Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/bvh/bvh.h
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| * BVH stored as it will be used for traversal on the rendering device. */ | * BVH stored as it will be used for traversal on the rendering device. */ | ||||
| struct PackedBVH { | struct PackedBVH { | ||||
| /* BVH nodes storage, one node is 4x int4, and contains two bounding boxes, | /* BVH nodes storage, one node is 4x int4, and contains two bounding boxes, | ||||
| * and child, triangle or object indexes depending on the node type */ | * and child, triangle or object indexes depending on the node type */ | ||||
| array<int4> nodes; | array<int4> nodes; | ||||
| /* object index to BVH node index mapping for instances */ | /* object index to BVH node index mapping for instances */ | ||||
| array<int> object_node; | array<int> object_node; | ||||
| /* precomputed triangle intersection data, one triangle is 4x float4 */ | |||||
| array<float4> tri_woop; | |||||
| /* primitive type - triangle or strand */ | /* primitive type - triangle or strand */ | ||||
| array<int> prim_type; | array<int> prim_type; | ||||
| /* visibility visibilitys for primitives */ | /* visibility visibilitys for primitives */ | ||||
| array<uint> prim_visibility; | array<uint> prim_visibility; | ||||
| /* mapping from BVH primitive index to true primitive index, as primitives | /* mapping from BVH primitive index to true primitive index, as primitives | ||||
| * may be duplicated due to spatial splits. -1 for instances. */ | * may be duplicated due to spatial splits. -1 for instances. */ | ||||
| array<int> prim_index; | array<int> prim_index; | ||||
| /* mapping from BVH primitive index, to the object id of that primitive. */ | /* mapping from BVH primitive index, to the object id of that primitive. */ | ||||
| Show All 37 Lines | protected: | ||||
| BVH(const BVHParams& params, const vector<Object*>& objects); | BVH(const BVHParams& params, const vector<Object*>& objects); | ||||
| /* cache */ | /* cache */ | ||||
| bool cache_read(CacheData& key); | bool cache_read(CacheData& key); | ||||
| void cache_write(CacheData& key); | void cache_write(CacheData& key); | ||||
| /* triangles and strands*/ | /* triangles and strands*/ | ||||
| void pack_primitives(); | void pack_primitives(); | ||||
| void pack_triangle(int idx, float4 woop[3]); | |||||
| void pack_curve_segment(int idx, float4 woop[3]); | |||||
| /* merge instance BVH's */ | /* merge instance BVH's */ | ||||
| void pack_instances(size_t nodes_size); | void pack_instances(size_t nodes_size); | ||||
| /* for subclasses to implement */ | /* for subclasses to implement */ | ||||
| virtual void pack_nodes(const array<int>& prims, const BVHNode *root) = 0; | virtual void pack_nodes(const array<int>& prims, const BVHNode *root) = 0; | ||||
| virtual void refit_nodes() = 0; | virtual void refit_nodes() = 0; | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||