markupExt
markupExt copied to clipboard
Problem loading new markup data
New data doesn't get loaded when the newData
event gets dispatched with fresh points. The following patch seems to fix the issue.
diff --git a/docs/markupExt.js b/docs/markupExt.js
index 9ed4cd3..8e3185f 100644
--- a/docs/markupExt.js
+++ b/docs/markupExt.js
@@ -70,6 +70,7 @@ markup3d.prototype.unload = function() {
markup3d.prototype.load = function() {
var self = this;
+ this.material = null;
this.offset = viewer.model.getData().globalOffset; // use global offset to align pointCloud with lmv scene
// setup listeners for new data and mouse events
@@ -101,7 +102,7 @@ markup3d.prototype.load = function() {
else {
// create new point cloud material
var texture = THREE.ImageUtils.loadTexture("img/icons.png");
- var material = new THREE.ShaderMaterial({
+ this.material = new THREE.ShaderMaterial({
vertexColors: THREE.VertexColors,
fragmentShader: this.fragmentShader,
vertexShader: this.vertexShader,
@@ -113,7 +114,7 @@ markup3d.prototype.load = function() {
}
});
}
- this.pointCloud = new THREE.PointCloud(this.geometry, material);
+ this.pointCloud = new THREE.PointCloud(this.geometry, this.material);
this.pointCloud.position.sub( this.offset );
this.scene.add(this.pointCloud);
}