diff Render.cpp @ 595:55d6b756e03a

Cave textures
author Nomad
date Wed, 06 Mar 2013 16:51:23 +0200
parents 7e8f5124056c
children f2697c2b4109
line wrap: on
line diff
--- a/Render.cpp	Wed Mar 06 16:14:21 2013 +0200
+++ b/Render.cpp	Wed Mar 06 16:51:23 2013 +0200
@@ -7800,14 +7800,14 @@
   double v17; // st6@10
   //char v18; // zf@10
   Texture *v19; // edx@10
-  Texture *v23; // edx@16
-  char *v24; // ecx@16
-  char *v25; // eax@16
-  double v26; // st6@17
-  int v27; // esi@17
-  double v28; // st6@17
-  unsigned int v33; // ecx@18
-  char *v34; // eax@19
+  //Texture *v23; // edx@16
+  //char *v24; // ecx@16
+  //char *v25; // eax@16
+  //double v26; // st6@17
+  //int v27; // esi@17
+  //double v28; // st6@17
+  //unsigned int v33; // ecx@18
+  //char *v34; // eax@19
   //Texture *v45; // edx@23
   //char *v46; // ecx@23
   //char *v47; // eax@23
@@ -7908,36 +7908,47 @@
     }
     else
     {
-      __debugbreak();
-        if ( (signed int)uNumVertices > 0 )
-        {
-          v23 = pTex;
-          v24 = (char *)&array_507D30[0].vWorldViewPosition;
-          v25 = (char *)&d3d_vertex_buffer[0].pos.y;
-          pTex = (Texture *)uNumVertices;
-          uint v18;
-          do
-          {
-            v26 = *(float *)v24 * 0.061758894;
-            v27 = *((int *)v24 + 3);
-            *((int *)v25 + 4) = 0;
-            *((int *)v25 - 1) = v27;
-            *(int *)v25 = *((int *)v24 + 4);
-            *((int *)v25 + 3) = uColor;
-            v25 += 32;
-            *((float *)v25 - 7) = 1.0 - 1.0 / v26;
-            v28 = 1.0 / *(float *)v24;
-            v24 += 48;
-            v18 = pTex == (Texture *)1;
-            pTex = (Texture *)((char *)pTex - 1);
-            *((float *)v25 - 6) = v28;
+      for (uint i = 0; i < uNumVertices; ++i)
+      {
+        d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX;
+        d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY;
+        d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894);
+        d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x;
+        d3d_vertex_buffer[i].diffuse = uColor;
+        d3d_vertex_buffer[i].specular = 0;
+        d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth;
+        d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight;
+      }
+      //__debugbreak();
+        //if ( (signed int)uNumVertices > 0 )
+        //{
+          //v23 = pTex;
+          //v24 = (char *)&array_507D30[0].vWorldViewPosition;
+          //v25 = (char *)&d3d_vertex_buffer[0].pos.y;
+          //pTex = (Texture *)uNumVertices;
+          //uint v18;
+          //do
+          //{
+            //v26 = *(float *)v24 * 0.061758894;
+            //v27 = *((int *)v24 + 3);
+            //*((int *)v25 + 4) = 0;
+            //*((int *)v25 - 1) = v27;
+            //*(int *)v25 = *((int *)v24 + 4);
+            //*((int *)v25 + 3) = uColor;
+            //v25 += 32;
+            //*((float *)v25 - 7) = 1.0 - 1.0 / v26;
+            //v28 = 1.0 / *(float *)v24;
+            //v24 += 48;
+            //v18 = pTex == (Texture *)1;
+            //pTex = (Texture *)((char *)pTex - 1);
+            //*((float *)v25 - 6) = v28;
             //a3 = (BLVFace *)v23->uTextureWidth;
-            *((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth;
+            //*((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth;
             //a3 = (BLVFace *)v23->uTextureHeight;
-            *((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight;
-          }
-          while ( !v18 );
-        }
+            //*((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight;
+          //}
+          //while ( !v18 );
+        //}
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false));
         ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
         ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr));
@@ -7946,9 +7957,13 @@
                 d3d_vertex_buffer,
                 uNumVertices,
                 28));
-        ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1));
+
+        ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE));
         pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0);
-        v33 = uNumVertices;
+
+        for (uint i = 0; i < uNumVertices; ++i)
+          d3d_vertex_buffer[i].diffuse = uCorrectedColor;
+        /*v33 = uNumVertices;
         if ( (signed int)uNumVertices > 0 )
         {
           v34 = (char *)&d3d_vertex_buffer[0].diffuse;
@@ -7959,7 +7974,7 @@
             --v33;
           }
           while ( v33 );
-        }
+        }*/
         ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex));
         ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE));