From 74b14413c1ee7896a498e939f1c756ef28e769bf Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Thu, 4 Apr 2024 13:49:55 -0700 Subject: [PATCH] feat: ParticleSystemModel --- models/csharp/UrchinModels.cs | 16 ++++++---------- ...eGroupModel.json => ParticleSystemModel.json} | 2 +- src/vbl_aquarium/models/urchin.py | 15 ++++++--------- 3 files changed, 13 insertions(+), 20 deletions(-) rename models/schemas/urchin/{ParticleGroupModel.json => ParticleSystemModel.json} (55%) diff --git a/models/csharp/UrchinModels.cs b/models/csharp/UrchinModels.cs index a04c1f5..eaadd86 100644 --- a/models/csharp/UrchinModels.cs +++ b/models/csharp/UrchinModels.cs @@ -182,26 +182,22 @@ public MeshModel(string id, string shape, Vector3 position, Color color, Vector3 [Serializable] -public struct ParticleGroupModel +public struct ParticleSystemModel { public string ID; - public Vector3 Scale; public string Shape; public string Material; - public float[] Xs; - public float[] Ys; - public float[] Zs; + public Vector3[] Positions; + public float[] Sizes; public Color[] Colors; - public ParticleGroupModel(string id, Vector3 scale, string shape, string material, float[] xs, float[] ys, float[] zs, Color[] colors) + public ParticleSystemModel(string id, string shape, string material, Vector3[] positions, float[] sizes, Color[] colors) { ID = id; - Scale = scale; Shape = shape; Material = material; - Xs = xs; - Ys = ys; - Zs = zs; + Positions = positions; + Sizes = sizes; Colors = colors; } } diff --git a/models/schemas/urchin/ParticleGroupModel.json b/models/schemas/urchin/ParticleSystemModel.json similarity index 55% rename from models/schemas/urchin/ParticleGroupModel.json rename to models/schemas/urchin/ParticleSystemModel.json index c89c2cb..013809f 100644 --- a/models/schemas/urchin/ParticleGroupModel.json +++ b/models/schemas/urchin/ParticleSystemModel.json @@ -1 +1 @@ -{"$defs": {"Color": {"properties": {"r": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "title": "Color", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"ID": {"title": "Id", "type": "string"}, "Scale": {"$ref": "#/$defs/Vector3"}, "Shape": {"title": "Shape", "type": "string"}, "Material": {"title": "Material", "type": "string"}, "Xs": {"items": {"type": "number"}, "title": "Xs", "type": "array"}, "Ys": {"items": {"type": "number"}, "title": "Ys", "type": "array"}, "Zs": {"items": {"type": "number"}, "title": "Zs", "type": "array"}, "Colors": {"items": {"$ref": "#/$defs/Color"}, "title": "Colors", "type": "array"}}, "required": ["ID", "Scale", "Shape", "Material", "Xs", "Ys", "Zs", "Colors"], "title": "ParticleGroupModel", "type": "object"} \ No newline at end of file +{"$defs": {"Color": {"properties": {"r": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "title": "Color", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"ID": {"title": "Id", "type": "string"}, "Shape": {"title": "Shape", "type": "string"}, "Material": {"title": "Material", "type": "string"}, "Positions": {"items": {"$ref": "#/$defs/Vector3"}, "title": "Positions", "type": "array"}, "Sizes": {"items": {"type": "number"}, "title": "Sizes", "type": "array"}, "Colors": {"items": {"$ref": "#/$defs/Color"}, "title": "Colors", "type": "array"}}, "required": ["ID", "Shape", "Material", "Positions", "Sizes", "Colors"], "title": "ParticleSystemModel", "type": "object"} \ No newline at end of file diff --git a/src/vbl_aquarium/models/urchin.py b/src/vbl_aquarium/models/urchin.py index 7e1af60..765862c 100644 --- a/src/vbl_aquarium/models/urchin.py +++ b/src/vbl_aquarium/models/urchin.py @@ -116,17 +116,14 @@ class ProbeModel(VBLBaseModel): # Particle group -class ParticleGroupModel(VBLBaseModel): +class ParticleSystemModel(VBLBaseModel): id: str = Field(alias="ID") - scale: Vector3 - shape: str - material: str + n: int + material: str = 'circle' - xs: list[float] - ys: list[float] - zs: list[float] - - colors: list[Color] + positions: list[Vector3] = [] + sizes: list[float] = [] + colors: list[Color] = [] # Text