Prechádzať zdrojové kódy

Fixed up the GL side, and tweaked some shader pathing to not cause issues with the new common shader placement.

Areloch 8 rokov pred
rodič
commit
9bf9184628

+ 12 - 0
Templates/BaseGame/game/core/gfxData/shaders.cs

@@ -135,6 +135,18 @@ singleton ShaderData( VolumetricFogReflectionShader )
 	
    OGLVertexShaderFile  = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogRefl.glsl";
+
+   pixVersion = 3.0;
+};
+singleton ShaderData( CubemapSaveShader )
+{
+   DXVertexShaderFile = "shaders/common/cubemapSaveV.hlsl";
+   DXPixelShaderFile = "shaders/common/cubemapSaveP.hlsl";
+	
+   OGLVertexShaderFile  = "shaders/common/gl/cubemapSaveV.glsl";
+   OGLPixelShaderFile   = "shaders/common/gl/cubemapSaveP.glsl";
+   
+   samplerNames[0] = "$cubemapTex";
 	
    pixVersion = 3.0;
 };

+ 1 - 1
Templates/BaseGame/game/core/globals.cs

@@ -72,7 +72,7 @@ $pref::Video::autoDetect = 1;
 
 // This is the path used by ShaderGen to cache procedural shaders.  If left
 // blank ShaderGen will only cache shaders to memory and not to disk.
-$shaderGen::cachePath = "data/shaders";
+$shaderGen::cachePath = "data/shaderCache";
 
 // Uncomment to disable ShaderGen, useful when debugging
 //$ShaderGen::GenNewShaders = false;

+ 10 - 4
Templates/BaseGame/game/core/helperFunctions.cs

@@ -166,7 +166,7 @@ function recursiveLoadDatablockFiles( %datablockFiles, %previousErrors )
    %reloadDatablockFiles.delete();         
 }
 
-function getPrefpath()
+function getUserPath()
 {
 	%temp = getUserHomeDirectory();  
 	echo(%temp);  
@@ -176,19 +176,25 @@ function getPrefpath()
 		echo(%temp);
 		if(!isDirectory(%temp)) 
 		{
-			$prefpath = "data";  
+			%userPath = "data";  
 		}
 		else  
 		{
 			//put it in appdata/roaming
-			$prefpath = %temp @ "/" @ $appName @ "/preferences";  
+			%userPath = %temp @ "/" @ $appName;  
 		}  
 	}  
 	else  
 	{  
 		//put it in user/documents  
-		$prefPath = %temp @ "/" @ $appName @ "/preferences";  
+		%userPath = %temp @ "/" @ $appName;  
 	}
+	return %userPath;
+}
+
+function getPrefpath()
+{
+   $prefPath = getUserPath() @ "/preferences";
 	return $prefPath;
 }
 

+ 2 - 2
Templates/BaseGame/game/core/lighting/advanced/deferredShading.cs

