示例#1
0
 /// <summary>
 /// Begin drawing meshes
 /// </summary>
 protected override void OnBegin()
 {
     //DiffuseSampler.BindDiffuse();
     // Reset previous Sprite/SpriteSet cache
     LastMesh = null;
     State.CheckError();
 }
示例#2
0
        /// <summary>
        /// Finish drawing meshes
        /// </summary>
        protected override void OnEnd()
        {
            GPUMesh <T> .Unbind();

            Texture2D.UnbindDiffuse();
            Sampler.UnbindDiffuse();
            BlendType.Unbind();
            State.CheckError();
        }
示例#3
0
        /// <summary>
        /// Draw a mesh
        /// </summary>
        /// <param name="mesh"></param>
        /// <param name="transform"></param>
        /// <param name="color"></param>
        /// <param name="blendType"></param>
        public void DrawMesh(GPUMesh <T> mesh, ref Matrix4 <float> transform, VulpineLib.Util.Color color, BlendType blendType)
        {
            Assert();

            if (!Drawing)
            {
                throw new InvalidOperationException("Not drawing; Begin() must be called first");
            }
            if (mesh != LastMesh !)
            {
                mesh.Bind();
                LastMesh = mesh;
            }
            // Bind the BlendType
            blendType.Bind();
            // Set the model color
            mesh.ShaderProgram.SetModelColor(color);
            // Set the model matrix
            mesh.ShaderProgram.SetModelMatrix(ref transform);
            // Draw
            mesh.Draw();
            State.CheckError();
        }