Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_geometry_fields.hh
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||||
| #pragma once | #pragma once | ||||
| /** \file | /** \file | ||||
| * \ingroup bke | * \ingroup bke | ||||
| * | * | ||||
| * Common field utilities and field definitions for geometry components. | * Common field utilities and field definitions for geometry components. | ||||
| */ | */ | ||||
| #include "BKE_geometry_set.hh" | #include "BKE_geometry_set.hh" | ||||
| #include "FN_field.hh" | #include "FN_field.hh" | ||||
| namespace blender::bke { | namespace blender::bke { | ||||
| class TextureFieldContext; | |||||
| class GeometryComponentFieldContext : public fn::FieldContext { | class GeometryComponentFieldContext : public fn::FieldContext { | ||||
| private: | private: | ||||
| const GeometryComponent &component_; | const GeometryComponent &component_; | ||||
| const eAttrDomain domain_; | const eAttrDomain domain_; | ||||
| public: | public: | ||||
| GeometryComponentFieldContext(const GeometryComponent &component, const eAttrDomain domain) | GeometryComponentFieldContext(const GeometryComponent &component, const eAttrDomain domain) | ||||
| : component_(component), domain_(domain) | : component_(component), domain_(domain) | ||||
| Show All 17 Lines | public: | ||||
| GVArray get_varray_for_context(const fn::FieldContext &context, | GVArray get_varray_for_context(const fn::FieldContext &context, | ||||
| IndexMask mask, | IndexMask mask, | ||||
| ResourceScope &scope) const override; | ResourceScope &scope) const override; | ||||
| virtual GVArray get_varray_for_context(const GeometryComponent &component, | virtual GVArray get_varray_for_context(const GeometryComponent &component, | ||||
| eAttrDomain domain, | eAttrDomain domain, | ||||
| IndexMask mask) const = 0; | IndexMask mask) const = 0; | ||||
| virtual GVArray get_varray_for_context(const TextureFieldContext &context) const | |||||
| { | |||||
| return {}; | |||||
| } | |||||
| }; | }; | ||||
| class AttributeFieldInput : public GeometryFieldInput { | class AttributeFieldInput : public GeometryFieldInput { | ||||
| private: | private: | ||||
| std::string name_; | std::string name_; | ||||
| public: | public: | ||||
| AttributeFieldInput(std::string name, const CPPType &type) | AttributeFieldInput(std::string name, const CPPType &type) | ||||
| Show All 12 Lines | public: | ||||
| StringRefNull attribute_name() const | StringRefNull attribute_name() const | ||||
| { | { | ||||
| return name_; | return name_; | ||||
| } | } | ||||
| GVArray get_varray_for_context(const GeometryComponent &component, | GVArray get_varray_for_context(const GeometryComponent &component, | ||||
| eAttrDomain domain, | eAttrDomain domain, | ||||
| IndexMask mask) const override; | IndexMask mask) const override; | ||||
| GVArray get_varray_for_context(const TextureFieldContext &context) const override; | |||||
| std::string socket_inspection_name() const override; | std::string socket_inspection_name() const override; | ||||
| uint64_t hash() const override; | uint64_t hash() const override; | ||||
| bool is_equal_to(const fn::FieldNode &other) const override; | bool is_equal_to(const fn::FieldNode &other) const override; | ||||
| }; | }; | ||||
| class IDAttributeFieldInput : public GeometryFieldInput { | class IDAttributeFieldInput : public GeometryFieldInput { | ||||
| Show All 25 Lines | public: | ||||
| NormalFieldInput() : GeometryFieldInput(CPPType::get<float3>()) | NormalFieldInput() : GeometryFieldInput(CPPType::get<float3>()) | ||||
| { | { | ||||
| category_ = Category::Generated; | category_ = Category::Generated; | ||||
| } | } | ||||
| GVArray get_varray_for_context(const GeometryComponent &component, | GVArray get_varray_for_context(const GeometryComponent &component, | ||||
| const eAttrDomain domain, | const eAttrDomain domain, | ||||
| IndexMask mask) const override; | IndexMask mask) const override; | ||||
| GVArray get_varray_for_context(const TextureFieldContext &context) const override; | |||||
| std::string socket_inspection_name() const override; | std::string socket_inspection_name() const override; | ||||
| uint64_t hash() const override; | uint64_t hash() const override; | ||||
| bool is_equal_to(const fn::FieldNode &other) const override; | bool is_equal_to(const fn::FieldNode &other) const override; | ||||
| }; | }; | ||||
| class AnonymousAttributeFieldInput : public GeometryFieldInput { | class AnonymousAttributeFieldInput : public GeometryFieldInput { | ||||
| ▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines | |||||