Skip to content

Commit bdc9762

Browse files
committed
make badly aligned KTX textures just a warning
1 parent 987984b commit bdc9762

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

src/osgPlugins/ktx/ReaderWriterKTX.cpp

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -186,26 +186,18 @@ osgDB::ReaderWriter::ReadResult ReaderWriterKTX::readKTXStream(std::istream& fin
186186
fin.ignore(0);
187187
}
188188

189-
// Check if this is an ASTC texture
190-
bool isASTCTexture = (header.glInternalFormat >= 0x93B0 && header.glInternalFormat <= 0x93DD);
191-
192-
// For ASTC textures, validate orientation
193-
if (isASTCTexture)
189+
// Warn about orientation issues
190+
if (ktxOrientation.empty())
194191
{
195-
// ASTC textures must have S=r,T=u orientation (OpenGL native, bottom-left origin)
196-
// If no KTXorientation is specified, we assume the default which is incorrect for ASTC
197-
if (ktxOrientation.empty())
198-
{
199-
OSG_WARN << "ASTC texture in KTX file lacks KTXorientation metadata. "
200-
<< "ASTC textures require explicit KTXorientation=S=r,T=u" << std::endl;
201-
return ReadResult(ReadResult::FILE_NOT_HANDLED);
202-
}
203-
else if (ktxOrientation != "S=r,T=u" && ktxOrientation != "S=r,T=u,R=o")
204-
{
205-
OSG_WARN << "ASTC texture in KTX file has incompatible orientation: " << ktxOrientation
206-
<< ". ASTC textures require KTXorientation=S=r,T=u" << std::endl;
207-
return ReadResult(ReadResult::FILE_NOT_HANDLED);
208-
}
192+
OSG_WARN << "KTX file lacks KTXorientation metadata. OpenSceneGraph expects KTX textures "
193+
<< "in OpenGL orientation (S=r,T=u). Textures created for DirectX/Vulkan (S=r,T=d) "
194+
<< "may appear vertically flipped." << std::endl;
195+
}
196+
else if (ktxOrientation == "S=r,T=d" || ktxOrientation == "S=r,T=d,R=i" || ktxOrientation == "S=r,T=d,R=o")
197+
{
198+
OSG_WARN << "KTX file has DirectX/Vulkan orientation (" << ktxOrientation
199+
<< "). OpenSceneGraph expects OpenGL orientation (S=r,T=u). "
200+
<< "Texture may appear vertically flipped." << std::endl;
209201
}
210202

211203
uint32_t imageSize;

0 commit comments

Comments
 (0)