@@ -23,7 +23,6 @@ constexpr int bw_kernel_grid = 1024;
2323constexpr int bw_kernel_block = 256 ;
2424constexpr int bw_kernel_grid = 256 ;
2525#endif
26- constexpr Float k_null_gas_min = Float(1 .e-3 );
2726
2827// sun has a half angle of .266 degrees
2928constexpr Float cos_half_angle = Float(0.9999891776066407 ); // cos(half_angle);
@@ -60,24 +59,21 @@ struct Camera
6059 const Float yaw = yaw_deg / Float (180 .) * M_PI;
6160 const Float pitch = pitch_deg / Float (180 .) * M_PI;
6261 const Float roll = roll_deg / Float (180 .) * M_PI;
63- mx = {cos (yaw)*sin (pitch), (cos (yaw)*cos (pitch)*sin (roll)-sin (yaw)*cos (roll)), (cos (yaw)*cos (pitch)*cos (roll)+sin (yaw)*sin (roll))};
64- my = {sin (yaw)*sin (pitch), (sin (yaw)*cos (pitch)*sin (roll)+cos (yaw)*cos (roll)), (sin (yaw)*cos (pitch)*cos (roll)-cos (yaw)*sin (roll))};
65- mz = {-cos (pitch), sin (pitch)*sin (roll), sin (pitch)*cos (roll)};
62+ mx = {cos (yaw)*cos (pitch), (cos (yaw)*sin (pitch)*sin (roll)-sin (yaw)*cos (roll)), (cos (yaw)*sin (pitch)*cos (roll)+sin (yaw)*sin (roll))};
63+ my = {sin (yaw)*cos (pitch), (sin (yaw)*sin (pitch)*sin (roll)+cos (yaw)*cos (roll)), (sin (yaw)*sin (pitch)*cos (roll)-cos (yaw)*sin (roll))};
64+ mz = {-sin (pitch), cos (pitch)*sin (roll), cos (pitch)*cos (roll)};
6665 }
6766
6867 void setup_normal_camera (const Camera camera)
6968 {
7069 if (!fisheye)
7170 {
72- const Vector<Float> dir_tmp = {0 , 0 , 1 };
73- const Vector<Float> dir_cam = normalize (Vector<Float>({dot (camera.mx ,dir_tmp), dot (camera.my ,dir_tmp), dot (camera.mz ,dir_tmp)*Float (-1 )}));
74- Vector<Float> dir_up;
75- if ( (int (dir_cam.z )==1 ) || (int (dir_cam.z )==-1 ) )
76- dir_up = {1 , 0 , 0 };
77- else
78- dir_up = {0 , 0 , 1 };
79-
80- cam_width = normalize (cross (dir_cam, dir_up));
71+ const Vector<Float> dir_tmp = {1 , 0 , 0 };
72+ const Vector<Float> dir_cam = normalize (Vector<Float>({dot (camera.mx ,dir_tmp), dot (camera.my ,dir_tmp), dot (camera.mz ,dir_tmp)}));
73+ const Vector<Float> dir_up_tmp = {0 , 0 , 1 };
74+ const Vector<Float> dir_up = normalize (Vector<Float>({dot (camera.mx ,dir_up_tmp), dot (camera.my ,dir_up_tmp), dot (camera.mz ,dir_up_tmp)}));
75+
76+ cam_width = Float (-1 ) * normalize (cross (dir_cam, dir_up));
8177 cam_height = normalize (cross (dir_cam, cam_width));
8278 cam_depth = dir_cam / tan (fov/Float (180 )*M_PI/Float (2 .));
8379
@@ -91,17 +87,18 @@ struct Camera
9187 // size of output arrays, either number of horizontal and vertical pixels, or number of zenith/azimuth angles of fisheye lens. Default to 1024
9288 int ny = 1024 ;
9389 int nx = 1024 ;
90+ Int npix;
9491};
9592
9693
9794__global__
9895void ray_tracer_kernel_bw (
9996 const int igpt,
100- const int photons_per_pixel,
97+ const Int photons_per_pixel,
10198 const Grid_knull* __restrict__ k_null_grid,
10299 Float* __restrict__ camera_count,
103100 Float* __restrict__ camera_shot,
104- int * __restrict__ counter,
101+ Int * __restrict__ counter,
105102 const Float* __restrict__ k_ext, const Optics_scat* __restrict__ scat_asy,
106103 const Float* __restrict__ k_ext_bg, const Optics_scat* __restrict__ scat_asy_bg,
107104 const Float* __restrict__ z_lev_bg,
0 commit comments