AaronCameron.net
I care not for your petty politics.
Not a Member? - Login or Create an Account
Wednesday the 23rd of May 2012 @ 05:28pm
Front Page Journal Projects Your Profile About
[]

LibN2L-4 Library Code Reference

Classes
Compounds
Files
Members
Method Index
Full Reference

cRPovRayModel.h

Go to the documentation of this file.
00001 /************************************************************************
00002 Nova-2 Library (libN2L, or simply n2l) Game development C++ Library
00003 Copyright (C) 2003  Aaron Cameron
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Lesser General Public
00007 License as published by the Free Software Foundation; either
00008 version 2.1 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Lesser General Public License for more details.
00014 
00015 You should have received a copy of the GNU Lesser General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 
00019 A copy of the GNU Lesser General Public License has been provided with
00020 this library in the file 'COPYING'.
00021 
00022 Contact information for the author of this library has been provided
00023 with this library in the file 'AUTHOR'.
00024 ************************************************************************/
00025 #ifndef _n2l4_cRPovRayModel_H
00026 #define _n2l4_cRPovRayModel_H
00027 
00028 #include "n2l/n2l.h"
00029 #include "n2l/geometry.h"
00030 
00031 #include "renderTools/cRModelInterface.h"
00032 
00033 namespace n2l
00034 {
00035     class cVfsNodeInterface;
00036     class cGLTexture;
00037 
00057     class cRPovRayModel : public cRModelInterface
00058     {
00059     public:
00060         cRPovRayModel( const cVfsNodeInterface & iFile );
00061         virtual ~cRPovRayModel();
00062 
00063         virtual void load( const cVfsNodeInterface & iFile );
00064 
00065         virtual void defaultTexture(    const tUint iMeshIndex,
00066                                         const cAutoPtr<const cGLTexture> & iTexture );
00067 
00068         virtual void render(    const cAutoPtr<const cGLTexture> & i_iTexture,
00069                                 const tRenderOptions iOptions = R_Normal ) const;
00070 
00071         virtual void centerAroundOrigin();
00072 
00073         virtual const tString & vfsType() const;
00074 
00075         virtual void free();
00076 
00077     private:
00078         /***********************************************/
00079         class cMesh2
00080         {
00081         public:
00082             cMesh2( const tString & iBuffer,
00083                     const tString::size_type & iPos,
00084                     tString::size_type & oPos );
00085             ~cMesh2();
00086 
00087             void minMaxVectors( tVector3f & oMin,
00088                                 tVector3f & oMax ) const;
00089 
00090             void render(    const cAutoPtr<const cGLTexture> & i_iTexture,
00091                             const tRenderOptions iOptions ) const;
00092             void defaultTexture( const cAutoPtr<const cGLTexture> & iTexture);
00093 
00094         private:
00102             const tString::size_type loadVertex3Array(
00103                                     tVector3f *& o_oArray,
00104                                     const tString & iBuffer,
00105                                     const tString::size_type & iPos,
00106                                     tUint & oNumLoaded );
00107 
00108             const tString::size_type loadVertex2Array(
00109                                     tVector2f *& o_oArray,
00110                                     const tString & iBuffer,
00111                                     const tString::size_type & iPos,
00112                                     tUint & oNumLoaded );
00113 
00114             const tString::size_type loadIndex3Array(
00115                                     tVector3u *& o_oArray,
00116                                     const tString & iBuffer,
00117                                     const tString::size_type & iPos,
00118                                     tUint & oNumLoaded );
00119 
00120 
00121             tVector3f   * mVertVectors;
00122             tVector3f   * mNormVectors;
00123             tVector2f   * mUVVectors;
00124             
00125             tVector3u   * mFaceIndices;
00126             tVector3u   * mUVIndices;
00127 
00128             tUint       mNumVertices;
00129             tUint       mNumNormals;
00130             tUint       mNumUVVectors;
00131             
00132             tUint       mNumFaceIndices;
00133             tUint       mNumUVIndices;
00134 
00135             cAutoPtr<const cGLTexture>  mTexture;
00136         }; // cMesh2
00137         /***********************************************/
00138 
00139         typedef std::vector<cAutoPtr<cMesh2> >  tMeshList;
00140 
00141         tMeshList   mMeshes;
00142 
00143     }; // class
00144 
00145 } // namespace n2l
00146 
00147 #endif
©2012 Aaron Cameron