diff --git a/simgear/scene/sky/CloudShaderGeometry.hxx b/simgear/scene/sky/CloudShaderGeometry.hxx index 6e6ac4d2..50225f65 100755 --- a/simgear/scene/sky/CloudShaderGeometry.hxx +++ b/simgear/scene/sky/CloudShaderGeometry.hxx @@ -42,12 +42,12 @@ class CloudShaderGeometry : public osg::Drawable { public: + const static unsigned int CLOUD_HEIGHT = 10; const static unsigned int TEXTURE_INDEX_X = 11; const static unsigned int TEXTURE_INDEX_Y = 12; const static unsigned int WIDTH = 13; const static unsigned int HEIGHT = 14; const static unsigned int SHADE = 15; - const static unsigned int CLOUD_HEIGHT = 16; CloudShaderGeometry() { diff --git a/simgear/scene/sky/cloudfield.cxx b/simgear/scene/sky/cloudfield.cxx index 0d225a0a..f901b0f4 100644 --- a/simgear/scene/sky/cloudfield.cxx +++ b/simgear/scene/sky/cloudfield.cxx @@ -157,14 +157,16 @@ SGCloudField::SGCloudField() : } } + int leafs = QUADTREE_SIZE / BRANCH_SIZE; + for (int x = 0; x < QUADTREE_SIZE; x++) { for (int y = 0; y < QUADTREE_SIZE; y++) { field_group[x][y]= new osg::Switch; field_group[x][y]->setName("3D cloud group"); // Work out where to put this node in the quad tree - int i = (int) (BRANCH_SIZE * ((float) x) / ((float) QUADTREE_SIZE)); - int j = (int) (BRANCH_SIZE * ((float) y) / ((float) QUADTREE_SIZE)); + int i = x / leafs; + int j = y / leafs; quad[i][j]->addChild(field_group[x][y].get(), 0.0f, 20000.0f); } }