#line 1 "./shader/../../_tool/KTGLTerrainG.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slKTGLTerrain.fxh" #line 1 "D://KTGL/include/terrain/KTGLTerrainShaderMacro.h" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainShaderOptions.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 1 "D://KTGL/include/shader/base/ShaderMacro.h" #line 1 "D://KTGL/shaderlib2/shader/include/slTypes.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 81 "D://KTGL/shaderlib2/shader/include/slTypes.fxh" typedef int SLT_INT; typedef int SLT_INT1; typedef int2 SLT_INT2; typedef int3 SLT_INT3; typedef int4 SLT_INT4; typedef int1x1 SLT_INT1x1; typedef int2x1 SLT_INT2x1; typedef int3x1 SLT_INT3x1; typedef int4x1 SLT_INT4x1; typedef int1x2 SLT_INT1x2; typedef int2x2 SLT_INT2x2; typedef int3x2 SLT_INT3x2; typedef int4x2 SLT_INT4x2; typedef int1x3 SLT_INT1x3; typedef int2x3 SLT_INT2x3; typedef int3x3 SLT_INT3x3; typedef int4x3 SLT_INT4x3; typedef int1x4 SLT_INT1x4; typedef int2x4 SLT_INT2x4; typedef int3x4 SLT_INT3x4; typedef int4x4 SLT_INT4x4; #line 88 typedef bool SLT_BOOL; typedef bool SLT_BOOL1; typedef bool2 SLT_BOOL2; typedef bool3 SLT_BOOL3; typedef bool4 SLT_BOOL4; typedef bool1x1 SLT_BOOL1x1; typedef bool2x1 SLT_BOOL2x1; typedef bool3x1 SLT_BOOL3x1; typedef bool4x1 SLT_BOOL4x1; typedef bool1x2 SLT_BOOL1x2; typedef bool2x2 SLT_BOOL2x2; typedef bool3x2 SLT_BOOL3x2; typedef bool4x2 SLT_BOOL4x2; typedef bool1x3 SLT_BOOL1x3; typedef bool2x3 SLT_BOOL2x3; typedef bool3x3 SLT_BOOL3x3; typedef bool4x3 SLT_BOOL4x3; typedef bool1x4 SLT_BOOL1x4; typedef bool2x4 SLT_BOOL2x4; typedef bool3x4 SLT_BOOL3x4; typedef bool4x4 SLT_BOOL4x4; #line 98 typedef half SLT_HALF; typedef half SLT_HALF1; typedef half2 SLT_HALF2; typedef half3 SLT_HALF3; typedef half4 SLT_HALF4; typedef half1x1 SLT_HALF1x1; typedef half2x1 SLT_HALF2x1; typedef half3x1 SLT_HALF3x1; typedef half4x1 SLT_HALF4x1; typedef half1x2 SLT_HALF1x2; typedef half2x2 SLT_HALF2x2; typedef half3x2 SLT_HALF3x2; typedef half4x2 SLT_HALF4x2; typedef half1x3 SLT_HALF1x3; typedef half2x3 SLT_HALF2x3; typedef half3x3 SLT_HALF3x3; typedef half4x3 SLT_HALF4x3; typedef half1x4 SLT_HALF1x4; typedef half2x4 SLT_HALF2x4; typedef half3x4 SLT_HALF3x4; typedef half4x4 SLT_HALF4x4; #line 105 typedef float SLT_FLOAT; typedef float SLT_FLOAT1; typedef float2 SLT_FLOAT2; typedef float3 SLT_FLOAT3; typedef float4 SLT_FLOAT4; typedef float1x1 SLT_FLOAT1x1; typedef float2x1 SLT_FLOAT2x1; typedef float3x1 SLT_FLOAT3x1; typedef float4x1 SLT_FLOAT4x1; typedef float1x2 SLT_FLOAT1x2; typedef float2x2 SLT_FLOAT2x2; typedef float3x2 SLT_FLOAT3x2; typedef float4x2 SLT_FLOAT4x2; typedef float1x3 SLT_FLOAT1x3; typedef float2x3 SLT_FLOAT2x3; typedef float3x3 SLT_FLOAT3x3; typedef float4x3 SLT_FLOAT4x3; typedef float1x4 SLT_FLOAT1x4; typedef float2x4 SLT_FLOAT2x4; typedef float3x4 SLT_FLOAT3x4; typedef float4x4 SLT_FLOAT4x4; #line 112 typedef uint SLT_UINT; typedef uint SLT_UINT1; typedef uint2 SLT_UINT2; typedef uint3 SLT_UINT3; typedef uint4 SLT_UINT4; typedef uint1x1 SLT_UINT1x1; typedef uint2x1 SLT_UINT2x1; typedef uint3x1 SLT_UINT3x1; typedef uint4x1 SLT_UINT4x1; typedef uint1x2 SLT_UINT1x2; typedef uint2x2 SLT_UINT2x2; typedef uint3x2 SLT_UINT3x2; typedef uint4x2 SLT_UINT4x2; typedef uint1x3 SLT_UINT1x3; typedef uint2x3 SLT_UINT2x3; typedef uint3x3 SLT_UINT3x3; typedef uint4x3 SLT_UINT4x3; typedef uint1x4 SLT_UINT1x4; typedef uint2x4 SLT_UINT2x4; typedef uint3x4 SLT_UINT3x4; typedef uint4x4 SLT_UINT4x4; #line 120 typedef float SLT_POINT; typedef float SLT_POINT1; typedef float2 SLT_POINT2; typedef float3 SLT_POINT3; typedef float4 SLT_POINT4; typedef float1x1 SLT_POINT1x1; typedef float2x1 SLT_POINT2x1; typedef float3x1 SLT_POINT3x1; typedef float4x1 SLT_POINT4x1; typedef float1x2 SLT_POINT1x2; typedef float2x2 SLT_POINT2x2; typedef float3x2 SLT_POINT3x2; typedef float4x2 SLT_POINT4x2; typedef float1x3 SLT_POINT1x3; typedef float2x3 SLT_POINT2x3; typedef float3x3 SLT_POINT3x3; typedef float4x3 SLT_POINT4x3; typedef float1x4 SLT_POINT1x4; typedef float2x4 SLT_POINT2x4; typedef float3x4 SLT_POINT3x4; typedef float4x4 SLT_POINT4x4; #line 128 typedef float SLT_VECTOR; typedef float SLT_VECTOR1; typedef float2 SLT_VECTOR2; typedef float3 SLT_VECTOR3; typedef float4 SLT_VECTOR4; typedef float1x1 SLT_VECTOR1x1; typedef float2x1 SLT_VECTOR2x1; typedef float3x1 SLT_VECTOR3x1; typedef float4x1 SLT_VECTOR4x1; typedef float1x2 SLT_VECTOR1x2; typedef float2x2 SLT_VECTOR2x2; typedef float3x2 SLT_VECTOR3x2; typedef float4x2 SLT_VECTOR4x2; typedef float1x3 SLT_VECTOR1x3; typedef float2x3 SLT_VECTOR2x3; typedef float3x3 SLT_VECTOR3x3; typedef float4x3 SLT_VECTOR4x3; typedef float1x4 SLT_VECTOR1x4; typedef float2x4 SLT_VECTOR2x4; typedef float3x4 SLT_VECTOR3x4; typedef float4x4 SLT_VECTOR4x4; #line 136 typedef half SLT_DIR; typedef half SLT_DIR1; typedef half2 SLT_DIR2; typedef half3 SLT_DIR3; typedef half4 SLT_DIR4; typedef half1x1 SLT_DIR1x1; typedef half2x1 SLT_DIR2x1; typedef half3x1 SLT_DIR3x1; typedef half4x1 SLT_DIR4x1; typedef half1x2 SLT_DIR1x2; typedef half2x2 SLT_DIR2x2; typedef half3x2 SLT_DIR3x2; typedef half4x2 SLT_DIR4x2; typedef half1x3 SLT_DIR1x3; typedef half2x3 SLT_DIR2x3; typedef half3x3 SLT_DIR3x3; typedef half4x3 SLT_DIR4x3; typedef half1x4 SLT_DIR1x4; typedef half2x4 SLT_DIR2x4; typedef half3x4 SLT_DIR3x4; typedef half4x4 SLT_DIR4x4; #line 144 typedef half SLT_COLOR; typedef half SLT_COLOR1; typedef half2 SLT_COLOR2; typedef half3 SLT_COLOR3; typedef half4 SLT_COLOR4; typedef half1x1 SLT_COLOR1x1; typedef half2x1 SLT_COLOR2x1; typedef half3x1 SLT_COLOR3x1; typedef half4x1 SLT_COLOR4x1; typedef half1x2 SLT_COLOR1x2; typedef half2x2 SLT_COLOR2x2; typedef half3x2 SLT_COLOR3x2; typedef half4x2 SLT_COLOR4x2; typedef half1x3 SLT_COLOR1x3; typedef half2x3 SLT_COLOR2x3; typedef half3x3 SLT_COLOR3x3; typedef half4x3 SLT_COLOR4x3; typedef half1x4 SLT_COLOR1x4; typedef half2x4 SLT_COLOR2x4; typedef half3x4 SLT_COLOR3x4; typedef half4x4 SLT_COLOR4x4; #line 151 typedef half SLT_TEXCOORD; typedef half SLT_TEXCOORD1; typedef half2 SLT_TEXCOORD2; typedef half3 SLT_TEXCOORD3; typedef half4 SLT_TEXCOORD4; typedef half1x1 SLT_TEXCOORD1x1; typedef half2x1 SLT_TEXCOORD2x1; typedef half3x1 SLT_TEXCOORD3x1; typedef half4x1 SLT_TEXCOORD4x1; typedef half1x2 SLT_TEXCOORD1x2; typedef half2x2 SLT_TEXCOORD2x2; typedef half3x2 SLT_TEXCOORD3x2; typedef half4x2 SLT_TEXCOORD4x2; typedef half1x3 SLT_TEXCOORD1x3; typedef half2x3 SLT_TEXCOORD2x3; typedef half3x3 SLT_TEXCOORD3x3; typedef half4x3 SLT_TEXCOORD4x3; typedef half1x4 SLT_TEXCOORD1x4; typedef half2x4 SLT_TEXCOORD2x4; typedef half3x4 SLT_TEXCOORD3x4; typedef half4x4 SLT_TEXCOORD4x4; #line 158 typedef float SLT_SHADOWMAP; typedef float SLT_SHADOWMAP1; typedef float2 SLT_SHADOWMAP2; typedef float3 SLT_SHADOWMAP3; typedef float4 SLT_SHADOWMAP4; typedef float1x1 SLT_SHADOWMAP1x1; typedef float2x1 SLT_SHADOWMAP2x1; typedef float3x1 SLT_SHADOWMAP3x1; typedef float4x1 SLT_SHADOWMAP4x1; typedef float1x2 SLT_SHADOWMAP1x2; typedef float2x2 SLT_SHADOWMAP2x2; typedef float3x2 SLT_SHADOWMAP3x2; typedef float4x2 SLT_SHADOWMAP4x2; typedef float1x3 SLT_SHADOWMAP1x3; typedef float2x3 SLT_SHADOWMAP2x3; typedef float3x3 SLT_SHADOWMAP3x3; typedef float4x3 SLT_SHADOWMAP4x3; typedef float1x4 SLT_SHADOWMAP1x4; typedef float2x4 SLT_SHADOWMAP2x4; typedef float3x4 SLT_SHADOWMAP3x4; typedef float4x4 SLT_SHADOWMAP4x4; #line 166 typedef SLT_HALF SLT_WEIGHT; typedef SLT_HALF SLT_WEIGHT1; typedef SLT_HALF2 SLT_WEIGHT2; typedef SLT_HALF3 SLT_WEIGHT3; typedef SLT_HALF4 SLT_WEIGHT4; typedef SLT_HALF1x1 SLT_WEIGHT1x1; typedef SLT_HALF2x1 SLT_WEIGHT2x1; typedef SLT_HALF3x1 SLT_WEIGHT3x1; typedef SLT_HALF4x1 SLT_WEIGHT4x1; typedef SLT_HALF1x2 SLT_WEIGHT1x2; typedef SLT_HALF2x2 SLT_WEIGHT2x2; typedef SLT_HALF3x2 SLT_WEIGHT3x2; typedef SLT_HALF4x2 SLT_WEIGHT4x2; typedef SLT_HALF1x3 SLT_WEIGHT1x3; typedef SLT_HALF2x3 SLT_WEIGHT2x3; typedef SLT_HALF3x3 SLT_WEIGHT3x3; typedef SLT_HALF4x3 SLT_WEIGHT4x3; typedef SLT_HALF1x4 SLT_WEIGHT1x4; typedef SLT_HALF2x4 SLT_WEIGHT2x4; typedef SLT_HALF3x4 SLT_WEIGHT3x4; typedef SLT_HALF4x4 SLT_WEIGHT4x4; #line 179 typedef sampler1D SLT_SAMPLER_1D; #line 186 typedef sampler2D SLT_SAMPLER_2D; #line 193 typedef sampler3D SLT_SAMPLER_3D; #line 200 typedef samplerCUBE SLT_SAMPLER_CUBE; #line 266 typedef float SLT_PARAM_FLOAT; typedef float SLT_PARAM_FLOAT1; typedef float2 SLT_PARAM_FLOAT2; typedef float3 SLT_PARAM_FLOAT3; typedef float4 SLT_PARAM_FLOAT4; typedef float1x1 SLT_PARAM_FLOAT1x1; typedef float2x1 SLT_PARAM_FLOAT2x1; typedef float3x1 SLT_PARAM_FLOAT3x1; typedef float4x1 SLT_PARAM_FLOAT4x1; typedef float1x2 SLT_PARAM_FLOAT1x2; typedef float2x2 SLT_PARAM_FLOAT2x2; typedef float3x2 SLT_PARAM_FLOAT3x2; typedef float4x2 SLT_PARAM_FLOAT4x2; typedef float1x3 SLT_PARAM_FLOAT1x3; typedef float2x3 SLT_PARAM_FLOAT2x3; typedef float3x3 SLT_PARAM_FLOAT3x3; typedef float4x3 SLT_PARAM_FLOAT4x3; typedef float1x4 SLT_PARAM_FLOAT1x4; typedef float2x4 SLT_PARAM_FLOAT2x4; typedef float3x4 SLT_PARAM_FLOAT3x4; typedef float4x4 SLT_PARAM_FLOAT4x4; #line 277 typedef float SLT_PARAM_HALF; typedef float SLT_PARAM_HALF1; typedef float2 SLT_PARAM_HALF2; typedef float3 SLT_PARAM_HALF3; typedef float4 SLT_PARAM_HALF4; typedef float1x1 SLT_PARAM_HALF1x1; typedef float2x1 SLT_PARAM_HALF2x1; typedef float3x1 SLT_PARAM_HALF3x1; typedef float4x1 SLT_PARAM_HALF4x1; typedef float1x2 SLT_PARAM_HALF1x2; typedef float2x2 SLT_PARAM_HALF2x2; typedef float3x2 SLT_PARAM_HALF3x2; typedef float4x2 SLT_PARAM_HALF4x2; typedef float1x3 SLT_PARAM_HALF1x3; typedef float2x3 SLT_PARAM_HALF2x3; typedef float3x3 SLT_PARAM_HALF3x3; typedef float4x3 SLT_PARAM_HALF4x3; typedef float1x4 SLT_PARAM_HALF1x4; typedef float2x4 SLT_PARAM_HALF2x4; typedef float3x4 SLT_PARAM_HALF3x4; typedef float4x4 SLT_PARAM_HALF4x4; #line 288 typedef uniform float SLT_PARAM_INT; typedef uniform float SLT_PARAM_INT1; typedef uniform float2 SLT_PARAM_INT2; typedef uniform float3 SLT_PARAM_INT3; typedef uniform float4 SLT_PARAM_INT4; typedef uniform float1x1 SLT_PARAM_INT1x1; typedef uniform float2x1 SLT_PARAM_INT2x1; typedef uniform float3x1 SLT_PARAM_INT3x1; typedef uniform float4x1 SLT_PARAM_INT4x1; typedef uniform float1x2 SLT_PARAM_INT1x2; typedef uniform float2x2 SLT_PARAM_INT2x2; typedef uniform float3x2 SLT_PARAM_INT3x2; typedef uniform float4x2 SLT_PARAM_INT4x2; typedef uniform float1x3 SLT_PARAM_INT1x3; typedef uniform float2x3 SLT_PARAM_INT2x3; typedef uniform float3x3 SLT_PARAM_INT3x3; typedef uniform float4x3 SLT_PARAM_INT4x3; typedef uniform float1x4 SLT_PARAM_INT1x4; typedef uniform float2x4 SLT_PARAM_INT2x4; typedef uniform float3x4 SLT_PARAM_INT3x4; typedef uniform float4x4 SLT_PARAM_INT4x4; #line 296 typedef uniform bool SLT_PARAM_BOOL; typedef uniform bool SLT_PARAM_BOOL1; typedef uniform bool2 SLT_PARAM_BOOL2; typedef uniform bool3 SLT_PARAM_BOOL3; typedef uniform bool4 SLT_PARAM_BOOL4; typedef uniform bool1x1 SLT_PARAM_BOOL1x1; typedef uniform bool2x1 SLT_PARAM_BOOL2x1; typedef uniform bool3x1 SLT_PARAM_BOOL3x1; typedef uniform bool4x1 SLT_PARAM_BOOL4x1; typedef uniform bool1x2 SLT_PARAM_BOOL1x2; typedef uniform bool2x2 SLT_PARAM_BOOL2x2; typedef uniform bool3x2 SLT_PARAM_BOOL3x2; typedef uniform bool4x2 SLT_PARAM_BOOL4x2; typedef uniform bool1x3 SLT_PARAM_BOOL1x3; typedef uniform bool2x3 SLT_PARAM_BOOL2x3; typedef uniform bool3x3 SLT_PARAM_BOOL3x3; typedef uniform bool4x3 SLT_PARAM_BOOL4x3; typedef uniform bool1x4 SLT_PARAM_BOOL1x4; typedef uniform bool2x4 SLT_PARAM_BOOL2x4; typedef uniform bool3x4 SLT_PARAM_BOOL3x4; typedef uniform bool4x4 SLT_PARAM_BOOL4x4; #line 1 "D://KTGL/shaderlib2/shader/include/slAccessoriesOptions.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccessoriesDependency.fxh" #line 12 "D://KTGL/shaderlib2/shader/include/slAccessoriesOptions.fxh" static int s_nAccTexCoordNum = 0; #line 55 int slpIncrementAccessoryTexCoord() { int n = s_nAccTexCoordNum; s_nAccTexCoordNum++; return n; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccessoriesOptionsKIDS.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccAlphaSpecularMap.fxh" #line 58 int slAlphaSpecularMap : ACCESSORY < string Name = "AlphaSpecMap"; string Macro = "SLC_ALPHASPECULAR_MAP"; string Modifier = "As"; string Description = "An accessory to use a texture that has specular and alpha channel."; string DescriptionJ = "アルファスペキュラアクセサリ"; int CreateClass = 0; >; static SLT_INT s_nAlphaSpecularMapTCI = 0; #line 96 bool slcIsAlphaSpecularMap() { return 0; } #line 109 SLT_INT slpGetAlphaSpecularMapTexCoordIndex() { return s_nAlphaSpecularMapTCI; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccAmbientOcclusion.fxh" #line 88 int slAmbientOcclusionPackOption : ACCESSORYOPTION < string Name = "SLO_AO_TEXTUREUSAGE"; int Default = 5 ; string Description = "Texture Paking"; string DescriptionJ = "テクスチャパッキング"; string List = "None, ASO"; string Modifier = ", so"; int None = 5; int ASO = 11; string NoneDescription = "RGB Occlusioin map"; string ASODescription = "R:Alpha,G:SpecularB:Occlusion"; string NoneDescriptionJ = "RGBオクルージョンマップ"; int DetectType = 3; >; int slAmbientOcclusionScalerOption : ACCESSORYOPTION < string Name = "SLO_AO_ENABLESCALER"; int Default = 0 ; string Description = "Enable occlusion scaler"; string DescriptionJ = "オクルージョンの強さスケール有効"; string List = "Disable, Enable"; int Disable = 0; int Enable = 1; >; int slAmbientOcclusionMainLightDiffuseOcclusionOption : ACCESSORYOPTION < string Name = "SLO_AO_MAINLIGHT_DIFFUSEOCCLUSION_TYPE"; int Default = 0 ; string Description = "Enable main light diffuse occlusion scaler"; string DescriptionJ = "オクルージョンをメインライトのディフューズにも適用する"; string List = "Disable, Enable, Branch"; int Disable = 0; int Enable = 1; int Branch = 2; >; int slAmbientOcclusionSubLightDiffuseOcclusionOption : ACCESSORYOPTION < string Name = "SLO_AO_SUBLIGHT_DIFFUSEOCCLUSION_TYPE"; int Default = 0 ; string Description = "Enable sub light diffuse occlusion scaler"; string DescriptionJ = "オクルージョンをサブライトのディフューズにも適用する"; string List = "Disable, Enable, Branch"; int Disable = 0; int Enable = 1; int Branch = 2; >; #line 169 int slAmbientOccAccessory : ACCESSORY < string Name = "AmbientOcc"; string Macro = "SLC_AMBIENT_OCCLUSION"; string Modifier = "A"; string Description = "An accessory to make a shader with ambient occlusion map"; string DescriptionJ = "アンビエントオクルージョンアクセサリ"; int CreateClass = 1; string CreatorClass = "CAmbientOcclusionAccessoryCreator"; string Pack = "slAmbientOcclusionPackOption"; string Scaler = "slAmbientOcclusionScalerOption"; string DiffuseOcclusionMain = "slAmbientOcclusionMainLightDiffuseOcclusionOption"; string DiffuseOcclusionSub = "slAmbientOcclusionSubLightDiffuseOcclusionOption"; >; #line 196 static SLT_INT s_nAmbientOccTCI = 0; #line 216 bool slcIsAmbientOcclusion() { return 0; } #line 228 SLT_INT sloGetAmbientOcclusionTexUsage() { return 5; } #line 240 SLT_INT sloIsEnableAmbientOcclusionScaler() { return 0; } #line 252 SLT_INT sloGetMainLightDiffuseOcclusionType() { return 0; } #line 264 SLT_INT sloGetSubLightDiffuseOcclusionType() { return 0; } #line 277 SLT_INT slpGetAmbientOcclusionTexCoordIndex() { return s_nAmbientOccTCI; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccBillBoard.fxh" #line 42 bool slcIsBillBoard() { return 0; } #line 122 int slBillboardTypeOption : ACCESSORYOPTION < string Name = "SLO_BILLBOARD_TYPE"; int Default = 0 ; string Description = "Billboard Type"; string DescriptionJ = "ビルボードの種類"; string List = "Sprite, Billboard, EyeOrient, NoRotation"; string Modifier = " 0, 1, 2, x"; int Sprite = 0; int Billboard = 1; int EyeOrient = 2; int NoRotation = 9; string SpriteMacro = "KTGL_SHLIB_BLBD_TYPE_SPRITE"; string BillboardMacro = "KTGL_SHLIB_BLBD_TYPE_BILLBOARD"; string EyeOrientMacro = "KTGL_SHLIB_BLBD_TYPE_EYE_ORIENTED"; string NoRotationMacro = "KTGL_SHLIB_BLBD_TYPE_NO_ROTATION"; string SpriteDescription = "Sprite Type"; string BillboardDescription = "Billboard Type"; string EyeOrientDescription = "Eye Oritented Billboard Type"; string NoRotationDescription = "No Rotation Type"; string SpriteDescriptionJ = "スプライト"; string BillboardDescriptionJ = "ローカルY軸回転"; string EyeOrientDescriptionJ = "Y軸回転"; string NoRotationDescriptionJ = "回転なし"; int DetectType = 3; >; #line 168 int slBillboardTexSwitchOption : ACCESSORYOPTION < string Name = "SLO_BILLBOARD_TEX_SWITCH"; int Default = 0 ; string Description = "Billboard Texture Switch"; string DescriptionJ = "ビルボードのテクスチャ切り替えの種類"; string List = "None, X2, X4, X8, Free"; int None = 0; int X2 = 1; int X4 = 2; int X8 = 3; int Free = 4; string NoneMacro = "KTGL_SHLIB_BLBD_SWITCH_NONE"; string X2Macro = "KTGL_SHLIB_BLBD_SWITCH_X2"; string X4Macro = "KTGL_SHLIB_BLBD_SWITCH_X4"; string X8Macro = "KTGL_SHLIB_BLBD_SWITCH_X8"; string FreeMacro = "KTGL_SHLIB_BLBD_SWITCH_FREE"; string NoneDescription = "No Switching"; string X2Description = "Switch 2 Textures"; string X4Description = "Switch 4 Textures"; string X8Description = "Switch 8 Textures"; string FreeDescription = "Switch Some Textures"; string NoneDescriptionJ = "切り替えなし"; string X2DescriptionJ = "2枚切り替え"; string X4DescriptionJ = "4枚切り替え"; string X8DescriptionJ = "8枚切り替え"; string FreeDescriptionJ = "任意切り替え"; >; #line 212 int slBillboardS3DOption : ACCESSORYOPTION < string Name = "SLO_BILLBOARD_S3D"; int Default = 0; string Description = "Billboard S3D"; string DescriptionJ = "ビルボードのS3D表\示"; string List = "On, Off"; int On = 1; int Off = 0; >; #line 242 int slBillboardShadowTypeOption : ACCESSORYOPTION < string Name = "SLO_BILLBOARD_TYPE"; int Default = 0 ; string Description = "BillboardShadow Type"; string DescriptionJ = "ビルボードタイプ"; string List = "Sprite, Billboard, EyeOrient, CamSprite, CamBillboard, CamEyeOrient, NoRotation"; string Modifier = " 0, 1, 2, 0c, 1c, 2c, x"; int Sprite = 3; int Billboard = 4; int EyeOrient = 5; int CamSprite = 6; int CamBillboard = 7; int CamEyeOrient = 8; int NoRotation = 9; string SpriteMacro = "KTGL_SHLIB_BLBDSM_TYPE_LIT_SPRITE"; string BillboardMacro = "KTGL_SHLIB_BLBDSM_TYPE_LIT_BILLBOARD"; string EyeOrientMacro = "KTGL_SHLIB_BLBDSM_TYPE_LIT_EYE_ORIENTED"; string CamSpriteMacro = "KTGL_SHLIB_BLBDSM_TYPE_CAM_SPRITE"; string CamBillboardMacro = "KTGL_SHLIB_BLBDSM_TYPE_CAM_BILLBOARD"; string CamEyeOrientMacro = "KTGL_SHLIB_BLBDSM_TYPE_CAM_EYE_ORIENTED"; string NoRotationMacro = "KTGL_SHLIB_BLBD_TYPE_NO_ROTATION"; string SpriteDescription = "Light Oriented Sprite Type"; string BillboardDescription = "Light Oriented Billboard Type"; string EyeOrientDescription = "Light Oriented Eye Oriented Billboard Type"; string CamSpriteDescription = "Camera Oriented Sprite Type"; string CamBillboardDescription = "Camera Oriented Billboard Type"; string CamEyeOrientDescription = "Camera Oriented Eye Oriented Billboard Type"; string NoRotationDescription = "No Rotation Type"; string SpriteDescriptionJ = "ライト方向に正対"; string BillboardDescriptionJ = "ライト方向にローカルY軸回転"; string EyeOrientDescriptionJ = "ライト方向にY軸回転"; string CamSpriteDescriptionJ = "カメラ方向に正対"; string CamBillboardDescriptionJ = "カメラ方向にローカルY軸回転"; string CamEyeOrientDescriptionJ = "カメラ方向にY軸回転"; string NoRotationDescriptionJ = "回転なし"; int DetectType = 3; >; #line 297 int slBillboardShadowS3DOption : ACCESSORYOPTION < string Name = "SLO_BILLBOARD_S3D"; int Default = 0; string Description = "Billboard S3D"; string DescriptionJ = "ビルボードのS3D表\示"; string List = "On, Off"; int On = 1; int Off = 0; >; #line 352 int slBillboardAccessories : ACCESSORY < string Name = "Billboard"; string Modifier = "B"; string Macro = "SLC_BILLBOARD"; string Exclude = "BillboardShadow, Cloth"; string Description = "An accessory to make a billboard shader"; string DescriptionJ = "ビルボードアクセサリ"; int CreateClass = 2; string CreatorClass = "CBillboardAccessoryCreator"; string Type = "slBillboardTypeOption"; string Switch = "slBillboardTexSwitchOption"; string S3D = "slBillboardS3DOption"; string Key = "Geometry"; >; #line 1 "D://KTGL/shaderlib2/shader/include/slAccBypassWorldTransform.fxh" #line 57 int slBypassWorldAccessory : ACCESSORY < string Name = "BypassWorld"; string Macro = "SLC_BYPASS_WORLD_TRANSFORM"; string Modifier = "By"; int CreateClass = 2; string CreatorClass = "CBypassWorldTransformAccessoryCreator"; string Description = "An accessory to improve accuracy of vertex transform"; string DescriptionJ = "座標変換の精度を高めるアクセサリ"; string Key = "Geometry"; >; #line 81 bool slcIsBypassWorldTransform() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccCloth.fxh" #line 42 int slClothMaxCtrlPointOption : ACCESSORYOPTION < string Name = "SLO_SPLINE_CTRL_NUM"; string Description = "An option to specify maximum number of spline control points"; string DescriptionJ = "最大制御点数"; int DetectType = 8; >; #line 69 int slClothAccessory : ACCESSORY < string Name = "Cloth"; string Macro = "SLC_CLOTH_SPLINE_ENABLED"; string Modifier = "C"; int CreateClass = 0; string Description = "An accessory to make a shader for cloth models"; string DescriptionJ = "布アクセサリ"; string MaxCtrlPoint = "slClothMaxCtrlPointOption"; int DetectType = 8; string Key = "Geometry"; >; #line 101 int sloGetClothCtrlPointNum() { return 128; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccColorController.fxh" #line 61 int slColorControllerAccessory : ACCESSORY < string Name = "ColorController"; string Modifier = "Ccr"; string Macro = "SLC_COLOR_CONTROLLER"; string Description = "An accessory to control a computed albedo color."; string DescriptionJ = "カラー加算アクセサリ"; int CreateClass = 2; string CreatorClass = "CColorControllerAccessoryCreator"; >; #line 91 bool slcIsEnableColorController() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccColorSpecularMap.fxh" #line 89 int slColorSpecularAlphaOption : ACCESSORYOPTION < string Name = "SLO_COLOR_SPECULARMAP_ALPHA_USAGE"; string Description = "Using alpha channel of the color specular map as decay"; string DescriptionJ = "Decayをアルファに含める"; string List = "None, Decay, LogDecay"; string Modifier = " , d, ld"; int None = 0; int Decay = 1; int LogDecay = 2; int DetectType = 3; >; #line 118 int slColorSpecularMapTexCoordOption : ACCESSORYOPTION < string Name = "SLO_COLORSPECULARMAP_TEXCOORD"; int Default = 1 ; string Description = "Texture coordinate index for color specular map"; string DescriptionJ = "カラースペキュラマップのテクスチャ座標インデックス"; string List = "Stage0, Unique"; int Stage0 = 0; int Unique = 1; string Stage0Macro = "SHTEX_STAGE0"; string UniqueMacro = "SHTEX_UNIQUE"; string Stage0Description = "Using texture stage[0] Texcoord"; string UniqueDescription = "anything"; string Stage0DescriptionJ = "ステージ0のテクスチャ座標を使用"; string UniqueDescriptionJ = "専用テクスチャ座標を使用"; int DetectType = 5; int DetectColorUsage = 2; >; #line 158 int slColorSpecularmapAccessory : ACCESSORY < string Name = "ColorSpMap"; string Macro = "SLC_COLOR_SPECULARMAP"; string Modifier = "Cs"; int CreateClass = 0; string Description = "An accessory to enable specular map"; string DescriptionJ = "カラースペキュラマップアクセサリ"; string AlphaUsage = "slColorSpecularAlphaOption"; string TexCoord = "slColorSpecularMapTexCoordOption"; int DetectType = 3; >; #line 194 static int s_nColorSpMapTCI = 0; #line 212 SLT_BOOL slcIsColorSpecularMapAccessory() { return 0; } #line 222 SLT_INT sloGetColorSpecularMapAlphaType() { return 0; } #line 232 SLT_INT sloGetColorSpecularMapTexCoord() { return 1; } #line 245 int slGetColorSpecularMapTexCoordIndex() { return s_nColorSpMapTCI; } #line 255 int slGetColorSpecularMapAlphaUsage() { if (sloGetColorSpecularMapAlphaType() == 0) { return 0; } else { return 12; } } #line 1 "D://KTGL/shaderlib2/shader/include/slAccDissolve.fxh" #line 61 int slDissolveAccessory : ACCESSORY < string Name = "Dissolve"; string Modifier = "Di"; string Macro = "SLC_DISSOLVE"; int CreateClass = 2; string CreatorClass = "CDissolveAccessoryCreator"; string Description = "An accessory to dissolve animation"; string DescriptionJ = "ディゾルブアニメーションアクセサリ"; string Key = "Tex"; >; #line 93 SLT_BOOL slcIsDissolve() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccEmissiveMap.fxh" #line 52 int slEmissiveMapTexCoordOption : ACCESSORYOPTION < string Name = "SLO_EMISSIVEMAP_TEXCOORD"; int Default = 1 ; string Description = "Texture coordinate index for emissive map"; string DescriptionJ = "エミッシブマップのテクスチャ座標インデックス"; string List = "Stage0, Unique"; int Stage0 = 0; int Unique = 1; string Stage0Macro = "SHTEX_STAGE0"; string UniqueMacro = "SHTEX_UNIQUE"; string Stage0Description = "Using texture stage[0] Texcoord"; string UniqueDescription = "anything"; string Stage0DescriptionJ = "ステージ0のテクスチャ座標を使用"; string UniqueDescriptionJ = "専用テクスチャ座標を使用"; int DetectType = 5; int DetectColorUsage = 19; >; #line 105 int slEmiMapAccessory : ACCESSORY < string Name = "EmiMap"; string Modifier = "Em"; string Macro = "SLC_EMISSIVE_MAPPING"; string Description = "An accessory to make a shader with emissive map"; string DescriptionJ = "エミッシブマップアクセサリ"; string TexCoord = "slEmissiveMapTexCoordOption"; int CreateClass = 2; string CreatorClass = "CEmissiveMapAccessoryCreator"; >; #line 134 static SLT_INT s_nEmissiveMapTCI = 0; #line 151 bool slcIsEmissiveMapping() { return 0; } #line 161 SLT_INT sloGetEmissiveMapTexCoordType() { return 1; } #line 174 SLT_INT slpGetEmissiveMapTexCoordIndex() { return s_nEmissiveMapTCI; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccEnvironmentMap.fxh" #line 109 int slEnvMapReflectionOption : ACCESSORYOPTION < string Name = "SLO_ENVMAP_REFLECTION"; int Default = 0 ; string Description = "Reflection type"; string DescriptionJ = "反射の種類"; string List = "Metaric, Fresnel, Refraction, Prism, Prism2"; string Modifier = " , f, r, p, p2"; int Metaric = 0; int Fresnel = 1; int Refraction = 2; int Prism = 3; int Prism2 = 4; string MetaricMacro = "KTGL_SHLIB_ENVMAP_REFLECTION_METARIC"; string FresnelMacro = "KTGL_SHLIB_ENVMAP_REFLECTION_FRESNEL"; string RefractionMacro = "KTGL_SHLIB_ENVMAP_REFLECTION_REFRACTION"; string PrismMacro = "KTGL_SHLIB_ENVMAP_REFLECTION_PRISM"; string Prism2Macro = "KTGL_SHLIB_ENVMAP_REFLECTION_PRISM2"; string MetaricDescription = "Metaric Reflection"; string FresnelDescription = "Fresnel Reflection"; string RefractionDescription = "Refraction"; string PrismDescription = "Prism Refraction"; string Prism2Description = "6 elements Prism Refraction"; string MetaricDescriptionJ = "金属反射"; string FresnelDescriptionJ = "フレネル反射"; string RefractionDescriptionJ = "屈折透過"; string PrismDescriptionJ = "3 色プリズム透過"; string Prism2DescriptionJ = "6 色プリズム透過"; int DetectType = 3; >; #line 158 int slEnvMapMapTypeOption : ACCESSORYOPTION < string Name = "SLO_ENVMAP_TYPE"; int Default = 0 ; string Description = "Environment mapping method"; string DescriptionJ = "マッピング方法"; string List = "Cube, MirrorBall, LightProbe"; int Cube = 0; int MirrorBall = 1; int LightProbe = 2; string CubeMacro = "KTGL_SHLIB_ENVMAP_CUBE"; string MirrorBallMacro = "KTGL_SHLIB_ENVMAP_MIRRORBALL"; string LightProbeMacro = "KTGL_SHLIB_ENVMAP_LIGHTPROBE"; string CubeDescription = "Cube map"; string MirrorBallDescription = "Mirror ball"; string LightProbeDescription = "Angular map"; string CubeDescriptionJ = "キューブマップ"; string MirrorBallDescriptionJ = "ミラーボール"; string LightProbeDescriptionJ = "アンギュラーマップ"; >; #line 195 int slEnvMapTransformOption : ACCESSORYOPTION < string Name = "SLO_ENABLE_ENVMAP_COORD"; int Default = 0 ; string Description = "Enable Envmap coordinate"; string DescriptionJ = "座標変換"; int Min = 0; int Max = 1; >; #line 212 int slEnvMapRGBSOption : ACCESSORYOPTION < string Name = "SLO_ENABLE_RGBS"; int Default = 0 ; string Description = "Enable RGBS decording"; string DescriptionJ = "RGBSデコーディング"; int Min = 0; int Max = 1; int DetectType = 10; >; #line 230 int slEnvMapOldFresnelOption : ACCESSORYOPTION < string Name = "SLO_ENABLE_OLD_FRESNEL"; int Default = 0; string Description = "Enable old fresnel parameter"; string DescriptionJ = "フレネル係数の計算を古いバージョンにする"; string List = "On, Off"; int On = 1; int Off = 0; >; #line 276 int slEnvMapAccessory : ACCESSORY < string Name = "EnvMap"; string Modifier = "E"; string Macro = "SLC_ENVIRONMENT_MAPPING"; string Description = "An accessory to make a shader with environment map"; string DescriptionJ = "環境マップアクセサリ"; int CreateClass = 2; string CreatorClass = "CEnvMapAccessoryCreator"; string Reflection = "slEnvMapReflectionOption"; string MapType = "slEnvMapMapTypeOption"; string Transform = "slEnvMapTransformOption"; string RGBS = "slEnvMapRGBSOption"; string OldFresnel = "slEnvMapOldFresnelOption"; >; #line 325 typedef SLT_SAMPLER_CUBE SLT_SAMPLER_ENVMAP; #line 343 bool slcIsEnvironmentMapping() { return 0; } #line 355 SLT_BOOL sloIsEnvMapCoordEnabled() { return 0; } #line 367 SLT_INT sloGetEnvMapType() { return 0; } #line 379 SLT_BOOL sloIsRGBSEnabled() { return 0; } #line 390 SLT_INT sloGetEnvMapReflectionType() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccFaceRobot.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../include/slAccNormalMapBlend.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../include/../include/slAccNormalMap.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../include/../include/../include/slCompileOptions.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../include/../include/slAccPixelLighting.fxh" #line 70 int slPerPixelMainLightOnlyOption : ACCESSORYOPTION < string Name = "SLO_PERPIXEL_MAINLIGHT_ONLY"; int Default = 0 ; string Description = "Pixel lighting for only main light"; string DescriptionJ = "メインライトのみピクセルライティング"; int Min = 0; int Max = 1; >; #line 105 int slPerPixelAccessory : ACCESSORY < string Name = "PerPixel"; string Macro = "SLC_PER_PIXEL_LIGHTING"; string Modifier = "P"; int CreateClass = 0; string Exclude = "NormalMap, ParallaxMap"; string Description = "An accessory for Per Pixel Lighting"; string DescriptionJ = "パーピクセルライティングアクセサリ"; string MainLightOnly = "slPerPixelMainLightOnlyOption"; >; #line 121 "D://KTGL/shaderlib2/shader/include/../include/../include/slAccNormalMap.fxh" int slNormalMapMirrorOption : ACCESSORYOPTION < string Name = "SLO_NORMALMAP_MIRROR"; int Default = 1 ; string Description = "Detecting mirrored tex coordinate (u direction)"; string DescriptionJ = "法線マップの裏がえり判別方法"; string List = "None, TangentW, Auto"; int None = 0; int TangentW = 1; int Auto = 2; string NoneMacro = "KTGL_SHLIB_NORMALMAPMIRROR_NONE"; string TangentWMacro = "KTGL_SHLIB_NORMALMAPMIRROR_TANGENTW"; string AutoMacro = "KTGL_SHLIB_NORMALMAPMIRROR_CALC"; string NoneDescription = "detecting nothing"; string TangentWDescription = "direction is included in vertex tangent w"; string AutoDescription = "calculating in pixel shader"; string NoneDescriptionJ = "計算しない"; string TangentWDescriptionJ = "頂点接線のWに含める"; string AutoDescriptionJ = "ピクセルシェーダで自動計算"; >; #line 160 int slNormalMapTexCoordOption : ACCESSORYOPTION < string Name = "SLO_NORMALMAP_TEXCOORD"; int Default = 1 ; string Description = "Texture coordinate index for normal map"; string DescriptionJ = "法線マップのテクスチャ座標インデックス"; string List = "Stage0, Unique"; int Stage0 = 0; int Unique = 1; string Stage0Macro = "SHTEX_STAGE0"; string UniqueMacro = "SHTEX_UNIQUE"; string Stage0Description = "Using texture stage[0] Texcoord"; string UniqueDescription = "anything"; string Stage0DescriptionJ = "ステージ0のテクスチャ座標を使用"; string UniqueDescriptionJ = "専用テクスチャ座標を使用"; int DetectType = 5; int DetectColorUsage = 3; >; #line 190 int slNormalSpecularMapOption : ACCESSORYOPTION < string Name = "SLO_NORMALMAP_SPECMAP"; int Default = 0 ; string Description = "Using alpha channnel for specular map"; string DescriptionJ = "法線マップのアルファをスペキュラマップに使用"; int Min = 0; int Max = 1; int DetectType = 4; int DetectColorUsage = 3; int DetectAlphaUsage = 2; >; #line 213 int slNormalMapCompressOption : ACCESSORYOPTION < string Name = "SLO_NORMALMAP_COMPRESS"; int Default = 0 ; string Description = "Compression type."; string DescriptionJ = "法線マップの圧縮タイプ"; string List = "None, FixB, SwapA, FixSwap, All"; int None = 0; int FixB = 1; int SwapA = 2; int FixSwap = 3; int All = 4; string NoneMacro = "KTGL_SHLIB_NORMALMAP_COMPRESS_NONE"; string FixBMacro = "KTGL_SHLIB_NORMALMAP_COMPRESS_FIXB"; string SwapAMacro = "KTGL_SHLIB_NORMALMAP_COMPRESS_SWAPRA"; string FixSwapMacro = "KTGL_SHLIB_NORMALMAP_COMPRESS_FIXB_SWAPRA"; string AllMacro = "KTGL_SHLIB_NORMALMAP_COMPRESS_ALL"; string NoneDescription = "No compression or simple compression"; string FixBDescription = "Fix B channel to 1.0"; string SwapAMDescription = "Swap A and R channels"; string FixSwapDescription = "Fix B to 1.0, swap A and R"; string AllDescription = "All (without normalspecular)"; string NoneDescriptionJ = "通常"; string FixBDescriptionJ = "Bチャンネルを1に固定"; string SwapAMDescriptionJ = "A-Rチャンネルを交換してDXT5"; string FixSwapDescriptionJ = "Bチャンネルを1に固定+AR交換してDXT5"; string AllDescriptionJ = "全てに対応"; int DetectType = 11; >; #line 279 int slNormalMapAccessory : ACCESSORY < string Name = "NormalMap"; string Macro = "SLC_NORMAL_MAPPING"; string Modifier = "N"; int CreateClass = 1; string CreatorClass = "CNormalMapAccessoryCreator"; string Exclude = "PerPixel, ParallaxMap"; string Description = "An accessory to make a shader with normal map"; string DescriptionJ = "法線マップアクセサリ"; string MainLightOnly = "slPerPixelMainLightOnlyOption"; string Mirror = "slNormalMapMirrorOption"; string TexCoord = "slNormalMapTexCoordOption"; string SpecularMap = "slNormalSpecularMapOption"; string Compress = "slNormalMapCompressOption"; >; #line 334 static int s_nNormalMapTCI = -1; #line 354 bool slcNormalMapping() { return 0; } int slGetNormalMapTexCoordIndex() { return s_nNormalMapTCI; } #line 372 SLT_INT sloGetNormalMapCompressionType() { return 0; } #line 382 SLT_INT sloGetNormalMapDirectionType() { return 1; } #line 392 SLT_BOOL sloIsNormalSpecular() { return 0; } #line 402 SLT_INT sloGetNormalMapTexCoordType() { return 1; } #line 412 int sloGetNormalMapAlphaUsage() { if (sloIsNormalSpecular()) { return 2; } else { return 0; } } #line 427 SLT_BOOL slpIsNormalMapBAccumulated() { return (sloGetNormalMapCompressionType() == 3 || sloGetNormalMapCompressionType() == 1 || sloGetNormalMapCompressionType() == 4); } #line 439 SLT_BOOL slpIsNormalMapARSwapped() { return (sloGetNormalMapCompressionType() == 3 || sloGetNormalMapCompressionType() == 2); } #line 68 "D://KTGL/shaderlib2/shader/include/../include/slAccNormalMapBlend.fxh" int slNormalMapBlendTexCoordOption : ACCESSORYOPTION < string Name = "SLO_NORMALMAP_BLEND_TEXCOORD"; int Default = 1 ; string Description = "Blending Texture coordinate index for normal map"; string DescriptionJ = "ブレンド法線マップのテクスチャ座標インデックス"; string List = "Stage0, Unique"; int Stage0 = 0; int Unique = 1; string Stage0Macro = "SHTEX_STAGE0"; string UniqueMacro = "SHTEX_UNIQUE"; string Stage0Description = "Using texture stage[0] Texcoord"; string UniqueDescription = "anything"; string Stage0DescriptionJ = "ステージ0のテクスチャ座標を使用"; string UniqueDescriptionJ = "専用テクスチャ座標を使用"; int DetectType = 5; int DetectColorUsage = 3; >; #line 106 int slNormalMapBlendColorIndexOption : ACCESSORYOPTION < string Name = "SLO_NORMALMAP_BLEND_COLOR_INDEX"; int Default = 0 ; string Description = "Blending influency color index for normal map blend"; string DescriptionJ = "ブレンド法線マップ影響度用カラーインデックス"; string List = "Color0, Color1"; int Color0 = 0; int Color1 = 1; string Color0Description = "Using color0 as blending influency."; string Color1Description = "Using color1 as blending influency."; string Color0DescriptionJ = "ブレンド用法線マップの影響度に頂点カラー0を使用"; string Color1DescriptionJ = "ブレンド用法線マップの影響度に頂点カラー1を使用"; >; #line 149 int slNormalMapBlendAccessory : ACCESSORY < string Name = "NormalMapBlend"; string Macro = "SLC_NORMAL_MAPPING_BLEND"; string Modifier = "Nb"; int CreateClass = 2; string CreatorClass = "CNormalMapBlendAccessoryCreator"; string Exclude = "PerPixel, ParallaxMap"; string Description = "An accessory to make a normalmap blending shader with double normal maps"; string DescriptionJ = "法線マップブレンディングアクセサリ"; string MainLightOnly = "slPerPixelMainLightOnlyOption"; string Mirror = "slNormalMapMirrorOption"; string TexCoord = "slNormalMapTexCoordOption"; string SpecularMap = "slNormalSpecularMapOption"; string Compress = "slNormalMapCompressOption"; string BlendTexCoord = "slNormalMapBlendTexCoordOption"; string ColorIndex = "slNormalMapBlendColorIndexOption"; >; #line 179 static int s_nNormalMapBlendTCI = -1; #line 186 bool slcIsNormalMappingBlend() { return 0; } int slGetNormalMapBlendTexCoordIndex() { return s_nNormalMapBlendTCI; } #line 202 SLT_INT sloGetNormalMapBlendTexCoordType() { return 1; } #line 212 SLT_INT sloGetNormalMapBlendColorIndex() { return 0; } #line 61 "D://KTGL/shaderlib2/shader/include/slAccFaceRobot.fxh" int slFaceRobotColorNumOption : ACCESSORYOPTION < string Name = "SLO_FACE_ROBOT_COLOR_NUM"; int Default = 1 ; string List = "Mask3, Mask6, Mask9"; string Modifier = " 1, 2, 3"; int Mask3 = 1; int Mask6 = 2; int Mask9 = 3; string Description = "Region Masks"; string DescriptionJ = "領域マスクの数"; >; #line 110 int slFaceRobotAccessory : ACCESSORY < string Name = "FaceRobot"; string Macro = "SLC_FACE_ROBOT"; string Modifier = "Fr"; int CreateClass = 2; string CreatorClass = "CFaceRobotAccessoryCreator"; string Exclude = "Cloth, NormalMapBlend, NormalMap, PerPixel, ParallaxMap"; string Description = "An accessory to animate a data made by FaceRobot"; string DescriptionJ = "FaceRobot対応アクセサリ"; string MainLightOnly = "slPerPixelMainLightOnlyOption"; string Mirror = "slNormalMapMirrorOption"; string TexCoord = "slNormalMapTexCoordOption"; string SpecularMap = "slNormalSpecularMapOption"; string Compress = "slNormalMapCompressOption"; string ColorNum = "slFaceRobotColorNumOption"; >; #line 147 bool slcIsFaceRobot() { return 0; } #line 158 SLT_INT sloGetFaceRobotColorNum() { return 1; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccInstancing.fxh" #line 25 int slInstancingFlagsOption : ACCESSORYOPTION < string Name = "SLC_INSTANCING_FLAGS"; string Description = "Specify a combination of instancing flags (KTGL_SHLIB_INSTANCING_xxx)"; string DescriptionJ = "インスタンシングフラグ"; string Flags = "INST_POSITION, INST_POSITION_ROTATION, INST_SINCOS, INST_YZAXES, INST_TEXCOORD, INST_MATRIX, INST_COLOR_MODULATE, INST_COLOR_REPLACE, INST_LOCAL, INST_ENABLE_CLOTH, INST_DIFFUSE, INST_AMBIENT, INST_SPECULAR, INST_EMISSIVE"; string FlagList = "Position, PositionRot, SinCos, YZAxes, TexCoord, Matrix, ColorModulate, ColorReplace, Local, Cloth, Diffuse, Ambient, Specular, Emissive"; int Position = 0x010; int PositionRot = 0x030; int SinCos = 0x040; int YZAxes = 0x080; int TexCoord = 0x800; int Matrix = 0x100; int ColorModulate = 0x200; int ColorReplace = 0x400; int Local = 0x1000; int Cloth = 0x0001; int Diffuse = 0x10000; int Ambient = 0x20000; int Specular = 0x40000; int Emissive = 0x80000; string PositionDescription = "Position"; string PositionRotDescription = "Position & Rotation Angle"; string SinCosDescription = "sin & cos of Rotation Angle"; string YZAxesDescription = "Y & Z Axes"; string TexCoordDescription = "Offset of texcoord"; string MatrixDescription = "Matrix"; string ColorModulateDescription = "Modulate color"; string ColorReplaceDescription = "Replace color"; string LocalDescription = "Indicate in local space"; string ClothDescription = "Enable cloth instancing"; string DiffuseDescription = "Diffuse"; string AmbientDescription = "Ambient"; string SpecularDescription = "Specular"; string EmissiveDescription = "Emissive"; string PositionDescriptionJ = "位置"; string PositionRotDescriptionJ = "位置+回転角"; string SinCosDescriptionJ = "回転角のsin, cos"; string YZAxesDescriptionJ = "Y軸とZ軸"; string TexCoordDescriptionJ = "テクスチャ座標のオフセット"; string MatrixDescriptionJ = "マトリクス"; string ColorModulateDescriptionJ = "カラーを乗算する"; string ColorReplaceDescriptionJ = "カラーを置き換える"; string LocalDescriptionJ = "ローカル座標系で指定"; string ClothDescriptionJ = "布"; string DiffuseDescriptionJ = "ディフューズ"; string AmbientDescriptionJ = "アンビエント"; string SpecularDescriptionJ = "スペキュラ"; string EmissiveDescriptionJ = "エミッション"; >; #line 119 int slInstancingAccessory : ACCESSORY < string Name = "Instancing"; string Macro = "SLC_INSTANCING_ENABLED"; string Modifier = "I"; int CreateClass = 0; string Description = "An accessory to make an instancing shader"; string DescriptionJ = "インスタンシングアクセサリ"; string Flags = "slInstancingFlagsOption"; string Key = "Geometry"; >; #line 1 "D://KTGL/shaderlib2/shader/include/slAccUnpackedVSInput.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 120 "D://KTGL/shaderlib2/shader/include/slAccUnpackedVSInput.fxh" int slUnpackedTypeOption : ACCESSORYOPTION < string Description = "An option to specify unpacked vertex data type"; string DescriptionJ = "アンパック頂点データの型"; string List = "Float, Half, Int, Uint, Short, UShort, Char, Uchar, Float2, Half2, Int2, Uint2, Short2, UShort2, Char2, Uchar2, Float3, Half3, Int3, Uint3, Short3, UShort3, Char3, Uchar3, Float4, Half4, Int4, Uint4, Short4, UShort4, Char4, Uchar4, Float0, Half0, Int0, Uint0, Short0, UShort0, Char0, Uchar0"; int Default = 0; int Float = 0x0100 | 1; int Half = 0x0200 | 1; int Int = 0x0300 | 1; int Uint = 0x0400 | 1; int Short = 0x0500 | 1; int UShort = 0x0600 | 1; int Char = 0x0700 | 1; int Uchar = 0x0800 | 1; int Float2 = 0x0100 | 2; int Half2 = 0x0200 | 2; int Int2 = 0x0300 | 2; int Uint2 = 0x0400 | 2; int Short2 = 0x0500 | 2; int UShort2 = 0x0600 | 2; int Char2 = 0x0700 | 2; int Uchar2 = 0x0800 | 2; int Float3 = 0x0100 | 3; int Half3 = 0x0200 | 3; int Int3 = 0x0300 | 3; int Uint3 = 0x0400 | 3; int Short3 = 0x0500 | 3; int UShort3 = 0x0600 | 3; int Char3 = 0x0700 | 3; int Uchar3 = 0x0800 | 3; int Float4 = 0x0100 | 4; int Half4 = 0x0200 | 4; int Int4 = 0x0300 | 4; int Uint4 = 0x0400 | 4; int Short4 = 0x0500 | 4; int UShort4 = 0x0600 | 4; int Char4 = 0x0700 | 4; int Uchar4 = 0x0800 | 4; int Float0 = 0x0100 ; int Half0 = 0x0200 ; int Int0 = 0x0300 ; int Uint0 = 0x0400 ; int Short0 = 0x0500 ; int UShort0 = 0x0600 ; int Char0 = 0x0700 ; int Uchar0 = 0x0800 ; string Float0Description = "Use in order to specify only type."; string Half0Description = "Use in order to specify only type."; string Int0Description = "Use in order to specify only type."; string Uint0Description = "Use in order to specify only type."; string Short0Description = "Use in order to specify only type."; string UShort0Description = "Use in order to specify only type."; string Char0Description = "Use in order to specify only type."; string Uchar0Description = "Use in order to specify only type."; string Float0DescriptionJ = "型のみを指定する場合に使用する"; string Half0DescriptionJ = "型のみを指定する場合に使用する"; string Int0DescriptionJ = "型のみを指定する場合に使用する"; string Uint0DescriptionJ = "型のみを指定する場合に使用する"; string Short0DescriptionJ = "型のみを指定する場合に使用する"; string UShort0DescriptionJ = "型のみを指定する場合に使用する"; string Char0DescriptionJ = "型のみを指定する場合に使用する"; string Uchar0DescriptionJ = "型のみを指定する場合に使用する"; >; #line 231 int slUnpackedVSInputAccessory : ACCESSORY < string Name = "Unpack"; string Macro = "SLC_ACC_UNPACKED_VS_INPUT"; string Modifier = "Upk"; int CreateClass = 0; string Description = "An accessory for offline unpack vertices"; string DescriptionJ = "頂点のアンパックアクセサリ"; string Position = "slUnpackedTypeOption, SLO_UNPACKED_TYPE_POSITION"; string Normal = "slUnpackedTypeOption, SLO_UNPACKED_TYPE_NORMAL"; string Tangent = "slUnpackedTypeOption, SLO_UNPACKED_TYPE_TANGENT"; string TexCoord = "slUnpackedTypeOption, SLO_UNPACKED_TYPE_TEXCOORD"; string Color0 = "slUnpackedTypeOption, SLO_UNPACKED_TYPE_COLOR0"; string Weight = "slUnpackedTypeOption, SLO_UNPACKED_TYPE_WEIGHT"; string BlendIndices = "slUnpackedTypeOption, SLO_UNPACKED_TYPE_BLENDINDICES"; string Key = "Geometry"; string Exclude = "Instancing"; >; #line 304 bool slcIsUnpackedVertexInput() { return 0; } #line 315 int sloGetUnpackedComponent(uniform int nFlg) { return nFlg & 0x000f; } #line 325 int sloGetUnpackedType(uniform int nFlg) { return nFlg & 0x0f00; } #line 335 int sloGetUnpackedTypePosition() { if (0 == 0) { return 0x0100 | 3; } else { return 0; } } #line 349 int sloGetUnpackedTypeNormal() { if (0 == 0) { return 0x0100 | 3; } else { return 0; } } #line 363 int sloGetUnpackedTypeTangent() { if (0 == 0) { return 0x0100 | 4; } else { return 0; } } #line 377 int sloGetUnpackedTypeTexCoord() { if (0 == 0) { return 0x0100 | 2; } else { return 0; } } #line 391 int sloGetUnpackedTypeColor0() { if (0 == 0) { return 0x0800 | 4; } else { return 0; } } #line 405 int sloGetUnpackedTypeWeight() { if (0 == 0) { if (slcIsFullVertexWeights()) { return 0x0100 | (slcGetVertexWeightNum()+1); } else if (0 < slcGetVertexWeightNum()) { return 0x0100 | slcGetVertexWeightNum(); } else { return 0x0100 | 4; } } else if (sloGetUnpackedComponent(0) == 0) { int _type = sloGetUnpackedType(0); if (slcIsFullVertexWeights()) { return _type | (slcGetVertexWeightNum()+1); } else if (0 < slcGetVertexWeightNum()) { return _type | slcGetVertexWeightNum(); } else { return _type | 4; } } else { return 0; } } #line 441 int sloGetUnpackedTypeBlendIndices() { if (0 == 0) { return 0x0800 | 4; } else { return 0; } } #line 1 "D://KTGL/shaderlib2/shader/include/slAccMultiRenderTarget.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 45 "D://KTGL/shaderlib2/shader/include/slAccMultiRenderTarget.fxh" int slMRTOutputOption : ACCESSORYOPTION < string Description = "An option to specify each RT output"; string DescriptionJ = "マルチレンダーターゲットの出力内容"; string List = "None, ViewZ, ViewZn, ViewZ_RGB, Z, Z_RGB, OverflowColor, Custom, User_RGB, ViewNZ, ViewN_RGB"; int Default = 0; int None = 0; int ViewZ = 1; int ViewZn = 2; int ViewZ_RGB = 3; int Z = 4; int Z_RGB = 5; int OverflowColor = 6; int Custom = 7; int User_RGB = 8; int ViewNZ = 9; int ViewN_RGB = 10; string NoneMacro = "MRT_NONE"; string ViewZMacro = "MRT_DEPTH"; string ViewZnMacro = "MRT_DEPTH_N"; string ViewZ_RGBMacro = "MRT_DEPTH_RGB"; string ZMacro = "MRT_Z"; string Z_RGBMacro = "MRT_Z_RGB"; string OverflowColorMacro = "MRT_EXCESS_COLOR"; string CustomMacro = "MRT_CUSTOM"; string User_RGBMacro = "MRT_USER_RGB"; string ViewNZMacro = "MRT_VIEW_NORMAL_DEPTH"; string ViewN_RGBMacro = "MRT_VIEW_NORMAL_RGB"; string NoneDescription = "No data output"; string ViewZDescription = "Z value in view coordinate"; string ViewZnDescription = "Normalized Z value in view coordinate"; string ViewZ_RGBDescription = "Decompose Z value to RGB"; string ZDescription = "Z value in perspective coordinate"; string Z_RGBDescription = "Decompose perspective Z value to RGB"; string OverflowColorDescription = "Overflow color"; string CustomDescription = "Customize RT output"; string User_RGBDescription = "User specified RGB output"; string ViewNZDescription = "Normal and Z in view coordinate"; string ViewN_RGBDescription = "View normal as color"; string NoneDescriptionJ = "なし"; string ViewZDescriptionJ = "深度値"; string ViewZnDescriptionJ = "正規化した深度値"; string ViewZ_RGBDescriptionJ = "RGBに深度値"; string ZDescriptionJ = "Z値"; string Z_RGBDescriptionJ = "RGBにZ値を書き込む"; string OverflowColorDescriptionJ = "1.0を超えた色を書き込む"; string CustomDescriptionJ = "カスタマイズ"; string User_RGBDescriptionJ = "ユーザー指定のRGB"; string ViewNZDescriptionJ = "法線と深度"; string ViewN_RGBDescriptionJ = "法線(カラー)"; >; #line 107 string slMRTCustomFileOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_CUSTOM_MRT_INCLUDE_FILE"; string Default = ""; string Description = "An option to specify custom MRT file"; string DescriptionJ = "カスタマイズ用ファイル"; >; #line 139 int slMRTAccessory : ACCESSORY < string Name = "MRT"; string Macro = "SLC_MRT_ENABLED"; string Modifier = "M"; int CreateClass = 0; string Description = "An accessory for multi render target"; string DescriptionJ = "マルチレンダーターゲットアクセサリ"; string RT1 = "slMRTOutputOption, SLC_MRT_1_OLD"; string RT2 = "slMRTOutputOption, SLC_MRT_2_OLD"; string RT3 = "slMRTOutputOption, SLC_MRT_3_OLD"; string File = "slMRTCustomFileOption"; string Key = "MRT"; >; #line 178 bool slcIsMRT() { return 0; } #line 188 bool slcIsIgnoredMRT() { return 0; } #line 199 int slcGetMRT1() { if (slcIsIgnoredMRT()) { return 0; } else { return 0; } } #line 215 int slcGetMRT2() { if (slcIsIgnoredMRT()) { return 0; } else { return 0; } } #line 231 int slcGetMRT3() { if (slcIsIgnoredMRT()) { return 0; } else { return 0; } } #line 247 bool slcDoesMRTOutputDepth() { return (slcGetMRT1() == 1 || slcGetMRT2() == 1 || slcGetMRT3() == 1) || (slcGetMRT1() == 3) || (slcGetMRT2() == 3) || (slcGetMRT3() == 3); } #line 258 bool slcDoesMRTOutputNormalizeDepth() { return (slcGetMRT1() == 2 || slcGetMRT2() == 2 || slcGetMRT3() == 2); } #line 268 bool slcDoesMRTOutputZ() { return (slcGetMRT1() == 4 || slcGetMRT2() == 4 || slcGetMRT3() == 4) || (slcGetMRT1() == 5 || slcGetMRT2() == 5 || slcGetMRT3() == 5); } #line 279 bool slcDoesMRTOutputViewNormalDepth() { return (slcGetMRT1() == 9 || slcGetMRT2() == 9 || slcGetMRT3() == 9); } #line 289 bool slcDoesMRTOutputViewNormalRGB() { return (slcGetMRT1() == 10 || slcGetMRT2() == 10 || slcGetMRT3() == 10); } #line 1 "D://KTGL/shaderlib2/shader/include/slAccParallaxMap.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccNormalMap.fxh" #line 86 "D://KTGL/shaderlib2/shader/include/slAccParallaxMap.fxh" int slParallaxExtraSamplesOption : ACCESSORYOPTION < string Name = "SLO_PARALLAX_MAP_EXTRA_SAMPLES"; int Default = 0 ; string Description = "An option to perform extra samples"; string DescriptionJ = "追加サンプリング回数"; int Min = 0; int Max = 3; >; #line 114 int slParallaxMapOffSetLimitingOption : ACCESSORYOPTION < string Name = "SLO_PARALLAX_MAP_OFFSET_LIMIT_METHOD"; int Default = 1 ; string List = "Off, On, On2"; int On = 2; int On2 = 1; int Off = 0; string Description = "An option to perform offset limiting"; string DescriptionJ = "オフセット制限オプション"; >; #line 142 int slParallaxMapOffsetTargetOption : ACCESSORYOPTION < string Name = "SLO_PARALLAX_MAP_SHIFT_ONLY_STAGE0"; int Default = 0; string List = "Stage0Only, All"; int Stage0Only = 1; int All = 0; string Description = "Target of shifting texcoord"; string DescriptionJ = "シフト対象のテクスチャ座標"; >; #line 186 int slParallaxMapAccessory : ACCESSORY < string Name = "ParallaxMap"; string Modifier = "Pm"; string Macro = "SLC_PARALLAX_MAPPING"; string Exclude = "PerPixel,NormalMap"; string Description = "An accessory to make a shader with parallax map"; string DescriptionJ = "パララックスマッピングアクセサリ"; int CreateClass = 2; string CreatorClass = "CParallaxMapAccessoryCreator"; string ExtraSamples = "slParallaxExtraSamplesOption"; string Limiting = "slParallaxMapOffSetLimitingOption"; string OffsetTarget = "slParallaxMapOffsetTargetOption"; string Mirror = "slNormalMapMirrorOption"; string TexCoord = "slNormalMapTexCoordOption"; >; #line 240 SLT_BOOL slcIsParallaxMapping() { return 0; } #line 251 SLT_INT sloGetParallaxOffsetLimitMethod() { return 1; } #line 261 SLT_INT sloGetParallaxOffsetTarget() { return 0; } #line 270 SLT_INT sloGetParallaxExtraSampleNum() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccParallaxMapBlend.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccParallaxMap.fxh" #line 52 "D://KTGL/shaderlib2/shader/include/slAccParallaxMapBlend.fxh" int slParallaxBlendBlendOption : ACCESSORYOPTION < string Name = "SLO_PARALLAX_MAP_BLEND"; int Default = 0 ; string Description = "An option to perform extra samples"; string DescriptionJ = "ブレンディング方法"; int Min = 0; int Max = 1; >; #line 96 int slParallaxMapBlendAccessory : ACCESSORY < string Name = "ParallaxMapBlend"; string Modifier = "Pmb"; string Macro = "SLC_PARALLAX_MAPPING_BLEND"; string Exclude = "PerPixel,NormalMap"; string Description = "An accessory to make a blending shader with double parallax maps"; string DescriptionJ = "パララックスマッピングブレンドアクセサリ"; int CreateClass = 2; string CreatorClass = "CParallaxMapBlendAccessoryCreator"; string ExtraSamples = "slParallaxExtraSamplesOption"; string Limiting = "slParallaxMapOffSetLimitingOption"; string OffsetTarget = "slParallaxMapOffsetTargetOption"; string Mirror = "slNormalMapMirrorOption"; string TexCoord = "slNormalMapTexCoordOption"; >; #line 131 SLT_BOOL slcIsParallaxMapBlendAccessory() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccNormalMap.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccNormalMapBlend.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccPatternMap.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../include/slCompileOptions.fxh" #line 170 "D://KTGL/shaderlib2/shader/include/slAccPatternMap.fxh" int slPatternMapOption : ACCESSORYOPTION < string Name = "SLO_PATTERNMAP_TYPE"; int Default = 0 ; string Description = "Pattern mapping type"; string DescriptionJ = "マッピング方法"; string List = "Planar, PlanarClip, PlanarProj"; int Planar = 0; int PlanarClip = 1; int PlanarProj = 2; string PlanarMacro = "KTGL_SHLIB_PATTERN_MAPPING_TYPE_PLANAR_MAP"; string PlanarClipMacro = "KTGL_SHLIB_PATTERN_MAPPING_TYPE_PLANAR_CLIP"; string PlanarProjMacro = "KTGL_SHLIB_PATTERN_MAPPING_TYPE_PLANAR_PROJECTION"; string PlanarDescription = "Planar map"; string PlanarClipDescription = "Planar with clip"; string PlanarProjDescription = "Planar Projection"; string PlanarDescriptionJ = "平面投影"; string PlanarClipDescriptionJ = "クリップ付平面投影"; string PlanarProjDescriptionJ = "透視変換"; >; #line 216 int slPatternMapVSTransOption : ACCESSORYOPTION < string Name = "SLO_PATTERNMAP_TRANSFORM_IN_VS"; int Default = 1 ; string Description = "Transform in vertex shader"; string DescriptionJ = "頂点シェーダで座標変換"; int Min = 0; int Max = 1; >; #line 232 int slPatternMapFadeOption : ACCESSORYOPTION < string Name = "SLO_PATTERNMAP_ENABLE_FADE"; int Default = 0 ; string Description = "Enable fade in/out"; string DescriptionJ = "フェードイン・アウトを行う"; int Min = 0; int Max = 1; >; #line 273 int slPatternMapAccessory : ACCESSORY < string Name = "PatternMap"; string Modifier = "Pt"; string Macro = "SLC_PATTERN_MAPPING"; string Description = "An accessory for pattern lighting"; string DescriptionJ = "パターンライティンアクセサリ"; int CreateClass = 2; string CreatorClass = "CPatternMapAccessoryCreator"; string MapType = "slPatternMapOption"; string VSTrans = "slPatternMapVSTransOption"; string Fade = "slPatternMapFadeOption"; >; #line 326 bool slcIsPatternMapping() { return 1; } #line 336 SLT_INT sloGetPatternMapType() { return 0; } #line 349 SLT_BOOL sloIsPatternMapTransformPerformedInVS() { return 1; } #line 360 SLT_BOOL sloIsPatternMapFadeEnabled() { return 0; } #line 369 SLT_BOOL sloPatternMapForIsSimpleLightMap() { return 0 && sloGetPatternMapType() == 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccPixelLighting.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccRamp.fxh" #line 48 int slRampAccessory : ACCESSORY < string Name = "Ramp"; string Macro = "SLC_RAMP_LIGHTING"; string Modifier = "Yr"; int CreateClass = 1; string CreatorClass = "CRampAccessoryCreator"; string Description = "An accessory to make a shader with ramp texture"; string DescriptionJ = "ランプアクセサリ"; >; #line 78 SLT_BOOL slcIsRampAccessory() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccRim.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../include/slCompileOptions.fxh" #line 120 "D://KTGL/shaderlib2/shader/include/slAccRim.fxh" int slRimLightTargetOption : ACCESSORYOPTION < string Name = "SLO_RIM_LIGHT_TARGET"; int Default = 0 ; string List = "All, Main, None"; string Description = "Target lights for rim effect"; string DescriptionJ = "リム計算の対象"; int All = 0; int Main = 1; int None = 2; string AllDescription = "All light"; string MainDescription = "Main light Only"; string NoneDescription = "No light dependency"; string AllDescriptionJ = "全てのライト"; string MainDescriptionJ = "メインライトのみ"; string NoneDescriptionJ = "ライトに依存しない"; >; #line 149 int slRimModeOption : ACCESSORYOPTION < string Name = "SLO_RIMMODE_ADD"; int Default = 0; string Description = "Apply mode"; string DescriptionJ = "リムの適用先"; string List = "Diffuse, Add"; string Modifier = " , a"; int Diffuse = 0; int Add = 1; string DiffuseDescription = "Apply as diffuse"; string AddDescription = "Add rim term after texture blending"; string DiffuseDescriptionJ = "ディフューズとして適用"; string AddDescriptionJ = "加算する"; int DetectType = 3; >; #line 176 int slRimSeparateFromShadowOption : ACCESSORYOPTION < string Name = "SLO_RIM_SEPARATE_FROM_SHADOW"; int Default = 0 ; string Description = "Not casting shadow to rim term"; string DescriptionJ = "リムに影を落とさない"; int Min = 0; int Max = 1; >; #line 215 int slRimAccessory : ACCESSORY < string Name = "Rim"; string Macro = "SLC_RIM_LIGHTING"; string Modifier = "Ri"; int CreateClass = 2; string Description = "An accessory for Rim Lighting"; string DescriptionJ = "リムライティングアクセサリ"; string Target = "slRimLightTargetOption"; string Mode = "slRimModeOption"; string NoShadow = "slRimSeparateFromShadowOption"; string Lock = "Rim"; >; #line 262 bool slcIsRimLighting() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccScaleColor.fxh" #line 51 float slScaleColorScaleOption : ACCESSORYOPTION < string Name = "SLO_SCALE_COLOR_VALUE"; float Default = 1.0f; string Description = "An option to specify scale color value"; string DescriptionJ = "カラースケールアクセサリのスケール値"; >; #line 79 int slScaleColorAccessory : ACCESSORY < string Name = "ScaleColor"; string Macro = "SLC_COLORSCALE_ACCESSORY_ENABLED"; string Modifier = "Csc"; int CreateClass = 0; string Description = "An accessory to scale output color"; string DescriptionJ = "カラースケールアクセサリ"; string Scale = "slScaleColorScaleOption"; string Key = "Color, ToneMap"; >; #line 111 SLT_BOOL slcIsScaleColorAccessory() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccTextureAnimation.fxh" #line 152 bool slcIsColorSurfaceTextureAnimation(uniform int nIndex) { if ( nIndex == 0 ) { return 0; } else if ( nIndex == 1 ) { return 0; } else if ( nIndex == 2 ) { return 0; } else if ( nIndex == 3 ) { return 0; } else { return false; } } #line 172 bool slcIsShaderUsageTextureAnimation(uniform int nIndex) { if ( nIndex == 0 ) { return 0; } else if ( nIndex == 1 ) { return 0; } else if ( nIndex == 2 ) { return 0; } else if ( nIndex == 3 ) { return 0; } else { return false; } } #line 192 bool slcIsNormalMapTextureAnimation() { return 0; } #line 202 bool slcIsEmissiveMapTextureAnimation() { return 0; } #line 212 bool slcIsTextureAnimationAll() { return 0; } #line 222 bool slcIsTextureAnimation() { return 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0; } #line 256 int slTexAnimationColor0Accessory : ACCESSORY < string Name = "TexAnimationColor0"; string Macro = "SLC_TEX_ANIMATION_COLOR0"; string Modifier = "T0"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with texture color0 animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(カラーサーフェス0)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 284 int slTexAnimationColor1Accessory : ACCESSORY < string Name = "TexAnimationColor1"; string Macro = "SLC_TEX_ANIMATION_COLOR1"; string Modifier = "T1"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with texture color1 animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(カラーサーフェス1)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 311 int slTexAnimationColor2Accessory : ACCESSORY < string Name = "TexAnimationColor2"; string Macro = "SLC_TEX_ANIMATION_COLOR2"; string Modifier = "T2"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with texture color2 animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(カラーサーフェス2)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 338 int slTexAnimationColor3Accessory : ACCESSORY < string Name = "TexAnimationColor3"; string Macro = "SLC_TEX_ANIMATION_COLOR3"; string Modifier = "T3"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with texture color3 animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(カラーサーフェス3)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 368 int slTexAnimationNormalMapAccessory : ACCESSORY < string Name = "TexAnimationNormalMap"; string Macro = "SLC_TEX_ANIMATION_NORMALMAP"; string Modifier = "Tn"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with normalmap animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(法線マップ)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 395 int slTexAnimationShader0Accessory : ACCESSORY < string Name = "TexAnimationShader0"; string Macro = "SLC_TEX_ANIMATION_SHADER0"; string Modifier = "Ts0"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with special texture0 animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(特殊テクスチャ0)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 422 int slTexAnimationShader1Accessory : ACCESSORY < string Name = "TexAnimationShader1"; string Macro = "SLC_TEX_ANIMATION_SHADER1"; string Modifier = "Ts1"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with special texture1 animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(特殊テクスチャ1)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 449 int slTexAnimationShader2Accessory : ACCESSORY < string Name = "TexAnimationShader2"; string Macro = "SLC_TEX_ANIMATION_SHADER2"; string Modifier = "Ts2"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with special texture2 animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(特殊テクスチャ2)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 476 int slTexAnimationShader3Accessory : ACCESSORY < string Name = "TexAnimationShader3"; string Macro = "SLC_TEX_ANIMATION_SHADER3"; string Modifier = "Ts3"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with special texture3 animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(特殊テクスチャ3)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 507 int slTexAnimationEmissiveMapAccessory : ACCESSORY < string Name = "TexAnimationEmissiveMap"; string Macro = "SLC_TEX_ANIMATION_EMISSIVEMAP"; string Modifier = "Te"; string Exclude = "TexAnimationAll"; string Description = "An accessory to make a shader with emissive-map animation"; string DescriptionJ = "テクスチャアニメーションアクセサリ(エミッシブマップ)"; int CreateClass = 2; string CreatorClass = "CTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 535 int slTexAnimationAllAccessory : ACCESSORY < string Name = "TexAnimationAll"; string Macro = "SLC_TEX_ANIMATION_ALL"; string Modifier = "T"; string Description = "An accessory to make a shader with all texture animation"; string DescriptionJ = "汎用テクスチャアニメーションアクセサリ"; int CreateClass = 2; string CreatorClass = "CGeneralTextureAnimationAccessoryCreator"; string Key = "Tex"; >; #line 1 "D://KTGL/shaderlib2/shader/include/slAccAlphaTest.fxh" #line 76 int slAlphaTestOption : ACCESSORYOPTION < string Name = "SLO_ALPHATEST_TARGET"; int Default = 0; string Description = "Alpha test source"; string DescriptionJ = "アルファテストに使用するソ\ース"; string List = "Stage0, FinalColor"; int Stage0 = 0; int FinalColor = 1; >; #line 109 int slAlphaTestAccessory : ACCESSORY < string Name = "AlphaTest"; string Macro = "SLC_ALPHA_TEST"; string Modifier = "At"; int CreateClass = 0; string Description = "An accessory to perform alpha test in a pixel shader"; string DescriptionJ = "アルファテストアクセサリ"; string Source = "slAlphaTestOption"; >; #line 142 SLT_BOOL slcIsAlphaTest() { return 0; } #line 152 SLT_INT sloGetAlphaTestSource() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccTextureBlur.fxh" #line 51 int slTextureBlurSampleNumOption : ACCESSORYOPTION < string Name = "SLC_TEXTURE_BLUR_SAMPLE_NUM"; int Default = 2; string Description = "Specify how many times to sample a texture."; string DescriptionJ = "サンプリング回数の指定"; int Min = 0; int Max = 16; >; #line 67 int slTextureBlurAnisotropicOption : ACCESSORYOPTION < string Name = "SLC_TEXTURE_BLUR_ANISOTROPIC"; int Default = 0; string Description = "An option to use anisotropic filter."; string DescriptionJ = "異方性フィルタオプション"; string List = "On, Off"; int On = 1; int Off = 0; >; #line 118 int slTextureBlurAccessory : ACCESSORY < string Name = "TexBlur"; string Macro = "SLC_ENABLE_TEXTURE_BLUR"; string Modifier = "Tb"; int CreateClass = 2; string CreatorClass = "CTextureBlurAccessoryCreator"; string Description = "Texture Blur accessory"; string DescriptionJ = "テクスチャブラーアクセサリ"; string SampleNum = "slTextureBlurSampleNumOption"; string Anisotropic = "slTextureBlurAnisotropicOption"; >; #line 148 bool slcIsTextureBlurEnabled() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccToneMap.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../include/slCompileOptions.fxh" #line 50 "D://KTGL/shaderlib2/shader/include/slAccToneMap.fxh" bool slcToneMapping() { return 0; } #line 60 bool slcInverseToneMapping() { return 0; } #line 152 int slToneMapTypeOption : ACCESSORYOPTION < string Name = "SLO_TONEMAP_TYPE"; int Default = 0 ; string Description = "Tone mapping type"; string DescriptionJ = "トーンマップタイプ"; string List = "None, Linear, Log, Reinhard, Texture"; int None = 0; int Linear = 1; int Log = 2; int Reinhard = 3; int _Texture = 4; string NoneMacro = "KTGL_SHLIB_TONE_MAPPING_TYPE_NONE"; string LinearMacro = "KTGL_SHLIB_TONE_MAPPING_TYPE_LINEAR"; string LogMacro = "KTGL_SHLIB_TONE_MAPPING_TYPE_LOG"; string ReinhardMacro = "KTGL_SHLIB_TONE_MAPPING_TYPE_REINHARD"; string TextureMacro = "KTGL_SHLIB_TONE_MAPPING_TYPE_TEXTURE"; string NoneDescription = "No tone mapping"; string LinearDescription = "Linear mapping"; string LogDescription = "Log mapping"; string ReinhardDescription = "Reinhard mapping"; string TextureDescription = "Tone mapping with texture"; string NoneDescriptionJ = "トーンマッピングを行わない"; string LinearDescriptionJ = "線形マッピング"; string LogDescriptionJ = "対数マッピング"; string ReinhardDescriptionJ = "Reinhardマッピング"; string TextureDescriptionJ = "テクスチャを使ったトーンマッピング"; >; #line 200 int slToneMapApplyToOption : ACCESSORYOPTION < string Name = "SLO_TONEMAP_APPLY_TO"; int Default = 0 ; string Description = "Tone mapping target"; string DescriptionJ = "トーンマップの適用対象"; string List = "RGB, Lum"; int RGB = 0; int Lum = 1; string RGBDescription = "Tone mapping to RGB"; string LumDescription = "Tone mapping to luminance"; string RGBDescriptionJ = "RGBに適用"; string LumDescriptionJ = "輝度に適用"; >; #line 236 int slToneMapExposureOption : ACCESSORYOPTION < string Name = "SLO_TONEMAP_EXPOSURE"; int Default = 0 ; string Description = "Exposure correction option"; string DescriptionJ = "露光補正オプション"; string List = "None, Direct, LumValue, LumTexture, DirectTexture"; int None = 0; int Direct = 1; int LumValue = 2; int LumTexture = 3; int DirectTexture = 4; string NoneMacro = "KTGL_SHLIB_TONE_MAPPING_EXPOSURE_NONE"; string DirectMacro = "KTGL_SHLIB_TONE_MAPPING_EXPOSURE_DIRECT"; string LumValueMacro = "KTGL_SHLIB_TONE_MAPPING_EXPOSURE_VALUE"; string LumTextureMacro = "KTGL_SHLIB_TONE_MAPPING_EXPOSURE_LUM_TEXTURE"; string DirectTextureMacro = "KTGL_SHLIB_TONE_MAPPING_EXPOSURE_DIRECT_TEXTURE"; string NoneDescription = "No exposure correction"; string DirectDescription = "Set an exposure correction value directly"; string LumValueDescription = "Set an average luminance value and a middle gray"; string LumTextureDescription = "Set an average luminance texture and a middle gray"; string DirectTextureDescription = "Set an exposure correction texture directly"; string NoneDescriptionJ = "露光補正なし"; string DirectDescriptionJ = "露光補正係数を直接指定する"; string LumValueDescriptionJ = "平均輝度値と調整後の画面の明るさを指定する"; string LumTextureDescriptionJ = "平均輝度テクスチャと調整後の画面の明るさを指定する"; string DirectTextureDescriptionJ = "露光補正係数をピクセル値に持つテクスチャを指定する"; >; #line 281 int slToneMapCustomFileOption : ACCESSORYOPTION < string Name = "SLO_TONEMAP_CUSTOM_SAMPLING_INCLUDE_FILE"; string Default = ""; string Description = "An option to specify custom sampling macro file"; string DescriptionJ = "テクスチャサンプリングのカスタムマクロファイル"; >; #line 318 int slToneMapAccessory : ACCESSORY < string Name = "ToneMap"; string Modifier = "Tm"; string Macro = "SLC_TONE_MAPPING"; string Description = "An accessory for tone mapping"; string DescriptionJ = "トーンマッピングアクセサリ"; int CreateClass = 2; string CreatorClass = "CToneMapAccessoryCreator"; string Type = "slToneMapTypeOption"; string To = "slToneMapApplyToOption"; string Exposure = "slToneMapExposureOption"; string File = "slToneMapCustomFileOption"; string Key = "ToneMap"; >; #line 1 "D://KTGL/shaderlib2/shader/include/slAccVertexProcessor.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 61 "D://KTGL/shaderlib2/shader/include/slAccVertexProcessor.fxh" int slTransformedVertexCoordOption : ACCESSORYOPTION < string Name = "SLC_VERTEX_TRANSFORMED"; int Default = 2; string Description = "Specify the coordinate system of input vertices"; string DescriptionJ = "入力頂点の座標系"; string List = "Local, World, Projection"; int Local = 1; int World = 2; int Projection = 3; string LocalMacro = "KTGL_SHLIB_VERTEX_TRANSFORMED_LOCAL"; string WorldMacro = "KTGL_SHLIB_VERTEX_TRANSFORMED_WORLD"; string ProjectionMacro = "KTGL_SHLIB_VERTEX_TRANSFORMED_PROJECTION"; string LocalDescription = "Local coord"; string WorldDescription = "World coord"; string ProjectionDescription = "Projection coord"; string LocalDescriptionJ = "ローカル座標系"; string WorldDescriptionJ = "ワールド座標系"; string ProjectionDescriptionJ = "射影座標系"; >; #line 116 int slVertexProcInputOption : ACCESSORYOPTION < string Name = "SLO_VERTEX_PROC_INPUT_FLAGS"; int Default = (0x1+0x2+0); string List = "NotSpecify"; int NotSpecify = (0x1+0x2+0); >; #line 142 int slVertexProcAccessory : ACCESSORY < string Name = "VertexProc"; string Macro = "SLC_ENABLE_TRANSFORMED_VERTEX"; string Modifier = "V"; int CreateClass = 2; string CreatorClass = "CVertexProcAccessoryCreator"; string Description = "An accessory to use vertex processor"; string DescriptionJ = "事前頂点処理アクセサリ"; string Coord = "slTransformedVertexCoordOption"; string Input = "slVertexProcInputOption"; string Key = "Geometry"; >; #line 176 int slcGetVertexCoordinateSpace() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccWaterDrop.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccEnvironmentMap.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slAccNormalMap.fxh" #line 84 "D://KTGL/shaderlib2/shader/include/slAccWaterDrop.fxh" int slDummyReflectionOption : ACCESSORYOPTION < string Name = "SLO_WATERDROP_DUMMY_REFLECTION"; int Default = 0 ; string Description = "Dummy"; string DescriptionJ = "ダミーオプション"; int DetectType = 9; >; #line 102 int slUseDropNormalMapOption : ACCESSORYOPTION < string Name = "SLO_WATERDROP_USE_NORMALMAP"; int Default = 0 ; string Description = "Using normalmap for waterdrop"; string DescriptionJ = "水滴用法線マップを使用"; int Min = 0; int Max = 1; string List = "None, Use"; string Modifier = " , n"; int None = 0; int Use = 1; int DetectType = 4; int DetectColorUsage = 10; >; #line 128 int slUseDropNormalTexCoordOption : ACCESSORYOPTION < string Name = "SLO_WATERDROP_USE_NORMALMAP_TEXCOORD"; int Default = 0 ; string Description = "Using texcoord for waterdrop normalmap"; string DescriptionJ = "水滴用法線マップ専用テクスチャ座標を使用"; int Min = 0; int Max = 1; int DetectType = 15; int DetectUsage = 10; int ReferenceUsage = 9; bool Inverse = true; >; #line 154 int slDropNormalMapAlphaEnvmapMaskOption : ACCESSORYOPTION < string Name = "SLO_WATERDROP_NORMALMAP_ALPHAENVMASK"; int Default = 0 ; string Description = "Using alpha channnel for envmap mask"; string DescriptionJ = "法線マップのアルファを環境マップマスクに使用"; int Min = 0; int Max = 1; int DetectType = 4; int DetectColorUsage = 10; int DetectAlphaUsage = 9; >; #line 201 int slWaterDropAccessory : ACCESSORY < string Name = "WaterDrop"; string Macro = "SLC_WATERDROP"; string Modifier = "Wd"; int CreateClass = 1; string CreatorClass = "CWaterDropAccessoryCreator"; string Exclude = "PerPixel, ParallaxMap, EnvMap"; string Description = "An accessory to express water drops"; string DescriptionJ = "水滴アクセサリ"; string Reflection = "slDummyReflectionOption"; string MapType = "slEnvMapMapTypeOption"; string Transform = "slEnvMapTransformOption"; string RGBS = "slEnvMapRGBSOption"; string Normal = "slUseDropNormalMapOption"; string UseNormalTexCoord = "slUseDropNormalTexCoordOption"; string Mirror = "slNormalMapMirrorOption"; string NormalMapEnvMask = "slDropNormalMapAlphaEnvmapMaskOption"; string Compress = "slNormalMapCompressOption"; >; #line 271 static int s_nWaterDropEnvMaskTCI = 0; static int s_nWaterDropNMTCI = 0; #line 293 SLT_BOOL slcIsWaterDropAccessory() { return 0; } int slGetWaterDropNormalMapTexCoordIndex() { return s_nWaterDropNMTCI; } int slGetWaterDropEnvMapMaskTexCoordIndex() { return s_nWaterDropEnvMaskTCI; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccLightMap.fxh" #line 78 int slLtMapFormatAnnotation : ACCESSORYOPTION < string Name = "SLO_LIGHT_MAP_FORMAT"; int Default = 0; string Description = "Lightmap Format"; string DescriptionJ = "ライトマップフォーマット"; string List = "Basic, Composite"; int Basic = 0; int Composite = 1; > ; #line 108 int slLightMapAccessory : ACCESSORY < string Name = "LightMap"; string Macro = "SLC_LIGHT_MAP"; string Modifier = "Lm"; string Description = "An accessory for lighting with light map"; string DescriptionJ = "ライトマップアクセサリ"; int CreateClass = 2; string CreatorClass = "CLightMapAccessoryCreator"; string LtMapFormat = "slLtMapFormatAnnotation"; >; #line 131 static SLT_INT s_nLightMapTCI = 0; #line 150 SLT_BOOL slcIsLightMapAccessory() { return 0; } #line 164 SLT_INT slpGetLightMapTexCoordIndex() { return s_nLightMapTCI; } #line 178 SLT_INT slpGetLightMapFormat() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccLightProbe.fxh" #line 70 int slLightProbeAccessory : ACCESSORY < string Name = "LightProbe"; string Modifier = "Lp"; string Macro = "SLC_LIGHT_PROBE"; string Description = "An accessory to make a shader with Light Probe"; string DescriptionJ = "ライトプローブアクセサリ"; int CreateClass = 2; string CreatorClass = "CLightProbeAccessoryCreator"; >; #line 112 bool slcIsLightProbe() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccGBuffer.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 37 "D://KTGL/shaderlib2/shader/include/slAccGBuffer.fxh" int slGBufferShaderTypeOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_SHADERTYPE"; int Default = 0; string Description = "Shader Type"; string DescriptionJ = "シェーディングタイプの設定"; >; #line 52 string slGBufferCustomFileOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_CUSTOM_INCLUDE_FILE"; string Default = ""; string Description = "An option to specify custom GBuffer file"; string DescriptionJ = "カスタマイズ用ファイル"; >; #line 67 int slGBufferDephtInMRTOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_DEPTH_IN_MRT"; int Default = 0; string Description = "MRT number of Depth element( don't output depth is 0 )"; string DescriptionJ = "深度値が出力されるMRT番号(入っていなければ0)"; >; #line 86 int slGBufferNumOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_NUM"; int Default = 3; string Description = "GBuffer Num"; string DescriptionJ = "GBufferのMRT枚数"; >; #line 106 int slGBufferRSMLightingOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_RSM_LIGHTING"; string List = "None,Standard,PhysBasedStandard,PhysBasedMetal"; int Default = 0; int None = 0; int Standard = 1; int PhysBasedStandard = 2; int PhysBasedMetal = 3; >; #line 1 "D://KTGL/shaderlib2/shader/include/slAccGBufferMRTOption.fxh" #line 16 string slGBufferMRT1_X_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT1_X"; string Default = ""; string Description = "GBuffer MRT1 X Element"; string DescriptionJ = "MRT1番目のXエレメント"; bool Quotate = false; >; string slGBufferMRT1_Y_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT1_Y"; string Default = ""; string Description = "GBuffer MRT1 Y Element"; string DescriptionJ = "MRT1番目のYエレメント"; bool Quotate = false; >; string slGBufferMRT1_Z_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT1_Z"; string Default = ""; string Description = "GBuffer MRT1 Z Element"; string DescriptionJ = "MRT1番目のZエレメント"; bool Quotate = false; >; string slGBufferMRT1_W_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT1_W"; string Default = ""; string Description = "GBuffer MRT1 W Element"; string DescriptionJ = "MRT1番目のWエレメント"; bool Quotate = false; >; #line 64 string slGBufferMRT2_X_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT2_X"; string Default = ""; string Description = "GBuffer MRT2 X Element"; string DescriptionJ = "MRT2番目のXエレメント"; bool Quotate = false; >; string slGBufferMRT2_Y_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT2_Y"; string Default = ""; string Description = "GBuffer MRT2 Y Element"; string DescriptionJ = "MRT2番目のYエレメント"; bool Quotate = false; >; string slGBufferMRT2_Z_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT2_Z"; string Default = ""; string Description = "GBuffer MRT2 Z Element"; string DescriptionJ = "MRT2番目のZエレメント"; bool Quotate = false; >; string slGBufferMRT2_W_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT2_W"; string Default = ""; string Description = "GBuffer MRT2 W Element"; string DescriptionJ = "MRT2番目のWエレメント"; bool Quotate = false; >; #line 112 string slGBufferMRT3_X_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT3_X"; string Default = ""; string Description = "GBuffer MRT3 X Element"; string DescriptionJ = "MRT3番目のXエレメント"; bool Quotate = false; >; string slGBufferMRT3_Y_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT3_Y"; string Default = ""; string Description = "GBuffer MRT3 Y Element"; string DescriptionJ = "MRT3番目のYエレメント"; bool Quotate = false; >; string slGBufferMRT3_Z_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT3_Z"; string Default = ""; string Description = "GBuffer MRT3 Z Element"; string DescriptionJ = "MRT3番目のZエレメント"; bool Quotate = false; >; string slGBufferMRT3_W_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT3_W"; string Default = ""; string Description = "GBuffer MRT3 W Element"; string DescriptionJ = "MRT3番目のWエレメント"; bool Quotate = false; >; #line 160 string slGBufferMRT4_X_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT4_X"; string Default = ""; string Description = "GBuffer MRT4 X Element"; string DescriptionJ = "MRT4番目のXエレメント"; bool Quotate = false; >; string slGBufferMRT4_Y_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT4_Y"; string Default = ""; string Description = "GBuffer MRT4 Y Element"; string DescriptionJ = "MRT4番目のYエレメント"; bool Quotate = false; >; string slGBufferMRT4_Z_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT4_Z"; string Default = ""; string Description = "GBuffer MRT4 Z Element"; string DescriptionJ = "MRT4番目のZエレメント"; bool Quotate = false; >; string slGBufferMRT4_W_Option : ACCESSORYOPTION < string Name = "SLC_SHLIB_GBUFFER_MRT4_W"; string Default = ""; string Description = "GBuffer MRT4 W Element"; string DescriptionJ = "MRT4番目のWエレメント"; bool Quotate = false; >; #line 131 "D://KTGL/shaderlib2/shader/include/slAccGBuffer.fxh" int slGBufferAccessory : ACCESSORY < string Name = "GBuffer"; string Macro = "SLC_GBUFFER_ENABLED"; string Modifier = "Gb"; int CreateClass = 2; string CreatorClass = "CGBufferAccessoryCreator"; string Description = "An accessory for GBuffer"; string DescriptionJ = "GBufferアクセサリ"; string ShaderType = "slGBufferShaderTypeOption"; string CustomFile = "slGBufferCustomFileOption"; string DepthInMRT = "slGBufferDephtInMRTOption"; string MRTNum = "slGBufferNumOption"; string RSMLighting = "slGBufferRSMLightingOption"; string MRT1_X = "slGBufferMRT1_X_Option"; string MRT1_Y = "slGBufferMRT1_Y_Option"; string MRT1_Z = "slGBufferMRT1_Z_Option"; string MRT1_W = "slGBufferMRT1_W_Option"; string MRT2_X = "slGBufferMRT2_X_Option"; string MRT2_Y = "slGBufferMRT2_Y_Option"; string MRT2_Z = "slGBufferMRT2_Z_Option"; string MRT2_W = "slGBufferMRT2_W_Option"; string MRT3_X = "slGBufferMRT3_X_Option"; string MRT3_Y = "slGBufferMRT3_Y_Option"; string MRT3_Z = "slGBufferMRT3_Z_Option"; string MRT3_W = "slGBufferMRT3_W_Option"; string MRT4_X = "slGBufferMRT4_X_Option"; string MRT4_Y = "slGBufferMRT4_Y_Option"; string MRT4_Z = "slGBufferMRT4_Z_Option"; string MRT4_W = "slGBufferMRT4_W_Option"; string Key = "MRT"; >; SLT_BOOL slcIsGBuffer() { return 0; } SLT_INT slcGetGBufferShaderType() { return 0; } SLT_INT slcGetGBufferDephtInMRT() { return 0; } SLT_INT slcGetGBufferNum() { return 3; } SLT_INT slcGetGBufferRSMLighting() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccPNTriangles.fxh" #line 15 int slPNTrianglesDisplacementMappingOption : ACCESSORYOPTION < string Name = "SLO_PN_TRIANGLES_DISPLACEMENT_MAPPING"; string Macro = "SLO_PN_TRIANGLES_DISPLACEMENT_MAPPING"; string List = "None, NormalMapA"; int Default = 0; int None = 0; int NormalMapA = 1; >; int slPNTriangles : ACCESSORY < string Name = "PNTriangles"; string Macro = "SLC_PN_TRIANGLES"; string Modifier = "Pnt"; string Description = ""; string DescriptionJ = ""; string Key = "Geometry"; string DisplacementMap = "slPNTrianglesDisplacementMappingOption"; >; bool slcIsPNTriangles() { return 0; } int sloGetPNTrianglesDisplacementMapping() { return SLO_PN_TRIANGLES_DISPLACEMENT_MAPPING; } void slSetUpPNTrianglesVertex( inout PIPE _pipe ) { if ( slcIsPNTriangles() ) { _pipe.Output( "floatinterpolation ""SLT_SHADOWMAP4", "vPntShadowPos3", "PNT_SHADOWPOS3" ); _pipe.Output( "floatinterpolation ""SLT_SHADOWMAP4", "vPntShadowPos2", "PNT_SHADOWPOS2" ); _pipe.Output( "floatinterpolation ""SLT_SHADOWMAP4", "vPntShadowPos1", "PNT_SHADOWPOS1" ); _pipe.Output( "floatinterpolation ""SLT_SHADOWMAP4", "vPntShadowPos0", "PNT_SHADOWPOS0" ); _pipe.Output( "SLT_TEXCOORD2", "vPntNmhCoord", "PNT_NMHCOORD" ); _pipe.Output( "SLT_DIR3" , "vPntNormal", "PNT_NORMAL" ); _pipe.Output( "SLT_POINT4", "vPntPos" , "PNT_POSITION" ); } } void slOutputPNTrianglesVertex( inout PIPE _pipe ) { if ( slcIsPNTriangles() ) { _pipe.vPntPos = _pipe.vWorldPos; _pipe.vPntNormal = _pipe.vcWorldNormal; if ( 1 == sloGetPNTrianglesDisplacementMapping() ) { _pipe.vPntNmhCoord = slGetNormalMapTexCoord( _pipe ); } if ( _pipe.IsExisting( "vShadowPos0" ) ) { _pipe.vPntShadowPos0 = _pipe.vShadowPos0; } if ( _pipe.IsExisting( "vShadowPos1" ) ) { _pipe.vPntShadowPos1 = _pipe.vShadowPos1; } if ( _pipe.IsExisting( "vShadowPos2" ) ) { _pipe.vPntShadowPos2 = _pipe.vShadowPos2; } if ( _pipe.IsExisting( "vShadowPos3" ) ) { _pipe.vPntShadowPos3 = _pipe.vShadowPos3; } } } void slSetUpPNTrianglesPixel( inout PIPE _pipe ) { if ( slcIsPNTriangles() ) { if ( _pipe.IsExisting( "vWorldPos" ) ) { _pipe.vWorldPos = _pipe.vPntPos; } if ( _pipe.IsExisting( "vcWorldNormal" ) ) { _pipe.vcWorldNormal = _pipe.vPntNormal; } if ( _pipe.IsExisting( "vShadowPos0" ) ) { _pipe.vShadowPos0 = _pipe.vPntShadowPos0; } if ( _pipe.IsExisting( "vShadowPos1" ) ) { _pipe.vShadowPos1 = _pipe.vPntShadowPos1; } if ( _pipe.IsExisting( "vShadowPos2" ) ) { _pipe.vShadowPos2 = _pipe.vPntShadowPos2; } if ( _pipe.IsExisting( "vShadowPos3" ) ) { _pipe.vShadowPos3 = _pipe.vPntShadowPos3; } } } void slOutputPNTrianglesPixel( inout SLT_COLOR4 _out, inout PIPE _pipe ) { if ( slcIsPNTriangles() ) { _out += _pipe.vPntPos * 0.0; _out.xyz += _pipe.vPntNormal * 0.0; if ( 1 == sloGetPNTrianglesDisplacementMapping() ) { _out.xy += _pipe.vPntNmhCoord * 0.0; } } } #line 1 "D://KTGL/shaderlib2/shader/include/slAccOrenNayar.fxh" #line 51 int slOrenNayarAccessory : ACCESSORY < string Name = "OrenNayar"; string Macro = "SLC_OREN_NAYAR"; string Modifier = "On"; int CreateClass = 0; string Description = "An accessory for Oren-Nayar Reflectance Model"; string DescriptionJ = "Oren-Nayar反射モデルアクセサリ"; string Lock = "PhysicallyBased"; >; #line 77 bool slcIsOrenNayar() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccSSSTransmit.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 40 "D://KTGL/shaderlib2/shader/include/slAccSSSTransmit.fxh" int slSSSSeparateOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_SSS_SEPARATESPEC"; int Default = 0; string Description = "Specular Output Type"; string DescriptionJ = "スペキュラ出力の設定"; >; #line 61 int slSSSTransmitOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_SSS_TRANSMIT"; int Default = 0; string Description = "Specular Output Type"; string DescriptionJ = "透過処理の設定"; >; #line 81 int slSSSDephtInMRTOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_SSS_DEPTH"; int Default = 0; string Description = "Depth Output"; string DescriptionJ = "深度出力の設定"; >; #line 105 int slSSSDepthMapTypeOption : ACCESSORYOPTION < string Name = "SLC_SHLIB_SSS_DEPTH_MAP_TYPE"; int Default = 0; string Description = "Depth map type"; string DescriptionJ = "深度マップの種類"; string List = "PLANAR_MAP, PLANAR_PROJECT, CASCADE2_PROJECT, CASCADE3_PROJECT, CASCADE4_PROJECT, CASCADE2_MAP, CASCADE3_MAP, CASCADE4_MAP, Auto"; int PLANAR_MAP = 0; int PLANAR_PROJECT = 1; int CASCADE2_PROJECT = 6; int CASCADE3_PROJECT = 7; int CASCADE4_PROJECT = 8; int CASCADE2_MAP = 9; int CASCADE3_MAP = 10; int CASCADE4_MAP = 11; int Auto = 8; >; #line 138 int slSSSTransmitAccessory : ACCESSORY < string Name = "SSSTransmit"; string Macro = "SLC_SSS_ENABLED"; string Modifier = "Sss"; int CreateClass = 2; string CreatorClass = "CSSSTransmitAccessoryCreator"; string Description = "An accessory for SSS"; string DescriptionJ = "SSSアクセサリ"; string SeparateSpec = "slSSSSeparateOption"; string Transmit = "slSSSTransmitOption"; string DepthInMRT = "slSSSDephtInMRTOption"; string DepthMapType = "slSSSDepthMapTypeOption"; string Key = "Sss"; >; SLT_BOOL slcIsSSS() { return 0; } SLT_BOOL slcGetSSSSeparateSpecular() { return 0; } SLT_BOOL slcGetSSSTransmit() { return 0; } SLT_BOOL slcGetSSSDepthInMrt() { return 0; } SLT_BOOL slcIsSSSCascadeEnable() { return (0 == 6 || 0 == 7 || 0 == 8 || 0 == 9 || 0 == 10 || 0 == 11 ); } SLT_INT slcGetSSSCascadeNum() { if (0 == 0 || 0 == 1) { return 1; } if (0 == 6 || 0 == 9) { return 2; } if (0 == 7 || 0 == 10) { return 3; } if (0 == 8 || 0 == 11) { return 4; } } SLT_INT slcIsSSSLSPEnable() { return ( 0 == 1 || 0 == 6 || 0 == 7 || 0 == 8 ); } SLT_INT slcIsSSSOutputPositionVertex() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccMaterialScaler.fxh" #line 54 int slMaterialScalerAccessory : ACCESSORY < string Name = "MaterialScaler"; string Modifier = ""; string Macro = "SLC_MATERIAL_SCALER"; string Description = "An accessory to scale material"; string DescriptionJ = "マテリアルにスケールをかけるアクセサリ"; int CreateClass = 2; string CreatorClass = "CMaterialScalerAccessoryCreator"; >; #line 79 bool slcIsMaterialScaler() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccTileLightList.fxh" #line 95 int slTileLightListTileSizeOption : ACCESSORYOPTION < string Name = "SLO_TILE_SIZE"; int Default = 16; string Description = "Tile size for light lists"; string DescriptionJ = "ライトリストに対応するタイルのサイズ"; int Min = 8; int Max = 32; >; #line 114 int slTileLightListMaxLightsPerTileOption : ACCESSORYOPTION < string Name = "SLO_MAX_LIGHTS_PER_TILE"; int Default = 254; string Description = "Max light count per tile"; string DescriptionJ = "タイルごとの最大ライト数"; int Min = 0; >; #line 132 int slTileLightListIsIndex32bitOption : ACCESSORYOPTION < string Name = "SLO_IS_LIGHT_INDEX_32BIT"; int Default = 0; string Description = "Whether light index is 32bit or not"; string DescriptionJ = "ライトインデックスが32bitかどうか"; int Min = 0; int Max = 1; >; #line 167 int slTileLightListIsFixedPitchOption : ACCESSORYOPTION < string Name = "SLO_IS_LIGHT_INDEX_LIST_FIXED_PITCH"; int Default = 1; string Description = "Whether light index list is written in fixed pitch"; string DescriptionJ = "ライトインデックスリストが固定ピッチで書き込まれているか"; int Min = 0; int Max = 1; >; #line 188 int slTileLightListIndicesSlotOption : ACCESSORYOPTION < string Name = "SLO_LIGHT_INDEX_LIST_SLOT"; int Default = 16; string Description = "Resource slot to which light index list is set"; string DescriptionJ = "ライトインデックスリストがセットされるリソ\ーススロット"; int Min = 16; int Max = 127; >; #line 213 int slTileLightListPositionsSlotOption : ACCESSORYOPTION < string Name = "SLO_LIGHT_POSITION_LIST_SLOT"; int Default = 17; string Description = "Resource slot to which light position (and center) list is set"; string DescriptionJ = "ライトの位置(と半径)のリストがセットされるリソ\ーススロット"; int Min = 16; int Max = 127; >; #line 234 int slTileLightListAttributesSlotOption : ACCESSORYOPTION < string Name = "SLO_LIGHT_ATTRIBUTE_LIST_SLOT"; int Default = 18; string Description = "Resource slot to which light attribute list is set"; string DescriptionJ = "ライトアトリビュートリストがセットされるリソ\ーススロット"; int Min = 16; int Max = 127; >; #line 268 int slTileLightListAmbientSourceOption : ACCESSORYOPTION < string Name = "SLO_LIGHT_AMBIENT_COLOR_SOURCE"; int Default = 0; string Description = "Source of light's ambient color"; string DescriptionJ = "ライトのアンビエントカラーがどこに含まれるか"; string List = "Unique, Diffuse, None"; int Unique = 0; int Diffuse = 1; int None = 2; string UniqueMacro = "KTGL_SHLIB_TLL_AMBIENT_UNIQUE"; string DiffuseMacro = "KTGL_SHLIB_TLL_AMBIENT_DIFFUSE"; string NoneMacro = "KTGL_SHLIB_TLL_AMBIENT_NONE"; string UniqueDescription = "Use unique ambient color in light attribute"; string DiffuseDescription = "Use diffuse color in light attribute"; string NoneDescription = "Use (0, 0, 0) as ambient color"; string UniqueDescriptionJ = "ライトアトリビュート内に含まれるアンビエントカラーを使用"; string DiffuseDescriptionJ = "ライトアトリビュート内のディフューズカラーを使用"; string NoneDescriptionJ = "(0, 0, 0)を使用(アンビエントカラーは無効)"; >; #line 311 int slTileLightListAccessory : ACCESSORY < string Name = "TileLightList"; string Modifier = "Tll"; string Macro = "SLC_TILE_LIGHT_LIST"; string Description = "An accessory to apply tile light list"; string DescriptionJ = "タイルごとのライトリストを適用するアクセサリ"; int CreateClass = 2; string CreatorClass = "CTileLightListAccessoryCreator"; string TileSize = "slTileLightListTileSizeOption"; string MaxLightsPerTile = "slTileLightListMaxLightsPerTileOption"; string IsIndex32bit = "slTileLightListIsIndex32bitOption"; string IsFixedPitch = "slTileLightListIsFixedPitchOption"; string IndicesSlot = "slTileLightListIndicesSlotOption"; string PositionsSlot = "slTileLightListPositionsSlotOption"; string AttributesSlot = "slTileLightListAttributesSlotOption"; string AmbientSource = "slTileLightListAmbientSourceOption"; string Exclude = "ClusterLightList"; >; #line 346 SLT_BOOL slcIsTileLightList() { return 0 && (slcGetPSProfile() >= 0x10041); } #line 357 SLT_INT sloGetTileSize() { return 16; } #line 367 SLT_INT sloGetMaxLightsPerTile() { return 254; } #line 377 SLT_BOOL sloIsLightIndex32bit() { return 0; } #line 387 SLT_BOOL sloIsLightIndexListFixedPitch() { return 1; } #line 397 SLT_INT sloGetLightIndexListSlot() { return 16; } #line 407 SLT_INT sloGetLightPositionListSlot() { return 17; } #line 417 SLT_INT sloGetLightAttributeListSlot() { return 18; } #line 427 SLT_INT sloGetLightAmbientColorSource() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccClusterLightList.fxh" #line 102 int slClusterLightListClusterSizeOption : ACCESSORYOPTION < string Name = "SLO_CLUSTER_SIZE"; int Default = 64; string Description = "Cluster size for light lists"; string DescriptionJ = "ライトリストに対応するクラスタのサイズ"; int Min = 8; int Max = 128; >; #line 121 int slClusterLightListClusterZNumOption : ACCESSORYOPTION < string Name = "SLO_CLUSTER_Z_NUM"; int Default = 16; string Description = "Number of clusters in the Z direction"; string DescriptionJ = "Z方向のクラスタ数"; int Min = 16; int Max = 128; >; #line 140 int slClusterLightListMaxLightsPerClusterOption : ACCESSORYOPTION < string Name = "SLO_MAX_LIGHTS_PER_CLUSTER"; int Default = 254; string Description = "Max light count per cluster"; string DescriptionJ = "クラスタごとの最大ライト数"; int Min = 0; >; #line 158 int slClusterLightListIsIndex32bitOption : ACCESSORYOPTION < string Name = "SLO_IS_LIGHT_INDEX_32BIT"; int Default = 0; string Description = "Whether light index is 32bit or not"; string DescriptionJ = "ライトインデックスが32bitかどうか"; int Min = 0; int Max = 1; >; #line 193 int slClusterLightListIsFixedPitchOption : ACCESSORYOPTION < string Name = "SLO_IS_LIGHT_INDEX_LIST_FIXED_PITCH"; int Default = 1; string Description = "Whether light index list is written in fixed pitch"; string DescriptionJ = "ライトインデックスリストが固定ピッチで書き込まれているか"; int Min = 0; int Max = 1; >; #line 228 int slClusterLightListFadeOutOption : ACCESSORYOPTION < string Name = "SLO_CLUSTER_LIGHT_FADE_OUT"; int Default = 0; string Description = "Whether lights fade out"; string DescriptionJ = "ライトを距離でフェードアウトさせるか"; int Min = 0; int Max = 1; >; #line 249 int slClusterLightListIndicesSlotOption : ACCESSORYOPTION < string Name = "SLO_LIGHT_INDEX_LIST_SLOT"; int Default = 16; string Description = "Resource slot to which light index list is set"; string DescriptionJ = "ライトインデックスリストがセットされるリソ\ーススロット"; int Min = 16; int Max = 127; >; #line 274 int slClusterLightListPositionsSlotOption : ACCESSORYOPTION < string Name = "SLO_LIGHT_POSITION_LIST_SLOT"; int Default = 17; string Description = "Resource slot to which light position (and center) list is set"; string DescriptionJ = "ライトの位置(と半径)のリストがセットされるリソ\ーススロット"; int Min = 16; int Max = 127; >; #line 295 int slClusterLightListAttributesSlotOption : ACCESSORYOPTION < string Name = "SLO_LIGHT_ATTRIBUTE_LIST_SLOT"; int Default = 18; string Description = "Resource slot to which light attribute list is set"; string DescriptionJ = "ライトアトリビュートリストがセットされるリソ\ーススロット"; int Min = 16; int Max = 127; >; #line 329 int slClusterLightListAmbientSourceOption : ACCESSORYOPTION < string Name = "SLO_LIGHT_AMBIENT_COLOR_SOURCE"; int Default = 0; string Description = "Source of light's ambient color"; string DescriptionJ = "ライトのアンビエントカラーがどこに含まれるか"; string List = "Unique, Diffuse, None"; int Unique = 0; int Diffuse = 1; int None = 2; string UniqueMacro = "KTGL_SHLIB_CLL_AMBIENT_UNIQUE"; string DiffuseMacro = "KTGL_SHLIB_CLL_AMBIENT_DIFFUSE"; string NoneMacro = "KTGL_SHLIB_CLL_AMBIENT_NONE"; string UniqueDescription = "Use unique ambient color in light attribute"; string DiffuseDescription = "Use diffuse color in light attribute"; string NoneDescription = "Use (0, 0, 0) as ambient color"; string UniqueDescriptionJ = "ライトアトリビュート内に含まれるアンビエントカラーを使用"; string DiffuseDescriptionJ = "ライトアトリビュート内のディフューズカラーを使用"; string NoneDescriptionJ = "(0, 0, 0)を使用(アンビエントカラーは無効)"; >; #line 372 int slClusterLightListAccessory : ACCESSORY < string Name = "ClusterLightList"; string Modifier = "Cll"; string Macro = "SLC_CLUSTER_LIGHT_LIST"; string Description = "An accessory to apply cluster light list"; string DescriptionJ = "クラスタごとのライトリストを適用するアクセサリ"; int CreateClass = 2; string CreatorClass = "CClusterLightListAccessoryCreator"; string ClusterSize = "slClusterLightListClusterSizeOption"; string ClusterZNum = "slClusterLightListClusterZNumOption"; string MaxLightsPerCluster = "slClusterLightListMaxLightsPerClusterOption"; string IsIndex32bit = "slClusterLightListIsIndex32bitOption"; string IsFixedPitch = "slClusterLightListIsFixedPitchOption"; string FadeOut = "slClusterLightListFadeOutOption"; string IndicesSlot = "slClusterLightListIndicesSlotOption"; string PositionsSlot = "slClusterLightListPositionsSlotOption"; string AttributesSlot = "slClusterLightListAttributesSlotOption"; string AmbientSource = "slClusterLightListAmbientSourceOption"; string Exclude = "TileLightList"; >; #line 409 SLT_BOOL slcIsClusterLightList() { return 0 && (slcGetPSProfile() >= 0x10041); } #line 420 SLT_INT sloGetClusterSize() { return 64; } #line 430 SLT_INT sloGetClusterZNum() { return 16; } #line 440 SLT_INT sloGetMaxLightsPerCluster() { return 254; } #line 450 SLT_BOOL sloIsLightIndex32bit() { return 0; } #line 460 SLT_BOOL sloIsLightIndexListFixedPitch() { return 1; } #line 470 SLT_BOOL sloIsClusterLightFadeOut() { return 0; } #line 480 SLT_INT sloGetLightAmbientColorSource() { return 0; } #line 1 "D://KTGL/shaderlib2/shader/include/slAccessoriesOptionsKIDSPost.fxh" #line 18 void slSetUpKIDSVertex( inout PIPE _pipe ) { } void slSetUpKIDSPixel( inout PIPE _pipe ) { } #line 117 "D://KTGL/shaderlib2/shader/include/slAccessoriesOptions.fxh" int slpGetAccessoryTexCoordNum() { return s_nAccTexCoordNum; } #line 1 "D://KTGL/include/terrain/KTGLTerrainShaderMacro.h" #line 60 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainShaderOptions.fx" int slKTGLTerrainShaderOption : OPTIONS < string Description = "Options for Terrain Shader"; string Option0 = "SLO_TERRAIN_SHADER_TYPE"; int Default = 805306368; >; #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccessories.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccessoryHeader.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slVSInput.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slShaderOptions.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slSetupVSInput.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slShaderOptions.fxh" #line 34 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" int slcGetLanguage() { return 2; } #line 45 int slcGetPlatform() { return 131075; } #line 57 int slcGetVSProfile() { return 36; } #line 69 int slcGetPSProfile() { return 65572; } #line 81 int slcGetHSProfile() { return 0; } #line 93 int slcGetDSProfile() { return 0; } #line 105 int slcGetGSProfile() { return 0; } #line 115 bool slcIsVSStaticBranchAvailable() { return 0x10 <= slcGetVSProfile(); } #line 125 bool slcIsPSStaticBranchAvailable() { return 0x10010 < slcGetPSProfile(); } #line 135 bool slcIsGeometryShaderAvailable() { return 0 < slcGetGSProfile(); } #line 145 bool slcIsTessellationAvailable() { return (0 < slcGetHSProfile()) && (0 < slcGetDSProfile()); } #line 166 bool slcIsSkinningBranch() { return 0; } #line 176 bool slcIsStaticSkinningBranchByLoop() { return 0; } #line 186 int slcGetVertexWeightNum() { return 0; } #line 196 bool slcIsFullVertexWeights() { return 0; } #line 206 bool slcIsBranchBlendIndices() { return 0; } #line 216 bool slcIsL2PUsed() { return 0; } #line 226 int slcGetMatrixPaletteNum() { return (1+0); } #line 236 bool slcIsMatrixPaletteNecessary() { return (slcGetVertexWeightNum()+1) < slcGetMatrixPaletteNum(); } #line 246 bool slcIsNormalDualQuaternion() { return 0; } #line 256 bool slcIsScaledDualQuaternion() { return 0; } #line 266 bool slcIsDualQuaternionEnabled() { return slcIsNormalDualQuaternion() || slcIsScaledDualQuaternion(); } #line 277 bool slcIsClothSpline() { return (0 && (0 == 0)); } #line 288 bool slcIsNormalizingNormalEnabled() { return 0; } #line 298 bool slcIsBranchNormalizeNormal() { return 0; } #line 309 SLT_BOOL slcAccumerateSkinningInFloat() { return ((131075 == 0x40001) && (((0+1)<(1+0)))); } #line 322 bool slpIsTangentSpaceRequired() { return 0; } #line 332 bool slpIsWorldPositionComputed() { return 1; } bool slpIsNormalPossiblyNormalized() { return 0 || 0 || 0; } #line 361 int slcGetInstancingFlag() { return 0; } #line 371 bool slIsEnabledInstancingPosition() { return (0 & 0x010); } #line 381 bool slcIsEnabledInstancingRotation() { return (0 & 0x020); } #line 391 bool slcIsEnabledInstancingSinCos() { return (0 & 0x040); } #line 401 bool slcIsEnabledInstancingYZAxis() { return (0 & 0x080); } #line 412 bool slcIsInstancingModulateColor() { return (0 & 0x200); } #line 423 bool slcIsInstancingReplaceColor() { return (0 & 0x400); } #line 433 bool slcIsEnabledInstancingMatrix() { return (0 & 0x100); } #line 443 bool slcIsTexCoordInstanced() { return (0 & 0x800); } #line 453 bool slcGetInstancingRotationAxis() { return 1; } #line 464 int slcGetInstancingCoordinate() { return 1; } #line 474 bool slcIsEnableInstancingForCloth() { return (0 & 0x0001); } #line 484 bool slcIsInstancingApplyDiffuse() { return (0 & 0x10000); } #line 494 bool slcIsInstancingApplyAmbient() { return (0 & 0x20000); } #line 504 bool slcIsInstancingApplySpecular() { return (0 & 0x40000); } #line 514 bool slcIsInstancingApplyEmissive() { return (0 & 0x80000); } #line 524 bool slcIsWorldSpaceUsedForInstancing() { return (slcGetInstancingCoordinate() == 1 && (slcIsEnabledInstancingMatrix() || slIsEnabledInstancingPosition() || slcIsEnabledInstancingSinCos())); } #line 534 bool slcIsInstancingAvailable() { return (slcIsEnableInstancingForCloth()) || (!slcIsClothSpline()); } #line 546 bool slcIsVfetchNecessary() { return (slcGetPlatform() == 0x30002) && slcGetInstancingFlag(); } #line 568 int slcGetMainLightType() { return 1; } #line 583 bool slpIsHDRLighting() { return 1; } #line 596 bool slcIsHDRLightingSupported() { return ((slcGetPlatform() == 0x30002)||(slcGetLanguage() != 2 && (0x20 <= slcGetVSProfile() || 0x10020 <= slcGetPSProfile()))); } #line 606 bool slpIsLightingResultSaturated() { return 0; } #line 617 int slcGetAllParallelLightNum() { return 2; } #line 627 SLT_INT slcGetMaxParallelSubLightNum() { if (slcGetMainLightType() == 1) { return slcGetAllParallelLightNum() - 1; } else { return slcGetAllParallelLightNum(); } } #line 642 bool slcIsParallelLightNumBranchEnabled() { return 0; } #line 652 int slcGetAllPointLightNum() { return 0; } #line 662 SLT_INT slcGetMaxPointSubLightNum() { if (slcGetMainLightType() == 2) { return slcGetAllPointLightNum() - 1; } else { return slcGetAllPointLightNum(); } } #line 678 bool slcIsPointLightNumBranchEnabled() { return 0; } #line 689 bool slcIsPointLightRangeTestDisabled() { return 1; } #line 700 bool slcIsPointLightDiv0CheckEnabled() { return 0; } #line 710 int slcGetAllSpotLightNum() { return 0; } #line 720 SLT_INT slcGetMaxSpotSubLightNum() { if (slcGetMainLightType() == 3) { return slcGetAllSpotLightNum() - 1; } else { return slcGetAllSpotLightNum(); } } #line 736 bool slcIsSpotLightNumBranchEnabled() { return 0; } #line 747 bool slcIsSpotLightConeTestDisabled() { return (bool)1; } #line 757 int slcGetAllHemisphereLightNum() { return 0; } #line 767 SLT_INT slcGetMaxHemisphereSubLightNum() { if (slcGetMainLightType() == 4) { return slcGetAllHemisphereLightNum() - 1; } else { return slcGetAllHemisphereLightNum(); } } #line 783 int slcIsHemisphereLightNumBranchEnabled() { return 0; } #line 794 bool slpIsLightingDisabled() { return (!(1)); } #line 806 bool slpIsPixelLighting() { return 0; } #line 816 bool slpIsTangentSpaceLighting() { return (!1 && !0 && 0 && 0 && ((((((1*2)+0*0)+1*0)+1*0)) + (((((0*2)+1*0)+1*0)+0*0))) <= 3); } #line 828 int slpGetSpecularEdgeType() { return 0; } #line 840 bool slpIsMainLightComputedSeparately() { return (1 || (1 != 0 && 3 != 0)); } SLT_INT slcGetMaxLightDirectionNum() { return (((((1*2)+0*0)+1*0)+1*0)); } SLT_INT slcGetMaxLightPositionNum() { return (((((0*2)+1*0)+1*0)+0*0)); } #line 870 bool slcIsShadowBranchEnabled() { return 0; } #line 883 int slcGetSoftShadowType() { return 3; } #line 894 int slcGetShadowMappingType() { return 1; } #line 905 int slcGetShadowMapFilterType() { return 2; } #line 917 int slcGetShadowMapFormat() { return 3; } #line 929 bool slcIsAmbientAlphaUsedAsShadow() { return 0; } #line 940 bool slcIsFarShadowErased() { return 0; } #line 951 bool slcShadowMayBeCasted() { return (1 != 0 && 3 != 0); } #line 961 bool slcIsShadowEnabled() { return (3 != 0); } #line 971 bool slcIsShadowCastedForAllLight() { return slcIsShadowEnabled() && (!slcShadowMayBeCasted()); } #line 981 bool slcIsJitterShadowAvailable() { return (4 <= slcGetSoftShadowType() && slcGetSoftShadowType() <= 7); } #line 992 int slcGetShadowMapMatrixNum() { return 1; } #line 1003 bool slcIsCascadeShadowMapEnabled() { return ((6<=slcGetShadowMappingType())&&(slcGetShadowMappingType()<=11)); } #line 1013 bool slcIsCascadeProjectionShadowMapEnabled() { return ((6<=slcGetShadowMappingType())&&(slcGetShadowMappingType()<=8)); } #line 1026 bool slcIsShadowDepthProjected() { return (slcGetShadowMappingType() == 1 || slcGetShadowMappingType() == 3); } #line 1038 bool slcIsShadowMapNonDependentPrefered() { return (131075 == 0x40001); } #line 1051 bool slpIsShadowMapTransformInPS() { return 0; } #line 1063 bool slpIsMipMapForShadowMap() { return ((131075 == 0x40001)); } #line 1079 bool slpIsTextureQueryExtensionForShadowMapEnabled() { return slcGetPlatform() == 0x40001 && slcGetShadowMapFormat() == 5; } #line 1101 int slcGetDiffuseSource() { return 3; } #line 1113 bool slcIsDiffuseSourceBranchEnabled() { return 0; } #line 1123 int slcGetAmbientSource() { return 3; } #line 1136 bool slcIsBranchAmbientSourceEnabled() { return 0; } #line 1146 int slcGetSpecularSource() { return 1; } #line 1158 bool slcIsSpecularSourceBranchEnabled() { return 0; } #line 1168 int slcGetEmissiveSource() { return 0; } #line 1180 bool slcIsEmissiveSourceBranchEnabled() { return 0; } #line 1190 bool slcIsSpecularPossiblyUsed() { return (1 != 0); } #line 1215 int slcGetFogMode() { return 4; } #line 1226 int slcGetFogAccuracy() { return 0; } #line 1236 bool slcIsAlphaFogEnabled() { return 0; } #line 1246 bool slcIsFogLimitEnabled() { return 0; } #line 1258 bool slcIsAcceptableLowPrecisionFogDepth() { return 0; } #line 1270 bool slcIsOutputScatteringInVS() { return (slcGetFogMode() == 4 && slcGetFogAccuracy() == 0); } #line 1280 bool slcIsOutputFogInVS() { return ((!slcIsOutputScatteringInVS()) && slcGetFogMode() != 0 && slcGetFogAccuracy() == 0); } #line 1290 bool slcIsOutputFogDepthInVS() { return ((!slcIsOutputScatteringInVS()) && slcGetFogMode() != 0 && slcGetFogAccuracy() == 1); } #line 1301 bool slcUseTexCoordForFogDepth() { return (slcIsOutputScatteringInVS() || ( (!slcIsAcceptableLowPrecisionFogDepth()) && !(slcIsHDRLightingSupported()) && slcIsOutputFogDepthInVS() && (slcGetFogMode() != 1) ) ); } #line 1314 bool slpIsFogColorDisabled() { return 0; } #line 1324 bool slcIsHardwareVertexFogEnabled() { return slcGetPlatform() == 0x10009 && (slcGetVSProfile() < 0x20); } #line 1348 bool slcIsTexStageCountBranchEnabled() { return 0; } #line 1360 bool slcIsTexOpBranchEnabled() { return 0; } #line 1372 bool slcIsSpecularMapBranchEnabled() { return 0; } #line 1384 bool slcIsSpecularMapStageEnabled() { return 0; } #line 1397 bool slcIsStage0SpecularEnabled() { return 0; } #line 1410 bool slcIsStage0AlphaSpecularEnabled() { return 0; } #line 1423 bool slcIsTexCoordIndexBranchEnabled() { return 0; } #line 1436 bool slcIsTexCoordIndexBranchExEnabled() { return 0; } #line 1447 bool slcIsTexCoordsPackedInVertex() { return 0; } #line 1458 int slcGetMaxTexStageCount() { return 0; } #line 1466 int slcGetTexStageColorOp(uniform int nStage) { if (nStage == 0) { return 4; } else if (nStage == 1) { return 4; } else if (nStage == 2) { return 4; } else if (nStage == 3) { return 4; } else if (nStage == 4) { return 4; } else if (nStage == 5) { return 4; } else if (nStage == 6) { return 4; } else if (nStage == 7) { return 4; } } int slcGetTexStageAlphaOp(uniform int nStage) { if (nStage == 0) { return 4; } else if (nStage == 1) { return 4; } else if (nStage == 2) { return 4; } else if (nStage == 3) { return 4; } else if (nStage == 4) { return 4; } else if (nStage == 5) { return 4; } else if (nStage == 6) { return 4; } else if (nStage == 7) { return 4; } } int slcGetTexStage0ColorOp() { return 4; } int slcGetTexStage0AlphaOp() { return 4; } int slcGetTexStage1ColorOp() { return 4; } int slcGetTexStage1AlphaOp() { return 4; } int slcGetTexStage2ColorOp() { return 4; } int slcGetTexStage2AlphaOp() { return 4; } int slcGetTexStage3ColorOp() { return 4; } int slcGetTexStage3AlphaOp() { return 4; } int slcGetTexStage4ColorOp() { return 4; } int slcGetTexStage4AlphaOp() { return 4; } int slcGetTexStage5ColorOp() { return 4; } int slcGetTexStage5AlphaOp() { return 4; } int slcGetTexStage6ColorOp() { return 4; } int slcGetTexStage6AlphaOp() { return 4; } int slcGetTexStage7ColorOp() { return 4; } int slcGetTexStage7AlphaOp() { return 4; } static const int s_slcTexCoordIndex[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; #line 1621 SLT_COLOR4 slcGetTexMultiplier() { return SLT_COLOR4(1.0f, 1.0f, 1.0f, 1.0f); } #line 1634 bool slcIsEnabledStage0AlphaTest() { return 0; } #line 1646 float slcGetStage0AlphaTestThreshold() { return 1.0f/256.0f; } #line 1657 bool slcIsEnabledBranchTexCoordInVS() { return (0 || 0); } #line 1667 bool slcIsEnabledBranchTexCoordInPS() { return ((0 || 0) && (!(0 || 0))); } #line 1678 bool slcIsEnabledBindingTexCoords() { return ((!((0 || 0) && (!(0 || 0)))) && (0x10010 <= 65572)); } #line 1690 int slcGetSpecularMapTexCoordIndex() { return (0+1); } #line 1701 int slpGetBlendStageTexCoordNum() { return 0; } #line 1711 int slpGetAllStageTexCoordNum() { return (0 + 0 + slpGetAccessoryTexCoordNum()); } #line 1724 int slpGetVSTexCoordNum() { if ((0 < 0) && ((0 < slpGetAllStageTexCoordNum()) || slcIsEnabledBranchTexCoordInPS() || slcIsTexCoordIndexBranchExEnabled())) { return 0; } else { return slpGetAllStageTexCoordNum(); } } #line 1740 bool slpSpecularMapMayBeUsed() { return (0) || ((1 != 0)); } #line 1752 bool slpIsStage0TexCoordUsed() { return (0 && ((0+1) == 0)); } bool slpIsVertexWeight() { return ((0 || 0 < 0) && (0 == 0)); } bool slpIsVertexNormal() { return 1; } bool slpIsVertexTangent() { return 0; } bool slpIsVertexColor0() { return ((0 & 0x400) || (3 == 2) || (3 == 3) || (3 == 2) || (3 == 3) || (1 == 2) || (1 == 3) || (0 == 2) || (0 == 3) || (0 == 2) || (0 == 3) ); } bool slpIsVertexTangentWUsedAsBinormalDirection() { return 0; } bool slpIsVertexBlendIndices() { return (((0+1)<(1+0)) && (0 == 0)); } SLT_BOOL slpIsBlendingVertices() { return slpIsVertexBlendIndices() || slcIsBranchBlendIndices() || 0 < slcGetVertexWeightNum(); } bool slpL2WAsMatrixArray() { return (0); } bool slpBlendIndicesAsFloat4ToRawInt4Bits() { return (0); } #line 1820 int slcGetClipPlaneNum() { return 0; } #line 1832 SLT_HALF slcGetScreenUpDir() { return (1); } #line 1844 SLT_HALF slcGetRenderTargetUpDir() { return (-1); } #line 22 "D://KTGL/shaderlib2/shader/include/../func/slSetupVSInput.fx" SLT_POINT4 _slVfetchPosition(float _nIndex) { SLT_POINT4 x; asm { vfetch x, _nIndex, position }; return x; } SLT_HALF4 _slVfetchBlendWeight(float _nIndex) { SLT_HALF4 x; asm { vfetch x, _nIndex, blendweight }; return x; } SLT_INT4 _slVfetchBlendIndices(float _nIndex) { SLT_INT4 x; asm { vfetch x, _nIndex, blendindices }; return x; } SLT_DIR4 _slVfetchNormal(float _nIndex) { SLT_DIR4 x; asm { vfetch x, _nIndex, normal }; return x; } SLT_DIR4 _slVfetchBinormal(float _nIndex) { SLT_DIR4 x; asm { vfetch x, _nIndex, binormal }; return x; } SLT_DIR4 _slVfetchTangent(float _nIndex) { SLT_DIR4 x; asm { vfetch x, _nIndex, tangent }; return x; } SLT_COLOR4 _slVfetchColor0(float _nIndex) { SLT_COLOR4 x; asm { vfetch x, _nIndex, color0 }; return x; } SLT_COLOR4 _slVfetchColor1(float _nIndex) { SLT_COLOR4 x; asm { vfetch x, _nIndex, color1 }; return x; } SLT_TEXCOORD4 _slVfetchTexcoord0(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, texcoord0 }; return x; } SLT_TEXCOORD4 _slVfetchTexcoord1(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, texcoord1 }; return x; } SLT_TEXCOORD4 _slVfetchTexcoord2(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, texcoord2 }; return x; } SLT_TEXCOORD4 _slVfetchTexcoord3(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, texcoord3 }; return x; } SLT_TEXCOORD4 _slVfetchTexcoord4(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, texcoord4 }; return x; } SLT_TEXCOORD4 _slVfetchTexcoord5(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, texcoord5 }; return x; } SLT_TEXCOORD4 _slVfetchTexcoord6(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, texcoord6 }; return x; } SLT_TEXCOORD4 _slVfetchTexcoord7(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, texcoord7 }; return x; } void slVfetchInstanceTexCoords(inout PIPE _pipe, float _nVertexIndex) { if ( slcIsTexCoordsPackedInVertex() ) { if ( 0 < slpGetVSTexCoordNum() ) { if ( slpGetVSTexCoordNum() == 1 ) { _pipe.vtxTex0 = _slVfetchTexcoord0(_nVertexIndex); }else { _pipe.vtxTex01 = _slVfetchTexcoord0(_nVertexIndex); } } if ( 2 < slpGetVSTexCoordNum() ) { if ( slpGetVSTexCoordNum() == 3 ) { _pipe.vtxTex2 = _slVfetchTexcoord1(_nVertexIndex); }else { _pipe.vtxTex23 = _slVfetchTexcoord1(_nVertexIndex); } } if ( 4 < slpGetVSTexCoordNum() ) { if ( slpGetVSTexCoordNum() == 5 ) { _pipe.vtxTex4 = _slVfetchTexcoord2(_nVertexIndex); }else { _pipe.vtxTex45 = _slVfetchTexcoord2(_nVertexIndex); } } if ( 6 < slpGetVSTexCoordNum() ) { if ( slpGetVSTexCoordNum() == 7 ) { _pipe.vtxTex6 = _slVfetchTexcoord3(_nVertexIndex); }else { _pipe.vtxTex67 = _slVfetchTexcoord3(_nVertexIndex); } } } else { if ( 0 < slpGetVSTexCoordNum() ) { _pipe.vtxTex0 = _slVfetchTexcoord0(_nVertexIndex); } if ( 1 < slpGetVSTexCoordNum() ) { _pipe.vtxTex1 = _slVfetchTexcoord1(_nVertexIndex); } if ( 2 < slpGetVSTexCoordNum() ) { _pipe.vtxTex2 = _slVfetchTexcoord2(_nVertexIndex); } if ( 3 < slpGetVSTexCoordNum() ) { _pipe.vtxTex3 = _slVfetchTexcoord3(_nVertexIndex); } if ( 4 < slpGetVSTexCoordNum() ) { _pipe.vtxTex4 = _slVfetchTexcoord4(_nVertexIndex); } if ( 5 < slpGetVSTexCoordNum() ) { _pipe.vtxTex5 = _slVfetchTexcoord5(_nVertexIndex); } if ( 6 < slpGetVSTexCoordNum() ) { _pipe.vtxTex6 = _slVfetchTexcoord6(_nVertexIndex); } if ( 7 < slpGetVSTexCoordNum() ) { _pipe.vtxTex7 = _slVfetchTexcoord7(_nVertexIndex); } } } #line 228 void slSetUpTexCoords(inout PIPE _pipe) { if (slcIsTexCoordsPackedInVertex()) { if (0 < slpGetVSTexCoordNum()) { if (slpGetVSTexCoordNum() == 1) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex0", "TEXCOORD0" ); } else { _pipe.Input( "SLT_TEXCOORD4", "vtxTex01", "TEXCOORD0" ); } } if (2 < slpGetVSTexCoordNum()) { if (slpGetVSTexCoordNum() == 3) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex2", "TEXCOORD1" ); } else { _pipe.Input( "SLT_TEXCOORD4", "vtxTex23", "TEXCOORD1" ); } } if (4 < slpGetVSTexCoordNum()) { if (slpGetVSTexCoordNum() == 5) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex4", "TEXCOORD2" ); } else { _pipe.Input( "SLT_TEXCOORD4", "vtxTex45", "TEXCOORD2" ); } } if (6 < slpGetVSTexCoordNum()) { if (slpGetVSTexCoordNum() == 7) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex6", "TEXCOORD3" ); } else { _pipe.Input( "SLT_TEXCOORD4", "vtxTex67", "TEXCOORD3" ); } } } else { if (0 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex0", "TEXCOORD0" ); } if (1 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex1", "TEXCOORD1" ); } if (2 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex2", "TEXCOORD2" ); } if (3 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex3", "TEXCOORD3" ); } if (4 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex4", "TEXCOORD4" ); } if (5 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex5", "TEXCOORD6" ); } if (6 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex6", "TEXCOORD8" ); } if (7 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxTex7", "TEXCOORD9" ); } } } void slVfetchStandardVertex( inout PIPE _pipe, float _nVertexIndex ) { _pipe.vtxPos = _slVfetchPosition(_nVertexIndex); if ( slpIsVertexWeight() ) { _pipe.vtxWeight = _slVfetchBlendWeight(_nVertexIndex); } if ( slpIsVertexBlendIndices() ) { _pipe.vtxnIndices = _slVfetchBlendIndices(_nVertexIndex); } _pipe.vtxNormal = _slVfetchNormal(_nVertexIndex); if ( (!slcIsInstancingReplaceColor()) || slcIsInstancingAvailable() ) { _pipe.vtxColor0 = _slVfetchColor0(_nVertexIndex); } slVfetchInstanceTexCoords( _pipe, _nVertexIndex ); _pipe.vtxTangent = _slVfetchTangent( _nVertexIndex ); } #line 324 void slFloat4ToRawInt4Bits( out SLT_INT4 vOut, in SLT_FLOAT4 vIn ) { vOut.x = floatToRawIntBits( vIn.x ); vOut.y = floatToRawIntBits( vIn.y ); vOut.z = floatToRawIntBits( vIn.z ); vOut.w = floatToRawIntBits( vIn.w ); } #line 350 void slSetUpStandardVertex(inout PIPE _pipe) { _pipe.Input( "SLT_POINT4", "vtxPos", "POSITION0" ); if (slpIsVertexWeight()) { if (slcAccumerateSkinningInFloat()) { _pipe.Input( "SLT_FLOAT4", "vtxWeight", "BLENDWEIGHT" ); } else { _pipe.Input( "SLT_HALF4", "vtxWeight", "BLENDWEIGHT" ); } } if (slpIsVertexBlendIndices()) { if (slcGetLanguage() == 3) { _pipe.Input( "SLT_FLOAT4", "vtxfIndices", "BLENDINDICES" ); _pipe.Insert( "vtxnIndices", (SLT_INT4)_pipe.vtxfIndices ); } if (slpL2WAsMatrixArray()) { _pipe.Input( "SLT_FLOAT4", "vtxfIndices", "BLENDINDICES" ); _pipe.Insert( "vtxnIndices", (SLT_INT4)(_pipe.vtxfIndices/3.0f) ); } else if ( slpBlendIndicesAsFloat4ToRawInt4Bits() ) { _pipe.Input( "SLT_FLOAT4", "vtxfIndices", "BLENDINDICES" ); _pipe.Insert( "SLT_INT4", "vtxnIndices" ); slFloat4ToRawInt4Bits( _pipe.vtxnIndices, _pipe.vtxfIndices ); } else { _pipe.Input( "SLT_INT4", "vtxnIndices", "BLENDINDICES" ); } } if (slcAccumerateSkinningInFloat()) { _pipe.Input( "SLT_FLOAT3", "vtxNormal", "NORMAL" ); } else { _pipe.Input( "SLT_DIR3", "vtxNormal", "NORMAL" ); } if (!slcIsInstancingReplaceColor()) { _pipe.Input( "saturate_color SLT_COLOR4", "vtxColor0", "COLOR0" ); } slSetUpTexCoords( _pipe ); if (slcAccumerateSkinningInFloat()) { _pipe.Input( "SLT_FLOAT4", "vtxTangent", "TANGENT0" ); } else { _pipe.Input( "SLT_DIR4", "vtxTangent", "TANGENT0" ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slSetupPSInput.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slLighting.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slLighting.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slLightingParameters.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" #line 23 "D://KTGL/shaderlib2/shader/include/../func/slLightingParameters.fx" struct slSParallelLight { SLT_DIR3 vcDir; SLT_COLOR3 clDiffuse; }; #line 35 struct slSPointLight { SLT_POINT3 vPos; SLT_COLOR3 clDiffuse; SLT_COLOR3 clAmbient; SLT_VECTOR4 vAtt; }; #line 49 struct slSSpotLight { SLT_POINT3 vPos; SLT_DIR3 vcDir; SLT_COLOR3 clDiffuse; SLT_COLOR3 clAmbient; SLT_VECTOR4 vAtt; SLT_VECTOR4 vCos; }; #line 65 struct slSHemisphereLight { SLT_DIR3 vcDir; SLT_COLOR3 clDiffuse; SLT_COLOR3 clAmbient; }; #line 90 SLT_PARAM_HALF4 litDir[(((((1*2)+0*0)+1*0)+1*0))] ; #line 98 SLT_PARAM_FLOAT4 litPos[(((((0*2)+1*0)+1*0)+0*0))] ; #line 106 SLT_PARAM_HALF4 litCol[(((((1*2)+1*0)+1*0)+1*0))] ; #line 114 SLT_PARAM_HALF4 litAmb[(((((0*2)+1*0)+1*0)+1*0))] ; #line 122 SLT_PARAM_HALF4 litAtt[(((((0*2)+1*0)+1*0)+0*0))] ; #line 129 SLT_PARAM_HALF4 litCos[(((((0*2)+0*0)+1*0)+0*0))] ; #line 137 SLT_PARAM_HALF4 ambLit ; #line 147 SLT_PARAM_INT nDirLit ; #line 156 SLT_PARAM_INT nPtLit ; #line 166 SLT_PARAM_INT nSpotLit ; #line 175 SLT_PARAM_INT nHemiLit ; #line 185 SLT_PARAM_FLOAT4 vEye ; #line 1 "D://KTGL/shaderlib2/shader/include/../func/slMaterial.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slMaterialParameters.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" #line 24 "D://KTGL/shaderlib2/shader/include/../func/slMaterialParameters.fx" SLT_PARAM_HALF4 cDiff ; #line 31 SLT_PARAM_HALF4 cAmb ; #line 39 SLT_PARAM_HALF4 cSpec ; #line 46 SLT_PARAM_HALF4 cEmis ; #line 55 SLT_PARAM_BOOL bSpec ; #line 66 SLT_PARAM_HALF4 vDiffSrc ; #line 76 SLT_PARAM_HALF4 vMatSrc ; #line 34 "D://KTGL/shaderlib2/shader/include/../func/slMaterial.fx" SLT_BOOL slIsSpecularEnabled() { if (slpSpecularMapMayBeUsed()) { if (slcIsSpecularSourceBranchEnabled()) { return bSpec; } else { if (slcGetSpecularSource() == 0) { return false; } else { return true; } } } else { return false; } } #line 72 SLT_COLOR4 slGetMaterialDiffuseColor() { return (SLT_COLOR4)cDiff; } #line 84 SLT_COLOR4 slGetMaterialAmbientColor() { return (SLT_COLOR4)cAmb; } #line 96 SLT_COLOR4 slGetMaterialSpecularColor() { return (SLT_COLOR4)cSpec; } #line 108 SLT_COLOR4 slGetMaterialEmissiveColor() { return (SLT_COLOR4)cEmis; } #line 121 SLT_COLOR4 slGetDiffuseColorDefault( PIPE _pipe ) { SLT_COLOR4 _clMaterialDiffuse; if (slcGetDiffuseSource() == 1 || slcGetDiffuseSource() == 3) { _clMaterialDiffuse = slGetMaterialDiffuseColor(); } else { _clMaterialDiffuse = (SLT_COLOR4)1; } if ((slcIsInstancingModulateColor() || slcIsInstancingReplaceColor()) && slcIsInstancingApplyDiffuse()) { _clMaterialDiffuse *= _pipe.vtxInstColor; } else if (slcGetDiffuseSource() == 2 || slcGetDiffuseSource() == 3) { if (slcIsDiffuseSourceBranchEnabled()) { _clMaterialDiffuse *= ( _pipe.vtxColor0 * vDiffSrc.x + vDiffSrc.w ); } else { _clMaterialDiffuse *= _pipe.vtxColor0; } } if (slcIsMaterialScaler()) { _clMaterialDiffuse *= slGetDiffuseScaler(); } return _clMaterialDiffuse; } #line 156 SLT_COLOR4 slGetDiffuseColor( PIPE _pipe ) { return slGetDiffuseColorDefault( _pipe ); } #line 170 SLT_COLOR4 slGetAmbientColorDefault( PIPE _pipe ) { SLT_COLOR4 _clMaterialAmbient; if (slcGetAmbientSource() == 1 || slcGetAmbientSource() == 3) { _clMaterialAmbient = slGetMaterialAmbientColor(); } else { _clMaterialAmbient =(SLT_COLOR4)1; } if ((slcIsInstancingModulateColor() || slcIsInstancingReplaceColor()) && slcIsInstancingApplyAmbient()) { return _clMaterialAmbient * _pipe.vtxInstColor; } else if (slcGetAmbientSource() == 2 || slcGetAmbientSource() == 3) { if (slcIsBranchAmbientSourceEnabled()) { _clMaterialAmbient *= ( vDiffSrc.y * _pipe.vtxColor0 + vDiffSrc.z ); } else { _clMaterialAmbient *= _pipe.vtxColor0; } } if (slcIsMaterialScaler()) { _clMaterialAmbient *= slGetAmbientScaler(); } return _clMaterialAmbient; } #line 204 SLT_COLOR4 slGetAmbientColor( PIPE _pipe ) { return slGetAmbientColorDefault( _pipe ); } #line 216 SLT_COLOR4 slGetSpecularColorDefault( PIPE _pipe ) { SLT_COLOR4 _clMaterialSpecular; if (slcGetSpecularSource() == 1 || slcGetSpecularSource() == 3) { _clMaterialSpecular = slGetMaterialSpecularColor(); } else { _clMaterialSpecular = SLT_COLOR4(0,0,0,100); } if ( (slcIsInstancingModulateColor() || slcIsInstancingReplaceColor()) && slcIsInstancingApplySpecular() ) { _clMaterialSpecular += _pipe.vtxInstColor; } else if (slcGetSpecularSource() == 2 || slcGetSpecularSource() == 3) { if (slcIsSpecularSourceBranchEnabled()) { _clMaterialSpecular += vMatSrc.x * _pipe.vtxColor0; } else { _clMaterialSpecular += _pipe.vtxColor0; } } if (slcIsMaterialScaler()) { _clMaterialSpecular *= slGetSpecularScaler(); } return _clMaterialSpecular; } #line 253 SLT_COLOR4 slGetSpecularColor( PIPE _pipe ) { return slGetSpecularColorDefault( _pipe ); } #line 263 SLT_COLOR3 slGetEmissiveColorDefault( PIPE _pipe ) { SLT_COLOR3 _cMaterialEmissive; if ( slcGetEmissiveSource() == 1 || slcGetEmissiveSource() == 3) { _cMaterialEmissive = (SLT_COLOR3)slGetMaterialEmissiveColor(); } else { _cMaterialEmissive = (SLT_COLOR3)0; } if ( (slcIsInstancingModulateColor() || slcIsInstancingReplaceColor()) && slcIsInstancingApplyEmissive() ) { return _cMaterialEmissive + (SLT_COLOR3)_pipe.vtxInstColor; } else if ( slcGetEmissiveSource() == 2 || slcGetEmissiveSource() == 3) { if (slcIsEmissiveSourceBranchEnabled()) { return _cMaterialEmissive + vMatSrc.y * (SLT_COLOR3)_pipe.vtxColor0; } else { return _cMaterialEmissive + (SLT_COLOR3)_pipe.vtxColor0; } } else { return _cMaterialEmissive; } } #line 295 SLT_COLOR3 slGetEmissiveColor( PIPE _pipe ) { return slGetEmissiveColorDefault( _pipe ); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFunction.fx" #line 119 SLT_COLOR4 slTex2DProj( SLT_SAMPLER_2D _sampler, SLT_TEXCOORD4 _texcoord ) { if ( slcGetLanguage() == 3 ) { return tex2DProj( _sampler, _texcoord ); } else if ( slcGetLanguage() == 2 ) { return tex2Dproj( _sampler, _texcoord.xyw ); } else { return tex2Dproj( _sampler, _texcoord ); } } SLT_HALF4 slHalfTex2DProj( SLT_SAMPLER_2D _sampler, SLT_TEXCOORD4 _texcoord ) { if ( slcGetLanguage() == 2 ) { return h4tex2Dproj( _sampler, _texcoord.xyw ); } else { return slTex2DProj( _sampler, _texcoord ); } } SLT_COLOR4 slColorTex2DProj( SLT_SAMPLER_2D _sampler, SLT_TEXCOORD4 _texcoord ) { if ( slcGetLanguage() == 2 ) { return h4tex2Dproj( _sampler, _texcoord.xyw ); } else { return slTex2DProj( _sampler, _texcoord ); } } SLT_DIR4 slDirTex2DProj( SLT_SAMPLER_2D _sampler, SLT_TEXCOORD4 _texcoord ) { if ( slcGetLanguage() == 2 ) { return h4tex2Dproj( _sampler, _texcoord.xyw ); } else { return slTex2DProj( _sampler, _texcoord ); } } #line 175 SLT_VECTOR3 slGetRelativeVector(SLT_POINT3 _pos1, SLT_POINT3 _pos0) { return (SLT_VECTOR3)(_pos1 - _pos0); } #line 188 SLT_DIR3 slNormalizeVector(SLT_VECTOR3 _vec) { return (SLT_DIR3)normalize( _vec ); } #line 201 SLT_DIR3 slNormalizeDirection(SLT_DIR3 _vec) { return normalize( _vec ); } #line 214 SLT_DIR3 slGetDirection(SLT_POINT3 _pos1, SLT_POINT3 _pos0) { return slNormalizeVector( slGetRelativeVector(_pos1, _pos0) ); } #line 229 void slSinCosVS(out float _sin, out float _cos, float _rad) { float2 _a = _rad; _a.y *= _rad; float2 _sc = float2(0.0003682847819f, -3.069039849e-005f)*_a.y + float2(-0.029462782f, 0.003682847819f); _sc = _sc*_a.y + float2(0.707106781f, -0.176776695f); _sc = _sc*_a + float2(0.0f, 1.414213562f); _sc = _sc*_sc.y + float2(0.0f, -1.0f); _sin = _sc.x; _cos = _sc.y; } #line 255 void slSinCosPS(out float _sin, out float _cos, float _rad) { sincos(_rad, _sin, _cos); } void slSinCosVS(out half _sin, out half _cos, half _rad) { half2 _a = _rad; _a.y *= _rad; half2 _sc = float2(0.0003682847819f, -3.069039849e-005f)*_a.y + float2(-0.029462782f, 0.003682847819f); _sc = _sc*_a.y + float2(0.707106781f, -0.176776695f); _sc = _sc*_a + float2(0.0f, 1.414213562f); _sc = _sc*_sc.y + float2(0.0f, -1.0f); _sin = _sc.x; _cos = _sc.y; } void slSinCosPS(out half _sin, out half _cos, half _rad) { sincos(_rad, _sin, _cos); } #line 293 void slSinCosEx(out float _sin, out float _cos, float _rad) { sincos(_rad, _sin, _cos); } void slSinCosEx(out half _sin, out half _cos, half _rad) { sincos(_rad, _sin, _cos); } #line 312 SLT_FLOAT3 slFloat2RGB(SLT_FLOAT _f) { SLT_FLOAT3 _color; _color.xyz = frac(saturate(_f) * SLT_FLOAT3(1.0f - 1.0f/(256.0f*256.0f*256.0f), 256.0f - 1.0f/(256.0f*256.0f), 256.0f*256.0f - 1.0f/256.0f)); _color *= 256.0f/255.0f; _color.xy -= _color.yz/256.0f; return _color; } #line 338 SLT_FLOAT slRGB2Float(SLT_COLOR3 _rgb) { return dot( _rgb, SLT_FLOAT3(255.0f/256.0f, 255.0f/(256.0f*256.0f), 256.0f/(256.0f*256.0f*256.0f)) ); } #line 351 SLT_COLOR4 slFloat2RGBA(SLT_FLOAT _f) { SLT_COLOR4 _color; _color.a = ceil(log2(_f)); _f = _f * exp2(-_color.a-1.0f) + 0.5f; _color.rgb = slFloat2RGB(_f); _color.a = _color.a/255.0f + 128.0f/255.0f; return _color; } #line 369 SLT_FLOAT slRGBA2Float(SLT_COLOR4 _rgbe) { SLT_HALF _e = _rgbe.a*255.0f - 128.0f; SLT_FLOAT _f = 2.0f * slRGB2Float(_rgbe.rgb) - 1.0f; return _f * exp2(_e); } #line 387 SLT_POINT3 slApplyMatrix(SLT_POINT3x3 mat, SLT_POINT3 vec) { return mul( vec, mat ); } SLT_POINT4 slApplyMatrix(SLT_POINT4x4 mat, SLT_POINT4 vec) { return mul( vec, mat ); } SLT_POINT4 slApplyMatrix(SLT_POINT3x4 mat, SLT_POINT4 vec) { return mul( vec, mat ); } #line 412 SLT_POINT3 slApplyTransposedMatrix(SLT_POINT3x3 mat, SLT_POINT3 vec) { return mul( mat, vec ); } SLT_POINT4 slApplyTransposedMatrix(SLT_POINT4x4 mat, SLT_POINT4 vec) { return mul( mat, vec ); } #line 451 SLT_TEXCOORD2 slVector2MirrorballMap( SLT_VECTOR3 _vec ) { SLT_DIR3 x = slNormalizeVector( _vec ); SLT_VECTOR1 d = dot( (SLT_VECTOR2)_vec.xy, (SLT_VECTOR2)_vec.xy ); SLT_TEXCOORD2 t = (d == 0.0f ? SLT_TEXCOORD2(0.0f, 0.0f) : (SLT_TEXCOORD2)(rsqrt(d)*(SLT_VECTOR2)_vec.xy)); SLT_TEXCOORD1 r = (SLT_TEXCOORD1)sqrt( 0.125f - 0.125f*x.z ); return SLT_TEXCOORD2(0.5f, 0.5f) + SLT_TEXCOORD2(r, -r) * t; } SLT_TEXCOORD2 slVector2LightProbeMap( SLT_VECTOR3 _vec ) { SLT_DIR3 x = slNormalizeVector( _vec ); SLT_VECTOR1 d = dot( (SLT_DIR2)_vec.xy, (SLT_DIR2)_vec.xy ); SLT_TEXCOORD2 t = (d == 0.0f ? SLT_TEXCOORD2(0.0f, 0.0f) : (SLT_TEXCOORD2)(rsqrt(d)*(SLT_VECTOR2)_vec.xy)); SLT_TEXCOORD1 r = (SLT_TEXCOORD1)(0.159154943f * acos( x.z )); return SLT_TEXCOORD2(0.5f, 0.5f) + SLT_TEXCOORD2(r, -r) * t; } SLT_TEXCOORD2 slDirection2ParabolicMap( SLT_DIR3 _vec ) { SLT_DIR1 _fCos = _vec.z; SLT_TEXCOORD1 _fA = 1.0f / ( 2.0f * ( 1.000000001f + _fCos ) ); return (SLT_TEXCOORD2)_vec * _fA + 0.5; } SLT_TEXCOORD2 slVector2ParabolicMap( SLT_VECTOR3 _vec ) { _vec = slNormalizeVector( _vec ); return slDirection2ParabolicMap( _vec ); } SLT_COLOR3 slGetApproxFresnelTerm( SLT_COLOR3 _vF0, SLT_DIR1 _fLH ) { _fLH = _fLH*_fLH; _fLH = _fLH*_fLH; return _vF0 + ( 1.0f - _vF0 ) * ( 1.0f - _fLH ); } SLT_COLOR3 slGetApproxFresnelTerm( SLT_COLOR3 _vF0, SLT_DIR3 _vIn, SLT_DIR3 _vHalf ) { return slGetApproxFresnelTerm( _vF0, dot( _vIn, _vHalf ) ); } SLT_COLOR3 slGetSchlickFresnelTerm( SLT_COLOR3 _vF0, SLT_DIR1 _fLH ) { _fLH = pow( saturate(1.0f - _fLH), 5.0f ); return lerp( _vF0, SLT_COLOR3(1.0f, 1.0f, 1.0f), (SLT_COLOR3)_fLH ); } SLT_COLOR3 slGetSchlickFresnelTerm( SLT_COLOR3 _vF0, SLT_DIR3 _vIn, SLT_DIR3 _vHalf ) { return slGetSchlickFresnelTerm( _vF0, dot( _vIn, _vHalf ) ); } SLT_COLOR3 slGetFresnelTerm( SLT_VECTOR3 _vRefractiveIndex, SLT_DIR1 _fLH ) { SLT_VECTOR3 _fG = sqrt( _vRefractiveIndex*_vRefractiveIndex - 1.0f + _fLH*_fLH ); SLT_VECTOR3 _fAddGLH = _fG + _fLH; SLT_VECTOR3 _fSubGLH = _fG - _fLH; SLT_VECTOR3 _f = (_fLH * _fAddGLH - 1.0f)/(_fLH * _fSubGLH + 1.0f); return (_fSubGLH*_fSubGLH) / (2.0f * _fAddGLH*_fAddGLH) * ( _f*_f + 1.0f ); } SLT_COLOR3 slGetFresnelTerm( SLT_VECTOR3 _vRefractiveIndex, SLT_DIR3 _vIn, SLT_DIR3 _vHalf ) { return slGetFresnelTerm( _vRefractiveIndex, dot( _vIn, _vHalf ) ); } #line 550 SLT_DIR3 slGetBiNormal( SLT_DIR3 _vcNormal, SLT_DIR3 _vcTangent ) { return cross( _vcTangent, _vcNormal ); } #line 563 SLT_DIR3 slGetBiNormal( SLT_DIR3 _vcNormal, SLT_DIR3 _vcTangent, SLT_DIR _fBiNormalDir ) { return cross( _vcTangent, _vcNormal ) * _fBiNormalDir; } #line 585 SLT_DIR3 slTransformDirectionW2S( SLT_DIR3 _vcNormal, SLT_DIR3 _vcTangent, SLT_DIR3 _vcBiNormal, SLT_DIR3 _vec ) { return SLT_DIR3( dot( _vcBiNormal, _vec ), dot( _vcTangent, _vec ), dot( _vcNormal, _vec ) ); } #line 602 SLT_VECTOR3 slTransformVectorW2S( SLT_DIR3 _vcNormal, SLT_DIR3 _vcTangent, SLT_DIR3 _vcBiNormal, SLT_VECTOR3 _vec ) { return SLT_VECTOR3( dot( _vcBiNormal, _vec ), dot( _vcTangent, _vec ), dot( _vcNormal, _vec ) ); } #line 628 SLT_DIR3 slTransformS2W( SLT_DIR3 _vcNormal, SLT_DIR3 _vcTangent, SLT_DIR3 _vcBiNormal, SLT_DIR3 _vec ) { return _vcBiNormal * _vec.x + _vcTangent * _vec.y + _vcNormal * _vec.z; } #line 644 SLT_DIR3 slTransformS2W( SLT_DIR3 _vcNormal, SLT_DIR3 _vcTangent, SLT_DIR3 _vec ) { return slTransformS2W( _vcNormal, _vcTangent, slGetBiNormal( _vcNormal, _vcTangent ), _vec ); } #line 659 SLT_DIR3 slTransformS2W( SLT_DIR3 _vcNormal, SLT_DIR3 _vcTangent, SLT_DIR _fBiNormalDir, SLT_DIR3 _vec ) { return slTransformS2W( _vcNormal, _vcTangent, slGetBiNormal( _vcNormal, _vcTangent, _fBiNormalDir ), _vec ); } #line 49 "D://KTGL/shaderlib2/shader/include/../func/slLighting.fx" void slApplyMainLightColor( inout SLT_COLOR3 _color, PIPE _pipe ) { } #line 60 slSParallelLight slGetParallelMainLight() { if (slcGetMainLightType() != 1) { Error( "Invalid call." ); } slSParallelLight _light; _light.vcDir = (SLT_DIR3)litDir[0]; _light.clDiffuse = (SLT_COLOR3)litCol[0]; return _light; } #line 81 slSParallelLight slGetParallelMainLight( PIPE _pipe ) { if (slcGetMainLightType() != 1) { Error( "Invalid call." ); } slSParallelLight _light; if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTLitDir" ) ) { _light.vcDir = normalize( _pipe.vTLitDir[0] ); _light.clDiffuse = (SLT_COLOR3)litCol[0]; } else { _light = slGetParallelMainLight(); } slApplyMainLightColor( _light.clDiffuse, _pipe ); return _light; } #line 117 slSParallelLight slGetParallelSubLight( uniform SLT_INT _nIndex ) { slSParallelLight _light; _light.vcDir = (SLT_DIR3)litDir[(0+1)+_nIndex]; _light.clDiffuse = (SLT_COLOR3)litCol[(0+1)+_nIndex]; return _light; } #line 137 slSParallelLight slGetParallelSubLight( PIPE _pipe, uniform SLT_INT _nIndex ) { if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTLitDir" ) ) { slSParallelLight _light; _light.vcDir = normalize( _pipe.vTLitDir[(0+1)+_nIndex] ); _light.clDiffuse = (SLT_COLOR3)litCol[(0+1)+_nIndex]; return _light; } else { return slGetParallelSubLight( _nIndex ); } } #line 160 slSParallelLight slGetFirstParallelLight(PIPE _pipe) { if (0 < slcGetAllParallelLightNum()) { if (slcGetMainLightType() == 1) { return slGetParallelMainLight( _pipe ); } else { return slGetParallelSubLight( _pipe, 0); } } else { Error( "There is no parallel light." ); } } #line 188 slSPointLight slGetPointMainLight() { if (slcGetMainLightType() != 2) { Error( "Invalid call." ); } slSPointLight _light; _light.vPos = (SLT_POINT3)litPos[0]; _light.clDiffuse = (SLT_COLOR3)litCol[0]; _light.clAmbient = (SLT_COLOR3)litAmb[0]; _light.vAtt = (SLT_VECTOR4)litAtt[0]; return _light; } #line 211 slSPointLight slGetPointMainLight( PIPE _pipe ) { if (slcGetMainLightType() != 2) { Error( "Invalid call." ); } slSPointLight _light; if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTLitPos" ) ) { _light.vPos = _pipe.vTLitPos[0]; _light.clDiffuse = (SLT_COLOR3)litCol[0]; _light.clAmbient = (SLT_COLOR3)litAmb[0]; _light.vAtt = (SLT_VECTOR4)litAtt[0]; } else { _light = slGetPointMainLight(); } slApplyMainLightColor( _light.clDiffuse, _pipe ); return _light; } #line 250 slSPointLight slGetPointSubLight( uniform SLT_INT _nIndex ) { slSPointLight _light; _light.vPos = (SLT_POINT3)litPos[((0*2))+_nIndex]; _light.clDiffuse = (SLT_COLOR3)litCol[((1*2))+_nIndex]; _light.clAmbient = (SLT_COLOR3)litAmb[((0*2))+_nIndex]; _light.vAtt = (SLT_VECTOR4)litAtt[((0*2))+_nIndex]; return _light; } #line 272 slSPointLight slGetPointSubLight( PIPE _pipe, uniform SLT_INT _nIndex ) { if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTLitPos" ) ) { slSPointLight _light; _light.vPos = _pipe.vTLitPos[((0*2))+_nIndex]; _light.clDiffuse = (SLT_COLOR3)litCol[((1*2))+_nIndex]; _light.clAmbient = (SLT_COLOR3)litAmb[((0*2))+_nIndex]; _light.vAtt = (SLT_VECTOR4)litAtt[((0*2))+_nIndex]; return _light; } else { return slGetPointSubLight( _nIndex ); } } #line 302 slSSpotLight slGetSpotMainLight() { if (slcGetMainLightType() != 3) { Error( "Invalid call." ); } slSSpotLight _light; _light.vPos = (SLT_POINT3)litPos[0]; _light.vcDir = (SLT_DIR3)litDir[0]; _light.clDiffuse = (SLT_COLOR3)litCol[0]; _light.clAmbient = (SLT_COLOR3)litAmb[0]; _light.vAtt = (SLT_VECTOR4)litAtt[0]; _light.vCos = (SLT_VECTOR4)litCos[0]; return _light; } #line 328 slSSpotLight slGetSpotMainLight( PIPE _pipe ) { if (slcGetMainLightType() != 3) { Error( "Invalid call." ); } slSSpotLight _light; if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTLitDir" ) ) { _light.vPos = _pipe.vTLitPos[0]; _light.vcDir = normalize( _pipe.vTLitDir[0] ); _light.clDiffuse = (SLT_COLOR3)litCol[0]; _light.clAmbient = (SLT_COLOR3)litAmb[0]; _light.vAtt = (SLT_VECTOR4)litAtt[0]; _light.vCos = (SLT_VECTOR4)litCos[0]; } else { _light = slGetSpotMainLight(); } slApplyMainLightColor( _light.clDiffuse, _pipe ); return _light; } #line 369 slSSpotLight slGetSpotSubLight( uniform SLT_INT _nIndex ) { slSSpotLight _light; _light.vPos = (SLT_POINT3)litPos[(((0*2)+1*0))+_nIndex]; _light.vcDir = (SLT_DIR3)litDir[(((1*2)+0*0))+_nIndex]; _light.clDiffuse = (SLT_COLOR3)litCol[(((1*2)+1*0))+_nIndex]; _light.clAmbient = (SLT_COLOR3)litAmb[(((0*2)+1*0))+_nIndex]; _light.vAtt = (SLT_VECTOR4)litAtt[(((0*2)+1*0))+_nIndex]; _light.vCos = (SLT_VECTOR4)litCos[(((0*2)+0*0))+_nIndex]; return _light; } #line 391 slSSpotLight slGetSpotSubLight( PIPE _pipe, uniform SLT_INT _nIndex ) { if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTLitDir" ) ) { slSSpotLight _light; _light.vPos = _pipe.vTLitPos[(((0*2)+1*0))+_nIndex]; _light.vcDir = normalize( _pipe.vTLitDir[(((1*2)+0*0))+_nIndex] ); _light.clDiffuse = (SLT_COLOR3)litCol[(((1*2)+1*0))+_nIndex]; _light.clAmbient = (SLT_COLOR3)litAmb[(((0*2)+1*0))+_nIndex]; _light.vAtt = (SLT_VECTOR4)litAtt[(((0*2)+1*0))+_nIndex]; _light.vCos = (SLT_VECTOR4)litCos[(((0*2)+0*0))+_nIndex]; return _light; } else { return slGetSpotSubLight( _nIndex ); } } #line 425 slSHemisphereLight slGetHemisphereSubLight( uniform SLT_INT _nIndex ) { slSHemisphereLight _light; _light.vcDir = (SLT_DIR3)litDir[((((1*2)+0*0)+1*0))+_nIndex]; _light.clDiffuse = (SLT_COLOR3)litCol[((((1*2)+1*0)+1*0))+_nIndex]; _light.clAmbient = (SLT_COLOR3)litAmb[((((0*2)+1*0)+1*0))+_nIndex]; return _light; } #line 444 slSHemisphereLight slGetHemisphereSubLight( PIPE _pipe, uniform SLT_INT _nIndex ) { if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTLitDir" ) ) { slSHemisphereLight _light; _light.vcDir = normalize( _pipe.vTLitDir[((((1*2)+0*0)+1*0))+_nIndex] ); _light.clDiffuse = (SLT_COLOR3)litCol[((((1*2)+1*0)+1*0))+_nIndex]; _light.clAmbient = (SLT_COLOR3)litAmb[((((0*2)+1*0)+1*0))+_nIndex]; return _light; } else { return slGetHemisphereSubLight( _nIndex ); } } #line 465 SLT_COLOR3 slGetAmbientLight() { return (SLT_COLOR3)ambLit; } #line 481 SLT_POINT4 slGetLightingPosition( PIPE _pipe ) { if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTEye" )) { return SLT_POINT4( 0, 0, 0, 1 ); } else { return slGetWorldPosition ( _pipe ); } } #line 501 SLT_DIR3 slGetLightingEyeVector( PIPE _pipe ) { if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTEye" )) { return _pipe.vTEye; } else { return slGetWorldEyeVector( _pipe ); } } #line 521 SLT_DIR3 slGetLightingEyeDirection( PIPE _pipe ) { if (slpIsTangentSpaceLighting() && _pipe.IsExisting( "vTEyeDir" )) { return _pipe.vTEyeDir; } else { return slGetWorldEyeDirection( _pipe ); } } #line 542 SLT_DIR3 slGetLightingNormal( PIPE _pipe ) { if (_pipe.IsExisting( "vcLitNormal" )) { return _pipe.vcLitNormal; } else { return slGetWorldNormal( _pipe ); } } #line 560 SLT_DIR3 slGetLightingTangent( PIPE _pipe ) { if (_pipe.IsExisting( "vcLitTangent" )) { return _pipe.vcLitTangent; } else { return slGetWorldTangent( _pipe ); } } #line 578 SLT_DIR3 slGetLightingBiNormal( PIPE _pipe ) { if (_pipe.IsExisting( "vcLitBiNormal" )) { return _pipe.vcLitBiNormal; } else { return slGetWorldBiNormal( _pipe ); } } #line 595 SLT_COLOR1 slGetLuminance( SLT_COLOR3 _color ) { SLT_COLOR3 _v = SLT_COLOR3( 0.298912f, 0.586611f, 0.114478 ); return dot( _color, _v ); } SLT_COLOR1 slGetSpecular( SLT_DIR3 _vcHalf, SLT_DIR3 _vcNormal, SLT_COLOR1 _fSpecPower ) { return (SLT_COLOR1)pow( saturate( dot( _vcHalf, _vcNormal ) ), _fSpecPower ); } SLT_COLOR1 slGetSmoothSpecular( SLT_DIR1 _fDot ) { return (SLT_COLOR1)smoothstep( (-0.3f), 0.0f, _fDot ); } SLT_COLOR1 slGetReflectionBeamDensity( SLT_DIR1 _fDot, SLT_DIR1 _fNV ) { return (SLT_COLOR1)( _fDot / max( _fDot, _fNV ) ); } SLT_COLOR1 slGetReflectionBeamDensity( SLT_DIR1 _fDot, SLT_DIR3 _vcNormal, SLT_DIR3 _vcEyeDir ) { return (SLT_COLOR1)(_fDot / max(_fDot, dot(_vcNormal, _vcEyeDir))); } SLT_COLOR1 slGetSpecularCoeff( SLT_DIR1 _fDot, SLT_DIR3 _vcNormal, SLT_DIR3 _vcEyeDir, SLT_DIR3 _vcHalf, SLT_COLOR1 _fSpecularPower ) { SLT_COLOR1 _result; if (slpGetSpecularEdgeType() == 0) { _result = (SLT_COLOR1)lit( _fDot, dot( _vcNormal, _vcHalf ), _fSpecularPower ).z; } else if (slpGetSpecularEdgeType() == 1) { _result = pow( saturate( dot( _vcNormal, _vcHalf ) ), _fSpecularPower ) * slGetSmoothSpecular( _fDot ); } else { _result = (SLT_COLOR1)lit( _fDot, dot( _vcNormal, _vcHalf ), _fSpecularPower ).z; _result *= slGetReflectionBeamDensity( _fDot, _vcNormal, _vcEyeDir ); } return _result; } SLT_COLOR3 slGetLightingCoeffs( SLT_DIR1 _fDot, SLT_DIR3 _vcNormal, SLT_DIR3 _vcEyeDir, SLT_DIR3 _vcHalf, SLT_COLOR1 _fSpecularPower ) { SLT_COLOR3 _result; if (slpGetSpecularEdgeType() == 0) { _result = (SLT_COLOR3)lit( _fDot, dot( _vcNormal, _vcHalf ), _fSpecularPower ); } else if (slpGetSpecularEdgeType() == 1) { _result.x = 1.0f; _result.y = saturate( _fDot ); _result.z = pow( saturate( dot( _vcNormal, _vcHalf ) ), _fSpecularPower ) * slGetSmoothSpecular( _fDot ); } else { _result = (SLT_COLOR3)lit( _fDot, dot( _vcNormal, _vcHalf ), _fSpecularPower ); _result.z *= slGetReflectionBeamDensity( _fDot, _vcNormal, _vcEyeDir ); } return _result; } void slApplyOcclusion2DiffuseTermAsMain( PIPE _pipe, inout SLT_COLOR3 _clDiffuseTerm, SLT_COLOR3 _clDiffuse ) { if ( sloGetMainLightDiffuseOcclusionType() == 1 ) { _clDiffuseTerm += _clDiffuse * _pipe.clOcc.rgb; } else if ( sloGetMainLightDiffuseOcclusionType() == 2 ) { _clDiffuseTerm += _clDiffuse * (_pipe.fDiffuseOcclusion.x != 0 ? _pipe.clOcc.rgb : SLT_COLOR3(1.0, 1.0, 1.0)); } else { _clDiffuseTerm += _clDiffuse; } } void slApplyOcclusion2DiffuseTermAsSub( PIPE _pipe, inout SLT_COLOR3 _clDiffuseTerm, SLT_COLOR3 _clDiffuse ) { if ( sloGetSubLightDiffuseOcclusionType() == 1 ) { _clDiffuseTerm += _clDiffuse * _pipe.clOcc.rgb; } else if ( sloGetSubLightDiffuseOcclusionType() == 2 ) { _clDiffuseTerm += _clDiffuse * (_pipe.fDiffuseOcclusion.y != 0 ? _pipe.clOcc.rgb : SLT_COLOR3(1.0, 1.0, 1.0)); } else { _clDiffuseTerm += _clDiffuse; } } void slAddDiffuseTerm( inout PIPE _pipe, SLT_COLOR3 _clDiffuse, uniform bool _bMainLight ) { if ( slcIsAmbientOcclusion() && _pipe.IsExisting("clOcc") ) { if ( _bMainLight ) { if ( _pipe.IsExisting( "clMainDiffuse" ) ) { slApplyOcclusion2DiffuseTermAsMain( _pipe, _pipe.clMainDiffuse, _clDiffuse ); } else { slApplyOcclusion2DiffuseTermAsMain( _pipe, _pipe.clDiffuse.rgb, _clDiffuse ); } } else { slApplyOcclusion2DiffuseTermAsSub( _pipe, _pipe.clDiffuse.rgb, _clDiffuse ); } } else { if (_bMainLight && _pipe.IsExisting( "clMainDiffuse" )) { _pipe.clMainDiffuse += _clDiffuse; } else { _pipe.clDiffuse.rgb += _clDiffuse; } } } void slAddSpecularTerm( inout PIPE _pipe, SLT_COLOR3 _clSpecular, uniform bool _bMainLight ) { if (_bMainLight && _pipe.IsExisting( "clMainSpecular")) { _pipe.clMainSpecular += _clSpecular; } else { _pipe.clSpecular += _clSpecular; } } #line 736 void slApplyBlinnPhongLighting( inout PIPE _pipe, SLT_COLOR3 _clLightColor, SLT_DIR3 _vcLightDir, uniform bool _bMainLight, uniform bool _bDiffuse, uniform bool _bSpecular ) { SLT_COLOR3 _clDiffuse; SLT_COLOR3 _clSpecular; SLT_DIR3 _vEyeDir = slGetLightingEyeDirection(_pipe); SLT_DIR3 _vNormal = slGetLightingNormal(_pipe); SLT_DIR1 _fDot = dot( _vNormal, -_vcLightDir ); SLT_DIR3 _vcHalf = slNormalizeDirection( _vEyeDir - _vcLightDir ); if (_bDiffuse && _bSpecular) { SLT_COLOR3 _result = slGetLightingCoeffs( _fDot, _vNormal, _vEyeDir, _vcHalf, _pipe.fSpecularDecay ); _clDiffuse = _clLightColor * _result.y; _clSpecular = _clLightColor * _result.z; } else if (_bSpecular) { _clSpecular = _clLightColor * slGetSpecularCoeff( _fDot, _vNormal, _vEyeDir, _vcHalf, _pipe.fSpecularDecay ); } else if (_bDiffuse) { _clDiffuse = _clLightColor * saturate( dot(-_vcLightDir, _vNormal) ); } if (_bDiffuse) { slAddDiffuseTerm( _pipe, _clDiffuse, _bMainLight ); } if (_bSpecular) { slAddSpecularTerm( _pipe, _clSpecular, _bMainLight ); } } #line 776 void slApplyLighting( inout PIPE _pipe, SLT_COLOR3 _clLightColor, SLT_DIR3 _vcLightDir, uniform bool _bMainLight, uniform bool _bDiffuse, uniform bool _bSpecular ) { slApplyBlinnPhongLighting( _pipe, _clLightColor, _vcLightDir, _bMainLight, _bDiffuse, _bSpecular ); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateLighting.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/../slFunction.fx" #line 10 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateLighting.fx" SLT_INT slGetParallelSubLightNum() { if (slcIsParallelLightNumBranchEnabled()) { return nDirLit; } else { return slcGetMaxParallelSubLightNum(); } } SLT_BOOL slIsValidParallelLight(uniform SLT_INT _nIndex) { if ( _nIndex < slcGetMaxParallelSubLightNum() ) { return _nIndex < slGetParallelSubLightNum(); } else { return false; } } SLT_INT slGetPointSubLightNum() { if (slcIsPointLightNumBranchEnabled()) { return nPtLit; } else { return slcGetMaxPointSubLightNum(); } } SLT_BOOL slIsValidPointLight(uniform SLT_INT _nIndex) { if ( _nIndex < slcGetMaxPointSubLightNum() ) { return _nIndex < slGetPointSubLightNum(); } else { return false; } } SLT_INT slGetSpotSubLightNum() { if (slcIsSpotLightNumBranchEnabled()) { return nSpotLit; } else { return slcGetMaxSpotSubLightNum(); } } SLT_BOOL slIsValidSpotLight(uniform SLT_INT _nIndex) { if ( _nIndex < slcGetMaxSpotSubLightNum() ) { return _nIndex < slGetSpotSubLightNum(); } else { return false; } } SLT_INT slGetHemisphereSubLightNum() { if (slcIsHemisphereLightNumBranchEnabled()) { return nHemiLit; } else { return slcGetMaxHemisphereSubLightNum(); } } SLT_BOOL slIsValidHemisphereLight(uniform SLT_INT _nIndex) { if ( _nIndex < slcGetMaxHemisphereSubLightNum() ) { return _nIndex < slGetHemisphereSubLightNum(); } else { return false; } } void slApplyAmbientLight( inout PIPE _pipe, SLT_COLOR3 _clAmbient ) { _pipe.clAmbient += _clAmbient; } void slApplyParallelLight( inout PIPE _pipe, slSParallelLight _lit, uniform bool _bMainLight, uniform bool _bDiffuse, uniform bool _bSpecular ) { slApplyLighting( _pipe, _lit.clDiffuse, _lit.vcDir, _bMainLight, _bDiffuse, _bSpecular ); } SLT_VECTOR slGetSquareDistance( SLT_VECTOR3 _vRelativePos ) { if (slcIsPointLightDiv0CheckEnabled()) { return dot( _vRelativePos, _vRelativePos ) + 6.1035156e-5f; } else { return dot( _vRelativePos, _vRelativePos ); } } SLT_VECTOR3 slGetRelativePointLightPosition( slSPointLight _light, PIPE _pipe ) { if (_pipe.IsExisting( "vTLitPos" ) ) { return (SLT_VECTOR3)_light.vPos; } else { return slGetRelativeVector((SLT_POINT3)_light.vPos, (SLT_POINT3)slGetLightingPosition( _pipe ) ); } } void slApplyPointLight( inout PIPE _pipe, slSPointLight _light, uniform bool _bMainLight, uniform bool _bDiffuse, uniform bool _bSpecular ) { SLT_VECTOR3 _vRelPos = slGetRelativePointLightPosition( _light, _pipe ); SLT_COLOR _attenuation; if (slcIsPointLightRangeTestDisabled()) { SLT_VECTOR1 _fD2 = slGetSquareDistance( _vRelPos ); SLT_VECTOR1 _fRD = rsqrt( _fD2 ); SLT_VECTOR3 _vD = SLT_VECTOR3( 1.0f, _fD2 * _fRD, _fD2 ); _vRelPos *= _fRD; _attenuation = (SLT_COLOR)(1.0f / dot( (SLT_VECTOR3)(_light).vAtt, _vD )); SLT_COLOR3 _clDiffuseColor = _attenuation*((_light).clDiffuse); SLT_COLOR3 _clAmbientColor = _attenuation*((_light).clAmbient); slApplyLighting( _pipe, _clDiffuseColor, -_vRelPos, _bMainLight, _bDiffuse, _bSpecular ); slApplyAmbientLight( _pipe, _clAmbientColor ); } else { SLT_VECTOR1 _fD2 = slGetSquareDistance( _vRelPos ); if ( _fD2 < _light.vAtt.w ) { SLT_VECTOR1 _fRD = rsqrt( _fD2 ); SLT_VECTOR3 _vD = SLT_VECTOR3(1.0f, _fD2 * _fRD, _fD2); _vRelPos *= _fRD; _attenuation = (SLT_COLOR)(1.0f / dot( (SLT_VECTOR3)(_light).vAtt, _vD )); SLT_COLOR3 _clDiffuseColor = _attenuation*((_light).clDiffuse); SLT_COLOR3 _clAmbientColor = _attenuation*((_light).clAmbient); slApplyLighting( _pipe, _clDiffuseColor, -_vRelPos, _bMainLight, _bDiffuse, _bSpecular ); slApplyAmbientLight( _pipe, _clAmbientColor ); } } } SLT_VECTOR3 slGetRelativeSpotLightPosition( slSSpotLight _light, PIPE _pipe ) { if (_pipe.IsExisting( "vTLitPos" ) ) { return (SLT_VECTOR3)_light.vPos; } else { return slGetRelativeVector((SLT_POINT3)_light.vPos, (SLT_POINT3)slGetLightingPosition( _pipe ) ); } } void slApplySpotLight( inout PIPE _pipe, slSSpotLight _light, uniform bool _bMainLight, uniform bool _bDiffuse, uniform bool _bSpecular ) { SLT_VECTOR3 _vRelPos = slGetRelativeSpotLightPosition( _light, _pipe ); SLT_COLOR _attenuation; if ( slcIsPointLightRangeTestDisabled() ) { SLT_VECTOR1 _fD2 = slGetSquareDistance( _vRelPos ); SLT_VECTOR1 _fRD = rsqrt( _fD2 ); _vRelPos *= _fRD; SLT_VECTOR1 _fCos = dot( _vRelPos, (SLT_DIR3)(_light).vcDir ); _fCos = saturate( _fCos * (_light).vCos.w + (_light).vCos.x ); if ( (0.0f < _fCos) || slcIsSpotLightConeTestDisabled() ) { SLT_VECTOR3 _vD = SLT_VECTOR3( 1.0f, _fD2 * _fRD, _fD2 ); _attenuation = (SLT_COLOR)(_fCos / dot( _vD, (SLT_VECTOR3)(_light).vAtt )); SLT_COLOR3 _clDiffuseColor = _attenuation*((_light).clDiffuse); SLT_COLOR3 _clAmbientColor = _attenuation*((_light).clAmbient); slApplyLighting( _pipe, _clDiffuseColor, -_vRelPos, _bMainLight, _bDiffuse, _bSpecular ); slApplyAmbientLight( _pipe, _clAmbientColor ); } } else { SLT_VECTOR1 _fD2 = slGetSquareDistance( _vRelPos ); if ( _fD2 < (_light).vAtt.w ) { SLT_VECTOR1 _fRD = rsqrt( _fD2 ); _vRelPos *= _fRD; SLT_VECTOR1 _fCos = dot( _vRelPos, (SLT_DIR3)(_light).vcDir ); _fCos = saturate( _fCos * (_light).vCos.w + (_light).vCos.x ); if ( (0.0f < _fCos) || slcIsSpotLightConeTestDisabled() ) { SLT_VECTOR3 _vD = SLT_VECTOR3( 1.0f, _fD2 * _fRD, _fD2 ); _attenuation = (SLT_COLOR)(_fCos / dot( _vD, (SLT_VECTOR3)(_light).vAtt )); SLT_COLOR3 _clDiffuseColor = _attenuation*((_light).clDiffuse); SLT_COLOR3 _clAmbientColor = _attenuation*((_light).clAmbient); slApplyLighting( _pipe, _clDiffuseColor, -_vRelPos, _bMainLight, _bDiffuse, _bSpecular ); slApplyAmbientLight( _pipe, _clAmbientColor ); } } } } void slApplyHemisphereLight( inout PIPE _pipe, slSHemisphereLight _light ) { SLT_DIR1 _fDot = dot( (SLT_DIR3)slGetLightingNormal( _pipe ), (SLT_DIR3)_light.vcDir ); SLT_COLOR3 _color = (SLT_COLOR3)_light.clAmbient + (SLT_COLOR3)(_light.clDiffuse * _fDot); slApplyAmbientLight( _pipe, _color); } void slApplyMainLight( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if (slcGetMainLightType() == 1) { if (0 < slcGetAllParallelLightNum()) { slApplyParallelLight( _pipe, slGetParallelMainLight( _pipe ), true, _bDiffuse, _bSpecular ); } } else if (slcGetMainLightType() == 2) { if (0 < slcGetAllPointLightNum()) { slApplyPointLight( _pipe, slGetPointMainLight( _pipe ), true, _bDiffuse, _bSpecular ); } } else if (slcGetMainLightType() == 3) { if (0 < slcGetAllSpotLightNum()) { slApplySpotLight( _pipe, slGetSpotMainLight( _pipe ), true, _bDiffuse, _bSpecular ); } } } void slApplyParallelSubLights( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { slSParallelLight paralitP; if ( slIsValidParallelLight(0) ) { paralitP = slGetParallelSubLight(_pipe, 0); slApplyParallelLight( _pipe, paralitP, false, _bDiffuse, _bSpecular ); if ( slIsValidParallelLight(1) ) { paralitP = slGetParallelSubLight(_pipe, 1); slApplyParallelLight( _pipe, paralitP, false, _bDiffuse, _bSpecular ); if ( slIsValidParallelLight(2) ) { paralitP = slGetParallelSubLight(_pipe, 2); slApplyParallelLight( _pipe, paralitP, false, _bDiffuse, _bSpecular ); if ( slIsValidParallelLight(3) ) { paralitP = slGetParallelSubLight(_pipe, 3); slApplyParallelLight( _pipe, paralitP, false, _bDiffuse, _bSpecular ); if ( slIsValidParallelLight(4) ) { paralitP = slGetParallelSubLight(_pipe, 4); slApplyParallelLight( _pipe, paralitP, false, _bDiffuse, _bSpecular ); if ( slIsValidParallelLight(5) ) { paralitP = slGetParallelSubLight(_pipe, 5); slApplyParallelLight( _pipe, paralitP, false, _bDiffuse, _bSpecular ); if ( slIsValidParallelLight(6) ) { paralitP = slGetParallelSubLight(_pipe, 6); slApplyParallelLight( _pipe, paralitP, false, _bDiffuse, _bSpecular ); if ( slIsValidParallelLight(7) ) { paralitP = slGetParallelSubLight(_pipe, 7); slApplyParallelLight( _pipe, paralitP, false, _bDiffuse, _bSpecular ); } } } } } } } } } void slApplyPointSubLights( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if ( slIsValidPointLight(0) ) { slSPointLight _lit = slGetPointSubLight(_pipe, 0); slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidPointLight(1) ) { _lit = slGetPointSubLight(_pipe, 1); slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidPointLight(2) ) { _lit = slGetPointSubLight(_pipe, 2); slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidPointLight(3) ) { _lit = slGetPointSubLight(_pipe, 3); slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidPointLight(4) ) { _lit = slGetPointSubLight(_pipe, 4); slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidPointLight(5) ) { _lit = slGetPointSubLight(_pipe, 5); slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidPointLight(6) ) { _lit = slGetPointSubLight(_pipe, 6); slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidPointLight(7) ) { _lit = slGetPointSubLight(_pipe, 7); slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); } } } } } } } } } void slApplySpotSubLights( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if ( slIsValidSpotLight(0) ) { slSSpotLight _lit = slGetSpotSubLight(_pipe, 0); slApplySpotLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidSpotLight(1) ) { _lit = slGetSpotSubLight(_pipe, 1); slApplySpotLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidSpotLight(2) ) { _lit = slGetSpotSubLight(_pipe, 2); slApplySpotLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidSpotLight(3) ) { _lit = slGetSpotSubLight(_pipe, 3); slApplySpotLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidSpotLight(4) ) { _lit = slGetSpotSubLight(_pipe, 4); slApplySpotLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidSpotLight(5) ) { _lit = slGetSpotSubLight(_pipe, 5); slApplySpotLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidSpotLight(6) ) { _lit = slGetSpotSubLight(_pipe, 6); slApplySpotLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); if ( slIsValidSpotLight(7) ) { _lit = slGetSpotSubLight(_pipe, 7); slApplySpotLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); } } } } } } } } } void slApplyHemisphereSubLights( inout PIPE _pipe ) { if ( slIsValidHemisphereLight(0) ) { slSHemisphereLight _lit = slGetHemisphereSubLight(_pipe, 0); slApplyHemisphereLight( _pipe, _lit ); if ( slIsValidHemisphereLight(1) ) { _lit = slGetHemisphereSubLight(_pipe, 1); slApplyHemisphereLight( _pipe, _lit ); if ( slIsValidHemisphereLight(2) ) { _lit = slGetHemisphereSubLight(_pipe, 2); slApplyHemisphereLight( _pipe, _lit ); if ( slIsValidHemisphereLight(3) ) { _lit = slGetHemisphereSubLight(_pipe, 3); slApplyHemisphereLight( _pipe, _lit ); if ( slIsValidHemisphereLight(4) ) { _lit = slGetHemisphereSubLight(_pipe, 4); slApplyHemisphereLight( _pipe, _lit ); if ( slIsValidHemisphereLight(5) ) { _lit = slGetHemisphereSubLight(_pipe, 5); slApplyHemisphereLight( _pipe, _lit ); if ( slIsValidHemisphereLight(6) ) { _lit = slGetHemisphereSubLight(_pipe, 6); slApplyHemisphereLight( _pipe, _lit ); if ( slIsValidHemisphereLight(7) ) { _lit = slGetHemisphereSubLight(_pipe, 7); slApplyHemisphereLight( _pipe, _lit ); } } } } } } } } } #line 784 "D://KTGL/shaderlib2/shader/include/../func/slLighting.fx" void slApplyDiffuseMaterialDefault(inout PIPE _pipe) { SLT_COLOR4 _clMaterialDiffuse = slGetDiffuseColor( _pipe ); if (_pipe.IsExisting("clMainDiffuse") && !slpIsPixelLighting()) { _pipe.clMainDiffuse.rgb *= (SLT_COLOR3)_clMaterialDiffuse; } if (_pipe.IsExisting("clDiffuse")) { _pipe.clDiffuse *= _clMaterialDiffuse; } } void slApplySpecularMaterialDefault(inout PIPE _pipe) { SLT_COLOR4 _clMaterialSpecular = slGetSpecularColor( _pipe ); if (_pipe.IsExisting("clMainSpecular")) { _pipe.clMainSpecular.rgb *= (SLT_COLOR3)_clMaterialSpecular; } if (_pipe.IsExisting("clSpecular")) { _pipe.clSpecular.rgb *= (SLT_COLOR3)_clMaterialSpecular; } } #line 813 void slApplyDiffuseMaterial(inout PIPE _pipe) { slApplyDiffuseMaterialDefault( _pipe ); } #line 824 void slApplySpecularMaterial(inout PIPE _pipe) { slApplySpecularMaterialDefault( _pipe ); } #line 837 void slCompositAmbientLightingResult(inout PIPE _pipe) { if (_pipe.IsExisting("clAmbient")) { SLT_COLOR4 _clMaterialAmbient = slGetAmbientColor( _pipe ); if (0) { _pipe.clAmbient *= _clMaterialAmbient.rgb; } else { _pipe.clDiffuse.rgb += (_pipe.clAmbient * _clMaterialAmbient.rgb); } } } #line 856 void slCompositEmissiveLightingResult(inout PIPE _pipe) { _pipe.clDiffuse.rgb += slGetEmissiveColor( _pipe ); } #line 875 void slApplyVertexShadowAlpha( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if (slcShadowMayBeCasted() && slcIsAmbientAlphaUsedAsShadow() && !slpIsPixelLighting()) { if (_bDiffuse) { SLT_COLOR3 _sub = _pipe.clMainDiffuse.xyz - _pipe.clMainDiffuse.xyz * ambLit.a; _pipe.clMainDiffuse.xyz -= _sub; _pipe.clDiffuse.xyz += _sub; } if (_bSpecular) { SLT_COLOR3 _sub2 = _pipe.clMainSpecular.xyz - _pipe.clMainSpecular.xyz * ambLit.a; _pipe.clMainSpecular.xyz -= _sub2; _pipe.clSpecular.xyz += _sub2; } } } #line 904 void slPrepareLightingDefault(inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, uniform bool _bMainLighting, uniform bool _bSubLighting) { SLT_COLOR4 _clZero = SLT_COLOR4(0,0,0,1); if (!_pipe.IsExisting( "clAmbient" )) { if (slpIsHDRLighting() && !slcIsHDRLightingSupported() ) { _pipe.Insert( "SLT_COLOR3", "clAmbient" ); } else { _pipe.Insert( "saturate_color SLT_COLOR3", "clAmbient" ); } _pipe.clAmbient = slGetAmbientLight(); } if (_bDiffuse) { if (slpIsMainLightComputedSeparately()) { if (_bMainLighting && !_pipe.IsExisting( "clMainDiffuse" )) { if (slpIsHDRLighting() && !slcIsHDRLightingSupported() ) { _pipe.Insert( "SLT_COLOR3", "clMainDiffuse" ); } else { _pipe.Insert( "saturate_color SLT_COLOR3", "clMainDiffuse" ); } _pipe.clMainDiffuse = _clZero.rgb; } } if (!_pipe.IsExisting( "clDiffuse" )) { if (slpIsHDRLighting() && !slcIsHDRLightingSupported() ) { _pipe.Insert( "SLT_COLOR4", "clDiffuse" ); } else { _pipe.Insert( "saturate_color SLT_COLOR4", "clDiffuse" ); } _pipe.clDiffuse = _clZero; } } if (_bSpecular) { if (slpIsMainLightComputedSeparately()) { if (_bMainLighting && !_pipe.IsExisting( "clMainSpecular" )) { if (slpIsHDRLighting() && !slcIsHDRLightingSupported() ) { _pipe.Insert( "SLT_COLOR3", "clMainSpecular" ); } else { _pipe.Insert( "saturate_color SLT_COLOR3", "clMainSpecular" ); } _pipe.clMainSpecular = _clZero.rgb; } } if (_bSubLighting && !_pipe.IsExisting( "clSpecular" )) { if (slpIsHDRLighting() && !slcIsHDRLightingSupported() ) { _pipe.Insert( "SLT_COLOR3", "clSpecular" ); } else { _pipe.Insert( "saturate_color SLT_COLOR3", "clSpecular" ); } _pipe.clSpecular = _clZero.rgb; } SLT_COLOR4 _clMaterialSpecular = slGetSpecularColor( _pipe ); _pipe.Insert( "clMaterialSpecular", (SLT_COLOR3)_clMaterialSpecular.rgb ); _pipe.Insert( "fSpecularDecay", (SLT_COLOR)_clMaterialSpecular.w ); } } #line 989 void slPrepareLighting(inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, uniform bool _bMainLighting, uniform bool _bSubLighting) { slPrepareLightingDefault( _pipe, _bDiffuse, _bSpecular, _bMainLighting, _bSubLighting ); } #line 1006 void slApplyVertexLightingBody(inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, uniform bool _bMainLighting, uniform bool _bSubLighting) { _bMainLighting = _bMainLighting && (slcGetMainLightType() != 0); _bSpecular = _bSpecular && slcIsSpecularPossiblyUsed(); slPrepareLighting( _pipe, _bDiffuse, _bSpecular && slcIsSpecularPossiblyUsed(), _bMainLighting, _bSubLighting ); if ( slIsSpecularEnabled() ) { if (_bMainLighting) { slApplyMainLight( _pipe, _bDiffuse, _bSpecular ); } if (_bSubLighting) { slApplyParallelSubLights( _pipe, _bDiffuse, _bSpecular ); slApplyPointSubLights( _pipe, _bDiffuse, _bSpecular ); slApplySpotSubLights( _pipe, _bDiffuse, _bSpecular ); } slApplyVertexShadowAlpha( _pipe, _bDiffuse, _bSpecular ); slApplySpecularMaterial( _pipe ); } else { if (_bMainLighting) { slApplyMainLight( _pipe, _bDiffuse, false ); } if (_bSubLighting) { slApplyParallelSubLights( _pipe, _bDiffuse, false ); slApplyPointSubLights( _pipe, _bDiffuse, false ); slApplySpotSubLights( _pipe, _bDiffuse, false ); } slApplyVertexShadowAlpha( _pipe, _bDiffuse, false ); } if (_bSubLighting) { slApplyHemisphereSubLights( _pipe ); } if (_bDiffuse) { slApplyDiffuseMaterial( _pipe ); slCompositAmbientLightingResult( _pipe ); slCompositEmissiveLightingResult( _pipe ); } } #line 1067 void slApplyVertexLighting(inout PIPE _pipe) { slApplyVertexLightingBody( _pipe, true, slcIsSpecularPossiblyUsed(), true, true ); } #line 1079 void slApplyVertexDiffuseLighting(inout PIPE _pipe) { slApplyVertexLightingBody( _pipe, true, false, true, true ); } #line 1091 void slApplyVertexSpecularLighting(inout PIPE _pipe) { slApplyVertexLightingBody( _pipe, false, slcIsSpecularPossiblyUsed(), true, true ); } #line 1106 void slCompositVertexMainLightTerm( inout SLT_COLOR3 _clSubLight, SLT_COLOR3 _clMainLight, PIPE _pipe ) { if (slcShadowMayBeCasted()) { _clSubLight = _pipe.fShadow * _clMainLight + _clSubLight; } else if (slcIsShadowCastedForAllLight()) { _clSubLight = _pipe.fShadow * (_clMainLight + _clSubLight); } else { _clSubLight += _clMainLight; } } #line 1128 void slCompositVertexMainLightingResultDefault( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if (_bDiffuse) { if (slpIsMainLightComputedSeparately() && _pipe.IsExisting( "clMainDiffuse" )) { SLT_COLOR3 _clMainDiffuse = (SLT_COLOR3)_pipe.clMainDiffuse.rgb; slApplyMainLightColor( _clMainDiffuse, _pipe ); slCompositVertexMainLightTerm( _pipe.clDiffuse.xyz, _clMainDiffuse, _pipe ); _pipe.clMainDiffuse.rgb = _clMainDiffuse; } else if (_pipe.IsExisting("clDiffuse")) { if (slcIsShadowEnabled()) { _pipe.clDiffuse.xyz *= _pipe.fShadow; } } } if (_bSpecular) { if (slcIsSpecularPossiblyUsed()) { if (slpIsMainLightComputedSeparately() && _pipe.IsExisting( "clMainSpecular" )) { SLT_COLOR3 _clMainSpecular = (SLT_COLOR3)_pipe.clMainSpecular.rgb; slApplyMainLightColor( _clMainSpecular, _pipe ); slCompositVertexMainLightTerm( _pipe.clSpecular, _clMainSpecular, _pipe ); _pipe.clMainSpecular.rgb = _clMainSpecular; } else if (_pipe.IsExisting("clSpecular")) { if (slcIsShadowEnabled()) { _pipe.clSpecular.xyz *= _pipe.fShadow; } } } } } #line 1179 void slCompositVertexMainLightingResult( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if (!slcIsGBuffer()) { slCompositVertexMainLightingResultDefault( _pipe, _bDiffuse, _bSpecular ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slLightingKIDS.fx" #line 32 "D://KTGL/shaderlib2/shader/include/../func/slSetupPSInput.fx" void slSetUpPixel(inout PIPE _pipe) { if ((slcGetPlatform() == 0x1000B) || (slcGetPlatform() == 0x20004)) { if (_pipe.IsExisting( "vOutPos" )) { _pipe.Insert( "vScreenPos", (SLT_TEXCOORD2)(_pipe.vOutPos.xy - 0.5) ); } else if (_pipe.IsExisting( "vPos" )) { _pipe.Insert( "vScreenPos", (SLT_TEXCOORD2)(_pipe.vPos.xy - 0.5) ); } } else { _pipe.Input( "SLT_TEXCOORD2", "vScreenPos", WPOS ); } if (_pipe.IsExisting( "vWorldPos" ) ) { _pipe.Insert( "vPEye", vEye.xyz - _pipe.vWorldPos.xyz ); _pipe.Insert( "vPEyeDir", slGetDirection((SLT_POINT3)vEye, (SLT_POINT3)(_pipe.vWorldPos)) ); } if (_pipe.IsExisting( "vcWorldNormal" )) { _pipe.Insert( "vcPWorldNormal", slNormalizeDirection( _pipe.vcWorldNormal ) ); } if (_pipe.IsExisting( "vcWorldTangent" ) ) { _pipe.Insert( "vcPWorldTangent", slNormalizeDirection( _pipe.vcWorldTangent ) ); } if (_pipe.IsExisting( "vcPWorldNormal" ) && _pipe.IsExisting( "vcWorldTangent" )) { SLT_DIR3 _vcWorldBiNormal; if ( _pipe.IsExisting( "fTangentW" ) ) { _vcWorldBiNormal = slGetBiNormal( _pipe.vcPWorldNormal, _pipe.vcPWorldTangent, _pipe.fTangentW ); } else { _vcWorldBiNormal = slGetBiNormal( _pipe.vcPWorldNormal, _pipe.vcPWorldTangent ); } _pipe.Insert( "vcPWorldBiNormal", _vcWorldBiNormal ); } slSetUpKIDSPixel( _pipe ); } #line 1 "D://KTGL/shaderlib2/shader/include/slTextureBlend.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTextureBlend.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateTextureBlendFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/../slTextureParameters.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/../slConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slShaderOptions.fxh" #line 23 "D://KTGL/shaderlib2/shader/include/../func/private/../slTextureParameters.fx" SLT_PARAM_FLOAT nStageNum ; #line 32 SLT_PARAM_FLOAT4 texIdx[((0 + 0 + slpGetAccessoryTexCoordNum())+3)/4] ; #line 46 SLT_PARAM_FLOAT4 texBlend[(0-1)*3] ; SLT_PARAM_FLOAT4 texOp[0/2] ; #line 68 SLT_SAMPLER_2D sStage0 < string UIName = "COLOR"; int Usage = 1; int Sampler = 16; int TexCoord = 16; string Description = "Surface color"; >; SLT_SAMPLER_2D sStage1 < int Sampler = 16+1; >; SLT_SAMPLER_2D sStage2 < int Sampler = 16+2; >; SLT_SAMPLER_2D sStage3 < int Sampler = 16+3; >; SLT_SAMPLER_2D sStage4 < int Sampler = 16+4; >; SLT_SAMPLER_2D sStage5 < int Sampler = 16+5; >; SLT_SAMPLER_2D sStage6 < int Sampler = 16+6; >; SLT_SAMPLER_2D sStage7 < int Sampler = 16+7; >; #line 119 SLT_SAMPLER_2D sSpMap < string UIName = "SpecularMap"; int Usage = 0; int AlphaUsage = 2; int Sampler = 32; int TexCoord = 32; string Description = "Only alpha components are used for specular map."; >; #line 139 SLT_PARAM_FLOAT4 vSpMap ; #line 151 SLT_PARAM_FLOAT4 vSAMap ; #line 16 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateTextureBlendFunc.fx" SLT_COLOR4 _slBlendTexture(SLT_COLOR4 _clTexture, SLT_COLOR4 _clCurrent, uniform SLT_FLOAT _nColorOp, uniform SLT_FLOAT _nAlphaOp) { SLT_COLOR4 _clOut; if ( _nColorOp == _nAlphaOp ) { if ( _nColorOp == 4 ) { _clOut = _clCurrent * _clTexture; } else if ( _nColorOp == 2 ) { _clOut = _clCurrent + _clTexture; } else if ( _nColorOp == 3 ) { _clOut = lerp( _clCurrent, _clTexture, _clTexture.a ); } else if ( _nColorOp == 5 ) { _clOut = _clCurrent + _clTexture.a * _clTexture; } else if ( _nColorOp == 1 ) { _clOut = _clTexture; } else { _clOut = _clCurrent; } } else { if ( _nColorOp == 3 ) { _clOut.rgb = lerp( (SLT_COLOR3)_clCurrent, (SLT_COLOR3)_clTexture, _clTexture.a ); _clOut.a = _clCurrent.a; } else if ( _nColorOp == 4 ) { _clOut.rgb = (SLT_COLOR3)_clCurrent * (SLT_COLOR3)_clTexture; _clOut.a = _clCurrent.a; } else if ( _nColorOp == 5 ) { _clOut.rgb = (SLT_COLOR3)_clCurrent + _clTexture.a * (SLT_COLOR3)_clTexture; _clOut.a = _clCurrent.a; } else if ( _nColorOp == 2 ) { _clOut.rgb = (SLT_COLOR3)_clCurrent + (SLT_COLOR3)_clTexture; _clOut.a = _clCurrent.a; } else if ( _nColorOp == 1 ) { _clOut.rgb = (SLT_COLOR3)_clTexture; _clOut.a = _clCurrent.a; } else { _clOut = _clCurrent; } if ( _nAlphaOp != 0 ) { if ( _nAlphaOp == 1 ) { _clOut.a = _clTexture.a; } else if ( _nAlphaOp == 4 ) { _clOut.a *= _clTexture.a; } else if ( _nAlphaOp == 2 ) { _clOut.a += _clTexture.a; } else if ( _nAlphaOp == 5 ) { _clOut.a += _clTexture.a*_clTexture.a; } else if ( _nAlphaOp == 3 ) { _clOut.a = lerp( _clCurrent.a, _clTexture.a, _clTexture.a ); } } } return _clOut; } SLT_COLOR4 _slBlendTexture(uniform SLT_INT _nStage, SLT_COLOR4 _clTexture, SLT_COLOR4 _clCurrent) { SLT_COLOR4 _wTex, _wCur; _wTex.rgb = (SLT_COLOR3)(texBlend[_nStage*3].x + texBlend[_nStage*3].w * _clTexture.a); _wTex.a = texBlend[_nStage*3].y + texBlend[_nStage*3].z * _clTexture.a; _wCur.rgb = (SLT_COLOR3)(texBlend[_nStage*3+1].x + texBlend[_nStage*3+1].w * _clTexture.a); _wCur.a = texBlend[_nStage*3+1].y + texBlend[_nStage*3+1].z * _clTexture.a; SLT_COLOR4 _clOut = _wTex * _clTexture + _wCur * _clCurrent; SLT_COLOR4 _clModulated = _clTexture * _clCurrent; _clOut.rgb += texBlend[_nStage*3+2].x * (SLT_COLOR3)_clModulated; _clOut.a += texBlend[_nStage*3+2].w * _clModulated.a; return _clOut; } SLT_COLOR4 _slBlendTexture2(uniform SLT_INT _nStage, SLT_COLOR4 _clTexture, SLT_COLOR4 _clCurrent) { return _slBlendTexture(_nStage, _clTexture, _clCurrent); } bool slIsStageValid( uniform int nStage ) { if (nStage < slcGetMaxTexStageCount()) { return nStage < slGetStageNum(); } else { return false; } } SLT_COLOR4 _slBlendTextures(PIPE _pipe, SLT_COLOR4 _clStage0) { SLT_COLOR4 _clCurrent; if ( slIsStageValid(1) ) { if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture(0, h4tex2D(sStage1, slGetStageTexCoord(_pipe, 1)), _clStage0); } else { _clCurrent = _slBlendTexture(h4tex2D(sStage1, slGetStageTexCoord(_pipe, 1)), _clStage0, slcGetTexStage1ColorOp(), slcGetTexStage1AlphaOp()); } if ( slIsStageValid(2) ) { if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture2(1, h4tex2D(sStage2, slGetStageTexCoord(_pipe, 2)), _clCurrent); } else { _clCurrent = _slBlendTexture(h4tex2D(sStage2, slGetStageTexCoord(_pipe, 2)), _clCurrent, slcGetTexStage2ColorOp(), slcGetTexStage2AlphaOp()); } if ( slIsStageValid(3) ) { if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture(2, h4tex2D(sStage3, slGetStageTexCoord(_pipe, 3)), _clCurrent); } else { _clCurrent = _slBlendTexture(h4tex2D(sStage3, slGetStageTexCoord(_pipe, 3)), _clCurrent, slcGetTexStage3ColorOp(), slcGetTexStage3AlphaOp()); } if ( slIsStageValid(4) ) { if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture2(3, h4tex2D(sStage4, slGetStageTexCoord(_pipe, 4)), _clCurrent); } else { _clCurrent = _slBlendTexture(h4tex2D(sStage4, slGetStageTexCoord(_pipe, 4)), _clCurrent, slcGetTexStage4ColorOp(), slcGetTexStage4AlphaOp()); } if ( slIsStageValid(5) ) { if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture(4, h4tex2D(sStage5, slGetStageTexCoord(_pipe, 5)), _clCurrent); } else { _clCurrent = _slBlendTexture(h4tex2D(sStage5, slGetStageTexCoord(_pipe, 5)), _clCurrent, slcGetTexStage5ColorOp(), slcGetTexStage5AlphaOp()); } if ( slIsStageValid(6) ) { if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture2(5, h4tex2D(sStage6, slGetStageTexCoord(_pipe, 6)), _clCurrent); } else { _clCurrent = _slBlendTexture(h4tex2D(sStage6, slGetStageTexCoord(_pipe, 6)), _clCurrent, slcGetTexStage6ColorOp(), slcGetTexStage6AlphaOp()); } if ( slIsStageValid(7) ) { if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture(6, h4tex2D(sStage7, slGetStageTexCoord(_pipe, 7)), _clCurrent); } else { _clCurrent = _slBlendTexture(h4tex2D(sStage7, slGetStageTexCoord(_pipe, 7)), _clCurrent, slcGetTexStage7ColorOp(), slcGetTexStage7AlphaOp()); } } } } } } } } else { _clCurrent = _clStage0; } return _clCurrent; } SLT_COLOR4 _slBlendTextures(SLT_TEXCOORD2 _texModified[0], PIPE _pipe, SLT_COLOR4 _clStage0) { if (slcGetPSProfile() < 0x10010) { return _slBlendTextures( _pipe, _clStage0 ); } else { SLT_COLOR4 _clCurrent; if (slIsStageValid(1)) { SLT_TEXCOORD2 _texRef = slGetStageTexCoord(_pipe, 1); if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture(0, SL_COLOR_TEX2D_GRAD(sStage1, _texModified[1], ddx(_texRef), ddy(_texRef)), _clStage0); } else { _clCurrent = _slBlendTexture(SL_COLOR_TEX2D_GRAD(sStage1, _texModified[1], ddx(_texRef), ddy(_texRef)), _clStage0, slcGetTexStage1ColorOp(), slcGetTexStage1AlphaOp()); } if (slIsStageValid(2)) { _texRef = slGetStageTexCoord(_pipe, 2); if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture2(1, SL_COLOR_TEX2D_GRAD(sStage2, _texModified[2], ddx(_texRef), ddy(_texRef)), _clCurrent); } else { _clCurrent = _slBlendTexture(SL_COLOR_TEX2D_GRAD(sStage2, _texModified[2], ddx(_texRef), ddy(_texRef)), _clCurrent, slcGetTexStage2ColorOp(), slcGetTexStage2AlphaOp()); } if (slIsStageValid(3)) { _texRef = slGetStageTexCoord(_pipe, 3); if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture(2, SL_COLOR_TEX2D_GRAD(sStage3, _texModified[3], ddx(_texRef), ddy(_texRef)), _clCurrent); } else { _clCurrent = _slBlendTexture(SL_COLOR_TEX2D_GRAD(sStage3, _texModified[3], ddx(_texRef), ddy(_texRef)), _clCurrent, slcGetTexStage3ColorOp(), slcGetTexStage3AlphaOp()); } if (slIsStageValid(4)) { _texRef = slGetStageTexCoord(_pipe, 4); if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture2(3, SL_COLOR_TEX2D_GRAD(sStage4, _texModified[4], ddx(_texRef), ddy(_texRef)), _clCurrent); } else { _clCurrent = _slBlendTexture(SL_COLOR_TEX2D_GRAD(sStage4, _texModified[4], ddx(_texRef), ddy(_texRef)), _clCurrent, slcGetTexStage4ColorOp(), slcGetTexStage4AlphaOp()); } if (slIsStageValid(5)) { _texRef = slGetStageTexCoord(_pipe, 5); if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture(4, SL_COLOR_TEX2D_GRAD(sStage5, _texModified[5], ddx(_texRef), ddy(_texRef)), _clCurrent); } else { _clCurrent = _slBlendTexture(SL_COLOR_TEX2D_GRAD(sStage5, _texModified[5], ddx(_texRef), ddy(_texRef)), _clCurrent, slcGetTexStage5ColorOp(), slcGetTexStage5AlphaOp()); } if (slIsStageValid(6)) { _texRef = slGetStageTexCoord(_pipe, 6); if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture2(5, SL_COLOR_TEX2D_GRAD(sStage6, _texModified[6], ddx(_texRef), ddy(_texRef)), _clCurrent); } else { _clCurrent = _slBlendTexture(SL_COLOR_TEX2D_GRAD(sStage6, _texModified[6], ddx(_texRef), ddy(_texRef)), _clCurrent, slcGetTexStage6ColorOp(), slcGetTexStage6AlphaOp()); } if (slIsStageValid(7)) { _texRef = slGetStageTexCoord(_pipe, 7); if (slcIsTexOpBranchEnabled()) { _clCurrent = _slBlendTexture(6, SL_COLOR_TEX2D_GRAD(sStage7, _texModified[7], ddx(_texRef), ddy(_texRef)), _clCurrent); } else { _clCurrent = _slBlendTexture(SL_COLOR_TEX2D_GRAD(sStage7, _texModified[7], ddx(_texRef), ddy(_texRef)), _clCurrent, slcGetTexStage7ColorOp(), slcGetTexStage7AlphaOp()); } } } } } } } } else { _clCurrent = _clStage0; } return _clCurrent; } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateTexCoordFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/../slTextureParameters.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/../slFunction.fx" #line 10 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateTexCoordFunc.fx" SLT_TEXCOORD2 _slGetVSInputTexCoord0(PIPE _pipe) { if (slcIsTexCoordsPackedInVertex() && 1 < slpGetVSTexCoordNum()) { return _pipe.vtxTex01.xy; } else { return _pipe.vtxTex0.xy; } } SLT_TEXCOORD2 _slGetVSInputTexCoord1(PIPE _pipe) { if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxTex01.zw; } else { return _pipe.vtxTex1.xy; } } SLT_TEXCOORD2 _slGetVSInputTexCoord2(PIPE _pipe) { if (slcIsTexCoordsPackedInVertex() && 3 < slpGetVSTexCoordNum()) { return _pipe.vtxTex23.xy; } else { return _pipe.vtxTex2.xy; } } SLT_TEXCOORD2 _slGetVSInputTexCoord3(PIPE _pipe) { if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxTex23.zw; } else { return _pipe.vtxTex3.xy; } } SLT_TEXCOORD2 _slGetVSInputTexCoord4(PIPE _pipe) { if (slcIsTexCoordsPackedInVertex() && 5 < slpGetVSTexCoordNum()) { return _pipe.vtxTex45.xy; } else { return _pipe.vtxTex4.xy; } } SLT_TEXCOORD2 _slGetVSInputTexCoord5(PIPE _pipe) { if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxTex45.zw; } else { return _pipe.vtxTex5.xy; } } SLT_TEXCOORD2 _slGetVSInputTexCoord6(PIPE _pipe) { if (slcIsTexCoordsPackedInVertex() && 7 < slpGetVSTexCoordNum()) { return _pipe.vtxTex67.xy; } else { return _pipe.vtxTex6.xy; } } SLT_TEXCOORD2 _slGetVSInputTexCoord7(PIPE _pipe) { if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxTex67.zw; } else { return _pipe.vtxTex7.xy; } } SLT_HALF _slGetTexCoordIndex0(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[0].x; } else { if (_bForce) { return texIdx[0].x; } else { return 0; } } } else { return 0; } } SLT_HALF _slGetTexCoordIndex1(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[0].y; } else { if (_bForce) { return texIdx[0].y; } else { return 1; } } } else { return 1; } } SLT_HALF4 _slGetTexCoordIndices01(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[0].xxyy; } else { if (_bForce) { return texIdx[0].xxyy; } else { return SLT_HALF4(0, 0, 1, 1); } } } else { return SLT_HALF4(0, 0, 1, 1); } } SLT_HALF _slGetTexCoordIndex2(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[0].z; } else { if (_bForce) { return texIdx[0].z; } else { return 2; } } } else { return 2; } } SLT_HALF4 _slGetTexCoordIndices12(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[0].yyzz; } else { if (_bForce) { return texIdx[0].yyzz; } else { return SLT_HALF4(1, 1, 2, 2); } } } else { return SLT_HALF4(1, 1, 2, 2); } } SLT_HALF _slGetTexCoordIndex3(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[0].w; } else { if (_bForce) { return texIdx[0].w; } else { return 3; } } } else { return 3; } } SLT_HALF4 _slGetTexCoordIndices23(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[0].zzww; } else { if (_bForce) { return texIdx[0].zzww; } else { return SLT_HALF4(2, 2, 3, 3); } } } else { return SLT_HALF4(2, 2, 3, 3); } } SLT_HALF _slGetTexCoordIndex4(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[1].x; } else { if (_bForce) { return texIdx[1].x; } else { return 4; } } } else { return 4; } } SLT_HALF4 _slGetTexCoordIndices34(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return SLT_HALF4( texIdx[0].w, texIdx[0].w, texIdx[1].x, texIdx[1].x ); } else { if (_bForce) { return SLT_HALF4( texIdx[0].w, texIdx[0].w, texIdx[1].x, texIdx[1].x ); } else { return SLT_HALF4(3, 3, 4, 4); } } } else { return SLT_HALF4(3, 3, 4, 4); } } SLT_HALF _slGetTexCoordIndex5(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[1].y; } else { if (_bForce) { return texIdx[1].y; } else { return 5; } } } else { return 5; } } SLT_HALF4 _slGetTexCoordIndices45(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[1].xxyy; } else { if (_bForce) { return texIdx[1].xxyy; } else { return SLT_HALF4(4, 4, 5, 5); } } } else { return SLT_HALF4(4, 4, 5, 5); } } SLT_HALF _slGetTexCoordIndex6(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[1].z; } else { if (_bForce) { return texIdx[1].z; } else { return 6; } } } else { return 6; } } SLT_HALF4 _slGetTexCoordIndices56(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[1].yyzz; } else { if (_bForce) { return texIdx[1].yyzz; } else { return SLT_HALF4(5, 5, 6, 6); } } } else { return SLT_HALF4(5, 5, 6, 6); } } SLT_HALF _slGetTexCoordIndex7(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[1].w; } else { if (_bForce) { return texIdx[1].w; } else { return 7; } } } else { return 7; } } SLT_HALF4 _slGetTexCoordIndices67(uniform SLT_BOOL _bForce) { if ( slcIsTexCoordIndexBranchEnabled() || slcIsTexCoordIndexBranchExEnabled() ) { if ( slcIsEnabledBranchTexCoordInVS() ) { return texIdx[1].zzww; } else { if (_bForce) { return texIdx[1].zzww; } else { return SLT_HALF4(6, 6, 7, 7); } } } else { return SLT_HALF4(6, 6, 7, 7); } } SLT_TEXCOORD2 _slGetVSTexCoord1or0( PIPE _pipe, SLT_HALF _nIndex ) { SLT_TEXCOORD2 _tex; if ( 0.0 < _nIndex ) { _tex = _slGetVSInputTexCoord1( _pipe ); } else { _tex = _slGetVSInputTexCoord0( _pipe ); } return _tex; } SLT_TEXCOORD2 _slGetVSTexCoord321or0( PIPE _pipe, SLT_HALF _nIndex ) { SLT_TEXCOORD2 _tex; if ( 1.0 < _nIndex ) { if (3 < slpGetVSTexCoordNum()) { if ( 2 < _nIndex ) { _tex = _slGetVSInputTexCoord3( _pipe ); } else { _tex = _slGetVSInputTexCoord2( _pipe ); } } else { _tex = _slGetVSInputTexCoord2( _pipe ); } } else { _tex = _slGetVSTexCoord1or0( _pipe, _nIndex ); } return _tex; } SLT_TEXCOORD2 _slGetVSTexCoord5or4( PIPE _pipe, SLT_HALF _nIndex ) { SLT_TEXCOORD2 _tex; if (5 < slpGetVSTexCoordNum()) { if ( 4.0 < _nIndex ) { _tex = _slGetVSInputTexCoord5( _pipe ); } else { _tex = _slGetVSInputTexCoord4( _pipe ); } } else { _tex = _slGetVSInputTexCoord4( _pipe ); } return _tex; } SLT_TEXCOORD2 _slGetTextureCoord( PIPE _pipe, SLT_HALF _nIndex ) { if (!slcIsTexCoordIndexBranchExEnabled()) { Error( "_slGetTextureCoord is valid when slcIsTexCoordIndexBranchExEnabled() returns non zero." ); } SLT_TEXCOORD2 _texCoord; if (4 < slpGetVSTexCoordNum()) { if ( 3.0 < _nIndex ) { if (6 < slpGetVSTexCoordNum()) { if ( 5.0 < _nIndex ) { if (7.0 < slpGetVSTexCoordNum()) { if ( 6.0 < _nIndex ) { _texCoord = _slGetVSInputTexCoord7( _pipe ); } else { _texCoord = _slGetVSInputTexCoord6( _pipe ); } } else { _texCoord = _slGetVSInputTexCoord6( _pipe ); } } else { _texCoord = _slGetVSTexCoord5or4( _pipe, _nIndex ); } } else { _texCoord = _slGetVSTexCoord5or4( _pipe, _nIndex ); } } else { _texCoord = _slGetVSTexCoord321or0( _pipe, _nIndex ); } } else if (2 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord321or0( _pipe, _nIndex ); } else if (1 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } else { _texCoord = _slGetVSInputTexCoord0( _pipe ); } return _texCoord; } SLT_TEXCOORD4 _slSwitchTexCoord( SLT_TEXCOORD4 _tex0, SLT_TEXCOORD4 _tex1, SLT_HALF4 _nIndices, uniform SLT_INT _nBase ) { SLT_HALF4 _nComp = SLT_HALF4( _nBase, _nBase, _nBase, _nBase ); if (slcGetLanguage() == 3) { bool4 _bComp = ( _nComp < _nIndices ); SLT_TEXCOORD4 _vTex; _vTex.xy = _bComp.x ? _tex0.xy : _tex1.xy; _vTex.zw = _bComp.z ? _tex0.zw : _tex1.zw; return _vTex; } else { return _nComp < _nIndices ? _tex0 : _tex1; } } SLT_TEXCOORD4 _slGetTextureCoords( PIPE _pipe, SLT_HALF4 _nIndices, uniform int _maxIndex = slpGetVSTexCoordNum() ) { SLT_TEXCOORD4 _texCoords; if ( slcIsTexCoordsPackedInVertex() ) { if (1 < slpGetVSTexCoordNum()) { if ( 1 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex01.zwwz, _pipe.vtxTex01.xyyx, _nIndices, 0 ); } else { _texCoords = _pipe.vtxTex01.xyyx; } if (2 < slpGetVSTexCoordNum()) { if ( 2 < _maxIndex ) { if (slpGetVSTexCoordNum() == 3) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex2.xyyx, _texCoords, _nIndices, 1 ); } else { _texCoords = _slSwitchTexCoord( _pipe.vtxTex23.xyyx, _texCoords, _nIndices, 1 ); } } if (3 < slpGetVSTexCoordNum()) { if ( 3 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex23.zwwz, _texCoords, _nIndices, 2 ); } if (4 < slpGetVSTexCoordNum()) { if ( 4 < _maxIndex ) { if (slpGetVSTexCoordNum() == 5) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex4.xyyx, _texCoords, _nIndices, 3 ); } else { _texCoords = _slSwitchTexCoord( _pipe.vtxTex45.xyyx, _texCoords, _nIndices, 3 ); } } if (5 < slpGetVSTexCoordNum()) { if ( 5 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex45.zwwz, _texCoords, _nIndices, 4 ); } if (6 < slpGetVSTexCoordNum()) { if ( 6 < _maxIndex ) { if (slpGetVSTexCoordNum() == 7) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex6.xyyx, _texCoords, _nIndices, 5 ); } else { _texCoords = _slSwitchTexCoord( _pipe.vtxTex67.xyyx, _texCoords, _nIndices, 5 ); } } if (7 < slpGetVSTexCoordNum()) { if ( 7 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex67.zwwz, _texCoords, _nIndices, 6 ); } } } } } } } } else { _texCoords = _pipe.vtxTex0.xyyx; } } else { if ( 1 < slpGetVSTexCoordNum() ) { if ( 1 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex1.xyyx, _pipe.vtxTex0.xyyx, _nIndices, 0 ); } else { _texCoords = _pipe.vtxTex0.xyyx; } if ( 2 < slpGetVSTexCoordNum() ) { if ( 2 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex2.xyyx, _texCoords, _nIndices, 1 ); } if ( 3 < slpGetVSTexCoordNum() ) { if ( 3 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex3.xyyx, _texCoords, _nIndices, 2 ); } if ( 4 < slpGetVSTexCoordNum() ) { if ( 4 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex4.xyyx, _texCoords, _nIndices, 3 ); } if ( 5 < slpGetVSTexCoordNum() ) { if ( 5 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex5.xyyx, _texCoords, _nIndices, 4 ); } if ( 6 < slpGetVSTexCoordNum() ) { if ( 6 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex6.xyyx, _texCoords, _nIndices, 5 ); } if ( 7 < slpGetVSTexCoordNum() ) { if ( 7 < _maxIndex ) { _texCoords = _slSwitchTexCoord( _pipe.vtxTex7.xyyx, _texCoords, _nIndices, 6 ); } } } } } } } } else { _texCoords = _pipe.vtxTex0.xyyx; } } return _texCoords; } SLT_TEXCOORD2 _slGetTextureCoord0( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (0 < slpGetAllStageTexCoordNum()) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoord( _pipe, _slGetTexCoordIndex0(_bForce) ); } else { return _slGetVSInputTexCoord0( _pipe ); } } } SLT_TEXCOORD2 _slGetTextureCoord1( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoord( _pipe, _slGetTexCoordIndex1(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { SLT_TEXCOORD2 _texCoord; if (1 < slpGetVSTexCoordNum()) { SLT_HALF _nIndex = _slGetTexCoordIndex1(_bForce); _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } else { _texCoord = _slGetVSInputTexCoord0( _pipe ); } return _texCoord; } else { return _slGetVSInputTexCoord1( _pipe ); } } SLT_TEXCOORD2 _slGetTextureCoord2( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoord( _pipe, _slGetTexCoordIndex2(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { SLT_TEXCOORD2 _texCoord; if (1 < slpGetVSTexCoordNum()) { SLT_HALF _nIndex = _slGetTexCoordIndex2(_bForce); if (2 < slpGetVSTexCoordNum()) { if ( 1.0 < _nIndex ) { _texCoord = _slGetVSInputTexCoord2( _pipe ); } else { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } } else { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } } else { _texCoord = _slGetVSInputTexCoord0( _pipe ); } return _texCoord; } else { return _slGetVSInputTexCoord2( _pipe ); } } SLT_TEXCOORD2 _slGetTextureCoord3( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoord( _pipe, _slGetTexCoordIndex3(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { SLT_TEXCOORD2 _texCoord; SLT_HALF _nIndex; if (1 < slpGetVSTexCoordNum()) { _nIndex = _slGetTexCoordIndex3(_bForce); } if (2 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord321or0( _pipe, _nIndex ); } else if (1 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } else { _texCoord = _slGetVSInputTexCoord0( _pipe ); } return _texCoord; } else { return _slGetVSInputTexCoord3( _pipe ); } } SLT_TEXCOORD2 _slGetTextureCoord4( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoord( _pipe, _slGetTexCoordIndex4(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { SLT_TEXCOORD2 _texCoord; SLT_HALF _nIndex; if (1 < slpGetVSTexCoordNum()) { _nIndex = _slGetTexCoordIndex4(_bForce); } if (2 < slpGetVSTexCoordNum()) { if ( 1 < _nIndex ) { if (4 < slpGetVSTexCoordNum()) { if ( 3 < _nIndex ) { _texCoord = _slGetVSInputTexCoord4( _pipe ); } else if ( 2 < _nIndex ) { _texCoord = _slGetVSInputTexCoord3( _pipe ); } else { _texCoord = _slGetVSInputTexCoord2( _pipe ); } } else if (3 < slpGetVSTexCoordNum()) { if ( 2 < _nIndex ) { _texCoord = _slGetVSInputTexCoord3( _pipe ); } else { _texCoord = _slGetVSInputTexCoord2( _pipe ); } } else { _texCoord = _slGetVSInputTexCoord2( _pipe ); } } else { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } } else if (1 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } else { _texCoord = _slGetVSInputTexCoord0( _pipe ); } return _texCoord; } else { return _slGetVSInputTexCoord4( _pipe ); } } SLT_TEXCOORD2 _slGetTextureCoord5( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoord( _pipe, _slGetTexCoordIndex5(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { SLT_TEXCOORD2 _texCoord; SLT_HALF _nIndex; if (1 < slpGetVSTexCoordNum()) { _nIndex = _slGetTexCoordIndex5(_bForce); } if (2 < slpGetVSTexCoordNum()) { if ( 1 < _nIndex ) { if (4 < slpGetVSTexCoordNum()) { if ( 3 < _nIndex ) { _texCoord = _slGetVSTexCoord5or4( _pipe, _nIndex ); } else if ( 2 < _nIndex ) { _texCoord = _slGetVSInputTexCoord3( _pipe ); } else { _texCoord = _slGetVSInputTexCoord2( _pipe ); } } else if (3 < slpGetVSTexCoordNum()) { if ( 2 < _nIndex ) { _texCoord = _slGetVSInputTexCoord3( _pipe ); } else { _texCoord = _slGetVSInputTexCoord2( _pipe ); } } else { _texCoord = _slGetVSInputTexCoord2( _pipe ); } } else { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } } else if (1 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } else { _texCoord = _slGetVSInputTexCoord0( _pipe ); } return _texCoord; } else { return _slGetVSInputTexCoord5( _pipe ); } } SLT_TEXCOORD2 _slGetTextureCoord6( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoord( _pipe, _slGetTexCoordIndex6(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { SLT_TEXCOORD2 _texCoord; SLT_HALF _nIndex; if (1 < slpGetVSTexCoordNum()) { _nIndex = _slGetTexCoordIndex6(_bForce); } if (4 < slpGetVSTexCoordNum()) { if ( 3 < _nIndex ) { if (6 < slpGetVSTexCoordNum()) { if ( 5 < _nIndex ) { _texCoord = _slGetVSInputTexCoord6( _pipe ); } else if ( 4 < _nIndex ) { _texCoord = _slGetVSInputTexCoord5( _pipe ); } else { _texCoord = _slGetVSInputTexCoord4( _pipe ); } } else { _texCoord = _slGetVSTexCoord5or4( _pipe, _nIndex ); } } else { _texCoord = _slGetVSTexCoord321or0( _pipe, _nIndex ); } } else if (2 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord321or0( _pipe, _nIndex ); } else if (1 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } else { _texCoord = _slGetVSInputTexCoord0( _pipe ); } return _texCoord; } else { return _slGetVSInputTexCoord6( _pipe ); } } SLT_TEXCOORD2 _slGetTextureCoord7( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoord( _pipe, _slGetTexCoordIndex7(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { SLT_TEXCOORD2 _texCoord; SLT_HALF _nIndex; if (1 < slpGetVSTexCoordNum()) { _nIndex = _slGetTexCoordIndex7(_bForce); } if (4 < slpGetVSTexCoordNum()) { if ( 3 < _nIndex ) { if (6 < slpGetVSTexCoordNum()) { if ( 5 < _nIndex ) { if (7 < slpGetVSTexCoordNum()) { if ( 6 < _nIndex ) { _texCoord = _slGetVSInputTexCoord7( _pipe ); } else { _texCoord = _slGetVSInputTexCoord6( _pipe ); } } else { _texCoord = _slGetVSInputTexCoord6( _pipe ); } } else if ( 4 < _nIndex ) { _texCoord = _slGetVSInputTexCoord5( _pipe ); } else { _texCoord = _slGetVSInputTexCoord4( _pipe ); } } } else { _texCoord = _slGetVSTexCoord5or4( _pipe, _nIndex ); } } else if (2 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord321or0( _pipe, _nIndex ); } else if (1 < slpGetVSTexCoordNum()) { _texCoord = _slGetVSTexCoord1or0( _pipe, _nIndex ); } else { _texCoord = _slGetVSInputTexCoord0( _pipe ); } return _texCoord; } else { return _slGetVSInputTexCoord7( _pipe ); } } SLT_TEXCOORD4 _slGetTextureCoord01( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (1 < slpGetAllStageTexCoordNum()) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices01(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices01(_bForce), 2 ); } else if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxTex01.xywz; } else { SLT_TEXCOORD4 _tex; _tex.xy = _pipe.vtxTex0; _tex.zw = (SLT_TEXCOORD2)_pipe.vtxTex1.yxyx; return _tex; } } } SLT_TEXCOORD4 _slGetTextureCoord12( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (2 < slpGetAllStageTexCoordNum()) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices12(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices12(_bForce), 3 ); } else { SLT_TEXCOORD4 _tex; _tex.xy = _slGetVSInputTexCoord1( _pipe ); _tex.zw = (SLT_TEXCOORD2)_slGetVSInputTexCoord2( _pipe ).yxyx; return _tex; } } } SLT_TEXCOORD4 _slGetTextureCoord23( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (3 < slpGetAllStageTexCoordNum()) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices23(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices23(_bForce), 4 ); } else if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxTex23.xywz; } else { SLT_TEXCOORD4 _tex; _tex.xy = _pipe.vtxTex2; _tex.zw = (SLT_TEXCOORD2)_pipe.vtxTex3.yxyx; return _tex; } } } SLT_TEXCOORD4 _slGetTextureCoord34( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (4 < slpGetAllStageTexCoordNum()) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices34(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices34(_bForce), 5 ); } else { SLT_TEXCOORD4 _tex; _tex.xy = _slGetVSInputTexCoord3( _pipe ); _tex.zw = _slGetVSInputTexCoord4( _pipe ).yxyx; return _tex; } } } SLT_TEXCOORD4 _slGetTextureCoord45( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (5 < slpGetAllStageTexCoordNum()) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices45(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices45(_bForce), 6 ); } else if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxTex45.xywz; } else { SLT_TEXCOORD4 _tex; _tex.xy = _pipe.vtxTex4; _tex.zw = _pipe.vtxTex5.yxyx; return _tex; } } } SLT_TEXCOORD4 _slGetTextureCoord56( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (6 < slpGetAllStageTexCoordNum()) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices56(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices56(_bForce), 7 ); } else { SLT_TEXCOORD4 _tex; _tex.xy = _slGetVSInputTexCoord5( _pipe ); _tex.zw = _slGetVSInputTexCoord6( _pipe ).yxyx; return _tex; } } } SLT_TEXCOORD4 _slGetTextureCoord67( PIPE _pipe, uniform SLT_BOOL _bForce = false ) { if (7 < slpGetAllStageTexCoordNum()) { if (slcIsTexCoordIndexBranchExEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices67(_bForce) ); } else if (slcIsTexCoordIndexBranchEnabled()) { return _slGetTextureCoords( _pipe, _slGetTexCoordIndices67(_bForce), 8 ); } else if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxTex67.xywz; } else { SLT_TEXCOORD4 _tex; _tex.xy = _pipe.vtxTex6; _tex.zw = _pipe.vtxTex7.yxyx; return _tex; } } } #line 27 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" SLT_INT slpGetVSOutputTexCoordOffset() { if (0) { return (slpGetBlendStageTexCoordNum()+0); } else if (0) { return slpGetBlendStageTexCoordNum(); } else { return 0; } } #line 45 SLT_INT slpGetPSTexCoordNum() { if (slcIsEnabledBranchTexCoordInPS()) { return slpGetVSTexCoordNum(); } else { return (slpGetAllStageTexCoordNum() - slpGetVSOutputTexCoordOffset()); } } #line 61 SLT_INT slpGetShaderTexCoordOffset() { return (slpGetBlendStageTexCoordNum() - slpGetVSOutputTexCoordOffset()); } #line 94 SLT_TEXCOORD2 slGetVertexTexCoord( PIPE _pipe, uniform SLT_INT n ) { SLT_TEXCOORD2 _tex; if ( n == 0 ) { _tex = _slGetTextureCoord0( _pipe, true ); } else if ( n == 1 ) { _tex = _slGetTextureCoord1( _pipe, true ); } else if ( n == 2 ) { _tex = _slGetTextureCoord2( _pipe, true ); } else if ( n == 3 ) { _tex = _slGetTextureCoord3( _pipe, true ); } else if ( n == 4 ) { _tex = _slGetTextureCoord4( _pipe, true ); } else if ( n == 5 ) { _tex = _slGetTextureCoord5( _pipe, true ); } else if ( n == 6 ) { _tex = _slGetTextureCoord6( _pipe, true ); } else if ( n == 7 ) { _tex = _slGetTextureCoord7( _pipe, true ); } else { _tex = 0; } return _tex; } #line 137 SLT_TEXCOORD2 slGetStageVertexTexCoord( PIPE _pipe, uniform SLT_INT _n ) { return slGetVertexTexCoord( _pipe, _n ); } #line 152 SLT_TEXCOORD2 slGetShaderVertexTexCoord( PIPE _pipe, uniform SLT_INT _n ) { return slGetVertexTexCoord( _pipe, _n + 0 ); } void slOutputVertexTextureCoordinatesWithoutOffset( inout PIPE _pipe ) { if (0 == slpGetPSTexCoordNum()) { } else if ( slcIsEnabledBindingTexCoords()) { _pipe.Insert( "SLT_TEXCOORD2", "vTexLast" ); if ( 1 < slpGetPSTexCoordNum()) { _pipe.InsertArray( "SLT_TEXCOORD4", "avTex", slpGetPSTexCoordNum()/2 ); _pipe.avTex[0] = _slGetTextureCoord01( _pipe ); if ( 2 < slpGetPSTexCoordNum()) { if ( 3 < slpGetPSTexCoordNum()) { _pipe.avTex[1] = _slGetTextureCoord23( _pipe ); if ( 4 < slpGetPSTexCoordNum()) { if ( 5 < slpGetPSTexCoordNum()) { _pipe.avTex[2] = _slGetTextureCoord45( _pipe ); if ( 6 < slpGetPSTexCoordNum()) { if ( 7 < slpGetPSTexCoordNum()) { _pipe.avTex[3] = _slGetTextureCoord67( _pipe ); } else { _pipe.vTexLast = _slGetTextureCoord6( _pipe ); } } } else { _pipe.vTexLast = _slGetTextureCoord4( _pipe ); } } } else { _pipe.vTexLast = _slGetTextureCoord2( _pipe ); } } } else { _pipe.vTexLast = _slGetTextureCoord0( _pipe ); } } else { _pipe.InsertArray( "SLT_TEXCOORD2", "avTex", slpGetPSTexCoordNum() ); _pipe.avTex[0] = _slGetTextureCoord0( _pipe ); if ( 1 < slpGetPSTexCoordNum()) { _pipe.avTex[1] = _slGetTextureCoord1( _pipe ); if ( 2 < slpGetPSTexCoordNum()) { _pipe.avTex[2] = _slGetTextureCoord2( _pipe ); if ( 3 < slpGetPSTexCoordNum()) { _pipe.avTex[3] = _slGetTextureCoord3( _pipe ); if ( 4 < slpGetPSTexCoordNum()) { _pipe.avTex[4] = _slGetTextureCoord4( _pipe ); if ( 5 < slpGetPSTexCoordNum()) { _pipe.avTex[5] = _slGetTextureCoord5( _pipe ); if ( 6 < slpGetPSTexCoordNum()) { _pipe.avTex[6] = _slGetTextureCoord6( _pipe ); if ( 7 < slpGetPSTexCoordNum()) { _pipe.avTex[7] = _slGetTextureCoord7( _pipe ); } } } } } } } } } void slOutputVertexTextureCoordinatesWithOffset( inout PIPE _pipe ) { if ( 0 == slpGetPSTexCoordNum() ) { } else if ( slcIsEnabledBindingTexCoords()) { _pipe.Insert( "SLT_TEXCOORD2", "vTexLast" ); if ( 1 < slpGetPSTexCoordNum()) { _pipe.InsertArray( "SLT_TEXCOORD4", "avTex", slpGetPSTexCoordNum()/2 ); if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord01( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord12( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord23( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord34( _pipe ); } else if ( 4 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord45( _pipe ); } else if ( 5 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord56( _pipe ); } else if ( 6 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord67( _pipe ); } if ( 2 < slpGetPSTexCoordNum()) { if ( 3 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord23( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord34( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord45( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord56( _pipe ); } else if ( 4 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord67( _pipe ); } if ( 4 < slpGetPSTexCoordNum()) { if ( 5 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord45( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord56( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord67( _pipe ); } if ( 6 < slpGetPSTexCoordNum()) { if ( 7 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[3] = _slGetTextureCoord67( _pipe ); } } else { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord6( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord7( _pipe ); } } } } else { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord4( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord5( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord6( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord7( _pipe ); } } } } else { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord2( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord3( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord4( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord5( _pipe ); } else if ( 4 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord6( _pipe ); } else if ( 5 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord7( _pipe ); } } } } else { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord0( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord1( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord2( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord3( _pipe ); } else if ( 4 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord4( _pipe ); } else if ( 5 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord5( _pipe ); } else if ( 6 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord6( _pipe ); } else if ( 7 == slpGetVSOutputTexCoordOffset()) { _pipe.vTexLast = _slGetTextureCoord7( _pipe ); } } } else { _pipe.InsertArray( "SLT_TEXCOORD2", "avTex", slpGetPSTexCoordNum() ); if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord0( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord1( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord2( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord3( _pipe ); } else if ( 4 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord4( _pipe ); } else if ( 5 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord5( _pipe ); } else if ( 6 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord6( _pipe ); } else if ( 7 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[0] = _slGetTextureCoord7( _pipe ); } if ( 1 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord1( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord2( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord3( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord4( _pipe ); } else if ( 4 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord5( _pipe ); } else if ( 5 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord6( _pipe ); } else if ( 6 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[1] = _slGetTextureCoord7( _pipe ); } if ( 2 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord2( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord3( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord4( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord5( _pipe ); } else if ( 4 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord6( _pipe ); } else if ( 5 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[2] = _slGetTextureCoord7( _pipe ); } if ( 3 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[3] = _slGetTextureCoord3( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[3] = _slGetTextureCoord4( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[3] = _slGetTextureCoord5( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[3] = _slGetTextureCoord6( _pipe ); } else if ( 4 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[3] = _slGetTextureCoord7( _pipe ); } if ( 4 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[4] = _slGetTextureCoord4( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[4] = _slGetTextureCoord5( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[4] = _slGetTextureCoord6( _pipe ); } else if ( 3 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[4] = _slGetTextureCoord7( _pipe ); } if ( 5 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[5] = _slGetTextureCoord5( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[5] = _slGetTextureCoord6( _pipe ); } else if ( 2 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[5] = _slGetTextureCoord7( _pipe ); } if ( 6 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[6] = _slGetTextureCoord6( _pipe ); } else if ( 1 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[6] = _slGetTextureCoord7( _pipe ); } if ( 7 < slpGetPSTexCoordNum()) { if ( 0 == slpGetVSOutputTexCoordOffset()) { _pipe.avTex[7] = _slGetTextureCoord7( _pipe ); } } } } } } } } } } #line 508 void slOutputVertexTextureCoordinates( inout PIPE _pipe ) { if (0 < slpGetPSTexCoordNum()) { if (slpGetVSOutputTexCoordOffset() == 0) { slOutputVertexTextureCoordinatesWithoutOffset( _pipe ); } else { slOutputVertexTextureCoordinatesWithOffset( _pipe ); } } } #line 531 SLT_TEXCOORD2 slGetTexCoord( PIPE _pipe, uniform SLT_INT n ) { if ( 0 == slpGetPSTexCoordNum() ) { Error( "slGetTexCoord is called but slpGetPSTexCoordNum() returns zero." ); } else if (slcIsEnabledBranchTexCoordInPS()) { SLT_HALF _index; if ( n == 0 ) { _index = texIdx[0].x; } else if ( n == 1 ) { _index = texIdx[0].y; } else if ( n == 2 ) { _index = texIdx[0].z; } else if ( n == 3 ) { _index = texIdx[0].w; } else if ( n == 4 ) { _index = texIdx[1].x; } else if ( n == 5 ) { _index = texIdx[1].y; } else if ( n == 6 ) { _index = texIdx[1].z; } else if ( n == 7 ) { _index = texIdx[1].w; } else { _index = 0; } if (slcIsEnabledBindingTexCoords()) { if (slpGetPSTexCoordNum() != 2*(slpGetPSTexCoordNum()/2)) { if ( _index == slpGetPSTexCoordNum() - 1 ) { return _pipe.vTexLast; } else { _index *= 0.5f; SLT_HALF _frac = frac(_index); if ( 0.1f < _frac; ) { return (SLT_TEXCOORD2)_pipe.avTex[_index].wz; } else { return (SLT_TEXCOORD2)_pipe.avTex[_index].xy; } } } else { _index *= 0.5f; SLT_HALF _frac = frac(_index); if ( 0.1f < _frac; ) { return (SLT_TEXCOORD2)_pipe.avTex[_index].wz; } else { return (SLT_TEXCOORD2)_pipe.avTex[_index].xy; } } } else { return _pipe.avTex[_index]; } } else if (slcIsEnabledBindingTexCoords()) { if (1 < slpGetPSTexCoordNum()) { if (slpGetPSTexCoordNum() != 2*(slpGetPSTexCoordNum()/2)) { if ( n == slpGetPSTexCoordNum() - 1 ) { return _pipe.vTexLast; } else if ( n % 2 ) { return (SLT_TEXCOORD2)_pipe.avTex[n/2].wz; } else { return (SLT_TEXCOORD2)_pipe.avTex[n/2].xy; } } else { if ( n % 2 ) { return (SLT_TEXCOORD2)_pipe.avTex[n/2].wz; } else { return (SLT_TEXCOORD2)_pipe.avTex[n/2].xy; } } } else { if ( _pipe.IsExisting( "vTexLast" ) ) { return _pipe.vTexLast; } else { return _pipe.texCoord; } } } else { return _pipe.avTex[n]; } } void slSetTexCoord( inout PIPE _pipe, SLT_INT n, SLT_TEXCOORD2 inputTexCoord ) { if ( 0 == slpGetPSTexCoordNum() ) { Error( "slSetTexCoord is called but slpGetPSTexCoordNum() returns zero." ); } else if (slcIsEnabledBranchTexCoordInPS()) { SLT_HALF _index; if ( n == 0 ) { _index = texIdx[0].x; } else if ( n == 1 ) { _index = texIdx[0].y; } else if ( n == 2 ) { _index = texIdx[0].z; } else if ( n == 3 ) { _index = texIdx[0].w; } else if ( n == 4 ) { _index = texIdx[1].x; } else if ( n == 5 ) { _index = texIdx[1].y; } else if ( n == 6 ) { _index = texIdx[1].z; } else if ( n == 7 ) { _index = texIdx[1].w; } else { _index = 0; } if (slcIsEnabledBindingTexCoords()) { if (slpGetPSTexCoordNum() != 2*(slpGetPSTexCoordNum()/2)) { if ( _index == slpGetPSTexCoordNum() - 1 ) { _pipe.vTexLast = inputTexCoord; } else { _index *= 0.5f; SLT_HALF _frac = frac(_index); if ( 0.1f < _frac; ) { _pipe.avTex[_index].wz = inputTexCoord; } else { _pipe.avTex[_index].xy = inputTexCoord; } } } else { _index *= 0.5f; SLT_HALF _frac = frac(_index); if ( 0.1f < _frac; ) { _pipe.avTex[_index].wz = inputTexCoord; } else { _pipe.avTex[_index].xy = inputTexCoord; } } } else { _pipe.avTex[_index] = inputTexCoord; } } else if (slcIsEnabledBindingTexCoords()) { if (1 < slpGetPSTexCoordNum()) { if (slpGetPSTexCoordNum() != 2*(slpGetPSTexCoordNum()/2)) { if ( n == slpGetPSTexCoordNum() - 1 ) { _pipe.vTexLast = inputTexCoord; } else if ( n % 2 ) { _pipe.avTex[n/2].wz = inputTexCoord; } else { _pipe.avTex[n/2].xy = inputTexCoord; } } else { if ( n % 2 ) { _pipe.avTex[n/2].wz = inputTexCoord; } else { _pipe.avTex[n/2].xy = inputTexCoord; } } } else { _pipe.vTexLast = inputTexCoord; } } else if ( n <= 0 ) { _pipe.avTex[n] = inputTexCoord; } } #line 744 SLT_TEXCOORD2 slGetStageTexCoord( PIPE _pipe, uniform SLT_INT _n ) { return slGetTexCoord( _pipe, _n ); } #line 757 SLT_TEXCOORD2 slGetShaderTexCoord( PIPE _pipe, uniform SLT_INT _n ) { return slGetTexCoord( _pipe, _n + slpGetShaderTexCoordOffset() ); } void slSetShaderTexCoord( inout PIPE _pipe, uniform SLT_INT _n, SLT_TEXCOORD2 inputTexCoord ) { slSetTexCoord( _pipe, _n + slpGetShaderTexCoordOffset(), inputTexCoord ); } #line 21 "D://KTGL/shaderlib2/shader/include/../func/slTextureBlend.fx" SLT_COLOR1 _slGetStage0Alpha( SLT_COLOR1 _alpha ) { if (slcGetTexStage0AlphaOp() == 0) { return 1.0f; } else { if (slcIsStage0AlphaSpecularEnabled() || slcIsTexOpBranchEnabled()) { if (slcGetPSProfile() < 0x10010) { _alpha = saturate(2.0f*(_alpha * vSAMap.y + vSAMap.z)); } else { _alpha = saturate(_alpha * vSAMap.y + vSAMap.z); } } else if (slcIsStage0SpecularEnabled()) { if (slcIsSpecularMapBranchEnabled()) { _alpha = (_alpha * vSpMap.z + vSpMap.y); } else { _alpha = 1.0f; } } return _alpha; } } SLT_COLOR1 _slGetStage0Specular( SLT_COLOR1 _alpha ) { if (slcIsStage0AlphaSpecularEnabled()) { if (slcGetPSProfile() < 0x10010) { return saturate(2.0f*(_alpha * vSAMap.w + vSAMap.x)); } else { return saturate(_alpha * vSAMap.w + vSAMap.x); } } else if (slcIsStage0SpecularEnabled()) { if (slcIsSpecularMapBranchEnabled()) { return (_alpha * vSpMap.y + vSpMap.z); } else { return _alpha; } } else { return 1.0f; } } SLT_COLOR4 slSampleStage0Tex( PIPE _pipe ) { return h4tex2D(sStage0, slGetStageTexCoord(_pipe, 0)); } void slGetStage0ColorAndSpecular( out SLT_COLOR4 _color, out SLT_COLOR1 _fSpecular, PIPE _pipe ) { _color = slSampleStage0Tex( _pipe ); _fSpecular = _slGetStage0Specular(_color.a); _color.a = _slGetStage0Alpha( _color.a ); } #line 109 void slApplySpecularMap( inout PIPE _pipe ) { if (slcIsSpecularMapStageEnabled()) { SLT_COLOR4 _clSpecularMap = h4tex2D(sSpMap, slGetTexCoord(_pipe, slcGetSpecularMapTexCoordIndex() )); if (slcIsSpecularMapBranchEnabled()) { _pipe.clSpecular *= (_clSpecularMap.a * vSpMap.x + vSpMap.w); } else { _pipe.clSpecular *= _clSpecularMap.a; } } } SLT_COLOR4 slGetBlendedTextureBody( PIPE _pipe ) { SLT_COLOR4 _clCurrent; SLT_COLOR1 _fSpecular; slGetStage0ColorAndSpecular( _clCurrent, _fSpecular, _pipe ); if (1 < slcGetMaxTexStageCount()) { _clCurrent = slcGetTexMultiplier()*_slBlendTextures( _pipe, _clCurrent ); } else { _clCurrent *= slcGetTexMultiplier(); } return _clCurrent; } #line 150 SLT_COLOR4 slGetBlendedTexture( PIPE _pipe ) { if (0 == slcGetMaxTexStageCount()) { return slcGetTexMultiplier(); } else { SLT_COLOR4 _clCurrent; if (slcIsTexStageCountBranchEnabled()) { if ( 0.0 < nStageNum ) { _clCurrent = slGetBlendedTextureBody( _pipe ); } else { _clCurrent = slcGetTexMultiplier(); } } else { _clCurrent = slGetBlendedTextureBody( _pipe ); } return _clCurrent; } } SLT_COLOR4 slGetBlendedTextureWithSpecularMapBody( inout PIPE _pipe ) { SLT_COLOR4 _clCurrent; SLT_COLOR1 _fSpecular; slGetStage0ColorAndSpecular( _clCurrent, _fSpecular, _pipe ); _pipe.clSpecular *= (SLT_COLOR3)_fSpecular; if (1 < slcGetMaxTexStageCount()) { _clCurrent = slcGetTexMultiplier()*_slBlendTextures( _pipe, _clCurrent ); } else { _clCurrent *= slcGetTexMultiplier(); } return _clCurrent; } #line 201 SLT_COLOR4 slGetBlendedTextureWithSpecularMap( inout PIPE _pipe ) { SLT_COLOR4 _clCurrent; if (slcIsSpecularMapStageEnabled()) { slApplySpecularMap( _pipe ); } if (slcIsTexStageCountBranchEnabled()) { if ( 0.5f < nStageNum ) { _clCurrent = slGetBlendedTextureWithSpecularMapBody( _pipe ); } else { _clCurrent = slcGetTexMultiplier(); } } else { _clCurrent = slGetBlendedTextureWithSpecularMapBody( _pipe ); } return _clCurrent; } #line 231 SLT_INT slGetStageNum() { if (slcIsTexStageCountBranchEnabled()) { return (SLT_INT)nStageNum; } else { return slcGetMaxTexStageCount(); } } SLT_COLOR3 slClampLightColor( SLT_COLOR3 _color ) { if (slpIsLightingResultSaturated()) { return saturate(_color); } else { return _color; } } #line 261 void slApplyTextureStages( inout PIPE _pipe ) { _pipe.clDiffuse.rgb = slClampLightColor(_pipe.clDiffuse.rgb); if (0 == slcGetMaxTexStageCount()) { if (slpSpecularMapMayBeUsed() && _pipe.IsExisting( "clSpecular" ) ) { _pipe.clSpecular = slClampLightColor(_pipe.clSpecular); if (slcIsSpecularMapStageEnabled()) { slApplySpecularMap( _pipe ); } } _pipe.clDiffuse *= slcGetTexMultiplier(); } else { if (slpSpecularMapMayBeUsed() && _pipe.IsExisting( "clSpecular" ) ) { _pipe.clSpecular = slClampLightColor(_pipe.clSpecular); _pipe.clDiffuse *= slGetBlendedTextureWithSpecularMap( _pipe ); } else { _pipe.clDiffuse *= slGetBlendedTexture(_pipe); } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccAlphaSpecularMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" #line 28 "D://KTGL/shaderlib2/shader/include/../func/slAccAlphaSpecularMap.fx" SLT_SAMPLER_2D sAlphaSpMap < string UIName = "AlphaSpecularMap."; string Description = "Alpha Specular Map"; int Usage = 11; int Sampler = 64; int TexCoord = slpGetAlphaSpecularMapTexCoordIndex(); >; #line 64 SLT_COLOR4 slGetAlphaSpecularMap( PIPE _pipe ) { return h4tex2D( sAlphaSpMap, slGetShaderTexCoord( _pipe, slpGetAlphaSpecularMapTexCoordIndex() ) ); } #line 83 void slSetUpAlphaSpecularMapPixel( inout PIPE _pipe ) { if (slcIsAlphaSpecularMap()) { SLT_COLOR4 _clAlphaSpec = slGetAlphaSpecularMap( _pipe ); _pipe.Insert( "clAlphaSpec", _clAlphaSpec ); } } #line 104 void slApplyAccAlphaSpecularMap( inout PIPE _pipe ) { if (slcIsAlphaSpecularMap()) { _pipe.clDiffuse.a *= _pipe.clAlphaSpec.r; if (_pipe.IsExisting( "clSpecular" )) { _pipe.clSpecular *= _pipe.clAlphaSpec.g; } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccAmbientOcclusion.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" #line 22 "D://KTGL/shaderlib2/shader/include/../func/slAccAmbientOcclusion.fx" SLT_FLOAT fOccScaler; SLT_FLOAT2 fDiffuseOcclusion; #line 32 SLT_SAMPLER_2D sOcc < string UIName = "OcclusionMap"; string Description = "Occlusion Map"; int Usage = 5; int Sampler = 64; int TexCoord = slpGetAmbientOcclusionTexCoordIndex(); >; #line 68 SLT_COLOR4 slGetOcclusionMap( PIPE _pipe ) { if (sloIsEnableAmbientOcclusionScaler()) { SLT_COLOR4 _clOcc = h4tex2D( sOcc, slGetShaderTexCoord( _pipe, slpGetAmbientOcclusionTexCoordIndex() ) ); return lerp( SLT_COLOR4(1.0f, 1.0f, 1.0f, 1.0f), _clOcc, saturate(fOccScaler) ); } else { return h4tex2D( sOcc, slGetShaderTexCoord( _pipe, slpGetAmbientOcclusionTexCoordIndex() ) ); } } #line 93 void slSetUpAmbientOcclusionPixel( inout PIPE _pipe ) { if (slcIsAmbientOcclusion() && !_pipe.IsExisting("clOcc")) { SLT_COLOR4 _clOcc = slGetOcclusionMap( _pipe ); _pipe.Insert( "clOcc", _clOcc ); } if (slcIsAmbientOcclusion() && (sloGetMainLightDiffuseOcclusionType() == 2 || sloGetSubLightDiffuseOcclusionType() == 2)) { _pipe.Insert( "fDiffuseOcclusion", fDiffuseOcclusion ); } } #line 108 void _slApplyAmbientOcclusion( inout PIPE _pipe, SLT_COLOR3 _clOcc ) { _pipe.clAmbient *= _clOcc; } #line 125 void slApplyAccAmbientOcclusion( inout PIPE _pipe ) { if (slcIsAmbientOcclusion()) { if (sloGetAmbientOcclusionTexUsage() == 11) { _pipe.clDiffuse.a *= _pipe.clOcc.r; _slApplyAmbientOcclusion( _pipe, (SLT_COLOR3)_pipe.clOcc.b ); if (_pipe.IsExisting( "clSpecular" )) { _pipe.clSpecular *= _pipe.clOcc.g; } } else { _slApplyAmbientOcclusion( _pipe, _pipe.clOcc.rgb ); } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccBillBoard.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFunction.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccInstancing.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" #line 31 "D://KTGL/shaderlib2/shader/include/../func/slAccInstancing.fx" SLT_POINT4 _slVfetchInstanceMatrix0(float _nIndex) { SLT_POINT4 x; asm { vfetch x, _nIndex, "FOGCOORD" }; return x; } SLT_POINT4 _slVfetchInstanceMatrix1(float _nIndex) { SLT_POINT4 x; asm { vfetch x, _nIndex, "PSIZE" }; return x; } SLT_POINT4 _slVfetchInstanceMatrix2(float _nIndex) { SLT_POINT4 x; asm { vfetch x, _nIndex, "BINORMAL" }; return x; } SLT_POINT4 _slVfetchInstancePosition(float _nIndex) { SLT_POINT4 x; asm { vfetch x, _nIndex, "BINORMAL" }; return x; } SLT_DIR4 _slVfetchInstanceSinCos(float _nIndex) { SLT_DIR4 x; asm { vfetch x, _nIndex, "PSIZE" }; return x; } SLT_DIR4 _slVfetchInstanceYAxis(float _nIndex) { SLT_DIR4 x; asm { vfetch x, _nIndex, "FOGCOORD" }; return x; } SLT_DIR4 _slVfetchInstanceZAxis(float _nIndex) { SLT_DIR4 x; asm { vfetch x, _nIndex, "PSIZE" }; return x; } SLT_COLOR4 _slVfetchInstanceColor(float _nIndex) { SLT_COLOR4 x; asm { vfetch x, _nIndex, "COLOR1" }; return x; } SLT_TEXCOORD4 _slVfetchInstanceTexcoord(float _nIndex) { SLT_TEXCOORD4 x; asm { vfetch x, _nIndex, "PSIZE" }; return x; } void slVfetchInstancingVertex( inout PIPE _pipe, float _nInstanceIndex ) { if (slcIsInstancingAvailable()) { if (slcIsEnabledInstancingMatrix()) { _pipe.vtxInstMat0 = _slVfetchInstanceMatrix0(_nInstanceIndex); _pipe.vtxInstMat1 = _slVfetchInstanceMatrix1(_nInstanceIndex); _pipe.vtxInstMat2 = _slVfetchInstanceMatrix2(_nInstanceIndex); } if (slIsEnabledInstancingPosition() || slcIsEnabledInstancingRotation()) { _pipe.vtxInstPos = _slVfetchInstancePosition(_nInstanceIndex); } if (slcIsEnabledInstancingSinCos()) { _pipe.vtxInstTex = _slVfetchInstanceSinCos(_nInstanceIndex); } if (slcIsTexCoordInstanced() && (slcIsEnabledInstancingMatrix() || !slcIsEnabledInstancingSinCos()) && 0 < slpGetVSTexCoordNum()) { _pipe.vtxInstTex = _slVfetchInstanceTexcoord(_nInstanceIndex); } if (slcIsEnabledInstancingYZAxis()) { _pipe.vtxInstYAxis = _slVfetchInstanceYAxis(_nInstanceIndex); _pipe.vtxInstZAxis = _slVfetchInstanceZAxis(_nInstanceIndex); } if (slcIsInstancingReplaceColor()) { _pipe.vtxColor0 = _slVfetchInstanceColor(_nInstanceIndex); } else if (slcIsInstancingModulateColor()) { _pipe.vtxInstColor = _slVfetchInstanceColor(_nInstanceIndex); } } } #line 143 float slGetInstancingVertexIndex( PIPE _pipe ) { return _pipe.vtxVertexIndex; } #line 153 float slGetInstancingInstanceIndex( PIPE _pipe ) { return _pipe.vtxInstanceIndex; } float4 ksgInstSize; #line 191 void slSetUpInstancingVertex(inout PIPE _pipe) { if (slcIsVfetchNecessary()) { _pipe.Input( "int", "vtxInstIndex", "INDEX" ); float _nInstanceIndex = _pipe.vtxInstIndex * ksgInstSize.y + ksgInstSize.z; float _nVertexIndex = _pipe.vtxInstIndex - ksgInstSize.x * ((int)_nInstanceIndex); _pipe.Insert( "vtxInstanceIndex", _nInstanceIndex ); _pipe.Insert( "vtxVertexIndex", _nVertexIndex ); } if (slcIsInstancingAvailable()) { if (slcIsEnabledInstancingMatrix()) { _pipe.Input( "SLT_POINT4", "vtxInstMat0", "FOGCOORD" ); _pipe.Input( "SLT_POINT4", "vtxInstMat1", "PSIZE" ); _pipe.Input( "SLT_POINT4", "vtxInstMat2", "BINORMAL" ); } if (slIsEnabledInstancingPosition()) { if (slcIsEnabledInstancingRotation()) { _pipe.Input( "SLT_POINT4", "vtxInstPos", "BINORMAL" ); } else { _pipe.Input( "SLT_POINT3", "vtxInstPos", "BINORMAL" ); } } if (slcIsEnabledInstancingSinCos()) { if (slcIsTexCoordInstanced()) { _pipe.Input( "SLT_DIR4", "vtxInstTex", "PSIZE" ); } else { _pipe.Input( "SLT_DIR2", "vtxInstTex", "PSIZE" ); } } if (slcIsTexCoordInstanced() && (slcIsEnabledInstancingMatrix() || !slcIsEnabledInstancingSinCos()) && 0 < slpGetVSTexCoordNum()) { _pipe.Input( "SLT_TEXCOORD2", "vtxInstTex", "PSIZE" ); } if (slcIsEnabledInstancingYZAxis()) { _pipe.Input( "SLT_DIR3", "vtxInstYAxis", "FOGCOORD" ); _pipe.Input( "SLT_DIR3", "vtxInstZAxis", "PSIZE" ); } if (slcIsInstancingReplaceColor()) { _pipe.Input( "saturate_color SLT_COLOR4", "vtxColor0", "COLOR1" ); } else if (slcIsInstancingModulateColor()) { _pipe.Input( "SLT_COLOR4", "vtxInstColor", "COLOR1" ); } if (slcIsVfetchNecessary()) { slVfetchInstancingVertex( _pipe, slGetInstancingInstanceIndex( _pipe ) ); } } } SLT_POINT4 _slTransformInstancePosition( PIPE _pipe, SLT_POINT4 _pos ) { if ( slcIsEnabledInstancingMatrix() ) { SLT_POINT4 _outpos; _outpos.x = dot(_pipe.vtxInstMat0, _pos); _outpos.y = dot(_pipe.vtxInstMat1, _pos); _outpos.z = dot(_pipe.vtxInstMat2, _pos); _outpos.w = _pos.w; return _outpos; } } SLT_DIR3 _slTransformInstanceDirection( PIPE _pipe, SLT_DIR3 _vec ) { if ( slcIsEnabledInstancingMatrix() ) { SLT_DIR3 _outvec; _outvec.x = dot((SLT_POINT3)_pipe.vtxInstMat0.xyz, _vec); _outvec.y = dot((SLT_POINT3)_pipe.vtxInstMat1.xyz, _vec); _outvec.z = dot((SLT_POINT3)_pipe.vtxInstMat2.xyz, _vec); return _outvec; } } SLT_DIR2 _slGetInstanceDirection( PIPE _pipe ) { if ( !slcIsEnabledInstancingMatrix() ) { if (slcIsEnabledInstancingSinCos()) { if (slcIsTexCoordsPackedInVertex()) { return _pipe.vtxInstTex.zw; } else { return _pipe.vtxInstTex; } } else if (slIsEnabledInstancingPosition() && slcIsEnabledInstancingRotation()) { SLT_FLOAT2 _dir; slSinCosVS( _dir.x, _dir.y, _pipe.vtxInstPos.w ); return (SLT_DIR2)_dir; } else { return SLT_DIR2(0.0f, 1.0f); } } } SLT_POINT3 _slRotateInstancePosition( SLT_DIR2 _dir, SLT_POINT3 _pos ) { if ( !slcIsEnabledInstancingMatrix() ) { SLT_POINT3 _outpos; if (slcGetInstancingRotationAxis() == 0) { _outpos.x = _pos.x; _outpos.y = _dir.y * _pos.y - _dir.x * _pos.z; _outpos.z = _dir.y * _pos.z + _dir.x * _pos.y; } else if (slcGetInstancingRotationAxis() == 1) { _outpos.y = _pos.y; _outpos.z = _dir.y * _pos.z - _dir.x * _pos.x; _outpos.x = _dir.y * _pos.x + _dir.x * _pos.z; } else if (slcGetInstancingRotationAxis() == 2) { _outpos.z = _pos.z; _outpos.x = _dir.y * _pos.x - _dir.x * _pos.y; _outpos.y = _dir.y * _pos.y + _dir.x * _pos.x; } else { _outpos = _pos; } return _outpos; } } SLT_POINT3 _slRotateInstancePosition( SLT_DIR3 _x, SLT_DIR3 _y, SLT_DIR3 _z, SLT_POINT3 _pos ) { if ( !slcIsEnabledInstancingMatrix() ) { SLT_POINT3 _outpos; _outpos = _y * _pos.y; _outpos += _z * _pos.z; _outpos += _x * _pos.x; return _outpos; } } SLT_DIR3 _slRotateInstanceDirection( SLT_DIR2 _dir, SLT_DIR3 _vec ) { if ( !slcIsEnabledInstancingMatrix() ) { SLT_DIR3 _outvec; if (slcGetInstancingRotationAxis() == 0) { _outvec.x = _vec.x; _outvec.y = _dir.y * _vec.y - _dir.x * _vec.z; _outvec.z = _dir.y * _vec.z + _dir.x * _vec.y; } else if (slcGetInstancingRotationAxis() == 1) { _outvec.y = _vec.y; _outvec.z = _dir.y * _vec.z - _dir.x * _vec.x; _outvec.x = _dir.y * _vec.x + _dir.x * _vec.z; } else if (slcGetInstancingRotationAxis() == 2) { _outvec.z = _vec.z; _outvec.x = _dir.y * _vec.x - _dir.x * _vec.y; _outvec.y = _dir.y * _vec.y + _dir.x * _vec.x; } else { _outvec = _vec; } return _outvec; } } SLT_DIR3 _slRotateInstanceDirection( SLT_DIR3 _x, SLT_DIR3 _y, SLT_DIR3 _z, SLT_DIR3 _vec ) { if (!slcIsEnabledInstancingMatrix()) { SLT_DIR3 _outvec; _outvec = _y * _vec.y; _outvec += _z * _vec.z; _outvec += _x * _vec.x; return _outvec; } } #line 393 void slApplyPreTransformInstancing( inout PIPE _pipe ) { if (!slcIsInstancingAvailable()) { return; } if (slcIsInstancingModulateColor()) { _pipe.vtxColor0 *= _pipe.vtxInstColor; } if (slcIsTexCoordsPackedInVertex() && 0 < slpGetVSTexCoordNum()) { if (slcIsTexCoordsPackedInVertex() && 1 < slpGetVSTexCoordNum()) { _pipe.vtxTex01.xy += _pipe.vtxInstTex.xy; } else { _pipe.vtxTex0.xy += _pipe.vtxInstTex.xy; } } if (slcGetInstancingCoordinate() == 0) { if (slcIsEnabledInstancingMatrix()) { _pipe.vtxPos = _slTransformInstancePosition( _pipe, _pipe.vtxPos ); _pipe.vtxNormal.xyz = _slTransformInstanceDirection( _pipe, _pipe.vtxNormal.xyz ); _pipe.vtxTangent.xyz = _slTransformInstanceDirection( _pipe, _pipe.vtxTangent.xyz ); } else { if (slcIsEnabledInstancingSinCos() || (slIsEnabledInstancingPosition() && slcIsEnabledInstancingRotation())) { SLT_DIR2 _dir = _slGetInstanceDirection( _pipe ); _pipe.vtxPos.xyz = _slRotateInstancePosition( _dir, _pipe.vtxPos.xyz ); _pipe.vtxNormal.xyz = _slRotateInstanceDirection( _dir, _pipe.vtxNormal.xyz ); _pipe.vtxTangent.xyz = _slRotateInstanceDirection( _dir, _pipe.vtxTangent.xyz ); } else if (slcIsEnabledInstancingYZAxis()) { SLT_DIR3 _x = cross( _pipe.vtxInstYAxis, _pipe.vtxInstXAxis ); _pipe.vtxPos.xyz = _slRotateInstancePosition( _x, _pipe.vtxInstYAxis, _pipe.vtxInstXAxis, _pipe.vtxPos.xyz ); _pipe.vtxNormal.xyz = _slRotateInstanceDirection( _x, _pipe.vtxInstYAxis, _pipe.vtxInstXAxis, _pipe.vtxNormal.xyz ); _pipe.vtxTangent.xyz = _slRotateInstanceDirection( _x, _pipe.vtxInstYAxis, _pipe.vtxInstXAxis, _pipe.vtxTangent.xyz ); } if (slIsEnabledInstancingPosition()) { _pipe.vtxPos.xyz += _pipe.vtxInstPos.xyz; } } } } #line 452 void slApplyPostTransformInstancing( inout PIPE _pipe ) { if (!slcIsInstancingAvailable()) { return; } if (slcGetInstancingCoordinate() == 1) { if (slcIsBypassWorldTransform()) { _pipe.vWorldPos = _pipe.vBypass; } if (slcIsEnabledInstancingMatrix()) { _pipe.vWorldPos = _slTransformInstancePosition( _pipe, _pipe.vWorldPos ); _pipe.vcWorldNormal = _slTransformInstanceDirection( _pipe, _pipe.vcWorldNormal ); _pipe.vcWorldTangent = _slTransformInstanceDirection( _pipe, _pipe.vcWorldTangent ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldNormal = slNormalizeDirection(_pipe.vcWorldNormal); _pipe.vcWorldTangent = slNormalizeDirection(_pipe.vcWorldTangent); } } else { if (slcIsEnabledInstancingSinCos() || (slIsEnabledInstancingPosition() && slcIsEnabledInstancingRotation())) { SLT_DIR2 _dir = _slGetInstanceDirection( _pipe ); _pipe.vWorldPos.xyz = _slRotateInstancePosition( _dir, _pipe.vWorldPos.xyz ); _pipe.vcWorldNormal = _slRotateInstanceDirection( _dir, _pipe.vcWorldNormal ); _pipe.vcWorldTangent = _slRotateInstanceDirection( _dir, _pipe.vcWorldTangent ); } else if (slcIsEnabledInstancingYZAxis()) { SLT_DIR3 _x = cross( _pipe.vtxInstYAxis, _pipe.vtxInstZAxis ); _pipe.vWorldPos.xyz = _slRotateInstancePosition( _x, _pipe.vtxInstYAxis, _pipe.vtxInstZAxis, _pipe.vWorldPos.xyz ); _pipe.vcWorldNormal = _slRotateInstanceDirection( _x, _pipe.vtxInstYAxis, _pipe.vtxInstZAxis, _pipe.vcWorldNormal ); _pipe.vcWorldTangent = _slRotateInstanceDirection( _x, _pipe.vtxInstYAxis, _pipe.vtxInstZAxis, _pipe.vcWorldTangent ); } if (slIsEnabledInstancingPosition()) { _pipe.vWorldPos.xyz += _pipe.vtxInstPos.xyz; } } if (slcIsBypassWorldTransform()) { _pipe.vBypass = _pipe.vWorldPos; _pipe.vWorldPos.xyz += slGetCameraPosition(); } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccUnpackedVSInput.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" #line 30 "D://KTGL/shaderlib2/shader/include/../func/slAccUnpackedVSInput.fx" void slInputUnpackedAttribute( inout PIPE _pipe, uniform int _type, uniform int _component, uniform string strName, uniform string strSemantic ) { if (slcGetPlatform() != 0x40001) { Error( "Offline unpack is avairable only in NGP." ); } if (_type == 0x0100) { if (_component == 1) { _pipe.Input( "__regformat float", strName, strSemantic ); } else if (_component == 2) { _pipe.Input( "__regformat float2", strName, strSemantic ); } else if (_component == 3) { _pipe.Input( "__regformat float3", strName, strSemantic ); } else if (_component == 4) { _pipe.Input( "__regformat float4", strName, strSemantic ); } } else if (_type == 0x0200) { if (_component == 1) { _pipe.Input( "__regformat half", strName, strSemantic ); } else if (_component == 2) { _pipe.Input( "__regformat half2", strName, strSemantic ); } else if (_component == 3) { _pipe.Input( "__regformat half3", strName, strSemantic ); } else if (_component == 4) { _pipe.Input( "__regformat half4", strName, strSemantic ); } } else if (_type == 0x0300) { if (_component == 1) { _pipe.Input( "__regformat int", strName, strSemantic ); } else if (_component == 2) { _pipe.Input( "__regformat int2", strName, strSemantic ); } else if (_component == 3) { _pipe.Input( "__regformat int3", strName, strSemantic ); } else if (_component == 4) { _pipe.Input( "__regformat int4", strName, strSemantic ); } } else if (_type == 0x0400) { if (_component == 1) { _pipe.Input( "__regformat unsigned int", strName, strSemantic ); } else if (_component == 2) { _pipe.Input( "__regformat unsigned int2", strName, strSemantic ); } else if (_component == 3) { _pipe.Input( "__regformat unsigned int3", strName, strSemantic ); } else if (_component == 4) { _pipe.Input( "__regformat unsigned int4", strName, strSemantic ); } } else if (_type == 0x0500) { if (_component == 1) { _pipe.Input( "__regformat short", strName, strSemantic ); } else if (_component == 2) { _pipe.Input( "__regformat short2", strName, strSemantic ); } else if (_component == 3) { _pipe.Input( "__regformat short3", strName, strSemantic ); } else if (_component == 4) { _pipe.Input( "__regformat short4", strName, strSemantic ); } } else if (_type == 0x0600) { if (_component == 1) { _pipe.Input( "__regformat unsigned short", strName, strSemantic ); } else if (_component == 2) { _pipe.Input( "__regformat unsigned short2", strName, strSemantic ); } else if (_component == 3) { _pipe.Input( "__regformat unsigned short3", strName, strSemantic ); } else if (_component == 4) { _pipe.Input( "__regformat unsigned short4", strName, strSemantic ); } } else if (_type == 0x0700) { if (_component == 1) { _pipe.Input( "__regformat char", strName, strSemantic ); } else if (_component == 2) { _pipe.Input( "__regformat char2", strName, strSemantic ); } else if (_component == 3) { _pipe.Input( "__regformat char3", strName, strSemantic ); } else if (_component == 4) { _pipe.Input( "__regformat char4", strName, strSemantic ); } } else if (_type == 0x0800) { if (_component == 1) { _pipe.Input( "__regformat unsigned char", strName, strSemantic ); } else if (_component == 2) { _pipe.Input( "__regformat unsigned char2", strName, strSemantic ); } else if (_component == 3) { _pipe.Input( "__regformat unsigned char3", strName, strSemantic ); } else if (_component == 4) { _pipe.Input( "__regformat unsigned char4", strName, strSemantic ); } } else { Error( "Unknown type for unpacked vertex input." ); } } #line 169 void slSetUpUnpackedTexCoords(inout PIPE _pipe) { int _type = sloGetUnpackedType( sloGetUnpackedTypeTexCoord() ); if (slcIsTexCoordsPackedInVertex()) { slInputUnpackedAttribute( _pipe, _type, 2, "vupTex0", "TEXCOORD0" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex2", "TEXCOORD1" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex4", "TEXCOORD2" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex6", "TEXCOORD3" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex0" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex2" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex4" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex6" ); _pipe.vtxTex0 = _pipe.vupTex0; _pipe.vtxTex2 = _pipe.vupTex2; _pipe.vtxTex4 = _pipe.vupTex4; _pipe.vtxTex6 = _pipe.vupTex6; slInputUnpackedAttribute( _pipe, _type, 4, "vupTex01", "TEXCOORD0" ); slInputUnpackedAttribute( _pipe, _type, 4, "vupTex23", "TEXCOORD1" ); slInputUnpackedAttribute( _pipe, _type, 4, "vupTex45", "TEXCOORD2" ); slInputUnpackedAttribute( _pipe, _type, 4, "vupTex67", "TEXCOORD3" ); _pipe.Insert( "SLT_TEXCOORD4", "vtxTex01" ); _pipe.Insert( "SLT_TEXCOORD4", "vtxTex23" ); _pipe.Insert( "SLT_TEXCOORD4", "vtxTex45" ); _pipe.Insert( "SLT_TEXCOORD4", "vtxTex67" ); _pipe.vtxTex01 = _pipe.vupTex01; _pipe.vtxTex23 = _pipe.vupTex23; _pipe.vtxTex45 = _pipe.vupTex45; _pipe.vtxTex67 = _pipe.vupTex67; } else { slInputUnpackedAttribute( _pipe, _type, 2, "vupTex0", "TEXCOORD0" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex1", "TEXCOORD1" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex2", "TEXCOORD2" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex3", "TEXCOORD3" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex4", "TEXCOORD4" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex5", "TEXCOORD5" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex6", "TEXCOORD6" ); slInputUnpackedAttribute( _pipe, _type, 2, "vupTex7", "TEXCOORD7" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex0" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex1" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex2" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex3" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex4" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex5" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex6" ); _pipe.Insert( "SLT_TEXCOORD2", "vtxTex7" ); _pipe.vtxTex0 = _pipe.vupTex0; _pipe.vtxTex1 = _pipe.vupTex1; _pipe.vtxTex2 = _pipe.vupTex2; _pipe.vtxTex3 = _pipe.vupTex3; _pipe.vtxTex4 = _pipe.vupTex4; _pipe.vtxTex5 = _pipe.vupTex5; _pipe.vtxTex6 = _pipe.vupTex6; _pipe.vtxTex7 = _pipe.vupTex7; } } void slSetUpUnpackedColor0(inout PIPE _pipe) { int _type = sloGetUnpackedType( sloGetUnpackedTypeColor0() ); int _component = sloGetUnpackedComponent( sloGetUnpackedTypeColor0() ); slInputUnpackedAttribute( _pipe, _type, _component, "vupColor0", "COLOR0" ); _pipe.Insert( "saturate_color SLT_COLOR4", "vtxColor0" ); if (_component == 4) { if (_type == 0x0800) { _pipe.vtxColor0 = _pipe.vupColor0 / 255.0f; } else { _pipe.vtxColor0 = _pipe.vupColor0; } } else { Error( "Unsupported component count for color0" ); } } void slSetUpUnpackedTangent(inout PIPE _pipe) { int _type = sloGetUnpackedType( sloGetUnpackedTypeTangent() ); int _component = sloGetUnpackedComponent( sloGetUnpackedTypeTangent() ); slInputUnpackedAttribute( _pipe, _type, _component, "vupTangent", "TANGENT0" ); if (slcAccumerateSkinningInFloat()) { _pipe.Insert( "SLT_FLOAT4", "vtxTangent" ); } else { _pipe.Insert( "SLT_DIR4", "vtxTangent" ); } if (_component == 4) { _pipe.vtxTangent = _pipe.vupTangent; } else if (_component == 3) { _pipe.vtxTangent.xyz = _pipe.vupTangent; _pipe.vtxTangent.w = 1.0f; } else { Error( "Unsupported component count for Tangent" ); } } #line 290 void slSetUpUnpackedVertex(inout PIPE _pipe) { { int _type = sloGetUnpackedType( sloGetUnpackedTypePosition() ); int _component = sloGetUnpackedComponent( sloGetUnpackedTypePosition() ); slInputUnpackedAttribute( _pipe, _type, _component, "vupPos", "POSITION0" ); _pipe.Insert( "SLT_POINT4", "vtxPos" ); if (_component == 4) { _pipe.vtxPos = (SLT_POINT4)_pipe.vupPos; } else if (_component == 3) { _pipe.vtxPos = SLT_POINT4( _pipe.vupPos, 1 ); } else { Error( "Unsupported component count for position." ); } } if (slpIsVertexWeight()) { int _type = sloGetUnpackedType( sloGetUnpackedTypeWeight() ); int _component = sloGetUnpackedComponent( sloGetUnpackedTypeWeight() ); slInputUnpackedAttribute( _pipe, _type, _component, "vupWeight", "BLENDWEIGHT" ); if (slcAccumerateSkinningInFloat()) { _pipe.Insert( "SLT_FLOAT4", "vtxWeight" ); } else { _pipe.Insert( "SLT_HALF4", "vtxWeight" ); } if (_type == 0x0800) { if (_component == 1) { _pipe.vtxWeight.x = _pipe.vupWeight / 255.0f; _pipe.vtxWeight.yzw = 0.0f; } else if (_component == 2) { _pipe.vtxWeight.xy = _pipe.vupWeight / 255.0f; _pipe.vtxWeight.zw = 0.0f; } else if (_component == 3) { _pipe.vtxWeight.xyz = _pipe.vupWeight / 255.0f; _pipe.vtxWeight.w = 0.0f; } else if (_component == 4) { _pipe.vtxWeight = _pipe.vupWeight / 255.0f; } else { Error( "Invalid component count for weight." ); } } else { if (_component == 1) { _pipe.vtxWeight.x = _pipe.vupWeight; _pipe.vtxWeight.yzw = 0.0f; } else if (_component == 2) { _pipe.vtxWeight.xy = _pipe.vupWeight; _pipe.vtxWeight.zw = 0.0f; } else if (_component == 3) { _pipe.vtxWeight.xyz = _pipe.vupWeight; _pipe.vtxWeight.w = 0.0f; } else if (_component == 4) { _pipe.vtxWeight = _pipe.vupWeight; } else { Error( "Invalid component count for weight." ); } } } if (slpIsVertexBlendIndices()) { int _type = sloGetUnpackedType( sloGetUnpackedTypeBlendIndices() ); int _component = sloGetUnpackedComponent( sloGetUnpackedTypeBlendIndices() ); slInputUnpackedAttribute( _pipe, _type, _component, "vupIndices", "BLENDINDICES" ); _pipe.Insert( "SLT_INT4", "vtxnIndices" ); if (slpL2WAsMatrixArray()) { SLT_FLOAT4 vtxfIndices; if (_component == 1) { vtxfIndices.x = (SLT_FLOAT4)_pipe.vupIndices; vtxfIndices.yzw = 0; } else if (_component == 2) { vtxfIndices.xy = (SLT_FLOAT4)_pipe.vupIndices; vtxfIndices.zw = 0; } else if (_component == 3) { vtxfIndices.xyz = (SLT_FLOAT4)_pipe.vupIndices; vtxfIndices.w = 0; } else if (_component == 4) { vtxfIndices = (SLT_FLOAT4)_pipe.vupIndices; } else { Error( "Invalid component count for weight." ); } _pipe.vtxnIndices = (SLT_INT4)( vtxfIndices / 3.0f ); } else { if (_component == 1) { _pipe.vtxnIndices.x = (SLT_INT4)_pipe.vupIndices; _pipe.vtxnIndices.yzw = 0; } else if (_component == 2) { _pipe.vtxnIndices.xy = (SLT_INT4)_pipe.vupIndices; _pipe.vtxnIndices.zw = 0; } else if (_component == 3) { _pipe.vtxnIndices.xyz = (SLT_INT4)_pipe.vupIndices; _pipe.vtxnIndices.w = 0; } else if (_component == 4) { _pipe.vtxnIndices = (SLT_INT4)_pipe.vupIndices; } else { Error( "Invalid component count for weight." ); } } } { int _type = sloGetUnpackedType( sloGetUnpackedTypeNormal() ); int _component = sloGetUnpackedComponent( sloGetUnpackedTypeNormal() ); slInputUnpackedAttribute( _pipe, _type, _component, "vupNormal", "NORMAL" ); if (slcAccumerateSkinningInFloat()) { _pipe.Insert( "SLT_FLOAT3", "vtxNormal" ); if (3 <= _component) { _pipe.vtxNormal = (SLT_FLOAT3)_pipe.vupNormal.xyz; } else { Error( "Unsupported component count for normal." ); } } else { _pipe.Insert( "SLT_DIR3", "vtxNormal" ); if (3 <= _component) { _pipe.vtxNormal = (SLT_DIR3)_pipe.vupNormal.xyz; } else { Error( "Unsupported component count for normal." ); } } } if (!slcIsInstancingReplaceColor()) { slSetUpUnpackedColor0( _pipe ); } slSetUpUnpackedTexCoords( _pipe ); slSetUpUnpackedTangent( _pipe ); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slGeometry.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slGeometryParameters.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" #line 25 "D://KTGL/shaderlib2/shader/include/../func/slGeometryParameters.fx" SLT_PARAM_FLOAT4x4 mW2P ; #line 34 SLT_PARAM_FLOAT4x4 mBW2P ; #line 44 SLT_PARAM_FLOAT4x4 mL2P ; #line 55 SLT_PARAM_FLOAT4 mL2WT[3] ; #line 73 SLT_PARAM_FLOAT4 mL2W[3*(1+0)] ; #line 88 SLT_PARAM_FLOAT4 mL2BW[3*(1+0)] ; #line 101 SLT_PARAM_INT nBLoop ; SLT_PARAM_FLOAT4 wmask ; SLT_PARAM_BOOL bSkin[2] ; #line 115 SLT_PARAM_FLOAT bMatIdx ; #line 124 SLT_PARAM_BOOL bNN ; #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFunction.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateGeometryFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slShaderOptions.fxh" #line 14 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateGeometryFunc.fx" int slGetSkinningLoopCount() { if ( !slcIsSkinningBranch() || !slcIsVSStaticBranchAvailable() ) { return slcGetVertexWeightNum(); } else { return nBLoop; } } SLT_BOOL slIsNormalNormalizationEnabled() { if (0) { return true; } else if (slcIsBranchNormalizeNormal()) { return bNN; } else { return slcIsNormalizingNormalEnabled(); } } SLT_POINT4 _slApplyL2W4x4( SLT_POINT4 _pos, uniform SLT_INT _nIDx3 ) { const SLT_INT temp_nIDx3 = _nIDx3; SLT_POINT4 _vPos; if (slcIsBypassWorldTransform()) { if (slpL2WAsMatrixArray()) { _vPos.xyz = mul( mL2BW[temp_nIDx3], _pos ); } else { _vPos.x = dot(_pos, mL2BW[temp_nIDx3]); _vPos.y = dot(_pos, mL2BW[temp_nIDx3 + 1]); _vPos.z = dot(_pos, mL2BW[temp_nIDx3 + 2]); } } else { if (slpL2WAsMatrixArray()) { _vPos.xyz = mul( mL2W[temp_nIDx3], _pos ); } else { _vPos.x = dot(_pos, mL2W[temp_nIDx3]); _vPos.y = dot(_pos, mL2W[temp_nIDx3 + 1]); _vPos.z = dot(_pos, mL2W[temp_nIDx3 + 2]); } } _vPos.w = _pos.w; return _vPos; } half3 _slApplyL2W3x3( half3 _vec, uniform SLT_INT _nIDx3 ) { const SLT_INT temp_nIDx3 = _nIDx3; half3 _vOut; if (slcIsBypassWorldTransform()) { if (slpL2WAsMatrixArray()) { _vOut.xyz = mul( (half3x3)mL2BW[temp_nIDx3], _vec ); } else { _vOut.x = dot(_vec, (half3)mL2BW[temp_nIDx3]); _vOut.y = dot(_vec, (half3)mL2BW[temp_nIDx3 + 1]); _vOut.z = dot(_vec, (half3)mL2BW[temp_nIDx3 + 2]); } } else { if (slpL2WAsMatrixArray()) { _vOut.xyz = mul( (half3x3)mL2W[temp_nIDx3], _vec ); } else { _vOut.x = dot(_vec, (half3)mL2W[temp_nIDx3]); _vOut.y = dot(_vec, (half3)mL2W[temp_nIDx3 + 1]); _vOut.z = dot(_vec, (half3)mL2W[temp_nIDx3 + 2]); } } return _vOut; } float3 _slApplyL2W3x3( float3 _vec, uniform SLT_INT _nIDx3 ) { const SLT_INT temp_nIDx3 = _nIDx3; SLT_VECTOR3 _vOut; if (slcIsBypassWorldTransform()) { if (slpL2WAsMatrixArray()) { _vOut.xyz = mul( (float3x3)mL2BW[temp_nIDx3], _vec ); } else { _vOut.x = dot(_vec, (float3)mL2BW[temp_nIDx3]); _vOut.y = dot(_vec, (float3)mL2BW[temp_nIDx3 + 1]); _vOut.z = dot(_vec, (float3)mL2BW[temp_nIDx3 + 2]); } } else { if (slpL2WAsMatrixArray()) { _vOut.xyz = mul( (float3x3)mL2W[temp_nIDx3], _vec ); } else { _vOut.x = dot(_vec, (float3)mL2W[temp_nIDx3]); _vOut.y = dot(_vec, (float3)mL2W[temp_nIDx3 + 1]); _vOut.z = dot(_vec, (float3)mL2W[temp_nIDx3 + 2]); } } return _vOut; } float3 _slApplyL2WT3x3( float3 _vec ) { float3 _vOut; _vOut.x = dot( (float3)mL2WT[0], _vec ); _vOut.y = dot( (float3)mL2WT[1], _vec ); _vOut.z = dot( (float3)mL2WT[2], _vec ); return _vOut; } half3 _slApplyL2WT3x3( half3 _vec ) { half3 _vOut; _vOut.x = dot( (half3)mL2WT[0], _vec ); _vOut.y = dot( (half3)mL2WT[1], _vec ); _vOut.z = dot( (half3)mL2WT[2], _vec ); return _vOut; } SLT_BOOL slIsIndexedSkinning() { if (slcIsBranchBlendIndices()) { return 0.0f < bMatIdx; } else { return slpIsVertexBlendIndices(); } } SLT_INT4 _slGetBlendIndices(PIPE _pipe) { SLT_INT4 _nIndices; if ( slIsIndexedSkinning() ) { _nIndices = _pipe.vtxnIndices; } else { if (slpL2WAsMatrixArray()) { _nIndices = SLT_INT4(0, 1, 2, 3); } else { _nIndices = SLT_INT4(0, 3, 6, 9); } } return _nIndices; } void _slPrepareBlendWeights(inout PIPE _pipe) { if (_pipe.IsExisting( "vtxWeight" )) { if (slcIsFullVertexWeights()) { _pipe.vcSkinningWeights = _pipe.vtxWeight; } else if (!slcIsSkinningBranch()) { if (slGetSkinningLoopCount() == 0) { _pipe.vcSkinningWeights = SLT_WEIGHT4( 1.0f, 0.0f, 0.0f, 0.0f ); } else if (slGetSkinningLoopCount() == 1) { _pipe.vcSkinningWeights.x = _pipe.vtxWeight.x; _pipe.vcSkinningWeights.y = 1.0f - _pipe.vtxWeight.x; _pipe.vcSkinningWeights.zw = (SLT_WEIGHT2)0.0f; } else if (slGetSkinningLoopCount() == 2) { _pipe.vcSkinningWeights.xy = _pipe.vtxWeight.xy; _pipe.vcSkinningWeights.z = 1.0f - _pipe.vtxWeight.x - _pipe.vtxWeight.y; _pipe.vcSkinningWeights.w = 0.0f; } else if (slGetSkinningLoopCount() == 3) { _pipe.vcSkinningWeights.xyz = _pipe.vtxWeight.xyz; _pipe.vcSkinningWeights.w = 1.0f - _pipe.vtxWeight.x - _pipe.vtxWeight.y - _pipe.vtxWeight.z; } } else if (slcIsStaticSkinningBranchByLoop()) { _pipe.vcSkinningWeights = 1.0f - dot(_pipe.vtxWeight.xyz, wmask.xyz); _pipe.vcSkinningWeights = lerp(_pipe.vcSkinningWeights, _pipe.vtxWeight, wmask); } else { _pipe.vcSkinningWeights = _pipe.vtxWeight; } } else { _pipe.vcSkinningWeights = SLT_WEIGHT4( 1.0f, 0.0f, 0.0f, 0.0f ); } } #line 257 SLT_POINT4x4 slGetMatrixW2P() { return (SLT_POINT4x4)mW2P; } SLT_VECTOR3x3 slGetMatrixW2P3x3() { return (SLT_VECTOR3x3)mW2P; } #line 273 SLT_POINT4x4 slGetMatrixL2P() { return (SLT_POINT4x4)mL2P; } SLT_VECTOR3x3 slGetMatrixL2P3x3() { return (SLT_VECTOR3x3)mL2P; } #line 293 SLT_POINT3x4 slGetWorldMatrixByAddress( SLT_INT _nAddr ) { const SLT_INT temp_nAddr = _nAddr; if (slcIsBypassWorldTransform()) { return SLT_POINT3x4(mL2BW[temp_nAddr], mL2BW[temp_nAddr+1], mL2BW[temp_nAddr+2]); } else { return SLT_POINT3x4(mL2W[temp_nAddr], mL2W[temp_nAddr+1], mL2W[temp_nAddr+2]); } } #line 319 SLT_POINT3x4 slGetWorldMatrix( SLT_INT _n ) { return slGetWorldMatrixByAddress(3*_n); } #line 330 SLT_VECTOR3x3 slGetWorldMatrixByAddress3x3( SLT_INT _nAddr ) { const SLT_INT temp_nAddr = _nAddr; if (slcIsBypassWorldTransform()) { return SLT_POINT3x3((SLT_VECTOR3)mL2BW[temp_nAddr], (SLT_VECTOR3)mL2BW[temp_nAddr+1], (SLT_VECTOR3)mL2BW[temp_nAddr+2]); } else { return SLT_POINT3x3((SLT_VECTOR3)mL2W[temp_nAddr], (SLT_VECTOR3)mL2W[temp_nAddr+1], (SLT_VECTOR3)mL2W[temp_nAddr+2]); } } #line 354 SLT_VECTOR3x3 slGetWorldMatrix3x3( SLT_INT _n ) { return slGetWorldMatrixByAddress3x3(3*_n); } #line 365 SLT_POINT3x4 slGetMatrixL2W() { return slGetWorldMatrixByAddress(0); } #line 375 SLT_VECTOR3x3 slGetMatrixL2W3x3() { return slGetWorldMatrixByAddress3x3(0); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/../func/private/slDualQuaternion.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/../func/private/../slConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/../func/private/../slFunction.fx" #line 14 "D://KTGL/shaderlib2/shader/include/../func/../func/private/slDualQuaternion.fx" void _slGeometryMADD( inout PIPE _pipe, SLT_FLOAT _fWeight, uniform SLT_INT _nIndices ) { _pipe.vWorldPos.xyz += _fWeight * _slApplyL2W4x4(_pipe.vtxPos, _nIndices).xyz; _pipe.vcWorldNormal += _fWeight * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices); _pipe.vcWorldTangent += _fWeight * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices); } void slGeometryMul( inout PIPE _pipe, SLT_FLOAT _fWeight ) { _pipe.vWorldPos.xyz *= _fWeight; _pipe.vcWorldNormal *= _fWeight; _pipe.vcWorldTangent *= _fWeight; } SLT_HALF4 _slGetBlendWeights(PIPE _pipe) { if (_pipe.IsExisting( "vtxWeight" )) { if (slcIsFullVertexWeights()) { return _pipe.vtxWeight; } else if (!slcIsSkinningBranch()) { if (slGetSkinningLoopCount() == 0) { return SLT_HALF4(1.0f, 0.0f, 0.0f, 0.0f); } else if (slGetSkinningLoopCount() == 1) { SLT_WEIGHT4 _w = (SLT_WEIGHT4)0.0f; _w.x = _pipe.vtxWeight.x; _w.y = 1.0f - _pipe.vtxWeight.x; return _w; } else if (slGetSkinningLoopCount() == 2) { SLT_WEIGHT4 _w = (SLT_WEIGHT4)0.0f; _w.xy = _pipe.vtxWeight.xy; _w.z = 1.0f - _pipe.vtxWeight.x - _pipe.vtxWeight.y; return _w; } else if (slGetSkinningLoopCount() == 3) { SLT_WEIGHT4 _w = (SLT_WEIGHT4)0.0f; _w.xyz = _pipe.vtxWeight.xyz; _w.w = 1.0f - _pipe.vtxWeight.x - _pipe.vtxWeight.y - _pipe.vtxWeight.z; return _w; } } else if (slcIsStaticSkinningBranchByLoop()) { SLT_WEIGHT4 _w = 1.0f - dot((SLT_WEIGHT3)_pipe.vtxWeight.xyz, (SLT_WEIGHT3)wmask.xyz); return lerp(_w, _pipe.vtxWeight, wmask); } else { return _pipe.vtxWeight; } } else { return SLT_HALF4(1.0f, 0.0f, 0.0f, 0.0f); } } void _slInitDualQuaternion( out SLT_FLOAT4 _oDQ[2], SLT_HALF _weights, SLT_INT _nIDx3 ) { if (slcIsBypassWorldTransform()) { _oDQ[0] = _weights * mL2BW[_nIDx3]; _oDQ[1] = _weights * mL2BW[_nIDx3 + 1]; } else { _oDQ[0] = _weights * mL2W[_nIDx3]; _oDQ[1] = _weights * mL2W[_nIDx3 + 1]; } } void _slBlendDualQuaternion( inout SLT_FLOAT4 _oDQ[2], SLT_FLOAT4 _rDQ0, SLT_HALF _weights, SLT_INT _nIDx3 ) { SLT_FLOAT sgn; if (slcIsBypassWorldTransform()) { sgn = sign( dot(_rDQ0, mL2BW[_nIDx3]) ); _oDQ[0] = _oDQ[0] + _weights * sgn * mL2BW[_nIDx3]; _oDQ[1] = _oDQ[1] + _weights * sgn * mL2BW[_nIDx3 + 1]; } else { sgn = sign( dot(_rDQ0, mL2W[_nIDx3]) ); _oDQ[0] = _oDQ[0] + _weights * sgn * mL2W[_nIDx3]; _oDQ[1] = _oDQ[1] + _weights * sgn * mL2W[_nIDx3 + 1]; } } void _slApplyDualQuaternion( inout PIPE _pipe, SLT_FLOAT4 _DQ[2] ) { SLT_POINT3 pos; pos = _pipe.vWorldPos.xyz + 2.0f*cross(_DQ[0].xyz, cross(_DQ[0].xyz, _pipe.vWorldPos.xyz) + _DQ[0].w*_pipe.vWorldPos.xyz); SLT_POINT3 trans = 2.0f*(_DQ[0].w*_DQ[1].xyz - _DQ[1].w * _DQ[0].xyz + cross(_DQ[0].xyz, _DQ[1].xyz)); _pipe.vWorldPos = SLT_FLOAT4(pos + trans, 1.0f); if (slpIsVertexNormal()) { SLT_DIR3 _vNormal = _pipe.vcWorldNormal; _pipe.vcWorldNormal = _vNormal + 2.0f*cross(_DQ[0].xyz, cross(_DQ[0].xyz, _vNormal) + _DQ[0].w*_vNormal); } if (slpIsVertexTangent()) { SLT_DIR3 _vTangent = _pipe.vcWorldTangent; _pipe.vcWorldTangent = _vTangent + 2.0f*cross(_DQ[0].xyz, cross(_DQ[0].xyz, _vTangent) + _DQ[0].w*_vTangent); } } void _slApplyDualQuaternionByID( inout PIPE _pipe, uniform SLT_INT _nIDx3 ) { SLT_FLOAT4 DQRotation; SLT_FLOAT4 DQTranslation; if (slcIsBypassWorldTransform()) { DQRotation = mL2BW[_nIDx3]; DQTranslation = mL2BW[_nIDx3+1]; } else { DQRotation = mL2W[_nIDx3]; DQTranslation = mL2W[_nIDx3+1]; } SLT_POINT3 pos; pos = _pipe.vWorldPos.xyz + 2.0f*cross(DQRotation.xyz, cross(DQRotation.xyz, _pipe.vWorldPos.xyz) + DQRotation.w*_pipe.vWorldPos.xyz); SLT_POINT3 trans = 2.0f*(DQRotation.w*DQTranslation.xyz - DQTranslation.w * DQRotation.xyz + cross(DQRotation.xyz, DQTranslation.xyz)); _pipe.vWorldPos = SLT_FLOAT4(pos + trans, 1.0f); if (slpIsVertexNormal()) { SLT_DIR3 _vNormal = _pipe.vcWorldNormal; _pipe.vcWorldNormal = _vNormal + 2.0f*cross(DQRotation.xyz, cross(DQRotation.xyz, _vNormal) + DQRotation.w*_vNormal); } if (slpIsVertexTangent()) { SLT_DIR3 _vTangent = _pipe.vcWorldTangent; _pipe.vcWorldTangent = _vTangent + 2.0f*cross(DQRotation.xyz, cross(DQRotation.xyz, _vTangent) + DQRotation.w*_vTangent); } } void _slTransformDQVertexToWorldByLoop( inout PIPE _pipe ) { SLT_INT4 _nIndices = _slGetBlendIndices( _pipe ); SLT_INT4 INDICES; if (slcIsScaledDualQuaternion()) { _nIndices = _nIndices * 2; INDICES = _nIndices + 2; } else { INDICES = _nIndices; } SLT_HALF4 _weights; if (slcIsSkinningBranch() || slcGetVertexWeightNum()) { _weights = _slGetBlendWeights(_pipe); } SLT_FLOAT4 dq[2], _dq[2]; if (slcIsScaledDualQuaternion()) { _slInitDualQuaternion( dq, _weights.x, _nIndices.x ); _slInitDualQuaternion( _dq, 1.0f, _nIndices.x ); _pipe.vWorldPos.xyz = _weights.x * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.x).xyz; _pipe.vWorldPos.w = 1.0f; _pipe.vcWorldNormal = _weights.x * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.x); _pipe.vcWorldTangent = _weights.x * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.x); for ( SLT_INT i = 0; i < slGetSkinningLoopCount(); ++i ) { _slBlendDualQuaternion( dq, _dq[0], _weights.y, _nDQPass1Indices.y ); _nDQPass1Indices.yz = _nDQPass1Indices.zw; _slGeometryMADD( _pipe, _weights.y, _nIndices.y ); _weights.yz = _weights.zw; _nIndices.yz = _nIndices.zw; } } else { _slInitDualQuaternion( dq, _weights.x, _nIndices.x ); _slInitDualQuaternion( _dq, 1.0f, _nIndices.x ); _pipe.vWorldPos = _pipe.vtxPos; _pipe.vcWorldNormal = _pipe.vtxNormal; _pipe.vcWorldTangent = _pipe.vtxTangent; for ( SLT_INT i = 0; i < slGetSkinningLoopCount(); ++i) { _slBlendDualQuaternion( dq, _dq, _weights.y, _nIndices.y ); _weights.yz = _weights.zw; _nIndices.yz = _nIndices.zw; } } SLT_FLOAT recip = rsqrt( dot(dq[0], dq[0]) ); dq[0] = dq[0] * recip; dq[1] = dq[1] * recip; _slApplyDualQuaternion(_pipe, dq); } void _slTransformDQVertexToWorldByIf( inout PIPE _pipe ) { SLT_INT4 _nIndices = _slGetBlendIndices( _pipe ); SLT_INT4 INDICES; if (slcIsScaledDualQuaternion()) { _nIndices = _nIndices * 2; INDICES = _nIndices + 2; } else { INDICES = _nIndices; } SLT_HALF4 _weights; if (slcIsSkinningBranch() || slcGetVertexWeightNum()) { _weights = _slGetBlendWeights(_pipe); } SLT_FLOAT4 dq[2], _dq[2]; if (slcIsScaledDualQuaternion()) { _pipe.vWorldPos = _slApplyL2W4x4(_pipe.vtxPos, INDICES.x); _pipe.vcWorldNormal = _slApplyL2W3x3(_pipe.vtxNormal.xyz, INDICES.x); _pipe.vcWorldTangent = _slApplyL2W3x3(_pipe.vtxTangent.xyz, INDICES.x); } else { _pipe.vWorldPos = _pipe.vtxPos; _pipe.vcWorldNormal = _pipe.vtxNormal; _pipe.vcWorldTangent = _pipe.vtxTangent; } if ( bSkin[0] ) { _slInitDualQuaternion( dq, _weights.x, _nIndices.x ); _slInitDualQuaternion( _dq, 1.0f, _nIndices.x ); if (slcIsScaledDualQuaternion()) { slGeometryMul( _pipe, _weights.x ); } if ( bSkin[1] ) { _slBlendDualQuaternion( dq, _dq[0], _weights.y, _nIndices.y ); _slBlendDualQuaternion( dq, _dq[0], _weights.z, _nIndices.z ); if (slcIsScaledDualQuaternion()) { _slGeometryMADD( _pipe, _weights.y, INDICES.y ); _slGeometryMADD( _pipe, _weights.z, INDICES.z ); } SLT_HALF w; if (slcIsFullVertexWeights()) { w = _weights.w; } else { w = 1.0f - _weights.x - _weights.y - _weights.z; } _slBlendDualQuaternion( dq, _dq[0], w, _nIndices.w ); if (slcIsScaledDualQuaternion()) { _slGeometryMADD( _pipe, w, INDICES.w ); } } else { _slBlendDualQuaternion( dq, _dq[0], _weights.y, _nIndices.y ); if (slcIsScaledDualQuaternion()) { _slGeometryMADD( _pipe, _weights.y, INDICES.y ); } SLT_HALF w; if (slcIsFullVertexWeights()) { w = _weights.z; } else { w = 1.0f - _weights.x - _weights.y; } _slBlendDualQuaternion( dq, _dq[0], w, _nIndices.z ); if (slcIsScaledDualQuaternion()) { _slGeometryMADD( _pipe, w, INDICES.z ); } } } else if ( bSkin[1] ) { _slInitDualQuaternion( dq, _weights.x, _nIndices.x ); _slInitDualQuaternion( _dq, 1.0f, _nIndices.x ); if (slcIsScaledDualQuaternion()) { slGeometryMul( _pipe, _weights.x ); } SLT_HALF w; if (slcIsFullVertexWeights()) { w = _weights.y; } else { w = 1.0f - _weights.x; } _slBlendDualQuaternion( dq, _dq[0], w, _nIndices.y ); if (slcIsScaledDualQuaternion()) { _slGeometryMADD( _pipe, w, INDICES.y ); } } else { _slInitDualQuaternion( dq, 1.0f, _nIndices.x ); } SLT_FLOAT recip = rsqrt( dot(dq[0], dq[0]) ); dq[0] = dq[0] * recip; dq[1] = dq[1] * recip; _slApplyDualQuaternion(_pipe, dq); } void _slTransformDQVertexToWorldExpandingLoop( inout PIPE _pipe ) { SLT_INT4 _nIndices = _slGetBlendIndices( _pipe ); SLT_INT4 INDICES; if (slcIsScaledDualQuaternion()) { _nIndices = _nIndices * 2; INDICES = _nIndices + 2; } else { INDICES = _nIndices; } SLT_HALF4 _weights; if (slcIsSkinningBranch() || slcGetVertexWeightNum()) { _weights = _slGetBlendWeights(_pipe); } SLT_FLOAT4 dq[2], _dq[2]; if (slcIsScaledDualQuaternion()) { _pipe.vWorldPos = _slApplyL2W4x4(_pipe.vtxPos, INDICES.x); if (slcGetVertexWeightNum() == 0) { _slInitDualQuaternion( dq, 1.0f, _nIndices.x ); SLT_FLOAT recip = rsqrt( dot(dq[0], dq[0]) ); dq[0] = dq[0] * recip; dq[1] = dq[1] * recip; _slApplyDualQuaternion(_pipe, dq); } if (slpIsVertexNormal()) { if (slpIsVertexBlendIndices() || slcGetVertexWeightNum()) { _pipe.vcWorldNormal = _slApplyL2W3x3(_pipe.vtxNormal.xyz, INDICES.x); } else if (slpIsNormalPossiblyNormalized()) { _pipe.vcWorldNormal = _slApplyL2WT3x3(_pipe.vtxNormal.xyz); } else { _pipe.vcWorldNormal = _slApplyL2W3x3(_pipe.vtxNormal.xyz, 0); } } _pipe.vcWorldTangent = _slApplyL2W3x3(_pipe.vtxTangent.xyz, INDICES.x); } else { _pipe.vWorldPos = _pipe.vtxPos; _pipe.vcWorldTangent = _pipe.vtxTangent.xyz; if (slcGetVertexWeightNum() == 0) { _slInitDualQuaternion( dq, 1.0f, _nIndices.x ); SLT_FLOAT recip = rsqrt( dot(dq[0], dq[0]) ); dq[0] = dq[0] * recip; dq[1] = dq[1] * recip; if (slpIsVertexNormal()) { if (slpIsVertexBlendIndices() || slcGetVertexWeightNum()) { _pipe.vcWorldNormal = _pipe.vtxNormal.xyz; } else if (slpIsNormalPossiblyNormalized()) { _pipe.vcWorldNormal = _slApplyL2WT3x3(_pipe.vtxNormal.xyz); } else { _pipe.vcWorldNormal = _pipe.vtxNormal.xyz; } } _slApplyDualQuaternion(_pipe, dq); } else { if (slpIsVertexNormal()) { _pipe.vcWorldNormal = _pipe.vtxNormal.xyz; } } } if (0 < slcGetVertexWeightNum()) { if ( 0 < slGetSkinningLoopCount() ) { _slInitDualQuaternion( dq, _weights.x, _nIndices.x ); _slInitDualQuaternion( _dq, 1.0f, _nIndices.x ); _slBlendDualQuaternion( dq, _dq[0], _weights.y, _nIndices.y ); if (slcIsScaledDualQuaternion()) { slGeometryMul( _pipe, _weights.x ); _slGeometryMADD( _pipe, _weights.y, INDICES.y ); } if (1 < slcGetVertexWeightNum()) { if ( 1 < slGetSkinningLoopCount() ) { _slBlendDualQuaternion( dq, _dq[0], _weights.z, _nIndices.z ); if (slcIsScaledDualQuaternion()) { _slGeometryMADD( _pipe, _weights.z, INDICES.z ); } if (2 < slcGetVertexWeightNum() ) { if ( 2 < slGetSkinningLoopCount() ) { _slBlendDualQuaternion( dq, _dq[0], _weights.w, _nIndices.w ); if (slcIsScaledDualQuaternion()) { _slGeometryMADD( _pipe, _weights.w, INDICES.w ); } } } } } } SLT_FLOAT recip = rsqrt( dot(dq[0], dq[0]) ); dq[0] = dq[0] * recip; dq[1] = dq[1] * recip; _slApplyDualQuaternion(_pipe, dq); } } void _slTransformDQVertexToWorld( inout PIPE _pipe ) { if (slcGetVertexCoordinateSpace() == 0) { if (slcIsSkinningBranch()) { if (slcIsStaticSkinningBranchByLoop()) { _slTransformDQVertexToWorldByLoop( _pipe ); } else { _slTransformDQVertexToWorldByIf( _pipe ); } } else { _slTransformDQVertexToWorldExpandingLoop( _pipe ); } _slNormalizeWorldVectors( _pipe ); } else if (slcGetVertexCoordinateSpace() == 1) { _slApplyDualQuaternionByID( _pipe, 0 ); } else if (slcGetVertexCoordinateSpace() == 2) { _pipe.vWorldPos = _pipe.vtxPos; _pipe.vcWorldNormal = _pipe.vtxNormal; _pipe.vcWorldTangent = _pipe.vtxTangent; } else if (slpIsWorldPositionComputed() || slcIsWorldSpaceUsedForInstancing()) { Error( "slcGetVertexCoordinateSpace() is defined as KTGL_SHLIB_VERTEX_TRANSFORMED_PROJECTION" ); } if (slcIsBypassWorldTransform()) { if (slcGetVertexCoordinateSpace() == 2) { Error( "Can not use BypassWorld accessory with KTGL_SHLIB_VERTEX_TRANSFORMED_WORLD" ); } _pipe.vBypass = _pipe.vWorldPos; _pipe.vWorldPos.xyz += slGetCameraPosition(); } } #line 34 "D://KTGL/shaderlib2/shader/include/../func/slGeometry.fx" SLT_POINT3 slGetCameraPosition() { return (SLT_POINT3)vEye; } #line 45 SLT_POINT4 slGetWorldPosition( PIPE _pipe ) { return _pipe.vWorldPos; } #line 56 SLT_VECTOR3 slGetWorldEyeVector( PIPE _pipe ) { if (_pipe.IsExisting( "vPEye" ) ) { return _pipe.vPEye; } else { return _pipe.vEye; } } #line 72 SLT_DIR3 slGetWorldEyeDirection( PIPE _pipe ) { if (_pipe.IsExisting( "vPEyeDir" ) ) { return _pipe.vPEyeDir; } else { return _pipe.vEyeDir; } } #line 90 SLT_DIR3 slGetWorldNormal( PIPE _pipe ) { if (_pipe.IsExisting( "vcPWorldNormal" )) { return _pipe.vcPWorldNormal; } else { return _pipe.vcWorldNormal; } } #line 110 SLT_DIR3 slGetWorldTangent( PIPE _pipe ) { if (_pipe.IsExisting( "vcPWorldTangent" )) { return _pipe.vcPWorldTangent; } else { return _pipe.vcWorldTangent; } } #line 129 SLT_DIR3 slGetWorldBiNormal( PIPE _pipe ) { if (_pipe.IsExisting( "vcPWorldBiNormal" )) { return _pipe.vcPWorldBiNormal; } else { return _pipe.vcWorldBiNormal; } } #line 150 void _slTransformVertexToWorldByIf( inout PIPE _pipe ) { SLT_INT4 _nIndices = _slGetBlendIndices( _pipe ); if (slcIsSkinningBranch() || slcGetVertexWeightNum()) { _slPrepareBlendWeights( _pipe ); } _pipe.vWorldPos = _slApplyL2W4x4(_pipe.vtxPos, _nIndices.x); _pipe.vcSkinningNormal = _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.x); _pipe.vcSkinningTangent = _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.x); if ( bSkin[0] ) { _pipe.vWorldPos.xyz *= _pipe.vcSkinningWeights.x; _pipe.vcSkinningNormal *= _pipe.vcSkinningWeights.x; _pipe.vcSkinningTangent *= _pipe.vcSkinningWeights.x; if ( bSkin[1] ) { _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.y * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.y).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.y); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.y); _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.z * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.z).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.z * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.z); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.z * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.z); if (!slcIsFullVertexWeights()) { _pipe.vcSkinningWeights.w = 1.0f - _pipe.vcSkinningWeights.x - _pipe.vcSkinningWeights.y - _pipe.vcSkinningWeights.z; } _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.w * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.w).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.w * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.w); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.w * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.w); } else { _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.y * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.y).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.y); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.y); if (!slcIsFullVertexWeights()) { _pipe.vcSkinningWeights.z = 1.0f - _pipe.vcSkinningWeights.x - _pipe.vcSkinningWeights.y; } _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.z * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.z).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.z * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.z); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.z * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.z); } } else if ( bSkin[1] ) { _pipe.vWorldPos.xyz *= _pipe.vcSkinningWeights.x; _pipe.vcSkinningNormal *= _pipe.vcSkinningWeights.x; _pipe.vcSkinningTangent *= _pipe.vcSkinningWeights.x; if (!slcIsFullVertexWeights()) { _pipe.vcSkinningWeights.y = 1.0f - _pipe.vcSkinningWeights.x; } _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.y * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.y).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.y); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.y); } _pipe.vcWorldNormal = (SLT_DIR3)_pipe.vcSkinningNormal; _pipe.vcWorldTangent = (SLT_DIR3)_pipe.vcSkinningTangent; } void _slTransformVertexToWorldByLoop( inout PIPE _pipe ) { SLT_INT4 _nIndices = _slGetBlendIndices( _pipe ); _slPrepareBlendWeights( _pipe ); _pipe.vWorldPos.xyz = _pipe.vcSkinningWeights.x * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.x).xyz; _pipe.vWorldPos.w = 1.0f; _pipe.vcSkinningNormal = _pipe.vcSkinningWeights.x * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.x); _pipe.vcSkinningTangent = _pipe.vcSkinningWeights.x * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.x); for ( SLT_INT i = 0; i < slGetSkinningLoopCount(); ++i ) { _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.y * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.y).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.y); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.y); _pipe.vcSkinningWeights.yz = _pipe.vcSkinningWeights.zw; _nIndices.yz = _nIndices.zw; } _pipe.vcWorldNormal = (SLT_DIR3)_pipe.vcSkinningNormal; _pipe.vcWorldTangent = (SLT_DIR3)_pipe.vcSkinningTangent; } void _slTransformVertexToWorldExpandingLoop( inout PIPE _pipe ) { SLT_INT4 _nIndices = _slGetBlendIndices( _pipe ); _pipe.vWorldPos = _slApplyL2W4x4(_pipe.vtxPos, _nIndices.x); if (slpIsVertexBlendIndices() || slcGetVertexWeightNum()) { _pipe.vcSkinningNormal = _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.x); } else if (slpIsNormalPossiblyNormalized()) { _pipe.vcSkinningNormal = _slApplyL2WT3x3(_pipe.vtxNormal.xyz); } else { _pipe.vcSkinningNormal = _slApplyL2W3x3(_pipe.vtxNormal.xyz, 0); } _pipe.vcSkinningTangent = _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.x); if (0 < slcGetVertexWeightNum()) { _slPrepareBlendWeights( _pipe ); if ( 0 < slGetSkinningLoopCount() ) { _pipe.vWorldPos.xyz *= _pipe.vcSkinningWeights.x; _pipe.vcSkinningNormal *= _pipe.vcSkinningWeights.x; _pipe.vcSkinningTangent *= _pipe.vcSkinningWeights.x; _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.y * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.y).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.y); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.y * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.y); if (1 < slcGetVertexWeightNum()) { if ( 1 < slGetSkinningLoopCount() ) { _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.z * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.z).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.z * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.z); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.z * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.z); if (2 < slcGetVertexWeightNum() ) { if ( 2 < slGetSkinningLoopCount() ) { _pipe.vWorldPos.xyz += _pipe.vcSkinningWeights.w * _slApplyL2W4x4(_pipe.vtxPos, _nIndices.w).xyz; _pipe.vcSkinningNormal += _pipe.vcSkinningWeights.w * _slApplyL2W3x3(_pipe.vtxNormal.xyz, _nIndices.w); _pipe.vcSkinningTangent += _pipe.vcSkinningWeights.w * _slApplyL2W3x3(_pipe.vtxTangent.xyz, _nIndices.w); } } } } } } _pipe.vcWorldNormal = (SLT_DIR3)_pipe.vcSkinningNormal; _pipe.vcWorldTangent = (SLT_DIR3)_pipe.vcSkinningTangent; } void _slNormalizeWorldVectors(inout PIPE _pipe) { if ( slIsNormalNormalizationEnabled() ) { if (_pipe.IsExisting( "vcWorldNormal" )) { _pipe.vcWorldNormal = slNormalizeDirection( _pipe.vcWorldNormal ); } if (_pipe.IsExisting( "vcWorldTangent" )) { _pipe.vcWorldTangent = slNormalizeDirection( _pipe.vcWorldTangent ); } } } void _slTransformVertexToWorld( inout PIPE _pipe ) { if (slcGetVertexCoordinateSpace() == 0) { if (slcIsSkinningBranch()) { if (slcIsStaticSkinningBranchByLoop()) { _slTransformVertexToWorldByLoop( _pipe ); } else { _slTransformVertexToWorldByIf( _pipe ); } } else { _slTransformVertexToWorldExpandingLoop( _pipe ); } _slNormalizeWorldVectors( _pipe ); } else if (slcGetVertexCoordinateSpace() == 1) { _pipe.vWorldPos = _slApplyL2W4x4(_pipe.vtxPos, 0); if (slpIsNormalPossiblyNormalized()) { _pipe.vcWorldNormal = _slApplyL2WT3x3(_pipe.vtxNormal.xyz); } else { _pipe.vcWorldNormal = _slApplyL2W3x3(_pipe.vtxNormal.xyz, 0); } _pipe.vcWorldTangent = _slApplyL2W3x3(_pipe.vtxTangent.xyz, 0); } else if (slcGetVertexCoordinateSpace() == 2) { _pipe.vWorldPos = _pipe.vtxPos; _pipe.vcWorldNormal = _pipe.vtxNormal; _pipe.vcWorldTangent = _pipe.vtxTangent; } else if (slpIsWorldPositionComputed() || slcIsWorldSpaceUsedForInstancing()) { Error( "slcGetVertexCoordinateSpace() is defined as KTGL_SHLIB_VERTEX_TRANSFORMED_PROJECTION" ); } if (slcIsBypassWorldTransform()) { if (slcGetVertexCoordinateSpace() == 2) { Error( "Can nnot use BypassWorld accessory with KTGL_SHLIB_VERTEX_TRANSFORMED_WORLD" ); } _pipe.vBypass = _pipe.vWorldPos; _pipe.vWorldPos.xyz += slGetCameraPosition(); } } SLT_POINT4 _slGetProjectedPosition(PIPE _pipe) { if (slcIsBypassWorldTransform()) { return slApplyMatrix( mBW2P, _pipe.vBypass ); } else { return slApplyMatrix( slGetMatrixW2P(), _pipe.vWorldPos ); } } #line 394 void _slTransformVertex( inout PIPE _pipe, uniform SLT_INT _nDstPosition ) { if ( (slpIsVertexBlendIndices() || slcIsSkinningBranch() || 0 < slcGetVertexWeightNum()) && (slcGetVertexCoordinateSpace() == 0) ) { if( slcIsDualQuaternionEnabled() ) { _slTransformDQVertexToWorld( _pipe ); } else { _slTransformVertexToWorld( _pipe ); } _pipe.vProjPos = _slGetProjectedPosition( _pipe ); } else if ((slcGetVertexCoordinateSpace() == 0) || (slcGetVertexCoordinateSpace() == 1)) { if ( _nDstPosition == 0 ) { _slTransformVertexToWorld( _pipe ); if (slcIsL2PUsed()) { _pipe.vProjPos = slApplyMatrix( slGetMatrixL2P(), _pipe.vtxPos ); } else { _pipe.vProjPos = _slGetProjectedPosition( _pipe ); } } else { _pipe.vProjPos = slApplyMatrix(slGetMatrixL2P(), _pipe.vtxPos); _pipe.vWorldPos = _slApplyL2W4x4(_pipe.vtxPos, 0); if (slpIsNormalPossiblyNormalized()) { _pipe.vcWorldNormal = _slApplyL2WT3x3(_pipe.vtxNormal.xyz); } else { _pipe.vcWorldNormal = _slApplyL2W3x3(_pipe.vtxNormal.xyz, 0); } _pipe.vcWorldTangent = _slApplyL2W3x3(_pipe.vtxTangent.xyz, 0); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldNormal = slNormalizeDirection( _pipe.vcWorldNormal ); _pipe.vcWorldTangent = slNormalizeDirection( _pipe.vcWorldTangent ); } if (slcIsBypassWorldTransform()) { _pipe.vBypass = _pipe.vProjPos; } } } else { _pipe.vWorldPos = _pipe.vtxPos; _pipe.vcWorldNormal = _pipe.vtxNormal.xyz; _pipe.vcWorldTangent = _pipe.vtxTangent.xyz; if (slcGetVertexCoordinateSpace() == 2) { _pipe.vProjPos = slApplyMatrix( slGetMatrixW2P(), _pipe.vtxPos ); } else { _pipe.vProjPos = _pipe.vtxPos; } } } void slTransformStandardVertex( inout PIPE _pipe, uniform SLT_INT _nDstPosition ) { slApplyPreTransformInstancing( _pipe ); if (slcIsInstancingAvailable() && slcIsWorldSpaceUsedForInstancing()) { if( slcIsDualQuaternionEnabled() ) { _slTransformDQVertexToWorld( _pipe ); } else { _slTransformVertexToWorld( _pipe ); } slApplyPostTransformInstancing( _pipe ); _pipe.vProjPos = _slGetProjectedPosition( _pipe ); } else { _slTransformVertex( _pipe, _nDstPosition ); } } #line 494 void slTransformStandardVertexToWorld( inout PIPE _pipe ) { slApplyPreTransformInstancing( _pipe ); if( slcIsDualQuaternionEnabled() ) { _slTransformDQVertexToWorld( _pipe ); } else { _slTransformVertexToWorld( _pipe ); } slApplyPostTransformInstancing( _pipe ); } #line 529 void slSetUpTransformedVectors( inout PIPE _pipe ) { _pipe.Insert( "SLT_POINT4", "vProjPos" ); _pipe.Insert( "SLT_POINT4", "vWorldPos" ); _pipe.Insert( "SLT_DIR3", "vcWorldNormal" ); _pipe.Insert( "SLT_DIR3", "vcWorldTangent" ); if (slcAccumerateSkinningInFloat()) { _pipe.Insert( "SLT_FLOAT3", "vcSkinningNormal" ); _pipe.Insert( "SLT_FLOAT3", "vcSkinningTangent" ); _pipe.Insert( "SLT_FLOAT4", "vcSkinningWeights" ); } else { _pipe.Insert( "SLT_DIR3", "vcSkinningNormal" ); _pipe.Insert( "SLT_DIR3", "vcSkinningTangent" ); _pipe.Insert( "SLT_HALF4", "vcSkinningWeights" ); } } #line 562 void slInsertVertexVectors( inout PIPE _pipe ) { if (_pipe.IsExisting( "vWorldPos" )) { _pipe.Insert( "vEye", slGetRelativeVector( (SLT_POINT3)vEye, (SLT_POINT3)(_pipe.vWorldPos)) ); _pipe.Insert( "vEyeDir", slNormalizeVector( _pipe.vEye ) ); } if (_pipe.IsExisting( "vcWorldNormal" ) && _pipe.IsExisting( "vcWorldTangent" )) { SLT_DIR3 _vcBiNormal; if (slpIsVertexTangentWUsedAsBinormalDirection()) { _vcBiNormal = slGetBiNormal( _pipe.vcWorldNormal, _pipe.vcWorldTangent, _pipe.vtxTangent.w ); } else { _vcBiNormal = slGetBiNormal( _pipe.vcWorldNormal, _pipe.vcWorldTangent ); } _pipe.Insert( "vcWorldBiNormal", _vcBiNormal ); } } #line 20 "D://KTGL/shaderlib2/shader/include/../func/slAccBillBoard.fx" SLT_DIR4 _slVfetchOffset(float _nIndex) { SLT_DIR4 x; asm { vfetch x, _nIndex, psize }; return x; } #line 146 SLT_PARAM_FLOAT3 BbPos; #line 153 SLT_PARAM_HALF3 BbAxisY; #line 160 SLT_PARAM_HALF3 BbL2WScl; #line 167 SLT_PARAM_HALF4 mBbL2W[3]; #line 174 SLT_PARAM_HALF4 mBbL2P[3]; #line 182 SLT_PARAM_HALF4 BbScl; #line 189 SLT_PARAM_HALF3 BbDir; #line 196 SLT_PARAM_HALF4 BbStep; bool slcIsInstancingYAxisRotation() { return ( (slcIsEnabledInstancingSinCos() || (slIsEnabledInstancingPosition() && slcIsEnabledInstancingRotation())) && (slcGetInstancingRotationAxis() == 1) ); } bool slcIsInstancingRotation() { return ( slcIsEnabledInstancingMatrix() || slcIsInstancingYAxisRotation() || slcIsEnabledInstancingYZAxis() ); } bool sloIsBillBoardInstRotAddition() { return ( slcIsInstancingRotation() && (0 != 0) ); } bool sloIsBillBoardCase2Addision() { return ( (1 == 2) && (0 != 0) ); } bool sloIsBillBoardMoreAddition() { return ( (1 == 2) && sloIsBillBoardInstRotAddition() ); } #line 262 SLT_DIR3 slApplyBillboardL2W( SLT_DIR3 _vec ) { SLT_DIR3 _vOut; _vOut = _vec.x * (SLT_DIR3)mBbL2W[0].xyz; _vOut += _vec.y * (SLT_DIR3)mBbL2W[1].xyz; _vOut += _vec.z * (SLT_DIR3)mBbL2W[2].xyz; return _vOut; } SLT_DIR4 slApplyBillboardL2P( SLT_DIR3 _vec ) { if ( !0 ) { return _vec.xyzz * (SLT_DIR4)BbScl; } else { SLT_DIR4 _vOut; _vOut = _vec.x * (SLT_DIR4)mBbL2P[0]; _vOut += _vec.y * (SLT_DIR4)mBbL2P[1]; _vOut += _vec.z * (SLT_DIR4)mBbL2P[2]; return _vOut; } } #line 399 void slApplyColorAndTexCoordBillboardInst( inout PIPE _pipe ) { if (slcIsInstancingModulateColor()) { _pipe.vtxColor0 *= _pipe.vtxInstColor; } if (slcIsTexCoordInstanced() && 0 < slpGetVSTexCoordNum()) { if (slcIsTexCoordsPackedInVertex() && 1 < slpGetVSTexCoordNum()) { _pipe.vtxTex01.xy += _pipe.vtxInstTex.xy; } else { _pipe.vtxTex0.xy += _pipe.vtxInstTex.xy; } } } void slApplyPreTransformBillboardInst( inout PIPE _pipe, out SLT_DIR3 _vcDir ) { if (!sloIsBillBoardInstRotAddition()) { Error(""); } if (slcIsEnabledInstancingMatrix()) { SLT_DIR2 _dir = slSetNormalized2DVector( _pipe.vtxInstMat0.z, _pipe.vtxInstMat2.z ); _pipe.vtxPos = _slTransformInstancePosition( _pipe, _pipe.vtxPos ); _vcDir = slAdditionalSinCos( (SLT_DIR3)BbDir, _dir ); } else { if (slcIsEnabledInstancingSinCos() || (slIsEnabledInstancingPosition() && slcIsEnabledInstancingRotation())) { SLT_DIR2 _dir = _slGetInstanceDirection( _pipe ); _pipe.vtxPos.xyz = _slRotateInstancePosition( _dir, _pipe.vtxPos.xyz ); _vcDir = slAdditionalSinCos( (SLT_DIR3)BbDir, _dir ); } else if (slcIsEnabledInstancingYZAxis()) { SLT_DIR3 _x = cross( _pipe.vtxInstYAxis, _pipe.vtxInstXAxis ); SLT_DIR2 _dir = slSetNormalized2DVector( _x.z, _pipe.vtxInstXAxis.z ); _pipe.vtxPos.xyz = _slRotateInstancePosition( _x, _pipe.vtxInstYAxis, _pipe.vtxInstXAxis, _pipe.vtxPos.xyz ); _vcDir = slAdditionalSinCos( (SLT_DIR3)BbDir, _dir ); } if (slIsEnabledInstancingPosition()) { _pipe.vtxPos.xyz += _pipe.vtxInstPos.xyz; } } } void slApplyPreTransformBillboardInst( inout PIPE _pipe ) { if (sloIsBillBoardInstRotAddition()) { Error(""); } if (slcIsEnabledInstancingMatrix()) { _pipe.vtxPos = _slTransformInstancePosition( _pipe, _pipe.vtxPos ); } else { if (slcIsEnabledInstancingSinCos() || (slIsEnabledInstancingPosition() && slcIsEnabledInstancingRotation())) { SLT_DIR2 _dir = _slGetInstanceDirection( _pipe ); _pipe.vtxPos.xyz = _slRotateInstancePosition( _dir, _pipe.vtxPos.xyz ); } else if (slcIsEnabledInstancingYZAxis()) { SLT_DIR3 _x = cross( _pipe.vtxInstYAxis, _pipe.vtxInstXAxis ); _pipe.vtxPos.xyz = _slRotateInstancePosition( _x, _pipe.vtxInstYAxis, _pipe.vtxInstXAxis, _pipe.vtxPos.xyz ); } if (slIsEnabledInstancingPosition()) { _pipe.vtxPos.xyz += _pipe.vtxInstPos.xyz; } } } void slApplyPostTransformBillboardInst( inout PIPE _pipe, out SLT_DIR3 _vcDir ) { if (!sloIsBillBoardInstRotAddition()) { Error( "" ); } if (slcIsEnabledInstancingMatrix()) { SLT_DIR2 _dir = slSetNormalized2DVector( _pipe.vtxInstMat0.z, _pipe.vtxInstMat2.z ); _pipe.vWorldPos = _slTransformInstancePosition( _pipe, _pipe.vWorldPos ); _vcDir = slAdditionalSinCos( (SLT_DIR3)BbDir, _dir ); } else { if (slcIsEnabledInstancingSinCos() || (slIsEnabledInstancingPosition() && slcIsEnabledInstancingRotation())) { SLT_DIR2 _dir = _slGetInstanceDirection( _pipe ); _pipe.vWorldPos.xyz = _slRotateInstancePosition( _dir, _pipe.vWorldPos.xyz ); if (slcGetInstancingRotationAxis() == 1) { _vcDir = slAdditionalSinCos( (SLT_DIR3)BbDir, _dir ); } } else if (slcIsEnabledInstancingYZAxis()) { SLT_DIR3 _x = cross( _pipe.vtxInstYAxis, _pipe.vtxInstZAxis ); SLT_DIR2 _dir = slSetNormalized2DVector( _x.z, _pipe.vtxInstXAxis.z ); _pipe.vWorldPos.xyz = _slRotateInstancePosition( _x, _pipe.vtxInstYAxis, _pipe.vtxInstZAxis, _pipe.vWorldPos.xyz ); _vcDir = slAdditionalSinCos( (SLT_DIR3)BbDir, _dir ); } if (slIsEnabledInstancingPosition()) { _pipe.vWorldPos.xyz += _pipe.vtxInstPos.xyz; } } } void slApplyPostTransformBillboardInst( inout PIPE _pipe ) { if (sloIsBillBoardInstRotAddition()) { Error( "" ); } if (slcIsEnabledInstancingMatrix()) { _pipe.vWorldPos = _slTransformInstancePosition( _pipe, _pipe.vWorldPos ); } else { if (slcIsEnabledInstancingSinCos() || (slIsEnabledInstancingPosition() && slcIsEnabledInstancingRotation())) { SLT_DIR2 _dir = _slGetInstanceDirection( _pipe ); _pipe.vWorldPos.xyz = _slRotateInstancePosition( _dir, _pipe.vWorldPos.xyz ); } else if (slcIsEnabledInstancingYZAxis()) { SLT_DIR3 _x = cross( _pipe.vtxInstYAxis, _pipe.vtxInstZAxis ); _pipe.vWorldPos.xyz = _slRotateInstancePosition( _x, _pipe.vtxInstYAxis, _pipe.vtxInstZAxis, _pipe.vWorldPos.xyz ); } if (slIsEnabledInstancingPosition()) { _pipe.vWorldPos.xyz += _pipe.vtxInstPos.xyz; } } } #line 584 void slSetUpBillBoardVertex(inout PIPE _pipe) { if (slcIsBillBoard()) { if (slcIsUnpackedVertexInput()) { slInputUnpackedAttribute( _pipe, 0x0100, 3, "vupBillBoardOffset", "PSIZE" ); _pipe.Insert( "SLT_DIR3", "vtxBillBoardOffset" ); _pipe.vtxBillBoardOffset = (SLT_DIR3)_pipe.vupBillBoardOffset; } else { _pipe.Input( "SLT_DIR3", "vtxBillBoardOffset", "PSIZE" ); } if (slcIsVfetchNecessary()) { _pipe.vcOffset = _slVfetchOffset( slGetInstancingVertexIndex( _pipe ) ); } } } SLT_DIR3 slGetBillBoardOffset( PIPE _pipe ) { return _pipe.vtxBillBoardOffset; } #line 620 void slTransformBillboardToWorld(inout PIPE _pipe) { SLT_DIR3 _vcDir; if (slcGetInstancingCoordinate() == 0) { if (sloIsBillBoardInstRotAddition()) { slApplyPreTransformBillboardInst( _pipe, _vcDir ); } else { slApplyPreTransformBillboardInst( _pipe ); } } slApplyColorAndTexCoordBillboardInst( _pipe ); _pipe.vWorldPos = _slApplyL2W4x4( _pipe.vtxPos, 0 ); if (slcGetInstancingCoordinate() == 1) { if (sloIsBillBoardInstRotAddition()) { slApplyPostTransformBillboardInst( _pipe, _vcDir ); } else { slApplyPostTransformBillboardInst( _pipe ); } } if (1 == 2) { SLT_DIR3 _vAxisX = normalize( cross( BbAxisY, (SLT_DIR3)( BbPos - _pipe.vWorldPos.xyz ) ) ); SLT_DIR3 _vAxisZ = cross( _vAxisX, BbAxisY ); _pipe.vWorldPos.xyz += slApplyBillboardL2W( slGetBillBoardOffset( _pipe ), _vAxisX, _vAxisZ ); _pipe.vcWorldNormal = slApplyBillboardL2W( _pipe.vtxNormal.xyz, _vAxisX, _vAxisZ ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldNormal = slNormalizeDirection( _pipe.vcWorldNormal ); } _pipe.vcWorldTangent = slApplyBillboardL2W( _pipe.vtxTangent.xyz, _vAxisX, _vAxisZ ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldTangent = slNormalizeDirection( _pipe.vcWorldTangent ); } if (sloIsBillBoardMoreAddition()) { _vcDir.y = -_vcDir.x; _vcDir = slAdditionalSinCos( _vcDir, slSetNormalized2DVector( _vAxisZ.x, _vAxisZ.z ) ); } else if (sloIsBillBoardCase2Addision()) { _vcDir = slAdditionalSinCos( (SLT_DIR3)BbDir, slSetNormalized2DVector( _vAxisZ.x, _vAxisZ.z ) ); } } else { _pipe.vWorldPos.xyz += slApplyBillboardL2W( slGetBillBoardOffset( _pipe ) ); _pipe.vcWorldNormal = slApplyBillboardL2W( _pipe.vtxNormal.xyz ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldNormal = slNormalizeDirection( _pipe.vcWorldNormal ); } _pipe.vcWorldTangent = slApplyBillboardL2W( _pipe.vtxTangent.xyz ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldTangent = slNormalizeDirection( _pipe.vcWorldTangent ); } } if (sloIsBillBoardInstRotAddition() || sloIsBillBoardMoreAddition() || sloIsBillBoardCase2Addision()) { slApplyTexSwitch( _pipe, _vcDir ); } else if (0 != 0) { slApplyTexSwitch( _pipe, (SLT_DIR3)BbDir ); } } void slTransformBillboardToWorldPrev(inout PIPE _pipe, inout SLT_DIR3 _vcDir) { if (slcGetInstancingCoordinate() == 0) { if (sloIsBillBoardInstRotAddition()) { slApplyPreTransformBillboardInst( _pipe, _vcDir ); } else { slApplyPreTransformBillboardInst( _pipe ); } } slApplyColorAndTexCoordBillboardInst( _pipe ); _pipe.vWorldPos = _slApplyL2W4x4( _pipe.vtxPos, 0 ); if (slcGetInstancingCoordinate() == 1) { if (sloIsBillBoardInstRotAddition()) { slApplyPostTransformBillboardInst( _pipe, _vcDir ); } else { slApplyPostTransformBillboardInst( _pipe ); } } } void slTransformBillboardToWorldAfter(inout PIPE _pipe, in SLT_DIR3 _vcDir) { if (1 == 2) { SLT_DIR3 _vAxisX = normalize( cross( BbAxisY, (SLT_DIR3)( BbPos - _pipe.vWorldPos.xyz ) ) ); SLT_DIR3 _vAxisZ = cross( _vAxisX, BbAxisY ); _pipe.vWorldPos.xyz += slApplyBillboardL2W( slGetBillBoardOffset( _pipe ), _vAxisX, _vAxisZ ); _pipe.vcWorldNormal = slApplyBillboardL2W( _pipe.vtxNormal.xyz, _vAxisX, _vAxisZ ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldNormal = slNormalizeDirection( _pipe.vcWorldNormal ); } _pipe.vcWorldTangent = slApplyBillboardL2W( _pipe.vtxTangent.xyz, _vAxisX, _vAxisZ ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldTangent = slNormalizeDirection( _pipe.vcWorldTangent ); } if (sloIsBillBoardMoreAddition()) { _vcDir.y = -_vcDir.x; _vcDir = slAdditionalSinCos( _vcDir, slSetNormalized2DVector( _vAxisZ.x, _vAxisZ.z ) ); } else if (sloIsBillBoardCase2Addision()) { _vcDir = slAdditionalSinCos( (SLT_DIR3)BbDir, slSetNormalized2DVector( _vAxisZ.x, _vAxisZ.z ) ); } } else { _pipe.vWorldPos.xyz += slApplyBillboardL2W( slGetBillBoardOffset( _pipe ) ); _pipe.vcWorldNormal = slApplyBillboardL2W( _pipe.vtxNormal.xyz ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldNormal = slNormalizeDirection( _pipe.vcWorldNormal ); } _pipe.vcWorldTangent = slApplyBillboardL2W( _pipe.vtxTangent.xyz ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldTangent = slNormalizeDirection( _pipe.vcWorldTangent ); } } if (sloIsBillBoardInstRotAddition() || sloIsBillBoardMoreAddition() || sloIsBillBoardCase2Addision()) { slApplyTexSwitch( _pipe, _vcDir ); } else if (0 != 0) { slApplyTexSwitch( _pipe, (SLT_DIR3)BbDir ); } } #line 799 void slTransformBillboard(inout PIPE _pipe, uniform SLT_INT _nDstPosition) { if (( 1 == 2 ) || slcIsWorldSpaceUsedForInstancing()) { slTransformBillboardToWorld( _pipe ); _pipe.vProjPos = slApplyMatrix( slGetMatrixW2P(), _pipe.vWorldPos ); } else { if ( _nDstPosition == 0 ) { slTransformBillboardToWorld( _pipe ); _pipe.vProjPos = slApplyMatrix( slGetMatrixW2P(), _pipe.vWorldPos ); } else { SLT_DIR3 _vcDir; if (slcGetInstancingCoordinate() == 0) { if (sloIsBillBoardInstRotAddition()) { slApplyPreTransformBillboardInst( _pipe, _vcDir ); } else { slApplyPreTransformBillboardInst( _pipe ); } } slApplyColorAndTexCoordBillboardInst( _pipe ); _pipe.vWorldPos = slApplyMatrix( slGetMatrixL2P(), _pipe.vtxPos ); _pipe.vWorldPos += slApplyBillboardL2P( slGetBillBoardOffset( _pipe ) ); _pipe.vcWorldNormal = slApplyBillboardL2W( _pipe.vtxNormal.xyz ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldNormal = slNormalizeDirection( _pipe.vcWorldNormal ); } _pipe.vcWorldTangent = slApplyBillboardL2W( _pipe.vtxTangent.xyz ); if ( slIsNormalNormalizationEnabled() ) { _pipe.vcWorldTangent = slNormalizeDirection( _pipe.vcWorldTangent ); } if (sloIsBillBoardInstRotAddition() || sloIsBillBoardMoreAddition() || sloIsBillBoardCase2Addision()) { slApplyTexSwitch( _pipe, _vcDir ); } else if (0 != 0) { slApplyTexSwitch( _pipe, (SLT_DIR3)BbDir ); } _pipe.vProjPos = _pipe.vWorldPos; } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccCloth.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slSetupVSInput.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slShaderOptions.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slGeometry.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccInstancing.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccUnpackedVSInput.fx" #line 47 "D://KTGL/shaderlib2/shader/include/../func/slAccCloth.fx" SLT_PARAM_FLOAT4 vCtrl[sloGetClothCtrlPointNum()] ; void slGetLocalClothSplineSurface( inout PIPE _pipe ) { SLT_BOOL bCloth = (0.0f < dot((half4)_pipe.vtxnIndices2, (half4)_pipe.vtxnIndices2)); SLT_POINT3 _pos0 = _pipe.vtxPos.x * vCtrl[_pipe.vtxnIndices.x].xyz + _pipe.vtxPos.y * vCtrl[_pipe.vtxnIndices.y].xyz + _pipe.vtxPos.z * vCtrl[_pipe.vtxnIndices.z].xyz + _pipe.vtxPos.w * vCtrl[_pipe.vtxnIndices.w].xyz; SLT_POINT3 _pos1 = _pipe.vtxPos.x * vCtrl[_pipe.vtxnIndices2.x].xyz + _pipe.vtxPos.y * vCtrl[_pipe.vtxnIndices2.y].xyz + _pipe.vtxPos.z * vCtrl[_pipe.vtxnIndices2.z].xyz + _pipe.vtxPos.w * vCtrl[_pipe.vtxnIndices2.w].xyz; SLT_POINT3 _pos2 = _pipe.vtxPos.x * vCtrl[_pipe.vtxnIndices3.x].xyz + _pipe.vtxPos.y * vCtrl[_pipe.vtxnIndices3.y].xyz + _pipe.vtxPos.z * vCtrl[_pipe.vtxnIndices3.z].xyz + _pipe.vtxPos.w * vCtrl[_pipe.vtxnIndices3.w].xyz; SLT_POINT3 _pos3 = _pipe.vtxPos.x * vCtrl[_pipe.vtxnIndices4.x].xyz + _pipe.vtxPos.y * vCtrl[_pipe.vtxnIndices4.y].xyz + _pipe.vtxPos.z * vCtrl[_pipe.vtxnIndices4.z].xyz + _pipe.vtxPos.w * vCtrl[_pipe.vtxnIndices4.w].xyz; SLT_POINT3 _pos = _pipe.vtxWeight.x * _pos0 + _pipe.vtxWeight.y * _pos1 + _pipe.vtxWeight.z * _pos2 + _pipe.vtxWeight.w * _pos3; SLT_POINT3 _dy = _pipe.vtxDiffY.x * _pos0 + _pipe.vtxDiffY.y * _pos1 + _pipe.vtxDiffY.z * _pos2 + _pipe.vtxDiffY.w * _pos3; SLT_POINT3 _dx0 = _pipe.vtxDiffX.x * vCtrl[_pipe.vtxnIndices.x].xyz + _pipe.vtxDiffX.y * vCtrl[_pipe.vtxnIndices.y].xyz + _pipe.vtxDiffX.z * vCtrl[_pipe.vtxnIndices.z].xyz + _pipe.vtxDiffX.w * vCtrl[_pipe.vtxnIndices.w].xyz; SLT_POINT3 _dx1 = _pipe.vtxDiffX.x * vCtrl[_pipe.vtxnIndices2.x].xyz + _pipe.vtxDiffX.y * vCtrl[_pipe.vtxnIndices2.y].xyz + _pipe.vtxDiffX.z * vCtrl[_pipe.vtxnIndices2.z].xyz + _pipe.vtxDiffX.w * vCtrl[_pipe.vtxnIndices2.w].xyz; SLT_POINT3 _dx2 = _pipe.vtxDiffX.x * vCtrl[_pipe.vtxnIndices3.x].xyz + _pipe.vtxDiffX.y * vCtrl[_pipe.vtxnIndices3.y].xyz + _pipe.vtxDiffX.z * vCtrl[_pipe.vtxnIndices3.z].xyz + _pipe.vtxDiffX.w * vCtrl[_pipe.vtxnIndices3.w].xyz; SLT_POINT3 _dx3 = _pipe.vtxDiffX.x * vCtrl[_pipe.vtxnIndices4.x].xyz + _pipe.vtxDiffX.y * vCtrl[_pipe.vtxnIndices4.y].xyz + _pipe.vtxDiffX.z * vCtrl[_pipe.vtxnIndices4.z].xyz + _pipe.vtxDiffX.w * vCtrl[_pipe.vtxnIndices4.w].xyz; SLT_POINT3 _dx = _pipe.vtxWeight.x * _dx0 + _pipe.vtxWeight.y * _dx1 + _pipe.vtxWeight.z * _dx2 + _pipe.vtxWeight.w * _dx3; SLT_POINT3 _z = cross( _dy, _dx ); if ( bCloth ) { _pipe.vtxNormal.xyz = _pipe.vtxNormal.x * _dx + _pipe.vtxNormal.y * _dy + _pipe.vtxNormal.z * _z; } _pipe.vtxNormal.xyz = normalize( _pipe.vtxNormal.xyz ); if ( bCloth ) { _pipe.vtxTangent.xyz = _pipe.vtxTangent.x * _dx + _pipe.vtxTangent.y * _dy + _pipe.vtxTangent.z * _z; } _pipe.vtxTangent.xyz = normalize( _pipe.vtxTangent.xyz ); _pos.xyz += _pipe.vtxNormal.w * _z; if ( bCloth ) { _pipe.vtxPos.xyz = _pos; _pipe.vtxPos.w = 1.0f; _pipe.vtxNormal.w = 0.0f; _pipe.vtxWeight = SLT_FLOAT4(1.0f,0.0f,0.0f,0.0f); _pipe.vtxnIndices = SLT_INT4(0,0,0,0); } } void slVfetchClothVertex( out PIPE _pipe, float _nVertexIndex ) { SLT_FLOAT4 _vPos; SLT_FLOAT4 _vWeight; SLT_FLOAT4 _vDiffX; SLT_FLOAT4 _vDiffY; SLT_INT4 _nIndices; SLT_INT4 _nIndices2; SLT_INT4 _nIndices3; SLT_INT4 _nIndices4; SLT_FLOAT4 _vcNormal; asm { vfetch _vPos, _nVertexIndex, position vfetch _vWeight, _nVertexIndex, blendweight vfetch _vDiffX, _nVertexIndex, binormal vfetch _vDiffY, _nVertexIndex, color1 vfetch _nIndices, _nVertexIndex, BLENDINDICES vfetch _nIndices2, _nVertexIndex, PSIZE vfetch _nIndices3, _nVertexIndex, FOGCOORD vfetch _nIndices4, _nVertexIndex, TEXCOORD5 vfetch _vcNormal, _nVertexIndex, normal }; _pipe.vtxPos = _vPos; _pipe.vtxWeight = _vWeight; _pipe.vtxDiffX = _vDiffX; _pipe.vtxDiffY = _vDiffY; _pipe.vtxnIndices = _nIndices; _pipe.vtxnIndices2 = _nIndices2; _pipe.vtxnIndices3 = _nIndices3; _pipe.vtxnIndices4 = _nIndices4; _pipe.vtxNormal = _vcNormal; if ( (!slcIsInstancingReplaceColor()) || slcIsInstancingAvailable() ) { _pipe.vtxColor0 = _slVfetchColor0(_nVertexIndex); } slVfetchInstanceTexCoords( _pipe, _nVertexIndex ); _pipe.vtxTangent = _slVfetchTangent( _nVertexIndex ); } void slSetUpUnpackedClothVertex(inout PIPE _pipe) { slInputUnpackedAttribute( _pipe, 0x0100, 4, "vtxPos", "POSITION0" ); slInputUnpackedAttribute( _pipe, 0x0100, 4, "vtxWeight", "BLENDWEIGHT" ); slInputUnpackedAttribute( _pipe, 0x0100, 4, "vtxDiffX", "BINORMAL" ); slInputUnpackedAttribute( _pipe, 0x0100, 4, "vtxDiffY", "COLOR1" ); int _nBlendIndicesType = sloGetUnpackedType( sloGetUnpackedTypeBlendIndices() ); slInputUnpackedAttribute( _pipe, _nBlendIndicesType, 4, "vupIndices", BLENDINDICES ); slInputUnpackedAttribute( _pipe, _nBlendIndicesType, 4, "vupIndices2", PSIZE ); slInputUnpackedAttribute( _pipe, _nBlendIndicesType, 4, "vupIndices3", FOGCOORD ); slInputUnpackedAttribute( _pipe, _nBlendIndicesType, 4, "vupIndices4", TEXCOORD5 ); _pipe.Insert( "SLT_INT4", "vtxnIndices" ); _pipe.Insert( "SLT_INT4", "vtxnIndices2" ); _pipe.Insert( "SLT_INT4", "vtxnIndices3" ); _pipe.Insert( "SLT_INT4", "vtxnIndices4" ); _pipe.vtxnIndices = (SLT_INT4)_pipe.vupIndices; _pipe.vtxnIndices2 = (SLT_INT4)_pipe.vupIndices2; _pipe.vtxnIndices3 = (SLT_INT4)_pipe.vupIndices3; _pipe.vtxnIndices4 = (SLT_INT4)_pipe.vupIndices4; slInputUnpackedAttribute( _pipe, 0x0100, 4, "vtxNormal", "NORMAL" ); if ( (!slcIsInstancingReplaceColor()) || (!slcIsEnableInstancingForCloth()) ) { slSetUpUnpackedColor0( _pipe ); } slSetUpUnpackedTexCoords( _pipe ); slSetUpUnpackedTangent( _pipe ); } #line 211 void slSetUpClothVertex(inout PIPE _pipe) { if (slcIsUnpackedVertexInput()) { slSetUpUnpackedClothVertex( _pipe ); } else { _pipe.Input( "SLT_FLOAT4", "vtxPos" , "POSITION0" ); _pipe.Input( "SLT_FLOAT4", "vtxWeight" , "BLENDWEIGHT" ); _pipe.Input( "SLT_FLOAT4", "vtxDiffX" , "BINORMAL" ); _pipe.Input( "SLT_FLOAT4", "vtxDiffY" , "COLOR1" ); if (slcGetLanguage() == 3) { _pipe.Input( "SLT_FLOAT4", "vtxfIndices" , BLENDINDICES ); _pipe.Input( "SLT_FLOAT4", "vtxfIndices2" , PSIZE ); _pipe.Input( "SLT_FLOAT4", "vtxfIndices3" , FOGCOORD ); _pipe.Input( "SLT_FLOAT4", "vtxfIndices4" , TEXCOORD5 ); _pipe.Insert( "vtxnIndices" , (SLT_INT4)_pipe.vtxfIndices ); _pipe.Insert( "vtxnIndices2", (SLT_INT4)_pipe.vtxfIndices2 ); _pipe.Insert( "vtxnIndices3", (SLT_INT4)_pipe.vtxfIndices3 ); _pipe.Insert( "vtxnIndices4", (SLT_INT4)_pipe.vtxfIndices4 ); } else if ( slpBlendIndicesAsFloat4ToRawInt4Bits() ) { _pipe.Input( "SLT_FLOAT4", "vtxfIndices" , BLENDINDICES ); _pipe.Input( "SLT_FLOAT4", "vtxfIndices2" , PSIZE ); _pipe.Input( "SLT_FLOAT4", "vtxfIndices3" , FOGCOORD ); _pipe.Input( "SLT_FLOAT4", "vtxfIndices4" , TEXCOORD5 ); _pipe.Insert( "SLT_INT4", "vtxnIndices" ); _pipe.Insert( "SLT_INT4", "vtxnIndices2" ); _pipe.Insert( "SLT_INT4", "vtxnIndices3" ); _pipe.Insert( "SLT_INT4", "vtxnIndices4" ); slFloat4ToRawInt4Bits( _pipe.vtxnIndices, _pipe.vtxfIndices ); slFloat4ToRawInt4Bits( _pipe.vtxnIndices2, _pipe.vtxfIndices2 ); slFloat4ToRawInt4Bits( _pipe.vtxnIndices3, _pipe.vtxfIndices3 ); slFloat4ToRawInt4Bits( _pipe.vtxnIndices4, _pipe.vtxfIndices4 ); } else { _pipe.Input( "SLT_INT4", "vtxnIndices" , BLENDINDICES ); _pipe.Input( "SLT_INT4", "vtxnIndices2" , PSIZE ); _pipe.Input( "SLT_INT4", "vtxnIndices3" , FOGCOORD ); _pipe.Input( "SLT_INT4", "vtxnIndices4" , TEXCOORD5 ); } _pipe.Input( "SLT_FLOAT4", "vtxNormal" , "NORMAL" ); if ( (!slcIsInstancingReplaceColor()) || (!slcIsEnableInstancingForCloth()) ) { _pipe.Input( "saturate_color SLT_COLOR4", "vtxColor0", "COLOR0" ); } slSetUpTexCoords( _pipe ); _pipe.Input( "SLT_FLOAT4", "vtxTangent", "TANGENT" ); } if (slcIsVfetchNecessary()) { slVfetchClothVertex( _pipe, slGetInstancingVertexIndex( _pipe ) ); } slGetLocalClothSplineSurface( _pipe ); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccColorController.fx" #line 93 void slSetUpColorControllerPixel( inout PIPE _pipe ) { if (slcIsEnableColorController() ) { SLT_COLOR3 _clAddColor = 0.0; slGetColorControllerParameters(_pipe, _clAddColor); _pipe.Insert( "clAddColor", _clAddColor ); } } #line 105 void slApplyAccColorController( inout PIPE _pipe) { if (slcIsEnableColorController() ) { if ( _pipe.IsExisting( "clDiffuse" ) ) { _pipe.clDiffuse.rgb += _pipe.clAddColor; } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccColorSpecularMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slLighting.fx" #line 31 "D://KTGL/shaderlib2/shader/include/../func/slAccColorSpecularMap.fx" SLT_SAMPLER_2D sColSpMap < string UIName = "ColorSpecularMap"; string Description = "ColorSpecularMap"; int Usage = 2; int AlphaUsage = slGetColorSpecularMapAlphaUsage(); int Sampler = 64; int TexCoord = slGetColorSpecularMapTexCoordIndex(); >; #line 50 SLT_PARAM_FLOAT fCsMaxDc; #line 94 SLT_COLOR4 slGetColorSpecularMap( PIPE _pipe ) { if (sloGetColorSpecularMapTexCoord() == 0) { return h4tex2D( sColSpMap, slGetStageTexCoord( _pipe, 0 ) ); } else { return h4tex2D( sColSpMap, slGetShaderTexCoord( _pipe, slGetColorSpecularMapTexCoordIndex() ) ); } } #line 114 void slModifySpecularDecay( inout PIPE _pipe ) { if (_pipe.IsExisting( "fSpecularDecay" ) && _pipe.IsExisting( "clColorSpMap" )) { if (sloGetColorSpecularMapAlphaType() == 1) { _pipe.fSpecularDecay = 255.0f * _pipe.clColorSpMap.a; } else if (sloGetColorSpecularMapAlphaType() == 2) { _pipe.fSpecularDecay = exp( fCsMaxDc * _pipe.clColorSpMap.a ); } } } #line 142 void slSetUpColorSpecularMapPixel( inout PIPE _pipe ) { if (slcIsColorSpecularMapAccessory()) { _pipe.Insert( "clColorSpMap", slGetColorSpecularMap( _pipe ) ); } } #line 160 void slApplyColorSpecularMap( inout PIPE _pipe ) { if (slcIsColorSpecularMapAccessory() && _pipe.IsExisting( "clSpecular" ) ) { _pipe.clSpecular *= _pipe.clColorSpMap.rgb; } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccDissolve.fx" #line 25 SLT_PARAM_FLOAT4 vDithAlp; #line 35 SLT_SAMPLER_2D sDissolveDither < string UIName = "DitherMatrixTexture"; string Description = "Texture for Dither Matrix"; int Usage = 18; int AlphaUsage = 18; int Sampler = 64; int TexCoord = -1; >; #line 61 void slClipDissolvedPixel(inout PIPE _pipe) { if ( slcIsDissolve() ) { if ( !_pipe.IsExisting( "vScreenPos" ) ) { _pipe.Input( "SLT_TEXCOORD2", "vScreenPos", WPOS ); } SLT_TEXCOORD2 _vDitherUV = ( _pipe.vScreenPos.xy + 0.5f ) * vDithAlp.xy; SLT_COLOR _fAlphaThres = h4tex2D( sDissolveDither, _vDitherUV ).a; clip( vDithAlp.a - _fAlphaThres ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccEmissiveMap.fx" #line 125 SLT_COLOR3 slGetEmissiveMap( PIPE _pipe ) { SLT_COLOR3 _clEmissive = SLT_COLOR3(0.0, 0.0, 0.0); if (sloGetEmissiveMapTexCoordType() == 0) { _clEmissive = h4tex2D( sEmi, slGetStageTexCoord( _pipe, 0 ) ).rgb; } else { _clEmissive = h4tex2D( sEmi, slGetShaderTexCoord( _pipe, slpGetEmissiveMapTexCoordIndex() ) ).rgb; } _clEmissive *= emScl; return _clEmissive; } #line 140 void slSetUpEmissiveMapPixel( inout PIPE _pipe ) { if (slcIsEmissiveMapping() ) { SLT_COLOR3 _clEmissive = slGetEmissiveMap(_pipe); _clEmissive *= slGetEmissiveColorDefault(_pipe) ; _pipe.Insert( "clEmissive", _clEmissive ); } } #line 152 void slApplyAccEmissiveMap( inout PIPE _pipe ) { if (slcIsEmissiveMapping() ) { if (_pipe.IsExisting("clDiffuse")) { _pipe.clDiffuse.rgb += _pipe.clEmissive; } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccEnvironmentMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFunction.fx" #line 40 "D://KTGL/shaderlib2/shader/include/../func/slAccEnvironmentMap.fx" SLT_COLOR3 slGetEnvironmentMapFresnelTerm(SLT_DIR1 c, SLT_COLOR3 _cF0) { return slGetSchlickFresnelTerm( _cF0, c ); } #line 53 SLT_TEXCOORD2 slMirrorballMap(SLT_VECTOR3 v) { return slVector2MirrorballMap( v ); } #line 66 SLT_TEXCOORD2 slLightProbeMap(SLT_VECTOR3 v) { return slVector2LightProbeMap( v ); } #line 79 SLT_COLOR4 slSampleEnvironmentMap( uniform SLT_SAMPLER_ENVMAP _sEnv, SLT_VECTOR3 _vcDir ) { if (sloGetEnvMapType() == 1) { return h4tex2D( _sEnv, slMirrorballMap( _vcDir ) ); } else if (sloGetEnvMapType() == 2) { return h4tex2D( _sEnv, slLightProbeMap( _vcDir ) ); } else { return h4texCUBE( _sEnv, _vcDir ); } } #line 100 SLT_COLOR4 slSampleEnvironmentMapLOD( uniform SLT_SAMPLER_ENVMAP _sEnv, SLT_VECTOR3 _vcDir, SLT_TEXCOORD1 _fMipLevel ) { if (sloGetEnvMapType() == 1) { return h4tex2Dlod( _sEnv, SLT_TEXCOORD4( slMirrorballMap( _vcDir ), _fMipLevel, _fMipLevel ) ); } else if (sloGetEnvMapType() == 2) { return h4tex2Dlod( _sEnv, SLT_TEXCOORD4( slLightProbeMap( _vcDir ), _fMipLevel, _fMipLevel ) ); } else { return h4texCUBElod( _sEnv, SLT_TEXCOORD4( _vcDir, _fMipLevel ) ); } } #line 119 SLT_COLOR4 slSampleEnvironmentMapGrad( uniform SLT_SAMPLER_ENVMAP _sEnv, SLT_VECTOR3 _vcDir, SLT_VECTOR3 _dx, SLT_VECTOR3 _dy ) { if (sloGetEnvMapType() == 1) { SLT_TEXCOORD2 x = slMirrorballMap(_vcDir + _dx); SLT_TEXCOORD2 y = slMirrorballMap(_vcDir + _dy); SLT_TEXCOORD2 c = slMirrorballMap(_vcDir); return h4tex2D( _sEnv, c, x-c, y-c ); } else if (sloGetEnvMapType() == 2) { SLT_TEXCOORD2 x = slLightProbeMap(_vcDir + _dx); SLT_TEXCOORD2 y = slLightProbeMap(_vcDir + _dy); SLT_TEXCOORD2 c = slLightProbeMap(_vcDir); return h4tex2D( _sEnv, c, x-c, y-c ); } else { return h4texCUBE( _sEnv, _vcDir, _dx, _dy ); } } #line 145 SLT_COLOR4 slSampleRGBSEnvironmentMap( uniform SLT_SAMPLER_ENVMAP _sEnv, SLT_VECTOR3 _vcDir, SLT_COLOR _fMaxValue ) { SLT_COLOR4 _clMap = slSampleEnvironmentMap( _sEnv, _vcDir ); _clMap.rgb *= _fMaxValue * _clMap.a; _clMap.a = 1.0f; return _clMap; } #line 158 SLT_COLOR4 slSampleRGBSEnvironmentMapLOD( uniform SLT_SAMPLER_ENVMAP _sEnv, SLT_VECTOR3 _vcDir, SLT_TEXCOORD1 _fMipLevel, SLT_COLOR _fMaxValue ) { SLT_COLOR4 _clMap = slSampleEnvironmentMapLOD( _sEnv, _vcDir, _fMipLevel ); _clMap.rgb *= _fMaxValue * _clMap.a; _clMap.a = 1.0f; return _clMap; } #line 171 SLT_COLOR4 slSampleRGBSEnvironmentMapGrad( uniform SLT_SAMPLER_ENVMAP _sEnv, SLT_VECTOR3 _vcDir, SLT_VECTOR3 _dx, SLT_VECTOR3 _dy, SLT_COLOR _fMaxValue ) { SLT_COLOR4 _clMap = slSampleEnvironmentMapGrad( _sEnv, _vcDir, _dx, _dy ); _clMap.rgb *= _fMaxValue * _clMap.a; _clMap.a = 1.0f; return _clMap; } #line 553 void slSetUpEnvironmentMapPixel(inout PIPE _pipe) { if (slcIsEnvironmentMapping()) { slSetUpEnvironmentMapPixelImplement( _pipe ); } } #line 571 void slCompositEnvMapReflectionColor( inout PIPE _pipe ) { if (slcIsEnvironmentMapping()) { if (_pipe.IsExisting( "clSpecular" )) { _pipe.clSpecular += slGetReflection( _pipe ); } else { _pipe.Insert( "clSpecular", slGetReflection( _pipe ) ); } } } #line 589 void slApplyRefraction( inout PIPE _pipe ) { if (slcIsEnvironmentMapping()) { _pipe.clDiffuse = slBlendRefraction( _pipe, _pipe.clDiffuse ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccFaceRobot.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccInstancing.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMapBlend.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slGeometry.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccPixelLighting.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slGeometry.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slLighting.fxh" #line 52 "D://KTGL/shaderlib2/shader/include/../func/slAccPixelLighting.fx" void slOutputPixelLightingVertex( inout PIPE _pipe ) { if (slpIsTangentSpaceLighting()) { if (0 < slcGetMaxLightDirectionNum()) { if (slcGetPlatform() == 0x40001) { _pipe.InsertArray( "SLT_DIR4", "vTLitDir", slcGetMaxLightDirectionNum() ); } else { _pipe.InsertArray( "SLT_DIR3", "vTLitDir", slcGetMaxLightDirectionNum() ); } } for (SLT_INT i = 0; i < slcGetMaxLightDirectionNum(); ++i ) { if (slcGetPlatform() == 0x40001) { SLT_DIR3 d = slTransformDirectionW2S( _pipe.vcWorldNormal, _pipe.vcWorldTangent, _pipe.vcWorldBiNormal, (SLT_DIR3)litDir[i] ); d = normalize( d ); _pipe.vTLitDir[i] = SLT_DIR4( d, 0.0 ); } else { _pipe.vTLitDir[i] = slTransformDirectionW2S( _pipe.vcWorldNormal, _pipe.vcWorldTangent, _pipe.vcWorldBiNormal, (SLT_DIR3)litDir[i] ); } } if (0 < slcGetMaxLightPositionNum()) { _pipe.InsertArray( "SLT_VECTOR3", "vTLitPos", slcGetMaxLightPositionNum() ); } for (SLT_INT i = 0; i < slcGetMaxLightPositionNum(); ++i ) { SLT_VECTOR3 _vcDir = (SLT_VECTOR3)(litPos[i].xyz - _pipe.vWorldPos.xyz); _pipe.vTLitPos[i] = slTransformVectorW2S( _pipe.vcWorldNormal, _pipe.vcWorldTangent, _pipe.vcWorldBiNormal, _vcDir ); } if (slcGetPlatform() == 0x40001) { SLT_VECTOR3 _vTEye3 = slTransformVectorW2S( _pipe.vcWorldNormal, _pipe.vcWorldTangent, _pipe.vcWorldBiNormal, vEye.xyz - _pipe.vWorldPos.xyz ); SLT_DIR4 _vTEye = SLT_DIR4( _vTEye3, 0.0f ); _pipe.Insert( "vTEye", _vTEye ); } else { SLT_VECTOR3 _vTEye = slTransformVectorW2S( _pipe.vcWorldNormal, _pipe.vcWorldTangent, _pipe.vcWorldBiNormal, vEye.xyz - _pipe.vWorldPos.xyz ); _pipe.Insert( "vTEye", _vTEye ); } } else if (slpIsVertexTangentWUsedAsBinormalDirection()) { _pipe.Insert( "fTangentW", (SLT_COLOR)_pipe.vtxTangent.w ); } } #line 121 void slSetUpPixelLightingPixel( inout PIPE _pipe ) { if (_pipe.IsExisting( "vTEye" ) ) { _pipe.Insert( "vTEyeDir", slNormalizeVector( _pipe.vTEye ) ); } #line 136 } #line 149 void slCompositPixelMainLightingResultDefault( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if (_bDiffuse && _pipe.IsExisting( "clMainDiffuse" )) { if (slcShadowMayBeCasted()) { _pipe.clDiffuse.rgb += _pipe.clMainDiffuse.rgb * _pipe.fShadow; } else { _pipe.clDiffuse.rgb += _pipe.clMainDiffuse.rgb; } } if (_bSpecular && _pipe.IsExisting( "clMainSpecular" )) { if (slcShadowMayBeCasted()) { _pipe.clSpecular += _pipe.clMainSpecular * _pipe.fShadow; } else { _pipe.clSpecular += _pipe.clMainSpecular; } } } #line 181 void slCompositPixelMainLightingResult( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { slCompositPixelMainLightingResultDefault( _pipe, _bDiffuse, _bSpecular ); } #line 199 void slApplyAllLightShadow( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if (slcIsShadowCastedForAllLight()) { if (_bSpecular) { _pipe.clSpecular *= _pipe.fShadow; } if (_bDiffuse) { _pipe.clDiffuse.rgb *= _pipe.fShadow; } } } #line 228 void slApplyPixelLightingBody( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, uniform bool _bMainLighting, uniform bool _bSubLighting ) { _bMainLighting = _bMainLighting && (slcGetMainLightType() != 0); _bSpecular = _bSpecular && slcIsSpecularPossiblyUsed(); slPrepareLighting( _pipe, _bDiffuse, _bSpecular, _bMainLighting, _bSubLighting ); if ( slIsSpecularEnabled() ) { if (_bMainLighting) { slApplyMainLight( _pipe, _bDiffuse, _bSpecular ); } slCompositPixelMainLightingResult( _pipe, _bDiffuse, _bSpecular ); if (_bSubLighting) { slApplyParallelSubLights( _pipe, _bDiffuse, _bSpecular ); slApplyPointSubLights( _pipe, _bDiffuse, _bSpecular ); slApplySpotSubLights( _pipe, _bDiffuse, _bSpecular ); if (slcIsTileLightList()) { slApplyTileLightList( _pipe, _bDiffuse, _bSpecular ); } if (slcIsClusterLightList()) { slApplyClusterLightList( _pipe, _bDiffuse, _bSpecular ); } } slApplyAllLightShadow( _pipe, _bDiffuse, _bSpecular ); slApplySpecularMaterial( _pipe ); } else { if (_bMainLighting) { slApplyMainLight( _pipe, _bDiffuse, false ); } slCompositPixelMainLightingResult( _pipe, _bDiffuse, false ); if (_bSubLighting) { slApplyParallelSubLights( _pipe, _bDiffuse, false ); slApplyPointSubLights( _pipe, _bDiffuse, false ); slApplySpotSubLights( _pipe, _bDiffuse, false ); if (slcIsTileLightList()) { slApplyTileLightList( _pipe, _bDiffuse, false ); } if (slcIsClusterLightList()) { slApplyClusterLightList( _pipe, _bDiffuse, false ); } } slApplyAllLightShadow( _pipe, _bDiffuse, false ); } if (_bSubLighting) { slApplyHemisphereSubLights( _pipe ); } if (_bDiffuse) { slApplyAccLightMap( _pipe ); slApplyDiffuseMaterial( _pipe ); slCompositAmbientLightingResult( _pipe ); slCompositEmissiveLightingResult( _pipe ); } } #line 313 void slApplyPixelLighting( inout PIPE _pipe ) { slApplyPixelLightingBody( _pipe, true, slcIsSpecularPossiblyUsed(), true, true ); } #line 325 void slApplyPixelSpecularLighting( inout PIPE _pipe ) { slApplyPixelLightingBody( _pipe, false, slcIsSpecularPossiblyUsed(), true, true ); } #line 337 void slApplyPixelDiffuseLighting( inout PIPE _pipe ) { slApplyPixelLightingBody( _pipe, true, false, true, true ); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" #line 37 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMap.fx" SLT_SAMPLER_2D sNMap < string UIName = "NormalMap"; string Description = "Normal Map"; int Usage = 3; int AlphaUsage = sloGetNormalMapAlphaUsage(); int Sampler = 64; int TexCoord = slGetNormalMapTexCoordIndex(); bool Always = true; >; #line 81 SLT_TEXCOORD2 slGetNormalMapTexCoord( PIPE _pipe ) { if (sloGetNormalMapTexCoordType() == 1) { return slGetShaderTexCoord( _pipe, slGetNormalMapTexCoordIndex() ); } else { return slGetStageTexCoord( _pipe, 0 ); } } SLT_DIR3 slColor2Vector( SLT_COLOR3 _vc ) { if (slpIsNormalMapBAccumulated()) { SLT_DIR2 _v = (SLT_DIR2)(2.0 * ( _vc - 0.5 )); SLT_DIR2 _v2 = _v*_v; return SLT_DIR3( _v.x, _v.y, sqrt(saturate( 1.0-_v2.x-_v2.y )) ); } else { return slNormalizeDirection( 2.0 * ( (SLT_DIR3)_vc - 0.5 ) ); } } #line 123 SLT_DIR4 slGetNormalMap( SLT_TEXCOORD2 _vTex, uniform SLT_SAMPLER_2D _NormalmapSampler ) { SLT_DIR4 _clNormalMap = h4tex2D( _NormalmapSampler, _vTex ); if (slpIsNormalMapARSwapped()) { _clNormalMap = _clNormalMap.agbr; } if (sloGetNormalMapCompressionType() == 4) { _clNormalMap.r *= _clNormalMap.a; } _clNormalMap.rgb = slColor2Vector( (SLT_COLOR3)_clNormalMap ); if (sloGetNormalMapDirectionType() == 2) { SLT_TEXCOORD2 _dx = ddx(_vTex); SLT_TEXCOORD2 _dy = ddy(_vTex); SLT_TEXCOORD1 _d = cross(_dx.xyy, _dy.xyy).z; if (slcGetScreenUpDir() < 0) { if ( _d < 0.0f ) { _clNormalMap.r = -_clNormalMap.r; } } else { if ( 0.0f < _d ) { _clNormalMap.r = -_clNormalMap.r; } } } return _clNormalMap; } #line 165 SLT_DIR4 slGetNormalMapVector(PIPE _pipe) { return slGetNormalMap( slGetNormalMapTexCoord(_pipe), sNMap ); } #line 179 SLT_DIR3 slGetModifiedTangent( SLT_DIR3 _vcNewNormal, SLT_DIR3 _vcTangent ) { return slNormalizeVector( _vcTangent - dot( _vcTangent, _vcNewNormal ) * _vcNewNormal ); } #line 203 void slSetUpNormalMapPixel( inout PIPE _pipe ) { if (slcNormalMapping()) { SLT_DIR4 _vNormalMap = slGetNormalMapVector( _pipe ); if (slpIsTangentSpaceLighting()) { _pipe.Insert( "vcLitNormal", (SLT_DIR3)_vNormalMap ); _pipe.Insert( "vcLitTangent", slGetModifiedTangent( _pipe.vcLitNormal, SLT_DIR3(0,1,0) ) ); } else { _pipe.Insert( "vcLitNormal", slTransformS2W( slGetWorldNormal( _pipe ), slGetWorldTangent( _pipe ), slGetWorldBiNormal( _pipe ), _vNormalMap.xyz ) ); _pipe.Insert( "vcLitTangent", slGetModifiedTangent( _pipe.vcLitNormal, slGetWorldTangent( _pipe ) ) ); } _pipe.Insert( "vcLitBiNormal", slGetBiNormal( _pipe.vcLitNormal, _pipe.vcLitTangent ) ); if (sloIsNormalSpecular()) { if (sloGetNormalMapCompressionType() == 4) { Error( "Invalid normal mapping setting : Compress=All, SpecularMap=1" ); } } _pipe.Insert( "fNormalMapAlpha", _vNormalMap.a ); } } #line 244 void slApplyNormalSpecular(inout PIPE _pipe) { if (slcNormalMapping()) { if (_pipe.IsExisting( "clSpecular" )) { if (sloIsNormalSpecular()) { _pipe.clSpecular *= _pipe.fNormalMapAlpha; } } } } #line 106 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMapBlend.fx" void slVfetchNormalMapBlendVertex(inout PIPE _pipe) { float _nVertexIndex = slGetInstancingVertexIndex( _pipe ); SLT_DIR4 _color1; if (sloGetNormalMapBlendColorIndex() != 0) { asm { vfetch _color1, _nVertexIndex, COLOR1 }; _pipe.vtxColor1 = _nVertexIndex; _pipe.vtxColor1 = _color1; } } #line 135 void slSetUpNormalMapBlendVertex(inout PIPE _pipe) { if (slcIsNormalMappingBlend()) { if (0 < sloGetNormalMapBlendColorIndex()) { _pipe.Input( "SLT_FLOAT4", "vtxColor1", COLOR1 ); } if (slcIsVfetchNecessary()) { slVfetchNormalMapBlendVertex( _pipe ); } } } #line 155 SLT_COLOR slGetNormalMapBlendingRatio( PIPE _pipe ) { if (0) { return fBlendRatio; } else if (sloGetNormalMapBlendColorIndex() == 0) { SLT_COLOR4 _vColor0 = frac(_pipe.vtxColor0); SLT_FLOAT4 _vfBW = SLT_FLOAT4(fBW[(SLT_INT)(_pipe.vtxColor0.x / 10.0f)].x, fBW[(SLT_INT)(_pipe.vtxColor0.y / 10.0f)].x, fBW[(SLT_INT)(_pipe.vtxColor0.z / 10.0f)].x, fBW[(SLT_INT)(_pipe.vtxColor0.w / 10.0f)].x ); return saturate( dot(_vColor0, _vfBW) ); } else if (sloGetNormalMapBlendColorIndex() == 1) { SLT_COLOR4 _vColor1 = frac(_pipe.vtxColor1); SLT_FLOAT4 _vfBW = SLT_FLOAT4(fBW[(SLT_INT)(_pipe.vtxColor1.x / 10.0f)].x, fBW[(SLT_INT)(_pipe.vtxColor1.y / 10.0f)].x, fBW[(SLT_INT)(_pipe.vtxColor1.z / 10.0f)].x, fBW[(SLT_INT)(_pipe.vtxColor1.w / 10.0f)].x ); return saturate( dot(_vColor1, _vfBW) ); } } #line 194 void slOutputNormalMapBlendVertex(inout PIPE _pipe) { if (slcIsNormalMappingBlend() || slcIsParallaxMapBlendAccessory()) { _pipe.Insert( "saturate_color SLT_COLOR", "fNMBlend" ); _pipe.fNMBlend = slGetNormalMapBlendingRatio( _pipe ); } } #line 211 SLT_DIR4 slGetBlendedNormalMap(SLT_TEXCOORD2 _vTex, SLT_TEXCOORD2 _vBlendTex, SLT_SAMPLER_2D _sNMap0, SLT_SAMPLER_2D _sNMap1, SLT_COLOR _fBlend) { SLT_DIR4 _vNormalMap0 = slGetNormalMap(_vTex, _sNMap0 ); SLT_DIR4 _vNormalMap1 = slGetNormalMap(_vBlendTex, _sNMap1 ); _vNormalMap0.xy *= _vNormalMap1.z; _vNormalMap1.xy *= _vNormalMap0.z; SLT_DIR4 _vBlend; _vBlend.xyw = lerp( _vNormalMap0.xyw, _vNormalMap1.xyw, _fBlend ); _vBlend.z = _vNormalMap0.z * _vNormalMap1.z; _vBlend.xyz = slNormalizeDirection( _vBlend.xyz ); return _vBlend; } SLT_TEXCOORD2 slGetBlendingNormalMapTexCoord( PIPE _pipe ) { if (sloGetNormalMapBlendTexCoordType() == 1) { return slGetShaderTexCoord( _pipe, slGetNormalMapBlendTexCoordIndex() ); } else { return slGetStageTexCoord( _pipe, 0 ); } } #line 80 "D://KTGL/shaderlib2/shader/include/../func/slAccFaceRobot.fx" SLT_DIR4 slVfetchFaceRobotVertex(inout PIPE _pipe) { float _nVertexIndex = slGetInstancingVertexIndex( _pipe ); SLT_DIR4 _color1; SLT_DIR4 _color2; if (2 < sloGetFaceRobotColorNum()) { asm { vfetch _color1, _nVertexIndex, COLOR1 vfetch _color2, _nVertexIndex, FOGCOORD }; _pipe.vtxColor1 = _color1; _pipe.vtxColor2 = _color2; } else if (1 < sloGetFaceRobotColorNum()) { asm { vfetch _color1, _nVertexIndex, COLOR1 }; _pipe.vtxColor1 = _color1; } } #line 116 void slSetUpFaceRobotVertex(inout PIPE _pipe) { if (slcIsFaceRobot()) { if (1 < sloGetFaceRobotColorNum()) { _pipe.Input( "SLT_FLOAT4", "vtxColor1", COLOR1 ); } if (2 < sloGetFaceRobotColorNum()) { _pipe.Input( "SLT_FLOAT4", "vtxColor2", FOGCOORD ); } if (slcIsVfetchNecessary()) { slVfetchFaceRobotVertex( _pipe ); } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccInstancing.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMapBlend.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccMultiRenderTarget.fx" #line 27 bool slpVSOutputViewNormal() { return ((slcDoesMRTOutputViewNormalDepth() || slcDoesMRTOutputViewNormalRGB()) && (!0)); } #line 46 SLT_PARAM_FLOAT4 vCamD; #line 54 SLT_PARAM_FLOAT4 vRGB; #line 62 SLT_PARAM_FLOAT4 mWV[3]; #line 82 SLT_VECTOR1 slNormalizeCameraDepth(SLT_VECTOR1 _fDepth) { return vCamD.x * _fDepth + vCamD.y; } #line 92 SLT_VECTOR1 slRestoreCameraDepth(SLT_VECTOR1 _fDepth) { return vCamD.z * _fDepth + vCamD.w; } #line 102 SLT_DIR3 slGetViewNormal(SLT_DIR3 vWorldNormal) { SLT_DIR3 _vOut; _vOut.x = dot( (SLT_DIR3)mWV[0], vWorldNormal ); _vOut.y = dot( (SLT_DIR3)mWV[1], vWorldNormal ); _vOut.z = dot( (SLT_DIR3)mWV[2], vWorldNormal ); return _vOut; } #line 116 SLT_COLOR3 slVector2Color( SLT_VECTOR3 _vc ) { return (SLT_COLOR3)( 0.5f * (SLT_DIR3)slNormalizeVector( _vc ) + 0.5f ); } #line 140 void slOutputMRTVertex( inout PIPE _pipe ) { if (slpVSOutputViewNormal()) { SLT_VECTOR3 _vViewNormal = slGetViewNormal( _pipe.vcWorldNormal ); _pipe.Insert( "vViewNormal", _vViewNormal ); } if (slcDoesMRTOutputZ()) { _pipe.Insert( "fZ", _pipe.vProjPos.z ); _pipe.Insert( "fW", _pipe.vProjPos.w ); } else if (slcDoesMRTOutputDepth() || slcDoesMRTOutputViewNormalDepth()) { _pipe.Insert( "fW", _pipe.vProjPos.w ); } else if (slcDoesMRTOutputNormalizeDepth()) { _pipe.Insert( "fCameraD", slNormalizeCameraDepth(_pipe.vProjPos.w) ); } } SLT_VECTOR slGetNormalizedDepth( PIPE _pipe ) { if (_pipe.IsExisting( "fCameraD" )) { return _pipe.fCameraD; } else { return slNormalizeCameraDepth( _pipe.fW ); } } SLT_DIR3 slGetViewNormal( PIPE _pipe ) { if (_pipe.IsExisting( "vViewNormal" )) { return _pipe.vViewNormal; } else { return slGetViewNormal( slGetWorldNormal( _pipe ) ); } } #line 197 void slOutputMRTPixel( inout SLT_COLOR4 _color0, inout PIPE _pipe ) { if ( slcGetMRT1() == 1 ) { SLT_FLOAT4 _clOut; _clOut.rgb = _pipe.fW; _clOut.w = _color0.w; _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetMRT1() == 2 ) { SLT_HALF4 _clOut; _clOut.rgb = slGetNormalizedDepth( _pipe ); _clOut.w = _color0.w; _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetMRT1() == 3 ) { SLT_COLOR4 _clOut; _clOut.xyz = slFloat2RGB(slGetNormalizedDepth( _pipe )); _clOut.w = _color0.w; _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetMRT1() == 4 ) { SLT_FLOAT4 _clOut; _clOut.xyz = (SLT_FLOAT3)(_pipe.fZ / _pipe.fW); _clOut.w = _color0.w; _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetMRT1() == 5 ) { SLT_COLOR4 _clOut = SLT_COLOR4( slFloat2RGB(_pipe.fZ / _pipe.fW), _color0.w ); _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetMRT1() == 6 ) { SLT_COLOR4 _clOut; _clOut.xyz = _color0.xyz - 1.0f; _clOut.w = _color0.w; _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetMRT1() == 8 ) { SLT_COLOR4 _clOut; _clOut.xyz = vRGB.xyz; _clOut.w = _color0.w; _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetMRT1() == 10 ) { SLT_COLOR4 _clOut; _clOut.rgb = slVector2Color( slGetViewNormal( _pipe ) ); _clOut.w = _color0.w; _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetMRT1() == 9 ) { SLT_FLOAT4 _clOut; _clOut.rgb = slGetViewNormal( _pipe ); _clOut.w = _pipe.fW; _pipe.Output( "color1", "COLOR1", _clOut ); } if ( slcGetMRT2() == 1 ) { SLT_FLOAT4 _clOut; _clOut.rgb = _pipe.fW; _clOut.w = _color0.w; _pipe.Output( "color2", "COLOR2", _clOut ); } else if ( slcGetMRT2() == 2 ) { SLT_HALF4 _clOut; _clOut.rgb = slGetNormalizedDepth( _pipe ); _clOut.w = _color0.w; _pipe.Output( "color2", "COLOR2", _clOut ); } else if ( slcGetMRT2() == 3 ) { SLT_COLOR4 _clOut; _clOut.xyz = slFloat2RGB(slGetNormalizedDepth( _pipe )); _clOut.w = _color0.w; _pipe.Output( "color2", "COLOR2", _clOut ); } else if ( slcGetMRT2() == 4 ) { SLT_FLOAT4 _clOut; _clOut.xyz = (SLT_FLOAT3)(_pipe.fZ / _pipe.fW); _clOut.w = _color0.w; _pipe.Output( "color2", "COLOR2", _clOut ); } else if ( slcGetMRT2() == 5 ) { SLT_COLOR4 _clOut = SLT_COLOR4( slFloat2RGB(_pipe.fZ / _pipe.fW), _color0.w ); _pipe.Output( "color2", "COLOR2", _clOut ); } else if ( slcGetMRT2() == 6 ) { SLT_COLOR4 _clOut; _clOut.xyz = _color0.xyz - 1.0f; _clOut.w = _color0.w; _pipe.Output( "color2", "COLOR2", _clOut ); } else if ( slcGetMRT2() == 8 ) { SLT_COLOR4 _clOut; _clOut.xyz = vRGB.xyz; _clOut.w = _color0.w; _pipe.Output( "color2", "COLOR2", _clOut ); } else if ( slcGetMRT2() == 10 ) { SLT_COLOR4 _clOut; _clOut.rgb = slVector2Color( slGetViewNormal( _pipe ) ); _clOut.w = _color0.w; _pipe.Output( "color2", "COLOR2", _clOut ); } else if ( slcGetMRT2() == 9 ) { SLT_FLOAT4 _clOut; _clOut.rgb = slGetViewNormal( _pipe ); _clOut.w = _pipe.fW; _pipe.Output( "color2", "COLOR2", _clOut ); } if ( slcGetMRT3() == 1 ) { SLT_FLOAT4 _clOut; _clOut.rgb = _pipe.fW; _clOut.w = _color0.w; _pipe.Output( "color3", "COLOR3", _clOut ); } else if ( slcGetMRT3() == 2 ) { SLT_HALF4 _clOut; _clOut.rgb = slGetNormalizedDepth( _pipe ); _clOut.w = _color0.w; _pipe.Output( "color3", "COLOR3", _clOut ); } else if ( slcGetMRT3() == 3 ) { SLT_COLOR4 _clOut; _clOut.xyz = slFloat2RGB(slGetNormalizedDepth( _pipe )); _clOut.w = _color0.w; _pipe.Output( "color3", "COLOR3", _clOut ); } else if ( slcGetMRT3() == 4 ) { SLT_FLOAT4 _clOut; _clOut.xyz = (SLT_FLOAT3)( _pipe.fZ / _pipe.fW ); _clOut.w = _color0.w; _pipe.Output( "color3", "COLOR3", _clOut ); } else if ( slcGetMRT3() == 5 ) { SLT_COLOR4 _clOut = SLT_COLOR4( slFloat2RGB(_pipe.fZ / _pipe.fW), _color0.w ); _pipe.Output( "color3", "COLOR3", _clOut ); } else if ( slcGetMRT3() == 6 ) { SLT_COLOR4 _clOut; _clOut.xyz = _color0.xyz - 1.0f; _clOut.w = _color0.w; _pipe.Output( "color3", "COLOR3", _clOut ); } else if ( slcGetMRT3() == 8 ) { SLT_COLOR4 _clOut; _clOut.xyz = vRGB.xyz; _clOut.w = _color0.w; _pipe.Output( "color3", "COLOR3", _clOut ); } else if ( slcGetMRT3() == 10 ) { SLT_COLOR4 _clOut; _clOut.rgb = slVector2Color( slGetViewNormal( _pipe ) ); _clOut.w = _color0.w; _pipe.Output( "color3", "COLOR3", _clOut ); } else if ( slcGetMRT3() == 9 ) { SLT_FLOAT4 _clOut; _clOut.rgb = slGetViewNormal( _pipe ); _clOut.w = _pipe.fW; _pipe.Output( "color3", "COLOR3", _clOut ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccParallaxMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTextureBlend.fx" #line 61 "D://KTGL/shaderlib2/shader/include/../func/slAccParallaxMap.fx" void slShiftTextureCoords(inout PIPE _pipe, SLT_TEXCOORD2 _OffSet) { if (sloGetParallaxOffsetTarget() == 1) { if (1 < slpGetPSTexCoordNum()) { _pipe.avTex[0].xy += _OffSet; } else if (slpGetPSTexCoordNum() == 1) { _pipe.vTexLast += _OffSet; } } else { if (slcIsEnabledBindingTexCoords()) { if (1 < slpGetPSTexCoordNum()) { _pipe.avTex[0] += _OffSet.xyyx; if (2 < slpGetPSTexCoordNum()) { if (3 < slpGetPSTexCoordNum()) { _pipe.avTex[1] += _OffSet.xyyx; if (4 < slpGetPSTexCoordNum()) { if (5 < slpGetPSTexCoordNum()) { _pipe.avTex[2] += _OffSet.xyyx; if (6 < slpGetPSTexCoordNum()) { if (7 < slpGetPSTexCoordNum()) { _pipe.avTex[3] += _OffSet.xyyx; } } } } } } } if (slpGetPSTexCoordNum() != 2*(slpGetPSTexCoordNum()/2)) { _pipe.vTexLast += _OffSet; } } else { if (1 < slpGetPSTexCoordNum()) { _pipe.avTex[0] += _OffSet; if (2 < slpGetPSTexCoordNum()) { _pipe.avTex[1] += _OffSet; if (3 < slpGetPSTexCoordNum()) { _pipe.avTex[2] += _OffSet; if (4 < slpGetPSTexCoordNum()) { _pipe.avTex[3] += _OffSet; if (5 < slpGetPSTexCoordNum()) { _pipe.avTex[4] += _OffSet; if (6 < slpGetPSTexCoordNum()) { _pipe.avTex[5] += _OffSet; if (7 < slpGetPSTexCoordNum()) { _pipe.avTex[6] += _OffSet; } } } } } } } } } } #line 127 void slApplyParallaxExtraSample( inout SLT_COLOR _fHeight, inout SLT_COLOR _fShift, SLT_TEXCOORD2 _vTex, SLT_DIR3 _vMove, uniform SLT_SAMPLER_2D _sampler ) { SLT_TEXCOORD2 _texSample = _vTex + _vMove.xy * _fShift; if (sloGetParallaxOffsetLimitMethod() == 2) { _fHeight = h4tex2D(_sampler, _texSample).a - _fHeight; _fShift += _fHeight * vPlx.y + vPlx.x; } else { _fHeight = (_fHeight + h4tex2D(_sampler, _texSample).a) * 0.5f; _fShift = _fHeight * vPlx.y + vPlx.x; } } SLT_COLOR slGetParallaxShift( SLT_TEXCOORD2 _vTex, SLT_DIR3 _vMove, uniform SLT_SAMPLER_2D _sampler ) { SLT_COLOR _fHeight = h4tex2D( _sampler, _vTex ).a; SLT_COLOR _fShift = vPlx.y * _fHeight + vPlx.x; if (0 < sloGetParallaxExtraSampleNum()) { slApplyParallaxExtraSample( _fHeight, _fShift, _vTex, _vMove, _sampler ); } if (1 < sloGetParallaxExtraSampleNum()) { slApplyParallaxExtraSample( _fHeight, _fShift, _vTex, _vMove, _sampler ); } if (2 < sloGetParallaxExtraSampleNum()) { slApplyParallaxExtraSample( _fHeight, _fShift, _vTex, _vMove, _sampler ); } return _fShift; } #line 173 void slSetUpParallaxMappingPixel(inout PIPE _pipe) { if (slcIsParallaxMapping()) { SLT_TEXCOORD2 _TexCoords = slGetNormalMapTexCoord( _pipe ); SLT_DIR3 _vMove = slGetLightingEyeDirection( _pipe ); _vMove.y = -_vMove.y; if (sloGetParallaxOffsetLimitMethod() == 0) { _vMove.xy /= _vMove.z; } SLT_COLOR _fShift = slGetParallaxShift( _TexCoords, _vMove, sNMap ); slShiftTextureCoords(_pipe, _vMove.xy * _fShift ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccParallaxMapBlend.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccParallaxMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccPatternMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccPixelLighting.fx" #line 28 "D://KTGL/shaderlib2/shader/include/../func/slAccPatternMap.fx" typedef SLT_SAMPLER_2D SLT_PATTERNMAP_SAMPLER; #line 36 SLT_PATTERNMAP_SAMPLER sLit < string Description = "Pattern Lighting Map"; int Usage = 7; int Sampler = 64; >; #line 51 SLT_POINT4x4 mW2Pt ; #line 60 SLT_PARAM_FLOAT fPtn ; #line 92 SLT_POINT4 slGetPatternMapSourcePosition(PIPE _pipe) { return slGetWorldPosition( _pipe ); } #line 113 void slOutputPatternMapParameters(inout PIPE _pipe) { SLT_TEXCOORD4 _vPatternPos; if (sloPatternMapForIsSimpleLightMap()) { SLT_POINT4 _vPos = slGetPatternMapSourcePosition( _pipe ); _vPatternPos.x = _vPos.x * mW2Pt._11 + mW2Pt._41; _vPatternPos.y = _vPos.z * mW2Pt._32 + mW2Pt._42; } else { _vPatternPos = mul( slGetPatternMapSourcePosition( _pipe ), mW2Pt ); } if (sloGetPatternMapType() == 0) { _pipe.Insert( "SLT_TEXCOORD2", "vPatternPos" ); _pipe.vPatternPos = (SLT_TEXCOORD2)_vPatternPos; } else if (sloGetPatternMapType() == 1) { _pipe.Insert( "SLT_TEXCOORD3", "vPatternPos" ); _pipe.vPatternPos = (SLT_TEXCOORD3)_vPatternPos; } else if (sloGetPatternMapType() == 2) { _pipe.Insert( "SLT_TEXCOORD4", "vPatternPos" ); _pipe.vPatternPos = _vPatternPos; } else if (sloGetPatternMapType() == 3 || sloGetPatternMapType() == 4) { _pipe.Insert( "SLT_TEXCOORD3", "vPatternPos" ); _pipe.vPatternPos = (SLT_TEXCOORD3)_vPatternPos; } } #line 153 void slOutputPatternMapVertex(inout PIPE _pipe) { if (slcIsPatternMapping()) { if (sloIsPatternMapTransformPerformedInVS()) { slOutputPatternMapParameters( _pipe ); } } } #line 178 void slApplyMainLightColor(inout SLT_COLOR3 _color, PIPE _pipe) { if (slcIsPatternMapping() && _pipe.IsExisting( "cPattern" ) ) { _color *= _pipe.cPattern.rgb; } } #line 204 void slSetUpPatternMapPixel( inout PIPE _pipe ) { if (slcIsPatternMapping()) { if (!sloIsPatternMapTransformPerformedInVS()) { slOutputPatternMapParameters( _pipe ); } SLT_COLOR4 _clPatternMap; if (sloGetPatternMapType() == 0 || sloGetPatternMapType() == 1) { _clPatternMap = h4tex2D( sLit, (SLT_TEXCOORD2)_pipe.vPatternPos ); } else if (sloGetPatternMapType() == 2) { _clPatternMap = slColorTex2DProj( sLit, _pipe.vPatternPos ); } else if (sloGetPatternMapType() == 3 || sloGetPatternMapType() == 4) { _clPatternMap = h4texCUBE( sLit, _pipe.vPatternPos ); } if (sloIsPatternMapFadeEnabled()) { _clPatternMap = lerp( SLT_COLOR4(1.0f, 1.0f, 1.0f, 1.0f), _clPatternMap, (SLT_COLOR)fPtn ); } if (sloGetPatternMapType() == 1) { _clPatternMap = (( _pipe.vPatternPos.z > 0 ) ? _clPatternMap : 1); } _pipe.Insert( "cPattern", _clPatternMap ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccPixelLighting.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccScaleColor.fx" #line 28 void slApplyScaleColor(inout SLT_COLOR4 _color0) { if (slcIsScaleColorAccessory()) { _color0.rgb *= 1.0f; } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccTextureAnimation.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccEmissiveMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" #line 16 "D://KTGL/shaderlib2/shader/include/../func/slAccTextureAnimation.fx" SLT_BOOL slIsEnabledAnimationShaderUsageTexCoord(uniform SLT_INT _nIndex) { if ( slcIsTextureAnimationAll() && _nIndex - 4 < slpGetShaderTexCoordOffset() && slpGetShaderTexCoordOffset() <= _nIndex ) { return true; } else if ( slcIsShaderUsageTextureAnimation(0) && _nIndex == slpGetShaderTexCoordOffset() ) { return true; } else if ( slcIsShaderUsageTextureAnimation(1) && _nIndex - 1 == slpGetShaderTexCoordOffset() ) { return true; } else if ( slcIsShaderUsageTextureAnimation(2) && _nIndex - 2 == slpGetShaderTexCoordOffset() ) { return true; } else if ( slcIsShaderUsageTextureAnimation(3) && _nIndex - 3 == slpGetShaderTexCoordOffset() ) { return true; } return false; } #line 40 SLT_BOOL slIsEnabledAnimationNormalMapTexCoord(uniform SLT_INT _nIndex) { if ( slcIsTextureAnimationAll() || slcIsNormalMapTextureAnimation() ) { if ( sloGetNormalMapTexCoordType() == 0 && _nIndex == 0 ) { return true; } else if ( sloGetNormalMapTexCoordType() == 1 ) { if ( _nIndex == slGetNormalMapTexCoordIndex() + slpGetShaderTexCoordOffset() ) { return true; } } } return false; } #line 66 SLT_BOOL slIsEnabledAnimationEmissiveMapTexCoord(uniform SLT_INT _nIndex) { if ( slcIsTextureAnimationAll() || slcIsEmissiveMapTextureAnimation() ) { if ( sloGetEmissiveMapTexCoordType() == 0 && _nIndex == 0 ) { return true; } else if ( sloGetEmissiveMapTexCoordType() == 1 ) { if ( _nIndex == slpGetEmissiveMapTexCoordIndex() + slpGetShaderTexCoordOffset() ) { return true; } } } return false; } #line 93 SLT_INT slIsEnabledAnimationTexCoord(uniform SLT_INT _nIndex) { if ( _nIndex < slpGetPSTexCoordNum() ) { if ( slcIsTextureAnimationAll() ) { return 1; } else if ( slcIsColorSurfaceTextureAnimation( _nIndex ) && _nIndex < 4 ) { return 1; } else if ( slIsEnabledAnimationShaderUsageTexCoord( _nIndex ) ) { return 1; } else if ( slIsEnabledAnimationNormalMapTexCoord( _nIndex ) ) { return 1; } else if ( slIsEnabledAnimationEmissiveMapTexCoord( _nIndex ) ) { return 1; } else { return 0; } } else { return 0; } } #line 123 SLT_INT slGetAnimationTexCoordNum() { return slIsEnabledAnimationTexCoord(0) + slIsEnabledAnimationTexCoord(1) + slIsEnabledAnimationTexCoord(2) + slIsEnabledAnimationTexCoord(3) + slIsEnabledAnimationTexCoord(4) + slIsEnabledAnimationTexCoord(5) + slIsEnabledAnimationTexCoord(6) + slIsEnabledAnimationTexCoord(7); } #line 144 SLT_BOOL slCheckTextureAnimationSettingError() { if ( slcIsColorSurfaceTextureAnimation(0) && slcGetMaxTexStageCount() < 1 ) { Error( "Invalid [TexAnimationColor0] Accessory Setting: TextureBlendNum < 1" ); } if ( slcIsColorSurfaceTextureAnimation(1) && slcGetMaxTexStageCount() < 2 ) { Error( "Invalid [TexAnimationColor0] Accessory Setting: TextureBlendNum < 2" ); } if ( slcIsColorSurfaceTextureAnimation(2) && slcGetMaxTexStageCount() < 3 ) { Error( "Invalid [TexAnimationColor0] Accessory Setting: TextureBlendNum < 3" ); } if ( slcIsColorSurfaceTextureAnimation(3) && slcGetMaxTexStageCount() < 4 ) { Error( "Invalid [TexAnimationColor0] Accessory Setting: TextureBlendNum < 4" ); } if ( slcIsShaderUsageTextureAnimation(0) && 0 < 1 ) { Error( "Invalid [TexAnimationShader0] Accessory Setting: ShaderTextureNum < 1" ); } if ( slcIsShaderUsageTextureAnimation(1) && 0 < 2 ) { Error( "Invalid [TexAnimationShader1] Accessory Setting: ShaderTextureNum < 2" ); } if ( slcIsShaderUsageTextureAnimation(2) && 0 < 3 ) { Error( "Invalid [TexAnimationShader2] Accessory Setting: ShaderTextureNum < 3" ); } if ( slcIsShaderUsageTextureAnimation(3) && 0 < 4 ) { Error( "Invalid [TexAnimationShader3] Accessory Setting: ShaderTextureNum < 4" ); } if ( slcIsNormalMapTextureAnimation() ) { if ( !slcNormalMapping() ) { Error( "Invalid [TexAnimationNormalMap] Accessory Setting: [NormalMap] Accessory is not defined" ); } if ( slcIsColorSurfaceTextureAnimation(0) && sloGetNormalMapTexCoordType() == 0 ) { Error( "Invalid [TexAnimationNormalMap] Accessory Setting: TexCoord Stage0 Animation has already defined by [TexAnimationColor0]" ); } } if ( slcIsEmissiveMapTextureAnimation() ) { if ( !slcIsEmissiveMapping() ) { Error( "Invalid [TexAnimationEmissiveMap] Accessory Setting: [EmiMap] Accessory is not defined" ); } if ( slcIsColorSurfaceTextureAnimation(0) && sloGetEmissiveMapTexCoordType() == 0 ) { Error( "Invalid [TexAnimationEmissiveMap] Accessory Setting: TexCoord Stage0 Animation has already defined by [TexAnimationColor0]" ); } } return slcIsTextureAnimation(); } #line 489 SLT_PARAM_FLOAT4 txTrs01; #line 496 SLT_PARAM_FLOAT4 txTrs23; #line 503 SLT_PARAM_FLOAT4 txTrs45; #line 510 SLT_PARAM_FLOAT4 txTrs67; #line 538 void slTranslateTexCoordByIndex(inout PIPE _pipe, SLT_TEXCOORD4 _vTrans, uniform SLT_INT _n) { if ( slcIsEnabledBindingTexCoords() ) { if ( slIsEnabledAnimationTexCoord(_n) && ( _n+1 == slpGetPSTexCoordNum() ) ) { _pipe.vTexLast += _vTrans.xy; } else if ( slIsEnabledAnimationTexCoord(_n) && slIsEnabledAnimationTexCoord(_n+1) ) { _pipe.avTex[_n/2] += _vTrans.xywz; } else if ( slIsEnabledAnimationTexCoord(_n) ) { _pipe.avTex[_n/2].xy += _vTrans.xy; } else if ( slIsEnabledAnimationTexCoord(_n+1) ) { _pipe.avTex[_n/2].zw += _vTrans.wz; } } else { if ( slIsEnabledAnimationTexCoord(_n) ) { _pipe.avTex[_n] += _vTrans.xy; } if ( slIsEnabledAnimationTexCoord(_n+1) ) { _pipe.avTex[_n+1] += _vTrans.zw; } } } #line 576 void slTranslateTexCoord(inout PIPE _pipe) { if ( slCheckTextureAnimationSettingError() ) { slTranslateTexCoordByIndex( _pipe, txTrs01, 0 ); slTranslateTexCoordByIndex( _pipe, txTrs23, 2 ); slTranslateTexCoordByIndex( _pipe, txTrs45, 4 ); slTranslateTexCoordByIndex( _pipe, txTrs67, 6 ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccAlphaTest.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" #line 29 "D://KTGL/shaderlib2/shader/include/../func/slAccAlphaTest.fx" SLT_PARAM_FLOAT vATest; #line 48 SLT_COLOR slGetStage0AlphaTestThreshold() { if (slcIsEnabledStage0AlphaTest()) { return slcGetStage0AlphaTestThreshold(); } else { return vATest; } } #line 76 void slSetUpAlphaTestPixel( inout PIPE _pipe ) { if (slcIsAlphaTest()) { if (sloGetAlphaTestSource() == 0 && 0 < slcGetMaxTexStageCount()) { _pipe.Insert( "SLT_COLOR4", "clStage0Color" ); _pipe.Insert( "fStage0Specular", (SLT_COLOR1)1.0 ); if (slcIsTexStageCountBranchEnabled()) { if ( 0.5f < nStageNum ) { _pipe.clStage0Color = slSampleStage0Tex( _pipe ); if (slpSpecularMapMayBeUsed()) { _pipe.fStage0Specular = _slGetStage0Specular(_pipe.clStage0Color.a); } _pipe.clStage0Color.a = _slGetStage0Alpha( _pipe.clStage0Color.a ); } else { _pipe.clStage0Color = slcGetTexMultiplier(); } } else { _pipe.clStage0Color = slSampleStage0Tex( _pipe ); if (slpSpecularMapMayBeUsed()) { _pipe.fStage0Specular = _slGetStage0Specular(_pipe.clStage0Color.a); } _pipe.clStage0Color.a = _slGetStage0Alpha( _pipe.clStage0Color.a ); } clip( _pipe.clStage0Color.a - slGetStage0AlphaTestThreshold() ); } } } void slGetStage0ColorAndSpecular( out SLT_COLOR4 _color, out SLT_COLOR1 _fSpecular, PIPE _pipe ) { if ( _pipe.IsExisting("clStage0Color") ) { _color = _pipe.clStage0Color; if (slpSpecularMapMayBeUsed()) { _fSpecular = _pipe.fStage0Specular; } else { _fSpecular = 1.0f; } } else { _color = slSampleStage0Tex( _pipe ); _fSpecular = _slGetStage0Specular(_color.a); _color.a = _slGetStage0Alpha( _color.a ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccTextureBlur.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFunction.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccAlphaTest.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTextureBlend.fx" #line 21 "D://KTGL/shaderlib2/shader/include/../func/slAccTextureBlur.fx" SLT_PARAM_FLOAT4 mTexBlur[3]; SLT_PARAM_FLOAT2 vTexBlur; #line 58 void slOutputTextureBlurVertex(inout PIPE _pipe) { if (slcIsTextureBlurEnabled()) { SLT_VECTOR3 _vTexBlur0; _vTexBlur0.xy = _pipe.vProjPos.xy * vTexBlur; _vTexBlur0.z = _pipe.vProjPos.w; SLT_VECTOR3 _vTexBlur1; _vTexBlur1.x = dot(mTexBlur[0], _pipe.vProjPos); _vTexBlur1.y = dot(mTexBlur[1], _pipe.vProjPos); _vTexBlur1.z = dot(mTexBlur[2], _pipe.vProjPos); _pipe.Insert( "vTexBlur0", _vTexBlur0 ); _pipe.Insert( "vTexBlur1", _vTexBlur1 ); } } #line 86 void slSetUpTextureBlurPixel(inout PIPE _pipe) { if (slcIsTextureBlurEnabled()) { SLT_VECTOR2 _vec = _pipe.vTexBlur0.xy/_pipe.vTexBlur0.z - _pipe.vTexBlur1.xy/_pipe.vTexBlur1.z; _pipe.Insert( "vTexBlur", _vec ); } } SLT_COLOR4 slGetBlurryTexture(SLT_SAMPLER_2D _s, SLT_TEXCOORD2 _uv, SLT_VECTOR2 _vMove) { SLT_COLOR4 _c; SLT_TEXCOORD2 _dx = ddx(_uv); SLT_TEXCOORD2 _dy = ddy(_uv); SLT_TEXCOORD2 _dx2; SLT_TEXCOORD2 _dy2; if (0) { SLT_FLOAT _moveX = dot(_dx, _vMove)*rsqrt(dot(_dx, _dx)); SLT_FLOAT _moveY = dot(_dy, _vMove)*rsqrt(dot(_dy, _dy)); _dx2 = _dx + _moveX*_dx; _dy2 = _dy + _moveY*_dy; _c = SL_COLOR_TEX2D_GRAD(_s, _uv, _dx2, _dy2); } else { _c = h4tex2D(_s, _uv); } if (1 < 2) { _dx *= _vMove.x; _dx += _dy * _vMove.y; for ( int i = 0; i < 2-1; ++i ) { _uv += _dx; if (0) { _c += SL_COLOR_TEX2D_GRAD(_s, _uv, _dx2, _dy2); } else { _c += h4tex2D(_s, _uv); } } _c /= 2; } return _c; } #line 143 void slApplyBlurrySpecularMap( inout PIPE _pipe ) { if (slcIsSpecularMapStageEnabled()) { SLT_COLOR4 _clSpecularMap = slGetBlurryTexture(sSpMap, slGetTexCoord(_pipe, slcGetSpecularMapTexCoordIndex()), _pipe.vTexBlur); if (slcIsSpecularMapBranchEnabled()) { _pipe.clSpecular *= (_clSpecularMap.a * vSpMap.x + vSpMap.w); } else { _pipe.clSpecular *= _clSpecularMap.a; } } } #line 163 SLT_COLOR4 slGetBlendedBlurryTexture( PIPE _pipe ) { if (0 == slcGetMaxTexStageCount()) { return slcGetTexMultiplier(); } SLT_COLOR4 _clCurrent; SLT_COLOR1 _fSpecular; if (slcIsTexStageCountBranchEnabled()) { if ( 0.0 < nStageNum ) { slGetStage0ColorAndSpecular( _clCurrent, _fSpecular, _pipe ); if (1 < slcGetMaxTexStageCount()) { _clCurrent = slcGetTexMultiplier()*_slBlendTextures( _pipe, _clCurrent ); } else { _clCurrent *= slcGetTexMultiplier(); } } else { _clCurrent = slcGetTexMultiplier(); } } else { slGetStage0ColorAndSpecular( _clCurrent, _fSpecular, _pipe ); if (1 < slcGetMaxTexStageCount()) { _clCurrent = slcGetTexMultiplier()*_slBlendTextures( _pipe, _clCurrent ); } else { _clCurrent *= slcGetTexMultiplier(); } } return _clCurrent; } #line 206 SLT_COLOR4 slGetBlendedBlurryTextureWithSpecularMap( inout PIPE _pipe ) { SLT_COLOR4 _clCurrent; SLT_COLOR1 _fSpecular; if (slcIsSpecularMapStageEnabled()) { slApplyBlurrySpecularMap( _pipe ); } if (slcIsTexStageCountBranchEnabled()) { if ( 0.5f < nStageNum ) { slGetStage0ColorAndSpecular( _clCurrent, _fSpecular, _pipe ); _pipe.clSpecular *= (SLT_COLOR3)_fSpecular; if (1 < slcGetMaxTexStageCount()) { _clCurrent = slcGetTexMultiplier()*_slBlendTextures( _pipe, _clCurrent ); } else { _clCurrent *= slcGetTexMultiplier(); } } else { _clCurrent = slcGetTexMultiplier(); } } else { slGetStage0ColorAndSpecular( _clCurrent, _fSpecular, _pipe ); _pipe.clSpecular *= (SLT_COLOR3)_fSpecular; if (1 < slcGetMaxTexStageCount()) { _clCurrent = slcGetTexMultiplier()*_slBlendTextures( _pipe, _clCurrent ); } else { _clCurrent *= slcGetTexMultiplier(); } } return _clCurrent; } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccToneMap.fx" #line 24 SLT_SAMPLER_2D sTone < string Description = "Tone Map"; int Usage = 13; int Sampler = 64; >; #line 36 SLT_SAMPLER_2D sInverseTone < string Description = "Inverse Tone Map"; int Usage = 14; int Sampler = 64; >; #line 48 SLT_SAMPLER_2D sExposure < string Description = "Exposure Texture"; int Usage = 15; int Sampler = 64; >; #line 68 SLT_PARAM_FLOAT2 vToneMapParams; #line 78 SLT_PARAM_FLOAT4 vExposureParams; #line 90 SLT_PARAM_FLOAT4 vExposureRange; #line 103 void _slApplyExposure( inout SLT_COLOR4 _color ) { if (0 == 1 || 0 == 2) { _color.rgb *= vExposureParams.y; } else if (0 == 3) { _color.rgb *= clamp(vExposureParams.x / (h4tex2D(sExposure, SLT_TEXCOORD2(0.5f, 0.5f)).r + 0.00001f), vExposureRange.x, vExposureRange.y); } else if (0 == 4) { _color.rgb *= h4tex2D(sExposure, SLT_TEXCOORD2(0.5f, 0.5f)).r; } } void _slApplyInverseExposure( inout SLT_COLOR4 _color ) { if (0 == 1 || 0 == 2) { _color.rgb *= vExposureParams.w; } else if (0 == 3) { _color.rgb *= clamp(vExposureParams.z * (h4tex2D(sExposure, SLT_TEXCOORD2(0.5f, 0.5f)).r + 0.00001f), vExposureRange.w, vExposureRange.z); } else if (0 == 4) { _color.rgb /= h4tex2D(sExposure, SLT_TEXCOORD2(0.5f, 0.5f)).r; } } SLT_COLOR _slCalcLuminance( SLT_COLOR4 _color ) { return dot(_color.rgb, SLT_COLOR3(0.29891f, 0.58661f, 0.11448f)); } #line 138 void slCalcCustomToneMapSampling( inout SLT_FLOAT3 _U ){} #line 151 void slCalcCustomInverseToneMapSampling( inout SLT_FLOAT3 _U ){} #line 163 void _slApplyToneMap( inout SLT_COLOR4 _color ) { if (0 == 1) { if (0 == 1) { _color.rgb *= vToneMapParams.x; } else if (0 == 2) { SLT_FLOAT fY = _slCalcLuminance(_color); _color.rgb /= (fY > 0.0f ? fY : 1.0f); _color.rgb *= log2(fY + 1.0f) * vToneMapParams.x; } else if (0 == 3) { SLT_FLOAT fY = _slCalcLuminance(_color); _color.rgb *= (fY * vToneMapParams.x + 1.0f) / (fY + 1.0f); } else if (0 == 4) { SLT_FLOAT fY = _slCalcLuminance(_color); SLT_FLOAT fU = saturate(fY * vToneMapParams.x); fU = slCalcCustomToneMapSampling( fU ); _color.rgb /= (fY > 0.0f ? fY : 1.0f); _color.rgb *= h4tex2D(sTone, SLT_TEXCOORD2(fU, 0.5f)).r; } } else { if (0 == 1) { _color.rgb *= vToneMapParams.x; } else if (0 == 2) { _color.rgb = log2(_color.rgb + 1.0f) * vToneMapParams.x; } else if (0 == 3) { _color.rgb *= (_color.rgb * vToneMapParams.x + 1.0f) / (_color.rgb + 1.0f); } else if (0 == 4) { SLT_FLOAT3 vU = saturate(_color.rgb * vToneMapParams.x); vU = slCalcCustomToneMapSampling( vU ); _color.r = h4tex2D(sTone, SLT_TEXCOORD2(vU.r, 0.5f)).r; _color.g = h4tex2D(sTone, SLT_TEXCOORD2(vU.g, 0.5f)).r; _color.b = h4tex2D(sTone, SLT_TEXCOORD2(vU.b, 0.5f)).r; } } } void _slApplyInverseToneMap( inout SLT_COLOR4 _color ) { if (0 == 1) { if (0 == 1) { _color.rgb *= vToneMapParams.y; } else if (0 == 2) { SLT_FLOAT fY = _slCalcLuminance(_color); _color.rgb /= (fY > 0.0f ? fY : 1.0f); _color.rgb *= (pow(SLT_FLOAT3(vToneMapParams.y, vToneMapParams.y, vToneMapParams.y), fY) - 1.0f); } else if (0 == 3) { SLT_FLOAT fY = _slCalcLuminance(_color); SLT_FLOAT fTemp = fY - 1.0f; _color.rgb /= (fY > 0.0f ? fY : 1.0f); _color.rgb *= (fTemp + sqrt(fTemp * fTemp + fY * 2.0f / vToneMapParams.y)); } else if (0 == 4) { SLT_FLOAT fY = saturate(_slCalcLuminance(_color)); fY = slCalcCustomInverseToneMapSampling( fY ); _color.rgb /= (fY > 0.0f ? fY : 1.0f); _color.rgb *= h4tex2D(sInverseTone, SLT_TEXCOORD2(fY, 0.5f)).r; } } else { if (0 == 1) { _color.rgb *= vToneMapParams.y; } else if (0 == 2) { _color.rgb = pow(SLT_FLOAT3(vToneMapParams.y, vToneMapParams.y, vToneMapParams.y), _color.rgb) - 1.0f; } else if (0 == 3) { SLT_COLOR3 vTemp = _color.rgb - SLT_COLOR3(1.0f, 1.0f, 1.0f); _color.rgb = (vTemp + sqrt(vTemp * vTemp + _color.rgb * 2.0f / vToneMapParams.y)); } else if (0 == 4) { SLT_FLOAT3 vU = saturate(_color.rgb); vU = slCalcCustomInverseToneMapSampling( vU ); _color.r = h4tex2D(sInverseTone, SLT_TEXCOORD2(vU.r, 0.5f)).r; _color.g = h4tex2D(sInverseTone, SLT_TEXCOORD2(vU.g, 0.5f)).r; _color.b = h4tex2D(sInverseTone, SLT_TEXCOORD2(vU.b, 0.5f)).r; } } } #line 246 void slApplyToneMapDefault( inout SLT_COLOR4 _color ) { if ( slcToneMapping() ) { _slApplyExposure(_color); _slApplyToneMap(_color); } } #line 257 void slApplyInverseToneMapDefault( inout SLT_COLOR4 _color ) { if ( slcInverseToneMapping() ) { _slApplyInverseToneMap(_color); _slApplyInverseExposure(_color); } } #line 273 void slApplyToneMap( inout SLT_COLOR4 _color ) { slApplyToneMapDefault( _color ); } #line 288 void slApplyInverseToneMap( inout SLT_COLOR4 _color ) { slApplyInverseToneMapDefault( _color ); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccRamp.fx" #line 85 SLT_COLOR3 slConvRGB2YCrCb( in SLT_COLOR3 _rgb ) { static const SLT_COLOR3 clRGB2Y = SLT_COLOR3( 0.299f, 0.587f, 0.114f ); static const SLT_COLOR3 clRGB2Cr = SLT_COLOR3( 0.500f, -0.419f, -0.081f ); static const SLT_COLOR3 clRGB2Cb = SLT_COLOR3( -0.169f, -0.332f, 0.500f ); return SLT_COLOR3( dot( clRGB2Y, _rgb ), dot( clRGB2Cr, _rgb ), dot( clRGB2Cb, _rgb ) ); } #line 97 SLT_COLOR3 slConvYCrCb2RGB( in SLT_COLOR3 _ycrcb ) { static const SLT_COLOR3 clYCrCb2R = SLT_COLOR3( 1.0f, 1.402f, 0.0f ); static const SLT_COLOR3 clYCrCb2G = SLT_COLOR3( 1.0f, -0.714f, -0.344f ); static const SLT_COLOR3 clYCrCb2B = SLT_COLOR3( 1.0f, 0.0f, 1.772f ); return SLT_COLOR3( dot( clYCrCb2R, _ycrcb ), dot( clYCrCb2G, _ycrcb ), dot( clYCrCb2B, _ycrcb ) ); } #line 113 SLT_COLOR3 slApplyRamp2Diffuse( in SLT_COLOR3 _diffuse ) { SLT_COLOR3 YCrCb = slConvRGB2YCrCb( _diffuse ); YCrCb.x = h4tex2D( sRamp, SLT_TEXCOORD2( YCrCb.x, 0.0f ) ).r; return slConvYCrCb2RGB( YCrCb ); } #line 127 SLT_COLOR3 slApplyRamp2Specular( in SLT_COLOR3 _specular ) { SLT_COLOR3 YCrCb = slConvRGB2YCrCb( _specular ); YCrCb.x = spScale.y * h4tex2D( sRamp, SLT_TEXCOORD2( YCrCb.x * spScale.x, 0.0f ) ).r; return slConvYCrCb2RGB( YCrCb ); } #line 145 void slApplyRampTexture( inout PIPE _pipe ) { if (slcIsRampAccessory()) { _pipe.clDiffuse.rgb = slApplyRamp2Diffuse( _pipe.clDiffuse.rgb ); if (_pipe.IsExisting( "clSpecular" )) { _pipe.clSpecular.rgb = slApplyRamp2Specular( _pipe.clSpecular.rgb ); } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccRim.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slLighting.fx" #line 123 "D://KTGL/shaderlib2/shader/include/../func/slAccRim.fx" SLT_INT sloGetRimLightingTarget() { return 0; } #line 135 bool sloIsAdditiveRim() { return 0; } #line 147 bool sloIsRimIndependentFromShadow() { return 0; } #line 161 SLT_COLOR1 slGetRimFresnel( SLT_DIR3 _vcNormal, SLT_DIR3 _vcEyeDir ) { SLT_COLOR1 _fFresnel = (SLT_COLOR1)(1.0 - saturate( dot( _vcNormal, slNormalizeVector(_vcEyeDir) ) )); _fFresnel = pow(_fFresnel, cRim.w); return cRim.r*_fFresnel; } #line 177 SLT_COLOR3 slGetColorRimFresnel( SLT_DIR3 _vcNormal, SLT_DIR3 _vcEyeDir ) { SLT_COLOR1 _fFresnel = (SLT_COLOR1)(1.0 - saturate( dot( _vcNormal, slNormalizeVector(_vcEyeDir) ) )); _fFresnel = pow(_fFresnel, cRim.w); return cRim.rgb*_fFresnel; } #line 194 SLT_COLOR1 slGetRim( SLT_COLOR1 _fFresnel, SLT_DIR3 _vcLightDir, SLT_DIR3 _vcEyeDir ) { return _fFresnel * (SLT_COLOR1)(saturate( dot( _vcLightDir, _vcEyeDir ) )); } #line 209 SLT_COLOR1 slApplyRim( SLT_COLOR1 _diffuse, SLT_COLOR1 _fFresnel, SLT_DIR3 _vcLightDir, SLT_DIR3 _vcEyeDir ) { return saturate( _diffuse + slGetRim( _fFresnel, _vcLightDir, _vcEyeDir ) ); } #line 227 void slApplyDiffuseRimTerm( inout PIPE _pipe, inout SLT_COLOR _fDot, SLT_COLOR3 _clLightColor, SLT_DIR3 _vcLightDir, uniform bool _bMainLight ) { if (!sloIsAdditiveRim()) { SLT_COLOR1 _fRim = slApplyRim( _fDot, _pipe.fRimFresnel, _vcLightDir, slGetLightingEyeDirection(_pipe) ); if (sloIsRimIndependentFromShadow() && slcIsShadowCastedForAllLight()) { _pipe.clRim += _clLightColor * saturate(_fRim-_fDot); } else if (sloIsRimIndependentFromShadow() && slcShadowMayBeCasted() && _bMainLight) { _pipe.clDiffuse.rgb += _clLightColor * saturate(_fRim-_fDot); } else { _fDot = _fRim; } } } #line 258 void slApplySpecularRimTerm( inout PIPE _pipe, SLT_COLOR _fDot, SLT_COLOR3 _clLightColor, SLT_DIR3 _vcLightDir, uniform bool _bMainLight ) { if (sloIsAdditiveRim()) { SLT_COLOR1 fRim = slApplyRim( _fDot, _pipe.fRimFresnel, _vcLightDir, slGetLightingEyeDirection(_pipe) ); if (_bMainLight && _pipe.IsExisting("clMainRim")) { _pipe.clMainRim += _clLightColor * saturate(fRim-_fDot); } else { _pipe.clRim += _clLightColor * saturate(fRim-_fDot); } } } #line 280 bool slIsRimLightEnabled(uniform SLT_BOOL _bMainLight) { if (slcIsRimLighting()) { if (sloGetRimLightingTarget() == 0) { return true; } if (sloGetRimLightingTarget() == 1) { return _bMainLight; } else { return false; } } else { return false; } } #line 308 void slApplyRimLighting( inout PIPE _pipe, SLT_COLOR3 _clLightColor, SLT_DIR3 _vcLightDir, uniform bool _bMainLight, uniform bool _bDiffuse, uniform bool _bSpecular ) { SLT_BOOL _bRimLighting = slIsRimLightEnabled( _bMainLight ); SLT_COLOR3 _clDiffuse; SLT_COLOR3 _clSpecular; SLT_DIR3 _vEyeDir = slGetLightingEyeDirection(_pipe); SLT_DIR3 _vNormal = slGetLightingNormal(_pipe); SLT_DIR1 _fDot = dot( _vNormal, -_vcLightDir ); SLT_DIR3 _vcHalf = slNormalizeDirection( _vEyeDir - _vcLightDir ); if (_bDiffuse && _bSpecular) { SLT_COLOR3 _result = slGetLightingCoeffs( _fDot, _vNormal, _vEyeDir, _vcHalf, _pipe.fSpecularDecay ); if (_bRimLighting) { slApplyDiffuseRimTerm( _pipe, _result.y, _clLightColor, _vcLightDir, _bMainLight ); } _clDiffuse = _clLightColor * _result.y; _clSpecular = _clLightColor * _result.z; } else if (_bSpecular) { _clSpecular = _clLightColor * slGetSpecularCoeff( _fDot, _vNormal, _vEyeDir, _vcHalf, _pipe.fSpecularDecay ); } else if (_bDiffuse) { _fDot = saturate( _fDot ); if (_bRimLighting) { slApplyDiffuseRimTerm( _pipe, _fDot, _clLightColor, _vcLightDir, _bMainLight ); } _clDiffuse = _clLightColor * _fDot; } if (_bRimLighting) { slApplySpecularRimTerm( _pipe, saturate(_fDot), _clLightColor, _vcLightDir, _bMainLight ); } if (_bDiffuse) { slAddDiffuseTerm( _pipe, _clDiffuse, _bMainLight ); } if (_bSpecular) { slAddSpecularTerm( _pipe, _clSpecular, _bMainLight ); } } #line 422 void slSetUpRimParameters(inout PIPE _pipe) { SLT_DIR3 _vEyeDir = slGetLightingEyeDirection(_pipe); SLT_DIR3 _vNormal = slGetLightingNormal(_pipe); if (sloGetRimLightingTarget() == 2) { _pipe.Insert( "clRim", slGetColorRimFresnel(_vNormal, _vEyeDir) ); } else { _pipe.Insert( "fRimFresnel", slGetRimFresnel(_vNormal, _vEyeDir) ); if (sloIsAdditiveRim()) { _pipe.Insert( "clRim", SLT_COLOR3(0,0,0) ); if (!slpIsPixelLighting() && !sloIsRimIndependentFromShadow() && slcShadowMayBeCasted()) { _pipe.Insert( "clMainRim", SLT_COLOR3(0,0,0) ); } } else { if (sloIsRimIndependentFromShadow() && slcIsShadowCastedForAllLight()) { _pipe.Insert( "clRim", SLT_COLOR3(0,0,0) ); } } } } #line 461 void slSetUpRimVertex(inout PIPE _pipe) { if (slcIsRimLighting() && !slpIsPixelLighting()) { slSetUpRimParameters( _pipe ); } } #line 476 void slSetUpRimPixel(inout PIPE _pipe) { if (slcIsRimLighting() && slpIsPixelLighting()) { slSetUpRimParameters( _pipe ); } } #line 490 void slApplyAdditiveRim( inout PIPE _pipe ) { if (slcIsRimLighting() && sloIsAdditiveRim()) { if (_pipe.IsExisting( "clMainRim" )) { slApplyMainLightColor( _pipe.clMainRim, _pipe ); if (!sloIsRimIndependentFromShadow() && slcShadowMayBeCasted()) { _pipe.clDiffuse.rgb += _pipe.clRim + _pipe.fShadow * _pipe.clMainRim; } else { _pipe.clDiffuse.rgb += _pipe.clRim + _pipe.clMainRim; } } else { _pipe.clDiffuse.rgb += _pipe.clRim; } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccWaterDrop.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccEnvironmentMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccNormalMap.fx" #line 159 "D://KTGL/shaderlib2/shader/include/../func/slAccWaterDrop.fx" void slSetUpWaterDropNormalMapPixel(inout PIPE _pipe) { SLT_TEXCOORD2 _vTex = slGetShaderTexCoord(_pipe, slGetWaterDropNormalMapTexCoordIndex());; SLT_DIR4 _vWDNormalMap = slGetNormalMap( _vTex, sNMapWD ); if ( slcNormalMapping() && 0 ) { _vWDNormalMap.xyz = slTransformS2W( _pipe.vcLitNormal, _pipe.vcLitTangent, _pipe.vcLitBiNormal, _vWDNormalMap.xyz ); } else { _vWDNormalMap.xyz = slTransformS2W( slGetWorldNormal( _pipe ), slGetWorldTangent( _pipe ), slGetWorldBiNormal( _pipe ), _vWDNormalMap.xyz ); } _pipe.Insert( "vWDNormal", _vWDNormalMap ); } SLT_COLOR2 slGetWaterDropMask( PIPE _pipe ) { return h4tex2D( sEnvMaskWD, slGetShaderTexCoord( _pipe, slGetWaterDropEnvMapMaskTexCoordIndex() ) ).rg; } #line 192 void slApplyWaterDropReflectionMaskImplement( inout PIPE _pipe ) { SLT_COLOR2 _mask; if (0 == 0) { _mask = slGetWaterDropMask( _pipe ); } else { _mask = SLT_COLOR2( _pipe.vWDNormal.w * 255.0f/127.0f - 128.0f/127.0f, _pipe.vWDNormal.w * 255.0f/128.0f ); } _pipe.Insert( "clEnvMask", _mask ); _pipe.cEnvReflect *= ( _pipe.clEnvMask.r + clDropAlpha.rgb * _pipe.clEnvMask.g ); } void slApplyWaterDropColor( inout SLT_COLOR3 _color, PIPE _pipe ) { _color = lerp( _color, clDropAlpha.rgb, _pipe.clEnvMask.g * clDropAlpha.a ); _color = lerp( _color, clDropOpaque.rgb, _pipe.clEnvMask.r ); } #line 225 void slSetUpWaterDropPixel(inout PIPE _pipe) { if (slcIsWaterDropAccessory() && 0) { slSetUpWaterDropNormalMapPixel( _pipe ); } } #line 246 void slApplyWaterDropReflectionMask( inout PIPE _pipe ) { if (slcIsWaterDropAccessory()) { slApplyWaterDropReflectionMaskImplement( _pipe ); } } #line 265 void slApplyWaterDropColor(inout PIPE _pipe) { if (slcIsWaterDropAccessory()) { slApplyWaterDropColorImplement( _pipe ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccLightMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccPixelLighting.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slLighting.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slTexCoord.fx" #line 107 "D://KTGL/shaderlib2/shader/include/../func/slAccLightMap.fx" void slOutputVertexTextureCoordinatesForLightmap( inout PIPE _pipe ) {} #line 135 SLT_COLOR4 slGetLightMap( PIPE _pipe ) { if (slcIsLightMapAccessory()) { return h4tex2D(sLightMap, slGetLightMapTexCoord(_pipe)); } else { return 1; } } #line 150 SLT_TEXCOORD2 slGetLightMapTexCoord( PIPE _pipe ) { return slGetShaderTexCoord( _pipe, slpGetLightMapTexCoordIndex() ); } #line 159 SLT_COLOR4 slGetDiffuseFromPreviousStage( PIPE _pipe ) { return _pipe.clDiffuse; } #line 168 SLT_COLOR3 slGetAmbientFromPreviousStage( PIPE _pipe ) { return _pipe.clAmbient; } SLT_COLOR3 slGetDiffuseBRDFColor( inout PIPE _pipe ) { SLT_COLOR3 ret = SLT_COLOR3( 1.0, 1.0, 1.0 ); if (_pipe.IsExisting("clDiffuseBRDF")) { ret= _pipe.clDiffuseBRDF; if(bIgnoreAlbedo){ ret= SLT_COLOR3( 1.0, 1.0, 1.0 ); } } return ret; } SLT_COLOR3 slGetDiffuseColorForLightMap( inout PIPE _pipe, SLT_COLOR3 diffuse ) { SLT_COLOR3 ret = diffuse; if (_pipe.IsExisting("clDiffuseBRDF")) { if(bIgnoreAlbedo){ ret= SLT_COLOR3( 1.0, 1.0, 1.0 ); } } return ret; } #line 206 void slApplyAccLightMap( inout PIPE _pipe ) { if (slcIsLightMapAccessory()) { SLT_COLOR4 lmColor = slGetLightMap( _pipe ); SLT_COLOR3 lmRgb = lmColor.rgb; SLT_COLOR3 lmA = lmColor.aaa; SLT_COLOR3 lmR = lmColor.rrr; SLT_COLOR3 lmG = lmColor.ggg; SLT_COLOR3 lmB = lmColor.bbb; if (_pipe.IsExisting("clDiffuse")) { SLT_COLOR4 clDiffuse = slGetDiffuseFromPreviousStage( _pipe ); SLT_FLOAT3 shadow = SLT_FLOAT3(0.0, 0.0, 0.0); if (_pipe.IsExisting("clMainDiffuse") && _pipe.IsExisting("fShadow")) { shadow = slGetShadowScaler() * lmRgb * _pipe.clMainDiffuse * (_pipe.fShadow - 1.0f); } clDiffuse.rgb = slGetDiffuseColorForLightMap( _pipe, clDiffuse.rgb) * slGetDiffuseScaler0() * lmRgb + slGetDiffuseColorForLightMap( _pipe, clDiffuse.rgb) * slGetDiffuseScaler1() * lmA + slGetDiffuseColorForLightMap( _pipe, clDiffuse.rgb) * slGetDiffuseScaler2() + slGetDiffuseScaler3() * slGetDiffuseBRDFColor( _pipe ) * lmRgb + slGetDiffuseScaler4() * slGetDiffuseBRDFColor( _pipe ) * lmR + slGetDiffuseScaler5() * slGetDiffuseBRDFColor( _pipe ) * lmG + slGetDiffuseScaler6() * slGetDiffuseBRDFColor( _pipe ) * lmB + shadow + SLT_FLOAT3(0.0, 0.0, 0.0); _pipe.Insert("clDiffuseBackup", clDiffuse); _pipe.clDiffuse = clDiffuse; } if (_pipe.IsExisting("clSpecular")){ _pipe.clSpecular *= slGetSpecularScaler0() * lmRgb + slGetSpecularScaler1() * lmA + slGetSpecularScaler2() + SLT_FLOAT3(0.0, 0.0, 0.0); } } } void slApplyAccLightMapAlbedoControlBody(inout PIPE _pipe) { if (_pipe.IsExisting("clDiffuseBackup") && _pipe.IsExisting("clDiffuse") ) { if (0) { if (_pipe.IsExisting("clAmbient")) { _pipe.clDiffuseBackup.rgb += slGetAmbientFromPreviousStage(_pipe); } } _pipe.clDiffuse = bIgnoreAlbedo ? _pipe.clDiffuseBackup : _pipe.clDiffuse; } } #line 308 void slApplyAccLightMapAmbientControl( inout PIPE _pipe ) { #line 322 } #line 328 void slApplyAccLightMapAlbedoControl( inout PIPE _pipe ) { if (slcIsLightMapAccessory()) { slApplyAccLightMapAlbedoControlBody(_pipe); } } #line 391 void slSetUpLightMapPixel( inout PIPE _pipe ) { } #line 401 void slApplyLightMapVertexLighting( inout PIPE _pipe ) { slApplyAccessoryVertexSpecularLighting( _pipe ); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccLightProbe.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slAccLightProbe.fxh" #line 30 "D://KTGL/shaderlib2/shader/include/../func/slAccLightProbe.fx" SLT_FLOAT3 coeffs[9]; #line 69 SLT_COLOR3 slGetLightProbeColor(SLT_DIR3 normal) { const SLT_FLOAT x = normal.x; const SLT_FLOAT y = normal.y; const SLT_FLOAT z = normal.z; SLT_FLOAT3 col = SLT_FLOAT3(0, 0, 0); col += coeffs[0] * (0.28209481f); col += coeffs[1] * (-0.48860252f * y); col += coeffs[2] * (0.48860252f * z); col += coeffs[3] * (-0.48860252f * x); col += coeffs[4] * (1.0925485f * x * y); col += coeffs[5] * (-1.0925485f * y * z); col += coeffs[6] * (0.31539160f * (3.0f*z*z - 1.0f)); col += coeffs[7] * (-1.0925485f * z * x); col += coeffs[8] * (0.54627424f * (x*x - y*y)); return(col); } #line 136 void slApplyAccLightProbeAlbedoControl(inout PIPE _pipe) { #line 152 } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccUnpackedVSInput.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccClipPlane.fx" SLT_BOOL slcIsShaderClipPlaneNecessary() { return (slcGetPlatform() == 0x20003 || slcGetPlatform() == 0x40001 || slcGetLanguage() == 3 || slcGetPlatform() == 0x1000B); } SLT_BOOL slcIsClipPlaneSemanticAvailable() { return slcGetPlatform() == 0x20003 || slcGetPlatform() == 0x40001 || slcGetPlatform() == 0x60001 || slcGetPlatform() == 0x1000B; } SLT_BOOL slcIsShaderClipPlaneEnabled() { return 0 < slcGetClipPlaneNum() && slcIsShaderClipPlaneNecessary(); } SLT_BOOL slcIsPixelShaderClipPlaneEnabled() { return 0 < slcGetClipPlaneNum() && !slcIsClipPlaneSemanticAvailable(); } SLT_PARAM_FLOAT4 ksgClipPlane[0]; #line 32 void slOutputClipPlaneParameters( inout PIPE _pipe ) { SLT_FLOAT fDistance; if ( slcGetPlatform() == 0x1000B ) { if ( 0 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip0", dot(ksgClipPlane[0], _pipe.vProjPos) ); _pipe.Output( "clip0", "CLP0", SLT_FLOAT4(_pipe.vClip0, 0.0, 0.0, 0.0) ); if ( 1 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip1", dot(ksgClipPlane[1], _pipe.vProjPos) ); _pipe.clip0.y = _pipe.vClip1; if ( 2 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip2", dot(ksgClipPlane[2], _pipe.vProjPos) ); _pipe.clip0.z = _pipe.vClip2; if ( 3 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip3", dot(ksgClipPlane[3], _pipe.vProjPos) ); _pipe.clip0.w = _pipe.vClip3; if ( 4 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip4", dot(ksgClipPlane[4], _pipe.vProjPos) ); _pipe.Output( "clip1", "CLP1", SLT_FLOAT4(_pipe.vClip4, 0.0, 0.0, 0.0) ); if ( 5 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip5", dot(ksgClipPlane[5], _pipe.vProjPos) ); _pipe.clip1.y = _pipe.vClip5; if ( 6 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip6", dot(ksgClipPlane[6], _pipe.vProjPos) ); _pipe.clip1.z = _pipe.vClip6; if ( 7 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip7", dot(ksgClipPlane[7], _pipe.vProjPos) ); _pipe.clip1.w = _pipe.vClip7; } } } } } } } } } else { if ( 0 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip0", dot(ksgClipPlane[0], _pipe.vProjPos) ); if (slcIsClipPlaneSemanticAvailable()) { _pipe.Output( "clip0", "CLP0", _pipe.vClip0 ); } if ( 1 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip1", dot(ksgClipPlane[1], _pipe.vProjPos) ); if (slcIsClipPlaneSemanticAvailable()) { _pipe.Output( "clip1", "CLP1", _pipe.vClip1 ); } if ( 2 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip2", dot(ksgClipPlane[2], _pipe.vProjPos) ); if (slcIsClipPlaneSemanticAvailable()) { _pipe.Output( "clip2", "CLP2", _pipe.vClip2 ); } if ( 3 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip3", dot(ksgClipPlane[3], _pipe.vProjPos) ); if (slcIsClipPlaneSemanticAvailable()) { _pipe.Output( "clip3", "CLP3", _pipe.vClip3 ); } if ( 4 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip4", dot(ksgClipPlane[4], _pipe.vProjPos) ); if (slcIsClipPlaneSemanticAvailable()) { _pipe.Output( "clip4", "CLP4", _pipe.vClip4 ); } if ( 5 < slcGetClipPlaneNum() ) { _pipe.Insert( "vClip5", dot(ksgClipPlane[5], _pipe.vProjPos) ); if (slcIsClipPlaneSemanticAvailable()) { _pipe.Output( "clip5", "CLP5", _pipe.vClip5 ); } } } } } } } } } void slClipWithUseClipPlanes( PIPE _pipe ) { SLT_FLOAT fDistance; if ( 0 < slcGetClipPlaneNum() ) { if ((_pipe.clip0) < 0.0) { discard; }; if ( 1 < slcGetClipPlaneNum() ) { if ((_pipe.clip1) < 0.0) { discard; }; if ( 2 < slcGetClipPlaneNum() ) { if ((_pipe.clip2) < 0.0) { discard; }; if ( 3 < slcGetClipPlaneNum() ) { if ((_pipe.clip3) < 0.0) { discard; }; if ( 4 < slcGetClipPlaneNum() ) { if ((_pipe.clip4) < 0.0) { discard; }; if ( 5 < slcGetClipPlaneNum() ) { if ((_pipe.clip5) < 0.0) { discard; }; } } } } } } } #line 157 void slOutputClipPlaneVertex( inout PIPE _pipe ) { if ( slcIsShaderClipPlaneEnabled() ) { slOutputClipPlaneParameters( _pipe ); } } #line 168 void slSetUpClipPlanePixel( inout PIPE _pipe ) { if ( slcIsPixelShaderClipPlaneEnabled() ) { slClipWithUseClipPlanes( _pipe ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccGBuffer.fx" #line 33 SLT_PARAM_FLOAT4 mWV[3]; SLT_PARAM_FLOAT4x4 mITW2V; #line 41 SLT_PARAM_INT mShdID; #line 72 SLT_DIR3 slGetViewNormal(SLT_DIR3 vWorldNormal) { SLT_DIR3 _vOut; _vOut.x = dot( (SLT_DIR3)mWV[0], vWorldNormal ); _vOut.y = dot( (SLT_DIR3)mWV[1], vWorldNormal ); _vOut.z = dot( (SLT_DIR3)mWV[2], vWorldNormal ); return _vOut; } #line 86 SLT_COLOR3 slVector2Color( SLT_VECTOR3 _vc ) { return (SLT_COLOR3)( 0.5f * (SLT_DIR3)slNormalizeVector( _vc ) + 0.5f ); } #line 94 void slOutputGBufferVertexDefault( inout PIPE _pipe ) { if( _pipe.IsExisting("vDepth") ) { _pipe.vDepth = _pipe.vProjPos.zw; } else { _pipe.Insert( "vDepth", _pipe.vProjPos.zw ); } } #line 118 void slOutputGBufferVertex( inout PIPE _pipe ) { slOutputGBufferVertexDefault( _pipe ); } void slSetupGBufferParamDefault(inout PIPE _pipe) { if (_pipe.IsExisting( "clSpecular" )) { _pipe.clSpecular = SLT_COLOR3( 1.0f, 1.0f, 1.0f ); } else { _pipe.Insert( "SLT_COLOR3", "clSpecular" ); _pipe.clSpecular = SLT_COLOR3( 1.0f, 1.0f, 1.0f ); } SLT_COLOR4 _clDiffuse = slGetDiffuseColor( _pipe ); if ( 0 < slpGetPSTexCoordNum() ) { SLT_COLOR4 _clBlendTex = slGetBlendedTextureWithSpecularMap( _pipe ); _clDiffuse *= _clBlendTex; } _pipe.GBufDiffuse = _clDiffuse; slApplyAccessoryExtraSpecularMap( _pipe ); SLT_COLOR _clSpDecay = 1.0f; if( _pipe.IsExisting( "fSpecularDecay" )) { _clSpDecay = log2( _pipe.fSpecularDecay ); } _pipe.GBufSpDecay = _clSpDecay * 0.1f; if( _pipe.IsExisting( "clAlbedoColor" )) { _pipe.GBufAlbedoColor = _pipe.clAlbedoColor; } if( _pipe.IsExisting( "fGlossiness" )) { _pipe.GBufGlossiness = _pipe.fGlossiness; } else { _pipe.GBufGlossiness = (_clSpDecay - 1.0f) * 0.1f; } if( _pipe.IsExisting( "clReflectance" )) { _pipe.GBufReflectance = _pipe.clReflectance; } SLT_DIR3 _vWTangent = slGetLightingTangent( _pipe ); SLT_DIR3 _vVTangent= slGetViewNormal( _vWTangent ); _pipe.GBufTangent = slVector2Color( _vVTangent ); #line 188 if (slcIsLightMapAccessory()) { _pipe.GBufOcclusion = slGetLightMap(_pipe).a; } else if (slcIsPatternMapping()) { SLT_COLOR4 _clPatternMap = h4tex2D( sLit, (SLT_TEXCOORD2)_pipe.vPatternPos ); _clPatternMap = lerp( SLT_COLOR4(1.0f, 1.0f, 1.0f, 1.0f), _clPatternMap, fPtn ); _pipe.GBufOcclusion = _clPatternMap.r; } if (slcIsAmbientOcclusion()) { if ( _pipe.IsExisting("clOcc") ) { _pipe.GBufOcclusion *= _pipe.clOcc.r; } else { _pipe.GBufOcclusion *= slGetOcclusionMap( _pipe ).r; } } _pipe.GBufSpecular = _pipe.clSpecular.xyz * slGetSpecularColor( _pipe ).xyz; SLT_DIR3 _vWNormal = slGetLightingNormal( _pipe ); SLT_DIR3 _vVNormal= slGetViewNormal( _vWNormal ); _pipe.GBufNormal = slVector2Color( _vVNormal ); _pipe.Insert( "GBufWNormal", slVector2Color( _vWNormal ) ); _pipe.GBufShType = slcGetGBufferShaderType()/255.0f; SLT_FLOAT1 _fDepth = _pipe.vDepth.x/_pipe.vDepth.y; _pipe.GBufDepth = slFloat2RGB(_fDepth); if ( slcGetGBufferRSMLighting() != 0 ) { _pipe.Insert( "SLT_COLOR3", "clMainDiffuse" ); _pipe.clMainDiffuse = SLT_COLOR3( 0, 0, 0 ); slApplyMainLight( _pipe, true, false ); _pipe.Insert( "GBufLightedColor", _pipe.clMainDiffuse * _clDiffuse.rgb ); } else { _pipe.Insert( "GBufLightedColor", _clDiffuse.rgb ); } } #line 238 void slSetupGBufferParam( inout PIPE _pipe ) { slSetupGBufferParamDefault( _pipe ); } #line 251 SLT_COLOR slGetGBufferStatic_One( inout PIPE _pipe ) { return 1.0f; } SLT_COLOR slGetGBufferStatic_Zero( inout PIPE _pipe ) { return 0.0f; } #line 259 SLT_COLOR4 slGetGBufferDiffuse( inout PIPE _pipe ) { return _pipe.GBufDiffuse; } SLT_COLOR slGetGBufferDiffuse_X( inout PIPE _pipe ) { return _pipe.GBufDiffuse.x; } SLT_COLOR slGetGBufferDiffuse_Y( inout PIPE _pipe ) { return _pipe.GBufDiffuse.y; } SLT_COLOR slGetGBufferDiffuse_Z( inout PIPE _pipe ) { return _pipe.GBufDiffuse.z; } SLT_COLOR slGetGBufferDiffuse_W( inout PIPE _pipe ) { return _pipe.GBufDiffuse.w; } #line 273 SLT_COLOR slGetGBufferOcclusion( inout PIPE _pipe ) { return _pipe.GBufOcclusion; } #line 279 SLT_COLOR3 slGetGBufferSpecular( inout PIPE _pipe ) { return _pipe.GBufSpecular; } SLT_COLOR slGetGBufferSpecular_X( inout PIPE _pipe ) { return _pipe.GBufSpecular.x; } SLT_COLOR slGetGBufferSpecular_Y( inout PIPE _pipe ) { return _pipe.GBufSpecular.y; } SLT_COLOR slGetGBufferSpecular_Z( inout PIPE _pipe ) { return _pipe.GBufSpecular.z; } #line 291 SLT_COLOR slGetGBufferSpecularDecay( inout PIPE _pipe ) { return _pipe.GBufSpDecay; } #line 297 SLT_COLOR slGetGBufferAlbedoColor_X( inout PIPE _pipe ) { return _pipe.GBufAlbedoColor.x; } SLT_COLOR slGetGBufferAlbedoColor_Y( inout PIPE _pipe ) { return _pipe.GBufAlbedoColor.y; } SLT_COLOR slGetGBufferAlbedoColor_Z( inout PIPE _pipe ) { return _pipe.GBufAlbedoColor.z; } #line 307 SLT_COLOR slGetGBufferGlossiness( inout PIPE _pipe ) { return _pipe.GBufGlossiness; } #line 313 SLT_COLOR slGetGBufferReflectance_X( inout PIPE _pipe ) { return _pipe.GBufReflectance.x; } SLT_COLOR slGetGBufferReflectance_Y( inout PIPE _pipe ) { return _pipe.GBufReflectance.y; } SLT_COLOR slGetGBufferReflectance_Z( inout PIPE _pipe ) { return _pipe.GBufReflectance.z; } #line 323 SLT_COLOR3 slGetGBufferNormal( inout PIPE _pipe ) { return _pipe.GBufNormal; } SLT_COLOR slGetGBufferNormal_X( inout PIPE _pipe ) { return _pipe.GBufNormal.x; } SLT_COLOR slGetGBufferNormal_Y( inout PIPE _pipe ) { return _pipe.GBufNormal.y; } SLT_COLOR slGetGBufferNormal_Z( inout PIPE _pipe ) { return _pipe.GBufNormal.z; } #line 335 SLT_COLOR3 slGetGBufferTangent( inout PIPE _pipe ) { return _pipe.GBufTangent; } SLT_COLOR slGetGBufferTangent_X( inout PIPE _pipe ) { return _pipe.GBufTangent.x; } SLT_COLOR slGetGBufferTangent_Y( inout PIPE _pipe ) { return _pipe.GBufTangent.y; } SLT_COLOR slGetGBufferTangent_Z( inout PIPE _pipe ) { return _pipe.GBufTangent.z; } #line 347 SLT_COLOR3 slGetGBufferAsp( inout PIPE _pipe ) { return _pipe.GBufAsp; } SLT_COLOR slGetGBufferAsp_X( inout PIPE _pipe ) { return _pipe.GBufAsp.x; } SLT_COLOR slGetGBufferAsp_Y( inout PIPE _pipe ) { return _pipe.GBufAsp.y; } #line 357 SLT_COLOR3 slGetGBufferWorldNormal( inout PIPE _pipe ) { return _pipe.GBufWNormal; } SLT_COLOR slGetGBufferWorldNormal_X( inout PIPE _pipe ) { return _pipe.GBufWNormal.x; } SLT_COLOR slGetGBufferWorldNormal_Y( inout PIPE _pipe ) { return _pipe.GBufWNormal.y; } SLT_COLOR slGetGBufferWorldNormal_Z( inout PIPE _pipe ) { return _pipe.GBufWNormal.z; } #line 369 SLT_COLOR3 slGetGBufferLightedColor( inout PIPE _pipe ) { return _pipe.GBufLightedColor; } SLT_COLOR slGetGBufferLightedColor_X( inout PIPE _pipe ) { return _pipe.GBufLightedColor.x; } SLT_COLOR slGetGBufferLightedColor_Y( inout PIPE _pipe ) { return _pipe.GBufLightedColor.y; } SLT_COLOR slGetGBufferLightedColor_Z( inout PIPE _pipe ) { return _pipe.GBufLightedColor.z; } #line 381 SLT_COLOR slGetGBufferShadow( inout PIPE _pipe ) { return _pipe.fShadow; } #line 388 SLT_COLOR slGetGBufferShaderType( inout PIPE _pipe ) { return _pipe.GBufShType; } #line 394 SLT_COLOR3 slGetGBufferDepth( inout PIPE _pipe ) { return _pipe.GBufDepth; } SLT_COLOR slGetGBufferDepth_X( inout PIPE _pipe ) { return _pipe.GBufDepth.x; } SLT_COLOR slGetGBufferDepth_Y( inout PIPE _pipe ) { return _pipe.GBufDepth.y; } SLT_COLOR slGetGBufferDepth_Z( inout PIPE _pipe ) { return _pipe.GBufDepth.z; } #line 406 SLT_COLOR3 slGetGBufferShadowDepth( inout PIPE _pipe ) { return _pipe.GBufShadowDepth; } SLT_COLOR slGetGBufferShadowDepth_X( inout PIPE _pipe ) { return _pipe.GBufShadowDepth.x; } SLT_COLOR slGetGBufferShadowDepth_Y( inout PIPE _pipe ) { return _pipe.GBufShadowDepth.y; } SLT_COLOR slGetGBufferShadowDepth_Z( inout PIPE _pipe ) { return _pipe.GBufShadowDepth.z; } #line 418 void slSetupGBufferPixel( inout PIPE _pipe ) { if( slcIsGBuffer() ) { SLT_COLOR4 clearCol = SLT_COLOR4( 0.0f, 0.0f, 0.0f, 0.0f ); if( slcGetGBufferNum() > 0 ) { _pipe.Insert( "GBuffer1", clearCol ); } if( slcGetGBufferNum() > 1 ) { _pipe.Insert( "GBuffer2", clearCol ); } if( slcGetGBufferNum() > 2 ) { _pipe.Insert( "GBuffer3", clearCol ); } if( slcGetGBufferNum() > 3 ) { _pipe.Insert( "GBuffer4", clearCol ); } _pipe.Insert( "GBufDiffuse", clearCol ); _pipe.Insert( "GBufNormal", clearCol.xyz ); _pipe.Insert( "GBufSpecular", clearCol.xyz ); _pipe.Insert( "GBufSpDecay", clearCol.x ); _pipe.Insert( "GBufAlbedoColor", clearCol ); _pipe.Insert( "GBufGlossiness", clearCol.x ); _pipe.Insert( "GBufReflectance", clearCol.xyz ); _pipe.Insert( "GBufTangent", clearCol.xyz ); _pipe.Insert( "GBufAsp", SLT_COLOR2(1.0f, 1.0f) ); _pipe.Insert( "GBufShType", clearCol.x ); _pipe.Insert( "GBufDepth", clearCol.xyz ); if ( _pipe.IsExisting( "fShadowDepth" ) ) { _pipe.Insert( "fShadow", slGetBiasedDepth( _pipe.fShadowDepth ) ); } else if ( _pipe.IsExisting( "vShadowPos" ) ) { _pipe.Insert( "fShadow", slGetBiasedDepthProj( _pipe.vShadowPos ) ); } if ( _pipe.IsExisting( "fShadow" ) ) { _pipe.Insert( "GBufShadowDepth", slFloat2RGB( _pipe.fShadow ) ); } _pipe.Insert( "GBufOcclusion", 1.0f ); } } #line 500 void slLayoutGBufferPixelDefault( inout SLT_COLOR4 _color0, inout PIPE _pipe ) { if( slcGetGBufferNum() > 0 ) { _pipe.GBuffer1.x = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer1.y = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer1.z = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer1.w = slGetGBufferStatic_Zero(_pipe); } if( slcGetGBufferNum() > 1 ) { _pipe.GBuffer2.x = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer2.y = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer2.z = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer2.w = slGetGBufferStatic_Zero(_pipe); } if( slcGetGBufferNum() > 2 ) { _pipe.GBuffer3.x = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer3.y = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer3.z = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer3.w = slGetGBufferStatic_Zero(_pipe); } if( slcGetGBufferNum() > 3 ) { _pipe.GBuffer4.x = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer4.y = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer4.z = slGetGBufferStatic_Zero(_pipe); _pipe.GBuffer4.w = slGetGBufferStatic_Zero(_pipe); } } void slLayoutGBufferPixel( inout SLT_COLOR4 _color0, inout PIPE _pipe ) { slLayoutGBufferPixelDefault( _color0, _pipe ); } #line 549 void slOutputGBufferPixel( inout SLT_COLOR4 _color0, inout PIPE _pipe ) { slSetupGBufferParam( _pipe ); slLayoutGBufferPixel( _color0, _pipe ); if( _pipe.IsExisting( "GBuffer1" )) { _color0 = _pipe.GBuffer1; } if( _pipe.IsExisting( "GBuffer2" )) { _pipe.Output( "color1", "COLOR1", _pipe.GBuffer2 ); } if( _pipe.IsExisting( "GBuffer3" )) { _pipe.Output( "color2", "COLOR2", _pipe.GBuffer3 ); } if( _pipe.IsExisting( "GBuffer4" )) { _pipe.Output( "color3", "COLOR3", _pipe.GBuffer4 ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccSSSTransmit.fx" #line 20 void slOutputSSSVertex(inout PIPE _pipe) { if (slcIsSSS()) { if (slcGetSSSDepthInMrt()) { _pipe.Insert( "fZ", _pipe.vProjPos.z ); } } } #line 166 void slGetTransmitPositionFromProjection( inout PIPE _pipe ) { if (slcIsSSSCascadeEnable()) { SLT_SHADOWMAP4 vDepthMapPos = 0.0; SLT_SHADOWMAP4 uvOffset = 0.0; SLT_POINT viewDepth = dot( _pipe.vDepthMapPos0, vDepth2VZ ); vDepthMapPos = (viewDepth > 0.0) ? _pipe.vDepthMapPos1 : _pipe.vDepthMapPos0; uvOffset = (viewDepth > 0.0) ? vCOffset[1] : vCOffset[0]; SLT_POINT4 vDepth2LZ0 = (viewDepth > 0.0) ? vDepth2LZ[2] : vDepth2LZ[0]; SLT_POINT4 vDepth2LZ1 = (viewDepth > 0.0) ? vDepth2LZ[3] : vDepth2LZ[1]; if (slcGetSSSCascadeNum() > 2) { viewDepth -= vCDepth.x; vDepthMapPos = (viewDepth > 0.0) ? _pipe.vDepthMapPos2 : vDepthMapPos; uvOffset = (viewDepth > 0.0) ? vCOffset[2] : uvOffset; vDepth2LZ0 = (viewDepth > 0.0) ? vDepth2LZ[4] : vDepth2LZ0; vDepth2LZ1 = (viewDepth > 0.0) ? vDepth2LZ[5] : vDepth2LZ1; if (slcGetSSSCascadeNum() > 3) { viewDepth -= vCDepth.y; vDepthMapPos = (viewDepth > 0.0) ? _pipe.vDepthMapPos3 : vDepthMapPos; uvOffset = (viewDepth > 0.0) ? vCOffset[3] : uvOffset; vDepth2LZ0 = (viewDepth > 0.0) ? vDepth2LZ[6] : vDepth2LZ0; vDepth2LZ1 = (viewDepth > 0.0) ? vDepth2LZ[7] : vDepth2LZ1; if (slcGetSSSCascadeNum() > 4) { Error("SSSS does not support over 4 cascades."); } } } _pipe.Insert( "trsPos", vDepthMapPos ); _pipe.Insert( "trsScale", uvOffset ); _pipe.Insert( "vDepth2LZ0", vDepth2LZ0 ); _pipe.Insert( "vDepth2LZ1", vDepth2LZ1 ); } else { _pipe.Insert( "trsPos", _pipe.vDepthMapPos0 ); SLT_SHADOWMAP4 uvOffset = SLT_SHADOWMAP4(1.0, 1.0, 0.0, 0.0); _pipe.Insert( "trsScale", uvOffset ); _pipe.Insert( "vDepth2LZ0", vDepth2LZ[0] ); _pipe.Insert( "vDepth2LZ1", vDepth2LZ[1] ); } if (slcIsSSSLSPEnable()) { _pipe.trsPos.xyz /= _pipe.trsPos.www; _pipe.trsPos.w = 1.0; } } #line 219 void slOutputSSSTransmitVertex( inout PIPE _pipe ) { if (slcIsSSS() ) { if (slcIsSSSOutputPositionVertex()) { slInsertSSSTransmitDepthPosition(_pipe); } } } #line 231 void slSetupSSSTransmitPixel( inout PIPE _pipe ) { if (slcIsSSS() ) { if (!slcIsSSSOutputPositionVertex()) { slInsertSSSTransmitDepthPosition(_pipe); } } } #line 251 void slOutputSSSPixel( inout SLT_COLOR4 _color0, inout PIPE _pipe ) { if (!slcIsSSS()) { return; } if (slcIsSSS() && slcGetSSSTransmit()) { SLT_COLOR4 _clCol = _pipe.clDiffuse; SLT_COLOR3 trasnColor = slApplyAccSSSTransmitLighting(_pipe); _clCol.rgb += trasnColor; _pipe.clDiffuse = _clCol; if( !slcGetSSSSeparateSpecular() ) { _color0.rgb += trasnColor; } } if (!_pipe.IsExisting( "clSpecular" ) && slcGetSSSSeparateSpecular() ) { _pipe.Insert( "clSpecular", SLT_COLOR4(0, 0, 0, 0) ); } if( !slcGetSSSSeparateSpecular() && !slcGetSSSDepthInMrt() ) { _color0.a = _pipe.clDiffuse.a; } else if ( slcGetSSSSeparateSpecular() && !slcGetSSSDepthInMrt() ) { _color0 = _pipe.clDiffuse; SLT_COLOR4 _clOut; _clOut.rgb = _pipe.clSpecular.rgb; _clOut.a = _pipe.clDiffuse.a; _pipe.Output( "color1", "COLOR1", _clOut ); } else if ( slcGetSSSSeparateSpecular() && slcGetSSSDepthInMrt()) { _color0 = _pipe.clDiffuse; SLT_COLOR4 _clOut; _clOut.rgb = _pipe.clSpecular.rgb; _clOut.a = _pipe.clDiffuse.a; _pipe.Output( "color1", "COLOR1", _clOut ); SLT_COLOR4 _clOut2; SLT_FLOAT1 _fDepth = slNormalizeCameraDepth( _pipe.fZ ); _clOut2.rgb = slFloat2RGB(_fDepth); _clOut2.a = 1.0f; _pipe.Output( "color2", "COLOR2", _clOut2 ); } else if( !slcGetSSSSeparateSpecular() && slcGetSSSDepthInMrt()) { _color0.a = _pipe.clDiffuse.a; SLT_COLOR4 _clOut1; SLT_FLOAT1 _fDepth = slNormalizeCameraDepth( _pipe.fZ ); _clOut1.rgb = slFloat2RGB(_fDepth); _clOut1.a = 1.0f; _pipe.Output( "color1", "COLOR1", _clOut1 ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccMaterialScaler.fx" #line 24 SLT_PARAM_FLOAT4 vDifScl; #line 32 SLT_PARAM_FLOAT4 vSpcScl; #line 42 SLT_PARAM_FLOAT4 vAmbScl; #line 54 SLT_COLOR4 slGetDiffuseScaler() { if (slcIsMaterialScaler()) { return (SLT_COLOR4)vDifScl; } else { return SLT_COLOR4( 1.0, 1.0, 1.0, 1.0 ); } } #line 70 SLT_COLOR4 slGetSpecularScaler() { if (slcIsMaterialScaler()) { return (SLT_COLOR4)vSpcScl; } else { return SLT_COLOR4( 1.0, 1.0, 1.0, 1.0 ); } } #line 87 SLT_COLOR4 slGetAmbientScaler() { if (slcIsMaterialScaler()) { return (SLT_COLOR4)vAmbScl; } else { return SLT_COLOR4( 1.0, 1.0, 1.0, 1.0 ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccTileLightList.fx" #line 35 SLT_PARAM_INT nTileNumX; #line 44 Buffer tLightIndices : register( t16 ); #line 53 Buffer tLightPositions : register( t17 ); #line 63 Buffer tLightAttributes : register( t18 ); #line 84 void _slApplyPointLightInTileLightList( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, SLT_UINT _nIndex ) { slSPointLight _lit; SLT_FLOAT4 _vPositionAndRadius = tLightPositions[_nIndex]; _lit.vPos = (SLT_POINT3)_vPositionAndRadius.xyz; _lit.vAtt.w = (SLT_VECTOR1)(_vPositionAndRadius.w * _vPositionAndRadius.w); if (sloGetLightAmbientColorSource() == 0) { _lit.clDiffuse = (SLT_COLOR3)tLightAttributes[3 * _nIndex + 0]; _lit.clAmbient = (SLT_COLOR3)tLightAttributes[3 * _nIndex + 1]; _lit.vAtt.xyz = (SLT_VECTOR3)tLightAttributes[3 * _nIndex + 2]; } else { _lit.clDiffuse = (SLT_COLOR3)tLightAttributes[2 * _nIndex + 0]; _lit.vAtt.xyz = (SLT_VECTOR3)tLightAttributes[2 * _nIndex + 1]; if (sloGetLightAmbientColorSource() == 1) { _lit.clAmbient = _lit.clDiffuse; } else { _lit.clAmbient = SLT_COLOR3( 0.0, 0.0, 0.0 ); } } slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); } #line 119 void _slApplySpotLightInTileLightList( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, SLT_UINT _nIndex ) { } #line 127 SLT_UINT _slGetLightIndexSize() { if (sloIsLightIndex32bit()) { return 4; } else { return 2; } } #line 147 void slApplyTileLightList( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { SLT_UINT _nTileIndexX = (SLT_UINT)((_pipe.vScreenPos.x + 0.5) / (SLT_FLOAT)sloGetTileSize()); SLT_UINT _nTileIndexY = (SLT_UINT)((_pipe.vScreenPos.y + 0.5) / (SLT_FLOAT)sloGetTileSize()); SLT_UINT _nTileIndex = nTileNumX * _nTileIndexY + _nTileIndexX; SLT_UINT _nIndexListPos; SLT_UINT _nLightNumInfoPos; if (sloIsLightIndexListFixedPitch()) { _nLightNumInfoPos = (sloGetMaxLightsPerTile() + (4 / _slGetLightIndexSize())) * _nTileIndex; _nIndexListPos = _nLightNumInfoPos + (4 / _slGetLightIndexSize()); } else { SLT_UINT _nTileInfoPos = (8 / _slGetLightIndexSize()) * _nTileIndex; if (sloIsLightIndex32bit()) { _nIndexListPos = tLightIndices[_nTileInfoPos]; _nLightNumInfoPos = _nTileInfoPos + 1; } else { _nIndexListPos = (tLightIndices[_nTileInfoPos] | (tLightIndices[_nTileInfoPos + 1] << 16)); _nLightNumInfoPos = _nTileInfoPos + 2; } } SLT_UINT _nPointLightNum, _nSpotLightNum; if (sloIsLightIndex32bit()) { SLT_UINT _nPackedNum = tLightIndices[_nLightNumInfoPos]; _nPointLightNum = (_nPackedNum >> 16); _nSpotLightNum = (_nPackedNum & 0xFFFF); } else { _nPointLightNum = tLightIndices[_nLightNumInfoPos]; _nSpotLightNum = tLightIndices[_nLightNumInfoPos + 1]; } for (SLT_UINT i = 0; i < _nPointLightNum; ++i) { SLT_UINT _nLightIndex = tLightIndices[_nIndexListPos + i]; _slApplyPointLightInTileLightList( _pipe, _bDiffuse, _bSpecular, _nLightIndex ); } _nIndexListPos += _nPointLightNum; for (SLT_UINT i = 0; i < _nSpotLightNum; ++i) { SLT_UINT _nLightIndex = tLightIndices[_nIndexListPos + i]; _slApplySpotLightInTileLightList( _pipe, _bDiffuse, _bSpecular, _nLightIndex ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccClusterLightList.fx" #line 35 SLT_PARAM_INT nClstPtch[2]; #line 56 SLT_PARAM_FLOAT4 vClstZPrm; #line 66 SLT_PARAM_FLOAT2 vFadeDist; #line 79 Buffer tCllLightIndices : register( t16 ); #line 88 Buffer tCllLightPositions : register( t17 ); #line 98 Buffer tCllLightAttributes : register( t18 ); #line 119 void _slApplyPointLightInClusterLightList( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, SLT_UINT _nIndex ) { slSPointLight _lit; SLT_FLOAT4 _vPositionAndRadius = tCllLightPositions[_nIndex]; _lit.vPos = (SLT_POINT3)_vPositionAndRadius.xyz; _lit.vAtt.w = (SLT_VECTOR1)(_vPositionAndRadius.w * _vPositionAndRadius.w); if (sloGetLightAmbientColorSource() == 0) { _lit.clDiffuse = (SLT_COLOR3)tCllLightAttributes[3 * _nIndex + 0]; _lit.clAmbient = (SLT_COLOR3)tCllLightAttributes[3 * _nIndex + 1]; _lit.vAtt.xyz = (SLT_VECTOR3)tCllLightAttributes[3 * _nIndex + 2]; if (_pipe.IsExisting( "fClusterLightFade" )) { _lit.clDiffuse *= _pipe.fClusterLightFade; _lit.clAmbient *= _pipe.fClusterLightFade; } } else { _lit.clDiffuse = (SLT_COLOR3)tCllLightAttributes[2 * _nIndex + 0]; _lit.vAtt.xyz = (SLT_VECTOR3)tCllLightAttributes[2 * _nIndex + 1]; if (_pipe.IsExisting( "fClusterLightFade" )) { _lit.clDiffuse *= _pipe.fClusterLightFade; } if (sloGetLightAmbientColorSource() == 1) { _lit.clAmbient = _lit.clDiffuse; } else { _lit.clAmbient = SLT_COLOR3( 0.0, 0.0, 0.0 ); } } slApplyPointLight( _pipe, _lit, false, _bDiffuse, _bSpecular ); } #line 163 void _slApplySpotLightInClusterLightList( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, SLT_UINT _nIndex ) { } #line 173 void slSetUpClusterLightListPixel( inout PIPE _pipe ) { if (slcIsClusterLightList()) { if (sloIsClusterLightFadeOut()) { _pipe.Insert( "SLT_COLOR1", "fClusterLightFade" ); } } } #line 191 SLT_POINT1 slGetClusterPixelDepth( PIPE _pipe ) { if (_pipe.IsExisting( "vOutPos" )) { return _pipe.vOutPos.z; } else if (_pipe.IsExisting( "vPos" )) { return _pipe.vPos.z; } else { Error("SV_Position is not found!"); } } #line 207 SLT_UINT _slGetLightIndexSize() { if (sloIsLightIndex32bit()) { return 4; } else { return 2; } } #line 227 void slApplyClusterLightList( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { SLT_UINT _nClusterIndexX = (SLT_UINT)((_pipe.vScreenPos.x + 0.5) / (SLT_FLOAT)sloGetClusterSize()); SLT_UINT _nClusterIndexY = (SLT_UINT)((_pipe.vScreenPos.y + 0.5) / (SLT_FLOAT)sloGetClusterSize()); SLT_POINT1 _fPixelDepth = slGetClusterPixelDepth( _pipe ); SLT_POINT1 _fInvViewDepth = _fPixelDepth * vClstZPrm.x + vClstZPrm.y; SLT_UINT _nClusterIndexZ = (SLT_UINT)max( log2( _fInvViewDepth ) * vClstZPrm.z + vClstZPrm.w, 0.0 ); if (_nClusterIndexZ < sloGetClusterZNum()) { SLT_UINT _nClusterIndex = (nClstPtch[1] * _nClusterIndexZ) + (nClstPtch[0] * _nClusterIndexY) + _nClusterIndexX; if (_pipe.IsExisting( "fClusterLightFade" )) { SLT_POINT1 _fViewZ = -1.0 / _fInvViewDepth; _pipe.fClusterLightFade = smoothstep( vFadeDist.y, vFadeDist.x, _fViewZ ); } SLT_UINT _nIndexListPos; SLT_UINT _nLightNumInfoPos; if (sloIsLightIndexListFixedPitch()) { _nLightNumInfoPos = (sloGetMaxLightsPerCluster() + (4 / _slGetLightIndexSize())) * _nClusterIndex; _nIndexListPos = _nLightNumInfoPos + (4 / _slGetLightIndexSize()); } else { SLT_UINT _nClusterInfoPos = (8 / _slGetLightIndexSize()) * _nClusterIndex; if (sloIsLightIndex32bit()) { _nIndexListPos = tCllLightIndices[_nClusterInfoPos]; _nLightNumInfoPos = _nClusterInfoPos + 1; } else { _nIndexListPos = (tCllLightIndices[_nClusterInfoPos] | (tCllLightIndices[_nClusterInfoPos + 1] << 16)); _nLightNumInfoPos = _nClusterInfoPos + 2; } } SLT_UINT _nPointLightNum, _nSpotLightNum; if (sloIsLightIndex32bit()) { SLT_UINT _nPackedNum = tCllLightIndices[_nLightNumInfoPos]; _nPointLightNum = (_nPackedNum >> 16); _nSpotLightNum = (_nPackedNum & 0xFFFF); } else { _nPointLightNum = tCllLightIndices[_nLightNumInfoPos]; _nSpotLightNum = tCllLightIndices[_nLightNumInfoPos + 1]; } for (SLT_UINT i = 0; i < _nPointLightNum; ++i) { SLT_UINT _nLightIndex = tCllLightIndices[_nIndexListPos + i]; _slApplyPointLightInClusterLightList( _pipe, _bDiffuse, _bSpecular, _nLightIndex ); } _nIndexListPos += _nPointLightNum; for (SLT_UINT i = 0; i < _nSpotLightNum; ++i) { SLT_UINT _nLightIndex = tCllLightIndices[_nIndexListPos + i]; _slApplySpotLightInClusterLightList( _pipe, _bDiffuse, _bSpecular, _nLightIndex ); } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccessoryHeaderKIDS.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccessoryFunc.fx" #line 23 void slSetUpAccUserVertex1( inout PIPE _pipe ) {} void slSetUpAccUserVertex2( inout PIPE _pipe ) {} void slSetUpAccUserVertex3( inout PIPE _pipe ) {} void slSetUpAccUserVertex4( inout PIPE _pipe ) {} void slSetUpAccUserVertex5( inout PIPE _pipe ) {} #line 32 void slOutputAccUserVertex1( inout PIPE _pipe ) {} void slOutputAccUserVertex2( inout PIPE _pipe ) {} void slOutputAccUserVertex3( inout PIPE _pipe ) {} void slOutputAccUserVertex4( inout PIPE _pipe ) {} void slOutputAccUserVertex5( inout PIPE _pipe ) {} #line 41 void slSetupAccUserPixel1( inout PIPE _pipe ) {} void slSetupAccUserPixel2( inout PIPE _pipe ) {} void slSetupAccUserPixel3( inout PIPE _pipe ) {} void slSetupAccUserPixel4( inout PIPE _pipe ) {} void slSetupAccUserPixel5( inout PIPE _pipe ) {} #line 50 void slApplyAccUserTexture1( inout PIPE _pipe ) {} void slApplyAccUserTexture2( inout PIPE _pipe ) {} void slApplyAccUserTexture3( inout PIPE _pipe ) {} void slApplyAccUserTexture4( inout PIPE _pipe ) {} void slApplyAccUserTexture5( inout PIPE _pipe ) {} #line 59 void slOutputAccUserPixel1( inout PIPE _pipe ) {} void slOutputAccUserPixel2( inout PIPE _pipe ) {} void slOutputAccUserPixel3( inout PIPE _pipe ) {} void slOutputAccUserPixel4( inout PIPE _pipe ) {} void slOutputAccUserPixel5( inout PIPE _pipe ) {} #line 68 void slOutputAccKIDSVertex( inout PIPE _pipe ) {} #line 82 void slSetUpAccessoryVertex( inout PIPE _pipe ) { slSetUpInstancingVertex( _pipe ); if (slcIsClothSpline()) { slSetUpClothVertex( _pipe ); } else { slSetUpStandardVertex( _pipe ); if (slcIsVfetchNecessary()) { slVfetchStandardVertex( _pipe, slGetInstancingVertexIndex( _pipe ) ); } } slSetUpBillBoardVertex( _pipe ); slSetUpNormalMapBlendVertex( _pipe ); slSetUpFaceRobotVertex( _pipe ); slSetUpPNTrianglesVertex( _pipe ); slSetUpAccUserVertex1( _pipe ); slSetUpAccUserVertex2( _pipe ); slSetUpAccUserVertex3( _pipe ); slSetUpAccUserVertex4( _pipe ); slSetUpAccUserVertex5( _pipe ); slSetUpKIDSVertex( _pipe ); } #line 138 void slTransformAccessoryVertexToWorld( inout PIPE _pipe ) { slSetUpTransformedVectors( _pipe ); if (slcIsBillBoard()) { slTransformBillboardToWorld( _pipe ); } else { slTransformStandardVertexToWorld( _pipe ); } slInsertVertexVectors( _pipe ); } #line 163 void slTransformAccessoryVertexToSpecifiedPosition( inout PIPE _pipe, uniform SLT_INT _nDstPosition ) { slSetUpTransformedVectors( _pipe ); if (slcIsBillBoard()) { slTransformBillboard( _pipe, _nDstPosition ); } else { slTransformStandardVertex( _pipe, _nDstPosition ); } slInsertVertexVectors( _pipe ); } #line 198 void slTransformAccessoryVertex( inout PIPE _pipe ) { if (slpIsWorldPositionComputed() || slcIsWorldSpaceUsedForInstancing()) { slTransformAccessoryVertexToSpecifiedPosition( _pipe, 0 ); } else { slTransformAccessoryVertexToSpecifiedPosition( _pipe, 1 ); } } #line 219 void slApplyAccessoryVertexLighting( inout PIPE _pipe ) { slSetUpRimVertex( _pipe ); if (!slpIsPixelLighting()) { slApplyVertexLighting( _pipe ); } } #line 235 void slApplyAccessoryVertexSpecularLighting( inout PIPE _pipe ) { slSetUpRimVertex( _pipe ); if (!slpIsPixelLighting()) { slApplyVertexSpecularLighting( _pipe ); } } #line 251 void slApplyAccessoryVertexDiffuseLighting( inout PIPE _pipe ) { slSetUpRimVertex( _pipe ); if (!slpIsPixelLighting()) { slApplyVertexDiffuseLighting( _pipe ); } } #line 273 void slOutputAccessoryVertexTextureCoordinates( inout PIPE _pipe ) { slOutputVertexTextureCoordinates( _pipe ); if (slcIsTextureAnimation()) { slTranslateTexCoord( _pipe ); } slOutputVertexTextureCoordinatesForLightmap( _pipe ); } #line 299 void slOutputAccessoryVertex( inout PIPE _pipe ) { slOutputPixelLightingVertex( _pipe ); slOutputPatternMapVertex( _pipe ); slOutputMRTVertex( _pipe ); slOutputTextureBlurVertex( _pipe ); slOutputNormalMapBlendVertex( _pipe ); slOutputClipPlaneVertex( _pipe ); slOutputGBufferVertex( _pipe ); slOutputPNTrianglesVertex( _pipe ); slOutputSSSTransmitVertex( _pipe ); slOutputAccUserVertex1( _pipe ); slOutputAccUserVertex2( _pipe ); slOutputAccUserVertex3( _pipe ); slOutputAccUserVertex4( _pipe ); slOutputAccUserVertex5( _pipe ); slOutputAccKIDSVertex( _pipe ); slOutputSSSVertex( _pipe ); } #line 354 void slSetUpAccessoryPixel(inout PIPE _pipe) { slSetUpClipPlanePixel( _pipe ); slSetUpPNTrianglesPixel( _pipe ); slSetUpPixel( _pipe ); slSetUpPixelLightingPixel( _pipe ); slSetUpParallaxMappingPixel( _pipe ); slSetUpNormalMapPixel( _pipe ); slSetUpWaterDropPixel( _pipe ); slSetUpAlphaSpecularMapPixel( _pipe ); slSetUpAmbientOcclusionPixel( _pipe ); slSetUpPatternMapPixel( _pipe ); slSetUpTextureBlurPixel( _pipe ); slSetUpAlphaTestPixel( _pipe ); slSetUpEnvironmentMapPixel( _pipe ); slSetUpRimPixel( _pipe ); slSetUpColorSpecularMapPixel( _pipe ); slSetUpLightMapPixel( _pipe ); slSetUpEmissiveMapPixel( _pipe ); slSetupGBufferPixel( _pipe ); slSetupSSSTransmitPixel( _pipe ); slSetUpColorControllerPixel( _pipe ); slSetUpClusterLightListPixel( _pipe ); slSetupAccUserPixel1( _pipe ); slSetupAccUserPixel2( _pipe ); slSetupAccUserPixel3( _pipe ); slSetupAccUserPixel4( _pipe ); slSetupAccUserPixel5( _pipe ); if ( slpIsTangentSpaceLighting() ) { if ( !_pipe.IsExisting( "vcLitNormal" ) ) { _pipe.Insert( "vcLitNormal", SLT_DIR3(0, 0, 1) ); } if ( !_pipe.IsExisting( "vcLitTangent" ) ) { _pipe.Insert( "vcLitTangent", SLT_DIR3(0, 1, 0) ); } if ( !_pipe.IsExisting( "vcLitBiNormal" ) ) { _pipe.Insert( "vcLitBiNormal", SLT_DIR3(1, 0, 0) ); } } } #line 452 void slApplyAccessoryPixelLighting( inout PIPE _pipe, SLT_COLOR _fShadow ) { _pipe.Insert( "fShadow", _fShadow ); slApplyAccLightMapAmbientControl( _pipe ); if (slpIsPixelLighting()) { slApplyPixelLighting( _pipe ); } else { slCompositVertexMainLightingResult( _pipe, true, slcIsSpecularPossiblyUsed() ); } } #line 477 void slApplyAccessoryPixelSpecularLighting( inout PIPE _pipe, SLT_COLOR _fShadow ) { _pipe.Insert( "fShadow", _fShadow ); if (slpIsPixelLighting()) { slApplyPixelSpecularLighting( _pipe ); } else { slCompositVertexMainLightingResult( _pipe, false, slcIsSpecularPossiblyUsed() ); } } #line 500 void slApplyAccessoryPixelDiffuseLighting( inout PIPE _pipe, SLT_COLOR _fShadow ) { _pipe.Insert( "fShadow", _fShadow ); if (slpIsPixelLighting()) { slApplyPixelDiffuseLighting( _pipe ); } else { slCompositVertexMainLightingResult( _pipe, true, false ); } } #line 527 void slApplyAccessoryExtraSpecularMapDefault( inout PIPE _pipe ) { slApplyNormalSpecular( _pipe ); slApplyColorSpecularMap( _pipe ); } #line 549 void slApplyAccessoryExtraSpecularMap( inout PIPE _pipe ) { slApplyAccessoryExtraSpecularMapDefault( _pipe ); } #line 564 void slApplyAccessoryReflectionMaskDefault( inout PIPE _pipe ) { slApplyWaterDropReflectionMask( _pipe ); } #line 578 void slApplyAccessoryReflectionMask( inout PIPE _pipe ) { slApplyAccessoryReflectionMaskDefault( _pipe ); } #line 591 void slApplyAccessoryTextureStages( inout PIPE _pipe ) { slApplyAccessoryReflectionMask( _pipe ); slCompositEnvMapReflectionColor( _pipe ); slApplyAccessoryExtraSpecularMap( _pipe ); slApplyAccAlphaSpecularMap( _pipe ); slApplyAccEmissiveMap( _pipe ); slApplyAccAmbientOcclusion( _pipe ); slApplyAccColorController( _pipe ); slApplyAccUserTexture1( _pipe ); slApplyAccUserTexture2( _pipe ); slApplyAccUserTexture3( _pipe ); slApplyAccUserTexture4( _pipe ); slApplyAccUserTexture5( _pipe ); if (0) { if (_pipe.IsExisting("clDiffuse") && _pipe.IsExisting("clAmbient")) { _pipe.clDiffuse.rgb += _pipe.clAmbient; } } slApplyRampTexture( _pipe ); slApplyTextureStages( _pipe ); slApplyAccLightMapAlbedoControl( _pipe ); slApplyAccLightProbeAlbedoControl( _pipe ); } #line 650 SLT_COLOR4 slGetAccessoryComposedColor( inout PIPE _pipe ) { slApplyAdditiveRim( _pipe ); slApplyRefraction( _pipe ); SLT_COLOR4 _clOut = _pipe.clDiffuse; if (_pipe.IsExisting( "clSpecular" )) { _clOut.rgb += _pipe.clSpecular; } return _clOut; } #line 677 void slApplyAccessoryTextures( out SLT_COLOR4 _clOut, inout PIPE _pipe ) { slApplyAccessoryTextureStages( _pipe ); _clOut = slGetAccessoryComposedColor( _pipe ); } #line 700 SLT_PARAM_FLOAT2 ktglAlphaRef; #line 714 void slFixedFuncAlphaTest( SLT_COLOR4 _color0 ) { if ( slcGetPlatform() == 0x20004 ) { if ( 0 ) { if ( slcGetMRT1() == 0 ) { if ( _color0.a < ktglAlphaRef.x || ktglAlphaRef.y < _color0.a ) { discard; } } } } } #line 742 void slOutputAccessoryPixel( inout SLT_COLOR4 _color0, inout PIPE _pipe ) { if( slcIsGBuffer() ) { slOutputGBufferPixel( _color0, _pipe ); } else { slClipDissolvedPixel( _pipe ); slApplyScaleColor( _color0 ); slApplyToneMap( _color0 ); slOutputAccUserPixel1( _pipe ); slOutputAccUserPixel2( _pipe ); slOutputAccUserPixel3( _pipe ); slOutputAccUserPixel4( _pipe ); slOutputAccUserPixel5( _pipe ); slOutputMRTPixel( _color0, _pipe ); slOutputSSSPixel( _color0, _pipe ); slFixedFuncAlphaTest( _color0 ); } slOutputPNTrianglesPixel( _color0, _pipe ); } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccessoryFuncKIDS.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slAccWriteDepth.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slAccWriteDepth.fxh" #line 68 int slWriteDepthFormatOption : ACCESSORYOPTION < string Name = "SLO_WRITE_DEPTH_TEXTURE_FORMAT"; int Default = 0; string Description = "Depth buffer format"; string DescriptionJ = "深度バッファフォーマット"; string List = "RGB, ABG, R, A, LinearRGB, LinearABG, LinearR, LinearA"; int RGB = 1; int ABG = 2; int R = 3; int A = 4; int LinearRGB = 5; int LinearABG = 6; int LinearR = 7; int LinearA = 8; >; #line 111 int slWriteDepthAccessory : ACCESSORY < string Name = "WriteRT"; string Modifier = "Wr"; string Macro = "SLC_WRITE_DEPTH_TO_RT"; string Description = "An accessory to write depth value on to RT"; string DescriptionJ = "深度値をレンダーターゲットに書き込むためのアクセサリ"; string Format = "slWriteDepthFormatOption"; string Key = "Depth"; >; #line 136 SLT_BOOL slcWriteRTAccessory() { return 0; } SLT_INT sloGetWriteDepthTextureFormat() { return 1; } SLT_BOOL sloIsWriteDepthLinear() { return (5 <= sloGetWriteDepthTextureFormat()); } #line 46 "D://KTGL/shaderlib2/shader/include/../func/slAccWriteDepth.fx" void slOutputWriteRTVertex(inout PIPE _pipe) { if (slcWriteRTAccessory()) { if (sloIsWriteDepthLinear()) { _pipe.Insert( "fZ", _pipe.vProjPos.z ); } else { _pipe.Insert( "vDepth", _pipe.vProjPos.zw ); } } } #line 64 void slOutputWriteRTPixel(inout SLT_COLOR4 _color0, PIPE _pipe, SLT_COLOR _alpha) { if (slcWriteRTAccessory() && sloGetWriteDepthTextureFormat() != 0) { SLT_FLOAT1 _fDepth; if (sloIsWriteDepthLinear()) { _fDepth = slNormalizeCameraDepth( _pipe.fZ ); } else { _fDepth = _pipe.vDepth.x/_pipe.vDepth.y; } if (sloGetWriteDepthTextureFormat() == 1 || sloGetWriteDepthTextureFormat() == 5) { _color0.rgb = slFloat2RGB(_fDepth); _color0.a = _alpha; } else if (sloGetWriteDepthTextureFormat() == 2 || sloGetWriteDepthTextureFormat() == 6) { _color0.rgb = slFloat2RGB(_fDepth); _color0.a = _alpha; _color0 = _color0.wzyx; } else if (sloGetWriteDepthTextureFormat() == 3 || sloGetWriteDepthTextureFormat() == 7) { _color0.rgb = _fDepth; _color0.a = _alpha; } else if (sloGetWriteDepthTextureFormat() == 4 || sloGetWriteDepthTextureFormat() == 8) { _color0 = _fDepth; } } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slShadowMap.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateShadowMapFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slShadowMapParameters.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" #line 25 "D://KTGL/shaderlib2/shader/include/../func/slShadowMapParameters.fx" SLT_PARAM_FLOAT4x4 mW2S[1] ; #line 33 SLT_PARAM_FLOAT4x4 mP2S[1] ; #line 43 SLT_PARAM_FLOAT4x4 mBW2S[1] ; #line 54 SLT_PARAM_FLOAT4 vCbW2S[2] ; #line 63 SLT_PARAM_FLOAT4 vCbBW2S[2] ; #line 79 SLT_PARAM_FLOAT4 vSMOf[1] ; #line 90 SLT_PARAM_FLOAT4 vS2VZ ; #line 96 SLT_PARAM_FLOAT4 vSMDF ; #line 113 SLT_PARAM_BOOL bSM[3] ; #line 120 SLT_BOOL slIsShadowMapEnabled() { if (slcIsShadowBranchEnabled()) { return bSM[0]; } else { return slcGetSoftShadowType() != 0; } } SLT_BOOL slIsShadowMapSoftOrJitter() { if (slcGetSoftShadowType() != 5 && 2 <= slcGetSoftShadowType()) { return bSM[1]; } else { return false; } } SLT_BOOL slIsShadowMapDitherOrJitter() { if (slcGetSoftShadowType() != 5 && 3 <= slcGetSoftShadowType()) { return bSM[2]; } else { return false; } } #line 157 SLT_PARAM_FLOAT4 scSM ; #line 164 SLT_PARAM_FLOAT4 scSM2 ; #line 176 typedef SLT_SAMPLER_2D SLT_SAMPLER_SHADOWMAP; #line 184 SLT_SAMPLER_SHADOWMAP sShadow < string Description = "Shadow Map"; int Sampler = 33; int Usage = 0; >; #line 196 SLT_PARAM_INT nSSLoop ; #line 211 SLT_PARAM_FLOAT4 vLPlane[2*1] ; #line 221 SLT_PARAM_FLOAT4 sdplane ; #line 230 SLT_SAMPLER_3D sJitter < int Sampler = 34; int Usage = 0; >; #line 246 SLT_PARAM_FLOAT4 jitter ; #line 254 SLT_PARAM_FLOAT4 vS2LZ[2 * 1] ; #line 259 SLT_PARAM_FLOAT fLSize; #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFunction.fx" #line 26 "D://KTGL/shaderlib2/shader/include/../func/private/slPrivateShadowMapFunc.fx" bool slIsShadowValueInverted() { if ( (slcIsAmbientAlphaUsedAsShadow() && (slcIsShadowEnabled() || slpIsPixelLighting())) || slcIsFarShadowErased() ) { return true; } else { return false; } } #line 43 SLT_COLOR slGetShadowValue( SLT_FLOAT _fShadowMapValue, SLT_FLOAT _fDepth ) { SLT_BOOL bShadowed; if (slcGetShadowMapFormat() == 4) { bShadowed = ((1-_fShadowMapValue) < _fDepth); } else { bShadowed = (_fShadowMapValue < _fDepth); } if (slIsShadowValueInverted()) { return bShadowed?1.0f:0.0f; } else { return bShadowed ? 0.0f : 1.0f; } } SLT_COLOR4 slGetShadowValue( SLT_FLOAT4 _vShadowMapValue, SLT_FLOAT4 _vDepth ) { SLT_BOOL4 bShadowed; if (slcGetShadowMapFormat() == 4) { bShadowed = ((1-_vShadowMapValue) < _vDepth); } else { bShadowed = ( _vShadowMapValue < _vDepth ); } if (slIsShadowValueInverted()) { return bShadowed.x && bShadowed.y && bShadowed.z && bShadowed.w ? SLT_COLOR4(1.0f, 1.0f, 1.0f, 1.0f) : SLT_COLOR4(0.0f, 0.0f, 0.0f, 0.0f); } else { return bShadowed.x && bShadowed.y && bShadowed.z && bShadowed.w ? SLT_COLOR4(0.0f, 0.0f, 0.0f, 0.0f) : SLT_COLOR4(1.0f, 1.0f, 1.0f, 1.0f); } } SLT_SHADOWMAP4 _slGetShadowMap2D( SLT_TEXCOORD2 _vTex, PIPE _pipe ) { if (slcIsCascadeShadowMapEnabled()) { _vTex = saturate( _vTex ) * _pipe.vSMScale.xy + _pipe.vSMScale.zw; } if (0x10020 <= slcGetPSProfile() && !slpIsMipMapForShadowMap()) { if (slpIsTextureQueryExtensionForShadowMapEnabled()) { SLT_SHADOWMAP1 _shadow = tex2Dlod( sShadow, SLT_TEXCOORD4( _vTex, 0.0f, 0.0f ) ); return SLT_SHADOWMAP4( _shadow, _shadow, _shadow, _shadow ); } else { return tex2Dlod( sShadow, SLT_TEXCOORD4( _vTex, 0.0f, 0.0f ) ); } } else if (slpIsTextureQueryExtensionForShadowMapEnabled()) { SLT_SHADOWMAP1 _shadow = tex2D( sShadow, _vTex ); return SLT_SHADOWMAP4( _shadow, _shadow, _shadow, _shadow ); } else { return tex2D( sShadow, _vTex ); } } #line 115 SLT_SHADOWMAP1 slExtractShadowDepth( SLT_SHADOWMAP4 _vColor ) { if (slpIsTextureQueryExtensionForShadowMapEnabled()) { return _vColor.r; } else if (slcGetShadowMapFormat() == 5) { Error( "This format is not avairable for shadow map format setting. Use KTGL_SHLIB_SHADOWMAP_FMT_FLOAT or KTGL_SHLIB_SHADOWMAP_FMT_REVERSE_FLOAT instead." ); } else if (slcGetShadowMapFormat() == 0) { return dot( _vColor.rgb, SLT_FLOAT3(255.0f/256.0f, 255.0f/(256.0f*256.0f), 1.0f/(256.0f*256.0f)) ); } else if (slcGetShadowMapFormat() == 1) { return dot( _vColor.rgb, SLT_SHADOWMAP3(31.0f/32.0f, 63.0f/(32.0f*64.0f), 1.0f/(32.0f*64.0f)) ); } else if (slcGetShadowMapFormat() == 2) { return dot( _vColor.rgb, SLT_SHADOWMAP3(31.0f/32.0f, 31.0f/(32.0f*32.0f), 1.0f/(32.0f*32.0f)) ); } else { return _vColor.r; } } SLT_SHADOWMAP2 _slGetDdistDuv( SLT_SHADOWMAP4 _vTexCoords ) { SLT_SHADOWMAP4 dx = ddx( _vTexCoords ); SLT_SHADOWMAP4 dy = ddy( _vTexCoords ); SLT_SHADOWMAP invDet = 1 / (dx.x*dy.y - dx.y*dy.x); SLT_SHADOWMAP2 dist; dist.x = dy.y * dx.w; dist.x -= dx.y * dy.w; dist.y = dx.x * dy.w; dist.y -= dy.x * dx.w; dist *= invDet; return dist; } #line 181 SLT_COLOR1 _slGetHardWareFilteredShadow( SLT_SHADOWMAP4 _vTex, PIPE _pipe ) { if (slcIsCascadeShadowMapEnabled()) { return tex2Dproj( sShadow, SLT_SHADOWMAP4( saturate( _vTex.xy ) * _pipe.vSMScale.xy + _pipe.vSMScale.zw, _vTex.zw ) ).r; } else { return (SLT_COLOR1)tex2Dproj( sShadow, _vTex ); } } #line 198 SLT_COLOR1 _slGetLinearFilteredShadow( SLT_TEXCOORD2 _vTex, SLT_SHADOWMAP1 _fDepth, SLT_SHADOWMAP4 _vShadowPos, PIPE _pipe ) { SLT_TEXCOORD2 _vWeights = _vTex * scSM.zw - SLT_TEXCOORD2(0.5f, 0.5f); _vWeights = frac( _vWeights ); SLT_TEXCOORD2 _tex0 = _vTex - _vWeights * scSM.xy; SLT_TEXCOORD2 _tex3 = _tex0 + scSM.xy; SLT_TEXCOORD2 _tex1 = SLT_TEXCOORD2(_tex3.x, _tex0.y); SLT_TEXCOORD2 _tex2 = SLT_TEXCOORD2(_tex0.x, _tex3.y); SLT_SHADOWMAP4 _vSample; _vSample.x = slExtractShadowDepth( _slGetShadowMap2D( _tex0, _pipe ) ); _vSample.w = slExtractShadowDepth( _slGetShadowMap2D( _tex1, _pipe ) ); _vSample.y = slExtractShadowDepth( _slGetShadowMap2D( _tex2, _pipe ) ); _vSample.z = slExtractShadowDepth( _slGetShadowMap2D( _tex3, _pipe ) ); SLT_COLOR4 _vShadow = slGetShadowValue(_vSample, SLT_SHADOWMAP4(_fDepth,_fDepth,_fDepth,_fDepth)); _vShadow.xy = lerp(_vShadow.xy, _vShadow.wz, (SLT_COLOR)_vWeights.x); SLT_COLOR1 _fShadow = lerp( _vShadow.x, _vShadow.y, (SLT_COLOR)_vWeights.y ); return _fShadow; } #line 225 SLT_COLOR1 _slGetVarianceFilteredShadow( SLT_TEXCOORD2 _vTex, SLT_SHADOWMAP1 _fDepth, SLT_SHADOWMAP4 _vShadowPos, PIPE _pipe ) { SLT_SHADOWMAP2 _vSM = _slGetShadowMap2D( _vTex, _pipe ).rg; SLT_SHADOWMAP1 _variance = saturate( _vSM.y - _vSM.x * _vSM.x ); SLT_SHADOWMAP1 _scale2 = 4.0f; SLT_SHADOWMAP1 _mue = (_fDepth - _vSM.x); SLT_SHADOWMAP1 _fShadow = (_mue > 0.0) ? (_variance / (_variance + _scale2*_mue * _mue)) : 1.0; SLT_SHADOWMAP1 _fThreshold = 1.0f/(_scale2+1.0f); SLT_SHADOWMAP1 _fS2 = smoothstep( _fThreshold, 1.0, _fShadow); _fShadow = min( _fShadow, _fS2 ); return _fShadow; } #line 251 SLT_COLOR1 _slGetSoftwareFilteredShadow( SLT_TEXCOORD2 _vTex, SLT_SHADOWMAP1 _fDepth, SLT_SHADOWMAP4 _vShadowPos, PIPE _pipe ) { if (slcGetShadowMapFilterType() == 0 ) { if (slcIsCascadeShadowMapEnabled()) { return slGetShadowValue( slExtractShadowDepth( _slGetShadowMap2D( _vTex, _pipe ) ), _fDepth ); } else { if (slcIsShadowDepthProjected()) { if (slcIsShadowMapNonDependentPrefered()) { if (slpIsTextureQueryExtensionForShadowMapEnabled()) { return slGetShadowValue( tex2Dproj( sShadow, _vShadowPos.xyw ), _fDepth ); } else { return slGetShadowValue( slExtractShadowDepth( tex2Dproj( sShadow, _vShadowPos.xyw ) ), _fDepth ); } } else { return slGetShadowValue( slExtractShadowDepth( _slGetShadowMap2D( _vTex, _pipe ) ), _fDepth ); } } else { return slGetShadowValue( slExtractShadowDepth( _slGetShadowMap2D( _vTex, _pipe ) ), _fDepth ); } } } else if (slcGetShadowMapFilterType() == 3) { return slGetShadowValue( slExtractShadowDepth( _slGetShadowMap2D( _vTex, _pipe ) ), _fDepth ); } else if (slcGetShadowMapFilterType() == 1) { if (slcIsCascadeShadowMapEnabled()) { return _slGetLinearFilteredShadow( _vTex, _fDepth, _vShadowPos, _pipe ); } else { return _slGetLinearFilteredShadow( _vTex, _fDepth, _vShadowPos, _pipe ); } } else { if (slcIsCascadeShadowMapEnabled()) { return _slGetVarianceFilteredShadow( _vTex, _fDepth, _vShadowPos, _pipe ); } else { return _slGetVarianceFilteredShadow( _vTex, _fDepth, _vShadowPos, _pipe ); } } } #line 309 SLT_COLOR1 slGetProcessedShadow( SLT_SHADOWMAP4 _vShadowPos ) { SLT_COLOR1 _fShadow; if ( slIsShadowMapEnabled() ) { _fShadow = slColorTex2DProj( sShadow, _vShadowPos ).r; } else { _fShadow = 1.0f; } return _fShadow; } #line 328 SLT_COLOR1 _slGetCubeShadowValue( SLT_TEXCOORD3 _vTex, SLT_SHADOWMAP1 _fDepth ) { if (slcGetShadowMapFilterType() == 2) { if (slcGetPSProfile() < 0x10041) { Error("HW_LINEAR_FILTER for CubeShadow is not supported."); } return texCUBEcmp( sShadow, SLT_SHADOWMAP4( _vTex, _fDepth ) ); } else { return slGetShadowValue( saturate( slExtractShadowDepth( texCUBE( sShadow, _vTex ) ) ), _fDepth ); } } #line 347 SLT_COLOR1 _slGetHardShadow( SLT_SHADOWMAP4 _vShadowPos, PIPE _pipe ) { SLT_COLOR1 _fShadow; if (slcGetShadowMappingType() == 2 || slcGetShadowMappingType() == 3) { SLT_SHADOWMAP1 _z = saturate( length( (SLT_SHADOWMAP3)_vShadowPos ) + _vShadowPos.w ); _fShadow = _slGetCubeShadowValue( _vShadowPos.xyz, _z ); } else if (slcGetShadowMapFilterType() == 2) { if (slcIsShadowDepthProjected() && slcIsCascadeShadowMapEnabled()) { _vShadowPos.xyz /= _vShadowPos.w; _vShadowPos.w = 1.0f; } else if (slcGetPlatform() == 0x40001) { _vShadowPos = _vShadowPos / _vShadowPos.w; _vShadowPos.z = min( _vShadowPos.z, 0.999999f ); } _fShadow = _slGetHardWareFilteredShadow( _vShadowPos, _pipe ); if (slIsShadowValueInverted()) { _fShadow = 1.0f - _fShadow; } } else { if (slcIsShadowDepthProjected()) { SLT_SHADOWMAP3 _vTex = _vShadowPos.xyz / _vShadowPos.w; if (0 && slcGetPlatform() == 0x40001) { _vTex.z = min( _vTex.z, 0.999999f ); } else { _vTex.z = saturate( _vTex.z ); } _fShadow = _slGetSoftwareFilteredShadow( _vTex.xy, _vTex.z, _vShadowPos, _pipe ); } else { _fShadow = _slGetSoftwareFilteredShadow( _vShadowPos.xy, saturate( _vShadowPos.z ), _vShadowPos, _pipe ); } } return _fShadow; } #line 401 SLT_COLOR1 _slGetSoftShadow( SLT_SHADOWMAP4 _vShadowPos, PIPE _pipe ) { SLT_COLOR1 _sum = 0; #line 417 if (slcGetShadowMapFilterType() == 2) { if (slcIsShadowDepthProjected()) { _vShadowPos.xyz /= _vShadowPos.w; } _vShadowPos.xy += scSM2.xy; _vShadowPos.w = 1.0f; SLT_SHADOWMAP4 _tex; _tex = _vShadowPos; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _vShadowPos.y += scSM.y; _tex = _vShadowPos; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _vShadowPos.y += scSM.y; _tex = _vShadowPos; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _vShadowPos.y += scSM.y; _tex = _vShadowPos; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM.x; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); if (slIsShadowValueInverted()) { return 1.0f - _sum / 16.0f; } } else { SLT_TEXCOORD2 _vTex; SLT_SHADOWMAP1 _fDepth; if (slcIsShadowDepthProjected()) { SLT_SHADOWMAP3 _vTemp = _vShadowPos.xyz / _vShadowPos.w; _vTex = (SLT_TEXCOORD2)(_vTemp.xy + scSM2.xy); _fDepth = saturate( _vTemp.z ); } else { _vTex = (SLT_TEXCOORD2)(_vShadowPos.xy + scSM2.xy); _fDepth = saturate( _vShadowPos.z ); } SLT_TEXCOORD2 _tex; _tex = _vTex; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _vTex.y += scSM.y; _tex = _vTex; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _vTex.y += scSM.y; _tex = _vTex; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _vTex.y += scSM.y; _tex = _vTex; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM.x; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); } return _sum / 16.0f; } #line 532 SLT_COLOR1 _slGetDitherSoftShadow( SLT_SHADOWMAP4 _vShadowPos, SLT_TEXCOORD2 _vDither, PIPE _pipe ) { SLT_TEXCOORD2 _vOffset = _vDither * scSM2.zw + scSM2.xy; SLT_COLOR1 _sum = 0.0; #line 551 if (slcGetShadowMappingType() == 2) { SLT_SHADOWMAP1 _z = saturate( length( (SLT_SHADOWMAP3)_vShadowPos ) + _vShadowPos.w ); SLT_SHADOWMAP3 _vAbsShadowPos = abs( _vShadowPos.xyz ); SLT_SHADOWMAP1 _fMaxAbsPos = max( max( _vAbsShadowPos.x, _vAbsShadowPos.y ), _vAbsShadowPos.z ); _vShadowPos.xyz /= _fMaxAbsPos; SLT_TEXCOORD3 _vOffs1, _vOffs2; if (_fMaxAbsPos == _vAbsShadowPos.x) { _vOffs1 = SLT_TEXCOORD3( 0.0, 0.0, scSM2.z ); _vOffs2 = SLT_TEXCOORD3( 0.0, scSM2.w, 0.0 ); _vShadowPos.zy += _vOffset; } else if (_fMaxAbsPos == _vAbsShadowPos.y) { _vOffs1 = SLT_TEXCOORD3( scSM2.z, 0.0, 0.0 ); _vOffs2 = SLT_TEXCOORD3( 0.0, 0.0, scSM2.w ); _vShadowPos.xz += _vOffset; } else { _vOffs1 = SLT_TEXCOORD3( scSM2.z, 0.0, 0.0 ); _vOffs2 = SLT_TEXCOORD3( 0.0, scSM2.w, 0.0 ); _vShadowPos.xy += _vOffset; } SLT_TEXCOORD3 _tex; _tex = _vShadowPos.xyz; _sum += _slGetCubeShadowValue( _tex, _z ); _tex += _vOffs1; _sum += _slGetCubeShadowValue( _tex, _z ); _tex = _vShadowPos.xyz + _vOffs2; _sum += _slGetCubeShadowValue( _tex, _z ); _tex += _vOffs1; _sum += _slGetCubeShadowValue( _tex, _z ); } else { if (slcGetShadowMapFilterType() == 2) { if (slcIsShadowDepthProjected()) { _vShadowPos.xyz /= _vShadowPos.w; } _vShadowPos.xy += _vOffset; _vShadowPos.w = 1.0f; SLT_SHADOWMAP4 _tex; _tex = _vShadowPos; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM2.z; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _vShadowPos.y += scSM2.w; _tex = _vShadowPos; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); _tex.x += scSM2.z; _sum += _slGetHardWareFilteredShadow( _tex, _pipe ); if (slIsShadowValueInverted()) { return 1.0f - _sum * 0.25f; } } else { SLT_TEXCOORD2 _vTex; SLT_SHADOWMAP1 _fDepth; if (slcIsShadowDepthProjected()) { SLT_SHADOWMAP3 _vTemp = _vShadowPos.xyz / _vShadowPos.w; _vTex = (SLT_TEXCOORD2)(_vTemp.xy + _vOffset); _fDepth = saturate( _vTemp.z ); } else { _vTex = (SLT_TEXCOORD2)(_vShadowPos.xy + _vOffset); _fDepth = saturate( _vShadowPos.z ); } SLT_TEXCOORD2 _tex; _tex = _vTex; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM2.z; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _vTex.y += scSM2.w; _tex = _vTex; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); _tex.x += scSM2.z; _sum += _slGetSoftwareFilteredShadow( _tex, _fDepth, _vShadowPos, _pipe ); } } return _sum * 0.25f; } #line 650 SLT_SHADOWMAP4 _slGetShadowMapTexCoordForLOD(SLT_SHADOWMAP4 _vTex) { if (slcIsShadowDepthProjected()) { return SLT_SHADOWMAP4(_vTex.xyz / _vTex.w, 0); } else { return SLT_SHADOWMAP4(_vTex.xyz, 0); } } SLT_COLOR1 _slGetJitterSoftShadow( SLT_SHADOWMAP4 _vShadowPos, SLT_TEXCOORD2 _vScreenPos, SLT_SHADOWMAP4 _vLPlane0, SLT_SHADOWMAP4 _vLPlane1 ) { SLT_COLOR1 _fShadow = 0; if (slcGetShadowMapFilterType() == 2) { SLT_SHADOWMAP4 _vTex; SLT_TEXCOORD4 _vJTex = SLT_TEXCOORD4( _vScreenPos * (SLT_TEXCOORD2)jitter, 0, 0 ); SLT_TEXCOORD4 _vJitter; for ( SLT_INT i = 0; i < 8/2; ++i ) { _vJitter = 2.0f * tex3Dlod( sJitter, _vJTex ) - 1.0f; _vJTex.z += 0.03125f; _vTex = _vShadowPos + _vJitter.x * _vLPlane0; _vTex += _vJitter.y * _vLPlane1; _fShadow += (SLT_COLOR1)tex2Dlod( sShadow, SLT_SHADOWMAP4(_vTex.xyz / _vTex.w, 0) ); _vTex = _vShadowPos + _vJitter.z * _vLPlane0; _vTex += _vJitter.w * _vLPlane1; _fShadow += (SLT_COLOR1)tex2Dlod( sShadow, SLT_SHADOWMAP4(_vTex.xyz / _vTex.w, 0) ); } if ( 0 < _fShadow ) { if ( _fShadow < 8 ) { for ( SLT_INT i = 0; i < nSSLoop; ++i ) { _vJitter = 2.0f * tex3Dlod( sJitter, _vJTex ) - 1.0f; _vJTex.z += 0.03125f; _vTex = _vShadowPos + _vJitter.x * _vLPlane0; _vTex += _vJitter.y * _vLPlane1; _fShadow += (SLT_COLOR1)tex2Dlod( sShadow, SLT_SHADOWMAP4(_vTex.xyz / _vTex.w, 0) ); _vTex = _vShadowPos + _vJitter.z * _vLPlane0; _vTex += _vJitter.w * _vLPlane1; _fShadow += (SLT_COLOR1)tex2Dlod( sShadow, SLT_SHADOWMAP4(_vTex.xyz / _vTex.w, 0) ); } _fShadow *= jitter.z; } else { _fShadow = 1.0f; } } if (slIsShadowValueInverted()) { _fShadow = 1.0f - _fShadow; } } else { SLT_SHADOWMAP4 _vTex; SLT_TEXCOORD4 _vJTex = SLT_TEXCOORD4( _vScreenPos * (SLT_TEXCOORD2)jitter, 0, 0 ); SLT_TEXCOORD4 _vJitter; SLT_SHADOWMAP1 _fDepth; if (slcIsShadowDepthProjected()) { _fDepth = saturate( _vShadowPos.z/_vShadowPos.w ); } else { _fDepth = saturate( _vShadowPos.z ); } for ( SLT_INT i = 0; i < 8/2; ++i ) { _vJitter = 2.0f * tex3Dlod( sJitter, _vJTex ) - 1.0f; _vJTex.z += 0.03125f; _vTex = _vShadowPos + _vJitter.x * _vLPlane0; _vTex += _vJitter.y * _vLPlane1; SLT_SHADOWMAP1 _fSample = slExtractShadowDepth( tex2Dlod( sShadow, _slGetShadowMapTexCoordForLOD(_vTex) ) ); SLT_SHADOWMAP1 _fDiff = _fDepth - _fSample; SLT_COLOR1 _fTemp = slGetShadowValue( 0.0f, _fDiff ); _fShadow += _fTemp; _vTex = _vShadowPos + _vJitter.z * _vLPlane0; _vTex += _vJitter.w * _vLPlane1; _fSample = slExtractShadowDepth( tex2Dlod( sShadow, _slGetShadowMapTexCoordForLOD(_vTex) ) ); _fDiff = _fDepth - _fSample; _fTemp = slGetShadowValue( 0.0f, _fDiff ); _fShadow += _fTemp; } if ( 0 < _fShadow ) { if ( _fShadow < 8 ) { for ( SLT_INT i = 0; i < nSSLoop; ++i ) { _vJitter = 2.0f * tex3Dlod( sJitter, _vJTex ) - 1.0f; _vJTex.z += 0.03125f; _vTex = _vShadowPos + _vJitter.x * _vLPlane0; _vTex += _vJitter.y * _vLPlane1; _fShadow += slGetShadowValue( slExtractShadowDepth( tex2Dlod( sShadow, _slGetShadowMapTexCoordForLOD(_vTex) ) ), _fDepth ); _vTex = _vShadowPos + _vJitter.z * _vLPlane0; _vTex += _vJitter.w * _vLPlane1; _fShadow += slGetShadowValue( slExtractShadowDepth( tex2Dlod( sShadow, _slGetShadowMapTexCoordForLOD(_vTex) ) ), _fDepth ); } _fShadow *= jitter.z; } else { _fShadow = 1.0f; } } } return _fShadow; } #line 795 SLT_SAMPLER_2D sShadowPointSampler < string Description = "Shadow Point Sampler"; int Sampler = 35; int Usage = 0; >; SLT_COLOR1 _slGetPercentageCloserSoftShadow( SLT_SHADOWMAP4 _vShadowPos, SLT_TEXCOORD2 _vDither, PIPE _pipe ) { SLT_COLOR1 _fShadow = 0; if ((slcGetShadowMapFilterType() == 2) && (slcGetPSProfile() < 0x10041)) { _fShadow = 1.0f; } else { SLT_SHADOWMAP1 _fDepth; if (slcGetShadowMappingType() == 2) { _fDepth = length( _vShadowPos.xyz ) + _vShadowPos.w; } else if (slcIsShadowDepthProjected()) { _fDepth = _vShadowPos.z / _vShadowPos.w; } else { _fDepth = _vShadowPos.z; } if (slcIsCascadeShadowMapEnabled()) { _vShadowPos.xy = saturate( _vShadowPos.xy ) * _pipe.vSMScale.xy + _pipe.vSMScale.zw; _pipe.vLPlane0.xy *= _pipe.vSMScale.xy; _pipe.vLPlane1.xy *= _pipe.vSMScale.xy; } SLT_TEXCOORD2 _vOffset = _vDither - SLT_TEXCOORD2(0.25f, 0.25f); SLT_HALF _nShadowNum = 0; SLT_HALF _fShadowDepth = 0; SLT_VECTOR1 _fRadius; if (slcGetShadowMappingType() == 2) { _fRadius = _fDepth * _pipe.vLPlane2.z / (3 * 2); } else { _fRadius = dot( _vShadowPos.xyz, _pipe.vLPlane2.xyz ) / 3; } SLT_VECTOR4 _vecX = _pipe.vLPlane0 * _fRadius; SLT_VECTOR4 _vecY = _pipe.vLPlane1 * _fRadius; SLT_SHADOWMAP4 _vTex; SLT_SHADOWMAP4 _vTemp; _vTemp = _vShadowPos + _vecX * _vOffset.x + _vecY * _vOffset.y; [unroll] for ( SLT_INT i = 0 ; i < 3 ; ++i ) { [unroll] for ( SLT_INT j = 0 ; j < 3 ; ++j ) { _vTex = _vTemp + _vecX * ( i - (3 - 1)/2 ) + _vecY * ( j - (3 - 1)/2 ); if (slcGetShadowMappingType() == 2) { if (slcGetShadowMapFilterType() == 2) { _fShadowDepth = texCUBEsmp( sShadow, sShadowPointSampler, _vTex.xyz ).r; } else { _fShadowDepth = slExtractShadowDepth( texCUBElod( sShadow, SLT_SHADOWMAP4( _vTex.xyz, 0.0 ) ) ); } } else { if (slcGetShadowMapFilterType() == 2) { _fShadowDepth = tex2Dsmp( sShadow, sShadowPointSampler, _vTex.xy / _vTex.w ).r; } else { _fShadowDepth = slExtractShadowDepth( tex2Dlod( sShadow, SLT_SHADOWMAP4(_vTex.xyz / _vTex.w, 0) ) ); } } _nShadowNum += ( _fShadowDepth < saturate( _fDepth ) ? 1 : 0 ); _fShadow += ( _fShadowDepth < saturate( _fDepth ) ? _fShadowDepth : 0 ); } } if ( 0.5f < _nShadowNum ) { int _nSSLoop = nSSLoop; _fShadowDepth = _fShadow / _nShadowNum; if (slcGetShadowMappingType() == 2) { _fRadius = (_fDepth - _fShadowDepth) * _pipe.vLPlane2.z; } else { _vTemp = SLT_SHADOWMAP4( _vShadowPos.xy / _vShadowPos.w, _fShadowDepth, 1.0f ); _fRadius = ( dot( ( _vShadowPos - _vTemp ).xyz , _pipe.vLPlane2.xyz) ); } if (slcGetShadowMapFilterType() == 2) { _nSSLoop = max( min( _nSSLoop, _fRadius * scSM.z * 2 ), 2 ); } _fRadius /= _nSSLoop; _vecX = _pipe.vLPlane0 * _fRadius; _vecY = _pipe.vLPlane1 * _fRadius; _fShadow = 0; _vTemp = _vShadowPos + _vecX * _vOffset.x + _vecY * _vOffset.y; for ( SLT_INT i = 0 ; i < _nSSLoop ; ++i ) { for ( SLT_INT j = 0 ; j < _nSSLoop ; ++j ) { _vTex = _vTemp + _vecX * ( i - (_nSSLoop - 1) * 0.5 ) + _vecY * ( j - (_nSSLoop - 1) * 0.5 ); if (slcGetShadowMappingType() != 2) { _vTex = SLT_SHADOWMAP4(_vTex.xyz / _vTex.w, 0); } if (slcIsCascadeShadowMapEnabled()) { _vTex.xy = clamp( _vTex.xy, _pipe.vSMMinTex, _pipe.vSMMaxTex ); } if (slcGetShadowMappingType() == 2) { if (slcGetShadowMapFilterType() == 2) { _fShadow += texCUBEcmp( sShadow, SLT_SHADOWMAP4( _vTex.xyz, saturate( _fDepth ) ) ); } else { _fShadow += ( slExtractShadowDepth( texCUBElod( sShadow, SLT_SHADOWMAP4( _vTex.xyz, 0.0 ) ) ) < saturate( _fDepth ) ? 0 : 1 ); } } else { if (slcGetShadowMapFilterType() == 2) { _fShadow += tex2Dproj( sShadow, SLT_SHADOWMAP4( _vTex.xy, _fDepth, 1.0 ) ); } else { _fShadow += ( slExtractShadowDepth( tex2Dlod( sShadow, _vTex ) ) < saturate( _fDepth ) ? 0 : 1 ); } } } } _fShadow = _fShadow / ( _nSSLoop * _nSSLoop ); } else { _fShadow = 1.0f; } } if (slIsShadowValueInverted()) { _fShadow = 1.0f - _fShadow; } return _fShadow; } #line 989 static const SLT_FLOAT fCHSWeights0[11 * 11] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 0.8, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 1.0, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 0.8, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, }; static const SLT_FLOAT fCHSWeights1[11 * 11] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, }; static const SLT_FLOAT fCHSWeights2[11 * 11] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.2, 0.0, 0.0, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, }; static const SLT_FLOAT fCHSWeights3[11 * 11] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, }; #line 1049 SLT_HALF _slCalcCHSWeight( SLT_INT _nRow, SLT_INT _nCol, SLT_HALF _fRatio ) { SLT_HALF _fRatio2 = _fRatio * _fRatio; SLT_HALF _fInvRatio = 1.0 - _fRatio; SLT_HALF _fInvRatio2 = _fInvRatio * _fInvRatio; SLT_INT _nIdx = _nRow * 11 + _nCol; return fCHSWeights0[_nIdx] * _fInvRatio2 * _fInvRatio + fCHSWeights1[_nIdx] * 3.0f * _fInvRatio2 * _fRatio + fCHSWeights2[_nIdx] * 3.0f * _fRatio2 * _fInvRatio + fCHSWeights3[_nIdx] * _fRatio2 * _fRatio; } #line 1065 SLT_BOOL _slcIsGatherAvailable() { if ((slcGetPSProfile() >= 0x10041) && (slcGetShadowMapFormat() == 3 || slcGetShadowMapFormat() == 4)) { return true; } else { return false; } } #line 1082 SLT_SHADOWMAP4 _slGetShadowDepth4( SLT_TEXCOORD2 _vTex, SLT_INT2 _vOffs, PIPE _pipe ) { SLT_SHADOWMAP4 _vDepth; if (_slcIsGatherAvailable()) { if (slcIsCascadeShadowMapEnabled()) { SLT_TEXCOORD2 _vMinTex = _pipe.vSMMinTex; SLT_TEXCOORD2 _vMaxTex = _pipe.vSMMaxTex; _vTex = clamp( _vTex + _vOffs * scSM.xy, _vMinTex, _vMaxTex ); _vDepth = GatherRed( sShadow, _vTex ); } else { _vDepth = GatherRed( sShadow, _vTex + _vOffs * scSM.xy ); } } else { _vTex += _vOffs * scSM.xy; SLT_TEXCOORD2 _vOffs2 = scSM.xy * 0.5; if (slcIsCascadeShadowMapEnabled()) { SLT_TEXCOORD2 _vMinTex = _pipe.vSMMinTex; SLT_TEXCOORD2 _vMaxTex = _pipe.vSMMaxTex; _vDepth.r = slExtractShadowDepth( tex2D( sShadow, clamp( _vTex + SLT_TEXCOORD2( -_vOffs2.x, _vOffs2.y ), _vMinTex, _vMaxTex ) ) ); _vDepth.g = slExtractShadowDepth( tex2D( sShadow, clamp( _vTex + SLT_TEXCOORD2( _vOffs2.x, _vOffs2.y ), _vMinTex, _vMaxTex ) ) ); _vDepth.b = slExtractShadowDepth( tex2D( sShadow, clamp( _vTex + SLT_TEXCOORD2( _vOffs2.x, -_vOffs2.y ), _vMinTex, _vMaxTex ) ) ); _vDepth.a = slExtractShadowDepth( tex2D( sShadow, clamp( _vTex + SLT_TEXCOORD2( -_vOffs2.x, -_vOffs2.y ), _vMinTex, _vMaxTex ) ) ); } else { _vDepth.r = slExtractShadowDepth( tex2D( sShadow, _vTex + SLT_TEXCOORD2( -_vOffs2.x, _vOffs2.y ) ) ); _vDepth.g = slExtractShadowDepth( tex2D( sShadow, _vTex + SLT_TEXCOORD2( _vOffs2.x, _vOffs2.y ) ) ); _vDepth.b = slExtractShadowDepth( tex2D( sShadow, _vTex + SLT_TEXCOORD2( _vOffs2.x, -_vOffs2.y ) ) ); _vDepth.a = slExtractShadowDepth( tex2D( sShadow, _vTex + SLT_TEXCOORD2( -_vOffs2.x, -_vOffs2.y ) ) ); } } return _vDepth; } #line 1132 SLT_SHADOWMAP1 _slShadow2LinearDepth( SLT_TEXCOORD2 _vTex, SLT_SHADOWMAP1 _fDepth, PIPE _pipe ) { if (!slcIsShadowDepthProjected() && !slcIsCascadeProjectionShadowMapEnabled()) { return _fDepth * -_pipe.vS2LZ0.z; } else { SLT_SHADOWMAP4 _vShadowPos = SLT_SHADOWMAP4( (SLT_SHADOWMAP2)_vTex, _fDepth, 1.0 ); SLT_SHADOWMAP1 _fZ = dot( _pipe.vS2LZ0, _vShadowPos ); SLT_SHADOWMAP1 _fW = dot( _pipe.vS2LZ1, _vShadowPos ); return -_fZ / _fW; } } #line 1152 SLT_COLOR1 _slGetContactHardeningShadow( SLT_SHADOWMAP4 _vShadowPos, PIPE _pipe ) { if (slcGetShadowMapFilterType() == 2) { Error( "Can't be used together Contact Hardening Shadow and HW Linear Filter." ); } if (slcIsShadowDepthProjected()) { _vShadowPos /= _vShadowPos.w; } SLT_TEXCOORD2 _vTex = _vShadowPos.xy; if (slcIsCascadeShadowMapEnabled()) { bool4 _vOut = bool4( bool2( _vTex.xy < 0.0 ), bool2( _vTex.xy > 1.0 ) ); if ( any( _vOut ) ) { return 1.0; } else { _vTex.xy = _vTex.xy * _pipe.vSMScale.xy + _pipe.vSMScale.zw; } if (_slcIsGatherAvailable()) { _pipe.vSMMaxTex -= scSM.xy; _pipe.vSMMinTex += scSM.xy; } else { _pipe.vSMMaxTex -= scSM.xy * 0.5; _pipe.vSMMinTex += scSM.xy * 0.5; if (slcGetPlatform() == 0x10009 || slcGetPlatform() == 0x30002) { _pipe.vSMMaxTex -= scSM.xy * 0.5; _pipe.vSMMinTex -= scSM.xy * 0.5; } } } SLT_TEXCOORD2 _vFrac; { SLT_TEXCOORD2 _vShadowMapSize = (SLT_TEXCOORD2)scSM.zw; SLT_TEXCOORD2 _vInvShadowMapSize = (SLT_TEXCOORD2)scSM.xy; SLT_TEXCOORD2 _vTexelHalfOffs = (_vTex.xy * _vShadowMapSize) + SLT_TEXCOORD2( 0.5, 0.5 ); SLT_TEXCOORD2 _vTexel = floor( _vTexelHalfOffs ); _vFrac = _vTexelHalfOffs - _vTexel; _vTex -= (_vFrac * _vInvShadowMapSize); } SLT_HALF4 _vZero = (SLT_SHADOWMAP4)0.0; SLT_HALF4 _vOne = (SLT_SHADOWMAP4)1.0; SLT_SHADOWMAP4 _vPixDepth = saturate(_vShadowPos.zzzz); SLT_HALF _fBlockerCount = 0.0; SLT_SHADOWMAP1 _fBlockerDepthSum = 0.0; #line 1217 SLT_INT _nRow, _nCol; for (_nRow = -(11 / 2); _nRow <= (11 / 2); _nRow += 2) { #line 1225 for (_nCol = -(11 / 2); _nCol <= (11 / 2); _nCol += 2) { SLT_SHADOWMAP4 _vDepth4 = _slGetShadowDepth4( _vTex, SLT_INT2( _nCol, _nRow ), _pipe ); SLT_HALF4 _vBlock = (_vPixDepth <= _vDepth4) ? _vZero : _vOne; _fBlockerCount += dot( _vBlock, _vOne ); _fBlockerDepthSum += dot( _vDepth4, _vBlock ); #line 1243 } } if (_fBlockerCount == 0.0f) { return 1.0; } else if (_fBlockerCount >= ((11 + 1) * (11 + 1) - 0.1)) { return 0.0; } else { SLT_SHADOWMAP1 _fBlockerDepthAvg = _fBlockerDepthSum / _fBlockerCount; _fBlockerDepthAvg = _slShadow2LinearDepth( _vShadowPos.xy, _fBlockerDepthAvg, _pipe ); _vShadowPos.z = _slShadow2LinearDepth( _vShadowPos.xy, _vShadowPos.z, _pipe ); SLT_HALF _fRatio = saturate( (_vShadowPos.z - _fBlockerDepthAvg) * abs( fLSize ) ); _fRatio *= _fRatio; #line 1285 SLT_HALF _fWeightSum = 0.0; for (_nRow = 0; _nRow < 11; _nRow++) { for (_nCol = 0; _nCol < 11; _nCol++) { _fWeightSum += _slCalcCHSWeight( _nRow, _nCol, _fRatio ); } } SLT_SHADOWMAP4 _vCurr[(11 / 2) + 1]; SLT_SHADOWMAP2 _vPrev[(11 / 2) + 1]; _vPrev[0] = SLT_SHADOWMAP2( 0, 0 ); SLT_SHADOWMAP1 _fShadow = 0.0; for (_nRow = -(11 / 2); _nRow <= (11 / 2); _nRow += 2) { #line 1305 for (_nCol = -(11 / 2); _nCol <= (11 / 2); _nCol += 2) { SLT_UINT _nIdx = ((SLT_UINT)(_nCol + (11 / 2))) / 2; #line 1321 SLT_SHADOWMAP4 _vDepth4 = _slGetShadowDepth4( _vTex, SLT_INT2( _nCol, _nRow ), _pipe ); _vCurr[_nIdx] = (_vPixDepth <= _vDepth4) ? _vOne : _vZero; { SLT_HALF _fWeightC, _fWeightL, _fWeightR; _fWeightC = _slCalcCHSWeight( _nRow + (11 / 2), _nCol + ((11 / 2) + 0), _fRatio ); if (_nCol != -(11 / 2)) { _fWeightL = _slCalcCHSWeight( _nRow + (11 / 2), _nCol + ((11 / 2) - 1), _fRatio ); } else { _fWeightL = 0.0; } if (_nCol != (11 / 2)) { _fWeightR = _slCalcCHSWeight( _nRow + (11 / 2), _nCol + ((11 / 2) + 1), _fRatio ); } else { _fWeightR = 0.0; } _fShadow += (1 - _vFrac.y) * ( _vCurr[_nIdx].w * (_vFrac.x * (_fWeightL - _fWeightC) + _fWeightC) + _vCurr[_nIdx].z * (_vFrac.x * (_fWeightC - _fWeightR) + _fWeightR) ); _fShadow += ( _vFrac.y) * ( _vCurr[_nIdx].x * (_vFrac.x * (_fWeightL - _fWeightC) + _fWeightC) + _vCurr[_nIdx].y * (_vFrac.x * (_fWeightC - _fWeightR) + _fWeightR) ); if (_nRow > -(11 / 2)) { SLT_HALF _fWeightUC, _fWeightUL, _fWeightUR; _fWeightUC = _slCalcCHSWeight( _nRow + ((11 / 2) - 1), _nCol + ((11 / 2) + 0), _fRatio ); if (_nCol != -(11 / 2)) { _fWeightUL = _slCalcCHSWeight( _nRow + ((11 / 2) - 1), _nCol + ((11 / 2) - 1), _fRatio ); } else { _fWeightUL = 0.0; } if (_nCol != (11 / 2)) { _fWeightUR = _slCalcCHSWeight( _nRow + ((11 / 2) - 1), _nCol + ((11 / 2) + 1), _fRatio ); } else { _fWeightUR = 0.0f; } _fShadow += (1 - _vFrac.y) * ( _vPrev[_nIdx].x * (_vFrac.x * (_fWeightUL - _fWeightUC) + _fWeightUC) + _vPrev[_nIdx].y * (_vFrac.x * (_fWeightUC - _fWeightUR) + _fWeightUR) ); _fShadow += ( _vFrac.y) * ( _vCurr[_nIdx].w * (_vFrac.x * (_fWeightUL - _fWeightUC) + _fWeightUC) + _vCurr[_nIdx].z * (_vFrac.x * (_fWeightUC - _fWeightUR) + _fWeightUR) ); } } if (_nRow != (11 / 2)) { _vPrev[_nIdx] = _vCurr[_nIdx].xy; _fShadow += _vPrev[_nIdx].x * 0.0; } } } return _fShadow / _fWeightSum; } } #line 1 "D://KTGL/shaderlib2/shader/include/../func/../func/slGeometry.fx" #line 42 "D://KTGL/shaderlib2/shader/include/../func/slShadowMap.fx" SLT_POINT4x4 slGetMatrixW2S(uniform SLT_INT _n = 0) { return mW2S[_n]; } #line 52 SLT_POINT4x4 slGetMatrixP2S(uniform SLT_INT _n = 0) { return mP2S[_n]; } #line 69 SLT_SHADOWMAP4 slGetShadowMapFacePositionFromProjection( SLT_POINT4 _pos, uniform SLT_INT _n ) { SLT_SHADOWMAP4 _vShadowPos; if (slcGetShadowMappingType() == 5) { _vShadowPos.x = 0.5f * _pos.x + 0.5f * _pos.w; _vShadowPos.y = slcGetRenderTargetUpDir() * 0.5f * _pos.y + 0.5f * _pos.w; _vShadowPos.zw = _pos.zw; } else { _vShadowPos = (SLT_SHADOWMAP4)slApplyMatrix( slGetMatrixP2S(_n), _pos ); } if (slcGetShadowMappingType() == 2) { _vShadowPos.z = -_vShadowPos.z; } return _vShadowPos; } #line 100 SLT_SHADOWMAP4 slGetShadowMapFacePositionFromWorld( SLT_POINT4 _pos, uniform SLT_INT _n ) { SLT_SHADOWMAP4 _vShadowPos; if (slcGetShadowMappingType() == 5) { _pos = slApplyMatrix( slGetMatrixW2P(), _pos ); _vShadowPos = slGetShadowMapFacePositionFromProjection(_pos, _n); } else if (slcGetShadowMappingType() == 2) { SLT_POINT3 _lightPos = vCbW2S[0].xyz; SLT_POINT _depthScale = vCbW2S[0].w; SLT_POINT _depthOffset = vCbW2S[1].x; _vShadowPos.xyz = ((SLT_POINT3)_pos + _lightPos) * _depthScale; _vShadowPos.z = -_vShadowPos.z; _vShadowPos.w = _depthOffset; } else { _vShadowPos = (SLT_SHADOWMAP4)slApplyMatrix( slGetMatrixW2S(_n), _pos ); } return _vShadowPos; } SLT_SHADOWMAP4 slGetShadowMapPositionFromBypass( SLT_POINT4 _pos, uniform SLT_INT _n ) { SLT_SHADOWMAP4 _vShadowPos; if (slcGetShadowMappingType() == 5) { _pos = slApplyMatrix( slGetMatrixW2P(), _pos ); _vShadowPos = slGetShadowMapFacePositionFromProjection(_pos, _n); } else if (slcGetShadowMappingType() == 2) { SLT_POINT3 _lightPos = vCbBW2S[0].xyz; SLT_POINT _depthScale = vCbBW2S[0].w; SLT_POINT _depthOffset = vCbBW2S[1].x; _vShadowPos.xyz = ((SLT_POINT3)_pos + _lightPos) * _depthScale; _vShadowPos.z = -_vShadowPos.z; _vShadowPos.w = _depthOffset; } else { _vShadowPos = (SLT_SHADOWMAP4)slApplyMatrix( mBW2S[_n], _pos ); } return _vShadowPos; } #line 167 SLT_SHADOWMAP4 slGetShadowMapFacePosition( PIPE _pipe, uniform SLT_INT _n ) { SLT_SHADOWMAP4 _vShadowPos; if (slcGetShadowMappingType() == 5) { _vShadowPos = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, _n ); } else { if (slpIsWorldPositionComputed() || slcIsWorldSpaceUsedForInstancing()) { if (slcIsBypassWorldTransform()) { _vShadowPos = slGetShadowMapPositionFromBypass( _pipe.vBypass, _n ); } else { _vShadowPos = slGetShadowMapFacePositionFromWorld( _pipe.vWorldPos, _n ); } } else { if ( slpIsBlendingVertices() ) { if (slcIsBypassWorldTransform()) { _vShadowPos = slGetShadowMapPositionFromBypass( _pipe.vBypass, _n ); } else { _vShadowPos = slGetShadowMapFacePositionFromWorld( _pipe.vWorldPos, _n ); } } else { _vShadowPos = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, _n ); } } } return _vShadowPos; } #line 216 void slInsertShadowMapPosition( inout PIPE _pipe ) { if (!slcIsShadowEnabled()) { return; } _pipe.Insert( "floatinterpolation ""SLT_SHADOWMAP4", "vShadowPos0" ); _pipe.vShadowPos0 = slGetShadowMapFacePosition( _pipe, 0 ); if (slcGetShadowMapMatrixNum() > 1) { _pipe.Insert( "floatinterpolation ""SLT_SHADOWMAP4", "vShadowPos1" ); _pipe.vShadowPos1 = slGetShadowMapFacePosition( _pipe, 1 ); if (slcGetShadowMapMatrixNum() > 2) { _pipe.Insert( "floatinterpolation ""SLT_SHADOWMAP4", "vShadowPos2" ); _pipe.vShadowPos2 = slGetShadowMapFacePosition( _pipe, 2 ); if (slcGetShadowMapMatrixNum() > 3) { _pipe.Insert( "floatinterpolation ""SLT_SHADOWMAP4", "vShadowPos3" ); _pipe.vShadowPos3 = slGetShadowMapFacePosition( _pipe, 3 ); } } } } #line 248 void slInsertShadowMapPositionFromWorld( inout PIPE _pipe ) { if (!slcIsShadowEnabled()) { return; } _pipe.Insert( "floatinterpolation ""SLT_SHADOWMAP4", "vShadowPos0" ); _pipe.vShadowPos0 = slGetShadowMapFacePositionFromWorld( _pipe.vWorldPos, 0 ); if (slcGetShadowMapMatrixNum() > 1) { _pipe.Insert( "floatinterpolation ""SLT_SHADOWMAP4", "vShadowPos1" ); _pipe.vShadowPos1 = slGetShadowMapFacePositionFromWorld( _pipe.vWorldPos, 1 ); if (slcGetShadowMapMatrixNum() > 2) { _pipe.Insert( "floatinterpolation ""SLT_SHADOWMAP4", "vShadowPos2" ); _pipe.vShadowPos2 = slGetShadowMapFacePositionFromWorld( _pipe.vWorldPos, 2 ); if (slcGetShadowMapMatrixNum() > 3) { _pipe.Insert( "floatinterpolation ""SLT_SHADOWMAP4", "vShadowPos3" ); _pipe.vShadowPos3 = slGetShadowMapFacePositionFromWorld( _pipe.vWorldPos, 3 ); } } } } #line 279 void slInsertShadowMapPositionFromProjection( inout PIPE _pipe ) { if (!slcIsShadowEnabled()) { return; } SLT_SHADOWMAP4 _vShadowPos = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, 0 ); _pipe.Insert( "vShadowPos0", _vShadowPos ); if (slcGetShadowMapMatrixNum() > 1) { _vShadowPos = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, 1 ); _pipe.Insert( "vShadowPos1", _vShadowPos ); if (slcGetShadowMapMatrixNum() > 2) { _vShadowPos = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, 2 ); _pipe.Insert( "vShadowPos2", _vShadowPos ); if (slcGetShadowMapMatrixNum() > 3) { _vShadowPos = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, 3 ); _pipe.Insert( "vShadowPos3", _vShadowPos ); } } } } #line 310 void slSetShadowMapPositionFromProjection( inout PIPE _pipe ) { if (!slcIsShadowEnabled()) { return; } _pipe.vShadowPos0 = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, 0 ); if (slcGetShadowMapMatrixNum() > 1) { _pipe.vShadowPos1 = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, 1 ); if (slcGetShadowMapMatrixNum() > 2) { _pipe.vShadowPos2 = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, 2 ); if (slcGetShadowMapMatrixNum() > 3) { _pipe.vShadowPos3 = slGetShadowMapFacePositionFromProjection( _pipe.vProjPos, 3 ); } } } } #line 342 void slOutputVertexShadowMapPosition( inout PIPE _pipe ) { if (!slpIsShadowMapTransformInPS()) { slInsertShadowMapPosition( _pipe ); } } #line 356 void slSetupPixelShadowMapPosition( inout PIPE _pipe ) { if (slpIsShadowMapTransformInPS()) { slInsertShadowMapPosition( _pipe ); } } SLT_TEXCOORD2 slApplyDitherMatrix( inout SLT_SHADOWMAP4 _vShadowPos, SLT_TEXCOORD2 _vScreenPos ) { SLT_TEXCOORD2 _dither; _dither = 0.5f*_vScreenPos; _dither.y += _dither.x; _dither = frac(_dither); if (slcGetShadowMapFilterType() == 3) { if (slcIsShadowDepthProjected()) { _vShadowPos.xy += _vShadowPos.w * scSM.xy * (_dither - SLT_TEXCOORD2(0.25f, 0.25f)); } else { _vShadowPos.xy += scSM.xy * (_dither - SLT_TEXCOORD2(0.25f, 0.25f)); } } return _dither; } void slRefineShadowValue( inout SLT_COLOR1 _fShadow, SLT_SHADOWMAP4 _vShadowPos, SLT_SHADOWMAP4 _vShadowPos0 ) { if (0) { SLT_HALF4 _cmp; if (slcIsShadowDepthProjected()) { _cmp = SLT_HALF4(0.0f, 0.0f, _vShadowPos.w, _vShadowPos.w) + SLT_HALF4(1.0f, 1.0f, -1.0f, -1.0f) * _vShadowPos.xyxy; } else { _cmp = SLT_HALF4(0.0f, 0.0f, 1.0f, 1.0f) + SLT_HALF4(1.0f, 1.0f, -1.0f, -1.0f) * _vShadowPos.xyxy; } _cmp = SLT_HALF4(0.0f, 0.0f, 0.0f, 0.0f) <= _cmp ? SLT_HALF4(0.0f, 0.0f, 0.0f, 0.0f) : SLT_HALF4(1.0f, 1.0f, 1.0f, 1.0f); _fShadow = saturate(dot(_cmp, SLT_HALF4(1,1,1,1))+_fShadow); } if ((slcIsAmbientAlphaUsedAsShadow() && (slcIsShadowEnabled() || slpIsPixelLighting())) || slcIsFarShadowErased()) { SLT_COLOR1 _alpha; if (slcIsFarShadowErased()) { if ((slcIsAmbientAlphaUsedAsShadow() && (slcIsShadowEnabled() || slpIsPixelLighting()))) { _alpha = saturate(dot(sdplane, _vShadowPos0)) * ambLit.a; } else { _alpha = saturate(dot(sdplane, _vShadowPos0)); } } else { _alpha = ambLit.a; } _fShadow *= _alpha; } if (slIsShadowValueInverted()) { _fShadow = 1.0f - _fShadow; } } #line 440 SLT_BOOL _slcIsLPlaneRequired() { if ((slcIsJitterShadowAvailable() || (slcGetSoftShadowType() == 8)) && (slcGetShadowMappingType() != 2)) { return true; } else { return false; } } #line 460 SLT_COLOR1 slGetShadow( PIPE _pipe ) { if (!slcIsShadowEnabled()) { return 1.0; } if (slcGetShadowMapFilterType() == 2 && (slcGetPlatform() == 0x30002)) { Error( "XBox360 dose not support Hardware shadow map."); } SLT_SHADOWMAP4 _vLPlane0; SLT_SHADOWMAP4 _vLPlane1; SLT_SHADOWMAP4 _vLPlane2; if (_slcIsLPlaneRequired()) { _vLPlane0 = vLPlane[0]; _vLPlane1 = vLPlane[1]; } if (slcGetSoftShadowType() == 8) { _vLPlane2 = vLPlane[2 * 1 + 0]; } SLT_SHADOWMAP4 _vS2LZ0 = vS2LZ[0]; SLT_SHADOWMAP4 _vS2LZ1 = vS2LZ[1]; SLT_SHADOWMAP4 _vShadowPos = _pipe.vShadowPos0; if (slcIsCascadeShadowMapEnabled()) { SLT_SHADOWMAP4 _vSMScale = vSMOf[0]; SLT_POINT depth = dot( _pipe.vShadowPos0, vS2VZ ); if (slcGetPlatform() == 0x40001) { SLT_SHADOWMAP2 s = (depth > 0.0) ? SLT_SHADOWMAP2(1, 0) : SLT_SHADOWMAP2(0, 1); _vShadowPos = _pipe.vShadowPos1 * s.x + _vShadowPos * s.y; _vSMScale = vSMOf[1] * s.x + _vSMScale * s.y; _vS2LZ0 = vS2LZ[2] * s.x + _vS2LZ0 * s.y; _vS2LZ1 = vS2LZ[3] * s.x + _vS2LZ1 * s.y; if (_slcIsLPlaneRequired()) { _vLPlane0 = vLPlane[2] * s.x + _vLPlane0 * s.y; _vLPlane1 = vLPlane[3] * s.x + _vLPlane1 * s.y; } if (slcGetSoftShadowType() == 8) { _vLPlane2 = vLPlane[2 * 1 + 1] * s.x + _vLPlane2 * s.y; } if (slcGetShadowMappingType() == 7 || slcGetShadowMappingType() == 10) { depth -= vSMDF.x; s = (depth > 0.0) ? SLT_SHADOWMAP2(1, 0) : SLT_SHADOWMAP2(0, 1); _vShadowPos = _pipe.vShadowPos2 * s.x + _vShadowPos * s.y; _vSMScale = vSMOf[2] * s.x + _vSMScale * s.y; _vS2LZ0 = vS2LZ[4] * s.x + _vS2LZ0 * s.y; _vS2LZ1 = vS2LZ[5] * s.x + _vS2LZ1 * s.y; if (_slcIsLPlaneRequired()) { _vLPlane0 = vLPlane[4] * s.x + _vLPlane0 * s.y; _vLPlane1 = vLPlane[5] * s.x + _vLPlane1 * s.y; } if (slcGetSoftShadowType() == 8) { _vLPlane2 = vLPlane[2 * 1 + 2] * s.x + _vLPlane2 * s.y; } } else if (slcGetShadowMappingType() == 8 || slcGetShadowMappingType() == 11) { SLT_POINT2 vDepth = SLT_POINT2( depth, depth ) - vSMDF.xy; SLT_SHADOWMAP s0 = (vDepth.x > 0.0) ? SLT_SHADOWMAP2(1, 0) : SLT_SHADOWMAP2(0, 1); SLT_SHADOWMAP s1 = (vDepth.y > 0.0) ? SLT_SHADOWMAP2(1, 0) : SLT_SHADOWMAP2(0, 1); _vShadowPos = _pipe.vShadowPos2 * s0.x + _vShadowPos * s0.y; _vSMScale = vSMOf[2] * s0.x + _vSMScale * s0.y; _vS2LZ0 = vS2LZ[4] * s0.x + _vS2LZ0 * s0.y; _vS2LZ1 = vS2LZ[5] * s0.x + _vS2LZ1 * s0.y; _vShadowPos = _pipe.vShadowPos3 * s1.x + _vShadowPos * s1.y; _vSMScale = vSMOf[3] * s1.x + _vSMScale * s1.y; _vS2LZ0 = vS2LZ[6] * s1.x + _vS2LZ0 * s1.y; _vS2LZ1 = vS2LZ[7] * s1.x + _vS2LZ1 * s1.y; if (_slcIsLPlaneRequired()) { _vLPlane0 = vLPlane[4] * s0.x + _vLPlane0 * s0.y; _vLPlane1 = vLPlane[5] * s0.x + _vLPlane1 * s0.y; _vLPlane0 = vLPlane[6] * s1.x + _vLPlane0 * s1.y; _vLPlane1 = vLPlane[7] * s1.x + _vLPlane1 * s1.y; } if (slcGetSoftShadowType() == 8) { _vLPlane2 = vLPlane[2 * 1 + 2] * s0.x + _vLPlane2 * s0.y; _vLPlane2 = vLPlane[2 * 1 + 3] * s1.x + _vLPlane2 * s1.y; } } } else { _vShadowPos = (depth > 0.0) ? _pipe.vShadowPos1 : _vShadowPos; _vSMScale = (depth > 0.0) ? vSMOf[1] : _vSMScale; _vS2LZ0 = (depth > 0.0) ? vS2LZ[2] : _vS2LZ0; _vS2LZ1 = (depth > 0.0) ? vS2LZ[3] : _vS2LZ1; if (_slcIsLPlaneRequired()) { _vLPlane0 = (depth > 0.0) ? vLPlane[2] : _vLPlane0; _vLPlane1 = (depth > 0.0) ? vLPlane[3] : _vLPlane1; } if (slcGetSoftShadowType() == 8) { _vLPlane2 = (depth > 0.0) ? vLPlane[2 * 1 + 1] : _vLPlane2; } if (slcGetShadowMappingType() == 7 || slcGetShadowMappingType() == 10) { depth -= vSMDF.x; _vShadowPos = (depth > 0.0) ? _pipe.vShadowPos2 : _vShadowPos; _vSMScale = (depth > 0.0) ? vSMOf[2] : _vSMScale; _vS2LZ0 = (depth > 0.0) ? vS2LZ[4] : _vS2LZ0; _vS2LZ1 = (depth > 0.0) ? vS2LZ[5] : _vS2LZ1; if (_slcIsLPlaneRequired()) { _vLPlane0 = (depth > 0.0) ? vLPlane[4] : _vLPlane0; _vLPlane1 = (depth > 0.0) ? vLPlane[5] : _vLPlane1; } if (slcGetSoftShadowType() == 8) { _vLPlane2 = (depth > 0.0) ? vLPlane[2 * 1 + 2] : _vLPlane2; } } else if (slcGetShadowMappingType() == 8 || slcGetShadowMappingType() == 11) { SLT_POINT2 vDepth = SLT_POINT2( depth, depth ) - vSMDF.xy; _vShadowPos = (vDepth.x > 0.0) ? _pipe.vShadowPos2 : _vShadowPos; _vSMScale = (vDepth.x > 0.0) ? vSMOf[2] : _vSMScale; _vS2LZ0 = (vDepth.x > 0.0) ? vS2LZ[4] : _vS2LZ0; _vS2LZ1 = (vDepth.x > 0.0) ? vS2LZ[5] : _vS2LZ1; _vShadowPos = (vDepth.y > 0.0) ? _pipe.vShadowPos3 : _vShadowPos; _vSMScale = (vDepth.y > 0.0) ? vSMOf[3] : _vSMScale; _vS2LZ0 = (vDepth.y > 0.0) ? vS2LZ[6] : _vS2LZ0; _vS2LZ1 = (vDepth.y > 0.0) ? vS2LZ[7] : _vS2LZ1; if (_slcIsLPlaneRequired()) { _vLPlane0 = (vDepth.x > 0.0) ? vLPlane[4] : _vLPlane0; _vLPlane1 = (vDepth.x > 0.0) ? vLPlane[5] : _vLPlane1; _vLPlane0 = (vDepth.y > 0.0) ? vLPlane[6] : _vLPlane0; _vLPlane1 = (vDepth.y > 0.0) ? vLPlane[7] : _vLPlane1; } if (slcGetSoftShadowType() == 8) { _vLPlane2 = (vDepth.x > 0.0) ? vLPlane[2 * 1 + 2] : _vLPlane2; _vLPlane2 = (vDepth.y > 0.0) ? vLPlane[2 * 1 + 3] : _vLPlane2; } } } if ( slcIsCascadeProjectionShadowMapEnabled() ) { _vShadowPos = SLT_SHADOWMAP4( _vShadowPos.xyz /_vShadowPos.w, 1 ); } _pipe.Insert( "vSMScale", _vSMScale ); if ((slcGetSoftShadowType() == 9) || (slcGetSoftShadowType() == 8)) { if (slcIsCascadeShadowMapEnabled()) { SLT_TEXCOORD2 _vSMMaxTex = _pipe.vSMScale.xy + _pipe.vSMScale.zw; _pipe.Insert( "vSMMaxTex", _vSMMaxTex ); _pipe.Insert( "vSMMinTex", _vSMScale.zw ); } } } if (slcGetSoftShadowType() == 9) { _pipe.Insert( "vS2LZ0", _vS2LZ0 ); _pipe.Insert( "vS2LZ1", _vS2LZ1 ); } if (_slcIsLPlaneRequired()) { _pipe.Insert( "vLPlane0", _vLPlane0 ); _pipe.Insert( "vLPlane1", _vLPlane1 ); } if (slcGetSoftShadowType() == 8) { _pipe.Insert( "vLPlane2", _vLPlane2 ); if (slcGetShadowMappingType() == 2) { SLT_SHADOWMAP3 _vAbsShadowPos = abs( _vShadowPos.xyz ); SLT_SHADOWMAP1 _fMaxAbsPos = max( max( _vAbsShadowPos.x, _vAbsShadowPos.y ), _vAbsShadowPos.z ); _vLPlane0 = ((_fMaxAbsPos == _vAbsShadowPos.x) ? SLT_SHADOWMAP4( 0.0, 0.0, _fMaxAbsPos, 0.0 ) : SLT_SHADOWMAP4( _fMaxAbsPos, 0.0, 0.0, 0.0 )); _vLPlane1 = ((_fMaxAbsPos == _vAbsShadowPos.y) ? SLT_SHADOWMAP4( 0.0, 0.0, _fMaxAbsPos, 0.0 ) : SLT_SHADOWMAP4( 0.0, _fMaxAbsPos, 0.0, 0.0 )); _pipe.Insert( "vLPlane0", _vLPlane0 ); _pipe.Insert( "vLPlane1", _vLPlane1 ); } } SLT_COLOR1 _fShadow = 0.0; SLT_TEXCOORD2 _dither; if ( (slcGetSoftShadowType() == 3) || ((3 < slcGetSoftShadowType()) && slcIsShadowBranchEnabled()) || (slcGetSoftShadowType() == 8) || (slcGetShadowMapFilterType() == 3) ) { _dither = slApplyDitherMatrix( _vShadowPos, _pipe.vScreenPos ); } if (slcGetShadowMappingType() == 5) { _fShadow = slGetProcessedShadow( _vShadowPos ); } else { if (slcIsShadowBranchEnabled()) { if ( slcGetSoftShadowType() == 9 ) { Error( "Contact Hardening Shadow with branch is not supported yet..." ); } if ( slIsShadowMapEnabled() ) { if (3 <= slcGetSoftShadowType()) { if ( slIsShadowMapDitherOrJitter() ) { if (slcGetSoftShadowType() == 8) { if ( slIsShadowMapSoftOrJitter() ) { _fShadow = _slGetPercentageCloserSoftShadow( _vShadowPos, _pipe.vScreenPos, _pipe ); } else { _fShadow = _slGetDitherSoftShadow( _vShadowPos, _dither, _pipe ); } } else if (4 <= slcGetSoftShadowType()) { if ( slIsShadowMapSoftOrJitter() ) { _fShadow = _slGetJitterSoftShadow( _vShadowPos, _pipe.vScreenPos, _vLPlane0, _vLPlane1 ); } else { _fShadow = _slGetDitherSoftShadow( _vShadowPos, _dither, _pipe ); } } else { _fShadow = _slGetDitherSoftShadow( _vShadowPos, _dither, _pipe ); } } else { if (2 <= slcGetSoftShadowType()) { if ( slIsShadowMapSoftOrJitter() ) { _fShadow = _slGetSoftShadow( _vShadowPos, _pipe ); } else { _fShadow = _slGetHardShadow( _vShadowPos, _pipe ); } } else { _fShadow = _slGetHardShadow( _vShadowPos, _pipe ); } } } else { if (2 <= slcGetSoftShadowType()) { if ( slIsShadowMapSoftOrJitter() ) { _fShadow = _slGetSoftShadow( _vShadowPos, _pipe ); } else { _fShadow = _slGetHardShadow( _vShadowPos, _pipe ); } } else { _fShadow = _slGetHardShadow( _vShadowPos, _pipe ); } } slRefineShadowValue( _fShadow, _vShadowPos, _pipe.vShadowPos0 ); } else { _fShadow = 1.0f; } } else { if (slcGetSoftShadowType() == 1) { _fShadow = _slGetHardShadow( _vShadowPos, _pipe ); } else if (slcGetSoftShadowType() == 2) { _fShadow = _slGetSoftShadow( _vShadowPos, _pipe ); } else if (slcGetSoftShadowType() == 3) { _fShadow = _slGetDitherSoftShadow( _vShadowPos, _dither, _pipe ); } else if (slcGetSoftShadowType() == 8) { _fShadow = _slGetPercentageCloserSoftShadow( _vShadowPos, _dither, _pipe ); } else if (slcGetSoftShadowType() == 9) { _fShadow = _slGetContactHardeningShadow( _vShadowPos, _pipe ); } else { _fShadow = _slGetJitterSoftShadow( _vShadowPos, _pipe.vScreenPos, _vLPlane0, _vLPlane1 ); } slRefineShadowValue( _fShadow, _vShadowPos, _pipe.vShadowPos0 ); } } return _fShadow; } #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFog.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFunction.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFogParameters.fx" #line 22 SLT_PARAM_FLOAT4 fog ; #line 29 SLT_PARAM_HALF4 cFog; #line 50 SLT_PARAM_FLOAT4 Scat[4] ; #line 1 "D://KTGL/shaderlib2/shader/include/../func/slScattering.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slFunction.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../func/slLightingParameters.fx" #line 25 "D://KTGL/shaderlib2/shader/include/../func/slScattering.fx" SLT_COLOR3 slGetRayleigh( SLT_COLOR1 _fLV ) { return Scat[2].rgb * (1.0 + _fLV*_fLV ); } #line 36 SLT_COLOR3 slGetMie( SLT_COLOR1 _fLV ) { return Scat[3].rgb * pow(Scat[3].a + Scat[2].a * _fLV, -1.5f); } #line 50 SLT_COLOR3 slGetInScattering( SLT_COLOR1 _fLV ) { return slGetMie( _fLV ) + slGetRayleigh( _fLV ) + Scat[1].rgb; } #line 67 SLT_COLOR3 slGetScatteringExtinction( SLT_COLOR1 _fDepth ) { SLT_COLOR3 _fD = saturate( exp2( (SLT_COLOR3)( Scat[0].rgb * _fDepth ) ) ); if (slcIsFogLimitEnabled()) { _fD = max( _fD, 1.0f - Scat[0].a ); } return _fD; } #line 79 void slGetScatteringExtinction( inout PIPE _pipe, SLT_COLOR1 _fDepth ) { _pipe.Insert( "vScatExtinct", slGetScatteringExtinction( _fDepth ) ); } #line 88 void slGetScatteringParameters( inout PIPE _pipe, SLT_COLOR1 _fDepth, SLT_DIR1 _fLV ) { slGetScatteringExtinction( _pipe, _fDepth ); SLT_COLOR3 _clInScat; if (slpIsFogColorDisabled()) { } else { _pipe.Insert( "cInScat", slGetInScattering( _fLV ) ); } } #line 105 void slGetScatteringParameters( inout PIPE _pipe, SLT_VECTOR3 _vcEye ) { SLT_VECTOR1 _fLen = dot( _vcEye, _vcEye ); SLT_VECTOR1 _fRLen = rsqrt( _fLen ); _fLen *= _fRLen; SLT_COLOR1 _fDepth = fog.x * _fLen + fog.y; if (slpIsFogColorDisabled()) { slGetScatteringExtinction( _pipe, _fDepth ); } else { SLT_DIR3 _vcLight = slGetScatteringLightDirection( _pipe ); _vcEye *= _fRLen; slGetScatteringParameters( _pipe, _fDepth, dot( _vcEye, _vcLight ) ); } } #line 135 void slGetVSOutScattering( inout PIPE _pipe ) { if (slcIsOutputScatteringInVS()) { slGetScatteringParameters( _pipe, _pipe.vEye ); } } #line 149 SLT_VECTOR3 slGetScatteringEyeVector( PIPE _pipe ) { return slGetLightingEyeVector(_pipe); } #line 161 SLT_DIR3 slGetScatteringEyeDirection( PIPE _pipe ) { return slGetLightingEyeDirection(_pipe); } #line 173 SLT_DIR3 slGetScatteringLightDirection( PIPE _pipe ) { slSParallelLight result = slGetFirstParallelLight( _pipe ); return result.vcDir; } void slApplyScatteringBody( inout SLT_COLOR4 _color, PIPE _pipe ) { if (slcGetFogMode() == 4) { if (slcGetFogAccuracy() == 0) { if (0) { SLT_COLOR1 _alpha = _color.a; _color.a = 1.0; _color = lerp( _pipe.cInScat, _color, _pipe.vScatExtinct ); _color.a *= _alpha; } else { _color.rgb = lerp( _pipe.cInScat, _color.rgb, _pipe.vScatExtinct ); } } else if (slcGetFogAccuracy() == 2) { slGetScatteringParameters( _pipe, slGetScatteringEyeVector(_pipe) ); _color.rgb = lerp( _pipe.cInScat, _color.rgb, _pipe.vScatExtinct ); } else if (slcGetFogAccuracy() == 1) { slGetScatteringParameters( _pipe, _pipe.fFogDepth, dot( slGetScatteringEyeDirection(_pipe), slGetScatteringLightDirection( _pipe ) ) ); _color.rgb = lerp( _pipe.cInScat, _color.rgb, _pipe.vScatExtinct ); } } } void slApplyScatteringNoLight( inout SLT_COLOR3 _color, PIPE _pipe ) { if (slcGetFogMode() == 4) { if (slcGetFogAccuracy() == 0) { } else if (slcGetFogAccuracy() == 2) { SLT_COLOR1 _fDepth = fog.x * length(slGetScatteringEyeVector(_pipe)) + fog.y; slGetScatteringExtinction( _pipe, _fDepth ); } else if (slcGetFogAccuracy() == 1) { slGetScatteringExtinction( _pipe, _pipe.fFogDepth ); } if (slpIsFogColorDisabled()) { _color.rgb *= _pipe.vScatExtinct; } else { _color.rgb = lerp( Scat[1].rgb, _color.rgb, _pipe.vScatExtinct ); } } } void slApplyScatteringExtinction( inout SLT_COLOR3 _color, PIPE _pipe ) { if (slcGetFogMode() == 4) { if (slcGetFogAccuracy() == 0) { } else if (slcGetFogAccuracy() == 2) { SLT_COLOR1 _fDepth = fog.x * length(slGetScatteringEyeVector(_pipe)) + fog.y; slGetScatteringExtinction( _pipe, _fDepth ); } else if (slcGetFogAccuracy() == 1) { slGetScatteringExtinction( _pipe, _pipe.fFogDepth ); } _color.rgb *= _pipe.vScatExtinct; } } void slGetScatteringFogColor( out SLT_COLOR3 _fog, out SLT_COLOR4 _extinction, PIPE _pipe ) { if (slcGetFogMode() == 4) { if (slcGetFogAccuracy() == 0) { } else if (slcGetFogAccuracy() == 2) { slGetScatteringParameters( _pipe, slGetScatteringEyeVector( _pipe ) ); } else if (slcGetFogAccuracy() == 1) { slGetScatteringParameters( _pipe, _pipe.fFogDepth, dot( slGetScatteringEyeDirection(_pipe), slGetScatteringLightDirection( _pipe ) ) ); } if (slpIsFogColorDisabled()) { _fog = 0; } else { _fog = _pipe.cInScat - _pipe.cInScat * _pipe.vScatExtinct; } _extinction.rgb = _pipe.vScatExtinct; _extinction.a = 1.0f; } } void slGetScatteringExtinction(out SLT_COLOR4 _extinction, inout PIPE _pipe) { if (slcGetFogMode() == 4) { if (slcGetFogAccuracy() == 0) { } else if (slcGetFogAccuracy() == 2) { SLT_COLOR1 _fDepth = fog.x * length(slGetScatteringEyeVector(_pipe)) + fog.y; slGetScatteringExtinction( _pipe, _fDepth ); } else if (slcGetFogAccuracy() == 1) { slGetScatteringExtinction( _pipe, _pipe.fFogDepth ); } _extinction.rgb = _pipe.vScatExtinct; _extinction.a = 1.0f; } } void slApplyScattering( inout SLT_COLOR4 _color, PIPE _pipe ) { if (0 < slcGetAllParallelLightNum()) { if (slpIsFogColorDisabled()) { slApplyScatteringExtinction( _color.rgb, _pipe ); } else { slApplyScatteringBody( _color, _pipe ); } } else { if (slpIsFogColorDisabled()) { slApplyScatteringExtinction( _color.rgb, _pipe ); } else { slApplyScatteringNoLight( _color.rgb, _pipe ); } } } void slGetScatteringColor( out SLT_COLOR3 _fog, out SLT_COLOR4 _extinction, PIPE _pipe ) { if (0 < slcGetAllParallelLightNum()) { slGetScatteringFogColor(_fog, _extinction, _pipe); } else { (_fog) = 0; slGetScatteringExtinction(_extinction, _pipe); } } #line 26 "D://KTGL/shaderlib2/shader/include/../func/slFog.fx" SLT_COLOR1 slGetVertexFogValue( SLT_COLOR1 _fDistance ) { if (slcGetFogMode() == 0) { return 0; } else if (slcGetFogMode() == 1) { return (SLT_COLOR1)( _fDistance * fog.x + fog.y ); } else if (slcGetFogMode() == 2) { return saturate( (SLT_COLOR1)exp2( fog.x * _fDistance + fog.y ) ); } else if (slcGetFogMode() == 3) { return saturate( (SLT_COLOR1)exp2( fog.x * _fDistance + fog.y ) ); } } SLT_COLOR1 slGetFogDepth( SLT_VECTOR1 _fDepth ) { return (SLT_COLOR1)(_fDepth * fog.x + fog.y); } #line 60 SLT_POINT slGetFogDepth( PIPE _pipe ) { return _pipe.vProjPos.w; } #line 70 void slOutputVertexFog( inout PIPE _pipe ) { if (slcIsOutputFogInVS()) { if (0x20 <= slcGetVSProfile()) { } SLT_COLOR _fFogValue = slGetVertexFogValue( slGetFogDepth(_pipe) ); if (slcIsHardwareVertexFogEnabled()) { _pipe.Output( "vFog", "FOG", _fFogValue ); } else { _pipe.Insert( "saturate_color SLT_COLOR", "vFog" ); _pipe.vFog = _fFogValue; } } } #line 95 void slOutputVertexFogDepth( inout PIPE _pipe ) { if (slcIsOutputFogDepthInVS()) { SLT_FLOAT _fDepth = slGetFogDepth(_pipe); if (slcIsAcceptableLowPrecisionFogDepth() && slcGetFogMode() != 1) { _pipe.Insert( "saturate_color SLT_COLOR", "fFogDepth" ); } else { _pipe.Insert( "SLT_COLOR", "fFogDepth" ); } _pipe.fFogDepth = (SLT_COLOR1)(_fDepth * fog.x + fog.y); } else if (slcIsOutputScatteringInVS()) { slGetVSOutScattering( _pipe ); } } #line 126 SLT_COLOR slGetPerPixelFogValue( SLT_COLOR1 _fFogDepth ) { if (slcGetFogMode() == 1) { return saturate( 1.0f-_fFogDepth ); } else if (slcGetFogMode() == 2) { return saturate( exp2( -_fFogDepth ) ); } else if (slcGetFogMode() == 3) { return saturate( exp2( -(_fFogDepth*_fFogDepth) ) ); } } #line 147 SLT_COLOR slGetPixelDFogValue( SLT_VECTOR1 _fDistance ) { if (slcGetFogMode() == 1) { return (SLT_COLOR1)saturate( _fDistance * fog.x + fog.y ); } else if (slcGetFogMode() == 2) { return (SLT_COLOR1)saturate( exp2( fog.x * _fDistance + fog.y ) ); } else if (slcGetFogMode() == 3) { return (SLT_COLOR1)saturate( exp2( fog.x * (_fDistance*_fDistance) + fog.y ) ); } } #line 165 SLT_COLOR1 slGetPixelDFogValue( SLT_VECTOR3 _vcEye ) { if (slcGetFogMode() == 1) { return (SLT_COLOR1)saturate( length( _vcEye ) * fog.x + fog.y ); } else if (slcGetFogMode() == 2) { return (SLT_COLOR1)saturate( exp2( fog.x * length( _vcEye ) + fog.y ) ); } else if (slcGetFogMode() == 3) { return (SLT_COLOR1)saturate( exp2( fog.x * dot( _vcEye, _vcEye ) + fog.y ) ); } } #line 186 SLT_COLOR4 slGetFogColor() { if (slpIsFogColorDisabled()) { return (SLT_COLOR4)0.0f; } else { return (SLT_COLOR4)cFog; } } #line 202 void slApplyFog( inout SLT_COLOR4 _color, SLT_COLOR1 _fFog ) { if (slcIsFogLimitEnabled()) { _fFog = max(_fFog, 1.0 - slGetFogColor().a); } if (slcIsAlphaFogEnabled()) { SLT_COLOR1 _alpha = _color.a; _color.a = 1.0; _color = lerp( slGetFogColor(), _color, (SLT_COLOR4)_fFog ); _color.a *= _alpha; } else { _color.rgb = lerp( (SLT_COLOR3)slGetFogColor(), (SLT_COLOR3)_color, _fFog ); } } #line 225 void slApplyFogExtinction( inout SLT_COLOR4 _color, SLT_COLOR1 _fFog ) { if (slcIsFogLimitEnabled()) { _fFog = max(_fFog, 1.0 - slGetFogColor().a); } if (slcIsAlphaFogEnabled()) { _color.rgb *= _fFog; _color.a *= slGetFogColor().a * (1.0f - _fFog); } else { _color.rgb *= _fFog; } } #line 248 void slApplyFog( inout SLT_COLOR4 _color, PIPE _pipe ) { if (slcGetFogMode() == 0) { } else if (slcGetFogMode() == 4) { slApplyScattering( _color, _pipe ); } else { if (slcGetFogAccuracy() == 0) { if (!slcIsHardwareVertexFogEnabled()) { SLT_COLOR1 _fFog = _pipe.vFog; if (slcGetFogMode() == 1) { _fFog = saturate( _fFog ); } if (slpIsFogColorDisabled()) { slApplyFogExtinction( _color, _fFog ); } else { slApplyFog( _color, _fFog ); } } } else if (slcGetFogAccuracy() == 1) { SLT_COLOR1 _fFog = slGetPerPixelFogValue( _pipe.fFogDepth ); if (slpIsFogColorDisabled()) { slApplyFogExtinction( _color, _fFog ); } else { slApplyFog( _color, _fFog ); } } else if (slcGetFogAccuracy() == 2) { SLT_COLOR1 _fFog = slGetPixelDFogValue( slGetLightingEyeVector( _pipe ) ); if (slpIsFogColorDisabled()) { slApplyFogExtinction( _color, _fFog ); } else { slApplyFog( _color, _fFog ); } } else { } } } void slGetFogColor( out SLT_COLOR3 _fog, out SLT_COLOR4 _extinction, SLT_COLOR1 _fFog ) { if (slcIsFogLimitEnabled()) { _fFog = (SLT_COLOR3)max(_fFog, 1.0 - slGetFogColor().a); } if (slpIsFogColorDisabled()) { _fog = (SLT_COLOR3)0.0f; } else { _fog = slGetFogColor().rgb - slGetFogColor().rgb * (SLT_COLOR3)_fFog; } _extinction.rgb = (SLT_COLOR3)_fFog; if (slcIsAlphaFogEnabled()) { _extinction.a = lerp(slGetFogColor().a, 1.0f, _fFog); } else { _extinction.a = 1.0f; } } void slGetFogColor( out SLT_COLOR3 _fog, out SLT_COLOR4 _extinction, PIPE _pipe ) { if (slcGetFogMode() == 0) { _fog = (SLT_COLOR3)0.0f; _extinction = (SLT_COLOR4)1.0f; } else if (slcGetFogMode() == 4) { slGetScatteringColor( _fog, _extinction, _pipe ); } else { if (slcGetFogAccuracy() == 1) { SLT_COLOR1 _fFog = slGetPerPixelFogValue( _pipe.fFogDepth ); slGetFogColor( _fog, _extinction, _fFog ); } else if (slcGetFogAccuracy() == 2) { SLT_COLOR1 _fFog = slGetPixelDFogValue( slGetLightingEyeVector( _pipe ) ); slGetFogColor( _fog, _extinction, _fFog ); } else { _fog = (SLT_COLOR3)0.0f; _extinction = (SLT_COLOR4)1.0f; } } } #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/slCompileOptions.fxh" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainShaderOptions.fx" #line 62 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" SLT_BOOL sloIsBlendRenderTargetShaderType() { return ( ( 805306368 & 0x7000 ) == 0x1000 ); } #line 72 SLT_BOOL sloIsNearShaderType() { return ( ( 805306368 & 0x7000 ) == 0x2000 ); } #line 82 SLT_BOOL sloIsMiddleShaderType() { return ( ( 805306368 & 0x7000 ) == 0x3000 ); } #line 92 SLT_BOOL sloIsFarShaderType() { return ( ( 805306368 & 0x7000 ) == 0x4000 ); } #line 102 SLT_BOOL sloIsDepthShaderType() { return 805306368 == 0x10000000; } #line 112 SLT_BOOL sloIsBlackShaderType() { return 805306368 == 0x30000000; } #line 122 SLT_BOOL sloIsCoverShaderType() { return 805306368 == 0x70000000; } #line 132 SLT_BOOL sloIsPBS() { return 0 != 0; } #line 146 SLT_BOOL sloIsSampledBlendMapR() { return ( ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 2 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 3 ) ) ) && ( 131075 == 0x20003 ) ) || ( ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 1 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 2 ) ) ) && ( 131075 == 0x20003 ) ) || ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 0 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 1 ) ) ); } #line 161 SLT_BOOL sloIsSampledBlendMapG() { return ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 1 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 2 ) ) ) && ( 131075 != 0x20003 ); } #line 173 SLT_BOOL sloIsSampledBlendMapB() { return ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 2 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 3 ) ) ) && ( 131075 != 0x20003 ); } #line 184 SLT_BOOL sloIsSampledBlendMapRG() { return ( ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 5 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 6 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 3 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 7 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 3 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 7 ) ) ) && ( 131075 == 0x20003 ) ) || ( ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 4 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 5 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 2 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 6 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 2 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 6 ) ) ) && ( 131075 == 0x20003 ) ) || ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 3 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 4 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 1 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 5 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 1 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 5 ) ) ); } #line 199 SLT_BOOL sloIsSampledBlendMapGB() { return ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 4 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 5 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 2 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 6 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 2 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 6 ) ) ) && ( 131075 != 0x20003 ); } #line 211 SLT_BOOL sloIsSampledBlendMapBR() { return ( ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 5 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 6 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 3 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 7 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 3 ) ) || ( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 7 ) ) ) && ( 131075 != 0x20003 ); } #line 222 SLT_BOOL sloIsSampledBlendMapRGB() { return ( ( ( 805306368 & 0x7000 ) == 0x1000 ) && ( ( 805306368 & 0x000F ) == 6 ) ); } #line 237 SLT_BOOL sloIsPalette1stNormalMap() { return ( ( 805306368 & ( 0x1 << 8 ) ) > 0 ); } #line 247 SLT_BOOL sloIsPalette2ndNormalMap() { return ( ( 805306368 & ( 0x1 << 4 ) ) > 0 ); } #line 257 SLT_BOOL sloArePaletteBothNormalMap() { return ( ( 805306368 & ( ( 0x1 << 8 ) | ( 0x1 << 4 ) ) ) == ( ( 0x1 << 8 ) | ( 0x1 << 4 ) ) ); } #line 267 SLT_BOOL sloMayBeUsedPaletteNormalMap() { return ( ( 805306368 & ( ( 0x1 << 8 ) | ( 0x1 << 4 ) ) ) > 0 ); } #line 281 SLT_BOOL sloIsPalette1stCliff() { return ( ( 805306368 & ( 0x2 << 8 ) ) > 0 ); } #line 291 SLT_BOOL sloIsPalette2ndCliff() { return ( ( 805306368 & ( 0x2 << 4 ) ) > 0 ); } #line 301 SLT_BOOL sloArePaletteBothCliff() { return ( ( 805306368 & ( ( 0x2 << 8 ) | ( 0x2 << 4 ) ) ) == ( ( 0x2 << 8 ) | ( 0x2 << 4 ) ) ); } #line 311 SLT_BOOL sloIsEnabledCliffTangent() { return ( ( ( 805306368 & ( 0x3 << 8 ) ) == ( 0x3 << 8 ) ) || ( ( 805306368 & ( 0x3 << 4 ) ) == ( 0x3 << 4 ) ) ); } #line 325 SLT_BOOL sloIsPalette1stSpecular() { return !sloIsPBS() && ( ( 805306368 & ( 0x4 << 8 ) ) > 0 ); } #line 335 SLT_BOOL sloIsPalette2ndSpecular() { return !sloIsPBS() && ( ( 805306368 & ( 0x4 << 4 ) ) > 0 ); } #line 345 SLT_BOOL sloArePaletteBothSpecular() { return !sloIsPBS() && ( ( 805306368 & ( ( 0x4 << 8 ) | ( 0x4 << 4 ) ) ) == ( ( 0x4 << 8 ) | ( 0x4 << 4 ) ) ); } #line 355 SLT_BOOL sloMayBeUsedPaletteSpecular() { return !sloIsPBS() && ( ( 805306368 & ( ( 0x4 << 8 ) | ( 0x4 << 4 ) ) ) > 0 ); } #line 370 SLT_INT sloTerrainLandTextureNum() { if ( sloIsSampledBlendMapRGB() ) { return 3; } else if ( sloIsSampledBlendMapRG() || sloIsSampledBlendMapGB() || sloIsSampledBlendMapBR() ) { return 2; } else if ( sloIsSampledBlendMapR() || sloIsSampledBlendMapG() || sloIsSampledBlendMapB() ) { return 1; } else if ( !( ( ( 805306368 & 0x7000 ) == 0 ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 0 ) ) ) ) { return 1; } return 0; } #line 389 SLT_INT sloTerrainBlendMapNum() { if ( ( ( !( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 0 ) ) ) && ( !( ( ( 805306368 & 0x7000 ) == 0x2000 ) && ( ( 805306368 & 0x000F ) == 4 ) ) ) && ( !( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 0 ) ) ) && ( !( ( ( 805306368 & 0x7000 ) == 0x3000 ) && ( ( 805306368 & 0x000F ) == 4 ) ) ) && ( !( ( ( 805306368 & 0x7000 ) == 0 ) || ( ( ( 805306368 & 0x7000 ) == 0x4000 ) && ( ( 805306368 & 0x000F ) == 0 ) ) ) ) ) ) { return 1; } else { return 0; } } #line 403 SLT_INT sloTerrainBlendedRenderTargetNum() { if ( ( ( ( 805306368 & 0x2000 ) > 0 ) && ( ( 805306368 & 0x000F ) >= 4 ) ) ) { return 1; } else { return 0; } } #line 417 SLT_INT sloTerrainFarTextureNum() { if ( sloIsMiddleShaderType() || sloIsFarShaderType() ) { return 1; } else { return 0; } } #line 431 SLT_INT sloTerrainNormalMapNum() { if ( sloArePaletteBothNormalMap() ) { return 2; } else if ( sloMayBeUsedPaletteNormalMap() ) { return 1; } else { return 0; } } #line 447 SLT_INT sloTerrainCliffPaletteNum() { if ( sloArePaletteBothCliff() ) { return 2; } else if ( ( ( 805306368 & ( ( 0x2 << 8 ) | ( 0x2 << 4 ) ) ) > 0 ) ) { return 1; } else { return 0; } } #line 463 SLT_INT sloTerrainUniqueSpecularPaletteNum() { if ( sloArePaletteBothSpecular() ) { return 2; } else if ( sloMayBeUsedPaletteSpecular() ) { return 1; } else { return 0; } } #line 479 SLT_INT sloTerrainTextureBlendMax() { return sloTerrainLandTextureNum() + sloTerrainBlendedRenderTargetNum() + sloTerrainFarTextureNum(); } #line 502 SLT_INT slpTerrainLandTexCoordOutputType() { if ( 0 < sloTerrainLandTextureNum() ) { return 2; } else { return 0; } } #line 521 SLT_INT slpTerrainCliffBlendWeightOutputType() { if ( 0 < sloTerrainCliffPaletteNum() ) { return 2; } else { return 0; } } #line 540 SLT_INT slpTerrainBlendMapTexCoordOutputType() { if ( 0 < sloTerrainBlendMapNum() ) { return 2; } else { return 0; } } #line 559 SLT_INT slpTerrainFarTexCoordOutputType() { if ( 0 < sloTerrainFarTextureNum() ) { return 2; } else { return 0; } } #line 576 SLT_INT slpTerrainBlendedRenderTargetTexCoordOutputType() { if ( 0 < sloTerrainBlendedRenderTargetNum() ) { return 1; } else { return 0; } } #line 596 SLT_BOOL sloIsEnabledMorphing() { return !sloIsFarShaderType() && !sloIsCoverShaderType(); } #line 606 SLT_BOOL slpIsTerrainOutputVertexOnlyType() { return sloIsDepthShaderType() || sloIsBlackShaderType() || 0; } #line 616 SLT_BOOL slpIsTerrainLightAndShadowType() { return !slpIsTerrainOutputVertexOnlyType() && !sloIsBlendRenderTargetShaderType(); } #line 626 SLT_BOOL slpIsTerrainSpecularLightingType() { return slpIsTerrainLightAndShadowType() && ( !sloIsFarShaderType() || sloIsPBS() ); } #line 665 SLT_BOOL sloIsEnabledTerrainSpecularSetting() { return ( (1 != 0) || sloIsPalette1stSpecular() || sloIsPalette2ndSpecular() ) && slpIsTerrainSpecularLightingType(); } #line 676 SLT_BOOL sloIsEnabledSpecularMapBlend() { return ( 2 == sloTerrainLandTextureNum() && 0 == sloTerrainUniqueSpecularPaletteNum() && (1 != 0) ); } #line 686 SLT_BOOL sloIsEnabled1stSpecularMap() { return ( ( 0 < sloTerrainLandTextureNum() ) && ( sloIsPalette1stSpecular() || (1 != 0) ) ); } #line 698 SLT_BOOL sloIsEnabled2ndSpecularMap() { return ( ( 1 < sloTerrainLandTextureNum() ) && ( sloIsPalette2ndSpecular() || ( (1 != 0) && !sloIsEnabledSpecularMapBlend() ) ) ); } #line 713 SLT_INT slcTerrainAutoRegisterMapStartVS() { if ( 131075 == 0x10009 ) { return 5; } else { return 0; } } #line 727 SLT_INT slcTerrainAutoRegisterMapStartPS() { if ( 131075 == 0x10009 ) { return 3; } else { return 0; } } #line 741 SLT_BOOL slcIsEnabledUVOffset() { return 131075 == 0x40001; } #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainParameters.fx" #line 23 SLT_PARAM_FLOAT4 scale; #line 31 SLT_PARAM_FLOAT4 gMrpRng; #line 39 SLT_PARAM_FLOAT4 texsize0; #line 47 SLT_PARAM_FLOAT2 texsize1; #line 54 SLT_PARAM_FLOAT4 bmsize; #line 61 SLT_PARAM_FLOAT4 clipToRTT; #line 68 SLT_PARAM_FLOAT4 spec0; #line 75 SLT_PARAM_FLOAT4 spec1; #line 88 SLT_PARAM_FLOAT4 texsizeFar; #line 97 SLT_PARAM_FLOAT4 uvOffset0; #line 106 SLT_PARAM_FLOAT2 uvOffset1; #line 112 SLT_SAMPLER_2D sBlendMap < int Usage = 128; int Sampler = 0 + 0; >; #line 121 SLT_SAMPLER_2D sLand0 < int Usage = 129; int Sampler = 0 + 1; >; #line 130 SLT_SAMPLER_2D sLand1 < int Usage = 130; int Sampler = 0 + 2; >; #line 142 SLT_SAMPLER_2D sLand2 < int Usage = 131; int Sampler = 0 + 3; >; #line 154 SLT_SAMPLER_2D sRtt < int Usage = 131; int Sampler = 0 + 3; >; #line 163 SLT_SAMPLER_2D sFarTex < int Usage = 132; int Sampler = 0 + 4; >; #line 172 SLT_SAMPLER_2D sNMap2 < int Usage = 133; int Sampler = 0 + 5; >; #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainSetupVSInput.fx" #line 56 void slSetUpTerrainVertex(inout PIPE _pipe) { _pipe.Input( "SLT_POINT4", "vtxPos", "POSITION0" ); _pipe.Input( "saturate_color SLT_COLOR4", "vtxColor0", "NORMAL" ); _pipe.Input( "saturate_color SLT_COLOR4", "vtxColor1", "COLOR0" ); } #line 87 void slTransformTerrainVertex( inout PIPE _pipe ) { slSetUpTransformedVectors( _pipe ); _pipe.vProjPos = slApplyMatrix( slGetMatrixL2P(), _pipe.vtxPos ); _pipe.vWorldPos = _pipe.vtxPos; _pipe.vcWorldNormal = _pipe.vtxNormal.xyz; _pipe.vcWorldTangent = _pipe.vtxTangent.xyz; slInsertVertexVectors( _pipe ); } #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainVertexDecode.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" #line 34 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainVertexDecode.fx" SLT_DIR3 slDecodeTerrainNormal(PIPE _pipe) { SLT_DIR3 _vcNormal; _vcNormal.x = _pipe.vtxColor0.w * 255.0f/127.0f - 128.0f/127.0f; _vcNormal.z = _pipe.vtxColor1.w * 255.0f/127.0f - 128.0f/127.0f; _vcNormal.y = sqrt( 1.0f - dot( _vcNormal.xz, _vcNormal.xz ) ); return _vcNormal; } #line 68 SLT_DIR4 slDecodeTerrainTangent(PIPE _pipe) { SLT_DIR4 _vcTangent; if ( sloIsEnabledCliffTangent() ) { _vcTangent = _pipe.vtxNormal.xyyx * _pipe.vtxNormal.zzyx; _vcTangent.z = - _vcTangent.w -_vcTangent.z; _vcTangent.w = 1.0f; _vcTangent.xyz = normalize( _vcTangent.xyz ); } else { _vcTangent = SLT_DIR4( 0.0f, _pipe.vtxNormal.z, -_pipe.vtxNormal.y, 1.0f ); _vcTangent.xyz = normalize( _vcTangent.xyz ); } return _vcTangent; } #line 99 SLT_COLOR4 slDecodeTerrainVertexColor(PIPE _pipe) { SLT_DIR4 _vColor; if ( sloIsNearShaderType() ) { _vColor.rgb = lerp( _pipe.vtxColor0.rgb, _pipe.vtxColor1.rgb, _pipe.fMorph ); _vColor.a = 1.0f; } else if ( sloIsMiddleShaderType() ) { _vColor.rgb = lerp( _pipe.vtxColor0.rgb, (SLT_COLOR3)1.0f, _pipe.fMorph ); _vColor.a = 1.0f; } else { _vColor.rgba = 1.0f; } return _vColor; } #line 138 void slDecodeTerrainVertex(inout PIPE _pipe) { SLT_POINT4 _vDecodePos; _vDecodePos.xyz = scale.xyz * _pipe.vtxPos.xyz; _vDecodePos.w = 1.0f; if ( sloIsEnabledMorphing() ) { _pipe.Insert( "saturate_color SLT_COLOR1", "fMorph" ); _pipe.fMorph = saturate( dot( _vDecodePos, gMrpRng ) ); _vDecodePos.y = scale.y * ( _pipe.vtxPos.y + _pipe.vtxPos.w * _pipe.fMorph ); } _vDecodePos.y += scale.w; _pipe.Insert( "SLT_DIR3", "vtxNormal" ); _pipe.vtxNormal = slDecodeTerrainNormal( _pipe ); _pipe.Insert( "SLT_DIR4", "vtxTangent" ); _pipe.vtxTangent = slDecodeTerrainTangent( _pipe ); _pipe.vtxColor0 = slDecodeTerrainVertexColor( _pipe ); _pipe.vtxPos = _vDecodePos; } #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainTexCoord.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" #line 36 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainTexCoord.fx" SLT_POINT2 slGetTerrainLandTexCoordSingle(SLT_POINT4 _vPos, SLT_FLOAT2 _vPaletteScale2, SLT_FLOAT2 _vPaletteOffset2) { if ( slcIsEnabledUVOffset() ) { return _vPos.xz * _vPaletteScale2 + _vPaletteOffset2; } else { return _vPos.xz * _vPaletteScale2; } } #line 55 SLT_POINT4 slGetTerrainLandTexCoordPair(SLT_POINT4 _vPos, SLT_FLOAT4 _vPaletteScale4, SLT_FLOAT4 _vPaletteOffset4) { if ( slcIsEnabledUVOffset() ) { return _vPos.xzzx * _vPaletteScale4 + _vPaletteOffset4; } else { return _vPos.xzzx * _vPaletteScale4; } } #line 74 SLT_POINT3 slGetTerrainLandTexCoordCliff(SLT_POINT4 _vPos, SLT_FLOAT3 _vPaletteScale3, SLT_FLOAT2 _vPaletteOffset2) { if ( slcIsEnabledUVOffset() ) { _vPos.xyz *= _vPaletteScale3; _vPos.xz += _vPaletteOffset2; return _vPos.xyz; } else { return _vPos.xyz * _vPaletteScale3; } } #line 97 SLT_TEXCOORD4 slGetTerrainCliffBlendWeight(SLT_DIR3 _vcNormal) { SLT_TEXCOORD2 _vDouble = (SLT_TEXCOORD2)normalize( _vcNormal.xz * _vcNormal.xz + 1.0f/1024.0f ); SLT_TEXCOORD4 _vWeight; _vWeight.xy = _vDouble * _vDouble; _vWeight.wz = _vcNormal.zx; return _vWeight; } #line 118 SLT_POINT2 slGetTerrainBlendMapTexCoord(SLT_POINT4 _vPos) { return _vPos.xz * bmsize.xy + bmsize.zw; } #line 132 SLT_POINT2 slGetTerrainAreaProjectionTexCoord(SLT_POINT4 _vPos) { return _vPos.xz * texsizeFar.xy + texsizeFar.zw; } #line 145 SLT_POINT3 slGetTerrainBlendedRenderTargetTexCoord(SLT_POINT4 _vProjPos) { SLT_POINT3 _texCoord; _texCoord.xy = _vProjPos.xy * clipToRTT.xz + _vProjPos.ww * clipToRTT.yw; _texCoord.z = _vProjPos.w; return _texCoord; } #line 179 void slOutputTerrainLandTextureCoordinates( inout PIPE _pipe, uniform SLT_INT _nTypeID ) { if (!(_nTypeID == 1 || _nTypeID == 2)) { Error("Invalid terrain shader option setting"); }; SLT_POINT4 _vLocalPos = slGetWorldPosition( _pipe ); if ( _nTypeID == slpTerrainLandTexCoordOutputType() ) { if ( 3 == sloTerrainLandTextureNum() && !_pipe.IsExisting( "txcLand2" ) ) { _pipe.Insert( "txcLand01", (SLT_POINT4)slGetTerrainLandTexCoordPair( _vLocalPos, texsize0, uvOffset0 ) ); _pipe.Insert( "txcLand2", (SLT_POINT2)slGetTerrainLandTexCoordSingle( _vLocalPos, texsize1.xy, uvOffset1.xy ) ); } else if ( 2 == sloTerrainLandTextureNum() ) { if ( 0 < sloTerrainCliffPaletteNum() ) { if ( sloIsPalette1stCliff() && !_pipe.IsExisting( "txcCliff0" ) ) { _pipe.Insert( "txcCliff0", (SLT_POINT3)slGetTerrainLandTexCoordCliff( _vLocalPos, texsize0.xyx, uvOffset0.xy ) ); } if ( sloIsPalette2ndCliff() && !_pipe.IsExisting( "txcCliff1" ) ) { _pipe.Insert( "txcCliff1", (SLT_POINT3)slGetTerrainLandTexCoordCliff( _vLocalPos, texsize0.wzw, uvOffset0.wz ) ); } if ( !sloIsPalette1stCliff() && !_pipe.IsExisting( "txcLand0" ) ) { _pipe.Insert( "txcLand0", (SLT_POINT2)slGetTerrainLandTexCoordSingle( _vLocalPos, texsize0.xy, uvOffset0.xy ) ); } if ( !sloIsPalette2ndCliff() && !_pipe.IsExisting( "txcLand1" ) ) { _pipe.Insert( "txcLand1", (SLT_POINT2)slGetTerrainLandTexCoordSingle( _vLocalPos, texsize0.wz, uvOffset0.wz ) ); } } else if ( !_pipe.IsExisting( "txcLand01" ) ) { _pipe.Insert( "txcLand01", (SLT_POINT4)slGetTerrainLandTexCoordPair( _vLocalPos, texsize0, uvOffset0 ) ); } } else if ( 1 == sloTerrainLandTextureNum() ) { if ( 0 < sloTerrainCliffPaletteNum() && !_pipe.IsExisting( "txcCliff0" ) ) { _pipe.Insert( "txcCliff0", (SLT_POINT3)slGetTerrainLandTexCoordCliff( _vLocalPos, texsize0.xyx, uvOffset0.xy ) ); } else if ( !_pipe.IsExisting( "txcLand0" ) ) { _pipe.Insert( "txcLand0", (SLT_POINT2)slGetTerrainLandTexCoordSingle( _vLocalPos, texsize0.xy, uvOffset0.xy ) ); } } } } #line 261 void slOutputTerrainTextureCoordinatesBody( inout PIPE _pipe, uniform SLT_INT _nTypeID ) { if (!(_nTypeID == 1 || _nTypeID == 2)) { Error("Invalid terrain shader option setting"); }; slOutputTerrainLandTextureCoordinates( _pipe, _nTypeID ); if ( _nTypeID == slpTerrainBlendMapTexCoordOutputType() && !_pipe.IsExisting( "txcBlendMap" ) ) { _pipe.Insert( "txcBlendMap", (SLT_POINT2)slGetTerrainBlendMapTexCoord( slGetWorldPosition( _pipe ) ) ); } if ( _nTypeID == slpTerrainFarTexCoordOutputType() && !_pipe.IsExisting( "txcFarTex" ) ) { _pipe.Insert( "txcFarTex", (SLT_POINT2)slGetTerrainAreaProjectionTexCoord( slGetWorldPosition( _pipe ) ) ); } if ( _nTypeID == slpTerrainBlendedRenderTargetTexCoordOutputType() && !_pipe.IsExisting( "txcRtt" ) ) { _pipe.Insert( "txcRtt", (SLT_POINT3)slGetTerrainBlendedRenderTargetTexCoord( _pipe.vProjPos ) ); } if ( _nTypeID == slpTerrainCliffBlendWeightOutputType() && !_pipe.IsExisting( "vCliffWeight" ) ) { _pipe.Insert( "vCliffWeight", (SLT_TEXCOORD4)slGetTerrainCliffBlendWeight( slGetWorldNormal( _pipe ) ) ); } } #line 308 void slOutputVertexTerrainTextureCoordinates( inout PIPE _pipe ) { if ( 0 < sloTerrainTextureBlendMax() ) { slOutputTerrainTextureCoordinatesBody( _pipe, 1 ); } } #line 330 void slSetUpTerrainTextureCoordinatesPixel( inout PIPE _pipe ) { if ( 0 < sloTerrainTextureBlendMax() ) { slOutputTerrainTextureCoordinatesBody( _pipe, 2 ); } } #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainSetupTexture.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainTextureBlend.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" #line 27 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainTextureBlend.fx" SLT_COLOR4 slSampleBlendCliffTexture( uniform SLT_SAMPLER_2D _Sampler, SLT_POINT3 _vTexCoord, SLT_TEXCOORD4 _vWeight ) { SLT_COLOR4 _TexXY = h4tex2D( _Sampler, _vTexCoord.xy ); SLT_COLOR4 _TexYZ = h4tex2D( _Sampler, _vTexCoord.zy ); return ( _TexYZ * _vWeight.x + _TexXY * _vWeight.y ); } #line 52 SLT_COLOR4 slGetBlendTerrainTexture(PIPE _pipe) { SLT_COLOR4 _clBlend; if ( 0 == sloTerrainLandTextureNum() && 0 < sloTerrainFarTextureNum() ) { _clBlend = _pipe.clFarTex; } else if ( 1 == sloTerrainLandTextureNum() && 1 == sloTerrainTextureBlendMax() && !_pipe.IsExisting( "vTexWeight" ) ) { _clBlend = _pipe.clLand0; } else { if (!(0 < sloTerrainLandTextureNum())) { Error("Invalid terrain shader option setting"); }; if ( 0 < sloTerrainLandTextureNum() ) { _clBlend = _pipe.clLand0 * _pipe.vTexWeight.r; } if ( 1 < sloTerrainLandTextureNum() ) { _clBlend += _pipe.clLand1 * _pipe.vTexWeight.g; } if ( 2 < sloTerrainLandTextureNum() ) { _clBlend += _pipe.clLand2 * _pipe.vTexWeight.b; } if ( 0 < sloTerrainBlendedRenderTargetNum() ) { _clBlend.rgb += _pipe.clRtt.rgb; } if ( 0 < sloTerrainFarTextureNum() ) { if ( sloIsPBS() ) { _clBlend += _pipe.clFarTex * _pipe.vFarWeight; } else { _clBlend.rgb += _pipe.clFarTex.rgb * _pipe.vFarWeight; } } } if ( sloIsBlendRenderTargetShaderType() ) { if (!(!slpIsTerrainSpecularLightingType())) { Error("Invalid terrain shader option setting"); }; if ( 1 == sloTerrainLandTextureNum() ) { _clBlend.a = _pipe.vTexWeight.r * 0.5f; } else if ( 2 == sloTerrainLandTextureNum() ) { _clBlend.a = ( _pipe.vTexWeight.r + _pipe.vTexWeight.g ) * 0.5f; } else if ( 3 == sloTerrainLandTextureNum() ) { _clBlend.a = dot( _pipe.vTexWeight.rgb, SLT_COLOR3( 0.5f,0.5f,0.5f ) ); } } return _clBlend; } #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainNormalMapBlend.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/../func/slAccessories.fx" #line 43 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainNormalMapBlend.fx" SLT_DIR4 slSampleBlendCliffNormalMap( uniform SLT_SAMPLER_2D _Sampler, SLT_TEXCOORD3 _vTexCoord, SLT_TEXCOORD4 _vWeight ) { SLT_DIR4 _DirXY = h4tex2D( _Sampler, _vTexCoord.xy ); SLT_DIR4 _DirYZ = h4tex2D( _Sampler, _vTexCoord.zy ); return ( _DirYZ * _vWeight.x + _DirXY * _vWeight.y ); } #line 62 SLT_DIR4 slDecompressTerrainNormalMap(SLT_DIR4 _clNormalMap) { if ( sloGetNormalMapCompressionType() == 0 ) { return _clNormalMap; } else { if ( sloIsPBS() ) { Error( "this normalmap compression type is not supported at physically based KTGLTerrain" ); } SLT_DIR4 _clDecompress = _clNormalMap; if ( slpIsNormalMapARSwapped() ) { _clDecompress = _clDecompress.agbr; } if ( sloGetNormalMapCompressionType() == 4 ) { _clDecompress.r *= _clDecompress.a; } if ( slpIsNormalMapBAccumulated() ) { Error( "this normalmap compression type is not supported at KTGLTerrain" ); } return _clDecompress; } } #line 123 SLT_DIR4 slGetBlendTerrainNormalMap(PIPE _pipe) { SLT_DIR4 _clNormalMap; if ( sloArePaletteBothNormalMap() ) { _clNormalMap = _pipe.vTexWeight.r * _pipe.clNormalMap0 + _pipe.vTexWeight.g * _pipe.clNormalMap1; _clNormalMap = slDecompressTerrainNormalMap( _clNormalMap ); if ( 2 != sloTerrainTextureBlendMax() ) { SLT_COLOR1 _fConstWeight = 1.0 - _pipe.vTexWeight.r - _pipe.vTexWeight.g; _clNormalMap.xyz = _clNormalMap.xyz + SLT_DIR3(0.5f,0.5f,1.0f) * _fConstWeight; } } else if ( sloIsPalette1stNormalMap() ) { _clNormalMap = slDecompressTerrainNormalMap( _pipe.clNormalMap0 ); if ( 1 != sloTerrainTextureBlendMax() ) { _clNormalMap.xyz = lerp( SLT_DIR3(0.5f,0.5f,1.0f), _clNormalMap.xyz, _pipe.vTexWeight.r ); } } else if ( sloIsPalette2ndNormalMap() ) { _clNormalMap = slDecompressTerrainNormalMap( _pipe.clNormalMap1 ); if ( 1 != sloTerrainTextureBlendMax() ) { _clNormalMap.xyz = lerp( SLT_DIR3(0.5f,0.5f,1.0f), _clNormalMap.xyz, _pipe.vTexWeight.g ); } } else { if (!(0)) { Error("Invalid terrain shader option setting"); }; _clNormalMap = SLT_DIR4(0.5f,0.5f,1.0f,1.0f); } _clNormalMap.xyz = slNormalizeDirection( _clNormalMap.xyz - 0.5f ); return _clNormalMap; } #line 38 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainSetupTexture.fx" SLT_COLOR4 slGetTerrainBlendedColor( PIPE _pipe ) { return _pipe.clBlendTexture; } #line 50 SLT_DIR4 slGetTerrainBlendedNormal( PIPE _pipe ) { return _pipe.vcBlendNormal; } #line 74 void slSetUpTerrainPaletteTextures( inout PIPE _pipe ) { if ( 0 < sloTerrainLandTextureNum() ) { _pipe.Insert( "SLT_COLOR4", "clLand0" ); if ( _pipe.IsExisting( "txcLand0" ) ) { _pipe.clLand0 = h4tex2D( sLand0, _pipe.txcLand0.xy ); } else if ( _pipe.IsExisting( "txcLand01" ) ) { _pipe.clLand0 = h4tex2D( sLand0, _pipe.txcLand01.xy ); } else if ( _pipe.IsExisting( "txcCliff0" ) && _pipe.IsExisting( "vCliffWeight" ) ) { _pipe.clLand0 = slSampleBlendCliffTexture( sLand0, _pipe.txcCliff0, _pipe.vCliffWeight ); } else { Error( "Undefined land texcoord[0]" ); } } if ( 1 < sloTerrainLandTextureNum() ) { _pipe.Insert( "SLT_COLOR4", "clLand1" ); if ( _pipe.IsExisting( "txcLand1" ) ) { _pipe.clLand1 = h4tex2D( sLand1, _pipe.txcLand1.xy ); } else if ( _pipe.IsExisting( "txcLand01" ) ) { _pipe.clLand1 = h4tex2D( sLand1, _pipe.txcLand01.wz ); } else if ( _pipe.IsExisting( "txcCliff1" ) && _pipe.IsExisting( "vCliffWeight" ) ) { _pipe.clLand1 = slSampleBlendCliffTexture( sLand1, _pipe.txcCliff1, _pipe.vCliffWeight ); } else { Error( "Undefined land texcoord[1]" ); } } if ( 2 < sloTerrainLandTextureNum() ) { _pipe.Insert( "SLT_COLOR4", "clLand2" ); if ( _pipe.IsExisting( "txcLand2" ) ) { _pipe.clLand2 = h4tex2D( sLand2, _pipe.txcLand2.xy ); } else { Error( "Undefined land texcoord[2]" ); } } if ( sloIsPalette1stNormalMap() ) { _pipe.Insert( "SLT_DIR4", "clNormalMap0" ); if ( _pipe.IsExisting( "txcLand0" ) ) { _pipe.clNormalMap0 = h4tex2D( sNMap, _pipe.txcLand0.xy ); } else if ( _pipe.IsExisting( "txcLand01" ) ) { _pipe.clNormalMap0 = h4tex2D( sNMap, _pipe.txcLand01.xy ); } else if ( _pipe.IsExisting( "txcCliff0" ) && _pipe.IsExisting( "vCliffWeight" ) ) { _pipe.clNormalMap0 = slSampleBlendCliffNormalMap( sNMap, _pipe.txcCliff0, _pipe.vCliffWeight ); } else { Error( "Undefined land texcoord[0]" ); } if ( sloIsPBS() ) { _pipe.Insert( "SLT_COLOR1", "fGlossiness0" ); _pipe.fGlossiness0 = _pipe.clNormalMap0.a; } } else if ( sloIsPBS() && 0 < sloTerrainLandTextureNum() ) { _pipe.Insert( "SLT_COLOR1", "fGlossiness0" ); if ( _pipe.IsExisting( "txcLand0" ) ) { _pipe.fGlossiness0 = h4tex2D( sNMap, _pipe.txcLand0.xy ).r; } else if ( _pipe.IsExisting( "txcLand01" ) ) { _pipe.fGlossiness0 = h4tex2D( sNMap, _pipe.txcLand01.xy ).r; } else if ( _pipe.IsExisting( "txcCliff0" ) && _pipe.IsExisting( "vCliffWeight" ) ) { _pipe.fGlossiness0 = slSampleBlendCliffNormalMap( sNMap, _pipe.txcCliff0, _pipe.vCliffWeight ).r; } else { Error( "Undefined land texcoord[0]" ); } } if ( sloIsPalette2ndNormalMap() ) { _pipe.Insert( "SLT_DIR4", "clNormalMap1" ); if ( sloIsPalette1stNormalMap() || sloIsPBS() ) { if ( _pipe.IsExisting( "txcLand1" ) ) { _pipe.clNormalMap1 = h4tex2D( sNMap2, _pipe.txcLand1.xy ); } else if ( _pipe.IsExisting( "txcLand01" ) ) { _pipe.clNormalMap1 = h4tex2D( sNMap2, _pipe.txcLand01.wz ); } else if ( _pipe.IsExisting( "txcCliff1" ) && _pipe.IsExisting( "vCliffWeight" ) ) { _pipe.clNormalMap1 = slSampleBlendCliffNormalMap( sNMap2, _pipe.txcCliff1, _pipe.vCliffWeight ); } else { Error( "Undefined land texcoord[1]" ); } } else { if ( _pipe.IsExisting( "txcLand1" ) ) { _pipe.clNormalMap1 = h4tex2D( sNMap, _pipe.txcLand1.xy ); } else if ( _pipe.IsExisting( "txcLand01" ) ) { _pipe.clNormalMap1 = h4tex2D( sNMap, _pipe.txcLand01.wz ); } else if ( _pipe.IsExisting( "txcCliff1" ) && _pipe.IsExisting( "vCliffWeight" ) ) { _pipe.clNormalMap1 = slSampleBlendCliffNormalMap( sNMap, _pipe.txcCliff1, _pipe.vCliffWeight ); } else { Error( "Undefined land texcoord[1]" ); } } if ( sloIsPBS() ) { _pipe.Insert( "SLT_COLOR1", "fGlossiness1" ); _pipe.fGlossiness1 = _pipe.clNormalMap1.a; } } else if ( sloIsPBS() && 1 < sloTerrainLandTextureNum() ) { _pipe.Insert( "SLT_COLOR1", "fGlossiness1" ); if ( _pipe.IsExisting( "txcLand1" ) ) { _pipe.fGlossiness1 = h4tex2D( sNMap2, _pipe.txcLand1.xy ).r; } else if ( _pipe.IsExisting( "txcLand01" ) ) { _pipe.fGlossiness1 = h4tex2D( sNMap2, _pipe.txcLand01.wz ).r; } else if ( _pipe.IsExisting( "txcCliff1" ) && _pipe.IsExisting( "vCliffWeight" ) ) { _pipe.fGlossiness1 = slSampleBlendCliffNormalMap( sNMap2, _pipe.txcCliff1, _pipe.vCliffWeight ).r; } else { Error( "Undefined land texcoord[1]" ); } } } #line 233 void slSetUpTerrainOptionalTextures( inout PIPE _pipe ) { if ( 0 < sloTerrainBlendedRenderTargetNum() ) { _pipe.Insert( "clRtt", (SLT_COLOR4)slColorTex2DProj( sRtt, _pipe.txcRtt.xyzz ) ); _pipe.clRtt.a += _pipe.clRtt.a; } if ( 0 < sloTerrainFarTextureNum() ) { _pipe.Insert( "clFarTex", (SLT_COLOR4)h4tex2D( sFarTex, _pipe.txcFarTex.xy ) ); } if ( 0 < sloTerrainBlendMapNum() ) { _pipe.Insert( "clBlendMap", (SLT_COLOR4)h4tex2D( sBlendMap, _pipe.txcBlendMap.xy ) ); } } #line 266 void slSetUpTerrainTextureBlendWeight( inout PIPE _pipe ) { if ( 0 == sloTerrainBlendMapNum() && 0 < sloTerrainBlendedRenderTargetNum() ) { _pipe.Insert( "vTexWeight", (SLT_COLOR1)( 1.0f - _pipe.clRtt.a ) ); } else if ( 0 < sloTerrainBlendMapNum() ) { if ( sloIsSampledBlendMapRGB() ) { _pipe.Insert( "vTexWeight", (SLT_COLOR3)_pipe.clBlendMap.rgb ); } else if ( sloIsSampledBlendMapRG() ) { _pipe.Insert( "vTexWeight", (SLT_COLOR2)_pipe.clBlendMap.rg ); } else if ( sloIsSampledBlendMapGB() ) { _pipe.Insert( "vTexWeight", (SLT_COLOR2)_pipe.clBlendMap.gb ); } else if ( sloIsSampledBlendMapBR() ) { _pipe.Insert( "vTexWeight", (SLT_COLOR2)_pipe.clBlendMap.br ); } else if ( sloIsSampledBlendMapR() ) { _pipe.Insert( "vTexWeight", (SLT_COLOR1)_pipe.clBlendMap.r ); } else if ( sloIsSampledBlendMapG() ) { _pipe.Insert( "vTexWeight", (SLT_COLOR1)_pipe.clBlendMap.g ); } else if ( sloIsSampledBlendMapB() ) { _pipe.Insert( "vTexWeight", (SLT_COLOR1)_pipe.clBlendMap.b ); } if ( sloIsNearShaderType() || sloIsMiddleShaderType() ) { SLT_COLOR1 fSum = 1.0f/1024.0f; if ( 1 == sloTerrainLandTextureNum() ) { fSum += _pipe.vTexWeight.r; } else if ( 2 == sloTerrainLandTextureNum() ) { fSum += _pipe.vTexWeight.r + _pipe.vTexWeight.g; } if ( 0 < sloTerrainBlendedRenderTargetNum() ) { fSum += _pipe.clRtt.a; _pipe.clRtt /= (SLT_COLOR4)fSum; } if ( sloIsSampledBlendMapRGB() ) { _pipe.vTexWeight /= (SLT_COLOR3)fSum; } else if ( sloIsSampledBlendMapRG() || sloIsSampledBlendMapGB() || sloIsSampledBlendMapBR() ) { _pipe.vTexWeight /= (SLT_COLOR2)fSum; } else if ( sloIsSampledBlendMapR() || sloIsSampledBlendMapG() || sloIsSampledBlendMapB() ) { _pipe.vTexWeight /= fSum; } } if (!(_pipe.IsExisting("vTexWeight"))) { Error("Invalid terrain shader option setting"); }; } if ( 0 < sloTerrainFarTextureNum() ) { _pipe.Insert( "SLT_COLOR1", "vFarWeight" ); if ( !_pipe.IsExisting("vTexWeight") ) { _pipe.Insert( "vTexWeight", (SLT_COLOR1)(1.0f) ); } if ( sloArePaletteBothCliff() ) { _pipe.vFarWeight = 1.0f - ( _pipe.vTexWeight.r + _pipe.vTexWeight.g ); } else if ( sloIsPalette1stCliff() ) { _pipe.vFarWeight = 1.0f - _pipe.vTexWeight.r; } else if ( sloIsPalette2ndCliff() ) { _pipe.vFarWeight = 1.0f - _pipe.vTexWeight.g; } else { _pipe.vFarWeight = 1.0f; } if ( sloIsMiddleShaderType() ) { _pipe.vFarWeight *= _pipe.fMorph; if ( sloTerrainLandTextureNum() != sloTerrainCliffPaletteNum() ) { if ( 1 < sloTerrainLandTextureNum() && 0 == sloTerrainCliffPaletteNum() ) { _pipe.vTexWeight.rg = _pipe.vTexWeight.rg - _pipe.vTexWeight.rg * _pipe.fMorph; } else if ( 1 < sloTerrainLandTextureNum() && sloIsPalette1stCliff() ) { _pipe.vTexWeight.g = _pipe.vTexWeight.g - _pipe.vTexWeight.g * _pipe.fMorph; } else if ( 0 < sloTerrainLandTextureNum() && !sloIsPalette1stCliff() ) { _pipe.vTexWeight.r = _pipe.vTexWeight.r - _pipe.vTexWeight.r * _pipe.fMorph; } } if ( 0 < sloTerrainBlendedRenderTargetNum() ) { _pipe.clRtt = _pipe.clRtt - _pipe.clRtt * _pipe.fMorph; } } } } #line 404 void slSetUpTerrainSpecularMap( inout PIPE _pipe ) { if ( sloIsEnabled1stSpecularMap() ) { if ( 0 == sloTerrainBlendMapNum() || sloIsEnabledSpecularMapBlend() ) { _pipe.Insert( "fTerrainSpMap1st", (SLT_COLOR1)( slGetTerrainBlendedColor( _pipe ).a ) ); } else { _pipe.Insert( "fTerrainSpMap1st", (SLT_COLOR1)( _pipe.clLand0.a * _pipe.vTexWeight.r ) ); } } else if ( sloIsPBS() && sloIsFarShaderType() ) { _pipe.Insert( "fTerrainSpMap1st", (SLT_COLOR1)( slGetTerrainBlendedColor( _pipe ).a ) ); } if ( sloIsEnabled2ndSpecularMap() ) { _pipe.Insert( "fTerrainSpMap2nd", (SLT_COLOR1)( _pipe.clLand1.a * _pipe.vTexWeight.g ) ); } } #line 449 void slSetUpTerrainTextures( inout PIPE _pipe ) { if ( 0 < sloTerrainTextureBlendMax() ) { slSetUpTerrainPaletteTextures( _pipe ); slSetUpTerrainOptionalTextures( _pipe ); slSetUpTerrainTextureBlendWeight( _pipe ); _pipe.Insert( "clBlendTexture", (SLT_COLOR4)slGetBlendTerrainTexture( _pipe ) ); if ( sloIsEnabledTerrainSpecularSetting() ) { slSetUpTerrainSpecularMap( _pipe ); } if ( sloMayBeUsedPaletteNormalMap() ) { _pipe.Insert( "vcBlendNormal", (SLT_DIR4)slGetBlendTerrainNormalMap( _pipe ) ); } } } #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainTextureBlend.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainNormalMapBlend.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainSpecularLighting.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/../func/slMaterial.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/../func/slLighting.fx" #line 33 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainSpecularLighting.fx" SLT_COLOR4 slGetTerrainPaletteSpecularConstant( PIPE _pipe, uniform SLT_INT _nIndex ) { if ( _nIndex == 0 ) { if ( sloIsPalette1stSpecular() ) { return spec0; } else if ( slcGetSpecularSource() == 1 || slcGetSpecularSource() == 3 ) { return cSpec; } } else if ( _nIndex == 1 && 1 < sloTerrainLandTextureNum() ) { if ( sloIsPalette2ndSpecular() ) { return spec1; } else if ( slcGetSpecularSource() == 1 || slcGetSpecularSource() == 3 ) { return cSpec; } } else { if (!(0)) { Error("Invalid terrain shader option setting"); }; } return SLT_COLOR4(0.0f,0.0f,0.0f,0.0f); } #line 75 SLT_COLOR4 slGetTerrainPaletteSpecularSoruce( PIPE _pipe, uniform SLT_INT _nIndex ) { SLT_COLOR4 _clSpecular = slGetTerrainPaletteSpecularConstant( _pipe, _nIndex ); if (slcGetSpecularSource() == 2 || slcGetSpecularSource() == 3) { if (slcIsSpecularSourceBranchEnabled()) { _clSpecular += _pipe.vtxColor0 * vMatSrc.x; } else { _clSpecular += _pipe.vtxColor0; } } return _clSpecular; } #line 103 void slApplyTerrainSpecularMaterial(inout PIPE _pipe) { #line 110 if ( sloIsEnabled1stSpecularMap() ) { SLT_COLOR4 _clMaterialSpecular = slGetTerrainPaletteSpecularSoruce(_pipe, 0); if (_pipe.IsExisting( "clMainSpecular" )) { _pipe.clMainSpecular.rgb *= _clMaterialSpecular.rgb; } if (_pipe.IsExisting( "clSpecular" )) { _pipe.clSpecular.rgb *= _clMaterialSpecular.rgb; }; } if ( sloIsEnabled2ndSpecularMap() ) { SLT_COLOR4 _clMaterialSpecular2 = slGetTerrainPaletteSpecularSoruce(_pipe, 1); if (_pipe.IsExisting( "clMainPaletteSpec2nd" )) { _pipe.clMainPaletteSpec2nd.rgb *= _clMaterialSpecular2.rgb; } if (_pipe.IsExisting( "clPaletteSpec2nd" )) { _pipe.clPaletteSpec2nd.rgb *= _clMaterialSpecular2.rgb; }; } } #line 139 void slApplyTerrainLighting( inout PIPE _pipe, SLT_COLOR3 _clLightColor, SLT_DIR3 _vcLightDir, uniform bool _bMainLight, uniform bool _bDiffuse, uniform bool _bSpecular ) { SLT_COLOR3 _clDiffuse; SLT_COLOR3 _clSpecular; SLT_DIR3 _vEyeDir = slGetLightingEyeDirection(_pipe); SLT_DIR3 _vNormal = slGetLightingNormal(_pipe); SLT_DIR1 _fDot = dot( _vNormal, -_vcLightDir ); SLT_DIR3 _vcHalf = slNormalizeDirection( _vEyeDir - _vcLightDir ); SLT_BOOL _bEnable1stSpecular = _bSpecular || sloIsEnabled1stSpecularMap(); SLT_BOOL _bMayBeUsedSpecular = _bEnable1stSpecular || sloIsEnabled2ndSpecularMap(); if (_bDiffuse && _bMayBeUsedSpecular) { SLT_COLOR3 _result = slGetLightingCoeffs( _fDot, _vNormal, _vEyeDir, _vcHalf, _pipe.fSpecularDecay ); _clDiffuse = _clLightColor * _result.y; _clSpecular = _clLightColor * _result.z; } else if (_bMayBeUsedSpecular) { _clSpecular = _clLightColor * slGetSpecularCoeff( _fDot, _vNormal, _vEyeDir, _vcHalf, _pipe.fSpecularDecay ); } else if (_bDiffuse) { _clDiffuse = _clLightColor * saturate( _fDot ); } if (_bDiffuse) { slAddDiffuseTerm( _pipe, _clDiffuse, _bMainLight ); } if (_bEnable1stSpecular) { slAddSpecularTerm( _pipe, _clSpecular, _bMainLight ); } if (sloIsEnabled2ndSpecularMap()) { if ( _bEnable1stSpecular ) { _clSpecular = _clLightColor * slGetSpecularCoeff( _fDot, _vNormal, _vEyeDir, _vcHalf, slGetTerrainPaletteSpecularConstant(_pipe, 1).w ); } if (_bMainLight && _pipe.IsExisting( "clMainPaletteSpec2nd")) { _pipe.clMainPaletteSpec2nd += _clSpecular; } else { _pipe.clPaletteSpec2nd += _clSpecular; } } } #line 204 void slSetUpTerrainPaletteSpecular( inout PIPE _pipe, uniform bool _bSpecular, uniform bool _bMainLighting, uniform bool _bSubLighting ) { #line 212 if ( !_bSpecular && sloIsEnabled1stSpecularMap() ) { if ( _bMainLighting && !_pipe.IsExisting( "clMainSpecular" ) ) { _pipe.Insert( "clMainSpecular", SLT_COLOR3(0,0,0) ); } if ( _bSubLighting && !_pipe.IsExisting( "clSpecular" ) ) { _pipe.Insert( "clSpecular", SLT_COLOR3(0,0,0) ); }; } if ( sloIsEnabled2ndSpecularMap() ) { if ( _bMainLighting && !_pipe.IsExisting( "clMainPaletteSpec2nd" ) ) { _pipe.Insert( "clMainPaletteSpec2nd", SLT_COLOR3(0,0,0) ); } if ( _bSubLighting && !_pipe.IsExisting( "clPaletteSpec2nd" ) ) { _pipe.Insert( "clPaletteSpec2nd", SLT_COLOR3(0,0,0) ); }; } if ( !_bSpecular && !_pipe.IsExisting( "fSpecularDecay" ) ) { if ( sloIsEnabled1stSpecularMap() ) { _pipe.Insert( "fSpecularDecay", slGetTerrainPaletteSpecularConstant(_pipe, 0).a ); } else if ( sloIsEnabled2ndSpecularMap() ) { _pipe.Insert( "fSpecularDecay", slGetTerrainPaletteSpecularConstant(_pipe, 1).a ); } } else if ( sloIsEnabled1stSpecularMap() ) { _pipe.fSpecularDecay = slGetTerrainPaletteSpecularConstant(_pipe, 0).a; } } #line 247 void slCompositTerrainVertexMainLightingResult( inout PIPE _pipe, uniform bool _bSpecular ) { #line 260 if ( !_bSpecular && sloIsEnabled1stSpecularMap() ) { if (slpIsMainLightComputedSeparately()) { slApplyMainLightColor( _pipe.clMainSpecular.rgb, _pipe ); slCompositVertexMainLightTerm( _pipe.clSpecular, _pipe.clMainSpecular, _pipe ); } else if ( slcIsShadowEnabled() && _pipe.IsExisting( "clSpecular" )) { _pipe.clSpecular.xyz *= _pipe.fShadow; }; } if ( sloIsEnabled2ndSpecularMap() ) { if (slpIsMainLightComputedSeparately()) { slApplyMainLightColor( _pipe.clMainPaletteSpec2nd.rgb, _pipe ); slCompositVertexMainLightTerm( _pipe.clPaletteSpec2nd, _pipe.clMainPaletteSpec2nd, _pipe ); } else if ( slcIsShadowEnabled() && _pipe.IsExisting( "clPaletteSpec2nd" )) { _pipe.clPaletteSpec2nd.xyz *= _pipe.fShadow; }; } } #line 281 void slCompositTerrainPixelMainLightingResult( inout PIPE _pipe, uniform bool _bSpecular ) { #line 294 if ( !_bSpecular && sloIsEnabled1stSpecularMap() ) { if (_pipe.IsExisting( "clMainSpecular" )) { if (slcShadowMayBeCasted()) { _pipe.clSpecular += _pipe.clMainSpecular * _pipe.fShadow; } else { _pipe.clSpecular += _pipe.clMainSpecular; } }; } if ( sloIsEnabled2ndSpecularMap() ) { if (_pipe.IsExisting( "clMainPaletteSpec2nd" )) { if (slcShadowMayBeCasted()) { _pipe.clPaletteSpec2nd += _pipe.clMainPaletteSpec2nd * _pipe.fShadow; } else { _pipe.clPaletteSpec2nd += _pipe.clMainPaletteSpec2nd; } }; } } #line 314 void slApplyTerrainSpecularMap( inout PIPE _pipe ) { SLT_BOOL _bExistSpecular = _pipe.IsExisting( "clSpecular" ); SLT_BOOL _bExistSpecular2nd = _pipe.IsExisting( "clPaletteSpec2nd" ); if ( _bExistSpecular ) { _pipe.clSpecular = slClampLightColor(_pipe.clSpecular); _pipe.clSpecular *= _pipe.fTerrainSpMap1st; } if ( _bExistSpecular2nd ) { _pipe.clPaletteSpec2nd = slClampLightColor( _pipe.clPaletteSpec2nd ); _pipe.clPaletteSpec2nd *= _pipe.fTerrainSpMap2nd; if ( _bExistSpecular ) { _pipe.clSpecular += _pipe.clPaletteSpec2nd; } else { _pipe.Insert( "clSpecular", _pipe.clPaletteSpec2nd ); } } } #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainOverrideFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainConstFunc.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainSetupTexture.fx" #line 1 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainSpecularLighting.fx" #line 65 "D://KTGL/shaderlib2/shader/include/../KTGLTerrain/slTerrainOverrideFunc.fx" SLT_BOOL slIsSpecularEnabled() { if (slcIsSpecularSourceBranchEnabled()) { Error("Invalid material option : can not use BR_SPECULAR branch option at KTGLTerrain"); } return sloIsEnabledTerrainSpecularSetting(); } #line 85 void slApplySpecularMaterial(inout PIPE _pipe) { if ( sloMayBeUsedPaletteSpecular() ) { slApplyTerrainSpecularMaterial( _pipe ); } else { slApplySpecularMaterialDefault( _pipe ); } } #line 102 void slApplyLighting( inout PIPE _pipe, SLT_COLOR3 _clLightColor, SLT_DIR3 _vcLightDir, uniform bool _bMainLight, uniform bool _bDiffuse, uniform bool _bSpecular ) { if ( sloMayBeUsedPaletteSpecular() ) { slApplyTerrainLighting( _pipe, _clLightColor, _vcLightDir, _bMainLight, _bDiffuse, _bSpecular ); } else { slApplyBlinnPhongLighting( _pipe, _clLightColor, _vcLightDir, _bMainLight, _bDiffuse, _bSpecular ); } } #line 126 void slPrepareLighting(inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular, uniform bool _bMainLighting, uniform bool _bSubLighting) { slPrepareLightingDefault( _pipe, _bDiffuse, _bSpecular, _bMainLighting, _bSubLighting ); if ( sloMayBeUsedPaletteSpecular() ) { slSetUpTerrainPaletteSpecular( _pipe, _bSpecular, _bMainLighting, _bSubLighting ); } } #line 146 void slCompositVertexMainLightingResult( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { slCompositVertexMainLightingResultDefault( _pipe, _bDiffuse, _bSpecular ); if ( sloMayBeUsedPaletteSpecular() ) { slCompositTerrainVertexMainLightingResult( _pipe, _bSpecular ); } } #line 168 void slCompositPixelMainLightingResult( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { slCompositPixelMainLightingResultDefault( _pipe, _bDiffuse, _bSpecular ); if ( sloMayBeUsedPaletteSpecular() ) { slCompositTerrainPixelMainLightingResult( _pipe, _bSpecular ); } } #line 190 void slApplyAllLightShadow( inout PIPE _pipe, uniform bool _bDiffuse, uniform bool _bSpecular ) { if (slcIsShadowCastedForAllLight()) { if (_bDiffuse) { _pipe.clDiffuse.rgb *= _pipe.fShadow; } if (_bSpecular || sloIsEnabled1stSpecularMap()) { _pipe.clSpecular *= _pipe.fShadow; } if (sloIsEnabled2ndSpecularMap()) { _pipe.clPaletteSpec2nd *= _pipe.fShadow; } } } #line 215 SLT_DIR4 slGetNormalMapVector(PIPE _pipe) { if ( sloMayBeUsedPaletteNormalMap() ) { return slGetTerrainBlendedNormal( _pipe ); } else { return slGetNormalMap( slGetNormalMapTexCoord(_pipe), sNMap ); } } #line 233 SLT_TEXCOORD2 slGetLightMapTexCoord( PIPE _pipe ) { return slGetTerrainAreaProjectionTexCoord( slGetWorldPosition( _pipe ) ); } #line 244 void slApplyTextureStages(inout PIPE _pipe) { if ( slpIsTerrainLightAndShadowType() ) { _pipe.clDiffuse.rgb = slClampLightColor(_pipe.clDiffuse.rgb); if ( 0 < sloTerrainTextureBlendMax() ) { _pipe.clDiffuse.rgb *= slGetTerrainBlendedColor( _pipe ).rgb; if ( sloIsEnabledTerrainSpecularSetting() ) { slApplyTerrainSpecularMap( _pipe ); } } else if ( _pipe.IsExisting( "clSpecular" ) ) { _pipe.clSpecular = slClampLightColor(_pipe.clSpecular); } } else { if (!(0 < sloTerrainTextureBlendMax())) { Error("Invalid terrain shader option setting"); }; _pipe.Insert( "clDiffuse", slGetTerrainBlendedColor( _pipe ) ); } _pipe.clDiffuse *= slcGetTexMultiplier(); } #line 288 SLT_PARAM_FLOAT4 mNormalL2V[3]; SLT_DIR3 slGetViewNormal(SLT_DIR3 vWorldNormal) { SLT_DIR3 _vOut; _vOut.x = dot( (SLT_DIR3)mNormalL2V[0], vWorldNormal ); _vOut.y = dot( (SLT_DIR3)mNormalL2V[1], vWorldNormal ); _vOut.z = dot( (SLT_DIR3)mNormalL2V[2], vWorldNormal ); return _vOut; } void slSetupGBufferParam(inout PIPE _pipe) { SLT_COLOR4 _clDiffuse = slGetDiffuseColor( _pipe ); if (_pipe.IsExisting( "clBlendTexture") ) { _pipe.GBufDiffuse = _clDiffuse * _pipe.clBlendTexture; } else { _pipe.GBufDiffuse = _clDiffuse; } SLT_COLOR3 _clSpecular; if ( _pipe.IsExisting( "fTerrainSpMap1st" ) ) { _clSpecular = slGetTerrainPaletteSpecularSoruce( _pipe, 0 ).rgb; _clSpecular *= _pipe.fTerrainSpMap1st; } else { _clSpecular = SLT_COLOR3( 0.0f, 0.0f, 0.0f ); } if ( 1 < sloTerrainLandTextureNum() ) { if ( _pipe.IsExisting( "fTerrainSpMap2nd" ) ) { SLT_COLOR3 _c = slGetTerrainPaletteSpecularSoruce( _pipe, 1 ).rgb; _clSpecular += _c * _pipe.fTerrainSpMap2nd; } } _pipe.GBufSpecular = _clSpecular; SLT_COLOR _clSpDecay = 1.0f; if( _pipe.IsExisting( "fSpecularDecay" )) { _clSpDecay = log2( _pipe.fSpecularDecay ); } _pipe.GBufSpDecay = _clSpDecay * 0.1f; if( _pipe.IsExisting( "clAlbedoColor" )) { _pipe.GBufAlbedoColor = _pipe.clAlbedoColor; } if( _pipe.IsExisting( "fGlossiness" )) { _pipe.GBufGlossiness = _pipe.fGlossiness; } else { _pipe.GBufGlossiness = (_clSpDecay - 1.0f) * 0.1f; } if( _pipe.IsExisting( "clReflectance" )) { _pipe.GBufReflectance = _pipe.clReflectance; } if (slcIsLightMapAccessory()) { _pipe.GBufOcclusion = slGetLightMap(_pipe).a; } else if (slcIsPatternMapping()) { SLT_COLOR4 _clPatternMap = h4tex2D( sLit, (SLT_TEXCOORD2)_pipe.vPatternPos ); _clPatternMap = lerp( SLT_COLOR4(1.0f, 1.0f, 1.0f, 1.0f), _clPatternMap, fPtn ); _pipe.GBufOcclusion = _clPatternMap.r; } SLT_DIR3 _vNormal = slGetViewNormal( slGetLightingNormal( _pipe ) ); _pipe.GBufNormal = slVector2Color( _vNormal ); _pipe.GBufShType = slcGetGBufferShaderType()/255.0f; SLT_FLOAT1 _fDepth = _pipe.vDepth.x/_pipe.vDepth.y; _pipe.GBufDepth = slFloat2RGB(_fDepth); } #line 10 "./shader/../../_tool/KTGLTerrainG.fx" int slKTGLBlendMapTerrainShader : GLOBAL < string ShaderID = "KTF"; int4 ShaderVersion = {0,0,0,1}; string EntryVS = "mainVS"; string EntryPS = "mainPS"; string Options = "slKTGLTerrainShaderOption"; string Description = "BlendMap Terrain Shader"; string DescriptionJ = "ブレンドマップ形式用地形描画シェーダ"; int AutoRegMapVS = slcTerrainAutoRegisterMapStartVS(); int AutoRegMapPS = slcTerrainAutoRegisterMapStartPS(); >; void mainVS(inout PIPE _pipe) { slSetUpTerrainVertex( _pipe ); slDecodeTerrainVertex( _pipe ); slTransformTerrainVertex( _pipe ); _pipe.Output( "vOutPos", "POSITION", _pipe.vProjPos ); if ( !slpIsTerrainOutputVertexOnlyType() ) { slOutputVertexTerrainTextureCoordinates( _pipe ); if ( slpIsTerrainLightAndShadowType() ) { slApplyAccessoryVertexLighting( _pipe ); slOutputVertexShadowMapPosition( _pipe ); slOutputVertexFog( _pipe ); slOutputVertexFogDepth( _pipe ); } slOutputAccessoryVertex( _pipe ); } else if ( sloIsDepthShaderType() && slcWriteRTAccessory() ) { slOutputWriteRTVertex( _pipe ); } } #line 120 void mainPS(inout PIPE _pipe) { _pipe.Output( "color0", "COLOR0", (SLT_COLOR4)(SLT_COLOR4(0,0,0,0)) ); }