Commit 13a821be authored by Jan Möbius's avatar Jan Möbius

More fixes

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16355 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 13111ca1
......@@ -204,7 +204,7 @@ public:
typedef TriangleBSPT<Traits> Base;
typedef typename Traits::Scalar Scalar;
OpenMeshTriangleBSPT(const Mesh& _mesh,
const Scalar _infinity = std::numeric_limits<Scalar>::infinity()) : Base(Traits(_mesh), _infinity) {}
const Scalar& _infinity = std::numeric_limits<Scalar>::infinity()) : Base(Traits(_mesh), _infinity) {}
};
//=============================================================================
......
......@@ -87,7 +87,7 @@ public:
/// construct from other matrix type
template <class OtherScalar>
inline GLMatrixT(const GLMatrixT<OtherScalar> _rhs)
inline GLMatrixT(const GLMatrixT<OtherScalar>& _rhs)
: Matrix4x4T<Scalar>(_rhs)
{}
......
......@@ -107,7 +107,7 @@ public:
/// construct from other matrix type
template <class OtherScalar>
inline Matrix4x4T(const Matrix4x4T<OtherScalar> _rhs) {
inline Matrix4x4T(const Matrix4x4T<OtherScalar>& _rhs) {
operator=(_rhs);
}
......
......@@ -138,7 +138,7 @@ namespace QtWidgets {
// copy qt event
template <class SomeEvent>
static QEvent* clone_event(QEvent* _event)
{ return (QEvent*) new SomeEvent(*(SomeEvent*) _event); }
{ return dynamic_cast<QEvent*>(new SomeEvent(*(SomeEvent*) _event)); }
//-----------------------------------------------------------------------------
......
......@@ -404,7 +404,7 @@ bool QtExaminerViewer::mapToSphere(const QPoint& _v2D, Vec3d& _v3D) const
void QtExaminerViewer::slotAnimation()
{
static int msecs=0, count=0;
QTime t;
t.start();
makeCurrent();
......@@ -412,6 +412,9 @@ void QtExaminerViewer::slotAnimation()
updateGL();
if (!isUpdateLocked()) {
static int msecs=0, count=0;
msecs += t.elapsed();
if (count==10) {
assert(statusbar_!=0);
......
......@@ -178,10 +178,8 @@ GridNode::draw(GLState& _state , const DrawModes::DrawMode& /* _drawMode */ )
// The factor is means the following
// If the viewer is farther away than the minRefinementDistance_, the factor is 0 and no refinement will take place
// If the viewer goes closer to the grid, the grid will be refined.
int factor = 0.0;
// Block negative distances (grid behind us)
factor = floor( minRefinementDistance_ / distance) - 1;
int factor = floor( minRefinementDistance_ / distance) - 1;
int vertical = verticalLines_;
int horizontal = horizontalLines_;
......
......@@ -155,7 +155,7 @@ void SplatCloudNode::boundingBox( ACG::Vec3d &_bbMin, ACG::Vec3d &_bbMax )
void SplatCloudNode::draw( GLState &_state, const DrawModes::DrawMode &_drawMode )
{
static const int RENDERMODE_POINTS = 0;
static const int RENDERMODE_DOTS = 1;
static const int RENDERMODE_SPLATS = 2;
......@@ -165,10 +165,11 @@ void SplatCloudNode::draw( GLState &_state, const DrawModes::DrawMode &_drawMode
rendermode = RENDERMODE_SPLATS;
else if( _drawMode.containsAtomicDrawMode( dotsDrawMode_ ) )
rendermode = RENDERMODE_DOTS;
else if( _drawMode.containsAtomicDrawMode( pointsDrawMode_ ) )
else if( _drawMode.containsAtomicDrawMode( pointsDrawMode_ ) ) {
static const int RENDERMODE_POINTS = 0;
rendermode = RENDERMODE_POINTS;
else
return;
} else
return;
// set desired depth function
ACG::GLState::depthFunc( _state.depthFunc() );
......
......@@ -600,20 +600,56 @@ void glViewer::drawScene()
// store time since last repaint in gl state and restart timer
glstate_->set_msSinceLastRedraw (redrawTime_.restart ());
// draw mono or stereo
makeCurrent();
// draw mono or stereo
// If stereo mode is selected, we have to provide multiple ways of rendering.
// 1. Default internal pipeline : Directly to output buffer (no stereo support!)
// 2. Non default : Non-stereo Directly to output buffer (no stereo support!)
//
//
// if (OpenFlipper::Options::stereoMode () == OpenFlipper::Options::OpenGL && OpenFlipper::Options::glStereo ())
// {
// // Stereo : Hardware support (OpenGL stereo : left and right buffer with offset eyes)
//
// return;
// }
// else if (OpenFlipper::Options::stereoMode () == OpenFlipper::Options::AnaglyphCustom && customAnaglyphSupported_)
// {
// //Stereo : No Hardware support (Left and right frame buffer with offset eyes)
// } else {
//
// }
// QGLFramebufferObject fbo( glstate_->viewport_width(),glstate_->viewport_height(),QGLFramebufferObject::CombinedDepthStencil );
//
// fbo.bind();
// Check if we use build in default renderer
if ( renderManager().activeId( properties_.viewerId() ) == 0 ) {
drawScene_mono();
} else {
renderManager().active( properties_.viewerId() )->plugin->render(glstate_,properties_);
}
if ( postProcessorManager().activeId( properties_.viewerId() ) != 0 ) {
postProcessorManager().active( properties_.viewerId() )->plugin->postProcess(glstate_);
}
// fbo.release();
//
// QRect blitRect(0,0,glstate_->viewport_width(),glstate_->viewport_height());
//
// //
// //QTime time;
// //time.restart();
// QGLFramebufferObject::blitFramebuffer( 0 , blitRect, &fbo, blitRect , GL_COLOR_BUFFER_BIT );
// //std::cerr << "Elapsed for blit: " << time.elapsed() << std::endl;
glFinish();
frame_time_ = timer.elapsed();
......@@ -1892,13 +1928,14 @@ bool glViewer::mapToSphere(const QPoint& _v2D, ACG::Vec3d& _v3D) const
void glViewer::slotAnimation()
{
static int msecs=0, count=0;
makeCurrent();
rotate( lastRotationAxis_, lastRotationAngle_ );
updateGL();
if (!properties_.updateLocked()) {
static int msecs=0, count=0;
msecs += frame_time_;
if (count >= 10 && msecs >= 500) {
char s[100];
......
......@@ -658,8 +658,6 @@ int InfoMeshObjectPlugin::getClosestEdgeInFace(MeshT* _mesh, int _face_idx, cons
template <class MeshT>
int InfoMeshObjectPlugin::getClosestVertexFromEdge(MeshT* _mesh, int _edge_idx, ACG::Vec3d& _hitPoint) {
int closest_v_idx = 0;
ACG::Vec3d toVertex = _mesh->point( _mesh->to_vertex_handle( _mesh->halfedge_handle(_mesh->edge_handle(_edge_idx),0 )) );
ACG::Vec3d fromVertex = _mesh->point( _mesh->from_vertex_handle( _mesh->halfedge_handle(_mesh->edge_handle(_edge_idx),0 )) );
......
......@@ -163,7 +163,7 @@ void OMPropertyVisualizerSkinWeights<MeshT>::setVertexPropertyFromText(unsigned
QStringList slAll = text.split(")(");
for (QStringList::iterator it = slAll.begin(); it != slAll.end(); it++)
for (QStringList::iterator it = slAll.begin(); it != slAll.end(); ++it)
{
QStringList slCurrent = it->split(",");
sw.insert(std::pair<int, double>(slCurrent.at(0).toInt(), slCurrent.at(1).toDouble()));
......
......@@ -73,9 +73,7 @@ ScriptingPlugin::ScriptingPlugin() :
lastFile_(""),
debuggerButton_(0)
#ifdef ENABLE_SCRIPT_DEBUGGER
#ifdef QT_SCRIPTTOOLS_LIB
,debugger_(0)
#endif
#endif
{
......
......@@ -1095,14 +1095,14 @@ void DepthPeelingPlugin::updatePeelingShaderSet()
#ifdef DEPTHPEELING_SHADER_EXPORT
char szFileName[256];
sprintf(szFileName, "peel_vertex_%02d.glsl", i);
sprintf(szFileName, "peel_vertex_%02u.glsl", i);
FILE* pShaderOut = fopen(szFileName, "wt");
for (GLSL::StringList::iterator it = strVertexShader.begin(); it != strVertexShader.end(); ++it)
fprintf(pShaderOut, it->c_str());
fclose(pShaderOut);
sprintf(szFileName, "peel_frag%02d.glsl", i);
sprintf(szFileName, "peel_frag%02u.glsl", i);
pShaderOut = fopen(szFileName, "wt");
for (GLSL::StringList::iterator it = strFragmentShader.begin(); it != strFragmentShader.end(); ++it)
fprintf(pShaderOut, it->c_str());
......@@ -1110,7 +1110,7 @@ void DepthPeelingPlugin::updatePeelingShaderSet()
if (flatDrawMode)
{
sprintf(szFileName, "peel_geom%02d.glsl", i);
sprintf(szFileName, "peel_geom%02u.glsl", i);
pShaderOut = fopen(szFileName, "wt");
for (GLSL::StringList::iterator it = strGeometryShader.begin(); it != strGeometryShader.end(); ++it)
fprintf(pShaderOut, it->c_str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment