Difference between revisions of "TEST-STRCMP4CODES"

From SimsWiki
Jump to: navigation, search
Line 1: Line 1:
 +
EP6-BV
 +
0xCD7FE87A
 +
0x1C0532FA
 +
0x8674B810
 +
0xFF9F1489
 +
# glow
  
#beginshader RotatingSteamLayers
+
#
#description Two layers of rotating steam textures
+
#
#extraparam float steamLayer1RotationSpeed 0.02 -1 1 ; Rotational speed of layer 1
+
#
#extraparam float steamLayer2RotationSpeed 0.02 -1 1 ; Rotational speed of layer 2
+
#extraparam float steamLayer1RotationX 0.5 -1 2 ; Rotation center X texture coord for layer 1
+
#extraparam float steamLayer1RotationY 0.5 -1 2 ; Rotation center Y texture coord for layer 1
+
#extraparam float steamLayer2RotationX 0.5 -1 2 ; Rotation center X texture coord for layer 2
+
#extraparam float steamLayer2RotationY 0.5 -1 2 ; Rotation center Y texture coord for layer 2
+
#extraparam int stdMatLayer 0 -32 32 ; Layer for render order
+
  setf steamLayer1RotationSpeed 0.02
+
  setf steamLayer2RotationSpeed 0.02
+
  setf steamLayer1RotationX 0.5
+
  setf steamLayer1RotationY 0.5
+
  setf steamLayer2RotationX 0.5
+
  setf steamLayer2RotationY 0.5
+
  define RotatingSteamLayers()
+
      material
+
        attributes
+
            attribute steamFade float1 0
+
        end
+
  
        shader -layer ($stdMatLayer * 18 + 17)
+
# Used for glow/steam effects: transparency falls off at edges
            vertexFormatPred position 0 true
+
# of object. (Camera-relative normal looks up into a cube map.)
            vertexFormatPred blendindices  0 false
+
define CubeAlphaFalloff()
            vertexFormatPred targetindices 0 false
+
            create SteamPass($stdMatBaseTextureName $steamLayer1RotationSpeed ($steamLayer1RotationX, $steamLayer1RotationY))
+
            create SteamPass($stdMatBaseTextureName $steamLayer2RotationSpeed ($steamLayer2RotationX, $steamLayer2RotationY))
+
        end
+
      end
+
  enddef
+
#endshader RotatingSteamLayers
+
 
+
 
+
define SteamPass(steamTexture speed origin)
+
  pass -fixedFunction
+
      create LightingStates()
+
      depthTest true -enableDepthWrite false
+
      alphaBlend srcFactor(srcColor) add dstFactor(invSrcColor)
+
      ffMatCoef -emit (1,1,1) -diff (0,0,0) -diffAlpha @steamFade
+
      fillmode $stdMatFillMode
+
 
+
      stage
+
        ffTextureCoordsSource 0
+
        texture &steamTexture
+
        textureBlend select(texture) multiply(texture diffuse)
+
      end
+
 
+
      stage
+
        ffTextureCoordsSource 0
+
        textureMatrixAnimation -targetType fixedFunction -arot sawtooth &speed 0 (0,1) -aorigin ((1, 1) - (&origin))
+
        texture &steamTexture
+
        textureBlend multiply(outRegister:alphaReplicate texture) multiply(outRegister texture)
+
      end
+
  end
+
enddef
+
 
+
 
+
 
+
define CubeAlphaFalloffTexture()
+
 
   material
 
   material
 
       attributes
 
       attributes
         attribute color float3
+
         attribute steamRGB float3
         attribute alpha float1
+
         attribute steamAlpha float1
        attribute scale float1
+
 
       end
 
       end
  
Line 73: Line 26:
 
         vertexFormatPred targetindices 0 false
 
         vertexFormatPred targetindices 0 false
  
      create DetermineHardwareSupport()
+
create DetermineHardwareSupport()
     
+
      if ($useFixedFunctionPath or $useSWVertexShaderPath)
+
if ($useFixedFunctionPath or $useSWVertexShaderPath)
        pass -fixedFunction
+
pass -fixedFunction
            create LightingStatesNoStdLightsParam(true false)
+
create LightingStatesNoStdLightsParam(true false)
           
+
alphaBlend srcFactor(srcAlpha) add dstFactor(one)
            alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha)
+
depthTest true -enableDepthWrite false
            depthTest true -enableDepthWrite false
+
ffMatCoef -amb (1,1,1) -diff (1,1,1) -emit (0,0,0) -spec (0,0,0) -specPow 0
           
+
colorScalar $stdMatDiffCoeff $stdMatAlphaMultiplier
            colorScalar @color @alpha
+
fillmode $stdMatFillMode
            ffScaleModelTransform @scale
