Merge branch 'master' of https://git.epicsparrow.com/epicsparrow/sparrowrenderer
This commit is contained in:
commit
0f26ca0d24
@ -31,19 +31,19 @@ void MeshBuilder::addTexCoord(const glm::vec2 &texCoord)
|
||||
}
|
||||
|
||||
|
||||
void MeshBuilder::addVertex(glm::vec3 &position, glm::vec3 &normal)
|
||||
void MeshBuilder::addVertex(const glm::vec3 &position, const glm::vec3 &normal)
|
||||
{
|
||||
addPosition(position);
|
||||
addNormal(normal);
|
||||
}
|
||||
|
||||
void MeshBuilder::addVertex(glm::vec3 &position, glm::vec2 &texCoord)
|
||||
void MeshBuilder::addVertex(const glm::vec3 &position, const glm::vec2 &texCoord)
|
||||
{
|
||||
addPosition(position);
|
||||
addTexCoord(texCoord);
|
||||
}
|
||||
|
||||
void MeshBuilder::addVertex(glm::vec3 &position, glm::vec3 &normal, glm::vec2 &texCoord)
|
||||
void MeshBuilder::addVertex(const glm::vec3 &position, const glm::vec3 &normal, const glm::vec2 &texCoord)
|
||||
{
|
||||
addVertex(position, normal);
|
||||
addTexCoord(texCoord);
|
||||
|
@ -17,9 +17,9 @@ public:
|
||||
void addTexCoord(float u, float v);
|
||||
void addTexCoord(const glm::vec2 &texCoord);
|
||||
|
||||
void addVertex(glm::vec3 &position, glm::vec3 &normal);
|
||||
void addVertex(glm::vec3 &position, glm::vec2 &texCoord);
|
||||
void addVertex(glm::vec3 &position, glm::vec3 &normal, glm::vec2 &texCoord);
|
||||
void addVertex(const glm::vec3 &position, const glm::vec3 &normal);
|
||||
void addVertex(const glm::vec3 &position, const glm::vec2 &texCoord);
|
||||
void addVertex(const glm::vec3 &position, const glm::vec3 &normal, const glm::vec2 &texCoord);
|
||||
|
||||
void addGroup(Material* myMaterial);
|
||||
void setCurrentGroup(int groupId);
|
||||
|
@ -10,11 +10,6 @@
|
||||
|
||||
PhongEntity::PhongEntity(Mesh* myMesh) : mesh(myMesh) {}
|
||||
|
||||
PhongEntity::~PhongEntity()
|
||||
{
|
||||
delete[] vbo;
|
||||
}
|
||||
|
||||
void PhongEntity::draw(const glm::mat4 viewMatrix, const glm::mat4 projectionMatrix, Lights::Light* dirLight, Lights* pointLights)
|
||||
{
|
||||
glm::mat4 modelViewMatrix = viewMatrix * modelMatrix;
|
||||
@ -120,6 +115,7 @@ void PhongEntity::destroyGL()
|
||||
{
|
||||
glAssert(glDeleteVertexArrays(1, &vao));
|
||||
glAssert(glDeleteBuffers(nb_buffers, vbo));
|
||||
delete[] vbo;
|
||||
}
|
||||
|
||||
void PhongEntity::drawGroup(int groupId)
|
||||
|
@ -33,7 +33,6 @@ public:
|
||||
glm::mat4 modelMatrix;
|
||||
|
||||
PhongEntity(Mesh* myMesh);
|
||||
~PhongEntity();
|
||||
|
||||
void draw(const glm::mat4 viewMatrix, const glm::mat4 projectionMatrix, Lights::Light* dirLight, Lights* pointLights);
|
||||
void crappyDraw(const glm::mat4 viewMatrix, const glm::mat4 projectionMatrix, Lights::Light* dirLight, Lights* pointLights);
|
||||
|
@ -32,6 +32,12 @@ void PhongMaterial::crappyBindAttributes()
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
|
||||
if(diffuse_texture != NULL)
|
||||
diffuse_texture->bind(TEX_ID);
|
||||
else
|
||||
{
|
||||
GLenum texSlot = GL_TEXTURE0+TEX_ID;
|
||||
glActiveTexture(texSlot);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void PhongMaterial::setTexture(Texture* myTexture)
|
||||
|
Loading…
x
Reference in New Issue
Block a user