28 template<
typename T, BLI_ENABLE_IF(std::is_
integral_v<T>)>
34 const int offset = offsets[index];
35 const int offset_next = offsets[index + 1];
39 namespace curves::nurbs {
360 void ensure_nurbs_basis_cache()
const;
465 return (cyclic && points_num > 1) ? points_num : points_num - 1;
476 return {
v.x,
v.y, 1.0f -
v.x -
v.y};
580 const float3 &handle_prev,
581 const float3 &handle_next,
662 namespace catmull_rom {
741 BasisCache &basis_cache);
819 return this->
runtime->type_counts;
866 return this->
runtime->bezier_evaluated_offsets.as_span().slice(points);
869 inline IndexRange CurvesGeometry::lengths_range_for_curve(
const int curve_index,
870 const bool cyclic)
const
874 const int start = points.
start() + curve_index;
879 const bool cyclic)
const
882 const IndexRange range = this->lengths_range_for_curve(curve_index,
cyclic);
883 return this->
runtime->evaluated_length_cache.as_span().slice(range);
887 const bool cyclic)
const
893 return lengths.
last();
902 namespace curves::bezier {
Low-level operations for curves that cannot be defined in the C++ header yet.
struct CurvesGeometry CurvesGeometry
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint order
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
ATTR_WARN_UNUSED_RESULT const BMVert * v
VArray< T > typed() const
constexpr int64_t one_after_last() const
constexpr int64_t size() const
constexpr int64_t start() const
constexpr const T & last(const int64_t n=0) const
constexpr int64_t size() const
constexpr bool is_empty() const
const Curves & curves_id_orig
CurvesEditHints(const Curves &curves_id_orig)
std::optional< Array< float3 > > positions
std::optional< Array< float3x3 > > deform_mats
Vector< float3 > evaluated_normal_cache
Vector< int > bezier_evaluated_offsets
std::mutex length_cache_mutex
bool position_cache_dirty
std::mutex tangent_cache_mutex
Vector< curves::nurbs::BasisCache > nurbs_basis_cache
Vector< float > evaluated_length_cache
Vector< int > evaluated_offsets_cache
Vector< float3 > evaluated_tangent_cache
std::mutex position_cache_mutex
std::mutex normal_cache_mutex
std::mutex nurbs_basis_cache_mutex
Span< float3 > evaluated_positions_span
Vector< float3 > evaluated_position_cache
bool nurbs_basis_cache_dirty
std::mutex offsets_cache_mutex
std::array< int, CURVE_TYPES_NUM > type_counts
IndexRange evaluated_points_for_curve(int index) const
VArray< int8_t > handle_types_left() const
void remove_attributes_based_on_types()
MutableSpan< float3 > positions_for_write()
void translate(const float3 &translation)
void remove_points(IndexMask points_to_delete)
VArray< float > selection_curve_float() const
VArray< int8_t > normal_mode() const
MutableSpan< int8_t > handle_types_right_for_write()
VArray< int8_t > handle_types_right() const
void ensure_can_interpolate_to_evaluated() const
IndexRange curves_range() const
void update_curve_types()
MutableSpan< int8_t > curve_types_for_write()
MutableSpan< int > resolution_for_write()
const std::array< int, CURVE_TYPES_NUM > & curve_type_counts() const
MutableSpan< float3 > handle_positions_left_for_write()
MutableAttributeAccessor attributes_for_write()
MutableSpan< float3 > handle_positions_right_for_write()
IndexRange points_for_curves(IndexRange curves) const
MutableSpan< int8_t > nurbs_knots_modes_for_write()
Span< float > evaluated_lengths_for_curve(int curve_index, bool cyclic) const
MutableSpan< float > tilt_for_write()
MutableSpan< float > selection_point_float_for_write()
VArray< float > tilt() const
Span< float3 > evaluated_tangents() const
MutableSpan< float > selection_curve_float_for_write()
void tag_normals_changed()
IndexRange evaluated_points_for_curves(IndexRange curves) const
MutableSpan< int8_t > nurbs_orders_for_write()
Span< float > nurbs_weights() const
MutableSpan< float2 > surface_uv_coords_for_write()
IndexRange points_for_curve(int index) const
void ensure_evaluated_offsets() const
Span< float3 > handle_positions_left() const
VArray< int > resolution() const
int evaluated_points_num() const
Span< int > evaluated_offsets() const
Span< int > bezier_evaluated_offsets_for_curve(int curve_index) const
void interpolate_to_evaluated(int curve_index, GSpan src, GMutableSpan dst) const
static const CurvesGeometry & wrap(const ::CurvesGeometry &dna_struct)
IndexRange points_range() const
Span< int > offsets() const
VArray< int8_t > nurbs_knots_modes() const
Span< float3 > evaluated_normals() const
VArray< float > selection_point_float() const
IndexMask indices_for_curve_type(CurveType type, Vector< int64_t > &r_indices) const
void remove_curves(IndexMask curves_to_delete)
static CurvesGeometry & wrap(::CurvesGeometry &dna_struct)
VArray< T > adapt_domain(const VArray< T > &varray, eAttrDomain from, eAttrDomain to) const
Span< float3 > positions() const
bool has_curve_with_type(CurveType type) const
MutableSpan< float > nurbs_weights_for_write()
void tag_topology_changed()
void resize(int points_num, int curves_num)
Span< float3 > handle_positions_right() const
MutableSpan< int8_t > normal_mode_for_write()
void tag_positions_changed()
void fill_curve_types(CurveType type)
AttributeAccessor attributes() const
float evaluated_length_total_for_curve(int curve_index, bool cyclic) const
void reverse_curves(IndexMask curves_to_reverse)
bool is_single_type(CurveType type) const
MutableSpan< int > offsets_for_write()
bool bounds_min_max(float3 &min, float3 &max) const
Span< float2 > surface_uv_coords() const
GVArray adapt_domain(const GVArray &varray, eAttrDomain from, eAttrDomain to) const
void transform(const float4x4 &matrix)
void ensure_evaluated_lengths() const
Span< float3 > evaluated_positions() const
VArray< int8_t > curve_types() const
VArray< bool > cyclic() const
CurvesGeometry & operator=(const CurvesGeometry &other)
void calculate_bezier_auto_handles()
MutableSpan< bool > cyclic_for_write()
VArray< int8_t > nurbs_orders() const
MutableSpan< int8_t > handle_types_left_for_write()
SyclQueue void void * src
static bool is_cyclic(const Nurb *nu)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
Insertion insert(const float3 &point_prev, const float3 &handle_prev, const float3 &handle_next, const float3 &point_next, float parameter)
bool segment_is_vector(const HandleType left, const HandleType right)
bool point_is_sharp(Span< int8_t > handle_types_left, Span< int8_t > handle_types_right, int index)
void calculate_auto_handles(bool cyclic, Span< int8_t > types_left, Span< int8_t > types_right, Span< float3 > positions, MutableSpan< float3 > positions_left, MutableSpan< float3 > positions_right)
void calculate_evaluated_offsets(Span< int8_t > handle_types_left, Span< int8_t > handle_types_right, bool cyclic, int resolution, MutableSpan< int > evaluated_offsets)
float3 calculate_vector_handle(const float3 &point, const float3 &next_point)
void evaluate_segment(const float3 &point_0, const float3 &point_1, const float3 &point_2, const float3 &point_3, MutableSpan< float3 > result)
bool last_cyclic_segment_is_vector(Span< int8_t > handle_types_left, Span< int8_t > handle_types_right)
void calculate_evaluated_positions(Span< float3 > positions, Span< float3 > handles_left, Span< float3 > handles_right, Span< int > evaluated_offsets, MutableSpan< float3 > evaluated_positions)
void set_handle_position(const float3 &position, HandleType type, HandleType type_other, const float3 &new_handle, float3 &handle, float3 &handle_other)
void interpolate_to_evaluated(GSpan src, Span< int > evaluated_offsets, GMutableSpan dst)
int calculate_evaluated_num(int points_num, bool cyclic, int resolution)
void interpolate_to_evaluated(GSpan src, bool cyclic, int resolution, GMutableSpan dst)
int calculate_evaluated_num(int points_num, int8_t order, bool cyclic, int resolution, KnotsMode knots_mode)
bool check_valid_num_and_order(int points_num, int8_t order, bool cyclic, KnotsMode knots_mode)
void calculate_knots(int points_num, KnotsMode mode, int8_t order, bool cyclic, MutableSpan< float > knots)
void calculate_basis_cache(int points_num, int evaluated_num, int8_t order, bool cyclic, Span< float > knots, BasisCache &basis_cache)
int knots_num(int points_num, int8_t order, bool cyclic)
void interpolate_to_evaluated(const BasisCache &basis_cache, int8_t order, Span< float > control_weights, GSpan src, GMutableSpan dst)
void calculate_normals_z_up(Span< float3 > tangents, MutableSpan< float3 > normals)
void calculate_normals_minimum(Span< float3 > tangents, bool cyclic, MutableSpan< float3 > normals)
void calculate_tangents(Span< float3 > positions, bool is_cyclic, MutableSpan< float3 > tangents)
float3 decode_surface_bary_coord(const float2 &v)
int segments_num(const int points_num, const bool cyclic)
float2 encode_surface_bary_coord(const float3 &v)
void curves_copy_parameters(const Curves &src, Curves &dst)
std::array< int, CURVE_TYPES_NUM > calculate_type_counts(const VArray< int8_t > &types)
constexpr IndexRange offsets_to_range(Span< T > offsets, int64_t index)
Curves * curves_new_nomain_single(int points_num, CurveType type)
Curves * curves_new_nomain(int points_num, int curves_num)
T interpolate(const T &a, const T &b, const FactorT &t)
MutableSpan< float3 > positions
MutableSpan< float3 > tangents
MutableSpan< float3 > normals
CurvesGeometryRuntimeHandle * runtime
Vector< int > start_indices