mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
c9c8d02332
This PR fixes a crash caused by the improperly ensured lifetime of RigGeometry::mSourceGeometry. mSourceGeometry was not adequate to ensure mSourceGeometry would outlive mGeometry because we extend mGeometrys lifetime beyond this lifetime by passing mGeometry to the draw traversal instead of this. In addition, We add important comments. We detect and prevent generally unsafe operations in high level code. We add a sprinkling of const to help clarify intentions.
31 lines
1000 B
C++
31 lines
1000 B
C++
#ifndef OPENMW_COMPONENTS_SCENEUTIL_ATTACH_H
|
|
#define OPENMW_COMPONENTS_SCENEUTIL_ATTACH_H
|
|
|
|
#include <string>
|
|
|
|
#include <osg/ref_ptr>
|
|
|
|
namespace osg
|
|
{
|
|
class Node;
|
|
class Group;
|
|
}
|
|
namespace Resource
|
|
{
|
|
class SceneManager;
|
|
}
|
|
|
|
namespace SceneUtil
|
|
{
|
|
|
|
/// Clone and attach parts of the \a toAttach scenegraph to the \a master scenegraph, using the specified filter and attachment node.
|
|
/// If the \a toAttach scene graph contains skinned objects, we will attach only those (filtered by the \a filter).
|
|
/// Otherwise, just attach all of the toAttach scenegraph to the attachment node on the master scenegraph, with no filtering.
|
|
/// @note The master scene graph is expected to include a skeleton.
|
|
/// @return A newly created node that is directly attached to the master scene graph
|
|
osg::ref_ptr<osg::Node> attach(osg::ref_ptr<const osg::Node> toAttach, osg::Node* master, const std::string& filter, osg::Group* attachNode, Resource::SceneManager *sceneManager);
|
|
|
|
}
|
|
|
|
#endif
|