Example #1
0
 internal TargetGroupFactory(DistinctTargetGroupTuple groupTuple, CraftFactory craft)
 {
     Id                 = groupTuple.id;
     Type               = groupTuple.type;
     Location           = groupTuple.location;
     Craft              = craft;
     targetPointFactory = new TargetPointFactory(craft, groupTuple);
 }
Example #2
0
        internal PartFactory(CraftFactory craft, NodeCollection shipPart)
        {
            Craft            = craft;
            ShipPart         = shipPart;
            hardpointFactory = new HardpointFactory(craft);

            // Fetch ship part top level data
            descriptor   = ShipPart.Children.OfType <PartDescriptor <Vector3> >().First();
            rotationInfo = ShipPart.Children.OfType <RotationInfo <Vector3> >().First();
            verts        = ShipPart.OfType <MeshVertices <Vector3> >().First();
            vertUV       = ShipPart.OfType <VertexUV <Vector2> >().First();
            vertNormals  = ShipPart.OfType <VertexNormals <Vector3> >().First();

            // All meshes are contained inside of a MeshLod
            // There is only one MeshLod per part.
            // Each LOD is BranchNode containing a collection of meshes and textures it uses.
            var lodNode = ShipPart.OfType <LodCollection>().First();

            _lods = new List <LodFactory>();
            int newLodIndex = 0;

            for (int i = 0; i < lodNode.MaxRenderDistance.Count; i++)
            {
                float distance = lodNode.MaxRenderDistance[i];

                // Out of order LODs are probably broken.  See TIE98 CAL.OPT.
                // If this distance is greater than the previous distance (smaller number means greater render distance),
                // then this LOD is occluded by the previous LOD.
                if (distance > 0 && i > 0 && distance > lodNode.MaxRenderDistance[i - 1])
                {
                    continue;
                }

                if (lodNode.Children[i] is NodeCollection branch)
                {
                    _lods.Add(new LodFactory(this, branch, newLodIndex, distance));
                    newLodIndex++;
                }
                else
                {
                    Debug.LogError("Skipping LOD" + newLodIndex + " as it is not a NodeCollection");
                }
            }
        }
Example #3
0
 internal HardpointFactory(CraftFactory part)
 {
     Craft = part;
 }
Example #4
0
 internal TargetPointFactory(CraftFactory craft, DistinctTargetGroupTuple groupTuple)
 {
     Craft      = craft;
     GroupTuple = groupTuple;
 }