예제 #1
0
 public BoxBlocker()
 {
     Vector3 minPoint = new Vector3(-1, -1, 0);
     Vector3 maxPoint = new Vector3(1, 1, 2);
     MainGraphic = new MetaModel
     {
         XMesh = new MeshConcretize
         {
             MeshDescription =
                 new global::Graphics.Software.Meshes.BoxMesh(minPoint, maxPoint, Facings.Frontside, false),
             Layout = global::Graphics.Software.Vertex.PositionNormalTexcoord.Instance
         },
         HasAlpha = true,
         Texture = new TextureFromFile("Models/Effects/Blue1.png"),
         ReceivesAmbientLight = Priority.Never,
         ReceivesDiffuseLight = Priority.Never,
     };
     PickingLocalBounding = VisibilityLocalBounding = new MetaBoundingBox
     {
         Mesh = ((MetaModel)MainGraphic).XMesh,
         Transformation = ((MetaModel)MainGraphic).World
     };
     //PhysicsLocalBounding = CreatePhysicsMeshBounding((MetaModel)MainGraphic);
     PhysicsLocalBounding = new Common.Bounding.Box { LocalBoundingBox = new BoundingBox(minPoint, maxPoint) };
 }
예제 #2
0
        public Altar1()
        {
            MainGraphic = new MetaModel
            {
                XMesh = new MeshFromFile("Models/Props/Altar1.x"),
                Texture = new TextureFromFile("Models/Props/Wall1.png"),
                SpecularTexture = new TextureFromFile("Models/Props/WallSpecular1.png"),
                World = Matrix.Scaling(0.1f, 0.1f, 0.1f) * SkinnedMesh.InitSkinnedMeshFromMaya,
                CastShadows = global::Graphics.Content.Priority.High,
                ReceivesShadows = Priority.High,
                ReceivesSpecular = Priority.High,
                SpecularExponent = 6,
            };

            VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic);
            PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic);
            PhysicsLocalBounding = new Common.Bounding.Box { LocalBoundingBox = new BoundingBox(new Vector3(-0.89f, -1.49f, -0.25f), new Vector3(0.89f, 1.49f, 1.54f)) };
            EditorRandomRotation = true;
            MaxHitPoints = HitPoints = 2000;
        }
 public void Draw(Matrix world, Common.Bounding.Box bounding, Color color)
 {
     View.Draw3DAABB(camera, world * bounding.Transformation, bounding.LocalBoundingBox.Minimum, bounding.LocalBoundingBox.Maximum, color);
     Draw(world, bounding.ToContainerBox(), Color.Purple);
 }
예제 #4
0
        public Cart1()
        {
            MainGraphic = new MetaModel
            {
                XMesh = new MeshFromFile("Models/Props/Cart1.x"),
                Texture = new TextureFromFile("Models/Props/Cart1.png"),
                SpecularTexture = new TextureFromFile("Models/Props/CartSpecular1.png"),
                World = Matrix.Scaling(0.14f, 0.14f, 0.14f) * SkinnedMesh.InitSkinnedMeshFromMaya,
                AlphaRef = 254,
                Visible = Priority.High,
                CastShadows = global::Graphics.Content.Priority.Medium,
                ReceivesShadows = Priority.High,
                ReceivesSpecular = Priority.Low,
            };

            VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic);
            PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic);
            PhysicsLocalBounding = new Common.Bounding.Box { LocalBoundingBox = new BoundingBox(new Vector3(-1.40f, -1.17f, -0.37f), new Vector3(1.07f, 0.78f, 0.95f)), Transformation = Matrix.Translation(0.10f, 0.10f, 0) };
            EditorRandomRotation = true;
        }
