Commit MetaInfo

Revision4506b2fc4952e4dadfe46362bcab4079e37444b0 (tree)
Time2007-06-06 03:17:48
Authorface__
Commiterface__

Log Message

[svn r31] Added some more oapi-functions as well as vessel-functions to further complete SetClassCaps method of DeltaGlider.

Change Summary

Incremental Difference

diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbiter.Interfaces.dll
Binary file Orbiter.Interfaces.dll has changed
diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbiter.Wrapper.dll
Binary file Orbiter.Wrapper.dll has changed
diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Commons.cs
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Commons.cs Fri Jun 01 18:27:53 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Commons.cs Tue Jun 05 20:17:48 2007 +0200
@@ -129,6 +129,48 @@
129129 Texture = texture;
130130 }
131131 }
132+
133+ public class ParticleStreamLevelReference
134+ {
135+ private IntPtr streamHandle;
136+ private IntPtr native;
137+
138+ public IntPtr StreamHandle
139+ {
140+ get { return streamHandle; }
141+ }
142+
143+ public double Level
144+ {
145+ get
146+ {
147+ double[] result=new double[1];
148+ Marshal.Copy(native, result, 0, 1);
149+ return result[0];
150+ }
151+ set
152+ {
153+ Marshal.Copy(new double[]{value}, 0, native, 1);
154+ }
155+ }
156+
157+ public IntPtr Native
158+ {
159+ get { return native; }
160+ }
161+
162+ public ParticleStreamLevelReference(IntPtr streamHandle)
163+ {
164+ this.streamHandle = streamHandle;
165+ native = Marshal.AllocHGlobal(sizeof (double));
166+ Marshal.DestroyStructure(native, typeof(double));
167+ }
168+
169+ ~ParticleStreamLevelReference()
170+ {
171+ Marshal.FreeHGlobal(native);
172+ }
173+ }
132174
133175 /// <summary>
134176 /// Planetary atmospheric constants
diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Vessel.cs
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Vessel.cs Fri Jun 01 18:27:53 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Interfaces/Vessel.cs Tue Jun 05 20:17:48 2007 +0200
@@ -161,5 +161,15 @@
161161 uint CreateAnimation (double initial_state);
162162 IntPtr AddAnimationComponent (uint animation, double state0, double state1, MeshGroupTransformation transformation, IntPtr parent);
163163 IntPtr AddAnimationComponent (uint animation, double state0, double state1, MeshGroupTransformation transformation);
164+ Vector3 AlbedoRGB { set; }
165+ double GravityGradientDamping { get; set;}
166+ void SetSurfaceFrictionCoefficients(double longitudinal, double latitudinal);
167+ double MaxWheelbrakeForce { set; }
168+ void SetWheelbrakeLevel (double level, int which, bool permanent);
169+ void SetWheelbrakeLevel (double level, int which);
170+ void SetWheelbrakeLevel (double level);
171+ double GetWheelbrakeLevel (int which);
172+ void InitNavRadios (uint navRadios);
173+ bool IsTransponderEnabled { set; }
164174 }
165175 }
diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/DeltaGlider.cs
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/DeltaGlider.cs Fri Jun 01 18:27:53 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.StockVessels/DeltaGlider.cs Tue Jun 05 20:17:48 2007 +0200
@@ -431,7 +431,7 @@
431431
432432 private uint[] engsliderpos=new uint[5]; // throttle settings for main,hover,scram engines
433433 private uint elevtrimpos; // elevator trim indicator position
434- private double[] scram_intensity=new double[2];
434+ private ParticleStreamLevelReference[] scram_intensity = new ParticleStreamLevelReference[2];
435435 private double[] scram_max=new double[2];
436436 private uint[] wbrake_pos=new uint[2];
437437 private int[] mainflowidx=new int[2];
@@ -614,7 +614,6 @@
614614 for (i = 0; i < scram_max.Length; i++)
615615 {
616616 scram_max[i] = 0.0;
617- scram_intensity[i] = 0.0;
618617 }
619618 for (i = 0; i < scgimbalidx.Length; i++)
620619 {
@@ -1123,32 +1122,32 @@
11231122 {
11241123 // *************** physical parameters **********************
11251124
1126- bool b;
1127- //if (oapiReadItem_bool (cfg, "SCRAMJET", b) && b) // set up scramjet configuration
1128- // scramjet = new Ramjet (This);
1125+ bool b = false;
1126+ if (OAPI.ReadItem(configuration, "SCRAMJET", ref b) && b) // set up scramjet configuration
1127+ scramjet = new Ramjet(This);
11291128
11301129 //VESSEL2::SetEmptyMass (scramjet ? EMPTY_MASS_SC : EMPTY_MASS);
11311130 Vector3[] r = new Vector3[] { new Vector3(0, 0, 6), new Vector3(0, 0, -4) };
11321131 This.Size = 10.0;
11331132 This.SetVisibilityLimit(7.5e-4, 1.5e-3);
1134- //This.SetAlbedoRGB (_V(0.77,0.20,0.13));
1135- //This.SetGravityGradientDamping (20.0);
1133+ This.AlbedoRGB = new Vector3(0.77, 0.20, 0.13);
1134+ This.GravityGradientDamping = 20.0;
11361135 This.CW = new CW(0.09, 0.09, 2, 1.4);
11371136 This.WingAspect = 0.7;
11381137 This.WingEffectiveness = 2.5;
11391138 This.CrossSections = new Vector3(53.0, 186.9, 25.9);
1140- //This.SetSurfaceFrictionCoeff (0.07, 0.3);
1141- //This.SetMaxWheelbrakeForce (2e5);
1139+ This.SetSurfaceFrictionCoefficients(0.07, 0.3);
1140+ This.MaxWheelbrakeForce = 2e5;
11421141 This.PMI = new Vector3(15.5, 22.1, 7.7);
11431142
11441143 This.SetDockParameters(new DockParameters(new Vector3(0, -0.49, 10.076), new Vector3(0, 0, 1), new Vector3(0, 1, 0)));
11451144 This.TouchDownPoints = new TouchDownPoints(new Vector3(0, -2.57, 10), new Vector3(-3.5, -2.57, -3), new Vector3(3.5, -2.57, -3));
1146- //This.EnableTransponder (true);
1145+ This.IsTransponderEnabled = true;
11471146 bool render_cockpit = true;
11481147
11491148 // ******************** NAV radios **************************
11501149
1151- //InitNavRadios (4);
1150+ This.InitNavRadios (4);
11521151
11531152 // ****************** propellant specs **********************
11541153
@@ -1273,24 +1272,25 @@
12731272
12741273 // **************** scramjet definitions ********************
12751274
1276- //if (scramjet) {
1277- // VECTOR3 dir = {0.0, sin(SCRAM_DEFAULT_DIR), cos(SCRAM_DEFAULT_DIR)};
1278-
1279- // for (int i = 0; i < 2; i++) {
1280- // th_scram[i] = CreateThruster (_V(i?0.9:-0.9, -0.8, -5.6), dir, 0, ph_scram, 0);
1281- // scramjet->AddThrusterDefinition (th_scram[i], SCRAM_FHV[modelidx],
1282- // SCRAM_INTAKE_AREA, SCRAM_TEMAX[modelidx], SCRAM_MAX_DMF[modelidx]);
1283- // }
1275+ if (scramjet!=null)
1276+ {
1277+ Vector3 dir = new Vector3( 0.0, Math.Sin(SCRAM_DEFAULT_DIR), Math.Cos(SCRAM_DEFAULT_DIR) );
12841278
1285- // // thrust rating and ISP for scramjet engines are updated continuously
1286- // //AddExhaust (th_scram[0], 10.0, 0.5);
1287- // //AddExhaust (th_scram[1], 10.0, 0.5);
1288- // PSTREAM_HANDLE ph;
1289- // ph = AddExhaustStream (th_scram[0], _V(-1,-1.1,-5.4), &exhaust_scram);
1290- // if (ph) oapiParticleSetLevelRef (ph, scram_intensity+0);
1291- // ph = AddExhaustStream (th_scram[1], _V( 1,-1.1,-5.4), &exhaust_scram);
1292- // if (ph) oapiParticleSetLevelRef (ph, scram_intensity+1);
1293- //}
1279+ for (int i = 0; i < 2; i++)
1280+ {
1281+ th_scram[i] = This.CreateThruster(new Vector3(i>0 ? 0.9 : -0.9, -0.8, -5.6), dir, 0, ph_scram, 0);
1282+ scramjet.AddThrusterDefinition(th_scram[i], SCRAM_FHV[modelidx],
1283+ SCRAM_INTAKE_AREA, SCRAM_TEMAX[modelidx], SCRAM_MAX_DMF[modelidx]);
1284+ }
1285+
1286+ // thrust rating and ISP for scramjet engines are updated continuously
1287+ //AddExhaust (th_scram[0], 10.0, 0.5);
1288+ //AddExhaust (th_scram[1], 10.0, 0.5);
1289+ 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));
1291+ 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));
1293+ }
12941294
12951295 // ********************* aerodynamics ***********************
12961296
diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.cpp
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.cpp Fri Jun 01 18:27:53 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.cpp Tue Jun 05 20:17:48 2007 +0200
@@ -19,5 +19,15 @@
1919 }
2020 double OAPI::GetInducedDrag(double cl, double aspectRatio, double efficiency){return oapiGetInducedDrag(cl, aspectRatio, efficiency);}
2121 double OAPI::GetWaveDrag(double mach, double mach1, double mach2, double mach3, double maximumWaveDragCooefficient){return oapiGetWaveDrag(mach, mach1, mach2, mach3, maximumWaveDragCooefficient);}
22+ bool OAPI::ReadItem(System::IntPtr file, System::String^ name, bool %flag)
23+ {
24+ IntPtr buf=Marshal::StringToHGlobalAnsi(name);
25+ bool internalFlag;
26+ bool result=oapiReadItem_bool((FILEHANDLE)(void *)file, (char *)(void *)buf, internalFlag);
27+ flag=internalFlag;
28+ Marshal::FreeHGlobal(buf);
29+ return result;
30+ }
31+ void OAPI::ParticleSetLevelReference(Interfaces::ParticleStreamLevelReference ^reference){oapiParticleSetLevelRef((PSTREAM_HANDLE)(void *)reference->StreamHandle, (double *)(void *)reference->Native);}
2232 }
2333 }
\ No newline at end of file
diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.h
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.h Fri Jun 01 18:27:53 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/OAPI.h Tue Jun 05 20:17:48 2007 +0200
@@ -17,6 +17,8 @@
1717 static Interfaces::AtmosphereConstants GetPlanetAtmConstants(IntPtr body);
1818 static double GetInducedDrag (double cl, double aspectRatio, double efficiency);
1919 static double GetWaveDrag (double mach, double mach1, double mach2, double mach3, double maximumWaveDragCooefficient);
20+ static bool ReadItem (IntPtr file, String^ name, bool %flag);
21+ static void ParticleSetLevelReference (Interfaces::ParticleStreamLevelReference^ reference);
2022 };
2123 }
2224 }
\ No newline at end of file
diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp Fri Jun 01 18:27:53 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp Tue Jun 05 20:17:48 2007 +0200
@@ -254,8 +254,22 @@
254254 unsigned int Vessel::CreateAnimation(double initial_state){return vessel->CreateAnimation(initial_state);}
255255 IntPtr Vessel::AddAnimationComponent(unsigned int animation, double state0, double state1, Interfaces::MeshGroupTransformation ^transformation, System::IntPtr parent){return (IntPtr)vessel->AddAnimationComponent(animation, state0, state1, (MGROUP_TRANSFORM *)(void *)transformation->Native, (ANIMATIONCOMPONENT_HANDLE)parent);}
256256 IntPtr Vessel::AddAnimationComponent(unsigned int animation, double state0, double state1, Interfaces::MeshGroupTransformation ^transformation){return (IntPtr)vessel->AddAnimationComponent(animation, state0, state1, (MGROUP_TRANSFORM *)(void *)transformation->Native);}
257-
258-
257+ void Vessel::AlbedoRGB::set(Interfaces::Vector3^ value){vessel->SetAlbedoRGB(_V(value->X, value->Y, value->Z));}
258+ double Vessel::GravityGradientDamping::get(void) {return vessel->GetGravityGradientDamping();}
259+ void Vessel::GravityGradientDamping::set(double value)
260+ {
261+ if (!vessel->SetGravityGradientDamping(value))
262+ throw gcnew System::AccessViolationException("Extended vessel masses are disabled!");
263+ }
264+ void Vessel::SetSurfaceFrictionCoefficients(double longitudinal, double latitudinal){vessel->SetSurfaceFrictionCoeff(longitudinal, latitudinal);}
265+ void Vessel::MaxWheelbrakeForce::set(double value){vessel->SetMaxWheelbrakeForce(value);}
266+ void Vessel::SetWheelbrakeLevel(double level, int which, bool permanent){vessel->SetWheelbrakeLevel(level, which, permanent);}
267+ void Vessel::SetWheelbrakeLevel(double level, int which){vessel->SetWheelbrakeLevel(level, which);}
268+ void Vessel::SetWheelbrakeLevel(double level){vessel->SetWheelbrakeLevel(level);}
269+ double Vessel::GetWheelbrakeLevel(int which){return vessel->GetWheelbrakeLevel(which);}
270+ void Vessel::InitNavRadios(unsigned int navRadios){vessel->InitNavRadios((DWORD)navRadios);}
271+ void Vessel::IsTransponderEnabled::set(bool value){vessel->EnableTransponder(value);}
272+
259273 IntPtr Vessel::Init(IntPtr vessel, int flightmodel, Interfaces::Vessel2^ vessel2)
260274 {
261275 return (IntPtr)(new Vessel2((OBJHANDLE)vessel, flightmodel, vessel2));
diff -r 8a1eebef47b9 -r 4506b2fc4952 Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.h
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.h Fri Jun 01 18:27:53 2007 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.h Tue Jun 05 20:17:48 2007 +0200
@@ -100,11 +100,19 @@
100100 virtual property double FuelMass {double get(void); void set(double value);};
101101 virtual property double FuelRate {double get(void);};
102102 virtual property double MaxFuelMass {double get(void); void set(double value);};
103- //ANIMATIONCOMPONENT_HANDLE AddAnimationComponent (UINT anim, double state0, double state1,
104- // MGROUP_TRANSFORM *trans, ANIMATIONCOMPONENT_HANDLE parent = NULL) const;
105103 virtual unsigned int CreateAnimation (double initial_state);
106104 virtual IntPtr AddAnimationComponent (unsigned int animation, double state0, double state1, Interfaces::MeshGroupTransformation^ transformation, IntPtr parent);
107105 virtual IntPtr AddAnimationComponent (unsigned int animation, double state0, double state1, Interfaces::MeshGroupTransformation^ transformation);
106+ virtual property Interfaces::Vector3^ AlbedoRGB {void set(Interfaces::Vector3^ value);};
107+ virtual property double GravityGradientDamping {double get(void); void set(double value);};
108+ virtual void SetSurfaceFrictionCoefficients(double longitudinal, double latitudinal);
109+ virtual property double MaxWheelbrakeForce {void set(double value);};
110+ virtual void SetWheelbrakeLevel (double level, int which, bool permanent);
111+ virtual void SetWheelbrakeLevel (double level, int which);
112+ virtual void SetWheelbrakeLevel (double level);
113+ virtual double GetWheelbrakeLevel (int which);
114+ virtual void InitNavRadios (unsigned int navRadios);
115+ virtual property bool IsTransponderEnabled {void set(bool value);};
108116
109117 //double GetMaxThrust (ENGINETYPE eng) const;
110118 //double GetEngineLevel (ENGINETYPE eng) const;
@@ -151,8 +159,6 @@
151159 //OBJHANDLE GetSMi (double &smi) const;
152160 //OBJHANDLE GetApDist (double &apdist) const;
153161 //OBJHANDLE GetPeDist (double &pedist) const;
154- //bool SetGravityGradientDamping (double damp) const;
155- //double GetGravityGradientDamping (void) const;
156162 //void SetISP (double) const;
157163 //void SetMaxThrust (ENGINETYPE eng, double th) const;
158164 //void SetEngineLevel (ENGINETYPE eng, double level) const;
@@ -166,7 +172,6 @@
166172 //bool ToggleNavmode (int mode);
167173 //bool GetNavmodeState (int mode);
168174 //void SetCOG_elev (double h) const;
169- //void SetAlbedoRGB (const VECTOR3 &albedo) const;
170175 //void SetCameraDefaultDirection (const VECTOR3 &cd) const;
171176 //void SetCameraDefaultDirection (const VECTOR3 &cd, double tilt) const;
172177 //void SetCameraRotationRange (double left, double right, double up, double down) const;
@@ -329,20 +334,12 @@
329334 //// Super-structure interface
330335 //bool GetSuperstructureCG (VECTOR3 &cg) const;
331336
332- //// Surface parameters
333- //void SetSurfaceFrictionCoeff (double mu_lng, double mu_lat) const;
334- //void SetMaxWheelbrakeForce (double f) const;
335- //void SetWheelbrakeLevel (double level, int which = 0, bool permanent = true) const;
336- //double GetWheelbrakeLevel (int which) const;
337-
338337 //// Navigation radio interface
339- //void InitNavRadios (DWORD nnav) const;
340338 //bool SetNavRecv (DWORD n, DWORD ch) const;
341339 //DWORD GetNavRecv (DWORD n) const;
342340 //float GetNavRecvFreq (DWORD n) const;
343341 //bool SetTransponderChannel (DWORD ch) const;
344342 //bool SetIDSChannel (DOCKHANDLE hDock, DWORD ch) const;
345- //void EnableTransponder (bool enable) const;
346343 //void EnableIDS (DOCKHANDLE hDock, bool enable) const;
347344 //NAVHANDLE GetTransponder (void) const;
348345 //NAVHANDLE GetIDS (DOCKHANDLE hDock) const;
diff -r 8a1eebef47b9 -r 4506b2fc4952 modules/DotNET/Orbiter.StockVessels.dll
Binary file modules/DotNET/Orbiter.StockVessels.dll has changed
diff -r 8a1eebef47b9 -r 4506b2fc4952 modules/DotNET/ShuttlePBdotNET.dll
Binary file modules/DotNET/ShuttlePBdotNET.dll has changed
diff -r 8a1eebef47b9 -r 4506b2fc4952 modules/DotNET/ShuttleVBOverloaded.dll
Binary file modules/DotNET/ShuttleVBOverloaded.dll has changed
diff -r 8a1eebef47b9 -r 4506b2fc4952 modules/DotNET/ShuttleVBdotNET.dll
Binary file modules/DotNET/ShuttleVBdotNET.dll has changed
diff -r 8a1eebef47b9 -r 4506b2fc4952 modules/ShuttlePBdotNET.dll
Binary file modules/ShuttlePBdotNET.dll has changed
diff -r 8a1eebef47b9 -r 4506b2fc4952 modules/ShuttleVBOverloaded.dll
Binary file modules/ShuttleVBOverloaded.dll has changed
diff -r 8a1eebef47b9 -r 4506b2fc4952 modules/ShuttleVBdotNET.dll
Binary file modules/ShuttleVBdotNET.dll has changed
Show on old repository browser