Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreRenderOperation.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://ogre.sourceforge.net/
00006 
00007 Copyright © 2000-2002 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 #ifndef _RenderOperation_H__
00026 #define _RenderOperation_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 #include "OgreColourValue.h"
00030 
00031 namespace Ogre {
00066     class RenderOperation {
00067     public:
00068         enum OpType {
00069             OT_POINT_LIST,
00070             OT_LINE_LIST,
00071             OT_LINE_STRIP,
00072             OT_TRIANGLE_LIST,
00073             OT_TRIANGLE_STRIP,
00074             OT_TRIANGLE_FAN
00075         };
00084         enum VertexOptions {
00086             VO_NORMALS = 1,
00088             VO_TEXTURE_COORDS = 2,
00090             VO_DIFFUSE_COLOURS = 4,
00092             VO_SPECULAR_COLOURS = 8,
00094             VO_BLEND_WEIGHTS = 16
00095         };
00096 
00098         struct VertexBlendData
00099         {
00100             unsigned short matrixIndex;
00101             Real blendWeight;
00102         };
00103 
00104         // true to use pIndexes to reference individual lines/triangles rather than embed. Allows vertex reuse.
00105         bool useIndexes;
00106 
00108         unsigned int numVertices;
00109 
00111         unsigned short numBlendWeightsPerVertex;
00112 
00113         // No memory allocation here,
00114         // assumed that all pointers are pointing
00115         // elsewhere e.g. model class data
00116 
00122         Real* pVertices;
00123 
00125         unsigned short vertexStride;
00126 
00128         Real* pNormals;
00129 
00131         unsigned short normalStride;
00132 
00138         Real* pTexCoords[OGRE_MAX_TEXTURE_COORD_SETS];
00139 
00141         unsigned short texCoordStride[OGRE_MAX_TEXTURE_COORD_SETS];
00142 
00144         int numTextureCoordSets;
00145 
00150         int numTextureDimensions[OGRE_MAX_TEXTURE_COORD_SETS];
00151 
00153         RGBA* pDiffuseColour;
00154 
00156         unsigned short diffuseStride;
00157 
00159         RGBA* pSpecularColour;
00160 
00162         unsigned short specularStride;
00163 
00169         VertexBlendData* pBlendingWeights;
00170 
00175         unsigned short* pIndexes;
00176 
00178         unsigned int numIndexes;
00179 
00181         int vertexOptions;
00183         OpType operationType;
00184 
00185         RenderOperation()
00186         {
00187             // Initialise all things
00188             vertexStride = normalStride = diffuseStride = specularStride = 0;
00189             numBlendWeightsPerVertex = 0;
00190             for (int i = 0; i < OGRE_MAX_TEXTURE_COORD_SETS; ++i)
00191             {
00192                 texCoordStride[i] = 0;
00193                 pTexCoords[0] = 0;
00194             }
00195 
00196             pVertices = 0;
00197             pNormals = 0;
00198             pDiffuseColour = 0;
00199             pSpecularColour = 0;
00200             pBlendingWeights = 0;
00201         }
00202     };
00203 
00204     /* Example usage (camera at (0,0,0) pointing down -Z (lookAt(0,0,-300))
00205 
00206         RenderOperation ro;
00207         float vertexData[9] = {100,   0, -300,
00208                                    0, 200, -300,
00209                               -100,   0, -300 };
00210         float normalData[9] = { 0, 0, 1,
00211                                 0, 0, 1,
00212                                 0, 0, 1};
00213         ro.operationType = RenderOperation::OT_TRIANGLE_LIST;
00214         ro.numVertices = 3;
00215         ro.useIndexes = false;
00216         ro.vertexOptions = RenderOperation::VO_NORMAL;
00217         ro.pVertices = vertexData;
00218         ro.pNormals = normalData;
00219         mDestRenderSystem->_render(ro);
00220     */
00221 }
00222 
00223 
00224 
00225 #endif

Copyright © 2002 by The OGRE Team