8#ifndef ENGINE_GRAPHICS_GMESH_H_
9#define ENGINE_GRAPHICS_GMESH_H_
12#include <unordered_map>
27 gMesh(
const std::vector<gVertex>&
vertices,
const std::vector<gIndex>& indices,
const std::vector<gTexture*>& textures);
29 std::shared_ptr<std::vector<gIndex>> indices,
30 std::vector<gTexture*> textures);
37 void setVertices(std::shared_ptr<std::vector<gVertex>>
vertices, std::shared_ptr<std::vector<gIndex>> indices);
40 void setTextures(
const std::unordered_map<gTexture::TextureType, gTexture*>& textures);
68 virtual void drawInstanced(
const std::vector<glm::mat4>& instanceTransformations);
127 void drawVulkan3D(
const std::vector<glm::mat4>* instanceTransformations =
nullptr,
128 gVbo* sourceVbo =
nullptr);
134 std::unique_ptr<gVbo>
vbo;
139 std::shared_ptr<std::vector<gIndex>> indices;
142 std::unordered_map<gTexture::TextureType, gTexture*> textures;
143 std::unordered_map<gTexture::TextureType, std::string> texturenames;
144 std::unordered_map<gTexture::TextureType, int> texturecounters = {
157 glm::vec2 texturetiling{1.0f, 1.0f};
159 gBoundingBox initialboundingbox;
160 gBoundingBox boundingbox;
161 bool needsboundingboxrecalculation;
Definition gBoundingBox.h:36
Definition gMaterial.h:20
static const int DRAWMODE_LINELOOP
Definition gMesh.h:23
std::shared_ptr< std::vector< gIndex > > getIndicesPtr()
void recalculateBoundingBox()
void setTexture(gTexture *texture)
void setTextureTiling(float tilingX, float tilingY)
const glm::vec2 & getTextureTiling() const
static const int DRAWMODE_POINTS
Definition gMesh.h:23
float distanceTriangles(gRay *ray)
void bindMaterialUniforms(gShader &shader)
virtual void drawInstanced(const std::vector< glm::mat4 > &instanceTransformations)
gMaterial * getMaterial()
void setName(const std::string &name)
bool vulkanindicesexpanded
Definition gMesh.h:118
void setTextures(const std::unordered_map< gTexture::TextureType, gTexture * > &textures)
static const int DRAWMODE_TRIANGLES
Definition gMesh.h:24
void drawStart(bool isInstanced=false)
std::vector< gVertex > & getVertices()
void fillMissingVertexColors(const glm::vec3 &defColor=glm::vec3(1.0f))
bool isprojection2d
Definition gMesh.h:136
int getVerticesNum() const
int getIndicesNum() const
const std::string & getName() const
gTexture * getTexture(gTexture::TextureType type)
static const int DRAWMODE_LINESTRIP
Definition gMesh.h:23
void setTextureTiling(float tiling)
void setVertices(const std::vector< gVertex > &vertices)
void setDrawMode(int drawMode)
void setTextures(const std::vector< gTexture * > &textures)
gMesh(std::shared_ptr< std::vector< gVertex > > vertices, std::shared_ptr< std::vector< gIndex > > indices, std::vector< gTexture * > textures)
void setMaterial(gMaterial *material)
void setVertices(const std::vector< gVertex > &vertices, const std::vector< gIndex > &indices)
static const int DRAWMODE_TRIANGLESTRIP
Definition gMesh.h:24
std::vector< gIndex > & getIndices()
bool intersectsTriangles(gRay *ray)
void setVertices(std::shared_ptr< std::vector< gVertex > > vertices, std::shared_ptr< std::vector< gIndex > > indices)
void setVertices(std::shared_ptr< std::vector< gVertex > > vertices)
void processTransformationMatrix() override
std::unique_ptr< gVbo > vbo
Definition gMesh.h:134
std::shared_ptr< std::vector< gVertex > > vertices
Definition gMesh.h:135
static const int DRAWMODE_LINES
Definition gMesh.h:23
const gBoundingBox & getInitialBoundingBox() const
const gBoundingBox & getBoundingBox()
void applyVertexGradient()
void bindMaterialTextures(gShader &shader)
static const int DRAWMODE_TRIANGLEFAN
Definition gMesh.h:24
void setAllVertexColor(const glm::vec3 &color)
gMesh(const std::vector< gVertex > &vertices, const std::vector< gIndex > &indices, const std::vector< gTexture * > &textures)
std::shared_ptr< std::vector< gVertex > > getVerticesPtr()
void drawVulkan3D(const std::vector< glm::mat4 > *instanceTransformations=nullptr, gVbo *sourceVbo=nullptr)
void drawVboInstanced(const std::vector< glm::mat4 > &instanceTransformations)
void expandIndicesForVulkan()
TextureType
Definition gTexture.h:19
@ TEXTURETYPE_PBR_AO
Definition gTexture.h:28
@ TEXTURETYPE_HEIGHT
Definition gTexture.h:23
@ TEXTURETYPE_NORMAL
Definition gTexture.h:22
@ TEXTURETYPE_PBR_ALBEDO
Definition gTexture.h:24
@ TEXTURETYPE_PBR_METALNESS
Definition gTexture.h:26
@ TEXTURETYPE_DIFFUSE
Definition gTexture.h:20
@ TEXTURETYPE_PBR_ROUGHNESS
Definition gTexture.h:25
@ TEXTURETYPE_PBR_NORMAL
Definition gTexture.h:27
@ TEXTURETYPE_SPECULAR
Definition gTexture.h:21