Cleanup: use ofs instead of offs as an abbreviation for offset

Used for local structs/variables,
since `ofs` is by far the most widely used abbreviation.
This commit is contained in:
Campbell Barton 2021-03-08 14:48:45 +11:00
parent b4f5128b21
commit a1bc7729f2
15 changed files with 111 additions and 116 deletions

View File

@ -875,9 +875,9 @@ static float (*displist_vert_coords_alloc(ListBase *dispbase, int *r_vert_len))[
allverts = MEM_mallocN(sizeof(float[3]) * (*r_vert_len), "displist_vert_coords_alloc allverts");
fp = (float *)allverts;
LISTBASE_FOREACH (DispList *, dl, dispbase) {
int offs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
memcpy(fp, dl->verts, sizeof(float) * offs);
fp += offs;
int ofs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
memcpy(fp, dl->verts, sizeof(float) * ofs);
fp += ofs;
}
return allverts;
@ -889,9 +889,9 @@ static void displist_vert_coords_apply(ListBase *dispbase, float (*allverts)[3])
fp = (float *)allverts;
LISTBASE_FOREACH (DispList *, dl, dispbase) {
int offs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
memcpy(dl->verts, fp, sizeof(float) * offs);
fp += offs;
int ofs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
memcpy(dl->verts, fp, sizeof(float) * ofs);
fp += ofs;
}
}

View File

@ -338,18 +338,18 @@ static void hammersley_create(float *out, int n, int seed, float amount)
{
RNG *rng;
double offs[2], t;
double ofs[2], t;
rng = BLI_rng_new(31415926 + n + seed);
offs[0] = BLI_rng_get_double(rng) + (double)amount;
offs[1] = BLI_rng_get_double(rng) + (double)amount;
ofs[0] = BLI_rng_get_double(rng) + (double)amount;
ofs[1] = BLI_rng_get_double(rng) + (double)amount;
BLI_rng_free(rng);
for (int k = 0; k < n; k++) {
BLI_hammersley_1d(k, &t);
out[2 * k + 0] = fmod((double)k / (double)n + offs[0], 1.0);
out[2 * k + 1] = fmod(t + offs[1], 1.0);
out[2 * k + 0] = fmod((double)k / (double)n + ofs[0], 1.0);
out[2 * k + 1] = fmod(t + ofs[1], 1.0);
}
}

View File

@ -762,9 +762,9 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
MarkerMove *mm = op->customdata;
TimeMarker *marker, *selmarker = NULL;
const int offs = RNA_int_get(op->ptr, "frames");
const int ofs = RNA_int_get(op->ptr, "frames");
char str[UI_MAX_DRAW_STR];
char str_offs[NUM_STR_REP_LEN];
char str_ofs[NUM_STR_REP_LEN];
int totmark;
const bool use_time = ed_marker_move_use_time(mm);
@ -776,27 +776,27 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
}
if (hasNumInput(&mm->num)) {
outputNumInput(&mm->num, str_offs, &scene->unit);
outputNumInput(&mm->num, str_ofs, &scene->unit);
}
else if (use_time) {
BLI_snprintf(str_offs, sizeof(str_offs), "%.2f", FRA2TIME(offs));
BLI_snprintf(str_ofs, sizeof(str_ofs), "%.2f", FRA2TIME(ofs));
}
else {
BLI_snprintf(str_offs, sizeof(str_offs), "%d", offs);
BLI_snprintf(str_ofs, sizeof(str_ofs), "%d", ofs);
}
if (totmark == 1 && selmarker) {
/* we print current marker value */
if (use_time) {
BLI_snprintf(
str, sizeof(str), TIP_("Marker %.2f offset %s"), FRA2TIME(selmarker->frame), str_offs);
str, sizeof(str), TIP_("Marker %.2f offset %s"), FRA2TIME(selmarker->frame), str_ofs);
}
else {
BLI_snprintf(str, sizeof(str), TIP_("Marker %d offset %s"), selmarker->frame, str_offs);
BLI_snprintf(str, sizeof(str), TIP_("Marker %d offset %s"), selmarker->frame, str_ofs);
}
}
else {
BLI_snprintf(str, sizeof(str), TIP_("Marker offset %s"), str_offs);
BLI_snprintf(str, sizeof(str), TIP_("Marker offset %s"), str_ofs);
}
ED_area_status_text(CTX_wm_area(C), str);
@ -907,12 +907,12 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op)
#endif
MarkerMove *mm = op->customdata;
TimeMarker *marker;
int a, offs;
int a, ofs;
offs = RNA_int_get(op->ptr, "frames");
ofs = RNA_int_get(op->ptr, "frames");
for (a = 0, marker = mm->markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
marker->frame = mm->oldframe[a] + offs;
marker->frame = mm->oldframe[a] + ofs;
a++;
}
}

View File

@ -644,8 +644,8 @@ static int selectbuffer_ret_hits_12(uint *UNUSED(buffer), const int hits12)
static int selectbuffer_ret_hits_5(uint *buffer, const int hits12, const int hits5)
{
const int offs = 4 * hits12;
memcpy(buffer, buffer + offs, 4 * hits5 * sizeof(uint));
const int ofs = 4 * hits12;
memcpy(buffer, buffer + ofs, 4 * hits5 * sizeof(uint));
return hits5;
}
@ -704,17 +704,12 @@ static EditBone *get_nearest_editbonepoint(
goto cache_end;
}
else if (hits12 > 0) {
int offs;
int ofs;
offs = 4 * hits12;
ofs = 4 * hits12;
BLI_rcti_init_pt_radius(&rect, vc->mval, 5);
const int hits5 = view3d_opengl_select_with_id_filter(vc,
buffer + offs,
MAXPICKBUF - offs,
&rect,
select_mode,
select_filter,
select_id_ignore);
const int hits5 = view3d_opengl_select_with_id_filter(
vc, buffer + ofs, MAXPICKBUF - ofs, &rect, select_mode, select_filter, select_id_ignore);
if (hits5 == 1) {
hits = selectbuffer_ret_hits_5(buffer, hits12, hits5);

View File

@ -873,12 +873,12 @@ static void pose_slide_draw_status(tPoseSlideOp *pso)
if (hasNumInput(&pso->num)) {
Scene *scene = pso->scene;
char str_offs[NUM_STR_REP_LEN];
char str_ofs[NUM_STR_REP_LEN];
outputNumInput(&pso->num, str_offs, &scene->unit);
outputNumInput(&pso->num, str_ofs, &scene->unit);
BLI_snprintf(
status_str, sizeof(status_str), "%s: %s | %s", mode_str, str_offs, limits_str);
status_str, sizeof(status_str), "%s: %s | %s", mode_str, str_ofs, limits_str);
}
else {
BLI_snprintf(status_str,

View File

@ -599,10 +599,10 @@ static void gpencil_interpolate_status_indicators(bContext *C, tGPDinterpolate *
BLI_strncpy(msg_str, TIP_("GPencil Interpolation: "), UI_MAX_DRAW_STR);
if (hasNumInput(&p->num)) {
char str_offs[NUM_STR_REP_LEN];
char str_ofs[NUM_STR_REP_LEN];
outputNumInput(&p->num, str_offs, &scene->unit);
BLI_snprintf(status_str, sizeof(status_str), "%s%s", msg_str, str_offs);
outputNumInput(&p->num, str_ofs, &scene->unit);
BLI_snprintf(status_str, sizeof(status_str), "%s%s", msg_str, str_ofs);
}
else {
BLI_snprintf(status_str,

View File

@ -466,10 +466,10 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi
GP_STROKE_BOX,
GP_STROKE_POLYLINE)) {
if (hasNumInput(&tgpi->num)) {
char str_offs[NUM_STR_REP_LEN];
char str_ofs[NUM_STR_REP_LEN];
outputNumInput(&tgpi->num, str_offs, &scene->unit);
BLI_snprintf(status_str, sizeof(status_str), "%s: %s", msg_str, str_offs);
outputNumInput(&tgpi->num, str_ofs, &scene->unit);
BLI_snprintf(status_str, sizeof(status_str), "%s: %s", msg_str, str_ofs);
}
else {
if (tgpi->flag == IN_PROGRESS) {

View File

@ -5246,8 +5246,8 @@ static bool ui_numedit_but_SLI(uiBut *but,
(but->softmax - but->softmin + but->a1);
}
else {
const float offs = (BLI_rctf_size_y(&but->rect) / 2.0f);
cursor_x_range = (BLI_rctf_size_x(&but->rect) - offs);
const float ofs = (BLI_rctf_size_y(&but->rect) / 2.0f);
cursor_x_range = (BLI_rctf_size_x(&but->rect) - ofs);
}
f = (mx_fl - data->dragstartx) / cursor_x_range + data->dragfstart;

View File

@ -3667,16 +3667,16 @@ static void widget_progressbar(
/* round corners */
const float value = but_progressbar->progress;
const float offs = wcol->roundness * BLI_rcti_size_y(&rect_prog);
const float ofs = wcol->roundness * BLI_rcti_size_y(&rect_prog);
float w = value * BLI_rcti_size_x(&rect_prog);
/* Ensure minimum size. */
w = MAX2(w, offs);
w = MAX2(w, ofs);
rect_bar.xmax = rect_bar.xmin + w;
round_box_edges(&wtb, roundboxalign, &rect_prog, offs);
round_box_edges(&wtb_bar, roundboxalign, &rect_bar, offs);
round_box_edges(&wtb, roundboxalign, &rect_prog, ofs);
round_box_edges(&wtb_bar, roundboxalign, &rect_bar, ofs);
wtb.draw_outline = true;
widgetbase_draw(&wtb, wcol);
@ -3733,9 +3733,9 @@ static void widget_numslider(
widget_init(&wtb1);
/* Backdrop first. */
const float offs = wcol->roundness * BLI_rcti_size_y(rect);
const float toffs = offs * 0.75f;
round_box_edges(&wtb, roundboxalign, rect, offs);
const float ofs = wcol->roundness * BLI_rcti_size_y(rect);
const float toffs = ofs * 0.75f;
round_box_edges(&wtb, roundboxalign, rect, ofs);
wtb.draw_outline = false;
widgetbase_draw(&wtb, wcol);
@ -3768,13 +3768,13 @@ static void widget_numslider(
const float width = (float)BLI_rcti_size_x(rect);
factor_ui = factor * width;
if (factor_ui <= offs) {
if (factor_ui <= ofs) {
/* Left part only. */
roundboxalign_slider &= ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT);
rect1.xmax = rect1.xmin + offs;
factor_discard = factor_ui / offs;
rect1.xmax = rect1.xmin + ofs;
factor_discard = factor_ui / ofs;
}
else if (factor_ui <= width - offs) {
else if (factor_ui <= width - ofs) {
/* Left part + middle part. */
roundboxalign_slider &= ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT);
rect1.xmax = rect1.xmin + factor_ui;
@ -3784,7 +3784,7 @@ static void widget_numslider(
factor_discard = factor;
}
round_box_edges(&wtb1, roundboxalign_slider, &rect1, offs);
round_box_edges(&wtb1, roundboxalign_slider, &rect1, ofs);
wtb1.draw_outline = false;
widgetbase_set_uniform_discard_factor(&wtb1, factor_discard);
widgetbase_draw(&wtb1, wcol);

View File

@ -187,11 +187,11 @@ static void decimate_draw_status_header(wmOperator *op, tDecimateGraphOp *dgo)
strcpy(mode_str, TIP_("Decimate Keyframes"));
if (hasNumInput(&dgo->num)) {
char str_offs[NUM_STR_REP_LEN];
char str_ofs[NUM_STR_REP_LEN];
outputNumInput(&dgo->num, str_offs, &dgo->scene->unit);
outputNumInput(&dgo->num, str_ofs, &dgo->scene->unit);
BLI_snprintf(status_str, sizeof(status_str), "%s: %s", mode_str, str_offs);
BLI_snprintf(status_str, sizeof(status_str), "%s: %s", mode_str, str_ofs);
}
else {
float percentage = RNA_property_float_get(op->ptr, dgo->percentage_prop);

View File

@ -2112,7 +2112,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
typedef struct CacheDrawData {
struct View2D *v2d;
float stripe_offs;
float stripe_ofs_y;
float stripe_ht;
int cache_flag;
GPUVertBuf *raw_vbo;
@ -2151,7 +2151,7 @@ static bool draw_cache_view_iter_fn(void *userdata,
{
CacheDrawData *drawdata = userdata;
struct View2D *v2d = drawdata->v2d;
float stripe_bot, stripe_top, stripe_offs, stripe_ht;
float stripe_bot, stripe_top, stripe_ofs_y, stripe_ht;
GPUVertBuf *vbo;
size_t *vert_count;
@ -2164,27 +2164,27 @@ static bool draw_cache_view_iter_fn(void *userdata,
vert_count = &drawdata->final_out_vert_count;
}
else if ((cache_type & SEQ_CACHE_STORE_RAW) && (drawdata->cache_flag & SEQ_CACHE_VIEW_RAW)) {
stripe_offs = drawdata->stripe_offs;
stripe_ofs_y = drawdata->stripe_ofs_y;
stripe_ht = drawdata->stripe_ht;
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + stripe_offs;
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + stripe_ofs_y;
stripe_top = stripe_bot + stripe_ht;
vbo = drawdata->raw_vbo;
vert_count = &drawdata->raw_vert_count;
}
else if ((cache_type & SEQ_CACHE_STORE_PREPROCESSED) &&
(drawdata->cache_flag & SEQ_CACHE_VIEW_PREPROCESSED)) {
stripe_offs = drawdata->stripe_offs;
stripe_ofs_y = drawdata->stripe_ofs_y;
stripe_ht = drawdata->stripe_ht;
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + (stripe_offs + stripe_ht) + stripe_offs;
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + (stripe_ofs_y + stripe_ht) + stripe_ofs_y;
stripe_top = stripe_bot + stripe_ht;
vbo = drawdata->preprocessed_vbo;
vert_count = &drawdata->preprocessed_vert_count;
}
else if ((cache_type & SEQ_CACHE_STORE_COMPOSITE) &&
(drawdata->cache_flag & SEQ_CACHE_VIEW_COMPOSITE)) {
stripe_offs = drawdata->stripe_offs;
stripe_ofs_y = drawdata->stripe_ofs_y;
stripe_ht = drawdata->stripe_ht;
stripe_top = seq->machine + SEQ_STRIP_OFSTOP - stripe_offs;
stripe_top = seq->machine + SEQ_STRIP_OFSTOP - stripe_ofs_y;
stripe_bot = stripe_top - stripe_ht;
vbo = drawdata->composite_vbo;
vert_count = &drawdata->composite_vert_count;
@ -2237,12 +2237,12 @@ static void draw_cache_view(const bContext *C)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
float stripe_bot, stripe_top;
float stripe_offs = UI_view2d_region_to_view_y(v2d, 1.0f) - v2d->cur.ymin;
float stripe_ofs_y = UI_view2d_region_to_view_y(v2d, 1.0f) - v2d->cur.ymin;
float stripe_ht = UI_view2d_region_to_view_y(v2d, 4.0f * UI_DPI_FAC * U.pixelsize) -
v2d->cur.ymin;
CLAMP_MAX(stripe_ht, 0.2f);
CLAMP_MIN(stripe_offs, stripe_ht / 2);
CLAMP_MIN(stripe_ofs_y, stripe_ht / 2);
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_FINAL_OUT) {
stripe_bot = UI_view2d_region_to_view_y(v2d, V2D_SCROLL_HANDLE_HEIGHT);
@ -2262,7 +2262,7 @@ static void draw_cache_view(const bContext *C)
continue;
}
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + stripe_offs;
stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + stripe_ofs_y;
stripe_top = stripe_bot + stripe_ht;
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_RAW) {
@ -2271,7 +2271,7 @@ static void draw_cache_view(const bContext *C)
immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
}
stripe_bot += stripe_ht + stripe_offs;
stripe_bot += stripe_ht + stripe_ofs_y;
stripe_top = stripe_bot + stripe_ht;
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_PREPROCESSED) {
@ -2280,7 +2280,7 @@ static void draw_cache_view(const bContext *C)
immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
}
stripe_top = seq->machine + SEQ_STRIP_OFSTOP - stripe_offs;
stripe_top = seq->machine + SEQ_STRIP_OFSTOP - stripe_ofs_y;
stripe_bot = stripe_top - stripe_ht;
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_COMPOSITE) {
@ -2297,7 +2297,7 @@ static void draw_cache_view(const bContext *C)
CacheDrawData userdata;
userdata.v2d = v2d;
userdata.stripe_offs = stripe_offs;
userdata.stripe_ofs_y = stripe_ofs_y;
userdata.stripe_ht = stripe_ht;
userdata.cache_flag = scene->ed->cache_flag;
userdata.raw_vert_count = 0;

View File

@ -1673,8 +1673,8 @@ static int selectbuffer_ret_hits_15(uint *UNUSED(buffer), const int hits15)
static int selectbuffer_ret_hits_9(uint *buffer, const int hits15, const int hits9)
{
const int offs = 4 * hits15;
memcpy(buffer, buffer + offs, 4 * hits9 * sizeof(uint));
const int ofs = 4 * hits15;
memcpy(buffer, buffer + ofs, 4 * hits9 * sizeof(uint));
return hits9;
}
@ -1683,8 +1683,8 @@ static int selectbuffer_ret_hits_5(uint *buffer,
const int hits9,
const int hits5)
{
const int offs = 4 * hits15 + 4 * hits9;
memcpy(buffer, buffer + offs, 4 * hits5 * sizeof(uint));
const int ofs = 4 * hits15 + 4 * hits9;
memcpy(buffer, buffer + ofs, 4 * hits5 * sizeof(uint));
return hits5;
}
@ -1726,30 +1726,30 @@ static int mixed_bones_object_selectbuffer(ViewContext *vc,
goto finally;
}
else if (hits15 > 0) {
int offs;
int ofs;
has_bones15 = selectbuffer_has_bones(buffer, hits15);
offs = 4 * hits15;
ofs = 4 * hits15;
BLI_rcti_init_pt_radius(&rect, mval, 9);
hits9 = view3d_opengl_select(
vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode, select_filter);
vc, buffer + ofs, MAXPICKBUF - ofs, &rect, select_mode, select_filter);
if (hits9 == 1) {
hits = selectbuffer_ret_hits_9(buffer, hits15, hits9);
goto finally;
}
else if (hits9 > 0) {
has_bones9 = selectbuffer_has_bones(buffer + offs, hits9);
has_bones9 = selectbuffer_has_bones(buffer + ofs, hits9);
offs += 4 * hits9;
ofs += 4 * hits9;
BLI_rcti_init_pt_radius(&rect, mval, 5);
hits5 = view3d_opengl_select(
vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode, select_filter);
vc, buffer + ofs, MAXPICKBUF - ofs, &rect, select_mode, select_filter);
if (hits5 == 1) {
hits = selectbuffer_ret_hits_5(buffer, hits15, hits9, hits5);
goto finally;
}
else if (hits5 > 0) {
has_bones5 = selectbuffer_has_bones(buffer + offs, hits5);
has_bones5 = selectbuffer_has_bones(buffer + ofs, hits5);
}
}

View File

@ -736,7 +736,7 @@ float GPU_polygon_offset_calc(const float (*winmat)[4], float viewdist, float di
int depthbits = 24;
depth_fac = 1.0f / (float)((1 << depthbits) - 1);
}
offs = (-1.0 / winmat[2][2]) * dist * depth_fac;
ofs = (-1.0 / winmat[2][2]) * dist * depth_fac;
UNUSED_VARS(viewdist);
#endif
@ -765,10 +765,10 @@ void GPU_polygon_offset(float viewdist, float dist)
/* dist is from camera to center point */
float offs = GPU_polygon_offset_calc(winmat, viewdist, dist);
float ofs = GPU_polygon_offset_calc(winmat, viewdist, dist);
winmat[3][2] -= offs;
offset += offs;
winmat[3][2] -= ofs;
offset += ofs;
}
else {
winmat[3][2] += offset;

View File

@ -658,10 +658,10 @@ static void get_ccgdm_data(DerivedMesh *lodm,
/* get the original cage face index */
int cage_face_index = index_mp_to_orig ? index_mp_to_orig[poly_index] : poly_index;
/* local offset in total cage face grids
* (1 << (2 * lvl)) is number of all polys for one cage face */
int loc_cage_poly_offs = poly_index % (1 << (2 * lvl));
* `(1 << (2 * lvl))` is number of all polys for one cage face */
int loc_cage_poly_ofs = poly_index % (1 << (2 * lvl));
/* local offset in the vertex grid itself */
int cell_index = loc_cage_poly_offs % (polys_per_grid_side * polys_per_grid_side);
int cell_index = loc_cage_poly_ofs % (polys_per_grid_side * polys_per_grid_side);
int cell_side = (grid_size - 1) / polys_per_grid_side;
/* row and column based on grid side */
int row = cell_index / polys_per_grid_side;
@ -1193,7 +1193,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm,
MLoopUV *mloopuv = lores_dm->getLoopDataArray(lores_dm, CD_MLOOPUV);
MAOBakeData *ao_data = (MAOBakeData *)bake_data;
int i, k, perm_offs;
int i, k, perm_ofs;
float pos[3], nrm[3];
float cen[3];
float axisX[3], axisY[3], axisZ[3];
@ -1236,7 +1236,7 @@ static void apply_ao_callback(DerivedMesh *lores_dm,
build_coordinate_frame(axisX, axisY, axisZ);
/* static noise */
perm_offs = (get_ao_random2(get_ao_random1(x) + y)) & (MAX_NUMBER_OF_AO_RAYS - 1);
perm_ofs = (get_ao_random2(get_ao_random1(x) + y)) & (MAX_NUMBER_OF_AO_RAYS - 1);
/* importance sample shadow rays (cosine weighted) */
for (i = 0; i < ao_data->number_of_rays; i++) {
@ -1246,12 +1246,12 @@ static void apply_ao_callback(DerivedMesh *lores_dm,
* a multi-dimensional domain (2D)
*/
const unsigned short I =
ao_data->permutation_table_1[(i + perm_offs) % ao_data->number_of_rays];
ao_data->permutation_table_1[(i + perm_ofs) % ao_data->number_of_rays];
const unsigned short J = ao_data->permutation_table_2[i];
const float JitPh = (get_ao_random2(I + perm_offs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
const float JitPh = (get_ao_random2(I + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
((float)MAX_NUMBER_OF_AO_RAYS);
const float JitTh = (get_ao_random1(J + perm_offs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
const float JitTh = (get_ao_random1(J + perm_ofs) & (MAX_NUMBER_OF_AO_RAYS - 1)) /
((float)MAX_NUMBER_OF_AO_RAYS);
const float SiSqPhi = (I + JitPh) / ao_data->number_of_rays;
const float Theta = (float)(2 * M_PI) * ((J + JitTh) / ao_data->number_of_rays);

View File

@ -555,10 +555,10 @@ static int mg_mFractalOrfBmTex(const Tex *tex, const float texvec[3], TexResult
tex->noisebasis);
if (texres->nor != NULL) {
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */
/* calculate bumpnormal */
texres->nor[0] = tex->ns_outscale * mgravefunc(texvec[0] + offs,
texres->nor[0] = tex->ns_outscale * mgravefunc(texvec[0] + ofs,
texvec[1],
texvec[2],
tex->mg_H,
@ -566,7 +566,7 @@ static int mg_mFractalOrfBmTex(const Tex *tex, const float texvec[3], TexResult
tex->mg_octaves,
tex->noisebasis);
texres->nor[1] = tex->ns_outscale * mgravefunc(texvec[0],
texvec[1] + offs,
texvec[1] + ofs,
texvec[2],
tex->mg_H,
tex->mg_lacunarity,
@ -574,7 +574,7 @@ static int mg_mFractalOrfBmTex(const Tex *tex, const float texvec[3], TexResult
tex->noisebasis);
texres->nor[2] = tex->ns_outscale * mgravefunc(texvec[0],
texvec[1],
texvec[2] + offs,
texvec[2] + ofs,
tex->mg_H,
tex->mg_lacunarity,
tex->mg_octaves,
@ -612,10 +612,10 @@ static int mg_ridgedOrHybridMFTex(const Tex *tex, const float texvec[3], TexResu
tex->noisebasis);
if (texres->nor != NULL) {
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */
/* calculate bumpnormal */
texres->nor[0] = tex->ns_outscale * mgravefunc(texvec[0] + offs,
texres->nor[0] = tex->ns_outscale * mgravefunc(texvec[0] + ofs,
texvec[1],
texvec[2],
tex->mg_H,
@ -625,7 +625,7 @@ static int mg_ridgedOrHybridMFTex(const Tex *tex, const float texvec[3], TexResu
tex->mg_gain,
tex->noisebasis);
texres->nor[1] = tex->ns_outscale * mgravefunc(texvec[0],
texvec[1] + offs,
texvec[1] + ofs,
texvec[2],
tex->mg_H,
tex->mg_lacunarity,
@ -635,7 +635,7 @@ static int mg_ridgedOrHybridMFTex(const Tex *tex, const float texvec[3], TexResu
tex->noisebasis);
texres->nor[2] = tex->ns_outscale * mgravefunc(texvec[0],
texvec[1],
texvec[2] + offs,
texvec[2] + ofs,
tex->mg_H,
tex->mg_lacunarity,
tex->mg_octaves,
@ -666,10 +666,10 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr
tex->noisebasis);
if (texres->nor != NULL) {
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */
/* calculate bumpnormal */
texres->nor[0] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0] + offs,
texres->nor[0] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0] + ofs,
texvec[1],
texvec[2],
tex->mg_H,
@ -678,7 +678,7 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr
tex->mg_offset,
tex->noisebasis);
texres->nor[1] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0],
texvec[1] + offs,
texvec[1] + ofs,
texvec[2],
tex->mg_H,
tex->mg_lacunarity,
@ -687,7 +687,7 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr
tex->noisebasis);
texres->nor[2] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0],
texvec[1],
texvec[2] + offs,
texvec[2] + ofs,
tex->mg_H,
tex->mg_lacunarity,
tex->mg_octaves,
@ -711,24 +711,24 @@ static int mg_distNoiseTex(const Tex *tex, const float texvec[3], TexResult *tex
texvec[0], texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2);
if (texres->nor != NULL) {
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */
/* calculate bumpnormal */
texres->nor[0] = BLI_noise_mg_variable_lacunarity(texvec[0] + offs,
texres->nor[0] = BLI_noise_mg_variable_lacunarity(texvec[0] + ofs,
texvec[1],
texvec[2],
tex->dist_amount,
tex->noisebasis,
tex->noisebasis2);
texres->nor[1] = BLI_noise_mg_variable_lacunarity(texvec[0],
texvec[1] + offs,
texvec[1] + ofs,
texvec[2],
tex->dist_amount,
tex->noisebasis,
tex->noisebasis2);
texres->nor[2] = BLI_noise_mg_variable_lacunarity(texvec[0],
texvec[1],
texvec[2] + offs,
texvec[2] + ofs,
tex->dist_amount,
tex->noisebasis,
tex->noisebasis2);
@ -805,14 +805,14 @@ static int voronoiTex(const Tex *tex, const float texvec[3], TexResult *texres)
}
if (texres->nor != NULL) {
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
float ofs = tex->nabla / tex->noisesize; /* also scaling of texvec */
/* calculate bumpnormal */
BLI_noise_voronoi(texvec[0] + offs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm);
BLI_noise_voronoi(texvec[0] + ofs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm);
texres->nor[0] = sc * fabsf(dot_v4v4(&tex->vn_w1, da));
BLI_noise_voronoi(texvec[0], texvec[1] + offs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm);
BLI_noise_voronoi(texvec[0], texvec[1] + ofs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm);
texres->nor[1] = sc * fabsf(dot_v4v4(&tex->vn_w1, da));
BLI_noise_voronoi(texvec[0], texvec[1], texvec[2] + offs, da, pa, tex->vn_mexp, tex->vn_distm);
BLI_noise_voronoi(texvec[0], texvec[1], texvec[2] + ofs, da, pa, tex->vn_mexp, tex->vn_distm);
texres->nor[2] = sc * fabsf(dot_v4v4(&tex->vn_w1, da));
tex_normal_derivate(tex, texres);