opengl visualization

This commit is contained in:
Joachim Schoeberl 2014-10-06 20:00:40 +00:00
parent e398e948b6
commit ece18134d1

View File

@ -43,7 +43,7 @@ namespace netgen
void VisualSceneGeometry :: DrawScene () void VisualSceneGeometry :: DrawScene ()
{ {
cout << "vs-csg::Draw" << endl; cout << "vs-csg::Draw" << endl;
if (changeval != geometry->GetChangeVal()) if (changeval != geometry->GetChangeVal())
BuildScene(); BuildScene();
@ -74,7 +74,6 @@ namespace netgen
double shine = vispar.shininess; double shine = vispar.shininess;
double transp = vispar.transp; double transp = vispar.transp;
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, shine); glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, shine);
glLogicOp (GL_COPY); glLogicOp (GL_COPY);
@ -93,7 +92,6 @@ namespace netgen
} }
} }
glPolygonOffset (1, 1); glPolygonOffset (1, 1);
glEnable (GL_POLYGON_OFFSET_FILL); glEnable (GL_POLYGON_OFFSET_FILL);
@ -185,8 +183,7 @@ namespace netgen
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_NORMAL_ARRAY);
/*
/*
for (int j = 0; j < ta.GetNT(); j++) for (int j = 0; j < ta.GetNT(); j++)
{ {
glBegin (GL_TRIANGLES); glBegin (GL_TRIANGLES);
@ -195,10 +192,11 @@ namespace netgen
int pi = ta.GetTriangle(j)[k]; int pi = ta.GetTriangle(j)[k];
glNormal3dv (ta.GetNormal(pi)); glNormal3dv (ta.GetNormal(pi));
glVertex3dv (ta.GetPoint(pi)); glVertex3dv (ta.GetPoint(pi));
cout << "v = " << ta.GetPoint(pi) << endl;
} }
glEnd (); glEnd ();
} }
*/ */
} }
glEndList (); glEndList ();
} }
@ -528,8 +526,6 @@ inline string ToString (const T& t)
void Hi () { cout << "hi from csgvis" << endl; }
#ifdef NG_PYTHON #ifdef NG_PYTHON
#include <boost/python.hpp> #include <boost/python.hpp>
namespace bp = boost::python; namespace bp = boost::python;
@ -549,24 +545,21 @@ BOOST_PYTHON_MODULE(libcsgvis)
bp::def ("VS", FunctionPointer bp::def ("VS", FunctionPointer
([] (CSGeometry & geom) ([] (CSGeometry & geom)
// ([] (shared_ptr<CSGeometry> geom)
{ {
geom.FindIdenticSurfaces (1e-6); geom.FindIdenticSurfaces (1e-6);
geom.CalcTriangleApproximation (0.01, 20); geom.CalcTriangleApproximation (0.01, 20);
auto vs = make_shared<VisualSceneGeometry>();
auto vs = make_shared<VisualSceneGeometry>(); vs->SetGeometry(&geom);
vs->SetGeometry(const_cast<CSGeometry*>(&geom));
// vs->SetGeometry(geom.get());
return vs; return vs;
})); }));
bp::def ("MouseMove", FunctionPointer bp::def ("MouseMove", FunctionPointer
([] ( VisualSceneGeometry &vsgeom, int oldx, int oldy, int newx, int newy, char mode) ([] ( VisualSceneGeometry &vsgeom, int oldx, int oldy, int newx, int newy, char mode)
// ([] (shared_ptr<CSGeometry> geom)
{ {
vsgeom.MouseMove(oldx,oldy,newx,newy,mode); vsgeom.MouseMove(oldx,oldy,newx,newy,mode);
})); }));
} }
#endif #endif