WS20: Object mask bug fix for random lights

The random lights placement algorithm was using the incorrect channel
from the object mask image, (red instead of blue as mentioned in
Docs/README.materials). This commit rectifies the mismatch.
This commit is contained in:
Fahim Imaduddin Dalvi
2022-01-17 22:13:38 +03:00
committed by Automatic Release Builder
parent 234abdf85c
commit e87a671942
2 changed files with 4 additions and 4 deletions

View File

@@ -267,12 +267,12 @@ public:
SGVec2f texCoord = a*t0 + b*t1 + c*t2;
// Check this random point against the object mask
// red channel.
// blue channel.
osg::Image* img = object_mask->getImage();
unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
unsigned int y = (int) (img->t() * texCoord.y()) % img->t();
if (mt_rand(&seed) < img->getColor(x, y).r()) {
if (mt_rand(&seed) < img->getColor(x, y).b()) {
points.push_back(randomPoint);
}
} else {

View File

@@ -192,12 +192,12 @@ public:
SGVec2f texCoord = a*t0 + b*t1 + c*t2;
// Check this random point against the object mask
// red channel.
// blue channel.
osg::Image* img = object_mask->getImage();
unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
unsigned int y = (int) (img->t() * texCoord.y()) % img->t();
if (mt_rand(&seed) < img->getColor(x, y).r()) {
if (mt_rand(&seed) < img->getColor(x, y).b()) {
points.push_back(randomPoint);
}
} else {