// ---------------------------------------------------------------------------- void AmbientLightSphere::update(float dt) { CheckStructure::update(dt); World *world = World::getWorld(); for(unsigned int i=0; i<world->getNumKarts(); i++) { AbstractKart *kart=world->getKart(i); if(!kart->getCamera()) continue; if(isInside(i)) { float d2=getDistance2ForKart(i); video::SColor color; Track *track=world->getTrack(); if(d2<m_inner_radius2) { // Inside inner radius --> use new ambient color color = m_ambient_color; } else // Interpolate between default and this ambient color { float f = (getRadius2()-d2)/(getRadius2()-m_inner_radius2); const video::SColor &def = track->getDefaultAmbientColor(); color = m_ambient_color.getInterpolated(def, f); } kart->getCamera()->setAmbientLight(color); } // if active } // for i<num_karts } // update
Action::Create3dPrimitive* CreatePrimitiveWidget::createTorusAction() const { gp_Ax3 axis(getPoint(), getDir()); float radius1 = getRadius1(); float radius2 = getRadius2(); float angle = getAngle(); return new Action::CreateTorus(axis, radius1, radius2, angle, 0, 0); }
Action::Create3dPrimitive* CreatePrimitiveWidget::createConeAction() const { gp_Ax3 axis(getPoint(), getDir()); float radius1 = getRadius1(); float radius2 = getRadius2(); float height = getHeight(); float angle = getAngle(); return new Action::CreateCone(axis, radius1, radius2, height, angle); }