diff --git a/src/osgPlugins/3ds/lib3ds/lib3ds.h b/src/osgPlugins/3ds/lib3ds/lib3ds.h index f4dfde01a..e3f4d171f 100644 --- a/src/osgPlugins/3ds/lib3ds/lib3ds.h +++ b/src/osgPlugins/3ds/lib3ds/lib3ds.h @@ -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; diff --git a/src/osgPlugins/3ds/lib3ds/lib3ds_chunktable.c b/src/osgPlugins/3ds/lib3ds/lib3ds_chunktable.c index dcf13084e..8b1a42cab 100644 --- a/src/osgPlugins/3ds/lib3ds/lib3ds_chunktable.c +++ b/src/osgPlugins/3ds/lib3ds/lib3ds_chunktable.c @@ -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"}, diff --git a/src/osgPlugins/3ds/lib3ds/lib3ds_impl.h b/src/osgPlugins/3ds/lib3ds/lib3ds_impl.h index b3c90c17f..b79c2c16e 100644 --- a/src/osgPlugins/3ds/lib3ds/lib3ds_impl.h +++ b/src/osgPlugins/3ds/lib3ds/lib3ds_impl.h @@ -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, diff --git a/src/osgPlugins/3ds/lib3ds/lib3ds_material.c b/src/osgPlugins/3ds/lib3ds/lib3ds_material.c index bb5ffc803..d3ed4988b 100644 --- a/src/osgPlugins/3ds/lib3ds/lib3ds_material.c +++ b/src/osgPlugins/3ds/lib3ds/lib3ds_material.c @@ -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;