示例#1
0
        public void drawEverything()
        {
            if (Globals.renderCollisionMap)
            {
                collision.drawCollisionMap(false);
            }
            else
            {
                AreaModel.drawModel(Vector3.One, Quaternion.Identity, Vector3.Zero);
            }

            for (int i = 0; i < Objects.Count; i++)
            {
                Object3D obj   = Objects[i];
                Vector3  scale = Vector3.One;
                // Need to slighting increase the model's size, just in-case of overlapping bounding boxes.
                if (isObjectSelected(0, i))
                {
                    scale = new Vector3(1.001f, 1.001f, 1.001f);
                }
                Quaternion rotation = new Quaternion(obj.xRot, obj.yRot, obj.zRot, 1.0f);
                Vector3    position = new Vector3(obj.xPos, obj.yPos, obj.zPos);
                if (obj.ModelID != 0 && parent.ModelIDs.ContainsKey(obj.ModelID))
                {
                    Model3D model = parent.ModelIDs[obj.ModelID];
                    if (Globals.drawObjectModels)
                    {
                        model.drawModel(scale, rotation, position);
                    }
                    BoundingBox.draw(scale, rotation, position,
                                     isObjectSelected(0, i) ? Globals.SelectedObjectColor : Globals.ObjectColor,
                                     model.UpperBoundary + boundOff, model.LowerBoundary - boundOff);
                }
                else
                {
                    BoundingBox.draw(scale, rotation, position,
                                     isObjectSelected(0, i) ? Globals.SelectedObjectColor : Globals.ObjectColor,
                                     new Vector3(150.0f, 150.0f, 150.0f),
                                     new Vector3(-150.0f, -150.0f, -150.0f));
                }
            }
            for (int i = 0; i < MacroObjects.Count; i++)
            {
                Object3D   obj      = MacroObjects[i];
                Vector3    scale    = Vector3.One;
                Quaternion rotation = new Quaternion(obj.xRot, obj.yRot, obj.zRot, 1.0f);
                Vector3    position = new Vector3(obj.xPos, obj.yPos, obj.zPos);
                if (obj.ModelID != 0 && parent.ModelIDs.ContainsKey(obj.ModelID))
                {
                    Model3D model = parent.ModelIDs[obj.ModelID];
                    if (Globals.drawObjectModels)
                    {
                        model.drawModel(scale, rotation, position);
                    }
                    BoundingBox.draw(scale, rotation, position,
                                     isObjectSelected(1, i) ? Globals.SelectedObjectColor : Globals.MacroObjectColor,
                                     model.UpperBoundary + boundOff, model.LowerBoundary - boundOff);
                }
                else
                {
                    BoundingBox.draw(scale, rotation, position,
                                     isObjectSelected(1, i) ? Globals.SelectedObjectColor : Globals.MacroObjectColor,
                                     new Vector3(150.0f, 150.0f, 150.0f),
                                     new Vector3(-150.0f, -150.0f, -150.0f));
                }
            }
            for (int i = 0; i < SpecialObjects.Count; i++)
            {
                Object3D   obj      = SpecialObjects[i];
                Vector3    scale    = Vector3.One;
                Quaternion rotation = new Quaternion(obj.xRot, obj.yRot, obj.zRot, 1.0f);
                Vector3    position = new Vector3(obj.xPos, obj.yPos, obj.zPos);
                if (obj.ModelID != 0 && parent.ModelIDs.ContainsKey(obj.ModelID))
                {
                    Model3D model = parent.ModelIDs[obj.ModelID];
                    if (Globals.drawObjectModels)
                    {
                        model.drawModel(scale, rotation, position);
                    }
                    BoundingBox.draw(scale, rotation, position,
                                     isObjectSelected(2, i) ? Globals.SelectedObjectColor : Globals.SpecialObjectColor,
                                     model.UpperBoundary + boundOff, model.LowerBoundary - boundOff);
                }
                else
                {
                    BoundingBox.draw(scale, rotation, position,
                                     isObjectSelected(2, i) ? Globals.SelectedObjectColor : Globals.SpecialObjectColor,
                                     new Vector3(150.0f, 150.0f, 150.0f),
                                     new Vector3(-150.0f, -150.0f, -150.0f));
                }
            }
        }