private RTTextureType mTexture; // The actualy texture functionality.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constrctus from parsing command file. xlm elements:
        ///     index, type
        /// MUST exist before any other texture type-specific elements!!
        /// </summary>
        /// <param name="parser"></param>
        public RTTexture(CommandFileParser parser)
        {
            parser.ParserRead();
            while (!parser.IsEndElement("texture"))
            {
                if (parser.IsElement() && (!parser.IsElement("texture")))
                {
                    if (parser.IsElement("index")) {
                        int i = parser.ReadInt();
                        SetResourceIndex(i);
                    }
                    else if (parser.IsElement("type")) {
                        String type = parser.ReadString();
                        if (type.Equals("color"))
                            mTexture = new RTTextureType_Color(parser);
                        else if (type.Equals("checker"))
                            mTexture = new RTTextureType_Checker(parser);
                        else if (type.Equals("noise"))
                            mTexture = new RTTextureType_Noise(parser);
                        else if (type.Equals("sine"))
                            mTexture = new RTTextureType_Sine(parser);
                        else if (type.Equals("marble"))
                            mTexture = new RTTextureType_Marble(parser);
                        else if (type.Equals("ramp"))
                            mTexture = new RTTextureType_Ramp(parser);
                        else if (type.Equals("grid"))
                            mTexture = new RTTextureType_Grid(parser);
                        else if (type.Equals("bump"))
                            mTexture = new RTTextureType_Bump(parser);
                        else
                            parser.ParserError("Texture: unknown type");
                    }
                    else
                        parser.ParserError("Texture");
                }
                else
                    parser.ParserRead();
            }
        }
        private RTTextureType mTexture; // The actualy texture functionality.

        /// <summary>
        /// Constrctus from parsing command file. xlm elements:
        ///     index, type
        /// MUST exist before any other texture type-specific elements!!
        /// </summary>
        /// <param name="parser"></param>
        public RTTexture(CommandFileParser parser)
        {
            parser.ParserRead();
            while (!parser.IsEndElement("texture"))
            {
                if (parser.IsElement() && (!parser.IsElement("texture")))
                {
                    if (parser.IsElement("index"))
                    {
                        int i = parser.ReadInt();
                        SetResourceIndex(i);
                    }
                    else if (parser.IsElement("type"))
                    {
                        String type = parser.ReadString();
                        if (type.Equals("color"))
                        {
                            mTexture = new RTTextureType_Color(parser);
                        }
                        else if (type.Equals("checker"))
                        {
                            mTexture = new RTTextureType_Checker(parser);
                        }
                        else if (type.Equals("noise"))
                        {
                            mTexture = new RTTextureType_Noise(parser);
                        }
                        else if (type.Equals("sine"))
                        {
                            mTexture = new RTTextureType_Sine(parser);
                        }
                        else if (type.Equals("marble"))
                        {
                            mTexture = new RTTextureType_Marble(parser);
                        }
                        else if (type.Equals("ramp"))
                        {
                            mTexture = new RTTextureType_Ramp(parser);
                        }
                        else if (type.Equals("grid"))
                        {
                            mTexture = new RTTextureType_Grid(parser);
                        }
                        else if (type.Equals("bump"))
                        {
                            mTexture = new RTTextureType_Bump(parser);
                        }
                        else
                        {
                            parser.ParserError("Texture: unknown type");
                        }
                    }
                    else
                    {
                        parser.ParserError("Texture");
                    }
                }
                else
                {
                    parser.ParserRead();
                }
            }
        }