ld33_umonster
diff src/room.cc @ 6:3b4460b34d43
progress
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 23 Aug 2015 05:37:09 +0300 |
parents | 93ff21458a16 |
children |
line diff
1.1 --- a/src/room.cc Sun Aug 23 04:45:24 2015 +0300 1.2 +++ b/src/room.cc Sun Aug 23 05:37:09 2015 +0300 1.3 @@ -5,25 +5,60 @@ 1.4 #include "object.h" 1.5 #include "scene.h" 1.6 #include "meshgen.h" 1.7 +#include "revol.h" 1.8 1.9 static Scene scn; 1.10 1.11 +static const vec2_t pillar_cp[] = { 1.12 + {0.8, 10}, 1.13 + {1.2, 5.5}, 1.14 + {1, 0} 1.15 +}; 1.16 +static const BezCurve pillar_curve = { 1.17 + sizeof pillar_cp / sizeof *pillar_cp, 1.18 + (vec2_t*)pillar_cp, 1.0 1.19 +}; 1.20 + 1.21 bool init_room() 1.22 { 1.23 Matrix4x4 xform; 1.24 1.25 // generate room 1.26 Mesh *mroom = new Mesh; 1.27 - gen_box(mroom, 50, 25, 50); 1.28 - xform.set_translation(Vector3(0, 12.5, 0)); 1.29 + gen_box(mroom, ROOM_WIDTH, ROOM_HEIGHT, ROOM_LENGTH); 1.30 + xform.set_translation(Vector3(0, ROOM_HEIGHT / 2.0, 0)); 1.31 mroom->apply_xform(xform); 1.32 mroom->flip(); 1.33 1.34 Object *oroom = new Object; 1.35 oroom->set_mesh(mroom); 1.36 + oroom->mtl.diffuse = Vector3(0.5, 0.5, 0.5); 1.37 oroom->rop.cast_shadows = false; 1.38 + scn.add_object(oroom); 1.39 1.40 - scn.add_object(oroom); 1.41 + for(int i=0; i<8; i++) { 1.42 + float x = (i < 4 ? -1.0 : 1.0) * ROOM_WIDTH * 0.3; 1.43 + float z = (float)(i % 4) * 12.5 - 12.5; 1.44 + 1.45 + Mesh *mpillar = new Mesh; 1.46 + gen_revol(mpillar, 16, 3, bezier_revol, bezier_revol_normal, (void*)&pillar_curve); 1.47 + 1.48 + Mesh mtorus; 1.49 + gen_torus(&mtorus, 1.0, 0.25, 16, 8); 1.50 + Matrix4x4 xform; 1.51 + xform.set_translation(Vector3(0, 0.1, 0)); 1.52 + mtorus.apply_xform(xform, Matrix4x4::identity); 1.53 + mpillar->append(mtorus); 1.54 + 1.55 + mpillar->texcoord_gen_cylinder(); 1.56 + 1.57 + Object *opillar = new Object; 1.58 + opillar->set_mesh(mpillar); 1.59 + opillar->mtl.diffuse = Vector3(0.6, 0.6, 0.6); 1.60 + opillar->xform().set_translation(Vector3(x, 0.0, z)); 1.61 + 1.62 + scn.add_object(opillar); 1.63 + } 1.64 return true; 1.65 } 1.66