@dreamcomposer/engine-types 0.0.28 → 0.0.31-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Layer.d.ts CHANGED
@@ -24,9 +24,11 @@ export interface Layer {
24
24
  /**
25
25
  * The texture of the layer, either a url or a blob.
26
26
  *
27
- * Must be in the PNG format.
27
+ * For non PNG images the file format must be specified:
28
+ * - in the URL itself
29
+ * - via a TextureUrl and TextureUrlCollection object
28
30
  */
29
- texture: string | Blob;
31
+ texture: string | TextureUrl | Blob | TextureBlob;
30
32
  /**
31
33
  * Whether or not the layer is overprinted with the texture.
32
34
  *
@@ -71,10 +73,6 @@ export interface PatternEmbossingConfiguration {
71
73
  * I don't know.
72
74
  */
73
75
  overrides?: TextureOverride<unknown>[];
74
- /**
75
- * Size of the main texture in pixels
76
- */
77
- sizePx: [number, number];
78
76
  /**
79
77
  * The offset of the embossing.
80
78
  */
@@ -85,6 +83,31 @@ export interface PatternEmbossingConfiguration {
85
83
  rotation?: number;
86
84
  }
87
85
 
86
+ export interface TextureUrl {
87
+ /**
88
+ * The public url of the texture
89
+ */
90
+ url: string;
91
+ /**
92
+ * Define the file extension of the texture. (e.g. ".png", ".jpg", ".basis")
93
+ *
94
+ * This is only necessary, if the url does not contain the extension itself
95
+ */
96
+ fileExtension?: string;
97
+ }
98
+ export interface TextureBlob {
99
+ /**
100
+ * The texture itself as an Blob
101
+ */
102
+ blob: Blob;
103
+ /**
104
+ * Define the file extension of the texture (e.g. ".png", ".jpg", ".ktx2")
105
+ *
106
+ * This is only necessary, if the blob is not a common image file (.png, .jpg)
107
+ */
108
+ fileExtension?: string;
109
+ }
110
+
88
111
  export type TextureOverride<T> = Record<
89
112
  string,
90
113
  Partial<T> | Record<string, Partial<T>>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamcomposer/engine-types",
3
- "version": "0.0.28",
3
+ "version": "0.0.31-next.1",
4
4
  "description": "The type definitions for messages from and to the engine",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -17,7 +17,6 @@ import { SetEmbossingHeightTextureMessage } from "./to-engine/SetEmbossingHeight
17
17
  import { SetEnvironmentMessage } from "./to-engine/SetEnvironmentMessage";
18
18
  import { SetEnvironmentVisibleMessage } from "./to-engine/SetEnvironmentVisibleMessage";
19
19
  import { SetFullscreenMessage } from "./to-engine/SetFullscreenMessage";
20
- import { SetGeometryBlobMessage } from "./to-engine/SetGeometryBlobMessage";
21
20
  import { SetGeometryMessage } from "./to-engine/SetGeometryMessage";
22
21
  import { SetGridVisibilityMessage } from "./to-engine/SetGridVisibilityMessage";
23
22
  import { SetHardwareScalingLevelMessage } from "./to-engine/SetHardwareScalingLevelMessage";
@@ -29,7 +28,6 @@ import { SetSurfaceMaterialMessage } from "./to-engine/SetSurfaceMaterialMessage
29
28
  import { ToggleFullscreenMessage } from "./to-engine/ToggleFullscreenMessage";
30
29
  import { ToggleInspectorMessage } from "./to-engine/ToggleInspectorMessage";
31
30
  import { UnhighlightLayerMessage } from "./to-engine/UnhighlightLayerMessage";
32
- import { SetGeometryUrlMessage } from "./to-engine/SetGeometryUrlMessage";
33
31
  import { ToggleVrMessage } from "./to-engine/ToggleVrMessage";
34
32
  import { PointerEventMessage } from "./from-engine/PointerEventMessage";
35
33
  import { HideGuiMessage } from "./from-engine/HideGuiMessage";
@@ -87,9 +85,7 @@ export type ToEnginePostMessage =
87
85
  | SetEnvironmentMessage
88
86
  | SetEnvironmentVisibleMessage
89
87
  | SetFullscreenMessage
90
- | SetGeometryBlobMessage
91
88
  | SetGeometryMessage
92
- | SetGeometryUrlMessage
93
89
  | SetGridVisibilityMessage
94
90
  | SetHardwareScalingLevelMessage
95
91
  | SetLayersMessage
@@ -6,73 +6,80 @@ import { ToEngineMessage } from "../post-messages";
6
6
  export interface SetGeometryMessage extends ToEngineMessage<"set-geometry"> {
7
7
  payload: {
8
8
  /**
9
- * Sets the default scale of the geometry.
9
+ * The BLOB or URL of the geometry (i.e., the 3D model, for example a box or a
10
+ * bottle) in the GLTF/GLB format.
10
11
  */
11
- defaultScale: [number, number, number];
12
- /**
13
- * Whether or not the geometry should automatically scale with the mappings
14
- * defined by the SetStageMappingsMessage.
15
- *
16
- * When `true`, the `axes` field of the stages should be set.
17
- */
18
- scaleWithMapping: boolean;
19
- /**
20
- * Whether or not the cutout texture from SetCutoutTextureMessage should be
21
- * used.
22
- */
23
- useCutoutTexture?: boolean;
24
- /**
25
- * A list with stages.
26
- *
27
- * A stage is an area on the geometry that a texture can be drawn on.
28
- */
29
- stages: {
12
+ model: string | Blob;
13
+ config: {
30
14
  /**
31
- * The name of the stage is the key.
15
+ * Sets the default scale of the geometry.
32
16
  */
33
- [stageName: string]: {
34
- /**
35
- * The display name of the stage. Does not need to match the name of the
36
- * key.
37
- */
38
- // TODO: Maybe better call it displayName to make this distinction clear?
39
- name: string;
40
- /**
41
- * The normal vector of the stage. This can for example be used to
42
- * automatically rotate the geometry to face this stage.
43
- *
44
- * Example: `[0, 0, 1]`
45
- */
46
- // TODO: Remove.
47
- normalVector: [number, number, number];
48
- /**
49
- * Not neccessary anymore must must still be send.
50
- */
51
- // TODO: Remove
52
- tris: [];
53
- /**
54
- * The UV color of the stage.
55
- *
56
- * The UV color marks the area on the texture that the stage is drawn
57
- * on. The array are normalized RGB colors (i.e., in the range from 0 to
58
- * 1).
59
- *
60
- * Example: `[0.21586, 1, 0.21586]`
61
- */
62
- uvColor: [number, number, number];
17
+ defaultScale: [number, number, number];
18
+ /**
19
+ * Whether or not the geometry should automatically scale with the mappings
20
+ * defined by the SetStageMappingsMessage.
21
+ *
22
+ * When `true`, the `axes` field of the stages should be set.
23
+ */
24
+ scaleWithMapping: boolean;
25
+ /**
26
+ * Whether or not the cutout texture from SetCutoutTextureMessage should be
27
+ * used.
28
+ */
29
+ useCutoutTexture?: boolean;
30
+ /**
31
+ * A list with stages.
32
+ *
33
+ * A stage is an area on the geometry that a texture can be drawn on.
34
+ */
35
+ stages: {
63
36
  /**
64
- * Maps the 2 axes of the 2D stage to the axes of the 3D geometry.
65
- *
66
- * Only relevant when `scaleWithMapping` is `true`.
67
- *
68
- * The number is the number of the axis (i.e., `0` for the x-axis, `1`
69
- * for the y-axis, and `2` for the z-axis).
70
- *
71
- * Example: `[0, 1]` maps the width and height of the stage to the x and
72
- * y-axis of the geometry.
73
- *
37
+ * The name of the stage is the key.
74
38
  */
75
- axes?: [number, number];
39
+ [stageName: string]: {
40
+ /**
41
+ * The display name of the stage. Does not need to match the name of the
42
+ * key.
43
+ */
44
+ // TODO: Maybe better call it displayName to make this distinction clear?
45
+ name: string;
46
+ /**
47
+ * The normal vector of the stage. This can for example be used to
48
+ * automatically rotate the geometry to face this stage.
49
+ *
50
+ * Example: `[0, 0, 1]`
51
+ */
52
+ // TODO: Remove.
53
+ normalVector: [number, number, number];
54
+ /**
55
+ * Not neccessary anymore must must still be send.
56
+ */
57
+ // TODO: Remove
58
+ tris: [];
59
+ /**
60
+ * The UV color of the stage.
61
+ *
62
+ * The UV color marks the area on the texture that the stage is drawn
63
+ * on. The array are normalized RGB colors (i.e., in the range from 0 to
64
+ * 1).
65
+ *
66
+ * Example: `[0.21586, 1, 0.21586]`
67
+ */
68
+ uvColor: [number, number, number];
69
+ /**
70
+ * Maps the 2 axes of the 2D stage to the axes of the 3D geometry.
71
+ *
72
+ * Only relevant when `scaleWithMapping` is `true`.
73
+ *
74
+ * The number is the number of the axis (i.e., `0` for the x-axis, `1`
75
+ * for the y-axis, and `2` for the z-axis).
76
+ *
77
+ * Example: `[0, 1]` maps the width and height of the stage to the x and
78
+ * y-axis of the geometry.
79
+ *
80
+ */
81
+ axes?: [number, number];
82
+ };
76
83
  };
77
84
  };
78
85
  };
@@ -1,13 +0,0 @@
1
- import { ToEngineMessage } from "../post-messages";
2
-
3
- /**
4
- * Set the scene's geometry's model as a blob.
5
- */
6
- export interface SetGeometryBlobMessage
7
- extends ToEngineMessage<"set-geometry-blob"> {
8
- /**
9
- * The data of the geometry (i.e., the 3D model, for example a box or a
10
- * bottle) in the GLTF format.
11
- */
12
- payload: Blob;
13
- }
@@ -1,13 +0,0 @@
1
- import { ToEngineMessage } from "../post-messages";
2
-
3
- /**
4
- * Set the url of the scene's geometry's model.
5
- */
6
- export interface SetGeometryUrlMessage
7
- extends ToEngineMessage<"set-geometry-url"> {
8
- /**
9
- * A url to the geometry (i.e., the 3D model, for example a box or a bottle)
10
- * in the GLTF format.
11
- */
12
- payload: string;
13
- }