Loading non-existent textures don't cause a CTD.http://i89.photobucket.com/albums/k207/Notebook_04/Westcott_P2.jpg
Guess its not loading my panel?
("Aardvark.dds" dosen't exist, I was using that to see if it CTD, it dosen't, another puzzle?)
// ==============================================================
// ORBITER MODULE: P2TestCell
// Part of the ORBITER SDK
// Copyright (C) 2002-2004 Martin Schweiger
// All rights reserved
//
// P2TestCell.cpp
// Control module for P2TestCell vessel class
//
// Notes:
// This is an example for a "minimal" vessel implementation which
// only overloads the clbkSetClassCaps method to define vessel
// capabilities and otherwise uses the default VESSEL class
// behaviour.
// ==============================================================
#define STRICT
#define ORBITER_MODULE
#include "orbitersdk.h"
#include "P2TestCell.h"
P2TestCell::P2TestCell (OBJHANDLE hVessel, int flightmodel)
: VESSEL3 (hVessel, flightmodel)
{
mh_P2External = oapiLoadMeshGlobal("P2TestCell");
mh_P2Internal = oapiLoadMeshGlobal("P2TestCellInterior");
}
P2TestCell::~P2TestCell ()
{
}
// ==============================================================
// Overloaded callback functions
// ==============================================================
int id=0;
bool P2TestCell::clbkLoadVC(int id)
{
SetCameraOffset (_V(0,1.5,0));
SetCameraDefaultDirection (_V(0,0,1));
SetCameraRotationRange (RAD*120, RAD*120, RAD*70, RAD*70);
SetCameraShiftRange (_V(0,0,0.1), _V(-0.2,0,0), _V(0.2,0,0));
return 0;
} // End "P2TestCell::clbkLoadVC"
// --------------------------------------------------------------
// Respond to virtual cockpit mouse events
// --------------------------------------------------------------
bool P2TestCell::clbkVCMouseEvent (int id, int event, VECTOR3 &p)
{
return false;
} End "P2TestCell::clbkVCMouseEvent"
// --------------------------------------------------------------
// Respond to virtual cockpit area redraw requests
// --------------------------------------------------------------
bool P2TestCell::clbkVCRedrawEvent (int id, int event, SURFHANDLE surf)
{
return false;
} // End "P2TestCell::clbkVCRedrawEvent"
// --------------------------------------------------------------
// Set the capabilities of the vessel class
// --------------------------------------------------------------
void P2TestCell::clbkSetClassCaps (FILEHANDLE cfg)
{
THRUSTER_HANDLE (th_main);
// physical vessel parameters
SetSize (P2_SIZE);
SetEmptyMass (P2_EMPTYMASS);
SetPMI (P2_PMI);
SetCrossSections (P2_CS);
SetRotDrag (P2_RD);
SetTouchdownPoints (P2_TDP[0], P2_TDP[1], P2_TDP[2]);
// propellant resources
PROPELLANT_HANDLE hpr = CreatePropellantResource (P2_FUELMASS);
// main engine
th_main = CreateThruster (_V(0,0,-4.35), _V(0,0,1), P2_MAXMAINTH, hpr, P2_ISP);
CreateThrusterGroup (&th_main, 1, THGROUP_MAIN);
AddExhaust (th_main, 8, 1, _V(0,0.3,-4.35), _V(0,0,-1));
PARTICLESTREAMSPEC contrail_main = {
0, 5.0, 16, 200, 0.15, 1.0, 5, 3.0, PARTICLESTREAMSPEC::DIFFUSE,
PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1
};
PARTICLESTREAMSPEC exhaust_main = {
0, 2.0, 20, 200, 0.05, 0.1, 8, 1.0, PARTICLESTREAMSPEC::EMISSIVE,
PARTICLESTREAMSPEC::LVL_SQRT, 0, 1,
PARTICLESTREAMSPEC::ATM_PLOG, 1e-5, 0.1
};
AddExhaustStream (th_main, _V(0,0.3,-10), &contrail_main);
AddExhaustStream (th_main, _V(0,0.3,-5), &exhaust_main);
// camera parameters
SetCameraOffset (_V(-0,0.8,0));
// associate a mesh for the visual
//AddMesh ("P2TestCell");
mesh_P2External = AddMesh (mh_P2External);
mesh_P2Internal = AddMesh (mh_P2Internal);
SetMeshVisibilityMode (mesh_P2Internal, MESHVIS_VC); // Set P2_Internal mesh to be visible in virtual cockpit view
}
// ==============================================================
// API callback interface
// ==============================================================
// --------------------------------------------------------------
// Vessel initialisation
// --------------------------------------------------------------
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new P2TestCell (hvessel, flightmodel);
}
// --------------------------------------------------------------
// Vessel cleanup
// --------------------------------------------------------------
DLLCLBK void ovcExit (VESSEL *vessel)
{
if (vessel) delete (P2TestCell*)vessel;
}
#include "orbitersdk.h"
// ==============================================================
// Some vessel parameters
// ==============================================================
const double P2_SIZE = 10.5; // mean radius [m]
const VECTOR3 P2_CS = {10.5,15.0,5.8}; // x,y,z cross sections [m^2]
const VECTOR3 P2_PMI = {2.28,2.31,0.79};// principal moments of inertia (mass-normalised) [m^2]
const VECTOR3 P2_RD = {0.025,0.025,0.02};//{0.05,0.1,0.05}; // rotation drag coefficients
const double P2_EMPTYMASS = 500.0; // empty vessel mass [kg]
const double P2_FUELMASS = 750.0; // max fuel mass [kg]
const double P2_ISP = 5e4; // fuel-specific impulse [m/s]
//const VECTOR3 P2_TDP[3] = {{0,-1.5,2},{-1,-1.5,-1.5},{1,-1.5,-1.5}}; // touchdown points [m]
const VECTOR3 P2_TDP[3] = {{0,0.01,2},{-1,0.01,-1.5},{1,0.01,-1.5}}; // touchdown points [m]
const double P2_MAXMAINTH = 3e4;
// ==============================================================
// P2TestCell class interface
// ==============================================================
class P2TestCell: public VESSEL3 {
public:
P2TestCell (OBJHANDLE hVessel, int flightmodel);
~P2TestCell ();
void clbkSetClassCaps (FILEHANDLE cfg);
int id;
//meshes
MESHHANDLE mh_P2External, mh_P2Internal;
UINT mesh_P2External;
UINT mesh_P2Internal;
bool clbkLoadVC (int id); // Load virtual cockpit mode
bool clbkVCMouseEvent (int id, int event, VECTOR3 &p); // Respond to virtual cockpit mouse events
bool clbkVCRedrawEvent (int id, int event, SURFHANDLE surf);
private:
};
int id=0;
bool P2TestCell::clbkLoadVC(int id)
{
SetCameraOffset (_V(0,1.5,0));
SetCameraDefaultDirection (_V(0,0,1));
SetCameraRotationRange (RAD*120, RAD*120, RAD*70, RAD*70);
SetCameraShiftRange (_V(0,0,0.1), _V(-0.2,0,0), _V(0.2,0,0));
return true;
} // End "P2TestCell::clbkLoadVC"
MSHX1
GROUPS 2
LABEL Interior
MATERIAL 1
TEXTURE 1
GEOM 24 12 ; Interior
4.31395 0.01 2.82572 0.0 1.0 0.0 1.0 1.0
...lots of data
-4.31395 2.79545 -2.82572 0.0 0.0 1.0 0.0 0.0
2 3 0
1 0 3
5 7 4
6 4 7
10 18 8
16 8 18
14 22 11
19 11 22
12 20 15
23 15 20
9 17 13
21 13 17
LABEL Desk
MATERIAL 2
TEXTURE 2
GEOM 202 132 ; Desk
1.00038 0.0271144 1.45396 0.0 -1.0 0.0 0.0 1.0
...even more data
-0.666291 0.575834 0.521924 -1.80166e-007 0.564086 -0.825716 0.501775 0.166667
9 0 8
0 9 1
10 76 91
76 10 2
11 78 92
78 11 3
12 80 93
80 12 4
13 82 94
82 13 5
14 84 95
84 14 6
15 86 96
86 15 7
90 88 97
88 90 74
17 8 16
8 17 9
18 91 99
91 18 10
19 92 100
92 19 11
20 93 101
93 20 12
21 94 102
94 21 13
22 95 103
95 22 14
23 96 104
96 23 15
98 97 105
97 98 90
25 16 24
16 25 17
26 99 107
99 26 18
27 100 108
100 27 19
28 101 109
101 28 20
29 102 110
102 29 21
30 103 111
103 30 22
31 104 112
104 31 23
106 105 113
105 106 98
33 24 32
24 33 25
34 107 115
107 34 26
35 108 116
108 35 27
36 109 117
109 36 28
37 110 118
110 37 29
38 111 119
111 38 30
39 112 123
112 39 31
114 113 127
113 114 106
41 32 40
32 41 33
42 115 129
115 42 34
43 116 130
116 43 35
44 117 131
117 44 36
45 118 132
118 45 37
70 68 73
68 70 69
47 123 46
123 47 39
128 127 139
127 128 114
49 40 48
40 49 41
50 129 142
129 50 42
51 130 144
130 51 43
52 131 146
131 52 44
53 132 148
132 53 45
71 73 72
73 71 70
55 46 54
46 55 47
140 139 158
139 140 128
83 79 81
85 79 83
85 77 79
85 75 77
87 75 85
87 89 75
154 141 159
145 149 147
145 150 149
143 150 145
141 150 143
154 150 141
120 57 124
165 121 56
125 58 136
170 126 166
137 59 155
175 138 171
156 60 151
180 157 176
152 61 133
185 153 181
134 160 122
161 135 186
162 63 167
192 163 62
168 64 172
194 169 193
173 65 177
196 174 195
178 66 182
198 179 197
183 67 187
200 184 199
188 190 164
191 189 201
MATERIALS 2
Concrete
TankBase
MATERIAL Concrete
0.588235 0.588235 0.588235 1.0
0.588235 0.588235 0.588235 1.0
0.9 0.9 0.9 1.0 0.0
0.0 0.0 0.0 1.0
MATERIAL TankBase
0.588235 0.588235 0.588235 1.0
0.588235 0.588235 0.588235 1.0
0.9 0.9 0.9 1.0 0.0
0.0 0.0 0.0 1.0
TEXTURES 2
Concrete.dds
metalcon.dds
// ========================================================
// Mesh resource file for P2TestCellInteriorInv
// Generated with meshc on Fri Feb 15 10:27:20 2013
// ========================================================
// Number of mesh groups:
#define NGRP 0
// Number of materials:
#define NMAT 0
// Number of textures:
#define NTEX 0
You have to include the file extension as well as the file name. So if your mesh is named P2TestCellInteriorInv.msh that is what you have to enter in MeshC.Never used meshc before, so guessing its finger trouble.
All help appreciated
// ========================================================
// Mesh resource file for P2TestCellInteriorInv.msh
// Generated with meshc on Fri Feb 15 12:04:42 2013
// ========================================================
// Number of mesh groups:
#define NGRP 2
// Number of materials:
#define NMAT 2
// Number of textures:
#define NTEX 2
// Named mesh groups:
#define GRP_Interior 0
#define GRP_Desk 1
and changing the Mesh Group paramater, I get these resultsstatic VCMFDSPEC LEFT_MFD = {mesh_P2Internal, GRP_Interior}; // Surface on which to display MFD. [Mesh, Mesh Group]
oapiVCRegisterMFD (0, &LEFT_MFD); // Register MFD in orbiter's interface [registry # and VCMFDSPEC]. (registry numbers start at 0 and count up)
MFD orientation follows UV map of the mesh group (0,0 - top left; 1,1 - bottom right).I'm guessing the MFD orientation follows the mesh axis, so I need to rectify this in 3DS MAX?
No need to do that. You put the right group index into VCMFDSPEC (and the right mesh index, of course) when you register the MFD surface with oapiVCRegisterMFD.How do I get the MFD onto the GRP_PanelLH, do I split off the Desk group as a new mesh from P2TestCellInteriorInv.msh?
// ========================================================
// Mesh resource file for P2TestCellInteriorInv.msh
// Generated with meshc on Fri Feb 15 12:18:53 2013
// ========================================================
// Number of mesh groups:
#define NGRP 3
// Number of materials:
#define NMAT 2
// Number of textures:
#define NTEX 2
// Named mesh groups:
#define GRP_Interior 0
#define GRP_Desk 1
#define GRP_PanelLH 2
const VECTOR3 LEFTMFD_POS = { 0.1, 1, 1}; //
// ==============================================================
// Some vessel parameters
// ==============================================================
const double P2_SIZE = 10.5; // mean radius [m]
const VECTOR3 P2_CS = {10.5,15.0,5.8}; // x,y,z cross sections [m^2]
const VECTOR3 P2_PMI = {2.28,2.31,0.79};// principal moments of inertia (mass-normalised) [m^2]
const VECTOR3 P2_RD = {0.025,0.025,0.02};//{0.05,0.1,0.05}; // rotation drag coefficients
const double P2_EMPTYMASS = 500.0; // empty vessel mass [kg]
const double P2_FUELMASS = 750.0; // max fuel mass [kg]
const double P2_ISP = 5e4; // fuel-specific impulse [m/s]
//const VECTOR3 P2_TDP[3] = {{0,-1.5,2},{-1,-1.5,-1.5},{1,-1.5,-1.5}}; // touchdown points [m]
const VECTOR3 P2_TDP[3] = {{0,0.01,2},{-1,0.01,-1.5},{1,0.01,-1.5}}; // touchdown points [m]
const double P2_MAXMAINTH = 3e4;
// ==============================================================
// P2TestCell class interface
// ==============================================================
class P2TestCell: public VESSEL3 {
public:
P2TestCell (OBJHANDLE hVessel, int flightmodel);
~P2TestCell ();
void clbkSetClassCaps (FILEHANDLE cfg);
void clbkPostStep(double simt, double simdt, double mjd);
//oapiProcessMFDButton (MFD_LEFT, bt, event);
int id;
//meshes
MESHHANDLE mh_P2External, mh_P2Internal;
UINT mesh_P2External;
UINT mesh_P2Internal;
//SURFHANDLE tex;
bool clbkLoadVC (int id); // Load virtual cockpit mode
bool clbkVCMouseEvent (int id, int event, VECTOR3 &p); // Respond to virtual cockpit mouse events
bool clbkVCRedrawEvent (int id, int event, SURFHANDLE surf);
private:
};
P2TestCell::P2TestCell (OBJHANDLE hVessel, int flightmodel)
: VESSEL3 (hVessel, flightmodel)
{
mh_P2External = oapiLoadMeshGlobal("P2TestCell");
mh_P2Internal = oapiLoadMeshGlobal("P2TestCellInteriorInv");
int id = 0; // VC identifier
}
P2TestCell::~P2TestCell ()
{
}
.....
bool P2TestCell::clbkLoadVC(int id)
{
// Register Camera (view) properties
switch (id)
{
case 0: // Commander's position
SetCameraOffset (_V(0,1.0,-3.0)); // Set camera position (x,y,z)
SetCameraDefaultDirection (_V(0,0,1)); // Set camera direction (x,y,z)
SetCameraRotationRange (RAD*120, RAD*120, RAD*70, RAD*70); // Set camera range of motion (Left, Right, Up, Down)
SetCameraShiftRange (_V(0,0,0.1), _V(-0.2,0,0), _V(0.2,0,0));
break;
case 1: // Pilot's position
SetCameraOffset (_V( 0.57, 0.68, 1.12)); // Set camera position (x,y,z)
SetCameraDefaultDirection (_V( 0, 0, 1)); // Set camera direction (x,y,z)
SetCameraRotationRange (RAD*120, RAD*120, RAD*60, RAD*60); // Set camera range of motion (Left, Right, Up, Down)
oapiVCSetNeighbours ( 0,-1,-1,-1);
break;
case 2: // Commander's position (looking up through COAS Reticle)
SetCameraOffset (_V(-0.59, 0.68, 1.12)); // Set camera position (x,y,z)
SetCameraDefaultDirection (_V( 0, 1, 0)); // Set camera direction (x,y,z)
SetCameraRotationRange (RAD*15, RAD*15, RAD*15, RAD*15); // Set camera range of motion (Left, Right, Up, Down)
oapiVCSetNeighbours (-1, 1,-1, 0);
break;
} // end "switch (id)"
// --- Register MFDs ----------------------------------------------------------------------------
VECTOR3 MFD_position = LEFTMFD_POS; // Location of MFD within VC
static VCMFDSPEC LEFT_MFD = {mesh_P2Internal, GRP_Interior}; // Surface on which to display MFD. [Mesh, Mesh Group]
oapiVCRegisterMFD (0, &LEFT_MFD); // Register MFD in orbiter's interface [registry # and VCMFDSPEC]. (registry numbers start at 0 and count up)
return true;
} // End "P2TestCell::clbkLoadVC"
When you open the .msh file with a text editor (notepad, for example), find the mesh group you're looking for (I see you use labels, so it shouldn't be hard). Below the GEOM keyword you should see lines with 8 values. The last 2 are UV map coordinates ('u' in 7th and 'v' in 8th). If there are fewer values in the line, and NONORMAL flag wasn't set, then the UV map wasn't set for the group, and it needs to be added. If NONORMAL flag is set for the group, then UV map coordinates should be in 4th and 5th value in the line.1)I haven't altered or defined the UV parameters of GRP_PanelLH, how do I check its value?
Yes.2) Do you mean making another planar surface in 3DS max above the panel on the desk, and detaching that as a group?
Orbiter needs to have correct data contained in the mesh file, too.I thought I just had to give orbiter the correct paramaters in VCMFDSPEC and orbiter would sort it out?