aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/mesh.h
blob: d17fcea81308e760ca2ebf7154f39998d1bb1b0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef __JE_MESH_H__
#define __JE_MESH_H__

#include <vector>

#include "../math/bbox.h"

#include "vertex.h"
#include "graphic.h"

namespace JinEngine
{
    namespace Graphics
    {

        ///
        /// A 2D mesh.
        ///
        class Mesh : public Renderable, public Object
        {
        public:
            Mesh();

            void setGraphic(const Graphic* graphic);
            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
} // namespace JinEngine

#endif