SparrowRenderer/phongentity.h

64 lines
1.1 KiB
C++

#ifndef PHONGENTITY_H
#define PHONGENTITY_H
#include <glew/glew.h>
#include <glm/mat4x4.hpp>
#include <vector>
class Mesh;
class Material;
class Shader;
class PhongEntity
{
protected:
Mesh* mesh;
// modern opengl :
enum {
// required buffers
POSITION_BUFFER,
// optionnal buffers :
NORMAL_BUFFER, TEXCOORD_BUFFER, TANGENT_BUFFER,
// indices buffers
INDICES_BUFFER
};
GLuint vao;
int nb_buffers;
GLuint* vbo;
void modernInit(bool isDynamic);
// old opengl :
GLuint displayList;
void crappyInit();
public:
/**
* @brief the model matrix is public, so the user can manipulate it in any way he desires.
*/
glm::mat4 modelMatrix;
PhongEntity(Mesh* myMesh);
void drawDisplayList();
void drawGroup(int groupId); // temporarily public
void initGL(bool isDynamic = false);
void destroyGL();
Mesh* getMesh() {return mesh;}
/**
* @brief this method returns a clone of the current entity.
* The same VAO/displayList will be used to render both, so there is no need to call initGL on the clone
*/
PhongEntity* clone();
};
#endif // PHONGENTITY_H