aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03172.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a03172.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/a03172.html576
1 files changed, 576 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03172.html b/docs/doxygen/nel/a03172.html
new file mode 100644
index 00000000..b4c5d4ce
--- /dev/null
+++ b/docs/doxygen/nel/a03172.html
@@ -0,0 +1,576 @@
+<!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: NL3D::CPSConstraintMeshHelper class Reference</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&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
+<h1>NL3D::CPSConstraintMeshHelper Class Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
+Well, we could have put a method template in <a class="el" href="a03161.html">CPSConstraintMesh</a>, but some compilers want the definition of the methods in the header, and some compilers don't want friend with function template, so we use a static method template of a friend class instead, which gives us the same result :)
+<p>
+
+<p>
+Definition at line <a class="el" href="a06250.html#l00517">517</a> of file <a class="el" href="a06250.html">ps_mesh.cpp</a>.<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03172.html#NL3D_1_1CPSConstraintMeshHelpere0">drawMeshs</a> (T posIt, <a class="el" href="a03161.html">CPSConstraintMesh</a> &amp;m, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>, <a class="el" href="a04558.html#a11">uint32</a> srcStep, bool opaque)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T, class U&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03172.html#NL3D_1_1CPSConstraintMeshHelpere1">drawPrerotatedMeshs</a> (T posIt, U indexIt, <a class="el" href="a03161.html">CPSConstraintMesh</a> &amp;m, <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a04223.html#a587">size</a>, <a class="el" href="a04558.html#a11">uint32</a> srcStep, bool opaque, <a class="el" href="a05363.html#a366">TAnimationTime</a> ellapsedTime)</td></tr>
+
+</table>
+<hr><h2>Member Function Documentation</h2>
+<a class="anchor" name="NL3D_1_1CPSConstraintMeshHelpere0" doxytag="NL3D::CPSConstraintMeshHelper::drawMeshs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" colspan="4">
+template&lt;class T&gt; </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap valign="top"> void NL3D::CPSConstraintMeshHelper::drawMeshs </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">T&nbsp;</td>
+ <td class="mdname" nowrap> <em>posIt</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a03161.html">CPSConstraintMesh</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>m</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>size</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcStep</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>opaque</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [inline, static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+get a vb in which to write. It has the same format than the input mesh, but can also have a color flag added<p>
+unmorphed case<p>
+constant case
+<p>
+Definition at line <a class="el" href="a06250.html#l00521">521</a> of file <a class="el" href="a06250.html">ps_mesh.cpp</a>.
+<p>
+References <a class="el" href="a06258.html#l00228">NL3D::CPSColoredParticle::_ColorScheme</a>, <a class="el" href="a06251.html#l00574">NL3D::CPSConstraintMesh::_GlobalAnimDate</a>, <a class="el" href="a03161.html#NL3D_1_1CPSConstraintMesht0">NL3D::CPSConstraintMesh::_MeshDisplayShare</a>, <a class="el" href="a06251.html#l00468">NL3D::CPSConstraintMesh::_Meshes</a>, <a class="el" href="a06251.html#l00580">NL3D::CPSConstraintMesh::_MorphScheme</a>, <a class="el" href="a06251.html#l00579">NL3D::CPSConstraintMesh::_MorphValue</a>, <a class="el" href="a06247.html#l01026">NL3D::CPSLocatedBindable::_Owner</a>, <a class="el" href="a06258.html#l00289">NL3D::CPSSizedParticle::_ParticleSize</a>, <a class="el" href="a06258.html#l00697">NL3D::CPSRotated3DPlaneParticle::_PlaneBasis</a>, <a class="el" href="a06258.html#l00695">NL3D::CPSRotated3DPlaneParticle::_PlaneBasisScheme</a>, <a class="el" href="a06258.html#l00290">NL3D::CPSSizedParticle::_SizeScheme</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera2">NL3D::IDriver::activeVertexBuffer()</a>, <a class="el" href="a06249.html#l00039">CHECK_VERTEX_BUFFER</a>, <a class="el" href="a06250.html#l01825">NL3D::CPSConstraintMesh::computeColors()</a>, <a class="el" href="a06251.html#l00064">NL3D::ConstraintMeshBufSize</a>, <a class="el" href="a06250.html#l01802">NL3D::CPSConstraintMesh::doRenderPasses()</a>, <a class="el" href="a06247.html#l00890">NL3D::CPSLocatedBindable::getDriver()</a>, <a class="el" href="a06711.html#l00338">NL3D::CVertexBuffer::getNormalOff()</a>, <a class="el" href="a06711.html#l00453">NL3D::CVertexBuffer::getNumVertices()</a>, <a class="el" href="a06151.html#l00111">NL3D::CParticleSystemProcess::getOwner()</a>, <a class="el" href="a06143.html#l00311">NL3D::CParticleSystem::getSystemDate()</a>, <a class="el" href="a05989.html#l02432">NL3D::CMesh::getVertexBuffer()</a>, <a class="el" href="a06710.html#l00438">NL3D::CVertexBuffer::getVertexCoordPointer()</a>, <a class="el" href="a06711.html#l00319">NL3D::CVertexBuffer::getVertexFormat()</a>, <a class="el" href="a06711.html#l00473">NL3D::CVertexBuffer::getVertexSize()</a>, <a class="el" href="a05972.html#l00200">NLMISC::CMatrix::identity()</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker&lt; CPlaneBasis &gt;::make()</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker&lt; float &gt;::make()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06251.html#l00449">NL3D::CPSConstraintMesh::CMeshDisplay::RdrPasses</a>, <a class="el" href="a05972.html#l00644">NLMISC::CMatrix::scale()</a>, <a class="el" href="a05972.html#l00209">NLMISC::CMatrix::setRot()</a>, <a class="el" href="a06246.html#l02142">NL3D::CPSLocatedBindable::setupDriverModelMatrix()</a>, <a class="el" href="a06250.html#l01729">NL3D::CPSConstraintMesh::setupRenderPasses()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06251.html#l00450">NL3D::CPSConstraintMesh::CMeshDisplay::VB</a>, <a class="el" href="a06259.html#l00048">NL3D::CPlaneBasis::X</a>, and <a class="el" href="a06259.html#l00049">NL3D::CPlaneBasis::Y</a>.
+<p>
+<div class="fragment"><pre>00522 {
+00523 CMesh &amp;mesh = * NLMISC::safe_cast&lt;CMesh *&gt;((IShape *) m._Meshes[0]);
+00524 <span class="keyword">const</span> CVertexBuffer &amp;modelVb = mesh.getVertexBuffer();
+00525
+00526 <span class="comment">// size for model vertices</span>
+00527 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> inVSize = modelVb.getVertexSize(); <span class="comment">// vertex size </span>
+00528
+00529 <span class="comment">// driver setup</span>
+00530 IDriver *driver = m.getDriver();
+00531 m.setupDriverModelMatrix();
+00532
+00533 <span class="comment">// buffer to compute sizes</span>
+00534 <span class="keywordtype">float</span> sizes[<a class="code" href="a05363.html#a264">ConstraintMeshBufSize</a>];
+00535
+00536 <span class="keywordtype">float</span> *ptCurrSize;
+00537 <a class="code" href="a04558.html#a15">uint</a> ptCurrSizeIncrement = m._SizeScheme ? 1 : 0;
+00538
+00539 T endPosIt;
+00540 <a class="code" href="a04558.html#a15">uint</a> leftToDo = <a class="code" href="a04223.html#a587">size</a>, toProcess;
+00541
+00543 CPSConstraintMesh::CMeshDisplay &amp;md= m._MeshDisplayShare.getMeshDisplay(m._Meshes[0], modelVb.getVertexFormat()
+00544 | (m._ColorScheme ? CVertexBuffer::PrimaryColorFlag : 0));
+00545
+00546 m.setupRenderPasses((<span class="keywordtype">float</span>) m._Owner-&gt;getOwner()-&gt;getSystemDate() - m._GlobalAnimDate, md.RdrPasses, opaque);
+00547
+00548 CVertexBuffer &amp;outVb = md.VB;
+00549 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> outVSize = outVb.getVertexSize();
+00550
+00551 driver-&gt;activeVertexBuffer(outVb);
+00552
+00553 <span class="comment">// we don't have precomputed mesh there ... so each mesh must be transformed, which is the worst case </span>
+00554 CPlaneBasis planeBasis[<a class="code" href="a05363.html#a264">ConstraintMeshBufSize</a>];
+00555 CPlaneBasis *ptBasis;
+00556 <a class="code" href="a04558.html#a15">uint</a> ptBasisIncrement = m._PlaneBasisScheme ? 1 : 0;
+00557
+00558 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> nbVerticesInSource = modelVb.getNumVertices();
+00559
+00560 <a class="code" href="a04558.html#a14">sint</a> inNormalOff=0;
+00561 <a class="code" href="a04558.html#a14">sint</a> outNormalOff=0;
+00562 <span class="keywordflow">if</span> (modelVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag)
+00563 {
+00564 inNormalOff = modelVb.getNormalOff();
+00565 outNormalOff = outVb.getNormalOff();
+00566 }
+00567
+00568 <span class="keywordflow">do</span>
+00569 {
+00570 <a class="code" href="a04558.html#a7">uint8</a> *outVertex = (<a class="code" href="a04558.html#a7">uint8</a> *) outVb.getVertexCoordPointer();
+00571
+00572 toProcess = <a class="code" href="a04061.html#a0">std::min</a>(leftToDo, ConstraintMeshBufSize);
+00573
+00574 <span class="keywordflow">if</span> (m._SizeScheme)
+00575 {
+00576 ptCurrSize = (<span class="keywordtype">float</span> *) (m._SizeScheme-&gt;make(m._Owner, size -leftToDo, &amp;sizes[0], <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep));
+00577 }
+00578 <span class="keywordflow">else</span>
+00579 {
+00580 ptCurrSize = &amp;m._ParticleSize;
+00581 }
+00582
+00583 <span class="keywordflow">if</span> (m._PlaneBasisScheme)
+00584 {
+00585 ptBasis = (CPlaneBasis *) (m._PlaneBasisScheme-&gt;make(m._Owner, size -leftToDo, &amp;planeBasis[0], <span class="keyword">sizeof</span>(CPlaneBasis), toProcess, <span class="keyword">true</span>, srcStep));
+00586 }
+00587 <span class="keywordflow">else</span>
+00588 {
+00589 ptBasis = &amp;m._PlaneBasis;
+00590 }
+00591
+00592
+00593 endPosIt = posIt + toProcess;
+00594 <span class="comment">// transfo matrix &amp; scaled transfo matrix;</span>
+00595 CMatrix M, sM;
+00596
+00597
+00598 <span class="keywordflow">if</span> (m._Meshes.size() == 1)
+00599 {
+00601 <span class="keywordflow">do</span>
+00602 {
+00603
+00604 <a class="code" href="a04558.html#a7">uint8</a> *inVertex = (<a class="code" href="a04558.html#a7">uint8</a> *) modelVb.getVertexCoordPointer();
+00605 <a class="code" href="a04558.html#a15">uint</a> k = nbVerticesInSource;
+00606
+00607 <span class="comment">// do we need a normal ?</span>
+00608 <span class="keywordflow">if</span> (modelVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag)
+00609 {
+00610 M.identity();
+00611 M.setRot(ptBasis-&gt;X, ptBasis-&gt;Y, ptBasis-&gt;X ^ ptBasis-&gt;Y);
+00612 sM = M;
+00613 sM.scale(*ptCurrSize);
+00614
+00615 <span class="comment">// offset of normals in the prerotated mesh </span>
+00616 <span class="keywordflow">do</span>
+00617 {
+00618 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(modelVb, inVertex);
+00619 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
+00620 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(modelVb, inVertex + inNormalOff);
+00621 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex + outNormalOff);
+00622
+00623 <span class="comment">// translate and resize the vertex (relatively to the mesh origin)</span>
+00624 *(CVector *) outVertex = *posIt + sM * *(CVector *) inVertex;
+00625 <span class="comment">// copy the normal</span>
+00626 *(CVector *) (outVertex + outNormalOff) = M * *(CVector *) (inVertex + inNormalOff);
+00627
+00628
+00629 inVertex += inVSize;
+00630 outVertex += outVSize;
+00631 }
+00632 <span class="keywordflow">while</span> (--k);
+00633 }
+00634 <span class="keywordflow">else</span>
+00635 {
+00636 <span class="comment">// no normal to transform</span>
+00637 sM.identity();
+00638 sM.setRot(ptBasis-&gt;X, ptBasis-&gt;Y, ptBasis-&gt;X ^ ptBasis-&gt;Y);
+00639 sM.scale(*ptCurrSize);
+00640
+00641 <span class="keywordflow">do</span>
+00642 {
+00643 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(modelVb, inVertex);
+00644 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
+00645
+00646 <span class="comment">// translate and resize the vertex (relatively to the mesh origin)</span>
+00647 *(CVector *) outVertex = *posIt + sM * *(CVector *) inVertex;
+00648
+00649 inVertex += inVSize;
+00650 outVertex += outVSize;
+00651 }
+00652 <span class="keywordflow">while</span> (--k);
+00653 }
+00654
+00655
+00656 ++posIt;
+00657 ptCurrSize += ptCurrSizeIncrement;
+00658 ptBasis += ptBasisIncrement;
+00659 }
+00660 <span class="keywordflow">while</span> (posIt != endPosIt);
+00661 }
+00662 <span class="keywordflow">else</span>
+00663 {
+00664 <span class="comment">// morphed case</span>
+00665
+00666 <span class="comment">// first, compute the morph value for each mesh</span>
+00667 <span class="keywordtype">float</span> morphValues[<a class="code" href="a05363.html#a264">ConstraintMeshBufSize</a>];
+00668 <span class="keywordtype">float</span> *currMorphValue;
+00669 <a class="code" href="a04558.html#a15">uint</a> morphValueIncr;
+00670
+00671 <span class="keywordflow">if</span> (m._MorphScheme) <span class="comment">// variable case</span>
+00672 {
+00673 currMorphValue = (<span class="keywordtype">float</span> *) m._MorphScheme-&gt;make(m._Owner, size - leftToDo, &amp;morphValues[0], <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep);
+00674 morphValueIncr = 1;
+00675 }
+00676 <span class="keywordflow">else</span>
+00677 {
+00678 currMorphValue = &amp;m._MorphValue;
+00679 morphValueIncr = 0;
+00680 }
+00681
+00682 <span class="keywordflow">do</span>
+00683 {
+00684 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> numShapes = m._Meshes.size();
+00685 <span class="keyword">const</span> <a class="code" href="a04558.html#a7">uint8</a> *m0, *m1;
+00686 <span class="keywordtype">float</span> lambda;
+00687 <span class="keywordtype">float</span> opLambda;
+00688 <span class="keyword">const</span> CVertexBuffer *inVB0, *inVB1;
+00689 <span class="keywordflow">if</span> (*currMorphValue &gt;= numShapes - 1)
+00690 {
+00691 lambda = 0.f;
+00692 opLambda = 1.f;
+00693 inVB0 = inVB1 = &amp;(m._Meshes[numShapes - 1]-&gt;getVertexBuffer());
+00694 }
+00695 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*currMorphValue &lt;= 0)
+00696 {
+00697 lambda = 0.f;
+00698 opLambda = 1.f;
+00699 inVB0 = inVB1 = &amp;(m._Meshes[0]-&gt;getVertexBuffer());
+00700 }
+00701 <span class="keywordflow">else</span>
+00702 {
+00703 <a class="code" href="a04558.html#a15">uint</a> iMeshIndex = (<a class="code" href="a04558.html#a15">uint</a>) *currMorphValue;
+00704 lambda = *currMorphValue - iMeshIndex;
+00705 opLambda = 1.f - lambda;
+00706 inVB0 = &amp;(m._Meshes[iMeshIndex]-&gt;getVertexBuffer());
+00707 inVB1 = &amp;(m._Meshes[iMeshIndex + 1]-&gt;getVertexBuffer());
+00708 }
+00709
+00710 m0 = (<a class="code" href="a04558.html#a7">uint8</a> *) inVB0-&gt;getVertexCoordPointer();
+00711 m1 = (<a class="code" href="a04558.html#a7">uint8</a> *) inVB1-&gt;getVertexCoordPointer();
+00712
+00713
+00714 <a class="code" href="a04558.html#a15">uint</a> k = nbVerticesInSource;
+00715 <span class="comment">// do we need a normal ?</span>
+00716 <span class="keywordflow">if</span> (modelVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag)
+00717 {
+00718 M.identity();
+00719 M.setRot(ptBasis-&gt;X, ptBasis-&gt;Y, ptBasis-&gt;X ^ ptBasis-&gt;Y);
+00720 sM = M;
+00721 sM.scale(*ptCurrSize);
+00722
+00723 <span class="comment">// offset of normals in the prerotated mesh </span>
+00724 <span class="keywordflow">do</span>
+00725 {
+00726 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB0), m0);
+00727 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB1), m1);
+00728 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB0), m0 + inNormalOff);
+00729 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB1), m1 + inNormalOff);
+00730 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
+00731 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex + outNormalOff);
+00732
+00733 <span class="comment">// morph, and transform the vertex</span>
+00734 *(CVector *) outVertex = *posIt + sM * (opLambda * *(CVector *) m0 + lambda * *(CVector *) m1);
+00735 <span class="comment">// morph, and transform the normal</span>
+00736 *(CVector *) (outVertex + outNormalOff) = M * (opLambda * *(CVector *) (m0 + inNormalOff)
+00737 + lambda * *(CVector *) (m1 + inNormalOff)).normed();
+00738
+00739
+00740 m0 += inVSize;
+00741 m1 += inVSize;
+00742 outVertex += outVSize;
+00743 }
+00744 <span class="keywordflow">while</span> (--k);
+00745 }
+00746 <span class="keywordflow">else</span>
+00747 {
+00748 <span class="comment">// no normal to transform</span>
+00749 sM.identity();
+00750 sM.setRot(ptBasis-&gt;X, ptBasis-&gt;Y, ptBasis-&gt;X ^ ptBasis-&gt;Y);
+00751 sM.scale(*ptCurrSize);
+00752
+00753 <span class="keywordflow">do</span>
+00754 {
+00755 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB0), m0);
+00756 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>((*inVB1), m1);
+00757 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
+00758 <span class="comment">// morph, and transform the vertex</span>
+00759 *(CVector *) outVertex = *posIt + sM * (opLambda * *(CVector *) m0 + opLambda * *(CVector *) m1);
+00760
+00761 m0 += inVSize;
+00762 m1 += inVSize;
+00763 outVertex += outVSize;
+00764 }
+00765 <span class="keywordflow">while</span> (--k);
+00766 }
+00767
+00768
+00769 ++posIt;
+00770 ptCurrSize += ptCurrSizeIncrement;
+00771 ptBasis += ptBasisIncrement;
+00772 currMorphValue += morphValueIncr;
+00773 }
+00774 <span class="keywordflow">while</span> (posIt != endPosIt);
+00775 }
+00776
+00777 <span class="comment">// compute colors if needed</span>
+00778 <span class="keywordflow">if</span> (m._ColorScheme)
+00779 {
+00780 m.computeColors(outVb, modelVb, size - leftToDo, toProcess, srcStep);
+00781 }
+00782
+00783 <span class="comment">// render meshs</span>
+00784 m.doRenderPasses(driver, toProcess, md.RdrPasses, opaque);
+00785 leftToDo -= toProcess;
+00786
+00787 }
+00788 <span class="keywordflow">while</span> (leftToDo);
+00789 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NL3D_1_1CPSConstraintMeshHelpere1" doxytag="NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" colspan="4">
+template&lt;class T, class U&gt; </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap valign="top"> void NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">T&nbsp;</td>
+ <td class="mdname" nowrap> <em>posIt</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>U&nbsp;</td>
+ <td class="mdname" nowrap> <em>indexIt</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a03161.html">CPSConstraintMesh</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>m</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>size</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>srcStep</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>opaque</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a05363.html#a366">TAnimationTime</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>ellapsedTime</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [inline, static]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+precompute rotation in a VB from the src mesh<p>
+get a mesh display struct on this shape, with eventually a primary color added.<p>
+copy datas for several mesh<p>
+render the result
+<p>
+Definition at line <a class="el" href="a06250.html#l00793">793</a> of file <a class="el" href="a06250.html">ps_mesh.cpp</a>.
+<p>
+References <a class="el" href="a06258.html#l00228">NL3D::CPSColoredParticle::_ColorScheme</a>, <a class="el" href="a06251.html#l00574">NL3D::CPSConstraintMesh::_GlobalAnimDate</a>, <a class="el" href="a03161.html#NL3D_1_1CPSConstraintMesht0">NL3D::CPSConstraintMesh::_MeshDisplayShare</a>, <a class="el" href="a06251.html#l00468">NL3D::CPSConstraintMesh::_Meshes</a>, <a class="el" href="a06247.html#l01026">NL3D::CPSLocatedBindable::_Owner</a>, <a class="el" href="a06258.html#l00289">NL3D::CPSSizedParticle::_ParticleSize</a>, <a class="el" href="a06258.html#l00290">NL3D::CPSSizedParticle::_SizeScheme</a>, <a class="el" href="a02434.html#NL3D_1_1IDrivera2">NL3D::IDriver::activeVertexBuffer()</a>, <a class="el" href="a06249.html#l00039">CHECK_VERTEX_BUFFER</a>, <a class="el" href="a06250.html#l01825">NL3D::CPSConstraintMesh::computeColors()</a>, <a class="el" href="a06251.html#l00064">NL3D::ConstraintMeshBufSize</a>, <a class="el" href="a06250.html#l01802">NL3D::CPSConstraintMesh::doRenderPasses()</a>, <a class="el" href="a06247.html#l00890">NL3D::CPSLocatedBindable::getDriver()</a>, <a class="el" href="a06711.html#l00338">NL3D::CVertexBuffer::getNormalOff()</a>, <a class="el" href="a06711.html#l00453">NL3D::CVertexBuffer::getNumVertices()</a>, <a class="el" href="a06151.html#l00111">NL3D::CParticleSystemProcess::getOwner()</a>, <a class="el" href="a06143.html#l00311">NL3D::CParticleSystem::getSystemDate()</a>, <a class="el" href="a05989.html#l02432">NL3D::CMesh::getVertexBuffer()</a>, <a class="el" href="a06710.html#l00438">NL3D::CVertexBuffer::getVertexCoordPointer()</a>, <a class="el" href="a06711.html#l00319">NL3D::CVertexBuffer::getVertexFormat()</a>, <a class="el" href="a06711.html#l00473">NL3D::CVertexBuffer::getVertexSize()</a>, <a class="el" href="a03136.html#NL3D_1_1CPSAttribMakerz714_2">NL3D::CPSAttribMaker&lt; float &gt;::make()</a>, <a class="el" href="a06250.html#l01531">NL3D::CPSConstraintMesh::makePrerotatedVb()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06152.html#l00060">PARTICLES_CHECK_MEM</a>, <a class="el" href="a06251.html#l00449">NL3D::CPSConstraintMesh::CMeshDisplay::RdrPasses</a>, <a class="el" href="a06246.html#l02142">NL3D::CPSLocatedBindable::setupDriverModelMatrix()</a>, <a class="el" href="a06250.html#l01729">NL3D::CPSConstraintMesh::setupRenderPasses()</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a05454.html#l00044">NL3D::TAnimationTime</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a06251.html#l00450">NL3D::CPSConstraintMesh::CMeshDisplay::VB</a>.
+<p>
+<div class="fragment"><pre>00800 {
+00801 <span class="comment">// get the vb from the original mesh</span>
+00802 CMesh &amp;mesh = *m._Meshes[0];
+00803 <span class="keyword">const</span> CVertexBuffer &amp;modelVb = mesh.getVertexBuffer();
+00804
+00806 CVertexBuffer &amp;prerotVb = m.makePrerotatedVb(modelVb, ellapsedTime);
+00807
+00808 <span class="comment">// driver setup</span>
+00809 IDriver *driver = m.getDriver();
+00810 m.setupDriverModelMatrix();
+00811
+00812 <span class="comment">// renderPasses setup</span>
+00813 <a class="code" href="a04199.html#a6">nlassert</a>(m._Owner);
+00814
+00815 <span class="comment">// storage for sizes of meshs</span>
+00816 <span class="keywordtype">float</span> sizes[<a class="code" href="a05363.html#a264">ConstraintMeshBufSize</a>];
+00817
+00818 <span class="comment">// point the size for the current mesh</span>
+00819 <span class="keywordtype">float</span> *ptCurrSize;
+00820 <a class="code" href="a04558.html#a15">uint</a> ptCurrSizeIncrement = m._SizeScheme ? 1 : 0;
+00821
+00822 T endPosIt;
+00823 <a class="code" href="a04558.html#a15">uint</a> leftToDo = <a class="code" href="a04223.html#a587">size</a>, toProcess;
+00824 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> nbVerticesInSource = modelVb.getNumVertices();
+00825
+00826
+00827
+00828 <span class="comment">// size of a complete prerotated model</span>
+00829 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> prerotatedModelSize = prerotVb.getVertexSize() * modelVb.getNumVertices();
+00830
+00832 CPSConstraintMesh::CMeshDisplay &amp;md = m._MeshDisplayShare.getMeshDisplay(m._Meshes[0], modelVb.getVertexFormat()
+00833 | (m._ColorScheme ? CVertexBuffer::PrimaryColorFlag : 0));
+00834
+00835
+00836 m.setupRenderPasses((<span class="keywordtype">float</span>) m._Owner-&gt;getOwner()-&gt;getSystemDate() - m._GlobalAnimDate, md.RdrPasses, opaque);
+00837
+00838 CVertexBuffer &amp;outVb = md.VB;
+00839
+00840 driver-&gt;activeVertexBuffer(outVb);
+00841
+00842
+00843 <span class="comment">// size of vertices in prerotated model</span>
+00844 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> inVSize = prerotVb.getVertexSize();
+00845
+00846 <span class="comment">// size ofr vertices in dest vb</span>
+00847 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> outVSize = outVb.getVertexSize();
+00848
+00849 <span class="comment">// offset of normals in vertices of the prerotated model, and source model </span>
+00850 <a class="code" href="a04558.html#a15">uint</a> normalOff=0;
+00851 <a class="code" href="a04558.html#a15">uint</a> pNormalOff=0;
+00852 <span class="keywordflow">if</span> (prerotVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag)
+00853 {
+00854 normalOff = outVb.getNormalOff();
+00855 pNormalOff = prerotVb.getNormalOff();
+00856 }
+00857
+00858 <span class="keywordflow">do</span>
+00859 {
+00860 toProcess = <a class="code" href="a04061.html#a0">std::min</a>(leftToDo, ConstraintMeshBufSize);
+00861
+00862 <span class="keywordflow">if</span> (m._SizeScheme)
+00863 {
+00864 <span class="comment">// compute size</span>
+00865 ptCurrSize = (<span class="keywordtype">float</span> *) (m._SizeScheme-&gt;make(m._Owner, size - leftToDo, &amp;sizes[0], <span class="keyword">sizeof</span>(<span class="keywordtype">float</span>), toProcess, <span class="keyword">true</span>, srcStep));
+00866 }
+00867 <span class="keywordflow">else</span>
+00868 {
+00869 <span class="comment">// pointer on constant size</span>
+00870 ptCurrSize = &amp;m._ParticleSize;
+00871 }
+00872
+00873 endPosIt = posIt + toProcess;
+00874 <a class="code" href="a04558.html#a7">uint8</a> *outVertex = (<a class="code" href="a04558.html#a7">uint8</a> *) outVb.getVertexCoordPointer();
+00876 <span class="keywordflow">do</span>
+00877 {
+00878 <a class="code" href="a04558.html#a7">uint8</a> *inVertex = (<a class="code" href="a04558.html#a7">uint8</a> *) prerotVb.getVertexCoordPointer() + prerotatedModelSize * *indexIt; <span class="comment">// prerotated vertex </span>
+00879 <a class="code" href="a04558.html#a15">uint</a> k = nbVerticesInSource;
+00880
+00881 <span class="keywordflow">if</span> (prerotVb.getVertexFormat() &amp; CVertexBuffer::NormalFlag) <span class="comment">// has it a normal ?</span>
+00882 {
+00883 <span class="keywordflow">do</span>
+00884 {
+00885 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
+00886 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(prerotVb, inVertex);
+00887 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex + normalOff);
+00888 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(prerotVb, inVertex + pNormalOff);
+00889
+00890
+00891 <span class="comment">// translate and resize the vertex (relatively to the mesh origin)</span>
+00892 *(CVector *) outVertex = *posIt + *ptCurrSize * *(CVector *) inVertex;
+00893 <span class="comment">// copy the normal</span>
+00894 *(CVector *) (outVertex + normalOff ) = *(CVector *) (inVertex + pNormalOff);
+00895 inVertex += inVSize;
+00896 outVertex += outVSize;
+00897 }
+00898 <span class="keywordflow">while</span> (--k);
+00899 }
+00900 <span class="keywordflow">else</span>
+00901 {
+00902 <span class="keywordflow">do</span>
+00903 {
+00904 <span class="comment">// translate and resize the vertex (relatively to the mesh origin)</span>
+00905 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(outVb, outVertex);
+00906 <a class="code" href="a04826.html#a0">CHECK_VERTEX_BUFFER</a>(prerotVb, inVertex);
+00907 *(CVector *) outVertex = *posIt + *ptCurrSize * *(CVector *) inVertex;
+00908 inVertex += inVSize;
+00909 outVertex += outVSize;
+00910 }
+00911 <span class="keywordflow">while</span> (--k);
+00912 }
+00913
+00914 ++indexIt;
+00915 ++posIt;
+00916 ptCurrSize += ptCurrSizeIncrement;
+00917 }
+00918 <span class="keywordflow">while</span> (posIt != endPosIt);
+00919
+00920 <span class="comment">// compute colors if needed</span>
+00921 <span class="keywordflow">if</span> (m._ColorScheme)
+00922 {
+00923 m.computeColors(outVb, modelVb, size - leftToDo, toProcess, srcStep);
+00924 }
+00925
+00926
+00928 m.doRenderPasses(driver, toProcess, md.RdrPasses, opaque);
+00929 leftToDo -= toProcess;
+00930
+00931 }
+00932 <span class="keywordflow">while</span> (leftToDo);
+00933 <a class="code" href="a04729.html#a0">PARTICLES_CHECK_MEM</a>
+00934 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr>The documentation for this class was generated from the following file:<ul>
+<li><a class="el" href="a06250.html">ps_mesh.cpp</a></ul>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 07:06:29 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>