1 #ifndef bstm_scene_info_h 2 #define bstm_scene_info_h 3 //: 4 // \file 5 #include <bocl/bocl_cl.h> 6 #include <bstm/bstm_block_metadata.h> 7 8 //: block info that can be easily made into a buffer and sent to gpu 9 struct bstm_scene_info 10 { 11 //world information 12 cl_float scene_origin[4]; // scene origin (4d point) 13 cl_int scene_dims[4]; // number of blocks in each dimension 14 cl_float block_len; // size of each block (can only be 1 number now that we've established blocks are cubes) 15 cl_float time_block_len; // dimension of the time axis 16 cl_int tree_buffer_length; // length of tree buffer (number of cells/trees) 17 cl_int data_buffer_length; // length of data buffer (number of cells) 18 }; 19 20 //: return a heap pointer to a scene info populate_scene_info(bstm_block_metadata data)21static bstm_scene_info* populate_scene_info(bstm_block_metadata data) 22 { 23 bstm_scene_info* info = new bstm_scene_info(); 24 25 info->scene_origin[0] = (float) data.local_origin_.x(); 26 info->scene_origin[1] = (float) data.local_origin_.y(); 27 info->scene_origin[2] = (float) data.local_origin_.z(); 28 info->scene_origin[3] = (float) data.local_origin_t_; 29 30 info->scene_dims[0] = (int) data.sub_block_num_.x(); // number of blocks in each dimension 31 info->scene_dims[1] = (int) data.sub_block_num_.y(); 32 info->scene_dims[2] = (int) data.sub_block_num_.z(); 33 info->scene_dims[3] = (int) data.sub_block_num_t_; 34 35 info->block_len = (float) data.sub_block_dim_.x(); 36 info->time_block_len = (float) data.sub_block_dim_t_; 37 38 info->tree_buffer_length = 0; 39 info->data_buffer_length = 0; 40 41 return info; 42 }; 43 44 class bstm_scene_info_wrapper : public vbl_ref_count 45 { 46 public: 47 bstm_scene_info * info; 48 }; 49 50 51 //Smart_Pointer typedef for bstm_scene 52 typedef vbl_smart_ptr<bstm_scene_info_wrapper> bstm_scene_info_wrapper_sptr; 53 54 55 #endif //bstm_scene_info_h 56