[bug?] Painting multiple textures

Dale_ee

05-10-2006 12:37:33

When painting multiple textures 'currChannel' variable isn't set to 0 after iteration. So this raises exception.


unsigned int currChannel = 0;
for (unsigned int k = 0; k < mNumTexture; k++)
{
uchar * const BaseData = mImages[k].getData();
assert (BaseData && "PagingLandScapeTexture::paint()");
const unsigned int currImagePos = imagePos * mNumChannelperTexture[k];
assert (currImagePos < mImages[k].getSize ());
assert (mNumChannelperTexture[k]*8 == mImages[k].getBPP ());

for (unsigned int j = 0; j < mNumChannelperTexture[k]; j++)
{
BaseData[ currImagePos + j ] =
static_cast <uchar> (
((*channelModifList)[currChannel]) * paintForce * bScale
+ BaseData[ currImagePos + j ] * invPaintForce
);
currChannel++;
}
doTextureNeedUpdate[k] = true;
}

tuan kuranes

05-10-2006 12:58:26

Seems fair. did you tested it and it works for you when fixed ?

Dale_ee

05-10-2006 13:01:33

Yep, but I had to slightly modify code, because I want to paint only one texture per turn.

tuan kuranes

16-10-2006 12:45:52

currChannel shouldn't be set to 0 after iteration.
currChannel iterates over all channels paintable independantlt of channel location (ie coverage or alpha maps)
Perhaps you have a channel count wrong there, or plsm2 wrongly counts them