コード例 #1
0
        public BoxDrawCommand3D(BoundingBox box, Color color, float thickness, bool warp) :
            base(color)
        {
            BoundingBox = box;
            Matrix worldMatrix = Matrix.CreateScale(box.Max.X - box.Min.X, box.Max.Y - box.Min.Y, box.Max.Z - box.Min.Z);

            worldMatrix.Translation = box.Min;

            for (int i = 0; i < 4; i++)
            {
                Vector3[] points = warp ? VertexNoise.WarpPoints(BoxPoints[i], new Vector3(box.Max.X - box.Min.X, box.Max.Y - box.Min.Y, box.Max.Z - box.Min.Z), box.Min) : BoxPoints[i];

                int count = 0;

                List <VertexPositionColor> triangleStrip = Drawer3D.GetTriangleStrip(points, thickness, color, ref count, worldMatrix);
                _stripVertices.Add(new VertexPositionColor[triangleStrip.Count]);
                _stripTriangleCounts.Add(count);
                triangleStrip.CopyTo(_stripVertices[i]);
            }
        }