예제 #1
0
        public static CVertexArray CreateMutable(DatLoader.Entity.CVertexArray _vertexArray)
        {
            var vertexArray = new CVertexArray();

            vertexArray.VertexType = _vertexArray.VertexType;
            vertexArray.Vertices   = new Dictionary <ushort, SWVertex>();
            foreach (var kvp in _vertexArray.Vertices)
            {
                vertexArray.Vertices.Add(kvp.Key, CreateMutable(kvp.Value));
            }
            return(vertexArray);
        }
예제 #2
0
 public Polygon(DatLoader.Entity.Polygon polygon, DatLoader.Entity.CVertexArray vertexArray)
 {
     NegSurface   = polygon.NegSurface;
     NegUVIndices = polygon.NegUVIndices;
     NumPoints    = polygon.NumPts;
     PosSurface   = polygon.PosSurface;
     PosUVIndices = polygon.PosUVIndices;
     SidesType    = (CullMode)polygon.SidesType;
     Stippling    = polygon.Stippling;
     VertexIDs    = polygon.VertexIds;
     Vertices     = new List <Vertex>();
     foreach (var vertexIdx in VertexIDs)
     {
         Vertices.Add(new Vertex(vertexArray.Vertices[(ushort)vertexIdx]));
     }
     make_plane();
 }
예제 #3
0
        /// <summary>
        /// Constructs a polygon from the DAT file
        /// </summary>
        public Polygon(DatLoader.Entity.Polygon polygon, DatLoader.Entity.CVertexArray vertexArray)
        {
            NegSurface = polygon.NegSurface;
            //NegUVIndices = polygon.NegUVIndices;
            PosSurface = polygon.PosSurface;
            //PosUVIndices = polygon.PosUVIndices;
            SidesType = polygon.SidesType;
            Stippling = polygon.Stippling;
            VertexIDs = polygon.VertexIds;
            Vertices  = new List <Vertex>();
            foreach (var vertexIdx in VertexIDs)
            {
                Vertices.Add(VertexCache.Get(vertexArray.Vertices[(ushort)vertexIdx]));
            }

            make_plane();
        }
예제 #4
0
파일: BSPNode.cs 프로젝트: jacobtipp/trACE
 public BSPNode(DatLoader.Entity.BSPNode node, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray)
 {
     if (node.Sphere != null)
     {
         Sphere = new Sphere(node.Sphere);
     }
     if (node.SplittingPlane != null)
     {
         SplittingPlane = node.SplittingPlane.ToNumerics();
     }
     Typename = node.Type;
     //Typename
     if (node.InPolys != null)
     {
         NumPolys = node.InPolys.Count;
         PolyIDs  = node.InPolys;
         Polygons = new List <Polygon>(node.InPolys.Count);
         foreach (var poly in node.InPolys)
         {
             Polygons.Add(PolygonCache.Get(polys[poly], vertexArray));
         }
     }
     if (node.PosNode != null)
     {
         if (!(node.PosNode is DatLoader.Entity.BSPLeaf))
         {
             PosNode = new BSPNode(node.PosNode, polys, vertexArray);
         }
         else // portal?
         {
             PosNode = new BSPLeaf((DatLoader.Entity.BSPLeaf)node.PosNode, polys, vertexArray);
         }
     }
     if (node.NegNode != null)
     {
         if (!(node.NegNode is DatLoader.Entity.BSPLeaf))
         {
             NegNode = new BSPNode(node.NegNode, polys, vertexArray);
         }
         else // portal?
         {
             NegNode = new BSPLeaf((DatLoader.Entity.BSPLeaf)node.NegNode, polys, vertexArray);
         }
     }
 }
예제 #5
0
 public BSPLeaf(DatLoader.Entity.BSPLeaf node, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray)
     : base(node, polys, vertexArray)
 {
     LeafIdx = node.LeafIndex;
     Solid   = node.Solid == 1;
 }
예제 #6
0
 public BSPTree(DatLoader.Entity.BSPTree bsp, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray)
 {
     RootNode = new BSPNode(bsp.RootNode, polys, vertexArray);
 }
예제 #7
0
        public static BSPTree Get(DatLoader.Entity.BSPTree _bspTree, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray)
        {
            var bspTree = new BSPTree(_bspTree, polys, vertexArray);

            if (!Enabled)
            {
                return(bspTree);
            }

            return(Get(bspTree));
        }
예제 #8
0
파일: BSPCache.cs 프로젝트: paroxysmal/ACE
 public static BSPTree Get(DatLoader.Entity.BSPTree bspTree, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray)
 {
     return(Get(new BSPTree(bspTree, polys, vertexArray)));
 }