-
-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(AxesActor): add option to flip axes individually
- Loading branch information
1 parent
75a3019
commit 18cf0e4
Showing
4 changed files
with
205 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<table> | ||
<tr> | ||
<td>Center axis</td> | ||
<td> | ||
<input class="recenter" type="checkbox" checked /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>X axis inversion</td> | ||
<td> | ||
<input class="xAxisInvert" type="checkbox" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Y axis inversion</td> | ||
<td> | ||
<input class="yAxisInvert" type="checkbox" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Z axis inversion</td> | ||
<td> | ||
<input class="zAxisInvert" type="checkbox" /> | ||
</td> | ||
</tr> | ||
</table> |
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,80 @@ | ||
import '@kitware/vtk.js/favicon'; | ||
|
||
// Load the rendering pieces we want to use (for both WebGL and WebGPU) | ||
import '@kitware/vtk.js/Rendering/Profiles/Geometry'; | ||
|
||
import macro from '@kitware/vtk.js/macros'; | ||
import vtkAxesActor from '@kitware/vtk.js/Rendering/Core/AxesActor'; | ||
import vtkFullScreenRenderWindow from '@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow'; | ||
|
||
import controlPanel from './controlPanel.html'; | ||
|
||
console.warn( | ||
'Click on index.ts to open source code for this example --------->' | ||
); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Standard rendering code setup | ||
// ---------------------------------------------------------------------------- | ||
|
||
const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({ | ||
background: [0.2, 0.3, 0.4], | ||
}); | ||
const renderer = fullScreenRenderer.getRenderer(); | ||
const renderWindow = fullScreenRenderer.getRenderWindow(); | ||
|
||
const axesActor = vtkAxesActor.newInstance(); | ||
renderer.addActor(axesActor); | ||
|
||
renderer.resetCamera(); | ||
renderWindow.render(); | ||
|
||
// ---------------------------------------------------------------------------- | ||
// UI control handling | ||
// ---------------------------------------------------------------------------- | ||
|
||
fullScreenRenderer.addController(controlPanel); | ||
|
||
function updateRendering() { | ||
axesActor.update(); | ||
renderer.resetCameraClippingRange(); | ||
renderWindow.render(); | ||
} | ||
|
||
document.querySelector('.recenter').addEventListener('change', (e) => { | ||
const config = axesActor.getConfig(); | ||
config.recenter = !!e.target.checked; | ||
axesActor.setConfig(config); | ||
updateRendering(); | ||
}); | ||
|
||
document.querySelector('.xAxisInvert').addEventListener('change', (e) => { | ||
const config = axesActor.getXConfig(); | ||
config.invert = !!e.target.checked; | ||
axesActor.setXConfig(config); | ||
updateRendering(); | ||
}); | ||
|
||
document.querySelector('.yAxisInvert').addEventListener('change', (e) => { | ||
const config = axesActor.getYConfig(); | ||
config.invert = !!e.target.checked; | ||
axesActor.setYConfig(config); | ||
updateRendering(); | ||
}); | ||
|
||
document.querySelector('.zAxisInvert').addEventListener('change', (e) => { | ||
const config = axesActor.getZConfig(); | ||
config.invert = !!e.target.checked; | ||
axesActor.setZConfig(config); | ||
updateRendering(); | ||
}); | ||
|
||
// ----------------------------------------------------------- | ||
// Make some variables global so that you can inspect and | ||
// modify objects in your browser's developer console: | ||
// ----------------------------------------------------------- | ||
|
||
global.setLoggerFunction = macro.setLoggerFunction; | ||
global.axesActor = axesActor; | ||
global.renderer = renderer; | ||
global.renderWindow = renderWindow; |
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
Oops, something went wrong.