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

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
......@@ -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;
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);
......
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