Skip to content

Commit

Permalink
chore(release): 1.4.0-55
Browse files Browse the repository at this point in the history
  • Loading branch information
speigg committed Sep 30, 2017
1 parent 73c695f commit eeb3247
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 19 deletions.
30 changes: 23 additions & 7 deletions dist/argon.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -19708,11 +19708,15 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
* @param entity The entity to convert.
* @param time The time which to retrieve the pose up the reference chain.
* @param referenceFrame The reference frame to convert the position and oriention to.
* @return a boolean indicating success or failure. Will be false if either property is
* not constant, or if either property cannot be converted to the new frame.
* @return a boolean indicating success or failure. Will return true if the entity position/orientation
* is already in the specified reference frame. Will return false if either property does
* not have a `setValue` method, or if either property cannot be converted to the new frame.
*/
function convertEntityReferenceFrame(entity, time, frame) {
if (!entity.position || !(entity.position instanceof ConstantPositionProperty) || !entity.orientation || !(entity.orientation instanceof ConstantProperty)) {
var entityPosition = entity.position;
var entityOrientation = entity.orientation;
if (entityPosition.referenceFrame === frame) return true;
if (!entityPosition || !entityPosition.setValue || !entityOrientation || !entityOrientation.setValue) {
return false;
}
if (!getEntityPositionInReferenceFrame(entity, time, frame, scratchCartesian)) {
Expand All @@ -19721,8 +19725,8 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
if (!getEntityOrientationInReferenceFrame(entity, time, frame, scratchOrientation)) {
return false;
}
entity.position.setValue(scratchCartesian, frame);
entity.orientation.setValue(scratchOrientation);
entityPosition.setValue(scratchCartesian, frame);
entityOrientation.setValue(scratchOrientation);
return true;
}

Expand Down Expand Up @@ -21342,7 +21346,7 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
requestVertexNormals: true
}));

_export('version', version = "1.4.0-54");
_export('version', version = "1.4.0-55");

__extends$1 = undefined && undefined.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
Expand Down Expand Up @@ -25226,6 +25230,7 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
this._scratchArray = [];
this._scratchMatrix3 = new Matrix3();
this._scratchMatrix4 = new Matrix4();
this._convertEntityReferenceFrame = convertEntityReferenceFrame;
this.sessionService.manager.on['ar.context.update'] = function (state) {
var scratchFrustum = _this._scratchFrustum;
// backwards-compat
Expand Down Expand Up @@ -25583,16 +25588,21 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
contextOriginPosition.setValue(Cartesian3.ZERO, deviceOrigin);
contextOriginOrientation.setValue(Quaternion.IDENTITY);
} else {
// save stage relative to origin
var stageRelativeToOrigin = this.getEntityPose(deviceStage, deviceOrigin);
// first figure out where the origin should be
var originRelativeToStage = this.getEntityPose(deviceOrigin, deviceStage);
contextOriginPosition.setValue(originRelativeToStage.position, contextStage);
contextOriginOrientation.setValue(originRelativeToStage.orientation);
// then convert the origin to the same frame used by the overridden stage
// convert origin to the same frame used by the overridden stage
var rootFrame = getReachableAncestorReferenceFrames(contextStage, time, this._scratchArray)[0];
if (!defined(rootFrame)) throw new Error("Stage frame must have a reachable parent reference frame!");
var originRelativeToRoot = this.getEntityPose(contextOrigin, rootFrame);
contextOriginPosition.setValue(originRelativeToRoot.position, rootFrame);
contextOriginOrientation.setValue(originRelativeToRoot.orientation);
// convert stage to be relative to origin
contextStagePosition.setValue(stageRelativeToOrigin.position, contextOrigin);
contextStageOrientation.setValue(stageRelativeToOrigin.orientation);
}
// update user entity (relative to origin) based on device user (relative to device origin) if the reality did not override it
var deviceUser = this.deviceService.user;
Expand All @@ -25603,6 +25613,8 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
var contextUserOrientation = contextUser.orientation;
contextUserPosition.setValue(userRelativeToOrigin.position, contextOrigin);
contextUserOrientation.setValue(userRelativeToOrigin.orientation);
} else {
this._convertEntityReferenceFrame(contextUser, time, contextStage);
}
// update view entity (if the reality did not set it)
var contextView = this.view;
Expand All @@ -25611,6 +25623,8 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
var contextViewOrientation = contextView.orientation;
contextViewPosition.setValue(Cartesian3.ZERO, contextUser);
contextViewOrientation.setValue(Quaternion.IDENTITY);
} else {
this._convertEntityReferenceFrame(contextView, time, contextUser);
}
// update subview entities (if the reality did not set them)
for (var i = 0; i < frameState.subviews.length; i++) {
Expand All @@ -25629,6 +25643,8 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
if (!entities[this.floor.id]) {
var floorPosition = this.floor.position;
floorPosition.setValue(Cartesian3.ZERO, contextStage);
} else {
this._convertEntityReferenceFrame(this.floor, time, contextStage);
}
};
ContextService.prototype._updateStageGeo = function () {
Expand Down
30 changes: 23 additions & 7 deletions dist/argon.js
Original file line number Diff line number Diff line change
Expand Up @@ -25266,11 +25266,15 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
* @param entity The entity to convert.
* @param time The time which to retrieve the pose up the reference chain.
* @param referenceFrame The reference frame to convert the position and oriention to.
* @return a boolean indicating success or failure. Will be false if either property is
* not constant, or if either property cannot be converted to the new frame.
* @return a boolean indicating success or failure. Will return true if the entity position/orientation
* is already in the specified reference frame. Will return false if either property does
* not have a `setValue` method, or if either property cannot be converted to the new frame.
*/
function convertEntityReferenceFrame(entity, time, frame) {
if (!entity.position || !(entity.position instanceof ConstantPositionProperty) || !entity.orientation || !(entity.orientation instanceof ConstantProperty)) {
var entityPosition = entity.position;
var entityOrientation = entity.orientation;
if (entityPosition.referenceFrame === frame) return true;
if (!entityPosition || !entityPosition.setValue || !entityOrientation || !entityOrientation.setValue) {
return false;
}
if (!getEntityPositionInReferenceFrame(entity, time, frame, scratchCartesian)) {
Expand All @@ -25279,8 +25283,8 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
if (!getEntityOrientationInReferenceFrame(entity, time, frame, scratchOrientation)) {
return false;
}
entity.position.setValue(scratchCartesian, frame);
entity.orientation.setValue(scratchOrientation);
entityPosition.setValue(scratchCartesian, frame);
entityOrientation.setValue(scratchOrientation);
return true;
}

Expand Down Expand Up @@ -26927,7 +26931,7 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
requestVertexNormals: true
}));

_export('version', version = "1.4.0-54");
_export('version', version = "1.4.0-55");

