Esempio n. 1
0
        private void DrawSubdivision(ref Matrix4 mvp, Vector3 min, Vector3 size, List <KCL.OctreeNode> modelOctrees, int subdiv)
        {
            var BoxSize     = size / 2f;
            var QuarterSize = BoxSize / 2f;

            int index = 0;

            for (int z = 0; z < 2; z++)
            {
                for (int y = 0; y < 2; y++)
                {
                    for (int x = 0; x < 2; x++)
                    {
                        var Boxmin = min + BoxSize * new Vector3(x, y, z);
                        var pos    = BoxSize * new Vector3(x, y, z);

                        if (modelOctrees[index].IsSelected)
                        {
                            DrawableBoundingBox.DrawBoundingBox(mvp, QuarterSize, Boxmin + QuarterSize, System.Drawing.Color.Red);
                        }
                        else
                        {
                            DrawableBoundingBox.DrawBoundingBox(mvp, QuarterSize, Boxmin + QuarterSize, System.Drawing.Color.Green);
                        }

                        if (modelOctrees[index].Nodes.Count > 0)
                        {
                            DrawSubdivision(ref mvp, Boxmin, BoxSize, modelOctrees[index].Children, subdiv++);
                        }

                        index++;
                    }
                }
            }
        }
        private void DrawBoundingBoxes()
        {
            var boundings = GetSelectionBox();

            DrawableBoundingBox.DrawBoundingBox(
                new Vector3(boundings.minX, boundings.minY, boundings.minZ),
                new Vector3(boundings.maxX, boundings.maxY, boundings.maxZ),
                new Vector3(0)
                );

            return;
        }