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);
|
addPosition(position);
|
||||||
addNormal(normal);
|
addNormal(normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshBuilder::addVertex(glm::vec3 &position, glm::vec2 &texCoord)
|
void MeshBuilder::addVertex(const glm::vec3 &position, const glm::vec2 &texCoord)
|
||||||
{
|
{
|
||||||
addPosition(position);
|
addPosition(position);
|
||||||
addTexCoord(texCoord);
|
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);
|
addVertex(position, normal);
|
||||||
addTexCoord(texCoord);
|
addTexCoord(texCoord);
|
||||||
|
@ -17,9 +17,9 @@ public:
|
|||||||
void addTexCoord(float u, float v);
|
void addTexCoord(float u, float v);
|
||||||
void addTexCoord(const glm::vec2 &texCoord);
|
void addTexCoord(const glm::vec2 &texCoord);
|
||||||
|
|
||||||
void addVertex(glm::vec3 &position, glm::vec3 &normal);
|
void addVertex(const glm::vec3 &position, const glm::vec3 &normal);
|
||||||
void addVertex(glm::vec3 &position, glm::vec2 &texCoord);
|
void addVertex(const glm::vec3 &position, const glm::vec2 &texCoord);
|
||||||
void addVertex(glm::vec3 &position, glm::vec3 &normal, glm::vec2 &texCoord);
|
void addVertex(const glm::vec3 &position, const glm::vec3 &normal, const glm::vec2 &texCoord);
|
||||||
|
|
||||||
void addGroup(Material* myMaterial);
|
void addGroup(Material* myMaterial);
|
||||||
void setCurrentGroup(int groupId);
|
void setCurrentGroup(int groupId);
|
||||||
|
@ -10,11 +10,6 @@
|
|||||||
|
|
||||||
PhongEntity::PhongEntity(Mesh* myMesh) : mesh(myMesh) {}
|
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)
|
void PhongEntity::draw(const glm::mat4 viewMatrix, const glm::mat4 projectionMatrix, Lights::Light* dirLight, Lights* pointLights)
|
||||||
{
|
{
|
||||||
glm::mat4 modelViewMatrix = viewMatrix * modelMatrix;
|
glm::mat4 modelViewMatrix = viewMatrix * modelMatrix;
|
||||||
@ -120,6 +115,7 @@ void PhongEntity::destroyGL()
|
|||||||
{
|
{
|
||||||
glAssert(glDeleteVertexArrays(1, &vao));
|
glAssert(glDeleteVertexArrays(1, &vao));
|
||||||
glAssert(glDeleteBuffers(nb_buffers, vbo));
|
glAssert(glDeleteBuffers(nb_buffers, vbo));
|
||||||
|
delete[] vbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhongEntity::drawGroup(int groupId)
|
void PhongEntity::drawGroup(int groupId)
|
||||||
|
@ -33,7 +33,6 @@ public:
|
|||||||
glm::mat4 modelMatrix;
|
glm::mat4 modelMatrix;
|
||||||
|
|
||||||
PhongEntity(Mesh* myMesh);
|
PhongEntity(Mesh* myMesh);
|
||||||
~PhongEntity();
|
|
||||||
|
|
||||||
void draw(const glm::mat4 viewMatrix, const glm::mat4 projectionMatrix, Lights::Light* dirLight, Lights* pointLights);
|
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);
|
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);
|
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
|
||||||
if(diffuse_texture != NULL)
|
if(diffuse_texture != NULL)
|
||||||
diffuse_texture->bind(TEX_ID);
|
diffuse_texture->bind(TEX_ID);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GLenum texSlot = GL_TEXTURE0+TEX_ID;
|
||||||
|
glActiveTexture(texSlot);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhongMaterial::setTexture(Texture* myTexture)
|
void PhongMaterial::setTexture(Texture* myTexture)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user