63 #include "ClippingNode.hh"
72 namespace SceneGraph {
83 position_ = _position;
84 normal_ = _normal; normal_.normalize();
89 if (slice_width_ == 0.0)
91 plane0_[0] = normal_[0];
92 plane0_[1] = normal_[1];
93 plane0_[2] = normal_[2];
94 plane0_[3] = -(normal_|position_);
101 float d = -(normal_|position_);
102 if (d > 0) { normal_ = -normal_; d = -d; }
104 plane0_[0] = normal_[0];
105 plane0_[1] = normal_[1];
106 plane0_[2] = normal_[2];
107 plane0_[3] = d + 0.5f*slice_width_;
109 plane1_[0] = -normal_[0];
110 plane1_[1] = -normal_[1];
111 plane1_[2] = -normal_[2];
112 plane1_[3] = -(d - 0.5f*slice_width_);
128 offset_plane0_[0] = plane0_[0];
129 offset_plane0_[1] = plane0_[1];
130 offset_plane0_[2] = plane0_[2];
131 offset_plane0_[3] = plane0_[3] - offset_;
133 offset_plane1_[0] = plane1_[0];
134 offset_plane1_[1] = plane1_[1];
135 offset_plane1_[2] = plane1_[2];
136 offset_plane1_[3] = plane1_[3] + offset_;
146 if (slice_width_ == 0.0)
148 glClipPlane(GL_CLIP_PLANE0, offset_plane0_);
156 glClipPlane(GL_CLIP_PLANE0, offset_plane0_);
158 glClipPlane(GL_CLIP_PLANE1, offset_plane1_);
170 if (slice_width_ > 0.0)
void set_plane(const Vec3f &_position, const Vec3f &_normal, float _eps=0.0)
set position and normal of plane
Namespace providing different geometric functions concerning angles.
static void enable(GLenum _cap)
replaces glEnable, but supports locking
static void disable(GLenum _cap)
replaces glDisable, but supports locking
void enter(GLState &_state, const DrawModes::DrawMode &_drawmode)
set texture
void set_offset(float _dist)
sweep plane along normal by _dist
void leave(GLState &_state, const DrawModes::DrawMode &_drawmode)
restores original texture (or no-texture)