Browse Source

implement draw_polygon

georges 25 years ago
parent
commit
cce8ca381d
1 changed files with 35 additions and 1 deletions
  1. 35 1
      panda/src/dxgsg/dxGraphicsStateGuardian.cxx

+ 35 - 1
panda/src/dxgsg/dxGraphicsStateGuardian.cxx

@@ -400,7 +400,7 @@ init_dx(  LPDIRECTDRAW7		context,
 
 
   if(((D3DDevDesc.dpcTriCaps.dwSrcBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS) ||
   if(((D3DDevDesc.dpcTriCaps.dwSrcBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS) ||
      ((D3DDevDesc.dpcTriCaps.dwDestBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS)) {
      ((D3DDevDesc.dpcTriCaps.dwDestBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS)) {
-         dxgsg_cat.error() << "device is missing texture blending capabilities, blending may not work correctly\n";
+         dxgsg_cat.error() << "device is missing alpha blending capabilities, blending may not work correctly\n";
   }
   }
 
 
   if(!(D3DDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_TRANSPARENCY)) {
   if(!(D3DDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_TRANSPARENCY)) {
@@ -418,6 +418,11 @@ init_dx(  LPDIRECTDRAW7		context,
          dxgsg_cat.error() << "device is missing tri-linear mipmap filtering capability, texture mipmaps may not supported!!!\n";
          dxgsg_cat.error() << "device is missing tri-linear mipmap filtering capability, texture mipmaps may not supported!!!\n";
   }
   }
 
 
+#define REQUIRED_TEXBLENDCAPS (D3DTEXOPCAPS_MODULATE | D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2)
+  if((D3DDevDesc.dwTextureOpCaps & REQUIRED_TEXBLENDCAPS)!=REQUIRED_TEXBLENDCAPS) {
+         dxgsg_cat.error() << "device is missing some required texture blending capabilities, texture blending may not work properly!!!\n";
+  }
+
   SetRect(&clip_rect, 0,0,0,0);		// no clip rect set
   SetRect(&clip_rect, 0,0,0,0);		// no clip rect set
 
 
   _d3dDevice->SetRenderState(D3DRENDERSTATE_AMBIENTMATERIALSOURCE, D3DMCS_COLOR1);
   _d3dDevice->SetRenderState(D3DRENDERSTATE_AMBIENTMATERIALSOURCE, D3DMCS_COLOR1);
@@ -980,6 +985,12 @@ draw_line(const GeomLine* geom) {
   dxgsg_cat.debug() << "draw_line()" << endl;
   dxgsg_cat.debug() << "draw_line()" << endl;
 #endif
 #endif
 
 
+#ifdef _DEBUG
+     if(geom->get_width()!=1.0f) {
+         dxgsg_cat.error() << "DX does not support drawing lines with a non-1.0 pixel width!!\n";
+     }
+#endif
+
 #ifdef WBD_GL_MODE
 #ifdef WBD_GL_MODE
   call_glLineWidth(geom->get_width());
   call_glLineWidth(geom->get_width());
  
  
@@ -1078,6 +1089,12 @@ draw_linestrip(const GeomLinestrip* geom) {
   dxgsg_cat.debug() << "draw_linestrip()" << endl;
   dxgsg_cat.debug() << "draw_linestrip()" << endl;
 #endif
 #endif
 
 
+#ifdef _DEBUG
+     if(geom->get_width()!=1.0f) {
+         dxgsg_cat.error() << "DX does not support drawing lines with a non-1.0 pixel width!!\n";
+     }
+#endif
+
 #ifdef WBD_GL_MODE
 #ifdef WBD_GL_MODE
   call_glLineWidth(geom->get_width());
   call_glLineWidth(geom->get_width());
 
 
@@ -1200,6 +1217,19 @@ draw_polygon(const GeomPolygon *geom) {
   dxgsg_cat.debug() << "draw_polygon()" << endl;
   dxgsg_cat.debug() << "draw_polygon()" << endl;
 #endif
 #endif
 
 
+/*  wireframe polygon will be drawn as multu-tri trifan until I get this casting issue straightened out
+   DWORD rstate;
+   _d3dDevice->GetRenderState(D3DRENDERSTATE_FILLMODE, &rstate);
+   if(rstate!=D3DFILL_WIREFRAME) {
+       draw_multitri(geom, D3DPT_TRIANGLEFAN);
+   } else {
+       Geom *gp=dynamic_cast<Geom *>(geom);  doesnt work
+       draw_linestrip(gp);
+   }
+*/   
+
+//   draw_multitri(geom, D3DPT_TRIANGLEFAN);
+
 #ifdef WBD_GL_MODE
 #ifdef WBD_GL_MODE
   int nprims = geom->get_num_prims();
   int nprims = geom->get_num_prims();
   const int *plen = geom->get_lengths();
   const int *plen = geom->get_lengths();
@@ -1903,6 +1933,10 @@ draw_multitri(const Geom *geom, D3DPRIMITIVETYPE tri_id)
 void DXGraphicsStateGuardian::
 void DXGraphicsStateGuardian::
 draw_sphere(const GeomSphere *geom) {
 draw_sphere(const GeomSphere *geom) {
   activate();
   activate();
+
+#ifdef _DEBUG
+  dxgsg_cat.debug() << "draw_sphere() unimplemented in DX!!\n";
+#endif
  
  
 #ifdef GSG_VERBOSE
 #ifdef GSG_VERBOSE
   dxgsg_cat.debug() << "draw_sphere()" << endl;
   dxgsg_cat.debug() << "draw_sphere()" << endl;