Skip to content

Commit fce8456

Browse files
committed
Compatible with Three R114
1 parent 8c57226 commit fce8456

File tree

6 files changed

+17
-4
lines changed

6 files changed

+17
-4
lines changed

src/models/TriangleList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ ROS3D.TriangleList = function(options) {
4343
}
4444
geometry.faces.push(faceVert);
4545
}
46-
material.vertexColors = THREE.VertexColors;
46+
material.vertexColors = true;
4747
} else if (colors.length === vertices.length / 3) {
4848
// use per-triangle color
4949
for (i = 0; i < vertices.length; i += 3) {
5050
var faceTri = new THREE.Face3(i, i + 1, i + 2);
5151
faceTri.color.setRGB(colors[i / 3].r, colors[i / 3].g, colors[i / 3].b);
5252
geometry.faces.push(faceTri);
5353
}
54-
material.vertexColors = THREE.FaceColors;
54+
material.vertexColors = true;
5555
} else {
5656
// use marker color
5757
for (i = 0; i < vertices.length; i += 3) {

src/navigation/OcTreeBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ ROS3D.OcTreeBase.prototype.buildGeometry = function () {
403403
const material = new THREE.MeshBasicMaterial({
404404
color: 'white',
405405
flatShading: true,
406-
vertexColors: THREE.VertexColors,
406+
vertexColors: true,
407407
transparent: this.opacity < 1.0,
408408
opacity: this.opacity
409409
});

src/sensors/Points.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ROS3D.Points.prototype.setup = function(frame, point_step, fields)
8686

8787
if(!this.material.isMaterial) { // if it is an option, apply defaults and pass it to a PointsMaterial
8888
if(this.colors && this.material.vertexColors === undefined) {
89-
this.material.vertexColors = THREE.VertexColors;
89+
this.material.vertexColors = true;
9090
}
9191
this.material = new THREE.PointsMaterial(this.material);
9292
}

src/visualization/SceneNode.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ROS3D.SceneNode = function(options) {
2525

2626
// Do not render this object until we receive a TF update
2727
this.visible = false;
28+
this.layers.disable(0);
2829

2930
// add the model
3031
this.add(object);
@@ -43,6 +44,7 @@ ROS3D.SceneNode = function(options) {
4344
// update the world
4445
this.updatePose(poseTransformed);
4546
this.visible = true;
47+
this.layers.enable(0);
4648
};
4749

4850
// listen for TF updates

src/visualization/interaction/Highlighter.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ ROS3D.Highlighter.prototype.makeEverythingInvisible = function (scene) {
9797
|| currentObject instanceof THREE.Sprite ) {
9898
currentObject.previousVisibility = currentObject.visible;
9999
currentObject.visible = false;
100+
currentObject.layers.disable(0); // Invisible
100101
}
101102
});
102103
};
@@ -113,13 +114,15 @@ ROS3D.Highlighter.prototype.makeHighlightedVisible = function (scene) {
113114
if ( currentObject instanceof THREE.Mesh || currentObject instanceof THREE.Line
114115
|| currentObject instanceof THREE.Sprite ) {
115116
currentObject.visible = true;
117+
currentObject.layers.enable(0); // Visible
116118
}
117119
};
118120

119121
for (var uuid in this.hoverObjs) {
120122
var selectedObject = this.hoverObjs[uuid];
121123
// Make each selected object and all of its children visible
122124
selectedObject.visible = true;
125+
selectedObject.layers.enable(0); // Visible
123126
selectedObject.traverse(makeVisible);
124127
}
125128
};
@@ -134,6 +137,11 @@ ROS3D.Highlighter.prototype.restoreVisibility = function (scene) {
134137
scene.traverse(function(currentObject) {
135138
if (currentObject.hasOwnProperty('previousVisibility')) {
136139
currentObject.visible = currentObject.previousVisibility;
140+
if (currentObject.visible) {
141+
currentObject.layers.enable(0); // Visible
142+
} else {
143+
currentObject.layers.disable(0); // Invisible
144+
}
137145
}
138146
}.bind(this));
139147
};

src/visualization/interaction/OrbitControls.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ ROS3D.OrbitControls = function(options) {
8181
scene.add(this.axes);
8282
this.axes.traverse(function(obj) {
8383
obj.visible = false;
84+
obj.layers.disable(0); // Invisible
8485
});
8586
}
8687

@@ -376,13 +377,15 @@ ROS3D.OrbitControls.prototype.showAxes = function() {
376377

377378
this.axes.traverse(function(obj) {
378379
obj.visible = true;
380+
obj.layers.enable(0); // Visible
379381
});
380382
if (this.hideTimeout) {
381383
clearTimeout(this.hideTimeout);
382384
}
383385
this.hideTimeout = setTimeout(function() {
384386
that.axes.traverse(function(obj) {
385387
obj.visible = false;
388+
obj.layers.disable(0); // Invisible
386389
});
387390
that.hideTimeout = false;
388391
}, 1000);

0 commit comments

Comments
 (0)