Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jailln committed Oct 27, 2023
1 parent fa5f70b commit bdec550
Show file tree
Hide file tree
Showing 24 changed files with 192 additions and 79 deletions.
2 changes: 1 addition & 1 deletion itowns/dev/dist/debug.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion itowns/dev/dist/itowns.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion itowns/dev/dist/itowns_widgets.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion itowns/dev/docs/api/Controls/CameraUtils.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h3>
<span class="type"><a onclick="window.parent.goTo('api/View/View.html','api/View/View')" title="View">View</a></span>,

camera:
<span class="type"><a onclick="window.parent.goTo('api/Renderer/Camera.html','api/Renderer/Camera')" title="Camera">Camera</a></span>,
<span class="type">THREE.Camera</span>,

extent:
<span class="type"><a onclick="window.parent.goTo('api/Geographic/Extent.html','api/Geographic/Extent')" title="Extent">Extent</a></span>
Expand Down
4 changes: 2 additions & 2 deletions itowns/dev/docs/api/Renderer/Camera.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h3>
<span class="type">number</span>,

options:
<span class="type">object</span>
<span class="type">Object</span>


)
Expand Down Expand Up @@ -176,7 +176,7 @@ <h3>
<div class="property">
<h3>
<span class="property-name">camera3D</span>
: <span class="type">object</span>
: <span class="type">THREE.Camera</span>
</h3>


Expand Down
125 changes: 124 additions & 1 deletion itowns/dev/docs/api/View/View.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,135 @@ <h2>Example</h2>

<pre class="prettyprint source lang-js"><code>var viewerDiv = document.getElementById('viewerDiv');
var view = itowns.View('EPSG:4326', viewerDiv, { camera: { type: itowns.CAMERA_TYPE.ORTHOGRAPHIC } });
var customControls = itowns.THREE.OrbitControls(view.camera.camera3D, viewerDiv);</code></pre>
var customControls = itowns.THREE.OrbitControls(view.camera3D, viewerDiv);</code></pre>





<hr class="title-divider"/>
<h2>Properties</h2>



<div class="property">
<h3>
<span class="property-name">domElement</span>
: <span class="type">HTMLElement</span>
</h3>


<div class="description">
<p>Thhe domElement holding the canvas where the view is displayed</p>
</div>

</div>

<hr/>



<div class="property">
<h3>
<span class="property-name">referenceCrs</span>
: <span class="type">String</span>
</h3>


<div class="description">
<p>The coordinate reference system of the view</p>
</div>

</div>

<hr/>



<div class="property">
<h3>
<span class="property-name">mainLoop</span>
: <span class="type">MainLoop</span>
</h3>


<div class="description">
<p>itowns mainloop scheduling the operations</p>
</div>

</div>

<hr/>



<div class="property">
<h3>
<span class="property-name">scene</span>
: <span class="type">THREE.Scene</span>
</h3>


<div class="description">
<p>threejs scene of the view</p>
</div>

</div>

<hr/>



<div class="property">
<h3>
<span class="property-name">camera</span>
: <span class="type"><a onclick="window.parent.goTo('api/Renderer/Camera.html','api/Renderer/Camera')" title="Camera">Camera</a></span>
</h3>


<div class="description">
<p>itowns camera (that holds a threejs camera that is directly accessible with View.camera3D)</p>
</div>

</div>

<hr/>



<div class="property">
<h3>
<span class="property-name">camera3D</span>
: <span class="type">THREE.Camera</span>
</h3>


<div class="description">
<p>threejs camera that is stored in itowns camera</p>
</div>

</div>

<hr/>



<div class="property">
<h3>
<span class="property-name">renderer</span>
: <span class="type">THREE.WebGLRenderer</span>
</h3>


<div class="description">
<p>threejs webglrenderer rendering this view</p>
</div>

</div>






<hr class="title-divider"/>
Expand Down
8 changes: 4 additions & 4 deletions itowns/dev/examples/3dtiles_basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
var viewerDiv = document.getElementById('viewerDiv');

var view = new itowns.GlobeView(viewerDiv, placement);
view.camera.camera3D.near = 5;
view.camera3D.near = 5;
setupLoadingScreen(viewerDiv, view);

