Cleanup: comments (long lines) in draw
This commit is contained in:
@@ -3928,6 +3928,8 @@ static bool tridiagonal_solve_with_limits(
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Keep ascii art. */
|
||||
/* clang-format off */
|
||||
/*
|
||||
* This function computes the handles of a series of auto bezier points
|
||||
* on the basis of 'no acceleration discontinuities' at the points.
|
||||
@@ -3979,6 +3981,7 @@ static bool tridiagonal_solve_with_limits(
|
||||
* 4. The equations for zero acceleration border conditions are basically the above
|
||||
* equation with parts omitted, so the handle size correction also applies.
|
||||
*/
|
||||
/* clang-format on */
|
||||
|
||||
static void bezier_eq_continuous(
|
||||
float *a, float *b, float *c, float *d, float *dy, float *l, int i)
|
||||
|
||||
@@ -206,31 +206,32 @@ void EEVEE_bloom_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *ved
|
||||
if ((effects->enabled_effects & EFFECT_BLOOM) != 0) {
|
||||
/** Bloom algorithm
|
||||
*
|
||||
* Overview :
|
||||
* Overview:
|
||||
* - Downsample the color buffer doing a small blur during each step.
|
||||
* - Accumulate bloom color using previously downsampled color buffers
|
||||
* and do an upsample blur for each new accumulated layer.
|
||||
* - Finally add accumulation buffer onto the source color buffer.
|
||||
*
|
||||
* [1/1] is original copy resolution (can be half or quarter res for performance)
|
||||
* <pre>
|
||||
* [DOWNSAMPLE CHAIN] [UPSAMPLE CHAIN]
|
||||
*
|
||||
* [DOWNSAMPLE CHAIN] [UPSAMPLE CHAIN]
|
||||
*
|
||||
* Source Color ── [Blit] ──> Bright Color Extract [1/1] Final Color
|
||||
* | Λ
|
||||
* [Downsample First] Source Color ─> + [Resolve]
|
||||
* v |
|
||||
* Color Downsampled [1/2] ────────────> + Accumulation Buffer [1/2]
|
||||
* | Λ
|
||||
* ─── ───
|
||||
* Repeat Repeat
|
||||
* ─── ───
|
||||
* v |
|
||||
* Color Downsampled [1/N-1] ──────────> + Accumulation Buffer [1/N-1]
|
||||
* | Λ
|
||||
* [Downsample] [Upsample]
|
||||
* v |
|
||||
* Color Downsampled [1/N] ─────────────────────────┘
|
||||
* Source Color ─ [Blit] ─> Bright Color Extract [1/1] Final Color
|
||||
* | Λ
|
||||
* [Downsample First] Source Color ─> + [Resolve]
|
||||
* v |
|
||||
* Color Downsampled [1/2] ────────────> + Accumulation Buffer [1/2]
|
||||
* | Λ
|
||||
* ─── ───
|
||||
* Repeat Repeat
|
||||
* ─── ───
|
||||
* v |
|
||||
* Color Downsampled [1/N-1] ──────────> + Accumulation Buffer [1/N-1]
|
||||
* | Λ
|
||||
* [Downsample] [Upsample]
|
||||
* v |
|
||||
* Color Downsampled [1/N] ─────────────────────────┘
|
||||
* </pre>
|
||||
*/
|
||||
DRWShadingGroup *grp;
|
||||
const bool use_highres = true;
|
||||
|
||||
@@ -141,10 +141,12 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata),
|
||||
float focus_dist = BKE_camera_object_dof_distance(camera);
|
||||
float focal_len = cam->lens;
|
||||
|
||||
/* this is factor that converts to the scene scale. focal length and sensor are expressed in mm
|
||||
* unit.scale_length is how many meters per blender unit we have. We want to convert to blender units though
|
||||
* because the shader reads coordinates in world space, which is in blender units.
|
||||
* Note however that focus_distance is already in blender units and shall not be scaled here (see T48157). */
|
||||
/* this is factor that converts to the scene scale. focal length and sensor are expressed in
|
||||
* mm unit.scale_length is how many meters per blender unit we have. We want to convert to
|
||||
* blender units though because the shader reads coordinates in world space, which is in
|
||||
* blender units.
|
||||
* Note however that focus_distance is already in blender units and shall not be scaled here
|
||||
* (see T48157). */
|
||||
float scale = (scene_eval->unit.system) ? scene_eval->unit.scale_length : 1.0f;
|
||||
float scale_camera = 0.001f / scale;
|
||||
/* we want radius here for the aperture number */
|
||||
|
||||
@@ -145,7 +145,8 @@ static void planar_pool_ensure_alloc(EEVEE_Data *vedata, int num_planar_ref)
|
||||
width, height, max_ii(1, num_planar_ref), GPU_DEPTH_COMPONENT24, 0, NULL);
|
||||
}
|
||||
else if (num_planar_ref == 0) {
|
||||
/* Makes Opengl Happy : Create a placeholder texture that will never be sampled but still bound to shader. */
|
||||
/* Makes Opengl Happy : Create a placeholder texture that will never be sampled but still
|
||||
* bound to shader. */
|
||||
txl->planar_pool = DRW_texture_create_2d_array(
|
||||
1, 1, 1, GPU_RGBA8, DRW_TEX_FILTER | DRW_TEX_MIPMAP, NULL);
|
||||
txl->planar_depth = DRW_texture_create_2d_array(1, 1, 1, GPU_DEPTH_COMPONENT24, 0, NULL);
|
||||
|
||||
@@ -680,7 +680,8 @@ static float light_shape_power_get(const Light *la, const EEVEE_Light *evli)
|
||||
power = 1.0f / (evli->sizex * evli->sizey * 4.0f * M_PI) * /* 1/(w*h*Pi) */
|
||||
80.0f; /* XXX : Empirical, Fit cycles power */
|
||||
if (ELEM(la->area_shape, LA_AREA_DISK, LA_AREA_ELLIPSE)) {
|
||||
/* Scale power to account for the lower area of the ellipse compared to the surrounding rectangle. */
|
||||
/* Scale power to account for the lower area of the ellipse compared to the surrounding
|
||||
* rectangle. */
|
||||
power *= 4.0f / M_PI;
|
||||
}
|
||||
}
|
||||
@@ -693,8 +694,9 @@ static float light_shape_power_get(const Light *la, const EEVEE_Light *evli)
|
||||
}
|
||||
else {
|
||||
power = 1.0f / (evli->radius * evli->radius * M_PI); /* 1/(r²*Pi) */
|
||||
/* Make illumation power closer to cycles for bigger radii. Cycles uses a cos^3 term that we cannot reproduce
|
||||
* so we account for that by scaling the light power. This function is the result of a rough manual fitting. */
|
||||
/* Make illumation power closer to cycles for bigger radii. Cycles uses a cos^3 term that we
|
||||
* cannot reproduce so we account for that by scaling the light power. This function is the
|
||||
* result of a rough manual fitting. */
|
||||
power += 1.0f / (2.0f * M_PI); /* power *= 1 + r²/2 */
|
||||
}
|
||||
return power;
|
||||
@@ -1383,7 +1385,8 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
DRW_draw_pass(psl->shadow_pass);
|
||||
}
|
||||
|
||||
/* 0.001f is arbitrary, but it should be relatively small so that filter size is not too big. */
|
||||
/* 0.001f is arbitrary, but it should be relatively small so that filter size is not too big.
|
||||
*/
|
||||
float filter_texture_size = la->soft * 0.001f;
|
||||
float filter_pixel_size = ceil(filter_texture_size / srd->cube_texel_size);
|
||||
linfo->filter_size = srd->cube_texel_size * ((filter_pixel_size > 1.0f) ? 1.5f : 0.0f);
|
||||
|
||||
@@ -1409,9 +1409,9 @@ static void material_opaque(Material *ma,
|
||||
}
|
||||
else {
|
||||
if (use_translucency) {
|
||||
/* NOTE: This is a nasty workaround, because the sss profile might not have been generated
|
||||
* but the UBO is still declared in this case even if not used. But rendering without a
|
||||
* bound UBO might result in crashes on certain platform. */
|
||||
/* NOTE: This is a nasty workaround, because the sss profile might not have been
|
||||
* generated but the UBO is still declared in this case even if not used.
|
||||
* But rendering without a bound UBO might result in crashes on certain platform. */
|
||||
DRW_shgroup_uniform_block(*shgrp, "sssProfile", e_data.dummy_sss_profile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,8 +296,9 @@ void EEVEE_reflection_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v
|
||||
/* Resolve at fullres */
|
||||
int sample = (DRW_state_is_image_render()) ? effects->taa_render_sample :
|
||||
effects->taa_current_sample;
|
||||
/* Doing a neighbor shift only after a few iteration. We wait for a prime number of cycles to avoid
|
||||
* noise correlation. This reduces variance faster. */
|
||||
/* Doing a neighbor shift only after a few iteration.
|
||||
* We wait for a prime number of cycles to avoid noise correlation.
|
||||
* This reduces variance faster. */
|
||||
effects->ssr_neighbor_ofs = ((sample / 5) % 8) * 4;
|
||||
switch ((sample / 11) % 4) {
|
||||
case 0:
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
|
||||
/* Based on Practical Realtime Strategies for Accurate Indirect Occlusion
|
||||
* http://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pdf
|
||||
* http://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pptx */
|
||||
* http://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pptx
|
||||
*/
|
||||
|
||||
#if defined(MESH_SHADER)
|
||||
# if !defined(USE_ALPHA_HASH)
|
||||
|
||||
@@ -319,7 +319,8 @@ float line_unit_sphere_intersect_dist(vec3 lineorigin, vec3 linedirection)
|
||||
|
||||
float line_unit_box_intersect_dist(vec3 lineorigin, vec3 linedirection)
|
||||
{
|
||||
/* https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/ */
|
||||
/* https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
|
||||
*/
|
||||
vec3 firstplane = (vec3(1.0) - lineorigin) / linedirection;
|
||||
vec3 secondplane = (vec3(-1.0) - lineorigin) / linedirection;
|
||||
vec3 furthestplane = max(firstplane, secondplane);
|
||||
|
||||
@@ -14,7 +14,8 @@ vec4 safe_color(vec4 c)
|
||||
|
||||
/**
|
||||
* Adapted from https://casual-effects.com/g3d/G3D10/data-files/shader/Film/Film_temporalAA.pix
|
||||
* which is adapted from https://github.com/gokselgoktas/temporal-anti-aliasing/blob/master/Assets/Resources/Shaders/TemporalAntiAliasing.cginc
|
||||
* which is adapted from
|
||||
* https://github.com/gokselgoktas/temporal-anti-aliasing/blob/master/Assets/Resources/Shaders/TemporalAntiAliasing.cginc
|
||||
* which is adapted from https://github.com/playdeadgames/temporal
|
||||
* Optimization by Stubbesaurus and epsilon adjustment to avoid division by zero.
|
||||
*
|
||||
|
||||
@@ -161,7 +161,8 @@ vec3 probe_evaluate_cube(int pd_id, vec3 W, vec3 R, float roughness)
|
||||
|
||||
/* From Frostbite PBR Course
|
||||
* Distance based roughness
|
||||
* http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf */
|
||||
* http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
|
||||
*/
|
||||
float original_roughness = roughness;
|
||||
float linear_roughness = sqrt(roughness);
|
||||
float distance_roughness = saturate(dist * linear_roughness / length(intersection));
|
||||
|
||||
@@ -282,7 +282,8 @@ void CLOSURE_NAME(vec3 N
|
||||
/* ---------------- SPECULAR ENVIRONMENT LIGHTING ----------------- */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Accumulate incoming light from all sources until accumulator is full. Then apply Occlusion and BRDF. */
|
||||
/* Accumulate incoming light from all sources until accumulator is full. Then apply Occlusion and
|
||||
* BRDF. */
|
||||
#ifdef CLOSURE_GLOSSY
|
||||
vec4 spec_accum = vec4(0.0);
|
||||
#endif
|
||||
|
||||
@@ -164,8 +164,8 @@ void ltc_transform_quad(vec3 N, vec3 V, mat3 Minv, inout vec3 corners[4])
|
||||
corners[3] = normalize(Minv * corners[3]);
|
||||
}
|
||||
|
||||
/* If corners have already pass through ltc_transform_quad(), then N **MUST** be vec3(0.0, 0.0, 1.0),
|
||||
* corresponding to the Up axis of the shading basis. */
|
||||
/* If corners have already pass through ltc_transform_quad(),
|
||||
* then N **MUST** be vec3(0.0, 0.0, 1.0), corresponding to the Up axis of the shading basis. */
|
||||
float ltc_evaluate_quad(vec3 corners[4], vec3 N)
|
||||
{
|
||||
/* Approximation using a sphere of the same solid angle than the quad.
|
||||
|
||||
@@ -84,8 +84,8 @@ void prepare_raycast(vec3 ray_origin,
|
||||
ss_end.w = project_point(ProjectionMatrix, ray_end).z;
|
||||
|
||||
/* XXX This is a hack a better method is welcome ! */
|
||||
/* We take the delta between the offseted depth and the depth and substract it from the ray depth.
|
||||
* This will change the world space thickness appearance a bit but we can have negative
|
||||
/* We take the delta between the offseted depth and the depth and substract it from the ray
|
||||
* depth. This will change the world space thickness appearance a bit but we can have negative
|
||||
* values without worries. We cannot do this in viewspace because of the perspective division. */
|
||||
ss_start.w = 2.0 * ss_start.z - ss_start.w;
|
||||
ss_end.w = 2.0 * ss_end.z - ss_end.w;
|
||||
|
||||
@@ -36,7 +36,8 @@ vec3 octahedral_to_cubemap_proj(vec2 co)
|
||||
}
|
||||
|
||||
/* Marco Salvi's GDC 2008 presentation about shadow maps pre-filtering techniques slide 24 */
|
||||
/* http://advances.realtimerendering.com/s2009/SIGGRAPH%202009%20-%20Lighting%20Research%20at%20Bungie.pdf Slide 55*/
|
||||
/* http://advances.realtimerendering.com/s2009/SIGGRAPH%202009%20-%20Lighting%20Research%20at%20Bungie.pdf
|
||||
* Slide 55. */
|
||||
#define ln_space_prefilter_step(ref, sample) exp(sample - ref)
|
||||
#define ln_space_prefilter_finalize(ref, sum) (ref + log(shadowInvSampleCount * sum))
|
||||
|
||||
|
||||
@@ -216,7 +216,8 @@ static DrawEngineType draw_engine_external_type = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* Note: currently unused, we should not register unless we want to see this when debugging the view. */
|
||||
/* Note: currently unused,
|
||||
* we should not register unless we want to see this when debugging the view. */
|
||||
|
||||
RenderEngineType DRW_engine_viewport_external_type = {
|
||||
NULL,
|
||||
|
||||
@@ -634,8 +634,9 @@ GPUBatch *DRW_gpencil_get_buffer_fill_geom(bGPdata *gpd)
|
||||
float(*points2d)[2] = MEM_mallocN(sizeof(*points2d) * totpoints, __func__);
|
||||
|
||||
/* Convert points to array and triangulate
|
||||
* Here a cache is not used because while drawing the information changes all the time, so the cache
|
||||
* would be recalculated constantly, so it is better to do direct calculation for each function call
|
||||
* Here a cache is not used because while drawing the information changes all the time, so the
|
||||
* cache would be recalculated constantly, so it is better to do direct calculation for each
|
||||
* function call
|
||||
*/
|
||||
for (int i = 0; i < totpoints; i++) {
|
||||
const tGPspoint *pt = &points[i];
|
||||
|
||||
@@ -1072,7 +1072,8 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache,
|
||||
DRW_gpencil_recalc_geometry_caches(ob, gpl, gp_style, src_gps);
|
||||
}
|
||||
|
||||
/* if the fill has any value, it's considered a fill and is not drawn if simplify fill is enabled */
|
||||
/* if the fill has any value, it's considered a fill and is not drawn if simplify fill is
|
||||
* enabled */
|
||||
if ((stl->storage->simplify_fill) &&
|
||||
(scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_REMOVE_FILL_LINE)) {
|
||||
if ((gp_style->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) ||
|
||||
@@ -1367,7 +1368,8 @@ static void gpencil_copy_frame(bGPDframe *gpf, bGPDframe *derived_gpf)
|
||||
}
|
||||
}
|
||||
|
||||
/* Triangulate stroke for high quality fill (this is done only if cache is null or stroke was modified) */
|
||||
/* Triangulate stroke for high quality fill (this is done only if cache is null or stroke was
|
||||
* modified) */
|
||||
void DRW_gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
|
||||
{
|
||||
BLI_assert(gps->totpoints >= 3);
|
||||
|
||||
@@ -328,7 +328,8 @@ void GPENCIL_cache_init(void *vedata)
|
||||
stl->g_data->shgrps_edit_point = NULL;
|
||||
|
||||
if (!stl->shgroups) {
|
||||
/* Alloc maximum size because count strokes is very slow and can be very complex due onion skinning.
|
||||
/* Alloc maximum size because count strokes is very slow and can be very complex due onion
|
||||
* skinning.
|
||||
*/
|
||||
stl->shgroups = MEM_mallocN(sizeof(GPENCIL_shgroup) * GPENCIL_MAX_SHGROUPS, "GPENCIL_shgroup");
|
||||
}
|
||||
|
||||
@@ -119,10 +119,11 @@ static void GPENCIL_dof_nearfar(Object *camera, float coc, float nearfar[2])
|
||||
float focus_dist = BKE_camera_object_dof_distance(camera);
|
||||
float focal_len = cam->lens;
|
||||
|
||||
/* this is factor that converts to the scene scale. focal length and sensor are expressed in mm
|
||||
* unit.scale_length is how many meters per blender unit we have. We want to convert to blender units though
|
||||
* because the shader reads coordinates in world space, which is in blender units.
|
||||
* Note however that focus_distance is already in blender units and shall not be scaled here (see T48157). */
|
||||
/* This is factor that converts to the scene scale. focal length and sensor are expressed in mm
|
||||
* unit.scale_length is how many meters per blender unit we have. We want to convert to blender
|
||||
* units though because the shader reads coordinates in world space, which is in blender units.
|
||||
* Note however that focus_distance is already in blender units and shall not be scaled here
|
||||
* (see T48157). */
|
||||
float scale = (scene->unit.system) ? scene->unit.scale_length : 1.0f;
|
||||
float scale_camera = 0.001f / scale;
|
||||
/* we want radius here for the aperture number */
|
||||
|
||||
@@ -180,7 +180,8 @@ void main()
|
||||
gl_FragDepth = min(-0.05, (gl_FragCoord.z / gl_FragCoord.w));
|
||||
}
|
||||
else if (xraymode == GP_XRAY_3DSPACE) {
|
||||
/* if 3D mode, move slightly the fill to avoid z-fighting between stroke and fill on same stroke */
|
||||
/* if 3D mode, move slightly the fill to avoid z-fighting between stroke and fill on same
|
||||
* stroke */
|
||||
if (drawmode == GP_DRAWMODE_3D) {
|
||||
gl_FragDepth = gl_FragCoord.z * 1.0001;
|
||||
}
|
||||
|
||||
@@ -362,9 +362,9 @@ void main()
|
||||
for (int dX = -1; dX <= 1; ++dX) {
|
||||
for (int dY = -1; dY <= 1; ++dY) {
|
||||
vec2 offset = vec2(float(dX), float(dY));
|
||||
/* If a pixel in the window is located at (x+dX, y+dY), put it at index (dX + R)(2R + 1) + (dY + R) of the
|
||||
* pixel array. This will fill the pixel array, with the top left pixel of the window at pixel[0] and the
|
||||
* bottom right pixel of the window at pixel[N-1]. */
|
||||
/* If a pixel in the window is located at (x+dX, y+dY), put it at index (dX + R)(2R + 1) +
|
||||
* (dY + R) of the pixel array. This will fill the pixel array, with the top left pixel of
|
||||
* the window at pixel[0] and the bottom right pixel of the window at pixel[N-1]. */
|
||||
v[(dX + 1) * 3 + (dY + 1)] = toVec(texture(blurTex, uv + offset * pixel_size * rad));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ float max_v3(vec3 v)
|
||||
|
||||
float line_unit_box_intersect_dist(vec3 lineorigin, vec3 linedirection)
|
||||
{
|
||||
/* https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/ */
|
||||
/* https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
|
||||
*/
|
||||
vec3 firstplane = (vec3(1.0) - lineorigin) / linedirection;
|
||||
vec3 secondplane = (vec3(-1.0) - lineorigin) / linedirection;
|
||||
vec3 furthestplane = min(firstplane, secondplane);
|
||||
|
||||
@@ -243,9 +243,10 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera)
|
||||
/* TODO(fclem) deduplicate with eevee */
|
||||
|
||||
/* this is factor that converts to the scene scale. focal length and sensor are expressed in mm
|
||||
* unit.scale_length is how many meters per blender unit we have. We want to convert to blender units though
|
||||
* because the shader reads coordinates in world space, which is in blender units.
|
||||
* Note however that focus_distance is already in blender units and shall not be scaled here (see T48157). */
|
||||
* unit.scale_length is how many meters per blender unit we have. We want to convert to blender
|
||||
* units though because the shader reads coordinates in world space, which is in blender units.
|
||||
* Note however that focus_distance is already in blender units and shall not be scaled here
|
||||
* (see T48157). */
|
||||
float scale = (scene_eval->unit.system) ? scene_eval->unit.scale_length : 1.0f;
|
||||
float scale_camera = 0.001f / scale;
|
||||
/* we want radius here for the aperture number */
|
||||
|
||||
@@ -43,7 +43,8 @@ void workbench_material_update_data(WORKBENCH_PrivateData *wpd,
|
||||
Material *mat,
|
||||
WORKBENCH_MaterialData *data)
|
||||
{
|
||||
/* When V3D_SHADING_TEXTURE_COLOR is active, use V3D_SHADING_MATERIAL_COLOR as fallback when no texture could be determined */
|
||||
/* When V3D_SHADING_TEXTURE_COLOR is active, use V3D_SHADING_MATERIAL_COLOR as fallback when no
|
||||
* texture could be determined */
|
||||
int color_type = wpd->shading.color_type == V3D_SHADING_TEXTURE_COLOR ?
|
||||
V3D_SHADING_MATERIAL_COLOR :
|
||||
wpd->shading.color_type;
|
||||
|
||||
@@ -259,7 +259,8 @@ static void MPATH_cache_motion_path(MPATH_PassList *psl,
|
||||
else if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) {
|
||||
bMotionPathVert *mpvP = (mpv - stepsize);
|
||||
bMotionPathVert *mpvN = (mpv + stepsize);
|
||||
/* only draw framenum if several consecutive highlighted points don't occur on same point */
|
||||
/* only draw framenum if several consecutive highlighted points don't occur on same point
|
||||
*/
|
||||
if ((equals_v3v3(mpv->co, mpvP->co) == 0) || (equals_v3v3(mpv->co, mpvN->co) == 0)) {
|
||||
numstr_len = sprintf(numstr, " %d", frame);
|
||||
DRW_text_cache_add(dt, mpv->co, numstr, numstr_len, 0, 0, txt_flag, col);
|
||||
|
||||
@@ -1185,8 +1185,8 @@ static void draw_bone_update_disp_matrix_bbone(EditBone *eBone, bPoseChannel *pc
|
||||
size_to_mat4(s, (const float[3]){xwidth, length / bbone_segments, zwidth});
|
||||
|
||||
/* Compute BBones segment matrices... */
|
||||
/* Note that we need this even for one-segment bones, because box drawing need specific weirdo matrix for the box,
|
||||
* that we cannot use to draw end points & co. */
|
||||
/* Note that we need this even for one-segment bones, because box drawing need specific weirdo
|
||||
* matrix for the box, that we cannot use to draw end points & co. */
|
||||
if (pchan) {
|
||||
Mat4 *bbones_mat = (Mat4 *)pchan->draw_data->bbone_matrix;
|
||||
if (bbone_segments > 1) {
|
||||
@@ -1797,7 +1797,8 @@ static void draw_bone_relations(EditBone *ebone,
|
||||
}
|
||||
else if (pchan && pchan->parent) {
|
||||
if (do_relations) {
|
||||
/* Only draw if bone or its parent is selected - reduces viewport complexity with complex rigs */
|
||||
/* Only draw if bone or its parent is selected - reduces viewport complexity with complex
|
||||
* rigs */
|
||||
if ((boneflag & BONE_SELECTED) ||
|
||||
(pchan->parent->bone && (pchan->parent->bone->flag & BONE_SELECTED))) {
|
||||
if ((boneflag & BONE_CONNECTED) == 0) {
|
||||
|
||||
@@ -3017,7 +3017,8 @@ GPUBatch *DRW_cache_bone_dof_lines_get(void)
|
||||
* We could make these more generic functions.
|
||||
* although filling 1d lines is not common.
|
||||
*
|
||||
* \note Use x coordinate to identify the vertex the vertex shader take care to place it appropriately.
|
||||
* \note Use x coordinate to identify the vertex the vertex shader take care to place it
|
||||
* appropriately.
|
||||
*/
|
||||
|
||||
static const float camera_coords_frame_bounds[5] = {
|
||||
|
||||
@@ -325,8 +325,8 @@ typedef enum eMRDataType {
|
||||
#define MR_DATATYPE_LOOSE_VERT_EGDE (MR_DATATYPE_LOOSE_VERT | MR_DATATYPE_LOOSE_EDGE)
|
||||
|
||||
/**
|
||||
* These functions look like they would be slow but they will typically return true on the first iteration.
|
||||
* Only false when all attached elements are hidden.
|
||||
* These functions look like they would be slow but they will typically return true on the first
|
||||
* iteration. Only false when all attached elements are hidden.
|
||||
*/
|
||||
static bool bm_vert_has_visible_edge(const BMVert *v)
|
||||
{
|
||||
@@ -1159,7 +1159,8 @@ static MeshRenderData *mesh_render_data_create_ex(Mesh *me,
|
||||
/* note: BKE_editmesh_loop_tangent_calc calculates 'CD_TANGENT',
|
||||
* not 'CD_MLOOPTANGENT' (as done below). It's OK, they're compatible. */
|
||||
|
||||
/* note: normally we'd use 'i_src' here, but 'i_dst' is in sync with 'rdata->cd.output' */
|
||||
/* note: normally we'd use 'i_src' here, but 'i_dst' is in sync with 'rdata->cd.output'
|
||||
*/
|
||||
rdata->cd.layers.tangent[i_dst] = CustomData_get_layer_n(
|
||||
&rdata->cd.output.ldata, CD_TANGENT, i_dst);
|
||||
if (rdata->tri_len != 0) {
|
||||
|
||||
@@ -90,8 +90,8 @@ void DRW_globals_update(void)
|
||||
dot_v3v3(gb->colorEditMeshMiddle, (float[3]){0.3333f, 0.3333f, 0.3333f})); /* Desaturate */
|
||||
|
||||
interp_v4_v4v4(gb->colorDupliSelect, gb->colorBackground, gb->colorSelect, 0.5f);
|
||||
/* Was 50% in 2.7x since the background was lighter making it easier to tell the color from black,
|
||||
* with a darker background we need a more faded color. */
|
||||
/* Was 50% in 2.7x since the background was lighter making it easier to tell the color from
|
||||
* black, with a darker background we need a more faded color. */
|
||||
interp_v4_v4v4(gb->colorDupli, gb->colorBackground, gb->colorWire, 0.3f);
|
||||
|
||||
#ifdef WITH_FREESTYLE
|
||||
@@ -1045,7 +1045,7 @@ struct GPUShader *volume_velocity_shader_get(bool use_needle)
|
||||
}
|
||||
}
|
||||
|
||||
/* ******************************************** COLOR UTILS *********************************************** */
|
||||
/* ******************************************** COLOR UTILS ************************************ */
|
||||
|
||||
/* TODO FINISH */
|
||||
/**
|
||||
|
||||
@@ -193,7 +193,8 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object,
|
||||
DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", part->rad_tip * part->rad_scale * 0.5f);
|
||||
DRW_shgroup_uniform_bool_copy(
|
||||
shgrp, "hairCloseTip", (part->shape_flag & PART_SHAPE_CLOSE_TIP) != 0);
|
||||
/* TODO(fclem): Until we have a better way to cull the hair and render with orco, bypass culling test. */
|
||||
/* TODO(fclem): Until we have a better way to cull the hair and render with orco, bypass culling
|
||||
* test. */
|
||||
DRW_shgroup_call_object_add_no_cull(
|
||||
shgrp, hair_cache->final[subdiv].proc_hairs[thickness_res - 1], object);
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
/**
|
||||
* DRW Instance Data Manager
|
||||
* This is a special memory manager that keeps memory blocks ready to send as vbo data in one continuous allocation.
|
||||
* This way we avoid feeding gawain each instance data one by one and unnecessary memcpy.
|
||||
* Since we loose which memory block was used each #DRWShadingGroup we need to redistribute them in the same order/size
|
||||
* to avoid to realloc each frame.
|
||||
* This is why #DRWInstanceDatas are sorted in a list for each different data size.
|
||||
* This is a special memory manager that keeps memory blocks ready to send as vbo data in one
|
||||
* continuous allocation. This way we avoid feeding gawain each instance data one by one and
|
||||
* unnecessary memcpy. Since we loose which memory block was used each #DRWShadingGroup we need to
|
||||
* redistribute them in the same order/size to avoid to realloc each frame. This is why
|
||||
* #DRWInstanceDatas are sorted in a list for each different data size.
|
||||
*/
|
||||
|
||||
#include "draw_instance_data.h"
|
||||
|
||||
@@ -161,7 +161,8 @@ void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, con
|
||||
drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_TEXTURE, tex, 0, 1);
|
||||
}
|
||||
|
||||
/* Same as DRW_shgroup_uniform_texture but is guaranteed to be bound if shader does not change between shgrp. */
|
||||
/* Same as DRW_shgroup_uniform_texture but is guaranteed to be bound if shader does not change
|
||||
* between shgrp. */
|
||||
void DRW_shgroup_uniform_texture_persistent(DRWShadingGroup *shgroup,
|
||||
const char *name,
|
||||
const GPUTexture *tex)
|
||||
@@ -178,7 +179,8 @@ void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup,
|
||||
drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_BLOCK, ubo, 0, 1);
|
||||
}
|
||||
|
||||
/* Same as DRW_shgroup_uniform_block but is guaranteed to be bound if shader does not change between shgrp. */
|
||||
/* Same as DRW_shgroup_uniform_block but is guaranteed to be bound if shader does not change
|
||||
* between shgrp. */
|
||||
void DRW_shgroup_uniform_block_persistent(DRWShadingGroup *shgroup,
|
||||
const char *name,
|
||||
const GPUUniformBuffer *ubo)
|
||||
@@ -1178,7 +1180,7 @@ void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct GPUBatch *batch
|
||||
/* PERF : This destroys the vaos cache so better check if it's necessary. */
|
||||
/* Note: This WILL break if batch->verts[0] is destroyed and reallocated
|
||||
* at the same address. Bindings/VAOs would remain obsolete. */
|
||||
//if (shgroup->instancing_geom->inst != batch->verts[0])
|
||||
// if (shgroup->instancing_geom->inst != batch->verts[0])
|
||||
GPU_batch_instbuf_set(shgroup->instance_geom, batch->verts[0], false);
|
||||
|
||||
#ifdef USE_GPU_SELECT
|
||||
|
||||
@@ -445,8 +445,9 @@ void DRW_state_clip_planes_set_from_rv3d(RegionView3D *rv3d)
|
||||
|
||||
/* Extract the 8 corners from a Projection Matrix.
|
||||
* Although less accurate, this solution can be simplified as follows:
|
||||
* BKE_boundbox_init_from_minmax(&bbox, (const float[3]){-1.0f, -1.0f, -1.0f}, (const float[3]){1.0f, 1.0f, 1.0f});
|
||||
* for (int i = 0; i < 8; i++) {mul_project_m4_v3(projinv, bbox.vec[i]);}
|
||||
* BKE_boundbox_init_from_minmax(&bbox, (const float[3]){-1.0f, -1.0f, -1.0f}, (const
|
||||
* float[3]){1.0f, 1.0f, 1.0f}); for (int i = 0; i < 8; i++) {mul_project_m4_v3(projinv,
|
||||
* bbox.vec[i]);}
|
||||
*/
|
||||
static void draw_frustum_boundbox_calc(const float (*projmat)[4], BoundBox *r_bbox)
|
||||
{
|
||||
|
||||
@@ -161,7 +161,7 @@ static void drw_deferred_shader_compilation_free(void *custom_data)
|
||||
|
||||
static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred)
|
||||
{
|
||||
/* Do not deferre the compilation if we are rendering for image.
|
||||
/* Do not deferre the compilation if we are rendering for image.
|
||||
* deferred rendering is only possible when `evil_C` is available */
|
||||
if (DST.draw_ctx.evil_C == NULL || DRW_state_is_image_render() || !USE_DEFERRED_COMPILATION ||
|
||||
!deferred) {
|
||||
@@ -183,7 +183,8 @@ static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred)
|
||||
/* Use original scene ID since this is what the jobs template tests for. */
|
||||
Scene *scene = (Scene *)DEG_get_original_id(&DST.draw_ctx.scene->id);
|
||||
|
||||
/* Get the running job or a new one if none is running. Can only have one job per type & owner. */
|
||||
/* Get the running job or a new one if none is running. Can only have one job per type & owner.
|
||||
*/
|
||||
wmJob *wm_job = WM_jobs_get(wm,
|
||||
win,
|
||||
scene,
|
||||
|
||||
@@ -570,7 +570,8 @@ static void EDIT_MESH_cache_init(void *vedata)
|
||||
&stl->g_data->vert_shgrp);
|
||||
}
|
||||
else {
|
||||
/* We render all wires with depth and opaque to a new fbo and blend the result based on depth values */
|
||||
/* We render all wires with depth and opaque to a new fbo and blend the result based on depth
|
||||
* values */
|
||||
psl->edit_face_occluded = edit_mesh_create_overlay_pass(&zero,
|
||||
stl->g_data->data_mask,
|
||||
stl->g_data->do_edges,
|
||||
|
||||
@@ -47,8 +47,8 @@ void DRW_edit_mesh_mode_text_measure_stats(ARegion *ar,
|
||||
Object *ob,
|
||||
const UnitSettings *unit)
|
||||
{
|
||||
/* Do not use ascii when using non-default unit system, some unit chars are utf8 (micro, square, etc.).
|
||||
* See bug #36090.
|
||||
/* Do not use ascii when using non-default unit system, some unit chars are utf8 (micro, square,
|
||||
* etc.). See bug #36090.
|
||||
*/
|
||||
struct DRWTextStore *dt = DRW_text_cache_ensure();
|
||||
const short txt_flag = DRW_TEXT_CACHE_GLOBALSPACE | (unit->system ? 0 : DRW_TEXT_CACHE_ASCII);
|
||||
@@ -159,15 +159,14 @@ void DRW_edit_mesh_mode_text_measure_stats(ARegion *ar,
|
||||
if (BM_edge_loop_pair(eed, &l_a, &l_b)) {
|
||||
/* Draw selected edges, or edges next to selected verts while dragging. */
|
||||
if (BM_elem_flag_test(eed, BM_ELEM_SELECT) ||
|
||||
(do_moving &&
|
||||
(BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) ||
|
||||
BM_elem_flag_test(eed->v2, BM_ELEM_SELECT) ||
|
||||
/* Special case, this is useful to show when verts connected to this edge
|
||||
* via a face are being transformed. */
|
||||
BM_elem_flag_test(l_a->next->next->v, BM_ELEM_SELECT) ||
|
||||
BM_elem_flag_test(l_a->prev->v, BM_ELEM_SELECT) ||
|
||||
BM_elem_flag_test(l_b->next->next->v, BM_ELEM_SELECT) ||
|
||||
BM_elem_flag_test(l_b->prev->v, BM_ELEM_SELECT)))) {
|
||||
(do_moving && (BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) ||
|
||||
BM_elem_flag_test(eed->v2, BM_ELEM_SELECT) ||
|
||||
/* Special case, this is useful to show when verts connected
|
||||
* to this edge via a face are being transformed. */
|
||||
BM_elem_flag_test(l_a->next->next->v, BM_ELEM_SELECT) ||
|
||||
BM_elem_flag_test(l_a->prev->v, BM_ELEM_SELECT) ||
|
||||
BM_elem_flag_test(l_b->next->next->v, BM_ELEM_SELECT) ||
|
||||
BM_elem_flag_test(l_b->prev->v, BM_ELEM_SELECT)))) {
|
||||
float v1_clip[3], v2_clip[3];
|
||||
|
||||
copy_v3_v3(v1, eed->v1->co);
|
||||
@@ -320,7 +319,8 @@ void DRW_edit_mesh_mode_text_measure_stats(ARegion *ar,
|
||||
}
|
||||
}
|
||||
|
||||
/* This option is for mesh ops and addons debugging; only available in UI if Blender starts with --debug */
|
||||
/* This option is for mesh ops and addons debugging; only available in UI if Blender starts with
|
||||
* --debug */
|
||||
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_INDICES) {
|
||||
int i;
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ static void EDIT_METABALL_cache_init(void *vedata)
|
||||
/* Add geometry to shadingGroups. Execute for each objects */
|
||||
static void EDIT_METABALL_cache_populate(void *vedata, Object *ob)
|
||||
{
|
||||
//EDIT_METABALL_PassList *psl = ((EDIT_METABALL_Data *)vedata)->psl;
|
||||
// EDIT_METABALL_PassList *psl = ((EDIT_METABALL_Data *)vedata)->psl;
|
||||
EDIT_METABALL_StorageList *stl = ((EDIT_METABALL_Data *)vedata)->stl;
|
||||
|
||||
if (ob->type == OB_MBALL) {
|
||||
|
||||
@@ -953,7 +953,8 @@ static void DRW_shgroup_empty_image(OBJECT_Shaders *sh_data,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Calling 'BKE_image_get_size' may free the texture. Get the size from 'tex' instead, see: T59347 */
|
||||
/* Calling 'BKE_image_get_size' may free the texture. Get the size from 'tex' instead,
|
||||
* see: T59347 */
|
||||
int size[2] = {0};
|
||||
|
||||
const bool use_alpha_blend = (ob->empty_image_flag & OB_EMPTY_IMAGE_USE_ALPHA_BLEND) != 0;
|
||||
|
||||
@@ -294,7 +294,7 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob)
|
||||
const Mesh *me_orig = DEG_get_original_object(ob)->data;
|
||||
Scene *scene = draw_ctx->scene;
|
||||
const bool use_surface = draw_ctx->v3d->overlay.texture_paint_mode_opacity !=
|
||||
0.0; //DRW_object_is_mode_shade(ob) == true;
|
||||
0.0; // DRW_object_is_mode_shade(ob) == true;
|
||||
const bool use_material_slots = (scene->toolsettings->imapaint.mode ==
|
||||
IMAGEPAINT_MODE_MATERIAL);
|
||||
const bool use_face_sel = (me_orig->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
||||
|
||||
@@ -200,7 +200,8 @@ static void SCULPT_cache_populate(void *vedata, Object *ob)
|
||||
sculpt_update_pbvh_normals(ob);
|
||||
|
||||
/* XXX, needed for dyntopo-undo (which clears).
|
||||
* probably depsgraph should handlle? in 2.7x getting derived-mesh does this (mesh_build_data) */
|
||||
* probably depsgraph should handlle? in 2.7x
|
||||
* getting derived-mesh does this (mesh_build_data). */
|
||||
if (ob->sculpt->pbvh == NULL) {
|
||||
/* create PBVH immediately (would be created on the fly too,
|
||||
* but this avoids waiting on first stroke) */
|
||||
|
||||
@@ -674,7 +674,7 @@ vec4 FxaaPixelShader(
|
||||
posP.x += offNP.x * FXAA_QUALITY__P10;
|
||||
if (!doneP)
|
||||
posP.y += offNP.y * FXAA_QUALITY__P10;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------------------*/
|
||||
# if (FXAA_QUALITY__PS > 11)
|
||||
if (doneNP) {
|
||||
if (!doneN)
|
||||
@@ -696,7 +696,7 @@ vec4 FxaaPixelShader(
|
||||
posP.x += offNP.x * FXAA_QUALITY__P11;
|
||||
if (!doneP)
|
||||
posP.y += offNP.y * FXAA_QUALITY__P11;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------------------*/
|
||||
# if (FXAA_QUALITY__PS > 12)
|
||||
if (doneNP) {
|
||||
if (!doneN)
|
||||
@@ -718,10 +718,10 @@ vec4 FxaaPixelShader(
|
||||
posP.x += offNP.x * FXAA_QUALITY__P12;
|
||||
if (!doneP)
|
||||
posP.y += offNP.y * FXAA_QUALITY__P12;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------------------*/
|
||||
}
|
||||
# endif
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------------------*/
|
||||
}
|
||||
# endif
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@@ -38,8 +38,8 @@ uniform usamplerBuffer hairStrandBuffer; /* R32UI */
|
||||
uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */
|
||||
|
||||
/* Not used, use one buffer per uv layer */
|
||||
//uniform samplerBuffer hairUVBuffer; /* RG32F */
|
||||
//uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */
|
||||
// uniform samplerBuffer hairUVBuffer; /* RG32F */
|
||||
// uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */
|
||||
|
||||
/* -- Subdivision stage -- */
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* We want to know how much a pixel is covered by a line.
|
||||
* We replace the square pixel with acircle of the same area and try to find the intersection area.
|
||||
* The area we search is the circular segment. https://en.wikipedia.org/wiki/Circular_segment
|
||||
* The formula for the area uses inverse trig function and is quite complexe.
|
||||
* Instead, we approximate it by using the smoothstep function and a 1.05 factor to the disc radius.
|
||||
* The formula for the area uses inverse trig function and is quite complexe. Instead,
|
||||
* we approximate it by using the smoothstep function and a 1.05 factor to the disc radius.
|
||||
*/
|
||||
#define DISC_RADIUS (M_1_SQRTPI * 1.05)
|
||||
#define GRID_LINE_SMOOTH_START (0.5 - DISC_RADIUS)
|
||||
|
||||
@@ -40,8 +40,8 @@ uniform int gridFlag;
|
||||
* We want to know how much a pixel is covered by a line.
|
||||
* We replace the square pixel with acircle of the same area and try to find the intersection area.
|
||||
* The area we search is the circular segment. https://en.wikipedia.org/wiki/Circular_segment
|
||||
* The formula for the area uses inverse trig function and is quite complexe.
|
||||
* Instead, we approximate it by using the smoothstep function and a 1.05 factor to the disc radius.
|
||||
* The formula for the area uses inverse trig function and is quite complexe. Instead,
|
||||
* we approximate it by using the smoothstep function and a 1.05 factor to the disc radius.
|
||||
*/
|
||||
#define DISC_RADIUS (M_1_SQRTPI * 1.05)
|
||||
#define GRID_LINE_SMOOTH_START (0.5 - DISC_RADIUS)
|
||||
|
||||
Reference in New Issue
Block a user