コード例 #1
0
 public VerticesContent(GraphicsDevice device, Texture2D heightMap)
 {
     LoadHeightData(heightMap);
     terrainVertices          = SetTerrainVertices();
     terrainIndices           = SetTerrainIndices();
     terrainVertices          = CalculateNormal();
     VIBuffer                 = CopyToTerrainBuffers();
     terrainVertexBuffer      = VIBuffer.vertexBuffer;
     terrainIndexBuffer       = VIBuffer.indexBuffer;
     terrainVertexDeclaration = VertexMultiTexture.vertexDeclaration;
 }
コード例 #2
0
        protected VIBuffer CopyToTerrainBuffers()
        {
            VertexBuffer vertexBuffer = new VertexBuffer(State.Device, VertexMultiTexture.vertexDeclaration,
                                                         terrainvertices.Length * VertexMultiTexture.SizeInBytes, BufferUsage.None);
            IndexBuffer indexBuffer = new IndexBuffer(State.Device, typeof(int), terrainIndices.Length, BufferUsage.WriteOnly);

            vertexBuffer.SetData(terrainvertices);
            indexBuffer.SetData(terrainIndices);

            VIBuffer _VIBuffer = new VIBuffer(vertexBuffer, indexBuffer);

            return(_VIBuffer);
        }