unsure about commit

beta.r3js.org
-=yb4f310 2018-02-19 23:33:00 +01:00
parent 7a8cfc87a6
commit 92f124e623
5 changed files with 67 additions and 40 deletions

View File

@ -35,25 +35,25 @@ if (typeof GameLib.D3.Runtime === 'undefined') {
GameLib.D3.Runtime = function(){};
}
if (typeof Q === 'undefined') {
if (typeof require === 'undefined') {
console.warn('You need the Q promise library for the GameLib.D3');
throw new Error('You need the Q promise library for the GameLib.D3');
}
var Q = require('q');
}
if (typeof _ === 'undefined') {
if (typeof require === 'undefined') {
console.warn('You need the lodash library for the GameLib.D3');
throw new Error('You need the lodash library for the GameLib.D3');
}
var _ = require('lodash');
}
// if (typeof Q === 'undefined') {
//
// if (typeof require === 'undefined') {
// console.warn('You need the Q promise library for the GameLib.D3');
// throw new Error('You need the Q promise library for the GameLib.D3');
// }
//
// var Q = require('q');
// }
//
// if (typeof _ === 'undefined') {
//
// if (typeof require === 'undefined') {
// console.warn('You need the lodash library for the GameLib.D3');
// throw new Error('You need the lodash library for the GameLib.D3');
// }
//
// var _ = require('lodash');
// }
// This gets injected by gulp
console.log("Loading GameLib compiled at: " + __DATE__);

View File

@ -139,8 +139,6 @@ GameLib.CustomCode.prototype.launchEditor = function(){
);
}
this.editor.on('change', function(){
this.code = this.editor.getValue();

View File

@ -18,6 +18,8 @@
* @constructor
* @param apiCamera
* @param aspectRatioMode
* @param minWidth
* @param minHeight
* @param width
* @param height
* @param near

View File

@ -207,20 +207,40 @@ GameLib.D3.Camera.Orthographic.prototype.updateFromInstance = function() {
GameLib.D3.Camera.Orthographic.prototype.updateFromAspectRatio = function() {
if (this.aspect < 1) {
var requiredAspect = this.minWidth / this.minHeight;
if (this.aspect < requiredAspect) {
/**
* Make height dependend on width
*/
this.width = this.minWidth;
this.height = this.minWidth / this.aspect;
if (this.height < this.minHeight) {
/**
* We have a problem - our new height is less than our minimum height
*/
this.height = this.minHeight;
this.width = this.aspect * this.height;
}
// if (this.height < this.minHeight) {
// /**
// * We have a problem - our new height is less than our minimum height
// */
//
//
// ;
//
// if (requiredAspect < this.aspect) {
// this.width = requiredAspect * this.height;
// } else {
// this.height = this.minHeight;
// this.width = this.aspect * this.height;
// }
//
//
// } else {
//
// /**
// * Try to fit our game into the window
// * @type {number}
// */
// // var requiredAspect = this.minWidth / this.minHeight;
// // this.width = requiredAspect * this.height;
// }
} else {
/**
@ -228,14 +248,14 @@ GameLib.D3.Camera.Orthographic.prototype.updateFromAspectRatio = function() {
*/
this.height = this.minHeight;
this.width = this.aspect * this.minHeight;
if (this.width < this.minWidth) {
/**
* We have a problem - our new width is less than our minimum width
*/
this.width = this.minWidth;
this.height = this.width / this.aspect;
}
//
// if (this.width < this.minWidth) {
// /**
// * We have a problem - our new width is less than our minimum width
// */
// this.width = this.minWidth;
// this.height = this.width / this.aspect;
// }
}
this.left = this.width / -2;

View File

@ -1609,7 +1609,13 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
property === 'depth' ||
property === 'radius'
) {
controllers.push(folder.add(object, property, 0, 1000, 0.1));
if (object instanceof GameLib.D3.Pass.Bloom) {
controllers.push(folder.add(object, property, -10, 10, 0.001));
} else {
controllers.push(folder.add(object, property, 0, 1000, 0.1));
}
} else if (
property === 'near' ||
property === 'distanceGrain' ||
@ -1617,7 +1623,8 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
) {
controllers.push(folder.add(object, property, -10, 100, 0.001));
} else if (
property === 'bumpScale'
property === 'bumpScale' ||
property === 'speed'
) {
controllers.push(folder.add(object, property, 0, 20, 0.001));
} else if (
@ -1652,7 +1659,7 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
property === 'strength' ||
property === 'power'
) {
controllers.push(folder.add(object, property, 0, 50, 0.001));
controllers.push(folder.add(object, property, 0, 25, 0.01));
} else if (
property === 'thetaLength' ||
property === 'angle'