OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreSubMesh.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __SubMesh_H_
29 #define __SubMesh_H_
30 
31 #include "OgrePrerequisites.h"
32 
33 #include "OgreRenderOperation.h"
35 #include "OgreAnimationTrack.h"
37 #include "OgreHeaderPrefix.h"
38 
39 namespace Ogre {
40 
61  {
62  friend class Mesh;
63  friend class MeshSerializerImpl;
66  public:
67  SubMesh();
68  ~SubMesh();
69 
70 
73 
76 
85 
88 
110 
113 
134 
137 
139  void setMaterialName(const String& matName, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
140  const String& getMaterialName(void) const;
141 
144  bool isMatInitialised(void) const;
145 
152  void _getRenderOperation(RenderOperation& rend, ushort lodIndex = 0);
153 
166  void addBoneAssignment(const VertexBoneAssignment& vertBoneAssign);
167 
173  void clearBoneAssignments(void);
174 
178 
183  BoneAssignmentIterator getBoneAssignmentIterator(void);
184 
187  const VertexBoneAssignmentList& getBoneAssignments() { return mBoneAssignments; }
188 
189 
191  void _compileBoneAssignments(void);
192 
197  AliasTextureIterator getAliasTextureIterator(void) const;
208  void addTextureAlias(const String& aliasName, const String& textureName);
214  void removeTextureAlias(const String& aliasName);
217  void removeAllTextureAliases(void);
220  bool hasTextureAliases(void) const { return !mTextureAliases.empty(); }
223  size_t getTextureAliasCount(void) const { return mTextureAliases.size(); }
224 
235  bool updateMaterialUsingTextureAliases(void);
236 
239  VertexAnimationType getVertexAnimationType(void) const;
240 
242  bool getVertexAnimationIncludesNormals() const { return mVertexAnimationIncludesNormals; }
243 
244 
249  void generateExtremes(size_t count);
250 
253  bool isBuildEdgesEnabled(void) const { return mBuildEdgesEnabled; }
254  void setBuildEdgesEnabled(bool b);
262  SubMesh * clone(const String& newName, Mesh *parentMesh = 0);
263 
264  protected:
265 
268 
271 
274 
276 
279 
282 
285 
288 
290  void removeLodLevels(void);
291 
292 
293  };
297 } // namespace
298 
299 #include "OgreHeaderSuffix.h"
300 
301 #endif
302 
303 
bool getVertexAnimationIncludesNormals() const
Returns whether animation on dedicated vertex data includes normals.
Definition: OgreSubMesh.h:242
multimap< size_t, VertexBoneAssignment >::type VertexBoneAssignmentList
Multimap of verex bone assignments (orders by vertex index)
Definition: OgreSubMesh.h:176
#define _OgreExport
Definition: OgrePlatform.h:255
const VertexBoneAssignmentList & getBoneAssignments()
Gets a const reference to the list of bone assignments.
Definition: OgreSubMesh.h:187
bool mVertexAnimationIncludesNormals
Whether normals are included in vertex animation keyframes.
Definition: OgreSubMesh.h:284
Mesh * parent
Reference to parent Mesh (not a smart pointer so child does not keep parent alive).
Definition: OgreSubMesh.h:136
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
size_t getTextureAliasCount(void) const
Gets the number of texture aliases assigned to the sub mesh.
Definition: OgreSubMesh.h:223
vector< IndexData * >::type LODFaceList
Definition: OgreSubMesh.h:111
vector< Vector3 >::type extremityPoints
A list of extreme points on the submesh (optional).
Definition: OgreSubMesh.h:133
ConstMapIterator< AliasTextureNamePairList > AliasTextureIterator
Definition: OgreSubMesh.h:193
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
bool hasTextureAliases(void) const
returns true if the sub mesh has texture aliases
Definition: OgreSubMesh.h:220
FastArray< unsigned short > IndexMap
Dedicated index map for translate blend index to bone index (only valid if useSharedVertices = false)...
Definition: OgreSubMesh.h:108
VertexAnimationType mVertexAnimationType
Type of vertex animation for dedicated vertex data (populated by Mesh)
Definition: OgreSubMesh.h:281
IndexMap blendIndexToBoneIndexMap
Definition: OgreSubMesh.h:109
bool isBuildEdgesEnabled(void) const
Returns true(by default) if the submesh should be included in the mesh EdgeList, otherwise returns fa...
Definition: OgreSubMesh.h:253
Internal implementation of Mesh reading / writing for the latest version of the .mesh format...
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Summary class collecting together index data source information.
Defines a part of a complete mesh.
Definition: OgreSubMesh.h:60
unsigned short ushort
Summary class collecting together vertex source information.
bool mBoneAssignmentsOutOfDate
Flag indicating that bone assignments need to be recompiled.
Definition: OgreSubMesh.h:278
'New' rendering operation using vertex buffers.
bool mMatInitialised
Is there a material yet?
Definition: OgreSubMesh.h:270
VertexData * vertexData
Dedicated vertex data (only valid if useSharedVertices = false).
Definition: OgreSubMesh.h:84
VertexBoneAssignmentList mBoneAssignments
Definition: OgreSubMesh.h:275
Class for providing backwards-compatibility for loading version 1.2 of the .mesh format.
bool mBuildEdgesEnabled
Is Build Edges Enabled.
Definition: OgreSubMesh.h:287
Concrete IteratorWrapper for const access to the underlying key-value container.
_StringBase String
Definition: OgreCommon.h:53
bool useSharedVertices
Indicates if this submesh shares vertex data with other meshes or whether it has it's own vertices...
Definition: OgreSubMesh.h:72
RenderOperation::OperationType operationType
The render operation type used to render this submesh.
Definition: OgreSubMesh.h:75
Resource holding data about 3D mesh.
Definition: OgreMesh.h:86
IndexData * indexData
Face index data.
Definition: OgreSubMesh.h:87
map< String, String >::type AliasTextureNamePairList
Alias / Texture name pair (first = alias, second = texture name)
Definition: OgreCommon.h:583
VertexAnimationType
Type of vertex animation.
Records the assignment of a single vertex to a single bone with the corresponding weight...
MapIterator< VertexBoneAssignmentList > BoneAssignmentIterator
Definition: OgreSubMesh.h:177
Class for providing backwards-compatibility for loading version 1.1 of the .mesh format.
AliasTextureNamePairList mTextureAliases
paired list of texture aliases and texture names
Definition: OgreSubMesh.h:273
OperationType
The rendering operation type to perform.
String mMaterialName
Name of the material this SubMesh uses.
Definition: OgreSubMesh.h:267
LODFaceList mLodFaceList
Definition: OgreSubMesh.h:112