Ejemplo n.º 1
0
        public void SetSplitPoints(List <Real> newSplitPoints)
        {
            if (newSplitPoints.Count != 4)
            {
                throw new Core.AxiomException("IntegratedPSSM3 sub render state supports only 4 split points");
            }

            for (int i = 1; i < newSplitPoints.Count; i++)
            {
                ShadowTextureParams curParams = this.shadowTextureParamsList[i - 1];
                curParams.MaxRange = newSplitPoints[i];
            }
        }
Ejemplo n.º 2
0
        private bool AddPSInvocation(Program psProgram, int groupOrder, ref int internalCounter)
        {
            Function           psMain            = psProgram.EntryPointFunction;
            FunctionInvocation curFuncInvocation = null;

            ShadowTextureParams splitParams0 = this.shadowTextureParamsList[0];
            ShadowTextureParams splitParams1 = this.shadowTextureParamsList[1];
            ShadowTextureParams splitParams2 = this.shadowTextureParamsList[2];

            //Compute shadow factor
            curFuncInvocation = new FunctionInvocation(SGXFuncComputeShadowColor3, groupOrder, internalCounter++);
            curFuncInvocation.PushOperand(this.psInDepth, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(this.psSplitPoints, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams0.PSInLightPosition, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams1.PSInLightPosition, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams2.PSInLightPosition, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams0.TextureSampler, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams1.TextureSampler, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams2.TextureSampler, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams0.InvTextureSize, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams1.InvTextureSize, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(splitParams2.InvTextureSize, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(this.psLocalShadowFactor, Operand.OpSemantic.Out);
            psMain.AddAtomInstance(curFuncInvocation);

            //Apply shadow factor on diffuse color
            curFuncInvocation = new FunctionInvocation(SGXFuncApplyShadowFactorDiffuse, groupOrder, internalCounter++);
            curFuncInvocation.PushOperand(this.psDerivedSceneColor, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(this.psDiffuse, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(this.psLocalShadowFactor, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(this.psLocalShadowFactor, Operand.OpSemantic.Out);
            psMain.AddAtomInstance(curFuncInvocation);

            //Apply shadow factor on specular color
            curFuncInvocation = new FunctionInvocation(SGXFuncModulateScalar, groupOrder, internalCounter++);
            curFuncInvocation.PushOperand(this.psLocalShadowFactor, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(this.psSpecular, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(this.psSpecular, Operand.OpSemantic.Out);
            psMain.AddAtomInstance(curFuncInvocation);

            //Assign the local diffuse to output diffuse
            curFuncInvocation = new FunctionInvocation(FFPRenderState.FFPFuncAssign, groupOrder, internalCounter++);
            curFuncInvocation.PushOperand(this.psDiffuse, Operand.OpSemantic.In);
            curFuncInvocation.PushOperand(this.psOutDiffuse, Operand.OpSemantic.Out);
            psMain.AddAtomInstance(curFuncInvocation);

            return(true);
        }