-
-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #631 from Kitware/skybox-example
Skybox example
- Loading branch information
Showing
4 changed files
with
76 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
Sources/Proxy/Representations/SkyboxRepresentationProxy/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import macro from 'vtk.js/Sources/macro'; | ||
import vtkSkybox from 'vtk.js/Sources/Rendering/Core/Skybox'; | ||
|
||
import vtkAbstractRepresentationProxy from 'vtk.js/Sources/Proxy/Core/AbstractRepresentationProxy'; | ||
|
||
// ---------------------------------------------------------------------------- | ||
// vtkSkyboxRepresentationProxy methods | ||
// ---------------------------------------------------------------------------- | ||
|
||
function vtkSkyboxRepresentationProxy(publicAPI, model) { | ||
// Set our className | ||
model.classHierarchy.push('vtkSkyboxRepresentationProxy'); | ||
model.actor = vtkSkybox.newInstance(); | ||
model.actors.push(model.actor); | ||
|
||
function updateTexture(texture) { | ||
model.actor.removeAllTextures(); | ||
model.actor.addTexture(texture); | ||
|
||
// Update domain | ||
const values = model.input.getAlgo().getPositions(); | ||
publicAPI.updateProxyProperty('position', { values }); | ||
} | ||
|
||
model.sourceDependencies.push({ setInputData: updateTexture }); | ||
|
||
// API ---------------------------------------------------------------------- | ||
|
||
publicAPI.setColorBy = () => {}; | ||
publicAPI.getColorBy = () => []; | ||
publicAPI.listDataArrays = () => []; | ||
|
||
publicAPI.setPosition = (value) => { | ||
model.input.getAlgo().setPosition(value); | ||
}; | ||
|
||
publicAPI.getPosition = () => model.input.getAlgo().getPosition(); | ||
} | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Object factory | ||
// ---------------------------------------------------------------------------- | ||
|
||
const DEFAULT_VALUES = {}; | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
export function extend(publicAPI, model, initialValues = {}) { | ||
Object.assign(model, DEFAULT_VALUES, initialValues); | ||
|
||
// Object methods | ||
vtkAbstractRepresentationProxy.extend(publicAPI, model); | ||
|
||
// Object specific methods | ||
vtkSkyboxRepresentationProxy(publicAPI, model); | ||
} | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
export const newInstance = macro.newInstance( | ||
extend, | ||
'vtkSkyboxRepresentationProxy' | ||
); | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
export default { newInstance, extend }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters