Ejemplo n.º 1
0
        public TexturedQuadData(Vector3[] vertices, Vector4[] texcoords, TexturedQuadData texture)
        {
            this.Vertices  = vertices;
            this.Texcoords = texcoords;

            if (texture._parentTexture != null)
            {
                texture = texture._parentTexture;
            }

            texture._childTextures.Add(this);
            this._parentTexture = texture;
            this.Color          = Color.White;  // ENSUREs alpha is 255.. use Color to set Alpha only
        }
Ejemplo n.º 2
0
        public void FreeTexture(bool remove)
        {
            if (_control != null && TextureVboID != 0)
            {
                if (_control.InvokeRequired)
                {
                    _control.Invoke(new Action <bool>(this.FreeTexture), remove);
                }
                else
                {
                    if (TextureVboID != 0)
                    {
                        GL.DeleteTexture(TextureVboID);
                        TextureVboID = 0;
                    }
                }

                if (remove)
                {
                    if (_parentTexture != null)
                    {
                        _parentTexture._childTextures.Remove(this);

                        _parentTexture = null;
                    }
                    else if (_childTextures.Count != 0)
                    {
                        _childTextures[0]._parentTexture = null;

                        for (int i = 1; i < _childTextures.Count; i++)
                        {
                            _childTextures[i] = _childTextures[0];
                            _childTextures[0]._childTextures.Add(_childTextures[i]);
                        }

                        _childTextures.Clear();
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public static TexturedQuadData FromBaseTexture(TexturedQuadData basetex, Vector3 centre, Vector3 rotationdeg, Rectangle bounds, float width, float height, float hoffset = 0, float voffset = 0)
 {
     Vector4[] texcoords = GetTexCoords(bounds.Left, bounds.Top, bounds.Right, bounds.Bottom, basetex.Texture.Width, basetex.Texture.Height);
     Vector3[] vertices  = GetVertices(centre, rotationdeg, width, height, hoffset, voffset);
     return(new TexturedQuadData(vertices, texcoords, basetex));
 }
Ejemplo n.º 4
0
 public static TexturedQuadData FromBaseTexture(TexturedQuadData basetex, PointData centre, Vector3 rotationdeg, float width, float height, float hoffset = 0, float voffset = 0)
 {
     return(FromBaseTexture(basetex, centre.Pos, rotationdeg, width, height, hoffset, voffset));
 }