diff --git a/.gitignore b/.gitignore index b81d87c..2ce6cc3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -build/* +build* *.user \ No newline at end of file diff --git a/lights.h b/lights.h index 8d035ef..4c522c5 100644 --- a/lights.h +++ b/lights.h @@ -5,7 +5,7 @@ #include #include -#define MAX_LIGHTS 8 +#define MAX_LIGHTS 4 class Shader; diff --git a/mainwindow.ui b/mainwindow.ui index c8d03fd..8cb16b2 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 757 - 492 + 400 + 300 @@ -40,8 +40,8 @@ 0 0 - 757 - 21 + 400 + 20 diff --git a/myglwidget.cpp b/myglwidget.cpp index 0baeb6e..c82c5a9 100644 --- a/myglwidget.cpp +++ b/myglwidget.cpp @@ -65,7 +65,8 @@ Scene* MyGLWidget::buildScene() void MyGLWidget::initializeGL() { - makeCurrent(); + if(renderer != NULL) + delete(renderer); renderer = new SparrowRenderer(width(), height()); Scene* scene = buildScene(); controller = new FocusController(new glm::vec3(0)); diff --git a/phong.frag b/phong.frag index af1d944..281702a 100644 --- a/phong.frag +++ b/phong.frag @@ -6,9 +6,9 @@ uniform vec3 materialKs; uniform float materialNs; uniform int nbDirLights; -uniform vec3 dirLights[16]; +uniform vec3 dirLights[8]; uniform int nbPointLights; -uniform vec3 pointLights[16]; +uniform vec3 pointLights[8]; // texture uniform sampler2D baseTexture; @@ -17,8 +17,8 @@ uniform sampler2D baseTexture; in vec3 varNormal; in vec2 varTexCoord; -in vec3 lightDirInView[8]; -in vec3 halfVecInView[8]; +in vec3 lightDirInView[4]; +in vec3 halfVecInView[4]; // resultat layout(location = 0)out vec4 outColor; @@ -41,9 +41,9 @@ void main(void) { int i; vec3 kd = vec3(texture2D(baseTexture, varTexCoord)); vec3 light = 0.1f*kd; - for(i=0; i