configuration modes

beta.r3js.org
-=yb4f310 2018-05-11 19:03:24 +02:00
parent ae5d71a80a
commit 96ea8c1f6a
4 changed files with 50 additions and 3 deletions

View File

@ -14,6 +14,7 @@
* @param activeRenderer
* @param enableComposer
* @param enableEffect
* @param defaultMode
* @constructor
*/
R3.API.RenderConfiguration = function (
@ -30,7 +31,8 @@ R3.API.RenderConfiguration = function (
activeComposer,
activeEffect,
enableComposer,
enableEffect
enableEffect,
defaultMode
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -100,6 +102,11 @@ R3.API.RenderConfiguration = function (
}
this.enableEffect = enableEffect;
if (R3.Utils.UndefinedOrNull(defaultMode)) {
defaultMode = R3.API.RenderConfiguration.DEFAULT_MODE_IN_GAME;
}
this.defaultMode = defaultMode;
R3.API.Component.call(
this,
R3.Component.RENDER_CONFIGURATION,
@ -122,3 +129,6 @@ R3.API.RenderConfiguration.SCALE_MODE_NONE = 0x1;
R3.API.RenderConfiguration.SCALE_MODE_LETTERBOX = 0x2;
R3.API.RenderConfiguration.SCALE_MODE_ZOOM_TO_BIGGER = 0x3;
R3.API.RenderConfiguration.SCALE_MODE_NON_UNIFORM = 0x4;
R3.API.RenderConfiguration.DEFAULT_MODE_IN_GAME = 0x1;
R3.API.RenderConfiguration.DEFAULT_MODE_EDIT = 0x2;

View File

@ -152,6 +152,19 @@ R3.AR.prototype.createInstance = function() {
arComponent.camera.instance.projectionMatrix.copy(projectionMatrix);
arComponent.camera.updateFromInstance();
arComponent.camera.instance.fov = arComponent.camera.fov;
arComponent.camera.instance.near = arComponent.camera.near;
arComponent.camera.instance.far = arComponent.camera.far;
arComponent.camera.instance.filmGauge = arComponent.camera.filmGauge;
arComponent.camera.instance.filmOffset = arComponent.camera.filmOffset;
arComponent.camera.instance.focus = arComponent.camera.focus;
arComponent.camera.instance.zoom = arComponent.camera.zoom;
arComponent.camera.instance.aspect = arComponent.camera.aspect;
arComponent.camera.instance.updateProjectionMatrix();
}
}
@ -219,6 +232,8 @@ R3.AR.prototype.createInstance = function() {
this.videoScene.camera = this.videoCamera;
arScene.videoScene.children[0].material.map.flipY = true;
/**
* Also update the video texture before render
*/

View File

@ -31,7 +31,8 @@ R3.RenderConfiguration = function (
apiRenderConfiguration.activeComposer,
apiRenderConfiguration.activeEffect,
apiRenderConfiguration.enableComposer,
apiRenderConfiguration.enableEffect
apiRenderConfiguration.enableEffect,
apiRenderConfiguration.defaultMode
);
this.logicalSize = new R3.Vector2(
@ -226,6 +227,15 @@ R3.RenderConfiguration.prototype.updateInstance = function(property) {
return;
}
if (
property === 'defaultMode'
) {
console.log('todo: defaultMode change');
return;
}
R3.Component.prototype.updateInstance.call(this, property);
};
/**
@ -252,7 +262,8 @@ R3.RenderConfiguration.prototype.toApiObject = function() {
R3.Utils.IdOrNull(this.activeComposer),
R3.Utils.IdOrNull(this.activeEffect),
this.enableComposer,
this.enableEffect
this.enableEffect,
this.defaultMode
);
return apiRenderConfiguration;

View File

@ -940,6 +940,17 @@ R3.System.GUI.prototype.buildControl = function(folder, componentTemplate, prope
}
)
);
} else if (property === 'defaultMode') {
controllers.push(
folder.add(
object,
property,
{
'in game' : R3.API.RenderConfiguration.DEFAULT_MODE_IN_GAME,
'edit' : R3.API.RenderConfiguration.DEFAULT_MODE_EDIT
}
)
);
} else if (property === 'aspectRatioMode') {
controllers.push(
folder.add(