void CubeAnim::update() { FMOD_System_GetChannel(system, 0, &canal); FMOD_Channel_GetSpectrum(canal, spectre, TAILLE_SPECTRE, 0, FMOD_DSP_FFT_WINDOW_RECT); for (size_t i = 0; i < _objects.size(); ++i) _objects[i]->translate(vec3(0, getEquation(i), 0)); }
void Plane::getEquation(float& a, float& b, float& c, float& d) const { double _a, _b, _c, _d; getEquation(_a, _b, _c, _d); a = (float)_a; b = (float)_b; c = (float)_c; d = (float)_d; }
void CubeAnim::draw(gdl::AShader &shader, type &LastType) { for (size_t i = 0; i < _objects.size(); ++i) { if (_objects[i]->getType() != LastType) { LastType = _objects[i]->getType(); _loader->bindTexture(LastType); } _loader->drawGeometry(shader, _objects[i]->getTransformation()); _objects[i]->translate(vec3(0, -getEquation(i), 0)); } }
bool ClipPlaneChunk::operator == (const StateChunk &other) const { ClipPlaneChunk const *tother = dynamic_cast<ClipPlaneChunk const*>(&other); if(!tother) return false; if(getEnable() != tother->getEnable()) return false; if(getEquation() != tother->getEquation()) return false; if(getBeacon() != tother->getBeacon()) return false; return true; }
void ClipPlaneChunk::activate(DrawEnv *pEnv, UInt32 idx) { #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) pEnv->incNumChunkChanges(); Matrix beaconMat; Matrix cameraMat = pEnv->getCameraViewing(); if(getBeacon() != NULL) { getBeacon()->getToWorld(beaconMat); } else { beaconMat.setIdentity(); SWARNING << "NO beacon" << std::endl; } cameraMat.mult(beaconMat); if(getEnable() == true) { GLdouble glEq[4]; const Vec4f &eq = getEquation(); glEq[0] = eq[0]; glEq[1] = eq[1]; glEq[2] = eq[2]; glEq[3] = eq[3]; glPushMatrix(); glLoadMatrixf(cameraMat.getValues()); glClipPlane( GL_CLIP_PLANE0 + idx, glEq); glEnable( GL_CLIP_PLANE0 + idx); glPopMatrix(); } #else OSG_ASSERT(false); #endif }
bool BlendChunk::operator == (const StateChunk &other) const { BlendChunk const *tother = dynamic_cast<BlendChunk const*>(&other); if(!tother) return false; if(tother == this) return true; if(getSrcFactor() != tother->getSrcFactor() || getDestFactor() != tother->getDestFactor() || getEquation() != tother->getEquation() || getColor() != tother->getColor() || getAlphaFunc() != tother->getAlphaFunc() || getAlphaValue() != tother->getAlphaValue() ) return false; return true; }
void Plane::getEquation(Vector3& n, float& d) const { double _d; getEquation(n, _d); d = (float)_d; }
void ClipPlaneChunk::changeFrom(DrawEnv *pEnv, StateChunk *old_chunk, UInt32 idx) { #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) ClipPlaneChunk const *old = dynamic_cast<ClipPlaneChunk const*>(old_chunk); // change from me to me? // this assumes I haven't changed in the meantime. // is that a valid assumption? if(old == this) return; pEnv->incNumChunkChanges(); Matrix beaconMat; Matrix cameraMat = pEnv->getCameraViewing(); if(getBeacon() != NULL) { getBeacon()->getToWorld(beaconMat); } else { beaconMat.setIdentity(); SWARNING << "ClipPlaneChunk::changeFrom: NO beacon" << std::endl; } cameraMat.mult(beaconMat); if(getEquation() != old->getEquation() || getEnable () != old->getEnable () || getBeacon () != old->getBeacon () ) { if(getEnable() == true) { GLdouble glEq[4]; const Vec4f &eq = getEquation(); glEq[0] = eq[0]; glEq[1] = eq[1]; glEq[2] = eq[2]; glEq[3] = eq[3]; glPushMatrix(); glLoadMatrixf(cameraMat.getValues()); glClipPlane(GL_CLIP_PLANE0 + idx, glEq); glEnable (GL_CLIP_PLANE0 + idx ); glPopMatrix(); } else { glDisable(GL_CLIP_PLANE0 + idx); } } #else OSG_ASSERT(false); #endif }