diff options
Diffstat (limited to 'source/blender/draw/engines/eevee')
9 files changed, 17 insertions, 22 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_film.cc b/source/blender/draw/engines/eevee/eevee_film.cc index a45d503a25c..2542e39aed0 100644 --- a/source/blender/draw/engines/eevee/eevee_film.cc +++ b/source/blender/draw/engines/eevee/eevee_film.cc @@ -92,9 +92,9 @@ void Film::init(const ivec2 &full_extent, const rcti *output_rect) } data_.opacity = 1.0f; - data_.uv_scale = 1.0f / vec2(full_extent); - data_.uv_scale_inv = full_extent; - data_.uv_bias = data_.offset / vec2(full_extent); + data_.uv_scale_inv = vec2(full_extent); + data_.uv_scale = 1.0f / data_.uv_scale_inv; + data_.uv_bias = vec2(data_.offset) * data_.uv_scale; } void Film::sync(void) diff --git a/source/blender/draw/engines/eevee/eevee_light.cc b/source/blender/draw/engines/eevee/eevee_light.cc index ab09ff4b0e5..bcc68d773f5 100644 --- a/source/blender/draw/engines/eevee/eevee_light.cc +++ b/source/blender/draw/engines/eevee/eevee_light.cc @@ -76,8 +76,8 @@ void Light::sync(ShadowModule &shadows, const Object *ob, float threshold) this->color = vec3(&la->r) * la->energy; normalize_m4_m4_ex(this->object_mat, ob->obmat, scale); /* Make sure we have consistent handedness (in case of negatively scaled Z axis). */ - vec3 cross = vec3::cross(this->_right, this->_up); - if (vec3::dot(cross, this->_back) < 0.0f) { + vec3 cross = math::cross(float3(this->_right), float3(this->_up)); + if (math::dot(cross, float3(this->_back)) < 0.0f) { negate_v3(this->_up); } diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.cc b/source/blender/draw/engines/eevee/eevee_lightcache.cc index c778c07f098..8c6625e4515 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.cc +++ b/source/blender/draw/engines/eevee/eevee_lightcache.cc @@ -1104,7 +1104,7 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float void EEVEE_lightcache_free(struct LightCache *lcache_) { eevee::LightCache *lcache = reinterpret_cast<eevee::LightCache *>(lcache_); - OBJECT_GUARDED_SAFE_DELETE(lcache, eevee::LightCache); + MEM_delete(lcache); } void EEVEE_lightcache_info_update(struct SceneEEVEE *eevee) diff --git a/source/blender/draw/engines/eevee/eevee_lightprobe.cc b/source/blender/draw/engines/eevee/eevee_lightprobe.cc index 2acce4ee203..c8eadea5f9e 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobe.cc +++ b/source/blender/draw/engines/eevee/eevee_lightprobe.cc @@ -38,7 +38,7 @@ void LightProbeModule::init() bool use_lookdev = inst_.use_studio_light(); if (!use_lookdev && lightcache_ && lightcache_->load()) { - OBJECT_GUARDED_SAFE_DELETE(lightcache_lookdev_, LightCache); + MEM_delete(lightcache_lookdev_); } else { if (lightcache_ && (lightcache_->flag & LIGHTCACHE_NOT_USABLE)) { diff --git a/source/blender/draw/engines/eevee/eevee_lightprobe.hh b/source/blender/draw/engines/eevee/eevee_lightprobe.hh index 1a58f73409b..c13f7a75ca4 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobe.hh +++ b/source/blender/draw/engines/eevee/eevee_lightprobe.hh @@ -89,8 +89,8 @@ class LightProbeModule { ~LightProbeModule() { - OBJECT_GUARDED_SAFE_DELETE(lightcache_lookdev_, LightCache); - OBJECT_GUARDED_SAFE_DELETE(lightcache_baking_, LightCache); + MEM_delete(lightcache_lookdev_); + MEM_delete(lightcache_baking_); } void init(); diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.cc b/source/blender/draw/engines/eevee/eevee_lookdev.cc index e5633ac47ee..881ab90343f 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.cc +++ b/source/blender/draw/engines/eevee/eevee_lookdev.cc @@ -314,7 +314,7 @@ void LookDev::sync_overlay(void) /* Pass 2D scale and bias factor in the last column. */ vec2 scale = sphere_size_ / vec2(viewport_size); - vec2 bias = -1.0f + scale + 2.0f * (anchor_ + offset + jitter) / vec2(viewport_size); + vec2 bias = -1.0f + scale + 2.0f * (vec2(anchor_) + offset + jitter) / vec2(viewport_size); copy_v4_fl4(sphere_mat[3], UNPACK2(scale), UNPACK2(bias)); DRW_shgroup_call_obmat(grp, sphere, sphere_mat); diff --git a/source/blender/draw/engines/eevee/eevee_shader_shared.hh b/source/blender/draw/engines/eevee/eevee_shader_shared.hh index 746087ad232..07690744367 100644 --- a/source/blender/draw/engines/eevee/eevee_shader_shared.hh +++ b/source/blender/draw/engines/eevee/eevee_shader_shared.hh @@ -43,12 +43,7 @@ #else /* C++ */ # pragma once -# include "BLI_float2.hh" -# include "BLI_float3.hh" -# include "BLI_float4.hh" # include "BLI_float4x4.hh" -# include "BLI_int2.hh" -# include "BLI_int3.hh" typedef float mat4[4][4]; using vec4 = blender::float4; diff --git a/source/blender/draw/engines/eevee/eevee_shadow.cc b/source/blender/draw/engines/eevee/eevee_shadow.cc index 70eb49ec487..06306ff770a 100644 --- a/source/blender/draw/engines/eevee/eevee_shadow.cc +++ b/source/blender/draw/engines/eevee/eevee_shadow.cc @@ -77,7 +77,7 @@ void ShadowTileMap::sync_clipmap(const float3 &camera_position, float4x4 viewinv = object_mat; copy_v3_v3(viewinv.values[3], tilemap_center); - float camera_distance_to_plane = float3::dot(float3(object_mat.values[2]), camera_position); + float camera_distance_to_plane = math::dot(float3(object_mat.values[2]), camera_position); float visible_near = camera_distance_to_plane - half_size; float visible_far = camera_distance_to_plane + half_size; @@ -444,7 +444,7 @@ void ShadowDirectional::end_sync(int min_level, far_ = -1.0e30f; BoundBox bbox = casters_bounds; for (auto i : IndexRange(8)) { - float dist = -float3::dot(z_axis, float3(bbox.vec[i])); + float dist = -math::dot(z_axis, float3(bbox.vec[i])); near_ = min_ff(near_, dist); far_ = max_ff(far_, dist); } @@ -471,8 +471,8 @@ void ShadowDirectional::end_sync(int min_level, /* Compute full offset from origin to the smallest clipmap tile size. */ float tile_size = first_clipmap.tile_size_get(); base_offset_ = int2( - roundf(float3::dot(float3(object_mat_.values[0]), camera_position) / tile_size), - roundf(float3::dot(float3(object_mat_.values[1]), camera_position) / tile_size)); + roundf(math::dot(float3(object_mat_.values[0]), camera_position) / tile_size), + roundf(math::dot(float3(object_mat_.values[1]), camera_position) / tile_size)); int level = min_level; int divisor = 1; @@ -653,7 +653,7 @@ void ShadowModule::end_sync(void) /* Get the farthest point from camera to know what distance to cover. */ float3 farthest_point = float3(1.0f, 1.0f, 1.0f); mul_project_m4_v3(inst_.camera.data_get().wininv, farthest_point); - float far_dist = farthest_point.length(); + float far_dist = math::length(farthest_point); float near_dist = fabsf(inst_.camera.data_get().clip_near); float3 cam_position = inst_.camera.position(); @@ -1041,7 +1041,7 @@ void ShadowModule::set_view(const DRWView *view, GPUTexture *depth_tx) p0 = p0 / p0.z; p1 = p1 / p1.z; } - screen_pixel_radius_inv_ = min_dim / float3::distance(p0, p1); + screen_pixel_radius_inv_ = min_dim / math::distance(p0, p1); } #ifdef SHADOW_DEBUG_FREEZE_CAMERA diff --git a/source/blender/draw/engines/eevee/eevee_shadow.hh b/source/blender/draw/engines/eevee/eevee_shadow.hh index 65456f11326..a7db2f6dc0e 100644 --- a/source/blender/draw/engines/eevee/eevee_shadow.hh +++ b/source/blender/draw/engines/eevee/eevee_shadow.hh @@ -107,7 +107,7 @@ struct AABB { float radius(void) const { - return (max - min).length() / 2.0f; + return math::length(max - min) / 2.0f; } operator BoundBox() const |