1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
Milkshape Simple OpenGL Exporter
--------------------------------
This exporter outputs simple OpenGL as either C-source or BlitzMax compatible
source.
To use select 'Simple OpenGL' from the 'Export' menu. When activated a dialog
is displayed with the following items:
Info
A text box with some basic info on the model and what will be created.
Directory
The directory that the sources will be generated in. Use the button
with the 3 periods to the left to select the directory.
Class/Function name
The name of the generated function or class.
Use Textures
Outputs the required 2D texture commands.
Generate Info
Defines some macros or constants that define info on the model,
such as its size, largest co-ordinates and centre of gravity.
Force COG to 0,0,0
The centre of gravity of the model is defined as the mid-point between
the most distance vertices. If you select this then the co-ordinates
are adjusted so that the model is centered on 0,0,0.
Generate for BlitzMax
If selected generates source for use with BlitzMax, otherwise C sources
are generated. See the following sections describing what's generated
for each language type.
Generate for lit scenes
If selected then the appropriate Open GL commands are output setting
the ambient, diffuse, specular and emissive colours.
If not selected, then the vertexes are given a simple colour taken
from the material's diffuse colour (or white if no material is
defined).
---------------------------------------------------------------------------
C Usage
---------------------------------------------------------------------------
To use the C source in your project, assuming you gave the function name as
Test, simply include Test.c and #include "Test.h" to use the model. The
function either has the prototype:
void Test(GLfloat x, GLfloat y, GLfloat z,
GLfloat rot_x, GLfloat rot_y, GLfloat rot_z)
or if 'Use Textures' was selected:
void Test(GLfloat x, GLfloat y, GLfloat z,
GLfloat rot_x, GLfloat rot_y, GLfloat rot_z,
GLint texture_id);
Simply call it with a position and rotation (and texture ID if needed) to draw
the model. Obviously the function can be called as many times as required
during scene generation.
Also generated is this function:
int Test2_CreateList(void);
If this is called then a OpenGL display list for the model is created (the
function returns FALSE if the list couldn't be created). The Test() function
will automatically use this list once it's created.
If 'Generate Info' was selected, then the following macros are defined:
TEST_COG_X
TEST_COG_Y
TEST_COG_Z
Defines the COG of the model (always zeros if 'Force COG ...' was
selected).
TEST_MIN_X
TEST_MAX_X
TEST_MIN_Y
TEST_MAX_Y
TEST_MIN_Z
TEST_MAX_Z
The maximum and minimum vertex values for each axis.
TEST_SIZE_X
TEST_SIZE_Y
TEST_SIZE_Z
The size of the model along each axis.
TEST_TEXTURED
Set to one if 'Use Textures' was selected. Otherwise zero.
TEST_MATERIALS
Set to one if 'Generate for lit scenes' was selected. Otherwise zero.
---------------------------------------------------------------------------
BlitzMAX Usage
---------------------------------------------------------------------------
To use the source in your project, assuming you gave the class name as
Test, simply include "Test.bmx" to use the model. This defines a class called
Test, which has the following fields:
Field x:Float
Field y:Float
Field z:Float
Field rot_x:Float
Field rot_y:Float
Field rot_z:Float
These defines the position and orientation of each instance.
Function Create:Test()
Used to create an instance.
Method Render() *OR*
Method Render(texture_id:Int)
Renders the model (with the supplied texture if 'Use Textures' was
selected).
Function CreateDisplayList:Int()
Creates a common OpenGL display list used by all instances of the
class. Returns True if the list was created, otherwise False.
Render() will use the display list automatically if it's been created.
If 'Generate Info' was selected, then the following constants are defined:
Const COG_X:Float
Const COG_Y:Float
Const COG_Z:Float
Defines the COG of the model (always zeros if 'Force COG ...' was
selected).
Const MIN_X:Float
Const MAX_X:Float
Const MIN_Y:Float
Const MAX_Y:Float
Const MIN_Z:Float
Const MAX_Z:Float
The maximum and minimum vertex values for each axis.
Const SIZE_X:Float
Const SIZE_Y:Float
Const SIZE_Z:Float
The size of the model along each axis.
Const TEXTURED:Int
Set to True if 'Use Textures' was selected. Otherwise False.
Const MATERIALS:Int
Set to True if 'Generate for lit scenes' was selected. Otherwise False.
-------------------------------------------------------------------------------
$Id$
|