diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/vertex__buffer_8cpp-source.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/vertex__buffer_8cpp-source.html')
-rw-r--r-- | docs/doxygen/nel/vertex__buffer_8cpp-source.html | 1021 |
1 files changed, 1021 insertions, 0 deletions
diff --git a/docs/doxygen/nel/vertex__buffer_8cpp-source.html b/docs/doxygen/nel/vertex__buffer_8cpp-source.html new file mode 100644 index 00000000..0fbd4a2d --- /dev/null +++ b/docs/doxygen/nel/vertex__buffer_8cpp-source.html @@ -0,0 +1,1021 @@ +<!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> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </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> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </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> + + +<!-- 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> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.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">Compound List</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">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <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> </center> +<hr><h1>vertex_buffer.cpp</h1><a href="vertex__buffer_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font> +00008 <font class="comment"> *</font> +00009 <font class="comment"> * This file is part of NEVRAX NEL.</font> +00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font> +00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> +00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font> +00013 <font class="comment"> * any later version.</font> +00014 <font class="comment"></font> +00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font> +00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font> +00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font> +00018 <font class="comment"> * General Public License for more details.</font> +00019 <font class="comment"></font> +00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font> +00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font> +00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font> +00023 <font class="comment"> * MA 02111-1307, USA.</font> +00024 <font class="comment"> */</font> +00025 +00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font> +00027 +00028 <font class="preprocessor">#include "<a class="code" href="vertex__buffer_8h.html">3d/vertex_buffer.h</a>"</font> +00029 <font class="preprocessor">#include "<a class="code" href="vector_8h.html">nel/misc/vector.h</a>"</font> +00030 <font class="preprocessor">#include "<a class="code" href="driver_8h.html">3d/driver.h</a>"</font> +00031 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC; +00032 +00033 +00034 <font class="keyword">namespace </font>NL3D +00035 { +00036 +00037 <font class="comment">// --------------------------------------------------</font> +00038 +<a name="l00039"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#p0">00039</a> <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a13">uint</a> CVertexBuffer::SizeType[NumType]= +00040 { +00041 1*<font class="keyword">sizeof</font>(double), +00042 1*<font class="keyword">sizeof</font>(float), +00043 1*<font class="keyword">sizeof</font>(short), +00044 2*<font class="keyword">sizeof</font>(double), +00045 2*<font class="keyword">sizeof</font>(float), +00046 2*<font class="keyword">sizeof</font>(short), +00047 3*<font class="keyword">sizeof</font>(double), +00048 3*<font class="keyword">sizeof</font>(float), +00049 3*<font class="keyword">sizeof</font>(short), +00050 4*<font class="keyword">sizeof</font>(double), +00051 4*<font class="keyword">sizeof</font>(float), +00052 4*<font class="keyword">sizeof</font>(short), +00053 4*<font class="keyword">sizeof</font>(char), +00054 }; +00055 +00056 <font class="comment">// --------------------------------------------------</font> +00057 +<a name="l00058"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#p1">00058</a> <font class="keyword">const</font> CVertexBuffer::TType CVertexBuffer::DefaultValueType[NumValue]= +00059 { +00060 Float3, <font class="comment">// Position</font> +00061 Float3, <font class="comment">// Normal</font> +00062 Float2, <font class="comment">// TexCoord0</font> +00063 Float2, <font class="comment">// TexCoord1</font> +00064 Float2, <font class="comment">// TexCoord2</font> +00065 Float2, <font class="comment">// TexCoord3</font> +00066 Float2, <font class="comment">// TexCoord4</font> +00067 Float2, <font class="comment">// TexCoord5</font> +00068 Float2, <font class="comment">// TexCoord6</font> +00069 Float2, <font class="comment">// TexCoord7</font> +00070 UChar4, <font class="comment">// Primary color</font> +00071 UChar4, <font class="comment">// Secondary color</font> +00072 Float4, <font class="comment">// 4 Weights</font> +00073 UChar4, <font class="comment">// PaletteSkin</font> +00074 Float1, <font class="comment">// Fog</font> +00075 Float1, <font class="comment">// Empty</font> +00076 }; +00077 +00078 <font class="comment">// --------------------------------------------------</font> +00079 +<a name="l00080"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a0">00080</a> CVertexBuffer::CVertexBuffer() +00081 { +00082 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> = 0; +00083 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = 0; +00084 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> = 0; +00085 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> = 0; +00086 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a> = 0; +00087 } +00088 +00089 <font class="comment">// --------------------------------------------------</font> +00090 +<a name="l00091"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a1">00091</a> CVertexBuffer::CVertexBuffer(<font class="keyword">const</font> CVertexBuffer &vb) +00092 { +00093 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> = 0; +00094 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = 0; +00095 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> = 0; +00096 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a> = 0; +00097 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a3">operator=</a>(vb); +00098 } +00099 +00100 <font class="comment">// --------------------------------------------------</font> +00101 +<a name="l00102"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a2">00102</a> CVertexBuffer::~CVertexBuffer() +00103 { +00104 <font class="comment">// Must kill the drv mirror of this VB.</font> +00105 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z824_2">DrvInfos</a>.kill(); +00106 } +00107 +00108 <font class="comment">// --------------------------------------------------</font> +00109 +<a name="l00110"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a3">00110</a> CVertexBuffer &CVertexBuffer::operator=(<font class="keyword">const</font> CVertexBuffer &vb) +00111 { +00112 <font class="comment">// Single value</font> +00113 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a> = vb._VertexSize; +00114 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> = vb._Flags; +00115 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> = vb._InternalFlags; +00116 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> = vb._NbVerts; +00117 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = vb._Capacity; +00118 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a> = vb._Verts; +00119 +00120 <font class="comment">// Arraies</font> +00121 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> value=0; value<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; value++) +00122 { +00123 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[value]= vb._Offset[value]; +00124 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[value]= vb._Type[value]; +00125 } +00126 +00127 <font class="comment">// Set touch flags</font> +00128 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u2">TouchedAll</a>; +00129 +00130 <font class="keywordflow">return</font> *<font class="keyword">this</font>; +00131 } +00132 +00133 <font class="comment">// --------------------------------------------------</font> +00134 +<a name="l00135"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_0">00135</a> <font class="keywordtype">bool</font> CVertexBuffer::setVertexFormat(<a class="code" href="types__nl_8h.html#a9">uint32</a> flags) +00136 { +00137 <a class="code" href="types__nl_8h.html#a13">uint</a> i; +00138 +00139 <font class="comment">// Clear extended values </font> +00140 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_0">clearValueEx</a> (); +00141 +00142 <font class="comment">// Position ?</font> +00143 <font class="keywordflow">if</font> (flags & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s19">PositionFlag</a>) +00144 { +00145 <font class="comment">// Add a standard position value</font> +00146 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s0">Position</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>); +00147 } +00148 +00149 <font class="comment">// Normal ?</font> +00150 <font class="keywordflow">if</font> (flags & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>) +00151 { +00152 <font class="comment">// Add a standard normal value</font> +00153 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s1">Normal</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>); +00154 } +00155 +00156 <font class="comment">// For each uv values</font> +00157 <font class="keywordflow">for</font>(i=0 ; i<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s49">MaxStage</a> ; i++) +00158 { +00159 <font class="comment">// UV ?</font> +00160 <font class="keywordflow">if</font> (flags & (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a><<i)) +00161 { +00162 <font class="comment">// Add a standard uv value</font> +00163 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> ((<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51">TValue</a>)(<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s2">TexCoord0</a>+i), <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s39">Float2</a>); +00164 } +00165 } +00166 +00167 <font class="comment">// Fog ?</font> +00168 <font class="keywordflow">if</font> (flags & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s33">FogFlag</a>) +00169 { +00170 <font class="comment">// Add a standard primary color value</font> +00171 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s14">Fog</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s36">Float1</a>); +00172 } +00173 +00174 <font class="comment">// Primary color ?</font> +00175 <font class="keywordflow">if</font> (flags & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>) +00176 { +00177 <font class="comment">// Add a standard primary color value</font> +00178 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s10">PrimaryColor</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s47">UChar4</a>); +00179 } +00180 +00181 <font class="comment">// Secondary color ?</font> +00182 <font class="keywordflow">if</font> (flags & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>) +00183 { +00184 <font class="comment">// Add a standard primary color value</font> +00185 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s11">SecondaryColor</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s47">UChar4</a>); +00186 } +00187 +00188 <font class="comment">// Weight ?</font> +00189 <font class="keywordflow">if</font> (flags & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>) +00190 { +00191 <font class="comment">// Add a standard primary color value</font> +00192 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s45">Float4</a>); +00193 } +00194 +00195 <font class="comment">// Palette skin ?</font> +00196 <font class="keywordflow">if</font> ((flags & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>)==CVertexBuffer::PaletteSkinFlag) +00197 { +00198 <font class="comment">// Add a standard primary color value</font> +00199 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s13">PaletteSkin</a>, <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s47">UChar4</a>); +00200 } +00201 +00202 <font class="comment">// Compute the vertex buffer</font> +00203 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_3">initEx</a> (); +00204 +00205 <font class="keywordflow">return</font> (true); +00206 } +00207 +00208 <font class="comment">// --------------------------------------------------</font> +00209 +<a name="l00210"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_22">00210</a> CVertexBuffer::TValue CVertexBuffer::getValueIdByNumberEx (<a class="code" href="types__nl_8h.html#a13">uint</a> valueNumber) +00211 { +00212 <font class="comment">// See NV_vertex_program spec, or driver_opengl_vertex.cpp:: GLVertexAttribIndex.</font> +00213 <font class="keyword">static</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51">TValue</a> lut[16]= { +00214 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s0">Position</a>, +00215 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>, +00216 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s1">Normal</a>, +00217 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s10">PrimaryColor</a>, +00218 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s11">SecondaryColor</a>, +00219 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s14">Fog</a>, +00220 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s13">PaletteSkin</a>, +00221 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s15">Empty</a>, +00222 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s2">TexCoord0</a>, +00223 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s3">TexCoord1</a>, +00224 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s4">TexCoord2</a>, +00225 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s5">TexCoord3</a>, +00226 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s6">TexCoord4</a>, +00227 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s7">TexCoord5</a>, +00228 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s8">TexCoord6</a>, +00229 <a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s9">TexCoord7</a>, +00230 }; +00231 +00232 <font class="keywordflow">return</font> lut[valueNumber]; +00233 } +00234 +00235 <font class="comment">// --------------------------------------------------</font> +00236 +<a name="l00237"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_0">00237</a> <font class="keywordtype">void</font> CVertexBuffer::clearValueEx () +00238 { +00239 <font class="comment">// Reset format flags</font> +00240 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a>=0; +00241 } +00242 +00243 <font class="comment">// --------------------------------------------------</font> +00244 +<a name="l00245"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">00245</a> <font class="keywordtype">void</font> CVertexBuffer::addValueEx (TValue valueId, TType <a class="code" href="driver__opengl__extension__def_8h.html#a240">type</a>) +00246 { +00247 <font class="comment">// Reset format flags</font> +00248 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> |= 1<<valueId; +00249 +00250 <font class="comment">// Set the type</font> +00251 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[valueId]=(uint8)<a class="code" href="driver__opengl__extension__def_8h.html#a240">type</a>; +00252 } +00253 +00254 <font class="comment">// --------------------------------------------------</font> +00255 +<a name="l00256"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_2">00256</a> <font class="keywordtype">bool</font> CVertexBuffer::hasValueEx(TValue valueId)<font class="keyword"> const</font> +00257 <font class="keyword"></font>{ +00258 <font class="keywordflow">return</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & (1 << valueId)) != 0; +00259 } +00260 +00261 <font class="comment">// --------------------------------------------------</font> +00262 +<a name="l00263"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_3">00263</a> <font class="keywordtype">void</font> CVertexBuffer::initEx () +00264 { +00265 <font class="comment">// Reset internal flag</font> +00266 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a>=<a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u2">TouchedAll</a>; +00267 +00268 <font class="comment">// Calc vertex size and set value's offset</font> +00269 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>=0; +00270 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> value=0; value<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; value++) +00271 { +00272 <font class="comment">// Value used ?</font> +00273 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a>&(1<<value)) +00274 { +00275 <font class="comment">// Set offset</font> +00276 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[value]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00277 +00278 <font class="comment">// New size</font> +00279 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#p0">SizeType</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[value]]; +00280 } +00281 } +00282 +00283 <font class="comment">// Reset number of vertices</font> +00284 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>=0; +00285 +00286 <font class="comment">// Compute new capacity</font> +00287 <font class="keywordflow">if</font> (_VertexSize) +00288 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = <a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.size()/<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00289 <font class="keywordflow">else</font> +00290 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a> = 0; +00291 } +00292 +00293 <font class="comment">// --------------------------------------------------</font> +00294 +<a name="l00295"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a7">00295</a> <font class="keywordtype">void</font> CVertexBuffer::reserve(<a class="code" href="types__nl_8h.html#a9">uint32</a> n) +00296 { +00297 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.resize(n*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>); +00298 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a>= n; +00299 } +00300 +00301 <font class="comment">// --------------------------------------------------</font> +00302 +<a name="l00303"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a4">00303</a> <font class="keywordtype">void</font> CVertexBuffer::setNumVertices(<a class="code" href="types__nl_8h.html#a9">uint32</a> n) +00304 { +00305 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a><n) +00306 { +00307 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a7">reserve</a>(n); +00308 } +00309 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> != n) +00310 { +00311 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u1">TouchedNumVertices</a>; +00312 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>=n; +00313 } +00314 } +00315 +00316 <font class="comment">// --------------------------------------------------</font> +00317 +<a name="l00318"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a6">00318</a> <font class="keywordtype">void</font> CVertexBuffer::deleteAllVertices() +00319 { +00320 <font class="comment">// free memory.</font> +00321 <a class="code" href="namespaceNLMISC.html#a197">contReset</a>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>); +00322 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o6">_Capacity</a>= 0; +00323 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>!=0) +00324 { +00325 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>=0; +00326 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u1">TouchedNumVertices</a>; +00327 } +00328 } +00329 +00330 <font class="comment">// --------------------------------------------------</font> +00331 +<a name="l00332"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_18">00332</a> <font class="keywordtype">void</font>* CVertexBuffer::getVertexCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx) +00333 { +00334 <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00335 +00336 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00337 ptr+=(idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>); +00338 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00339 } +00340 +00341 <font class="comment">// --------------------------------------------------</font> +00342 +<a name="l00343"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_19">00343</a> <font class="keywordtype">void</font>* CVertexBuffer::getNormalCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx) +00344 { +00345 <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00346 +00347 <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>) ) +00348 { +00349 <font class="keywordflow">return</font>(NULL); +00350 } +00351 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00352 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s1">Normal</a>]; +00353 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00354 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00355 } +00356 +00357 <font class="comment">// --------------------------------------------------</font> +00358 +<a name="l00359"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_21">00359</a> <font class="keywordtype">void</font>* CVertexBuffer::getColorPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx) +00360 { +00361 <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00362 +00363 <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>) ) +00364 { +00365 <font class="keywordflow">return</font>(NULL); +00366 } +00367 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00368 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s10">PrimaryColor</a>]; +00369 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00370 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00371 } +00372 +00373 <font class="comment">// --------------------------------------------------</font> +00374 +<a name="l00375"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_22">00375</a> <font class="keywordtype">void</font>* CVertexBuffer::getSpecularPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx) +00376 { +00377 <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00378 +00379 <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>) ) +00380 { +00381 <font class="keywordflow">return</font>(NULL); +00382 } +00383 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00384 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s11">SecondaryColor</a>]; +00385 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00386 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00387 } +00388 +00389 <font class="comment">// --------------------------------------------------</font> +00390 +<a name="l00391"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_20">00391</a> <font class="keywordtype">void</font>* CVertexBuffer::getTexCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx, <a class="code" href="types__nl_8h.html#a5">uint8</a> stage) +00392 { +00393 <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00394 +00395 <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a><<stage)) ) +00396 { +00397 <font class="keywordflow">return</font>(NULL); +00398 } +00399 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00400 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s2">TexCoord0</a>+stage]; +00401 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00402 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00403 } +00404 +00405 <font class="comment">// --------------------------------------------------</font> +00406 +<a name="l00407"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_23">00407</a> <font class="keywordtype">void</font>* CVertexBuffer::getWeightPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx, <a class="code" href="types__nl_8h.html#a5">uint8</a> wgt) +00408 { +00409 <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00410 +00411 <a class="code" href="debug_8h.html#a6">nlassert</a>(wgt<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s50">MaxWeight</a>); +00412 <font class="keywordflow">if</font>( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>)) +00413 <font class="keywordflow">return</font> NULL; +00414 +00415 ptr=(<a class="code" href="types__nl_8h.html#a5">uint8</a>*)(&<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>[idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>]); +00416 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]+wgt*<font class="keyword">sizeof</font>(float); +00417 +00418 <font class="keywordflow">return</font> ptr; +00419 } +00420 +00421 <font class="comment">// --------------------------------------------------</font> +00422 +<a name="l00423"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_24">00423</a> <font class="keywordtype">void</font>* CVertexBuffer::getPaletteSkinPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx) +00424 { +00425 <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00426 +00427 <font class="keywordflow">if</font> ( (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>) != CVertexBuffer::PaletteSkinFlag ) +00428 { +00429 <font class="keywordflow">return</font>(NULL); +00430 } +00431 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00432 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s13">PaletteSkin</a>]; +00433 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00434 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00435 } +00436 +00437 <font class="comment">// --------------------------------------------------</font> +00438 +00439 +00441 <font class="comment">// const versions //</font> +00443 <font class="comment"></font> +00444 +00445 <font class="comment">// --------------------------------------------------</font> +00446 +<a name="l00447"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_25">00447</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getVertexCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const </font> +00448 <font class="keyword"></font>{ +00449 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00450 +00451 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00452 ptr+=(idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>); +00453 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00454 } +00455 +00456 <font class="comment">// --------------------------------------------------</font> +00457 +<a name="l00458"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_26">00458</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getNormalCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const</font> +00459 <font class="keyword"></font>{ +00460 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00461 +00462 <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>) ) +00463 { +00464 <font class="keywordflow">return</font>(NULL); +00465 } +00466 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00467 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s1">Normal</a>]; +00468 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00469 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00470 } +00471 +00472 <font class="comment">// --------------------------------------------------</font> +00473 +<a name="l00474"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_28">00474</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getColorPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const</font> +00475 <font class="keyword"></font>{ +00476 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00477 +00478 <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>) ) +00479 { +00480 <font class="keywordflow">return</font>(NULL); +00481 } +00482 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00483 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s10">PrimaryColor</a>]; +00484 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00485 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00486 } +00487 +00488 <font class="comment">// --------------------------------------------------</font> +00489 +<a name="l00490"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_29">00490</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getSpecularPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const</font> +00491 <font class="keyword"></font>{ +00492 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00493 +00494 <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>) ) +00495 { +00496 <font class="keywordflow">return</font>(NULL); +00497 } +00498 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00499 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s11">SecondaryColor</a>]; +00500 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00501 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00502 } +00503 +00504 <font class="comment">// --------------------------------------------------</font> +00505 +<a name="l00506"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_27">00506</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getTexCoordPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx, <a class="code" href="types__nl_8h.html#a5">uint8</a> stage)<font class="keyword"> const</font> +00507 <font class="keyword"></font>{ +00508 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00509 +00510 <font class="keywordflow">if</font> ( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a><<stage)) ) +00511 { +00512 <font class="keywordflow">return</font>(NULL); +00513 } +00514 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00515 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s2">TexCoord0</a>+stage]; +00516 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00517 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00518 } +00519 +00520 <font class="comment">// --------------------------------------------------</font> +00521 +<a name="l00522"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_30">00522</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getWeightPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx, <a class="code" href="types__nl_8h.html#a5">uint8</a> wgt)<font class="keyword"> const</font> +00523 <font class="keyword"></font>{ +00524 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00525 +00526 <a class="code" href="debug_8h.html#a6">nlassert</a>(wgt<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s50">MaxWeight</a>); +00527 <font class="keywordflow">if</font>( !(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>)) +00528 <font class="keywordflow">return</font> NULL; +00529 +00530 ptr=(<a class="code" href="types__nl_8h.html#a5">uint8</a>*)(&<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>[idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>]); +00531 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]+wgt*<font class="keyword">sizeof</font>(float); +00532 +00533 <font class="keywordflow">return</font> ptr; +00534 } +00535 +00536 <font class="comment">// --------------------------------------------------</font> +00537 +<a name="l00538"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_31">00538</a> <font class="keyword">const</font> <font class="keywordtype">void</font>* CVertexBuffer::getPaletteSkinPointer(<a class="code" href="types__nl_8h.html#a13">uint</a> idx)<font class="keyword"> const</font> +00539 <font class="keyword"></font>{ +00540 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a>* ptr; +00541 +00542 <font class="keywordflow">if</font> ( (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>) != CVertexBuffer::PaletteSkinFlag ) +00543 { +00544 <font class="keywordflow">return</font>(NULL); +00545 } +00546 ptr=&(*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o7">_Verts</a>.begin()); +00547 ptr+=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o8">_Offset</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s13">PaletteSkin</a>]; +00548 ptr+=idx*<a class="code" href="classNL3D_1_1CVertexBuffer.html#o2">_VertexSize</a>; +00549 <font class="keywordflow">return</font>((<font class="keywordtype">void</font>*)ptr); +00550 } +00551 +00552 <font class="comment">// --------------------------------------------------</font> +00553 +<a name="l00554"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#c1">00554</a> <a class="code" href="types__nl_8h.html#a7">uint16</a> CVertexBuffer::remapV2Flags (<a class="code" href="types__nl_8h.html#a9">uint32</a> oldFlags, <a class="code" href="types__nl_8h.html#a13">uint</a>& weightCount) +00555 { +00556 <font class="comment">// Old flags</font> +00557 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_XYZ = 0x00000001; +00558 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_W0 = 0x00000002; +00559 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_W1 = 0x00000004; +00560 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_W2 = 0x00000008; +00561 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_W3 = 0x00000010; +00562 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_NORMAL = 0x00000020; +00563 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_COLOR = 0x00000040; +00564 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_SPECULAR = 0x00000080; +00565 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV0 = 0x00000100; +00566 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV1 = 0x00000200; +00567 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV2 = 0x00000400; +00568 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV3 = 0x00000800; +00569 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV4 = 0x00001000; +00570 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV5 = 0x00002000; +00571 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV6 = 0x00004000; +00572 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_UV7 = 0x00008000; +00573 <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a9">uint32</a> OLD_IDRV_VF_PALETTE_SKIN = 0x00010000 | OLD_IDRV_VF_W0 | OLD_IDRV_VF_W1 | OLD_IDRV_VF_W2 | OLD_IDRV_VF_W3; +00574 +00575 <font class="comment">// Old Flags</font> +00576 <a class="code" href="types__nl_8h.html#a7">uint16</a> newFlags=0; +00577 +00578 <font class="comment">// Number of weight values</font> +00579 weightCount=0; +00580 +00581 <font class="comment">// Remap the flags</font> +00582 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_XYZ) +00583 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s19">PositionFlag</a>; +00584 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_NORMAL) +00585 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>; +00586 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_COLOR) +00587 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>; +00588 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_SPECULAR) +00589 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>; +00590 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_UV0) +00591 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a>; +00592 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_UV1) +00593 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s22">TexCoord1Flag</a>; +00594 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_UV2) +00595 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s23">TexCoord2Flag</a>; +00596 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_UV3) +00597 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s24">TexCoord3Flag</a>; +00598 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_UV4) +00599 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s25">TexCoord4Flag</a>; +00600 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_UV5) +00601 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s26">TexCoord5Flag</a>; +00602 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_UV6) +00603 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s27">TexCoord6Flag</a>; +00604 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_UV7) +00605 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s28">TexCoord7Flag</a>; +00606 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_W0) +00607 { +00608 weightCount=1; +00609 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>; +00610 } +00611 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_W1) +00612 { +00613 weightCount=2; +00614 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>; +00615 } +00616 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_W2) +00617 { +00618 weightCount=3; +00619 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>; +00620 } +00621 <font class="keywordflow">if</font> (oldFlags&OLD_IDRV_VF_W3) +00622 { +00623 weightCount=4; +00624 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s31">WeightFlag</a>; +00625 } +00626 <font class="keywordflow">if</font> (oldFlags&(OLD_IDRV_VF_PALETTE_SKIN)) +00627 newFlags|=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>; +00628 +00629 <font class="comment">// Return the new flags</font> +00630 <font class="keywordflow">return</font> newFlags; +00631 } +00632 +00633 <font class="comment">// --------------------------------------------------</font> +00634 +<a name="l00635"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#c0">00635</a> <font class="keywordtype">void</font> CVertexBuffer::serialOldV1Minus(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f, <a class="code" href="types__nl_8h.html#a12">sint</a> ver) +00636 { +00637 <font class="comment">/*</font> +00638 <font class="comment"> Version 1:</font> +00639 <font class="comment"> - PaletteSkin version.</font> +00640 <font class="comment"> Version 0:</font> +00641 <font class="comment"> - base verison.</font> +00642 <font class="comment"> */</font> +00643 +00644 <font class="comment">// old Flags</font> +00645 <a class="code" href="types__nl_8h.html#a9">uint32</a> oldFlags; +00646 +00647 <font class="comment">// Serial VBuffers format/size.</font> +00648 <font class="comment">//=============================</font> +00649 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(oldFlags); +00650 +00651 <font class="comment">// Remap the flags</font> +00652 <a class="code" href="types__nl_8h.html#a13">uint</a> weightCount; +00653 <a class="code" href="types__nl_8h.html#a7">uint16</a> newFlags=<a class="code" href="classNL3D_1_1CVertexBuffer.html#c1">remapV2Flags</a> (oldFlags, weightCount); +00654 +00655 <font class="comment">// Must be reading</font> +00656 <a class="code" href="debug_8h.html#a6">nlassert</a> (f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()); +00657 +00658 <font class="comment">// Set default value type</font> +00659 <a class="code" href="types__nl_8h.html#a13">uint</a> i; +00660 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; i++) +00661 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[i]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#p1">DefaultValueType</a>[i]; +00662 +00663 <a class="code" href="types__nl_8h.html#a9">uint32</a> nbVert; <font class="comment">// Read only</font> +00664 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(nbVert); +00665 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a7">reserve</a>(0); +00666 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_0">setVertexFormat</a>(newFlags); +00667 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a4">setNumVertices</a>(nbVert); +00668 <font class="comment">// All other infos (but _Verts) are computed by setVertexFormat() and setNumVertices().</font> +00669 +00670 <font class="comment">// Weight count ?</font> +00671 <font class="keywordflow">switch</font> (weightCount) +00672 { +00673 <font class="keywordflow">case</font> 1: +00674 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s36">Float1</a>; +00675 <font class="keywordflow">break</font>; +00676 <font class="keywordflow">case</font> 2: +00677 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s39">Float2</a>; +00678 <font class="keywordflow">break</font>; +00679 <font class="keywordflow">case</font> 3: +00680 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>; +00681 <font class="keywordflow">break</font>; +00682 <font class="keywordflow">case</font> 4: +00683 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s45">Float4</a>; +00684 <font class="keywordflow">break</font>; +00685 } +00686 +00687 <font class="comment">// Serial VBuffers components.</font> +00688 <font class="comment">//============================</font> +00689 <font class="keywordflow">for</font>(<a class="code" href="types__nl_8h.html#a12">sint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>=0;<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a><(sint)<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>;<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>++) +00690 { +00691 <font class="comment">// XYZ.</font> +00692 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s19">PositionFlag</a>) +00693 { +00694 CVector &vert= *(CVector*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_18">getVertexCoordPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>); +00695 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(vert); +00696 } +00697 <font class="comment">// Normal</font> +00698 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s20">NormalFlag</a>) +00699 { +00700 CVector &norm= *(CVector*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_19">getNormalCoordPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>); +00701 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(norm); +00702 } +00703 <font class="comment">// Uvs.</font> +00704 <font class="keywordflow">for</font>(i=0;i<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s49">MaxStage</a>;i++) +00705 { +00706 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a><<i)) +00707 { +00708 CUV &uv= *(CUV*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_20">getTexCoordPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>, i); +00709 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(uv); +00710 } +00711 } +00712 <font class="comment">// Color.</font> +00713 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s29">PrimaryColorFlag</a>) +00714 { +00715 CRGBA &col= *(CRGBA*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_21">getColorPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>); +00716 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(col); +00717 } +00718 <font class="comment">// Specular.</font> +00719 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s30">SecondaryColorFlag</a>) +00720 { +00721 CRGBA &col= *(CRGBA*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_22">getSpecularPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>); +00722 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(col); +00723 } +00724 <font class="comment">// Weights</font> +00725 <font class="keywordflow">for</font>(i=0;i<weightCount;i++) +00726 { +00727 <font class="comment">// Weight channel available ?</font> +00728 <font class="keywordtype">float</font> &<a class="code" href="driver__opengl__extension__def_8h.html#a234">w</a>= *(<font class="keywordtype">float</font>*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_23">getWeightPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>, i); +00729 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a234">w</a>); +00730 } +00731 <font class="comment">// CPaletteSkin (version 1+ only).</font> +00732 <font class="keywordflow">if</font>((ver>=1) && ((<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & <a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s32">PaletteSkinFlag</a>) == CVertexBuffer::PaletteSkinFlag) ) +00733 { +00734 CPaletteSkin &ps= *(CPaletteSkin*)<a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_24">getPaletteSkinPointer</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>); +00735 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(ps); +00736 } +00737 +00738 } +00739 +00740 <font class="comment">// Set touch flags</font> +00741 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> = 0; +00742 <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00743 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u2">TouchedAll</a>; +00744 } +00745 +00746 <font class="comment">// --------------------------------------------------</font> +00747 +<a name="l00748"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a13">00748</a> <font class="keywordtype">void</font> CVertexBuffer::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) +00749 { +00750 <font class="comment">/*</font> +00751 <font class="comment"> Version 2:</font> +00752 <font class="comment"> - cut to use serialHeader() serialSubset().</font> +00753 <font class="comment"> Version 1:</font> +00754 <font class="comment"> - PaletteSkin version.</font> +00755 <font class="comment"> Version 0:</font> +00756 <font class="comment"> - base verison.</font> +00757 <font class="comment"> */</font> +00758 <a class="code" href="types__nl_8h.html#a12">sint</a> ver= f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(2); +00759 +00760 <font class="keywordflow">if</font> (ver<2) +00761 { +00762 <font class="comment">// old serial method</font> +00763 <a class="code" href="classNL3D_1_1CVertexBuffer.html#c0">serialOldV1Minus</a>(f, ver); +00764 } +00765 <font class="keywordflow">else</font> +00766 { +00767 <font class="comment">// read write the header of the VBuffer.</font> +00768 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z827_0">serialHeader</a>(f); +00769 +00770 <font class="comment">// read write the entire subset.</font> +00771 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z827_1">serialSubset</a>(f, 0, <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>); +00772 } +00773 } +00774 +00775 <font class="comment">// --------------------------------------------------</font> +00776 +<a name="l00777"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z827_0">00777</a> <font class="keywordtype">void</font> CVertexBuffer::serialHeader(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) +00778 { +00779 <font class="comment">/*</font> +00780 <font class="comment"> Version 1:</font> +00781 <font class="comment"> - Extended vertex format management.</font> +00782 <font class="comment"> Version 0:</font> +00783 <font class="comment"> - base verison of the header serialisation.</font> +00784 <font class="comment"> */</font> +00785 <a class="code" href="types__nl_8h.html#a12">sint</a> ver= f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(1); +00786 +00787 <font class="comment">// Serial VBuffers format/size.</font> +00788 <font class="comment">//=============================</font> +00789 +00790 <font class="comment">// Flags</font> +00791 <a class="code" href="types__nl_8h.html#a7">uint16</a> flags=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a>; +00792 +00793 <font class="keywordflow">if</font> (ver<1) +00794 { +00795 <font class="comment">// Must be reading</font> +00796 <a class="code" href="debug_8h.html#a6">nlassert</a> (f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()); +00797 +00798 <font class="comment">// Serial old flags</font> +00799 <a class="code" href="types__nl_8h.html#a9">uint32</a> oldFlags; +00800 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(oldFlags); +00801 +00802 <font class="comment">// Remap flags</font> +00803 <a class="code" href="types__nl_8h.html#a13">uint</a> weightCount; +00804 flags=<a class="code" href="classNL3D_1_1CVertexBuffer.html#c1">remapV2Flags</a> (oldFlags, weightCount); +00805 +00806 <font class="comment">// Set default value type</font> +00807 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> i=0; i<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; i++) +00808 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[i]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#p1">DefaultValueType</a>[i]; +00809 +00810 <font class="comment">// weight count ?</font> +00811 <font class="keywordflow">switch</font> (weightCount) +00812 { +00813 <font class="keywordflow">case</font> 1: +00814 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s36">Float1</a>; +00815 <font class="keywordflow">break</font>; +00816 <font class="keywordflow">case</font> 2: +00817 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s39">Float2</a>; +00818 <font class="keywordflow">break</font>; +00819 <font class="keywordflow">case</font> 3: +00820 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>; +00821 <font class="keywordflow">break</font>; +00822 <font class="keywordflow">case</font> 4: +00823 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]=<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s45">Float4</a>; +00824 <font class="keywordflow">break</font>; +00825 } +00826 } +00827 <font class="keywordflow">else</font> +00828 { +00829 <font class="comment">// Serial new vertex flags</font> +00830 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(flags); +00831 +00832 <font class="comment">// Serial type of values</font> +00833 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> i=0; i<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; i++) +00834 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[i]); +00835 } +00836 +00837 <font class="comment">// Serial nb vertices</font> +00838 <a class="code" href="types__nl_8h.html#a9">uint32</a> nbVerts=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>; +00839 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(nbVerts); +00840 +00841 <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00842 { +00843 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a7">reserve</a>(0); +00844 +00845 <font class="comment">// Init vertex format setup</font> +00846 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_0">clearValueEx</a> (); +00847 +00848 <font class="comment">// Init vertex format</font> +00849 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> i=0; i<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; i++) +00850 { +00851 <font class="comment">// Setup this value ?</font> +00852 <font class="keywordflow">if</font> (flags&(1<<i)) +00853 { +00854 <font class="comment">// Add a value</font> +00855 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_1">addValueEx</a> ((<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51">TValue</a>)i, (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s54">TType</a>)<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[i]); +00856 } +00857 } +00858 +00859 <font class="comment">// Build final vertex format</font> +00860 <a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_3">initEx</a> (); +00861 +00862 <font class="comment">// Set num of vertices</font> +00863 <a class="code" href="classNL3D_1_1CVertexBuffer.html#a4">setNumVertices</a>(nbVerts); +00864 } +00865 <font class="comment">// All other infos (but _Verts) are computed by initEx() and setNumVertices().</font> +00866 } +00867 +00868 +00869 <font class="comment">// --------------------------------------------------</font> +<a name="l00870"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z825_2">00870</a> <a class="code" href="types__nl_8h.html#a13">uint</a> CVertexBuffer:: getNumTexCoordUsed()<font class="keyword"> const</font> +00871 <font class="keyword"></font>{ +00872 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a12">sint</a> k = (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s55s49">MaxStage</a> - 1); k >= 0; --k) +00873 { +00874 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a> & (<a class="code" href="classNL3D_1_1CVertexBuffer.html#s53s21">TexCoord0Flag</a> << k)) <font class="keywordflow">return</font> (uint) (k + 1); +00875 } +00876 <font class="keywordflow">return</font> 0; +00877 } +00878 +00879 <font class="comment">// --------------------------------------------------</font> +00880 +<a name="l00881"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#a12">00881</a> <a class="code" href="types__nl_8h.html#a5">uint8</a> CVertexBuffer::getNumWeight ()<font class="keyword"> const</font> +00882 <font class="keyword"></font>{ +00883 <font class="comment">// Num weight</font> +00884 <font class="keywordflow">switch</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s12">Weight</a>]) +00885 { +00886 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s36">Float1</a>: +00887 <font class="keywordflow">return</font> 1; +00888 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s39">Float2</a>: +00889 <font class="keywordflow">return</font> 2; +00890 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s42">Float3</a>: +00891 <font class="keywordflow">return</font> 3; +00892 <font class="keywordflow">case</font> <a class="code" href="classNL3D_1_1CVertexBuffer.html#s54s45">Float4</a>: +00893 <font class="keywordflow">return</font> 4; +00894 } +00895 +00896 <font class="comment">// No weight</font> +00897 <font class="keywordflow">return</font> 0; +00898 } +00899 +00900 <font class="comment">// --------------------------------------------------</font> +00901 +<a name="l00902"></a><a class="code" href="classNL3D_1_1CVertexBuffer.html#z827_1">00902</a> <font class="keywordtype">void</font> CVertexBuffer::serialSubset(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f, <a class="code" href="types__nl_8h.html#a13">uint</a> vertexStart, <a class="code" href="types__nl_8h.html#a13">uint</a> vertexEnd) +00903 { +00904 <font class="comment">/*</font> +00905 <font class="comment"> Version 1:</font> +00906 <font class="comment"> - weight is 4 float in standard format.</font> +00907 <font class="comment"> Version 0:</font> +00908 <font class="comment"> - base verison of a vbuffer subset serialisation.</font> +00909 <font class="comment"> */</font> +00910 <a class="code" href="types__nl_8h.html#a12">sint</a> ver= f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(1); +00911 +00912 +00913 <font class="comment">// Serial VBuffers components.</font> +00914 <font class="comment">//============================</font> +00915 <a class="code" href="debug_8h.html#a6">nlassert</a>(vertexStart<<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a> || <a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>==0); +00916 <a class="code" href="debug_8h.html#a6">nlassert</a>(vertexEnd<=<a class="code" href="classNL3D_1_1CVertexBuffer.html#o5">_NbVerts</a>); +00917 <font class="keywordflow">for</font>(<a class="code" href="types__nl_8h.html#a13">uint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>=vertexStart; <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a><vertexEnd; <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>++) +00918 { +00919 <font class="comment">// For each value</font> +00920 <font class="keywordflow">for</font> (<a class="code" href="types__nl_8h.html#a13">uint</a> value=0; value<<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51s16">NumValue</a>; value++) +00921 { +00922 <font class="comment">// Value used ?</font> +00923 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CVertexBuffer.html#o3">_Flags</a>&(1<<value)) +00924 { +00925 <font class="comment">// Get the pointer on it</font> +00926 <font class="keywordtype">void</font> *ptr=<a class="code" href="classNL3D_1_1CVertexBuffer.html#z826_19">getValueEx</a> ((<a class="code" href="classNL3D_1_1CVertexBuffer.html#s51">TValue</a>)value, <a class="code" href="driver__opengl__extension__def_8h.html#a223">id</a>); +00927 f.<a class="code" href="classNLMISC_1_1IStream.html#z316_0">serialBuffer</a> ((<a class="code" href="types__nl_8h.html#a5">uint8</a>*)ptr, <a class="code" href="classNL3D_1_1CVertexBuffer.html#p0">SizeType</a>[<a class="code" href="classNL3D_1_1CVertexBuffer.html#o0">_Type</a>[value]]); +00928 } +00929 } +00930 } +00931 +00932 <font class="comment">// Set touch flags</font> +00933 <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00934 <a class="code" href="classNL3D_1_1CVertexBuffer.html#o4">_InternalFlags</a> |= <a class="code" href="classNL3D_1_1CVertexBuffer.html#u3u2">TouchedAll</a>; +00935 } +00936 +00937 <font class="comment">// --------------------------------------------------</font> +00938 +00939 <font class="comment">// CPaletteSkin serial (no version chek).</font> +<a name="l00940"></a><a class="code" href="structNL3D_1_1CPaletteSkin.html#a0">00940</a> <font class="keywordtype">void</font> CPaletteSkin::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) +00941 { +00942 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="structNL3D_1_1CPaletteSkin.html#m0">MatrixId</a>[0], <a class="code" href="structNL3D_1_1CPaletteSkin.html#m0">MatrixId</a>[1], <a class="code" href="structNL3D_1_1CPaletteSkin.html#m0">MatrixId</a>[2], <a class="code" href="structNL3D_1_1CPaletteSkin.html#m0">MatrixId</a>[3]); +00943 } +00944 +00945 <font class="comment">// --------------------------------------------------</font> +00946 +<a name="l00947"></a><a class="code" href="classNL3D_1_1IVBDrvInfos.html#a1">00947</a> IVBDrvInfos::~IVBDrvInfos() +00948 { +00949 <a class="code" href="classNL3D_1_1IVBDrvInfos.html#o0">_Driver</a>->removeVBDrvInfoPtr(<a class="code" href="classNL3D_1_1IVBDrvInfos.html#o1">_DriverIterator</a>); +00950 } +00951 +00952 <font class="comment">// --------------------------------------------------</font> +00953 +00954 } +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </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> |