| 25 | using namespace slg; |
| 26 | |
| 27 | void Scene::UpdateObjectTransformation(const string &objName, const Transform &trans) { |
| 28 | if (!objDefs.IsSceneObjectDefined(objName)) |
| 29 | throw runtime_error("Unknown object in Scene::UpdateObjectTransformation(): " + objName); |
| 30 | |
| 31 | SceneObject *obj = objDefs.GetSceneObject(objName); |
| 32 | ExtMesh *mesh = obj->GetExtMesh(); |
| 33 | |
| 34 | ExtInstanceTriangleMesh *instanceMesh = dynamic_cast<ExtInstanceTriangleMesh *>(mesh); |
| 35 | if (instanceMesh) { |
| 36 | instanceMesh->SetTransformation(trans); |
| 37 | editActions.AddAction(GEOMETRY_TRANS_EDIT); |
| 38 | } else { |
| 39 | mesh->ApplyTransform(trans); |
| 40 | editActions.AddAction(GEOMETRY_EDIT); |
| 41 | } |
| 42 | |
| 43 | // Check if it is a light source |
| 44 | if (obj->GetMaterial()->IsLightSource()) { |
| 45 | // Have to update all light sources using this mesh |
| 46 | for (u_int i = 0; i < mesh->GetTotalTriangleCount(); ++i) |
| 47 | lightDefs.GetLightSource(obj->GetName() + TRIANGLE_LIGHT_POSTFIX + ToString(i))->Preprocess(); |
| 48 | |
| 49 | editActions.AddActions(LIGHTS_EDIT | LIGHT_TYPES_EDIT); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | void Scene::UpdateObjectMaterial(const string &objName, const string &matName) { |
| 54 | if (!objDefs.IsSceneObjectDefined(objName)) |
nothing calls this directly
no test coverage detected