mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
chore: properly read uv data from gltf
This commit is contained in:
parent
c261aef1ef
commit
26f4640194
@ -17,7 +17,28 @@ float HalfFloat::ToFloat(const half_float_t half)
|
|||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
half_float_t HalfFloat::ToHalf(float f)
|
half_float_t HalfFloat::ToHalf(const float f)
|
||||||
{
|
{
|
||||||
return 0;
|
half_float_t v3;
|
||||||
|
int v6;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
uint32_t u;
|
||||||
|
float f;
|
||||||
|
} result{};
|
||||||
|
|
||||||
|
result.f = f;
|
||||||
|
|
||||||
|
if (static_cast<int>((2 * result.u) ^ 0x80000000) >> 14 < 0x3FFF)
|
||||||
|
v6 = static_cast<int>((2 * result.u) ^ 0x80000000) >> 14;
|
||||||
|
else
|
||||||
|
v6 = 0x3FFF;
|
||||||
|
|
||||||
|
if (v6 > -16384)
|
||||||
|
v3 = static_cast<half_float_t>(v6);
|
||||||
|
else
|
||||||
|
v3 = 0xC000;
|
||||||
|
|
||||||
|
return (v3 & 0x3FFFu) | ((result.u >> 16) & 0xC000u);
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ namespace
|
|||||||
float coordinates[3];
|
float coordinates[3];
|
||||||
float normal[3];
|
float normal[3];
|
||||||
if (!positionAccessor->GetFloatVec3(vertexIndex, coordinates) || !normalAccessor->GetFloatVec3(vertexIndex, normal)
|
if (!positionAccessor->GetFloatVec3(vertexIndex, coordinates) || !normalAccessor->GetFloatVec3(vertexIndex, normal)
|
||||||
|| !colorAccessor->GetFloatVec4(vertexIndex, vertex.color) || !colorAccessor->GetFloatVec2(vertexIndex, vertex.uv)
|
|| !colorAccessor->GetFloatVec4(vertexIndex, vertex.color) || !uvAccessor->GetFloatVec2(vertexIndex, vertex.uv)
|
||||||
|| !jointsAccessor->GetUnsignedVec4(vertexIndex, joints) || !weightsAccessor->GetFloatVec4(vertexIndex, weights))
|
|| !jointsAccessor->GetUnsignedVec4(vertexIndex, joints) || !weightsAccessor->GetFloatVec4(vertexIndex, weights))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user