|
|
|
|
|
|
|
|
import {serialize, timeout} from 'ts-browser-helpers' |
|
|
import {serialize, timeout} from 'ts-browser-helpers' |
|
|
import {AViewerPluginSync} from '../../viewer' |
|
|
import {AViewerPluginSync} from '../../viewer' |
|
|
import {uiButton, uiConfig, uiFolderContainer, uiInput, uiVector} from 'uiconfig.js' |
|
|
|
|
|
|
|
|
import {uiButton, uiConfig, uiFolderContainer, uiInput} from 'uiconfig.js' |
|
|
import {CanvasSnapshot, CanvasSnapshotOptions} from '../../utils/canvas-snapshot' |
|
|
import {CanvasSnapshot, CanvasSnapshotOptions} from '../../utils/canvas-snapshot' |
|
|
import {ProgressivePlugin} from '../pipeline/ProgressivePlugin' |
|
|
import {ProgressivePlugin} from '../pipeline/ProgressivePlugin' |
|
|
import {Zippable, zipSync} from 'three/examples/jsm/libs/fflate.module.js' |
|
|
import {Zippable, zipSync} from 'three/examples/jsm/libs/fflate.module.js' |
|
|
import {Vector4} from 'three' |
|
|
|
|
|
|
|
|
|
|
|
export interface CanvasSnapshotPluginOptions extends CanvasSnapshotOptions{ |
|
|
export interface CanvasSnapshotPluginOptions extends CanvasSnapshotOptions{ |
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
tileColumns?: number |
|
|
tileColumns?: number |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@uiFolderContainer('Canvas Snapshot (Image Export)') |
|
|
|
|
|
|
|
|
@uiFolderContainer('Image Export (Canvas Snapshot)') |
|
|
export class CanvasSnapshotPlugin extends AViewerPluginSync { |
|
|
export class CanvasSnapshotPlugin extends AViewerPluginSync { |
|
|
static readonly PluginType = 'CanvasSnapshotPlugin' |
|
|
static readonly PluginType = 'CanvasSnapshotPlugin' |
|
|
enabled = true |
|
|
enabled = true |
|
|
|
|
|
|
|
|
if (progressive && lastMaxFrames !== undefined) { |
|
|
if (progressive && lastMaxFrames !== undefined) { |
|
|
progressive.maxFrameCount = lastMaxFrames |
|
|
progressive.maxFrameCount = lastMaxFrames |
|
|
} |
|
|
} |
|
|
viewer.scene.mainCamera.setInteractions(true, CanvasSnapshotPlugin.PluginType) |
|
|
|
|
|
|
|
|
viewer.scene.mainCamera.setInteractions(true, CanvasSnapshotPlugin.PluginType, false) |
|
|
viewer.renderManager.renderScale = dpr |
|
|
viewer.renderManager.renderScale = dpr |
|
|
|
|
|
|
|
|
return file |
|
|
return file |
|
|
|
|
|
|
|
|
@serialize() |
|
|
@serialize() |
|
|
filename = 'snapshot' |
|
|
filename = 'snapshot' |
|
|
|
|
|
|
|
|
@uiInput('Frame Count') |
|
|
|
|
|
@serialize() |
|
|
|
|
|
progressiveFrames = 64 |
|
|
|
|
|
|
|
|
|
|
|
@uiInput('Tile Rows') |
|
|
|
|
|
@serialize() |
|
|
|
|
|
tileRows = 1 |
|
|
|
|
|
|
|
|
|
|
|
@uiInput('Tile Columns') |
|
|
|
|
|
@serialize() |
|
|
|
|
|
tileColumns = 1 |
|
|
|
|
|
|
|
|
|
|
|
@uiVector('Crop Rect (x, y, w, h)', [0, 1], 0.001) |
|
|
|
|
|
@serialize() |
|
|
|
|
|
rect = new Vector4(0, 0, 1, 1) |
|
|
|
|
|
|
|
|
// @uiInput('Frame Count') |
|
|
|
|
|
// @serialize() |
|
|
|
|
|
// progressiveFrames = 64 |
|
|
|
|
|
// |
|
|
|
|
|
// @uiInput('Tile Rows') |
|
|
|
|
|
// @serialize() |
|
|
|
|
|
// tileRows = 1 |
|
|
|
|
|
// |
|
|
|
|
|
// @uiInput('Tile Columns') |
|
|
|
|
|
// @serialize() |
|
|
|
|
|
// tileColumns = 1 |
|
|
|
|
|
// |
|
|
|
|
|
// @uiVector('Crop Rect (x, y, w, h)', [0, 1], 0.001) |
|
|
|
|
|
// @serialize() |
|
|
|
|
|
// rect = new Vector4(0, 0, 1, 1) |
|
|
|
|
|
|
|
|
private _downloading = false |
|
|
private _downloading = false |
|
|
|
|
|
|