@@ -1,6 +1,6 @@
 singleton ShaderData( ClearGBufferShader )
 {
-   DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferV.hlsl";
    DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferP.hlsl";
 
    OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
@@ -11,7 +11,7 @@ singleton ShaderData( ClearGBufferShader )
 
 singleton ShaderData( DeferredColorShader )
 {
-   DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferV.hlsl";
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.hlsl";
    DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/deferredColorShaderP.hlsl";
    
    OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";

+ 0 - 5
Templates/BaseGame/game/core/main.cs

@@ -41,11 +41,6 @@ $Core::UnAvailableTexturePath = "core/images/unavailable";
 $Core::WarningTexturePath = "core/images/warnMat";
 $Core::CommonShaderPath = "core/shaders";
 
-/// This is the path used by ShaderGen to cache procedural
-/// shaders.  If left blank ShaderGen will only cache shaders
-/// to memory and not to disk.
-$shaderGen::cachePath = "data/shaders";
-
 exec("./helperFunctions.cs");
 
 // We need some of the default GUI profiles in order to get the canvas and

+ 1 - 1
Templates/BaseGame/game/core/postFX/GammaPostFX.cs

@@ -25,7 +25,7 @@ singleton ShaderData( GammaShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/gammaP.hlsl";
 
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/gammaP.glsl";
    
    samplerNames[0] = "$backBuffer";

+ 1 - 1
Templates/BaseGame/game/core/postFX/MotionBlurFx.cs

@@ -25,7 +25,7 @@ singleton ShaderData( PFX_MotionBlurShader )
    DXVertexShaderFile   = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";  //we use the bare-bones postFxV.hlsl
    DXPixelShaderFile    = $Core::CommonShaderPath @ "/postFX/motionBlurP.hlsl";  //new pixel shader
    
-   OGLVertexShaderFile   = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile    = $Core::CommonShaderPath @ "/postFX/gl/motionBlurP.glsl";
    
    samplerNames[0] = "$backBuffer";

+ 1 - 1
Templates/BaseGame/game/core/postFX/caustics.cs

@@ -38,7 +38,7 @@ singleton ShaderData( PFX_CausticsShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/caustics/causticsP.hlsl";
          
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/caustics/gl/causticsP.glsl";
       
    samplerNames[0] = "$prepassTex";

+ 1 - 1
Templates/BaseGame/game/core/postFX/chromaticLens.cs

@@ -48,7 +48,7 @@ singleton ShaderData( PFX_ChromaticLensShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/chromaticLens.hlsl"; 
    
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/chromaticLens.glsl";
    
    samplerNames[0] = "$backBuffer";

+ 2 - 2
Templates/BaseGame/game/core/postFX/edgeAA.cs

@@ -37,7 +37,7 @@ singleton ShaderData( PFX_EdgeAADetectShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/edgeaa/edgeDetectP.hlsl";
          
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeDetectP.glsl";
       
    samplerNames[0] = "$prepassBuffer";
@@ -64,7 +64,7 @@ singleton ShaderData( PFX_EdgeAADebugShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/edgeaa/dbgEdgeDisplayP.hlsl";
          
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl";
       
    samplerNames[0] = "$edgeBuffer";

+ 1 - 1
Templates/BaseGame/game/core/postFX/flash.cs

@@ -25,7 +25,7 @@ singleton ShaderData( PFX_FlashShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/flashP.hlsl";
    
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/flashP.glsl";
    
    samplerNames[0] = "$backBuffer";

+ 2 - 2
Templates/BaseGame/game/core/postFX/fog.cs

@@ -29,7 +29,7 @@ singleton ShaderData( FogPassShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/fogP.hlsl";
          
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/fogP.glsl";
             
    samplerNames[0] = "$prepassTex";
@@ -76,7 +76,7 @@ singleton ShaderData( UnderwaterFogPassShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/underwaterFogP.hlsl";
          
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/underwaterFogP.glsl";
             
    samplerNames[0] = "$prepassTex";

+ 8 - 8
Templates/BaseGame/game/core/postFX/hdr.cs

@@ -77,7 +77,7 @@ singleton ShaderData( HDR_BrightPassShader )
 {
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/hdr/brightPassFilterP.hlsl";   
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/hdr/gl/brightPassFilterP.glsl";
    
    samplerNames[0] = "$inputTex";
@@ -102,7 +102,7 @@ singleton ShaderData( HDR_BloomGaussBlurHShader )
 {
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/hdr/bloomGaussBlurHP.hlsl";
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/hdr/gl/bloomGaussBlurHP.glsl";
    
    samplerNames[0] = "$inputTex";
@@ -114,7 +114,7 @@ singleton ShaderData( HDR_BloomGaussBlurVShader )
 {
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/hdr/bloomGaussBlurVP.hlsl";
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/hdr/gl/bloomGaussBlurVP.glsl";
    
    samplerNames[0] = "$inputTex";
@@ -126,7 +126,7 @@ singleton ShaderData( HDR_SampleLumShader )
 {
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/hdr/sampleLumInitialP.hlsl";
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/hdr/gl/sampleLumInitialP.glsl";
    
    samplerNames[0] = "$inputTex";
@@ -138,7 +138,7 @@ singleton ShaderData( HDR_DownSampleLumShader )
 {
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/hdr/sampleLumIterativeP.hlsl";
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/hdr/gl/sampleLumIterativeP.glsl";
    
    samplerNames[0] = "$inputTex";
@@ -150,7 +150,7 @@ singleton ShaderData( HDR_CalcAdaptedLumShader )
 {
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/hdr/calculateAdaptedLumP.hlsl";
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/hdr/gl/calculateAdaptedLumP.glsl";
    
    samplerNames[0] = "$currLum";
@@ -163,7 +163,7 @@ singleton ShaderData( HDR_CombineShader )
 {
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/hdr/finalPassCombineP.hlsl";
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/hdr/gl/finalPassCombineP.glsl";
    
    samplerNames[0] = "$sceneTex";
@@ -477,7 +477,7 @@ singleton ShaderData( LuminanceVisShader )
 {
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/hdr/luminanceVisP.hlsl";
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/hdr/gl/luminanceVisP.glsl";
    
    samplerNames[0] = "$inputTex";

+ 2 - 2
Templates/BaseGame/game/core/postFX/lightRay.cs

@@ -35,7 +35,7 @@ singleton ShaderData( LightRayOccludeShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/lightRay/lightRayOccludeP.hlsl";
    
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayOccludeP.glsl";
    
    samplerNames[0] = "$backBuffer";
@@ -49,7 +49,7 @@ singleton ShaderData( LightRayShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/lightRay/lightRayP.hlsl";
    
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayP.glsl";
    
    samplerNames[0] = "$frameSampler";

+ 1 - 1
Templates/BaseGame/game/core/postFX/ssao.cs

@@ -153,7 +153,7 @@ singleton ShaderData( SSAOShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/ssao/SSAO_P.hlsl";            
    
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_P.glsl";
 
    samplerNames[0] = "$prepassMap";

+ 1 - 1
Templates/BaseGame/game/core/postFX/turbulence.cs

@@ -35,7 +35,7 @@ singleton ShaderData( PFX_TurbulenceShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/turbulenceP.hlsl";
            
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/turbulenceP.glsl";
            
    samplerNames[0] = "$inputTex";

+ 1 - 1
Templates/BaseGame/game/core/postFX/vignette.cs

@@ -28,7 +28,7 @@ singleton ShaderData( VignetteShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/vignette/VignetteP.hlsl";
    
-   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
    OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/vignette/gl/VignetteP.glsl";
    
    samplerNames[0] = "$backBuffer";

+ 2 - 2
Templates/BaseGame/game/core/postFx.cs

@@ -25,8 +25,8 @@ singleton ShaderData( PFX_PassthruShader )
    DXVertexShaderFile 	= $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
    DXPixelShaderFile 	= $Core::CommonShaderPath @ "/postFX/passthruP.hlsl";
          
-//   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/postFxV.glsl";
-//   OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/passthruP.glsl";
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
+   OGLPixelShaderFile   = $Core::CommonShaderPath @ "/postFX/gl/passthruP.glsl";
       
    samplerNames[0] = "$inputTex";
    

+ 1 - 1
Templates/BaseGame/game/core/shaders/lighting/basic/gl/shadowFilterV.glsl

@@ -20,7 +20,7 @@
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
 
-#include "../../../../../../shaders/common/gl/torque.glsl"
+#include "../../../gl/torque.glsl"
 
 in vec4 vPosition;
 in vec2 vTexCoord0;

+ 1 - 1
Templates/BaseGame/game/core/shaders/lighting/basic/shadowFilterP.hlsl

@@ -20,7 +20,7 @@
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
 
-#include "shaders/common/postFx/postFx.hlsl"
+#include "../../postFx/postFx.hlsl"
 
 TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0);
 

+ 2 - 2
Templates/BaseGame/game/core/shaders/lighting/basic/shadowFilterV.hlsl

@@ -20,8 +20,8 @@
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
 
-#include "../../../../../../shaders/common/postFx/postFx.hlsl"
-#include "../../../../../../shaders/common/torque.hlsl"
+#include "../../postFx/postFx.hlsl"
+#include "../../torque.hlsl"
 
 float4 rtParams0;