ShaderLotskirt
From SimsWiki
EP2-NL 0xCD7FE87A 0x1C0532FA 0x0C50FBBF 0xFF439C10 # lotskirt # # Shaders for lot skirt # # seti lotSkirtLayer -6 # ============================================================================== define LotSkirtMaterialDefinition() setb hasColor false seti totalLights 0 material setc stdMatDiffCoef $terrainMatDiffCoef shader -layer ($lotSkirtLayer * 8) validateRenderShaderContext -vertexFormat position 0 required validateRenderShaderContext -vertexFormat normal 0 required validateRenderShaderContext -vertexFormat texcoord 0 required # not all lots seem to have this data, causing validation errors, making this a dynamic predicate solves this problem. setb hasColor (hasVertexFormat(color,0)) if ($hasColor) validateRenderShaderContext -vertexFormat color 0 required endif pass -fixedFunction create LightingStates() depthTestFunction acceptIfLessOrEqual ffDepthOffset -1 create AttenuatedMatCoef(1.0) alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha) fillmode $stdMatFillMode stage texture $surfaceTexture textureAddressing tile tile textureBlend multiply(texture diffuse) select(diffuse) end end end #end shader end #end material enddef define LotSkirtRoadMaterialDefinition() setb hasColor false seti totalLights 0 material shader -layer ($lotSkirtLayer * 8) validateRenderShaderContext -vertexFormat position 0 required validateRenderShaderContext -vertexFormat normal 0 required validateRenderShaderContext -vertexFormat texcoord 0 required #create DetermineHardwareSupport() #if ($useFixedFunctionPath) setb hasColor (hasVertexFormat(color,0)) if ($hasColor) validateRenderShaderContext -vertexFormat color 0 required endif pass -fixedFunction create LightingStates() #create LightingStatesNoStdLights() create AttenuatedMatCoef(1.0) alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha) fillmode $stdMatFillMode stage texture $surfaceTexture textureAddressing clamp clamp textureBlend multiply(texture diffuse) multiply(texture diffuse) end end #< else create SetupCommonHWShaderVariablesAndPredicates() if ($hasColor) vertexFormatPred color 0 true endif pass create NonStandardLighting() fillmode $stdMatFillMode alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha) shaderProgram -target vertexProgram -method link create BindsForHardwareVS1Transforms(false false) create BindsForLighting($kFullLighting) # override diffuse, since DX8 path divs by 2. shaderFragment TransformRigidForLighting1_1 if ($totalLights) bindConstants 14 -bindingID immediateData -data (2,2,2,1) shaderFragment TransformRigidForLighting1_1 create DX8DiffusePassLightFragments(true false 0 $totalLights $distantLightCount $pointLightCount $spotLightCount 1_1) shaderFragment CopyVertexAlphaToDiffuse1_1 stage texture $surfaceTexture textureAddressing tile tile textureBlend multiply(texture diffuse) multiply(texture diffuse) end else # eyeballed this value to sorta make the sidewalks match. # grass is still dark, road matches ok. bindConstants 14 -bindingID immediateData -data (0.8,0.82,0.88,1) shaderFragment TransformPositionRigidNoLighting1_1 shaderFragment Copy2DTexcoords1_1 shaderFragment AmbientLightingVertexColorMaterial1_1 stage texture $surfaceTexture textureAddressing tile tile textureBlend multiply(texture diffuse) multiply(texture diffuse) end endif end end #end pass endif #> end end enddef define LotSkirtRoadMaterialInstance(materialName textureName) materialDefinition &materialName setDefinition LotSkirtRoadMaterialDefinition addParam surfaceTexture &textureName end enddef define LotSkirtBoundaryClipMaterial() material shader -layer (($lotSkirtLayer - 1) * 8) pass -fixedFunction -clipAlways colorScalar (1, 1, 1, 1) depthTest true -enableDepthWrite true alphaBlend srcFactor(destColor) add dstFactor(zero) depthTestFunction acceptIfLess cullmode cullCounterClockwise stage textureBlend select(colorScalar) select(colorScalar) end end end end enddef materialDefinition lotSkirtBoundaryClip setDefinition LotSkirtBoundaryClipMaterial end # ============================================================================== create LotSkirtRoadMaterialInstance(lotSkirtRoad_Desert_00005700 lotskirtroad_desert_00005704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Desert_00020700 lotskirtroad_desert_00020704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Desert_00000f00 lotskirtroad_desert_00000f04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Desert_00000300 lotskirtroad_desert_00000304) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Desert_00004b00 lotskirtroad_desert_00004b04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Temperate_00005700 lotskirtroad_temperate_00005704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Temperate_00020700 lotskirtroad_temperate_00020704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Temperate_00000f00 lotskirtroad_temperate_00000f04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Temperate_00000300 lotskirtroad_temperate_00000304) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Temperate_00004b00 lotskirtroad_temperate_00004b04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_European_00005700 lotskirtroad_european_00005704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_European_00020700 lotskirtroad_european_00020704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_European_00000f00 lotskirtroad_european_00000f04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_European_00000300 lotskirtroad_european_00000304) create LotSkirtRoadMaterialInstance(lotSkirtRoad_European_00004b00 lotskirtroad_european_00004b04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Dirt_00005700 lotskirtroad_dirt_00005704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Dirt_00020700 lotskirtroad_dirt_00020704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Dirt_00000f00 lotskirtroad_dirt_00000f04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Dirt_00000300 lotskirtroad_dirt_00000304) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Dirt_00004b00 lotskirtroad_dirt_00004b04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Concrete_00005700 lotskirtroad_concrete_00005704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Concrete_00020700 lotskirtroad_concrete_00020704) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Concrete_00000f00 lotskirtroad_concrete_00000f04) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Concrete_00000300 lotskirtroad_concrete_00000304) create LotSkirtRoadMaterialInstance(lotSkirtRoad_Concrete_00004b00 lotskirtroad_concrete_00004b04)