start restructure
parent
452842cb45
commit
659954f7de
|
@ -2,7 +2,7 @@
|
||||||
* R3.API.AR
|
* R3.API.AR
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param video
|
* @param video
|
||||||
* @param pathCamera
|
* @param pathCamera
|
||||||
* @param pathMarker
|
* @param pathMarker
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
R3.API.AR = function(
|
R3.API.AR = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parent,
|
||||||
video,
|
video,
|
||||||
pathCamera,
|
pathCamera,
|
||||||
pathMarker,
|
pathMarker,
|
||||||
|
@ -79,7 +79,7 @@ R3.API.AR = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.AR,
|
R3.Component.AR,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param graphicsType
|
* @param graphicsType
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.GraphicsRuntime = function(
|
R3.API.GraphicsRuntime = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
graphicsType,
|
graphicsType,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -30,7 +30,7 @@ R3.API.GraphicsRuntime = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.API.GraphicsRuntime.GetComponentType(this.graphicsType),
|
R3.API.GraphicsRuntime.GetComponentType(this.graphicsType),
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,7 +21,7 @@ R3.API.GraphicsRuntime.Impact = function(
|
||||||
apiGraphicsRuntime.id,
|
apiGraphicsRuntime.id,
|
||||||
apiGraphicsRuntime.name,
|
apiGraphicsRuntime.name,
|
||||||
apiGraphicsRuntime.graphicsType,
|
apiGraphicsRuntime.graphicsType,
|
||||||
apiGraphicsRuntime.parentEntity
|
apiGraphicsRuntime.parent
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
|
@ -21,7 +21,7 @@ R3.API.GraphicsRuntime.Three = function(
|
||||||
apiGraphicsRuntime.id,
|
apiGraphicsRuntime.id,
|
||||||
apiGraphicsRuntime.name,
|
apiGraphicsRuntime.name,
|
||||||
apiGraphicsRuntime.graphicsType,
|
apiGraphicsRuntime.graphicsType,
|
||||||
apiGraphicsRuntime.parentEntity
|
apiGraphicsRuntime.parent
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
|
@ -6,7 +6,7 @@
|
||||||
* @param min
|
* @param min
|
||||||
* @param max
|
* @param max
|
||||||
*/
|
*/
|
||||||
R3.API.Number = function (
|
R3.API.Number = function(
|
||||||
value,
|
value,
|
||||||
grain,
|
grain,
|
||||||
min,
|
min,
|
|
@ -19,7 +19,7 @@ R3.AR = function(
|
||||||
this,
|
this,
|
||||||
apiAR.id,
|
apiAR.id,
|
||||||
apiAR.name,
|
apiAR.name,
|
||||||
apiAR.parentEntity,
|
apiAR.parent,
|
||||||
apiAR.video,
|
apiAR.video,
|
||||||
apiAR.pathCamera,
|
apiAR.pathCamera,
|
||||||
apiAR.pathMarker,
|
apiAR.pathMarker,
|
||||||
|
@ -435,7 +435,7 @@ R3.AR.prototype.toApiObject = function() {
|
||||||
return new R3.API.AR(
|
return new R3.API.AR(
|
||||||
this.id,
|
this.id,
|
||||||
this.name,
|
this.name,
|
||||||
R3.Utils.IdOrNull(this.parentEntity),
|
R3.Utils.IdOrNull(this.parent),
|
||||||
R3.Utils.IdOrNull(this.video),
|
R3.Utils.IdOrNull(this.video),
|
||||||
this.pathCamera,
|
this.pathCamera,
|
||||||
this.pathMarker,
|
this.pathMarker,
|
|
@ -3,7 +3,7 @@
|
||||||
* @param apiGraphicsRuntimeImpact
|
* @param apiGraphicsRuntimeImpact
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.GraphicsRuntime.Impact = function (
|
R3.GraphicsRuntime.Impact = function(
|
||||||
apiGraphicsRuntimeImpact
|
apiGraphicsRuntimeImpact
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @param parentObject
|
* @param parentObject
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Number = function (
|
R3.Number = function(
|
||||||
apiNumber,
|
apiNumber,
|
||||||
parentObject
|
parentObject
|
||||||
) {
|
) {
|
15
gulpfile.js
15
gulpfile.js
|
@ -7,11 +7,24 @@ var replace = require('gulp-string-replace');
|
||||||
gulp.task('build', build);
|
gulp.task('build', build);
|
||||||
gulp.task('monitor', monitor);
|
gulp.task('monitor', monitor);
|
||||||
|
|
||||||
|
var code = ' if (R3.Utils.UndefinedOrNull(apiComponent)) {';
|
||||||
|
code += ' apiComponent = {};';
|
||||||
|
code += ' }';
|
||||||
|
code += ' this.apiComponent = apiComponent;';
|
||||||
|
code += '\n';
|
||||||
|
code += ' R3.API.Component.call(';
|
||||||
|
code += ' this,';
|
||||||
|
code += ' this.apiComponent.parent,';
|
||||||
|
code += ' this.apiComponent.id,';
|
||||||
|
code += ' this.apiComponent.name';
|
||||||
|
code += ' );';
|
||||||
|
|
||||||
function build() {
|
function build() {
|
||||||
return gulp.src('./src/r3-*.js')
|
return gulp.src('./src/r3-*.js')
|
||||||
.pipe(sort())
|
.pipe(sort())
|
||||||
.pipe(concat('r3.js'))
|
.pipe(concat('r3.js'))
|
||||||
.pipe(replace('__DATE__', new Date().toString()))
|
.pipe(replace('__DATE__', new Date().toString()))
|
||||||
|
.pipe(replace('__API_COMPONENT_MACRO__', code));
|
||||||
.pipe(minify({
|
.pipe(minify({
|
||||||
ext:{
|
ext:{
|
||||||
src:'.js',
|
src:'.js',
|
||||||
|
@ -32,4 +45,4 @@ gulp.task(
|
||||||
build,
|
build,
|
||||||
monitor
|
monitor
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
* Event Core
|
* Event Core
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Event = function() {
|
R3.Event = function(parent) {
|
||||||
|
if (!parent) {
|
||||||
|
parent = null;
|
||||||
|
}
|
||||||
|
this.parent = parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +17,7 @@ R3.Event.Subscriptions = {};
|
||||||
R3.Event.OnceSubscriptions = {};
|
R3.Event.OnceSubscriptions = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Events we can subscribe to and publish
|
* Events we can subscribe to and emit
|
||||||
*/
|
*/
|
||||||
R3.Event.WINDOW_RESIZE = 0x1;
|
R3.Event.WINDOW_RESIZE = 0x1;
|
||||||
R3.Event.PARENT_SCENE_CHANGE = 0x2;
|
R3.Event.PARENT_SCENE_CHANGE = 0x2;
|
||||||
|
@ -93,7 +97,7 @@ R3.Event.TOUCH_MOVE = 0x4b;
|
||||||
R3.Event.TOUCH_CANCEL = 0x4c;
|
R3.Event.TOUCH_CANCEL = 0x4c;
|
||||||
R3.Event.GET_REMOTE_API_URL = 0x4d;
|
R3.Event.GET_REMOTE_API_URL = 0x4d;
|
||||||
R3.Event.COMPONENT_TYPES_UPDATE = 0x4e;
|
R3.Event.COMPONENT_TYPES_UPDATE = 0x4e;
|
||||||
R3.Event.DELAYED_INSTANCE_ENCOUNTERED = 0x4f;
|
R3.Event.PROJECT_LOADED = 0x4f;
|
||||||
R3.Event.CAST_SOURCE_CHANGED = 0x50;
|
R3.Event.CAST_SOURCE_CHANGED = 0x50;
|
||||||
R3.Event.RESOLVE_DEPENDENCIES = 0x51;
|
R3.Event.RESOLVE_DEPENDENCIES = 0x51;
|
||||||
R3.Event.NAME_UPDATE = 0x52;
|
R3.Event.NAME_UPDATE = 0x52;
|
||||||
|
@ -225,7 +229,7 @@ R3.Event.GetEventName = function(number) {
|
||||||
case 0x4c : return 'touch_cancel';
|
case 0x4c : return 'touch_cancel';
|
||||||
case 0x4d : return 'get_remote_api_url';
|
case 0x4d : return 'get_remote_api_url';
|
||||||
case 0x4e : return 'component_types_update';
|
case 0x4e : return 'component_types_update';
|
||||||
case 0x4f : return 'delayed_instance_encountered';
|
case 0x4f : return 'project_loaded';
|
||||||
case 0x50 : return 'cast_source_changed';
|
case 0x50 : return 'cast_source_changed';
|
||||||
case 0x51 : return 'resolve_dependencies';;
|
case 0x51 : return 'resolve_dependencies';;
|
||||||
case 0x52 : return 'name_update';
|
case 0x52 : return 'name_update';
|
||||||
|
@ -335,7 +339,7 @@ R3.Event.prototype.subscribe = function(
|
||||||
* @param clientErrorCallback
|
* @param clientErrorCallback
|
||||||
* @returns {number} of callbacks executed
|
* @returns {number} of callbacks executed
|
||||||
*/
|
*/
|
||||||
R3.Event.prototype.publish = function(
|
R3.Event.prototype.emit = function(
|
||||||
eventName,
|
eventName,
|
||||||
data,
|
data,
|
||||||
clientCallback,
|
clientCallback,
|
||||||
|
|
|
@ -69,7 +69,7 @@ R3.Utils.SortFacesByMaterialIndex = function(faces) {
|
||||||
* Sorts faces according to material index because later we will create
|
* Sorts faces according to material index because later we will create
|
||||||
* groups for each vertice group
|
* groups for each vertice group
|
||||||
*/
|
*/
|
||||||
faces.sort(function (a, b) {
|
faces.sort(function(a, b) {
|
||||||
|
|
||||||
if (a.materialIndex < b.materialIndex) {
|
if (a.materialIndex < b.materialIndex) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -158,7 +158,7 @@ R3.Utils.GetWindowSize = function() {
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.GET_WINDOW_SIZE,
|
R3.Event.GET_WINDOW_SIZE,
|
||||||
null,
|
null,
|
||||||
function (data) {
|
function(data) {
|
||||||
size = data;
|
size = data;
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
@ -242,7 +242,7 @@ R3.Utils.GetRandomIntInclusive = function(min, max) {
|
||||||
|
|
||||||
R3.Utils.InterpolateArray = function(data, fitCount) {
|
R3.Utils.InterpolateArray = function(data, fitCount) {
|
||||||
|
|
||||||
var linearInterpolate = function (before, after, atPoint) {
|
var linearInterpolate = function(before, after, atPoint) {
|
||||||
return before + (after - before) * atPoint;
|
return before + (after - before) * atPoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ R3.Utils.InterpolateArray = function(data, fitCount) {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Utils.UndefinedOrNull = function (
|
R3.Utils.UndefinedOrNull = function(
|
||||||
variable
|
variable
|
||||||
) {
|
) {
|
||||||
return typeof variable === 'undefined' || variable === null;
|
return typeof variable === 'undefined' || variable === null;
|
||||||
|
@ -283,7 +283,7 @@ R3.Utils.UndefinedOrNull = function (
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Utils.Defined = function (
|
R3.Utils.Defined = function(
|
||||||
variable
|
variable
|
||||||
) {
|
) {
|
||||||
return typeof variable !== 'undefined' && variable !== null;
|
return typeof variable !== 'undefined' && variable !== null;
|
||||||
|
@ -327,7 +327,7 @@ R3.Utils.GetParameters = function(fn) {
|
||||||
* @returns {null}
|
* @returns {null}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Utils.IdOrNull = function (object) {
|
R3.Utils.IdOrNull = function(object) {
|
||||||
if (R3.Utils.UndefinedOrNull(object)) {
|
if (R3.Utils.UndefinedOrNull(object)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -374,7 +374,7 @@ R3.Utils.LimitToPI = function(property, objectProperty) {
|
||||||
* @returns []
|
* @returns []
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Utils.IdArrayOrEmptyArray = function (array) {
|
R3.Utils.IdArrayOrEmptyArray = function(array) {
|
||||||
if (R3.Utils.UndefinedOrNull(array)) {
|
if (R3.Utils.UndefinedOrNull(array)) {
|
||||||
return [];
|
return [];
|
||||||
} else {
|
} else {
|
||||||
|
@ -448,7 +448,7 @@ R3.Utils.InvertWindingOrder = function(triangles) {
|
||||||
R3.Utils.InvertMeshWindingOrder = function(mesh) {
|
R3.Utils.InvertMeshWindingOrder = function(mesh) {
|
||||||
|
|
||||||
mesh.faces.forEach(
|
mesh.faces.forEach(
|
||||||
function (face) {
|
function(face) {
|
||||||
|
|
||||||
var tmpV1 = face.v1;
|
var tmpV1 = face.v1;
|
||||||
face.v1 = face.v2;
|
face.v1 = face.v2;
|
||||||
|
@ -767,7 +767,7 @@ R3.Utils.MovingAverage = function(period) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.Intersect = function (a, b) {
|
R3.Utils.Intersect = function(a, b) {
|
||||||
|
|
||||||
var t;
|
var t;
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ R3.Utils.Intersect = function (a, b) {
|
||||||
* @param e
|
* @param e
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function (e) {
|
function(e) {
|
||||||
return (b.indexOf(e) > -1);
|
return (b.indexOf(e) > -1);
|
||||||
}
|
}
|
||||||
).filter(
|
).filter(
|
||||||
|
@ -797,13 +797,13 @@ R3.Utils.Intersect = function (a, b) {
|
||||||
* @param c
|
* @param c
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function (e, i, c) {
|
function(e, i, c) {
|
||||||
return c.indexOf(e) === i;
|
return c.indexOf(e) === i;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.Difference = function (a, b) {
|
R3.Utils.Difference = function(a, b) {
|
||||||
|
|
||||||
var t;
|
var t;
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ R3.Utils.Difference = function (a, b) {
|
||||||
* @param e
|
* @param e
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function (e) {
|
function(e) {
|
||||||
return (b.indexOf(e) === -1);
|
return (b.indexOf(e) === -1);
|
||||||
}
|
}
|
||||||
).filter(
|
).filter(
|
||||||
|
@ -833,7 +833,7 @@ R3.Utils.Difference = function (a, b) {
|
||||||
* @param c
|
* @param c
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function (e, i, c) {
|
function(e, i, c) {
|
||||||
return c.indexOf(e) === i;
|
return c.indexOf(e) === i;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,468 @@
|
||||||
|
/**
|
||||||
|
* API Component Interface - Do not construct objects of this type directly
|
||||||
|
* @param parent
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.API.Component = function(
|
||||||
|
parent,
|
||||||
|
id,
|
||||||
|
name
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||||
|
parent = null;
|
||||||
|
}
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
id = R3.Utils.RandomId();
|
||||||
|
}
|
||||||
|
this.id = id;
|
||||||
|
|
||||||
|
this.componentType = this.getComponentType();
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(name)) {
|
||||||
|
name = R3.Component.GetComponentFriendlyName(this.componentType) + ' (' + this.id + ')';
|
||||||
|
}
|
||||||
|
this.name = name;
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.API.Component.prototype.constructor = R3.API.Component;
|
||||||
|
|
||||||
|
R3.API.Component.prototype.getComponentType = function() {
|
||||||
|
|
||||||
|
if (this instanceof R3.API.Box3) {
|
||||||
|
return R3.Component.BOX3;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Canvas) {
|
||||||
|
return R3.Component.CANVAS;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Clock) {
|
||||||
|
return R3.Component.CLOCK;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Controls.D3.Editor) {
|
||||||
|
return R3.Component.CONTROLS_EDITOR;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Controls.D3.FirstPerson) {
|
||||||
|
return R3.Component.CONTROLS_FIRST_PERSON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Controls.D3.Orbit) {
|
||||||
|
return R3.Component.CONTROLS_ORBIT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Controls.Keyboard) {
|
||||||
|
return R3.Component.CONTROLS_KEYBOARD;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Controls.Mouse) {
|
||||||
|
return R3.Component.CONTROLS_MOUSE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Controls.Touch) {
|
||||||
|
return R3.Component.CONTROLS_TOUCH;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Curve.Path.D2.Shape) {
|
||||||
|
return R3.Component.CURVE_PATH_D2_SHAPE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Curve.Path.D2) {
|
||||||
|
return R3.Component.CURVE_PATH_D2;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Curve.Path) {
|
||||||
|
return R3.Component.CURVE_PATH;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Curve) {
|
||||||
|
return R3.Component.CURVE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.CustomCode) {
|
||||||
|
return R3.Component.CUSTOM_CODE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.DomElement) {
|
||||||
|
return R3.Component.DOM_ELEMENT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.DrawRange) {
|
||||||
|
return R3.Component.DRAW_RANGE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Entity) {
|
||||||
|
return R3.Component.ENTITY;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.EntityManager) {
|
||||||
|
return R3.Component.ENTITY_MANAGER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Group) {
|
||||||
|
return R3.Component.GROUP;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.GUI) {
|
||||||
|
return R3.Component.GUI;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Image) {
|
||||||
|
return R3.Component.IMAGE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Mouse) {
|
||||||
|
return R3.Component.MOUSE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Plane) {
|
||||||
|
return R3.Component.PLANE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Project) {
|
||||||
|
return R3.Component.PROJECT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Renderer.D3.Canvas.Target) {
|
||||||
|
return R3.Component.RENDERER_D3_CANVAS_TARGET;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Renderer.D3.Canvas) {
|
||||||
|
return R3.Component.RENDERER_D3_CANVAS;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Renderer.D3.Target) {
|
||||||
|
return R3.Component.RENDERER_D3_TARGET;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Renderer.D3) {
|
||||||
|
return R3.Component.RENDERER_D3;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Renderer.D2) {
|
||||||
|
return R3.Component.RENDERER_D2;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Server) {
|
||||||
|
return R3.Component.SERVER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Socket.Receive) {
|
||||||
|
return R3.Component.SOCKET_RECEIVE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Socket.Cast) {
|
||||||
|
return R3.Component.SOCKET_CAST;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Sphere) {
|
||||||
|
return R3.Component.SPHERE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Stats) {
|
||||||
|
return R3.Component.STATS;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.User) {
|
||||||
|
return R3.Component.USER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.API.Video) {
|
||||||
|
return R3.Component.VIDEO;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Animation) {
|
||||||
|
return R3.Component.ANIMATION;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Object) {
|
||||||
|
return R3.Component.OBJECT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Audio) {
|
||||||
|
return R3.Component.AUDIO;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Bone) {
|
||||||
|
return R3.Component.BONE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Broadphase) {
|
||||||
|
return R3.Component.BROADPHASE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Camera.Perspective.Stereo) {
|
||||||
|
return R3.Component.CAMERA_PERSPECTIVE_STEREO;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Camera.Perspective) {
|
||||||
|
return R3.Component.CAMERA_PERSPECTIVE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Camera.Orthographic) {
|
||||||
|
return R3.Component.CAMERA_ORTHOGRAPHIC;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Camera.Cube) {
|
||||||
|
return R3.Component.CAMERA_CUBE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Composer) {
|
||||||
|
return R3.Component.COMPOSER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Effect.Stereo) {
|
||||||
|
return R3.Component.EFFECT_STEREO;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Effect.Parallax) {
|
||||||
|
return R3.Component.EFFECT_PARALLAX;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Effect.Anaglyph) {
|
||||||
|
return R3.Component.EFFECT_ANAGLYPH;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Fog) {
|
||||||
|
return R3.Component.FOG;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Font) {
|
||||||
|
return R3.Component.FONT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.FrictionContactMaterial) {
|
||||||
|
return R3.Component.FRICTION_CONTACT_MATERIAL;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.FrictionMaterial) {
|
||||||
|
return R3.Component.FRICTION_MATERIAL;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Box) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_BOX;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Circle) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_CIRCLE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Cone) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_CONE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Cylinder) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_CYLINDER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Dodecahedron) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_DODECAHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Extrude) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_EXTRUDE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Icosahedron) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_ICOSAHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Instanced) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_INSTANCED;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Lathe) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_LATHE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Octahedron) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_OCTAHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Parametric) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_PARAMETRIC;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Plane) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_PLANE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Polyhedron) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_POLYHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Ring) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_RING;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Shape) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_SHAPE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Sphere) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_SPHERE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Tetrahedron) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_TETRAHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Text) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_TEXT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Torus) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_TORUS;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.TorusKnot) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_TORUS_KNOT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer.Tube) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER_TUBE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Buffer) {
|
||||||
|
return R3.Component.GEOMETRY_BUFFER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Box) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_BOX;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Circle) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_CIRCLE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Cone) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_CONE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Cylinder) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_CYLINDER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Dodecahedron) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_DODECAHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Edges) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_EDGES;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Extrude) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_EXTRUDE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Icosahedron) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_ICOSAHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Lathe) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_LATHE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Octahedron) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_OCTAHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Parametric) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_PARAMETRIC;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Plane) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_PLANE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Polyhedron) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_POLYHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Ring) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_RING;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Shape) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_SHAPE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Sphere) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_SPHERE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Tetrahedron) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_TETRAHEDRON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Text) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_TEXT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Torus) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_TORUS;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.TorusKnot) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_TORUS_KNOT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Tube) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_TUBE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal.Wireframe) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL_WIREFRAME;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry.Normal) {
|
||||||
|
return R3.Component.GEOMETRY_NORMAL;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Geometry) {
|
||||||
|
return R3.Component.GEOMETRY;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Light.Ambient) {
|
||||||
|
return R3.Component.LIGHT_AMBIENT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Light.Directional) {
|
||||||
|
return R3.Component.LIGHT_DIRECTIONAL;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Light.Hemisphere) {
|
||||||
|
return R3.Component.LIGHT_HEMISPHERE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Light.Point) {
|
||||||
|
return R3.Component.LIGHT_POINT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Light.RectArea) {
|
||||||
|
return R3.Component.LIGHT_RECT_AREA;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Light.Spot) {
|
||||||
|
return R3.Component.LIGHT_SPOT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Material.Basic) {
|
||||||
|
return R3.Component.MATERIAL_BASIC;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Material.Phong) {
|
||||||
|
return R3.Component.MATERIAL_PHONG;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Material.Points) {
|
||||||
|
return R3.Component.MATERIAL_POINTS;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Material.Shader) {
|
||||||
|
return R3.Component.MATERIAL_SHADER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Material.Shader.Raw) {
|
||||||
|
return R3.Component.MATERIAL_SHADER_RAW;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Material.Standard) {
|
||||||
|
return R3.Component.MATERIAL_STANDARD;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Mesh) {
|
||||||
|
return R3.Component.MESH;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.ParticleEngine) {
|
||||||
|
return R3.Component.PARTICLE_ENGINE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Particle) {
|
||||||
|
return R3.Component.PARTICLE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Pass.Bloom) {
|
||||||
|
return R3.Component.PASS_BLOOM;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Pass.FXAA) {
|
||||||
|
return R3.Component.PASS_FXAA;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Pass.Render) {
|
||||||
|
return R3.Component.PASS_RENDER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Pass.SSAO) {
|
||||||
|
return R3.Component.PASS_SSAO;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.PhysicsWorld) {
|
||||||
|
return R3.Component.PHYSICS_WORLD;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Raycaster) {
|
||||||
|
return R3.Component.RAYCASTER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.RaycastVehicle) {
|
||||||
|
return R3.Component.RAYCAST_VEHICLE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.RaycastWheel) {
|
||||||
|
return R3.Component.RAYCAST_WHEEL;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.RenderTarget.Cube) {
|
||||||
|
return R3.Component.RENDER_TARGET_CUBE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.RenderTarget) {
|
||||||
|
return R3.Component.RENDER_TARGET;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.RigidBody) {
|
||||||
|
return R3.Component.RIGID_BODY;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Scene) {
|
||||||
|
return R3.Component.SCENE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Shader.Vertex) {
|
||||||
|
return R3.Component.SHADER_VERTEX;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Shader.Fragment) {
|
||||||
|
return R3.Component.SHADER_FRAGMENT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Shader) {
|
||||||
|
return R3.Component.SHADER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Shadow.Directional) {
|
||||||
|
return R3.Component.SHADOW_DIRECTIONAL;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Shadow.Spot) {
|
||||||
|
return R3.Component.SHADOW_SPOT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Shadow) {
|
||||||
|
return R3.Component.SHADOW;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Shape) {
|
||||||
|
return R3.Component.SHAPE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Skeleton) {
|
||||||
|
return R3.Component.SKELETON;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Solver) {
|
||||||
|
return R3.Component.SOLVER;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Spline) {
|
||||||
|
return R3.Component.SPLINE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Text) {
|
||||||
|
return R3.Component.TEXT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Texture.Canvas) {
|
||||||
|
return R3.Component.TEXTURE_CANVAS;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Texture.Cube) {
|
||||||
|
return R3.Component.TEXTURE_CUBE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Texture.Image) {
|
||||||
|
return R3.Component.TEXTURE_IMAGE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Texture) {
|
||||||
|
return R3.Component.TEXTURE;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Viewport.FixedAspect) {
|
||||||
|
return R3.Component.VIEWPORT_FIXED_ASPECT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Viewport.ZoomedAspect) {
|
||||||
|
return R3.Component.VIEWPORT_ZOOMED_ASPECT;
|
||||||
|
}
|
||||||
|
if (this instanceof R3.D3.API.Viewport) {
|
||||||
|
return R3.Component.VIEWPORT;
|
||||||
|
}
|
||||||
|
};
|
File diff suppressed because it is too large
Load Diff
|
@ -1,19 +0,0 @@
|
||||||
/**
|
|
||||||
* API Component Interface - Do not construct objects of this type directly
|
|
||||||
* @param componentType
|
|
||||||
* @param parentEntity
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.API.Component = function(
|
|
||||||
componentType,
|
|
||||||
parentEntity
|
|
||||||
) {
|
|
||||||
this.componentType = componentType;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(parentEntity)) {
|
|
||||||
parentEntity = null;
|
|
||||||
}
|
|
||||||
this.parentEntity = parentEntity;
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.API.Component.prototype.constructor = R3.API.Component;
|
|
|
@ -1,31 +1,29 @@
|
||||||
/**
|
/**
|
||||||
* R3.API.Box3
|
* R3.API.Box3
|
||||||
* @param id
|
* @param apiComponent
|
||||||
* @param name
|
|
||||||
* @param parentEntity
|
|
||||||
* @param min
|
* @param min
|
||||||
* @param max
|
* @param max
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Box3 = function (
|
R3.API.Box3 = function(
|
||||||
id,
|
apiComponent,
|
||||||
name,
|
|
||||||
parentEntity,
|
|
||||||
min,
|
min,
|
||||||
max
|
max
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent)) {
|
||||||
id = R3.Utils.RandomId();
|
apiComponent = {};
|
||||||
}
|
}
|
||||||
this.id = id;
|
this.apiComponent = apiComponent;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(name)) {
|
R3.API.Component.call(
|
||||||
name = 'Box (' + id + ')';
|
this,
|
||||||
}
|
this.apiComponent.parent,
|
||||||
this.name = name;
|
this.apiComponent.id,
|
||||||
|
this.apiComponent.name
|
||||||
|
);
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(min)) {
|
if (R3.Utils.UndefinedOrNull(min)) {
|
||||||
min = new R3.API.Vector3(0,0,0);
|
min = new R3.API.Vector3();
|
||||||
}
|
}
|
||||||
this.min = min;
|
this.min = min;
|
||||||
|
|
||||||
|
@ -33,12 +31,6 @@ R3.API.Box3 = function (
|
||||||
max = new R3.API.Vector3(1,1,1);
|
max = new R3.API.Vector3(1,1,1);
|
||||||
}
|
}
|
||||||
this.max = max;
|
this.max = max;
|
||||||
|
|
||||||
R3.API.Component.call(
|
|
||||||
this,
|
|
||||||
R3.Component.BOX3,
|
|
||||||
parentEntity
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Box3.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Box3.prototype = Object.create(R3.API.Component.prototype);
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* R3.API.Canvas
|
* R3.API.Canvas
|
||||||
* @param id
|
* @param apiComponent
|
||||||
* @param name
|
|
||||||
* @param parentEntity
|
|
||||||
* @param parentTexture
|
|
||||||
* @param autoUpdateSize
|
* @param autoUpdateSize
|
||||||
* @param width
|
* @param width
|
||||||
* @param height
|
* @param height
|
||||||
|
@ -14,10 +11,7 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Canvas = function(
|
R3.API.Canvas = function(
|
||||||
id,
|
apiComponent,
|
||||||
name,
|
|
||||||
parentEntity,
|
|
||||||
parentTexture,
|
|
||||||
autoUpdateSize,
|
autoUpdateSize,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -26,20 +20,18 @@ R3.API.Canvas = function(
|
||||||
texts,
|
texts,
|
||||||
textBaseline
|
textBaseline
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
|
||||||
id = R3.Utils.RandomId();
|
|
||||||
}
|
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(name)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent)) {
|
||||||
name = 'Canvas (' + id + ')';
|
apiComponent = {};
|
||||||
}
|
}
|
||||||
this.name = name;
|
this.apiComponent = apiComponent;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(parentTexture)) {
|
R3.API.Component.call(
|
||||||
parentTexture = null;
|
this,
|
||||||
}
|
this.apiComponent.parent,
|
||||||
this.parentTexture = parentTexture;
|
this.apiComponent.id,
|
||||||
|
this.apiComponent.name
|
||||||
|
);
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
||||||
autoUpdateSize = true;
|
autoUpdateSize = true;
|
||||||
|
@ -76,11 +68,6 @@ R3.API.Canvas = function(
|
||||||
}
|
}
|
||||||
this.textBaseline = textBaseline;
|
this.textBaseline = textBaseline;
|
||||||
|
|
||||||
R3.API.Component.call(
|
|
||||||
this,
|
|
||||||
R3.Component.CANVAS,
|
|
||||||
parentEntity
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Canvas.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Canvas.prototype = Object.create(R3.API.Component.prototype);
|
||||||
|
|
|
@ -1,47 +1,15 @@
|
||||||
/**
|
/**
|
||||||
* Raw Clock API object - should always correspond with the Clock Schema
|
* R3.API.Clock
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param id
|
* @param apiComponent
|
||||||
* @param name
|
|
||||||
* @param parentEntity
|
|
||||||
*/
|
*/
|
||||||
R3.API.Clock = function(
|
R3.API.Clock = function(
|
||||||
id,
|
apiComponent
|
||||||
name,
|
|
||||||
parentEntity
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
__API_COMPONENT_MACRO__
|
||||||
id = R3.Utils.RandomId();
|
|
||||||
}
|
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(name)) {
|
|
||||||
name = 'Clock (' + this.id + ')';
|
|
||||||
}
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
R3.API.Component.call(
|
|
||||||
this,
|
|
||||||
R3.Component.CLOCK,
|
|
||||||
parentEntity
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Clock.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Clock.prototype = Object.create(R3.API.Component.prototype);
|
||||||
R3.API.Clock.prototype.constructor = R3.API.Clock;
|
R3.API.Clock.prototype.constructor = R3.API.Clock;
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an API camera from an Object camera
|
|
||||||
* @param objectClock
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.API.Clock.FromObject = function(objectClock) {
|
|
||||||
|
|
||||||
return new R3.API.Clock(
|
|
||||||
objectClock.id,
|
|
||||||
objectClock.name,
|
|
||||||
objectClock.parentEntity
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
/**
|
/**
|
||||||
* API Color
|
* API Color
|
||||||
|
* @param parent
|
||||||
* @param r
|
* @param r
|
||||||
* @param g
|
* @param g
|
||||||
* @param b
|
* @param b
|
||||||
* @param a
|
* @param a
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Color = function (r, g, b, a) {
|
R3.API.Color = function(
|
||||||
|
r,
|
||||||
|
g,
|
||||||
|
b,
|
||||||
|
a
|
||||||
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(r)) {
|
if (R3.Utils.UndefinedOrNull(r)) {
|
||||||
r = 1;
|
r = 1;
|
||||||
}
|
}
|
||||||
|
@ -29,23 +35,3 @@ R3.API.Color = function (r, g, b, a) {
|
||||||
this.a = a;
|
this.a = a;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an API color from an Object color
|
|
||||||
* @param objectColor
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.API.Color.FromObject = function(objectColor) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(objectColor)){
|
|
||||||
objectColor = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return new R3.API.Color(
|
|
||||||
objectColor.r,
|
|
||||||
objectColor.g,
|
|
||||||
objectColor.b,
|
|
||||||
objectColor.a
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,51 +1,48 @@
|
||||||
/**
|
/**
|
||||||
* Raw Controls API object
|
* R3.API.Controls
|
||||||
|
* @param parent
|
||||||
* @param id
|
* @param id
|
||||||
* @param controlsType
|
|
||||||
* @param name
|
* @param name
|
||||||
* @param canvas
|
* @param canvas
|
||||||
* @param parentEntity
|
|
||||||
* @property controlsType
|
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Controls = function(
|
R3.API.Controls = function(
|
||||||
|
parent,
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
controlsType,
|
canvas
|
||||||
canvas,
|
|
||||||
parentEntity
|
|
||||||
) {
|
) {
|
||||||
|
R3.API.Component.call(
|
||||||
|
this,
|
||||||
|
parent
|
||||||
|
);
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
}
|
}
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(controlsType)) {
|
|
||||||
controlsType = R3.API.Controls.CONTROLS_TYPE_NONE;
|
|
||||||
}
|
|
||||||
this.controlsType = controlsType;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(name)) {
|
if (R3.Utils.UndefinedOrNull(name)) {
|
||||||
|
|
||||||
name = 'Controls';
|
name = 'Controls';
|
||||||
|
|
||||||
switch (this.controlsType) {
|
switch (this.componentType) {
|
||||||
case R3.API.Controls.CONTROLS_TYPE_TOUCH :
|
case R3.Component.CONTROLS_TOUCH:
|
||||||
name = 'Controls Touch';
|
name = 'Controls Touch';
|
||||||
break;
|
break;
|
||||||
case R3.API.Controls.CONTROLS_TYPE_KEYBOARD :
|
case R3.Component.CONTROLS_KEYBOARD :
|
||||||
name = 'Controls Keyboard';
|
name = 'Controls Keyboard';
|
||||||
break;
|
break;
|
||||||
case R3.API.Controls.CONTROLS_TYPE_MOUSE :
|
case R3.Component.CONTROLS_MOUSE :
|
||||||
name = 'Controls Mouse';
|
name = 'Controls Mouse';
|
||||||
break;
|
break;
|
||||||
case R3.API.Controls.CONTROLS_TYPE_EDITOR :
|
case R3.Component.CONTROLS_EDITOR :
|
||||||
name = 'Controls Editor';
|
name = 'Controls Editor';
|
||||||
break;
|
break;
|
||||||
case R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON :
|
case R3.Component.CONTROLS_FIRST_PERSON :
|
||||||
name = 'Controls First Person';
|
name = 'Controls First Person';
|
||||||
break;
|
break;
|
||||||
case R3.API.Controls.CONTROLS_TYPE_ORBIT :
|
case R3.Component.CONTROLS_ORBIT :
|
||||||
name = 'Controls Orbit';
|
name = 'Controls Orbit';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -58,61 +55,7 @@ R3.API.Controls = function(
|
||||||
canvas = null;
|
canvas = null;
|
||||||
}
|
}
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
|
|
||||||
R3.API.Component.call(
|
|
||||||
this,
|
|
||||||
R3.API.Controls.GetComponentType(this.controlsType),
|
|
||||||
parentEntity
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Controls.prototype = Object.create(R3.API.Component.prototype);
|
||||||
R3.API.Controls.prototype.constructor = R3.API.Controls;
|
R3.API.Controls.prototype.constructor = R3.API.Controls;
|
||||||
|
|
||||||
R3.API.Controls.GetComponentType = function(controlsType) {
|
|
||||||
|
|
||||||
var componentType = null;
|
|
||||||
|
|
||||||
switch (controlsType) {
|
|
||||||
case R3.API.Controls.CONTROLS_TYPE_NONE :
|
|
||||||
componentType = R3.Component.CONTROLS;
|
|
||||||
break;
|
|
||||||
case R3.API.Controls.CONTROLS_TYPE_TOUCH :
|
|
||||||
componentType = R3.Component.CONTROLS_TOUCH;
|
|
||||||
break;
|
|
||||||
case R3.API.Controls.CONTROLS_TYPE_KEYBOARD :
|
|
||||||
componentType = R3.Component.CONTROLS_KEYBOARD;
|
|
||||||
break;
|
|
||||||
case R3.API.Controls.CONTROLS_TYPE_MOUSE :
|
|
||||||
componentType = R3.Component.CONTROLS_MOUSE;
|
|
||||||
break;
|
|
||||||
case R3.API.Controls.CONTROLS_TYPE_EDITOR :
|
|
||||||
componentType = R3.Component.CONTROLS_EDITOR;
|
|
||||||
break;
|
|
||||||
case R3.API.Controls.CONTROLS_TYPE_ORBIT :
|
|
||||||
componentType = R3.Component.CONTROLS_ORBIT;
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
throw new Error('unhandled controls type: ' + controlsType);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return componentType;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controls Type
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
R3.API.Controls.CONTROLS_TYPE_NONE = 0x0;
|
|
||||||
R3.API.Controls.CONTROLS_TYPE_TOUCH = 0x1;
|
|
||||||
R3.API.Controls.CONTROLS_TYPE_KEYBOARD = 0x2;
|
|
||||||
R3.API.Controls.CONTROLS_TYPE_MOUSE = 0x3;
|
|
||||||
R3.API.Controls.CONTROLS_TYPE_EDITOR = 0x4;
|
|
||||||
R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON = 0x5;
|
|
||||||
R3.API.Controls.CONTROLS_TYPE_ORBIT = 0x6;
|
|
||||||
|
|
||||||
|
|
||||||
R3.API.Controls.D3 = function() {};
|
|
||||||
R3.API.Controls.D3.prototype = Object.create(R3.API.Controls.prototype);
|
|
||||||
R3.API.Controls.D3.prototype.constructor = R3.API.Controls.D3;
|
|
|
@ -1,43 +1,28 @@
|
||||||
/**
|
/**
|
||||||
* @param apiControls
|
* @param apiControlsD3
|
||||||
* @param raycaster
|
* @param raycaster
|
||||||
* @param camera
|
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Controls.D3.Editor = function(
|
R3.API.Controls.D3.Editor = function(
|
||||||
apiControls,
|
apiControlsD3,
|
||||||
raycaster,
|
raycaster
|
||||||
camera
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
|
||||||
apiControls = {
|
apiControlsD3 = {};
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_EDITOR
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
|
R3.API.Controls.D3.call(
|
||||||
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_EDITOR;
|
this,
|
||||||
}
|
apiControlsD3,
|
||||||
|
apiControlsD3.camera
|
||||||
|
);
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(raycaster)) {
|
if (R3.Utils.UndefinedOrNull(raycaster)) {
|
||||||
raycaster = new R3.D3.API.Raycaster();
|
raycaster = new R3.D3.API.Raycaster();
|
||||||
}
|
}
|
||||||
this.raycaster = raycaster;
|
this.raycaster = raycaster;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(camera)) {
|
|
||||||
camera = null;
|
|
||||||
}
|
|
||||||
this.camera = camera;
|
|
||||||
|
|
||||||
R3.API.Controls.call(
|
|
||||||
this,
|
|
||||||
apiControls.id,
|
|
||||||
apiControls.name,
|
|
||||||
apiControls.controlsType,
|
|
||||||
apiControls.canvas,
|
|
||||||
apiControls.parentEntity
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.D3.Editor.prototype = Object.create(R3.API.Controls.D3.prototype);
|
R3.API.Controls.D3.Editor.prototype = Object.create(R3.API.Controls.D3.prototype);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* R3.API.Controls.D3.FirstPerson
|
* R3.API.Controls.D3.FirstPerson
|
||||||
* @param apiControls
|
* @param apiControlsD3
|
||||||
* @param camera
|
|
||||||
* @param enabled
|
* @param enabled
|
||||||
* @param movementSpeed
|
* @param movementSpeed
|
||||||
* @param lookSpeed
|
* @param lookSpeed
|
||||||
|
@ -19,8 +18,7 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Controls.D3.FirstPerson = function(
|
R3.API.Controls.D3.FirstPerson = function(
|
||||||
apiControls,
|
apiControlsD3,
|
||||||
camera,
|
|
||||||
enabled,
|
enabled,
|
||||||
movementSpeed,
|
movementSpeed,
|
||||||
lookSpeed,
|
lookSpeed,
|
||||||
|
@ -37,20 +35,15 @@ R3.API.Controls.D3.FirstPerson = function(
|
||||||
autoSpeedFactor
|
autoSpeedFactor
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
|
||||||
apiControls = {
|
apiControlsD3 = {};
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
|
R3.API.Controls.D3.call(
|
||||||
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON;
|
this,
|
||||||
}
|
apiControlsD3,
|
||||||
|
apiControlsD3.camera
|
||||||
if (R3.Utils.UndefinedOrNull(camera)) {
|
);
|
||||||
camera = null;
|
|
||||||
}
|
|
||||||
this.camera = camera;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(enabled)) {
|
if (R3.Utils.UndefinedOrNull(enabled)) {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
|
@ -122,14 +115,6 @@ R3.API.Controls.D3.FirstPerson = function(
|
||||||
}
|
}
|
||||||
this.autoSpeedFactor = autoSpeedFactor;
|
this.autoSpeedFactor = autoSpeedFactor;
|
||||||
|
|
||||||
R3.API.Controls.call(
|
|
||||||
this,
|
|
||||||
apiControls.id,
|
|
||||||
apiControls.name,
|
|
||||||
apiControls.controlsType,
|
|
||||||
apiControls.canvas,
|
|
||||||
apiControls.parentEntity
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.D3.FirstPerson.prototype = Object.create(R3.API.Controls.D3.prototype);
|
R3.API.Controls.D3.FirstPerson.prototype = Object.create(R3.API.Controls.D3.prototype);
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* R3.API.Controls.D3.Orbit
|
* R3.API.Controls.D3.Orbit
|
||||||
* @param apiControls
|
* @param apiControlsD3
|
||||||
* @param camera
|
|
||||||
* @param target
|
* @param target
|
||||||
* @param enabled
|
* @param enabled
|
||||||
* @param minDistance
|
|
||||||
* @param maxDistance
|
|
||||||
* @param minZoom
|
|
||||||
* @param maxZoom
|
|
||||||
* @param minPolarAngle
|
* @param minPolarAngle
|
||||||
* @param maxPolarAngle
|
* @param maxPolarAngle
|
||||||
* @param enableDamping
|
* @param enableDamping
|
||||||
|
@ -24,8 +19,7 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Controls.D3.Orbit = function(
|
R3.API.Controls.D3.Orbit = function(
|
||||||
apiControls,
|
apiControlsD3,
|
||||||
camera,
|
|
||||||
target,
|
target,
|
||||||
enabled,
|
enabled,
|
||||||
minPolarAngle,
|
minPolarAngle,
|
||||||
|
@ -43,20 +37,15 @@ R3.API.Controls.D3.Orbit = function(
|
||||||
enableKeys
|
enableKeys
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
|
||||||
apiControls = {
|
apiControlsD3 = {};
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_ORBIT
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
|
R3.API.Controls.D3.call(
|
||||||
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_ORBIT;
|
this,
|
||||||
}
|
apiControlsD3,
|
||||||
|
apiControlsD3.camera
|
||||||
if (R3.Utils.UndefinedOrNull(camera)) {
|
);
|
||||||
camera = null;
|
|
||||||
}
|
|
||||||
this.camera = camera;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(target)) {
|
if (R3.Utils.UndefinedOrNull(target)) {
|
||||||
target = null;
|
target = null;
|
||||||
|
@ -133,14 +122,6 @@ R3.API.Controls.D3.Orbit = function(
|
||||||
}
|
}
|
||||||
this.enableKeys = enableKeys;
|
this.enableKeys = enableKeys;
|
||||||
|
|
||||||
R3.API.Controls.call(
|
|
||||||
this,
|
|
||||||
apiControls.id,
|
|
||||||
apiControls.name,
|
|
||||||
apiControls.controlsType,
|
|
||||||
apiControls.canvas,
|
|
||||||
apiControls.parentEntity
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.D3.Orbit.prototype = Object.create(R3.API.Controls.D3.prototype);
|
R3.API.Controls.D3.Orbit.prototype = Object.create(R3.API.Controls.D3.prototype);
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/**
|
||||||
|
* Raw Controls API object
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.API.Controls.D3 = function(
|
||||||
|
apiControls,
|
||||||
|
camera
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
||||||
|
apiControls = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
R3.API.Controls.call(
|
||||||
|
this,
|
||||||
|
apiControls.parent,
|
||||||
|
apiControls.id,
|
||||||
|
apiControls.name,
|
||||||
|
apiControls.canvas
|
||||||
|
);
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(camera)) {
|
||||||
|
camera = null;
|
||||||
|
}
|
||||||
|
this.camera = camera;
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.API.Controls.D3.prototype = Object.create(R3.API.Controls.prototype);
|
||||||
|
R3.API.Controls.D3.prototype.constructor = R3.API.Controls.D3;
|
|
@ -5,24 +5,12 @@
|
||||||
R3.API.Controls.Keyboard = function(
|
R3.API.Controls.Keyboard = function(
|
||||||
apiControls
|
apiControls
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
|
||||||
apiControls = {
|
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_KEYBOARD
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
|
|
||||||
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_KEYBOARD;
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Controls.call(
|
R3.API.Controls.call(
|
||||||
this,
|
this,
|
||||||
|
apiControls.parent,
|
||||||
apiControls.id,
|
apiControls.id,
|
||||||
apiControls.name,
|
apiControls.name,
|
||||||
apiControls.controlsType,
|
apiControls.canvas
|
||||||
apiControls.canvas,
|
|
||||||
apiControls.parentEntity
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,27 +5,14 @@
|
||||||
R3.API.Controls.Mouse = function(
|
R3.API.Controls.Mouse = function(
|
||||||
apiControls
|
apiControls
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
|
||||||
apiControls = {
|
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_MOUSE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
|
|
||||||
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_MOUSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Controls.call(
|
R3.API.Controls.call(
|
||||||
this,
|
this,
|
||||||
|
apiControls.parent,
|
||||||
apiControls.id,
|
apiControls.id,
|
||||||
apiControls.name,
|
apiControls.name,
|
||||||
apiControls.controlsType,
|
apiControls.canvas
|
||||||
apiControls.canvas,
|
|
||||||
apiControls.parentEntity
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.Mouse.prototype = Object.create(R3.API.Controls.prototype);
|
R3.API.Controls.Mouse.prototype = Object.create(R3.API.Controls.prototype);
|
||||||
R3.API.Controls.Mouse.prototype.constructor = R3.API.Controls.Mouse;
|
R3.API.Controls.Mouse.prototype.constructor = R3.API.Controls.Mouse;
|
||||||
|
|
||||||
|
|
|
@ -8,29 +8,19 @@ R3.API.Controls.Touch = function(
|
||||||
sensitivity
|
sensitivity
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
R3.API.Controls.call(
|
||||||
apiControls = {
|
this,
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_TOUCH
|
apiControls.parent,
|
||||||
};
|
apiControls.id,
|
||||||
}
|
apiControls.name,
|
||||||
|
apiControls.canvas
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
|
);
|
||||||
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_TOUCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(sensitivity)) {
|
if (R3.Utils.UndefinedOrNull(sensitivity)) {
|
||||||
sensitivity = 5;
|
sensitivity = 5;
|
||||||
}
|
}
|
||||||
this.sensitivity = sensitivity;
|
this.sensitivity = sensitivity;
|
||||||
|
|
||||||
R3.API.Controls.call(
|
|
||||||
this,
|
|
||||||
apiControls.id,
|
|
||||||
apiControls.name,
|
|
||||||
apiControls.controlsType,
|
|
||||||
apiControls.canvas,
|
|
||||||
apiControls.parentEntity
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.Touch.prototype = Object.create(R3.API.Controls.prototype);
|
R3.API.Controls.Touch.prototype = Object.create(R3.API.Controls.prototype);
|
||||||
|
|
|
@ -3,22 +3,21 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param curveType
|
* @param curveType
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param arcLenghDivisions
|
* @param arcLenghDivisions
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Curve = function (
|
R3.API.Curve = function(
|
||||||
|
parent,
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
curveType,
|
curveType,
|
||||||
parentEntity,
|
|
||||||
arcLenghDivisions
|
arcLenghDivisions
|
||||||
) {
|
) {
|
||||||
|
R3.API.Component.call(
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
this,
|
||||||
id = R3.Utils.RandomId();
|
parent
|
||||||
}
|
);
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(curveType)) {
|
if (R3.Utils.UndefinedOrNull(curveType)) {
|
||||||
curveType = R3.API.Curve.CURVE_TYPE_NONE;
|
curveType = R3.API.Curve.CURVE_TYPE_NONE;
|
||||||
|
@ -50,7 +49,7 @@ R3.API.Curve = function (
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.API.Curve.GetComponentType(this.curveType),
|
R3.API.Curve.GetComponentType(this.curveType),
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @param curves
|
* @param curves
|
||||||
* @param autoClose
|
* @param autoClose
|
||||||
*/
|
*/
|
||||||
R3.API.Curve.Path = function (
|
R3.API.Curve.Path = function(
|
||||||
apiCurve,
|
apiCurve,
|
||||||
curves,
|
curves,
|
||||||
autoClose
|
autoClose
|
||||||
|
@ -35,7 +35,7 @@ R3.API.Curve.Path = function (
|
||||||
apiCurve.id,
|
apiCurve.id,
|
||||||
apiCurve.name,
|
apiCurve.name,
|
||||||
apiCurve.curveType,
|
apiCurve.curveType,
|
||||||
apiCurve.parentEntity,
|
apiCurve.parent,
|
||||||
apiCurve.arcLenghDivisions
|
apiCurve.arcLenghDivisions
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @param apiCurvePath
|
* @param apiCurvePath
|
||||||
* @param points
|
* @param points
|
||||||
*/
|
*/
|
||||||
R3.API.Curve.Path.D2 = function (
|
R3.API.Curve.Path.D2 = function(
|
||||||
apiCurvePath,
|
apiCurvePath,
|
||||||
points
|
points
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param apiCurvePathD2
|
* @param apiCurvePathD2
|
||||||
*/
|
*/
|
||||||
R3.API.Curve.Path.D2.Shape = function (
|
R3.API.Curve.Path.D2.Shape = function(
|
||||||
apiCurvePathD2
|
apiCurvePathD2
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(apiCurvePathD2)) {
|
if (R3.Utils.UndefinedOrNull(apiCurvePathD2)) {
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
* @param name
|
* @param name
|
||||||
* @param eventId
|
* @param eventId
|
||||||
* @param code
|
* @param code
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.CustomCode = function (
|
R3.API.CustomCode = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
eventId,
|
eventId,
|
||||||
code,
|
code,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -37,7 +37,7 @@ R3.API.CustomCode = function (
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.CUSTOM_CODE,
|
R3.Component.CUSTOM_CODE,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param domElementId
|
* @param domElementId
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.DomElement = function(
|
R3.API.DomElement = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
domElementId,
|
domElementId,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -31,7 +31,7 @@ R3.API.DomElement = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.DOM_ELEMENT,
|
R3.Component.DOM_ELEMENT,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,11 +43,11 @@ R3.API.DomElement.prototype.constructor = R3.API.DomElement;
|
||||||
* @param objectDomElement
|
* @param objectDomElement
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.DomElement.FromObject = function (objectDomElement) {
|
R3.API.DomElement.FromObject = function(objectDomElement) {
|
||||||
return new R3.API.DomElement(
|
return new R3.API.DomElement(
|
||||||
objectDomElement.id,
|
objectDomElement.id,
|
||||||
objectDomElement.name,
|
objectDomElement.name,
|
||||||
objectDomElement.domElementId,
|
objectDomElement.domElementId,
|
||||||
objectDomElement.parentEntity
|
objectDomElement.parent
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param start
|
* @param start
|
||||||
* @param count
|
* @param count
|
||||||
*/
|
*/
|
||||||
R3.API.DrawRange = function (
|
R3.API.DrawRange = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parent,
|
||||||
start,
|
start,
|
||||||
count
|
count
|
||||||
) {
|
) {
|
||||||
|
@ -37,7 +37,7 @@ R3.API.DrawRange = function (
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.DRAW_RANGE,
|
R3.Component.DRAW_RANGE,
|
||||||
parentEntity
|
parent
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
* @param name
|
* @param name
|
||||||
* @param entities R3.API.Entity[]
|
* @param entities R3.API.Entity[]
|
||||||
* @param defaultEntity
|
* @param defaultEntity
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
*/
|
*/
|
||||||
R3.API.EntityManager = function(
|
R3.API.EntityManager = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
entities,
|
entities,
|
||||||
defaultEntity,
|
defaultEntity,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -37,7 +37,7 @@ R3.API.EntityManager = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.ENTITY_MANAGER,
|
R3.Component.ENTITY_MANAGER,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ R3.API.EntityManager.prototype.constructor = R3.API.EntityManager;
|
||||||
R3.API.EntityManager.FromObject = function(objectEntityManager) {
|
R3.API.EntityManager.FromObject = function(objectEntityManager) {
|
||||||
|
|
||||||
var apiEntities = objectEntityManager.entities.map(
|
var apiEntities = objectEntityManager.entities.map(
|
||||||
function (objectEntity) {
|
function(objectEntity) {
|
||||||
return R3.API.Entity.FromObject(objectEntity);
|
return R3.API.Entity.FromObject(objectEntity);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -62,6 +62,6 @@ R3.API.EntityManager.FromObject = function(objectEntityManager) {
|
||||||
objectEntityManager.name,
|
objectEntityManager.name,
|
||||||
apiEntities,
|
apiEntities,
|
||||||
objectEntityManager.defaultEntity,
|
objectEntityManager.defaultEntity,
|
||||||
objectEntityManager.parentEntity
|
objectEntityManager.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param components R3.Component[]
|
* @param components R3.Component[]
|
||||||
* @param parentEntity R3.Entity
|
* @param parent R3.Entity
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Entity = function(
|
R3.API.Entity = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
components,
|
components,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -27,10 +27,16 @@ R3.API.Entity = function(
|
||||||
}
|
}
|
||||||
this.components = components;
|
this.components = components;
|
||||||
|
|
||||||
|
var componentType = R3.Component.ENTITY;
|
||||||
|
|
||||||
|
if (this instanceof R3.API.Project) {
|
||||||
|
componentType = R3.Component.PROJECT;
|
||||||
|
}
|
||||||
|
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.ENTITY,
|
componentType,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +53,6 @@ R3.API.Entity.FromObject = function(objectEntity) {
|
||||||
objectEntity.id,
|
objectEntity.id,
|
||||||
objectEntity.name,
|
objectEntity.name,
|
||||||
objectEntity.components,
|
objectEntity.components,
|
||||||
objectEntity.parentEntity
|
objectEntity.parent
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param start
|
* @param start
|
||||||
* @param count
|
* @param count
|
||||||
* @param materialIndex
|
* @param materialIndex
|
||||||
*/
|
*/
|
||||||
R3.API.Group = function (
|
R3.API.Group = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parent,
|
||||||
start,
|
start,
|
||||||
count,
|
count,
|
||||||
materialIndex
|
materialIndex
|
||||||
|
@ -44,7 +44,7 @@ R3.API.Group = function (
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.GROUP,
|
R3.Component.GROUP,
|
||||||
parentEntity
|
parent
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param domElement
|
* @param domElement
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.GUI = function(
|
R3.API.GUI = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
domElement,
|
domElement,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -31,7 +31,7 @@ R3.API.GUI = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.GUI,
|
R3.Component.GUI,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ R3.API.GUI.FromObject = function(objectGUI) {
|
||||||
objectGUI.id,
|
objectGUI.id,
|
||||||
objectGUI.name,
|
objectGUI.name,
|
||||||
apiDomElement,
|
apiDomElement,
|
||||||
objectGUI.parentEntity
|
objectGUI.parent
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* R3.API.Image
|
* R3.API.Image
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param parentTexture
|
* @param parentTexture
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* @param extension
|
* @param extension
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
R3.API.Image = function(
|
R3.API.Image = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parent,
|
||||||
parentTexture,
|
parentTexture,
|
||||||
fileName,
|
fileName,
|
||||||
extension,
|
extension,
|
||||||
|
@ -92,7 +92,7 @@ R3.API.Image = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.IMAGE,
|
R3.Component.IMAGE,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,14 +83,14 @@ R3.API.Matrix4.FromObject = function(objectMatrix) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Matrix4.prototype.rotationMatrixX = function (radians) {
|
R3.API.Matrix4.prototype.rotationMatrixX = function(radians) {
|
||||||
this.identity();
|
this.identity();
|
||||||
this.rows[1] = new R3.API.Vector4(0, Math.cos(radians), -1 * Math.sin(radians), 0);
|
this.rows[1] = new R3.API.Vector4(0, Math.cos(radians), -1 * Math.sin(radians), 0);
|
||||||
this.rows[2] = new R3.API.Vector4(0, Math.sin(radians), Math.cos(radians), 0);
|
this.rows[2] = new R3.API.Vector4(0, Math.sin(radians), Math.cos(radians), 0);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Matrix4.prototype.rotationMatrixY = function (radians) {
|
R3.API.Matrix4.prototype.rotationMatrixY = function(radians) {
|
||||||
this.identity();
|
this.identity();
|
||||||
this.rows[0] = new R3.API.Vector4(
|
this.rows[0] = new R3.API.Vector4(
|
||||||
Math.cos(radians),
|
Math.cos(radians),
|
||||||
|
@ -107,32 +107,32 @@ R3.API.Matrix4.prototype.rotationMatrixY = function (radians) {
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Matrix4.prototype.rotationMatrixZ = function (radians) {
|
R3.API.Matrix4.prototype.rotationMatrixZ = function(radians) {
|
||||||
this.identity();
|
this.identity();
|
||||||
this.rows[0] = new R3.API.Vector4(Math.cos(radians), -1 * Math.sin(radians), 0, 0);
|
this.rows[0] = new R3.API.Vector4(Math.cos(radians), -1 * Math.sin(radians), 0, 0);
|
||||||
this.rows[1] = new R3.API.Vector4(Math.sin(radians), Math.cos(radians), 0, 0);
|
this.rows[1] = new R3.API.Vector4(Math.sin(radians), Math.cos(radians), 0, 0);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Matrix4.prototype.rotateX = function (radians, point) {
|
R3.API.Matrix4.prototype.rotateX = function(radians, point) {
|
||||||
this.identity();
|
this.identity();
|
||||||
this.rotationMatrixX(radians);
|
this.rotationMatrixX(radians);
|
||||||
return this.multiply(point);
|
return this.multiply(point);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Matrix4.prototype.rotateY = function (radians, point) {
|
R3.API.Matrix4.prototype.rotateY = function(radians, point) {
|
||||||
this.identity();
|
this.identity();
|
||||||
this.rotationMatrixY(radians);
|
this.rotationMatrixY(radians);
|
||||||
return this.multiply(point);
|
return this.multiply(point);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Matrix4.prototype.rotateZ = function (radians, point) {
|
R3.API.Matrix4.prototype.rotateZ = function(radians, point) {
|
||||||
this.identity();
|
this.identity();
|
||||||
this.rotationMatrixZ(radians);
|
this.rotationMatrixZ(radians);
|
||||||
return this.multiply(point);
|
return this.multiply(point);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Matrix4.prototype.multiply = function (mvp) {
|
R3.API.Matrix4.prototype.multiply = function(mvp) {
|
||||||
if (mvp instanceof R3.API.Quaternion || mvp instanceof R3.API.Vector4) {
|
if (mvp instanceof R3.API.Quaternion || mvp instanceof R3.API.Vector4) {
|
||||||
return new R3.API.Quaternion(
|
return new R3.API.Quaternion(
|
||||||
this.rows[0].x * mvp.x + this.rows[0].y * mvp.y + this.rows[0].z * mvp.z + this.rows[0].w * mvp.w,
|
this.rows[0].x * mvp.x + this.rows[0].y * mvp.y + this.rows[0].z * mvp.z + this.rows[0].w * mvp.w,
|
||||||
|
@ -149,7 +149,7 @@ R3.API.Matrix4.prototype.multiply = function (mvp) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Matrix4.prototype.identity = function () {
|
R3.API.Matrix4.prototype.identity = function() {
|
||||||
this.rows = [
|
this.rows = [
|
||||||
new R3.API.Vector4(1, 0, 0, 0),
|
new R3.API.Vector4(1, 0, 0, 0),
|
||||||
new R3.API.Vector4(0, 1, 0, 0),
|
new R3.API.Vector4(0, 1, 0, 0),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* API Mouse
|
* API Mouse
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @constructor
|
* @constructor
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
R3.API.Mouse = function(
|
R3.API.Mouse = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parent,
|
||||||
x,
|
x,
|
||||||
y
|
y
|
||||||
) {
|
) {
|
||||||
|
@ -37,7 +37,7 @@ R3.API.Mouse = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.MOUSE,
|
R3.Component.MOUSE,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
R3.API.Plane = function (
|
R3.API.Plane = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
normal,
|
normal,
|
||||||
constant,
|
constant,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -29,7 +29,7 @@ R3.API.Plane = function (
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.PLANE,
|
R3.Component.PLANE,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@ R3.API.Plane.prototype.constructor = R3.API.Plane;
|
||||||
* @param objectPlane
|
* @param objectPlane
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Plane.FromObject = function (objectPlane) {
|
R3.API.Plane.FromObject = function(objectPlane) {
|
||||||
return new R3.API.Plane(
|
return new R3.API.Plane(
|
||||||
objectPlane.id,
|
objectPlane.id,
|
||||||
objectPlane.name,
|
objectPlane.name,
|
||||||
R3.API.Vector3.FromObject(objectPlane.normal),
|
R3.API.Vector3.FromObject(objectPlane.normal),
|
||||||
objectPlane.constant,
|
objectPlane.constant,
|
||||||
objectPlane.parentEntity
|
objectPlane.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,28 +2,24 @@
|
||||||
* API Project
|
* API Project
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param users
|
* @param users
|
||||||
* @param isPublic
|
* @param isPublic
|
||||||
* @param entities
|
* @param entities
|
||||||
* @param renderers
|
* @param renderers
|
||||||
* @param cameras
|
* @param cameras
|
||||||
* @param cameraIndex
|
|
||||||
* @param controls
|
|
||||||
* @param mode
|
* @param mode
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Project = function(
|
R3.API.Project = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parent,
|
||||||
users,
|
users,
|
||||||
isPublic,
|
isPublic,
|
||||||
entities,
|
entities,
|
||||||
renderers,
|
renderers,
|
||||||
cameras,
|
cameras,
|
||||||
cameraIndex,
|
|
||||||
controls,
|
|
||||||
mode
|
mode
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -71,38 +67,25 @@ R3.API.Project = function(
|
||||||
}
|
}
|
||||||
this.cameras = cameras;
|
this.cameras = cameras;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(cameraIndex)) {
|
|
||||||
cameraIndex = R3.API.Project.CAMERA_INDEX_EDIT;
|
|
||||||
}
|
|
||||||
this.cameraIndex = cameraIndex;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(controls)) {
|
|
||||||
controls = new R3.API.Controls.D3.Orbit(
|
|
||||||
{
|
|
||||||
canvas: this.renderer.canvas
|
|
||||||
},
|
|
||||||
this.cameras[this.cameraIndex]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
this.controls = controls;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(mode)) {
|
if (R3.Utils.UndefinedOrNull(mode)) {
|
||||||
mode = R3.API.Project.DEFAULT_MODE_EDIT;
|
mode = R3.API.Project.APPLICATION_MODE_EDIT;
|
||||||
}
|
}
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
|
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.PROJECT,
|
this.id,
|
||||||
parentEntity
|
this.name,
|
||||||
|
this.components,
|
||||||
|
this.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Project.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Project.prototype = Object.create(R3.API.Component.prototype);
|
||||||
R3.API.Project.prototype.constructor = R3.API.Project;
|
R3.API.Project.prototype.constructor = R3.API.Project;
|
||||||
|
|
||||||
R3.API.Project.DEFAULT_MODE_RUN = 0x1;
|
R3.API.Project.APPLICATION_MODE_RUN = 0x1;
|
||||||
R3.API.Project.DEFAULT_MODE_EDIT = 0x2;
|
R3.API.Project.APPLICATION_MODE_EDIT = 0x2;
|
||||||
|
|
||||||
R3.API.Project.CAMERA_INDEX_EDIT = 0x0;
|
R3.API.Project.CAMERA_INDEX_EDIT = 0x0;
|
||||||
R3.API.Project.CAMERA_INDEX_RUN = 0x1;
|
R3.API.Project.CAMERA_INDEX_RUN = 0x1;
|
|
@ -8,7 +8,7 @@
|
||||||
* @param angle
|
* @param angle
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Quaternion = function (
|
R3.API.Quaternion = function(
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
z,
|
z,
|
||||||
|
@ -48,14 +48,14 @@ R3.API.Quaternion = function (
|
||||||
this.angle = angle;
|
this.angle = angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.prototype.translate = function (v) {
|
R3.API.Quaternion.prototype.translate = function(v) {
|
||||||
this.x += v.x;
|
this.x += v.x;
|
||||||
this.y += v.y;
|
this.y += v.y;
|
||||||
this.z += v.z;
|
this.z += v.z;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.prototype.copy = function () {
|
R3.API.Quaternion.prototype.copy = function() {
|
||||||
return new R3.API.Quaternion(
|
return new R3.API.Quaternion(
|
||||||
this.x,
|
this.x,
|
||||||
this.y,
|
this.y,
|
||||||
|
@ -67,7 +67,7 @@ R3.API.Quaternion.prototype.copy = function () {
|
||||||
/**
|
/**
|
||||||
* Note, this normalize function leaves 'w' component untouched
|
* Note, this normalize function leaves 'w' component untouched
|
||||||
*/
|
*/
|
||||||
R3.API.Quaternion.prototype.normalize = function () {
|
R3.API.Quaternion.prototype.normalize = function() {
|
||||||
|
|
||||||
var EPSILON = 0.000001;
|
var EPSILON = 0.000001;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ R3.API.Quaternion.prototype.normalize = function () {
|
||||||
this.z *= invLength;
|
this.z *= invLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.prototype.multiply = function (q) {
|
R3.API.Quaternion.prototype.multiply = function(q) {
|
||||||
|
|
||||||
var x, y, z, w;
|
var x, y, z, w;
|
||||||
var a = q;
|
var a = q;
|
||||||
|
@ -124,7 +124,7 @@ R3.API.Quaternion.prototype.multiply = function (q) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.prototype.setFromAngle = function (angle) {
|
R3.API.Quaternion.prototype.setFromAngle = function(angle) {
|
||||||
|
|
||||||
this.instance.setFromAxisAngle(this.axis.instance, angle);
|
this.instance.setFromAxisAngle(this.axis.instance, angle);
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ R3.API.Quaternion.prototype.setFromAngle = function (angle) {
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.prototype.subtract = function (v) {
|
R3.API.Quaternion.prototype.subtract = function(v) {
|
||||||
|
|
||||||
if (v instanceof R3.API.Vector3) {
|
if (v instanceof R3.API.Vector3) {
|
||||||
this.x -= v.x;
|
this.x -= v.x;
|
||||||
|
@ -154,7 +154,7 @@ R3.API.Quaternion.prototype.subtract = function (v) {
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.prototype.magnitude = function () {
|
R3.API.Quaternion.prototype.magnitude = function() {
|
||||||
return Math.sqrt(
|
return Math.sqrt(
|
||||||
(this.x * this.x) +
|
(this.x * this.x) +
|
||||||
(this.y * this.y) +
|
(this.y * this.y) +
|
||||||
|
@ -163,7 +163,7 @@ R3.API.Quaternion.prototype.magnitude = function () {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.prototype.normalize = function () {
|
R3.API.Quaternion.prototype.normalize = function() {
|
||||||
|
|
||||||
var magnitude = this.magnitude();
|
var magnitude = this.magnitude();
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ R3.API.Quaternion.prototype.setFromRotationMatrix = function(matrix4) {
|
||||||
* @param t
|
* @param t
|
||||||
* @returns {R3.Quaternion}
|
* @returns {R3.Quaternion}
|
||||||
*/
|
*/
|
||||||
R3.API.Quaternion.prototype.slerp = function (quaternion, t) {
|
R3.API.Quaternion.prototype.slerp = function(quaternion, t) {
|
||||||
|
|
||||||
this.updateInstance();
|
this.updateInstance();
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ R3.API.Quaternion.prototype.slerp = function (quaternion, t) {
|
||||||
* @param objectQuaternion
|
* @param objectQuaternion
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Quaternion.FromObject = function (objectQuaternion) {
|
R3.API.Quaternion.FromObject = function(objectQuaternion) {
|
||||||
|
|
||||||
var apiAxis = null;
|
var apiAxis = null;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
R3.API.Quaternion.Points = function () {
|
R3.API.Quaternion.Points = function() {
|
||||||
this.vectors = [];
|
this.vectors = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.add = function (vector) {
|
R3.API.Quaternion.Points.prototype.add = function(vector) {
|
||||||
|
|
||||||
if (vector instanceof R3.API.Vector3) {
|
if (vector instanceof R3.API.Vector3) {
|
||||||
vector = new R3.API.Quaternion(
|
vector = new R3.API.Quaternion(
|
||||||
|
@ -23,7 +23,7 @@ R3.API.Quaternion.Points.prototype.add = function (vector) {
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.copy = function () {
|
R3.API.Quaternion.Points.prototype.copy = function() {
|
||||||
|
|
||||||
var vectors = [];
|
var vectors = [];
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ R3.API.Quaternion.Points.prototype.copy = function () {
|
||||||
return vectors;
|
return vectors;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.maximizeXDistance = function (grain) {
|
R3.API.Quaternion.Points.prototype.maximizeXDistance = function(grain) {
|
||||||
|
|
||||||
// console.log("vectors (before): " + JSON.stringify(this.vectors, null, 2));
|
// console.log("vectors (before): " + JSON.stringify(this.vectors, null, 2));
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ R3.API.Quaternion.Points.prototype.maximizeXDistance = function (grain) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.maximizeYDistance = function (grain) {
|
R3.API.Quaternion.Points.prototype.maximizeYDistance = function(grain) {
|
||||||
|
|
||||||
// console.log("vectors (before): " + JSON.stringify(this.vectors, null, 2));
|
// console.log("vectors (before): " + JSON.stringify(this.vectors, null, 2));
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ R3.API.Quaternion.Points.prototype.maximizeYDistance = function (grain) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.lookAt = function (at, up) {
|
R3.API.Quaternion.Points.prototype.lookAt = function(at, up) {
|
||||||
|
|
||||||
var polyCenter = this.average();
|
var polyCenter = this.average();
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ R3.API.Quaternion.Points.prototype.lookAt = function (at, up) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.distances = function () {
|
R3.API.Quaternion.Points.prototype.distances = function() {
|
||||||
|
|
||||||
var minX = this.vectors[0].x;
|
var minX = this.vectors[0].x;
|
||||||
var minY = this.vectors[0].y;
|
var minY = this.vectors[0].y;
|
||||||
|
@ -184,7 +184,7 @@ R3.API.Quaternion.Points.prototype.distances = function () {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.average = function () {
|
R3.API.Quaternion.Points.prototype.average = function() {
|
||||||
var averageX = 0;
|
var averageX = 0;
|
||||||
var averageY = 0;
|
var averageY = 0;
|
||||||
var averageZ = 0;
|
var averageZ = 0;
|
||||||
|
@ -202,7 +202,7 @@ R3.API.Quaternion.Points.prototype.average = function () {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.negate = function () {
|
R3.API.Quaternion.Points.prototype.negate = function() {
|
||||||
|
|
||||||
for (var i = 0; i < this.vectors.length; i++) {
|
for (var i = 0; i < this.vectors.length; i++) {
|
||||||
this.vectors[i].x *= -1;
|
this.vectors[i].x *= -1;
|
||||||
|
@ -214,7 +214,7 @@ R3.API.Quaternion.Points.prototype.negate = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
R3.API.Quaternion.Points.prototype.toOrigin = function () {
|
R3.API.Quaternion.Points.prototype.toOrigin = function() {
|
||||||
|
|
||||||
var distanceFromOrigin = this.average().negate();
|
var distanceFromOrigin = this.average().negate();
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,15 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param rendererType
|
* @param rendererType
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param width
|
|
||||||
* @param height
|
|
||||||
* @param offset
|
|
||||||
* @param canvas
|
* @param canvas
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Renderer = function (
|
R3.API.Renderer = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
rendererType,
|
parent,
|
||||||
parentEntity,
|
rendererType
|
||||||
width,
|
|
||||||
height,
|
|
||||||
offset,
|
|
||||||
canvas
|
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -51,30 +44,10 @@ R3.API.Renderer = function (
|
||||||
}
|
}
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(width)) {
|
|
||||||
width = 1;
|
|
||||||
}
|
|
||||||
this.width = width;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(height)) {
|
|
||||||
height = 1;
|
|
||||||
}
|
|
||||||
this.height = height;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(offset)) {
|
|
||||||
offset = new R3.API.Vector2(0,0);
|
|
||||||
}
|
|
||||||
this.offset = offset;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(canvas)) {
|
|
||||||
canvas = new R3.API.Canvas();
|
|
||||||
}
|
|
||||||
this.canvas = canvas;
|
|
||||||
|
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.API.Renderer.GetComponentType(this.rendererType),
|
R3.API.Renderer.GetComponentType(this.rendererType),
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -93,8 +66,14 @@ R3.API.Renderer.GetComponentType = function(rendererType) {
|
||||||
case R3.API.Renderer.RENDERER_TYPE_2D :
|
case R3.API.Renderer.RENDERER_TYPE_2D :
|
||||||
componentType = R3.Component.RENDERER_D2;
|
componentType = R3.Component.RENDERER_D2;
|
||||||
break;
|
break;
|
||||||
case R3.API.Renderer.RENDERER_TYPE_3D :
|
case R3.API.Renderer.RENDERER_TYPE_3D_CANVAS :
|
||||||
componentType = R3.Component.RENDERER_D3;
|
componentType = R3.Component.RENDERER_D3_CANVAS;
|
||||||
|
break;
|
||||||
|
case R3.API.Renderer.RENDERER_TYPE_3D_TARGET :
|
||||||
|
componentType = R3.Component.RENDERER_D3_TARGET;
|
||||||
|
break;
|
||||||
|
case R3.API.Renderer.RENDERER_TYPE_3D_CANVAS_AND_TARGET :
|
||||||
|
componentType = R3.Component.RENDERER_D3_CANVAS_TARGET;
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
console.warn('could not determine component type');
|
console.warn('could not determine component type');
|
||||||
|
@ -104,9 +83,11 @@ R3.API.Renderer.GetComponentType = function(rendererType) {
|
||||||
return componentType;
|
return componentType;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Renderer.RENDERER_TYPE_NONE = 0x0;
|
R3.API.Renderer.RENDERER_TYPE_NONE = 0x0;
|
||||||
R3.API.Renderer.RENDERER_TYPE_2D = 0x1;
|
R3.API.Renderer.RENDERER_TYPE_2D = 0x1;
|
||||||
R3.API.Renderer.RENDERER_TYPE_3D = 0x2;
|
R3.API.Renderer.RENDERER_TYPE_3D_CANVAS = 0x2;
|
||||||
|
R3.API.Renderer.RENDERER_TYPE_3D_TARGET = 0x3;
|
||||||
|
R3.API.Renderer.RENDERER_TYPE_3D_CANVAS_AND_TARGET = 0x4;
|
||||||
|
|
||||||
R3.API.Renderer.MODE_CANVAS = 0x1;
|
R3.API.Renderer.MODE_CANVAS = 0x1;
|
||||||
R3.API.Renderer.MODE_TARGET = 0x2;
|
R3.API.Renderer.MODE_TARGET = 0x2;
|
||||||
|
@ -120,15 +101,3 @@ R3.API.Renderer.TONE_MAPPING_LINEAR = 1;
|
||||||
R3.API.Renderer.TONE_MAPPING_REINHARD = 2;
|
R3.API.Renderer.TONE_MAPPING_REINHARD = 2;
|
||||||
R3.API.Renderer.TONE_MAPPING_UNCHARTED_2 = 3;
|
R3.API.Renderer.TONE_MAPPING_UNCHARTED_2 = 3;
|
||||||
R3.API.Renderer.TONE_MAPPING_CINEON = 4;
|
R3.API.Renderer.TONE_MAPPING_CINEON = 4;
|
||||||
|
|
||||||
R3.API.Renderer.ASPECT_RATIO_NONE = 0x1;
|
|
||||||
R3.API.Renderer.ASPECT_RATIO_4_3 = 0x2;
|
|
||||||
R3.API.Renderer.ASPECT_RATIO_3_2 = 0x3;
|
|
||||||
R3.API.Renderer.ASPECT_RATIO_16_10 = 0x4;
|
|
||||||
R3.API.Renderer.ASPECT_RATIO_17_10 = 0x5;
|
|
||||||
R3.API.Renderer.ASPECT_RATIO_16_9 = 0x6;
|
|
||||||
|
|
||||||
R3.API.Renderer.SCALE_MODE_NONE = 0x1;
|
|
||||||
R3.API.Renderer.SCALE_MODE_LETTERBOX = 0x2;
|
|
||||||
R3.API.Renderer.SCALE_MODE_ZOOM_TO_BIGGER = 0x3;
|
|
||||||
R3.API.Renderer.SCALE_MODE_NON_UNIFORM = 0x4;
|
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
* R3.API.Renderer.D2
|
* R3.API.Renderer.D2
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param apiRenderer
|
* @param apiRenderer
|
||||||
|
* @param canvas
|
||||||
*/
|
*/
|
||||||
R3.API.Renderer.D2 = function (
|
R3.API.Renderer.D2 = function(
|
||||||
apiRenderer
|
apiRenderer,
|
||||||
|
canvas
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||||
|
@ -21,14 +23,15 @@ R3.API.Renderer.D2 = function (
|
||||||
this,
|
this,
|
||||||
apiRenderer.id,
|
apiRenderer.id,
|
||||||
apiRenderer.name,
|
apiRenderer.name,
|
||||||
apiRenderer.rendererType,
|
apiRenderer.parent,
|
||||||
apiRenderer.parentEntity,
|
apiRenderer.rendererType
|
||||||
apiRenderer.width,
|
|
||||||
apiRenderer.height,
|
|
||||||
apiRenderer.offset,
|
|
||||||
apiRenderer.canvas
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(canvas)) {
|
||||||
|
canvas = new R3.API.Canvas();
|
||||||
|
}
|
||||||
|
this.canvas = canvas;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Renderer.D2.prototype = Object.create(R3.API.Renderer.prototype);
|
R3.API.Renderer.D2.prototype = Object.create(R3.API.Renderer.prototype);
|
||||||
|
|
|
@ -0,0 +1,296 @@
|
||||||
|
/**
|
||||||
|
* R3.API.Renderer.D3
|
||||||
|
* @param apiRenderer
|
||||||
|
* @param renderMode
|
||||||
|
* @param autoClear
|
||||||
|
* @param autoClearColor
|
||||||
|
* @param autoClearDepth
|
||||||
|
* @param autoClearStencil
|
||||||
|
* @param gammaFactor
|
||||||
|
* @param gammaInput
|
||||||
|
* @param gammaOutput
|
||||||
|
* @param maxMorphTargets
|
||||||
|
* @param maxMorphNormals
|
||||||
|
* @param physicallyCorrectLights
|
||||||
|
* @param shadowMapEnabled
|
||||||
|
* @param shadowMapAutoUpdate
|
||||||
|
* @param shadowMapNeedsUpdate
|
||||||
|
* @param shadowMapType
|
||||||
|
* @param shadowMapRenderReverseSided
|
||||||
|
* @param shadowMapRenderSingleSided
|
||||||
|
* @param sortObjects
|
||||||
|
* @param toneMapping
|
||||||
|
* @param toneMappingExposure
|
||||||
|
* @param toneMappingWhitePoint
|
||||||
|
* @param premultipliedAlpha
|
||||||
|
* @param antialias
|
||||||
|
* @param stencil
|
||||||
|
* @param preserveDrawingBuffer
|
||||||
|
* @param depth
|
||||||
|
* @param logarithmicDepthBuffer
|
||||||
|
* @param localClippingEnabled
|
||||||
|
* @param renderTarget
|
||||||
|
* @param clippingPlanes
|
||||||
|
* @param clearColor
|
||||||
|
* @param viewports
|
||||||
|
* @param alpha
|
||||||
|
* @param opacity
|
||||||
|
* @param composer - only one composer can be active at a time
|
||||||
|
* @param effect - only one effect can be active at a time
|
||||||
|
* @param enableComposer
|
||||||
|
* @param enableEffect
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.API.Renderer.D3.Canvas.Target = function(
|
||||||
|
apiRenderer,
|
||||||
|
renderMode,
|
||||||
|
autoClear,
|
||||||
|
autoClearColor,
|
||||||
|
autoClearDepth,
|
||||||
|
autoClearStencil,
|
||||||
|
gammaFactor,
|
||||||
|
gammaInput,
|
||||||
|
gammaOutput,
|
||||||
|
maxMorphTargets,
|
||||||
|
maxMorphNormals,
|
||||||
|
physicallyCorrectLights,
|
||||||
|
shadowMapEnabled,
|
||||||
|
shadowMapAutoUpdate,
|
||||||
|
shadowMapNeedsUpdate,
|
||||||
|
shadowMapType,
|
||||||
|
shadowMapRenderReverseSided,
|
||||||
|
shadowMapRenderSingleSided,
|
||||||
|
sortObjects,
|
||||||
|
toneMapping,
|
||||||
|
toneMappingExposure,
|
||||||
|
toneMappingWhitePoint,
|
||||||
|
premultipliedAlpha,
|
||||||
|
antialias,
|
||||||
|
stencil,
|
||||||
|
preserveDrawingBuffer,
|
||||||
|
depth,
|
||||||
|
logarithmicDepthBuffer,
|
||||||
|
localClippingEnabled,
|
||||||
|
renderTarget,
|
||||||
|
clippingPlanes,
|
||||||
|
clearColor,
|
||||||
|
viewports,
|
||||||
|
alpha,
|
||||||
|
opacity
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||||
|
apiRenderer = {
|
||||||
|
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
|
||||||
|
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(renderMode)) {
|
||||||
|
renderMode = R3.API.Renderer.MODE_CANVAS;
|
||||||
|
}
|
||||||
|
this.renderMode = renderMode;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClear)) {
|
||||||
|
autoClear = true;
|
||||||
|
}
|
||||||
|
this.autoClear = autoClear;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
|
||||||
|
autoClearColor = true;
|
||||||
|
}
|
||||||
|
this.autoClearColor = autoClearColor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
|
||||||
|
autoClearDepth = true;
|
||||||
|
}
|
||||||
|
this.autoClearDepth = autoClearDepth;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
|
||||||
|
autoClearStencil = true;
|
||||||
|
}
|
||||||
|
this.autoClearStencil = autoClearStencil;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
|
||||||
|
gammaFactor = 2;
|
||||||
|
}
|
||||||
|
this.gammaFactor = gammaFactor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaInput)) {
|
||||||
|
gammaInput = false;
|
||||||
|
}
|
||||||
|
this.gammaInput = gammaInput;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
|
||||||
|
gammaOutput = false;
|
||||||
|
}
|
||||||
|
this.gammaOutput = gammaOutput;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
|
||||||
|
maxMorphTargets = 8;
|
||||||
|
}
|
||||||
|
this.maxMorphTargets = maxMorphTargets;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
|
||||||
|
maxMorphNormals = 4;
|
||||||
|
}
|
||||||
|
this.maxMorphNormals = maxMorphNormals;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
|
||||||
|
physicallyCorrectLights = false;
|
||||||
|
}
|
||||||
|
this.physicallyCorrectLights = physicallyCorrectLights;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
|
||||||
|
shadowMapEnabled = false;
|
||||||
|
}
|
||||||
|
this.shadowMapEnabled = shadowMapEnabled;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
|
||||||
|
shadowMapAutoUpdate = true;
|
||||||
|
}
|
||||||
|
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
|
||||||
|
shadowMapNeedsUpdate = false;
|
||||||
|
}
|
||||||
|
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
|
||||||
|
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
|
||||||
|
}
|
||||||
|
this.shadowMapType = shadowMapType;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
|
||||||
|
shadowMapRenderReverseSided = true;
|
||||||
|
}
|
||||||
|
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
|
||||||
|
shadowMapRenderSingleSided = true;
|
||||||
|
}
|
||||||
|
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(sortObjects)) {
|
||||||
|
sortObjects = true;
|
||||||
|
}
|
||||||
|
this.sortObjects = sortObjects;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMapping)) {
|
||||||
|
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
|
||||||
|
}
|
||||||
|
this.toneMapping = toneMapping;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
|
||||||
|
toneMappingExposure = 1;
|
||||||
|
}
|
||||||
|
this.toneMappingExposure = toneMappingExposure;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
|
||||||
|
toneMappingWhitePoint = 1;
|
||||||
|
}
|
||||||
|
this.toneMappingWhitePoint = toneMappingWhitePoint;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
|
||||||
|
premultipliedAlpha = true;
|
||||||
|
}
|
||||||
|
this.premultipliedAlpha = premultipliedAlpha;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(antialias)) {
|
||||||
|
antialias = false;
|
||||||
|
}
|
||||||
|
this.antialias = antialias;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(stencil)) {
|
||||||
|
stencil = true;
|
||||||
|
}
|
||||||
|
this.stencil = stencil;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
|
||||||
|
preserveDrawingBuffer = false;
|
||||||
|
}
|
||||||
|
this.preserveDrawingBuffer = preserveDrawingBuffer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(depth)) {
|
||||||
|
depth = true;
|
||||||
|
}
|
||||||
|
this.depth = depth;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
|
||||||
|
logarithmicDepthBuffer = false;
|
||||||
|
}
|
||||||
|
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
|
||||||
|
localClippingEnabled = false;
|
||||||
|
}
|
||||||
|
this.localClippingEnabled = localClippingEnabled;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||||
|
renderTarget = null;
|
||||||
|
}
|
||||||
|
this.renderTarget = renderTarget;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
|
||||||
|
clippingPlanes = [];
|
||||||
|
}
|
||||||
|
this.clippingPlanes = clippingPlanes;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(clearColor)) {
|
||||||
|
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
|
||||||
|
}
|
||||||
|
this.clearColor = clearColor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(viewports)) {
|
||||||
|
viewports = [new R3.D3.API.Viewport()];
|
||||||
|
}
|
||||||
|
this.viewports = viewports;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(alpha)) {
|
||||||
|
alpha = true;
|
||||||
|
}
|
||||||
|
this.alpha = alpha;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(opacity)) {
|
||||||
|
opacity = 1;
|
||||||
|
}
|
||||||
|
this.opacity = opacity;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(composer)) {
|
||||||
|
composer = new R3.API.Composer();
|
||||||
|
composer.renderer = this.id;
|
||||||
|
}
|
||||||
|
this.composer = composer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(effect)) {
|
||||||
|
effect = new R3.API.Effect();
|
||||||
|
effect.renderer = this.id;
|
||||||
|
}
|
||||||
|
this.effect = effect;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(enableComposer)) {
|
||||||
|
enableComposer = false;
|
||||||
|
}
|
||||||
|
this.enableComposer = enableComposer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(enableEffect)) {
|
||||||
|
enableEffect = false;
|
||||||
|
}
|
||||||
|
this.enableEffect = enableEffect;
|
||||||
|
|
||||||
|
R3.API.Renderer.call(
|
||||||
|
this,
|
||||||
|
apiRenderer.id,
|
||||||
|
apiRenderer.name,
|
||||||
|
apiRenderer.parent,
|
||||||
|
apiRenderer.rendererType,
|
||||||
|
apiRenderer.canvas
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);
|
||||||
|
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3;
|
|
@ -0,0 +1,274 @@
|
||||||
|
/**
|
||||||
|
* R3.API.Renderer.D3
|
||||||
|
* @param apiRenderer
|
||||||
|
* @param renderMode
|
||||||
|
* @param autoClear
|
||||||
|
* @param autoClearColor
|
||||||
|
* @param autoClearDepth
|
||||||
|
* @param autoClearStencil
|
||||||
|
* @param gammaFactor
|
||||||
|
* @param gammaInput
|
||||||
|
* @param gammaOutput
|
||||||
|
* @param maxMorphTargets
|
||||||
|
* @param maxMorphNormals
|
||||||
|
* @param physicallyCorrectLights
|
||||||
|
* @param shadowMapEnabled
|
||||||
|
* @param shadowMapAutoUpdate
|
||||||
|
* @param shadowMapNeedsUpdate
|
||||||
|
* @param shadowMapType
|
||||||
|
* @param shadowMapRenderReverseSided
|
||||||
|
* @param shadowMapRenderSingleSided
|
||||||
|
* @param sortObjects
|
||||||
|
* @param toneMapping
|
||||||
|
* @param toneMappingExposure
|
||||||
|
* @param toneMappingWhitePoint
|
||||||
|
* @param premultipliedAlpha
|
||||||
|
* @param antialias
|
||||||
|
* @param stencil
|
||||||
|
* @param preserveDrawingBuffer
|
||||||
|
* @param depth
|
||||||
|
* @param logarithmicDepthBuffer
|
||||||
|
* @param localClippingEnabled
|
||||||
|
* @param renderTarget
|
||||||
|
* @param clippingPlanes
|
||||||
|
* @param clearColor
|
||||||
|
* @param viewports
|
||||||
|
* @param alpha
|
||||||
|
* @param opacity
|
||||||
|
* @param composer - only one composer can be active at a time
|
||||||
|
* @param effect - only one effect can be active at a time
|
||||||
|
* @param enableComposer
|
||||||
|
* @param enableEffect
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.API.Renderer.D3.Canvas = function(
|
||||||
|
apiRenderer,
|
||||||
|
renderMode,
|
||||||
|
autoClear,
|
||||||
|
autoClearColor,
|
||||||
|
autoClearDepth,
|
||||||
|
autoClearStencil,
|
||||||
|
gammaFactor,
|
||||||
|
gammaInput,
|
||||||
|
gammaOutput,
|
||||||
|
maxMorphTargets,
|
||||||
|
maxMorphNormals,
|
||||||
|
physicallyCorrectLights,
|
||||||
|
shadowMapEnabled,
|
||||||
|
shadowMapAutoUpdate,
|
||||||
|
shadowMapNeedsUpdate,
|
||||||
|
shadowMapType,
|
||||||
|
shadowMapRenderReverseSided,
|
||||||
|
shadowMapRenderSingleSided,
|
||||||
|
sortObjects,
|
||||||
|
toneMapping,
|
||||||
|
toneMappingExposure,
|
||||||
|
toneMappingWhitePoint,
|
||||||
|
premultipliedAlpha,
|
||||||
|
antialias,
|
||||||
|
stencil,
|
||||||
|
preserveDrawingBuffer,
|
||||||
|
depth,
|
||||||
|
logarithmicDepthBuffer,
|
||||||
|
localClippingEnabled,
|
||||||
|
renderTarget,
|
||||||
|
clippingPlanes,
|
||||||
|
clearColor,
|
||||||
|
viewports,
|
||||||
|
alpha,
|
||||||
|
opacity
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||||
|
apiRenderer = {
|
||||||
|
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
|
||||||
|
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(renderMode)) {
|
||||||
|
renderMode = R3.API.Renderer.MODE_CANVAS;
|
||||||
|
}
|
||||||
|
this.renderMode = renderMode;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClear)) {
|
||||||
|
autoClear = true;
|
||||||
|
}
|
||||||
|
this.autoClear = autoClear;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
|
||||||
|
autoClearColor = true;
|
||||||
|
}
|
||||||
|
this.autoClearColor = autoClearColor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
|
||||||
|
autoClearDepth = true;
|
||||||
|
}
|
||||||
|
this.autoClearDepth = autoClearDepth;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
|
||||||
|
autoClearStencil = true;
|
||||||
|
}
|
||||||
|
this.autoClearStencil = autoClearStencil;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
|
||||||
|
gammaFactor = 2;
|
||||||
|
}
|
||||||
|
this.gammaFactor = gammaFactor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaInput)) {
|
||||||
|
gammaInput = false;
|
||||||
|
}
|
||||||
|
this.gammaInput = gammaInput;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
|
||||||
|
gammaOutput = false;
|
||||||
|
}
|
||||||
|
this.gammaOutput = gammaOutput;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
|
||||||
|
maxMorphTargets = 8;
|
||||||
|
}
|
||||||
|
this.maxMorphTargets = maxMorphTargets;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
|
||||||
|
maxMorphNormals = 4;
|
||||||
|
}
|
||||||
|
this.maxMorphNormals = maxMorphNormals;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
|
||||||
|
physicallyCorrectLights = false;
|
||||||
|
}
|
||||||
|
this.physicallyCorrectLights = physicallyCorrectLights;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
|
||||||
|
shadowMapEnabled = false;
|
||||||
|
}
|
||||||
|
this.shadowMapEnabled = shadowMapEnabled;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
|
||||||
|
shadowMapAutoUpdate = true;
|
||||||
|
}
|
||||||
|
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
|
||||||
|
shadowMapNeedsUpdate = false;
|
||||||
|
}
|
||||||
|
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
|
||||||
|
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
|
||||||
|
}
|
||||||
|
this.shadowMapType = shadowMapType;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
|
||||||
|
shadowMapRenderReverseSided = true;
|
||||||
|
}
|
||||||
|
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
|
||||||
|
shadowMapRenderSingleSided = true;
|
||||||
|
}
|
||||||
|
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(sortObjects)) {
|
||||||
|
sortObjects = true;
|
||||||
|
}
|
||||||
|
this.sortObjects = sortObjects;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMapping)) {
|
||||||
|
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
|
||||||
|
}
|
||||||
|
this.toneMapping = toneMapping;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
|
||||||
|
toneMappingExposure = 1;
|
||||||
|
}
|
||||||
|
this.toneMappingExposure = toneMappingExposure;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
|
||||||
|
toneMappingWhitePoint = 1;
|
||||||
|
}
|
||||||
|
this.toneMappingWhitePoint = toneMappingWhitePoint;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
|
||||||
|
premultipliedAlpha = true;
|
||||||
|
}
|
||||||
|
this.premultipliedAlpha = premultipliedAlpha;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(antialias)) {
|
||||||
|
antialias = false;
|
||||||
|
}
|
||||||
|
this.antialias = antialias;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(stencil)) {
|
||||||
|
stencil = true;
|
||||||
|
}
|
||||||
|
this.stencil = stencil;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
|
||||||
|
preserveDrawingBuffer = false;
|
||||||
|
}
|
||||||
|
this.preserveDrawingBuffer = preserveDrawingBuffer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(depth)) {
|
||||||
|
depth = true;
|
||||||
|
}
|
||||||
|
this.depth = depth;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
|
||||||
|
logarithmicDepthBuffer = false;
|
||||||
|
}
|
||||||
|
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
|
||||||
|
localClippingEnabled = false;
|
||||||
|
}
|
||||||
|
this.localClippingEnabled = localClippingEnabled;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||||
|
renderTarget = null;
|
||||||
|
}
|
||||||
|
this.renderTarget = renderTarget;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
|
||||||
|
clippingPlanes = [];
|
||||||
|
}
|
||||||
|
this.clippingPlanes = clippingPlanes;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(clearColor)) {
|
||||||
|
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
|
||||||
|
}
|
||||||
|
this.clearColor = clearColor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(viewports)) {
|
||||||
|
viewports = [new R3.D3.API.Viewport()];
|
||||||
|
}
|
||||||
|
this.viewports = viewports;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(alpha)) {
|
||||||
|
alpha = true;
|
||||||
|
}
|
||||||
|
this.alpha = alpha;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(opacity)) {
|
||||||
|
opacity = 1;
|
||||||
|
}
|
||||||
|
this.opacity = opacity;
|
||||||
|
|
||||||
|
R3.API.Renderer.call(
|
||||||
|
this,
|
||||||
|
apiRenderer.id,
|
||||||
|
apiRenderer.name,
|
||||||
|
apiRenderer.parent,
|
||||||
|
apiRenderer.rendererType,
|
||||||
|
apiRenderer.canvas
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);
|
||||||
|
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3;
|
|
@ -0,0 +1,296 @@
|
||||||
|
/**
|
||||||
|
* R3.API.Renderer.D3
|
||||||
|
* @param apiRenderer
|
||||||
|
* @param renderMode
|
||||||
|
* @param autoClear
|
||||||
|
* @param autoClearColor
|
||||||
|
* @param autoClearDepth
|
||||||
|
* @param autoClearStencil
|
||||||
|
* @param gammaFactor
|
||||||
|
* @param gammaInput
|
||||||
|
* @param gammaOutput
|
||||||
|
* @param maxMorphTargets
|
||||||
|
* @param maxMorphNormals
|
||||||
|
* @param physicallyCorrectLights
|
||||||
|
* @param shadowMapEnabled
|
||||||
|
* @param shadowMapAutoUpdate
|
||||||
|
* @param shadowMapNeedsUpdate
|
||||||
|
* @param shadowMapType
|
||||||
|
* @param shadowMapRenderReverseSided
|
||||||
|
* @param shadowMapRenderSingleSided
|
||||||
|
* @param sortObjects
|
||||||
|
* @param toneMapping
|
||||||
|
* @param toneMappingExposure
|
||||||
|
* @param toneMappingWhitePoint
|
||||||
|
* @param premultipliedAlpha
|
||||||
|
* @param antialias
|
||||||
|
* @param stencil
|
||||||
|
* @param preserveDrawingBuffer
|
||||||
|
* @param depth
|
||||||
|
* @param logarithmicDepthBuffer
|
||||||
|
* @param localClippingEnabled
|
||||||
|
* @param renderTarget
|
||||||
|
* @param clippingPlanes
|
||||||
|
* @param clearColor
|
||||||
|
* @param viewports
|
||||||
|
* @param alpha
|
||||||
|
* @param opacity
|
||||||
|
* @param composer - only one composer can be active at a time
|
||||||
|
* @param effect - only one effect can be active at a time
|
||||||
|
* @param enableComposer
|
||||||
|
* @param enableEffect
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.API.Renderer.D3.Target = function(
|
||||||
|
apiRenderer,
|
||||||
|
renderMode,
|
||||||
|
autoClear,
|
||||||
|
autoClearColor,
|
||||||
|
autoClearDepth,
|
||||||
|
autoClearStencil,
|
||||||
|
gammaFactor,
|
||||||
|
gammaInput,
|
||||||
|
gammaOutput,
|
||||||
|
maxMorphTargets,
|
||||||
|
maxMorphNormals,
|
||||||
|
physicallyCorrectLights,
|
||||||
|
shadowMapEnabled,
|
||||||
|
shadowMapAutoUpdate,
|
||||||
|
shadowMapNeedsUpdate,
|
||||||
|
shadowMapType,
|
||||||
|
shadowMapRenderReverseSided,
|
||||||
|
shadowMapRenderSingleSided,
|
||||||
|
sortObjects,
|
||||||
|
toneMapping,
|
||||||
|
toneMappingExposure,
|
||||||
|
toneMappingWhitePoint,
|
||||||
|
premultipliedAlpha,
|
||||||
|
antialias,
|
||||||
|
stencil,
|
||||||
|
preserveDrawingBuffer,
|
||||||
|
depth,
|
||||||
|
logarithmicDepthBuffer,
|
||||||
|
localClippingEnabled,
|
||||||
|
renderTarget,
|
||||||
|
clippingPlanes,
|
||||||
|
clearColor,
|
||||||
|
viewports,
|
||||||
|
alpha,
|
||||||
|
opacity
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||||
|
apiRenderer = {
|
||||||
|
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
|
||||||
|
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(renderMode)) {
|
||||||
|
renderMode = R3.API.Renderer.MODE_CANVAS;
|
||||||
|
}
|
||||||
|
this.renderMode = renderMode;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClear)) {
|
||||||
|
autoClear = true;
|
||||||
|
}
|
||||||
|
this.autoClear = autoClear;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
|
||||||
|
autoClearColor = true;
|
||||||
|
}
|
||||||
|
this.autoClearColor = autoClearColor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
|
||||||
|
autoClearDepth = true;
|
||||||
|
}
|
||||||
|
this.autoClearDepth = autoClearDepth;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
|
||||||
|
autoClearStencil = true;
|
||||||
|
}
|
||||||
|
this.autoClearStencil = autoClearStencil;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
|
||||||
|
gammaFactor = 2;
|
||||||
|
}
|
||||||
|
this.gammaFactor = gammaFactor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaInput)) {
|
||||||
|
gammaInput = false;
|
||||||
|
}
|
||||||
|
this.gammaInput = gammaInput;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
|
||||||
|
gammaOutput = false;
|
||||||
|
}
|
||||||
|
this.gammaOutput = gammaOutput;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
|
||||||
|
maxMorphTargets = 8;
|
||||||
|
}
|
||||||
|
this.maxMorphTargets = maxMorphTargets;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
|
||||||
|
maxMorphNormals = 4;
|
||||||
|
}
|
||||||
|
this.maxMorphNormals = maxMorphNormals;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
|
||||||
|
physicallyCorrectLights = false;
|
||||||
|
}
|
||||||
|
this.physicallyCorrectLights = physicallyCorrectLights;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
|
||||||
|
shadowMapEnabled = false;
|
||||||
|
}
|
||||||
|
this.shadowMapEnabled = shadowMapEnabled;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
|
||||||
|
shadowMapAutoUpdate = true;
|
||||||
|
}
|
||||||
|
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
|
||||||
|
shadowMapNeedsUpdate = false;
|
||||||
|
}
|
||||||
|
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
|
||||||
|
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
|
||||||
|
}
|
||||||
|
this.shadowMapType = shadowMapType;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
|
||||||
|
shadowMapRenderReverseSided = true;
|
||||||
|
}
|
||||||
|
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
|
||||||
|
shadowMapRenderSingleSided = true;
|
||||||
|
}
|
||||||
|
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(sortObjects)) {
|
||||||
|
sortObjects = true;
|
||||||
|
}
|
||||||
|
this.sortObjects = sortObjects;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMapping)) {
|
||||||
|
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
|
||||||
|
}
|
||||||
|
this.toneMapping = toneMapping;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
|
||||||
|
toneMappingExposure = 1;
|
||||||
|
}
|
||||||
|
this.toneMappingExposure = toneMappingExposure;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
|
||||||
|
toneMappingWhitePoint = 1;
|
||||||
|
}
|
||||||
|
this.toneMappingWhitePoint = toneMappingWhitePoint;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
|
||||||
|
premultipliedAlpha = true;
|
||||||
|
}
|
||||||
|
this.premultipliedAlpha = premultipliedAlpha;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(antialias)) {
|
||||||
|
antialias = false;
|
||||||
|
}
|
||||||
|
this.antialias = antialias;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(stencil)) {
|
||||||
|
stencil = true;
|
||||||
|
}
|
||||||
|
this.stencil = stencil;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
|
||||||
|
preserveDrawingBuffer = false;
|
||||||
|
}
|
||||||
|
this.preserveDrawingBuffer = preserveDrawingBuffer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(depth)) {
|
||||||
|
depth = true;
|
||||||
|
}
|
||||||
|
this.depth = depth;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
|
||||||
|
logarithmicDepthBuffer = false;
|
||||||
|
}
|
||||||
|
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
|
||||||
|
localClippingEnabled = false;
|
||||||
|
}
|
||||||
|
this.localClippingEnabled = localClippingEnabled;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||||
|
renderTarget = null;
|
||||||
|
}
|
||||||
|
this.renderTarget = renderTarget;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
|
||||||
|
clippingPlanes = [];
|
||||||
|
}
|
||||||
|
this.clippingPlanes = clippingPlanes;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(clearColor)) {
|
||||||
|
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
|
||||||
|
}
|
||||||
|
this.clearColor = clearColor;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(viewports)) {
|
||||||
|
viewports = [new R3.D3.API.Viewport()];
|
||||||
|
}
|
||||||
|
this.viewports = viewports;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(alpha)) {
|
||||||
|
alpha = true;
|
||||||
|
}
|
||||||
|
this.alpha = alpha;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(opacity)) {
|
||||||
|
opacity = 1;
|
||||||
|
}
|
||||||
|
this.opacity = opacity;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(composer)) {
|
||||||
|
composer = new R3.API.Composer();
|
||||||
|
composer.renderer = this.id;
|
||||||
|
}
|
||||||
|
this.composer = composer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(effect)) {
|
||||||
|
effect = new R3.API.Effect();
|
||||||
|
effect.renderer = this.id;
|
||||||
|
}
|
||||||
|
this.effect = effect;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(enableComposer)) {
|
||||||
|
enableComposer = false;
|
||||||
|
}
|
||||||
|
this.enableComposer = enableComposer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(enableEffect)) {
|
||||||
|
enableEffect = false;
|
||||||
|
}
|
||||||
|
this.enableEffect = enableEffect;
|
||||||
|
|
||||||
|
R3.API.Renderer.call(
|
||||||
|
this,
|
||||||
|
apiRenderer.id,
|
||||||
|
apiRenderer.name,
|
||||||
|
apiRenderer.parent,
|
||||||
|
apiRenderer.rendererType,
|
||||||
|
apiRenderer.canvas
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);
|
||||||
|
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3;
|
|
@ -35,17 +35,13 @@
|
||||||
* @param viewports
|
* @param viewports
|
||||||
* @param alpha
|
* @param alpha
|
||||||
* @param opacity
|
* @param opacity
|
||||||
* @param logicalSize
|
* @param composer - only one composer can be active at a time
|
||||||
* @param aspectRatio
|
* @param effect - only one effect can be active at a time
|
||||||
* @param scaleMode
|
|
||||||
* @param scenes
|
|
||||||
* @param composers
|
|
||||||
* @param effects
|
|
||||||
* @param enableComposer
|
* @param enableComposer
|
||||||
* @param enableEffects
|
* @param enableEffect
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Renderer.D3 = function (
|
R3.API.Renderer.D3 = function(
|
||||||
apiRenderer,
|
apiRenderer,
|
||||||
renderMode,
|
renderMode,
|
||||||
autoClear,
|
autoClear,
|
||||||
|
@ -80,12 +76,7 @@ R3.API.Renderer.D3 = function (
|
||||||
clearColor,
|
clearColor,
|
||||||
viewports,
|
viewports,
|
||||||
alpha,
|
alpha,
|
||||||
opacity,
|
opacity
|
||||||
scenes,
|
|
||||||
composers,
|
|
||||||
effect,
|
|
||||||
enableComposer,
|
|
||||||
enableEffect
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||||
|
@ -249,19 +240,12 @@ R3.API.Renderer.D3 = function (
|
||||||
this.clippingPlanes = clippingPlanes;
|
this.clippingPlanes = clippingPlanes;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(clearColor)) {
|
if (R3.Utils.UndefinedOrNull(clearColor)) {
|
||||||
clearColor = new R3.API.Color(0.11, 0.11, 0.11);
|
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
|
||||||
}
|
}
|
||||||
this.clearColor = clearColor;
|
this.clearColor = clearColor;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(viewports)) {
|
if (R3.Utils.UndefinedOrNull(viewports)) {
|
||||||
viewports = [new R3.D3.API.Viewport(
|
viewports = [new R3.D3.API.Viewport()];
|
||||||
null,
|
|
||||||
null,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
)];
|
|
||||||
}
|
}
|
||||||
this.viewports = viewports;
|
this.viewports = viewports;
|
||||||
|
|
||||||
|
@ -275,15 +259,34 @@ R3.API.Renderer.D3 = function (
|
||||||
}
|
}
|
||||||
this.opacity = opacity;
|
this.opacity = opacity;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(composer)) {
|
||||||
|
composer = new R3.API.Composer();
|
||||||
|
composer.renderer = this.id;
|
||||||
|
}
|
||||||
|
this.composer = composer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(effect)) {
|
||||||
|
effect = new R3.API.Effect();
|
||||||
|
effect.renderer = this.id;
|
||||||
|
}
|
||||||
|
this.effect = effect;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(enableComposer)) {
|
||||||
|
enableComposer = false;
|
||||||
|
}
|
||||||
|
this.enableComposer = enableComposer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(enableEffect)) {
|
||||||
|
enableEffect = false;
|
||||||
|
}
|
||||||
|
this.enableEffect = enableEffect;
|
||||||
|
|
||||||
R3.API.Renderer.call(
|
R3.API.Renderer.call(
|
||||||
this,
|
this,
|
||||||
apiRenderer.id,
|
apiRenderer.id,
|
||||||
apiRenderer.name,
|
apiRenderer.name,
|
||||||
|
apiRenderer.parent,
|
||||||
apiRenderer.rendererType,
|
apiRenderer.rendererType,
|
||||||
apiRenderer.parentEntity,
|
|
||||||
apiRenderer.width,
|
|
||||||
apiRenderer.height,
|
|
||||||
apiRenderer.offset,
|
|
||||||
apiRenderer.canvas
|
apiRenderer.canvas
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* @param preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime
|
* @param preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime
|
||||||
* @param port
|
* @param port
|
||||||
* @param protocols
|
* @param protocols
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Server = function(
|
R3.API.Server = function(
|
||||||
|
@ -24,7 +24,7 @@ R3.API.Server = function(
|
||||||
preferIp,
|
preferIp,
|
||||||
port,
|
port,
|
||||||
protocols,
|
protocols,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -80,7 +80,7 @@ R3.API.Server = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.SERVER,
|
R3.Component.SERVER,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @param roomId
|
* @param roomId
|
||||||
* @param peerId
|
* @param peerId
|
||||||
* @param server R3.Server
|
* @param server R3.Server
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Socket = function(
|
R3.API.Socket = function(
|
||||||
|
@ -16,7 +16,7 @@ R3.API.Socket = function(
|
||||||
roomId,
|
roomId,
|
||||||
peerId,
|
peerId,
|
||||||
server,
|
server,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -87,7 +87,7 @@ R3.API.Socket = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.API.Socket.GetComponentType(this.socketType),
|
R3.API.Socket.GetComponentType(this.socketType),
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ R3.API.Socket.Cast = function(
|
||||||
apiSocket.roomId,
|
apiSocket.roomId,
|
||||||
apiSocket.peerId,
|
apiSocket.peerId,
|
||||||
apiSocket.server,
|
apiSocket.server,
|
||||||
apiSocket.parentEntity
|
apiSocket.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ R3.API.Socket.Receive = function(
|
||||||
apiSocket.roomId,
|
apiSocket.roomId,
|
||||||
apiSocket.peerId,
|
apiSocket.peerId,
|
||||||
apiSocket.server,
|
apiSocket.server,
|
||||||
apiSocket.parentEntity
|
apiSocket.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @param center
|
* @param center
|
||||||
* @param radius
|
* @param radius
|
||||||
*/
|
*/
|
||||||
R3.API.Sphere = function (
|
R3.API.Sphere = function(
|
||||||
center,
|
center,
|
||||||
radius
|
radius
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param domElement
|
* @param domElement
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Stats = function(
|
R3.API.Stats = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
domElement,
|
domElement,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -31,7 +31,7 @@ R3.API.Stats = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.STATS,
|
R3.Component.STATS,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ R3.API.Stats.FromObject = function(objectStats) {
|
||||||
objectStats.id,
|
objectStats.id,
|
||||||
objectStats.name,
|
objectStats.name,
|
||||||
apiDomElement,
|
apiDomElement,
|
||||||
objectStats.parentEntity
|
objectStats.parent
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @param id String
|
* @param id String
|
||||||
* @param name String
|
* @param name String
|
||||||
* @param systemType
|
* @param systemType
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.System = function (
|
R3.API.System = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
systemType,
|
systemType,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -81,7 +81,7 @@ R3.API.System = function (
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
componentType,
|
componentType,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -99,6 +99,6 @@ R3.API.System.FromObject = function(objectComponent) {
|
||||||
objectComponent.id,
|
objectComponent.id,
|
||||||
objectComponent.name,
|
objectComponent.name,
|
||||||
objectComponent.systemType,
|
objectComponent.systemType,
|
||||||
objectComponent.parentEntity
|
objectComponent.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* API User
|
* API User
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param googleId
|
* @param googleId
|
||||||
* @param fullName
|
* @param fullName
|
||||||
* @param givenName
|
* @param givenName
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
R3.API.User = function(
|
R3.API.User = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parent,
|
||||||
googleId,
|
googleId,
|
||||||
fullName,
|
fullName,
|
||||||
givenName,
|
givenName,
|
||||||
|
@ -79,7 +79,7 @@ R3.API.User = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.USER,
|
R3.Component.USER,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
R3.API.Vector2 = function (x, y) {
|
/**
|
||||||
|
* R3.API.Vector2
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.API.Vector2 = function(x, y) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(x)) {
|
if (R3.Utils.UndefinedOrNull(x)) {
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -9,34 +15,134 @@ R3.API.Vector2 = function (x, y) {
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.API.Vector2.prototype.copy = function () {
|
|
||||||
return new R3.API.Vector2(
|
|
||||||
this.x,
|
|
||||||
this.y
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.API.Vector2.prototype.equals = function (v) {
|
|
||||||
return this.x === v.x && this.y === v.y;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an API vector from an Object vector
|
* Equals
|
||||||
* @param objectVector
|
* TODO: Test
|
||||||
* @constructor
|
* @param v
|
||||||
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
R3.API.Vector2.FromObject = function (objectVector) {
|
R3.API.Vector2.prototype.equals = function(v) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(objectVector)) {
|
if ((this.x === v.x) &&
|
||||||
console.warn('vector from db undefined - stale version in db');
|
(this.y === v.y)) {
|
||||||
objectVector = {};
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new R3.API.Vector2(
|
|
||||||
objectVector.x,
|
|
||||||
objectVector.y
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add
|
||||||
|
* TODO: Test
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.add = function(v) {
|
||||||
|
this.x += v.x;
|
||||||
|
this.y += v.y;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtract
|
||||||
|
* TODO: Test
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.subtract = function(v) {
|
||||||
|
this.x -= v.x;
|
||||||
|
this.y -= v.y;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiply
|
||||||
|
* TODO: Test
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.multiply = function(v) {
|
||||||
|
this.x *= v.x;
|
||||||
|
this.y *= v.y;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Divide
|
||||||
|
* TODO: Test
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.divide = function(v) {
|
||||||
|
this.x *= (1.0 / v.x);
|
||||||
|
this.y *= (1.0 / v.y);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clamp
|
||||||
|
* TODO: Test
|
||||||
|
* @param min R3.API.Vector2
|
||||||
|
* @param max R3.API.Vector2
|
||||||
|
* @returns {R3.API.Vector2}
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.clamp = function(min, max) {
|
||||||
|
|
||||||
|
this.x = Math.max(min.x, Math.min(max.x, this.x));
|
||||||
|
this.y = Math.max(min.y, Math.min(max.y, this.y));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Length
|
||||||
|
* TODO: Test
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.length = function() {
|
||||||
|
return Math.sqrt(
|
||||||
|
this.x * this.x + this.y * this.y
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dot product
|
||||||
|
* TODO: Test
|
||||||
|
* @param v
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.dot = function(v) {
|
||||||
|
return this.x * v.x + this.y * v.y;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize
|
||||||
|
* TODO: Test
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.normalize = function() {
|
||||||
|
return this.multiply(1.0 / this.length());
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Test
|
||||||
|
* Angle between this vector and origin
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.angle = function() {
|
||||||
|
var angle = Math.atan2(this.y, this.x);
|
||||||
|
if ( angle < 0 ) angle += 2 * Math.PI;
|
||||||
|
return angle;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interpolate to v from here
|
||||||
|
* TODO: Test
|
||||||
|
* @param v
|
||||||
|
* @param alpha
|
||||||
|
* @returns {R3.API.Vector2}
|
||||||
|
*/
|
||||||
|
R3.API.Vector2.prototype.lerp = function( v, alpha ) {
|
||||||
|
this.x += ( v.x - this.x ) * alpha;
|
||||||
|
this.y += ( v.y - this.y ) * alpha;
|
||||||
|
return this;
|
||||||
|
};
|
|
@ -1,4 +1,11 @@
|
||||||
R3.API.Vector3 = function (x, y, z) {
|
/**
|
||||||
|
* R3.API.Vector3
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.API.Vector3 = function(x, y, z) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(x)) {
|
if (R3.Utils.UndefinedOrNull(x)) {
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -17,6 +24,13 @@ R3.API.Vector3 = function (x, y, z) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
R3.API.Vector3.prototype.setFrom = function(vector3) {
|
||||||
|
this.x = vector3.x;
|
||||||
|
this.y = vector3.y;
|
||||||
|
this.z = vector3.z;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.negate = function() {
|
R3.API.Vector3.prototype.negate = function() {
|
||||||
this.x = -this.x;
|
this.x = -this.x;
|
||||||
this.y = -this.y;
|
this.y = -this.y;
|
||||||
|
@ -24,71 +38,55 @@ R3.API.Vector3.prototype.negate = function() {
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.subtract = function (v) {
|
R3.API.Vector3.prototype.subtract = function(v) {
|
||||||
return new R3.API.Vector3(
|
this.x -= v.x;
|
||||||
this.x - v.x,
|
this.y -= v.y;
|
||||||
this.y - v.y,
|
this.z -= v.z;
|
||||||
this.z - v.z
|
return this;
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.sub = function (v) {
|
R3.API.Vector3.prototype.sub = function(v) {
|
||||||
return new R3.API.Vector3(
|
return this.subtract(v);
|
||||||
this.x - v.x,
|
|
||||||
this.y - v.y,
|
|
||||||
this.z - v.z
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.equals = function (v) {
|
R3.API.Vector3.prototype.equals = function(v) {
|
||||||
return this.x === v.x && this.y === v.y && this.z === v.z;
|
return this.x === v.x && this.y === v.y && this.z === v.z;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.cross = function (v) {
|
R3.API.Vector3.prototype.cross = function(v) {
|
||||||
return new R3.API.Vector3(
|
var x = this.y * v.z - this.z * v.y;
|
||||||
this.y * v.z - this.z * v.y,
|
var y = this.z * v.x - this.x * v.z;
|
||||||
this.z * v.x - this.x * v.z,
|
var z = this.x * v.y - this.y * v.x;
|
||||||
this.x * v.y - this.y * v.x
|
this.x = x;
|
||||||
);
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.clockwise = function (u, v, w, viewPoint) {
|
R3.API.Vector3.prototype.lookAt = function(at, up) {
|
||||||
var normal = R3.API.Vector3.normal(u, v, w);
|
|
||||||
var uv = u.copy();
|
|
||||||
var winding = normal.dot(uv.subtract(viewPoint));
|
|
||||||
return (winding > 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.API.Vector3.normal = function (u, v, w) {
|
|
||||||
var vv = v.copy();
|
|
||||||
var wv = w.copy();
|
|
||||||
return vv.subtract(u).cross(wv.subtract(u));
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.API.Vector3.prototype.lookAt = function (at, up) {
|
|
||||||
var lookAtMatrix = R3.API.Matrix4.lookAt(this, at, up);
|
var lookAtMatrix = R3.API.Matrix4.lookAt(this, at, up);
|
||||||
return this.multiply(lookAtMatrix);
|
return this.multiply(lookAtMatrix);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.translate = function (v) {
|
R3.API.Vector3.prototype.translate = function(v) {
|
||||||
this.x += v.x;
|
this.x += v.x;
|
||||||
this.y += v.y;
|
this.y += v.y;
|
||||||
this.z += v.z;
|
this.z += v.z;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.add = function (v) {
|
R3.API.Vector3.prototype.add = function(v) {
|
||||||
this.x += v.x;
|
this.x += v.x;
|
||||||
this.y += v.y;
|
this.y += v.y;
|
||||||
this.z += v.z;
|
this.z += v.z;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.squared = function () {
|
R3.API.Vector3.prototype.squared = function() {
|
||||||
return this.x * this.x + this.y * this.y + this.z * this.z;
|
return this.x * this.x + this.y * this.y + this.z * this.z;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.copy = function () {
|
R3.API.Vector3.prototype.copy = function() {
|
||||||
return new R3.API.Vector3(
|
return new R3.API.Vector3(
|
||||||
this.x,
|
this.x,
|
||||||
this.y,
|
this.y,
|
||||||
|
@ -96,18 +94,23 @@ R3.API.Vector3.prototype.copy = function () {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.set = function (x, y, z) {
|
R3.API.Vector3.prototype.set = function(x, y, z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.lerp = function ( v, alpha ) {
|
R3.API.Vector3.prototype.lerp = function( v, alpha ) {
|
||||||
return new R3.API.Vector3(
|
|
||||||
this.x + ( v.x - this.x ) * alpha,
|
var x = this.x + ( v.x - this.x ) * alpha;
|
||||||
this.y + ( v.y - this.y ) * alpha,
|
var y = this.y + ( v.y - this.y ) * alpha;
|
||||||
this.z + ( v.z - this.z ) * alpha
|
var z = this.z + ( v.z - this.z ) * alpha;
|
||||||
);
|
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
|
||||||
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.distanceTo = function(v) {
|
R3.API.Vector3.prototype.distanceTo = function(v) {
|
||||||
|
@ -135,11 +138,11 @@ R3.API.Vector3.AngleDirection = function(forward, directionToCheck, up) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiplies this vector with a scalar, vector or matrix. If you want a copy, copy() it first
|
* Multiplies this vector with a scalar, vector or matrix. If you want a copy, copy() it first
|
||||||
* @param object {Number | R3.API.Vector3 | R3.API.Vector4 | R3.API.Matrix3 | R3.API.Matrix4}
|
* @param object {Number | R3.API.Vector3 | R3.Vector4 | R3.API.Matrix3 | R3.API.Matrix4}
|
||||||
* @param cross boolean true if you want the cross product, otherwise returns the scalar (dot or inner) product
|
* @param cross boolean true if you want the cross product, otherwise returns the scalar (dot or inner) product
|
||||||
* @returns {R3.API.Vector3 | Number}
|
* @returns {R3.API.Vector3 | Number}
|
||||||
*/
|
*/
|
||||||
R3.API.Vector3.prototype.multiply = function (object, cross) {
|
R3.API.Vector3.prototype.multiply = function(object, cross) {
|
||||||
|
|
||||||
var x, y, z;
|
var x, y, z;
|
||||||
|
|
||||||
|
@ -188,11 +191,11 @@ R3.API.Vector3.prototype.multiply = function (object, cross) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
R3.API.Vector3.prototype.dot = function (v) {
|
R3.API.Vector3.prototype.dot = function(v) {
|
||||||
return (this.x * v.x) + (this.y * v.y) + (this.z * v.z);
|
return (this.x * v.x) + (this.y * v.y) + (this.z * v.z);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.normalize = function () {
|
R3.API.Vector3.prototype.normalize = function() {
|
||||||
var EPSILON = 0.000001;
|
var EPSILON = 0.000001;
|
||||||
var v2 = this.squared();
|
var v2 = this.squared();
|
||||||
|
|
||||||
|
@ -201,19 +204,12 @@ R3.API.Vector3.prototype.normalize = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
var invLength = 1.0 / Math.sqrt(v2);
|
var invLength = 1.0 / Math.sqrt(v2);
|
||||||
return new R3.API.Vector3(
|
|
||||||
this.x * invLength,
|
|
||||||
this.y * invLength,
|
|
||||||
this.z * invLength
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.API.Vector3.prototype.clone = function () {
|
this.x *= invLength;
|
||||||
return new R3.API.Vector3(
|
this.y *= invLength;
|
||||||
this.x,
|
this.z *= invLength;
|
||||||
this.y,
|
|
||||||
this.z
|
return this;
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.applyQuaternion = function(q) {
|
R3.API.Vector3.prototype.applyQuaternion = function(q) {
|
||||||
|
@ -252,26 +248,7 @@ R3.API.Vector3.prototype.reflect = function(normal) {
|
||||||
return this.sub( v1.copy( normal ).multiply( 2 * this.dot( normal ) ) );
|
return this.sub( v1.copy( normal ).multiply( 2 * this.dot( normal ) ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Vector3.prototype.angleTo = function (v) {
|
R3.API.Vector3.prototype.angleTo = function(v) {
|
||||||
var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) );
|
var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) );
|
||||||
return Math.acos( exports.Math.clamp( theta, - 1, 1 ) );
|
return Math.acos( exports.Math.clamp( theta, - 1, 1 ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an API vector from an Object vector
|
|
||||||
* @param objectVector
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.API.Vector3.FromObject = function (objectVector) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(objectVector)) {
|
|
||||||
console.warn('vector from db undefined - stale version in db');
|
|
||||||
objectVector = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return new R3.API.Vector3(
|
|
||||||
objectVector.x,
|
|
||||||
objectVector.y,
|
|
||||||
objectVector.z
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,46 +1,31 @@
|
||||||
R3.API.Vector4 = function (x, y, z, w) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(x)) {
|
|
||||||
x = 0;
|
|
||||||
}
|
|
||||||
this.x = x;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(y)) {
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
this.y = y;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(z)) {
|
|
||||||
z = 0;
|
|
||||||
}
|
|
||||||
this.z = z;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(w)) {
|
|
||||||
w = 1;
|
|
||||||
}
|
|
||||||
this.w = w;
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.API.Vector4.prototype.equals = function (v) {
|
|
||||||
return this.x === v.x && this.y === v.y && this.z === v.z && this.w === v.w;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an API vector from an Object vector
|
* R3.API.Vector4
|
||||||
* @param objectVector
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @param w
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Vector4.FromObject = function (objectVector) {
|
R3.API.Vector4 = function(x, y, z, w) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(objectVector)) {
|
if (R3.Utils.UndefinedOrNull(x)) {
|
||||||
console.warn('vector from db undefined - stale version in db');
|
x = 0;
|
||||||
objectVector = {};
|
}
|
||||||
}
|
this.x = x;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(y)) {
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
this.y = y;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(z)) {
|
||||||
|
z = 0;
|
||||||
|
}
|
||||||
|
this.z = z;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(w)) {
|
||||||
|
w = 0;
|
||||||
|
}
|
||||||
|
this.w = w;
|
||||||
|
|
||||||
return new R3.API.Vector4(
|
|
||||||
objectVector.x,
|
|
||||||
objectVector.y,
|
|
||||||
objectVector.z,
|
|
||||||
objectVector.w
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* R3.API.Video
|
* R3.API.Video
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param autoUpdateSize
|
* @param autoUpdateSize
|
||||||
* @param width
|
* @param width
|
||||||
* @param height
|
* @param height
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
R3.API.Video = function(
|
R3.API.Video = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parent,
|
||||||
autoUpdateSize,
|
autoUpdateSize,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -60,7 +60,7 @@ R3.API.Video = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.VIDEO,
|
R3.Component.VIDEO,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,49 +1,46 @@
|
||||||
/**
|
/**
|
||||||
* R3.Box3
|
* R3.Box3
|
||||||
* @param implementation
|
|
||||||
* @param apiBox3
|
* @param apiBox3
|
||||||
* @param parentObject
|
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Box3 = function (
|
R3.Box3 = function(
|
||||||
implementation,
|
apiBox3
|
||||||
apiBox3,
|
|
||||||
parentObject
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.implementation = implementation;
|
|
||||||
this.implementation.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(parentObject)) {
|
|
||||||
parentObject = null;
|
|
||||||
}
|
|
||||||
this.parentObject = parentObject;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiBox3)) {
|
if (R3.Utils.UndefinedOrNull(apiBox3)) {
|
||||||
apiBox3 = {};
|
apiBox3 = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.API.Box3.call(
|
R3.API.Box3.call(
|
||||||
this,
|
this,
|
||||||
apiBox3.id,
|
apiBox3,
|
||||||
apiBox3.name,
|
|
||||||
apiBox3.parentEntity,
|
|
||||||
apiBox3.min,
|
apiBox3.min,
|
||||||
apiBox3.max
|
apiBox3.max
|
||||||
);
|
);
|
||||||
|
|
||||||
this.min = new R3.Vector3(
|
this.min = new R3.Vector3(
|
||||||
this.implementation,
|
this,
|
||||||
this.min,
|
this.min,
|
||||||
this
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.max = new R3.Vector3(
|
this.max = new R3.Vector3(
|
||||||
this.implementation,
|
this,
|
||||||
this.max,
|
this.max
|
||||||
this
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.graphics = null;
|
||||||
|
this.physics = null;
|
||||||
|
|
||||||
|
R3.Event.Emit(
|
||||||
|
R3.Event.GET_RUNTIME,
|
||||||
|
function(runtime) {
|
||||||
|
this.graphics = runtime.graphics;
|
||||||
|
this.physics = runtime.physics;
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.componentRuntime = R3.Component.GetComponentRuntime(parent);
|
||||||
|
|
||||||
this.createInstance();
|
this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,10 +53,22 @@ R3.Box3.prototype.constructor = R3.Box3;
|
||||||
*/
|
*/
|
||||||
R3.Box3.prototype.createInstance = function() {
|
R3.Box3.prototype.createInstance = function() {
|
||||||
|
|
||||||
this.instance = new THREE.Box3(
|
switch (this.componentRuntime) {
|
||||||
this.min.instance,
|
case R3.Component.GRAPHICS_RUNTIME :
|
||||||
this.max.instance
|
this.instance = this.graphics.Box3(
|
||||||
);
|
this.min,
|
||||||
|
this.max
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case R3.Component.PHYSICS_RUNTIME :
|
||||||
|
this.instance = this.physics.Box3(
|
||||||
|
this.min,
|
||||||
|
this.max
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error('unhandled component runtime: ' + this.componentRuntime);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,9 +97,11 @@ R3.Box3.prototype.updateInstance = function(property) {
|
||||||
*/
|
*/
|
||||||
R3.Box3.prototype.toApiObject = function() {
|
R3.Box3.prototype.toApiObject = function() {
|
||||||
return new R3.API.Box3(
|
return new R3.API.Box3(
|
||||||
this.id,
|
new R3.API.Component(
|
||||||
this.name,
|
this.parent,
|
||||||
R3.Utils.IdOrNull(this.parentEntity),
|
this.id,
|
||||||
|
this.name
|
||||||
|
),
|
||||||
this.min.toApiObject(),
|
this.min.toApiObject(),
|
||||||
this.max.toApiObject()
|
this.max.toApiObject()
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,7 +19,7 @@ R3.Canvas = function(
|
||||||
this,
|
this,
|
||||||
apiCanvas.id,
|
apiCanvas.id,
|
||||||
apiCanvas.name,
|
apiCanvas.name,
|
||||||
apiCanvas.parentEntity,
|
apiCanvas.parent,
|
||||||
apiCanvas.parentTexture,
|
apiCanvas.parentTexture,
|
||||||
apiCanvas.autoUpdateSize,
|
apiCanvas.autoUpdateSize,
|
||||||
apiCanvas.width,
|
apiCanvas.width,
|
||||||
|
@ -163,7 +163,7 @@ R3.Canvas.prototype.toApiObject = function() {
|
||||||
return new R3.API.Canvas(
|
return new R3.API.Canvas(
|
||||||
this.id,
|
this.id,
|
||||||
this.name,
|
this.name,
|
||||||
R3.Utils.IdOrNull(this.parentEntity),
|
R3.Utils.IdOrNull(this.parent),
|
||||||
R3.Utils.IdOrNull(this.parentTexture),
|
R3.Utils.IdOrNull(this.parentTexture),
|
||||||
this.autoUpdateSize,
|
this.autoUpdateSize,
|
||||||
this.width,
|
this.width,
|
||||||
|
|
|
@ -20,7 +20,7 @@ R3.Clock = function(
|
||||||
this,
|
this,
|
||||||
apiClock.id,
|
apiClock.id,
|
||||||
apiClock.name,
|
apiClock.name,
|
||||||
apiClock.parentEntity
|
apiClock.parent
|
||||||
);
|
);
|
||||||
|
|
||||||
R3.Component.call(this);
|
R3.Component.call(this);
|
||||||
|
@ -72,7 +72,7 @@ R3.Clock.prototype.toApiObject = function() {
|
||||||
return new R3.API.Clock(
|
return new R3.API.Clock(
|
||||||
this.id,
|
this.id,
|
||||||
this.name,
|
this.name,
|
||||||
R3.Utils.IdOrNull(this.parentEntity)
|
R3.Utils.IdOrNull(this.parent)
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @param grain Number
|
* @param grain Number
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Color = function (
|
R3.Color = function(
|
||||||
graphics,
|
graphics,
|
||||||
apiColor,
|
apiColor,
|
||||||
parentObject,
|
parentObject,
|
||||||
|
@ -76,7 +76,7 @@ R3.Color.prototype.updateInstance = function(property) {
|
||||||
* @returns {R3.API.Color}
|
* @returns {R3.API.Color}
|
||||||
*/
|
*/
|
||||||
R3.Color.prototype.toApiObject = function() {
|
R3.Color.prototype.toApiObject = function() {
|
||||||
return new R3.API.Color(
|
return new R3.API.Color(this,
|
||||||
this.r,
|
this.r,
|
||||||
this.g,
|
this.g,
|
||||||
this.b,
|
this.b,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @property controlsType
|
* @property controlsType
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls = function (
|
R3.Controls = function(
|
||||||
apiControls
|
apiControls
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -16,9 +16,8 @@ R3.Controls = function (
|
||||||
this,
|
this,
|
||||||
apiControls.id,
|
apiControls.id,
|
||||||
apiControls.name,
|
apiControls.name,
|
||||||
apiControls.controlsType,
|
|
||||||
apiControls.canvas,
|
apiControls.canvas,
|
||||||
apiControls.parentEntity
|
apiControls.parent
|
||||||
);
|
);
|
||||||
|
|
||||||
var linkedObjects = {
|
var linkedObjects = {
|
||||||
|
@ -93,7 +92,7 @@ R3.Controls.prototype.toApiObject = function() {
|
||||||
this.name,
|
this.name,
|
||||||
this.controlsType,
|
this.controlsType,
|
||||||
R3.Utils.IdOrNull(this.canvas),
|
R3.Utils.IdOrNull(this.canvas),
|
||||||
R3.Utils.IdOrNull(this.parentEntity)
|
R3.Utils.IdOrNull(this.parent)
|
||||||
);
|
);
|
||||||
|
|
||||||
return apiControls;
|
return apiControls;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @param apiEditorControls
|
* @param apiEditorControls
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.Editor = function (
|
R3.Controls.D3.Editor = function(
|
||||||
graphics,
|
graphics,
|
||||||
apiEditorControls
|
apiEditorControls
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @param apiFirstPersonControls
|
* @param apiFirstPersonControls
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.FirstPerson = function (
|
R3.Controls.D3.FirstPerson = function(
|
||||||
graphics,
|
graphics,
|
||||||
apiFirstPersonControls
|
apiFirstPersonControls
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @param apiOrbitControls
|
* @param apiOrbitControls
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.Orbit = function (
|
R3.Controls.D3.Orbit = function(
|
||||||
graphics,
|
graphics,
|
||||||
apiOrbitControls
|
apiOrbitControls
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* @param apiKeyboardControls R3.API.Controls
|
* @param apiKeyboardControls R3.API.Controls
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.Keyboard = function (
|
R3.Controls.Keyboard = function(
|
||||||
apiKeyboardControls
|
apiKeyboardControls
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* @param apiMouseControls R3.API.Controls
|
* @param apiMouseControls R3.API.Controls
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.Mouse = function (
|
R3.Controls.Mouse = function(
|
||||||
apiMouseControls
|
apiMouseControls
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param apiTouchControls
|
* @param apiTouchControls
|
||||||
*/
|
*/
|
||||||
R3.Controls.Touch = function (
|
R3.Controls.Touch = function(
|
||||||
apiTouchControls
|
apiTouchControls
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ R3.Curve = function(
|
||||||
apiCurve.id,
|
apiCurve.id,
|
||||||
apiCurve.name,
|
apiCurve.name,
|
||||||
apiCurve.curveType,
|
apiCurve.curveType,
|
||||||
apiCurve.parentEntity,
|
apiCurve.parent,
|
||||||
apiCurve.arcLenghDivisions
|
apiCurve.arcLenghDivisions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ R3.Curve.prototype.toApiObject = function() {
|
||||||
this.id,
|
this.id,
|
||||||
this.name,
|
this.name,
|
||||||
this.curveType,
|
this.curveType,
|
||||||
R3.Utils.IdOrNull(this.parentEntity),
|
R3.Utils.IdOrNull(this.parent),
|
||||||
this.arcLenghDivisions
|
this.arcLenghDivisions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ R3.CustomCode = function(
|
||||||
apiCustomCode.name,
|
apiCustomCode.name,
|
||||||
apiCustomCode.eventId,
|
apiCustomCode.eventId,
|
||||||
apiCustomCode.code,
|
apiCustomCode.code,
|
||||||
apiCustomCode.parentEntity
|
apiCustomCode.parent
|
||||||
);
|
);
|
||||||
|
|
||||||
this.editor = null;
|
this.editor = null;
|
||||||
|
@ -62,7 +62,7 @@ R3.CustomCode.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.instance = new Function('data', this.code).bind(this);
|
this.instance = new Function('data', this.code).bind(this);
|
||||||
this.publish(
|
this.emit(
|
||||||
R3.Event.COMPILE_SUCCESS,
|
R3.Event.COMPILE_SUCCESS,
|
||||||
{
|
{
|
||||||
component: this
|
component: this
|
||||||
|
@ -70,7 +70,7 @@ R3.CustomCode.prototype.updateInstance = function(property) {
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.instance = new Function('data', "console.log('compilation update failed for : " + this.name + "');").bind(this);
|
this.instance = new Function('data', "console.log('compilation update failed for : " + this.name + "');").bind(this);
|
||||||
this.publish(
|
this.emit(
|
||||||
R3.Event.COMPILE_FAILED,
|
R3.Event.COMPILE_FAILED,
|
||||||
{
|
{
|
||||||
component: this
|
component: this
|
||||||
|
@ -82,7 +82,7 @@ R3.CustomCode.prototype.updateInstance = function(property) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'eventId') {
|
if (property === 'eventId') {
|
||||||
this.publish(
|
this.emit(
|
||||||
R3.Event.EVENT_ID_UPDATE,
|
R3.Event.EVENT_ID_UPDATE,
|
||||||
{
|
{
|
||||||
component : this
|
component : this
|
||||||
|
@ -104,7 +104,7 @@ R3.CustomCode.prototype.toApiObject = function() {
|
||||||
this.name,
|
this.name,
|
||||||
this.eventId,
|
this.eventId,
|
||||||
this.code,
|
this.code,
|
||||||
R3.Utils.IdOrNull(this.parentEntity)
|
R3.Utils.IdOrNull(this.parent)
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param objectType
|
* @param objectType
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param useQuaternion
|
* @param useQuaternion
|
||||||
* @param position
|
* @param position
|
||||||
* @param quaternion
|
* @param quaternion
|
||||||
|
@ -17,7 +17,7 @@ R3.D3.API.Object = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
objectType,
|
objectType,
|
||||||
parentEntity,
|
parent,
|
||||||
useQuaternion,
|
useQuaternion,
|
||||||
position,
|
position,
|
||||||
quaternion,
|
quaternion,
|
||||||
|
@ -115,7 +115,7 @@ R3.D3.API.Object = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.D3.API.Object.GetComponentType(this.objectType),
|
R3.D3.API.Object.GetComponentType(this.objectType),
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
* @param blocking
|
* @param blocking
|
||||||
* @param applyToMeshWhenDone
|
* @param applyToMeshWhenDone
|
||||||
* @param meshes
|
* @param meshes
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Animation = function (
|
R3.D3.API.Animation = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
rotationSpeed,
|
rotationSpeed,
|
||||||
|
@ -26,7 +26,7 @@ R3.D3.API.Animation = function (
|
||||||
blocking,
|
blocking,
|
||||||
applyToMeshWhenDone,
|
applyToMeshWhenDone,
|
||||||
meshes,
|
meshes,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -90,7 +90,7 @@ R3.D3.API.Animation = function (
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.ANIMATION,
|
R3.Component.ANIMATION,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,6 +116,6 @@ R3.D3.API.Animation.FromObject = function(objectComponent) {
|
||||||
objectComponent.blocking,
|
objectComponent.blocking,
|
||||||
objectComponent.applyToMeshWhenDone,
|
objectComponent.applyToMeshWhenDone,
|
||||||
objectComponent.meshes,
|
objectComponent.meshes,
|
||||||
objectComponent.parentEntity
|
objectComponent.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* @param camera
|
* @param camera
|
||||||
* @param overplay
|
* @param overplay
|
||||||
* @param paused
|
* @param paused
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Audio = function(
|
R3.D3.API.Audio = function(
|
||||||
|
@ -20,7 +20,7 @@ R3.D3.API.Audio = function(
|
||||||
camera,
|
camera,
|
||||||
overplay,
|
overplay,
|
||||||
paused,
|
paused,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -66,7 +66,7 @@ R3.D3.API.Audio = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.AUDIO,
|
R3.Component.AUDIO,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ R3.D3.API.Audio.FromObject = function(objectAudio) {
|
||||||
apiCamera,
|
apiCamera,
|
||||||
objectAudio.overplay,
|
objectAudio.overplay,
|
||||||
objectAudio.paused,
|
objectAudio.paused,
|
||||||
objectAudio.parentEntity
|
objectAudio.parent
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @param weight float
|
* @param weight float
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.BoneWeight = function (
|
R3.D3.API.BoneWeight = function(
|
||||||
boneIndex,
|
boneIndex,
|
||||||
weight
|
weight
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* @param parentBoneIds
|
* @param parentBoneIds
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Bone = function (
|
R3.D3.API.Bone = function(
|
||||||
apiD3Object,
|
apiD3Object,
|
||||||
childBoneIds,
|
childBoneIds,
|
||||||
parentBoneIds
|
parentBoneIds
|
||||||
|
@ -36,7 +36,7 @@ R3.D3.API.Bone = function (
|
||||||
apiD3Object.id,
|
apiD3Object.id,
|
||||||
apiD3Object.name,
|
apiD3Object.name,
|
||||||
apiD3Object.objectType,
|
apiD3Object.objectType,
|
||||||
apiD3Object.parentEntity,
|
apiD3Object.parent,
|
||||||
apiD3Object.useQuaternion,
|
apiD3Object.useQuaternion,
|
||||||
apiD3Object.position,
|
apiD3Object.position,
|
||||||
apiD3Object.quaternion,
|
apiD3Object.quaternion,
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param broadphaseType
|
* @param broadphaseType
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Broadphase = function(
|
R3.D3.API.Broadphase = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
broadphaseType,
|
broadphaseType,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -31,7 +31,7 @@ R3.D3.API.Broadphase = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.BROADPHASE,
|
R3.Component.BROADPHASE,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ R3.D3.API.Broadphase.FromObject = function(objectBroadphase) {
|
||||||
objectBroadphase.id,
|
objectBroadphase.id,
|
||||||
objectBroadphase.name,
|
objectBroadphase.name,
|
||||||
objectBroadphase.broadphaseType,
|
objectBroadphase.broadphaseType,
|
||||||
objectBroadphase.parentEntity
|
objectBroadphase.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ R3.D3.API.Camera = function(
|
||||||
apiD3Object.id,
|
apiD3Object.id,
|
||||||
apiD3Object.name,
|
apiD3Object.name,
|
||||||
apiD3Object.objectType,
|
apiD3Object.objectType,
|
||||||
apiD3Object.parentEntity,
|
apiD3Object.parent,
|
||||||
apiD3Object.useQuaternion,
|
apiD3Object.useQuaternion,
|
||||||
apiD3Object.position,
|
apiD3Object.position,
|
||||||
apiD3Object.quaternion,
|
apiD3Object.quaternion,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* R3.D3.API.Composer
|
* R3.D3.API.Composer
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param autoUpdateSize
|
* @param autoUpdateSize
|
||||||
* @param width
|
* @param width
|
||||||
* @param height
|
* @param height
|
||||||
|
@ -11,10 +11,10 @@
|
||||||
* @param passes
|
* @param passes
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Composer = function (
|
R3.D3.API.Composer = function(
|
||||||
|
parent,
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
|
||||||
autoUpdateSize,
|
autoUpdateSize,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -22,6 +22,12 @@ R3.D3.API.Composer = function (
|
||||||
renderTarget,
|
renderTarget,
|
||||||
passes
|
passes
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||||
|
parent = null;
|
||||||
|
}
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +54,13 @@ R3.D3.API.Composer = function (
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(renderer)) {
|
if (R3.Utils.UndefinedOrNull(renderer)) {
|
||||||
renderer = null;
|
|
||||||
|
if (this.parent && this.parent.parent.renderer) {
|
||||||
|
renderer = this.parent.parent.renderer;
|
||||||
|
} else {
|
||||||
|
renderer = null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
|
|
||||||
|
@ -65,7 +77,7 @@ R3.D3.API.Composer = function (
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.COMPOSER,
|
R3.Component.COMPOSER,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param effectType
|
* @param effectType
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param renderer
|
* @param renderer
|
||||||
* @param width
|
* @param width
|
||||||
* @param height
|
* @param height
|
||||||
|
@ -16,7 +16,7 @@ R3.D3.API.Effect = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
effectType,
|
effectType,
|
||||||
parentEntity,
|
parent,
|
||||||
renderer,
|
renderer,
|
||||||
width,
|
width,
|
||||||
height
|
height
|
||||||
|
@ -87,7 +87,7 @@ R3.D3.API.Effect = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
componentType,
|
componentType,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ R3.D3.API.Effect.Anaglyph = function(
|
||||||
apiEffect.id,
|
apiEffect.id,
|
||||||
apiEffect.name,
|
apiEffect.name,
|
||||||
apiEffect.effectType,
|
apiEffect.effectType,
|
||||||
apiEffect.parentEntity,
|
apiEffect.parent,
|
||||||
apiEffect.renderer,
|
apiEffect.renderer,
|
||||||
apiEffect.width,
|
apiEffect.width,
|
||||||
apiEffect.height
|
apiEffect.height
|
||||||
|
|
|
@ -22,7 +22,7 @@ R3.D3.API.Effect.Parallax = function(
|
||||||
apiEffect.id,
|
apiEffect.id,
|
||||||
apiEffect.name,
|
apiEffect.name,
|
||||||
apiEffect.effectType,
|
apiEffect.effectType,
|
||||||
apiEffect.parentEntity,
|
apiEffect.parent,
|
||||||
apiEffect.renderer,
|
apiEffect.renderer,
|
||||||
apiEffect.width,
|
apiEffect.width,
|
||||||
apiEffect.height
|
apiEffect.height
|
||||||
|
|
|
@ -29,7 +29,7 @@ R3.D3.API.Effect.Stereo = function(
|
||||||
apiEffect.id,
|
apiEffect.id,
|
||||||
apiEffect.name,
|
apiEffect.name,
|
||||||
apiEffect.effectType,
|
apiEffect.effectType,
|
||||||
apiEffect.parentEntity,
|
apiEffect.parent,
|
||||||
apiEffect.renderer,
|
apiEffect.renderer,
|
||||||
apiEffect.width,
|
apiEffect.width,
|
||||||
apiEffect.height
|
apiEffect.height
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* @param normal
|
* @param normal
|
||||||
* @param selected
|
* @param selected
|
||||||
* @param parentGeometry
|
* @param parentGeometry
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Face = function(
|
R3.D3.API.Face = function(
|
||||||
|
@ -30,7 +30,7 @@ R3.D3.API.Face = function(
|
||||||
normal,
|
normal,
|
||||||
selected,
|
selected,
|
||||||
parentGeometry,
|
parentGeometry,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -69,15 +69,15 @@ R3.D3.API.Face = function(
|
||||||
this.uvs = uvs;
|
this.uvs = uvs;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(color)) {
|
if (R3.Utils.UndefinedOrNull(color)) {
|
||||||
color = new R3.API.Color();
|
color = new R3.API.Color(this);
|
||||||
}
|
}
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(vertexColors)) {
|
if (R3.Utils.UndefinedOrNull(vertexColors)) {
|
||||||
vertexColors = [
|
vertexColors = [
|
||||||
new R3.API.Color(),
|
new R3.API.Color(this),
|
||||||
new R3.API.Color(),
|
new R3.API.Color(this),
|
||||||
new R3.API.Color()
|
new R3.API.Color(this)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
this.vertexColors = vertexColors;
|
this.vertexColors = vertexColors;
|
||||||
|
@ -105,7 +105,7 @@ R3.D3.API.Face = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.FACE,
|
R3.Component.FACE,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* @param near
|
* @param near
|
||||||
* @param far
|
* @param far
|
||||||
* @param density
|
* @param density
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Fog = function(
|
R3.D3.API.Fog = function(
|
||||||
|
@ -18,7 +18,7 @@ R3.D3.API.Fog = function(
|
||||||
near,
|
near,
|
||||||
far,
|
far,
|
||||||
density,
|
density,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -37,7 +37,7 @@ R3.D3.API.Fog = function(
|
||||||
this.exponential = exponential;
|
this.exponential = exponential;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(color)) {
|
if (R3.Utils.UndefinedOrNull(color)) {
|
||||||
color = new R3.API.Color(1, 1, 1, 1)
|
color = new R3.API.Color(this, 1, 1, 1, 1)
|
||||||
}
|
}
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ R3.D3.API.Fog = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.FOG,
|
R3.Component.FOG,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param url
|
* @param url
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Font = function(
|
R3.D3.API.Font = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
url,
|
url,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -30,7 +30,7 @@ R3.D3.API.Font = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.FONT,
|
R3.Component.FONT,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +47,6 @@ R3.D3.API.Font.FromObject = function(objectFont) {
|
||||||
objectFont.id,
|
objectFont.id,
|
||||||
objectFont.name,
|
objectFont.name,
|
||||||
objectFont.url,
|
objectFont.url,
|
||||||
objectFont.parentEntity
|
objectFont.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* @param contactEquationRelaxation
|
* @param contactEquationRelaxation
|
||||||
* @param frictionEquationStiffness
|
* @param frictionEquationStiffness
|
||||||
* @param frictionEquationRelaxation
|
* @param frictionEquationRelaxation
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.FrictionContactMaterial = function(
|
R3.D3.API.FrictionContactMaterial = function(
|
||||||
|
@ -22,7 +22,7 @@ R3.D3.API.FrictionContactMaterial = function(
|
||||||
contactEquationRelaxation,
|
contactEquationRelaxation,
|
||||||
frictionEquationStiffness,
|
frictionEquationStiffness,
|
||||||
frictionEquationRelaxation,
|
frictionEquationRelaxation,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -73,7 +73,7 @@ R3.D3.API.FrictionContactMaterial = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.FRICTION_CONTACT_MATERIAL,
|
R3.Component.FRICTION_CONTACT_MATERIAL,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ R3.D3.API.FrictionContactMaterial.FromObject = function(objectFrictionContactMat
|
||||||
objectFrictionContactMaterial.contactEquationRelaxation,
|
objectFrictionContactMaterial.contactEquationRelaxation,
|
||||||
objectFrictionContactMaterial.frictionEquationStiffness,
|
objectFrictionContactMaterial.frictionEquationStiffness,
|
||||||
objectFrictionContactMaterial.frictionEquationRelaxation,
|
objectFrictionContactMaterial.frictionEquationRelaxation,
|
||||||
objectFrictionContactMaterial.parentEntity
|
objectFrictionContactMaterial.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @param name
|
* @param name
|
||||||
* @param friction
|
* @param friction
|
||||||
* @param restitution
|
* @param restitution
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.FrictionMaterial = function(
|
R3.D3.API.FrictionMaterial = function(
|
||||||
|
@ -12,7 +12,7 @@ R3.D3.API.FrictionMaterial = function(
|
||||||
name,
|
name,
|
||||||
friction,
|
friction,
|
||||||
restitution,
|
restitution,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
|
@ -38,7 +38,7 @@ R3.D3.API.FrictionMaterial = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.Component.FRICTION_MATERIAL,
|
R3.Component.FRICTION_MATERIAL,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ R3.D3.API.FrictionMaterial.FromObject = function(objectFrictionMaterial) {
|
||||||
objectFrictionMaterial.name,
|
objectFrictionMaterial.name,
|
||||||
objectFrictionMaterial.friction,
|
objectFrictionMaterial.friction,
|
||||||
objectFrictionMaterial.restitution,
|
objectFrictionMaterial.restitution,
|
||||||
objectFrictionMaterial.parentEntity
|
objectFrictionMaterial.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param geometryType
|
* @param geometryType
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @param parentMesh
|
* @param parentMesh
|
||||||
* @param boundingBox
|
* @param boundingBox
|
||||||
* @param boundingSphere
|
* @param boundingSphere
|
||||||
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
geometryType,
|
geometryType,
|
||||||
parentEntity,
|
parent,
|
||||||
parentMesh,
|
parentMesh,
|
||||||
boundingBox,
|
boundingBox,
|
||||||
boundingSphere,
|
boundingSphere,
|
||||||
|
@ -207,7 +207,7 @@ R3.D3.API.Geometry = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
R3.D3.API.Geometry.GetComponentType(this.geometryType),
|
R3.D3.API.Geometry.GetComponentType(this.geometryType),
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ R3.D3.API.Geometry.Buffer = function(
|
||||||
apiGeometry.id,
|
apiGeometry.id,
|
||||||
apiGeometry.name,
|
apiGeometry.name,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.geometryType,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.parent,
|
||||||
apiGeometry.parentMesh,
|
apiGeometry.parentMesh,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.boundingBox,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.boundingSphere,
|
||||||
|
|
|
@ -112,7 +112,7 @@ R3.D3.API.Geometry.Normal = function(
|
||||||
apiGeometry.id,
|
apiGeometry.id,
|
||||||
apiGeometry.name,
|
apiGeometry.name,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.geometryType,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.parent,
|
||||||
apiGeometry.parentMesh,
|
apiGeometry.parentMesh,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.boundingBox,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.boundingSphere,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @param color
|
* @param color
|
||||||
* @param intensity
|
* @param intensity
|
||||||
* @param parentScene
|
* @param parentScene
|
||||||
* @param parentEntity
|
* @param parent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Light = function(
|
R3.D3.API.Light = function(
|
||||||
|
@ -16,7 +16,7 @@ R3.D3.API.Light = function(
|
||||||
color,
|
color,
|
||||||
intensity,
|
intensity,
|
||||||
parentScene,
|
parentScene,
|
||||||
parentEntity
|
parent
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -59,7 +59,7 @@ R3.D3.API.Light = function(
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(color)) {
|
if (R3.Utils.UndefinedOrNull(color)) {
|
||||||
color = new R3.API.Color(1,1,1);
|
color = new R3.API.Color(this, 1,1,1);
|
||||||
}
|
}
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ R3.D3.API.Light = function(
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
componentType,
|
componentType,
|
||||||
parentEntity
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ R3.D3.API.Light.Ambient = function(
|
||||||
apiLight.color,
|
apiLight.color,
|
||||||
apiLight.intensity,
|
apiLight.intensity,
|
||||||
apiLight.parentScene,
|
apiLight.parentScene,
|
||||||
apiLight.parentEntity
|
apiLight.parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue