Commit e0e196bf authored by tenter's avatar tenter

separate enter leave functions

parent b1b0e876
Pipeline #2942 passed with stage
in 93 minutes and 27 seconds
......@@ -144,27 +144,22 @@ ClippingNode::set_offset(float _offset)
//----------------------------------------------------------------------------
void ClippingNode::enter(IRenderer* _renderer, GLState& /* _state */ , const DrawModes::DrawMode& /* _drawmode */ )
void ClippingNode::enter(GLState& /* _state */ , const DrawModes::DrawMode& /* _drawmode */ )
{
if (_renderer)
_renderer->addRenderObjectModifier(&mod_);
// one clipping plane
if (slice_width_ == 0.0)
{
glClipPlane(GL_CLIP_PLANE0, offset_plane0_);
ACG::GLState::enable(GL_CLIP_PLANE0);
}
// two planes -> slice
else
{
// one clipping plane
if (slice_width_ == 0.0)
{
glClipPlane(GL_CLIP_PLANE0, offset_plane0_);
ACG::GLState::enable(GL_CLIP_PLANE0);
}
// two planes -> slice
else
{
glClipPlane(GL_CLIP_PLANE0, offset_plane0_);
ACG::GLState::enable(GL_CLIP_PLANE0);
glClipPlane(GL_CLIP_PLANE1, offset_plane1_);
ACG::GLState::enable(GL_CLIP_PLANE1);
}
glClipPlane(GL_CLIP_PLANE0, offset_plane0_);
ACG::GLState::enable(GL_CLIP_PLANE0);
glClipPlane(GL_CLIP_PLANE1, offset_plane1_);
ACG::GLState::enable(GL_CLIP_PLANE1);
}
}
......@@ -172,16 +167,29 @@ void ClippingNode::enter(IRenderer* _renderer, GLState& /* _state */ , const Dra
//----------------------------------------------------------------------------
void ClippingNode::leave(IRenderer* _renderer, GLState& /* _state */ , const DrawModes::DrawMode& /* _drawmode */ )
void ClippingNode::leave(GLState& /* _state */ , const DrawModes::DrawMode& /* _drawmode */ )
{
if (_renderer)
_renderer->removeRenderObjectModifier(&mod_);
else
{
ACG::GLState::disable(GL_CLIP_PLANE0);
if (slice_width_ > 0.0)
ACG::GLState::disable(GL_CLIP_PLANE1);
}
ACG::GLState::disable(GL_CLIP_PLANE0);
if (slice_width_ > 0.0)
ACG::GLState::disable(GL_CLIP_PLANE1);
}
//----------------------------------------------------------------------------
void ClippingNode::enter(IRenderer* _renderer, GLState& /* _state */, const DrawModes::DrawMode& /* _drawmode */)
{
_renderer->addRenderObjectModifier(&mod_);
}
//----------------------------------------------------------------------------
void ClippingNode::leave(IRenderer* _renderer, GLState& /* _state */, const DrawModes::DrawMode& /* _drawmode */)
{
_renderer->removeRenderObjectModifier(&mod_);
}
//=============================================================================
......
......@@ -125,12 +125,18 @@ public:
/// set class name
ACG_CLASSNAME(ClippingNode);
/// set texture
/// enable clipping plane
void enter(IRenderer* _renderer, GLState& _state, const DrawModes::DrawMode& _drawmode);
/// restores original texture (or no-texture)
/// disable clipping plane
void leave(IRenderer* _renderer, GLState& _state, const DrawModes::DrawMode& _drawmode);
/// enable clipping plane
void enter(GLState& _state, const DrawModes::DrawMode& _drawmode);
/// disable clipping plane
void leave(GLState& _state, const DrawModes::DrawMode& _drawmode);
/// set position and normal of plane
void set_plane(const Vec3f& _position, const Vec3f& _normal, float _eps=0.0);
......
......@@ -395,12 +395,12 @@ public:
void enter (BaseNode *_node)
{
_node->enter(0, state_, DrawModes::DEFAULT);
_node->enter(state_, DrawModes::DEFAULT);
}
void leave (BaseNode *_node)
{
_node->leave(0, state_, DrawModes::DEFAULT);
_node->leave(state_, DrawModes::DEFAULT);
}
/// Returns minimum point of the bounding box
......@@ -717,17 +717,17 @@ public:
void enter(BaseNode* _node)
{
if (_node->drawMode() == DrawModes::DEFAULT)
_node->enter(0, state_, drawMode_);
_node->enter(state_, drawMode_);
else
_node->enter(0, state_, _node->drawMode());
_node->enter(state_, _node->drawMode());
}
void leave(BaseNode* _node)
{
if (_node->drawMode() == DrawModes::DEFAULT)
_node->leave(0, state_, drawMode_);
_node->leave(state_, drawMode_);
else
_node->leave(0, state_, _node->drawMode());
_node->leave(state_, _node->drawMode());
}
private:
......
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