@@ -58,7 +58,7 @@ class DynamicGeometryState:
5858 __slots__ = ['params' , 'time' , 'ctx' , 'module' , 'pipeline' , 'pipeline_opts' ,
5959 'raygen_grp' , 'miss_grp' , 'hit_grp' , 'sbt' ,
6060 'generate_vertices_kernel' , 'd_temp_vertices' , 'last_exploding_sphere_rebuild_time' ,
61- 'static_gas_handle ' , 'deforming_gas_handle ' , 'exploding_gas_handle ' , 'ias' ,
61+ 'static_gas ' , 'deforming_gas ' , 'exploding_gas ' , 'ias' ,
6262 'trackball' , 'camera_changed' , 'mouse_button' , 'resize_dirty' , 'minimized' ]
6363
6464 def __init__ (self ):
@@ -78,7 +78,7 @@ def camera(self):
7878
7979 @property
8080 def dimensions (self ):
81- return (int (self .params .height ), int (self .params .width ))
81+ return (int (self .params .width ), int (self .params .height ))
8282
8383class AnimationMode (enum .Enum ):
8484 NONE = 0
@@ -101,17 +101,17 @@ class AnimationMode(enum.Enum):
101101INST_COUNT = g_diffuse_colors .shape [0 ]
102102
103103g_instances = np .asarray ([
104- [1 , 0 , 0 , - 4.5 ,
105- 0 , 1 , 0 , 0 ,
104+ [1 , 0 , 0 , - 4.5 ,
105+ 0 , 1 , 0 , 0 ,
106106 0 , 0 , 1 , 0 ],
107- [1 , 0 , 0 , - 1.5 ,
108- 0 , 1 , 0 , 0 ,
107+ [1 , 0 , 0 , - 1.5 ,
108+ 0 , 1 , 0 , 0 ,
109109 0 , 0 , 1 , 0 ],
110- [1 , 0 , 0 , 1.5 ,
111- 0 , 1 , 0 , 0 ,
110+ [1 , 0 , 0 , 1.5 ,
111+ 0 , 1 , 0 , 0 ,
112112 0 , 0 , 1 , 0 ],
113- [1 , 0 , 0 , 4.5 ,
114- 0 , 1 , 0 , 0 ,
113+ [1 , 0 , 0 , 4.5 ,
114+ 0 , 1 , 0 , 0 ,
115115 0 , 0 , 1 , 0 ],
116116], dtype = np .float32 ).reshape (INST_COUNT , 3 , 4 )
117117
@@ -124,7 +124,7 @@ def mouse_button_callback(window, button, action, mods):
124124 (x , y ) = glfw .get_cursor_pos (window )
125125 if action is glfw .PRESS :
126126 state .mouse_button = button
127- state .trackball .start_tracking (int ( x ), int ( y ) )
127+ state .trackball .start_tracking (x , y )
128128 else :
129129 state .mouse_button = - 1
130130
@@ -163,7 +163,7 @@ def key_callback(window, key, scancode, action, mods):
163163
164164def scroll_callback (window , xscroll , yscroll ):
165165 state = glfw .get_window_user_pointer (window )
166- if state .trackball .wheel_event (int ( yscroll ) ):
166+ if state .trackball .wheel_event (yscroll ):
167167 state .camera_changed = True
168168
169169#------------------------------------------------------------------------------
@@ -202,11 +202,6 @@ def update_state(output_buffer, state):
202202
203203def launch_subframe (output_buffer , state ):
204204 state .params .frame_buffer = output_buffer .map ()
205-
206- print ('LAUNCH SUBFRAME' )
207- print ('state.dimensions' , state .dimensions )
208- print (f'state.output_buffer: width={ output_buffer .width } height={ output_buffer .height } ' )
209- print (f'state.params\n { state .params } ' )
210205
211206 state .pipeline .launch (state .sbt , dimensions = state .dimensions ,
212207 params = state .params .handle , stream = output_buffer .stream )
@@ -230,7 +225,7 @@ def init_camera_state(state):
230225 trackball = state .trackball
231226 trackball .move_speed = 10.0
232227 trackball .set_reference_frame ([1 ,0 ,0 ], [0 ,0 ,1 ], [0 ,1 ,0 ])
233- trackball .gimbal_lock = True
228+ trackball .reinitialize_orientation_from_camera ()
234229
235230def create_context (state ):
236231 logger = ox .Logger (log )
@@ -257,13 +252,13 @@ def update_mesh_accel(state):
257252def build_vertex_generation_kernel (state ):
258253 cuda_source = os .path .join (script_dir , 'cuda' , 'dynamic_geometry_vertex_generation.cu' )
259254 example_include_path = os .path .dirname (cuda_source )
260-
255+
261256 build_flags = ox .module .get_default_nvrtc_compile_flags () + (f'-I{ example_include_path } ' ,)
262257
263258 with open (cuda_source , 'r' ) as f :
264259 code = f .read ()
265260
266- state .generate_vertices_kernel = cp .RawKernel (code = code , backend = 'nvrtc' ,
261+ state .generate_vertices_kernel = cp .RawKernel (code = code , backend = 'nvrtc' ,
267262 options = build_flags , name = 'generate_vertices' )
268263
269264def build_mesh_accel (state ):
@@ -283,14 +278,14 @@ def build_mesh_accel(state):
283278 # Build an AS over the triangles.
284279 # We use un-indexed triangles so we can explode the sphere per triangle.
285280 build_input = ox .BuildInputTriangleArray (state .d_temp_vertices , flags = [ox .GeometryFlags .NONE ])
286- state .static_gas_handle = ox .AccelerationStructure (state .ctx , build_input ,
281+ state .static_gas = ox .AccelerationStructure (state .ctx , build_input ,
287282 compact = True , allow_update = True , random_vertex_access = True )
288283
289- state .deforming_gas_handle = state .static_gas_handle
290- state .exploding_gas_handle = state .static_gas_handle
284+ state .deforming_gas = state .static_gas
285+ state .exploding_gas = state .static_gas
291286
292- traversables = [state .static_gas_handle , state .static_gas_handle ,
293- state .deforming_gas_handle , state .exploding_gas_handle ]
287+ traversables = [state .static_gas , state .static_gas ,
288+ state .deforming_gas , state .exploding_gas ]
294289 instances = []
295290 for i in range (INST_COUNT ):
296291 instance = ox .Instance (traversable = traversables [i ], instance_id = 0 , flags = ox .InstanceFlags .NONE ,
0 commit comments