예제 #1
0
        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 ) );
                }
            }
        }