From 0b010912092daa98a2e83db1848dd05405f69190 Mon Sep 17 00:00:00 2001 From: Claire Kuang Date: Wed, 22 Oct 2025 10:53:38 +0100 Subject: [PATCH] feat(objects): Adds new camera and view proxy classes (#407) * Adds new camera and view proxy classes * Update ViewProxy.cs --- src/Speckle.Objects/Other/Camera.cs | 32 ++++++++++++++++++++++++++ src/Speckle.Objects/Other/ViewProxy.cs | 27 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/Speckle.Objects/Other/Camera.cs create mode 100644 src/Speckle.Objects/Other/ViewProxy.cs diff --git a/src/Speckle.Objects/Other/Camera.cs b/src/Speckle.Objects/Other/Camera.cs new file mode 100644 index 00000000..fd63e823 --- /dev/null +++ b/src/Speckle.Objects/Other/Camera.cs @@ -0,0 +1,32 @@ +using Speckle.Objects.Geometry; +using Speckle.Sdk.Models; + +namespace Speckle.Objects.Other; + +/// +/// Camera class to represent a camera for a 3D view. +/// +/// Assumes a Z-up, right-handed convention for orientation vectors +[SpeckleType("Objects.Other.Camera")] +public class Camera : Base +{ + /// + /// The location of the camera + /// + public required Point position { get; set; } + + /// + /// The unit up vector of the camera + /// + public required Vector up { get; set; } + + /// + /// The unit forward vector of the camera + /// + public required Vector forward { get; set; } + + /// + /// Indicates whether or not the camera is using orthographic projection. By default, the projection should be perspective. + /// + public bool isOrthographic { get; set; } +} diff --git a/src/Speckle.Objects/Other/ViewProxy.cs b/src/Speckle.Objects/Other/ViewProxy.cs new file mode 100644 index 00000000..aeac1027 --- /dev/null +++ b/src/Speckle.Objects/Other/ViewProxy.cs @@ -0,0 +1,27 @@ +using Speckle.Sdk.Models; +using Speckle.Sdk.Models.Proxies; + +namespace Speckle.Objects.Other; + +/// +/// Proxy for 3D views. +/// +/// The list points to the applicationIds of any atomic objects that are visible in this view. An empty objects list indicates that all objects by default are visible. +[SpeckleType("Objects.Other.ViewProxy")] +public class ViewProxy : Base, IProxyCollection +{ + /// + /// The list of application ids of objects that belong to this view + /// + public required List objects { get; set; } + + /// + /// The camera used for this view + /// + public required Camera value { get; set; } + + /// + /// The name of this view + /// + public required string name { get; set; } +}