From 6fe8960291985696db2779cdb58666d193cd3e53 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 6 Nov 2016 14:32:36 +0100 Subject: [PATCH] Remove most of the OpenGL stuff --- evertims/CMakeLists.txt | 1 - evertims/src/solver.cc | 8 --- libevert/CMakeLists.txt | 1 - libevert/src/elBeam.cc | 41 ----------- libevert/src/elOrientedPoint.cc | 120 -------------------------------- libevert/src/elPathSolution.cc | 41 ----------- libevert/src/elPathSolution.h | 1 - libevert/src/elPolygon.cc | 14 ---- libevert/src/elRay.cc | 18 ----- libevert/src/elRoom.cc | 54 -------------- 10 files changed, 299 deletions(-) diff --git a/evertims/CMakeLists.txt b/evertims/CMakeLists.txt index b542103..f146e80 100644 --- a/evertims/CMakeLists.txt +++ b/evertims/CMakeLists.txt @@ -24,7 +24,6 @@ set(CMAKE_THREAD_PREFER_PTHREAD ON) find_package(Threads) find_package(evert REQUIRED) -find_package(OpenGL REQUIRED) target_include_directories(${PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src diff --git a/evertims/src/solver.cc b/evertims/src/solver.cc index 3185afe..a0b64cc 100644 --- a/evertims/src/solver.cc +++ b/evertims/src/solver.cc @@ -31,14 +31,6 @@ #include #include -#ifdef __Darwin - #include - #include -#else - #include - #include -#endif - #include "solver.h" #include "material.h" #include "utils.h" diff --git a/libevert/CMakeLists.txt b/libevert/CMakeLists.txt index a5c832e..a457bd8 100644 --- a/libevert/CMakeLists.txt +++ b/libevert/CMakeLists.txt @@ -7,7 +7,6 @@ set (EVERT_SOURCES src/elBSP.cc src/elOrientedPoint.cc src/elVector.cc - src/elRay.cc src/elListener.cc src/elPathSolution.cc src/elRoom.cc diff --git a/libevert/src/elBeam.cc b/libevert/src/elBeam.cc index 0885a21..87009cb 100644 --- a/libevert/src/elBeam.cc +++ b/libevert/src/elBeam.cc @@ -82,44 +82,3 @@ void Beam::calculatePleqs(void) } m_pleqs[0] = sign * m_polygon.getPleq(); } - -/* -void Beam::render(const Vector3& color) const -{ - static const float extrudeDist = 100000.f; // 100 m - - if (m_polygon.numPoints() == 0) - return; - - glColor3fv(&color.x); - glBegin(GL_LINE_LOOP); - for (int i=0; i < m_polygon.numPoints(); i++) - glVertex3fv(&m_polygon[i].x); - glEnd(); - - glBegin(GL_LINES); - for (int i=0; i < m_polygon.numPoints(); i++) - { - Vector3 p = m_polygon[i]; - glVertex3fv(&p.x); - p += extrudeDist * normalize(p-m_top); - glVertex3fv(&p.x); - } - glEnd(); - - glBegin(GL_POLYGON); - for (int i=0; i < m_polygon.numPoints(); i++) - glVertex3fv(&m_polygon[i].x); - glEnd(); - - glBegin(GL_QUAD_STRIP); - for (int i=0; i <= m_polygon.numPoints(); i++) - { - Vector3 p = m_polygon[i % m_polygon.numPoints()]; - Vector3 e = p + extrudeDist * normalize(p-m_top); - glVertex3fv(&p.x); - glVertex3fv(&e.x); - } - glEnd(); -} -*/ diff --git a/libevert/src/elOrientedPoint.cc b/libevert/src/elOrientedPoint.cc index b5319f8..8b57377 100644 --- a/libevert/src/elOrientedPoint.cc +++ b/libevert/src/elOrientedPoint.cc @@ -25,14 +25,6 @@ #include "elOrientedPoint.h" -#ifdef __Darwin - #include - #include -#else - #include - #include -#endif - using namespace EL; //------------------------------------------------------------------------ @@ -63,115 +55,3 @@ const OrientedPoint& OrientedPoint::operator=(const OrientedPoint& s) m_name = s.m_name; return *this; } - -//------------------------------------------------------------------------ - -void multMatrix(const Matrix3x4& m) -{ - float mtx[16]; - *((Matrix3x4*)mtx) = m; - mtx[12] = mtx[3]; - mtx[13] = mtx[7]; - mtx[14] = mtx[11]; - mtx[15] = 1.0f; - mtx[3] = mtx[7] = mtx[11] = 0.0f; - swap(mtx[1], mtx[4]); - swap(mtx[2], mtx[8]); - swap(mtx[6], mtx[9]); - - glMultMatrixf(mtx); -} -/* -void OrientedPoint::render(const Vector3& color) const -{ - const Vector3& pos = getPosition(); - Vector3 posd = pos + getDirection() * 1000.f; - - glPushAttrib(GL_ALL_ATTRIB_BITS); - glEnable(GL_POINT_SMOOTH); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GREATER, 0.f); - glPointSize(13.f); - glBegin(GL_POINTS); - glColor3fv(&color.x); - glVertex3fv(&pos.x); - glEnd(); - glDisable(GL_ALPHA_TEST); - - glBegin(GL_LINES); - glVertex3fv(&pos.x); - glVertex3fv(&posd.x); - glEnd(); - - const char* string = getName().c_str(); - - glPushMatrix(); - - // determine string width - glLoadIdentity(); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - glDepthMask(GL_FALSE); - for (const char* p = string; *p; p++) - glutStrokeCharacter(GLUT_STROKE_ROMAN, *p); - float m[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, m); - float width = m[12]; - - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glDepthMask(GL_TRUE); - - glPopMatrix(); - glPushMatrix(); - - glTranslatef(pos.x, pos.y, pos.z); - Matrix3x4 orient; - orient.setRotation(getOrientation()); - multMatrix(orient); - glScalef(4.f, 4.f, 4.f); - glTranslatef(-width/2, -40.f, 200.f); - - static const float miny = -30.f; - static const float maxy = 110.f; - static const float pad = 20.f; - - Vector3 cv[5] = - { - Vector3(-pad, miny-pad, 0.f), - Vector3(width+pad, miny-pad, 0.f), - Vector3(width+pad, maxy+pad, 0.f), - Vector3(-pad, maxy+pad, 0.f), - Vector3(width/2, 40.f, -200.f) - }; - - glColor4f(.5f, .5f, .5f, .5f); - glDepthMask(GL_FALSE); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBegin(GL_QUADS); - for (int j=0; j < 4; j++) - glVertex3fv(&cv[j].x); - glEnd(); - glDisable(GL_BLEND); - glDepthMask(GL_TRUE); - - glLineWidth(1.f); - glColor3f(1.f, 1.f, 1.f); - glBegin(GL_LINES); - for (int j=0; j < 4; j++) - { - glVertex3fv(&cv[j].x); - glVertex3fv(&cv[(j+1)%4].x); - glVertex3fv(&cv[j].x); - glVertex3fv(&cv[4].x); - } - glEnd(); - - glColor3f(1,1,1); - glLineWidth(2.f); - for (const char* p = string; *p; p++) - glutStrokeCharacter(GLUT_STROKE_ROMAN, *p); - - glPopMatrix(); - glPopAttrib(); -} -*/ diff --git a/libevert/src/elPathSolution.cc b/libevert/src/elPathSolution.cc index 12826d2..21b417b 100644 --- a/libevert/src/elPathSolution.cc +++ b/libevert/src/elPathSolution.cc @@ -31,12 +31,6 @@ #include "elRoom.h" #include "elSource.h" -#ifdef __Darwin - #include -#else - #include -#endif - #include #define printf // Comment to add debug logs @@ -64,41 +58,6 @@ struct PathSolution::SolutionNode const Polygon* m_polygon; }; -//------------------------------------------------------------------------ -void PathSolution::renderPath(const Path& path) const -{ - glPushAttrib(GL_ALL_ATTRIB_BITS); - - float width = 2.f*(m_maximumOrder-path.m_order+1.f); - float alpha = ((float)m_maximumOrder-path.m_order+4)/(m_maximumOrder+4); - - // std::cerr << "Drawing path: width = " << width << ", alpha = " << alpha << std::endl; - - glLineWidth(width); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(1.f, 1.f, 0.f, alpha); - - glBegin(GL_LINE_STRIP); - for( int i=0; i < (int)path.m_points.size(); i++ ) - { - glVertex3fv(&path.m_points[i].x); - } - glEnd(); - - glPointSize(width*2.f); - glColor4f(1.f, 1.f, 1.f, alpha*2); - glEnable(GL_POINT_SMOOTH); - glDepthMask(GL_FALSE); - glBegin(GL_POINTS); - for( int i=0; i < (int)path.m_points.size(); i++ ) - { - glVertex3fv(&path.m_points[i].x); - } - glEnd(); - - glPopAttrib(); -} //------------------------------------------------------------------------ PathSolution::PathSolution(const Room& room, const Source& source, const Listener& listener, int maximumOrder, bool changed): diff --git a/libevert/src/elPathSolution.h b/libevert/src/elPathSolution.h index 513e9c1..2b81f3b 100644 --- a/libevert/src/elPathSolution.h +++ b/libevert/src/elPathSolution.h @@ -78,7 +78,6 @@ class PathSolution const Source & getSource (void) { return m_source; } int getOrder (void) { return m_maximumOrder; } - void renderPath (const Path& path) const; bool save (char *filename, char *modelname); void print (int minOrder, int maxOrder, int maxAmount); diff --git a/libevert/src/elPolygon.cc b/libevert/src/elPolygon.cc index 081dc45..d5be174 100644 --- a/libevert/src/elPolygon.cc +++ b/libevert/src/elPolygon.cc @@ -681,17 +681,3 @@ void Polygon::expand (float eps) } } - - -//------------------------------------------------------------------------ -/* - void Polygon::render(const Vector3& color) const - { - glBegin(GL_POLYGON); - glColor3fv(&color.x); - for (int i=0; i < numPoints(); i++) - glVertex3fv(&m_points[i].x); - glEnd(); - } - */ - diff --git a/libevert/src/elRay.cc b/libevert/src/elRay.cc index 588fb44..4ab5a3c 100644 --- a/libevert/src/elRay.cc +++ b/libevert/src/elRay.cc @@ -25,22 +25,4 @@ #include "elRay.h" -#ifdef __Darwin - #include -#else - #include -#endif - using namespace EL; - -//------------------------------------------------------------------------ -/* -void Ray::render(const Vector3& color) const -{ - glBegin(GL_LINES); - glColor3fv(&color.x); - glVertex3fv(&m_a.x); - glVertex3fv(&m_b.x); - glEnd(); -} -*/ diff --git a/libevert/src/elRoom.cc b/libevert/src/elRoom.cc index e512cb5..2db933a 100644 --- a/libevert/src/elRoom.cc +++ b/libevert/src/elRoom.cc @@ -27,14 +27,6 @@ #include "elRoom.h" #include -#ifdef __Darwin - #include - #include -#else - #include - #include -#endif - using namespace EL; @@ -264,49 +256,3 @@ Vector3 Room::getCenter(void) const getBoundingBox(mn, mx); return .5f*(mn+mx); } - -//------------------------------------------------------------------------ - -void Room::render(void) const -{ - glPushAttrib(GL_ALL_ATTRIB_BITS); - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1, 1); - - for( int i=0; i < numConvexElements(); i++ ) - { - const Room::Element& e = getConvexElement(i); - Vector3 color = e.m_color; - - float ldot = dot(e.m_polygon.getNormal(), normalize(Vector3(3,2,4))); - ldot = .25f + .75f*fabsf(ldot); - color *= ldot; - glColor3fv(&color.x); - - /* - glBegin(GL_POLYGON); - for (int j=0; j < e.m_polygon.numPoints(); j++) - glVertex3fv(&e.m_polygon[j].x); - - glEnd(); - */ - } - glDisable(GL_POLYGON_OFFSET_FILL); - - glLineWidth(1.f); - for( int i=0; i < numElements(); i++ ) - { - const Room::Element& e = getElement(i); - glColor3f(1.f, 1.f, 1.f); - Vector3 color = e.m_color; - glColor3fv(&color.x); - glBegin(GL_LINE_LOOP); - for( int j=0; j < e.m_polygon.numPoints(); j++ ) - { - glVertex3fv(&e.m_polygon[j].x); - } - glEnd(); - } - glPopAttrib(); -} -