public override void WriteInstance(Serialization.MaterialSerializer ser, SubRenderState subRenderState,
                                    Graphics.Pass srcPass, Graphics.Pass dstPass)
 {
 }
Exemple #2
0
 public override void WriteInstance(Serialization.MaterialSerializer ser, SubRenderState subRenderState,
                                    Graphics.Pass srcPass, Graphics.Pass dstPass)
 {
     //ser.WriteAttribute(4, "texturing_stage");
     //ser.WriteValue("ffp");
 }
Exemple #3
0
 public override bool PreAddToRenderState(TargetRenderState targetRenderState, Graphics.Pass srcPass,
                                          Graphics.Pass dstPass)
 {
     return(base.PreAddToRenderState(targetRenderState, srcPass, dstPass));
 }
 public override SubRenderState CreateInstance(Scripting.Compiler.ScriptCompiler compiler,
                                               Scripting.Compiler.AST.PropertyAbstractNode prop,
                                               Graphics.Pass pass, ScriptTranslator stranslator)
 {
     return(null);
 }
Exemple #5
0
 public virtual bool PreAddToRenderState(TargetRenderState targetRenderState, Graphics.Pass srcPass,
                                         Graphics.Pass dstPass)
 {
     return(true);
 }
Exemple #6
0
 public virtual void UpdateGpuProgramsParams(Graphics.IRenderable rend, Graphics.Pass pass,
                                             Graphics.AutoParamDataSource source,
                                             Core.Collections.LightList lightList)
 {
 }
Exemple #7
0
        public override bool PreAddToRenderState(TargetRenderState targetRenderState, Graphics.Pass srcPass,
                                                 Graphics.Pass dstPass)
        {
            bool      isValid   = true;
            Technique firstTech = srcPass.Parent.Parent.GetTechnique(0);

            //TODO
            //var hsAny = firstTech.UserObjectBindings.GetUserAny(HardwareSkinning.HsDataBindName);
            if (false)               //hsAny.isEmpty == false)
            {
            }
            //If there is no associated techniqe, default to linear skinning as a pass-through
            if (this.activeTechnique == null)
            {
                SetHardwareSkinningParam(0, 0, RTShaderSystem.SkinningType.Linear, false, false);
            }
            int boneCount   = this.activeTechnique.BoneCount;
            int weightCount = this.activeTechnique.WeightCount;

            bool doBoneCalculations = isValid && (boneCount != 0) && (boneCount <= 256) && (weightCount != 0) &&
                                      (weightCount <= 4) &&
                                      ((this.creator == null) || (boneCount <= this.creator.MaxCalculableBoneCount));

            this.activeTechnique.DoBoneCalculations = doBoneCalculations;


            if ((doBoneCalculations) && (this.creator != null))
            {
                //update the receiver and caster materials
                if (dstPass.Parent.ShadowCasterMaterial == null)
                {
                    Material mat = this.creator.GetCustomShadowCasterMaterial(this.skinningType, weightCount - 1);
                    dstPass.Parent.SetShadowCasterMaterial(mat.Name);
                }

                if (dstPass.Parent.ShadowReceiverMaterial == null)
                {
                    Material mat = this.creator.GetCustomShadowCasterMaterial(this.skinningType, weightCount - 1);
                    dstPass.Parent.SetShadowReceiverMaterial(mat.Name);
                }
            }
            return(true);
        }
Exemple #8
0
        public override SubRenderState CreateInstance(Scripting.Compiler.ScriptCompiler compiler,
                                                      PropertyAbstractNode prop, Graphics.Pass pass,
                                                      ScriptTranslator stranslator)
        {
            if (prop.Name == "lighting_stage")
            {
                if (prop.Values.Count >= 2)
                {
                    string strValue;
                    int    it = 0;

                    //Read light model type.
                    if (!SGScriptTranslator.GetString(prop.Values[it], out strValue))
                    {
                        //compiler.AddError(...)
                        return(null);
                    }

                    //Case light model type is normal map
                    if (strValue == "normal_map")
                    {
                        it++;
                        if (!SGScriptTranslator.GetString(prop.Values[it], out strValue))
                        {
                            //compiler.AddError(...)
                            return(null);
                        }

                        SubRenderState subRenderState          = CreateOrRetrieveInstance(stranslator);
                        var            normalMapSubRenderState = subRenderState as NormalMapLighting;

                        normalMapSubRenderState.NormalMapTextureName = strValue;

                        //Read normal map space type.
                        if (prop.Values.Count >= 3)
                        {
                            it++;
                            if (!SGScriptTranslator.GetString(prop.Values[it], out strValue))
                            {
                                //compiler.AddError(...)
                                return(null);
                            }

                            //Normal map defines normals in tangent space.
                            if (strValue == "tangent_space")
                            {
                                normalMapSubRenderState.NormalMapSpace = NormalMapSpace.Tangent;
                            }

                            //Normal map defines normals in object space
                            if (strValue == "object_space")
                            {
                                normalMapSubRenderState.NormalMapSpace = NormalMapSpace.Object;
                            }
                        }

                        //Read texture coordinate index.
                        if (prop.Values.Count >= 4)
                        {
                            int textureCoordinatesIndex = 0;
                            it++;
                            if (!SGScriptTranslator.GetInt(prop.Values[it], out textureCoordinatesIndex))
                            {
                                normalMapSubRenderState.TexCoordIndex = textureCoordinatesIndex;
                            }
                        }

                        //Read texture filtering format
                        if (prop.Values.Count >= 5)
                        {
                            it++;
                            if (!SGScriptTranslator.GetString(prop.Values[it], out strValue))
                            {
                                //compiler.AddError(...)
                                return(null);
                            }

                            if (strValue == "none")
                            {
                                normalMapSubRenderState.SetNormalMapFiltering(Graphics.FilterOptions.Point, Graphics.FilterOptions.Point,
                                                                              Graphics.FilterOptions.None);
                            }
                            else if (strValue == "bilinear")
                            {
                                normalMapSubRenderState.SetNormalMapFiltering(Graphics.FilterOptions.Linear, Graphics.FilterOptions.Linear,
                                                                              Graphics.FilterOptions.Point);
                            }
                            else if (strValue == "trilinear")
                            {
                                normalMapSubRenderState.SetNormalMapFiltering(Graphics.FilterOptions.Linear, Graphics.FilterOptions.Linear,
                                                                              Graphics.FilterOptions.Linear);
                            }
                            else if (strValue == "anisotropic")
                            {
                                normalMapSubRenderState.SetNormalMapFiltering(Graphics.FilterOptions.Anisotropic,
                                                                              Graphics.FilterOptions.Anisotropic, Graphics.FilterOptions.Linear);
                            }
                        }

                        //Read max anisotropy value
                        if (prop.Values.Count >= 6)
                        {
                            int maxAnisotropy = 0;
                            it++;
                            if (SGScriptTranslator.GetInt(prop.Values[it], out maxAnisotropy))
                            {
                                normalMapSubRenderState.NormalMapAnisotropy = maxAnisotropy;
                            }
                        }
                        //Read mip bias value.
                        if (prop.Values.Count >= 7)
                        {
                            Real mipBias = 0;
                            it++;
                            if (SGScriptTranslator.GetReal(prop.Values[it], out mipBias))
                            {
                                normalMapSubRenderState.NormalMapMipBias = mipBias;
                            }
                        }
                        return(subRenderState);
                    }
                }
            }
            return(null);
        }
Exemple #9
0
        public override bool PreAddToRenderState(TargetRenderState targetRenderState, Graphics.Pass srcPass,
                                                 Graphics.Pass dstPass)
        {
            TrackVertexColor trackColor = srcPass.VertexColorTracking;

            if (trackColor != null)
            {
                AddResolveStageMask((int)StageFlags.VsInputDiffuse);
            }

            return(true);
        }