+
            fillmode $stdMatFillMode
+
  
            stage
+
stage
              texture $stdMatEnvCubeTextureName -alphaFalloffCubeMap 64 (0, 1, 0) (-30, 255) 5
+
texture $stdMatEnvCubeTextureName -alphaFalloffCubeMap 64 (0, 1, 0) (-30, 255) 5
              textureMIPFilterHint disabled
+
textureMIPFilterHint disabled
 +
ffTextureCoordsSource fromNormal
 +
textureTransformType vector3
 +
textureAddressing clamp clamp clamp
 +
textureBlend select(texture:alphaReplicate) multiply(texture colorScalar)
 +
end
  
              ffTextureCoordsSource fromNormal
+
stage
              textureTransformType vector3
+
texture $stdMatBaseTextureName ${stdMatBaseTextureParam} 
              # ffTextureMatrix -orientToCamera
+
ffTextureCoordsSource 0
 +
textureBlend select(colorScalar) multiply(outRegister texture)
 +
end
 +
end
 +
else
 +
 +
# VS/PS equivelant
 +
pass
 +
create NonStandardLighting()
 +
 +
alphaBlend srcFactor(srcAlpha) add dstFactor(one)
 +
depthTest true -enableDepthWrite false
 +
fillmode $stdMatFillMode
  
              textureAddressing clamp clamp clamp
+
shaderProgram -target vertexProgram -method assemble
 
+
bindConstants 0 -bindingID geomToClip -constantCount 4
              textureBlend select(texture:alphaReplicate) multiply(texture colorScalar)
+
bindConstants 4 -bindingID geomToCamera -constantCount 3
            end
+
shaderSource
 
+
vs_1_1
            stage
+
dcl_position v0
              texture $stdMatBaseTextureName ${stdMatBaseTextureParam}
+
dcl_normal v1
              ffTextureCoordsSource 0
+
dcl_texcoord v2
              textureBlend select(colorScalar) multiply(outRegister texture)
+
            end
+
m4x4 oPos, v0, c0  ; send to clip space
        end
+
      else
+
mov oT1.xy, v2  ; copy tex coords straight out
        pass
+
       
+
m3x3 oT0.xyz, v1, c4 ; transform normal to camera space.
            # supports global wireframe modes and so forth.
+
            create NonStandardLighting()
+
endShaderSource
           
+
end
            alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha)
+
            depthTest true -enableDepthWrite false
+
shaderProgram -target pixelProgram -method assemble
 
+
            shaderProgram -target vertexProgram -method assemble
+
setv3 evalDiffuse ($stdMatDiffCoeff)
              bindConstants 0 -bindingID geomToClip -constantCount 4
+
bindConstants 0 -bindingID immediateData -data ($evalDiffuse, $stdMatAlphaMultiplier)
              bindConstants 10 -bindingID immediateData -data (@scale)
+
              bindConstants 4 -bindingID geomToCamera -constantCount 3
+
shaderSource
              shaderSource
+
ps_1_1
                  vs_1_1
+
tex t0 ; a cube map
                  def c11, 0,0.5,1,2
+
tex t1 ; a 2D texture
                  dcl_position v0
+
                  dcl_normal v1
+
mov r0.rgb, c0 ; output color from the diffuse
                  dcl_texcoord v2
+
+ mul r0.a, t0.a, c0.a  ; alpha = tex0.a * tex1.a * alphaMultiplier
                 
+
mul r0.a, r0.a, t1.a
                  mul r0.xyz, v0, c10.x
+
                  mov r0.w, v0.wwww
+
endShaderSource
                  m4x4 oPos, r0, c0
+
                  m3x3 oT0.xyz, v1,c4
+
end
                 
+
                  mov oT1.xy, v2
+
              endShaderSource
+
sampler 0
            end
+
texture $stdMatEnvCubeTextureName -alphaFalloffCubeMap 64 (0, 1, 0) (-30, 255) 5
           
+
textureMIPFilterHint disabled
            shaderProgram -target pixelProgram -method assemble
+
textureAddressing clamp clamp clamp
              bindConstants 0 -bindingID immediateData -data (@color)
+
end
              bindConstants 1 -bindingID immediateData -data (@alpha) -startChannel w
+
sampler 1
              shaderSource
+
texture $stdMatBaseTextureName ${stdMatBaseTextureParam}  
                  ps_1_1
+
end
                  tex t0
+
                  tex t1
+
end
 
+
                  mov r0.rgb, c0
+
endif
                  +mul r0.a,t0.a, c1.a
+
       end # shader
                  mul r0.a, t1.a, r0.a
+
     
              endShaderSource
+
      #fallback, do nothing
            end
+
 
+
 
+
            sampler 0  
