Exemple #1
0
        /// <summary>Gets a list of all triangles in view.</summary>
        /// <param name="camera">The camera to test against.</param>
        /// <returns>A list of all triangles in view.</returns>
        public List<VertexPositionTexture> getTriangles(Camera camera)
        {
            if (Triangles == null)
                return new List<VertexPositionTexture>(0);

            List<VertexPositionTexture> tris = new List<VertexPositionTexture>(Triangles.Length);

            Vector2[] tri = new Vector2[3];

            for (int i = 0; i < Triangles.Length; i += 3)
            {
                int i1 = i + 1;
                int i2 = i + 2;

                Vector3 tri0 = Triangles[i];
                Vector3 tri1 = Triangles[i1];
                Vector3 tri2 = Triangles[i2];

                // if triangle is in view of camera, add it
                /*if (camera.inView(tri0)
                    || camera.inView(tri1)
                    || camera.inView(tri2))*/
                {
                    tris.AddRange(new VertexPositionTexture[]
                    {
                        new VertexPositionTexture(camera.worldToScreenDraw(tri0), TexCoords[i]),
                        new VertexPositionTexture(camera.worldToScreenDraw(tri1), TexCoords[i1]),
                        new VertexPositionTexture(camera.worldToScreenDraw(tri2), TexCoords[i2])
                    });
                }
            }

            return tris;
        }
Exemple #2
0
 /// <summary>Resets all members to their default values.</summary>
 public void clear()
 {
     Script = new ScriptMan(this);
     EditorMode = false;
     Players = new List<Player>();
     PlayerActions = new List<PlayerAction>();
     SegEvents = new List<Dictionary<string, WorldEvent.EventType>>();
     NodeEvents = new List<Dictionary<string, WorldEvent.EventType>>();
     EventsToSend = new List<WorldEvent>();
     Nodes = new List<Node>();
     Segments = new List<Segment>();
     Geos = new List<Geo>();
     Hotspots = new List<Hotspot>();
     NodeTypes = new List<NodeType>();
     PlayerByID = new Dictionary<string, Player>();
     NodeByID = new Dictionary<string, Node>();
     SegByID = new Dictionary<string, Segment>();
     GeoByID = new Dictionary<string, Geo>();
     HotspotByID = new Dictionary<string, Hotspot>();
     NodeTypeByID = new Dictionary<string, NodeType>();
     NextPlayerID = 0L;
     NextNodeID = 0L;
     NextSegID = 0L;
     NextGeoID = 0L;
     NextHotspotID = 0L;
     NextNodeTypeID = 0L;
     Cam = new Camera();
     Collision = new CollisionManager();
     Grid = null;
     CurTime = new GameTime();
     Size = new VectorF((FInt)1000);
     PersonSpacing = (FInt)20;
     PersonSpeedLower = (FInt)50;
     PersonSpeedUpper = (FInt)200;
     RetractSpeed = (FInt)90;
     BuildRate = (FInt)10;
     FogRows = 1;
     FogCols = 1;
     PathRows = 1;
     PathCols = 1;
     ScriptBeginUpdate = string.Empty;
     FrontEndActions = new Queue<FrontEndAction>();
 }