Aiv.Fast2D.Mesh.DrawTexture C# (CSharp) Метод

DrawTexture() публичный Метод

public DrawTexture ( Texture tex ) : void
tex Texture
Результат void
        public virtual void DrawTexture(Texture tex)
        {
            if (this.v == null || this.uv == null)
                return;
            // upload fake vcs (if required) to avoid crashes
            if (this.vc == null && this.hasVertexColors)
            {
                this.vc = new float[this.v.Length * 2];
                this.UpdateVertexColor();
            }
            this.Bind();
            tex.Bind();
            if (this.requireUseTexture)
                this.shader.SetUniform("use_texture", 1f);
            this.shader.Use();
            if (this.shaderSetupHook != null)
            {
                this.shaderSetupHook(this);
            }
            this.ApplyMatrix();
            if (instances <= 1)
            {
            #if !__MOBILE__
                GL.DrawArrays(PrimitiveType.Triangles, 0, this.v.Length / 2);
            #else
                GL.DrawArrays(BeginMode.Triangles, 0, this.v.Length / 2);
            #endif
            }
            else
            {
                GL.DrawArraysInstanced(PrimitiveType.Triangles, 0, this.v.Length / 2, instances);
            }
        }

Same methods

Mesh::DrawTexture ( int textureId ) : void

Usage Example

Пример #1
0
 public void Apply(Window window)
 {
     if (!this.useDepth)
     {
         screenMesh.DrawTexture(renderTexture);
     }
     else
     {
         screenMesh.Draw((m) =>
         {
             Graphics.BindTextureToUnit(renderTexture.Id, 0);
             Graphics.BindTextureToUnit(renderTexture.DepthId, 1);
             m.shader.SetUniform("tex", 0);
             m.shader.SetUniform("depth_tex", 1);
         });
     }
 }
All Usage Examples Of Aiv.Fast2D.Mesh::DrawTexture