Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/geometry_component_mesh.cc
| Show First 20 Lines • Show All 938 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| ColorGeometry4b encoded_color = linear_color.encode(); | ColorGeometry4b encoded_color = linear_color.encode(); | ||||
| col.r = encoded_color.r; | col.r = encoded_color.r; | ||||
| col.g = encoded_color.g; | col.g = encoded_color.g; | ||||
| col.b = encoded_color.b; | col.b = encoded_color.b; | ||||
| col.a = encoded_color.a; | col.a = encoded_color.a; | ||||
| } | } | ||||
| static float get_crease(const MEdge &edge) | static float get_edge_crease(const MEdge &edge) | ||||
| { | { | ||||
| return edge.crease / 255.0f; | return edge.crease / 255.0f; | ||||
| } | } | ||||
| static void set_crease(MEdge &edge, float value) | static void set_edge_crease(MEdge &edge, float value) | ||||
| { | { | ||||
| edge.crease = round_fl_to_uchar_clamp(value * 255.0f); | edge.crease = round_fl_to_uchar_clamp(value * 255.0f); | ||||
| } | } | ||||
| class VArrayImpl_For_VertexWeights final : public VMutableArrayImpl<float> { | class VArrayImpl_For_VertexWeights final : public VMutableArrayImpl<float> { | ||||
| private: | private: | ||||
| MDeformVert *dverts_; | MDeformVert *dverts_; | ||||
| const int dvert_index_; | const int dvert_index_; | ||||
| ▲ Show 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | static BuiltinCustomDataLayerProvider shade_smooth( | ||||
| BuiltinAttributeProvider::NonCreatable, | BuiltinAttributeProvider::NonCreatable, | ||||
| BuiltinAttributeProvider::Writable, | BuiltinAttributeProvider::Writable, | ||||
| BuiltinAttributeProvider::NonDeletable, | BuiltinAttributeProvider::NonDeletable, | ||||
| face_access, | face_access, | ||||
| make_derived_read_attribute<MPoly, bool, get_shade_smooth>, | make_derived_read_attribute<MPoly, bool, get_shade_smooth>, | ||||
| make_derived_write_attribute<MPoly, bool, get_shade_smooth, set_shade_smooth>, | make_derived_write_attribute<MPoly, bool, get_shade_smooth, set_shade_smooth>, | ||||
| nullptr); | nullptr); | ||||
| static BuiltinCustomDataLayerProvider crease( | static BuiltinCustomDataLayerProvider vertex_crease("crease", | ||||
| ATTR_DOMAIN_POINT, | |||||
| CD_PROP_FLOAT, | |||||
| CD_CREASE, | |||||
| BuiltinAttributeProvider::Creatable, | |||||
| BuiltinAttributeProvider::Writable, | |||||
| BuiltinAttributeProvider::Deletable, | |||||
| point_access, | |||||
| make_array_read_attribute<float>, | |||||
| make_array_write_attribute<float>, | |||||
| nullptr); | |||||
| static BuiltinCustomDataLayerProvider edge_crease( | |||||
| "crease", | "crease", | ||||
| ATTR_DOMAIN_EDGE, | ATTR_DOMAIN_EDGE, | ||||
| CD_PROP_FLOAT, | CD_PROP_FLOAT, | ||||
| CD_MEDGE, | CD_MEDGE, | ||||
| BuiltinAttributeProvider::NonCreatable, | BuiltinAttributeProvider::NonCreatable, | ||||
| BuiltinAttributeProvider::Writable, | BuiltinAttributeProvider::Writable, | ||||
| BuiltinAttributeProvider::NonDeletable, | BuiltinAttributeProvider::NonDeletable, | ||||
| edge_access, | edge_access, | ||||
| make_derived_read_attribute<MEdge, float, get_crease>, | make_derived_read_attribute<MEdge, float, get_edge_crease>, | ||||
| make_derived_write_attribute<MEdge, float, get_crease, set_crease>, | make_derived_write_attribute<MEdge, float, get_edge_crease, set_edge_crease>, | ||||
| nullptr); | nullptr); | ||||
| static NamedLegacyCustomDataProvider uvs( | static NamedLegacyCustomDataProvider uvs( | ||||
| ATTR_DOMAIN_CORNER, | ATTR_DOMAIN_CORNER, | ||||
| CD_PROP_FLOAT2, | CD_PROP_FLOAT2, | ||||
| CD_MLOOPUV, | CD_MLOOPUV, | ||||
| corner_access, | corner_access, | ||||
| make_derived_read_attribute<MLoopUV, float2, get_loop_uv>, | make_derived_read_attribute<MLoopUV, float2, get_loop_uv>, | ||||
| Show All 9 Lines | #undef MAKE_MUTABLE_CUSTOM_DATA_GETTER | ||||
| static VertexGroupsAttributeProvider vertex_groups; | static VertexGroupsAttributeProvider vertex_groups; | ||||
| static CustomDataAttributeProvider corner_custom_data(ATTR_DOMAIN_CORNER, corner_access); | static CustomDataAttributeProvider corner_custom_data(ATTR_DOMAIN_CORNER, corner_access); | ||||
| static CustomDataAttributeProvider point_custom_data(ATTR_DOMAIN_POINT, point_access); | static CustomDataAttributeProvider point_custom_data(ATTR_DOMAIN_POINT, point_access); | ||||
| static CustomDataAttributeProvider edge_custom_data(ATTR_DOMAIN_EDGE, edge_access); | static CustomDataAttributeProvider edge_custom_data(ATTR_DOMAIN_EDGE, edge_access); | ||||
| static CustomDataAttributeProvider face_custom_data(ATTR_DOMAIN_FACE, face_access); | static CustomDataAttributeProvider face_custom_data(ATTR_DOMAIN_FACE, face_access); | ||||
| return ComponentAttributeProviders( | return ComponentAttributeProviders( | ||||
| {&position, &id, &material_index, &shade_smooth, &normal, &crease}, | {&position, &id, &material_index, &shade_smooth, &normal, &vertex_crease, &edge_crease}, | ||||
| {&uvs, | {&uvs, | ||||
| &vertex_colors, | &vertex_colors, | ||||
| &corner_custom_data, | &corner_custom_data, | ||||
| &vertex_groups, | &vertex_groups, | ||||
| &point_custom_data, | &point_custom_data, | ||||
| &edge_custom_data, | &edge_custom_data, | ||||
| &face_custom_data}); | &face_custom_data}); | ||||
| } | } | ||||
| Show All 11 Lines | |||||