Mathias Frhlich:
I have a small update which fixes the algorythm used for marking solid surfaces for some cases where some branch nodes carry the object names I had expected in the leaf nodes. That will also introduce the possibility to mark whole subtrees from the scenegraph solid.
This commit is contained in:
parent
9afec17205
commit
127e84cee9
2 changed files with 10 additions and 5 deletions
|
@ -92,7 +92,7 @@ bool FGAICarrier::init() {
|
||||||
// Attach a pointer to this carrier class to those objects.
|
// Attach a pointer to this carrier class to those objects.
|
||||||
mark_wires(sel, wire_objects);
|
mark_wires(sel, wire_objects);
|
||||||
mark_cat(sel, catapult_objects);
|
mark_cat(sel, catapult_objects);
|
||||||
mark_solid(sel, solid_objects);
|
mark_solid(sel, solid_objects, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -160,13 +160,18 @@ bool FGAICarrier::mark_wires(ssgEntity* e, const list<string>& wire_objects) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FGAICarrier::mark_solid(ssgEntity* e, const list<string>& solid_objects) {
|
bool FGAICarrier::mark_solid(ssgEntity* e, const list<string>& solid_objects, bool mark) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (e->isAKindOf(ssgTypeBranch())) {
|
if (e->isAKindOf(ssgTypeBranch())) {
|
||||||
ssgBranch* br = (ssgBranch*)e;
|
ssgBranch* br = (ssgBranch*)e;
|
||||||
ssgEntity* kid;
|
ssgEntity* kid;
|
||||||
|
|
||||||
|
list<string>::const_iterator it;
|
||||||
|
for (it = solid_objects.begin(); it != solid_objects.end(); ++it)
|
||||||
|
mark = mark || e->getName() && (*it) == e->getName();
|
||||||
|
|
||||||
for ( kid = br->getKid(0); kid != NULL ; kid = br->getNextKid() )
|
for ( kid = br->getKid(0); kid != NULL ; kid = br->getNextKid() )
|
||||||
found = mark_solid(kid, solid_objects) || found;
|
found = mark_solid(kid, solid_objects, mark) || found;
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
br->setTraversalMaskBits(SSGTRAV_HOT);
|
br->setTraversalMaskBits(SSGTRAV_HOT);
|
||||||
|
@ -174,7 +179,7 @@ bool FGAICarrier::mark_solid(ssgEntity* e, const list<string>& solid_objects) {
|
||||||
} else if (e->isAKindOf(ssgTypeLeaf())) {
|
} else if (e->isAKindOf(ssgTypeLeaf())) {
|
||||||
list<string>::const_iterator it;
|
list<string>::const_iterator it;
|
||||||
for (it = solid_objects.begin(); it != solid_objects.end(); ++it) {
|
for (it = solid_objects.begin(); it != solid_objects.end(); ++it) {
|
||||||
if (e->getName() && (*it) == e->getName()) {
|
if (mark || (e->getName() && (*it) == e->getName())) {
|
||||||
e->setTraversalMaskBits(SSGTRAV_HOT);
|
e->setTraversalMaskBits(SSGTRAV_HOT);
|
||||||
e->setUserData( FGAICarrierHardware::newSolid( this ) );
|
e->setUserData( FGAICarrierHardware::newSolid( this ) );
|
||||||
found = true;
|
found = true;
|
||||||
|
|
|
@ -92,7 +92,7 @@ private:
|
||||||
void mark_nohot(ssgEntity*);
|
void mark_nohot(ssgEntity*);
|
||||||
bool mark_wires(ssgEntity*, const list<string>&);
|
bool mark_wires(ssgEntity*, const list<string>&);
|
||||||
bool mark_cat(ssgEntity*, const list<string>&);
|
bool mark_cat(ssgEntity*, const list<string>&);
|
||||||
bool mark_solid(ssgEntity*, const list<string>&);
|
bool mark_solid(ssgEntity*, const list<string>&, bool);
|
||||||
|
|
||||||
list<string> solid_objects; // List of solid object names
|
list<string> solid_objects; // List of solid object names
|
||||||
list<string> wire_objects; // List of wire object names
|
list<string> wire_objects; // List of wire object names
|
||||||
|
|
Loading…
Reference in a new issue