var menuGlobe = new GuiTools('menuDiv', view, 300);
Expand Down Expand Up @@ -84,9 +84,9 @@
debug.create3dTilesDebugUI(menuGlobe.gui, view, $3dTilesLayerDiscreteLOD, d);
debug.create3dTilesDebugUI(menuGlobe.gui, view, $3dTilesLayerRequestVolume, d);
d.zoom = function() {
view.camera.camera3D.position.set(1215013.9, -4736315.5, 4081597.5);
view.camera.camera3D.quaternion.set(0.9108514448729665, 0.13456816437801225, 0.1107206134840362, 0.3741416847378546);
view.notifyChange(view.camera.camera3D);
view.camera3D.position.set(1215013.9, -4736315.5, 4081597.5);
view.camera3D.quaternion.set(0.9108514448729665, 0.13456816437801225, 0.1107206134840362, 0.3741416847378546);
view.notifyChange(view.camera3D);
}
menuGlobe.gui.add(d, 'zoom').name('Go to point cloud');
</script>
Expand Down
16 changes: 8 additions & 8 deletions itowns/dev/examples/3dtiles_pointcloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ul>
<li>Display your pointcloud</li>
<li>Use classification to assign colour to each points</li>
<li>Switch between mode on the left panel</li>
<li>Switch between mode on the left panel</li>
</ul>
</div>
<div id="viewerDiv"></div>
Expand All @@ -27,7 +27,7 @@
<script type="text/javascript">
/* global itowns,document,GuiTools*/


var placement = {
coord: new itowns.Coordinates('EPSG:4326', 3.695885, 43.397379, 0),

Expand All @@ -39,7 +39,7 @@
var viewerDiv = document.getElementById('viewerDiv');

var view = new itowns.GlobeView(viewerDiv, placement);
view.camera.camera3D.near = 5;
view.camera3D.near = 5;
setupLoadingScreen(viewerDiv, view);

var menuGlobe = new GuiTools('menuDiv', view, 300);
Expand Down Expand Up @@ -76,14 +76,14 @@
itowns.View.prototype.addLayer.call(view, $3dTilesLayerSetePC);
function switchMode(){
let pntsLayer = view.getLayerById("3d-tiles-sete");

if(pntsLayer){
pntsLayer = pntsLayer;
pntsLayer.pntsMode = pntsLayer.pntsMode == itowns.PNTS_MODE.COLOR ? itowns.PNTS_MODE.CLASSIFICATION : itowns.PNTS_MODE.COLOR;
view.notifyChange(view.camera.camera3D);
view.notifyChange(view.camera3D);
}
}

// Add the UI Debug
var d = new debug.Debug(view, menuGlobe.gui);
debug.createTileDebugUI(menuGlobe.gui, view, view.tileLayer, d);
Expand All @@ -94,9 +94,9 @@
}
menuGlobe.gui.add(d, 'switch').name('Mode Switch');







</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion itowns/dev/examples/effects_postprocessing.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
var r = g.renderer;
r.setRenderTarget(g.fullSizeRenderTarget);
r.clear();
r.render(view.scene, view.camera.camera3D);
r.render(view.scene, view.camera3D);

quad.material.uniforms.tDiffuse.value = g.fullSizeRenderTarget.texture;
quad.material.uniforms.tSize.value.set(
Expand Down
11 changes: 4 additions & 7 deletions itowns/dev/examples/effects_stereo.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

view.render = function render() {
r.clear();
effect.render(view.scene, view.camera.camera3D);
effect.render(view.scene, view.camera3D);
};

view.notifyChange();
Expand All @@ -125,8 +125,7 @@
function enableAnaglyph() {
var _eff;
if (effect instanceof THREE.AnaglyphEffect) return;
_eff = new THREE.AnaglyphEffect(view.mainLoop.gfxEngine.renderer,
view.camera.camera3D);
_eff = new THREE.AnaglyphEffect(view.mainLoop.gfxEngine.renderer, view.camera3D);
enableEffect(_eff);
}

Expand All @@ -139,8 +138,7 @@
function enableParallax() {
var _eff;
if (effect instanceof THREE.ParallaxBarrierEffect) return;
_eff = new THREE.ParallaxBarrierEffect(view.mainLoop.gfxEngine.renderer,
view.camera.camera3D);
_eff = new THREE.ParallaxBarrierEffect(view.mainLoop.gfxEngine.renderer, view.camera3D);
enableEffect(_eff);
}

Expand All @@ -150,8 +148,7 @@
function enableStereo() {
var _eff;
if (effect instanceof THREE.StereoEffect) return;
_eff = new THREE.StereoEffect(view.mainLoop.gfxEngine.renderer,
view.camera.camera3D);
_eff = new THREE.StereoEffect(view.mainLoop.gfxEngine.renderer, view.camera3D);
enableEffect(_eff);
}

Expand Down
10 changes: 4 additions & 6 deletions itowns/dev/examples/entwine_simple_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,21 @@
var eptLayer, eptSource;

function onLayerReady() {
var camera = view.camera.camera3D;

var lookAt = new itowns.THREE.Vector3();
var size = new itowns.THREE.Vector3();
eptLayer.root.bbox.getSize(size);
eptLayer.root.bbox.getCenter(lookAt);

camera.far = 2.0 * size.length();
view.camera3D.far = 2.0 * size.length();

var position = eptLayer.root.bbox.min.clone().add(size.multiply({ x: 0, y: 0, z: size.x / size.z }));

camera.position.copy(position);
camera.lookAt(lookAt);
view.camera3D.position.copy(position);
view.camera3D.lookAt(lookAt);

controls.options.moveSpeed = size.length();

view.notifyChange(camera);
view.notifyChange(view.camera3D);
controls.reset();
}

Expand Down
9 changes: 3 additions & 6 deletions itowns/dev/examples/itowns-potree.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@
// Controls and camera specific setting.
itownsViewer.controls.minDistanceCollision = 0.01;
itownsViewer.controls.minDistance = 20;
itownsViewer.camera.camera3D.near = 0.1;


view.camera3D.near = 0.1;

// ---------- TWEAK ITOWNS VIEWER TO SUPPORT POTREE VISUALIZATION : ----------

Expand All @@ -179,9 +177,8 @@
})

// Set Potree viewer camera as iTowns viewer camera.
const camera = itownsViewer.camera.camera3D;
camera.zoomTo = () => {};
potreeViewer.scene.cameraP = camera;
view.camera3D.zoomTo = () => {};
potreeViewer.scene.cameraP = view.camera3D;

// TODO : should be moved to Label2DRenderer constructor
itownsViewer.mainLoop.gfxEngine.label2dRenderer.domElement.style.pointerEvents = 'none';
Expand Down
7 changes: 3 additions & 4 deletions itowns/dev/examples/js/OrientedImageHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,12 @@ function setupViewCameraLookingAtObject(camera, coord, objectToLookAt) {
// eslint-disable-next-line no-unused-vars
function setupViewCameraDecomposing(view, camera) {
let upWorld;
const viewCamera = view.camera.camera3D;
camera.matrixWorld.decompose(viewCamera.position, viewCamera.quaternion, viewCamera.scale);
camera.matrixWorld.decompose(view.camera3D.position, view.camera3D.quaternion, view.camera3D.scale);

// setup up vector
upWorld = camera.localToWorld(camera.up.clone());
upWorld = viewCamera.position.clone().sub(upWorld);
viewCamera.up.copy(upWorld);
upWorld = view.camera3D.position.clone().sub(upWorld);
view.camera3D.up.copy(upWorld);
}

// add a camera helper to debug camera position..
Expand Down
2 changes: 1 addition & 1 deletion itowns/dev/examples/js/plugins/DragNDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const DragNDrop = (function _() {
}

// Move the camera
itowns.CameraUtils.transformCameraToLookAtTarget(_view, _view.camera.camera3D, extent);
itowns.CameraUtils.transformCameraToLookAtTarget(_view, _view.camera3D, extent);
});
};

Expand Down
10 changes: 4 additions & 6 deletions itowns/dev/examples/laz_dragndrop.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,21 @@
view.scene.add(points);
points.updateMatrixWorld(true);

var camera = view.camera.camera3D;

var lookAt = new itowns.THREE.Vector3();
var size = new itowns.THREE.Vector3();
geometry.boundingBox.getSize(size);
geometry.boundingBox.getCenter(lookAt);

camera.far = Math.max(2.0 * size.length(), camera.far);
view.camera3D.far = Math.max(2.0 * size.length(), camera.far);

var position = geometry.boundingBox.min.clone().add(size.multiply({ x: 0, y: 0, z: size.x / size.z }));

camera.position.copy(position);
camera.lookAt(lookAt);
view.camera3D.position.copy(position);
view.camera3D.lookAt(lookAt);

controls.options.moveSpeed = size.length();

view.notifyChange(camera);
view.notifyChange(view.camera3D);
controls.reset();
});
};
Expand Down
Loading

0 comments on commit bdec550

Please sign in to comment.