29#include "System/json.h"
63 Mesh(
unsigned tilesWide = 1,
unsigned tilesHigh = 1);
79 [[nodiscard]] auto
name() const -> const std::
string&;
84 auto
setFrame(
unsigned newFrameNum) ->
void;
sys::Json Stream
Definition AudioObject.h:20
nlohmann::json json
Definition Json.cpp:19
uniforms
Definition Mesh.h:43
@ uvOffset
Definition Mesh.h:48
@ multColor
Definition Mesh.h:47
@ view
Definition Mesh.h:46
@ world
Definition Mesh.h:44
@ projection
Definition Mesh.h:45
int GLint
Definition VAO.h:23
Buffer that holds data for the vertices for OpenGL.
A struct for stroing vertexes and handing them to opengl.
Definition IndexBuffer.h:23
friend auto to_json(json &j, const Mesh &a) -> void
Definition Mesh.cpp:221
auto uploadMeshToGPU() -> void
Upload mesh data to gpu, when creating mesh, or loading from a file.
Definition Mesh.cpp:41
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:181
std::vector< Vertex > vertices
local copy of the Vertexes uploaded to the gpu
Definition Mesh.h:124
auto operator=(const Mesh &other) -> Mesh &=default
auto incrementFrame() -> void
Definition Mesh.cpp:171
auto getFrame() const -> unsigned
get the frame of the mesh. frames go right to left, then top top bottom
Definition Mesh.cpp:166
unsigned spriteTilesCountU
number of sprite tiles wide the image would be for this mesh
Definition Mesh.h:120
std::shared_ptr< IndexBuffer > triangleBuffer
Definition Mesh.h:116
auto setObjectColor(const Vector4D &color) const -> void
Definition Mesh.cpp:212
unsigned maxFrames
max number of frames that makes sense for the mesh, assuming a tilesheet of spriteTilesCountV by spri...
Definition Mesh.h:129
auto setObjectTransform(const AffineMatrix &transform) const -> void
Sets the uniform for the object.
Definition Mesh.cpp:194
Mesh(unsigned tilesWide=1, unsigned tilesHigh=1)
constructs a mesh.
Definition Mesh.cpp:75
unsigned spriteTilesCountV
number of sprite tiles high the image would be for this mesh
Definition Mesh.h:122
auto name() const -> const std::string &
Definition Mesh.cpp:151
auto setFrame(unsigned newFrameNum) -> void
Set the frame of the mesh, automatically calculates correct uv offset. Frames go right to left,...
Definition Mesh.cpp:161
auto decrementFrame() -> void
Definition Mesh.cpp:176
auto save(Stream &stream) const -> void
Definition Mesh.cpp:146
auto operator=(Mesh &&other) noexcept -> Mesh &=default
auto setObjectProjection(const AffineMatrix &projection) const -> void
Definition Mesh.cpp:201
auto activate() const -> void
Definition Mesh.cpp:93
auto deactivate() const -> void
Definition Mesh.cpp:98
std::string _name
the name of the mesh, used for serialization
Definition Mesh.h:113
friend auto from_json(const json &j, Mesh &a) -> void
Definition Mesh.cpp:231
std::shared_ptr< VertexBuffer > vertexBuffer
Definition Mesh.h:117
std::shared_ptr< VAO > vao
vertex attribute object, the "mesh" in opengl
Definition Mesh.h:115
auto setObjectCamera(const AffineMatrix &camera) const -> void
Definition Mesh.cpp:206
Mesh(Mesh &&other) noexcept=default
unsigned frame
frame of animation for calculating uv offsets, clamped to be valid for the sprite sheet size
Definition Mesh.h:127
auto load(const Stream &stream) -> void
Definition Mesh.cpp:141
auto setName(const std::string &name) -> void
Definition Mesh.cpp:156
auto draw(const Shader &shader, const Texture &texture) const -> void
Definition Mesh.cpp:103
auto showMenu() -> void
Definition Mesh.cpp:187
Mesh(const Mesh &other)=default
holds and manages textures for use with meshes in sprites
Definition Texture.h:33
Buffer that holds data for the vertices for OpenGL.
Definition VertexBuffer.h:32
Definition AffineMatrix.h:30