示例#1
0
        public bool SetTexture(XmlNode channels, string textureName)
        {
            XmlNode nodeXml = channels.SelectSingleNode(textureName);

            if (nodeXml != null)
            {
                Texture texture = SmallParserUtils.ParseTextureXml(nodeXml.InnerText);
                _material.SetTexture(textureName, texture);
                return(texture != null);
            }
            return(false);
        }
示例#2
0
        public void SetLightmap(XmlNode channels, string propName)
        {
            // Tile and lightmap data
            XmlNode tileMaxXml = channels.SelectSingleNode("_TileMax");

            if (tileMaxXml != null)
            {
                float tileMax   = SmallParserUtils.ParseFloatXml(tileMaxXml.InnerText);
                float tileScale = 1.0f / tileMax;
                _material.SetFloat("_TileScale", tileScale);

                float tileX = SmallParserUtils.ParseFloatXml(channels.SelectSingleNode("_TileX").InnerText);
                float tileY = SmallParserUtils.ParseFloatXml(channels.SelectSingleNode("_TileY").InnerText);
                _material.SetVector("_Offset", new Vector4(tileX * tileScale, tileY * tileScale));

                // Lightmap
                XmlNode lightmapXml = channels.SelectSingleNode("_Lightmap");
                if (lightmapXml != null)
                {
                    Texture texture = SmallParserUtils.ParseTextureXml(lightmapXml.InnerText);
                    _material.SetTexture("_Lightmap", texture);
                }
            }
        }