Пример #1
0
        private void doCreateQuadtreeDebugBox(QuadtreeNode node, List <TgcDebugBox> debugBoxes,
                                              float boxLowerX, float boxLowerY, float boxLowerZ,
                                              float boxUpperX, float boxUpperY, float boxUpperZ, int step)
        {
            QuadtreeNode[] children = node.children;

            float midX = FastMath.Abs((boxUpperX - boxLowerX) / 2);
            float midZ = FastMath.Abs((boxUpperZ - boxLowerZ) / 2);

            //Crear caja debug
            TgcDebugBox box = createDebugBox(boxLowerX, boxLowerY, boxLowerZ, boxUpperX, boxUpperY, boxUpperZ, step);

            debugBoxes.Add(box);

            //es hoja, dibujar caja
            if (children == null)
            {
            }

            //recursividad sobre hijos
            else
            {
                step++;

                //000
                doCreateQuadtreeDebugBox(children[0], debugBoxes, boxLowerX + midX, boxLowerY, boxLowerZ + midZ, boxUpperX, boxUpperY, boxUpperZ, step);
                //001
                doCreateQuadtreeDebugBox(children[1], debugBoxes, boxLowerX + midX, boxLowerY, boxLowerZ, boxUpperX, boxUpperY, boxUpperZ - midZ, step);

                //100
                doCreateQuadtreeDebugBox(children[2], debugBoxes, boxLowerX, boxLowerY, boxLowerZ + midZ, boxUpperX - midX, boxUpperY, boxUpperZ, step);
                //101
                doCreateQuadtreeDebugBox(children[3], debugBoxes, boxLowerX, boxLowerY, boxLowerZ, boxUpperX - midX, boxUpperY, boxUpperZ - midZ, step);
            }
        }
Пример #2
0
        public override void Init()
        {
            //Crear caja debug vacia
            debugBox = new TgcDebugBox();

            //Modifiers para vararis sus parametros
            Modifiers.addVertex3f("size", new Vector3(0, 0, 0), new Vector3(100, 100, 100), new Vector3(20, 20, 20));
            Modifiers.addVertex3f("position", new Vector3(-100, -100, -100), new Vector3(100, 100, 100),
                                  new Vector3(0, 0, 0));
            Modifiers.addFloat("thickness", 0.1f, 5, 0.2f);
            Modifiers.addColor("color", Color.BurlyWood);

            Camara = new TgcRotationalCamera(new Vector3(), 50f);
        }
Пример #3
0
        public override void init()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Crear caja debug vacia
            debugBox = new TgcDebugBox();

            //Modifiers para vararis sus parametros
            GuiController.Instance.Modifiers.addVertex3f("size", new Vector3(0, 0, 0), new Vector3(100, 100, 100), new Vector3(20, 20, 20));
            GuiController.Instance.Modifiers.addVertex3f("position", new Vector3(-100, -100, -100), new Vector3(100, 100, 100), new Vector3(0, 0, 0));
            GuiController.Instance.Modifiers.addFloat("thickness", 0.1f, 5, 0.2f);
            GuiController.Instance.Modifiers.addColor("color", Color.BurlyWood);

            GuiController.Instance.RotCamera.CameraDistance = 50;
        }
