Game Development Community

TGEA 1.7 BUG - detail texture, fog bug

by robo · in Torque Game Engine Advanced · 06/15/2008 (3:17 am) · 2 replies

When I removal detail texture, fog does not occur properly

like this

new TerrainBlock(MyTerrain) {
      canSaveDynamicFields = "1";
      scale = "1 1 1";
      terrainFile = "scriptsAndAssets/data/missions/simple.ter";

//omission ..

[b]//      detailTexture = "scriptsAndAssets/data/terrains/details/detail1";[/b]

//omission..

   };

www.myschoollife.co.kr/bug/fog1.jpg

#1
06/27/2008 (9:46 pm)
Fixed.

It was not setting the camera position shader constant if there was no detail map. Change the following about in the middle of TerrainRender::renderBlock():

if (!fixedfunction) // ADD THIS
       GFX->setVertexShaderConstF(20, &mCamPos.x, 1); // ADD THIS
 
   if (TerrainRender::mCurrentBlock->mDetailTextureHandle)
   {
      if (!fixedfunction)
      {
         GFX->setShader(sd->shader);
         Point4F detailConst(
            TerrainRender::mCurrentBlock->mDetailDistance / 2.0f,
            1.f / (TerrainRender::mCurrentBlock->mDetailDistance / 2.0f), 
            block->mDetailScale,
            0);
         GFX->setVertexShaderConstF(50, &detailConst[0], 1);
 
         // REMOVE THIS: GFX->setVertexShaderConstF(20, &mCamPos.x, 1);
#2
07/10/2008 (11:07 pm)
Thank you Tom

All working fine. Great!