Bump engine submodule and use new math functions.

This commit is contained in:
Roz K 2022-12-20 15:39:38 +01:00
parent cdf13f50a7
commit 6eb05b27ab
Signed by: roz
GPG Key ID: 51FBF4E483E1C822
2 changed files with 29 additions and 24 deletions

2
engine

@ -1 +1 @@
Subproject commit abf1e87a3677cc01543f295df588cfa5c54db4e4 Subproject commit ccce6c5d83deb260d06bc525721e31c7c4edcabe

View File

@ -148,9 +148,10 @@ def main():
tests_environment_inputs = environment.resolve_inputs(tests_shader) tests_environment_inputs = environment.resolve_inputs(tests_shader)
sky_environment_inputs = environment.resolve_inputs(sky_shader) sky_environment_inputs = environment.resolve_inputs(sky_shader)
_rotation = mat3() blob_translation = tests_batch.params[blob_id].translation
_origin = vec3() cube_translation = tests_batch.params[cube_id].translation
_lookat = vec3() cube_orientation = tests_batch.params[cube_id].orientation
clouds_orientation = tests_batch.params[clouds_id].orientation
print("Running...") print("Running...")
start_time = time.monotonic() start_time = time.monotonic()
@ -169,18 +170,19 @@ def main():
begin_frame() begin_frame()
frame_begin = time.thread_time() frame_begin = time.thread_time()
mat3_rotation(_rotation, vec3_up, (current_time * 0.21) % tau) rotation = mat3()
mat3_mul_vec3(tests_batch.params[blob_id].translation, _rotation, blob_spawn_translation) mat3_rotation(rotation, vec3_up, (current_time * 0.21) % tau)
mat3_mul_vec3(tests_batch.params[cube_id].translation, _rotation, cube_spawn_translation) mat3_mul_vec3(blob_translation, rotation, blob_spawn_translation)
mat3_rotation(_rotation, vec3_up, (current_time * 0.43) % tau) mat3_mul_vec3(cube_translation, rotation, cube_spawn_translation)
mat3_mul_vec3(tests_batch.params[cube_id].orientation, _rotation, vec3_forward) vec3_rotate(cube_orientation, vec3_forward, vec3_up, (current_time * 0.43) % tau)
mat3_rotation(_rotation, vec3_up, (current_time * -0.037) % tau) vec3_rotate(clouds_orientation, vec3_forward, vec3_up, (current_time * -0.037) % tau)
mat3_mul_vec3(tests_batch.params[clouds_id].orientation, _rotation, vec3_forward)
mat3_rotation(_rotation, vec3_up, (current_time * 0.05) % tau) origin = vec3()
mat3_mul_vec3(_origin, _rotation, vec3(*camera_origin)) lookat = vec3()
mat3_mul_vec3(_lookat, _rotation, vec3(*camera_lookat)) mat3_rotation(rotation, vec3_up, (current_time * 0.05) % tau)
camera.set_view(_origin, _lookat) mat3_mul_vec3(origin, rotation, vec3(*camera_origin))
mat3_mul_vec3(lookat, rotation, vec3(*camera_lookat))
camera.set_view(origin, lookat)
environment.from_sun(camera.view, sun_direction, sun_power) environment.from_sun(camera.view, sun_direction, sun_power)
select_shader(terrain_shader) select_shader(terrain_shader)
@ -213,9 +215,12 @@ def main():
unselect_texture(2, normalmap) unselect_texture(2, normalmap)
unselect_shader(tests_shader) unselect_shader(tests_shader)
camera.set_view( m2km = vec3(0.001, 0.001, 0.001)
vec3(_origin.x * 0.001, _origin.y * 0.001, _origin.z * 0.001), origin_km = vec3()
vec3(_lookat.x * 0.001, _lookat.y * 0.001, _lookat.z * 0.001)) lookat_km = vec3()
vec3_mul_vec3(origin_km, origin, m2km)
vec3_mul_vec3(lookat_km, lookat, m2km)
camera.set_view(origin_km, lookat_km)
select_shader(sky_shader) select_shader(sky_shader)
camera.update_inputs(sky_camera_inputs) camera.update_inputs(sky_camera_inputs)
@ -260,13 +265,13 @@ def main():
# for x in range(10000) # for x in range(10000)
# current_time = 0 # current_time = 0
# Draw * 9999 : min = 0.21 , max = 2.16 , avg = 0.27 ms # Draw * 9999 : min = 0.2 , max = 2.31 , avg = 0.27 ms
# Draw * 9999 : min = 0.20 , max = 1.96 , avg = 0.27 ms # Draw * 9999 : min = 0.2 , max = 2.41 , avg = 0.27 ms
# Draw * 9999 : min = 0.20 , max = 2.43 , avg = 0.27 ms # Draw * 9999 : min = 0.2 , max = 2.73 , avg = 0.27 ms
# Frame * 9999 : min = 0.27 , max = 2.29 , avg = 0.38 ms # Frame * 9999 : min = 0.26 , max = 2.44 , avg = 0.38 ms
# Frame * 9999 : min = 0.26 , max = 2.08 , avg = 0.37 ms # Frame * 9999 : min = 0.26 , max = 2.54 , avg = 0.37 ms
# Frame * 9999 : min = 0.26 , max = 2.59 , avg = 0.38 ms # Frame * 9999 : min = 0.26 , max = 2.90 , avg = 0.38 ms
print("Quitting...") print("Quitting...")
del tests_batch del tests_batch