Fix circular/modulo arithmetic (Refs #93)
This commit is contained in:
parent
1912101fe8
commit
8fbfb7c22b
1 changed files with 2 additions and 10 deletions
|
|
@ -450,17 +450,9 @@ public:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeMatCapIndex(uint32_t delta)
|
void changeMatCapIndex(int32_t delta)
|
||||||
{
|
{
|
||||||
uboVS.texIndex += delta;
|
uboVS.texIndex = (uboVS.texIndex + delta + textures.matCapArray.layerCount) % textures.matCapArray.layerCount;
|
||||||
if (uboVS.texIndex < 0)
|
|
||||||
{
|
|
||||||
uboVS.texIndex = textures.matCapArray.layerCount-1;
|
|
||||||
}
|
|
||||||
if (uboVS.texIndex >= textures.matCapArray.layerCount)
|
|
||||||
{
|
|
||||||
uboVS.texIndex = 0;
|
|
||||||
}
|
|
||||||
updateUniformBuffers();
|
updateUniformBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue