Merge branch 'blender-v2.91-release'
This commit is contained in:
commit
4d5e0a8520
|
@ -52,11 +52,11 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
|
|||
/* Test if we can instance or if the object is modified. */
|
||||
BL::ID b_ob_data = b_ob.data();
|
||||
BL::ID b_key_id = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data;
|
||||
GeometryKey key(b_key_id.ptr.data, use_particle_hair);
|
||||
BL::Material material_override = view_layer.material_override;
|
||||
Shader *default_shader = (b_ob.type() == BL::Object::type_VOLUME) ? scene->default_volume :
|
||||
scene->default_surface;
|
||||
Geometry::Type geom_type = determine_geom_type(b_ob, use_particle_hair);
|
||||
GeometryKey key(b_key_id.ptr.data, geom_type);
|
||||
|
||||
/* Find shader indices. */
|
||||
vector<Shader *> used_shaders;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "render/geometry.h"
|
||||
#include "render/scene.h"
|
||||
|
||||
#include "util/util_map.h"
|
||||
|
@ -230,9 +231,9 @@ struct ObjectKey {
|
|||
|
||||
struct GeometryKey {
|
||||
void *id;
|
||||
bool use_particle_hair;
|
||||
Geometry::Type geometry_type;
|
||||
|
||||
GeometryKey(void *id, bool use_particle_hair) : id(id), use_particle_hair(use_particle_hair)
|
||||
GeometryKey(void *id, Geometry::Type geometry_type) : id(id), geometry_type(geometry_type)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -242,7 +243,7 @@ struct GeometryKey {
|
|||
return true;
|
||||
}
|
||||
else if (id == k.id) {
|
||||
if (use_particle_hair < k.use_particle_hair) {
|
||||
if (geometry_type < k.geometry_type) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,9 +313,12 @@ void Camera::update(Scene *scene)
|
|||
if (type == CAMERA_PERSPECTIVE) {
|
||||
float3 v = transform_perspective(&full_rastertocamera,
|
||||
make_float3(full_width, full_height, 1.0f));
|
||||
|
||||
frustum_right_normal = normalize(make_float3(v.z, 0.0f, -v.x));
|
||||
frustum_top_normal = normalize(make_float3(0.0f, v.z, -v.y));
|
||||
|
||||
v = transform_perspective(&full_rastertocamera, make_float3(0.0f, 0.0f, 1.0f));
|
||||
frustum_left_normal = normalize(make_float3(-v.z, 0.0f, v.x));
|
||||
frustum_bottom_normal = normalize(make_float3(0.0f, -v.z, v.y));
|
||||
}
|
||||
|
||||
/* Compute kernel camera data. */
|
||||
|
@ -644,17 +647,22 @@ float Camera::world_to_raster_size(float3 P)
|
|||
|
||||
if (offscreen_dicing_scale > 1.0f) {
|
||||
float3 p = transform_point(&worldtocamera, P);
|
||||
float3 v = transform_perspective(&full_rastertocamera,
|
||||
make_float3(full_width, full_height, 0.0f));
|
||||
float3 v1 = transform_perspective(&full_rastertocamera,
|
||||
make_float3(full_width, full_height, 0.0f));
|
||||
float3 v2 = transform_perspective(&full_rastertocamera, make_float3(0.0f, 0.0f, 0.0f));
|
||||
|
||||
/* Create point clamped to frustum */
|
||||
float3 c;
|
||||
c.x = max(-v.x, min(v.x, p.x));
|
||||
c.y = max(-v.y, min(v.y, p.y));
|
||||
c.x = max(v2.x, min(v1.x, p.x));
|
||||
c.y = max(v2.y, min(v1.y, p.y));
|
||||
c.z = max(0.0f, p.z);
|
||||
|
||||
float f_dist = len(p - c) / sqrtf((v.x * v.x + v.y * v.y) * 0.5f);
|
||||
|
||||
/* Check right side */
|
||||
float f_dist = len(p - c) / sqrtf((v1.x * v1.x + v1.y * v1.y) * 0.5f);
|
||||
if (f_dist < 0.0f) {
|
||||
/* Check left side */
|
||||
f_dist = len(p - c) / sqrtf((v2.x * v2.x + v2.y * v2.y) * 0.5f);
|
||||
}
|
||||
if (f_dist > 0.0f) {
|
||||
res += res * f_dist * (offscreen_dicing_scale - 1.0f);
|
||||
}
|
||||
|
@ -685,10 +693,8 @@ float Camera::world_to_raster_size(float3 P)
|
|||
/* Distance from the four planes */
|
||||
float r = dot(p, frustum_right_normal);
|
||||
float t = dot(p, frustum_top_normal);
|
||||
p = make_float3(-p.x, -p.y, p.z);
|
||||
float l = dot(p, frustum_right_normal);
|
||||
float b = dot(p, frustum_top_normal);
|
||||
p = make_float3(-p.x, -p.y, p.z);
|
||||
float l = dot(p, frustum_left_normal);
|
||||
float b = dot(p, frustum_bottom_normal);
|
||||
|
||||
if (r <= 0.0f && l <= 0.0f && t <= 0.0f && b <= 0.0f) {
|
||||
/* Point is inside frustum */
|
||||
|
@ -701,9 +707,9 @@ float Camera::world_to_raster_size(float3 P)
|
|||
else {
|
||||
/* Point may be behind or off to the side, need to check */
|
||||
float3 along_right = make_float3(-frustum_right_normal.z, 0.0f, frustum_right_normal.x);
|
||||
float3 along_left = make_float3(frustum_right_normal.z, 0.0f, frustum_right_normal.x);
|
||||
float3 along_left = make_float3(frustum_left_normal.z, 0.0f, -frustum_left_normal.x);
|
||||
float3 along_top = make_float3(0.0f, -frustum_top_normal.z, frustum_top_normal.y);
|
||||
float3 along_bottom = make_float3(0.0f, frustum_top_normal.z, frustum_top_normal.y);
|
||||
float3 along_bottom = make_float3(0.0f, frustum_bottom_normal.z, -frustum_bottom_normal.y);
|
||||
|
||||
float dist[] = {r, l, t, b};
|
||||
float3 along[] = {along_right, along_left, along_top, along_bottom};
|
||||
|
|
|
@ -170,6 +170,8 @@ class Camera : public Node {
|
|||
|
||||
float3 frustum_right_normal;
|
||||
float3 frustum_top_normal;
|
||||
float3 frustum_left_normal;
|
||||
float3 frustum_bottom_normal;
|
||||
|
||||
/* update */
|
||||
bool need_update;
|
||||
|
|
|
@ -83,7 +83,7 @@ static void test_lattice_deform_free(LatticeDeformTestContext *ctx)
|
|||
TEST(lattice_deform_performance, performance_no_dvert_1)
|
||||
{
|
||||
const int32_t num_items = 1;
|
||||
LatticeDeformTestContext ctx = {0};
|
||||
LatticeDeformTestContext ctx = {{{0}}};
|
||||
RandomNumberGenerator rng;
|
||||
test_lattice_deform_init(&ctx, &rng, num_items);
|
||||
test_lattice_deform(&ctx, num_items);
|
||||
|
@ -92,7 +92,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1)
|
|||
TEST(lattice_deform_performance, performance_no_dvert_1000)
|
||||
{
|
||||
const int32_t num_items = 1000;
|
||||
LatticeDeformTestContext ctx = {0};
|
||||
LatticeDeformTestContext ctx = {{{0}}};
|
||||
RandomNumberGenerator rng;
|
||||
test_lattice_deform_init(&ctx, &rng, num_items);
|
||||
test_lattice_deform(&ctx, num_items);
|
||||
|
@ -101,7 +101,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1000)
|
|||
TEST(lattice_deform_performance, performance_no_dvert_10000)
|
||||
{
|
||||
const int32_t num_items = 10000;
|
||||
LatticeDeformTestContext ctx = {0};
|
||||
LatticeDeformTestContext ctx = {{{0}}};
|
||||
RandomNumberGenerator rng;
|
||||
test_lattice_deform_init(&ctx, &rng, num_items);
|
||||
test_lattice_deform(&ctx, num_items);
|
||||
|
@ -110,7 +110,7 @@ TEST(lattice_deform_performance, performance_no_dvert_10000)
|
|||
TEST(lattice_deform_performance, performance_no_dvert_100000)
|
||||
{
|
||||
const int32_t num_items = 100000;
|
||||
LatticeDeformTestContext ctx = {0};
|
||||
LatticeDeformTestContext ctx = {{{0}}};
|
||||
RandomNumberGenerator rng;
|
||||
test_lattice_deform_init(&ctx, &rng, num_items);
|
||||
test_lattice_deform(&ctx, num_items);
|
||||
|
@ -119,7 +119,7 @@ TEST(lattice_deform_performance, performance_no_dvert_100000)
|
|||
TEST(lattice_deform_performance, performance_no_dvert_1000000)
|
||||
{
|
||||
const int32_t num_items = 1000000;
|
||||
LatticeDeformTestContext ctx = {0};
|
||||
LatticeDeformTestContext ctx = {{{0}}};
|
||||
RandomNumberGenerator rng;
|
||||
test_lattice_deform_init(&ctx, &rng, num_items);
|
||||
test_lattice_deform(&ctx, num_items);
|
||||
|
@ -128,11 +128,11 @@ TEST(lattice_deform_performance, performance_no_dvert_1000000)
|
|||
TEST(lattice_deform_performance, performance_no_dvert_10000000)
|
||||
{
|
||||
const int32_t num_items = 10000000;
|
||||
LatticeDeformTestContext ctx = {0};
|
||||
LatticeDeformTestContext ctx = {{{0}}};
|
||||
RandomNumberGenerator rng;
|
||||
test_lattice_deform_init(&ctx, &rng, num_items);
|
||||
test_lattice_deform(&ctx, num_items);
|
||||
test_lattice_deform_free(&ctx);
|
||||
}
|
||||
|
||||
} // namespace blender::bke::tests
|
||||
} // namespace blender::bke::tests
|
||||
|
|
|
@ -211,9 +211,9 @@ void Shader::print_log(Span<const char *> sources, char *log, const char *stage,
|
|||
BLI_dynstr_appendf(dynstr, "%s%s%s: ", warn_col, "Warning", info_col);
|
||||
}
|
||||
/* Print the error itself. */
|
||||
BLI_dynstr_appendf(dynstr, info_col);
|
||||
BLI_dynstr_append(dynstr, info_col);
|
||||
BLI_dynstr_nappend(dynstr, log_line, (line_end + 1) - log_line);
|
||||
BLI_dynstr_appendf(dynstr, reset_col);
|
||||
BLI_dynstr_append(dynstr, reset_col);
|
||||
/* Continue to next line. */
|
||||
log_line = line_end + 1;
|
||||
last_error_line = error_line;
|
||||
|
|
|
@ -122,7 +122,7 @@ static void APIENTRY debug_callback(GLenum UNUSED(source),
|
|||
}
|
||||
|
||||
if (((LOG.type->flag & CLG_FLAG_USE) && (LOG.type->level >= clog_severity))) {
|
||||
CLG_logf(LOG.type, clog_severity, debug_groups, "", message);
|
||||
CLG_logf(LOG.type, clog_severity, debug_groups, "", "%s", message);
|
||||
if (severity == GL_DEBUG_SEVERITY_HIGH) {
|
||||
/* Focus on error message. */
|
||||
if (use_color) {
|
||||
|
|
Loading…
Reference in New Issue