From Bjorn Blessing, "I got bored of the constant reports of “missing chunk 0xA08A” when reading 3ds-files. After a bit of research I discovered that this property is related to the advanced transparency settings for the material in 3D studio. In this case the falloff parameter. These controls affect the opacity falloff of a transparent material. And the property chooses whether falloff is in or out. I have added the property to the file reader BUT no changes are made to make this property propagate into the osgMaterial. But at least we get rid of this annoying error message."
This commit is contained in:
@@ -242,6 +242,7 @@ typedef struct Lib3dsMaterial {
|
||||
int soften; /* bool */
|
||||
int face_map; /* bool */
|
||||
int two_sided; /* Material visible from back */
|
||||
int transparency_falloff; /* Transparency falloff in/out */
|
||||
int map_decal; /* bool */
|
||||
int use_wire;
|
||||
int use_wire_abs;
|
||||
|
||||
@@ -86,6 +86,7 @@ static Lib3dsChunkTable lib3ds_chunk_table[] = {
|
||||
{CHK_MAT_SELF_ILPCT, "MAT_SELF_ILPCT"},
|
||||
{CHK_MAT_WIRE, "MAT_WIRE"},
|
||||
{CHK_MAT_FACEMAP, "MAT_FACEMAP"},
|
||||
{CHK_MAT_TRANSPARENCY_FALLOFF, "MAT_TRANSPARENCY_FALLOFF"},
|
||||
{CHK_MAT_PHONGSOFT, "MAT_PHONGSOFT"},
|
||||
{CHK_MAT_WIREABS, "MAT_WIREABS"},
|
||||
{CHK_MAT_WIRE_SIZE, "MAT_WIRE_SIZE"},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
by the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Thisprogram is distributed in the hope that it will be useful,
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
@@ -132,6 +132,7 @@ typedef enum Lib3dsChunks {
|
||||
CHK_MAT_SELF_ILPCT =0xA084,
|
||||
CHK_MAT_WIRE =0xA085,
|
||||
CHK_MAT_FACEMAP =0xA088,
|
||||
CHK_MAT_TRANSPARENCY_FALLOFF =0xA08A,
|
||||
CHK_MAT_PHONGSOFT =0xA08C,
|
||||
CHK_MAT_WIREABS =0xA08E,
|
||||
CHK_MAT_WIRE_SIZE =0xA087,
|
||||
|
||||
@@ -371,6 +371,11 @@ lib3ds_material_read(Lib3dsMaterial *material, Lib3dsIo *io) {
|
||||
break;
|
||||
}
|
||||
|
||||
case CHK_MAT_TRANSPARENCY_FALLOFF: {
|
||||
material->transparency_falloff = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case CHK_MAT_PHONGSOFT: {
|
||||
material->soften = TRUE;
|
||||
break;
|
||||
@@ -492,7 +497,7 @@ lib3ds_material_read(Lib3dsMaterial *material, Lib3dsIo *io) {
|
||||
material->autorefl_map_frame_step = lib3ds_io_read_intd(io);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
lib3ds_chunk_unknown(chunk, io);
|
||||
}
|
||||
@@ -821,6 +826,13 @@ lib3ds_material_write(Lib3dsMaterial *material, Lib3dsIo *io) {
|
||||
lib3ds_chunk_write(&c, io);
|
||||
}
|
||||
|
||||
if (material->transparency_falloff) { /*---- CHK_MAT_TRANSPARENCY_FALLOFF ----*/
|
||||
Lib3dsChunk c;
|
||||
c.chunk = CHK_MAT_TRANSPARENCY_FALLOFF;
|
||||
c.size = 6;
|
||||
lib3ds_chunk_write(&c, io);
|
||||
}
|
||||
|
||||
if (material->soften) { /*---- CHK_MAT_PHONGSOFT ----*/
|
||||
Lib3dsChunk c;
|
||||
c.chunk = CHK_MAT_PHONGSOFT;
|
||||
|
||||
Reference in New Issue
Block a user