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:
parent
4ed559d5a9
commit
1afbda9833
@ -267,12 +267,12 @@ public:
|
|||||||
SGVec2f texCoord = a*t0 + b*t1 + c*t2;
|
SGVec2f texCoord = a*t0 + b*t1 + c*t2;
|
||||||
|
|
||||||
// Check this random point against the object mask
|
// Check this random point against the object mask
|
||||||
// red channel.
|
// blue channel.
|
||||||
osg::Image* img = object_mask->getImage();
|
osg::Image* img = object_mask->getImage();
|
||||||
unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
|
unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
|
||||||
unsigned int y = (int) (img->t() * texCoord.y()) % img->t();
|
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);
|
points.push_back(randomPoint);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -196,12 +196,12 @@ public:
|
|||||||
SGVec2f texCoord = a*t0 + b*t1 + c*t2;
|
SGVec2f texCoord = a*t0 + b*t1 + c*t2;
|
||||||
|
|
||||||
// Check this random point against the object mask
|
// Check this random point against the object mask
|
||||||
// red channel.
|
// blue channel.
|
||||||
osg::Image* img = object_mask->getImage();
|
osg::Image* img = object_mask->getImage();
|
||||||
unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
|
unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
|
||||||
unsigned int y = (int) (img->t() * texCoord.y()) % img->t();
|
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);
|
points.push_back(randomPoint);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user