This commit is contained in:
Roberto Garrido 2018-05-08 18:06:57 +02:00
Родитель acb1d31ed7 9f38a93537
Коммит 2b6b0a7260
4 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

@ -5,9 +5,9 @@ import MatrixMath from './fill/MatrixMath.js'
XRPresentationFrame provides all of the values needed to render a single frame of an XR scene to the XRDisplay.
*/
export default class XRPresentationFrame {
constructor(session){
constructor(session, timestamp){
this._session = session
this._timestamp = this._session.reality._getTimeStamp();
this._timestamp = this._session.reality._getTimeStamp(timestamp);
}
get session(){ return this._session }

Просмотреть файл

@ -59,13 +59,13 @@ export default class XRSession extends EventHandlerBase {
}
_handleRequestFrame(callback) {
return this._display._requestAnimationFrame(() => {
return this._display._requestAnimationFrame((timestamp) => {
if (this._skip) {
this._skip = false;
return this._handleRequestFrame(callback)
}
//this._skip = true; // try skipping every second raf
const frame = this._createPresentationFrame()
const frame = this._createPresentationFrame(timestamp)
this._updateCameraAnchor(frame)
this._display._reality._handleNewFrame(frame)
@ -177,8 +177,8 @@ export default class XRSession extends EventHandlerBase {
this._display._startVideoFrames();
}
_createPresentationFrame(){
return new XRPresentationFrame(this)
_createPresentationFrame(timestamp){
return new XRPresentationFrame(this, timestamp)
}
_getCoordinateSystem(...types){

Просмотреть файл

@ -607,12 +607,13 @@ export default class CameraReality extends Reality {
}
}
_getTimeStamp() {
_getTimeStamp(timestamp) {
if(this._arKitWrapper !== null){
return this._arKitWrapper.timestamp;
}else{
// use performance.now()
return ( performance || Date ).now();
//return ( performance || Date ).now();
return timestamp
}
}
/*

Просмотреть файл

@ -73,6 +73,9 @@ export default class VirtualReality extends Reality {
})
}
_getTimeStamp(timestamp) {
return timestamp
}
}