.PHONY: clean-libs
clean-libs:
$(MAKE) -C libs clean
+
+.PHONY: data
+data:
+ tools/procdata
obj = src/aabox.o src/chunk.o src/dynarr.o src/extmesh.o src/g3danm.o \
src/g3dscn.o src/goat3d.o src/log.o src/read.o src/track.o src/write.o \
- src/util.o
+ src/readgltf.o src/util.o src/json.o
alib = ../unix/goat3d.a
CFLAGS = -O3 -g -Iinclude -I../treestor/include -I..
if((g3dimpl_loadgltf(g, io)) == 0) {
return 0;
}
+ io->seek(0, SEEK_SET, io->cls);
tsio.data = io->cls;
tsio.read = io->read;
static int ginit(void)
{
- int i, j, num, nfaces;
+ int i, num, nfaces;
int *idxarr;
float *varr, *narr, *uvarr;
float xform[16];
- if(!(gscn = goat3d_create()) || goat3d_load(gscn, "data/track1.g3d")) {
+ if(!(gscn = goat3d_create()) || goat3d_load(gscn, "data/level1.g3d")) {
return -1;
}
num = goat3d_get_node_count(gscn);
for(i=0; i<num; i++) {
struct goat3d_node *node = goat3d_get_node(gscn, i);
+ if(match_prefix(goat3d_get_node_name(node), "portal_")) {
+ continue;
+ }
if(goat3d_get_node_type(node) == GOAT3D_NODE_MESH) {
struct goat3d_mesh *mesh = goat3d_get_node_object(node);
memcpy(res, s, len + 1);
return res;
}
+
+
+int match_prefix(const char *str, const char *prefix)
+{
+ while(*str && *prefix) {
+ if(*str++ != *prefix++) {
+ return 0;
+ }
+ }
+ return *prefix ? 0 : 1;
+}
#define strdup_nf(s) strdup_nf_impl(s, __FILE__, __LINE__)
char *strdup_nf_impl(const char *s, const char *file, int line);
+int match_prefix(const char *str, const char *prefix);
+
#endif /* UTIL_H_ */
#!/bin/sh
-[ ! -e data/track1.g3d -o datasrc/track1.gltf -nt data/track1.g3d ] && \
- ass2goat datasrc/track1.gltf && mv datasrc/track1.goat3d data/track1.g3d
+[ ! -e data/level1.g3d -o datasrc/level1.gltf -nt data/level1.g3d ] && \
+ ass2goat datasrc/level1.gltf && mv datasrc/level1.goat3d data/level1.g3d
+
+exit 0