Skip to content

Commit

Permalink
Add DotBIMLoaderPlugin and cacheBuster property to multiple plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mlankamp committed Jan 13, 2025
1 parent c16c527 commit 536e83a
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 1 deletion.
4 changes: 4 additions & 0 deletions types/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export declare interface ICityJSONDefaultDataSource {
* @param {Function} error Callback fired on error.
*/
getCityJSON(src: string | number, ok: (json: any)=> void, error: (e: Error)=> void): void;

get cacheBuster(): boolean;

set cacheBuster(value: boolean);
}

export declare type CityJSONLoaderPluginConfiguration = {
Expand Down
121 changes: 121 additions & 0 deletions types/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import {IFCObjectDefaults, Plugin, VBOSceneModel, Viewer} from "../../viewer";

export declare interface IDotBIMDefaultDataSource {
/**
* Gets the contents of the given ````.xkt```` file in an arraybuffer.
*
* @param {String|Number} dotBIMSrc Path or ID of an ````.bim```` file.
* @param {Function} ok Callback fired on success, argument is the ````.xkt```` file in an arraybuffer.
* @param {Function} error Callback fired on error.
*/
getDotBIM(dotBIMSrc: string | number, ok: (buffer: ArrayBuffer) => void, error: (e: Error) => void): void;

get cacheBuster(): boolean;

set cacheBuster(value: boolean);
}

export declare type DotBIMLoaderPluginConfiguration = {
/** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
id?: string;
/** Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.*/
objectDefaults?: IFCObjectDefaults;
/** A custom data source through which the XKTLoaderPlugin can load model and metadata files. Defaults to an instance of {@link DotBIMDefaultDataSource}, which loads uover HTTP. */
dataSource?: IDotBIMDefaultDataSource;
};


/**
* @param {Number[]} [params.rotation=[0,0,0]] The model's orientation, as Euler angles given in degrees, for each of the X, Y and Z axis.
* @param {Boolean} [params.backfaces=true] When true, always show backfaces, even on objects for which the .BIM material is single-sided. When false, only show backfaces on geometries whenever the .BIM material is double-sided.
* @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to
* represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
* primitives. Only works while {@link DTX#enabled} is also ````true````.
*/
export declare type LoadDotBIMModel = {
/** ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default. */
id?: string;
/** Path to a .BIM file, as an alternative to the ````bim```` parameter. */
src?: string;
/** .BIM JSON, as an alternative to the ````src```` parameter. */
bim?: any;
/** Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}. */
objectDefaults?: object;
/** When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject.type} values in this list. */
includeTypes?: string[]
/** When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject.type} values in this list. */
excludeTypes?: string[];
/** The double-precision World-space origin of the model's coordinates. */
origin?: number[];
/** The single-precision position, relative to ````origin````. */
position?: number[];
/** The model's scale. */
scale?: number[];
/** The model's orientation, given as Euler angles in degrees, for each of the X, Y and Z axis. */
rotation?: number[];
/** When true, always show backfaces, even on objects for which the .BIM material is single-sided. When false, only show backfaces on geometries whenever the .BIM material is double-sided. */
backfaces?: boolean;
/** When ````true```` (default) use data textures (DTX), where appropriate, to
* represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
* primitives. Only works while {@link DTX#enabled} is also ````true````. */
dtxEnabled?: boolean;
};

export declare class DotBIMLoaderPlugin extends Plugin {
/**
* @constructor
*
* @param {Viewer} viewer The Viewer.
* @param {DotBIMLoaderPluginConfiguration} cfg Plugin configuration.
*/
constructor(viewer: Viewer, cfg?: DotBIMLoaderPluginConfiguration);

/**
* Sets a custom data source through which the DotBIMLoaderPlugin can .BIM files.
*
* Default value is {@link DotBIMDefaultDataSource}, which loads via an XMLHttpRequest.
*
* @type {IXKTDefaultDataSource}
*/
set dataSource(arg: IDotBIMDefaultDataSource);

/**
* Gets the custom data source through which the DotBIMLoaderPlugin can load .BIM files.
*
* Default value is {@link DotBIMDefaultDataSource}, which loads via an XMLHttpRequest.
*
* @type {IXKTDefaultDataSource}
*/
get dataSource(): IDotBIMDefaultDataSource;

/**
* Sets map of initial default states for each loaded {@link Entity} that represents an object.
*
* @type {IFCObjectDefaults}
*/
set objectDefaults(arg: IFCObjectDefaults);

/**
* Gets map of initial default states for each loaded {@link Entity} that represents an object.
*
* @type {IFCObjectDefaults}
*/
get objectDefaults(): IFCObjectDefaults;

/**
* Loads a .BIM model from a file into this DotBIMLoaderPlugin's {@link Viewer}.
*
* @param {LoadBIMModel} params Loading parameters.
* @returns {VBOSceneModel} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
*/

/**
* Loads a .BIM model from a file into this DotBIMLoaderPlugin's {@link Viewer}.
*
* @param {LoadDotBIMModel} params Loading parameters.
* @returns {VBOSceneModel} Entity representing the model, which will have {@link Entity.isModel} set ````true```` and will be registered by {@link Entity.id} in {@link Scene.models}.
*/
load(params: LoadDotBIMModel): VBOSceneModel;
}
1 change: 1 addition & 0 deletions types/plugins/DotBIMLoaderPlugin/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./DotBIMLoaderPlugin";
4 changes: 4 additions & 0 deletions types/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export declare interface IGLTFDefaultDataSource {
* @param {Function} error Fired on error while loading the glTF binary asset.
*/
getArrayBuffer(glTFSrc: string | number, binarySrc: string | number, ok: Function, error: Function): void;

get cacheBuster(): boolean;

set cacheBuster(value: boolean);
}

export declare type GLTFLoaderPluginConfiguration = {
Expand Down
4 changes: 4 additions & 0 deletions types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export declare interface ILASDefaultDataSource {
* @param {Function} error Callback fired on error.
*/
getLAS(src: string | number, ok: (LAS: ArrayBuffer) => void, error: (e: Error) => void): void;

get cacheBuster(): boolean;

set cacheBuster(value: boolean);
}

export declare type LASLoaderPluginConfiguration = {
Expand Down
4 changes: 4 additions & 0 deletions types/plugins/STLLoaderPlugin/STLLoaderPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export declare interface ISTLDefaultDataSource {
* @param {Function} error Fired on error while loading the STL file.
*/
getSTL(src: string | number, ok: Function, error: Function): void;

get cacheBuster(): boolean;

set cacheBuster(value: boolean);
}

export declare type STLLoaderPluginCOnfiguration = {
Expand Down
4 changes: 4 additions & 0 deletions types/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { ModelStats } from "../index";
* @param {Function} error Callback fired on error.
*/
getIFC(src: string | number, ok: (buffer: ArrayBuffer)=> void, error: (e: Error)=> void): void;

get cacheBuster(): boolean;

set cacheBuster(value: boolean);
}

export declare type WebIFCLoaderPluginConfiguration = {
Expand Down
20 changes: 19 additions & 1 deletion types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,28 @@ export declare type LoadXKTModel = {
saoEnabled?: boolean;
/** Indicates if physically-based rendering (PBR) will apply to the model. Only works when {@link Scene.pbrEnabled} is also ````true````. */
pbrEnabled?: boolean;
/** Indicates if base color texture rendering is enabled for the model. Overridden by ````pbrEnabled````. Only works when {@link Scene#colorTextureEnabled} is also ````true````. */
colorTextureEnabled?: boolean;
/** When we set this ````true````, then we force rendering of backfaces for the model. */
backfaces?: boolean;
/** When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). */
excludeUnclassifiedObjects?: boolean;
/** Indicates whether to globalize each {@link Entity.id} and {@link MetaObject.id}, in case you need to prevent ID clashes with other models. */
globalizeObjectIds?: boolean;
/** Indicates whether to enable geometry reuse */
/** Indicates whether to enable geometry reuse (````true```` by default) or whether to expand
* all geometry instances into batches (````false````), and not use instancing to render them. Setting this ````false```` can significantly
* improve Viewer performance for models that have excessive geometry reuse, but may also increases the amount of
* browser and GPU memory used by the model. See [#769](https://github.com/xeokit/xeokit-sdk/issues/769) for more info. */
reuseGeometries?: boolean;
/** When ````true```` (default) use data textures (DTX), where appropriate, to
* represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
* primitives. Only works while {@link DTX#enabled} is also ````true````. */
dtxEnabled?: boolean;
/** Specifies the rendering order for the model. This is used to control the order in which
* SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
* render pass. */
renderOrder?: number;
}

export declare interface IXKTDefaultDataSource {
Expand All @@ -84,6 +98,10 @@ export declare interface IXKTDefaultDataSource {
* @param {Function} error Callback fired on error.
*/
getXKT(src: string | number, ok: (buffer: ArrayBuffer) => void, error: (e: Error) => void): void;

get cacheBuster(): boolean;

set cacheBuster(value: boolean);
}

/**
Expand Down
1 change: 1 addition & 0 deletions types/plugins/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from "./AxisGizmoPlugin";
export * from "./BCFViewpointsPlugin";
export * from "./CityJSONLoaderPlugin";
export * from "./DistanceMeasurementsPlugin";
export * from "./DotBIMLoaderPlugin";
export * from "./FastNavPlugin";
export * from "./GLTFLoaderPlugin";
export * from "./LASLoaderPlugin";
Expand Down

0 comments on commit 536e83a

Please sign in to comment.