Canvas texture replacement visitor compiler fix.
Change to use pointers rather than osg::ref_ptr<osg::Group> - based on http://andesengineering.com/OSG_ProducerArticles/RefPointers/RefPointers I think that it is not possible that the scenegraph can be modified between the visitor and the modify, provided that the methods are called after each other like this: ReplaceStaticTextureVisitor visitor(name, new_texture); branch->accept(visitor); visitor.modify_groups(); return visitor.getPlacements();
This commit is contained in:
parent
e48a3d8b32
commit
bde3dd0644
1 changed files with 11 additions and 3 deletions
|
@ -70,9 +70,16 @@ FGODGauge::~FGODGauge()
|
|||
* Used to remember the located groups that require modification
|
||||
*/
|
||||
typedef struct {
|
||||
typedef osg::ref_ptr<osg::Group> GroupPtr;
|
||||
GroupPtr parent;
|
||||
GroupPtr node;
|
||||
// could be:
|
||||
//typedef osg::ref_ptr<osg::Group> GroupPtr;
|
||||
//GroupPtr parent;
|
||||
//GroupPtr node;
|
||||
// However this gives compile errors on linux;
|
||||
// so change to use good old fashioned pointers.
|
||||
// This means that the pointer may become invalid; however provided that this is a short lived operation
|
||||
// and that modify is called immediately after visit it should work.
|
||||
osg::Group *parent;
|
||||
osg::Group *node;
|
||||
int unit;
|
||||
}GroupListItem;
|
||||
|
||||
|
@ -207,6 +214,7 @@ class ReplaceStaticTextureVisitor:
|
|||
* this section of code used to be in the apply method above, however to work this requires modification of the scenegraph nodes
|
||||
* that are currently iterating, so instead the apply method will locate the groups to be modified and when finished then the
|
||||
* nodes can actually be modified safely. Initially found thanks to the debug RTL in MSVC2015 throwing an exception.
|
||||
* should be called immediately after the visitor to ensure that the groups are still valid and that nothing else has modified these groups.
|
||||
*/
|
||||
void modify_groups()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue