Working vtk-js integration
MODIFY
src/vtkjs/pointFeature.js
src/vtkjs/pointFeature.js
@@ -5,7 +5,7 @@ var pointFeature = require('../pointFeature');
var vtkActor = vtk.Rendering.Core.vtkActor;// = require('vtk.js/Sources/Rendering/Core/Actor');
var vtkMapper = vtk.Rendering.Core.vtkMapper;// = require('vtk.js/Sources/Rendering/Core/Mapper');
-var vtkSphereSource = vtk.Filters.Sources.vtkSphereSource;// = require('vtk.js/Sources/Filters/Sources/SphereSource');
+var vtkConeSource = vtk.Filters.Sources.vtkConeSource;// = require('vtk.js/Sources/Filters/Sources/SphereSource');
// var vtkPlaneSource = vtk.Filters.Sources.vtkPlaneSource;// = require('vtk.js/Sources/Filters/Sources/PlaneSource');
//////////////////////////////////////////////////////////////////////////////
@@ -89,24 +89,26 @@ var vtkjs_pointFeature = function (arg) {
m_this.gcs(), m_this.layer().map().gcs(),
position, 3);
- if (!nonzeroZ && m_this.gcs() !== m_this.layer().map().gcs()) {
- for (i = i3 = 0; i < numPts; i += 1, i3 += 3) {
- position[i3 + 2] = 0;
- }
- }
+ // if (!nonzeroZ && m_this.gcs() !== m_this.layer().map().gcs()) {
+ // for (i = i3 = 0; i < numPts; i += 1, i3 += 3) {
+ // position[i3 + 2] = 0;
+ // }
+ // }
+
/* Some transforms modify the z-coordinate. If we started with all zero z
* coordinates, don't modify them. This could be changed if the
* z-coordinate space of the gl cube is scaled appropriately. */
for (i = i3 = 0; i < numPts; i += 1, i3 += 3) {
- var source = vtkSphereSource.newInstance();
- source.setCenter(position[i3], position[i3 + 1], position[i3 + 2]);
- source.setRadius(100000.0);
+ var source = vtkConeSource.newInstance();
+ // source.setCenter(position[i3], position[i3 + 1], position[i3 + 2]);
+ // source.setRadius(100000.0);
var actor = vtkActor.newInstance();
var mapper = vtkMapper.newInstance();
actor.getProperty().setEdgeVisibility(true);
mapper.setInputConnection(source.getOutputPort());
actor.setMapper(mapper);
m_this.renderer().contextRenderer().addActor(actor);
+ m_this.renderer().contextRenderer().setLayer(1);
m_actors.push(actor);
}
m_this.buildTime().modified();

MODIFY
src/vtkjs/vtkjsRenderer.js
src/vtkjs/vtkjsRenderer.js
@@ -166,21 +166,22 @@ var vtkjsRenderer = function (arg) {
rotation = map.rotation() || 0,
view = camera.view,
proj = camera.projectionMatrix;
- if (proj[15]) {
+ // if (proj[15]) {
/* we want positive z to be closer to the camera, but webGL does the
* converse, so reverse the z coordinates. */
- proj = mat4.scale(util.mat4AsArray(), proj, [1, 1, -1]);
- }
+ // proj = mat4.scale(util.mat4AsArray(), proj, [1, 1, -1]);
+ // }
/* A similar kluge as in the base camera class worldToDisplay4. With this,
* we can show z values from 0 to 1. */
- proj = mat4.translate(util.mat4AsArray(), proj,
- [0, 0, camera.constructor.bounds.far]);
+ // proj = mat4.translate(util.mat4AsArray(), proj,
+ // [0, 0, camera.constructor.bounds.far]);
console.log(`VTKJS: viewMat: ${m_this.contextRenderer().getActiveCamera().getViewMatrix()}`);
console.log(`GEOJS: viewMat: ${view}`);
console.log(`VTKJS: projMat: ${m_this.contextRenderer().getActiveCamera().getProjectionMatrix()}`);
console.log(`GEOJS: projMat: ${proj}`);
- m_this.contextRenderer().getActiveCamera().computeViewParametersFromPhysicalMatrix(camera.world);
+ // m_this.contextRenderer().getActiveCamera().computeViewParametersFromPhysicalMatrix(view);
+ m_this.contextRenderer().getActiveCamera().setViewMatrix(view);
m_this.contextRenderer().getActiveCamera().setProjectionMatrix(proj);
// camera.view = m_this.contextRenderer().getActiveCamera().getViewMatrix();
// camera.projectionMatrix = m_this.contextRenderer().getActiveCamera().getProjectionMatrix();

Working vtk-js integration