private void BuildGeometry() { geom = GpuDemGeometry.CreateGeometry(rDb, gDevice, out maxDataValue, reader); clipBottomSideQuad = new CustomVertex.PositionColored[4]; int clr = Color.DarkGray.ToArgb(); clipBottomSideQuad[1] = new CustomVertex.PositionColored(0, -0.5f, 0, clr); clipBottomSideQuad[0] = new CustomVertex.PositionColored(0, -0.5f, 5, clr); clipBottomSideQuad[3] = new CustomVertex.PositionColored(5, -0.5f, 0, clr); clipBottomSideQuad[2] = new CustomVertex.PositionColored(5, -0.5f, 5, clr); }
public static GpuDemGeometry CreateGeometry(RasterDatabase.RasterDatabase rDatabase, Device gDevice, out float maxValue, GDALReader reader) { // create actual geometry - tesselated plane IndexBuffer geomPlaneIndices; PlaneHelper.CreateIndexBuffer(gDevice, 14, 14, out geomPlaneIndices); VertexBuffer geomPlaneVerts; PlaneHelper.CreateVertexBufferInside(gDevice, 16, 16, new Vector2(1, 1), out geomPlaneVerts); VertexBuffer geomPatchVerts; PlaneHelper.CreatePatchVertexBuffer(gDevice, 16, 16, new Vector2(1, 1), out geomPatchVerts); IndexBuffer geomPatchIndices; PlaneHelper.CreatePatchIndexBuffer(gDevice, 16, 16, out geomPatchIndices); // create cache of all depths RectangleGroupQuadTree rTree = rDatabase.ProduceLayerMipMap(0, 256); RectangleGroupQuadTree.GroupNode[][] dataNodes = new RectangleGroupQuadTree.GroupNode[rTree.Depth][]; for (int depth = 0; depth < rTree.Depth; depth++) { RectangleGroupQuadTree.GroupNode[] nodes; rTree.GetNodes(depth + 1, out nodes); dataNodes[depth] = nodes; } GpuDemGeometry geom = new GpuDemGeometry(new Vector3(), new Vector3(10, 0, 10), new Vector3(5, 0, 5), 16 * 16, 15 * 15 * 2, PrimitiveType.TriangleList, gDevice); geom.geomPlaneVerts = geomPlaneVerts; geom.geomPlaneIndices = geomPlaneIndices; geom.geomPatchIndices = geomPatchIndices; geom.geomPatchVerts = geomPatchVerts; geom.reader = reader; geom.dataNodes = dataNodes; geom.ViewUpdated(new Vector3()); maxValue = 1; return(geom); }