MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / BOOST_FOREACH

Function BOOST_FOREACH

src/slg/scene/parseobjects.cpp:35–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 double lastPrint = WallClockTime();
34 u_int objCount = 0;
35 BOOST_FOREACH(const string &key, objKeys) {
36 // Extract the object name
37 const string objName = Property::ExtractField(key, 2);
38 if (objName == "")
39 throw runtime_error("Syntax error in " + key);
40
41 if (objDefs.IsSceneObjectDefined(objName)) {
42 // A replacement for an existing object
43 const SceneObject *oldObj = objDefs.GetSceneObject(objName);
44 const bool wasLightSource = oldObj->GetMaterial()->IsLightSource();
45
46 // Check if the old object was a light source
47 if (wasLightSource) {
48 editActions.AddActions(LIGHTS_EDIT | LIGHT_TYPES_EDIT);
49
50 // Delete all old triangle lights
51 lightDefs.DeleteLightSourceStartWith(oldObj->GetName() + TRIANGLE_LIGHT_POSTFIX);
52 }
53 }
54
55 // In order to have harlequin colors with OBJECT_ID output
56 const u_int objID = ((u_int)(RadicalInverse(objDefs.GetSize() + 1, 2) * 255.f + .5f)) |
57 (((u_int)(RadicalInverse(objDefs.GetSize() + 1, 3) * 255.f + .5f)) << 8) |
58 (((u_int)(RadicalInverse(objDefs.GetSize() + 1, 5) * 255.f + .5f)) << 16);
59 SceneObject *obj = CreateObject(objID, objName, props);
60 objDefs.DefineSceneObject(obj);
61
62 // Check if it is a light source
63 const Material *mat = obj->GetMaterial();
64 if (mat->IsLightSource()) {
65 SDL_LOG("The " << objName << " object is a light sources with " << obj->GetExtMesh()->GetTotalTriangleCount() << " triangles");
66
67 objDefs.DefineIntersectableLights(lightDefs, obj);
68 }
69
70 ++objCount;
71
72 const double now = WallClockTime();
73 if (now - lastPrint > 2.0) {
74 SDL_LOG("Scene objects count: " << objCount);
75 lastPrint = now;
76 }
77 }
78 SDL_LOG("Scene objects count: " << objCount);
79
80 editActions.AddActions(GEOMETRY_EDIT);

Callers

nothing calls this directly

Calls 13

RadicalInverseFunction · 0.85
WallClockTimeFunction · 0.85
IsSceneObjectDefinedMethod · 0.80
GetSceneObjectMethod · 0.80
AddActionsMethod · 0.80
DefineSceneObjectMethod · 0.80
IsLightSourceMethod · 0.45
GetMaterialMethod · 0.45
GetSizeMethod · 0.45
GetTotalTriangleCountMethod · 0.45

Tested by

no test coverage detected