From 84a663cb70b057a5ce0c9ff1910bc2eb9c0ba653 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 21 Dec 2018 19:02:22 +0800 Subject: +2d mesh --- src/libjin/graphics/je_mesh.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/libjin/graphics/je_mesh.h') 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 + +#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 mVertices; + }; } // namespace Graphics -- cgit v1.1-26-g67d0