TEST-STRCMP4CODES

From SimsWiki
Revision as of 00:48, 3 September 2007 by Niol (Talk | contribs)

Jump to: navigation, search
  1. Pool depth layer materials
  1. this is here soley because the layering on standard material
  2. is too constrained. We need a layer less than 7, or we'll
  3. render over transparent areas of Sims (e.g. hair) when
  4. they're in the pool at a shallow view angle.

setc poolLayerColour (0, 0.5, 1.0, 1.0) define PoolDepthLayerMaterial()

  material     
     create DetermineHardwareSupport() 
     if ($useSWVertexShaderPath or $useFixedFunctionPath)
        shader
        end
     else
        shader -layer $poolWaterLayer
           validateRenderShaderContext -vertexFormat position 0 required
           validateRenderShaderContext -vertexFormat texcoord 0 required
           
           pass
              alphaBlend srcFactor(srcAlpha) add dstFactor(invSrcAlpha)

depthTest true -enableDepthWrite false

              #fillmode wireframe
              shaderProgram -target vertexProgram -method compile -version 1_1
                 bindConstants 0 -bindingID geomToClip -constantCount 4
                 bindConstants 4 -bindingID immediateData -data ($poolLayerColour)
                 
                 shaderSource
                    float4x4 clipSpaceMatrix      : register(c0);
                    float4   poolLayer            : register(c4);
                    
                    struct cVertexIn
                    {
                       float3 mPosition : POSITION0;   
                       float2 alpha     : TEXCOORD0;                  
                    };
                    
                    struct cVertexOut
                    {
                       float4 mClipPosition : POSITION;                     
                       float4 mColor        : COLOR0;
                    };
                    
                    cVertexOut VertexMain(cVertexIn vertexIn)
                    {                 
                       cVertexOut result;                                                                        
                       result.mClipPosition = mul(float4(vertexIn.mPosition, 1), clipSpaceMatrix);                     
                       result.mColor = float4(poolLayer.r, poolLayer.g, poolLayer.b, poolLayer.a * vertexIn.alpha.x); 
                       return result;         
                    }
                    
                 endShaderSource
              end                       
              
              shaderProgram -target pixelProgram -method compile -version 1_1
                 shaderSource                  
                    float4 PixelMain(float4 color : COLOR) : COLOR
                    {                                             
                       return color;
                    }
                 endShaderSource
              end                        
           end         
        end
     endif
  end

enddef

materialDefinition "poolWaterLayer-0"

  # this layer does nothing but create the caustics tile.
  setDefinition CausticsGeneratorMaterial   

end

materialDefinition "poolWaterLayer-1"

  setDefinition PoolDepthLayerMaterial   
  addParam poolLayerColour (0, 0.5, 1.0, 0.2)

end materialDefinition "poolWaterLayer-2"

  setDefinition PoolDepthLayerMaterial  
  addParam poolLayerColour (0, 0.5, 1.0, 0.2)    

end materialDefinition "poolWaterLayer-3"

  setDefinition PoolDepthLayerMaterial
  addParam poolLayerColour (0, 0.5, 1.0, 0.5)   

end

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox