Lots of trees (ugly)
This commit is contained in:
parent
a2d38044f0
commit
1f3b6a973d
2
haloo3d
2
haloo3d
@ -1 +1 @@
|
||||
Subproject commit d5cd80d67cacec466968aa846883e2dd10db3a38
|
||||
Subproject commit a30aea9dac005602b64d9591f906407bccbd88e2
|
34
terrain.c
34
terrain.c
@ -125,8 +125,9 @@ void gen_terrain(struct vec3i pos, haloo3d_obj *model,
|
||||
eprintf("Generating terrain at %d,%d\n", pos.x, pos.z);
|
||||
haloo3d_obj *tree = haloo3d_easystore_getobj(storage, TREEKEY);
|
||||
// Don't allow the model to have more than some amount of faces/vertices.
|
||||
haloo3d_obj_resetfixed(model, CHUNKVSIZE * CHUNKVSIZE * 4,
|
||||
CHUNKVSIZE * CHUNKVSIZE * 4);
|
||||
haloo3d_obj_resetfixed(model, CHUNKVSIZE * CHUNKVSIZE * 16,
|
||||
CHUNKVSIZE * CHUNKVSIZE * 16);
|
||||
// if (rand() & 3) return;
|
||||
struct vec3 landcol = haloo3d_gen_paletteuv(LANDCOL); // 0xF2C0);
|
||||
int landuv = haloo3d_obj_addvtexture(model, landcol);
|
||||
fnl_state ns = fnlCreateState();
|
||||
@ -158,13 +159,30 @@ void gen_terrain(struct vec3i pos, haloo3d_obj *model,
|
||||
haloo3d_obj_addface(model, face);
|
||||
fastface(face, landuv, br, tr, tl);
|
||||
haloo3d_obj_addface(model, face);
|
||||
}
|
||||
haloo3d_obj_addobj(model, tree,
|
||||
(struct vec3){.x = CHUNKSIZE / 2.0,
|
||||
.y = LANDHEIGHT,
|
||||
.z = CHUNKSIZE / 2.0},
|
||||
struct vec4 corn = model->vertices[bl];
|
||||
if (corn.y > 0.1) {
|
||||
float scale = 0.1 + RANDF() * 0.05;
|
||||
float height = 0.5 + RANDF() * 0.5;
|
||||
// for (int b = 1; b <= 4; b++) {
|
||||
haloo3d_obj_addobj(
|
||||
model, tree,
|
||||
(struct vec3){.x = corn.x, .y = corn.y + scale * height, .z = corn.z},
|
||||
(struct vec3)DEFAULTLOOK, (struct vec3)DEFAULTUP,
|
||||
(struct vec3){.x = 1.0, .y = 1.0, .z = 1.0});
|
||||
(struct vec3){.x = scale, .y = scale * height, .z = scale});
|
||||
//}
|
||||
// haloo3d_obj_addobj(
|
||||
// model, tree,
|
||||
// (struct vec3){
|
||||
// .x = corn.x, .y = corn.y + scale * height * 2, .z = corn.z},
|
||||
// (struct vec3)DEFAULTLOOK, (struct vec3)DEFAULTUP,
|
||||
// (struct vec3){.x = scale, .y = scale * height, .z = scale});
|
||||
}
|
||||
}
|
||||
// haloo3d_obj_addobj(
|
||||
// model, tree,
|
||||
// (struct vec3){.x = CHUNKSIZE / 2.0, .y = 1.0, .z = -CHUNKSIZE / 2.0},
|
||||
// (struct vec3)DEFAULTLOOK, (struct vec3)DEFAULTUP,
|
||||
// (struct vec3){.x = 1.0, .y = 1.0, .z = 1.0});
|
||||
haloo3d_obj_shrinktofit(model);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user