Skip to content

Commit

Permalink
SceneModel Typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Nov 22, 2023
1 parent b26a405 commit 1eddfd3
Show file tree
Hide file tree
Showing 8 changed files with 1,463 additions and 1,219 deletions.
612 changes: 3 additions & 609 deletions types/viewer/scene/models/PerformanceModel/PerformanceModel.d.ts

Large diffs are not rendered by default.

708 changes: 708 additions & 0 deletions types/viewer/scene/models/SceneModel.d.ts

Large diffs are not rendered by default.

418 changes: 418 additions & 0 deletions types/viewer/scene/models/SceneModelEntity.d.ts

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions types/viewer/scene/models/SceneModelMesh.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import {SceneModelEntity} from "./SceneModelEntity";
import {SceneModelTransform} from "./SceneModelTransform";
import {SceneModelTextureSet} from "./SceneModelTextureSet";
import {SceneModel} from "./SceneModel";

/**
* A mesh within a {@link SceneModel}.
*
* * Created with {@link SceneModel#createMesh}
* * Belongs to exactly one {@link SceneModelEntity}
* * Stored by ID in {@link SceneModel#meshes}
* * Referenced by {@link SceneModelEntity#meshes}
* * Can have a {@link SceneModelTransform} to dynamically scale, rotate and translate it.
*/
export declare class SceneModelMesh {

/**
* The {@link SceneModel} that owns this SceneModelMesh.
*
* @type {SceneModel}
*/
model: SceneModel;

/**
* The {@link SceneModelEntity} that owns this SceneModelMesh.
*
* @type {SceneModelEntity}
*/
object: SceneModelEntity;

/**
* The {@link SceneModelTransform} that transforms this SceneModelMesh.
*
* * This only exists when the SceneModelMesh is instancing its geometry.
* * These are created with {@link SceneModel#createTransform}
* * Each of these is also registered in {@link SceneModel#transforms}.
*
* @type {SceneModelTransform}
*/
transform: SceneModelTransform | null;


/**
* The {@link SceneModelTextureSet} that optionally textures this SceneModelMesh.
*
* * This only exists when the SceneModelMesh has texture.
* * These are created with {@link SceneModel#createTextureSet}
* * Each of these is also registered in {@link SceneModel#textureSets}.
*
* @type {SceneModelTextureSet}
*/
textureSet: SceneModelTextureSet | null;

/**
* Unique ID of this SceneModelMesh.
*
* The SceneModelMesh is registered against this ID in {@link SceneModel#meshes}.
*/
id: string | number;

/**
* The {@link SceneModelEntity} that owns this SceneModelMesh.
*
* @type {SceneModelEntity}
*/
entity: SceneModelEntity;

}
16 changes: 16 additions & 0 deletions types/viewer/scene/models/SceneModelTexture.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* A texture within a {@link SceneModelTextureSet}.
*
* * Created with {@link SceneModel#createTexture}
* * Belongs to many {@link SceneModelTextureSet}s
* * Stored by ID in {@link SceneModel#textures}}
*/
export declare class SceneModelTexture {

/**
* Unique ID of this SceneModelTexture.
*
* The SceneModelTexture is registered against this ID in {@link SceneModel#textures}.
*/
id: string | number;
}
51 changes: 51 additions & 0 deletions types/viewer/scene/models/SceneModelTextureSet.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {SceneModelTexture} from "./SceneModelTexture";


/**
* A texture set within a {@link SceneModel}.
*
* * Created with {@link SceneModel#createTextureSet}
* * Belongs to many {@link SceneModelMesh}es
* * Stored by ID in {@link SceneModel#textureSets}
* * Referenced by {@link SceneModelMesh#textureSet}
*/

export declare class SceneModelTextureSet {

/**
* Unique ID of this SceneModelTextureSet.
*
* The SceneModelTextureSet is registered against this ID in {@link SceneModel#textureSets}.
*/
id: string | number;

/**
* The color texture.
* @type {SceneModelTexture|*}
*/
colorTexture: SceneModelTexture | null;

/**
* The metallic-roughness texture.
* @type {SceneModelTexture|*}
*/
metallicRoughnessTexture: SceneModelTexture | null;

/**
* The normal map texture.
* @type {SceneModelTexture|*}
*/
normalsTexture: SceneModelTexture | null;

/**
* The emissive color texture.
* @type {SceneModelTexture|*}
*/
emissiveTexture: SceneModelTexture | null;

/**
* The ambient occlusion texture.
* @type {SceneModelTexture|*}
*/
occlusionTexture: SceneModelTexture | null;
}
197 changes: 197 additions & 0 deletions types/viewer/scene/models/SceneModelTransform.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
import {SceneModelMesh} from "./SceneModelMesh";

/**
* A dynamically-updatable transform within a {@link SceneModel}.
*
* * Can be composed into hierarchies
* * Shared by multiple {@link SceneModelMesh}es
* * Created with {@link SceneModel#createTransform}
* * Stored by ID in {@link SceneModel#transforms}
* * Referenced by {@link SceneModelMesh#transform}
*/
export declare class SceneModelTransform {

/**
* Unique ID of this SceneModelTransform.
*
* The SceneModelTransform is registered against this ID in {@link SceneModel#transforms}.
*/
id: string | number;

/**
* The optional parent SceneModelTransform.
*
* @type {SceneModelTransform}
*/
get parentTransform(): SceneModelTransform | null;

/**
* The {@link SceneModelMesh}es transformed by this SceneModelTransform.
*
* @returns {[]}
*/
get meshes(): SceneModelMesh[];

/**
* Sets the SceneModelTransform's local translation.
*
* Default value is ````[0,0,0]````.
*
* @type {number[]}
*/
set position(value: number[]);

/**
* Gets the SceneModelTransform's translation.
*
* Default value is ````[0,0,0]````.
*
* @type {number[]}
*/
get position(): number[];

/**
* Sets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
*
* Default value is ````[0,0,0]````.
*
* @type {number[]}
*/
set rotation(value: number[]);

/**
* Gets the SceneModelTransform's rotation, as Euler angles given in degrees, for each of the X, Y and Z axis.
*
* Default value is ````[0,0,0]````.
*
* @type {number[]}
*/
get rotation(): number[];

/**
* Sets the SceneModelTransform's rotation quaternion.
*
* Default value is ````[0,0,0,1]````.
*
* @type {number[]}
*/
set quaternion(value: number[]);

/**
* Gets the SceneModelTransform's rotation quaternion.
*
* Default value is ````[0,0,0,1]````.
*
* @type {number[]}
*/
get quaternion(): number[];

/**
* Sets the SceneModelTransform's scale.
*
* Default value is ````[1,1,1]````.
*
* @type {number[]}
*/
set scale(value: number[]);

/**
* Gets the SceneModelTransform's scale.
*
* Default value is ````[1,1,1]````.
*
* @type {number[]}
*/
get scale(): number[];

/**
* Sets the SceneModelTransform's transform matrix.
*
* Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.
*
* @type {number[]}
*/
set matrix(value: number[]);

/**
* Gets the SceneModelTransform's transform matrix.
*
* Default value is ````[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]````.
*
* @type {number[]}
*/
get matrix(): number[];

/**
* Gets the SceneModelTransform's World matrix.
*
* @property worldMatrix
* @type {number[]}
*/
get worldMatrix(): number[];

/**
* Rotates the SceneModelTransform about the given axis by the given increment.
*
* @param {number[]} axis Local axis about which to rotate.
* @param {number} angle Angle increment in degrees.
*/
rotate(axis: number[], angle: number): void;

/**
* Rotates the SceneModelTransform about the given World-space axis by the given increment.
*
* @param {number[]} axis Local axis about which to rotate.
* @param {number} angle Angle increment in degrees.
*/
rotateOnWorldAxis(axis: number[], angle: number): void;

/**
* Rotates the SceneModelTransform about the local X-axis by the given increment.
*
* @param {number} angle Angle increment in degrees.
*/
rotateX(angle: number): void;

/**
* Rotates the SceneModelTransform about the local Y-axis by the given increment.
*
* @param {number} angle Angle increment in degrees.
*/
rotateY(angle: number): void;

/**
* Rotates the SceneModelTransform about the local Z-axis by the given increment.
*
* @param {number} angle Angle increment in degrees.
*/
rotateZ(angle: number): void;

/**
* Translates the SceneModelTransform along the local axis by the given increment.
*
* @param {number[]} axis Normalized local space 3D vector along which to translate.
*/
translate(axis: number[]): void;

/**
* Translates the SceneModelTransform along the local X-axis by the given increment.
*
* @param {number} distance Distance to translate along the X-axis.
*/
translateX(distance: number): void;

/**
* Translates the SceneModelTransform along the local Y-axis by the given increment.
*
* @param {number} distance Distance to translate along the Y-axis.
*/
translateY(distance: number): void;

/**
* Translates the SceneModelTransform along the local Z-axis by the given increment.
*
* @param {number} distance Distance to translate along the Z-axis.
*/
translateZ(distance: number): void;
}
Loading

0 comments on commit 1eddfd3

Please sign in to comment.