private void DrawChunkWithIndices(Chunk chunk) { if (chunk.Texture != null) { shader.SetDiffuseTexture(chunk.Texture); } nativeDevice.SetStreamSource(0, nativeVertexBuffer, 0, vertexSize); nativeDevice.Indices = nativeIndexBuffer; nativeDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, totalVerticesCount, chunk.FirstIndexOffsetInBytes / indexSize, chunk.NumberOfIndices / VerticesPerTriangle); }
public override void Draw() { const int VerticesPerTriangle = 3; nativeDevice.SetStreamSource(0, vertexBuffer, 0, Format.Stride); nativeDevice.Indices = indexBuffer; nativeDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, NumberOfVertices, 0, NumberOfIndices / VerticesPerTriangle); }
int SetStreamSourceHook(IntPtr devicePtr, int stream, IntPtr vBuffer, int offsetInBytes, int Stride) { using (SlimDX.Direct3D9.Device device = SlimDX.Direct3D9.Device.FromPointer(devicePtr)) { try { if (stream == 0) { stride = Stride; vb = VertexBuffer.FromPointer(vBuffer); } } catch (Exception e) { Interface.ReportException(e); } return(device.SetStreamSource(stream, VertexBuffer.FromPointer(vBuffer), offsetInBytes, Stride).Code); } }