Exemple #1
0
 static void lib3ds_chunk_unknown(Lib3dsChunks chunk, Lib3dsIo io)
 {
     if (io.log_func != null)
     {
         lib3ds_io_log(io, Lib3dsLogLevel.LIB3DS_LOG_WARN, "Unknown Chunk: {0} (0x{1:X})", lib3ds_chunk_name(chunk), chunk);
     }
 }
		static void lib3ds_chunk_read_start(Lib3dsChunk c, Lib3dsChunks chunk, Lib3dsIo io)
		{
			Debug.Assert(c!=null);
			Debug.Assert(io!=null);
			lib3ds_chunk_read(c, io);
			if((chunk!=0)&&(c.chunk!=chunk)) lib3ds_io_log(io, Lib3dsLogLevel.LIB3DS_LOG_ERROR, "Unexpected chunk found.");
			io.log_indent++;
		}
Exemple #3
0
 static void lib3ds_chunk_read_start(Lib3dsChunk c, Lib3dsChunks chunk, Lib3dsIo io)
 {
     Debug.Assert(c != null);
     Debug.Assert(io != null);
     lib3ds_chunk_read(c, io);
     if ((chunk != 0) && (c.chunk != chunk))
     {
         lib3ds_io_log(io, Lib3dsLogLevel.LIB3DS_LOG_ERROR, "Unexpected chunk found.");
     }
     io.log_indent++;
 }
        static void texture_map_write(Lib3dsChunks chunk, Lib3dsTextureMap map, Lib3dsIo io)
        {
            if (map.name == null || map.name.Length == 0)
            {
                return;
            }
            Lib3dsChunk c_chunk = new Lib3dsChunk();

            c_chunk.chunk = chunk;
            lib3ds_chunk_write_start(c_chunk, io);

            int_percentage_write(map.percent, io);

            {             // ---- CHK_MAT_MAPNAME ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAPNAME;
                c.size  = 6 + (uint)map.name.Length + 1;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_string(io, map.name);
            }

            {             // ---- CHK_MAT_MAP_TILING ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_TILING;
                c.size  = 8;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_word(io, (ushort)map.flags);
            }

            {             // ---- CHK_MAT_MAP_TEXBLUR ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_TEXBLUR;
                c.size  = 10;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_float(io, map.blur);
            }

            {             // ---- CHK_MAT_MAP_USCALE ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_USCALE;
                c.size  = 10;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_float(io, map.scale[0]);
            }

            {             // ---- CHK_MAT_MAP_VSCALE ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_VSCALE;
                c.size  = 10;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_float(io, map.scale[1]);
            }

            {             // ---- CHK_MAT_MAP_UOFFSET ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_UOFFSET;
                c.size  = 10;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_float(io, map.offset[0]);
            }

            {             // ---- CHK_MAT_MAP_VOFFSET ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_VOFFSET;
                c.size  = 10;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_float(io, map.offset[1]);
            }

            {             // ---- CHK_MAT_MAP_ANG ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_ANG;
                c.size  = 10;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_float(io, map.rotation);
            }

            {             // ---- CHK_MAT_MAP_COL1 ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_COL1;
                c.size  = 9;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_1[0] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_1[1] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_1[2] + 0.5));
            }

            {             // ---- CHK_MAT_MAP_COL2 ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_COL2;
                c.size  = 9;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_2[0] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_2[1] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_2[2] + 0.5));
            }

            {             // ---- CHK_MAT_MAP_RCOL ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_RCOL;
                c.size  = 9;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_r[0] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_r[1] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_r[2] + 0.5));
            }

            {             // ---- CHK_MAT_MAP_GCOL ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_GCOL;
                c.size  = 9;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_g[0] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_g[1] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_g[2] + 0.5));
            }

            {             // ---- CHK_MAT_MAP_BCOL ----
                Lib3dsChunk c = new Lib3dsChunk();
                c.chunk = Lib3dsChunks.CHK_MAT_MAP_BCOL;
                c.size  = 9;
                lib3ds_chunk_write(c, io);
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_b[0] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_b[1] + 0.5));
                lib3ds_io_write_byte(io, (byte)Math.Floor(255.0 * map.tint_b[2] + 0.5));
            }

            lib3ds_chunk_write_end(c_chunk, io);
        }
		static string lib3ds_chunk_name(Lib3dsChunks chunk)
		{
			switch(chunk)
			{
				case Lib3dsChunks.CHK_NULL_CHUNK: return "NULL_CHUNK";
				case Lib3dsChunks.CHK_M3DMAGIC: return "M3DMAGIC";
				case Lib3dsChunks.CHK_SMAGIC: return "SMAGIC";
				case Lib3dsChunks.CHK_LMAGIC: return "LMAGIC";
				case Lib3dsChunks.CHK_MLIBMAGIC: return "MLIBMAGIC";
				case Lib3dsChunks.CHK_MATMAGIC: return "MATMAGIC";
				case Lib3dsChunks.CHK_CMAGIC: return "CMAGIC";
				case Lib3dsChunks.CHK_M3D_VERSION: return "M3D_VERSION";
				case Lib3dsChunks.CHK_M3D_KFVERSION: return "M3D_KFVERSION";
				case Lib3dsChunks.CHK_COLOR_F: return "COLOR_F";
				case Lib3dsChunks.CHK_COLOR_24: return "COLOR_24";
				case Lib3dsChunks.CHK_LIN_COLOR_24: return "LIN_COLOR_24";
				case Lib3dsChunks.CHK_LIN_COLOR_F: return "LIN_COLOR_F";
				case Lib3dsChunks.CHK_INT_PERCENTAGE: return "INT_PERCENTAGE";
				case Lib3dsChunks.CHK_FLOAT_PERCENTAGE: return "FLOAT_PERCENTAGE";
				case Lib3dsChunks.CHK_MDATA: return "MDATA";
				case Lib3dsChunks.CHK_MESH_VERSION: return "MESH_VERSION";
				case Lib3dsChunks.CHK_MASTER_SCALE: return "MASTER_SCALE";
				case Lib3dsChunks.CHK_LO_SHADOW_BIAS: return "LO_SHADOW_BIAS";
				case Lib3dsChunks.CHK_HI_SHADOW_BIAS: return "HI_SHADOW_BIAS";
				case Lib3dsChunks.CHK_SHADOW_MAP_SIZE: return "SHADOW_MAP_SIZE";
				case Lib3dsChunks.CHK_SHADOW_SAMPLES: return "SHADOW_SAMPLES";
				case Lib3dsChunks.CHK_SHADOW_RANGE: return "SHADOW_RANGE";
				case Lib3dsChunks.CHK_SHADOW_FILTER: return "SHADOW_FILTER";
				case Lib3dsChunks.CHK_RAY_BIAS: return "RAY_BIAS";
				case Lib3dsChunks.CHK_O_CONSTS: return "O_CONSTS";
				case Lib3dsChunks.CHK_AMBIENT_LIGHT: return "AMBIENT_LIGHT";
				case Lib3dsChunks.CHK_BIT_MAP: return "BIT_MAP";
				case Lib3dsChunks.CHK_SOLID_BGND: return "SOLID_BGND";
				case Lib3dsChunks.CHK_V_GRADIENT: return "V_GRADIENT";
				case Lib3dsChunks.CHK_USE_BIT_MAP: return "USE_BIT_MAP";
				case Lib3dsChunks.CHK_USE_SOLID_BGND: return "USE_SOLID_BGND";
				case Lib3dsChunks.CHK_USE_V_GRADIENT: return "USE_V_GRADIENT";
				case Lib3dsChunks.CHK_FOG: return "FOG";
				case Lib3dsChunks.CHK_FOG_BGND: return "FOG_BGND";
				case Lib3dsChunks.CHK_LAYER_FOG: return "LAYER_FOG";
				case Lib3dsChunks.CHK_DISTANCE_CUE: return "DISTANCE_CUE";
				case Lib3dsChunks.CHK_DCUE_BGND: return "DCUE_BGND";
				case Lib3dsChunks.CHK_USE_FOG: return "USE_FOG";
				case Lib3dsChunks.CHK_USE_LAYER_FOG: return "USE_LAYER_FOG";
				case Lib3dsChunks.CHK_USE_DISTANCE_CUE: return "USE_DISTANCE_CUE";
				case Lib3dsChunks.CHK_MAT_ENTRY: return "MAT_ENTRY";
				case Lib3dsChunks.CHK_MAT_NAME: return "MAT_NAME";
				case Lib3dsChunks.CHK_MAT_AMBIENT: return "MAT_AMBIENT";
				case Lib3dsChunks.CHK_MAT_DIFFUSE: return "MAT_DIFFUSE";
				case Lib3dsChunks.CHK_MAT_SPECULAR: return "MAT_SPECULAR";
				case Lib3dsChunks.CHK_MAT_SHININESS: return "MAT_SHININESS";
				case Lib3dsChunks.CHK_MAT_SHIN2PCT: return "MAT_SHIN2PCT";
				case Lib3dsChunks.CHK_MAT_TRANSPARENCY: return "MAT_TRANSPARENCY";
				case Lib3dsChunks.CHK_MAT_XPFALL: return "MAT_XPFALL";
				case Lib3dsChunks.CHK_MAT_USE_XPFALL: return "MAT_USE_XPFALL";
				case Lib3dsChunks.CHK_MAT_REFBLUR: return "MAT_REFBLUR";
				case Lib3dsChunks.CHK_MAT_SHADING: return "MAT_SHADING";
				case Lib3dsChunks.CHK_MAT_USE_REFBLUR: return "MAT_USE_REFBLUR";
				case Lib3dsChunks.CHK_MAT_SELF_ILLUM: return "MAT_SELF_ILLUM";
				case Lib3dsChunks.CHK_MAT_TWO_SIDE: return "MAT_TWO_SIDE";
				case Lib3dsChunks.CHK_MAT_DECAL: return "MAT_DECAL";
				case Lib3dsChunks.CHK_MAT_ADDITIVE: return "MAT_ADDITIVE";
				case Lib3dsChunks.CHK_MAT_SELF_ILPCT: return "MAT_SELF_ILPCT";
				case Lib3dsChunks.CHK_MAT_WIRE: return "MAT_WIRE";
				case Lib3dsChunks.CHK_MAT_FACEMAP: return "MAT_FACEMAP";
				case Lib3dsChunks.CHK_MAT_PHONGSOFT: return "MAT_PHONGSOFT";
				case Lib3dsChunks.CHK_MAT_WIREABS: return "MAT_WIREABS";
				case Lib3dsChunks.CHK_MAT_WIRE_SIZE: return "MAT_WIRE_SIZE";
				case Lib3dsChunks.CHK_MAT_TEXMAP: return "MAT_TEXMAP";
				case Lib3dsChunks.CHK_MAT_SXP_TEXT_DATA: return "MAT_SXP_TEXT_DATA";
				case Lib3dsChunks.CHK_MAT_TEXMASK: return "MAT_TEXMASK";
				case Lib3dsChunks.CHK_MAT_SXP_TEXTMASK_DATA: return "MAT_SXP_TEXTMASK_DATA";
				case Lib3dsChunks.CHK_MAT_TEX2MAP: return "MAT_TEX2MAP";
				case Lib3dsChunks.CHK_MAT_SXP_TEXT2_DATA: return "MAT_SXP_TEXT2_DATA";
				case Lib3dsChunks.CHK_MAT_TEX2MASK: return "MAT_TEX2MASK";
				case Lib3dsChunks.CHK_MAT_SXP_TEXT2MASK_DATA: return "MAT_SXP_TEXT2MASK_DATA";
				case Lib3dsChunks.CHK_MAT_OPACMAP: return "MAT_OPACMAP";
				case Lib3dsChunks.CHK_MAT_SXP_OPAC_DATA: return "MAT_SXP_OPAC_DATA";
				case Lib3dsChunks.CHK_MAT_OPACMASK: return "MAT_OPACMASK";
				case Lib3dsChunks.CHK_MAT_SXP_OPACMASK_DATA: return "MAT_SXP_OPACMASK_DATA";
				case Lib3dsChunks.CHK_MAT_BUMPMAP: return "MAT_BUMPMAP";
				case Lib3dsChunks.CHK_MAT_SXP_BUMP_DATA: return "MAT_SXP_BUMP_DATA";
				case Lib3dsChunks.CHK_MAT_BUMPMASK: return "MAT_BUMPMASK";
				case Lib3dsChunks.CHK_MAT_SXP_BUMPMASK_DATA: return "MAT_SXP_BUMPMASK_DATA";
				case Lib3dsChunks.CHK_MAT_SPECMAP: return "MAT_SPECMAP";
				case Lib3dsChunks.CHK_MAT_SXP_SPEC_DATA: return "MAT_SXP_SPEC_DATA";
				case Lib3dsChunks.CHK_MAT_SPECMASK: return "MAT_SPECMASK";
				case Lib3dsChunks.CHK_MAT_SXP_SPECMASK_DATA: return "MAT_SXP_SPECMASK_DATA";
				case Lib3dsChunks.CHK_MAT_SHINMAP: return "MAT_SHINMAP";
				case Lib3dsChunks.CHK_MAT_SXP_SHIN_DATA: return "MAT_SXP_SHIN_DATA";
				case Lib3dsChunks.CHK_MAT_SHINMASK: return "MAT_SHINMASK";
				case Lib3dsChunks.CHK_MAT_SXP_SHINMASK_DATA: return "MAT_SXP_SHINMASK_DATA";
				case Lib3dsChunks.CHK_MAT_SELFIMAP: return "MAT_SELFIMAP";
				case Lib3dsChunks.CHK_MAT_SXP_SELFI_DATA: return "MAT_SXP_SELFI_DATA";
				case Lib3dsChunks.CHK_MAT_SELFIMASK: return "MAT_SELFIMASK";
				case Lib3dsChunks.CHK_MAT_SXP_SELFIMASK_DATA: return "MAT_SXP_SELFIMASK_DATA";
				case Lib3dsChunks.CHK_MAT_REFLMAP: return "MAT_REFLMAP";
				case Lib3dsChunks.CHK_MAT_REFLMASK: return "MAT_REFLMASK";
				case Lib3dsChunks.CHK_MAT_SXP_REFLMASK_DATA: return "MAT_SXP_REFLMASK_DATA";
				case Lib3dsChunks.CHK_MAT_ACUBIC: return "MAT_ACUBIC";
				case Lib3dsChunks.CHK_MAT_MAPNAME: return "MAT_MAPNAME";
				case Lib3dsChunks.CHK_MAT_MAP_TILING: return "MAT_MAP_TILING";
				case Lib3dsChunks.CHK_MAT_MAP_TEXBLUR: return "MAT_MAP_TEXBLUR";
				case Lib3dsChunks.CHK_MAT_MAP_USCALE: return "MAT_MAP_USCALE";
				case Lib3dsChunks.CHK_MAT_MAP_VSCALE: return "MAT_MAP_VSCALE";
				case Lib3dsChunks.CHK_MAT_MAP_UOFFSET: return "MAT_MAP_UOFFSET";
				case Lib3dsChunks.CHK_MAT_MAP_VOFFSET: return "MAT_MAP_VOFFSET";
				case Lib3dsChunks.CHK_MAT_MAP_ANG: return "MAT_MAP_ANG";
				case Lib3dsChunks.CHK_MAT_MAP_COL1: return "MAT_MAP_COL1";
				case Lib3dsChunks.CHK_MAT_MAP_COL2: return "MAT_MAP_COL2";
				case Lib3dsChunks.CHK_MAT_MAP_RCOL: return "MAT_MAP_RCOL";
				case Lib3dsChunks.CHK_MAT_MAP_GCOL: return "MAT_MAP_GCOL";
				case Lib3dsChunks.CHK_MAT_MAP_BCOL: return "MAT_MAP_BCOL";
				case Lib3dsChunks.CHK_NAMED_OBJECT: return "NAMED_OBJECT";
				case Lib3dsChunks.CHK_N_DIRECT_LIGHT: return "N_DIRECT_LIGHT";
				case Lib3dsChunks.CHK_DL_OFF: return "DL_OFF";
				case Lib3dsChunks.CHK_DL_OUTER_RANGE: return "DL_OUTER_RANGE";
				case Lib3dsChunks.CHK_DL_INNER_RANGE: return "DL_INNER_RANGE";
				case Lib3dsChunks.CHK_DL_MULTIPLIER: return "DL_MULTIPLIER";
				case Lib3dsChunks.CHK_DL_EXCLUDE: return "DL_EXCLUDE";
				case Lib3dsChunks.CHK_DL_ATTENUATE: return "DL_ATTENUATE";
				case Lib3dsChunks.CHK_DL_SPOTLIGHT: return "DL_SPOTLIGHT";
				case Lib3dsChunks.CHK_DL_SPOT_ROLL: return "DL_SPOT_ROLL";
				case Lib3dsChunks.CHK_DL_SHADOWED: return "DL_SHADOWED";
				case Lib3dsChunks.CHK_DL_LOCAL_SHADOW2: return "DL_LOCAL_SHADOW2";
				case Lib3dsChunks.CHK_DL_SEE_CONE: return "DL_SEE_CONE";
				case Lib3dsChunks.CHK_DL_SPOT_RECTANGULAR: return "DL_SPOT_RECTANGULAR";
				case Lib3dsChunks.CHK_DL_SPOT_ASPECT: return "DL_SPOT_ASPECT";
				case Lib3dsChunks.CHK_DL_SPOT_PROJECTOR: return "DL_SPOT_PROJECTOR";
				case Lib3dsChunks.CHK_DL_SPOT_OVERSHOOT: return "DL_SPOT_OVERSHOOT";
				case Lib3dsChunks.CHK_DL_RAY_BIAS: return "DL_RAY_BIAS";
				case Lib3dsChunks.CHK_DL_RAYSHAD: return "DL_RAYSHAD";
				case Lib3dsChunks.CHK_N_CAMERA: return "N_CAMERA";
				case Lib3dsChunks.CHK_CAM_SEE_CONE: return "CAM_SEE_CONE";
				case Lib3dsChunks.CHK_CAM_RANGES: return "CAM_RANGES";
				case Lib3dsChunks.CHK_OBJ_HIDDEN: return "OBJ_HIDDEN";
				case Lib3dsChunks.CHK_OBJ_VIS_LOFTER: return "OBJ_VIS_LOFTER";
				case Lib3dsChunks.CHK_OBJ_DOESNT_CAST: return "OBJ_DOESNT_CAST";
				case Lib3dsChunks.CHK_OBJ_DONT_RCVSHADOW: return "OBJ_DONT_RCVSHADOW";
				case Lib3dsChunks.CHK_OBJ_MATTE: return "OBJ_MATTE";
				case Lib3dsChunks.CHK_OBJ_FAST: return "OBJ_FAST";
				case Lib3dsChunks.CHK_OBJ_PROCEDURAL: return "OBJ_PROCEDURAL";
				case Lib3dsChunks.CHK_OBJ_FROZEN: return "OBJ_FROZEN";
				case Lib3dsChunks.CHK_N_TRI_OBJECT: return "N_TRI_OBJECT";
				case Lib3dsChunks.CHK_POINT_ARRAY: return "POINT_ARRAY";
				case Lib3dsChunks.CHK_POINT_FLAG_ARRAY: return "POINT_FLAG_ARRAY";
				case Lib3dsChunks.CHK_FACE_ARRAY: return "FACE_ARRAY";
				case Lib3dsChunks.CHK_MSH_MAT_GROUP: return "MSH_MAT_GROUP";
				case Lib3dsChunks.CHK_SMOOTH_GROUP: return "SMOOTH_GROUP";
				case Lib3dsChunks.CHK_MSH_BOXMAP: return "MSH_BOXMAP";
				case Lib3dsChunks.CHK_TEX_VERTS: return "TEX_VERTS";
				case Lib3dsChunks.CHK_MESH_MATRIX: return "MESH_MATRIX";
				case Lib3dsChunks.CHK_MESH_COLOR: return "MESH_COLOR";
				case Lib3dsChunks.CHK_MESH_TEXTURE_INFO: return "MESH_TEXTURE_INFO";
				case Lib3dsChunks.CHK_KFDATA: return "KFDATA";
				case Lib3dsChunks.CHK_KFHDR: return "KFHDR";
				case Lib3dsChunks.CHK_KFSEG: return "KFSEG";
				case Lib3dsChunks.CHK_KFCURTIME: return "KFCURTIME";
				case Lib3dsChunks.CHK_AMBIENT_NODE_TAG: return "AMBIENT_NODE_TAG";
				case Lib3dsChunks.CHK_OBJECT_NODE_TAG: return "OBJECT_NODE_TAG";
				case Lib3dsChunks.CHK_CAMERA_NODE_TAG: return "CAMERA_NODE_TAG";
				case Lib3dsChunks.CHK_TARGET_NODE_TAG: return "TARGET_NODE_TAG";
				case Lib3dsChunks.CHK_LIGHT_NODE_TAG: return "LIGHT_NODE_TAG";
				case Lib3dsChunks.CHK_L_TARGET_NODE_TAG: return "L_TARGET_NODE_TAG";
				case Lib3dsChunks.CHK_SPOTLIGHT_NODE_TAG: return "SPOTLIGHT_NODE_TAG";
				case Lib3dsChunks.CHK_NODE_ID: return "NODE_ID";
				case Lib3dsChunks.CHK_NODE_HDR: return "NODE_HDR";
				case Lib3dsChunks.CHK_PIVOT: return "PIVOT";
				case Lib3dsChunks.CHK_INSTANCE_NAME: return "INSTANCE_NAME";
				case Lib3dsChunks.CHK_MORPH_SMOOTH: return "MORPH_SMOOTH";
				case Lib3dsChunks.CHK_BOUNDBOX: return "BOUNDBOX";
				case Lib3dsChunks.CHK_POS_TRACK_TAG: return "POS_TRACK_TAG";
				case Lib3dsChunks.CHK_COL_TRACK_TAG: return "COL_TRACK_TAG";
				case Lib3dsChunks.CHK_ROT_TRACK_TAG: return "ROT_TRACK_TAG";
				case Lib3dsChunks.CHK_SCL_TRACK_TAG: return "SCL_TRACK_TAG";
				case Lib3dsChunks.CHK_MORPH_TRACK_TAG: return "MORPH_TRACK_TAG";
				case Lib3dsChunks.CHK_FOV_TRACK_TAG: return "FOV_TRACK_TAG";
				case Lib3dsChunks.CHK_ROLL_TRACK_TAG: return "ROLL_TRACK_TAG";
				case Lib3dsChunks.CHK_HOT_TRACK_TAG: return "HOT_TRACK_TAG";
				case Lib3dsChunks.CHK_FALL_TRACK_TAG: return "FALL_TRACK_TAG";
				case Lib3dsChunks.CHK_HIDE_TRACK_TAG: return "HIDE_TRACK_TAG";
				case Lib3dsChunks.CHK_POLY_2D: return "POLY_2D";
				case Lib3dsChunks.CHK_SHAPE_OK: return "SHAPE_OK";
				case Lib3dsChunks.CHK_SHAPE_NOT_OK: return "SHAPE_NOT_OK";
				case Lib3dsChunks.CHK_SHAPE_HOOK: return "SHAPE_HOOK";
				case Lib3dsChunks.CHK_PATH_3D: return "PATH_3D";
				case Lib3dsChunks.CHK_PATH_MATRIX: return "PATH_MATRIX";
				case Lib3dsChunks.CHK_SHAPE_2D: return "SHAPE_2D";
				case Lib3dsChunks.CHK_M_SCALE: return "M_SCALE";
				case Lib3dsChunks.CHK_M_TWIST: return "M_TWIST";
				case Lib3dsChunks.CHK_M_TEETER: return "M_TEETER";
				case Lib3dsChunks.CHK_M_FIT: return "M_FIT";
				case Lib3dsChunks.CHK_M_BEVEL: return "M_BEVEL";
				case Lib3dsChunks.CHK_XZ_CURVE: return "XZ_CURVE";
				case Lib3dsChunks.CHK_YZ_CURVE: return "YZ_CURVE";
				case Lib3dsChunks.CHK_INTERPCT: return "INTERPCT";
				case Lib3dsChunks.CHK_DEFORM_LIMIT: return "DEFORM_LIMIT";
				case Lib3dsChunks.CHK_USE_CONTOUR: return "USE_CONTOUR";
				case Lib3dsChunks.CHK_USE_TWEEN: return "USE_TWEEN";
				case Lib3dsChunks.CHK_USE_SCALE: return "USE_SCALE";
				case Lib3dsChunks.CHK_USE_TWIST: return "USE_TWIST";
				case Lib3dsChunks.CHK_USE_TEETER: return "USE_TEETER";
				case Lib3dsChunks.CHK_USE_FIT: return "USE_FIT";
				case Lib3dsChunks.CHK_USE_BEVEL: return "USE_BEVEL";
				case Lib3dsChunks.CHK_DEFAULT_VIEW: return "DEFAULT_VIEW";
				case Lib3dsChunks.CHK_VIEW_TOP: return "VIEW_TOP";
				case Lib3dsChunks.CHK_VIEW_BOTTOM: return "VIEW_BOTTOM";
				case Lib3dsChunks.CHK_VIEW_LEFT: return "VIEW_LEFT";
				case Lib3dsChunks.CHK_VIEW_RIGHT: return "VIEW_RIGHT";
				case Lib3dsChunks.CHK_VIEW_FRONT: return "VIEW_FRONT";
				case Lib3dsChunks.CHK_VIEW_BACK: return "VIEW_BACK";
				case Lib3dsChunks.CHK_VIEW_USER: return "VIEW_USER";
				case Lib3dsChunks.CHK_VIEW_CAMERA: return "VIEW_CAMERA";
				case Lib3dsChunks.CHK_VIEW_WINDOW: return "VIEW_WINDOW";
				case Lib3dsChunks.CHK_VIEWPORT_LAYOUT_OLD: return "VIEWPORT_LAYOUT_OLD";
				case Lib3dsChunks.CHK_VIEWPORT_DATA_OLD: return "VIEWPORT_DATA_OLD";
				case Lib3dsChunks.CHK_VIEWPORT_LAYOUT: return "VIEWPORT_LAYOUT";
				case Lib3dsChunks.CHK_VIEWPORT_DATA: return "VIEWPORT_DATA";
				case Lib3dsChunks.CHK_VIEWPORT_DATA_3: return "VIEWPORT_DATA_3";
				case Lib3dsChunks.CHK_VIEWPORT_SIZE: return "VIEWPORT_SIZE";
				case Lib3dsChunks.CHK_NETWORK_VIEW: return "NETWORK_VIEW";
				default: return "***UNKNOWN***";
			}
		}
		static void lib3ds_chunk_unknown(Lib3dsChunks chunk, Lib3dsIo io)
		{
			if(io.log_func!=null)
			{
				lib3ds_io_log(io, Lib3dsLogLevel.LIB3DS_LOG_WARN, "Unknown Chunk: {0} (0x{1:X})", lib3ds_chunk_name(chunk), chunk);
			}
		}
        static string lib3ds_chunk_name(Lib3dsChunks chunk)
        {
            switch (chunk)
            {
            case Lib3dsChunks.CHK_NULL_CHUNK: return("NULL_CHUNK");

            case Lib3dsChunks.CHK_M3DMAGIC: return("M3DMAGIC");

            case Lib3dsChunks.CHK_SMAGIC: return("SMAGIC");

            case Lib3dsChunks.CHK_LMAGIC: return("LMAGIC");

            case Lib3dsChunks.CHK_MLIBMAGIC: return("MLIBMAGIC");

            case Lib3dsChunks.CHK_MATMAGIC: return("MATMAGIC");

            case Lib3dsChunks.CHK_CMAGIC: return("CMAGIC");

            case Lib3dsChunks.CHK_M3D_VERSION: return("M3D_VERSION");

            case Lib3dsChunks.CHK_M3D_KFVERSION: return("M3D_KFVERSION");

            case Lib3dsChunks.CHK_COLOR_F: return("COLOR_F");

            case Lib3dsChunks.CHK_COLOR_24: return("COLOR_24");

            case Lib3dsChunks.CHK_LIN_COLOR_24: return("LIN_COLOR_24");

            case Lib3dsChunks.CHK_LIN_COLOR_F: return("LIN_COLOR_F");

            case Lib3dsChunks.CHK_INT_PERCENTAGE: return("INT_PERCENTAGE");

            case Lib3dsChunks.CHK_FLOAT_PERCENTAGE: return("FLOAT_PERCENTAGE");

            case Lib3dsChunks.CHK_MDATA: return("MDATA");

            case Lib3dsChunks.CHK_MESH_VERSION: return("MESH_VERSION");

            case Lib3dsChunks.CHK_MASTER_SCALE: return("MASTER_SCALE");

            case Lib3dsChunks.CHK_LO_SHADOW_BIAS: return("LO_SHADOW_BIAS");

            case Lib3dsChunks.CHK_HI_SHADOW_BIAS: return("HI_SHADOW_BIAS");

            case Lib3dsChunks.CHK_SHADOW_MAP_SIZE: return("SHADOW_MAP_SIZE");

            case Lib3dsChunks.CHK_SHADOW_SAMPLES: return("SHADOW_SAMPLES");

            case Lib3dsChunks.CHK_SHADOW_RANGE: return("SHADOW_RANGE");

            case Lib3dsChunks.CHK_SHADOW_FILTER: return("SHADOW_FILTER");

            case Lib3dsChunks.CHK_RAY_BIAS: return("RAY_BIAS");

            case Lib3dsChunks.CHK_O_CONSTS: return("O_CONSTS");

            case Lib3dsChunks.CHK_AMBIENT_LIGHT: return("AMBIENT_LIGHT");

            case Lib3dsChunks.CHK_BIT_MAP: return("BIT_MAP");

            case Lib3dsChunks.CHK_SOLID_BGND: return("SOLID_BGND");

            case Lib3dsChunks.CHK_V_GRADIENT: return("V_GRADIENT");

            case Lib3dsChunks.CHK_USE_BIT_MAP: return("USE_BIT_MAP");

            case Lib3dsChunks.CHK_USE_SOLID_BGND: return("USE_SOLID_BGND");

            case Lib3dsChunks.CHK_USE_V_GRADIENT: return("USE_V_GRADIENT");

            case Lib3dsChunks.CHK_FOG: return("FOG");

            case Lib3dsChunks.CHK_FOG_BGND: return("FOG_BGND");

            case Lib3dsChunks.CHK_LAYER_FOG: return("LAYER_FOG");

            case Lib3dsChunks.CHK_DISTANCE_CUE: return("DISTANCE_CUE");

            case Lib3dsChunks.CHK_DCUE_BGND: return("DCUE_BGND");

            case Lib3dsChunks.CHK_USE_FOG: return("USE_FOG");

            case Lib3dsChunks.CHK_USE_LAYER_FOG: return("USE_LAYER_FOG");

            case Lib3dsChunks.CHK_USE_DISTANCE_CUE: return("USE_DISTANCE_CUE");

            case Lib3dsChunks.CHK_MAT_ENTRY: return("MAT_ENTRY");

            case Lib3dsChunks.CHK_MAT_NAME: return("MAT_NAME");

            case Lib3dsChunks.CHK_MAT_AMBIENT: return("MAT_AMBIENT");

            case Lib3dsChunks.CHK_MAT_DIFFUSE: return("MAT_DIFFUSE");

            case Lib3dsChunks.CHK_MAT_SPECULAR: return("MAT_SPECULAR");

            case Lib3dsChunks.CHK_MAT_SHININESS: return("MAT_SHININESS");

            case Lib3dsChunks.CHK_MAT_SHIN2PCT: return("MAT_SHIN2PCT");

            case Lib3dsChunks.CHK_MAT_TRANSPARENCY: return("MAT_TRANSPARENCY");

            case Lib3dsChunks.CHK_MAT_XPFALL: return("MAT_XPFALL");

            case Lib3dsChunks.CHK_MAT_USE_XPFALL: return("MAT_USE_XPFALL");

            case Lib3dsChunks.CHK_MAT_REFBLUR: return("MAT_REFBLUR");

            case Lib3dsChunks.CHK_MAT_SHADING: return("MAT_SHADING");

            case Lib3dsChunks.CHK_MAT_USE_REFBLUR: return("MAT_USE_REFBLUR");

            case Lib3dsChunks.CHK_MAT_SELF_ILLUM: return("MAT_SELF_ILLUM");

            case Lib3dsChunks.CHK_MAT_TWO_SIDE: return("MAT_TWO_SIDE");

            case Lib3dsChunks.CHK_MAT_DECAL: return("MAT_DECAL");

            case Lib3dsChunks.CHK_MAT_ADDITIVE: return("MAT_ADDITIVE");

            case Lib3dsChunks.CHK_MAT_SELF_ILPCT: return("MAT_SELF_ILPCT");

            case Lib3dsChunks.CHK_MAT_WIRE: return("MAT_WIRE");

            case Lib3dsChunks.CHK_MAT_FACEMAP: return("MAT_FACEMAP");

            case Lib3dsChunks.CHK_MAT_PHONGSOFT: return("MAT_PHONGSOFT");

            case Lib3dsChunks.CHK_MAT_WIREABS: return("MAT_WIREABS");

            case Lib3dsChunks.CHK_MAT_WIRE_SIZE: return("MAT_WIRE_SIZE");

            case Lib3dsChunks.CHK_MAT_TEXMAP: return("MAT_TEXMAP");

            case Lib3dsChunks.CHK_MAT_SXP_TEXT_DATA: return("MAT_SXP_TEXT_DATA");

            case Lib3dsChunks.CHK_MAT_TEXMASK: return("MAT_TEXMASK");

            case Lib3dsChunks.CHK_MAT_SXP_TEXTMASK_DATA: return("MAT_SXP_TEXTMASK_DATA");

            case Lib3dsChunks.CHK_MAT_TEX2MAP: return("MAT_TEX2MAP");

            case Lib3dsChunks.CHK_MAT_SXP_TEXT2_DATA: return("MAT_SXP_TEXT2_DATA");

            case Lib3dsChunks.CHK_MAT_TEX2MASK: return("MAT_TEX2MASK");

            case Lib3dsChunks.CHK_MAT_SXP_TEXT2MASK_DATA: return("MAT_SXP_TEXT2MASK_DATA");

            case Lib3dsChunks.CHK_MAT_OPACMAP: return("MAT_OPACMAP");

            case Lib3dsChunks.CHK_MAT_SXP_OPAC_DATA: return("MAT_SXP_OPAC_DATA");

            case Lib3dsChunks.CHK_MAT_OPACMASK: return("MAT_OPACMASK");

            case Lib3dsChunks.CHK_MAT_SXP_OPACMASK_DATA: return("MAT_SXP_OPACMASK_DATA");

            case Lib3dsChunks.CHK_MAT_BUMPMAP: return("MAT_BUMPMAP");

            case Lib3dsChunks.CHK_MAT_SXP_BUMP_DATA: return("MAT_SXP_BUMP_DATA");

            case Lib3dsChunks.CHK_MAT_BUMPMASK: return("MAT_BUMPMASK");

            case Lib3dsChunks.CHK_MAT_SXP_BUMPMASK_DATA: return("MAT_SXP_BUMPMASK_DATA");

            case Lib3dsChunks.CHK_MAT_SPECMAP: return("MAT_SPECMAP");

            case Lib3dsChunks.CHK_MAT_SXP_SPEC_DATA: return("MAT_SXP_SPEC_DATA");

            case Lib3dsChunks.CHK_MAT_SPECMASK: return("MAT_SPECMASK");

            case Lib3dsChunks.CHK_MAT_SXP_SPECMASK_DATA: return("MAT_SXP_SPECMASK_DATA");

            case Lib3dsChunks.CHK_MAT_SHINMAP: return("MAT_SHINMAP");

            case Lib3dsChunks.CHK_MAT_SXP_SHIN_DATA: return("MAT_SXP_SHIN_DATA");

            case Lib3dsChunks.CHK_MAT_SHINMASK: return("MAT_SHINMASK");

            case Lib3dsChunks.CHK_MAT_SXP_SHINMASK_DATA: return("MAT_SXP_SHINMASK_DATA");

            case Lib3dsChunks.CHK_MAT_SELFIMAP: return("MAT_SELFIMAP");

            case Lib3dsChunks.CHK_MAT_SXP_SELFI_DATA: return("MAT_SXP_SELFI_DATA");

            case Lib3dsChunks.CHK_MAT_SELFIMASK: return("MAT_SELFIMASK");

            case Lib3dsChunks.CHK_MAT_SXP_SELFIMASK_DATA: return("MAT_SXP_SELFIMASK_DATA");

            case Lib3dsChunks.CHK_MAT_REFLMAP: return("MAT_REFLMAP");

            case Lib3dsChunks.CHK_MAT_REFLMASK: return("MAT_REFLMASK");

            case Lib3dsChunks.CHK_MAT_SXP_REFLMASK_DATA: return("MAT_SXP_REFLMASK_DATA");

            case Lib3dsChunks.CHK_MAT_ACUBIC: return("MAT_ACUBIC");

            case Lib3dsChunks.CHK_MAT_MAPNAME: return("MAT_MAPNAME");

            case Lib3dsChunks.CHK_MAT_MAP_TILING: return("MAT_MAP_TILING");

            case Lib3dsChunks.CHK_MAT_MAP_TEXBLUR: return("MAT_MAP_TEXBLUR");

            case Lib3dsChunks.CHK_MAT_MAP_USCALE: return("MAT_MAP_USCALE");

            case Lib3dsChunks.CHK_MAT_MAP_VSCALE: return("MAT_MAP_VSCALE");

            case Lib3dsChunks.CHK_MAT_MAP_UOFFSET: return("MAT_MAP_UOFFSET");

            case Lib3dsChunks.CHK_MAT_MAP_VOFFSET: return("MAT_MAP_VOFFSET");

            case Lib3dsChunks.CHK_MAT_MAP_ANG: return("MAT_MAP_ANG");

            case Lib3dsChunks.CHK_MAT_MAP_COL1: return("MAT_MAP_COL1");

            case Lib3dsChunks.CHK_MAT_MAP_COL2: return("MAT_MAP_COL2");

            case Lib3dsChunks.CHK_MAT_MAP_RCOL: return("MAT_MAP_RCOL");

            case Lib3dsChunks.CHK_MAT_MAP_GCOL: return("MAT_MAP_GCOL");

            case Lib3dsChunks.CHK_MAT_MAP_BCOL: return("MAT_MAP_BCOL");

            case Lib3dsChunks.CHK_NAMED_OBJECT: return("NAMED_OBJECT");

            case Lib3dsChunks.CHK_N_DIRECT_LIGHT: return("N_DIRECT_LIGHT");

            case Lib3dsChunks.CHK_DL_OFF: return("DL_OFF");

            case Lib3dsChunks.CHK_DL_OUTER_RANGE: return("DL_OUTER_RANGE");

            case Lib3dsChunks.CHK_DL_INNER_RANGE: return("DL_INNER_RANGE");

            case Lib3dsChunks.CHK_DL_MULTIPLIER: return("DL_MULTIPLIER");

            case Lib3dsChunks.CHK_DL_EXCLUDE: return("DL_EXCLUDE");

            case Lib3dsChunks.CHK_DL_ATTENUATE: return("DL_ATTENUATE");

            case Lib3dsChunks.CHK_DL_SPOTLIGHT: return("DL_SPOTLIGHT");

            case Lib3dsChunks.CHK_DL_SPOT_ROLL: return("DL_SPOT_ROLL");

            case Lib3dsChunks.CHK_DL_SHADOWED: return("DL_SHADOWED");

            case Lib3dsChunks.CHK_DL_LOCAL_SHADOW2: return("DL_LOCAL_SHADOW2");

            case Lib3dsChunks.CHK_DL_SEE_CONE: return("DL_SEE_CONE");

            case Lib3dsChunks.CHK_DL_SPOT_RECTANGULAR: return("DL_SPOT_RECTANGULAR");

            case Lib3dsChunks.CHK_DL_SPOT_ASPECT: return("DL_SPOT_ASPECT");

            case Lib3dsChunks.CHK_DL_SPOT_PROJECTOR: return("DL_SPOT_PROJECTOR");

            case Lib3dsChunks.CHK_DL_SPOT_OVERSHOOT: return("DL_SPOT_OVERSHOOT");

            case Lib3dsChunks.CHK_DL_RAY_BIAS: return("DL_RAY_BIAS");

            case Lib3dsChunks.CHK_DL_RAYSHAD: return("DL_RAYSHAD");

            case Lib3dsChunks.CHK_N_CAMERA: return("N_CAMERA");

            case Lib3dsChunks.CHK_CAM_SEE_CONE: return("CAM_SEE_CONE");

            case Lib3dsChunks.CHK_CAM_RANGES: return("CAM_RANGES");

            case Lib3dsChunks.CHK_OBJ_HIDDEN: return("OBJ_HIDDEN");

            case Lib3dsChunks.CHK_OBJ_VIS_LOFTER: return("OBJ_VIS_LOFTER");

            case Lib3dsChunks.CHK_OBJ_DOESNT_CAST: return("OBJ_DOESNT_CAST");

            case Lib3dsChunks.CHK_OBJ_DONT_RCVSHADOW: return("OBJ_DONT_RCVSHADOW");

            case Lib3dsChunks.CHK_OBJ_MATTE: return("OBJ_MATTE");

            case Lib3dsChunks.CHK_OBJ_FAST: return("OBJ_FAST");

            case Lib3dsChunks.CHK_OBJ_PROCEDURAL: return("OBJ_PROCEDURAL");

            case Lib3dsChunks.CHK_OBJ_FROZEN: return("OBJ_FROZEN");

            case Lib3dsChunks.CHK_N_TRI_OBJECT: return("N_TRI_OBJECT");

            case Lib3dsChunks.CHK_POINT_ARRAY: return("POINT_ARRAY");

            case Lib3dsChunks.CHK_POINT_FLAG_ARRAY: return("POINT_FLAG_ARRAY");

            case Lib3dsChunks.CHK_FACE_ARRAY: return("FACE_ARRAY");

            case Lib3dsChunks.CHK_MSH_MAT_GROUP: return("MSH_MAT_GROUP");

            case Lib3dsChunks.CHK_SMOOTH_GROUP: return("SMOOTH_GROUP");

            case Lib3dsChunks.CHK_MSH_BOXMAP: return("MSH_BOXMAP");

            case Lib3dsChunks.CHK_TEX_VERTS: return("TEX_VERTS");

            case Lib3dsChunks.CHK_MESH_MATRIX: return("MESH_MATRIX");

            case Lib3dsChunks.CHK_MESH_COLOR: return("MESH_COLOR");

            case Lib3dsChunks.CHK_MESH_TEXTURE_INFO: return("MESH_TEXTURE_INFO");

            case Lib3dsChunks.CHK_KFDATA: return("KFDATA");

            case Lib3dsChunks.CHK_KFHDR: return("KFHDR");

            case Lib3dsChunks.CHK_KFSEG: return("KFSEG");

            case Lib3dsChunks.CHK_KFCURTIME: return("KFCURTIME");

            case Lib3dsChunks.CHK_AMBIENT_NODE_TAG: return("AMBIENT_NODE_TAG");

            case Lib3dsChunks.CHK_OBJECT_NODE_TAG: return("OBJECT_NODE_TAG");

            case Lib3dsChunks.CHK_CAMERA_NODE_TAG: return("CAMERA_NODE_TAG");

            case Lib3dsChunks.CHK_TARGET_NODE_TAG: return("TARGET_NODE_TAG");

            case Lib3dsChunks.CHK_LIGHT_NODE_TAG: return("LIGHT_NODE_TAG");

            case Lib3dsChunks.CHK_L_TARGET_NODE_TAG: return("L_TARGET_NODE_TAG");

            case Lib3dsChunks.CHK_SPOTLIGHT_NODE_TAG: return("SPOTLIGHT_NODE_TAG");

            case Lib3dsChunks.CHK_NODE_ID: return("NODE_ID");

            case Lib3dsChunks.CHK_NODE_HDR: return("NODE_HDR");

            case Lib3dsChunks.CHK_PIVOT: return("PIVOT");

            case Lib3dsChunks.CHK_INSTANCE_NAME: return("INSTANCE_NAME");

            case Lib3dsChunks.CHK_MORPH_SMOOTH: return("MORPH_SMOOTH");

            case Lib3dsChunks.CHK_BOUNDBOX: return("BOUNDBOX");

            case Lib3dsChunks.CHK_POS_TRACK_TAG: return("POS_TRACK_TAG");

            case Lib3dsChunks.CHK_COL_TRACK_TAG: return("COL_TRACK_TAG");

            case Lib3dsChunks.CHK_ROT_TRACK_TAG: return("ROT_TRACK_TAG");

            case Lib3dsChunks.CHK_SCL_TRACK_TAG: return("SCL_TRACK_TAG");

            case Lib3dsChunks.CHK_MORPH_TRACK_TAG: return("MORPH_TRACK_TAG");

            case Lib3dsChunks.CHK_FOV_TRACK_TAG: return("FOV_TRACK_TAG");

            case Lib3dsChunks.CHK_ROLL_TRACK_TAG: return("ROLL_TRACK_TAG");

            case Lib3dsChunks.CHK_HOT_TRACK_TAG: return("HOT_TRACK_TAG");

            case Lib3dsChunks.CHK_FALL_TRACK_TAG: return("FALL_TRACK_TAG");

            case Lib3dsChunks.CHK_HIDE_TRACK_TAG: return("HIDE_TRACK_TAG");

            case Lib3dsChunks.CHK_POLY_2D: return("POLY_2D");

            case Lib3dsChunks.CHK_SHAPE_OK: return("SHAPE_OK");

            case Lib3dsChunks.CHK_SHAPE_NOT_OK: return("SHAPE_NOT_OK");

            case Lib3dsChunks.CHK_SHAPE_HOOK: return("SHAPE_HOOK");

            case Lib3dsChunks.CHK_PATH_3D: return("PATH_3D");

            case Lib3dsChunks.CHK_PATH_MATRIX: return("PATH_MATRIX");

            case Lib3dsChunks.CHK_SHAPE_2D: return("SHAPE_2D");

            case Lib3dsChunks.CHK_M_SCALE: return("M_SCALE");

            case Lib3dsChunks.CHK_M_TWIST: return("M_TWIST");

            case Lib3dsChunks.CHK_M_TEETER: return("M_TEETER");

            case Lib3dsChunks.CHK_M_FIT: return("M_FIT");

            case Lib3dsChunks.CHK_M_BEVEL: return("M_BEVEL");

            case Lib3dsChunks.CHK_XZ_CURVE: return("XZ_CURVE");

            case Lib3dsChunks.CHK_YZ_CURVE: return("YZ_CURVE");

            case Lib3dsChunks.CHK_INTERPCT: return("INTERPCT");

            case Lib3dsChunks.CHK_DEFORM_LIMIT: return("DEFORM_LIMIT");

            case Lib3dsChunks.CHK_USE_CONTOUR: return("USE_CONTOUR");

            case Lib3dsChunks.CHK_USE_TWEEN: return("USE_TWEEN");

            case Lib3dsChunks.CHK_USE_SCALE: return("USE_SCALE");

            case Lib3dsChunks.CHK_USE_TWIST: return("USE_TWIST");

            case Lib3dsChunks.CHK_USE_TEETER: return("USE_TEETER");

            case Lib3dsChunks.CHK_USE_FIT: return("USE_FIT");

            case Lib3dsChunks.CHK_USE_BEVEL: return("USE_BEVEL");

            case Lib3dsChunks.CHK_DEFAULT_VIEW: return("DEFAULT_VIEW");

            case Lib3dsChunks.CHK_VIEW_TOP: return("VIEW_TOP");

            case Lib3dsChunks.CHK_VIEW_BOTTOM: return("VIEW_BOTTOM");

            case Lib3dsChunks.CHK_VIEW_LEFT: return("VIEW_LEFT");

            case Lib3dsChunks.CHK_VIEW_RIGHT: return("VIEW_RIGHT");

            case Lib3dsChunks.CHK_VIEW_FRONT: return("VIEW_FRONT");

            case Lib3dsChunks.CHK_VIEW_BACK: return("VIEW_BACK");

            case Lib3dsChunks.CHK_VIEW_USER: return("VIEW_USER");

            case Lib3dsChunks.CHK_VIEW_CAMERA: return("VIEW_CAMERA");

            case Lib3dsChunks.CHK_VIEW_WINDOW: return("VIEW_WINDOW");

            case Lib3dsChunks.CHK_VIEWPORT_LAYOUT_OLD: return("VIEWPORT_LAYOUT_OLD");

            case Lib3dsChunks.CHK_VIEWPORT_DATA_OLD: return("VIEWPORT_DATA_OLD");

            case Lib3dsChunks.CHK_VIEWPORT_LAYOUT: return("VIEWPORT_LAYOUT");

            case Lib3dsChunks.CHK_VIEWPORT_DATA: return("VIEWPORT_DATA");

            case Lib3dsChunks.CHK_VIEWPORT_DATA_3: return("VIEWPORT_DATA_3");

            case Lib3dsChunks.CHK_VIEWPORT_SIZE: return("VIEWPORT_SIZE");

            case Lib3dsChunks.CHK_NETWORK_VIEW: return("NETWORK_VIEW");

            default: return("***UNKNOWN***");
            }
        }
		static void texture_map_write(Lib3dsChunks chunk, Lib3dsTextureMap map, Lib3dsIo io)
		{
			if(map.name==null||map.name.Length==0) return;
			Lib3dsChunk c_chunk=new Lib3dsChunk();

			c_chunk.chunk=chunk;
			lib3ds_chunk_write_start(c_chunk, io);

			int_percentage_write(map.percent, io);

			{ // ---- CHK_MAT_MAPNAME ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAPNAME;
				c.size=6+(uint)map.name.Length+1;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_string(io, map.name);
			}

			{ // ---- CHK_MAT_MAP_TILING ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_TILING;
				c.size=8;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_word(io, (ushort)map.flags);
			}

			{ // ---- CHK_MAT_MAP_TEXBLUR ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_TEXBLUR;
				c.size=10;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_float(io, map.blur);
			}

			{ // ---- CHK_MAT_MAP_USCALE ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_USCALE;
				c.size=10;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_float(io, map.scale[0]);
			}

			{ // ---- CHK_MAT_MAP_VSCALE ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_VSCALE;
				c.size=10;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_float(io, map.scale[1]);
			}

			{ // ---- CHK_MAT_MAP_UOFFSET ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_UOFFSET;
				c.size=10;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_float(io, map.offset[0]);
			}

			{ // ---- CHK_MAT_MAP_VOFFSET ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_VOFFSET;
				c.size=10;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_float(io, map.offset[1]);
			}

			{ // ---- CHK_MAT_MAP_ANG ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_ANG;
				c.size=10;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_float(io, map.rotation);
			}

			{ // ---- CHK_MAT_MAP_COL1 ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_COL1;
				c.size=9;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_1[0]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_1[1]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_1[2]+0.5));
			}

			{ // ---- CHK_MAT_MAP_COL2 ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_COL2;
				c.size=9;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_2[0]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_2[1]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_2[2]+0.5));
			}

			{ // ---- CHK_MAT_MAP_RCOL ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_RCOL;
				c.size=9;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_r[0]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_r[1]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_r[2]+0.5));
			}

			{ // ---- CHK_MAT_MAP_GCOL ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_GCOL;
				c.size=9;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_g[0]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_g[1]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_g[2]+0.5));
			}

			{ // ---- CHK_MAT_MAP_BCOL ----
				Lib3dsChunk c=new Lib3dsChunk();
				c.chunk=Lib3dsChunks.CHK_MAT_MAP_BCOL;
				c.size=9;
				lib3ds_chunk_write(c, io);
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_b[0]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_b[1]+0.5));
				lib3ds_io_write_byte(io, (byte)Math.Floor(255.0*map.tint_b[2]+0.5));
			}

			lib3ds_chunk_write_end(c_chunk, io);
		}