Commit 87b0e875 authored by Kenneth Vanhoey's avatar Kenneth Vanhoey
Browse files

Lightfield decimation improved + visualisation of frames

parent 182790ae
...@@ -92,8 +92,6 @@ void Approximator_Frame<PFP>::approximate(Dart d) ...@@ -92,8 +92,6 @@ void Approximator_Frame<PFP>::approximate(Dart d)
assert(!"Approximator_Frame::approximate") ; assert(!"Approximator_Frame::approximate") ;
} }
// AutoAttributeHandler<VEC3> normals = this->m_map.template getAttribute<VEC3>(VERTEX_ORBIT, "normals") ;
// this->m_approx[d].getSubVectorH(2,0,normals[d]) ;
} }
/************************************************************************************ /************************************************************************************
...@@ -164,8 +162,8 @@ void Approximator_RGBfunctions<PFP>::approximate(Dart d) ...@@ -164,8 +162,8 @@ void Approximator_RGBfunctions<PFP>::approximate(Dart d)
assert (-3.15 < alpha2 && alpha2 <= 3.15) ; assert (-3.15 < alpha2 && alpha2 <= 3.15) ;
// Create and sum quadrics // Create and sum quadrics
(*m_quadricRGBfunctions)[d] += QuadricRGBfunctions<REAL>(this->m_attrV[d],gamma1, alpha1) ; (*m_quadricRGBfunctions)[d] += QuadricRGBfunctions<REAL>(this->m_attrV[d], gamma1, alpha1) ;
(*m_quadricRGBfunctions)[d] += QuadricRGBfunctions<REAL>(this->m_attrV[dd],gamma2, alpha2) ; (*m_quadricRGBfunctions)[d] += QuadricRGBfunctions<REAL>(this->m_attrV[dd], gamma2, alpha2) ;
// Compute new function // Compute new function
if (! (*m_quadricRGBfunctions)[d].findOptimizedRGBfunctions(this->m_approx[d])) if (! (*m_quadricRGBfunctions)[d].findOptimizedRGBfunctions(this->m_approx[d]))
......
...@@ -91,7 +91,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -91,7 +91,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& Pos, const typename PFP::TFRAME& Frame, const typename PFP::TRGBFUNCS& RGBfuncs, const FunctorSelect& good = SelectorTrue()) ; bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& Pos, const typename PFP::TMAT33& Frame, const typename PFP::TMAT36& RGBfuncs, const FunctorSelect& good = SelectorTrue()) ;
} // namespace Export } // namespace Export
......
...@@ -256,7 +256,7 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, ...@@ -256,7 +256,7 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
} }
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& Pos, const typename PFP::TFRAME& Frame, const typename PFP::TRGBFUNCS& RGBfuncs, const FunctorSelect& good) bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& Pos, const typename PFP::TMAT33& Frame, const typename PFP::TMAT36& RGBfuncs, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
......
...@@ -65,11 +65,14 @@ template <typename PFP> ...@@ -65,11 +65,14 @@ template <typename PFP>
void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode,
const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, const typename PFP::TVEC3& color, const FunctorSelect& good = SelectorTrue()); const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, const typename PFP::TVEC3& color, const FunctorSelect& good = SelectorTrue());
template <typename PFP> template <typename PFP>
void renderNormalVertices(typename PFP::MAP& the_map, void renderNormalVertices(typename PFP::MAP& the_map,
const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, float scale, const FunctorSelect& good = SelectorTrue()); const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, float scale, const FunctorSelect& good = SelectorTrue());
template <typename PFP>
void renderFrameVertices(typename PFP::MAP& the_map,
const typename PFP::TVEC3& position, const typename PFP::TMAT33& frames, float scale, const FunctorSelect& good = SelectorTrue());
} // namespace Direct } // namespace Direct
} // namespace Render } // namespace Render
......
...@@ -182,6 +182,18 @@ void renderNormalVertices(typename PFP::MAP& the_map, const typename PFP::TVEC3& ...@@ -182,6 +182,18 @@ void renderNormalVertices(typename PFP::MAP& the_map, const typename PFP::TVEC3&
glEnd(); glEnd();
} }
template <typename PFP>
void renderFrameVertices(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, const typename PFP::TMAT33& frame, float scale, const FunctorSelect& good)
{
FunctorGLFrame<PFP> fgl_frame(the_map, good, position, frame, scale) ;
glBegin(GL_LINES) ;
the_map.foreach_orbit(VERTEX_ORBIT, fgl_frame, good) ;
glEnd();
}
} // namespace Direct } // namespace Direct
} // namespace Render } // namespace Render
......
...@@ -210,8 +210,8 @@ template<typename PFP> ...@@ -210,8 +210,8 @@ template<typename PFP>
class FunctorGLNormal : public CGoGN::FunctorMap<typename PFP::MAP> class FunctorGLNormal : public CGoGN::FunctorMap<typename PFP::MAP>
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
protected: protected:
/** /**
* positions of vertices * positions of vertices
...@@ -240,6 +240,43 @@ public: ...@@ -240,6 +240,43 @@ public:
bool operator() (Dart d); bool operator() (Dart d);
}; };
template<typename PFP>
class FunctorGLFrame : public CGoGN::FunctorMap<typename PFP::MAP>
{
typedef typename PFP::MAP MAP;
protected:
/**
* positions of vertices
*/
const typename PFP::TVEC3& m_positions;
/**
* frame of vertices
*/
const typename PFP::TMAT33& m_frames;
/**
* Dart selector to restrict the rendering
*/
const FunctorSelect& m_selector;
float m_scale;
public:
/**
* @param good dart selector
*/
FunctorGLFrame (MAP& map, const FunctorSelect& good, const typename PFP::TVEC3& posi, const typename PFP::TMAT33& frames, float scale);
bool operator() (Dart d);
};
} // namespace Direct } // namespace Direct
} // namespace Render } // namespace Render
......
...@@ -361,8 +361,33 @@ bool FunctorGLNormal<PFP>::operator() (Dart d) ...@@ -361,8 +361,33 @@ bool FunctorGLNormal<PFP>::operator() (Dart d)
return false; return false;
} }
template<typename PFP>
FunctorGLFrame<PFP>::FunctorGLFrame(MAP& map, const FunctorSelect& good, const typename PFP::TVEC3& posi, const typename PFP::TMAT33& frames, float scale):
FunctorMap<MAP>(map),
m_positions(posi),
m_frames(frames),
m_selector(good),
m_scale(scale)
{
}
template<typename PFP>
bool FunctorGLFrame<PFP>::operator() (Dart d)
{
if (m_selector(d))
{
typename PFP::VEC3 p = m_positions[d] ;
for (unsigned int i = 0 ; i < 3 ; ++i) {
glVertex3fv(p.data());
typename PFP::VEC3 q,vec ;
m_frames[d].getSubVectorH(i,0,vec) ;
q = p ;
q += m_scale * vec ;
glVertex3fv(q.data());
}
}
return false;
}
template <typename PFP> template <typename PFP>
FunctorGLFaceColor<PFP>::FunctorGLFaceColor(MAP& map, bool lighted, bool smooth, int nbe, float expl, bool stor, FunctorGLFaceColor<PFP>::FunctorGLFaceColor(MAP& map, bool lighted, bool smooth, int nbe, float expl, bool stor,
......
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