-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calcDeviceParams_() running twice when using custom dpdb.json #313
Comments
Looking at the dpdb logic in cardboard-vr-display, it looks like, yes, the device is initially searched for in the local DPDB copy, and then falls back to fetching the URL for an up-to-date value. Are the expectations here that the I wonder for local values, if it'd make more sense to pass them into the constructor rather than requiring an XHR call for values, as this is more for sites out in the wild to be able to pull in the latest device values without needing to update the polyfill, rather than supplying your own local device values. |
I guess my expectations are that the local copy would be appended to the url or cached copy, so looking through the devices array only happens once. But if that’s not feasible, checking the local one first would make more sense, at least in my use-case. |
The DPDB_URL is for referencing remote data that may contain updated content, and not considered "local", as a fallback, which is a different connotation than appending extra data locally. Otherwise, all experiences would first require the URL data fetch, which leads me to think that maybe there should be a different mechanism for local data |
Oh, I see. That would certainly help my use case, which I admit is pretty rare in the grand scheme of things. If there was an additional DPDB_LOCAL option in the config, that took a javascript object and appended it to the existing cache before anything initialized, that would help. As it stands right now, though, this is just an annoying visual bug, and not anything game-breaking. To clear up my understanding, there's three potential sources of the DPDB, right? The hardcoded DPDB_CACHE, the one at |
Your understanding matches mine I believe; however the fetch for the DPDB_URL should only occur if the device wasn't found in the local DPDB_CACHE. Does this have a visual effect on distortion? The remote DPDB should be available usually by the time a user enters VR. And yes, I think a DPDB_LOCAL option is a good idea, since I've seen users do what your describing to add their specific device for testing |
Was there any progress on this? DPDB_LOCAL seems like a good option to add. |
I'm running into this as well. As anyone come across a solution? |
Description:
A little background first
I'm creating a custom VR setup, using a small display and running content on it in Three.js on a PC.
Since it's not a real mobile device, I have to spoof the User Agent to make webvr think it is real, and I do so by setting it before I initialize the polyfill:
Additionally, since this device is definitely not in the official
dpdb.json
, I have to create my own version:And pass it into the polyfill:
Herein lies the issue
On initialization of the polyfill, I immediately get:
But when looking at the returned devices, it does seem like the
CardboardVRDisplay
has correctly initialized, asconfig.DPDB_URL
is "./data/dpdb.json", anddeviceInfo_.device.bevelMeters
is 0.002.After throwing some additional logs in
webvr-polyfill.js
, it seems likecalcDeviceParams_()
is running twice, once for theDPDB_CACHE
, and then once for my specialdpdb.json
. The first call throws the errors, and the second call overwrites the fallback device with the custom one.Additional Information:
The text was updated successfully, but these errors were encountered: