EHS
Mesh.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Array.h"
5#include "Vertex.h"
6#include "ehs/BaseObj.h"
7
8namespace ehs
9{
10 class EHS_LIB_IO Mesh final : public BaseObj
11 {
12 protected:
13 UInt_64 hashId;
17
18 public:
19 Mesh();
20
21 Mesh(Str_8 id, Array<Vertex_f> vertices, Array<UInt_32> indices);
22
23 Mesh(Str_8 id, Array<Vertex_f> vertices);
24
25 Mesh(Mesh&& mesh) noexcept;
26
27 Mesh(const Mesh& mesh);
28
29 Mesh& operator=(Mesh&& mesh) noexcept;
30
31 Mesh& operator=(const Mesh& mesh);
32
33 void Release();
34
35 UInt_64 GetHashId() const;
36
37 void SetId(Str_8 newId);
38
39 Str_8 GetId() const;
40
41 void SetVertices(const Array<Vertex_f>& newVertices);
42
43 const Array<Vertex_f>& GetVertices() const;
44
45 Array<Vertex_f>& GetVertices();
46
47 void SetIndices(const Array<UInt_32>& newIndices);
48
49 bool HasIndices() const;
50
51 const Array<UInt_32>& GetIndices() const;
52
53 Array<UInt_32>& GetIndices();
54
55 void Calculate();
56
57 private:
58 static void Calculate(Vertex_f& vert1, Vertex_f& vert2, Vertex_f& vert3);
59 };
60
61 const Mesh portraitGui("PortraitGui",
62 {
63 {{0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}},
64 {{0.0f, 1.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}},
65 {{1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}},
66 {{1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}}
67 },
68 {0, 1, 2, 3, 2, 1}
69 );
70
71 const Mesh portrait("Portrait",
72 {
73 {{-0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}},
74 {{-0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}},
75 {{0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}},
76 {{0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}}
77 },
78 {0, 1, 2, 3, 2, 1}
79 );
80}
Definition: Array.h:16
Definition: BaseObj.h:9
Definition: Mesh.h:11
UInt_64 hashId
Definition: Mesh.h:13
Array< UInt_32 > indices
Definition: Mesh.h:16
Array< Vertex_f > vertices
Definition: Mesh.h:15
Str_8 id
Definition: Mesh.h:14
Definition: Vertex.h:13
Definition: Anchor.h:6
const Mesh portraitGui("PortraitGui", { {{0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}}, {{0.0f, 1.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}}, {{1.0f, 0.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}}, {{1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}} }, {0, 1, 2, 3, 2, 1})
const Mesh portrait("Portrait", { {{-0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 0.0f}}, {{-0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f}}, {{0.5f, -0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 0.0f}}, {{0.5f, 0.5f, 0.0f}, {0.0f, 0.0f, -1.0f}, {1.0f, 1.0f}} }, {0, 1, 2, 3, 2, 1})