public FighterGeometry() { var nose = new Nose(0.5f, 0.6f, 26, 0.4f); var cockpitFuselage = new CockpitFuselage(nose, 1.2f, 1.2f, 3f); var mainFuselage = new MainFuselage(cockpitFuselage); var intake = new EngineIntake(cockpitFuselage); var underside = new Underside(intake); var canopy = new Canopy(0.65f, 0.5f, 3f, 16); var wing = new Wing(4.5f, 4.5f); var rear = new Rear(mainFuselage, underside); var tailFin = new TailFin(); var stabilizer = new Stabilizer(); var exhaust = new Exhaust(rear, 0.6f); var bottomFin = new BottomFin(); var path = exhaust.FlangeEndXSection; var graySlide = new Vec3(1f).Interpolate(new Vec3(0f), path.Vertices.Length); path.Vertices.Color(graySlide); Paths = EnumerableExt.Enumerate(path); Fighter = Composite.Create(Stacking.StackBackward(cockpitFuselage.Fuselage, mainFuselage.Fuselage) .Concat(EnumerableExt.Enumerate(intake.Intake, intake.Belly, underside.Geometry, canopy.Geometry, wing.Geometry, wing.Geometry.ReflectX(), rear.Geometry, exhaust.Geometry, exhaust.StabilizerFlange, exhaust.StabilizerFlange.ReflectX(), tailFin.Geometry, stabilizer.Geometry, stabilizer.Geometry.ReflectX(), bottomFin.Geometry, bottomFin.Geometry.ReflectX()))) .Smoothen(0.85f) .Center(); }
public MainFuselage(CockpitFuselage cockpitFuselage) { XSection = CrossSection( cockpitFuselage.XSectionStart.position, cockpitFuselage.XSection.Vertices.Furthest(Dir3D.Up).First().position.Y, cockpitFuselage.XSection.Vertices.Length); var transforms = from z in EnumerableExt.Range(0f, -2f, -0.25f) select Mat.Translation <Mat4> (0f, 0f, z); var paths = EnumerableExt.Append( cockpitFuselage.XSection.MorphTo(XSection, transforms), XSection.Translate(0f, 0f, -6.75f)); RearXSection = paths.Last(); Fuselage = paths.Extrude <V, P> (false, false) .Color(_color); }
public EngineIntake(CockpitFuselage cockpitFuselage) { var startNode = cockpitFuselage.XSectionStart; XSection = CrossSection(startNode.position, -cockpitFuselage.XSection.Vertices.Furthest(Dir3D.Up).First().position.Y, 20); var transforms = from s in EnumerableExt.Range(0.25f, 2f, 0.25f) let scaleFactor = 1f + (0.2f * s.Pow(0.5f)) select Mat.Translation <Mat4> (0f, 0f, -s) * Mat.Scaling <Mat4> (scaleFactor, scaleFactor, 1f) .RelativeTo(new Vec3(0f, startNode.position.Y, 0f)); Intake = XSection .Inset <P, V> (0.9f, 0.9f) .Stretch(transforms, true, false) .Color(_color); RearXSection = XSection.Transform(transforms.Last()); BellyXSection = Path <P, Vec3> .FromVecs( from v in cockpitFuselage.Fuselage.Vertices.Furthest (Dir3D.Back) where v.position.Y < -0.1f select v.position); var scalePoint = new Vec3(0f, BellyXSection.Vertices.First().position.Y, 0f); Belly = EnumerableExt.Enumerate(BellyXSection, BellyXSection.Transform(Mat.Translation <Mat4> (0f, 0f, -1f) * Mat.Scaling <Mat4> (1.45f, 1f, 1f).RelativeTo(scalePoint)), BellyXSection.Transform(Mat.Translation <Mat4> (0f, 0f, -2f) * Mat.Scaling <Mat4> (1.9f, 1.25f, 1f).RelativeTo(scalePoint)), BellyXSection.Transform(Mat.Translation <Mat4> (0f, 0f, -3f) * Mat.Scaling <Mat4> (1.9f, 1.3f, 1f).RelativeTo(scalePoint))) .Extrude <V, P> (false, false) .Color(_color); }