paysages : Small changes.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@254 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
4f55c9e2a6
commit
e940bb0165
2 changed files with 11 additions and 10 deletions
|
@ -120,15 +120,15 @@ void WidgetWanderer::mouseMoveEvent(QMouseEvent* event)
|
||||||
|
|
||||||
if (event->buttons() & Qt::LeftButton)
|
if (event->buttons() & Qt::LeftButton)
|
||||||
{
|
{
|
||||||
cameraStrafeRight(&_current_camera, (double)(last_mouse_x - event->x()) * factor);
|
cameraRotateYaw(&_current_camera, (double)(event->x() - last_mouse_x) * factor * 0.1);
|
||||||
cameraStrafeUp(&_current_camera, (double)(event->y() - last_mouse_y) * factor);
|
cameraRotatePitch(&_current_camera, (double)(event->y() - last_mouse_y) * factor * 0.1);
|
||||||
updateGL();
|
updateGL();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
else if (event->buttons() & Qt::RightButton)
|
else if (event->buttons() & Qt::RightButton)
|
||||||
{
|
{
|
||||||
cameraRotateYaw(&_current_camera, (double)(event->x() - last_mouse_x) * factor * 0.1);
|
cameraStrafeRight(&_current_camera, (double)(last_mouse_x - event->x()) * factor);
|
||||||
cameraRotatePitch(&_current_camera, (double)(event->y() - last_mouse_y) * factor * 0.1);
|
cameraStrafeUp(&_current_camera, (double)(event->y() - last_mouse_y) * factor);
|
||||||
updateGL();
|
updateGL();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ void WidgetWanderer::initializeGL()
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
|
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LESS);
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
@ -208,16 +208,16 @@ static inline void _renderTerrainQuad(TerrainDefinition* terrain, double x, doub
|
||||||
y3 = terrainGetHeight(terrain, x + size, z + size);
|
y3 = terrainGetHeight(terrain, x + size, z + size);
|
||||||
y4 = terrainGetHeight(terrain, x + size, z);
|
y4 = terrainGetHeight(terrain, x + size, z);
|
||||||
|
|
||||||
glColor3f(0.0, 0.5, 0.0);
|
glColor3f(0.0, 1.0, 0.0);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_LINE_LOOP);
|
||||||
glVertex3f(x, y1, z);
|
glVertex3f(x, y1, z);
|
||||||
glVertex3f(x, y2, z + size);
|
glVertex3f(x, y2, z + size);
|
||||||
glVertex3f(x + size, y3, z + size);
|
glVertex3f(x + size, y3, z + size);
|
||||||
glVertex3f(x + size, y4, z);
|
glVertex3f(x + size, y4, z);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glColor3f(0.0, 1.0, 0.0);
|
glColor3f(0.0, 0.5, 0.0);
|
||||||
glBegin(GL_LINE_LOOP);
|
glBegin(GL_QUADS);
|
||||||
glVertex3f(x, y1, z);
|
glVertex3f(x, y1, z);
|
||||||
glVertex3f(x, y2, z + size);
|
glVertex3f(x, y2, z + size);
|
||||||
glVertex3f(x + size, y3, z + size);
|
glVertex3f(x + size, y3, z + size);
|
||||||
|
|
|
@ -180,7 +180,7 @@ static Color _applyLightCustom(LightDefinition* definition, Renderer* renderer,
|
||||||
view = v3Normalize(v3Sub(location, renderer->camera_location));
|
view = v3Normalize(v3Sub(location, renderer->camera_location));
|
||||||
reflect = v3Sub(direction_inv, v3Scale(normal, 2.0 * v3Dot(direction_inv, normal)));
|
reflect = v3Sub(direction_inv, v3Scale(normal, 2.0 * v3Dot(direction_inv, normal)));
|
||||||
|
|
||||||
specular = v3Dot(reflect, view) * material.reflection;
|
specular = v3Dot(reflect, view);
|
||||||
if (specular > 0.0)
|
if (specular > 0.0)
|
||||||
{
|
{
|
||||||
specular = pow(specular, material.shininess);
|
specular = pow(specular, material.shininess);
|
||||||
|
@ -189,6 +189,7 @@ static Color _applyLightCustom(LightDefinition* definition, Renderer* renderer,
|
||||||
{
|
{
|
||||||
specular = 0.0;
|
specular = 0.0;
|
||||||
}
|
}
|
||||||
|
specular *= material.reflection;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue