diff options
author | chai <chaifix@163.com> | 2018-12-21 19:02:22 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-21 19:02:22 +0800 |
commit | 84a663cb70b057a5ce0c9ff1910bc2eb9c0ba653 (patch) | |
tree | 625d2a7804c6f29aac367098972f96a47fcb7ae3 /src/libjin/graphics/je_mesh.h | |
parent | 90cd4ff40e647e4150638e69f80ac587ceff1631 (diff) |
+2d mesh
Diffstat (limited to 'src/libjin/graphics/je_mesh.h')
-rw-r--r-- | src/libjin/graphics/je_mesh.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/libjin/graphics/je_mesh.h b/src/libjin/graphics/je_mesh.h index 5bcca2e..1dbf3a4 100644 --- a/src/libjin/graphics/je_mesh.h +++ b/src/libjin/graphics/je_mesh.h @@ -1,6 +1,11 @@ #ifndef __JE_MESH_H__ #define __JE_MESH_H__ +#include <vector> + +#include "../math/je_bbox.h" + +#include "je_vertex.h" #include "je_graphic.h" namespace JinEngine @@ -11,15 +16,34 @@ namespace JinEngine /// /// A 2D mesh. /// - class Mesh + class Mesh : public Renderable, public Object { public: + Mesh(); + void setGraphic(const Graphic* graphic); - void pushVertex(float x, float y, float u, float v); + void pushVertex(float x, float y, float u, float v, Color color = Color::WHITE); + void pushVertex(const Vertex& vertex); + inline Math::BBox getBound() { return mBound; } + + void render(float x, float y, float sx, float sy, float r, float ox = 0, float oy = 0) const; private: + /// + /// Graphic binded. + /// const Graphic* mGraphic; + /// + /// Bound box of mesh. + /// + Math::BBox mBound; + + /// + /// + /// + std::vector<Vertex> mVertices; + }; } // namespace Graphics |