paysages : WIP on terrain painting.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@519 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2013-02-07 23:02:16 +00:00 committed by ThunderK
parent 34fa6f1bab
commit 26dd7e9695

View file

@ -237,7 +237,7 @@ void WidgetHeightMap::initializeGL()
glEnable(GL_LIGHT0); glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1); glEnable(GL_LIGHT1);
glEnable(GL_COLOR_MATERIAL); glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_EMISSION); //glColorMaterial(GL_FRONT_AND_BACK, GL_EMISSION);
//glFrontFace(GL_CCW); //glFrontFace(GL_CCW);
//glCullFace(GL_BACK); //glCullFace(GL_BACK);
@ -349,16 +349,9 @@ void WidgetHeightMap::paintGL()
{ {
diff = 1.0; diff = 1.0;
} }
if (vertex->painted) glColor3f(0.8 + diff, vertex->painted ? 1.0 : 0.8, 0.8);
{ glNormal3f(vertex->normal.x, vertex->normal.y, vertex->normal.z);
glColor3d(0.2 + diff, 0.0, 0.0); glVertex3f(vertex->point.x, vertex->point.y, vertex->point.z);
}
else
{
glColor3d(diff, 0.0, 0.0);
}
glNormal3d(vertex->normal.x, vertex->normal.y, vertex->normal.z);
glVertex3d(vertex->point.x, vertex->point.y, vertex->point.z);
} }
} }
glEnd(); glEnd();
@ -402,7 +395,7 @@ void WidgetHeightMap::updateVertexInfo()
vertex->point.y = terrainGetGridHeight(_terrain, dx, dz, 1); vertex->point.y = terrainGetGridHeight(_terrain, dx, dz, 1);
vertex->painted = terrainIsPainted(_terrain->height_map, x, z); vertex->painted = terrainIsPainted(_terrain->height_map, dx, dz);
} }
} }