コード例 #1
0
 /// <summary>
 /// Используется для отрисовки вертексного буфера внешнего класса, например TerrainSpriteLayer
 /// </summary>
 /// <param name="buffer">.</param>
 /// <param name="start">.</param>
 /// <param name="length">.</param>
 /// <param name="type">.</param>
 /// <param name="sheet">.</param>
 /// <param name="blendMode">.</param>
 public void DrawVertexBuffer(VertexBuffer <Vertex> buffer, int start, int length, PrimitiveType type, Sheet sheet, BlendMode blendMode)
 {
     shader.SetTexture("Texture0", sheet.AssignOrGetOrSetDataGLTexture());
     renderer.Context.SetBlendMode(blendMode);
     shader.PrepareRender();
     buffer.ActivateVAO();
     renderer.DrawBatcForOpenGLVertexBuffer(buffer, start, length, type);
     buffer.CloseVAO();
     renderer.Context.SetBlendMode(BlendMode.None);
 }
コード例 #2
0
        void Render(
            ModelRenderData renderData,
            IModelCache cache,
            float[] t, float[] lightDirection,
            float[] ambientLight, float[] diffuseLight,
            float colorPaletteTextureMidIndex, float normalsPaletteTextureMidIndex)
        {
            shader.SetTexture("DiffuseTexture", renderData.Sheet.AssignOrGetOrSetDataGLTexture());
            shader.SetVec("PaletteRows", colorPaletteTextureMidIndex, normalsPaletteTextureMidIndex);
            shader.SetMatrix("TransformMatrix", t);
            shader.SetVec("LightDirection", lightDirection, 4);
            shader.SetVec("AmbientLight", ambientLight, 3);
            shader.SetVec("DiffuseLight", diffuseLight, 3);

            shader.PrepareRender();
            renderer.DrawBatcForOpenGLVertexBuffer(cache.VertexBuffer, renderData.Start, renderData.Count, PrimitiveType.TriangleList);
        }