Пример #4
0
        private void doCreateKdTreeDebugBox(KdTreeNode node, List <TgcDebugBox> debugBoxes,
                                            float boxLowerX, float boxLowerY, float boxLowerZ,
                                            float boxUpperX, float boxUpperY, float boxUpperZ, int step)
        {
            KdTreeNode[] children = node.children;

            //Crear caja debug
            TgcDebugBox box = createDebugBox(boxLowerX, boxLowerY, boxLowerZ, boxUpperX, boxUpperY, boxUpperZ, step);

            debugBoxes.Add(box);

            //es hoja, dibujar caja
            if (children == null)
            {
            }

            //recursividad sobre hijos
            else
            {
                step++;

                float xCut = node.xCut;
                float yCut = node.yCut;
                float zCut = node.zCut;


                //000
                doCreateKdTreeDebugBox(children[0], debugBoxes, xCut, yCut, zCut, boxUpperX, boxUpperY, boxUpperZ, step);
                //001
                doCreateKdTreeDebugBox(children[1], debugBoxes, xCut, yCut, boxLowerZ, boxUpperX, boxUpperY, zCut, step);

                //010
                doCreateKdTreeDebugBox(children[2], debugBoxes, xCut, boxLowerY, zCut, boxUpperX, yCut, boxUpperZ, step);
                //011
                doCreateKdTreeDebugBox(children[3], debugBoxes, xCut, boxLowerY, boxLowerZ, boxUpperX, yCut, zCut, step);

                //100
                doCreateKdTreeDebugBox(children[4], debugBoxes, boxLowerX, yCut, zCut, xCut, boxUpperY, boxUpperZ, step);
                //101
                doCreateKdTreeDebugBox(children[5], debugBoxes, boxLowerX, yCut, boxLowerZ, xCut, boxUpperY, zCut, step);

                //110
                doCreateKdTreeDebugBox(children[6], debugBoxes, boxLowerX, boxLowerY, zCut, xCut, yCut, boxUpperZ, step);
                //111
                doCreateKdTreeDebugBox(children[7], debugBoxes, boxLowerX, boxLowerY, boxLowerZ, xCut, yCut, zCut, step);
            }
        }
Пример #5
0
        /// <summary>
        /// Crear meshes debug
        /// </summary>
        public void createDebugMeshes()
        {
            debugBoxes = new List <TgcDebugBox>();

            for (int x = 0; x < grid.GetUpperBound(0); x++)
            {
                for (int y = 0; y < grid.GetUpperBound(1); y++)
                {
                    for (int z = 0; z < grid.GetUpperBound(2); z++)
                    {
                        GrillaRegularNode node = grid[x, y, z];
                        TgcDebugBox       box  = TgcDebugBox.fromExtremes(node.BoundingBox.PMin, node.BoundingBox.PMax, Color.Red);

                        debugBoxes.Add(box);
                    }
                }
            }
        }
Пример #6
0
        /// <summary>
        ///     Crear meshes debug
        /// </summary>
        public void createDebugMeshes()
        {
            debugBoxes = new List <TgcDebugBox>();

            for (var x = 0; x < grid.GetUpperBound(0); x++)
            {
                for (var y = 0; y < grid.GetUpperBound(1); y++)
                {
                    for (var z = 0; z < grid.GetUpperBound(2); z++)
                    {
                        var node = grid[x, y, z];
                        var box  = TgcDebugBox.fromExtremes(node.BoundingBox.PMin, node.BoundingBox.PMax, Color.Red);

                        debugBoxes.Add(box);
                    }
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Construir caja debug
        /// </summary>
        private TgcDebugBox createDebugBox(float boxLowerX, float boxLowerY, float boxLowerZ,
                                           float boxUpperX, float boxUpperY, float boxUpperZ, int step)
        {
            //Determinar color y grosor según profundidad
            Color c;
            float thickness;

            switch (step)
            {
            case 0:
                c         = Color.Red;
                thickness = 4f;
                break;

            case 1:
                c         = Color.Violet;
                thickness = 3f;
                break;

            case 2:
                c         = Color.Brown;
                thickness = 2f;
                break;

            case 3:
                c         = Color.Gold;
                thickness = 1f;
                break;

            default:
                c         = Color.Orange;
                thickness = 0.5f;
                break;
            }

            //Crear caja Debug
            TgcDebugBox box = TgcDebugBox.fromExtremes(
                new Vector3(boxLowerX, boxLowerY, boxLowerZ),
                new Vector3(boxUpperX, boxUpperY, boxUpperZ),
                c, thickness);

            return(box);
        }