+
              texture $stdMatEnvCubeTextureName -alphaFalloffCubeMap 64 (0, 1, 0) (-30, 255) 5
+
              textureMIPFilterHint disabled
+
              textureAddressing clamp clamp clamp
+
            end
+
           
+
            sampler 1
+
              texture $stdMatBaseTextureName ${stdMatBaseTextureParam}
+
            end
+
        end
+
      endif
+
       end
+
 
       shader
 
       shader
 
       end
 
       end
 +
     
 
   end
 
   end
 
enddef
 
enddef
  
materialDefinition steamSphere_steam
+
#
   setDefinition CubeAlphaFalloffTexture
+
# Various lighting glows.
   addParam stdMatLayer 13
+
#
   addParam stdMatEnvCubeTextureName steamSphere_alphaFalloff5
+
materialDefinition lightingTableBigBulb_glowSphere
   addParam stdMatBaseTextureName steam-alpha
+
   setDefinition CubeAlphaFalloff
 +
   addParam stdMatLayer 15
 +
  addParam stdMatDiffCoeff (1, 1, .8)
 +
  addParam stdMatAlphaBlendMode additive
 +
  addParam stdMatAlphaMultiplier 0.55
 +
   addParam stdMatEnvCubeTextureName lightingStreetlight_glow_alphaFalloff5
 +
   addParam stdMatBaseTextureName lightingStreetlight-glowSphere-alpha
 
end
 
end
  
materialDefinition effectsSteam_steam
+
materialDefinition lightingStreetlight_glowSphereNull
   setDefinition CubeAlphaFalloffTexture
+
   setDefinition Null
   addParam stdMatLayer 13
+
   addParam stdMatLayer 15
 +
  addParam stdMatDiffCoeff (1, 1, 1)
 +
  addParam stdMatAlphaBlendMode additive
 +
  addParam stdMatAlphaMultiplier 1
 
   addParam stdMatEnvCubeTextureName steamSphere_alphaFalloff5
 
   addParam stdMatEnvCubeTextureName steamSphere_alphaFalloff5
   addParam stdMatBaseTextureName effectsSteam-alpha
+
   addParam stdMatBaseTextureName steam-alpha
 
end
 
end
  
materialDefinition effectsSmallSteam_steam
+
materialDefinition lightingStreetlight_glowSphere
#< test use of the StandardParticleModelMaterial
+
   setDefinition CubeAlphaFalloff
  setDefinition StandardParticleModelMaterial
+
  addParam stdMatBaseTextureName steam-alpha
+
  addParam stdMatDiffCoef (1, 1, 1)
+
  addParam stdMatBaseTextureAlphaReplicate true
+
#>
+
   setDefinition CubeAlphaFalloffTexture
+
 
   addParam stdMatLayer 15
 
   addParam stdMatLayer 15
   addParam stdMatEnvCubeTextureName steamSphere_alphaFalloff5
+
  addParam stdMatDiffCoeff (1, 1, .8)
   addParam stdMatBaseTextureName steam-alpha
+
  addParam stdMatAlphaBlendMode additive
 +
  addParam stdMatAlphaMultiplier 1
 +
   addParam stdMatEnvCubeTextureName lightingStreetlight_glow_alphaFalloff5
 +
   addParam stdMatBaseTextureName lightingStreetlight-glowSphere-alpha
 
end
 
end
  
 
+
materialDefinition memoryIcon_glowSphere
materialDefinition fightPuff_puffball
+
   setDefinition CubeAlphaFalloff
   setDefinition CubeAlphaFalloffTexture
+
   addParam stdMatLayer 15
   addParam stdMatLayer 13
+
  addParam stdMatDiffCoeff (1, 1, .8)
   addParam stdMatEnvCubeTextureName steamSphere_alphaFalloff5
+
  addParam stdMatAlphaBlendMode additive
   addParam stdMatBaseTextureName effectsFightPuff-alpha
+
  addParam stdMatAlphaMultiplier 1
 +
 
 +
   addParam stdMatEnvCubeTextureName lightingStreetlight_glow_alphaFalloff5
 +
   addParam stdMatBaseTextureName reflection3DGlow-envcube6
 
end
 
end

Revision as of 06:58, 7 September 2007

EP6-BV 0xCD7FE87A 0x1C0532FA 0x8674B810 0xFF9F1489

  1. glow
  1. Used for glow/steam effects: transparency falls off at edges
  2. of object. (Camera-relative normal looks up into a cube map.)

define CubeAlphaFalloff()

  material
     attributes
        attribute steamRGB float3
        attribute steamAlpha float1
     end
     shader -layer ($stdMatLayer * 18 + 17)
        vertexFormatPred position      0 true
        vertexFormatPred normal        0 true
        vertexFormatPred texcoord      0 true
        vertexFormatPred blendindices  0 false
        vertexFormatPred targetindices 0 false

