34 references_(&references),
35 unaligned_heuristic_(unaligned_heuristic),
36 aligned_space_(aligned_space)
39 float min_sah = FLT_MAX;
54 for (
int i = range.
size() - 1; i > 0; i--) {
63 for (
int i = 1; i < range.
size(); i++) {
95 BoundBox effective_left_bounds, effective_right_bounds;
104 for (
int i = 0; i < this->
num_left; ++i) {
106 effective_left_bounds.
grow(prim_boundbox);
108 for (
int i = 0; i < num_right; ++i) {
110 effective_right_bounds.
grow(prim_boundbox);
132 references_(&references),
133 unaligned_heuristic_(unaligned_heuristic),
134 aligned_space_(aligned_space)
138 if (aligned_space ==
NULL) {
139 range_bounds = range.
bounds();
148 float3 invBinSize = 1.0f / binSize;
161 for (
unsigned int refIdx = range.
start(); refIdx < range.
end(); refIdx++) {
164 float3 firstBinf = (prim_bounds.
min - origin) * invBinSize;
165 float3 lastBinf = (prim_bounds.
max - origin) * invBinSize;
166 int3 firstBin =
make_int3((
int)firstBinf.
x, (
int)firstBinf.
y, (
int)firstBinf.
z);
167 int3 lastBin =
make_int3((
int)lastBinf.
x, (
int)lastBinf.
y, (
int)lastBinf.
z);
176 for (
int i = firstBin[
dim]; i < lastBin[
dim]; i++) {
180 builder, leftRef, rightRef, currRef,
dim, origin[
dim] + binSize[
dim] * (
float)(i + 1));
204 int rightNum = range.
size();
215 if (sah < this->
sah) {
236 int left_start = range.
start();
237 int left_end = left_start;
238 int right_start = range.
end();
239 int right_end = range.
end();
243 for (
int i = left_end; i < right_start; i++) {
245 if (prim_bounds.
max[this->dim] <= this->pos) {
247 left_bounds.
grow(prim_bounds);
248 swap(refs[i], refs[left_end++]);
250 else if (prim_bounds.
min[this->dim] >= this->pos) {
252 right_bounds.
grow(prim_bounds);
253 swap(refs[i--], refs[--right_start]);
264 new_refs.reserve(right_start - left_end);
265 while (left_end < right_start) {
268 refs[left_end].prim_index(),
269 refs[left_end].prim_object(),
270 refs[left_end].prim_type());
293 float minSAH =
min(
min(unsplitLeftSAH, unsplitRightSAH), duplicateSAH);
295 if (minSAH == unsplitLeftSAH) {
300 else if (minSAH == unsplitRightSAH) {
303 swap(refs[left_end], refs[--right_start]);
309 refs[left_end++] = lref;
310 new_refs.push_back(rref);
315 if (new_refs.size() != 0) {
316 refs.insert(refs.begin() + (right_end - new_refs.size()), new_refs.begin(), new_refs.end());
320 for (
int i = left_start; i < left_end - left_start; ++i) {
322 left_bounds.
grow(prim_boundbox);
324 for (
int i = right_start; i < right_end - right_start; ++i) {
326 right_bounds.
grow(prim_boundbox);
329 left =
BVHRange(left_bounds, left_start, left_end - left_start);
330 right =
BVHRange(right_bounds, right_start, right_end - right_start);
346 for (
int i = 0; i < 3; i++) {
356 left_bounds.
grow(v0);
359 right_bounds.
grow(v0);
362 if ((v0p < pos && v1p >
pos) || (v0p >
pos && v1p <
pos)) {
365 right_bounds.
grow(
t);
381 const int k0 =
curve.first_key + segment_index;
382 const int k1 = k0 + 1;
383 float3 v0 = hair->get_curve_keys()[k0];
384 float3 v1 = hair->get_curve_keys()[k1];
398 left_bounds.
grow(v0);
401 right_bounds.
grow(v0);
410 if ((v0p < pos && v1p >
pos) || (v0p >
pos && v1p <
pos)) {
413 right_bounds.
grow(
t);
427 float3 point = pointcloud->get_points()[prim_index];
483 Geometry *geom =
object->get_geometry();
489 mesh, &object->get_tfm(), tri_idx,
dim,
pos, left_bounds, right_bounds);
493 Hair *hair =
static_cast<Hair *
>(geom);
494 for (
int curve_idx = 0; curve_idx < hair->
num_curves(); ++curve_idx) {
496 for (
int segment_idx = 0; segment_idx <
curve.num_keys - 1; ++segment_idx) {
498 hair, &object->get_tfm(), curve_idx, segment_idx,
dim,
pos, left_bounds, right_bounds);
504 for (
int point_idx = 0; point_idx < pointcloud->
num_points(); ++point_idx) {
506 pointcloud, &object->get_tfm(), point_idx,
dim,
pos, left_bounds, right_bounds);
530 Hair *hair =
static_cast<Hair *
>(ob->get_geometry());
typedef float(TangentPoint)[2]
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
vector< Object * > objects
BVHSpatialStorage * storage_
vector< BVHReference > * references_
__forceinline BoundBox get_prim_bounds(const BVHReference &prim) const
void split(BVHRange &left, BVHRange &right, const BVHRange &range)
const Transform * aligned_space_
const BVHUnaligned * unaligned_heuristic_
__forceinline float primitive_cost(int n) const
__forceinline int size() const
__forceinline int start() const
__forceinline const BoundBox & bounds() const
__forceinline int end() const
__forceinline int prim_type() const
__forceinline int prim_object() const
__forceinline const BoundBox & bounds() const
__forceinline int prim_index() const
void split_point_primitive(const PointCloud *pointcloud, const Transform *tfm, int prim_index, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds)
void split_curve_primitive(const Hair *hair, const Transform *tfm, int prim_index, int segment_index, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds)
void split_curve_reference(const BVHReference &ref, const Hair *hair, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds)
void split_triangle_primitive(const Mesh *mesh, const Transform *tfm, int prim_index, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds)
__forceinline float3 get_unaligned_point(const float3 &point) const
__forceinline BoundBox get_prim_bounds(const BVHReference &prim) const
BVHSpatialStorage * storage_
void split_object_reference(const Object *object, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds)
const Transform * aligned_space_
vector< BVHReference > * references_
void split_triangle_reference(const BVHReference &ref, const Mesh *mesh, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds)
void split_point_reference(const BVHReference &ref, const PointCloud *pointcloud, int dim, float pos, BoundBox &left_bounds, BoundBox &right_bounds)
void split_reference(const BVHBuild &builder, BVHReference &left, BVHReference &right, const BVHReference &ref, int dim, float pos)
void split(BVHBuild *builder, BVHRange &left, BVHRange &right, const BVHRange &range)
BoundBox compute_aligned_boundbox(const BVHObjectBinning &range, const BVHReference *references, const Transform &aligned_space, BoundBox *cent_bounds=NULL) const
Curve get_curve(size_t i) const
size_t num_curves() const
#define CCL_NAMESPACE_END
#define PRIMITIVE_UNPACK_SEGMENT(type)
static float lerp(float t, float a, float b)
T clamp(const T &a, const T &min, const T &max)
void bvh_reference_sort(int start, int end, BVHReference *data, int dim, const BVHUnaligned *unaligned_heuristic, const Transform *aligned_space)
vector< BVHReference > new_references
vector< BoundBox > right_bounds
BVHSpatialBin bins[3][BVHParams::NUM_SPATIAL_BINS]
__forceinline void intersect(const BoundBox &bbox)
__forceinline float safe_area() const
__forceinline void grow(const float3 &pt)
Triangle get_triangle(size_t i) const
size_t num_triangles() const
size_t num_points() const