@@ -220,6 +220,7 @@ def display_subframe(output_buffer, gl_display, window):
220220 framebuf_res_x , framebuf_res_y ,
221221 output_buffer .get_pbo () )
222222
223+
223224def init_camera_state (state ):
224225 camera = state .camera
225226 camera .eye = (0 , 1 , - 20 )
@@ -233,12 +234,14 @@ def init_camera_state(state):
233234 trackball .set_reference_frame ([1 ,0 ,0 ], [0 ,0 ,1 ], [0 ,1 ,0 ])
234235 trackball .reinitialize_orientation_from_camera ()
235236
237+
236238def create_context (state ):
237239 logger = ox .Logger (log )
238240 ctx = ox .DeviceContext (validation_mode = False , log_callback_function = logger , log_callback_level = 4 )
239241 ctx .cache_enabled = False
240242 state .ctx = ctx
241243
244+
242245def generate_animated_vertices (out_vertices , animation_mode , time , width , height ):
243246 threads_per_block = 128
244247 num_blocks = (width * height + threads_per_block - 1 ) // threads_per_block
@@ -251,12 +254,13 @@ def generate_animated_vertices(out_vertices, animation_mode, time, width, height
251254def launch_generate_animated_vertices (state , animation_mode ):
252255 generate_animated_vertices (state .d_temp_vertices , animation_mode , state .time , g_tessellation_resolution , g_tessellation_resolution )
253256
257+
254258def update_mesh_accel (state ):
255259 # first sphere is static
256260
257261 # second sphere moves by updating its transform matrix
258- transform = state .ias_build_input .get_transform_view (1 )
259- transform [1 ,- 1 ] = np .sin (4 * state .time )
262+ transform = state .ias_build_input .view_instance_transform (1 )
263+ transform [1 , - 1 ] = np .sin (4 * state .time )
260264
261265 # third sphere deforms
262266 launch_generate_animated_vertices (state , AnimationMode .DEFORM )
@@ -270,13 +274,14 @@ def update_mesh_accel(state):
270274 state .last_exploding_sphere_rebuild_time = state .time
271275 state .exploding_gas = ox .AccelerationStructure (state .ctx , state .gas_build_input ,
272276 compact = True , allow_update = True , random_vertex_access = True )
273- state .ias_build_input . instances [3 ].update_traversable ( state .exploding_gas )
277+ state .ias_build_input [3 ].traversable = state .exploding_gas
274278 state .ias_build_input .update_instance (3 )
275279 else :
276280 state .exploding_gas .update (state .gas_build_input )
277281
278282 state .ias .update (state .ias_build_input )
279283
284+
280285def build_vertex_generation_kernel (state ):
281286 cuda_source = os .path .join (script_dir , 'cuda' , 'dynamic_geometry_vertex_generation.cu' )
282287 example_include_path = os .path .dirname (cuda_source )
@@ -289,6 +294,7 @@ def build_vertex_generation_kernel(state):
289294 state .generate_vertices_kernel = cp .RawKernel (code = code , backend = 'nvrtc' ,
290295 options = build_flags , name = 'generate_vertices' )
291296
297+
292298def build_mesh_accel (state ):
293299 # Allocate temporary space for vertex generation.
294300 # The same memory space is reused for generating the deformed and exploding vertices before updates.
@@ -335,9 +341,10 @@ def create_module(state):
335341 else :
336342 exception_flags = ox .ExceptionFlags .NONE
337343
344+ print ("Triangle value" , ox .PrimitiveTypeFlags .TRIANGLE .value )
338345 pipeline_opts = ox .PipelineCompileOptions (
339346 uses_motion_blur = False ,
340- uses_primitive_type_flags = ox .PrimitiveTypeFlags .TRIANGLE ,
347+ uses_primitive_type_flags = ox .PrimitiveTypeFlags .TRIANGLE ,
341348 traversable_graph_flags = ox .TraversableGraphFlags .ALLOW_SINGLE_LEVEL_INSTANCING ,
342349 exception_flags = exception_flags ,
343350 num_payload_values = 3 ,
@@ -347,7 +354,7 @@ def create_module(state):
347354 compile_opts = ox .ModuleCompileOptions (
348355 max_register_count = ox .ModuleCompileOptions .DEFAULT_MAX_REGISTER_COUNT ,
349356 opt_level = ox .CompileOptimizationLevel .DEFAULT ,
350- debug_level = ox .CompileDebugLevel .LINEINFO )
357+ debug_level = ox .CompileDebugLevel .MODERATE )
351358
352359 cuda_source = os .path .join (script_dir , 'cuda' , 'dynamic_geometry.cu' )
353360 state .module = ox .Module (state .ctx , cuda_source , compile_opts , pipeline_opts )
@@ -364,7 +371,7 @@ def create_pipeline(state):
364371 program_grps = [state .raygen_grp , state .miss_grp , state .hit_grp ]
365372
366373 link_opts = ox .PipelineLinkOptions (max_trace_depth = 1 ,
367- debug_level = ox .CompileDebugLevel .LINEINFO )
374+ debug_level = ox .CompileDebugLevel .MODERATE )
368375
369376 pipeline = ox .Pipeline (state .ctx ,
370377 compile_options = state .pipeline_opts ,
0 commit comments