feat(web): complete product workflow implementation
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { WebEngineEditCommand } from "./web-engine";
|
||||
import type { MeshPrimitive, WebEngineEditCommand } from "./web-engine";
|
||||
|
||||
type CoreCommand<T extends WebEngineEditCommand["type"]> = Extract<WebEngineEditCommand, { type: T }>;
|
||||
type Vector3 = [number, number, number];
|
||||
@@ -7,6 +7,9 @@ const vector3 = (value: readonly number[]): Vector3 => [value[0] ?? 0, value[1]
|
||||
|
||||
/** Typed constructors used by the workbench for the source-backed scene API. */
|
||||
export const coreSceneCommands = Object.freeze({
|
||||
createPrimitive(primitive: MeshPrimitive, location: readonly number[] = [0, 0, 0], name?: string): CoreCommand<"createPrimitive"> {
|
||||
return { type: "createPrimitive", primitive, location: vector3(location), ...(name ? { name } : {}) };
|
||||
},
|
||||
createCube(location: readonly number[] = [0, 0, 0], name?: string): CoreCommand<"createPrimitive"> {
|
||||
return { type: "createPrimitive", primitive: "CUBE", location: vector3(location), ...(name ? { name } : {}) };
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user