From 639b34294ffc20721c66db46e59e07d9100ac4b8 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 10 Sep 2020 20:30:31 +0800 Subject: *init --- Runner/Mesh/Font.cpp | 0 Runner/Mesh/Font.h | 0 Runner/Mesh/FontManager.h | 0 Runner/Mesh/Glyph.h | 9 +++++++ Runner/Mesh/Mesh.cpp | 4 +++ Runner/Mesh/Mesh.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++ Runner/Mesh/MeshUtil.h | 6 +++++ Runner/Mesh/TextMesh.h | 11 +++++++++ 8 files changed, 92 insertions(+) create mode 100644 Runner/Mesh/Font.cpp create mode 100644 Runner/Mesh/Font.h create mode 100644 Runner/Mesh/FontManager.h create mode 100644 Runner/Mesh/Glyph.h create mode 100644 Runner/Mesh/Mesh.cpp create mode 100644 Runner/Mesh/Mesh.h create mode 100644 Runner/Mesh/MeshUtil.h create mode 100644 Runner/Mesh/TextMesh.h (limited to 'Runner/Mesh') diff --git a/Runner/Mesh/Font.cpp b/Runner/Mesh/Font.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Runner/Mesh/Font.h b/Runner/Mesh/Font.h new file mode 100644 index 0000000..e69de29 diff --git a/Runner/Mesh/FontManager.h b/Runner/Mesh/FontManager.h new file mode 100644 index 0000000..e69de29 diff --git a/Runner/Mesh/Glyph.h b/Runner/Mesh/Glyph.h new file mode 100644 index 0000000..6020b45 --- /dev/null +++ b/Runner/Mesh/Glyph.h @@ -0,0 +1,9 @@ +#ifndef GLYPH_H +#define GLYPH_H + +class Glyph +{ + +}; + +#endif \ No newline at end of file diff --git a/Runner/Mesh/Mesh.cpp b/Runner/Mesh/Mesh.cpp new file mode 100644 index 0000000..95bd597 --- /dev/null +++ b/Runner/Mesh/Mesh.cpp @@ -0,0 +1,4 @@ +#include "Mesh.h" +#include "MeshUtil.h" + + diff --git a/Runner/Mesh/Mesh.h b/Runner/Mesh/Mesh.h new file mode 100644 index 0000000..77c6577 --- /dev/null +++ b/Runner/Mesh/Mesh.h @@ -0,0 +1,62 @@ +#ifndef MESH_H +#define MESH_H + +#include "../Graphics/VertexBuffer.h" +#include "../Utilities/Type.h" + +// Ïà¶ÔVertexBuffer¸ü¼Óuplevel +class Mesh +{ +public: + + Mesh(bool readable = false); + ~Mesh(); + + void IsReadable(); + + void SetVertices(float* data); + void SetNormals(float* data); + void SetTangents(float* data); + void SetColors(float* data); + void SetTexCoords(int channel, float* data); + + void SetTriangles(int* indices); + void SetIndices(int* indices); + + void SetVertices(float* data, int start, int length); + void SetNormals(float* data, int start, int length); + void SetTangents(float* data, int start, int length); + void SetColors(float* data, int start, int length); + void SetTexCoords(int channel, float* data, int start, int length); + + void SetVertex(float x, float y, float z, int index); + void SetNormal(float x, float y, float z, int index); + void SetTangent(float x, float y, float z, int index); + void SetColor(float r, float g, float b, float a, int index); + void SetTexCoord(float u, float v, int index); + + void GetAABB(float bias = 0.f); + + inline bool HasVertexAttr(VertexAttrMask attr); + + void Draw(); + + void CalculateNormal(); + void CalculateTangent(); + +private: + + uint m_VertexAttrBits; + + bool m_IsReadable; + + VertexBuffer* m_VBO; + +}; + +inline bool Mesh::HasVertexAttr(VertexAttrMask attr) +{ + return m_VertexAttrBits & attr; +} + +#endif \ No newline at end of file diff --git a/Runner/Mesh/MeshUtil.h b/Runner/Mesh/MeshUtil.h new file mode 100644 index 0000000..830ac70 --- /dev/null +++ b/Runner/Mesh/MeshUtil.h @@ -0,0 +1,6 @@ +#ifndef MESH_UTIL_H +#define MESH_UTIL_H + + + +#endif \ No newline at end of file diff --git a/Runner/Mesh/TextMesh.h b/Runner/Mesh/TextMesh.h new file mode 100644 index 0000000..1f27bbb --- /dev/null +++ b/Runner/Mesh/TextMesh.h @@ -0,0 +1,11 @@ +#ifndef TEXT_MESH_H +#define TEXT_MESH_H + +class TextMesh +{ +public: + + +}; + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0