melowntech / vts-browser-js

JavaScript WebGL 3D map rendering engine
BSD 2-Clause "Simplified" License
218 stars 42 forks source link

Two camera example for vts-browser-js #184

Closed shrikant-panchal closed 4 years ago

shrikant-panchal commented 4 years ago

I observed that the vts-browser-cpp provides a two-camera-example that explains how to split your viewport into two different level of details using two separate cameras.

Is there any similar type of example available for vts-browser-js? If No, could you please help me understand the method to achieve it?

I am trying to implement two viewports, such that, in view-1 the camera will be at some distance and user can rotate zoom in/out etc, in view-2 camera will follow the object and will show a close up.

Any help will be really appreciated!

shrikant-panchal commented 4 years ago

I am seeking a help on this issue since more than 2weeks, can someone at least guide me to some useful reference?

davidmtech commented 4 years ago

There is no support for multiple viewports in vts-browser-js. There is no easy way how to do that. You can try to modify drawMap function

https://github.com/melowntech/vts-browser-js/blob/a0d80a516fe82a8e626f96009b4b27ba250a16d3/src/core/map/draw.js#L148

Call this function for each viewport and modify WebGL viewport, projections, ... for each viewport manually.

VrushalNanavati commented 3 years ago

@davidmtech Thanks for the information.

We did try to modify this method and we could just draw the map two times in two viewports. but the camera still works with a complete window. We want to control even the navigation in these viewports differently. Basically, we're trying to replicate the exact two camera example from vts-browser-cpp in vts-browser.js.

Currently, the camera is dependent on the map and somehow the navigation considers the whole canvas size for its camera manipulation. Can you please direct us on how feasible it is to implement following on top of existing vts? Single map to contain more than one camera with its own navigation system which will be controlled in it's given viewport?