Compare commits
No commits in common. "7c1f85e03f0a6b903466a414da0bf819a2a199b8" and "9dd97baee81f6f140a6834674539775cecf9c994" have entirely different histories.
7c1f85e03f
...
9dd97baee8
2
engine
2
engine
@ -1 +1 @@
|
||||
Subproject commit eaff99a5b61355f2c6fa138eb54feb654ba24e78
|
||||
Subproject commit ddb9b0598f182ad84ef3f5501ac3934eb7959578
|
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_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')
|
||||
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')
|
||||
terrain_batch = batch.Batch(tiles_vertices, generated.size ** 2, params_format(PARAM_FORMAT_VEC3_SHORT))
|
||||
|
||||
#TODO: generator & for real
|
||||
@ -90,40 +90,42 @@ def main():
|
||||
if h == 0.0:
|
||||
continue
|
||||
if r > 0.0:
|
||||
model = water_model
|
||||
model = water
|
||||
elif h < 2.0:
|
||||
model = sand_model
|
||||
model = sand
|
||||
elif h < 180:
|
||||
if nz > 0.9:
|
||||
if ny < -0.01 and nz > 0.93:
|
||||
model = forest_model
|
||||
model = forest
|
||||
else:
|
||||
model = grass_model
|
||||
model = grass
|
||||
else:
|
||||
model = rock_model
|
||||
model = rock
|
||||
elif vd < vr - 3.0 and nz > 0.999:
|
||||
model = lava_model
|
||||
model = lava
|
||||
elif vd < vr + 2.0:
|
||||
model = mud_model
|
||||
model = mud
|
||||
elif vd < vr + 6.0 and nz < 0.67:
|
||||
model = mud_model
|
||||
model = mud
|
||||
else:
|
||||
model = rock_model
|
||||
model = rock
|
||||
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_model = archive.get_model('blob')
|
||||
cube_model = archive.get_model('cube')
|
||||
clouds_model = archive.get_model('clouds')
|
||||
blob = archive.get_model('blob')
|
||||
cube = archive.get_model('cube')
|
||||
clouds = 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_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)
|
||||
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)
|
||||
|
||||
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'))
|
||||
@ -143,8 +145,7 @@ def main():
|
||||
tests_environment_inputs = environment.resolve_inputs(tests_shader)
|
||||
sky_environment_inputs = environment.resolve_inputs(sky_shader)
|
||||
|
||||
_forward = vec3(vec3_forward)
|
||||
_up = vec3(vec3_up)
|
||||
up = vec3(vec3_up)
|
||||
_rotation = mat3()
|
||||
_origin = vec3()
|
||||
_lookat = vec3()
|
||||
@ -170,20 +171,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_spawn_translation)
|
||||
mat3_rotation(_rotation, up, (current_time * 0.21) % tau)
|
||||
mat3_mul_vec3(_blob_translation, _rotation, blob_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_spawn_translation)
|
||||
mat3_mul_vec3(_cube_translation, _rotation, cube_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, _forward)
|
||||
mat3_rotation(_rotation, up, (current_time * 0.43) % tau)
|
||||
mat3_mul_vec3(_cube_orientation, _rotation, cube_orientation)
|
||||
tests_batch.set_param(1, cube_id, _cube_orientation)
|
||||
mat3_rotation(_rotation, _up, (current_time * -0.037) % tau)
|
||||
mat3_mul_vec3(_clouds_orientation, _rotation, _forward)
|
||||
mat3_rotation(_rotation, up, (current_time * -0.037) % tau)
|
||||
mat3_mul_vec3(_clouds_orientation, _rotation, clouds_orientation)
|
||||
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