public void Render(ModelShader shader) { if (!VertexBuffer.DataSet) { return; } GeometrySectionData geo = myGeometry[0]; foreach (MaterialSplit mat in geo.MaterialSplits) { if (mat.Material.TextureCount > 0) { TextureSectionData tex = mat.Material.Textures[0]; if (tex.Texture != null) { shader.SetTexture("tex_diffuse", tex.Texture); } if (tex.Mask != null) { shader.SetTexture("tex_mask", tex.Mask); //shader.AlphaMask = true; } else { shader.AlphaMask = false; } shader.Colour = mat.Material.Colour; GL.DrawElements(BeginMode.TriangleStrip, mat.VertexCount, DrawElementsType.UnsignedShort, mat.Offset * sizeof(UInt16)); } } }
public void SetupVertexBuffer() { if (VertexBuffer == null) { VertexBuffer = new VertexBuffer(9); if (myGeometry.Length > 0) { GeometrySectionData geo = myGeometry[0]; VertexBuffer.SetData(geo.GetVertices(), geo.GetIndices()); } } }