mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2025-05-31 14:11:42 +05:30
Implemented getTextureBatch()
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "devil1tex.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void printtph (struct TexturePack *tp) {
|
||||
@@ -55,3 +56,23 @@ void gettbd (struct TextureBatchDescriptor **descriptors,
|
||||
return;
|
||||
}
|
||||
|
||||
void gettexturebatch(struct TextureBatch **tb,
|
||||
const char *filedata,
|
||||
unsigned int filesize) {
|
||||
struct TexturePack *tp = (struct TexturePack*)filedata;
|
||||
struct TextureBatchDescriptor **bds = NULL;
|
||||
bds = (struct TextureBatchDescriptor**)malloc(tp -> batchNumber);
|
||||
gettbd(bds, filedata, filesize);
|
||||
unsigned int offset = tp -> firstBatchOffset;
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
// TextureBatch shares a starting address with the first texture
|
||||
// and shares the ending address with the last texture.
|
||||
for (i = 0; i < tp -> batchNumber; i++) {
|
||||
printf("%x \n", offset);
|
||||
tb[i] = (struct TextureBatch*)filedata + offset;
|
||||
// the next texture batch is TextureSize * number of textures away.
|
||||
offset += bds[i] -> textureSize * (bds[i] -> texNumber);
|
||||
}
|
||||
free(bds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user