Commit MetaInfo

Révision7a010f96b65cbcfeaff66038c9f455e8a16e79ef (tree)
l'heure2007-06-12 02:03:05
Auteurface__
Commiterface__

Message de Log

[svn r33] Some more vessel and oapi-function in order to make the DeltaGlider airborne.

Change Summary

Modification

diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Commons.cs
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Commons.cs Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Commons.cs Mon Jun 11 19:03:05 2007 +0200
@@ -130,16 +130,10 @@
130130 }
131131 }
132132
133- public class ParticleStreamLevelReference
133+ public class DoublePointer
134134 {
135- private IntPtr streamHandle;
136135 private IntPtr native;
137-
138- public IntPtr StreamHandle
139- {
140- get { return streamHandle; }
141- }
142-
136+
143137 public double Level
144138 {
145139 get
@@ -159,19 +153,18 @@
159153 get { return native; }
160154 }
161155
162- public ParticleStreamLevelReference(IntPtr streamHandle)
156+ public DoublePointer()
163157 {
164- this.streamHandle = streamHandle;
165158 native = Marshal.AllocHGlobal(sizeof (double));
166159 Marshal.DestroyStructure(native, typeof(double));
167160 }
168161
169- ~ParticleStreamLevelReference()
162+ ~DoublePointer()
170163 {
171164 Marshal.FreeHGlobal(native);
172165 }
173166 }
174-
167+
175168 /// <summary>
176169 /// Planetary atmospheric constants
177170 /// </summary>
@@ -234,10 +227,13 @@
234227 }
235228
236229 /// <summary>
237- /// vessel beacon light parameters
230+ /// *********************************************************************************************************************
231+ /// vessel beacon light parameters TODO: CREATE CLASSES INSTEAD OF STRUCTS IN ORDER TO ALLOW PROPERTY-MARSHALLING!!!!
232+ /// *********************************************************************************************************************
238233 /// </summary>
239234 public struct BeaconLightSpecification
240235 {
236+ public IntPtr Native;
241237 /// <summary>
242238 /// beacon texture identifier
243239 /// </summary>
@@ -277,6 +273,7 @@
277273
278274 public BeaconLightSpecification(uint shape, Vector3 position, Vector3 color, double size, double fallOff, double period, double duration, double timeOffset, bool active)
279275 {
276+ Native = IntPtr.Zero;
280277 Shape = shape;
281278 Position = position;
282279 Color = color;
@@ -336,10 +333,10 @@
336333 public delegate double LiftCoefficientDelegate(double angleOfAttack);
337334
338335 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
339- public delegate void AirFoilCoefficientDelegate(double angleOfAttack, double mach, double reynolds, IntPtr LiftCoefficientDoublePointer, IntPtr MomentCoefficientDoublePointer, IntPtr DragCoefficientDoublePointer);
336+ public delegate void AirFoilCoefficientDelegate(double angleOfAttack, double mach, double reynolds, IntPtr liftCoefficientDoublePointer, IntPtr momentCoefficientDoublePointer, IntPtr dragCoefficientDoublePointer);
340337
341338 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
342- public delegate void AirFoilCoefficientExDelegate(double angleOfAttack, double mach, double reynolds, IntPtr contextVoidPointer, IntPtr LiftCoefficientDoublePointer, IntPtr MomentCoefficientDoublePointer, IntPtr DragCoefficientDoublePointer);
339+ public delegate void AirFoilCoefficientExDelegate(double angleOfAttack, double mach, double reynolds, IntPtr contextVoidPointer, IntPtr liftCoefficientDoublePointer, IntPtr momentCoefficientDoublePointer, IntPtr dragCoefficientDoublePointer);
343340
344341 public enum ThrusterGroup
345342 {
@@ -366,4 +363,14 @@
366363 Vertical,
367364 Horizontal,
368365 }
366+
367+ public enum ControlSurface
368+ {
369+ Elevator,
370+ Rudder,
371+ Aileron,
372+ Flap,
373+ ElevatorTrim,
374+ RudderTrim,
375+ }
369376 }
diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Constants.cs
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Constants.cs Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Constants.cs Mon Jun 11 19:03:05 2007 +0200
@@ -14,5 +14,19 @@
1414 public const double G = 9.81; // gravitational acceleration [m/s^2] at Earth mean radius
1515 public const double ATMP = 101.4e3; // atmospheric pressure [Pa] at Earth sea level
1616 public const double ATMD = 1.293; // atmospheric density [kg/m^3] at Earth sea level
17+ public const int AIRCTRL_AXIS_AUTO = 0;
18+ public const int AIRCTRL_AXIS_YPOS = 1;
19+ public const int AIRCTRL_AXIS_YNEG = 2;
20+ public const int AIRCTRL_AXIS_XPOS = 3;
21+ public const int AIRCTRL_AXIS_XNEG = 4;
22+ public const uint BEACONSHAPE_COMPACT = 0;
23+ public const uint BEACONSHAPE_DIFFUSE = 1;
24+ public const uint BEACONSHAPE_STAR = 2;
25+ public const int MESHVIS_NEVER = 0x00;
26+ public const int MESHVIS_EXTERNAL = 0x01;
27+ public const int MESHVIS_COCKPIT = 0x02;
28+ public const int MESHVIS_ALWAYS = (MESHVIS_EXTERNAL|MESHVIS_COCKPIT);
29+ public const int MESHVIS_VC = 0x04;
30+ public const int MESHVIS_EXTPASS = 0x10;
1731 }
1832 }
diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Vessel.cs
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Vessel.cs Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Vessel.cs Mon Jun 11 19:03:05 2007 +0200
@@ -182,5 +182,14 @@
182182 /// <remarks>This is not a native Orbiter function. It is used for marshalling managed context in
183183 /// airfoil coefficient functions.</remarks>
184184 object GetAirFoilCoefficientFunctionContext (IntPtr key);
185+ void CreateControlSurface (ControlSurface type, double area, double liftCoefficientShift, Vector3 reference);
186+ void CreateControlSurface (ControlSurface type, double area, double liftCoefficientShift, Vector3 reference, int axis);
187+ void CreateControlSurface (ControlSurface type, double area, double liftCoefficientShift, Vector3 reference, int axis, uint animation);
188+ IntPtr CreateControlSurface2 (ControlSurface type, double area, double liftCoefficientShift, Vector3 reference);
189+ IntPtr CreateControlSurface2 (ControlSurface type, double area, double liftCoefficientShift, Vector3 reference, int axis);
190+ IntPtr CreateControlSurface2 (ControlSurface type, double area, double liftCoefficientShift, Vector3 reference, int axis, uint animation);
191+ void CreateVariableDragElement (DoublePointer drag, double factor, Vector3 reference);
192+ void SetMeshVisibilityMode (uint mesh, short mode);
193+ void AddBeacon(BeaconLightSpecification beacon);
185194 }
186195 }
diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/DeltaGlider.cs
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/DeltaGlider.cs Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/DeltaGlider.cs Mon Jun 11 19:03:05 2007 +0200
@@ -1,4 +1,5 @@
11 using System;
2+using System.Runtime.InteropServices;
23 using Orbiter.Interfaces;
34 using Orbiter.Wrapper;
45 using MeshGroupRotation=Orbiter.Interfaces.MeshGroupRotation;
@@ -352,15 +353,15 @@
352353 private DoorStatus radiator_status;
353354 private DoorStatus brake_status;
354355
355- private double nose_proc; // logical status
356+ private DoublePointer nose_proc; // logical status
356357 private double ladder_proc; // logical status
357- private double gear_proc; // logical status
358- private double rcover_proc; // logical status
358+ private DoublePointer gear_proc; // logical status
359+ private DoublePointer rcover_proc; // logical status
359360 private double olock_proc; // logical status
360361 private double ilock_proc; // logical status
361362 private double hatch_proc; // logical status
362- private double radiator_proc; // logical status
363- private double brake_proc; // logical status
363+ private DoublePointer radiator_proc; // logical status
364+ private DoublePointer brake_proc; // logical status
364365 private uint anim_gear; // handle for landing gear animation
365366 private uint anim_rcover; // handle for retro cover animation
366367 private uint anim_nose; // handle for nose cone animation
@@ -431,7 +432,7 @@
431432
432433 private uint[] engsliderpos=new uint[5]; // throttle settings for main,hover,scram engines
433434 private uint elevtrimpos; // elevator trim indicator position
434- private ParticleStreamLevelReference[] scram_intensity = new ParticleStreamLevelReference[2];
435+ private DoublePointer[] scram_intensity = new DoublePointer[2];
435436 private double[] scram_max=new double[2];
436437 private uint[] wbrake_pos=new uint[2];
437438 private int[] mainflowidx=new int[2];
@@ -527,25 +528,28 @@
527528 /// <param name="angleOfAttack"></param>
528529 /// <param name="mach"></param>
529530 /// <param name="reynolds"></param>
530- /// <param name="context"></param>
531- /// <param name="cl"></param>
532- /// <param name="cm"></param>
533- /// <param name="cd"></param>
531+ /// <param name="contextVoidPointer"></param>
532+ /// <param name="liftCoefficientDoublePointer"></param>
533+ /// <param name="momentCoefficientDoublePointer"></param>
534+ /// <param name="dragCoefficientDoublePointer"></param>
534535 /// <remarks>
535536 /// Return lift, moment and zero-lift drag coefficients as a
536537 /// function of angle of attack (alpha or beta)
537538 /// </remarks>
538- private void VLiftCoeff(double angleOfAttack, double mach, double reynolds, object context, out double cl, out double cm, out double cd)
539+ private void VLiftCoeff(double angleOfAttack, double mach, double reynolds, IntPtr contextVoidPointer, IntPtr liftCoefficientDoublePointer, IntPtr momentCoefficientDoublePointer, IntPtr dragCoefficientDoublePointer)
539540 {
540541 int i;
541542 for (i = 0; i < alpha.Length-1 && alpha[i+1] < angleOfAttack; i++);
542543 double f = (angleOfAttack-alpha[i]) / (alpha[i+1]-alpha[i]);
543- cl = verticalCL[i] + (verticalCL[i+1]-verticalCL[i]) * f; // angleOfAttack-dependent lift coefficient
544- cm = verticalCM[i] + (verticalCM[i+1]-verticalCM[i]) * f; // angleOfAttack-dependent moment coefficient
544+ double cl = verticalCL[i] + (verticalCL[i+1]-verticalCL[i]) * f; // angleOfAttack-dependent lift coefficient
545+ double cm = verticalCM[i] + (verticalCM[i+1]-verticalCM[i]) * f; // angleOfAttack-dependent moment coefficient
545546 double saoa = Math.Sin(angleOfAttack);
546547 double pd = 0.015 + 0.4*saoa*saoa; // profile drag
547- cd = pd + OAPI.GetInducedDrag (cl, 1.5, 0.7) + OAPI.GetWaveDrag (mach, 0.75, 1.0, 1.1, 0.04);
548+ double cd = pd + OAPI.GetInducedDrag (cl, 1.5, 0.7) + OAPI.GetWaveDrag (mach, 0.75, 1.0, 1.1, 0.04);
548549 // profile drag + (lift-)induced drag + transonic/supersonic wave (compressibility) drag
550+ Marshal.StructureToPtr(cl, liftCoefficientDoublePointer, true);
551+ Marshal.StructureToPtr(cm, momentCoefficientDoublePointer, true);
552+ Marshal.StructureToPtr(cd, dragCoefficientDoublePointer, true);
549553 }
550554
551555 /// <summary>
@@ -554,21 +558,24 @@
554558 /// <param name="angleOfAttack"></param>
555559 /// <param name="mach"></param>
556560 /// <param name="reynolds"></param>
557- /// <param name="context"></param>
558- /// <param name="cl"></param>
559- /// <param name="cm"></param>
560- /// <param name="cd"></param>
561+ /// <param name="contextVoidPointer"></param>
562+ /// <param name="liftCoefficientDoublePointer"></param>
563+ /// <param name="momentCoefficientDoublePointer"></param>
564+ /// <param name="dragCoefficientDoublePointer"></param>
561565 /// <remarks>
562566 /// Return lift, moment and zero-lift drag coefficients as a
563567 /// function of angle of attack (alpha or beta)
564568 /// </remarks>
565- private void HLiftCoeff(double angleOfAttack, double mach, double reynolds, object context, out double cl, out double cm, out double cd)
569+ private void HLiftCoeff(double angleOfAttack, double mach, double reynolds, IntPtr contextVoidPointer, IntPtr liftCoefficientDoublePointer, IntPtr momentCoefficientDoublePointer, IntPtr dragCoefficientDoublePointer)
566570 {
567571 int i;
568572 for (i = 0; i < beta.Length-1 && beta[i+1] < angleOfAttack; i++);
569- cl = horizontalCL[i] + (horizontalCL[i+1]-horizontalCL[i]) * (angleOfAttack-beta[i]) / (beta[i+1]-beta[i]);
570- cm = 0.0;
571- cd = 0.015 +OAPI.GetInducedDrag(cl, 1.5, 0.6) + OAPI.GetWaveDrag(mach, 0.75, 1.0, 1.1, 0.04);
573+ double cl = horizontalCL[i] + (horizontalCL[i+1]-horizontalCL[i]) * (angleOfAttack-beta[i]) / (beta[i+1]-beta[i]);
574+ double cm = 0.0;
575+ double cd = 0.015 +OAPI.GetInducedDrag(cl, 1.5, 0.6) + OAPI.GetWaveDrag(mach, 0.75, 1.0, 1.1, 0.04);
576+ Marshal.StructureToPtr(cl, liftCoefficientDoublePointer, true);
577+ Marshal.StructureToPtr(cm, momentCoefficientDoublePointer, true);
578+ Marshal.StructureToPtr(cd, dragCoefficientDoublePointer, true);
572579 }
573580
574581 public DeltaGlider(int fmodel)
@@ -580,11 +587,8 @@
580587 slip_ind = Math.PI * 0.5;
581588 load_ind = Math.PI;
582589 gear_status = DoorStatus.CLOSED;
583- gear_proc = 0.0;
584590 rcover_status = DoorStatus.CLOSED;
585- rcover_proc = 0.0;
586591 nose_status = DoorStatus.CLOSED;
587- nose_proc = 0.0;
588592 ladder_status = DoorStatus.CLOSED;
589593 ladder_proc = 0.0;
590594 olock_status = DoorStatus.CLOSED;
@@ -594,9 +598,7 @@
594598 hatch_status = DoorStatus.CLOSED;
595599 hatch_proc = 0.0;
596600 brake_status = DoorStatus.CLOSED;
597- brake_proc = 0.0;
598601 radiator_status = DoorStatus.CLOSED;
599- radiator_proc = 0.0;
600602 visual = IntPtr.Zero;
601603 exmesh = IntPtr.Zero;
602604 vcmesh = IntPtr.Zero;
@@ -1117,6 +1119,28 @@
11171119 else for (int i = 0; i < values.Length; i++) result[i] = th_att_rot[values[i]];
11181120 return result;
11191121 }
1122+
1123+ private static Vector3[] beaconpos = new Vector3[]
1124+ {
1125+ new Vector3(-8.6,0,-3.3),
1126+ new Vector3(8.6,0,-3.3),
1127+ new Vector3(0,0.5,-7.5),
1128+ new Vector3(0,2.2,2),
1129+ new Vector3(0,-1.4,2),
1130+ new Vector3(-8.9,2.5,-5.4),
1131+ new Vector3(8.9,2.5,-5.4),
1132+ new Vector3(0,-1.8,2)
1133+ };
1134+ private static Vector3[] beaconcol = new Vector3[]
1135+ {
1136+ new Vector3(1.0,0.5,0.5),
1137+ new Vector3(0.5,1.0,0.5),
1138+ new Vector3(1,1,1),
1139+ new Vector3(1,0.6,0.6),
1140+ new Vector3(1,0.6,0.6),
1141+ new Vector3(1,1,1),
1142+ new Vector3(1,1,1)
1143+ };
11201144
11211145 public void SetClassCaps(IntPtr configuration)
11221146 {
@@ -1125,8 +1149,7 @@
11251149 bool b = false;
11261150 if (OAPI.ReadItem(configuration, "SCRAMJET", ref b) && b) // set up scramjet configuration
11271151 scramjet = new Ramjet(This);
1128-
1129- //VESSEL2::SetEmptyMass (scramjet ? EMPTY_MASS_SC : EMPTY_MASS);
1152+ This.EmptyMass = scramjet != null ? EMPTY_MASS_SC : EMPTY_MASS;
11301153 Vector3[] r = new Vector3[] { new Vector3(0, 0, 6), new Vector3(0, 0, -4) };
11311154 This.Size = 10.0;
11321155 This.SetVisibilityLimit(7.5e-4, 1.5e-3);
@@ -1287,61 +1310,59 @@
12871310 //AddExhaust (th_scram[0], 10.0, 0.5);
12881311 //AddExhaust (th_scram[1], 10.0, 0.5);
12891312 IntPtr ph = This.AddExhaustStream(th_scram[0], new Vector3(-1, -1.1, -5.4), exhaust_scram);
1290- if (ph!=IntPtr.Zero) OAPI.ParticleSetLevelReference(scram_intensity[0]=new ParticleStreamLevelReference(ph));
1313+ if (ph!=IntPtr.Zero) OAPI.ParticleSetLevelReference(ph, scram_intensity[0]=new DoublePointer());
12911314 ph = This.AddExhaustStream(th_scram[1], new Vector3(1, -1.1, -5.4), exhaust_scram);
1292- if (ph != IntPtr.Zero) OAPI.ParticleSetLevelReference(scram_intensity[1] = new ParticleStreamLevelReference(ph));
1315+ if (ph != IntPtr.Zero) OAPI.ParticleSetLevelReference(ph, scram_intensity[1] = new DoublePointer());
12931316 }
12941317
12951318 // ********************* aerodynamics ***********************
12961319
1297- //hwing = This.CreateAirfoil3 (LIFT_VERTICAL, _V(0,0,-0.3), VLiftCoeff, 0, 5, 90, 1.5);
1298- //// wing and body lift+drag components
1299-
1300- //This.CreateAirfoil3 (LIFT_HORIZONTAL, _V(0,0,-4), HLiftCoeff, 0, 5, 15, 1.5);
1301- //// vertical stabiliser and body lift and drag components
1320+ hwing = This.CreateAirfoil3(AirFoilOrientation.Vertical, new Vector3(0, 0, -0.3), VLiftCoeff, 0, 5, 90, 1.5);
1321+ // wing and body lift+drag components
13021322
1303- //CreateControlSurface (AIRCTRL_ELEVATOR, 1.4, 1.5, _V( 0,0,-7.2), AIRCTRL_AXIS_XPOS, anim_elevator);
1304- //CreateControlSurface (AIRCTRL_RUDDER, 0.8, 1.5, _V( 0,0,-7.2), AIRCTRL_AXIS_YPOS, anim_rudder);
1305- //hlaileron = CreateControlSurface2 (AIRCTRL_AILERON, 0.3, 1.5, _V( 7.5,0,-7.2), AIRCTRL_AXIS_XPOS, anim_raileron);
1306- //hraileron = CreateControlSurface2 (AIRCTRL_AILERON, 0.3, 1.5, _V(-7.5,0,-7.2), AIRCTRL_AXIS_XNEG, anim_laileron);
1307- //CreateControlSurface (AIRCTRL_ELEVATORTRIM, 0.3, 1.5, _V( 0,0,-7.2), AIRCTRL_AXIS_XPOS, anim_elevatortrim);
1323+ This.CreateAirfoil3(AirFoilOrientation.Horizontal, new Vector3(0, 0, -4), HLiftCoeff, 0, 5, 15, 1.5);
1324+ // vertical stabiliser and body lift and drag components
13081325
1309- //CreateVariableDragElement (&gear_proc, 0.8, _V(0, -1, 0)); // landing gear
1310- //CreateVariableDragElement (&rcover_proc, 0.2, _V(0,-0.5,6.5)); // retro covers
1311- //CreateVariableDragElement (&nose_proc, 3, _V(0, 0, 8)); // nose cone
1312- //CreateVariableDragElement (&radiator_proc, 1, _V(0,1.5,-4)); // radiator
1313- //CreateVariableDragElement (&brake_proc, 4, _V(0,0,-8)); // airbrake
1326+ This.CreateControlSurface(ControlSurface.Elevator, 1.4, 1.5, new Vector3(0, 0, -7.2), Constants.AIRCTRL_AXIS_XPOS, anim_elevator);
1327+ This.CreateControlSurface(ControlSurface.Rudder, 0.8, 1.5, new Vector3(0, 0, -7.2), Constants.AIRCTRL_AXIS_YPOS, anim_rudder);
1328+ hlaileron = This.CreateControlSurface2(ControlSurface.Aileron, 0.3, 1.5, new Vector3(7.5, 0, -7.2), Constants.AIRCTRL_AXIS_XPOS, anim_raileron);
1329+ hraileron = This.CreateControlSurface2(ControlSurface.Aileron, 0.3, 1.5, new Vector3(-7.5, 0, -7.2), Constants.AIRCTRL_AXIS_XNEG, anim_laileron);
1330+ This.CreateControlSurface(ControlSurface.ElevatorTrim, 0.3, 1.5, new Vector3(0, 0, -7.2), Constants.AIRCTRL_AXIS_XPOS, anim_elevatortrim);
13141331
1315- //SetRotDrag (_V(0.10,0.13,0.04));
1332+ This.CreateVariableDragElement(gear_proc = new DoublePointer(), 0.8, new Vector3(0, -1, 0)); // landing gear
1333+ This.CreateVariableDragElement(rcover_proc = new DoublePointer(), 0.2, new Vector3(0, -0.5, 6.5)); // retro covers
1334+ This.CreateVariableDragElement(nose_proc = new DoublePointer(), 3, new Vector3(0, 0, 8)); // nose cone
1335+ This.CreateVariableDragElement(radiator_proc = new DoublePointer(), 1, new Vector3(0, 1.5, -4)); // radiator
1336+ This.CreateVariableDragElement(brake_proc = new DoublePointer(), 4, new Vector3(0, 0, -8)); // airbrake
1337+
1338+ This.RotationalDrag = new Vector3(0.10, 0.13, 0.04);
13161339 // angular damping
13171340
13181341 // ************************* mesh ***************************
13191342
13201343 // ********************* beacon lights **********************
1321- //static VECTOR3 beaconpos[8] = {{-8.6,0,-3.3}, {8.6,0,-3.3}, {0,0.5,-7.5}, {0,2.2,2}, {0,-1.4,2}, {-8.9,2.5,-5.4}, {8.9,2.5,-5.4}, {0,-1.8,2}};
1322- //static VECTOR3 beaconcol[7] = {{1.0,0.5,0.5}, {0.5,1.0,0.5}, {1,1,1}, {1,0.6,0.6}, {1,0.6,0.6}, {1,1,1}, {1,1,1}};
1323- //for (i = 0; i < 7; i++) {
1324- // beacon[i].shape = (i < 3 ? BEACONSHAPE_DIFFUSE : BEACONSHAPE_STAR);
1325- // beacon[i].pos = beaconpos+i;
1326- // beacon[i].col = beaconcol+i;
1327- // beacon[i].size = (i < 3 ? 0.3 : 0.55);
1328- // beacon[i].falloff = (i < 3 ? 0.4 : 0.6);
1329- // beacon[i].period = (i < 3 ? 0 : i < 5 ? 2 : 1.13);
1330- // beacon[i].duration = (i < 5 ? 0.1 : 0.05);
1331- // beacon[i].tofs = (6-i)*0.2;
1332- // beacon[i].active = false;
1333- // AddBeacon (beacon+i);
1334- //}
1335- //if (scramjet) beacon[4].pos = beaconpos+7;
1344+ for (int i = 0; i < 7; i++) {
1345+ beacon[i].Shape = (i < 3 ? Constants.BEACONSHAPE_DIFFUSE : Constants.BEACONSHAPE_STAR);
1346+ beacon[i].Position = beaconpos[i];
1347+ beacon[i].Color = beaconcol[i];
1348+ beacon[i].Size = (i < 3 ? 0.3 : 0.55);
1349+ beacon[i].FallOff = (i < 3 ? 0.4 : 0.6);
1350+ beacon[i].Period = (i < 3 ? 0 : i < 5 ? 2 : 1.13);
1351+ beacon[i].Duration = (i < 5 ? 0.1 : 0.05);
1352+ beacon[i].TimeOffset = (6-i)*0.2;
1353+ beacon[i].Active = false;
1354+ This.AddBeacon (beacon[i]);
1355+ }
1356+ if (scramjet!=null) beacon[4].Position = beaconpos[7];
13361357
1337- //SetMeshVisibilityMode (AddMesh (exmesh_tpl = oapiLoadMeshGlobal (ScramVersion() ? "DG\\deltaglider" : "DG\\deltaglider_ns")), MESHVIS_EXTERNAL);
1338- //SetMeshVisibilityMode (AddMesh (vcmesh_tpl = oapiLoadMeshGlobal ("DG\\DeltaGliderCockpit")), MESHVIS_VC);
1358+ This.SetMeshVisibilityMode (This.AddMesh (exmesh_tpl = OAPI.LoadMeshGlobal (scramVersion ? "DG\\deltaglider" : "DG\\deltaglider_ns")), Constants.MESHVIS_EXTERNAL);
1359+ This.SetMeshVisibilityMode (This.AddMesh (vcmesh_tpl = OAPI.LoadMeshGlobal ("DG\\DeltaGliderCockpit")), Constants.MESHVIS_VC);
13391360
13401361 // **************** vessel-specific insignia ****************
13411362
1342- //insignia_tex = oapiCreateTextureSurface (256, 256);
1343- //SURFHANDLE hTex = oapiGetTextureHandle (exmesh_tpl, 5);
1344- //if (hTex) oapiBlt (insignia_tex, hTex, 0, 0, 0, 0, 256, 256);
1363+ insignia_tex = OAPI.CreateTextureSurface(256, 256);
1364+ IntPtr hTex = OAPI.GetTextureHandle(exmesh_tpl, 5);
1365+ if (hTex!=IntPtr.Zero) OAPI.Blt(insignia_tex, hTex, 0, 0, 0, 0, 256, 256);
13451366 }
13461367
13471368 public void SaveState(IntPtr scenario)
@@ -1478,5 +1499,13 @@
14781499 {
14791500 throw new NotImplementedException();
14801501 }
1502+
1503+ private bool scramVersion
1504+ {
1505+ get
1506+ {
1507+ return scramjet != null;
1508+ }
1509+ }
14811510 }
14821511 }
\ No newline at end of file
diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/ShuttlePB.cs
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/ShuttlePB.cs Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/ShuttlePB.cs Mon Jun 11 19:03:05 2007 +0200
@@ -89,7 +89,7 @@
8989 This.PMI=new Vector3(2.28,2.31,0.79);
9090 This.TrimScale=0.05;
9191 This.CameraOffset=new Vector3(0,0.8,0);
92- This.LiftCoefficient=new LiftCoefficientDelegate(LiftCoefficient);
92+ This.LiftCoefficient=LiftCoefficient;
9393 This.SetDockParameters(new DockParameters(new Vector3(0,1.3,-1), new Vector3(0,1,0), new Vector3(0,0,-1)));
9494 This.TouchDownPoints=new TouchDownPoints(new Vector3(0,-1.5,2), new Vector3(-1,-1.5,-1.5), new Vector3(1,-1.5,-1.5));
9595
diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.cpp
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.cpp Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.cpp Mon Jun 11 19:03:05 2007 +0200
@@ -28,6 +28,17 @@
2828 Marshal::FreeHGlobal(buf);
2929 return result;
3030 }
31- void OAPI::ParticleSetLevelReference(Interfaces::ParticleStreamLevelReference ^reference){oapiParticleSetLevelRef((PSTREAM_HANDLE)(void *)reference->StreamHandle, (double *)(void *)reference->Native);}
31+ void OAPI::ParticleSetLevelReference(IntPtr particleStream, Interfaces::DoublePointer ^reference){oapiParticleSetLevelRef((PSTREAM_HANDLE)(void *)particleStream, (double *)(void *)reference->Native);}
32+ IntPtr OAPI::LoadMeshGlobal(System::String ^name)
33+ {
34+ IntPtr buf=Marshal::StringToHGlobalAnsi(name);
35+ IntPtr result=(IntPtr)oapiLoadMeshGlobal((char *)(void *)buf);
36+ Marshal::FreeHGlobal(buf);
37+ return result;
38+ }
39+ IntPtr OAPI::CreateTextureSurface(int width, int height){return (IntPtr)oapiCreateTextureSurface(width, height);}
40+ IntPtr OAPI::GetTextureHandle(System::IntPtr mesh, unsigned int textureIndex){return (IntPtr)oapiGetTextureHandle((MESHHANDLE)(void *)mesh, textureIndex);}
41+ void OAPI::Blt(System::IntPtr target, System::IntPtr source, int targetX, int targetY, int sourceX, int sourceY, int width, int height, unsigned int colorKey){oapiBlt((SURFHANDLE)(void *)target, (SURFHANDLE)(void *)source, targetX, targetY, sourceX, sourceY, width, height, colorKey);}
42+ void OAPI::Blt(System::IntPtr target, System::IntPtr source, int targetX, int targetY, int sourceX, int sourceY, int width, int height){oapiBlt((SURFHANDLE)(void *)target, (SURFHANDLE)(void *)source, targetX, targetY, sourceX, sourceY, width, height);}
3243 }
3344 }
\ No newline at end of file
diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.h
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.h Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.h Mon Jun 11 19:03:05 2007 +0200
@@ -18,7 +18,12 @@
1818 static double GetInducedDrag (double cl, double aspectRatio, double efficiency);
1919 static double GetWaveDrag (double mach, double mach1, double mach2, double mach3, double maximumWaveDragCooefficient);
2020 static bool ReadItem (IntPtr file, String^ name, bool %flag);
21- static void ParticleSetLevelReference (Interfaces::ParticleStreamLevelReference^ reference);
21+ static void ParticleSetLevelReference (IntPtr particleStream, Interfaces::DoublePointer^ reference);
22+ static IntPtr LoadMeshGlobal (String^ name);
23+ static IntPtr CreateTextureSurface (int width, int height);
24+ static IntPtr GetTextureHandle (IntPtr mesh, unsigned int textureIndex);
25+ static void Blt (IntPtr target, IntPtr source, int targetX, int targetY, int sourceX, int sourceY, int width, int height, unsigned int colorKey);
26+ static void Blt (IntPtr target, IntPtr source, int targetX, int targetY, int sourceX, int sourceY, int width, int height);
2227 };
2328 }
2429 }
\ No newline at end of file
diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp Mon Jun 11 19:03:05 2007 +0200
@@ -306,6 +306,15 @@
306306 return result;
307307 }
308308 System::Object^ Vessel::GetAirFoilCoefficientFunctionContext(System::IntPtr key){return coefficientDelegatesByKey[key];}
309+ void Vessel::CreateControlSurface(Orbiter::Interfaces::ControlSurface type, double area, double liftCoefficientShift, Orbiter::Interfaces::Vector3 ^reference){vessel->CreateControlSurface((AIRCTRL_TYPE)type, area, liftCoefficientShift, _V(reference->X, reference->Y, reference->Z));}
310+ void Vessel::CreateControlSurface(Orbiter::Interfaces::ControlSurface type, double area, double liftCoefficientShift, Orbiter::Interfaces::Vector3 ^reference, int axis){vessel->CreateControlSurface((AIRCTRL_TYPE)type, area, liftCoefficientShift, _V(reference->X, reference->Y, reference->Z), axis);}
311+ void Vessel::CreateControlSurface(Orbiter::Interfaces::ControlSurface type, double area, double liftCoefficientShift, Orbiter::Interfaces::Vector3 ^reference, int axis, unsigned int animation){vessel->CreateControlSurface((AIRCTRL_TYPE)type, area, liftCoefficientShift, _V(reference->X, reference->Y, reference->Z), axis, animation);}
312+ IntPtr Vessel::CreateControlSurface2(Orbiter::Interfaces::ControlSurface type, double area, double liftCoefficientShift, Orbiter::Interfaces::Vector3 ^reference, int axis, unsigned int animation){return (IntPtr)vessel->CreateControlSurface2((AIRCTRL_TYPE)type, area, liftCoefficientShift, _V(reference->X, reference->Y, reference->Z), axis, animation);}
313+ IntPtr Vessel::CreateControlSurface2(Orbiter::Interfaces::ControlSurface type, double area, double liftCoefficientShift, Orbiter::Interfaces::Vector3 ^reference, int axis){return (IntPtr)vessel->CreateControlSurface2((AIRCTRL_TYPE)type, area, liftCoefficientShift, _V(reference->X, reference->Y, reference->Z), axis);}
314+ IntPtr Vessel::CreateControlSurface2(Orbiter::Interfaces::ControlSurface type, double area, double liftCoefficientShift, Orbiter::Interfaces::Vector3 ^reference){return (IntPtr)vessel->CreateControlSurface2((AIRCTRL_TYPE)type, area, liftCoefficientShift, _V(reference->X, reference->Y, reference->Z));}
315+ void Vessel::CreateVariableDragElement(Interfaces::DoublePointer ^drag, double factor, Orbiter::Interfaces::Vector3 ^reference){vessel->CreateVariableDragElement((double *)(void *)drag->Native, factor, _V(reference->X, reference->Y, reference->Z));}
316+ void Vessel::SetMeshVisibilityMode(unsigned int mesh, short mode){vessel->SetMeshVisibilityMode(mesh, mode);}
317+ void Vessel::AddBeacon(Orbiter::Interfaces::BeaconLightSpecification beacon){vessel->AddBeacon((BEACONLIGHTSPEC *)(void *)beacon.Native);}
309318
310319 IntPtr Vessel::Init(IntPtr vessel, int flightmodel, Interfaces::Vessel2^ vessel2)
311320 {
diff -r a7e971f0b352 -r 7a010f96b65c Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.h
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.h Wed Jun 06 21:02:55 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.h Mon Jun 11 19:03:05 2007 +0200
@@ -117,7 +117,16 @@
117117 virtual IntPtr CreateAirfoil2 (Interfaces::AirFoilOrientation align, Interfaces::Vector3^ reference, Interfaces::AirFoilCoefficientDelegate^ coefficient, double chordLength, double wingArea, double aspectRatio);
118118 virtual IntPtr CreateAirfoil3 (Interfaces::AirFoilOrientation align, Interfaces::Vector3^ reference, Interfaces::AirFoilCoefficientExDelegate^ coefficient, Object^ context, double chordLength, double wingArea, double aspectRatio);
119119 virtual Object^ GetAirFoilCoefficientFunctionContext (IntPtr key);
120-
120+ virtual void CreateControlSurface (Interfaces::ControlSurface type, double area, double liftCoefficientShift, Interfaces::Vector3^ reference);
121+ virtual void CreateControlSurface (Interfaces::ControlSurface type, double area, double liftCoefficientShift, Interfaces::Vector3^ reference, int axis);
122+ virtual void CreateControlSurface (Interfaces::ControlSurface type, double area, double liftCoefficientShift, Interfaces::Vector3^ reference, int axis, unsigned int animation);
123+ virtual IntPtr CreateControlSurface2 (Interfaces::ControlSurface type, double area, double liftCoefficientShift, Interfaces::Vector3^ reference);
124+ virtual IntPtr CreateControlSurface2 (Interfaces::ControlSurface type, double area, double liftCoefficientShift, Interfaces::Vector3^ reference, int axis);
125+ virtual IntPtr CreateControlSurface2 (Interfaces::ControlSurface type, double area, double liftCoefficientShift, Interfaces::Vector3^ reference, int axis, unsigned int animation);
126+ virtual void CreateVariableDragElement (Interfaces::DoublePointer^ drag, double factor, Interfaces::Vector3^ reference);
127+ virtual void SetMeshVisibilityMode (unsigned int mesh, short int mode);
128+ virtual void AddBeacon (Interfaces::BeaconLightSpecification beacon);
129+
121130 //double GetMaxThrust (ENGINETYPE eng) const;
122131 //double GetEngineLevel (ENGINETYPE eng) const;
123132 //double *GetMainThrustModPtr (void) const;
@@ -194,7 +203,6 @@
194203 //bool ShiftMesh (UINT idx, const VECTOR3 &ofs) const;
195204 //void ShiftMeshes (const VECTOR3 &ofs) const;
196205 //MESHHANDLE GetMesh (VISHANDLE vis, UINT idx) const;
197- //void SetMeshVisibilityMode (UINT meshidx, WORD mode) const;
198206 //void SetMeshVisibleInternal (UINT meshidx, bool visible) const;
199207 //bool MeshgroupTransform (VISHANDLE vis, const MESHGROUP_TRANSFORM &mt) const;
200208 //void SetExhaustScales (EXHAUSTTYPE exh, WORD id, double lscale, double wscale) const;
@@ -294,13 +302,10 @@
294302 //void EditAirfoil (AIRFOILHANDLE hAirfoil, DWORD flag, const VECTOR3 &ref, AirfoilCoeffFunc cf, double c, double S, double A) const;
295303 //bool DelAirfoil (AIRFOILHANDLE hAirfoil) const;
296304 //void ClearAirfoilDefinitions (void) const;
297- //void CreateControlSurface (AIRCTRL_TYPE type, double area, double dCl, const VECTOR3 &ref, int axis = AIRCTRL_AXIS_AUTO, UINT anim = (UINT)-1) const;
298- //CTRLSURFHANDLE CreateControlSurface2 (AIRCTRL_TYPE type, double area, double dCl, const VECTOR3 &ref, int axis = AIRCTRL_AXIS_AUTO, UINT anim = (UINT)-1) const;
299305 //bool DelControlSurface (CTRLSURFHANDLE hCtrlSurf) const;
300306 //void ClearControlSurfaceDefinitions (void) const;
301307 //void SetControlSurfaceLevel (AIRCTRL_TYPE type, double level) const;
302308 //double GetControlSurfaceLevel (AIRCTRL_TYPE type) const;
303- //void CreateVariableDragElement (double *drag, double factor, const VECTOR3 &ref) const;
304309 //void ClearVariableDragElements () const;
305310
306311 //// Nosewheel-steering
@@ -331,7 +336,6 @@
331336 //bool DetachChild (ATTACHMENTHANDLE attachment, double vel = 0.0) const;
332337
333338 //// beacon light management
334- //void AddBeacon (BEACONLIGHTSPEC *bs);
335339 //bool DelBeacon (BEACONLIGHTSPEC *bs);
336340 //void ClearBeacons ();
337341
Afficher sur ancien navigateur de dépôt.