__extends$1 = undefined && undefined.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
Expand Down Expand Up @@ -30811,6 +30815,7 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
this._scratchArray = [];
this._scratchMatrix3 = new Matrix3();
this._scratchMatrix4 = new Matrix4();
this._convertEntityReferenceFrame = convertEntityReferenceFrame;
this.sessionService.manager.on['ar.context.update'] = function (state) {
var scratchFrustum = _this._scratchFrustum;
// backwards-compat
Expand Down Expand Up @@ -31168,16 +31173,21 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
contextOriginPosition.setValue(Cartesian3.ZERO, deviceOrigin);
contextOriginOrientation.setValue(Quaternion.IDENTITY);
} else {
// save stage relative to origin
var stageRelativeToOrigin = this.getEntityPose(deviceStage, deviceOrigin);
// first figure out where the origin should be
var originRelativeToStage = this.getEntityPose(deviceOrigin, deviceStage);
contextOriginPosition.setValue(originRelativeToStage.position, contextStage);
contextOriginOrientation.setValue(originRelativeToStage.orientation);
// then convert the origin to the same frame used by the overridden stage
// convert origin to the same frame used by the overridden stage
var rootFrame = getReachableAncestorReferenceFrames(contextStage, time, this._scratchArray)[0];
if (!defined(rootFrame)) throw new Error("Stage frame must have a reachable parent reference frame!");
var originRelativeToRoot = this.getEntityPose(contextOrigin, rootFrame);
contextOriginPosition.setValue(originRelativeToRoot.position, rootFrame);
contextOriginOrientation.setValue(originRelativeToRoot.orientation);
// convert stage to be relative to origin
contextStagePosition.setValue(stageRelativeToOrigin.position, contextOrigin);
contextStageOrientation.setValue(stageRelativeToOrigin.orientation);
}
// update user entity (relative to origin) based on device user (relative to device origin) if the reality did not override it
var deviceUser = this.deviceService.user;
Expand All @@ -31188,6 +31198,8 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
var contextUserOrientation = contextUser.orientation;
contextUserPosition.setValue(userRelativeToOrigin.position, contextOrigin);
contextUserOrientation.setValue(userRelativeToOrigin.orientation);
} else {
this._convertEntityReferenceFrame(contextUser, time, contextStage);
}
// update view entity (if the reality did not set it)
var contextView = this.view;
Expand All @@ -31196,6 +31208,8 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
var contextViewOrientation = contextView.orientation;
contextViewPosition.setValue(Cartesian3.ZERO, contextUser);
contextViewOrientation.setValue(Quaternion.IDENTITY);
} else {
this._convertEntityReferenceFrame(contextView, time, contextUser);
}
// update subview entities (if the reality did not set them)
for (var i = 0; i < frameState.subviews.length; i++) {
Expand All @@ -31214,6 +31228,8 @@ $__System.register('1', ['2', '3', '3c', '4', '9', '10', 'a', '20', '33', '42',
if (!entities[this.floor.id]) {
var floorPosition = this.floor.position;
floorPosition.setValue(Cartesian3.ZERO, contextStage);
} else {
this._convertEntityReferenceFrame(this.floor, time, contextStage);
}
};
ContextService.prototype._updateStageGeo = function () {
Expand Down
2 changes: 1 addition & 1 deletion dist/argon.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@argonjs/argon",
"version": "1.4.0-54",
"version": "1.4.0-55",
"main": "dist/argon.core.js",
"browser": "dist/argon.js",
"typings": "index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Entity, EntityCollection, Cartographic, Transforms, JulianDate, ReferenceFrame } from './cesium/cesium-imports';
import { SerializedEntityStateMap, SerializedSubviewList, ContextFrameState, GeolocationOptions, CanvasViewport } from './common';
import { SessionService, SessionPort } from './session';
import { Event } from './utils';
import { Event, convertEntityReferenceFrame } from './utils';
import { EntityService, EntityServiceProvider, EntityPose } from './entity';
import { DeviceService, Device } from './device';
import { ViewService } from './view';
Expand Down Expand Up @@ -229,6 +229,7 @@ export declare class ContextService {
private _updateBackwardsCompatability(frameState);
private _update(frameState, skipEvents?);
_updateEntities(entities: SerializedEntityStateMap): void;
_convertEntityReferenceFrame: typeof convertEntityReferenceFrame;
_updateContextEntities(frameState: ContextFrameState): void;
_updateStageGeo(): void;
private _previousOriginReferenceFrame?;
Expand Down
5 changes: 3 additions & 2 deletions src/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export declare function decomposePerspectiveProjectionMatrix(mat: Matrix4, resul
* @param entity The entity to convert.
* @param time The time which to retrieve the pose up the reference chain.
* @param referenceFrame The reference frame to convert the position and oriention to.
* @return a boolean indicating success or failure. Will be false if either property is
* not constant, or if either property cannot be converted to the new frame.
* @return a boolean indicating success or failure. Will return true if the entity position/orientation
* is already in the specified reference frame. Will return false if either property does
* not have a `setValue` method, or if either property cannot be converted to the new frame.
*/
export declare function convertEntityReferenceFrame(entity: Entity, time: JulianDate, frame: ReferenceFrame | Entity): boolean;
export declare const isArgonApp: boolean;
Expand Down

0 comments on commit eeb3247

Please sign in to comment.