Beispiel #1
0
        public BMDMaterialWrapper(Material mat, SuperBMDLib.Model model)
        {
            Material    = mat;
            ParentModel = model;

            Text = mat.Name;

            int textureUnit = 1;

            if (mat.TextureIndices[0] != -1)
            {
                int texIndex = mat.TextureIndices[0];

                BMDTextureMap matTexture = new BMDTextureMap(this);
                matTexture.TextureIndex = texIndex;
                matTexture.Name         = ParentModel.Textures[texIndex].Name;
                matTexture.Type         = STGenericMatTexture.TextureType.Diffuse;
                matTexture.textureUnit  = textureUnit++;

                matTexture.WrapModeS = ConvertWrapMode(ParentModel.Textures[texIndex].WrapS);
                matTexture.WrapModeT = ConvertWrapMode(ParentModel.Textures[texIndex].WrapT);
                matTexture.MinFilter = ConvertMinFilter(ParentModel.Textures[texIndex].MinFilter);
                matTexture.MagFilter = ConvertMagFilter(ParentModel.Textures[texIndex].MagFilter);

                TextureMaps.Add(matTexture);

                foreach (var textureIndex in mat.TextureIndices)
                {
                    if (textureIndex != -1)
                    {
                        Nodes.Add(ParentModel.Textures[textureIndex].Name);
                    }
                }
            }
        }
        private BcresTextureMapWrapper CreateGenericMatTexture(int textureUnit, BCRES bcres, TextureMapInfo TextureMapInfo)
        {
            STGenericMatTexture tex1 = new STGenericMatTexture();
            var TexRef  = TextureMapInfo.TextureRef;
            var Sampler = TextureMapInfo.Sampler;

            tex1.textureUnit = textureUnit++;
            tex1.Name        = TexRef.Reference.Name;
            tex1.Type        = STGenericMatTexture.TextureType.Diffuse;
            TextureMaps.Add(tex1);

            switch (TextureMapInfo.WrapU)
            {
            case PICATextureWrap.Repeat: tex1.WrapModeS = STTextureWrapMode.Repeat; break;

            case PICATextureWrap.Mirror: tex1.WrapModeS = STTextureWrapMode.Mirror; break;

            case PICATextureWrap.ClampToEdge: tex1.WrapModeS = STTextureWrapMode.Clamp; break;

            case PICATextureWrap.ClampToBorder: tex1.WrapModeS = STTextureWrapMode.Clamp; break;
            }
            switch (TextureMapInfo.WrapV)
            {
            case PICATextureWrap.Repeat: tex1.WrapModeT = STTextureWrapMode.Repeat; break;

            case PICATextureWrap.Mirror: tex1.WrapModeT = STTextureWrapMode.Mirror; break;

            case PICATextureWrap.ClampToEdge: tex1.WrapModeT = STTextureWrapMode.Clamp; break;

            case PICATextureWrap.ClampToBorder: tex1.WrapModeT = STTextureWrapMode.Clamp; break;
            }

            switch (TextureMapInfo.MagFilter)
            {
            case PICATextureFilter.Linear: tex1.MagFilter = STTextureMagFilter.Linear; break;

            case PICATextureFilter.Nearest: tex1.MagFilter = STTextureMagFilter.Nearest; break;
            }

            switch (TextureMapInfo.MinFilter)
            {
            case PICATextureFilter.Linear: tex1.MagFilter = STTextureMagFilter.Linear; break;

            case PICATextureFilter.Nearest: tex1.MagFilter = STTextureMagFilter.Nearest; break;
            }

            switch (TextureMapInfo.MipFilter)
            {
            case PICATextureFilter.Linear: tex1.MagFilter = STTextureMagFilter.Linear; break;

            case PICATextureFilter.Nearest: tex1.MagFilter = STTextureMagFilter.Nearest; break;
            }


            var wrapperTexMap = new BcresTextureMapWrapper(bcres, TextureMapInfo, tex1);

            return(wrapperTexMap);
        }
Beispiel #3
0
        public override void AddTexture(string texture)
        {
            Console.WriteLine("TextureMaps AddTexture");

            int        index      = ParentLayout.AddTexture(texture);
            TextureRef textureRef = new TextureRef();

            textureRef.ID     = (short)index;
            textureRef.Name   = texture;
            TextureMaps       = TextureMaps.AddToArray(textureRef);
            TextureTransforms = TextureTransforms.AddToArray(new BxlytTextureTransform());
        }
Beispiel #4
0
        public override void AddTexture(string texture)
        {
            int        index      = ParentLayout.AddTexture(texture);
            TextureRef textureRef = new TextureRef();

            textureRef.ID   = (short)index;
            textureRef.Name = texture;
            TextureMaps     = TextureMaps.AddToArray(textureRef);
            TexCoordGens.Add(new TexCoordGenEntry()
            {
                Type         = TexCoordGenTypes.GX_TG_MTX2x4,
                MatrixSource = TexCoordGenMatrixSource.GX_DTTMTX9 + (TexCoordGens.Count * 4),
                Source       = TexCoordGenSource.GX_TG_TEX0
            });
            TextureTransforms = TextureTransforms.AddToArray(new BxlytTextureTransform());
        }
Beispiel #5
0
        public String createUnifiedVertexProgram(MaterialDescription description, TextureMaps maps)
        {
            String baseName = "Textured";

            if (maps == TextureMaps.None)
            {
                baseName = "Untextured";
            }

            String shaderName = DetermineVertexShaderName(baseName.ToString(), description.NumHardwareBones, description.NumHardwarePoses, description.Parity);

            if (!createdPrograms.ContainsKey(shaderName))
            {
                var program = setupUnifiedVertex(shaderName, maps, description);
                createdPrograms.Add(shaderName, program);
            }
            return(shaderName);
        }
Beispiel #6
0
        public void Read(FileReader reader)
        {
            Unknown1 = reader.ReadUInt32(); //0
            uint numTextures = reader.ReadUInt32();

            Unknown2 = reader.ReadUInt32(); //0, 1, -1
            Unknown3 = reader.ReadUInt32(); //0, 1, -1

            TextureIndices = new List <ushort[]>();
            for (int i = 0; i < numTextures; i++)
            {
                TextureIndices.Add(reader.ReadUInt16s(6));
            }

            Diffuse      = new G1MTextureMap();
            Diffuse.Type = STGenericMatTexture.TextureType.Diffuse;
            TextureMaps.Add(Diffuse);
        }
Beispiel #7
0
        public MODMaterial(MOD_Parser parser, Material mat)
        {
            this.DiffuseColor = mat.DiffuseColor;

            for (int i = 0; i < mat.TextureAttributeIndices.Length; i++)
            {
                short index = mat.TextureAttributeIndices[i];
                if (index != -1)
                {
                    var attribute = parser.TextureAttributes[index];
                    TextureMaps.Add(new STGenericTextureMap()
                    {
                        WrapU = ConvertWrapMode(attribute.WrapS),
                        WrapV = ConvertWrapMode(attribute.WrapT),
                        Name  = $"Texture{attribute.TextureIndex}",
                        Type  = STTextureType.Diffuse,
                    });
                }
            }
        }
Beispiel #8
0
        protected String DetermineVertexPreprocessorDefines(TextureMaps maps, int numHardwareBones, int numHardwarePoses, bool parity)
        {
            StringBuilder definesBuilder = new StringBuilder();

            if (parity)
            {
                definesBuilder.Append("PARITY=1,");
            }
            if (numHardwareBones > 0)
            {
                definesBuilder.AppendFormat("BONES_PER_VERTEX={0},", numHardwareBones);
            }
            if (numHardwarePoses > 0)
            {
                definesBuilder.AppendFormat("POSE_COUNT={0},", numHardwarePoses);
            }
            if (maps == TextureMaps.None)
            {
                definesBuilder.Append("NO_MAPS=1,");
            }
            return(definesBuilder.ToString());
        }
        private void ReloadMaterial()
        {
            for (int i = 0; i < Material.EnabledTextures?.Length; i++)
            {
                if (Material.EnabledTextures[i])
                {
                    H3DTextureMapWrapper matTexture = new H3DTextureMapWrapper();
                    if (i == 0)
                    {
                        matTexture.Name = Material.Texture0Name;
                    }
                    if (i == 1)
                    {
                        matTexture.Name = Material.Texture1Name;
                    }
                    if (i == 2)
                    {
                        matTexture.Name = Material.Texture2Name;
                    }

                    if (Material.TextureMappers.Length > i)
                    {
                        var mapper = Material.TextureMappers[i];
                        if (TextureMaps.Count == 0) //first texture added
                        {
                            matTexture.Type = STGenericMatTexture.TextureType.Diffuse;
                        }

                        matTexture.WrapModeS = ConvertWrapMode(mapper.WrapU);
                        matTexture.WrapModeT = ConvertWrapMode(mapper.WrapV);
                    }

                    TextureMaps.Add(matTexture);
                }
            }
        }
