Ran core generator for new objects/properties for mesh.
diff --git a/dev/defs/shapes/text.json b/dev/defs/shapes/text.json index b82a17e..8cbadf1 100644 --- a/dev/defs/shapes/text.json +++ b/dev/defs/shapes/text.json
@@ -1,5 +1,6 @@ { "name": "Text", + "runtime": false, "key": { "int": 110, "string": "text"
diff --git a/dev/defs/shapes/text_run.json b/dev/defs/shapes/text_run.json index 8e97dad..5fb11de 100644 --- a/dev/defs/shapes/text_run.json +++ b/dev/defs/shapes/text_run.json
@@ -1,5 +1,6 @@ { "name": "TextRun", + "runtime": false, "key": { "int": 113, "string": "textrun"
diff --git a/include/rive/generated/core_registry.hpp b/include/rive/generated/core_registry.hpp index 8ea8e18..cef092c 100644 --- a/include/rive/generated/core_registry.hpp +++ b/include/rive/generated/core_registry.hpp
@@ -75,12 +75,15 @@ #include "rive/nested_artboard.hpp" #include "rive/node.hpp" #include "rive/shapes/clipping_shape.hpp" +#include "rive/shapes/contour_mesh_vertex.hpp" #include "rive/shapes/cubic_asymmetric_vertex.hpp" #include "rive/shapes/cubic_detached_vertex.hpp" #include "rive/shapes/cubic_mirrored_vertex.hpp" #include "rive/shapes/cubic_vertex.hpp" #include "rive/shapes/ellipse.hpp" #include "rive/shapes/image.hpp" +#include "rive/shapes/mesh.hpp" +#include "rive/shapes/mesh_vertex.hpp" #include "rive/shapes/paint/fill.hpp" #include "rive/shapes/paint/gradient_stop.hpp" #include "rive/shapes/paint/linear_gradient.hpp" @@ -99,6 +102,7 @@ #include "rive/shapes/star.hpp" #include "rive/shapes/straight_vertex.hpp" #include "rive/shapes/triangle.hpp" +#include "rive/shapes/vertex.hpp" #include "rive/transform_component.hpp" #include "rive/world_transform_component.hpp" namespace rive { @@ -198,14 +202,20 @@ return new TrimPath(); case FillBase::typeKey: return new Fill(); + case MeshVertexBase::typeKey: + return new MeshVertex(); case ShapeBase::typeKey: return new Shape(); case StraightVertexBase::typeKey: return new StraightVertex(); case CubicAsymmetricVertexBase::typeKey: return new CubicAsymmetricVertex(); + case MeshBase::typeKey: + return new Mesh(); case PointsPathBase::typeKey: return new PointsPath(); + case ContourMeshVertexBase::typeKey: + return new ContourMeshVertex(); case RectangleBase::typeKey: return new Rectangle(); case CubicMirroredVertexBase::typeKey: @@ -552,11 +562,17 @@ case TrimPathBase::offsetPropertyKey: object->as<TrimPathBase>()->offset(value); break; - case PathVertexBase::xPropertyKey: - object->as<PathVertexBase>()->x(value); + case VertexBase::xPropertyKey: + object->as<VertexBase>()->x(value); break; - case PathVertexBase::yPropertyKey: - object->as<PathVertexBase>()->y(value); + case VertexBase::yPropertyKey: + object->as<VertexBase>()->y(value); + break; + case MeshVertexBase::uPropertyKey: + object->as<MeshVertexBase>()->u(value); + break; + case MeshVertexBase::vPropertyKey: + object->as<MeshVertexBase>()->v(value); break; case StraightVertexBase::radiusPropertyKey: object->as<StraightVertexBase>()->radius(value); @@ -768,6 +784,9 @@ static void setBytes(Core* object, int propertyKey, std::vector<uint8_t> value) { switch (propertyKey) { + case MeshBase::triangleIndexBytesPropertyKey: + object->as<MeshBase>()->triangleIndexBytes(value); + break; case FileAssetContentsBase::bytesPropertyKey: object->as<FileAssetContentsBase>()->bytes(value); break; @@ -983,10 +1002,14 @@ return object->as<TrimPathBase>()->end(); case TrimPathBase::offsetPropertyKey: return object->as<TrimPathBase>()->offset(); - case PathVertexBase::xPropertyKey: - return object->as<PathVertexBase>()->x(); - case PathVertexBase::yPropertyKey: - return object->as<PathVertexBase>()->y(); + case VertexBase::xPropertyKey: + return object->as<VertexBase>()->x(); + case VertexBase::yPropertyKey: + return object->as<VertexBase>()->y(); + case MeshVertexBase::uPropertyKey: + return object->as<MeshVertexBase>()->u(); + case MeshVertexBase::vPropertyKey: + return object->as<MeshVertexBase>()->v(); case StraightVertexBase::radiusPropertyKey: return object->as<StraightVertexBase>()->radius(); case CubicAsymmetricVertexBase::rotationPropertyKey: @@ -1139,6 +1162,8 @@ } static std::vector<uint8_t> getBytes(Core* object, int propertyKey) { switch (propertyKey) { + case MeshBase::triangleIndexBytesPropertyKey: + return object->as<MeshBase>()->triangleIndexBytes(); case FileAssetContentsBase::bytesPropertyKey: return object->as<FileAssetContentsBase>()->bytes(); } @@ -1242,8 +1267,10 @@ case TrimPathBase::startPropertyKey: case TrimPathBase::endPropertyKey: case TrimPathBase::offsetPropertyKey: - case PathVertexBase::xPropertyKey: - case PathVertexBase::yPropertyKey: + case VertexBase::xPropertyKey: + case VertexBase::yPropertyKey: + case MeshVertexBase::uPropertyKey: + case MeshVertexBase::vPropertyKey: case StraightVertexBase::radiusPropertyKey: case CubicAsymmetricVertexBase::rotationPropertyKey: case CubicAsymmetricVertexBase::inDistancePropertyKey: @@ -1311,6 +1338,7 @@ case SolidColorBase::colorValuePropertyKey: case GradientStopBase::colorValuePropertyKey: return CoreColorType::id; + case MeshBase::triangleIndexBytesPropertyKey: case FileAssetContentsBase::bytesPropertyKey: return CoreBytesType::id; default:
diff --git a/include/rive/generated/shapes/contour_mesh_vertex_base.hpp b/include/rive/generated/shapes/contour_mesh_vertex_base.hpp new file mode 100644 index 0000000..2e5b9a5 --- /dev/null +++ b/include/rive/generated/shapes/contour_mesh_vertex_base.hpp
@@ -0,0 +1,35 @@ +#ifndef _RIVE_CONTOUR_MESH_VERTEX_BASE_HPP_ +#define _RIVE_CONTOUR_MESH_VERTEX_BASE_HPP_ +#include "rive/shapes/mesh_vertex.hpp" +namespace rive { + class ContourMeshVertexBase : public MeshVertex { + protected: + typedef MeshVertex Super; + + public: + static const uint16_t typeKey = 111; + + /// Helper to quickly determine if a core object extends another without + /// RTTI at runtime. + bool isTypeOf(uint16_t typeKey) const override { + switch (typeKey) { + case ContourMeshVertexBase::typeKey: + case MeshVertexBase::typeKey: + case VertexBase::typeKey: + case ContainerComponentBase::typeKey: + case ComponentBase::typeKey: + return true; + default: + return false; + } + } + + uint16_t coreType() const override { return typeKey; } + + Core* clone() const override; + + protected: + }; +} // namespace rive + +#endif \ No newline at end of file
diff --git a/include/rive/generated/shapes/cubic_asymmetric_vertex_base.hpp b/include/rive/generated/shapes/cubic_asymmetric_vertex_base.hpp index 793a509..041a53b 100644 --- a/include/rive/generated/shapes/cubic_asymmetric_vertex_base.hpp +++ b/include/rive/generated/shapes/cubic_asymmetric_vertex_base.hpp
@@ -17,6 +17,7 @@ case CubicAsymmetricVertexBase::typeKey: case CubicVertexBase::typeKey: case PathVertexBase::typeKey: + case VertexBase::typeKey: case ContainerComponentBase::typeKey: case ComponentBase::typeKey: return true;
diff --git a/include/rive/generated/shapes/cubic_detached_vertex_base.hpp b/include/rive/generated/shapes/cubic_detached_vertex_base.hpp index 109eae0..43d3df2 100644 --- a/include/rive/generated/shapes/cubic_detached_vertex_base.hpp +++ b/include/rive/generated/shapes/cubic_detached_vertex_base.hpp
@@ -17,6 +17,7 @@ case CubicDetachedVertexBase::typeKey: case CubicVertexBase::typeKey: case PathVertexBase::typeKey: + case VertexBase::typeKey: case ContainerComponentBase::typeKey: case ComponentBase::typeKey: return true;
diff --git a/include/rive/generated/shapes/cubic_mirrored_vertex_base.hpp b/include/rive/generated/shapes/cubic_mirrored_vertex_base.hpp index 5e614f1..420178a 100644 --- a/include/rive/generated/shapes/cubic_mirrored_vertex_base.hpp +++ b/include/rive/generated/shapes/cubic_mirrored_vertex_base.hpp
@@ -17,6 +17,7 @@ case CubicMirroredVertexBase::typeKey: case CubicVertexBase::typeKey: case PathVertexBase::typeKey: + case VertexBase::typeKey: case ContainerComponentBase::typeKey: case ComponentBase::typeKey: return true;
diff --git a/include/rive/generated/shapes/cubic_vertex_base.hpp b/include/rive/generated/shapes/cubic_vertex_base.hpp index fe02cca..a6a973c 100644 --- a/include/rive/generated/shapes/cubic_vertex_base.hpp +++ b/include/rive/generated/shapes/cubic_vertex_base.hpp
@@ -15,6 +15,7 @@ switch (typeKey) { case CubicVertexBase::typeKey: case PathVertexBase::typeKey: + case VertexBase::typeKey: case ContainerComponentBase::typeKey: case ComponentBase::typeKey: return true;
diff --git a/include/rive/generated/shapes/mesh_base.hpp b/include/rive/generated/shapes/mesh_base.hpp new file mode 100644 index 0000000..5a2aa1e --- /dev/null +++ b/include/rive/generated/shapes/mesh_base.hpp
@@ -0,0 +1,66 @@ +#ifndef _RIVE_MESH_BASE_HPP_ +#define _RIVE_MESH_BASE_HPP_ +#include <vector> +#include "rive/container_component.hpp" +#include "rive/core/field_types/core_bytes_type.hpp" +namespace rive { + class MeshBase : public ContainerComponent { + protected: + typedef ContainerComponent Super; + + public: + static const uint16_t typeKey = 109; + + /// Helper to quickly determine if a core object extends another without + /// RTTI at runtime. + bool isTypeOf(uint16_t typeKey) const override { + switch (typeKey) { + case MeshBase::typeKey: + case ContainerComponentBase::typeKey: + case ComponentBase::typeKey: + return true; + default: + return false; + } + } + + uint16_t coreType() const override { return typeKey; } + + static const uint16_t triangleIndexBytesPropertyKey = 223; + + private: + std::vector<uint8_t> m_TriangleIndexBytes; + + public: + inline const std::vector<uint8_t>& triangleIndexBytes() const { + return m_TriangleIndexBytes; + } + void triangleIndexBytes(std::vector<uint8_t> value) { + if (m_TriangleIndexBytes == value) { + return; + } + m_TriangleIndexBytes = value; + triangleIndexBytesChanged(); + } + + Core* clone() const override; + void copy(const MeshBase& object) { + m_TriangleIndexBytes = object.m_TriangleIndexBytes; + ContainerComponent::copy(object); + } + + bool deserialize(uint16_t propertyKey, BinaryReader& reader) override { + switch (propertyKey) { + case triangleIndexBytesPropertyKey: + m_TriangleIndexBytes = CoreBytesType::deserialize(reader); + return true; + } + return ContainerComponent::deserialize(propertyKey, reader); + } + + protected: + virtual void triangleIndexBytesChanged() {} + }; +} // namespace rive + +#endif \ No newline at end of file
diff --git a/include/rive/generated/shapes/mesh_vertex_base.hpp b/include/rive/generated/shapes/mesh_vertex_base.hpp new file mode 100644 index 0000000..8fffc8e --- /dev/null +++ b/include/rive/generated/shapes/mesh_vertex_base.hpp
@@ -0,0 +1,80 @@ +#ifndef _RIVE_MESH_VERTEX_BASE_HPP_ +#define _RIVE_MESH_VERTEX_BASE_HPP_ +#include "rive/core/field_types/core_double_type.hpp" +#include "rive/shapes/vertex.hpp" +namespace rive { + class MeshVertexBase : public Vertex { + protected: + typedef Vertex Super; + + public: + static const uint16_t typeKey = 108; + + /// Helper to quickly determine if a core object extends another without + /// RTTI at runtime. + bool isTypeOf(uint16_t typeKey) const override { + switch (typeKey) { + case MeshVertexBase::typeKey: + case VertexBase::typeKey: + case ContainerComponentBase::typeKey: + case ComponentBase::typeKey: + return true; + default: + return false; + } + } + + uint16_t coreType() const override { return typeKey; } + + static const uint16_t uPropertyKey = 215; + static const uint16_t vPropertyKey = 216; + + private: + float m_U = 0.0f; + float m_V = 0.0f; + + public: + inline float u() const { return m_U; } + void u(float value) { + if (m_U == value) { + return; + } + m_U = value; + uChanged(); + } + + inline float v() const { return m_V; } + void v(float value) { + if (m_V == value) { + return; + } + m_V = value; + vChanged(); + } + + Core* clone() const override; + void copy(const MeshVertexBase& object) { + m_U = object.m_U; + m_V = object.m_V; + Vertex::copy(object); + } + + bool deserialize(uint16_t propertyKey, BinaryReader& reader) override { + switch (propertyKey) { + case uPropertyKey: + m_U = CoreDoubleType::deserialize(reader); + return true; + case vPropertyKey: + m_V = CoreDoubleType::deserialize(reader); + return true; + } + return Vertex::deserialize(propertyKey, reader); + } + + protected: + virtual void uChanged() {} + virtual void vChanged() {} + }; +} // namespace rive + +#endif \ No newline at end of file
diff --git a/include/rive/generated/shapes/path_vertex_base.hpp b/include/rive/generated/shapes/path_vertex_base.hpp index 6b864af..f5a9e08 100644 --- a/include/rive/generated/shapes/path_vertex_base.hpp +++ b/include/rive/generated/shapes/path_vertex_base.hpp
@@ -1,11 +1,10 @@ #ifndef _RIVE_PATH_VERTEX_BASE_HPP_ #define _RIVE_PATH_VERTEX_BASE_HPP_ -#include "rive/container_component.hpp" -#include "rive/core/field_types/core_double_type.hpp" +#include "rive/shapes/vertex.hpp" namespace rive { - class PathVertexBase : public ContainerComponent { + class PathVertexBase : public Vertex { protected: - typedef ContainerComponent Super; + typedef Vertex Super; public: static const uint16_t typeKey = 14; @@ -15,6 +14,7 @@ bool isTypeOf(uint16_t typeKey) const override { switch (typeKey) { case PathVertexBase::typeKey: + case VertexBase::typeKey: case ContainerComponentBase::typeKey: case ComponentBase::typeKey: return true; @@ -25,53 +25,7 @@ uint16_t coreType() const override { return typeKey; } - static const uint16_t xPropertyKey = 24; - static const uint16_t yPropertyKey = 25; - - private: - float m_X = 0.0f; - float m_Y = 0.0f; - - public: - inline float x() const { return m_X; } - void x(float value) { - if (m_X == value) { - return; - } - m_X = value; - xChanged(); - } - - inline float y() const { return m_Y; } - void y(float value) { - if (m_Y == value) { - return; - } - m_Y = value; - yChanged(); - } - - void copy(const PathVertexBase& object) { - m_X = object.m_X; - m_Y = object.m_Y; - ContainerComponent::copy(object); - } - - bool deserialize(uint16_t propertyKey, BinaryReader& reader) override { - switch (propertyKey) { - case xPropertyKey: - m_X = CoreDoubleType::deserialize(reader); - return true; - case yPropertyKey: - m_Y = CoreDoubleType::deserialize(reader); - return true; - } - return ContainerComponent::deserialize(propertyKey, reader); - } - protected: - virtual void xChanged() {} - virtual void yChanged() {} }; } // namespace rive
diff --git a/include/rive/generated/shapes/straight_vertex_base.hpp b/include/rive/generated/shapes/straight_vertex_base.hpp index ebe1057..3b54c9e 100644 --- a/include/rive/generated/shapes/straight_vertex_base.hpp +++ b/include/rive/generated/shapes/straight_vertex_base.hpp
@@ -16,6 +16,7 @@ switch (typeKey) { case StraightVertexBase::typeKey: case PathVertexBase::typeKey: + case VertexBase::typeKey: case ContainerComponentBase::typeKey: case ComponentBase::typeKey: return true;
diff --git a/include/rive/generated/shapes/vertex_base.hpp b/include/rive/generated/shapes/vertex_base.hpp new file mode 100644 index 0000000..b8beeb6 --- /dev/null +++ b/include/rive/generated/shapes/vertex_base.hpp
@@ -0,0 +1,78 @@ +#ifndef _RIVE_VERTEX_BASE_HPP_ +#define _RIVE_VERTEX_BASE_HPP_ +#include "rive/container_component.hpp" +#include "rive/core/field_types/core_double_type.hpp" +namespace rive { + class VertexBase : public ContainerComponent { + protected: + typedef ContainerComponent Super; + + public: + static const uint16_t typeKey = 107; + + /// Helper to quickly determine if a core object extends another without + /// RTTI at runtime. + bool isTypeOf(uint16_t typeKey) const override { + switch (typeKey) { + case VertexBase::typeKey: + case ContainerComponentBase::typeKey: + case ComponentBase::typeKey: + return true; + default: + return false; + } + } + + uint16_t coreType() const override { return typeKey; } + + static const uint16_t xPropertyKey = 24; + static const uint16_t yPropertyKey = 25; + + private: + float m_X = 0.0f; + float m_Y = 0.0f; + + public: + inline float x() const { return m_X; } + void x(float value) { + if (m_X == value) { + return; + } + m_X = value; + xChanged(); + } + + inline float y() const { return m_Y; } + void y(float value) { + if (m_Y == value) { + return; + } + m_Y = value; + yChanged(); + } + + void copy(const VertexBase& object) { + m_X = object.m_X; + m_Y = object.m_Y; + ContainerComponent::copy(object); + } + + bool deserialize(uint16_t propertyKey, BinaryReader& reader) override { + switch (propertyKey) { + case xPropertyKey: + m_X = CoreDoubleType::deserialize(reader); + return true; + case yPropertyKey: + m_Y = CoreDoubleType::deserialize(reader); + return true; + } + return ContainerComponent::deserialize(propertyKey, reader); + } + + protected: + virtual void xChanged() {} + virtual void yChanged() {} + }; +} // namespace rive + +#endif \ No newline at end of file
diff --git a/include/rive/shapes/contour_mesh_vertex.hpp b/include/rive/shapes/contour_mesh_vertex.hpp new file mode 100644 index 0000000..51d8873 --- /dev/null +++ b/include/rive/shapes/contour_mesh_vertex.hpp
@@ -0,0 +1,11 @@ +#ifndef _RIVE_CONTOUR_MESH_VERTEX_HPP_ +#define _RIVE_CONTOUR_MESH_VERTEX_HPP_ +#include "rive/generated/shapes/contour_mesh_vertex_base.hpp" +#include <stdio.h> +namespace rive { + class ContourMeshVertex : public ContourMeshVertexBase { + public: + }; +} // namespace rive + +#endif \ No newline at end of file
diff --git a/include/rive/shapes/mesh.hpp b/include/rive/shapes/mesh.hpp new file mode 100644 index 0000000..7e38f4f --- /dev/null +++ b/include/rive/shapes/mesh.hpp
@@ -0,0 +1,11 @@ +#ifndef _RIVE_MESH_HPP_ +#define _RIVE_MESH_HPP_ +#include "rive/generated/shapes/mesh_base.hpp" +#include <stdio.h> +namespace rive { + class Mesh : public MeshBase { + public: + }; +} // namespace rive + +#endif \ No newline at end of file
diff --git a/include/rive/shapes/mesh_vertex.hpp b/include/rive/shapes/mesh_vertex.hpp new file mode 100644 index 0000000..bd58ccd --- /dev/null +++ b/include/rive/shapes/mesh_vertex.hpp
@@ -0,0 +1,11 @@ +#ifndef _RIVE_MESH_VERTEX_HPP_ +#define _RIVE_MESH_VERTEX_HPP_ +#include "rive/generated/shapes/mesh_vertex_base.hpp" +#include <stdio.h> +namespace rive { + class MeshVertex : public MeshVertexBase { + public: + }; +} // namespace rive + +#endif \ No newline at end of file
diff --git a/include/rive/shapes/vertex.hpp b/include/rive/shapes/vertex.hpp new file mode 100644 index 0000000..555d170 --- /dev/null +++ b/include/rive/shapes/vertex.hpp
@@ -0,0 +1,11 @@ +#ifndef _RIVE_VERTEX_HPP_ +#define _RIVE_VERTEX_HPP_ +#include "rive/generated/shapes/vertex_base.hpp" +#include <stdio.h> +namespace rive { + class Vertex : public VertexBase { + public: + }; +} // namespace rive + +#endif \ No newline at end of file
diff --git a/src/generated/shapes/contour_mesh_vertex_base.cpp b/src/generated/shapes/contour_mesh_vertex_base.cpp new file mode 100644 index 0000000..a19d016 --- /dev/null +++ b/src/generated/shapes/contour_mesh_vertex_base.cpp
@@ -0,0 +1,10 @@ +#include "rive/generated/shapes/contour_mesh_vertex_base.hpp" +#include "rive/shapes/contour_mesh_vertex.hpp" + +using namespace rive; + +Core* ContourMeshVertexBase::clone() const { + auto cloned = new ContourMeshVertex(); + cloned->copy(*this); + return cloned; +}
diff --git a/src/generated/shapes/mesh_base.cpp b/src/generated/shapes/mesh_base.cpp new file mode 100644 index 0000000..5cae283 --- /dev/null +++ b/src/generated/shapes/mesh_base.cpp
@@ -0,0 +1,10 @@ +#include "rive/generated/shapes/mesh_base.hpp" +#include "rive/shapes/mesh.hpp" + +using namespace rive; + +Core* MeshBase::clone() const { + auto cloned = new Mesh(); + cloned->copy(*this); + return cloned; +}
diff --git a/src/generated/shapes/mesh_vertex_base.cpp b/src/generated/shapes/mesh_vertex_base.cpp new file mode 100644 index 0000000..45171ac --- /dev/null +++ b/src/generated/shapes/mesh_vertex_base.cpp
@@ -0,0 +1,10 @@ +#include "rive/generated/shapes/mesh_vertex_base.hpp" +#include "rive/shapes/mesh_vertex.hpp" + +using namespace rive; + +Core* MeshVertexBase::clone() const { + auto cloned = new MeshVertex(); + cloned->copy(*this); + return cloned; +}