mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Cleanup: Formatting
Run `make format` after the library update in the previous commit.
This commit is contained in:
parent
66224d69b0
commit
a68d39e9d9
383 changed files with 1343 additions and 1365 deletions
|
|
@ -67,9 +67,9 @@ ATOMIC_INLINE size_t atomic_add_and_fetch_z(size_t *p, size_t x)
|
|||
ATOMIC_INLINE size_t atomic_sub_and_fetch_z(size_t *p, size_t x)
|
||||
{
|
||||
#if (LG_SIZEOF_PTR == 8)
|
||||
return (size_t)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t) - ((int64_t)x));
|
||||
return (size_t)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t)-((int64_t)x));
|
||||
#elif (LG_SIZEOF_PTR == 4)
|
||||
return (size_t)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t) - ((int32_t)x));
|
||||
return (size_t)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t)-((int32_t)x));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -85,9 +85,9 @@ ATOMIC_INLINE size_t atomic_fetch_and_add_z(size_t *p, size_t x)
|
|||
ATOMIC_INLINE size_t atomic_fetch_and_sub_z(size_t *p, size_t x)
|
||||
{
|
||||
#if (LG_SIZEOF_PTR == 8)
|
||||
return (size_t)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t) - ((int64_t)x));
|
||||
return (size_t)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)-((int64_t)x));
|
||||
#elif (LG_SIZEOF_PTR == 4)
|
||||
return (size_t)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t) - ((int32_t)x));
|
||||
return (size_t)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)-((int32_t)x));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -146,9 +146,9 @@ ATOMIC_INLINE unsigned int atomic_add_and_fetch_u(unsigned int *p, unsigned int
|
|||
ATOMIC_INLINE unsigned int atomic_sub_and_fetch_u(unsigned int *p, unsigned int x)
|
||||
{
|
||||
#if (LG_SIZEOF_INT == 8)
|
||||
return (unsigned int)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t) - ((int64_t)x));
|
||||
return (unsigned int)atomic_add_and_fetch_uint64((uint64_t *)p, (uint64_t)-((int64_t)x));
|
||||
#elif (LG_SIZEOF_INT == 4)
|
||||
return (unsigned int)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t) - ((int32_t)x));
|
||||
return (unsigned int)atomic_add_and_fetch_uint32((uint32_t *)p, (uint32_t)-((int32_t)x));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -164,9 +164,9 @@ ATOMIC_INLINE unsigned int atomic_fetch_and_add_u(unsigned int *p, unsigned int
|
|||
ATOMIC_INLINE unsigned int atomic_fetch_and_sub_u(unsigned int *p, unsigned int x)
|
||||
{
|
||||
#if (LG_SIZEOF_INT == 8)
|
||||
return (unsigned int)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t) - ((int64_t)x));
|
||||
return (unsigned int)atomic_fetch_and_add_uint64((uint64_t *)p, (uint64_t)-((int64_t)x));
|
||||
#elif (LG_SIZEOF_INT == 4)
|
||||
return (unsigned int)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t) - ((int32_t)x));
|
||||
return (unsigned int)atomic_fetch_and_add_uint32((uint32_t *)p, (uint32_t)-((int32_t)x));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -620,7 +620,7 @@ static void create_mesh(Scene *scene,
|
|||
const bool need_default_tangent = (subdivision == false) && (blender_uv_names.empty()) &&
|
||||
(mesh->need_attribute(scene, ATTR_STD_UV_TANGENT));
|
||||
if (mesh->need_attribute(scene, ATTR_STD_GENERATED) || need_default_tangent) {
|
||||
const float(*orco)[3] = static_cast<const float(*)[3]>(
|
||||
const float (*orco)[3] = static_cast<const float (*)[3]>(
|
||||
CustomData_get_layer(&b_mesh.vert_data, CD_ORCO));
|
||||
Attribute *attr = attributes.add(ATTR_STD_GENERATED);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class PathTraceWork {
|
|||
bool has_multiple_works() const;
|
||||
|
||||
/* Allocate working memory for execution. Must be called before init_execution(). */
|
||||
virtual void alloc_work_memory(){};
|
||||
virtual void alloc_work_memory() {};
|
||||
|
||||
/* Initialize execution of kernels.
|
||||
* Will ensure that all device queues are initialized for execution.
|
||||
|
|
|
|||
|
|
@ -1141,7 +1141,7 @@ ccl_device_inline void volume_distance_sampling_finalize(
|
|||
reservoir.add_sample(
|
||||
1.0f - guided_scatter_prob,
|
||||
# ifdef __DENOISING_FEATURES__
|
||||
{vstate.emission, reservoir.candidate.t, result.indirect_throughput, 0.0f, vstate.albedo}
|
||||
{ vstate.emission, reservoir.candidate.t, result.indirect_throughput, 0.0f, vstate.albedo }
|
||||
# else
|
||||
{vstate.emission, reservoir.candidate.t, result.indirect_throughput, 0.0f}
|
||||
# endif
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@
|
|||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#define OSL_CLOSURE_STRUCT_BEGIN(Upper, lower) \
|
||||
struct ccl_align(8) Upper##Closure \
|
||||
{ \
|
||||
struct ccl_align(8) Upper##Closure { \
|
||||
const char *label;
|
||||
#define OSL_CLOSURE_STRUCT_END(Upper, lower) \
|
||||
} \
|
||||
|
|
@ -31,8 +30,7 @@ CCL_NAMESPACE_BEGIN
|
|||
|
||||
#include "closures_template.h"
|
||||
|
||||
struct ccl_align(8) LayerClosure
|
||||
{
|
||||
struct ccl_align(8) LayerClosure {
|
||||
const ccl_private OSLClosure *base;
|
||||
const ccl_private OSLClosure *top;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -66,20 +66,17 @@ struct OSLClosure {
|
|||
OSLClosureType id;
|
||||
};
|
||||
|
||||
struct ccl_align(8) OSLClosureMul : public OSLClosure
|
||||
{
|
||||
struct ccl_align(8) OSLClosureMul : public OSLClosure {
|
||||
packed_float3 weight;
|
||||
const ccl_private OSLClosure *closure;
|
||||
};
|
||||
|
||||
struct ccl_align(8) OSLClosureAdd : public OSLClosure
|
||||
{
|
||||
struct ccl_align(8) OSLClosureAdd : public OSLClosure {
|
||||
const ccl_private OSLClosure *closureA;
|
||||
const ccl_private OSLClosure *closureB;
|
||||
};
|
||||
|
||||
struct ccl_align(8) OSLClosureComponent : public OSLClosure
|
||||
{
|
||||
struct ccl_align(8) OSLClosureComponent : public OSLClosure {
|
||||
packed_float3 weight;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1000,8 +1000,7 @@ struct AttributeMap {
|
|||
ClosureType type; \
|
||||
float sample_weight
|
||||
|
||||
struct ccl_align(16) ShaderClosure
|
||||
{
|
||||
struct ccl_align(16) ShaderClosure {
|
||||
SHADER_CLOSURE_BASE;
|
||||
|
||||
/* Extra space for closures to store data, somewhat arbitrary but closures
|
||||
|
|
@ -1132,8 +1131,7 @@ enum ShaderDataObjectFlag {
|
|||
SD_OBJECT_HAS_VOLUME_MOTION)
|
||||
};
|
||||
|
||||
struct ccl_align(16) ShaderData
|
||||
{
|
||||
struct ccl_align(16) ShaderData {
|
||||
/* position */
|
||||
float3 P;
|
||||
/* smooth normal for shading */
|
||||
|
|
@ -1215,15 +1213,13 @@ struct ccl_align(16) ShaderData
|
|||
#ifdef __KERNEL_GPU__
|
||||
/* ShaderDataTinyStorage needs the same alignment as ShaderData, or else
|
||||
* the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
|
||||
struct ccl_align(16) ShaderDataTinyStorage
|
||||
{
|
||||
struct ccl_align(16) ShaderDataTinyStorage {
|
||||
char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * MAX_CLOSURE];
|
||||
};
|
||||
|
||||
/* ShaderDataCausticsStorage needs the same alignment as ShaderData, or else
|
||||
* the pointer cast in AS_SHADER_DATA invokes undefined behavior. */
|
||||
struct ccl_align(16) ShaderDataCausticsStorage
|
||||
{
|
||||
struct ccl_align(16) ShaderDataCausticsStorage {
|
||||
char pad[sizeof(ShaderData) - sizeof(ShaderClosure) * (MAX_CLOSURE - CAUSTICS_MAX_CLOSURE)];
|
||||
};
|
||||
#else
|
||||
|
|
@ -1432,9 +1428,7 @@ enum KernelBVHLayout {
|
|||
};
|
||||
|
||||
/* Specialized struct that can become constants in dynamic compilation. */
|
||||
#define KERNEL_STRUCT_BEGIN(name, parent) \
|
||||
struct ccl_align(16) name \
|
||||
{
|
||||
#define KERNEL_STRUCT_BEGIN(name, parent) struct ccl_align(16) name {
|
||||
#define KERNEL_STRUCT_END(name) \
|
||||
} \
|
||||
; \
|
||||
|
|
@ -1476,8 +1470,7 @@ struct KernelLightLinkSet {
|
|||
uint light_tree_root;
|
||||
};
|
||||
|
||||
struct ccl_align(16) KernelData
|
||||
{
|
||||
struct ccl_align(16) KernelData {
|
||||
/* Features and limits. */
|
||||
uint kernel_features;
|
||||
uint max_closures;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class ImageLoader {
|
|||
virtual int get_tile_number() const;
|
||||
|
||||
/* Free any memory used for loading metadata and pixels. */
|
||||
virtual void cleanup(){};
|
||||
virtual void cleanup() {};
|
||||
|
||||
/* Compare avoid loading the same image multiple times. */
|
||||
virtual bool equals(const ImageLoader &other) const = 0;
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ class ShaderNode : public Node {
|
|||
/* Simplify settings used by artists to the ones which are simpler to
|
||||
* evaluate in the kernel but keep the final result unchanged.
|
||||
*/
|
||||
virtual void simplify_settings(Scene * /*scene*/){};
|
||||
virtual void simplify_settings(Scene * /*scene*/) {};
|
||||
|
||||
virtual bool has_surface_emission()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class DisplayDriver {
|
|||
virtual void update_end() = 0;
|
||||
|
||||
/* Optionally flush outstanding display commands before ending the render loop. */
|
||||
virtual void flush(){};
|
||||
virtual void flush() {};
|
||||
|
||||
virtual half4 *map_texture_buffer() = 0;
|
||||
virtual void unmap_texture_buffer() = 0;
|
||||
|
|
@ -171,8 +171,8 @@ class DisplayDriver {
|
|||
*
|
||||
* For example, destruction of the CUDA object associated with an OpenGL requires the
|
||||
* OpenGL context to be active. */
|
||||
virtual void graphics_interop_activate(){};
|
||||
virtual void graphics_interop_deactivate(){};
|
||||
virtual void graphics_interop_activate() {};
|
||||
virtual void graphics_interop_deactivate() {};
|
||||
|
||||
/* Clear the display buffer by filling it with zeros. */
|
||||
virtual void zero() = 0;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@
|
|||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Stack allocator for the use with STL. */
|
||||
template<int SIZE, typename T> class ccl_try_align(16) StackAllocator
|
||||
{
|
||||
template<int SIZE, typename T> class ccl_try_align(16) StackAllocator {
|
||||
public:
|
||||
using size_type = size_t;
|
||||
using difference_type = ptrdiff_t;
|
||||
|
|
@ -61,7 +60,7 @@ template<int SIZE, typename T> class ccl_try_align(16) StackAllocator
|
|||
return mem;
|
||||
}
|
||||
|
||||
void deallocate(T * p, const size_t n)
|
||||
void deallocate(T *p, const size_t n)
|
||||
{
|
||||
if (p == nullptr) {
|
||||
return;
|
||||
|
|
@ -80,7 +79,7 @@ template<int SIZE, typename T> class ccl_try_align(16) StackAllocator
|
|||
|
||||
/* Address of an reference. */
|
||||
|
||||
T *address(T & x) const
|
||||
T *address(T &x) const
|
||||
{
|
||||
return &x;
|
||||
}
|
||||
|
|
@ -92,14 +91,14 @@ template<int SIZE, typename T> class ccl_try_align(16) StackAllocator
|
|||
|
||||
/* Object construction/destruction. */
|
||||
|
||||
void construct(T * p, const T &val)
|
||||
void construct(T *p, const T &val)
|
||||
{
|
||||
if (p != nullptr) {
|
||||
new (p) T(val);
|
||||
}
|
||||
}
|
||||
|
||||
void destroy(T * p)
|
||||
void destroy(T *p)
|
||||
{
|
||||
p->~T();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ CCL_NAMESPACE_BEGIN
|
|||
#ifndef __KERNEL_NATIVE_VECTOR_TYPES__
|
||||
struct int4;
|
||||
|
||||
struct ccl_try_align(16) float4
|
||||
{
|
||||
struct ccl_try_align(16) float4 {
|
||||
# ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128 m128;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ struct packed_int3 {
|
|||
ccl_device_inline_method packed_int3() = default;
|
||||
|
||||
ccl_device_inline_method packed_int3(const int px, const int py, const int pz)
|
||||
: x(px), y(py), z(pz){};
|
||||
: x(px), y(py), z(pz) {};
|
||||
|
||||
ccl_device_inline_method packed_int3(const int3 &a) : x(a.x), y(a.y), z(a.z) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ CCL_NAMESPACE_BEGIN
|
|||
|
||||
#ifndef __KERNEL_NATIVE_VECTOR_TYPES__
|
||||
|
||||
struct ccl_try_align(16) int4
|
||||
{
|
||||
struct ccl_try_align(16) int4 {
|
||||
# ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128i m128;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ struct packed_uint3 {
|
|||
ccl_device_inline_method packed_uint3() = default;
|
||||
|
||||
ccl_device_inline_method packed_uint3(const uint px, const uint py, const uint pz)
|
||||
: x(px), y(py), z(pz){};
|
||||
: x(px), y(py), z(pz) {};
|
||||
|
||||
ccl_device_inline_method packed_uint3(const uint3 &a) : x(a.x), y(a.y), z(a.z) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ typedef enum {
|
|||
} GHOST_TKey;
|
||||
|
||||
#define GHOST_KEY_MODIFIER_NUM ((_GHOST_KEY_MODIFIER_MAX - _GHOST_KEY_MODIFIER_MIN) + 1)
|
||||
#define GHOST_KEY_MODIFIER_TO_INDEX(key) ((unsigned int)(key)-_GHOST_KEY_MODIFIER_MIN)
|
||||
#define GHOST_KEY_MODIFIER_TO_INDEX(key) ((unsigned int)(key) - _GHOST_KEY_MODIFIER_MIN)
|
||||
#define GHOST_KEY_MODIFIER_FROM_INDEX(key) \
|
||||
(GHOST_TKey)(((unsigned int)(key) + _GHOST_KEY_MODIFIER_MIN))
|
||||
#define GHOST_KEY_MODIFIER_CHECK(key) (GHOST_KEY_MODIFIER_TO_INDEX(key) < GHOST_KEY_MODIFIER_NUM)
|
||||
|
|
@ -825,22 +825,24 @@ typedef struct {
|
|||
|
||||
#define GHOST_CONTEXT_PARAMS_NONE \
|
||||
{ \
|
||||
/*is_stereo_visual*/ false, /*is_debug*/ false, /*vsync*/ GHOST_kVSyncModeUnset, \
|
||||
/*is_stereo_visual*/ false, \
|
||||
/*is_debug*/ false, \
|
||||
/*vsync*/ GHOST_kVSyncModeUnset, \
|
||||
}
|
||||
|
||||
#define GHOST_CONTEXT_PARAMS_FROM_GPU_SETTINGS_OFFSCREEN(gpu_settings) \
|
||||
{ \
|
||||
/*is_stereo_visual*/ false, \
|
||||
/*is_debug*/ (((gpu_settings).flags & GHOST_gpuDebugContext) != 0), \
|
||||
/*vsync*/ GHOST_kVSyncModeUnset, \
|
||||
/*is_stereo_visual*/ false, \
|
||||
/*is_debug*/ (((gpu_settings).flags & GHOST_gpuDebugContext) != 0), \
|
||||
/*vsync*/ GHOST_kVSyncModeUnset, \
|
||||
}
|
||||
|
||||
#define GHOST_CONTEXT_PARAMS_FROM_GPU_SETTINGS(gpu_settings) \
|
||||
{ \
|
||||
/*is_stereo_visual*/ (((gpu_settings).flags & GHOST_gpuStereoVisual) != 0), \
|
||||
/*is_debug*/ (((gpu_settings).flags & GHOST_gpuDebugContext) != 0), /*vsync*/ \
|
||||
(((gpu_settings).flags & GHOST_gpuVSyncIsOverridden) ? (gpu_settings).vsync : \
|
||||
GHOST_kVSyncModeUnset), \
|
||||
/*is_stereo_visual*/ (((gpu_settings).flags & GHOST_gpuStereoVisual) != 0), \
|
||||
/*is_debug*/ (((gpu_settings).flags & GHOST_gpuDebugContext) != 0), /*vsync*/ \
|
||||
(((gpu_settings).flags & GHOST_gpuVSyncIsOverridden) ? (gpu_settings).vsync : \
|
||||
GHOST_kVSyncModeUnset), \
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -869,7 +871,9 @@ typedef struct {
|
|||
|
||||
#define GHOST_WINDOW_HDR_INFO_NONE \
|
||||
{ \
|
||||
/*hdr_enabled*/ false, /*wide_gamut_enabled*/ false, /*sdr_white_level*/ 1.0f, \
|
||||
/*hdr_enabled*/ false, \
|
||||
/*wide_gamut_enabled*/ false, \
|
||||
/*sdr_white_level*/ 1.0f, \
|
||||
}
|
||||
|
||||
#ifdef WITH_VULKAN_BACKEND
|
||||
|
|
|
|||
|
|
@ -177,5 +177,5 @@ class GHOST_ContextMTL : public GHOST_Context {
|
|||
void metalInitFramebuffer();
|
||||
void metalUpdateFramebuffer();
|
||||
void metalSwapBuffers();
|
||||
void initClear(){};
|
||||
void initClear() {};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,10 +41,7 @@ static const char *ndof_progress_string[] = {
|
|||
};
|
||||
|
||||
/* Printable values for #NDOF_ButtonT enum (keep aligned) */
|
||||
#define MAP_ENTRY(button) \
|
||||
{ \
|
||||
GHOST_##button, #button \
|
||||
}
|
||||
#define MAP_ENTRY(button) {GHOST_##button, #button}
|
||||
static const std::map<GHOST_NDOF_ButtonT, const char *> ndof_button_names = {
|
||||
/* Disable wrapping, it makes it difficult to read. */
|
||||
/* clang-format off */
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ struct GWL_Output {
|
|||
class GHOST_SystemWayland : public GHOST_System {
|
||||
public:
|
||||
GHOST_SystemWayland(bool background);
|
||||
GHOST_SystemWayland() : GHOST_SystemWayland(true){};
|
||||
GHOST_SystemWayland() : GHOST_SystemWayland(true) {};
|
||||
|
||||
~GHOST_SystemWayland() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ void GHOST_XrAction::updateState(XrSession session,
|
|||
(std::string("Failed to get state for vector2f action \"") + action_name + "\".")
|
||||
.data());
|
||||
if (state.isActive) {
|
||||
memcpy(((float(*)[2])states_)[subaction_idx], &state.currentState, sizeof(float[2]));
|
||||
memcpy(((float (*)[2])states_)[subaction_idx], &state.currentState, sizeof(float[2]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,13 +219,13 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding {
|
|||
GL_RGB10_A2,
|
||||
GL_RGBA16,
|
||||
# endif
|
||||
GL_RGBA16F,
|
||||
GL_RGBA16F,
|
||||
# if 1
|
||||
GL_RGB10_A2,
|
||||
GL_RGBA16,
|
||||
GL_RGB10_A2,
|
||||
GL_RGBA16,
|
||||
# endif
|
||||
GL_RGBA8,
|
||||
GL_SRGB8_ALPHA8,
|
||||
GL_RGBA8,
|
||||
GL_SRGB8_ALPHA8,
|
||||
};
|
||||
|
||||
std::optional result = choose_swapchain_format_from_candidates(gpu_binding_formats,
|
||||
|
|
|
|||
|
|
@ -139,13 +139,13 @@ std::optional<int64_t> GHOST_XrGraphicsBindingD3D::chooseSwapchainFormat(
|
|||
DXGI_FORMAT_R10G10B10A2_UNORM,
|
||||
DXGI_FORMAT_R16G16B16A16_UNORM,
|
||||
#endif
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT,
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT,
|
||||
#if 1
|
||||
DXGI_FORMAT_R10G10B10A2_UNORM,
|
||||
DXGI_FORMAT_R16G16B16A16_UNORM,
|
||||
DXGI_FORMAT_R10G10B10A2_UNORM,
|
||||
DXGI_FORMAT_R16G16B16A16_UNORM,
|
||||
#endif
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
|
||||
};
|
||||
|
||||
std::optional result = choose_swapchain_format_from_candidates(gpu_binding_formats,
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ extern size_t (*MEM_get_peak_memory)(void) ATTR_WARN_UNUSED_RESULT;
|
|||
|
||||
/** Overhead for lockfree allocator (use to avoid slop-space). */
|
||||
#define MEM_SIZE_OVERHEAD sizeof(size_t)
|
||||
#define MEM_SIZE_OPTIMAL(size) ((size)-MEM_SIZE_OVERHEAD)
|
||||
#define MEM_SIZE_OPTIMAL(size) ((size) - MEM_SIZE_OVERHEAD)
|
||||
|
||||
#ifndef NDEBUG
|
||||
extern const char *(*MEM_name_ptr)(void *vmemh);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ size_t malloc_usable_size(void *ptr);
|
|||
# define MEM_INLINE static inline
|
||||
#endif
|
||||
|
||||
#define IS_POW2(a) (((a) & ((a)-1)) == 0)
|
||||
#define IS_POW2(a) (((a) & ((a) - 1)) == 0)
|
||||
|
||||
/* Extra padding which needs to be applied on MemHead to make it aligned. */
|
||||
#define MEMHEAD_ALIGN_PADDING(alignment) \
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ class AttributeOwner {
|
|||
void *ptr_ = nullptr;
|
||||
|
||||
public:
|
||||
AttributeOwner(){};
|
||||
AttributeOwner(AttributeOwnerType type, void *ptr) : type_(type), ptr_(ptr){};
|
||||
AttributeOwner() {};
|
||||
AttributeOwner(AttributeOwnerType type, void *ptr) : type_(type), ptr_(ptr) {};
|
||||
|
||||
static AttributeOwner from_id(ID *id);
|
||||
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ bool CTX_data_dir(const char *member);
|
|||
{ \
|
||||
blender::Vector<PointerRNA> ctx_data_list; \
|
||||
CTX_data_##member(C, &ctx_data_list); \
|
||||
for (PointerRNA & ctx_link : ctx_data_list) { \
|
||||
for (PointerRNA &ctx_link : ctx_data_list) { \
|
||||
Type instance = (Type)ctx_link.data;
|
||||
|
||||
#define CTX_DATA_END \
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ using IDTypeForeachColorFunction = void (*)(ID *id, const IDTypeForeachColorFunc
|
|||
* fully valid, and can be asserted on. But in some cases, they are not (fully) valid, e.g when
|
||||
* copying an ID and all of its embedded data.
|
||||
*/
|
||||
using IDTypeEmbeddedOwnerPointerGetFunction = ID **(*)(ID *id, bool debug_relationship_assert);
|
||||
using IDTypeEmbeddedOwnerPointerGetFunction = ID **(*)(ID * id, bool debug_relationship_assert);
|
||||
|
||||
using IDTypeBlendWriteFunction = void (*)(BlendWriter *writer, ID *id, const void *id_address);
|
||||
using IDTypeBlendReadDataFunction = void (*)(BlendDataReader *reader, ID *id);
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ using NodeGatherAddOperationsFunction =
|
|||
void (*)(blender::nodes::GatherAddNodeSearchParams ¶ms);
|
||||
|
||||
using NodeGetCompositorOperationFunction =
|
||||
blender::compositor::NodeOperation *(*)(blender::compositor::Context &context,
|
||||
blender::compositor::NodeOperation *(*)(blender::compositor::Context & context,
|
||||
blender::nodes::DNode node);
|
||||
using NodeExtraInfoFunction = void (*)(blender::nodes::NodeExtraInfoParams ¶ms);
|
||||
using NodeInverseElemEvalFunction =
|
||||
|
|
@ -211,7 +211,7 @@ struct bNodeSocketType {
|
|||
const SocketValueVariant *geometry_nodes_default_value = nullptr;
|
||||
};
|
||||
|
||||
using NodeInitExecFunction = void *(*)(bNodeExecContext *context,
|
||||
using NodeInitExecFunction = void *(*)(bNodeExecContext * context,
|
||||
bNode *node,
|
||||
bNodeInstanceKey key);
|
||||
using NodeFreeExecFunction = void (*)(void *nodedata);
|
||||
|
|
|
|||
|
|
@ -239,17 +239,17 @@ void BKE_shrinkwrap_snap_point_to_surface(const ShrinkwrapTreeData *tree,
|
|||
*/
|
||||
#define NULL_ShrinkwrapCalcData \
|
||||
{ \
|
||||
NULL, \
|
||||
NULL, \
|
||||
}
|
||||
#define NULL_BVHTreeFromMesh \
|
||||
{ \
|
||||
NULL, \
|
||||
NULL, \
|
||||
}
|
||||
#define NULL_BVHTreeRayHit \
|
||||
{ \
|
||||
NULL, \
|
||||
NULL, \
|
||||
}
|
||||
#define NULL_BVHTreeNearest \
|
||||
{ \
|
||||
0, \
|
||||
0, \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -986,13 +986,13 @@ bool BKE_appdir_program_python_search(char *program_filepath,
|
|||
/* Check both possible names. */
|
||||
const char *python_names[] = {
|
||||
#ifdef PYTHON_EXECUTABLE_NAME
|
||||
python_build_def,
|
||||
python_build_def,
|
||||
#endif
|
||||
#if defined(WIN32) && !defined(NDEBUG)
|
||||
basename_debug,
|
||||
basename_debug,
|
||||
#endif
|
||||
python_version,
|
||||
basename,
|
||||
python_version,
|
||||
basename,
|
||||
};
|
||||
bool is_found = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -1023,7 +1023,7 @@ static void equalize_cubic_bezier(const float control[4][3],
|
|||
const float *segment_scales,
|
||||
float *r_t_points)
|
||||
{
|
||||
float(*coords)[3] = static_cast<float(*)[3]>(BLI_array_alloca(coords, temp_segments + 1));
|
||||
float (*coords)[3] = static_cast<float (*)[3]>(BLI_array_alloca(coords, temp_segments + 1));
|
||||
float *pdist = static_cast<float *>(BLI_array_alloca(pdist, temp_segments + 1));
|
||||
|
||||
/* Compute the first pass of bezier point coordinates. */
|
||||
|
|
@ -1861,7 +1861,7 @@ static void find_bbone_segment_index_straight(const bPoseChannel *pchan,
|
|||
float *r_blend_next)
|
||||
{
|
||||
const Mat4 *mats = pchan->runtime.bbone_deform_mats;
|
||||
const float(*mat)[4] = mats[0].mat;
|
||||
const float (*mat)[4] = mats[0].mat;
|
||||
|
||||
/* Transform co to bone space and get its y component. */
|
||||
const float y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1];
|
||||
|
|
|
|||
|
|
@ -722,7 +722,7 @@ static void camera_frame_fit_data_init(const Scene *scene,
|
|||
BKE_camera_params_compute_matrix(params);
|
||||
|
||||
/* initialize callback data */
|
||||
copy_m3_m4(data->camera_rotmat, (float(*)[4])ob->object_to_world().ptr());
|
||||
copy_m3_m4(data->camera_rotmat, (float (*)[4])ob->object_to_world().ptr());
|
||||
normalize_m3(data->camera_rotmat);
|
||||
/* To transform a plane which is in its homogeneous representation (4d vector),
|
||||
* we need the inverse of the transpose of the transform matrix... */
|
||||
|
|
|
|||
|
|
@ -711,7 +711,7 @@ static bool cloth_from_object(
|
|||
using namespace blender;
|
||||
int i = 0;
|
||||
ClothVertex *verts = nullptr;
|
||||
const float(*shapekey_rest)[3] = nullptr;
|
||||
const float (*shapekey_rest)[3] = nullptr;
|
||||
const float tnull[3] = {0, 0, 0};
|
||||
|
||||
/* If we have a clothObject, free it. */
|
||||
|
|
@ -746,7 +746,7 @@ static bool cloth_from_object(
|
|||
if (clmd->sim_parms->shapekey_rest &&
|
||||
!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH))
|
||||
{
|
||||
shapekey_rest = static_cast<const float(*)[3]>(
|
||||
shapekey_rest = static_cast<const float (*)[3]>(
|
||||
CustomData_get_layer(&mesh->vert_data, CD_CLOTH_ORCO));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ static float colorband_hue_interp(
|
|||
int mode = 0;
|
||||
|
||||
#define HUE_INTERP(h_a, h_b) ((mfac * (h_a)) + (fac * (h_b)))
|
||||
#define HUE_MOD(h) (((h) < 1.0f) ? (h) : (h)-1.0f)
|
||||
#define HUE_MOD(h) (((h) < 1.0f) ? (h) : (h) - 1.0f)
|
||||
|
||||
h1 = HUE_MOD(h1);
|
||||
h2 = HUE_MOD(h2);
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ void BKE_curvemap_handle_set(CurveMap *cuma, int type)
|
|||
static void calchandle_curvemap(BezTriple *bezt, const BezTriple *prev, const BezTriple *next)
|
||||
{
|
||||
/* defines to avoid confusion */
|
||||
#define p2_h1 ((p2)-3)
|
||||
#define p2_h1 ((p2) - 3)
|
||||
#define p2_h2 ((p2) + 3)
|
||||
|
||||
const float *p1, *p3;
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ void BKE_crazyspace_build_sculpt(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
blender::Array<blender::float3, 0> origVerts = deformcos;
|
||||
float(*quats)[4];
|
||||
float (*quats)[4];
|
||||
int i, deformed = 0;
|
||||
VirtualModifierData virtual_modifier_data;
|
||||
Object object_eval;
|
||||
|
|
|
|||
|
|
@ -3068,7 +3068,7 @@ static void calchandleNurb_intern(BezTriple *bezt,
|
|||
char fcurve_smoothing)
|
||||
{
|
||||
/* defines to avoid confusion */
|
||||
#define p2_h1 ((p2)-3)
|
||||
#define p2_h1 ((p2) - 3)
|
||||
#define p2_h2 ((p2) + 3)
|
||||
|
||||
const float *p1, *p3;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ static void knot_remove_error_recalculate(
|
|||
BLI_assert(equals_v3v3(points[k->next->point_index], k->next->co));
|
||||
#endif
|
||||
|
||||
const float(*points_offset)[3];
|
||||
const float (*points_offset)[3];
|
||||
uint points_offset_len;
|
||||
|
||||
if (k->prev->point_index < k->next->point_index) {
|
||||
|
|
@ -196,7 +196,7 @@ uint BKE_curve_decimate_bezt_array(BezTriple *bezt_array,
|
|||
const uint bezt_array_last = bezt_array_len - 1;
|
||||
const uint points_len = BKE_curve_calc_coords_axis_len(bezt_array_len, resolu, is_cyclic, true);
|
||||
|
||||
float(*points)[3] = MEM_malloc_arrayN<float[3]>(points_len * (is_cyclic ? 2 : 1), __func__);
|
||||
float (*points)[3] = MEM_malloc_arrayN<float[3]>(points_len * (is_cyclic ? 2 : 1), __func__);
|
||||
|
||||
BKE_curve_calc_coords_axis(
|
||||
bezt_array, bezt_array_len, resolu, is_cyclic, false, 0, sizeof(float[3]), &points[0][0]);
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ static void layerSwap_mdisps(void *data, const int *ci)
|
|||
return;
|
||||
}
|
||||
|
||||
float(*d)[3] = MEM_calloc_arrayN<float[3]>(s->totdisp, "mdisps swap");
|
||||
float (*d)[3] = MEM_calloc_arrayN<float[3]>(s->totdisp, "mdisps swap");
|
||||
|
||||
for (int S = 0; S < corners; S++) {
|
||||
memcpy(d + cornersize * S, s->disps + cornersize * ci[S], sizeof(float[3]) * cornersize);
|
||||
|
|
@ -633,7 +633,7 @@ static void layerCopy_mdisps(const void *source, void *dest, const int count)
|
|||
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (s[i].disps) {
|
||||
d[i].disps = static_cast<float(*)[3]>(MEM_dupallocN(s[i].disps));
|
||||
d[i].disps = static_cast<float (*)[3]>(MEM_dupallocN(s[i].disps));
|
||||
d[i].hidden = static_cast<uint *>(MEM_dupallocN(s[i].hidden));
|
||||
}
|
||||
else {
|
||||
|
|
@ -1157,7 +1157,7 @@ static void layerInterp_mvert_skin(const void **sources,
|
|||
|
||||
static void layerSwap_flnor(void *data, const int *corner_indices)
|
||||
{
|
||||
short(*flnors)[4][3] = static_cast<short(*)[4][3]>(data);
|
||||
short (*flnors)[4][3] = static_cast<short (*)[4][3]>(data);
|
||||
short nors[4][3];
|
||||
int i = 4;
|
||||
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ static void curve_to_displist(const Curve *cu,
|
|||
dl->charidx = nu->charidx;
|
||||
dl->type = (is_cyclic && (dl->nr != 2)) ? DL_POLY : DL_SEGM;
|
||||
|
||||
float(*coords)[3] = (float(*)[3])dl->verts;
|
||||
float (*coords)[3] = (float (*)[3])dl->verts;
|
||||
for (int i = 0; i < len; i++) {
|
||||
const BPoint *bp = &nu->bp[i];
|
||||
copy_v3_v3(coords[i], bp->vec);
|
||||
|
|
|
|||
|
|
@ -1861,7 +1861,7 @@ static void dynamic_paint_apply_surface_vpaint_blend_cb(void *__restrict userdat
|
|||
userdata);
|
||||
|
||||
PaintPoint *pPoint = (PaintPoint *)data->surface->data->type_data;
|
||||
float(*fcolor)[4] = data->fcolor;
|
||||
float (*fcolor)[4] = data->fcolor;
|
||||
|
||||
/* blend dry and wet layer */
|
||||
blendColors(
|
||||
|
|
@ -1879,7 +1879,7 @@ static void dynamic_paint_apply_surface_vpaint_cb(void *__restrict userdata,
|
|||
|
||||
const DynamicPaintSurface *surface = data->surface;
|
||||
PaintPoint *pPoint = (PaintPoint *)surface->data->type_data;
|
||||
float(*fcolor)[4] = data->fcolor;
|
||||
float (*fcolor)[4] = data->fcolor;
|
||||
|
||||
blender::MutableSpan<blender::ColorGeometry4b> mloopcol = data->mloopcol;
|
||||
blender::MutableSpan<blender::ColorGeometry4b> mloopcol_wet = data->mloopcol_wet;
|
||||
|
|
@ -1950,8 +1950,8 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *
|
|||
const blender::Span<int> corner_verts = result->corner_verts();
|
||||
|
||||
/* paint is stored on dry and wet layers, so mix final color first */
|
||||
float(*fcolor)[4] = MEM_calloc_arrayN<float[4]>(sData->total_points,
|
||||
"Temp paint color");
|
||||
float (*fcolor)[4] = MEM_calloc_arrayN<float[4]>(sData->total_points,
|
||||
"Temp paint color");
|
||||
|
||||
DynamicPaintModifierApplyData data{};
|
||||
data.surface = surface;
|
||||
|
|
@ -2203,7 +2203,16 @@ Mesh *dynamicPaint_Modifier_do(
|
|||
/* Create a surface for uv image sequence format. */
|
||||
#define JITTER_SAMPLES \
|
||||
{ \
|
||||
0.0f, 0.0f, -0.2f, -0.4f, 0.2f, 0.4f, 0.4f, -0.2f, -0.4f, 0.3f, \
|
||||
0.0f, \
|
||||
0.0f, \
|
||||
-0.2f, \
|
||||
-0.4f, \
|
||||
0.2f, \
|
||||
0.4f, \
|
||||
0.4f, \
|
||||
-0.2f, \
|
||||
-0.4f, \
|
||||
0.3f, \
|
||||
}
|
||||
|
||||
struct DynamicPaintCreateUVSurfaceData {
|
||||
|
|
@ -3768,11 +3777,11 @@ static void dynamic_paint_brush_velocity_compute_cb(void *__restrict userdata,
|
|||
|
||||
Vec3f *brush_vel = data->brush_vel;
|
||||
|
||||
const float(*positions_p)[3] = data->positions_p;
|
||||
const float(*positions_c)[3] = data->positions_c;
|
||||
const float (*positions_p)[3] = data->positions_p;
|
||||
const float (*positions_c)[3] = data->positions_c;
|
||||
|
||||
const float(*obmat)[4] = data->obmat;
|
||||
float(*prev_obmat)[4] = data->prev_obmat;
|
||||
const float (*obmat)[4] = data->obmat;
|
||||
float (*prev_obmat)[4] = data->prev_obmat;
|
||||
|
||||
const float timescale = data->timescale;
|
||||
|
||||
|
|
@ -3831,7 +3840,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph,
|
|||
}
|
||||
numOfVerts_p = mesh_p->verts_num;
|
||||
|
||||
float(*positions_p)[3] = reinterpret_cast<float(*)[3]>(
|
||||
float (*positions_p)[3] = reinterpret_cast<float (*)[3]>(
|
||||
mesh_p->vert_positions_for_write().data());
|
||||
copy_m4_m4(prev_obmat, ob->object_to_world().ptr());
|
||||
|
||||
|
|
@ -3854,7 +3863,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph,
|
|||
mesh_c = runtime_data->brush_mesh;
|
||||
|
||||
numOfVerts_c = mesh_c->verts_num;
|
||||
float(*positions_c)[3] = reinterpret_cast<float(*)[3]>(
|
||||
float (*positions_c)[3] = reinterpret_cast<float (*)[3]>(
|
||||
mesh_c->vert_positions_for_write().data());
|
||||
|
||||
(*brushVel) = MEM_malloc_arrayN<Vec3f>(size_t(numOfVerts_c), "Dynamic Paint brush velocity");
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ Array<Array<float4>> BKE_editmesh_uv_tangents_calc(BMEditMesh *em,
|
|||
|
||||
mesh2tangent.looptris = em->looptris;
|
||||
result[n].reinitialize(bm->totloop);
|
||||
mesh2tangent.tangent = reinterpret_cast<float(*)[4]>(result[n].data());
|
||||
mesh2tangent.tangent = reinterpret_cast<float (*)[4]>(result[n].data());
|
||||
|
||||
mikk::Mikktspace<SGLSLEditMeshToTangent> mikk(mesh2tangent);
|
||||
mikk.genTangSpace();
|
||||
|
|
@ -275,7 +275,7 @@ Array<float4> BKE_editmesh_orco_tangents_calc(BMEditMesh *em,
|
|||
mesh2tangent.orco = vert_orco;
|
||||
|
||||
mesh2tangent.looptris = em->looptris;
|
||||
mesh2tangent.tangent = reinterpret_cast<float(*)[4]>(result.data());
|
||||
mesh2tangent.tangent = reinterpret_cast<float (*)[4]>(result.data());
|
||||
mikk::Mikktspace<SGLSLEditMeshToTangent> mikk(mesh2tangent);
|
||||
mikk.genTangSpace();
|
||||
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ static float dvar_eval_rotDiff(const AnimationEvalContext * /*anim_eval_context*
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
const float(*mat[2])[4];
|
||||
const float (*mat[2])[4];
|
||||
|
||||
/* NOTE: for now, these are all just world-space. */
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
|
|
|||
|
|
@ -155,9 +155,10 @@ void BKE_gpencil_stroke_fill_triangulate(bGPDstroke *gps)
|
|||
gps->tot_triangles = gps->totpoints - 2;
|
||||
uint(*tmp_triangles)[3] = MEM_malloc_arrayN<uint[3]>(size_t(gps->tot_triangles),
|
||||
"GP Stroke temp triangulation");
|
||||
float(*points2d)[2] = MEM_malloc_arrayN<float[2]>(size_t(gps->totpoints),
|
||||
"GP Stroke temp 2d points");
|
||||
float(*uv)[2] = MEM_malloc_arrayN<float[2]>(size_t(gps->totpoints), "GP Stroke temp 2d uv data");
|
||||
float (*points2d)[2] = MEM_malloc_arrayN<float[2]>(size_t(gps->totpoints),
|
||||
"GP Stroke temp 2d points");
|
||||
float (*uv)[2] = MEM_malloc_arrayN<float[2]>(size_t(gps->totpoints),
|
||||
"GP Stroke temp 2d uv data");
|
||||
|
||||
int direction = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ static void update_triangle_cache(const Span<float3> positions,
|
|||
}
|
||||
MutableSpan<int3> r_tris = triangles.slice(triangle_offsets[curve_i]);
|
||||
|
||||
float(*projverts)[2] = static_cast<float(*)[2]>(
|
||||
float (*projverts)[2] = static_cast<float (*)[2]>(
|
||||
BLI_memarena_alloc(pf_arena, sizeof(*projverts) * size_t(points.size())));
|
||||
|
||||
float3x3 axis_mat;
|
||||
|
|
@ -510,7 +510,7 @@ static void update_triangle_cache(const Span<float3> positions,
|
|||
}
|
||||
|
||||
BLI_polyfill_calc_arena(
|
||||
projverts, points.size(), 0, reinterpret_cast<uint32_t(*)[3]>(r_tris.data()), pf_arena);
|
||||
projverts, points.size(), 0, reinterpret_cast<uint32_t (*)[3]>(r_tris.data()), pf_arena);
|
||||
BLI_memarena_clear(pf_arena);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -601,7 +601,7 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **
|
|||
Mesh *mesh;
|
||||
BMVert *eve;
|
||||
BMIter iter;
|
||||
float(*co)[3];
|
||||
float (*co)[3];
|
||||
int a;
|
||||
|
||||
mesh = (Mesh *)key->from;
|
||||
|
|
@ -1588,7 +1588,7 @@ float *BKE_key_evaluate_object_ex(
|
|||
case ID_LT: {
|
||||
Lattice *lattice = (Lattice *)obdata;
|
||||
const int totpoint = min_ii(tot, lattice->pntsu * lattice->pntsv * lattice->pntsw);
|
||||
keyblock_data_convert_to_lattice((const float(*)[3])out, lattice->def, totpoint);
|
||||
keyblock_data_convert_to_lattice((const float (*)[3])out, lattice->def, totpoint);
|
||||
break;
|
||||
}
|
||||
case ID_CU_LEGACY: {
|
||||
|
|
@ -1687,7 +1687,7 @@ void BKE_keyblock_data_set_with_mat4(Key *key,
|
|||
for (KeyBlock *kb = static_cast<KeyBlock *>(key->block.first); kb; kb = kb->next, index++) {
|
||||
if (ELEM(shape_index, -1, index)) {
|
||||
const int block_elem_len = kb->totelem;
|
||||
float(*block_data)[3] = (float(*)[3])kb->data;
|
||||
float (*block_data)[3] = (float (*)[3])kb->data;
|
||||
for (int data_offset = 0; data_offset < block_elem_len; ++data_offset) {
|
||||
const float *src_data = (const float *)(elements + data_offset);
|
||||
float *dst_data = (float *)(block_data + data_offset);
|
||||
|
|
@ -1956,7 +1956,7 @@ std::optional<std::string> BKE_keyblock_curval_rnapath_get(const Key *key, const
|
|||
void BKE_keyblock_update_from_lattice(const Lattice *lt, KeyBlock *kb)
|
||||
{
|
||||
BPoint *bp;
|
||||
float(*fp)[3];
|
||||
float (*fp)[3];
|
||||
int a, tot;
|
||||
|
||||
BLI_assert(kb->totelem == lt->pntsu * lt->pntsv * lt->pntsw);
|
||||
|
|
@ -1967,7 +1967,7 @@ void BKE_keyblock_update_from_lattice(const Lattice *lt, KeyBlock *kb)
|
|||
}
|
||||
|
||||
bp = lt->def;
|
||||
fp = static_cast<float(*)[3]>(kb->data);
|
||||
fp = static_cast<float (*)[3]>(kb->data);
|
||||
for (a = 0; a < kb->totelem; a++, fp++, bp++) {
|
||||
copy_v3_v3(*fp, bp->vec);
|
||||
}
|
||||
|
|
@ -2002,7 +2002,7 @@ static void keyblock_data_convert_to_lattice(const float (*fp)[3],
|
|||
void BKE_keyblock_convert_to_lattice(const KeyBlock *kb, Lattice *lt)
|
||||
{
|
||||
BPoint *bp = lt->def;
|
||||
const float(*fp)[3] = static_cast<const float(*)[3]>(kb->data);
|
||||
const float (*fp)[3] = static_cast<const float (*)[3]>(kb->data);
|
||||
const int tot = min_ii(kb->totelem, lt->pntsu * lt->pntsv * lt->pntsw);
|
||||
|
||||
keyblock_data_convert_to_lattice(fp, bp, tot);
|
||||
|
|
@ -2213,8 +2213,8 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
|||
const bool face_normals_needed = r_face_normals != nullptr || vert_normals_needed ||
|
||||
loop_normals_needed;
|
||||
|
||||
float(*vert_normals)[3] = r_vert_normals;
|
||||
float(*face_normals)[3] = r_face_normals;
|
||||
float (*vert_normals)[3] = r_vert_normals;
|
||||
float (*face_normals)[3] = r_face_normals;
|
||||
bool free_vert_normals = false;
|
||||
bool free_face_normals = false;
|
||||
if (vert_normals_needed && r_vert_normals == nullptr) {
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline,
|
|||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||
|
||||
MaskSplinePoint *point_curr, *point_prev;
|
||||
float(*diff_points)[2], (*fp)[2];
|
||||
float (*diff_points)[2], (*fp)[2];
|
||||
const int tot = BKE_mask_spline_differentiate_calc_total(spline, resol);
|
||||
int a;
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ static void feather_bucket_add_edge(FeatherEdgesBucket *bucket, int start, int e
|
|||
bucket->segments = MEM_calloc_arrayN<int[2]>(alloc_delta, "feather bucket segments");
|
||||
}
|
||||
else {
|
||||
bucket->segments = static_cast<int(*)[2]>(MEM_reallocN(
|
||||
bucket->segments = static_cast<int (*)[2]>(MEM_reallocN(
|
||||
bucket->segments, (alloc_delta + bucket->tot_segment) * sizeof(*bucket->segments)));
|
||||
}
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ static float (
|
|||
{
|
||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||
MaskSplinePoint *point_curr, *point_prev;
|
||||
float(*feather)[2], (*fp)[2];
|
||||
float (*feather)[2], (*fp)[2];
|
||||
|
||||
const int tot = BKE_mask_spline_differentiate_calc_total(spline, resol);
|
||||
int a;
|
||||
|
|
@ -570,7 +570,7 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__double
|
|||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||
|
||||
MaskSplinePoint *point_curr, *point_prev;
|
||||
float(*feather)[2], (*fp)[2];
|
||||
float (*feather)[2], (*fp)[2];
|
||||
const int tot = BKE_mask_spline_differentiate_calc_total(spline, resol);
|
||||
int a;
|
||||
|
||||
|
|
@ -724,7 +724,7 @@ float (*BKE_mask_spline_feather_points(MaskSpline *spline, int *r_tot_feather_po
|
|||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||
|
||||
int i, tot = 0;
|
||||
float(*feather)[2], (*fp)[2];
|
||||
float (*feather)[2], (*fp)[2];
|
||||
|
||||
/* count */
|
||||
for (i = 0; i < spline->tot_point; i++) {
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ static bool layer_bucket_isect_test(const MaskRasterLayer *layer,
|
|||
const float bucket_max_rad_squared)
|
||||
{
|
||||
uint *face = layer->face_array[face_index];
|
||||
float(*cos)[3] = layer->face_coords;
|
||||
float (*cos)[3] = layer->face_coords;
|
||||
|
||||
const float xmin = layer->bounds.xmin + (bucket_size_x * float(bucket_x));
|
||||
const float ymin = layer->bounds.ymin + (bucket_size_y * float(bucket_y));
|
||||
|
|
@ -425,7 +425,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
|
|||
const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad;
|
||||
|
||||
uint *face = &layer->face_array[0][0];
|
||||
float(*cos)[3] = layer->face_coords;
|
||||
float (*cos)[3] = layer->face_coords;
|
||||
|
||||
const uint bucket_tot = layer->buckets_x * layer->buckets_y;
|
||||
LinkNode **bucketstore = MEM_calloc_arrayN<LinkNode *>(bucket_tot, __func__);
|
||||
|
|
@ -623,11 +623,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
|
|||
const bool is_cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0;
|
||||
const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0;
|
||||
|
||||
float(*diff_points)[2];
|
||||
float (*diff_points)[2];
|
||||
uint tot_diff_point;
|
||||
|
||||
float(*diff_feather_points)[2];
|
||||
float(*diff_feather_points_flip)[2];
|
||||
float (*diff_feather_points)[2];
|
||||
float (*diff_feather_points_flip)[2];
|
||||
uint tot_diff_feather_points;
|
||||
|
||||
const uint resol_a = uint(BKE_mask_spline_resolution(spline, width, height) / 4);
|
||||
|
|
@ -899,8 +899,8 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
|
|||
}
|
||||
|
||||
{
|
||||
uint(*face_array)[4], *face; /* access coords */
|
||||
float(*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */
|
||||
uint(*face_array)[4], *face; /* access coords */
|
||||
float (*face_coords)[3], *cos; /* xy, z 0-1 (1.0 == filled) */
|
||||
uint sf_tri_tot;
|
||||
rctf bounds;
|
||||
uint face_index;
|
||||
|
|
@ -946,7 +946,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
|
|||
uint sf_vert_tot_isect = uint(BLI_listbase_count(&sf_ctx.fillvertbase));
|
||||
uint i = sf_vert_tot;
|
||||
|
||||
face_coords = static_cast<float(*)[3]>(
|
||||
face_coords = static_cast<float (*)[3]>(
|
||||
MEM_reallocN(face_coords, sizeof(float[3]) * (sf_vert_tot + sf_vert_tot_isect)));
|
||||
|
||||
cos = (&face_coords[sf_vert_tot][0]);
|
||||
|
|
@ -1332,7 +1332,7 @@ static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2
|
|||
|
||||
if (face_index) {
|
||||
uint(*face_array)[4] = layer->face_array;
|
||||
float(*cos)[3] = layer->face_coords;
|
||||
float (*cos)[3] = layer->face_coords;
|
||||
float best_dist = 1.0f;
|
||||
while (*face_index != TRI_TERMINATOR_ID) {
|
||||
const float test_dist = maskrasterize_layer_isect(
|
||||
|
|
|
|||
|
|
@ -673,7 +673,7 @@ void BKE_mball_data_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
|
|||
BKE_lattice_deform_coords(
|
||||
ob->parent,
|
||||
ob,
|
||||
reinterpret_cast<float(*)[3]>(mesh->vert_positions_for_write().data()),
|
||||
reinterpret_cast<float (*)[3]>(mesh->vert_positions_for_write().data()),
|
||||
mesh->verts_num,
|
||||
0,
|
||||
nullptr,
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ static float densfunc(const MetaElem *ball, float x, float y, float z)
|
|||
float dist2;
|
||||
float dvec[3] = {x, y, z};
|
||||
|
||||
mul_m4_v3((const float(*)[4])ball->imat, dvec);
|
||||
mul_m4_v3((const float (*)[4])ball->imat, dvec);
|
||||
|
||||
switch (ball->type) {
|
||||
case MB_BALL:
|
||||
|
|
@ -444,7 +444,7 @@ static void make_face(PROCESS *process, int i1, int i2, int i3, int i4)
|
|||
|
||||
if (UNLIKELY(process->totindex == process->curindex)) {
|
||||
process->totindex = process->totindex ? (process->totindex * 2) : MBALL_ARRAY_LEN_INIT;
|
||||
process->indices = static_cast<int(*)[4]>(
|
||||
process->indices = static_cast<int (*)[4]>(
|
||||
MEM_reallocN(process->indices, sizeof(int[4]) * process->totindex));
|
||||
}
|
||||
|
||||
|
|
@ -1278,9 +1278,9 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
|
|||
* rotation ->
|
||||
* ml local space
|
||||
*/
|
||||
mul_m4_series((float(*)[4])new_ml->mat, obinv, bob->object_to_world().ptr(), pos, rot);
|
||||
mul_m4_series((float (*)[4])new_ml->mat, obinv, bob->object_to_world().ptr(), pos, rot);
|
||||
/* ml local space -> basis object space */
|
||||
invert_m4_m4((float(*)[4])new_ml->imat, (float(*)[4])new_ml->mat);
|
||||
invert_m4_m4((float (*)[4])new_ml->imat, (float (*)[4])new_ml->mat);
|
||||
|
||||
/* rad2 is inverse of squared radius */
|
||||
new_ml->rad2 = 1 / (ml->rad * ml->rad);
|
||||
|
|
@ -1323,7 +1323,7 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
|
|||
|
||||
/* Transformation of meta-elem bounding-box. */
|
||||
for (uint i = 0; i < 8; i++) {
|
||||
mul_m4_v3((float(*)[4])new_ml->mat, new_ml->bb->vec[i]);
|
||||
mul_m4_v3((float (*)[4])new_ml->mat, new_ml->bb->vec[i]);
|
||||
}
|
||||
|
||||
/* Find max and min of transformed bounding-box. */
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ float face_area_calc(const Span<float3> vert_positions, const Span<int> face_ver
|
|||
for (const int i : face_verts.index_range()) {
|
||||
coords[i] = vert_positions[face_verts[i]];
|
||||
}
|
||||
return area_poly_v3((const float(*)[3])coords.data(), face_verts.size());
|
||||
return area_poly_v3((const float (*)[3])coords.data(), face_verts.size());
|
||||
}
|
||||
|
||||
} // namespace blender::bke::mesh
|
||||
|
|
@ -466,7 +466,7 @@ void BKE_mesh_mdisp_flip(MDisps *md, const bool use_loop_mdisp_flip)
|
|||
}
|
||||
|
||||
const int sides = int(sqrt(md->totdisp));
|
||||
float(*co)[3] = md->disps;
|
||||
float (*co)[3] = md->disps;
|
||||
|
||||
for (int x = 0; x < sides; x++) {
|
||||
float *co_a, *co_b;
|
||||
|
|
|
|||
|
|
@ -386,9 +386,9 @@ static void bm_corners_to_loops_ex(ID *id,
|
|||
}
|
||||
|
||||
if (CustomData_has_layer(fdata_legacy, CD_TESSLOOPNORMAL)) {
|
||||
float(*loop_normals)[3] = (float(*)[3])CustomData_get_for_write(
|
||||
float (*loop_normals)[3] = (float (*)[3])CustomData_get_for_write(
|
||||
ldata, loopstart, CD_NORMAL, totloop);
|
||||
const short(*tessloop_normals)[3] = (short(*)[3])CustomData_get_for_write(
|
||||
const short (*tessloop_normals)[3] = (short (*)[3])CustomData_get_for_write(
|
||||
fdata_legacy, findex, CD_TESSLOOPNORMAL, totface);
|
||||
const int max = mf->v4 ? 4 : 3;
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ static void bm_corners_to_loops_ex(ID *id,
|
|||
MDisps *ld = (MDisps *)CustomData_get_for_write(ldata, loopstart, CD_MDISPS, totloop);
|
||||
const MDisps *fd = (const MDisps *)CustomData_get_for_write(
|
||||
fdata_legacy, findex, CD_MDISPS, totface);
|
||||
const float(*disps)[3] = fd->disps;
|
||||
const float (*disps)[3] = fd->disps;
|
||||
int tot = mf->v4 ? 4 : 3;
|
||||
int corners;
|
||||
|
||||
|
|
@ -900,10 +900,10 @@ static void mesh_loops_to_tessdata(CustomData *fdata_legacy,
|
|||
}
|
||||
|
||||
if (hasLoopNormal) {
|
||||
short(*face_normals)[4][3] = (short(*)[4][3])CustomData_get_layer(fdata_legacy,
|
||||
CD_TESSLOOPNORMAL);
|
||||
const float(*loop_normals)[3] = (const float(*)[3])CustomData_get_layer(corner_data,
|
||||
CD_NORMAL);
|
||||
short (*face_normals)[4][3] = (short (*)[4][3])CustomData_get_layer(fdata_legacy,
|
||||
CD_TESSLOOPNORMAL);
|
||||
const float (*loop_normals)[3] = (const float (*)[3])CustomData_get_layer(corner_data,
|
||||
CD_NORMAL);
|
||||
|
||||
for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, face_normals++) {
|
||||
for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) {
|
||||
|
|
@ -1099,7 +1099,7 @@ static int mesh_tessface_calc(Mesh &mesh,
|
|||
float normal[3];
|
||||
|
||||
float axis_mat[3][3];
|
||||
float(*projverts)[2];
|
||||
float (*projverts)[2];
|
||||
uint(*tris)[3];
|
||||
|
||||
const uint totfilltri = mp_totloop - 2;
|
||||
|
|
@ -1109,7 +1109,7 @@ static int mesh_tessface_calc(Mesh &mesh,
|
|||
}
|
||||
|
||||
tris = (uint(*)[3])BLI_memarena_alloc(arena, sizeof(*tris) * size_t(totfilltri));
|
||||
projverts = (float(*)[2])BLI_memarena_alloc(arena, sizeof(*projverts) * size_t(mp_totloop));
|
||||
projverts = (float (*)[2])BLI_memarena_alloc(arena, sizeof(*projverts) * size_t(mp_totloop));
|
||||
|
||||
zero_v3(normal);
|
||||
|
||||
|
|
@ -1233,7 +1233,7 @@ void BKE_mesh_tessface_calc(Mesh *mesh)
|
|||
&mesh->fdata_legacy,
|
||||
&mesh->corner_data,
|
||||
&mesh->face_data,
|
||||
reinterpret_cast<float(*)[3]>(mesh->vert_positions_for_write().data()),
|
||||
reinterpret_cast<float (*)[3]>(mesh->vert_positions_for_write().data()),
|
||||
mesh->totface_legacy,
|
||||
mesh->corners_num,
|
||||
mesh->faces_num);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(blender::OffsetIndices<int> faces,
|
|||
threading::parallel_for(faces.index_range(), 1024, [&](const IndexRange range) {
|
||||
for (const int64_t face : range) {
|
||||
const Span<float2> face_uvs = uv_map.slice(faces[face]);
|
||||
winding[face] = cross_poly_v2(reinterpret_cast<const float(*)[2]>(face_uvs.data()),
|
||||
winding[face] = cross_poly_v2(reinterpret_cast<const float (*)[2]>(face_uvs.data()),
|
||||
uint(faces[face].size())) < 0.0f;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
|
|||
/* handle shape keys */
|
||||
totshape = CustomData_number_of_layers(&result->vert_data, CD_SHAPEKEY);
|
||||
for (a = 0; a < totshape; a++) {
|
||||
float(*cos)[3] = static_cast<float(*)[3]>(
|
||||
float (*cos)[3] = static_cast<float (*)[3]>(
|
||||
CustomData_get_layer_n_for_write(&result->vert_data, CD_SHAPEKEY, a, result->verts_num));
|
||||
for (int i = src_verts_num; i < result->verts_num; i++) {
|
||||
mul_m4_v3(mtx, cos[i]);
|
||||
|
|
@ -359,7 +359,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
|
|||
const int totuv = CustomData_number_of_layers(&result->corner_data, CD_PROP_FLOAT2);
|
||||
|
||||
for (a = 0; a < totuv; a++) {
|
||||
float(*uv_map)[2] = static_cast<float(*)[2]>(CustomData_get_layer_n_for_write(
|
||||
float (*uv_map)[2] = static_cast<float (*)[2]>(CustomData_get_layer_n_for_write(
|
||||
&result->corner_data, CD_PROP_FLOAT2, a, result->corners_num));
|
||||
int j = src_loops_num;
|
||||
uv_map += j; /* second set of loops only */
|
||||
|
|
|
|||
|
|
@ -181,13 +181,13 @@ static void mesh_calc_eigen_matrix(const Span<float3> positions, float r_mat[4][
|
|||
|
||||
/* NOTE: here we apply sample correction to covariance matrix, since we consider the vertices
|
||||
* as a sample of the whole 'surface' population of our mesh. */
|
||||
BLI_covariance_m3_v3n(reinterpret_cast<const float(*)[3]>(positions.data()),
|
||||
BLI_covariance_m3_v3n(reinterpret_cast<const float (*)[3]>(positions.data()),
|
||||
int(positions.size()),
|
||||
true,
|
||||
covmat,
|
||||
center);
|
||||
|
||||
eigen_success = BLI_eigen_solve_selfadjoint_m3((const float(*)[3])covmat, eigen_val, eigen_vec);
|
||||
eigen_success = BLI_eigen_solve_selfadjoint_m3((const float (*)[3])covmat, eigen_val, eigen_vec);
|
||||
BLI_assert(eigen_success);
|
||||
UNUSED_VARS_NDEBUG(eigen_success);
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ void BKE_mesh_remap_find_best_match_from_mesh(const Span<float3> vert_positions_
|
|||
{1.0f, 1.0f, -1.0f}, /* -> 1, -1, 1 */
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
const float(*mirr)[3];
|
||||
const float (*mirr)[3];
|
||||
|
||||
float mat_src[4][4], mat_dst[4][4], best_mat_dst[4][4];
|
||||
float best_match = FLT_MAX, match;
|
||||
|
|
@ -355,7 +355,7 @@ static int mesh_remap_interp_face_data_get(const blender::IndexRange face,
|
|||
const bool do_weights,
|
||||
int *r_closest_index)
|
||||
{
|
||||
float(*vco)[3];
|
||||
float (*vco)[3];
|
||||
float ref_dist_sq = FLT_MAX;
|
||||
int *index;
|
||||
const int sources_num = int(face.size());
|
||||
|
|
@ -363,7 +363,7 @@ static int mesh_remap_interp_face_data_get(const blender::IndexRange face,
|
|||
|
||||
if (size_t(sources_num) > *buff_size) {
|
||||
*buff_size = size_t(sources_num);
|
||||
*vcos = static_cast<float(*)[3]>(MEM_reallocN(*vcos, sizeof(**vcos) * *buff_size));
|
||||
*vcos = static_cast<float (*)[3]>(MEM_reallocN(*vcos, sizeof(**vcos) * *buff_size));
|
||||
*indices = static_cast<int *>(MEM_reallocN(*indices, sizeof(**indices) * *buff_size));
|
||||
if (do_weights) {
|
||||
*weights = static_cast<float *>(MEM_reallocN(*weights, sizeof(**weights) * *buff_size));
|
||||
|
|
@ -543,7 +543,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(const int mode,
|
|||
const blender::Span<int> tri_faces = me_src->corner_tri_faces();
|
||||
|
||||
size_t tmp_buff_size = MREMAP_DEFAULT_BUFSIZE;
|
||||
float(*vcos)[3] = MEM_malloc_arrayN<float[3]>(tmp_buff_size, __func__);
|
||||
float (*vcos)[3] = MEM_malloc_arrayN<float[3]>(tmp_buff_size, __func__);
|
||||
int *indices = MEM_malloc_arrayN<int>(tmp_buff_size, __func__);
|
||||
float *weights = MEM_malloc_arrayN<float>(tmp_buff_size, __func__);
|
||||
|
||||
|
|
@ -1074,14 +1074,14 @@ static void mesh_island_to_astar_graph(MeshIslandStore *islands,
|
|||
|
||||
const int node_num = islands ? island_face_map->count : int(faces.size());
|
||||
uchar *face_status = MEM_calloc_arrayN<uchar>(size_t(node_num), __func__);
|
||||
float(*face_centers)[3];
|
||||
float (*face_centers)[3];
|
||||
|
||||
int pidx_isld;
|
||||
int i;
|
||||
|
||||
BLI_astar_graph_init(r_as_graph, node_num, nullptr);
|
||||
/* face_centers is owned by graph memarena. */
|
||||
face_centers = static_cast<float(*)[3]>(
|
||||
face_centers = static_cast<float (*)[3]>(
|
||||
BLI_memarena_calloc(r_as_graph->mem, sizeof(*face_centers) * size_t(node_num)));
|
||||
|
||||
if (islands) {
|
||||
|
|
@ -1260,7 +1260,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
|
|||
blender::Span<int> tri_faces_src;
|
||||
|
||||
size_t buff_size_interp = MREMAP_DEFAULT_BUFSIZE;
|
||||
float(*vcos_interp)[3] = nullptr;
|
||||
float (*vcos_interp)[3] = nullptr;
|
||||
int *indices_interp = nullptr;
|
||||
float *weights_interp = nullptr;
|
||||
|
||||
|
|
@ -1479,7 +1479,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
|
|||
|
||||
if (mesh_remap_bvhtree_query_nearest(tdata, &nearest, tmp_co, max_dist_sq, &hit_dist))
|
||||
{
|
||||
float(*nor_dst)[3];
|
||||
float (*nor_dst)[3];
|
||||
blender::Span<blender::float3> nors_src;
|
||||
float best_nor_dot = -2.0f;
|
||||
float best_sqdist_fallback = FLT_MAX;
|
||||
|
|
@ -2084,9 +2084,9 @@ void BKE_mesh_remap_calc_faces_from_mesh(const int mode,
|
|||
float *weights = MEM_malloc_arrayN<float>(numfaces_src, __func__);
|
||||
|
||||
size_t tmp_face_size = MREMAP_DEFAULT_BUFSIZE;
|
||||
float(*face_vcos_2d)[2] = MEM_malloc_arrayN<float[2]>(tmp_face_size, __func__);
|
||||
float (*face_vcos_2d)[2] = MEM_malloc_arrayN<float[2]>(tmp_face_size, __func__);
|
||||
/* Tessellated 2D face, always (num_loops - 2) triangles. */
|
||||
int(*tri_vidx_2d)[3] = MEM_malloc_arrayN<int[3]>(tmp_face_size - 2, __func__);
|
||||
int (*tri_vidx_2d)[3] = MEM_malloc_arrayN<int[3]>(tmp_face_size - 2, __func__);
|
||||
|
||||
for (const int64_t i : faces_dst.index_range()) {
|
||||
/* For each dst face, we sample some rays from it (2D grid in pnor space)
|
||||
|
|
@ -2123,9 +2123,9 @@ void BKE_mesh_remap_calc_faces_from_mesh(const int mode,
|
|||
|
||||
if (UNLIKELY(size_t(face.size()) > tmp_face_size)) {
|
||||
tmp_face_size = size_t(face.size());
|
||||
face_vcos_2d = static_cast<float(*)[2]>(
|
||||
face_vcos_2d = static_cast<float (*)[2]>(
|
||||
MEM_reallocN(face_vcos_2d, sizeof(*face_vcos_2d) * tmp_face_size));
|
||||
tri_vidx_2d = static_cast<int(*)[3]>(
|
||||
tri_vidx_2d = static_cast<int (*)[3]>(
|
||||
MEM_reallocN(tri_vidx_2d, sizeof(*tri_vidx_2d) * (tmp_face_size - 2)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ bool BKE_mesh_runtime_is_valid(Mesh *mesh_eval)
|
|||
CustomData_get_layer_for_write(&mesh_eval->vert_data, CD_MDEFORMVERT, mesh_eval->verts_num));
|
||||
is_valid &= BKE_mesh_validate_arrays(
|
||||
mesh_eval,
|
||||
reinterpret_cast<float(*)[3]>(positions.data()),
|
||||
reinterpret_cast<float (*)[3]>(positions.data()),
|
||||
positions.size(),
|
||||
edges.data(),
|
||||
edges.size(),
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ BLI_INLINE void mesh_calc_tessellation_for_face_impl(const Span<int> corner_vert
|
|||
|
||||
uint(*tris)[3] = static_cast<uint(*)[3]>(
|
||||
BLI_memarena_alloc(pf_arena, sizeof(*tris) * size_t(totfilltri)));
|
||||
float(*projverts)[2] = static_cast<float(*)[2]>(
|
||||
float (*projverts)[2] = static_cast<float (*)[2]>(
|
||||
BLI_memarena_alloc(pf_arena, sizeof(*projverts) * size_t(face_size)));
|
||||
|
||||
for (int j = 0; j < face_size; j++) {
|
||||
|
|
|
|||
|
|
@ -1050,7 +1050,7 @@ bool BKE_mesh_validate(Mesh *mesh, const bool do_verbose, const bool cddata_chec
|
|||
CustomData_get_layer_for_write(&mesh->vert_data, CD_MDEFORMVERT, mesh->verts_num));
|
||||
BKE_mesh_validate_arrays(
|
||||
mesh,
|
||||
reinterpret_cast<float(*)[3]>(positions.data()),
|
||||
reinterpret_cast<float (*)[3]>(positions.data()),
|
||||
positions.size(),
|
||||
edges.data(),
|
||||
edges.size(),
|
||||
|
|
@ -1107,7 +1107,7 @@ bool BKE_mesh_is_valid(Mesh *mesh)
|
|||
CustomData_get_layer_for_write(&mesh->vert_data, CD_MDEFORMVERT, mesh->verts_num));
|
||||
is_valid &= BKE_mesh_validate_arrays(
|
||||
mesh,
|
||||
reinterpret_cast<float(*)[3]>(positions.data()),
|
||||
reinterpret_cast<float (*)[3]>(positions.data()),
|
||||
positions.size(),
|
||||
edges.data(),
|
||||
edges.size(),
|
||||
|
|
|
|||
|
|
@ -489,11 +489,11 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, const int
|
|||
MDisps *mdisp = &mdisps[corner];
|
||||
const int totdisp = multires_grid_tot[lvl];
|
||||
|
||||
float(*disps)[3] = MEM_calloc_arrayN<float[3]>(totdisp, "multires disps");
|
||||
float (*disps)[3] = MEM_calloc_arrayN<float[3]>(totdisp, "multires disps");
|
||||
|
||||
if (mdisp->disps != nullptr) {
|
||||
float(*ndisps)[3] = disps;
|
||||
float(*hdisps)[3] = mdisp->disps;
|
||||
float (*ndisps)[3] = disps;
|
||||
float (*hdisps)[3] = mdisp->disps;
|
||||
|
||||
multires_copy_grid(ndisps, hdisps, nsize, hsize);
|
||||
if (mdisp->hidden) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static void multires_subdivide_create_object_space_linear_grids(Mesh *mesh)
|
|||
for (int l = 0; l < face.size(); l++) {
|
||||
const int loop_index = face[l];
|
||||
|
||||
float(*disps)[3] = mdisps[loop_index].disps;
|
||||
float (*disps)[3] = mdisps[loop_index].disps;
|
||||
mdisps[loop_index].totdisp = 4;
|
||||
mdisps[loop_index].level = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ static void allocate_displacement_grid(MDisps *displacement_grid, const int leve
|
|||
{
|
||||
const int grid_size = blender::bke::subdiv::grid_size_from_level(level);
|
||||
const int grid_area = grid_size * grid_size;
|
||||
float(*disps)[3] = MEM_calloc_arrayN<float[3]>(grid_area, "multires disps");
|
||||
float (*disps)[3] = MEM_calloc_arrayN<float[3]>(grid_area, "multires disps");
|
||||
if (displacement_grid->disps != nullptr) {
|
||||
MEM_freeN(displacement_grid->disps);
|
||||
}
|
||||
|
|
@ -644,7 +644,7 @@ void multires_reshape_store_original_grids(MultiresReshapeContext *reshape_conte
|
|||
* Reshape process will ensure all grids are on top level, but that happens on separate set of
|
||||
* grids which eventually replaces original one. */
|
||||
if (orig_grid->disps != nullptr) {
|
||||
orig_grid->disps = static_cast<float(*)[3]>(MEM_dupallocN(orig_grid->disps));
|
||||
orig_grid->disps = static_cast<float (*)[3]>(MEM_dupallocN(orig_grid->disps));
|
||||
}
|
||||
if (orig_grid_paint_masks != nullptr) {
|
||||
GridPaintMask *orig_paint_mask_grid = &orig_grid_paint_masks[grid_index];
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ static void store_grid_data(MultiresUnsubdivideContext *context,
|
|||
const int grid_size = CCG_grid_size(context->num_original_levels);
|
||||
const int face_grid_size = CCG_grid_size(context->num_original_levels + 1);
|
||||
const int face_grid_area = face_grid_size * face_grid_size;
|
||||
float(*face_grid)[3] = MEM_calloc_arrayN<float[3]>(face_grid_area, "face_grid");
|
||||
float (*face_grid)[3] = MEM_calloc_arrayN<float[3]>(face_grid_area, "face_grid");
|
||||
|
||||
for (int i = 0; i < face.size(); i++) {
|
||||
const int loop_index = face[i];
|
||||
|
|
@ -1178,7 +1178,7 @@ static void multires_create_grids_in_unsubdivided_base_mesh(MultiresUnsubdivideC
|
|||
|
||||
/* Allocate the MDISPS grids and copy the extracted data from context. */
|
||||
for (int i = 0; i < totloop; i++) {
|
||||
float(*disps)[3] = MEM_calloc_arrayN<float[3]>(totdisp, __func__);
|
||||
float (*disps)[3] = MEM_calloc_arrayN<float[3]>(totdisp, __func__);
|
||||
|
||||
if (mdisps[i].disps) {
|
||||
MEM_freeN(mdisps[i].disps);
|
||||
|
|
|
|||
|
|
@ -2735,7 +2735,7 @@ void BKE_object_obdata_size_init(Object *ob, const float size)
|
|||
unit_m4(mat);
|
||||
scale_m4_fl(mat, size);
|
||||
|
||||
BKE_lattice_transform(lt, (float(*)[4])mat, false);
|
||||
BKE_lattice_transform(lt, (float (*)[4])mat, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -3160,7 +3160,7 @@ static void give_parvert(const Object *par, int nr, float vec[3], const bool use
|
|||
DispList *dl = par->runtime->curve_cache ?
|
||||
BKE_displist_find(&par->runtime->curve_cache->disp, DL_VERTS) :
|
||||
nullptr;
|
||||
float(*co)[3] = dl ? (float(*)[3])dl->verts : nullptr;
|
||||
float (*co)[3] = dl ? (float (*)[3])dl->verts : nullptr;
|
||||
int tot;
|
||||
|
||||
if (latt->editlatt) {
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ static bool copy_dupli_context(DupliContext *r_ctx,
|
|||
r_ctx->object = ob;
|
||||
r_ctx->instance_stack = ctx->instance_stack;
|
||||
if (mat) {
|
||||
mul_m4_m4m4(r_ctx->space_mat, (float(*)[4])ctx->space_mat, mat);
|
||||
mul_m4_m4m4(r_ctx->space_mat, (float (*)[4])ctx->space_mat, mat);
|
||||
}
|
||||
r_ctx->persistent_id[r_ctx->level] = index;
|
||||
r_ctx->instance_idx[r_ctx->level] = instance_index;
|
||||
|
|
@ -279,7 +279,7 @@ static DupliObject *make_dupli(const DupliContext *ctx,
|
|||
|
||||
dob->ob = ob;
|
||||
dob->ob_data = const_cast<ID *>(object_data);
|
||||
mul_m4_m4m4(dob->mat, (float(*)[4])ctx->space_mat, mat);
|
||||
mul_m4_m4m4(dob->mat, (float (*)[4])ctx->space_mat, mat);
|
||||
dob->type = ctx->gen == nullptr ? 0 : ctx->dupli_gen_type_stack->last();
|
||||
dob->preview_base_geometry = ctx->preview_base_geometry;
|
||||
dob->preview_instance_index = ctx->preview_instance_index;
|
||||
|
|
@ -779,7 +779,7 @@ static void make_duplis_verts(const DupliContext *ctx)
|
|||
vdd.totvert = mesh_eval->verts_num;
|
||||
vdd.vert_positions = mesh_eval->vert_positions();
|
||||
vdd.vert_normals = mesh_eval->vert_normals();
|
||||
vdd.orco = (const float(*)[3])CustomData_get_layer(&mesh_eval->vert_data, CD_ORCO);
|
||||
vdd.orco = (const float (*)[3])CustomData_get_layer(&mesh_eval->vert_data, CD_ORCO);
|
||||
|
||||
make_child_duplis(ctx, &vdd, make_child_duplis_verts_from_mesh);
|
||||
}
|
||||
|
|
@ -1149,7 +1149,7 @@ static void get_dupliface_transform_from_coords(Span<float3> coords,
|
|||
/* Scale. */
|
||||
float scale;
|
||||
if (use_scale) {
|
||||
const float area = area_poly_v3((const float(*)[3])coords.data(), uint(coords.size()));
|
||||
const float area = area_poly_v3((const float (*)[3])coords.data(), uint(coords.size()));
|
||||
scale = sqrtf(area) * scale_fac;
|
||||
}
|
||||
else {
|
||||
|
|
@ -1255,7 +1255,7 @@ static void make_child_duplis_faces_from_mesh(const DupliContext *ctx,
|
|||
Object *inst_ob)
|
||||
{
|
||||
FaceDupliData_Mesh *fdd = (FaceDupliData_Mesh *)userdata;
|
||||
const float(*orco)[3] = fdd->orco;
|
||||
const float (*orco)[3] = fdd->orco;
|
||||
const float2 *uv_map = fdd->uv_map;
|
||||
const int totface = fdd->totface;
|
||||
const bool use_scale = fdd->params.use_scale;
|
||||
|
|
@ -1371,7 +1371,7 @@ static void make_duplis_faces(const DupliContext *ctx)
|
|||
fdd.uv_map = (uv_idx != -1) ? (const float2 *)CustomData_get_layer_n(
|
||||
&mesh_eval->corner_data, CD_PROP_FLOAT2, uv_idx) :
|
||||
nullptr;
|
||||
fdd.orco = (const float(*)[3])CustomData_get_layer(&mesh_eval->vert_data, CD_ORCO);
|
||||
fdd.orco = (const float (*)[3])CustomData_get_layer(&mesh_eval->vert_data, CD_ORCO);
|
||||
|
||||
make_child_duplis(ctx, &fdd, make_child_duplis_faces_from_mesh);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1716,7 +1716,7 @@ void psys_interpolate_face(Mesh *mesh,
|
|||
else {
|
||||
interp_v3_v3v3v3(orco, o1, o2, o3, w);
|
||||
}
|
||||
BKE_mesh_orco_verts_transform(mesh, (float(*)[3])orco, 1, true);
|
||||
BKE_mesh_orco_verts_transform(mesh, (float (*)[3])orco, 1, true);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(orco, vec);
|
||||
|
|
@ -1841,7 +1841,7 @@ int psys_particle_dm_face_lookup(Mesh *mesh_final,
|
|||
const OrigSpaceFace *osface_final;
|
||||
int pindex_orig;
|
||||
float uv[2];
|
||||
const float(*faceuv)[2];
|
||||
const float (*faceuv)[2];
|
||||
|
||||
const int *index_mf_to_mpoly_deformed = nullptr;
|
||||
const int *index_mf_to_mpoly = nullptr;
|
||||
|
|
@ -2031,7 +2031,7 @@ void psys_particle_on_dm(Mesh *mesh_final,
|
|||
float orco[3])
|
||||
{
|
||||
float tmpnor[3], mapfw[4];
|
||||
const float(*orcodata)[3];
|
||||
const float (*orcodata)[3];
|
||||
int mapindex;
|
||||
|
||||
if (!psys_map_index_on_dm(mesh_final, from, index, index_dmcache, fw, foffset, &mapindex, mapfw))
|
||||
|
|
@ -2056,7 +2056,8 @@ void psys_particle_on_dm(Mesh *mesh_final,
|
|||
return;
|
||||
}
|
||||
|
||||
orcodata = static_cast<const float(*)[3]>(CustomData_get_layer(&mesh_final->vert_data, CD_ORCO));
|
||||
orcodata = static_cast<const float (*)[3]>(
|
||||
CustomData_get_layer(&mesh_final->vert_data, CD_ORCO));
|
||||
const blender::Span<blender::float3> vert_normals = mesh_final->vert_normals();
|
||||
|
||||
if (from == PART_FROM_VERT) {
|
||||
|
|
@ -2070,7 +2071,7 @@ void psys_particle_on_dm(Mesh *mesh_final,
|
|||
if (orco) {
|
||||
if (orcodata) {
|
||||
copy_v3_v3(orco, orcodata[mapindex]);
|
||||
BKE_mesh_orco_verts_transform(mesh_final, (float(*)[3])orco, 1, true);
|
||||
BKE_mesh_orco_verts_transform(mesh_final, (float (*)[3])orco, 1, true);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(orco, vec);
|
||||
|
|
@ -2099,8 +2100,8 @@ void psys_particle_on_dm(Mesh *mesh_final,
|
|||
|
||||
if (from == PART_FROM_VOLUME) {
|
||||
psys_interpolate_face(mesh_final,
|
||||
reinterpret_cast<const float(*)[3]>(vert_positions.data()),
|
||||
reinterpret_cast<const float(*)[3]>(vert_normals.data()),
|
||||
reinterpret_cast<const float (*)[3]>(vert_positions.data()),
|
||||
reinterpret_cast<const float (*)[3]>(vert_normals.data()),
|
||||
mface,
|
||||
mtface,
|
||||
orcodata,
|
||||
|
|
@ -2122,8 +2123,8 @@ void psys_particle_on_dm(Mesh *mesh_final,
|
|||
}
|
||||
else {
|
||||
psys_interpolate_face(mesh_final,
|
||||
reinterpret_cast<const float(*)[3]>(vert_positions.data()),
|
||||
reinterpret_cast<const float(*)[3]>(vert_normals.data()),
|
||||
reinterpret_cast<const float (*)[3]>(vert_positions.data()),
|
||||
reinterpret_cast<const float (*)[3]>(vert_normals.data()),
|
||||
mface,
|
||||
mtface,
|
||||
orcodata,
|
||||
|
|
@ -3803,7 +3804,7 @@ static void psys_face_mat(Object *ob, Mesh *mesh, ParticleData *pa, float mat[4]
|
|||
{
|
||||
float v[3][3];
|
||||
MFace *mface;
|
||||
const float(*orcodata)[3];
|
||||
const float (*orcodata)[3];
|
||||
|
||||
int i = ELEM(pa->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND) ? pa->num : pa->num_dmcache;
|
||||
if (i == -1 || i >= mesh->totface_legacy) {
|
||||
|
|
@ -3817,8 +3818,8 @@ static void psys_face_mat(Object *ob, Mesh *mesh, ParticleData *pa, float mat[4]
|
|||
const OrigSpaceFace *osface = static_cast<const OrigSpaceFace *>(
|
||||
CustomData_get_for_write(&mesh->fdata_legacy, i, CD_ORIGSPACE, mesh->totface_legacy));
|
||||
|
||||
if (orco &&
|
||||
(orcodata = static_cast<const float(*)[3]>(CustomData_get_layer(&mesh->vert_data, CD_ORCO))))
|
||||
if (orco && (orcodata = static_cast<const float (*)[3]>(
|
||||
CustomData_get_layer(&mesh->vert_data, CD_ORCO))))
|
||||
{
|
||||
copy_v3_v3(v[0], orcodata[mface->v1]);
|
||||
copy_v3_v3(v[1], orcodata[mface->v2]);
|
||||
|
|
|
|||
|
|
@ -370,9 +370,9 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
|
|||
jit2 = MEM_malloc_arrayN<float>(3 + 2 * size_t(num), "initjit");
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
BLI_jitterate1((float(*)[2])jit, (float(*)[2])jit2, num, rad1);
|
||||
BLI_jitterate1((float(*)[2])jit, (float(*)[2])jit2, num, rad1);
|
||||
BLI_jitterate2((float(*)[2])jit, (float(*)[2])jit2, num, rad2);
|
||||
BLI_jitterate1((float (*)[2])jit, (float (*)[2])jit2, num, rad1);
|
||||
BLI_jitterate1((float (*)[2])jit, (float (*)[2])jit2, num, rad1);
|
||||
BLI_jitterate2((float (*)[2])jit, (float (*)[2])jit2, num, rad2);
|
||||
}
|
||||
MEM_freeN(jit2);
|
||||
BLI_rng_free(rng);
|
||||
|
|
@ -617,8 +617,8 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa,
|
|||
tot = mesh->totface_legacy;
|
||||
|
||||
psys_interpolate_face(mesh,
|
||||
reinterpret_cast<const float(*)[3]>(positions.data()),
|
||||
reinterpret_cast<const float(*)[3]>(mesh->vert_normals().data()),
|
||||
reinterpret_cast<const float (*)[3]>(positions.data()),
|
||||
reinterpret_cast<const float (*)[3]>(mesh->vert_normals().data()),
|
||||
mface,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
|
@ -1020,7 +1020,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx,
|
|||
|
||||
if (from == PART_FROM_VERT) {
|
||||
const blender::Span<blender::float3> positions = mesh->vert_positions();
|
||||
const float(*orcodata)[3] = static_cast<const float(*)[3]>(
|
||||
const float (*orcodata)[3] = static_cast<const float (*)[3]>(
|
||||
CustomData_get_layer(&mesh->vert_data, CD_ORCO));
|
||||
int totvert = mesh->verts_num;
|
||||
|
||||
|
|
@ -1068,9 +1068,9 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx,
|
|||
/* Calculate weights from face areas */
|
||||
if ((part->flag & PART_EDISTR || children) && from != PART_FROM_VERT) {
|
||||
float totarea = 0.0f, co1[3], co2[3], co3[3], co4[3];
|
||||
const float(*orcodata)[3];
|
||||
const float (*orcodata)[3];
|
||||
|
||||
orcodata = static_cast<const float(*)[3]>(CustomData_get_layer(&mesh->vert_data, CD_ORCO));
|
||||
orcodata = static_cast<const float (*)[3]>(CustomData_get_layer(&mesh->vert_data, CD_ORCO));
|
||||
|
||||
MFace *mfaces = (MFace *)CustomData_get_layer_for_write(
|
||||
&mesh->fdata_legacy, CD_MFACE, mesh->totface_legacy);
|
||||
|
|
|
|||
|
|
@ -1404,10 +1404,7 @@ static void integrate_particle(
|
|||
{
|
||||
#define ZERO_F43 \
|
||||
{ \
|
||||
{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, \
|
||||
{ \
|
||||
0.0f, 0.0f, 0.0f \
|
||||
} \
|
||||
{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} \
|
||||
}
|
||||
|
||||
ParticleKey states[5];
|
||||
|
|
@ -2784,8 +2781,8 @@ void BKE_psys_collision_neartest_cb(void *userdata,
|
|||
ParticleCollision *col = (ParticleCollision *)userdata;
|
||||
ParticleCollisionElement pce;
|
||||
const blender::int3 vert_tri = &col->md->vert_tris[index];
|
||||
float(*x)[3] = col->md->x;
|
||||
float(*v)[3] = col->md->current_v;
|
||||
float (*x)[3] = col->md->x;
|
||||
float (*v)[3] = col->md->current_v;
|
||||
float t = hit->dist / col->original_ray_length;
|
||||
int collision = 0;
|
||||
|
||||
|
|
@ -3508,7 +3505,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
|
|||
sim->scene,
|
||||
sim->ob,
|
||||
psys->hair_in_mesh,
|
||||
reinterpret_cast<float(*)[3]>(psys->hair_out_mesh->vert_positions_for_write().data()));
|
||||
reinterpret_cast<float (*)[3]>(psys->hair_out_mesh->vert_positions_for_write().data()));
|
||||
psys->hair_out_mesh->tag_positions_changed();
|
||||
|
||||
/* restore cloth effector weights */
|
||||
|
|
|
|||
|
|
@ -285,12 +285,12 @@ static rbCollisionShape *rigidbody_get_shape_convexhull_from_mesh(Object *ob,
|
|||
{
|
||||
rbCollisionShape *shape = nullptr;
|
||||
const Mesh *mesh = nullptr;
|
||||
const float(*positions)[3] = nullptr;
|
||||
const float (*positions)[3] = nullptr;
|
||||
int totvert = 0;
|
||||
|
||||
if (ob->type == OB_MESH && ob->data) {
|
||||
mesh = rigidbody_get_mesh(ob);
|
||||
positions = (mesh) ? reinterpret_cast<const float(*)[3]>(mesh->vert_positions().data()) :
|
||||
positions = (mesh) ? reinterpret_cast<const float (*)[3]>(mesh->vert_positions().data()) :
|
||||
nullptr;
|
||||
totvert = (mesh) ? mesh->verts_num : 0;
|
||||
}
|
||||
|
|
@ -600,7 +600,7 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol)
|
|||
const blender::Span<int> corner_verts = mesh->corner_verts();
|
||||
|
||||
if (!positions.is_empty() && !corner_tris.is_empty()) {
|
||||
BKE_mesh_calc_volume(reinterpret_cast<const float(*)[3]>(positions.data()),
|
||||
BKE_mesh_calc_volume(reinterpret_cast<const float (*)[3]>(positions.data()),
|
||||
positions.size(),
|
||||
corner_tris.data(),
|
||||
corner_tris.size(),
|
||||
|
|
@ -673,7 +673,7 @@ void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3])
|
|||
const blender::Span<blender::int3> corner_tris = mesh->corner_tris();
|
||||
|
||||
if (!positions.is_empty() && !corner_tris.is_empty()) {
|
||||
BKE_mesh_calc_volume(reinterpret_cast<const float(*)[3]>(positions.data()),
|
||||
BKE_mesh_calc_volume(reinterpret_cast<const float (*)[3]>(positions.data()),
|
||||
positions.size(),
|
||||
corner_tris.data(),
|
||||
corner_tris.size(),
|
||||
|
|
@ -1675,7 +1675,7 @@ static void rigidbody_update_sim_ob(Depsgraph *depsgraph, Object *ob, RigidBodyO
|
|||
if (rbo->shape == RB_SHAPE_TRIMESH && rbo->flag & RBO_FLAG_USE_DEFORM) {
|
||||
const Mesh *mesh = BKE_object_get_mesh_deform_eval(ob);
|
||||
if (mesh) {
|
||||
const float(*positions)[3] = reinterpret_cast<const float(*)[3]>(
|
||||
const float (*positions)[3] = reinterpret_cast<const float (*)[3]>(
|
||||
mesh->vert_positions().data());
|
||||
int totvert = mesh->verts_num;
|
||||
const std::optional<blender::Bounds<blender::float3>> bounds = BKE_object_boundbox_get(ob);
|
||||
|
|
|
|||
|
|
@ -1417,13 +1417,13 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd,
|
|||
|
||||
if (mesh != nullptr && smd->shrinkType == MOD_SHRINKWRAP_PROJECT) {
|
||||
/* Setup arrays to get vertex positions, normals and deform weights */
|
||||
calc.vert_positions = reinterpret_cast<float(*)[3]>(mesh->vert_positions_for_write().data());
|
||||
calc.vert_positions = reinterpret_cast<float (*)[3]>(mesh->vert_positions_for_write().data());
|
||||
calc.vert_normals = mesh->vert_normals();
|
||||
|
||||
/* Using vertices positions/normals as if a subsurface was applied */
|
||||
if (smd->subsurfLevels) {
|
||||
subdivided_positions = shrinkwrap_calc_subdivided_positions(mesh, smd->subsurfLevels);
|
||||
calc.vert_positions = reinterpret_cast<float(*)[3]>(subdivided_positions.data());
|
||||
calc.vert_positions = reinterpret_cast<float (*)[3]>(subdivided_positions.data());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1477,7 +1477,7 @@ void shrinkwrapParams_deform(const ShrinkwrapParams ¶ms,
|
|||
calc.smd = &smd;
|
||||
calc.ob = &object;
|
||||
calc.numVerts = int(positions.size());
|
||||
calc.vertexCos = reinterpret_cast<float(*)[3]>(positions.data());
|
||||
calc.vertexCos = reinterpret_cast<float (*)[3]>(positions.data());
|
||||
calc.dvert = dvert.is_empty() ? nullptr : dvert.data();
|
||||
calc.vgroup = defgrp_index;
|
||||
calc.invert_vgroup = params.invert_vertex_weights;
|
||||
|
|
@ -1525,7 +1525,7 @@ void BKE_shrinkwrap_mesh_nearest_surface_deform(Depsgraph *depsgraph,
|
|||
src_me,
|
||||
nullptr,
|
||||
-1,
|
||||
reinterpret_cast<float(*)[3]>(src_me->vert_positions_for_write().data()),
|
||||
reinterpret_cast<float (*)[3]>(src_me->vert_positions_for_write().data()),
|
||||
src_me->verts_num);
|
||||
src_me->tag_positions_changed();
|
||||
}
|
||||
|
|
@ -1549,12 +1549,12 @@ void BKE_shrinkwrap_remesh_target_project(Mesh *src_me, Mesh *target_me, Object
|
|||
|
||||
calc.smd = &ssmd;
|
||||
calc.numVerts = src_me->verts_num;
|
||||
calc.vertexCos = reinterpret_cast<float(*)[3]>(src_me->vert_positions_for_write().data());
|
||||
calc.vertexCos = reinterpret_cast<float (*)[3]>(src_me->vert_positions_for_write().data());
|
||||
calc.vert_normals = src_me->vert_normals();
|
||||
calc.vgroup = -1;
|
||||
calc.target = target_me;
|
||||
calc.keepDist = ssmd.keepDist;
|
||||
calc.vert_positions = reinterpret_cast<float(*)[3]>(src_me->vert_positions_for_write().data());
|
||||
calc.vert_positions = reinterpret_cast<float (*)[3]>(src_me->vert_positions_for_write().data());
|
||||
BLI_SPACE_TRANSFORM_SETUP(&calc.local2target, ob_target, ob_target);
|
||||
|
||||
ShrinkwrapTreeData tree;
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
|
|||
hull = max_ff(ob->pd->pdef_sbift, ob->pd->pdef_sboft);
|
||||
|
||||
/* Allocate and copy verts. */
|
||||
pccd_M->vert_positions = static_cast<const float(*)[3]>(MEM_dupallocN(cmd->xnew));
|
||||
pccd_M->vert_positions = static_cast<const float (*)[3]>(MEM_dupallocN(cmd->xnew));
|
||||
/* note that xnew coords are already in global space, */
|
||||
/* determine the ortho BB */
|
||||
for (i = 0; i < pccd_M->mvert_num; i++) {
|
||||
|
|
@ -387,7 +387,7 @@ static void ccd_mesh_update(Object *ob, ccd_Mesh *pccd_M)
|
|||
}
|
||||
pccd_M->vert_positions_prev = pccd_M->vert_positions;
|
||||
/* Allocate and copy verts. */
|
||||
pccd_M->vert_positions = static_cast<const float(*)[3]>(MEM_dupallocN(cmd->xnew));
|
||||
pccd_M->vert_positions = static_cast<const float (*)[3]>(MEM_dupallocN(cmd->xnew));
|
||||
/* note that xnew coords are already in global space, */
|
||||
/* determine the ortho BB */
|
||||
for (i = 0; i < pccd_M->mvert_num; i++) {
|
||||
|
|
@ -754,7 +754,7 @@ static void build_bps_springlist(Object *ob)
|
|||
add_bp_springlist(bp, sb->totspring - b);
|
||||
}
|
||||
} /* For springs. */
|
||||
} /* For bp. */
|
||||
} /* For bp. */
|
||||
}
|
||||
|
||||
static void calculate_collision_balls(Object *ob)
|
||||
|
|
@ -1064,8 +1064,8 @@ static int sb_detect_face_pointCached(const float face_v1[3],
|
|||
{
|
||||
/* only with deflecting set */
|
||||
if (ob->pd && ob->pd->deflect) {
|
||||
const float(*vert_positions)[3] = nullptr;
|
||||
const float(*vert_positions_prev)[3] = nullptr;
|
||||
const float (*vert_positions)[3] = nullptr;
|
||||
const float (*vert_positions_prev)[3] = nullptr;
|
||||
if (ccdm) {
|
||||
vert_positions = ccdm->vert_positions;
|
||||
a = ccdm->mvert_num;
|
||||
|
|
@ -1117,8 +1117,8 @@ static int sb_detect_face_pointCached(const float face_v1[3],
|
|||
}
|
||||
a--;
|
||||
} /* while (a) */
|
||||
} /* if (vert_positions) */
|
||||
} /* if (ob->pd && ob->pd->deflect) */
|
||||
} /* if (vert_positions) */
|
||||
} /* if (ob->pd && ob->pd->deflect) */
|
||||
BLI_ghashIterator_step(ihash);
|
||||
}
|
||||
} /* while () */
|
||||
|
|
@ -1157,8 +1157,8 @@ static int sb_detect_face_collisionCached(const float face_v1[3],
|
|||
{
|
||||
/* only with deflecting set */
|
||||
if (ob->pd && ob->pd->deflect) {
|
||||
const float(*vert_positions)[3] = nullptr;
|
||||
const float(*vert_positions_prev)[3] = nullptr;
|
||||
const float (*vert_positions)[3] = nullptr;
|
||||
const float (*vert_positions_prev)[3] = nullptr;
|
||||
const blender::int3 *vt = nullptr;
|
||||
const CCDF_MinMax *mima = nullptr;
|
||||
|
||||
|
|
@ -1230,7 +1230,7 @@ static int sb_detect_face_collisionCached(const float face_v1[3],
|
|||
mima++;
|
||||
vt++;
|
||||
} /* while a */
|
||||
} /* if (ob->pd && ob->pd->deflect) */
|
||||
} /* if (ob->pd && ob->pd->deflect) */
|
||||
BLI_ghashIterator_step(ihash);
|
||||
}
|
||||
} /* while () */
|
||||
|
|
@ -1338,8 +1338,8 @@ static int sb_detect_edge_collisionCached(const float edge_v1[3],
|
|||
{
|
||||
/* only with deflecting set */
|
||||
if (ob->pd && ob->pd->deflect) {
|
||||
const float(*vert_positions)[3] = nullptr;
|
||||
const float(*vert_positions_prev)[3] = nullptr;
|
||||
const float (*vert_positions)[3] = nullptr;
|
||||
const float (*vert_positions_prev)[3] = nullptr;
|
||||
const blender::int3 *vt = nullptr;
|
||||
const CCDF_MinMax *mima = nullptr;
|
||||
|
||||
|
|
@ -1417,7 +1417,7 @@ static int sb_detect_edge_collisionCached(const float edge_v1[3],
|
|||
mima++;
|
||||
vt++;
|
||||
} /* while a */
|
||||
} /* if (ob->pd && ob->pd->deflect) */
|
||||
} /* if (ob->pd && ob->pd->deflect) */
|
||||
BLI_ghashIterator_step(ihash);
|
||||
}
|
||||
} /* while () */
|
||||
|
|
@ -1640,8 +1640,8 @@ static int sb_detect_vertex_collisionCached(float opco[3],
|
|||
{
|
||||
/* only with deflecting set */
|
||||
if (ob->pd && ob->pd->deflect) {
|
||||
const float(*vert_positions)[3] = nullptr;
|
||||
const float(*vert_positions_prev)[3] = nullptr;
|
||||
const float (*vert_positions)[3] = nullptr;
|
||||
const float (*vert_positions_prev)[3] = nullptr;
|
||||
const blender::int3 *vt = nullptr;
|
||||
const CCDF_MinMax *mima = nullptr;
|
||||
|
||||
|
|
@ -1761,7 +1761,7 @@ static int sb_detect_vertex_collisionCached(float opco[3],
|
|||
mima++;
|
||||
vt++;
|
||||
} /* while a */
|
||||
} /* if (ob->pd && ob->pd->deflect) */
|
||||
} /* if (ob->pd && ob->pd->deflect) */
|
||||
BLI_ghashIterator_step(ihash);
|
||||
}
|
||||
} /* while () */
|
||||
|
|
@ -2160,11 +2160,11 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene,
|
|||
// sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, float forcetime)
|
||||
sb_spring_force(ob, ilast - bb, bs, iks, forcetime);
|
||||
} /* loop springs. */
|
||||
} /* existing spring list. */
|
||||
} /* Any edges. */
|
||||
} /* existing spring list. */
|
||||
} /* Any edges. */
|
||||
/* ---springs */
|
||||
} /* Omit on snap. */
|
||||
} /* Loop all bp's. */
|
||||
} /* Omit on snap. */
|
||||
} /* Loop all bp's. */
|
||||
return 0; /* Done fine. */
|
||||
}
|
||||
|
||||
|
|
@ -3240,8 +3240,8 @@ void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float ls
|
|||
BodyPoint *bp;
|
||||
ReferenceVert *rp;
|
||||
SoftBody *sb = nullptr;
|
||||
float(*opos)[3];
|
||||
float(*rpos)[3];
|
||||
float (*opos)[3];
|
||||
float (*rpos)[3];
|
||||
float com[3], rcom[3];
|
||||
int a;
|
||||
|
||||
|
|
|
|||
|
|
@ -457,8 +457,8 @@ static void studiolight_create_matcap_gputexture(StudioLightImage *sli)
|
|||
const size_t ibuf_pixel_count = IMB_get_pixel_count(ibuf);
|
||||
float *gpu_matcap_3components = MEM_calloc_arrayN<float>(3 * ibuf_pixel_count, __func__);
|
||||
|
||||
const float(*offset4)[4] = (const float(*)[4])ibuf->float_buffer.data;
|
||||
float(*offset3)[3] = (float(*)[3])gpu_matcap_3components;
|
||||
const float (*offset4)[4] = (const float (*)[4])ibuf->float_buffer.data;
|
||||
float (*offset3)[3] = (float (*)[3])gpu_matcap_3components;
|
||||
for (size_t i = 0; i < ibuf_pixel_count; i++, offset4++, offset3++) {
|
||||
copy_v3_v3(*offset3, *offset4);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ static void set_face_varying_data_from_uv_task(void *__restrict userdata,
|
|||
FaceVaryingDataFromUVContext *ctx = static_cast<FaceVaryingDataFromUVContext *>(userdata);
|
||||
opensubdiv::TopologyRefinerImpl *topology_refiner = ctx->topology_refiner;
|
||||
const int layer_index = ctx->layer_index;
|
||||
const float(*mluv)[2] = &ctx->uv_map[ctx->faces[face_index].start()];
|
||||
const float (*mluv)[2] = &ctx->uv_map[ctx->faces[face_index].start()];
|
||||
|
||||
/* TODO(sergey): OpenSubdiv's C-API converter can change winding of
|
||||
* loops of a face, need to watch for that, to prevent wrong UVs assigned.
|
||||
|
|
@ -151,11 +151,11 @@ static void set_face_varying_data_from_uv(Subdiv *subdiv,
|
|||
opensubdiv::TopologyRefinerImpl *topology_refiner = subdiv->topology_refiner;
|
||||
OpenSubdiv_Evaluator *evaluator = subdiv->evaluator;
|
||||
const int num_faces = topology_refiner->base_level().GetNumFaces();
|
||||
const float(*mluv)[2] = uv_map;
|
||||
const float (*mluv)[2] = uv_map;
|
||||
|
||||
const int num_fvar_values = topology_refiner->base_level().GetNumFVarValues(layer_index);
|
||||
/* Use a temporary buffer so we do not upload UVs one at a time to the GPU. */
|
||||
float(*buffer)[2] = MEM_malloc_arrayN<float[2]>(size_t(num_fvar_values), __func__);
|
||||
float (*buffer)[2] = MEM_malloc_arrayN<float[2]>(size_t(num_fvar_values), __func__);
|
||||
|
||||
FaceVaryingDataFromUVContext ctx;
|
||||
ctx.topology_refiner = topology_refiner;
|
||||
|
|
@ -179,9 +179,9 @@ static void set_face_varying_data_from_uv(Subdiv *subdiv,
|
|||
|
||||
static void set_vertex_data_from_orco(Subdiv *subdiv, const Mesh *mesh)
|
||||
{
|
||||
const float(*orco)[3] = static_cast<const float(*)[3]>(
|
||||
const float (*orco)[3] = static_cast<const float (*)[3]>(
|
||||
CustomData_get_layer(&mesh->vert_data, CD_ORCO));
|
||||
const float(*cloth_orco)[3] = static_cast<const float(*)[3]>(
|
||||
const float (*cloth_orco)[3] = static_cast<const float (*)[3]>(
|
||||
CustomData_get_layer(&mesh->vert_data, CD_CLOTH_ORCO));
|
||||
|
||||
if (orco || cloth_orco) {
|
||||
|
|
@ -256,7 +256,7 @@ bool eval_refine_from_mesh(Subdiv *subdiv,
|
|||
/* Set face-varying data to UV maps. */
|
||||
const int num_uv_layers = CustomData_number_of_layers(&mesh->corner_data, CD_PROP_FLOAT2);
|
||||
for (int layer_index = 0; layer_index < num_uv_layers; layer_index++) {
|
||||
const float(*uv_map)[2] = static_cast<const float(*)[2]>(
|
||||
const float (*uv_map)[2] = static_cast<const float (*)[2]>(
|
||||
CustomData_get_layer_n(&mesh->corner_data, CD_PROP_FLOAT2, layer_index));
|
||||
set_face_varying_data_from_uv(subdiv, mesh, uv_map, layer_index);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,9 +116,9 @@ static void subdiv_mesh_ctx_cache_custom_data_layers(SubdivMeshContext *ctx)
|
|||
/* UV layers interpolation. */
|
||||
subdiv_mesh_ctx_cache_uv_layers(ctx);
|
||||
/* Orco interpolation. */
|
||||
ctx->orco = static_cast<float(*)[3]>(
|
||||
ctx->orco = static_cast<float (*)[3]>(
|
||||
CustomData_get_layer_for_write(&subdiv_mesh->vert_data, CD_ORCO, subdiv_mesh->verts_num));
|
||||
ctx->cloth_orco = static_cast<float(*)[3]>(CustomData_get_layer_for_write(
|
||||
ctx->cloth_orco = static_cast<float (*)[3]>(CustomData_get_layer_for_write(
|
||||
&subdiv_mesh->vert_data, CD_CLOTH_ORCO, subdiv_mesh->verts_num));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2823,7 +2823,7 @@ ImBuf *BKE_tracking_get_plane_imbuf(const ImBuf *frame_ibuf,
|
|||
const MovieTrackingPlaneMarker *plane_marker)
|
||||
{
|
||||
/* Alias for corners, allowing shorter access to coordinates. */
|
||||
const float(*corners)[2] = plane_marker->corners;
|
||||
const float (*corners)[2] = plane_marker->corners;
|
||||
|
||||
/* Dimensions of the frame image in pixels. */
|
||||
const int frame_width = frame_ibuf->x;
|
||||
|
|
|
|||
|
|
@ -1301,7 +1301,7 @@ static void tracking_stabilize_frame_interpolation_cb(void *__restrict userdata,
|
|||
static_cast<TrackingStabilizeFrameInterpolationData *>(userdata);
|
||||
ImBuf *ibuf = data->ibuf;
|
||||
ImBuf *tmpibuf = data->tmpibuf;
|
||||
float(*mat)[4] = data->mat;
|
||||
float (*mat)[4] = data->mat;
|
||||
|
||||
float vec[3] = {0.0f, float(y), 0.0f};
|
||||
float rvec[3];
|
||||
|
|
|
|||
|
|
@ -372,8 +372,8 @@ void BKE_volume_grid_wireframe(const Volume *volume,
|
|||
boxes_to_edge_mesh({box}, grid.transform(), verts, edges);
|
||||
}
|
||||
cb(cb_userdata,
|
||||
(float(*)[3])verts.data(),
|
||||
(int(*)[2])edges.data(),
|
||||
(float (*)[3])verts.data(),
|
||||
(int (*)[2])edges.data(),
|
||||
verts.size(),
|
||||
edges.size());
|
||||
}
|
||||
|
|
@ -395,8 +395,8 @@ void BKE_volume_grid_wireframe(const Volume *volume,
|
|||
}
|
||||
|
||||
cb(cb_userdata,
|
||||
(float(*)[3])verts.data(),
|
||||
(int(*)[2])edges.data(),
|
||||
(float (*)[3])verts.data(),
|
||||
(int (*)[2])edges.data(),
|
||||
verts.size(),
|
||||
edges.size());
|
||||
}
|
||||
|
|
@ -453,7 +453,7 @@ void BKE_volume_grid_selection_surface(const Volume * /*volume*/,
|
|||
const float offset_factor = 0.01f;
|
||||
grow_triangles(verts, tris, offset_factor);
|
||||
|
||||
cb(cb_userdata, (float(*)[3])verts.data(), (int(*)[3])tris.data(), verts.size(), tris.size());
|
||||
cb(cb_userdata, (float (*)[3])verts.data(), (int (*)[3])tris.data(), verts.size(), tris.size());
|
||||
#else
|
||||
UNUSED_VARS(volume_grid);
|
||||
cb(cb_userdata, nullptr, nullptr, 0, 0);
|
||||
|
|
|
|||
|
|
@ -850,8 +850,7 @@ template<typename T, typename Fn>
|
|||
#if (defined(__GNUC__) && !defined(__clang__))
|
||||
[[gnu::optimize("O3")]]
|
||||
#endif
|
||||
inline void
|
||||
optimized_foreach_index(const IndexMaskSegment segment, const Fn fn)
|
||||
inline void optimized_foreach_index(const IndexMaskSegment segment, const Fn fn)
|
||||
{
|
||||
BLI_assert(segment.last() < std::numeric_limits<T>::max());
|
||||
if (unique_sorted_indices::non_empty_is_range(segment.base_span())) {
|
||||
|
|
@ -872,10 +871,9 @@ template<typename T, typename Fn>
|
|||
#if (defined(__GNUC__) && !defined(__clang__))
|
||||
[[gnu::optimize("O3")]]
|
||||
#endif
|
||||
inline void
|
||||
optimized_foreach_index_with_pos(const IndexMaskSegment segment,
|
||||
const int64_t segment_pos,
|
||||
const Fn fn)
|
||||
inline void optimized_foreach_index_with_pos(const IndexMaskSegment segment,
|
||||
const int64_t segment_pos,
|
||||
const Fn fn)
|
||||
{
|
||||
BLI_assert(segment.last() < std::numeric_limits<T>::max());
|
||||
BLI_assert(segment.size() + segment_pos < std::numeric_limits<T>::max());
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ template<typename T> struct AngleRadianBase {
|
|||
public:
|
||||
AngleRadianBase() = default;
|
||||
|
||||
AngleRadianBase(const T &radian) : value_(radian){};
|
||||
explicit AngleRadianBase(const T &cos, const T &sin) : value_(math::atan2(sin, cos)){};
|
||||
AngleRadianBase(const T &radian) : value_(radian) {};
|
||||
explicit AngleRadianBase(const T &cos, const T &sin) : value_(math::atan2(sin, cos)) {};
|
||||
|
||||
/** Static functions. */
|
||||
|
||||
|
|
@ -184,9 +184,9 @@ template<typename T> struct AngleCartesianBase {
|
|||
* Create an angle from a radian value.
|
||||
*/
|
||||
explicit AngleCartesianBase(const T &radian)
|
||||
: AngleCartesianBase(math::cos(radian), math::sin(radian)){};
|
||||
: AngleCartesianBase(math::cos(radian), math::sin(radian)) {};
|
||||
explicit AngleCartesianBase(const AngleRadianBase<T> &angle)
|
||||
: AngleCartesianBase(math::cos(angle.radian()), math::sin(angle.radian())){};
|
||||
: AngleCartesianBase(math::cos(angle.radian()), math::sin(angle.radian())) {};
|
||||
|
||||
/** Static functions. */
|
||||
|
||||
|
|
@ -385,7 +385,7 @@ template<typename T = float> struct AngleFraction {
|
|||
* fractions.
|
||||
*/
|
||||
AngleFraction(int64_t numerator, int64_t denominator = 1)
|
||||
: numerator_(numerator), denominator_(denominator){};
|
||||
: numerator_(numerator), denominator_(denominator) {};
|
||||
|
||||
public:
|
||||
/** Static functions. */
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Axis {
|
|||
public:
|
||||
Axis() = default;
|
||||
|
||||
constexpr Axis(const Value axis) : axis_(axis){};
|
||||
constexpr Axis(const Value axis) : axis_(axis) {};
|
||||
|
||||
/** Convert an uppercase axis character 'X', 'Y' or 'Z' to an enum value. */
|
||||
constexpr static Axis from_char(char axis_char)
|
||||
|
|
@ -124,8 +124,8 @@ class AxisSigned {
|
|||
public:
|
||||
AxisSigned() = default;
|
||||
|
||||
constexpr AxisSigned(Value axis) : axis_(axis){};
|
||||
constexpr AxisSigned(Axis axis) : axis_(from_int(axis.as_int())){};
|
||||
constexpr AxisSigned(Value axis) : axis_(axis) {};
|
||||
constexpr AxisSigned(Axis axis) : axis_(from_int(axis.as_int())) {};
|
||||
|
||||
/** Allow casting from DNA enums stored as short / int. */
|
||||
constexpr static AxisSigned from_int(int axis_int)
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ template<typename T> struct EulerBase {
|
|||
|
||||
EulerBase() = default;
|
||||
|
||||
EulerBase(const AngleT &x, const AngleT &y, const AngleT &z) : xyz_(x, y, z){};
|
||||
EulerBase(const AngleT &x, const AngleT &y, const AngleT &z) : xyz_(x, y, z) {};
|
||||
|
||||
EulerBase(const VecBase<AngleT, 3> &vec) : xyz_(vec){};
|
||||
EulerBase(const VecBase<AngleT, 3> &vec) : xyz_(vec) {};
|
||||
|
||||
EulerBase(const VecBase<T, 3> &vec) : xyz_(vec.x, vec.y, vec.z){};
|
||||
EulerBase(const VecBase<T, 3> &vec) : xyz_(vec.x, vec.y, vec.z) {};
|
||||
|
||||
public:
|
||||
/** Static functions. */
|
||||
|
|
@ -144,7 +144,7 @@ template<typename T> struct EulerXYZBase : public EulerBase<T> {
|
|||
*/
|
||||
template<typename AngleU> EulerXYZBase(const VecBase<AngleU, 3> &vec) : EulerBase<T>(vec){};
|
||||
|
||||
EulerXYZBase(const AngleT &x, const AngleT &y, const AngleT &z) : EulerBase<T>(x, y, z){};
|
||||
EulerXYZBase(const AngleT &x, const AngleT &y, const AngleT &z) : EulerBase<T>(x, y, z) {};
|
||||
|
||||
/**
|
||||
* Create a rotation from an basis axis and an angle.
|
||||
|
|
@ -216,7 +216,7 @@ template<typename T> struct Euler3Base : public EulerBase<T> {
|
|||
Euler3Base &eul_;
|
||||
|
||||
public:
|
||||
explicit Swizzle(Euler3Base &eul) : eul_(eul){};
|
||||
explicit Swizzle(Euler3Base &eul) : eul_(eul) {};
|
||||
|
||||
Euler3Base &operator=(const VecBase<AngleT, 3> &angles)
|
||||
{
|
||||
|
|
@ -250,7 +250,7 @@ template<typename T> struct Euler3Base : public EulerBase<T> {
|
|||
: EulerBase<T>(angles_xyz), order_(order){};
|
||||
|
||||
Euler3Base(const AngleT &x, const AngleT &y, const AngleT &z, EulerOrder order)
|
||||
: EulerBase<T>(x, y, z), order_(order){};
|
||||
: EulerBase<T>(x, y, z), order_(order) {};
|
||||
|
||||
/**
|
||||
* Create a rotation around a single euler axis and an angle.
|
||||
|
|
@ -264,7 +264,7 @@ template<typename T> struct Euler3Base : public EulerBase<T> {
|
|||
* Defines rotation order but not the rotation values.
|
||||
* Used for conversion from other rotation types.
|
||||
*/
|
||||
Euler3Base(EulerOrder order) : order_(order){};
|
||||
Euler3Base(EulerOrder order) : order_(order) {};
|
||||
|
||||
/** Methods. */
|
||||
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ struct MatView : NonCopyable, NonMovable {
|
|||
|
||||
/** Allow wrapping C-style matrices using view. IMPORTANT: Alignment of src needs to match. */
|
||||
explicit MatView(const float (*src)[SrcNumRow])
|
||||
: MatView(*reinterpret_cast<const SrcMatT *>(&src[0][0])){};
|
||||
: MatView(*reinterpret_cast<const SrcMatT *>(&src[0][0])) {};
|
||||
|
||||
/** Array access. */
|
||||
|
||||
|
|
@ -720,11 +720,11 @@ struct MutableMatView
|
|||
public:
|
||||
MutableMatView() = delete;
|
||||
|
||||
MutableMatView(SrcMatT &src) : MatViewT(const_cast<const SrcMatT &>(src)){};
|
||||
MutableMatView(SrcMatT &src) : MatViewT(const_cast<const SrcMatT &>(src)) {};
|
||||
|
||||
/** Allow wrapping C-style matrices using view. IMPORTANT: Alignment of src needs to match. */
|
||||
explicit MutableMatView(float src[SrcNumCol][SrcNumRow])
|
||||
: MutableMatView(*reinterpret_cast<SrcMatT *>(&src[0][0])){};
|
||||
: MutableMatView(*reinterpret_cast<SrcMatT *>(&src[0][0])) {};
|
||||
|
||||
/** Array access. */
|
||||
|
||||
|
|
|
|||
|
|
@ -40,19 +40,19 @@ template<typename T> struct QuaternionBase {
|
|||
QuaternionBase() = default;
|
||||
|
||||
QuaternionBase(const T &new_w, const T &new_x, const T &new_y, const T &new_z)
|
||||
: w(new_w), x(new_x), y(new_y), z(new_z){};
|
||||
: w(new_w), x(new_x), y(new_y), z(new_z) {};
|
||||
|
||||
/**
|
||||
* Creates a quaternion from an vector without reordering the components.
|
||||
* \note Component order must follow the scalar constructor (w, x, y, z).
|
||||
*/
|
||||
explicit QuaternionBase(const VecBase<T, 4> &vec) : QuaternionBase(UNPACK4(vec)){};
|
||||
explicit QuaternionBase(const VecBase<T, 4> &vec) : QuaternionBase(UNPACK4(vec)) {};
|
||||
|
||||
/**
|
||||
* Creates a quaternion from real (w) and imaginary parts (x, y, z).
|
||||
*/
|
||||
QuaternionBase(const T &real, const VecBase<T, 3> &imaginary)
|
||||
: QuaternionBase(real, UNPACK3(imaginary)){};
|
||||
: QuaternionBase(real, UNPACK3(imaginary)) {};
|
||||
|
||||
/** Static functions. */
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ struct Heap {
|
|||
/** \name Internal Functions
|
||||
* \{ */
|
||||
|
||||
#define HEAP_PARENT(i) (((i)-1) >> 1)
|
||||
#define HEAP_PARENT(i) (((i) - 1) >> 1)
|
||||
#define HEAP_LEFT(i) (((i) << 1) + 1)
|
||||
#define HEAP_RIGHT(i) (((i) << 1) + 2)
|
||||
#define HEAP_COMPARE(a, b) ((a)->value < (b)->value)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "BLI_strict_flags.h" /* IWYU pragma: keep. Keep last. */
|
||||
|
||||
#define HEAP_PARENT(i) (((i)-1) >> 1)
|
||||
#define HEAP_PARENT(i) (((i) - 1) >> 1)
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name HeapSimple Internal Structs
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ MINLINE axis_t max_axis(axis_t a, axis_t b)
|
|||
static void node_minmax_init(const BVHTree *tree, BVHNode *node)
|
||||
{
|
||||
axis_t axis_iter;
|
||||
float(*bv)[2] = (float(*)[2])node->bv;
|
||||
float (*bv)[2] = (float (*)[2])node->bv;
|
||||
|
||||
for (axis_iter = tree->start_axis; axis_iter != tree->stop_axis; axis_iter++) {
|
||||
bv[axis_iter][0] = FLT_MAX;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ void BLI_memarena_free(MemArena *ma)
|
|||
}
|
||||
|
||||
/** Pad num up by \a amt (must be power of two). */
|
||||
#define PADUP(num, amt) (((num) + ((amt)-1)) & ~((amt)-1))
|
||||
#define PADUP(num, amt) (((num) + ((amt) - 1)) & ~((amt) - 1))
|
||||
|
||||
/** Align alloc'ed memory (needed if `align > 8`). */
|
||||
static void memarena_curbuf_align(MemArena *ma)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ using offset_t = intptr_t;
|
|||
// #define USE_TOTALLOC
|
||||
|
||||
/* pad must be power of two */
|
||||
#define PADUP(num, pad) (((num) + ((pad)-1)) & ~((pad)-1))
|
||||
#define PADUP(num, pad) (((num) + ((pad) - 1)) & ~((pad) - 1))
|
||||
|
||||
struct BLI_memiter_elem {
|
||||
offset_t size;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ struct BLI_mempool {
|
|||
((BLI_freenode *)(CHECK_TYPE_INLINE(chunk, BLI_mempool_chunk *), (void *)((chunk) + 1)))
|
||||
|
||||
#define NODE_STEP_NEXT(node) ((BLI_freenode *)((char *)(node) + esize))
|
||||
#define NODE_STEP_PREV(node) ((BLI_freenode *)((char *)(node)-esize))
|
||||
#define NODE_STEP_PREV(node) ((BLI_freenode *)((char *)(node) - esize))
|
||||
|
||||
/** Extra bytes implicitly used for every chunk alloc. */
|
||||
#define CHUNK_OVERHEAD uint(MEM_SIZE_OVERHEAD + sizeof(BLI_mempool_chunk))
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ struct BChunkList;
|
|||
*/
|
||||
#define USE_HASH_TABLE_KEY_CACHE
|
||||
#ifdef USE_HASH_TABLE_KEY_CACHE
|
||||
# define HASH_TABLE_KEY_UNSET ((hash_key)-1)
|
||||
# define HASH_TABLE_KEY_FALLBACK ((hash_key)-2)
|
||||
# define HASH_TABLE_KEY_UNSET ((hash_key) - 1)
|
||||
# define HASH_TABLE_KEY_FALLBACK ((hash_key) - 2)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ void BLI_bitmap_draw_2d_tri_v2i(
|
|||
/* sort edge-segments on y, then x axis */
|
||||
static int draw_poly_v2i_n__span_y_sort(const void *a_p, const void *b_p, void *verts_p)
|
||||
{
|
||||
const int(*verts)[2] = static_cast<const int(*)[2]>(verts_p);
|
||||
const int (*verts)[2] = static_cast<const int (*)[2]>(verts_p);
|
||||
const int *a = static_cast<const int *>(a_p);
|
||||
const int *b = static_cast<const int *>(b_p);
|
||||
const int *co_a = verts[a[0]];
|
||||
|
|
@ -328,7 +328,7 @@ void BLI_bitmap_draw_2d_poly_v2i_n(const int xmin,
|
|||
/* Originally by Darel Rex Finley, 2007.
|
||||
* Optimized by Campbell Barton, 2016 to track sorted intersections. */
|
||||
|
||||
int(*span_y)[2] = MEM_malloc_arrayN<int[2]>(size_t(verts.size()), __func__);
|
||||
int (*span_y)[2] = MEM_malloc_arrayN<int[2]>(size_t(verts.size()), __func__);
|
||||
int span_y_len = 0;
|
||||
|
||||
for (int i_curr = 0, i_prev = int(verts.size() - 1); i_curr < verts.size(); i_prev = i_curr++) {
|
||||
|
|
|
|||
|
|
@ -796,7 +796,7 @@ float BLI_convexhull_aabb_fit_points_2d(blender::Span<float2> points)
|
|||
int points_hull_num = BLI_convexhull_2d(points, index_map);
|
||||
|
||||
if (points_hull_num > 1) {
|
||||
float(*points_hull)[2] = MEM_malloc_arrayN<float[2]>(size_t(points_hull_num), __func__);
|
||||
float (*points_hull)[2] = MEM_malloc_arrayN<float[2]>(size_t(points_hull_num), __func__);
|
||||
for (int j = 0; j < points_hull_num; j++) {
|
||||
copy_v2_v2(points_hull[j], points[index_map[j]]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -512,7 +512,7 @@ template<typename T> void cdt_draw(const std::string &label, const CDTArrangemen
|
|||
}
|
||||
double scale = view_width / width;
|
||||
|
||||
# define SX(x) (((x)-minx) * scale)
|
||||
# define SX(x) (((x) - minx) * scale)
|
||||
# define SY(y) ((maxy - (y)) * scale)
|
||||
|
||||
std::ofstream f;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void BLI_jitterate2(float (*jit1)[2], float (*jit2)[2], int num, float radius2)
|
|||
|
||||
void BLI_jitter_init(float (*jitarr)[2], int num)
|
||||
{
|
||||
float(*jit2)[2];
|
||||
float (*jit2)[2];
|
||||
float number_fl, number_fl_sqrt;
|
||||
float x, rad1, rad2, rad3;
|
||||
RNG *rng;
|
||||
|
|
|
|||
|
|
@ -55,13 +55,13 @@ struct KDTree {
|
|||
#define KD_NEAR_ALLOC_INC 100 /* alloc increment for collecting nearest */
|
||||
#define KD_FOUND_ALLOC_INC 50 /* alloc increment for collecting nearest */
|
||||
|
||||
#define KD_NODE_UNSET ((uint)-1)
|
||||
#define KD_NODE_UNSET ((uint) - 1)
|
||||
|
||||
/**
|
||||
* When set we know all values are unbalanced,
|
||||
* otherwise clear them when re-balancing: see #62210.
|
||||
*/
|
||||
#define KD_NODE_ROOT_IS_INIT ((uint)-2)
|
||||
#define KD_NODE_ROOT_IS_INIT ((uint) - 2)
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Local Math API
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ bool BLI_lasso_is_point_inside(const Span<int2> mcoords,
|
|||
|
||||
const int pt[2] = {sx, sy};
|
||||
return isect_point_poly_v2_int(
|
||||
pt, reinterpret_cast<const int(*)[2]>(mcoords.data()), uint(mcoords.size()));
|
||||
pt, reinterpret_cast<const int (*)[2]>(mcoords.data()), uint(mcoords.size()));
|
||||
}
|
||||
|
||||
bool BLI_lasso_is_edge_inside(
|
||||
|
|
|
|||
|
|
@ -2313,7 +2313,7 @@ bool isect_tri_tri_v3_ex(const float tri_a[3][3],
|
|||
double isect_dir[3];
|
||||
cross_v3_v3v3_db(isect_dir, plane_a, plane_b);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
const float(*tri)[3] = i == 0 ? tri_a : tri_b;
|
||||
const float (*tri)[3] = i == 0 ? tri_a : tri_b;
|
||||
/* Rearrange the triangle so that the vertex that is alone on one side
|
||||
* of the plane is located at index 1. */
|
||||
int tri_i[3];
|
||||
|
|
|
|||
|
|
@ -2090,7 +2090,7 @@ void add_weighted_dq_dq(DualQuat *dq_sum, const DualQuat *dq, float weight)
|
|||
weight = -weight;
|
||||
}
|
||||
|
||||
copy_m4_m4(wmat, (float(*)[4])dq->scale);
|
||||
copy_m4_m4(wmat, (float (*)[4])dq->scale);
|
||||
mul_m4_fl(wmat, weight);
|
||||
add_m4_m4m4(dq_sum->scale, dq_sum->scale, wmat);
|
||||
dq_sum->scale_weight += weight;
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ struct BBCalcData {
|
|||
const IMesh &im;
|
||||
Array<BoundingBox> *face_bounding_box;
|
||||
|
||||
BBCalcData(const IMesh &im, Array<BoundingBox> *fbb) : im(im), face_bounding_box(fbb){};
|
||||
BBCalcData(const IMesh &im, Array<BoundingBox> *fbb) : im(im), face_bounding_box(fbb) {};
|
||||
};
|
||||
|
||||
static void calc_face_bb_range_func(void *__restrict userdata,
|
||||
|
|
@ -741,7 +741,7 @@ struct BBPadData {
|
|||
Array<BoundingBox> *face_bounding_box;
|
||||
double pad;
|
||||
|
||||
BBPadData(Array<BoundingBox> *fbb, double pad) : face_bounding_box(fbb), pad(pad){};
|
||||
BBPadData(Array<BoundingBox> *fbb, double pad) : face_bounding_box(fbb), pad(pad) {};
|
||||
};
|
||||
|
||||
static void pad_face_bb_range_func(void *__restrict userdata,
|
||||
|
|
@ -1944,7 +1944,7 @@ static Array<Face *> polyfill_triangulate_poly(Face *f, IMeshArena *arena)
|
|||
}
|
||||
/* Project along negative face normal so (x,y) can be used in 2d. */
|
||||
float axis_mat[3][3];
|
||||
float(*projverts)[2];
|
||||
float (*projverts)[2];
|
||||
uint(*tris)[3];
|
||||
const int totfilltri = flen - 2;
|
||||
/* Prepare projected vertices and array to receive triangles in tessellation. */
|
||||
|
|
@ -2846,8 +2846,7 @@ static IMesh remove_degenerate_tris(const IMesh &tm_in)
|
|||
|
||||
IMesh trimesh_self_intersect(const IMesh &tm_in, IMeshArena *arena)
|
||||
{
|
||||
return trimesh_nary_intersect(
|
||||
tm_in, 1, [](int /*t*/) { return 0; }, true, arena);
|
||||
return trimesh_nary_intersect(tm_in, 1, [](int /*t*/) { return 0; }, true, arena);
|
||||
}
|
||||
|
||||
IMesh trimesh_nary_intersect(const IMesh &tm_in,
|
||||
|
|
|
|||
|
|
@ -762,7 +762,7 @@ static const float g_perlin_data_v3[512 + 2][3] = {
|
|||
static float noise3_perlin(const float vec[3])
|
||||
{
|
||||
const char *p = g_perlin_data_ub;
|
||||
const float(*g)[3] = g_perlin_data_v3;
|
||||
const float (*g)[3] = g_perlin_data_v3;
|
||||
int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
|
||||
float rx0, rx1, ry0, ry1, rz0, rz1, sx, sy, sz, a, b, c, d, t, u, v;
|
||||
const float *q;
|
||||
|
|
|
|||
|
|
@ -586,7 +586,7 @@ static void pf_triangulate(PolyFill *pf)
|
|||
static void pf_coord_sign_calc(const PolyFill *pf, PolyIndex *pi)
|
||||
{
|
||||
/* localize */
|
||||
const float(*coords)[2] = pf->coords;
|
||||
const float (*coords)[2] = pf->coords;
|
||||
|
||||
pi->sign = span_tri_v2_sign(coords[pi->prev->index], coords[pi->index], coords[pi->next->index]);
|
||||
}
|
||||
|
|
@ -682,7 +682,7 @@ static bool pf_ear_tip_check(PolyFill *pf, PolyIndex *pi_ear_tip, const eSign si
|
|||
{
|
||||
#ifndef USE_KDTREE
|
||||
/* localize */
|
||||
const float(*coords)[2] = pf->coords;
|
||||
const float (*coords)[2] = pf->coords;
|
||||
PolyIndex *pi_curr;
|
||||
|
||||
const float *v1, *v2, *v3;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue