MCPcopy Create free account
hub / github.com/assimp/assimp / LoadLWO2TextureHeader

Method LoadLWO2TextureHeader

code/AssetLib/LWO/LWOMaterial.cpp:546–579  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

544
545// ------------------------------------------------------------------------------------------------
546void LWOImporter::LoadLWO2TextureHeader(unsigned int size, LWO::Texture &tex) {
547 LE_NCONST uint8_t *const end = mFileBuffer + size;
548
549 // get the ordinal string
550 GetS0(tex.ordinal, size);
551
552 // we could crash later if this is an empty string ...
553 if (!tex.ordinal.length()) {
554 ASSIMP_LOG_ERROR("LWO2: Ill-formed SURF.BLOK ordinal string");
555 tex.ordinal = "\x00";
556 }
557 while (true) {
558 if (mFileBuffer + 6 >= end) break;
559 const IFF::SubChunkHeader head = IFF::LoadSubChunk(mFileBuffer);
560
561 if (mFileBuffer + head.length > end)
562 throw DeadlyImportError("LWO2: Invalid texture header chunk length");
563
564 uint8_t *const next = mFileBuffer + head.length;
565 switch (head.type) {
566 case AI_LWO_CHAN:
567 tex.type = GetU4();
568 break;
569 case AI_LWO_ENAB:
570 tex.enabled = GetU2() ? true : false;
571 break;
572 case AI_LWO_OPAC:
573 tex.blendType = (Texture::BlendType)GetU2();
574 tex.mStrength = GetF4();
575 break;
576 }
577 mFileBuffer = next;
578 }
579}
580
581// ------------------------------------------------------------------------------------------------
582void LWOImporter::LoadLWO2TextureBlock(LE_NCONST IFF::SubChunkHeader *head, unsigned int size) {

Callers

nothing calls this directly

Calls 2

LoadSubChunkFunction · 0.85
DeadlyImportErrorFunction · 0.85

Tested by

no test coverage detected