Beispiel #10
0
        protected String DetermineFragmentPreprocessorDefines(TextureMaps maps, bool alpha, bool glossMap, bool highlight, bool opacity)
        {
            StringBuilder definesBuilder = new StringBuilder("VIRTUAL_TEXTURE=1,");

            if (enableIntelFix)
            {
                definesBuilder.Append("INTEL_VTEXCOORD_FIX=1,");
            }
            if (alpha)
            {
                definesBuilder.Append("ALPHA=1,");
            }
            if (highlight)
            {
                definesBuilder.Append("HIGHLIGHT=1,");
            }
            if (opacity)
            {
                definesBuilder.Append("OPACITY=1,");
            }
            switch (normalMapReadMode)
            {
            case NormaMapReadMode.RG:
                definesBuilder.Append("RG_NORMALS=1,");
                break;
            }
            if (maps == TextureMaps.None)
            {
                definesBuilder.Append("NO_MAPS=1,");
            }
            else
            {
                StringBuilder mapDefineBuilder = new StringBuilder();
                if ((maps & TextureMaps.Normal) == TextureMaps.Normal)
                {
                    mapDefineBuilder.Append("NORMAL_");
                    definesBuilder.Append("NORMAL_MAP=1,");
                }
                if ((maps & TextureMaps.Diffuse) == TextureMaps.Diffuse)
                {
                    mapDefineBuilder.Append("DIFFUSE_");
                    definesBuilder.Append("DIFFUSE_MAP=1,");

                    if (glossMap)
                    {
                        definesBuilder.Append("GLOSS_MAP=1,");
                        if (!separateOpacityMap) //If we don't do opacity maps separately always use the opacity green channel as the gloss map
                        {
                            definesBuilder.Append("GLOSS_CHANNEL_OPACITY_GREEN=1,");
                        }
                    }
                }
                if ((maps & TextureMaps.Specular) == TextureMaps.Specular)
                {
                    mapDefineBuilder.Append("SPECULAR_");
                    definesBuilder.Append("SPECULAR_MAP=1,");
                }
                if ((maps & TextureMaps.Opacity) == TextureMaps.Opacity)
                {
                    mapDefineBuilder.Append("OPACITY_");
                    definesBuilder.Append("OPACITY_MAP=1,");
                    if (separateOpacityMap)
                    {
                        definesBuilder.Append("SEPARATE_OPACITY=1,");
                    }

                    if (glossMap)
                    {
                        definesBuilder.Append("GLOSS_MAP=1,GLOSS_CHANNEL_OPACITY_GREEN=1,");
                    }
                }
                mapDefineBuilder.Append("MAPS=1");
                definesBuilder.Append(mapDefineBuilder.ToString());
            }
            return(definesBuilder.ToString());
        }
        protected override HighLevelGpuProgramSharedPtr setupUnifiedFrag(String name, MaterialDescription description, TextureMaps maps, bool alpha)
        {
            var program = HighLevelGpuProgramManager.Instance.createProgram(name, ResourceGroupName, "glsl", GpuProgramType.GPT_FRAGMENT_PROGRAM);

            program.Value.SourceFile = UnifiedShaderBase + "UnifiedFS.glsl";
            program.Value.setParam("attach", "Lighting_FP_GLSL Unpack_FP_GLSL VirtualTextureFuncs_GLSL");
            program.Value.setParam("preprocessor_defines", DetermineFragmentPreprocessorDefines(maps, alpha, description.HasGlossMap, description.IsHighlight, description.HasOpacityValue));
            program.Value.load();

            using (var defaultParams = program.Value.getDefaultParameters())
            {
                try
                {
                    int textureIndex = 0;
                    if ((maps & TextureMaps.Normal) == TextureMaps.Normal)
                    {
                        defaultParams.Value.setNamedConstant("normalTexture", textureIndex++);
                    }
                    if ((maps & TextureMaps.Diffuse) == TextureMaps.Diffuse)
                    {
                        defaultParams.Value.setNamedConstant("colorTexture", textureIndex++);
                    }
                    if ((maps & TextureMaps.Specular) == TextureMaps.Specular)
                    {
                        defaultParams.Value.setNamedConstant("specularTexture", textureIndex++);
                    }
                    if ((maps & TextureMaps.Opacity) == TextureMaps.Opacity && separateOpacityMap)
                    {
                        defaultParams.Value.setNamedConstant("opacityTexture", textureIndex++);
                    }
                    if (maps != TextureMaps.None)
                    {
                        defaultParams.Value.setNamedConstant("indirectionTex", textureIndex++);
                    }

                    defaultParams.Value.setNamedAutoConstant("lightDiffuseColor", AutoConstantType.ACT_LIGHT_DIFFUSE_COLOUR, 0);
                    defaultParams.Value.setNamedAutoConstant("emissiveColor", AutoConstantType.ACT_SURFACE_EMISSIVE_COLOUR);

                    if (description.HasGlossMap)
                    {
                        defaultParams.Value.setNamedConstant("glossyStart", 40.0f);
                        defaultParams.Value.setNamedConstant("glossyRange", 0.0f);
                    }
                    else
                    {
                        defaultParams.Value.setNamedAutoConstant("glossyness", AutoConstantType.ACT_SURFACE_SHININESS);
                    }

                    if ((maps & TextureMaps.Diffuse) == 0)
                    {
                        defaultParams.Value.setNamedAutoConstant("diffuseColor", AutoConstantType.ACT_SURFACE_DIFFUSE_COLOUR);
                    }

                    //Check for need to pass specular color
                    if ((maps & TextureMaps.Specular) == 0)
                    {
                        defaultParams.Value.setNamedAutoConstant("specularColor", AutoConstantType.ACT_SURFACE_SPECULAR_COLOUR);
                    }

                    if (description.IsHighlight)
                    {
                        defaultParams.Value.setNamedAutoConstant("highlightColor", AutoConstantType.ACT_CUSTOM, 1);
                    }

                    if (alpha)
                    {
                        defaultParams.Value.setNamedAutoConstant("alpha", AutoConstantType.ACT_CUSTOM, 0);
                    }
                }
                catch (Exception)
                {
                    Logging.Log.Warning($"Could not set params for frag program '{name}'");
                }
            }

            return(program);
        }
        protected override HighLevelGpuProgramSharedPtr setupUnifiedVertex(String name, TextureMaps maps, MaterialDescription description)
        {
            var program = HighLevelGpuProgramManager.Instance.createProgram(name, ResourceGroupName, "glsl", GpuProgramType.GPT_VERTEX_PROGRAM);

            program.Value.SourceFile = UnifiedShaderBase + "MainVP.glsl";

            program.Value.setParam("attach", "Pack_VP_GLSL");
            program.Value.SkeletalAnimationIncluded = description.NumHardwareBones > 0;
            program.Value.NumberOfPoses             = (ushort)description.NumHardwarePoses;
            program.Value.setParam("preprocessor_defines", DetermineVertexPreprocessorDefines(maps, description.NumHardwareBones, description.NumHardwarePoses, description.Parity));
            program.Value.load();

            using (var defaultParams = program.Value.getDefaultParameters())
            {
                if (description.NumHardwareBones > 0 || description.NumHardwarePoses > 0)
                {
                    defaultParams.Value.setNamedAutoConstant("eyePosition", AutoConstantType.ACT_CAMERA_POSITION_OBJECT_SPACE);
                    defaultParams.Value.setNamedAutoConstant("lightAttenuation", AutoConstantType.ACT_LIGHT_ATTENUATION, 0);
                    defaultParams.Value.setNamedAutoConstant("lightPosition", AutoConstantType.ACT_LIGHT_POSITION_OBJECT_SPACE, 0);

                    defaultParams.Value.setNamedAutoConstant("worldMatrix3x4Array", AutoConstantType.ACT_WORLD_MATRIX_ARRAY_3x4);
                    defaultParams.Value.setNamedAutoConstant("cameraMatrix", AutoConstantType.ACT_VIEWPROJ_MATRIX);

                    if (description.NumHardwarePoses > 0)
                    {
                        defaultParams.Value.setNamedAutoConstant("poseAnimAmount", AutoConstantType.ACT_ANIMATION_PARAMETRIC);
                    }
                }
                else
                {
                    defaultParams.Value.setNamedAutoConstant("cameraMatrix", AutoConstantType.ACT_WORLDVIEWPROJ_MATRIX);
                    defaultParams.Value.setNamedAutoConstant("eyePosition", AutoConstantType.ACT_CAMERA_POSITION_OBJECT_SPACE);
                    defaultParams.Value.setNamedAutoConstant("lightAttenuation", AutoConstantType.ACT_LIGHT_ATTENUATION, 0);
                    defaultParams.Value.setNamedAutoConstant("lightPosition", AutoConstantType.ACT_LIGHT_POSITION_OBJECT_SPACE, 0);
                }
            }

            return(program);
        }
Beispiel #13
0
        private void ReloadMaterial()
        {
            SwitchParams.Clear();
            ValueParams.Clear();
            ColorParams.Clear();
            TextureMaps.Clear();

            for (int i = 0; i < Material.Switches?.Count; i++)
            {
                var val = Material.Switches[i];
                SwitchParams.Add(val.Name, new GFLXSwitchParam(val));
            }

            for (int i = 0; i < Material.Values?.Count; i++)
            {
                var val = Material.Values[i];
                ValueParams.Add(val.Name, new GFLXValueParam(val));
            }

            for (int i = 0; i < Material.Colors?.Count; i++)
            {
                var val = Material.Colors[i];
                ColorParams.Add(val.Name, new GFLXColorParam(val));
            }

            int textureUnit = 1;

            for (int t = 0; t < Material.TextureMaps?.Count; t++)
            {
                var    tex  = Material.TextureMaps[t];
                string name = ParentModel.Textures[(int)tex.Index];

                GFLXTextureMap matTexture = new GFLXTextureMap();
                matTexture.gflxTextureMap = tex;
                matTexture.Name           = name;
                matTexture.Transform      = new STTextureTransform();
                matTexture.SamplerName    = tex.Sampler;
                matTexture.textureUnit    = textureUnit++;
                matTexture.WrapModeS      = STTextureWrapMode.Mirror;
                matTexture.WrapModeT      = STTextureWrapMode.Repeat;
                TextureMaps.Add(matTexture);

                if (tex.Params != null)
                {
                    matTexture.WrapModeS = GFLXTextureMap.ConvertWrap(tex.Params.WrapModeX);
                    matTexture.WrapModeT = GFLXTextureMap.ConvertWrap(tex.Params.WrapModeY);
                }

                switch (tex.Sampler)
                {
                case "Texture0112`":
                case "BaseColor0":
                case "Col0Tex":
                case "L0ColTex":
                    matTexture.Type = STGenericMatTexture.TextureType.Diffuse;
                    break;

                case "EmissionMaskTex":
                    //     matTexture.Type = STGenericMatTexture.TextureType.Emission;
                    break;

                case "LyCol0Tex":
                    break;

                case "NormalMapTex":
                    matTexture.Type = STGenericMatTexture.TextureType.Normal;
                    break;

                case "AmbientTex":
                    if (SwitchParams.ContainsKey("AmbientMapEnable"))
                    {
                        if (SwitchParams["AmbientMapEnable"].Value)
                        {
                            matTexture.Type = STGenericMatTexture.TextureType.AO;
                        }
                    }
                    break;

                case "LightTblTex":
                    break;

                case "SphereMapTex":
                    break;

                case "EffectTex":
                    break;
                }


                float ScaleX = 1;
                float ScaleY = 1;
                float TransX = 0;
                float TransY = 0;

                //Lookup the uniforms and apply a transform to the texture map
                //Used for the UV viewer
                if (matTexture.Type == STGenericMatTexture.TextureType.Diffuse)
                {
                    if (ValueParams.ContainsKey("ColorUVScaleU"))
                    {
                        ScaleX = ValueParams["ColorUVScaleU"].Value;
                    }
                    if (ValueParams.ContainsKey("ColorUVScaleV"))
                    {
                        ScaleY = ValueParams["ColorUVScaleV"].Value;
                    }

                    if (ValueParams.ContainsKey("ColorUVTranslateU"))
                    {
                        TransX += ValueParams["ColorUVTranslateU"].Value;
                    }
                    if (ValueParams.ContainsKey("ColorUVTranslateV"))
                    {
                        TransY += ValueParams["ColorUVTranslateV"].Value;
                    }

                    if (ValueParams.ContainsKey("ColorBaseU"))
                    {
                        TransX += ValueParams["ColorBaseU"].Value;
                    }
                    if (ValueParams.ContainsKey("ColorBaseV"))
                    {
                        TransY += ValueParams["ColorBaseV"].Value;
                    }
                }
                if (matTexture.Type == STGenericMatTexture.TextureType.Normal)
                {
                }

                matTexture.Transform.Scale     = new OpenTK.Vector2(ScaleX, ScaleY);
                matTexture.Transform.Translate = new OpenTK.Vector2(TransX, TransY);
            }
        }
Beispiel #14
0
 protected abstract HighLevelGpuProgramSharedPtr setupUnifiedVertex(String name, TextureMaps maps, MaterialDescription description);
Beispiel #15
0
        public void Reload(Material material)
        {
            ShaderArchive = "";
            ShaderModel   = "";
            ShaderParams.Clear();
            ShaderOptions.Clear();
            Samplers.Clear();
            TextureMaps.Clear();

            UpdateRenderState();

            if (material.ShaderAssign != null)
            {
                ShaderArchive = material.ShaderAssign.ShaderArchiveName;
                ShaderModel   = material.ShaderAssign.ShadingModelName;
            }

            foreach (var param in material.ShaderParams)
            {
                ShaderParams.Add(param.Key, param.Value);
            }
            foreach (var option in material.ShaderAssign.ShaderOptions)
            {
                ShaderOptions.Add(option.Key, option.Value);
            }

            // if (ShaderParams.ContainsKey("gsys_i_color_ratio0"))
            //   ShaderParams["gsys_i_color_ratio0"].DataValue = 0.1f;

            for (int i = 0; i < material.TextureRefs.Count; i++)
            {
                string  name        = material.TextureRefs[i].Name;
                Sampler sampler     = material.Samplers[i];
                var     texSampler  = material.Samplers[i].TexSampler;
                string  samplerName = sampler.Name;
                string  fragSampler = "";

                //Force frag shader sampler to be used
                if (material.ShaderAssign.SamplerAssigns.ContainsValue(samplerName))
                {
                    material.ShaderAssign.SamplerAssigns.TryGetKey(samplerName, out fragSampler);
                }

                Samplers.Add(fragSampler);

                this.TextureMaps.Add(new TextureMap()
                {
                    Name      = name,
                    Sampler   = samplerName,
                    MagFilter = GXConverter.ConvertMagFilter(texSampler.MagFilter),
                    MinFilter = GXConverter.ConvertMinFilter(
                        texSampler.MipFilter,
                        texSampler.MinFilter),
                    Type    = GetTextureType(fragSampler),
                    WrapU   = GXConverter.ConvertWrapMode(texSampler.ClampX),
                    WrapV   = GXConverter.ConvertWrapMode(texSampler.ClampY),
                    LODBias = texSampler.LodBias,
                    MaxLOD  = texSampler.MaxLod,
                    MinLOD  = texSampler.MinLod,
                });
            }
        }
