gwnavruntime/collision/indexedmesh.h Source File

indexedmesh.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 #pragma once
8 
10 
11 namespace Kaim
12 {
13 
14 class File;
15 
18 class IndexedMesh : public RefCountBase<IndexedMesh, MemStat_CollisionData>
19 {
20 public:
21  IndexedMesh() : m_blob(nullptr) {}
22 
23  void InitFromBuilder(IndexedMeshBlobBuilder& builder);
24  void InitFromHandler(Ptr<BlobHandler<IndexedMeshBlob>> handler);
25 
26  KyUInt32 GetTriangleCount() const { return m_blob->m_indices.GetCount() / 3; }
27  KyUInt32 GetVertexCount() const { return m_blob->m_vertices.GetCount(); }
28  KyUInt32 GetIndexCount() const { return m_blob->m_indices.GetCount(); }
29 
30  KyUInt32 GetIndexAt(const KyUInt32 i) const { return m_blob->m_indices.GetValues()[i]; }
31  Vec3f GetVertexAt(const KyUInt32 i) const { return m_blob->m_vertices.GetValues()[i]; }
32 
33  const UByte* GetIndicesDataPtr() const { return m_blob->GetIndexBase(); }
34  const UByte* GetVerticesDataPtr() const { return m_blob->GetVertexBase(); }
35 
36  KyUInt32 GetIndexStride() const { return 3 * sizeof(KyUInt32); }
37  KyUInt32 GetVertexStride() const { return 3 * sizeof(KyFloat32); }
38 
39  KyResult WriteToObjFile(File* objFile) const;
40 
41  BlobHandler<IndexedMeshBlob>* GetBlobHandler() { return m_blobHandler; }
42 
43 private:
44  Ptr<BlobHandler<IndexedMeshBlob>> m_blobHandler;
45  IndexedMeshBlob* m_blob;
46 };
47 }
48 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Wraps a IndexedMeshBlob either as IndexedMeshBlob* or as Ptr< />> Also adds ...
Definition: indexedmesh.h:18
std::uint8_t UByte
uint8_t
Definition: SF_Types.h:134
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16