create DetermineHardwareSupport()

if ($useFixedFunctionPath or $useSWVertexShaderPath) pass -fixedFunction create LightingStatesNoStdLightsParam(true false) alphaBlend srcFactor(srcAlpha) add dstFactor(one) depthTest true -enableDepthWrite false ffMatCoef -amb (1,1,1) -diff (1,1,1) -emit (0,0,0) -spec (0,0,0) -specPow 0 colorScalar $stdMatDiffCoeff $stdMatAlphaMultiplier fillmode $stdMatFillMode

stage texture $stdMatEnvCubeTextureName -alphaFalloffCubeMap 64 (0, 1, 0) (-30, 255) 5 textureMIPFilterHint disabled ffTextureCoordsSource fromNormal textureTransformType vector3 textureAddressing clamp clamp clamp textureBlend select(texture:alphaReplicate) multiply(texture colorScalar) end

stage texture $stdMatBaseTextureName ${stdMatBaseTextureParam} ffTextureCoordsSource 0 textureBlend select(colorScalar) multiply(outRegister texture) end end else

# VS/PS equivelant pass create NonStandardLighting()

alphaBlend srcFactor(srcAlpha) add dstFactor(one) depthTest true -enableDepthWrite false fillmode $stdMatFillMode

shaderProgram -target vertexProgram -method assemble bindConstants 0 -bindingID geomToClip -constantCount 4 bindConstants 4 -bindingID geomToCamera -constantCount 3 shaderSource vs_1_1 dcl_position v0 dcl_normal v1 dcl_texcoord v2

m4x4 oPos, v0, c0  ; send to clip space

mov oT1.xy, v2  ; copy tex coords straight out

m3x3 oT0.xyz, v1, c4  ; transform normal to camera space.

endShaderSource end

shaderProgram -target pixelProgram -method assemble

setv3 evalDiffuse ($stdMatDiffCoeff) bindConstants 0 -bindingID immediateData -data ($evalDiffuse, $stdMatAlphaMultiplier)

shaderSource ps_1_1 tex t0 ; a cube map tex t1 ; a 2D texture

mov r0.rgb, c0  ; output color from the diffuse + mul r0.a, t0.a, c0.a  ; alpha = tex0.a * tex1.a * alphaMultiplier mul r0.a, r0.a, t1.a

endShaderSource

end


sampler 0 texture $stdMatEnvCubeTextureName -alphaFalloffCubeMap 64 (0, 1, 0) (-30, 255) 5 textureMIPFilterHint disabled textureAddressing clamp clamp clamp end sampler 1 texture $stdMatBaseTextureName ${stdMatBaseTextureParam} end

end

endif

     end # shader
     
     #fallback, do nothing
     shader
     end
     
  end

enddef

  1. Various lighting glows.

materialDefinition lightingTableBigBulb_glowSphere

  setDefinition CubeAlphaFalloff
  addParam stdMatLayer 15
  addParam stdMatDiffCoeff (1, 1, .8)
  addParam stdMatAlphaBlendMode additive
  addParam stdMatAlphaMultiplier 0.55
  addParam stdMatEnvCubeTextureName lightingStreetlight_glow_alphaFalloff5
  addParam stdMatBaseTextureName lightingStreetlight-glowSphere-alpha

end

materialDefinition lightingStreetlight_glowSphereNull

  setDefinition Null
  addParam stdMatLayer 15
  addParam stdMatDiffCoeff (1, 1, 1)
  addParam stdMatAlphaBlendMode additive
  addParam stdMatAlphaMultiplier 1
  addParam stdMatEnvCubeTextureName steamSphere_alphaFalloff5
  addParam stdMatBaseTextureName steam-alpha

end

materialDefinition lightingStreetlight_glowSphere

  setDefinition CubeAlphaFalloff
  addParam stdMatLayer 15
  addParam stdMatDiffCoeff (1, 1, .8)
  addParam stdMatAlphaBlendMode additive
  addParam stdMatAlphaMultiplier 1
  addParam stdMatEnvCubeTextureName lightingStreetlight_glow_alphaFalloff5
  addParam stdMatBaseTextureName lightingStreetlight-glowSphere-alpha

end

materialDefinition memoryIcon_glowSphere

  setDefinition CubeAlphaFalloff
  addParam stdMatLayer 15
  addParam stdMatDiffCoeff (1, 1, .8)
  addParam stdMatAlphaBlendMode additive
  addParam stdMatAlphaMultiplier 1
  
  addParam stdMatEnvCubeTextureName lightingStreetlight_glow_alphaFalloff5
  addParam stdMatBaseTextureName reflection3DGlow-envcube6

end

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox