diff --git a/resources/web/wwi/FloatingProtoParameterWindow.js b/resources/web/wwi/FloatingProtoParameterWindow.js index 01e3fb6d99f..ef5477db1e6 100644 --- a/resources/web/wwi/FloatingProtoParameterWindow.js +++ b/resources/web/wwi/FloatingProtoParameterWindow.js @@ -3,7 +3,6 @@ import {VRML} from './protoVisualizer/vrml_type.js'; import WbCamera from './nodes/WbCamera.js'; import WbHingeJoint from './nodes/WbHingeJoint.js'; import WbWorld from './nodes/WbWorld.js'; -import WbRangeFinder from './nodes/WbRangeFinder.js'; export default class FloatingProtoParameterWindow extends FloatingWindow { #protoManager; @@ -503,7 +502,7 @@ export default class FloatingProtoParameterWindow extends FloatingWindow { for (const key of keys) { const device = nodes.get(key); - if (device instanceof WbCamera || device instanceof WbRangeFinder) { + if (device instanceof WbCamera) { numberOfDevices++; let div = document.createElement('div'); diff --git a/resources/web/wwi/Parser.js b/resources/web/wwi/Parser.js index e81485a8e90..d941fa702e5 100644 --- a/resources/web/wwi/Parser.js +++ b/resources/web/wwi/Parser.js @@ -628,15 +628,8 @@ export default class Parser { newNode = new WbPen(id, translation, scale, rotation, name === '' ? 'pen' : name); else if (node.tagName === 'Radar') newNode = new WbRadar(id, translation, scale, rotation, name === '' ? 'radar' : name); - else if (node.tagName === 'RangeFinder') { - const height = parseInt(getNodeAttribute(node, 'height', '64')); - const width = parseInt(getNodeAttribute(node, 'width', '64')); - const fieldOfView = parseFloat(getNodeAttribute(node, 'fieldOfView', M_PI_4)); - const maxRange = parseFloat(getNodeAttribute(node, 'maxRange', '1')); - const minRange = parseFloat(getNodeAttribute(node, 'minRange', '0.01')); - newNode = new WbRangeFinder(id, translation, scale, rotation, name === '' ? 'range finder' : name, height, width, - fieldOfView, maxRange, minRange); - } + else if (node.tagName === 'RangeFinder') + newNode = new WbRangeFinder(id, translation, scale, rotation, name === '' ? 'range finder' : name); else if (node.tagName === 'Receiver') newNode = new WbReceiver(id, translation, scale, rotation, name === '' ? 'receiver' : name); else if (node.tagName === 'Speaker') diff --git a/resources/web/wwi/X3dScene.js b/resources/web/wwi/X3dScene.js index 1d76c7bf19e..d7a164f2d47 100644 --- a/resources/web/wwi/X3dScene.js +++ b/resources/web/wwi/X3dScene.js @@ -37,7 +37,6 @@ import WbVector3 from './nodes/utils/WbVector3.js'; import WbNormal from './nodes/WbNormal.js'; import WbSpotLight from './nodes/WbSpotLight.js'; import WbDirectionalLight from './nodes/WbDirectionalLight.js'; -import WbRangeFinder from './nodes/WbRangeFinder.js'; export default class X3dScene { #loader; @@ -395,11 +394,6 @@ export default class X3dScene { object.far = parseFloat(pose[key]); else if (key === 'near') object.near = parseFloat(pose[key]); - } else if (object instanceof WbRangeFinder) { - if (key === 'maxRange') - object.maxRange = parseFloat(pose[key]); - else if (key === 'minRange') - object.minRange = parseFloat(pose[key]); } if (object instanceof WbLight) { diff --git a/resources/web/wwi/nodes/WbAbstractCamera.js b/resources/web/wwi/nodes/WbAbstractCamera.js index d27417c6f6a..b723c143438 100644 --- a/resources/web/wwi/nodes/WbAbstractCamera.js +++ b/resources/web/wwi/nodes/WbAbstractCamera.js @@ -93,14 +93,14 @@ export default class WbAbstractCamera extends WbSolid { let drawFarPlane; let f; - const n = this._minRange(); + const n = this.minRange(); // if the far is set to 0 it means the far clipping plane is set to infinity // so, the far distance of the colored frustum should be set arbitrarily - if (this._charType === 'c' && this._maxRange() === 0) { + if (this._charType === 'c' && this.maxRange() === 0) { f = n + 2 * _wr_config_get_line_scale(); drawFarPlane = false; } else { - f = this._maxRange(); + f = this.maxRange(); drawFarPlane = true; } @@ -153,10 +153,10 @@ export default class WbAbstractCamera extends WbSolid { _wr_node_set_visible(this._transform, true); } - _minRange() { + minRange() { } - _maxRange() { + maxRange() { return 1.0; } diff --git a/resources/web/wwi/nodes/WbCamera.js b/resources/web/wwi/nodes/WbCamera.js index 52490fccaad..b85fc04a44b 100644 --- a/resources/web/wwi/nodes/WbCamera.js +++ b/resources/web/wwi/nodes/WbCamera.js @@ -29,11 +29,11 @@ export default class WbCamera extends WbAbstractCamera { this._update(); } - _minRange() { + minRange() { return this.#near; } - _maxRange() { + maxRange() { return this.#far; } } diff --git a/resources/web/wwi/nodes/WbRangeFinder.js b/resources/web/wwi/nodes/WbRangeFinder.js index 9a712211e43..eab3abe8a70 100644 --- a/resources/web/wwi/nodes/WbRangeFinder.js +++ b/resources/web/wwi/nodes/WbRangeFinder.js @@ -2,38 +2,4 @@ import WbAbstractCamera from './WbAbstractCamera.js'; // This class is used to retrieve the type of device export default class WbRangeFinder extends WbAbstractCamera { - #maxRange; - #minRange; - constructor(id, translation, scale, rotation, name, height, width, fieldOfView, maxRange, minRange) { - super(id, translation, scale, rotation, name, height, width, fieldOfView); - this.#maxRange = maxRange; - console.log(minRange) - this.#minRange = minRange; - } - - get maxRange() { - return this.#maxRange; - } - - set maxRange(newMaxRange) { - this.#maxRange = newMaxRange; - this._update(); - } - - get minRange() { - return this.#minRange; - } - - set minRange(newMinRange) { - this.#minRange = newMinRange; - this._update(); - } - - _minRange() { - return this.#minRange; - } - - _maxRange() { - return this.#maxRange; - } } diff --git a/resources/web/wwi/protos/ProtoCamera.proto b/resources/web/wwi/protos/ProtoCamera.proto index 2a4fdba6cd5..334ff5e4c03 100644 --- a/resources/web/wwi/protos/ProtoCamera.proto +++ b/resources/web/wwi/protos/ProtoCamera.proto @@ -8,15 +8,12 @@ field SFInt32 width field SFInt32 height 64 field SFFloat near 0.01 field SFFloat far 0.0 -field SFFloat minRange 0.01 -field SFFloat maxRange 1 ] { Robot { translation 0 0 0.2 children [ Camera { - rotation 0 1 0 1.5708 children [ Shape { appearance Asphalt { @@ -32,13 +29,6 @@ field SFFloat maxRange near IS near fieldOfView IS fieldOfView } - RangeFinder { - width IS width - height IS height - maxRange IS maxRange - minRange IS minRange - fieldOfView IS fieldOfView - } ] } }