12#ifndef FOOLSENGINE_MESH_H
13#define FOOLSENGINE_MESH_H
22#include <assimp/scene.h>
44 StaticMesh(
const std::vector<BuiltinVertexData>&
mVertices,
const std::vector<GLuint>&
mElements, GLuint vertexBuffer=0, GLuint elementBuffer=0,
bool isUploaded=
false);
275 std::shared_ptr<IResource>
createResource(
const nlohmann::json& methodParameters)
override;
ResourceConstructor(int explicitlyInitializeMe)
Definition resource_database.hpp:491
Resource(int explicitlyInitializeMe)
Definition resource_database.hpp:389
StaticMeshFromDescription()
Creates this StaticMesh constructor.
Definition mesh.hpp:254
static std::string getResourceConstructorName()
Gets the constructor type string for this constructor.
Definition mesh.hpp:264
std::shared_ptr< IResource > createResource(const nlohmann::json &methodParameters) override
The method responsible for actually creating a StaticMesh.
Definition mesh.cpp:220
A class whose current main purpose is to store geometry related info, and to upload it to GPU memory ...
Definition mesh.hpp:33
StaticMesh(const std::vector< BuiltinVertexData > &mVertices, const std::vector< GLuint > &mElements, GLuint vertexBuffer=0, GLuint elementBuffer=0, bool isUploaded=false)
Constructs a new static mesh object.
Definition mesh.cpp:15
std::vector< BuiltinVertexData >::iterator getVertexListEnd()
Gets an iterator to the end of this object's vertex list.
Definition mesh.cpp:238
void unload()
Deallocates vertex and element data belonging to this object from the GPU.
Definition mesh.cpp:192
void setAttributePointers(const VertexLayout &shaderVertexLayout, std::size_t startingOffset=0)
Specifies the offsets of vertex attributes per the vertex layout requested by a shader.
Definition mesh.cpp:133
void bind(const VertexLayout &shaderVertexLayout)
Binds this object's vertex data according to the vertex layout specified by the shader program.
Definition mesh.cpp:90
GLuint getElementCount()
Returns number of elements in the elements array for this mesh.
Definition mesh.hpp:66
GLuint mVertexBuffer
The OpenGL vertex buffer handle for this object, if it has been uploaded to GPU memory.
Definition mesh.hpp:165
void releaseResource()
Loses references to resources owned by this object, allowing another object to take ownership of them...
Definition mesh.cpp:207
void unbind()
Unbinds this object's vertex data.
Definition mesh.cpp:187
void destroyResource()
Deallocates related GPU buffers and releases resources owned by this object.
Definition mesh.cpp:203
std::vector< BuiltinVertexData >::iterator getVertexListBegin()
Gets an iterator to the beginning of this object's vertex list.
Definition mesh.cpp:232
VertexLayout getVertexLayout() const
Gets the vertex layout associated with this object, that of BuiltinVertexData.
Definition mesh.cpp:216
void upload()
Uploads the vertex and element data for this object to the GPU.
Definition mesh.cpp:107
std::vector< BuiltinVertexData > mVertices
This object's vertex data.
Definition mesh.hpp:140
bool mIsUploaded
Marker for whether the data in this object has been uploaded to the GPU.
Definition mesh.hpp:159
VertexLayout mVertexLayout
The vertex layout associated with this mesh, same as BuiltinVertexData's vertex layout.
Definition mesh.hpp:153
GLuint mElementBuffer
The OpenGL element buffer handle for this object, if it has been uploaded to GPU memory.
Definition mesh.hpp:171
static std::string getResourceTypeName()
Gets the resource type string for this object.
Definition mesh.hpp:123
StaticMesh & operator=(const StaticMesh &other)
Copy assignment operator.
Definition mesh.cpp:75
~StaticMesh()
Destructor.
Definition mesh.cpp:31
std::vector< GLuint > mElements
This object's element list.
Definition mesh.hpp:147
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition camera_system.hpp:20
Headers relating to resources and their management for a given project.
A list of attribute descriptors that together define the layout and size of the vertex they make up i...
Definition vertex.hpp:141
Contains engine's built-in vertex definitions, along with their associated attribute locations in the...