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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: shape.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"> <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>shape.cpp</h1><a href="a04953.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00007 <span class="comment">/* Copyright, 2000 Nevrax Ltd.</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * This file is part of NEVRAX NEL.</span>
00010 <span class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</span>
00011 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
00012 <span class="comment"> * the Free Software Foundation; either version 2, or (at your option)</span>
00013 <span class="comment"> * any later version.</span>
00014 <span class="comment"></span>
00015 <span class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</span>
00016 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00017 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
00018 <span class="comment"> * General Public License for more details.</span>
00019 <span class="comment"></span>
00020 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
00021 <span class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</span>
00022 <span class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</span>
00023 <span class="comment"> * MA 02111-1307, USA.</span>
00024 <span class="comment"> */</span>
00025
00026 <span class="preprocessor">#include "<a class="code" href="a05015.html">std3d.h</a>"</span>
00027
00028 <span class="preprocessor">#include "<a class="code" href="a04954.html">3d/shape.h</a>"</span>
00029 <span class="preprocessor">#include "<a class="code" href="a05148.html">3d/transform_shape.h</a>"</span>
00030 <span class="preprocessor">#include "<a class="code" href="a04926.html">3d/scene.h</a>"</span>
00031
00032 <span class="preprocessor">#include <string></span>
00033
00034
00035 <span class="keyword">using</span> <span class="keyword">namespace </span>NLMISC;
00036
00037
00038 <span class="keyword">namespace </span>NL3D
00039 {
00040
00041
00042 <span class="comment">// ***************************************************************************</span>
00043 <span class="comment">// ***************************************************************************</span>
00044 <span class="comment">// IShape</span>
00045 <span class="comment">// ***************************************************************************</span>
00046 <span class="comment">// ***************************************************************************</span>
00047
00048
00049 <span class="comment">// ***************************************************************************</span>
<a name="l00050"></a><a class="code" href="a02539.html#NL3D_1_1IShapea1">00050</a> <a class="code" href="a02537.html">CTransformShape</a> *IShape::createInstance(<a class="code" href="a03348.html">CScene</a> &scene)
00051 {
00052 <a class="code" href="a02537.html">CTransformShape</a> *mo= (<a class="code" href="a02537.html">CTransformShape</a>*)scene.<a class="code" href="a03348.html#NL3D_1_1CScenez804_0">createModel</a>(NL3D::TransformShapeId);
00053 mo-><a class="code" href="a02537.html#NL3D_1_1CWaveMakerModelo2">Shape</a>= <span class="keyword">this</span>;
00054 <span class="keywordflow">return</span> mo;
00055 }
00056
00057
00058 <span class="comment">// ***************************************************************************</span>
<a name="l00059"></a><a class="code" href="a02539.html#NL3D_1_1IShapea7">00059</a> IShape::IShape()
00060 {
00061 _DistMax= -1;
00062 }
00063
00064
00065 <span class="comment">// ***************************************************************************</span>
<a name="l00066"></a><a class="code" href="a02539.html#NL3D_1_1IShapea11">00066</a> <span class="keywordtype">void</span> IShape::setDistMax(<span class="keywordtype">float</span> distMax)
00067 {
00068 _DistMax= distMax;
00069 <span class="comment">// normalize infinite setup.</span>
00070 <span class="keywordflow">if</span>(distMax<0)
00071 _DistMax= -1;
00072 }
00073
00074
00075 <span class="comment">// ***************************************************************************</span>
<a name="l00076"></a><a class="code" href="a02539.html#NL3D_1_1IShapea3">00076</a> <span class="keywordtype">void</span> IShape::getAABBox(<a class="code" href="a02156.html">CAABBox</a> &bbox)<span class="keyword"> const</span>
00077 <span class="keyword"></span>{
00078 bbox.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1902_1">setCenter</a>(CVector::Null);
00079 bbox.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1902_2">setHalfSize</a>(CVector::Null);
00080 }
00081
00082
00083 <span class="comment">// ***************************************************************************</span>
00084 <span class="comment">// ***************************************************************************</span>
00085 <span class="comment">// CShapeStream</span>
00086 <span class="comment">// ***************************************************************************</span>
00087 <span class="comment">// ***************************************************************************</span>
00088
00089
00090 <span class="comment">// ***************************************************************************</span>
<a name="l00091"></a><a class="code" href="a03381.html#NL3D_1_1CShapeStreama1">00091</a> CShapeStream::CShapeStream ()
00092 {
00093 _Shape=NULL;
00094 }
00095
00096
00097 <span class="comment">// ***************************************************************************</span>
<a name="l00098"></a><a class="code" href="a03381.html#NL3D_1_1CShapeStreama0">00098</a> CShapeStream::CShapeStream (<a class="code" href="a02539.html">IShape</a>* shape)
00099 {
00100 <span class="comment">// Set the pointer</span>
00101 <a class="code" href="a03381.html#NL3D_1_1CShapeStreama4">setShapePointer</a> (shape);
00102 }
00103
00104
00105 <span class="comment">// ***************************************************************************</span>
<a name="l00106"></a><a class="code" href="a03381.html#NL3D_1_1CShapeStreama4">00106</a> <span class="keywordtype">void</span> CShapeStream::setShapePointer (<a class="code" href="a02539.html">IShape</a>* shape)
00107 {
00108 _Shape=shape;
00109 }
00110
00111
00112 <span class="comment">// ***************************************************************************</span>
<a name="l00113"></a><a class="code" href="a03381.html#NL3D_1_1CShapeStreama2">00113</a> <a class="code" href="a02539.html">IShape</a>* CShapeStream::getShapePointer ()<span class="keyword"> const</span>
00114 <span class="keyword"></span>{
00115 <span class="keywordflow">return</span> _Shape;
00116 }
00117
00118
00119 <span class="comment">// ***************************************************************************</span>
<a name="l00120"></a><a class="code" href="a03381.html#NL3D_1_1CShapeStreama3">00120</a> <span class="keywordtype">void</span> CShapeStream::serial(<a class="code" href="a02270.html">NLMISC::IStream</a> &f) <span class="keywordflow">throw</span>(<a class="code" href="a03781.html">NLMISC::EStream</a>)
00121 {
00122 <span class="comment">// First, serial an header or checking if it is correct</span>
00123 f.serialCheck ((<a class="code" href="a04558.html#a11">uint32</a>)'PAHS');
00124
00125 <span class="comment">// Then, serial the shape</span>
00126 f.serialPolyPtr (_Shape);
00127
00128 <span class="comment">// Ok, it's done</span>
00129 }
00130
00131 } <span class="comment">// NL3D</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:37:17 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
</a>1.3.6 </small></address>
</body>
</html>
|