diff Render.cpp @ 2251:47bcb700b74b

for StackLight_TerrainFace
author Ritor1
date Wed, 26 Feb 2014 20:10:43 +0600
parents 8817c398b792
children 2e02c384c62b
line wrap: on
line diff
--- a/Render.cpp	Tue Feb 25 20:02:06 2014 +0600
+++ b/Render.cpp	Wed Feb 26 20:10:43 2014 +0600
@@ -226,6 +226,7 @@
 {
   int v6; // ecx@8
   struct Polygon *pTilePolygon; // ebx@8
+  float a3a;
 
   //warning: the game uses CW culling by default, ccw is incosistent
   pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW);
@@ -319,6 +320,12 @@
                   (norm->y * (float)pOutdoor->vSunlight.y / 65536.0) -
                   (norm->z * (float)pOutdoor->vSunlight.z / 65536.0));
       pTilePolygon->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f);
+      //if ( norm_idx < 0 || norm_idx > uNumTerrainNormals - 1 )
+        //norm = 0;
+      //else
+        //norm = &pTerrainNormals[norm_idx];
+      //pGame->pLightmapBuilder->StackLights_TerrainFace(norm, &a3a, array_50AC10, 4, 1);
+      //pDecalBuilder->_49BE8A(pTilePolygon, norm, &a3a, array_50AC10, 4, 1);
 //-----------------------------------------------------------------------------------------------
 
       ++pODMRenderParams->uNumPolygons;
@@ -8476,18 +8483,18 @@
       {
         //t = near_clip - v0.x / v1.x - v0.x    (формула получения точки пересечения отрезка с плоскостью)
         t = (8.0 - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i + 1].vWorldViewPosition.x - array_50AC10[i].vWorldViewPosition.x);
-        array_507D30[out_num_vertices].vWorldViewPosition.y = (array_50AC10[i + 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y) * t + array_50AC10[i].vWorldViewPosition.y;
-        array_507D30[out_num_vertices].vWorldViewPosition.z = (array_50AC10[i + 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z) * t + array_50AC10[i].vWorldViewPosition.z;
-        array_507D30[out_num_vertices].u = (array_50AC10[i + 1].u - array_50AC10[i].u) * t + array_50AC10[i].u;
-        array_507D30[out_num_vertices].v = (array_50AC10[i + 1].v - array_50AC10[i].v) * t + array_50AC10[i].v;
+        array_507D30[out_num_vertices].vWorldViewPosition.y = fixpoint_mul((array_50AC10[i + 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y), t) + array_50AC10[i].vWorldViewPosition.y;
+        array_507D30[out_num_vertices].vWorldViewPosition.z = fixpoint_mul((array_50AC10[i + 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z), t) + array_50AC10[i].vWorldViewPosition.z;
+        array_507D30[out_num_vertices].u = fixpoint_mul((array_50AC10[i + 1].u - array_50AC10[i].u), t) + array_50AC10[i].u;
+        array_507D30[out_num_vertices].v = fixpoint_mul((array_50AC10[i + 1].v - array_50AC10[i].v), t) + array_50AC10[i].v;
       }
       else
       {
         t = (8.0 - array_50AC10[i + 1].vWorldViewPosition.x) / (array_50AC10[i].vWorldViewPosition.x - array_50AC10[i + 1].vWorldViewPosition.x);
-        array_507D30[out_num_vertices].vWorldViewPosition.y = (array_50AC10[i].vWorldViewPosition.y - array_50AC10[i + 1].vWorldViewPosition.y) * t + array_50AC10[i + 1].vWorldViewPosition.y;
-        array_507D30[out_num_vertices].vWorldViewPosition.z = (array_50AC10[i].vWorldViewPosition.z - array_50AC10[i + 1].vWorldViewPosition.z) * t + array_50AC10[i + 1].vWorldViewPosition.z;
-        array_507D30[out_num_vertices].u = (array_50AC10[i].u - array_50AC10[i + 1].u) * t + array_50AC10[i + 1].u;
-        array_507D30[out_num_vertices].v = (array_50AC10[i].v - array_50AC10[i + 1].v) * t + array_50AC10[i + 1].v;
+        array_507D30[out_num_vertices].vWorldViewPosition.y = fixpoint_mul((array_50AC10[i].vWorldViewPosition.y - array_50AC10[i + 1].vWorldViewPosition.y), t) + array_50AC10[i + 1].vWorldViewPosition.y;
+        array_507D30[out_num_vertices].vWorldViewPosition.z = fixpoint_mul((array_50AC10[i].vWorldViewPosition.z - array_50AC10[i + 1].vWorldViewPosition.z), t) + array_50AC10[i + 1].vWorldViewPosition.z;
+        array_507D30[out_num_vertices].u = fixpoint_mul((array_50AC10[i].u - array_50AC10[i + 1].u), t) + array_50AC10[i + 1].u;
+        array_507D30[out_num_vertices].v = fixpoint_mul((array_50AC10[i].v - array_50AC10[i + 1].v), t) + array_50AC10[i + 1].v;
       }
       array_507D30[out_num_vertices].vWorldViewPosition.x = 8.0;
       array_507D30[out_num_vertices]._rhw = 1.0 / 8.0;