oktaeder/src/data/Scene.ts

41 lines
801 B
TypeScript
Raw Normal View History

2023-07-26 21:13:16 +00:00
/*!
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Node } from ".";
2023-07-26 21:13:16 +00:00
export interface SceneProps {
readonly name?: string;
readonly nodes?: Node[];
}
export class Scene {
readonly type!: "Scene";
_name: string;
2023-07-26 21:13:16 +00:00
_nodes: Node[];
constructor({
name = "",
nodes = [],
}: SceneProps) {
this._name = name;
this._nodes = nodes;
}
2023-07-30 19:28:48 +00:00
set name(value: string) { this._name = value; }
get name(): string { return this._name; }
2023-07-26 21:13:16 +00:00
}
Object.defineProperty(Scene.prototype, "type", { value: "Scene" });
2023-07-26 21:13:16 +00:00
export function isScene(value: unknown): value is Scene {
return Boolean(value) && (value as Scene).type === "Scene";
}