1- using RayCaster , GeometryBasics, LinearAlgebra
1+ using Raycore , GeometryBasics, LinearAlgebra
22using GLMakie, FileIO
33
44function LowSphere (radius, contact= Point3f (0 ); ntriangles= 10 )
@@ -14,20 +14,20 @@ begin
1414 l = 0.5
1515 floor = Rect3f (- l, - l, - 0.01 , 2 l, 2 l, 0.01 )
1616 cat = load (Makie. assetpath (" cat.obj" ))
17- bvh = RayCaster . BVHAccel ([s1, s2, s3, s4, cat]);
17+ bvh = Raycore . BVHAccel ([s1, s2, s3, s4, cat]);
1818 world_mesh = GeometryBasics. Mesh (bvh)
1919 f, ax, pl = Makie. mesh (world_mesh; color= :teal )
2020 center! (ax. scene)
2121 viewdir = normalize (ax. scene. camera. view_direction[])
2222end
2323
24- hitpoints, centroid = RayCaster . get_centroid (bvh, viewdir)
24+ hitpoints, centroid = Raycore . get_centroid (bvh, viewdir)
2525
2626
2727begin
28- @time " hitpoints" hitpoints, centroid = RayCaster . get_centroid (bvh, viewdir)
29- @time " illum" illum = RayCaster . get_illumination (bvh, viewdir)
30- @time " viewf_matrix" viewf_matrix = RayCaster . view_factors (bvh, rays_per_triangle= 1000 )
28+ @time " hitpoints" hitpoints, centroid = Raycore . get_centroid (bvh, viewdir)
29+ @time " illum" illum = Raycore . get_illumination (bvh, viewdir)
30+ @time " viewf_matrix" viewf_matrix = Raycore . view_factors (bvh, rays_per_triangle= 1000 )
3131 viewfacts = map (i-> Float32 (sum (view (viewf_matrix, :, i))), 1 : length (bvh. primitives))
3232 world_mesh = GeometryBasics. Mesh (bvh)
3333 N = length (world_mesh. faces)
6767using KernelAbstractions, Atomix
6868
6969function random_scatter_kernel! (bvh, triangle, u, v, normal)
70- point = RayCaster . random_triangle_point (triangle)
70+ point = Raycore . random_triangle_point (triangle)
7171 o = point .+ (normal .* 0.01f0 ) # Offset so it doesn't self intersect
72- dir = RayCaster . random_hemisphere_uniform (normal, u, v)
73- ray = RayCaster . Ray (; o= o, d= dir)
74- hit, prim, _ = RayCaster . intersect! (bvh, ray)
72+ dir = Raycore . random_hemisphere_uniform (normal, u, v)
73+ ray = Raycore . Ray (; o= o, d= dir)
74+ hit, prim, _ = Raycore . closest_hit (bvh, ray)
7575 return hit, prim
7676end
7777
@@ -109,10 +109,10 @@ using AMDGPU
109109prim_info = map (bvh. primitives) do triangle
110110 n = GB. orthogonal_vector (Vec3f, GB. Triangle (triangle. vertices... ))
111111 normal = normalize (Vec3f (n))
112- u, v = RayCaster . get_orthogonal_basis (normal)
112+ u, v = Raycore . get_orthogonal_basis (normal)
113113 return triangle, u, v, normal
114114end
115- bvh_gpu = RayCaster . to_gpu (ROCArray, bvh)
115+ bvh_gpu = Raycore . to_gpu (ROCArray, bvh)
116116result_gpu = ROCArray (result)
117117prim_info_gpu = ROCArray (prim_info)
118118@time begin
@@ -158,11 +158,11 @@ final_rays / 10^6
158158prim_info = map (bvh. primitives) do triangle
159159 n = GB. orthogonal_vector (Vec3f, GB. Triangle (triangle. vertices... ))
160160 normal = normalize (Vec3f (n))
161- u, v = RayCaster . get_orthogonal_basis (normal)
161+ u, v = Raycore . get_orthogonal_basis (normal)
162162 return triangle, u, v, normal
163163end
164164
165- bvh_gpu = RayCaster . to_gpu (ROCArray, bvh)
165+ bvh_gpu = Raycore . to_gpu (ROCArray, bvh)
166166result_gpu = ROCArray (result)
167167prim_info_gpu = ROCArray (prim_info)
168168@time begin
0 commit comments