Commit 9db0a07a authored by Jan Möbius's avatar Jan Möbius
Browse files

Cleanedup slicing node ... i wanted to clean up the clipping node but anyway


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8117 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 4e5765ad
......@@ -57,10 +57,10 @@ namespace SceneGraph {
SliceNode::SliceNode( BaseNode * _parent,
std::string _name ) :
BaseNode( _parent, _name )
BaseNode( _parent, _name ),
view_frame_(false),
enabled_(NONE)
{
set_enabled( NONE );
set_visible_box( Vec3f( 0, 0, 0 ),
Vec3f( 1, 1, 1 ) );
......@@ -68,8 +68,6 @@ SliceNode::SliceNode( BaseNode * _parent,
Vec3f( 1, 1, 1 ) );
set_cursor( Vec3f( 0.5, 0.5, 0.5 ) );
view_frame( false );
}
......@@ -110,10 +108,10 @@ SliceNode::availableDrawModes() const
{
return 0;
return ( DrawModes::POINTS |
DrawModes::WIREFRAME |
DrawModes::HIDDENLINE |
DrawModes::SOLID_FLAT_SHADED |
DrawModes::SOLID_SMOOTH_SHADED );
DrawModes::WIREFRAME |
DrawModes::HIDDENLINE |
DrawModes::SOLID_FLAT_SHADED |
DrawModes::SOLID_SMOOTH_SHADED );
}
......@@ -123,12 +121,17 @@ SliceNode::availableDrawModes() const
void
SliceNode::draw( GLState & /* _state */ , unsigned int /* _drawMode */ )
{
if ( view_frame_ )
draw_frame();
if ( is_enabled( NONE ) )
return;
glPushAttrib(GL_LIGHTING_BIT);
glPushAttrib(GL_ENABLE_BIT);
glPushAttrib(GL_COLOR_BUFFER_BIT);
if ( view_frame_ )
draw_frame();
glEnable( GL_LIGHTING );
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE );
......@@ -142,6 +145,10 @@ SliceNode::draw( GLState & /* _state */ , unsigned int /* _drawMode */ )
glDisable( GL_BLEND );
glDisable( GL_TEXTURE_3D );
glDisable( GL_LIGHTING );
glPopAttrib();
glPopAttrib();
glPopAttrib();
}
......@@ -189,22 +196,6 @@ SliceNode::draw_frame() const
glEnd();
/*
glBegin( GL_LINES );
glVertex3f( bbmin_[0], cursor_[1], cursor_[2] );
glVertex3f( bbmax_[0], cursor_[1], cursor_[2] );
glVertex3f( cursor_[0], bbmin_[1], cursor_[2] );
glVertex3f( cursor_[0], bbmax_[1], cursor_[2] );
glVertex3f( cursor_[0], cursor_[1], bbmin_[2] );
glVertex3f( cursor_[0], cursor_[1], bbmax_[2] );
glEnd();
*/
glBegin( GL_LINES );
glColor3f( 1, 1, 1 );
......@@ -350,104 +341,6 @@ SliceNode::draw_planes() const
glDepthRange(0.0, 1.0);
}
//----------------------------------------------------------------------------
// void
// SliceNode::draw_planes() const
// {
// glShadeModel( GL_FLAT );
// glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
// glDepthRange(0.01, 1.0);
// Vec3f rel;
// Vec3f tcmin;
// Vec3f tcmax;
// for ( int i = 0; i < 3; ++i )
// {
// rel[i] = ( cursor_[i]-texture_min_[i] ) / ( texture_max_[i] - texture_min_[i] );
// tcmin[i] = ( visible_min_[i] - texture_min_[i] )
// / ( texture_max_[i] - texture_min_[i] );
// tcmax[i] = ( visible_max_[i] - texture_min_[i] )
// / ( texture_max_[i] - texture_min_[i] );
// }
// if ( cursor_[2] >= visible_min_[2] &&
// cursor_[2] <= visible_max_[2] &&
// is_enabled( XY_PLANE ) )
// {
// glBegin( GL_QUADS );
// glNormal3f( 0, 0, 1 );
// glTexCoord3f( tcmin[0], tcmin[1], rel[2] );
// glVertex3f( visible_min_[0], visible_min_[1], cursor_[2] );
// glTexCoord3f( tcmax[0], tcmin[1], rel[2] );
// glVertex3f( visible_max_[0], visible_min_[1], cursor_[2] );
// glTexCoord3f( tcmax[0], tcmax[1], rel[2] );
// glVertex3f( visible_max_[0], visible_max_[1], cursor_[2] );
// glTexCoord3f( tcmin[0], tcmax[1], rel[2] );
// glVertex3f( visible_min_[0], visible_max_[1], cursor_[2] );
// glEnd();
// }
// if ( cursor_[0] >= visible_min_[0] &&
// cursor_[0] <= visible_max_[0] &&
// is_enabled( YZ_PLANE ) )
// {
// glBegin( GL_QUADS );
// glNormal3f( -1, 0, 0 );
// glTexCoord3f( rel[0], tcmin[1], tcmin[2] );
// glVertex3f( cursor_[0], visible_min_[1], visible_min_[2] );
// glTexCoord3f( rel[0], tcmin[1], tcmax[2] );
// glVertex3f( cursor_[0], visible_min_[1], visible_max_[2] );
// glTexCoord3f( rel[0], tcmax[1], tcmax[2] );
// glVertex3f( cursor_[0], visible_max_[1], visible_max_[2] );
// glTexCoord3f( rel[0], tcmax[1], tcmin[2] );
// glVertex3f( cursor_[0], visible_max_[1], visible_min_[2] );
// glEnd();
// }
// if ( cursor_[1] >= visible_min_[1] &&
// cursor_[1] <= visible_max_[1] &&
// is_enabled( XZ_PLANE ) )
// {
// glBegin( GL_QUADS );
// glNormal3f( 0, -1, 0 );
// glTexCoord3f( tcmin[0], rel[1], tcmin[2] );
// glVertex3f( visible_min_[0], cursor_[1], visible_min_[2] );
// glTexCoord3f( tcmax[0], rel[1], tcmin[2] );
// glVertex3f( visible_max_[0], cursor_[1], visible_min_[2] );
// glTexCoord3f( tcmax[0], rel[1], tcmax[2] );
// glVertex3f( visible_max_[0], cursor_[1], visible_max_[2] );
// glTexCoord3f( tcmin[0], rel[1], tcmax[2] );
// glVertex3f( visible_min_[0], cursor_[1], visible_max_[2] );
// glEnd();
// }
// glDepthRange(0.0, 1.0);
// }
//----------------------------------------------------------------------------
......@@ -518,9 +411,6 @@ SliceNode::set_texture_box( const Vec3f & _box_min,
void
SliceNode::pick( GLState & _state, PickTarget /* _target */ )
{
// if ( _target == PICK_ANYTHING )
// return;
_state.pick_set_maximum (1);
_state.pick_set_name (0);
glDisable(GL_LIGHTING);
......
......@@ -79,14 +79,14 @@ public:
};
SliceNode( BaseNode * _parent = 0,
std::string _name = "<SliceNode>" );
std::string _name = "<SliceNode>" );
virtual ~SliceNode();
void set_visible_box( const Vec3f & _bmin,
const Vec3f & _bmax );
const Vec3f & _bmax );
void set_texture_box( const Vec3f & _bmin,
const Vec3f & _bmax );
const Vec3f & _bmax );
ACG_CLASSNAME( SliceNode );
......
Supports Markdown
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