Bläddra i källkod

Merge pull request #1371 from Azaezel/afxZodiacFindings

Afx zodiac findings
Brian Roberts 7 månader sedan
förälder
incheckning
cd2213de36
20 ändrade filer med 107 tillägg och 47 borttagningar
  1. 1 1
      Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.cpp
  2. 2 4
      Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.cpp
  3. 2 4
      Engine/source/afx/afxZodiacPolysoupRenderer_T3D.cpp
  4. 2 4
      Engine/source/afx/afxZodiacTerrainRenderer_T3D.cpp
  5. 3 3
      Engine/source/afx/arcaneFX.cpp
  6. 2 3
      Engine/source/afx/ce/afxBillboard_T3D.cpp
  7. 16 0
      Engine/source/afx/ce/afxZodiac.cpp
  8. 1 1
      Engine/source/afx/ce/afxZodiacPlane_T3D.cpp
  9. 59 5
      Templates/BaseGame/game/core/rendering/scripts/gfxData/shaders.tscript
  10. 5 8
      Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript
  11. 3 3
      Templates/BaseGame/game/core/rendering/shaders/AFX/afxPostFX_Highlight_ALT_P.hlsl
  12. 3 3
      Templates/BaseGame/game/core/rendering/shaders/AFX/afxPostFX_Highlight_P.hlsl
  13. 1 1
      Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Interior_P.hlsl
  14. 1 1
      Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Interior_V.hlsl
  15. 1 1
      Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Polysoup_P.hlsl
  16. 1 1
      Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Polysoup_V.hlsl
  17. 1 1
      Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Terrain_P.hlsl
  18. 1 1
      Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Terrain_V.hlsl
  19. 1 1
      Templates/BaseGame/game/core/rendering/shaders/AFX/gl/afxZodiac_Polysoup_V.glsl
  20. 1 1
      Templates/BaseGame/game/core/rendering/shaders/AFX/gl/afxZodiac_Terrain_V.glsl

+ 1 - 1
Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.cpp

@@ -108,7 +108,7 @@ void afxZodiacGroundPlaneRenderer::initShader()
    d.zDefined = false;
    d.zEnable = true;
    d.zWriteEnable = false;
-   d.zFunc = GFXCmpLessEqual;
+   d.zFunc = GFXCmpGreaterEqual;
    d.zSlopeBias = 0;
    d.alphaDefined = true;
    d.alphaTestEnable = true; 

+ 2 - 4
Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.cpp

@@ -105,10 +105,8 @@ void afxZodiacMeshRoadRenderer::initShader()
    d.cullDefined = true;
    d.blendDefined = true;
    d.blendEnable = true;
-   d.zDefined = false;
-   d.zEnable = true;
-   d.zWriteEnable = false;
-   d.zFunc = GFXCmpLessEqual;
+   d.setZReadWrite(true, false);
+   d.zFunc = GFXCmpGreaterEqual;
    d.zSlopeBias = 0;
    d.alphaDefined = true;
    d.alphaTestEnable = true; 

+ 2 - 4
Engine/source/afx/afxZodiacPolysoupRenderer_T3D.cpp

@@ -105,10 +105,8 @@ void afxZodiacPolysoupRenderer::initShader()
    d.cullDefined = true;
    d.blendDefined = true;
    d.blendEnable = true;
-   d.zDefined = false;
-   d.zEnable = true;
-   d.zWriteEnable = false;
-   d.zFunc = GFXCmpLessEqual;
+   d.setZReadWrite(true, false);
+   d.zFunc = GFXCmpGreaterEqual;
    d.zSlopeBias = 0;
    d.alphaDefined = true;
    d.alphaTestEnable = true; 

+ 2 - 4
Engine/source/afx/afxZodiacTerrainRenderer_T3D.cpp

@@ -115,10 +115,8 @@ void afxZodiacTerrainRenderer::initShader()
    d.cullDefined = true;
    d.blendDefined = true;
    d.blendEnable = true;
-   d.zDefined = false;
-   d.zEnable = true;
-   d.zWriteEnable = false;
-   d.zFunc = GFXCmpLessEqual;
+   d.setZReadWrite(true, false);
+   d.zFunc = GFXCmpGreaterEqual;
    d.zSlopeBias = 0;
    d.alphaDefined = true;
    d.alphaTestEnable = true; 

+ 3 - 3
Engine/source/afx/arcaneFX.cpp

@@ -108,9 +108,9 @@ U32              arcaneFX::sTargetSelectionTimeoutMS = 500;
 bool             arcaneFX::sClickToTargetSelf = false;
 U32              arcaneFX::sMissileCollisionMask = 0;
 StringTableEntry arcaneFX::sParameterFieldPrefix = 0;
-F32              arcaneFX::sTerrainZodiacZBias = -0.00025f;
-F32              arcaneFX::sInteriorZodiacZBias = -0.0001f;
-F32              arcaneFX::sPolysoupZodiacZBias = -0.0001f;
+F32              arcaneFX::sTerrainZodiacZBias = 0.00025f;
+F32              arcaneFX::sInteriorZodiacZBias = 0.0001f;
+F32              arcaneFX::sPolysoupZodiacZBias = 0.0001f;
 U32              arcaneFX::master_choreographer_id = 1;
 U16              arcaneFX::master_scope_id = 1;
 bool             arcaneFX::is_shutdown = true;

+ 2 - 3
Engine/source/afx/ce/afxBillboard_T3D.cpp

@@ -67,9 +67,8 @@ void afxBillboard::_renderBillboard(ObjectRenderInst *ri, SceneRenderState* stat
     desc.alphaTestRef = 1;
     desc.alphaTestFunc = GFXCmpGreaterEqual;
     
-    desc.setZReadWrite(true);
-    desc.zFunc = GFXCmpLessEqual;
-    desc.zWriteEnable = false;
+    desc.setZReadWrite(true, false);
+    desc.zFunc = GFXCmpGreaterEqual;
 
     desc.samplersDefined = true;
 

+ 16 - 0
Engine/source/afx/ce/afxZodiac.cpp

@@ -326,6 +326,22 @@ bool afxZodiacData::preload(bool server, String &errorStr)
   if (vert_range.x == 0.0f && vert_range.y == 0.0f)
     vert_range.x = vert_range.y = radius_xy;
 
+  if (mTextureAssetId != StringTable->EmptyString())
+  {
+     mTextureAsset = mTextureAssetId;
+     if (mTextureAsset.notNull())
+     {
+        if (getTexture() != StringTable->EmptyString() && mTextureName != StringTable->insert("texhandle"))
+        {
+           if (mTextureAsset.notNull())
+           {
+              mTextureAsset->getChangedSignal().notify(this, &afxZodiacData::onImageChanged);
+           }
+
+           mTexture.set(getTexture(), mTextureProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));
+        }
+     }
+  }
   return true;
 }
 

+ 1 - 1
Engine/source/afx/ce/afxZodiacPlane_T3D.cpp

