ClippingPresetAnimatedDualPlanes::ClippingPresetAnimatedDualPlanes( Geom::Vec3f centerStart, Geom::Vec3f centerEnd, float size, int axis, bool facing, bool zigzag) { // Store animation settings m_dirVec = centerEnd - centerStart; m_dirVec.normalize(); m_startPoint = centerStart; m_endPoint = centerEnd; m_zigzag = zigzag; int usedAxis = axis; if ((usedAxis < 0) || (usedAxis > 2)) usedAxis = 0; // Axis on which planes will be aligned Geom::Vec3f positDir (0.0f, 0.0f, 0.0f); positDir[usedAxis] = 1.0f; Geom::Vec3f negDir (0.0f, 0.0f, 0.0f); negDir[usedAxis] = -1.0f; // Facing of planes float side = 1.0f; if (facing) side = -1.0f; // Add planes to preset addClipPlane(positDir, centerStart + positDir*(size / 2.0f)*(side)); addClipPlane(negDir, centerStart + negDir*(size / 2.0f)*(side)); // Set clipping mode ClippingShader::clippingMode clipMode = ClippingShader::CLIPPING_MODE_AND; if (facing) clipMode = ClippingShader::CLIPPING_MODE_OR; setClippingMode(clipMode); }
ClippingPresetAnimatedRotatingPlane::ClippingPresetAnimatedRotatingPlane(Geom::Vec3f center, int axis) { // Store animation settings m_axis = axis; if ((m_axis < 0) || (m_axis)) m_axis = 0; // Axis on which planes will be aligned Geom::Vec3f normal (0.0f, 0.0f, 0.0f); normal[(m_axis + 1) % 3] = 1.0f; // Add plane to preset addClipPlane(normal, center); // Set clipping mode setClippingMode(ClippingShader::CLIPPING_MODE_AND); }
//--------------------------------------------------------------------- void RenderSystem::addClipPlane (Real A, Real B, Real C, Real D) { addClipPlane(Plane(A, B, C, D)); }