void PhotonSortingTask::Run() { // quit right away if photons not enabled if (!GetSceneData()->photonSettings.photonsEnabled) return; Cooperate(); if(strategy!=NULL) { delete strategy; sortPhotonMap(); } else { if (!this->load()) messageFactory.Error(POV_EXCEPTION_STRING("Failed to load photon map from disk"), "Could not load photon map (%s)",GetSceneData()->photonSettings.fileName); // set photon options automatically if (GetSceneData()->surfacePhotonMap.numPhotons>0) GetSceneData()->surfacePhotonMap.setGatherOptions(GetSceneData()->photonSettings,false); if (GetSceneData()->mediaPhotonMap.numPhotons>0) GetSceneData()->mediaPhotonMap.setGatherOptions(GetSceneData()->photonSettings,true); } // good idea to make sure all warnings and errors arrive frontend now [trf] SendProgress(); Cooperate(); }
void PhotonEstimationTask::SearchThroughObjectsEstimatePhotons(vector<ObjectPtr>& Objects, LightSource *Light) { ViewThreadData *renderDataPtr = GetViewDataPtr(); shared_ptr<SceneData> sceneData = GetSceneData(); /* check this object and all siblings */ for(vector<ObjectPtr>::iterator Sib = Objects.begin(); Sib != Objects.end(); Sib++) { if(Test_Flag((*Sib), PH_TARGET_FLAG) && !((*Sib)->Type & LIGHT_SOURCE_OBJECT)) { /* do not shoot photons if global lights are turned off for ObjectPtr */ if(!Test_Flag((*Sib), NO_GLOBAL_LIGHTS_FLAG)) { EstimatePhotonsForObjectAndLight((*Sib), Light); } Cooperate(); } /* if it has children, check them too */ else if(((*Sib)->Type & IS_COMPOUND_OBJECT)) { SearchThroughObjectsEstimatePhotons(((CSG *)(*Sib))->children, Light); } } }
void PhotonEstimationTask::Run() { // quit right away if photons not enabled if (!GetSceneData()->photonSettings.photonsEnabled) return; if (GetSceneData()->photonSettings.surfaceCount==0) return; Cooperate(); // COUNT THE PHOTONS DBL factor; photonCountEstimate = 0.0; // global lights GetViewDataPtr()->Light_Is_Global = true; for(vector<LightSource *>::iterator Light = GetSceneData()->lightSources.begin(); Light != GetSceneData()->lightSources.end(); Light++) { if((*Light)->Light_Type != FILL_LIGHT_SOURCE) SearchThroughObjectsEstimatePhotons(GetSceneData()->objects, *Light); } // light_group lights /* TODO renderer->sceneData->photonSettings.Light_Is_Global = false; for(vector<LightSource *>::iterator Light_Group_Light = renderer->sceneData->lightGroupLights.begin(); Light_Group_Light != renderer->sceneData->lightGroupLights.end(); Light_Group_Light++) { Light = Light_Group_Light->Light; if (Light->Light_Type != FILL_LightSource) { SearchThroughObjectsEstimatePhotons(GetSceneData()->objects, *Light); } } */ factor = (DBL)photonCountEstimate/GetSceneData()->photonSettings.surfaceCount; factor = sqrt(factor); GetSceneData()->photonSettings.surfaceSeparation *= factor; // good idea to make sure all warnings and errors arrive frontend now [trf] Cooperate(); }
void MaskedColor::BlitTo( int x, int y, OGraphics& output) { Surface &dest = *output.GetSurface(); Cooperate( dest ); Surf::BlitFX fx; fx.flood_fill = true; fx.flood_color = _color.u; fx.invert_src_alpha = _inverted; fx.alpha_factors[0] = _alpha_0; fx.alpha_factors[1] = _alpha_1; fx.rotation = !!_angle; fx.angle = _angle; dest.Blit( x, y, *GetSurface(), GetRect(), fx ); }
void MaskedColor::MultiBlitTo( OGraphics &output, const PointList &pnts, const RectList &rcs ) { Surface &dest = *output.GetSurface(); Cooperate( dest ); const Surface &source = *GetSurface(); Surf::BlitFX fx; fx.flood_fill = true; fx.flood_color = _color.u; fx.invert_src_alpha = _inverted; fx.alpha_factors[0] = _alpha_0; fx.alpha_factors[1] = _alpha_1; fx.rotation = !!_angle; fx.angle = _angle; dest.MultiBlit( source, pnts, rcs, fx ); }
/************* * DESCRIPTION: update window and input methods * INPUT: none * OUTPUT: none *************/ static void SAVEDS CooperateInterface(rsiCONTEXT *rc) { Cooperate(rc); }
void __saveds CooperateInterface(rsiCONTEXT *rc) { Cooperate(rc); }