コード例 #1
0
ファイル: Block.cs プロジェクト: slagusev/glueeengine
        /*
         * 1-----2
         * /|    /|
         * / |   / |
         * 5-----4  |
         |  0--|--3
         | /   | /
         |/    |/
         | 6-----7
         */
        public Block(AxisAlignedBox box)
        {
            this.surfacesMap = new Dictionary <string, List <Surface> >();
            this.vertices    = new List <Vector3>(box.GetAllCorners());

            this.AddSurface(new Surface("floor", 5, 4, 2, 1)); // top
            this.AddSurface(new Surface("roof", 6, 0, 3, 7));  // bottom
            this.AddSurface(new Surface("wall", 0, 1, 2, 3));  // back
            this.AddSurface(new Surface("wall", 7, 4, 5, 6));  // front
            this.AddSurface(new Surface("wall", 3, 2, 4, 7));  // right
            this.AddSurface(new Surface("wall", 6, 5, 1, 0));  // left

            this.edgeList.Add(new Edge(0, 1));
            this.edgeList.Add(new Edge(1, 2));
            this.edgeList.Add(new Edge(2, 3));
            this.edgeList.Add(new Edge(3, 0));
            this.edgeList.Add(new Edge(5, 1));
            this.edgeList.Add(new Edge(4, 2));
            this.edgeList.Add(new Edge(7, 3));
            this.edgeList.Add(new Edge(6, 0));
            this.edgeList.Add(new Edge(5, 4));
            this.edgeList.Add(new Edge(4, 7));
            this.edgeList.Add(new Edge(7, 6));
            this.edgeList.Add(new Edge(6, 5));

            this.centre = box.Center;
        }
コード例 #2
0
ファイル: Block.cs プロジェクト: slagusev/glueeengine
        private void Update(AxisAlignedBox box)
        {
            this.vertices = new List <Vector3>(box.GetAllCorners());
            this.centre   = box.Center;
            this.solidObject.BoundingBox = box;
            this.wireObject.BoundingBox  = box;

            DrawSolid(true);
            DrawWire(true);
        }
コード例 #3
0
ファイル: ResizableBox.cs プロジェクト: slagusev/glueeengine
        private void Draw(bool update)
        {
            this.corners = box.GetAllCorners();

            /*
             *     1-----2
             *    /|    /|
             *   / |   / |
             *  5-----4  |
             |  0--|--3
             | /   | /
             |/    |/
             |  6-----7
             */
            // draw the wire box
            string      material = "Editor/SelectionBox";
            ColourValue colour   = ColourValue.White;

            // draw the outline
            if (update)
            {
                this.wireBox.BeginUpdate(0);
            }
            else
            {
                this.wireBox.Begin(material, RenderOperation.OperationTypes.OT_LINE_LIST);
            }

            DrawLine(this.wireBox, indices[0], indices[1], colour);
            DrawLine(this.wireBox, indices[1], indices[2], colour);
            DrawLine(this.wireBox, indices[2], indices[3], colour);
            DrawLine(this.wireBox, indices[3], indices[0], colour);
            this.wireBox.End();

            // draw the mouse grips
            UpdateMouseGrips();

            if (update)
            {
                this.wireBox.BeginUpdate(1);
            }
            else
            {
                this.wireBox.Begin(material, RenderOperation.OperationTypes.OT_POINT_LIST);
            }

            foreach (Vector3 grip in mouseGrips)
            {
                this.wireBox.Position(grip);
            }

            this.wireBox.End();
        }
コード例 #4
0
        private void UpdateWireBox()
        {
            if (this.wireBox == null)
            {
                this.wireBox                 = Engine.Graphics.SceneManager.CreateManualObject();
                this.wireBox.Dynamic         = true;
                this.wireBox.QueryFlags      = 0;
                this.wireBox.VisibilityFlags = ViewportController.VF_PERSPECTIVE;

                Engine.Graphics.SceneManager.RootSceneNode.AttachObject(wireBox);
                this.wireBox.Begin("BaseWhiteNoLighting", RenderOperation.OperationTypes.OT_LINE_LIST);
            }
            else
            {
                this.wireBox.BeginUpdate(0);
            }

            Vector3[] corners = box.GetAllCorners();
            this.wireBox.Position(corners[0]);  // back quad
            this.wireBox.Position(corners[1]);
            this.wireBox.Position(corners[1]);
            this.wireBox.Position(corners[2]);
            this.wireBox.Position(corners[2]);
            this.wireBox.Position(corners[3]);
            this.wireBox.Position(corners[3]);
            this.wireBox.Position(corners[0]);

            this.wireBox.Position(corners[0]);  // back to front lines
            this.wireBox.Position(corners[6]);
            this.wireBox.Position(corners[1]);
            this.wireBox.Position(corners[5]);
            this.wireBox.Position(corners[2]);
            this.wireBox.Position(corners[4]);
            this.wireBox.Position(corners[3]);
            this.wireBox.Position(corners[7]);

            this.wireBox.Position(corners[7]);  // front quad
            this.wireBox.Position(corners[6]);
            this.wireBox.Position(corners[6]);
            this.wireBox.Position(corners[5]);
            this.wireBox.Position(corners[5]);
            this.wireBox.Position(corners[4]);
            this.wireBox.Position(corners[4]);
            this.wireBox.Position(corners[7]);
            this.wireBox.End();
        }