예제 #5
0
 public WallEnd1()
 {
     MainGraphic = new MetaModel
     {
         XMesh = new MeshFromFile("Models/Props/WallEnd1.x"),
         Texture = new TextureFromFile("Models/Props/WallEnd1.png"),
         SpecularTexture = new TextureFromFile("Models/Props/WallendSpecular1.png"),
         World = Matrix.Scaling(0.09f, 0.09f, 0.09f) * SkinnedMesh.InitSkinnedMeshFromMaya,
         Visible = Priority.High,
         CastShadows = global::Graphics.Content.Priority.High,
         ReceivesShadows = Priority.High,
         ReceivesSpecular = Priority.High,
         SpecularExponent = 6,
     };
     VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic);
     PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic);
     PhysicsLocalBounding = new Common.Bounding.Box { LocalBoundingBox = new BoundingBox(new Vector3(-0.69f, -0.68f, -1.29f), new Vector3(0.69f, 0.68f, 4.62f)) };
     EditorRandomRotation = true;
 }
예제 #6
0
        public Bench2()
        {
            MainGraphic = new MetaModel
            {
                XMesh = new MeshFromFile("Models/Props/Bench2.x"),
                Texture = new TextureFromFile("Models/Props/Bench1.png"),
                SpecularTexture = new TextureFromFile("Models/Props/BenchSpecular1.png"),
                World = Matrix.Scaling(0.13f, 0.13f, 0.13f) * SkinnedMesh.InitSkinnedMeshFromMaya,
                Visible = Priority.High,
                CastShadows = global::Graphics.Content.Priority.Medium,
                ReceivesShadows = Priority.High,
                ReceivesSpecular = Priority.Medium,
            };

            VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic);
            PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic);
            PhysicsLocalBounding = new Common.Bounding.Box { LocalBoundingBox = new BoundingBox(new Vector3(-1.05f, -0.15f, -0.48f), new Vector3(1.05f, 0.76f, 1.14f)) };
            EditorPlacementLocalBounding = new Common.Bounding.Cylinder(Vector3.Zero, 3, 1.1f);
            EditorRandomRotation = true;
        }
예제 #7
0
        void UpdatePhysicsLocalBounding()
        {
            if (MainGraphic == null) return;

            #if GATE_LOCAL_BOUNDING_HACK
            if (State == UnitState.Alive)
            {
                PhysicsLocalBounding = CreatePhysicsMeshBounding(new MetaModel { XMesh = new MeshFromFile("Models/Props/GatePathmeshClosed1.x"), World = ((MetaModel)Graphic).World });
                UpdateMotionObject();
            }
            else
            {
                PhysicsLocalBounding = null;
                MotionObject = null;
            }
            #else
            MeshFromFile physicsMesh;
            if (State == UnitState.Alive)
                PhysicsLocalBounding = new Common.Bounding.Box { LocalBoundingBox = new BoundingBox(new Vector3(-0.47f, -1.62f, -0.42f), new Vector3(0.46f, 1.59f, 2.54f)) };
            else
            {
                physicsMesh = new MeshFromFile("Models/Props/GatePathmeshOpen1.x");
                PhysicsLocalBounding = CreatePhysicsMeshBounding(new MetaModel { XMesh = physicsMesh, World = ((MetaModel)MainGraphic).World });
            }
            #endif
        }
예제 #8
0
        public Fence4()
        {
            MainGraphic = new MetaModel
            {
                XMesh = new MeshFromFile("Models/Props/Fence4.x"),
                Texture = new TextureFromFile("Models/Props/Fence1.png"),
                World = Matrix.Scaling(0.14f, 0.14f, 0.18f) * SkinnedMesh.InitSkinnedMeshFromMaya,
                Visible = Priority.High,
                CastShadows = global::Graphics.Content.Priority.Medium,
                ReceivesShadows = Priority.High,
            };

            VisibilityLocalBounding = CreateBoundingBoxFromModel((MetaModel)MainGraphic);
            PickingLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic);
            PhysicsLocalBounding = new Common.Bounding.Box { LocalBoundingBox = new BoundingBox(new Vector3(-0.31f, -1.4f, -0.5f), new Vector3(0.31f, 1.4f, 0.9f)), Transformation = Matrix.Scaling(1, 1, 0.5f) };

            EditorPlacementLocalBounding = new Common.Bounding.Cylinder(Vector3.Zero, 3, 1f);
            EditorRandomRotation = true;
        }