fesoliveira014 / yanve

0 stars 0 forks source link

Improve Scene Node parameter manipulation #19

Open fesoliveira014 opened 3 years ago

fesoliveira014 commented 3 years ago

Currently, in order to manipulate a scene node we need to do the following:

auto& sm= yanve::scene::SceneManager::getInstance();
sm.resolveNodeID(id)->translate(somePosition);

A better way, as implemented in Horde3D would be the following:

auto& sm= yanve::scene::SceneManager::getInstance();
sm.setParameterVec3(id, SceneNodeParam::Translate, somePosition);

For some specialized nodes, such as the camera, it makes a big difference:

auto& sm= yanve::scene::SceneManager::getInstance();
// as is currently
cameraUp = ((yanve::scene::Camera*)sm.resolveNodeID(cameraId))->up();
// as would be
cameraUp = sm.getParameterVec3(cameraId, CameraParam::Up);

There is also the plus that no pointer manipulation would be necessary on the "front-end", all happening inside the scene managere system.