Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
case 0xA010: // Indirekte Farbe case 0xA020: // Streufarbe case 0xA030: // Glanzfarbe // Farbe lesen printf("Farbe gefunden: "); if(tbProceedTo3DSChunk(pVFile, 0x0011)) [b]<----------[/b] pVFile->Seek(TB_VFSO_CURSOR, ChunkHeader.dwChunkSize - sizeof(tb3DSChunkHeader)); else { pVFile->Read(sizeof(BYTE), &r); pVFile->Read(sizeof(BYTE), &g); pVFile->Read(sizeof(BYTE), &b); // Farbe ins Fließkomma-RGB-Format umwandeln und speichern switch(ChunkHeader.wChunkID) { case 0xA010: pOut->AmbientColor = tbColor((BYTE)(r), g, b, 0); printf("ambient"); break; case 0xA020: pOut->DiffuseColor = tbColor((BYTE)(r), g, b, 255); printf("streufarbe"); break; case 0xA030: pOut->SpecularColor = tbColor((BYTE)(r), g, b, 0); printf("glanzfarbe"); break; } } break; |
Zitat
Subchunks of these material characteristics (level 3)
-----------------------------------------------------
0011 RGB1
0012 RGB2
Each of the three color chunks have 2 subchunks that defines their
colors. It seems that RGB1 is the color with a gamma (which one ?)
and RGB2 is the same color but as displayed on top of the material
editor window. But I'm not quite sure why there is two aspects
of the same color and what it does.
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
tbColor readColor(tbVFile* pVFile) { tb3DSChunkHeader ChunkHeader; float fColor[3]; BYTE byteColor[3]; pVFile->Read(sizeof(tb3DSChunkHeader), &ChunkHeader); switch (ChunkHeader.wChunkID) { case 0x0010: // rgb color float format case 0x0013: // rgb color float format (gamma corrected) pVFile->Read(sizeof(FLOAT), &fColor[0]); pVFile->Read(sizeof(FLOAT), &fColor[1]); pVFile->Read(sizeof(FLOAT), &fColor[2]); return tbColor(fColor[0], fColor[1], fColor[2]); case 0x0011: // rgb color byte format case 0x0012: // rgb color byte format (gamma corrected) pVFile->Read(sizeof(BYTE), &byteColor[0]); pVFile->Read(sizeof(BYTE), &byteColor[1]); pVFile->Read(sizeof(BYTE), &byteColor[2]); return tbColor(byteColor[0], byteColor[1], byteColor[2]); default: return tbColor(0.0f, 0.0f, 0.0f); } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
case 0xA010: // Indirekte Farbe // Farbe einlesen pOut->AmbientColor = readColor(pVFile); break; case 0xA020: // Streufarbe // Farbe einlesen pOut->DiffuseColor = readColor(pVFile); break; case 0xA030: // Glanzfarbe // Farbe einlesen pOut->SpecularColor = readColor(pVFile); break; |
Werbeanzeige