Skip to content

Commit

Permalink
Revert "rangefinder"
Browse files Browse the repository at this point in the history
This reverts commit 8d43b63.
  • Loading branch information
Benjamin Deleze committed Dec 2, 2022
1 parent b0efefd commit 83804e5
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 68 deletions.
3 changes: 1 addition & 2 deletions resources/web/wwi/FloatingProtoParameterWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down
11 changes: 2 additions & 9 deletions resources/web/wwi/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 0 additions & 6 deletions resources/web/wwi/X3dScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions resources/web/wwi/nodes/WbAbstractCamera.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -153,10 +153,10 @@ export default class WbAbstractCamera extends WbSolid {
_wr_node_set_visible(this._transform, true);
}

_minRange() {
minRange() {
}

_maxRange() {
maxRange() {
return 1.0;
}

Expand Down
4 changes: 2 additions & 2 deletions resources/web/wwi/nodes/WbCamera.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export default class WbCamera extends WbAbstractCamera {
this._update();
}

_minRange() {
minRange() {
return this.#near;
}

_maxRange() {
maxRange() {
return this.#far;
}
}
34 changes: 0 additions & 34 deletions resources/web/wwi/nodes/WbRangeFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
10 changes: 0 additions & 10 deletions resources/web/wwi/protos/ProtoCamera.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
]
}
}

0 comments on commit 83804e5

Please sign in to comment.