Bitmap
Extends:
A plane-shaped 3D object containing a bitmap image.
- Creates a 3D quad containing our bitmap, located and oriented using
pos,normalandupvectors. - Registered by Bitmap#id in Scene#bitmaps.
- BCFViewpointsPlugin will save and load Bitmaps in BCF viewpoints.
Usage
In the example below, we'll load the Schependomlaan model, then use
an Bitmap to show a storey plan next to the model.
import {Viewer, Bitmap, XKTLoaderPlugin} from "xeokit-sdk.es.js";
const viewer = new Viewer({
canvasId: "myCanvas",
transparent: true
});
viewer.camera.eye = [-24.65, 21.69, 8.16];
viewer.camera.look = [-14.62, 2.16, -1.38];
viewer.camera.up = [0.59, 0.57, -0.56];
const xktLoader = new XKTLoaderPlugin(viewer);
xktLoader.load({
id: "myModel",
src: "./models/xkt/Schependomlaan.xkt",
edges: true
});
new Bitmap(viewer.scene, {
src: "./images/schependomlaanPlanView.png",
visible: true, // Show the Bitmap
height: 24.0, // Height of Bitmap
pos: [-15, 0, -10], // World-space position of Bitmap's center
normal: [0, -1, 0], // Vector perpendicular to Bitmap
up: [0, 0, 1], // Direction of Bitmap "up"
collidable: false, // Bitmap does not contribute to Scene boundary
clippable: true, // Bitmap can be clipped by SectionPlanes
pickable: true // Allow the ground plane to be picked
});
Constructor Summary
| Public Constructor | ||
| public |
constructor(owner: Component, cfg: *) Creates a new Bitmap. |
|
Member Summary
| Public Members | ||
| public set |
Sets if this |
|
| public get |
Gets if this |
|
| public set |
Sets if this |
|
| public get |
Gets if this |
|
| public set |
Sets the World-space height of the |
|
| public get |
height: * Gets the World-space height of the |
|
| public set |
image: HTMLImageElement Sets an |
|
| public get |
image: HTMLImageElement Gets the Returns null if not set. |
|
| public set |
Sets an image file path that the Accepted file types are PNG and JPEG. Sets Texture#image null. You may also need to set Bitmap#type, if you want to read the image data with Bitmap#imageData. |
|
| public get |
Gets the image file path that the Returns null if not set. |
|
| public get |
Gets the direction of the normal vector that is perpendicular to this |
|
| public set |
Sets the opacity factor for this |
|
| public get |
Gets this This is a factor in range |
|
| public set |
Sets if this |
|
| public get |
Gets if this |
|
| public get |
Gets the World-space position of this |
|
| public set |
Sets an image file path that the If the file extension is a recognized MIME type, also sets Bitmap#type to that MIME type. Accepted file types are PNG and JPEG. |
|
| public get |
Gets the image file path that the Returns null if not set. |
|
| public set |
Sets the MIME type of this Bitmap. |
|
| public get |
Gets the MIME type of this Bitmap. |
|
| public get |
Gets the "up" direction of this |
|
| public set |
Sets if this |
|
| public get |
Gets if this |
|
Method Summary
| Public Methods | ||
| public |
destroy() Destroys this |
|
Inherited Summary
| From class Component | ||
| public get |
The Component that owns the lifecycle of this Component, if any. |
|
| public |
True as soon as this Component has been destroyed |
|
| public |
ID of this Component, unique within the Scene. |
|
| public |
meta: * Arbitrary, user-defined metadata on this component. |
|
| public |
The parent Scene that contains this Component. |
|
| public |
viewer: Viewer The viewer that contains this Scene. |
|
| public |
clear() Destroys all Components that are owned by this. |
|
| public |
destroy() Destroys this component. |
|
| public |
Logs an error for this component to the JavaScript console. |
|
| public |
Fires an event on this component. |
|
| public |
Returns true if there are any subscribers to the given event on this component. |
|
| public |
Tests if this component is of the given type, or is a subclass of the given type. |
|
| public |
Logs a console debugging message for this component. |
|
| public |
Cancels an event subscription that was previously made with Component#on or Component#once. |
|
| public |
Subscribes to an event on this component. |
|
| public |
Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd. |
|
| public |
scheduleTask(task: *) Schedule a task to perform on the next browser interval |
|
| public |
Logs a warning for this component to the JavaScript console. |
|
Public Constructors
public constructor(owner: Component, cfg: *) source
Creates a new Bitmap.
Registers the Bitmap in Scene#bitmaps; causes Scene to fire a "bitmapCreated" event.
Override:
Component#constructorParams:
| Name | Type | Attribute | Description |
| owner | Component |
|
Owner component. When destroyed, the owner will destroy this |
| cfg | * |
|
|
| cfg.id | String |
|
Optional ID, unique among all components in the parent Scene, generated automatically when omitted. |
| cfg.visible | Boolean |
|
Indicates whether or not this |
| cfg.pos | Number[] |
|
World-space position of the |
| cfg.normal | Number[] |
|
Normal vector indicating the direction the |
| cfg.up | Number[] |
|
Direction of "up" for the |
| cfg.height | Number[] |
|
World-space height of the |
| cfg.matrix | Number[] |
|
Modelling transform matrix for the |
| cfg.collidable | Boolean |
|
Indicates if the |
| cfg.clippable | Boolean |
|
Indicates if the |
| cfg.pickable | Boolean |
|
Indicates if the |
| cfg.opacity | Number |
|
|
| cfg.src | String |
|
URL of image. Accepted file types are PNG and JPEG. |
| cfg.image | HTMLImageElement |
|
An |
| cfg.imageData | String |
|
Image data as a base64 encoded string. |
| cfg.type | String |
|
Image MIME type. Accepted values are "jpg" and "png". Default is "jpg". Normally only needed with |
Public Members
public set clippable: Boolean source
Sets if this Bitmap is clippable.
Clipping is done by the SectionPlanes in Scene#sectionPlanes.
Default is true.
public get clippable: Boolean source
Gets if this Bitmap is clippable.
Clipping is done by the SectionPlanes in Scene#sectionPlanes.
Default is true.
public set collidable: Boolean source
Sets if this Bitmap is included in boundary calculations.
Default is true.
public get collidable: Boolean source
Gets if this Bitmap is included in boundary calculations.
Default is true.
public set height(height: Number) source
Sets the World-space height of the Bitmap.
Default value is 1.0.
public get height: * source
Gets the World-space height of the Bitmap.
Returns {Number} World-space height of the Bitmap.
public set image: HTMLImageElement source
Sets an HTMLImageElement to source the image from.
Sets Texture#src null.
You may also need to set Bitmap#type, if you want to read the image data with Bitmap#imageData.
public get image: HTMLImageElement source
Gets the HTMLImageElement the Bitmap's image is sourced from, if set.
Returns null if not set.
public set imageData: String source
Sets an image file path that the Bitmap's image is sourced from.
Accepted file types are PNG and JPEG.
Sets Texture#image null.
You may also need to set Bitmap#type, if you want to read the image data with Bitmap#imageData.
public get imageData: String source
Gets the image file path that the Bitmap's image is sourced from, if set.
Returns null if not set.
public get normal: Number[]: * source
Gets the direction of the normal vector that is perpendicular to this Bitmap.
public set opacity: Number source
Sets the opacity factor for this Bitmap.
This is a factor in range [0..1] which multiplies by the rendered fragment alphas.
public get opacity: Number source
Gets this Bitmap's opacity factor.
This is a factor in range [0..1] which multiplies by the rendered fragment alphas.
public get pos: Number[]: * source
Gets the World-space position of this Bitmap.
Default value is [0, 0, 0].
public set src: String source
Sets an image file path that the Bitmap's image is sourced from.
If the file extension is a recognized MIME type, also sets Bitmap#type to that MIME type.
Accepted file types are PNG and JPEG.
public get src: String source
Gets the image file path that the Bitmap's image is sourced from, if set.
Returns null if not set.
public set type: String source
Sets the MIME type of this Bitmap.
This is used by Bitmap when getting image data with Bitmap#imageData.
Supported values are "jpg" and "png",
Default is "jpg".
Public Methods
public destroy() source
Destroys this Bitmap.
Removes the Bitmap` from Scene#bitmaps; causes Scene to fire a "bitmapDestroyed" event.
Reference
Source

