29#include "System/json.h"
56 Mesh(
unsigned tilesWide = 1,
unsigned tilesHigh = 1);
72 [[nodiscard]] auto
name() const -> const std::
string&;
77 auto
setFrame(
unsigned newFrameNum) ->
void;
sys::Json Stream
Definition AudioObject.h:20
nlohmann::json json
Definition Json.cpp:19
uniforms
Definition Mesh.h:39
@ uvOffset
Definition Mesh.h:44
@ multColor
Definition Mesh.h:43
@ view
Definition Mesh.h:42
@ world
Definition Mesh.h:40
@ projection
Definition Mesh.h:41
int GLint
Definition VAO.h:20
Buffer that holds data for the vertices for OpenGL.
A struct for stroing vertexes and handing them to opengl.
Definition IndexBuffer.h:20
friend auto to_json(json &j, const Mesh &a) -> void
Definition Mesh.cpp:218
Mesh(unsigned tilesWide=1, unsigned tilesHigh=1)
constructs a mesh.
Definition Mesh.cpp:72
std::vector< gfx::Vertex > vertices
local copy of the Vertexes uploaded to the gpu
Definition Mesh.h:117
auto operator=(Mesh &&other) noexcept -> Mesh &=default
Mesh(const Mesh &other)=default
auto setObjectCamera(const AffineMatrix &camera) const -> void
Definition Mesh.cpp:203
unsigned maxFrames
max number of frames that makes sense for the mesh, assuming a tilesheet of spriteTilesCountV by spri...
Definition Mesh.h:122
std::shared_ptr< VAO > vao
vertex attribute object, the "mesh" in opengl
Definition Mesh.h:108
auto decrementFrame() -> void
Definition Mesh.cpp:173
auto setObjectColor(const Vector4D &color) const -> void
Definition Mesh.cpp:209
std::string _name
the name of the mesh, used for serialization
Definition Mesh.h:106
std::shared_ptr< IndexBuffer > triangleBuffer
Definition Mesh.h:109
auto operator=(const Mesh &other) -> Mesh &=default
unsigned spriteTilesCountU
number of sprite tiles wide the image would be for this mesh
Definition Mesh.h:113
Mesh(Mesh &&other) noexcept=default
unsigned spriteTilesCountV
number of sprite tiles high the image would be for this mesh
Definition Mesh.h:115
auto deactivate() const -> void
Definition Mesh.cpp:95
auto showMenu() -> void
Definition Mesh.cpp:184
auto name() const -> const std::string &
Definition Mesh.cpp:148
auto incrementFrame() -> void
Definition Mesh.cpp:168
friend auto from_json(const json &j, Mesh &a) -> void
Definition Mesh.cpp:228
auto setName(const std::string &name) -> void
Definition Mesh.cpp:153
auto activate() const -> void
Definition Mesh.cpp:90
auto draw(const Shader &shader, const Texture &texture) const -> void
Definition Mesh.cpp:100
auto getFrame() const -> unsigned
get the frame of the mesh. frames go right to left, then top top bottom
Definition Mesh.cpp:163
unsigned frame
frame of animation for calculating uv offsets, clamped to be valid for the sprite sheet size
Definition Mesh.h:120
auto setFrame(unsigned newFrameNum) -> void
Set the frame of the mesh, automatically calculates correct uv offset. Frames go right to left,...
Definition Mesh.cpp:158
auto save(Stream &stream) const -> void
Definition Mesh.cpp:143
auto uploadMeshToGPU() -> void
Upload mesh data to gpu, when creating mesh, or loading from a file.
Definition Mesh.cpp:38
auto setObjectTransform(const AffineMatrix &transform) const -> void
Sets the uniform for the object.
Definition Mesh.cpp:191
std::shared_ptr< VertexBuffer > vertexBuffer
Definition Mesh.h:110
auto load(Stream &stream) -> void
Definition Mesh.cpp:138
auto setObjectProjection(const AffineMatrix &projection) const -> void
Definition Mesh.cpp:198
auto getMaxFrames() const -> unsigned
get the max number of frames of the mesh, based on the tiles wide and high of the mesh
Definition Mesh.cpp:178
holds and manages textures for use with meshes in sprites
Definition Texture.h:31
Buffer that holds data for the vertices for OpenGL.
Definition VertexBuffer.h:29
Definition AffineMatrix.h:30