Change cloudfield::addCloud interface,
so it's more obvious that "addCloud" won't keep a reference to SGNewCloud.
This commit is contained in:
@@ -253,10 +253,9 @@ void SGCloudField::applyCoverage(void) {
|
|||||||
last_coverage = coverage;
|
last_coverage = coverage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SGCloudField::addCloud( SGVec3f& pos, SGNewCloud *cloud) {
|
void SGCloudField::addCloud( SGVec3f& pos, osg::ref_ptr<EffectGeode> geode) {
|
||||||
defined3D = true;
|
defined3D = true;
|
||||||
osg::ref_ptr<osg::Geode> geode = cloud->genCloud();
|
|
||||||
|
|
||||||
// Determine which quadtree to put it in.
|
// Determine which quadtree to put it in.
|
||||||
int x = (int) floor((pos.x() + fieldSize/2.0) * QUADTREE_SIZE / fieldSize);
|
int x = (int) floor((pos.x() + fieldSize/2.0) * QUADTREE_SIZE / fieldSize);
|
||||||
if (x >= QUADTREE_SIZE) x = (QUADTREE_SIZE - 1);
|
if (x >= QUADTREE_SIZE) x = (QUADTREE_SIZE - 1);
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ using std::vector;
|
|||||||
|
|
||||||
class SGNewCloud;
|
class SGNewCloud;
|
||||||
|
|
||||||
|
namespace simgear
|
||||||
|
{
|
||||||
|
class EffectGeode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A layer of 3D clouds.
|
* A layer of 3D clouds.
|
||||||
*/
|
*/
|
||||||
@@ -99,7 +104,7 @@ public:
|
|||||||
void clear(void);
|
void clear(void);
|
||||||
|
|
||||||
// add one cloud, data is not copied, ownership given
|
// add one cloud, data is not copied, ownership given
|
||||||
void addCloud( SGVec3f& pos, SGNewCloud *cloud);
|
void addCloud( SGVec3f& pos, osg::ref_ptr<simgear::EffectGeode> cloud);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reposition the cloud layer at the specified origin and
|
* reposition the cloud layer at the specified origin and
|
||||||
|
|||||||
Reference in New Issue
Block a user