コード例 #1
0
            public void MakeMetal(int newDifTexId, int newCubeTexId, float[] minGain, float[] refColor, float[] fresParams, float[] fresColor, bool preserveDiffuse = false, bool preserveNrmMap = true)
            {
                UpdateLabeledTextureIds();

                float materialHash = -1f;

                if (propertyValuesByName.ContainsKey("NU_materialHash"))
                {
                    materialHash = propertyValuesByName["NU_materialHash"][0];
                }
                animatedPropertyValuesByName.Clear();
                propertyValuesByName.Clear();

                // The texture ID used for diffuse later.
                int difTexId = newDifTexId;

                if (preserveDiffuse)
                {
                    difTexId = Diffuse1Id;
                }

                // add all the textures
                textures.Clear();
                displayTexId = -1;

                MatTexture diffuse   = new MatTexture(difTexId);
                MatTexture cube      = new MatTexture(newCubeTexId);
                MatTexture normal    = new MatTexture(normalId);
                MatTexture dummyRamp = MatTexture.GetDefault();

                dummyRamp.hash = 0x10080000;

                if (HasNormalMap && preserveNrmMap)
                {
                    Flags = 0x9601106B;
                    textures.Add(diffuse);
                    textures.Add(cube);
                    textures.Add(normal);
                    textures.Add(dummyRamp);
                }
                else
                {
                    Flags = 0x96011069;
                    textures.Add(diffuse);
                    textures.Add(cube);
                    textures.Add(dummyRamp);
                }

                // add material properties
                propertyValuesByName.Add("NU_colorSamplerUV", new float[] { 1, 1, 0, 0 });
                propertyValuesByName.Add("NU_fresnelColor", fresColor);
                propertyValuesByName.Add("NU_blinkColor", new float[] { 0f, 0f, 0f, 0 });
                propertyValuesByName.Add("NU_reflectionColor", refColor);
                propertyValuesByName.Add("NU_aoMinGain", minGain);
                propertyValuesByName.Add("NU_lightMapColorOffset", new float[] { 0f, 0f, 0f, 0 });
                propertyValuesByName.Add("NU_fresnelParams", fresParams);
                propertyValuesByName.Add("NU_alphaBlendParams", new float[] { 0f, 0f, 0f, 0 });
                propertyValuesByName.Add("NU_materialHash", new float[] { materialHash, 0f, 0f, 0 });
            }
コード例 #2
0
            public void AddDefaultMaterial()
            {
                Material mat = Material.GetDefault();

                materials.Add(mat);
                mat.textures.Add(new MatTexture(0x10000000));
                mat.textures.Add(MatTexture.GetDefault());
            }
コード例 #3
0
ファイル: Material.cs プロジェクト: y4my4my4m/Smash-Forge
            public static Material GetDefault()
            {
                Material material = new Material();

                material.Flags    = 0x94010161;
                material.cullMode = 0x0405;
                material.entries.Add("NU_colorSamplerUV", new float[] { 1, 1, 0, 0 });
                material.entries.Add("NU_fresnelColor", new float[] { 1, 1, 1, 1 });
                material.entries.Add("NU_blinkColor", new float[] { 0, 0, 0, 0 });
                material.entries.Add("NU_aoMinGain", new float[] { 0, 0, 0, 0 });
                material.entries.Add("NU_lightMapColorOffset", new float[] { 0, 0, 0, 0 });
                material.entries.Add("NU_fresnelParams", new float[] { 1, 0, 0, 0 });
                material.entries.Add("NU_alphaBlendParams", new float[] { 0, 0, 0, 0 });
                material.entries.Add("NU_materialHash", new float[] { FileData.toFloat(0x7E538F65), 0, 0, 0 });

                material.textures.Add(new MatTexture(0x10000000));
                material.textures.Add(MatTexture.GetDefault());
                return(material);
            }