a whole lotta work!!
- refactoring - completely changed the tooling (adding elements) - better re-use for more stable editing - new elements - ui adjustments - LINT for stair-editing - many more changes
This commit is contained in:
@@ -32,6 +32,8 @@ void MapView3D::initializeGL() {
|
||||
|
||||
QGLWidget::initializeGL();
|
||||
|
||||
//glCullFace(GL_FRONT);
|
||||
|
||||
// culling, lighting, depth-test, ...
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
@@ -42,6 +44,7 @@ void MapView3D::initializeGL() {
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
//glEnable(GL_LIGHT1);
|
||||
|
||||
GLfloat light0_position [] = {+50, 50, +50, 1};
|
||||
@@ -89,7 +92,7 @@ void MapView3D::paintGL() {
|
||||
glTranslatef(center.x, center.z, center.y);
|
||||
|
||||
// 0) swap the y axis
|
||||
//glScalef(+1, -1, +1);
|
||||
glScalef(+1, -1, +1);
|
||||
|
||||
|
||||
|
||||
@@ -110,9 +113,6 @@ void MapView3D::resizeGL(int width, int height) {
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
#ifdef QT_OPENGL_ES_1
|
||||
//glOrthof(-2, +2, -2, +2, 1.0, 15.0);
|
||||
#else
|
||||
//glOrtho(-2, +2, -2, +2, 1.0, 25.0);
|
||||
//glFrustum(-1,1, -1,1, 0.1,20);
|
||||
viewport.size.x = 2.0f;
|
||||
@@ -120,8 +120,12 @@ void MapView3D::resizeGL(int width, int height) {
|
||||
const float w = viewport.size.x;
|
||||
const float h = viewport.size.y;
|
||||
glOrtho(-w, +w, -h, +h, -20, +20);
|
||||
//glScalef(1,-1,1);
|
||||
|
||||
//glFrustum(+w, -w, -h, +h, -20, +20);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
@@ -137,10 +141,10 @@ void MapView3D::mouseMoveEvent(QMouseEvent* e) {
|
||||
float dx = mouse.x - e->x();
|
||||
float dy = mouse.y - e->y();
|
||||
if (mouse.btn == 1) {
|
||||
rot.z -= dx/2.0f; // upward
|
||||
rot.z += dx/2.0f; // upward
|
||||
rot.x -= dy/2.0f;
|
||||
} else if (mouse.btn == 4) {
|
||||
Point3 vec(-dx / width() * 2 * viewport.size.x, 0, dy / height() * 2 * viewport.size.y);
|
||||
Point3 vec(-dx / width() * 2 * viewport.size.x, 0, +dy / height() * 2 * viewport.size.y);
|
||||
vec = vec.rot(rot.x/180*M_PI, rot.y/180*M_PI, rot.z/180*M_PI);
|
||||
vec /= scale;
|
||||
center += vec;
|
||||
|
||||
Reference in New Issue
Block a user