mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-29 02:02:04 +05:30
Added example of getting all textures
This commit is contained in:
parent
4bed12289b
commit
b2ddc14a63
@ -97,3 +97,32 @@ Functions
|
|||||||
true on success.
|
true on success.
|
||||||
|
|
||||||
false when failing checks against segmentation faults.
|
false when failing checks against segmentation faults.
|
||||||
|
|
||||||
|
Example logic to extract all textures:
|
||||||
|
{
|
||||||
|
// After reading the file in...
|
||||||
|
// Need to know how many batches are in the package.
|
||||||
|
struct TexturePack *p = (struct TexturePack*)filedata;
|
||||||
|
|
||||||
|
// Need to know about each batch in the package.
|
||||||
|
struct TextureBatchDescriptor *d = NULL;
|
||||||
|
|
||||||
|
struct Texture *t = NULL;
|
||||||
|
|
||||||
|
unsigned int i;
|
||||||
|
for (i = 0; i < p -> batchNumber; i++) {
|
||||||
|
DEVIL1TEX.getbatchdesc(&d, i, filedata, filesize);
|
||||||
|
|
||||||
|
// Batch descriptor tells how many textures are in the batch.
|
||||||
|
t = (struct Texture*)
|
||||||
|
malloc(sizeof(struct Texture) * (d -> texNumber));
|
||||||
|
DEVIL1TEX.gettextures(t, i, filedata, filesize);
|
||||||
|
|
||||||
|
// There are now textures in 't'.
|
||||||
|
for (j = 0; j < d -> texNumber; j++) {
|
||||||
|
// Do whatever you want with however many of them there are.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user