aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-30 23:40:38 +0000
committertaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-30 23:40:38 +0000
commitc566f87fe5853e4f1596792652f203c7386c8699 (patch)
tree9dfcec4bb6449d528ede9d56c638b04d5d2c48b1
parent8b6eba5edd92fcdf1ec3e2fc129f78c452abf903 (diff)
Plumbing :)
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@199 84d2e878-0bd5-11dd-ad15-13eda11d74c5
-rw-r--r--data/Makefile.am3
-rw-r--r--data/models/pipe-horiz72
-rw-r--r--data/models/walle-hole69
-rw-r--r--data/rooms/00-00-012
-rw-r--r--data/rooms/00-00-022
-rw-r--r--data/rooms/00-00-034
-rw-r--r--data/rooms/00-00-043
-rw-r--r--data/rooms/00-01-043
-rw-r--r--data/rooms/00-02-043
-rw-r--r--src/game.c2
-rw-r--r--src/obj2model.c29
11 files changed, 184 insertions, 8 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index 1c3afd6..f4ec188 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,6 +1,7 @@
modelsdir = $(datadir)/thrust3d/models
models_DATA = models/floor models/lander models/randombox models/walle models/walln models/wallw models/walls \
- models/platform models/ceiling models/tiledfloor models/pipe models/lander-coll
+ models/platform models/ceiling models/tiledfloor models/pipe models/lander-coll models/walle-hole \
+ models/pipe-horiz
shadersdir = $(datadir)/thrust3d/shaders
shaders_DATA = shaders/lighting.vert shaders/lighting.frag shaders/swirlytron.vert shaders/swirlytron.frag
diff --git a/data/models/pipe-horiz b/data/models/pipe-horiz
new file mode 100644
index 0000000..4e08368
--- /dev/null
+++ b/data/models/pipe-horiz
@@ -0,0 +1,72 @@
+# source-material/models/pipe-horiz.obj
+
+QUADS
+ +0.462 -5.000 -0.191 0.000 0.000 +0.924 +0.000 -0.383
+ +0.354 -5.000 -0.354 0.000 0.000 +0.707 +0.000 -0.707
+ +0.354 +5.000 -0.354 0.000 0.000 +0.707 +0.000 -0.707
+ +0.462 +5.000 -0.191 0.000 0.000 +0.924 +0.000 -0.383
+ +0.500 -5.000 +0.000 0.000 0.000 +1.000 +0.000 +0.000
+ +0.462 -5.000 -0.191 0.000 0.000 +0.924 +0.000 -0.383
+ +0.462 +5.000 -0.191 0.000 0.000 +0.924 +0.000 -0.383
+ +0.500 +5.000 -0.000 0.000 0.000 +1.000 +0.000 +0.000
+ +0.462 -5.000 +0.191 0.000 0.000 +0.924 +0.000 +0.383
+ +0.500 -5.000 +0.000 0.000 0.000 +1.000 +0.000 +0.000
+ +0.500 +5.000 -0.000 0.000 0.000 +1.000 +0.000 +0.000
+ +0.462 +5.000 +0.191 0.000 0.000 +0.924 +0.000 +0.383
+ +0.354 -5.000 +0.354 0.000 0.000 +0.707 +0.000 +0.707
+ +0.462 -5.000 +0.191 0.000 0.000 +0.924 +0.000 +0.383
+ +0.462 +5.000 +0.191 0.000 0.000 +0.924 +0.000 +0.383
+ +0.354 +5.000 +0.354 0.000 0.000 +0.707 +0.000 +0.707
+ +0.191 -5.000 +0.462 0.000 0.000 +0.383 +0.000 +0.924
+ +0.354 -5.000 +0.354 0.000 0.000 +0.707 +0.000 +0.707
+ +0.354 +5.000 +0.354 0.000 0.000 +0.707 +0.000 +0.707
+ +0.191 +5.000 +0.462 0.000 0.000 +0.383 +0.000 +0.924
+ +0.000 -5.000 +0.500 0.000 0.000 +0.000 +0.000 +1.000
+ +0.191 -5.000 +0.462 0.000 0.000 +0.383 +0.000 +0.924
+ +0.191 +5.000 +0.462 0.000 0.000 +0.383 +0.000 +0.924
+ +0.000 +5.000 +0.500 0.000 0.000 +0.000 +0.000 +1.000
+ -0.191 -5.000 +0.462 0.000 0.000 -0.383 +0.000 +0.924
+ +0.000 -5.000 +0.500 0.000 0.000 +0.000 +0.000 +1.000
+ +0.000 +5.000 +0.500 0.000 0.000 +0.000 +0.000 +1.000
+ -0.191 +5.000 +0.462 0.000 0.000 -0.383 +0.000 +0.924
+ -0.354 -5.000 +0.354 0.000 0.000 -0.707 +0.000 +0.707
+ -0.191 -5.000 +0.462 0.000 0.000 -0.383 +0.000 +0.924
+ -0.191 +5.000 +0.462 0.000 0.000 -0.383 +0.000 +0.924
+ -0.354 +5.000 +0.354 0.000 0.000 -0.707 +0.000 +0.707
+ -0.462 -5.000 +0.191 0.000 0.000 -0.924 +0.000 +0.383
+ -0.354 -5.000 +0.354 0.000 0.000 -0.707 +0.000 +0.707
+ -0.354 +5.000 +0.354 0.000 0.000 -0.707 +0.000 +0.707
+ -0.462 +5.000 +0.191 0.000 0.000 -0.924 +0.000 +0.383
+ -0.500 -5.000 -0.000 0.000 0.000 -1.000 +0.000 +0.000
+ -0.462 -5.000 +0.191 0.000 0.000 -0.924 +0.000 +0.383
+ -0.462 +5.000 +0.191 0.000 0.000 -0.924 +0.000 +0.383
+ -0.500 +5.000 -0.000 0.000 0.000 -1.000 +0.000 +0.000
+ -0.462 -5.000 -0.191 0.000 0.000 -0.924 +0.000 -0.383
+ -0.500 -5.000 -0.000 0.000 0.000 -1.000 +0.000 +0.000
+ -0.500 +5.000 -0.000 0.000 0.000 -1.000 +0.000 +0.000
+ -0.462 +5.000 -0.191 0.000 0.000 -0.924 +0.000 -0.383
+ -0.354 -5.000 -0.354 0.000 0.000 -0.707 +0.000 -0.707
+ -0.462 -5.000 -0.191 0.000 0.000 -0.924 +0.000 -0.383
+ -0.462 +5.000 -0.191 0.000 0.000 -0.924 +0.000 -0.383
+ -0.354 +5.000 -0.354 0.000 0.000 -0.707 +0.000 -0.707
+ -0.191 -5.000 -0.462 0.000 0.000 -0.383 +0.000 -0.924
+ -0.354 -5.000 -0.354 0.000 0.000 -0.707 +0.000 -0.707
+ -0.354 +5.000 -0.354 0.000 0.000 -0.707 +0.000 -0.707
+ -0.191 +5.000 -0.462 0.000 0.000 -0.383 +0.000 -0.924
+ +0.000 -5.000 -0.500 0.000 0.000 +0.000 +0.000 -1.000
+ -0.191 -5.000 -0.462 0.000 0.000 -0.383 +0.000 -0.924
+ -0.191 +5.000 -0.462 0.000 0.000 -0.383 +0.000 -0.924
+ +0.000 +5.000 -0.500 0.000 0.000 +0.000 +0.000 -1.000
+ +0.191 -5.000 -0.462 0.000 0.000 +0.383 +0.000 -0.924
+ +0.000 -5.000 -0.500 0.000 0.000 +0.000 +0.000 -1.000
+ +0.000 +5.000 -0.500 0.000 0.000 +0.000 +0.000 -1.000
+ +0.191 +5.000 -0.462 0.000 0.000 +0.383 +0.000 -0.924
+ +0.354 -5.000 -0.354 0.000 0.000 +0.707 +0.000 -0.707
+ +0.191 -5.000 -0.462 0.000 0.000 +0.383 +0.000 -0.924
+ +0.191 +5.000 -0.462 0.000 0.000 +0.383 +0.000 -0.924
+ +0.354 +5.000 -0.354 0.000 0.000 +0.707 +0.000 -0.707
+ +0.354 -5.000 -0.354 0.000 0.000 +0.707 +0.000 -0.707
+ +0.191 -5.000 -0.462 0.000 0.000 +0.383 +0.000 -0.924
+ +0.191 +5.000 -0.462 0.000 0.000 +0.383 +0.000 -0.924
+ +0.354 +5.000 -0.354 0.000 0.000 +0.707 +0.000 -0.707
+
diff --git a/data/models/walle-hole b/data/models/walle-hole
new file mode 100644
index 0000000..d8e0eae
--- /dev/null
+++ b/data/models/walle-hole
@@ -0,0 +1,69 @@
+# source-material/models/walle-hole.obj
+
+QUADS
+ -0.000 -2.500 +5.000 1.000 0.250 -1.000 -0.000 -0.000
+ -0.000 -2.500 +2.500 0.750 0.250 -1.000 -0.000 -0.000
+ +0.000 -5.000 +2.500 0.750 0.000 -1.000 -0.000 -0.000
+ -0.000 -5.000 +5.000 1.000 0.000 -1.000 -0.000 -0.000
+ -0.000 +0.000 +5.000 1.000 0.500 -1.000 -0.000 -0.000
+ -0.000 +0.000 +2.500 0.750 0.500 -1.000 -0.000 -0.000
+ -0.000 -2.500 +2.500 0.750 0.250 -1.000 -0.000 -0.000
+ -0.000 -2.500 +5.000 1.000 0.250 -1.000 -0.000 -0.000
+ -0.000 -2.500 +2.500 0.750 0.250 -1.000 -0.000 -0.000
+ -0.000 -2.500 +0.000 0.500 0.250 -1.000 -0.000 -0.000
+ -0.000 -5.000 +0.000 0.500 0.000 -1.000 -0.000 -0.000
+ +0.000 -5.000 +2.500 0.750 0.000 -1.000 -0.000 -0.000
+ -0.000 +0.000 +2.500 0.750 0.500 -1.000 -0.000 -0.000
+ -0.000 +0.000 +0.000 0.500 0.500 -1.000 -0.000 -0.000
+ -0.000 -2.500 +0.000 0.500 0.250 -1.000 -0.000 -0.000
+ -0.000 -2.500 +2.500 0.750 0.250 -1.000 -0.000 -0.000
+ -0.000 +2.500 +5.000 1.000 0.750 -1.000 -0.000 -0.000
+ -0.000 +2.500 +2.500 0.750 0.750 -1.000 -0.000 -0.000
+ -0.000 +0.000 +2.500 0.750 0.500 -1.000 -0.000 -0.000
+ -0.000 +0.000 +5.000 1.000 0.500 -1.000 -0.000 -0.000
+ -0.000 +5.000 +5.000 1.000 1.000 -1.000 -0.000 -0.000
+ -0.000 +5.000 +2.500 0.750 1.000 -1.000 -0.000 -0.000
+ -0.000 +2.500 +2.500 0.750 0.750 -1.000 -0.000 -0.000
+ -0.000 +2.500 +5.000 1.000 0.750 -1.000 -0.000 -0.000
+ -0.000 +5.000 +2.500 0.750 1.000 -1.000 -0.000 -0.000
+ -0.000 +5.000 -0.000 0.500 1.000 -1.000 -0.000 -0.000
+ -0.000 +2.500 -0.000 0.500 0.750 -1.000 -0.000 -0.000
+ -0.000 +2.500 +2.500 0.750 0.750 -1.000 -0.000 -0.000
+ -0.000 -2.500 +0.000 0.500 0.250 -1.000 -0.000 -0.000
+ +0.000 -2.500 -2.500 0.250 0.250 -1.000 -0.000 -0.000
+ +0.000 -5.000 -2.500 0.250 0.000 -1.000 -0.000 -0.000
+ -0.000 -5.000 +0.000 0.500 0.000 -1.000 -0.000 -0.000
+ -0.000 +0.000 +0.000 0.500 0.500 -1.000 -0.000 -0.000
+ +0.000 -0.000 -2.500 0.250 0.500 -1.000 -0.000 -0.000
+ +0.000 -2.500 -2.500 0.250 0.250 -1.000 -0.000 -0.000
+ -0.000 -2.500 +0.000 0.500 0.250 -1.000 -0.000 -0.000
+ +0.000 -2.500 -2.500 0.250 0.250 -1.000 -0.000 -0.000
+ +0.000 -2.500 -5.000 0.000 0.250 -1.000 -0.000 -0.000
+ +0.000 -5.000 -5.000 0.000 0.000 -1.000 -0.000 -0.000
+ +0.000 -5.000 -2.500 0.250 0.000 -1.000 -0.000 -0.000
+ +0.000 -0.000 -2.500 0.250 0.500 -1.000 -0.000 -0.000
+ +0.000 -0.000 -5.000 0.000 0.500 -1.000 -0.000 -0.000
+ +0.000 -2.500 -5.000 0.000 0.250 -1.000 -0.000 -0.000
+ +0.000 -2.500 -2.500 0.250 0.250 -1.000 -0.000 -0.000
+ -0.000 +2.500 -0.000 0.500 0.750 -1.000 -0.000 -0.000
+ +0.000 +2.500 -2.500 0.250 0.750 -1.000 -0.000 -0.000
+ +0.000 -0.000 -2.500 0.250 0.500 -1.000 -0.000 -0.000
+ -0.000 +0.000 +0.000 0.500 0.500 -1.000 -0.000 -0.000
+ -0.000 +5.000 -0.000 0.500 1.000 -1.000 -0.000 -0.000
+ -0.000 +5.000 -2.500 0.250 1.000 -1.000 -0.000 -0.000
+ +0.000 +2.500 -2.500 0.250 0.750 -1.000 -0.000 -0.000
+ -0.000 +2.500 -0.000 0.500 0.750 -1.000 -0.000 -0.000
+ +0.000 +2.500 -2.500 0.250 0.750 -1.000 -0.000 -0.000
+ +0.000 +2.500 -5.000 0.000 0.750 -1.000 -0.000 -0.000
+ +0.000 -0.000 -5.000 0.000 0.500 -1.000 -0.000 -0.000
+ +0.000 -0.000 -2.500 0.250 0.500 -1.000 -0.000 -0.000
+ -0.000 +5.000 -2.500 0.250 1.000 -1.000 -0.000 -0.000
+ +0.000 +5.000 -5.000 0.000 1.000 -1.000 -0.000 -0.000
+ +0.000 +2.500 -5.000 0.000 0.750 -1.000 -0.000 -0.000
+ +0.000 +2.500 -2.500 0.250 0.750 -1.000 -0.000 -0.000
+ -0.000 +5.000 -2.500 0.250 1.000 -1.000 -0.000 -0.000
+ +0.000 +5.000 -5.000 0.000 1.000 -1.000 -0.000 -0.000
+ +0.000 +2.500 -5.000 0.000 0.750 -1.000 -0.000 -0.000
+ +0.000 +2.500 -2.500 0.250 0.750 -1.000 -0.000 -0.000
+texture tiledwall
+
diff --git a/data/rooms/00-00-01 b/data/rooms/00-00-01
index 359e16a..b3b8c9c 100644
--- a/data/rooms/00-00-01
+++ b/data/rooms/00-00-01
@@ -8,5 +8,7 @@ walle 5.0 0.0 0.0
walln 0.0 5.0 0.0
walls 0.0 -5.0 0.0
+pipe-horiz -3.5 0.0 0.0
+
comment Ventilation shaft
diff --git a/data/rooms/00-00-02 b/data/rooms/00-00-02
index df1b45e..97a6b51 100644
--- a/data/rooms/00-00-02
+++ b/data/rooms/00-00-02
@@ -8,5 +8,7 @@ walle 5.0 0.0 0.0
walln 0.0 5.0 0.0
walls 0.0 -5.0 0.0
+pipe-horiz 3.5 0.0 0.0
+
comment Ventilation shaft
diff --git a/data/rooms/00-00-03 b/data/rooms/00-00-03
index 845b22d..af2f925 100644
--- a/data/rooms/00-00-03
+++ b/data/rooms/00-00-03
@@ -4,9 +4,11 @@ connected 00 00 02
connected 00 00 04
wallw -5.0 0.0 0.0
-walle 5.0 0.0 0.0
+walle-hole 5.0 0.0 0.0
walln 0.0 5.0 0.0
walls 0.0 -5.0 0.0
+pipe-horiz 0.5 0.0 0.0
+
comment Ventilation shaft
diff --git a/data/rooms/00-00-04 b/data/rooms/00-00-04
index d733b3b..431ff82 100644
--- a/data/rooms/00-00-04
+++ b/data/rooms/00-00-04
@@ -8,5 +8,8 @@ walle 5.0 0.0 0.0
walls 0.0 -5.0 0.0
ceiling 0.0 0.0 5.0
+pipe-horiz -3.5 0.0 4.2
+pipe-horiz 3.5 0.0 0.0
+
comment Top of ventilation shaft
diff --git a/data/rooms/00-01-04 b/data/rooms/00-01-04
index 39a06f7..54455f0 100644
--- a/data/rooms/00-01-04
+++ b/data/rooms/00-01-04
@@ -8,5 +8,8 @@ walle 5.0 0.0 0.0
ceiling 0.0 0.0 5.0
tiledfloor 0.0 0.0 -5.0
+pipe-horiz -3.5 0.0 4.2
+pipe-horiz 3.5 0.0 0.0
+
comment Ventilation shaft
diff --git a/data/rooms/00-02-04 b/data/rooms/00-02-04
index ccfa00a..34884bf 100644
--- a/data/rooms/00-02-04
+++ b/data/rooms/00-02-04
@@ -14,5 +14,8 @@ pipe -4.5 -1.0 -5.0
pipe -4.5 1.0 -5.0
pipe 4.5 3.0 -5.0
+pipe-horiz -3.5 0.0 4.2
+pipe-horiz 3.5 0.0 0.0
+
comment Ventilation shaft
diff --git a/src/game.c b/src/game.c
index edf8a7d..ae9ff2c 100644
--- a/src/game.c
+++ b/src/game.c
@@ -26,7 +26,7 @@
#define MAX_OBJECTS 100
/* Maximum indicies of the rooms - remember they start at zero */
-#define MAX_ROOM_X 0
+#define MAX_ROOM_X 1
#define MAX_ROOM_Y 2
#define MAX_ROOM_Z 4
diff --git a/src/obj2model.c b/src/obj2model.c
index 4bf6d48..d58786e 100644
--- a/src/obj2model.c
+++ b/src/obj2model.c
@@ -27,11 +27,13 @@ int main(int argc, char *argv[]) {
FILE *out;
float vtmp[3*MAX_VERTICES];
float vntmp[3*MAX_VERTICES];
+ float textmp[2*MAX_VERTICES];
int v_used[MAX_VERTICES];
int vn_used[MAX_VERTICES];
- int n_vtmp, n_vntmp;
+ int tex_used[MAX_VERTICES];
+ int n_vtmp, n_vntmp, n_textmp;
int nprev;
- int i, v_unused, vn_unused;
+ int i, v_unused, vn_unused, tex_unused;
fh = fopen(argv[1], "r");
if ( fh == NULL ) {
@@ -42,10 +44,12 @@ int main(int argc, char *argv[]) {
for ( i=0; i<MAX_VERTICES; i++ ) {
v_used[i] = 5;
vn_used[i] = 5;
+ tex_used[i] = 5;
}
/* Zip through and find all the vertices */
n_vtmp = 0;
+ n_textmp = 0;
n_vntmp = 0;
while ( !feof(fh) ) {
@@ -80,6 +84,14 @@ int main(int argc, char *argv[]) {
n_vntmp++;
continue;
}
+
+ if ( sscanf(line+s, "vt %f %f %f\n", &x, &y, &z) == 3 ) {
+ textmp[2*n_textmp+0] = x;
+ textmp[2*n_textmp+1] = y;
+ tex_used[n_textmp] = 0;
+ n_textmp++;
+ continue;
+ }
}
@@ -123,7 +135,7 @@ int main(int argc, char *argv[]) {
for ( i=1; i<n; i++ ) {
char **sp;
- int np, nnum, j, nslash;
+ int np, j, nslash;
nslash = 0;
for ( j=0; j<strlen(bits[i]); j++ ) {
@@ -131,7 +143,7 @@ int main(int argc, char *argv[]) {
}
if ( nslash == 2 ) {
- int vnum;
+ int vnum, tnum, nnum;
np = assplode(bits[i], "/", &sp, ASSPLODE_DUPS);
if ( np != 3 ) {
@@ -139,6 +151,7 @@ int main(int argc, char *argv[]) {
continue;
}
vnum = atoi(sp[0])-1;
+ tnum = atoi(sp[1])-1;
nnum = atoi(sp[2])-1;
if ( vnum >= n_vtmp ) {
fprintf(stderr, "Vertex index is too high (%i/%i)\n", vnum, n_vtmp);
@@ -150,10 +163,11 @@ int main(int argc, char *argv[]) {
}
fprintf(out, "%+8.3f %+8.3f %+8.3f %8.3f %8.3f %+8.3f %+8.3f %+8.3f\n",
vtmp[3*vnum+0], vtmp[3*vnum+1], vtmp[3*vnum+2],
- 0.0, 0.0,
+ textmp[2*tnum+0], textmp[2*tnum+1],
vntmp[3*nnum+0], vntmp[3*nnum+1], vntmp[3*nnum+2]);
v_used[vnum] = 1;
vn_used[nnum] = 1;
+ tex_used[tnum] = 1;
free(sp[0]);
free(sp[1]);
free(sp[2]);
@@ -185,6 +199,7 @@ int main(int argc, char *argv[]) {
v_unused = 0;
vn_unused = 0;
+ tex_unused = 0;
for ( i=0; i<MAX_VERTICES; i++ ) {
if ( v_used[i] == 0 ) {
v_unused++;
@@ -192,9 +207,13 @@ int main(int argc, char *argv[]) {
if ( vn_used[i] == 0 ) {
vn_unused++;
}
+ if ( tex_used[i] == 0 ) {
+ tex_unused++;
+ }
}
printf("%i vertices (%i unused)\n", n_vtmp, v_unused);
printf("%i normals (%i unused)\n", n_vntmp, vn_unused);
+ printf("%i texcoords (%i unused)\n", n_textmp, tex_unused);
return 0;