bool DSLightChunk::operator == (const StateChunk &other) const { const DSLightChunk *tother = dynamic_cast<const DSLightChunk *>(&other); if(!tother) return false; if(tother == this) return true; if(!getAmbient ().equals(tother->getAmbient (), TypeTraits<Real32>::getDefaultEps()) || !getDiffuse ().equals(tother->getDiffuse (), TypeTraits<Real32>::getDefaultEps()) || !getSpecular ().equals(tother->getSpecular (), TypeTraits<Real32>::getDefaultEps()) || !getPosition ().equals(tother->getPosition (), TypeTraits<Real32>::getDefaultEps()) || !getDirection().equals(tother->getDirection(), TypeTraits<Real32>::getDefaultEps()) || getConstantAttenuation () != tother->getConstantAttenuation () || getLinearAttenuation () != tother->getLinearAttenuation () || getQuadraticAttenuation() != tother->getQuadraticAttenuation() || getCutoff () != tother->getCutoff () || getExponent () != tother->getExponent () ) { return false; } return true; }
bool PointChunk::operator == (const StateChunk &other) const { PointChunk const *tother = dynamic_cast<PointChunk const*>(&other); if(!tother) return false; if(tother == this) return true; if(getSize() != tother->getSize() || getSmooth() != tother->getSmooth() || getMinSize() != tother->getMinSize() || getMaxSize() != tother->getMaxSize() || getConstantAttenuation() != tother->getConstantAttenuation() || getLinearAttenuation() != tother->getLinearAttenuation() || getQuadraticAttenuation() != tother->getQuadraticAttenuation() || getFadeThreshold() != tother->getFadeThreshold() || getSprite() != tother->getSprite() || getRMode() != tother->getRMode() ) { return false; } return true; }
Vector3f SpotLight::getAttenuation () const { Single constantAtten = getConstantAttenuation (); Single linearAtten = getLinearAttenuation (); Single quadraticAtten = getQuadraticAttenuation (); Vector3f attenuation (constantAtten, linearAtten, quadraticAtten); return (attenuation); }
void PointLight::makeChunk(void) { Inherited::makeChunk(); Vec4f pos(_sfPosition.getValue()); pos[3] = 1; _pChunk->setPosition (pos ); _pChunk->setConstantAttenuation (getConstantAttenuation ()); _pChunk->setLinearAttenuation (getLinearAttenuation ()); _pChunk->setQuadraticAttenuation(getQuadraticAttenuation()); }
void PointChunk::changeFrom(DrawEnv *pEnv, StateChunk *old_chunk, UInt32 ) { PointChunk *old = dynamic_cast<PointChunk *>(old_chunk); #ifndef OSG_OGL_ES2 if(getSize() != old->getSize()) glPointSize(getSize()); #endif #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) if(getSmooth() && !old->getSmooth()) { glEnable(GL_POINT_SMOOTH); } else if(!getSmooth() && old->getSmooth()) { glDisable(GL_POINT_SMOOTH); } #endif Window *pWin = pEnv->getWindow(); osgSinkUnusedWarning(pWin); #if GL_ARB_point_parameters if(getMinSize() >= 0.f) { if(pEnv->getWindow()->hasExtOrVersion(_extPointParameters, 0x0104)) { OSGGETGLFUNCBYID_GL3( glPointParameterf, osgGlPointParameterf, _funcIdPointParameterf, pWin); #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) OSGGETGLFUNCBYID_GL3( glPointParameterfv, osgGlPointParameterfv, _funcIdPointParameterfv, pWin); osgGlPointParameterf(GL_POINT_SIZE_MIN_ARB, getMinSize()); osgGlPointParameterf(GL_POINT_SIZE_MAX_ARB, getMaxSize()); #endif osgGlPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE_ARB, getFadeThreshold()); #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) GLfloat att[3] = { getConstantAttenuation (), getLinearAttenuation (), getQuadraticAttenuation() }; osgGlPointParameterfv(GL_POINT_DISTANCE_ATTENUATION_ARB, att); #endif } } else if(old->getMinSize() >= 0.f) { if(pEnv->getWindow()->hasExtOrVersion(_extPointParameters, 0x0104)) { OSGGETGLFUNCBYID_GL3( glPointParameterf, osgGlPointParameterf, _funcIdPointParameterf, pWin); #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) OSGGETGLFUNCBYID_GL3( glPointParameterfv, osgGlPointParameterfv, _funcIdPointParameterfv, pWin); osgGlPointParameterf(GL_POINT_SIZE_MIN_ARB, 0); osgGlPointParameterf(GL_POINT_SIZE_MAX_ARB, 1e10); #endif osgGlPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1); #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) GLfloat att[3] = { 1, 0, 0 }; osgGlPointParameterfv(GL_POINT_DISTANCE_ATTENUATION_ARB, att); #endif } } #endif #if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY) #if GL_ARB_point_sprite if(getSprite() && !old->getSprite()) { if(pEnv->getWindow()->hasExtOrVersion(_extPointSpriteARB, 0x0200)) { #if GL_NV_point_sprite if(pEnv->getWindow()->hasExtension(_extPointSpriteNV)) { OSGGETGLFUNCBYID_GL3( glPointParameterf, osgGlPointParameterf, _funcIdPointParameterf, pWin); osgGlPointParameterf(GL_POINT_SPRITE_R_MODE_NV, Real32(getRMode())); } #endif glEnable(GL_POINT_SPRITE_ARB); } } else if(!getSprite() && old->getSprite()) { if(pEnv->getWindow()->hasExtOrVersion(_extPointSpriteARB, 0x0200)) { glDisable(GL_POINT_SPRITE_ARB); } } #endif #endif #if ! defined(GL_ARB_point_parameters) && ! defined(GL_ARB_point_sprite) pEnv; #endif }