@@ -125,7 +125,7 @@ void afxZodiacPlane::_renderZodiacPlane(ObjectRenderInst *ri, SceneRenderState*
     desc.setAlphaTest(true, GFXCmpGreater, 0);
 
     desc.setZReadWrite(true);
-    desc.zFunc = GFXCmpLessEqual;
+    desc.zFunc = GFXCmpGreaterEqual;
     desc.zWriteEnable = false;
     desc.samplersDefined = true;
 

+ 59 - 5
Templates/BaseGame/game/core/rendering/scripts/gfxData/shaders.tscript

@@ -140,11 +140,11 @@ singleton ShaderData( VolumetricFogReflectionShader )
 };
 singleton ShaderData( CubemapSaveShader )
 {
-   DXVertexShaderFile = "shaders/common/cubemapSaveV.hlsl";
-   DXPixelShaderFile = "shaders/common/cubemapSaveP.hlsl";
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/common/cubemapSaveV.hlsl";
+   DXPixelShaderFile = $Core::CommonShaderPath @ "/common/cubemapSaveP.hlsl";
 	
-   OGLVertexShaderFile  = "shaders/common/gl/cubemapSaveV.glsl";
-   OGLPixelShaderFile   = "shaders/common/gl/cubemapSaveP.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/common/gl/cubemapSaveV.glsl";
+   OGLPixelShaderFile   = $Core::CommonShaderPath @ "/common/gl/cubemapSaveP.glsl";
    
    samplerNames[0] = "$cubemapTex";
 	
@@ -187,4 +187,58 @@ singleton ShaderData( ThickLineGUI )
    OGLPixelShaderFile    = $Core::CommonShaderPath @ "/fixedFunction/gl/thickLineP.glsl";
       
    pixVersion = 3.0;   
-};
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
+// Arcane-FX - Shared AFX Shaders
+//
+// All of the non-zodiac shaders support alpha-fading.
+//
+// Copyright (C) Faust Logic, Inc.
+//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
+
+
+//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
+// Zodiac Shaders
+
+new ShaderData(afxZodiacTerrainShader)
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Terrain_V.hlsl";
+   DXPixelShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Terrain_P.hlsl";
+
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Terrain_V.glsl";
+   OGLPixelShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Terrain_P.glsl";
+
+   samplerNames[0] = "$zodiacMap";
+   
+   pixVersion = 1.1;
+};
+
+new ShaderData(afxZodiacInteriorShader)
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Interior_V.hlsl";
+   DXPixelShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Interior_P.hlsl";
+
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Interior_V.glsl";
+   OGLPixelShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Interior_P.glsl";
+
+   samplerNames[0] = "$zodiacMap";
+   
+   pixVersion = 1.1;
+};
+
+new ShaderData(afxZodiacPolysoupShader)
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Polysoup_V.hlsl";
+   DXPixelShaderFile = $Core::CommonShaderPath @ "/AFX/afxZodiac_Polysoup_P.hlsl";
+
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Polysoup_V.glsl";
+   OGLPixelShaderFile = $Core::CommonShaderPath @ "/AFX/gl/afxZodiac_Polysoup_P.glsl";
+
+   samplerNames[0] = "$zodiacMap";
+   
+   pixVersion = 1.1;
+};
+
+//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

+ 5 - 8
Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript

@@ -87,14 +87,11 @@ function initRenderManager()
    // Resolve format change token last.
    DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin)       { renderOrder = 1.7; stateToken = AL_FormatToken; } );
 
-   if(isObject(afxZodiacTerrainRenderer))
-   {
-      DiffuseRenderPassManager.addManager( new afxZodiacTerrainRenderer() { bintype = "TerrainZodiac"; renderOrder = 1.41; processAddOrder = 1.41; } );
-      DiffuseRenderPassManager.addManager( new afxZodiacPolysoupRenderer() { bintype = "PolysoupZodiac"; renderOrder = 1.42; processAddOrder = 1.42; } );
-      DiffuseRenderPassManager.addManager( new afxZodiacGroundPlaneRenderer() { bintype = "GroundPlaneZodiac"; renderOrder = 1.43; processAddOrder = 1.43; } );
-      DiffuseRenderPassManager.addManager( new afxZodiacMeshRoadRenderer() { bintype = "MeshRoadZodiac"; renderOrder = 1.44; processAddOrder = 1.44; } );
-      DiffuseRenderPassManager.addManager( new afxRenderHighlightMgr() { renderOrder = 1.55; processAddOrder = 1.55; } );  // for selection-highlighting
-   }
+   DiffuseRenderPassManager.addManager( new afxZodiacTerrainRenderer() { bintype = "TerrainZodiac"; renderOrder = 1.41; processAddOrder = 1.41; } );
+   DiffuseRenderPassManager.addManager( new afxZodiacPolysoupRenderer() { bintype = "PolysoupZodiac"; renderOrder = 1.42; processAddOrder = 1.42; } );
+   DiffuseRenderPassManager.addManager( new afxZodiacGroundPlaneRenderer() { bintype = "GroundPlaneZodiac"; renderOrder = 1.43; processAddOrder = 1.43; } );
+   DiffuseRenderPassManager.addManager( new afxZodiacMeshRoadRenderer() { bintype = "MeshRoadZodiac"; renderOrder = 1.44; processAddOrder = 1.44;} );
+   DiffuseRenderPassManager.addManager( new afxRenderHighlightMgr() { renderOrder = 1.55; processAddOrder = 1.55;} );  // for selection-highlighting      
 }
 
 /// This is the Default PostFX state block. Put here to prevent any missing object  

