diff --git a/.gitmodules b/.gitmodules index 336afbd9..0c67c5e6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "3rdparty/miniaudio"] path = 3rdparty/miniaudio url = https://github.com/mackron/miniaudio.git +[submodule "3rdparty/tinygltf"] + path = 3rdparty/tinygltf + url = https://github.com/syoyo/tinygltf.git diff --git a/3rdparty/3dsftk3/3dsftk.h b/3rdparty/3dsftk3/3dsftk.h deleted file mode 100644 index de43a983..00000000 --- a/3rdparty/3dsftk3/3dsftk.h +++ /dev/null @@ -1,1931 +0,0 @@ -/**************************************************************************** - * - * 3DSFTK.H - 3D Studio File Toolkit for Release 3 library header - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * This program is copyrighted by Autodesk, Inc. and is licensed to you under - * the following conditions. You may not distribute or publish the source - * code of this program in any form. You may incorporate this code in object - * form in derivative works provided such derivative works are (i.) are de- - * signed and intended to work solely with Autodesk, Inc. products, and (ii.) - * contain Autodesk's copyright notice "(C) Copyright 1995 by Autodesk, Inc." - * - * AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. AUTODESK SPE- - * CIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR - * A PARTICULAR USE. AUTODESK, INC. DOES NOT WARRANT THAT THE OPERATION OF - * THE PROGRAM WILL BE UNINTERRUPTED OR ERROR FREE. - * - ***************************************************************************/ - -#ifndef FTK3DS_H -#define FTK3DS_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Note: Item's prefixed with a "Priv" comment are internally used, are not - part of the toolkit's published interface, and should not be used - by non-ftk library functions */ - - -/* Data Type Synonyms For Portability */ - -#define char3ds char -#define uchar3ds unsigned char -#define byte3ds char -#define ubyte3ds unsigned char -#define short3ds short int -#define ushort3ds unsigned short int -#define long3ds long int -#define ulong3ds unsigned long int -#define float3ds float -#define double3ds double -#define int3ds int -#define void3ds void - -/* 3DS File Toolkit revision level. Future revisions will increment this - integer number */ -#define FTKRevisionLevel3ds 2 - -/*------------------------------------ - Error reporting and testing macros - ----------------------------------*/ - -/* Pending error flag values for ftkerr3ds global */ -#define FTK_ERROR True3ds -#define FTK_NO_ERROR False3ds - -/*--- If ftkerr3ds shows that an error has occured, return */ -#define ON_ERROR_RETURN {if(ftkerr3ds && !ignoreftkerr3ds) return;} -#define ON_ERROR_RETURNR(rval) {if(ftkerr3ds && !ignoreftkerr3ds) return rval;} - -/*--- If ftkerr3ds shows that an error has occured, push error and return */ -#define ADD_ERROR_RETURN(id) {if(ftkerr3ds){PushErrList3ds(id); if (!ignoreftkerr3ds) return;}} -#define ADD_ERROR_RETURNR(id, rval) {if(ftkerr3ds){PushErrList3ds(id); if (!ignoreftkerr3ds) return rval;}} - -/*--- If ftkerr3ds shows that an error has occured, push error */ -#define ADD_ERROR(id) {if (ftkerr3ds){PushErrList3ds(id);}} - -/*--- Reset the the error flag */ -#define CLEAR_ERROR {if (ftkerr3ds){ClearErrList3ds();}} - -/*--- Simply set the error state: Good if you need to clean-up before returning */ -#define SET_ERROR {ftkerr3ds=True3ds;} - -/*--- Set error state, push an error ID and return */ -#define SET_ERROR_RETURN(id) {PushErrList3ds(id); if (!ignoreftkerr3ds) return;} -#define SET_ERROR_RETURNR(id, rval) {PushErrList3ds(id); if (!ignoreftkerr3ds) return rval;} - -/* Prints errors and exits application */ -#define PRINT_ERRORS_EXIT(file) {if(ftkerr3ds){DumpErrList3ds(file); if (!ignoreftkerr3ds) exit(-1);}} - -/*---------------------------------------- - Commonly used structures and constants - --------------------------------------*/ - -/* Constants to define True and False in a compiler independant way. */ -#define TRUE3DS (1==1) -#define FALSE3DS (1!=1) -static const byte3ds True3ds = (1==1); -static const byte3ds False3ds = (1!=1); - -/* point3ds - 3D point structure */ -typedef struct -{ - float3ds x, y, z; -} point3ds; - -/* fcolor3ds - Floating point color definition */ -typedef struct { - float3ds r; /* RGB Color components */ - float3ds g; - float3ds b; -} fcolor3ds; - -/* face3ds - Face list element */ -typedef struct -{ - ushort3ds v1, v2, v3, flag; -} face3ds; - -/* textvert3ds - Texture assignment coordinate */ -typedef struct -{ - float3ds u, v; -} textvert3ds; -/* Priv */ /* trackheader3ds - Global track settings */ -/* Priv */ typedef struct -/* Priv */ { -/* Priv */ ushort3ds flags; -/* Priv */ ulong3ds nu1, nu2; -/* Priv */ ulong3ds keycount; /* Number of keys in the track */ -/* Priv */ } trackheader3ds; - -/* keyheader3ds - Animation key settings */ -typedef struct -{ - ulong3ds time; /* Key's frame position */ - ushort3ds rflags; /* Spline terms used flag */ - float3ds tension; /* Flagged with 0x01 */ - float3ds continuity; /* Flagged with 0x02 */ - float3ds bias; /* Flagged with 0x04 */ - float3ds easeto; /* Flagged with 0x08 */ - float3ds easefrom; /* Flagged with 0x10 */ -} keyheader3ds; - -/* kfrotkey3ds - Rotation key */ -typedef struct { - float3ds angle; /* angle of rotation */ - float3ds x; /* rotation axis vector */ - float3ds y; - float3ds z; -} kfrotkey3ds; - -/* kfmorphkey3ds - Object morph key */ -typedef struct { - char3ds name[13]; /* name of target morph object */ -} kfmorphkey3ds; - - -/* Error codes generated by toolkit */ -typedef enum -{ - NO_FTK_ERRORS = 0, /* No errors are pending */ - ERR_NO_MEM, /* Not enough memory to complete operation */ - ERR_INVALID_ARG, /* The argument passed to the function invalid. Usually */ - /* caused by a NULL pointer or an out of range numeric */ - /* argument. */ - ERR_INVALID_DATA, /* The structure passed as an argument to the function has */ - /* invalid or out of range data in its fields. */ - ERR_INVALID_CHUNK, /* An invalid chunk structure was encountered while reading */ - /* the database. Usually caused by a corrupt database or */ - /* file */ - ERR_INVALID_DATABASE, /* The database passed as an argument has not be created */ - /* yet. */ - ERR_WRONG_DATABASE, /* The database passed as an argument is the wrong kind of */ - /* database for this function. */ - ERR_UNFOUND_CHUNK, /* The database is missing important file chunks needed to */ - /* fill out the requested structure. Usually caused by a */ - /* corrupt database or file */ - ERR_WRONG_OBJECT, /* The name passed to the functions exists, but is not the */ - /* type of object asked for. For example, asking for a mesh */ - /* object with the GetCameraByName3ds function. */ - ERR_NO_SUCH_FILE, /* The filename passed as an argument for reading does not exist */ - ERR_INIT_FAILED, /* Failed to initialize structure passed as an argument */ - ERR_OPENING_FILE, /* Could not open requested file */ - ERR_CLOSING_FILE, /* Could not close requested file */ - ERR_READING_FILE, /* Error occured while reading file */ - ERR_CREATING_DATABASE, /* Error occured while creating database */ - ERR_READING_DATABASE, /* Error occured while reading database */ - ERR_WRITING_DATABASE, /* Error occured while writing database */ - ERR_WRITING_FILE, /* Error occured while writing file */ - ERR_STRING_TOO_LONG, /* String encountered in file, structure, or as an */ - /* argument was longer than expected. Possibly caused by */ - /* an uninitialed pointer, corrupt file or database */ - ERR_TOO_MANY_FILES, /* The toolkit has reached its maximum open file limit of */ - /* 252 files. */ - ERR_GET_FAIL, /* Failed to get new data from database */ - ERR_PUT_FAIL, /* Failed to add new data to the database */ - N_ERRORS -}errorid3ds; - -typedef struct { - errorid3ds id; - const char3ds *desc; -} ErrRec3ds; - - -/* Priv */ /* chunktag3ds - enumeration of all possible chunk type identifiers. See appendix for */ -/* Priv */ /* more information concerning chunk structures */ -/* Priv */ typedef enum -/* Priv */ { -/* Priv */ /* Trick Chunk Flags For ChunkSyntax function */ - -/* Priv */ NULL_CHUNK = 0x0000, -/* Priv */ ChunkType = 0x0995, -/* Priv */ ChunkUnique = 0x0996, -/* Priv */ NotChunk = 0x0997, -/* Priv */ Container = 0x0998, -/* Priv */ IsChunk = 0x0999, - -/* Priv */ /* Dummy Chunk that sometimes appears in 3ds files created by prerelease 3D Studio R2 */ -/* Priv */ DUMMY = 0xFFFF, - -/* Priv */ /* Trick Chunk Types For Open*, Write*, Close* functions */ - -/* Priv */ POINT_ARRAY_ENTRY = 0xF110, -/* Priv */ POINT_FLAG_ARRAY_ENTRY = 0xF111, -/* Priv */ FACE_ARRAY_ENTRY = 0xF120, -/* Priv */ MSH_MAT_GROUP_ENTRY = 0xF130, -/* Priv */ TEX_VERTS_ENTRY = 0xF140, -/* Priv */ SMOOTH_GROUP_ENTRY = 0xF150, -/* Priv */ POS_TRACK_TAG_KEY = 0xF020, -/* Priv */ ROT_TRACK_TAG_KEY = 0xF021, -/* Priv */ SCL_TRACK_TAG_KEY = 0xF022, -/* Priv */ FOV_TRACK_TAG_KEY = 0xF023, -/* Priv */ ROLL_TRACK_TAG_KEY = 0xF024, -/* Priv */ COL_TRACK_TAG_KEY = 0xF025, -/* Priv */ MORPH_TRACK_TAG_KEY = 0xF026, -/* Priv */ HOT_TRACK_TAG_KEY = 0xF027, -/* Priv */ FALL_TRACK_TAG_KEY = 0xF028, -/* Priv */ -/* Priv */ /* 3DS File Chunk IDs */ - -/* Priv */ M3DMAGIC = 0x4D4D, -/* Priv */ SMAGIC = 0x2D2D, -/* Priv */ LMAGIC = 0x2D3D, -/* Priv */ MLIBMAGIC = 0x3DAA, -/* Priv */ MATMAGIC = 0x3DFF, -/* Priv */ M3D_VERSION = 0x0002, -/* Priv */ M3D_KFVERSION = 0x0005, - -/* Priv */ /* Mesh Chunk Ids */ - -/* Priv */ MDATA = 0x3D3D, -/* Priv */ MESH_VERSION = 0x3D3E, -/* Priv */ COLOR_F = 0x0010, -/* Priv */ COLOR_24 = 0x0011, -/* Priv */ LIN_COLOR_24 = 0x0012, -/* Priv */ LIN_COLOR_F = 0x0013, -/* Priv */ INT_PERCENTAGE = 0x0030, -/* Priv */ FLOAT_PERCENTAGE = 0x0031, - -/* Priv */ MASTER_SCALE = 0x0100, - -/* Priv */ BIT_MAP = 0x1100, -/* Priv */ USE_BIT_MAP = 0x1101, -/* Priv */ SOLID_BGND = 0x1200, -/* Priv */ USE_SOLID_BGND = 0x1201, -/* Priv */ V_GRADIENT = 0x1300, -/* Priv */ USE_V_GRADIENT = 0x1301, - -/* Priv */ LO_SHADOW_BIAS = 0x1400, -/* Priv */ HI_SHADOW_BIAS = 0x1410, -/* Priv */ SHADOW_MAP_SIZE = 0x1420, -/* Priv */ SHADOW_SAMPLES = 0x1430, -/* Priv */ SHADOW_RANGE = 0x1440, -/* Priv */ SHADOW_FILTER = 0x1450, -/* Priv */ RAY_BIAS = 0x1460, -/* Priv */ -/* Priv */ O_CONSTS = 0x1500, -/* Priv */ -/* Priv */ AMBIENT_LIGHT = 0x2100, - -/* Priv */ FOG = 0x2200, -/* Priv */ USE_FOG = 0x2201, -/* Priv */ FOG_BGND = 0x2210, -/* Priv */ DISTANCE_CUE = 0x2300, -/* Priv */ USE_DISTANCE_CUE = 0x2301, -/* Priv */ LAYER_FOG = 0x2302, -/* Priv */ USE_LAYER_FOG = 0x2303, -/* Priv */ DCUE_BGND = 0x2310, - -/* Priv */ DEFAULT_VIEW = 0x3000, -/* Priv */ VIEW_TOP = 0x3010, -/* Priv */ VIEW_BOTTOM = 0x3020, -/* Priv */ VIEW_LEFT = 0x3030, -/* Priv */ VIEW_RIGHT = 0x3040, -/* Priv */ VIEW_FRONT = 0x3050, -/* Priv */ VIEW_BACK = 0x3060, -/* Priv */ VIEW_USER = 0x3070, -/* Priv */ VIEW_CAMERA = 0x3080, -/* Priv */ VIEW_WINDOW = 0x3090, - -/* Priv */ NAMED_OBJECT = 0x4000, -/* Priv */ OBJ_HIDDEN = 0x4010, -/* Priv */ OBJ_VIS_LOFTER = 0x4011, -/* Priv */ OBJ_DOESNT_CAST = 0x4012, -/* Priv */ OBJ_MATTE = 0x4013, -/* Priv */ OBJ_FAST = 0x4014, -/* Priv */ OBJ_PROCEDURAL = 0x4015, -/* Priv */ OBJ_FROZEN = 0x4016, -/* Priv */ OBJ_DONT_RCVSHADOW = 0x4017, - -/* Priv */ N_TRI_OBJECT = 0x4100, - -/* Priv */ POINT_ARRAY = 0x4110, -/* Priv */ POINT_FLAG_ARRAY = 0x4111, -/* Priv */ FACE_ARRAY = 0x4120, -/* Priv */ MSH_MAT_GROUP = 0x4130, -/* Priv */ OLD_MAT_GROUP = 0x4131, -/* Priv */ TEX_VERTS = 0x4140, -/* Priv */ SMOOTH_GROUP = 0x4150, -/* Priv */ MESH_MATRIX = 0x4160, -/* Priv */ MESH_COLOR = 0x4165, -/* Priv */ MESH_TEXTURE_INFO = 0x4170, -/* Priv */ PROC_NAME = 0x4181, -/* Priv */ PROC_DATA = 0x4182, -/* Priv */ MSH_BOXMAP = 0x4190, - -/* Priv */ N_D_L_OLD = 0x4400, - -/* Priv */ N_CAM_OLD = 0x4500, - -/* Priv */ N_DIRECT_LIGHT = 0x4600, -/* Priv */ DL_SPOTLIGHT = 0x4610, -/* Priv */ DL_OFF = 0x4620, -/* Priv */ DL_ATTENUATE = 0x4625, -/* Priv */ DL_RAYSHAD = 0x4627, -/* Priv */ DL_SHADOWED = 0x4630, -/* Priv */ DL_LOCAL_SHADOW = 0x4640, -/* Priv */ DL_LOCAL_SHADOW2 = 0x4641, -/* Priv */ DL_SEE_CONE = 0x4650, -/* Priv */ DL_SPOT_RECTANGULAR = 0x4651, -/* Priv */ DL_SPOT_OVERSHOOT = 0x4652, -/* Priv */ DL_SPOT_PROJECTOR = 0x4653, -/* Priv */ DL_EXCLUDE = 0x4654, -/* Priv */ DL_RANGE = 0x4655, /* Not used in R3 */ -/* Priv */ DL_SPOT_ROLL = 0x4656, -/* Priv */ DL_SPOT_ASPECT = 0x4657, -/* Priv */ DL_RAY_BIAS = 0x4658, -/* Priv */ DL_INNER_RANGE = 0x4659, -/* Priv */ DL_OUTER_RANGE = 0x465A, -/* Priv */ DL_MULTIPLIER = 0x465B, - -/* Priv */ N_AMBIENT_LIGHT = 0x4680, - -/* Priv */ N_CAMERA = 0x4700, -/* Priv */ CAM_SEE_CONE = 0x4710, -/* Priv */ CAM_RANGES = 0x4720, - -/* Priv */ HIERARCHY = 0x4F00, -/* Priv */ PARENT_OBJECT = 0x4F10, -/* Priv */ PIVOT_OBJECT = 0x4F20, -/* Priv */ PIVOT_LIMITS = 0x4F30, -/* Priv */ PIVOT_ORDER = 0x4F40, -/* Priv */ XLATE_RANGE = 0x4F50, - -/* Priv */ POLY_2D = 0x5000, - -/* Priv */ /* Flags in shaper file that tell whether polys make up an ok shape */ - -/* Priv */ SHAPE_OK = 0x5010, -/* Priv */ SHAPE_NOT_OK = 0x5011, - -/* Priv */ SHAPE_HOOK = 0x5020, - -/* Priv */ PATH_3D = 0x6000, -/* Priv */ PATH_MATRIX = 0x6005, -/* Priv */ SHAPE_2D = 0x6010, -/* Priv */ M_SCALE = 0x6020, -/* Priv */ M_TWIST = 0x6030, -/* Priv */ M_TEETER = 0x6040, -/* Priv */ M_FIT = 0x6050, -/* Priv */ M_BEVEL = 0x6060, -/* Priv */ XZ_CURVE = 0x6070, -/* Priv */ YZ_CURVE = 0x6080, -/* Priv */ INTERPCT = 0x6090, -/* Priv */ DEFORM_LIMIT = 0x60A0, - -/* Priv */ /* Flags for Modeler options */ - -/* Priv */ USE_CONTOUR = 0x6100, -/* Priv */ USE_TWEEN = 0x6110, -/* Priv */ USE_SCALE = 0x6120, -/* Priv */ USE_TWIST = 0x6130, -/* Priv */ USE_TEETER = 0x6140, -/* Priv */ USE_FIT = 0x6150, -/* Priv */ USE_BEVEL = 0x6160, - -/* Priv */ /* Viewport description chunks */ - -/* Priv */ VIEWPORT_LAYOUT_OLD = 0x7000, -/* Priv */ VIEWPORT_DATA_OLD = 0x7010, -/* Priv */ VIEWPORT_LAYOUT = 0x7001, -/* Priv */ VIEWPORT_DATA = 0x7011, -/* Priv */ VIEWPORT_DATA_3 = 0x7012, -/* Priv */ VIEWPORT_SIZE = 0x7020, -/* Priv */ NETWORK_VIEW = 0x7030, - -/* Priv */ /* External Application Data */ - -/* Priv */ XDATA_SECTION = 0x8000, -/* Priv */ XDATA_ENTRY = 0x8001, -/* Priv */ XDATA_APPNAME = 0x8002, -/* Priv */ XDATA_STRING = 0x8003, -/* Priv */ XDATA_FLOAT = 0x8004, -/* Priv */ XDATA_DOUBLE = 0x8005, -/* Priv */ XDATA_SHORT = 0x8006, -/* Priv */ XDATA_LONG = 0x8007, -/* Priv */ XDATA_VOID = 0x8008, -/* Priv */ XDATA_GROUP = 0x8009, -/* Priv */ XDATA_RFU6 = 0x800A, -/* Priv */ XDATA_RFU5 = 0x800B, -/* Priv */ XDATA_RFU4 = 0x800C, -/* Priv */ XDATA_RFU3 = 0x800D, -/* Priv */ XDATA_RFU2 = 0x800E, -/* Priv */ XDATA_RFU1 = 0x800F, -/* Priv */ -/* Priv */ PARENT_NAME = 0x80F0, - -/* Priv */ /* Material Chunk IDs */ - -/* Priv */ MAT_ENTRY = 0xAFFF, -/* Priv */ MAT_NAME = 0xA000, -/* Priv */ MAT_AMBIENT = 0xA010, -/* Priv */ MAT_DIFFUSE = 0xA020, -/* Priv */ MAT_SPECULAR = 0xA030, -/* Priv */ MAT_SHININESS = 0xA040, -/* Priv */ MAT_SHIN2PCT = 0xA041, -/* Priv */ MAT_SHIN3PCT = 0xA042, -/* Priv */ MAT_TRANSPARENCY = 0xA050, -/* Priv */ MAT_XPFALL = 0xA052, -/* Priv */ MAT_REFBLUR = 0xA053, - -/* Priv */ MAT_SELF_ILLUM = 0xA080, -/* Priv */ MAT_TWO_SIDE = 0xA081, -/* Priv */ MAT_DECAL = 0xA082, -/* Priv */ MAT_ADDITIVE = 0xA083, -/* Priv */ MAT_SELF_ILPCT = 0xA084, -/* Priv */ MAT_WIRE = 0xA085, -/* Priv */ MAT_SUPERSMP = 0xA086, -/* Priv */ MAT_WIRESIZE = 0xA087, -/* Priv */ MAT_FACEMAP = 0xA088, -/* Priv */ MAT_XPFALLIN = 0xA08A, -/* Priv */ MAT_PHONGSOFT = 0xA08C, -/* Priv */ MAT_WIREABS = 0xA08E, - -/* Priv */ MAT_SHADING = 0xA100, - -/* Priv */ MAT_TEXMAP = 0xA200, -/* Priv */ MAT_OPACMAP = 0xA210, -/* Priv */ MAT_REFLMAP = 0xA220, -/* Priv */ MAT_BUMPMAP = 0xA230, -/* Priv */ MAT_SPECMAP = 0xA204, -/* Priv */ MAT_USE_XPFALL = 0xA240, -/* Priv */ MAT_USE_REFBLUR = 0xA250, -/* Priv */ MAT_BUMP_PERCENT = 0xA252, - -/* Priv */ MAT_MAPNAME = 0xA300, -/* Priv */ MAT_ACUBIC = 0xA310, - -/* Priv */ MAT_SXP_TEXT_DATA = 0xA320, -/* Priv */ MAT_SXP_TEXT2_DATA = 0xA321, -/* Priv */ MAT_SXP_OPAC_DATA = 0xA322, -/* Priv */ MAT_SXP_BUMP_DATA = 0xA324, -/* Priv */ MAT_SXP_SPEC_DATA = 0xA325, -/* Priv */ MAT_SXP_SHIN_DATA = 0xA326, -/* Priv */ MAT_SXP_SELFI_DATA = 0xA328, -/* Priv */ MAT_SXP_TEXT_MASKDATA = 0xA32A, -/* Priv */ MAT_SXP_TEXT2_MASKDATA = 0xA32C, -/* Priv */ MAT_SXP_OPAC_MASKDATA = 0xA32E, -/* Priv */ MAT_SXP_BUMP_MASKDATA = 0xA330, -/* Priv */ MAT_SXP_SPEC_MASKDATA = 0xA332, -/* Priv */ MAT_SXP_SHIN_MASKDATA = 0xA334, -/* Priv */ MAT_SXP_SELFI_MASKDATA = 0xA336, -/* Priv */ MAT_SXP_REFL_MASKDATA = 0xA338, -/* Priv */ MAT_TEX2MAP = 0xA33A, -/* Priv */ MAT_SHINMAP = 0xA33C, -/* Priv */ MAT_SELFIMAP = 0xA33D, -/* Priv */ MAT_TEXMASK = 0xA33E, -/* Priv */ MAT_TEX2MASK = 0xA340, -/* Priv */ MAT_OPACMASK = 0xA342, -/* Priv */ MAT_BUMPMASK = 0xA344, -/* Priv */ MAT_SHINMASK = 0xA346, -/* Priv */ MAT_SPECMASK = 0xA348, -/* Priv */ MAT_SELFIMASK = 0xA34A, -/* Priv */ MAT_REFLMASK = 0xA34C, -/* Priv */ MAT_MAP_TILINGOLD = 0xA350, -/* Priv */ MAT_MAP_TILING = 0xA351, -/* Priv */ MAT_MAP_TEXBLUR_OLD = 0xA352, -/* Priv */ MAT_MAP_TEXBLUR = 0xA353, -/* Priv */ MAT_MAP_USCALE = 0xA354, -/* Priv */ MAT_MAP_VSCALE = 0xA356, -/* Priv */ MAT_MAP_UOFFSET = 0xA358, -/* Priv */ MAT_MAP_VOFFSET = 0xA35A, -/* Priv */ MAT_MAP_ANG = 0xA35C, -/* Priv */ MAT_MAP_COL1 = 0xA360, -/* Priv */ MAT_MAP_COL2 = 0xA362, -/* Priv */ MAT_MAP_RCOL = 0xA364, -/* Priv */ MAT_MAP_GCOL = 0xA366, -/* Priv */ MAT_MAP_BCOL = 0xA368, - -/* Priv */ /* Keyframe Chunk IDs */ - -/* Priv */ KFDATA = 0xB000, -/* Priv */ KFHDR = 0xB00A, -/* Priv */ AMBIENT_NODE_TAG = 0xB001, -/* Priv */ OBJECT_NODE_TAG = 0xB002, -/* Priv */ CAMERA_NODE_TAG = 0xB003, -/* Priv */ TARGET_NODE_TAG = 0xB004, -/* Priv */ LIGHT_NODE_TAG = 0xB005, -/* Priv */ L_TARGET_NODE_TAG = 0xB006, -/* Priv */ SPOTLIGHT_NODE_TAG = 0xB007, - -/* Priv */ KFSEG = 0xB008, -/* Priv */ KFCURTIME = 0xB009, -/* Priv */ NODE_HDR = 0xB010, -/* Priv */ INSTANCE_NAME = 0xB011, -/* Priv */ PRESCALE = 0xB012, -/* Priv */ PIVOT = 0xB013, -/* Priv */ BOUNDBOX = 0xB014, -/* Priv */ MORPH_SMOOTH = 0xB015, -/* Priv */ POS_TRACK_TAG = 0xB020, -/* Priv */ ROT_TRACK_TAG = 0xB021, -/* Priv */ SCL_TRACK_TAG = 0xB022, -/* Priv */ FOV_TRACK_TAG = 0xB023, -/* Priv */ ROLL_TRACK_TAG = 0xB024, -/* Priv */ COL_TRACK_TAG = 0xB025, -/* Priv */ MORPH_TRACK_TAG = 0xB026, -/* Priv */ HOT_TRACK_TAG = 0xB027, -/* Priv */ FALL_TRACK_TAG = 0xB028, -/* Priv */ HIDE_TRACK_TAG = 0xB029, -/* Priv */ NODE_ID = 0xB030, -/* Priv */ -/* Priv */ CMAGIC = 0xC23D, - -/* Priv */ C_MDRAWER = 0xC010, -/* Priv */ C_TDRAWER = 0xC020, -/* Priv */ C_SHPDRAWER = 0xC030, -/* Priv */ C_MODDRAWER = 0xC040, -/* Priv */ C_RIPDRAWER = 0xC050, -/* Priv */ C_TXDRAWER = 0xC060, -/* Priv */ C_PDRAWER = 0xC062, -/* Priv */ C_MTLDRAWER = 0xC064, -/* Priv */ C_FLIDRAWER = 0xC066, -/* Priv */ C_CUBDRAWER = 0xC067, -/* Priv */ C_MFILE = 0xC070, -/* Priv */ C_SHPFILE = 0xC080, -/* Priv */ C_MODFILE = 0xC090, -/* Priv */ C_RIPFILE = 0xC0A0, -/* Priv */ C_TXFILE = 0xC0B0, -/* Priv */ C_PFILE = 0xC0B2, -/* Priv */ C_MTLFILE = 0xC0B4, -/* Priv */ C_FLIFILE = 0xC0B6, -/* Priv */ C_PALFILE = 0xC0B8, -/* Priv */ C_TX_STRING = 0xC0C0, -/* Priv */ C_CONSTS = 0xC0D0, -/* Priv */ C_SNAPS = 0xC0E0, -/* Priv */ C_GRIDS = 0xC0F0, -/* Priv */ C_ASNAPS = 0xC100, -/* Priv */ C_GRID_RANGE = 0xC110, -/* Priv */ C_RENDTYPE = 0xC120, -/* Priv */ C_PROGMODE = 0xC130, -/* Priv */ C_PREVMODE = 0xC140, -/* Priv */ C_MODWMODE = 0xC150, -/* Priv */ C_MODMODEL = 0xC160, -/* Priv */ C_ALL_LINES = 0xC170, -/* Priv */ C_BACK_TYPE = 0xC180, -/* Priv */ C_MD_CS = 0xC190, -/* Priv */ C_MD_CE = 0xC1A0, -/* Priv */ C_MD_SML = 0xC1B0, -/* Priv */ C_MD_SMW = 0xC1C0, -/* Priv */ C_LOFT_WITH_TEXTURE = 0xC1C3, -/* Priv */ C_LOFT_L_REPEAT = 0xC1C4, -/* Priv */ C_LOFT_W_REPEAT = 0xC1C5, -/* Priv */ C_LOFT_UV_NORMALIZE = 0xC1C6, -/* Priv */ C_WELD_LOFT = 0xC1C7, -/* Priv */ C_MD_PDET = 0xC1D0, -/* Priv */ C_MD_SDET = 0xC1E0, -/* Priv */ C_RGB_RMODE = 0xC1F0, -/* Priv */ C_RGB_HIDE = 0xC200, -/* Priv */ C_RGB_MAPSW = 0xC202, -/* Priv */ C_RGB_TWOSIDE = 0xC204, -/* Priv */ C_RGB_SHADOW = 0xC208, -/* Priv */ C_RGB_AA = 0xC210, -/* Priv */ C_RGB_OVW = 0xC220, -/* Priv */ C_RGB_OVH = 0xC230, -/* Priv */ C_RGB_PICTYPE = 0xC240, -/* Priv */ C_RGB_OUTPUT = 0xC250, -/* Priv */ C_RGB_TODISK = 0xC253, -/* Priv */ C_RGB_COMPRESS = 0xC254, -/* Priv */ C_JPEG_COMPRESSION = 0xC255, -/* Priv */ C_RGB_DISPDEV = 0xC256, -/* Priv */ C_RGB_HARDDEV = 0xC259, -/* Priv */ C_RGB_PATH = 0xC25A, -/* Priv */ C_BITMAP_DRAWER = 0xC25B, -/* Priv */ C_RGB_FILE = 0xC260, -/* Priv */ C_RGB_OVASPECT = 0xC270, - -/* Priv */ C_RGB_ANIMTYPE = 0xC271, -/* Priv */ C_RENDER_ALL = 0xC272, -/* Priv */ C_REND_FROM = 0xC273, -/* Priv */ C_REND_TO = 0xC274, -/* Priv */ C_REND_NTH = 0xC275, -/* Priv */ C_PAL_TYPE = 0xC276, -/* Priv */ C_RND_TURBO = 0xC277, -/* Priv */ C_RND_MIP = 0xC278, -/* Priv */ C_BGND_METHOD = 0xC279, -/* Priv */ C_AUTO_REFLECT = 0xC27A, -/* Priv */ C_VP_FROM = 0xC27B, -/* Priv */ C_VP_TO = 0xC27C, -/* Priv */ C_VP_NTH = 0xC27D, -/* Priv */ C_REND_TSTEP = 0xC27E, -/* Priv */ C_VP_TSTEP = 0xC27F, - -/* Priv */ C_SRDIAM = 0xC280, -/* Priv */ C_SRDEG = 0xC290, -/* Priv */ C_SRSEG = 0xC2A0, -/* Priv */ C_SRDIR = 0xC2B0, -/* Priv */ C_HETOP = 0xC2C0, -/* Priv */ C_HEBOT = 0xC2D0, -/* Priv */ C_HEHT = 0xC2E0, -/* Priv */ C_HETURNS = 0xC2F0, -/* Priv */ C_HEDEG = 0xC300, -/* Priv */ C_HESEG = 0xC310, -/* Priv */ C_HEDIR = 0xC320, -/* Priv */ C_QUIKSTUFF = 0xC330, -/* Priv */ C_SEE_LIGHTS = 0xC340, -/* Priv */ C_SEE_CAMERAS = 0xC350, -/* Priv */ C_SEE_3D = 0xC360, -/* Priv */ C_MESHSEL = 0xC370, -/* Priv */ C_MESHUNSEL = 0xC380, -/* Priv */ C_POLYSEL = 0xC390, -/* Priv */ C_POLYUNSEL = 0xC3A0, -/* Priv */ C_SHPLOCAL = 0xC3A2, -/* Priv */ C_MSHLOCAL = 0xC3A4, -/* Priv */ C_NUM_FORMAT = 0xC3B0, -/* Priv */ C_ARCH_DENOM = 0xC3C0, -/* Priv */ C_IN_DEVICE = 0xC3D0, -/* Priv */ C_MSCALE = 0xC3E0, -/* Priv */ C_COMM_PORT = 0xC3F0, -/* Priv */ C_TAB_BASES = 0xC400, -/* Priv */ C_TAB_DIVS = 0xC410, -/* Priv */ C_MASTER_SCALES = 0xC420, -/* Priv */ C_SHOW_1STVERT = 0xC430, -/* Priv */ C_SHAPER_OK = 0xC440, -/* Priv */ C_LOFTER_OK = 0xC450, -/* Priv */ C_EDITOR_OK = 0xC460, -/* Priv */ C_KEYFRAMER_OK = 0xC470, -/* Priv */ C_PICKSIZE = 0xC480, -/* Priv */ C_MAPTYPE = 0xC490, -/* Priv */ C_MAP_DISPLAY = 0xC4A0, -/* Priv */ C_TILE_XY = 0xC4B0, -/* Priv */ C_MAP_XYZ = 0xC4C0, -/* Priv */ C_MAP_SCALE = 0xC4D0, -/* Priv */ C_MAP_MATRIX_OLD = 0xC4E0, -/* Priv */ C_MAP_MATRIX = 0xC4E1, -/* Priv */ C_MAP_WID_HT = 0xC4F0, -/* Priv */ C_OBNAME = 0xC500, -/* Priv */ C_CAMNAME = 0xC510, -/* Priv */ C_LTNAME = 0xC520, -/* Priv */ C_CUR_MNAME = 0xC525, -/* Priv */ C_CURMTL_FROM_MESH = 0xC526, -/* Priv */ C_GET_SHAPE_MAKE_FACES = 0xC527, -/* Priv */ C_DETAIL = 0xC530, -/* Priv */ C_VERTMARK = 0xC540, -/* Priv */ C_MSHAX = 0xC550, -/* Priv */ C_MSHCP = 0xC560, -/* Priv */ C_USERAX = 0xC570, -/* Priv */ C_SHOOK = 0xC580, -/* Priv */ C_RAX = 0xC590, -/* Priv */ C_STAPE = 0xC5A0, -/* Priv */ C_LTAPE = 0xC5B0, -/* Priv */ C_ETAPE = 0xC5C0, -/* Priv */ C_KTAPE = 0xC5C8, -/* Priv */ C_SPHSEGS = 0xC5D0, -/* Priv */ C_GEOSMOOTH = 0xC5E0, -/* Priv */ C_HEMISEGS = 0xC5F0, -/* Priv */ C_PRISMSEGS = 0xC600, -/* Priv */ C_PRISMSIDES = 0xC610, -/* Priv */ C_TUBESEGS = 0xC620, -/* Priv */ C_TUBESIDES = 0xC630, -/* Priv */ C_TORSEGS = 0xC640, -/* Priv */ C_TORSIDES = 0xC650, -/* Priv */ C_CONESIDES = 0xC660, -/* Priv */ C_CONESEGS = 0xC661, -/* Priv */ C_NGPARMS = 0xC670, -/* Priv */ C_PTHLEVEL = 0xC680, -/* Priv */ C_MSCSYM = 0xC690, -/* Priv */ C_MFTSYM = 0xC6A0, -/* Priv */ C_MTTSYM = 0xC6B0, -/* Priv */ C_SMOOTHING = 0xC6C0, -/* Priv */ C_MODICOUNT = 0xC6D0, -/* Priv */ C_FONTSEL = 0xC6E0, -/* Priv */ C_TESS_TYPE = 0xC6f0, -/* Priv */ C_TESS_TENSION = 0xC6f1, - -/* Priv */ C_SEG_START = 0xC700, -/* Priv */ C_SEG_END = 0xC705, -/* Priv */ C_CURTIME = 0xC710, -/* Priv */ C_ANIMLENGTH = 0xC715, -/* Priv */ C_PV_FROM = 0xC720, -/* Priv */ C_PV_TO = 0xC725, -/* Priv */ C_PV_DOFNUM = 0xC730, -/* Priv */ C_PV_RNG = 0xC735, -/* Priv */ C_PV_NTH = 0xC740, -/* Priv */ C_PV_TYPE = 0xC745, -/* Priv */ C_PV_METHOD = 0xC750, -/* Priv */ C_PV_FPS = 0xC755, -/* Priv */ C_VTR_FRAMES = 0xC765, -/* Priv */ C_VTR_HDTL = 0xC770, -/* Priv */ C_VTR_HD = 0xC771, -/* Priv */ C_VTR_TL = 0xC772, -/* Priv */ C_VTR_IN = 0xC775, -/* Priv */ C_VTR_PK = 0xC780, -/* Priv */ C_VTR_SH = 0xC785, - -/* Priv */ /* Material chunks */ - -/* Priv */ C_WORK_MTLS = 0xC790, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_2 = 0xC792, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_3 = 0xC793, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_4 = 0xC794, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_5 = 0xCB00, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_6 = 0xCB01, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_7 = 0xCB02, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_8 = 0xCB03, /* Old-style -- now ignored */ -/* Priv */ C_WORKMTL = 0xCB04, -/* Priv */ C_SXP_TEXT_DATA = 0xCB10, -/* Priv */ C_SXP_TEXT2_DATA = 0xCB20, -/* Priv */ C_SXP_OPAC_DATA = 0xCB11, -/* Priv */ C_SXP_BUMP_DATA = 0xCB12, -/* Priv */ C_SXP_SPEC_DATA = 0xCB24, -/* Priv */ C_SXP_SHIN_DATA = 0xCB13, -/* Priv */ C_SXP_SELFI_DATA = 0xCB28, -/* Priv */ C_SXP_TEXT_MASKDATA = 0xCB30, -/* Priv */ C_SXP_TEXT2_MASKDATA = 0xCB32, -/* Priv */ C_SXP_OPAC_MASKDATA = 0xCB34, -/* Priv */ C_SXP_BUMP_MASKDATA = 0xCB36, -/* Priv */ C_SXP_SPEC_MASKDATA = 0xCB38, -/* Priv */ C_SXP_SHIN_MASKDATA = 0xCB3A, -/* Priv */ C_SXP_SELFI_MASKDATA = 0xC3C, -/* Priv */ C_SXP_REFL_MASKDATA = 0xCB3E, - -/* Priv */ C_BGTYPE = 0xC7A1, -/* Priv */ C_MEDTILE = 0xC7B0, - -/* Priv */ /* Contrast */ - -/* Priv */ C_LO_CONTRAST = 0xC7D0, -/* Priv */ C_HI_CONTRAST = 0xC7D1, - -/* Priv */ /* 3d frozen display */ - -/* Priv */ C_FROZ_DISPLAY = 0xC7E0, - -/* Priv */ /* Booleans */ -/* Priv */ C_BOOLWELD = 0xc7f0, -/* Priv */ C_BOOLTYPE = 0xc7f1, - -/* Priv */ C_ANG_THRESH = 0xC900, -/* Priv */ C_SS_THRESH = 0xC901, -/* Priv */ C_TEXTURE_BLUR_DEFAULT = 0xC903, - -/* Priv */ C_MAPDRAWER = 0xCA00, -/* Priv */ C_MAPDRAWER1 = 0xCA01, -/* Priv */ C_MAPDRAWER2 = 0xCA02, -/* Priv */ C_MAPDRAWER3 = 0xCA03, -/* Priv */ C_MAPDRAWER4 = 0xCA04, -/* Priv */ C_MAPDRAWER5 = 0xCA05, -/* Priv */ C_MAPDRAWER6 = 0xCA06, -/* Priv */ C_MAPDRAWER7 = 0xCA07, -/* Priv */ C_MAPDRAWER8 = 0xCA08, -/* Priv */ C_MAPDRAWER9 = 0xCA09, -/* Priv */ C_MAPDRAWER_ENTRY = 0xCA10, - -/* Priv */ /* system options */ -/* Priv */ C_BACKUP_FILE = 0xCA20, -/* Priv */ C_DITHER_256 = 0xCA21, -/* Priv */ C_SAVE_LAST = 0xCA22, -/* Priv */ C_USE_ALPHA = 0xCA23, -/* Priv */ C_TGA_DEPTH = 0xCA24, -/* Priv */ C_REND_FIELDS = 0xCA25, -/* Priv */ C_REFLIP = 0xCA26, -/* Priv */ C_SEL_ITEMTOG = 0xCA27, -/* Priv */ C_SEL_RESET = 0xCA28, -/* Priv */ C_STICKY_KEYINF = 0xCA29, -/* Priv */ C_WELD_THRESHOLD = 0xCA2A, -/* Priv */ C_ZCLIP_POINT = 0xCA2B, -/* Priv */ C_ALPHA_SPLIT = 0xCA2C, -/* Priv */ C_KF_SHOW_BACKFACE = 0xCA30, -/* Priv */ C_OPTIMIZE_LOFT = 0xCA40, -/* Priv */ C_TENS_DEFAULT = 0xCA42, -/* Priv */ C_CONT_DEFAULT = 0xCA44, -/* Priv */ C_BIAS_DEFAULT = 0xCA46, - -/* Priv */ C_DXFNAME_SRC = 0xCA50, -/* Priv */ C_AUTO_WELD = 0xCA60, -/* Priv */ C_AUTO_UNIFY = 0xCA70, -/* Priv */ C_AUTO_SMOOTH = 0xCA80, -/* Priv */ C_DXF_SMOOTH_ANG = 0xCA90, -/* Priv */ C_SMOOTH_ANG = 0xCAA0, - -/* Priv */ /* Special network-use chunks */ - -/* Priv */ C_NET_USE_VPOST = 0xCC00, -/* Priv */ C_NET_USE_GAMMA = 0xCC10, -/* Priv */ C_NET_FIELD_ORDER = 0xCC20, - -/* Priv */ C_BLUR_FRAMES = 0xCD00, -/* Priv */ C_BLUR_SAMPLES = 0xCD10, -/* Priv */ C_BLUR_DUR = 0xCD20, -/* Priv */ C_HOT_METHOD = 0xCD30, -/* Priv */ C_HOT_CHECK = 0xCD40, -/* Priv */ C_PIXEL_SIZE = 0xCD50, -/* Priv */ C_DISP_GAMMA = 0xCD60, -/* Priv */ C_FBUF_GAMMA = 0xCD70, -/* Priv */ C_FILE_OUT_GAMMA = 0xCD80, -/* Priv */ C_FILE_IN_GAMMA = 0xCD82, -/* Priv */ C_GAMMA_CORRECT = 0xCD84, -/* Priv */ C_APPLY_DISP_GAMMA = 0xCD90 /* OBSOLETE */, -/* Priv */ C_APPLY_FBUF_GAMMA = 0xCDA0 /* OBSOLETE */, -/* Priv */ C_APPLY_FILE_GAMMA = 0xCDB0 /* OBSOLETE */, -/* Priv */ C_FORCE_WIRE = 0xCDC0, -/* Priv */ C_RAY_SHADOWS = 0xCDD0, -/* Priv */ C_MASTER_AMBIENT = 0xCDE0, -/* Priv */ C_SUPER_SAMPLE = 0xCDF0, -/* Priv */ C_OBJECT_MBLUR = 0xCE00, -/* Priv */ C_MBLUR_DITHER = 0xCE10, -/* Priv */ C_DITHER_24 = 0xCE20, -/* Priv */ C_SUPER_BLACK = 0xCE30, -/* Priv */ C_SAFE_FRAME = 0xCE40, -/* Priv */ C_VIEW_PRES_RATIO = 0xCE50, -/* Priv */ C_BGND_PRES_RATIO = 0xCE60, -/* Priv */ C_NTH_SERIAL_NUM = 0xCE70, - -/* Priv */ /* Video Post */ -/* Priv */ VPDATA = 0xd000, - -/* Priv */ P_QUEUE_ENTRY = 0xd100, -/* Priv */ P_QUEUE_IMAGE = 0xd110, -/* Priv */ P_QUEUE_USEIGAMMA = 0xd114, -/* Priv */ P_QUEUE_PROC = 0xd120, -/* Priv */ P_QUEUE_SOLID = 0xd130, -/* Priv */ P_QUEUE_GRADIENT = 0xd140, -/* Priv */ P_QUEUE_KF = 0xd150, -/* Priv */ P_QUEUE_MOTBLUR = 0xd152, -/* Priv */ P_QUEUE_MB_REPEAT = 0xd153, -/* Priv */ P_QUEUE_NONE = 0xd160, - -/* Priv */ P_QUEUE_RESIZE = 0xd180, -/* Priv */ P_QUEUE_OFFSET = 0xd185, -/* Priv */ P_QUEUE_ALIGN = 0xd190, - -/* Priv */ P_CUSTOM_SIZE = 0xd1a0, - -/* Priv */ P_ALPH_NONE = 0xd210, -/* Priv */ P_ALPH_PSEUDO = 0xd220 /* Old chunk */, -/* Priv */ P_ALPH_OP_PSEUDO = 0xd221 /* Old chunk */, -/* Priv */ P_ALPH_BLUR = 0xd222 /* Replaces pseudo */, -/* Priv */ P_ALPH_PCOL = 0xd225, -/* Priv */ P_ALPH_C0 = 0xd230, -/* Priv */ P_ALPH_OP_KEY = 0xd231, -/* Priv */ P_ALPH_KCOL = 0xd235, -/* Priv */ P_ALPH_OP_NOCONV = 0xd238, -/* Priv */ P_ALPH_IMAGE = 0xd240, -/* Priv */ P_ALPH_ALPHA = 0xd250, -/* Priv */ P_ALPH_QUES = 0xd260, -/* Priv */ P_ALPH_QUEIMG = 0xd265, -/* Priv */ P_ALPH_CUTOFF = 0xd270, -/* Priv */ P_ALPHANEG = 0xd280, - -/* Priv */ P_TRAN_NONE = 0xd300, -/* Priv */ P_TRAN_IMAGE = 0xd310, -/* Priv */ P_TRAN_FRAMES = 0xd312, -/* Priv */ P_TRAN_FADEIN = 0xd320, -/* Priv */ P_TRAN_FADEOUT = 0xd330, -/* Priv */ P_TRANNEG = 0xd340, - -/* Priv */ P_RANGES = 0xd400, - -/* Priv */ P_PROC_DATA = 0xd500 - -/* Priv */ } chunktag3ds; - - -/* Priv */ /* chunk3ds - Internal database representation of file information */ -/* Priv */ typedef struct chunk3ds { -/* Priv */ chunktag3ds tag; /* Type of chunk */ -/* Priv */ ulong3ds size; /* Number of bytes used by chunk */ -/* Priv */ ulong3ds position; /* Offset in source file */ -/* Priv */ void *data; /* Memory copy of file data */ -/* Priv */ struct chunk3ds *sibling; /* Next chunk in database */ -/* Priv */ struct chunk3ds *children; /* Chunks contained within this chunk */ -/* Priv */ ubyte3ds readindex; /* Index of source file in file table */ -/* Priv */ ubyte3ds writeindex; /* Index of destination file in file table */ -/* Priv */ } chunk3ds; - -/* Priv */ /* chunklistentry3ds - Cross reference between name and chunk */ -/* Priv */ typedef struct { -/* Priv */ char3ds *name; /* Chunk Name list */ -/* Priv */ chunk3ds *chunk; /* Corresponding Pos */ -/* Priv */ } chunklistentry3ds; - -/* Priv */ /* chunklist3ds - List of cross references */ -/* Priv */ typedef struct -/* Priv */ { -/* Priv */ ulong3ds count; /* Number of entries in list */ -/* Priv */ chunklistentry3ds *list; /* Contents of list */ -/* Priv */ } chunklist3ds; - - -/* namelistentry3ds - Name of database object */ -typedef struct -{ - char3ds *name; /* Name of object */ -} namelistentry3ds; - -/* namelist3ds - List of database object names */ -typedef struct -{ - ulong3ds count; /*--- How many entries are in list */ - ulong3ds spaces; /*--- How much space for entries */ - namelistentry3ds *list; /*--- char ** to access pointers */ -} namelist3ds; - - -/* Priv */ /* filestate3ds - Read/write state of a file */ -/* Priv */ typedef enum -/* Priv */ { -/* Priv */ StateNotKnown = 0, /* No state determined yet, file not open */ -/* Priv */ ReadFromFile = 1, /* Open for read */ -/* Priv */ WriteToFile = 2, /* Open for write */ -/* Priv */ ReadWriteFile = 3 /* Open for read and write, not used by toolkit */ -/* Priv */ } filestate3ds; - -/* file3ds - Handle to 3D Studio files */ -typedef struct -{ - FILE *file; /* stdio file pointer */ - char3ds *filename; /* name of file */ - filestate3ds state; /* file open state */ - ubyte3ds index; /* Position of pointer in the FileContextList, if the - index eq InvalidFileContext3ds, then it is not in the - list */ - void *buffer; /* Buffered I/O buffer */ - ulong3ds buffersize; - ulong3ds bufferpos; - byte3ds istempfile; /* True3ds if file is a temp file */ -} file3ds; - -//@caiiiycuk: Unknow word is used -/* Priv */ /* dbtype3ds - Database type settings */ -/* Priv */ typedef enum -/* Priv */ { -/* Priv */ UnknownFile, /* Database has not be created yet */ -/* Priv */ MeshFile, /* 3D Studio .3DS file */ -/* Priv */ ProjectFile, /* 3D STudio .PRJ file */ -/* Priv */ MaterialFile /* 3D Studio .MLI file */ -/* Priv */ } dbtype3ds; - -/* database3ds - File database */ -typedef struct -{ - chunk3ds *topchunk; /* top chunk in the file */ - byte3ds objlistdirty; /* If true, than *objlist needs to be recreated */ - byte3ds matlistdirty; - byte3ds nodelistdirty; - chunklist3ds *objlist; /* Quick Cross references between names and database chunks */ - chunklist3ds *matlist; - chunklist3ds *nodelist; -} database3ds; -typedef enum -{ - NoView3ds, - TopView3ds, - BottomView3ds, - LeftView3ds, - RightView3ds, - FrontView3ds, - BackView3ds, - UserView3ds, - CameraView3ds, - SpotlightView3ds -} viewtype3ds; - -typedef struct -{ - ushort3ds xpos; - ushort3ds ypos; - ushort3ds width; - ushort3ds height; -} viewsize3ds; - -/* Used to describe top, bottom, left, right, front and back views */ -typedef struct -{ - point3ds center; /* Center of orthagonal view */ - float3ds zoom; /* View zoom factor */ -} orthoview3ds; - -/* Used to describe user views */ -typedef struct -{ - point3ds center; /* Center of user view */ - float3ds zoom; /* View zoom factor */ - float3ds horang; /* Horizontal angle of view */ - float3ds verang; /* Veritical angle of view */ -} userview3ds; - -/* Used to describe camera views */ -typedef struct -{ - char3ds name[11]; /* Name of the camera used in the view */ -} cameraview3ds; - -/* Viewport structure details the kind of view in a viewport */ -typedef struct -{ - viewtype3ds type; /* top, bottom, left, right, front, back, user and camera */ - viewsize3ds size; /* Size of the viewport */ - orthoview3ds ortho; /* used for top, bottom, left, right, front, and back views */ - userview3ds user; /* Used for user views */ - cameraview3ds camera; /* Used for camera views */ -} viewport3ds; -typedef enum -{ - UseShadowMap, - UseRayTraceShadow -} shadowstyle3ds; - -typedef struct { /* global shadow settings */ - shadowstyle3ds type; /* Either UseShadowMaps or UseRayTraceShadows */ - float3ds bias; /* shadow bias factor. */ - float3ds raybias; /* shadow ray bais factor. Used in R3 */ - short3ds mapsize; /* shadow map size */ - float3ds filter; /* shadow filter */ -} shadowsets3ds; - -typedef struct { - float3ds masterscale; /* Master mesh scale factor */ - shadowsets3ds shadow; /* Global shadow settings */ - fcolor3ds ambientlight; /* ambient light color */ - point3ds oconsts; /* default object constructing axis */ -} meshset3ds; -typedef enum -{ - NoAtmo, /* no active astmospherics */ - UseFog, /* fog astmostpheric */ - UseLayerFog, /* layer fog astmostpheric */ - UseDistanceCue /* distance cue astmostpheric */ -} atmospheretype3ds; - -typedef enum -{ - NoFall, /* no falloff */ - TopFall, /* falloff to the top */ - BottomFall /* falloff to the bottom */ -} layerfogfalloff3ds; - -typedef struct /* fog atmosphere parameters */ -{ - float3ds nearplane; /* near radius of fog effect */ - float3ds neardensity; /* near fog density */ - float3ds farplane; /* far radius of fog effect */ - float3ds fardensity; /* far fog density */ - fcolor3ds fogcolor; /* color of fog effect */ - byte3ds fogbgnd; /* True3ds / False3ds "fog background" flag */ -} fogsettings3ds; - -typedef struct /* layered fog atmosphere parameters */ -{ - float3ds zmin; /* lower bounds of fog */ - float3ds zmax; /* upper bounds of fog */ - float3ds density; /* fog density */ - fcolor3ds fogcolor; /* fog color */ - layerfogfalloff3ds falloff; /* falloff style */ - byte3ds fogbgnd; /* True3ds / False3ds "fog background" flag */ -} layerfogsettings3ds; - -typedef struct /* distance cue atmosphere parameters */ -{ - float3ds nearplane; /* near radius of effect */ - float3ds neardim; /* near dimming factor */ - float3ds farplane; /* far radius of effect */ - float3ds fardim; /* far dimming factor */ - byte3ds dcuebgnd; /* True3ds / False3ds effect the background flag */ -} dcuesettings3ds; - -typedef struct { - fogsettings3ds fog; /* fog atmostphere settings */ - layerfogsettings3ds layerfog; /* layered fog atmosphere parameters */ - dcuesettings3ds dcue; /* distance cue atmosphere parameters */ - atmospheretype3ds activeatmo; /* The active astmospheric */ -} atmosphere3ds; - -/* enumerate list of possible backgrounds used in file */ -typedef enum -{ - NoBgnd, - UseSolidBgnd, - UseVGradientBgnd, - UseBitmapBgnd -} backgroundtype3ds; - -typedef struct -{ - char3ds *name; /* name of background bitmap */ -} bitmapbgnd3ds; - -typedef struct -{ - fcolor3ds color; /* color of solid background */ -} solidbgnd3ds; - -typedef struct -{ - float3ds gradpercent; /* Placement of mid color band, ranges from 0-1 */ - fcolor3ds top; /* color of top band */ - fcolor3ds mid; /* color of mid background band */ - fcolor3ds bottom; /* color of bottom band */ -} vgradientbgnd3ds; - -typedef struct { - bitmapbgnd3ds bitmap; - solidbgnd3ds solid; - vgradientbgnd3ds vgradient; - backgroundtype3ds bgndused; /* background in effect */ -} background3ds; - -/* Used for shading field in material3ds structure */ -typedef enum -{ - Wire = 0, - Flat = 1, - Gouraud = 2, - Phong = 3, - Metal = 4 -} shadetype3ds; - -/* Used for tiling field in bitmap3ds structure */ -typedef enum -{ - Tile = 1, - Decal = 2, - Both = 3 -} tiletype3ds; - -typedef enum -{ - Pyramidal, - SummedArea -} filtertype3ds; - -typedef enum -{ - RGB, - Alpha, - RGBLumaTint, - AlphaTint, - RGBTint -} tinttype3ds; - - -/* Used By AddMaterial3ds */ - -typedef struct { - ubyte3ds firstframe; /* True for First Frame Only */ - ubyte3ds flat; /* True for flat mirror reflection */ - ulong3ds size; /* Map resolution */ - ulong3ds nthframe; /* Map update period */ -} acubic3ds; /* Cubic reflection map defintion */ - -typedef struct { - char3ds name[13]; /* Bitmap file name */ - float3ds percent; /* Strength percentage */ - tiletype3ds tiling; /* Tile/Decal/Both */ - byte3ds ignorealpha; - filtertype3ds filter; /* Pyramidal/Summed Area */ - float3ds blur; - byte3ds mirror; - byte3ds negative; - float3ds uscale, vscale; - float3ds uoffset, voffset; - float3ds rotation; - tinttype3ds source; /* RGB/RGB Luma Tint/Alpha Tint/RGB Tint */ - fcolor3ds tint1; - fcolor3ds tint2; - fcolor3ds redtint; - fcolor3ds greentint; - fcolor3ds bluetint; - ulong3ds datasize; /* Size of procedural data */ - void3ds *data; /* Procedural data */ -} bitmap3ds; /* Bit map definition */ - -/* Structure to all map settings */ -typedef struct { - bitmap3ds map; /* The map settings */ - bitmap3ds mask; /* The mask settings */ -} mapset3ds; - -typedef struct { - bitmap3ds map; /* The map settings */ - byte3ds useauto; /* True3ds if automatic reflections are being used */ - acubic3ds automap; /* Automatic reflection definitions */ - bitmap3ds mask; /* The mask settings */ -} rmapset3ds; - -typedef struct { - char3ds name[17]; /* Name */ - fcolor3ds ambient; /* Ambient light color */ - fcolor3ds diffuse; /* Diffuse light color */ - fcolor3ds specular; /* Specular light color */ - float3ds shininess; /* Shininess factor */ - float3ds shinstrength; /* Shininess strength */ - float3ds blur; /* Blur factor */ - float3ds transparency; /* Trasparency factor */ - float3ds transfalloff; /* Fallof factor */ - float3ds selfillumpct; /* Self illumination percentage */ - float3ds wiresize; /* Width of wireframe */ - shadetype3ds shading; /* Shading type */ - byte3ds useblur; /* Blurring flag */ - byte3ds usefall; /* Transparency falloff flag */ - byte3ds twosided; /* Two sided material flag */ - byte3ds selfillum; /* Self illumination flag */ - byte3ds additive; /* Additive transparency flag */ - byte3ds usewire; /* Use wireframe rendering */ - byte3ds usewireabs; /* Wire size is in units, not pixels. */ - byte3ds facemap; /* Face mapping switch */ - byte3ds soften; /* Soften switch */ - mapset3ds texture; /* Texture map settings */ - mapset3ds texture2; /* Second texture map settings */ - mapset3ds opacity; /* Opacity map settings */ - mapset3ds bump; /* Bump map settings */ - mapset3ds specmap; /* Specularity map settings */ - mapset3ds shinmap; /* Shininess map settings */ - mapset3ds illummap; /* Self illumination map settings */ - rmapset3ds reflect; /* Reflection map settings */ -} material3ds; /* Material definition */ - -/* mapinfo3ds - Texture map icon placement */ -typedef struct { - ushort3ds maptype; /* Icon type */ - float3ds tilex; /* Tiling */ - float3ds tiley; - float3ds cenx; /* Position of center */ - float3ds ceny; - float3ds cenz; - float3ds scale; /* Icon scaling factor */ - float3ds matrix[12]; /* Orientation matrix */ - float3ds pw; /* Planar icon width */ - float3ds ph; /* Planar icon height */ - float3ds ch; /* Cylinder icon height */ -} mapinfo3ds; - -/* objmat3ds - Material assignments by face */ -typedef struct { - char3ds name[17]; /* Material name */ - ushort3ds nfaces; /* Number of faces using material */ - ushort3ds *faceindex; /* List of faces using material */ -} objmat3ds; - -/* mesh3ds - Mesh object definition */ -typedef struct { - char3ds name[11]; /* Object name */ - byte3ds ishidden; /* Hidden object flag */ - byte3ds isvislofter; /* Lofter visibility flag */ - byte3ds ismatte; /* Matte object flag */ - byte3ds isnocast; /* Doesn't cast shadow's flag */ - byte3ds isfast; /* Fast display flag */ - byte3ds isnorcvshad; /* Doesn't recieve shadows */ - byte3ds isfrozen; /* Frozen object flag */ - ushort3ds nvertices; /* Vertice count */ - point3ds *vertexarray; /* List of vertices */ - ushort3ds nvflags; /* Number of vertex flags */ - ushort3ds *vflagarray; /* List of vertex flags */ - ushort3ds ntextverts; /* Number of texture vertices */ - textvert3ds *textarray; /* List of texture coordinates */ - byte3ds usemapinfo; /* Boolean for use of mapping icon information */ - mapinfo3ds map; /* Mapping icon info */ - float3ds locmatrix[12]; /* Object orientation matrix */ - ushort3ds nfaces; /* Face count */ - face3ds *facearray; /* List of faces */ - ulong3ds *smootharray; /* Smoothing group assignment list */ - byte3ds useboxmap; /* Boolean used to indicate the use of box mapping */ - char3ds boxmap[6][17]; /* Material names used in boxmapping */ - ubyte3ds meshcolor; /* UI color assigned to the mesh */ - ushort3ds nmats; /* Assigned materials count */ - objmat3ds *matarray; /* Material assignment list */ - byte3ds useproc; /* Use animated stand-in flag */ - ulong3ds procsize; /* Size of animated stand-in data */ - char3ds procname[13]; /* Name of animated stand-in procedure */ - void3ds *procdata; /* Animated stand-in data */ -} mesh3ds; - -/* conestyle3ds - Spolight projection cone shape. */ -typedef enum -{ - Circular, - Rectangular -} conestyle3ds; - -/* spotshadow - Spotlight shadow settings */ -typedef struct { - byte3ds cast; /* True if spotlight casts shadows */ - shadowstyle3ds type; /* UseShadow or UseRayTrace */ - byte3ds local; /* True if local shadow settings are being used */ - float3ds bias; /* Shadow bias */ - float3ds filter; /* Shadow filter */ - ushort3ds mapsize; /* Shadow map size */ - float3ds raybias; /* Ray tracing shadow bias */ -} spotshadow3ds; - -/* spotcond3ds - cone visability settings */ -typedef struct { - conestyle3ds type; /* Circular or rectangular light cone */ - byte3ds show; /* True if cone is visable */ - byte3ds overshoot; /* True if cone overshoot is on */ -} spotcone3ds; - -/* spotproject3ds - spotlight projectio bitmap */ -typedef struct { - byte3ds use; /* True if using projector */ - char3ds *bitmap; /* Name of projector bitmap */ -} spotprojector3ds; - -/* spotlight3ds - spotlight settings */ -typedef struct -{ - point3ds target; /* Spotlight target */ - float3ds hotspot; /* Hotspot angle */ - float3ds falloff; /* Hotspot falloff */ - float3ds roll; /* Roll angle */ - float3ds aspect; /* Aspect ratio */ - spotshadow3ds shadows; - spotcone3ds cone; - spotprojector3ds projector; -} spotlight3ds; - -/* liteattenuate3ds - Light attenuation settings */ -typedef struct { - byte3ds on; /* True if light attenuation is on */ - float3ds inner; /* Inner range of attenuation */ - float3ds outer; /* Outer range of attenuation */ -} liteattenuate3ds; - -/* light3ds - omni and spotlight settings */ -typedef struct { - char3ds name[11]; /* Light name */ - point3ds pos; /* Light position */ - fcolor3ds color; /* Light color */ - float3ds multiplier;/* Light intensity multiplier */ - byte3ds dloff; /* True if light is off */ - liteattenuate3ds attenuation; - namelist3ds *exclude; - spotlight3ds *spot; /* If not null, then struct is a spotlight, else omni. */ -} light3ds; - -/* camrange3ds - Camera atomosphere ranges */ -typedef struct { - float3ds cam_near; /* Nearest effect radiu */ - float3ds cam_far; /* Farthest effect radius */ -} camranges3ds; - -typedef struct -{ - char3ds name[11]; - point3ds position; - point3ds target; - float3ds roll; - float3ds fov; - byte3ds showcone; - camranges3ds ranges; -} camera3ds; - -typedef struct { - ulong3ds length; - ulong3ds curframe; -} kfkeyinfo3ds; - -typedef struct { - byte3ds use; - ulong3ds begin; - ulong3ds end; -} kfsegment3ds; - -typedef struct -{ - kfkeyinfo3ds anim; - kfsegment3ds seg; -} kfsets3ds; - - -typedef struct { - char3ds name[11]; /* Name of camera object */ - char3ds parent[22]; /* Name of parent object */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds npkeys; /* Number of camera position keys */ - ushort3ds npflag; /* Loop control flag for camera position keys */ - keyheader3ds *pkeys; /* Spline values for camera position keys */ - point3ds *pos; /* Camera position keys */ - - ulong3ds nfkeys; /* Number of camera FOV keys */ - ushort3ds nfflag; /* Loop control flag for camera FOV keys */ - keyheader3ds *fkeys; /* Spline values for camera FOV keys */ - float3ds *fov; /* Camera FOV keys */ - - ulong3ds nrkeys; /* Number of camera roll keys */ - ushort3ds nrflag; /* Loop control flag for camera roll keys */ - keyheader3ds *rkeys; /* Spline values for camera roll keys */ - float3ds *roll; /* Camera roll keys */ - - char3ds tparent[22]; /* Index of parent object for target */ - ulong3ds ntkeys; /* Number of target position keys */ - ushort3ds ntflag; /* Loop control flag for target position keys */ - keyheader3ds *tkeys; /* Spline values for target position keys */ - point3ds *tpos; /* Target position keys */ - ushort3ds tflags1; /* flags field from target node header */ - ushort3ds tflags2; /* flags field from target node header */ -} kfcamera3ds; - -/* kfambient3ds - Ambient light animation */ -typedef struct { - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag for color keys */ - keyheader3ds *ckeys; /* Spline values for position keys */ - fcolor3ds *color; /* Color keys */ -} kfambient3ds; -/* Used By ObjectMotion3ds */ - -typedef struct { - char3ds name[11]; /* Name of mesh */ - char3ds parent[22]; /* Name of parent object */ - ushort3ds flags1; /* flags field from node header */ - ushort3ds flags2; /* flags2 field from node header */ - - point3ds pivot; /* Object pivot point */ - char3ds instance[11]; /* Object instance name */ - point3ds boundmin; /* Minimum bounding box point for dummy objects */ - point3ds boundmax; /* Maximum bounding box point for dummy objects */ - - ulong3ds npkeys; /* Number of position keys */ - short3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for position keys */ - point3ds *pos; /* Mesh position keys */ - - ulong3ds nrkeys; /* Number of rotation keys */ - short3ds nrflag; /* Loop control flag for rotation keys */ - keyheader3ds *rkeys; /* Spline values for rotation keys */ - kfrotkey3ds *rot; /* Rotation keys */ - - ulong3ds nskeys; /* Number of scaling keys */ - short3ds nsflag; /* Loop control flag for scaling keys */ - keyheader3ds *skeys; /* Spline values for scaling */ - point3ds *scale; /* Mesh scaling keys */ - - ulong3ds nmkeys; /* Number of morph keys */ - short3ds nmflag; /* Loop control flag for morph keys */ - keyheader3ds *mkeys; /* Spline values for morph keys */ - kfmorphkey3ds *morph; /* Morph keys */ - - ulong3ds nhkeys; /* Number of hide keys */ - short3ds nhflag; /* Loop control flag for hide keys */ - keyheader3ds *hkeys; /* Spline values for hide keys */ - float3ds msangle; /* Morph smoothing group angle */ -} kfmesh3ds; - -/* Used By OmnilightMotion3ds */ - -typedef struct { - char3ds name[11]; /* Name of the light object node */ - char3ds parent[22]; /* Name of the parent object */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds npkeys; /* Number of position keys */ - ushort3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for position keys */ - point3ds *pos; /* Position keys */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag for color keys */ - keyheader3ds *ckeys; /* Spline values for position keys */ - fcolor3ds *color; /* Color keys */ - -} kfomni3ds; - -typedef struct { - char3ds name[11]; /* Name of camera object */ - char3ds parent[22]; /* Parent name */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - -#ifdef broken - short3ds visable; /* Flags to control visability */ -#endif - ulong3ds npkeys; /* Number of light position keys */ - ushort3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for light position keys */ - point3ds *pos; /* Light position keys */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag color keys */ - keyheader3ds *ckeys; /* Spline values for color keys */ - fcolor3ds *color; /* Color keys */ - - ulong3ds nhkeys; /* Number of hotspot angle keys */ - ushort3ds nhflag; /* Loop control flag for hotspot angle keys */ - keyheader3ds *hkeys; /* Spline values for hotspot angle keys */ - float3ds *hot; /* Hotspot angle keys */ - - ulong3ds nfkeys; /* Number of falloff angle keys */ - ushort3ds nfflag; /* Loop control flag for falloff angle keys */ - keyheader3ds *fkeys; /* Spline values for falloff angle keys */ - float3ds *fall; /* Falloff angle keys */ - - ulong3ds nrkeys; /* Number of light roll keys */ - ushort3ds nrflag; /* Loop control flag for light roll keys */ - keyheader3ds *rkeys; /* Spline values for light roll keys */ - float3ds *roll; /* Light roll keys */ - - char3ds tparent[22]; /* Name of target's parent object */ - ulong3ds ntkeys; /* Number of target position keys */ - ushort3ds ntflag; /* Loop control flag for target position keys */ - keyheader3ds *tkeys; /* Spline values for target position keys */ - point3ds *tpos; /* Target position keys */ - ushort3ds tflags1; /* flags field from target node header */ - ushort3ds tflags2; /* flags field from target node header */ - -} kfspot3ds; -typedef struct { - long3ds size; - void3ds *data; -} xdataraw3ds; - - -/*---------------------------------------- - Constants for commonly used structures - --------------------------------------*/ - -/* 3DS File Toolkit revision level. Future revisions will increment this - integer number */ -static const long3ds __FTKRevisionLevel3ds = FTKRevisionLevel3ds; - -/* Flags used by the flag field of the mesh3ds structure */ -static const ushort3ds FaceCAVisable3ds = 0x0001; /* Flags the CA edge as visable */ -static const ushort3ds FaceBCVisable3ds = 0x0002; /* Flags the BC edge as visable */ -static const ushort3ds FaceABVisable3ds = 0x0004; /* Flags the AB edge as visable */ -static const ushort3ds FaceUWrap3ds = 0x0008; /* Flags the face as being at - a texture coord u wrap - seam */ -static const ushort3ds FaceVWrap3ds = 0x0010; /* Flags the face as being at - a texture coord v wrap - seam */ - -/* Flags used by the rflags field of the keyheader3ds structure */ -static const ushort3ds KeyUsesTension3ds = 0x01; -static const ushort3ds KeyUsesCont3ds = 0x02; -static const ushort3ds KeyUsesBias3ds = 0x04; -static const ushort3ds KeyUsesEaseTo3ds = 0x08; -static const ushort3ds KeyUsesEaseFrom3ds= 0x10; - -/* Flags used by the track flags field */ -static const ushort3ds TrackSingle3ds = 0x0000; -static const ushort3ds TrackLoops3ds = 0x0003; -static const ushort3ds TrackRepeats3ds = 0x0002; -static const ushort3ds TrackLockX3ds = 0x0008; -static const ushort3ds TrackLockY3ds = 0x0010; -static const ushort3ds TrackLockZ3ds = 0x0020; -static const ushort3ds TrackNoLinkX3ds = 0x0100; -static const ushort3ds TrackNoLinkY3ds = 0x0200; -static const ushort3ds TrackNoLinkZ3ds = 0x0400; - -/* Basic structure default contents for ease of initialization */ -static const point3ds DefPoint3ds = {0.0F, 0.0F, 0.0F}; -static const textvert3ds DefTextVert3ds = {0.0F, 0.0F}; -static const face3ds DefFace3ds = {0, 1, 2, 0}; -static const trackheader3ds DefTrackHeader3ds = {0, 0, 0, 1}; -static const keyheader3ds DefKeyHeader3ds = {0, 0, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; -/* Last toolkit error */ -extern byte3ds ftkerr3ds; /* True3ds if error is pending */ -extern byte3ds ignoreftkerr3ds; /* True3ds if errors are being ignored by toolkit */ -/* Fog flags */ -static const ulong3ds LayerFogBgnd = 0x100000; -static const ulong3ds NoFalloff = 0x0; -static const ulong3ds TopFalloff = 0x2; -static const ulong3ds BottomFalloff = 0x1; - - -/* Flags for initflags parameter */ -static const ushort3ds InitNoExtras3ds = 0x0000; -static const ushort3ds InitVertexArray3ds = 0x0001; -static const ushort3ds InitTextArray3ds = 0x0002; -static const ushort3ds InitFaceArray3ds = 0x0004; -static const ushort3ds InitMatArray3ds = 0x0008; -static const ushort3ds InitSmoothArray3ds = 0x0010; -static const ushort3ds InitProcData3ds = 0x0020; -static const ushort3ds InitVFlagArray3ds = 0x0040; - - -/* Smoothing group flags used in the smootharray field of the mesh3ds structure */ -static const ulong3ds Smooth01Group3ds = 0x00000001; -static const ulong3ds Smooth02Group3ds = 0x00000002; -static const ulong3ds Smooth03Group3ds = 0x00000004; -static const ulong3ds Smooth04Group3ds = 0x00000008; -static const ulong3ds Smooth05Group3ds = 0x00000010; -static const ulong3ds Smooth06Group3ds = 0x00000020; -static const ulong3ds Smooth07Group3ds = 0x00000030; -static const ulong3ds Smooth08Group3ds = 0x00000080; -static const ulong3ds Smooth09Group3ds = 0x00000100; -static const ulong3ds Smooth10Group3ds = 0x00000200; -static const ulong3ds Smooth11Group3ds = 0x00000400; -static const ulong3ds Smooth12Group3ds = 0x00000800; -static const ulong3ds Smooth13Group3ds = 0x00001000; -static const ulong3ds Smooth14Group3ds = 0x00002000; -static const ulong3ds Smooth15Group3ds = 0x00004000; -static const ulong3ds Smooth16Group3ds = 0x00008000; -static const ulong3ds Smooth17Group3ds = 0x00010000; -static const ulong3ds Smooth18Group3ds = 0x00020000; -static const ulong3ds Smooth19Group3ds = 0x00040000; -static const ulong3ds Smooth20Group3ds = 0x00080000; -static const ulong3ds Smooth21Group3ds = 0x00100000; -static const ulong3ds Smooth22Group3ds = 0x00200000; -static const ulong3ds Smooth23Group3ds = 0x00400000; -static const ulong3ds Smooth24Group3ds = 0x00800000; -static const ulong3ds Smooth25Group3ds = 0x01000000; -static const ulong3ds Smooth26Group3ds = 0x02000000; -static const ulong3ds Smooth27Group3ds = 0x04000000; -static const ulong3ds Smooth28Group3ds = 0x08000000; -static const ulong3ds Smooth29Group3ds = 0x10000000; -static const ulong3ds Smooth30Group3ds = 0x20000000; -static const ulong3ds Smooth31Group3ds = 0x40000000; -static const ulong3ds Smooth32Group3ds = 0x80000000; -static const char3ds *DummyName3ds = "$$$DUMMY"; -/* Flag settings for kfmesh3ds, kfomni3ds, kfcamera3ds, kfambient, and kfspot3ds */ - -/* For the flags field */ -static const ushort3ds KfNodeOff3ds = 1<<3; -static const ushort3ds KfHideNode3ds = 1<<11; -static const ushort3ds KfFastNode3ds = 1<<12; - -/* For the flags2 field */ -static const ushort3ds KfNodeHasPath3ds = 1; -static const ushort3ds KfNodeAutoSmooth3ds = 1<<1; -static const ushort3ds KfNodeFrozen3ds = 1<<2; -static const ushort3ds KfMotionBlur3ds = 1<<4; -static const ushort3ds KfBlurBranch3ds = 1<<5; -static const ushort3ds KfMorphMtl3ds = 1<<6; -static const ushort3ds KfMorphOb = 1<<7; - -typedef enum -{ - LightTarget, - CameraTarget -} targettype3ds; - -static const long3ds TerseDump3ds = 0; /* Just the chunk headers */ -static const long3ds MediumDump3ds = 1; /* Selected bits of data (usually not array dumps) */ -static const long3ds MaximumDump3ds = 2; /* Everything */ -/* Priv */ void PushErrList3ds(errorid3ds id); -/* Priv */ const char3ds *ErrCodeToString3ds(errorid3ds err); -void DumpErrList3ds(FILE *outfile); -void ClearErrList3ds(); -const ErrRec3ds *ReturnErrorList3ds(); - - -/* Functions to use with namelist3ds structures */ -void InitNameList3ds(namelist3ds **chunk, ulong3ds count); -void ReleaseNameList3ds(namelist3ds **chunk); -void AddToNameList3ds(namelist3ds **list_, char3ds *name); - -/* File control functions */ -file3ds *OpenFile3ds(const char3ds *filename, const char *attrib); -file3ds *OpenFile3ds_buf(char3ds *buf, long3ds len); -void CloseAllFiles3ds(); -void CloseFile3ds(file3ds *file); - - -/* Database functions */ -void InitDatabase3ds(database3ds **db); -void ReleaseDatabase3ds(database3ds **db); -void CreateDatabase3ds(file3ds *file, database3ds *db); -void CreateNewDatabase3ds(database3ds *db, dbtype3ds type); -dbtype3ds GetDatabaseType3ds(database3ds *db); -void CopyDatabase3ds(database3ds *idb, database3ds *odb); -void DisconnectDatabase3ds(database3ds *db); -void WriteDatabase3ds(file3ds *file, database3ds *db); -void InitViewport3ds(viewport3ds **vp); -void ReleaseViewport3ds(viewport3ds **vp); -void GetViewport3ds(database3ds *db, viewport3ds **vp); -void PutViewport3ds(database3ds *db, viewport3ds *vp); -void CopyViewport3ds(database3ds *destdb, database3ds *srcdb); -void InitMeshSet3ds(meshset3ds **); -void ReleaseMeshSet3ds(meshset3ds **); -void GetMeshSet3ds(database3ds *, meshset3ds **); -void PutMeshSet3ds(database3ds *db, meshset3ds *settings); -void CopyMeshSet3ds(database3ds *destdb, database3ds *srcdb); - -void InitAtmosphere3ds(atmosphere3ds **atmo); -void ReleaseAtmosphere3ds(atmosphere3ds **atmo); -void GetAtmosphere3ds(database3ds *db, atmosphere3ds **atmo); -void PutAtmosphere3ds(database3ds *db, atmosphere3ds *atmo); -void CopyAtmosphere3ds(database3ds *destdb, database3ds *srcdb); - -void InitBackground3ds(background3ds **bgnd); -void ReleaseBackground3ds(background3ds **bgnd); -void GetBackground3ds(database3ds *db, background3ds **bgnd); -void PutBackground3ds(database3ds *db, background3ds *bgnd); -void CopyBackground3ds(database3ds *destdb, database3ds *srcdb); - -short3ds AddMaterial3ds(const material3ds *mat); -void InitBitmap3ds(bitmap3ds *map_); -short3ds InitMaterial3ds(material3ds **mat); -void ReleaseMaterial3ds(material3ds **mat); -ulong3ds GetMaterialCount3ds(database3ds *db); -void GetMaterialNameList3ds(database3ds *db, namelist3ds **list_); -void GetMaterialByIndex3ds(database3ds *db, ulong3ds index, material3ds **mat); -void GetMaterialByName3ds(database3ds *db, char3ds *name, material3ds **mat); -void PutMaterial3ds(database3ds *db, material3ds *mat); -void CopyMaterialByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyMaterialByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteMaterialByName3ds(database3ds *db, char3ds *name); -void DeleteMaterialByIndex3ds(database3ds *db, ulong3ds index); -void InitMeshObj3ds(mesh3ds **obj, ushort3ds nvertices, ushort3ds nfaces, ushort3ds iniflags); -void InitMeshObjField3ds(mesh3ds *obj, ushort3ds const initflags); -void InitMatArrayIndex3ds (mesh3ds *obj, ushort3ds mat, ushort3ds nfaces); - -/* Mesh object functions */ -ulong3ds GetMeshCount3ds(database3ds *db); -void GetMeshNameList3ds(database3ds *db, namelist3ds **list_); -void GetMeshByIndex3ds(database3ds *db, ulong3ds index, mesh3ds **mesh); -void GetMeshByName3ds(database3ds *db, char3ds *name, mesh3ds **mesh); -void PutMesh3ds(database3ds *db, mesh3ds *mesh); -void CopyMeshByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyMeshByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteMeshByName3ds(database3ds *db, char3ds *name); -void DeleteMeshByIndex3ds(database3ds *db, ulong3ds index); -void RelMeshObj3ds(mesh3ds **obj); - -/* Light related functions */ -void InitLight3ds(light3ds **light); -void InitSpotlight3ds(light3ds **spotlight); -void ReleaseLight3ds(light3ds **light); -ulong3ds GetOmnilightCount3ds(database3ds *db); -ulong3ds GetSpotlightCount3ds(database3ds *db); -void GetOmnilightNameList3ds(database3ds *db, namelist3ds **list_); -void GetSpotlightNameList3ds(database3ds *db, namelist3ds **list_); -void GetSpotlightByIndex3ds(database3ds *db, long3ds index, light3ds **light); -void GetOmnilightByIndex3ds(database3ds *db, long3ds index, light3ds **light); -void GetSpotlightByName3ds(database3ds *db, char3ds *name, light3ds **light); -void GetOmnilightByName3ds(database3ds *db, char3ds *name, light3ds **light); -void PutSpotlight3ds(database3ds *db, light3ds *light); -void PutOmnilight3ds(database3ds *db, light3ds *light); -void CopySpotlightByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopySpotlightByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyOmnilightByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyOmnilightByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteSpotlightByIndex3ds(database3ds *db, ulong3ds index); -void DeleteOmnilightByIndex3ds(database3ds *db, ulong3ds index); -void DeleteSpotlightByName3ds(database3ds *db, char3ds *name); -void DeleteOmnilightByName3ds(database3ds *db, char3ds *name); -void InitCamera3ds(camera3ds **cam); -void ReleaseCamera3ds(camera3ds **cam); -ulong3ds GetCameraCount3ds(database3ds *db); -void GetCameraNameList3ds(database3ds *db, namelist3ds **list_); -void GetCameraByIndex3ds(database3ds *db, ulong3ds index, camera3ds **cam); -void GetCameraByName3ds(database3ds *db, char3ds *name, camera3ds **cam); -void PutCamera3ds(database3ds *db, camera3ds *cam); - -void CopyCameraByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyCameraByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); - -void DeleteCameraByName3ds(database3ds *db, char3ds *name); -void DeleteCameraByIndex3ds(database3ds *db, ulong3ds index); - -void InitKfSets3ds(kfsets3ds **key); -void ReleaseKfSets3ds(kfsets3ds **key); -void PutKfSets3ds(database3ds *db, kfsets3ds *key); -void GetKfSets3ds(database3ds *db, kfsets3ds **key); -void CopyKfSets3ds(database3ds *destdb, database3ds *srcdb); - - -void InitCameraMotion3ds(kfcamera3ds **cam, ulong3ds npkeys, ulong3ds nfkeys, - ulong3ds nrkeys, ulong3ds ntkeys); - -void GetCameraMotionByName3ds(database3ds *db, - const char3ds *name, - kfcamera3ds **kfcam); - -void GetCameraMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfcamera3ds **kfcam); - -void PutCameraMotion3ds(database3ds *db, kfcamera3ds *kfcam); - - -void ReleaseCameraMotion3ds(kfcamera3ds **cam); - -ulong3ds GetCameraNodeCount3ds(database3ds *db); - -void GetCameraNodeNameList3ds(database3ds *db, namelist3ds **list_); - -void DeleteCameraMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteCameraMotionByName3ds(database3ds *db, char3ds *name); -void CopyCameraMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyCameraMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); - - -/* Ambient Light Animation Functions */ -void InitAmbientLightMotion3ds(kfambient3ds **light, ulong3ds nckeys); -void ReleaseAmbientLightMotion3ds(kfambient3ds **light); -void GetAmbientLightMotion3ds(database3ds *db, kfambient3ds **kfambient); -void PutAmbientLightMotion3ds(database3ds *db, kfambient3ds *kfambient); -void DeleteAmbientLightMotion3ds(database3ds *db); -void CopyAmbientLightMotion3ds(database3ds *destdb, database3ds *srcdb); -void InitObjectMotion3ds(kfmesh3ds **obj, - ulong3ds npkeys, - ulong3ds nrkeys, - ulong3ds nskeys, - ulong3ds nmkeys, - ulong3ds nhkeys); - -void ReleaseObjectMotion3ds(kfmesh3ds **obj); - -void GetObjectNodeNameList3ds(database3ds *db, - namelist3ds **list_); - -ulong3ds GetObjectNodeCount3ds(database3ds *db); - -void GetObjectMotionByName3ds(database3ds *db, - char3ds *name, - kfmesh3ds **kfmesh); - -void GetObjectMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfmesh3ds **kfmesh); - -void PutObjectMotion3ds(database3ds *db, - kfmesh3ds *kfmesh); - -void DeleteObjectMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteObjectMotionByName3ds(database3ds *db, char3ds *name); -void CopyObjectMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyObjectMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void InitOmnilightMotion3ds(kfomni3ds **light, - ulong3ds npkeys, - ulong3ds nckeys); - -void ReleaseOmnilightMotion3ds(kfomni3ds **light); - -void GetOmnilightNodeNameList3ds(database3ds *db, - namelist3ds **list_); - -void GetOmnilightMotionByName3ds(database3ds *db, - char3ds *name, - kfomni3ds **kfomni); - -void GetOmnilightMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfomni3ds **kfomni); - -ulong3ds GetOmnilightNodeCount3ds(database3ds *db); - -void PutOmnilightMotion3ds(database3ds *db, - kfomni3ds *kfomni); - -void PutOmnilightMotion3ds(database3ds *db, - kfomni3ds *kfomni); - -void DeleteOmnilightMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteOmnilightMotionByName3ds(database3ds *db, char3ds *name); -void CopyOmnilightMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyOmnilightMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void InitSpotlightMotion3ds(kfspot3ds **spot, - ulong3ds npkeys, - ulong3ds nckeys, - ulong3ds nhkeys, - ulong3ds nfkeys, - ulong3ds nrkeys, - ulong3ds ntkeys); - -void ReleaseSpotlightMotion3ds(kfspot3ds **spot); - -void GetSpotlightNodeNameList3ds(database3ds *db, - namelist3ds **list_); - -ulong3ds GetSpotlightNodeCount3ds(database3ds *db); - -void GetSpotlightMotionByName3ds(database3ds *db, - char3ds *name, - kfspot3ds **kfspot); - -void PutSpotlightMotion3ds(database3ds *db, - kfspot3ds *kfspot); - -void GetSpotlightMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfspot3ds **kfspot); - -void DeleteSpotlightMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteSpotlightMotionByName3ds(database3ds *db, char3ds *name); -void CopySpotlightMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopySpotlightMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); - -void FillMatrix3ds(mesh3ds *obj); -void SetBoundBox3ds(const mesh3ds *mobj, kfmesh3ds *kobj ); -void DumpMapInfo3ds(FILE *out, mapinfo3ds *map_, long3ds dumplevel); -void DumpMesh3ds(FILE *out, mesh3ds *mesh, long3ds dumplevel); -void DumpMaterial3ds(FILE *out, material3ds *mat, long3ds dumplevel); -void DumpBitmap3ds(FILE *out, bitmap3ds *map_, long3ds dumplevel); -void SetDumpLevel3ds(long3ds newlevel); -void DumpDatabase3ds(FILE *outfile, database3ds *db); -void GetMeshXDataByName3ds(database3ds *db, char3ds *meshname, char3ds *appname, xdataraw3ds **data); -ulong3ds GetMeshXDataCount3ds(database3ds *db, char3ds *meshname); -#ifdef __cplusplus -} -#endif - -#endif diff --git a/3rdparty/3dsftk3/CMakeLists.txt b/3rdparty/3dsftk3/CMakeLists.txt deleted file mode 100644 index 9607cd34..00000000 --- a/3rdparty/3dsftk3/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -project(3dsftk3 C) - -add_library(3dsftk3 - src/3dsambm.c - src/3dsambm.h - src/3dsaset.c - src/3dsaset.h - src/3dsbbox.c - src/3dsbbox.h - src/3dsbgnd.c - src/3dsbgnd.h - src/3dscamm.c - src/3dscamm.h - src/3dscamr.c - src/3dscamr.h - src/3dserr.c - src/3dserr.h - src/3dsfile.c - src/3dsfile.h - src/3dsftkst.h - src/3dshier.c - src/3dshier.h - src/3dsiobj.c - src/3dsiobj.h - src/3dskey.c - src/3dskey.h - src/3dslites.c - src/3dslites.h - src/3dsmatr.c - src/3dsmatr.h - src/3dsmatx.c - src/3dsmatx.h - src/3dsmobj.c - src/3dsmobj.h - src/3dsmset.c - src/3dsmset.h - src/3dsobjm.c - src/3dsobjm.h - src/3dsomnm.c - src/3dsomnm.h - src/3dsprim.c - src/3dsprim.h - src/3dsrange.h - src/3dsrobj.c - src/3dsrobj.h - src/3dssptm.c - src/3dssptm.h - src/3dsstrlf.c - src/3dsstrlf.h - src/3dstype.h - src/3dsutil.c - src/3dsutil.h - src/3dsvers.c - src/3dsvers.h - src/3dsvprt.c - src/3dsvprt.h - src/assert.c - src/chunk3ds.c - src/chunk3ds.h - src/chunkinf.h - src/dbase3ds.c - src/dbase3ds.h - src/dumpchnk.c - src/dumpchnk.h - src/dumpsrc.c - src/dumpsrc.h - src/dumpstr.c - src/dumpstr.h - src/ftkhead.h - src/ftktail.h - src/kdata3ds.c - src/kdata3ds.h - src/kfutils.c - src/kfutils.h - src/mdata3ds.c - src/mdata3ds.h - src/seekchil.c - src/seekchil.h - src/smartall.c - src/smartall.h - src/strcmpi.c - src/strcmpi.h - src/strdup.c - src/swapbyte.c - src/swapbyte.h - src/xdata.c - src/xdata.h -) - -target_include_directories(3dsftk3 PUBLIC include) diff --git a/3rdparty/3dsftk3/include/3dsftk.h b/3rdparty/3dsftk3/include/3dsftk.h deleted file mode 100644 index 46696ec0..00000000 --- a/3rdparty/3dsftk3/include/3dsftk.h +++ /dev/null @@ -1,1997 +0,0 @@ -/************************************************************************** - * 3DSFTK.H - 3D Studio File Toolkit for Release 3 library header - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#ifndef FTK3DS_H -#define FTK3DS_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Note: Item's prefixed with a "Priv" comment are internally used, are not - part of the toolkit's published interface, and should not be used - by non-ftk library functions */ - - -/* Data Type Synonyms For Portability */ - -#define char3ds char -#define uchar3ds unsigned char -#define byte3ds char -#define ubyte3ds unsigned char -#define short3ds int16_t -#define ushort3ds uint16_t -#define long3ds int32_t -#define ulong3ds uint32_t -#define float3ds float -#define double3ds double -#define int3ds int -#define void3ds void - -/* 3DS File Toolkit revision level. Future revisions will increment this - integer number */ -#define FTKRevisionLevel3ds 2 - -/*------------------------------------ - Error reporting and testing macros - ----------------------------------*/ - -/* Pending error flag values for ftkerr3ds global */ -#define FTK_ERROR True3ds -#define FTK_NO_ERROR False3ds - -/*--- If ftkerr3ds shows that an error has occured, return */ -#define ON_ERROR_RETURN {if(ftkerr3ds && !ignoreftkerr3ds) return;} -#define ON_ERROR_RETURNR(rval) {if(ftkerr3ds && !ignoreftkerr3ds) return rval;} - -/*--- If ftkerr3ds shows that an error has occured, push error and return */ -#define ADD_ERROR_RETURN(id) {if(ftkerr3ds){PushErrList3ds(id); if (!ignoreftkerr3ds) return;}} -#define ADD_ERROR_RETURNR(id, rval) {if(ftkerr3ds){PushErrList3ds(id); if (!ignoreftkerr3ds) return rval;}} - -/*--- If ftkerr3ds shows that an error has occured, push error */ -#define ADD_ERROR(id) {if (ftkerr3ds){PushErrList3ds(id);}} - -/*--- Reset the the error flag */ -#define CLEAR_ERROR {if (ftkerr3ds){ClearErrList3ds();}} - -/*--- Simply set the error state: Good if you need to clean-up before returning */ -#define SET_ERROR {ftkerr3ds=True3ds;} - -/*--- Set error state, push an error ID and return */ -#define SET_ERROR_RETURN(id) {PushErrList3ds(id); if (!ignoreftkerr3ds) return;} -#define SET_ERROR_RETURNR(id, rval) {PushErrList3ds(id); if (!ignoreftkerr3ds) return rval;} - -/* Prints errors and exits application */ -#define PRINT_ERRORS_EXIT(file) {if(ftkerr3ds){DumpErrList3ds(file); if (!ignoreftkerr3ds) exit(-1);}} - -/*---------------------------------------- - Commonly used structures and constants - --------------------------------------*/ - -/* Constants to define True and False in a compiler independant way. */ -#define TRUE3DS (1==1) -#define FALSE3DS (1!=1) -static const byte3ds True3ds = (1==1); -static const byte3ds False3ds = (1!=1); - -/* point3ds - 3D point structure */ -typedef struct -{ - float3ds x, y, z; -} point3ds; - -/* fcolor3ds - Floating point color definition */ -typedef struct { - float3ds r; /* RGB Color components */ - float3ds g; - float3ds b; -} fcolor3ds; - -/* face3ds - Face list element */ -typedef struct -{ - ushort3ds v1, v2, v3, flag; -} face3ds; - -/* textvert3ds - Texture assignment coordinate */ -typedef struct -{ - float3ds u, v; -} textvert3ds; -/* Priv */ /* trackheader3ds - Global track settings */ -/* Priv */ typedef struct -/* Priv */ { -/* Priv */ ushort3ds flags; -/* Priv */ ulong3ds nu1, nu2; -/* Priv */ ulong3ds keycount; /* Number of keys in the track */ -/* Priv */ } trackheader3ds; - -/* keyheader3ds - Animation key settings */ -typedef struct -{ - ulong3ds time; /* Key's frame position */ - ushort3ds rflags; /* Spline terms used flag */ - float3ds tension; /* Flagged with 0x01 */ - float3ds continuity; /* Flagged with 0x02 */ - float3ds bias; /* Flagged with 0x04 */ - float3ds easeto; /* Flagged with 0x08 */ - float3ds easefrom; /* Flagged with 0x10 */ -} keyheader3ds; - -/* kfrotkey3ds - Rotation key */ -typedef struct { - float3ds angle; /* angle of rotation */ - float3ds x; /* rotation axis vector */ - float3ds y; - float3ds z; -} kfrotkey3ds; - -/* kfmorphkey3ds - Object morph key */ -typedef struct { - char3ds name[13]; /* name of target morph object */ -} kfmorphkey3ds; - - -/* Error codes generated by toolkit */ -typedef enum -{ - NO_FTK_ERRORS = 0, /* No errors are pending */ - ERR_NO_MEM, /* Not enough memory to complete operation */ - ERR_INVALID_ARG, /* The argument passed to the function invalid. Usually */ - /* caused by a NULL pointer or an out of range numeric */ - /* argument. */ - ERR_INVALID_DATA, /* The structure passed as an argument to the function has */ - /* invalid or out of range data in its fields. */ - ERR_INVALID_CHUNK, /* An invalid chunk structure was encountered while reading */ - /* the database. Usually caused by a corrupt database or */ - /* file */ - ERR_INVALID_DATABASE, /* The database passed as an argument has not be created */ - /* yet. */ - ERR_WRONG_DATABASE, /* The database passed as an argument is the wrong kind of */ - /* database for this function. */ - ERR_UNFOUND_CHUNK, /* The database is missing important file chunks needed to */ - /* fill out the requested structure. Usually caused by a */ - /* corrupt database or file */ - ERR_WRONG_OBJECT, /* The name passed to the functions exists, but is not the */ - /* type of object asked for. For example, asking for a mesh */ - /* object with the GetCameraByName3ds function. */ - ERR_NO_SUCH_FILE, /* The filename passed as an argument for reading does not exist */ - ERR_INIT_FAILED, /* Failed to initialize structure passed as an argument */ - ERR_OPENING_FILE, /* Could not open requested file */ - ERR_CLOSING_FILE, /* Could not close requested file */ - ERR_READING_FILE, /* Error occured while reading file */ - ERR_CREATING_DATABASE, /* Error occured while creating database */ - ERR_READING_DATABASE, /* Error occured while reading database */ - ERR_WRITING_DATABASE, /* Error occured while writing database */ - ERR_WRITING_FILE, /* Error occured while writing file */ - ERR_STRING_TOO_LONG, /* String encountered in file, structure, or as an */ - /* argument was longer than expected. Possibly caused by */ - /* an uninitialed pointer, corrupt file or database */ - ERR_TOO_MANY_FILES, /* The toolkit has reached its maximum open file limit of */ - /* 252 files. */ - ERR_GET_FAIL, /* Failed to get new data from database */ - ERR_PUT_FAIL, /* Failed to add new data to the database */ - N_ERRORS -}errorid3ds; - -typedef struct { - errorid3ds id; - const char3ds *desc; -} ErrRec3ds; - - -/* Priv */ /* chunktag3ds - enumeration of all possible chunk type identifiers. See appendix for */ -/* Priv */ /* more information concerning chunk structures */ -/* Priv */ typedef enum -/* Priv */ { -/* Priv */ /* Trick Chunk Flags For ChunkSyntax function */ - -/* Priv */ NULL_CHUNK = 0x0000, -/* Priv */ ChunkType = 0x0995, -/* Priv */ ChunkUnique = 0x0996, -/* Priv */ NotChunk = 0x0997, -/* Priv */ Container = 0x0998, -/* Priv */ IsChunk = 0x0999, - -/* Priv */ /* Dummy Chunk that sometimes appears in 3ds files created by prerelease 3D Studio R2 */ -/* Priv */ DUMMY = 0xFFFF, - -/* Priv */ /* Trick Chunk Types For Open*, Write*, Close* functions */ - -/* Priv */ POINT_ARRAY_ENTRY = 0xF110, -/* Priv */ POINT_FLAG_ARRAY_ENTRY = 0xF111, -/* Priv */ FACE_ARRAY_ENTRY = 0xF120, -/* Priv */ MSH_MAT_GROUP_ENTRY = 0xF130, -/* Priv */ TEX_VERTS_ENTRY = 0xF140, -/* Priv */ SMOOTH_GROUP_ENTRY = 0xF150, -/* Priv */ POS_TRACK_TAG_KEY = 0xF020, -/* Priv */ ROT_TRACK_TAG_KEY = 0xF021, -/* Priv */ SCL_TRACK_TAG_KEY = 0xF022, -/* Priv */ FOV_TRACK_TAG_KEY = 0xF023, -/* Priv */ ROLL_TRACK_TAG_KEY = 0xF024, -/* Priv */ COL_TRACK_TAG_KEY = 0xF025, -/* Priv */ MORPH_TRACK_TAG_KEY = 0xF026, -/* Priv */ HOT_TRACK_TAG_KEY = 0xF027, -/* Priv */ FALL_TRACK_TAG_KEY = 0xF028, -/* Priv */ -/* Priv */ /* 3DS File Chunk IDs */ - -/* Priv */ M3DMAGIC = 0x4D4D, -/* Priv */ SMAGIC = 0x2D2D, -/* Priv */ LMAGIC = 0x2D3D, -/* Priv */ MLIBMAGIC = 0x3DAA, -/* Priv */ MATMAGIC = 0x3DFF, -/* Priv */ M3D_VERSION = 0x0002, -/* Priv */ M3D_KFVERSION = 0x0005, - -/* Priv */ /* Mesh Chunk Ids */ - -/* Priv */ MDATA = 0x3D3D, -/* Priv */ MESH_VERSION = 0x3D3E, -/* Priv */ COLOR_F = 0x0010, -/* Priv */ COLOR_24 = 0x0011, -/* Priv */ LIN_COLOR_24 = 0x0012, -/* Priv */ LIN_COLOR_F = 0x0013, -/* Priv */ INT_PERCENTAGE = 0x0030, -/* Priv */ FLOAT_PERCENTAGE = 0x0031, - -/* Priv */ MASTER_SCALE = 0x0100, - -/* Priv */ BIT_MAP = 0x1100, -/* Priv */ USE_BIT_MAP = 0x1101, -/* Priv */ SOLID_BGND = 0x1200, -/* Priv */ USE_SOLID_BGND = 0x1201, -/* Priv */ V_GRADIENT = 0x1300, -/* Priv */ USE_V_GRADIENT = 0x1301, - -/* Priv */ LO_SHADOW_BIAS = 0x1400, -/* Priv */ HI_SHADOW_BIAS = 0x1410, -/* Priv */ SHADOW_MAP_SIZE = 0x1420, -/* Priv */ SHADOW_SAMPLES = 0x1430, -/* Priv */ SHADOW_RANGE = 0x1440, -/* Priv */ SHADOW_FILTER = 0x1450, -/* Priv */ RAY_BIAS = 0x1460, -/* Priv */ -/* Priv */ O_CONSTS = 0x1500, -/* Priv */ -/* Priv */ AMBIENT_LIGHT = 0x2100, - -/* Priv */ FOG = 0x2200, -/* Priv */ USE_FOG = 0x2201, -/* Priv */ FOG_BGND = 0x2210, -/* Priv */ DISTANCE_CUE = 0x2300, -/* Priv */ USE_DISTANCE_CUE = 0x2301, -/* Priv */ LAYER_FOG = 0x2302, -/* Priv */ USE_LAYER_FOG = 0x2303, -/* Priv */ DCUE_BGND = 0x2310, - -/* Priv */ DEFAULT_VIEW = 0x3000, -/* Priv */ VIEW_TOP = 0x3010, -/* Priv */ VIEW_BOTTOM = 0x3020, -/* Priv */ VIEW_LEFT = 0x3030, -/* Priv */ VIEW_RIGHT = 0x3040, -/* Priv */ VIEW_FRONT = 0x3050, -/* Priv */ VIEW_BACK = 0x3060, -/* Priv */ VIEW_USER = 0x3070, -/* Priv */ VIEW_CAMERA = 0x3080, -/* Priv */ VIEW_WINDOW = 0x3090, - -/* Priv */ NAMED_OBJECT = 0x4000, -/* Priv */ OBJ_HIDDEN = 0x4010, -/* Priv */ OBJ_VIS_LOFTER = 0x4011, -/* Priv */ OBJ_DOESNT_CAST = 0x4012, -/* Priv */ OBJ_MATTE = 0x4013, -/* Priv */ OBJ_FAST = 0x4014, -/* Priv */ OBJ_PROCEDURAL = 0x4015, -/* Priv */ OBJ_FROZEN = 0x4016, -/* Priv */ OBJ_DONT_RCVSHADOW = 0x4017, - -/* Priv */ N_TRI_OBJECT = 0x4100, - -/* Priv */ POINT_ARRAY = 0x4110, -/* Priv */ POINT_FLAG_ARRAY = 0x4111, -/* Priv */ FACE_ARRAY = 0x4120, -/* Priv */ MSH_MAT_GROUP = 0x4130, -/* Priv */ OLD_MAT_GROUP = 0x4131, -/* Priv */ TEX_VERTS = 0x4140, -/* Priv */ SMOOTH_GROUP = 0x4150, -/* Priv */ MESH_MATRIX = 0x4160, -/* Priv */ MESH_COLOR = 0x4165, -/* Priv */ MESH_TEXTURE_INFO = 0x4170, -/* Priv */ PROC_NAME = 0x4181, -/* Priv */ PROC_DATA = 0x4182, -/* Priv */ MSH_BOXMAP = 0x4190, - -/* Priv */ N_D_L_OLD = 0x4400, - -/* Priv */ N_CAM_OLD = 0x4500, - -/* Priv */ N_DIRECT_LIGHT = 0x4600, -/* Priv */ DL_SPOTLIGHT = 0x4610, -/* Priv */ DL_OFF = 0x4620, -/* Priv */ DL_ATTENUATE = 0x4625, -/* Priv */ DL_RAYSHAD = 0x4627, -/* Priv */ DL_SHADOWED = 0x4630, -/* Priv */ DL_LOCAL_SHADOW = 0x4640, -/* Priv */ DL_LOCAL_SHADOW2 = 0x4641, -/* Priv */ DL_SEE_CONE = 0x4650, -/* Priv */ DL_SPOT_RECTANGULAR = 0x4651, -/* Priv */ DL_SPOT_OVERSHOOT = 0x4652, -/* Priv */ DL_SPOT_PROJECTOR = 0x4653, -/* Priv */ DL_EXCLUDE = 0x4654, -/* Priv */ DL_RANGE = 0x4655, /* Not used in R3 */ -/* Priv */ DL_SPOT_ROLL = 0x4656, -/* Priv */ DL_SPOT_ASPECT = 0x4657, -/* Priv */ DL_RAY_BIAS = 0x4658, -/* Priv */ DL_INNER_RANGE = 0x4659, -/* Priv */ DL_OUTER_RANGE = 0x465A, -/* Priv */ DL_MULTIPLIER = 0x465B, - -/* Priv */ N_AMBIENT_LIGHT = 0x4680, - -/* Priv */ N_CAMERA = 0x4700, -/* Priv */ CAM_SEE_CONE = 0x4710, -/* Priv */ CAM_RANGES = 0x4720, - -/* Priv */ HIERARCHY = 0x4F00, -/* Priv */ PARENT_OBJECT = 0x4F10, -/* Priv */ PIVOT_OBJECT = 0x4F20, -/* Priv */ PIVOT_LIMITS = 0x4F30, -/* Priv */ PIVOT_ORDER = 0x4F40, -/* Priv */ XLATE_RANGE = 0x4F50, - -/* Priv */ POLY_2D = 0x5000, - -/* Priv */ /* Flags in shaper file that tell whether polys make up an ok shape */ - -/* Priv */ SHAPE_OK = 0x5010, -/* Priv */ SHAPE_NOT_OK = 0x5011, - -/* Priv */ SHAPE_HOOK = 0x5020, - -/* Priv */ PATH_3D = 0x6000, -/* Priv */ PATH_MATRIX = 0x6005, -/* Priv */ SHAPE_2D = 0x6010, -/* Priv */ M_SCALE = 0x6020, -/* Priv */ M_TWIST = 0x6030, -/* Priv */ M_TEETER = 0x6040, -/* Priv */ M_FIT = 0x6050, -/* Priv */ M_BEVEL = 0x6060, -/* Priv */ XZ_CURVE = 0x6070, -/* Priv */ YZ_CURVE = 0x6080, -/* Priv */ INTERPCT = 0x6090, -/* Priv */ DEFORM_LIMIT = 0x60A0, - -/* Priv */ /* Flags for Modeler options */ - -/* Priv */ USE_CONTOUR = 0x6100, -/* Priv */ USE_TWEEN = 0x6110, -/* Priv */ USE_SCALE = 0x6120, -/* Priv */ USE_TWIST = 0x6130, -/* Priv */ USE_TEETER = 0x6140, -/* Priv */ USE_FIT = 0x6150, -/* Priv */ USE_BEVEL = 0x6160, - -/* Priv */ /* Viewport description chunks */ - -/* Priv */ VIEWPORT_LAYOUT_OLD = 0x7000, -/* Priv */ VIEWPORT_DATA_OLD = 0x7010, -/* Priv */ VIEWPORT_LAYOUT = 0x7001, -/* Priv */ VIEWPORT_DATA = 0x7011, -/* Priv */ VIEWPORT_DATA_3 = 0x7012, -/* Priv */ VIEWPORT_SIZE = 0x7020, -/* Priv */ NETWORK_VIEW = 0x7030, - -/* Priv */ /* External Application Data */ - -/* Priv */ XDATA_SECTION = 0x8000, -/* Priv */ XDATA_ENTRY = 0x8001, -/* Priv */ XDATA_APPNAME = 0x8002, -/* Priv */ XDATA_STRING = 0x8003, -/* Priv */ XDATA_FLOAT = 0x8004, -/* Priv */ XDATA_DOUBLE = 0x8005, -/* Priv */ XDATA_SHORT = 0x8006, -/* Priv */ XDATA_LONG = 0x8007, -/* Priv */ XDATA_VOID = 0x8008, -/* Priv */ XDATA_GROUP = 0x8009, -/* Priv */ XDATA_RFU6 = 0x800A, -/* Priv */ XDATA_RFU5 = 0x800B, -/* Priv */ XDATA_RFU4 = 0x800C, -/* Priv */ XDATA_RFU3 = 0x800D, -/* Priv */ XDATA_RFU2 = 0x800E, -/* Priv */ XDATA_RFU1 = 0x800F, -/* Priv */ -/* Priv */ PARENT_NAME = 0x80F0, - -/* Priv */ /* Material Chunk IDs */ - -/* Priv */ MAT_ENTRY = 0xAFFF, -/* Priv */ MAT_NAME = 0xA000, -/* Priv */ MAT_AMBIENT = 0xA010, -/* Priv */ MAT_DIFFUSE = 0xA020, -/* Priv */ MAT_SPECULAR = 0xA030, -/* Priv */ MAT_SHININESS = 0xA040, -/* Priv */ MAT_SHIN2PCT = 0xA041, -/* Priv */ MAT_SHIN3PCT = 0xA042, -/* Priv */ MAT_TRANSPARENCY = 0xA050, -/* Priv */ MAT_XPFALL = 0xA052, -/* Priv */ MAT_REFBLUR = 0xA053, - -/* Priv */ MAT_SELF_ILLUM = 0xA080, -/* Priv */ MAT_TWO_SIDE = 0xA081, -/* Priv */ MAT_DECAL = 0xA082, -/* Priv */ MAT_ADDITIVE = 0xA083, -/* Priv */ MAT_SELF_ILPCT = 0xA084, -/* Priv */ MAT_WIRE = 0xA085, -/* Priv */ MAT_SUPERSMP = 0xA086, -/* Priv */ MAT_WIRESIZE = 0xA087, -/* Priv */ MAT_FACEMAP = 0xA088, -/* Priv */ MAT_XPFALLIN = 0xA08A, -/* Priv */ MAT_PHONGSOFT = 0xA08C, -/* Priv */ MAT_WIREABS = 0xA08E, - -/* Priv */ MAT_SHADING = 0xA100, - -/* Priv */ MAT_TEXMAP = 0xA200, -/* Priv */ MAT_OPACMAP = 0xA210, -/* Priv */ MAT_REFLMAP = 0xA220, -/* Priv */ MAT_BUMPMAP = 0xA230, -/* Priv */ MAT_SPECMAP = 0xA204, -/* Priv */ MAT_USE_XPFALL = 0xA240, -/* Priv */ MAT_USE_REFBLUR = 0xA250, -/* Priv */ MAT_BUMP_PERCENT = 0xA252, - -/* Priv */ MAT_MAPNAME = 0xA300, -/* Priv */ MAT_ACUBIC = 0xA310, - -/* Priv */ MAT_SXP_TEXT_DATA = 0xA320, -/* Priv */ MAT_SXP_TEXT2_DATA = 0xA321, -/* Priv */ MAT_SXP_OPAC_DATA = 0xA322, -/* Priv */ MAT_SXP_BUMP_DATA = 0xA324, -/* Priv */ MAT_SXP_SPEC_DATA = 0xA325, -/* Priv */ MAT_SXP_SHIN_DATA = 0xA326, -/* Priv */ MAT_SXP_SELFI_DATA = 0xA328, -/* Priv */ MAT_SXP_TEXT_MASKDATA = 0xA32A, -/* Priv */ MAT_SXP_TEXT2_MASKDATA = 0xA32C, -/* Priv */ MAT_SXP_OPAC_MASKDATA = 0xA32E, -/* Priv */ MAT_SXP_BUMP_MASKDATA = 0xA330, -/* Priv */ MAT_SXP_SPEC_MASKDATA = 0xA332, -/* Priv */ MAT_SXP_SHIN_MASKDATA = 0xA334, -/* Priv */ MAT_SXP_SELFI_MASKDATA = 0xA336, -/* Priv */ MAT_SXP_REFL_MASKDATA = 0xA338, -/* Priv */ MAT_TEX2MAP = 0xA33A, -/* Priv */ MAT_SHINMAP = 0xA33C, -/* Priv */ MAT_SELFIMAP = 0xA33D, -/* Priv */ MAT_TEXMASK = 0xA33E, -/* Priv */ MAT_TEX2MASK = 0xA340, -/* Priv */ MAT_OPACMASK = 0xA342, -/* Priv */ MAT_BUMPMASK = 0xA344, -/* Priv */ MAT_SHINMASK = 0xA346, -/* Priv */ MAT_SPECMASK = 0xA348, -/* Priv */ MAT_SELFIMASK = 0xA34A, -/* Priv */ MAT_REFLMASK = 0xA34C, -/* Priv */ MAT_MAP_TILINGOLD = 0xA350, -/* Priv */ MAT_MAP_TILING = 0xA351, -/* Priv */ MAT_MAP_TEXBLUR_OLD = 0xA352, -/* Priv */ MAT_MAP_TEXBLUR = 0xA353, -/* Priv */ MAT_MAP_USCALE = 0xA354, -/* Priv */ MAT_MAP_VSCALE = 0xA356, -/* Priv */ MAT_MAP_UOFFSET = 0xA358, -/* Priv */ MAT_MAP_VOFFSET = 0xA35A, -/* Priv */ MAT_MAP_ANG = 0xA35C, -/* Priv */ MAT_MAP_COL1 = 0xA360, -/* Priv */ MAT_MAP_COL2 = 0xA362, -/* Priv */ MAT_MAP_RCOL = 0xA364, -/* Priv */ MAT_MAP_GCOL = 0xA366, -/* Priv */ MAT_MAP_BCOL = 0xA368, - -/* Priv */ /* Keyframe Chunk IDs */ - -/* Priv */ KFDATA = 0xB000, -/* Priv */ KFHDR = 0xB00A, -/* Priv */ AMBIENT_NODE_TAG = 0xB001, -/* Priv */ OBJECT_NODE_TAG = 0xB002, -/* Priv */ CAMERA_NODE_TAG = 0xB003, -/* Priv */ TARGET_NODE_TAG = 0xB004, -/* Priv */ LIGHT_NODE_TAG = 0xB005, -/* Priv */ L_TARGET_NODE_TAG = 0xB006, -/* Priv */ SPOTLIGHT_NODE_TAG = 0xB007, - -/* Priv */ KFSEG = 0xB008, -/* Priv */ KFCURTIME = 0xB009, -/* Priv */ NODE_HDR = 0xB010, -/* Priv */ INSTANCE_NAME = 0xB011, -/* Priv */ PRESCALE = 0xB012, -/* Priv */ PIVOT = 0xB013, -/* Priv */ BOUNDBOX = 0xB014, -/* Priv */ MORPH_SMOOTH = 0xB015, -/* Priv */ POS_TRACK_TAG = 0xB020, -/* Priv */ ROT_TRACK_TAG = 0xB021, -/* Priv */ SCL_TRACK_TAG = 0xB022, -/* Priv */ FOV_TRACK_TAG = 0xB023, -/* Priv */ ROLL_TRACK_TAG = 0xB024, -/* Priv */ COL_TRACK_TAG = 0xB025, -/* Priv */ MORPH_TRACK_TAG = 0xB026, -/* Priv */ HOT_TRACK_TAG = 0xB027, -/* Priv */ FALL_TRACK_TAG = 0xB028, -/* Priv */ HIDE_TRACK_TAG = 0xB029, -/* Priv */ NODE_ID = 0xB030, -/* Priv */ -/* Priv */ CMAGIC = 0xC23D, - -/* Priv */ C_MDRAWER = 0xC010, -/* Priv */ C_TDRAWER = 0xC020, -/* Priv */ C_SHPDRAWER = 0xC030, -/* Priv */ C_MODDRAWER = 0xC040, -/* Priv */ C_RIPDRAWER = 0xC050, -/* Priv */ C_TXDRAWER = 0xC060, -/* Priv */ C_PDRAWER = 0xC062, -/* Priv */ C_MTLDRAWER = 0xC064, -/* Priv */ C_FLIDRAWER = 0xC066, -/* Priv */ C_CUBDRAWER = 0xC067, -/* Priv */ C_MFILE = 0xC070, -/* Priv */ C_SHPFILE = 0xC080, -/* Priv */ C_MODFILE = 0xC090, -/* Priv */ C_RIPFILE = 0xC0A0, -/* Priv */ C_TXFILE = 0xC0B0, -/* Priv */ C_PFILE = 0xC0B2, -/* Priv */ C_MTLFILE = 0xC0B4, -/* Priv */ C_FLIFILE = 0xC0B6, -/* Priv */ C_PALFILE = 0xC0B8, -/* Priv */ C_TX_STRING = 0xC0C0, -/* Priv */ C_CONSTS = 0xC0D0, -/* Priv */ C_SNAPS = 0xC0E0, -/* Priv */ C_GRIDS = 0xC0F0, -/* Priv */ C_ASNAPS = 0xC100, -/* Priv */ C_GRID_RANGE = 0xC110, -/* Priv */ C_RENDTYPE = 0xC120, -/* Priv */ C_PROGMODE = 0xC130, -/* Priv */ C_PREVMODE = 0xC140, -/* Priv */ C_MODWMODE = 0xC150, -/* Priv */ C_MODMODEL = 0xC160, -/* Priv */ C_ALL_LINES = 0xC170, -/* Priv */ C_BACK_TYPE = 0xC180, -/* Priv */ C_MD_CS = 0xC190, -/* Priv */ C_MD_CE = 0xC1A0, -/* Priv */ C_MD_SML = 0xC1B0, -/* Priv */ C_MD_SMW = 0xC1C0, -/* Priv */ C_LOFT_WITH_TEXTURE = 0xC1C3, -/* Priv */ C_LOFT_L_REPEAT = 0xC1C4, -/* Priv */ C_LOFT_W_REPEAT = 0xC1C5, -/* Priv */ C_LOFT_UV_NORMALIZE = 0xC1C6, -/* Priv */ C_WELD_LOFT = 0xC1C7, -/* Priv */ C_MD_PDET = 0xC1D0, -/* Priv */ C_MD_SDET = 0xC1E0, -/* Priv */ C_RGB_RMODE = 0xC1F0, -/* Priv */ C_RGB_HIDE = 0xC200, -/* Priv */ C_RGB_MAPSW = 0xC202, -/* Priv */ C_RGB_TWOSIDE = 0xC204, -/* Priv */ C_RGB_SHADOW = 0xC208, -/* Priv */ C_RGB_AA = 0xC210, -/* Priv */ C_RGB_OVW = 0xC220, -/* Priv */ C_RGB_OVH = 0xC230, -/* Priv */ C_RGB_PICTYPE = 0xC240, -/* Priv */ C_RGB_OUTPUT = 0xC250, -/* Priv */ C_RGB_TODISK = 0xC253, -/* Priv */ C_RGB_COMPRESS = 0xC254, -/* Priv */ C_JPEG_COMPRESSION = 0xC255, -/* Priv */ C_RGB_DISPDEV = 0xC256, -/* Priv */ C_RGB_HARDDEV = 0xC259, -/* Priv */ C_RGB_PATH = 0xC25A, -/* Priv */ C_BITMAP_DRAWER = 0xC25B, -/* Priv */ C_RGB_FILE = 0xC260, -/* Priv */ C_RGB_OVASPECT = 0xC270, - -/* Priv */ C_RGB_ANIMTYPE = 0xC271, -/* Priv */ C_RENDER_ALL = 0xC272, -/* Priv */ C_REND_FROM = 0xC273, -/* Priv */ C_REND_TO = 0xC274, -/* Priv */ C_REND_NTH = 0xC275, -/* Priv */ C_PAL_TYPE = 0xC276, -/* Priv */ C_RND_TURBO = 0xC277, -/* Priv */ C_RND_MIP = 0xC278, -/* Priv */ C_BGND_METHOD = 0xC279, -/* Priv */ C_AUTO_REFLECT = 0xC27A, -/* Priv */ C_VP_FROM = 0xC27B, -/* Priv */ C_VP_TO = 0xC27C, -/* Priv */ C_VP_NTH = 0xC27D, -/* Priv */ C_REND_TSTEP = 0xC27E, -/* Priv */ C_VP_TSTEP = 0xC27F, - -/* Priv */ C_SRDIAM = 0xC280, -/* Priv */ C_SRDEG = 0xC290, -/* Priv */ C_SRSEG = 0xC2A0, -/* Priv */ C_SRDIR = 0xC2B0, -/* Priv */ C_HETOP = 0xC2C0, -/* Priv */ C_HEBOT = 0xC2D0, -/* Priv */ C_HEHT = 0xC2E0, -/* Priv */ C_HETURNS = 0xC2F0, -/* Priv */ C_HEDEG = 0xC300, -/* Priv */ C_HESEG = 0xC310, -/* Priv */ C_HEDIR = 0xC320, -/* Priv */ C_QUIKSTUFF = 0xC330, -/* Priv */ C_SEE_LIGHTS = 0xC340, -/* Priv */ C_SEE_CAMERAS = 0xC350, -/* Priv */ C_SEE_3D = 0xC360, -/* Priv */ C_MESHSEL = 0xC370, -/* Priv */ C_MESHUNSEL = 0xC380, -/* Priv */ C_POLYSEL = 0xC390, -/* Priv */ C_POLYUNSEL = 0xC3A0, -/* Priv */ C_SHPLOCAL = 0xC3A2, -/* Priv */ C_MSHLOCAL = 0xC3A4, -/* Priv */ C_NUM_FORMAT = 0xC3B0, -/* Priv */ C_ARCH_DENOM = 0xC3C0, -/* Priv */ C_IN_DEVICE = 0xC3D0, -/* Priv */ C_MSCALE = 0xC3E0, -/* Priv */ C_COMM_PORT = 0xC3F0, -/* Priv */ C_TAB_BASES = 0xC400, -/* Priv */ C_TAB_DIVS = 0xC410, -/* Priv */ C_MASTER_SCALES = 0xC420, -/* Priv */ C_SHOW_1STVERT = 0xC430, -/* Priv */ C_SHAPER_OK = 0xC440, -/* Priv */ C_LOFTER_OK = 0xC450, -/* Priv */ C_EDITOR_OK = 0xC460, -/* Priv */ C_KEYFRAMER_OK = 0xC470, -/* Priv */ C_PICKSIZE = 0xC480, -/* Priv */ C_MAPTYPE = 0xC490, -/* Priv */ C_MAP_DISPLAY = 0xC4A0, -/* Priv */ C_TILE_XY = 0xC4B0, -/* Priv */ C_MAP_XYZ = 0xC4C0, -/* Priv */ C_MAP_SCALE = 0xC4D0, -/* Priv */ C_MAP_MATRIX_OLD = 0xC4E0, -/* Priv */ C_MAP_MATRIX = 0xC4E1, -/* Priv */ C_MAP_WID_HT = 0xC4F0, -/* Priv */ C_OBNAME = 0xC500, -/* Priv */ C_CAMNAME = 0xC510, -/* Priv */ C_LTNAME = 0xC520, -/* Priv */ C_CUR_MNAME = 0xC525, -/* Priv */ C_CURMTL_FROM_MESH = 0xC526, -/* Priv */ C_GET_SHAPE_MAKE_FACES = 0xC527, -/* Priv */ C_DETAIL = 0xC530, -/* Priv */ C_VERTMARK = 0xC540, -/* Priv */ C_MSHAX = 0xC550, -/* Priv */ C_MSHCP = 0xC560, -/* Priv */ C_USERAX = 0xC570, -/* Priv */ C_SHOOK = 0xC580, -/* Priv */ C_RAX = 0xC590, -/* Priv */ C_STAPE = 0xC5A0, -/* Priv */ C_LTAPE = 0xC5B0, -/* Priv */ C_ETAPE = 0xC5C0, -/* Priv */ C_KTAPE = 0xC5C8, -/* Priv */ C_SPHSEGS = 0xC5D0, -/* Priv */ C_GEOSMOOTH = 0xC5E0, -/* Priv */ C_HEMISEGS = 0xC5F0, -/* Priv */ C_PRISMSEGS = 0xC600, -/* Priv */ C_PRISMSIDES = 0xC610, -/* Priv */ C_TUBESEGS = 0xC620, -/* Priv */ C_TUBESIDES = 0xC630, -/* Priv */ C_TORSEGS = 0xC640, -/* Priv */ C_TORSIDES = 0xC650, -/* Priv */ C_CONESIDES = 0xC660, -/* Priv */ C_CONESEGS = 0xC661, -/* Priv */ C_NGPARMS = 0xC670, -/* Priv */ C_PTHLEVEL = 0xC680, -/* Priv */ C_MSCSYM = 0xC690, -/* Priv */ C_MFTSYM = 0xC6A0, -/* Priv */ C_MTTSYM = 0xC6B0, -/* Priv */ C_SMOOTHING = 0xC6C0, -/* Priv */ C_MODICOUNT = 0xC6D0, -/* Priv */ C_FONTSEL = 0xC6E0, -/* Priv */ C_TESS_TYPE = 0xC6f0, -/* Priv */ C_TESS_TENSION = 0xC6f1, - -/* Priv */ C_SEG_START = 0xC700, -/* Priv */ C_SEG_END = 0xC705, -/* Priv */ C_CURTIME = 0xC710, -/* Priv */ C_ANIMLENGTH = 0xC715, -/* Priv */ C_PV_FROM = 0xC720, -/* Priv */ C_PV_TO = 0xC725, -/* Priv */ C_PV_DOFNUM = 0xC730, -/* Priv */ C_PV_RNG = 0xC735, -/* Priv */ C_PV_NTH = 0xC740, -/* Priv */ C_PV_TYPE = 0xC745, -/* Priv */ C_PV_METHOD = 0xC750, -/* Priv */ C_PV_FPS = 0xC755, -/* Priv */ C_VTR_FRAMES = 0xC765, -/* Priv */ C_VTR_HDTL = 0xC770, -/* Priv */ C_VTR_HD = 0xC771, -/* Priv */ C_VTR_TL = 0xC772, -/* Priv */ C_VTR_IN = 0xC775, -/* Priv */ C_VTR_PK = 0xC780, -/* Priv */ C_VTR_SH = 0xC785, - -/* Priv */ /* Material chunks */ - -/* Priv */ C_WORK_MTLS = 0xC790, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_2 = 0xC792, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_3 = 0xC793, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_4 = 0xC794, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_5 = 0xCB00, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_6 = 0xCB01, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_7 = 0xCB02, /* Old-style -- now ignored */ -/* Priv */ C_WORK_MTLS_8 = 0xCB03, /* Old-style -- now ignored */ -/* Priv */ C_WORKMTL = 0xCB04, -/* Priv */ C_SXP_TEXT_DATA = 0xCB10, -/* Priv */ C_SXP_TEXT2_DATA = 0xCB20, -/* Priv */ C_SXP_OPAC_DATA = 0xCB11, -/* Priv */ C_SXP_BUMP_DATA = 0xCB12, -/* Priv */ C_SXP_SPEC_DATA = 0xCB24, -/* Priv */ C_SXP_SHIN_DATA = 0xCB13, -/* Priv */ C_SXP_SELFI_DATA = 0xCB28, -/* Priv */ C_SXP_TEXT_MASKDATA = 0xCB30, -/* Priv */ C_SXP_TEXT2_MASKDATA = 0xCB32, -/* Priv */ C_SXP_OPAC_MASKDATA = 0xCB34, -/* Priv */ C_SXP_BUMP_MASKDATA = 0xCB36, -/* Priv */ C_SXP_SPEC_MASKDATA = 0xCB38, -/* Priv */ C_SXP_SHIN_MASKDATA = 0xCB3A, -/* Priv */ C_SXP_SELFI_MASKDATA = 0xC3C, -/* Priv */ C_SXP_REFL_MASKDATA = 0xCB3E, - -/* Priv */ C_BGTYPE = 0xC7A1, -/* Priv */ C_MEDTILE = 0xC7B0, - -/* Priv */ /* Contrast */ - -/* Priv */ C_LO_CONTRAST = 0xC7D0, -/* Priv */ C_HI_CONTRAST = 0xC7D1, - -/* Priv */ /* 3d frozen display */ - -/* Priv */ C_FROZ_DISPLAY = 0xC7E0, - -/* Priv */ /* Booleans */ -/* Priv */ C_BOOLWELD = 0xc7f0, -/* Priv */ C_BOOLTYPE = 0xc7f1, - -/* Priv */ C_ANG_THRESH = 0xC900, -/* Priv */ C_SS_THRESH = 0xC901, -/* Priv */ C_TEXTURE_BLUR_DEFAULT = 0xC903, - -/* Priv */ C_MAPDRAWER = 0xCA00, -/* Priv */ C_MAPDRAWER1 = 0xCA01, -/* Priv */ C_MAPDRAWER2 = 0xCA02, -/* Priv */ C_MAPDRAWER3 = 0xCA03, -/* Priv */ C_MAPDRAWER4 = 0xCA04, -/* Priv */ C_MAPDRAWER5 = 0xCA05, -/* Priv */ C_MAPDRAWER6 = 0xCA06, -/* Priv */ C_MAPDRAWER7 = 0xCA07, -/* Priv */ C_MAPDRAWER8 = 0xCA08, -/* Priv */ C_MAPDRAWER9 = 0xCA09, -/* Priv */ C_MAPDRAWER_ENTRY = 0xCA10, - -/* Priv */ /* system options */ -/* Priv */ C_BACKUP_FILE = 0xCA20, -/* Priv */ C_DITHER_256 = 0xCA21, -/* Priv */ C_SAVE_LAST = 0xCA22, -/* Priv */ C_USE_ALPHA = 0xCA23, -/* Priv */ C_TGA_DEPTH = 0xCA24, -/* Priv */ C_REND_FIELDS = 0xCA25, -/* Priv */ C_REFLIP = 0xCA26, -/* Priv */ C_SEL_ITEMTOG = 0xCA27, -/* Priv */ C_SEL_RESET = 0xCA28, -/* Priv */ C_STICKY_KEYINF = 0xCA29, -/* Priv */ C_WELD_THRESHOLD = 0xCA2A, -/* Priv */ C_ZCLIP_POINT = 0xCA2B, -/* Priv */ C_ALPHA_SPLIT = 0xCA2C, -/* Priv */ C_KF_SHOW_BACKFACE = 0xCA30, -/* Priv */ C_OPTIMIZE_LOFT = 0xCA40, -/* Priv */ C_TENS_DEFAULT = 0xCA42, -/* Priv */ C_CONT_DEFAULT = 0xCA44, -/* Priv */ C_BIAS_DEFAULT = 0xCA46, - -/* Priv */ C_DXFNAME_SRC = 0xCA50, -/* Priv */ C_AUTO_WELD = 0xCA60, -/* Priv */ C_AUTO_UNIFY = 0xCA70, -/* Priv */ C_AUTO_SMOOTH = 0xCA80, -/* Priv */ C_DXF_SMOOTH_ANG = 0xCA90, -/* Priv */ C_SMOOTH_ANG = 0xCAA0, - -/* Priv */ /* Special network-use chunks */ - -/* Priv */ C_NET_USE_VPOST = 0xCC00, -/* Priv */ C_NET_USE_GAMMA = 0xCC10, -/* Priv */ C_NET_FIELD_ORDER = 0xCC20, - -/* Priv */ C_BLUR_FRAMES = 0xCD00, -/* Priv */ C_BLUR_SAMPLES = 0xCD10, -/* Priv */ C_BLUR_DUR = 0xCD20, -/* Priv */ C_HOT_METHOD = 0xCD30, -/* Priv */ C_HOT_CHECK = 0xCD40, -/* Priv */ C_PIXEL_SIZE = 0xCD50, -/* Priv */ C_DISP_GAMMA = 0xCD60, -/* Priv */ C_FBUF_GAMMA = 0xCD70, -/* Priv */ C_FILE_OUT_GAMMA = 0xCD80, -/* Priv */ C_FILE_IN_GAMMA = 0xCD82, -/* Priv */ C_GAMMA_CORRECT = 0xCD84, -/* Priv */ C_APPLY_DISP_GAMMA = 0xCD90 /* OBSOLETE */, -/* Priv */ C_APPLY_FBUF_GAMMA = 0xCDA0 /* OBSOLETE */, -/* Priv */ C_APPLY_FILE_GAMMA = 0xCDB0 /* OBSOLETE */, -/* Priv */ C_FORCE_WIRE = 0xCDC0, -/* Priv */ C_RAY_SHADOWS = 0xCDD0, -/* Priv */ C_MASTER_AMBIENT = 0xCDE0, -/* Priv */ C_SUPER_SAMPLE = 0xCDF0, -/* Priv */ C_OBJECT_MBLUR = 0xCE00, -/* Priv */ C_MBLUR_DITHER = 0xCE10, -/* Priv */ C_DITHER_24 = 0xCE20, -/* Priv */ C_SUPER_BLACK = 0xCE30, -/* Priv */ C_SAFE_FRAME = 0xCE40, -/* Priv */ C_VIEW_PRES_RATIO = 0xCE50, -/* Priv */ C_BGND_PRES_RATIO = 0xCE60, -/* Priv */ C_NTH_SERIAL_NUM = 0xCE70, - -/* Priv */ /* Video Post */ -/* Priv */ VPDATA = 0xd000, - -/* Priv */ P_QUEUE_ENTRY = 0xd100, -/* Priv */ P_QUEUE_IMAGE = 0xd110, -/* Priv */ P_QUEUE_USEIGAMMA = 0xd114, -/* Priv */ P_QUEUE_PROC = 0xd120, -/* Priv */ P_QUEUE_SOLID = 0xd130, -/* Priv */ P_QUEUE_GRADIENT = 0xd140, -/* Priv */ P_QUEUE_KF = 0xd150, -/* Priv */ P_QUEUE_MOTBLUR = 0xd152, -/* Priv */ P_QUEUE_MB_REPEAT = 0xd153, -/* Priv */ P_QUEUE_NONE = 0xd160, - -/* Priv */ P_QUEUE_RESIZE = 0xd180, -/* Priv */ P_QUEUE_OFFSET = 0xd185, -/* Priv */ P_QUEUE_ALIGN = 0xd190, - -/* Priv */ P_CUSTOM_SIZE = 0xd1a0, - -/* Priv */ P_ALPH_NONE = 0xd210, -/* Priv */ P_ALPH_PSEUDO = 0xd220 /* Old chunk */, -/* Priv */ P_ALPH_OP_PSEUDO = 0xd221 /* Old chunk */, -/* Priv */ P_ALPH_BLUR = 0xd222 /* Replaces pseudo */, -/* Priv */ P_ALPH_PCOL = 0xd225, -/* Priv */ P_ALPH_C0 = 0xd230, -/* Priv */ P_ALPH_OP_KEY = 0xd231, -/* Priv */ P_ALPH_KCOL = 0xd235, -/* Priv */ P_ALPH_OP_NOCONV = 0xd238, -/* Priv */ P_ALPH_IMAGE = 0xd240, -/* Priv */ P_ALPH_ALPHA = 0xd250, -/* Priv */ P_ALPH_QUES = 0xd260, -/* Priv */ P_ALPH_QUEIMG = 0xd265, -/* Priv */ P_ALPH_CUTOFF = 0xd270, -/* Priv */ P_ALPHANEG = 0xd280, - -/* Priv */ P_TRAN_NONE = 0xd300, -/* Priv */ P_TRAN_IMAGE = 0xd310, -/* Priv */ P_TRAN_FRAMES = 0xd312, -/* Priv */ P_TRAN_FADEIN = 0xd320, -/* Priv */ P_TRAN_FADEOUT = 0xd330, -/* Priv */ P_TRANNEG = 0xd340, - -/* Priv */ P_RANGES = 0xd400, - -/* Priv */ P_PROC_DATA = 0xd500 - -/* Priv */ } chunktag3ds; - - -/* Priv */ /* chunk3ds - Internal database representation of file information */ -/* Priv */ typedef struct chunk3ds { -/* Priv */ chunktag3ds tag; /* Type of chunk */ -/* Priv */ ulong3ds size; /* Number of bytes used by chunk */ -/* Priv */ ulong3ds position; /* Offset in source file */ -/* Priv */ void *data; /* Memory copy of file data */ -/* Priv */ struct chunk3ds *sibling; /* Next chunk in database */ -/* Priv */ struct chunk3ds *children; /* Chunks contained within this chunk */ -/* Priv */ ubyte3ds readindex; /* Index of source file in file table */ -/* Priv */ ubyte3ds writeindex; /* Index of destination file in file table */ -/* Priv */ } chunk3ds; - -/* Priv */ /* chunklistentry3ds - Cross reference between name and chunk */ -/* Priv */ typedef struct { -/* Priv */ char3ds *name; /* Chunk Name list */ -/* Priv */ chunk3ds *chunk; /* Corresponding Pos */ -/* Priv */ } chunklistentry3ds; - -/* Priv */ /* chunklist3ds - List of cross references */ -/* Priv */ typedef struct -/* Priv */ { -/* Priv */ ulong3ds count; /* Number of entries in list */ -/* Priv */ chunklistentry3ds *list; /* Contents of list */ -/* Priv */ } chunklist3ds; - - -/* namelistentry3ds - Name of database object */ -typedef struct -{ - char3ds *name; /* Name of object */ -} namelistentry3ds; - -/* namelist3ds - List of database object names */ -typedef struct -{ - ulong3ds count; /*--- How many entries are in list */ - ulong3ds spaces; /*--- How much space for entries */ - namelistentry3ds *list; /*--- char ** to access pointers */ -} namelist3ds; - - -/* Priv */ /* filestate3ds - Read/write state of a file */ -/* Priv */ typedef enum -/* Priv */ { -/* Priv */ StateNotKnown = 0, /* No state determined yet, file not open */ -/* Priv */ ReadFromFile = 1, /* Open for read */ -/* Priv */ WriteToFile = 2, /* Open for write */ -/* Priv */ ReadWriteFile = 3 /* Open for read and write, not used by toolkit */ -/* Priv */ } filestate3ds; - -/* file3ds - Handle to 3D Studio files */ -typedef struct -{ - FILE *file; /* stdio file pointer */ - char3ds *filename; /* name of file */ - filestate3ds state; /* file open state */ - ubyte3ds index; /* Position of pointer in the FileContextList, if the - index eq InvalidFileContext3ds, then it is not in the - list */ - void *buffer; /* Buffered I/O buffer */ - ulong3ds buffersize; - byte3ds istempfile; /* True3ds if file is a temp file */ -} file3ds; - -/* Priv */ /* dbtype3ds - Database type settings */ -/* Priv */ typedef enum -/* Priv */ { -/* Priv */ Unknown, /* Database has not be created yet */ -/* Priv */ MeshFile, /* 3D Studio .3DS file */ -/* Priv */ ProjectFile, /* 3D STudio .PRJ file */ -/* Priv */ MaterialFile /* 3D Studio .MLI file */ -/* Priv */ } dbtype3ds; - -/* database3ds - File database */ -typedef struct -{ - chunk3ds *topchunk; /* top chunk in the file */ - byte3ds objlistdirty; /* If true, than *objlist needs to be recreated */ - byte3ds matlistdirty; - byte3ds nodelistdirty; - chunklist3ds *objlist; /* Quick Cross references between names and database chunks */ - chunklist3ds *matlist; - chunklist3ds *nodelist; -} database3ds; -typedef enum -{ - NoView3ds, - TopView3ds, - BottomView3ds, - LeftView3ds, - RightView3ds, - FrontView3ds, - BackView3ds, - UserView3ds, - CameraView3ds, - SpotlightView3ds -} viewtype3ds; - -typedef struct -{ - ushort3ds xpos; - ushort3ds ypos; - ushort3ds width; - ushort3ds height; -} viewsize3ds; - -/* Used to describe top, bottom, left, right, front and back views */ -typedef struct -{ - point3ds center; /* Center of orthagonal view */ - float3ds zoom; /* View zoom factor */ -} orthoview3ds; - -/* Used to describe user views */ -typedef struct -{ - point3ds center; /* Center of user view */ - float3ds zoom; /* View zoom factor */ - float3ds horang; /* Horizontal angle of view */ - float3ds verang; /* Veritical angle of view */ -} userview3ds; - -/* Used to describe camera views */ -typedef struct -{ - char3ds name[11]; /* Name of the camera used in the view */ -} cameraview3ds; - -/* Viewport structure details the kind of view in a viewport */ -typedef struct -{ - viewtype3ds type; /* top, bottom, left, right, front, back, user and camera */ - viewsize3ds size; /* Size of the viewport */ - orthoview3ds ortho; /* used for top, bottom, left, right, front, and back views */ - userview3ds user; /* Used for user views */ - cameraview3ds camera; /* Used for camera views */ -} viewport3ds; -typedef enum -{ - UseShadowMap, - UseRayTraceShadow -} shadowstyle3ds; - -typedef struct { /* global shadow settings */ - shadowstyle3ds type; /* Either UseShadowMaps or UseRayTraceShadows */ - float3ds bias; /* shadow bias factor. */ - float3ds raybias; /* shadow ray bais factor. Used in R3 */ - short3ds mapsize; /* shadow map size */ - float3ds filter; /* shadow filter */ -} shadowsets3ds; - -typedef struct { - float3ds masterscale; /* Master mesh scale factor */ - shadowsets3ds shadow; /* Global shadow settings */ - fcolor3ds ambientlight; /* ambient light color */ - point3ds oconsts; /* default object constructing axis */ -} meshset3ds; -typedef enum -{ - NoAtmo, /* no active astmospherics */ - UseFog, /* fog astmostpheric */ - UseLayerFog, /* layer fog astmostpheric */ - UseDistanceCue /* distance cue astmostpheric */ -} atmospheretype3ds; - -typedef enum -{ - NoFall, /* no falloff */ - TopFall, /* falloff to the top */ - BottomFall /* falloff to the bottom */ -} layerfogfalloff3ds; - -typedef struct /* fog atmosphere parameters */ -{ - float3ds nearplane; /* near radius of fog effect */ - float3ds neardensity; /* near fog density */ - float3ds farplane; /* far radius of fog effect */ - float3ds fardensity; /* far fog density */ - fcolor3ds fogcolor; /* color of fog effect */ - byte3ds fogbgnd; /* True3ds / False3ds "fog background" flag */ -} fogsettings3ds; - -typedef struct /* layered fog atmosphere parameters */ -{ - float3ds zmin; /* lower bounds of fog */ - float3ds zmax; /* upper bounds of fog */ - float3ds density; /* fog density */ - fcolor3ds fogcolor; /* fog color */ - layerfogfalloff3ds falloff; /* falloff style */ - byte3ds fogbgnd; /* True3ds / False3ds "fog background" flag */ -} layerfogsettings3ds; - -typedef struct /* distance cue atmosphere parameters */ -{ - float3ds nearplane; /* near radius of effect */ - float3ds neardim; /* near dimming factor */ - float3ds farplane; /* far radius of effect */ - float3ds fardim; /* far dimming factor */ - byte3ds dcuebgnd; /* True3ds / False3ds effect the background flag */ -} dcuesettings3ds; - -typedef struct { - fogsettings3ds fog; /* fog atmostphere settings */ - layerfogsettings3ds layerfog; /* layered fog atmosphere parameters */ - dcuesettings3ds dcue; /* distance cue atmosphere parameters */ - atmospheretype3ds activeatmo; /* The active astmospheric */ -} atmosphere3ds; - -/* enumerate list of possible backgrounds used in file */ -typedef enum -{ - NoBgnd, - UseSolidBgnd, - UseVGradientBgnd, - UseBitmapBgnd -} backgroundtype3ds; - -typedef struct -{ - char3ds *name; /* name of background bitmap */ -} bitmapbgnd3ds; - -typedef struct -{ - fcolor3ds color; /* color of solid background */ -} solidbgnd3ds; - -typedef struct -{ - float3ds gradpercent; /* Placement of mid color band, ranges from 0-1 */ - fcolor3ds top; /* color of top band */ - fcolor3ds mid; /* color of mid background band */ - fcolor3ds bottom; /* color of bottom band */ -} vgradientbgnd3ds; - -typedef struct { - bitmapbgnd3ds bitmap; - solidbgnd3ds solid; - vgradientbgnd3ds vgradient; - backgroundtype3ds bgndused; /* background in effect */ -} background3ds; - -/* Used for shading field in material3ds structure */ -typedef enum -{ - Wire = 0, - Flat = 1, - Gouraud = 2, - Phong = 3, - Metal = 4 -} shadetype3ds; - -/* Used for tiling field in bitmap3ds structure */ -typedef enum -{ - Tile = 1, - Decal = 2, - Both = 3 -} tiletype3ds; - -typedef enum -{ - Pyramidal, - SummedArea -} filtertype3ds; - -typedef enum -{ - RGB, - Alpha, - RGBLumaTint, - AlphaTint, - RGBTint -} tinttype3ds; - - -/* Used By AddMaterial3ds */ - -typedef struct { - ubyte3ds firstframe; /* True for First Frame Only */ - ubyte3ds flat; /* True for flat mirror reflection */ - ulong3ds size; /* Map resolution */ - ulong3ds nthframe; /* Map update period */ -} acubic3ds; /* Cubic reflection map defintion */ - -typedef struct { - char3ds name[13]; /* Bitmap file name */ - float3ds percent; /* Strength percentage */ - tiletype3ds tiling; /* Tile/Decal/Both */ - byte3ds ignorealpha; - filtertype3ds filter; /* Pyramidal/Summed Area */ - float3ds blur; - byte3ds mirror; - byte3ds negative; - float3ds uscale, vscale; - float3ds uoffset, voffset; - float3ds rotation; - tinttype3ds source; /* RGB/RGB Luma Tint/Alpha Tint/RGB Tint */ - fcolor3ds tint1; - fcolor3ds tint2; - fcolor3ds redtint; - fcolor3ds greentint; - fcolor3ds bluetint; - ulong3ds datasize; /* Size of procedural data */ - void3ds *data; /* Procedural data */ -} bitmap3ds; /* Bit map definition */ - -/* Structure to all map settings */ -typedef struct { - bitmap3ds map; /* The map settings */ - bitmap3ds mask; /* The mask settings */ -} mapset3ds; - -typedef struct { - bitmap3ds map; /* The map settings */ - byte3ds useauto; /* True3ds if automatic reflections are being used */ - acubic3ds automap; /* Automatic reflection definitions */ - bitmap3ds mask; /* The mask settings */ -} rmapset3ds; - -typedef struct { - char3ds name[17]; /* Name */ - fcolor3ds ambient; /* Ambient light color */ - fcolor3ds diffuse; /* Diffuse light color */ - fcolor3ds specular; /* Specular light color */ - float3ds shininess; /* Shininess factor */ - float3ds shinstrength; /* Shininess strength */ - float3ds blur; /* Blur factor */ - float3ds transparency; /* Trasparency factor */ - float3ds transfalloff; /* Fallof factor */ - float3ds selfillumpct; /* Self illumination percentage */ - float3ds wiresize; /* Width of wireframe */ - shadetype3ds shading; /* Shading type */ - byte3ds useblur; /* Blurring flag */ - byte3ds usefall; /* Transparency falloff flag */ - byte3ds twosided; /* Two sided material flag */ - byte3ds selfillum; /* Self illumination flag */ - byte3ds additive; /* Additive transparency flag */ - byte3ds usewire; /* Use wireframe rendering */ - byte3ds usewireabs; /* Wire size is in units, not pixels. */ - byte3ds facemap; /* Face mapping switch */ - byte3ds soften; /* Soften switch */ - mapset3ds texture; /* Texture map settings */ - mapset3ds texture2; /* Second texture map settings */ - mapset3ds opacity; /* Opacity map settings */ - mapset3ds bump; /* Bump map settings */ - mapset3ds specmap; /* Specularity map settings */ - mapset3ds shinmap; /* Shininess map settings */ - mapset3ds illummap; /* Self illumination map settings */ - rmapset3ds reflect; /* Reflection map settings */ -} material3ds; /* Material definition */ - -/* mapinfo3ds - Texture map icon placement */ -typedef struct { - ushort3ds maptype; /* Icon type */ - float3ds tilex; /* Tiling */ - float3ds tiley; - float3ds cenx; /* Position of center */ - float3ds ceny; - float3ds cenz; - float3ds scale; /* Icon scaling factor */ - float3ds matrix[12]; /* Orientation matrix */ - float3ds pw; /* Planar icon width */ - float3ds ph; /* Planar icon height */ - float3ds ch; /* Cylinder icon height */ -} mapinfo3ds; - -/* objmat3ds - Material assignments by face */ -typedef struct { - char3ds name[17]; /* Material name */ - ushort3ds nfaces; /* Number of faces using material */ - ushort3ds *faceindex; /* List of faces using material */ -} objmat3ds; - -/* mesh3ds - Mesh object definition */ -typedef struct { - char3ds name[11]; /* Object name */ - byte3ds ishidden; /* Hidden object flag */ - byte3ds isvislofter; /* Lofter visibility flag */ - byte3ds ismatte; /* Matte object flag */ - byte3ds isnocast; /* Doesn't cast shadow's flag */ - byte3ds isfast; /* Fast display flag */ - byte3ds isnorcvshad; /* Doesn't recieve shadows */ - byte3ds isfrozen; /* Frozen object flag */ - ushort3ds nvertices; /* Vertice count */ - point3ds *vertexarray; /* List of vertices */ - ushort3ds nvflags; /* Number of vertex flags */ - ushort3ds *vflagarray; /* List of vertex flags */ - ushort3ds ntextverts; /* Number of texture vertices */ - textvert3ds *textarray; /* List of texture coordinates */ - byte3ds usemapinfo; /* Boolean for use of mapping icon information */ - mapinfo3ds map; /* Mapping icon info */ - float3ds locmatrix[12]; /* Object orientation matrix */ - ushort3ds nfaces; /* Face count */ - face3ds *facearray; /* List of faces */ - ulong3ds *smootharray; /* Smoothing group assignment list */ - byte3ds useboxmap; /* Boolean used to indicate the use of box mapping */ - char3ds boxmap[6][17]; /* Material names used in boxmapping */ - ubyte3ds meshcolor; /* UI color assigned to the mesh */ - ushort3ds nmats; /* Assigned materials count */ - objmat3ds *matarray; /* Material assignment list */ - byte3ds useproc; /* Use animated stand-in flag */ - ulong3ds procsize; /* Size of animated stand-in data */ - char3ds procname[13]; /* Name of animated stand-in procedure */ - void3ds *procdata; /* Animated stand-in data */ -} mesh3ds; - -/* conestyle3ds - Spolight projection cone shape. */ -typedef enum -{ - Circular, - Rectangular -} conestyle3ds; - -/* spotshadow - Spotlight shadow settings */ -typedef struct { - byte3ds cast; /* True if spotlight casts shadows */ - shadowstyle3ds type; /* UseShadow or UseRayTrace */ - byte3ds local; /* True if local shadow settings are being used */ - float3ds bias; /* Shadow bias */ - float3ds filter; /* Shadow filter */ - ushort3ds mapsize; /* Shadow map size */ - float3ds raybias; /* Ray tracing shadow bias */ -} spotshadow3ds; - -/* spotcond3ds - cone visability settings */ -typedef struct { - conestyle3ds type; /* Circular or rectangular light cone */ - byte3ds show; /* True if cone is visable */ - byte3ds overshoot; /* True if cone overshoot is on */ -} spotcone3ds; - -/* spotproject3ds - spotlight projectio bitmap */ -typedef struct { - byte3ds use; /* True if using projector */ - char3ds *bitmap; /* Name of projector bitmap */ -} spotprojector3ds; - -/* spotlight3ds - spotlight settings */ -typedef struct -{ - point3ds target; /* Spotlight target */ - float3ds hotspot; /* Hotspot angle */ - float3ds falloff; /* Hotspot falloff */ - float3ds roll; /* Roll angle */ - float3ds aspect; /* Aspect ratio */ - spotshadow3ds shadows; - spotcone3ds cone; - spotprojector3ds projector; -} spotlight3ds; - -/* liteattenuate3ds - Light attenuation settings */ -typedef struct { - byte3ds on; /* True if light attenuation is on */ - float3ds inner; /* Inner range of attenuation */ - float3ds outer; /* Outer range of attenuation */ -} liteattenuate3ds; - -/* light3ds - omni and spotlight settings */ -typedef struct { - char3ds name[11]; /* Light name */ - point3ds pos; /* Light position */ - fcolor3ds color; /* Light color */ - float3ds multiplier;/* Light intensity multiplier */ - byte3ds dloff; /* True if light is off */ - liteattenuate3ds attenuation; - namelist3ds *exclude; - spotlight3ds *spot; /* If not null, then struct is a spotlight, else omni. */ -} light3ds; - -/* camrange3ds - Camera atomosphere ranges */ -typedef struct { - float3ds cam_near; /* Nearest effect radiu */ - float3ds cam_far; /* Farthest effect radius */ -} camranges3ds; - -typedef struct -{ - char3ds name[11]; - point3ds position; - point3ds target; - float3ds roll; - float3ds fov; - byte3ds showcone; - camranges3ds ranges; -} camera3ds; - -typedef struct { - ulong3ds length; - ulong3ds curframe; -} kfkeyinfo3ds; - -typedef struct { - byte3ds use; - ulong3ds begin; - ulong3ds end; -} kfsegment3ds; - -typedef struct -{ - kfkeyinfo3ds anim; - kfsegment3ds seg; -} kfsets3ds; - - -typedef struct { - char3ds name[11]; /* Name of camera object */ - char3ds parent[22]; /* Name of parent object */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds npkeys; /* Number of camera position keys */ - ushort3ds npflag; /* Loop control flag for camera position keys */ - keyheader3ds *pkeys; /* Spline values for camera position keys */ - point3ds *pos; /* Camera position keys */ - - ulong3ds nfkeys; /* Number of camera FOV keys */ - ushort3ds nfflag; /* Loop control flag for camera FOV keys */ - keyheader3ds *fkeys; /* Spline values for camera FOV keys */ - float3ds *fov; /* Camera FOV keys */ - - ulong3ds nrkeys; /* Number of camera roll keys */ - ushort3ds nrflag; /* Loop control flag for camera roll keys */ - keyheader3ds *rkeys; /* Spline values for camera roll keys */ - float3ds *roll; /* Camera roll keys */ - - char3ds tparent[22]; /* Index of parent object for target */ - ulong3ds ntkeys; /* Number of target position keys */ - ushort3ds ntflag; /* Loop control flag for target position keys */ - keyheader3ds *tkeys; /* Spline values for target position keys */ - point3ds *tpos; /* Target position keys */ - ushort3ds tflags1; /* flags field from target node header */ - ushort3ds tflags2; /* flags field from target node header */ -} kfcamera3ds; - -/* kfambient3ds - Ambient light animation */ -typedef struct { - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag for color keys */ - keyheader3ds *ckeys; /* Spline values for position keys */ - fcolor3ds *color; /* Color keys */ -} kfambient3ds; -/* Used By ObjectMotion3ds */ - -typedef struct { - char3ds name[11]; /* Name of mesh */ - char3ds parent[22]; /* Name of parent object */ - ushort3ds flags1; /* flags field from node header */ - ushort3ds flags2; /* flags2 field from node header */ - - point3ds pivot; /* Object pivot point */ - char3ds instance[11]; /* Object instance name */ - point3ds boundmin; /* Minimum bounding box point for dummy objects */ - point3ds boundmax; /* Maximum bounding box point for dummy objects */ - - ulong3ds npkeys; /* Number of position keys */ - short3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for position keys */ - point3ds *pos; /* Mesh position keys */ - - ulong3ds nrkeys; /* Number of rotation keys */ - short3ds nrflag; /* Loop control flag for rotation keys */ - keyheader3ds *rkeys; /* Spline values for rotation keys */ - kfrotkey3ds *rot; /* Rotation keys */ - - ulong3ds nskeys; /* Number of scaling keys */ - short3ds nsflag; /* Loop control flag for scaling keys */ - keyheader3ds *skeys; /* Spline values for scaling */ - point3ds *scale; /* Mesh scaling keys */ - - ulong3ds nmkeys; /* Number of morph keys */ - short3ds nmflag; /* Loop control flag for morph keys */ - keyheader3ds *mkeys; /* Spline values for morph keys */ - kfmorphkey3ds *morph; /* Morph keys */ - - ulong3ds nhkeys; /* Number of hide keys */ - short3ds nhflag; /* Loop control flag for hide keys */ - keyheader3ds *hkeys; /* Spline values for hide keys */ - float3ds msangle; /* Morph smoothing group angle */ -} kfmesh3ds; - -/* Used By OmnilightMotion3ds */ - -typedef struct { - char3ds name[11]; /* Name of the light object node */ - char3ds parent[22]; /* Name of the parent object */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds npkeys; /* Number of position keys */ - ushort3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for position keys */ - point3ds *pos; /* Position keys */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag for color keys */ - keyheader3ds *ckeys; /* Spline values for position keys */ - fcolor3ds *color; /* Color keys */ - -} kfomni3ds; - -typedef struct { - char3ds name[11]; /* Name of camera object */ - char3ds parent[22]; /* Parent name */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - -#ifdef broken - short3ds visable; /* Flags to control visability */ -#endif - ulong3ds npkeys; /* Number of light position keys */ - ushort3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for light position keys */ - point3ds *pos; /* Light position keys */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag color keys */ - keyheader3ds *ckeys; /* Spline values for color keys */ - fcolor3ds *color; /* Color keys */ - - ulong3ds nhkeys; /* Number of hotspot angle keys */ - ushort3ds nhflag; /* Loop control flag for hotspot angle keys */ - keyheader3ds *hkeys; /* Spline values for hotspot angle keys */ - float3ds *hot; /* Hotspot angle keys */ - - ulong3ds nfkeys; /* Number of falloff angle keys */ - ushort3ds nfflag; /* Loop control flag for falloff angle keys */ - keyheader3ds *fkeys; /* Spline values for falloff angle keys */ - float3ds *fall; /* Falloff angle keys */ - - ulong3ds nrkeys; /* Number of light roll keys */ - ushort3ds nrflag; /* Loop control flag for light roll keys */ - keyheader3ds *rkeys; /* Spline values for light roll keys */ - float3ds *roll; /* Light roll keys */ - - char3ds tparent[22]; /* Name of target's parent object */ - ulong3ds ntkeys; /* Number of target position keys */ - ushort3ds ntflag; /* Loop control flag for target position keys */ - keyheader3ds *tkeys; /* Spline values for target position keys */ - point3ds *tpos; /* Target position keys */ - ushort3ds tflags1; /* flags field from target node header */ - ushort3ds tflags2; /* flags field from target node header */ - -} kfspot3ds; -typedef struct { - long3ds size; - void3ds *data; -} xdataraw3ds; - - -/*---------------------------------------- - Constants for commonly used structures - --------------------------------------*/ - -/* 3DS File Toolkit revision level. Future revisions will increment this - integer number */ -static const long3ds __FTKRevisionLevel3ds = FTKRevisionLevel3ds; - -/* Flags used by the flag field of the mesh3ds structure */ -static const ushort3ds FaceCAVisable3ds = 0x0001; /* Flags the CA edge as visable */ -static const ushort3ds FaceBCVisable3ds = 0x0002; /* Flags the BC edge as visable */ -static const ushort3ds FaceABVisable3ds = 0x0004; /* Flags the AB edge as visable */ -static const ushort3ds FaceUWrap3ds = 0x0008; /* Flags the face as being at - a texture coord u wrap - seam */ -static const ushort3ds FaceVWrap3ds = 0x0010; /* Flags the face as being at - a texture coord v wrap - seam */ - -/* Flags used by the rflags field of the keyheader3ds structure */ -static const ushort3ds KeyUsesTension3ds = 0x01; -static const ushort3ds KeyUsesCont3ds = 0x02; -static const ushort3ds KeyUsesBias3ds = 0x04; -static const ushort3ds KeyUsesEaseTo3ds = 0x08; -static const ushort3ds KeyUsesEaseFrom3ds= 0x10; - -/* Flags used by the track flags field */ -static const ushort3ds TrackSingle3ds = 0x0000; -static const ushort3ds TrackLoops3ds = 0x0003; -static const ushort3ds TrackRepeats3ds = 0x0002; -static const ushort3ds TrackLockX3ds = 0x0008; -static const ushort3ds TrackLockY3ds = 0x0010; -static const ushort3ds TrackLockZ3ds = 0x0020; -static const ushort3ds TrackNoLinkX3ds = 0x0100; -static const ushort3ds TrackNoLinkY3ds = 0x0200; -static const ushort3ds TrackNoLinkZ3ds = 0x0400; - -/* Basic structure default contents for ease of initialization */ -static const point3ds DefPoint3ds = {0.0F, 0.0F, 0.0F}; -static const textvert3ds DefTextVert3ds = {0.0F, 0.0F}; -static const face3ds DefFace3ds = {0, 1, 2, 0}; -static const trackheader3ds DefTrackHeader3ds = {0, 0, 0, 1}; -static const keyheader3ds DefKeyHeader3ds = {0, 0, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; -/* Last toolkit error */ -extern byte3ds ftkerr3ds; /* True3ds if error is pending */ -extern byte3ds ignoreftkerr3ds; /* True3ds if errors are being ignored by toolkit */ -/* Fog flags */ -static const ulong3ds LayerFogBgnd = 0x100000; -static const ulong3ds NoFalloff = 0x0; -static const ulong3ds TopFalloff = 0x2; -static const ulong3ds BottomFalloff = 0x1; - - -/* Flags for initflags parameter */ -static const ushort3ds InitNoExtras3ds = 0x0000; -static const ushort3ds InitVertexArray3ds = 0x0001; -static const ushort3ds InitTextArray3ds = 0x0002; -static const ushort3ds InitFaceArray3ds = 0x0004; -static const ushort3ds InitMatArray3ds = 0x0008; -static const ushort3ds InitSmoothArray3ds = 0x0010; -static const ushort3ds InitProcData3ds = 0x0020; -static const ushort3ds InitVFlagArray3ds = 0x0040; - - -/* Smoothing group flags used in the smootharray field of the mesh3ds structure */ -static const ulong3ds Smooth01Group3ds = 0x00000001; -static const ulong3ds Smooth02Group3ds = 0x00000002; -static const ulong3ds Smooth03Group3ds = 0x00000004; -static const ulong3ds Smooth04Group3ds = 0x00000008; -static const ulong3ds Smooth05Group3ds = 0x00000010; -static const ulong3ds Smooth06Group3ds = 0x00000020; -static const ulong3ds Smooth07Group3ds = 0x00000030; -static const ulong3ds Smooth08Group3ds = 0x00000080; -static const ulong3ds Smooth09Group3ds = 0x00000100; -static const ulong3ds Smooth10Group3ds = 0x00000200; -static const ulong3ds Smooth11Group3ds = 0x00000400; -static const ulong3ds Smooth12Group3ds = 0x00000800; -static const ulong3ds Smooth13Group3ds = 0x00001000; -static const ulong3ds Smooth14Group3ds = 0x00002000; -static const ulong3ds Smooth15Group3ds = 0x00004000; -static const ulong3ds Smooth16Group3ds = 0x00008000; -static const ulong3ds Smooth17Group3ds = 0x00010000; -static const ulong3ds Smooth18Group3ds = 0x00020000; -static const ulong3ds Smooth19Group3ds = 0x00040000; -static const ulong3ds Smooth20Group3ds = 0x00080000; -static const ulong3ds Smooth21Group3ds = 0x00100000; -static const ulong3ds Smooth22Group3ds = 0x00200000; -static const ulong3ds Smooth23Group3ds = 0x00400000; -static const ulong3ds Smooth24Group3ds = 0x00800000; -static const ulong3ds Smooth25Group3ds = 0x01000000; -static const ulong3ds Smooth26Group3ds = 0x02000000; -static const ulong3ds Smooth27Group3ds = 0x04000000; -static const ulong3ds Smooth28Group3ds = 0x08000000; -static const ulong3ds Smooth29Group3ds = 0x10000000; -static const ulong3ds Smooth30Group3ds = 0x20000000; -static const ulong3ds Smooth31Group3ds = 0x40000000; -static const ulong3ds Smooth32Group3ds = 0x80000000; -static const char3ds *DummyName3ds = "$$$DUMMY"; -/* Flag settings for kfmesh3ds, kfomni3ds, kfcamera3ds, kfambient, and kfspot3ds */ - -/* For the flags field */ -static const ushort3ds KfNodeOff3ds = 1<<3; -static const ushort3ds KfHideNode3ds = 1<<11; -static const ushort3ds KfFastNode3ds = 1<<12; - -/* For the flags2 field */ -static const ushort3ds KfNodeHasPath3ds = 1; -static const ushort3ds KfNodeAutoSmooth3ds = 1<<1; -static const ushort3ds KfNodeFrozen3ds = 1<<2; -static const ushort3ds KfMotionBlur3ds = 1<<4; -static const ushort3ds KfBlurBranch3ds = 1<<5; -static const ushort3ds KfMorphMtl3ds = 1<<6; -static const ushort3ds KfMorphOb = 1<<7; - -typedef enum -{ - LightTarget, - CameraTarget -} targettype3ds; - -static const long3ds TerseDump3ds = 0; /* Just the chunk headers */ -static const long3ds MediumDump3ds = 1; /* Selected bits of data (usually not array dumps) */ -static const long3ds MaximumDump3ds = 2; /* Everything */ -/* Priv */ void PushErrList3ds(errorid3ds id); -/* Priv */ const char3ds *ErrCodeToString3ds(errorid3ds err); -void DumpErrList3ds(FILE *outfile); -void ClearErrList3ds(); -const ErrRec3ds *ReturnErrorList3ds(); - - -/* Functions to use with namelist3ds structures */ -void InitNameList3ds(namelist3ds **chunk, ulong3ds count); -void ReleaseNameList3ds(namelist3ds **chunk); -void AddToNameList3ds(namelist3ds **list, char3ds *name); - -/* File control functions */ -file3ds *OpenFile3ds(const char3ds *filename, const char *attrib); -file3ds *OpenFile3ds_buf(char3ds *buf, long3ds len); -void CloseAllFiles3ds(); -void CloseFile3ds(file3ds *file); - - -/* Database functions */ -void InitDatabase3ds(database3ds **db); -void ReleaseDatabase3ds(database3ds **db); -void CreateDatabase3ds(file3ds *file, database3ds *db); -void CreateNewDatabase3ds(database3ds *db, dbtype3ds type); -dbtype3ds GetDatabaseType3ds(database3ds *db); -void CopyDatabase3ds(database3ds *idb, database3ds *odb); -void DisconnectDatabase3ds(database3ds *db); -void WriteDatabase3ds(file3ds *file, database3ds *db); -void InitViewport3ds(viewport3ds **vp); -void ReleaseViewport3ds(viewport3ds **vp); -void GetViewport3ds(database3ds *db, viewport3ds **vp); -void PutViewport3ds(database3ds *db, viewport3ds *vp); -void CopyViewport3ds(database3ds *destdb, database3ds *srcdb); -void InitMeshSet3ds(meshset3ds **); -void ReleaseMeshSet3ds(meshset3ds **); -void GetMeshSet3ds(database3ds *, meshset3ds **); -void PutMeshSet3ds(database3ds *db, meshset3ds *settings); -void CopyMeshSet3ds(database3ds *destdb, database3ds *srcdb); - -void InitAtmosphere3ds(atmosphere3ds **atmo); -void ReleaseAtmosphere3ds(atmosphere3ds **atmo); -void GetAtmosphere3ds(database3ds *db, atmosphere3ds **atmo); -void PutAtmosphere3ds(database3ds *db, atmosphere3ds *atmo); -void CopyAtmosphere3ds(database3ds *destdb, database3ds *srcdb); - -void InitBackground3ds(background3ds **bgnd); -void ReleaseBackground3ds(background3ds **bgnd); -void GetBackground3ds(database3ds *db, background3ds **bgnd); -void PutBackground3ds(database3ds *db, background3ds *bgnd); -void CopyBackground3ds(database3ds *destdb, database3ds *srcdb); - -short3ds AddMaterial3ds(const material3ds *mat); -void InitBitmap3ds(bitmap3ds *map); -short3ds InitMaterial3ds(material3ds **mat); -void ReleaseMaterial3ds(material3ds **mat); -ulong3ds GetMaterialCount3ds(database3ds *db); -void GetMaterialNameList3ds(database3ds *db, namelist3ds **list); -void GetMaterialByIndex3ds(database3ds *db, ulong3ds index, material3ds **mat); -void GetMaterialByName3ds(database3ds *db, char3ds *name, material3ds **mat); -void PutMaterial3ds(database3ds *db, material3ds *mat); -void CopyMaterialByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyMaterialByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteMaterialByName3ds(database3ds *db, char3ds *name); -void DeleteMaterialByIndex3ds(database3ds *db, ulong3ds index); -void InitMeshObj3ds(mesh3ds **obj, ushort3ds nvertices, ushort3ds nfaces, ushort3ds iniflags); -void InitMeshObjField3ds(mesh3ds *obj, ushort3ds const initflags); -void InitMatArrayIndex3ds (mesh3ds *obj, ushort3ds mat, ushort3ds nfaces); - -/* Mesh object functions */ -ulong3ds GetMeshCount3ds(database3ds *db); -void GetMeshNameList3ds(database3ds *db, namelist3ds **list); -void GetMeshByIndex3ds(database3ds *db, ulong3ds index, mesh3ds **mesh); -void GetMeshByName3ds(database3ds *db, char3ds *name, mesh3ds **mesh); -void PutMesh3ds(database3ds *db, mesh3ds *mesh); -void CopyMeshByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyMeshByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteMeshByName3ds(database3ds *db, char3ds *name); -void DeleteMeshByIndex3ds(database3ds *db, ulong3ds index); -void RelMeshObj3ds(mesh3ds **obj); - -/* Light related functions */ -void InitLight3ds(light3ds **light); -void InitSpotlight3ds(light3ds **spotlight); -void ReleaseLight3ds(light3ds **light); -ulong3ds GetOmnilightCount3ds(database3ds *db); -ulong3ds GetSpotlightCount3ds(database3ds *db); -void GetOmnilightNameList3ds(database3ds *db, namelist3ds **list); -void GetSpotlightNameList3ds(database3ds *db, namelist3ds **list); -void GetSpotlightByIndex3ds(database3ds *db, long3ds index, light3ds **light); -void GetOmnilightByIndex3ds(database3ds *db, long3ds index, light3ds **light); -void GetSpotlightByName3ds(database3ds *db, char3ds *name, light3ds **light); -void GetOmnilightByName3ds(database3ds *db, char3ds *name, light3ds **light); -void PutSpotlight3ds(database3ds *db, light3ds *light); -void PutOmnilight3ds(database3ds *db, light3ds *light); -void CopySpotlightByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopySpotlightByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyOmnilightByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyOmnilightByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteSpotlightByIndex3ds(database3ds *db, ulong3ds index); -void DeleteOmnilightByIndex3ds(database3ds *db, ulong3ds index); -void DeleteSpotlightByName3ds(database3ds *db, char3ds *name); -void DeleteOmnilightByName3ds(database3ds *db, char3ds *name); -void InitCamera3ds(camera3ds **cam); -void ReleaseCamera3ds(camera3ds **cam); -ulong3ds GetCameraCount3ds(database3ds *db); -void GetCameraNameList3ds(database3ds *db, namelist3ds **list); -void GetCameraByIndex3ds(database3ds *db, ulong3ds index, camera3ds **cam); -void GetCameraByName3ds(database3ds *db, char3ds *name, camera3ds **cam); -void PutCamera3ds(database3ds *db, camera3ds *cam); - -void CopyCameraByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyCameraByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); - -void DeleteCameraByName3ds(database3ds *db, char3ds *name); -void DeleteCameraByIndex3ds(database3ds *db, ulong3ds index); - -void InitKfSets3ds(kfsets3ds **key); -void ReleaseKfSets3ds(kfsets3ds **key); -void PutKfSets3ds(database3ds *db, kfsets3ds *key); -void GetKfSets3ds(database3ds *db, kfsets3ds **key); -void CopyKfSets3ds(database3ds *destdb, database3ds *srcdb); - - -void InitCameraMotion3ds(kfcamera3ds **cam, ulong3ds npkeys, ulong3ds nfkeys, - ulong3ds nrkeys, ulong3ds ntkeys); - -void GetCameraMotionByName3ds(database3ds *db, - const char3ds *name, - kfcamera3ds **kfcam); - -void GetCameraMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfcamera3ds **kfcam); - -void PutCameraMotion3ds(database3ds *db, kfcamera3ds *kfcam); - - -void ReleaseCameraMotion3ds(kfcamera3ds **cam); - -ulong3ds GetCameraNodeCount3ds(database3ds *db); - -void GetCameraNodeNameList3ds(database3ds *db, namelist3ds **list); - -void DeleteCameraMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteCameraMotionByName3ds(database3ds *db, char3ds *name); -void CopyCameraMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyCameraMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); - - -/* Ambient Light Animation Functions */ -void InitAmbientLightMotion3ds(kfambient3ds **light, ulong3ds nckeys); -void ReleaseAmbientLightMotion3ds(kfambient3ds **light); -void GetAmbientLightMotion3ds(database3ds *db, kfambient3ds **kfambient); -void PutAmbientLightMotion3ds(database3ds *db, kfambient3ds *kfambient); -void DeleteAmbientLightMotion3ds(database3ds *db); -void CopyAmbientLightMotion3ds(database3ds *destdb, database3ds *srcdb); -void InitObjectMotion3ds(kfmesh3ds **obj, - ulong3ds npkeys, - ulong3ds nrkeys, - ulong3ds nskeys, - ulong3ds nmkeys, - ulong3ds nhkeys); - -void ReleaseObjectMotion3ds(kfmesh3ds **obj); - -void GetObjectNodeNameList3ds(database3ds *db, - namelist3ds **list); - -ulong3ds GetObjectNodeCount3ds(database3ds *db); - -void GetObjectMotionByName3ds(database3ds *db, - char3ds *name, - kfmesh3ds **kfmesh); - -void GetObjectMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfmesh3ds **kfmesh); - -void PutObjectMotion3ds(database3ds *db, - kfmesh3ds *kfmesh); - -void DeleteObjectMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteObjectMotionByName3ds(database3ds *db, char3ds *name); -void CopyObjectMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyObjectMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void InitOmnilightMotion3ds(kfomni3ds **light, - ulong3ds npkeys, - ulong3ds nckeys); - -void ReleaseOmnilightMotion3ds(kfomni3ds **light); - -void GetOmnilightNodeNameList3ds(database3ds *db, - namelist3ds **list); - -void GetOmnilightMotionByName3ds(database3ds *db, - char3ds *name, - kfomni3ds **kfomni); - -void GetOmnilightMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfomni3ds **kfomni); - -ulong3ds GetOmnilightNodeCount3ds(database3ds *db); - -void PutOmnilightMotion3ds(database3ds *db, - kfomni3ds *kfomni); - -void PutOmnilightMotion3ds(database3ds *db, - kfomni3ds *kfomni); - -void DeleteOmnilightMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteOmnilightMotionByName3ds(database3ds *db, char3ds *name); -void CopyOmnilightMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyOmnilightMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void InitSpotlightMotion3ds(kfspot3ds **spot, - ulong3ds npkeys, - ulong3ds nckeys, - ulong3ds nhkeys, - ulong3ds nfkeys, - ulong3ds nrkeys, - ulong3ds ntkeys); - -void ReleaseSpotlightMotion3ds(kfspot3ds **spot); - -void GetSpotlightNodeNameList3ds(database3ds *db, - namelist3ds **list); - -ulong3ds GetSpotlightNodeCount3ds(database3ds *db); - -void GetSpotlightMotionByName3ds(database3ds *db, - char3ds *name, - kfspot3ds **kfspot); - -void PutSpotlightMotion3ds(database3ds *db, - kfspot3ds *kfspot); - -void GetSpotlightMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfspot3ds **kfspot); - -void DeleteSpotlightMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteSpotlightMotionByName3ds(database3ds *db, char3ds *name); -void CopySpotlightMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopySpotlightMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); - -void FillMatrix3ds(mesh3ds *obj); -void SetBoundBox3ds(const mesh3ds *mobj, kfmesh3ds *kobj ); -void DumpMapInfo3ds(FILE *out, mapinfo3ds *map, long3ds dumplevel); -void DumpMesh3ds(FILE *out, mesh3ds *mesh, long3ds dumplevel); -void DumpMaterial3ds(FILE *out, material3ds *mat, long3ds dumplevel); -void DumpBitmap3ds(FILE *out, bitmap3ds *map, long3ds dumplevel); -void SetDumpLevel3ds(long3ds newlevel); -void DumpDatabase3ds(FILE *outfile, database3ds *db); -void GetMeshXDataByName3ds(database3ds *db, char3ds *meshname, char3ds *appname, xdataraw3ds **data); -ulong3ds GetMeshXDataCount3ds(database3ds *db, char3ds *meshname); -#ifdef __cplusplus -} -#endif - -#endif diff --git a/3rdparty/3dsftk3/src/3dsambm.c b/3rdparty/3dsftk3/src/3dsambm.c deleted file mode 100644 index 4cf38336..00000000 --- a/3rdparty/3dsftk3/src/3dsambm.c +++ /dev/null @@ -1,368 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include - -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dssptm.h" -#include "3dsambm.h" -#include "kfutils.h" - -static /* const */ char3ds *kAmbientName = "$AMBIENT$"; - -/*---------------------------------------------------------- - | - |InitAmbientLightMotion3ds - | - +----------------------------------------------------------*/ -void InitAmbientLightMotion3ds(kfambient3ds **light, - ulong3ds nckeys) -{ - ulong3ds i; - - if (*light == NULL) - { - (*light) = malloc(sizeof(kfambient3ds)); - if(*light == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - (*light)->flags1 = (*light)->flags2 = (ushort3ds)0; - (*light)->nckeys = nckeys; - (*light)->color = NULL; - (*light)->ckeys = NULL; - } - - if ((*light)->ckeys != NULL) { - free((*light)->ckeys); - (*light)->ckeys = NULL; - } - if ((*light)->color != NULL) { - free((*light)->color); - (*light)->color = NULL; - } - - if (nckeys != 0) - { - (*light)->ncflag = TrackSingle3ds; - (*light)->nckeys = nckeys; - - (*light)->ckeys = calloc((*light)->nckeys, sizeof(keyheader3ds)); - if((*light)->ckeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*light)->nckeys; i++) - memcpy(&(((*light)->ckeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - (*light)->color = calloc((*light)->nckeys, sizeof(fcolor3ds)); - if((*light)->color == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*light)->nckeys; i++) - ((*light)->color)[i].r = - ((*light)->color)[i].g = - ((*light)->color)[i].b = (float3ds)1.0; - } -} - -/*---------------------------------------------------------- -| - |ReleaseAmbientLightMotion3ds - | - +----------------------------------------------------------*/ -void ReleaseAmbientLightMotion3ds(kfambient3ds **light) -{ - if (*light != NULL) { - if((*light)->ckeys != NULL) - free((*light)->ckeys); - if((*light)->color != NULL) - free((*light)->color); - free(*light); - *light = NULL; - } -} - - -/*---------------------------------------------------------------------- - | - | GetAmbientLightMotion3ds - | - | db: database to be searched - | kfambient: Ptr to the addr of kfambient3ds structure, if (*kfambient) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfambient remains unchanged. - | - | Ambient light a special case: only one ambient node per keyframe data - | chunk. - | - +----------------------------------------------------------------------*/ -void GetAmbientLightMotion3ds(database3ds *db, - kfambient3ds **kfambient) -{ - chunk3ds *pKfChunk, *pChunk = NULL; - - if(db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /*--- Find Keyframe chunk */ - FindChunk3ds(db->topchunk, KFDATA, &pKfChunk); - if (pKfChunk){ - FindChunk3ds(pKfChunk, AMBIENT_NODE_TAG, &pChunk); - if (pChunk) - GetAmbientLightMotionChunk3ds(pChunk, kfambient); - } -} - -/*-------------------------------------------------------------------------- - | GetAmbientLightMotionChunk3ds - | - | pAmbientChunk:SPOTAMBIENT_NODE_TAG chunk to extract data from - | pTargetChunk: L_TARGET_NODE_TAG chunk to extract target data from - | kfspot: Structure to fill in with chunk data - | - | chunk----->kfAmbient3ds - | - | Gets AmbientLight keyframe information from chunk - | - | L_TARGET - | ... - | NODE_HDR - | APP_DATA - | COL_TRACK - | - +--------------------------------------------------------------------------*/ -void GetAmbientLightMotionChunk3ds(chunk3ds *pAmbientChunk, - kfambient3ds **kfambient) -{ - kfambient3ds - *pKfAmbient; - chunk3ds - *pNodeHdrChunk, *pColChunk; - ulong3ds i, - nColKeys = 0; - NodeHdr - *pNodeHdr = NULL; - ColTrackTag - *pColData = NULL; - - if (pAmbientChunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /*------------------------------- - | Get information from chunks - +-------------------------------*/ - /*--- Search children of AmbientLight chunk */ - FindChunk3ds(pAmbientChunk, NODE_HDR, &pNodeHdrChunk); - FindChunk3ds(pAmbientChunk, COL_TRACK_TAG, &pColChunk); - - if (pNodeHdrChunk){ - ReadChunkData3ds(pNodeHdrChunk); - pNodeHdr = pNodeHdrChunk->data; - } - - if(pColChunk){ - ReadChunkData3ds(pColChunk); - pColData = pColChunk->data; - nColKeys = pColData->trackhdr.keycount; - } - - /*-------------------------------------------- - | Set-up and fill-in the kfambient3ds structure - +--------------------------------------------*/ - InitAmbientLightMotion3ds(kfambient, nColKeys); - - pKfAmbient = *kfambient; - - /*--- Header Information */ - if (pNodeHdr){ - pKfAmbient->flags1 = pNodeHdr->flags1; - pKfAmbient->flags2 = pNodeHdr->flags2; - } - - /*--- Color Information */ - if (pColData){ - if (nColKeys){ - pKfAmbient->ncflag = pColData->trackhdr.flags; - for(i=0; ickeys)[i]), - &((pColData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfAmbient->color)[i]), - &((pColData->colorlist)[i]), - sizeof(fcolor3ds)); - } - } - } - - /*--- Free Chunk Data */ - if (pNodeHdrChunk) - FreeFileChunkData3ds(pNodeHdrChunk); - if (pColChunk) - FreeFileChunkData3ds(pColChunk); -} - -/*-------------------------------------------------------------------------- - | PutAmbientLightMotion3ds - | Puts AmbientLight keyframe information into database. - | - | kfAmbientLight3ds--->db - | - | KFDATA - | ... - | LIGHT_NODE - | NODE_ID - | NODE_HDR - | APP_DATA - | COL_TRACK - | - | Needs Work: - | 1. NodeId: what value? - | - +--------------------------------------------------------------------------*/ -void PutAmbientLightMotion3ds(database3ds *db, kfambient3ds *kfambient) -{ - chunk3ds - *pKfChunk, *pAmbientChunk, *pAmbientXdata = NULL; - - if(db == NULL || kfambient == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if(db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATA); - - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /*--- Find KFSEG chunk to put keyframe data into */ - kfGetKfSeg(db->topchunk, &pKfChunk); - - /*--- Destroy old chunks, Copy any XData and reattach it later */ - kfExtractXdata(db, kAmbientName, AMBIENT_NODE_TAG, &pAmbientXdata); - - pAmbientChunk = kfPutGenericNode(AMBIENT_NODE_TAG, pKfChunk); - kfPutNodeId(pAmbientChunk); - kfPutNodeHeader(kAmbientName, - kfambient->flags1, - kfambient->flags2, - (char3ds *)0, - pAmbientChunk); - - if (kfambient->nckeys>0 && kfambient->ckeys && kfambient->color) - kfPutColorTrack(kfambient->nckeys, - kfambient->ncflag, - kfambient->ckeys, - kfambient->color, - pAmbientChunk); - - /*--- Replace XData */ - if (pAmbientXdata) - AddChildOrdered3ds(pAmbientChunk, pAmbientXdata); -} - -void DeleteAmbientLightMotion3ds(database3ds *db) -{ - DeleteNodeTagByNameAndType3ds(db, kAmbientName, AMBIENT_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopyAmbientLightMotion3ds(database3ds *destdb, database3ds *srcdb) -{ - CopyNodeTagByNameAndType3ds(destdb, srcdb, kAmbientName, AMBIENT_NODE_TAG); - ON_ERROR_RETURN; -} - - diff --git a/3rdparty/3dsftk3/src/3dsambm.h b/3rdparty/3dsftk3/src/3dsambm.h deleted file mode 100644 index 3b0164d0..00000000 --- a/3rdparty/3dsftk3/src/3dsambm.h +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef AMBM_3DS_H -#define AMBM_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" - -#define NoParent3ds -1 - -/* Public Typedefs */ - -/* kfambient3ds - Ambient light animation */ -typedef struct { - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag for color keys */ - keyheader3ds *ckeys; /* Spline values for position keys */ - fcolor3ds *color; /* Color keys */ -} kfambient3ds; -/* End Public */ - -/* Public Prototypes */ - -/* Ambient Light Animation Functions */ -void InitAmbientLightMotion3ds(kfambient3ds **light, ulong3ds nckeys); -void ReleaseAmbientLightMotion3ds(kfambient3ds **light); -void GetAmbientLightMotion3ds(database3ds *db, kfambient3ds **kfambient); -void PutAmbientLightMotion3ds(database3ds *db, kfambient3ds *kfambient); -void DeleteAmbientLightMotion3ds(database3ds *db); -void CopyAmbientLightMotion3ds(database3ds *destdb, database3ds *srcdb); -/* End Public */ - -void GetAmbientLightMotionChunk3ds(chunk3ds *pAmbientChunk, - kfambient3ds **kfambient); - - - -#endif diff --git a/3rdparty/3dsftk3/src/3dsaset.c b/3rdparty/3dsftk3/src/3dsaset.c deleted file mode 100644 index c3e904b7..00000000 --- a/3rdparty/3dsftk3/src/3dsaset.c +++ /dev/null @@ -1,521 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* 3dsaset.c, 3dsaset.h - - Inits, frees, puts and gets the atmosphere3ds structure which provides - and interface to the 3ds astmostpheric effects depth cue, fog, and - layer fog (DISTANCE_CUE, FOG, and LAYER_FOG chunks. -*/ - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsftkst.h" -#include "chunk3ds.h" -#include "dbase3ds.h" -#include "3dsaset.h" - -/* Initializes the atmosphere3ds structure, if **env is an address to a null pointer, - then memory for the structure will also be allocated */ -void InitAtmosphere3ds(atmosphere3ds **atmo) -{ - if (atmo == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* if the pointer is a null, then allocate the structure */ - if (*atmo == NULL) - { - *atmo = malloc(sizeof(atmosphere3ds)); - if(*atmo == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - } - - (*atmo)->fog.nearplane = 0.0f; - (*atmo)->fog.neardensity = 0.0f; - (*atmo)->fog.farplane = 1000.0f; - (*atmo)->fog.fardensity = 100.0f; - (*atmo)->fog.fogcolor.r = (*atmo)->fog.fogcolor.g = (*atmo)->fog.fogcolor.b = 0.0f; - (*atmo)->fog.fogbgnd = True3ds; - - (*atmo)->layerfog.zmin = 0.0f; - (*atmo)->layerfog.zmax = 100.0f; - (*atmo)->layerfog.density = 50.0f; - (*atmo)->layerfog.fogcolor.r = (*atmo)->layerfog.fogcolor.g = (*atmo)->layerfog.fogcolor.b = 0.0f; - (*atmo)->layerfog.falloff = NoFall; - (*atmo)->layerfog.fogbgnd = True3ds; - - (*atmo)->dcue.nearplane = 0.0f; - (*atmo)->dcue.neardim = 0.0f; - (*atmo)->dcue.farplane = 1000.0f; - (*atmo)->dcue.fardim = 100.0f; - - (*atmo)->activeatmo = NoAtmo; -} - -void ReleaseAtmosphere3ds(atmosphere3ds **atmo) -{ - if(atmo == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (*atmo != NULL) - { - free(*atmo); - *atmo = NULL; - } -} - -/* Retreves the atmospheric settings from chunk database */ -void GetAtmosphere3ds(database3ds *db, /* the database being searched */ - atmosphere3ds **atmo /* the atmosphere settings - destination. If *atmo is NULL, - then a new structure will be - allocated */ - ) -{ - chunk3ds *mdata, *chunk; - - if (db == NULL || atmo == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* find the MDATA chunk */ - FindChunk3ds(db->topchunk, MDATA, &mdata); - - /* if the MDATA chunk was found, then search for the atmospheric chunks */ - if (mdata != NULL) - { - InitAtmosphere3ds(atmo); - - /* Search for fog chunk */ - FindChunk3ds(mdata, FOG, &chunk); - if (chunk != NULL) - { - Fog *fog; - chunk3ds *color, *bgnd; - - /* Read the chunk information */ - fog = ReadChunkData3ds(chunk); - - /* Copy the fog data into the structure */ - (*atmo)->fog.nearplane = fog->nearplanedist; - (*atmo)->fog.neardensity = fog->nearplanedensity; - (*atmo)->fog.farplane = fog->farplanedist; - (*atmo)->fog.fardensity = fog->farplanedensity; - - /* Search for fog color chunk */ - FindChunk3ds(chunk, COLOR_F, &color); - if (color != NULL) - { - ColorF *c; - - c = ReadChunkData3ds(color); - - (*atmo)->fog.fogcolor.r = c->red; - (*atmo)->fog.fogcolor.g = c->green; - (*atmo)->fog.fogcolor.b = c->blue; - } - - /* Search for fog_bgnd chunk */ - FindChunk3ds(chunk, FOG_BGND, &bgnd); - if (bgnd != NULL) - { - (*atmo)->fog.fogbgnd = True3ds; - } else - { - (*atmo)->fog.fogbgnd = False3ds; - } - - } - - /* search for layer_fog chunk */ - FindChunk3ds(mdata, LAYER_FOG, &chunk); - if (chunk != NULL) - { - LayerFog *fog; - chunk3ds *color; - - fog = ReadChunkData3ds(chunk); - - (*atmo)->layerfog.zmin = fog->zmin; - (*atmo)->layerfog.zmax = fog->zmax; - (*atmo)->layerfog.density = fog->density; - - if ((fog->type & LayerFogBgnd) == LayerFogBgnd) - (*atmo)->layerfog.fogbgnd = True3ds; - else - (*atmo)->layerfog.fogbgnd = False3ds; - - if ((fog->type & TopFalloff) == TopFalloff) - (*atmo)->layerfog.falloff = TopFall; - else { - if ((fog->type & BottomFalloff) == BottomFalloff) - (*atmo)->layerfog.falloff = BottomFall; - else - (*atmo)->layerfog.falloff = NoFall; - } - - FindChunk3ds(chunk, COLOR_F, &color); - if (color != NULL) - { - ColorF *c; - - c = ReadChunkData3ds(color); - - (*atmo)->layerfog.fogcolor.r = c->red; - (*atmo)->layerfog.fogcolor.g = c->green; - (*atmo)->layerfog.fogcolor.b = c->blue; - } - } - - /* Search for distance_cue chunk */ - FindChunk3ds(mdata, DISTANCE_CUE, &chunk); - if (chunk != NULL) - { - DistanceCue *dcue; - chunk3ds *bgnd; - - dcue = ReadChunkData3ds(chunk); - - (*atmo)->dcue.nearplane = dcue->nearplanedist; - (*atmo)->dcue.neardim = dcue->nearplanedimming; - (*atmo)->dcue.farplane = dcue->farplanedist; - (*atmo)->dcue.fardim = dcue->farplanedimming; - - FindChunk3ds(chunk, DCUE_BGND, &bgnd); - if (bgnd != NULL) - { - (*atmo)->dcue.dcuebgnd = True3ds; - } else - { - (*atmo)->dcue.dcuebgnd = False3ds; - } - - } - - /* Search for use_fog, use_layer_fog, or use_distance_cue */ - FindChunk3ds(mdata, USE_FOG, &chunk); - if (chunk != NULL) - { - (*atmo)->activeatmo = UseFog; - } else - { - FindChunk3ds(mdata, USE_LAYER_FOG, &chunk); - if (chunk != NULL) - { - (*atmo)->activeatmo = UseLayerFog; - } else - { - FindChunk3ds(mdata, USE_DISTANCE_CUE, &chunk); - if (chunk != NULL) - { - (*atmo)->activeatmo = UseDistanceCue; - } else - { - (*atmo)->activeatmo = NoAtmo; - } - } - } - } -} - -/* Adds/replaces atmosphere settings in the chunk database */ -void PutAtmosphere3ds(database3ds *db, /* Database being modified */ - atmosphere3ds *atmo /* The atmosphere settings being added */ - ) -{ - chunk3ds *mdata, *color, *chunk, *bgnd; - Fog *fog; - LayerFog *layerfog; - DistanceCue *dcue; - ColorF *c; - - if (db == NULL || atmo == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if(db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Search for a mesh data chunk */ - FindChunk3ds(db->topchunk, MDATA, &mdata); - - /* If one isn't found, then add a new one to the database */ - if (mdata == NULL) - { - InitChunk3ds(&mdata); - mdata->tag = MDATA; - AddChildOrdered3ds(db->topchunk, mdata); - } - - /* Search for a FOG chunk, and replace the existing one or add a new one */ - ReplaceOrAddChild3ds(mdata, FOG, &chunk); - - /* Create a new data structure */ - InitChunkData3ds(chunk); - - /* Type safe the void pointer */ - fog = chunk->data; - - fog->nearplanedist = atmo->fog.nearplane; - fog->nearplanedensity = atmo->fog.neardensity; - fog->farplanedist = atmo->fog.farplane; - fog->farplanedensity = atmo->fog.fardensity; - - /* Add color chunk */ - InitChunk3ds(&color); - color->tag = COLOR_F; - InitChunkData3ds(color); - - c = color->data; - c->red = atmo->fog.fogcolor.r; - c->green = atmo->fog.fogcolor.g; - c->blue = atmo->fog.fogcolor.b; - - AddChildOrdered3ds(chunk, color); - - if (atmo->fog.fogbgnd) - { - InitChunk3ds(&bgnd); - bgnd->tag = FOG_BGND; - AddChildOrdered3ds(chunk, bgnd); - } - - /* Add a layer_fog chunk */ - ReplaceOrAddChild3ds(mdata, LAYER_FOG, &chunk); - InitChunkData3ds(chunk); - layerfog = chunk->data; - - layerfog->zmin = atmo->layerfog.zmin; - layerfog->zmax = atmo->layerfog.zmax; - layerfog->density = atmo->layerfog.density; - switch(atmo->layerfog.falloff) - { - case NoFall: - layerfog->type = NoFalloff; - break; - case TopFall: - layerfog->type = TopFalloff; - break; - case BottomFall: - layerfog->type = BottomFalloff; - } - - if (atmo->layerfog.fogbgnd) - layerfog->type |= LayerFogBgnd; - - InitChunk3ds(&color); - color->tag = COLOR_F; - InitChunkData3ds(color); - - c = color->data; - c->red = atmo->layerfog.fogcolor.r; - c->green = atmo->layerfog.fogcolor.g; - c->blue = atmo->layerfog.fogcolor.b; - - AddChildOrdered3ds(chunk, color); - - /* Add a distance_cue chunk */ - ReplaceOrAddChild3ds(mdata, DISTANCE_CUE, &chunk); - InitChunkData3ds(chunk); - dcue = chunk->data; - - dcue->nearplanedist = atmo->dcue.nearplane; - dcue->nearplanedimming = atmo->dcue.neardim; - dcue->farplanedist = atmo->dcue.farplane; - dcue->farplanedimming = atmo->dcue.fardim; - - if (atmo->dcue.dcuebgnd) - { - InitChunk3ds(&bgnd); - bgnd->tag = DCUE_BGND; - AddChildOrdered3ds(chunk, bgnd); - } - - /* Add a use_fog, use_layer_fog, or use_distance_cue */ - - /* first, find any existing use_* chunks */ - FindChunk3ds(mdata, USE_FOG, &chunk); - if (chunk == NULL) - { - FindChunk3ds(mdata, USE_LAYER_FOG, &chunk); - if (chunk == NULL) - { - FindChunk3ds(mdata, USE_DISTANCE_CUE, &chunk); - } - } - - /* If one was found, delete it */ - if (chunk != NULL) - { - DeleteChunk3ds(chunk); - } - - if (atmo->activeatmo != NoAtmo) - { - if (chunk == NULL) - { - InitChunk3ds(&chunk); - chunk->tag = USE_FOG; /* just to help place in order */ - AddChildOrdered3ds(mdata,chunk); - } - - /* add the new use_* chunk */ - switch (atmo->activeatmo) - { - case UseFog: - chunk->tag = USE_FOG; - break; - case UseLayerFog: - chunk->tag = USE_LAYER_FOG; - break; - case UseDistanceCue: - chunk->tag = USE_DISTANCE_CUE; - break; - case NoAtmo: - chunk->tag = NULL_CHUNK; - break; - } - } -} - -void CopyAtmosphere3ds(database3ds *destdb, database3ds *srcdb) -{ - chunk3ds *srcmdata, *destmdata, *srcchunk, *destchunk; - - if ((destdb == NULL) || (srcdb == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find source mesh section */ - FindChunk3ds(srcdb->topchunk, MDATA, &srcmdata); - - /* If found */ - if (srcmdata != NULL) - { - /* Find or create destination mesh section */ - FindChunk3ds(destdb->topchunk, MDATA, &destmdata); - if (destmdata == NULL) - { - InitChunkAs3ds(&destmdata, MDATA); - AddChildOrdered3ds(destdb->topchunk, destmdata); - } - - /* Scan the source mdata section looking for mesh setting chunks */ - for (srcchunk = srcmdata->children; srcchunk != NULL; srcchunk = srcchunk->sibling) - { - switch(srcchunk->tag) - { - case FOG: - case LAYER_FOG: - case DISTANCE_CUE: - case USE_FOG: - case USE_LAYER_FOG: - case USE_DISTANCE_CUE: - /* if the same chunk exists in the destination, then delete it */ - FindNextChunk3ds(destmdata->children, srcchunk->tag, &destchunk); - if (destchunk != NULL) - DeleteChunk3ds(destchunk); - - /* Copy and add the chunk */ - CopyChunk3ds(srcchunk, &destchunk); - AddChildOrdered3ds(destmdata, destchunk); - break; - default: - break; - } - } - } -} - diff --git a/3rdparty/3dsftk3/src/3dsaset.h b/3rdparty/3dsftk3/src/3dsaset.h deleted file mode 100644 index 55aa5635..00000000 --- a/3rdparty/3dsftk3/src/3dsaset.h +++ /dev/null @@ -1,177 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/* 3dsaset.c, 3dsaset.h - - Inits, frees, puts and gets the atmosphere3ds structure which provides - and interface to the 3ds atmospheric effects depth cue, fog, and - layer fog (DISTANCE_CUE, FOG, and LAYER_FOG chunks. -*/ - -#ifndef ASET_3DS_H -#define ASET_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" - -/* Public Consts */ -/* Fog flags */ -static const ulong3ds LayerFogBgnd = 0x100000; -static const ulong3ds NoFalloff = 0x0; -static const ulong3ds TopFalloff = 0x2; -static const ulong3ds BottomFalloff = 0x1; - -/* End Public */ - -/* Public Typedefs */ -typedef enum -{ - NoAtmo, /* no active astmospherics */ - UseFog, /* fog astmostpheric */ - UseLayerFog, /* layer fog astmostpheric */ - UseDistanceCue /* distance cue astmostpheric */ -} atmospheretype3ds; - -typedef enum -{ - NoFall, /* no falloff */ - TopFall, /* falloff to the top */ - BottomFall /* falloff to the bottom */ -} layerfogfalloff3ds; - -typedef struct /* fog atmosphere parameters */ -{ - float3ds nearplane; /* near radius of fog effect */ - float3ds neardensity; /* near fog density */ - float3ds farplane; /* far radius of fog effect */ - float3ds fardensity; /* far fog density */ - fcolor3ds fogcolor; /* color of fog effect */ - byte3ds fogbgnd; /* True3ds / False3ds "fog background" flag */ -} fogsettings3ds; - -typedef struct /* layered fog atmosphere parameters */ -{ - float3ds zmin; /* lower bounds of fog */ - float3ds zmax; /* upper bounds of fog */ - float3ds density; /* fog density */ - fcolor3ds fogcolor; /* fog color */ - layerfogfalloff3ds falloff; /* falloff style */ - byte3ds fogbgnd; /* True3ds / False3ds "fog background" flag */ -} layerfogsettings3ds; - -typedef struct /* distance cue atmosphere parameters */ -{ - float3ds nearplane; /* near radius of effect */ - float3ds neardim; /* near dimming factor */ - float3ds farplane; /* far radius of effect */ - float3ds fardim; /* far dimming factor */ - byte3ds dcuebgnd; /* True3ds / False3ds effect the background flag */ -} dcuesettings3ds; - -typedef struct { - fogsettings3ds fog; /* fog atmostphere settings */ - layerfogsettings3ds layerfog; /* layered fog atmosphere parameters */ - dcuesettings3ds dcue; /* distance cue atmosphere parameters */ - atmospheretype3ds activeatmo; /* The active astmospheric */ -} atmosphere3ds; - -/* End Public */ - -/* Public Prototypes */ -void InitAtmosphere3ds(atmosphere3ds **atmo); -void ReleaseAtmosphere3ds(atmosphere3ds **atmo); -void GetAtmosphere3ds(database3ds *db, atmosphere3ds **atmo); -void PutAtmosphere3ds(database3ds *db, atmosphere3ds *atmo); -void CopyAtmosphere3ds(database3ds *destdb, database3ds *srcdb); - -/* End Public */ - - - - -#endif - - diff --git a/3rdparty/3dsftk3/src/3dsbbox.c b/3rdparty/3dsftk3/src/3dsbbox.c deleted file mode 100644 index e210a656..00000000 --- a/3rdparty/3dsftk3/src/3dsbbox.c +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include "3dstype.h" -#include "3dserr.h" -#include "chunk3ds.h" -#include "3dsmobj.h" -#include "3dsobjm.h" -#include "3dsbbox.h" - -void SetBoundBox3ds(const mesh3ds *mobj, kfmesh3ds *kobj ) -{ - ushort3ds i; - - if((mobj == NULL) || (kobj == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if((mobj->vertexarray == NULL) || (mobj->nvertices == 0)) - SET_ERROR_RETURN(ERR_INVALID_DATA); - - kobj->boundmin.x = kobj->boundmax.x = mobj->vertexarray[0].x; - kobj->boundmin.y = kobj->boundmax.y = mobj->vertexarray[0].y; - kobj->boundmin.z = kobj->boundmax.z = mobj->vertexarray[0].z; - - for (i=1; invertices; i++) { - if( mobj->vertexarray[i].x < kobj->boundmin.x ) - kobj->boundmin.x = mobj->vertexarray[i].x; - if( mobj->vertexarray[i].y < kobj->boundmin.y ) - kobj->boundmin.y = mobj->vertexarray[i].y; - if( mobj->vertexarray[i].z < kobj->boundmin.z ) - kobj->boundmin.z = mobj->vertexarray[i].z; - - if( mobj->vertexarray[i].x > kobj->boundmax.x ) - kobj->boundmax.x = mobj->vertexarray[i].x; - if( mobj->vertexarray[i].y > kobj->boundmax.y ) - kobj->boundmax.y = mobj->vertexarray[i].y; - if( mobj->vertexarray[i].z > kobj->boundmax.z ) - kobj->boundmax.z = mobj->vertexarray[i].z; - } -} diff --git a/3rdparty/3dsftk3/src/3dsbbox.h b/3rdparty/3dsftk3/src/3dsbbox.h deleted file mode 100644 index d1760ec2..00000000 --- a/3rdparty/3dsftk3/src/3dsbbox.h +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef BBOX_3DS_H -#define BBOX_3DS_H - -/* Public Prototypes */ -void SetBoundBox3ds(const mesh3ds *mobj, kfmesh3ds *kobj ); -/* End Public */ - -#endif diff --git a/3rdparty/3dsftk3/src/3dsbgnd.c b/3rdparty/3dsftk3/src/3dsbgnd.c deleted file mode 100644 index 23de06e5..00000000 --- a/3rdparty/3dsftk3/src/3dsbgnd.c +++ /dev/null @@ -1,509 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* Inits, frees, puts and gets the background3ds structure which provides an */ -/* interface to the 3D Studio scene background settings. */ - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsbgnd.h" -#include "3dsftkst.h" -#include "chunk3ds.h" -#include "dbase3ds.h" - -/* Initializes the background3ds structure, if **bgnd is an address to */ -/* a null pointer, then memory for the struture will be allocated at */ -/* this time */ -void InitBackground3ds(background3ds **bgnd) -{ - if (bgnd == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* if the pointer is NULL, then allocated the structure */ - if (*bgnd == NULL) - { - *bgnd = malloc(sizeof(background3ds)); - - if(*bgnd == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - } - - (*bgnd)->bitmap.name = NULL; - (*bgnd)->solid.color.r = (*bgnd)->solid.color.g = (*bgnd)->solid.color.b = 0.0f; - (*bgnd)->vgradient.gradpercent = 0.5f; - (*bgnd)->vgradient.top.r = (*bgnd)->vgradient.top.g = (*bgnd)->vgradient.top.b = 0.0f; - (*bgnd)->vgradient.mid.r = (*bgnd)->vgradient.mid.g = (*bgnd)->vgradient.mid.b = 0.0f; - (*bgnd)->vgradient.bottom.r = (*bgnd)->vgradient.bottom.g = (*bgnd)->vgradient.bottom.b = 0.0f; - (*bgnd)->bgndused = NoBgnd; -} - -void ReleaseBackground3ds(background3ds **bgnd) -{ - if (bgnd != NULL) - { - if ((*bgnd)->bitmap.name != NULL) - { - free((*bgnd)->bitmap.name); - (*bgnd)->bitmap.name = NULL; - } - - free(*bgnd); - *bgnd = NULL; - } - -} - -/* Retreaves the background settings from the chunk database */ -void GetBackground3ds(database3ds *db, /* the database being searched */ - background3ds **bgnd /* the background settings - destination. If *atmo is NULL, - then a new structure will be - allocated */ - ) -{ - chunk3ds *mdata, *chunk; - - if (db == NULL || bgnd == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Find the MDATA chunk */ - FindChunk3ds(db->topchunk, MDATA, &mdata); - - /* only continue with structure filling if an MDATA chunk is found */ - if (mdata != NULL) - { - InitBackground3ds(bgnd); - - /* Search for bitmap chunk */ - FindChunk3ds(mdata, BIT_MAP, &chunk); - if (chunk != NULL) - { - BitMap *bitmap; - - /* Read the chunk information */ - ReadChunkData3ds(chunk); - - /* Alias the data */ - bitmap = chunk->data; - - /* Copy the bitmap filename to the structure */ - if (bitmap->bitmap != NULL) (*bgnd)->bitmap.name = strdup(bitmap->bitmap); - else (*bgnd)->bitmap.name = strdup(""); - } - - FindChunk3ds(mdata, SOLID_BGND, &chunk); - if (chunk != NULL) - { - chunk3ds *cc; - - FindChunk3ds(chunk, COLOR_F, &cc); - if (cc != NULL) - { - ColorF *cd; - - cd = ReadChunkData3ds(cc); - (*bgnd)->solid.color.r = cd->red; - (*bgnd)->solid.color.g = cd->green; - (*bgnd)->solid.color.b = cd->blue; - } - - FindChunk3ds(chunk, LIN_COLOR_F, &cc); - if (cc != NULL) - { - LinColorF *cd; - - cd = ReadChunkData3ds(cc); - (*bgnd)->solid.color.r = cd->red; - (*bgnd)->solid.color.g = cd->green; - (*bgnd)->solid.color.b = cd->blue; - } - } - - FindChunk3ds(mdata, V_GRADIENT, &chunk); - if (chunk != NULL) - { - chunk3ds *topcolor, *midcolor, *botcolor; - - /* The COLOR_F chunks are the old, non-gamma corrected colors */ - ReadChunkData3ds(chunk); - (*bgnd)->vgradient.gradpercent = ((VGradient *)(chunk->data))->gradpercent; - FindChunk3ds(chunk, COLOR_F, &topcolor); - if (topcolor != NULL) - { - ReadChunkData3ds(topcolor); - (*bgnd)->vgradient.top.r = ((ColorF *)(topcolor->data))->red; - (*bgnd)->vgradient.top.g = ((ColorF *)(topcolor->data))->green; - (*bgnd)->vgradient.top.b = ((ColorF *)(topcolor->data))->blue; - FindNextChunk3ds(topcolor->sibling, COLOR_F, &midcolor); - if (midcolor != NULL) - { - ReadChunkData3ds(midcolor); - (*bgnd)->vgradient.mid.r = ((ColorF *)(midcolor->data))->red; - (*bgnd)->vgradient.mid.g = ((ColorF *)(midcolor->data))->green; - (*bgnd)->vgradient.mid.b = ((ColorF *)(midcolor->data))->blue; - FindNextChunk3ds(midcolor->sibling, COLOR_F, &botcolor); - if (botcolor != NULL) - { - ReadChunkData3ds(botcolor); - (*bgnd)->vgradient.bottom.r = ((ColorF *)(botcolor->data))->red; - (*bgnd)->vgradient.bottom.g = ((ColorF *)(botcolor->data))->green; - (*bgnd)->vgradient.bottom.b = ((ColorF *)(botcolor->data))->blue; - } - } - } - - /* If the newer, gamma correct colors are available, then use them instead */ - FindChunk3ds(chunk, LIN_COLOR_F, &topcolor); - if (topcolor != NULL) - { - ReadChunkData3ds(topcolor); - (*bgnd)->vgradient.top.r = ((ColorF *)(topcolor->data))->red; - (*bgnd)->vgradient.top.g = ((ColorF *)(topcolor->data))->green; - (*bgnd)->vgradient.top.b = ((ColorF *)(topcolor->data))->blue; - FindNextChunk3ds(topcolor->sibling, LIN_COLOR_F, &midcolor); - if (midcolor != NULL) - { - ReadChunkData3ds(midcolor); - (*bgnd)->vgradient.mid.r = ((ColorF *)(midcolor->data))->red; - (*bgnd)->vgradient.mid.g = ((ColorF *)(midcolor->data))->green; - (*bgnd)->vgradient.mid.b = ((ColorF *)(midcolor->data))->blue; - FindNextChunk3ds(midcolor->sibling, LIN_COLOR_F, &botcolor); - if (botcolor != NULL) - { - ReadChunkData3ds(botcolor); - (*bgnd)->vgradient.bottom.r = ((ColorF *)(botcolor->data))->red; - (*bgnd)->vgradient.bottom.g = ((ColorF *)(botcolor->data))->green; - (*bgnd)->vgradient.bottom.b = ((ColorF *)(botcolor->data))->blue; - } - } - } - } - - /* Search for use_bitmap, use_solid_bgnd, or use_v_gradient */ - FindChunk3ds(mdata, USE_BIT_MAP, &chunk); - if (chunk != NULL) - { - (*bgnd)->bgndused = UseBitmapBgnd; - } else - { - FindChunk3ds(mdata, USE_SOLID_BGND, &chunk); - if (chunk != NULL) - { - (*bgnd)->bgndused = UseSolidBgnd; - } else - { - FindChunk3ds(mdata, USE_V_GRADIENT, &chunk); - if (chunk != NULL) - { - (*bgnd)->bgndused = UseVGradientBgnd; - } else - { - (*bgnd)->bgndused = NoBgnd; - } - } - } - } -} - -void PutBackground3ds(database3ds *db, background3ds *bgnd) -{ - chunk3ds *mdata; - - if(db == NULL || bgnd == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if(db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Search for a mesh data chunk */ - FindChunk3ds(db->topchunk, MDATA, &mdata); - - /* If one isn't found, add it to the list */ - if (mdata == NULL) - { - InitChunkAs3ds(&mdata, MDATA); - AddChildOrdered3ds(db->topchunk, mdata); - } - - /* if (1) */ /* Put bitmap background chunk. */ - { - chunk3ds *c; - BitMap *d; - - ReplaceOrAddChild3ds(mdata, BIT_MAP, &c); - d = InitChunkData3ds(c); - d->bitmap = (bgnd->bitmap.name)? strdup(bgnd->bitmap.name): strdup(""); - } - - /* if (1) */ /* Put the SOLID_BGND chunk */ - { - chunk3ds *cs, *cc; - ColorF *dc; - - ReplaceOrAddChild3ds(mdata, SOLID_BGND, &cs); - - dc = InitChunkAndData3ds(&cc, COLOR_F); - - dc->red = bgnd->solid.color.r; - dc->green = bgnd->solid.color.g; - dc->blue = bgnd->solid.color.b; - - AddChild3ds(cs, cc); - - dc = InitChunkAndData3ds(&cc, LIN_COLOR_F); - - dc->red = bgnd->solid.color.r; - dc->green = bgnd->solid.color.g; - dc->blue = bgnd->solid.color.b; - - AddChild3ds(cs, cc); - } - - /* if (1) */ /* Put the V_GRADIENT chunk */ - { - chunk3ds *cv, *cc; - VGradient *dv; - ColorF *dc; - - ReplaceOrAddChild3ds(mdata, V_GRADIENT, &cv); - dv = InitChunkData3ds(cv); - dv->gradpercent = bgnd->vgradient.gradpercent; - - dc = InitChunkAndData3ds(&cc, COLOR_F); - dc->red = bgnd->vgradient.top.r; - dc->green = bgnd->vgradient.top.g; - dc->blue = bgnd->vgradient.top.b; - - AddChild3ds(cv, cc); - - dc = InitChunkAndData3ds(&cc, LIN_COLOR_F); - dc->red = bgnd->vgradient.top.r; - dc->green = bgnd->vgradient.top.g; - dc->blue = bgnd->vgradient.top.b; - - AddChild3ds(cv, cc); - - dc = InitChunkAndData3ds(&cc, COLOR_F); - dc->red = bgnd->vgradient.mid.r; - dc->green = bgnd->vgradient.mid.g; - dc->blue = bgnd->vgradient.mid.b; - - AddChild3ds(cv, cc); - - dc = InitChunkAndData3ds(&cc, LIN_COLOR_F); - dc->red = bgnd->vgradient.mid.r; - dc->green = bgnd->vgradient.mid.g; - dc->blue = bgnd->vgradient.mid.b; - - AddChild3ds(cv, cc); - - dc = InitChunkAndData3ds(&cc, COLOR_F); - dc->red = bgnd->vgradient.bottom.r; - dc->green = bgnd->vgradient.bottom.g; - dc->blue = bgnd->vgradient.bottom.b; - - AddChild3ds(cv, cc); - - dc = InitChunkAndData3ds(&cc, LIN_COLOR_F); - dc->red = bgnd->vgradient.bottom.r; - dc->green = bgnd->vgradient.bottom.g; - dc->blue = bgnd->vgradient.bottom.b; - - AddChild3ds(cv, cc); - - } - - /* if (1) */ /* Add a use_bitmap_bgnd, use_solid_bgnd, or use_v_gradient */ - { - chunk3ds *chunk; - - /* first, find any existing use_* chunks */ - FindChunk3ds(mdata, USE_BIT_MAP, &chunk); - if (chunk == NULL) - { - FindChunk3ds(mdata, USE_SOLID_BGND, &chunk); - if (chunk == NULL) - { - FindChunk3ds(mdata, USE_V_GRADIENT, &chunk); - } - } - - /* If one was found, delete it */ - if (chunk != NULL) - { - DeleteChunk3ds(chunk); - } - - if (bgnd->bgndused != NoBgnd) - { - if (chunk == NULL) - { - InitChunk3ds(&chunk); - chunk->tag = USE_BIT_MAP; /* just to help place in order */ - AddChildOrdered3ds(mdata,chunk); - } - - /* add the new use_* chunk */ - switch (bgnd->bgndused) - { - case UseBitmapBgnd: - chunk->tag = USE_BIT_MAP; - break; - case UseSolidBgnd: - chunk->tag = USE_SOLID_BGND; - break; - case UseVGradientBgnd: - chunk->tag = USE_V_GRADIENT; - break; - case NoBgnd: - chunk->tag = NULL_CHUNK; - break; - } - } - } -} - -void CopyBackground3ds(database3ds *destdb, database3ds *srcdb) -{ - chunk3ds *srcmdata, *destmdata, *srcchunk, *destchunk; - - if ((destdb == NULL) || (srcdb == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find source mesh section */ - FindChunk3ds(srcdb->topchunk, MDATA, &srcmdata); - - /* If found */ - if (srcmdata != NULL) - { - /* Find or create destination mesh section */ - FindChunk3ds(destdb->topchunk, MDATA, &destmdata); - if (destmdata == NULL) - { - InitChunkAs3ds(&destmdata, MDATA); - AddChildOrdered3ds(destdb->topchunk, destmdata); - } - - /* Scan the source mdata section looking for background setting chunks */ - for (srcchunk = srcmdata->children; srcchunk != NULL; srcchunk = srcchunk->sibling) - { - switch(srcchunk->tag) - { - case V_GRADIENT: - case SOLID_BGND: - case BIT_MAP: - case USE_SOLID_BGND: - case USE_V_GRADIENT: - case USE_BIT_MAP: - /* if the same chunk exists in the destination, then delete it */ - FindNextChunk3ds(destmdata->children, srcchunk->tag, &destchunk); - if (destchunk != NULL) - DeleteChunk3ds(destchunk); - - /* Copy and add the chunk */ - CopyChunk3ds(srcchunk, &destchunk); - AddChildOrdered3ds(destmdata, destchunk); - break; - default: - break; - } - } - } -} - - diff --git a/3rdparty/3dsftk3/src/3dsbgnd.h b/3rdparty/3dsftk3/src/3dsbgnd.h deleted file mode 100644 index b32dc887..00000000 --- a/3rdparty/3dsftk3/src/3dsbgnd.h +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/* Inits, frees, puts and gets the background3ds structure which provides an */ -/* interface to the 3D Studio scene background settings. */ - -#ifndef BGND_3DS_H -#define BGND_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" - -/* Public Typedefs */ -/* enumerate list of possible backgrounds used in file */ -typedef enum -{ - NoBgnd, - UseSolidBgnd, - UseVGradientBgnd, - UseBitmapBgnd -} backgroundtype3ds; - -typedef struct -{ - char3ds *name; /* name of background bitmap */ -} bitmapbgnd3ds; - -typedef struct -{ - fcolor3ds color; /* color of solid background */ -} solidbgnd3ds; - -typedef struct -{ - float3ds gradpercent; /* Placement of mid color band, ranges from 0-1 */ - fcolor3ds top; /* color of top band */ - fcolor3ds mid; /* color of mid background band */ - fcolor3ds bottom; /* color of bottom band */ -} vgradientbgnd3ds; - -typedef struct { - bitmapbgnd3ds bitmap; - solidbgnd3ds solid; - vgradientbgnd3ds vgradient; - backgroundtype3ds bgndused; /* background in effect */ -} background3ds; - -/* End Public */ - -/* Public Prototypes */ -void InitBackground3ds(background3ds **bgnd); -void ReleaseBackground3ds(background3ds **bgnd); -void GetBackground3ds(database3ds *db, background3ds **bgnd); -void PutBackground3ds(database3ds *db, background3ds *bgnd); -void CopyBackground3ds(database3ds *destdb, database3ds *srcdb); - -/* End Public */ - -#endif diff --git a/3rdparty/3dsftk3/src/3dscamm.c b/3rdparty/3dsftk3/src/3dscamm.c deleted file mode 100644 index 914ef454..00000000 --- a/3rdparty/3dsftk3/src/3dscamm.c +++ /dev/null @@ -1,666 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "xdata.h" -#include "3dscamm.h" -#include "kfutils.h" - -/*---------------------------------------------------------------------- - | - | InitCameraMotion3ds - | - +---------------------------------------------------------------------*/ -void InitCameraMotion3ds(kfcamera3ds **cam, - ulong3ds npkeys, - ulong3ds nfkeys, - ulong3ds nrkeys, - ulong3ds ntkeys) -{ - ulong3ds i; - - if (*cam == NULL) - { - (*cam) = malloc(sizeof(kfcamera3ds)); - if(*cam == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - (*cam)->name[0] = 0; - (*cam)->parent[0] = 0; - (*cam)->flags1 = (*cam)->flags2 = (ushort3ds)0; - (*cam)->npkeys = npkeys; - (*cam)->nfkeys = nfkeys; - (*cam)->nrkeys = nrkeys; - (*cam)->tparent[0] = 0; - (*cam)->ntkeys = ntkeys; - (*cam)->pkeys = NULL; - (*cam)->pos = NULL; - (*cam)->fkeys = NULL; - (*cam)->fov = NULL; - (*cam)->rkeys = NULL; - (*cam)->roll = NULL; - (*cam)->tkeys = NULL; - (*cam)->tpos = NULL; - } - - if (npkeys != 0) - { - (*cam)->npflag = TrackSingle3ds; - - (*cam)->npkeys = npkeys; - if ((*cam)->pkeys != NULL) {free((*cam)->pkeys); (*cam)->pkeys = NULL;} - if ((*cam)->pos != NULL) {free((*cam)->pos); (*cam)->pos = NULL;} - - (*cam)->pkeys = calloc((*cam)->npkeys, sizeof(keyheader3ds)); - if ((*cam)->pkeys == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*cam)->npkeys; i++) - memcpy(&(((*cam)->pkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - (*cam)->pos = calloc((*cam)->npkeys, sizeof(point3ds)); - if ((*cam)->pos == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*cam)->npkeys; i++) - memcpy(&(((*cam)->pos)[i]), &DefPoint3ds, sizeof(DefPoint3ds)); - } - - if (nfkeys != 0) - { - (*cam)->nfflag = TrackSingle3ds; - - (*cam)->nfkeys = nfkeys; - if ((*cam)->fkeys != NULL) {free((*cam)->fkeys); (*cam)->fkeys = NULL;} - if ((*cam)->fov != NULL) {free((*cam)->fov); (*cam)->fov = NULL;} - - (*cam)->fkeys = calloc((*cam)->nfkeys, sizeof(keyheader3ds)); - if((*cam)->fkeys == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*cam)->nfkeys; i++) - memcpy(&(((*cam)->fkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - (*cam)->fov = calloc((*cam)->nfkeys, sizeof(float3ds)); - if((*cam)->fov == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - for (i = 0; i < (*cam)->nfkeys; i++) - ((*cam)->fov)[i] = 60.0F; - } - - if (nrkeys != 0) - { - (*cam)->nrflag = TrackSingle3ds; - - (*cam)->nrkeys = nrkeys; - if ((*cam)->rkeys != NULL) {free((*cam)->rkeys); (*cam)->rkeys = NULL;} - if ((*cam)->roll != NULL) {free((*cam)->roll); (*cam)->roll = NULL;} - - (*cam)->rkeys = calloc((*cam)->nrkeys, sizeof(keyheader3ds)); - if((*cam)->rkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - for (i = 0; i < (*cam)->nrkeys; i++) - memcpy(&(((*cam)->rkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - (*cam)->roll = calloc((*cam)->nrkeys, sizeof(float3ds)); - if((*cam)->roll == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - for (i = 0; i < (*cam)->nrkeys; i++) - ((*cam)->roll)[i] = 0.0F; - } - - if (ntkeys != 0) - { - (*cam)->ntflag = TrackSingle3ds; - (*cam)->tflags1 = (*cam)->tflags2 = (short3ds)0; - - (*cam)->ntkeys = ntkeys; - if ((*cam)->tkeys != NULL) {free((*cam)->tkeys); (*cam)->tkeys = NULL;} - if ((*cam)->tpos != NULL) {free((*cam)->tpos); (*cam)->tpos = NULL;} - - (*cam)->tkeys = calloc((*cam)->ntkeys, sizeof(keyheader3ds)); - if((*cam)->tkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - for (i = 0; i < (*cam)->ntkeys; i++) - memcpy(&(((*cam)->tkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - (*cam)->tpos = calloc((*cam)->ntkeys, sizeof(point3ds)); - if((*cam)->tpos == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - for (i = 0; i < (*cam)->ntkeys; i++) - memcpy(&(((*cam)->tpos)[i]), &DefPoint3ds, sizeof(DefPoint3ds)); - } - -} - -/*------------------------------------------------------------- - | - | ReleaseCameraMotion3ds - | - +-------------------------------------------------------------*/ -void ReleaseCameraMotion3ds(kfcamera3ds **cam) -{ - if (*cam != NULL) { - if((*cam)->pkeys != NULL) free((*cam)->pkeys); - if((*cam)->pos != NULL) free((*cam)->pos); - if((*cam)->fkeys != NULL) free((*cam)->fkeys); - if((*cam)->fov != NULL) free((*cam)->fov); - if((*cam)->rkeys != NULL) free((*cam)->rkeys); - if((*cam)->roll != NULL) free((*cam)->roll); - if((*cam)->tkeys != NULL) free((*cam)->tkeys); - if((*cam)->tpos != NULL) free((*cam)->tpos); - free(*cam); - *cam = NULL; - } -} - -/*----------------------------------------------------------------- - | - | GetCameraNodCount3ds - | - +-----------------------------------------------------------------*/ -ulong3ds GetCameraNodeCount3ds(database3ds *db) -{ - return kfGetGenericNodeCount(db, CAMERA_NODE_TAG); -} - -/*------------------------------------------------------------------ - | - | GetCameraNodNameList3ds - | - +-----------------------------------------------------------------*/ -void GetCameraNodeNameList3ds(database3ds *db, namelist3ds **list) -{ - kfGetGenericNodeNameList(db, CAMERA_NODE_TAG, list); -} - -/*---------------------------------------------------------------------- - | - | GetCameraMotionByName3ds - | - | db: database to be searched - | name: name of camera - | kfcam: Ptr to the addr of kfcamera3ds structure, if (*kfcam) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfcam remains unchanged. - | - +----------------------------------------------------------------------*/ -void GetCameraMotionByName3ds(database3ds *db, - const char3ds *name, - kfcamera3ds **kfcam) -{ - chunk3ds *pCameraChunk, *pTargetChunk; - - if ((db == NULL) || (name == NULL)) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != M3DMAGIC) && (db->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - kfFindNamedAndTaggedChunk(db, name, CAMERA_NODE_TAG, &pCameraChunk); - - if (pCameraChunk) - kfFindNamedAndTaggedChunk(db, name, TARGET_NODE_TAG, &pTargetChunk); - - if (pCameraChunk) - GetCameraMotion3ds(pCameraChunk, pTargetChunk, kfcam); - -} - -/*---------------------------------------------------------------------- - | - | GetCameraMotionByIndex3ds - | - | db: database to be searched - | index: index of camera in name list - | kfcam: Ptr to the addr of kfcamera3ds structure, if (*kfcam) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfcam remains unchanged. - | - +----------------------------------------------------------------------*/ -void GetCameraMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfcamera3ds **kfcam) -{ - chunk3ds *pCameraChunk, *pTargetChunk; - namelist3ds *list = NULL; - char3ds *name; - - if(db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - GetCameraNodeNameList3ds(db, &list); - - if(index < list->count){ - - name = list->list[index].name; - kfFindNamedAndTaggedChunk(db, name, CAMERA_NODE_TAG, &pCameraChunk); - - if (pCameraChunk){ - kfFindNamedAndTaggedChunk(db, name, TARGET_NODE_TAG, &pTargetChunk); - GetCameraMotion3ds(pCameraChunk, pTargetChunk, kfcam); - } - } - /*--- release list when done using name */ - ReleaseNameList3ds(&list); -} - - - -/*-------------------------------------------------------------------------- - | GetCameraMotion3ds - | - | pCamChunk:CAMERA_NODE_TAG chunk to extract data from - | pTargetChunk: TARGET_NODE_TAG chunk to extract target data from - | kfcam: Structure to fill in with chunk data - | - | chunk----->kfcamera3ds - | - | Gets camera keyframe information from chunk - | - +--------------------------------------------------------------------------*/ -void GetCameraMotion3ds(chunk3ds *pCamChunk, - chunk3ds *pTargetChunk, - kfcamera3ds **kfcam) -{ - kfcamera3ds - *pKfCam; - chunk3ds - *pNodeHdrChunk, *pPosChunk, *pFovChunk, - *pRollChunk, *pTargetPosChunk = NULL, *pTargetHdrChunk = NULL; - ulong3ds - i, nPosKeys = 0, nFovKeys = 0, nRollKeys = 0, nTargetKeys = 0; - NodeHdr - *pNodeHdr, *pTargetHdr = NULL; - PosTrackTag - *pPosData = NULL, *pTargetData = NULL; - FovTrackTag - *pFovData = NULL; - RollTrackTag - *pRollData = NULL; - - if(pCamChunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - - /*------------------------------- - | Get information from chunks - +-------------------------------*/ - /*--- Search children of camera chunk */ - FindChunk3ds(pCamChunk, NODE_HDR, &pNodeHdrChunk); - FindChunk3ds(pCamChunk, POS_TRACK_TAG, &pPosChunk); - FindChunk3ds(pCamChunk, FOV_TRACK_TAG, &pFovChunk); - FindChunk3ds(pCamChunk, ROLL_TRACK_TAG, &pRollChunk); - - ReadChunkData3ds(pNodeHdrChunk); - pNodeHdr = pNodeHdrChunk->data; - - if(pPosChunk){ - ReadChunkData3ds(pPosChunk); - pPosData = pPosChunk->data; - nPosKeys = pPosData->trackhdr.keycount; - } - - if(pFovChunk){ - ReadChunkData3ds(pFovChunk); - pFovData = pFovChunk->data; - nFovKeys = pFovData->trackhdr.keycount; - } - - if(pRollChunk){ - ReadChunkData3ds(pRollChunk); - pRollData = pRollChunk->data; - nRollKeys = pRollData->trackhdr.keycount; - } - - if (pTargetChunk){ - FindChunk3ds(pTargetChunk, NODE_HDR, &pTargetHdrChunk); - if (pTargetHdrChunk){ - ReadChunkData3ds(pTargetHdrChunk); - pTargetHdr = pTargetHdrChunk->data; - } - - FindChunk3ds(pTargetChunk, POS_TRACK_TAG, &pTargetPosChunk); - if (pTargetPosChunk){ - ReadChunkData3ds(pTargetPosChunk); - pTargetData = pTargetPosChunk->data; - nTargetKeys = pTargetData->trackhdr.keycount; - } - } - - /*-------------------------------------------- - | Set-up and fill-in the kfcamera structure - +--------------------------------------------*/ - InitCameraMotion3ds(kfcam, - nPosKeys, - nFovKeys, - nRollKeys, - nTargetKeys); - - pKfCam = *kfcam; - - /*--- Header Information */ - strcpy(pKfCam->name, pNodeHdr->objname); - pKfCam->flags1 = pNodeHdr->flags1; - pKfCam->flags2 = pNodeHdr->flags2; - - /*--- Parents */ - kfGetParentName(pNodeHdrChunk, pKfCam->parent); - kfGetParentName(pTargetHdrChunk, pKfCam->tparent); - - /*--- Target Information */ - if (nTargetKeys){ - pKfCam->ntflag = pTargetData->trackhdr.flags; - - for(i=0; itkeys)[i]), - &((pTargetData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfCam->tpos)[i]), - &((pTargetData->positionlist)[i]), - sizeof(point3ds)); - } - } - if (pTargetHdr) { - pKfCam->tflags1 = pTargetHdr->flags1; - pKfCam->tflags2 = pTargetHdr->flags2; - } - - /*--- Position Information */ - if (nPosKeys){ - pKfCam->npflag = pPosData->trackhdr.flags; - for (i=0; ipkeys)[i]), - &((pPosData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfCam->pos)[i]), - &((pPosData->positionlist)[i]), - sizeof(point3ds)); - } - } - - /*--- Field of view Information */ - if (nFovKeys){ - pKfCam->nfflag = pFovData->trackhdr.flags; - for (i=0; ifkeys)[i]), - &((pFovData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfCam->fov)[i]), - &((pFovData->fovanglelist)[i]), - sizeof(float3ds)); - } - } - - /*--- Roll Track Information */ - if (nRollKeys){ - pKfCam->nrflag = pRollData->trackhdr.flags; - for (i=0; irkeys)[i]), - &((pRollData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfCam->roll)[i]), - &((pRollData->rollanglelist)[i]), - sizeof(float3ds)); - } - } - - /*--- Free Chunk Data */ - FreeFileChunkData3ds(pPosChunk); - FreeFileChunkData3ds(pFovChunk); - FreeFileChunkData3ds(pRollChunk); - FreeFileChunkData3ds(pNodeHdrChunk); - if (pTargetPosChunk) - FreeFileChunkData3ds(pTargetPosChunk); - if (pTargetHdrChunk) - FreeFileChunkData3ds(pTargetHdrChunk); -} - -/*-------------------------------------------------------------------------- - | PutCameraMotion3ds - | Puts camera keyframe information into database. - | - | kfcamera3ds--->db - | - | KFDATA - | ... - | TARGET - | CAMERA_NODE - | NODE_ID - | NODE_HDR - | APP_DATA - | POS_TRACK - | FOV_TRACK - | ROLL_TRACK - | - | Needs Work: - | 1. NodeId: what value? - | - +--------------------------------------------------------------------------*/ -void PutCameraMotion3ds(database3ds *db, kfcamera3ds *kfcam) -{ - chunk3ds - *pKfChunk, *pCamChunk, *pTargetChunk = NULL, - *pCameraXdata = NULL, *pTargetXdata = NULL; - - if(db == NULL || kfcam == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATA); - - if (!(db->topchunk->tag == M3DMAGIC) || (db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_INVALID_DATA); - - /*--- Find KFSEG chunk to put keyframe data into */ - kfGetKfSeg(db->topchunk, &pKfChunk); - ON_ERROR_RETURN; - - /*--- Destroy old chunks, Copy any XData and reattach it later */ - kfExtractXdata(db, kfcam->name, TARGET_NODE_TAG, &pTargetXdata); - kfExtractXdata(db, kfcam->name, CAMERA_NODE_TAG, &pCameraXdata); - - MakeNodeTagListDirty3ds(db); - - /*--- TARGET TRACK */ - if (kfcam->ntkeys>0 && kfcam->tkeys && kfcam->tpos) - pTargetChunk = kfPutTargetTrack(kfcam->tparent, - kfcam->ntkeys, - kfcam->ntflag, - kfcam->tkeys, - kfcam->tpos, - kfcam->name, - kfcam->tflags1, - kfcam->tflags2, - CameraTarget, - pKfChunk); - - pCamChunk = kfPutGenericNode(CAMERA_NODE_TAG, pKfChunk); - kfPutNodeId(pCamChunk); - kfPutNodeHeader(kfcam->name, - kfcam->flags1, - kfcam->flags2, - kfcam->parent, - pCamChunk); - - if (kfcam->npkeys>0 && kfcam->pkeys && kfcam->pos) - kfPutPosTrack(kfcam->npkeys, - kfcam->npflag, - kfcam->pkeys, - kfcam->pos, - pCamChunk); - - /*-- FIELD OF VIEW */ - if (kfcam->nfkeys>0 && kfcam->fkeys && kfcam->fov){ - FovTrackTag *data; - chunk3ds *temp = NULL; - int nKeys; - - /*--- Create the FOV_TRACK_TAG chunk */ - InitChunk3ds(&temp); - temp->tag = FOV_TRACK_TAG; - data = InitChunkData3ds(temp); - - /*--- Initialize trackhdr field */ - data->trackhdr.flags = kfcam->nfflag; - nKeys = data->trackhdr.keycount = kfcam->nfkeys; - data->trackhdr.nu1 = data->trackhdr.nu2 = 0; /* Not Used */ - - /*--- Copy headers */ - data->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - memcpy(data->keyhdrlist, kfcam->fkeys, nKeys * sizeof(keyheader3ds)); - - /*--- Copy Points */ - data->fovanglelist = malloc(nKeys * sizeof(float3ds)); - memcpy(data->fovanglelist, kfcam->fov, nKeys * sizeof(float3ds)); - - /*--- Make if a child of the kframe node */ - AddChildOrdered3ds(pCamChunk, temp); - } - - if (kfcam->nrkeys>0 && kfcam->rkeys && kfcam->roll) - kfPutRollTrack(kfcam->nrkeys, - kfcam->nrflag, - kfcam->rkeys, - kfcam->roll, - pCamChunk); - - /*--- Replace XData */ - if (pCameraXdata) - AddChildOrdered3ds(pCamChunk, pCameraXdata); - if (pTargetXdata) - AddChildOrdered3ds(pTargetChunk, pTargetXdata); -} - -void DeleteCameraMotionByIndex3ds(database3ds *db, ulong3ds index) -{ - DeleteNodeTagByIndexAndType3ds(db, index, CAMERA_NODE_TAG); - ON_ERROR_RETURN; -} - -void DeleteCameraMotionByName3ds(database3ds *db, char3ds *name) -{ - DeleteNodeTagByNameAndType3ds(db, name, CAMERA_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopyCameraMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - CopyNodeTagByIndexAndType3ds(destdb, srcdb, index, CAMERA_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopyCameraMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - CopyNodeTagByNameAndType3ds(destdb, srcdb, name, CAMERA_NODE_TAG); - ON_ERROR_RETURN; -} diff --git a/3rdparty/3dsftk3/src/3dscamm.h b/3rdparty/3dsftk3/src/3dscamm.h deleted file mode 100644 index 3ee3a939..00000000 --- a/3rdparty/3dsftk3/src/3dscamm.h +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef CAMM_3DS_H -#define CAMM_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" -#include "chunk3ds.h" - -#define NoParent3ds -1 - -/* Public Typedefs */ - -typedef struct { - char3ds name[11]; /* Name of camera object */ - char3ds parent[22]; /* Name of parent object */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds npkeys; /* Number of camera position keys */ - ushort3ds npflag; /* Loop control flag for camera position keys */ - keyheader3ds *pkeys; /* Spline values for camera position keys */ - point3ds *pos; /* Camera position keys */ - - ulong3ds nfkeys; /* Number of camera FOV keys */ - ushort3ds nfflag; /* Loop control flag for camera FOV keys */ - keyheader3ds *fkeys; /* Spline values for camera FOV keys */ - float3ds *fov; /* Camera FOV keys */ - - ulong3ds nrkeys; /* Number of camera roll keys */ - ushort3ds nrflag; /* Loop control flag for camera roll keys */ - keyheader3ds *rkeys; /* Spline values for camera roll keys */ - float3ds *roll; /* Camera roll keys */ - - char3ds tparent[22]; /* Index of parent object for target */ - ulong3ds ntkeys; /* Number of target position keys */ - ushort3ds ntflag; /* Loop control flag for target position keys */ - keyheader3ds *tkeys; /* Spline values for target position keys */ - point3ds *tpos; /* Target position keys */ - ushort3ds tflags1; /* flags field from target node header */ - ushort3ds tflags2; /* flags field from target node header */ -} kfcamera3ds; -/* End Public */ - -/* Public Prototypes */ - -void InitCameraMotion3ds(kfcamera3ds **cam, ulong3ds npkeys, ulong3ds nfkeys, - ulong3ds nrkeys, ulong3ds ntkeys); - -void GetCameraMotionByName3ds(database3ds *db, - const char3ds *name, - kfcamera3ds **kfcam); - -void GetCameraMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfcamera3ds **kfcam); - -void PutCameraMotion3ds(database3ds *db, kfcamera3ds *kfcam); - - -void ReleaseCameraMotion3ds(kfcamera3ds **cam); - -ulong3ds GetCameraNodeCount3ds(database3ds *db); - -void GetCameraNodeNameList3ds(database3ds *db, namelist3ds **list); - -void DeleteCameraMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteCameraMotionByName3ds(database3ds *db, char3ds *name); -void CopyCameraMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyCameraMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); - -/* End Public */ - -void GetCameraMotion3ds(chunk3ds *pCamChunk, chunk3ds *pTargetChunk, - kfcamera3ds **kfcam); - - - -#endif - diff --git a/3rdparty/3dsftk3/src/3dscamr.c b/3rdparty/3dsftk3/src/3dscamr.c deleted file mode 100644 index f0697906..00000000 --- a/3rdparty/3dsftk3/src/3dscamr.c +++ /dev/null @@ -1,434 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* Module Overview: - - 3dscamr.c and 3dscamr.h concern themselves with the handling of cameras - inside the 3ds mesh section. - -*/ - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dscamr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dsutil.h" - -void InitCamera3ds(camera3ds **cam) -{ - if (cam == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (*cam == NULL) - { - *cam = malloc(sizeof(camera3ds)); - if (*cam == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - } - - (*cam)->name[0] = 0; - (*cam)->position.x = 0.0f; - (*cam)->position.y = 0.0f; - (*cam)->position.z = 0.0f; - (*cam)->target.x = 1.0f; - (*cam)->target.y = 1.0f; - (*cam)->target.z = 1.0f; - (*cam)->roll = 0.0f; - (*cam)->fov = 45.0f; - (*cam)->showcone = False3ds; - (*cam)->ranges.cam_near = 10.0f; - (*cam)->ranges.cam_far = 1000.0f; -} - -void ReleaseCamera3ds(camera3ds **cam) -{ - if (cam != NULL) - { - if (*cam != NULL) - { - free(*cam); - } - *cam = NULL; - } -} - -ulong3ds GetCameraCount3ds(database3ds *db) -{ - chunk3ds *ncam; - ulong3ds camcount = 0, i; - - UpdateNamedObjectList3ds(db); - - if (db->objlist == NULL) return 0; - - for (i = 0; i < db->objlist->count; i++) - { - FindChunk3ds(db->objlist->list[i].chunk, N_CAMERA, &ncam); - if (ncam != NULL) camcount++; - } - - return camcount; -} - -void GetCameraNameList3ds(database3ds *db, namelist3ds **list) -{ - chunk3ds *current=NULL, *nobj=NULL, *ncam; - ulong3ds camcount, i, j; - - if (db == NULL || list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - UpdateNamedObjectList3ds(db); - - camcount = GetCameraCount3ds(db); - - InitNameList3ds(list, camcount); - - for (i = 0, j = 0; (i < db->objlist->count) && (j < camcount); i++) - { - FindChunk3ds(db->objlist->list[i].chunk, N_CAMERA, &ncam); - if (ncam != NULL) - { - (*list)->list[j].name = strdup(db->objlist->list[i].name); - j++; - } - } -} - -void GetCameraByIndex3ds(database3ds *db, ulong3ds index, camera3ds **cam) -{ - chunk3ds *ncam; - ulong3ds i, camcount; - - if (db == NULL || cam == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - UpdateNamedObjectList3ds(db); - - for (i = 0, camcount = 0; i < db->objlist->count; i++) - { - FindChunk3ds(db->objlist->list[i].chunk, N_CAMERA, &ncam); - if (ncam != NULL) - { - camcount++; - if (camcount-1 == index) GetCameraEntry3ds(db->objlist->list[i].chunk, cam); - } - } -} - -void GetCameraByName3ds(database3ds *db, char3ds *name, camera3ds **cam) -{ - chunk3ds *nobj, *ncam; - - if (db == NULL || name == NULL || cam == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - UpdateNamedObjectList3ds(db); - - FindNamedObject3ds(db, name, &nobj); - - if (nobj != NULL) - { - FindChunk3ds(nobj, N_CAMERA, &ncam); - if (ncam == NULL) - SET_ERROR_RETURN(ERR_WRONG_OBJECT); - GetCameraEntry3ds(nobj, cam); - } -} - -void DeleteCameraByName3ds(database3ds *db, char3ds *name) -{ - - DeleteNamedObjectByName3ds(db, name); - ON_ERROR_RETURN; -} - -void DeleteCameraByIndex3ds(database3ds *db, ulong3ds index) -{ - DeleteChunkTypeByIndex3ds(db, N_CAMERA, index); - ON_ERROR_RETURN; -} - -void CopyCameraByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - - CopyNamedObjectByIndex3ds(destdb, srcdb, N_CAMERA, index); - ON_ERROR_RETURN; -} - -void CopyCameraByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - CopyNamedObjectByName3ds(destdb, srcdb, name); - ON_ERROR_RETURN; -} - -void PutCamera3ds(database3ds *db, camera3ds *cam) -{ - chunk3ds *mdata, *nobj = NULL, *ncamera = NULL, *current = NULL; - NamedObject *nobjdata; - NCamera *ncameradata; - chunk3ds *xdata = NULL; - - if (db == NULL || cam == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if (!(db->topchunk->tag == M3DMAGIC) || (db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - FindChunk3ds(db->topchunk, MDATA, &mdata); - - if (mdata == NULL) - { - InitChunk3ds(&mdata); - AddChildOrdered3ds(db->topchunk, mdata); - } - - FindNamedObject3ds(db, cam->name, &nobj); - - if (nobj != NULL) - { - FindChunk3ds(nobj, XDATA_SECTION, &xdata); - DeleteChunk3ds(nobj); - nobj = NULL; - } - - nobjdata = InitChunkAndData3ds(&nobj, NAMED_OBJECT); - ON_ERROR_RETURN; - - nobjdata->name = malloc(strlen(cam->name)+1); - strcpy(nobjdata->name, cam->name); - - AddChildOrdered3ds(mdata, nobj); - MakeNamedObjectListDirty3ds(db); - - InitChunk3ds(&ncamera); - ncamera->tag = N_CAMERA; - AddChild3ds(nobj, ncamera); - - /* Fill in the camera chunk definition */ - ncamera->size = HeaderSize3ds + 2*PointSize3ds + 2*FloatSize3ds; - - ncameradata = malloc(sizeof(NCamera)); - ncamera->data = ncameradata; - - ncameradata->camerapos.x = cam->position.x; - ncameradata->camerapos.y = cam->position.y; - ncameradata->camerapos.z = cam->position.z; - ncameradata->targetpos.x = cam->target.x; - ncameradata->targetpos.y = cam->target.y; - ncameradata->targetpos.z = cam->target.z; - ncameradata->camerabank = cam->roll; - ncameradata->camerafocallength = 2400.0f / cam->fov; - - if (cam->showcone) - { - chunk3ds *showcone = NULL; - - InitChunk3ds(&showcone); - showcone->tag = CAM_SEE_CONE; - showcone->size = 6; - - AddChild3ds(ncamera, showcone); - ncamera->size += showcone->size; - } - - /* if (1) */ - { - chunk3ds *ranges = NULL; - - InitChunk3ds(&ranges); - ranges->tag = CAM_RANGES; - ranges->size = 2*FloatSize3ds; - ranges->data = malloc(sizeof(CamRanges)); - ((CamRanges *)(ranges->data))->nearplane = cam->ranges.cam_near; - ((CamRanges *)(ranges->data))->farplane = cam->ranges.cam_far; - - AddChild3ds(ncamera, ranges); - ncamera->size += ranges->size; - - } - - if (xdata != NULL) - { - AddChild3ds(ncamera, xdata); - ncamera->size += xdata->size; - } -} - -void GetCameraEntry3ds(chunk3ds *chunk, camera3ds **cam) -{ - chunk3ds *ncam, *current, *nobj; - NCamera *data; - - if(chunk == NULL || cam == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (chunk->tag != NAMED_OBJECT) - SET_ERROR_RETURN(ERR_WRONG_OBJECT); - - FindNextChunk3ds(chunk->children, N_CAMERA, &ncam); - if (ncam == NULL) SET_ERROR_RETURN(ERR_WRONG_OBJECT); - - InitCamera3ds(cam); - ON_ERROR_RETURN; - - CopyChunk3ds(chunk, &nobj); - ON_ERROR_RETURN; - - FindNextChunk3ds(nobj->children, N_CAMERA, &ncam); - - ReadChunkData3ds(nobj); - ON_ERROR_RETURN; - - strcpy((*cam)->name, ((NamedObject *)(nobj->data))->name); - - ReadChunkData3ds(ncam); - ON_ERROR_RETURN; - - data = ncam->data; - (*cam)->position.x = data->camerapos.x; - (*cam)->position.y = data->camerapos.y; - (*cam)->position.z = data->camerapos.z; - (*cam)->target.x = data->targetpos.x; - (*cam)->target.y = data->targetpos.y; - (*cam)->target.z = data->targetpos.z; - (*cam)->roll = data->camerabank; - (*cam)->fov = 2400.0f / data->camerafocallength; - - for (current = ncam->children; current != NULL; current = current->sibling) - { - switch(current->tag) - { - case CAM_SEE_CONE: - (*cam)->showcone = True3ds; - break; - case CAM_RANGES: - { - CamRanges *data; - ReadChunkData3ds(current); - data = current->data; - - (*cam)->ranges.cam_near = data->nearplane; - (*cam)->ranges.cam_far = data->farplane; - break; - } - } - } - /* ReleaseChunk3ds(&ncam); */ - ReleaseChunk3ds(&nobj); /* CCJ */ -} - - -#ifdef NOTWORKING -short3ds AddCamera3ds(const char3ds *name, const point3ds *pos, const point3ds *targ, float3ds bnkang, float3ds foc, ushort3ds cone) -{ - ReturnIfError3ds(); - - OpenNamedObject3ds(name); - ReturnIfError3ds(); - - if (cone == True3ds) cone = CamSeeCone3ds; - - WriteNCamera3ds(pos, targ, bnkang, foc, cone); - ReturnIfError3ds(); - - CloseNamedObject3ds(); - ReturnIfError3ds(); - - ReturnSuccess3ds(); -} - - -#endif - diff --git a/3rdparty/3dsftk3/src/3dscamr.h b/3rdparty/3dsftk3/src/3dscamr.h deleted file mode 100644 index 6f0568fa..00000000 --- a/3rdparty/3dsftk3/src/3dscamr.h +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef CAMR_3DS_H -#define CAMR_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" -#include "xdata.h" - -/* Public Typedefs */ - -/* camrange3ds - Camera atomosphere ranges */ -typedef struct { - float3ds cam_near; /* Nearest effect radiu */ - float3ds cam_far; /* Farthest effect radius */ -} camranges3ds; - -typedef struct -{ - char3ds name[11]; - point3ds position; - point3ds target; - float3ds roll; - float3ds fov; - byte3ds showcone; - camranges3ds ranges; -} camera3ds; -/* End Public */ - -/* Public Prototypes */ -void InitCamera3ds(camera3ds **cam); -void ReleaseCamera3ds(camera3ds **cam); -ulong3ds GetCameraCount3ds(database3ds *db); -void GetCameraNameList3ds(database3ds *db, namelist3ds **list); -void GetCameraByIndex3ds(database3ds *db, ulong3ds index, camera3ds **cam); -void GetCameraByName3ds(database3ds *db, char3ds *name, camera3ds **cam); -void PutCamera3ds(database3ds *db, camera3ds *cam); - -void CopyCameraByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyCameraByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); - -void DeleteCameraByName3ds(database3ds *db, char3ds *name); -void DeleteCameraByIndex3ds(database3ds *db, ulong3ds index); - -/* End Public */ -void GetCameraEntry3ds(chunk3ds *chunk, camera3ds **cam); - -#endif diff --git a/3rdparty/3dsftk3/src/3dserr.c b/3rdparty/3dsftk3/src/3dserr.c deleted file mode 100644 index 0bf76d91..00000000 --- a/3rdparty/3dsftk3/src/3dserr.c +++ /dev/null @@ -1,215 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include - -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" - -#define ERR_STACK_ENTRIES 20 - -#define ERR_STACK_INIT {NO_FTK_ERRORS, NULL} - -/* The extra entry is always set to NO_FTK_ERRORS so we always know were the end is */ -static ErrRec3ds ErrStack[ERR_STACK_ENTRIES+1] = {ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT, ERR_STACK_INIT}; - -/*--- Global Error Flags */ -byte3ds ftkerr3ds = FALSE3DS, ignoreftkerr3ds = FALSE3DS; - -void PushErrList3ds(errorid3ds id) -{ - int i = 0; - - if (id == NO_FTK_ERRORS) return; - - ftkerr3ds = True3ds; - - for (i = 0; i < (ERR_STACK_ENTRIES-1); i++) - { - if (ErrStack[i].id == NO_FTK_ERRORS) - { - ErrStack[i].id = id; - ErrStack[i].desc = ErrCodeToString3ds(id); - ErrStack[i+1].id = NO_FTK_ERRORS; - return; - } - } - /* If loop completed, then ERR_STACK_ENTRIES of errors has occured */ - if (ErrStack[ERR_STACK_ENTRIES].id == NO_FTK_ERRORS) /* If the last slot is empty */ - { - ErrStack[ERR_STACK_ENTRIES].id = id; /* Fill the last slot with a valid error */ - ErrStack[ERR_STACK_ENTRIES].desc = ErrCodeToString3ds(id); - } else /* Set the last error to max error warning */ - { - ErrStack[ERR_STACK_ENTRIES].id = N_ERRORS; - ErrStack[ERR_STACK_ENTRIES].desc = ErrCodeToString3ds(N_ERRORS); - } -} - -void ClearErrList3ds() -{ - int i; - - ftkerr3ds = False3ds; - - for (i=0; i -#include "3dstype.h" -#include "3dsprim.h" - -/* Public Typedefs */ - -/* Error codes generated by toolkit */ -typedef enum -{ - NO_FTK_ERRORS = 0, /* No errors are pending */ - ERR_NO_MEM, /* Not enough memory to complete operation */ - ERR_INVALID_ARG, /* The argument passed to the function invalid. Usually */ - /* caused by a NULL pointer or an out of range numeric */ - /* argument. */ - ERR_INVALID_DATA, /* The structure passed as an argument to the function has */ - /* invalid or out of range data in its fields. */ - ERR_INVALID_CHUNK, /* An invalid chunk structure was encountered while reading */ - /* the database. Usually caused by a corrupt database or */ - /* file */ - ERR_INVALID_DATABASE, /* The database passed as an argument has not be created */ - /* yet. */ - ERR_WRONG_DATABASE, /* The database passed as an argument is the wrong kind of */ - /* database for this function. */ - ERR_UNFOUND_CHUNK, /* The database is missing important file chunks needed to */ - /* fill out the requested structure. Usually caused by a */ - /* corrupt database or file */ - ERR_WRONG_OBJECT, /* The name passed to the functions exists, but is not the */ - /* type of object asked for. For example, asking for a mesh */ - /* object with the GetCameraByName3ds function. */ - ERR_NO_SUCH_FILE, /* The filename passed as an argument for reading does not exist */ - ERR_INIT_FAILED, /* Failed to initialize structure passed as an argument */ - ERR_OPENING_FILE, /* Could not open requested file */ - ERR_CLOSING_FILE, /* Could not close requested file */ - ERR_READING_FILE, /* Error occured while reading file */ - ERR_CREATING_DATABASE, /* Error occured while creating database */ - ERR_READING_DATABASE, /* Error occured while reading database */ - ERR_WRITING_DATABASE, /* Error occured while writing database */ - ERR_WRITING_FILE, /* Error occured while writing file */ - ERR_STRING_TOO_LONG, /* String encountered in file, structure, or as an */ - /* argument was longer than expected. Possibly caused by */ - /* an uninitialed pointer, corrupt file or database */ - ERR_TOO_MANY_FILES, /* The toolkit has reached its maximum open file limit of */ - /* 252 files. */ - ERR_GET_FAIL, /* Failed to get new data from database */ - ERR_PUT_FAIL, /* Failed to add new data to the database */ - N_ERRORS -}errorid3ds; - -typedef struct { - errorid3ds id; - const char3ds *desc; -} ErrRec3ds; - -/* End Public */ - -/* Public Consts */ -/* Last toolkit error */ -extern byte3ds ftkerr3ds; /* True3ds if error is pending */ -extern byte3ds ignoreftkerr3ds; /* True3ds if errors are being ignored by toolkit */ -/* End Public */ - -/* Private Prototypes */ -void PushErrList3ds(errorid3ds id); -const char3ds *ErrCodeToString3ds(errorid3ds err); -/* End Private */ - -/* Public Prototypes */ -void DumpErrList3ds(FILE *outfile); -void ClearErrList3ds(); -const ErrRec3ds *ReturnErrorList3ds(); - -/* End Public */ - -/* Public Defines */ -/*------------------------------------ - Error reporting and testing macros - ----------------------------------*/ - -/* Pending error flag values for ftkerr3ds global */ -#define FTK_ERROR True3ds -#define FTK_NO_ERROR False3ds - -/*--- If ftkerr3ds shows that an error has occured, return */ -#define ON_ERROR_RETURN {if(ftkerr3ds && !ignoreftkerr3ds) return;} -#define ON_ERROR_RETURNR(rval) {if(ftkerr3ds && !ignoreftkerr3ds) return rval;} - -/*--- If ftkerr3ds shows that an error has occured, push error and return */ -#define ADD_ERROR_RETURN(id) {if(ftkerr3ds){PushErrList3ds(id); if (!ignoreftkerr3ds) return;}} -#define ADD_ERROR_RETURNR(id, rval) {if(ftkerr3ds){PushErrList3ds(id); if (!ignoreftkerr3ds) return rval;}} - -/*--- If ftkerr3ds shows that an error has occured, push error */ -#define ADD_ERROR(id) {if (ftkerr3ds){PushErrList3ds(id);}} - -/*--- Reset the the error flag */ -#define CLEAR_ERROR {if (ftkerr3ds){ClearErrList3ds();}} - -/*--- Simply set the error state: Good if you need to clean-up before returning */ -#define SET_ERROR {ftkerr3ds=True3ds;} - -/*--- Set error state, push an error ID and return */ -#define SET_ERROR_RETURN(id) {PushErrList3ds(id); if (!ignoreftkerr3ds) return;} -#define SET_ERROR_RETURNR(id, rval) {PushErrList3ds(id); if (!ignoreftkerr3ds) return rval;} - -/* Prints errors and exits application */ -#define PRINT_ERRORS_EXIT(file) {if(ftkerr3ds){DumpErrList3ds(file); if (!ignoreftkerr3ds) exit(-1);}} -/* End Public */ -#endif /* ERR_3DS */ diff --git a/3rdparty/3dsftk3/src/3dsfile.c b/3rdparty/3dsftk3/src/3dsfile.c deleted file mode 100644 index 6cb9ef9d..00000000 --- a/3rdparty/3dsftk3/src/3dsfile.c +++ /dev/null @@ -1,502 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* The module concerns itself with the management of open 3ds files and provides - for association of a file handle with a number. */ - -#include -#include -#include -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dsstrlf.h" -#include "3dsrange.h" - -#include "3dsftkst.h" -#include "3dsfile.h" - -#include "3dserr.h" - -file3ds *FileContext3ds = NULL; /* The current file being read from and/or written to at - any given time by the other file routines. A trickier - way of doing it, but it keeps me from passing file handles - all around the place */ - -file3ds **FileContextList3ds = NULL; /* A list of open file3ds structures. Used to - associate a file with an index */ - -static const ubyte3ds MaxFileContext = 252; /* Maximum number of open 3DS files. Higher - values have other meanings, see file3ds for - more info on this */ - -static ubyte3ds NextFileContext = 0; /* The next available *file3ds slot in FileContextList3ds */ - -static ubyte3ds CurrentFileContext = 0; /* The corresponding index for the file in *FileContext3ds */ - -long3ds NewFileBufferSize3ds = 4096*2; - -/* Initializes **FileContextList3ds */ -void InitContextList3ds() -{ - ubyte3ds i; - - FileContextList3ds = calloc(MaxFileContext, sizeof(file3ds *)); - if (FileContextList3ds == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - for(i = 0; i < MaxFileContext; i++) FileContextList3ds[i] = NULL; - NextFileContext = 0; - CurrentFileContext = 0; -} - -/* Releases memory used by **FileContextList3ds */ -void ReleaseContextList3ds() -{ - - free(FileContextList3ds); - FileContextList3ds = NULL; - NextFileContext = 0; - CurrentFileContext = 0; -} - -/* Adds a file3ds * to **FileContextList3ds */ -void AddContext3ds(file3ds *file) -{ - ubyte3ds i; - - /* If this is the first add, initialize the list */ - if (FileContextList3ds == NULL) InitContextList3ds(); - - /* scan for an open slot in the list */ - - for (i = 0; i < NextFileContext; i++) - { - if (FileContextList3ds[i] == NULL) break; - } - - if (i>=MaxFileContext) - SET_ERROR_RETURN(ERR_TOO_MANY_FILES); - - /* Install the file pointer */ - FileContextList3ds[i] = file; - - /* Associate the list position with the file */; - file->index = i; - - /* Increment the file counter if needed */ - if (i == NextFileContext) NextFileContext++; -} - -/* Removes a file3ds * from **FileContextList3ds */ -void DelContext3ds(file3ds *file) -{ - myassert(file != NULL, "DelContext3ds: arg *file cannot be NULL"); - - /* if the file's list position is accurate */ - if (file == FileContextList3ds[file->index]) - { - /* Clear the file's entry */ - FileContextList3ds[file->index] = NULL; - file->index = InvalidFileContext3ds; /* Make sure the file index gets invalidated */ - } -} - -void SetContextByIndex3ds(ubyte3ds index) -{ - if (index <= NextFileContext) - { - SetContext3ds(FileContextList3ds[index]); - } -} - -file3ds *GetContextByIndex3ds(ubyte3ds index) -{ - if (index < NextFileContext) - return(FileContextList3ds[index]); - else - return(NULL); -} - -file3ds *GetContextByName3ds(const char3ds *name) -{ - ubyte3ds i; - - for (i = 0; i < NextFileContext; i++) - { - if (FileContextList3ds[i] != NULL) - { - if (strcmp(FileContextList3ds[i]->filename, name) == 0) - return FileContextList3ds[i]; - } - } - return NULL; -} - -ubyte3ds GetContextIndex3ds() -{ - return(FileContext3ds->index); -} - -/* Returns True3ds if file index is a real file */ -byte3ds IsValidFileIndex3ds(ubyte3ds index) -{ - if (index == InvalidFileContext3ds) return False3ds; - return ((byte3ds)(GetContextByIndex3ds(index) != NULL)); -} - -/* Sets the file to be used for subsequent file operations */ -void SetContext3ds(file3ds *file) -{ - myassert(file != NULL, "SetContext3ds: arg *file cannot be NULL"); - - FileContext3ds = file; - CurrentFileContext = file->index; -} - -file3ds *GetContext3ds() -{ - return(FileContext3ds); -} - -void SetFileName3ds(const char3ds *filename) -{ - long3ds length; - - assert(filename != NULL); - - length = strlenf3ds(filename, FileNameStrMax3ds); - GetContext3ds()->filename = malloc(sizeof(char3ds)*(length+1)); - if (GetContext3ds()->filename == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - strcpy((GetContext3ds())->filename, filename); -} - -char3ds *GetFileName3ds() -{ - return((GetContext3ds())->filename); -} - -void InitFile3ds(file3ds **file) -{ - - (*file) = malloc(sizeof(file3ds)); - - if ((*file) == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - (*file)->file = NULL; - (*file)->filename = NULL; - (*file)->state = StateNotKnown; - (*file)->index = InvalidFileContext3ds; - (*file)->buffer = NULL; - (*file)->buffersize = 0; - (*file)->bufferposition = 0; - (*file)->istempfile = False3ds; -} - -file3ds *OpenFile3ds(const char3ds *filename, const char *attrib) -{ - file3ds *new = NULL; - file3ds *exist = NULL; - FILE *file = NULL; - long3ds i, length; - - if (filename == NULL || attrib == NULL) - SET_ERROR_RETURNR(ERR_INVALID_ARG, NULL); - - /* Search for duplicate filename in the list */ - exist = GetContextByName3ds(filename); - - InitFile3ds(&new); - ADD_ERROR_RETURNR(ERR_INIT_FAILED, NULL); - - AddContext3ds(new); - - new->filename = strdup(filename); - - if (new->filename == NULL) - ADD_ERROR_RETURNR(ERR_NO_MEM, NULL); - - strcpy(new->filename, filename); - - length = strlenf3ds(attrib, 30); - for (i = 0; i < length; i++) - { - if (attrib[i] == 'r') {new->state = new->state | ReadFromFile; break;} - - if (attrib[i] == 'w') {new->state = new->state | WriteToFile; break;} - } - if (new->state == StateNotKnown) - SET_ERROR_RETURNR(ERR_INIT_FAILED, NULL); - - /* If a file of this name is already in use */ - if (exist != NULL) - { - /* If the state is the same, then delete the new one and return the old */ - if (exist->state == new->state) - { - free(new->filename); - free(new); - return exist; - } - - /* If the existing is read, then the new must be write */ - if ((exist->state & ReadFromFile) != 0) - { - /* Change the existing filename */ - RenameFileToTemp3ds(exist); - ON_ERROR_RETURNR(NULL); - } else { /* New file is read while existing is write */ - /* Close it off so it can be opened for reading */ - CloseFile3ds(exist); - } - } - - switch(new->state) - { - case ReadFromFile: file = fopen(new->filename, "rb"); break; - case WriteToFile: file = fopen(new->filename, "wb"); break; - case ReadWriteFile: file = fopen(new->filename, "rb"); break; - } - - if (file == NULL) - SET_ERROR_RETURNR(ERR_OPENING_FILE, NULL); - - new->file = file; - - if (NewFileBufferSize3ds > 0) - { - void *buf; - - buf = malloc(NewFileBufferSize3ds); - if (buf != NULL) - { - new->buffer = buf; - new->buffersize = NewFileBufferSize3ds; - setbuf(file, new->buffer); - } - } - - return new; -} - -file3ds *OpenFile3ds_buf(char3ds *buf, long3ds len) -{ - file3ds *new = NULL; - - InitFile3ds(&new); - ADD_ERROR_RETURNR(ERR_INIT_FAILED, NULL); - - AddContext3ds(new); - - new->filename = 0; - new->istempfile = 0; - new->state = new->state | ReadFromFile; - - new->file = NULL; - new->buffer = buf; - new->buffersize = len; - new->bufferposition = 0; - - return new; -} - -ulong3ds GetFilePosition3ds() -{ - return GetContext3ds()->bufferposition; -} - -short3ds FileSeek3ds(long3ds newposition) -{ - GetContext3ds()->bufferposition = newposition; - return 1; -} - -void CloseAllFiles3ds() -{ - ubyte3ds i; - - for(i = 0; i < NextFileContext; i++) - { - CloseFile3ds(FileContextList3ds[i]); - ON_ERROR_RETURN; - } - free(FileContextList3ds); - - FileContextList3ds = NULL; - NextFileContext = 0; - CurrentFileContext = 0; -} - -void CloseFile3ds(file3ds *file) -{ - long3ds closeresult = 0, removeresult = 0; - - if (file != NULL) - { - if (file->file != NULL) - { - closeresult = fclose(file->file); - if (file->istempfile) removeresult = remove(file->filename); - } - - DelContext3ds(file); - - free(file->filename); - free(file->buffer); - free(file); - - if (closeresult != 0) - SET_ERROR_RETURN(ERR_CLOSING_FILE); - } -} - -void RenameFileToTemp3ds(file3ds *file) -{ - long3ds fileresult; - long3ds filepos; - char3ds *newtempname; - char3ds *c, *t; - - filepos = ftell(file->file); - - fileresult = fclose(file->file); - if (fileresult != 0) SET_ERROR_RETURN(ERR_CLOSING_FILE); - - newtempname = malloc(FileNameStrMax3ds); - if (newtempname == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - /* Make a copy of the old name, so we can strip off the name and keep the path */ - strcpy(newtempname, file->filename); - - for (c = &(newtempname[strlen(newtempname)-1]); c > newtempname; c--) - if ( *c == '\\' || *c == '/' || *c == ':') - { - c++; /* Keep the seperator */ - break; - } - - *c = 0; /* Null terminate the path */ - - /* Get the temp name */ - t = tmpnam(NULL); - - /* Since different platforms disagree on where the tempfile goes, be sure - to strip off any extra path information */ - for (c = &(t[strlen(t)-1]); c > t; c--) - if ( *c == '\\' || *c == '/' || *c == ':') - { - t = c + 1; /* just on the other side of the slash */ - break; - } - - /* append a temp name to the path */ - strcat(newtempname, t); - - fileresult = rename(file->filename, newtempname); - if (fileresult != 0) SET_ERROR_RETURN(ERR_OPENING_FILE); - - file->istempfile = True3ds; - free(file->filename); - file->filename = strdup(newtempname); - if (file->filename == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - free(newtempname); - - file->file = fopen(file->filename, "rb"); - if (file->file == NULL) SET_ERROR_RETURN(ERR_OPENING_FILE); - - if (file->buffer != NULL) - { - setbuf(file->file, file->buffer); - } - - /* Return to original position */ - fseek(file->file, filepos, 0); -} - diff --git a/3rdparty/3dsftk3/src/3dsfile.h b/3rdparty/3dsftk3/src/3dsfile.h deleted file mode 100644 index dcf29e2d..00000000 --- a/3rdparty/3dsftk3/src/3dsfile.h +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef FILE_3DS_H -#define FILE_3DS_H - -#include "3dstype.h" -#include "3dsrange.h" -#include "3dserr.h" - -/* Private Typedefs */ - -/* filestate3ds - Read/write state of a file */ -typedef enum -{ - StateNotKnown = 0, /* No state determined yet, file not open */ - ReadFromFile = 1, /* Open for read */ - WriteToFile = 2, /* Open for write */ - ReadWriteFile = 3 /* Open for read and write, not used by toolkit */ -} filestate3ds; -/* End Private */ - -/* Public Typedefs */ - -/* file3ds - Handle to 3D Studio files */ -typedef struct -{ - FILE *file; /* stdio file pointer */ - char3ds *filename; /* name of file */ - filestate3ds state; /* file open state */ - ubyte3ds index; /* Position of pointer in the FileContextList, if the - index eq InvalidFileContext3ds, then it is not in the - list */ - void *buffer; /* Buffered I/O buffer */ - ulong3ds buffersize; - ulong3ds bufferposition; - byte3ds istempfile; /* True3ds if file is a temp file */ -} file3ds; -/* End Public */ - -static const ubyte3ds InvalidFileContext3ds = 255; /* Signifies an invalid file pointer, or - a file pointer without a position */ - -void InitContextList3ds(); -void ReleaseContextList3ds(); -void AddContext3ds(file3ds *file); -void DelContext3ds(file3ds *file); -void SetContextByIndex3ds(ubyte3ds index); -byte3ds IsValidFileIndex3ds(ubyte3ds index); -file3ds *GetContextByIndex3ds(ubyte3ds index); -ubyte3ds GetContextIndex3ds(); -void SetContext3ds(file3ds *file); -file3ds *GetContext3ds(); -void SetFileName3ds(const char3ds *filename); -char3ds *GetFileName3ds(); -void InitFile3ds(file3ds **file); -ulong3ds GetFilePosition3ds(); -short3ds FileSeek3ds(long3ds newposition); -void RenameFileToTemp3ds(file3ds *file); - - -/* Public Prototypes */ - -/* File control functions */ -file3ds *OpenFile3ds(const char3ds *filename, const char *attrib); -file3ds *OpenFile3ds_buf(char3ds *buf, long3ds len); -void CloseAllFiles3ds(); -void CloseFile3ds(file3ds *file); - -/* End Public */ -#endif diff --git a/3rdparty/3dsftk3/src/3dsftkst.h b/3rdparty/3dsftk3/src/3dsftkst.h deleted file mode 100644 index 9f94cf3a..00000000 --- a/3rdparty/3dsftk3/src/3dsftkst.h +++ /dev/null @@ -1,538 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/* Header file for 3DS File Toolkit: Database Structures */ - -#ifndef FTK_3DS_H -#define FTK_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" - -typedef struct { - ulong3ds version; -} M3dVersion; - -typedef struct { - float3ds red; - float3ds green; - float3ds blue; -} ColorF, LinColorF; - -typedef struct { - ubyte3ds red; - ubyte3ds green; - ubyte3ds blue; -} Color24, LinColor24, MatMapRCol, MatMapGCol, MatMapBCol, MatMapCol1, MatMapCol2; - -typedef struct { - short3ds intpercentage; -} IntPercentage, MatBumpPercent; - -typedef struct { - float3ds floatpercentage; -} FloatPercentage; - -typedef struct { - char3ds *name; -} MatMapname; - -typedef struct { - long3ds version; -} MeshVersion; - -typedef struct { - float3ds masterscale; -} MasterScale; - -typedef struct { - float3ds bias; -} LoShadowBias, HiShadowBias, RayBias; - -typedef struct { - short3ds shadowmapsize; -} ShadowMapSize; - -typedef struct { - short3ds shadowsamples; -} ShadowSamples; - -typedef struct { - long3ds shadowrange; -} ShadowRange; - -typedef struct { - float3ds shadowfilter; -} ShadowFilter; - -typedef struct { - point3ds oconsts; -} OConsts; - -typedef struct { - char3ds *bitmap; -} BitMap; - -typedef struct { - float3ds gradpercent; -} VGradient; - -typedef struct { - float3ds nearplanedist; - float3ds nearplanedensity; - float3ds farplanedist; - float3ds farplanedensity; -} Fog; - -typedef struct { - float3ds zmin; - float3ds zmax; - float3ds density; - ulong3ds type; -} LayerFog; - -typedef struct { - float3ds nearplanedist; - float3ds nearplanedimming; - float3ds farplanedist; - float3ds farplanedimming; -} DistanceCue; - -typedef struct { - point3ds viewtargetcoord; - float3ds viewwidth; -} ViewStandard; - -typedef struct { - point3ds viewtargetcoord; - float3ds viewwidth; - float3ds xyviewangle; - float3ds yzviewangle; - float3ds bankangle; -} ViewUser; -typedef struct { - char3ds *name; -} ViewCamera; - -typedef struct { - char3ds *name; -} MatName; - -typedef struct { - short3ds matshading; -} MatShading; - -typedef struct { - byte3ds shadelevel; - byte3ds antialias; - short3ds flags; - ulong3ds mapsize; - ulong3ds frameinterval; -} MatAcubic; - -typedef struct { - long3ds size; - void *data; -} IpasData; - -typedef struct { - float3ds wiresize; -} MatWireSize; - -typedef struct { - ushort3ds tiling; -} MatMapTiling; - -typedef struct { - float3ds percent; -} MatMapTexblur; - -typedef struct { - float3ds scale; -} MatMapUScale, MatMapVScale; - -typedef struct { - float3ds offset; -} MatMapUOffset, MatMapVOffset; - -typedef struct { - float3ds angle; -} MatMapAng; - -typedef struct { - char3ds *name; -} NamedObject; - -typedef struct { - ushort3ds vertices; - point3ds *pointlist; -} PointArray; - -typedef struct { - ushort3ds flags; - ushort3ds *flaglist; -} PointFlagArray; - -typedef struct { - ushort3ds faces; - face3ds *facelist; -} FaceArray; - -typedef struct { - char3ds *matname; - ushort3ds faces; - ushort3ds *facelist; -} MshMatGroup; - -typedef struct -{ - char3ds *matnames[6]; -} MshBoxmap; - -typedef struct { - ushort3ds groups; - ulong3ds *grouplist; -} SmoothGroup; - -typedef struct { - ushort3ds numcoords; - textvert3ds *textvertlist; -} TexVerts; - -typedef struct { - float3ds xmatrix[12]; -} MeshMatrix; - -typedef struct { - ubyte3ds color; -} MeshColor; - -typedef struct { - ushort3ds maptype; - float3ds xtiling; - float3ds ytiling; - point3ds iconpos; - float3ds iconscaling; - float3ds xmatrix[12]; - float3ds iconwidth; - float3ds iconheight; - float3ds cyliconheight; -} MeshTextureInfo; - -typedef struct { - char3ds *name; -} ProcName; - -typedef struct { - point3ds lightpos; -} NDirectLight; - -typedef struct { - char3ds *name; -} DlExclude; - -typedef struct { - point3ds spotlighttarg; - float3ds hotspotangle; - float3ds falloffangle; -} DlSpotlight; - -typedef struct { - float3ds range; -} DlOuterRange, DlInnerRange; - -typedef struct { - float3ds multiple; -} DlMultiplier; - -typedef struct { - float3ds angle; -} DlSpotRoll; - -typedef struct { - float3ds aspect; -} DlSpotAspect; - -typedef struct { - char3ds *name; -} DlSpotProjector; - -typedef struct { - float3ds bias; -} DlRayBias; - -typedef struct { - float3ds localshadowbias; - float3ds localshadowfilter; - short3ds localshadowmapsize; -} DlLocalShadow2; - -typedef struct { - point3ds camerapos; - point3ds targetpos; - float3ds camerabank; - float3ds camerafocallength; -} NCamera; - -typedef struct { - float3ds nearplane; - float3ds farplane; -} CamRanges; - -typedef struct { - short3ds form; /* 0 = single window, 1 = 2 split verticle, 2 = 2 split horizontal, 3 = 4 equal squares, - 4 = 2 squares left & 1 rect right, 5 = 1 rect at top & 2 sqr on bot, 6 = 1 rect left & 2 sqr right, - 7 = 2 sqr top & 1 rect bot, 8 = 3 split vertical, 9 = 2 split horiz, 10 = 3 sqr left and 1 rect right, - 11 = 1 rect left & 3 sqr. right. - - form becomes 0 during swap and its preswapped value is stored in the swapport field */ - short3ds top; /* Active window index of 0 to 5 */ - short3ds ready; - short3ds wstate; /* 0 if no swap window, 1 if in swaped "w" state. During a swap, the old 0 window gets stored as the 4 window */ - short3ds swapws; - short3ds swapport; /* The preswapped value from the form field */ - short3ds swapcur; /* The window index that was swapped */ -} ViewportLayout; - -typedef struct { /* Values given for 1024x768 resolution */ - ushort3ds xpos; /* 0 */ - ushort3ds ypos; /* 14 */ - ushort3ds width; /* 895 */ - ushort3ds height; /* 725 */ -} ViewportSize; - -typedef struct { - ushort3ds flags; - ushort3ds axislockout; - ushort3ds winxpos; - ushort3ds winypos; - ushort3ds winwidth; - ushort3ds winheight; - ushort3ds view; /* 0 = No view, 1 = Top View, 2 = Bottom View, 3 = Left View, 4 = Right View, 5 = Front View, 6 = Back View, 7 = User View, 18 = Spotlight View, 65535 = Camera View */ - float3ds zoomfactor; - point3ds center; - float3ds horizang; - float3ds vertang; - char3ds *camname; -} ViewportData, ViewportData3; - -typedef struct { - short3ds revision; - char3ds *filename; - long3ds animlength; -} KFHdr; - -typedef struct { - short3ds id; -} KFId; - -typedef struct { - long3ds first; - long3ds last; -} KFSeg; - -typedef struct { - long3ds currframenum; -} KFCurtime; - -typedef struct { - char3ds *objname; - ushort3ds flags1; - ushort3ds flags2; - short3ds parentindex; -} NodeHdr; - -typedef struct { - point3ds offset; -} Pivot; - -typedef struct { - char3ds *name; -} InstanceName; - -typedef struct { - float3ds smoothgroupangle; -} MorphSmooth; - -typedef struct { - point3ds min; - point3ds max; -} BoundBox; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - point3ds *positionlist; -} PosTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - fcolor3ds *colorlist; -} ColTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - kfrotkey3ds *rotationlist; -} RotTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - point3ds *scalelist; -} ScaleTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - kfmorphkey3ds *morphlist; -} MorphTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; -} HideTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - float3ds *fovanglelist; -} FovTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - float3ds *rollanglelist; -} RollTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - float3ds *hotspotanglelist; -} HotTrackTag; - -typedef struct { - trackheader3ds trackhdr; - keyheader3ds *keyhdrlist; - float3ds *falloffanglelist; -} FallTrackTag; - -typedef struct { - long3ds size; - void3ds *data; -} XDataEntry; - -typedef struct { - char3ds *name; -} XDataAppName; - -typedef struct { - char3ds *string; -} XDataString; - -typedef struct { - float3ds value; -} XDataFloat; - -typedef struct { - double3ds value; -} XDataDouble; - -typedef struct { - short3ds value; -} XDataShort; - -typedef struct { - long3ds value; -} XDataLong; - -typedef struct { - void *data; -} XDataVoid; - -#endif - diff --git a/3rdparty/3dsftk3/src/3dshier.c b/3rdparty/3dsftk3/src/3dshier.c deleted file mode 100644 index 3e65cef4..00000000 --- a/3rdparty/3dsftk3/src/3dshier.c +++ /dev/null @@ -1,660 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dshier.h" -#include "kfutils.h" - -static void s_assignParentNames(database3ds *db); -static void s_computeNodeIds(database3ds *db); - -/*------------------------------------------------ - | - | nodeTags: Those tags that are in hierarchy - | - +-----------------------------------------------*/ -static chunktag3ds nodeTags[] = { - TARGET_NODE_TAG, - OBJECT_NODE_TAG, - CAMERA_NODE_TAG, - LIGHT_NODE_TAG, - L_TARGET_NODE_TAG, - SPOTLIGHT_NODE_TAG, - (chunktag3ds)NULL, -}; - -static IdNodePtr nodeList = NULL; - -/*---------------------------------------------------------- - | AssignParentNames - | convert parent ID's to parent names. - | - +----------------------------------------------------------*/ -void AssignParentNames(database3ds *db) -{ - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - InitNodeList(); - ParseDb(db); - s_assignParentNames(db); - ReleaseNodeList(); -} - -/*---------------------------------------------------------- - | ComputeNodeIds - | Assign NODE_ID's and parentId's - | - +----------------------------------------------------------*/ -void ComputeNodeIds(database3ds *db) -{ - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - InitNodeList(); - s_computeNodeIds(db); - ReleaseNodeList(); - -} - -/*--------------------------------------------------- - | - | IsNode3ds: return True3ds if id is node id - | - +---------------------------------------------------*/ -short3ds IsNode3ds(chunktag3ds tagID) -{ - long3ds i = 0; - - while(nodeTags[i] != (chunktag3ds)NULL){ - if (tagID == nodeTags[i]) - return True3ds; - i++; - } - return False3ds; -} - -/*--------------------------------------------------- - | - | InitNodeList - | - +---------------------------------------------------*/ -void InitNodeList() -{ - if (nodeList != NULL) - ReleaseNodeList(); -} - -/*------------------------------------------------------- - | - | makeNode - | add node to linked list (uninitialized) - | - +------------------------------------------------------*/ -static void makeNode(IdNodePtr *pPNode) -{ - IdNodePtr pNode, pId = nodeList; - - pNode = malloc(sizeof(IdNode)); - if (pNode != NULL){ - if (!pId){ /*--- First Node */ - nodeList = pNode; - } - else{ /*--- Add to list */ - while(pId->next) - pId = pId->next; - pId->next = pNode; - } - } - /* else push error here */ - - *pPNode = pNode; -} - -static short3ds getChunkNodeId(chunk3ds *pChunk) -{ - chunk3ds *pIdChunk; - - short3ds retVal = kNoId; - - FindChunk3ds(pChunk, NODE_ID, &pIdChunk); - if (pIdChunk != NULL){ - KFId *pKfId = ReadChunkData3ds(pIdChunk); - if (pKfId != NULL) retVal = pKfId->id; - FreeFileChunkData3ds(pIdChunk); - } - - return retVal; -} - - -/*------------------------------------------------- - | - | addToNodeList - | create a node, put node in list and fill-in - | structure. - | - +------------------------------------------------*/ -static void addToNodeList(chunk3ds *pChunk) -{ - IdNodePtr pNewNode; - chunk3ds *pHdrChunk, *pInstChunk; - NodeHdr *pNodeHdr; - - makeNode(&pNewNode); - if (pNewNode == NULL) - return; - - FindChunk3ds(pChunk, NODE_HDR, &pHdrChunk); - if (pHdrChunk == NULL) - return; - - pNodeHdr = ReadChunkData3ds(pHdrChunk); - if (pNodeHdr == NULL) - return; - - /*--- FILL IN NODE DATA */ - pNewNode->name = strdup(pNodeHdr->objname); - pNewNode->Id = getChunkNodeId(pChunk); - pNewNode->tag = pChunk->tag; - pNewNode->parentId = pNodeHdr->parentindex; - pNewNode->next = NULL; - pNewNode->inst = NULL; - - /*--- Check for INSTANCE */ - if (pChunk->tag == OBJECT_NODE_TAG){ - FindChunk3ds(pChunk, INSTANCE_NAME, &pInstChunk); - if (pInstChunk != NULL){ - InstanceName *data = ReadChunkData3ds(pInstChunk); - if (data != NULL && data->name != NULL){ - pNewNode->inst = strdup(data->name); - FreeFileChunkData3ds(pInstChunk); - } - } - } - FreeFileChunkData3ds(pHdrChunk); -} - -/*------------------------------------------------------------------ - | - | PrintNodeList - | Simple array style print-out of what is in current nodeList. - | - +------------------------------------------------------------------*/ -void PrintNodeList(FILE *outfile) -{ - IdNodePtr pId = nodeList; - - while(pId){ - if (pId->inst == NULL) - fprintf(outfile, "ID:%d\tName:%s\tParent:%d\n", - (int)pId->Id, - pId->name, - (int)pId->parentId); - else - fprintf(outfile, "ID:%d\tName:%s.%s\tParent:%d\n", - (int)pId->Id, - pId->name, - pId->inst, - (int)pId->parentId); - pId = pId->next; - } -} - - -static void printNode(FILE *outfile, IdNodePtr pId, int spaces) -{ - int i = 0; - IdNodePtr nList = nodeList; - - while(iname); - - while(nList){ - if (nList->parentId == pId->Id) - printNode(outfile, nList, spaces+1); - nList = nList->next; - } -} - -/*------------------------------------------------------------------ - | - | PrintHierarchy - | Hierarchy print-out of parents and thier children - | - +------------------------------------------------------------------*/ -void PrintHierarchy(FILE *outfile) -{ - IdNodePtr pId = nodeList; - - while(pId){ - /*--- Only do those w/o parents, rest do themselves */ - if (pId->parentId == -1) - printNode(outfile, pId, 0); - pId = pId->next; - } -} - - - -/*------------------------------------------------------------------- - | - | ReleaseNodeList - | - +------------------------------------------------------------------*/ -void ReleaseNodeList() -{ - IdNodePtr pId = nodeList, pNext; - - while (pId != NULL) - { - pNext = pId; - if (pId->name) - free(pId->name); - if (pId->inst) - free(pId->inst); - pNext = pId->next; - free(pId); - pId = pNext; - } - nodeList = NULL; -} - -/*---------------------------------------------------------------- - | - | checkListNodeIds - | earlier versions (pre 3) of 3dstudio had no node ids, it - | simple used the order in which they came along, if so - | put in NODE IDs. Assuming that if one node has no ID the - | whole list get renumbered. - | - +---------------------------------------------------------------*/ -static void checkListNodeIds() -{ - IdNodePtr pId = nodeList; - - while(pId){ - if (pId->Id == kNoId){ /*--- If somebody has no ID renumber list */ - short3ds index = 0; - - pId = nodeList; - while(pId){ - pId->Id = index++; - pId = pId->next; - } - break; - } - pId = pId->next; - } -} - - -/*------------------------------------------------------------------- - | - | ParseDb - | Traverse the database and fill in the nodeList. - | InitNodeList first. - | - +-------------------------------------------------------------------*/ -void ParseDb(database3ds *db) -{ - chunk3ds *pChunk, *pKfData; - - FindChunk3ds(db->topchunk, KFDATA, &pKfData); - if (pKfData == NULL) - return; - - for (pChunk=pKfData->children; pChunk!=NULL; pChunk=pChunk->sibling){ - if (IsNode3ds(pChunk->tag) == True3ds) - addToNodeList(pChunk); - } - - checkListNodeIds(); -} - -static IdNodePtr findNodeById(short3ds id) -{ - IdNodePtr pId = nodeList; - - while (pId != NULL){ - if (pId->Id == id) - break; - pId = pId->next; - } - - return pId; -} - -#ifdef NOT_USED_IN_THIS_MODULE -static IdNodePtr findNodeByNameAndId(char3ds *name, chunktag3ds id) -{ - IdNodePtr pId = nodeList; - - while (pId != NULL){ - if (strcmp(pId->name, name) == 0 && - pId->tag == id) - break; - pId = pId->next; - } - - return pId; -} -#endif - -static IdNodePtr findObjNodeByName(char3ds *name) -{ - IdNodePtr pId = nodeList; - - /*--- extract names */ - if (strchr(name, (int)'.') != NULL){ - char3ds *pC, *pName, *pInst; - - /*--- Copy name and cutoff instance name */ - pName = strdup(name); - pC = strchr(pName, (int)'.'); - *pC = (char3ds)0; - - /*--- point to instance part of orignal name string */ - pInst = strchr(name, (int)'.') + 1; - - while (pId != NULL){ - if (strcmp(pId->name, pName) == 0 && - strcmp(pId->inst, pInst) == 0){ - break; - } - pId = pId->next; - } - free(pName); - } - else { /*--- No Instance name */ - while (pId != NULL){ - if (strcmp(pId->name, name) == 0) - { - if (pId->inst == NULL) break; - if (pId->inst[0] == 0) break; - } - pId = pId->next; - } - } - return pId; -} - - -/*----------------------------------------------------- - | - | s_AssignParentNames - | Traverse keyframe data and assign parent - | names to its own chunk PARENT_NAME which is - | is a child of NODE_HDR. - | - | NODE_HDR - | PARENT_NAME - +----------------------------------------------------*/ -static void s_assignParentNames(database3ds *db) -{ - chunk3ds *pChunk, *pKfData, *pHdrChunk, *pNameChunk, *pIdChunk; - int i = 0; - KFId *pKfId; - IdNodePtr pIdNode, pIdParentNode; - char3ds *pName = NULL, *pInst = NULL; - - FindChunk3ds(db->topchunk, KFDATA, &pKfData); - if (pKfData == NULL) - return; - - /*--- Find chunks in KFRAMER */ - while(nodeTags[i] != (chunktag3ds)NULL){ - FindChunk3ds(pKfData, nodeTags[i], &pChunk); - if (pChunk){ - - while(pChunk){ - FindChunk3ds(pChunk, NODE_HDR, &pHdrChunk); - if (pHdrChunk == NULL) - goto NEXT; - - FindChunk3ds(pChunk, NODE_ID, &pIdChunk); - if (pIdChunk == NULL) - goto NEXT; - - pKfId = ReadChunkData3ds(pIdChunk); - if (pKfId == NULL) - goto NEXT; - - /*--- Find table entry for node of interest */ - pIdNode = findNodeById(pKfId->id); - /*--- No ID (bad) or No Parent (ok) */ - if (pIdNode == NULL || pIdNode->parentId == -1) - goto NEXT; - - /*--- Find table entry for PARENT */ - pIdParentNode = findNodeById(pIdNode->parentId); - if (pIdParentNode != NULL){ - pName = pIdParentNode->name; - pInst = pIdParentNode->inst; - } - - if (pName == NULL) - goto NEXT; - - /*--- Concatenate names if there is an inst name */ - if (pInst != NULL) - { - char3ds *pC; - - pC = malloc(strlen(pName) + strlen(pInst) + 2); - sprintf(pC, "%s.%s", pName, pInst); - pName = pC; - } - - /*--- If PARENT chunk exists, copy into it */ - FindChunk3ds(pHdrChunk, PARENT_NAME, &pNameChunk); - if (pNameChunk != NULL){ - InstanceName *pInstName; - - pInstName = ReadChunkData3ds(pNameChunk); - if (pInstName == NULL){ - if (pInst) free(pName); - goto NEXT; - } - strcpy(pInstName->name, pName); - } - else /*--- Create PARENT_NAME chunk */ - kfAddParentName(pHdrChunk, pName); - - if (pInst) free(pName); - - NEXT:FindNextChunk3ds(pChunk->sibling, nodeTags[i], &pChunk); - } - } - i++; - } -} - -static void setNodeId(chunk3ds *pChunk, short3ds id) -{ - chunk3ds *pIdChunk; - KFId *pKfId; - - FindChunk3ds(pChunk, NODE_ID, &pIdChunk); - if (pIdChunk == NULL) - return; - pKfId = ReadChunkData3ds(pIdChunk); - if (pKfId == NULL) - return; - - pKfId->id = id; -} -/*----------------------------------------------------- - | - | s_computeNodeIds - | Traverse keyframe data and assign NODE_ID's - | and fill in parentId's of named parents. - | - | Note: naming scheme - | - | NODE PARENT - | parentname:foo.bar ----> name:foo - | instance:bar - | - | parentname:foo ----> name:foo - | instance:(NULL) - | - +----------------------------------------------------*/ -static void s_computeNodeIds(database3ds *db) -{ - chunk3ds *pChunk, *pKfData; - short3ds i = 0; - IdNodePtr pId; - - InitNodeList(); - - FindChunk3ds(db->topchunk, KFDATA, &pKfData); - if (pKfData == NULL) - return; - - /*--- Set Node ID's and build list */ - for (pChunk=pKfData->children; pChunk!=NULL; pChunk=pChunk->sibling){ - if (pChunk->tag == AMBIENT_NODE_TAG){ - setNodeId(pChunk, -1); - continue; - } - - if (IsNode3ds(pChunk->tag) == True3ds){ - setNodeId(pChunk, i); - addToNodeList(pChunk); - i++; - } - } - - /*--- Assign parent IDs base on parent names */ - for (pChunk=pKfData->children; pChunk!=NULL; pChunk=pChunk->sibling){ - chunk3ds *pHdrChunk, *pNameChunk; - NodeHdr *pNodeHdr; - InstanceName *pInstName; - - if (IsNode3ds(pChunk->tag) == False3ds) - continue; - - /*--- Get Header and Data */ - FindChunk3ds(pChunk, NODE_HDR, &pHdrChunk); - if (pHdrChunk == NULL) - continue; - pNodeHdr = ReadChunkData3ds(pHdrChunk); - if (pNodeHdr == NULL) - continue; - - /*--- Get PARENT_NAME and Data */ - FindChunk3ds(pHdrChunk, PARENT_NAME, &pNameChunk); - /*--- No parent chunk ---> no parent */ - if (pNameChunk == NULL){ - pNodeHdr->parentindex = -1; - continue; - } - pInstName = ReadChunkData3ds(pNameChunk); - if (pInstName == NULL) - continue; - - /*--- Find the table entry of the parent */ - pId = findObjNodeByName(pInstName->name); - - /*--- If there is an Id use it, else no parent */ - pNodeHdr->parentindex = (short3ds)((pId)? pId->Id : -1); - FreeFileChunkData3ds(pNameChunk); - } -} - diff --git a/3rdparty/3dsftk3/src/3dshier.h b/3rdparty/3dsftk3/src/3dshier.h deleted file mode 100644 index 2828cb6f..00000000 --- a/3rdparty/3dsftk3/src/3dshier.h +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" - -static const short3ds kNoId = -1; - -/* PUBLIC */ - - -/* END PUBLIC */ - -void InitNodeList(); -void PrintNodeList(FILE *outfile); -void PrintHierarchy(FILE *outfile); - -void ReleaseNodeList(); -void ParseDb(database3ds *db); - -void AssignParentNames(database3ds *db); -void ComputeNodeIds(database3ds *db); - -struct _IdNode{ - short3ds Id; - chunktag3ds tag; - char3ds *name; - char3ds *inst; - short3ds parentId; - struct _IdNode *next; -}; - -typedef struct _IdNode IdNode, *IdNodePtr; - diff --git a/3rdparty/3dsftk3/src/3dsiobj.c b/3rdparty/3dsftk3/src/3dsiobj.c deleted file mode 100644 index ab9ceadc..00000000 --- a/3rdparty/3dsftk3/src/3dsiobj.c +++ /dev/null @@ -1,390 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsmobj.h" -#include "3dsrobj.h" -#include "3dsiobj.h" - -static const objmat3ds DefObjMat3ds = {{0}, 0, NULL}; - -void InitMeshObjField3ds (mesh3ds *obj, const ushort3ds field) -{ - ulong3ds i; - void *tpnt; - - if (obj == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Test to see if vertices are being allocated */ - if ((field & InitVertexArray3ds) == InitVertexArray3ds) - { - if (obj->nvertices == 0) /* If the vertice count is 0 then free the array */ - { - RelMeshObjField3ds(obj, RelVertexArray3ds); - } else - { - if (obj->vertexarray == NULL) /* if this is the very first allocation */ - { - /* Allocate the new block of memory */ - obj->vertexarray = calloc(obj->nvertices, sizeof(point3ds)); - if (obj->vertexarray == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - /* Initialize the new block */ - for (i = 0; i < obj->nvertices; i++) - memcpy(&((obj->vertexarray)[i]), &DefPoint3ds, sizeof(DefPoint3ds)); - } else /* else this is an existing block */ - { - /* Just resize it */ - tpnt = realloc(obj->vertexarray, sizeof(point3ds)*obj->nvertices); - if (tpnt == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - /* Dont set the new pointer unless the allocation was successful */ - obj->vertexarray = tpnt; - } - } - } - - if ((field & InitTextArray3ds) == InitTextArray3ds) - { - if (obj->ntextverts == 0) - { - RelMeshObjField3ds(obj, RelTextArray3ds); - } else - { - if (obj->textarray == NULL) - { - obj->textarray = calloc(obj->ntextverts, sizeof(textvert3ds)); - if (obj->textarray == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < obj->ntextverts; i++) - memcpy(&((obj->textarray)[i]), &DefTextVert3ds, sizeof(DefTextVert3ds)); - } else - { - tpnt = realloc(obj->textarray, sizeof(textvert3ds)*obj->ntextverts); - if (tpnt == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - obj->textarray = tpnt; - } - } - } - - if ((field & InitFaceArray3ds) == InitFaceArray3ds) - { - if (obj->nfaces == 0) - { - RelMeshObjField3ds(obj, RelFaceArray3ds); - } else - { - if (obj->facearray == NULL) - { - obj->facearray = calloc(obj->nfaces, sizeof(face3ds)); - if (obj->facearray == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < obj->nfaces; i++) - memcpy(&((obj->facearray)[i]), &DefFace3ds, sizeof(DefFace3ds)); - } else - { - tpnt = realloc(obj->facearray, sizeof(face3ds)*obj->nfaces); - if (tpnt == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - obj->facearray = tpnt; - } - } - } - - if ((field & InitMatArray3ds) == InitMatArray3ds) - { - if (obj->nmats == 0) - { - RelMeshObjField3ds(obj, RelMatArray3ds); - } else - { - if (obj->matarray == NULL) - { - obj->matarray = calloc(obj->nmats, sizeof(objmat3ds)); - if (obj->matarray == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < obj->nmats; i++) - memcpy(&((obj->matarray)[i]), &DefObjMat3ds, sizeof(DefObjMat3ds)); - } else - { - tpnt = realloc(obj->matarray, sizeof(objmat3ds)*obj->nmats); - if (tpnt == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - obj->matarray = tpnt; - } - } - } - - if ((field & InitSmoothArray3ds) == InitSmoothArray3ds) - { - if (obj->nfaces == 0) - { - RelMeshObjField3ds(obj, RelSmoothArray3ds); - } else - { - if (obj->smootharray == NULL) - { - obj->smootharray = calloc(obj->nfaces, sizeof(ulong3ds)); - if (obj->smootharray == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < obj->nfaces; i++) - (obj->smootharray)[i] = 0; - } else - { - tpnt = realloc(obj->smootharray, sizeof(ulong3ds)*obj->nfaces); - if (tpnt == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - obj->smootharray = tpnt; - } - } - } - - if ((field & InitProcData3ds) == InitProcData3ds) - { - if (obj->procsize == 0) - { - RelMeshObjField3ds(obj, RelProcData3ds); - } else - { - if (obj->procdata == NULL) - { - obj->procdata = calloc(obj->procsize, sizeof(ubyte3ds)); - if (obj->procdata == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - memset(obj->procdata, 0, sizeof(ubyte3ds)*obj->procsize); - } else - { - tpnt = realloc(obj->procdata, sizeof(ubyte3ds)*obj->procsize); - if (tpnt == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - obj->procdata = tpnt; - } - } - } - - if ((field & InitVFlagArray3ds) == InitVFlagArray3ds) - { - if (obj->nvertices == 0) - { - RelMeshObjField3ds(obj, RelVFlagArray3ds); - } else - { - if (obj->vflagarray == NULL) - { - obj->vflagarray = calloc(obj->nvertices, sizeof(ushort3ds)); - if (obj->vflagarray == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < obj->nvflags; i++) obj->vflagarray[i] = 0; - } else - { - tpnt = realloc(obj->vflagarray, sizeof(ushort3ds)*obj->nvertices); - if (tpnt == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - obj->vflagarray = tpnt; - } - } - } - -} - -void InitMatArrayIndex3ds (mesh3ds *obj, ushort3ds mat, ushort3ds nfaces) -{ - if (obj == NULL || nfaces == 0) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (obj->nfaces == 0 || mat > obj->nmats) - SET_ERROR_RETURN(ERR_INVALID_DATA); - - if (obj->matarray[mat].faceindex) - free(obj->matarray[mat].faceindex); - - obj->matarray[mat].faceindex = calloc(nfaces, sizeof(ushort3ds)); - if (obj->matarray[mat].faceindex == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); -} - -void InitMeshObj3ds(mesh3ds **obj, ushort3ds nvertices, ushort3ds nfaces, ushort3ds initflags) -{ - ulong3ds i; - mesh3ds *mobj; - - if (obj == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - - mobj = *obj; /* Some compilers generate wasteful dereferencing code for each occurance if this isn't done */ - - if (mobj == NULL) - { - mobj = malloc(sizeof(mesh3ds)); - if (mobj == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - - *obj = mobj; - - mobj->vertexarray = NULL; - mobj->textarray = NULL; - mobj->vflagarray = NULL; - mobj->facearray = NULL; - mobj->matarray = NULL; - mobj->smootharray = NULL; - mobj->procdata = NULL; - } - - mobj->name[0] = 0; - mobj->ishidden = False3ds; - mobj->isvislofter = False3ds; - mobj->ismatte = False3ds; - mobj->isnocast = False3ds; - mobj->isnorcvshad = False3ds; - mobj->isfast = False3ds; - mobj->isfrozen = False3ds; - mobj->nvertices = nvertices; - mobj->ntextverts = 0; - mobj->nvflags = 0; - - mobj->usemapinfo = False3ds; - mobj->map.maptype = 0; - mobj->map.tilex = 1.0F; - mobj->map.tiley = 1.0F; - mobj->map.cenx = 0.0F; - mobj->map.ceny = 0.0F; - mobj->map.cenz = 0.0F; - mobj->map.scale = 1.0F; - mobj->map.matrix[0] = 1.0F; - mobj->map.matrix[1] = 0.0F; - mobj->map.matrix[2] = 0.0F; - mobj->map.matrix[3] = 0.0F; - mobj->map.matrix[4] = 1.0F; - mobj->map.matrix[5] = 0.0F; - mobj->map.matrix[6] = 0.0F; - mobj->map.matrix[7] = 0.0F; - mobj->map.matrix[8] = 0.0F; - mobj->map.matrix[9] = 0.0F; - mobj->map.matrix[10] = 0.0F; - mobj->map.matrix[11] = 0.0F; - mobj->map.pw = 1.0F; - mobj->map.ph = 1.0F; - mobj->map.ch = 1.0F; - - for (i = 0; i < 12; i++) mobj->locmatrix[i] = 0.0F; - mobj->nfaces = nfaces; - mobj->nmats = 0; - mobj->useboxmap = False3ds; - for (i = 0; i < 6; i++) mobj->boxmap[i][0] = 0; - mobj->meshcolor = 0; - mobj->procsize = 0; - mobj->procname[0] = 0; - - InitMeshObjField3ds(mobj, (ushort3ds)(InitVertexArray3ds | InitFaceArray3ds)); - ON_ERROR_RETURN; - - if ((initflags & InitTextArray3ds) == InitTextArray3ds) - { - mobj->ntextverts = mobj->nvertices; - InitMeshObjField3ds(mobj, InitTextArray3ds); - ON_ERROR_RETURN; - } - - if ((initflags & InitVFlagArray3ds) == InitVFlagArray3ds) - { - mobj->nvflags = mobj->nvertices; - InitMeshObjField3ds(mobj, InitVFlagArray3ds); - ON_ERROR_RETURN; - } - - if ((initflags & InitSmoothArray3ds) == InitSmoothArray3ds) - { - InitMeshObjField3ds(mobj, InitSmoothArray3ds); - ON_ERROR_RETURN; - } - return; - -} diff --git a/3rdparty/3dsftk3/src/3dsiobj.h b/3rdparty/3dsftk3/src/3dsiobj.h deleted file mode 100644 index d9058a83..00000000 --- a/3rdparty/3dsftk3/src/3dsiobj.h +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef IOBJ_3DS_H -#define IOBJ_3DS_H - -#include "3dsmobj.h" - -/* Flags for InitMeshObjField3ds function */ - - -/* Public Consts */ - -/* Flags for initflags parameter */ -static const ushort3ds InitNoExtras3ds = 0x0000; -static const ushort3ds InitVertexArray3ds = 0x0001; -static const ushort3ds InitTextArray3ds = 0x0002; -static const ushort3ds InitFaceArray3ds = 0x0004; -static const ushort3ds InitMatArray3ds = 0x0008; -static const ushort3ds InitSmoothArray3ds = 0x0010; -static const ushort3ds InitProcData3ds = 0x0020; -static const ushort3ds InitVFlagArray3ds = 0x0040; - -/* End Public */ - - - -/* Public Prototypes */ -void InitMeshObj3ds(mesh3ds **obj, ushort3ds nvertices, ushort3ds nfaces, ushort3ds iniflags); -void InitMeshObjField3ds(mesh3ds *obj, ushort3ds const initflags); -void InitMatArrayIndex3ds (mesh3ds *obj, ushort3ds mat, ushort3ds nfaces); -/* End Public */ - -#endif diff --git a/3rdparty/3dsftk3/src/3dskey.c b/3rdparty/3dsftk3/src/3dskey.c deleted file mode 100644 index df1ec924..00000000 --- a/3rdparty/3dsftk3/src/3dskey.c +++ /dev/null @@ -1,400 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dscamm.h" -#include "kfutils.h" -#include "3dskey.h" - -/*------------------------------------------------------------ - | - | InitKeyInfo3ds - | - +------------------------------------------------------------*/ -void InitKeyInfo3ds(kfkeyinfo3ds *key) -{ - key->length = 30; - key->curframe = 0; -} - -void InitKfSegment3ds(kfsegment3ds *key) -{ - key->use = False3ds; - key->begin = 0; - key->end = 30; -} - -void InitKfSets3ds(kfsets3ds **key) -{ - if (key == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (*key == NULL) - { - *key = malloc(sizeof(kfsets3ds)); - if (*key == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - } - - InitKeyInfo3ds(&((*key)->anim)); - InitKfSegment3ds(&((*key)->seg)); -} - -void ReleaseKfSets3ds(kfsets3ds **key) -{ - if (key != NULL) - { - free(*key); - *key = NULL; - } -} - -void GetKeyInfo3ds(database3ds *db, kfkeyinfo3ds *key) -{ - chunk3ds *kfdata, *kfhdr, *kfcurtime; - myassert(key != NULL, "GetKeyInfo3ds: arg *key cannot be NULL"); - - kfGetKfSeg(db->topchunk, &kfdata); - ON_ERROR_RETURN; - - FindNextChunk3ds(kfdata->children, KFHDR, &kfhdr); - - if (kfhdr != NULL) - { - KFHdr *d; - - d = ReadChunkData3ds(kfhdr); - ON_ERROR_RETURN; - - key->length = d->animlength; - - FreeFileChunkData3ds(kfhdr); - } - - FindNextChunk3ds(kfdata->children, KFCURTIME, &kfcurtime); - - if (kfcurtime != NULL) - { - KFCurtime *d; - - d = ReadChunkData3ds(kfcurtime); - ON_ERROR_RETURN; - - key->curframe = d->currframenum; - } -} - - -/*--------------------------------------------------------- - | PutKeyInfo - | Puts keyframe header information. Note: - | KeyframeHeader filename not handled in this - | version. -sjw - | - +--------------------------------------------------------*/ -void PutKeyInfo3ds(database3ds *db, kfkeyinfo3ds *key) -{ - chunk3ds *pChunk = NULL, *pKfChunk = NULL; - KFHdr *hdata; -/* KFSeg *fdata; */ - KFCurtime *cdata; - - kfGetKfSeg(db->topchunk, &pKfChunk); - ON_ERROR_RETURN; - - /*--- KEYFRAME HEADER */ - FindChunk3ds(pKfChunk, KFHDR, &pChunk); - if (pChunk == NULL){ - InitChunk3ds(&pChunk); ON_ERROR_RETURN; - pChunk->tag = KFHDR; - hdata = InitChunkData3ds(pChunk); - hdata->revision = 5; /*--- Default value */ - hdata->animlength = key->length; - /*--- Filename Not Handled for now */ - hdata->filename = strdup(""); - AddChildOrdered3ds(pKfChunk, pChunk);ON_ERROR_RETURN; - } - else{ - hdata = ReadChunkData3ds(pChunk); ON_ERROR_RETURN; - hdata->animlength = key->length; - } - -#ifdef DONT_DO - /*--- KEYFRAME SEGMENT */ - pChunk = NULL; - FindChunk3ds(pKfChunk, KFSEG, &pChunk); - if (pChunk == NULL){ - InitChunk3ds(&pChunk); ON_ERROR_RETURN; - pChunk->tag = KFSEG; - fdata = InitChunkData3ds(pChunk); - fdata->first = key->firstframe; - fdata->last = key->lastframe; - AddChildOrdered3ds(pKfChunk, pChunk); ON_ERROR_RETURN; - } - else{ - fdata = ReadChunkData3ds(pChunk); ON_ERROR_RETURN; - fdata->first = key->firstframe; - fdata->last = key->lastframe; - } -#endif - - /*--- KEYFRAME CURTIME */ - pChunk = NULL; - FindChunk3ds(pKfChunk, KFCURTIME, &pChunk); - if (pChunk == NULL){ - InitChunk3ds(&pChunk); ON_ERROR_RETURN; - pChunk->tag = KFCURTIME; - cdata = InitChunkData3ds(pChunk); - cdata->currframenum = key->curframe; - AddChildOrdered3ds(pKfChunk, pChunk); - } - else { - cdata = ReadChunkData3ds(pChunk); ON_ERROR_RETURN; - cdata->currframenum = key->curframe; - } -} - -void GetKfSegment3ds(database3ds *db, kfsegment3ds *key) -{ - chunk3ds *kfdata, *kfseg; - KFSeg *data; - - kfGetKfSeg(db->topchunk, &kfdata); - - FindNextChunk3ds(kfdata->children, KFSEG, &kfseg); - if (kfseg != NULL) - { - data = ReadChunkData3ds(kfseg); - ON_ERROR_RETURN; - - key->use = True3ds; - key->begin = data->first; - key->end = data->last; - - FreeFileChunkData3ds(kfseg); - } -} - - -void PutKfSegment3ds(database3ds *db, kfsegment3ds *key) -{ - chunk3ds *kfdata, *kfseg; - KFSeg *data; - - kfGetKfSeg(db->topchunk, &kfdata); - - if (key->use) - { - ReplaceOrAddChild3ds(kfdata, KFSEG, &kfseg); - ON_ERROR_RETURN; - - data = InitChunkData3ds(kfseg); - ON_ERROR_RETURN; - - data->first = key->begin; - data->last = key->end; - } else - { - FindNextChunk3ds(kfdata->children, KFSEG, &kfseg); - DeleteChunk3ds(kfseg); - } -} - -void GetKfSets3ds(database3ds *db, kfsets3ds **key) -{ - kfsets3ds *k; - - if(db == NULL || key == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != M3DMAGIC) && (db->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - InitKfSets3ds(key); - ON_ERROR_RETURN; - - k = *key; - - GetKeyInfo3ds(db, &(k->anim)); - ON_ERROR_RETURN; - - GetKfSegment3ds(db, &(k->seg)); - ON_ERROR_RETURN; -} - - -void PutKfSets3ds(database3ds *db, kfsets3ds *key) -{ - if(db == NULL || key == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != M3DMAGIC) && (db->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - PutKeyInfo3ds(db, &(key->anim)); - ON_ERROR_RETURN; - - PutKfSegment3ds(db, &(key->seg)); - ON_ERROR_RETURN; -} - - -void CopyKfSets3ds(database3ds *destdb, database3ds *srcdb) -{ - chunk3ds *srckdata, *destkdata, *srcchunk, *destchunk; - - if ((destdb == NULL) || (srcdb == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - - FindNextChunk3ds(srcdb->topchunk->children, KFDATA, &srckdata); - - if (srckdata != NULL) - { - - kfGetKfSeg(destdb->topchunk, &destkdata); - ON_ERROR_RETURN; - - FindNextChunk3ds(srckdata, KFHDR, &srcchunk); - - if (srcchunk != NULL) - { - FindNextChunk3ds(destkdata->children, srcchunk->tag, &destchunk); - - if (destchunk != NULL) DeleteChunk3ds(destchunk); - - CopyChunk3ds(srcchunk, &destchunk); - ON_ERROR_RETURN; - - AddChildOrdered3ds(destkdata, destchunk); - - } - - FindNextChunk3ds(srckdata, KFCURTIME, &srcchunk); - - if (srcchunk != NULL) - { - FindNextChunk3ds(destkdata->children, srcchunk->tag, &destchunk); - - if (destchunk != NULL) DeleteChunk3ds(destchunk); - - CopyChunk3ds(srcchunk, &destchunk); - ON_ERROR_RETURN; - - AddChildOrdered3ds(destkdata, destchunk); - - } - - FindNextChunk3ds(srckdata, KFSEG, &srcchunk); - - if (srcchunk != NULL) - { - FindNextChunk3ds(destkdata->children, srcchunk->tag, &destchunk); - - if (destchunk != NULL) DeleteChunk3ds(destchunk); - - CopyChunk3ds(srcchunk, &destchunk); - ON_ERROR_RETURN; - - AddChildOrdered3ds(destkdata, destchunk); - - } - - } -} - - diff --git a/3rdparty/3dsftk3/src/3dskey.h b/3rdparty/3dsftk3/src/3dskey.h deleted file mode 100644 index 348c1a78..00000000 --- a/3rdparty/3dsftk3/src/3dskey.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef KEY_3DS_H -#define KEY_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" - -/* Public Typedefs */ - -typedef struct { - ulong3ds length; - ulong3ds curframe; -} kfkeyinfo3ds; - -typedef struct { - byte3ds use; - ulong3ds begin; - ulong3ds end; -} kfsegment3ds; - -typedef struct -{ - kfkeyinfo3ds anim; - kfsegment3ds seg; -} kfsets3ds; - -/* End Public */ - -/* Public Prototypes */ -void InitKfSets3ds(kfsets3ds **key); -void ReleaseKfSets3ds(kfsets3ds **key); -void PutKfSets3ds(database3ds *db, kfsets3ds *key); -void GetKfSets3ds(database3ds *db, kfsets3ds **key); -void CopyKfSets3ds(database3ds *destdb, database3ds *srcdb); - -/* End Public */ - -void InitKeyInfo3ds(kfkeyinfo3ds *key); -void PutKeyInfo3ds(database3ds *db, kfkeyinfo3ds *key); -void PutKfSegment3ds(database3ds *db, kfsegment3ds *key); -void InitKfSegment3ds(kfsegment3ds *key); - - -#endif /* KEY_3DS_H */ diff --git a/3rdparty/3dsftk3/src/3dslites.c b/3rdparty/3dsftk3/src/3dslites.c deleted file mode 100644 index 12b0a908..00000000 --- a/3rdparty/3dsftk3/src/3dslites.c +++ /dev/null @@ -1,1063 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/*=========================================================================== - | Module Overview: - | - | 3dslite.h and 3dslite.c concern themselves with the handling of - | spotlights and omnilights inside the 3ds mesh section. - | - +===========================================================================*/ - - - -#include -#include - -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dslites.h" -#include "kfutils.h" - - -static void putTagFloat(chunk3ds *pParentChunk, - chunktag3ds tag, - float3ds *f) ; - -/*-------------------------------------------------------------------------- - | InitLight3ds - | - | Initializes the light3ds structure. If *light is null, - | memory is also allocated for it. Note that the *spot field is - | ignored when an existing structure is used. - | - +--------------------------------------------------------------------------*/ -void InitLight3ds(light3ds **light) -{ - if (light == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* If (*light) a null pointer, then alloc new memory for the pointer */ - if (*light == NULL){ - *light = malloc(sizeof(light3ds)); - if(*light == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - /* Set all fields with pointer to NULL as well */ - (*light)->spot = NULL; - (*light)->exclude = NULL; - } - - (*light)->name[0] = 0; - (*light)->pos.x = 0.0F; - (*light)->pos.y = 0.0F; - (*light)->pos.z = 0.0F; - (*light)->color.r = 0.708852F; - (*light)->color.g = 0.708852F; - (*light)->color.b = 0.708852F; - (*light)->multiplier = 1.0F; - (*light)->dloff = False3ds; - (*light)->attenuation.on = False3ds; - (*light)->attenuation.inner = 10.0F; - (*light)->attenuation.outer = 100.0F; - - if ((*light)->exclude != NULL) - ReleaseNameList3ds(&((*light)->exclude)); - - InitNameList3ds( &((*light)->exclude), (long3ds)0); -} - -/*----------------------------------------------------------- - | ReleaseLight3ds - | - +-----------------------------------------------------------*/ -void ReleaseLight3ds(light3ds **light) -{ - if((*light) == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if ((*light)->exclude != NULL) - ReleaseNameList3ds(&((*light)->exclude)); - ON_ERROR_RETURN; - - if ((*light)->spot != NULL){ - if ((*light)->spot->projector.bitmap != NULL) - free((*light)->spot->projector.bitmap); - ON_ERROR_RETURN; - free((*light)->spot); - } - ON_ERROR_RETURN; - - free(*light); - *light = NULL; -} - - -/*---------------------------------------------------------- - | InitSpotlight3ds - | - +----------------------------------------------------------*/ -void InitSpotlight3ds(light3ds **spotlight) -{ - if(spotlight == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Do the common light initialization */ - InitLight3ds(spotlight); - - /* free the old spotlight pointer */ - if ((*spotlight)->spot != NULL) - { - if ((*spotlight)->spot->projector.bitmap != NULL) - free((*spotlight)->spot->projector.bitmap); - free((*spotlight)->spot); - (*spotlight)->spot = NULL; - } - - (*spotlight)->spot = malloc(sizeof(spotlight3ds)); - if((*spotlight)->spot == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - (*spotlight)->spot->target.x = 1.0F; - (*spotlight)->spot->target.y = 1.0F; - (*spotlight)->spot->target.z = 1.0F; - (*spotlight)->spot->hotspot = 44.0F; - (*spotlight)->spot->falloff = 45.0F; - (*spotlight)->spot->roll = 0.0F; - (*spotlight)->spot->aspect = 1.0F; - - (*spotlight)->spot->shadows.cast = False3ds; - (*spotlight)->spot->shadows.type = UseShadowMap; - (*spotlight)->spot->shadows.local = False3ds; - (*spotlight)->spot->shadows.bias = 1.0F; - (*spotlight)->spot->shadows.filter = 3.0F; - (*spotlight)->spot->shadows.mapsize = 512; - (*spotlight)->spot->shadows.raybias = 1.0F; - - (*spotlight)->spot->cone.type = Circular; - (*spotlight)->spot->cone.show = False3ds; - (*spotlight)->spot->cone.overshoot = False3ds; - - (*spotlight)->spot->projector.use = False3ds; - (*spotlight)->spot->projector.bitmap = NULL; -} - -/*------------------------------------------------------------------------ - | - | GetOmnilightCount3ds - | - +--------------------------------------------------------------------*/ -ulong3ds GetOmnilightCount3ds(database3ds *db) -{ - chunk3ds *dlite, *spotl; - ulong3ds omnicount = 0, i; - - if (db == NULL) - SET_ERROR_RETURNR(ERR_INVALID_ARG, 0); - - /* Update the index to named objects if the list has changed recently */ - UpdateNamedObjectList3ds(db); - - if (db->objlist == NULL) return 0; - - /* Scan through the list of named objects looking for lights */ - for (i = 0; i < db->objlist->count; i++) - { - /* Search each object for a light chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_DIRECT_LIGHT, &dlite); - - /* if one was found, check to see if its a spotlight */ - if (dlite != NULL) - { - FindChunk3ds(dlite, DL_SPOTLIGHT, &spotl); - /* if it isn't a spotlight, then increment the count */ - if (spotl == NULL) omnicount++; - } - } - return omnicount; -} - -/*------------------------------------------------------------------------ - | - | GetSpotlightCount3ds - | - +--------------------------------------------------------------------*/ -ulong3ds GetSpotlightCount3ds(database3ds *db) -{ - chunk3ds *dlite, *spotl; - ulong3ds spotcount = 0, i; - - if (db == NULL) - SET_ERROR_RETURNR(ERR_INVALID_ARG, 0); - - /* Update the index to named objects if the list has changed recently */ - UpdateNamedObjectList3ds(db); - - if (db->objlist == NULL) return 0; - - /* Scan through the list of named objects looking for lights */ - for (i = 0; i < db->objlist->count; i++) - { - /* Search each object for a light chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_DIRECT_LIGHT, &dlite); - - /* if one was found, check to see if its a spotlight */ - if (dlite != NULL) - { - FindChunk3ds(dlite, DL_SPOTLIGHT, &spotl); - /* if it is a spotlight, then increment the count */ - if (spotl != NULL) - spotcount++; - } - } - - return spotcount; -} - -/*-------------------------------------------------------------------------- - | - | GetOmnilightNameList3ds - | Searches *db to construct **list, a list of omnilight names within - | the database - | - | db: The database bing searched. - | list: The resulting namelist pairs, if *list is null, then a namelist - | structure will be allocated. - | - +--------------------------------------------------------------------------*/ -void GetOmnilightNameList3ds(database3ds *db, - namelist3ds **list) -{ - chunk3ds *lite, *spot; - ulong3ds omnilightcount, i, j; - - if (db == NULL || list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Update the index to named objects if the list has changed recently */ - UpdateNamedObjectList3ds(db); - - /* Get the number of omnilights contained in the named object list */ - omnilightcount = GetOmnilightCount3ds(db); - - /* Initilize the namelist array */ - InitNameList3ds(list, omnilightcount); - - /* Scan through the list of named objects */ - for (i = 0, j = 0; (i < db->objlist->count) && (j < omnilightcount); i++) - { - /* Search each named object for a light chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_DIRECT_LIGHT, &lite); - - /* if its a light chunk, check to see if its a spotlight */ - if (lite != NULL) - { - FindChunk3ds(lite, DL_SPOTLIGHT, &spot); - - /* If its not a spot */ - if (spot == NULL) - { - /* Copy the name into the list */ - (*list)->list[j].name = strdup(db->objlist->list[i].name); - j++; /* increment the omnilight counter */ - } - } - } -} - -/*----------------------------------------------------------------- - | - | DeleteSpotlightByName3ds - | - +----------------------------------------------------------------*/ -void DeleteSpotlightByName3ds(database3ds *db, char3ds *name) -{ - - DeleteNamedObjectByName3ds(db, name); - ON_ERROR_RETURN; -} - -void DeleteSpotlightByIndex3ds(database3ds *db, ulong3ds index) -{ - DeleteChunkTypeByIndex3ds(db, DL_SPOTLIGHT, index); - ON_ERROR_RETURN; -} - -void CopySpotlightByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - - CopyNamedObjectByIndex3ds(destdb, srcdb, DL_SPOTLIGHT, index); - ON_ERROR_RETURN; -} - -void CopySpotlightByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - CopyNamedObjectByName3ds(destdb, srcdb, name); - ON_ERROR_RETURN; -} - - -void DeleteOmnilightByName3ds(database3ds *db, char3ds *name) -{ - - DeleteNamedObjectByName3ds(db, name); - ON_ERROR_RETURN; -} - -void DeleteOmnilightByIndex3ds(database3ds *db, ulong3ds index) -{ - DeleteChunkTypeByIndex3ds(db, N_DIRECT_LIGHT, index); - ON_ERROR_RETURN; -} - -void CopyOmnilightByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - - CopyNamedObjectByIndex3ds(destdb, srcdb, N_DIRECT_LIGHT, index); - ON_ERROR_RETURN; -} - -void CopyOmnilightByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - CopyNamedObjectByName3ds(destdb, srcdb, name); - ON_ERROR_RETURN; -} - -/*-------------------------------------------------------------------------- - | - | GetSpotlightNameList3ds - | Searches *db to construct **list, a list of spotlight names within - | the database - | - | db: The database bing searched. - | list: The resulting namelist pairs, if *list is null, then a namelist - | structure will be allocated. - | - +--------------------------------------------------------------------------*/ -void GetSpotlightNameList3ds(database3ds *db, - namelist3ds **list) -{ - chunk3ds *spot; - ulong3ds spotlightcount, i, j; - - if (db == NULL || list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Update the index to named objects if the list has changed recently */ - UpdateNamedObjectList3ds(db); - - /* Get the number of spotlights contained in the named object list */ - spotlightcount = GetSpotlightCount3ds(db); - - /* Initilize the namelist array */ - InitNameList3ds(list, spotlightcount); - - /* Scan through the list of named objects */ - for (i = 0, j = 0; (i < db->objlist->count) && (j < spotlightcount); i++) - { - /* Search each named object for a direct light chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_DIRECT_LIGHT, &spot); - - /* Search each direct light for a spotlight chunk */ - if (spot != NULL) - FindChunk3ds(spot, DL_SPOTLIGHT, &spot); - - /* If it is a spotlight chunk */ - if (spot != NULL) - { - /* Copy the name into the list */ - (*list)->list[j].name = strdup(db->objlist->list[i].name); - j++; - } - } -} - -/*------------------------------------------------------------------------ - | - | GetOmnilightByIndex3ds - | Fills out the **omni structure from the (index)th mesh reference - | found in *db. - | - +------------------------------------------------------------------------*/ -void GetOmnilightByIndex3ds(database3ds *db, - long3ds index, - light3ds **omni) -{ - chunk3ds *lite, *spot; - ulong3ds i; - long3ds omnicount; - - if (db == NULL || omni == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Update the list if it's changed recently */ - UpdateNamedObjectList3ds(db); - - /* Scan through the list */ - for (i = 0, omnicount=0; i < db->objlist->count; i++) - { - /* Search for a light chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_DIRECT_LIGHT, &lite); - - /* if one was found, check to see if its a spot */ - if (lite != NULL) - { - FindChunk3ds(lite, DL_SPOTLIGHT, &spot); - { - /* if its not a spot then increment the count */ - if (spot == NULL) - { - omnicount++; - /* If thisis the (index)th light, file out the structure */ - if (omnicount-1 == index) - { - GetLightEntryChunk3ds(db->objlist->list[i].chunk, omni); - break; - } - } - } - } - } -} - -/*------------------------------------------------------------------------ - | - | GetSpotlightByIndex3ds - | Fills out the **spot structure from the (index)th spot reference - | found in *db. - | - +------------------------------------------------------------------------*/ -void GetSpotlightByIndex3ds(database3ds *db, - long3ds index, - light3ds **spotlight) -{ - chunk3ds *lite, *spot; - ulong3ds i; - long3ds spotcount; - - if (db == NULL || spotlight == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Update the list if it's changed recently */ - UpdateNamedObjectList3ds(db); - - /* Scan through the list */ - for (i = 0, spotcount=0; i < db->objlist->count; i++) - { - /* Search for a light chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_DIRECT_LIGHT, &lite); - - /* if one was found, check to see if its a spot */ - if (lite != NULL) - { - FindChunk3ds(lite, DL_SPOTLIGHT, &spot); - { - /* if its a spot then increment the count */ - if (spot != NULL) - { - spotcount++; - /* If thisis the (index)th light, file out the structure */ - if (spotcount-1 == index) - { - GetLightEntryChunk3ds(db->objlist->list[i].chunk, - spotlight); - break; - } - } - } - } - } -} - -/*------------------------------------------------------------------------- - | - | GetOmnilightByName3ds - | - | Fills out the **omni structure contained in *db that matches the - | name in *name. - | - +------------------------------------------------------------------------*/ -void GetOmnilightByName3ds(database3ds *db, - char3ds *name, - light3ds **omnilight) -{ - chunk3ds *nobj, *lite, *spot; - - if (db == NULL || name == NULL || omnilight == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find the matching name */ - FindNamedObject3ds(db, name, &nobj); - - /* If a match was found */ - if (nobj != NULL) - { - /* Verify that its a light */ - FindChunk3ds(nobj, N_DIRECT_LIGHT, &lite); - - /* if its a light then check to see if its a spot */ - FindChunk3ds(lite, DL_SPOTLIGHT, &spot); - - /* if its not a spot, then retreave the structure */ - if (spot == NULL) - { - GetLightEntryChunk3ds(nobj, omnilight); - } - } -} - -/*-------------------------------------------------------------------------- - | - | GetSpotlightByName3ds - | - | Fills out the **spot structure contained in *db that matches the - | name in *name. - | - +--------------------------------------------------------------------------*/ -void GetSpotlightByName3ds(database3ds *db, - char3ds *name, - light3ds **spotlight) -{ - chunk3ds *nobj, *lite, *spot; - - if (db == NULL || spotlight == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find the matching name */ - FindNamedObject3ds(db, name, &nobj); - - /* If a match was found */ - if (nobj != NULL) - { - /* Verify that its a light */ - FindChunk3ds(nobj, N_DIRECT_LIGHT, &lite); - - /* if its a light then check to see if its a spot */ - FindChunk3ds(lite, DL_SPOTLIGHT, &spot); - - /* if it is a spot, then retreave the structure */ - if (spot != NULL) - { - GetLightEntryChunk3ds(nobj, spotlight); - } - } -} - -/*------------------------------------------------------------------------ - | - | GetLightEntryChunk3ds - | Fills out the *light structure with the light pointed to - | by *chunk - | - +-----------------------------------------------------------------------*/ -void GetLightEntryChunk3ds(chunk3ds *chunk, light3ds **light) -{ - chunk3ds *nobj, *dlite, *spot, *current; - - if (light == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindNextChunk3ds(chunk->children, N_DIRECT_LIGHT, &dlite); - if (dlite == NULL) SET_ERROR_RETURN(ERR_WRONG_OBJECT); - - CopyChunk3ds(chunk, &nobj); - - FindChunk3ds(nobj, N_DIRECT_LIGHT, &dlite); - - FindChunk3ds(nobj, DL_SPOTLIGHT, &spot); - - if (dlite != NULL) - { - NamedObject *nobjd; - NDirectLight *ndl; - - /* Initilize **light properly */ - if (spot == NULL) - InitLight3ds(light); - else - InitSpotlight3ds(light); - - /* Copy the object name */ - nobjd = ReadChunkData3ds(nobj); - strcpy((*light)->name, nobjd->name); - - /* Copy the light postion */ - ndl = ReadChunkData3ds(dlite); - (*light)->pos = ndl->lightpos; - - /* scan all the chunks the light contains */ - for (current = dlite->children; current != NULL; current = current->sibling) - { - switch(current->tag) - { - case COLOR_F: /* The color of the light */ - { - ColorF *d; - d = ReadChunkData3ds(current); - (*light)->color.r = d->red; - (*light)->color.g = d->green; - (*light)->color.b = d->blue; - } - break; - case COLOR_24: /* The color of the (*light) */ - { - Color24 *d; - d = ReadChunkData3ds(current); - (*light)->color.r = (float3ds)d->red / 255.0F; - (*light)->color.g = (float3ds)d->green / 255.0F; - (*light)->color.b = (float3ds)d->blue / 255.0F; - } - break; - case DL_MULTIPLIER: /* The light intensity */ - { - DlMultiplier *d; - d = ReadChunkData3ds(current); - (*light)->multiplier = d->multiple; - } - break; - case DL_INNER_RANGE: - { - DlInnerRange *d; - - d = ReadChunkData3ds(current); - /* assuming since there is a value it is on */ - (*light)->attenuation.inner = d->range; - } - break; - case DL_OUTER_RANGE: - { - DlOuterRange *d; - - d = ReadChunkData3ds(current); - /* assuming since there is a value it is on */ - (*light)->attenuation.outer = d->range; - } - break; - case DL_EXCLUDE: - { - DlExclude *d; - char3ds *name; - - d = ReadChunkData3ds(current); - if ((*light)->exclude == NULL) - InitNameList3ds(&((*light)->exclude), 0); - - name = d->name; - d->name = NULL; - - AddToNameList3ds(&((*light)->exclude), name); - free(name); - } - break; - case DL_OFF: - (*light)->dloff = True3ds; - break; - case DL_ATTENUATE: - (*light)->attenuation.on = True3ds; - break; - } - } - - /*--- DL_SPOTLIGHT chunk */ - if (spot != NULL){ - DlSpotlight *d; - - /*--- Read spotlight data */ - d = ReadChunkData3ds(spot); - (*light)->spot->target = d->spotlighttarg; - (*light)->spot->hotspot = d->hotspotangle; - (*light)->spot->falloff = d->falloffangle; - - /* scan all the chunks the spotlight contains */ - for (current = spot->children; - current != NULL; - current = current->sibling) - { - switch(current->tag) - { - case DL_SPOT_ROLL: - { - DlSpotRoll *d; - - d = ReadChunkData3ds(current); - (*light)->spot->roll = d->angle; - } - break; - case DL_LOCAL_SHADOW: - (*light)->spot->shadows.cast = True3ds; - break; - case DL_LOCAL_SHADOW2: - { - DlLocalShadow2 *d; - d = ReadChunkData3ds(current); - - (*light)->spot->shadows.bias = d->localshadowbias; - (*light)->spot->shadows.filter = d->localshadowfilter; - (*light)->spot->shadows.mapsize = d->localshadowmapsize; - (*light)->spot->shadows.local = True3ds; - } - break; - case DL_SHADOWED: - (*light)->spot->shadows.cast = True3ds; - break; - case DL_SPOT_RECTANGULAR: - (*light)->spot->cone.type = Rectangular; - break; - case DL_SEE_CONE: - (*light)->spot->cone.show = True3ds; - break; - case DL_SPOT_OVERSHOOT: - (*light)->spot->cone.overshoot = True3ds; - break; - case DL_SPOT_ASPECT: - { - DlSpotAspect *d; - - d = ReadChunkData3ds(current); - (*light)->spot->aspect = d->aspect; - } - break; - case DL_RAY_BIAS: - { - DlRayBias *d; - - d = ReadChunkData3ds(current); - (*light)->spot->shadows.raybias = d->bias; - } - break; - case DL_RAYSHAD: - { - (*light)->spot->shadows.type = UseRayTraceShadow; - break; - } - case DL_SPOT_PROJECTOR: - { - DlSpotProjector *d; - d = ReadChunkData3ds(current); - (*light)->spot->projector.bitmap = d->name; - (*light)->spot->projector.use = True3ds; - d->name = NULL; - } - break; - - } - } - } - } - ReleaseChunk3ds(&nobj); - -} - -void PutOmnilight3ds(database3ds *db, light3ds *light) -{ - if (db == NULL || light == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - PutLight3ds(db, light); -} - -void PutSpotlight3ds(database3ds *db, light3ds *light) -{ - if (db == NULL || light == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - PutLight3ds(db,light); -} - - -/*---------------------------------------------------------------- - | - | PutLight3ds - | - | Put chunks in database from light3ds structure. - | - +-----------------------------------------------------------------*/ -void PutLight3ds(database3ds *db, light3ds *light) -{ - chunk3ds *pMdata, *pNamed, *pLight, *pSpot, *current, *xdata; - - if (db == NULL || light == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - FindChunk3ds(db->topchunk, MDATA, &pMdata); - if (pMdata == NULL) - { - InitChunk3ds(&pMdata); - pMdata->tag = MDATA; - AddChildOrdered3ds(db->topchunk, pMdata); - } - - /* Discover if the named object already exists */ - FindNamedObject3ds(db, light->name, &pNamed); - - /* If it does, then delete it */ - if (pNamed != NULL) - { - /* First, rescue the xdata chunk if there is one */ - FindChunk3ds(pNamed, XDATA_SECTION, ¤t); - - /* If there is one */ - if (current != NULL) - { - /* Then make a copy of it to reintroduce later */ - CopyChunk3ds(current, &xdata); - } - - /* Delete the chunk's children and data, - leaving it in the same list order */ - DeleteChunk3ds(pNamed); - pNamed->tag = NAMED_OBJECT; /* retag the chunk */ - - } else /* else pNamed needs to be initialized and added */ - { - InitChunkAs3ds(&pNamed, NAMED_OBJECT); - AddChildOrdered3ds(pMdata, pNamed); - } - - { /*--- NAME */ - NamedObject *d; - - d = InitChunkData3ds(pNamed); - d->name = strdup(light->name); - MakeNamedObjectListDirty3ds(db); - } - - { /*--- N_DIRECT_LIGHT & POSITION */ - NDirectLight *d; - - pLight = kfPutGenericNode(N_DIRECT_LIGHT, pNamed); - d = InitChunkData3ds(pLight); - memcpy(&(d->lightpos), &(light->pos), sizeof(point3ds)); - } - - /* - | Add children to DIRECT_LIGHT - */ - - /*--- COLOR */ - { - ColorF *d; - chunk3ds *pChunk; - - pChunk = kfPutGenericNode(COLOR_F, pLight); - d = InitChunkData3ds(pChunk); - - d->red = light->color.r; - d->green = light->color.g; - d->blue = light->color.b; - } - - putTagFloat(pLight, DL_OUTER_RANGE, &light->attenuation.outer); - ON_ERROR_RETURN; - - putTagFloat(pLight, DL_INNER_RANGE, &light->attenuation.inner); - ON_ERROR_RETURN; - - putTagFloat(pLight, DL_MULTIPLIER, &light->multiplier); - ON_ERROR_RETURN; - - if (light->dloff == True3ds) - kfPutGenericNode(DL_OFF, pLight); - - if (light->attenuation.on == True3ds) - kfPutGenericNode(DL_ATTENUATE, pLight); - - /*--- DL_EXCLUDE */ - if (light->exclude != NULL && light->exclude->count > 0){ - chunk3ds *pChunk; - ulong3ds i; - DlExclude *d; - - for(i=0; iexclude->count; i++){ - pChunk = kfPutGenericNode(DL_EXCLUDE, pLight); - d = InitChunkData3ds(pChunk); - d->name = strdup((light->exclude->list)[i].name); - } - } - - - /*----------------------- - | SPOTLIGHT SECTION - +-----------------------*/ - if (light->spot == NULL) - return; - - { - DlSpotlight *d; - - pSpot = kfPutGenericNode(DL_SPOTLIGHT, pLight); - d = InitChunkData3ds(pSpot); - memcpy(&d->spotlighttarg, &light->spot->target, sizeof(point3ds)); - d->hotspotangle = light->spot->hotspot; - d->falloffangle = light->spot->falloff; - } - - putTagFloat(pSpot, DL_SPOT_ROLL, &light->spot->roll); - - if (light->spot->aspect != 1.0F) - putTagFloat(pSpot, DL_SPOT_ASPECT, &light->spot->aspect); - - /*--- SHADOWS */ - if (light->spot->shadows.cast == True3ds) - kfPutGenericNode(DL_SHADOWED, pSpot); - - if (light->spot->shadows.type == UseRayTraceShadow) - kfPutGenericNode(DL_RAYSHAD, pSpot); - - putTagFloat(pSpot, DL_RAY_BIAS, &light->spot->shadows.raybias); - - /*--- DL_LOCAL_SHADOW2 */ - if (light->spot->shadows.local == True3ds) - { - DlLocalShadow2 *d; - chunk3ds *pChunk; - - kfPutGenericNode(DL_LOCAL_SHADOW, pSpot); - pChunk = kfPutGenericNode(DL_LOCAL_SHADOW2, pSpot); - d = InitChunkData3ds(pChunk); - - d->localshadowbias = light->spot->shadows.bias; - d->localshadowfilter = light->spot->shadows.filter; - d->localshadowmapsize = light->spot->shadows.mapsize; - } - - - /*--- CONE */ - if (light->spot->cone.type == Rectangular) - kfPutGenericNode(DL_SPOT_RECTANGULAR, pSpot); - if (light->spot->cone.show == True3ds) - kfPutGenericNode(DL_SEE_CONE, pSpot); - if (light->spot->cone.overshoot == True3ds) - kfPutGenericNode(DL_SPOT_OVERSHOOT, pSpot); - - /*--- PROJECTOR */ - if (light->spot->projector.use == True3ds) - { - DlSpotProjector *d; - chunk3ds *pChunk; - - pChunk = kfPutGenericNode(DL_SPOT_PROJECTOR, pSpot); - d = InitChunkData3ds(pChunk); - - d->name = strdup(light->spot->projector.bitmap); - } -} - -static void putTagFloat(chunk3ds *pParentChunk, - chunktag3ds tag, - float3ds *f) -{ - chunk3ds *pGenericChunk; - void *pVoid; - - InitChunk3ds(&pGenericChunk); - ON_ERROR_RETURN; - - pGenericChunk->tag = tag; - AddChildOrdered3ds(pParentChunk, pGenericChunk); - - pVoid = InitChunkData3ds(pGenericChunk); - ON_ERROR_RETURN; - - memcpy(pVoid, f, sizeof(float3ds)); -} - - - diff --git a/3rdparty/3dsftk3/src/3dslites.h b/3rdparty/3dsftk3/src/3dslites.h deleted file mode 100644 index 3398d601..00000000 --- a/3rdparty/3dsftk3/src/3dslites.h +++ /dev/null @@ -1,193 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/* Module Overview: - - 3dslite.h and 3dslite.c concern themselves with the handling of spotlights - and omnilights inside the 3ds mesh section. - -*/ - -#include "3dstype.h" -#include "3dsprim.h" -#include "3dsmset.h" - -/* Public Typedefs */ - -/* conestyle3ds - Spolight projection cone shape. */ -typedef enum -{ - Circular, - Rectangular -} conestyle3ds; - -/* spotshadow - Spotlight shadow settings */ -typedef struct { - byte3ds cast; /* True if spotlight casts shadows */ - shadowstyle3ds type; /* UseShadow or UseRayTrace */ - byte3ds local; /* True if local shadow settings are being used */ - float3ds bias; /* Shadow bias */ - float3ds filter; /* Shadow filter */ - ushort3ds mapsize; /* Shadow map size */ - float3ds raybias; /* Ray tracing shadow bias */ -} spotshadow3ds; - -/* spotcond3ds - cone visability settings */ -typedef struct { - conestyle3ds type; /* Circular or rectangular light cone */ - byte3ds show; /* True if cone is visable */ - byte3ds overshoot; /* True if cone overshoot is on */ -} spotcone3ds; - -/* spotproject3ds - spotlight projectio bitmap */ -typedef struct { - byte3ds use; /* True if using projector */ - char3ds *bitmap; /* Name of projector bitmap */ -} spotprojector3ds; - -/* spotlight3ds - spotlight settings */ -typedef struct -{ - point3ds target; /* Spotlight target */ - float3ds hotspot; /* Hotspot angle */ - float3ds falloff; /* Hotspot falloff */ - float3ds roll; /* Roll angle */ - float3ds aspect; /* Aspect ratio */ - spotshadow3ds shadows; - spotcone3ds cone; - spotprojector3ds projector; -} spotlight3ds; - -/* liteattenuate3ds - Light attenuation settings */ -typedef struct { - byte3ds on; /* True if light attenuation is on */ - float3ds inner; /* Inner range of attenuation */ - float3ds outer; /* Outer range of attenuation */ -} liteattenuate3ds; - -/* light3ds - omni and spotlight settings */ -typedef struct { - char3ds name[11]; /* Light name */ - point3ds pos; /* Light position */ - fcolor3ds color; /* Light color */ - float3ds multiplier;/* Light intensity multiplier */ - byte3ds dloff; /* True if light is off */ - liteattenuate3ds attenuation; - namelist3ds *exclude; - spotlight3ds *spot; /* If not null, then struct is a spotlight, else omni. */ -} light3ds; -/* End Public */ - -/* Public Prototypes */ - -/* Light related functions */ -void InitLight3ds(light3ds **light); -void InitSpotlight3ds(light3ds **spotlight); -void ReleaseLight3ds(light3ds **light); -ulong3ds GetOmnilightCount3ds(database3ds *db); -ulong3ds GetSpotlightCount3ds(database3ds *db); -void GetOmnilightNameList3ds(database3ds *db, namelist3ds **list); -void GetSpotlightNameList3ds(database3ds *db, namelist3ds **list); -void GetSpotlightByIndex3ds(database3ds *db, long3ds index, light3ds **light); -void GetOmnilightByIndex3ds(database3ds *db, long3ds index, light3ds **light); -void GetSpotlightByName3ds(database3ds *db, char3ds *name, light3ds **light); -void GetOmnilightByName3ds(database3ds *db, char3ds *name, light3ds **light); -void PutSpotlight3ds(database3ds *db, light3ds *light); -void PutOmnilight3ds(database3ds *db, light3ds *light); -void CopySpotlightByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopySpotlightByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyOmnilightByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyOmnilightByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteSpotlightByIndex3ds(database3ds *db, ulong3ds index); -void DeleteOmnilightByIndex3ds(database3ds *db, ulong3ds index); -void DeleteSpotlightByName3ds(database3ds *db, char3ds *name); -void DeleteOmnilightByName3ds(database3ds *db, char3ds *name); -/* End Public */ - -void GetLightEntryChunk3ds(chunk3ds *chunk, light3ds **light); - -void PutLight3ds(database3ds *db, light3ds *light); - diff --git a/3rdparty/3dsftk3/src/3dsmatr.c b/3rdparty/3dsftk3/src/3dsmatr.c deleted file mode 100644 index 2c5e1bc1..00000000 --- a/3rdparty/3dsftk3/src/3dsmatr.c +++ /dev/null @@ -1,1963 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "3dsmatr.h" -#include "chunk3ds.h" -#include "3dsftkst.h" - -void InitBitmap3ds(bitmap3ds *map) -{ - if (map == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - - map->name[0] = 0; - map->percent = 0.0F; - map->tiling = Tile; - map->ignorealpha = False3ds; - map->filter = Pyramidal; - map->blur = 0.0F; - map->mirror = False3ds; - map->negative = False3ds; - map->uscale = 1.0F; - map->vscale = 1.0F; - map->uoffset = 0.0F; - map->voffset = 0.0F; - map->rotation = 0.0F; - map->source = RGB; - map->tint1.r = map->tint1.g = map->tint1.b = 0.0F; - map->tint2.r = map->tint2.g = map->tint2.b = 1.0F; - map->redtint.r = 1.0F; - map->redtint.g = map->redtint.b = 0.0F; - map->greentint.g = 1.0F; - map->greentint.r = map->greentint.b = 0.0F; - map->bluetint.b = 1.0F; - map->bluetint.g = map->bluetint.r = 0.0F; - map->data = NULL; - map->datasize = 0; -} - - - - -short3ds InitMaterial3ds(material3ds **mat) -{ - if (*mat == NULL) - { - *mat = malloc(sizeof(material3ds)); - assert(*mat != NULL); - - } - - (*mat)->name[0] = 0; - (*mat)->ambient.r = (*mat)->ambient.g = (*mat)->ambient.b = 0.0F; - (*mat)->diffuse.r = (*mat)->diffuse.g = (*mat)->diffuse.b = 0.0F; - (*mat)->specular.r = (*mat)->specular.g = (*mat)->specular.b = 0.0F; - (*mat)->shininess = 0.0F; - (*mat)->shinstrength = 0.0F; - (*mat)->blur = 0.0F; - (*mat)->transparency = 0.0F; - (*mat)->transfalloff = 0.0F; - (*mat)->selfillumpct = 0.0F; - (*mat)->wiresize = 1.0F; - (*mat)->shading = Phong; - (*mat)->useblur = False3ds; - (*mat)->soften = False3ds; - (*mat)->usefall = False3ds; - (*mat)->twosided = False3ds; - (*mat)->selfillum = False3ds; - (*mat)->additive = False3ds; - (*mat)->reflect.useauto = False3ds; - (*mat)->usewire = False3ds; - (*mat)->usewireabs = False3ds; - (*mat)->facemap = False3ds; - (*mat)->reflect.automap.firstframe = False3ds; - (*mat)->reflect.automap.flat = False3ds; - (*mat)->reflect.automap.size = 100; - (*mat)->reflect.automap.nthframe = 1; - InitBitmap3ds(&((*mat)->texture.map)); - InitBitmap3ds(&((*mat)->texture.mask)); - InitBitmap3ds(&((*mat)->texture2.map)); - InitBitmap3ds(&((*mat)->texture2.mask)); - InitBitmap3ds(&((*mat)->opacity.map)); - InitBitmap3ds(&((*mat)->opacity.mask)); - InitBitmap3ds(&((*mat)->reflect.map)); - InitBitmap3ds(&((*mat)->reflect.mask)); - InitBitmap3ds(&((*mat)->bump.map)); - InitBitmap3ds(&((*mat)->bump.mask)); - InitBitmap3ds(&((*mat)->specmap.map)); - InitBitmap3ds(&((*mat)->specmap.mask)); - InitBitmap3ds(&((*mat)->shinmap.map)); - InitBitmap3ds(&((*mat)->shinmap.mask)); - InitBitmap3ds(&((*mat)->illummap.map)); - InitBitmap3ds(&((*mat)->illummap.mask)); - - return 0; -} - -void ReleaseMaterial3ds(material3ds **mat) -{ - if (mat != NULL) - { - if (*mat != NULL) - { - free((*mat)->texture.map.data); - free((*mat)->texture.mask.data); - free((*mat)->texture2.map.data); - free((*mat)->texture2.mask.data); - free((*mat)->opacity.map.data); - free((*mat)->opacity.mask.data); - free((*mat)->reflect.mask.data); - free((*mat)->bump.map.data); - free((*mat)->bump.mask.data); - free((*mat)->specmap.map.data); - free((*mat)->specmap.mask.data); - free((*mat)->shinmap.map.data); - free((*mat)->shinmap.mask.data); - free((*mat)->illummap.map.data); - free((*mat)->illummap.mask.data); - free((*mat)); - } - *mat = NULL; - } - -} - -ulong3ds GetMaterialCount3ds(database3ds *db) -{ - chunk3ds *current=NULL, *chunk=NULL; - long3ds matcount=0; - - if (db == NULL) - SET_ERROR_RETURNR(ERR_INVALID_ARG, 0); - - UpdateMatEntryList3ds(db); - - if (db->matlist == NULL) return 0; - return db->matlist->count; -} - -void GetMaterialNameList3ds(database3ds *db, namelist3ds **list) -{ - ulong3ds i; - - if (db == NULL || list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - UpdateMatEntryList3ds(db); - - InitNameList3ds(list, GetMaterialCount3ds(db)); - - for (i = 0; i < db->matlist->count; i++) - { - (*list)->list[i].name = strdup(db->matlist->list[i].name); - } -} - -void GetBitmapChunk3ds(chunk3ds *chunk, bitmap3ds *bitmap) -{ - chunk3ds *current, *index; - - if (chunk == NULL || bitmap == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - for (index = chunk->children; index != NULL; index = index->sibling) - { - /* Make a copy of the chunk. This is done so that the chunk can be - cleanly junked at the end of the switch statement and its data can be - changed and shallow copied without fear. */ - CopyChunk3ds(index, ¤t); - - switch(current->tag) - { - case INT_PERCENTAGE: - ReadChunkData3ds(current); - bitmap->percent = ((IntPercentage *)(current->data))->intpercentage / 100.0F; - break; - - case FLOAT_PERCENTAGE: - ReadChunkData3ds(current); - bitmap->percent = ((FloatPercentage *)(current->data))->floatpercentage; - break; - - case MAT_MAPNAME: - ReadChunkData3ds(current); - strcpy(bitmap->name, ((MatMapname *)(current->data))->name); - break; - - case MAT_MAP_TILING: - { - MatMapTiling *d; - ReadChunkData3ds(current); - d = current->data; - - if (d->tiling & TEX_DECAL) - { - if (d->tiling & TEX_NOWRAP) bitmap->tiling = Decal; - else bitmap->tiling = Both; - } - else bitmap->tiling = Tile; - - bitmap->ignorealpha = (char3ds)((d->tiling & TEX_DONT_USE_ALPHA) == TEX_DONT_USE_ALPHA); - - if (d->tiling & TEX_SAT) bitmap->filter = SummedArea; - else bitmap->filter = Pyramidal; - - bitmap->mirror = (char3ds)((d->tiling & TEX_MIRROR) == TEX_MIRROR); - bitmap->negative = (char3ds)((d->tiling & TEX_INVERT) == TEX_INVERT); - - if (d->tiling & TEX_TINT) - { - if (d->tiling & TEX_ALPHA_SOURCE) bitmap->source = AlphaTint; - else bitmap->source = RGBLumaTint; - } - else - { - - if (d->tiling & TEX_RGB_TINT) bitmap->source = RGBTint; - else if (d->tiling & TEX_ALPHA_SOURCE) bitmap->source = Alpha; - else bitmap->source = RGB; - } - break; - } - case MAT_MAP_USCALE: - ReadChunkData3ds(current); - bitmap->uscale = ((MatMapUScale *)(current->data))->scale; - break; - - case MAT_MAP_VSCALE: - ReadChunkData3ds(current); - bitmap->vscale = ((MatMapVScale *)(current->data))->scale; - break; - - case MAT_MAP_UOFFSET: - ReadChunkData3ds(current); - bitmap->uoffset = ((MatMapUOffset *)(current->data))->offset; - break; - - case MAT_MAP_VOFFSET: - ReadChunkData3ds(current); - bitmap->voffset = ((MatMapVOffset *)(current->data))->offset; - break; - - case MAT_MAP_ANG: - ReadChunkData3ds(current); - bitmap->rotation = ((MatMapAng *)(current->data))->angle; - break; - - case MAT_BUMP_PERCENT: - /* Value is really stored in material3ds structure */ - break; - - case MAT_MAP_COL1: - { - MatMapCol1 *d; - ReadChunkData3ds(current); - d = current->data; - - bitmap->tint1.r = (float3ds)(d->red) / 255.0F; - bitmap->tint1.g = (float3ds)(d->green) / 255.0F; - bitmap->tint1.b = (float3ds)(d->blue) / 255.0F; - break; - } - - case MAT_MAP_COL2: - { - MatMapCol2 *d; - ReadChunkData3ds(current); - d = current->data; - - bitmap->tint2.r = (float3ds)(d->red) / 255.0F; - bitmap->tint2.g = (float3ds)(d->green) / 255.0F; - bitmap->tint2.b = (float3ds)(d->blue) / 255.0F; - break; - } - - case MAT_MAP_RCOL: - { - MatMapRCol *d; - ReadChunkData3ds(current); - d = current->data; - - bitmap->redtint.r = (float3ds)(d->red) / 255.0F; - bitmap->redtint.g = (float3ds)(d->green) / 255.0F; - bitmap->redtint.b = (float3ds)(d->blue) / 255.0F; - break; - } - - case MAT_MAP_GCOL: - { - MatMapGCol *d; - ReadChunkData3ds(current); - d = current->data; - - bitmap->greentint.r = (float3ds)(d->red) / 255.0F; - bitmap->greentint.g = (float3ds)(d->green) / 255.0F; - bitmap->greentint.b = (float3ds)(d->blue) / 255.0F; - break; - } - - case MAT_MAP_BCOL: - { - MatMapBCol *d; - ReadChunkData3ds(current); - d = current->data; - - bitmap->bluetint.r = (float3ds)(d->red) / 255.0F; - bitmap->bluetint.g = (float3ds)(d->green) / 255.0F; - bitmap->bluetint.b = (float3ds)(d->blue) / 255.0F; - break; - } - case MAT_MAP_TEXBLUR: - { - MatMapTexblur *d; - ReadChunkData3ds(current); - d = current->data; - - bitmap->blur = d->percent; /*--- Float percents */ - break; - } - } - ReleaseChunk3ds(¤t); - } - } - -/* Converts a bitmap3ds structure into represenative chunks. The routine expects - arg *map to be the appropriate "map" chunk. */ -void PutBitmapChunk3ds(chunk3ds *map, bitmap3ds *bitmap) -{ - - if (map == NULL || bitmap == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - - /* Check to see if the chunk is used by checking for a bitmap name */ - if (bitmap->name[0] != 0) - { - - { - chunk3ds *c; - IntPercentage *d; - - d = InitChunkAndData3ds(&c, INT_PERCENTAGE); - - /*--- Round to get closest fit */ - d->intpercentage = (short3ds)(bitmap->percent * 100.0F + 0.5); - - AddChildOrdered3ds(map, c); - } - - { - chunk3ds *c; - MatName *d; - - d = InitChunkAndData3ds(&c, MAT_MAPNAME); - d->name = strdup(bitmap->name); - - AddChildOrdered3ds(map, c); - } - - - { - chunk3ds *c; - MatMapTiling *d; - - d = InitChunkAndData3ds(&c, MAT_MAP_TILING); - - /*--- Clear Flag */ - d->tiling = 0; - - switch (bitmap->tiling) - { - case Tile: - break; - case Decal: - d->tiling |= TEX_DECAL | TEX_NOWRAP; - break; - case Both: - d->tiling |= TEX_DECAL; - } - - if (bitmap->ignorealpha) d->tiling |= TEX_DONT_USE_ALPHA; - if (bitmap->filter == SummedArea) d->tiling |= TEX_SAT; - if (bitmap->mirror) d->tiling |= TEX_MIRROR; - if (bitmap->negative) d->tiling |= TEX_INVERT; - - switch(bitmap->source) - { - case AlphaTint: - d->tiling |= TEX_ALPHA_SOURCE | TEX_TINT; - break; - case RGBLumaTint: - d->tiling |= TEX_TINT; - break; - case RGBTint: - d->tiling |= TEX_RGB_TINT; - break; - case Alpha: - d->tiling |= TEX_ALPHA_SOURCE; - break; - case RGB: - break; - } - /*--- Note: Perhaps, if d->tiling == 0) bail out from this chunk */ - AddChildOrdered3ds(map, c); - } - - /* Add scaling chunks if scaling is not default */ - if ((bitmap->uscale != 1.0F) || (bitmap->vscale != 1.0F)) - { - chunk3ds *c; - MatMapUScale *d; - - d = InitChunkAndData3ds(&c, MAT_MAP_USCALE); - d->scale = bitmap->uscale; - AddChildOrdered3ds(map, c); - - d = InitChunkAndData3ds(&c, MAT_MAP_VSCALE); - d->scale = bitmap->vscale; - AddChildOrdered3ds(map, c); - } - - /* Add offset chunks if offset is not default of 0.0F */ - if ((bitmap->uoffset != 0.0F) || (bitmap->voffset != 0.0F)) - { - chunk3ds *c; - MatMapUOffset *d; - - d = InitChunkAndData3ds(&c, MAT_MAP_UOFFSET); - d->offset = bitmap->uoffset; - AddChildOrdered3ds(map, c); - - d = InitChunkAndData3ds(&c, MAT_MAP_VOFFSET); - d->offset = bitmap->voffset; - AddChildOrdered3ds(map, c); - } - - /* Add rotation chunk if rotation is not default of 0.0F */ - if (bitmap->rotation != 0.0F) - { - chunk3ds *c; - MatMapAng *d; - - d = InitChunkAndData3ds(&c, MAT_MAP_ANG); - d->angle = bitmap->rotation; - AddChildOrdered3ds(map, c); - - } - - if (bitmap->blur != 0.0F){ - chunk3ds *c; - MatMapTexblur *d; - - d = InitChunkAndData3ds(&c, MAT_MAP_TEXBLUR); - d->percent = bitmap->blur; - AddChildOrdered3ds(map, c); - } - - /* Add tinting chunks as needed */ - switch (bitmap->source) - { - case RGB: /* No tint chunks */ - break; - case RGBLumaTint: /* Add MAT_MAP_COL1 and MAT_MAP_COL2 chunks */ - case AlphaTint: - { - chunk3ds *c; - MatMapCol1 *d; - - d = InitChunkAndData3ds(&c, MAT_MAP_COL1); - d->red = (ubyte3ds)(bitmap->tint1.r * 255.0F); - d->green = (ubyte3ds)(bitmap->tint1.g * 255.0F); - d->blue = (ubyte3ds)(bitmap->tint1.b * 255.0F); - - AddChildOrdered3ds(map, c); - - d = InitChunkAndData3ds(&c, MAT_MAP_COL2); - d->red = (ubyte3ds)(bitmap->tint2.r * 255.0F); - d->green = (ubyte3ds)(bitmap->tint2.g * 255.0F); - d->blue = (ubyte3ds)(bitmap->tint2.b * 255.0F); - - AddChildOrdered3ds(map, c); - - break; - } - case RGBTint: /* Add MAT_MAP_RCOL, MAT_MAP_GCOL, MAT_MAP_BCOL */ - { - chunk3ds *c; - MatMapRCol *d; - - d = InitChunkAndData3ds(&c, MAT_MAP_RCOL); - d->red = (ubyte3ds)(bitmap->redtint.r * 255.0F); - d->green = (ubyte3ds)(bitmap->redtint.g * 255.0F); - d->blue = (ubyte3ds)(bitmap->redtint.b * 255.0F); - - AddChildOrdered3ds(map, c); - - d = InitChunkAndData3ds(&c, MAT_MAP_GCOL); - d->red = (ubyte3ds)(bitmap->greentint.r * 255.0F); - d->green = (ubyte3ds)(bitmap->greentint.g * 255.0F); - d->blue = (ubyte3ds)(bitmap->greentint.b * 255.0F); - - AddChildOrdered3ds(map, c); - - d = InitChunkAndData3ds(&c, MAT_MAP_BCOL); - d->red = (ubyte3ds)(bitmap->bluetint.r * 255.0F); - d->green = (ubyte3ds)(bitmap->bluetint.g * 255.0F); - d->blue = (ubyte3ds)(bitmap->bluetint.b * 255.0F); - - AddChildOrdered3ds(map, c); - break; - } - } - } -} - -static float3ds ReadPercentageChunk3ds(chunk3ds *chunk) -{ - IntPercentage *i; - FloatPercentage *f; - chunk3ds *datachunk; - - FindChunk3ds(chunk, INT_PERCENTAGE, &datachunk); - if (datachunk != NULL) - { - i = ReadChunkData3ds(datachunk); - return (float3ds)(i->intpercentage) / 100.0F; - } else - { - FindChunk3ds(chunk, FLOAT_PERCENTAGE, &datachunk); - if (datachunk != NULL) - { - f = ReadChunkData3ds(datachunk); - return f->floatpercentage; - } - } - return 0.0f; -} - -void ReadMatEntryChunk3ds(chunk3ds *chunk, material3ds **mat) -{ - chunk3ds *current, *index, *datachunk=NULL, *matentry, *color; - - if (chunk == NULL || mat == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (chunk->tag != MAT_ENTRY) - SET_ERROR_RETURN(ERR_INVALID_CHUNK); - - matentry = chunk; - - InitMaterial3ds(mat); - - for (index = matentry->children; index != NULL; index=index->sibling) - { - /* Make a copy of the chunk. This is done so that the chunk can be - cleanly junked at the end of the switch statement and its data can be - changed and shallow copied without fear. */ - CopyChunk3ds(index, ¤t); - - if ((current->tag & 0xFF00) != 0x8000) /* ignore xdata: prs */ - { /* prs */ - switch (current->tag) - { - case MAT_NAME: - ReadChunkData3ds(current); - strcpy((*mat)->name, ((MatName *)(current->data))->name); - break; - case MAT_AMBIENT: - { - Color24 *d; - - FindChunk3ds(current, COLOR_24, &color); - d = ReadChunkData3ds(color); - (*mat)->ambient.r = (float3ds)d->red / 255.0F; - (*mat)->ambient.g = (float3ds)d->green / 255.0F; - (*mat)->ambient.b = (float3ds)d->blue / 255.0F; - - FindChunk3ds(current, LIN_COLOR_24, &color); - if (color != NULL) - { - ReadChunkData3ds(color); - (*mat)->ambient.r = (float3ds)(((LinColor24 *)(color->data))->red) / 255.0F; - (*mat)->ambient.g = (float3ds)(((LinColor24 *)(color->data))->green) / 255.0F; - (*mat)->ambient.b = (float3ds)(((LinColor24 *)(color->data))->blue) / 255.0F; - } - break; - } - case MAT_DIFFUSE: - FindChunk3ds(current, COLOR_24, &color); - if (color == NULL) - SET_ERROR_RETURN(ERR_UNFOUND_CHUNK); - - ReadChunkData3ds(color); - (*mat)->diffuse.r = (float3ds)(((Color24 *)(color->data))->red) / 255.0F; - (*mat)->diffuse.g = (float3ds)(((Color24 *)(color->data))->green) / 255.0F; - (*mat)->diffuse.b = (float3ds)(((Color24 *)(color->data))->blue) / 255.0F; - - FindChunk3ds(current, LIN_COLOR_24, &color); - if (color != NULL) - { - ReadChunkData3ds(color); - (*mat)->diffuse.r = (float3ds)(((LinColor24 *)(color->data))->red) / 255.0F; - (*mat)->diffuse.g = (float3ds)(((LinColor24 *)(color->data))->green) / 255.0F; - (*mat)->diffuse.b = (float3ds)(((LinColor24 *)(color->data))->blue) / 255.0F; - } - break; - case MAT_SPECULAR: - FindChunk3ds(current, COLOR_24, &color); - if (color == NULL) - SET_ERROR_RETURN(ERR_UNFOUND_CHUNK); - - ReadChunkData3ds(color); - (*mat)->specular.r = (float3ds)(((Color24 *)(color->data))->red) / 255.0F; - (*mat)->specular.g = (float3ds)(((Color24 *)(color->data))->green) / 255.0F; - (*mat)->specular.b = (float3ds)(((Color24 *)(color->data))->blue) / 255.0F; - - FindChunk3ds(current, LIN_COLOR_24, &color); - if (color != NULL) - { - ReadChunkData3ds(color); - (*mat)->specular.r = (float3ds)(((LinColor24 *)(color->data))->red) / 255.0F; - (*mat)->specular.g = (float3ds)(((LinColor24 *)(color->data))->green) / 255.0F; - (*mat)->specular.b = (float3ds)(((LinColor24 *)(color->data))->blue) / 255.0F; - } - break; - - case MAT_SHININESS: - { - (*mat)->shininess = ReadPercentageChunk3ds(current); - break; - } - - case MAT_SHIN2PCT: - - (*mat)->shinstrength = ReadPercentageChunk3ds(current); - break; - - case MAT_SHIN3PCT: - /* Just skip for now */ - break; - - case MAT_REFBLUR: - - (*mat)->blur = ReadPercentageChunk3ds(current); - break; - - case MAT_TRANSPARENCY: - - (*mat)->transparency = ReadPercentageChunk3ds(current); - break; - - case MAT_XPFALL: - - (*mat)->transfalloff = ReadPercentageChunk3ds(current); - break; - - case MAT_SELF_ILPCT: - - (*mat)->selfillumpct = ReadPercentageChunk3ds(current); - break; - case MAT_WIRE: - (*mat)->shading = WireShading3ds; - break; - case MAT_WIREABS: - (*mat)->usewireabs = True3ds; - break; - case MAT_XPFALLIN: - (*mat)->transparency = -((*mat)->transparency); - break; - case MAT_WIRESIZE: - ReadChunkData3ds(current); - (*mat)->wiresize = ((MatWireSize *)(current->data))->wiresize; - break; - - case MAT_USE_XPFALL: - (*mat)->usefall = True3ds; - break; - - case MAT_USE_REFBLUR: - (*mat)->useblur = True3ds; - break; - - case MAT_SELF_ILLUM: - (*mat)->selfillum = True3ds; - break; - - case MAT_TWO_SIDE: - (*mat)->twosided = True3ds; - break; - - case MAT_ADDITIVE: - (*mat)->additive = True3ds; - break; - - case MAT_SHADING: - ReadChunkData3ds(current); - (*mat)->shading = ((MatShading *)(current->data))->matshading; - break; - - case MAT_FACEMAP: - (*mat)->facemap = True3ds; - break; - - case MAT_PHONGSOFT: - (*mat)->soften = True3ds; - break; - - case MAT_TEXMAP: - GetBitmapChunk3ds(current, &(*mat)->texture.map); - break; - - case MAT_TEXMASK: - GetBitmapChunk3ds(current, &(*mat)->texture.mask); - break; - - case MAT_TEX2MAP: - GetBitmapChunk3ds(current, &(*mat)->texture2.map); - break; - - case MAT_TEX2MASK: - GetBitmapChunk3ds(current, &(*mat)->texture2.mask); - break; - - case MAT_OPACMAP: - GetBitmapChunk3ds(current, &(*mat)->opacity.map); - break; - - case MAT_OPACMASK: - GetBitmapChunk3ds(current, &(*mat)->opacity.mask); - break; - - case MAT_REFLMAP: - GetBitmapChunk3ds(current, &(*mat)->reflect.map); - break; - - case MAT_ACUBIC: - { - MatAcubic *d; - d = ReadChunkData3ds(current); - (*mat)->reflect.useauto = True3ds; - (*mat)->reflect.automap.firstframe = (uchar3ds)((d->flags & ACubicFirst3ds) == ACubicFirst3ds); - (*mat)->reflect.automap.flat = (uchar3ds)((d->flags & ACubicFlat3ds) == ACubicFlat3ds); - - (*mat)->reflect.automap.size = d->mapsize; - (*mat)->reflect.automap.nthframe = d->frameinterval; - break; - } - - case MAT_REFLMASK: - GetBitmapChunk3ds(current, &(*mat)->reflect.mask); - break; - - case MAT_BUMPMAP: - GetBitmapChunk3ds(current, &(*mat)->bump.map); - FindChunk3ds(current, MAT_BUMP_PERCENT, &datachunk); - if (datachunk != NULL) - { - MatBumpPercent *d; - d = ReadChunkData3ds(datachunk); - (*mat)->bump.map.percent = (float3ds)(d->intpercentage) / 100.0F; - - } - break; - - case MAT_BUMPMASK: - GetBitmapChunk3ds(current, &(*mat)->bump.mask); - break; - - case MAT_SPECMAP: - GetBitmapChunk3ds(current, &(*mat)->specmap.map); - break; - - case MAT_SPECMASK: - GetBitmapChunk3ds(current, &(*mat)->specmap.mask); - break; - - case MAT_SHINMAP: - GetBitmapChunk3ds(current, &(*mat)->shinmap.map); - break; - - case MAT_SHINMASK: - GetBitmapChunk3ds(current, &(*mat)->shinmap.mask); - break; - - case MAT_SELFIMAP: - GetBitmapChunk3ds(current, &(*mat)->illummap.map); - break; - - case MAT_SELFIMASK: - GetBitmapChunk3ds(current, &(*mat)->illummap.mask); - break; - - case MAT_SXP_TEXT_DATA: - { - IpasData *d; - d = ReadChunkData3ds(current); - (*mat)->texture.map.datasize = d->size; - (*mat)->texture.map.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_TEXT_MASKDATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->texture.mask.datasize = d->size; - (*mat)->texture.mask.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_TEXT2_DATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->texture2.map.datasize = d->size; - (*mat)->texture2.map.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_TEXT2_MASKDATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->texture2.mask.datasize = d->size; - (*mat)->texture2.mask.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_OPAC_DATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->opacity.map.datasize = d->size; - (*mat)->opacity.map.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_OPAC_MASKDATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->opacity.mask.datasize = d->size; - (*mat)->opacity.mask.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_REFL_MASKDATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->reflect.mask.datasize = d->size; - (*mat)->reflect.mask.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_BUMP_DATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->bump.map.datasize = d->size; - (*mat)->bump.map.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_BUMP_MASKDATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->bump.mask.datasize = d->size; - (*mat)->bump.mask.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_SPEC_DATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->specmap.map.datasize = d->size; - (*mat)->specmap.map.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_SPEC_MASKDATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->specmap.mask.datasize = d->size; - (*mat)->specmap.mask.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_SHIN_DATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->shinmap.map.datasize = d->size; - (*mat)->shinmap.map.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_SHIN_MASKDATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->shinmap.mask.datasize = d->size; - (*mat)->shinmap.mask.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_SELFI_DATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->illummap.map.datasize = d->size; - (*mat)->illummap.map.data = d->data; - d->data = NULL; - break; - } - case MAT_SXP_SELFI_MASKDATA: - { - IpasData *d; - ReadChunkData3ds(current); - d = current->data; - (*mat)->illummap.mask.datasize = d->size; - (*mat)->illummap.mask.data = d->data; - d->data = NULL; - break; - } - default: - SET_ERROR_RETURN(ERR_INVALID_CHUNK) - } - } /* prs */ - ReleaseChunk3ds(¤t); - } -} - -void GetMaterialByIndex3ds(database3ds *db, ulong3ds index, material3ds **mat) -{ - chunk3ds *chunk; - - if (mat == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - - chunk = FindMatEntryByIndex3ds(db, index); - ON_ERROR_RETURN; - - if (chunk != NULL) - { - ReadMatEntryChunk3ds(chunk, mat); - ON_ERROR_RETURN; - } -} - -void GetMaterialByName3ds(database3ds *db, char3ds *name, material3ds **mat) -{ - chunk3ds *chunk=NULL; - - if ( mat == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindMatEntry3ds(db, name, &chunk); - ON_ERROR_RETURN; - - if (chunk != NULL) - ReadMatEntryChunk3ds(chunk, mat); - -} - -void DeleteMaterialByIndex3ds(database3ds *db, ulong3ds index) -{ - chunk3ds *pChunk; - - pChunk = FindMatEntryByIndex3ds(db, index); - ON_ERROR_RETURN; - - if (pChunk != NULL) - { - DeleteChunk3ds(pChunk); - MakeMatEntryListDirty3ds(db); - } -} - -void DeleteMaterialByName3ds(database3ds *db, char3ds *name) -{ - chunk3ds *pChunk; - - FindMatEntry3ds(db, name, &pChunk); - ON_ERROR_RETURN; - - if (pChunk != NULL) - DeleteChunk3ds(pChunk); - - MakeMatEntryListDirty3ds(db); -} - - -void CopyMaterialByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - chunk3ds *topsect, *matr, *newmatr; - - if ((destdb == NULL) || (srcdb == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Check to see if the destination database is a 3DS, PRJ, or MLI */ - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC) && - (srcdb->topchunk->tag != MLIBMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC) && - (destdb->topchunk->tag != MLIBMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find the material in the source database */ - matr = FindMatEntryByIndex3ds(srcdb, index); - ON_ERROR_RETURN; - - if (matr != NULL) - { - chunk3ds *nc; - MatName *matrname; - - /* Find the section in the destination the material gets copied to */ - switch(destdb->topchunk->tag) - { - case M3DMAGIC: - case CMAGIC: - { - FindNextChunk3ds(destdb->topchunk->children, MDATA, &topsect); - - /* If MDATA chunk not present then create one */ - if (topsect == NULL) - { - InitChunkAs3ds(&topsect, MDATA); - ON_ERROR_RETURN; - AddChildOrdered3ds(destdb->topchunk, topsect); - } - break; - } - case MLIBMAGIC: - topsect = destdb->topchunk; - } - - /* Get the source materials's name */ - FindNextChunk3ds(matr->children, MAT_NAME, &nc); - if (nc == NULL) SET_ERROR_RETURN(ERR_INVALID_CHUNK); - - matrname = ReadChunkData3ds(nc); - - /* Delete any material by that name in the destination */ - DeleteMaterialByName3ds(destdb, matrname->name); - - /* Copy the source material */ - CopyChunk3ds(matr, &newmatr); - ON_ERROR_RETURN; - - /* Add the copy to the destination */ - AddChildOrdered3ds(topsect, newmatr); - - MakeMatEntryListDirty3ds(destdb); - } -} - -void CopyMaterialByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - chunk3ds *topsect, *matr, *newmatr; - - if ((destdb == NULL) || (srcdb == NULL) || (name == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Check to see if the destination database is a 3DS, PRJ, or MLI */ - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC) && - (srcdb->topchunk->tag != MLIBMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC) && - (destdb->topchunk->tag != MLIBMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find the material in the source database */ - FindMatEntry3ds(srcdb, name, &matr); - ON_ERROR_RETURN; - - if (matr != NULL) - { - - /* Find the section in the destination the material gets copied to */ - switch(destdb->topchunk->tag) - { - case M3DMAGIC: - case CMAGIC: - { - FindNextChunk3ds(destdb->topchunk->children, MDATA, &topsect); - - /* If MDATA chunk not present then create one */ - if (topsect == NULL) - { - InitChunkAs3ds(&topsect, MDATA); - ON_ERROR_RETURN; - AddChildOrdered3ds(destdb->topchunk, topsect); - } - break; - } - case MLIBMAGIC: - topsect = destdb->topchunk; - } - - /* Delete any material by that name in the destination */ - DeleteMaterialByName3ds(destdb, name); - - /* Copy the source material */ - CopyChunk3ds(matr, &newmatr); - ON_ERROR_RETURN; - - /* Add the copy to the destination */ - AddChildOrdered3ds(topsect, newmatr); - - MakeMatEntryListDirty3ds(destdb); - } -} - - -/* Puts a material3ds into the chunk database. Not that this routine will clobber - materials of the same name, except it will transfer the old xdata onto the new - object. If the developer wants to wipe out the XDATA too, he'll have to - explicitly delete using the DeleteMaterial3ds function */ -void PutMaterial3ds(database3ds *db, material3ds *material) -{ - chunk3ds *container, *matr, *current; - chunk3ds *xdata = NULL; - - if(db == NULL || material == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if(db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if(!(db->topchunk->tag == M3DMAGIC || - db->topchunk->tag == CMAGIC || - db->topchunk->tag == MLIBMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Depending on the file type, we look for different things */ - - /* If it's a material library, then we use the magic chunk for the containing chunk */ - if (db->topchunk->tag == MLIBMAGIC) - { - container = db->topchunk; - } else - { - FindChunk3ds(db->topchunk, MDATA, &container); - - /* if an MDATA chunk is not found, then add one to the file */ - if (container == NULL) - { - InitChunkAs3ds(&container, MDATA); - AddChildOrdered3ds(db->topchunk, container); - } - } - - /* Discover if the material name already exists */ - FindMatEntry3ds(db, material->name, &matr); - - /* If it does, then delete it */ - if (matr != NULL) - { - /* First, resue the xdata chunk if there is one */ - FindChunk3ds(matr, XDATA_SECTION, ¤t); - - /* If there is one */ - if (current != NULL) - { - /* Then make a copy of it to reintroduce later */ - CopyChunk3ds(current, &xdata); - } - - /* Delete the chunk's children and data, it's list position */ - DeleteChunk3ds(matr); - matr->tag = MAT_ENTRY; - } else /* else a MAT_ENTRY needs to be initialized and added */ - { - InitChunkAs3ds(&matr, MAT_ENTRY); - AddChildOrdered3ds(container, matr); - } - - /* Make the name list dirty */ - MakeMatEntryListDirty3ds(db); - - /* Add the material name. */ - { - MatName *d; - chunk3ds *temp = NULL; - - /* Initialize the new chunk */ - d = InitChunkAndData3ds(&temp, MAT_NAME); - - d->name = strdup(material->name); - AddChildOrdered3ds(matr, temp); - } - - /* Add ambient light color */ - { - chunk3ds *ambient, *color; - Color24 *c; - - /* Initialize the new ambient chunk */ - InitChunkAs3ds(&ambient, MAT_AMBIENT); - - /* Initialize the color chunk */ - c = InitChunkAndData3ds(&color, COLOR_24); - - /* Copy over the values */ - c->red = (ubyte3ds)(material->ambient.r * 255.0F); - c->green = (ubyte3ds)(material->ambient.g * 255.0F); - c->blue = (ubyte3ds)(material->ambient.b * 255.0F); - - /* Put the color chunk into the ambient chunk */ - AddChildOrdered3ds(ambient, color); - - /* Initialize the color chunk again for the second linear color */ - c = InitChunkAndData3ds(&color, LIN_COLOR_24); - - /* Copy over the values */ - c->red = (ubyte3ds)(material->ambient.r * 255.0F); - c->green = (ubyte3ds)(material->ambient.g * 255.0F); - c->blue = (ubyte3ds)(material->ambient.b * 255.0F); - - /* Put the lcolor chunk into the ambient chunk */ - AddChildOrdered3ds(ambient, color); - - /* Put the ambient chunk into the material */ - AddChildOrdered3ds(matr, ambient); - } - - /* Add diffuse light color */ - { - chunk3ds *diffuse, *color; - Color24 *c; - - InitChunkAs3ds(&diffuse, MAT_DIFFUSE); - c = InitChunkAndData3ds(&color, COLOR_24); - - c->red = (ubyte3ds)(material->diffuse.r * 255.0F); - c->green = (ubyte3ds)(material->diffuse.g * 255.0F); - c->blue = (ubyte3ds)(material->diffuse.b * 255.0F); - - AddChildOrdered3ds(diffuse, color); - - c = InitChunkAndData3ds(&color, LIN_COLOR_24); - - c->red = (ubyte3ds)(material->diffuse.r * 255.0F); - c->green = (ubyte3ds)(material->diffuse.g * 255.0F); - c->blue = (ubyte3ds)(material->diffuse.b * 255.0F); - - AddChildOrdered3ds(diffuse, color); - AddChildOrdered3ds(matr, diffuse); - } - - /* Add specular light color */ - { - chunk3ds *specular, *color; - Color24 *c; - - InitChunkAs3ds(&specular, MAT_SPECULAR); - c = InitChunkAndData3ds(&color, COLOR_24); - - c->red = (ubyte3ds)(material->specular.r * 255.0F); - c->green = (ubyte3ds)(material->specular.g * 255.0F); - c->blue = (ubyte3ds)(material->specular.b * 255.0F); - - AddChildOrdered3ds(specular, color); - - c = InitChunkAndData3ds(&color, LIN_COLOR_24); - - c->red = (ubyte3ds)(material->specular.r * 255.0F); - c->green = (ubyte3ds)(material->specular.g * 255.0F); - c->blue = (ubyte3ds)(material->specular.b * 255.0F); - - AddChildOrdered3ds(specular, color); - AddChildOrdered3ds(matr, specular); - } - - /* Add shininess factor */ - { - chunk3ds *shininess, *ci; - IntPercentage *i; - - InitChunkAs3ds(&shininess, MAT_SHININESS); - i = InitChunkAndData3ds(&ci, INT_PERCENTAGE); - - i->intpercentage = (short3ds)(material->shininess * 100.0F); - - AddChildOrdered3ds(shininess, ci); - AddChildOrdered3ds(matr, shininess); - } - - /* Add shininess strength factor */ - { - chunk3ds *shin2pct, *ci; - IntPercentage *i; - - InitChunkAs3ds(&shin2pct, MAT_SHIN2PCT); - i = InitChunkAndData3ds(&ci, INT_PERCENTAGE); - - i->intpercentage = (short3ds)(material->shinstrength * 100.0F); - - AddChildOrdered3ds(shin2pct, ci); - AddChildOrdered3ds(matr, shin2pct); - } - - /* Add transparency factor */ - { - chunk3ds *transparency, *ci; - IntPercentage *i; - - InitChunkAs3ds(&transparency, MAT_TRANSPARENCY); - i = InitChunkAndData3ds(&ci, INT_PERCENTAGE); - - i->intpercentage = (short3ds)(material->transparency * 100.0F); - - AddChildOrdered3ds(transparency, ci); - AddChildOrdered3ds(matr, transparency); - } - - /* Add transparency falloff factor */ - { - chunk3ds *transfalloff, *ci; - IntPercentage *i; - short3ds abs_percent; - float3ds round = (material->transfalloff > 0.0F)? 0.5F: -0.5F; - - InitChunkAs3ds(&transfalloff, MAT_XPFALL); - i = InitChunkAndData3ds(&ci, INT_PERCENTAGE); - - /*--- Round for accuracy */ - abs_percent = (short3ds)(material->transfalloff * 100.0F + round); - i->intpercentage = (short3ds)abs((int)abs_percent); - - AddChildOrdered3ds(transfalloff, ci); - AddChildOrdered3ds(matr, transfalloff); - - if (material->transfalloff < 0.0F){ - chunk3ds *fallin; - - InitChunkAs3ds(&fallin, MAT_XPFALLIN); - AddChildOrdered3ds(matr, fallin); - } - } - - /* Add refblur factor */ - { - chunk3ds *refblur, *ci; - IntPercentage *i; - - InitChunkAs3ds(&refblur, MAT_REFBLUR); - i = InitChunkAndData3ds(&ci, INT_PERCENTAGE); - - i->intpercentage = (short3ds)(material->blur * 100.0F); - - AddChildOrdered3ds(refblur, ci); - AddChildOrdered3ds(matr, refblur); - } - - /* Shading type */ - { - chunk3ds *c; - MatShading *d; - - d = InitChunkAndData3ds(&c, MAT_SHADING); - d->matshading = (short3ds)(material->shading); - - AddChildOrdered3ds(matr, c); - } - - /* Add self illum percentage */ - { - chunk3ds *sillum, *ci; - IntPercentage *i; - - InitChunkAs3ds(&sillum, MAT_SELF_ILPCT); - i = InitChunkAndData3ds(&ci, INT_PERCENTAGE); - - i->intpercentage = (short3ds)(material->selfillumpct * 100.0F); - - AddChildOrdered3ds(sillum, ci); - AddChildOrdered3ds(matr, sillum); - } - - if (material->twosided) - { - chunk3ds *c; - InitChunkAs3ds(&c, MAT_TWO_SIDE); - - AddChildOrdered3ds(matr, c); - } - - /* Wire size */ - { - chunk3ds *c; - MatWireSize *d; - - d = InitChunkAndData3ds(&c, MAT_WIRESIZE); - d->wiresize = material->wiresize; - - AddChildOrdered3ds(matr, c); - } - - if (material->useblur) - { - chunk3ds *c; - - InitChunkAs3ds(&c, MAT_USE_REFBLUR); - - AddChildOrdered3ds(matr, c); - } - - if (material->usefall) - { - chunk3ds *c; - InitChunkAs3ds(&c, MAT_USE_XPFALL); - - AddChildOrdered3ds(matr, c); - } - - if (material->selfillum) - { - chunk3ds *c; - InitChunkAs3ds(&c, MAT_SELF_ILLUM); - - AddChildOrdered3ds(matr, c); - } - - if (material->additive) - { - chunk3ds *c; - InitChunkAs3ds(&c, MAT_ADDITIVE); - AddChildOrdered3ds(matr, c); - } - - if (material->usewire) - { - chunk3ds *c; - InitChunkAs3ds(&c, MAT_WIRE); - AddChildOrdered3ds(matr, c); - } - - if (material->usewireabs) - { - chunk3ds *c; - InitChunkAs3ds(&c, MAT_WIREABS); - AddChildOrdered3ds(matr, c); - } - - if (material->facemap) - { - chunk3ds *c; - InitChunkAs3ds(&c, MAT_FACEMAP); - AddChildOrdered3ds(matr, c); - } - - if (material->soften) - { - chunk3ds *c; - InitChunkAs3ds(&c, MAT_PHONGSOFT); - AddChildOrdered3ds(matr, c); - } - - /* If the map structure has a filename then add it to the chunk */ - if (material->texture.map.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_TEXMAP); - PutBitmapChunk3ds(m, &(material->texture.map)); - - AddChildOrdered3ds(matr, m); - - if ((material->texture.map.data != NULL) && (material->texture.map.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_TEXT_DATA); - ds->size = material->texture.map.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->texture.map.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - - } - - if (material->texture.mask.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_TEXMASK); - PutBitmapChunk3ds(m, &(material->texture.mask)); - - AddChildOrdered3ds(matr, m); - - if ((material->texture.mask.data != NULL) && (material->texture.mask.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_TEXT_MASKDATA); - ds->size = material->texture.mask.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->texture.mask.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - - } - - if (material->texture2.map.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_TEX2MAP); - PutBitmapChunk3ds(m, &(material->texture2.map)); - - AddChildOrdered3ds(matr, m); - - if ((material->texture2.map.data != NULL) && (material->texture2.map.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_TEXT2_DATA); - ds->size = material->texture2.map.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->texture2.map.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->texture2.mask.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_TEX2MASK); - PutBitmapChunk3ds(m, &(material->texture2.mask)); - - AddChildOrdered3ds(matr, m); - - if ((material->texture2.mask.data != NULL) && (material->texture2.mask.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_TEXT2_MASKDATA); - ds->size = material->texture2.mask.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->texture2.mask.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->opacity.map.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_OPACMAP); - PutBitmapChunk3ds(m, &(material->opacity.map)); - - AddChildOrdered3ds(matr, m); - - if ((material->opacity.map.data != NULL) && (material->opacity.map.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_OPAC_DATA); - ds->size = material->opacity.map.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->opacity.map.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->opacity.mask.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_OPACMASK); - PutBitmapChunk3ds(m, &(material->opacity.mask)); - - AddChildOrdered3ds(matr, m); - - if ((material->opacity.mask.data != NULL) && (material->opacity.mask.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_OPAC_MASKDATA); - ds->size = material->opacity.mask.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->opacity.mask.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->bump.map.name[0] != 0) - { - chunk3ds *m; - chunk3ds *s; - MatBumpPercent *d; - - InitChunkAs3ds(&m, MAT_BUMPMAP); - PutBitmapChunk3ds(m, &(material->bump.map)); - - d = InitChunkAndData3ds(&s, MAT_BUMP_PERCENT); - d->intpercentage = (short3ds)(material->bump.map.percent * 100.0F); - AddChildOrdered3ds(m, s); - - AddChildOrdered3ds(matr, m); - - if ((material->bump.map.data != NULL) && (material->bump.map.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_BUMP_DATA); - ds->size = material->bump.map.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->bump.map.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - - } - - if (material->bump.mask.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_BUMPMASK); - PutBitmapChunk3ds(m, &(material->bump.mask)); - - AddChildOrdered3ds(matr, m); - - if ((material->bump.mask.data != NULL) && (material->bump.mask.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_BUMP_MASKDATA); - ds->size = material->bump.mask.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->bump.mask.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->specmap.map.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_SPECMAP); - PutBitmapChunk3ds(m, &(material->specmap.map)); - - AddChildOrdered3ds(matr, m); - - if ((material->specmap.map.data != NULL) && (material->specmap.map.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_SPEC_DATA); - ds->size = material->specmap.map.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->specmap.map.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->specmap.mask.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_SPECMASK); - PutBitmapChunk3ds(m, &(material->specmap.mask)); - - AddChildOrdered3ds(matr, m); - - if ((material->specmap.mask.data != NULL) && (material->specmap.mask.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_OPAC_MASKDATA); - ds->size = material->specmap.mask.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->specmap.mask.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->shinmap.map.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_SHINMAP); - PutBitmapChunk3ds(m, &(material->shinmap.map)); - - AddChildOrdered3ds(matr, m); - - if ((material->shinmap.map.data != NULL) && (material->shinmap.map.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_SHIN_DATA); - ds->size = material->shinmap.map.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->shinmap.map.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->shinmap.mask.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_SHINMASK); - PutBitmapChunk3ds(m, &(material->shinmap.mask)); - - AddChildOrdered3ds(matr, m); - - if ((material->shinmap.mask.data != NULL) && (material->shinmap.mask.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_SHIN_MASKDATA); - ds->size = material->shinmap.mask.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->shinmap.mask.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->illummap.map.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_SELFIMAP); - PutBitmapChunk3ds(m, &(material->illummap.map)); - - AddChildOrdered3ds(matr, m); - - if ((material->illummap.map.data != NULL) && (material->illummap.map.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_SELFI_DATA); - ds->size = material->illummap.map.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->illummap.map.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->illummap.mask.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_SELFIMASK); - PutBitmapChunk3ds(m, &(material->illummap.mask)); - - AddChildOrdered3ds(matr, m); - - if ((material->illummap.mask.data != NULL) && (material->illummap.mask.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_SELFI_MASKDATA); - ds->size = material->illummap.mask.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->illummap.mask.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if ((material->reflect.map.name[0] != 0) || (material->reflect.useauto)) - { - chunk3ds *cm, *cn, *ci; - IntPercentage *di; - MatName *dn; - - InitChunkAs3ds(&cm, MAT_REFLMAP); - - di = InitChunkAndData3ds(&ci, INT_PERCENTAGE); - di->intpercentage = (short3ds)(material->reflect.map.percent * 100.0F); - AddChildOrdered3ds(cm, ci); - - dn = InitChunkAndData3ds(&cn, MAT_MAPNAME); - dn->name = strdup(material->reflect.map.name); - - AddChildOrdered3ds(cm, cn); - - AddChildOrdered3ds(matr, cm); - } - - if (material->reflect.mask.name[0] != 0) - { - chunk3ds *m; - - InitChunkAs3ds(&m, MAT_REFLMASK); - PutBitmapChunk3ds(m, &(material->reflect.mask)); - - AddChildOrdered3ds(matr, m); - - if ((material->reflect.mask.data != NULL) && (material->reflect.mask.datasize > 0)) - { - chunk3ds *cs; - IpasData *ds; - - ds = InitChunkAndData3ds(&cs, MAT_SXP_REFL_MASKDATA); - ds->size = material->reflect.mask.datasize; - ds->data = malloc(ds->size); - memcpy(ds->data, material->reflect.mask.data, ds->size); - - AddChildOrdered3ds(matr, cs); - } - } - - if (material->reflect.useauto) - { - chunk3ds *ca; - MatAcubic *da; - - da = InitChunkAndData3ds(&ca, MAT_ACUBIC); - da->flags = 1; - if (material->reflect.automap.firstframe) - da->flags = (short3ds)(da->flags | ACubicFirst3ds); - if (material->reflect.automap.flat) - da->flags = (short3ds)(da->flags | ACubicFlat3ds); - - da->mapsize = material->reflect.automap.size; - da->frameinterval = material->reflect.automap.nthframe; - - AddChildOrdered3ds(matr, ca); - } - -} - diff --git a/3rdparty/3dsftk3/src/3dsmatr.h b/3rdparty/3dsftk3/src/3dsmatr.h deleted file mode 100644 index 3e53807c..00000000 --- a/3rdparty/3dsftk3/src/3dsmatr.h +++ /dev/null @@ -1,257 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/* 3dsmatr.c, 3dsmatr.h: performs Material chunk related operations - using the material3ds structure */ - -#ifndef MATR_3DS_H -#define MATR_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" -#include "xdata.h" - -/* Public Typedefs */ -/* Used for shading field in material3ds structure */ -typedef enum -{ - Wire = 0, - Flat = 1, - Gouraud = 2, - Phong = 3, - Metal = 4 -} shadetype3ds; - -/* Used for tiling field in bitmap3ds structure */ -typedef enum -{ - Tile = 1, - Decal = 2, - Both = 3 -} tiletype3ds; - -typedef enum -{ - Pyramidal, - SummedArea -} filtertype3ds; - -typedef enum -{ - RGB, - Alpha, - RGBLumaTint, - AlphaTint, - RGBTint -} tinttype3ds; - -/* End Public */ - - - -/* For the shading field */ -static const ushort3ds WireShading3ds = 0; -static const ushort3ds FlatShading3ds = 1; -static const ushort3ds GouraudShading3ds = 2; -static const ushort3ds PhongShading3ds = 3; -static const ushort3ds MetalShading3ds = 4; - -/* For the MAT_TILING chunk */ -static const ushort3ds TEX_DECAL = 1; -static const ushort3ds TEX_MIRROR = 1<<1; -static const ushort3ds TEX_UNUSED1 = 1<<2; -static const ushort3ds TEX_INVERT = 1<<3; -static const ushort3ds TEX_NOWRAP = 1<<4; -static const ushort3ds TEX_SAT = 1<<5; /* summed area table */ -static const ushort3ds TEX_ALPHA_SOURCE = 1<<6; /* use ALPHA instead of RGB of map */ -static const ushort3ds TEX_TINT = 1<<7; /* tint for color */ -static const ushort3ds TEX_DONT_USE_ALPHA = 1<<8; /* don't use map alpha */ -static const ushort3ds TEX_RGB_TINT = 1<<9; /* Do RGB color transform */ - -/* Used with acubic3ds structure */ - -static const ushort3ds ACubicFirst3ds = 0x09; -static const ushort3ds ACubicFlat3ds = 0x11; - -/* Public Typedefs */ - -/* Used By AddMaterial3ds */ - -typedef struct { - ubyte3ds firstframe; /* True for First Frame Only */ - ubyte3ds flat; /* True for flat mirror reflection */ - ulong3ds size; /* Map resolution */ - ulong3ds nthframe; /* Map update period */ -} acubic3ds; /* Cubic reflection map defintion */ - -typedef struct { - char3ds name[13]; /* Bitmap file name */ - float3ds percent; /* Strength percentage */ - tiletype3ds tiling; /* Tile/Decal/Both */ - byte3ds ignorealpha; - filtertype3ds filter; /* Pyramidal/Summed Area */ - float3ds blur; - byte3ds mirror; - byte3ds negative; - float3ds uscale, vscale; - float3ds uoffset, voffset; - float3ds rotation; - tinttype3ds source; /* RGB/RGB Luma Tint/Alpha Tint/RGB Tint */ - fcolor3ds tint1; - fcolor3ds tint2; - fcolor3ds redtint; - fcolor3ds greentint; - fcolor3ds bluetint; - ulong3ds datasize; /* Size of procedural data */ - void3ds *data; /* Procedural data */ -} bitmap3ds; /* Bit map definition */ - -/* Structure to all map settings */ -typedef struct { - bitmap3ds map; /* The map settings */ - bitmap3ds mask; /* The mask settings */ -} mapset3ds; - -typedef struct { - bitmap3ds map; /* The map settings */ - byte3ds useauto; /* True3ds if automatic reflections are being used */ - acubic3ds automap; /* Automatic reflection definitions */ - bitmap3ds mask; /* The mask settings */ -} rmapset3ds; - -typedef struct { - char3ds name[17]; /* Name */ - fcolor3ds ambient; /* Ambient light color */ - fcolor3ds diffuse; /* Diffuse light color */ - fcolor3ds specular; /* Specular light color */ - float3ds shininess; /* Shininess factor */ - float3ds shinstrength; /* Shininess strength */ - float3ds blur; /* Blur factor */ - float3ds transparency; /* Trasparency factor */ - float3ds transfalloff; /* Fallof factor */ - float3ds selfillumpct; /* Self illumination percentage */ - float3ds wiresize; /* Width of wireframe */ - shadetype3ds shading; /* Shading type */ - byte3ds useblur; /* Blurring flag */ - byte3ds usefall; /* Transparency falloff flag */ - byte3ds twosided; /* Two sided material flag */ - byte3ds selfillum; /* Self illumination flag */ - byte3ds additive; /* Additive transparency flag */ - byte3ds usewire; /* Use wireframe rendering */ - byte3ds usewireabs; /* Wire size is in units, not pixels. */ - byte3ds facemap; /* Face mapping switch */ - byte3ds soften; /* Soften switch */ - mapset3ds texture; /* Texture map settings */ - mapset3ds texture2; /* Second texture map settings */ - mapset3ds opacity; /* Opacity map settings */ - mapset3ds bump; /* Bump map settings */ - mapset3ds specmap; /* Specularity map settings */ - mapset3ds shinmap; /* Shininess map settings */ - mapset3ds illummap; /* Self illumination map settings */ - rmapset3ds reflect; /* Reflection map settings */ -} material3ds; /* Material definition */ -/* End Public */ - -/* Public Prototypes */ -short3ds AddMaterial3ds(const material3ds *mat); -void InitBitmap3ds(bitmap3ds *map); -short3ds InitMaterial3ds(material3ds **mat); -void ReleaseMaterial3ds(material3ds **mat); -ulong3ds GetMaterialCount3ds(database3ds *db); -void GetMaterialNameList3ds(database3ds *db, namelist3ds **list); -void GetMaterialByIndex3ds(database3ds *db, ulong3ds index, material3ds **mat); -void GetMaterialByName3ds(database3ds *db, char3ds *name, material3ds **mat); -void PutMaterial3ds(database3ds *db, material3ds *mat); -void CopyMaterialByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyMaterialByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteMaterialByName3ds(database3ds *db, char3ds *name); -void DeleteMaterialByIndex3ds(database3ds *db, ulong3ds index); -/* End Public */ -void ReadMatEntryChunk3ds(chunk3ds *chunk, material3ds **mat); - -#endif - diff --git a/3rdparty/3dsftk3/src/3dsmatx.c b/3rdparty/3dsftk3/src/3dsmatx.c deleted file mode 100644 index b81b7494..00000000 --- a/3rdparty/3dsftk3/src/3dsmatx.c +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "chunk3ds.h" -#include "3dsprim.h" -#include "3dsmobj.h" -#include "3dsmatx.h" - -void FillMatrix3ds(mesh3ds *obj) -{ - ushort3ds i; - point3ds min,max; - - if (obj == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((obj->nvertices == 0) || (obj->vertexarray == NULL)) SET_ERROR_RETURN(ERR_INVALID_DATA); - - min.x = max.x = obj->vertexarray[0].x; - min.y = max.y = obj->vertexarray[0].y; - min.z = max.z = obj->vertexarray[0].z; - for (i=1;invertices;i++) { - if (obj->vertexarray[i].x < min.x) - min.x = obj->vertexarray[i].x; - if (obj->vertexarray[i].y < min.y) - min.y = obj->vertexarray[i].y; - if (obj->vertexarray[i].z < min.z) - min.z = obj->vertexarray[i].z; - if (obj->vertexarray[i].x > max.x) - max.x = obj->vertexarray[i].x; - if (obj->vertexarray[i].y > max.y) - max.y = obj->vertexarray[i].y; - if (obj->vertexarray[i].z > max.z) - max.z = obj->vertexarray[i].z; - } - obj->locmatrix[0] = 1.0F; - obj->locmatrix[1] = 0.0F; - obj->locmatrix[2] = 0.0F; - obj->locmatrix[3] = 0.0F; - obj->locmatrix[4] = 1.0F; - obj->locmatrix[5] = 0.0F; - obj->locmatrix[6] = 0.0F; - obj->locmatrix[7] = 0.0F; - obj->locmatrix[8] = 1.0F; - obj->locmatrix[9] = (max.x+min.x)*0.5F; - obj->locmatrix[10] = (max.y+min.y)*0.5F; - obj->locmatrix[11] = (max.z+min.z)*0.5F; -} - diff --git a/3rdparty/3dsftk3/src/3dsmatx.h b/3rdparty/3dsftk3/src/3dsmatx.h deleted file mode 100644 index 3e0ec71d..00000000 --- a/3rdparty/3dsftk3/src/3dsmatx.h +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef MATX_3DS_H -#define MATX_3DS_H - -/* Public Prototypes */ -void FillMatrix3ds(mesh3ds *obj); -/* End Public */ - -#endif diff --git a/3rdparty/3dsftk3/src/3dsmobj.c b/3rdparty/3dsftk3/src/3dsmobj.c deleted file mode 100644 index 6a92dbed..00000000 --- a/3rdparty/3dsftk3/src/3dsmobj.c +++ /dev/null @@ -1,862 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsmobj.h" -#include "3dsftkst.h" -#include "dbase3ds.h" -#include "3dsiobj.h" -#include "3dsutil.h" - - - -const objmat3ds DefObjMat3ds = {{0}, 0, NULL}; - -/* Returns a count of mesh objects referenced in the chunk list */ -ulong3ds GetMeshCount3ds(database3ds *db /* The chunk listing that is being searched */ - ) -{ - chunk3ds *ntri; /* The possible pointer for the mesh chunk */ - ulong3ds meshcount = 0, i; - - /* Update the index to named objects if the list has changed recently */ - UpdateNamedObjectList3ds(db); - ON_ERROR_RETURNR(0); - - if (db->objlist == NULL) return 0; - - /* Scan through the list of named objects */ - for (i = 0; i < db->objlist->count; i++) - { - /* Search each named object for a mesh chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_TRI_OBJECT, &ntri); - /* if a mesh chunk was found, increment the count */ - if (ntri != NULL) meshcount++; - } - - return meshcount; -} - -/* Searches *db to construct **list, a list of mesh names associated with - their chunk definition. */ -void GetMeshNameList3ds(database3ds *db, /* The chunk database being searched */ - namelist3ds **list /* The resulting namelist pairs, if - *list is null, then a namelist - structure will be allocated */ - ) -{ - chunk3ds *current=NULL, *nobj=NULL, *ntri; - ulong3ds meshcount, i, j; - - if (db == NULL || list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Update the index to named objects if the list has changed recently */ - UpdateNamedObjectList3ds(db); - - /* Get the number of meshes contained in the named object list */ - meshcount = GetMeshCount3ds(db); - - /* Initilize the namelist array */ - InitNameList3ds(list, meshcount); - - /* Scan through the list of named objects */ - for (i = 0, j = 0; (i < db->objlist->count) && (j < meshcount); i++) - { - /* Search each named object for a mesh chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_TRI_OBJECT, &ntri); - - /* If it is a mesh chunk */ - if (ntri != NULL) - { - /* Copy the name into the list */ - (*list)->list[j].name = strdup(db->objlist->list[i].name); - j++; - } - } -} - -/* Fills out the **mesh structure from the (index)th mesh reference found in *db */ -void GetMeshByIndex3ds(database3ds *db, ulong3ds index, mesh3ds **mesh) -{ - chunk3ds *ntri; - ulong3ds i, meshcount; - - if (db == NULL || mesh == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Update the index to named objects if the list has changed recently */ - UpdateNamedObjectList3ds(db); - - /* Scan through the list of named objects */ - for (i = 0, meshcount = 0; i < db->objlist->count; i++) - { - /* Search each named object for a mesh chunk */ - FindChunk3ds(db->objlist->list[i].chunk, N_TRI_OBJECT, &ntri); - - /* If a mesh chunk is found */ - if (ntri != NULL) - { - /* Increment the running total */ - meshcount++; - /* If this is the (index)th mesh, fill out the structure */ - if (meshcount-1 == index) - { - GetMeshEntryChunk3ds(db->objlist->list[i].chunk, mesh); - break; - } - } - } -} - -/* Fills out the **mesh structure contained in *db with the name listed in *name */ -void GetMeshByName3ds(database3ds *db, /* Chunk listing to be searched */ - char3ds *name, /* Name of mesh being searched for */ - mesh3ds **mesh /* A pointer to the address of the mesh - structure, if (*mesh) is null, then - memory will be allocated for the new - structure, otherwise, the existing - structure will be filled in with the new - values. If no match is found, then **mesh - remains unchanged */ - ) -{ - chunk3ds *nobj = NULL, *ntri = NULL; - - if (db == NULL || name == NULL || mesh == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - UpdateNamedObjectList3ds(db); - - /* Find the matching mesh name in the chunk list */ - FindNamedObject3ds(db, name, &nobj); - - /* if a match is found */ - if (nobj != NULL) - { - /* See it the named object is a mesh object */ - FindChunk3ds(nobj, N_TRI_OBJECT, &ntri); - - /* If it is a mesh object, then fill in the mesh structure */ - if (ntri != NULL) - GetMeshEntryChunk3ds(nobj, mesh); - } -} - -void DeleteMeshByName3ds(database3ds *db, char3ds *name) -{ - DeleteNamedObjectByName3ds(db, name); - ON_ERROR_RETURN; - -} - -void DeleteMeshByIndex3ds(database3ds *db, ulong3ds index) -{ - DeleteChunkTypeByIndex3ds(db, N_TRI_OBJECT, index); - ON_ERROR_RETURN; -} - -void CopyMeshByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - - CopyNamedObjectByIndex3ds(destdb, srcdb, N_TRI_OBJECT, index); - ON_ERROR_RETURN; -} - -void CopyMeshByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - CopyNamedObjectByName3ds(destdb, srcdb, name); - ON_ERROR_RETURN; -} - -/* Function aids the GetMeshEntryChunk3ds in determining - how many materials are defined within the mesh object */ - -ulong3ds GetMeshMatCount3ds(chunk3ds *current) -{ - chunk3ds *datachunk; - ushort3ds meshmatcount=0; - - FindChunk3ds(current, MSH_MAT_GROUP, &datachunk); - - while(datachunk != NULL) - { - meshmatcount++; - FindNextChunk3ds(datachunk->sibling, MSH_MAT_GROUP, &datachunk); - } - return(meshmatcount); -} - -void GetMeshEntryChunk3ds(chunk3ds *chunk, mesh3ds **mesh) -{ - chunk3ds *nobj=NULL, *datachunk=NULL, *ntrichunk, *current; - void *data = NULL; - ushort3ds meshmatcount=0; - - if (chunk == NULL || mesh == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindNextChunk3ds(chunk->children, N_TRI_OBJECT, &ntrichunk); - if (ntrichunk == NULL) - SET_ERROR_RETURN(ERR_WRONG_OBJECT); - - InitMeshObj3ds(mesh,0,0,0); - - /* Copy the mesh chunk into a temporary chunk */ - CopyChunk3ds(chunk, &nobj); - ON_ERROR_RETURN; - - /* Get the N_TRI_OBJECT part out of it. */ - FindNextChunk3ds(nobj->children, N_TRI_OBJECT, &ntrichunk); - - /* Get the mesh name. */ - { - NamedObject *d; - d = ReadChunkData3ds(nobj); - strcpy((*mesh)->name, d->name); - } - - for (current = ntrichunk->children; current != NULL; current = current->sibling) - { - switch(current->tag) - { - case POINT_ARRAY: - { - PointArray *d; - d = ReadChunkData3ds(current); - (*mesh)->nvertices = d->vertices; - (*mesh)->vertexarray = d->pointlist; - d->pointlist = NULL; - break; - } - case POINT_FLAG_ARRAY: - { - PointFlagArray *flags; - - flags = ReadChunkData3ds(current); - (*mesh)->nvflags = flags->flags; - (*mesh)->vflagarray = flags->flaglist; - flags->flaglist = NULL; - break; - } - - case FACE_ARRAY: - { - FaceArray *d; - - d = ReadChunkData3ds(current); - (*mesh)->nfaces = d->faces; - (*mesh)->facearray = d->facelist; - d->facelist = NULL; - - if (current->children != NULL) - { - /* begin search for MESH_MAT_GROUP and SMOOTH_GROUP */ - chunk3ds *facearraychunk=current; - - /* create a list of all mesh mat groups */ - - FindChunk3ds(facearraychunk, MSH_MAT_GROUP, &datachunk); - if (datachunk != NULL) - { - ulong3ds index; - - meshmatcount = (ushort3ds)GetMeshMatCount3ds(datachunk); - (*mesh)->nmats = meshmatcount; - (*mesh)->matarray = calloc(meshmatcount, sizeof(objmat3ds)); - - for (index = 0; index < (*mesh)->nmats; index++) - { - MshMatGroup *omat = NULL; - - omat = ReadChunkData3ds(datachunk); - - strcpy((*mesh)->matarray[index].name, omat->matname); - (*mesh)->matarray[index].nfaces = omat->faces; - - (*mesh)->matarray[index].faceindex = omat->facelist; - omat->facelist = NULL; - - FindNextChunk3ds(datachunk->sibling, MSH_MAT_GROUP, &datachunk); - - } - } - - FindNextChunk3ds(facearraychunk->children, SMOOTH_GROUP, &datachunk); - if (datachunk != NULL) { - SmoothGroup *sm; - long3ds smelements; - - sm = ReadChunkData3ds(datachunk); - smelements = (datachunk->size - 6)/LongSize3ds; - - (*mesh)->smootharray = sm->grouplist; - sm->grouplist = NULL; - } - - FindNextChunk3ds(facearraychunk->children, MSH_BOXMAP, &datachunk); - if (datachunk != NULL) - { - MshBoxmap *bm; - ushort3ds i; - - ReadChunkData3ds(datachunk); - bm = datachunk->data; - for (i = 0; i < 6; i++) strcpy((*mesh)->boxmap[i], bm->matnames[i]); - (*mesh)->useboxmap = True3ds; - } - - } - break; - } - - case TEX_VERTS: - { - TexVerts *tv; - - ReadChunkData3ds(current); - tv = current->data; - - (*mesh)->ntextverts = tv->numcoords; - (*mesh)->textarray = tv->textvertlist; - tv->textvertlist = NULL; - break; - } - - case MESH_MATRIX: - { - ReadChunkData3ds(current); - data = current->data; - memcpy((*mesh)->locmatrix ,((MeshMatrix *)data)->xmatrix, 12*sizeof(float3ds)); - break; - } - case MESH_TEXTURE_INFO: - { - (*mesh)->usemapinfo = True3ds; - ReadChunkData3ds(current); - data = current->data; - (*mesh)->map.maptype = ((MeshTextureInfo *)data)->maptype; - (*mesh)->map.tilex = ((MeshTextureInfo *)data)->xtiling; - (*mesh)->map.tiley = ((MeshTextureInfo *)data)->ytiling; - (*mesh)->map.cenx = ((MeshTextureInfo *)data)->iconpos.x; - (*mesh)->map.ceny = ((MeshTextureInfo *)data)->iconpos.y; - (*mesh)->map.cenz = ((MeshTextureInfo *)data)->iconpos.z; - (*mesh)->map.scale = ((MeshTextureInfo *)data)->iconscaling; - memcpy((*mesh)->map.matrix , ((MeshTextureInfo *)data)->xmatrix, 12*sizeof(float3ds)); - (*mesh)->map.pw = ((MeshTextureInfo *)data)->iconwidth; - (*mesh)->map.ph = ((MeshTextureInfo *)data)->iconheight; - (*mesh)->map.ch = ((MeshTextureInfo *)data)->cyliconheight; - break; - } - case PROC_NAME: - { - ReadChunkData3ds(current); - data = current->data; - strcpy((*mesh)->procname, ((ProcName *)data)->name); - break; - } - case PROC_DATA: - { - IpasData *d; - d = ReadChunkData3ds(current); - (*mesh)->procsize = d->size; - (*mesh)->procdata = d->data; - d->data = NULL; /* CCJ */ - break; - } - case MESH_COLOR: - { - ReadChunkData3ds(current); - (*mesh)->meshcolor = ((MeshColor *)(current->data))->color; - break; - } - } - - } - - FindNextChunk3ds(nobj->children, OBJ_HIDDEN, ¤t); - if (current != NULL) (*mesh)->ishidden = True3ds; - else (*mesh)->ishidden = False3ds; - - FindNextChunk3ds(nobj->children, OBJ_VIS_LOFTER, ¤t); - if (current != NULL) (*mesh)->isvislofter = True3ds; - else (*mesh)->isvislofter = False3ds; - - FindNextChunk3ds(nobj->children, OBJ_DOESNT_CAST, ¤t); - if (current != NULL) (*mesh)->isnocast = True3ds; - else (*mesh)->isnocast = False3ds; - - FindNextChunk3ds(nobj->children, OBJ_MATTE, ¤t); - if (current != NULL) (*mesh)->ismatte = True3ds; - else (*mesh)->ismatte = False3ds; - - FindNextChunk3ds(nobj->children, OBJ_FAST, ¤t); - if (current != NULL) (*mesh)->isfast = True3ds; - else (*mesh)->isfast = False3ds; - - FindNextChunk3ds(nobj->children, OBJ_FROZEN, ¤t); - if (current != NULL) (*mesh)->isfrozen = True3ds; - else (*mesh)->isfrozen = False3ds; - - FindNextChunk3ds(nobj->children, OBJ_DONT_RCVSHADOW, ¤t); - if (current != NULL) (*mesh)->isnorcvshad = True3ds; - else (*mesh)->isnorcvshad = False3ds; - - FindNextChunk3ds(nobj->children, OBJ_PROCEDURAL, ¤t); - if (current != NULL) (*mesh)->useproc = True3ds; - else (*mesh)->useproc = False3ds; - - ReleaseChunk3ds(&nobj); -} - -/* Puts a mesh3ds into the chunk database. Note that this routine will clobber - named objects of the same name, except that it will transfer the old xdata onto - the new object. If the developer wants to wipe out the XDATA too, he'll have - to explicitly delete using the DeleteMesh3ds function */ -void PutMesh3ds(database3ds *db, mesh3ds *mesh) -{ - chunk3ds *mdata, *nobj, *ntri, *current; - NamedObject *nobjdata; - chunk3ds *xdata = NULL; - long3ds i; - - - if (db == NULL || mesh == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - FindChunk3ds(db->topchunk, MDATA, &mdata); - - if (mdata == NULL) - { - InitChunk3ds(&mdata); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - mdata->tag = MDATA; - AddChildOrdered3ds(db->topchunk, mdata); - } - - /* Discover if the named object already exists */ - FindNamedObject3ds(db, mesh->name, &nobj); - ON_ERROR_RETURN; - - /* If it does, then delete it */ - if (nobj != NULL) - { - /* First, rescue the xdata chunk if there is one */ - FindChunk3ds(nobj, XDATA_SECTION, ¤t); - - /* If there is one */ - if (current != NULL) - { - /* Then make a copy of it to reintroduce later */ - CopyChunk3ds(current, &xdata); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - } - - /* Delete the chunk's children and data, leaving it in the same list order */ - DeleteChunk3ds(nobj); - nobj->tag = NAMED_OBJECT; /* retag the chunk */ - - } else /* else nobj needs to be initialized and added */ - { - InitChunkAs3ds(&nobj, NAMED_OBJECT); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - - AddChildOrdered3ds(mdata, nobj); - - } - - - /* Copy the mesh name into the chunk */ - nobjdata = InitChunkData3ds(nobj); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - nobjdata->name = strdup(mesh->name); - MakeNamedObjectListDirty3ds(db); - - InitChunk3ds(&ntri); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - ntri->tag = N_TRI_OBJECT; - AddChildOrdered3ds(nobj, ntri); - - if ((mesh->nvertices > 0) && (mesh->vertexarray != NULL)) - { /* Add the point array */ - PointArray *d; - chunk3ds *temp = NULL; - - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = POINT_ARRAY; - d = InitChunkData3ds(temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - d->vertices = mesh->nvertices; - d->pointlist = malloc(sizeof(point3ds)*d->vertices); - if (d->pointlist == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - memcpy(d->pointlist, mesh->vertexarray, sizeof(point3ds)*d->vertices); - AddChildOrdered3ds(ntri, temp); - } - - if (mesh->ntextverts > 0) - { - TexVerts *d; - chunk3ds *temp = NULL; - - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = TEX_VERTS; - d = InitChunkData3ds(temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - d->numcoords = mesh->ntextverts; - d->textvertlist = malloc(sizeof(textvert3ds)*d->numcoords); - if (d->textvertlist == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - memcpy(d->textvertlist, mesh->textarray, sizeof(textvert3ds)*d->numcoords); - AddChildOrdered3ds(ntri, temp); - } - - if (mesh->usemapinfo) - { - MeshTextureInfo *d; - chunk3ds *temp; - - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = MESH_TEXTURE_INFO; - d = InitChunkData3ds(temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - - d->maptype = mesh->map.maptype; - d->xtiling = mesh->map.tilex; - d->ytiling = mesh->map.tiley; - d->iconpos.x = mesh->map.cenx; - d->iconpos.y = mesh->map.ceny; - d->iconpos.z = mesh->map.cenz; - d->iconscaling = mesh->map.scale; - memcpy(d->xmatrix, mesh->map.matrix, sizeof(float3ds)*12); - d->iconwidth = mesh->map.pw; - d->iconheight = mesh->map.ph; - d->cyliconheight = mesh->map.ch; - AddChildOrdered3ds(ntri, temp); - } - - if ((mesh->nvflags > 0) && (mesh->vflagarray != NULL)) - { - PointFlagArray *d; - chunk3ds *temp = NULL; - - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = POINT_FLAG_ARRAY; - d = InitChunkData3ds(temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - d->flags = mesh->nvflags; - d->flaglist = malloc(sizeof(ushort3ds)*d->flags); - if (d->flaglist == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - memcpy(d->flaglist, mesh->vflagarray, sizeof(ushort3ds)*d->flags); - AddChildOrdered3ds(ntri, temp); - } - - - { - MeshMatrix *d; - chunk3ds *temp = NULL; - - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = MESH_MATRIX; - d = InitChunkData3ds(temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - memcpy(d->xmatrix, mesh->locmatrix, sizeof(float3ds)*12); - AddChildOrdered3ds(ntri, temp); - } - - - { - chunk3ds *temp = NULL; - - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = MESH_COLOR; - InitChunkData3ds(temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - ((MeshColor *)(temp->data))->color = mesh->meshcolor; - AddChildOrdered3ds(ntri, temp); - } - - if (mesh->nfaces > 0) - { - chunk3ds *farr = NULL; - FaceArray *d; - - InitChunk3ds(&farr); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - farr->tag = FACE_ARRAY; - d = InitChunkData3ds(farr); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - farr->data = d; - d->faces = mesh->nfaces; - d->facelist = malloc(sizeof(face3ds)*d->faces); - if (d->facelist == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - memcpy(d->facelist, mesh->facearray, sizeof(face3ds)*d->faces); - AddChildOrdered3ds(ntri, farr); - - if (mesh->nmats > 0) - { - chunk3ds *matgroup; - ushort3ds x; - MshMatGroup *d; - - for (x = 0; x < mesh->nmats; x++) - { - matgroup = NULL; - InitChunk3ds(&matgroup); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - matgroup->tag = MSH_MAT_GROUP; - d = InitChunkData3ds(matgroup); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - d->matname = strdup(mesh->matarray[x].name); - d->faces = mesh->matarray[x].nfaces; - if (d->faces > 0) - { - d->facelist = malloc(sizeof(short3ds)*d->faces); - if (d->facelist == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - memcpy(d->facelist, mesh->matarray[x].faceindex, sizeof(short3ds)*d->faces); - } else - { - d->facelist = NULL; - } - AddChildOrdered3ds(farr, matgroup); - } - } - - if (mesh->smootharray != NULL) - { - chunk3ds *smooth = NULL; - SmoothGroup *d; - - InitChunk3ds(&smooth); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - smooth->tag = SMOOTH_GROUP; - d = InitChunkData3ds(smooth); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - - d->groups = mesh->nfaces; - d->grouplist = malloc(sizeof(long3ds)*d->groups); - if (d->grouplist == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - memcpy(d->grouplist, mesh->smootharray, sizeof(long3ds)*d->groups); - AddChildOrdered3ds(farr, smooth); - } - - if (mesh->useboxmap) - { - chunk3ds *boxmap = NULL; - MshBoxmap *d; - - InitChunk3ds(&boxmap); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - boxmap->tag = MSH_BOXMAP; - d = InitChunkData3ds(boxmap); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - - for (i = 0; i < 6; i++) - { - d->matnames[i] = strdup(mesh->boxmap[i]); - } - AddChildOrdered3ds(farr, boxmap); - } - } - - if (mesh->procdata != NULL) - { - chunk3ds *procname, *procdata; - ProcName *pname; - IpasData *pdata; - - InitChunk3ds(&procname); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - InitChunk3ds(&procdata); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - procname->tag = PROC_NAME; - procdata->tag = PROC_DATA; - pname = InitChunkData3ds(procname); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - pdata = InitChunkData3ds(procdata); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - - pname->name = strdup(mesh->procname); - pdata->size = mesh->procsize; - pdata->data = malloc(pdata->size); - if (pdata->data == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - memcpy(pdata->data, mesh->procdata, pdata->size); - AddChildOrdered3ds(ntri, procname); - AddChildOrdered3ds(ntri, procdata); - } - - if (mesh->ishidden) - { - chunk3ds *temp; - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = OBJ_HIDDEN; - AddChildOrdered3ds(nobj, temp); - } - - if (mesh->isvislofter) - { - chunk3ds *temp; - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = OBJ_VIS_LOFTER; - AddChildOrdered3ds(nobj, temp); - } - - if (mesh->ismatte) - { - chunk3ds *temp; - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = OBJ_MATTE; - AddChildOrdered3ds(nobj, temp); - } - - if (mesh->isnocast) - { - chunk3ds *temp; - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = OBJ_DOESNT_CAST; - AddChildOrdered3ds(nobj, temp); - } - - if (mesh->isfast) - { - chunk3ds *temp; - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = OBJ_FAST; - AddChildOrdered3ds(nobj, temp); - } - - if (mesh->isnorcvshad) - { - chunk3ds *temp; - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = OBJ_DONT_RCVSHADOW; - AddChildOrdered3ds(nobj, temp); - } - - if (mesh->isfrozen) - { - chunk3ds *temp; - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = OBJ_FROZEN; - AddChildOrdered3ds(nobj, temp); - } - - if ((mesh->useproc==True3ds) && (mesh->procdata != NULL)) - { - chunk3ds *temp; - InitChunk3ds(&temp); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - temp->tag = OBJ_PROCEDURAL; - AddChildOrdered3ds(nobj, temp); - } - - if (xdata != NULL) - { - AddChildOrdered3ds(ntri, xdata); - } - } - diff --git a/3rdparty/3dsftk3/src/3dsmobj.h b/3rdparty/3dsftk3/src/3dsmobj.h deleted file mode 100644 index 40ff58d9..00000000 --- a/3rdparty/3dsftk3/src/3dsmobj.h +++ /dev/null @@ -1,207 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef MOBJ_3DS_H -#define MOBJ_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" - -/* Public Consts */ - -/* Smoothing group flags used in the smootharray field of the mesh3ds structure */ -static const ulong3ds Smooth01Group3ds = 0x00000001; -static const ulong3ds Smooth02Group3ds = 0x00000002; -static const ulong3ds Smooth03Group3ds = 0x00000004; -static const ulong3ds Smooth04Group3ds = 0x00000008; -static const ulong3ds Smooth05Group3ds = 0x00000010; -static const ulong3ds Smooth06Group3ds = 0x00000020; -static const ulong3ds Smooth07Group3ds = 0x00000030; -static const ulong3ds Smooth08Group3ds = 0x00000080; -static const ulong3ds Smooth09Group3ds = 0x00000100; -static const ulong3ds Smooth10Group3ds = 0x00000200; -static const ulong3ds Smooth11Group3ds = 0x00000400; -static const ulong3ds Smooth12Group3ds = 0x00000800; -static const ulong3ds Smooth13Group3ds = 0x00001000; -static const ulong3ds Smooth14Group3ds = 0x00002000; -static const ulong3ds Smooth15Group3ds = 0x00004000; -static const ulong3ds Smooth16Group3ds = 0x00008000; -static const ulong3ds Smooth17Group3ds = 0x00010000; -static const ulong3ds Smooth18Group3ds = 0x00020000; -static const ulong3ds Smooth19Group3ds = 0x00040000; -static const ulong3ds Smooth20Group3ds = 0x00080000; -static const ulong3ds Smooth21Group3ds = 0x00100000; -static const ulong3ds Smooth22Group3ds = 0x00200000; -static const ulong3ds Smooth23Group3ds = 0x00400000; -static const ulong3ds Smooth24Group3ds = 0x00800000; -static const ulong3ds Smooth25Group3ds = 0x01000000; -static const ulong3ds Smooth26Group3ds = 0x02000000; -static const ulong3ds Smooth27Group3ds = 0x04000000; -static const ulong3ds Smooth28Group3ds = 0x08000000; -static const ulong3ds Smooth29Group3ds = 0x10000000; -static const ulong3ds Smooth30Group3ds = 0x20000000; -static const ulong3ds Smooth31Group3ds = 0x40000000; -static const ulong3ds Smooth32Group3ds = 0x80000000; -/* End Public */ - -/* Public Typedefs */ - -/* mapinfo3ds - Texture map icon placement */ -typedef struct { - ushort3ds maptype; /* Icon type */ - float3ds tilex; /* Tiling */ - float3ds tiley; - float3ds cenx; /* Position of center */ - float3ds ceny; - float3ds cenz; - float3ds scale; /* Icon scaling factor */ - float3ds matrix[12]; /* Orientation matrix */ - float3ds pw; /* Planar icon width */ - float3ds ph; /* Planar icon height */ - float3ds ch; /* Cylinder icon height */ -} mapinfo3ds; - -/* objmat3ds - Material assignments by face */ -typedef struct { - char3ds name[17]; /* Material name */ - ushort3ds nfaces; /* Number of faces using material */ - ushort3ds *faceindex; /* List of faces using material */ -} objmat3ds; - -/* mesh3ds - Mesh object definition */ -typedef struct { - char3ds name[11]; /* Object name */ - byte3ds ishidden; /* Hidden object flag */ - byte3ds isvislofter; /* Lofter visibility flag */ - byte3ds ismatte; /* Matte object flag */ - byte3ds isnocast; /* Doesn't cast shadow's flag */ - byte3ds isfast; /* Fast display flag */ - byte3ds isnorcvshad; /* Doesn't recieve shadows */ - byte3ds isfrozen; /* Frozen object flag */ - ushort3ds nvertices; /* Vertice count */ - point3ds *vertexarray; /* List of vertices */ - ushort3ds nvflags; /* Number of vertex flags */ - ushort3ds *vflagarray; /* List of vertex flags */ - ushort3ds ntextverts; /* Number of texture vertices */ - textvert3ds *textarray; /* List of texture coordinates */ - byte3ds usemapinfo; /* Boolean for use of mapping icon information */ - mapinfo3ds map; /* Mapping icon info */ - float3ds locmatrix[12]; /* Object orientation matrix */ - ushort3ds nfaces; /* Face count */ - face3ds *facearray; /* List of faces */ - ulong3ds *smootharray; /* Smoothing group assignment list */ - byte3ds useboxmap; /* Boolean used to indicate the use of box mapping */ - char3ds boxmap[6][17]; /* Material names used in boxmapping */ - ubyte3ds meshcolor; /* UI color assigned to the mesh */ - ushort3ds nmats; /* Assigned materials count */ - objmat3ds *matarray; /* Material assignment list */ - byte3ds useproc; /* Use animated stand-in flag */ - ulong3ds procsize; /* Size of animated stand-in data */ - char3ds procname[13]; /* Name of animated stand-in procedure */ - void3ds *procdata; /* Animated stand-in data */ -} mesh3ds; -/* End Public */ - -/* Public Prototypes */ - -/* Mesh object functions */ -ulong3ds GetMeshCount3ds(database3ds *db); -void GetMeshNameList3ds(database3ds *db, namelist3ds **list); -void GetMeshByIndex3ds(database3ds *db, ulong3ds index, mesh3ds **mesh); -void GetMeshByName3ds(database3ds *db, char3ds *name, mesh3ds **mesh); -void PutMesh3ds(database3ds *db, mesh3ds *mesh); -void CopyMeshByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyMeshByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void DeleteMeshByName3ds(database3ds *db, char3ds *name); -void DeleteMeshByIndex3ds(database3ds *db, ulong3ds index); -/* End Public */ - -ulong3ds GetMeshMatCount3ds(chunk3ds *current); -void GetMeshEntryChunk3ds(chunk3ds *chunk, mesh3ds **mesh); - -#endif - diff --git a/3rdparty/3dsftk3/src/3dsmset.c b/3rdparty/3dsftk3/src/3dsmset.c deleted file mode 100644 index 390fe266..00000000 --- a/3rdparty/3dsftk3/src/3dsmset.c +++ /dev/null @@ -1,430 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsftkst.h" -#include "chunk3ds.h" -#include "dbase3ds.h" -#include "3dsmset.h" -#include "mdata3ds.h" - -/* Initializes the mesh settings structure, if the pointer is a NULL pointer, then - memory will be allocated for the mesh settings structure */ -void InitMeshSet3ds(meshset3ds **settings) -{ - if (settings == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* if the structure pointer is NULL, then allocate a new one. */ - if (*settings == NULL) - { - *settings = malloc(sizeof(meshset3ds)); - if(*settings == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - } - - (*settings)->masterscale = 1.0f; - (*settings)->shadow.bias = 1.0f; - (*settings)->shadow.raybias = 1.0f; - (*settings)->shadow.mapsize = 512; - (*settings)->shadow.filter = 3.0f; - (*settings)->ambientlight.r = (*settings)->ambientlight.g = (*settings)->ambientlight.b = 0.39216f; - (*settings)->oconsts.x = (*settings)->oconsts.y = (*settings)->oconsts.z = 0.0f; -} - -/* Frees the memory allocated to the pointer, and set the pointer to NULL */ -void ReleaseMeshSet3ds(meshset3ds **settings) -{ - if (settings == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (*settings != NULL) - { - free(*settings); - *settings = NULL; - } -} - - -/* Retreves the mesh settings from the database */ -void GetMeshSet3ds(database3ds *db, /* Database being searched */ - meshset3ds **settings /* The mesh settings structure, if - *settings is NULL, then a new - structure will be allocated by the - routine */ - ) -{ - chunk3ds *mdata, *chunk; - - if (db == NULL || settings == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Find the mesh data chunk */ - FindChunk3ds(db->topchunk, MDATA, &mdata); - - /* If the mesh data section is found */ - if (mdata != NULL) - { - InitMeshSet3ds(settings); - - /* Search for a master_scale chunk */ - FindNextChunk3ds(mdata->children, MASTER_SCALE, &chunk); - if (chunk != NULL) - { - MasterScale *scale; - - ReadChunkData3ds(chunk); - scale = chunk->data; - (*settings)->masterscale = scale->masterscale; - FreeFileChunkData3ds(chunk); - } - - /* Search for lo_shadow_bias chunk */ - FindNextChunk3ds(mdata->children, LO_SHADOW_BIAS, &chunk); - if (chunk != NULL) - { - LoShadowBias *bias; - - ReadChunkData3ds(chunk); - bias = chunk->data; - (*settings)->shadow.bias = bias->bias; - FreeFileChunkData3ds(chunk); - } - - /* Search for ray_bias chunk */ - FindNextChunk3ds(mdata->children, RAY_BIAS, &chunk); - if (chunk != NULL) - { - RayBias *bias; - - ReadChunkData3ds(chunk); - bias = chunk->data; - (*settings)->shadow.raybias = bias->bias; - FreeFileChunkData3ds(chunk); - } - - /* Search for mapsize chunk */ - FindNextChunk3ds(mdata->children, SHADOW_MAP_SIZE, &chunk); - if (chunk != NULL) - { - ShadowMapSize *size; - - ReadChunkData3ds(chunk); - size = chunk->data; - (*settings)->shadow.mapsize = size->shadowmapsize; - FreeFileChunkData3ds(chunk); - } - - /* Search for shadow_filter chunk */ - FindNextChunk3ds(mdata->children, SHADOW_FILTER, &chunk); - if (chunk != NULL) - { - ShadowFilter *filter; - ReadChunkData3ds(chunk); - filter = chunk->data; - (*settings)->shadow.filter = filter->shadowfilter; - FreeFileChunkData3ds(chunk); - } - - /* Search for ambient_light chunk */ - FindNextChunk3ds(mdata->children, AMBIENT_LIGHT, &chunk); - if (chunk != NULL) - { - chunk3ds *colorchunk; - - /* Search for the old style color chunk inside the ambient light chunk */ - FindChunk3ds(chunk, COLOR_F, &colorchunk); - if (colorchunk != NULL) - { - ColorF *color; - ReadChunkData3ds(colorchunk); - color = colorchunk->data; - (*settings)->ambientlight.r = color->red; - (*settings)->ambientlight.g = color->green; - (*settings)->ambientlight.b = color->blue; - FreeFileChunkData3ds(colorchunk); - } else - { - /* Just for robust completeness, search for the COLOR_24 chunk */ - FindChunk3ds(chunk, COLOR_24, &colorchunk); - if (colorchunk != NULL) - { - Color24 *color; - ReadChunkData3ds(colorchunk); - color = colorchunk->data; - (*settings)->ambientlight.r = (float3ds)(color->red) / 256.0f; - (*settings)->ambientlight.g = (float3ds)(color->green) / 256.0f; - (*settings)->ambientlight.b = (float3ds)(color->blue) / 256.0f; - FreeFileChunkData3ds(colorchunk); - } - } - - /* Search for the newer linear color chunk inside the ambient light chunk */ - FindChunk3ds(chunk, LIN_COLOR_F, &colorchunk); - if (colorchunk != NULL) - { - LinColorF *color; - ReadChunkData3ds(colorchunk); - color = colorchunk->data; - (*settings)->ambientlight.r = color->red; - (*settings)->ambientlight.g = color->green; - (*settings)->ambientlight.b = color->blue; - FreeFileChunkData3ds(colorchunk); - } else - { - /* Just for completeness, search for the LIN_COLOR_24 chunk */ - FindChunk3ds(chunk, LIN_COLOR_24, &colorchunk); - if (colorchunk != NULL) - { - LinColor24 *color; - ReadChunkData3ds(colorchunk); - color = colorchunk->data; - (*settings)->ambientlight.r = (float3ds)(color->red) / 256.0f; - (*settings)->ambientlight.g = (float3ds)(color->green) / 256.0f; - (*settings)->ambientlight.b = (float3ds)(color->blue) / 256.0f; - FreeFileChunkData3ds(colorchunk); - } - } - } - - /* Search for the oconst chunk */ - FindNextChunk3ds(mdata->children, O_CONSTS, &chunk); - if (chunk != NULL) - { - OConsts *d; - d = ReadChunkData3ds(chunk); - (*settings)->oconsts.x = d->oconsts.x; - (*settings)->oconsts.y = d->oconsts.y; - (*settings)->oconsts.z = d->oconsts.z; - FreeFileChunkData3ds(chunk); - } - } -} - -/* Adds/replaces mesh settings to/in the 3ds chunk database */ -void PutMeshSet3ds(database3ds *db, /* chunk database to put the settings in */ - meshset3ds *settings /* the settings to ad to the database */ - ) -{ - chunk3ds *mdata, *color, *chunk; - - if(db == NULL || settings == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if(db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Search for a mesh data chunk */ - FindChunk3ds(db->topchunk, MDATA, &mdata); - - /* If one isn't found, add it to the list */ - if (mdata == NULL) - { - InitChunkAs3ds(&mdata, MDATA); - AddChildOrdered3ds(db->topchunk, mdata); - } - - /* Search for a MESH_VERSION chunk, and replace the existing one or add a new one */ - ReplaceOrAddChild3ds(mdata, MESH_VERSION, &chunk); - - /* Create a new data structure */ - InitChunkData3ds(chunk); - - /* Add the master scale chunk */ - ReplaceOrAddChild3ds(mdata, MASTER_SCALE, &chunk); - InitChunkData3ds(chunk); - ((MasterScale *)(chunk->data))->masterscale = settings->masterscale; - - /* Add the lo_shadow_bias chunk */ - ReplaceOrAddChild3ds(mdata, LO_SHADOW_BIAS, &chunk); - InitChunkData3ds(chunk); - ((LoShadowBias *)(chunk->data))->bias = settings->shadow.bias; - - /* Add the shadow_map_size chunk */ - ReplaceOrAddChild3ds(mdata, SHADOW_MAP_SIZE, &chunk); - InitChunkData3ds(chunk); - ((ShadowMapSize *)(chunk->data))->shadowmapsize = settings->shadow.mapsize; - - /* Add the shadow_filter chunk */ - ReplaceOrAddChild3ds(mdata, SHADOW_FILTER, &chunk); - InitChunkData3ds(chunk); - ((ShadowFilter *)(chunk->data))->shadowfilter = settings->shadow.filter; - - /* Add the ray_bias chunk */ - ReplaceOrAddChild3ds(mdata, RAY_BIAS, &chunk); - InitChunkData3ds(chunk); - ((RayBias *)(chunk->data))->bias = settings->shadow.raybias; - - /* Add the ambient_light chunk */ - ReplaceOrAddChild3ds(mdata, AMBIENT_LIGHT, &chunk); - - InitChunkAndData3ds(&color, COLOR_F); - AddChildOrdered3ds(chunk, color); - ((ColorF *)(color->data))->red = settings->ambientlight.r; - ((ColorF *)(color->data))->green = settings->ambientlight.g; - ((ColorF *)(color->data))->blue = settings->ambientlight.b; - - InitChunkAndData3ds(&color, LIN_COLOR_F); - AddChildOrdered3ds(chunk, color); - ((LinColorF *)(color->data))->red = settings->ambientlight.r; - ((LinColorF *)(color->data))->green = settings->ambientlight.g; - ((LinColorF *)(color->data))->blue = settings->ambientlight.b; - - /* Add the oconst chunk */ - ReplaceOrAddChild3ds(mdata, O_CONSTS, &chunk); - InitChunkData3ds(chunk); - ((OConsts *)(chunk->data))->oconsts.x = settings->oconsts.x; - ((OConsts *)(chunk->data))->oconsts.y = settings->oconsts.y; - ((OConsts *)(chunk->data))->oconsts.z = settings->oconsts.z; - - -} - -void CopyMeshSet3ds(database3ds *destdb, database3ds *srcdb) -{ - chunk3ds *srcmdata, *destmdata, *srcchunk, *destchunk; - - if ((destdb == NULL) || (srcdb == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find source mesh section */ - FindNextChunk3ds(srcdb->topchunk->children, MDATA, &srcmdata); - - /* If found */ - if (srcmdata != NULL) - { - /* Find or create destination mesh section */ - FindChunk3ds(destdb->topchunk, MDATA, &destmdata); - if (destmdata == NULL) - { - InitChunkAs3ds(&destmdata, MDATA); - AddChildOrdered3ds(destdb->topchunk, destmdata); - } - - /* Scan the source mdata section looking for mesh setting chunks */ - for (srcchunk = srcmdata->children; srcchunk != NULL; srcchunk = srcchunk->sibling) - { - switch(srcchunk->tag) - { - case MESH_VERSION: - case MASTER_SCALE: - case LO_SHADOW_BIAS: - case SHADOW_MAP_SIZE: - case SHADOW_FILTER: - case RAY_BIAS: - case O_CONSTS: - /* if the same chunk exists in the destination, then delete it */ - FindNextChunk3ds(destmdata->children, srcchunk->tag, &destchunk); - if (destchunk != NULL) - DeleteChunk3ds(destchunk); - - /* Copy and add the chunk */ - CopyChunk3ds(srcchunk, &destchunk); - ON_ERROR_RETURN; - - AddChildOrdered3ds(destmdata, destchunk); - break; - default: - break; - } - } - } -} - - diff --git a/3rdparty/3dsftk3/src/3dsmset.h b/3rdparty/3dsftk3/src/3dsmset.h deleted file mode 100644 index 7ff7f11b..00000000 --- a/3rdparty/3dsftk3/src/3dsmset.h +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef MSET_3DS_H -#define MSET_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" - -/* Public Typedefs */ -typedef enum -{ - UseShadowMap, - UseRayTraceShadow -} shadowstyle3ds; - -typedef struct { /* global shadow settings */ - shadowstyle3ds type; /* Either UseShadowMaps or UseRayTraceShadows */ - float3ds bias; /* shadow bias factor. */ - float3ds raybias; /* shadow ray bais factor. Used in R3 */ - short3ds mapsize; /* shadow map size */ - float3ds filter; /* shadow filter */ -} shadowsets3ds; - -typedef struct { - float3ds masterscale; /* Master mesh scale factor */ - shadowsets3ds shadow; /* Global shadow settings */ - fcolor3ds ambientlight; /* ambient light color */ - point3ds oconsts; /* default object constructing axis */ -} meshset3ds; -/* End Public */ - -/* Public Prototypes */ -void InitMeshSet3ds(meshset3ds **); -void ReleaseMeshSet3ds(meshset3ds **); -void GetMeshSet3ds(database3ds *, meshset3ds **); -void PutMeshSet3ds(database3ds *db, meshset3ds *settings); -void CopyMeshSet3ds(database3ds *destdb, database3ds *srcdb); - -/* End Public */ - -#endif - diff --git a/3rdparty/3dsftk3/src/3dsobjm.c b/3rdparty/3dsftk3/src/3dsobjm.c deleted file mode 100644 index f6281f9e..00000000 --- a/3rdparty/3dsftk3/src/3dsobjm.c +++ /dev/null @@ -1,927 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - - -#include -#include - -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "dbase3ds.h" -#include "3dsobjm.h" -#include "kfutils.h" - -const kfrotkey3ds -DefKfRotKey3ds = {0.0F, 0.0F, 0.0F, 1.0F}; /* Zero degree rotation about the Z axis */ - -/*----------------------------------------------------------------------------- - | InitObjectMotion3ds - | - +---------------------------------------------------------------------------*/ -void InitObjectMotion3ds(kfmesh3ds **obj, - ulong3ds npkeys, /* Number of position keys */ - ulong3ds nrkeys, /* Number of rot keys */ - ulong3ds nskeys, /* Number of scale keys */ - ulong3ds nmkeys, /* Number of morph keys */ - ulong3ds nhkeys) /* Number of hide keys */ -{ - ulong3ds i; - - if ((*obj) == NULL) - { - (*obj) = malloc(sizeof(kfmesh3ds)); - if (*obj == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - (*obj)->name[0] = 0; - (*obj)->parent[0] = 0; - (*obj)->flags1 = (*obj)->flags2 = (ushort3ds)0; - - memcpy(&((*obj)->pivot), &DefPoint3ds, sizeof(DefPoint3ds)); - - (*obj)->instance[0] = 0; - - memcpy(&((*obj)->boundmin), &DefPoint3ds, sizeof(DefPoint3ds)); - memcpy(&((*obj)->boundmax), &DefPoint3ds, sizeof(DefPoint3ds)); - - (*obj)->npkeys = npkeys; - (*obj)->nrkeys = nrkeys; - (*obj)->nskeys = nskeys; - (*obj)->nmkeys = nmkeys; - (*obj)->nhkeys = nhkeys; - - (*obj)->pkeys = NULL; - (*obj)->rkeys = NULL; - (*obj)->skeys = NULL; - (*obj)->mkeys = NULL; - (*obj)->hkeys = NULL; - - - (*obj)->pos = NULL; - (*obj)->rot = NULL; - (*obj)->scale = NULL; - (*obj)->morph = NULL; - - (*obj)->msangle = 24.0F; - } - - if (npkeys != 0) - { - (*obj)->npflag = TrackSingle3ds; - - (*obj)->npkeys = npkeys; - if ((*obj)->pkeys != NULL) {free((*obj)->pkeys); (*obj)->pkeys = NULL;} - if ((*obj)->pos != NULL) {free((*obj)->pos); (*obj)->pos = NULL;} - - (*obj)->pkeys = calloc((*obj)->npkeys, sizeof(keyheader3ds)); - if((*obj)->pkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->npkeys; i++) - memcpy(&(((*obj)->pkeys)[i]), &DefKeyHeader3ds, sizeof(DefKeyHeader3ds)); - - (*obj)->pos = calloc((*obj)->npkeys, sizeof(point3ds)); - if((*obj)->pos == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->npkeys; i++) - memcpy(&(((*obj)->pos)[i]), &DefPoint3ds, sizeof(DefPoint3ds)); - } - - if (nrkeys != 0) - { - (*obj)->nrflag = TrackSingle3ds; - - (*obj)->nrkeys = nrkeys; - if ((*obj)->rkeys != NULL) {free((*obj)->rkeys); (*obj)->rkeys = NULL;} - if ((*obj)->rot != NULL) {free((*obj)->rot); (*obj)->rot = NULL;} - - (*obj)->rkeys = calloc((*obj)->nrkeys, sizeof(keyheader3ds)); - if((*obj)->rkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->nrkeys; i++) - memcpy(&(((*obj)->rkeys)[i]), &DefKeyHeader3ds, sizeof(DefKeyHeader3ds)); - - (*obj)->rot = calloc((*obj)->nrkeys, sizeof(kfrotkey3ds)); - if((*obj)->rot == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->nrkeys; i++) - memcpy(&(((*obj)->rot)[i]), &DefKfRotKey3ds, sizeof(DefKfRotKey3ds)); - } - - if (nskeys != 0) - { - (*obj)->nsflag = TrackSingle3ds; - - (*obj)->nskeys = nskeys; - if ((*obj)->skeys != NULL) {free((*obj)->skeys); (*obj)->skeys = NULL;} - if ((*obj)->scale != NULL) {free((*obj)->scale); (*obj)->scale = NULL;} - - (*obj)->skeys = calloc((*obj)->nskeys, sizeof(keyheader3ds)); - if((*obj)->skeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->nskeys; i++) - memcpy(&(((*obj)->skeys)[i]), &DefKeyHeader3ds, sizeof(DefKeyHeader3ds)); - - (*obj)->scale = calloc((*obj)->nskeys, sizeof(point3ds)); - if((*obj)->scale == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->nskeys; i++) - ((*obj)->scale)[i].x = ((*obj)->scale)[i].y = ((*obj)->scale)[i].z = 1.0F; - } - - if (nmkeys != 0) - { - (*obj)->nmflag = TrackSingle3ds; - - (*obj)->nmkeys = nmkeys; - if ((*obj)->mkeys != NULL) {free((*obj)->mkeys); (*obj)->mkeys = NULL;} - if ((*obj)->morph != NULL) {free((*obj)->morph); (*obj)->morph = NULL;} - - (*obj)->mkeys = calloc((*obj)->nmkeys, sizeof(keyheader3ds)); - if((*obj)->mkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->nmkeys; i++) - memcpy(&(((*obj)->mkeys)[i]), &DefKeyHeader3ds, sizeof(DefKeyHeader3ds)); - - (*obj)->morph = calloc((*obj)->nmkeys, sizeof(kfmorphkey3ds)); - if((*obj)->morph == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->nmkeys; i++) - ((*obj)->morph)[i].name[0] = ' '; - } - - if (nhkeys != 0) - { - (*obj)->nhflag = TrackSingle3ds; - - (*obj)->nhkeys = nhkeys; - if ((*obj)->hkeys != NULL) {free((*obj)->hkeys); (*obj)->hkeys = NULL;} - - (*obj)->hkeys = calloc((*obj)->nhkeys, sizeof(keyheader3ds)); - if((*obj)->mkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - for (i = 0; i < (*obj)->nmkeys; i++) - memcpy(&(((*obj)->mkeys)[i]), &DefKeyHeader3ds, sizeof(DefKeyHeader3ds)); - } -} - -/*-------------------------------------------------------- - | - | ReleaseObjectMotion3ds - | - +--------------------------------------------------------*/ -void ReleaseObjectMotion3ds(kfmesh3ds **obj) -{ - if (*obj != NULL) - { - if ((*obj)->pkeys != NULL) - free((*obj)->pkeys); - if ((*obj)->pos != NULL) - free((*obj)->pos); - if ((*obj)->rkeys != NULL) - free((*obj)->rkeys); - if ((*obj)->rot != NULL) - free((*obj)->rot); - if ((*obj)->skeys != NULL) - free((*obj)->skeys); - if ((*obj)->scale != NULL) - free((*obj)->scale); - if ((*obj)->mkeys != NULL) - free((*obj)->mkeys); - if ((*obj)->morph != NULL) - free((*obj)->morph); - if ((*obj)->hkeys != NULL) - free((*obj)->hkeys); - free(*obj); - *obj = NULL; - } - -} - -/*-------------------------------------------------------------------- - | - | GetObjectNodeCount3ds - | - +--------------------------------------------------------------------*/ -ulong3ds GetObjectNodeCount3ds(database3ds *db) -{ - return kfGetGenericNodeCount(db, OBJECT_NODE_TAG); -} - -/*-------------------------------------------------------------------- - | - | GetObjectNodeNameList3ds - | - +--------------------------------------------------------------------*/ -void GetObjectNodeNameList3ds(database3ds *db, namelist3ds **list) -{ - kfGetGenericNodeNameList(db, OBJECT_NODE_TAG, list); -} - - -/*---------------------------------------------------------------------- - | - | GetObjectMotionByName3ds - | - | db: database to be searched - | name: name of Object - | kfmesh: Ptr to the addr of kfmesh3ds structure, if (*kfmesh) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfmesh remains unchanged. - | - +----------------------------------------------------------------------*/ -void GetObjectMotionByName3ds(database3ds *db, - char3ds *name, - kfmesh3ds **kfmesh) -{ - chunk3ds *pObjectChunk; - - if(db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - pObjectChunk = FindNodeTagByNameAndType3ds(db, name, OBJECT_NODE_TAG); - ON_ERROR_RETURN; - - if (pObjectChunk) GetObjectMotion3ds(pObjectChunk, kfmesh); - ON_ERROR_RETURN; - -} - -/*---------------------------------------------------------------------- - | - | GetObjectMotionByIndex3ds - | - | db: database to be searched - | index: index of Object in name list - | kfmesh: Ptr to the addr of kfmesh3ds structure, if (*kfmesh) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfmesh remains unchanged. - | - +----------------------------------------------------------------------*/ -void GetObjectMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfmesh3ds **kfmesh) -{ - chunk3ds *pObjChunk; - - if(db == NULL || kfmesh == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if(db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if(db->topchunk->tag != M3DMAGIC && db->topchunk->tag != CMAGIC) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - pObjChunk = FindNodeTagByIndexAndType3ds(db, index, OBJECT_NODE_TAG); - ON_ERROR_RETURN; - - if (pObjChunk) GetObjectMotion3ds(pObjChunk, kfmesh); - ON_ERROR_RETURN; - -} - - - - -/*-------------------------------------------------------------------------- - | GetObjectMotion3ds - | - | pSpotChunk:OBJECT_NODE_TAG chunk to extract data from - | kfmesh: Structure to fill in with chunk data - | - | chunk----->kfMesh3ds - | - | Gets mesh keyframe information from chunk - | - | NODE_ID - | NODE_HDR - | APP_DATA - | INSTANCE_NAME - | PRESCALE a no-op in 3ds code - | POS_TRACK - | ROT_TRACK - | SCL_TRACK - | MORPH_TRACK - | MORPH_SMOOTH - | HIDE_TRACK - | - +--------------------------------------------------------------------------*/ -void GetObjectMotion3ds(chunk3ds *pMeshChunk, kfmesh3ds **kfmesh) -{ - kfmesh3ds - *pKfMesh; - chunk3ds - *pNodeHdrChunk, - *pInstChunk, - *pPivotChunk, - *pBboxChunk, - *pMsChunk, - *pPosChunk, - *pRotChunk, - *pScaleChunk, - *pMorphChunk, - *pHideChunk; - - ulong3ds - nPosKeys = 0, - nRotKeys = 0, - nScaleKeys = 0, - nMorphKeys = 0, - nHideKeys = 0; - - NodeHdr - *pNodeHdr; - Pivot - *pPivotData = NULL; - InstanceName - *pInstData = NULL; - BoundBox - *pBboxData = NULL; - MorphSmooth - *pMsData = NULL; - PosTrackTag - *pPosData = NULL; - RotTrackTag - *pRotData = NULL; - ScaleTrackTag - *pScaleData = NULL; - MorphTrackTag - *pMorphData = NULL; - HideTrackTag - *pHideData = NULL; - - chunk3ds *objtag; - - if(pMeshChunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if(pMeshChunk->tag != OBJECT_NODE_TAG) SET_ERROR_RETURN(ERR_WRONG_OBJECT); - - CopyChunk3ds(pMeshChunk, &objtag); - ON_ERROR_RETURN; - - /*------------------------------- - | Get information from chunks - +-------------------------------*/ - /*--- Search children of MeshLight chunk */ - FindChunk3ds(objtag, NODE_HDR, &pNodeHdrChunk); - FindChunk3ds(objtag, INSTANCE_NAME, &pInstChunk); - FindChunk3ds(objtag, PIVOT, &pPivotChunk); - FindChunk3ds(objtag, BOUNDBOX, &pBboxChunk); - FindChunk3ds(objtag, MORPH_SMOOTH, &pMsChunk); - FindChunk3ds(objtag, POS_TRACK_TAG, &pPosChunk); - FindChunk3ds(objtag, ROT_TRACK_TAG, &pRotChunk); - FindChunk3ds(objtag, SCL_TRACK_TAG, &pScaleChunk); - FindChunk3ds(objtag, MORPH_TRACK_TAG, &pMorphChunk); - FindChunk3ds(objtag, HIDE_TRACK_TAG, &pHideChunk); - - ReadChunkData3ds(pNodeHdrChunk); - pNodeHdr = pNodeHdrChunk->data; - - if (pInstChunk){ - ReadChunkData3ds(pInstChunk); - pInstData = pInstChunk->data; - pInstChunk->data = NULL; - } - - if (pPivotChunk){ - ReadChunkData3ds(pPivotChunk); - pPivotData = pPivotChunk->data; - pPivotChunk->data = NULL; - } - - if (pBboxChunk){ - ReadChunkData3ds(pBboxChunk); - pBboxData = pBboxChunk->data; - pBboxChunk->data = NULL; - } - - if (pMsChunk){ - pMsData = ReadChunkData3ds(pMsChunk); - pMsChunk->data = NULL; - } - - if(pPosChunk){ - ReadChunkData3ds(pPosChunk); - pPosData = pPosChunk->data; - nPosKeys = pPosData->trackhdr.keycount; - pPosChunk->data = NULL; - } - - if(pRotChunk){ - ReadChunkData3ds(pRotChunk); - pRotData = pRotChunk->data; - nRotKeys = pRotData->trackhdr.keycount; - pRotChunk->data = NULL; - } - if(pScaleChunk){ - ReadChunkData3ds(pScaleChunk); - pScaleData = pScaleChunk->data; - nScaleKeys = pScaleData->trackhdr.keycount; - pScaleChunk->data = NULL; - } - - if(pMorphChunk){ - ReadChunkData3ds(pMorphChunk); - pMorphData = pMorphChunk->data; - nMorphKeys = pMorphData->trackhdr.keycount; - pMorphChunk->data = NULL; - } - - if(pHideChunk){ - ReadChunkData3ds(pHideChunk); - pHideData = pHideChunk->data; - nHideKeys = pHideData->trackhdr.keycount; - pHideChunk->data = NULL; - } - - /*-------------------------------------------- - | Set-up and fill-in the kfmesh3ds structure - +--------------------------------------------*/ - if ((*kfmesh) == NULL) - { - (*kfmesh) = malloc(sizeof(kfmesh3ds)); - if(*kfmesh == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - } - - pKfMesh = *kfmesh; - - /*--- Header Information */ - strcpy(pKfMesh->name, pNodeHdr->objname); - pKfMesh->flags1 = pNodeHdr->flags1; - pKfMesh->flags2 = pNodeHdr->flags2; - - /*--- Get Parent Name if there is one */ - kfGetParentName(pNodeHdrChunk, pKfMesh->parent); - - /*--- Instance */ - if (pInstData) - { - strcpy(pKfMesh->instance, pInstData->name); - free(pInstData->name); /* CCJ */ - free( pInstData ); - } - else - pKfMesh->instance[0] = 0; - - /*--- Pivot */ - if (pPivotData) - { - memcpy(&(pKfMesh->pivot), &(pPivotData->offset), - sizeof(DefPoint3ds)); - free( pPivotData ); - } - else - memcpy(&(pKfMesh->pivot), &(DefPoint3ds), - sizeof(DefPoint3ds)); - - /*--- Bound */ - if (pBboxData) - { - memcpy(&(pKfMesh->boundmin), &(pBboxData->min), sizeof(point3ds)); - memcpy(&(pKfMesh->boundmax), &(pBboxData->max), sizeof(point3ds)); - free( pBboxData ); - } - else - { - memcpy(&(pKfMesh->boundmin), &DefPoint3ds, sizeof(DefPoint3ds)); - memcpy(&(pKfMesh->boundmax), &DefPoint3ds, sizeof(DefPoint3ds)); - } - - /*--- MorphSmooth Angle */ - if (pMsData) - { - pKfMesh->msangle = pMsData->smoothgroupangle; - free( pMsData ); - } - else - pKfMesh->msangle = 0.0F; - - /*--- Position */ - pKfMesh->npkeys = nPosKeys; - if (nPosKeys) - { - pKfMesh->pkeys = pPosData->keyhdrlist; - pKfMesh->pos = pPosData->positionlist; - pKfMesh->npflag = pPosData->trackhdr.flags; - free( pPosData ); - } - else - { - pKfMesh->pkeys = NULL; - pKfMesh->pos = NULL; - pKfMesh->npflag = 0; - } - - /*--- Rotation */ - pKfMesh->nrkeys = nRotKeys; - if (nRotKeys) - { - pKfMesh->rkeys = pRotData->keyhdrlist; - pKfMesh->rot = pRotData->rotationlist; - pKfMesh->nrflag = pRotData->trackhdr.flags; - free( pRotData ); - } - else - { - pKfMesh->rkeys = NULL; - pKfMesh->rot = NULL; - pKfMesh->nrflag = 0; - } - - /*--- Scale */ - pKfMesh->nskeys = nScaleKeys; - if (nScaleKeys) - { - pKfMesh->skeys = pScaleData->keyhdrlist; - pKfMesh->scale = pScaleData->scalelist; - pKfMesh->nsflag = pScaleData->trackhdr.flags; - free( pScaleData ); - } - else - { - pKfMesh->skeys = NULL; - pKfMesh->scale = NULL; - pKfMesh->nsflag = 0; - } - - /*--- Morph */ - pKfMesh->nmkeys = nMorphKeys; - if (nMorphKeys) - { - pKfMesh->mkeys = pMorphData->keyhdrlist; - pKfMesh->morph = pMorphData->morphlist; - pKfMesh->nmflag = pMorphData->trackhdr.flags; - free( pMorphData ); - } - else - { - pKfMesh->mkeys = NULL; - pKfMesh->morph = NULL; - pKfMesh->nmflag = 0; - } - - pKfMesh->nhkeys = nHideKeys; - if (nHideKeys) - { - pKfMesh->hkeys = pHideData->keyhdrlist; - pKfMesh->nhflag = pHideData->trackhdr.flags; - free( pHideData ); - } - else - { - pKfMesh->hkeys = NULL; - pKfMesh->nhflag = 0; - } - - /*-- ADDITIONAL MORPH INFO HERE */ - - /*--- Free Chunk Data: only free those that arent being copied */ - ReleaseChunk3ds(&objtag); -} - - -/*-------------------------------------------------------------------------- - | PutObjectMotion3ds - | Puts Object keyframe information into database. - | - | kfMesh3ds--->db - | - | KFDATA - | ... - | OBJECT_NODE - | NODE_ID - | NODE_HDR - | APP_DATA - | INSTANCE - | POS_TRACK - | ROT_TRACK - | SCL_TRACK - | MORPH_TRACK - | MORPH_SMOOTH - | HIDE_TRACK - | - | Needs Work: - | - +--------------------------------------------------------------------------*/ -void PutObjectMotion3ds(database3ds *db, kfmesh3ds *kfmesh) -{ - chunk3ds - *pKfChunk, *pMeshChunk, *pMeshXdata = NULL; - - if(db == NULL || kfmesh == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if(db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /*--- Find KFSEG chunk to put keyframe data into */ - kfGetKfSeg(db->topchunk, &pKfChunk); - - /*--- Destroy old chunks, Copy any XData and reattach it later */ - kfExtractXdata(db, kfmesh->name, OBJECT_NODE_TAG, &pMeshXdata); - - pMeshChunk = kfPutGenericNode(OBJECT_NODE_TAG, pKfChunk); - ON_ERROR_RETURN; - - MakeNodeTagListDirty3ds(db); - - kfPutNodeId(pMeshChunk); - kfPutNodeHeader(kfmesh->name, - kfmesh->flags1, - kfmesh->flags2, - kfmesh->parent, - pMeshChunk); - - if (strlen(kfmesh->instance) > 0){ /*--- Instance Name */ - chunk3ds *temp; - InstanceName *data; - - InitChunk3ds(&temp); - temp->tag = INSTANCE_NAME; - data = InitChunkData3ds(temp); - data->name = strdup(kfmesh->instance); - AddChildOrdered3ds(pMeshChunk, temp); - } - - if(strcmp(kfmesh->name, DummyName3ds) == 0){ /*--- Bounding Box */ - chunk3ds *temp; - BoundBox *data; - - InitChunk3ds(&temp); - temp->tag = BOUNDBOX; - data = InitChunkData3ds(temp); - - memcpy(&(data->min), &(kfmesh->boundmin), sizeof(point3ds)); - memcpy(&(data->max), &(kfmesh->boundmax), sizeof(point3ds)); - - AddChildOrdered3ds(pMeshChunk, temp); - } - - if((kfmesh->flags2) & KfNodeAutoSmooth3ds == KfNodeAutoSmooth3ds) - { /*--- Morphsmooth angle */ - chunk3ds *temp; - MorphSmooth *data; - - InitChunk3ds(&temp); - temp->tag = MORPH_SMOOTH; - data = InitChunkData3ds(temp); - - data->smoothgroupangle = kfmesh->msangle; - AddChildOrdered3ds(pMeshChunk, temp); - } - - /* if(1)*/ - { /*--- Pivot */ - chunk3ds *temp; - Pivot *data; - - InitChunk3ds(&temp); - temp->tag = PIVOT; - data = InitChunkData3ds(temp); - - memcpy(&(data->offset), &(kfmesh->pivot), sizeof(DefPoint3ds)); - AddChildOrdered3ds(pMeshChunk, temp); - } - - if (kfmesh->npkeys>0 && kfmesh->pkeys && kfmesh->pos) - kfPutPosTrack(kfmesh->npkeys, - kfmesh->npflag, - kfmesh->pkeys, - kfmesh->pos, - pMeshChunk); - - /*--- ROTATION */ - if (kfmesh->nrkeys>0 && kfmesh->rkeys && kfmesh->rot){ - RotTrackTag *data; - chunk3ds *temp = NULL; - int nKeys = kfmesh->nrkeys; - keyheader3ds *pKeyHdr = kfmesh->rkeys; - ushort3ds localFlag = kfmesh->nrflag; - - /*--- Create the ROT_TRACK_TAG chunk */ - InitChunk3ds(&temp); - temp->tag = ROT_TRACK_TAG; - data = InitChunkData3ds(temp); - - /*--- Initialize trackhdr field */ - data->trackhdr.flags = localFlag; - data->trackhdr.keycount = nKeys; - data->trackhdr.nu1 = data->trackhdr.nu2 = (ushort3ds)0; - - /*--- Copy headers */ - data->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - memcpy(data->keyhdrlist, pKeyHdr, nKeys * sizeof(keyheader3ds)); - - data->rotationlist = malloc(nKeys * sizeof(kfrotkey3ds)); - memcpy(data->rotationlist, kfmesh->rot, nKeys * sizeof(kfrotkey3ds)); - - /*--- Make if a child of the kframe node */ - AddChildOrdered3ds(pMeshChunk, temp); - } - - /*--- SCALING */ - if (kfmesh->nskeys>0 && kfmesh->skeys && kfmesh->scale){ - ScaleTrackTag *data; - chunk3ds *temp = NULL; - int nKeys = kfmesh->nskeys; - keyheader3ds *pKeyHdr = kfmesh->skeys; - ushort3ds localFlag = kfmesh->nsflag; - - /*--- Create the SCALE_TRACK_TAG chunk */ - InitChunk3ds(&temp); - temp->tag = SCL_TRACK_TAG; - data = InitChunkData3ds(temp); - - /*--- Initialize trackhdr field */ - data->trackhdr.flags = localFlag; - data->trackhdr.keycount = nKeys; - data->trackhdr.nu1 = data->trackhdr.nu2 = (ushort3ds)0; - - /*--- Copy headers */ - data->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - memcpy(data->keyhdrlist, pKeyHdr, nKeys * sizeof(keyheader3ds)); - - data->scalelist = malloc(nKeys * sizeof(point3ds)); - memcpy(data->scalelist, kfmesh->scale, nKeys * sizeof(point3ds)); - - /*--- Make if a child of the kframe node */ - AddChildOrdered3ds(pMeshChunk, temp); - } - - /*--- Morphing */ - if (kfmesh->nmkeys>0 && kfmesh->mkeys && kfmesh->morph){ - MorphTrackTag *data; - chunk3ds *temp = NULL; - int nKeys = kfmesh->nmkeys; - keyheader3ds *pKeyHdr = kfmesh->mkeys; - ushort3ds localFlag = kfmesh->nmflag; - - /*--- Create the MORPH_TRACK_TAG chunk */ - InitChunk3ds(&temp); - temp->tag = MORPH_TRACK_TAG; - data = InitChunkData3ds(temp); - - /*--- Initialize trackhdr field */ - data->trackhdr.flags = localFlag; - data->trackhdr.keycount = nKeys; - data->trackhdr.nu1 = data->trackhdr.nu2 = (ushort3ds)0; - - /*--- Copy headers */ - data->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - memcpy(data->keyhdrlist, pKeyHdr, nKeys * sizeof(keyheader3ds)); - - data->morphlist = malloc(nKeys * sizeof(kfmorphkey3ds)); - memcpy(data->morphlist, kfmesh->morph, nKeys * sizeof(kfmorphkey3ds)); - - /*--- Make if a child of the kframe node */ - AddChildOrdered3ds(pMeshChunk, temp); - } - - /*--- Hide -special case: only headers */ - if (kfmesh->nhkeys>0 && kfmesh->hkeys){ - HideTrackTag *data; - chunk3ds *temp = NULL; - int nKeys = kfmesh->nhkeys; - keyheader3ds *pKeyHdr = kfmesh->hkeys; - ushort3ds localFlag = kfmesh->nhflag; - - /*--- Create the HIDE_TRACK_TAG chunk */ - InitChunk3ds(&temp); - temp->tag = HIDE_TRACK_TAG; - data = InitChunkData3ds(temp); - - /*--- Initialize trackhdr field */ - data->trackhdr.flags = localFlag; - data->trackhdr.keycount = nKeys; - data->trackhdr.nu1 = data->trackhdr.nu2 = (ushort3ds)0; - - /*--- Copy headers */ - data->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - memcpy(data->keyhdrlist, pKeyHdr, nKeys * sizeof(keyheader3ds)); - - /*--- Make if a child of the kframe node */ - AddChildOrdered3ds(pMeshChunk, temp); - } - - /*--- Replace XData */ - if (pMeshXdata) - AddChildOrdered3ds(pMeshChunk, pMeshXdata); -} - -void DeleteObjectMotionByIndex3ds(database3ds *db, ulong3ds index) -{ - DeleteNodeTagByIndexAndType3ds(db, index, OBJECT_NODE_TAG); - ON_ERROR_RETURN; -} - -void DeleteObjectMotionByName3ds(database3ds *db, char3ds *name) -{ - DeleteNodeTagByNameAndType3ds(db, name, OBJECT_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopyObjectMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - CopyNodeTagByIndexAndType3ds(destdb, srcdb, index, OBJECT_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopyObjectMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - CopyNodeTagByNameAndType3ds(destdb, srcdb, name, OBJECT_NODE_TAG); - ON_ERROR_RETURN; -} - diff --git a/3rdparty/3dsftk3/src/3dsobjm.h b/3rdparty/3dsftk3/src/3dsobjm.h deleted file mode 100644 index 08dd4edd..00000000 --- a/3rdparty/3dsftk3/src/3dsobjm.h +++ /dev/null @@ -1,193 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef OBJM_3DS_H -#define OBJM_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" -#include "xdata.h" -#include "chunk3ds.h" - -/* Used By ObjectMotion3ds */ - -#define NoMorphSmooth3ds 0 -#define MorphSmooth3ds 0xb015 - -/* Used in the visable field of the kfmesh3ds structure */ -#define ShowObjMotion3ds 0 -#define HideObjMotion3ds (1<<11) -#define FastObjMotion3ds (1<<12) -#define FreezeObjMotion3ds (1<<2) - -/* Public Type Definitions */ -#define NoParent3ds -1 - -/* Public Consts */ -static const char3ds *DummyName3ds = "$$$DUMMY"; -/* End Public */ - -/* Public Typedefs */ -/* Used By ObjectMotion3ds */ - -typedef struct { - char3ds name[11]; /* Name of mesh */ - char3ds parent[22]; /* Name of parent object */ - ushort3ds flags1; /* flags field from node header */ - ushort3ds flags2; /* flags2 field from node header */ - - point3ds pivot; /* Object pivot point */ - char3ds instance[11]; /* Object instance name */ - point3ds boundmin; /* Minimum bounding box point for dummy objects */ - point3ds boundmax; /* Maximum bounding box point for dummy objects */ - - ulong3ds npkeys; /* Number of position keys */ - short3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for position keys */ - point3ds *pos; /* Mesh position keys */ - - ulong3ds nrkeys; /* Number of rotation keys */ - short3ds nrflag; /* Loop control flag for rotation keys */ - keyheader3ds *rkeys; /* Spline values for rotation keys */ - kfrotkey3ds *rot; /* Rotation keys */ - - ulong3ds nskeys; /* Number of scaling keys */ - short3ds nsflag; /* Loop control flag for scaling keys */ - keyheader3ds *skeys; /* Spline values for scaling */ - point3ds *scale; /* Mesh scaling keys */ - - ulong3ds nmkeys; /* Number of morph keys */ - short3ds nmflag; /* Loop control flag for morph keys */ - keyheader3ds *mkeys; /* Spline values for morph keys */ - kfmorphkey3ds *morph; /* Morph keys */ - - ulong3ds nhkeys; /* Number of hide keys */ - short3ds nhflag; /* Loop control flag for hide keys */ - keyheader3ds *hkeys; /* Spline values for hide keys */ - float3ds msangle; /* Morph smoothing group angle */ -} kfmesh3ds; -/* End Public */ - -/* Public Prototypes */ -void InitObjectMotion3ds(kfmesh3ds **obj, - ulong3ds npkeys, - ulong3ds nrkeys, - ulong3ds nskeys, - ulong3ds nmkeys, - ulong3ds nhkeys); - -void ReleaseObjectMotion3ds(kfmesh3ds **obj); - -void GetObjectNodeNameList3ds(database3ds *db, - namelist3ds **list); - -ulong3ds GetObjectNodeCount3ds(database3ds *db); - -void GetObjectMotionByName3ds(database3ds *db, - char3ds *name, - kfmesh3ds **kfmesh); - -void GetObjectMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfmesh3ds **kfmesh); - -void PutObjectMotion3ds(database3ds *db, - kfmesh3ds *kfmesh); - -void DeleteObjectMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteObjectMotionByName3ds(database3ds *db, char3ds *name); -void CopyObjectMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyObjectMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -/* End Public */ - -void GetObjectMotion3ds(chunk3ds *MeshChunk, - kfmesh3ds **kfmesh); - - - -#endif - diff --git a/3rdparty/3dsftk3/src/3dsomnm.c b/3rdparty/3dsftk3/src/3dsomnm.c deleted file mode 100644 index 5c81ed42..00000000 --- a/3rdparty/3dsftk3/src/3dsomnm.c +++ /dev/null @@ -1,505 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - - -#include -#include - -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dssptm.h" -#include "3dsomnm.h" -#include "kfutils.h" -#include "3dserr.h" - -/*---------------------------------------------------------- - | - |InitOmnilightMotion3ds - | - +----------------------------------------------------------*/ -void InitOmnilightMotion3ds(kfomni3ds **light, - ulong3ds npkeys, - ulong3ds nckeys) -{ - ulong3ds i; - - if (*light == NULL) - { - (*light) = malloc(sizeof(kfomni3ds)); - if(*light == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - (*light)->name[0] = 0; - (*light)->parent[0] = 0; - (*light)->flags1 = (*light)->flags2 = (ushort3ds)0; - - (*light)->npkeys = npkeys; - (*light)->nckeys = nckeys; - (*light)->pkeys = NULL; - (*light)->pos = NULL; - (*light)->ckeys = NULL; - (*light)->color = NULL; - } - - if (npkeys != 0) - { - (*light)->npflag = TrackSingle3ds; - - (*light)->npkeys = npkeys; - if ((*light)->pkeys != NULL) { - free((*light)->pkeys); - (*light)->pkeys = NULL; - } - - if ((*light)->pos != NULL) { - free((*light)->pos); - (*light)->pos = NULL; - } - - (*light)->pkeys = calloc((*light)->npkeys, sizeof(keyheader3ds)); - if((*light)->pkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*light)->npkeys; i++) - memcpy(&(((*light)->pkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - (*light)->pos = calloc((*light)->npkeys, sizeof(point3ds)); - if((*light)->pos == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*light)->npkeys; i++) - memcpy(&(((*light)->pos)[i]), - &DefPoint3ds, - sizeof(DefPoint3ds)); - } - - if (nckeys != 0) - { - (*light)->ncflag = TrackSingle3ds; - - (*light)->nckeys = nckeys; - if ((*light)->ckeys != NULL) { - free((*light)->ckeys); - (*light)->ckeys = NULL; - } - - if ((*light)->color != NULL) { - free((*light)->color); - (*light)->color = NULL; - } - - (*light)->ckeys = calloc((*light)->nckeys, sizeof(keyheader3ds)); - if((*light)->ckeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*light)->nckeys; i++) - memcpy(&(((*light)->ckeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - (*light)->color = calloc((*light)->nckeys, sizeof(fcolor3ds)); - if((*light)->color == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < (*light)->nckeys; i++) - ((*light)->color)[i].r = - ((*light)->color)[i].g = - ((*light)->color)[i].b = (float3ds)1.0; - } -} - -/*---------------------------------------------------------- - | - |ReleaseOmnilightMotion3ds - | - +----------------------------------------------------------*/ -void ReleaseOmnilightMotion3ds(kfomni3ds **light) -{ - if (*light != NULL) { - if((*light)->pkeys != NULL) free((*light)->pkeys); - if((*light)->pos != NULL) free((*light)->pos); - if((*light)->ckeys != NULL) free((*light)->ckeys); - if((*light)->color != NULL) free((*light)->color); - free(*light); - *light = NULL; - } -} - -/*-------------------------------------------------------------------- - | - | GetOmnilightNodeCount3ds - | - +--------------------------------------------------------------------*/ -ulong3ds GetOmnilightNodeCount3ds(database3ds *db) -{ - return kfGetGenericNodeCount(db, LIGHT_NODE_TAG); -} - -/*-------------------------------------------------------------------- - | - | GetOmnilightNodeNameList3ds - | - +--------------------------------------------------------------------*/ -void GetOmnilightNodeNameList3ds(database3ds *db, namelist3ds **list) -{ - kfGetGenericNodeNameList(db, LIGHT_NODE_TAG, list); -} - - -/*---------------------------------------------------------------------- - | - | GetOmnilightMotionByName3ds - | - | db: database to be searched - | name: name of Omnilight - | kfomni: Ptr to the addr of kfomni3ds structure, if (*kfomni) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfomni remains unchanged. - | - +----------------------------------------------------------------------*/ -void GetOmnilightMotionByName3ds(database3ds *db, - char3ds *name, - kfomni3ds **kfomni) -{ - chunk3ds *pChunk; - - if(db == NULL || name == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - kfFindNamedAndTaggedChunk(db, name, LIGHT_NODE_TAG, &pChunk); - - if (pChunk) - GetOmnilightMotion3ds(pChunk, kfomni); -} - -/*---------------------------------------------------------------------- - | - | GetOmnilightMotionByIndex3ds - | - | db: database to be searched - | index: index of Omnilight in name list - | kfomni: Ptr to the addr of kfomni3ds structure, if (*kfomni) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfomni remains unchanged. - | - +----------------------------------------------------------------------*/ -void GetOmnilightMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfomni3ds **kfomni) -{ - chunk3ds *pOmniChunk; - namelist3ds *list = NULL; - char3ds *name; - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - GetOmnilightNodeNameList3ds(db, &list); - - if (index < list->count){ - name = list->list[index].name; - kfFindNamedAndTaggedChunk(db, name, LIGHT_NODE_TAG, &pOmniChunk); - - if (pOmniChunk) - GetOmnilightMotion3ds(pOmniChunk, kfomni); - } - /*--- release list when done using name */ - ReleaseNameList3ds(&list); - } - - - -/*-------------------------------------------------------------------------- - | GetOmnilightMotion3ds - | - | pOmniChunk:SPOTLIGHT_NODE_TAG chunk to extract data from - | pTargetChunk: L_TARGET_NODE_TAG chunk to extract target data from - | kfspot: Structure to fill in with chunk data - | - | chunk----->kfOmni3ds - | - | Gets Omnilight keyframe information from chunk - | - | L_TARGET - | NODE_ID - | NODE_HDR - | APP_DATA - | POS_TRACK - | COL_TRACK - | HOT_TRACK - | FALL_TRACK - | ROLL_TRACK - | - +--------------------------------------------------------------------------*/ -void GetOmnilightMotion3ds(chunk3ds *pOmniChunk, - kfomni3ds **kfomni) -{ - kfomni3ds *pKfOmni; - chunk3ds *pNodeHdrChunk, *pPosChunk, *pColChunk; - ulong3ds i, nPosKeys = 0, nColKeys = 0; - NodeHdr *pNodeHdr; - PosTrackTag *pPosData = NULL; - ColTrackTag *pColData = NULL; - - - if (pOmniChunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /*------------------------------- - | Get information from chunks - +-------------------------------*/ - /*--- Search children of OmniLight chunk */ - FindChunk3ds(pOmniChunk, NODE_HDR, &pNodeHdrChunk); - FindChunk3ds(pOmniChunk, POS_TRACK_TAG, &pPosChunk); - FindChunk3ds(pOmniChunk, COL_TRACK_TAG, &pColChunk); - - ReadChunkData3ds(pNodeHdrChunk); - pNodeHdr = pNodeHdrChunk->data; - - if(pPosChunk){ - ReadChunkData3ds(pPosChunk); - pPosData = pPosChunk->data; - nPosKeys = pPosData->trackhdr.keycount; - } - - if(pColChunk){ - ReadChunkData3ds(pColChunk); - pColData = pColChunk->data; - nColKeys = pColData->trackhdr.keycount; - } - - /*-------------------------------------------- - | Set-up and fill-in the kfomni3ds structure - +--------------------------------------------*/ - InitOmnilightMotion3ds(kfomni, nPosKeys, nColKeys); - - pKfOmni = *kfomni; - - /*--- Header Information */ - strcpy(pKfOmni->name, pNodeHdr->objname); - pKfOmni->flags1 = pNodeHdr->flags1; - pKfOmni->flags2 = pNodeHdr->flags2; - kfGetParentName(pNodeHdrChunk, pKfOmni->parent); - - /*--- Position Information */ - if (nPosKeys){ - pKfOmni->npflag = pPosData->trackhdr.flags; - for (i=0; ipkeys)[i]), &((pPosData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfOmni->pos)[i]), &((pPosData->positionlist)[i]), - sizeof(point3ds)); - } - } - - /*--- Color Information */ - if (nColKeys){ - pKfOmni->ncflag = pColData->trackhdr.flags; - for (i=0; ickeys)[i]), &((pColData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfOmni->color)[i]), &((pColData->colorlist)[i]), - sizeof(fcolor3ds)); - } - } - - /*--- Free Chunk Data */ - if (pNodeHdrChunk) - FreeFileChunkData3ds(pNodeHdrChunk); - if (pPosChunk) - FreeFileChunkData3ds(pPosChunk); - if (pColChunk) - FreeFileChunkData3ds(pColChunk); -} - -/*-------------------------------------------------------------------------- - | PutOmnilightMotion3ds - | Puts Omnilight keyframe information into database. - | - | kfOmnilight3ds--->db - | - | KFDATA - | ... - | LIGHT_NODE - | NODE_ID - | NODE_HDR - | APP_DATA - | POS_TRACK - | COL_TRACK - | - | Needs Work: - | 1. NodeId: what value? - | - +--------------------------------------------------------------------------*/ -void PutOmnilightMotion3ds(database3ds *db, kfomni3ds *kfomni) -{ - chunk3ds - *pKfChunk, *pOmniChunk, *pOmniXdata = NULL; - - if(db == NULL || kfomni == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if(db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - MakeNodeTagListDirty3ds(db); - - /*--- Find KFSEG chunk to put keyframe data into */ - kfGetKfSeg(db->topchunk, &pKfChunk); - - /*--- Destroy old chunks, Copy any XData and reattach it later */ - kfExtractXdata(db, kfomni->name, LIGHT_NODE_TAG, &pOmniXdata); - - - pOmniChunk = kfPutGenericNode(LIGHT_NODE_TAG, pKfChunk); - kfPutNodeId(pOmniChunk); - kfPutNodeHeader(kfomni->name, - kfomni->flags1, - kfomni->flags2, - kfomni->parent, - pOmniChunk); - - MakeNodeTagListDirty3ds(db); - - - if (kfomni->npkeys>0 && kfomni->pkeys && kfomni->pos) - kfPutPosTrack(kfomni->npkeys, - kfomni->npflag, - kfomni->pkeys, - kfomni->pos, - pOmniChunk); - - if (kfomni->nckeys>0 && kfomni->ckeys && kfomni->color) - kfPutColorTrack(kfomni->nckeys, - kfomni->ncflag, - kfomni->ckeys, - kfomni->color, - pOmniChunk); - - /*--- Replace XData */ - if (pOmniXdata) - AddChildOrdered3ds(pOmniChunk, pOmniXdata); -} - -void DeleteOmnilightMotionByIndex3ds(database3ds *db, ulong3ds index) -{ - DeleteNodeTagByIndexAndType3ds(db, index, LIGHT_NODE_TAG); - ON_ERROR_RETURN; -} - -void DeleteOmnilightMotionByName3ds(database3ds *db, char3ds *name) -{ - DeleteNodeTagByNameAndType3ds(db, name, LIGHT_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopyOmnilightMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - CopyNodeTagByIndexAndType3ds(destdb, srcdb, index, LIGHT_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopyOmnilightMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - CopyNodeTagByNameAndType3ds(destdb, srcdb, name, LIGHT_NODE_TAG); - ON_ERROR_RETURN; -} - diff --git a/3rdparty/3dsftk3/src/3dsomnm.h b/3rdparty/3dsftk3/src/3dsomnm.h deleted file mode 100644 index abfb36d7..00000000 --- a/3rdparty/3dsftk3/src/3dsomnm.h +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef OMNM_3DS_H -#define OMNM_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" -#include "chunk3ds.h" - -/* Public Typedefs */ - -/* Used By OmnilightMotion3ds */ - -typedef struct { - char3ds name[11]; /* Name of the light object node */ - char3ds parent[22]; /* Name of the parent object */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - - ulong3ds npkeys; /* Number of position keys */ - ushort3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for position keys */ - point3ds *pos; /* Position keys */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag for color keys */ - keyheader3ds *ckeys; /* Spline values for position keys */ - fcolor3ds *color; /* Color keys */ - -} kfomni3ds; -/* End Public */ - -/* Public Prototypes */ -void InitOmnilightMotion3ds(kfomni3ds **light, - ulong3ds npkeys, - ulong3ds nckeys); - -void ReleaseOmnilightMotion3ds(kfomni3ds **light); - -void GetOmnilightNodeNameList3ds(database3ds *db, - namelist3ds **list); - -void GetOmnilightMotionByName3ds(database3ds *db, - char3ds *name, - kfomni3ds **kfomni); - -void GetOmnilightMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfomni3ds **kfomni); - -ulong3ds GetOmnilightNodeCount3ds(database3ds *db); - -void PutOmnilightMotion3ds(database3ds *db, - kfomni3ds *kfomni); - -void PutOmnilightMotion3ds(database3ds *db, - kfomni3ds *kfomni); - -void DeleteOmnilightMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteOmnilightMotionByName3ds(database3ds *db, char3ds *name); -void CopyOmnilightMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopyOmnilightMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -/* End Public */ -void GetOmnilightMotion3ds(chunk3ds *pOmniChunk, - kfomni3ds **kfomni); - - - - -#endif diff --git a/3rdparty/3dsftk3/src/3dsprim.c b/3rdparty/3dsftk3/src/3dsprim.c deleted file mode 100644 index e3498bb0..00000000 --- a/3rdparty/3dsftk3/src/3dsprim.c +++ /dev/null @@ -1,636 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsfile.h" -#include "swapbyte.h" -#include "3dsprim.h" - - -void WriteByte3ds(byte3ds x) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -byte3ds ReadByte3ds() -{ - byte3ds x; - - if ((GetContext3ds()->bufferposition + ByteSize3ds) > GetContext3ds()->buffersize) - SET_ERROR_RETURNR(ERR_READING_FILE, 0); - - ubyte3ds *p = (ubyte3ds *)GetContext3ds()->buffer + GetContext3ds()->bufferposition; - memcpy(&x, p, ByteSize3ds); - GetContext3ds()->bufferposition += ByteSize3ds; - - return(x); -} - -void WriteUByte3ds(ubyte3ds x) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -ubyte3ds ReadUByte3ds() -{ - ubyte3ds x; - - if ((GetContext3ds()->bufferposition + ByteSize3ds) > GetContext3ds()->buffersize) - SET_ERROR_RETURNR(ERR_READING_FILE, 0); - - ubyte3ds *p = (ubyte3ds *)GetContext3ds()->buffer + GetContext3ds()->bufferposition; - memcpy(&x, p, ByteSize3ds); - GetContext3ds()->bufferposition += ByteSize3ds; - - return(x); -} - -void WriteShort3ds(short3ds x) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -short3ds ReadShort3ds() -{ - short3ds native, intel; - - if ((GetContext3ds()->bufferposition + ShortSize3ds) > GetContext3ds()->buffersize) - SET_ERROR_RETURNR(ERR_READING_FILE, 0); - - ubyte3ds *p = (ubyte3ds *)GetContext3ds()->buffer + GetContext3ds()->bufferposition; - memcpy(&intel, p, ShortSize3ds); - GetContext3ds()->bufferposition += ShortSize3ds; - - I2NShort3ds(&intel, &native); - - return(native); -} - -void WriteUShort3ds(ushort3ds x) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -ushort3ds ReadUShort3ds() -{ - ushort3ds native, intel; - - if ((GetContext3ds()->bufferposition + ShortSize3ds) > GetContext3ds()->buffersize) - SET_ERROR_RETURNR(ERR_READING_FILE, 0); - - ubyte3ds *p = (ubyte3ds *)GetContext3ds()->buffer + GetContext3ds()->bufferposition; - memcpy(&intel, p, ShortSize3ds); - GetContext3ds()->bufferposition += ShortSize3ds; - - I2NShort3ds(&intel, &native); - - return(native); -} - -void WriteLong3ds(long3ds x) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -long3ds ReadLong3ds() -{ - long3ds native, intel; - - if ((GetContext3ds()->bufferposition + LongSize3ds) > GetContext3ds()->buffersize) - SET_ERROR_RETURNR(ERR_READING_FILE, 0); - - ubyte3ds *p = (ubyte3ds *)GetContext3ds()->buffer + GetContext3ds()->bufferposition; - memcpy(&intel, p, LongSize3ds); - GetContext3ds()->bufferposition += LongSize3ds; - - I2NLong3ds(&intel, &native); - - return(native); -} - -void WriteULong3ds(ulong3ds x) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -ulong3ds ReadULong3ds() -{ - ulong3ds native, intel; - - if ((GetContext3ds()->bufferposition + LongSize3ds) > GetContext3ds()->buffersize) - SET_ERROR_RETURNR(ERR_READING_FILE, 0); - - ubyte3ds *p = (ubyte3ds *)GetContext3ds()->buffer + GetContext3ds()->bufferposition; - memcpy(&intel, p, LongSize3ds); - GetContext3ds()->bufferposition += LongSize3ds; - - I2NLong3ds(&intel, &native); - - return(native); -} - -void WriteFloat3ds(float3ds x) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -float3ds ReadFloat3ds() -{ - float3ds native, intel; - - if ((GetContext3ds()->bufferposition + FloatSize3ds) > GetContext3ds()->buffersize) - SET_ERROR_RETURNR(ERR_READING_FILE, 0); - - ubyte3ds *p = (ubyte3ds *)GetContext3ds()->buffer + GetContext3ds()->bufferposition; - memcpy(&intel, p, FloatSize3ds); - GetContext3ds()->bufferposition += FloatSize3ds; - - I2NFloat3ds(&intel, &native); - - return(native); -} - -void WriteDouble3ds(double3ds x) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -double3ds ReadDouble3ds() -{ - double3ds native, intel; - - if ((GetContext3ds()->bufferposition + FloatSize3ds) > GetContext3ds()->buffersize) - SET_ERROR_RETURNR(ERR_READING_FILE, 0); - - ubyte3ds *p = (ubyte3ds *)GetContext3ds()->buffer + GetContext3ds()->bufferposition; - memcpy(&intel, p, FloatSize3ds); - GetContext3ds()->bufferposition += FloatSize3ds; - - I2NDouble3ds(&intel, &native); - - return(native); -} - -void WriteVoid3ds(ulong3ds size, const void *data) -{ - ulong3ds i; - for (i = 0; i < size; i++) { - WriteUByte3ds(((ubyte3ds *)data)[i]); - ON_ERROR_RETURN; - } -} - -void ReadVoid3ds(ulong3ds size, void *data) -{ - ulong3ds i; - for (i = 0; i < size; i++) - { - ((ubyte3ds *)data)[i] = ReadByte3ds(); - ON_ERROR_RETURN; - } -} - -void SkipVoid3ds(ulong3ds size) -{ - ulong3ds i; - for (i = 0; i < size; i++) - { - ReadByte3ds(); - ON_ERROR_RETURN; - } -} - -void WriteString3ds(const char3ds *s) -{ - ulong3ds i,l; - l = strlen(s); - for (i = 0; i < l; i++) WriteByte3ds(s[i]); - - WriteByte3ds(0); /* Write a null on the end of the string */ - ON_ERROR_RETURN; -} - -void WriteFixedString3ds(const char3ds *s, ulong3ds length) -{ -/* length is the length of the string space including null */ - ulong3ds i,l; - l = strlen(s); - for (i = 0; i < l; i++) - { - WriteByte3ds(s[i]); - } - for (i = l; i < length; i++) - { - WriteByte3ds(0); /* fill the remaining space with nulls */ - ON_ERROR_RETURN; - } - -} - -void ReadString3ds(char3ds *s, ulong3ds length) -{ -/* length is the length of the string space including null */ - ulong3ds i; - - s[0] = 0; - - for (i = 0; i < length; i++) - { - s[i] = ReadByte3ds(); - ON_ERROR_RETURN; - - if (s[i] == 0) break; - } - - /* check that the string wasn't too long and was null terminated */ - if((s[i] != 0) && (i == length)) - SET_ERROR_RETURN(ERR_READING_FILE); -} - -void ReadAndAllocString3ds(char3ds **s, /* the address of the pointer for the string */ - ulong3ds length /* the maximum allowable length for the string */ - ) -{ - char3ds *temp = NULL; - ulong3ds l; - - temp = malloc(sizeof(char3ds)*(length+1)); - if(temp == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - ReadString3ds(temp, length+1); - ON_ERROR_RETURN; - - l = strlen(temp); - *s = malloc(sizeof(char3ds)*(l+1)); - if (*s == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - strcpy(*s, temp); - - free(temp); - -} -void ReadAndAllocFixedString3ds(char3ds **s, /* the address of the pointer for the string */ - ulong3ds length /* the maximum allowable length for the string */ - ) -{ - char3ds *temp = NULL; - ulong3ds l; - - temp = malloc(sizeof(char3ds)*(length+1)); - if (temp == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - ReadFixedString3ds(temp, length+1); - ON_ERROR_RETURN; - - l = strlen(temp); - *s = malloc(sizeof(char3ds)*(l+1)); - if (*s == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - strcpy(*s, temp); - - free(temp); - -} - -void ReadFixedString3ds(char3ds *s, ulong3ds length) -{ -/* length is the length of the string space including null */ - ulong3ds i,l; - - s[0] = 0; - - for (i = 0; i < length; i++) - { - s[i] = ReadByte3ds(); - ON_ERROR_RETURN; - - if (s[i] == 0) break; - } - - /* check that the string wasn't too long and was null terminated */ -/* myassert((i < length) || (s[i] == 0), "ReadFixedString3ds: Bad string read"); */ - - if (s[i] != 0) - SET_ERROR_RETURN(ERR_READING_FILE); - - /* read the unused portion of the string */ - if (i < length) - { - l = strlen(s); - for (i = l+1; i < length; i++) - { - s[i] = ReadByte3ds(); - ON_ERROR_RETURN; - } - } -} - -void WriteHeader3ds(chunktag3ds chunktype, ulong3ds size) -{ - WriteUShort3ds((ushort3ds)chunktype); - ON_ERROR_RETURN; - - WriteULong3ds(size); - ON_ERROR_RETURN; - -} - -void ReadHeader3ds(chunktag3ds *chunktype, ulong3ds *size) -{ - *chunktype = ReadUShort3ds(); - ON_ERROR_RETURN; - - *size = ReadULong3ds(); - ON_ERROR_RETURN; -} - -void FinishHeader3ds(ulong3ds startpos, ulong3ds endpos) -{ - SET_ERROR_RETURN(ERR_WRITING_FILE); -} - -void WritePoint3ds(const point3ds *p) -{ - WriteFloat3ds(p->x); - ON_ERROR_RETURN; - - WriteFloat3ds(p->y); - ON_ERROR_RETURN; - - WriteFloat3ds(p->z); - ON_ERROR_RETURN; - -} - -void ReadPoint3ds(point3ds *p) -{ - memcpy(p, &DefPoint3ds, sizeof(DefPoint3ds)); - - p->x = ReadFloat3ds(); - ON_ERROR_RETURN; - - p->y = ReadFloat3ds(); - ON_ERROR_RETURN; - - p->z = ReadFloat3ds(); - ON_ERROR_RETURN; -} - -void WriteTextVert3ds(const textvert3ds *t) -{ - WriteFloat3ds(t->u); - ON_ERROR_RETURN; - - WriteFloat3ds(t->v); - ON_ERROR_RETURN; - -} - -void ReadTextVert3ds(textvert3ds *t) -{ - memcpy(t, &DefTextVert3ds, sizeof(DefTextVert3ds)); - - t->u = ReadFloat3ds(); - ON_ERROR_RETURN; - - t->v = ReadFloat3ds(); - ON_ERROR_RETURN; -} - -void WriteFace3ds(const face3ds *f) -{ - WriteUShort3ds(f->v1); - ON_ERROR_RETURN; - - WriteUShort3ds(f->v2); - ON_ERROR_RETURN; - - WriteUShort3ds(f->v3); - ON_ERROR_RETURN; - - WriteUShort3ds(f->flag); - ON_ERROR_RETURN; -} - -void ReadFace3ds(face3ds *f) -{ - memcpy(f, &DefFace3ds, sizeof(DefFace3ds)); - - f->v1 = ReadUShort3ds(); - ON_ERROR_RETURN; - - f->v2 = ReadUShort3ds(); - ON_ERROR_RETURN; - - f->v3 = ReadUShort3ds(); - ON_ERROR_RETURN; - - f->flag = ReadUShort3ds(); - ON_ERROR_RETURN; -} - -void WriteTrackHeader3ds(const trackheader3ds *t) -{ - WriteUShort3ds(t->flags); - ON_ERROR_RETURN; - - WriteULong3ds(t->nu1); - ON_ERROR_RETURN; - - WriteULong3ds(t->nu2); - ON_ERROR_RETURN; - - WriteULong3ds(t->keycount); - ON_ERROR_RETURN; -} - -void ReadTrackHeader3ds(trackheader3ds *t) -{ - memcpy(t, &DefTrackHeader3ds, sizeof(DefTrackHeader3ds)); - - t->flags = ReadUShort3ds(); - ON_ERROR_RETURN; - - t->nu1 = ReadULong3ds(); - ON_ERROR_RETURN; - - t->nu2 = ReadULong3ds(); - ON_ERROR_RETURN; - - t->keycount = ReadULong3ds(); - ON_ERROR_RETURN; -} - -void WriteKeyHeader3ds(const keyheader3ds *k) -{ - WriteULong3ds(k->time); - ON_ERROR_RETURN; - - WriteUShort3ds(k->rflags); - ON_ERROR_RETURN; - - if ((k->rflags & KeyUsesTension3ds) == KeyUsesTension3ds) - { - WriteFloat3ds(k->tension); - ON_ERROR_RETURN; - } - - if ((k->rflags & KeyUsesCont3ds) == KeyUsesCont3ds) - { - WriteFloat3ds(k->continuity); - ON_ERROR_RETURN; - } - - if ((k->rflags & KeyUsesBias3ds) == KeyUsesBias3ds) - { - WriteFloat3ds(k->bias); - ON_ERROR_RETURN; - } - - if ((k->rflags & KeyUsesEaseTo3ds) == KeyUsesEaseTo3ds) - { - WriteFloat3ds(k->easeto); - ON_ERROR_RETURN; - } - - if ((k->rflags & KeyUsesEaseFrom3ds) == KeyUsesEaseFrom3ds) - { - WriteFloat3ds(k->easefrom); - ON_ERROR_RETURN; - } -} - -void ReadKeyHeader3ds(keyheader3ds *k) -{ - memcpy(k, &DefKeyHeader3ds, sizeof(DefKeyHeader3ds)); - - k->time = ReadULong3ds(); - ON_ERROR_RETURN; - - k->rflags = ReadUShort3ds(); - ON_ERROR_RETURN; - - if ((k->rflags & KeyUsesTension3ds) == KeyUsesTension3ds) - { - k->tension = ReadFloat3ds(); - ON_ERROR_RETURN; - } - - if ((k->rflags & KeyUsesCont3ds) == KeyUsesCont3ds) - { - k->continuity = ReadFloat3ds(); - ON_ERROR_RETURN; - } - - if ((k->rflags & KeyUsesBias3ds) == KeyUsesBias3ds) - { - k->bias = ReadFloat3ds(); - ON_ERROR_RETURN; - } - - if ((k->rflags & KeyUsesEaseTo3ds) == KeyUsesEaseTo3ds) - { - k->easeto = ReadFloat3ds(); - ON_ERROR_RETURN; - } - - if ((k->rflags & KeyUsesEaseFrom3ds) == KeyUsesEaseFrom3ds) - { - k->easefrom = ReadFloat3ds(); - ON_ERROR_RETURN; - } -} - diff --git a/3rdparty/3dsftk3/src/3dsprim.h b/3rdparty/3dsftk3/src/3dsprim.h deleted file mode 100644 index d8a9b3a9..00000000 --- a/3rdparty/3dsftk3/src/3dsprim.h +++ /dev/null @@ -1,277 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef PRIM_3DS_H -#define PRIM_3DS_H - -#include "3dstype.h" -#include "chunkinf.h" - -/* Public Defines */ -/* 3DS File Toolkit revision level. Future revisions will increment this - integer number */ -#define FTKRevisionLevel3ds 2 - -/* End Public */ - - -/* Public Typedefs */ - -/*---------------------------------------- - Commonly used structures and constants - --------------------------------------*/ - -/* Constants to define True and False in a compiler independant way. */ -#define TRUE3DS (1==1) -#define FALSE3DS (1!=1) -static const byte3ds True3ds = (1==1); -static const byte3ds False3ds = (1!=1); - -/* point3ds - 3D point structure */ -typedef struct -{ - float3ds x, y, z; -} point3ds; - -/* fcolor3ds - Floating point color definition */ -typedef struct { - float3ds r; /* RGB Color components */ - float3ds g; - float3ds b; -} fcolor3ds; - -/* face3ds - Face list element */ -typedef struct -{ - ushort3ds v1, v2, v3, flag; -} face3ds; - -/* textvert3ds - Texture assignment coordinate */ -typedef struct -{ - float3ds u, v; -} textvert3ds; -/* End Public */ - -/* Private Typedefs */ -/* trackheader3ds - Global track settings */ -typedef struct -{ - ushort3ds flags; - ulong3ds nu1, nu2; - ulong3ds keycount; /* Number of keys in the track */ -} trackheader3ds; -/* End Private */ - -/* Public Typedefs */ - -/* keyheader3ds - Animation key settings */ -typedef struct -{ - ulong3ds time; /* Key's frame position */ - ushort3ds rflags; /* Spline terms used flag */ - float3ds tension; /* Flagged with 0x01 */ - float3ds continuity; /* Flagged with 0x02 */ - float3ds bias; /* Flagged with 0x04 */ - float3ds easeto; /* Flagged with 0x08 */ - float3ds easefrom; /* Flagged with 0x10 */ -} keyheader3ds; - -/* kfrotkey3ds - Rotation key */ -typedef struct { - float3ds angle; /* angle of rotation */ - float3ds x; /* rotation axis vector */ - float3ds y; - float3ds z; -} kfrotkey3ds; - -/* kfmorphkey3ds - Object morph key */ -typedef struct { - char3ds name[13]; /* name of target morph object */ -} kfmorphkey3ds; - -/* End Public */ - -/* Public Consts */ - -/*---------------------------------------- - Constants for commonly used structures - --------------------------------------*/ - -/* 3DS File Toolkit revision level. Future revisions will increment this - integer number */ -static const long3ds __FTKRevisionLevel3ds = FTKRevisionLevel3ds; - -/* Flags used by the flag field of the mesh3ds structure */ -static const ushort3ds FaceCAVisable3ds = 0x0001; /* Flags the CA edge as visable */ -static const ushort3ds FaceBCVisable3ds = 0x0002; /* Flags the BC edge as visable */ -static const ushort3ds FaceABVisable3ds = 0x0004; /* Flags the AB edge as visable */ -static const ushort3ds FaceUWrap3ds = 0x0008; /* Flags the face as being at - a texture coord u wrap - seam */ -static const ushort3ds FaceVWrap3ds = 0x0010; /* Flags the face as being at - a texture coord v wrap - seam */ - -/* Flags used by the rflags field of the keyheader3ds structure */ -static const ushort3ds KeyUsesTension3ds = 0x01; -static const ushort3ds KeyUsesCont3ds = 0x02; -static const ushort3ds KeyUsesBias3ds = 0x04; -static const ushort3ds KeyUsesEaseTo3ds = 0x08; -static const ushort3ds KeyUsesEaseFrom3ds= 0x10; - -/* Flags used by the track flags field */ -static const ushort3ds TrackSingle3ds = 0x0000; -static const ushort3ds TrackLoops3ds = 0x0003; -static const ushort3ds TrackRepeats3ds = 0x0002; -static const ushort3ds TrackLockX3ds = 0x0008; -static const ushort3ds TrackLockY3ds = 0x0010; -static const ushort3ds TrackLockZ3ds = 0x0020; -static const ushort3ds TrackNoLinkX3ds = 0x0100; -static const ushort3ds TrackNoLinkY3ds = 0x0200; -static const ushort3ds TrackNoLinkZ3ds = 0x0400; - -/* Basic structure default contents for ease of initialization */ -static const point3ds DefPoint3ds = {0.0F, 0.0F, 0.0F}; -static const textvert3ds DefTextVert3ds = {0.0F, 0.0F}; -static const face3ds DefFace3ds = {0, 1, 2, 0}; -static const trackheader3ds DefTrackHeader3ds = {0, 0, 0, 1}; -static const keyheader3ds DefKeyHeader3ds = {0, 0, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; -/* End Public */ - -static const int ByteSize3ds = 1; -static const int ShortSize3ds = 2; -static const int LongSize3ds = 4; -static const int FloatSize3ds = 4; -static const int DoubleSize3ds = 8; -static const int PointSize3ds = 12; -static const int TextVertSize3ds = 8; -static const int FaceSize3ds = 8; -static const int HeaderSize3ds = 6; -static const int TrackHeaderSize3ds = 14; - -void WriteByte3ds(byte3ds x); -byte3ds ReadByte3ds(); -void WriteUByte3ds(ubyte3ds x); -ubyte3ds ReadUByte3ds(); -void WriteShort3ds(short3ds x); -short3ds ReadShort3ds(); -void WriteUShort3ds(ushort3ds x); -ushort3ds ReadUShort3ds(); -void WriteLong3ds(long3ds x); -long3ds ReadLong3ds(); -void WriteULong3ds(ulong3ds x); -ulong3ds ReadULong3ds(); -void WriteFloat3ds(float3ds x); -float3ds ReadFloat3ds(); -void WriteDouble3ds(double3ds x); -double3ds ReadDouble3ds(); -void WriteVoid3ds(ulong3ds size, const void *data); -void ReadVoid3ds(ulong3ds size, void *data); -void SkipVoid3ds(ulong3ds size); -void WriteString3ds(const char3ds *s); -void WriteFixedString3ds(const char3ds *s, ulong3ds length); -void ReadString3ds(char3ds *s, ulong3ds length); -void ReadAndAllocString3ds(char3ds **s, ulong3ds length); -void ReadAndAllocFixedString3ds(char3ds **s, ulong3ds length); -void ReadFixedString3ds(char3ds *s, ulong3ds length); -void WriteHeader3ds(chunktag3ds chunktype, ulong3ds size); -void ReadHeader3ds(chunktag3ds *chunktype, ulong3ds *size); -void FinishHeader3ds(ulong3ds startpos, ulong3ds endpos); -void WritePoint3ds(const point3ds *p); -void ReadPoint3ds(point3ds *p); -void WriteTextVert3ds(const textvert3ds *t); -void ReadTextVert3ds(textvert3ds *t); -void WriteFace3ds(const face3ds *f); -void ReadFace3ds(face3ds *f); -void WriteTrackHeader3ds(const trackheader3ds *t); -void ReadTrackHeader3ds(trackheader3ds *t); -void WriteKeyHeader3ds(const keyheader3ds *k); -void ReadKeyHeader3ds(keyheader3ds *k); - - -#endif - diff --git a/3rdparty/3dsftk3/src/3dsrange.h b/3rdparty/3dsftk3/src/3dsrange.h deleted file mode 100644 index ce94c661..00000000 --- a/3rdparty/3dsftk3/src/3dsrange.h +++ /dev/null @@ -1,245 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/* a list of constants that define various value ranges for specific chunks */ - -#ifndef RANGE_3DS_H -#define RANGE_3DS_H - - -/* 3DS filename */ -#define FileNameStrMax3ds 512 - -/* 3DS file attributes */ -#define FileAttrStrMax3ds 128 - -/* MASTER_SCALE chunk */ -#define MasterScaleMin3ds 0.0 /* Noninclusive minimum value for master scale */ - -/* LO_SHADOW_BIAS chunk */ -#define LoShadowBiasMin3ds 0.0 /* Noninclusive minimum value for low shadow bias setting */ - -/* HI_SHADOW_BIAS chunk */ -#define HiShadowBiasMin3ds 0.0 /* Noninclusive minimum value for high shadow bias setting */ - -/* SHADOW_MAP_SIZE chunk */ -#define ShadowMapSizeMin3ds 0 /* Noninclusive minimum value for shadow map size */ - -/* SHADOW_SAMPLES chunk */ -#define ShadowSamplesMin3ds 0 /* Noninclusive minimum value for shadow samples */ - -/* SHADOW_RANGE chunk */ -#define ShadowRangeMin3ds 0 /* Noninclusive minimum value for shadow range */ - -/* SHADOW_FILTER chunk */ -#define ShadowFilterMin3ds 1.0 /* Inclusive minimum value for shadow filter */ -#define ShadowFilterMax3ds 10.0 /* Inclusive maximum value for shadow filter */ - -/* BITMAP chunk */ -#define BitMapStrMax3ds 12 /* maximum string length for filename */ - -/* V_GRADIENT chunk */ -#define VGradientMin3ds 0.0 /* minimum value for gradient midpoint */ -#define VGradientMax3ds 1.0 /* maximum value for gradient midpoint */ - -/* FOG chunk */ -#define FogMin3ds 0.0 /* minimum value for fogging plane density */ -#define FogMax3ds 1.0 /* maximum value for fogging plane density */ - -/* DISTANCE_CUE */ -#define DistanceCueMin3ds 0.0 /* minimum value for dimming factor */ -#define DistanceCueMax3ds 1.0 /* maximum value for dimming factor */ - -/* VIEW_CAMERA */ -#define ViewCameraStrMax3ds 10 /* maximum string length for filename */ - -/* MAT_NAME */ -#define MatNameStrMax3ds 16 /* maximum string length for material name */ - -/* MAT_SHADING */ -#define MatShadingMin3ds 0 /* minimum shading value */ -#define MatShadingMax3ds 3 /* maximum shading value */ - -/* MAT_ACUBIC_FMIN */ -#define MatACubicFMin3ds 1 /* minimum frame skip count */ -#define MatACubicAMin3ds 0 /* minimum reflection map aliasing */ -#define MatACubicAMax3ds 3 /* maximum reflection map aliasing */ - -/* POINT_ARRAY */ -#define PointArrayMin3ds 3 /* minimum number of vertices */ - -/* FACE_ARRAY */ -#define FaceArrayMin3ds 1 /* minimum number of faces */ - -/* MshMatGroup3ds */ -#define MshMatGroupMin3ds 1 /* minimum number of faces per material */ -#define MshMatGroupStrMax3ds 16 /* maximim string length for MshMatGroup */ - -/* PROC_NAME */ -#define ProcNameStrMax3ds 12 /* maximum string length for axp process */ - -/* DL_SPOTLIGHT */ -#define DLSpotlightMin3ds 0.0 /* minimum for hotspot and falloff cones */ -#define DLSpotlightMax3ds 160.0 /* maximum for hotspot and falloff cones */ - -/* DL_LOCAL_SHADOW2 */ -#define DLLocalShadow2SMin3ds 10 /* minimum shadow map size */ -#define DLLocalShadow2SMax3ds 4096 /* maximum shadow map size */ -#define DLLocalShadow2FMin3ds 1.0 /* minimum shadow map size */ -#define DLLocalShadow2FMax3ds 10.0 /* maximum shadow map size */ - -/* COLOR_F */ -#define ColorFMin3ds 0.0 /* minimum color value in a channel */ -#define ColorFMax3ds 1.0 /* maximum color value in a channel */ - -/* INT_PERCENTAGE */ -#define IntPercentageMax3ds 100 /* Maximum integer percentage */ - -/* FLOAT_PERCENTAGE */ -#define FloatPercentageMax3ds 1.0 /* Maximum floating point percentage */ - -/* MAT_MAPNAME */ -#define MatMapNameStrMax3ds 12 /* Maximum map name string size */ - -/* NAMED_OBJECT */ -#define NamedObjectStrMax3ds 10 /* Maximum named object string size */ - -/* N_CAMERA */ -#define NCameraFOVMin3ds 0.00025 /* Minimum field of view for camera */ -#define NCameraFOVMax3ds 160.0 /* Maximum field of view for camera */ -#define NCameraFocMin3ds 10.7813 /* Minimum lens size for camera */ -#define NCameraFocMax3ds 10000000 /* Maximum lens size for camera */ - -/* KFHDR */ -#define KFHdrStrMax3ds 12 /* Maximum keyframe header name string size */ - -/* NODE_HDR */ -#define NodeHdrStrMax3ds 10 /* Maximum node name string size */ - -/* INSTANCE_NAME */ -#define InstanceNameStrMax3ds 10 /* Maximum instance name string size */ - -/* MORPH_TRACK */ -#define MorphTrackStrMax3ds 10 /* Maximum morph object name string size */ - -/* MORPH_SMOOTH */ -#define MorphSmoothMin3ds 0.0 /* Minimum morph smoothing angle */ -#define MorphSmoothMax3ds 360.0 /* Maximum morph smoothing angle */ - -/* Keyframe Spline Limits */ -#define KFTensionMin3ds -1.0 /* Minimum key spline tension */ -#define KFTensionMax3ds 1.0 /* Maximum key spline tension */ -#define KFContinuityMin3ds -1.0 /* Minimum key spline continuity */ -#define KFContinuityMax3ds 1.0 /* Maximum key spline continuity */ -#define KFBiasMin3ds -1.0 /* Minimum key spline bias */ -#define KFBiasMax3ds 1.0 /* Maximum key spline bias */ -#define KFEaseToMin3ds 0.0 /* Minimum key spline ease to */ -#define KFEaseToMax3ds 1.0 /* Maximum key spline ease to */ -#define KFEaseFromMin3ds 0.0 /* Minimum key spline ease from */ -#define KFEaseFromMax3ds 1.0 /* Maximum key spline ease from */ - -/* Track header Limits */ -#define TrackHeaderKeysMin3ds 1 /* Minimum number of keys in a track */ - -/* COL_TRACK_TAG_KEY */ -#define ColTrackTagMin3ds 0.0 /* Minimum color value */ -#define ColTrackTagMax3ds 1.0 /* Maximum color value */ - -/* FOV_TRACK_TAG_KEY */ -#define FOVTrackTagMin3ds NCameraFOVMin3ds /* Minimum camera FOV */ -#define FOVTrackTagMax3ds NCameraFOVMax3ds /* Maximum camera FOV */ - -/* HOT_TRACK_TAG_KEY */ -#define HotTrackTagMin3ds 0.0 /* Minimum hot spot angle */ -#define HotTrackTagMax3ds 160.0 /* Maximum hot spot angle */ - -/* FALL_TRACK_TAG_KEY */ -#define FallTrackTagMin3ds 0.0 /* Minimum fall off angle */ -#define FallTrackTagMax3ds 160.0 /* Maximum fall off angle */ - -/* End Public */ - -#endif diff --git a/3rdparty/3dsftk3/src/3dsrobj.c b/3rdparty/3dsftk3/src/3dsrobj.c deleted file mode 100644 index 1d9a1759..00000000 --- a/3rdparty/3dsftk3/src/3dsrobj.c +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsmobj.h" -#include "3dsrobj.h" - -void RelMeshObjField3ds(mesh3ds *obj, ushort3ds field) -{ - ulong3ds i; - - assert(obj != NULL); - - if ((field & RelVertexArray3ds) == RelVertexArray3ds) - { - if (obj->vertexarray != NULL) - {free(obj->vertexarray); obj->vertexarray = NULL;} - } - if ((field & RelTextArray3ds) == RelTextArray3ds) - { - if (obj->textarray != NULL) - {free(obj->textarray); obj->textarray = NULL;} - } - if ((field & RelFaceArray3ds) == RelFaceArray3ds) - { - if (obj->facearray != NULL) - {free(obj->facearray); obj->facearray = NULL;} - } - if ((field & RelMatArray3ds) == RelMatArray3ds) - { - if (obj->matarray != NULL) - { - for (i = 0; i < obj->nmats; i++) - { - if (obj->matarray[i].faceindex != NULL) - {free(obj->matarray[i].faceindex); obj->matarray[i].faceindex = NULL;} - } - free(obj->matarray); (obj->matarray = NULL); - - } - } - if ((field & RelSmoothArray3ds) == RelSmoothArray3ds) - { - if (obj->smootharray != NULL) - {free(obj->smootharray); obj->smootharray = NULL;} - } - if ((field & RelProcData3ds) == RelProcData3ds) - { - if (obj->procdata != NULL) - {free(obj->procdata); obj->procdata = NULL;} - } - - if ((field & RelVFlagArray3ds) == RelVFlagArray3ds) - { - if (obj->vflagarray != NULL) - { - free(obj->vflagarray); obj->vflagarray = NULL; - } - } - -} - -void RelMeshObj3ds(mesh3ds **obj) -{ - if ((obj != NULL) && (*obj != NULL)) - { - RelMeshObjField3ds(*obj, RelVertexArray3ds); - RelMeshObjField3ds(*obj, RelTextArray3ds); - RelMeshObjField3ds(*obj, RelFaceArray3ds); - RelMeshObjField3ds(*obj, RelMatArray3ds); - RelMeshObjField3ds(*obj, RelSmoothArray3ds); - RelMeshObjField3ds(*obj, RelProcData3ds); - RelMeshObjField3ds(*obj, RelVFlagArray3ds); - - free(*obj); - } - - *obj = NULL; - -} - diff --git a/3rdparty/3dsftk3/src/3dsrobj.h b/3rdparty/3dsftk3/src/3dsrobj.h deleted file mode 100644 index 27564f91..00000000 --- a/3rdparty/3dsftk3/src/3dsrobj.h +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef ROBJ_3DS_H -#define ROBJ_3DS_H - -/* Field codes for RelMeshObjField3ds */ -static const ushort3ds RelVertexArray3ds = 0x0001; -static const ushort3ds RelTextArray3ds = 0x0002; -static const ushort3ds RelFaceArray3ds = 0x0004; -static const ushort3ds RelMatArray3ds = 0x0008; -static const ushort3ds RelSmoothArray3ds = 0x0010; -static const ushort3ds RelProcData3ds = 0x0020; -static const ushort3ds RelVFlagArray3ds = 0x0040; - -void RelMeshObjField3ds(mesh3ds *obj, ushort3ds field); - -/* Public Prototypes */ -void RelMeshObj3ds(mesh3ds **obj); -/* End Public */ - -#endif - - - diff --git a/3rdparty/3dsftk3/src/3dssptm.c b/3rdparty/3dsftk3/src/3dssptm.c deleted file mode 100644 index 4e8023fa..00000000 --- a/3rdparty/3dsftk3/src/3dssptm.c +++ /dev/null @@ -1,944 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - - -#include -#include - -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dssptm.h" -#include "kfutils.h" - - -/*----------------------------------------------------------------------------- - | InitSpotlightMotion3ds - | Needs: - | -check default values -esp. color -sjw - +---------------------------------------------------------------------------*/ -void InitSpotlightMotion3ds(kfspot3ds **spot, - ulong3ds npkeys, /* Number of position keys */ - ulong3ds nckeys, /* Number of color keys */ - ulong3ds nhkeys, /* Number of hot spot angle keys */ - ulong3ds nfkeys, /* Number of falloff angle keys */ - ulong3ds nrkeys, /* Number of roll keys */ - ulong3ds ntkeys) /* Number of target position keys */ -{ - ulong3ds i; - - if (*spot == NULL) - { - (*spot) = malloc(sizeof(kfspot3ds)); - if (*spot == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - (*spot)->name[0] = 0; - (*spot)->parent[0] = 0; - (*spot)->tparent[0] = 0; - (*spot)->flags1 = (*spot)->flags2 = (ushort3ds)0; - (*spot)->tflags1 = (*spot)->tflags2 = (ushort3ds)0; - - (*spot)->npkeys = npkeys; - (*spot)->nckeys = nckeys; - (*spot)->nfkeys = nfkeys; - (*spot)->ntkeys = ntkeys; - (*spot)->nhkeys = nhkeys; - (*spot)->nrkeys = nrkeys; - - (*spot)->pkeys = NULL; - (*spot)->ckeys = NULL; - (*spot)->hkeys = NULL; - (*spot)->fkeys = NULL; - (*spot)->tkeys = NULL; - (*spot)->rkeys = NULL; - - - (*spot)->pos = NULL; - (*spot)->color = NULL; - (*spot)->hot = NULL; - (*spot)->fall = NULL; - (*spot)->tpos = NULL; - (*spot)->roll = NULL; - } - - /*--- POSITION KEYS -----------------------------------------------------*/ - if (npkeys != 0) - { - (*spot)->npflag = TrackSingle3ds; /* sjw: Is this valid? */ - (*spot)->npkeys = npkeys; - - /*--- free old keys if they exist */ - if ((*spot)->pkeys != NULL) { - free((*spot)->pkeys); - (*spot)->pkeys = NULL; - } - - /*--- free old positions if they exist */ - if ((*spot)->pos != NULL) { - free((*spot)->pos); - (*spot)->pos = NULL; - } - - /*--- alloc new keys */ - (*spot)->pkeys = calloc((*spot)->npkeys, sizeof(keyheader3ds)); - if((*spot)->pkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - /*--- initialize with default header/spline */ - for (i = 0; i < (*spot)->npkeys; i++) - memcpy(&(((*spot)->pkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - /*--- alloc new positions */ - (*spot)->pos = calloc((*spot)->npkeys, sizeof(point3ds)); - if((*spot)->pos == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - /*--- initialize with default position */ - for (i = 0; i < (*spot)->npkeys; i++) - memcpy(&(((*spot)->pos)[i]), &DefPoint3ds, sizeof(DefPoint3ds)); - } - - /*--- COLOR KEYS ----------------------------------------------------------*/ - if (nckeys != 0) - { - (*spot)->ncflag = TrackSingle3ds; /* sjw: Is this valid? */ - (*spot)->nckeys = nckeys; - - /*--- free old color keys */ - if ((*spot)->ckeys != NULL) { - free((*spot)->ckeys); - (*spot)->ckeys = NULL; - } - - /*--- free old colors */ - if ((*spot)->color != NULL) { - free((*spot)->color); - (*spot)->color = NULL; - } - - /*--- alloc new color keys */ - (*spot)->ckeys = calloc((*spot)->nckeys, sizeof(keyheader3ds)); - if((*spot)->ckeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - /*--- initialize to default values */ - for (i = 0; i < (*spot)->nckeys; i++) - memcpy(&(((*spot)->ckeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - /*--- alloc new colors */ - (*spot)->color = calloc((*spot)->nckeys, sizeof(fcolor3ds)); - if((*spot)->color == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - /*--- Where to get default color? -sjw*/ -#ifdef LATER - for (i = 0; i < (*spot)->nckeys; i++) - memcpy(&(((*spot)->color)[i]), - &localDColor.bDefFColor3ds, - sizeof(DefFColor3ds)); -#endif - } - - /*---HOT-SPOT ANGLE KEYS---------------------------------------------------*/ - if (nhkeys != 0) - { - (*spot)->nhflag = TrackSingle3ds; /* sjw: Is this valid? */ - (*spot)->nhkeys = nhkeys; - - /*--- free old color keys */ - if ((*spot)->hkeys != NULL) { - free((*spot)->hkeys); - (*spot)->hkeys = NULL; - } - - /*--- free old data */ - if ((*spot)->hot != NULL) { - free((*spot)->hot); - (*spot)->hot = NULL; - } - - /*--- alloc new hot keys */ - (*spot)->hkeys = calloc((*spot)->nhkeys, sizeof(keyheader3ds)); - if((*spot)->hkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - /*--- initialize to default values */ - for (i = 0; i < (*spot)->nhkeys; i++) - memcpy(&(((*spot)->hkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - /*--- alloc new hots */ - (*spot)->hot = calloc((*spot)->nhkeys, sizeof(float3ds)); - if((*spot)->hot == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - /* default hot spot ange 90.0 for now, get real value later (1..174.5) */ - for (i = 0; i < (*spot)->nhkeys; i++) - ((*spot)->hot)[i] = (float3ds)90.0; - } - - - /*---FALLOFF ANGLE KEYS----------------------------------------------------*/ - if (nfkeys != 0) - { - (*spot)->nfflag = TrackSingle3ds; /* sjw: Is this valid? */ - (*spot)->nfkeys = nfkeys; - - /*--- free old color keys */ - if ((*spot)->fkeys != NULL) { - free((*spot)->fkeys); - (*spot)->fkeys = NULL; - } - - /*--- free old data */ - if ((*spot)->fall != NULL) { - free((*spot)->fall); - (*spot)->fall = NULL; - } - - /*--- alloc new fall keys */ - (*spot)->fkeys = calloc((*spot)->nfkeys, sizeof(keyheader3ds)); - if((*spot)->fkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - /*--- initialize to default values */ - for (i = 0; i < (*spot)->nfkeys; i++) - memcpy(&(((*spot)->fkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - /*--- alloc new falls */ - (*spot)->fall = calloc((*spot)->nfkeys, sizeof(float3ds)); - if((*spot)->fall == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - /* default falloff ange 90.0 for now, get real value later (1..175) */ - for (i = 0; i < (*spot)->nfkeys; i++) - ((*spot)->fall)[i] = (float3ds)90.0; - } - - /*--- ROLL KEYS ----------------------------------------------------------*/ - - if (nrkeys != 0) - { - (*spot)->nrflag = TrackSingle3ds; - - (*spot)->nrkeys = nrkeys; - if ((*spot)->rkeys != NULL) {free((*spot)->rkeys); (*spot)->rkeys = NULL;} - if ((*spot)->roll != NULL) {free((*spot)->roll); (*spot)->roll = NULL;} - - (*spot)->rkeys = calloc((*spot)->nrkeys, sizeof(keyheader3ds)); - if((*spot)->rkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - for (i = 0; i < (*spot)->nrkeys; i++) - memcpy(&(((*spot)->rkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - (*spot)->roll = calloc((*spot)->nrkeys, sizeof(float3ds)); - if((*spot)->roll == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - for (i = 0; i < (*spot)->nrkeys; i++) - ((*spot)->roll)[i] = (float3ds)0.0; - } - - /*---L_TARGET POS KEYS ------------------------------------------------*/ - if (ntkeys != 0) - { - (*spot)->ntflag = TrackSingle3ds; - (*spot)->ntkeys = ntkeys; - - /*--- free old keys */ - if ((*spot)->tkeys != NULL) { - free((*spot)->tkeys); - (*spot)->tkeys = NULL; - } - - /*--- free old data */ - if ((*spot)->tpos != NULL) { - free((*spot)->tpos); - (*spot)->tpos = NULL; - } - - /*--- alloc new tpos keys */ - (*spot)->tkeys = calloc((*spot)->ntkeys, sizeof(keyheader3ds)); - if((*spot)->tkeys == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - /*--- initialize to default values */ - for (i = 0; i < (*spot)->ntkeys; i++) - memcpy(&(((*spot)->tkeys)[i]), - &DefKeyHeader3ds, - sizeof(DefKeyHeader3ds)); - - /*--- alloc new positions */ - (*spot)->tpos = calloc((*spot)->ntkeys, sizeof(point3ds)); - if((*spot)->tpos == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - - /* default target position, 0,0,0 sjw fix later if necessary */ - for (i = 0; i < (*spot)->ntkeys; i++) - memcpy(&(((*spot)->tpos)[i]), &DefPoint3ds, sizeof(DefPoint3ds)); - } -} - -/*-------------------------------------------------------- - | - | ReleaseSpotlightMotion3ds - | - +--------------------------------------------------------*/ -void ReleaseSpotlightMotion3ds(kfspot3ds **spot) -{ - if (*spot != NULL) { - /*--- POSITION */ - if((*spot)->pkeys != NULL) - free((*spot)->pkeys); - if((*spot)->pos != NULL) - free((*spot)->pos); - /*--- HOTSPOT */ - if((*spot)->hkeys != NULL) - free((*spot)->hkeys); - if((*spot)->hot != NULL) - free((*spot)->hot); - /*--- FALLOFF */ - if((*spot)->fkeys != NULL) - free((*spot)->fkeys); - if((*spot)->fall != NULL) - free((*spot)->fall); - /*---L_TARGET */ - if((*spot)->tkeys != NULL) - free((*spot)->tkeys); - if((*spot)->tpos != NULL) - free((*spot)->tpos); - /*---ROLL */ - if((*spot)->rkeys != NULL) - free((*spot)->rkeys); - if((*spot)->roll != NULL) - free((*spot)->roll); - /*---COLOR */ - if((*spot)->ckeys != NULL) - free((*spot)->ckeys); - if((*spot)->color != NULL) - free((*spot)->color); - free(*spot); - *spot = NULL; - } -} - -/*-------------------------------------------------------------------- - | - | GetSpotlightNodeCount3ds - | - +--------------------------------------------------------------------*/ -ulong3ds GetSpotlightNodeCount3ds(database3ds *db) -{ - return kfGetGenericNodeCount(db, SPOTLIGHT_NODE_TAG); -} - -/*-------------------------------------------------------------------- - | - | GetSpotlightNodeNameList3ds - | - +--------------------------------------------------------------------*/ -void GetSpotlightNodeNameList3ds(database3ds *db, namelist3ds **list) -{ - kfGetGenericNodeNameList(db, SPOTLIGHT_NODE_TAG, list); -} - - -/*---------------------------------------------------------------------- - | - | GetSpotlightMotionByName3ds - | - | db: database to be searched - | name: name of spotlight - | kfspot: Ptr to the addr of kfspot3ds structure, if (*kfspot) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfspot remains unchanged. - | - +----------------------------------------------------------------------*/ -void GetSpotlightMotionByName3ds(database3ds *db, - char3ds *name, - kfspot3ds **kfspot) -{ - chunk3ds *pSpotlightChunk, *pTargetChunk; - - if ((db == NULL) || (name == NULL)) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != M3DMAGIC) && (db->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - - kfFindNamedAndTaggedChunk(db, name, SPOTLIGHT_NODE_TAG, &pSpotlightChunk); - - if (pSpotlightChunk) - kfFindNamedAndTaggedChunk(db, name, L_TARGET_NODE_TAG, &pTargetChunk); - - if (pSpotlightChunk) - GetSpotlightMotion3ds(pSpotlightChunk, pTargetChunk, kfspot); - -} - -/*---------------------------------------------------------------------- - | - | GetSpotlightMotionByIndex3ds - | - | db: database to be searched - | index: index of Spotlight in name list - | kfspot: Ptr to the addr of kfspot3ds structure, if (*kfspot) - | is null, then memory will be allocated for the new - | structure, otherwise, the existing structure will be - | filled in with the new values. If no match is found, then - | kfspot remains unchanged. - | - +----------------------------------------------------------------------*/ -void GetSpotlightMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfspot3ds **kfspot) -{ - chunk3ds *pSpotChunk, *pTargetChunk; - namelist3ds *list = NULL; - char3ds *name; - - if(db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - GetSpotlightNodeNameList3ds(db, &list); - - if(index < list->count){ - name = list->list[index].name; - kfFindNamedAndTaggedChunk(db, name, SPOTLIGHT_NODE_TAG, &pSpotChunk); - - if (pSpotChunk){ - kfFindNamedAndTaggedChunk(db, name, L_TARGET_NODE_TAG, &pTargetChunk); - if (pTargetChunk) - GetSpotlightMotion3ds(pSpotChunk, pTargetChunk, kfspot); - } - } - - /*--- release list when done using name */ - ReleaseNameList3ds(&list); -} - -/*-------------------------------------------------------------------------- - | GetSpotlightMotion3ds - | - | pSpotChunk:SPOTLIGHT_NODE_TAG chunk to extract data from - | pTargetChunk: L_TARGET_NODE_TAG chunk to extract target data from - | kfspot: Structure to fill in with chunk data - | - | chunk----->kfSpot3ds - | - | Gets Spotlight keyframe information from chunk - | - | L_TARGET - | ... - | NODE_HDR - | APP_DATA - | POS_TRACK - | COL_TRACK - | HOT_TRACK - | FALL_TRACK - | ROLL_TRACK - | - +--------------------------------------------------------------------------*/ -void GetSpotlightMotion3ds(chunk3ds *pSpotChunk, - chunk3ds *pTargetChunk, - kfspot3ds **kfspot) -{ - kfspot3ds - *pKfSpot; - chunk3ds - *pNodeHdrChunk, *pPosChunk, *pColChunk, *pTargetPosChunk = NULL, - *pHotChunk, *pFallChunk, *pRollChunk, *pTargetHdrChunk = NULL; - ulong3ds i, - nPosKeys = 0, - nColKeys = 0, - nHotKeys = 0, - nFallKeys = 0, - nRollKeys = 0, - nTargetKeys = 0; - NodeHdr - *pNodeHdr = NULL, *pTargetHdr = NULL; - PosTrackTag - *pPosData = NULL, *pTargetData = NULL; - ColTrackTag - *pColData = NULL; - HotTrackTag - *pHotData = NULL; - FallTrackTag - *pFallData = NULL; - RollTrackTag - *pRollData = NULL; - - if(pSpotChunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /*------------------------------- - | Get information from chunks - +-------------------------------*/ - /*--- Search children of Spotlight chunk */ - FindChunk3ds(pSpotChunk, NODE_HDR, &pNodeHdrChunk); - FindChunk3ds(pSpotChunk, POS_TRACK_TAG, &pPosChunk); - FindChunk3ds(pSpotChunk, COL_TRACK_TAG, &pColChunk); - FindChunk3ds(pSpotChunk, HOT_TRACK_TAG, &pHotChunk); - FindChunk3ds(pSpotChunk, FALL_TRACK_TAG, &pFallChunk); - FindChunk3ds(pSpotChunk, ROLL_TRACK_TAG, &pRollChunk); - - ReadChunkData3ds(pNodeHdrChunk); - pNodeHdr = pNodeHdrChunk->data; - - if(pPosChunk){ - ReadChunkData3ds(pPosChunk); - pPosData = pPosChunk->data; - nPosKeys = pPosData->trackhdr.keycount; - } - - if(pColChunk){ - ReadChunkData3ds(pColChunk); - pColData = pColChunk->data; - nColKeys = pColData->trackhdr.keycount; - } - - if(pHotChunk){ - ReadChunkData3ds(pHotChunk); - pHotData = pHotChunk->data; - nHotKeys = pHotData->trackhdr.keycount; - } - - if(pFallChunk){ - ReadChunkData3ds(pFallChunk); - pFallData = pFallChunk->data; - nFallKeys = pFallData->trackhdr.keycount; - } - - if(pRollChunk){ - ReadChunkData3ds(pRollChunk); - pRollData = pRollChunk->data; - nRollKeys = pRollData->trackhdr.keycount; - } - - if (pTargetChunk){ - FindChunk3ds(pTargetChunk, NODE_HDR, &pTargetHdrChunk); - if (pTargetHdrChunk){ - ReadChunkData3ds(pTargetHdrChunk); - pTargetHdr = pTargetHdrChunk->data; - } - - FindChunk3ds(pTargetChunk, POS_TRACK_TAG, &pTargetPosChunk); - if (pTargetPosChunk){ - ReadChunkData3ds(pTargetPosChunk); - pTargetData = pTargetPosChunk->data; - nTargetKeys = pTargetData->trackhdr.keycount; - } - else - pTargetData = NULL; - } - - /*-------------------------------------------- - | Set-up and fill-in the kfspot3ds structure - +--------------------------------------------*/ - InitSpotlightMotion3ds(kfspot, - nPosKeys, - nColKeys, - nHotKeys, - nFallKeys, - nRollKeys, - nTargetKeys); - - pKfSpot = *kfspot; - - /*--- Header Information */ - strcpy(pKfSpot->name, pNodeHdr->objname); - pKfSpot->flags1 = pNodeHdr->flags1; - pKfSpot->flags2 = pNodeHdr->flags2; - - /*--- Get Parent Name if there is one */ - kfGetParentName(pNodeHdrChunk, pKfSpot->parent); - kfGetParentName(pTargetHdrChunk, pKfSpot->tparent); - - if (pTargetHdr){ - pKfSpot->tflags1 = pTargetHdr->flags1; - pKfSpot->tflags2 = pTargetHdr->flags2; - } - else - pKfSpot->tflags1 = pKfSpot->tflags2 = (short3ds)0; - - /*--- Target Information */ - if (nTargetKeys){ - pKfSpot->ntflag = pTargetData->trackhdr.flags; - for(i=0; itkeys)[i]), - &((pTargetData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfSpot->tpos)[i]), - &((pTargetData->positionlist)[i]), - sizeof(point3ds)); - } - } - - /*--- Position Information */ - if (nPosKeys){ - pKfSpot->npflag = pPosData->trackhdr.flags; - for (i=0; ipkeys)[i]), - &((pPosData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfSpot->pos)[i]), - &((pPosData->positionlist)[i]), - sizeof(point3ds)); - } - } - - /*--- Color Information */ - if (nColKeys){ - pKfSpot->ncflag = pColData->trackhdr.flags; - for (i=0; ickeys)[i]), - &((pColData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfSpot->color)[i]), - &((pColData->colorlist)[i]), - sizeof(fcolor3ds)); - } - } - - /*--- Hot Spot Information */ - if (nHotKeys){ - pKfSpot->nhflag = pHotData->trackhdr.flags; - for (i=0; ihkeys)[i]), - &((pHotData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfSpot->hot)[i]), - &((pHotData->hotspotanglelist)[i]), - sizeof(float3ds)); - } - } - - /*--- Falloff Information */ - if (nFallKeys){ - pKfSpot->nfflag = pFallData->trackhdr.flags; - for (i=0; ifkeys)[i]), - &((pFallData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfSpot->fall)[i]), - &((pFallData->falloffanglelist)[i]), - sizeof(float3ds)); - } - } - - /*--- Roll Track Information */ - if (nRollKeys){ - pKfSpot->nrflag = pRollData->trackhdr.flags; - for (i=0; irkeys)[i]), - &((pRollData->keyhdrlist)[i]), - sizeof(keyheader3ds)); - memcpy(&((pKfSpot->roll)[i]), - &((pRollData->rollanglelist)[i]), - sizeof(float3ds)); - } - } - - /*--- Free Chunk Data */ - FreeFileChunkData3ds(pNodeHdrChunk); - FreeFileChunkData3ds(pPosChunk); - FreeFileChunkData3ds(pColChunk); - FreeFileChunkData3ds(pHotChunk); - FreeFileChunkData3ds(pFallChunk); - FreeFileChunkData3ds(pRollChunk); - if (pTargetPosChunk) - FreeFileChunkData3ds(pTargetPosChunk); -} - - - -/*-------------------------------------------------------------------------- - | PutSpotlightMotion3ds - | Puts Spotlight keyframe information into database. - | - | kfSpotlight3ds--->db - | - | KFDATA - | ... - | L_TARGET - | SPOTLIGHT_NODE - | NODE_ID - | NODE_HDR - | APP_DATA - | POS_TRACK - | COL_TRACK - | HOT_TRACK - | FALL_TRACK - | ROLL_TRACK - | - | Needs Work: - | 1. NodeId: what value? - | - +--------------------------------------------------------------------------*/ -void PutSpotlightMotion3ds(database3ds *db, kfspot3ds *kfspot) -{ - chunk3ds - *pKfChunk, *pSpotChunk, *pTargetChunk = NULL, - *pSpotXdata = NULL, *pTargetXdata = NULL; - - if(db == NULL || kfspot == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if(db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if (!(db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - - /*--- Find KFSEG chunk to put keyframe data into */ - kfGetKfSeg(db->topchunk, &pKfChunk); - - /*--- Destroy old chunks, Copy any XData and reattach it later */ - kfExtractXdata(db, kfspot->name, L_TARGET_NODE_TAG, &pTargetXdata); - kfExtractXdata(db, kfspot->name, SPOTLIGHT_NODE_TAG, &pSpotXdata); - - MakeNodeTagListDirty3ds(db); - - /*--- L_TARGET TRACK */ - if (kfspot->ntkeys>0 && kfspot->tkeys && kfspot->tpos) - pTargetChunk = kfPutTargetTrack(kfspot->tparent, - kfspot->ntkeys, - kfspot->ntflag, - kfspot->tkeys, - kfspot->tpos, - kfspot->name, - kfspot->tflags1, - kfspot->tflags2, - LightTarget, - pKfChunk); - - pSpotChunk = kfPutGenericNode(SPOTLIGHT_NODE_TAG, pKfChunk); - kfPutNodeId(pSpotChunk); - kfPutNodeHeader(kfspot->name, - kfspot->flags1, - kfspot->flags2, - kfspot->parent, - pSpotChunk); - - if (kfspot->npkeys>0 && kfspot->pkeys && kfspot->pos) - kfPutPosTrack(kfspot->npkeys, - kfspot->npflag, - kfspot->pkeys, - kfspot->pos, - pSpotChunk); - - - if (kfspot->nckeys>0 && kfspot->ckeys && kfspot->color) - kfPutColorTrack(kfspot->nckeys, - kfspot->ncflag, - kfspot->ckeys, - kfspot->color, - pSpotChunk); - - /*-- HOTSPOT */ - if (kfspot->nhkeys>0 && kfspot->hkeys && kfspot->hot){ - HotTrackTag *data; - chunk3ds *temp = NULL; - int nKeys = kfspot->nhkeys; - keyheader3ds *pKeyHdr = kfspot->hkeys; - ushort3ds localFlag = kfspot->nhflag; - - /*--- Create the HOT_TRACK_TAG chunk */ - InitChunk3ds(&temp); - temp->tag = HOT_TRACK_TAG; - data = InitChunkData3ds(temp); - - /*--- Initialize trackhdr field */ - data->trackhdr.flags = localFlag; - data->trackhdr.keycount = nKeys; - data->trackhdr.nu1 = data->trackhdr.nu2 = (ushort3ds)0; - - /*--- Copy headers */ - data->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - memcpy(data->keyhdrlist, pKeyHdr, nKeys * sizeof(keyheader3ds)); - - data->hotspotanglelist = malloc(nKeys * sizeof(float3ds)); - memcpy(data->hotspotanglelist, kfspot->hot, nKeys * sizeof(float3ds)); - - /*--- Make if a child of the kframe node */ - AddChildOrdered3ds(pSpotChunk, temp); - } - - /*-- FALLOFF */ - if (kfspot->nfkeys>0 && kfspot->fkeys && kfspot->fall){ - FallTrackTag *data; - chunk3ds *temp = NULL; - int nKeys = kfspot->nfkeys; - keyheader3ds *pKeyHdr = kfspot->fkeys; - ushort3ds localFlag = kfspot->nfflag; - - /*--- Create the FALL_TRACK_TAG chunk */ - InitChunk3ds(&temp); - temp->tag = FALL_TRACK_TAG; - data = InitChunkData3ds(temp); - - /*--- Initialize trackhdr field */ - data->trackhdr.flags = localFlag; - data->trackhdr.keycount = nKeys; - data->trackhdr.nu1 = data->trackhdr.nu2 = (ushort3ds)0; - - /*--- Copy headers */ - data->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - memcpy(data->keyhdrlist, pKeyHdr, nKeys * sizeof(keyheader3ds)); - - data->falloffanglelist = malloc(nKeys * sizeof(float3ds)); - memcpy(data->falloffanglelist, kfspot->fall, nKeys * sizeof(float3ds)); - - /*--- Make if a child of the kframe node */ - AddChildOrdered3ds(pSpotChunk, temp); - } - - /*--- ROLL */ - if (kfspot->nrkeys>0 && kfspot->rkeys && kfspot->roll) - kfPutRollTrack(kfspot->nrkeys, - kfspot->nrflag, - kfspot->rkeys, - kfspot->roll, - pSpotChunk); - - /*--- Replace XData */ - if (pSpotXdata) - AddChildOrdered3ds(pSpotChunk, pSpotXdata); - if (pTargetXdata) - AddChildOrdered3ds(pTargetChunk, pTargetXdata); -} - -void DeleteSpotlightMotionByIndex3ds(database3ds *db, ulong3ds index) -{ - DeleteNodeTagByIndexAndType3ds(db, index, SPOTLIGHT_NODE_TAG); - ON_ERROR_RETURN; -} - -void DeleteSpotlightMotionByName3ds(database3ds *db, char3ds *name) -{ - DeleteNodeTagByNameAndType3ds(db, name, SPOTLIGHT_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopySpotlightMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index) -{ - CopyNodeTagByIndexAndType3ds(destdb, srcdb, index, SPOTLIGHT_NODE_TAG); - ON_ERROR_RETURN; -} - -void CopySpotlightMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - CopyNodeTagByNameAndType3ds(destdb, srcdb, name, SPOTLIGHT_NODE_TAG); - ON_ERROR_RETURN; -} diff --git a/3rdparty/3dsftk3/src/3dssptm.h b/3rdparty/3dsftk3/src/3dssptm.h deleted file mode 100644 index eeec2ae2..00000000 --- a/3rdparty/3dsftk3/src/3dssptm.h +++ /dev/null @@ -1,187 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef SPTM_3DS_H -#define SPTM_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "chunk3ds.h" -#include "dbase3ds.h" - -#define ShowSpotlight3ds 0 -#define HideSpotlight3ds (1<<11) /* Hide spotlight from display and rendering */ - -/* Public Typedefs */ - -typedef struct { - char3ds name[11]; /* Name of camera object */ - char3ds parent[22]; /* Parent name */ - - ushort3ds flags1; /* flags field from node header -fixup later */ - ushort3ds flags2; /* flags2 field from node header -fixup later */ - -#ifdef broken - short3ds visable; /* Flags to control visability */ -#endif - ulong3ds npkeys; /* Number of light position keys */ - ushort3ds npflag; /* Loop control flag for position keys */ - keyheader3ds *pkeys; /* Spline values for light position keys */ - point3ds *pos; /* Light position keys */ - - ulong3ds nckeys; /* Number of color keys */ - ushort3ds ncflag; /* Loop control flag color keys */ - keyheader3ds *ckeys; /* Spline values for color keys */ - fcolor3ds *color; /* Color keys */ - - ulong3ds nhkeys; /* Number of hotspot angle keys */ - ushort3ds nhflag; /* Loop control flag for hotspot angle keys */ - keyheader3ds *hkeys; /* Spline values for hotspot angle keys */ - float3ds *hot; /* Hotspot angle keys */ - - ulong3ds nfkeys; /* Number of falloff angle keys */ - ushort3ds nfflag; /* Loop control flag for falloff angle keys */ - keyheader3ds *fkeys; /* Spline values for falloff angle keys */ - float3ds *fall; /* Falloff angle keys */ - - ulong3ds nrkeys; /* Number of light roll keys */ - ushort3ds nrflag; /* Loop control flag for light roll keys */ - keyheader3ds *rkeys; /* Spline values for light roll keys */ - float3ds *roll; /* Light roll keys */ - - char3ds tparent[22]; /* Name of target's parent object */ - ulong3ds ntkeys; /* Number of target position keys */ - ushort3ds ntflag; /* Loop control flag for target position keys */ - keyheader3ds *tkeys; /* Spline values for target position keys */ - point3ds *tpos; /* Target position keys */ - ushort3ds tflags1; /* flags field from target node header */ - ushort3ds tflags2; /* flags field from target node header */ - -} kfspot3ds; -/* End Public */ - - -/* Public Prototypes */ -void InitSpotlightMotion3ds(kfspot3ds **spot, - ulong3ds npkeys, - ulong3ds nckeys, - ulong3ds nhkeys, - ulong3ds nfkeys, - ulong3ds nrkeys, - ulong3ds ntkeys); - -void ReleaseSpotlightMotion3ds(kfspot3ds **spot); - -void GetSpotlightNodeNameList3ds(database3ds *db, - namelist3ds **list); - -ulong3ds GetSpotlightNodeCount3ds(database3ds *db); - -void GetSpotlightMotionByName3ds(database3ds *db, - char3ds *name, - kfspot3ds **kfspot); - -void PutSpotlightMotion3ds(database3ds *db, - kfspot3ds *kfspot); - -void GetSpotlightMotionByIndex3ds(database3ds *db, - ulong3ds index, - kfspot3ds **kfspot); - -void DeleteSpotlightMotionByIndex3ds(database3ds *db, ulong3ds index); -void DeleteSpotlightMotionByName3ds(database3ds *db, char3ds *name); -void CopySpotlightMotionByIndex3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index); -void CopySpotlightMotionByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); - -/* End Public */ - -void GetSpotlightMotion3ds(chunk3ds *pSpotChunk, - chunk3ds *pTargetChunk, - kfspot3ds **kfspot); - - -#endif - diff --git a/3rdparty/3dsftk3/src/3dsstrlf.c b/3rdparty/3dsftk3/src/3dsstrlf.c deleted file mode 100644 index 8ee6301d..00000000 --- a/3rdparty/3dsftk3/src/3dsstrlf.c +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* A string length scanner that has an upper limit */ - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsstrlf.h" - - -/* maxlength is increased by one to account for a null character*/ -ulong3ds strlenf3ds(const char3ds *string, long3ds maxlength) -{ - long3ds i; - - if (string == NULL) - SET_ERROR_RETURNR(ERR_INVALID_ARG, 0); - - if (string == NULL) return 0; - - for (i = 0; i < (maxlength+1); i++) - { - if (string[i] == 0) break; - } - if (string[i] != 0) - SET_ERROR_RETURNR(ERR_STRING_TOO_LONG, 0); - - return(i); -} - - diff --git a/3rdparty/3dsftk3/src/3dsstrlf.h b/3rdparty/3dsftk3/src/3dsstrlf.h deleted file mode 100644 index 27023b25..00000000 --- a/3rdparty/3dsftk3/src/3dsstrlf.h +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef STRLF_3DS_H -#define STRLF_3DS_H - -#include "3dstype.h" - -ulong3ds strlenf3ds(const char3ds *string, long3ds maxlength); - -#endif - diff --git a/3rdparty/3dsftk3/src/3dstype.h b/3rdparty/3dsftk3/src/3dstype.h deleted file mode 100644 index cafa73f0..00000000 --- a/3rdparty/3dsftk3/src/3dstype.h +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef TYPE_3DS_H -#define TYPE_3DS_H - -#include "smartall.h" - -#include - -/* Data types and definitions common to all object modules */ - -/* Public Defines */ - -/* Data Type Synonyms For Portability */ - -#define char3ds char -#define uchar3ds unsigned char -#define byte3ds char -#define ubyte3ds unsigned char -#define short3ds int16_t -#define ushort3ds uint16_t -#define long3ds int32_t -#define ulong3ds uint32_t -#define float3ds float -#define double3ds double -#define int3ds int -#define void3ds void - -/* End Public */ - -char3ds *strdup3ds(const char3ds *s1); -#define strdup(source) strdup3ds(source) - -/* Unix fudges */ -#ifdef SPARC -int strcmpi(char3ds *s1, char3ds *s2); -#define memcpy(dest, source, size) (void *)memcpy((char *)dest, (char *)source, size) -#define memset(dest, value, size) (void *)memset((char *)dest, value, size) -#endif - -#ifndef NDEBUG -void assertfunc(int ex, char *msg, char *file, int line); -#define _myassert(ex, msg) assertfunc((ex), msg, __FILE__, __LINE__) -#define myassert(ex, msg) _myassert(ex, msg) -#else -#define _myassert(ex, msg) -#define myassert(ex,msg) -#endif - - -#endif - diff --git a/3rdparty/3dsftk3/src/3dsutil.c b/3rdparty/3dsftk3/src/3dsutil.c deleted file mode 100644 index 2a092a43..00000000 --- a/3rdparty/3dsftk3/src/3dsutil.c +++ /dev/null @@ -1,812 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* Various informational type utility functions */ - -#include "stdlib.h" -#include "string.h" -#include "3dstype.h" -#include "3dsprim.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsutil.h" - -char3ds indentstring[] = "| | | | | | | | | | | | | | "; - -char3ds *indent(short3ds level) -{ - long3ds offset; - offset = strlen(indentstring)-(level*3); - return(&(indentstring[offset])); -} - -void ChunkHeaderReport3ds(FILE *outfile, chunk3ds *chunk, ushort3ds indentlevel) -{ - fprintf(outfile, "\n%sChunk %s (%0xH) \n%sLength is %d (%0xH) \n", indent(indentlevel), - ChunkTagToString3ds(chunk->tag), chunk->tag, indent(indentlevel), chunk->size, chunk->size); -} - -void PrintKeyHeader3ds(FILE *outfile, keyheader3ds *key, ushort3ds indentlevel) -{ - fprintf(outfile, "%sFrame %u", indent(indentlevel), key->time); - if((key->rflags & KeyUsesTension3ds) == KeyUsesTension3ds) fprintf(outfile, ", Tens %.2f", key->tension); - if((key->rflags & KeyUsesCont3ds) == KeyUsesCont3ds) fprintf(outfile, ", Cont %.2f", key->continuity); - if((key->rflags & KeyUsesBias3ds) == KeyUsesBias3ds) fprintf(outfile, ", Bias %.2f", key->bias); - if((key->rflags & KeyUsesEaseTo3ds) == KeyUsesEaseTo3ds) fprintf(outfile, ", Ease to %.2f", key->easeto); - if((key->rflags & KeyUsesEaseFrom3ds) == KeyUsesEaseFrom3ds) fprintf(outfile, ", Ease from %.2f", key->easefrom); - fprintf(outfile, "\n"); -} - - -char3ds *ChunkTagToString3ds(chunktag3ds tag) -{ - switch(tag) - { - case NULL_CHUNK: return("NULL_CHUNK"); - case ChunkType: return("ChunkType"); - case ChunkUnique: return("ChunkUnique"); - case NotChunk: return("NotChunk"); - case Container: return("Container"); - case IsChunk: return("IsChunk"); - - /* Dummy Chunk that sometimes appears in 3ds files created by - prerelease 3D Studio R2 */ - case DUMMY: return("DUMMY"); - - /* Trick Chunk Types For Open*, Write*, Close* functions */ - - case POINT_ARRAY_ENTRY: return("POINT_ARRAY_ENTRY"); - case POINT_FLAG_ARRAY_ENTRY: return("POINT_FLAG_ARRAY_ENTRY"); - case FACE_ARRAY_ENTRY: return("FACE_ARRAY_ENTRY"); - case MSH_MAT_GROUP_ENTRY: return("MSH_MAT_GROUP_ENTRY"); - case TEX_VERTS_ENTRY: return("TEX_VERTS_ENTRY"); - case SMOOTH_GROUP_ENTRY: return("SMOOTH_GROUP_ENTRY"); - case POS_TRACK_TAG_KEY: return("POS_TRACK_TAG_KEY"); - case ROT_TRACK_TAG_KEY: return("ROT_TRACK_TAG_KEY"); - case SCL_TRACK_TAG_KEY: return("SCL_TRACK_TAG_KEY"); - case FOV_TRACK_TAG_KEY: return("FOV_TRACK_TAG_KEY"); - case ROLL_TRACK_TAG_KEY: return("ROLL_TRACK_TAG_KEY"); - case COL_TRACK_TAG_KEY: return("COL_TRACK_TAG_KEY"); - case MORPH_TRACK_TAG_KEY: return("MORPH_TRACK_TAG_KEY"); - case HOT_TRACK_TAG_KEY: return("HOT_TRACK_TAG_KEY"); - case FALL_TRACK_TAG_KEY: return("FALL_TRACK_TAG_KEY"); - - /* 3DS File Chunk IDs */ - - case M3DMAGIC: return("M3DMAGIC"); - case SMAGIC: return("SMAGIC"); - case LMAGIC: return("LMAGIC"); - case MLIBMAGIC: return("MLIBMAGIC"); - case MATMAGIC: return("MATMAGIC"); - case M3D_VERSION: return("M3D_VERSION"); - case M3D_KFVERSION: return("M3D_KFVERSION"); - - /* Mesh Chunk Ids */ - - case MDATA: return("MDATA"); - case MESH_VERSION: return("MESH_VERSION"); - case COLOR_F: return("COLOR_F"); - case COLOR_24: return("COLOR_24"); - case LIN_COLOR_24: return("LIN_COLOR_24"); - case LIN_COLOR_F: return("LIN_COLOR_F"); - case INT_PERCENTAGE: return("INT_PERCENTAGE"); - case FLOAT_PERCENTAGE: return("FLOAT_PERCENTAGE"); - - case MASTER_SCALE: return("MASTER_SCALE"); - - case BIT_MAP: return("BIT_MAP"); - case USE_BIT_MAP: return("USE_BIT_MAP"); - case SOLID_BGND: return("SOLID_BGND"); - case USE_SOLID_BGND: return("USE_SOLID_BGND"); - case V_GRADIENT: return("V_GRADIENT"); - case USE_V_GRADIENT: return("USE_V_GRADIENT"); - - case LO_SHADOW_BIAS: return("LO_SHADOW_BIAS"); - case HI_SHADOW_BIAS: return("HI_SHADOW_BIAS"); - case SHADOW_MAP_SIZE: return("SHADOW_MAP_SIZE"); - case SHADOW_SAMPLES: return("SHADOW_SAMPLES"); - case SHADOW_RANGE: return("SHADOW_RANGE"); - case SHADOW_FILTER: return("SHADOW_FILTER"); - case RAY_BIAS: return("RAY_BIAS"); - - case O_CONSTS: return("O_CONSTS"); - - case AMBIENT_LIGHT: return("AMBIENT_LIGHT"); - - case FOG: return("FOG"); - case USE_FOG: return("USE_FOG"); - case FOG_BGND: return("FOG_BGND"); - case DISTANCE_CUE: return("DISTANCE_CUE"); - case USE_DISTANCE_CUE: return("USE_DISTANCE_CUE"); - case LAYER_FOG: return("LAYER_FOG"); - case USE_LAYER_FOG: return("USE_LAYER_FOG"); - case DCUE_BGND: return("DCUE_BGND"); - - case DEFAULT_VIEW: return("DEFAULT_VIEW"); - case VIEW_TOP: return("VIEW_TOP"); - case VIEW_BOTTOM: return("VIEW_BOTTOM"); - case VIEW_LEFT: return("VIEW_LEFT"); - case VIEW_RIGHT: return("VIEW_RIGHT"); - case VIEW_FRONT: return("VIEW_FRONT"); - case VIEW_BACK: return("VIEW_BACK"); - case VIEW_USER: return("VIEW_USER"); - case VIEW_CAMERA: return("VIEW_CAMERA"); - case VIEW_WINDOW: return("VIEW_WINDOW"); - - case NAMED_OBJECT: return("NAMED_OBJECT"); - case OBJ_HIDDEN: return("OBJ_HIDDEN"); - case OBJ_VIS_LOFTER: return("OBJ_VIS_LOFTER"); - case OBJ_DOESNT_CAST: return("OBJ_DOESNT_CAST"); - case OBJ_MATTE: return("OBJ_MATTE"); - case OBJ_FAST: return("OBJ_FAST"); - case OBJ_PROCEDURAL: return("OBJ_PROCEDURAL"); - case OBJ_FROZEN: return("OBJ_FROZEN"); - case OBJ_DONT_RCVSHADOW: return("OBJ_DONT_RCVSHADOW"); - - case N_TRI_OBJECT: return("N_TRI_OBJECT"); - - case POINT_ARRAY: return("POINT_ARRAY"); - case POINT_FLAG_ARRAY: return("POINT_FLAG_ARRAY"); - case FACE_ARRAY: return("FACE_ARRAY"); - case MSH_MAT_GROUP: return("MSH_MAT_GROUP"); - case OLD_MAT_GROUP: return("OLD_MAT_GROUP"); - case TEX_VERTS: return("TEX_VERTS"); - case SMOOTH_GROUP: return("SMOOTH_GROUP"); - case MESH_MATRIX: return("MESH_MATRIX"); - case MESH_COLOR: return("MESH_COLOR"); - case MESH_TEXTURE_INFO: return("MESH_TEXTURE_INFO"); - case PROC_NAME: return("PROC_NAME"); - case PROC_DATA: return("PROC_DATA"); - case MSH_BOXMAP: return("MSH_BOXMAP"); - - case N_D_L_OLD: return("N_D_L_OLD"); - - case N_CAM_OLD: return("N_CAM_OLD"); - - case N_DIRECT_LIGHT: return("N_DIRECT_LIGHT"); - case DL_SPOTLIGHT: return("DL_SPOTLIGHT"); - case DL_OFF: return("DL_OFF"); - case DL_ATTENUATE: return("DL_ATTENUATE"); - case DL_RAYSHAD: return("DL_RAYSHAD"); - case DL_SHADOWED: return("DL_SHADOWED"); - case DL_LOCAL_SHADOW: return("DL_LOCAL_SHADOW"); - case DL_LOCAL_SHADOW2: return("DL_LOCAL_SHADOW2"); - case DL_SEE_CONE: return("DL_SEE_CONE"); - case DL_SPOT_RECTANGULAR: return("DL_SPOT_RECTANGULAR"); - case DL_SPOT_OVERSHOOT: return("DL_SPOT_OVERSHOOT"); - case DL_SPOT_PROJECTOR: return("DL_SPOT_PROJECTOR"); - case DL_EXCLUDE: return("DL_EXCLUDE"); - case DL_RANGE: return("DL_RANGE"); - case DL_SPOT_ROLL: return("DL_SPOT_ROLL"); - case DL_SPOT_ASPECT: return("DL_SPOT_ASPECT"); - case DL_RAY_BIAS: return("DL_RAY_BIAS"); - case DL_INNER_RANGE: return("DL_INNER_RANGE"); - case DL_OUTER_RANGE: return("DL_OUTER_RANGE"); - case DL_MULTIPLIER: return("DL_MULTIPLIER"); - - case N_AMBIENT_LIGHT: return("N_AMBIENT_LIGHT"); - - case N_CAMERA: return("N_CAMERA"); - case CAM_SEE_CONE: return("CAM_SEE_CONE"); - case CAM_RANGES: return("CAM_RANGES"); - - case HIERARCHY: return("HIERARCHY"); - case PARENT_OBJECT: return("PARENT_OBJECT"); - case PIVOT_OBJECT: return("PIVOT_OBJECT"); - case PIVOT_LIMITS: return("PIVOT_LIMITS"); - case PIVOT_ORDER: return("PIVOT_ORDER"); - case XLATE_RANGE: return("XLATE_RANGE"); - - case POLY_2D: return("POLY_2D"); - -/* Flags in shaper file that tell whether polys make up an ok shape */ - - case SHAPE_OK: return("SHAPE_OK"); - case SHAPE_NOT_OK: return("SHAPE_NOT_OK"); - - case SHAPE_HOOK: return("SHAPE_HOOK"); - - case PATH_3D: return("PATH_3D"); - case PATH_MATRIX: return("PATH_MATRIX"); - case SHAPE_2D: return("SHAPE_2D"); - case M_SCALE: return("M_SCALE"); - case M_TWIST: return("M_TWIST"); - case M_TEETER: return("M_TEETER"); - case M_FIT: return("M_FIT"); - case M_BEVEL: return("M_BEVEL"); - case XZ_CURVE: return("XZ_CURVE"); - case YZ_CURVE: return("YZ_CURVE"); - case INTERPCT: return("INTERPCT"); - case DEFORM_LIMIT: return("DEFORM_LIMIT"); - -/* Flags for Modeler options */ - - case USE_CONTOUR: return("USE_CONTOUR"); - case USE_TWEEN: return("USE_TWEEN"); - case USE_SCALE: return("USE_SCALE"); - case USE_TWIST: return("USE_TWIST"); - case USE_TEETER: return("USE_TEETER"); - case USE_FIT: return("USE_FIT"); - case USE_BEVEL: return("USE_BEVEL"); - - /* Viewport description chunks */ - - case VIEWPORT_LAYOUT_OLD: return("VIEWPORT_LAYOUT_OLD"); - case VIEWPORT_DATA_OLD: return("VIEWPORT_DATA_OLD"); - case VIEWPORT_LAYOUT: return("VIEWPORT_LAYOUT"); - case VIEWPORT_DATA: return("VIEWPORT_DATA"); - case VIEWPORT_DATA_3: return("VIEWPORT_DATA_3"); - case VIEWPORT_SIZE: return("VIEWPORT_SIZE"); - case NETWORK_VIEW: return("NETWORK_VIEW"); - - /* External Application Data */ - - case XDATA_SECTION: return("XDATA_SECTION"); - case XDATA_ENTRY: return("XDATA_ENTRY"); - case XDATA_APPNAME: return("XDATA_APPNAME"); - case XDATA_STRING: return("XDATA_STRING"); - case XDATA_FLOAT: return("XDATA_FLOAT"); - case XDATA_DOUBLE: return("XDATA_DOUBLE"); - case XDATA_SHORT: return("XDATA_SHORT"); - case XDATA_LONG: return("XDATA_LONG"); - case XDATA_VOID: return("XDATA_VOID"); - case XDATA_GROUP: return("XDATA_GROUP"); - case XDATA_RFU6: return("XDATA_RFU6"); - case XDATA_RFU5: return("XDATA_RFU5"); - case XDATA_RFU4: return("XDATA_RFU4"); - case XDATA_RFU3: return("XDATA_RFU3"); - case XDATA_RFU2: return("XDATA_RFU2"); - case XDATA_RFU1: return("XDATA_RFU1"); - - /* Material Chunk IDs */ - - case MAT_ENTRY: return("MAT_ENTRY"); - case MAT_NAME: return("MAT_NAME"); - case MAT_AMBIENT: return("MAT_AMBIENT"); - case MAT_DIFFUSE: return("MAT_DIFFUSE"); - case MAT_SPECULAR: return("MAT_SPECULAR"); - case MAT_SHININESS: return("MAT_SHININESS"); - case MAT_SHIN2PCT: return("MAT_SHIN2PCT"); - case MAT_SHIN3PCT: return("MAT_SHIN3PCT"); - case MAT_TRANSPARENCY: return("MAT_TRANSPARENCY"); - case MAT_XPFALL: return("MAT_XPFALL"); - case MAT_REFBLUR: return("MAT_REFBLUR"); - - case MAT_SELF_ILLUM: return("MAT_SELF_ILLUM"); - case MAT_TWO_SIDE: return("MAT_TWO_SIDE"); - case MAT_DECAL: return("MAT_DECAL"); - case MAT_ADDITIVE: return("MAT_ADDITIVE"); - case MAT_SELF_ILPCT: return("MAT_SELF_ILPCT"); - case MAT_WIRE: return("MAT_WIRE"); - case MAT_SUPERSMP: return("MAT_SUPERSMP"); - case MAT_WIRESIZE: return("MAT_WIRESIZE"); - case MAT_FACEMAP: return("MAT_FACEMAP"); - case MAT_XPFALLIN: return("MAT_XPFALLIN"); - case MAT_PHONGSOFT: return("MAT_PHONGSOFT"); - case MAT_WIREABS: return("MAT_WIREABS"); - - case MAT_SHADING: return("MAT_SHADING"); - - case MAT_TEXMAP: return("MAT_TEXMAP"); - case MAT_OPACMAP: return("MAT_OPACMAP"); - case MAT_REFLMAP: return("MAT_REFLMAP"); - case MAT_BUMPMAP: return("MAT_BUMPMAP"); - case MAT_SPECMAP: return("MAT_SPECMAP"); - case MAT_USE_XPFALL: return("MAT_USE_XPFALL"); - case MAT_USE_REFBLUR: return("MAT_USE_REFBLUR"); - case MAT_BUMP_PERCENT: return("MAT_BUMP_PERCENT"); - - case MAT_MAPNAME: return("MAT_MAPNAME"); - case MAT_ACUBIC: return("MAT_ACUBIC"); - - case MAT_SXP_TEXT_DATA: return("MAT_SXP_TEXT_DATA"); - case MAT_SXP_TEXT2_DATA: return("MAT_SXP_TEXT2_DATA"); - case MAT_SXP_OPAC_DATA: return("MAT_SXP_OPAC_DATA"); - case MAT_SXP_BUMP_DATA: return("MAT_SXP_BUMP_DATA"); - case MAT_SXP_SPEC_DATA: return("MAT_SXP_SPEC_DATA"); - case MAT_SXP_SHIN_DATA: return("MAT_SXP_SHIN_DATA"); - case MAT_SXP_SELFI_DATA: return("MAT_SXP_SELFI_DATA"); - case MAT_SXP_TEXT_MASKDATA: return("MAT_SXP_TEXT_MASKDATA"); - case MAT_SXP_TEXT2_MASKDATA: return("MAT_SXP_TEXT2_MASKDATA"); - case MAT_SXP_OPAC_MASKDATA: return("MAT_SXP_OPAC_MASKDATA"); - case MAT_SXP_BUMP_MASKDATA: return("MAT_SXP_BUMP_MASKDATA"); - case MAT_SXP_SPEC_MASKDATA: return("MAT_SXP_SPEC_MASKDATA"); - case MAT_SXP_SHIN_MASKDATA: return("MAT_SXP_SHIN_MASKDATA"); - case MAT_SXP_SELFI_MASKDATA: return("MAT_SXP_SELFI_MASKDATA"); - case MAT_SXP_REFL_MASKDATA: return("MAT_SXP_REFL_MASKDATA"); - case MAT_TEX2MAP: return("MAT_TEX2MAP"); - case MAT_SHINMAP: return("MAT_SHINMAP"); - case MAT_SELFIMAP: return("MAT_SELFIMAP"); - case MAT_TEXMASK: return("MAT_TEXMASK"); - case MAT_TEX2MASK: return("MAT_TEX2MASK"); - case MAT_OPACMASK: return("MAT_OPACMASK"); - case MAT_BUMPMASK: return("MAT_BUMPMASK"); - case MAT_SHINMASK: return("MAT_SHINMASK"); - case MAT_SPECMASK: return("MAT_SPECMASK"); - case MAT_SELFIMASK: return("MAT_SELFIMASK"); - case MAT_REFLMASK: return("MAT_REFLMASK"); - case MAT_MAP_TILINGOLD: return("MAT_MAP_TILINGOLD"); - case MAT_MAP_TILING: return("MAT_MAP_TILING"); - case MAT_MAP_TEXBLUR_OLD: return("MAT_MAP_TEXBLUR_OLD"); - case MAT_MAP_TEXBLUR: return("MAT_MAP_TEXBLUR"); - case MAT_MAP_USCALE: return("MAT_MAP_USCALE"); - case MAT_MAP_VSCALE: return("MAT_MAP_VSCALE"); - case MAT_MAP_UOFFSET: return("MAT_MAP_UOFFSET"); - case MAT_MAP_VOFFSET: return("MAT_MAP_VOFFSET"); - case MAT_MAP_ANG: return("MAT_MAP_ANG"); - case MAT_MAP_COL1: return("MAT_MAP_COL1"); - case MAT_MAP_COL2: return("MAT_MAP_COL2"); - case MAT_MAP_RCOL: return("MAT_MAP_RCOL"); - case MAT_MAP_GCOL: return("MAT_MAP_GCOL"); - case MAT_MAP_BCOL: return("MAT_MAP_BCOL"); - - /* Keyframe Chunk IDs */ - - case KFDATA: return("KFDATA"); - case KFHDR: return("KFHDR"); - case AMBIENT_NODE_TAG: return("AMBIENT_NODE_TAG"); - case OBJECT_NODE_TAG: return("OBJECT_NODE_TAG"); - case CAMERA_NODE_TAG: return("CAMERA_NODE_TAG"); - case TARGET_NODE_TAG: return("TARGET_NODE_TAG"); - case LIGHT_NODE_TAG: return("LIGHT_NODE_TAG"); - case L_TARGET_NODE_TAG: return("L_TARGET_NODE_TAG"); - case SPOTLIGHT_NODE_TAG: return("SPOTLIGHT_NODE_TAG"); - - case KFSEG: return("KFSEG"); - case KFCURTIME: return("KFCURTIME"); - case NODE_HDR: return("NODE_HDR"); - case PARENT_NAME: return("PARENT_NAME"); - case INSTANCE_NAME: return("INSTANCE_NAME"); - case PRESCALE: return("PRESCALE"); - case PIVOT: return("PIVOT"); - case BOUNDBOX: return("BOUNDBOX"); - case MORPH_SMOOTH: return("MORPH_SMOOTH"); - case POS_TRACK_TAG: return("POS_TRACK_TAG"); - case ROT_TRACK_TAG: return("ROT_TRACK_TAG"); - case SCL_TRACK_TAG: return("SCL_TRACK_TAG"); - case FOV_TRACK_TAG: return("FOV_TRACK_TAG"); - case ROLL_TRACK_TAG: return("ROLL_TRACK_TAG"); - case COL_TRACK_TAG: return("COL_TRACK_TAG"); - case MORPH_TRACK_TAG: return("MORPH_TRACK_TAG"); - case HOT_TRACK_TAG: return("HOT_TRACK_TAG"); - case FALL_TRACK_TAG: return("FALL_TRACK_TAG"); - case HIDE_TRACK_TAG: return("HIDE_TRACK_TAG"); - case NODE_ID: return("NODE_ID"); - - case CMAGIC: return("CMAGIC"); - - case C_MDRAWER: return("C_MDRAWER"); - case C_TDRAWER: return("C_TDRAWER"); - case C_SHPDRAWER: return("C_SHPDRAWER"); - case C_MODDRAWER: return("C_MODDRAWER"); - case C_RIPDRAWER: return("C_RIPDRAWER"); - case C_TXDRAWER: return("C_TXDRAWER"); - case C_PDRAWER: return("C_PDRAWER"); - case C_MTLDRAWER: return("C_MTLDRAWER"); - case C_FLIDRAWER: return("C_FLIDRAWER"); - case C_CUBDRAWER: return("C_CUBDRAWER"); - case C_MFILE: return("C_MFILE"); - case C_SHPFILE: return("C_SHPFILE"); - case C_MODFILE: return("C_MODFILE"); - case C_RIPFILE: return("C_RIPFILE"); - case C_TXFILE: return("C_TXFILE"); - case C_PFILE: return("C_PFILE"); - case C_MTLFILE: return("C_MTLFILE"); - case C_FLIFILE: return("C_FLIFILE"); - case C_PALFILE: return("C_PALFILE"); - case C_TX_STRING: return("C_TX_STRING"); - case C_CONSTS: return("C_CONSTS"); - case C_SNAPS: return("C_SNAPS"); - case C_GRIDS: return("C_GRIDS"); - case C_ASNAPS: return("C_ASNAPS"); - case C_GRID_RANGE: return("C_GRID_RANGE"); - case C_RENDTYPE: return("C_RENDTYPE"); - case C_PROGMODE: return("C_PROGMODE"); - case C_PREVMODE: return("C_PREVMODE"); - case C_MODWMODE: return("C_MODWMODE"); - case C_MODMODEL: return("C_MODMODEL"); - case C_ALL_LINES: return("C_ALL_LINES"); - case C_BACK_TYPE: return("C_BACK_TYPE"); - case C_MD_CS: return("C_MD_CS"); - case C_MD_CE: return("C_MD_CE"); - case C_MD_SML: return("C_MD_SML"); - case C_MD_SMW: return("C_MD_SMW"); - case C_LOFT_WITH_TEXTURE: return("C_LOFT_WITH_TEXTURE"); - case C_LOFT_L_REPEAT: return("C_LOFT_L_REPEAT"); - case C_LOFT_W_REPEAT: return("C_LOFT_W_REPEAT"); - case C_LOFT_UV_NORMALIZE: return("C_LOFT_UV_NORMALIZE"); - case C_WELD_LOFT: return("C_WELD_LOFT"); - case C_MD_PDET: return("C_MD_PDET"); - case C_MD_SDET: return("C_MD_SDET"); - case C_RGB_RMODE: return("C_RGB_RMODE"); - case C_RGB_HIDE: return("C_RGB_HIDE"); - case C_RGB_MAPSW: return("C_RGB_MAPSW"); - case C_RGB_TWOSIDE: return("C_RGB_TWOSIDE"); - case C_RGB_SHADOW: return("C_RGB_SHADOW"); - case C_RGB_AA: return("C_RGB_AA"); - case C_RGB_OVW: return("C_RGB_OVW"); - case C_RGB_OVH: return("C_RGB_OVH"); - case C_RGB_PICTYPE: return("C_RGB_PICTYPE"); - case C_RGB_OUTPUT: return("C_RGB_OUTPUT"); - case C_RGB_TODISK: return("C_RGB_TODISK"); - case C_RGB_COMPRESS: return("C_RGB_COMPRESS"); - case C_JPEG_COMPRESSION: return("C_JPEG_COMPRESSION"); - case C_RGB_DISPDEV: return("C_RGB_DISPDEV"); - case C_RGB_HARDDEV: return("C_RGB_HARDDEV"); - case C_RGB_PATH: return("C_RGB_PATH"); - case C_BITMAP_DRAWER: return("C_BITMAP_DRAWER"); - case C_RGB_FILE: return("C_RGB_FILE"); - case C_RGB_OVASPECT: return("C_RGB_OVASPECT"); - - case C_RGB_ANIMTYPE: return("C_RGB_ANIMTYPE"); - case C_RENDER_ALL: return("C_RENDER_ALL"); - case C_REND_FROM: return("C_REND_FROM"); - case C_REND_TO: return("C_REND_TO"); - case C_REND_NTH: return("C_REND_NTH"); - case C_REND_TSTEP: return("C_REND_TSTEP"); - case C_VP_TSTEP: return("C_VP_TSTEP"); - - case C_PAL_TYPE: return("C_PAL_TYPE"); - case C_RND_TURBO: return("C_RND_TURBO"); - case C_RND_MIP: return("C_RND_MIP"); - case C_BGND_METHOD: return("C_BGND_METHOD"); - case C_AUTO_REFLECT: return("C_AUTO_REFLECT"); - case C_VP_FROM: return("C_VP_FROM"); - case C_VP_TO: return("C_VP_TO"); - case C_VP_NTH: return("C_VP_NTH"); - - case C_SRDIAM: return("C_SRDIAM"); - case C_SRDEG: return("C_SRDEG"); - case C_SRSEG: return("C_SRSEG"); - case C_SRDIR: return("C_SRDIR"); - case C_HETOP: return("C_HETOP"); - case C_HEBOT: return("C_HEBOT"); - case C_HEHT: return("C_HEHT"); - case C_HETURNS: return("C_HETURNS"); - case C_HEDEG: return("C_HEDEG"); - case C_HESEG: return("C_HESEG"); - case C_HEDIR: return("C_HEDIR"); - case C_QUIKSTUFF: return("C_QUIKSTUFF"); - case C_SEE_LIGHTS: return("C_SEE_LIGHTS"); - case C_SEE_CAMERAS: return("C_SEE_CAMERAS"); - case C_SEE_3D: return("C_SEE_3D"); - case C_MESHSEL: return("C_MESHSEL"); - case C_MESHUNSEL: return("C_MESHUNSEL"); - case C_POLYSEL: return("C_POLYSEL"); - case C_POLYUNSEL: return("C_POLYUNSEL"); - case C_SHPLOCAL: return("C_SHPLOCAL"); - case C_MSHLOCAL: return("C_MSHLOCAL"); - case C_NUM_FORMAT: return("C_NUM_FORMAT"); - case C_ARCH_DENOM: return("C_ARCH_DENOM"); - case C_IN_DEVICE: return("C_IN_DEVICE"); - case C_MSCALE: return("C_MSCALE"); - case C_COMM_PORT: return("C_COMM_PORT"); - case C_TAB_BASES: return("C_TAB_BASES"); - case C_TAB_DIVS: return("C_TAB_DIVS"); - case C_MASTER_SCALES: return("C_MASTER_SCALES"); - case C_SHOW_1STVERT: return("C_SHOW_1STVERT"); - case C_SHAPER_OK: return("C_SHAPER_OK"); - case C_LOFTER_OK: return("C_LOFTER_OK"); - case C_EDITOR_OK: return("C_EDITOR_OK"); - case C_KEYFRAMER_OK: return("C_KEYFRAMER_OK"); - case C_PICKSIZE: return("C_PICKSIZE"); - case C_MAPTYPE: return("C_MAPTYPE"); - case C_MAP_DISPLAY: return("C_MAP_DISPLAY"); - case C_TILE_XY: return("C_TILE_XY"); - case C_MAP_XYZ: return("C_MAP_XYZ"); - case C_MAP_SCALE: return("C_MAP_SCALE"); - case C_MAP_MATRIX_OLD: return("C_MAP_MATRIX_OLD"); - case C_MAP_MATRIX: return("C_MAP_MATRIX"); - case C_MAP_WID_HT: return("C_MAP_WID_HT"); - case C_OBNAME: return("C_OBNAME"); - case C_CAMNAME: return("C_CAMNAME"); - case C_LTNAME: return("C_LTNAME"); - case C_CUR_MNAME: return("C_CUR_MNAME"); - case C_CURMTL_FROM_MESH: return("C_CURMTL_FROM_MESH"); - case C_GET_SHAPE_MAKE_FACES: return("C_GET_SHAPE_MAKE_FACES"); - case C_DETAIL: return("C_DETAIL"); - case C_VERTMARK: return("C_VERTMARK"); - case C_MSHAX: return("C_MSHAX"); - case C_MSHCP: return("C_MSHCP"); - case C_USERAX: return("C_USERAX"); - case C_SHOOK: return("C_SHOOK"); - case C_RAX: return("C_RAX"); - case C_STAPE: return("C_STAPE"); - case C_LTAPE: return("C_LTAPE"); - case C_ETAPE: return("C_ETAPE"); - case C_KTAPE: return("C_KTAPE"); - case C_SPHSEGS: return("C_SPHSEGS"); - case C_GEOSMOOTH: return("C_GEOSMOOTH"); - case C_HEMISEGS: return("C_HEMISEGS"); - case C_PRISMSEGS: return("C_PRISMSEGS"); - case C_PRISMSIDES: return("C_PRISMSIDES"); - case C_TUBESEGS: return("C_TUBESEGS"); - case C_TUBESIDES: return("C_TUBESIDES"); - case C_TORSEGS: return("C_TORSEGS"); - case C_TORSIDES: return("C_TORSIDES"); - case C_CONESIDES: return("C_CONESIDES"); - case C_CONESEGS: return("C_CONESEGS"); - case C_NGPARMS: return("C_NGPARMS"); - case C_PTHLEVEL: return("C_PTHLEVEL"); - case C_MSCSYM: return("C_MSCSYM"); - case C_MFTSYM: return("C_MFTSYM"); - case C_MTTSYM: return("C_MTTSYM"); - case C_SMOOTHING: return("C_SMOOTHING"); - case C_MODICOUNT: return("C_MODICOUNT"); - case C_FONTSEL: return("C_FONTSEL"); - case C_TESS_TYPE: return("C_TESS_TYPE"); - case C_TESS_TENSION: return("C_TESS_TENSION"); - - case C_SEG_START: return("C_SEG_START"); - case C_SEG_END: return("C_SEG_END"); - case C_CURTIME: return("C_CURTIME"); - case C_ANIMLENGTH: return("C_ANIMLENGTH"); - case C_PV_FROM: return("C_PV_FROM"); - case C_PV_TO: return("C_PV_TO"); - case C_PV_DOFNUM: return("C_PV_DOFNUM"); - case C_PV_RNG: return("C_PV_RNG"); - case C_PV_NTH: return("C_PV_NTH"); - case C_PV_TYPE: return("C_PV_TYPE"); - case C_PV_METHOD: return("C_PV_METHOD"); - case C_PV_FPS: return("C_PV_FPS"); - case C_VTR_FRAMES: return("C_VTR_FRAMES"); - case C_VTR_HDTL: return("C_VTR_HDTL"); - case C_VTR_HD: return("C_VTR_HD"); - case C_VTR_TL: return("C_VTR_TL"); - case C_VTR_IN: return("C_VTR_IN"); - case C_VTR_PK: return("C_VTR_PK"); - case C_VTR_SH: return("C_VTR_SH"); - -/* Material chunks */ - - case C_WORK_MTLS: return("C_WORK_MTLS"); - case C_WORK_MTLS_2: return("C_WORK_MTLS_2"); - case C_WORK_MTLS_3: return("C_WORK_MTLS_3"); - case C_WORK_MTLS_4: return("C_WORK_MTLS_4"); - case C_WORK_MTLS_5: return("C_WORK_MTLS_5"); - case C_WORK_MTLS_6: return("C_WORK_MTLS_6"); - case C_WORK_MTLS_7: return("C_WORK_MTLS_7"); - case C_WORK_MTLS_8: return("C_WORK_MTLS_8"); - case C_WORKMTL: return("C_WORKMTL"); - case C_SXP_TEXT_DATA: return("C_SXP_TEXT_DATA"); - case C_SXP_TEXT2_DATA: return("C_SXP_TEXT2_DATA"); - case C_SXP_OPAC_DATA: return("C_SXP_OPAC_DATA"); - case C_SXP_BUMP_DATA: return("C_SXP_BUMP_DATA"); - case C_SXP_SPEC_DATA: return("C_SXP_SPEC_DATA"); - case C_SXP_SHIN_DATA: return("C_SXP_SHIN_DATA"); - case C_SXP_SELFI_DATA: return("C_SXP_SELFI_DATA"); - case C_SXP_TEXT_MASKDATA: return("C_SXP_TEXT_MASKDATA"); - case C_SXP_TEXT2_MASKDATA: return("C_SXP_TEXT2_MASKDATA"); - case C_SXP_OPAC_MASKDATA: return("C_SXP_OPAC_MASKDATA"); - case C_SXP_BUMP_MASKDATA: return("C_SXP_BUMP_MASKDATA"); - case C_SXP_SPEC_MASKDATA: return("C_SXP_SPEC_MASKDATA"); - case C_SXP_SHIN_MASKDATA: return("C_SXP_SHIN_MASKDATA"); - case C_SXP_SELFI_MASKDATA: return("C_SXP_SELFI_MASKDATA"); - case C_SXP_REFL_MASKDATA: return("C_SXP_REFL_MASKDATA"); - - case C_BGTYPE: return("C_BGTYPE"); - case C_MEDTILE: return("C_MEDTILE"); - -/* Contrast */ - - case C_LO_CONTRAST: return("C_LO_CONTRAST"); - case C_HI_CONTRAST: return("C_HI_CONTRAST"); - -/* 3d frozen display */ - - case C_FROZ_DISPLAY: return("C_FROZ_DISPLAY"); - -/* Booleans */ - case C_BOOLWELD: return("C_BOOLWELD"); - case C_BOOLTYPE: return("C_BOOLTYPE"); - - case C_ANG_THRESH: return("C_ANG_THRESH"); - case C_SS_THRESH: return("C_SS_THRESH"); - case C_TEXTURE_BLUR_DEFAULT: return("C_TEXTURE_BLUR_DEFAULT"); - - case C_MAPDRAWER: return("C_MAPDRAWER"); - case C_MAPDRAWER1: return("C_MAPDRAWER1"); - case C_MAPDRAWER2: return("C_MAPDRAWER2"); - case C_MAPDRAWER3: return("C_MAPDRAWER3"); - case C_MAPDRAWER4: return("C_MAPDRAWER4"); - case C_MAPDRAWER5: return("C_MAPDRAWER5"); - case C_MAPDRAWER6: return("C_MAPDRAWER6"); - case C_MAPDRAWER7: return("C_MAPDRAWER7"); - case C_MAPDRAWER8: return("C_MAPDRAWER8"); - case C_MAPDRAWER9: return("C_MAPDRAWER9"); - case C_MAPDRAWER_ENTRY: return("C_MAPDRAWER_ENTRY"); - -/* system options */ - case C_BACKUP_FILE: return("C_BACKUP_FILE"); - case C_DITHER_256: return("C_DITHER_256"); - case C_SAVE_LAST: return("C_SAVE_LAST"); - case C_USE_ALPHA: return("C_USE_ALPHA"); - case C_TGA_DEPTH: return("C_TGA_DEPTH"); - case C_REND_FIELDS: return("C_REND_FIELDS"); - case C_REFLIP: return("C_REFLIP"); - case C_SEL_ITEMTOG: return("C_SEL_ITEMTOG"); - case C_SEL_RESET: return("C_SEL_RESET"); - case C_STICKY_KEYINF: return("C_STICKY_KEYINF"); - case C_WELD_THRESHOLD: return("C_WELD_THRESHOLD"); - case C_ZCLIP_POINT: return("C_ZCLIP_POINT"); - case C_ALPHA_SPLIT: return("C_ALPHA_SPLIT"); - case C_KF_SHOW_BACKFACE: return("C_KF_SHOW_BACKFACE"); - case C_OPTIMIZE_LOFT: return("C_OPTIMIZE_LOFT"); - case C_TENS_DEFAULT: return("C_TENS_DEFAULT"); - case C_CONT_DEFAULT: return("C_CONT_DEFAULT"); - case C_BIAS_DEFAULT: return("C_BIAS_DEFAULT"); - - case C_DXFNAME_SRC : return("C_DXFNAME_SRC "); - case C_AUTO_WELD : return("C_AUTO_WELD "); - case C_AUTO_UNIFY : return("C_AUTO_UNIFY "); - case C_AUTO_SMOOTH : return("C_AUTO_SMOOTH "); - case C_DXF_SMOOTH_ANG : return("C_DXF_SMOOTH_ANG "); - case C_SMOOTH_ANG : return("C_SMOOTH_ANG "); - -/* Special network-use chunks */ - - case C_NET_USE_VPOST: return("C_NET_USE_VPOST"); - case C_NET_USE_GAMMA: return("C_NET_USE_GAMMA"); - case C_NET_FIELD_ORDER: return("C_NET_FIELD_ORDER"); - - case C_BLUR_FRAMES: return("C_BLUR_FRAMES"); - case C_BLUR_SAMPLES: return("C_BLUR_SAMPLES"); - case C_BLUR_DUR: return("C_BLUR_DUR"); - case C_HOT_METHOD: return("C_HOT_METHOD"); - case C_HOT_CHECK: return("C_HOT_CHECK"); - case C_PIXEL_SIZE: return("C_PIXEL_SIZE"); - case C_DISP_GAMMA: return("C_DISP_GAMMA"); - case C_FBUF_GAMMA: return("C_FBUF_GAMMA"); - case C_FILE_OUT_GAMMA: return("C_FILE_OUT_GAMMA"); - case C_FILE_IN_GAMMA: return("C_FILE_IN_GAMMA"); - case C_GAMMA_CORRECT: return("C_GAMMA_CORRECT"); - case C_APPLY_DISP_GAMMA: return("C_APPLY_DISP_GAMMA"); - case C_APPLY_FBUF_GAMMA: return("C_APPLY_FBUF_GAMMA"); - case C_APPLY_FILE_GAMMA: return("C_APPLY_FILE_GAMMA"); - case C_FORCE_WIRE: return("C_FORCE_WIRE"); - case C_RAY_SHADOWS: return("C_RAY_SHADOWS"); - case C_MASTER_AMBIENT: return("C_MASTER_AMBIENT"); - case C_SUPER_SAMPLE: return("C_SUPER_SAMPLE"); - case C_OBJECT_MBLUR: return("C_OBJECT_MBLUR"); - case C_MBLUR_DITHER: return("C_MBLUR_DITHER"); - case C_DITHER_24: return("C_DITHER_24"); - case C_SUPER_BLACK: return("C_SUPER_BLACK"); - case C_SAFE_FRAME: return("C_SAFE_FRAME"); - case C_VIEW_PRES_RATIO: return("C_VIEW_PRES_RATIO"); - case C_BGND_PRES_RATIO: return("C_BGND_PRES_RATIO"); - case C_NTH_SERIAL_NUM: return("C_NTH_SERIAL_NUM"); - - case VPDATA: return("VPDATA"); - - case P_QUEUE_ENTRY: return("P_QUEUE_ENTRY"); - case P_QUEUE_IMAGE: return("P_QUEUE_IMAGE"); - case P_QUEUE_USEIGAMMA: return("P_QUEUE_USEIGAMMA"); - case P_QUEUE_PROC: return("P_QUEUE_PROC"); - case P_QUEUE_SOLID: return("P_QUEUE_SOLID"); - case P_QUEUE_GRADIENT: return("P_QUEUE_GRADIENT"); - case P_QUEUE_KF: return("P_QUEUE_KF"); - case P_QUEUE_MOTBLUR: return("P_QUEUE_MOTBLUR"); - case P_QUEUE_MB_REPEAT: return("P_QUEUE_MB_REPEAT"); - case P_QUEUE_NONE: return("P_QUEUE_NONE"); - - case P_QUEUE_RESIZE: return("P_QUEUE_RESIZE"); - case P_QUEUE_OFFSET: return("P_QUEUE_OFFSET"); - case P_QUEUE_ALIGN: return("P_QUEUE_ALIGN"); - - case P_CUSTOM_SIZE: return("P_CUSTOM_SIZE"); - - case P_ALPH_NONE: return("P_ALPH_NONE"); - case P_ALPH_PSEUDO: return("P_ALPH_PSEUDO"); - case P_ALPH_OP_PSEUDO: return("P_ALPH_OP_PSEUDO"); - case P_ALPH_BLUR: return("P_ALPH_BLUR"); - case P_ALPH_PCOL: return("P_ALPH_PCOL"); - case P_ALPH_C0: return("P_ALPH_C0"); - case P_ALPH_OP_KEY: return("P_ALPH_OP_KEY"); - case P_ALPH_KCOL: return("P_ALPH_KCOL"); - case P_ALPH_OP_NOCONV: return("P_ALPH_OP_NOCONV"); - case P_ALPH_IMAGE: return("P_ALPH_IMAGE"); - case P_ALPH_ALPHA: return("P_ALPH_ALPHA"); - case P_ALPH_QUES: return("P_ALPH_QUES"); - case P_ALPH_QUEIMG: return("P_ALPH_QUEIMG"); - case P_ALPH_CUTOFF: return("P_ALPH_CUTOFF"); - case P_ALPHANEG: return("P_ALPHANEG"); - - case P_TRAN_NONE: return("P_TRAN_NONE"); - case P_TRAN_IMAGE: return("P_TRAN_IMAGE"); - case P_TRAN_FRAMES: return("P_TRAN_FRAMES"); - case P_TRAN_FADEIN: return("P_TRAN_FADEIN"); - case P_TRAN_FADEOUT: return("P_TRAN_FADEOUT"); - case P_TRANNEG: return("P_TRANNEG"); - - case P_RANGES: return("P_RANGES"); - - case P_PROC_DATA: return("P_PROC_DATA"); - - default : return("UNKNOWN_CHUNK"); - } -} - diff --git a/3rdparty/3dsftk3/src/3dsutil.h b/3rdparty/3dsftk3/src/3dsutil.h deleted file mode 100644 index 2e2bfce5..00000000 --- a/3rdparty/3dsftk3/src/3dsutil.h +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef UTIL_3DS_H -#define UTIL_3DS_H - -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dsftkst.h" -#include "chunk3ds.h" -#include "chunkinf.h" - -/* Function Prototypes */ -char3ds *indent(short3ds level); -char3ds *ChunkTagToString3ds(chunktag3ds tag); -void ChunkHeaderReport3ds(FILE *outfile, chunk3ds *chunk, ushort3ds indentlevel); -void PrintKeyHeader3ds(FILE *outfile, keyheader3ds *key, ushort3ds indentlevel); - - - -#endif - - - - - diff --git a/3rdparty/3dsftk3/src/3dsvers.c b/3rdparty/3dsftk3/src/3dsvers.c deleted file mode 100644 index e41a9b6e..00000000 --- a/3rdparty/3dsftk3/src/3dsvers.c +++ /dev/null @@ -1,392 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* Module Overview: - 3dsvers.c, 3dsvers.h - File Release related functions. - -*/ - -#include -#include -#include "3dstype.h" -#include "dbase3ds.h" -#include "3dsprim.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dsvers.h" -#include "3dserr.h" - -/* Scans the database for M3D_VERSION chunk and returnes its release */ -releaselevel3ds GetM3dMagicRelease3ds(database3ds *db) -{ - chunk3ds *c = NULL; - - if (db == NULL) - ADD_ERROR_RETURNR(ERR_INVALID_ARG, ReleaseNotKnown3ds); - - if (db->topchunk == NULL) - ADD_ERROR_RETURNR(ERR_INVALID_DATABASE, ReleaseNotKnown3ds); - - /* If the database is a 3DS file */ - if (db->topchunk->tag == M3DMAGIC) - { - FindChunk3ds(db->topchunk, M3D_VERSION, &c); - - if (c != NULL) - { - M3dVersion *d; - d = ReadChunkData3ds(c); - - if (d->version == 1) return Release13ds; - else - if (d->version == 2) return Release23ds; - else - if (d->version == 3) return Release33ds; - else - return ReleaseNotKnown3ds; - } - else - return ReleaseNotKnown3ds; - } - else - return ReleaseNotKnown3ds; -} - -/* Sets the M3dMagicRelease level */ -void PutM3dMagicRelease3ds(database3ds *db, releaselevel3ds release) -{ - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATA); - - if (db->topchunk->tag == M3DMAGIC) - { - chunk3ds *c; - M3dVersion *d; - - ReplaceOrAddChild3ds(db->topchunk, M3D_VERSION, &c); - ON_ERROR_RETURN; - d = InitChunkData3ds(c); - ON_ERROR_RETURN; - - switch(release) - { - case Release13ds: - d->version = 1; - break; - case Release23ds: - d->version = 2; - break; - case Release33ds: - d->version = 3; - break; - case ReleaseNotKnown3ds: - d->version = 4; - } - } - -} - -/* Scans the database for MESH_VERSION chunk and returnes its release */ -releaselevel3ds GetMeshRelease3ds(database3ds *db) -{ - chunk3ds *c = NULL; - - if (db == NULL) - ADD_ERROR_RETURNR(ERR_INVALID_ARG, ReleaseNotKnown3ds); - - if (db->topchunk == NULL) - ADD_ERROR_RETURNR(ERR_INVALID_DATABASE, ReleaseNotKnown3ds); - - /* If the database is a 3DS file */ - if ((db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - { - FindChunk3ds(db->topchunk, MESH_VERSION, &c); - - if (c != NULL) - { - MeshVersion *d; - d = ReadChunkData3ds(c); - - if (d->version == 1) return Release13ds; - else - if (d->version == 2) return Release23ds; - else - if (d->version == 3) return Release33ds; - else - return ReleaseNotKnown3ds; - } - else - return ReleaseNotKnown3ds; - } - else - return ReleaseNotKnown3ds; -} - -/* Sets the MeshRelease level */ -void PutMeshRelease3ds(database3ds *db, releaselevel3ds release) -{ - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATA); - - if ((db->topchunk->tag == M3DMAGIC) || (db->topchunk->tag == CMAGIC)) - { - chunk3ds *mdata; - chunk3ds *c; - M3dVersion *d; - - - FindChunk3ds(db->topchunk, MDATA, &mdata); - - if (mdata == NULL) - { - InitChunkAs3ds(&mdata, MDATA); - AddChildOrdered3ds(db->topchunk, mdata); - } - - ReplaceOrAddChild3ds(mdata, MESH_VERSION, &c); - d = InitChunkData3ds(c); - - switch(release) - { - case Release13ds: - d->version = 1; - break; - case Release23ds: - d->version = 2; - break; - case Release33ds: - d->version = 3; - break; - case ReleaseNotKnown3ds: - d->version = 4; - } - } -} - -/* Scans the database for KFHDR chunk and returnes its release level */ -releaselevel3ds GetKfRelease3ds(database3ds *db) -{ - chunk3ds *c = NULL, *kfdata; - - if (db == NULL) - SET_ERROR_RETURNR(ERR_INVALID_ARG, ReleaseNotKnown3ds); - if (db->topchunk == NULL) - SET_ERROR_RETURNR(ERR_INVALID_DATABASE, ReleaseNotKnown3ds); - - /* If the database is a 3DS file */ - if ((db->topchunk->tag == M3DMAGIC || db->topchunk->tag == CMAGIC)) - { - FindChunk3ds(db->topchunk, KFDATA, &kfdata); - - if (kfdata != NULL) - FindChunk3ds(db->topchunk, KFHDR, &c); - - if (c != NULL) - { - KFHdr *d; - d = ReadChunkData3ds(c); - - if (d->revision == 1) return Release13ds; - else - if (d->revision == 2) return Release23ds; - else - if (d->revision == 5) return Release33ds; - else - return ReleaseNotKnown3ds; - } - else - return ReleaseNotKnown3ds; - } - else - return ReleaseNotKnown3ds; -} - -/* Sets the KFDATA release level */ -void PutKfRelease3ds(database3ds *db, releaselevel3ds release) -{ - KFHdr *d; - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - if ((db->topchunk->tag == M3DMAGIC) || (db->topchunk->tag == CMAGIC)) - { - chunk3ds *kfdata; - chunk3ds *kfhdr; - - /* Find the KFDATA section */ - FindChunk3ds(db->topchunk, KFDATA, &kfdata); - - /* If one doesn't exist, then create it */ - if (kfdata == NULL) - { - InitChunkAs3ds(&kfdata, KFDATA); - AddChildOrdered3ds(db->topchunk, kfdata); - } - - /* Find the KFHDR */ - FindChunk3ds(kfdata, KFHDR, &kfhdr); - - /* If a KFHDR doesn't exist, then create it */ - if (kfhdr == NULL) - { - - d = InitChunkAndData3ds(&kfhdr, KFHDR); - d->filename = strdup(""); - d->animlength = 30; /* Just a default */ - AddChildOrdered3ds(kfdata, kfhdr); - - } else /* Else, just get its data */ - { - d = ReadChunkData3ds(kfhdr); - } - - /* Set the revision level */ - switch(release) - { - case Release13ds: - d->revision = 1; - break; - case Release23ds: - d->revision = 2; - break; - case Release33ds: - d->revision = 5; - break; - case ReleaseNotKnown3ds: - d->revision = 6; - break; - } - } -} - -releaselevel3ds GetDatabaseRelease3ds(database3ds *db) -{ - dbtype3ds dtype; - - dtype = GetDatabaseType3ds(db); - - switch(dtype) - { - case MeshFile: - return GetM3dMagicRelease3ds(db); - case ProjectFile: - return GetMeshRelease3ds(db); - case MaterialFile: - return Release33ds; - default: - return ReleaseNotKnown3ds; - } -} - -void PutDatabaseRelease3ds(database3ds *db, releaselevel3ds rev) -{ - dbtype3ds dtype; - - dtype = GetDatabaseType3ds(db); - - switch(dtype) - { - case MeshFile: - PutM3dMagicRelease3ds(db, rev); - case ProjectFile: - PutMeshRelease3ds(db, rev); - PutKfRelease3ds(db, rev); - break; - default: - break; - } -} diff --git a/3rdparty/3dsftk3/src/3dsvers.h b/3rdparty/3dsftk3/src/3dsvers.h deleted file mode 100644 index de2ef4e7..00000000 --- a/3rdparty/3dsftk3/src/3dsvers.h +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/* Module Overview: - 3dsvers.c, 3dsvers.h - File Version related functions. - -*/ - - -typedef enum -{ - Release13ds, - Release23ds, - Release33ds, - ReleaseNotKnown3ds -} releaselevel3ds; - -releaselevel3ds GetM3dMagicRelease3ds(database3ds *db); -void PutM3dMagicRelease3ds(database3ds *db, releaselevel3ds release); -releaselevel3ds GetMeshRelease3ds(database3ds *db); -void PutMeshRelease3ds(database3ds *db, releaselevel3ds release); -releaselevel3ds GetKfRelease3ds(database3ds *db); -void PutKfRelease3ds(database3ds *db, releaselevel3ds release); -releaselevel3ds GetDatabaseRelease3ds(database3ds *db); -void PutDatabaseRelease3ds(database3ds *db, releaselevel3ds rev); diff --git a/3rdparty/3dsftk3/src/3dsvprt.c b/3rdparty/3dsftk3/src/3dsvprt.c deleted file mode 100644 index 667648c5..00000000 --- a/3rdparty/3dsftk3/src/3dsvprt.c +++ /dev/null @@ -1,800 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - - -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsftkst.h" -#include "chunk3ds.h" -#include "dbase3ds.h" -#include "3dsvprt.h" - -void InitViewport3ds(viewport3ds **vp) -{ - viewport3ds *v; - - if (vp == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - - v = *vp; - - if (v == NULL) - { - v = malloc(sizeof(viewport3ds)); - if (v == NULL) SET_ERROR_RETURN(ERR_NO_MEM); - *vp = v; - } - - v->type = TopView3ds; - v->ortho.center.x = 0.0f; - v->ortho.center.y = v->ortho.center.z = 0.0f; - v->ortho.zoom = 0.7395f; - v->user.center.x = v->user.center.y = v->user.center.z = 0.0f; - v->user.zoom = 0.7395f; - v->user.horang = 20.0f; - v->user.verang = 30.0f; - v->camera.name[0] = 0; - v->size.xpos = 0; - v->size.ypos = 0; - v->size.width = 1000; - v->size.height = 1000; - -} - -void ReleaseViewport3ds(viewport3ds **vp) -{ - if (vp != NULL) - { - free(*vp); - *vp = NULL; - } -} - -void GetViewportEntry3ds(chunk3ds *section, viewport3ds **vp) -{ - chunk3ds *vlay, *c; - ViewportLayout *dvlay; - ViewportSize *dvsize; - ViewportData *dvdata; - long3ds portindex = 0; - byte3ds foundv3 = False3ds; - viewport3ds *v; - - FindNextChunk3ds(section->children, VIEWPORT_LAYOUT, &vlay); - - if (vlay != NULL) - { - InitViewport3ds(vp); - ADD_ERROR_RETURN(ERR_GET_FAIL); - - v = *vp; - - dvlay = ReadChunkData3ds(vlay); - ADD_ERROR_RETURN(ERR_GET_FAIL); - - for (c = vlay->children; c != NULL; c = c->sibling) - { - switch(c->tag) - { - case VIEWPORT_SIZE: - dvsize = ReadChunkData3ds(c); - ADD_ERROR_RETURN(ERR_GET_FAIL); - v->size.xpos = dvsize->xpos; - v->size.ypos = dvsize->ypos; - v->size.width = dvsize->width; - v->size.height = dvsize->height; - break; - case VIEWPORT_DATA_3: - foundv3 = True3ds; - if (portindex == dvlay->top) - { - dvdata = ReadChunkData3ds(c); - ADD_ERROR_RETURN(ERR_GET_FAIL); - - switch(dvdata->view) - { - case 0: - v->type = NoView3ds; - break; - case 1: - v->type = TopView3ds; - break; - case 2: - v->type = BottomView3ds; - break; - case 3: - v->type = LeftView3ds; - break; - case 4: - v->type = RightView3ds; - break; - case 5: - v->type = FrontView3ds; - break; - case 6: - v->type = BackView3ds; - break; - case 7: - v->type = UserView3ds; - break; - case 0xFFFF: - v->type = CameraView3ds; - break; - case 18: - v->type = SpotlightView3ds; - break; - default: - v->type = NoView3ds; - } - - v->ortho.zoom = v->user.zoom = dvdata->zoomfactor; - v->ortho.center.x = v->user.center.x = dvdata->center.x; - v->ortho.center.y = v->user.center.y = dvdata->center.y; - v->ortho.center.z = v->user.center.z = dvdata->center.z; - v->user.horang = dvdata->horizang; - v->user.verang = dvdata->vertang; - strcpy(v->camera.name, dvdata->camname); - - } - portindex++; - break; - case VIEWPORT_DATA: - if (foundv3) break; - if (portindex == dvlay->top) - { - dvdata = ReadChunkData3ds(c); - ADD_ERROR_RETURN(ERR_GET_FAIL); - - switch(dvdata->view) - { - case 0: - v->type = NoView3ds; - break; - case 1: - v->type = TopView3ds; - break; - case 2: - v->type = BottomView3ds; - break; - case 3: - v->type = LeftView3ds; - break; - case 4: - v->type = RightView3ds; - break; - case 5: - v->type = FrontView3ds; - break; - case 6: - v->type = BackView3ds; - break; - case 7: - v->type = UserView3ds; - break; - case 0xFFFF: - v->type = CameraView3ds; - break; - case 18: - v->type = SpotlightView3ds; - break; - default: - v->type = NoView3ds; - } - - v->ortho.zoom = v->user.zoom = dvdata->zoomfactor; - v->ortho.center.x = v->user.center.x = dvdata->center.x; - v->ortho.center.y = v->user.center.y = dvdata->center.y; - v->ortho.center.z = v->user.center.z = dvdata->center.z; - v->user.horang = dvdata->horizang; - v->user.verang = dvdata->vertang; - strcpy(v->camera.name, dvdata->camname); - - } - portindex++; - break; - } - } - } else - { - /* Not Viewport Layout in file */ - *vp = NULL; - } -} - -/* Searches an MDATA chunk looking for a DEFAULT_VIEW chunk. *vp should allready be - initialized before passing it to this function */ -void GetDefaultView3ds(chunk3ds *section, viewport3ds *vp) -{ - chunk3ds *defv; - chunk3ds *vtype = NULL; - - myassert(vp != NULL, "GetDefaultView3ds: arg *vp is NULL"); - - if (section->tag == MDATA) - { - FindNextChunk3ds(section->children, DEFAULT_VIEW, &defv); - - if (defv != NULL) vtype = defv->children; - - if (vtype != NULL) - { - switch(vtype->tag) - { - case VIEW_TOP: - { - ViewStandard *d; - d = ReadChunkData3ds(vtype); - vp->type = TopView3ds; - vp->ortho.center.x = d->viewtargetcoord.x; - vp->ortho.center.y = d->viewtargetcoord.y; - vp->ortho.center.z = d->viewtargetcoord.z; - vp->ortho.zoom = d->viewwidth / (float3ds)vp->size.width; - break; - } - case VIEW_BOTTOM: - { - ViewStandard *d; - d = ReadChunkData3ds(vtype); - vp->type = TopView3ds; - vp->ortho.center.x = d->viewtargetcoord.x; - vp->ortho.center.y = d->viewtargetcoord.y; - vp->ortho.center.z = d->viewtargetcoord.z; - vp->ortho.zoom = d->viewwidth / (float3ds)vp->size.width; - break; - } - case VIEW_LEFT: - { - ViewStandard *d; - d = ReadChunkData3ds(vtype); - vp->type = TopView3ds; - vp->ortho.center.x = d->viewtargetcoord.x; - vp->ortho.center.y = d->viewtargetcoord.y; - vp->ortho.center.z = d->viewtargetcoord.z; - vp->ortho.zoom = d->viewwidth / (float3ds)vp->size.width; - break; - - } - case VIEW_RIGHT: - { - ViewStandard *d; - d = ReadChunkData3ds(vtype); - vp->type = TopView3ds; - vp->ortho.center.x = d->viewtargetcoord.x; - vp->ortho.center.y = d->viewtargetcoord.y; - vp->ortho.center.z = d->viewtargetcoord.z; - vp->ortho.zoom = d->viewwidth / (float3ds)vp->size.width; - break; - - } - case VIEW_FRONT: - { - ViewStandard *d; - d = ReadChunkData3ds(vtype); - vp->type = TopView3ds; - vp->ortho.center.x = d->viewtargetcoord.x; - vp->ortho.center.y = d->viewtargetcoord.y; - vp->ortho.center.z = d->viewtargetcoord.z; - vp->ortho.zoom = d->viewwidth / (float3ds)vp->size.width; - break; - - } - case VIEW_BACK: - { - ViewStandard *d; - d = ReadChunkData3ds(vtype); - vp->type = TopView3ds; - vp->ortho.center.x = d->viewtargetcoord.x; - vp->ortho.center.y = d->viewtargetcoord.y; - vp->ortho.center.z = d->viewtargetcoord.z; - vp->ortho.zoom = d->viewwidth / (float3ds)vp->size.width; - break; - - } - case VIEW_USER: - { - ViewUser *d; - d = ReadChunkData3ds(vtype); - vp->type = UserView3ds; - vp->user.center.x = d->viewtargetcoord.x; - vp->user.center.y = d->viewtargetcoord.y; - vp->user.center.z = d->viewtargetcoord.z; - vp->user.zoom = d->viewwidth / (float3ds)vp->size.width; - vp->user.horang = d->xyviewangle; - vp->user.verang = d->yzviewangle; - break; - - } - case VIEW_CAMERA: - { - ViewCamera *d; - d = ReadChunkData3ds(vtype); - vp->type = CameraView3ds; - strcpy(vp->camera.name, d->name); - break; - - } - } - - } - } -} - -void PutDefaultView3ds(chunk3ds *section, viewport3ds *vp) -{ - chunk3ds *defv, *vtype; - - myassert(vp != NULL, "GetDefaultView3ds: arg *vp is NULL"); - - if (section->tag == MDATA) - { - ReplaceOrAddChild3ds(section, DEFAULT_VIEW, &defv); - ON_ERROR_RETURN; - - switch(vp->type) - { - case TopView3ds: - { - ViewStandard *d; - d = InitChunkAndData3ds(&vtype, VIEW_TOP); - d->viewtargetcoord.x = vp->ortho.center.x; - d->viewtargetcoord.y = vp->ortho.center.y; - d->viewtargetcoord.z = vp->ortho.center.z; - d->viewwidth = (float3ds)vp->size.width / vp->ortho.zoom; - AddChildOrdered3ds(defv, vtype); - break; - } - case BottomView3ds: - { - ViewStandard *d; - d = InitChunkAndData3ds(&vtype, VIEW_BOTTOM); - d->viewtargetcoord.x = vp->ortho.center.x; - d->viewtargetcoord.y = vp->ortho.center.y; - d->viewtargetcoord.z = vp->ortho.center.z; - d->viewwidth = (float3ds)vp->size.width / vp->ortho.zoom; - AddChildOrdered3ds(defv, vtype); - break; - } - case LeftView3ds: - { - ViewStandard *d; - d = InitChunkAndData3ds(&vtype, VIEW_LEFT); - d->viewtargetcoord.x = vp->ortho.center.x; - d->viewtargetcoord.y = vp->ortho.center.y; - d->viewtargetcoord.z = vp->ortho.center.z; - d->viewwidth = (float3ds)vp->size.width / vp->ortho.zoom; - AddChildOrdered3ds(defv, vtype); - break; - } - case RightView3ds: - { - ViewStandard *d; - d = InitChunkAndData3ds(&vtype, VIEW_RIGHT); - d->viewtargetcoord.x = vp->ortho.center.x; - d->viewtargetcoord.y = vp->ortho.center.y; - d->viewtargetcoord.z = vp->ortho.center.z; - d->viewwidth = (float3ds)vp->size.width / vp->ortho.zoom; - AddChildOrdered3ds(defv, vtype); - break; - } - case FrontView3ds: - { - ViewStandard *d; - d = InitChunkAndData3ds(&vtype, VIEW_FRONT); - d->viewtargetcoord.x = vp->ortho.center.x; - d->viewtargetcoord.y = vp->ortho.center.y; - d->viewtargetcoord.z = vp->ortho.center.z; - d->viewwidth = (float3ds)vp->size.width / vp->ortho.zoom; - AddChildOrdered3ds(defv, vtype); - break; - } - case BackView3ds: - { - ViewStandard *d; - d = InitChunkAndData3ds(&vtype, VIEW_BOTTOM); - d->viewtargetcoord.x = vp->ortho.center.x; - d->viewtargetcoord.y = vp->ortho.center.y; - d->viewtargetcoord.z = vp->ortho.center.z; - d->viewwidth = (float3ds)vp->size.width / vp->ortho.zoom; - AddChildOrdered3ds(defv, vtype); - break; - } - case UserView3ds: - { - ViewUser *d; - d = InitChunkAndData3ds(&vtype, VIEW_USER); - d->viewtargetcoord.x = vp->user.center.x; - d->viewtargetcoord.y = vp->user.center.y; - d->viewtargetcoord.z = vp->user.center.z; - d->viewwidth = (float3ds)vp->size.width / vp->user.zoom; - d->xyviewangle = vp->user.horang; - d->yzviewangle = vp->user.verang; - AddChildOrdered3ds(defv, vtype); - break; - } - case CameraView3ds: - { - ViewCamera *d; - d = InitChunkAndData3ds(&vtype, VIEW_CAMERA); - d->name = strdup(vp->camera.name); - AddChildOrdered3ds(defv, vtype); - break; - } - } - } -} - -void PutViewportEntry3ds(chunk3ds *section, viewport3ds *vp) -{ - chunk3ds *vlay, *vsize, *vdata, *c; - ViewportLayout *dvlay; - ViewportSize *dvsize; - ViewportData *dvdata; - ulong3ds i; - - /* Delete any existing viewport layout chunks */ - FindNextChunk3ds(section->children, VIEWPORT_LAYOUT, &vlay); - if (vlay != NULL) - { - DeleteChunk3ds(vlay); - /* Retag it so it can be used again */ - vlay->tag = VIEWPORT_LAYOUT; - } else - { - InitChunkAs3ds(&vlay, VIEWPORT_LAYOUT); - ON_ERROR_RETURN; - AddChildOrdered3ds(section, vlay); - ON_ERROR_RETURN; - } - - dvlay = InitChunkData3ds(vlay); - ON_ERROR_RETURN; - - /* init view to a single view configuration */ - dvlay->form = 0; - dvlay->top = 0; - dvlay->ready = 1; - dvlay->wstate = 0; - dvlay->swapws = 0; - dvlay->swapport = 0; - dvlay->swapcur = 0; - - dvsize = InitChunkAndData3ds(&vsize, VIEWPORT_SIZE); - dvsize->xpos = vp->size.xpos; - dvsize->ypos = vp->size.ypos; - dvsize->width = vp->size.width; - dvsize->height = vp->size.height; - - AddChildOrdered3ds(vlay, vsize); - - dvdata = InitChunkAndData3ds(&vdata, VIEWPORT_DATA_3); - - dvdata->flags = 1; - dvdata->axislockout = 0; - dvdata->winxpos = vp->size.xpos; - dvdata->winypos = vp->size.ypos; - dvdata->winwidth = vp->size.width; - dvdata->winheight = vp->size.height; - - switch (vp->type) - { - case TopView3ds: - dvdata->view = 1; - break; - case BottomView3ds: - dvdata->view = 2; - break; - case LeftView3ds: - dvdata->view = 3; - break; - case RightView3ds: - dvdata->view = 4; - break; - case FrontView3ds: - dvdata->view = 5; - break; - case BackView3ds: - dvdata->view = 6; - break; - case UserView3ds: - dvdata->view = 7; - break; - case CameraView3ds: - dvdata->view = 0xFFFF; - break; - case SpotlightView3ds: - dvdata->view = 18; - break; - } - - switch(vp->type) - { - case TopView3ds: - case BottomView3ds: - case LeftView3ds: - case RightView3ds: - case FrontView3ds: - case BackView3ds: - dvdata->zoomfactor = vp->ortho.zoom; - dvdata->center.x = vp->ortho.center.x; - dvdata->center.y = vp->ortho.center.y; - dvdata->center.z = vp->ortho.center.z; - dvdata->horizang = 20.0f; - dvdata->vertang = 30.0f; - dvdata->camname = strdup(""); - break; - case UserView3ds: - dvdata->zoomfactor = vp->user.zoom; - dvdata->center.x = vp->user.center.x; - dvdata->center.y = vp->user.center.y; - dvdata->center.z = vp->user.center.z; - dvdata->horizang = vp->user.horang; - dvdata->vertang = vp->user.verang; - dvdata->camname = strdup(""); - break; - case CameraView3ds: - dvdata->zoomfactor = 0.0f; - dvdata->center.x = 0.0f; - dvdata->center.y = 0.0f; - dvdata->center.z = 0.0f; - dvdata->horizang = 20.0f; - dvdata->vertang = 30.0f; - dvdata->camname = strdup(vp->camera.name); - break; - } - - /* Duplicate the same port 5 times */ - for (i = 0; i < 5; i++) - { - CopyChunk3ds(vdata, &c); - ON_ERROR_RETURN; - - AddChildOrdered3ds(vlay, c); - ON_ERROR_RETURN; - } - - /* Change to the old style port */ - vdata->tag = VIEWPORT_DATA; - for (i = 0; i < 5; i++) - { - CopyChunk3ds(vdata, &c); - ON_ERROR_RETURN; - - AddChildOrdered3ds(vlay, c); - ON_ERROR_RETURN; - } - - ReleaseChunk3ds(&vdata); - ON_ERROR_RETURN; - -} - -void GetViewport3ds(database3ds *db, viewport3ds **vp) -{ - chunk3ds *kfdata; - - if ((db == NULL) || (vp == NULL)) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != M3DMAGIC) && (db->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - FindNextChunk3ds(db->topchunk->children, KFDATA, &kfdata); - if (kfdata != NULL) - { - GetViewportEntry3ds(kfdata, vp); - ON_ERROR_RETURN; - } else { - FindChunk3ds(db->topchunk->children, MDATA, &kfdata); - if (kfdata != NULL) - { - GetViewportEntry3ds(kfdata, vp); - ON_ERROR_RETURN; - } - } -} - - -void PutViewport3ds(database3ds *db, viewport3ds *vp) -{ - chunk3ds *mdata, *kfdata; - - if ((db == NULL) || (vp == NULL)) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != M3DMAGIC) && (db->topchunk->tag != CMAGIC)) SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find or create the mdata section */ - FindNextChunk3ds(db->topchunk->children, MDATA, &mdata); - if (mdata == NULL) - { - InitChunkAs3ds(&mdata, MDATA); - ON_ERROR_RETURN; - - AddChildOrdered3ds(db->topchunk, mdata); - } - - PutViewportEntry3ds(mdata, vp); - ON_ERROR_RETURN; - - PutDefaultView3ds(mdata, vp); - ON_ERROR_RETURN; - - - /* Find or create the kfdata section */ - FindNextChunk3ds(db->topchunk->children, KFDATA, &kfdata); - if (kfdata == NULL) - { - InitChunkAs3ds(&kfdata, KFDATA); - ON_ERROR_RETURN; - - AddChildOrdered3ds(db->topchunk, kfdata); - } - - PutViewportEntry3ds(kfdata, vp); - ON_ERROR_RETURN; -} - -void CopyViewport3ds(database3ds *destdb, database3ds *srcdb) -{ - chunk3ds *smdata, *skfdata, *dmdata, *dkfdata, *svp, *dvp; - - if ((destdb == NULL) || (srcdb == NULL)) SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find or make the mdata and kfdata sections in the destination */ - FindNextChunk3ds(destdb->topchunk->children, MDATA, &dmdata); - if (dmdata == NULL) - { - InitChunkAs3ds(&dmdata, MDATA); - ON_ERROR_RETURN; - - AddChildOrdered3ds(destdb->topchunk, dmdata); - } - - FindNextChunk3ds(destdb->topchunk->children, KFDATA, &dkfdata); - if (dkfdata == NULL) - { - InitChunkAs3ds(&dkfdata, KFDATA); - ON_ERROR_RETURN; - - AddChildOrdered3ds(destdb->topchunk, dkfdata); - } - - /* Find the mdata viewport in the source file */ - FindNextChunk3ds(srcdb->topchunk->children, MDATA, &smdata); - if (smdata != NULL) - { - /* Find the source viewport */ - FindNextChunk3ds(smdata->children, VIEWPORT_LAYOUT, &svp); - if (svp != NULL) - { - /* Find the viewport chunks (if any) in the destination and delete them */ - FindNextChunk3ds(dmdata->children, VIEWPORT_LAYOUT, &dvp); - if (dvp != NULL) DeleteChunk3ds(dvp); - - /* Copy the chunk */ - CopyChunk3ds(svp, &dvp); - ON_ERROR_RETURN; - - AddChildOrdered3ds(dmdata, dvp); - } - - FindNextChunk3ds(smdata->children, DEFAULT_VIEW, &svp); - if (svp != NULL) - { - FindNextChunk3ds(dmdata->children, DEFAULT_VIEW, &dvp); - if (dvp != NULL) DeleteChunk3ds(dvp); - - CopyChunk3ds(svp, &dvp); - ON_ERROR_RETURN; - - AddChildOrdered3ds(dmdata, dvp); - } - - } - - /* Find the kfdata viewport in the source file */ - FindNextChunk3ds(srcdb->topchunk->children, KFDATA, &skfdata); - if (skfdata != NULL) - { - FindNextChunk3ds(skfdata->children, VIEWPORT_LAYOUT, &svp); - if (svp != NULL) - { - /* Find the viewport chunks (if any) in the destination and delete them */ - FindNextChunk3ds(dkfdata->children, VIEWPORT_LAYOUT, &dvp); - if (dvp != NULL) DeleteChunk3ds(dvp); - - /* Copy the chunk */ - CopyChunk3ds(svp, &dvp); - ON_ERROR_RETURN; - - AddChildOrdered3ds(dkfdata, dvp); - } - } -} - diff --git a/3rdparty/3dsftk3/src/3dsvprt.h b/3rdparty/3dsftk3/src/3dsvprt.h deleted file mode 100644 index 2830605d..00000000 --- a/3rdparty/3dsftk3/src/3dsvprt.h +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef VPRT_3DS_H -#define VPRT_3DS_H - -/* Public Typedefs */ -typedef enum -{ - NoView3ds, - TopView3ds, - BottomView3ds, - LeftView3ds, - RightView3ds, - FrontView3ds, - BackView3ds, - UserView3ds, - CameraView3ds, - SpotlightView3ds -} viewtype3ds; - -typedef struct -{ - ushort3ds xpos; - ushort3ds ypos; - ushort3ds width; - ushort3ds height; -} viewsize3ds; - -/* Used to describe top, bottom, left, right, front and back views */ -typedef struct -{ - point3ds center; /* Center of orthagonal view */ - float3ds zoom; /* View zoom factor */ -} orthoview3ds; - -/* Used to describe user views */ -typedef struct -{ - point3ds center; /* Center of user view */ - float3ds zoom; /* View zoom factor */ - float3ds horang; /* Horizontal angle of view */ - float3ds verang; /* Veritical angle of view */ -} userview3ds; - -/* Used to describe camera views */ -typedef struct -{ - char3ds name[11]; /* Name of the camera used in the view */ -} cameraview3ds; - -/* Viewport structure details the kind of view in a viewport */ -typedef struct -{ - viewtype3ds type; /* top, bottom, left, right, front, back, user and camera */ - viewsize3ds size; /* Size of the viewport */ - orthoview3ds ortho; /* used for top, bottom, left, right, front, and back views */ - userview3ds user; /* Used for user views */ - cameraview3ds camera; /* Used for camera views */ -} viewport3ds; -/* End Public */ - -/* Public Prototypes */ -void InitViewport3ds(viewport3ds **vp); -void ReleaseViewport3ds(viewport3ds **vp); -void GetViewport3ds(database3ds *db, viewport3ds **vp); -void PutViewport3ds(database3ds *db, viewport3ds *vp); -void CopyViewport3ds(database3ds *destdb, database3ds *srcdb); -/* End Public */ - -void PutViewportEntry3ds(chunk3ds *section, viewport3ds *vp); - -#endif diff --git a/3rdparty/3dsftk3/src/assert.c b/3rdparty/3dsftk3/src/assert.c deleted file mode 100644 index 46d69ad0..00000000 --- a/3rdparty/3dsftk3/src/assert.c +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include - - -/* This function has two enhancements over the older asserts macro. One, when an - insertion fails, you can place a break point on the function and then back out - to the calling routine, two, the assertion has a message attached that can later - be converted to a run time error message */ -void assertfunc(int ex, char *msg, char *file, int line) -{ - if(!(ex)) - { - fprintf(stderr, "Assertion \"%s\" failed: file \"%s\", line %d\n", msg, file, line); - exit(1); - } -} - - diff --git a/3rdparty/3dsftk3/src/chunk3ds.c b/3rdparty/3dsftk3/src/chunk3ds.c deleted file mode 100644 index 6e005d96..00000000 --- a/3rdparty/3dsftk3/src/chunk3ds.c +++ /dev/null @@ -1,4188 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include - -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "chunkinf.h" -#include "3dsfile.h" -#include "chunk3ds.h" -#include "3dsrange.h" -#include "3dsftkst.h" -#include "3dsutil.h" -#include "3dserr.h" - -/* Initializes and allocates memory for a chunk. */ -void InitChunk3ds(chunk3ds **chunk) -{ - if (chunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - *chunk = malloc(sizeof(chunk3ds)); - if (chunk == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - /* set default values */ - (*chunk)->tag = NULL_CHUNK; - (*chunk)->size = 0; - (*chunk)->position = 0; - (*chunk)->data = NULL; - (*chunk)->sibling = NULL; - (*chunk)->children = NULL; - (*chunk)->readindex = InvalidFileContext3ds; - (*chunk)->writeindex = InvalidFileContext3ds; -} - -/* Initilizes and sets tag in one function */ -void InitChunkAs3ds(chunk3ds **chunk, chunktag3ds tag) -{ - sm_tag(ChunkTagToString3ds(tag)); - InitChunk3ds(chunk); - ON_ERROR_RETURN; - (*chunk)->tag = tag; - sm_untag(); -} - -void ReleaseChunk3ds(chunk3ds **chunk) -{ - /* free memory associated with chunk and substructure */ - if (chunk != NULL) - { - if (*chunk != NULL) - { - if ((*chunk)->data != NULL) - FreeChunkData3ds(*chunk); - ReleaseChunk3ds( &(*chunk)->children ); - ReleaseChunk3ds( &(*chunk)->sibling ); - } - free(*chunk); - *chunk = NULL; - } -} - -void ReleaseSiblingChunk3ds(chunk3ds **chunk) -{ - if (chunk != NULL) - { - if (*chunk != NULL) - { - if ((*chunk)->sibling != NULL) ReleaseSiblingChunk3ds(&((*chunk)->sibling)); - ReleaseChunk3ds(chunk); - } - } -} - -/* Delete chunk returns a chunk to its untagged state state, but leaves it - connected to any siblings it might have */ -void DeleteChunk3ds(chunk3ds *chunk) -{ - if (chunk != NULL) - { - /* release any children */ - if (chunk->children != NULL) ReleaseChunk3ds(&(chunk->children)); - - /* release any data */ - if (chunk->data != NULL) FreeChunkData3ds(chunk); - - /* return to a semi-uninitialized state */ - chunk->tag = NULL_CHUNK; - chunk->size = 0; - chunk->position = 0; - chunk->readindex = InvalidFileContext3ds; - chunk->writeindex = InvalidFileContext3ds; - } -} - -/* CheckChunk3ds checksum's a chunk, even the header and children */ -long3ds CheckChunk3ds(chunk3ds *chunk) -{ - long3ds sum = 0, nshorts, index; - ushort3ds *sumbuffer; - - SetContextByIndex3ds(chunk->readindex); - - nshorts = chunk->size / sizeof(ushort3ds); - - if ((chunk->size % sizeof(ushort3ds)) > 0) nshorts++; - - sumbuffer = malloc(sizeof(ushort3ds)*nshorts); - memset(sumbuffer, 0, sizeof(ushort3ds)*nshorts); - - FileSeek3ds(chunk->position); - ReadVoid3ds(chunk->size, sumbuffer); - - for (index = 0; index < nshorts; index++) - { - sum = sum + sumbuffer[index]; - } - free(sumbuffer); - - return sum; -} - -/* FindChunk3ds searchs the *top chunk and its children for a match */ -void FindChunk3ds(chunk3ds *top, chunktag3ds tag, chunk3ds **chunk) -{ - chunk3ds *child, *match; - - if (chunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - - if (top != NULL) - { - if (top->tag == tag) - { - *chunk = top; - return; - } - else - for (child = top->children; child != NULL; child = child->sibling) - { - FindChunk3ds(child, tag, &match); - if (match != NULL) - { - *chunk = match; - return; - } - } - - } - *chunk = NULL; -} - -void FindNextChunk3ds(chunk3ds *local, chunktag3ds tag, chunk3ds **chunk) -{ - chunk3ds *new=NULL, *current = local; - - myassert(chunk != NULL, "FindNextChunk3ds: arg **chunk cannot be NULL"); - - while ((current != NULL) && (new == NULL)) - { - if (current->tag == tag) new = current; - current = current->sibling; - } - *chunk = new; -} - -/* AddChild3ds puts the chunk at then end of the sibling list */ -void AddChild3ds(chunk3ds *parent, chunk3ds *child) -{ - chunk3ds *current=NULL; - - if ( parent->children == NULL) { - parent->children = child; - } - else { - current = parent->children; - while (current->sibling != NULL) { - current = current->sibling; - } - current->sibling = child; - } -} - -/* AddChildOrdered3ds will insert the child among its siblings depending - on the order of occurance set by the 3DS file. */ -void AddChildOrdered3ds(chunk3ds *parent, chunk3ds *child) -{ - chunk3ds *current, *prev; - long3ds childvalue; - - if (parent == NULL || child == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - childvalue = GetChunkValue3ds(child->tag); - - if (parent->children == NULL) - { - parent->children = child; - } else - { - for(current = parent->children, prev = NULL; current->sibling != NULL; prev=current,current=current->sibling) - { - if (childvalue > GetChunkValue3ds(current->tag)) - break; - } - - if (childvalue > GetChunkValue3ds(current->tag)) - { - child->sibling = current; - if (prev != NULL) prev->sibling = child; - else parent->children = child; - } else - { - child->sibling = current->sibling; - current->sibling = child; - } - } -} - -/* ReplaceOrAddChild3ds will search *parent's children for a chunk of tag type. If - it finds a match, it will delete the existing chunk and prepare it for new data - to be added. If there isn't a match, it adds the chunk to the *parent's children - and returns a reference to the new child in **child */ -void ReplaceOrAddChild3ds(chunk3ds *parent, chunktag3ds tag, chunk3ds **child) -{ - if (parent == NULL || child == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Search for child with tag */ - FindNextChunk3ds(parent->children, tag, child); - - /* if child chunk is found */ - if (*child != NULL) - { - /* delete the current contents of the chunk while preserving its list position */ - DeleteChunk3ds(*child); - /* give the deleted chunk the tag */ - (*child)->tag = tag; - } else /* create new chunk and add it */ - { - InitChunkAs3ds(child, tag); - ON_ERROR_RETURN; - AddChildOrdered3ds(parent, *child); - } -} - -void CopyChunk3ds(chunk3ds *ichunk, chunk3ds **ochunk) -{ - if (ichunk == NULL || ochunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - *ochunk = NULL; - InitChunk3ds(ochunk); - ON_ERROR_RETURN; - - (*ochunk)->tag = ichunk->tag; - (*ochunk)->size = ichunk->size; - (*ochunk)->position = ichunk->position; - (*ochunk)->readindex = ichunk->readindex; - (*ochunk)->writeindex = ichunk->writeindex; - - /* In order to minimize memory usage, chunk data that already - exists in a file mearly has its pointer handed off to the copy. - The data is only really copied if there is no file image of the - data */ - if (ichunk->data != NULL) - { - if (ichunk->readindex != InvalidFileContext3ds) - { - (*ochunk)->data = ichunk->data; - ichunk->data = NULL; - } else - CopyChunkData3ds(ichunk, *ochunk); - ON_ERROR_RETURN; - } - - if (ichunk->children != NULL) - { - chunk3ds *ic; - chunk3ds **oc; - - for(ic = ichunk->children, oc = &((*ochunk)->children); - ic != NULL; - ic = ic->sibling, oc = &((*oc)->sibling) - ) - { - - CopyChunk3ds(ic, oc); - ON_ERROR_RETURN; - } - - } - -} - -/* DisconnectChunk3ds - reads the data of a chunk and removes its reference to the - source file */ -void DisconnectChunk3ds(chunk3ds *chunk) -{ - myassert(chunk != NULL, "DisconnectChunk3ds: Arg *chunk cannot be NULL"); - - ReadChunkData3ds(chunk); - ON_ERROR_RETURN; - - chunk->readindex = InvalidFileContext3ds; - chunk->writeindex = InvalidFileContext3ds; - - if (chunk->children != NULL) - { - chunk3ds *ic; - - for (ic = chunk->children; ic != NULL; ic = ic->sibling) - { - DisconnectChunk3ds(ic); - ON_ERROR_RETURN; - } - } -} - -void InitChunkList3ds(chunklist3ds **list, ulong3ds count) -{ - ulong3ds i; - - if (list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (*list == NULL) - { - *list = malloc(sizeof(chunklist3ds)); - if (*list == NULL) - SET_ERROR_RETURN(ERR_NO_MEM) - } - - (*list)->count = count; - (*list)->list = NULL; - - if (count > 0) - { - (*list)->list = calloc(count, sizeof(chunklistentry3ds)); - if (*list == NULL) - SET_ERROR_RETURN(ERR_NO_MEM) - } - - for(i = 0; i < count; i++) - { - (*list)->list[i].name = NULL; - (*list)->list[i].chunk = NULL; - } -} - -void ReleaseChunkList3ds(chunklist3ds **list) -{ - ulong3ds i; - - if (list != NULL && *list != NULL) - { - if ((*list)->list != NULL) - { - for(i = 0; i < (*list)->count; i++) - { - free((*list)->list[i].name); - (*list)->list[i].chunk = NULL; - } - free((*list)->list); - } - free (*list); - *list = NULL; - } -} - -/*------------------------------------------------------------------------- - | InitNameList3ds - | If the list is initiated empty, make space for kGRANULE_SIZE entrie - | so as items are added we don't have to realloc the list. - | - +-------------------------------------------------------------------------*/ -static const long3ds kGRANULE_SIZE = 5; - -void InitNameList3ds(namelist3ds **list, ulong3ds count) -{ - ulong3ds i; - ulong3ds spaces; - - if (list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (*list == NULL) - { - *list = malloc(sizeof(namelist3ds)); - if (*list == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - } - - spaces = (count == 0)? kGRANULE_SIZE: count; - - (*list)->count = count; - (*list)->list = NULL; - (*list)->spaces = spaces; - - (*list)->list = calloc(spaces, sizeof(namelistentry3ds)); - if ((*list)->list == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - for (i = 0; i < spaces; i++) - { - (*list)->list[i].name = NULL; - } -} - -void ReleaseNameList3ds(namelist3ds **list) -{ - ulong3ds i; - - if (list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (*list != NULL) - { - if ((*list)->list != NULL) - { - for(i = 0; i < (*list)->spaces; i++) - { - if ((*list)->list[i].name != NULL) - free((*list)->list[i].name); - } - free((*list)->list); - } - free (*list); - *list = NULL; - } -} - -void AddToNameList3ds(namelist3ds **list, char3ds *name) -{ - namelist3ds *pList; - - if (list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - pList = *list; - - /*--- Just add name to list */ - if (pList->count < pList->spaces) - { - pList->list[pList->count].name = strdup3ds(name); - pList->count++; - } - else /*--- Bump list size by kGRANULE_SIZE */ - { - ulong3ds i, spaces; - namelistentry3ds *newList; - - spaces = pList->spaces + kGRANULE_SIZE; - newList = calloc(spaces, sizeof(namelistentry3ds)); - - if (newList == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - /*--- copy over pointers, initialize new space */ - for (i=0; icount) - newList[i].name = pList->list[i].name; - else - newList[i].name = NULL; - } - - /*--- Reassign pointers */ - free((*list)->list); - (*list)->list = newList; - (*list)->spaces = spaces; - - AddToNameList3ds(list, name); - } -} - - -void *InitChunkData3ds(chunk3ds *chunk) -{ - sm_tag(ChunkTagToString3ds(chunk->tag)); - - switch (chunk->tag) - { - case COLOR_F: - chunk->data = malloc(sizeof(ColorF)); - break; - case LIN_COLOR_F: - chunk->data = malloc(sizeof(LinColorF)); - break; - case COLOR_24: - chunk->data = malloc(sizeof(Color24)); - break; - case LIN_COLOR_24: - chunk->data = malloc(sizeof(LinColor24)); - break; - case INT_PERCENTAGE: - chunk->data = malloc(sizeof(IntPercentage)); - break; - case FLOAT_PERCENTAGE: - chunk->data = malloc(sizeof(FloatPercentage)); - break; - case MAT_MAPNAME: - chunk->data = malloc(sizeof(MatMapname)); - break; - case M3D_VERSION: - chunk->data = malloc(sizeof(M3dVersion)); - break; - case MESH_VERSION: - chunk->data = malloc(sizeof(MeshVersion)); - break; - case MASTER_SCALE: - chunk->data = malloc(sizeof(MasterScale)); - break; - case LO_SHADOW_BIAS: - chunk->data = malloc(sizeof(LoShadowBias)); - break; - case SHADOW_FILTER: - chunk->data = malloc(sizeof(ShadowFilter)); - break; - case SHADOW_RANGE: - chunk->data = malloc(sizeof(ShadowRange)); - break; - case HI_SHADOW_BIAS: - chunk->data = malloc(sizeof(HiShadowBias)); - break; - case RAY_BIAS: - chunk->data = malloc(sizeof(RayBias)); - break; - case SHADOW_MAP_SIZE: - chunk->data = malloc(sizeof(ShadowMapSize)); - break; - case SHADOW_SAMPLES: - chunk->data = malloc(sizeof(ShadowSamples)); - break; - case O_CONSTS: - chunk->data = malloc(sizeof(OConsts)); - break; - case BIT_MAP: - chunk->data = malloc(sizeof(BitMap)); - break; - case V_GRADIENT: - chunk->data = malloc(sizeof(VGradient)); - break; - case FOG: - chunk->data = malloc(sizeof(Fog)); - break; - case LAYER_FOG: - chunk->data = malloc(sizeof(LayerFog)); - break; - case DISTANCE_CUE: - chunk->data = malloc(sizeof(DistanceCue)); - break; - case VIEW_TOP: - case VIEW_BOTTOM: - case VIEW_LEFT: - case VIEW_RIGHT: - case VIEW_FRONT: - case VIEW_BACK: - chunk->data = malloc(sizeof(ViewStandard)); - break; - case VIEW_USER: - chunk->data = malloc(sizeof(ViewUser)); - break; - case VIEW_CAMERA: - chunk->data = malloc(sizeof(ViewCamera)); - break; - case MAT_NAME: - chunk->data = malloc(sizeof(MatName)); - break; - case MAT_SHADING: - chunk->data = malloc(sizeof(MatShading)); - break; - case MAT_ACUBIC: - chunk->data = malloc(sizeof(MatAcubic)); - break; - case MAT_SXP_TEXT_DATA: - case MAT_SXP_TEXT2_DATA: - case MAT_SXP_OPAC_DATA: - case MAT_SXP_BUMP_DATA: - case MAT_SXP_SPEC_DATA: - case MAT_SXP_SHIN_DATA: - case MAT_SXP_SELFI_DATA: - case MAT_SXP_TEXT_MASKDATA: - case MAT_SXP_TEXT2_MASKDATA: - case MAT_SXP_OPAC_MASKDATA: - case MAT_SXP_BUMP_MASKDATA: - case MAT_SXP_SPEC_MASKDATA: - case MAT_SXP_SHIN_MASKDATA: - case MAT_SXP_SELFI_MASKDATA: - case MAT_SXP_REFL_MASKDATA: - case PROC_DATA: - chunk->data = malloc(sizeof(IpasData)); - break; - case MAT_WIRESIZE: - chunk->data = malloc(sizeof(MatWireSize)); - break; - case MAT_MAP_TILING: - chunk->data = malloc(sizeof(MatMapTiling)); - break; - case MAT_MAP_TEXBLUR: - chunk->data = malloc(sizeof(MatMapTexblur)); - break; - case MAT_MAP_USCALE: - chunk->data = malloc(sizeof(MatMapUScale)); - break; - case MAT_MAP_VSCALE: - chunk->data = malloc(sizeof(MatMapVScale)); - break; - case MAT_MAP_UOFFSET: - chunk->data = malloc(sizeof(MatMapUOffset)); - break; - case MAT_MAP_VOFFSET: - chunk->data = malloc(sizeof(MatMapVOffset)); - break; - case MAT_MAP_ANG: - chunk->data = malloc(sizeof(MatMapAng)); - break; - case MAT_MAP_COL1: - chunk->data = malloc(sizeof(MatMapCol1)); - break; - case MAT_MAP_COL2: - chunk->data = malloc(sizeof(MatMapCol2)); - break; - case MAT_MAP_RCOL: - chunk->data = malloc(sizeof(MatMapRCol)); - break; - case MAT_MAP_GCOL: - chunk->data = malloc(sizeof(MatMapGCol)); - break; - case MAT_MAP_BCOL: - chunk->data = malloc(sizeof(MatMapBCol)); - break; - case MAT_BUMP_PERCENT: - chunk->data = malloc(sizeof(MatBumpPercent)); - break; - case NAMED_OBJECT: - chunk->data = malloc(sizeof(NamedObject)); - break; - case POINT_ARRAY: - chunk->data = malloc(sizeof(PointArray)); - break; - case POINT_FLAG_ARRAY: - chunk->data = malloc(sizeof(PointFlagArray)); - break; - case FACE_ARRAY: - chunk->data = malloc(sizeof(FaceArray)); - break; - case MSH_MAT_GROUP: - chunk->data = malloc(sizeof(MshMatGroup)); - break; - case MSH_BOXMAP: - chunk->data = malloc(sizeof(MshBoxmap)); - break; - case SMOOTH_GROUP: - chunk->data = malloc(sizeof(SmoothGroup)); - break; - case TEX_VERTS: - chunk->data = malloc(sizeof(TexVerts)); - break; - case MESH_MATRIX: - chunk->data = malloc(sizeof(MeshMatrix)); - break; - case MESH_COLOR: - chunk->data = malloc(sizeof(MeshColor)); - break; - case MESH_TEXTURE_INFO: - chunk->data = malloc(sizeof(MeshTextureInfo)); - break; - case PROC_NAME: - chunk->data = malloc(sizeof(ProcName)); - break; - case N_DIRECT_LIGHT: - chunk->data = malloc(sizeof(NDirectLight)); - break; - case DL_EXCLUDE: - chunk->data = malloc(sizeof(DlExclude)); - break; - case DL_INNER_RANGE: - chunk->data = malloc(sizeof(DlInnerRange)); - break; - case DL_OUTER_RANGE: - chunk->data = malloc(sizeof(DlOuterRange)); - break; - case DL_MULTIPLIER: - chunk->data = malloc(sizeof(DlMultiplier)); - break; - case DL_SPOTLIGHT: - chunk->data = malloc(sizeof(DlSpotlight)); - break; - case DL_LOCAL_SHADOW2: - chunk->data = malloc(sizeof(DlLocalShadow2)); - break; - case DL_SPOT_ROLL: - chunk->data = malloc(sizeof(DlSpotRoll)); - break; - case DL_SPOT_ASPECT: - chunk->data = malloc(sizeof(DlSpotAspect)); - break; - case DL_SPOT_PROJECTOR: - chunk->data = malloc(sizeof(DlSpotProjector)); - break; - case DL_RAY_BIAS: - chunk->data = malloc(sizeof(DlRayBias)); - break; - case N_CAMERA: - chunk->data = malloc(sizeof(NCamera)); - break; - case CAM_RANGES: - chunk->data = malloc(sizeof(CamRanges)); - break; - case VIEWPORT_LAYOUT: - chunk->data = malloc(sizeof(ViewportLayout)); - break; - case VIEWPORT_SIZE: - chunk->data = malloc(sizeof(ViewportSize)); - break; - case VIEWPORT_DATA_3: - case VIEWPORT_DATA: - chunk->data = malloc(sizeof(ViewportData)); - break; - case XDATA_ENTRY: - chunk->data = malloc(sizeof(XDataEntry)); - break; - case XDATA_APPNAME: - chunk->data = malloc(sizeof(XDataAppName)); - break; - case XDATA_STRING: - chunk->data = malloc(sizeof(XDataString)); - break; - case KFHDR: - chunk->data = malloc(sizeof(KFHdr)); - break; - case KFSEG: - chunk->data = malloc(sizeof(KFSeg)); - break; - case KFCURTIME: - chunk->data = malloc(sizeof(KFCurtime)); - break; - case NODE_ID: - chunk->data = malloc(sizeof(KFId)); - break; - case NODE_HDR: - chunk->data = malloc(sizeof(NodeHdr)); - break; - case PIVOT: - chunk->data = malloc(sizeof(Pivot)); - break; - case INSTANCE_NAME: - chunk->data = malloc(sizeof(InstanceName)); - break; - case PARENT_NAME: - chunk->data = malloc(sizeof(InstanceName)); - break; - case MORPH_SMOOTH: - chunk->data = malloc(sizeof(MorphSmooth)); - break; - case BOUNDBOX: - chunk->data = malloc(sizeof(BoundBox)); - break; - case POS_TRACK_TAG: - chunk->data = malloc(sizeof(PosTrackTag)); - break; - case COL_TRACK_TAG: - chunk->data = malloc(sizeof(ColTrackTag)); - break; - case ROT_TRACK_TAG: - chunk->data = malloc(sizeof(RotTrackTag)); - break; - case SCL_TRACK_TAG: - chunk->data = malloc(sizeof(ScaleTrackTag)); - break; - case MORPH_TRACK_TAG: - chunk->data = malloc(sizeof(MorphTrackTag)); - break; - case FOV_TRACK_TAG: - chunk->data = malloc(sizeof(FovTrackTag)); - break; - case ROLL_TRACK_TAG: - chunk->data = malloc(sizeof(RollTrackTag)); - break; - case HOT_TRACK_TAG: - chunk->data = malloc(sizeof(HotTrackTag)); - break; - case FALL_TRACK_TAG: - chunk->data = malloc(sizeof(FallTrackTag)); - break; - case HIDE_TRACK_TAG: - chunk->data = malloc(sizeof(HideTrackTag)); - break; - case M3DMAGIC: /* Chunks who consist entirely of children */ - case MLIBMAGIC: - case MDATA: - case AMBIENT_LIGHT: - case SOLID_BGND: - case DEFAULT_VIEW: - case MAT_ENTRY: - case MAT_AMBIENT: - case MAT_DIFFUSE: - case MAT_SPECULAR: - case MAT_SHININESS: - case MAT_SHIN2PCT: - case MAT_SHIN3PCT: - case MAT_TRANSPARENCY: - case MAT_XPFALL: - case MAT_REFBLUR: - case MAT_SELF_ILPCT: - case MAT_TEXMAP: - case MAT_TEXMASK: - case MAT_TEX2MAP: - case MAT_TEX2MASK: - case MAT_OPACMAP: - case MAT_OPACMASK: - case MAT_REFLMAP: - case MAT_REFLMASK: - case MAT_BUMPMAP: - case MAT_BUMPMASK: - case MAT_SPECMAP: - case MAT_SPECMASK: - case MAT_SHINMAP: - case MAT_SHINMASK: - case MAT_SELFIMAP: - case MAT_SELFIMASK: - case N_TRI_OBJECT: - case KFDATA: - case AMBIENT_NODE_TAG: - case OBJECT_NODE_TAG: - case CAMERA_NODE_TAG: - case TARGET_NODE_TAG: - case LIGHT_NODE_TAG: - case SPOTLIGHT_NODE_TAG: - case L_TARGET_NODE_TAG: - case CMAGIC: - case XDATA_SECTION: - case XDATA_GROUP: - chunk->data = NULL; - break; - default: /* A truely hideous thing to do but it helps with unknown chunks */ - { - if (chunk->size > 6) /* Don't mess with dataless chunks */ - chunk->data = malloc(chunk->size - 6); - break; - } - } /* End of Case */ - sm_untag(); - return chunk->data; /* returns the pointer should someone want it */ -} - -/* Initializes a chunk and its data fields in one fell swoop, and - returns a pointer to the data chunk. */ -void *InitChunkAndData3ds(chunk3ds **chunk, chunktag3ds tag) -{ - sm_tag(ChunkTagToString3ds(tag)); - InitChunk3ds(chunk); - ON_ERROR_RETURNR(NULL); - (*chunk)->tag = tag; - sm_untag(); - return InitChunkData3ds(*chunk); -} - -/* Reads the data out of the chunk detailed in *chunk and places a pointer to - the data into the chunk3ds structure, it will also return that pointer. */ -void *ReadChunkData3ds(chunk3ds *chunk) -{ - myassert(chunk != NULL, "ReadChunkData3ds: arg *chunk cannot be NULL"); - - if (chunk->data == NULL) /* don't try to read the data if its already been read */ - { - /* Set the current file to the file that contain's the chunk's data */ - SetContextByIndex3ds(chunk->readindex); - - /* Seek to the beginning of the chunk's data (harmless if the chunk has no data) */ - FileSeek3ds(chunk->position + 6); - - sm_tag(ChunkTagToString3ds(chunk->tag)); - - switch (chunk->tag) - { - case COLOR_F: - { - ColorF *data; /* local variables are used instead of casts to minimize errors */ - data = malloc(sizeof(ColorF)); /* Allocate the memory to hold the data */ - chunk->data = data; /* copy the pointer into chunk */ - data->red = ReadFloat3ds(); /* Read the data out of the file */ - data->green = ReadFloat3ds(); - data->blue = ReadFloat3ds(); - break; - } - case LIN_COLOR_F: - { - LinColorF *data; - data = malloc(sizeof(LinColorF)); - chunk->data = data; - data->red = ReadFloat3ds(); - data->green = ReadFloat3ds(); - data->blue = ReadFloat3ds(); - break; - } - case COLOR_24: - { - Color24 *data; - data = malloc(sizeof(Color24)); - chunk->data = data; - data->red = ReadUByte3ds(); - data->green = ReadUByte3ds(); - data->blue = ReadUByte3ds(); - break; - } - case LIN_COLOR_24: - { - LinColor24 *data; - data = malloc(sizeof(LinColor24)); - chunk->data = data; - data->red = ReadUByte3ds(); - data->green = ReadUByte3ds(); - data->blue = ReadUByte3ds(); - break; - } - case INT_PERCENTAGE: - { - IntPercentage *data; - data = malloc(sizeof(IntPercentage)); - chunk->data = data; - data->intpercentage = ReadShort3ds(); - break; - } - case FLOAT_PERCENTAGE: - { - FloatPercentage *data; - data = malloc(sizeof(FloatPercentage)); - chunk->data = data; - data->floatpercentage = ReadFloat3ds(); - break; - } - case MAT_MAPNAME: - { - MatMapname *data; - data = malloc(sizeof(MatMapname)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), MatNameStrMax3ds); - break; - } - case M3D_VERSION: - { - M3dVersion *data; - data = malloc(sizeof(M3dVersion)); - chunk->data = data; - data->version = ReadLong3ds(); - break; - } - case MESH_VERSION: - { - MeshVersion *data; - data = malloc(sizeof(MeshVersion)); - chunk->data = data; - data->version = ReadLong3ds(); - break; - } - case MASTER_SCALE: - { - MasterScale *data; - data = malloc(sizeof(MasterScale)); - chunk->data = data; - data->masterscale = ReadFloat3ds(); - break; - } - case LO_SHADOW_BIAS: - { - LoShadowBias *data; - data = malloc(sizeof(LoShadowBias)); - chunk->data = data; - data->bias = ReadFloat3ds(); - break; - } - case SHADOW_FILTER: - { - ShadowFilter *data; - data = (ShadowFilter *) malloc(sizeof(ShadowFilter)); - chunk->data = data; - data->shadowfilter = ReadFloat3ds(); - break; - } - case SHADOW_RANGE: - { - ShadowRange *data; - data = (ShadowRange *) malloc(sizeof(ShadowRange)); - chunk->data = data; - data->shadowrange = ReadLong3ds(); - break; - } - case HI_SHADOW_BIAS: - { - HiShadowBias *data; - data = malloc(sizeof(HiShadowBias)); - chunk->data = data; - data->bias = ReadFloat3ds(); - break; - } - case RAY_BIAS: - { - RayBias *data; - data = malloc(sizeof(RayBias)); - chunk->data = data; - data->bias = ReadFloat3ds(); - break; - } - case SHADOW_MAP_SIZE: - { - ShadowMapSize *data; - data = malloc(sizeof(ShadowMapSize)); - chunk->data = data; - data->shadowmapsize = ReadShort3ds(); - break; - } - case SHADOW_SAMPLES: - { - ShadowSamples *data; - data = malloc(sizeof(ShadowSamples)); - chunk->data = data; - data->shadowsamples = ReadShort3ds(); - break; - } - case O_CONSTS: - { - OConsts *data; - data = malloc(sizeof(OConsts)); - chunk->data = data; - ReadPoint3ds(&(data->oconsts)); - break; - } - case BIT_MAP: - { - BitMap *data; - data = malloc(sizeof(BitMap)); - chunk->data = data; - ReadAndAllocString3ds(&(data->bitmap), BitMapStrMax3ds); - break; - } - case V_GRADIENT: - { - VGradient *data; - data = (VGradient *) malloc(sizeof(VGradient)); - chunk->data = data; - data->gradpercent = ReadFloat3ds(); - break; - } - case FOG: - { - Fog *data; - data = malloc(sizeof(Fog)); - chunk->data = data; - data->nearplanedist = ReadFloat3ds(); - data->nearplanedensity = ReadFloat3ds(); - data->farplanedist = ReadFloat3ds(); - data->farplanedensity = ReadFloat3ds(); - break; - } - case LAYER_FOG: - { - LayerFog *data; - data = malloc(sizeof(LayerFog)); - chunk->data = data; - data->zmin = ReadFloat3ds(); - data->zmax = ReadFloat3ds(); - data->density = ReadFloat3ds(); - data->type = ReadULong3ds(); - break; - } - case DISTANCE_CUE: - { - DistanceCue *data; - data = malloc(sizeof(DistanceCue)); - chunk->data = data; - data->nearplanedist = ReadFloat3ds(); - data->nearplanedimming = ReadFloat3ds(); - data->farplanedist = ReadFloat3ds(); - data->farplanedimming = ReadFloat3ds(); - break; - } - case VIEW_TOP: - case VIEW_BOTTOM: - case VIEW_LEFT: - case VIEW_RIGHT: - case VIEW_FRONT: - case VIEW_BACK: - { - ViewStandard *data; - data = malloc(sizeof(ViewStandard)); - chunk->data = data; - data->viewwidth = ReadFloat3ds(); - ReadPoint3ds(&(data->viewtargetcoord)); - break; - } - case VIEW_USER: - { - ViewUser *data; - data = malloc(sizeof(ViewUser)); - chunk->data = data; - data->viewwidth = ReadFloat3ds(); - data->xyviewangle = ReadFloat3ds(); - data->yzviewangle = ReadFloat3ds(); - data->bankangle = ReadFloat3ds(); - ReadPoint3ds(&(data->viewtargetcoord)); - break; - } - case VIEW_CAMERA: - { - ViewCamera *data; - data = malloc(sizeof(ViewCamera)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), ViewCameraStrMax3ds); - break; - } - case MAT_NAME: - { - MatName *data; - data = malloc(sizeof(MatName)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), MatNameStrMax3ds); - break; - } - case MAT_SHADING: - { - MatShading *data; - data = malloc(sizeof(MatShading)); - chunk->data = data; - FileSeek3ds(chunk->position +6); - data->matshading = ReadShort3ds(); - break; - } - case MAT_ACUBIC: - { - MatAcubic *data; - data = malloc(sizeof(MatAcubic)); - chunk->data = data; - data->shadelevel = ReadByte3ds(); - data->antialias = ReadByte3ds(); - data->flags = ReadShort3ds(); - data->mapsize = ReadULong3ds(); - data->frameinterval = ReadULong3ds(); - break; - } - case MAT_SXP_TEXT_DATA: - case MAT_SXP_TEXT2_DATA: - case MAT_SXP_OPAC_DATA: - case MAT_SXP_BUMP_DATA: - case MAT_SXP_SPEC_DATA: - case MAT_SXP_SHIN_DATA: - case MAT_SXP_SELFI_DATA: - case MAT_SXP_TEXT_MASKDATA: - case MAT_SXP_TEXT2_MASKDATA: - case MAT_SXP_OPAC_MASKDATA: - case MAT_SXP_BUMP_MASKDATA: - case MAT_SXP_SPEC_MASKDATA: - case MAT_SXP_SHIN_MASKDATA: - case MAT_SXP_SELFI_MASKDATA: - case MAT_SXP_REFL_MASKDATA: - case PROC_DATA: - { - IpasData *data; - data = malloc(sizeof(IpasData)); - chunk->data = data; - data->size = chunk->size - 6; - data->data = calloc(data->size, sizeof(byte3ds)); - ReadVoid3ds(data->size, data->data); - break; - } - case MAT_WIRESIZE: - { - MatWireSize *data; - data = malloc(sizeof(MatWireSize)); - chunk->data = data; - data->wiresize = ReadFloat3ds(); - break; - } - case MAT_MAP_TILING: - { - MatMapTiling *data; - data = malloc(sizeof(MatMapTiling)); - chunk->data = data; - data ->tiling = ReadUShort3ds(); - break; - } - case MAT_MAP_TEXBLUR: - { - MatMapTexblur *data; - data = malloc(sizeof(MatMapTexblur)); - chunk->data = data; - data->percent = ReadFloat3ds(); - break; - } - case MAT_MAP_USCALE: - { - MatMapUScale *data; - data = malloc(sizeof(MatMapUScale)); - chunk->data = data; - data->scale = ReadFloat3ds(); - break; - } - case MAT_MAP_VSCALE: - { - MatMapVScale *data; - data = malloc(sizeof(MatMapVScale)); - chunk->data = data; - data->scale = ReadFloat3ds(); - break; - } - case MAT_MAP_UOFFSET: - { - MatMapUOffset *data; - data = malloc(sizeof(MatMapUOffset)); - chunk->data = data; - data->offset = ReadFloat3ds(); - break; - } - case MAT_MAP_VOFFSET: - { - MatMapVOffset *data; - data = malloc(sizeof(MatMapVOffset)); - chunk->data = data; - data->offset = ReadFloat3ds(); - break; - } - case MAT_MAP_ANG: - { - MatMapAng *data; - data = malloc(sizeof(MatMapAng)); - chunk->data = data; - data->angle = ReadFloat3ds(); - break; - } - case MAT_MAP_COL1: - { - MatMapCol1 *data; - data = malloc(sizeof(MatMapCol1)); - chunk->data = data; - data->red = ReadUByte3ds(); - data->green = ReadUByte3ds(); - data->blue = ReadUByte3ds(); - break; - } - case MAT_MAP_COL2: - { - MatMapCol2 *data; - data = malloc(sizeof(MatMapCol2)); - chunk->data = data; - data->red = ReadUByte3ds(); - data->green = ReadUByte3ds(); - data->blue = ReadUByte3ds(); - break; - } - case MAT_MAP_RCOL: - { - MatMapRCol *data; - data = malloc(sizeof(MatMapRCol)); - chunk->data = data; - data->red = ReadUByte3ds(); - data->green = ReadUByte3ds(); - data->blue = ReadUByte3ds(); - break; - } - case MAT_MAP_GCOL: - { - MatMapGCol *data; - data = malloc(sizeof(MatMapGCol)); - chunk->data = data; - data->red = ReadUByte3ds(); - data->green = ReadUByte3ds(); - data->blue = ReadUByte3ds(); - break; - } - case MAT_MAP_BCOL: - { - MatMapBCol *data; - data = malloc(sizeof(MatMapBCol)); - chunk->data = data; - data->red = ReadUByte3ds(); - data->green = ReadUByte3ds(); - data->blue = ReadUByte3ds(); - break; - } - case MAT_BUMP_PERCENT: - { - MatBumpPercent *data; - data = malloc(sizeof(MatBumpPercent)); - chunk->data = data; - data->intpercentage = ReadShort3ds(); - break; - } - case NAMED_OBJECT: - { - NamedObject *data; - data = malloc(sizeof(NamedObject)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), NamedObjectStrMax3ds); - break; - } - case POINT_ARRAY: - { - PointArray *data; - ushort3ds x; - ushort3ds vertices; - data = malloc(sizeof(PointArray)); - chunk->data = data; - data->vertices = ReadUShort3ds(); - vertices = data->vertices; - data->pointlist = calloc(vertices, sizeof(point3ds)); - for (x=0; x < vertices; x++) { - ReadPoint3ds(&(data->pointlist[x])); - } - break; - } - case POINT_FLAG_ARRAY: - { - PointFlagArray *data; - ushort3ds x; - ushort3ds flags; - data = malloc(sizeof(PointFlagArray)); - chunk->data = data; - data->flags = ReadUShort3ds(); - flags = data->flags; - data->flaglist = calloc(flags, sizeof(short3ds)); - for (x=0; x < flags; x++) { - *(data->flaglist + x) = ReadShort3ds(); - } - break; - } - case FACE_ARRAY: - { - FaceArray *data; - ushort3ds x; - ushort3ds faces; - data = malloc(sizeof(FaceArray)); - chunk->data = data; - data->faces = ReadUShort3ds(); - faces = data->faces; - data->facelist = calloc(faces, sizeof(face3ds)); - for (x=0; x < faces; x++) { - ReadFace3ds(&(data->facelist[x])); - } - break; - } - case MSH_MAT_GROUP: - { - MshMatGroup *data; - ushort3ds x; - ushort3ds faces; - data = malloc(sizeof(MshMatGroup)); - chunk->data = data; - ReadAndAllocString3ds(&(data->matname), MatNameStrMax3ds); - data->faces = ReadUShort3ds(); - if (data->faces != 0) - { - faces = data->faces; - data->facelist = calloc(faces, sizeof(ushort3ds)); - for (x=0; x < faces; x++) { - data->facelist[x] = ReadUShort3ds(); - } - } else - { - data->facelist = NULL; - } - break; - } - case MSH_BOXMAP: - { - MshBoxmap *data; - ushort3ds i; - data = malloc(sizeof(MshBoxmap)); - chunk->data = data; - for (i = 0; i < 6; i++) - { - ReadAndAllocString3ds(&(data->matnames[i]), MatNameStrMax3ds); - } - break; - } - case SMOOTH_GROUP: - { - SmoothGroup *data; - ushort3ds x; - - data = malloc(sizeof(SmoothGroup)); - chunk->data = data; - data->groups = (ushort3ds) ((chunk->size - 6)/4); - data->grouplist = calloc(data->groups, sizeof(ulong3ds)); - for (x = 0; x < data->groups; x++) - { - data->grouplist[x] = ReadULong3ds(); - } - break; - } - case TEX_VERTS: - { - TexVerts *data; - ushort3ds x; - ushort3ds coords; - data = malloc(sizeof(TexVerts)); - chunk->data = data; - data->numcoords = ReadUShort3ds(); - coords = data->numcoords; - data->textvertlist = calloc(coords, sizeof(textvert3ds)); - for (x=0; x < coords; x++){ - ReadTextVert3ds(&(data->textvertlist[x])); - } - break; - } - case MESH_MATRIX: - { - MeshMatrix *data; - ushort3ds x; - - data = malloc(sizeof(MeshMatrix)); - chunk->data = data; - for (x=0; x<=11; x++){ - *(data->xmatrix + x) = ReadFloat3ds(); - } - break; - } - case MESH_COLOR: - { - MeshColor *data; - data = malloc(sizeof(MeshColor)); - chunk->data = data; - data->color = ReadUByte3ds(); - break; - } - case MESH_TEXTURE_INFO: - { - MeshTextureInfo *data; - ushort3ds x; - data = malloc(sizeof(MeshTextureInfo)); - chunk->data = data; - data->maptype = ReadUShort3ds(); - data->xtiling = ReadFloat3ds(); - data->ytiling = ReadFloat3ds(); - ReadPoint3ds(&(data->iconpos)); - data->iconscaling = ReadFloat3ds(); - for (x=0; x<=11; x++) { - *(data->xmatrix + x) = ReadFloat3ds(); - } - data->iconwidth = ReadFloat3ds(); - data->iconheight = ReadFloat3ds(); - data->cyliconheight = ReadFloat3ds(); - break; - } - case PROC_NAME: - { - ProcName *data; - data = malloc(sizeof(ProcName)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), ProcNameStrMax3ds); - break; - } - case N_DIRECT_LIGHT: - { - NDirectLight *data; - data = malloc(sizeof(NDirectLight)); - chunk->data = data; - ReadPoint3ds(&(data->lightpos)); - break; - } - case DL_EXCLUDE: - { - DlExclude *data; - data = malloc(sizeof(DlExclude)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), NamedObjectStrMax3ds); - break; - } - case DL_INNER_RANGE: - { - DlInnerRange *data; - data = malloc(sizeof(DlInnerRange)); - chunk->data = data; - data->range = ReadFloat3ds(); - break; - } - case DL_OUTER_RANGE: - { - DlOuterRange *data; - data = malloc(sizeof(DlOuterRange)); - chunk->data = data; - data->range = ReadFloat3ds(); - break; - } - case DL_MULTIPLIER: - { - DlMultiplier *data; - data = malloc(sizeof(DlMultiplier)); - chunk->data = data; - data->multiple = ReadFloat3ds(); - break; - } - case DL_SPOTLIGHT: - { - DlSpotlight *data; - data = malloc(sizeof(DlSpotlight)); - chunk->data = data; - ReadPoint3ds(&(data->spotlighttarg)); - data->hotspotangle = ReadFloat3ds(); - data->falloffangle = ReadFloat3ds(); - break; - } - case DL_LOCAL_SHADOW2: - { - DlLocalShadow2 *data; - data = malloc(sizeof(DlLocalShadow2)); - chunk->data = data; - data->localshadowbias = ReadFloat3ds(); - data->localshadowfilter = ReadFloat3ds(); - data->localshadowmapsize = ReadShort3ds(); - break; - } - case DL_SPOT_ROLL: - { - DlSpotRoll *data; - data = malloc(sizeof(DlSpotRoll)); - chunk->data = data; - data->angle = ReadFloat3ds(); - break; - } - case DL_SPOT_ASPECT: - { - DlSpotAspect *data; - data = malloc(sizeof(DlSpotAspect)); - chunk->data = data; - data->aspect = ReadFloat3ds(); - break; - } - case DL_SPOT_PROJECTOR: - { - DlSpotProjector *data; - data = malloc(sizeof(DlSpotProjector)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), BitMapStrMax3ds); - break; - } - case DL_RAY_BIAS: - { - DlRayBias *data; - data = malloc(sizeof(DlRayBias)); - chunk->data = data; - data->bias = ReadFloat3ds(); - break; - } - case N_CAMERA: - { - NCamera *data; - data = malloc(sizeof(NCamera)); - chunk->data = data; - ReadPoint3ds(&(data->camerapos)); - ReadPoint3ds(&(data->targetpos)); - data->camerabank = ReadFloat3ds(); - data->camerafocallength = ReadFloat3ds(); - break; - } - case CAM_RANGES: - { - CamRanges *data; - data = malloc(sizeof(CamRanges)); - chunk->data = data; - data->nearplane = ReadFloat3ds(); - data->farplane = ReadFloat3ds(); - break; - } - case VIEWPORT_LAYOUT: - { - ViewportLayout *data; - data = malloc(sizeof(ViewportLayout)); - chunk->data = data; - data->form = ReadShort3ds(); - data->top = ReadShort3ds(); - data->ready = ReadShort3ds(); - data->wstate = ReadShort3ds(); - data->swapws = ReadShort3ds(); - data->swapport = ReadShort3ds(); - data->swapcur = ReadShort3ds(); - break; - } - case VIEWPORT_SIZE: - { - ViewportSize *data; - data = malloc(sizeof(ViewportSize)); - chunk->data = data; - data->xpos = ReadUShort3ds(); - data->ypos = ReadUShort3ds(); - data->width = ReadUShort3ds(); - data->height = ReadUShort3ds(); - break; - } - case VIEWPORT_DATA_3: - case VIEWPORT_DATA: - { - ViewportData *data; - data = malloc(sizeof(ViewportData)); - chunk->data = data; - data->flags = ReadShort3ds(); - data->axislockout = ReadShort3ds(); - data->winxpos = ReadShort3ds(); - data->winypos = ReadShort3ds(); - data->winwidth = ReadShort3ds(); - data->winheight = ReadShort3ds(); - data->view = ReadShort3ds(); - data->zoomfactor = ReadFloat3ds(); - ReadPoint3ds(&(data->center)); - data->horizang = ReadFloat3ds(); - data->vertang = ReadFloat3ds(); - ReadAndAllocFixedString3ds(&(data->camname), NamedObjectStrMax3ds); - break; - } - case XDATA_ENTRY: - { - XDataEntry *data; - data = InitChunkData3ds(chunk); - data->size = (chunk->size) - 6; - data->data = malloc(data->size); - ReadVoid3ds(data->size, data->data); - break; - } - case XDATA_APPNAME: - { - XDataAppName *data; - data = malloc(sizeof(XDataAppName)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), chunk->size); - break; - } - case XDATA_STRING: - { - XDataString *data; - data = malloc(sizeof(XDataString)); - chunk->data = data; - ReadAndAllocString3ds(&(data->string), chunk->size); - break; - } - case KFHDR: - { - KFHdr *data; - data = malloc(sizeof(KFHdr)); - chunk->data = data; - data->revision = ReadShort3ds(); - ReadAndAllocString3ds(&(data->filename), FileNameStrMax3ds); - data->animlength = ReadLong3ds(); - break; - } - case KFSEG: - { - KFSeg *data; - data = malloc(sizeof(KFSeg)); - chunk->data = data; - data->first = ReadLong3ds(); - data->last = ReadLong3ds(); - break; - } - case KFCURTIME: - { - KFCurtime *data; - data = malloc(sizeof(KFCurtime)); - chunk->data = data; - data->currframenum = ReadLong3ds(); - break; - } - case NODE_ID: - { - KFId *data; - data = malloc(sizeof(KFId)); - chunk->data = data; - data->id = ReadShort3ds(); - break; - } - case NODE_HDR: - { - NodeHdr *data; - data = malloc(sizeof(NodeHdr)); - chunk->data = data; - ReadAndAllocString3ds(&(data->objname), NodeHdrStrMax3ds); - data->flags1 = ReadUShort3ds(); - data->flags2 = ReadUShort3ds(); - data->parentindex = ReadShort3ds(); - break; - } - case PIVOT: - { - Pivot *data; - data = malloc(sizeof(Pivot)); - chunk->data = data; - ReadPoint3ds(&(data->offset)); - break; - } - case INSTANCE_NAME: - { - InstanceName *data; - data = malloc(sizeof(InstanceName)); - chunk->data = data; - ReadAndAllocString3ds(&(data->name), InstanceNameStrMax3ds); - break; - } - case PARENT_NAME: - { - break; - } - case MORPH_SMOOTH: - { - MorphSmooth *data; - data = malloc(sizeof(MorphSmooth)); - chunk->data = data; - data->smoothgroupangle = ReadFloat3ds(); - break; - } - case BOUNDBOX: - { - BoundBox *data; - data = malloc(sizeof(BoundBox)); - chunk->data = data; - ReadPoint3ds(&(data->min)); - ReadPoint3ds(&(data->max)); - break; - } - case POS_TRACK_TAG: - { - PosTrackTag *data; - ulong3ds keys; - ulong3ds x=0; - - data = malloc(sizeof(PosTrackTag)); - chunk->data = data; - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - data->positionlist = calloc(keys, sizeof(point3ds)); - - for(x=0; xkeyhdrlist[x])); - ReadPoint3ds(&(data->positionlist[x])); - } - break; - } - case COL_TRACK_TAG: - { - ColTrackTag *data; - ulong3ds keys; - ulong3ds x; - data = malloc(sizeof(ColTrackTag)); - chunk->data = data; - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - data->colorlist = calloc(keys, sizeof(fcolor3ds)); - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - for(x=0; xkeyhdrlist[x])); - data->colorlist[x].r = ReadFloat3ds(); - data->colorlist[x].g = ReadFloat3ds(); - data->colorlist[x].b = ReadFloat3ds(); - } - break; - } - case ROT_TRACK_TAG: - { - RotTrackTag *data; - ulong3ds x; - ulong3ds keys; - data = malloc(sizeof(RotTrackTag)); - chunk->data = data; - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - data->rotationlist = calloc(keys, sizeof(kfrotkey3ds)); - for(x=0; xkeyhdrlist[x])); - data->rotationlist[x].angle = ReadFloat3ds(); - data->rotationlist[x].x = ReadFloat3ds(); - data->rotationlist[x].y = ReadFloat3ds(); - data->rotationlist[x].z = ReadFloat3ds(); - } - break; - } - case SCL_TRACK_TAG: - { - ScaleTrackTag *data; - ulong3ds x; - ulong3ds keys; - - data = malloc(sizeof(ScaleTrackTag)); - chunk->data = data; - - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - data->scalelist = calloc(keys, sizeof(point3ds)); - - for(x=0; xkeyhdrlist[x])); - data->scalelist[x].x = ReadFloat3ds(); - data->scalelist[x].y = ReadFloat3ds(); - data->scalelist[x].z = ReadFloat3ds(); - } - break; - } - case MORPH_TRACK_TAG: - { - MorphTrackTag *data; - ulong3ds x; - ulong3ds keys; - - data = malloc(sizeof(MorphTrackTag)); - chunk->data = data; - - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - data->morphlist = calloc(keys, sizeof(kfmorphkey3ds)); - for(x=0; xkeyhdrlist[x])); - ReadString3ds(data->morphlist[x].name, NamedObjectStrMax3ds); - } - break; - } - case FOV_TRACK_TAG: - { - FovTrackTag *data; - ulong3ds x; - ulong3ds keys; - - data = malloc(sizeof(FovTrackTag)); - chunk->data = data; - - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - data->fovanglelist = calloc(keys, sizeof(float3ds)); - for(x=0; xkeyhdrlist[x])); - *(data->fovanglelist + x) = ReadFloat3ds(); - } - break; - } - case ROLL_TRACK_TAG: - { - RollTrackTag *data; - ulong3ds x; - ulong3ds keys; - - data = malloc(sizeof(RollTrackTag)); - chunk->data = data; - - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - data->rollanglelist = calloc(keys, sizeof(float3ds)); - for(x=0; xkeyhdrlist[x])); - *(data->rollanglelist + x) = ReadFloat3ds(); - } - break; - } - case HOT_TRACK_TAG: - { - HotTrackTag *data; - ulong3ds x; - ulong3ds keys; - - data = malloc(sizeof(HotTrackTag)); - chunk->data = data; - - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - data->hotspotanglelist = calloc(keys, sizeof(float3ds)); - for(x=0; xkeyhdrlist[x])); - *(data->hotspotanglelist + x) = ReadFloat3ds(); - } - break; - } - case FALL_TRACK_TAG: - { - FallTrackTag *data; - ulong3ds x; - ulong3ds keys; - - data = malloc(sizeof(FallTrackTag)); - chunk->data = data; - - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - data->falloffanglelist = calloc(keys, sizeof(float3ds)); - for(x=0; xkeyhdrlist[x])); - *(data->falloffanglelist + x) = ReadFloat3ds(); - } - break; - } - case HIDE_TRACK_TAG: - { - HideTrackTag *data; - ulong3ds x; - ulong3ds keys; - - data = malloc(sizeof(HideTrackTag)); - chunk->data = data; - - ReadTrackHeader3ds(&(data->trackhdr)); - keys = data->trackhdr.keycount; - - data->keyhdrlist = calloc(keys, sizeof(keyheader3ds)); - for(x=0; xkeyhdrlist[x])); - } - break; - } - case M3DMAGIC: /* Chunks that do not contain data, or only contain children */ - case MLIBMAGIC: - case MDATA: - case AMBIENT_LIGHT: - case SOLID_BGND: - case DEFAULT_VIEW: - case MAT_ENTRY: - case MAT_AMBIENT: - case MAT_DIFFUSE: - case MAT_SPECULAR: - case MAT_SHININESS: - case MAT_SHIN2PCT: - case MAT_SHIN3PCT: - case MAT_TRANSPARENCY: - case MAT_XPFALL: - case MAT_REFBLUR: - case MAT_SELF_ILPCT: - case MAT_TEXMAP: - case MAT_TEXMASK: - case MAT_TEX2MAP: - case MAT_TEX2MASK: - case MAT_OPACMAP: - case MAT_OPACMASK: - case MAT_REFLMAP: - case MAT_REFLMASK: - case MAT_BUMPMAP: - case MAT_BUMPMASK: - case MAT_SPECMAP: - case MAT_SPECMASK: - case MAT_SHINMAP: - case MAT_SHINMASK: - case MAT_SELFIMAP: - case MAT_SELFIMASK: - case N_TRI_OBJECT: - case KFDATA: - case AMBIENT_NODE_TAG: - case OBJECT_NODE_TAG: - case CAMERA_NODE_TAG: - case TARGET_NODE_TAG: - case LIGHT_NODE_TAG: - case SPOTLIGHT_NODE_TAG: - case L_TARGET_NODE_TAG: - case CMAGIC: - case XDATA_SECTION: - case XDATA_GROUP: - break; - - default: /* A truely hideous thing to do but it helps with unknown chunks */ - { - if (chunk->size > 6) /* Don't mess with dataless chunks */ - { - chunk->data = malloc(chunk->size - 6); - ReadVoid3ds(chunk->size - 6, chunk->data); - break; - } - } - } /* End of Case */ - sm_untag(); - } - return chunk->data; -} - -void WriteChunkData3ds(chunk3ds *chunk) -{ - - /* Don't try to write if data field is NULL */ - if (chunk->data != NULL) - { - SetContextByIndex3ds(chunk->writeindex); - - switch (chunk->tag) - { - case NULL_CHUNK: - { - /* don't do anything */ - break; - } - case COLOR_F: - { - ColorF *data = chunk->data; - - WriteFloat3ds(data->red); - WriteFloat3ds(data->green); - WriteFloat3ds(data->blue); - break; - } - case LIN_COLOR_F: - { - LinColorF *data = chunk->data; - - WriteFloat3ds(data->red); - WriteFloat3ds(data->green); - WriteFloat3ds(data->blue); - break; - } - case COLOR_24: - { - Color24 *data = chunk->data; - - WriteUByte3ds(data->red); - WriteUByte3ds(data->green); - WriteUByte3ds(data->blue); - break; - } - case LIN_COLOR_24: - { - LinColor24 *data = chunk->data; - - WriteUByte3ds(data->red); - WriteUByte3ds(data->green); - WriteUByte3ds(data->blue); - break; - } - case INT_PERCENTAGE: - { - IntPercentage *data = chunk->data; - - WriteShort3ds(data->intpercentage); - break; - } - case FLOAT_PERCENTAGE: - { - FloatPercentage *data = chunk->data; - - WriteFloat3ds(data->floatpercentage); - break; - } - case MAT_MAPNAME: - { - MatMapname *data = chunk->data; - - WriteString3ds(data->name); - break; - } - case M3D_VERSION: - { - M3dVersion *data = chunk->data; - - WriteLong3ds(data->version); - break; - } - case MESH_VERSION: - { - MeshVersion *data = chunk->data; - - WriteLong3ds(data->version); - break; - } - case MASTER_SCALE: - { - MasterScale *data = chunk->data; - - WriteFloat3ds(data->masterscale); - break; - } - case LO_SHADOW_BIAS: - { - LoShadowBias *data = chunk->data; - - WriteFloat3ds(data->bias); - break; - } - case SHADOW_FILTER: - { - ShadowFilter *data = chunk->data; - - WriteFloat3ds(data->shadowfilter); - break; - } - case SHADOW_RANGE: - { - ShadowRange *data = chunk->data; - - WriteLong3ds(data->shadowrange); - break; - } - case HI_SHADOW_BIAS: - { - HiShadowBias *data = chunk->data; - - WriteFloat3ds(data->bias); - break; - } - case RAY_BIAS: - { - RayBias *data = chunk->data; - - WriteFloat3ds(data->bias); - break; - } - case SHADOW_MAP_SIZE: - { - ShadowMapSize *data = chunk->data; - - WriteShort3ds(data->shadowmapsize); - break; - } - case SHADOW_SAMPLES: - { - ShadowSamples *data = chunk->data; - - WriteShort3ds(data->shadowsamples); - break; - } - case O_CONSTS: - { - OConsts *data = chunk->data; - - WritePoint3ds(&(data->oconsts)); - break; - } - case BIT_MAP: - { - BitMap *data = chunk->data; - - WriteString3ds(data->bitmap); - break; - } - case V_GRADIENT: - { - VGradient *data = chunk->data; - - WriteFloat3ds(data->gradpercent); - break; - } - case FOG: - { - Fog *data = chunk->data; - - WriteFloat3ds(data->nearplanedist); - WriteFloat3ds(data->nearplanedensity); - WriteFloat3ds(data->farplanedist); - WriteFloat3ds(data->farplanedensity); - break; - } - case LAYER_FOG: - { - LayerFog *data = chunk->data; - - WriteFloat3ds(data->zmin); - WriteFloat3ds(data->zmax); - WriteFloat3ds(data->density); - WriteULong3ds(data->type); - break; - } - case DISTANCE_CUE: - { - DistanceCue *data = chunk->data; - - WriteFloat3ds(data->nearplanedist); - WriteFloat3ds(data->nearplanedimming); - WriteFloat3ds(data->farplanedist); - WriteFloat3ds(data->farplanedimming); - break; - } - case VIEW_TOP: - case VIEW_BOTTOM: - case VIEW_LEFT: - case VIEW_RIGHT: - case VIEW_FRONT: - case VIEW_BACK: - { - ViewStandard *data = chunk->data; - - WriteFloat3ds(data->viewwidth); - WritePoint3ds(&(data->viewtargetcoord)); - break; - } - case VIEW_USER: - { - ViewUser *data = chunk->data; - - WriteFloat3ds(data->viewwidth); - WriteFloat3ds(data->xyviewangle); - WriteFloat3ds(data->yzviewangle); - WriteFloat3ds(data->bankangle); - WritePoint3ds(&(data->viewtargetcoord)); - break; - } - case VIEW_CAMERA: - { - ViewCamera *data = chunk->data; - - WriteString3ds(data->name); - break; - } - case MAT_NAME: - { - MatName *data = chunk->data; - - WriteString3ds(data->name); - break; - } - case MAT_SHADING: - { - MatShading *data = chunk->data; - - WriteShort3ds(data->matshading); - break; - } - case MAT_ACUBIC: - { - MatAcubic *data = chunk->data; - - WriteByte3ds(data->shadelevel); - WriteByte3ds(data->antialias); - WriteShort3ds(data->flags); - WriteULong3ds(data->mapsize); - WriteULong3ds(data->frameinterval); - break; - } - case MAT_SXP_TEXT_DATA: - case MAT_SXP_TEXT2_DATA: - case MAT_SXP_OPAC_DATA: - case MAT_SXP_BUMP_DATA: - case MAT_SXP_SPEC_DATA: - case MAT_SXP_SHIN_DATA: - case MAT_SXP_SELFI_DATA: - case MAT_SXP_TEXT_MASKDATA: - case MAT_SXP_TEXT2_MASKDATA: - case MAT_SXP_OPAC_MASKDATA: - case MAT_SXP_BUMP_MASKDATA: - case MAT_SXP_SPEC_MASKDATA: - case MAT_SXP_SHIN_MASKDATA: - case MAT_SXP_SELFI_MASKDATA: - case MAT_SXP_REFL_MASKDATA: - case PROC_DATA: - { - IpasData *data = chunk->data; - - WriteVoid3ds(data->size, data->data); - break; - } - case MAT_WIRESIZE: - { - MatWireSize *data = chunk->data; - - WriteFloat3ds(data->wiresize); - break; - } - case MAT_MAP_TILING: - { - MatMapTiling *data = chunk->data; - - WriteUShort3ds(data ->tiling); - break; - } - case MAT_MAP_TEXBLUR: - { - MatMapTexblur *data = chunk->data; - - WriteFloat3ds(data->percent); - break; - } - case MAT_MAP_USCALE: - { - MatMapUScale *data = chunk->data; - - WriteFloat3ds(data->scale); - break; - } - case MAT_MAP_VSCALE: - { - MatMapVScale *data = chunk->data; - - WriteFloat3ds(data->scale); - break; - } - case MAT_MAP_UOFFSET: - { - MatMapUOffset *data = chunk->data; - - WriteFloat3ds(data->offset); - break; - } - case MAT_MAP_VOFFSET: - { - MatMapVOffset *data = chunk->data; - - WriteFloat3ds(data->offset); - break; - } - case MAT_MAP_ANG: - { - MatMapAng *data = chunk->data; - - WriteFloat3ds(data->angle); - break; - } - case MAT_MAP_COL1: - { - MatMapCol1 *data = chunk->data; - - WriteUByte3ds(data->red); - WriteUByte3ds(data->green); - WriteUByte3ds(data->blue); - break; - } - case MAT_MAP_COL2: - { - MatMapCol2 *data = chunk->data; - - WriteUByte3ds(data->red); - WriteUByte3ds(data->green); - WriteUByte3ds(data->blue); - break; - } - case MAT_MAP_RCOL: - { - MatMapRCol *data = chunk->data; - - WriteUByte3ds(data->red); - WriteUByte3ds(data->green); - WriteUByte3ds(data->blue); - break; - } - case MAT_MAP_GCOL: - { - MatMapGCol *data = chunk->data; - - WriteUByte3ds(data->red); - WriteUByte3ds(data->green); - WriteUByte3ds(data->blue); - break; - } - case MAT_MAP_BCOL: - { - MatMapBCol *data = chunk->data; - - WriteUByte3ds(data->red); - WriteUByte3ds(data->green); - WriteUByte3ds(data->blue); - break; - } - case MAT_BUMP_PERCENT: - { - MatBumpPercent *data = chunk->data; - - WriteShort3ds(data->intpercentage); - break; - } - case NAMED_OBJECT: - { - NamedObject *data = chunk->data; - - WriteString3ds(data->name); - break; - } - case POINT_ARRAY: - { - PointArray *data = chunk->data; - ushort3ds x; - - WriteUShort3ds(data->vertices); - - for (x=0; x < data->vertices; x++) - { - WritePoint3ds(data->pointlist + x); - } - break; - } - case POINT_FLAG_ARRAY: - { - PointFlagArray *data = chunk->data; - ushort3ds x; - - WriteUShort3ds(data->flags); - for (x=0; x < data->flags; x++) - { - WriteShort3ds(data->flaglist[x]); - } - break; - } - case FACE_ARRAY: - { - FaceArray *data = chunk->data; - ushort3ds x; - - WriteUShort3ds(data->faces); - for (x=0; x < data->faces; x++) - { - WriteFace3ds(data->facelist + x); - } - break; - } - case MSH_MAT_GROUP: - { - MshMatGroup *data = chunk->data; - ushort3ds x; - - WriteString3ds(data->matname); - WriteUShort3ds(data->faces); - - if (data->faces != 0) - { - for (x=0; x < data->faces; x++) - { - WriteUShort3ds(data->facelist[x]); - } - } - break; - } - case MSH_BOXMAP: - { - MshBoxmap *data = chunk->data; - ushort3ds i; - - for (i = 0; i < 6; i++) - { - WriteString3ds(data->matnames[i]); - } - break; - } - case SMOOTH_GROUP: - { - SmoothGroup *data = chunk->data; - ushort3ds x; - - for (x=0; x < data->groups; x++) - { - WriteULong3ds(data->grouplist[x]); - } - break; - } - case TEX_VERTS: - { - TexVerts *data = chunk->data; - - ushort3ds x; - - WriteUShort3ds(data->numcoords); - - for (x=0; x < data->numcoords; x++) - { - WriteTextVert3ds(data->textvertlist + x); - } - break; - } - case MESH_MATRIX: - { - MeshMatrix *data = chunk->data; - ushort3ds x; - - for (x=0; x<=11; x++) - { - WriteFloat3ds(data->xmatrix[x]); - } - break; - } - case MESH_COLOR: - { - MeshColor *data = chunk->data; - - WriteUByte3ds(data->color); - break; - } - case MESH_TEXTURE_INFO: - { - MeshTextureInfo *data = chunk->data; - ushort3ds x; - - WriteUShort3ds(data->maptype); - WriteFloat3ds(data->xtiling); - WriteFloat3ds(data->ytiling); - WritePoint3ds(&(data->iconpos)); - WriteFloat3ds(data->iconscaling); - for (x=0; x<=11; x++) - { - WriteFloat3ds(data->xmatrix[x]); - } - WriteFloat3ds(data->iconwidth); - WriteFloat3ds(data->iconheight); - WriteFloat3ds(data->cyliconheight); - break; - } - case PROC_NAME: - { - ProcName *data = chunk->data; - - WriteString3ds(data->name); - break; - } - case N_DIRECT_LIGHT: - { - NDirectLight *data = chunk->data; - - WritePoint3ds(&(data->lightpos)); - break; - } - case DL_EXCLUDE: - { - DlExclude *data = chunk->data; - - WriteString3ds(data->name); - break; - } - case DL_INNER_RANGE: - { - DlInnerRange *data = chunk->data; - - WriteFloat3ds(data->range); - break; - } - case DL_OUTER_RANGE: - { - DlOuterRange *data = chunk->data; - - WriteFloat3ds(data->range); - break; - } - case DL_MULTIPLIER: - { - DlMultiplier *data = chunk->data; - - WriteFloat3ds(data->multiple); - break; - } - case DL_SPOTLIGHT: - { - DlSpotlight *data = chunk->data; - - WritePoint3ds(&(data->spotlighttarg)); - WriteFloat3ds(data->hotspotangle); - WriteFloat3ds(data->falloffangle); - break; - } - case DL_LOCAL_SHADOW2: - { - DlLocalShadow2 *data = chunk->data; - - WriteFloat3ds(data->localshadowbias); - WriteFloat3ds(data->localshadowfilter); - WriteShort3ds(data->localshadowmapsize); - break; - } - case DL_SPOT_ROLL: - { - DlSpotRoll *data = chunk->data; - - WriteFloat3ds(data->angle); - break; - } - case DL_SPOT_ASPECT: - { - DlSpotAspect *data = chunk->data; - - WriteFloat3ds(data->aspect); - break; - } - case DL_SPOT_PROJECTOR: - { - DlSpotProjector *data = chunk->data; - - WriteString3ds(data->name); - break; - } - case DL_RAY_BIAS: - { - DlRayBias *data = chunk->data; - - WriteFloat3ds(data->bias); - break; - } - case N_CAMERA: - { - NCamera *data = chunk->data; - - WritePoint3ds(&(data->camerapos)); - WritePoint3ds(&(data->targetpos)); - WriteFloat3ds(data->camerabank); - WriteFloat3ds(data->camerafocallength); - break; - } - case CAM_RANGES: - { - CamRanges *data = chunk->data; - - WriteFloat3ds(data->nearplane); - WriteFloat3ds(data->farplane); - break; - } - case VIEWPORT_LAYOUT: - { - ViewportLayout *data = chunk->data; - - WriteShort3ds(data->form); - WriteShort3ds(data->top); - WriteShort3ds(data->ready); - WriteShort3ds(data->wstate); - WriteShort3ds(data->swapws); - WriteShort3ds(data->swapport); - WriteShort3ds(data->swapcur); - break; - } - case VIEWPORT_SIZE: - { - ViewportSize *data = chunk->data; - - WriteUShort3ds(data->xpos); - WriteUShort3ds(data->ypos); - WriteUShort3ds(data->width); - WriteUShort3ds(data->height); - break; - } - case VIEWPORT_DATA_3: - case VIEWPORT_DATA: - { - ViewportData *data = chunk->data; - - WriteShort3ds(data->flags); - WriteShort3ds(data->axislockout); - WriteShort3ds(data->winxpos); - WriteShort3ds(data->winypos); - WriteShort3ds(data->winwidth); - WriteShort3ds(data->winheight); - WriteShort3ds(data->view); - WriteFloat3ds(data->zoomfactor); - WritePoint3ds(&(data->center)); - WriteFloat3ds(data->horizang); - WriteFloat3ds(data->vertang); - WriteFixedString3ds(data->camname, NamedObjectStrMax3ds+1); - break; - } - case XDATA_APPNAME: - { - XDataAppName *data = chunk->data; - WriteString3ds(data->name); - break; - } - case XDATA_STRING: - { - XDataString *data = chunk->data; - WriteString3ds(data->string); - break; - } - case KFHDR: - { - KFHdr *data = chunk->data; - - WriteShort3ds(data->revision); - WriteString3ds(data->filename); - WriteLong3ds(data->animlength); - break; - } - case KFSEG: - { - KFSeg *data = chunk->data; - - WriteLong3ds(data->first); - WriteLong3ds(data->last); - break; - } - case KFCURTIME: - { - KFCurtime *data = chunk->data; - - WriteLong3ds(data->currframenum); - break; - } - case NODE_ID: - { - KFId *data = chunk->data; - - WriteShort3ds(data->id); - break; - } - case NODE_HDR: - { - NodeHdr *data = chunk->data; - - WriteString3ds(data->objname); - WriteUShort3ds(data->flags1); - WriteUShort3ds(data->flags2); - WriteShort3ds(data->parentindex); - break; - } - case PIVOT: - { - Pivot *data = chunk->data; - - WritePoint3ds(&(data->offset)); - break; - } - case INSTANCE_NAME: - { - InstanceName *data = chunk->data; - - WriteString3ds(data->name); - break; - } - case PARENT_NAME: - { - break; - } - case MORPH_SMOOTH: - { - MorphSmooth *data = chunk->data; - - WriteFloat3ds(data->smoothgroupangle); - break; - } - case BOUNDBOX: - { - BoundBox *data = chunk->data; - - WritePoint3ds(&(data->min)); - WritePoint3ds(&(data->max)); - break; - } - case POS_TRACK_TAG: - { - PosTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WritePoint3ds(data->positionlist + x); - } - break; - } - case COL_TRACK_TAG: - { - ColTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WriteFloat3ds(data->colorlist[x].r); - WriteFloat3ds(data->colorlist[x].g); - WriteFloat3ds(data->colorlist[x].b); - } - break; - } - case ROT_TRACK_TAG: - { - RotTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WriteFloat3ds(data->rotationlist[x].angle); - WriteFloat3ds(data->rotationlist[x].x); - WriteFloat3ds(data->rotationlist[x].y); - WriteFloat3ds(data->rotationlist[x].z); - } - break; - } - case SCL_TRACK_TAG: - { - ScaleTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WriteFloat3ds(data->scalelist[x].x); - WriteFloat3ds(data->scalelist[x].y); - WriteFloat3ds(data->scalelist[x].z); - } - break; - } - case MORPH_TRACK_TAG: - { - MorphTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WriteString3ds(data->morphlist[x].name); - } - break; - } - case FOV_TRACK_TAG: - { - FovTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WriteFloat3ds(data->fovanglelist[x]); - } - break; - } - case ROLL_TRACK_TAG: - { - RollTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WriteFloat3ds(data->rollanglelist[x]); - } - break; - } - case HOT_TRACK_TAG: - { - HotTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WriteFloat3ds(data->hotspotanglelist[x]); - } - break; - } - case FALL_TRACK_TAG: - { - FallTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - WriteFloat3ds(data->falloffanglelist[x]); - } - break; - } - case HIDE_TRACK_TAG: - { - HideTrackTag *data = chunk->data; - ulong3ds x; - - WriteTrackHeader3ds(&(data->trackhdr)); - - for(x = 0; x < data->trackhdr.keycount; x++) - { - WriteKeyHeader3ds(data->keyhdrlist + x); - } - break; - } - default: /* A truely hideous thing to do but it helps in prototyping */ - { - if (chunk->size > 6) - { - WriteVoid3ds(chunk->size - 6, chunk->data); - break; - } - } - } /* End of Case */ - } - -} - -void CopyChunkData3ds(chunk3ds *ichunk, chunk3ds *ochunk) -{ - sm_tag(ChunkTagToString3ds(ichunk->tag)); - - /* Don't try to copy if data field is NULL */ - if ((ichunk->data != NULL) && (ochunk->data == NULL)) - { - switch (ichunk->tag) - { - case COLOR_F: - { - ochunk->data = malloc(sizeof(ColorF)); - memcpy(ochunk->data, ichunk->data, sizeof(ColorF)); - break; - } - case LIN_COLOR_F: - { - ochunk->data = malloc(sizeof(LinColorF)); - memcpy(ochunk->data, ichunk->data, sizeof(LinColorF)); - break; - } - case COLOR_24: - { - ochunk->data = malloc(sizeof(Color24)); - memcpy(ochunk->data, ichunk->data, sizeof(Color24)); - break; - } - case LIN_COLOR_24: - { - ochunk->data = malloc(sizeof(LinColor24)); - memcpy(ochunk->data, ichunk->data, sizeof(LinColor24)); - break; - } - case INT_PERCENTAGE: - { - ochunk->data = malloc(sizeof(IntPercentage)); - memcpy(ochunk->data, ichunk->data, sizeof(IntPercentage)); - break; - } - case FLOAT_PERCENTAGE: - { - ochunk->data = malloc(sizeof(FloatPercentage)); - memcpy(ochunk->data, ichunk->data, sizeof(FloatPercentage)); - break; - } - case MAT_MAPNAME: - { - MatMapname *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(MatMapname)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(MatMapname)); - odata->name = malloc(strlen(idata->name)+1); - strcpy(odata->name, idata->name); - - break; - } - case M3D_VERSION: - { - ochunk->data = malloc(sizeof(M3dVersion)); - memcpy(ochunk->data, ichunk->data, sizeof(M3dVersion)); - break; - } - case MESH_VERSION: - { - ochunk->data = malloc(sizeof(MeshVersion)); - memcpy(ochunk->data, ichunk->data, sizeof(MeshVersion)); - break; - } - case MASTER_SCALE: - { - ochunk->data = malloc(sizeof(MasterScale)); - memcpy(ochunk->data, ichunk->data, sizeof(MasterScale)); - break; - } - case LO_SHADOW_BIAS: - { - ochunk->data = malloc(sizeof(LoShadowBias)); - memcpy(ochunk->data, ichunk->data, sizeof(LoShadowBias)); - break; - } - case SHADOW_FILTER: - { - ochunk->data = malloc(sizeof(ShadowFilter)); - memcpy(ochunk->data, ichunk->data, sizeof(ShadowFilter)); - break; - } - case SHADOW_RANGE: - { - ochunk->data = malloc(sizeof(ShadowRange)); - memcpy(ochunk->data, ichunk->data, sizeof(ShadowRange)); - break; - } - case HI_SHADOW_BIAS: - { - ochunk->data = malloc(sizeof(HiShadowBias)); - memcpy(ochunk->data, ichunk->data, sizeof(HiShadowBias)); - break; - } - case RAY_BIAS: - { - ochunk->data = malloc(sizeof(RayBias)); - memcpy(ochunk->data, ichunk->data, sizeof(RayBias)); - break; - } - case SHADOW_MAP_SIZE: - { - ochunk->data = malloc(sizeof(ShadowMapSize)); - memcpy(ochunk->data, ichunk->data, sizeof(ShadowMapSize)); - break; - } - case SHADOW_SAMPLES: - { - ochunk->data = malloc(sizeof(ShadowSamples)); - memcpy(ochunk->data, ichunk->data, sizeof(ShadowSamples)); - break; - } - case O_CONSTS: - { - ochunk->data = malloc(sizeof(OConsts)); - memcpy(ochunk->data, ichunk->data, sizeof(OConsts)); - break; - } - case BIT_MAP: - { - BitMap *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(BitMap)); - odata = ochunk->data; - memcpy(ochunk->data, ichunk->data, sizeof(BitMap)); - odata->bitmap = malloc(strlen(idata->bitmap)+1); - - strcpy(odata->bitmap, idata->bitmap); - - break; - } - case V_GRADIENT: - { - ochunk->data = malloc(sizeof(VGradient)); - memcpy(ochunk->data, ichunk->data, sizeof(VGradient)); - break; - } - case FOG: - { - ochunk->data = malloc(sizeof(Fog)); - memcpy(ochunk->data, ichunk->data, sizeof(Fog)); - break; - } - case LAYER_FOG: - { - ochunk->data = malloc(sizeof(LayerFog)); - memcpy(ochunk->data, ichunk->data, sizeof(LayerFog)); - break; - } - case DISTANCE_CUE: - { - ochunk->data = malloc(sizeof(DistanceCue)); - memcpy(ochunk->data, ichunk->data, sizeof(DistanceCue)); - break; - } - case VIEW_TOP: - case VIEW_BOTTOM: - case VIEW_LEFT: - case VIEW_RIGHT: - case VIEW_FRONT: - case VIEW_BACK: - { - ochunk->data = malloc(sizeof(ViewStandard)); - memcpy(ochunk->data, ichunk->data, sizeof(ViewStandard)); - break; - } - case VIEW_USER: - { - ochunk->data = malloc(sizeof(ViewUser)); - memcpy(ochunk->data, ichunk->data, sizeof(ViewUser)); - break; - } - case VIEW_CAMERA: - { - ViewCamera *idata, *odata; - - ochunk->data = malloc(sizeof(ViewCamera)); - idata = ichunk->data; - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(ViewCamera)); - - odata->name = malloc(strlen(idata->name)+1); - strcpy(odata->name, idata->name); - - break; - } - case MAT_NAME: - { - MatName *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(MatName)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(MatName)); - - odata->name = malloc(strlen(idata->name)+1); - strcpy(odata->name, idata->name); - - break; - } - case MAT_SHADING: - { - ochunk->data = malloc(sizeof(MatShading)); - memcpy(ochunk->data, ichunk->data, sizeof(MatShading)); - break; - } - case MAT_ACUBIC: - { - ochunk->data = malloc(sizeof(MatAcubic)); - memcpy(ochunk->data, ichunk->data, sizeof(MatAcubic)); - break; - } - case MAT_SXP_TEXT_DATA: - case MAT_SXP_TEXT2_DATA: - case MAT_SXP_OPAC_DATA: - case MAT_SXP_BUMP_DATA: - case MAT_SXP_SPEC_DATA: - case MAT_SXP_SHIN_DATA: - case MAT_SXP_SELFI_DATA: - case MAT_SXP_TEXT_MASKDATA: - case MAT_SXP_TEXT2_MASKDATA: - case MAT_SXP_OPAC_MASKDATA: - case MAT_SXP_BUMP_MASKDATA: - case MAT_SXP_SPEC_MASKDATA: - case MAT_SXP_SHIN_MASKDATA: - case MAT_SXP_SELFI_MASKDATA: - case MAT_SXP_REFL_MASKDATA: - case PROC_DATA: - { - IpasData *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(IpasData)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(IpasData)); - odata->data = malloc(idata->size); - memcpy(odata->data, idata->data, (size_t)(idata->size)); - - break; - } - case MAT_WIRESIZE: - { - ochunk->data = malloc(sizeof(MatWireSize)); - memcpy(ochunk->data, ichunk->data, sizeof(MatWireSize)); - break; - } - case MAT_MAP_TILING: - { - ochunk->data = malloc(sizeof(MatMapTiling)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapTiling)); - break; - } - case MAT_MAP_TEXBLUR: - { - ochunk->data = malloc(sizeof(MatMapTexblur)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapTexblur)); - break; - } - case MAT_MAP_USCALE: - { - ochunk->data = malloc(sizeof(MatMapUScale)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapUScale)); - break; - } - case MAT_MAP_VSCALE: - { - ochunk->data = malloc(sizeof(MatMapVScale)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapVScale)); - break; - } - case MAT_MAP_UOFFSET: - { - ochunk->data = malloc(sizeof(MatMapUOffset)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapUOffset)); - break; - } - case MAT_MAP_VOFFSET: - { - ochunk->data = malloc(sizeof(MatMapVOffset)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapVOffset)); - break; - } - case MAT_MAP_ANG: - { - ochunk->data = malloc(sizeof(MatMapAng)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapAng)); - break; - } - case MAT_MAP_COL1: - { - ochunk->data = malloc(sizeof(MatMapCol1)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapCol1)); - break; - } - case MAT_MAP_COL2: - { - ochunk->data = malloc(sizeof(MatMapCol2)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapCol2)); - break; - } - case MAT_MAP_RCOL: - { - ochunk->data = malloc(sizeof(MatMapRCol)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapRCol)); - break; - } - case MAT_MAP_GCOL: - { - ochunk->data = malloc(sizeof(MatMapGCol)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapGCol)); - break; - } - case MAT_MAP_BCOL: - { - ochunk->data = malloc(sizeof(MatMapBCol)); - memcpy(ochunk->data, ichunk->data, sizeof(MatMapBCol)); - break; - } - case MAT_BUMP_PERCENT: - { - ochunk->data = malloc(sizeof(MatBumpPercent)); - memcpy(ochunk->data, ichunk->data, sizeof(MatBumpPercent)); - break; - } - case NAMED_OBJECT: - { - NamedObject *idata = ichunk->data, *odata; - - odata = ochunk->data = malloc(sizeof(NamedObject)); - odata->name = strdup3ds(idata->name); - break; - } - case POINT_ARRAY: - { - PointArray *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(PointArray)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(PointArray)); - - odata->pointlist = calloc(idata->vertices, sizeof(point3ds)); - memcpy(odata->pointlist, idata->pointlist, sizeof(point3ds)*idata->vertices); - break; - } - case POINT_FLAG_ARRAY: - { - PointFlagArray *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(PointFlagArray)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(PointFlagArray)); - odata->flaglist = calloc(idata->flags, sizeof(short3ds)); - - memcpy(odata->flaglist, idata->flaglist, sizeof(short3ds)*idata->flags); - - break; - } - case FACE_ARRAY: - { - FaceArray *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(FaceArray)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(FaceArray)); - - odata->facelist = calloc(idata->faces, sizeof(face3ds)); - memcpy(odata->facelist, idata->facelist, idata->faces*sizeof(face3ds)); - - break; - } - case MSH_MAT_GROUP: - { - MshMatGroup *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(MshMatGroup)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(MshMatGroup)); - - odata->facelist = malloc(idata->faces*sizeof(ushort3ds)); - memcpy(odata->facelist, idata->facelist, idata->faces*sizeof(ushort3ds)); - - odata->matname = malloc(strlen(idata->matname)+1); - strcpy(odata->matname, idata->matname); - - break; - } - case MSH_BOXMAP: - { - MshBoxmap *idata = ichunk->data, *odata; - ushort3ds i; - - ochunk->data = malloc(sizeof(MshBoxmap)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(MshBoxmap)); - - for (i = 0; i < 6; i++) - { - odata->matnames[i] = malloc(strlen(idata->matnames[i])+1); - strcpy(odata->matnames[i], idata->matnames[i]); - } - break; - } - case SMOOTH_GROUP: - { - SmoothGroup *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(SmoothGroup)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(SmoothGroup)); - - odata->grouplist = malloc(idata->groups*sizeof(ulong3ds)); - memcpy(odata->grouplist, idata->grouplist, idata->groups*sizeof(ulong3ds)); - - break; - } - case TEX_VERTS: - { - TexVerts *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(TexVerts)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(TexVerts)); - - odata->textvertlist = malloc(idata->numcoords*sizeof(textvert3ds)); - memcpy(odata->textvertlist, idata->textvertlist, idata->numcoords*sizeof(textvert3ds)); - - break; - } - case MESH_MATRIX: - { - ochunk->data = malloc(sizeof(MeshMatrix)); - memcpy(ochunk->data, ichunk->data, sizeof(MeshMatrix)); - break; - } - case MESH_COLOR: - { - ochunk->data = malloc(sizeof(MeshColor)); - memcpy(ochunk->data, ichunk->data, sizeof(MeshColor)); - break; - } - case MESH_TEXTURE_INFO: - { - ochunk->data = malloc(sizeof(MeshTextureInfo)); - memcpy(ochunk->data, ichunk->data, sizeof(MeshTextureInfo)); - break; - } - case PROC_NAME: - { - ProcName *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(ProcName)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(ProcName)); - odata->name = malloc(strlen(idata->name)+1); - strcpy(odata->name, idata->name); - - break; - } - case N_DIRECT_LIGHT: - { - ochunk->data = malloc(sizeof(NDirectLight)); - memcpy(ochunk->data, ichunk->data, sizeof(NDirectLight)); - break; - } - case DL_EXCLUDE: - { - DlExclude *idata = ichunk->data, *odata; - - odata = ochunk->data = malloc(sizeof(DlExclude)); - odata->name = strdup3ds(idata->name); - break; - } - case DL_INNER_RANGE: - { - ochunk->data = malloc(sizeof(DlInnerRange)); - memcpy(ochunk->data, ichunk->data, sizeof(DlInnerRange)); - break; - } - case DL_OUTER_RANGE: - { - ochunk->data = malloc(sizeof(DlOuterRange)); - memcpy(ochunk->data, ichunk->data, sizeof(DlOuterRange)); - break; - } - case DL_MULTIPLIER: - { - ochunk->data = malloc(sizeof(DlMultiplier)); - memcpy(ochunk->data, ichunk->data, sizeof(DlMultiplier)); - break; - } - case DL_SPOTLIGHT: - { - ochunk->data = malloc(sizeof(DlSpotlight)); - memcpy(ochunk->data, ichunk->data, sizeof(DlSpotlight)); - break; - } - case DL_LOCAL_SHADOW2: - { - ochunk->data = malloc(sizeof(DlLocalShadow2)); - memcpy(ochunk->data, ichunk->data, sizeof(DlLocalShadow2)); - break; - } - case DL_SPOT_ROLL: - { - ochunk->data = malloc(sizeof(DlSpotRoll)); - memcpy(ochunk->data, ichunk->data, sizeof(DlSpotRoll)); - break; - } - case DL_SPOT_ASPECT: - { - ochunk->data = malloc(sizeof(DlSpotAspect)); - memcpy(ochunk->data, ichunk->data, sizeof(DlSpotAspect)); - break; - } - case DL_SPOT_PROJECTOR: - { - DlSpotProjector *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(DlSpotProjector)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(DlSpotProjector)); - - odata->name = malloc(strlen(idata->name)+1); - strcpy(odata->name, idata->name); - - break; - } - case DL_RAY_BIAS: - { - ochunk->data = malloc(sizeof(DlRayBias)); - memcpy(ochunk->data, ichunk->data, sizeof(DlRayBias)); - break; - } - case N_CAMERA: - { - ochunk->data = malloc(sizeof(NCamera)); - memcpy(ochunk->data, ichunk->data, sizeof(NCamera)); - break; - } - case CAM_RANGES: - { - ochunk->data = malloc(sizeof(CamRanges)); - memcpy(ochunk->data, ichunk->data, sizeof(CamRanges)); - break; - } - case VIEWPORT_LAYOUT: - { - ochunk->data = malloc(sizeof(ViewportLayout)); - memcpy(ochunk->data, ichunk->data, sizeof(ViewportLayout)); - break; - } - case VIEWPORT_SIZE: - { - ochunk->data = malloc(sizeof(ViewportSize)); - memcpy(ochunk->data, ichunk->data, sizeof(ViewportSize)); - break; - } - case VIEWPORT_DATA_3: - case VIEWPORT_DATA: - { - ViewportData *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(ViewportData)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(ViewportData)); - odata->camname = malloc(strlen(idata->camname)+1); - strcpy(odata->camname, idata->camname); - - break; - } - case KFHDR: - { - KFHdr *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(KFHdr)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(KFHdr)); - odata->filename = malloc(strlen(idata->filename)+1); - strcpy(odata->filename, idata->filename); - - break; - } - case KFSEG: - { - ochunk->data = malloc(sizeof(KFSeg)); - memcpy(ochunk->data, ichunk->data, sizeof(KFSeg)); - break; - } - case KFCURTIME: - { - ochunk->data = malloc(sizeof(KFCurtime)); - memcpy(ochunk->data, ichunk->data, sizeof(KFCurtime)); - break; - } - case NODE_ID: - { - ochunk->data = malloc(sizeof(KFId)); - memcpy(ochunk->data, ichunk->data, sizeof(KFId)); - break; - } - case NODE_HDR: - { - NodeHdr *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(NodeHdr)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(NodeHdr)); - - odata->objname = malloc(strlen(idata->objname)+1); - strcpy(odata->objname, idata->objname); - - break; - } - case PIVOT: - { - ochunk->data = malloc(sizeof(Pivot)); - memcpy(ochunk->data, ichunk->data, sizeof(Pivot)); - break; - } - case PARENT_NAME: - { - InstanceName *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(InstanceName)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(InstanceName)); - - odata->name = malloc(strlen(idata->name)+1); - strcpy(odata->name, idata->name); - - break; - } - case INSTANCE_NAME: - { - InstanceName *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(InstanceName)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(InstanceName)); - - odata->name = malloc(strlen(idata->name)+1); - strcpy(odata->name, idata->name); - - break; - } - case MORPH_SMOOTH: - { - ochunk->data = malloc(sizeof(MorphSmooth)); - memcpy(ochunk->data, ichunk->data, sizeof(MorphSmooth)); - break; - } - case BOUNDBOX: - { - ochunk->data = malloc(sizeof(BoundBox)); - memcpy(ochunk->data, ichunk->data, sizeof(BoundBox)); - break; - } - case POS_TRACK_TAG: - { - PosTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(PosTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(PosTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->positionlist = malloc(idata->trackhdr.keycount*sizeof(point3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->positionlist, idata->positionlist, idata->trackhdr.keycount*sizeof(point3ds)); - - break; - } - case COL_TRACK_TAG: - { - ColTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(ColTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(ColTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->colorlist = malloc(idata->trackhdr.keycount*sizeof(fcolor3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->colorlist, idata->colorlist, idata->trackhdr.keycount*sizeof(fcolor3ds)); - - break; - } - case ROT_TRACK_TAG: - { - RotTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(RotTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(RotTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->rotationlist = malloc(idata->trackhdr.keycount*sizeof(kfrotkey3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->rotationlist, idata->rotationlist, idata->trackhdr.keycount*sizeof(kfrotkey3ds)); - - break; - } - case SCL_TRACK_TAG: - { - ScaleTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(ScaleTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(ScaleTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->scalelist = malloc(idata->trackhdr.keycount*sizeof(point3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->scalelist, idata->scalelist, idata->trackhdr.keycount*sizeof(point3ds)); - - break; - } - case MORPH_TRACK_TAG: - { - MorphTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(MorphTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(MorphTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->morphlist = malloc(idata->trackhdr.keycount*sizeof(kfmorphkey3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->morphlist, idata->morphlist, idata->trackhdr.keycount*sizeof(kfmorphkey3ds)); - - break; - } - case FOV_TRACK_TAG: - { - FovTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(FovTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(FovTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->fovanglelist = malloc(idata->trackhdr.keycount*sizeof(float3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->fovanglelist, idata->fovanglelist, idata->trackhdr.keycount*sizeof(float3ds)); - - break; - } - case ROLL_TRACK_TAG: - { - RollTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(RollTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(RollTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->rollanglelist = malloc(idata->trackhdr.keycount*sizeof(float3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->rollanglelist, idata->rollanglelist, idata->trackhdr.keycount*sizeof(float3ds)); - - break; - } - case HOT_TRACK_TAG: - { - HotTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(HotTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(HotTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->hotspotanglelist = malloc(idata->trackhdr.keycount*sizeof(float3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->hotspotanglelist, idata->hotspotanglelist, idata->trackhdr.keycount*sizeof(float3ds)); - - break; - } - case FALL_TRACK_TAG: - { - FallTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(FallTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(FallTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - odata->falloffanglelist = malloc(idata->trackhdr.keycount*sizeof(float3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - memcpy(odata->falloffanglelist, idata->falloffanglelist, idata->trackhdr.keycount*sizeof(float3ds)); - - break; - } - case HIDE_TRACK_TAG: - { - HideTrackTag *idata = ichunk->data, *odata; - - ochunk->data = malloc(sizeof(HideTrackTag)); - odata = ochunk->data; - - memcpy(ochunk->data, ichunk->data, sizeof(HideTrackTag)); - - odata->keyhdrlist = malloc(idata->trackhdr.keycount*sizeof(keyheader3ds)); - - memcpy(odata->keyhdrlist, idata->keyhdrlist, idata->trackhdr.keycount*sizeof(keyheader3ds)); - break; - } - default: /* complements the default in the reader, will work on any pointer free chunk */ - { - if (ichunk->size > 6) - { - ochunk->data = malloc(ichunk->size - 6); - memcpy(ochunk->data, ichunk->data, ichunk->size - 6); - } - } - - - } /* End of Case */ - } - sm_untag(); -} - -/* Function only frees the chunk data if it has been written to a file */ -void FreeFileChunkData3ds(chunk3ds *chunk) -{ - myassert(chunk != NULL, "FreeFileChunkData3ds: arg *chunk cannot be NULL"); - - if (IsValidFileIndex3ds(chunk->readindex)) FreeChunkData3ds(chunk); -} - -void FreeChunkData3ds(chunk3ds *chunk) -{ - myassert(chunk != NULL, "FreeChunkData3ds: arge *chunk cannot be a NULL pointer."); - - if (chunk->data != NULL) - { - /* Switch only cares about chunk->data fields that contain other pointers that - need to be free */ - - switch(chunk->tag) - { - case MAT_MAPNAME: - { - MatMapname *data; - data = chunk->data; - free(data->name); - break; - } - case BIT_MAP: - { - BitMap *data; - data = chunk->data; - free(data->bitmap); - break; - } - case VIEWPORT_DATA_3: - case VIEWPORT_DATA: - { - ViewportData *data; - data = chunk->data; - free(data->camname); - break; - } - case VIEW_CAMERA: - { - ViewCamera *data; - data = chunk->data; - free(data->name); - break; - } - case MAT_NAME: - { - MatName *data; - data = chunk->data; - free(data->name); - break; - } - case MAT_SXP_TEXT_DATA: - case MAT_SXP_TEXT2_DATA: - case MAT_SXP_OPAC_DATA: - case MAT_SXP_BUMP_DATA: - case MAT_SXP_SPEC_DATA: - case MAT_SXP_SHIN_DATA: - case MAT_SXP_SELFI_DATA: - case MAT_SXP_TEXT_MASKDATA: - case MAT_SXP_TEXT2_MASKDATA: - case MAT_SXP_OPAC_MASKDATA: - case MAT_SXP_BUMP_MASKDATA: - case MAT_SXP_SPEC_MASKDATA: - case MAT_SXP_SHIN_MASKDATA: - case MAT_SXP_SELFI_MASKDATA: - case MAT_SXP_REFL_MASKDATA: - case PROC_DATA: - { - IpasData *data; - data = chunk->data; - free(data->data); - break; - } - case NAMED_OBJECT: - { - NamedObject *data; - data = chunk->data; - free(data->name); - break; - } - case DL_EXCLUDE: - { - DlExclude *data; - data = chunk->data; - free(data->name); - break; - } - case POINT_ARRAY: - { - PointArray *data; - data = chunk->data; - free(data->pointlist); - break; - } - case POINT_FLAG_ARRAY: - { - PointFlagArray *data; - data = chunk->data; - free(data->flaglist); - break; - } - case FACE_ARRAY: - { - FaceArray *data; - data = chunk->data; - free(data->facelist); - break; - } - case MSH_MAT_GROUP: - { - MshMatGroup *data; - data = chunk->data; - free(data->facelist); - free(data->matname); - break; - } - case MSH_BOXMAP: - { - MshBoxmap *data; - ushort3ds i; - - data = chunk->data; - for (i = 0; i < 6; i++) - { - free(data->matnames[i]); - } - break; - } - case SMOOTH_GROUP: - { - SmoothGroup *data; - data = chunk->data; - free(data->grouplist); - break; - } - case TEX_VERTS: - { - TexVerts *data; - data = chunk->data; - free(data->textvertlist); - break; - } - case PROC_NAME: - { - ProcName *data; - data = chunk->data; - free(data->name); - break; - } - case DL_SPOT_PROJECTOR: - { - DlSpotProjector *data; - data = chunk->data; - free(data->name); - break; - } - case XDATA_ENTRY: - { - XDataEntry *data = chunk->data; - free(data->data); - break; - } - case XDATA_APPNAME: - { - XDataAppName *data = chunk->data; - free(data->name); - break; - } - case XDATA_STRING: - { - XDataString *data = chunk->data; - free(data->string); - break; - } - case KFHDR: - { - KFHdr *data; - data = chunk->data; - free(data->filename); - break; - } - case NODE_HDR: - { - NodeHdr *data; - data = chunk->data; - free(data->objname); - break; - } - case PARENT_NAME: - { - InstanceName *data; - data = chunk->data; - free(data->name); - break; - } - case INSTANCE_NAME: - { - InstanceName *data; - data = chunk->data; - free(data->name); - break; - } - case POS_TRACK_TAG: - { - PosTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->positionlist); - break; - } - case COL_TRACK_TAG: - { - ColTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->colorlist); - break; - } - case ROT_TRACK_TAG: - { - RotTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->rotationlist); - break; - } - case SCL_TRACK_TAG: - { - ScaleTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->scalelist); - break; - } - case MORPH_TRACK_TAG: - { - MorphTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->morphlist); - break; - } - case FOV_TRACK_TAG: - { - FovTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->fovanglelist); - break; - } - case ROLL_TRACK_TAG: - { - RollTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->rollanglelist); - break; - } - case HOT_TRACK_TAG: - { - HotTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->hotspotanglelist); - break; - } - case FALL_TRACK_TAG: - { - FallTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - free(data->falloffanglelist); - break; - } - case HIDE_TRACK_TAG: - { - HideTrackTag *data; - data = chunk->data; - free(data->keyhdrlist); - break; - } - default: - { - break; - } - } /* End case */ - - free(chunk->data); - chunk->data = NULL; - } - -} - -/* Computes a chunk weighting used to determine proper chunk order, - higher values appear earlier in the parent than lower values */ -long3ds GetChunkValue3ds(chunktag3ds tag) -{ - long3ds value = 0; - - /* Only chunks where an explicit order matters are in the case */ - - switch(tag) - { - case NULL_CHUNK: value++; /* These should just be ignored */ - case SMAGIC: value++; - case LMAGIC: value++; - case M3DMAGIC: value++; - case M3D_VERSION: value++; - case MDATA: value++; - case KFDATA: value++; - case COLOR_24: value++; - case LIN_COLOR_24: value++; - case MESH_VERSION: value++; - case MAT_ENTRY: value++; - case KFHDR: value++; - case MASTER_SCALE: value++; - case VIEWPORT_LAYOUT: value++; - case LO_SHADOW_BIAS: value++; - case SHADOW_MAP_SIZE: value++; - case SHADOW_FILTER: value++; - case RAY_BIAS: value++; - case O_CONSTS: value++; - case AMBIENT_LIGHT: value++; - case SOLID_BGND: value++; - case BIT_MAP: value++; - case V_GRADIENT: value++; - case USE_BIT_MAP: - case USE_SOLID_BGND: - case USE_V_GRADIENT: value++; - case FOG: value++; - case LAYER_FOG: value++; - case DISTANCE_CUE: value++; - case DEFAULT_VIEW: value++; - case NAMED_OBJECT: value++; - case KFSEG: value++; - case KFCURTIME: value++; - case TARGET_NODE_TAG: - case L_TARGET_NODE_TAG: - case OBJECT_NODE_TAG: - case CAMERA_NODE_TAG: - case SPOTLIGHT_NODE_TAG: value++; - case AMBIENT_NODE_TAG: value++; - case N_TRI_OBJECT: - case N_CAMERA: - case N_DIRECT_LIGHT: value++; - case OBJ_HIDDEN: value++; - break; - default: value = 0; - } - return value; -} - diff --git a/3rdparty/3dsftk3/src/chunk3ds.h b/3rdparty/3dsftk3/src/chunk3ds.h deleted file mode 100644 index 301da1e7..00000000 --- a/3rdparty/3dsftk3/src/chunk3ds.h +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef CHUNK_3DS_H -#define CHUNK_3DS_H - -#include "3dstype.h" -#include "3dserr.h" -#include "chunkinf.h" - -/* Private Typedefs */ - -/* chunk3ds - Internal database representation of file information */ -typedef struct chunk3ds { - chunktag3ds tag; /* Type of chunk */ - ulong3ds size; /* Number of bytes used by chunk */ - ulong3ds position; /* Offset in source file */ - void *data; /* Memory copy of file data */ - struct chunk3ds *sibling; /* Next chunk in database */ - struct chunk3ds *children; /* Chunks contained within this chunk */ - ubyte3ds readindex; /* Index of source file in file table */ - ubyte3ds writeindex; /* Index of destination file in file table */ -} chunk3ds; - -/* chunklistentry3ds - Cross reference between name and chunk */ -typedef struct { - char3ds *name; /* Chunk Name list */ - chunk3ds *chunk; /* Corresponding Pos */ -} chunklistentry3ds; - -/* chunklist3ds - List of cross references */ -typedef struct -{ - ulong3ds count; /* Number of entries in list */ - chunklistentry3ds *list; /* Contents of list */ -} chunklist3ds; - -/* End Private */ - -/* Public Typedefs */ - -/* namelistentry3ds - Name of database object */ -typedef struct -{ - char3ds *name; /* Name of object */ -} namelistentry3ds; - -/* namelist3ds - List of database object names */ -typedef struct -{ - ulong3ds count; /*--- How many entries are in list */ - ulong3ds spaces; /*--- How much space for entries */ - namelistentry3ds *list; /*--- char ** to access pointers */ -} namelist3ds; - -/* End Public */ - -/* Public Prototypes */ - -/* Functions to use with namelist3ds structures */ -void InitNameList3ds(namelist3ds **chunk, ulong3ds count); -void ReleaseNameList3ds(namelist3ds **chunk); -void AddToNameList3ds(namelist3ds **list, char3ds *name); -/* End Public */ - -void InitChunk3ds(chunk3ds **chunk); -void InitChunkAs3ds(chunk3ds **chunk, chunktag3ds tag); -void *InitChunkAndData3ds(chunk3ds **chunk, chunktag3ds tag); -void ReleaseChunk3ds(chunk3ds **chunk); -void ReleaseSiblingChunk3ds(chunk3ds **chunk); -void DeleteChunk3ds(chunk3ds *chunk); -void FindChunk3ds(chunk3ds *local, chunktag3ds tag, chunk3ds **chunk); -void FindNextChunk3ds(chunk3ds *local, chunktag3ds tag, chunk3ds **chunk); -void AddChild3ds(chunk3ds *parent, chunk3ds *child); -void ReplaceOrAddChild3ds(chunk3ds *parent, chunktag3ds tag, chunk3ds **child); -void CopyChunk3ds(chunk3ds *ichunk, chunk3ds **ochunk); -void DisconnectChunk3ds(chunk3ds *chunk); -void CopyChunkData3ds(chunk3ds *ichunk, chunk3ds *ochunk); -void InitChunkList3ds(chunklist3ds **chunk, ulong3ds count); -void ReleaseChunkList3ds(chunklist3ds **chunk); -void *InitChunkData3ds(chunk3ds *chunk); -void *ReadChunkData3ds(chunk3ds *chunk); -void WriteChunkData3ds(chunk3ds *chunk); -void FreeFileChunkData3ds(chunk3ds *chunk); -void FreeChunkData3ds(chunk3ds *chunk); -long3ds CheckChunk3ds(chunk3ds *chunk); -long3ds GetChunkValue3ds(chunktag3ds tag); -void AddChildOrdered3ds(chunk3ds *parent, chunk3ds *child); - - -#endif diff --git a/3rdparty/3dsftk3/src/chunkinf.h b/3rdparty/3dsftk3/src/chunkinf.h deleted file mode 100644 index 716da453..00000000 --- a/3rdparty/3dsftk3/src/chunkinf.h +++ /dev/null @@ -1,785 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef CHUNK_INF_3DS_H -#define CHUNK_INF_3DS_H - -#include "3dstype.h" - -/* Private Typedefs */ - -/* chunktag3ds - enumeration of all possible chunk type identifiers. See appendix for */ -/* more information concerning chunk structures */ -typedef enum -{ - /* Trick Chunk Flags For ChunkSyntax function */ - - NULL_CHUNK = 0x0000, - ChunkType = 0x0995, - ChunkUnique = 0x0996, - NotChunk = 0x0997, - Container = 0x0998, - IsChunk = 0x0999, - - /* Dummy Chunk that sometimes appears in 3ds files created by prerelease 3D Studio R2 */ - DUMMY = 0xFFFF, - - /* Trick Chunk Types For Open*, Write*, Close* functions */ - - POINT_ARRAY_ENTRY = 0xF110, - POINT_FLAG_ARRAY_ENTRY = 0xF111, - FACE_ARRAY_ENTRY = 0xF120, - MSH_MAT_GROUP_ENTRY = 0xF130, - TEX_VERTS_ENTRY = 0xF140, - SMOOTH_GROUP_ENTRY = 0xF150, - POS_TRACK_TAG_KEY = 0xF020, - ROT_TRACK_TAG_KEY = 0xF021, - SCL_TRACK_TAG_KEY = 0xF022, - FOV_TRACK_TAG_KEY = 0xF023, - ROLL_TRACK_TAG_KEY = 0xF024, - COL_TRACK_TAG_KEY = 0xF025, - MORPH_TRACK_TAG_KEY = 0xF026, - HOT_TRACK_TAG_KEY = 0xF027, - FALL_TRACK_TAG_KEY = 0xF028, - - /* 3DS File Chunk IDs */ - - M3DMAGIC = 0x4D4D, - SMAGIC = 0x2D2D, - LMAGIC = 0x2D3D, - MLIBMAGIC = 0x3DAA, - MATMAGIC = 0x3DFF, - M3D_VERSION = 0x0002, - M3D_KFVERSION = 0x0005, - - /* Mesh Chunk Ids */ - - MDATA = 0x3D3D, - MESH_VERSION = 0x3D3E, - COLOR_F = 0x0010, - COLOR_24 = 0x0011, - LIN_COLOR_24 = 0x0012, - LIN_COLOR_F = 0x0013, - INT_PERCENTAGE = 0x0030, - FLOAT_PERCENTAGE = 0x0031, - - MASTER_SCALE = 0x0100, - - BIT_MAP = 0x1100, - USE_BIT_MAP = 0x1101, - SOLID_BGND = 0x1200, - USE_SOLID_BGND = 0x1201, - V_GRADIENT = 0x1300, - USE_V_GRADIENT = 0x1301, - - LO_SHADOW_BIAS = 0x1400, - HI_SHADOW_BIAS = 0x1410, - SHADOW_MAP_SIZE = 0x1420, - SHADOW_SAMPLES = 0x1430, - SHADOW_RANGE = 0x1440, - SHADOW_FILTER = 0x1450, - RAY_BIAS = 0x1460, - - O_CONSTS = 0x1500, - - AMBIENT_LIGHT = 0x2100, - - FOG = 0x2200, - USE_FOG = 0x2201, - FOG_BGND = 0x2210, - DISTANCE_CUE = 0x2300, - USE_DISTANCE_CUE = 0x2301, - LAYER_FOG = 0x2302, - USE_LAYER_FOG = 0x2303, - DCUE_BGND = 0x2310, - - DEFAULT_VIEW = 0x3000, - VIEW_TOP = 0x3010, - VIEW_BOTTOM = 0x3020, - VIEW_LEFT = 0x3030, - VIEW_RIGHT = 0x3040, - VIEW_FRONT = 0x3050, - VIEW_BACK = 0x3060, - VIEW_USER = 0x3070, - VIEW_CAMERA = 0x3080, - VIEW_WINDOW = 0x3090, - - NAMED_OBJECT = 0x4000, - OBJ_HIDDEN = 0x4010, - OBJ_VIS_LOFTER = 0x4011, - OBJ_DOESNT_CAST = 0x4012, - OBJ_MATTE = 0x4013, - OBJ_FAST = 0x4014, - OBJ_PROCEDURAL = 0x4015, - OBJ_FROZEN = 0x4016, - OBJ_DONT_RCVSHADOW = 0x4017, - - N_TRI_OBJECT = 0x4100, - - POINT_ARRAY = 0x4110, - POINT_FLAG_ARRAY = 0x4111, - FACE_ARRAY = 0x4120, - MSH_MAT_GROUP = 0x4130, - OLD_MAT_GROUP = 0x4131, - TEX_VERTS = 0x4140, - SMOOTH_GROUP = 0x4150, - MESH_MATRIX = 0x4160, - MESH_COLOR = 0x4165, - MESH_TEXTURE_INFO = 0x4170, - PROC_NAME = 0x4181, - PROC_DATA = 0x4182, - MSH_BOXMAP = 0x4190, - - N_D_L_OLD = 0x4400, - - N_CAM_OLD = 0x4500, - - N_DIRECT_LIGHT = 0x4600, - DL_SPOTLIGHT = 0x4610, - DL_OFF = 0x4620, - DL_ATTENUATE = 0x4625, - DL_RAYSHAD = 0x4627, - DL_SHADOWED = 0x4630, - DL_LOCAL_SHADOW = 0x4640, - DL_LOCAL_SHADOW2 = 0x4641, - DL_SEE_CONE = 0x4650, - DL_SPOT_RECTANGULAR = 0x4651, - DL_SPOT_OVERSHOOT = 0x4652, - DL_SPOT_PROJECTOR = 0x4653, - DL_EXCLUDE = 0x4654, - DL_RANGE = 0x4655, /* Not used in R3 */ - DL_SPOT_ROLL = 0x4656, - DL_SPOT_ASPECT = 0x4657, - DL_RAY_BIAS = 0x4658, - DL_INNER_RANGE = 0x4659, - DL_OUTER_RANGE = 0x465A, - DL_MULTIPLIER = 0x465B, - - N_AMBIENT_LIGHT = 0x4680, - - N_CAMERA = 0x4700, - CAM_SEE_CONE = 0x4710, - CAM_RANGES = 0x4720, - - HIERARCHY = 0x4F00, - PARENT_OBJECT = 0x4F10, - PIVOT_OBJECT = 0x4F20, - PIVOT_LIMITS = 0x4F30, - PIVOT_ORDER = 0x4F40, - XLATE_RANGE = 0x4F50, - - POLY_2D = 0x5000, - - /* Flags in shaper file that tell whether polys make up an ok shape */ - - SHAPE_OK = 0x5010, - SHAPE_NOT_OK = 0x5011, - - SHAPE_HOOK = 0x5020, - - PATH_3D = 0x6000, - PATH_MATRIX = 0x6005, - SHAPE_2D = 0x6010, - M_SCALE = 0x6020, - M_TWIST = 0x6030, - M_TEETER = 0x6040, - M_FIT = 0x6050, - M_BEVEL = 0x6060, - XZ_CURVE = 0x6070, - YZ_CURVE = 0x6080, - INTERPCT = 0x6090, - DEFORM_LIMIT = 0x60A0, - - /* Flags for Modeler options */ - - USE_CONTOUR = 0x6100, - USE_TWEEN = 0x6110, - USE_SCALE = 0x6120, - USE_TWIST = 0x6130, - USE_TEETER = 0x6140, - USE_FIT = 0x6150, - USE_BEVEL = 0x6160, - - /* Viewport description chunks */ - - VIEWPORT_LAYOUT_OLD = 0x7000, - VIEWPORT_DATA_OLD = 0x7010, - VIEWPORT_LAYOUT = 0x7001, - VIEWPORT_DATA = 0x7011, - VIEWPORT_DATA_3 = 0x7012, - VIEWPORT_SIZE = 0x7020, - NETWORK_VIEW = 0x7030, - - /* External Application Data */ - - XDATA_SECTION = 0x8000, - XDATA_ENTRY = 0x8001, - XDATA_APPNAME = 0x8002, - XDATA_STRING = 0x8003, - XDATA_FLOAT = 0x8004, - XDATA_DOUBLE = 0x8005, - XDATA_SHORT = 0x8006, - XDATA_LONG = 0x8007, - XDATA_VOID = 0x8008, - XDATA_GROUP = 0x8009, - XDATA_RFU6 = 0x800A, - XDATA_RFU5 = 0x800B, - XDATA_RFU4 = 0x800C, - XDATA_RFU3 = 0x800D, - XDATA_RFU2 = 0x800E, - XDATA_RFU1 = 0x800F, - - PARENT_NAME = 0x80F0, - - /* Material Chunk IDs */ - - MAT_ENTRY = 0xAFFF, - MAT_NAME = 0xA000, - MAT_AMBIENT = 0xA010, - MAT_DIFFUSE = 0xA020, - MAT_SPECULAR = 0xA030, - MAT_SHININESS = 0xA040, - MAT_SHIN2PCT = 0xA041, - MAT_SHIN3PCT = 0xA042, - MAT_TRANSPARENCY = 0xA050, - MAT_XPFALL = 0xA052, - MAT_REFBLUR = 0xA053, - - MAT_SELF_ILLUM = 0xA080, - MAT_TWO_SIDE = 0xA081, - MAT_DECAL = 0xA082, - MAT_ADDITIVE = 0xA083, - MAT_SELF_ILPCT = 0xA084, - MAT_WIRE = 0xA085, - MAT_SUPERSMP = 0xA086, - MAT_WIRESIZE = 0xA087, - MAT_FACEMAP = 0xA088, - MAT_XPFALLIN = 0xA08A, - MAT_PHONGSOFT = 0xA08C, - MAT_WIREABS = 0xA08E, - - MAT_SHADING = 0xA100, - - MAT_TEXMAP = 0xA200, - MAT_OPACMAP = 0xA210, - MAT_REFLMAP = 0xA220, - MAT_BUMPMAP = 0xA230, - MAT_SPECMAP = 0xA204, - MAT_USE_XPFALL = 0xA240, - MAT_USE_REFBLUR = 0xA250, - MAT_BUMP_PERCENT = 0xA252, - - MAT_MAPNAME = 0xA300, - MAT_ACUBIC = 0xA310, - - MAT_SXP_TEXT_DATA = 0xA320, - MAT_SXP_TEXT2_DATA = 0xA321, - MAT_SXP_OPAC_DATA = 0xA322, - MAT_SXP_BUMP_DATA = 0xA324, - MAT_SXP_SPEC_DATA = 0xA325, - MAT_SXP_SHIN_DATA = 0xA326, - MAT_SXP_SELFI_DATA = 0xA328, - MAT_SXP_TEXT_MASKDATA = 0xA32A, - MAT_SXP_TEXT2_MASKDATA = 0xA32C, - MAT_SXP_OPAC_MASKDATA = 0xA32E, - MAT_SXP_BUMP_MASKDATA = 0xA330, - MAT_SXP_SPEC_MASKDATA = 0xA332, - MAT_SXP_SHIN_MASKDATA = 0xA334, - MAT_SXP_SELFI_MASKDATA = 0xA336, - MAT_SXP_REFL_MASKDATA = 0xA338, - MAT_TEX2MAP = 0xA33A, - MAT_SHINMAP = 0xA33C, - MAT_SELFIMAP = 0xA33D, - MAT_TEXMASK = 0xA33E, - MAT_TEX2MASK = 0xA340, - MAT_OPACMASK = 0xA342, - MAT_BUMPMASK = 0xA344, - MAT_SHINMASK = 0xA346, - MAT_SPECMASK = 0xA348, - MAT_SELFIMASK = 0xA34A, - MAT_REFLMASK = 0xA34C, - MAT_MAP_TILINGOLD = 0xA350, - MAT_MAP_TILING = 0xA351, - MAT_MAP_TEXBLUR_OLD = 0xA352, - MAT_MAP_TEXBLUR = 0xA353, - MAT_MAP_USCALE = 0xA354, - MAT_MAP_VSCALE = 0xA356, - MAT_MAP_UOFFSET = 0xA358, - MAT_MAP_VOFFSET = 0xA35A, - MAT_MAP_ANG = 0xA35C, - MAT_MAP_COL1 = 0xA360, - MAT_MAP_COL2 = 0xA362, - MAT_MAP_RCOL = 0xA364, - MAT_MAP_GCOL = 0xA366, - MAT_MAP_BCOL = 0xA368, - - /* Keyframe Chunk IDs */ - - KFDATA = 0xB000, - KFHDR = 0xB00A, - AMBIENT_NODE_TAG = 0xB001, - OBJECT_NODE_TAG = 0xB002, - CAMERA_NODE_TAG = 0xB003, - TARGET_NODE_TAG = 0xB004, - LIGHT_NODE_TAG = 0xB005, - L_TARGET_NODE_TAG = 0xB006, - SPOTLIGHT_NODE_TAG = 0xB007, - - KFSEG = 0xB008, - KFCURTIME = 0xB009, - NODE_HDR = 0xB010, - INSTANCE_NAME = 0xB011, - PRESCALE = 0xB012, - PIVOT = 0xB013, - BOUNDBOX = 0xB014, - MORPH_SMOOTH = 0xB015, - POS_TRACK_TAG = 0xB020, - ROT_TRACK_TAG = 0xB021, - SCL_TRACK_TAG = 0xB022, - FOV_TRACK_TAG = 0xB023, - ROLL_TRACK_TAG = 0xB024, - COL_TRACK_TAG = 0xB025, - MORPH_TRACK_TAG = 0xB026, - HOT_TRACK_TAG = 0xB027, - FALL_TRACK_TAG = 0xB028, - HIDE_TRACK_TAG = 0xB029, - NODE_ID = 0xB030, - - CMAGIC = 0xC23D, - - C_MDRAWER = 0xC010, - C_TDRAWER = 0xC020, - C_SHPDRAWER = 0xC030, - C_MODDRAWER = 0xC040, - C_RIPDRAWER = 0xC050, - C_TXDRAWER = 0xC060, - C_PDRAWER = 0xC062, - C_MTLDRAWER = 0xC064, - C_FLIDRAWER = 0xC066, - C_CUBDRAWER = 0xC067, - C_MFILE = 0xC070, - C_SHPFILE = 0xC080, - C_MODFILE = 0xC090, - C_RIPFILE = 0xC0A0, - C_TXFILE = 0xC0B0, - C_PFILE = 0xC0B2, - C_MTLFILE = 0xC0B4, - C_FLIFILE = 0xC0B6, - C_PALFILE = 0xC0B8, - C_TX_STRING = 0xC0C0, - C_CONSTS = 0xC0D0, - C_SNAPS = 0xC0E0, - C_GRIDS = 0xC0F0, - C_ASNAPS = 0xC100, - C_GRID_RANGE = 0xC110, - C_RENDTYPE = 0xC120, - C_PROGMODE = 0xC130, - C_PREVMODE = 0xC140, - C_MODWMODE = 0xC150, - C_MODMODEL = 0xC160, - C_ALL_LINES = 0xC170, - C_BACK_TYPE = 0xC180, - C_MD_CS = 0xC190, - C_MD_CE = 0xC1A0, - C_MD_SML = 0xC1B0, - C_MD_SMW = 0xC1C0, - C_LOFT_WITH_TEXTURE = 0xC1C3, - C_LOFT_L_REPEAT = 0xC1C4, - C_LOFT_W_REPEAT = 0xC1C5, - C_LOFT_UV_NORMALIZE = 0xC1C6, - C_WELD_LOFT = 0xC1C7, - C_MD_PDET = 0xC1D0, - C_MD_SDET = 0xC1E0, - C_RGB_RMODE = 0xC1F0, - C_RGB_HIDE = 0xC200, - C_RGB_MAPSW = 0xC202, - C_RGB_TWOSIDE = 0xC204, - C_RGB_SHADOW = 0xC208, - C_RGB_AA = 0xC210, - C_RGB_OVW = 0xC220, - C_RGB_OVH = 0xC230, - C_RGB_PICTYPE = 0xC240, - C_RGB_OUTPUT = 0xC250, - C_RGB_TODISK = 0xC253, - C_RGB_COMPRESS = 0xC254, - C_JPEG_COMPRESSION = 0xC255, - C_RGB_DISPDEV = 0xC256, - C_RGB_HARDDEV = 0xC259, - C_RGB_PATH = 0xC25A, - C_BITMAP_DRAWER = 0xC25B, - C_RGB_FILE = 0xC260, - C_RGB_OVASPECT = 0xC270, - - C_RGB_ANIMTYPE = 0xC271, - C_RENDER_ALL = 0xC272, - C_REND_FROM = 0xC273, - C_REND_TO = 0xC274, - C_REND_NTH = 0xC275, - C_PAL_TYPE = 0xC276, - C_RND_TURBO = 0xC277, - C_RND_MIP = 0xC278, - C_BGND_METHOD = 0xC279, - C_AUTO_REFLECT = 0xC27A, - C_VP_FROM = 0xC27B, - C_VP_TO = 0xC27C, - C_VP_NTH = 0xC27D, - C_REND_TSTEP = 0xC27E, - C_VP_TSTEP = 0xC27F, - - C_SRDIAM = 0xC280, - C_SRDEG = 0xC290, - C_SRSEG = 0xC2A0, - C_SRDIR = 0xC2B0, - C_HETOP = 0xC2C0, - C_HEBOT = 0xC2D0, - C_HEHT = 0xC2E0, - C_HETURNS = 0xC2F0, - C_HEDEG = 0xC300, - C_HESEG = 0xC310, - C_HEDIR = 0xC320, - C_QUIKSTUFF = 0xC330, - C_SEE_LIGHTS = 0xC340, - C_SEE_CAMERAS = 0xC350, - C_SEE_3D = 0xC360, - C_MESHSEL = 0xC370, - C_MESHUNSEL = 0xC380, - C_POLYSEL = 0xC390, - C_POLYUNSEL = 0xC3A0, - C_SHPLOCAL = 0xC3A2, - C_MSHLOCAL = 0xC3A4, - C_NUM_FORMAT = 0xC3B0, - C_ARCH_DENOM = 0xC3C0, - C_IN_DEVICE = 0xC3D0, - C_MSCALE = 0xC3E0, - C_COMM_PORT = 0xC3F0, - C_TAB_BASES = 0xC400, - C_TAB_DIVS = 0xC410, - C_MASTER_SCALES = 0xC420, - C_SHOW_1STVERT = 0xC430, - C_SHAPER_OK = 0xC440, - C_LOFTER_OK = 0xC450, - C_EDITOR_OK = 0xC460, - C_KEYFRAMER_OK = 0xC470, - C_PICKSIZE = 0xC480, - C_MAPTYPE = 0xC490, - C_MAP_DISPLAY = 0xC4A0, - C_TILE_XY = 0xC4B0, - C_MAP_XYZ = 0xC4C0, - C_MAP_SCALE = 0xC4D0, - C_MAP_MATRIX_OLD = 0xC4E0, - C_MAP_MATRIX = 0xC4E1, - C_MAP_WID_HT = 0xC4F0, - C_OBNAME = 0xC500, - C_CAMNAME = 0xC510, - C_LTNAME = 0xC520, - C_CUR_MNAME = 0xC525, - C_CURMTL_FROM_MESH = 0xC526, - C_GET_SHAPE_MAKE_FACES = 0xC527, - C_DETAIL = 0xC530, - C_VERTMARK = 0xC540, - C_MSHAX = 0xC550, - C_MSHCP = 0xC560, - C_USERAX = 0xC570, - C_SHOOK = 0xC580, - C_RAX = 0xC590, - C_STAPE = 0xC5A0, - C_LTAPE = 0xC5B0, - C_ETAPE = 0xC5C0, - C_KTAPE = 0xC5C8, - C_SPHSEGS = 0xC5D0, - C_GEOSMOOTH = 0xC5E0, - C_HEMISEGS = 0xC5F0, - C_PRISMSEGS = 0xC600, - C_PRISMSIDES = 0xC610, - C_TUBESEGS = 0xC620, - C_TUBESIDES = 0xC630, - C_TORSEGS = 0xC640, - C_TORSIDES = 0xC650, - C_CONESIDES = 0xC660, - C_CONESEGS = 0xC661, - C_NGPARMS = 0xC670, - C_PTHLEVEL = 0xC680, - C_MSCSYM = 0xC690, - C_MFTSYM = 0xC6A0, - C_MTTSYM = 0xC6B0, - C_SMOOTHING = 0xC6C0, - C_MODICOUNT = 0xC6D0, - C_FONTSEL = 0xC6E0, - C_TESS_TYPE = 0xC6f0, - C_TESS_TENSION = 0xC6f1, - - C_SEG_START = 0xC700, - C_SEG_END = 0xC705, - C_CURTIME = 0xC710, - C_ANIMLENGTH = 0xC715, - C_PV_FROM = 0xC720, - C_PV_TO = 0xC725, - C_PV_DOFNUM = 0xC730, - C_PV_RNG = 0xC735, - C_PV_NTH = 0xC740, - C_PV_TYPE = 0xC745, - C_PV_METHOD = 0xC750, - C_PV_FPS = 0xC755, - C_VTR_FRAMES = 0xC765, - C_VTR_HDTL = 0xC770, - C_VTR_HD = 0xC771, - C_VTR_TL = 0xC772, - C_VTR_IN = 0xC775, - C_VTR_PK = 0xC780, - C_VTR_SH = 0xC785, - -/* Material chunks */ - - C_WORK_MTLS = 0xC790, /* Old-style -- now ignored */ - C_WORK_MTLS_2 = 0xC792, /* Old-style -- now ignored */ - C_WORK_MTLS_3 = 0xC793, /* Old-style -- now ignored */ - C_WORK_MTLS_4 = 0xC794, /* Old-style -- now ignored */ - C_WORK_MTLS_5 = 0xCB00, /* Old-style -- now ignored */ - C_WORK_MTLS_6 = 0xCB01, /* Old-style -- now ignored */ - C_WORK_MTLS_7 = 0xCB02, /* Old-style -- now ignored */ - C_WORK_MTLS_8 = 0xCB03, /* Old-style -- now ignored */ - C_WORKMTL = 0xCB04, - C_SXP_TEXT_DATA = 0xCB10, - C_SXP_TEXT2_DATA = 0xCB20, - C_SXP_OPAC_DATA = 0xCB11, - C_SXP_BUMP_DATA = 0xCB12, - C_SXP_SPEC_DATA = 0xCB24, - C_SXP_SHIN_DATA = 0xCB13, - C_SXP_SELFI_DATA = 0xCB28, - C_SXP_TEXT_MASKDATA = 0xCB30, - C_SXP_TEXT2_MASKDATA = 0xCB32, - C_SXP_OPAC_MASKDATA = 0xCB34, - C_SXP_BUMP_MASKDATA = 0xCB36, - C_SXP_SPEC_MASKDATA = 0xCB38, - C_SXP_SHIN_MASKDATA = 0xCB3A, - C_SXP_SELFI_MASKDATA = 0xC3C, - C_SXP_REFL_MASKDATA = 0xCB3E, - - C_BGTYPE = 0xC7A1, - C_MEDTILE = 0xC7B0, - -/* Contrast */ - - C_LO_CONTRAST = 0xC7D0, - C_HI_CONTRAST = 0xC7D1, - -/* 3d frozen display */ - - C_FROZ_DISPLAY = 0xC7E0, - -/* Booleans */ - C_BOOLWELD = 0xc7f0, - C_BOOLTYPE = 0xc7f1, - - C_ANG_THRESH = 0xC900, - C_SS_THRESH = 0xC901, - C_TEXTURE_BLUR_DEFAULT = 0xC903, - - C_MAPDRAWER = 0xCA00, - C_MAPDRAWER1 = 0xCA01, - C_MAPDRAWER2 = 0xCA02, - C_MAPDRAWER3 = 0xCA03, - C_MAPDRAWER4 = 0xCA04, - C_MAPDRAWER5 = 0xCA05, - C_MAPDRAWER6 = 0xCA06, - C_MAPDRAWER7 = 0xCA07, - C_MAPDRAWER8 = 0xCA08, - C_MAPDRAWER9 = 0xCA09, - C_MAPDRAWER_ENTRY = 0xCA10, - -/* system options */ - C_BACKUP_FILE = 0xCA20, - C_DITHER_256 = 0xCA21, - C_SAVE_LAST = 0xCA22, - C_USE_ALPHA = 0xCA23, - C_TGA_DEPTH = 0xCA24, - C_REND_FIELDS = 0xCA25, - C_REFLIP = 0xCA26, - C_SEL_ITEMTOG = 0xCA27, - C_SEL_RESET = 0xCA28, - C_STICKY_KEYINF = 0xCA29, - C_WELD_THRESHOLD = 0xCA2A, - C_ZCLIP_POINT = 0xCA2B, - C_ALPHA_SPLIT = 0xCA2C, - C_KF_SHOW_BACKFACE = 0xCA30, - C_OPTIMIZE_LOFT = 0xCA40, - C_TENS_DEFAULT = 0xCA42, - C_CONT_DEFAULT = 0xCA44, - C_BIAS_DEFAULT = 0xCA46, - - C_DXFNAME_SRC = 0xCA50, - C_AUTO_WELD = 0xCA60, - C_AUTO_UNIFY = 0xCA70, - C_AUTO_SMOOTH = 0xCA80, - C_DXF_SMOOTH_ANG = 0xCA90, - C_SMOOTH_ANG = 0xCAA0, - -/* Special network-use chunks */ - - C_NET_USE_VPOST = 0xCC00, - C_NET_USE_GAMMA = 0xCC10, - C_NET_FIELD_ORDER = 0xCC20, - - C_BLUR_FRAMES = 0xCD00, - C_BLUR_SAMPLES = 0xCD10, - C_BLUR_DUR = 0xCD20, - C_HOT_METHOD = 0xCD30, - C_HOT_CHECK = 0xCD40, - C_PIXEL_SIZE = 0xCD50, - C_DISP_GAMMA = 0xCD60, - C_FBUF_GAMMA = 0xCD70, - C_FILE_OUT_GAMMA = 0xCD80, - C_FILE_IN_GAMMA = 0xCD82, - C_GAMMA_CORRECT = 0xCD84, - C_APPLY_DISP_GAMMA = 0xCD90 /* OBSOLETE */, - C_APPLY_FBUF_GAMMA = 0xCDA0 /* OBSOLETE */, - C_APPLY_FILE_GAMMA = 0xCDB0 /* OBSOLETE */, - C_FORCE_WIRE = 0xCDC0, - C_RAY_SHADOWS = 0xCDD0, - C_MASTER_AMBIENT = 0xCDE0, - C_SUPER_SAMPLE = 0xCDF0, - C_OBJECT_MBLUR = 0xCE00, - C_MBLUR_DITHER = 0xCE10, - C_DITHER_24 = 0xCE20, - C_SUPER_BLACK = 0xCE30, - C_SAFE_FRAME = 0xCE40, - C_VIEW_PRES_RATIO = 0xCE50, - C_BGND_PRES_RATIO = 0xCE60, - C_NTH_SERIAL_NUM = 0xCE70, - - /* Video Post */ - VPDATA = 0xd000, - - P_QUEUE_ENTRY = 0xd100, - P_QUEUE_IMAGE = 0xd110, - P_QUEUE_USEIGAMMA = 0xd114, - P_QUEUE_PROC = 0xd120, - P_QUEUE_SOLID = 0xd130, - P_QUEUE_GRADIENT = 0xd140, - P_QUEUE_KF = 0xd150, - P_QUEUE_MOTBLUR = 0xd152, - P_QUEUE_MB_REPEAT = 0xd153, - P_QUEUE_NONE = 0xd160, - - P_QUEUE_RESIZE = 0xd180, - P_QUEUE_OFFSET = 0xd185, - P_QUEUE_ALIGN = 0xd190, - - P_CUSTOM_SIZE = 0xd1a0, - - P_ALPH_NONE = 0xd210, - P_ALPH_PSEUDO = 0xd220 /* Old chunk */, - P_ALPH_OP_PSEUDO = 0xd221 /* Old chunk */, - P_ALPH_BLUR = 0xd222 /* Replaces pseudo */, - P_ALPH_PCOL = 0xd225, - P_ALPH_C0 = 0xd230, - P_ALPH_OP_KEY = 0xd231, - P_ALPH_KCOL = 0xd235, - P_ALPH_OP_NOCONV = 0xd238, - P_ALPH_IMAGE = 0xd240, - P_ALPH_ALPHA = 0xd250, - P_ALPH_QUES = 0xd260, - P_ALPH_QUEIMG = 0xd265, - P_ALPH_CUTOFF = 0xd270, - P_ALPHANEG = 0xd280, - - P_TRAN_NONE = 0xd300, - P_TRAN_IMAGE = 0xd310, - P_TRAN_FRAMES = 0xd312, - P_TRAN_FADEIN = 0xd320, - P_TRAN_FADEOUT = 0xd330, - P_TRANNEG = 0xd340, - - P_RANGES = 0xd400, - - P_PROC_DATA = 0xd500 - -} chunktag3ds; - -/* End Private */ - - -#endif diff --git a/3rdparty/3dsftk3/src/dbase3ds.c b/3rdparty/3dsftk3/src/dbase3ds.c deleted file mode 100644 index 6fcbfcdf..00000000 --- a/3rdparty/3dsftk3/src/dbase3ds.c +++ /dev/null @@ -1,1219 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dsfile.h" -#include "3dsftkst.h" -#include "chunk3ds.h" -#include "3dsutil.h" -#include "seekchil.h" -#include "dbase3ds.h" -#include "3dshier.h" -#include "3dsvers.h" -#include "3dserr.h" - -void InitDatabase3ds(database3ds **db) -{ - - if (*db == NULL) { - *db = (database3ds *)malloc(sizeof(database3ds)); - if ((*db) == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - } - - (*db)->topchunk = NULL; - -/* (*db)->readfile = 0; - (*db)->writefile = 0; */ - (*db)->objlistdirty = True3ds; - (*db)->matlistdirty = True3ds; - (*db)->nodelistdirty = True3ds; - (*db)->objlist = NULL; - (*db)->matlist = NULL; - (*db)->nodelist = NULL; - -} - -void ReleaseDatabase3ds(database3ds **db) -{ - if (db != NULL) - { - if (*db != NULL) - { - if ((*db)->topchunk != NULL) - { - ReleaseChunk3ds(&((*db)->topchunk)); - } - if((*db)->objlist){ - ReleaseChunkList3ds(&((*db)->objlist)); - ON_ERROR_RETURN; - } - - if((*db)->matlist){ - ReleaseChunkList3ds(&((*db)->matlist)); - ON_ERROR_RETURN; - } - - if((*db)->nodelist){ - ReleaseChunkList3ds(&((*db)->nodelist)); - ON_ERROR_RETURN; - } - - free (*db); - *db = NULL; - } - } -} - -void UpdateNamedObjectList3ds(database3ds *db) -{ - chunk3ds *mdata = NULL, *nobj = NULL; - long3ds objcount = 0, i; - NamedObject *data; - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (db->objlistdirty) - { - db->objlistdirty = False3ds; - - ReleaseChunkList3ds(&(db->objlist)); - ON_ERROR_RETURN; - - FindChunk3ds(db->topchunk, MDATA, &mdata); - - if (mdata != NULL) - { - for (FindChunk3ds(mdata, NAMED_OBJECT, &nobj); - nobj != NULL; - FindNextChunk3ds(nobj->sibling, NAMED_OBJECT, &nobj) - ) - { - ON_ERROR_RETURN; - objcount++; - } - } - - InitChunkList3ds(&(db->objlist), objcount); - ON_ERROR_RETURN; - - if (mdata == NULL) return; - - for (FindChunk3ds(mdata, NAMED_OBJECT, &nobj), i = 0; - nobj != NULL; - FindNextChunk3ds(nobj->sibling, NAMED_OBJECT, &nobj), i++ - ) - { - ReadChunkData3ds(nobj); - ON_ERROR_RETURN; - - data = nobj->data; - - db->objlist->list[i].chunk = nobj; - db->objlist->list[i].name = strdup(data->name); - } - } -} - -void FindNamedObject3ds(database3ds *db, char3ds *name, chunk3ds **found) -{ - chunk3ds *current = NULL; - ulong3ds i; - - if (db == NULL || name == NULL || found == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - UpdateNamedObjectList3ds(db); - ON_ERROR_RETURN; - - for(i = 0; i < db->objlist->count; i++) - { - if (strcmp(name, db->objlist->list[i].name) == 0) - { - current = db->objlist->list[i].chunk; - break; - } - } - - *found = current; -} - -/* FindNamedObjectByIndex: Searches the database for a named object by index position and - object type. Returns the NAMED_OBJECT chunk if found, NULL otherwise */ -chunk3ds *FindNamedObjectByIndex3ds(database3ds *db, chunktag3ds type, ulong3ds index) -{ - chunk3ds *chunk; - ulong3ds i, count; - - UpdateNamedObjectList3ds(db); - - for (i = 0, count = 0; i objlist->count; i++) - { - if (type == DL_SPOTLIGHT) - { - FindChunk3ds(db->objlist->list[i].chunk, N_DIRECT_LIGHT, &chunk); - if (chunk != NULL) - FindChunk3ds(chunk, type, &chunk); - } else - { - FindChunk3ds(db->objlist->list[i].chunk, type, &chunk); - } - - if (chunk != NULL) - { - if (count == index) - return db->objlist->list[i].chunk; - count++; - } - } - - return NULL; -} - -/*----------------------------------------------------------- - | DeleteChunkTypeByIndex3ds - | - | Deletes an indexed chunk by type - | type : N_CAMERA, etc. - | - +----------------------------------------------------------*/ -void DeleteChunkTypeByIndex3ds(database3ds *db, - chunktag3ds type, - ulong3ds index) -{ - chunk3ds *pChunk; - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - pChunk = FindNamedObjectByIndex3ds(db, type, index); - if (pChunk != NULL) - { - DeleteChunk3ds(pChunk); - MakeNamedObjectListDirty3ds(db); - } - -} - -void DeleteNamedObjectByName3ds(database3ds *db, char3ds *name) -{ - chunk3ds *pChunk; - - if (db == NULL || name == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindNamedObject3ds(db, name, &pChunk); - - if (pChunk != NULL) - DeleteChunk3ds(pChunk); - - MakeNamedObjectListDirty3ds(db); -} - - -void CopyNamedObjectByIndex3ds(database3ds *destdb, database3ds *srcdb, chunktag3ds nobjtype, ulong3ds index) -{ - chunk3ds *mdata, *nobj, *newnobj; - - if ((destdb == NULL) || (srcdb == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Check to see if the destination database is a 3DS or PRJ */ - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - /* Find the named object in the source database */ - nobj = FindNamedObjectByIndex3ds(srcdb, nobjtype, index); - - if (nobj != NULL) - { - NamedObject *nobjname; - - FindChunk3ds(destdb->topchunk, MDATA, &mdata); - - /* If MDATA chunk not present then create one */ - if (mdata == NULL) - { - InitChunkAs3ds(&mdata, MDATA); - ON_ERROR_RETURN; - AddChildOrdered3ds(destdb->topchunk, mdata); - } - - /* Get the source object's name */ - nobjname = ReadChunkData3ds(nobj); - - /* Delete any object by that name in the destination */ - DeleteNamedObjectByName3ds(destdb, nobjname->name); - - /* Copy the source mesh */ - CopyChunk3ds(nobj, &newnobj); - ON_ERROR_RETURN; - - /* Add the copy to the destination */ - AddChildOrdered3ds(mdata, newnobj); - - MakeNamedObjectListDirty3ds(destdb); - } -} - -void CopyNamedObjectByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name) -{ - chunk3ds *mdata, *nobj, *newnobj; - - if ((destdb == NULL) || (srcdb == NULL) || (name == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - - /* Find the object in the source database */ - FindNamedObject3ds(srcdb, name, &nobj); - ON_ERROR_RETURN; - - if (nobj != NULL) - { - FindChunk3ds(destdb->topchunk, MDATA, &mdata); - - /* If MDATA chunk not present then create one */ - if (mdata == NULL) - { - InitChunkAs3ds(&mdata, MDATA); - ON_ERROR_RETURN; - AddChildOrdered3ds(destdb->topchunk, mdata); - } - - /* Delete any object by that name in the destination */ - DeleteNamedObjectByName3ds(destdb, name); - - /* Copy the source object */ - CopyChunk3ds(nobj, &newnobj); - ON_ERROR_RETURN; - - /* Add the copy to the destination */ - AddChildOrdered3ds(mdata, newnobj); - - MakeNamedObjectListDirty3ds(destdb); - } -} - - -#ifdef SPEEDS_OLD_FUNCTION -/*----------------------------------------------------------- - | DeleteChunkTypeByIndex3ds - | - | Deletes an indexed chunk by type - | type : N_CAMERA, etc. - | - +----------------------------------------------------------*/ -void DeleteChunkTypeByIndex3ds(database3ds *db, - chunktag3ds type, - ulong3ds index) -{ - chunk3ds *pChunk; - ulong3ds i, count; - - UpdateNamedObjectList3ds(db); - - for (i = 0, count = 0; i < db->objlist->count; i++){ - - FindChunk3ds(db->objlist->list[i].chunk, type, &pChunk); - - if(pChunk != NULL){ - if (count == index){ - DeleteChunk3ds(pChunk); - return; - } - count++; - } - } -} -#endif - - -void MakeNamedObjectListDirty3ds(database3ds *db) -{ - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - db->objlistdirty = True3ds; -} - -void UpdateMatEntryList3ds(database3ds *db) -{ - chunk3ds *parent = NULL, *current = NULL, *matentry = NULL, *matname = NULL; - long3ds matcount = 0, i; - MatName *data; - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (db->matlistdirty) - { - db->matlistdirty = False3ds; - - ReleaseChunkList3ds(&(db->matlist)); - - FindChunk3ds(db->topchunk, MDATA, &parent); - if (parent == NULL) FindChunk3ds(db->topchunk, MLIBMAGIC, &parent); - - if (parent != NULL) - { - for (FindChunk3ds(parent, MAT_ENTRY, &matentry); - matentry != NULL; - FindNextChunk3ds(matentry->sibling, MAT_ENTRY, &matentry) - ) - matcount++; - } - - InitChunkList3ds(&(db->matlist), matcount); - - if (parent == NULL) return; - - for (FindChunk3ds(parent, MAT_ENTRY, &matentry), i = 0; - matentry != NULL; - FindNextChunk3ds(matentry->sibling, MAT_ENTRY, &matentry), i++ - ) - { - FindChunk3ds(matentry, MAT_NAME, &matname); - ReadChunkData3ds(matname); - data = matname->data; - - db->matlist->list[i].chunk = matentry; - db->matlist->list[i].name = strdup(data->name); - } - } -} - -void FindMatEntry3ds(database3ds *db, char3ds *name, chunk3ds **found) -{ - chunk3ds *current = NULL; - ulong3ds i; - - if (db == NULL || name == NULL || found == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != MLIBMAGIC) && (db->topchunk->tag != M3DMAGIC) && - (db->topchunk->tag != CMAGIC)) SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - UpdateMatEntryList3ds(db); - ON_ERROR_RETURN; - - for(i = 0; i < db->matlist->count; i++) - { - if (strcmp(name, db->matlist->list[i].name) == 0) - { - current = db->matlist->list[i].chunk; - break; - } - } - - *found = current; -} - -chunk3ds *FindMatEntryByIndex3ds(database3ds *db, ulong3ds index) -{ - if (db == NULL) SET_ERROR_RETURNR(ERR_INVALID_ARG, NULL); - if (db->topchunk == NULL) SET_ERROR_RETURNR(ERR_INVALID_DATABASE, NULL); - if ((db->topchunk->tag != MLIBMAGIC) && (db->topchunk->tag != M3DMAGIC) && - (db->topchunk->tag != CMAGIC)) SET_ERROR_RETURNR(ERR_WRONG_DATABASE, NULL); - - UpdateMatEntryList3ds(db); - ON_ERROR_RETURNR(NULL); - - if (index < db->matlist->count) - { - return db->matlist->list[index].chunk; - } - return NULL; -} - -void MakeMatEntryListDirty3ds(database3ds *db) -{ - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - db->matlistdirty = True3ds; -} - -void UpdateNodeTagList3ds(database3ds *db) -{ - chunk3ds *kfdata = NULL, *nodetag = NULL; - chunk3ds *ic; - long3ds nodecount = 0, i; - - myassert(db != NULL, "UpdateNodeTagList3ds: arg *db cannot be NULL"); - myassert(db->topchunk != NULL, "UpdateNodeTagList3ds: arg *db->topchunk cannot be NULL"); - - if (db->nodelistdirty) - { - - ReleaseChunkList3ds(&(db->nodelist)); - - FindChunk3ds(db->topchunk, KFDATA, &kfdata); - - /* If there is a keyframe section, then cound the number of nodetags around */ - if (kfdata != NULL) - { - for(ic = kfdata->children; ic != NULL; ic = ic->sibling) - { - switch(ic->tag) - { - case AMBIENT_NODE_TAG: - case OBJECT_NODE_TAG: - case CAMERA_NODE_TAG: - case TARGET_NODE_TAG: - case LIGHT_NODE_TAG: - case L_TARGET_NODE_TAG: - case SPOTLIGHT_NODE_TAG: - nodecount++; - break; - default: - break; - } - - } - } - - InitChunkList3ds(&(db->nodelist), nodecount); - ON_ERROR_RETURN; - - if (nodecount == 0) return; - - i = 0; - - for (nodetag = kfdata->children; nodetag != NULL; nodetag = nodetag->sibling) - { - switch(nodetag->tag) - { - case AMBIENT_NODE_TAG: - case OBJECT_NODE_TAG: - case CAMERA_NODE_TAG: - case TARGET_NODE_TAG: - case LIGHT_NODE_TAG: - case L_TARGET_NODE_TAG: - case SPOTLIGHT_NODE_TAG: - { - chunk3ds *c; - NodeHdr *d = NULL; - - FindNextChunk3ds(nodetag->children, NODE_HDR, &c); - if (c != NULL) - { - d = ReadChunkData3ds(c); - ON_ERROR_RETURN; - - db->nodelist->list[i].chunk = nodetag; - db->nodelist->list[i].name = strdup(d->objname); - if (db->nodelist->list[i].name == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - - } - - /* Object tags may have an instance name as well, which gets appended to - the object name with a "." seperator */ - if (nodetag->tag == OBJECT_NODE_TAG) - { - FindNextChunk3ds(nodetag->children, INSTANCE_NAME, &c); - if (c != NULL) - { - InstanceName *insd; - insd = ReadChunkData3ds(c); - ON_ERROR_RETURN; - - db->nodelist->list[i].name = realloc(db->nodelist->list[i].name, strlen(d->objname)+strlen(insd->name)+2); - if (db->nodelist->list[i].name == NULL) - SET_ERROR_RETURN(ERR_NO_MEM); - strcat(db->nodelist->list[i].name, "."); - strcat(db->nodelist->list[i].name, insd->name); - } - } - i++; /* Increment index counter */ - break; - } - default: - break; - } - } - - myassert(i == nodecount, "UpdateNodeTagList3ds: Difference in node count and node list elements."); - - db->nodelistdirty = False3ds; - } -} - -void MakeNodeTagListDirty3ds(database3ds *db) -{ - myassert(db != NULL, "MakeNodeTagListDirt3ds: arg *db cannot be NULL."); - db->nodelistdirty = True3ds; -} - -chunk3ds *FindNodeTagByNameAndType3ds(database3ds *db, char3ds *name, chunktag3ds type) -{ - chunk3ds *current = NULL; - ulong3ds i; - - myassert(db != NULL, "FindNodeTagByNameAndType3ds: arg *db cannot be NULL."); - myassert(db != NULL, "FindNodeTagByNameAndType3ds: arg *name cannot be NULL."); - - UpdateNodeTagList3ds(db); - ON_ERROR_RETURNR(NULL); - - for(i = 0; i < db->nodelist->count; i++) - { - if ((db->nodelist->list[i].chunk->tag == type) && (strcmp(name, db->nodelist->list[i].name) == 0)) - { - return db->nodelist->list[i].chunk; - } - } - - return NULL; -} - -chunk3ds *FindNodeTagByIndexAndType3ds(database3ds *db, ulong3ds index, chunktag3ds type) -{ - chunk3ds *current = NULL; - ulong3ds i, icount = 0; - - myassert(db != NULL, "FindNodeTagByNameAndType3ds: arg *db cannot be NULL."); - myassert(db != NULL, "FindNodeTagByNameAndType3ds: arg *name cannot be NULL."); - - UpdateNodeTagList3ds(db); - ON_ERROR_RETURNR(NULL); - - for(i = 0; i < db->nodelist->count; i++) - { - if (db->nodelist->list[i].chunk->tag == type) - { - if (icount == index) return db->nodelist->list[i].chunk; - icount++; - } - } - - return NULL; -} - -/* Deletes a node based on index, if a camera or spotlight, target gets aced as well */ -void DeleteNodeTagByIndexAndType3ds(database3ds *db, ulong3ds index, chunktag3ds type) -{ - chunk3ds *nodetag; - - if (db == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != M3DMAGIC) && (db->topchunk->tag != CMAGIC)) SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - nodetag = FindNodeTagByIndexAndType3ds(db, index, type); - ON_ERROR_RETURN; - - if (nodetag != NULL) - { - if ((type == CAMERA_NODE_TAG) || (type == SPOTLIGHT_NODE_TAG)) - { - chunk3ds *nodehdr, *target; - NodeHdr *d; - - FindNextChunk3ds(nodetag->children, NODE_HDR, &nodehdr); - if (nodehdr != NULL) - { - d = ReadChunkData3ds(nodehdr); - ON_ERROR_RETURN; - if (type == CAMERA_NODE_TAG) - target = FindNodeTagByNameAndType3ds(db, d->objname, TARGET_NODE_TAG); - else - target = FindNodeTagByNameAndType3ds(db, d->objname, L_TARGET_NODE_TAG); - ON_ERROR_RETURN; - - if (target != NULL) - DeleteChunk3ds(target); - } - } - DeleteChunk3ds(nodetag); - MakeNodeTagListDirty3ds(db); - } -} - -/* Deletes a node based on name, if a camera or spotlight, target gets aced as well */ -void DeleteNodeTagByNameAndType3ds(database3ds *db, char3ds *name, chunktag3ds type) -{ - chunk3ds *nodetag; - - if ((db == NULL) || (name == NULL)) SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((db->topchunk->tag != M3DMAGIC) && (db->topchunk->tag != CMAGIC)) SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - nodetag = FindNodeTagByNameAndType3ds(db, name, type); - ON_ERROR_RETURN; - - if (nodetag != NULL) - { - - DeleteChunk3ds(nodetag); - MakeNodeTagListDirty3ds(db); - } - - if (type == CAMERA_NODE_TAG) - DeleteNodeTagByNameAndType3ds(db, name, TARGET_NODE_TAG); - if (type == SPOTLIGHT_NODE_TAG) - DeleteNodeTagByNameAndType3ds(db, name, L_TARGET_NODE_TAG); - ON_ERROR_RETURN; - -} - -void CopyNodeTagByIndexAndType3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index, chunktag3ds type) -{ - chunk3ds *kfdata, *nodetag, *newnode, *nodehdr; - NodeHdr *nodename; - - - if ((destdb == NULL) || (srcdb == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - - /* Find the node to be copied */ - nodetag = FindNodeTagByIndexAndType3ds(srcdb, index, type); - ON_ERROR_RETURN; - - if (nodetag != NULL) - { - /* Find or make the destination keyframer section */ - FindNextChunk3ds(destdb->topchunk->children, KFDATA, &kfdata); - if (kfdata == NULL) - { - InitChunkAs3ds(&kfdata, KFDATA); - AddChildOrdered3ds(destdb->topchunk, kfdata); - } - - /* Get the source node's name */ - FindNextChunk3ds(nodetag->children, NODE_HDR, &nodehdr); - nodename = ReadChunkData3ds(nodehdr); - ON_ERROR_RETURN; - - /* Delete any node of the same name in the destination */ - if (type == OBJECT_NODE_TAG){ /* 'cat' the instance name on */ - chunk3ds *pInstChunk; - char3ds buf[50]; - - sprintf(buf, "%s", nodename->objname); - - FindNextChunk3ds(nodetag->children, INSTANCE_NAME, &pInstChunk); - if (pInstChunk){ - InstanceName *pInstName = ReadChunkData3ds(pInstChunk); - if (pInstName) - sprintf(buf, "%s.%s", nodename->objname, pInstName->name); - } - DeleteNodeTagByNameAndType3ds(destdb, buf, type); - ON_ERROR_RETURN; - } - else{ /*--- Regular non-instance type of node object */ - DeleteNodeTagByNameAndType3ds(destdb, nodename->objname, type); - ON_ERROR_RETURN; - } - - /* If a camera or a spot, then copy their targets first */ - if (type == CAMERA_NODE_TAG) - CopyNodeTagByNameAndType3ds(destdb, srcdb, nodename->objname, TARGET_NODE_TAG); - if (type == SPOTLIGHT_NODE_TAG) - CopyNodeTagByNameAndType3ds(destdb, srcdb, nodename->objname, L_TARGET_NODE_TAG); - ON_ERROR_RETURN; - - /* Copy the node */ - CopyChunk3ds(nodetag, &newnode); - ON_ERROR_RETURN; - - /* Add the copy to the destination */ - AddChildOrdered3ds(kfdata, newnode); - - MakeNodeTagListDirty3ds(destdb); - } -} - -void CopyNodeTagByNameAndType3ds(database3ds *destdb, database3ds *srcdb, char3ds *name, chunktag3ds type) -{ - chunk3ds *kfdata, *nodetag, *newnode; - - if ((destdb == NULL) || (srcdb == NULL) || (name == NULL)) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if ((srcdb->topchunk == NULL) || (destdb->topchunk == NULL)) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - if ((srcdb->topchunk->tag != M3DMAGIC) && (srcdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - if ((destdb->topchunk->tag != M3DMAGIC) && (destdb->topchunk->tag != CMAGIC)) - SET_ERROR_RETURN(ERR_WRONG_DATABASE); - - - /* Find the node to be copied */ - nodetag = FindNodeTagByNameAndType3ds(srcdb, name, type); - ON_ERROR_RETURN; - - if (nodetag != NULL) - { - /* Find or make the destination keyframer section */ - FindNextChunk3ds(destdb->topchunk->children, KFDATA, &kfdata); - if (kfdata == NULL) - { - InitChunkAs3ds(&kfdata, KFDATA); - AddChildOrdered3ds(destdb->topchunk, kfdata); - } - - /* If a camera or a spot, then copy their targets too */ - if (type == CAMERA_NODE_TAG) - CopyNodeTagByNameAndType3ds(destdb, srcdb, name, TARGET_NODE_TAG); - if (type == SPOTLIGHT_NODE_TAG) - CopyNodeTagByNameAndType3ds(destdb, srcdb, name, L_TARGET_NODE_TAG); - - - /* Delete any node of the same name in the destination */ - DeleteNodeTagByNameAndType3ds(destdb, name, type); - - /* Copy the node */ - CopyChunk3ds(nodetag, &newnode); - ON_ERROR_RETURN; - - /* Add the copy to the destination */ - AddChildOrdered3ds(kfdata, newnode); - - MakeNodeTagListDirty3ds(destdb); - } -} - -/* Special function to handle child reads when an IPAS routine incorrectly creates and XDATA_ENTRY chunk. This - function could be used to recover chunks from any badly formed chunk structure as well. */ -void ReadXDataEntryChildren3ds(chunk3ds *parent) -{ - ulong3ds parentBody=0, childPosition=0, cpos=0, fpos=0; - chunk3ds *child; - - SetContextByIndex3ds(parent->readindex); - - SeekChild3ds(parent); - - parentBody = parent->position + parent->size; - - while (GetFilePosition3ds() < parentBody) - { - child = NULL; - InitChunk3ds(&child); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - - child->position = GetFilePosition3ds(); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - - child->readindex = GetContextIndex3ds(); - ReadHeader3ds(&(child->tag),&(child->size)); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - - /* Validate the child chunk... */ - - /* First, is it a valid header? */ - switch (child->tag) - { - case XDATA_APPNAME: - case XDATA_STRING: - case XDATA_FLOAT: - case XDATA_DOUBLE: - case XDATA_SHORT: - case XDATA_LONG: - case XDATA_VOID: - case XDATA_GROUP: - case XDATA_RFU6: - case XDATA_RFU5: - case XDATA_RFU4: - case XDATA_RFU3: - case XDATA_RFU2: - case XDATA_RFU1: - { - /* Second, does the size fit inside the XDATA_ENTRY chunk? */ - if ((child->position + child->size) <= parentBody) - { - /* Chances are, its a good subchunk, so add it in */ - AddChild3ds(parent, child); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - - ReadXDataEntryChildren3ds(child); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - } - else { - ReleaseChunk3ds(&child); /* CCJ */ - } - break; - } - default: /* must not be a valid chunk, seek to the end of the parent then */ - { - ReleaseChunk3ds(&child); /* CCJ */ - FileSeek3ds(parentBody); - break; - } - } - } -} - - -void ReadChildren3ds(chunk3ds *parent) -{ - ulong3ds parentBody=0, childPosition=0, cpos=0, fpos=0; - chunk3ds *child; - - SetContextByIndex3ds(parent->readindex); - - SeekChild3ds(parent); - - parentBody = parent->position + parent->size; - - while (GetFilePosition3ds() < parentBody) { - child = NULL; - InitChunk3ds(&child); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - - child->position = GetFilePosition3ds(); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - - child->readindex = GetContextIndex3ds(); - ReadHeader3ds(&(child->tag),&(child->size)); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - - -#ifdef NOT - printf("%s%s %s%d %s%d\n", "Tag: ", - ChunkTagToString3ds(child->tag), - "Size: ",child->size, "Pos: ",child->position); -#endif - - AddChild3ds(parent, child); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - - if (child->tag == XDATA_ENTRY) - { - ReadXDataEntryChildren3ds(child); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - } else - { - ReadChildren3ds(child); - ADD_ERROR(ERR_READING_DATABASE); - ON_ERROR_RETURN; - } - } -} - -void WriteChunk3ds(chunk3ds *chunk, ubyte3ds fileindex) -{ - long3ds startpos, endpos; - chunk3ds *chilindex; - - if (chunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - myassert(GetContextByIndex3ds(fileindex) != NULL, "WriteChunk3ds: tried to write to nonexistant file3ds."); - - if (chunk != NULL && chunk->tag != PARENT_NAME && chunk->tag != NULL_CHUNK) - { - - SetContextByIndex3ds(fileindex); /* Select the file to be written too */ - chunk->writeindex = fileindex; /* Store the index of the chunk */ - startpos = GetFilePosition3ds(); /* Get the current location of file */ - ReadChunkData3ds(chunk); /* Read chunk data if needed */ - ON_ERROR_RETURN; - - /* Reselect the file to written to in case the read occured from another */ - SetContextByIndex3ds(fileindex); - - /* Seek the same position in case the data was read from the same file */ - FileSeek3ds(startpos); - ON_ERROR_RETURN; - - /* Write the header information, the size may not be correct */ - WriteHeader3ds(chunk->tag, chunk->size); - ON_ERROR_RETURN; - - WriteChunkData3ds(chunk); /* Write the chunk data if needed */ - ON_ERROR_RETURN; - - /* If the chunk has children, then write the children out */ - for (chilindex = chunk->children; chilindex != NULL; chilindex = chilindex->sibling) - { - WriteChunk3ds(chilindex, fileindex); - ON_ERROR_RETURN; - } - - /* Reselect the file to written to in case the read occured from another file */ - SetContextByIndex3ds(fileindex); - endpos = GetFilePosition3ds(); /* Get the end position of the chunk */ - - /* If the real size of the chunk is not the same as chunk->size fix it up - the size in the header and *chunk */ - if ((ulong3ds)(endpos - startpos) != chunk->size) - { - FinishHeader3ds(startpos, endpos); /* FinishHeader3ds returns to endpos after the write */ - chunk->size = endpos - startpos; - } - - /* If the write file is available for read change the read index to the write file */ - if (GetContextByIndex3ds(fileindex)->state == ReadWriteFile) chunk->readindex = fileindex; - ON_ERROR_RETURN; - - /* If there is a valid source for chunk->data then free it up */ - if (GetContextByIndex3ds(chunk->readindex) != NULL) FreeChunkData3ds(chunk); - - } - - -} - -void CreateDatabase3ds(file3ds *file, database3ds *db) -{ - chunk3ds *chunk=NULL; - - if (db == NULL || file == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if ((file->state == ReadFromFile) || (file->state == ReadWriteFile)) - { - InitChunk3ds(&chunk); - ADD_ERROR_RETURN(ERR_CREATING_DATABASE); - - db->topchunk = chunk; - - chunk->readindex = file->index; - - SetContext3ds(file); - ADD_ERROR_RETURN(ERR_CREATING_DATABASE); - - FileSeek3ds(0); - ADD_ERROR_RETURN(ERR_CREATING_DATABASE); - - ReadHeader3ds(&(chunk->tag), &(chunk->size)); - ADD_ERROR(ERR_CREATING_DATABASE); - ON_ERROR_RETURN; - - /* Test Chunk Header to determine if current chunk is - Top Level chunk type */ - if ((chunk->tag == M3DMAGIC) || (chunk->tag == CMAGIC) || (chunk->tag == MLIBMAGIC)) - { - ReadChildren3ds(db->topchunk); - ADD_ERROR_RETURN(ERR_CREATING_DATABASE); - - AssignParentNames(db); - ADD_ERROR_RETURN(ERR_CREATING_DATABASE); - - } - - } -} - - -void CreateNewDatabase3ds(database3ds *db, dbtype3ds type) -{ - chunk3ds *chunk=NULL; - - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - InitChunk3ds(&chunk); - ADD_ERROR(ERR_CREATING_DATABASE); - ON_ERROR_RETURN; - - switch (type) - { - case MeshFile: - chunk->tag = M3DMAGIC; - break; - case ProjectFile: - chunk->tag = CMAGIC; - break; - case MaterialFile: - chunk->tag = MLIBMAGIC; - break; - } - db->topchunk = chunk; - - /* All new databases are created with R3 version */ - PutDatabaseRelease3ds(db, Release33ds); - -} - -dbtype3ds GetDatabaseType3ds(database3ds *db) -{ - if (db == NULL) return Unknown; - if (db->topchunk == NULL) return Unknown; - - switch (db->topchunk->tag) - { - case M3DMAGIC: - return MeshFile; - case CMAGIC: - return ProjectFile; - case MLIBMAGIC: - return MaterialFile; - default: - return Unknown; - } - -} - - -void CopyDatabase3ds(database3ds *idb, database3ds *odb) -{ - if (idb == NULL || odb == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - CopyChunk3ds(idb->topchunk, &(odb->topchunk)); -} - -/* DisconnectDatabase3ds sucks up all the data in a file internally, and removes - references to the file data */ -void DisconnectDatabase3ds(database3ds *db) -{ - if (db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - if (db->topchunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_DATABASE); - - DisconnectChunk3ds(db->topchunk); - ON_ERROR_RETURN; -} - -void WriteDatabase3ds(file3ds *file, database3ds *db) -{ - if (file == NULL || db == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /* Since the toolkit can only write out R3 stuff, force the version chunks to R3 before - writting the database */ - PutDatabaseRelease3ds(db, Release33ds); - - if (file->state == WriteToFile) - { -/* db->writefile = file->index; */ - - ComputeNodeIds(db); - ADD_ERROR(ERR_WRITING_DATABASE); - ON_ERROR_RETURN; - - SetContext3ds(file); - ADD_ERROR(ERR_WRITING_DATABASE); - ON_ERROR_RETURN; - - FileSeek3ds(0); /* Write file rewrites the entire file from the beginning */ - ADD_ERROR(ERR_WRITING_DATABASE); - ON_ERROR_RETURN; - - db->topchunk->writeindex = file->index; - - WriteChunk3ds(db->topchunk, file->index); - ADD_ERROR(ERR_WRITING_DATABASE); - ON_ERROR_RETURN; - } -} - diff --git a/3rdparty/3dsftk3/src/dbase3ds.h b/3rdparty/3dsftk3/src/dbase3ds.h deleted file mode 100644 index adedb845..00000000 --- a/3rdparty/3dsftk3/src/dbase3ds.h +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef DBASE_3DS_H -#define DBASE_3DS_H - -#include "3dstype.h" -#include "3dsfile.h" -/* #include "3dsftkst.h" */ -#include "3dserr.h" -#include "chunk3ds.h" - -/* Database instance structure */ - -/* Used as a parameter to CreateNewDatabase3ds */ - -/* Private Typedefs */ - -/* dbtype3ds - Database type settings */ -typedef enum -{ - Unknown, /* Database has not be created yet */ - MeshFile, /* 3D Studio .3DS file */ - ProjectFile, /* 3D STudio .PRJ file */ - MaterialFile /* 3D Studio .MLI file */ -} dbtype3ds; -/* End Private */ - -/* Public Typedef */ - -/* database3ds - File database */ -typedef struct -{ - chunk3ds *topchunk; /* top chunk in the file */ - byte3ds objlistdirty; /* If true, than *objlist needs to be recreated */ - byte3ds matlistdirty; - byte3ds nodelistdirty; - chunklist3ds *objlist; /* Quick Cross references between names and database chunks */ - chunklist3ds *matlist; - chunklist3ds *nodelist; -} database3ds; -/* End Public */ - -/* Public Prototypes */ - -/* Database functions */ -void InitDatabase3ds(database3ds **db); -void ReleaseDatabase3ds(database3ds **db); -void CreateDatabase3ds(file3ds *file, database3ds *db); -void CreateNewDatabase3ds(database3ds *db, dbtype3ds type); -dbtype3ds GetDatabaseType3ds(database3ds *db); -void CopyDatabase3ds(database3ds *idb, database3ds *odb); -void DisconnectDatabase3ds(database3ds *db); -void WriteDatabase3ds(file3ds *file, database3ds *db); -/* End Public */ - -void UpdateNamedObjectList3ds(database3ds *db); -void FindNamedObject3ds(database3ds *db, char3ds *name, chunk3ds **found); -void MakeNamedObjectListDirty3ds(database3ds *db); -void UpdateMatEntryList3ds(database3ds *db); -void FindMatEntry3ds(database3ds *db, char3ds *name, chunk3ds **found); -chunk3ds *FindMatEntryByIndex3ds(database3ds *db, ulong3ds index); -void MakeMatEntryListDirty3ds(database3ds *db); -void ReadChildren3ds(chunk3ds *parent); -void ReadXDataEntryChildren3ds(chunk3ds *parent); -void WriteChunk3ds(chunk3ds *chunk, ubyte3ds fileindex); -void DeleteChunkTypeByIndex3ds(database3ds *db, chunktag3ds id, ulong3ds index); -void DeleteNamedObjectByName3ds(database3ds *db, char3ds *name); -chunk3ds *FindNamedObjectByIndex3ds(database3ds *db, chunktag3ds type, ulong3ds index); -void CopyNamedObjectByName3ds(database3ds *destdb, database3ds *srcdb, char3ds *name); -void CopyNamedObjectByIndex3ds(database3ds *destdb, database3ds *srcdb, chunktag3ds nobjtype, ulong3ds index); -void UpdateNodeTagList3ds(database3ds *db); -void MakeNodeTagListDirty3ds(database3ds *db); -chunk3ds *FindNodeTagByNameAndType3ds(database3ds *db, char3ds *name, chunktag3ds type); -chunk3ds *FindNodeTagByIndexAndType3ds(database3ds *db, ulong3ds index, chunktag3ds type); -void DeleteNodeTagByIndexAndType3ds(database3ds *db, ulong3ds index, chunktag3ds type); -void DeleteNodeTagByNameAndType3ds(database3ds *db, char3ds *name, chunktag3ds type); -void CopyNodeTagByIndexAndType3ds(database3ds *destdb, database3ds *srcdb, ulong3ds index, chunktag3ds type); -void CopyNodeTagByNameAndType3ds(database3ds *destdb, database3ds *srcdb, char3ds *name, chunktag3ds type); - - -#endif - diff --git a/3rdparty/3dsftk3/src/dumpchnk.c b/3rdparty/3dsftk3/src/dumpchnk.c deleted file mode 100644 index 63ef5905..00000000 --- a/3rdparty/3dsftk3/src/dumpchnk.c +++ /dev/null @@ -1,1384 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* Source file for DumpChunk3ds function for ascii printout of file chunks. */ - -#include -#include -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "3dsftkst.h" -#include "3dsutil.h" -#include "dumpchnk.h" -#include "chunk3ds.h" -#include "3dsmatr.h" -#include "kfutils.h" - -static long3ds DumpLevel3ds = 2; - -void SetDumpLevel3ds(long3ds newlevel) -{ - DumpLevel3ds = newlevel; -} - -/* Retrieves the data for a chunk, formats the data into ascii text, and sends the text to outfile */ -void DumpChunk3ds(FILE *outfile, /* file formated text gets output to */ - chunk3ds *chunk, /* chunk that is being dumped */ - ushort3ds indentlevel /* level of indentation for the chunk */ - ) -{ - chunk3ds *child; - - ChunkHeaderReport3ds(outfile, chunk, indentlevel); - - - if (DumpLevel3ds != TerseDump3ds) - { - switch(chunk->tag) - { - case MESH_VERSION : - { - MeshVersion *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sVersion %u\n", indent(indentlevel), d->version); - - break; - } - - case M3D_VERSION : - { - M3dVersion *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sVersion %u\n", indent(indentlevel), d->version); - - break; - } - - case COLOR_F : - { - ColorF *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %f,", indent(indentlevel), d->red); - fprintf(outfile, "G: %f,", d->green); - fprintf(outfile, "B: %f\n", d->blue); - - break; - } - - case LIN_COLOR_F : - { - LinColorF *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %f,", indent(indentlevel), d->red); - fprintf(outfile, "G: %f,", d->green); - fprintf(outfile, "B: %f\n", d->blue); - - break; - } - - case COLOR_24 : - { - Color24 *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %u,", indent(indentlevel), d->red); - fprintf(outfile, "G: %u,", d->green); - fprintf(outfile, "B: %u\n", d->blue); - - break; - } - - case LIN_COLOR_24 : - { - LinColor24 *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %u,", indent(indentlevel), d->red); - fprintf(outfile, "G: %u,", d->green); - fprintf(outfile, "B: %u\n", d->blue); - - break; - } - - case INT_PERCENTAGE : - { - IntPercentage *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sPercentage of %i%%\n", indent(indentlevel), d->intpercentage); - - break; - } - - case FLOAT_PERCENTAGE : - { - FloatPercentage *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sPercentage of %f\n", indent(indentlevel), d->floatpercentage); - - break; - } - - case MASTER_SCALE : - { - MasterScale *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMaster Scale %f\n", indent(indentlevel), d->masterscale); - - break; - } - - case BIT_MAP : - { - BitMap *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sBitmap name %s\n", indent(indentlevel), d->bitmap); - - break; - } - - case V_GRADIENT: - { - VGradient *d; - ReadChunkData3ds(chunk); - d = chunk->data; - fprintf(outfile, "%sMidpoint %f\n", indent(indentlevel), d->gradpercent); - - - break; - } - - case LO_SHADOW_BIAS: - { - LoShadowBias *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sBias of %f\n", indent(indentlevel), d->bias); - - break; - } - - case HI_SHADOW_BIAS: - { - HiShadowBias *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sBias of %f\n", indent(indentlevel), d->bias); - - break; - } - - case RAY_BIAS: - { - RayBias *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sBias of %f\n", indent(indentlevel), d->bias); - - break; - } - - case SHADOW_MAP_SIZE: - { - ShadowMapSize *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sSize of %i\n", indent(indentlevel), d->shadowmapsize); - - break; - } - - case SHADOW_SAMPLES: - { - ShadowSamples *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sSize of %i\n", indent(indentlevel), d->shadowsamples); - - break; - } - - case SHADOW_RANGE: - { - ShadowRange *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sRange of %i\n", indent(indentlevel), d->shadowrange); - - break; - } - - case SHADOW_FILTER: - { - ShadowFilter *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sFilter of %f\n", indent(indentlevel), d->shadowfilter); - - break; - } - - case O_CONSTS: - { - OConsts *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sPlane at %f, %f, %f\n", indent(indentlevel), d->oconsts.x, d->oconsts.y, d->oconsts.z); - - break; - } - - case FOG: - { - Fog *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sNear plane at %f\n", indent(indentlevel), d->nearplanedist); - fprintf(outfile, "%sNear density of %f\n", indent(indentlevel), d->nearplanedensity); - fprintf(outfile, "%sFar plane at %f\n", indent(indentlevel), d->farplanedist); - fprintf(outfile, "%sFar density of %f\n", indent(indentlevel), d->farplanedensity); - - break; - } - case LAYER_FOG: - { - LayerFog *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sFog Z range is %f to %f.\n", indent(indentlevel), d->zmin, d->zmax); - fprintf(outfile, "%sFog density is %f.\n", indent(indentlevel), d->density); - fprintf(outfile, "%sFog type of %x.\n", indent(indentlevel), d->type); - break; - } - - case DISTANCE_CUE: - { - DistanceCue *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sNear plane at %f\n", indent(indentlevel), d->nearplanedist); - fprintf(outfile, "%sNear density of %f\n", indent(indentlevel), d->nearplanedimming); - fprintf(outfile, "%sFar plane at %f\n", indent(indentlevel), d->farplanedist); - fprintf(outfile, "%sFar density of %f\n", indent(indentlevel), d->farplanedimming); - - break; - } - case VIEW_TOP: - case VIEW_BOTTOM: - case VIEW_LEFT: - case VIEW_RIGHT: - case VIEW_FRONT: - case VIEW_BACK: - { - ViewStandard *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sTarget at %f, %f, %f\n", indent(indentlevel), d->viewtargetcoord.x, d->viewtargetcoord.y, d->viewtargetcoord.z); - fprintf(outfile, "%sView width of %f\n", indent(indentlevel), d->viewwidth); - - break; - } - case VIEW_USER: - { - ViewUser *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sTarget at %f, %f, %f\n", indent(indentlevel), d->viewtargetcoord.x, d->viewtargetcoord.y, d->viewtargetcoord.z); - fprintf(outfile, "%sView width of %f\n", indent(indentlevel), d->viewwidth); - fprintf(outfile, "%sHorizontal view angle of %f\n", indent(indentlevel), d->xyviewangle); - fprintf(outfile, "%sVertical view angle of %f\n", indent(indentlevel), d->yzviewangle); - fprintf(outfile, "%sBank angle of %f\n", indent(indentlevel), d->bankangle); - - break; - } - case VIEW_CAMERA: - { - ViewCamera *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sCamera name %s\n", indent(indentlevel), d->name); - - break; - } - case NAMED_OBJECT: - { - NamedObject *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sName: %s\n", indent(indentlevel), d->name); - break; - } - case POINT_ARRAY: - { - PointArray *d; - ushort3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Vertices\n", indent(indentlevel), d->vertices); - if (DumpLevel3ds == MaximumDump3ds) - { - for(i = 0; i < d->vertices; i++) - { - fprintf(outfile, "%sVertex %i at %f, %f, %f\n", indent(indentlevel), i, d->pointlist[i].x, d->pointlist[i].y, d->pointlist[i].z); - } - } - - break; - } - - case POINT_FLAG_ARRAY: - { - PointFlagArray *d; - ushort3ds i; - - d = ReadChunkData3ds(chunk); - - fprintf(outfile, "%s%u Flags\n", indent(indentlevel), d->flags); - if (DumpLevel3ds == MaximumDump3ds) - { - for (i = 0; i < d->flags; i++) - { - fprintf(outfile, "%sFlag %i is %u\n", indent(indentlevel), i, d->flaglist[i]); - } - } - break; - } - - case FACE_ARRAY: - { - FaceArray *d; - ushort3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Faces\n", indent(indentlevel), d->faces); - if (DumpLevel3ds == MaximumDump3ds) - { - for(i = 0; i < d->faces; i++) - { - fprintf(outfile, "%sFace %i vertices %i, %i, %i and flag %x\n", indent(indentlevel), i, d->facelist[i].v1, d->facelist[i].v2, d->facelist[i].v3, d->facelist[i].flag); - } - } - - break; - } - case MSH_MAT_GROUP: - { - MshMatGroup *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMaterial Name Of %s\n", indent(indentlevel), d->matname); - fprintf(outfile, "%sAssigned to %i faces\n", indent(indentlevel), d->faces); - - break; - } - case MSH_BOXMAP: - { - MshBoxmap *d; - ushort3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sBoxmap consists of the following materials:\n", indent(indentlevel)); - for(i = 0; i < 6; i++) - fprintf(outfile, "%s%s\n", indent(indentlevel), d->matnames[i]); - break; - } - case TEX_VERTS: - { - TexVerts *d; - ushort3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Vertices\n", indent(indentlevel), d->numcoords); - if (DumpLevel3ds == MaximumDump3ds) - { - for(i = 0; i < d->numcoords; i++) - { - fprintf(outfile, "%sVertex %i with tex vert of %f, %f\n", indent(indentlevel), i, d->textvertlist[i].u, d->textvertlist[i].v); - } - } - - break; - } - - case MESH_TEXTURE_INFO: - { - MeshTextureInfo *d; - ushort3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap Type of %i\n", indent(indentlevel), d->maptype); - fprintf(outfile, "%sX Tiling of %f\n", indent(indentlevel), d->xtiling); - fprintf(outfile, "%sY Tiling of %f\n", indent(indentlevel), d->ytiling); - fprintf(outfile, "%sIcon position of %f, %f, %f\n", indent(indentlevel), d->iconpos.x, d->iconpos.y, d->iconpos.z); - - for (i = 0; i < 12; i+=3) - { - fprintf(outfile, "%s[%i] %f [%i] %f [%i] %f\n", indent(indentlevel), i, d->xmatrix[i], i+1, d->xmatrix[i+1], i+2, d->xmatrix[i+2]); - } - - fprintf(outfile, "%sScaling Value of %f\n", indent(indentlevel), d->iconscaling); - fprintf(outfile, "%sPlanar Icon Width of %f\n", indent(indentlevel), d->iconwidth); - fprintf(outfile, "%sPlanar Icon Height of %f\n", indent(indentlevel), d->iconheight); - fprintf(outfile, "%sCylinder Icon Height of %f\n", indent(indentlevel), d->cyliconheight); - - break; - } - case MESH_MATRIX: - { - MeshMatrix *d; - ushort3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - for (i = 0; i < 12; i+=3) - { - fprintf(outfile, "%s[%i] %f [%i] %f [%i] %f\n", indent(indentlevel), i, d->xmatrix[i], i+1, d->xmatrix[i+1], i+2, d->xmatrix[i+2]); - } - - break; - } - case PROC_NAME: - { - ProcName *d; - - d = ReadChunkData3ds(chunk); - - fprintf(outfile, "%sProcedure Name of %s\n", indent(indentlevel), d->name); - - break; - } - case MESH_COLOR: - { - MeshColor *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor index of %i\n", indent(indentlevel), d->color); - break; - } - case N_DIRECT_LIGHT: - { - NDirectLight *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sLight at %f, %f, %f\n", indent(indentlevel), d->lightpos.x, d->lightpos.y, d->lightpos.z); - - break; - } - case DL_EXCLUDE: - { - DlExclude *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sExclude %s.\n", indent(indentlevel), d->name); - break; - } - case DL_OUTER_RANGE: - case DL_INNER_RANGE: - { - DlOuterRange *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sRange of %f.\n", indent(indentlevel), d->range); - break; - } - case DL_MULTIPLIER: - { - DlMultiplier *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMultiple of %f.\n", indent(indentlevel), d->multiple); - break; - } - case DL_SPOT_ROLL: - { - DlSpotRoll *d; - d = ReadChunkData3ds(chunk); - - fprintf(outfile, "%sRoll angle of %f.\n", indent(indentlevel), d->angle); - break; - } - case DL_SPOT_ASPECT: - { - DlSpotAspect *d; - d = ReadChunkData3ds(chunk); - - fprintf(outfile, "%sSpot aspect of %f.\n", indent(indentlevel), d->aspect); - break; - } - case DL_SPOT_PROJECTOR: - { - DlSpotProjector *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sFilename of %s.\n", indent(indentlevel), d->name); - break; - } - case DL_RAY_BIAS: - { - DlRayBias *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sBias of %f.\n", indent(indentlevel), d->bias); - break; - } - - case DL_SPOTLIGHT: - { - DlSpotlight *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sTarget at %f, %f, %f\n", indent(indentlevel), d->spotlighttarg.x, d->spotlighttarg.y, d->spotlighttarg.z); - fprintf(outfile, "%sHotspot cone of %f, ", indent(indentlevel), d->hotspotangle); - fprintf(outfile, "Falloff cone of %f\n", d->falloffangle); - - break; - } - case DL_LOCAL_SHADOW2: - { - DlLocalShadow2 *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sShadow bias of %f\n", indent(indentlevel), d->localshadowbias); - fprintf(outfile, "%sShadow filter of %f\n", indent(indentlevel), d->localshadowfilter); - fprintf(outfile, "%sShadow map size of %f\n", indent(indentlevel), d->localshadowmapsize); - - break; - } - case N_CAMERA: - { - NCamera *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sCamera at %f, %f, %f\n", indent(indentlevel), d->camerapos.x, d->camerapos.y, d->camerapos.z); - fprintf(outfile, "%sTarget at %f, %f, %f\n", indent(indentlevel), d->targetpos.x, d->targetpos.y, d->targetpos.z); - fprintf(outfile, "%sBank angle of %f", indent(indentlevel), d->camerabank); - fprintf(outfile, " and a foc of %f\n", d->camerafocallength); - - break; - } - case CAM_RANGES: - { - CamRanges *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sCamera near range is %f and far range is %f.\n", indent(indentlevel), d->nearplane, d->farplane); - break; - } - case VIEWPORT_LAYOUT: - { - ViewportLayout *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sForm of %i\n", indent(indentlevel), d->form); - fprintf(outfile, "%sTop of %i\n", indent(indentlevel), d->top); - fprintf(outfile, "%sReady of %i\n", indent(indentlevel), d->ready); - fprintf(outfile, "%sWState of %i\n", indent(indentlevel), d->wstate); - fprintf(outfile, "%sSwap WS of %i\n", indent(indentlevel), d->swapws); - fprintf(outfile, "%sSwap Port of %i\n", indent(indentlevel), d->swapport); - fprintf(outfile, "%sSwap Cur of %i\n", indent(indentlevel), d->swapcur); - - break; - } - - case VIEWPORT_SIZE: - { - ViewportSize *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sWork Area X: %i Y: %i W: %i H: %i\n", indent(indentlevel), d->xpos, d->ypos, d->width, d->height); - - break; - } - case VIEWPORT_DATA_3: - case VIEWPORT_DATA: - { - ViewportData *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sFlags of %x\n", indent(indentlevel), d->flags); - fprintf(outfile, "%sAxis Lockouts of %x\n", indent(indentlevel), d->axislockout); - fprintf(outfile, "%sWindow Position of %i, ", indent(indentlevel), d->winxpos); - fprintf(outfile, "%i\n", d->winypos); - fprintf(outfile, "%sWindow Size of %i, ", indent(indentlevel), d->winwidth); - fprintf(outfile, "%i\n", d->winheight); - fprintf(outfile, "%sWindow View of %i\n", indent(indentlevel), d->view); - fprintf(outfile, "%sZoom Factor of %f\n", indent(indentlevel), d->zoomfactor); - fprintf(outfile, "%sWorld center of %f, %f, %f\n", indent(indentlevel), d->center.x, d->center.y, d->center.z); - fprintf(outfile, "%sHorizontal Angle of %f\n", indent(indentlevel), d->horizang); - fprintf(outfile, "%sVertical Angle of %f\n", indent(indentlevel), d->vertang); - fprintf(outfile, "%sCamera Name of %s\n", indent(indentlevel), d->camname); - - break; - } - case XDATA_APPNAME: - { - XDataAppName *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sApplication name %s\n", indent(indentlevel), d->name); - break; - } - case XDATA_STRING: - { - XDataString *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sString value of %s\n", indent(indentlevel), d->string); - break; - } - case MAT_NAME: - { - MatName *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMaterial name %s\n", indent(indentlevel), d->name); - - break; - } - case MAT_SHADING: - { - MatShading *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sShading value of %u\n", indent(indentlevel), d->matshading); - - break; - } - case MAT_ACUBIC: - { - MatAcubic *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sShade level of %i\n", indent(indentlevel), d->shadelevel); - fprintf(outfile, "%sAntialias level of %i\n", indent(indentlevel), d->antialias); - fprintf(outfile, "%sFlags of %u\n", indent(indentlevel), d->flags); - fprintf(outfile, "%sMap size of %u\n", indent(indentlevel), d->mapsize); - fprintf(outfile, "%sFrame skip of %u\n", indent(indentlevel), d->frameinterval); - - break; - } - case MAT_MAPNAME: - { - MatMapname *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap name %s\n", indent(indentlevel), d->name); - - break; - } - case MAT_WIRESIZE: - { - MatWireSize *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sWire frame size of %f\n", indent(indentlevel), d->wiresize); - - break; - } - case MAT_MAP_TILING: - { - MatMapTiling *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap flags of", indent(indentlevel)); - if (d->tiling & TEX_DECAL) fprintf(outfile, " TEX_DECAL"); - if (d->tiling & TEX_MIRROR) fprintf(outfile, " TEX_MIRROR"); - if (d->tiling & TEX_UNUSED1) fprintf(outfile, " TEX_UNUSED1"); - if (d->tiling & TEX_INVERT) fprintf(outfile, " TEX_INVERT"); - if (d->tiling & TEX_NOWRAP) fprintf(outfile, " TEX_NOWRAP"); - if (d->tiling & TEX_SAT) fprintf(outfile, " TEX_SAT"); - if (d->tiling & TEX_ALPHA_SOURCE) fprintf(outfile, " TEX_ALPHA_SOURCE"); - if (d->tiling & TEX_TINT) fprintf(outfile, " TEX_TINT"); - if (d->tiling & TEX_DONT_USE_ALPHA) fprintf(outfile, " TEX_DONT_USE_ALPHA"); - if (d->tiling & TEX_RGB_TINT) fprintf(outfile, " TEX_RGB_TINT"); - if (d->tiling == 0) fprintf(outfile, " NONE"); - fprintf(outfile, "\n"); - - break; - } - - case MAT_MAP_COL1 : - { - MatMapCol1 *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %u,", indent(indentlevel), d->red); - fprintf(outfile, "G: %u,", d->green); - fprintf(outfile, "B: %u\n", d->blue); - - break; - } - - case MAT_MAP_COL2 : - { - MatMapCol2 *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %u,", indent(indentlevel), d->red); - fprintf(outfile, "G: %u,", d->green); - fprintf(outfile, "B: %u\n", d->blue); - - break; - } - - case MAT_MAP_RCOL : - { - MatMapRCol *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %u,", indent(indentlevel), d->red); - fprintf(outfile, "G: %u,", d->green); - fprintf(outfile, "B: %u\n", d->blue); - - break; - } - - case MAT_MAP_GCOL : - { - MatMapGCol *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %u,", indent(indentlevel), d->red); - fprintf(outfile, "G: %u,", d->green); - fprintf(outfile, "B: %u\n", d->blue); - - break; - } - - case MAT_MAP_BCOL : - { - MatMapBCol *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sColor R: %u,", indent(indentlevel), d->red); - fprintf(outfile, "G: %u,", d->green); - fprintf(outfile, "B: %u\n", d->blue); - - break; - } - - case MAT_MAP_TEXBLUR: - { - MatMapTexblur *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap bluring of %f\n", indent(indentlevel), d->percent); - - break; - } - - case MAT_MAP_USCALE: - { - MatMapUScale *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap U scale of %f\n", indent(indentlevel), d->scale); - - break; - } - - case MAT_MAP_VSCALE: - { - MatMapVScale *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap V scale of %f\n", indent(indentlevel), d->scale); - - break; - } - - case MAT_MAP_UOFFSET: - { - MatMapUOffset *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap U offset of %f\n", indent(indentlevel), d->offset); - - break; - } - - case MAT_MAP_VOFFSET: - { - MatMapVOffset *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap V offset of %f\n", indent(indentlevel), d->offset); - - break; - } - - case MAT_MAP_ANG: - { - MatMapAng *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMap rotation angle of %f\n", indent(indentlevel), d->angle); - - break; - } - - case MAT_BUMP_PERCENT : - { - MatBumpPercent *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sPercentage of %i%%\n", indent(indentlevel), d->intpercentage); - - break; - } - - case KFHDR: - { - KFHdr *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sRevision level of %x\n", indent(indentlevel), d->revision); - fprintf(outfile, "%sFilename %s\n", indent(indentlevel), d->filename); - fprintf(outfile, "%sAnimation length of %i\n", indent(indentlevel), d->animlength); - - break; - } - case KFSEG: - { - KFSeg *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sSegment starts at %i and ends at %i\n", indent(indentlevel), d->first, d->last); - - break; - } - case KFCURTIME: - { - KFCurtime *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sCurrent frame is %i\n", indent(indentlevel), d->currframenum); - - break; - } - case NODE_ID: - { - int i; - KFId *d; - - d = ReadChunkData3ds(chunk); - i = (int)d->id; - fprintf(outfile, "%s Node ID: %d \n", indent(indentlevel), i); - break; - } - case NODE_HDR: - { - NodeHdr *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, - "%sObject name: %s\n", - indent(indentlevel), - d->objname); - - /*--- Flags 1 */ - fprintf(outfile, - "%sFlags 1: %x\n", - indent(indentlevel), - d->flags1); - if (DumpLevel3ds == MaximumDump3ds){ - - if (d->flags1&NODE_RENDOB_HIDE) - fprintf(outfile, "%sNODE_RENDOB_HIDE\n", indent(indentlevel)); - if (d->flags1&NODE_OFF) - fprintf(outfile, "%sNODE_OFF\n", indent(indentlevel)); - if (d->flags1&ATKEY1) - fprintf(outfile, "%sATKEY1\n", indent(indentlevel)); - if (d->flags1&ATKEY2) - fprintf(outfile, "%sATKEY2\n", indent(indentlevel)); - if (d->flags1&ATKEY3) - fprintf(outfile, "%sATKEY3\n", indent(indentlevel)); - if (d->flags1&ATKEY4) - fprintf(outfile, "%sATKEY4\n", indent(indentlevel)); - if (d->flags1&ATKEY5) - fprintf(outfile, "%sATKEY5\n", indent(indentlevel)); - if (d->flags1&ATKEYFLAGS) - fprintf(outfile, "%sATKEYFLAGS\n", indent(indentlevel)); - if (d->flags1&MARK_NODE) - fprintf(outfile, "%sMARK_NODE\n", indent(indentlevel)); - if (d->flags1&DISABLE_NODE) - fprintf(outfile, "%sDISABLE_NODE\n", indent(indentlevel)); - if (d->flags1&HIDE_NODE) - fprintf(outfile, "%sHIDE_NODE\n", indent(indentlevel)); - if (d->flags1&FAST_NODE) - fprintf(outfile, "%sFAST_NODE\n", indent(indentlevel)); - if (d->flags1&PRIMARY_NODE) - fprintf(outfile, "%sPRIMARY_NODE\n", indent(indentlevel)); - if (d->flags1&NODE_CALC_PATH) - fprintf(outfile, "%sNODE_CALC_PATH\n", indent(indentlevel)); - } - - /*--- Flags 2 */ - fprintf(outfile, - "%sFlags 2: %x\n", - indent(indentlevel), - d->flags2); - if (DumpLevel3ds == MaximumDump3ds){ - if (d->flags2&NODE_HAS_PATH) - fprintf(outfile, "%sNODE_HAS_PATH\n",indent(indentlevel)); - if (d->flags2&NODE_AUTO_SMOOTH) - fprintf(outfile, "%sNODE_AUTO_SMOOTH\n",indent(indentlevel)); - if (d->flags2&NODE_FROZEN) - fprintf(outfile, "%sNODE_FROZEN\n",indent(indentlevel)); - if (d->flags2&NODE_ANI_HIDDEN) - fprintf(outfile, "%sNODE_ANI_HIDDEN\n",indent(indentlevel)); - if (d->flags2&NODE_MOTION_BLUR) - fprintf(outfile, "%sNODE_MOTION_BLUR\n",indent(indentlevel)); - if (d->flags2&NODE_BLUR_BRANCH) - fprintf(outfile, "%sNODE_BLUR_BRANCH\n",indent(indentlevel)); - if (d->flags2&NODE_MORPH_MTL) - fprintf(outfile, "%sNODE_MORPH_MTL\n",indent(indentlevel)); - if (d->flags2&NODE_MORPH_OB) - fprintf(outfile, "%sNODE_MORPH_OB\n",indent(indentlevel)); - } - - - if (d->parentindex == -1) - fprintf(outfile, "%sNo Parent\n", indent(indentlevel)); - else - fprintf(outfile, - "%sParent %i\n", indent(indentlevel), d->parentindex); - break; - } - case INSTANCE_NAME: - { - InstanceName *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sInstance name: %s\n", indent(indentlevel), d->name); - - break; - } - case PARENT_NAME: - { - InstanceName *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - if (d == NULL ||d->name[0] == 0) - fprintf(outfile, "%sNo Parent\n", indent(indentlevel)); - else - fprintf(outfile, "%sParent name: %s\n", - indent(indentlevel), d->name); - break; - } - case PIVOT: - { - Pivot *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sPivot at %f, %f, %f\n", indent(indentlevel), d->offset.x, d->offset.y, d->offset.z); - - break; - } - case BOUNDBOX: - { - BoundBox *d; - - d = chunk->data; - if (d != NULL){ - fprintf(outfile, "%sMinimum at %f, %f, %f\n", indent(indentlevel), d->min.x, d->min.y, d->min.z); - fprintf(outfile, "%sMaximum at %f, %f, %f\n", indent(indentlevel), d->max.x, d->max.y, d->max.z); - } - - break; - } - case MORPH_SMOOTH: - { - MorphSmooth *d; - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%sMorph Smoothing Angle of %f\n", indent(indentlevel), d->smoothgroupangle); - - break; - } - case POS_TRACK_TAG: - { - PosTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sObject at %f, %f, %f\n", indent(indentlevel), d->positionlist[i].x, d->positionlist[i].y, d->positionlist[i].z); - } - - break; - } - case ROT_TRACK_TAG: - { - RotTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) - { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sRotation of %f\n", indent(indentlevel), d->rotationlist[i].angle); - fprintf(outfile, "%sAxis of %f, %f, %f\n", indent(indentlevel), d->rotationlist[i].x, d->rotationlist[i].y, d->rotationlist[i].z); - } - - break; - } - case SCL_TRACK_TAG: - { - ScaleTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sScale of %f, %f, %f\n", indent(indentlevel), d->scalelist[i].x, d->scalelist[i].y, d->scalelist[i].z); - } - - break; - } - case FOV_TRACK_TAG: - { - FovTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sCamera Fov of %f\n", indent(indentlevel), d->fovanglelist[i]); - } - - break; - } - case ROLL_TRACK_TAG: - { - RollTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sCamera Roll of %f\n", indent(indentlevel), d->rollanglelist[i]); - } - - break; - } - case COL_TRACK_TAG: - { - ColTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sColor R: %f,", indent(indentlevel), d->colorlist[i].r); - fprintf(outfile, "G: %f,", d->colorlist[i].g); - fprintf(outfile, "B: %f\n", d->colorlist[i].b); - } - - break; - } - case MORPH_TRACK_TAG: - { - MorphTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sMorph to %s\n", indent(indentlevel), d->morphlist[i].name); - } - - break; - } - case HOT_TRACK_TAG: - { - HotTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sHotspot angle of %f\n", indent(indentlevel), d->hotspotanglelist[i]); - } - - break; - } - case FALL_TRACK_TAG: - { - FallTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", indent(indentlevel), d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - fprintf(outfile, "%sFalloff Angle of %f\n", indent(indentlevel), d->falloffanglelist[i]); - } - - break; - } - case HIDE_TRACK_TAG: - { - HideTrackTag *d; - ulong3ds i; - - ReadChunkData3ds(chunk); - d = chunk->data; - - fprintf(outfile, "%s%u Keys, %x Flags.\n", - indent(indentlevel), - d->trackhdr.keycount, d->trackhdr.flags); - - for (i = 0; i < d->trackhdr.keycount; i++) { - PrintKeyHeader3ds(outfile, &(d->keyhdrlist[i]), indentlevel); - } - - break; - } - - } /* End Switch */ - } - - child = chunk->children; - - while (child != NULL) - { - DumpChunk3ds(outfile, child, (ushort3ds)(indentlevel+1)); - ON_ERROR_RETURN; - - child = child->sibling; - } - - - -} - -void CheckSumChunk3ds(FILE *outfile, chunk3ds *chunk, ushort3ds indentlevel) -{ - - ChunkHeaderReport3ds(outfile, chunk, indentlevel); - fprintf(outfile, "%sChecksum Of %li\n", indent(indentlevel), CheckChunk3ds(chunk)); - if (chunk->children != NULL) CheckSumChunk3ds(outfile, chunk->children, (ushort3ds)(indentlevel+1)); - if (chunk->sibling != NULL) CheckSumChunk3ds(outfile, chunk->sibling, indentlevel); -} - -void DumpDatabase3ds(FILE *outfile, database3ds *db) -{ -/* SetContext3ds(db->file); */ - DumpChunk3ds(outfile, db->topchunk, 0); - -} - -void CheckSumDatabase3ds(FILE *outfile, database3ds *db) -{ - CheckSumChunk3ds(outfile, db->topchunk, 0); -} diff --git a/3rdparty/3dsftk3/src/dumpchnk.h b/3rdparty/3dsftk3/src/dumpchnk.h deleted file mode 100644 index 2aefbbc4..00000000 --- a/3rdparty/3dsftk3/src/dumpchnk.h +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef DUMPCHK_3DS_H -#define DUMPCHK_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "chunkinf.h" -#include "3dsftkst.h" -#include "dbase3ds.h" - -void DumpChunk3ds(FILE *outfile, /* file formated text gets output to */ - chunk3ds *chunk, /* chunk that is being dumped */ - ushort3ds indentlevel /* level of indentation for the chunk */ - ); -void CheckSumChunk3ds(FILE *outfile, chunk3ds *chunk, ushort3ds indentlevel); - -/* Public Prototypes */ -void SetDumpLevel3ds(long3ds newlevel); -void DumpDatabase3ds(FILE *outfile, database3ds *db); -/* End Public */ - -void CheckSumDatabase3ds(FILE *outfile, database3ds *db); - -/* Public Consts */ -static const long3ds TerseDump3ds = 0; /* Just the chunk headers */ -static const long3ds MediumDump3ds = 1; /* Selected bits of data (usually not array dumps) */ -static const long3ds MaximumDump3ds = 2; /* Everything */ -/* End Public */ - -#endif - diff --git a/3rdparty/3dsftk3/src/dumpsrc.c b/3rdparty/3dsftk3/src/dumpsrc.c deleted file mode 100644 index 3aa1c048..00000000 --- a/3rdparty/3dsftk3/src/dumpsrc.c +++ /dev/null @@ -1,275 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* Source file for DumpScr3ds functions for emiting source reps of structures */ - -#include -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsmobj.h" -#include "3dsmatr.h" -#include "dumpsrc.h" - -void DumpMeshSrc3ds(FILE *out, const mesh3ds *mesh, const char3ds *varname) -{ - ushort3ds i,j; - - if (out == NULL || mesh == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - if (mesh->vertexarray != NULL) - { - fprintf(out, "point3ds %sverts[%i] = {", varname, mesh->nvertices); - for (i = 0; i < mesh->nvertices; i++) - { - if (i > 0) fprintf(out, ", "); - if ((i % 2) == 0) fprintf(out, "\n "); - fprintf(out, "{%f, %f, %f}", mesh->vertexarray[i].x, mesh->vertexarray[i].y, mesh->vertexarray[i].z); - } - fprintf(out, "\n};\n\n"); - } - - if (mesh->textarray != NULL) - { - fprintf(out, "textvert3ds %stext[%i] = {", varname, mesh->ntextverts); - for (i = 0; i < mesh->ntextverts; i++) - { - if (i > 0) fprintf(out, ", "); - if ((i % 3) == 0) fprintf(out, "\n "); - fprintf(out, "{%f, %f}", mesh->textarray[i].u, mesh->textarray[i].v); - } - fprintf(out, "\n};\n\n"); - } - - if (mesh->facearray != NULL) - { - fprintf(out, "face3ds %sface[%i] = {", varname, mesh->nfaces); - for (i = 0; i < mesh->nfaces; i++) - { - if (i > 0) fprintf(out, ", "); - if ((i % 2) == 0) fprintf(out, "\n "); - fprintf(out, "{%i, %i, %i, 0x%x}", mesh->facearray[i].v1, mesh->facearray[i].v2, mesh->facearray[i].v3, mesh->facearray[i].flag); - } - fprintf(out, "\n};\n\n"); - } - if (mesh->smootharray != NULL) - { - fprintf(out, "ulong3ds %ssmooth[%i] = {", varname, mesh->nfaces); - for (i = 0; i < mesh->nfaces; i++) - { - if (i > 0) fprintf(out, ", "); - if ((i % 4) == 0) fprintf(out, "\n "); - fprintf(out, "0x%x", mesh->smootharray[i]); - } - fprintf(out, "\n};\n\n"); - } - - if (mesh->matarray != NULL) - { - for (i = 0; i < mesh->nmats; i++) - { - if (mesh->matarray[i].faceindex != NULL) - { - fprintf(out, "ushort3ds %sfal%i[%i] = {", varname, i, mesh->matarray[i].nfaces); - for (j = 0; j < mesh->matarray[i].nfaces; j++) - { - if (j > 0) fprintf(out, ", "); - if ((j % 6) == 0) fprintf(out, "\n "); - fprintf(out, "%u", mesh->matarray[i].faceindex[j]); - } - fprintf(out, "\n};\n\n"); - } - } - - fprintf(out, "objmat3ds %smats[%i] = {\n", varname, mesh->nmats); - for (i = 0; i < mesh->nmats; i++) - { - fprintf(out, " {\"%s\", %i, ", mesh->matarray[i].name, mesh->matarray[i].nfaces); - fprintf(out, "%sfal%i}\n", varname, i); - } - fprintf(out, "\n};\n\n"); - } - - fprintf(out, "mesh3ds %s = {\n", varname); - - i = (ushort3ds)strlen(varname); - fprintf(out, " {"); - for (j = 0; j < i; j++) - { - if (j > 0) fprintf(out, ","); - fprintf(out, "'%c'", varname[j]); - } - fprintf(out, "}, /* name */\n"); - - fprintf(out, " %u, /* ishidden */\n", mesh->ishidden); - fprintf(out, " %u, /* isvislofter */\n", mesh->isvislofter); - fprintf(out, " %u, /* ismatte */\n", mesh->ismatte); - fprintf(out, " %u, /* isnocast */\n", mesh->isnocast); - fprintf(out, " %u, /* isfast */\n", mesh->isfast); - fprintf(out, " %u, /* isnorcvshad */\n", mesh->isnorcvshad); - fprintf(out, " %u, /* isfrozen */\n", mesh->isfrozen); - - fprintf(out, " %i, /* nvertices */\n", mesh->nvertices); - - if (mesh->vertexarray != NULL) - fprintf(out, " %sverts, /* vertexarray */\n", varname); - else - fprintf(out, " NULL, /* vertexarray */\n"); - - fprintf(out, " %i, /* ntextverts */\n", mesh->ntextverts); - - if (mesh->textarray != NULL) - fprintf(out, " %stexts, /* textarray */\n", varname); - else - fprintf(out, " NULL, /* textarray */\n"); - - fprintf(out, " %u, /* usemapinfo */\n", mesh->usemapinfo); - - fprintf(out, " { /* map */\n"); - fprintf(out, " %i, /* map.maptype */\n", mesh->map.maptype); - fprintf(out, " %f, /* map.tilex */\n", mesh->map.tilex); - fprintf(out, " %f, /* map.tiley */\n", mesh->map.tiley); - fprintf(out, " %f, /* map.cenx */\n", mesh->map.cenx); - fprintf(out, " %f, /* map.ceny */\n", mesh->map.ceny); - fprintf(out, " %f, /* map.cenz */\n", mesh->map.cenz); - fprintf(out, " %f, /* map.scale */\n", mesh->map.scale); - fprintf(out, " { /* map.matrix[12] */"); - for (i = 0; i < 12; i++) - { - if ((i % 4) == 0) fprintf(out, "\n "); - fprintf(out, "%f, ", mesh->map.matrix[i]); - } - fprintf(out, "\n },\n"); - fprintf(out, " %f, /* map.pw */\n", mesh->map.pw); - fprintf(out, " %f, /* map.ph */\n", mesh->map.ph); - fprintf(out, " %f, /* map.ch */\n", mesh->map.ch); - fprintf(out, " },\n"); - fprintf(out, " { /* locmatrix[12] */"); - for (i = 0; i < 12; i++) - { - if ((i % 4) == 0) fprintf(out, "\n "); - fprintf(out, "%f, ", mesh->locmatrix[i]); - } - fprintf(out, "\n },\n"); - fprintf(out, " %i, /* nfaces */\n", mesh->nfaces); - if (mesh->facearray != NULL) - fprintf(out, " %sface, /* facearray */\n", varname); - else - fprintf(out, " NULL, /* facearray */\n"); - if (mesh->smootharray != NULL) - fprintf(out, " %ssmooth, /* smootharray */\n", varname); - else - fprintf(out, " NULL, /* smootharray */\n"); - - fprintf(out, " %u, /* useboxmap */\n", mesh->useboxmap); - fprintf(out, " { /* boxmap */\n"); - for (i = 0; i < 6; i++) - { - if (mesh->boxmap[i][0] == 0) - fprintf(out, " \"\",\n"); - else - fprintf(out, " \"%s\",\n", mesh->boxmap[i]); - } - fprintf(out, " },\n"); - fprintf(out, " %i, /* meshcolor */\n", mesh->meshcolor); - fprintf(out, " %i, /* nmats */\n", mesh->nmats); - if (mesh->matarray != NULL) - fprintf(out, " %smats, /* matarray */\n", varname); - else - fprintf(out, " NULL, /* matarray */\n"); - - fprintf(out, " %i, /* procsize */\n", mesh->procsize); - fprintf(out, " \"%s\", /* procname */\n", mesh->procname); - if (mesh->procdata != NULL) - fprintf(out, " %sproc /* procdata */\n", varname); - else - fprintf(out, " NULL /* procdata */\n"); - fprintf(out, "};\n"); -} - diff --git a/3rdparty/3dsftk3/src/dumpsrc.h b/3rdparty/3dsftk3/src/dumpsrc.h deleted file mode 100644 index b72dedba..00000000 --- a/3rdparty/3dsftk3/src/dumpsrc.h +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef DUMP_SRC_H -#define DUMP_SRC_H - -#include "3dstype.h" -#include "3dsmobj.h" -#include "3dsmatr.h" - -void DumpMeshSrc3ds(FILE *out, const mesh3ds *mesh, const char3ds *varname); - -#endif diff --git a/3rdparty/3dsftk3/src/dumpstr.c b/3rdparty/3dsftk3/src/dumpstr.c deleted file mode 100644 index a4322497..00000000 --- a/3rdparty/3dsftk3/src/dumpstr.c +++ /dev/null @@ -1,390 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* Source file for Dump3ds functions for ascii printout of file structures.*/ - -#include -#include -#include -#include "3dstype.h" -#include "3dserr.h" -#include "3dsmobj.h" -#include "3dsmatr.h" -#include "dumpstr.h" - -void DumpMapInfo3ds(FILE *out, mapinfo3ds *map, long3ds dumplevel) -{ - ushort3ds i; - - i = (ushort3ds)dumplevel; /* This routine may use this arg one day, this is just to kill - warnings about unused args */ - - fprintf(out, "Mapping info:\n"); - - fprintf(out, "Map Type of %i\n", map->maptype); - fprintf(out, "X Tiling of %f\n", map->tilex); - fprintf(out, "Y Tiling of %f\n", map->tiley); - fprintf(out, "Icon position of %f, %f, %f\n", map->cenx, map->ceny, map->cenz); - - for (i = 0; i < 12; i+=3) - { - fprintf(out, "[%i] %f [%i] %f [%i] %f\n", i, map->matrix[i], i+1, map->matrix[i+1], i+2, map->matrix[i+2]); - } - - fprintf(out, "Scaling Value of %f\n", map->scale); - fprintf(out, "Planar Icon Width of %f\n", map->pw); - fprintf(out, "Planar Icon Height of %f\n", map->ph); - fprintf(out, "Cylinder Icon Height of %f\n", map->ch); -} - -void DumpMesh3ds(FILE *out, mesh3ds *mesh, long3ds dumplevel) -{ - ushort3ds i; - - if (out == NULL || mesh == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - fprintf(out, "Mesh3ds structure contents:\n\n"); - fprintf(out, "Name: %s\n", mesh->name); - fprintf(out, "Object Flags: "); - if (mesh->ishidden) fprintf(out, "ishidden "); - if (mesh->isvislofter) fprintf(out, "vislofter "); - if (mesh->ismatte) fprintf(out, "ismatte "); - if (mesh->isnocast) fprintf(out, "isnocast "); - if (mesh->isfast) fprintf(out, "isfast "); - if (mesh->isnorcvshad) fprintf(out, "isnorcvshad "); - if (mesh->isfrozen) fprintf(out, "isfrozen"); - fprintf(out, "\n"); - fprintf(out, "Number of vertices: %i\n", mesh->nvertices); - fprintf(out, "Number of texture coords: %i\n", mesh->ntextverts); - if (mesh->usemapinfo) DumpMapInfo3ds(out, &(mesh->map), dumplevel); - fprintf(out, "Mesh Matrix:\n"); - for (i = 0; i < 12; i+=3) - { - fprintf(out, "[%i] %f [%i] %f [%i] %f\n", i, mesh->locmatrix[i], i+1, mesh->locmatrix[i+1], i+2, mesh->locmatrix[i+2]); - } - fprintf(out, "Number of faces: %i\n", mesh->nfaces); - fprintf(out, "Mesh Color: %i\n", mesh->meshcolor); - if (mesh->nmats > 0) - { - fprintf(out, "Materials assigned to mesh:\n"); - for(i = 0; i < mesh->nmats; i++) - { - fprintf(out, "%s\n", mesh->matarray[i].name); - } - } else - { - fprintf(out, "No materials assigned to mesh.\n"); - } - if (mesh->smootharray != NULL) - { - ushort3ds index; - fprintf(out, "Smooth groups assigned to mesh: "); - - for (i = 0; i < 32; i++) - { - for (index = 0; index < mesh->nfaces; index++) - { - if (mesh->smootharray[index] == (ulong3ds)(1L << i)) - { - fprintf(out, "%i ", i); - break; - } - } - } - fprintf(out, "\n"); - } - if (mesh->useboxmap) - { - fprintf(out, "Box mapping assignment:\n"); - for (i = 0; i < 6; i++) fprintf(out, "%s\n", mesh->boxmap[i]); - } - - if (mesh->procname[0] != 0) fprintf(out, "Stand-in procedure: %s\n", mesh->procname); -} - -void DumpBitmap3ds(FILE *out, bitmap3ds *map, long3ds dumplevel) -{ - ulong3ds i; - - i = dumplevel; /* This routine may use this arg one day, this is just to kill - warnings about unused args */ - - if (out == NULL || map == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - fprintf(out, " Name: %s\n", map->name); - fprintf(out, " Strength: %f\n", map->percent); - fprintf(out, " Tiling: "); - - switch(map->tiling) { - case Tile: fprintf(out, "Tile"); break; - case Decal: fprintf(out, "Decal"); break; - case Both: fprintf(out, "Both"); break; - } - fprintf(out, "\n"); - - if (map->ignorealpha) fprintf(out, " Ignoring Alpha Channel\n"); - if (map->filter == Pyramidal) fprintf(out, " Pyramidal"); - else fprintf(out, " Summed Array"); - fprintf(out, " Map Filtering\n"); - - fprintf(out, " Map Blurring of %f\n", map->blur); - if (map->mirror) fprintf(out, " Map is mirrored\n"); - if (map->negative) fprintf(out, " Map is negative\n"); - fprintf(out, " Scaling u: %f v: %f\n", map->uscale, map->vscale); - fprintf(out, " Offset u: %f v: %f\n", map->uoffset, map->voffset); - fprintf(out, " Rotation angle: %f\n", map->rotation); - - fprintf(out, " Image source from "); - switch(map->source) - { - case RGB: fprintf(out, "map RGB"); break; - case Alpha: fprintf(out, "map alpha"); break; - case RGBLumaTint: fprintf(out, "RGB lumanence tint"); break; - case AlphaTint: fprintf(out, "alpha channel tint"); break; - case RGBTint: fprintf(out, "RGB component tint"); break; - } - fprintf(out, "\n"); - - fprintf(out, " First tint r: %f g: %f b: %f\n", map->tint1.r, map->tint1.g, map->tint1.b); - fprintf(out, " Second tint r: %f g: %f b: %f\n", map->tint2.r, map->tint2.g, map->tint2.b); - fprintf(out, " Red tint r: %f g: %f b: %f\n", map->redtint.r, map->redtint.g, map->redtint.b); - fprintf(out, " Green tint r: %f g: %f b: %f\n", map->greentint.r, map->greentint.g, map->greentint.b); - fprintf(out, " Blue tint r: %f g: %f b: %f\n", map->bluetint.r, map->bluetint.g, map->bluetint.b); -} - -void DumpMaterial3ds(FILE *out, material3ds *mat, long3ds dumplevel) -{ - if (out == NULL || mat == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - fprintf(out, "Materials3ds structure contents:\n\n"); - fprintf(out, "Name: %s\n", mat->name); - fprintf(out, "Ambient: r: %f, g: %f, b: %f\n", mat->ambient.r, mat->ambient.g, mat->ambient.b); - fprintf(out, "Diffuse: r: %f, g: %f, b: %f\n", mat->diffuse.r, mat->diffuse.g, mat->diffuse.b); - fprintf(out, "Specular: r: %f, g: %f, b: %f\n", mat->specular.r, mat->specular.g, mat->specular.b); - - fprintf(out, "Shininess: %f Shininess Strength: %f\n", mat->shininess, mat->shinstrength); - if (mat->useblur) fprintf(out, "Using blur of %f\n", mat->blur); - else fprintf(out, "Not using blur, but its set to %f\n", mat->blur); - fprintf(out, "Transparency: %f\n", mat->transparency); - if (mat->usefall) fprintf(out, "Using transparency falloff of %f\n", mat->transfalloff); - else fprintf(out, "Not using transparency falloff, but is set to %f\n", mat->transfalloff); - - if (mat->selfillum) fprintf(out, "Self Illumination: %f\n", mat->selfillumpct); - if (mat->usewire) fprintf(out, "Wire frame size: %f\n", mat->wiresize); - fprintf(out, "Shading Style: "); - switch(mat->shading) - { - case Wire: fprintf(out, "Wire"); break; - case Flat: fprintf(out, "Flat"); break; - case Gouraud: fprintf(out, "Gouraud"); break; - case Phong: fprintf(out, "Phong"); break; - case Metal: fprintf(out, "Metal"); break; - } - fprintf(out, "\n"); - - if (mat->twosided) fprintf(out, "Two Sided\n"); - if (mat->additive) fprintf(out, "Additive"); - else fprintf(out, "Subtractive"); - fprintf(out, " Transparency\n"); - - if (mat->facemap) fprintf(out, "Using face mapping\n"); - if (mat->soften) fprintf(out, "Using phong softening\n"); - - if (mat->reflect.useauto) - { - fprintf(out, "Cubic Reflection Mapping Parameters: \n"); - fprintf(out, "\n"); - fprintf(out, " Flags:"); - if (!(mat->reflect.automap.firstframe) && !(mat->reflect.automap.flat)) fprintf(out, " None"); - if (mat->reflect.automap.firstframe) fprintf(out, " [First Frame Only]"); - if (mat->reflect.automap.flat) fprintf(out, " [Flat Mirror]"); - fprintf(out, "\n"); - fprintf(out, " Map size: %i\n", mat->reflect.automap.size); - fprintf(out, " Nth frame: %i\n", mat->reflect.automap.nthframe); - } - - if (mat->texture.map.name[0] != 0) - { - fprintf(out, "Texture map contents:\n"); - DumpBitmap3ds(out, &mat->texture.map, dumplevel); - } - - if (mat->texture.mask.name[0] != 0) - { - fprintf(out, "Texture mask contents:\n"); - DumpBitmap3ds(out, &mat->texture.mask, dumplevel); - } - - if (mat->texture2.map.name[0] != 0) - { - fprintf(out, "Texture map two contents:\n"); - DumpBitmap3ds(out, &mat->texture2.map, dumplevel); - } - - if (mat->texture2.mask.name[0] != 0) - { - fprintf(out, "Texture mask two contents:\n"); - DumpBitmap3ds(out, &mat->texture2.mask, dumplevel); - } - - if (mat->opacity.map.name[0] != 0) - { - fprintf(out, "Opacity map contents:\n"); - DumpBitmap3ds(out, &mat->opacity.map, dumplevel); - } - - if (mat->opacity.mask.name[0] != 0) - { - fprintf(out, "Opacity mask contents:\n"); - DumpBitmap3ds(out, &mat->opacity.mask, dumplevel); - } - - if (mat->reflect.map.name[0] != 0) - { - fprintf(out, "Reflection map contents:\n"); - fprintf(out, " Name: %s\n", mat->reflect.map.name); - fprintf(out, " Strength: %f\n", mat->reflect.map.percent); - } - if (mat->reflect.mask.name[0] != 0) - { - fprintf(out, "Reflection mask contents:\n"); - DumpBitmap3ds(out, &mat->reflect.mask, dumplevel); - } - - if (mat->bump.map.name[0] != 0) - { - fprintf(out, "Bump map contents:\n"); - DumpBitmap3ds(out, &mat->bump.map, dumplevel); - fprintf(out, " R3 Bump of %f\n", mat->bump.map.percent); - } - if (mat->bump.mask.name[0] != 0) - { - fprintf(out, "Bump mask contents:\n"); - DumpBitmap3ds(out, &mat->bump.mask, dumplevel); - } - - if (mat->specmap.map.name[0] != 0) - { - fprintf(out, "Specular map contents:\n"); - DumpBitmap3ds(out, &mat->specmap.map, dumplevel); - } - - if (mat->specmap.mask.name[0] != 0) - { - fprintf(out, "Specular mask contents:\n"); - DumpBitmap3ds(out, &mat->specmap.mask, dumplevel); - } - - if (mat->shinmap.map.name[0] != 0) - { - fprintf(out, "Shininess map contents:\n"); - DumpBitmap3ds(out, &mat->shinmap.map, dumplevel); - } - - if (mat->shinmap.mask.name[0] != 0) - { - fprintf(out, "Shininess mask contents:\n"); - DumpBitmap3ds(out, &mat->shinmap.mask, dumplevel); - } - - if (mat->illummap.map.name[0] != 0) - { - fprintf(out, "Illumination map contents:\n"); - DumpBitmap3ds(out, &mat->illummap.map, dumplevel); - } - - if (mat->illummap.mask.name[0] != 0) - { - fprintf(out, "Illummap mask contents:\n"); - DumpBitmap3ds(out, &mat->illummap.mask, dumplevel); - } - -} - diff --git a/3rdparty/3dsftk3/src/dumpstr.h b/3rdparty/3dsftk3/src/dumpstr.h deleted file mode 100644 index aa156332..00000000 --- a/3rdparty/3dsftk3/src/dumpstr.h +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef DUMP_STR_H -#define DUMP_STR_H - -#include "3dstype.h" -#include "3dsmobj.h" -#include "3dsmatr.h" - -/* Public Prototypes */ -void DumpMapInfo3ds(FILE *out, mapinfo3ds *map, long3ds dumplevel); -void DumpMesh3ds(FILE *out, mesh3ds *mesh, long3ds dumplevel); -void DumpMaterial3ds(FILE *out, material3ds *mat, long3ds dumplevel); -void DumpBitmap3ds(FILE *out, bitmap3ds *map, long3ds dumplevel); -/* End Public */ -#endif diff --git a/3rdparty/3dsftk3/src/ftkfiles.inc b/3rdparty/3dsftk3/src/ftkfiles.inc deleted file mode 100644 index 78e11407..00000000 --- a/3rdparty/3dsftk3/src/ftkfiles.inc +++ /dev/null @@ -1,224 +0,0 @@ -# -# This file is used by all compiler platforms to determine dependencies -# - - -LIBRARY_HEADERS1 = 3dstype.h 3dsprim.h 3dserr.h chunkinf.h chunk3ds.h 3dsfile.h dbase3ds.h -LIBRARY_HEADERS2 = 3dsrange.h 3dsftkst.h 3dsstrlf.h 3dsvprt.h 3dsmset.h 3dsaset.h 3dsbgnd.h -LIBRARY_HEADERS3 = 3dsmatr.h 3dsiobj.h 3dsmobj.h 3dsrobj.h 3dslites.h 3dscamr.h 3dskey.h -LIBRARY_HEADERS4 = 3dscamm.h 3dsambm.h 3dsobjm.h 3dsomnm.h 3dssptm.h 3dsmatx.h -LIBRARY_HEADERS5 = mdata3ds.h kdata3ds.h dumpsrc.h strcmpi.h kfutils.h 3dshier.h 3dsvers.h -LIBRARY_HEADERS6 = 3dsbbox.h ftkhead.h ftktail.h -LIBRARY_HEADERS7 = seekchil.h swapbyte.h smartall.h 3dsutil.h dumpstr.h dumpchnk.h xdata.h -LIBRARY_HEADERS8 = -LIBRARY_HEADERS9 = - - -LIBRARY_HEADERS = $(LIBRARY_HEADERS1) $(LIBRARY_HEADERS2) $(LIBRARY_HEADERS3) $(LIBRARY_HEADERS4) $(LIBRARY_HEADERS5) $(LIBRARY_HEADERS6) $(LIBRARY_HEADERS7) $(LIBRARY_HEADERS8) $(LIBRARY_HEADERS9) - - -LIBRARY_SOURCE = 3dsfile.c dbase3ds.c chunk3ds.c 3dserr.c 3dsstrlf.c seekchil.c 3dsprim.c makeswap.c smartall.c strcmpi.c 3dsutil.c 3dsiobj.c 3dsrobj.c 3dsmatr.c dumpstr.c 3dsmobj.c 3dsobjm.c assert.c dumpchnk.c xdata.c mdata3ds.c kdata3ds.c 3dscamr.c 3dscamm.c strdup.c dumpsrc.c 3dsaset.c 3dsmset.c 3dsbgnd.c kfutils.c 3dslites.c 3dshier.c scanhdr.c 3dssptm.c 3dsomnm.c 3dsambm.c 3dsvers.c 3dskey.c 3dsmatx.c 3dsbbox.c 3dsvprt.c - -LIBRARY_SRC_DIR = source - -LIBRARY_BATCH = buildat.bat targat.bat makelibs.bat makelib.bat maketarg.bat copykit.bat -TOOLKIT_BATCH = makesamp.bat makesmp2.bat - -MAKEFILES_UNX = makefile.spc -MAKEFILES_DOS = makefile.w95 makefile.mw3 makefile.m30 makefile.vc1 ftkvc22.mak ftkwc10.mak - -MAKEFILE_INC = ftkfiles.inc - -UTILITY_DEPS = $(INC)/dumpchnk.h $(INC)/3dstype.h $(INC)/dbase3ds.h $(INC)/3dsmobj.h $(INC)/mdata3ds.h $(INC)/3dscamr.h $(INC)/3dscamm.h $(INC)/3dsaset.h $(INC)/3dsmset.h $(INC)/3dsbgnd.h $(INC)/3dslites.h - -DUMP3DS_SOURCE = dump3ds.c -DUMP3DS_DIR = dump3ds - -XDATA3DS_SOURCE = xdata3ds.c -XDATA3DS_DIR = xdata3ds - -DUPTEST_SOURCE = duptest.c -DUPTEST_DIR = duptest - -EXAMPLE_DIR = examples - -POLYGON_SOURCE = polygon.c -POLYGON_DIR = $(EXAMPLE_DIR)/polygon - -TUNNEL_SOURCE = tunnel.c tunnel2.c tunnel.h -TUNNEL_DIR = $(EXAMPLE_DIR)/tunnel - -TOOLKIT_HEADER = 3dsftk.h -TOOLKIT_HEADER_DIR = inc - -TOOLKIT_LIBS = 3dftkm30.lib 3dftkm32.lib 3dftkvc1.lib 3dftkw95.lib -TOOLKIT_LIB_DIR = lib - -TOOLKIT_DIRS = $(DUMP3DS_DIR) $(DUPTEST_DIR) $(EXAMPLE_DIR) $(POLYGON_DIR) $(TUNNEL_DIR) $(TOOLKIT_HEADER_DIR) $(TOOLKIT_LIB_DIR) - -3DSOBJS = 3dsfile.$(OXT) dbase3ds.$(OXT) chunk3ds.$(OXT) 3dserr.$(OXT) 3dsstrlf.$(OXT) seekchil.$(OXT) 3dsprim.$(OXT) smartall.$(OXT) strcmpi.$(OXT) 3dsutil.$(OXT) 3dsiobj.$(OXT) 3dsrobj.$(OXT) 3dsmatr.$(OXT) dumpstr.$(OXT) 3dsmobj.$(OXT) 3dsobjm.$(OXT) assert.$(OXT) dumpchnk.$(OXT) xdata.$(OXT) mdata3ds.$(OXT) kdata3ds.$(OXT) 3dscamr.$(OXT) 3dscamm.$(OXT) strdup.$(OXT) dumpsrc.$(OXT) 3dsaset.$(OXT) 3dsmset.$(OXT) 3dsbgnd.$(OXT) kfutils.$(OXT) 3dslites.$(OXT) 3dshier.$(OXT) 3dssptm.$(OXT) 3dsomnm.$(OXT) 3dsambm.$(OXT) 3dsvers.$(OXT) 3dskey.$(OXT) 3dsmatx.$(OXT) 3dsbbox.$(OXT) 3dsvprt.$(OXT) swapbyte.$(OXT) - -3DSFILE_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dsstrlf.h 3dsrange.h 3dsftkst.h 3dsfile.h 3dserr.h - - -DBASE3DS_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dsfile.h 3dsrange.h 3dserr.h 3dsftkst.h chunk3ds.h 3dsutil.h seekchil.h dbase3ds.h 3dshier.h 3dsvers.h - - -CHUNK3DS_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dsfile.h 3dsrange.h 3dserr.h chunk3ds.h 3dsftkst.h 3dsutil.h - - -3DSERR_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h - - -3DSSTRLF_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsstrlf.h - - -SEEKCHIL_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h 3dsfile.h 3dsrange.h 3dsftkst.h seekchil.h chunk3ds.h - - -3DSPRIM_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsfile.h 3dsrange.h swapbyte.h chunkinf.h - - -MAKESWAP_DEP = 3dstype.h smartall.h - - -SMARTALL_DEP = - -STRCMPI_DEP = 3dstype.h smartall.h strcmpi.h - - -3DSUTIL_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h chunk3ds.h 3dserr.h 3dsutil.h 3dsftkst.h - - -3DSIOBJ_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsmobj.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h chunk3ds.h xdata.h 3dsrobj.h 3dsiobj.h - - -3DSROBJ_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsmobj.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h chunk3ds.h xdata.h 3dsrobj.h - - -3DSMATR_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h 3dsmatr.h dbase3ds.h 3dsfile.h 3dsrange.h chunk3ds.h xdata.h 3dsftkst.h - - -DUMPSTR_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsmobj.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h chunk3ds.h xdata.h 3dsmatr.h dumpstr.h - - -3DSMOBJ_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsmobj.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h chunk3ds.h xdata.h 3dsftkst.h 3dsiobj.h 3dsutil.h - - -3DSOBJM_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h xdata.h 3dsobjm.h dbase3ds.h 3dsfile.h 3dsrange.h kfutils.h - - -ASSERT_DEP = - -DUMPCHNK_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h 3dsftkst.h 3dsutil.h chunk3ds.h dumpchnk.h dbase3ds.h 3dsfile.h 3dsrange.h 3dsmatr.h xdata.h kfutils.h - - -XDATA_DEP = 3dstype.h smartall.h chunkinf.h chunk3ds.h 3dserr.h 3dsprim.h 3dsftkst.h xdata.h - - -MDATA3DS_DEP = 3dstype.h smartall.h 3dsfile.h 3dsrange.h 3dserr.h 3dsprim.h dbase3ds.h chunk3ds.h 3dsftkst.h mdata3ds.h xdata.h - - -KDATA3DS_DEP = 3dstype.h smartall.h 3dsfile.h 3dsrange.h 3dserr.h 3dsprim.h dbase3ds.h chunk3ds.h 3dsftkst.h kdata3ds.h xdata.h - - -3DSCAMR_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dscamr.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h chunk3ds.h xdata.h 3dsftkst.h 3dsutil.h - - -3DSCAMM_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h xdata.h 3dscamm.h dbase3ds.h 3dsfile.h 3dsrange.h kfutils.h - - -STRDUP_DEP = 3dstype.h smartall.h - - -DUMPSRC_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsmobj.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h chunk3ds.h xdata.h 3dsmatr.h dumpsrc.h - - -3DSASET_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsftkst.h chunk3ds.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h 3dsaset.h - - -3DSMSET_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsftkst.h chunk3ds.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h 3dsmset.h mdata3ds.h xdata.h - - -3DSBGND_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsbgnd.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h chunk3ds.h 3dsftkst.h - - -KFUTILS_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h xdata.h 3dscamm.h dbase3ds.h 3dsfile.h 3dsrange.h kfutils.h - - -3DSLITES_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h xdata.h 3dslites.h 3dsmset.h dbase3ds.h 3dsfile.h 3dsrange.h kfutils.h - - -3DSHIER_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h 3dshier.h dbase3ds.h kfutils.h 3dsfile.h 3dsrange.h xdata.h - - -SCANHDR_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h - - -3DSSPTM_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h xdata.h 3dssptm.h dbase3ds.h 3dsfile.h 3dsrange.h kfutils.h - - -3DSOMNM_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h xdata.h 3dssptm.h dbase3ds.h 3dsfile.h 3dsrange.h 3dsomnm.h kfutils.h - - -3DSAMBM_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h xdata.h 3dssptm.h dbase3ds.h 3dsfile.h 3dsrange.h 3dsambm.h kfutils.h - - -3DSVERS_DEP = 3dstype.h smartall.h dbase3ds.h 3dsfile.h 3dsrange.h 3dserr.h 3dsprim.h chunk3ds.h chunkinf.h 3dsftkst.h 3dsvers.h - - -3DSKEY_DEP = 3dstype.h smartall.h 3dsprim.h chunkinf.h 3dserr.h chunk3ds.h 3dsftkst.h xdata.h 3dscamm.h dbase3ds.h 3dsfile.h 3dsrange.h kfutils.h 3dskey.h - - -3DSMATX_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h chunk3ds.h chunkinf.h 3dsmobj.h dbase3ds.h 3dsfile.h 3dsrange.h xdata.h 3dsmatx.h - - -3DSBBOX_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h chunk3ds.h chunkinf.h 3dsmobj.h dbase3ds.h 3dsfile.h 3dsrange.h xdata.h 3dsobjm.h 3dsbbox.h - -3DSVPRT_DEP = 3dstype.h smartall.h 3dserr.h 3dsprim.h 3dsftkst.h chunk3ds.h chunkinf.h dbase3ds.h 3dsfile.h 3dsrange.h 3dsvprt.h - -SWAPBYTE_DEP = 3dstype.h smartall.h swapbyte.h - -3dsfile.$(OXT): 3dsfile.c $(3DSFILE_DEP) -dbase3ds.$(OXT): dbase3ds.c $(DBASE3DS_DEP) -chunk3ds.$(OXT): chunk3ds.c $(CHUNK3DS_DEP) -3dserr.$(OXT): 3dserr.c $(3DSERR_DEP) -3dsstrlf.$(OXT): 3dsstrlf.c $(3DSSTRLF_DEP) -seekchil.$(OXT): seekchil.c $(SEEKCHIL_DEP) -3dsprim.$(OXT): 3dsprim.c $(3DSPRIM_DEP) -makeswap.$(OXT): makeswap.c $(MAKESWAP_DEP) -smartall.$(OXT): smartall.c $(SMARTALL_DEP) -strcmpi.$(OXT): strcmpi.c $(STRCMPI_DEP) -3dsutil.$(OXT): 3dsutil.c $(3DSUTIL_DEP) -3dsiobj.$(OXT): 3dsiobj.c $(3DSIOBJ_DEP) -3dsrobj.$(OXT): 3dsrobj.c $(3DSROBJ_DEP) -3dsmatr.$(OXT): 3dsmatr.c $(3DSMATR_DEP) -dumpstr.$(OXT): dumpstr.c $(DUMPSTR_DEP) -3dsmobj.$(OXT): 3dsmobj.c $(3DSMOBJ_DEP) -3dsobjm.$(OXT): 3dsobjm.c $(3DSOBJM_DEP) -assert.$(OXT): assert.c $(ASSERT_DEP) -dumpchnk.$(OXT): dumpchnk.c $(DUMPCHNK_DEP) -xdata.$(OXT): xdata.c $(XDATA_DEP) -mdata3ds.$(OXT): mdata3ds.c $(MDATA3DS_DEP) -kdata3ds.$(OXT): kdata3ds.c $(KDATA3DS_DEP) -3dscamr.$(OXT): 3dscamr.c $(3DSCAMR_DEP) -3dscamm.$(OXT): 3dscamm.c $(3DSCAMM_DEP) -strdup.$(OXT): strdup.c $(STRDUP_DEP) -dumpsrc.$(OXT): dumpsrc.c $(DUMPSRC_DEP) -3dsaset.$(OXT): 3dsaset.c $(3DSASET_DEP) -3dsmset.$(OXT): 3dsmset.c $(3DSMSET_DEP) -3dsbgnd.$(OXT): 3dsbgnd.c $(3DSBGND_DEP) -kfutils.$(OXT): kfutils.c $(KFUTILS_DEP) -3dslites.$(OXT): 3dslites.c $(3DSLITES_DEP) -3dshier.$(OXT): 3dshier.c $(3DSHIER_DEP) -scanhdr.$(OXT): scanhdr.c $(SCANHDR_DEP) -3dssptm.$(OXT): 3dssptm.c $(3DSSPTM_DEP) -3dsomnm.$(OXT): 3dsomnm.c $(3DSOMNM_DEP) -3dsambm.$(OXT): 3dsambm.c $(3DSAMBM_DEP) -3dsvers.$(OXT): 3dsvers.c $(3DSVERS_DEP) -3dskey.$(OXT): 3dskey.c $(3DSKEY_DEP) -3dsmatx.$(OXT): 3dsmatx.c $(3DSMATX_DEP) -3dsbbox.$(OXT): 3dsbbox.c $(3DSBBOX_DEP) -3dsvprt.$(OXT): 3dsvprt.c $(3DSVPRT_DEP) - -swapbyte.$(OXT): swapbyte.c $(SWAPBYTE_DEP) diff --git a/3rdparty/3dsftk3/src/ftkhead.h b/3rdparty/3dsftk3/src/ftkhead.h deleted file mode 100644 index 57b71e8e..00000000 --- a/3rdparty/3dsftk3/src/ftkhead.h +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef FTK3DS_H -#define FTK3DS_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Note: Item's prefixed with a "Priv" comment are internally used, are not - part of the toolkit's published interface, and should not be used - by non-ftk library functions */ - diff --git a/3rdparty/3dsftk3/src/ftktail.h b/3rdparty/3dsftk3/src/ftktail.h deleted file mode 100644 index b5aa42e1..00000000 --- a/3rdparty/3dsftk3/src/ftktail.h +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/3rdparty/3dsftk3/src/kdata3ds.c b/3rdparty/3dsftk3/src/kdata3ds.c deleted file mode 100644 index 81c498be..00000000 --- a/3rdparty/3dsftk3/src/kdata3ds.c +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include - -#include "3dstype.h" -#include "3dsfile.h" -#include "dbase3ds.h" -#include "3dsftkst.h" -#include "kdata3ds.h" -#include "3dserr.h" - diff --git a/3rdparty/3dsftk3/src/kdata3ds.h b/3rdparty/3dsftk3/src/kdata3ds.h deleted file mode 100644 index 5a9bd6b1..00000000 --- a/3rdparty/3dsftk3/src/kdata3ds.h +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#include -#include -#include - -#include "3dstype.h" -#include "3dsfile.h" -#include "dbase3ds.h" -#include "3dsftkst.h" -#include "xdata.h" - - diff --git a/3rdparty/3dsftk3/src/kfutils.c b/3rdparty/3dsftk3/src/kfutils.c deleted file mode 100644 index a41d1bfc..00000000 --- a/3rdparty/3dsftk3/src/kfutils.c +++ /dev/null @@ -1,569 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include - -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "xdata.h" -#include "3dscamm.h" -#include "kfutils.h" - -/*--------------------------------------------------------------------------- - | kfPutNodeHeader - | Add a NODE_HDR chunk to the parent chunk - | - | Needs: parent stuff implemented - | - | flags1 - | NODE_UNUSED0 (1) - | NODE_UNUSED1 (1<<1) - | NODE_RENDOB_HIDE (1<<2) - | NODE_OFF (1<<3) - | ATKEY1 (1<<4) - | ATKEY2 (1<<5) - | ATKEY3 (1<<6) - | ATKEY4 (1<<7) - | ATKEY5 (1<<8) - | ATKEYFLAGS (ATKEY1|ATKEY2|ATKEY3|ATKEY4|ATKEY5) - | MARK_NODE (1<<9) - | DISABLE_NODE (1<<10) - | HIDE_NODE (1<<11) - | FAST_NODE (1<<12) draw node quikdraw style - | NODE_UNUSED13 (1<<13) - | PRIMARY_NODE (1<<14) corresponds to mesh - | NODE_CALC_PATH (1<<15) - | - | flags2: - | NODE_HAS_PATH (1) - | NODE_AUTO_SMOOTH (1<<1) - | NODE_FROZEN (1<<2) - | NODE_ANI_HIDDEN (1<<3) - | NODE_MOTION_BLUR (1<<4) - | NODE_BLUR_BRANCH (1<<5) - | NODE_MORPH_MTL (1<<6) - | NODE_MORPH_OB (1<<7) - | - +----------------------------------------------------------------------------*/ -void kfPutNodeHeader(char3ds *objname, - short3ds flags1, - short3ds flags2, - char3ds *parentname, - chunk3ds *pParentChunk) - -{ - chunk3ds *pHdrChunk; - NodeHdr *pNodeHdr; - - InitChunk3ds(&pHdrChunk); - pHdrChunk->tag = NODE_HDR; - pNodeHdr = InitChunkData3ds(pHdrChunk); - pNodeHdr->objname = strdup(objname); - pNodeHdr->flags1 = flags1; - pNodeHdr->flags2 = flags2; - pNodeHdr->parentindex = -1; - AddChildOrdered3ds(pParentChunk, pHdrChunk); - kfAddParentName(pHdrChunk, parentname); -} - - -/*---------------------------------------------------------------------------- - | kfPutNodeId - | put a NodeId into database as a child of parentChunk - | - +---------------------------------------------------------------------------*/ -void kfPutNodeId(chunk3ds *pParentChunk) -{ - chunk3ds *pIdChunk; - KFId *pId; - - InitChunk3ds(&pIdChunk); - pIdChunk->tag = NODE_ID; - pId = InitChunkData3ds(pIdChunk); - /*--- This is validated later */ - pId->id = -1; - AddChildOrdered3ds(pParentChunk, pIdChunk); -} - -/*---------------------------------------------------------------------------- - | kfPutGenericNode - | - | Put a tag into database as a child of parentChunk - | - +---------------------------------------------------------------------------*/ -chunk3ds * kfPutGenericNode(chunktag3ds tagId, chunk3ds *pParentChunk) -{ - chunk3ds *pGenericChunk; - - InitChunk3ds(&pGenericChunk); - ON_ERROR_RETURNR(NULL); - - pGenericChunk->tag = tagId; - AddChildOrdered3ds(pParentChunk, pGenericChunk); - return pGenericChunk; -} - -/*----------------------------------------------------------------------- - | kfPutPosTrack - | - | Put a position track into database - | - +----------------------------------------------------------------------*/ -void kfPutPosTrack(ulong3ds nKeys, /* Number of position keys */ - ushort3ds flag,/* Loop control flag for position keys */ - keyheader3ds *headers, /* Spline vals for keys */ - point3ds *pos, /* Position keys */ - chunk3ds *pParentChunk) -{ - chunk3ds *pPosChunk; - PosTrackTag *pPosTrack; - - if (nKeys<1 || !headers || !pos) - return; - - /*--- Create the POS_TRACK_TAG chunk */ - InitChunk3ds(&pPosChunk); - pPosChunk->tag = POS_TRACK_TAG; - pPosTrack = InitChunkData3ds(pPosChunk); - - /*--- pos tag header */ - pPosTrack->trackhdr.flags = flag; - pPosTrack->trackhdr.keycount = nKeys; - pPosTrack->trackhdr.nu1 = pPosTrack->trackhdr.nu2 = 0; /*--- Not Used */ - - /*--- Copy node headers */ - pPosTrack->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - /*--- Check for null pointer here later */ - memcpy(pPosTrack->keyhdrlist, headers, nKeys * sizeof(keyheader3ds)); - - /*--- POINTS */ - pPosTrack->positionlist = malloc(nKeys * sizeof(point3ds)); - /*--- Check for null pointer here later */ - memcpy(pPosTrack->positionlist, pos, nKeys * sizeof(point3ds)); - - AddChildOrdered3ds(pParentChunk, pPosChunk); -} - -/*----------------------------------------------------------------------- - | kfPutColorTrack - | - | Put a color track into database - | - | Needs: index of parent stuff - | - +----------------------------------------------------------------------*/ -void kfPutColorTrack(ulong3ds nKeys, /* Number of color keys */ - ushort3ds flag, /* Loop ctrl flag for color keys */ - keyheader3ds *headers, /* Spline values for color keys */ - fcolor3ds *colors, /* colors */ - chunk3ds *pParentChunk) -{ - chunk3ds *pColorChunk; - ColTrackTag *pColorTrack; - - if (nKeys<1 || !headers || !colors) - return; - - /*--- Create the COLOR_TRACK_TAG chunk */ - InitChunk3ds(&pColorChunk); - pColorChunk->tag = COL_TRACK_TAG; - pColorTrack = InitChunkData3ds(pColorChunk); - - /*--- Color tag header */ - pColorTrack->trackhdr.flags = flag; - pColorTrack->trackhdr.keycount = nKeys; - pColorTrack->trackhdr.nu1 = pColorTrack->trackhdr.nu2 = 0; /*--- Not Used */ - - /*--- Copy node headers */ - pColorTrack->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - /*--- Check for null pointer here later */ - memcpy(pColorTrack->keyhdrlist, headers, nKeys * sizeof(keyheader3ds)); - - /*--- COLORS */ - pColorTrack->colorlist = malloc(nKeys * sizeof(fcolor3ds)); - /*--- Check for null pointer here later */ - memcpy(pColorTrack->colorlist, colors, nKeys * sizeof(fcolor3ds)); - - /*--- Make if a child of the kframe node */ - AddChildOrdered3ds(pParentChunk, pColorChunk); -} - - -/*--------------------------------------------------------- - | kfPutTargetTrack - | Put a target track into database, this goes - | before the [CAMERA, LIGHT etc]_TRACK_TAG - | - *--------------------------------------------------------*/ -chunk3ds *kfPutTargetTrack( - char3ds *tparent, /* Name of parent object for target */ - ulong3ds nKeys, /* Number of target position keys */ - ushort3ds tflag, /* Loop ctrl flag for target position keys */ - keyheader3ds *headers, /* Spline values for target position keys */ - point3ds *pos, /* Target position keys */ - char3ds *pName, - short3ds flags1, /* flags 1 and 2 for header info */ - short3ds flags2, - targettype3ds target, /* LightTarget or CameraTarget */ - chunk3ds *pParentChunk) -{ - chunk3ds *pTargetChunk; - - - if (target == LightTarget) - pTargetChunk = kfPutGenericNode(L_TARGET_NODE_TAG, pParentChunk); - else /* (target == CameraTarget) */ - pTargetChunk = kfPutGenericNode(TARGET_NODE_TAG, pParentChunk); - - kfPutNodeId(pTargetChunk); - kfPutNodeHeader(pName, flags1, flags2, tparent, pTargetChunk); - kfPutPosTrack(nKeys, tflag, headers, pos, pTargetChunk); - - return pTargetChunk; -} - - -/*------------------------------------------------------------- - | kfFindNamedAndTaggedChunk - | - | Look through the keyframer stuff and find named chunk - | of the tag type tagId. - | - | Has to be a chunk that as a Node Header - | -CAMERA_NODE, LIGHT_NODE,,. - +--------------------------------------------------------------*/ -void kfFindNamedAndTaggedChunk(database3ds *db, /* dbase to be searched */ - const char3ds *name, /* name to search for */ - chunktag3ds tagId, /* tag to search for */ - chunk3ds **pChunk) /* return chunk here */ -{ - chunk3ds *pKfChunk, *pNodeHdrChunk, *cnode; - - if (db == NULL || name == NULL || pChunk == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - /*--- Find Keyframe chunk */ - FindChunk3ds(db->topchunk, KFDATA, &pKfChunk); - ON_ERROR_RETURN; - - /*--- Look for the target tag */ - *pChunk = NULL; - for (FindChunk3ds(pKfChunk, tagId, &cnode); - cnode != NULL; - FindNextChunk3ds(cnode->sibling, tagId, &cnode)) - { - FindNextChunk3ds(cnode->children, NODE_HDR, &pNodeHdrChunk); - if (pNodeHdrChunk != NULL){ - NodeHdr *pNodeHdr; - - ReadChunkData3ds(pNodeHdrChunk); - pNodeHdr = pNodeHdrChunk->data; - - /*--- Match name, set pointer */ - if (!strcmp(name, pNodeHdr->objname)){ - *pChunk = cnode; - FreeFileChunkData3ds(pNodeHdrChunk); - break; - } - FreeFileChunkData3ds(pNodeHdrChunk); - } - } -} - - -/*----------------------------------------------------------------------- - | kfPutRollTrack - | - | Put a camera roll track into database - | - | Needs: index of parent stuff - | - +----------------------------------------------------------------------*/ -void kfPutRollTrack(ulong3ds nKeys, - ushort3ds flag, - keyheader3ds *headers, - float3ds *roll, - chunk3ds *pParentChunk) -{ - chunk3ds *pRollChunk; - RollTrackTag *data; - - /*--- Create the ROLL_TRACK_TAG chunk */ - InitChunk3ds(&pRollChunk); - pRollChunk->tag = ROLL_TRACK_TAG; - data = InitChunkData3ds(pRollChunk); - - /*--- Initialize trackhdr field */ - data->trackhdr.flags = flag; - nKeys = data->trackhdr.keycount = nKeys; - data->trackhdr.nu1 = data->trackhdr.nu2 = (ushort3ds)0; /*--- Not used */ - - /*--- Copy headers */ - data->keyhdrlist = malloc(nKeys * sizeof(keyheader3ds)); - memcpy(data->keyhdrlist, - headers, - nKeys * sizeof(keyheader3ds)); - - /*--- Copy Points */ - data->rollanglelist = malloc(nKeys * sizeof(float3ds)); - memcpy(data->rollanglelist, roll, nKeys * sizeof(float3ds)); - - AddChildOrdered3ds(pParentChunk, pRollChunk); -} - -/*---------------------------------------------------------------------- - | - | kfExtractXdata - | make copy of a tags xdata, delete the tag and return the - | copy via pNewXdata - | - +-----------------------------------------------------------------------*/ -void kfExtractXdata(database3ds *db, - char3ds *name, /* name of node to search for */ - chunktag3ds tagId, /* tag to search for */ - chunk3ds **pNewXdata) -{ - chunk3ds *pDeadChunk, *pOldXdata; - - pDeadChunk = FindNodeTagByNameAndType3ds(db, name, tagId); - - if (pDeadChunk != NULL) - return; - - /*--- If the chunk exists, get xdata from it */ - FindChunk3ds(pDeadChunk, XDATA_SECTION, &pOldXdata); - if (pOldXdata) - CopyChunk3ds(pOldXdata, pNewXdata); - - DeleteChunk3ds(pDeadChunk); -} - -/*------------------------------------------------------------------- - | - | kfGetGenericNodeCount - | ID is CAMERA_NODE_TAG etc. - | - +-------------------------------------------------------------------*/ - -ulong3ds kfGetGenericNodeCount(database3ds *db, - chunktag3ds tagID) -{ - chunk3ds *current=NULL, *cnode=NULL; - ulong3ds nodecount = 0, i; - - UpdateNodeTagList3ds(db); - ON_ERROR_RETURNR(0); - - for (i = 0; i < db->nodelist->count; i++) - { - if (db->nodelist->list[i].chunk->tag == tagID) nodecount++; - } - - return nodecount; -} - -/*---------------------------------------------------------------------- - | - | kfGetGenericNodeNameList - | ID is CAMERA_NODE_TAG etc. - | - +---------------------------------------------------------------------*/ -void kfGetGenericNodeNameList(database3ds *db, - chunktag3ds tagID, - namelist3ds **list) -{ - chunk3ds *current=NULL; - ulong3ds nodecount = 0, i, j; - - if (db == NULL || list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - UpdateNodeTagList3ds(db); - ON_ERROR_RETURN; - - nodecount = kfGetGenericNodeCount(db, tagID); - - InitNameList3ds(list, nodecount); - - for (i = 0, j = 0; (i < db->nodelist->count) && (j < nodecount); i++) - { - if (db->nodelist->list[i].chunk->tag == tagID) - { - (*list)->list[j].name = strdup(db->nodelist->list[i].name); - j++; - } - } -} - -/*---------------------------------------------------------------------- - | - | kfAddGenericNodeXData - | ID is CAMERA_NODE_TAG etc. - | - +---------------------------------------------------------------------*/ -void kfAddGenericNodeXData(database3ds *db, - char3ds *objname, - char3ds *appname, - chunktag3ds tagID, - xdata3ds *data) -{ - chunk3ds *cnode; - - if (db == NULL || objname == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - kfFindNamedAndTaggedChunk(db, objname, tagID, &cnode); - /* AddXDataEntry3ds(cnode, appname, data);*/ -} - -/*----------------------------------------------------------------------- - | kfGetKfSeg - | - | All the keyframe information has to go in the appropriate segment, - | KFDATA - | - +------------------------------------------------------------------------*/ -void kfGetKfSeg(chunk3ds *pTopChunk, chunk3ds **pKData) -{ - chunk3ds *pChunk = NULL; - - /*--- Look for KFDATA */ - FindNextChunk3ds(pTopChunk->children, KFDATA, &pChunk); - if (pChunk == NULL) - pChunk = kfPutGenericNode(KFDATA, pTopChunk); - - *pKData = pChunk; -} - -/*----------------------------------------------------------------------- - | - | kfGetParentName - | - | Get Parent Name if there is one - | - +-----------------------------------------------------------------------*/ -void kfGetParentName(chunk3ds *pChunk, char3ds *pChar) -{ - chunk3ds *pNameChunk; - NamedObject *nObj; - - pChar[0] = 0; - FindChunk3ds(pChunk, PARENT_NAME, &pNameChunk); - if (pNameChunk == NULL) - return; - - nObj = ReadChunkData3ds(pNameChunk); - if (nObj == NULL) - return; - - if (nObj->name != 0 && nObj->name[0] != 0) - strcpy(pChar, nObj->name); - - FreeFileChunkData3ds(pNameChunk); -} - -void kfAddParentName(chunk3ds *pChunk, char3ds *pChar) -{ - chunk3ds *temp; - InstanceName *data; - - if (pChar == 0) - return; - - InitChunk3ds(&temp); - temp->tag = PARENT_NAME; - data = InitChunkData3ds(temp); - - data->name = strdup(pChar); - AddChildOrdered3ds(pChunk, temp); -} - diff --git a/3rdparty/3dsftk3/src/kfutils.h b/3rdparty/3dsftk3/src/kfutils.h deleted file mode 100644 index 5e1faf6f..00000000 --- a/3rdparty/3dsftk3/src/kfutils.h +++ /dev/null @@ -1,300 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/*----------------------------------------------------------- - | kfutils.h - | Header file for kfutils.c - | sjw 4/94 - *-----------------------------------------------------------*/ - -#ifndef KFUTILS_3DS_H -#define KFUTILS_3DS_H - -#include "3dstype.h" -#include "3dsprim.h" -#include "dbase3ds.h" -#include "xdata.h" -#include "chunk3ds.h" - -/* Public Consts */ -/* Flag settings for kfmesh3ds, kfomni3ds, kfcamera3ds, kfambient, and kfspot3ds */ - -/* For the flags field */ -static const ushort3ds KfNodeOff3ds = 1<<3; -static const ushort3ds KfHideNode3ds = 1<<11; -static const ushort3ds KfFastNode3ds = 1<<12; - -/* For the flags2 field */ -static const ushort3ds KfNodeHasPath3ds = 1; -static const ushort3ds KfNodeAutoSmooth3ds = 1<<1; -static const ushort3ds KfNodeFrozen3ds = 1<<2; -static const ushort3ds KfMotionBlur3ds = 1<<4; -static const ushort3ds KfBlurBranch3ds = 1<<5; -static const ushort3ds KfMorphMtl3ds = 1<<6; -static const ushort3ds KfMorphOb = 1<<7; - -typedef enum -{ - LightTarget, - CameraTarget -} targettype3ds; - -/* End Public */ - -/*--- Values for flags */ -#define NODE_RENDOB_HIDE (1<<2) -#define NODE_OFF (1<<3) -#define ATKEY1 (1<<4) -#define ATKEY2 (1<<5) -#define ATKEY3 (1<<6) -#define ATKEY4 (1<<7) -#define ATKEY5 (1<<8) -#define ATKEYFLAGS (ATKEY1|ATKEY2|ATKEY3|ATKEY4|ATKEY5) -#define MARK_NODE (1<<9) -#define DISABLE_NODE (1<<10) -#define HIDE_NODE (1<<11) -#define FAST_NODE (1<<12) /* draw node quikdraw style */ -#define PRIMARY_NODE (1<<14) /* corresponds to mesh */ -#define NODE_CALC_PATH (1<<15) - -/*--- Values for flags2 */ -#define NODE_HAS_PATH (1) -#define NODE_AUTO_SMOOTH (1<<1) -#define NODE_FROZEN (1<<2) -#define NODE_ANI_HIDDEN (1<<3) -#define NODE_MOTION_BLUR (1<<4) -#define NODE_BLUR_BRANCH (1<<5) -#define NODE_MORPH_MTL (1<<6) -#define NODE_MORPH_OB (1<<7) - -/*--- Routines for setting and clearing flags fields */ - -/*--- flags --------------------------------------------*/ -#define CHECK_NODE_RENDOB_HIDE(flag) (flag&NODE_RENDOB_HIDE) -#define CHECK_NODE_OFF(flag) (flag&NODE_OFF) -#define CHECK_ATKEY1(flag) (flag&ATKEY1) -#define CHECK_ATKEY2(flag) (flag&ATKEY2) -#define CHECK_ATKEY3(flag) (flag&ATKEY3) -#define CHECK_ATKEY4(flag) (flag&ATKEY4) -#define CHECK_ATKEY5(flag) (flag&ATKEY5) -#define CHECK_ATKEYFLAGS(flag) (flag&ATKEYFLAGS) -#define CHECK_MARK_NODE(flag) (flag&MARK_NODE) -#define CHECK_DISABLE_NODE(flag) (flag&DISABLE_NODE) -#define CHECK_HIDE_NODE(flag) (flag&HIDE_NODE) -#define CHECK_FAST_NODE(flag) (flag&FAST_NODE) -#define CHECK_PRIMARY_NODE(flag) (flag&PRIMARY_NODE) -#define CHECK_NODE_CALC_PATH(flag) (flag&NODE_CALC_PATH) - -#define SET_NODE_RENDOB_HIDE(flag) (flag|=NODE_RENDOB_HIDE) -#define SET_NODE_OFF(flag) (flag|=NODE_OFF) -#define SET_ATKEY1(flag) (flag|=ATKEY1) -#define SET_ATKEY2(flag) (flag|=ATKEY2) -#define SET_ATKEY3(flag) (flag|=ATKEY3) -#define SET_ATKEY4(flag) (flag|=ATKEY4) -#define SET_ATKEY5(flag) (flag|=ATKEY5) -#define SET_ATKEYFLAGS(flag) (flag|=ATKEYFLAGS) -#define SET_MARK_NODE(flag) (flag|=MARK_NODE) -#define SET_DISABLE_NODE(flag) (flag|=DISABLE_NODE) -#define SET_HIDE_NODE(flag) (flag|=HIDE_NODE) -#define SET_FAST_NODE(flag) (flag|=FAST_NODE) -#define SET_PRIMARY_NODE(flag) (flag|=PRIMARY_NODE) -#define SET_NODE_CALC_PATH(flag) (flag|=NODE_CALC_PATH) - -#define CLEAR_NODE_RENDOB_HIDE(flag) (flag&=~NODE_RENDOB_HIDE) -#define CLEAR_NODE_OFF(flag) (flag&=~NODE_OFF) -#define CLEAR_ATKEY1(flag) (flag&=~ATKEY1) -#define CLEAR_ATKEY2(flag) (flag&=~ATKEY2) -#define CLEAR_ATKEY3(flag) (flag&=~ATKEY3) -#define CLEAR_ATKEY4(flag) (flag&=~ATKEY4) -#define CLEAR_ATKEY5(flag) (flag&=~ATKEY5) -#define CLEAR_ATKEYFLAGS(flag) (flag&=~ATKEYFLAGS) -#define CLEAR_MARK_NODE(flag) (flag&=~MARK_NODE) -#define CLEAR_DISABLE_NODE(flag) (flag&=~DISABLE_NODE) -#define CLEAR_HIDE_NODE(flag) (flag&=~HIDE_NODE) -#define CLEAR_FAST_NODE(flag) (flag&=~FAST_NODE) -#define CLEAR_PRIMARY_NODE(flag) (flag&=~PRIMARY_NODE) -#define CLEAR_NODE_CALC_PATH(flag) (flag&=~NODE_CALC_PATH) - -/*--- flags2 ----------------------------------------------*/ -#define CHECK_HAS_PATH(flag) (flag&NODE_HAS_PATH) -#define CHECK_AUTO_SMOOTH(flag) (flag&NODE_AUTO_SMOOTH) -#define CHECK_FROZEN(flag) (flag&NODE_FROZEN) -#define CHECK_ANI_HIDDEN(flag) (flag&NODE_ANI_HIDDEN) -#define CHECK_MOTION_BLUR(flag) (flag&NODE_MOTION_BLUR) -#define CHECK_BLUR_BRANCH(flag) (flag&NODE_BLUR_BRANCH) -#define CHECK_MORPH_MATL(flag) (flag&NODE_MORPH_MATL) -#define CHECK_MORPH_OB(flag) (flag&NODE_MORPH_OB) - -#define SET_HAS_PATH(flag) (flag|=NODE_HAS_PATH) -#define SET_AUTO_SMOOTH(flag) (flag|=NODE_SMOOTH) -#define SET_FROZEN(flag) (flag|=NODE_FROZEN) -#define SET_ANI_HIDDEN(flag) (flag|=NODE_ANI_HIDDEN) -#define SET_MOTION_BLUR(flag) (flag|=NODE_MOTION_BLUR) -#define SET_BLUR_BRANCH(flag) (flag|=NODE_BLUR_BRANCH) -#define SET_MORPH_MATL(flag) (flag|=NODE_MORPH_MATL) -#define SET_MORPH_OB(flag) (flag|=NODE_MORPH_OB) - -#define CLEAR_HAS_PATH(flag) (flag&=~NODE_HAS_PATH) -#define CLEAR_AUTO_SMOOTH(flag) (flag&=~NODE_AUTO_SMOOTH) -#define CLEAR_FROZEN(flag) (flag&=~NODE_FROZEN) -#define CLEAR_ANI_HIDDEN(flag) (flag&=~NODE_ANI_HIDDEN) -#define CLEAR_MOTION_BLUR(flag) (flag&=~NODE_MOTION_BLUR) -#define CLEAR_BLUR_BRANCH(flag) (flag&=~NODE_BLUR_BRANCH) -#define CLEAR_MORPH_MATL(flag) (flag&=~NODE_MORPH_MATL) -#define CLEAR_MORPH_OB(flag) (flag&=~NODE_MORPH_OB) - -/*--- prototypes */ - -void kfPutNodeHeader(char3ds *objname, - short3ds flags1, - short3ds flags2, - char3ds *parentname, - chunk3ds *pParentChunk); - - -void kfPutNodeId(chunk3ds *pParentChunk); - -chunk3ds * kfPutGenericNode(chunktag3ds tagId, - chunk3ds *pParentChunk); - -void kfPutPosTrack(ulong3ds nKeys, - ushort3ds flag, - keyheader3ds *headers, - point3ds *pos, - chunk3ds *pParentChunk); - -chunk3ds *kfPutTargetTrack(char3ds *tparent, - ulong3ds nKeys, - ushort3ds tflag, - keyheader3ds *headers, - point3ds *pos, - char3ds *pName, - short3ds flags1, - short3ds flags2, - targettype3ds target, - chunk3ds *pParentChunk); - -void kfPutColorTrack(ulong3ds nKeys, - ushort3ds flag, - keyheader3ds *headers, - fcolor3ds *colors, - chunk3ds *pParentChunk); - -void kfFindNamedAndTaggedChunk(database3ds *db, - const char3ds *name, - chunktag3ds tagId, - chunk3ds **pChunk); - -void kfExtractXdata(database3ds *db, - char3ds *name, - chunktag3ds tagId, - chunk3ds **pNewXdata); - -void kfPutRollTrack(ulong3ds nKeys, - ushort3ds flag, - keyheader3ds *headers, - float3ds *roll, - chunk3ds *pParentChunk); - -ulong3ds kfGetGenericNodeCount(database3ds *db, - chunktag3ds tagID); - -void kfGetGenericNodeNameList(database3ds *db, - chunktag3ds tagID, - namelist3ds **list); - -void kfAddGenericNodeXData(database3ds *db, - char3ds *objname, - char3ds *appname, - chunktag3ds tagID, - xdata3ds *data); - -void kfAddParentName(chunk3ds *pChunk, char3ds *pChar); -void kfGetKfSeg(chunk3ds *pTopChunk, chunk3ds **pKSeg); -void kfGetParentName(chunk3ds *pChunk, char3ds *pChar); - - -#endif /* KFUTILS_3DS_H */ diff --git a/3rdparty/3dsftk3/src/makefile.vc4 b/3rdparty/3dsftk3/src/makefile.vc4 deleted file mode 100644 index 11ee21e8..00000000 --- a/3rdparty/3dsftk3/src/makefile.vc4 +++ /dev/null @@ -1,109 +0,0 @@ -# This make file was built to use Microsoft NMAKE and MSVC 4.x -# -######################################################## -# -# assumes set MSDEVDIR= -# - -.SILENT: - -#extension for object files -OXT = obj - -LIBDIR = ..\lib - -!ifdef DEBUG -LIBNAME = $(LIBDIR)\ftkvc40d.lib -!else -LIBNAME = $(LIBDIR)\ftkvc40.lib -!endif - -INC = ..\inc - -CFLAGS_D_LIB32 = /nologo /W4 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" -CFLAGS_R_LIB32 = /nologo /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" -LFLAGS_D_LIB32 = /nologo -LFLAGS_R_LIB32 = /nologo - -!ifdef DEBUG -CFLAGS = $(CFLAGS_D_LIB32) -LFLAGS = $(LFLAGS_D_LIB32) -!else -CFLAGS = $(CFLAGS_R_LIB32) -LFLAGS = $(LFLAGS_R_LIB32) -!endif - -CC = cl - -CPF = - -.c.obj: - set LIB=$(MSDEVDIR)\lib - set INCLUDE=$(MSDEVDIR)\include - $(CC) $(CFLAGS) /c $*.c $(CPF) - -.c.exe: - set LIB=$(MSDEVDIR)\lib - set INCLUDE=$(MSDEVDIR)\include - $(CC) $(CFLAGS) $*.c -link $(LFLAGS) - -IL = .\\ -AS = 386asmp $(AFLAGS) -APF = -NOLIST -TWOCASE -i $(IL) - -.asm.obj: - $(AS) $* $(APF) - -.obj.lib: - - - -######################################################## -## End Pretty much standard stuff -######################################################## - -all : $(LIBNAME) $(INC)/3dsftk.h - -clean : - -del *.obj - -del *.pdb - -del *.ilk - -del scanhdr.exe - -del makeswap.exe - -del swapbyte.c - -################################################# - -include ftkfiles.inc - -$(LIBNAME) : $(3DSOBJS) - if exist $@ del $@ - lib @<< /out:$(LIBNAME) -$(3DSOBJS) -<< - -$(INC)/3dsftk.h : $(LIBRARY_HEADERS) ftkhead.h ftktail.h scanhdr.exe - copy ftkhead.h $(INC)\3dsftk.h - !scanhdr -pub -priv -define @<< >>$(INC)\3dsftk.h -$** -<< - !scanhdr -pub -priv -typedef @<< >>$(INC)\3dsftk.h -$** -<< - !scanhdr -pub -priv -consts @<< >>$(INC)\3dsftk.h -$** -<< - !scanhdr -pub -priv -protos @<< >>$(INC)\3dsftk.h -$** -<< - type ftktail.h >>$(INC)\3dsftk.h - -scanhdr.exe: scanhdr.c $(LIBNAME) $(SCANHDR_DEP) - set lib=$(MSDEVDIR)\lib - set include=$(MSDEVDIR)\include - $(CC) $(CFLAGS) scanhdr.c $(LIBNAME) -link $(LFLAGS) - -swapbyte.c: makeswap.exe - makeswap.exe -makeswap.exe: makeswap.c $(MAKESWAP_DEP) - diff --git a/3rdparty/3dsftk3/src/makeswap.c b/3rdparty/3dsftk3/src/makeswap.c deleted file mode 100644 index 4bad18f7..00000000 --- a/3rdparty/3dsftk3/src/makeswap.c +++ /dev/null @@ -1,331 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - - -/* a routine that generates platform specific byte order swapping functions - by testing for the native processors byte order, and then writing c - source for conversion routines. This code is meant to be used during - the build process prior to compiling the core code that is using the - byte swapping routines. - - This code makes the assumption that longs are 4 byte integers, shorts - are 2 byte integers, floats are 4 byte floating point values, doubles - are 8 byte floating point values, and arrays of char3ds are one byte per - char3ds and byte alligned. This code also makes the assumption that - members of a union overlap each other. - -*/ - -#include -#include -#include "3dstype.h" - -typedef union { - long3ds l; - char3ds c[4]; - } TestLong; - -typedef union { - short3ds s; - char3ds c[2]; - } TestShort; - -typedef union { - float3ds f; - char3ds c[4]; - } TestFloat; - -typedef union { - double3ds d; - char3ds c[8]; -} TestDouble; - -#define SRCNAME "swapbyte.c" /* the name of the generated source file */ - -#define SRCPREAMBLE "/* this source was algorythmically generated by makeswap.c */\n\n#include \"3dstype.h\"\n#include \"swapbyte.h\"\n" - -#define LongValue 0x11223344 /* the compiler defined order */ -#define LByte0 0x44 /* the same value in intel order */ -#define LByte1 0x33 -#define LByte2 0x22 -#define LByte3 0x11 -#define LongSize3ds 8 - -#define ShortValue 0x1122 /* the compiler defined order */ -#define SByte0 0x22 /* the same value in intel order */ -#define SByte1 0x11 -#define ShortSize3ds 2 - -#define CharSize3ds 1 - -/* warning, I picked the floating point constant arbitrarily */ -#define FloatValue 1.12233E31F /* the compiler defined order */ -#define FByte0 0x70 /* the same value in intel order */ -#define FByte1 0xA8 -#define FByte2 0x0D -#define FByte3 0x73 -#define FloatSize3ds 4 - -#define DoubleValue 1.1223344556677E156 -#define DByte0 0x6A -#define DByte1 0x5A -#define DByte2 0xE1 -#define DByte3 0x22 -#define DByte4 0x48 -#define DByte5 0xED -#define DByte6 0x54 -#define DByte7 0x60 - -#define DoubleSize3ds 8 - -TestLong tlong; /* test variables */ -TestShort tshort; -TestFloat tfloat; -TestDouble tdouble; - -int longtab[4]; /* translation tables */ -int shorttab[2]; -int floattab[4]; -int doubletab[8]; - -FILE *newsource; - -void main () { - int i; - - /* initialize the test variables with magic numbers*/ - tlong.l = LongValue; - tshort.s = ShortValue; - tfloat.f = FloatValue; - tdouble.d = DoubleValue; - - for(i = 0; i < 8; i++) printf("tdouble.c[%i] = %x\n", i, ((unsigned int)tdouble.c[i] & 0xFF)); - - /* test for byte size */ - if (sizeof(long) != LongSize3ds) - { - fprintf(stdout, "ERROR: Native longs are not the same size as Intel longs."); - fprintf(stderr, "ERROR: Native longs are not the same size as Intel longs"); - exit(1); - } - if (sizeof(short) != ShortSize3ds) - { - fprintf(stdout, "ERROR: Native shorts are not the same size as Intel shorts."); - fprintf(stderr, "ERROR: Native shorts are not the same size as Intel shorts"); - exit(1); - } - if (sizeof(float) != FloatSize3ds) - { - fprintf(stdout, "ERROR: Native floats are not the same size as Intel floats."); - fprintf(stderr, "ERROR: Native floats are not the same size as Intel floats"); - exit(1); - } - if (sizeof(double) != DoubleSize3ds) - { - fprintf(stdout, "ERROR: Native doubles are not the same size as Intel doubles."); - fprintf(stderr, "ERROR: Native doubles are not the same size as Intel doubles"); - exit(1); - } - - - - /* build translation table for long3ds */ - for (longtab[0] = 0; longtab[0] < 4; longtab[0]++) if (tlong.c[longtab[0]] == LByte0) break; - for (longtab[1] = 0; longtab[1] < 4; longtab[1]++) if (tlong.c[longtab[1]] == LByte1) break; - for (longtab[2] = 0; longtab[2] < 4; longtab[2]++) if (tlong.c[longtab[2]] == LByte2) break; - for (longtab[3] = 0; longtab[3] < 4; longtab[3]++) if (tlong.c[longtab[3]] == LByte3) break; - - /* build translation table for short3ds */ - for (shorttab[0] = 0; shorttab[0] < 2; shorttab[0]++) if (tshort.c[shorttab[0]] == SByte0) break; - for (shorttab[1] = 0; shorttab[1] < 2; shorttab[1]++) if (tshort.c[shorttab[1]] == SByte1) break; - - /* build translation table for float3ds */ - for (floattab[0] = 0; floattab[0] < 4; floattab[0]++) if ((tfloat.c[floattab[0]] & 0xFF) == FByte0) break; - for (floattab[1] = 0; floattab[1] < 4; floattab[1]++) if ((tfloat.c[floattab[1]] & 0xFF) == FByte1) break; - for (floattab[2] = 0; floattab[2] < 4; floattab[2]++) if ((tfloat.c[floattab[2]] & 0xFF) == FByte2) break; - for (floattab[3] = 0; floattab[3] < 4; floattab[3]++) if ((tfloat.c[floattab[3]] & 0xFF) == FByte3) break; - - /* build translation table for double3ds */ - for (doubletab[0] = 0; doubletab[0] < 8; doubletab[0]++) if ((tdouble.c[doubletab[0]] & 0xFF) == DByte0) break; - for (doubletab[1] = 0; doubletab[1] < 8; doubletab[1]++) if ((tdouble.c[doubletab[1]] & 0xFF) == DByte1) break; - for (doubletab[2] = 0; doubletab[2] < 8; doubletab[2]++) if ((tdouble.c[doubletab[2]] & 0xFF) == DByte2) break; - for (doubletab[3] = 0; doubletab[3] < 8; doubletab[3]++) if ((tdouble.c[doubletab[3]] & 0xFF) == DByte3) break; - for (doubletab[4] = 0; doubletab[4] < 8; doubletab[4]++) if ((tdouble.c[doubletab[4]] & 0xFF) == DByte4) break; - for (doubletab[5] = 0; doubletab[5] < 8; doubletab[5]++) if ((tdouble.c[doubletab[5]] & 0xFF) == DByte5) break; - for (doubletab[6] = 0; doubletab[6] < 8; doubletab[6]++) if ((tdouble.c[doubletab[6]] & 0xFF) == DByte6) break; - for (doubletab[7] = 0; doubletab[7] < 8; doubletab[7]++) if ((tdouble.c[doubletab[7]] & 0xFF) == DByte7) break; - - newsource = fopen(SRCNAME, "wt"); - if (newsource != NULL) { - printf("Creating %s\n", SRCNAME); - fprintf(newsource, SRCPREAMBLE); - - fprintf(newsource, "void N2ILong3ds(void *native, void *intel)"); - fprintf(newsource, "{\n"); - /* If native is an intel byte order */ - if (longtab[0]==0 && longtab[1]==1 && longtab[2]==2 && longtab[3]==3) - { - fprintf(newsource, " *((unsigned long *)(intel)) = *((unsigned long *)(native));\n"); - } else { - for (i = 0; i < 4; i++) fprintf(newsource," ((byte3ds *)intel)[%i] = ((byte3ds *)native)[%i];\n", i, longtab[i]); - } - fprintf(newsource, "}\n\n"); - - fprintf(newsource, "void I2NLong3ds(void *intel, void *native)"); - fprintf(newsource, "{\n"); - if (longtab[0]==0 && longtab[1]==1 && longtab[2]==2 && longtab[3]==3) - { - fprintf(newsource, " *((unsigned long *)(native)) = *((unsigned long *)(intel));\n"); - } else { - for (i = 0; i < 4; i++) fprintf(newsource," ((byte3ds *)native)[%i] = ((byte3ds *)intel)[%i];\n", longtab[i], i); - } - fprintf(newsource, "}\n\n"); - - fprintf(newsource, "void N2IShort3ds(void *native, void *intel)"); - fprintf(newsource, "{\n"); - if (shorttab[0]==0 && shorttab[1]==1) - { - fprintf(newsource, " *((unsigned short *)(intel)) = *((unsigned short *)(native));\n"); - } else { - for (i = 0; i < 2; i++) fprintf(newsource," ((byte3ds *)intel)[%i] = ((byte3ds *)native)[%i];\n", i, shorttab[i]); - } - fprintf(newsource, "}\n\n"); - - fprintf(newsource, "void I2NShort3ds(void *intel, void *native)"); - fprintf(newsource, "{\n"); - if (shorttab[0]==0 && shorttab[1]==1) - { - fprintf(newsource, " *((unsigned short *)(native)) = *((unsigned short *)(intel));\n"); - } else { - for (i = 0; i < 2; i++) fprintf(newsource," ((byte3ds *)native)[%i] = ((byte3ds *)intel)[%i];\n", shorttab[i], i); - } - fprintf(newsource, "}\n\n"); - - fprintf(newsource, "void N2IFloat3ds(void *native, void *intel)"); - fprintf(newsource, "{\n"); - if (floattab[0]==0 && floattab[1]==1 && floattab[2]==2 && floattab[3]==3) - { - fprintf(newsource, " *((float *)(intel)) = *((float *)(native));\n"); - } else { - for (i = 0; i < 4; i++) fprintf(newsource," ((byte3ds *)intel)[%i] = ((byte3ds *)native)[%i];\n", i, floattab[i]); - } - fprintf(newsource, "}\n\n"); - - fprintf(newsource, "void I2NFloat3ds(void *intel, void *native)"); - fprintf(newsource, "{\n"); - if (floattab[0]==0 && floattab[1]==1 && floattab[2]==2 && floattab[3]==3) - { - fprintf(newsource, " *((float *)(native)) = *((float *)(intel));\n"); - } else { - for (i = 0; i < 4; i++) fprintf(newsource," ((byte3ds *)native)[%i] = ((byte3ds *)intel)[%i];\n", floattab[i], i); - } - fprintf(newsource, "}\n\n"); - - fprintf(newsource, "void N2IDouble3ds(void *native, void *intel)"); - fprintf(newsource, "{\n"); - if (doubletab[0]==0 && doubletab[1]==1 && doubletab[2]==2 && doubletab[3]==3 && doubletab[4]==4 && doubletab[5]==5 && doubletab[6]==6 && doubletab[7]==7) - { - fprintf(newsource, " *((double *)(intel)) = *((double *)(native));\n"); - } else { - for (i = 0; i < 8; i++) fprintf(newsource," ((byte3ds *)intel)[%i] = ((byte3ds *)native)[%i];\n", i, doubletab[i]); - } - fprintf(newsource, "}\n\n"); - - fprintf(newsource, "void I2NDouble3ds(void *intel, void *native)"); - fprintf(newsource, "{\n"); - if (doubletab[0]==0 && doubletab[1]==1 && doubletab[2]==2 && doubletab[3]==3 && doubletab[4]==4 && doubletab[5]==5 && doubletab[6]==6 && doubletab[7]==7) - { - fprintf(newsource, " *((double *)(native)) = *((double *)(intel));\n"); - } else { - for (i = 0; i < 8; i++) fprintf(newsource," ((byte3ds *)native)[%i] = ((byte3ds *)intel)[%i];\n", doubletab[i], i); - } - fprintf(newsource, "}\n\n"); - - fclose(newsource); - } - exit(0); -} diff --git a/3rdparty/3dsftk3/src/mdata3ds.c b/3rdparty/3dsftk3/src/mdata3ds.c deleted file mode 100644 index b341c4c1..00000000 --- a/3rdparty/3dsftk3/src/mdata3ds.c +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include - -#include "3dstype.h" -#include "3dsfile.h" -#include "dbase3ds.h" -#include "3dsftkst.h" -#include "mdata3ds.h" -#include "3dserr.h" - -void GetMeshSectionChunk3ds(database3ds *db, chunk3ds **mdata) -{ - myassert(db != NULL, "GetMeshSectionChunk3ds: arg *db cannot be NULL"); - myassert(mdata != NULL, "GetMeshSectionChunk3ds: arg **mdata cannot be NULL"); - - FindNextChunk3ds(db->topchunk->children, MDATA, mdata); - if (*mdata == NULL) - { - InitChunkAs3ds(mdata, MDATA); - ON_ERROR_RETURN; - - AddChildOrdered3ds(db->topchunk, *mdata); - ON_ERROR_RETURN; - } -} - diff --git a/3rdparty/3dsftk3/src/mdata3ds.h b/3rdparty/3dsftk3/src/mdata3ds.h deleted file mode 100644 index a6d3c0dc..00000000 --- a/3rdparty/3dsftk3/src/mdata3ds.h +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#include -#include - -#include "3dstype.h" -#include "3dsfile.h" -#include "dbase3ds.h" -#include "3dsftkst.h" -#include "xdata.h" - -#ifndef MDATA_3DS_H -#define MDATA_3DS_H - -void GetMeshSectionChunk3ds(database3ds *db, chunk3ds **mdata); - - -#endif diff --git a/3rdparty/3dsftk3/src/scanhdr.c b/3rdparty/3dsftk3/src/scanhdr.c deleted file mode 100644 index d95932d0..00000000 --- a/3rdparty/3dsftk3/src/scanhdr.c +++ /dev/null @@ -1,308 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "smartall.h" - -static void banner (char3ds *proc_name) -{ - char3ds *cp; - long3ds i; - - static const long3ds banner_size = 10; - static char3ds *banner_help[10] = - { - "headtype:", - " -pub = Only declarations marked public", - " -priv = Only declarations marked private", - "", - "dectype:", - " -typedef = Only type definitions", - " -consts = Only constants", - " -protos = Only prototypes", - " -define = Only #defines", - " -all = All of the above" - }; - - cp = strrchr(proc_name, '\\'); - fprintf(stdout, "Usage: %s -[headtype] -[dectype] @
...\n", (cp) ? ++cp : proc_name); - for(i = 0; i < banner_size; i++) - - { - fprintf(stdout, "%s\n", banner_help[i]); - } -} - - -/* Flags for things to scan */ -ubyte3ds gettypedef; -ubyte3ds getconsts; -ubyte3ds getprots; -ubyte3ds getdefs; -ubyte3ds getpriv; -ubyte3ds getpub; - -void scanfile(char3ds *fn) -{ - FILE *infile = NULL; - byte3ds emitlines = False3ds; - byte3ds emitplines = False3ds; - char3ds *buffer; - long3ds i; - - infile = fopen(fn, "rb"); - if (infile == NULL) return; - - buffer = malloc(16000); - if (buffer == NULL) return; - - while (fgets(buffer, 16000, infile)) - { - - for (i = 0; i < 1; i++) - { - if (getpub) - { - if (gettypedef) - if (strncmp("/* Public Typedefs */", buffer, 16 ) == 0) - {emitlines = True3ds; break;} - if (getconsts) - if (strncmp("/* Public Consts */", buffer, 16) == 0) - {emitlines = True3ds; break;} - if (getprots) - if (strncmp("/* Public Prototypes */", buffer, 16) == 0) - {emitlines = True3ds; break;} - if (getdefs) - if (strncmp("/* Public Defines */", buffer, 16) == 0) - {emitlines = True3ds; break;} - if (strncmp("/* End Public */", buffer, 12) == 0) - {emitlines = False3ds; break;} - } - if (getpriv) - { - if (gettypedef) - if (strncmp("/* Private Typedefs */", buffer, 16) == 0) - {emitplines = True3ds; break;} - if (getconsts) - if (strncmp("/* Private Consts */", buffer, 16) == 0) - {emitplines = True3ds; break;} - if (getprots) - if (strncmp("/* Private Prototypes */", buffer, 16) == 0) - {emitplines = True3ds; break;} - if (getdefs) - if (strncmp("/* Private Defines */", buffer, 16) == 0) - {emitplines = True3ds; break;} - if (strncmp("/* End Private */", buffer, 12) == 0) - {emitplines = False3ds; break;} - } - - if (emitlines) - fprintf(stdout, "%s", buffer); - if (emitplines) - { - if (buffer[0] == '\n' || buffer[0] == '\r') - fprintf(stdout, "%s", buffer); - else - fprintf(stdout, "/* Priv */ %s", buffer); - } - - } - } - - fclose(infile); - - free(buffer); -} - -void main(int argc, char3ds *argv[]) -{ - - gettypedef = False3ds; - getconsts = False3ds; - getprots = False3ds; - getdefs = False3ds; - getpriv = False3ds; - getpub = False3ds; - - if (argc > 1) - { - long3ds i; - - /* Scan for options and filenames */ - for (i = 1; i < argc; i++) - { - switch(argv[i][0]) - { - case '-': /* "-*" */ - switch(argv[i][1]) - { - case 'p': /* "-p*" */ - switch(argv[i][2]) - { - case 'u': /* "-pub" */ - getpub = True3ds; - break; - case 'r': /* "-pr*" */ - switch(argv[i][3]) - { - case 'i': - getpriv = True3ds; - break; - case 'o': - getprots = True3ds; - } - break; - } - break; - case 't': /* '-t*' */ - gettypedef = True3ds; - break; - case 'c': - getconsts = True3ds; - break; - case 'd': - getdefs = True3ds; - break; - case 'a': - gettypedef = getconsts = getprots = getdefs = True3ds; - break; - } - break; - case '@': /* list of files */ - { - char3ds *c; - char3ds *filename; - const char3ds *delimiters = " \r\n\t"; - - FILE *f; - - c = argv[i]+1; - f = fopen(c, "rb"); - if (f == NULL) break; - filename = malloc(16000); - if (filename == NULL) break; - - while(fgets(filename, 16000, f)) - { - char *tok; - for(tok = strtok(filename, delimiters); tok != NULL; tok = strtok(NULL, delimiters)) - { - /* scan the file */ - scanfile(tok); - } - } - - fclose(f); - break; - } - - default: - scanfile(argv[i]); - break; - } - } - - } else - banner(argv[0]); - - exit(0); -} - - - - - - - - - - - diff --git a/3rdparty/3dsftk3/src/seekchil.c b/3rdparty/3dsftk3/src/seekchil.c deleted file mode 100644 index 0190611c..00000000 --- a/3rdparty/3dsftk3/src/seekchil.c +++ /dev/null @@ -1,363 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dserr.h" -#include "3dsfile.h" -#include "chunkinf.h" -#include "3dsftkst.h" -#include "3dsrange.h" -#include "seekchil.h" -#include "chunk3ds.h" - -/* Function skips to next chunk on disk by seeking the next file position */ - -void SeekChild3ds(chunk3ds *chunk) -{ - long3ds offset=0; - char3ds dummy[50]; - - switch(chunk->tag) - { - case M3DMAGIC: - case SMAGIC: - case LMAGIC: - case MATMAGIC: - case MLIBMAGIC: - case MDATA: - case AMBIENT_LIGHT: - case SOLID_BGND: - case DEFAULT_VIEW: - case MAT_ENTRY: - case MAT_AMBIENT: - case MAT_DIFFUSE: - case MAT_SPECULAR: - case MAT_SHININESS: - case MAT_SHIN2PCT: - case MAT_SHIN3PCT: - case MAT_TRANSPARENCY: - case MAT_XPFALL: - case MAT_REFBLUR: - case MAT_SELF_ILPCT: - case MAT_TEXMAP: - case MAT_TEXMASK: - case MAT_TEX2MAP: - case MAT_TEX2MASK: - case MAT_OPACMAP: - case MAT_OPACMASK: - case MAT_REFLMAP: - case MAT_REFLMASK: - case MAT_BUMPMAP: - case MAT_BUMPMASK: - case MAT_SPECMAP: - case MAT_SPECMASK: - case MAT_SHINMAP: - case MAT_SHINMASK: - case MAT_SELFIMAP: - case MAT_SELFIMASK: - case N_TRI_OBJECT: - case XDATA_SECTION: - case XDATA_ENTRY: - case KFDATA: - case OBJECT_NODE_TAG: - case CAMERA_NODE_TAG: - case TARGET_NODE_TAG: - case LIGHT_NODE_TAG: - case SPOTLIGHT_NODE_TAG: - case L_TARGET_NODE_TAG: - case AMBIENT_NODE_TAG: - case CMAGIC: - break; - case M3D_VERSION: - offset = LongSize3ds; - break; - case COLOR_F: - offset = 3*(FloatSize3ds); - break; - case COLOR_24: - offset = 3*(ByteSize3ds); - break; - case INT_PERCENTAGE: - offset = ShortSize3ds; - break; - case FLOAT_PERCENTAGE: - offset = FloatSize3ds; - break; - case MAT_MAPNAME: - ReadString3ds(dummy, MatMapNameStrMax3ds + 1); - break; - case MESH_VERSION: - offset = LongSize3ds; - break; - case MASTER_SCALE: - offset = FloatSize3ds; - break; - case LO_SHADOW_BIAS: - offset = FloatSize3ds; - break; - case HI_SHADOW_BIAS: - offset = FloatSize3ds; - break; - case SHADOW_MAP_SIZE: - offset = ShortSize3ds; - break; - case SHADOW_SAMPLES: - offset = ShortSize3ds; - break; - case O_CONSTS: - offset = PointSize3ds; - break; - case V_GRADIENT: - offset = FloatSize3ds; - break; - case NAMED_OBJECT: - ReadString3ds(dummy, NamedObjectStrMax3ds + 1); - break; - case BIT_MAP: - ReadString3ds(dummy, BitMapStrMax3ds + 1); - break; - case FOG: - offset = 4*(FloatSize3ds); - break; - case LAYER_FOG: - offset = 3*(FloatSize3ds)+LongSize3ds; - break; - case DISTANCE_CUE: - offset = 4*(FloatSize3ds); - break; - case N_DIRECT_LIGHT: - offset = PointSize3ds; - break; - case DL_SPOTLIGHT: - offset = PointSize3ds + 2*(FloatSize3ds); - break; - case N_CAMERA: - offset = 2*(PointSize3ds) + 2*(FloatSize3ds); - break; - case VIEWPORT_LAYOUT: - offset = 7*ShortSize3ds; - break; - case VIEW_TOP: - case VIEW_BOTTOM: - case VIEW_LEFT: - case VIEW_RIGHT: - case VIEW_FRONT: - case VIEW_BACK: - offset = PointSize3ds + FloatSize3ds; - break; - case VIEW_USER: - offset = PointSize3ds + 4*(FloatSize3ds); - break; - case VIEW_CAMERA: - ReadString3ds(dummy, ViewCameraStrMax3ds + 1); - break; - case MAT_NAME: - ReadString3ds(dummy, MatNameStrMax3ds + 1); - break; - case MAT_ACUBIC: - offset = 2*(ByteSize3ds) + 2*(LongSize3ds) + ShortSize3ds; - break; - case POINT_ARRAY: - case POINT_FLAG_ARRAY: - offset = chunk->size - 6; - break; - case FACE_ARRAY: - { - ushort3ds faces; - faces = ReadUShort3ds(); - offset = faces * ShortSize3ds * 4; - break; - } - case MSH_MAT_GROUP: - offset = chunk->size - 6; - break; - case SMOOTH_GROUP: - offset = chunk->size - 6; - break; - case TEX_VERTS: - offset = chunk->size - 6; - break; - case MESH_MATRIX: - offset = 12*(FloatSize3ds); - break; - case MESH_TEXTURE_INFO: - offset = chunk->size - 6; - break; - case PROC_NAME: - ReadString3ds(dummy, ProcNameStrMax3ds + 1); - break; - case DL_LOCAL_SHADOW2: - offset = 2*(FloatSize3ds) + ShortSize3ds; - break; - case KFHDR: - ReadShort3ds(); - ReadString3ds(dummy, FileNameStrMax3ds + 1); - ReadLong3ds(); - break; - case KFSEG: - offset = 2*(LongSize3ds); - break; - case KFCURTIME: - offset = LongSize3ds; - break; - case NODE_HDR: - ReadString3ds(dummy, NodeHdrStrMax3ds + 1); - offset = 2*(ShortSize3ds) + ShortSize3ds; - break; - case NODE_ID: - offset = ShortSize3ds; - break; - case PIVOT: - offset = PointSize3ds; - break; - case INSTANCE_NAME: - ReadString3ds(dummy, InstanceNameStrMax3ds + 1); - break; - case MORPH_SMOOTH: - offset = FloatSize3ds; - break; - case BOUNDBOX: - offset = 2*PointSize3ds; - break; - case MAT_SXP_TEXT_DATA: - case MAT_SXP_TEXT2_DATA: - case MAT_SXP_OPAC_DATA: - case MAT_SXP_BUMP_DATA: - case MAT_SXP_SPEC_DATA: - case MAT_SXP_SHIN_DATA: - case MAT_SXP_SELFI_DATA: - case MAT_SXP_TEXT_MASKDATA: - case MAT_SXP_TEXT2_MASKDATA: - case MAT_SXP_OPAC_MASKDATA: - case MAT_SXP_BUMP_MASKDATA: - case MAT_SXP_SPEC_MASKDATA: - case MAT_SXP_SHIN_MASKDATA: - case MAT_SXP_SELFI_MASKDATA: - case MAT_SXP_REFL_MASKDATA: - case PROC_DATA: - offset = (chunk->size - 6); - break; - case POS_TRACK_TAG: - offset = (chunk->size - 6); - break; - case COL_TRACK_TAG: - offset = (chunk->size - 6); - break; - case ROT_TRACK_TAG: - offset = (chunk->size - 6); - break; - case SCL_TRACK_TAG: - offset = (chunk->size - 6); - break; - case MORPH_TRACK_TAG: - offset = (chunk->size - 6); - break; - case FOV_TRACK_TAG: - offset = (chunk->size - 6); - break; - case ROLL_TRACK_TAG: - offset = (chunk->size - 6); - break; - case HOT_TRACK_TAG: - offset = (chunk->size - 6); - break; - case FALL_TRACK_TAG: - offset = (chunk->size - 6); - break; - case VPDATA: - offset = LongSize3ds; - break; - default: - offset = chunk->size - 6; - break; - } - FileSeek3ds(GetFilePosition3ds()+offset); - -} - diff --git a/3rdparty/3dsftk3/src/seekchil.h b/3rdparty/3dsftk3/src/seekchil.h deleted file mode 100644 index ba6a6fa1..00000000 --- a/3rdparty/3dsftk3/src/seekchil.h +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef SEEKCHIL_H -#define SEEKCHIL_H - -#include -#include "3dstype.h" -#include "3dsprim.h" -#include "3dsftkst.h" -#include "chunk3ds.h" - -void SeekChild3ds(chunk3ds *tag); - -#endif diff --git a/3rdparty/3dsftk3/src/smartall.c b/3rdparty/3dsftk3/src/smartall.c deleted file mode 100644 index db8fbfb5..00000000 --- a/3rdparty/3dsftk3/src/smartall.c +++ /dev/null @@ -1,515 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* - - Smart memory allocator - - Evolved over several years, starting with the initial SMARTALLOC - code for AutoSketch in 1986, guided by the Blind Watchbreaker, - John Walker. Isolated in this general-purpose form in September - of 1989. - -*/ - -#include -#include -#include - -#ifndef NDEBUG -void assertfunc(int ex, char *msg, char *file, int line); -#define _myassert(ex, msg) assertfunc((ex), msg, __FILE__, __LINE__) -#define myassert(ex, msg) _myassert(ex, msg) -#else -#define _myassert(ex, msg) -#define myassert(ex,msg) -#endif - -/*LINTLIBRARY*/ -#ifdef lint -#include -extern char *sprintf(); -#endif - -#ifdef SMARTALLOC - -typedef enum {False = 0, True = 1} Boolean; -typedef unsigned short ushort; - -void sm_free(void *fp); -void *sm_malloc(const char *fname, int lineno, unsigned int nbytes); -void *sm_calloc(const char *fname, int lineno, unsigned int nelem, unsigned int elsize); -void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size); -void *actuallymalloc(unsigned int size); -void *actuallycalloc(unsigned int nelem, unsigned int elsize); -void *actuallyrealloc(void *ptr, unsigned int size); -void actuallyfree(void *cp); -void sm_tag(char *tag); -void sm_untag(); -void sm_dump(Boolean bufdump); -void sm_static(int mode); - - -#define EOS '\0' /* End of string sentinel */ -#define V (void) - -#ifdef min -#undef min -#endif - -#define min(a,b) ((a)<(b) ? (a) : (b)) - -/* Queue data structures */ - -/* General purpose queue */ - -typedef struct queue { - struct queue *qnext, /* Next item in queue */ - *qprev; /* Previous item in queue */ -} queue; - -/* Memory allocation control structures and storage. */ - -typedef struct { - queue abq; /* Links on allocated queue */ - unsigned ablen; /* Buffer length in bytes */ - const char *abfname; /* File name pointer */ - char *abtag; /* Comment tag */ - ushort ablineno; /* Line number of allocation */ -} abufhead; - -static queue abqueue = { /* Allocated buffer queue */ - &abqueue, &abqueue -}; - -static Boolean bufimode = False; /* Buffers not tracked when True */ - -/* Queue functions */ - -static void qinsert(); -static queue *qdchain(); - - -static const abtagstacksize = 40; -static int abtagstackpos = 0; -static char* abtagstack[40] = {NULL}; - - -/* SMALLOC -- Allocate buffer, enqueing on the orphaned buffer - tracking list. */ - -static void *smalloc(const char *fname, int lineno, unsigned nbytes) -{ - char *buf; - - /* Note: Unix MALLOC actually permits a zero length to be - passed and allocates a valid block with zero user bytes. - Such a block can later be expanded with realloc(). We - disallow this based on the belief that it's better to make - a special case and allocate one byte in the rare case this - is desired than to miss all the erroneous occurrences where - buffer length calculation code results in a zero. */ - - nbytes += sizeof(abufhead) + 1; - if ((buf = malloc(nbytes)) != NULL) { - /* Enqueue buffer on allocated list */ - qinsert(&abqueue, (queue *) buf); - ((abufhead *) buf)->ablen = nbytes; - ((abufhead *) buf)->abtag = abtagstack[abtagstackpos]; - ((abufhead *) buf)->abfname = bufimode ? NULL : fname; - ((abufhead *) buf)->ablineno = lineno; - /* Emplace end-clobber detector at end of buffer */ - buf[nbytes - 1] = (((long) buf) & 0xFF) ^ 0xC5; - buf += sizeof(abufhead); /* Increment to user data start */ - } - return buf; -} - -/* SM_FREE -- Update free pool availability. FREE is never called - except through this interface or by actuallyfree(). - free(x) is defined to generate a call to this - routine. */ - -void sm_free(void *fp) -{ - queue *qp; - char *cp = fp; - - if (cp == NULL) return; /* this is acceptable behavior for now */ - - myassert(cp != NULL, "sm_free: cannot release a NULL buffer"); /* Better not release a null buffer, guy! */ - - cp -= sizeof(abufhead); - qp = (queue *) cp; - - /* The following assertions will catch virtually every release - of an address which isn't an allocated buffer. */ - - myassert(qp->qnext->qprev == qp, "sm_free: cannot release an invalid pointer"); /* Validate queue links */ - myassert(qp->qprev->qnext == qp, "sm_free: cannot release an invalid poitner"); - - /* The following assertion detects storing off the end of the - allocated space in the buffer by comparing the end of buffer - checksum with the address of the buffer. */ - - myassert(((unsigned char *) cp)[((abufhead *) cp)->ablen - 1] == - ((((long) cp) & 0xFF) ^ 0xC5), "sm_free: freed memory buffer overwrote allocated boundries"); - - V qdchain(qp); - - /* Now we wipe the contents of the just-released buffer with - "designer garbage" (Duff Kurland's phrase) of alternating - bits. This is intended to ruin the day for any miscreant who - attempts to access data through a pointer into storage that's - been previously released. */ - - V memset(cp, 0xAA, (int) ((abufhead *) cp)->ablen); - - free(cp); -} - -/* SM_MALLOC -- Allocate buffer. NULL is returned if no memory - was available. */ - -void *sm_malloc(const char *fname, int lineno, unsigned int nbytes) -{ - char *buf; - - if ((buf = smalloc(fname, lineno, nbytes)) != NULL) { - - /* To catch sloppy code that assumes buffers obtained from - malloc() are zeroed, we preset the buffer contents to - "designer garbage" consisting of alternating bits. */ - - V memset(buf, 0x55, (int) nbytes); - } - return buf; -} - -/* SM_CALLOC -- Allocate an array and clear it to zero. */ - -void *sm_calloc(const char *fname, int lineno, unsigned int nelem, unsigned int elsize) -{ - char *buf; - - if ((buf = smalloc(fname, lineno, nelem * elsize)) != NULL) { - V memset(buf, 0, (int) (nelem * elsize)); - } - return buf; -} - -/* SM_REALLOC -- Adjust the size of a previously allocated buffer. - Note that the trick of "resurrecting" a previously - freed buffer with realloc() is NOT supported by this - function. Further, because of the need to maintain - our control storage, SM_REALLOC must always allocate - a new block and copy the data in the old block. - This may result in programs which make heavy use of - realloc() running much slower than normally. */ - -void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size) -{ - unsigned osize; - char *buf; - - myassert(size > 0, "sm_realloc: must realloc more than 0 bytes"); - - /* If the old block pointer is NULL, treat realloc() as a - malloc(). SVID is silent on this, but many C libraries - permit this. */ - - if (ptr == NULL) - return sm_malloc(fname, lineno, size); - - /* If the old and new sizes are the same, be a nice guy and just - return the buffer passed in. */ - - osize = ((abufhead *) ptr)->ablen - - (sizeof(abufhead) + 1); - if (size == osize) { - return ptr; - } - - /* Sizes differ. Allocate a new buffer of the requested size. - If we can't obtain such a buffer, act as defined in SVID: - return NULL from realloc() and leave the buffer in PTR - intact. */ - - if ((buf = smalloc(fname, lineno, size)) != NULL) { - V memcpy(buf, ptr, (int) min(size, osize)); - /* If the new buffer is larger than the old, fill the balance - of it with "designer garbage". */ - if (size > osize) { - V memset(buf + osize, 0x55, (int) (size - osize)); - } - - /* All done. Free and dechain the original buffer. */ - - sm_free(ptr); - } - return buf; -} - -/* ACTUALLYMALLOC -- Call the system malloc() function to obtain - storage which will eventually be released - by system or library routines not compiled - using SMARTALLOC. */ - -void *actuallymalloc(unsigned int size) -{ - return malloc(size); -} - -/* ACTUALLYCALLOC -- Call the system calloc() function to obtain - storage which will eventually be released - by system or library routines not compiled - using SMARTALLOC. */ - -void *actuallycalloc(unsigned int nelem, unsigned int elsize) -{ - return calloc(nelem, elsize); -} - -/* ACTUALLYREALLOC -- Call the system realloc() function to obtain - storage which will eventually be released - by system or library routines not compiled - using SMARTALLOC. */ - -void *actuallyrealloc(void *ptr, unsigned int size) -{ - return realloc(ptr, size); -} - -/* ACTUALLYFREE -- Interface to system free() function to release - buffers allocated by low-level routines. */ - -void actuallyfree(void *cp) -{ - free(cp); -} - -void sm_tag(char *tag) -{ - if (abtagstackpos+1 < abtagstacksize) - { - abtagstackpos++; - } - - abtagstack[abtagstackpos] = tag; -} - -void sm_untag() -{ - abtagstack[abtagstackpos] = NULL; - - if (abtagstackpos > 0) abtagstackpos--; -} - -/* SM_DUMP -- Print orphaned buffers (and dump them if BUFDUMP is - True). */ - -void sm_dump(Boolean bufdump) -{ - abufhead *ap = (abufhead *) abqueue.qnext; - - while (ap != (abufhead *) &abqueue) { - - if ((ap == NULL) || - (ap->abq.qnext->qprev != (queue *) ap) || - (ap->abq.qprev->qnext != (queue *) ap)) { - V fprintf(stderr, - "\nOrphaned buffers exist. Dump terminated following\n"); - V fprintf(stderr, - " discovery of bad links in chain of orphaned buffers.\n"); - V fprintf(stderr, - " Buffer address with bad links: %lx\n", (long) ap); - break; - } - - if (ap->abfname != NULL) { - unsigned memsize = ap->ablen - (sizeof(abufhead) + 1); - char errmsg[120]; - - if (ap->abtag != NULL) - { - V sprintf(errmsg, - "Orphaned buffer: %6u bytes allocated at line %d of %s with tag %s\n", - memsize, ap->ablineno, ap->abfname, ap->abtag - ); - } - else - { - V sprintf(errmsg, - "Orphaned buffer: %6u bytes allocated at line %d of %s\n", - memsize, ap->ablineno, ap->abfname - ); - } - - V fprintf(stderr, "%s", errmsg); - if (bufdump) { - unsigned llen = 0; - char *cp = ((char *) ap) + sizeof(abufhead); - - errmsg[0] = EOS; - while (memsize) { - if (llen >= 16) { - V strcat(errmsg, "\n"); - llen = 0; - V fprintf(stderr, "%s", errmsg); - errmsg[0] = EOS; - } - V sprintf(errmsg + strlen(errmsg), " %02X", - (*cp++) & 0xFF); - llen++; - memsize--; - } - V fprintf(stderr, "%s\n", errmsg); - } - } - ap = (abufhead *) ap->abq.qnext; - } -} - -/* SM_STATIC -- Orphaned buffer detection can be disabled (for such - items as buffers allocated during initialisation) by - calling sm_static(1). Normal orphaned buffer - detection can be re-enabled with sm_static(0). Note - that all the other safeguards still apply to buffers - allocated when sm_static(1) mode is in effect. */ - -void sm_static(int mode) -{ - bufimode = (Boolean) (mode != 0); -} - -/* Queue manipulation functions. */ - - -/* QINSERT -- Insert object at end of queue */ - -static void qinsert(queue *qhead, queue *object) -{ - myassert(qhead->qprev->qnext == qhead || qhead->qnext->qprev == qhead, - "qinsert: allocation structure is bad or corrupt"); - - /* qinsert: alloc struct is bad */ - - object->qnext = qhead; - object->qprev = qhead->qprev; - qhead->qprev = object; - object->qprev->qnext = object; -} - - -/* QREMOVE -- Remove object from queue. Returns NULL if queue empty */ - -static queue *qremove(queue *qhead) -{ - queue *object; - - myassert(qhead->qprev->qnext == qhead, "qremove: allocation structure is bad or corrupt"); - myassert(qhead->qnext->qprev == qhead, "qremove: allocation structure is bad or corrupt"); - - if ((object = qhead->qnext) == qhead) - return NULL; - qhead->qnext = object->qnext; - object->qnext->qprev = qhead; - return object; -} - - -/* QDCHAIN -- Dequeue an item from the middle of a queue. Passed - the queue item, returns the (now dechained) queue item. */ - -static queue *qdchain(queue *qitem) -{ - myassert(qitem->qprev->qnext == qitem, "gdchain: allocation structure is bad or corrupt"); - myassert(qitem->qnext->qprev == qitem, "qdchain: allocation structure is bad or corrupt"); - - return qremove(qitem->qprev); -} -#endif diff --git a/3rdparty/3dsftk3/src/smartall.h b/3rdparty/3dsftk3/src/smartall.h deleted file mode 100644 index ed63cb53..00000000 --- a/3rdparty/3dsftk3/src/smartall.h +++ /dev/null @@ -1,142 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef SMARTALL_H -#define SMARTALL_H -/* - - Definitions for the smart memory allocator - -*/ - -#ifdef SMARTALLOC - -typedef enum {False = 0, True = 1} Boolean; -typedef unsigned short ushort; - -void sm_free(void *fp); -void *sm_malloc(const char *fname, int lineno, unsigned long nbytes); -void *sm_calloc(const char *fname, int lineno, unsigned long nelem, unsigned long elsize); -void *sm_realloc(const char *fname, int lineno, void *ptr, unsigned long size); -void *actuallymalloc(unsigned long size); -void *actuallycalloc(unsigned long nelem, unsigned long elsize); -void *actuallyrealloc(void *ptr, unsigned long size); -void actuallyfree(void *cp); -void sm_tag(char *tag); -void sm_untag(); -void sm_dump(Boolean bufdump); -void sm_static(int mode); - - -/* Redefine standard memory allocator calls to use our routines - instead. */ - -#define free sm_free -#define cfree sm_free -#define malloc(x) sm_malloc(__FILE__, __LINE__, (x)) -#define calloc(n,e) sm_calloc(__FILE__, __LINE__, (n), (e)) -#define realloc(p,x) sm_realloc(__FILE__, __LINE__, (p), (x)) - -#else - -/* extern void *malloc(), *calloc(), *realloc(); -extern void free(); -*/ - -/* If SMARTALLOC is disabled, define its special calls to default to - the standard routines. */ - -#define actuallyfree(x) free(x) -#define actuallymalloc(x) malloc(x) -#define actuallycalloc(x,y) calloc(x,y) -#define actuallyrealloc(x,y) realloc(x,y) -#define sm_dump(x) -#define sm_static(x) -#define sm_tag(x) -#define sm_untag() -#endif - -#endif /* SMARTALL_H */ diff --git a/3rdparty/3dsftk3/src/strcmpi.c b/3rdparty/3dsftk3/src/strcmpi.c deleted file mode 100644 index 9984d2b7..00000000 --- a/3rdparty/3dsftk3/src/strcmpi.c +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -/* A home brew case insensitive string compare for those few platforms that - don't have them in thier standard libraries. -*/ - -#include -#include "3dstype.h" -#include "strcmpi.h" - -int strcmpi(char3ds *s1, char3ds *s2) -{ - char3ds *a1, *a2, c1, c2; - a1 = s1; - a2 = s2; - - for (;;) - { - c1 = (char3ds)tolower(*a1); c2 = (char3ds)tolower(*a2); - if ((c1 == 0) && (c2 == 0)) return(0); - if (c1 < c2) return(-1); - if (c1 > c2) return(1); - a1++; a2++; - } -} diff --git a/3rdparty/3dsftk3/src/strcmpi.h b/3rdparty/3dsftk3/src/strcmpi.h deleted file mode 100644 index 4829d57d..00000000 --- a/3rdparty/3dsftk3/src/strcmpi.h +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -/* A home brew case insensitive string compare for those few platforms that - don't have them in thier standard libraries. -*/ - -#ifndef STRCMPI_H -#define STRCMPI_H - -#include -#include "3dstype.h" -#include "strcmpi.h" - - -int strcmpi(char3ds *s1, char3ds *s2); - -#endif diff --git a/3rdparty/3dsftk3/src/strdup.c b/3rdparty/3dsftk3/src/strdup.c deleted file mode 100644 index edbf9409..00000000 --- a/3rdparty/3dsftk3/src/strdup.c +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - - -#include -#include -#include "3dstype.h" - -/* A strdup routine for those platforms that don't have one in the library */ -char3ds *strdup3ds(const char3ds *s1) -{ - char *s2; - int size; - - size = (strlen(s1)+1)*sizeof(char); - - s2 = malloc(size); - - memcpy(s2, s1, size); - - return s2; -} - - - - - diff --git a/3rdparty/3dsftk3/src/swapbyte.c b/3rdparty/3dsftk3/src/swapbyte.c deleted file mode 100644 index 95e496ca..00000000 --- a/3rdparty/3dsftk3/src/swapbyte.c +++ /dev/null @@ -1,36 +0,0 @@ -/* this source was algorythmically generated by makeswap.c */ - -#include "3dstype.h" -#include "swapbyte.h" -void N2ILong3ds(void *native, void *intel){ - *((uint32_t *)(intel)) = *((uint32_t *)(native)); -} - -void I2NLong3ds(void *intel, void *native){ - *((uint32_t *)(native)) = *((uint32_t *)(intel)); -} - -void N2IShort3ds(void *native, void *intel){ - *((uint16_t *)(intel)) = *((uint16_t *)(native)); -} - -void I2NShort3ds(void *intel, void *native){ - *((uint16_t *)(native)) = *((uint16_t *)(intel)); -} - -void N2IFloat3ds(void *native, void *intel){ - *((float *)(intel)) = *((float *)(native)); -} - -void I2NFloat3ds(void *intel, void *native){ - *((float *)(native)) = *((float *)(intel)); -} - -void N2IDouble3ds(void *native, void *intel){ - *((double *)(intel)) = *((double *)(native)); -} - -void I2NDouble3ds(void *intel, void *native){ - *((double *)(native)) = *((double *)(intel)); -} - diff --git a/3rdparty/3dsftk3/src/swapbyte.h b/3rdparty/3dsftk3/src/swapbyte.h deleted file mode 100644 index b9ca5959..00000000 --- a/3rdparty/3dsftk3/src/swapbyte.h +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef SWAP_BYTE_3DS -#define SWAP_BYTE_3DS - -#include "3dstype.h" - -/* Private Function Prototypes */ - -void N2ILong3ds(void *native, void *intel); -void I2NLong3ds(void *native, void *intel); -void N2IShort3ds(void *native, void *intel); -void I2NShort3ds(void *native, void *intel); -void N2IFloat3ds(void *native, void *intel); -void I2NFloat3ds(void *native, void *intel); -void N2IDouble3ds(void *native, void *intel); -void I2NDouble3ds(void *native, void *intel); - -#endif diff --git a/3rdparty/3dsftk3/src/xdata.c b/3rdparty/3dsftk3/src/xdata.c deleted file mode 100644 index b804cca3..00000000 --- a/3rdparty/3dsftk3/src/xdata.c +++ /dev/null @@ -1,954 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - - -#include - -#include -#include "3dstype.h" -#include "chunkinf.h" -#include "chunk3ds.h" -#include "3dsftkst.h" -#include "3dserr.h" -#include "kfutils.h" -#include "xdata.h" - - -/* GetXDataCount3ds counts the number of occurances of XDATA_ENTRIES - contained in the chunk. */ - -ulong3ds GetXDataCount3ds(chunk3ds *chunk) -{ - chunk3ds *xdatasection, *xdataentry; - ulong3ds xdatacount = 0; - - if (chunk == NULL) - SET_ERROR_RETURNR(ERR_INVALID_ARG, 0); - - if (chunk->tag != XDATA_SECTION) - FindChunk3ds(chunk, XDATA_SECTION, &xdatasection); - else - xdatasection = chunk; - - if (xdatasection == NULL) return 0; - - for (FindChunk3ds(xdatasection, XDATA_ENTRY, &xdataentry); - xdataentry != NULL; - FindNextChunk3ds(xdataentry->sibling, XDATA_ENTRY, &xdataentry) - ) xdatacount++; - - return(xdatacount); -} - -void GetXDataChunkList3ds(chunk3ds *chunk, chunklist3ds **list) -{ - chunk3ds *xdatasection, *xdataentry, *xdataname; - long3ds xdatacount = 0, i; - XDataAppName *data; - - if (chunk == NULL || list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - xdatacount = GetXDataCount3ds(chunk); - - InitChunkList3ds(list, xdatacount); - - if (xdatacount <= 0) return; - - if (chunk->tag != XDATA_SECTION) - FindChunk3ds(chunk, XDATA_SECTION, &xdatasection); - else - xdatasection = chunk; - - for (i = 0, FindChunk3ds(xdatasection, XDATA_ENTRY, &xdataentry); - xdataentry != NULL; - i++, FindNextChunk3ds(xdataentry->sibling, XDATA_ENTRY, &xdataentry) - ) - { - FindChunk3ds(xdataentry, XDATA_APPNAME, &xdataname); - if (xdataname != NULL) /* If there is an appname then put it in the list */ - { - ReadChunkData3ds(xdataname); - data = xdataname->data; - - (*list)->list[i].name = strdup(data->name); - (*list)->list[i].chunk = xdataentry; - FreeChunkData3ds(xdataname); - - } else /* Put a null string in the list entry */ - { - (*list)->list[i].name = malloc(sizeof(char3ds)); - (*list)->list[i].name[0] = 0; - (*list)->list[i].chunk = xdataentry; - } - } - - -} - -void GetXDataNameList3ds(chunk3ds *chunk, namelist3ds **list) -{ - chunk3ds *xdatasection, *xdataentry, *xdataname; - long3ds xdatacount = 0, i; - XDataAppName *data; - - if (chunk == NULL || list == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - xdatacount = GetXDataCount3ds(chunk); - - InitNameList3ds(list, xdatacount); - - if (xdatacount <= 0) return; - - if (chunk->tag != XDATA_SECTION) - FindChunk3ds(chunk, XDATA_SECTION, &xdatasection); - else - xdatasection = chunk; - - for (i = 0, FindChunk3ds(xdatasection, XDATA_ENTRY, &xdataentry); - xdataentry != NULL; - i++, FindNextChunk3ds(xdataentry->sibling, XDATA_ENTRY, &xdataentry) - ) - { - FindChunk3ds(xdataentry, XDATA_APPNAME, &xdataname); - if (xdataname != NULL) /* If there is an appname then put it in the list */ - { - ReadChunkData3ds(xdataname); - data = xdataname->data; - - (*list)->list[i].name = strdup(data->name); - - } else /* Put a null string in the list entry */ - { - (*list)->list[i].name = malloc(sizeof(char3ds)); - (*list)->list[i].name[0] = 0; - - } - } - -} - - -void FindXDataEntryByName3ds(chunk3ds *chunk, char3ds *appname, chunk3ds **xentry) -{ - chunk3ds *xdatasection, *xdataentry, *xdataname; - XDataAppName *data; - - if (chunk == NULL || appname == NULL || xentry == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - *xentry = NULL; - - FindChunk3ds(chunk, XDATA_SECTION, &xdatasection); - - if (xdatasection == NULL) return; - - for (FindChunk3ds(xdatasection, XDATA_ENTRY, &xdataentry); - xdataentry != NULL; - FindNextChunk3ds(xdataentry->sibling, XDATA_ENTRY, &xdataentry)) - { - FindChunk3ds(xdataentry, XDATA_APPNAME, &xdataname); - - if (xdataname != NULL) - { - data = ReadChunkData3ds(xdataname); - - if (strcmp(appname, data->name) == 0) - { - *xentry = xdataentry; - return; - } - } - } -} - -void PutXDataEntryByName3ds(chunk3ds *chunk, char3ds *appname, chunk3ds *xentry) -{ - chunk3ds *xdatasection=NULL, *xdataentry=NULL, *xdataname=NULL, *section; - - if (chunk == NULL || appname == NULL || xentry == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindChunk3ds(chunk, XDATA_SECTION, &xdatasection); - ADD_ERROR_RETURN(ERR_PUT_FAIL) - - if (xdatasection == NULL) - { - /* Search for the appropriate chunk to create the XDATA_SECTION in */ - FindChunk3ds(chunk, N_TRI_OBJECT, §ion); - if (section != NULL) - { - InitChunkAs3ds(&xdatasection, XDATA_SECTION); - AddChildOrdered3ds(section, xdatasection); - } - } - - - /* If an entry with the same appname already exists, then delete it */ - FindXDataEntryByName3ds(xdatasection, appname, &xdataentry); - if (xdataentry != NULL) - { - DeleteChunk3ds(xdataentry); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - } - - CopyChunk3ds(xentry, &xdataentry); - - AddChildOrdered3ds(xdatasection, xentry); - ADD_ERROR_RETURN(ERR_PUT_FAIL); - - -} - - -void FindXDataEntryByIndex3ds(chunk3ds *chunk, ulong3ds index, chunk3ds **xentry) -{ - chunk3ds *xdatasection, *xdataentry; - ulong3ds i; - - if (chunk == NULL || xentry == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - *xentry = NULL; - - FindChunk3ds(chunk, XDATA_SECTION, &xdatasection); - - if (xdatasection == NULL) return; - - for (FindChunk3ds(xdatasection, XDATA_ENTRY, &xdataentry), i = 0; - xdataentry != NULL; - FindNextChunk3ds(xdataentry->sibling, XDATA_ENTRY, &xdataentry), i++) - { - if (i == index) - { - *xentry = xdataentry; - return; - } - } -} - - - -/* This function retrieves the entire XDATA_ENTRY chunk */ -void GetXDataRawEntryByName3ds(chunk3ds *chunk, char3ds *appname, xdataraw3ds **data) -{ - chunk3ds *xsection = NULL, *xentry = NULL, *xname = NULL, *temp = NULL; - XDataEntry *entrydata; - - if (chunk == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindChunk3ds(chunk, XDATA_SECTION, &xsection); - if (xsection == NULL) - { - *data = NULL; - return; - } - - FindXDataEntryByName3ds(xsection, appname, &xentry); - if (xentry == NULL) - { - *data = NULL; - return; - } - - CopyChunk3ds(xentry, &temp); - - *data = malloc(sizeof(xdataraw3ds)); - - entrydata = ReadChunkData3ds(temp); - - (*data)->size = entrydata->size; - - (*data)->data = entrydata->data; - entrydata->data = NULL; - - ReleaseChunk3ds(&temp); - - -} - - -/* This function retrieves the entire XDATA_ENTRY chunk */ -void GetXDataRawEntryByIndex3ds(chunk3ds *chunk, ulong3ds index, xdataraw3ds **data) -{ - chunk3ds *xsection = NULL, *xentry = NULL, *xname = NULL, *temp = NULL; - XDataEntry *entrydata; - - if (chunk == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindChunk3ds(chunk, XDATA_SECTION, &xsection); - if (xsection == NULL) - { - *data = NULL; - return; - } - - FindXDataEntryByIndex3ds(xsection, index, &xentry); - if (xentry == NULL) - { - *data = NULL; - return; - } - - CopyChunk3ds(xentry, &temp); - - *data = malloc(sizeof(xdataraw3ds)); - - entrydata = ReadChunkData3ds(temp); - - (*data)->size = entrydata->size; - - (*data)->data = entrydata->data; - entrydata->data = NULL; - - ReleaseChunk3ds(&temp); - - -} - -ulong3ds GetMeshXDataCount3ds(database3ds *db, char3ds *meshname) -{ - chunk3ds *nobj, *ntrichunk; - - if (db == NULL || meshname == NULL) - SET_ERROR_RETURNR(ERR_INVALID_ARG, 0); - - FindNamedObject3ds(db, meshname, &nobj); - - if (nobj != NULL) - { - FindChunk3ds(nobj, N_TRI_OBJECT, &ntrichunk); - if (ntrichunk != NULL) - { - return GetXDataCount3ds(ntrichunk); - } else - { - return 0; - } - } - - return 0; -} - -void GetMeshXDataByIndex3ds(database3ds *db, char3ds *meshname, ulong3ds index, xdataraw3ds **data) -{ - chunk3ds *nobj, *ntrichunk; - - if (db == NULL || meshname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindNamedObject3ds(db, meshname, &nobj); - - if (nobj != NULL) - { - FindChunk3ds(nobj, N_TRI_OBJECT, &ntrichunk); - if (ntrichunk != NULL) - { - GetXDataRawEntryByIndex3ds(ntrichunk, index, data); - } - } -} - -void GetMeshXDataByName3ds(database3ds *db, char3ds *meshname, char3ds *appname, xdataraw3ds **data) -{ - chunk3ds *nobj, *ntrichunk; - - if (db == NULL || meshname == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindNamedObject3ds(db, meshname, &nobj); - - if (nobj != NULL) - { - FindChunk3ds(nobj, N_TRI_OBJECT, &ntrichunk); - if (ntrichunk != NULL) - { - GetXDataRawEntryByName3ds(ntrichunk, appname, data); - } - } -} - - -#ifdef not_working - -/* AddXDataEntry3ds adds/replaces external data to the children list of the - given chunk. If an XDATA_SECTION doesn't exist, it will create it. - If an XDATA_APPNAME already exists, it will replace it. */ - -void AddXDataEntry3ds(chunk3ds *chunk, char3ds *appname, xdata3ds *data) -{ - chunk3ds *xsection = NULL, *xentry = NULL, *xname = NULL; - XDataAppName *namedata; - - if (chunk == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindChunk3ds(chunk, XDATA_SECTION, &xsection); - - if (xsection == NULL) /* A new XDATA_SECTION must be created */ - { - InitChunk3ds(&xsection); - xsection->tag = XDATA_SECTION; - AddChild3ds(chunk, xsection); - } - - if (xsection->children == NULL) /* A new XDATA_ENTRY must be created */ - { - InitChunk3ds(&xentry); - xentry->tag = XDATA_ENTRY; - - xsection->children = xentry; - - } else /* Look for a matching appname */ - { - FindXDataEntryByName3ds(xsection, appname, &xentry); - if (xentry != NULL) /* if a match was found then overwrite it */ - { - chunk3ds *tempsib; - - ReleaseChunk3ds(&(xentry->children)); - tempsib = xentry->sibling; /* temp store sibling list */ - InitChunk3ds(&xentry); /* Note that InitChunk shouln't allocate more memory if there is already some there */ - xentry->tag = XDATA_ENTRY; - xentry->sibling = tempsib; - } else /* Add a new entry to the end of the sibling list */ - { - InitChunk3ds(&xentry); - xentry->tag = XDATA_ENTRY; - AddChild3ds(xsection, xentry); - } - } - - /* Lets build up the new xentry */ - - InitChunk3ds(&xname); - xname->tag = XDATA_APPNAME; - namedata = malloc(sizeof(XDataAppName)); - xname->data = namedata; - namedata->name = malloc((strlen(appname)+1)*sizeof(char3ds)); - strcpy(namedata->name, appname); - - AddChild3ds(xentry, xname); - - AddXData3ds(xentry, data); - -} - - -/*------------------------------------------------------------------------- - | - |AddAmbientLightNodeXData3ds - | - | Note: There is only one AMBIENT_NODE_TAG. - +------------------------------------------------------------------------*/ -void AddAmbientLightNodeXData3ds(database3ds *db, - char3ds *appname, - xdata3ds *data) -{ - chunk3ds *pKfChunk, *pChunk; - - FindChunk3ds(db->topchunk, KFDATA, &pKfChunk); - if (pKfChunk){ - FindChunk3ds(pKfChunk, AMBIENT_NODE_TAG, &pChunk); - if (pChunk) - AddXDataEntry3ds(pChunk, appname, data); - } -} - -/*------------------------------------------------------------------------- - | - | AddCameraNodeXData3ds - | - +------------------------------------------------------------------------*/ -void AddCameraNodeXData3ds(database3ds *db, - char3ds *camname, - char3ds *appname, - xdata3ds *data) -{ - kfAddGenericNodeXData(db, camname, appname, CAMERA_NODE_TAG, data); -} - - -void PutCameraXData3ds(database3ds *db, char3ds *camname, char3ds *appname, xdata3ds *data) -{ - chunk3ds *nobj, *ncam; - - if (db == NULL || camname == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindNamedObject3ds(db, camname, &nobj); - ON_ERROR_RETURN; - - if (nobj != NULL) - { - FindChunk3ds(nobj, N_CAMERA, &ncam); - if (ncam != NULL) - { - AddXDataEntry3ds(ncam, appname, data); - } - } -} - - -void PutMaterialXData3ds(database3ds *db, char3ds *matname, char3ds *appname, xdata3ds *data) -{ - chunk3ds *matentry = NULL; - - if (db == NULL || matname == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindMatEntry3ds(db, matname, &matentry); - - if (matentry != NULL) - AddXDataEntry3ds(matentry, appname, data); - -} - -void PutMeshXData3ds(database3ds *db, char3ds *meshname, char3ds *appname, xdata3ds *data) -{ - chunk3ds *nobj, *ntrichunk; - - if (db == NULL || meshname == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindNamedObject3ds(db, meshname, &nobj); - - if (nobj != NULL) - { - FindChunk3ds(nobj, N_TRI_OBJECT, &ntrichunk); - if (ntrichunk != NULL) - { - AddXDataEntry3ds(ntrichunk, appname, data); - } - } -} -#endif - -#ifdef not_working -/*------------------------------------------------------------------------- - | - |AddObjectNodeXData3ds - | - +------------------------------------------------------------------------*/ -void AddObjectNodeXData3ds(database3ds *db, - char3ds *name, - char3ds *appname, - xdata3ds *data) -{ - kfAddGenericNodeXData(db, name, appname, OBJECT_NODE_TAG, data); -} - -/*------------------------------------------------------------------------- - | - |AddOmnilightNodeXData3ds - | - +------------------------------------------------------------------------*/ -void AddOmnilightNodeXData3ds(database3ds *db, - char3ds *name, - char3ds *appname, - xdata3ds *data) -{ - kfAddGenericNodeXData(db, name, appname, LIGHT_NODE_TAG, data); -} - -/*------------------------------------------------------------------------- - | - |AddSpotlightNodeXData3ds - | - +------------------------------------------------------------------------*/ -void AddSpotlightNodeXData3ds(database3ds *db, - char3ds *name, - char3ds *appname, - xdata3ds *data) -{ - kfAddGenericNodeXData(db, name, appname, SPOTLIGHT_NODE_TAG, data); -} - -void AddKfSectionXData3ds(database3ds *db, char3ds *appname, xdata3ds *data) -{ - chunk3ds *kfdata; - - if (db == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindChunk3ds(db->topchunk, KFDATA, &kfdata); - - if (kfdata != NULL) - AddXDataEntry3ds(kfdata, appname, data); -} - -void PutMeshSectionXData3ds(database3ds *db, char3ds *appname, xdata3ds *data) -{ - chunk3ds *mdata; - - if (db == NULL || appname == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - FindChunk3ds(db->topchunk, MDATA, &mdata); - if (mdata != NULL) - AddXDataEntry3ds(mdata, appname, data); -} -#endif - -#ifdef OldWayOfDoingIt - -/* Older function relies on having a list made, but since the list only exists for the life of the function, I - thought it a bit wasteful. */ -void FindXDataEntryByName3ds(chunk3ds *chunk, char3ds *appname, chunk3ds **xentry) -{ - chunklist3ds *list = NULL; - ulong3ds x; - - if (chunk == NULL || appname == NULL || xentry == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - *xentry = NULL; - GetXDataChunkList3ds(chunk, &list); - - for (x = 0; x < list->count; x ++) - { - if (strcmp(appname, list->list[x].name) == 0) - { - *xentry = list->list[x].chunk; - break; - } - } - - ReleaseChunkList3ds(&list); - -} -#endif - -#ifdef NOT_YET_COMPLETE - -void GetXData3ds(chunk3ds *chunk, xdata3ds **xdata) -{ - if (chunk == NULL || data == NULL) SET_ERROR_RETURN(ERR_INVALID_ARG); - - *xdata = malloc(sizeof(xdata3ds)); - - switch (chunk->tag) - { - case XDATA_ENTRY: - { - long3ds i; - - - /* Are there recognizable sub chunks */ - if (chunk->children != NULL) - { - chunk3ds *temp; - /* Count the number of subchunks */ - for (temp = chunk->children, i = 0; temp != NULL; temp = temp->sibling, i++); - - /* Allocate enough entries in the list */ - (*xdata)->data.entry.list = calloc(i, sizeof(xdata3ds)); - xdata->data.group.items = i; - - /* Fill up the entries */ - for (temp = chunk->children; temp != NULL; temp = temp->sibling) - { - GetXData3ds(temp, &(((*xdata)->data.entry.list)[i])); - } - } - - /* Is there unidentified data? */ - - /* Code needs to be writen here and else where to handle this - case */ - break; - } - case XDATA_APPNAME: - { - XDataAppName *data; - - data = ReadChunkData3ds(chunk); - - xdata->data.name = data->name; - data->name = NULL; - break; - } - case XDATA_STRING: - { - XDataString *data; - data = ReadChunkData3ds(chunk); - - xdata->data.string = data->string; - data->string = NULL; - break; - } - case XDATA_FLOAT: - { - XDataFloat *data; - data = ReadChunkData3ds(chunk); - - xdata->data.float = data->value; - break; - } - case XDATA_DOUBLE: - { - XDataDouble *data; - data = ReadChunkData3ds(chunk); - - xdata->data.double = data->value; - break; - } - case XDATA_SHORT: - { - XDataShort *data; - data = ReadChunkData3ds(chunk); - - xdata->data.short = data->value; - break; - } - case XDATA_LONG: - { - XDataLong *data; - data = ReadChunkData3ds(chunk); - - xdata->data.long = data->value; - break; - } - case XDATA_VOID: - { - XDataVoid *data; - data = ReadChunkData3ds(chunk); - - xdata->data.void.size = (chunk->size - 6); - xdata->data.void.void = data->void; - data->void = NULL; - } - case XDATA_GROUP: - { - long3ds i; - - if (chunk->children != NULL) - { - chunk3ds *temp; - /* Count the number of subchunks */ - for (temp = chunk->children, i = 0; temp != NULL; temp = temp->sibling, i++); - - /* Allocate enough entries in the list */ - (*xdata)->data.group.list = calloc(i, sizeof(xdata3ds)); - xdata->data.group.items = i; - - /* Fill up the entries */ - for (temp = chunk->children; temp != NULL; temp = temp->sibling) - { - GetXData3ds(temp, &(((*xdata)->data.entry.list)[i])); - } - } - - - -void AddXData3ds(chunk3ds *chunk, xdata3ds *data) -{ - chunk3ds *newchunk; - long3ds i; - - if (chunk == NULL || data == NULL) - SET_ERROR_RETURN(ERR_INVALID_ARG); - - - if(chunk->tag != XDATA_ENTRY) - SET_ERROR_RETURN(ERR_INVALID_DATA); - - - if (data->xtag != XDataEntry3ds) /* XDataEntry is alread in *chunk */ - { - InitChunk3ds(&newchunk); - AddChild3ds(chunk, newchunk); - } - - switch(data->xtag) - { - case XDataEntry3ds: - { - xdatalist3ds *l = data->data; - for(i = 0; i < l->items; i++) AddXData3ds(chunk, &(l->list[i])); - break; - } - case XDataString3ds: - { - XDataString *d; - char3ds *s = data->data; - - newchunk->tag = XDATA_STRING; - newchunk->size = 6+strlen(s)+1; /* header+string+nul */ - - d = malloc(sizeof(XDataString)); - newchunk->data = d; - - d->string = malloc((strlen(s)+1)*sizeof(char3ds)); - strcpy(d->string, s); - break; - } - case XDataFloat3ds: - { - XDataFloat *d; - float3ds *f = data->data; - - newchunk->tag = XDATA_FLOAT; - newchunk->size = 6+4; /* header+float */ - - d = malloc(sizeof(XDataFloat)); - newchunk->data = d; - - d->value = *f; - break; - } - case XDataDouble3ds: - { - XDataDouble *d; - double3ds *doub = data->data; - - newchunk->tag = XDATA_DOUBLE; - newchunk->size = 6+8; /* header+double */ - - d = malloc(sizeof(XDataDouble)); - newchunk->data = d; - - d->value = *doub; - break; - } - case XDataShort3ds: - { - XDataShort *d; - ushort3ds *s = data->data; - - newchunk->tag = XDATA_SHORT; - newchunk->size = 6+2; /* header+short */ - - d = malloc(sizeof(XDataShort)); - newchunk->data = d; - - d->value = *s; - break; - } - case XDataLong3ds: - { - XDataLong *d; - long3ds *l = data->data; - - newchunk->tag = XDATA_LONG; - newchunk->size = 6+4; /* header+long */ - - d = malloc(sizeof(XDataLong)); - newchunk->data = d; - - d->value = *l; - break; - } - case XDataGroup3ds: - { - xdatalist3ds *l = data->data; - - newchunk->tag = XDATA_GROUP; - newchunk->size = 0; /* Size not known */ - - for (i = 0; i < l->items; i++) AddXData3ds(newchunk, &(l->list[i])); - break; - } - default: /* note that "case XDataVoid3ds:" ends up here */ - { - xdatavoid3ds *v = data->data; - - newchunk->tag = (chunktag3ds)(data->xtag); - newchunk->size = 6 + v->size; /* header + data */ - - if(v->size > 0) - { - newchunk->data = malloc(v->size); - memcpy(newchunk->data, v->data, v->size); - } - break; - } - } /* end switch */ -} -#endif diff --git a/3rdparty/3dsftk3/src/xdata.h b/3rdparty/3dsftk3/src/xdata.h deleted file mode 100644 index 9ca33932..00000000 --- a/3rdparty/3dsftk3/src/xdata.h +++ /dev/null @@ -1,166 +0,0 @@ -/************************************************************************** - * 3D Studio File Toolkit for Release 3 - * - * (C) Copyright 1997 by Autodesk, Inc. - * - * License Agreement - * - * This Autodesk Program is copyrighted by Autodesk, Inc. and is - * licensed to you (individual or a legal entity) under the following - * conditions: - * - * You may use, modify, copy, reproduce, distribute, sell, and market - * the Autodesk Program, incorporated in whole or a portion thereof, - * solely as a part of a Larger Work ("Larger Work" is defined as a - * work which contains the Autodesk Program or portions thereof with - * software/programs not governed by the terms of this License) provided - * such Larger Works: - * (i) are designed and intended to work solely with Autodesk, Inc. - * products, - * (ii.) conspicuously contain Autodesk's copyright notice - * "(C) Copyright 1995 by Autodesk, Inc.", - * (iii) contain a copy of this license along with the Autodesk - * Program, (iv) contain the disclaimer of warranty and all - * notices that refer to this License and to the absence of - * any warranty; - * (v) add substantial value in addition to the Autodesk Program. - * - * Any derivative or modification of this Autodesk Program must be - * distributed, published and licensed under the same conditions as - * this License. - * - * You may not license or distribute the Autodesk Program as a standalone - * program or product including OEM and private label. - * - * You may not use, copy, modify, sublicense or distribute the Autodesk - * Program or any portion thereof in any form if such use or distribution - * is not expressly licensed and or is expressly prohibited under this - * License. - * - * You acknowledge and agree that Autodesk shall own all right, title - * and interest in the Autodesk Program and all rights in patents whether - * now known or hereafter discovered. You do not hold and shall not claim - * any interest whatsoever in the Autodesk Program. - * - * You agree that the Autodesk Program, any portion or derivative - * thereof will not be shipped, transferred or exported into any country - * or used in any manner prohibited by the United States Export - * Administration Act or any other applicable export control law, - * restriction or regulation. - * - * NO WARRANTY. - * AUTODESK PROVIDES THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * NON-INFRINGEMENT OF THIRD PARTY RIGHTS, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. DOES - * NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED - * OR ERROR FREE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF - * THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU - * (NOT AUTODESK) ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR - * OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL - * PART OF THIS LICENSE. NO USE OF THE PROGRAM IS AUTHORIZED HEREUNDER - * EXCEPT UNDER THIS DISCLAIMER. - * - * LIMITATION OF LIABILITY. - * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL AUTODESK, OR ANY - * OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AS - * PERMITTED HEREIN, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, - * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE - * OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF - * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR - * THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER - * SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - * - * This License will be governed by the laws of the State of California, - * U.S.A., excluding the application of its conflicts of law rules. - * If any part of this License is found void and unenforceable, it will - * not affect the validity of the balance of the License, which shall - * remain valid and enforceable according to its terms. - * - * This License and the rights granted hereunder will terminate - * automatically if you fail to comply with the terms herein. All - * sublicenses to the Autodesk Program which are properly granted shall - * survive any termination of this license. - *************************************************************************/ - -#ifndef XDATA_H -#define XDATA_H - -#include "3dstype.h" -#include "dbase3ds.h" - -/* Public Typedefs */ -typedef struct { - long3ds size; - void3ds *data; -} xdataraw3ds; - -/* End Public */ - -typedef enum -{ - XDataEntry3ds = 0x8001, - XDataAppName3ds = 0x8002, - XDataString3ds = 0x8003, - XDataFloat3ds = 0x8004, - XDataDouble3ds = 0x8005, - XDataShort3ds = 0x8006, - XDataLong3ds = 0x8007, - XDataVoid3ds = 0x8008, - XDataGroup3ds = 0x8009 - -} xdatatag3ds; - -typedef struct xdata3ds -{ - xdatatag3ds xtag; - union { - struct { /* Used when the entry contains recognizable sub chunks */ - long3ds items; - struct xdata3ds *list; - } entry; - char3ds *name; /* Appname field */ - char3ds *string; /* XDATA_STRING chunk */ - float3ds f; /* XDATA_FLOAT chunk */ - double3ds d; /* XDATA_DOUBLE chunk */ - short3ds s; /* XDATA_SHORT chunk */ - long3ds l; /* XDATA_LONG chunk */ - struct { /* XDATA_VOID chunk */ - long3ds size; - void3ds *v; - } v; - struct { /* XDATA_GROUP chunk */ - long3ds items; - struct xdata3ds *list; - } group; - struct { /* XDATA_ENTRY with no recognizable sub chunks */ - long3ds size; - void3ds *data; - } rawentry; - } data; -} xdata3ds; - -/* Public Prototypes */ -void GetMeshXDataByName3ds(database3ds *db, char3ds *meshname, char3ds *appname, xdataraw3ds **data); -ulong3ds GetMeshXDataCount3ds(database3ds *db, char3ds *meshname); -/* End Public */ -ulong3ds GetXDataCount3ds(chunk3ds *chunk); -void GetXDataNameList3ds(chunk3ds *chunk, namelist3ds **list); -void FindXDataEntryByName3ds(chunk3ds *chunk, char3ds *appname, chunk3ds **xentry); -void AddXData3ds(chunk3ds *chunk, xdata3ds *data); -void AddXDataEntry3ds(chunk3ds *chunk, char3ds *appname, xdata3ds *data); -void AddAmbientLightNodeXData3ds(database3ds *db, char3ds *appname, xdata3ds *data); -void AddCameraNodeXData3ds(database3ds *db, char3ds *camname, char3ds *appname, xdata3ds *data); -void PutCameraXData3ds(database3ds *db, char3ds *camname, char3ds *appname, xdata3ds *data); -void PutMaterialXData3ds(database3ds *db, char3ds *matname, char3ds *appname, xdata3ds *data); -void PutMeshXData3ds(database3ds *db, char3ds *meshname, char3ds *appname, xdata3ds *data); -void AddObjectNodeXData3ds(database3ds *db, char3ds *name, char3ds *appname, xdata3ds *data); -void AddOmnilightNodeXData3ds(database3ds *db, char3ds *name, char3ds *appname, xdata3ds *data); -void AddSpotlightNodeXData3ds(database3ds *db, char3ds *name, char3ds *appname, xdata3ds *data); -void AddKfSectionXData3ds(database3ds *db, char3ds *appname, xdata3ds *data); -void PutMeshSectionXData3ds(database3ds *db, char3ds *appname, xdata3ds *data); - - - -#endif diff --git a/3rdparty/tinygltf b/3rdparty/tinygltf new file mode 160000 index 00000000..6782f887 --- /dev/null +++ b/3rdparty/tinygltf @@ -0,0 +1 @@ +Subproject commit 6782f887bb100e2bc7e6751ad46fe8288c84f767 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cd57df0..ae4550c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") add_compile_options(-Werror=mismatched-new-delete) endif () -add_subdirectory(3rdparty/3dsftk3) +set(TINYGLTF_BUILD_LOADER_EXAMPLE OFF CACHE INTERNAL "" FORCE) +set(TINYGLTF_HEADER_ONLY ON CACHE INTERNAL "" FORCE) +set(TINYGLTF_INSTALL OFF CACHE INTERNAL "" FORCE) +set(TINYGLTF_USE_CPP14 ON CACHE INTERNAL "" FORCE) +add_subdirectory(3rdparty/tinygltf) + add_subdirectory(3rdparty/iniparser) add_subdirectory(MechoSoma) diff --git a/MechoSoma/CMakeLists.txt b/MechoSoma/CMakeLists.txt index b81a90b4..aa2416d9 100644 --- a/MechoSoma/CMakeLists.txt +++ b/MechoSoma/CMakeLists.txt @@ -492,7 +492,7 @@ if (APPLE) endif() add_library(${LIBRARY_NAME} ${GAME_SOURCES}) -target_link_libraries(${LIBRARY_NAME} PUBLIC 3dsftk3 iniparser jpeg) +target_link_libraries(${LIBRARY_NAME} PUBLIC tinygltf iniparser jpeg) set_target_properties(${LIBRARY_NAME} PROPERTIES CXX_STANDARD 17 diff --git a/MechoSoma/VisGeneric/Dispatcher.cpp b/MechoSoma/VisGeneric/Dispatcher.cpp index b75120d4..c1cd35b6 100644 --- a/MechoSoma/VisGeneric/Dispatcher.cpp +++ b/MechoSoma/VisGeneric/Dispatcher.cpp @@ -644,24 +644,26 @@ cMesh* cMeshLibrary::Load3ds(const char *filename,const char *TexturePath,unsign if(stricmp(&fname[l],".m3d")==0) return Loadm3d(fname,TexturePath,Type,SizeObject); cFile3ds f; if(f.Open(fname)==0) return 0; - char TextureName[17],NameMesh[22],Shading,OpacityName[17]; - int NumberObject3ds=f.OpenBaseMesh(),nPoint,nPolygon; + char TextureName[cFile3ds::TextureNameSize]; + char NameMesh[cFile3ds::ObjectNameSize]; + char Shading; + char OpacityName[cFile3ds::OpacityNameSize]; + int NumberObject3ds=f.GetMeshCount(),nPoint,nPolygon; if(SizeObject!=0) f.MaxSizeMesh(NumberObject3ds,SizeObject); // єёЄрэютър ьрё°Єрср чруЁєцрхьюую юс·хъЄр - int NumberKeyFrame=f.OpenBaseKeyFrame(); cMesh *tmpMesh=0,*BaseMesh=0,*Bound=0; int i; for(i=0;iGetName()=NameMesh; Tile->GetID()=gb_TileID++; - f.ReadMesh(Vertex,Face,(char*)TextureName,Matrix); - f.ReadMaterial(TextureName,TextureName,OpacityName,&Tile->GetDiffuse().a,&ShinStrength,&Shininess,&Shading,&Tile->GetDiffuse().r,&Tile->GetDiffuse().g,&Tile->GetDiffuse().b); + f.ReadMesh(Vertex,Face,Matrix); + f.ReadMaterial(TextureName,OpacityName,&Tile->GetDiffuse().a,&ShinStrength,&Shininess,&Shading,&Tile->GetDiffuse().r,&Tile->GetDiffuse().g,&Tile->GetDiffuse().b); if(Tile->GetDiffuse().a>0) Tile->GetDiffuse().a=1-Tile->GetDiffuse().a; else Tile->GetDiffuse().a=1+Tile->GetDiffuse().a; if(Tile->GetDiffuse().a<0) Tile->GetDiffuse().a=0; else if(Tile->GetDiffuse().a>1) Tile->GetDiffuse().a=1; @@ -696,12 +698,10 @@ cMesh* cMeshLibrary::Load3ds(const char *filename,const char *TexturePath,unsign for(k=0;kSetName(NameMesh); Bound->AddTile(Tile); } else if((BaseMesh==0)||((tmpMesh=BaseMesh->FindMesh(NameParent))==0)) - { // шэшЎшрышчрЎш  срчютюую ЁюфшЄхы  + { // объект главный родитель if(BaseMesh==0) { BaseMesh=tmpMesh=AddMesh(NameMesh); @@ -759,9 +759,9 @@ cMesh* cMeshLibrary::Load3ds(const char *filename,const char *TexturePath,unsign if(Scale) delete[] Scale; delete[] Vertex; delete[] Face; - f.CloseMesh(); } - for(i=NumberObject3ds;iFindMesh(NameDummyParent); if(Mesh) Mesh->Dummies.Add(v,DummyName); - f.CloseDummy(); } if(BaseMesh) { BaseMesh->Alignment(); BaseMesh->ReCalcTotalBound(); BaseMesh->SetFrame(); } else { XBuffer buf; buf<"Error: cMeshLibrary::Load3ds/r/nNot create "CalcTotalBound(); Bound->SetParent(BaseMesh); } - f.CloseBaseKeyFrame(); - f.CloseBaseMesh(); f.Close(); return BaseMesh; } diff --git a/MechoSoma/VisGeneric/File3ds.cpp b/MechoSoma/VisGeneric/File3ds.cpp index 931e74e5..0fce6784 100644 --- a/MechoSoma/VisGeneric/File3ds.cpp +++ b/MechoSoma/VisGeneric/File3ds.cpp @@ -1,301 +1,535 @@ -#include #include "File3ds.h" + +#include +#include #include -#include "Math3d.h" -#include "BaseDefine.h" +#include +#include +#include +#include +#include +#include -#ifdef _MECHOSOMA_ -int m3dOpenResource(const char* fname,XStream& fh); -int vmapOpenResource(const char* fname,XStream& fh); -extern "C" { -void openLogFile(const char* fname); -void closeLogFile(void); -}; -#endif +#define TINYGLTF_IMPLEMENTATION +#define STB_IMAGE_IMPLEMENTATION +#define STB_IMAGE_WRITE_IMPLEMENTATION +#include -#define RAD_GRAD 57.296f +#include "filesystem.h" +#include "BaseDefine.h" +#include "Math3d.h" -char cFile3ds::Open(const char *fname,int OpenDirection) +namespace { - const ErrRec3ds *ErrList=ReturnErrorList3ds(); - -#ifdef _MECHOSOMA_ - int buf_len; - char* buf; - - XStream fh; - - if(OpenDirection==1) - m3dOpenResource(fname,fh); - else if(OpenDirection==2) - vmapOpenResource(fname,fh); - - buf_len = fh.size(); - buf = (char*)malloc(buf_len); - fh.read(buf,buf_len); - fh.close(); -/* - char* tmp_buf = strdup(fname); - tmp_buf[strlen(tmp_buf) - 3] = 'l'; - tmp_buf[strlen(tmp_buf) - 2] = 'o'; - tmp_buf[strlen(tmp_buf) - 1] = 'g'; - - openLogFile(tmp_buf); - free(tmp_buf); -*/ - - f=OpenFile3ds_buf(buf,buf_len); -// f=OpenFile3ds(fname,"rb"); -#else - f=OpenFile3ds(fname,"rb"); -#endif - if(f==0) { CLEAR_ERROR; CloseAllFiles3ds(); /* CLEAR_INFO_MESSAGE; /*ERROR_MESSAGE("3ds file not found",fname,0);*/ XBuffer msg; msg < "3ds file not found " < fname; ErrH.Abort(msg); return 0; } - InitDatabase3ds(&db); - CreateDatabase3ds(f,db); - return 1; -} -void cFile3ds::Close() -{ -// SHOW_INFO_MESSAGE(f->filename); - ReleaseDatabase3ds(&db); - CloseFile3ds(f); -// closeLogFile(); +const std::string MaterialExtension = "3DS_material"; +const std::string AnimationExtension = "3DS_animation"; +const std::string DummyExtension = "3DS_dummy"; +const std::string DummyName = "$$$DUMMY"; - CLEAR_ERROR; - CloseAllFiles3ds(); -} -//******************************** MESH ********************************** -int cFile3ds::OpenBaseMesh() -{ - return GetMeshCount3ds(db); -} -void cFile3ds::OpenMesh(int nObject,int *nPoint,int *nFace,char *NameObject) +std::string to_lower(const std::string &input) { - mesh=NULL; - GetMeshByIndex3ds(db,nObject,&mesh); - (*nPoint)=(int)mesh->nvertices; /* Vertice count */ - int nTexel=(int)mesh->ntextverts; /* Number of texture vertices */ - (*nFace)=(int)mesh->nfaces; /* Face count */ - strcpy(NameObject,mesh->name); -// InfoBuf<"3d object "(*nPoint)) - { XBuffer buf; buf<"Error : cFile3ds::OpenMesh()\r\nBad 3ds file "filename<" (number texel != number point) in mesh "name; ErrH.Abort(buf.address()); } -// ERROR_MESSAGE(f->filename,"cFile3ds::OpenMesh()\r\nError - bad 3ds file (number texel != number point)\r\n",0); + std::string result; + std::transform(input.begin(), input.end(), std::back_inserter(result), [](auto c) { return std::tolower(c); }); + return result; } -float cFile3ds::MaxSizeMesh(int nObject,float NewSize) + +std::string create_node_name(const char *file_name) { - float Max=0; - for(int j=0;jnvertices;i++) + + if (!part.empty()) { - if(fabs(mesh->vertexarray[i].x)>Max) Max=fabs(mesh->vertexarray[i].x); - if(fabs(mesh->vertexarray[i].y)>Max) Max=fabs(mesh->vertexarray[i].y); - if(fabs(mesh->vertexarray[i].z)>Max) Max=fabs(mesh->vertexarray[i].z); + result << "_" << to_lower(part); } - return Max; + + return result.str().substr(1); } -void cFile3ds::ReadMesh(float *PointXYZUV,int *FaceP1P2P3,char *NameMaterial,float *Matrix) + +struct ModelStore { - point3ds *point=mesh->vertexarray; /* List of vertices */ - textvert3ds *texel=mesh->textarray; /* List of texture coordinates */ - face3ds *face=mesh->facearray; /* List of faces */ + ModelStore() + { + tinygltf::TinyGLTF loader; + std::string error; + std::string warning; + const bool result = loader.LoadBinaryFromFile(&model, &error, &warning, "RESOURCE/3ds.gltf"); + if (!warning.empty()) + { + std::cout << "WARNING: " << warning << std::endl; + } - int i; - for(i=0;infaces;i++) + if (!error.empty()) + { + std::cout << "ERROR: " << error << std::endl; + } + + if (!result) + { + ErrH.Abort("LoadBinaryFromFile", XERR_USER, 0, ""); + } + + assert(model.scenes.size() == 1); + for (auto index : model.scenes[0].nodes) + { + const auto &node = model.nodes[index]; + assert(node_index.find(node.name) == node_index.end()); + node_index.emplace(node.name, &node); + } + } + + void SetParentNode(const char *file_name) { - FaceP1P2P3[3*i+0]=face[i].v1; - FaceP1P2P3[3*i+1]=face[i].v2; - FaceP1P2P3[3*i+2]=face[i].v3; + const auto node_name = create_node_name(file_name); + const auto node = node_index.find(node_name); + if (node == node_index.end()) + { + ErrH.Abort("Node not found", XERR_USER, 0, ""); + } + parent_node = node->second; + + dummies.clear(); + children.clear(); + for (auto index : parent_node->children) + { + const auto &node = model.nodes[index]; + if (node.name == DummyName) + { + dummies.push_back(index); + } + else + { + children.push_back(index); + } + } } - for(i=0;invertices;i++) + void Reset() { - PointXYZUV[5*i+0]=point[i].x*Scale; - PointXYZUV[5*i+1]=point[i].y*Scale; - PointXYZUV[5*i+2]=point[i].z*Scale; - int test11=*((int*)&point[i].x); - if((test11==0xFFFFFFFF)||(test11==0xFFFFFF7F)) - test11=test11; + parent_node = nullptr; + current_node = nullptr; + current_mesh = nullptr; + current_dummy = nullptr; + current_animation = nullptr; } - for(i=0;intextverts;i++) + + tinygltf::Model model; + std::unordered_map node_index; + const tinygltf::Node *parent_node = nullptr; + std::vector children; + std::vector dummies; + const tinygltf::Node *current_node = nullptr; + const tinygltf::Mesh *current_mesh = nullptr; + const tinygltf::Node *current_dummy = nullptr; + const tinygltf::Animation *current_animation = nullptr; + +}; +std::unique_ptr model_store; + +} + +cFile3ds::cFile3ds() : Scale(1.0), CountDummy(0) {} + +cFile3ds::~cFile3ds() +{ + Close(); +} + +char cFile3ds::Open(const char *FileName) +{ + if (!model_store) { - PointXYZUV[5*i+3]=texel[i].u; - PointXYZUV[5*i+4]=texel[i].v; + model_store = std::make_unique(); } - for(i=0;i<9;i++) Matrix[i]=mesh->locmatrix[i]; - for(i=9;i<12;i++) Matrix[i]=mesh->locmatrix[i]*Scale; - if(mesh->matarray) - strcpy(NameMaterial,mesh->matarray->name); - else for(i=0;i<17;i++) NameMaterial[i]=0; -// InfoBuf<", material: "matarray->name<"\r\n"; + model_store->SetParentNode(FileName); + return 1; } -void cFile3ds::ReadMaterial(char *NameMaterial,char *TextureName,char *OpacityName,float *Transparency,float *ShinStrength,float *Shininess,char *Shading,float *rDiffuse,float *gDiffuse,float *bDiffuse) +void cFile3ds::Close() { - material3ds *mat=NULL; - GetMaterialByName3ds(db,NameMaterial,&mat); - if(mat==0) { XBuffer buf; buf<"Error : cFile3ds::ReadMaterial()\r\nBad material 3ds file "filename; ErrH.Abort(buf.address()); } -/* InfoBuf<" transparency:"<=((*Transparency)=mat->transparency)< - " shinstrength:"<=((*ShinStrength)=mat->shinstrength)< - " shininess:"<=((*Shininess)=mat->shininess)< - " shading:"<=((*Shading)=(char)mat->shading)<"\r\n"; */ - (*Transparency)=mat->transparency; (*ShinStrength)=mat->shinstrength; (*Shininess)=mat->shininess; (*Shading)=(char)mat->shading; - *rDiffuse=mat->diffuse.r; *gDiffuse=mat->diffuse.g; *bDiffuse=mat->diffuse.b; - if(mat->texture.map.name) - strcpy(TextureName,mat->texture.map.name); - else for(int i=0;i<17;i++) TextureName[i]=0; - if(mat->opacity.map.name) - strcpy(OpacityName,mat->opacity.map.name); - else for(int i=0;i<17;i++) OpacityName[i]=0; - ReleaseMaterial3ds(&mat); + model_store->Reset(); } -void cFile3ds::CloseMesh() + +//******************************** MESH ********************************** +int cFile3ds::GetMeshCount() { - RelMeshObj3ds(&mesh); + assert(model_store->parent_node != nullptr); + return static_cast(model_store->children.size()); } -void cFile3ds::CloseBaseMesh() + +void cFile3ds::GetMeshParameters(int nObject, int *nPoint, int *nFace, char *ObjectName) { + assert(model_store->parent_node != nullptr); + assert(nObject < static_cast(model_store->children.size())); + + const auto node_index = model_store->children[nObject]; + const auto &node = model_store->model.nodes[node_index]; + assert(node.mesh != -1); + const auto &mesh = model_store->model.meshes[node.mesh]; + + assert(mesh.primitives.size() == 1); + const auto &primitive = mesh.primitives[0]; + + { + const auto index = primitive.attributes.at("POSITION"); + const auto &accessor = model_store->model.accessors[index]; + *nPoint = static_cast(accessor.count); + } + + const auto &accessor = model_store->model.accessors[primitive.indices]; + assert(accessor.count % 3 == 0); + *nFace = static_cast(accessor.count / 3); + + std::fill(ObjectName, ObjectName + ObjectNameSize, 0); + assert(node.name.size() < ObjectNameSize); + node.name.copy(ObjectName, node.name.size()); + + auto extras = node.extras.Get(); + auto animation_index = extras.find("animation_index"); + if (animation_index != extras.end()) + { + const auto &animation = model_store->model.animations[animation_index->second.Get()]; + model_store->current_animation = &animation; + } + + model_store->current_node = &node; + model_store->current_mesh = &mesh; } -//***************************** KEYFRAME ********************************** -int cFile3ds::OpenBaseKeyFrame() + +float cFile3ds::MaxSizeMesh(int nObject, float NewSize) { - objlist=NULL; - GetObjectNodeNameList3ds(db,&objlist); -// InfoBuf<"Number object motion: "<=objlist->count<"\r\n"; - return (int) objlist->count; + float max = 0; + for (int i = 0; i < nObject; i++) + { + const auto node_index = model_store->children[i]; + const auto &node = model_store->model.nodes[node_index]; + const auto &mesh = model_store->model.meshes[node.mesh]; + + assert(mesh.primitives.size() == 1); + const auto &primitive = mesh.primitives[0]; + const auto index = primitive.attributes.at("POSITION"); + const auto &accessor = model_store->model.accessors[index]; + + assert(accessor.maxValues.size() == 3); + for (auto v : accessor.maxValues) + { + max = std::max(max, static_cast(abs(v))); + } + + assert(accessor.minValues.size() == 3); + for (auto v : accessor.minValues) + { + max = std::max(max, static_cast(abs(v))); + } + } + + Scale = NewSize / max; + return max; } -void cFile3ds::OpenKeyFrame(const char *NameFrame) + +void cFile3ds::ReadMesh(float *PointXYZUV, int *FaceP1P2P3, float *Matrix) { - kfmesh=NULL; - for(unsigned int i=0;icount;i++) - if(strcmp(NameFrame,objlist->list[i].name)==0) { GetObjectMotionByIndex3ds(db,i,&kfmesh); return; } - XBuffer buf; buf<"Error: in 3ds file "filename<" not found keyframe object - "current_node != nullptr); + assert(model_store->current_mesh != nullptr); + + const auto &buffer = model_store->model.buffers[0]; + const auto &primitive = model_store->current_mesh->primitives[0]; + + { + const auto &accessor = model_store->model.accessors[primitive.indices]; + const auto &view = model_store->model.bufferViews[accessor.bufferView]; + auto data = reinterpret_cast(buffer.data.data() + view.byteOffset); + + for (size_t i = 0; i < accessor.count; i++) + { + FaceP1P2P3[i] = data[i]; + } + } + + const auto &accessor = model_store->model.accessors[primitive.attributes.at("POSITION")]; + const float *position_data = nullptr; + const float *uv_data = nullptr; + + { + const auto &view = model_store->model.bufferViews[accessor.bufferView]; + position_data = reinterpret_cast(buffer.data.data() + view.byteOffset); + } + + { + const auto p = primitive.attributes.find("TEXCOORD_0"); + if (p != primitive.attributes.end()) + { + const auto &accessor = model_store->model.accessors[p->second]; + const auto &view = model_store->model.bufferViews[accessor.bufferView]; + uv_data = reinterpret_cast(buffer.data.data() + view.byteOffset); + } + } + + size_t position_cursor = 0; + size_t uv_cursor = 0; + for (size_t i = 0; i < accessor.count; i++) + { + PointXYZUV[5*i + 0] = position_data[position_cursor++] * Scale; + PointXYZUV[5*i + 1] = position_data[position_cursor++] * Scale; + PointXYZUV[5*i + 2] = position_data[position_cursor++] * Scale; + + if (uv_data != nullptr) + { + PointXYZUV[5*i + 3] = uv_data[uv_cursor++]; + PointXYZUV[5*i + 4] = uv_data[uv_cursor++]; + } + } + + auto &m = model_store->current_node->matrix; + assert(m.size() == 16); + size_t matrix_cursor = 0; + for (size_t i = 0; i < 12; i++) + { + if ((i + 1) % 4 != 0) + { + Matrix[matrix_cursor++] = m[i]; + } + } + for (size_t i = 12; i < 15; i++) + { + Matrix[matrix_cursor++] = m[i] * Scale; + } } -void cFile3ds::ReadKeyFrame(char *Parent,float **Pos,int *NumberPos,float **Rot,int *NumberRot,float **Scale,int *NumberScale,float *Pivot) + +void cFile3ds::ReadMaterial(char *TextureName, char *OpacityName, float *Transparency, float *ShinStrength, float *Shininess, char *Shading, float *rDiffuse, float *gDiffuse, float *bDiffuse) { - strcpy(Parent,kfmesh->parent); - (*NumberPos)=kfmesh->npkeys; (*NumberRot)=kfmesh->nrkeys; (*NumberScale)=kfmesh->nskeys; - if(*NumberPos) (*Pos)=new float[4*(*NumberPos)]; else (*Pos)=0; - if(*NumberRot) (*Rot)=new float[5*(*NumberRot)]; else (*Rot)=0; - if(*NumberScale) (*Scale)=new float [4*(*NumberScale)]; else (*Scale)=0; - int i; - for(i=0;i<(*NumberPos);i++) + assert(model_store->current_mesh != nullptr); + + const auto &primitive = model_store->current_mesh->primitives[0]; + if (primitive.material == -1) { - (*Pos)[4*i+0]=(float)kfmesh->pkeys[i].time; - (*Pos)[4*i+1]=kfmesh->pos[i].x*cFile3ds::Scale; - (*Pos)[4*i+2]=kfmesh->pos[i].y*cFile3ds::Scale; - (*Pos)[4*i+3]=kfmesh->pos[i].z*cFile3ds::Scale; + ErrH.Abort("Bad material"); } - double x2=0,y2=0,z2=0,w2=1; - double Angle=kfmesh->rot[0].angle/2; - double x1=kfmesh->rot[0].x*sin(Angle); - double y1=kfmesh->rot[0].y*sin(Angle); - double z1=kfmesh->rot[0].z*sin(Angle); - double w1=cos(Angle); - double scale=1.0f/sqrt(w1*w1+x1*x1+y1*y1+z1*z1); - (*Rot)[5*0+0]=(float)kfmesh->rkeys[0].time; - (*Rot)[5*0+1]=(float)(w1*scale); - (*Rot)[5*0+2]=(float)(x1*scale); - (*Rot)[5*0+3]=(float)(y1*scale); - (*Rot)[5*0+4]=(float)(z1*scale); - for(i=1;i<(*NumberRot);i++) + + const auto &material = model_store->model.materials[primitive.material]; + const auto &extension = material.extensions.at(MaterialExtension).Get(); + + *Transparency = static_cast(extension.at("transparency").Get()); + *ShinStrength = static_cast(extension.at("shininess_strength").Get()); + *Shininess = static_cast(extension.at("shininess").Get()); + *Shading = static_cast(extension.at("shading").Get()); + + const auto &diffuse = extension.at("diffuse").Get(); + assert(diffuse.size() == 3); + *rDiffuse = static_cast(diffuse[0].Get()); + *gDiffuse = static_cast(diffuse[1].Get()); + *bDiffuse = static_cast(diffuse[2].Get()); + + std::fill(TextureName, TextureName + TextureNameSize, 0); + auto texture_map_name = extension.find("texture_map_name"); + if (texture_map_name != extension.end()) { - double Angle=kfmesh->rot[i].angle/2; - double x1=kfmesh->rot[i].x*sin(Angle); - double y1=kfmesh->rot[i].y*sin(Angle); - double z1=kfmesh->rot[i].z*sin(Angle); - double w1=cos(Angle); - - double W=w1*w2-x1*x2-y1*y2-z1*z2; - double X=w1*x2+x1*w2+y1*z2-z1*y2; - double Y=w1*y2-x1*z2+y1*w2+z1*x2; - double Z=w1*z2+x1*y2-y1*x2+z1*w2; - - double scale=1.0f/sqrt(W*W+X*X+Y*Y+Z*Z); - - (*Rot)[5*i+0]=(float)kfmesh->rkeys[i].time; - (*Rot)[5*i+1]=(float)(w2=W*scale); - (*Rot)[5*i+2]=(float)(x2=X*scale); - (*Rot)[5*i+3]=(float)(y2=Y*scale); - (*Rot)[5*i+4]=(float)(z2=Z*scale); + const auto &s = texture_map_name->second.Get(); + assert(s.size() < TextureNameSize); + s.copy(TextureName, s.size()); } - for(i=0;i<(*NumberScale);i++) + + std::fill(OpacityName, OpacityName + OpacityNameSize, 0); + auto opacity_map_name = extension.find("opacity_map_name"); + if (opacity_map_name != extension.end()) { - (*Scale)[4*i+0]=(float)kfmesh->skeys[i].time; - if(kfmesh->scale[0].x!=0.f) (*Scale)[4*i+1]=(float)kfmesh->scale[i].x/kfmesh->scale[0].x; else (*Scale)[4*i+1]=1.f; - if(kfmesh->scale[0].y!=0.f) (*Scale)[4*i+2]=(float)kfmesh->scale[i].y/kfmesh->scale[0].y; else (*Scale)[4*i+2]=1.f; - if(kfmesh->scale[0].z!=0.f) (*Scale)[4*i+3]=(float)kfmesh->scale[i].z/kfmesh->scale[0].z; else (*Scale)[4*i+3]=1.f; + const auto &s = opacity_map_name->second.Get(); + assert(s.size() < OpacityNameSize); + s.copy(OpacityName, s.size()); } - Pivot[0]=kfmesh->pivot.x*cFile3ds::Scale; Pivot[1]=kfmesh->pivot.y*cFile3ds::Scale; Pivot[2]=kfmesh->pivot.z*cFile3ds::Scale; -/* InfoBuf<" Parent name: "current_animation != nullptr); + const auto &extension = model_store->current_animation->extensions.at(AnimationExtension).Get(); + + const auto &parent = extension.at("parent").Get(); + assert(parent.size() < ParentNameSize); + std::fill(ParentName, ParentName + ParentNameSize, 0); + parent.copy(ParentName, parent.size()); + + const auto &pivot_array = extension.at("pivot").Get(); + assert(pivot_array.size() == 3); + Pivot[0] = static_cast(pivot_array[0].Get()) * cFile3ds::Scale; + Pivot[1] = static_cast(pivot_array[1].Get()) * cFile3ds::Scale; + Pivot[2] = static_cast(pivot_array[2].Get()) * cFile3ds::Scale; + + *NumberPos = 0; + *Pos = nullptr; + + *NumberRot = 0; + *Rot = nullptr; + + *NumberScale = 0; + *Scale = nullptr; + + for (const auto &channel : model_store->current_animation->channels) + { + const auto &sampler = model_store->current_animation->samplers[channel.sampler]; + + const float *time_data = nullptr; + size_t count = 0; + { + const auto &accessor = model_store->model.accessors[sampler.input]; + count = accessor.count; + const auto &view = model_store->model.bufferViews[accessor.bufferView]; + const auto &buffer = model_store->model.buffers[0]; + time_data = reinterpret_cast(buffer.data.data() + view.byteOffset); + } + + if (count == 0) + { + continue; + } + + const float *value_data = nullptr; + { + const auto &accessor = model_store->model.accessors[sampler.output]; + assert(count == accessor.count); + const auto &view = model_store->model.bufferViews[accessor.bufferView]; + const auto &buffer = model_store->model.buffers[0]; + value_data = reinterpret_cast(buffer.data.data() + view.byteOffset); + } + + if (channel.target_path == "translation") + { + *NumberPos = static_cast(count); + (*Pos) = new float[4 * count]; + size_t cursor = 0; + size_t value_cursor = 0; + for (size_t i = 0; i < count; i++) + { + (*Pos)[cursor++] = time_data[i]; + (*Pos)[cursor++] = value_data[value_cursor++] * cFile3ds::Scale; + (*Pos)[cursor++] = value_data[value_cursor++] * cFile3ds::Scale; + (*Pos)[cursor++] = value_data[value_cursor++] * cFile3ds::Scale; + } + } + else if (channel.target_path == "rotation") + { + *NumberRot = static_cast(count); + (*Rot) = new float[5 * count]; + size_t cursor = 0; + size_t value_cursor = 0; + for (size_t i = 0; i < count; i++) + { + (*Rot)[cursor++] = time_data[i]; + + const float x = value_data[value_cursor++]; + const float y = value_data[value_cursor++]; + const float z = value_data[value_cursor++]; + const float w = value_data[value_cursor++]; + + (*Rot)[cursor++] = w; + (*Rot)[cursor++] = x; + (*Rot)[cursor++] = y; + (*Rot)[cursor++] = z; + } + } + else if (channel.target_path == "scale") + { + *NumberScale = static_cast(count); + (*Scale) = new float[4 * count]; + size_t cursor = 0; + size_t value_cursor = 0; + for (size_t i = 0; i < count; i++) + { + (*Scale)[cursor++] = time_data[i]; + (*Scale)[cursor++] = value_data[value_cursor++]; + (*Scale)[cursor++] = value_data[value_cursor++]; + (*Scale)[cursor++] = value_data[value_cursor++]; + } + } + } } + +int cFile3ds::GetDummyCount() +{ + return static_cast(model_store->dummies.size()); +} + const char* cFile3ds::OpenDummy(int NumberKeyFrame) { - while(CountDummycount) + if (model_store->dummies.empty() || CountDummy == model_store->dummies.size()) { - kfmesh=NULL; - GetObjectMotionByName3ds(db,objlist->list[CountDummy++].name,&kfmesh); - if(strcmp(kfmesh->name,DummyName3ds)==0) return (char*) kfmesh->instance; - ReleaseObjectMotion3ds(&kfmesh); + ErrH.Abort("Dummy not found", XERR_USER, 0, ""); } - XBuffer buf; buf<"Error: dummy not found - " filename; ErrH.Abort(buf.address()); return 0; + + auto index = model_store->dummies[CountDummy++]; + const auto &node = model_store->model.nodes[index]; + model_store->current_dummy = &node; + const auto &extension = node.extensions.at(DummyExtension).Get(); + const auto &instance = extension.at("instance").Get(); + return instance.c_str(); } + const char* cFile3ds::GetDummyParent() { - return kfmesh->parent; + assert(model_store->current_dummy != nullptr); + + const auto &extension = model_store->current_dummy->extensions.at(DummyExtension).Get(); + const auto &parent = extension.at("parent").Get(); + return parent.c_str(); } -void cFile3ds::ReadDummy(float *x,float *y,float *z) + +void cFile3ds::ReadDummy(float *x, float *y, float *z) { - if((kfmesh->parent==0)||(kfmesh->parent[0]==0)) + assert(model_store->current_dummy != nullptr); + + const auto &translation = model_store->current_dummy->translation; + assert(translation.size() == 3); + + const auto &rotation = model_store->current_dummy->rotation; + const auto &scale = model_store->current_dummy->scale; + + if (rotation.empty() && scale.empty()) { - *x=kfmesh->pos[0].x*Scale; - *y=kfmesh->pos[0].y*Scale; - *z=kfmesh->pos[0].z*Scale; + *x = translation[0] * Scale; + *y = translation[1] * Scale; + *z = translation[2] * Scale; } else { - float x_=kfmesh->pos[0].x*Scale; - float y_=kfmesh->pos[0].y*Scale; - float z_=kfmesh->pos[0].z*Scale; + assert(rotation.size() == 4); + assert(scale.size() == 3); + + const float tx = translation[0] * Scale; + const float ty = translation[1] * Scale; + const float tz = translation[2] * Scale; + + const float x1 = rotation[0]; + const float y1 = rotation[1]; + const float z1 = rotation[2]; + const float w1 = rotation[3]; + cMatrix Matrix; - double Angle=kfmesh->rot[0].angle/2; - double x1=kfmesh->rot[0].x*sin(Angle); - double y1=kfmesh->rot[0].y*sin(Angle); - double z1=kfmesh->rot[0].z*sin(Angle); - double w1=cos(Angle); - double scale=1.0f/sqrt(w1*w1+x1*x1+y1*y1+z1*z1); Matrix.NewMatrix(); - Matrix.Rotate(w1,x1,y1,z1); - Matrix.Scale(scale/kfmesh->scale[0].x,scale/kfmesh->scale[0].y,scale/kfmesh->scale[0].z); - (*x)=Matrix.rot()[0][0]*x_+Matrix.rot()[0][1]*y_+Matrix.rot()[0][2]*z_; - (*y)=Matrix.rot()[1][0]*x_+Matrix.rot()[1][1]*y_+Matrix.rot()[1][2]*z_; - (*z)=Matrix.rot()[2][0]*x_+Matrix.rot()[2][1]*y_+Matrix.rot()[2][2]*z_; + Matrix.Rotate(w1, x1, y1, z1); + const float object_scale = 1.0f / sqrt(w1*w1 + x1*x1 + y1*y1 + z1*z1); + Matrix.Scale(object_scale / scale[0], object_scale / scale[1], object_scale / scale[2]); + + *x = Matrix.rot()[0][0] * tx + Matrix.rot()[0][1] * ty + Matrix.rot()[0][2] * tz; + *y = Matrix.rot()[1][0] * tx + Matrix.rot()[1][1] * ty + Matrix.rot()[1][2] * tz; + *z = Matrix.rot()[2][0] * tx + Matrix.rot()[2][1] * ty + Matrix.rot()[2][2] * tz; } } -void cFile3ds::CloseDummy() -{ - ReleaseObjectMotion3ds(&kfmesh); -} -void cFile3ds::CloseBaseKeyFrame() -{ - ReleaseNameList3ds(&objlist); -} diff --git a/MechoSoma/VisGeneric/File3ds.h b/MechoSoma/VisGeneric/File3ds.h index 60cf058f..0e640de8 100644 --- a/MechoSoma/VisGeneric/File3ds.h +++ b/MechoSoma/VisGeneric/File3ds.h @@ -1,52 +1,39 @@ #ifndef __FILEASC_H__ #define __FILEASC_H__ -#include "3dsftk.h" -#include "stddef.h" -#include "stdlib.h" -#include "time.h" +#include +#include +#include class cFile3ds { float Scale; - file3ds *f; - database3ds *db; - - mesh3ds *mesh; - - namelist3ds *objlist; - kfmesh3ds *kfmesh; - unsigned int CountDummy; public: - cFile3ds(const char *fname=0) { CountDummy=0; f=NULL; db=NULL; Scale=1.0f; if(fname) Open(fname); } - ~cFile3ds() { } + static constexpr unsigned int ObjectNameSize = 22; + static constexpr unsigned int TextureNameSize = 17; + static constexpr unsigned int OpacityNameSize = 17; + static constexpr unsigned int ParentNameSize = 30; - char Open(const char *fname,int OpenDirection=1); + cFile3ds(); + ~cFile3ds(); + + char Open(const char *fname); void Close(); + //****************** Mesh operation ******************** - int OpenBaseMesh(); // return Number Object Tri-mesh - void OpenMesh(int nObject,int *nPoint,int *nFace,char *NameObject); - float MaxSizeMesh(int nObject,float NewSize); - float GetMaxSizeMesh(float Max); - void ReadMesh(float *PointXYZUV,int *FaceP1P2P3,char *NameMaterial,float *Matrix); - void ReadMaterial(char *NameMaterial,char *TextureName,char *OpacityName,float *Transparency,float *ShinStrength,float *Shininess,char *Shading,float *rDiffuse,float *gDiffuse,float *bDiffuse); - void CloseMesh(); - void CloseBaseMesh(); - //**************** KeyFrame operation ******************* - int OpenBaseKeyFrame(); // return Number Mesh Motion - - void OpenKeyFrame(const char *NameFrame); - void ReadKeyFrame(char *Parent,float **Pos,int *NumberPos,float **Rot,int *NumberRot,float **Scale,int *NumberScale,float *Pivot); - void CloseKeyFrame(); - + int GetMeshCount(); + void GetMeshParameters(int nObject, int *nPoint, int *nFace, char *NameObject); + float MaxSizeMesh(int nObject, float NewSize); + void ReadMesh(float *PointXYZUV, int *FaceP1P2P3, float *Matrix); + void ReadMaterial(char *TextureName, char *OpacityName, float *Transparency, float *ShinStrength, float *Shininess, char *Shading, float *rDiffuse, float *gDiffuse, float *bDiffuse); + void ReadKeyFrame(char *Parent, float **Pos, int *NumberPos, float **Rot, int *NumberRot, float **Scale, int *NumberScale, float *Pivot); + + int GetDummyCount(); const char* OpenDummy(int NumberKeyFrame); const char* GetDummyParent(); - void ReadDummy(float *x,float *y,float *z); - void CloseDummy(); - - void CloseBaseKeyFrame(); + void ReadDummy(float *x, float *y, float *z); }; -#endif //__FILEASC_H__ \ No newline at end of file +#endif //__FILEASC_H__ diff --git a/MechoSoma/VisGeneric/TileMap.cpp b/MechoSoma/VisGeneric/TileMap.cpp index da434e93..146d6a1e 100644 --- a/MechoSoma/VisGeneric/TileMap.cpp +++ b/MechoSoma/VisGeneric/TileMap.cpp @@ -97,26 +97,26 @@ inline void AddPointAlpha(cBaseArray &PointAlpha,short x,short y,i int cTileMap::Load3ds(const char *fname) { cFile3ds f; - if(f.Open(fname,2)==0) return 0; + if(f.Open(fname)==0) return 0; xTile=yTile=16; _xTile=_yTile=7; if(Tile) delete [] Tile; Tile=new sTileMap[xTile*yTile]; float dx=1.f/(1<<_xTile), dy=1.f/(1<<_yTile); GetZReflectionSurface()=-1; - char TextureName[17],NameMesh[22]; // Shading,OpacityName[17]; - int NumberObject3ds=f.OpenBaseMesh(),nPoint,nPolygon; + char NameMesh[cFile3ds::ObjectNameSize]; // Shading,OpacityName[17]; + int NumberObject3ds=f.GetMeshCount(),nPoint,nPolygon; cBaseArray PointAlpha(50000,10000); // P3D->SaveAttribute("attribute.raw"); // P3D->SaveVoxel("voxel.raw"); int i; for(i=0;i