ParticleModel
-
class
cee.pt.ParticleModel() Client-side particle model. Fetches, decodes, caches, and renders time-stepped particle frames via the PtServer REST API (
/api/v1/models).const model = new cee.pt.ParticleModel(); await model.openModel('http://server/api/v1/models/mydata.ptfx'); await model.setFrame(0); model.closeModel();
Constructors
Accessors
Methods
closeModelgetBoundingBoxgetCurrentFrameScalarRangegetDecimationFactorgetDefaultCameraConfiggetOpacitygetParticleColorgetParticleSizegetScalarMappergetUseScalarMappingisOpenopenModelsetActiveScalarFieldsetDecimationFactorsetFramesetOpacitysetParticleColorsetParticleSizesetPreloadFrameCountsetScalarMappersetServerErrorHandlersetUseScalarMapping
Constructors
Accessors
-
ParticleModel.activeScalarField() Return type: string
-
ParticleModel.animation() The animation controller for this model.
Return type: Animation
-
ParticleModel.currentFrameIndex() Return type: number
-
ParticleModel.datasetInfo() Return type: DatasetInfo
-
ParticleModel.frameCount() Return type: number
-
ParticleModel.maxParticleCount() Return type: number
-
ParticleModel.name() Name of the model.
Mainly used for debugging.
Return type: string
-
ParticleModel.name(value) Arguments: - value (
string) – None
Name of the model.
Mainly used for debugging.
Return type: void - value (
-
ParticleModel.scalarFieldNames() Return type: [string]
Methods
closeModel
-
ParticleModel.closeModel() Close the model and release resources. Error handler is preserved.
Return type: void
getBoundingBox
-
ParticleModel.getBoundingBox([options]) Arguments: - options (
ModelBoundingBoxOptions) – optional None
Returns the current
BoundingBox(in world coordinates) of the model.When called without any parameters this method will return the current bounding box of the model, including only visible parts/objects. For models that support it, the full bounding box can may queried by specifying the optional
ModelBoundingBoxOptionsand settingModelBoundingBoxOptions.includeHiddenPartsto true.Return type: BoundingBox - options (
getCurrentFrameScalarRange
-
ParticleModel.getCurrentFrameScalarRange() Per-frame scalar range de-quantized from uint16 via the global range.
Return type: function
getDefaultCameraConfig
-
ParticleModel.getDefaultCameraConfig() Can return an optional default camera configuration for this model.
If a model returns a default camera config, any views displaying the model may utilize the information to do first-time setup of their camera. The camera config will not have any effect on views where the camera has already been set by the user. If multiple models are shown in the same view, the first model with a default camera config will take precedence.
Return type: CameraConfig
getOpacity
-
ParticleModel.getOpacity() Get the opacity of the particles. 0 = fully transparent, 1 = fully opaque.
Return type: number
openModel
-
ParticleModel.openModel(datasetUrl) Arguments: - datasetUrl (
string) – None
Open a particle dataset from a URL.
Return type: Promise <DatasetInfo> - datasetUrl (
setActiveScalarField
-
ParticleModel.setActiveScalarField(fieldName) Arguments: - fieldName (
string) – None
Switch active scalar field on the server. Invalidates cache and reloads current frame.
Return type: Promise <void> - fieldName (
setDecimationFactor
-
ParticleModel.setDecimationFactor(factor) Arguments: - factor (
number) – None
Set server-side decimation factor [0.01, 1.0]. Invalidates cache and reloads current frame.
Return type: void - factor (
setFrame
-
ParticleModel.setFrame(frameIndex) Arguments: - frameIndex (
number) – 0-based index in[0, frameCount)
Load and display a frame. Cancels any previous inflight request.
Return type: Promise <void> - frameIndex (
setOpacity
-
ParticleModel.setOpacity(opacity) Arguments: - opacity (
number) – None
Set the opacity of the particles (clamped to [0, 1]).
Return type: void - opacity (
setParticleColor
-
ParticleModel.setParticleColor(color) Arguments: - color (
Color3Like) – None
Set solid particle color (used when scalar mapping is off).
Return type: void - color (
setParticleSize
-
ParticleModel.setParticleSize(size) Arguments: - size (
number) – None
Set point size in pixels (clamped to >= 1).
Return type: void - size (
setPreloadFrameCount
-
ParticleModel.setPreloadFrameCount(count) Arguments: - count (
number) – None
Set the number of frames to preload ahead. 0 disables preloading. Takes effect immediately: if the model is open and a frame is loaded, a new preload batch is started from the current frame.
Return type: void - count (
setScalarMapper
-
ParticleModel.setScalarMapper(mapper) Arguments: - mapper (
ScalarMapper) – None
Set scalar mapper for color mapping.
Return type: void - mapper (
setServerErrorHandler
-
ParticleModel.setServerErrorHandler(handler) Arguments: - handler (
ServerErrorHandler) – None
Set error handler. Persists across close/open cycles. Pass
nullto clear.Return type: void - handler (