VenomEngine
Cross-Platform Modern Graphics Engine
Loading...
Searching...
No Matches
Mesh.h
Go to the documentation of this file.
1
8#pragma once
9
12
14
15#include <vector>
16
17namespace venom
18{
19namespace common
20{
21class ModelImpl;
22class VENOM_COMMON_API MeshImpl : public PluginObjectImpl, public GraphicsPluginObject
23{
24public:
25 MeshImpl();
26 virtual ~MeshImpl() = default;
27
28 void SetMaterial(const Material & material);
29 bool HasMaterial() const;
30 const Material & GetMaterial() const;
31 virtual void Draw() = 0;
32
33private:
39 virtual vc::Error __LoadMeshFromCurrentData() = 0;
40
41protected:
42 friend class ModelImpl;
43 std::vector<vcm::VertexPos> _positions;
44 std::vector<vcm::VertexNormal> _normals;
45 std::vector<vcm::VertexColor> _colors[8];
46 std::vector<vcm::VertexUV> _uvs[8];
47 std::vector<uint32_t> _indices;
48 std::vector<vcm::VertexTangent> _tangents;
49 std::vector<vcm::VertexBitangent> _bitangents;
51};
52
55class VENOM_COMMON_API Mesh : public PluginObjectImplWrapper
56{
57public:
58 Mesh();
59 ~Mesh();
60
65 inline void SetMaterial(const Material & material) {
66 _impl->As<MeshImpl>()->SetMaterial(material);
67 }
68
73 inline bool HasMaterial() const {
74 return _impl->As<MeshImpl>()->HasMaterial();
75 }
76
81 inline const Material & GetMaterial() const {
82 return _impl->As<MeshImpl>()->GetMaterial();
83 }
84
88 inline void Draw() const {
89 _impl->As<MeshImpl>()->Draw();
90 }
91
92private:
93 friend class ModelImpl;
94};
95
96
97}
98}
Base class for graphics plugin objects.
Definition GraphicsPluginObject.h:80
Definition Material.h:58
Contains all the mesh's data and is the main high-level interface for the user.
Definition Mesh.h:56
void Draw() const
Draws the mesh.
Definition Mesh.h:88
bool HasMaterial() const
Checks if the mesh has a Material assigned.
Definition Mesh.h:73
const Material & GetMaterial() const
Returns the Material assigned to the mesh.
Definition Mesh.h:81
void SetMaterial(const Material &material)
Assigns Material to mesh.
Definition Mesh.h:65
Definition Mesh.h:23
Definition Model.h:30
Container for the PluginObjectImplWrapper Important to avoid it from loading the PluginObjectImpl if ...
Definition PluginObject.h:111
Interface for the PluginObject different implementations.
Definition PluginObject.h:56
Wrapper for the PluginObjectImpl, inherited by classes like Model or Mesh to make them usable as comp...
Definition PluginObject.h:76
Contains the entirety of the code of the VenomEngine project.
Definition Config.h:13