OgreSubMesh.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://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2012 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 #ifndef __SubMesh_H_
00029 #define __SubMesh_H_
00030 
00031 #include "OgrePrerequisites.h"
00032 
00033 #include "OgreVertexIndexData.h"
00034 #include "OgreMaterial.h"
00035 #include "OgreRenderOperation.h"
00036 #include "OgreVertexBoneAssignment.h"
00037 #include "OgreAnimationTrack.h"
00038 #include "OgreResourceGroupManager.h"
00039 
00040 namespace Ogre {
00041 
00061     class _OgreExport SubMesh : public SubMeshAlloc
00062     {
00063         friend class Mesh;
00064         friend class MeshSerializerImpl;
00065         friend class MeshSerializerImpl_v1_2;
00066         friend class MeshSerializerImpl_v1_1;
00067     public:
00068         SubMesh();
00069         ~SubMesh();
00070 
00071 
00073         bool useSharedVertices;
00074 
00076         RenderOperation::OperationType operationType;
00077 
00085         VertexData *vertexData;
00086 
00088         IndexData *indexData;
00089 
00109         typedef vector<unsigned short>::type IndexMap;
00110         IndexMap blendIndexToBoneIndexMap;
00111 
00112         typedef vector<IndexData*>::type LODFaceList;
00113         LODFaceList mLodFaceList;
00114 
00134         vector<Vector3>::type extremityPoints;
00135 
00137         Mesh* parent;
00138 
00140         void setMaterialName(const String& matName, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
00141         const String& getMaterialName(void) const;
00142 
00145         bool isMatInitialised(void) const;
00146 
00153         void _getRenderOperation(RenderOperation& rend, ushort lodIndex = 0);
00154 
00167         void addBoneAssignment(const VertexBoneAssignment& vertBoneAssign);
00168 
00174         void clearBoneAssignments(void);
00175 
00177         typedef multimap<size_t, VertexBoneAssignment>::type VertexBoneAssignmentList;
00178         typedef MapIterator<VertexBoneAssignmentList> BoneAssignmentIterator;
00179 
00184         BoneAssignmentIterator getBoneAssignmentIterator(void);
00185 
00188         const VertexBoneAssignmentList& getBoneAssignments() { return mBoneAssignments; }
00189 
00190 
00192         void _compileBoneAssignments(void);
00193 
00194         typedef ConstMapIterator<AliasTextureNamePairList> AliasTextureIterator;
00198         AliasTextureIterator getAliasTextureIterator(void) const;
00209         void addTextureAlias(const String& aliasName, const String& textureName);
00215         void removeTextureAlias(const String& aliasName);
00218         void removeAllTextureAliases(void);
00221         bool hasTextureAliases(void) const { return !mTextureAliases.empty(); }
00224         size_t getTextureAliasCount(void) const { return mTextureAliases.size(); }
00225 
00236         bool updateMaterialUsingTextureAliases(void);
00237 
00240         VertexAnimationType getVertexAnimationType(void) const;
00241         
00243         bool getVertexAnimationIncludesNormals() const { return mVertexAnimationIncludesNormals; }
00244 
00245 
00250         void generateExtremes(size_t count);
00251 
00254         bool isBuildEdgesEnabled(void) const { return mBuildEdgesEnabled; }
00255         void setBuildEdgesEnabled(bool b);
00256 
00257     protected:
00258 
00260         String mMaterialName;
00261 
00263         bool mMatInitialised;
00264 
00266         AliasTextureNamePairList mTextureAliases;
00267 
00268         VertexBoneAssignmentList mBoneAssignments;
00269 
00271         bool mBoneAssignmentsOutOfDate;
00272 
00274         mutable VertexAnimationType mVertexAnimationType;
00275 
00277         mutable bool mVertexAnimationIncludesNormals;
00278 
00280         bool mBuildEdgesEnabled;
00281 
00283         void removeLodLevels(void);
00284 
00285 
00286     };
00290 } // namespace
00291 
00292 #endif
00293 
00294 

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:28 2012