abhishekvp / cesium-lg

Liquid Galaxy GSoC 2016 Project: Enabling Cesium for Liquid Galaxy
5 stars 3 forks source link

getAspectRatio didn't work for me. #25

Closed alfski closed 8 years ago

alfski commented 8 years ago

I'm not sure why you need to check for greatest common divisor? With 16:9 screen.width is still the horizontal and screen.height the vertical.

This worked...

        function getAspectRatio() {
        return screen.height / screen.width;
        }

hmm... probably should be width / height, and then divide the HorizFov in the clients.

abhishekvp commented 8 years ago

Right, I thought I needed to get the aspect ratio in the form of "16:9", and hence did the GCD. I realize now that we only need it for computation purpose and not displaying! Will fix this, also I think for some reason screen.height and screen.width do not get the correct browser window size, I will look into it.

alfski commented 8 years ago

my guess is it should be this document.body.clientWidth / clientHeight

abhishekvp commented 8 years ago

Yeah! I have tested it at my end, by resizing the window and aspect ratio changes.

alfski commented 8 years ago

Clients need to divide HorizFOV by aspectratio now that it is width/height...

viewer.camera.frustum.fov = toRadians(CONFIG.slaveHorizFOV / getAspectRatio());
abhishekvp commented 8 years ago

Hi @alfski, Does this work for you now? If yes, then we can go ahead and close this issue.

alfski commented 8 years ago

seems to be working now.