Use normalized short for animated texture update
It should allow to have the maximum possible smooth animation texture_trans_x,y is fmoded so it's guaranteed to be -1.0 to 1.0
This commit is contained in:
parent
7aaac81d0a
commit
c3d0db9856
@ -133,7 +133,7 @@ SPDynamicDrawCall::SPDynamicDrawCall(scene::E_PRIMITIVE_TYPE pt,
|
|||||||
glVertexAttribDivisorARB(10, 1);
|
glVertexAttribDivisorARB(10, 1);
|
||||||
// Texture translation
|
// Texture translation
|
||||||
glEnableVertexAttribArray(11);
|
glEnableVertexAttribArray(11);
|
||||||
glVertexAttribPointer(11, 2, GL_HALF_FLOAT, GL_FALSE, 32, (void*)24);
|
glVertexAttribPointer(11, 2, GL_SHORT, GL_TRUE, 32, (void*)24);
|
||||||
glVertexAttribDivisorARB(11, 1);
|
glVertexAttribDivisorARB(11, 1);
|
||||||
// Misc data (skinning offset and hue change)
|
// Misc data (skinning offset and hue change)
|
||||||
glEnableVertexAttribArray(12);
|
glEnableVertexAttribArray(12);
|
||||||
|
@ -71,7 +71,11 @@ public:
|
|||||||
short s[4] = { toFloat16(scale.X), toFloat16(scale.Y),
|
short s[4] = { toFloat16(scale.X), toFloat16(scale.Y),
|
||||||
toFloat16(scale.Z), toFloat16(rotation.W) };
|
toFloat16(scale.Z), toFloat16(rotation.W) };
|
||||||
memcpy(m_data + 16, s, 8);
|
memcpy(m_data + 16, s, 8);
|
||||||
short tm[2] = { toFloat16(texture_trans_x), toFloat16(texture_trans_y) };
|
short tm[2] =
|
||||||
|
{
|
||||||
|
short(texture_trans_x * 32767.0f),
|
||||||
|
short(texture_trans_y * 32767.0f)
|
||||||
|
};
|
||||||
memcpy(m_data + 24, tm, 4);
|
memcpy(m_data + 24, tm, 4);
|
||||||
memcpy(m_data + 28, &skinning_offset, 2);
|
memcpy(m_data + 28, &skinning_offset, 2);
|
||||||
short hue_packed = short(core::clamp(int(hue * 100.0f), 0, 100));
|
short hue_packed = short(core::clamp(int(hue * 100.0f), 0, 100));
|
||||||
|
@ -353,7 +353,7 @@ void SPMeshBuffer::recreateVAO(unsigned i)
|
|||||||
glVertexAttribDivisorARB(10, 1);
|
glVertexAttribDivisorARB(10, 1);
|
||||||
// Texture translation
|
// Texture translation
|
||||||
glEnableVertexAttribArray(11);
|
glEnableVertexAttribArray(11);
|
||||||
glVertexAttribPointer(11, 2, GL_HALF_FLOAT, GL_FALSE, 32, (void*)24);
|
glVertexAttribPointer(11, 2, GL_SHORT, GL_TRUE, 32, (void*)24);
|
||||||
glVertexAttribDivisorARB(11, 1);
|
glVertexAttribDivisorARB(11, 1);
|
||||||
// Misc data (skinning offset and hue change)
|
// Misc data (skinning offset and hue change)
|
||||||
glEnableVertexAttribArray(12);
|
glEnableVertexAttribArray(12);
|
||||||
|
Loading…
Reference in New Issue
Block a user