New York is in the Altantic

Dec 5, 2013 at 2:00 PM
Edited Dec 5, 2013 at 2:02 PM
First, thank you for putting this on CodePlex. It's truly some awesome code and I plan to read it and hope to learn!

On my Surface Pro, cities are not shown at the correct locations. Ex: NYC is in the Atlantic (or outer space), Redmond is in the middle of the country and LA is down in Mexico.

It's hard to tell if the clouds are in the correct location since a satellite view of the US is pretty cloudy through the Midwest to East right now but Weathr is showing clouds where I'd estimate NYC to be.

Playing with it some more, it's clear that there's a projection or scaling issue as zooming can really move the cities to wild locations.

John
Dec 5, 2013 at 9:00 PM
Edited Dec 5, 2013 at 10:35 PM
Hi John,

I'll spare you the earthquake joke :)

But thanks for trying the app out, and for reporting the issue. I've actually received a few reports of this already. The issue appears to be related to cases where the resolution scaling is set to either 140% or 180%. It was something I was aware of, but didn't think the issue was very widespread. So no time like the present to fix it. :D

I checked in Changeset 31284, which hopefully resolves the issue. Can you please confirm and then I'll update the Release?

If you're not connected through TFS, the change is to add this code to the end of SceneRenderer::CreateWindowSizeDependentResources:
// Adjust the viewport to account for the current resolution scale.
// This enables us to properly project from 3D to 2D.
float resolutionScale = 1.0f;
switch (Windows::Graphics::Display::DisplayInformation::GetForCurrentView()->ResolutionScale)
{
default:
case Windows::Graphics::Display::ResolutionScale::Scale120Percent: // not currently used
case Windows::Graphics::Display::ResolutionScale::Scale150Percent: // currently applies only to Windows Phone 8
case Windows::Graphics::Display::ResolutionScale::Scale160Percent: // currently applies only to Windows Phone 8
case Windows::Graphics::Display::ResolutionScale::Scale225Percent: // not currently used
    assert(false); // assert in Debug builds and fall through.
case Windows::Graphics::Display::ResolutionScale::Scale100Percent:
    resolutionScale = 1.0f;
    break;
case Windows::Graphics::Display::ResolutionScale::Scale140Percent:
    resolutionScale = 1.4f;
    break;
case Windows::Graphics::Display::ResolutionScale::Scale180Percent:
    resolutionScale = 1.8f;
    break;
}
m_viewport.Width /= resolutionScale;
m_viewport.Height /= resolutionScale;
Marked as answer by jschroedl on 12/5/2013 at 3:51 PM
Dec 5, 2013 at 11:48 PM
Perfect. That fixed it! Thanks.

Speaking of Earthquakes, isn't there a web service to feed up all the current/recent earthquake events from around the world. It would be cool to have a quake layer to turn on. Maybe the land/sea in the vicinity would rumble :)

John
Dec 6, 2013 at 12:01 AM
Glad it worked. Thanks for confirming. I wasn't looking forward to fixing that one -- glad in the end it wasn't a lot of code :D

Great idea about the earthquake layer! This project is open source, so that might be a great opportunity for someone if I don't get to it first! I can imagine some control on the UI that lets you specify what layers to show -- weather data, earthquake data, and so on.