예제 #1
0
        public Shape(string id, VertexBuffer[] vertexBuffers, IndexBuffer[] indexBuffers,
                     int[] numVertices, int[] numIndices, int[] indexVRefs,
                     PrimitiveType[] pTypes, VertexFormats[] vFormats,
                     int[] primCounts, BoundingBox bBox)
            : base(id, null, null)
        {
            vBuffers = vertexBuffers;
            iBuffers = indexBuffers;

            vertexCount = numVertices;
            indexCount = numIndices;
            this.indexVRefs = indexVRefs;
            this.pTypes = pTypes;
            this.vFormats = vFormats;
            this.primCounts = primCounts;
            this.bBox = bBox;
        }
예제 #2
0
        public static void DrawWireframe(Device device, BoundingBox box, int clr)
        {
            CustomVertex.PositionColored[] lines = new CustomVertex.PositionColored[24];
            // bottom
            lines[0] = new CustomVertex.PositionColored(/*box.position*/new Vector3(), clr);
            lines[1] = new CustomVertex.PositionColored(/*box.position.X +*/ box.dimensions.X, /*box.position.Y*/0, /*box.position.Z*/0, clr);

            lines[2] = lines[1];
            lines[3] = new CustomVertex.PositionColored(lines[2].X, /*box.position.Y*/0, /*box.position.Z +*/ box.dimensions.Z, clr);

            lines[4] = lines[3];
            lines[5] = new CustomVertex.PositionColored(/*box.position.X*/0, /*box.position.Y*/0, /*box.position.Z +*/ box.dimensions.Z, clr);

            lines[6] = lines[5];
            lines[7] = lines[0];

            // top
            for (int i = 8; i < 16; i++)
            {
            	lines[i] = lines[i - 8];
                lines[i].Y = /*box.position.Y +*/ box.dimensions.Y;
            }

            // connectors
            lines[16] = lines[0];
            lines[17] = lines[8];

            lines[18] = lines[2];
            lines[19] = lines[10];

            lines[20] = lines[4];
            lines[21] = lines[12];

            lines[22] = lines[6];
            lines[23] = lines[14];

            // render lines
            device.VertexFormat = CustomVertex.PositionColored.Format;
            device.Indices = null;
            device.DrawUserPrimitives(PrimitiveType.LineList, 12, lines);
        }