Beispiel #16
0
        public String createFragmentProgram(MaterialDescription description, bool alpha, out TextureMaps textureMaps)
        {
            StringBuilder name = new StringBuilder();

            textureMaps = TextureMaps.None;

            if (description.HasNormalMap)
            {
                textureMaps |= TextureMaps.Normal;
                name.Append("NormalMap");
            }
            else
            {
                name.Append("Normal");
            }

            if (description.HasDiffuseMap)
            {
                textureMaps |= TextureMaps.Diffuse;
                name.Append("DiffuseMap");
            }
            else
            {
                name.Append("Diffuse");
            }

            if (description.HasSpecularColorMap)
            {
                textureMaps |= TextureMaps.Specular;
                name.Append("SpecularMap");
            }
            else
            {
                name.Append("Specular");
            }

            if (description.HasGlossMap)
            {
                name.Append("GlossMap");
            }

            if (description.HasOpacityMap)
            {
                textureMaps |= TextureMaps.Opacity;
                name.Append("OpacityMap");
            }
            else if (description.HasOpacityValue)
            {
                name.Append("Opacity");
            }

            if (description.IsHighlight)
            {
                name.Append("Highlight");
            }

            String shaderName = DetermineFragmentShaderName(name.ToString(), alpha);

            if (!createdPrograms.ContainsKey(shaderName))
            {
                var program = setupUnifiedFrag(shaderName, description, textureMaps, alpha);
                createdPrograms.Add(shaderName, program);
            }
            return(shaderName);
        }
Beispiel #17
0
 protected abstract HighLevelGpuProgramSharedPtr setupUnifiedFrag(String name, MaterialDescription description, TextureMaps maps, bool alpha);