X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fterrain.cc;h=89caa6ea92a0c0cb9fdebcda2acc51c505427127;hb=1d424e50420a5b04aadb5abac2c02f4e7b797618;hp=c4db7edadf066c8618866051da4349067f8f3721;hpb=0d3454cbd5e803b8dea601110d403cd5563df9be;p=demo diff --git a/src/terrain.cc b/src/terrain.cc index c4db7ed..89caa6e 100644 --- a/src/terrain.cc +++ b/src/terrain.cc @@ -58,8 +58,8 @@ bool Terrain::generate(const TerrainParams ¶ms) data.yoffs = (float)i / (float)params.ytiles; gen_heightfield(tile.mesh, txsz, tysz, params.max_height, - params.tile_usub, params.tile_vsub, calc_height, - (void*)&data); + params.tile_usub, params.tile_vsub, calc_height, + (void *)&data); float xoffs = j * txsz - params.xsz / 2.0 + txsz / 2.0; float yoffs = i * tysz - params.ysz / 2.0 + tysz / 2.0; @@ -70,10 +70,10 @@ bool Terrain::generate(const TerrainParams ¶ms) tiles.push_back(tile); -/* - the terrain scene stores objects only - no need to fill the mat, mesh std::vectors -*/ + /* + the terrain scene stores objects only + no need to fill the mat, mesh std::vectors + */ Object *o = new Object; o->mesh = tile.mesh; o->material = &material; @@ -115,7 +115,7 @@ float Terrain::get_height(float u, float v) const sn = sn * 0.5 + 0.5; if(params.coarse_heightmap.pixels) { - Vec4 texel = params.coarse_heightmap.lookup_nearest(u, v); + Vec4 texel = params.coarse_heightmap.lookup_linear(u, v, 1.0 / params.tile_usub, 1.0 / params.tile_vsub); sn *= texel.x; } return sn; @@ -123,7 +123,7 @@ float Terrain::get_height(float u, float v) const static float calc_height(float u, float v, void *ptr) { - GenData *data = (GenData*)ptr; + GenData *data = (GenData *)ptr; const TerrainParams *tp = data->tp; u = u / tp->xtiles + data->xoffs;