+ 3 - 3
Templates/BaseGame/game/core/rendering/shaders/AFX/afxPostFX_Highlight_ALT_P.hlsl

@@ -5,9 +5,9 @@
 // (currently not used for default AFX selection-highlighting)
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../common/shaderModel.hlsl"
-#include "../common/shaderModelAutoGen.hlsl"
-#include "shaders/common/postFX/postFx.hlsl"  
+#include "../shaderModel.hlsl"
+#include "../shaderModelAutoGen.hlsl"
+#include "../postFX/postFx.hlsl"  
   
 TORQUE_UNIFORM_SAMPLER2D(highlightBuffer,0);
 TORQUE_UNIFORM_SAMPLER2D(backBuffer,1);

+ 3 - 3
Templates/BaseGame/game/core/rendering/shaders/AFX/afxPostFX_Highlight_P.hlsl

@@ -4,9 +4,9 @@
 // http://www.garagegames.com/community/resources/view/17821
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../common/shaderModel.hlsl"
-#include "../common/shaderModelAutoGen.hlsl"
-#include "shaders/common/postFX/postFx.hlsl"  
+#include "../shaderModel.hlsl"
+#include "../shaderModelAutoGen.hlsl"
+#include "../postFX/postFx.hlsl"  
   
 TORQUE_UNIFORM_SAMPLER2D(highlightBuffer,0);
 TORQUE_UNIFORM_SAMPLER2D(backBuffer,1);

+ 1 - 1
Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Interior_P.hlsl

@@ -8,7 +8,7 @@
 // Copyright (C) Faust Logic, Inc.
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../common/shaderModel.hlsl"
+#include "../shaderModel.hlsl"
 
 struct ConnectData
 {

+ 1 - 1
Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Interior_V.hlsl

@@ -8,7 +8,7 @@
 // Copyright (C) Faust Logic, Inc.
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../common/shaderModel.hlsl"
+#include "../shaderModel.hlsl"
 struct VertData
 {
    float3 position        : POSITION;

+ 1 - 1
Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Polysoup_P.hlsl

@@ -8,7 +8,7 @@
 // Copyright (C) Faust Logic, Inc.
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../common/shaderModel.hlsl"
+#include "../shaderModel.hlsl"
 
 struct ConnectData
 {

+ 1 - 1
Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Polysoup_V.hlsl

@@ -8,7 +8,7 @@
 // Copyright (C) Faust Logic, Inc.
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../common/shaderModel.hlsl"
+#include "../shaderModel.hlsl"
 struct VertData
 {
    float3 position        : POSITION;

+ 1 - 1
Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Terrain_P.hlsl

@@ -8,7 +8,7 @@
 // Copyright (C) Faust Logic, Inc.
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../common/shaderModel.hlsl"
+#include "../shaderModel.hlsl"
 
 struct ConnectData
 {

+ 1 - 1
Templates/BaseGame/game/core/rendering/shaders/AFX/afxZodiac_Terrain_V.hlsl

@@ -8,7 +8,7 @@
 // Copyright (C) Faust Logic, Inc.
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../common/shaderModel.hlsl"
+#include "../shaderModel.hlsl"
 struct VertData
 {
    float3 position        : POSITION;

+ 1 - 1
Templates/BaseGame/game/core/rendering/shaders/AFX/gl/afxZodiac_Polysoup_V.glsl

@@ -8,7 +8,7 @@
 // Copyright (C) Faust Logic, Inc.
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../../common/gl/hlslCompat.glsl"
+#include "../../gl/hlslCompat.glsl"
 
 uniform mat4 modelview;
 

+ 1 - 1
Templates/BaseGame/game/core/rendering/shaders/AFX/gl/afxZodiac_Terrain_V.glsl

@@ -8,7 +8,7 @@
 // Copyright (C) Faust Logic, Inc.
 //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 
-#include "../../common/gl/hlslCompat.glsl"
+#include "../../gl/hlslCompat.glsl"
 
 uniform mat4 modelview;