From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/computed__string_8cpp-source.html | 215 +++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 docs/doxygen/nel/computed__string_8cpp-source.html (limited to 'docs/doxygen/nel/computed__string_8cpp-source.html') diff --git a/docs/doxygen/nel/computed__string_8cpp-source.html b/docs/doxygen/nel/computed__string_8cpp-source.html new file mode 100644 index 00000000..095a0d55 --- /dev/null +++ b/docs/doxygen/nel/computed__string_8cpp-source.html @@ -0,0 +1,215 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

computed_string.cpp

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #include "std3d.h"
+00027 
+00028 #include "3d/computed_string.h"
+00029 #include "3d/texture.h"
+00030 #include "3d/primitive_block.h"
+00031 #include "3d/material.h"
+00032 
+00033 #include "nel/misc/smart_ptr.h"
+00034 #include "nel/misc/debug.h"
+00035 
+00036 #include "nel/misc/file.h"
+00037 
+00038 using namespace std;
+00039 
+00040 namespace NL3D {
+00041 
+00042 
+00043 
+00044 /*------------------------------------------------------------------*\
+00045                                                         getHotSpotVector()
+00046 \*------------------------------------------------------------------*/
+00047 CVector CComputedString::getHotSpotVector(THotSpot hotspot)
+00048 {
+00049         CVector hotspotVector(0,0,0);
+00050 
+00051         if(hotspot==MiddleLeft)
+00052                 hotspotVector = CVector(0,0,-StringHeight/2);
+00053         
+00054         if(hotspot==TopLeft)
+00055                 hotspotVector = CVector(0,0,-StringHeight);
+00056         
+00057         if(hotspot==MiddleBottom)
+00058                 hotspotVector = CVector(-StringWidth/2,0,0);
+00059         
+00060         if(hotspot==MiddleMiddle)
+00061                 hotspotVector = CVector(-StringWidth/2,0,-StringHeight/2);
+00062         
+00063         if(hotspot==MiddleTop)
+00064                 hotspotVector = CVector(-StringWidth/2,0,-StringHeight);
+00065         
+00066         if(hotspot==BottomRight)
+00067                 hotspotVector = CVector(-StringWidth,0,0);
+00068         
+00069         if(hotspot==MiddleRight)
+00070                 hotspotVector = CVector(-StringWidth,0,-StringHeight/2);
+00071         
+00072         if(hotspot==TopRight)
+00073                 hotspotVector = CVector(-StringWidth,0,-StringHeight);
+00074 
+00075         return hotspotVector;
+00076 }
+00077 
+00078 
+00079 /*------------------------------------------------------------------*\
+00080                                                         render2D()
+00081 \*------------------------------------------------------------------*/
+00082 void CComputedString::render2D (IDriver& driver,
+00083                                                                 float x, float z,
+00084                                                                 THotSpot hotspot,
+00085                                                                 float scaleX, float scaleZ,
+00086                                                                 float rotateY
+00087                                                                 )
+00088 {
+00089         if (Vertices.getNumVertices() == 0)
+00090                 return;
+00091         //x*=ResX/ResY;
+00092         x*=(float)4/3;
+00093 
+00094         driver.setFrustum(0, 4.0f/3.0f, 0, 1, -1, 1, false);  // resX/resY
+00095 
+00096         // Computing hotspot translation vector
+00097         CVector hotspotVector = getHotSpotVector(hotspot);
+00098 
+00099         // tansformation matrix initialized to identity
+00100         CMatrix matrix;
+00101         matrix.identity();
+00102                 
+00103         // view matrix <-> identity
+00104         driver.setupViewMatrix(matrix);
+00105 
+00106         // model matrix :
+00107         // centering to hotspot, then scaling, rotating, and translating.
+00108         matrix.translate(CVector(x,0,z));
+00109         matrix.rotateY(rotateY);
+00110         matrix.scale(CVector(scaleX,1,scaleZ));
+00111         matrix.translate(hotspotVector);
+00112         driver.setupModelMatrix(matrix);
+00113         
+00114         driver.activeVertexBuffer(Vertices);
+00115 
+00116         // rendering each primitives 
+00117         Material->setZFunc (CMaterial::always);
+00118         Material->setZWrite (false);
+00119         Material->setColor (Color);
+00120         driver.renderQuads (*Material, 0, Vertices.getNumVertices()/4);
+00121 }
+00122 
+00123 
+00124 /*------------------------------------------------------------------*\
+00125                                                         render3D()
+00126 \*------------------------------------------------------------------*/
+00127 void CComputedString::render3D (IDriver& driver,CMatrix matrix,THotSpot hotspot)
+00128 {
+00129         if (Vertices.getNumVertices() == 0)
+00130                 return;
+00131         // Computing hotspot translation vector
+00132         CVector hotspotVector = getHotSpotVector(hotspot);
+00133         matrix.translate(hotspotVector);
+00134 
+00135         driver.setupModelMatrix(matrix);
+00136         driver.activeVertexBuffer(Vertices);
+00137 
+00138         // Rendering each primitive blocks
+00139         Material->setZFunc (CMaterial::lessequal);
+00140         Material->setZWrite (true);
+00141         Material->setColor (Color);
+00142         driver.renderQuads (*Material,0,Vertices.getNumVertices()/4);
+00143 }
+00144 
+00145 
+00146 } // NL3D
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1