diff options
Diffstat (limited to 'source/modules/asura-core/mesh')
-rw-r--r-- | source/modules/asura-core/mesh/am2_handler.cpp | 36 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/am2_handler.h | 32 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/mesh2d_data.h | 58 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/mesh2d_handler.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/mesh2d_handler.h | 34 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/obj_handler.cpp | 0 | ||||
-rw-r--r-- | source/modules/asura-core/mesh/obj_handler.h | 0 |
7 files changed, 160 insertions, 0 deletions
diff --git a/source/modules/asura-core/mesh/am2_handler.cpp b/source/modules/asura-core/mesh/am2_handler.cpp new file mode 100644 index 0000000..fce7817 --- /dev/null +++ b/source/modules/asura-core/mesh/am2_handler.cpp @@ -0,0 +1,36 @@ +#include "am2_handler.h" + +namespace AsuraEngine +{ + namespace Mesh + { +/* +Asuramesh2DʽΪ.am2ʽ¡ +ͷ11ֽڱһAsuraMesh2Dļ +ASURAMESH2D +v position +t tangent +n normal +[c color] +[u texcoord0] +[u texcoord1] +[u texcoord2] +[u texcoord3] + +f surface + + +ASURAMESH2D +p0 +v 0, 0 +t -0.2, 0.45 +n -0.3, 0.6 +p1 + + +*/ + + + + } +} diff --git a/source/modules/asura-core/mesh/am2_handler.h b/source/modules/asura-core/mesh/am2_handler.h new file mode 100644 index 0000000..de93be9 --- /dev/null +++ b/source/modules/asura-core/mesh/am2_handler.h @@ -0,0 +1,32 @@ +#ifndef __ASURA_MESH2D_AM2_HANDLER_H__ +#define __ASURA_MESH2D_AM2_HANDLER_H__ + +#include "mesh2d_handler.h" + +namespace AsuraEngine +{ + namespace Mesh + { + + /// + /// Asura Mesh Format handlerAsura.am2ʽmeshļ + /// + class AM2Handler ASURA_FINAL : public Mesh2DHandler + { + public: + + AM2Handler(); + ~AM2Handler(); + + bool CanDecode(AEIO::DataBuffer& input) override; + + void Decode(AEIO::DataBuffer& input, Mesh2DData& target) override; + + void Encode(Mesh2DData& input, AEIO::DataBuffer& target) override; + + }; + + } +} + +#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 e69de29..ad4b6c8 100644 --- a/source/modules/asura-core/mesh/mesh2d_data.h +++ b/source/modules/asura-core/mesh/mesh2d_data.h @@ -0,0 +1,58 @@ +#ifndef __ASURA_MESH2D_DATA_H__ +#define __ASURA_MESH2D_DATA_H__ + +#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/math/vector2.hpp> +#include <asura-utils/io/decoded_data.h> + +#include <vector> + +#include "../graphics/color.h" +#include "../graphics/gpu_buffer.h" + +namespace AsuraEngine +{ + namespace Mesh + { + + /// + /// Mesh2DĶݣindexʹáAsura 2D mesh֧4UVһϡ + /// + struct Vertex + { + AEMath::Vector2f position; ///< + AEMath::Vector2f tangent; ///< + AEMath::Vector2f normal; ///< + AEGraphics::Color color; ///< ɫ + AEMath::Vector2f texCoord[4]; ///< UVs + }; + + /// + /// meshĶݺ + /// + class Mesh2DData + : AEIO::DecodedData + , AEScripting::Portable<Mesh2DData> + { + public: + + void Decode(AEIO::DataBuffer& buffer) override; + + private: + + /// + /// meshж㡣 + /// + std::vector<Vertex*> mVertices; + + /// + /// ebo + /// + std::vector<float> mIndices; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/mesh/mesh2d_handler.cpp b/source/modules/asura-core/mesh/mesh2d_handler.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/mesh/mesh2d_handler.cpp diff --git a/source/modules/asura-core/mesh/mesh2d_handler.h b/source/modules/asura-core/mesh/mesh2d_handler.h new file mode 100644 index 0000000..05e12f0 --- /dev/null +++ b/source/modules/asura-core/mesh/mesh2d_handler.h @@ -0,0 +1,34 @@ +#ifndef __ASURA_MESH2D_HANDLER_H__ +#define __ASURA_MESH2D_HANDLER_H__ + +#include <asura-utils/io/data_buffer.h> +#include <asura-utils/type.h> + +#include "mesh2d_data.h" + +namespace AsuraEngine +{ + namespace Mesh + { + + /// + /// ͱmesh + /// + ASURA_ABSTRACT class Mesh2DHandler + { + public: + Mesh2DHandler() {}; + virtual ~Mesh2DHandler() {}; + + virtual bool CanDecode(AEIO::DataBuffer& input) = 0; + + virtual void Decode(AEIO::DataBuffer& input, Mesh2DData& target) = 0; + + virtual void Encode(Mesh2DData& input, AEIO::DataBuffer& target) = 0; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/mesh/obj_handler.cpp b/source/modules/asura-core/mesh/obj_handler.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/mesh/obj_handler.cpp diff --git a/source/modules/asura-core/mesh/obj_handler.h b/source/modules/asura-core/mesh/obj_handler.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/mesh/obj_handler.h |