mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-29 10:12:02 +05:30
Added getheader() functions for tex and geo component
This commit is contained in:
parent
c1bb8c457f
commit
6d0b82682e
@ -85,6 +85,9 @@ typedef struct {
|
||||
// input: pointer to struct
|
||||
void (* const printcoordinate)(struct Coordinate*, unsigned int);
|
||||
|
||||
// input: pointer to struct, file data
|
||||
bool (* const getheader) (struct Header*, const char*);
|
||||
|
||||
// input: pointer of pointer to struct, order, file data
|
||||
// ** = 'pass by reference' of a pointer to struct
|
||||
bool (* const getmeshheader) (struct MeshHeader**,
|
||||
@ -96,11 +99,11 @@ typedef struct {
|
||||
unsigned int offset,
|
||||
const char * const);
|
||||
|
||||
// input: pointer to struct, order, file data
|
||||
// input: pointer to struct, order, file data, file size
|
||||
bool (* const getmesh) (struct Mesh*,
|
||||
unsigned int i,
|
||||
const char*,
|
||||
unsigned int filesize);
|
||||
unsigned int);
|
||||
} fn_devil1geo;
|
||||
extern fn_devil1geo const DEVIL1GEO;
|
||||
|
||||
|
@ -45,6 +45,9 @@ typedef struct {
|
||||
// input: pointer to struct
|
||||
void (* const printbatchdesc)(struct TextureBatchDescriptor*);
|
||||
|
||||
// input: pointer to struct, file data
|
||||
bool (* const getheader) (struct TexturePack*, const char*);
|
||||
|
||||
// input: pointer of pointer to struct, order, file data, file size
|
||||
// ** = 'pass by reference' of a pointer to struct
|
||||
bool (* const getbatchdesc) (struct TextureBatchDescriptor**,
|
||||
|
@ -9,6 +9,7 @@ static void printmeshbatch(struct Batch*);
|
||||
|
||||
static void printcoordinate(struct Coordinate*, unsigned int);
|
||||
|
||||
static bool getgheader(struct Header*, const char*);
|
||||
|
||||
static bool getmeshheader(struct MeshHeader**, unsigned int i, const char * const);
|
||||
|
||||
@ -20,6 +21,7 @@ fn_devil1geo const DEVIL1GEO = {printgheader,
|
||||
printmeshheader,
|
||||
printmeshbatch,
|
||||
printcoordinate,
|
||||
getgheader,
|
||||
getmeshheader,
|
||||
getmeshbatch,
|
||||
getmesh};
|
||||
@ -74,6 +76,14 @@ static void printcoordinate(struct Coordinate *p, unsigned int count) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool getgheader(struct Header* h, const char* filedata) {
|
||||
if (filedata == NULL) {
|
||||
return false;
|
||||
}
|
||||
h = (struct Header*)filedata;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool getmeshheader(struct MeshHeader **hs,
|
||||
unsigned int i,
|
||||
const char * const filedata) {
|
||||
|
@ -8,8 +8,10 @@ static void printtph(struct TexturePack*);
|
||||
// Print Texture Batch Descriptor.
|
||||
static void printtbd(struct TextureBatchDescriptor*);
|
||||
|
||||
// Get Texture Batch Descriptor.
|
||||
// Get Texture Pack Header
|
||||
static bool getpackheader(struct TexturePack*, const char*);
|
||||
|
||||
// Get Texture Batch Descriptor.
|
||||
static bool gettexdescriptor(struct TextureBatchDescriptor**,
|
||||
unsigned int,
|
||||
const char *,
|
||||
@ -30,6 +32,7 @@ static bool unpacktexbatch(struct Texture*,
|
||||
|
||||
fn_devil1tex const DEVIL1TEX = {printtph,
|
||||
printtbd,
|
||||
getpackheader,
|
||||
gettexdescriptor,
|
||||
gettexbatch,
|
||||
unpacktexbatch};
|
||||
@ -55,6 +58,14 @@ static void printtbd(struct TextureBatchDescriptor *bd) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool getpackheader(struct TexturePack* p, const char *filedata) {
|
||||
if (filedata == NULL) {
|
||||
return false;
|
||||
}
|
||||
p = (struct TexturePack*)filedata;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool gettexdescriptor(struct TextureBatchDescriptor **descriptor,
|
||||
unsigned int i,
|
||||
const char *filedata,
|
||||
|
Loading…
Reference in New Issue
Block a user