Exemplo n.º 1
0
 internal TargetGroupFactory(DistinctTargetGroupTuple groupTuple, CraftFactory craft)
 {
     Id                 = groupTuple.id;
     Type               = groupTuple.type;
     Location           = groupTuple.location;
     Craft              = craft;
     targetPointFactory = new TargetPointFactory(craft, groupTuple);
 }
Exemplo n.º 2
0
        internal bool Equals(DistinctTargetGroupTuple other)
        {
            if (other.GetType() != this.GetType())
            {
                return(false);
            }

            return(this.id == other.id && this.type == other.type && this.location == other.location);
        }
Exemplo n.º 3
0
        private void CraftFactoryImpl()
        {
            // Determine total size of the craft.  Used for LOD size.
            bool    foundDescriptor = false;
            Vector3 upperBound      = new Vector3(); // upper bound
            Vector3 lowerBound      = new Vector3(); // lower bound

            foreach (var descriptor in Opt.OfType <PartDescriptor <Vector3> >())
            {
                var huc = descriptor.HitboxUpperCorner;
                var hlc = descriptor.HitboxLowerCorner;
                // In case origin is outside of all hitbox demensions,
                // set the bounds based on first hitbox found and expand from there.
                if (foundDescriptor)
                {
                    upperBound = Vector3.Max(upperBound, huc);
                    lowerBound = Vector3.Min(lowerBound, hlc);
                }
                else
                {
                    upperBound      = new Vector3(huc.x, huc.y, huc.z);
                    lowerBound      = new Vector3(hlc.x, hlc.y, hlc.z);
                    foundDescriptor = true;
                }
            }

            if (foundDescriptor)
            {
                Size = (upperBound - lowerBound).magnitude;
            }
            else
            {
                // TODO: Vertex based size calculation
                Size = float.PositiveInfinity;
            }

            foreach (NodeCollection shipPart in Opt.RootNodes.OfType <NodeCollection>())
            {
                var factory = new PartFactory(this, shipPart);

                if (null == factory.descriptor || null == TargetingGroupBase)
                {
                    nonTargetGroupedParts.Add(factory);
                    factory.CreateChildTarget = true;
                }
                else
                {
                    var groupTuple = new DistinctTargetGroupTuple(factory.descriptor);

                    if (targetGroups.TryGetValue(groupTuple, out TargetGroupFactory group))
                    {
                        group.Add(factory);
                    }
                    else
                    {
                        group = new TargetGroupFactory(groupTuple, this);
                        group.Add(factory);
                        targetGroups.Add(groupTuple, group);
                    }
                }
            }

            textures     = Opt.OfType <XWOpt.OptNode.Texture>().ToList();
            TextureAtlas = new TextureAtlas(textures, PartShader, "OPT Craft Atlas", Opt.Version, makeEmissiveTexture ? emissiveExponent : (float?)null);
        }
Exemplo n.º 4
0
 internal TargetPointFactory(CraftFactory craft, DistinctTargetGroupTuple groupTuple)
 {
     Craft      = craft;
     GroupTuple = groupTuple;
 }