Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 20 | pmbaty | 1 | #ifndef _DATAFILE_H_ |
| 2 | #define _DATAFILE_H_ |
||
| 3 | |||
| 4 | #include "brender/br_types.h" |
||
| 5 | |||
| 6 | // The names of these enum values are a wild guess |
||
| 7 | enum { |
||
| 8 | DF_TYPE_BR_INT_8 = 0, |
||
| 9 | DF_TYPE_BR_UINT_8 = 1, |
||
| 10 | DF_TYPE_BR_INT_16 = 2, |
||
| 11 | DF_TYPE_BR_UINT_16 = 3, |
||
| 12 | DF_TYPE_BR_INT_32 = 4, |
||
| 13 | DF_TYPE_BR_UINT_32 = 5, |
||
| 14 | DF_TYPE_BR_FIXED = 6, |
||
| 15 | DF_TYPE_BR_ANGLE = 7, |
||
| 16 | DF_TYPE_FLOAT = 8, |
||
| 17 | DF_TYPE_DOUBLE = 9, |
||
| 18 | DF_TYPE_BR_SCALAR = 10, |
||
| 19 | DF_TYPE_BR_FRACTION = 11, |
||
| 20 | DF_TYPE_BR_UFRACTION = 12, |
||
| 21 | DF_TYPE_ENUM_8 = 13, |
||
| 22 | DF_TYPE_ENUM_16 = 14, |
||
| 23 | DF_TYPE_ENUM_32 = 15, |
||
| 24 | DF_TYPE_STRUCT = 16, |
||
| 25 | DF_TYPE_ASCIZ = 17, |
||
| 26 | DF_TYPE_BR_COLOUR = 18, |
||
| 27 | DF_TYPE_BR_VECTOR2 = 19, |
||
| 28 | DF_TYPE_BR_VECTOR3 = 20, |
||
| 29 | DF_TYPE_BR_VECTOR4 = 21, |
||
| 30 | DF_TYPE_BR_FRACTION_X = 22, |
||
| 31 | DF_TYPE_BR_UFRACTION_X = 23, |
||
| 32 | DF_TYPE_BR_FRACTION_F = 24, |
||
| 33 | DF_TYPE_BR_UFRACTION_F = 25, |
||
| 34 | DF_TYPE_BR_VECTOR2_X = 26, |
||
| 35 | DF_TYPE_BR_VECTOR3_X = 27, |
||
| 36 | DF_TYPE_BR_VECTOR4_X = 28, |
||
| 37 | DF_TYPE_BR_VECTOR2_F = 29, |
||
| 38 | DF_TYPE_BR_VECTOR3_F = 30, |
||
| 39 | DF_TYPE_BR_VECTOR4_F = 31, |
||
| 40 | DF_TYPE_COUNT, |
||
| 41 | }; |
||
| 42 | |||
| 43 | enum { |
||
| 44 | DF_CHUNKID_END = 0, |
||
| 45 | DF_CHUNKID_IMAGE_PLANE = 1, |
||
| 46 | DF_CHUNKID_RLE_IMAGE_PLANE = 2, |
||
| 47 | DF_CHUNKID_PIXELMAP = 3, |
||
| 48 | DF_CHUNKID_MATERIAL_OLD = 4, |
||
| 49 | DF_CHUNKID_ADD_MATERIAL = 5, |
||
| 50 | DF_CHUNKID_OLD_ACTOR = 6, |
||
| 51 | DF_CHUNKID_OLD_ADD_SIBLING = 7, |
||
| 52 | DF_CHUNKID_OLD_ADD_CHILD = 8, |
||
| 53 | DF_CHUNKID_OLD_MATERIAL_INDEX = 9, |
||
| 54 | DF_CHUNKID_OLD_VERTICES = 10, |
||
| 55 | DF_CHUNKID_OLD_VERTICES_UV = 11, |
||
| 56 | DF_CHUNKID_OLD_FACES = 12, |
||
| 57 | DF_CHUNKID_OLD_MODEL = 13, |
||
| 58 | DF_CHUNKID_ADD_MODEL = 14, |
||
| 59 | DF_CHUNKID_ANIM = 15, |
||
| 60 | DF_CHUNKID_ANIM_TRANSFORM = 16, |
||
| 61 | DF_CHUNKID_ANIM_RATE = 17, |
||
| 62 | DF_CHUNKID_FILE_INFO = 18, |
||
| 63 | DF_CHUNKID_OLD_LIGHT = 19, |
||
| 64 | DF_CHUNKID_OLD_CAMERA = 20, |
||
| 65 | DF_CHUNKID_PIVOT = 21, |
||
| 66 | DF_CHUNKID_MATERIAL_INDEX = 22, |
||
| 67 | DF_CHUNKID_VERTICES = 23, |
||
| 68 | DF_CHUNKID_VERTEX_UV = 24, |
||
| 69 | DF_CHUNKID_OLD_FACES_1 = 25, |
||
| 70 | DF_CHUNKID_FACE_MATERIAL = 26, |
||
| 71 | DF_CHUNKID_OLD_MODEL_1 = 27, |
||
| 72 | DF_CHUNKID_COLOUR_MAP_REF = 28, |
||
| 73 | DF_CHUNKID_OPACITY_MAP_REF = 29, |
||
| 74 | DF_CHUNKID_INDEX_BLEND_REF = 30, |
||
| 75 | DF_CHUNKID_INDEX_SHADE_REF = 31, |
||
| 76 | DF_CHUNKID_SCREENDOOR_REF = 32, |
||
| 77 | DF_CHUNKID_PIXELS = 33, |
||
| 78 | DF_CHUNKID_ADD_MAP = 34, |
||
| 79 | DF_CHUNKID_ACTOR = 35, |
||
| 80 | DF_CHUNKID_ACTOR_MODEL = 36, |
||
| 81 | DF_CHUNKID_ACTOR_TRANSFORM = 37, |
||
| 82 | DF_CHUNKID_ACTOR_MATERIAL = 38, |
||
| 83 | DF_CHUNKID_ACTOR_LIGHT = 39, |
||
| 84 | DF_CHUNKID_ACTOR_CAMERA = 40, |
||
| 85 | DF_CHUNKID_ACTOR_BOUNDS = 41, |
||
| 86 | DF_CHUNKID_ACTOR_ADD_CHILD = 42, |
||
| 87 | DF_CHUNKID_TRANSFORM_MATRIX34 = 43, |
||
| 88 | DF_CHUNKID_TRANSFORM_MATRIX34_LP = 44, |
||
| 89 | DF_CHUNKID_TRANSFORM_QUAT = 45, |
||
| 90 | DF_CHUNKID_TRANSFORM_EULER = 46, |
||
| 91 | DF_CHUNKID_TRANSFORM_LOOK_UP = 47, |
||
| 92 | DF_CHUNKID_TRANSFORM_TRANSLATION = 48, |
||
| 93 | DF_CHUNKID_TRANSFORM_IDENTITY = 49, |
||
| 94 | DF_CHUNKID_BOUNDS = 50, |
||
| 95 | DF_CHUNKID_LIGHT = 51, |
||
| 96 | DF_CHUNKID_CAMERA = 52, |
||
| 97 | DF_CHUNKID_FACES = 53, |
||
| 98 | DF_CHUNKID_MODEL = 54, |
||
| 99 | DF_CHUNKID_ACTOR_CLIP_PLANE = 55, |
||
| 100 | DF_CHUNKID_PLANE = 56, |
||
| 101 | DF_CHUNKID_SATURN_FACES = 57, |
||
| 102 | DF_CHUNKID_SATURN_MODEL = 58, |
||
| 103 | DF_CHUNKID_INDEX_FOG_REF = 59, |
||
| 104 | DF_CHUNKID_MATERIAL_OLD_2 = 60, |
||
| 105 | }; |
||
| 106 | |||
| 107 | void DfPush(int type, void* value, int count); |
||
| 108 | |||
| 109 | void* DfPop(int type, int* countp); |
||
| 110 | |||
| 111 | void* DfTop(int type, int* countp); |
||
| 112 | |||
| 113 | int DfTopType(void); |
||
| 114 | |||
| 115 | int TextReadLine(br_datafile* df, char** ident, char** data); |
||
| 116 | |||
| 117 | br_uint_16 scalarTypeConvert(br_datafile* df, br_uint_16 t); |
||
| 118 | |||
| 119 | br_uint_32 DfStructWriteBinary(br_datafile* df, br_file_struct* str, void* base); |
||
| 120 | |||
| 121 | br_uint_32 DfStructReadBinary(br_datafile* df, br_file_struct* str, void* base); |
||
| 122 | |||
| 123 | int DfStructSizeBinary(br_datafile* df, br_file_struct* str, void* base); |
||
| 124 | |||
| 125 | int EnumFromString(br_file_enum* e, char* str); |
||
| 126 | |||
| 127 | char* EnumToString(br_file_enum* e, int num); |
||
| 128 | |||
| 129 | br_uint_32 DfStructWriteText(br_datafile* df, br_file_struct* str, void* base); |
||
| 130 | |||
| 131 | br_uint_32 StructWriteTextSub(br_datafile* df, br_file_struct* str, void* base, int indent); |
||
| 132 | |||
| 133 | br_uint_32 DfStructReadText(br_datafile* df, br_file_struct* str, void* base); |
||
| 134 | |||
| 135 | br_uint_32 StructReadTextSub(br_datafile* df, br_file_struct* str, void* base); |
||
| 136 | |||
| 137 | int DfStructSizeText(br_datafile* df, br_file_struct* str, void* base); |
||
| 138 | |||
| 139 | br_uint_32 DfStructWriteArray(br_datafile* df, br_file_struct* str, void* base, int n); |
||
| 140 | |||
| 141 | br_uint_32 DfStructReadArray(br_datafile* df, br_file_struct* str, void* base, int n); |
||
| 142 | |||
| 143 | int DfChunkWriteText(br_datafile* df, br_uint_32 id, br_uint_32 length); |
||
| 144 | |||
| 145 | int DfChunkReadText(br_datafile* df, br_uint_32* plength); |
||
| 146 | |||
| 147 | int DfChunkWriteBinary(br_datafile* df, br_uint_32 id, br_uint_32 length); |
||
| 148 | |||
| 149 | int DfChunkReadBinary(br_datafile* df, br_uint_32* plength); |
||
| 150 | |||
| 151 | void DfCountWriteText(br_datafile* df, br_uint_32 count); |
||
| 152 | |||
| 153 | br_uint_32 DfCountReadText(br_datafile* df); |
||
| 154 | |||
| 155 | void DfCountWriteBinary(br_datafile* df, br_uint_32 count); |
||
| 156 | |||
| 157 | br_uint_32 DfCountReadBinary(br_datafile* df); |
||
| 158 | |||
| 159 | int DfCountSizeText(br_datafile* df); |
||
| 160 | |||
| 161 | int DfCountSizeBinary(br_datafile* df); |
||
| 162 | |||
| 163 | br_uint_8* BlockWriteSetup(void* base, int block_size, int block_stride, int block_count, int size); |
||
| 164 | |||
| 165 | int DfBlockWriteText(br_datafile* df, void* base, int block_size, int block_stride, int block_count, int size); |
||
| 166 | |||
| 167 | void* DfBlockReadText(br_datafile* df, void* base, int* count, int size, int mtype); |
||
| 168 | |||
| 169 | int DfBlockWriteBinary(br_datafile* df, void* base, int block_size, int block_stride, int block_count, int size); |
||
| 170 | |||
| 171 | void* DfBlockReadBinary(br_datafile* df, void* base, int* count, int size, int mtype); |
||
| 172 | |||
| 173 | int DfBlockSizeText(br_datafile* df, void* base, int block_size, int block_stride, int block_count, int size); |
||
| 174 | |||
| 175 | int DfBlockSizeBinary(br_datafile* df, void* base, int block_size, int block_stride, int block_count, int size); |
||
| 176 | |||
| 177 | char* DfNameReadText(br_datafile* df, char* name); |
||
| 178 | |||
| 179 | int DfNameWriteText(br_datafile* df, char* name); |
||
| 180 | |||
| 181 | int DfNameSizeText(br_datafile* df, char* name); |
||
| 182 | |||
| 183 | char* DfNameReadBinary(br_datafile* df, char* name); |
||
| 184 | |||
| 185 | int DfNameWriteBinary(br_datafile* df, char* name); |
||
| 186 | |||
| 187 | int DfNameSizeBinary(br_datafile* df, char* name); |
||
| 188 | |||
| 189 | int DfSkipText(br_datafile* df, br_uint_32 length); |
||
| 190 | |||
| 191 | int DfSkipBinary(br_datafile* df, br_uint_32 length); |
||
| 192 | |||
| 193 | int DfChunksInterpret(br_datafile* df, br_chunks_table* table); |
||
| 194 | |||
| 195 | void BrNullOther(void); |
||
| 196 | |||
| 197 | int DfFileIdentify(br_uint_8* magics, br_size_t n_magics); |
||
| 198 | |||
| 199 | br_datafile* DfOpen(char* name, int write, br_token scalar_type); |
||
| 200 | |||
| 201 | void DfClose(br_datafile* df); |
||
| 202 | |||
| 203 | int BrWriteModeSet(int mode); |
||
| 204 | |||
| 205 | #endif |