aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/seg__remanence__shape_8cpp-source.html
blob: 8b25adc0c969bad3c77eac9a86046c843c981402 (plain)
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG  SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>seg_remanence_shape.cpp</h1><a href="seg__remanence__shape_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00006 <font class="comment">/* Copyright, 2000, 2001, 2002 Nevrax Ltd.</font>
00007 <font class="comment"> *</font>
00008 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00009 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00010 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00011 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00012 <font class="comment"> * any later version.</font>
00013 <font class="comment"></font>
00014 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00015 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00016 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00017 <font class="comment"> * General Public License for more details.</font>
00018 <font class="comment"></font>
00019 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00020 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00021 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00022 <font class="comment"> * MA 02111-1307, USA.</font>
00023 <font class="comment"> */</font>
00024 
00025 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
00026 
00027 <font class="preprocessor">#include "<a class="code" href="seg__remanence__shape_8h.html">3d/seg_remanence_shape.h</a>"</font>
00028 <font class="preprocessor">#include "<a class="code" href="seg__remanence_8h.html">3d/seg_remanence.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="driver_8h.html">3d/driver.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="scene_8h.html">3d/scene.h</a>"</font>
00031 
00032 
00033 
00034 
00035 <font class="keyword">namespace </font>NL3D
00036 {
00037 
00038 
00039 <font class="comment">//===========================================================</font>
<a name="l00040"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z789_0">00040</a> CSegRemanenceShape::CSegRemanenceShape() : _GeomTouched(true),
00041                                                                                    _MatTouched(true),
00042                                                                                    _TextureShifting(true),
00043                                                                                    _NumSlices(8),
00044                                                                                    _SliceTime(0.05f),
00045                                                                                    _RollUpRatio(1.f),
00046                                                                                    _AnimatedMat(NULL)
00047 {
00048         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o10">_BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_0">setCenter</a>(<a class="code" href="classNLMISC_1_1CVector.html#p0">NLMISC::CVector::Null</a>);
00049         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o10">_BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_1">setHalfSize</a>(<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(3, 3, 3));
00050         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a6">setNumCorners</a>(2);
00051 }
00052 
00053 <font class="comment">//===========================================================</font>
<a name="l00054"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z789_4">00054</a> <font class="keywordtype">void</font> CSegRemanenceShape::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
00055 {
00056         sint ver = f.serialVersion(1);
00057         f.serial(_NumSlices);
00058         f.serial(_SliceTime);
00059         f.serialCont(_Corners); 
00060         f.serial(_Mat); 
00061         f.serial(_BBox);
00062         f.serial(_TextureShifting);
00063         f.serialPtr(_AnimatedMat);
00064         <font class="keywordflow">if</font> (f.isReading())
00065         {       
00066                 _GeomTouched = <font class="keyword">true</font>;
00067                 _MatTouched  = <font class="keyword">true</font>;
00068         }
00069         <font class="keywordflow">if</font> (ver &gt;= 1)
00070         {
00071                 f.serial(_RollUpRatio);
00072         }
00073 }
00074 
00075 <font class="comment">//===========================================================</font>
<a name="l00076"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a5">00076</a> <font class="keywordtype">void</font> CSegRemanenceShape::setSliceTime(<font class="keywordtype">float</font> sliceTime)
00077 {
00078         <a class="code" href="debug_8h.html#a6">nlassert</a>(sliceTime &gt; 0);
00079         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o4">_SliceTime</a> = sliceTime; 
00080 }
00081 
00082 <font class="comment">//===========================================================</font>
<a name="l00083"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a8">00083</a> <font class="keywordtype">void</font> CSegRemanenceShape::setCorner(uint corner, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a415">value</a>)
00084 {
00085         <a class="code" href="debug_8h.html#a6">nlassert</a>(corner &lt; <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>.size());
00086         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>[corner] = value;
00087 }
00088 
00089 <font class="comment">//===========================================================</font>
<a name="l00090"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a2">00090</a> <font class="keywordtype">void</font> CSegRemanenceShape::setNumSlices(uint32 numSlices)
00091 {
00092         <a class="code" href="debug_8h.html#a6">nlassert</a>(numSlices &gt;= 2);
00093         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> = numSlices; 
00094         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o0">_GeomTouched</a> = <font class="keyword">true</font>;
00095 }
00096 
00097 <font class="comment">//===========================================================</font>
<a name="l00098"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a9">00098</a> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> CSegRemanenceShape::getCorner(uint corner)<font class="keyword"> const</font>
00099 <font class="keyword"></font>{
00100         <a class="code" href="debug_8h.html#a6">nlassert</a>(corner &lt; <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>.size());
00101         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>[corner];
00102 }
00103 
00104 <font class="comment">//===========================================================</font>
<a name="l00105"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a6">00105</a> <font class="keywordtype">void</font> CSegRemanenceShape::setNumCorners(uint numCorners)
00106 {
00107         <a class="code" href="debug_8h.html#a6">nlassert</a>(numCorners &gt;= 2);
00108         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>.resize(numCorners);
00109         std::fill(<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>.begin(), <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>.end(), <a class="code" href="classNLMISC_1_1CVector.html#p0">NLMISC::CVector::Null</a>);
00110         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o0">_GeomTouched</a> = <font class="keyword">true</font>;
00111 }
00112 
00113 <font class="comment">//===========================================================</font>
<a name="l00114"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z790_0">00114</a> <font class="keywordtype">void</font> CSegRemanenceShape::render(IDriver *drv, CTransformShape *trans, <font class="keywordtype">bool</font> opaquePass)
00115 {
00116         <font class="keywordflow">if</font> ((!opaquePass &amp;&amp; <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>.getBlend())
00117             || (opaquePass &amp;&amp; !<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>.getBlend())
00118            )
00119         {
00120                 CSegRemanence *sr = NLMISC::safe_cast&lt;CSegRemanence *&gt;(trans);
00121                 <font class="keywordflow">if</font> (!sr-&gt;isStarted()) <font class="keywordflow">return</font>;           
00122                 <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#c0">setupVBnPB</a>();
00123                 <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#c1">setupMaterial</a>();
00124                 <font class="comment">// vertices are rendered in world space</font>
00125                 drv-&gt;setupModelMatrix(<a class="code" href="classNLMISC_1_1CMatrix.html#p0">NLMISC::CMatrix::Identity</a>);               
00126                 <font class="comment">//              </font>
00127                 sr-&gt;render(drv, <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o8">_VB</a>, <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o9">_PB</a>, <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>);                
00128         }
00129 }
00130 
00131 
00132 <font class="comment">//===========================================================</font>
<a name="l00133"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z790_1">00133</a> <font class="keywordtype">void</font> CSegRemanenceShape::flushTextures(IDriver &amp;driver)
00134 {
00135         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>.flushTextures(driver);
00136 }
00137 
00138 <font class="comment">//===========================================================</font>
<a name="l00139"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z790_2">00139</a> CTransformShape *CSegRemanenceShape::createInstance(CScene &amp;scene)
00140 {       
00141         CSegRemanence *sr = NLMISC::safe_cast&lt;CSegRemanence *&gt;(scene.createModel(NL3D::SegRemanenceShapeId) );
00142         sr-&gt;Shape = <font class="keyword">this</font>;
00143         CAnimatedMaterial *aniMat = NULL;
00144         <font class="keywordflow">if</font> (_AnimatedMat)
00145         {
00146                 aniMat = <font class="keyword">new</font> CAnimatedMaterial(<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o11">_AnimatedMat</a>);
00147                 aniMat-&gt;setMaterial(&amp;<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>);             
00148         }
00149         sr-&gt;setAnimatedMaterial(aniMat);
00150         sr-&gt;setupFromShape();
00151         <font class="comment">// SegRemanence are added to the "Fx" Load Balancing Group.</font>
00152         sr-&gt;setLoadBalancingGroup(<font class="stringliteral">"Fx"</font>);
00153         <font class="keywordflow">return</font> sr;
00154 }
00155 
00156 
00157 <font class="comment">//===========================================================</font>
<a name="l00158"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z790_3">00158</a> <font class="keywordtype">float</font> CSegRemanenceShape::getNumTriangles(<font class="keywordtype">float</font> distance)
00159 {
00160         <font class="keywordflow">return</font> (float) (<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> * 2);
00161 }
00162 
00163 
00164 <font class="comment">//===========================================================</font>
<a name="l00165"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#c0">00165</a> <font class="keywordtype">void</font> CSegRemanenceShape::setupVBnPB()
00166 {
00167         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o0">_GeomTouched</a>) <font class="keywordflow">return</font>;
00168 
00169         uint numCorners = <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>.size();
00170         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o8">_VB</a>.setVertexFormat(CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag);
00171         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o8">_VB</a>.setNumVertices(numCorners * (<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + 1));
00172         uint k, <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>;
00173         
00174         <font class="comment">// set tex coords</font>
00175         <font class="keywordflow">for</font>(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; numCorners; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00176         {               
00177                 <font class="keywordflow">for</font>(k = 0; k &lt;= <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a>; ++k)
00178                 {
00179                 
00180                         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o8">_VB</a>.setTexCoord((<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + 1) * <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + k, 0, (<font class="keywordtype">float</font>) k / <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a>, (<font class="keywordtype">float</font>) <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> / (numCorners - 1));
00181                 }
00182         }
00183         <font class="comment">// create primitive block</font>
00184         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o9">_PB</a>.setNumTri(2 * (numCorners - 1) * <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a>);
00185         <font class="comment">//</font>
00186         <font class="keywordflow">for</font>(<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> = 0; <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> &lt; numCorners - 1; ++<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a>)
00187         {
00188                 <font class="keywordflow">for</font>(k = 0; k &lt; <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a>; ++k)
00189                 {
00190                         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o9">_PB</a>.setTri(2 * (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> * <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + k), (<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + 1) * <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + k,  (<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + 1) * (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + 1) + k + 1, (<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + 1) * (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + 1) + k);
00191                         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o9">_PB</a>.setTri(2 * (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> * <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + k) + 1, (<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + 1) * <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + k, (<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + 1) * <a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + k + 1, (<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a> + 1) * (<a class="code" href="namespaceNLAISCRIPT.html#a20">l</a> + 1) + k + 1);
00192                 }
00193         }
00194         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o0">_GeomTouched</a> = <font class="keyword">false</font>;   
00195 }
00196 
00197 <font class="comment">//===========================================================</font>
<a name="l00198"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a10">00198</a> <font class="keywordtype">void</font> CSegRemanenceShape::setBBox(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> &amp;bbox)
00199 {
00200         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o10">_BBox</a> = bbox;
00201 }
00202 
00203 <font class="comment">//===========================================================</font>
<a name="l00204"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a0">00204</a> <font class="keywordtype">void</font> CSegRemanenceShape::setMaterial(<font class="keyword">const</font> CMaterial &amp;mat)
00205 {
00206         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a> = mat;
00207         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o1">_MatTouched</a> = <font class="keyword">true</font>;
00208 }
00209 
00210 <font class="comment">//===========================================================</font>
<a name="l00211"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a11">00211</a> <font class="keywordtype">void</font> CSegRemanenceShape::setTextureShifting(<font class="keywordtype">bool</font> on <font class="comment">/*=true*/</font>)
00212 {
00213         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o2">_TextureShifting</a> = on;
00214         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o1">_MatTouched</a> = <font class="keyword">true</font>;
00215 }
00216 
00217 <font class="comment">//===========================================================</font>
<a name="l00218"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a16">00218</a> <font class="keywordtype">void</font> CSegRemanenceShape::setRollupRatio(<font class="keywordtype">float</font> ratio)
00219 {
00220         <a class="code" href="debug_8h.html#a6">nlassert</a>(ratio &gt; 0);
00221         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o5">_RollUpRatio</a> = ratio;
00222 }
00223 
00224 <font class="comment">//===========================================================</font>
<a name="l00225"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#c1">00225</a> <font class="keywordtype">void</font> CSegRemanenceShape::setupMaterial()
00226 {
00227         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o1">_MatTouched</a>) <font class="keywordflow">return</font>;       
00228         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>.enableUserTexMat(0);
00229         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>.getTexture(0)-&gt;setWrapS(ITexture::Clamp);  
00230         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>.setDoubleSided(<font class="keyword">true</font>);
00231         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>.setLighting(<font class="keyword">false</font>); <font class="comment">// lighting not supported (the vb has no normals anyway..)</font>
00232         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o1">_MatTouched</a> = <font class="keyword">false</font>;
00233 }
00234 
00235 <font class="comment">//===========================================================</font>
<a name="l00236"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#a14">00236</a> <font class="keywordtype">void</font> CSegRemanenceShape::setAnimatedMaterial(<font class="keyword">const</font> std::string &amp;name)
00237 {
00238         <a class="code" href="debug_8h.html#a6">nlassert</a>(!name.empty());
00239         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o11">_AnimatedMat</a> == NULL);
00240         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o11">_AnimatedMat</a>  = <font class="keyword">new</font> CMaterialBase;
00241         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o11">_AnimatedMat</a>-&gt;Name = name;
00242 }
00243 
00244 
00245 
00246 <font class="comment">//===========================================================</font>
<a name="l00247"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z789_2">00247</a> CSegRemanenceShape::CSegRemanenceShape(<font class="keyword">const</font> CSegRemanenceShape &amp;other) : IShape(other), _AnimatedMat(NULL)
00248 {
00249         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#c2">copyFromOther</a>(other);
00250 }
00251 
00252 <font class="comment">//===========================================================</font>
<a name="l00253"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z789_3">00253</a> CSegRemanenceShape &amp;CSegRemanenceShape::operator = (<font class="keyword">const</font> CSegRemanenceShape &amp;other)
00254 {
00255         <font class="keywordflow">if</font> (&amp;other != <font class="keyword">this</font>)
00256         {       
00257                 <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#c2">copyFromOther</a>(other);
00258                 (<a class="code" href="classNL3D_1_1IShape.html#a0">IShape</a> &amp;) *<font class="keyword">this</font> = (<a class="code" href="classNL3D_1_1IShape.html#a0">IShape</a> &amp;) other; <font class="comment">// copy base part  </font>
00259         }
00260         <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00261 }
00262 
00263 <font class="comment">//===========================================================</font>
<a name="l00264"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#z789_1">00264</a> CSegRemanenceShape::~CSegRemanenceShape()
00265 {
00266         <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o11">_AnimatedMat</a>;
00267 }
00268 
00269 <font class="comment">//===========================================================</font>
<a name="l00270"></a><a class="code" href="classNL3D_1_1CSegRemanenceShape.html#c2">00270</a> <font class="keywordtype">void</font> CSegRemanenceShape::copyFromOther(<font class="keyword">const</font> CSegRemanenceShape &amp;other)
00271 {
00272         <font class="keywordflow">if</font> (&amp;other == <font class="keyword">this</font>) <font class="keywordflow">return</font>;
00273         CMaterialBase *otherAnimatedMat = other._AnimatedMat != NULL ? <font class="keyword">new</font> CMaterialBase(*other._AnimatedMat)
00274                                                                                                                                  : NULL;
00275         <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o11">_AnimatedMat</a>;
00276         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o11">_AnimatedMat</a> = otherAnimatedMat;
00277 
00278         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o0">_GeomTouched</a>     = other._GeomTouched;
00279         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o1">_MatTouched</a>      = other._MatTouched; 
00280         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o2">_TextureShifting</a> = other._TextureShifting;      
00281         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o3">_NumSlices</a>       = other._NumSlices;
00282         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o4">_SliceTime</a>       = other._SliceTime;
00283         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o6">_Corners</a>                 = other._Corners;      
00284         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o7">_Mat</a>             = other._Mat;
00285         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o8">_VB</a>              = other._VB;
00286         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o9">_PB</a>              = other._PB;
00287         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o10">_BBox</a>                    = other._BBox; 
00288         <a class="code" href="classNL3D_1_1CSegRemanenceShape.html#o5">_RollUpRatio</a>     = other._RollUpRatio;  
00289 }
00290         
00291 }
00292 
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>