diff options
Diffstat (limited to 'source/modules/asura-core/mesh')
-rw-r--r-- | source/modules/asura-core/mesh/am2_handler.cpp | 10 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/am2_handler.h | 34 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/mesh2d_data.h | 100 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/mesh2d_handler.h | 34 |
4 files changed, 85 insertions, 93 deletions
diff --git a/source/modules/asura-core/mesh/am2_handler.cpp b/source/modules/asura-core/mesh/am2_handler.cpp index 31bd51b..d0b9252 100644 --- a/source/modules/asura-core/mesh/am2_handler.cpp +++ b/source/modules/asura-core/mesh/am2_handler.cpp @@ -1,9 +1,7 @@ #include "am2_handler.h" -namespace AsuraEngine -{ - namespace Mesh - { +namespace_begin(AsuraEngine) +namespace_begin(Mesh) /* Asuramesh2DʽΪ.am2ʽ¡ ͷ11ֽڱһAsuraMesh2Dļ @@ -32,5 +30,5 @@ f 0, 1, 2 - } -} +namespace_end +namespace_end diff --git a/source/modules/asura-core/mesh/am2_handler.h b/source/modules/asura-core/mesh/am2_handler.h index de93be9..4fa8ba5 100644 --- a/source/modules/asura-core/mesh/am2_handler.h +++ b/source/modules/asura-core/mesh/am2_handler.h @@ -3,30 +3,28 @@ #include "mesh2d_handler.h" -namespace AsuraEngine -{ - namespace Mesh - { +namespace_begin(AsuraEngine) +namespace_begin(Mesh) - /// - /// Asura Mesh Format handlerAsura.am2ʽmeshļ - /// - class AM2Handler ASURA_FINAL : public Mesh2DHandler - { - public: +/// +/// Asura Mesh Format handlerAsura.am2ʽmeshļ +/// +class AM2Handler ASURA_FINAL : public Mesh2DHandler +{ +public: - AM2Handler(); - ~AM2Handler(); + AM2Handler(); + ~AM2Handler(); - bool CanDecode(AEIO::DataBuffer& input) override; + bool CanDecode(AEIO::DataBuffer& input) override; - void Decode(AEIO::DataBuffer& input, Mesh2DData& target) override; + void Decode(AEIO::DataBuffer& input, Mesh2DData& target) override; - void Encode(Mesh2DData& input, AEIO::DataBuffer& target) override; + void Encode(Mesh2DData& input, AEIO::DataBuffer& target) override; - }; +}; - } -} +namespace_end +namespace_end #endif
\ No newline at end of file diff --git a/source/modules/asura-core/mesh/mesh2d_data.h b/source/modules/asura-core/mesh/mesh2d_data.h index 2fea7ec..024ba02 100644 --- a/source/modules/asura-core/mesh/mesh2d_data.h +++ b/source/modules/asura-core/mesh/mesh2d_data.h @@ -13,67 +13,65 @@ #include "../graphics/color.h" #include "../graphics/gpu_buffer.h" -namespace AsuraEngine +namespace_begin(AsuraEngine) +namespace_begin(Mesh) + +/// +/// Mesh2DĶݣindexʹáAsura 2D mesh֧4UVһϡ +/// +struct Vertex +{ + AEMath::Vector2f position; ///< + AEGraphics::Color color; ///< ɫ + AEMath::Vector2f texCoord[4]; ///< UVs +}; + +/// +/// meshĶݺ +/// +class Mesh2DData + : AEIO::DecodedData + , AEScripting::Portable<Mesh2DData> { - namespace Mesh +public: + + enum Mesh2DComponent { + MESH2D_COMPONENT_POSITION, + MESH2D_COMPONENT_COLOR, + MESH2D_COMPONENT_TEXCOORD0, + MESH2D_COMPONENT_TEXCOORD1, + MESH2D_COMPONENT_TEXCOORD2, + MESH2D_COMPONENT_TEXCOORD3, + }; + + void Decode(AEIO::DataBuffer& buffer) override; + +private: - /// - /// Mesh2DĶݣindexʹáAsura 2D mesh֧4UVһϡ - /// - struct Vertex - { - AEMath::Vector2f position; ///< - AEGraphics::Color color; ///< ɫ - AEMath::Vector2f texCoord[4]; ///< UVs - }; - - /// - /// meshĶݺ - /// - class Mesh2DData - : AEIO::DecodedData - , AEScripting::Portable<Mesh2DData> - { - public: - - enum Mesh2DComponent - { - MESH2D_COMPONENT_POSITION, - MESH2D_COMPONENT_COLOR, - MESH2D_COMPONENT_TEXCOORD0, - MESH2D_COMPONENT_TEXCOORD1, - MESH2D_COMPONENT_TEXCOORD2, - MESH2D_COMPONENT_TEXCOORD3, - }; - - void Decode(AEIO::DataBuffer& buffer) override; - - private: - - LUAX_DECL_FACTORY(Mesh2DData); + LUAX_DECL_FACTORY(Mesh2DData); - LUAX_DECL_ENUM(Mesh2DComponent, 1); + LUAX_DECL_ENUM(Mesh2DComponent, 1); - LUAX_DECL_METHOD(_GetVertices); - LUAX_DECL_METHOD(_GetVertex); + LUAX_DECL_METHOD(_GetVertices); + LUAX_DECL_METHOD(_GetVertex); - /// - /// meshж㡣 - /// - std::vector<Vertex*> m_Vertices; + /// + /// meshж㡣 + /// + std::vector<Vertex*> m_Vertices; - /// - /// ebo - /// - std::vector<int> m_Indices; + /// + /// ebo + /// + std::vector<int> m_Indices; - int m_Components; + int m_Components; - }; +}; - } -} +namespace_end +namespace_end namespace AEMesh = AsuraEngine::Mesh; diff --git a/source/modules/asura-core/mesh/mesh2d_handler.h b/source/modules/asura-core/mesh/mesh2d_handler.h index 05e12f0..c8ae32e 100644 --- a/source/modules/asura-core/mesh/mesh2d_handler.h +++ b/source/modules/asura-core/mesh/mesh2d_handler.h @@ -6,29 +6,27 @@ #include "mesh2d_data.h" -namespace AsuraEngine -{ - namespace Mesh - { +namespace_begin(AsuraEngine) +namespace_begin(Mesh) - /// - /// ͱmesh - /// - ASURA_ABSTRACT class Mesh2DHandler - { - public: - Mesh2DHandler() {}; - virtual ~Mesh2DHandler() {}; +/// +/// ͱmesh +/// +ASURA_ABSTRACT class Mesh2DHandler +{ +public: + Mesh2DHandler() {}; + virtual ~Mesh2DHandler() {}; - virtual bool CanDecode(AEIO::DataBuffer& input) = 0; + virtual bool CanDecode(AEIO::DataBuffer& input) = 0; - virtual void Decode(AEIO::DataBuffer& input, Mesh2DData& target) = 0; + virtual void Decode(AEIO::DataBuffer& input, Mesh2DData& target) = 0; - virtual void Encode(Mesh2DData& input, AEIO::DataBuffer& target) = 0; + virtual void Encode(Mesh2DData& input, AEIO::DataBuffer& target) = 0; - }; +}; - } -} +namespace_end +namespace_end #endif
\ No newline at end of file |