コード例 #1
0
ファイル: Frustum.cs プロジェクト: zdimension/FreeRaider
        public bool IsOBBVisible(OBB obb, Camera cam)
        {
            var ins = true;
            foreach (var p in obb.Polygons)
            {
                var t = p.Plane.Distance(cam.Position);
                if(t > 0.0 && IsPolyVisible(p, cam))
                {
                    return true;
                }
                if(ins && t > 0)
                {
                    ins = false;
                }
            }

            return ins;
        }
コード例 #2
0
ファイル: Render.cs プロジェクト: zdimension/FreeRaider
        public void DrawOBB(OBB obb)
        {
            var p = obb.Polygons;
            addLine(p[0].Vertices[0].Position, p[1].Vertices[0].Position);
            addLine(p[0].Vertices[1].Position, p[1].Vertices[3].Position);
            addLine(p[0].Vertices[2].Position, p[1].Vertices[2].Position);
            addLine(p[0].Vertices[3].Position, p[1].Vertices[1].Position);

            foreach (var po in p)
            {
                for (var j = 0; j < po.Vertices.Count - 1; j++)
                {
                    addLine(po.Vertices[j].Position, po.Vertices[j + 1].Position);
                }
                addLine(po.Vertices.Last().Position, po.Vertices.First().Position);
            }
        }
コード例 #3
0
ファイル: Entity.cs プロジェクト: zdimension/FreeRaider
        public Entity(uint id)
        {
            ID = id;
            MoveType = MoveType.OnFloor;
            Self = new EngineContainer();

            Transform = new Transform();
            Transform.SetIdentity();
            Self.Object = this;
            Self.ObjectType = OBJECT_TYPE.Entity;
            Self.Room = null;
            Self.CollisionType = COLLISION_TYPE.None;
            OBB = new OBB();
            OBB.Transform = Transform;
            Bt = new BtEntityData();
            Bt.BtBody = new List<RigidBody>();
            Bt.BtJoints = new List<TypedConstraint>();
            Bt.NoFixAll = false;
            Bt.NoFixBodyParts = 0x0000000;
            Bt.ManifoldArray = null;
            Bt.Shapes = new List<CollisionShape>();
            Bt.GhostObjects = new List<PairCachingGhostObject>();
            Bt.LastCollisions = new List<EntityCollisionNode>();

            Bf = new SSBoneFrame();
            Bf.Animations = new SSAnimation();
            Bf.Animations.Model = null;
            Bf.Animations.ClearOnFrame();
            Bf.Animations.FrameTime = 0.0f;
            Bf.Animations.LastState = TR_STATE.LaraWalkForward;
            Bf.Animations.NextState = TR_STATE.LaraWalkForward;
            Bf.Animations.Lerp = 0.0f;
            Bf.Animations.CurrentAnimation = TR_ANIMATION.LaraRun;
            Bf.Animations.CurrentFrame = 0;
            Bf.Animations.NextAnimation = TR_ANIMATION.LaraRun;
            Bf.Animations.NextFrame = 0;
            Bf.Animations.Next = null;
            Bf.BoneTags = new List<SSBoneTag>();
            Bf.BBMax = Vector3.Zero;
            Bf.BBMin = Vector3.Zero;
            Bf.Centre = Vector3.Zero;
            Bf.Position = Vector3.Zero;
            Speed = Vector3.Zero;
        }