|
|
| Line 2: |
Line 2: |
| | 0xCD7FE87A | | 0xCD7FE87A |
| | 0x1C0532FA | | 0x1C0532FA |
| − | 0x9149CD43
| + | 0x8054E1BF |
| − | 0xFF002DC8
| + | 0xFF9189CC |
| − | # particles | + | # clotheschange |
| | | | |
| − | #
| + | materialDefinition clothesChangeSwirl |
| − | # Various standard shaders for particle systems.
| + | setDefinition StandardParticleModelMaterial |
| − | #
| + | addParam stdMatLayer 15 |
| − | | + | addParam stdMatLightingEnabled false |
| − | | + | addParam stdMatAlphaTestEnabled false |
| − | # StandardParticlesMaterial
| + | addParam stdMatBaseTextureAlphaReplicate true |
| − | #
| + | addParam stdMatBaseTextureEnabled true |
| − | # The standard shader for billboard-style particles.
| + | addParam stdMatBaseTextureName clotheschange-swirls |
| − | # This is referenced from the effects manager.
| + | addParam stdMatEmissiveCoef (1, 1, 1) |
| − | | + | addParam stdMatBaseTextureAddressingU clamp |
| − | setb stdPMDoAlphaMask true
| + | addParam stdMatBaseTextureAddressingV clamp |
| − | setb stdPMDoDepthWrite false
| + | end |
| − | setb stdPMDoDepthTest true
| + | |
| − | setb stdPMAdditive false
| + | |
| − | setb stdPMModulate false
| + | |
| − | setb stdPMInvertDepth false
| + | |
| − | setb stdPMDebugFill false
| + | |
| − | | + | |
| − | set stdParticleCompositeTexture ""
| + | |
| − |
| + | |
| − | define StandardParticlesMaterial()
| + | |
| − | material | + | |
| − | # put ourselves two layers above the standard, plus
| + | |
| − | # transparent, because we don't write Z, and anything
| + | |
| − | # that renders after us will stomp on us.
| + | |
| − | if (varExists(stdPMLayer))
| + | |
| − | shader -layer $stdPMLayer
| + | |
| − | else
| + | |
| − | shader -layer ($stdMatLayer * 8 + 7) # 7 for alpha blend
| + | |
| − | endif
| + | |
| − |
| + | |
| − | vertexFormatPred position 0 true
| + | |
| − | vertexFormatPred texcoord 0 true
| + | |
| − | vertexFormatPred color 0 true
| + | |
| − | vertexFormatPred blendindices 0 false
| + | |
| − | vertexFormatPred targetindices 0 false
| + | |
| − |
| + | |
| − | numLightsPred environmentCube (numLightsOfType(environmentCube))
| + | |
| − | | + | |
| − | pass -fixedFunction
| + | |
| − | create LightingStatesNoStdLights()
| + | |
| − | ffPerVertexColor -enable true -diff vertexDiffuse
| + | |
| − |
| + | |
| − | if $stdPMDebugFill
| + | |
| − | alphaBlend srcFactor(one) add dstFactor(zero)
| + | |
| − | elseif $stdPMAdditive
| + | |
| − | alphaBlend srcFactor(srcAlpha) add dstFactor(one)
| + | |
| − | elseif $stdPMModulate
| + | |
| − | alphaBlend srcFactor(destColor) add dstFactor(zero)
| + | |
| − | else
| + | |
| − | alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha)
| + | |
| − | endif
| + | |
| − |
| + | |
| − | depthTest $stdPMDoDepthTest -enableDepthWrite $stdPMDoDepthWrite
| + | |
| − | if ($stdPMInvertDepth)
| + | |
| − | depthTestFunction acceptIfGreater
| + | |
| − | endif
| + | |
| − |
| + | |
| − | if (not $stdPMDebugFill)
| + | |
| − | alphaTest $stdPMDoAlphaMask 1
| + | |
| − | alphaTestFunction acceptIfGreaterOrEqual # is this the default? remove if so...
| + | |
| − | endif
| + | |
| − | | + | |
| − | # the particle system takes care of whether lighting is applied,
| + | |
| − | # by setting kGeomSkipIllumination appropriately.
| + | |
| − | if (numLightsOfType(environmentCube) > 0)
| + | |
| − | colorScalar (1, 1, 1, 1) -applyTextureLightColor 0 0
| + | |
| − | endif
| + | |
| − |
| + | |
| − | fillmode $stdMatFillMode # so we pick up on wireframe.
| + | |
| − | cullmode none
| + | |
| − | | + | |
| − | create LightingStatesNoStdLights()
| + | |
| − |
| + | |
| − | stage
| + | |
| − | texture $stdParticleTexture
| + | |
| − |
| + | |
| − | textureAddressing clamp clamp
| + | |
| − | | + | |
| − | textureBlend multiply(texture diffuse) multiply(texture diffuse)
| + | |
| − | end
| + | |
| − |
| + | |
| − | if (strcmp("$stdParticleCompositeTexture", "()") != 0)
| + | |
| − | # alpha composite over the top
| + | |
| − | stage
| + | |
| − | texture $stdParticleCompositeTexture
| + | |
| − |
| + | |
| − | textureAddressing clamp clamp
| + | |
| − | ffTextureCoordsSource 0
| + | |
| − | | + | |
| − | textureBlend lerpTextureAlpha(texture outRegister) select(outRegister)
| + | |
| − | end
| + | |
| − | elseif (numLightsOfType(environmentCube) > 0)
| + | |
| − | # multiply in environment tint.
| + | |
| − | # We could do this more cheaply in the particle streaming code, where there
| + | |
| − | # is already an overall colour multiplier for the per-vertex colour, but we
| + | |
| − | # can't access the lights from there.
| + | |
| − | # We don't (yet) support particle "lighting" with composite particles.
| + | |
| − | stage
| + | |
| − | textureBlend multiply(colorScalar outRegister) multiply(colorScalar outRegister)
| + | |
| − | end
| + | |
| − | endif
| + | |
| − | end
| + | |
| − | end
| + | |
| − |
| + | |
| − |
| + | |
| − |
| + | |
| − | # since particles tend to be transparent, the fallback will be to not draw them.
| + | |
| − | shader
| + | |
| − |
| + | |
| − | end #shader
| + | |
| − |
| + | |
| − |
| + | |
| − |
| + | |
| − |
| + | |
| − | end
| + | |
| − | enddef
| + | |
| − | | + | |
| − | | + | |
| − | | + | |
| − | # StandardParticleModelMaterial
| + | |
| − | #
| + | |
| − | # The standard shader for model (shape)-based particles.
| + | |
| − | # Respects a subset (basically phong-shaded textured) of the
| + | |
| − | # standard material parameters.
| + | |
| − | | + | |
| − | #aliasshader StandardParticleModelMaterial StandardMaterial
| + | |
| − | define StandardParticleModelMaterial()
| + | |
| − | material
| + | |
| − | # TODO: do ltScale properly; but we'll probably move this functionality into
| + | |
| − | # standard material before we tackle that.
| + | |
| − | set ltScale 2
| + | |
| − |
| + | |
| − | attributes
| + | |
| − | attribute color float3
| + | |
| − | attribute alpha float1
| + | |
| − | attribute scale float1
| + | |
| − | end
| + | |
| − | | + | |
| − | | + | |
| − | shader -layer ($stdMatLayer * 8 + 7) # 7 for alpha blend
| + | |
| − | vertexFormatPred position 0 true
| + | |
| − | vertexFormatPred texcoord 0 true
| + | |
| − | vertexFormatPred blendindices 0 false
| + | |
| − | vertexFormatPred targetindices 0 false
| + | |
| − |
| + | |
| − | create DetermineHardwareSupport()
| + | |
| − | | + | |
| − | pass -fixedFunction
| + | |
| − | ffMatCoef -amb ($stdMatDiffCoef * (1 / $ltScale).xxx) -ambAlpha $stdMatAlphaMultiplier -diff ($stdMatDiffCoef * (1 / $ltScale).xxx) -diffAlpha $stdMatAlphaMultiplier -emit ($stdMatEmissiveCoef * (1 / $ltScale).xxx) -emitAlpha $stdMatAlphaMultiplier -spec $stdMatSpecCoef -specPow $stdMatSpecPower
| + | |
| − | addSpecular true
| + | |
| − |
| + | |
| − | # normalize normals because of scale
| + | |
| − | create LightingStatesParam(true false)
| + | |
| − |
| + | |
| − | # We should be able to call StandardShaderFBAlphaState here, but
| + | |
| − | # because this wasn't done originally, there are a bunch of existing
| + | |
| − | # materials that have blend set to "none" where they should be set to
| + | |
| − | # "blend".
| + | |
| − | if (strcmp("${stdMatAlphaBlendMode}", "additive") = 0)
| + | |
| − | alphaBlend srcFactor(srcAlpha) add dstFactor(one)
| + | |
| − | depthTest true -enableDepthWrite false
| + | |
| − | else
| + | |
| − | alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha)
| + | |
| − | depthTest true -enableDepthWrite true
| + | |
| − | endif
| + | |
| − |
| + | |
| − | alphaTest $stdMatAlphaTestEnabled $stdMatAlphaRefValue
| + | |
| − | alphaTestFunction acceptIfGreaterOrEqual
| + | |
| − | | + | |
| − | colorScalar @color @alpha
| + | |
| − |
| + | |
| − | ffScaleModelTransform @scale
| + | |
| − |
| + | |
| − | fillmode $stdMatFillMode
| + | |
| − | | + | |
| − | stage
| + | |
| − | create StandardShaderTextureState(Base)
| + | |
| − |
| + | |
| − | # outRegister is previous stage. For first stage, diffuse.
| + | |
| − | if $stdMatBaseTextureAlphaReplicate
| + | |
| − | textureBlend multiplyScale${ltScale}(texture:alphaReplicate outRegister) multiply(texture outRegister)
| + | |
| − | else
| + | |
| − | textureBlend multiplyScale${ltScale}(texture outRegister) multiply(texture outRegister)
| + | |
| − | endif
| + | |
| − | end
| + | |
| − |
| + | |
| − | stage
| + | |
| − | textureBlend multiply(colorScalar outRegister) multiply(colorScalar outRegister)
| + | |
| − | end
| + | |
| − | end
| + | |
| − |
| + | |
| − | if (strcmp("${stdMatEnvCubeMode}", "reflection") = 0)
| + | |
| − | pass -fixedFunction
| + | |
| − | create LightingStatesParam(true false)
| + | |
| − | | + | |
| − | alphaBlend srcFactor(one) add dstFactor(one)
| + | |
| − | ffScaleModelTransform @scale
| + | |
| − | colorScalar $stdMatEnvCubeCoef 1
| + | |
| − | fillmode $stdMatFillMode
| + | |
| − |
| + | |
| − | stage
| + | |
| − | if ($cubeMapSupport)
| + | |
| − | create StandardShaderEnvCubeMapState(fromReflectionVector)
| + | |
| − | textureBlend multiply(texture colorScalar) select(texture)
| + | |
| − | else
| + | |
| − | textureBlend select(colorScalar) select(colorScalar)
| + | |
| − | endif
| + | |
| − | end
| + | |
| − | end
| + | |
| − | endif
| + | |
| − | end
| + | |
| − |
| + | |
| − |
| + | |
| − | # non textured opaque fallback.
| + | |
| − | shader -layer ($stdMatLayer * 8)
| + | |
| − | pass -fixedFunction
| + | |
| − | create LightingStatesParam(true false)
| + | |
| − | ffScaleModelTransform @scale
| + | |
| − | colorScalar @color @alpha
| + | |
| − | ffMatCoef -amb ($stdMatDiffCoef * (0.5).xxx) -ambAlpha $stdMatAlphaMultiplier -diff ($stdMatDiffCoef * (0.5).xxx) -diffAlpha $stdMatAlphaMultiplier -emit ($stdMatEmissiveCoef * (0.5).xxx) -emitAlpha $stdMatAlphaMultiplier -spec $stdMatSpecCoef -specPow $stdMatSpecPower
| + | |
| − | | + | |
| − | stage
| + | |
| − | textureBlend multiplyScale2(diffuse colorScalar) select(colorScalar)
| + | |
| − | end
| + | |
| − |
| + | |
| − | end
| + | |
| − |
| + | |
| − | end
| + | |
| − |
| + | |
| − | # do-nothing fallback
| + | |
| − |
| + | |
| − | shader
| + | |
| − | end
| + | |
| − |
| + | |
| − | end
| + | |
| − | enddef
| + | |
| − | | + | |
| − | | + | |
| − | #
| + | |
| − | # Various standard shaders for particle systems.
| + | |
| − | #
| + | |
| − | | + | |
| − | | + | |
| − | # StandardParticlesMaterial
| + | |
| − | #
| + | |
| − | # The standard shader for billboard-style particles.
| + | |
| − | # This is referenced from the effects manager.
| + | |
| − | | + | |
| − | setb stdPMDoAlphaMask true
| + | |
| − | setb stdPMDoDepthWrite false
| + | |
| − | setb stdPMDoDepthTest true
| + | |
| − | setb stdPMAdditive false
| + | |
| − | setb stdPMModulate false
| + | |
| − | setb stdPMInvertDepth false
| + | |
| − | setb stdPMDebugFill false
| + | |
| − | | + | |
| − | set stdParticleCompositeTexture ""
| + | |
| − |
| + | |
| − | define StandardParticlesMaterial()
| + | |
| − | material | + | |
| − | # put ourselves two layers above the standard, plus
| + | |
| − | # transparent, because we don't write Z, and anything
| + | |
| − | # that renders after us will stomp on us.
| + | |
| − | if (varExists(stdPMLayer))
| + | |
| − | shader -layer $stdPMLayer
| + | |
| − | else
| + | |
| − | shader -layer ($stdMatLayer * 8 + 7) # 7 for alpha blend
| + | |
| − | endif
| + | |
| − |
| + | |
| − | vertexFormatPred position 0 true
| + | |
| − | vertexFormatPred texcoord 0 true
| + | |
| − | vertexFormatPred color 0 true
| + | |
| − | vertexFormatPred blendindices 0 false
| + | |
| − | vertexFormatPred targetindices 0 false
| + | |
| − |
| + | |
| − | numLightsPred environmentCube (numLightsOfType(environmentCube))
| + | |
| − | | + | |
| − | pass -fixedFunction
| + | |
| − | create LightingStatesNoStdLights()
| + | |
| − | ffPerVertexColor -enable true -diff vertexDiffuse
| + | |
| − |
| + | |
| − | if $stdPMDebugFill
| + | |
| − | alphaBlend srcFactor(one) add dstFactor(zero)
| + | |
| − | elseif $stdPMAdditive
| + | |
| − | alphaBlend srcFactor(srcAlpha) add dstFactor(one)
| + | |
| − | elseif $stdPMModulate
| + | |
| − | alphaBlend srcFactor(destColor) add dstFactor(zero)
| + | |
| − | else
| + | |
| − | alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha)
| + | |
| − | endif
| + | |
| − |
| + | |
| − | depthTest $stdPMDoDepthTest -enableDepthWrite $stdPMDoDepthWrite
| + | |
| − | if ($stdPMInvertDepth)
| + | |
| − | depthTestFunction acceptIfGreater
| + | |
| − | endif
| + | |
| − |
| + | |
| − | if (not $stdPMDebugFill)
| + | |
| − | alphaTest $stdPMDoAlphaMask 1
| + | |
| − | alphaTestFunction acceptIfGreaterOrEqual # is this the default? remove if so...
| + | |
| − | endif
| + | |
| − | | + | |
| − | # the particle system takes care of whether lighting is applied,
| + | |
| − | # by setting kGeomSkipIllumination appropriately.
| + | |
| − | if (numLightsOfType(environmentCube) > 0)
| + | |
| − | colorScalar (1, 1, 1, 1) -applyTextureLightColor 0 0
| + | |
| − | endif
| + | |
| − |
| + | |
| − | fillmode $stdMatFillMode # so we pick up on wireframe.
| + | |
| − | cullmode none
| + | |
| − | | + | |
| − | create LightingStatesNoStdLights()
| + | |
| − |
| + | |
| − | stage
| + | |
| − | texture $stdParticleTexture
| + | |
| − |
| + | |
| − | textureAddressing clamp clamp
| + | |
| − | | + | |
| − | textureBlend multiply(texture diffuse) multiply(texture diffuse)
| + | |
| − | end
| + | |
| − |
| + | |
| − | if (strcmp("$stdParticleCompositeTexture", "()") != 0)
| + | |
| − | # alpha composite over the top
| + | |
| − | stage
| + | |
| − | texture $stdParticleCompositeTexture
| + | |
| − |
| + | |
| − | textureAddressing clamp clamp
| + | |
| − | ffTextureCoordsSource 0
| + | |
| − |
| + | |
| − | textureBlend lerpTextureAlpha(texture outRegister) select(outRegister)
| + | |
| − | end
| + | |
| − | elseif (numLightsOfType(environmentCube) > 0)
| + | |
| − | # multiply in environment tint.
| + | |
| − | # We could do this more cheaply in the particle streaming code, where there
| + | |
| − | # is already an overall colour multiplier for the per-vertex colour, but we
| + | |
| − | # can't access the lights from there.
| + | |
| − | # We don't (yet) support particle "lighting" with composite particles.
| + | |
| − | stage
| + | |
| − | textureBlend multiply(colorScalar outRegister) multiply(colorScalar outRegister)
| + | |
| − | end
| + | |
| − | endif
| + | |
| − | end
| + | |
| − | end
| + | |
| − |
| + | |
| − |
| + | |
| − |
| + | |
| − | # since particles tend to be transparent, the fallback will be to not draw them.
| + | |
| − | shader
| + | |
| − |
| + | |
| − | end #shader
| + | |
| − |
| + | |
| − |
| + | |
| − |
| + | |
| − |
| + | |
| − | end
| + | |
| − | enddef
| + | |
| − | | + | |
| − | | + | |
| − | | + | |
| − | # StandardParticleModelMaterial
| + | |
| − | #
| + | |
| − | # The standard shader for model (shape)-based particles.
| + | |
| − | # Respects a subset (basically phong-shaded textured) of the
| + | |
| − | # standard material parameters.
| + | |
| − | | + | |
| − | #aliasshader StandardParticleModelMaterial StandardMaterial
| + | |
| − | define StandardParticleModelMaterial()
| + | |
| − | material
| + | |
| − | # TODO: do ltScale properly; but we'll probably move this functionality into
| + | |
| − | # standard material before we tackle that.
| + | |
| − | set ltScale 2
| + | |
| − |
| + | |
| − | attributes
| + | |
| − | attribute color float3
| + | |
| − | attribute alpha float1
| + | |
| − | attribute scale float1
| + | |
| − | end
| + | |
| − | | + | |
| − | | + | |
| − | shader -layer ($stdMatLayer * 8 + 7) # 7 for alpha blend
| + | |
| − | vertexFormatPred position 0 true
| + | |
| − | vertexFormatPred texcoord 0 true
| + | |
| − | vertexFormatPred blendindices 0 false
| + | |
| − | vertexFormatPred targetindices 0 false
| + | |
| − |
| + | |
| − | create DetermineHardwareSupport()
| + | |
| − | | + | |
| − | pass -fixedFunction
| + | |
| − | ffMatCoef -amb ($stdMatDiffCoef * (1 / $ltScale).xxx) -ambAlpha $stdMatAlphaMultiplier -diff ($stdMatDiffCoef * (1 / $ltScale).xxx) -diffAlpha $stdMatAlphaMultiplier -emit ($stdMatEmissiveCoef * (1 / $ltScale).xxx) -emitAlpha $stdMatAlphaMultiplier -spec $stdMatSpecCoef -specPow $stdMatSpecPower
| + | |
| − | addSpecular true
| + | |
| − |
| + | |
| − | # normalize normals because of scale
| + | |
| − | create LightingStatesParam(true false)
| + | |
| − |
| + | |
| − | # We should be able to call StandardShaderFBAlphaState here, but
| + | |
| − | # because this wasn't done originally, there are a bunch of existing
| + | |
| − | # materials that have blend set to "none" where they should be set to
| + | |
| − | # "blend".
| + | |
| − | if (strcmp("${stdMatAlphaBlendMode}", "additive") = 0)
| + | |
| − | alphaBlend srcFactor(srcAlpha) add dstFactor(one)
| + | |
| − | depthTest true -enableDepthWrite false
| + | |
| − | else
| + | |
| − | alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha)
| + | |
| − | depthTest true -enableDepthWrite true
| + | |
| − | endif
| + | |
| − |
| + | |
| − | alphaTest $stdMatAlphaTestEnabled $stdMatAlphaRefValue
| + | |
| − | alphaTestFunction acceptIfGreaterOrEqual
| + | |
| − | | + | |
| − | colorScalar @color @alpha
| + | |
| − |
| + | |
| − | ffScaleModelTransform @scale
| + | |
| − |
| + | |
| − | fillmode $stdMatFillMode
| + | |
| − | | + | |
| − | stage
| + | |
| − | create StandardShaderTextureState(Base)
| + | |
| − |
| + | |
| − | # outRegister is previous stage. For first stage, diffuse.
| + | |
| − | if $stdMatBaseTextureAlphaReplicate
| + | |
| − | textureBlend multiplyScale${ltScale}(texture:alphaReplicate outRegister) multiply(texture outRegister)
| + | |
| − | else
| + | |
| − | textureBlend multiplyScale${ltScale}(texture outRegister) multiply(texture outRegister)
| + | |
| − | endif
| + | |
| − | end
| + | |
| − |
| + | |
| − | stage
| + | |
| − | textureBlend multiply(colorScalar outRegister) multiply(colorScalar outRegister)
| + | |
| − | end
| + | |
| − | end
| + | |
| − |
| + | |
| − | if (strcmp("${stdMatEnvCubeMode}", "reflection") = 0)
| + | |
| − | pass -fixedFunction
| + | |
| − | create LightingStatesParam(true false)
| + | |
| − |
| + | |
| − | alphaBlend srcFactor(one) add dstFactor(one)
| + | |
| − | ffScaleModelTransform @scale
| + | |
| − | colorScalar $stdMatEnvCubeCoef 1
| + | |
| − | fillmode $stdMatFillMode
| + | |
| − |
| + | |
| − | stage
| + | |
| − | if ($cubeMapSupport)
| + | |
| − | create StandardShaderEnvCubeMapState(fromReflectionVector)
| + | |
| − | textureBlend multiply(texture colorScalar) select(texture)
| + | |
| − | else
| + | |
| − | textureBlend select(colorScalar) select(colorScalar)
| + | |
| − | endif
| + | |
| − | end
| + | |
| − | end
| + | |
| − | endif
| + | |
| − | end
| + | |
| − |
| + | |
| − |
| + | |
| − | # non textured opaque fallback.
| + | |
| − | shader -layer ($stdMatLayer * 8)
| + | |
| − | pass -fixedFunction
| + | |
| − | create LightingStatesParam(true false)
| + | |
| − | ffScaleModelTransform @scale
| + | |
| − | colorScalar @color @alpha
| + | |
| − | ffMatCoef -amb ($stdMatDiffCoef * (0.5).xxx) -ambAlpha $stdMatAlphaMultiplier -diff ($stdMatDiffCoef * (0.5).xxx) -diffAlpha $stdMatAlphaMultiplier -emit ($stdMatEmissiveCoef * (0.5).xxx) -emitAlpha $stdMatAlphaMultiplier -spec $stdMatSpecCoef -specPow $stdMatSpecPower
| + | |
| − |
| + | |
| − | stage
| + | |
| − | textureBlend multiplyScale2(diffuse colorScalar) select(colorScalar)
| + | |
| − | end
| + | |
| − |
| + | |
| − | end
| + | |
| − |
| + | |
| − | end
| + | |
| − |
| + | |
| − | # do-nothing fallback
| + | |
| − |
| + | |
| − | shader
| + | |
| − | end
| + | |
| − |
| + | |
| − | end
| + | |
| − | enddef
| + | |