Commit 7a993e26 authored by Jan Möbius's avatar Jan Möbius

Switched bounding box action to doubles

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7994 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fd3cdc6a
......@@ -154,7 +154,7 @@ public:
_bbMax since they may already store values of previous nodes'
bounding box computation.
*/
virtual void boundingBox(Vec3f& /* _bbMin */, Vec3f& /*_bbMax*/ ) {}
virtual void boundingBox(Vec3d& /* _bbMin */, Vec3d& /*_bbMax*/ ) {}
/** This function is called when traversing the scene graph and
arriving at this node. It can be used to store GL states that
......
......@@ -94,7 +94,7 @@ CoordFrameNode::availableDrawModes() const
void
CoordFrameNode::boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
CoordFrameNode::boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
_bbMin.minimize(bb_min_);
_bbMax.maximize(bb_max_);
......
......@@ -95,7 +95,7 @@ public:
/// return available draw modes
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// drawing the primitive
void draw(GLState& _state, unsigned int _drawMode);
......@@ -105,9 +105,9 @@ public:
/// set bounding box
void set_bounding_box(const Vec3f& _bb_min, const Vec3f& _bb_max);
/// get bounding box
const Vec3f& bb_min() const { return bb_min_; }
const Vec3d& bb_min() const { return bb_min_; }
/// get bounding box
const Vec3f& bb_max() const { return bb_max_; }
const Vec3d& bb_max() const { return bb_max_; }
/// get x-plane container
......@@ -160,7 +160,7 @@ private:
// extend of bounding box
Vec3f bb_min_, bb_max_;
Vec3d bb_min_, bb_max_;
// planes in x-, y-, z-direction
std::vector<float> x_planes_, y_planes_, z_planes_;
......
......@@ -68,7 +68,7 @@ namespace SceneGraph {
void
CoordsysNode::
boundingBox(Vec3f& /*_bbMin*/, Vec3f& /*_bbMax*/)
boundingBox(Vec3d& /*_bbMin*/, Vec3d& /*_bbMax*/)
{
//_bbMin.minimize( Vect3f )
}
......
......@@ -107,7 +107,7 @@ public:
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// draw Coordsys
void draw(GLState& _state, unsigned int _drawMode);
......
......@@ -67,7 +67,7 @@ namespace SceneGraph {
void
GlutPrimitiveNode::
boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
if (_bbMin[0] > -size_) _bbMin[0] = -size_;
if (_bbMin[1] > -size_) _bbMin[1] = -size_;
......
......@@ -131,7 +131,7 @@ public:
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// drawing the primitive
void draw(GLState& _state, unsigned int _drawMode);
......
......@@ -98,7 +98,7 @@ GridNode::availableDrawModes() const
void
GridNode::boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
GridNode::boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
_bbMin.minimize(bb_min_);
_bbMax.maximize(bb_max_);
......
......@@ -94,7 +94,7 @@ public:
/// return available draw modes
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// drawing the primitive
void draw(GLState& _state, unsigned int _drawMode);
/// don't pick me
......@@ -117,8 +117,8 @@ private:
float gridSize_;
/// bounding box
Vec3f bb_min_;
Vec3f bb_max_;
Vec3d bb_min_;
Vec3d bb_max_;
/// colors for the grid
Vec3f baseLineColor_;
......
......@@ -65,14 +65,23 @@ namespace SceneGraph {
void
LineNode::
boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
Vec3f bbMin(FLT_MAX,FLT_MAX,FLT_MAX);
Vec3f bbMax(-FLT_MAX,-FLT_MAX,-FLT_MAX);
ConstPointIter p_it=points_.begin(), p_end=points_.end();
for (; p_it!=p_end; ++p_it)
{
_bbMin.minimize(*p_it);
_bbMax.maximize(*p_it);
bbMax.maximize(*p_it);
bbMin.minimize(*p_it);
}
Vec3d bbMind = ACG::Vec3d(bbMin);
Vec3d bbMaxd = ACG::Vec3d(bbMax);
_bbMin.minimize(bbMind);
_bbMax.maximize(bbMaxd);
}
......
......@@ -124,7 +124,7 @@ public:
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// draw lines and normals
void draw(GLState& _state, unsigned int _drawMode);
......
......@@ -145,7 +145,7 @@ MeshNodeT<Mesh>::
template<class Mesh>
void
MeshNodeT<Mesh>::
boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
_bbMin.minimize(bbMin_);
_bbMax.maximize(bbMax_);
......@@ -389,15 +389,15 @@ update_geometry()
updateEdgeList_ = true;
updateAnyList_ = true;
bbMin_ = Vec3f(FLT_MAX, FLT_MAX, FLT_MAX);
bbMax_ = Vec3f(-FLT_MAX, -FLT_MAX, -FLT_MAX);
bbMin_ = Vec3d(FLT_MAX, FLT_MAX, FLT_MAX);
bbMax_ = Vec3d(-FLT_MAX, -FLT_MAX, -FLT_MAX);
typename Mesh::ConstVertexIter v_it(mesh_.vertices_begin()),
v_end(mesh_.vertices_end());
for (; v_it!=v_end; ++v_it)
{
bbMin_.minimize((Vec3f)mesh_.point(v_it));
bbMax_.maximize((Vec3f)mesh_.point(v_it));
bbMin_.minimize(mesh_.point(v_it));
bbMax_.maximize(mesh_.point(v_it));
}
if (GLEW_ARB_vertex_buffer_object) {
......
......@@ -104,7 +104,7 @@ public:
/// return available draw modes
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// drawing
void draw(GLState& _state, unsigned int _drawMode);
/// picking
......@@ -253,8 +253,8 @@ private:
std::vector< ACG::Vec4uc > pickColorBuf_;
// bounding box
Vec3f bbMin_;
Vec3f bbMax_;
Vec3d bbMin_;
Vec3d bbMax_;
};
......
......@@ -68,13 +68,23 @@ namespace SceneGraph {
void
OBJNode::
boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
Vec3f bbMin(FLT_MAX,FLT_MAX,FLT_MAX);
Vec3f bbMax(-FLT_MAX,-FLT_MAX,-FLT_MAX);
for(unsigned int i=0; i<vertices_.size(); ++i)
{
_bbMin.minimize(vertices_[i]);
_bbMax.maximize(vertices_[i]);
bbMin.minimize(vertices_[i]);
bbMax.maximize(vertices_[i]);
}
Vec3d bbMind = ACG::Vec3d(bbMin);
Vec3d bbMaxd = ACG::Vec3d(bbMax);
_bbMin.minimize(bbMind);
_bbMax.maximize(bbMaxd);
}
......
......@@ -98,7 +98,7 @@ public:
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// drawing the primitive
void draw(GLState& _state, unsigned int _drawMode);
......
......@@ -54,23 +54,26 @@ namespace SceneGraph {
//== IMPLEMENTATION ==========================================================
void PlaneNode::boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
void PlaneNode::boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
Vec3f pos = position_ - xDirection_*0.5 - yDirection_*0.5;
//add a little offset in normal direction
Vec3f pos0 = pos + normal_*0.1;
Vec3f pos1 = pos - normal_*0.1;
Vec3d pos0 = ACG::Vec3d( pos + normal_*0.1 );
Vec3d pos1 = ACG::Vec3d( pos - normal_*0.1 );
Vec3d xDird = ACG::Vec3d( xDirection_ );
Vec3d yDird = ACG::Vec3d( yDirection_ );
_bbMin.minimize( pos0 );
_bbMin.minimize( pos0 + xDirection_);
_bbMin.minimize( pos0 + yDirection_);
_bbMin.minimize( pos0 + xDirection_ + yDirection_);
_bbMin.minimize( pos0 + xDird);
_bbMin.minimize( pos0 + yDird);
_bbMin.minimize( pos0 + xDird + yDird);
_bbMax.maximize( pos1 );
_bbMax.maximize( pos1 + xDirection_);
_bbMax.maximize( pos1 + yDirection_);
_bbMax.maximize( pos1 + xDirection_ + yDirection_);
_bbMax.maximize( pos1 + xDird);
_bbMax.maximize( pos1 + yDird);
_bbMax.maximize( pos1 + xDird + yDird);
}
//----------------------------------------------------------------------------
......
......@@ -89,7 +89,7 @@ class ACGDLLEXPORT PlaneNode : public BaseNode
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// draw Plane
void draw(GLState& _state, unsigned int _drawMode);
......
......@@ -66,12 +66,22 @@ namespace SceneGraph {
void
PointNode::
boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
Vec3f bbMin(FLT_MAX,FLT_MAX,FLT_MAX);
Vec3f bbMax(-FLT_MAX,-FLT_MAX,-FLT_MAX);
ConstPointIter p_it=points_.begin(), p_end=points_.end();
for (; p_it!=p_end; ++p_it) {
_bbMin.minimize(*p_it); _bbMax.maximize(*p_it);
bbMin.minimize(*p_it);
bbMax.maximize(*p_it);
}
Vec3d bbMind = ACG::Vec3d(bbMin);
Vec3d bbMaxd = ACG::Vec3d(bbMax);
_bbMin.minimize(bbMind);
_bbMax.maximize(bbMaxd);
}
......
......@@ -106,7 +106,7 @@ public:
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// draw points and normals
void draw(GLState& _state, unsigned int _drawMode);
......
......@@ -68,12 +68,12 @@ namespace SceneGraph {
template <class PolyLine>
void
PolyLineNodeT<PolyLine>::
boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
for (unsigned int i=0; i< polyline_.n_vertices(); ++i)
{
_bbMin.minimize((Vec3f)polyline_.point(i));
_bbMax.maximize((Vec3f)polyline_.point(i));
_bbMin.minimize(polyline_.point(i));
_bbMax.maximize(polyline_.point(i));
}
}
......
......@@ -121,7 +121,7 @@ public:
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// draw lines and normals
void draw(GLState& /*_state*/, unsigned int _drawMode);
......
......@@ -86,16 +86,24 @@ QuadNode::~QuadNode()
void
QuadNode::boundingBox( Vec3f & _bbMin, Vec3f & _bbMax )
QuadNode::boundingBox( Vec3d & _bbMin, Vec3d & _bbMax )
{
PointVector::const_iterator p_it = point_.begin(),
p_end = point_.end();
Vec3f bbMin(FLT_MAX,FLT_MAX,FLT_MAX);
Vec3f bbMax(-FLT_MAX,-FLT_MAX,-FLT_MAX);
PointVector::const_iterator p_it = point_.begin(), p_end = point_.end();
for ( ; p_it != p_end; ++p_it )
{
_bbMin.minimize( *p_it );
_bbMax.maximize( *p_it );
bbMin.minimize( *p_it );
bbMax.maximize( *p_it );
}
Vec3d bbMind = ACG::Vec3d(bbMin);
Vec3d bbMaxd = ACG::Vec3d(bbMax);
_bbMin.minimize(bbMind);
_bbMax.maximize(bbMaxd);
}
......
......@@ -81,7 +81,7 @@ public:
unsigned int availableDrawModes() const;
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
void draw(GLState& _state, unsigned int _drawMode);
void pick(GLState& _state, PickTarget _target);
......
......@@ -379,8 +379,8 @@ public:
bool operator()(BaseNode* _node)
{
Vec3f bbMin( FLT_MAX, FLT_MAX, FLT_MAX);
Vec3f bbMax(-FLT_MAX, -FLT_MAX, -FLT_MAX);
Vec3d bbMin( FLT_MAX, FLT_MAX, FLT_MAX);
Vec3d bbMax(-FLT_MAX, -FLT_MAX, -FLT_MAX);
_node->boundingBox(bbMin, bbMax);
if ((bbMin[0] > bbMax[0]) ||
......@@ -406,13 +406,13 @@ public:
}
/// Returns minimum point of the bounding box
const Vec3f& bbMin() const { return bbMin_; }
const Vec3d& bbMin() const { return bbMin_; }
/// Returns maximum point of the bounding box
const Vec3f& bbMax() const { return bbMax_; }
const Vec3d& bbMax() const { return bbMax_; }
private:
Vec3f bbMin_, bbMax_;
Vec3d bbMin_, bbMax_;
GLState state_;
};
......
......@@ -95,7 +95,7 @@ SliceNode::view_frame( bool _view_frame )
void
SliceNode::boundingBox( Vec3f & _bbMin, Vec3f & _bbMax )
SliceNode::boundingBox( Vec3d & _bbMin, Vec3d & _bbMax )
{
_bbMin.minimize( visible_min_ );
_bbMax.maximize( visible_max_ );
......
......@@ -92,7 +92,7 @@ public:
unsigned int availableDrawModes() const;
void boundingBox( Vec3f & _bbMin, Vec3f & _bbMax );
void boundingBox( Vec3d & _bbMin, Vec3d & _bbMax );
void draw( GLState& _state, unsigned int _drawMode );
void draw_frame() const;
......@@ -110,8 +110,8 @@ public:
private:
Vec3f visible_min_;
Vec3f visible_max_;
Vec3d visible_min_;
Vec3d visible_max_;
Vec3f texture_min_;
Vec3f texture_max_;
......
......@@ -92,7 +92,7 @@ StatusNodeT( const Mesh& _mesh,
template <class Mesh, class Mod>
void
StatusNodeT<Mesh, Mod>::
boundingBox(Vec3f& _bbMin, Vec3f& _bbMax)
boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
{
_bbMin.minimize(bbMin_);
_bbMax.maximize(bbMax_);
......@@ -121,8 +121,8 @@ void
StatusNodeT<Mesh, Mod>::
update_cache()
{
bbMin_ = Vec3f(FLT_MAX, FLT_MAX, FLT_MAX);
bbMax_ = Vec3f(-FLT_MAX, -FLT_MAX, -FLT_MAX);
bbMin_ = Vec3d(FLT_MAX, FLT_MAX, FLT_MAX);
bbMax_ = Vec3d(-FLT_MAX, -FLT_MAX, -FLT_MAX);
typename Mesh::ConstVertexIter v_it(mesh_.vertices_sbegin()),
v_end(mesh_.vertices_end());
......@@ -134,8 +134,8 @@ update_cache()
{
v_cache_.push_back(v_it.handle().idx());
}
bbMin_.minimize((Vec3f)mesh_.point(v_it));
bbMax_.maximize((Vec3f)mesh_.point(v_it));
bbMin_.minimize(mesh_.point(v_it));
bbMax_.maximize(mesh_.point(v_it));
}
......
......@@ -103,7 +103,7 @@ public:
unsigned int availableDrawModes() const;
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
void draw(GLState& _state, unsigned int _drawMode);
void pick(GLState& /* _state */ , PickTarget /* _target */ ) {}
......@@ -128,8 +128,8 @@ private:
std::vector<FaceHandle> fh_cache_;
// bounding box
Vec3f bbMin_;
Vec3f bbMax_;
Vec3d bbMin_;
Vec3d bbMax_;
};
......
......@@ -83,7 +83,7 @@ TextNode::
void
TextNode::
boundingBox(Vec3f& /*_bbMin*/, Vec3f& /*_bbMax*/)
boundingBox(Vec3d& /*_bbMin*/, Vec3d& /*_bbMax*/)
{
}
......
......@@ -114,7 +114,7 @@ public:
unsigned int availableDrawModes() const;
/// update bounding box
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// draw Text
void draw(GLState& _state, unsigned int _drawMode);
......
......@@ -167,6 +167,13 @@ TranslationManipulatorNode( BaseNode* _parent, const std::string& _name )
element_[i].active_current_color_ = element_[i].active_target_color_;
element_[i].inactive_current_color_ = element_[i].inactive_target_color_;
}
/*
setMultipassNode(0);
multipassNodeSetActive(2,true);
setMultipassStatus(0);
multipassStatusSetActive(1,true);
multipassStatusSetActive(2,true);*/
}
......@@ -1949,15 +1956,15 @@ void TranslationManipulatorNode::updateSize (GLState& _state)
//----------------------------------------------------------------------------
void TranslationManipulatorNode::boundingBox( Vec3f & _bbMin, Vec3f & _bbMax )
void TranslationManipulatorNode::boundingBox( Vec3d & _bbMin, Vec3d & _bbMax )
{
if (!draw_manipulator_)
return;
float r = 2 * manipulator_height_;
_bbMin.minimize(Vec3f(-r,-r,-r));
_bbMax.maximize(Vec3f(r,r,r));
_bbMin.minimize(Vec3d(-r,-r,-r));
_bbMax.maximize(Vec3d(r,r,r));
}
//----------------------------------------------------------------------------
......
......@@ -161,7 +161,7 @@ public:
virtual void mouseEvent(GLState& _state, QMouseEvent* _event);
/// bounding box of node
void boundingBox(Vec3f& _bbMin, Vec3f& _bbMax);
void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
/// set current operation mode
void setMode (ManipulatorMode _mode);
......@@ -238,8 +238,8 @@ private:
Vec3d dirZ_;
GLUquadricObj* axis_;
GLUquadricObj* circle_;
GLUquadricObj* sphere_;
GLUquadricObj* circle_;
GLUquadricObj* sphere_;
double manipulator_radius_;
double manipulator_height_;
......@@ -264,8 +264,8 @@ private:
bool ignoreTime_;
Vec2i oldPoint2D_;
Vec3d draggingOrigin3D_;
bool dragging_;
Vec3d draggingOrigin3D_;
bool dragging_;
Vec3d currentScale_;
......
......@@ -85,16 +85,25 @@ TriangleNode::~TriangleNode()
void
TriangleNode::boundingBox( Vec3f & _bbMin, Vec3f & _bbMax )
TriangleNode::boundingBox( Vec3d & _bbMin, Vec3d & _bbMax )
{
Vec3f bbMin(FLT_MAX,FLT_MAX,FLT_MAX);
Vec3f bbMax(-FLT_MAX,-FLT_MAX,-FLT_MAX);
PointVector::const_iterator p_it = point_.begin(),
p_end = point_.end();
p_end = point_.end();
for ( ; p_it != p_end; ++p_it )
{
_bbMin.minimize( *p_it );
_bbMax.maximize( *p_it );
bbMin.minimize( *p_it );
bbMax.maximize( *p_it );
}
Vec3d bbMind = ACG::Vec3d(bbMin);
Vec3d bbMaxd = ACG::Vec3d(bbMax);
_bbMin.minimize(bbMind);
_bbMax.maximize(bbMaxd);
}
......
......@@ -82,7 +82,7 @@ public:
unsigned int availableDrawModes() const;