Difference between revisions of "TEST-STRCMP4CODES"
Line 1: | Line 1: | ||
− | # | + | EP3-OFB |
+ | 0xCD7FE87A | ||
+ | 0x1C0532FA | ||
+ | 0xB00AEAC0 | ||
+ | 0xFF7D973E | ||
+ | # rug | ||
− | + | ||
− | # | + | ############################################################## |
− | # | + | # Rugs |
− | # | + | # |
− | + | ||
− | define | + | seti rugLayer -2 |
− | material | + | setb forceFF false |
− | + | setb hasShapeColor false | |
− | + | ||
− | + | define RugMaterialFF() | |
− | + | material | |
− | + | shader -layer $rugLayer | |
− | + | ||
− | + | if ($hasShapeColor) | |
− | + | pass -fixedFunction -modifiedEachFrameHint | |
+ | else | ||
+ | pass -fixedFunction | ||
+ | endif | ||
+ | |||
+ | create LightingStates() | ||
+ | create AttenuatedMatCoef(1) | ||
+ | |||
+ | |||
+ | ffDepthOffset 2 | ||
− | + | alphaTest true 127 | |
− | + | alphaTestFunction acceptIfGreater | |
− | + | depthTest true -enableDepthWrite false | |
− | + | ||
− | + | colorScalar (0.8, 0.8, 0.8, 1) | |
− | + | ||
− | + | if ($hasShapeColor) | |
− | + | tsEdithShapeColor $currentMaterialName | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | stage | |
− | + | texture $rugTexture | |
− | + | ffTextureCoordsSource 0 | |
− | + | # add the lightmap lighting to any direct lights. | |
− | + | # the light map has been prescaled by 0.5 | |
− | + | textureBlend multiply(texture colorScalar) select(texture) | |
− | + | end | |
− | end | + | |
− | end | + | else |
− | end | + | |
+ | stage | ||
+ | texture "floorLightMap_${page}" | ||
+ | ffTextureCoordsSource 1 | ||
+ | # add the lightmap lighting to any direct lights. | ||
+ | # the light map has been prescaled by 0.5 | ||
+ | textureBlend multiply(texture colorScalar) select(texture) | ||
+ | end | ||
+ | |||
+ | stage | ||
+ | texture $rugTexture | ||
+ | textureAddressing clamp clamp | ||
+ | ffTextureCoordsSource 0 | ||
+ | textureBlend multiplyScale2(texture outRegister) select(texture) | ||
+ | end #end stage | ||
+ | endif | ||
+ | |||
+ | end #pass | ||
+ | end #end shader | ||
+ | end #end material | ||
+ | enddef | ||
+ | |||
+ | setv3 matdiffuse (0.8, 0.8, 0.8) | ||
+ | |||
+ | define RugMaterialGen() | ||
+ | material | ||
+ | create DetermineHardwareSupport() | ||
+ | |||
+ | #trace "$currentMaterialName : $forceFF" | ||
+ | |||
+ | if (not $hasShapeColor and ($useHWShader1Path or $useHWShader2Path)) | ||
+ | create RugMaterialHW() | ||
+ | else | ||
+ | create RugMaterialFF() | ||
+ | |||
+ | # ultimate fallback pass? no light map, one stage. | ||
+ | shader -layer $rugLayer | ||
+ | validateRenderShaderContext -vertexFormat position 0 required | ||
+ | validateRenderShaderContext -vertexFormat normal 0 required | ||
+ | validateRenderShaderContext -vertexFormat texcoord 0 required | ||
+ | |||
+ | pass -fixedFunction | ||
+ | create LightingStates() | ||
+ | create AttenuatedMatCoef(1) | ||
+ | |||
+ | ffDepthOffset 2 | ||
+ | alphaTest true 127 | ||
+ | alphaTestFunction acceptIfGreater | ||
+ | depthTest true -enableDepthWrite false | ||
+ | |||
+ | stage | ||
+ | texture $rugTexture | ||
+ | textureAddressing clamp clamp | ||
+ | ffTextureCoordsSource 0 | ||
+ | textureBlend multiplyScale2(texture diffuse) select(outRegister) | ||
+ | end | ||
+ | end | ||
+ | end | ||
endif | endif | ||
− | end | + | end # material |
enddef | enddef | ||
− | + | define RugMaterialHW() | |
− | + | shader -layer $rugLayer | |
− | + | validateRenderShaderContext -vertexFormat position 0 required | |
− | + | validateRenderShaderContext -vertexFormat texcoord 0 required | |
+ | |||
+ | pass | ||
+ | alphaTest true 127 | ||
+ | alphaTestFunction acceptIfGreater | ||
+ | depthTest true -enableDepthWrite false | ||
+ | depthTestFunction acceptIfLess | ||
+ | |||
+ | shaderProgram -target vertexProgram -method compile -version 1_1 | ||
+ | bindConstants 0 -bindingID geomToCamera -constantCount 3 | ||
+ | bindConstants 3 -bindingID cameraToClipWithDepthOffset -constantCount 4 -data(2, 2, 2, 2) | ||
+ | |||
+ | shaderSource | ||
+ | float4x3 geomToCameraMatrix : register(c0); | ||
+ | float4x4 cameraToClipWithDOMatrix : register(c3); | ||
+ | |||
+ | struct cVertexIn | ||
+ | { | ||
+ | float3 mPosition : POSITION0; | ||
+ | float2 mTC0 : TEXCOORD0; | ||
+ | float2 mTC1 : TEXCOORD1; | ||
+ | }; | ||
+ | |||
+ | struct cVertexOut | ||
+ | { | ||
+ | float4 mClipPosition : POSITION; | ||
+ | float2 mTC0 : TEXCOORD0; | ||
+ | float2 mTC1 : TEXCOORD1; | ||
+ | }; | ||
+ | |||
+ | cVertexOut VertexMain(cVertexIn vertexIn) | ||
+ | { | ||
+ | cVertexOut result; | ||
+ | float3 pos = mul(float4(vertexIn.mPosition, 1), geomToCameraMatrix); | ||
+ | result.mClipPosition = mul(float4(pos, 1), cameraToClipWithDOMatrix); | ||
+ | result.mTC0 = vertexIn.mTC0; | ||
+ | result.mTC1 = vertexIn.mTC1; | ||
+ | return result; | ||
+ | } | ||
+ | |||
+ | endShaderSource | ||
+ | end | ||
+ | |||
+ | shaderProgram -target pixelProgram -method assemble | ||
+ | bindConstants 0 -bindingID immediateData -data($matdiffuse, 1) | ||
+ | |||
+ | shaderSource | ||
+ | ps_1_1 | ||
+ | def c2, 1,1,1,1 | ||
+ | tex t0 ; base | ||
+ | tex t1 ; lightmap | ||
+ | |||
+ | mul r0, t0, t1 ; base floor * light map | ||
+ | mul_x2 r0.rgb, r0, c0 ; scale at the end to prevent precision/LDR errors | ||
+ | mov r0.a, t0.a | ||
+ | endShaderSource | ||
+ | end # end shader program | ||
+ | |||
+ | sampler 0 | ||
+ | texture $rugTexture | ||
+ | textureAddressing clamp clamp | ||
+ | end | ||
+ | |||
+ | sampler 1 | ||
+ | texture "floorLightMap_${page}" | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | enddef | ||
− | materialDefinition | + | materialDefinition RugMaterial |
− | + | addParam rugTexture rug | |
− | addParam | + | addParam page 0 |
+ | addParam stdMatDiffCoef (0.8, 0.8, 0.8) | ||
+ | addParam stdMatSpecPower 0 | ||
+ | addParam stdMatEmissiveCoef 0,0,0 | ||
+ | addParam stdMatSpecCoef 0,0,0 | ||
+ | setDefinition RugMaterialGen | ||
end | end | ||
− | materialDefinition | + | |
− | + | materialDefinition RugMaterialEdithColor | |
− | addParam | + | addParam rugTexture rug |
− | + | addParam page 0 | |
− | + | addParam stdMatDiffCoef (0.8, 0.8, 0.8) | |
− | + | addParam stdMatSpecPower 0 | |
− | addParam | + | addParam stdMatEmissiveCoef 0,0,0 |
+ | addParam stdMatSpecCoef 0,0,0 | ||
+ | addParam hasShapeColor true | ||
+ | setDefinition RugMaterialGen | ||
end | end |
Revision as of 08:22, 7 September 2007
EP3-OFB 0xCD7FE87A 0x1C0532FA 0xB00AEAC0 0xFF7D973E
- rug
- Rugs
seti rugLayer -2 setb forceFF false setb hasShapeColor false
define RugMaterialFF()
material shader -layer $rugLayer
if ($hasShapeColor) pass -fixedFunction -modifiedEachFrameHint else pass -fixedFunction endif create LightingStates() create AttenuatedMatCoef(1) ffDepthOffset 2 alphaTest true 127 alphaTestFunction acceptIfGreater depthTest true -enableDepthWrite false colorScalar (0.8, 0.8, 0.8, 1) if ($hasShapeColor) tsEdithShapeColor $currentMaterialName stage texture $rugTexture ffTextureCoordsSource 0 # add the lightmap lighting to any direct lights.
# the light map has been prescaled by 0.5 textureBlend multiply(texture colorScalar) select(texture)
end else stage texture "floorLightMap_${page}" ffTextureCoordsSource 1 # add the lightmap lighting to any direct lights.
# the light map has been prescaled by 0.5 textureBlend multiply(texture colorScalar) select(texture)
end stage texture $rugTexture textureAddressing clamp clamp ffTextureCoordsSource 0
textureBlend multiplyScale2(texture outRegister) select(texture)
end #end stage endif end #pass end #end shader end #end material
enddef
setv3 matdiffuse (0.8, 0.8, 0.8)
define RugMaterialGen()
material create DetermineHardwareSupport() #trace "$currentMaterialName : $forceFF" if (not $hasShapeColor and ($useHWShader1Path or $useHWShader2Path)) create RugMaterialHW() else create RugMaterialFF()
# ultimate fallback pass? no light map, one stage.
shader -layer $rugLayer validateRenderShaderContext -vertexFormat position 0 required validateRenderShaderContext -vertexFormat normal 0 required validateRenderShaderContext -vertexFormat texcoord 0 required
pass -fixedFunction create LightingStates() create AttenuatedMatCoef(1)
ffDepthOffset 2
alphaTest true 127 alphaTestFunction acceptIfGreater depthTest true -enableDepthWrite false
stage texture $rugTexture textureAddressing clamp clamp ffTextureCoordsSource 0 textureBlend multiplyScale2(texture diffuse) select(outRegister) end end end
endif end # material
enddef
define RugMaterialHW()
shader -layer $rugLayer validateRenderShaderContext -vertexFormat position 0 required validateRenderShaderContext -vertexFormat texcoord 0 required pass alphaTest true 127 alphaTestFunction acceptIfGreater
depthTest true -enableDepthWrite false depthTestFunction acceptIfLess
shaderProgram -target vertexProgram -method compile -version 1_1 bindConstants 0 -bindingID geomToCamera -constantCount 3 bindConstants 3 -bindingID cameraToClipWithDepthOffset -constantCount 4 -data(2, 2, 2, 2) shaderSource float4x3 geomToCameraMatrix : register(c0); float4x4 cameraToClipWithDOMatrix : register(c3); struct cVertexIn { float3 mPosition : POSITION0; float2 mTC0 : TEXCOORD0; float2 mTC1 : TEXCOORD1; }; struct cVertexOut { float4 mClipPosition : POSITION; float2 mTC0 : TEXCOORD0; float2 mTC1 : TEXCOORD1; }; cVertexOut VertexMain(cVertexIn vertexIn) { cVertexOut result; float3 pos = mul(float4(vertexIn.mPosition, 1), geomToCameraMatrix); result.mClipPosition = mul(float4(pos, 1), cameraToClipWithDOMatrix); result.mTC0 = vertexIn.mTC0; result.mTC1 = vertexIn.mTC1; return result; } endShaderSource end
shaderProgram -target pixelProgram -method assemble bindConstants 0 -bindingID immediateData -data($matdiffuse, 1) shaderSource ps_1_1 def c2, 1,1,1,1 tex t0 ; base tex t1 ; lightmap mul r0, t0, t1 ; base floor * light map mul_x2 r0.rgb, r0, c0 ; scale at the end to prevent precision/LDR errors mov r0.a, t0.a endShaderSource end # end shader program sampler 0 texture $rugTexture textureAddressing clamp clamp end sampler 1
texture "floorLightMap_${page}" end
end end
enddef
materialDefinition RugMaterial
addParam rugTexture rug addParam page 0 addParam stdMatDiffCoef (0.8, 0.8, 0.8) addParam stdMatSpecPower 0 addParam stdMatEmissiveCoef 0,0,0 addParam stdMatSpecCoef 0,0,0 setDefinition RugMaterialGen
end
materialDefinition RugMaterialEdithColor
addParam rugTexture rug addParam page 0 addParam stdMatDiffCoef (0.8, 0.8, 0.8) addParam stdMatSpecPower 0 addParam stdMatEmissiveCoef 0,0,0 addParam stdMatSpecCoef 0,0,0 addParam hasShapeColor true setDefinition RugMaterialGen
end