19 void SunBeamsOperation::calc_rays_common_data()
29 calc_rays_common_data();
55 int x0 = (int)source[0];
56 int y0 = (int)source[1];
59 u =
x * fxu +
y * fyu;
60 v =
x * fxv +
y * fyv;
65 int x0 = (int)source[0];
66 int y0 = (int)source[1];
67 x = x0 + u * fxu +
v * fxv;
68 y = y0 + u * fyu +
v * fyv;
83 const float source[2],
92 float &falloff_factor)
98 double tan_phi = pv / (
double)pu;
99 double dr =
sqrt(tan_phi * tan_phi + 1.0);
100 double cos_phi = 1.0 / dr;
103 float umin =
max_ff(pu - cos_phi * dist_min, 0.0f);
104 float umax =
max_ff(pu - cos_phi * dist_max, 0.0f);
108 int start = (int)
floorf(umax);
109 int end = (int)
ceilf(umin);
114 falloff_factor = dist_max > dist_min ? dr / (
double)(dist_max - dist_min) : 0.0f;
116 float *iter =
input->get_buffer() +
input->get_coords_offset(
x,
y);
130 const float source[2],
137 float falloff_factor;
142 if ((
int)(co[0] - source[0]) == 0 && (
int)(co[1] - source[1]) == 0) {
149 input, source, co, dist_min, dist_max,
x,
y, num,
v, dv, falloff_factor);
156 for (
int i = 0; i < num; i++) {
157 float weight = 1.0f - (
float)i * falloff_factor;
161 if (
x >= rect.
xmin && x < rect.xmax && y >= rect.
ymin &&
y < rect.
ymax) {
187 if (v_local < 0.0f) {
214 const float source[2],
219 float pt_ofs[2] = {co[0] - source[0], co[1] - source[1]};
238 if (pt_ofs[0] > 0.0f) {
239 if (pt_ofs[1] > 0.0f) {
249 if (pt_ofs[1] > 0.0f) {
260 if (pt_ofs[0] > 0.0f) {
261 if (pt_ofs[1] > 0.0f) {
271 if (pt_ofs[1] > 0.0f) {
291 const float co[2] = {(
float)
x, (
float)
y};
298 float co[2] = {(
float)
x, (
float)
y};
307 int ico[2] = {(int)co[0], (
int)co[1]};
329 const rcti &output_area,
334 calc_rays_common_data();
336 r_input_area = output_area;
358 out_elem +=
output->elem_stride;
typedef float(TangentPoint)[2]
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void sub_v2_v2(float r[2], const float a[2])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void zero_v4(float r[4])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
MINLINE void zero_v3(float r[3])
MINLINE float normalize_v2(float r[2])
void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2])
typedef double(DMatrix)[4][4]
_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 y
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
a MemoryBuffer contains access to the data of a chunk
unsigned int get_height() const
void add_output_socket(DataType datatype)
unsigned int get_width() const
NodeOperationFlags flags_
NodeOperation * get_input_operation(int index)
virtual bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void set_canvas_input_index(unsigned int index)
set the index of the input socket that will determine the canvas of this operation
virtual void * initialize_tile_data(rcti *)
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override
Get input operation area being read by this operation on rendering given output area.
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void init_execution() override
void execute_pixel(float output[4], int x, int y, void *data) override
calculate a single pixel
void * initialize_tile_data(rcti *rect) override
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
IconTextureDrawCall border
ccl_global float * buffer
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
static void area(int d1, int d2, int e1, int e2, float weights[2])
static void calc_ray_shift(rcti *rect, float x, float y, const float source[2], float ray_length)
static void accumulate_line(MemoryBuffer *input, float output[4], const float co[2], const float source[2], float dist_min, float dist_max)
static bNodeSocketTemplate inputs[]
static void sector_to_buffer(const float source[2], int u, int v, int &x, int &y)
static void buffer_to_sector(const float source[2], float x, float y, float &u, float &v)
static void eval(MemoryBuffer *input, float output[4], const float co[2], const float source[2], float dist_min, float dist_max)
static float * init_buffer_iterator(MemoryBuffer *input, const float source[2], const float co[2], float dist_min, float dist_max, int &x, int &y, int &num, float &v, float &dv, float &falloff_factor)