Cleanup: some renaming.
This commit is contained in:
parent
0e6183011e
commit
7c1f85e03f
69
game/game.py
69
game/game.py
@ -71,13 +71,13 @@ def main():
|
||||
tiles_texture = archive.get_texture('tiles')
|
||||
tiles_sampler = resolve_input(terrain_shader, b'u_texture_sampler')
|
||||
tiles_vertices = archive.get_vertices('tiles')
|
||||
water = archive.get_model('water')
|
||||
sand = archive.get_model('sand')
|
||||
grass = archive.get_model('grass')
|
||||
forest = archive.get_model('forest')
|
||||
rock = archive.get_model('rock')
|
||||
mud = archive.get_model('mud')
|
||||
lava = archive.get_model('lava')
|
||||
water_model = archive.get_model('water')
|
||||
sand_model = archive.get_model('sand')
|
||||
grass_model = archive.get_model('grass')
|
||||
forest_model = archive.get_model('forest')
|
||||
rock_model = archive.get_model('rock')
|
||||
mud_model = archive.get_model('mud')
|
||||
lava_model = archive.get_model('lava')
|
||||
terrain_batch = batch.Batch(tiles_vertices, generated.size ** 2, params_format(PARAM_FORMAT_VEC3_SHORT))
|
||||
|
||||
#TODO: generator & for real
|
||||
@ -90,42 +90,40 @@ def main():
|
||||
if h == 0.0:
|
||||
continue
|
||||
if r > 0.0:
|
||||
model = water
|
||||
model = water_model
|
||||
elif h < 2.0:
|
||||
model = sand
|
||||
model = sand_model
|
||||
elif h < 180:
|
||||
if nz > 0.9:
|
||||
if ny < -0.01 and nz > 0.93:
|
||||
model = forest
|
||||
model = forest_model
|
||||
else:
|
||||
model = grass
|
||||
model = grass_model
|
||||
else:
|
||||
model = rock
|
||||
model = rock_model
|
||||
elif vd < vr - 3.0 and nz > 0.999:
|
||||
model = lava
|
||||
model = lava_model
|
||||
elif vd < vr + 2.0:
|
||||
model = mud
|
||||
model = mud_model
|
||||
elif vd < vr + 6.0 and nz < 0.67:
|
||||
model = mud
|
||||
model = mud_model
|
||||
else:
|
||||
model = rock
|
||||
model = rock_model
|
||||
model.spawn(terrain_batch, (float(((mx - 128) * 8) + 4), float(((127 - my) * 8) + 4), 0.0))
|
||||
|
||||
tests_texture = archive.get_texture('tests')
|
||||
tests_sampler = resolve_input(tests_shader, b'u_texture_sampler')
|
||||
tests_vertices = archive.get_vertices('tests')
|
||||
blob = archive.get_model('blob')
|
||||
cube = archive.get_model('cube')
|
||||
clouds = archive.get_model('clouds')
|
||||
blob_model = archive.get_model('blob')
|
||||
cube_model = archive.get_model('cube')
|
||||
clouds_model = archive.get_model('clouds')
|
||||
tests_batch = batch.Batch(tests_vertices, 3,
|
||||
params_format(PARAM_FORMAT_VEC3_FLOAT, PARAM_FORMAT_VEC3_INT10 | PARAM_FORMAT_NORMALIZE))
|
||||
blob_translation = vec3((-100.0, -500.0, 0.0))
|
||||
cube_translation = vec3((100.0, -500.0, 0.0))
|
||||
cube_orientation = vec3(vec3_forward)
|
||||
clouds_orientation = vec3(vec3_forward)
|
||||
blob_id = blob.spawn(tests_batch, blob_translation, vec3_forward)
|
||||
cube_id = cube.spawn(tests_batch, cube_translation, cube_orientation)
|
||||
clouds_id = clouds.spawn(tests_batch, (0.0, 0.0, 32.0), clouds_orientation)
|
||||
blob_spawn_translation = vec3((-100.0, -500.0, 0.0))
|
||||
cube_spawn_translation = vec3((100.0, -500.0, 0.0))
|
||||
blob_id = blob_model.spawn(tests_batch, blob_spawn_translation, vec3_forward)
|
||||
cube_id = cube_model.spawn(tests_batch, cube_spawn_translation, vec3_forward)
|
||||
clouds_id = clouds_model.spawn(tests_batch, (0.0, 0.0, 32.0), vec3_forward)
|
||||
|
||||
sea_phase = resolve_input(sky_shader, b'u_sea_phase')
|
||||
sea_polar_textures = sea.load_polar_textures(('data/sea_bump1.png', 'data/sea_bump2.png'))
|
||||
@ -145,7 +143,8 @@ def main():
|
||||
tests_environment_inputs = environment.resolve_inputs(tests_shader)
|
||||
sky_environment_inputs = environment.resolve_inputs(sky_shader)
|
||||
|
||||
up = vec3(vec3_up)
|
||||
_forward = vec3(vec3_forward)
|
||||
_up = vec3(vec3_up)
|
||||
_rotation = mat3()
|
||||
_origin = vec3()
|
||||
_lookat = vec3()
|
||||
@ -171,20 +170,20 @@ def main():
|
||||
begin_frame()
|
||||
frame_begin = time.thread_time()
|
||||
|
||||
mat3_rotation(_rotation, up, (current_time * 0.21) % tau)
|
||||
mat3_mul_vec3(_blob_translation, _rotation, blob_translation)
|
||||
mat3_rotation(_rotation, _up, (current_time * 0.21) % tau)
|
||||
mat3_mul_vec3(_blob_translation, _rotation, blob_spawn_translation)
|
||||
tests_batch.set_param(0, blob_id, _blob_translation)
|
||||
tests_batch.set_param(1, blob_id, vec3(math.vec3_normalize((sun_direction[0], sun_direction[1], 0.0))))
|
||||
mat3_mul_vec3(_cube_translation, _rotation, cube_translation)
|
||||
mat3_mul_vec3(_cube_translation, _rotation, cube_spawn_translation)
|
||||
tests_batch.set_param(0, cube_id, _cube_translation)
|
||||
mat3_rotation(_rotation, up, (current_time * 0.43) % tau)
|
||||
mat3_mul_vec3(_cube_orientation, _rotation, cube_orientation)
|
||||
mat3_rotation(_rotation, _up, (current_time * 0.43) % tau)
|
||||
mat3_mul_vec3(_cube_orientation, _rotation, _forward)
|
||||
tests_batch.set_param(1, cube_id, _cube_orientation)
|
||||
mat3_rotation(_rotation, up, (current_time * -0.037) % tau)
|
||||
mat3_mul_vec3(_clouds_orientation, _rotation, clouds_orientation)
|
||||
mat3_rotation(_rotation, _up, (current_time * -0.037) % tau)
|
||||
mat3_mul_vec3(_clouds_orientation, _rotation, _forward)
|
||||
tests_batch.set_param(1, clouds_id, _clouds_orientation)
|
||||
|
||||
mat3_rotation(_rotation, up, (current_time * 0.05) % tau)
|
||||
mat3_rotation(_rotation, _up, (current_time * 0.05) % tau)
|
||||
mat3_mul_vec3(_origin, _rotation, vec3(camera_origin))
|
||||
mat3_mul_vec3(_lookat, _rotation, vec3(camera_lookat))
|
||||
camera.set_view(_origin, _lookat)
|
||||
|
Loading…
Reference in New Issue
Block a user