restructuring
parent
567b6b9f38
commit
b28b1bc99b
32
gulpfile.js
32
gulpfile.js
|
@ -17,7 +17,7 @@ code += '\t\tthis,\n';
|
||||||
code += '\t\tthis.apiComponent.parent,\n';
|
code += '\t\tthis.apiComponent.parent,\n';
|
||||||
code += '\t\tthis.apiComponent.id,\n';
|
code += '\t\tthis.apiComponent.id,\n';
|
||||||
code += '\t\tthis.apiComponent.name\n';
|
code += '\t\tthis.apiComponent.name\n';
|
||||||
code += '\t);';
|
code += '\t)';
|
||||||
|
|
||||||
var code2 = 'if (R3.Utils.UndefinedOrNull(apiGeometryBuffer)) {\n';
|
var code2 = 'if (R3.Utils.UndefinedOrNull(apiGeometryBuffer)) {\n';
|
||||||
code2 += '\t\tapiGeometryBuffer = {};\n';
|
code2 += '\t\tapiGeometryBuffer = {};\n';
|
||||||
|
@ -32,7 +32,7 @@ code2 += '\t\tthis.apiGeometryBuffer.drawRange,\n';
|
||||||
code2 += '\t\tthis.apiGeometryBuffer.groups,\n';
|
code2 += '\t\tthis.apiGeometryBuffer.groups,\n';
|
||||||
code2 += '\t\tthis.apiGeometryBuffer.index,\n';
|
code2 += '\t\tthis.apiGeometryBuffer.index,\n';
|
||||||
code2 += '\t\tthis.apiGeometryBuffer.morphAttributes\n';
|
code2 += '\t\tthis.apiGeometryBuffer.morphAttributes\n';
|
||||||
code2 += '\t);';
|
code2 += '\t)';
|
||||||
|
|
||||||
var code3 = 'if (R3.Utils.UndefinedOrNull(apiGeometryNormal)) {\n';
|
var code3 = 'if (R3.Utils.UndefinedOrNull(apiGeometryNormal)) {\n';
|
||||||
code3 += '\t\tapiGeometryNormal = {};\n';
|
code3 += '\t\tapiGeometryNormal = {};\n';
|
||||||
|
@ -55,7 +55,7 @@ code3 += '\t\tthis.apiGeometryNormal.normalsNeedUpdate,\n';
|
||||||
code3 += '\t\tthis.apiGeometryNormal.colorsNeedUpdate,\n';
|
code3 += '\t\tthis.apiGeometryNormal.colorsNeedUpdate,\n';
|
||||||
code3 += '\t\tthis.apiGeometryNormal.groupsNeedUpdate,\n';
|
code3 += '\t\tthis.apiGeometryNormal.groupsNeedUpdate,\n';
|
||||||
code3 += '\t\tthis.apiGeometryNormal.lineDistancesNeedUpdate\n';
|
code3 += '\t\tthis.apiGeometryNormal.lineDistancesNeedUpdate\n';
|
||||||
code3 += '\t);';
|
code3 += '\t)';
|
||||||
|
|
||||||
var code4 = 'if (R3.Utils.UndefinedOrNull(apiMaterial)) {\n';
|
var code4 = 'if (R3.Utils.UndefinedOrNull(apiMaterial)) {\n';
|
||||||
code4 += '\t\tapiMaterial = {};\n';
|
code4 += '\t\tapiMaterial = {};\n';
|
||||||
|
@ -99,7 +99,7 @@ code4 += '\t\tthis.apiMaterial.side,\n';
|
||||||
code4 += '\t\tthis.apiMaterial.transparent,\n';
|
code4 += '\t\tthis.apiMaterial.transparent,\n';
|
||||||
code4 += '\t\tthis.apiMaterial.vertexColors,\n';
|
code4 += '\t\tthis.apiMaterial.vertexColors,\n';
|
||||||
code4 += '\t\tthis.apiMaterial.visible\n';
|
code4 += '\t\tthis.apiMaterial.visible\n';
|
||||||
code4 += '\t);';
|
code4 += '\t)';
|
||||||
|
|
||||||
var code5 = 'if (R3.Utils.UndefinedOrNull(apiTexture)) {\n';
|
var code5 = 'if (R3.Utils.UndefinedOrNull(apiTexture)) {\n';
|
||||||
code5 += '\t\tapiTexture = {};\n';
|
code5 += '\t\tapiTexture = {};\n';
|
||||||
|
@ -133,7 +133,28 @@ code5 += '\t\tthis.apiTexture.version,\n';
|
||||||
code5 += '\t\tthis.apiTexture.animated,\n';
|
code5 += '\t\tthis.apiTexture.animated,\n';
|
||||||
code5 += '\t\tthis.apiTexture.reverseAnimation,\n';
|
code5 += '\t\tthis.apiTexture.reverseAnimation,\n';
|
||||||
code5 += '\t\tthis.apiTexture.forward\n';
|
code5 += '\t\tthis.apiTexture.forward\n';
|
||||||
code5 += '\t);';
|
code5 += '\t)';
|
||||||
|
|
||||||
|
var code6 = 'if (R3.Utils.UndefinedOrNull(apiComponent)) {\n';
|
||||||
|
code6 += '\t\tapiComponent = {};\n';
|
||||||
|
code6 += '\t}\n';
|
||||||
|
code6 += '\tthis.apiComponent = apiComponent;\n';
|
||||||
|
code6 += '\n';
|
||||||
|
code6 += '\tthis.graphics\t= null;\n';
|
||||||
|
code6 += '\tthis.physics\t= null;\n';
|
||||||
|
code6 += '\tthis.gui\t\t= null;\n';
|
||||||
|
code6 += '\tthis.stats\t\t= null;\n';
|
||||||
|
code6 += '\n';
|
||||||
|
code6 += '\tR3.Event.Emit(\n';
|
||||||
|
code6 += '\t\tR3.Event.GET_RUNTIME,\n';
|
||||||
|
code6 += '\t\tfunction(runtime) {\n';
|
||||||
|
code6 += '\t\t\tthis.graphics\t= runtime.graphics;\n';
|
||||||
|
code6 += '\t\t\tthis.physics\t= runtime.physics;\n';
|
||||||
|
code6 += '\t\t\tthis.coder\t= runtime.coder;\n';
|
||||||
|
code6 += '\t\t\tthis.gui\t\t= runtime.gui;\n';
|
||||||
|
code6 += '\t\t\tthis.stats\t\t= runtime.stats;\n';
|
||||||
|
code6 += '\t\t}.bind(this)\n';
|
||||||
|
code6 += '\t)';
|
||||||
|
|
||||||
function build() {
|
function build() {
|
||||||
return gulp.src('./src/r3-*.js')
|
return gulp.src('./src/r3-*.js')
|
||||||
|
@ -145,6 +166,7 @@ function build() {
|
||||||
.pipe(replace('__API_GEOMETRY_NORMAL_MACRO__', code3))
|
.pipe(replace('__API_GEOMETRY_NORMAL_MACRO__', code3))
|
||||||
.pipe(replace('__API_MATERIAL_MACRO__', code4))
|
.pipe(replace('__API_MATERIAL_MACRO__', code4))
|
||||||
.pipe(replace('__API_TEXTURE_MACRO__', code5))
|
.pipe(replace('__API_TEXTURE_MACRO__', code5))
|
||||||
|
.pipe(replace('__RUNTIME_COMPONENT_MACRO__', code6))
|
||||||
.pipe(minify({
|
.pipe(minify({
|
||||||
ext:{
|
ext:{
|
||||||
src:'.js',
|
src:'.js',
|
||||||
|
|
|
@ -862,37 +862,37 @@ R3.Utils.IsEmpty = function(obj) {
|
||||||
return (Object.keys(obj).length === 0 && obj.constructor === Object);
|
return (Object.keys(obj).length === 0 && obj.constructor === Object);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.isString = function(member) {
|
R3.Utils.IsString = function(member) {
|
||||||
return (typeof member === 'string');
|
return (typeof member === 'string');
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.isBoolean = function(member) {
|
R3.Utils.IsBoolean = function(member) {
|
||||||
return (member === true || member === false);
|
return (member === true || member === false);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.isColor = function(member) {
|
R3.Utils.IsColor = function(member) {
|
||||||
return (member instanceof R3.Color);
|
return (member instanceof R3.Color);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.isNumber = function(member) {
|
R3.Utils.IsNumber = function(member) {
|
||||||
return (typeof member === 'number');
|
return (typeof member === 'number');
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.isVector2 = function(member) {
|
R3.Utils.IsVector2 = function(member) {
|
||||||
return (
|
return (
|
||||||
member instanceof R3.API.Vector2 ||
|
member instanceof R3.API.Vector2 ||
|
||||||
member instanceof R3.Vector2
|
member instanceof R3.Vector2
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.isVector3 = function(member) {
|
R3.Utils.IsVector3 = function(member) {
|
||||||
return (
|
return (
|
||||||
member instanceof R3.API.Vector3 ||
|
member instanceof R3.API.Vector3 ||
|
||||||
member instanceof R3.Vector3
|
member instanceof R3.Vector3
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Utils.isVector4 = function(member) {
|
R3.Utils.IsVector4 = function(member) {
|
||||||
return (
|
return (
|
||||||
member instanceof R3.API.Vector4 ||
|
member instanceof R3.API.Vector4 ||
|
||||||
member instanceof R3.Vector4 ||
|
member instanceof R3.Vector4 ||
|
||||||
|
@ -901,6 +901,11 @@ R3.Utils.isVector4 = function(member) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
R3.Utils.IsObject = function(member) {
|
||||||
|
var type = typeof member;
|
||||||
|
return type === 'function' || type === 'object' && !!member;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,28 +1,33 @@
|
||||||
/**
|
/**
|
||||||
* Component Interface
|
* R3.Component is an R3.Event
|
||||||
* @constructor
|
|
||||||
* @param linkedObjects
|
|
||||||
* @param parent
|
* @param parent
|
||||||
|
* @param linkedObjects
|
||||||
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Component = function(
|
R3.Component = function(
|
||||||
parent,
|
parent,
|
||||||
linkedObjects
|
linkedObjects
|
||||||
) {
|
) {
|
||||||
/**
|
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||||
* Call the Event constructor first so we can set the parent right away
|
parent = null;
|
||||||
*/
|
}
|
||||||
R3.Event.call(
|
this.parent = parent;
|
||||||
this,
|
|
||||||
parent
|
|
||||||
);
|
|
||||||
|
|
||||||
this.componentType = this.getComponentType();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||||
linkedObjects = {};
|
linkedObjects = {};
|
||||||
}
|
}
|
||||||
this.linkedObjects = linkedObjects;
|
this.linkedObjects = linkedObjects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the Event constructor first so we can set the parent right away
|
||||||
|
*/
|
||||||
|
R3.Event.call(
|
||||||
|
this,
|
||||||
|
this.parent
|
||||||
|
);
|
||||||
|
|
||||||
|
this.componentType = this.getComponentType();
|
||||||
|
|
||||||
this.idToObject = {};
|
this.idToObject = {};
|
||||||
|
|
||||||
this.selected = false;
|
this.selected = false;
|
||||||
|
@ -200,29 +205,78 @@ R3.Component.prototype.getDependencies = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Component.prototype.updateInstance = function(property) {
|
R3.Component.prototype.updateInstance = function(property) {
|
||||||
console.warn('TODO: update instance for parent change');
|
|
||||||
|
|
||||||
//
|
if (property === 'id') {
|
||||||
// if (property === 'parent') {
|
console.warn('TODO: update id');
|
||||||
//
|
return;
|
||||||
// if (this.parent instanceof R3.Entity) {
|
}
|
||||||
// this.parent.addComponent(this);
|
|
||||||
//
|
|
||||||
// this.buildIdToObject();
|
|
||||||
//
|
|
||||||
// Object.keys(this.idToObject).map(
|
|
||||||
// function(componentId) {
|
|
||||||
//
|
|
||||||
// if (this.id !== componentId) {
|
|
||||||
// this.parent.addComponent(this.idToObject[componentId]);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }.bind(this)
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
if (property === 'name') {
|
||||||
|
console.warn('TODO: update name');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'parent') {
|
||||||
|
console.warn('TODO: update parent');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* R3.Component.prototype.updateFromInstance
|
||||||
|
*
|
||||||
|
* - Updates the component by its instance data
|
||||||
|
*
|
||||||
|
* @param property
|
||||||
|
*/
|
||||||
|
R3.Component.prototype.updateFromInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
this[property] instanceof R3.Color
|
||||||
|
) {
|
||||||
|
this[property].r = this.instance[property].r;
|
||||||
|
this[property].g = this.instance[property].g;
|
||||||
|
this[property].b = this.instance[property].b;
|
||||||
|
this[property].a = this.instance[property].a;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
this[property] instanceof R3.Vector2
|
||||||
|
) {
|
||||||
|
this[property].x = this.instance[property].x;
|
||||||
|
this[property].y = this.instance[property].y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
this[property] instanceof R3.Vector3
|
||||||
|
) {
|
||||||
|
this[property].x = this.instance[property].x;
|
||||||
|
this[property].y = this.instance[property].y;
|
||||||
|
this[property].z = this.instance[property].z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
this[property] instanceof R3.Vector4 |
|
||||||
|
this[property] instanceof R3.Quaternion
|
||||||
|
) {
|
||||||
|
this[property].x = this.instance[property].x;
|
||||||
|
this[property].y = this.instance[property].y;
|
||||||
|
this[property].z = this.instance[property].z;
|
||||||
|
this[property].w = this.instance[property].w;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
this[property] instanceof R3.Matrix4
|
||||||
|
) {
|
||||||
|
throw new Error('TODO : implement this code - no use case yet');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R3.Utils.IsObject(this[property])) {
|
||||||
|
throw new Error('TODO : update component object from instance object');
|
||||||
|
}
|
||||||
|
|
||||||
|
this[property] = this.instance[property];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,6 +315,28 @@ R3.Component.prototype.getParent = function(property, constructor) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function traverses the parent chain to find the first parent which matches the constructor
|
||||||
|
* @param constructor
|
||||||
|
*/
|
||||||
|
R3.Component.prototype.getFirstParent = function(constructor) {
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(constructor)) {
|
||||||
|
throw new Error('You need to specify a constructor');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.parent === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.parent instanceof constructor) {
|
||||||
|
return this.parent;
|
||||||
|
} else {
|
||||||
|
return this.getFirstParent(constructor);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
R3.Component.prototype.toString = function() {
|
R3.Component.prototype.toString = function() {
|
||||||
return this.id;
|
return this.id;
|
||||||
};
|
};
|
||||||
|
@ -573,9 +649,9 @@ R3.Component.GetComponentInfo = function(number) {
|
||||||
apiConstructor : R3.API.System
|
apiConstructor : R3.API.System
|
||||||
};
|
};
|
||||||
case 0x14 : return {
|
case 0x14 : return {
|
||||||
name : 'R3.GraphicsRuntime',
|
name : 'R3.Runtime.Graphics',
|
||||||
runtime : R3.Component.DEFAULT_RUNTIME,
|
runtime : R3.Component.DEFAULT_RUNTIME,
|
||||||
constructor : R3.GraphicsRuntime
|
constructor : R3.Runtime.Graphics
|
||||||
};
|
};
|
||||||
case 0x15 : return {
|
case 0x15 : return {
|
||||||
name : 'R3.D3.Helper',
|
name : 'R3.D3.Helper',
|
||||||
|
@ -1944,7 +2020,7 @@ R3.Component.prototype.getComponentType = function() {
|
||||||
if (this instanceof R3.GUI) {
|
if (this instanceof R3.GUI) {
|
||||||
return R3.Component.GUI;
|
return R3.Component.GUI;
|
||||||
}
|
}
|
||||||
if (this instanceof R3.GUIRuntime) {
|
if (this instanceof R3.Runtime.GUI) {
|
||||||
return R3.Component.GUI_RUNTIME;
|
return R3.Component.GUI_RUNTIME;
|
||||||
}
|
}
|
||||||
if (this instanceof R3.Image) {
|
if (this instanceof R3.Image) {
|
||||||
|
@ -2017,6 +2093,39 @@ R3.Component.GetComponentConstructor = function(componentType) {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
R3.Component.prototype.getPropertyValue = function(item) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We found data that we need to process - here we have to pay attention.
|
||||||
|
* For linked objects - we only store the ID
|
||||||
|
*/
|
||||||
|
if (item instanceof R3.Component) {
|
||||||
|
return R3.Utils.IdOrNull(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle colors, vectors and matrices - they are not components so they have their own toApiObject functions
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
item instanceof R3.Color |
|
||||||
|
item instanceof R3.Vector2 |
|
||||||
|
item instanceof R3.Vector3 |
|
||||||
|
item instanceof R3.Vector4 |
|
||||||
|
item instanceof R3.Quaternion |
|
||||||
|
item instanceof R3.Matrix4
|
||||||
|
) {
|
||||||
|
return item.toApiObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If we get to this point and we still have an Object - we throw an error
|
||||||
|
*/
|
||||||
|
if (R3.Utils.IsObject(item)) {
|
||||||
|
throw new Error('We still have an object here which is trying to get saved: ' + item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Components are linked at runtime - for storing, we just store the ID
|
* Components are linked at runtime - for storing, we just store the ID
|
||||||
|
@ -2028,15 +2137,65 @@ R3.Component.prototype.toApiObject = function() {
|
||||||
|
|
||||||
var apiConstructor = info.apiConstructor;
|
var apiConstructor = info.apiConstructor;
|
||||||
|
|
||||||
console.warn('implement generic component toApiObject');
|
var apiObject = new apiConstructor();
|
||||||
|
|
||||||
var parameters = R3.Utils.GetParameters(apiConstructor);
|
for (var property in apiObject) {
|
||||||
|
if (apiObject.hasOwnProperty(property)) {
|
||||||
|
|
||||||
throw new Error(parameters);
|
/**
|
||||||
|
* Check if the current component also has this property
|
||||||
|
*/
|
||||||
|
if (this.hasOwnProperty(property)) {
|
||||||
|
|
||||||
return this.id;
|
if (this[property] instanceof R3.Runtime) {
|
||||||
// return new info.apiConstructor()
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this is a runtime object - we ignore those
|
||||||
|
*/
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this property is an array of something
|
||||||
|
*/
|
||||||
|
if (this[property].isArray) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Quick sanity check that the apiObject also thinks this is an array
|
||||||
|
*/
|
||||||
|
if (!arrayObject[property].isArray) {
|
||||||
|
throw new Error('The API Object ' + apiObject + ' does not seem to think ' + property + ' is an array');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loop through the array - assign the contents of
|
||||||
|
* the array to the apiObject
|
||||||
|
*/
|
||||||
|
apiObject[property] = this[property].reduce(
|
||||||
|
function(result, item) {
|
||||||
|
|
||||||
|
if (item instanceof R3.Runtime) {
|
||||||
|
throw new Error('Please don\'t store Runtime Objects in Arrays');
|
||||||
|
}
|
||||||
|
|
||||||
|
result.push(this.getPropertyValue(item));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}.bind(this),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is not an array, so get the proper value directly from the property
|
||||||
|
*/
|
||||||
|
apiObject[property] = this.getPropertyValue(this[property]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2436,7 +2595,7 @@ R3.Component.GetRuntimeObject = function(info) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (info.runtime === R3.Component.GRAPHICS_RUNTIME) {
|
if (info.runtime instanceof R3.Runtime.Graphics) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(runtime.graphics)) {
|
if (R3.Utils.UndefinedOrNull(runtime.graphics)) {
|
||||||
console.warn('no runtime graphics: ', info);
|
console.warn('no runtime graphics: ', info);
|
||||||
|
@ -2523,4 +2682,4 @@ R3.Component.ConstructFromObject = function(rawComponentObject) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return runtimeComponent;
|
return runtimeComponent;
|
||||||
};
|
};
|
|
@ -7,7 +7,7 @@ R3.API.Clock = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.API.Controls = function(
|
||||||
canvas
|
canvas
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(canvas)) {
|
if (R3.Utils.UndefinedOrNull(canvas)) {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.API.Curve = function(
|
||||||
arcLenghDivisions
|
arcLenghDivisions
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(arcLenghDivisions)) {
|
if (R3.Utils.UndefinedOrNull(arcLenghDivisions)) {
|
||||||
arcLenghDivisions = 200;
|
arcLenghDivisions = 200;
|
|
@ -11,7 +11,7 @@ R3.API.CustomCode = function(
|
||||||
code
|
code
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(eventId)) {
|
if (R3.Utils.UndefinedOrNull(eventId)) {
|
||||||
eventId = R3.Event.KEY_UP;
|
eventId = R3.Event.KEY_UP;
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.API.DomElement = function(
|
||||||
domElementId
|
domElementId
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(domElementId)) {
|
if (R3.Utils.UndefinedOrNull(domElementId)) {
|
||||||
domElementId = '';
|
domElementId = '';
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.API.DrawRange = function(
|
||||||
count
|
count
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(start)) {
|
if (R3.Utils.UndefinedOrNull(start)) {
|
||||||
start = 0;
|
start = 0;
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.API.EntityManager = function(
|
||||||
entities
|
entities
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(entities)) {
|
if (R3.Utils.UndefinedOrNull(entities)) {
|
||||||
entities = [];
|
entities = [];
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.API.Entity = function(
|
||||||
components
|
components
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(components)) {
|
if (R3.Utils.UndefinedOrNull(components)) {
|
||||||
components = [];
|
components = [];
|
||||||
|
|
|
@ -13,7 +13,7 @@ R3.API.Group = function(
|
||||||
materialIndex
|
materialIndex
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(start)) {
|
if (R3.Utils.UndefinedOrNull(start)) {
|
||||||
start = 0;
|
start = 0;
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.API.GUI = function(
|
||||||
domElement
|
domElement
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(domElement)) {
|
if (R3.Utils.UndefinedOrNull(domElement)) {
|
||||||
domElement = null;
|
domElement = null;
|
||||||
|
|
|
@ -21,7 +21,7 @@ R3.API.Image = function(
|
||||||
height
|
height
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(fileName)) {
|
if (R3.Utils.UndefinedOrNull(fileName)) {
|
||||||
fileName = R3.Utils.LowerUnderscore(name);
|
fileName = R3.Utils.LowerUnderscore(name);
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.API.Mouse = function(
|
||||||
y
|
y
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(x)) {
|
if (R3.Utils.UndefinedOrNull(x)) {
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.API.Plane = function(
|
||||||
constant
|
constant
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(normal)) {
|
if (R3.Utils.UndefinedOrNull(normal)) {
|
||||||
normal = new R3.API.Vector3(1,0,0);
|
normal = new R3.API.Vector3(1,0,0);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
* @param entities
|
* @param entities
|
||||||
* @param renderers
|
* @param renderers
|
||||||
* @param cameras
|
* @param cameras
|
||||||
|
* @param audios
|
||||||
* @param mode
|
* @param mode
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
|
@ -16,10 +17,11 @@ R3.API.Project = function(
|
||||||
entities,
|
entities,
|
||||||
renderers,
|
renderers,
|
||||||
cameras,
|
cameras,
|
||||||
|
audios,
|
||||||
mode
|
mode
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(users)) {
|
if (R3.Utils.UndefinedOrNull(users)) {
|
||||||
throw new Error('Only registered users can create projects');
|
throw new Error('Only registered users can create projects');
|
||||||
|
@ -56,6 +58,11 @@ R3.API.Project = function(
|
||||||
}
|
}
|
||||||
this.cameras = cameras;
|
this.cameras = cameras;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(audios)) {
|
||||||
|
audios = [];
|
||||||
|
}
|
||||||
|
this.audios = audios;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(mode)) {
|
if (R3.Utils.UndefinedOrNull(mode)) {
|
||||||
mode = R3.API.Project.APPLICATION_MODE_EDIT;
|
mode = R3.API.Project.APPLICATION_MODE_EDIT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ R3.API.Renderer = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ R3.API.Server = function(
|
||||||
protocols
|
protocols
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(protocol)) {
|
if (R3.Utils.UndefinedOrNull(protocol)) {
|
||||||
protocol = R3.API.Server.PROTOCOL_HTTP_SSL;
|
protocol = R3.API.Server.PROTOCOL_HTTP_SSL;
|
||||||
|
|
|
@ -13,7 +13,7 @@ R3.API.Socket = function(
|
||||||
server
|
server
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(roomId)) {
|
if (R3.Utils.UndefinedOrNull(roomId)) {
|
||||||
roomId = 'room_' + R3.Utils.RandomId();
|
roomId = 'room_' + R3.Utils.RandomId();
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.API.Sphere = function(
|
||||||
radius
|
radius
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(center)) {
|
if (R3.Utils.UndefinedOrNull(center)) {
|
||||||
center = new R3.API.Vector3(0,0,0);
|
center = new R3.API.Vector3(0,0,0);
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.API.Stats = function(
|
||||||
domElement
|
domElement
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(domElement)) {
|
if (R3.Utils.UndefinedOrNull(domElement)) {
|
||||||
domElement = null;
|
domElement = null;
|
||||||
|
|
|
@ -23,7 +23,7 @@ R3.API.User = function(
|
||||||
idToken
|
idToken
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(googleId)) {
|
if (R3.Utils.UndefinedOrNull(googleId)) {
|
||||||
throw new Error('invalid user - no google ID');
|
throw new Error('invalid user - no google ID');
|
||||||
|
|
|
@ -17,7 +17,7 @@ R3.API.Video = function(
|
||||||
source
|
source
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
||||||
autoUpdateSize = true;
|
autoUpdateSize = true;
|
||||||
|
|
|
@ -1,29 +1,21 @@
|
||||||
/**
|
/**
|
||||||
* R3.Box3
|
* R3.Box3
|
||||||
* @param parent
|
* @param parent
|
||||||
* @param apiBox3
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Box3 = function(
|
R3.Box3 = function(
|
||||||
parent,
|
parent,
|
||||||
apiBox3
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(parent)) {
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
parent = null;
|
|
||||||
}
|
|
||||||
this.parent = parent;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiBox3)) {
|
|
||||||
apiBox3 = {};
|
|
||||||
}
|
|
||||||
this.apiBox3 = apiBox3;
|
|
||||||
|
|
||||||
R3.API.Box3.call(
|
R3.API.Box3.call(
|
||||||
this,
|
this,
|
||||||
this.apiBox3,
|
apiComponent,
|
||||||
this.apiBox3.min,
|
apiComponent.min,
|
||||||
this.apiBox3.max
|
apiComponent.max
|
||||||
);
|
);
|
||||||
|
|
||||||
this.min = new R3.Vector3(
|
this.min = new R3.Vector3(
|
||||||
|
@ -36,20 +28,12 @@ R3.Box3 = function(
|
||||||
this.max
|
this.max
|
||||||
);
|
);
|
||||||
|
|
||||||
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(this.parent);
|
this.componentRuntime = R3.Component.GetComponentRuntime(this.parent);
|
||||||
|
|
||||||
this.createInstance();
|
R3.Component.call(
|
||||||
|
this,
|
||||||
|
parent
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Box3.prototype = Object.create(R3.Component.prototype);
|
R3.Box3.prototype = Object.create(R3.Component.prototype);
|
||||||
|
@ -90,27 +74,16 @@ R3.Box3.prototype.updateInstance = function(property) {
|
||||||
this.instance.min.x = this.min.x;
|
this.instance.min.x = this.min.x;
|
||||||
this.instance.min.y = this.min.y;
|
this.instance.min.y = this.min.y;
|
||||||
this.instance.min.z = this.min.z;
|
this.instance.min.z = this.min.z;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'max') {
|
if (property === 'max') {
|
||||||
this.instance.max.x = this.max.x;
|
this.instance.max.x = this.max.x;
|
||||||
this.instance.max.y = this.max.y;
|
this.instance.max.y = this.max.y;
|
||||||
this.instance.max.z = this.max.z;
|
this.instance.max.z = this.max.z;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
R3.Component.prototype.updateInstance.call(this, property);
|
||||||
* R3.Box3 to R3.API.Box3
|
|
||||||
* @returns {R3.API.Box3}
|
|
||||||
*/
|
|
||||||
R3.Box3.prototype.toApiObject = function() {
|
|
||||||
return new R3.API.Box3(
|
|
||||||
new R3.API.Component(
|
|
||||||
this.parent,
|
|
||||||
this.id,
|
|
||||||
this.name
|
|
||||||
),
|
|
||||||
this.min.toApiObject(),
|
|
||||||
this.max.toApiObject()
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,50 +1,42 @@
|
||||||
/**
|
/**
|
||||||
* Canvas object
|
* R3.Canvas
|
||||||
* @param graphics
|
* @param parent
|
||||||
* @param apiCanvas
|
* @param apiComponent
|
||||||
* @returns {R3.Canvas}
|
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Canvas = function(
|
R3.Canvas = function(
|
||||||
graphics,
|
parent,
|
||||||
apiCanvas
|
apiComponent
|
||||||
) {
|
) {
|
||||||
this.graphics = graphics;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiCanvas)) {
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
apiCanvas = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Canvas.call(
|
R3.API.Canvas.call(
|
||||||
this,
|
this,
|
||||||
apiCanvas.id,
|
apiComponent,
|
||||||
apiCanvas.name,
|
apiComponent.autoUpdateSize,
|
||||||
apiCanvas.parent,
|
apiComponent.width,
|
||||||
apiCanvas.parentTexture,
|
apiComponent.height,
|
||||||
apiCanvas.autoUpdateSize,
|
apiComponent.offset,
|
||||||
apiCanvas.width,
|
apiComponent.tabIndex,
|
||||||
apiCanvas.height,
|
apiComponent.texts,
|
||||||
apiCanvas.offset,
|
apiComponent.textBaseline
|
||||||
apiCanvas.tabIndex,
|
|
||||||
apiCanvas.texts,
|
|
||||||
apiCanvas.textBaseline
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.offset = new R3.Vector2(
|
this.offset = new R3.Vector2(
|
||||||
this.graphics,
|
|
||||||
this.offset,
|
|
||||||
this
|
|
||||||
);
|
|
||||||
|
|
||||||
R3.Component.call(
|
|
||||||
this,
|
this,
|
||||||
{
|
this.offset
|
||||||
'parentTexture' : R3.D3.Texture,
|
|
||||||
'texts' : [R3.D3.Text]
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.context = null;
|
this.context = null;
|
||||||
|
|
||||||
|
R3.Component.call(
|
||||||
|
this,
|
||||||
|
parent,
|
||||||
|
{
|
||||||
|
'texts' : [R3.D3.Text]
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Canvas.prototype = Object.create(R3.Component.prototype);
|
R3.Canvas.prototype = Object.create(R3.Component.prototype);
|
||||||
|
@ -154,31 +146,10 @@ R3.Canvas.prototype.updateInstance = function(property) {
|
||||||
R3.Component.prototype.updateInstance.call(this, property);
|
R3.Component.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Canvas to a R3.API.Canvas
|
|
||||||
* @returns {R3.API.Canvas}
|
|
||||||
*/
|
|
||||||
R3.Canvas.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
return new R3.API.Canvas(
|
|
||||||
this.id,
|
|
||||||
this.name,
|
|
||||||
R3.Utils.IdOrNull(this.parent),
|
|
||||||
R3.Utils.IdOrNull(this.parentTexture),
|
|
||||||
this.autoUpdateSize,
|
|
||||||
this.width,
|
|
||||||
this.height,
|
|
||||||
this.offset.toApiObject(),
|
|
||||||
this.tabIndex,
|
|
||||||
this.texts.map(function(text){
|
|
||||||
return R3.Utils.IdOrNull(text)
|
|
||||||
}),
|
|
||||||
this.textBaseline
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.Canvas.prototype.writeText = function() {
|
R3.Canvas.prototype.writeText = function() {
|
||||||
|
|
||||||
|
var parentTexture = this.getFirstParent(R3.D3.Texture);
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
this.texts.map(
|
this.texts.map(
|
||||||
|
@ -189,14 +160,12 @@ R3.Canvas.prototype.writeText = function() {
|
||||||
this.context = this.instance.getContext('2d');
|
this.context = this.instance.getContext('2d');
|
||||||
}
|
}
|
||||||
|
|
||||||
text.parentCanvas = this;
|
|
||||||
|
|
||||||
this.context.fillStyle = text.fillStyle;
|
this.context.fillStyle = text.fillStyle;
|
||||||
this.context.font = text.font;
|
this.context.font = text.font;
|
||||||
this.context.fillText(text.value, text.offset.x, text.offset.y);
|
this.context.fillText(text.value, text.offset.x, text.offset.y);
|
||||||
|
|
||||||
if (this.parentTexture && this.parentTexture.instance) {
|
if (parentTexture && parentTexture.instance) {
|
||||||
this.parentTexture.instance.needsUpdate = true;
|
parentTexture.instance.needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
|
|
|
@ -1,49 +1,47 @@
|
||||||
/**
|
/**
|
||||||
* Creates a Clock object
|
* R3.Clock
|
||||||
* @param graphics
|
* @param parent
|
||||||
* @param apiClock R3.API.Clock
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Clock = function(
|
R3.Clock = function(
|
||||||
graphics,
|
parent,
|
||||||
apiClock
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiClock)) {
|
|
||||||
apiClock = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Clock.call(
|
R3.API.Clock.call(
|
||||||
this,
|
this,
|
||||||
apiClock.id,
|
apiComponent
|
||||||
apiClock.name,
|
|
||||||
apiClock.parent
|
|
||||||
);
|
);
|
||||||
|
|
||||||
R3.Component.call(this);
|
R3.Component.call(
|
||||||
|
this,
|
||||||
|
parent
|
||||||
|
);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
R3.Clock.prototype = Object.create(R3.Component.prototype);
|
R3.Clock.prototype = Object.create(R3.Component.prototype);
|
||||||
R3.Clock.prototype.constructor = R3.Clock;
|
R3.Clock.prototype.constructor = R3.Clock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a camera instance of 'graphics' type (only THREE for now)
|
* R3.Clock.prototype.createInstance
|
||||||
* @returns {THREE.Clock}
|
|
||||||
*/
|
*/
|
||||||
R3.Clock.prototype.createInstance = function() {
|
R3.Clock.prototype.createInstance = function() {
|
||||||
|
|
||||||
this.instance = new THREE.Clock();
|
this.instance = this.graphics.Clock();
|
||||||
|
|
||||||
R3.Component.prototype.createInstance.call(this);
|
R3.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the instance with the current state
|
* R3.Clock.prototype.updateInstance
|
||||||
|
* @param property
|
||||||
*/
|
*/
|
||||||
R3.Clock.prototype.updateInstance = function() {
|
R3.Clock.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
R3.Component.prototype.updateInstance.call(this, property);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,7 +52,6 @@ R3.Clock.prototype.getDelta = function() {
|
||||||
/**
|
/**
|
||||||
* clamp the delta to 1/60
|
* clamp the delta to 1/60
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (delta > (1 / 30.0)) {
|
if (delta > (1 / 30.0)) {
|
||||||
// console.log('clipped ' + (delta - (1/30.0)) + ' seconds - essentially lost time');
|
// console.log('clipped ' + (delta - (1/30.0)) + ' seconds - essentially lost time');
|
||||||
delta = (1 / 30.0);
|
delta = (1 / 30.0);
|
||||||
|
@ -62,35 +59,3 @@ R3.Clock.prototype.getDelta = function() {
|
||||||
|
|
||||||
return delta;
|
return delta;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Clock to a new R3.API.Clock
|
|
||||||
* @returns {R3.API.Clock}
|
|
||||||
*/
|
|
||||||
R3.Clock.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
return new R3.API.Clock(
|
|
||||||
this.id,
|
|
||||||
this.name,
|
|
||||||
R3.Utils.IdOrNull(this.parent)
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts from an Object camera to a R3.Clock
|
|
||||||
* @param graphics R3.Graphics
|
|
||||||
* @param objectClock Object
|
|
||||||
* @returns {R3.Clock}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.Clock.FromObject = function(graphics, objectClock) {
|
|
||||||
|
|
||||||
var apiClock = R3.API.Clock.FromObject(objectClock);
|
|
||||||
|
|
||||||
return new R3.Clock(
|
|
||||||
graphics,
|
|
||||||
apiClock
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
* Coder
|
|
||||||
* @param id
|
|
||||||
* @param name
|
|
||||||
* @param coderType
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.CoderRuntime = function(
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
coderType
|
|
||||||
) {
|
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
|
||||||
id = R3.Utils.RandomId();
|
|
||||||
}
|
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(name)) {
|
|
||||||
name = 'Coder (' + id + ')';
|
|
||||||
}
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(coderType)) {
|
|
||||||
coderType = R3.CoderRuntime.TYPE_CODE_MIRROR;
|
|
||||||
}
|
|
||||||
this.coderType = coderType;
|
|
||||||
|
|
||||||
this.createInstance();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* R3.CoderRuntime Types
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
R3.CoderRuntime.TYPE_CODE_MIRROR = 0x1;
|
|
||||||
|
|
||||||
R3.CoderRuntime.prototype.createInstance = function() {
|
|
||||||
if (this.coderType === R3.CoderRuntime.TYPE_CODE_MIRROR) {
|
|
||||||
this.instance = CodeMirror;
|
|
||||||
} else {
|
|
||||||
this.instance = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.CoderRuntime.prototype.updateInstance = function(property) {
|
|
||||||
if (property === 'coderType') {
|
|
||||||
this.createInstance();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs a warning and throws an error if not cannon
|
|
||||||
*/
|
|
||||||
R3.CoderRuntime.prototype.isNotCodeMirrorThrow = function() {
|
|
||||||
if (this.instance !== CodeMirror) {
|
|
||||||
console.error('Only CodeMirror supported');
|
|
||||||
throw new Error('Only CodeMirror supported');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/**
|
/**
|
||||||
* Runtime color for updating instance objects
|
* R3.Color
|
||||||
* @param parent
|
* @param parent
|
||||||
* @param apiColor R3.API.Color
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Color = function(
|
R3.Color = function(
|
||||||
parent,
|
parent,
|
||||||
apiColor
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(parent)) {
|
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||||
|
@ -14,32 +14,16 @@ R3.Color = function(
|
||||||
}
|
}
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiColor)) {
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
apiColor = {};
|
|
||||||
}
|
|
||||||
this.apiColor = apiColor;
|
|
||||||
|
|
||||||
R3.API.Color.call(
|
R3.API.Color.call(
|
||||||
this,
|
this,
|
||||||
this.apiColor.r,
|
apiComponent.r,
|
||||||
this.apiColor.g,
|
apiComponent.g,
|
||||||
this.apiColor.b,
|
apiComponent.b,
|
||||||
this.apiColor.a
|
apiComponent.a
|
||||||
);
|
);
|
||||||
|
|
||||||
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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,16 +36,13 @@ R3.Color.prototype.constructor = R3.Color;
|
||||||
*/
|
*/
|
||||||
R3.Color.prototype.createInstance = function() {
|
R3.Color.prototype.createInstance = function() {
|
||||||
|
|
||||||
switch (this.componentRuntime) {
|
this.instance = this.graphics.Color(
|
||||||
case R3.Component.GRAPHICS_RUNTIME :
|
this.r,
|
||||||
this.instance = this.graphics.Color(
|
this.g,
|
||||||
this.r,
|
this.b,
|
||||||
this.g,
|
this.a
|
||||||
this.b,
|
);
|
||||||
this.a
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,13 +50,24 @@ R3.Color.prototype.createInstance = function() {
|
||||||
*/
|
*/
|
||||||
R3.Color.prototype.updateInstance = function(property) {
|
R3.Color.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
this.instance.r = this.r;
|
if (property === 'r') {
|
||||||
this.instance.g = this.g;
|
this.instance.r = this.r;
|
||||||
this.instance.b = this.b;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.parentObject &&
|
if (property === 'g') {
|
||||||
this.parentObject.updateInstance) {
|
this.instance.g = this.g;
|
||||||
this.parentObject.updateInstance(property);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'b') {
|
||||||
|
this.instance.b = this.b;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'a') {
|
||||||
|
this.instance.a = this.a;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,71 +1,37 @@
|
||||||
/**
|
/**
|
||||||
* R3.Controls
|
* R3.Controls is an R3.Component
|
||||||
* @param apiControls
|
* @param parent
|
||||||
* @property controlsType
|
* @param linkedObjects
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls = function(
|
R3.Controls = function(
|
||||||
apiControls
|
parent,
|
||||||
|
linkedObjects
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||||
apiControls = {};
|
linkedObjects = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.API.Controls.call(
|
if (this.canvas instanceof R3.API.Component) {
|
||||||
this,
|
this.canvas = R3.Component.ConstructFromObject(this.canvas);
|
||||||
apiControls.id,
|
|
||||||
apiControls.name,
|
|
||||||
apiControls.canvas,
|
|
||||||
apiControls.parent
|
|
||||||
);
|
|
||||||
|
|
||||||
var linkedObjects = {
|
|
||||||
canvas : R3.Canvas
|
|
||||||
};
|
|
||||||
|
|
||||||
var delayed = false;
|
|
||||||
|
|
||||||
switch (this.controlsType) {
|
|
||||||
case (R3.API.Controls.CONTROLS_TYPE_EDITOR) :
|
|
||||||
linkedObjects.raycaster = R3.D3.Raycaster;
|
|
||||||
linkedObjects.camera = R3.D3.Camera;
|
|
||||||
delayed = true;
|
|
||||||
break;
|
|
||||||
case (R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON) :
|
|
||||||
linkedObjects.camera = R3.D3.Camera;
|
|
||||||
delayed = true;
|
|
||||||
break;
|
|
||||||
case (R3.API.Controls.CONTROLS_TYPE_ORBIT) :
|
|
||||||
linkedObjects.camera = R3.D3.Camera;
|
|
||||||
linkedObjects.target = R3.Component;
|
|
||||||
delayed = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
linkedObjects.canvas = R3.Canvas;
|
||||||
|
|
||||||
R3.Component.call(
|
R3.Component.call(
|
||||||
this,
|
this,
|
||||||
linkedObjects,
|
parent,
|
||||||
delayed
|
linkedObjects
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Controls.prototype = Object.create(R3.Component.prototype);
|
R3.Controls.prototype = Object.create(R3.Component.prototype);
|
||||||
R3.Controls.prototype.constructor = R3.Controls;
|
R3.Controls.prototype.constructor = R3.Controls;
|
||||||
|
|
||||||
R3.Controls.D3 = function() {};
|
|
||||||
R3.Controls.D3.prototype = Object.create(R3.Controls.prototype);
|
|
||||||
R3.Controls.D3.prototype.constructor = R3.Controls.D3;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a mesh instance or updates it
|
* R3.Controls.prototype.updateInstance
|
||||||
*/
|
* @param property
|
||||||
R3.Controls.prototype.createInstance = function() {
|
|
||||||
R3.Component.prototype.createInstance.call(this);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the mesh instance
|
|
||||||
*/
|
*/
|
||||||
R3.Controls.prototype.updateInstance = function(property) {
|
R3.Controls.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
@ -76,24 +42,8 @@ R3.Controls.prototype.updateInstance = function(property) {
|
||||||
component: this
|
component: this
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.Component.prototype.updateInstance.call(this, property);
|
R3.Component.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Controls to a R3.API.Controls
|
|
||||||
* @returns {R3.API.Controls}
|
|
||||||
*/
|
|
||||||
R3.Controls.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiControls = new R3.API.Controls(
|
|
||||||
this.id,
|
|
||||||
this.name,
|
|
||||||
this.controlsType,
|
|
||||||
R3.Utils.IdOrNull(this.canvas),
|
|
||||||
R3.Utils.IdOrNull(this.parent)
|
|
||||||
);
|
|
||||||
|
|
||||||
return apiControls;
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,46 +1,35 @@
|
||||||
/**
|
/**
|
||||||
* Controls Superset - The apiControls properties get moved into the Controls object itself, and then the instance is created
|
* R3.Controls.D3.Editor is an R3.Controls.D3
|
||||||
* @param graphics R3.GraphicsRuntime
|
* @param parent
|
||||||
* @param apiEditorControls
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.Editor = function(
|
R3.Controls.D3.Editor = function(
|
||||||
graphics,
|
parent,
|
||||||
apiEditorControls
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiEditorControls)) {
|
|
||||||
apiEditorControls = {
|
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_EDITOR
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull()) {
|
|
||||||
apiEditorControls.controlsType = R3.API.Controls.CONTROLS_TYPE_EDITOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Controls.D3.Editor.call(
|
R3.API.Controls.D3.Editor.call(
|
||||||
this,
|
this,
|
||||||
apiEditorControls,
|
apiComponent,
|
||||||
apiEditorControls.raycaster,
|
apiComponent.raycaster
|
||||||
apiEditorControls.camera
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.raycaster instanceof R3.D3.API.Raycaster) {
|
if (this.raycaster instanceof R3.API.Component) {
|
||||||
this.raycaster = new R3.D3.Raycaster(
|
this.raycaster = R3.Component.ConstructFromObject(this.raycaster);
|
||||||
this.graphics,
|
|
||||||
this.raycaster
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.Controls.call(
|
var linkedObjects = {
|
||||||
this,
|
raycaster : R3.D3.Raycaster
|
||||||
apiEditorControls
|
};
|
||||||
);
|
|
||||||
|
|
||||||
|
R3.Controls.D3.call(
|
||||||
|
this,
|
||||||
|
parent,
|
||||||
|
linkedObjects
|
||||||
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,28 +44,9 @@ R3.Controls.D3.Editor.prototype.constructor = R3.Controls.D3.Editor;
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.Editor.prototype.createInstance = function() {
|
R3.Controls.D3.Editor.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (
|
this.instance = this.graphics.EditorControls(this.canvas, this.camera);
|
||||||
R3.Utils.UndefinedOrNull(this.camera) ||
|
|
||||||
R3.Utils.UndefinedOrNull(this.camera.instance)
|
|
||||||
) {
|
|
||||||
console.warn('no camera at time of editor-controls create instance');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
R3.Component.prototype.createInstance.call(this);
|
||||||
R3.Utils.UndefinedOrNull(this.canvas) ||
|
|
||||||
R3.Utils.UndefinedOrNull(this.canvas.instance)
|
|
||||||
) {
|
|
||||||
console.warn('no canvas at time of editor-controls create instance');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance = new THREE.EditorControls(
|
|
||||||
this.camera.instance,
|
|
||||||
this.canvas.instance
|
|
||||||
);
|
|
||||||
|
|
||||||
R3.Controls.prototype.createInstance.call(this);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,32 +55,10 @@ R3.Controls.D3.Editor.prototype.createInstance = function() {
|
||||||
R3.Controls.D3.Editor.prototype.updateInstance = function(property) {
|
R3.Controls.D3.Editor.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
property === 'canvas' ||
|
property === 'raycaster'
|
||||||
property === 'camera'
|
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(this.instance)) {
|
console.warn('todo : update raycaster');
|
||||||
this.createInstance();
|
|
||||||
} else {
|
|
||||||
this.instance.dispose();
|
|
||||||
this.createInstance();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.warn('an update instance was called on editor controls - which, if not called from within a running system at the right time will affect the order of input event handling and cause system instability');
|
R3.Controls.D3.prototype.updateInstance.call(this, property);
|
||||||
|
|
||||||
R3.Controls.prototype.updateInstance.call(this, property);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Controls.D3.Editor to a R3.D3.API.Mesh
|
|
||||||
* @returns {R3.API.Controls}
|
|
||||||
*/
|
|
||||||
R3.Controls.D3.Editor.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiControls = R3.Controls.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
apiControls.raycaster = R3.Utils.IdOrNull(this.raycaster);
|
|
||||||
apiControls.camera = R3.Utils.IdOrNull(this.camera);
|
|
||||||
|
|
||||||
return apiControls;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,51 +1,39 @@
|
||||||
/**
|
/**
|
||||||
* Controls Superset - The apiControls properties get moved into the Controls object itself, and then the instance is created
|
* R3.Controls.D3.FirstPerson is an R3.Controls.D3
|
||||||
* @param graphics R3.GraphicsRuntime
|
* @param parent
|
||||||
* @param apiFirstPersonControls
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.FirstPerson = function(
|
R3.Controls.D3.FirstPerson = function(
|
||||||
graphics,
|
parent,
|
||||||
apiFirstPersonControls
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiFirstPersonControls)) {
|
|
||||||
apiFirstPersonControls = {
|
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull()) {
|
|
||||||
apiFirstPersonControls.controlsType = R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON;
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Controls.D3.FirstPerson.call(
|
R3.API.Controls.D3.FirstPerson.call(
|
||||||
this,
|
this,
|
||||||
apiFirstPersonControls,
|
apiComponent,
|
||||||
apiFirstPersonControls.camera,
|
apiComponent.enabled,
|
||||||
apiFirstPersonControls.enabled,
|
apiComponent.movementSpeed,
|
||||||
apiFirstPersonControls.movementSpeed,
|
apiComponent.lookSpeed,
|
||||||
apiFirstPersonControls.lookSpeed,
|
apiComponent.lookVertical,
|
||||||
apiFirstPersonControls.lookVertical,
|
apiComponent.autoForward,
|
||||||
apiFirstPersonControls.autoForward,
|
apiComponent.activeLook,
|
||||||
apiFirstPersonControls.activeLook,
|
apiComponent.heightSpeed,
|
||||||
apiFirstPersonControls.heightSpeed,
|
apiComponent.heightCoef,
|
||||||
apiFirstPersonControls.heightCoef,
|
apiComponent.heightMin,
|
||||||
apiFirstPersonControls.heightMin,
|
apiComponent.heightMax,
|
||||||
apiFirstPersonControls.heightMax,
|
apiComponent.constrainVertical,
|
||||||
apiFirstPersonControls.constrainVertical,
|
apiComponent.verticalMin,
|
||||||
apiFirstPersonControls.verticalMin,
|
apiComponent.verticalMax,
|
||||||
apiFirstPersonControls.verticalMax,
|
apiComponent.autoSpeedFactor
|
||||||
apiFirstPersonControls.autoSpeedFactor
|
|
||||||
);
|
);
|
||||||
|
|
||||||
R3.Controls.call(
|
R3.Controls.D3.call(
|
||||||
this,
|
this,
|
||||||
apiFirstPersonControls
|
parent
|
||||||
);
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,43 +49,26 @@ R3.Controls.D3.FirstPerson.prototype.constructor = R3.Controls.D3.FirstPerson;
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.FirstPerson.prototype.createInstance = function() {
|
R3.Controls.D3.FirstPerson.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (
|
this.instance = this.graphics.FirstPersonControls(
|
||||||
R3.Utils.UndefinedOrNull(this.camera) ||
|
this.canvas,
|
||||||
R3.Utils.UndefinedOrNull(this.camera.instance)
|
this.camera,
|
||||||
) {
|
this.enabled,
|
||||||
console.warn('no camera at time of editor-controls create instance');
|
this.movementSpeed,
|
||||||
return;
|
this.lookSpeed,
|
||||||
}
|
this.lookVertical,
|
||||||
|
this.autoForward,
|
||||||
if (
|
this.activeLook,
|
||||||
R3.Utils.UndefinedOrNull(this.canvas) ||
|
this.heightSpeed,
|
||||||
R3.Utils.UndefinedOrNull(this.canvas.instance)
|
this.heightCoef,
|
||||||
) {
|
this.heightMin,
|
||||||
console.warn('no canvas at time of editor-controls create instance');
|
this.heightMax,
|
||||||
return;
|
this.constrainVertical,
|
||||||
}
|
this.verticalMin,
|
||||||
|
this.verticalMax,
|
||||||
this.instance = new THREE.FirstPersonControls(
|
this.autoSpeedFactor
|
||||||
this.camera.instance,
|
|
||||||
this.canvas.instance
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.instance.enabled = this.enabled;
|
|
||||||
this.instance.movementSpeed = this.movementSpeed;
|
|
||||||
this.instance.lookSpeed = this.lookSpeed;
|
|
||||||
this.instance.lookVertical = this.lookVertical;
|
|
||||||
this.instance.autoForward = this.autoForward;
|
|
||||||
this.instance.activeLook = this.activeLook;
|
|
||||||
this.instance.heightSpeed = this.heightSpeed;
|
|
||||||
this.instance.heightCoef = this.heightCoef;
|
|
||||||
this.instance.heightMin = this.heightMin;
|
|
||||||
this.instance.heightMax = this.heightMax;
|
|
||||||
this.instance.constrainVertical = this.constrainVertical;
|
|
||||||
this.instance.verticalMin = this.verticalMin;
|
|
||||||
this.instance.verticalMax = this.verticalMax;
|
|
||||||
this.instance.autoSpeedFactor = this.autoSpeedFactor;
|
|
||||||
|
|
||||||
R3.Controls.prototype.createInstance.call(this);
|
R3.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,18 +76,6 @@ R3.Controls.D3.FirstPerson.prototype.createInstance = function() {
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.FirstPerson.prototype.updateInstance = function(property) {
|
R3.Controls.D3.FirstPerson.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (
|
|
||||||
property === 'canvas' ||
|
|
||||||
property === 'camera'
|
|
||||||
) {
|
|
||||||
if (R3.Utils.UndefinedOrNull(this.instance)) {
|
|
||||||
this.createInstance();
|
|
||||||
} else {
|
|
||||||
this.instance.dispose();
|
|
||||||
this.createInstance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'enabled') {
|
if (property === 'enabled') {
|
||||||
this.instance.enabled = this.enabled;
|
this.instance.enabled = this.enabled;
|
||||||
return;
|
return;
|
||||||
|
@ -186,35 +145,6 @@ R3.Controls.D3.FirstPerson.prototype.updateInstance = function(property) {
|
||||||
this.instance.autoSpeedFactor = this.autoSpeedFactor;
|
this.instance.autoSpeedFactor = this.autoSpeedFactor;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
R3.Controls.prototype.updateInstance.call(this, property);
|
R3.Controls.D3.prototype.updateInstance.call(this, property);
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Controls.D3.FirstPerson to a R3.D3.API.Mesh
|
|
||||||
* @returns {R3.API.Controls}
|
|
||||||
*/
|
|
||||||
R3.Controls.D3.FirstPerson.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiControls = R3.Controls.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
return new R3.API.Controls.D3.FirstPerson(
|
|
||||||
apiControls,
|
|
||||||
R3.Utils.IdOrNull(this.camera),
|
|
||||||
this.enabled,
|
|
||||||
this.movementSpeed,
|
|
||||||
this.lookSpeed,
|
|
||||||
this.lookVertical,
|
|
||||||
this.autoForward,
|
|
||||||
this.activeLook,
|
|
||||||
this.heightSpeed,
|
|
||||||
this.heightCoef,
|
|
||||||
this.heightMin,
|
|
||||||
this.heightMax,
|
|
||||||
this.constrainVertical,
|
|
||||||
this.verticalMin,
|
|
||||||
this.verticalMax,
|
|
||||||
this.autoSpeedFactor
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,59 +1,52 @@
|
||||||
/**
|
/**
|
||||||
* Controls Superset - The apiControls properties get moved into the Controls object itself, and then the instance is created
|
* R3.Controls.D3.Orbit is an R3.Controls.D3
|
||||||
* @param graphics R3.GraphicsRuntime
|
* @param parent
|
||||||
* @param apiOrbitControls
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.Orbit = function(
|
R3.Controls.D3.Orbit = function(
|
||||||
graphics,
|
parent,
|
||||||
apiOrbitControls
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiOrbitControls)) {
|
|
||||||
apiOrbitControls = {
|
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_ORBIT
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull()) {
|
|
||||||
apiOrbitControls.controlsType = R3.API.Controls.CONTROLS_TYPE_ORBIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Controls.D3.Orbit.call(
|
R3.API.Controls.D3.Orbit.call(
|
||||||
this,
|
this,
|
||||||
apiOrbitControls,
|
apiComponent,
|
||||||
apiOrbitControls.camera,
|
apiComponent.target,
|
||||||
apiOrbitControls.target,
|
apiComponent.enabled,
|
||||||
apiOrbitControls.enabled,
|
apiComponent.minPolarAngle,
|
||||||
apiOrbitControls.minPolarAngle,
|
apiComponent.maxPolarAngle,
|
||||||
apiOrbitControls.maxPolarAngle,
|
apiComponent.enableDamping,
|
||||||
apiOrbitControls.enableDamping,
|
apiComponent.dampingFactor,
|
||||||
apiOrbitControls.dampingFactor,
|
apiComponent.enableZoom,
|
||||||
apiOrbitControls.enableZoom,
|
apiComponent.zoomSpeed,
|
||||||
apiOrbitControls.zoomSpeed,
|
apiComponent.enableRotate,
|
||||||
apiOrbitControls.enableRotate,
|
apiComponent.rotateSpeed,
|
||||||
apiOrbitControls.rotateSpeed,
|
apiComponent.enablePan,
|
||||||
apiOrbitControls.enablePan,
|
apiComponent.keyPanSpeed,
|
||||||
apiOrbitControls.keyPanSpeed,
|
apiComponent.autoRotate,
|
||||||
apiOrbitControls.autoRotate,
|
apiComponent.autoRotateSpeed,
|
||||||
apiOrbitControls.autoRotateSpeed,
|
apiComponent.enableKeys
|
||||||
apiOrbitControls.enableKeys
|
|
||||||
);
|
);
|
||||||
|
|
||||||
R3.Controls.call(
|
if (this.target instanceof R3.API.Component) {
|
||||||
|
this.target = R3.Component.ConstructFromObject(this.target);
|
||||||
|
}
|
||||||
|
|
||||||
|
var linkedObjects = {
|
||||||
|
target : R3.D3.Object
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.Controls.D3.call(
|
||||||
this,
|
this,
|
||||||
apiOrbitControls
|
parent,
|
||||||
);
|
linkedObjects
|
||||||
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Inheritance
|
|
||||||
* @type {R3.Controls}
|
|
||||||
*/
|
|
||||||
R3.Controls.D3.Orbit.prototype = Object.create(R3.Controls.D3.prototype);
|
R3.Controls.D3.Orbit.prototype = Object.create(R3.Controls.D3.prototype);
|
||||||
R3.Controls.D3.Orbit.prototype.constructor = R3.Controls.D3.Orbit;
|
R3.Controls.D3.Orbit.prototype.constructor = R3.Controls.D3.Orbit;
|
||||||
|
|
||||||
|
@ -62,47 +55,27 @@ R3.Controls.D3.Orbit.prototype.constructor = R3.Controls.D3.Orbit;
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.Orbit.prototype.createInstance = function() {
|
R3.Controls.D3.Orbit.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (
|
this.instance = this.graphics.OrbitControls(
|
||||||
R3.Utils.UndefinedOrNull(this.camera) ||
|
this.canvas,
|
||||||
R3.Utils.UndefinedOrNull(this.camera.instance)
|
this.camera,
|
||||||
) {
|
this.target,
|
||||||
console.warn('no camera at time of editor-controls create instance');
|
this.enabled,
|
||||||
return;
|
this.minPolarAngle,
|
||||||
}
|
this.maxPolarAngle,
|
||||||
|
this.enableDamping,
|
||||||
if (
|
this.dampingFactor,
|
||||||
R3.Utils.UndefinedOrNull(this.canvas) ||
|
this.enableZoom,
|
||||||
R3.Utils.UndefinedOrNull(this.canvas.instance)
|
this.zoomSpeed,
|
||||||
) {
|
this.enableRotate,
|
||||||
console.warn('no canvas at time of editor-controls create instance');
|
this.rotateSpeed,
|
||||||
return;
|
this.enablePan,
|
||||||
}
|
this.keyPanSpeed,
|
||||||
|
this.autoRotate,
|
||||||
this.instance = new THREE.OrbitControls(
|
this.autoRotateSpeed,
|
||||||
this.camera.instance,
|
this.enableKeys
|
||||||
this.canvas.instance
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.target && this.target.instance) {
|
R3.Component.prototype.createInstance.call(this);
|
||||||
this.instance.target = this.target.instance.position;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance.enabled = this.enabled;
|
|
||||||
this.instance.minPolarAngle = this.minPolarAngle;
|
|
||||||
this.instance.maxPolarAngle = this.maxPolarAngle;
|
|
||||||
this.instance.enableDamping = this.enableDamping;
|
|
||||||
this.instance.dampingFactor = this.dampingFactor;
|
|
||||||
this.instance.enableZoom = this.enableZoom;
|
|
||||||
this.instance.zoomSpeed = this.zoomSpeed;
|
|
||||||
this.instance.enableRotate = this.enableRotate;
|
|
||||||
this.instance.rotateSpeed = this.rotateSpeed;
|
|
||||||
this.instance.enablePan = this.enablePan;
|
|
||||||
this.instance.keyPanSpeed = this.keyPanSpeed;
|
|
||||||
this.instance.autoRotate = this.autoRotate;
|
|
||||||
this.instance.autoRotateSpeed = this.autoRotateSpeed;
|
|
||||||
this.instance.enableKeys = this.enableKeys;
|
|
||||||
|
|
||||||
R3.Controls.prototype.createInstance.call(this);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,24 +83,12 @@ R3.Controls.D3.Orbit.prototype.createInstance = function() {
|
||||||
*/
|
*/
|
||||||
R3.Controls.D3.Orbit.prototype.updateInstance = function(property) {
|
R3.Controls.D3.Orbit.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (
|
|
||||||
property === 'canvas' ||
|
|
||||||
property === 'camera'
|
|
||||||
) {
|
|
||||||
if (R3.Utils.UndefinedOrNull(this.instance)) {
|
|
||||||
this.createInstance();
|
|
||||||
} else {
|
|
||||||
this.instance.dispose();
|
|
||||||
this.createInstance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'target') {
|
if (property === 'target') {
|
||||||
|
|
||||||
if (this.target && this.target.instance) {
|
if (this.target && this.target.instance) {
|
||||||
this.instance.target = this.target.instance.position;
|
this.instance.target = this.target.instance.position;
|
||||||
} else {
|
} else {
|
||||||
this.instance.target = new THREE.Vector3();
|
this.instance.target = new this.graphics.Vector3();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -201,35 +162,6 @@ R3.Controls.D3.Orbit.prototype.updateInstance = function(property) {
|
||||||
this.instance.enableKeys = this.enableKeys;
|
this.instance.enableKeys = this.enableKeys;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.Controls.prototype.updateInstance.call(this, property);
|
R3.Controls.D3.prototype.updateInstance.call(this, property);
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Controls.D3.Orbit to a R3.D3.API.Mesh
|
|
||||||
* @returns {R3.API.Controls}
|
|
||||||
*/
|
|
||||||
R3.Controls.D3.Orbit.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiControls = R3.Controls.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
return new R3.API.Controls.D3.Orbit(
|
|
||||||
apiControls,
|
|
||||||
R3.Utils.IdOrNull(this.camera),
|
|
||||||
R3.Utils.IdOrNull(this.target),
|
|
||||||
this.enabled,
|
|
||||||
this.minPolarAngle,
|
|
||||||
this.maxPolarAngle,
|
|
||||||
this.enableDamping,
|
|
||||||
this.dampingFactor,
|
|
||||||
this.enableZoom,
|
|
||||||
this.zoomSpeed,
|
|
||||||
this.enableRotate,
|
|
||||||
this.rotateSpeed,
|
|
||||||
this.enablePan,
|
|
||||||
this.keyPanSpeed,
|
|
||||||
this.autoRotate,
|
|
||||||
this.autoRotateSpeed,
|
|
||||||
this.enableKeys
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* R3.Controls.D3 is an R3.Controls
|
||||||
|
* @param parent
|
||||||
|
* @param linkedObjects
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.Controls.D3 = function(
|
||||||
|
parent,
|
||||||
|
linkedObjects
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||||
|
linkedObjects = {};
|
||||||
|
}
|
||||||
|
linkedObjects.camera = R3.D3.Camera;
|
||||||
|
|
||||||
|
R3.Controls.call(
|
||||||
|
this,
|
||||||
|
parent,
|
||||||
|
linkedObjects
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.Controls.D3.prototype = Object.create(R3.Controls.prototype);
|
||||||
|
R3.Controls.D3.prototype.constructor = R3.Controls.D3;
|
||||||
|
|
||||||
|
R3.Controls.D3.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (property === 'camera') {
|
||||||
|
console.warn('update camera instance update');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
R3.Controls.prototype.updateInstance.call(this, property);
|
||||||
|
|
||||||
|
};
|
|
@ -1,26 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* Keyboard Controls
|
* R3.Controls.Keyboard is an R3.Controls
|
||||||
* @param apiKeyboardControls R3.API.Controls
|
* @param parent
|
||||||
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.Keyboard = function(
|
R3.Controls.Keyboard = function(
|
||||||
apiKeyboardControls
|
parent,
|
||||||
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiKeyboardControls)) {
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
apiKeyboardControls = {
|
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_KEYBOARD
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Controls.Keyboard.call(
|
R3.API.Controls.Keyboard.call(
|
||||||
this,
|
this,
|
||||||
apiKeyboardControls
|
apiComponent
|
||||||
);
|
);
|
||||||
|
|
||||||
R3.Controls.call(
|
R3.Controls.call(
|
||||||
this,
|
this,
|
||||||
apiKeyboardControls
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,11 +34,8 @@ R3.Controls.Keyboard.prototype.constructor = R3.Controls.Keyboard;
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
R3.Controls.Keyboard.prototype.createInstance = function() {
|
R3.Controls.Keyboard.prototype.createInstance = function() {
|
||||||
/**
|
|
||||||
* Set instance to true to indicate no dependencies to other components
|
|
||||||
*/
|
|
||||||
this.instance = true;
|
this.instance = true;
|
||||||
R3.Controls.prototype.createInstance.call(this);
|
R3.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,31 +44,3 @@ R3.Controls.Keyboard.prototype.createInstance = function() {
|
||||||
R3.Controls.Keyboard.prototype.updateInstance = function(property) {
|
R3.Controls.Keyboard.prototype.updateInstance = function(property) {
|
||||||
R3.Controls.prototype.updateInstance.call(this, property);
|
R3.Controls.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Controls.Keyboard to a R3.API.Controls
|
|
||||||
* @returns {R3.API.Controls}
|
|
||||||
*/
|
|
||||||
R3.Controls.Keyboard.prototype.toApiObject = function() {
|
|
||||||
var apiControls = R3.Controls.prototype.toApiObject.call(this);
|
|
||||||
/**
|
|
||||||
* add other properties here as this component develops...
|
|
||||||
*/
|
|
||||||
return apiControls;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an Keyboard Controls object from data
|
|
||||||
* @param objectControls
|
|
||||||
* @returns {R3.Controls.Keyboard}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.Controls.Keyboard.FromObject = function(objectControls) {
|
|
||||||
|
|
||||||
var apiKeyboardControls = R3.API.Controls.Keyboard.FromObject(objectControls);
|
|
||||||
|
|
||||||
return new R3.Controls.Keyboard(
|
|
||||||
apiKeyboardControls
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,26 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* Mouse Controls
|
* R3.Controls.Mouse
|
||||||
* @param apiMouseControls R3.API.Controls
|
* @param parent
|
||||||
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Controls.Mouse = function(
|
R3.Controls.Mouse = function(
|
||||||
apiMouseControls
|
parent,
|
||||||
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiMouseControls)) {
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
apiMouseControls = {
|
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_MOUSE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Controls.Mouse.call(
|
R3.API.Controls.Mouse.call(
|
||||||
this,
|
this,
|
||||||
apiMouseControls
|
apiComponent
|
||||||
);
|
);
|
||||||
|
|
||||||
R3.Controls.call(
|
R3.Controls.call(
|
||||||
this,
|
this,
|
||||||
apiMouseControls
|
parent
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,11 +34,8 @@ R3.Controls.Mouse.prototype.constructor = R3.Controls.Mouse;
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
R3.Controls.Mouse.prototype.createInstance = function() {
|
R3.Controls.Mouse.prototype.createInstance = function() {
|
||||||
/**
|
|
||||||
* Set instance to true to indicate no dependencies to other components
|
|
||||||
*/
|
|
||||||
this.instance = true;
|
this.instance = true;
|
||||||
R3.Controls.prototype.createInstance.call(this);
|
R3.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,31 +44,3 @@ R3.Controls.Mouse.prototype.createInstance = function() {
|
||||||
R3.Controls.Mouse.prototype.updateInstance = function(property) {
|
R3.Controls.Mouse.prototype.updateInstance = function(property) {
|
||||||
R3.Controls.prototype.updateInstance.call(this, property);
|
R3.Controls.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Controls.Mouse to a R3.API.Controls
|
|
||||||
* @returns {R3.API.Controls}
|
|
||||||
*/
|
|
||||||
R3.Controls.Mouse.prototype.toApiObject = function() {
|
|
||||||
var apiControls = R3.Controls.prototype.toApiObject.call(this);
|
|
||||||
/**
|
|
||||||
* add other properties here as this component develops...
|
|
||||||
*/
|
|
||||||
return apiControls;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an Mouse Controls object from data
|
|
||||||
* @param objectControls
|
|
||||||
* @returns {R3.Controls.Mouse}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.Controls.Mouse.FromObject = function(objectControls) {
|
|
||||||
|
|
||||||
var apiMouseControls = R3.API.Controls.Mouse.FromObject(objectControls);
|
|
||||||
|
|
||||||
return new R3.Controls.Mouse(
|
|
||||||
apiMouseControls
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,28 +1,27 @@
|
||||||
/**
|
/**
|
||||||
* Touch Controls
|
* Touch Controls
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param apiTouchControls
|
* @param parent
|
||||||
|
* @param apiComponent
|
||||||
*/
|
*/
|
||||||
R3.Controls.Touch = function(
|
R3.Controls.Touch = function(
|
||||||
apiTouchControls
|
parent,
|
||||||
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiTouchControls)) {
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
apiTouchControls = {
|
|
||||||
controlsType : R3.API.Controls.CONTROLS_TYPE_TOUCH
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.Controls.Touch.call(
|
R3.API.Controls.Touch.call(
|
||||||
this,
|
this,
|
||||||
apiTouchControls,
|
apiComponent,
|
||||||
apiTouchControls.sensitivity
|
apiComponent.sensitivity
|
||||||
);
|
);
|
||||||
|
|
||||||
R3.Controls.call(
|
R3.Controls.call(
|
||||||
this,
|
this,
|
||||||
apiTouchControls
|
parent
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,11 +36,8 @@ R3.Controls.Touch.prototype.constructor = R3.Controls.Touch;
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
R3.Controls.Touch.prototype.createInstance = function() {
|
R3.Controls.Touch.prototype.createInstance = function() {
|
||||||
/**
|
|
||||||
* Set instance to true to indicate no dependencies to other components
|
|
||||||
*/
|
|
||||||
this.instance = true;
|
this.instance = true;
|
||||||
R3.Controls.prototype.createInstance.call(this);
|
R3.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,33 +46,3 @@ R3.Controls.Touch.prototype.createInstance = function() {
|
||||||
R3.Controls.Touch.prototype.updateInstance = function(property) {
|
R3.Controls.Touch.prototype.updateInstance = function(property) {
|
||||||
R3.Controls.prototype.updateInstance.call(this, property);
|
R3.Controls.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Controls.Touch to a R3.API.Controls
|
|
||||||
* @returns {R3.API.Controls}
|
|
||||||
*/
|
|
||||||
R3.Controls.Touch.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiControls = R3.Controls.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
apiControls.sensitivity = this.sensitivity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add other properties here as this component develops...
|
|
||||||
*/
|
|
||||||
return apiControls;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an Touch Controls object from data
|
|
||||||
* @param objectControls
|
|
||||||
* @returns {R3.Controls.Touch}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.Controls.Touch.FromObject = function(objectControls) {
|
|
||||||
|
|
||||||
var apiTouchControls = R3.API.Controls.Touch.FromObject(objectControls);
|
|
||||||
|
|
||||||
return new R3.Controls.Touch(apiTouchControls);
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,43 +1,53 @@
|
||||||
/**
|
/**
|
||||||
* R3.Curve
|
* R3.Curve
|
||||||
* @param graphics R3.GraphicsRuntime
|
* @param parent
|
||||||
* @param apiCurve R3.API.Curve
|
* @param apiComponent
|
||||||
* @property curveType
|
* @param linkedObjects
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Curve = function(
|
R3.Curve = function(
|
||||||
graphics,
|
parent,
|
||||||
apiCurve
|
apiComponent,
|
||||||
|
linkedObjects
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
/**
|
||||||
|
* This class behaves in such a way that we can create instances from it - we define the runtime and construct
|
||||||
|
* the api object and upgrade its properties (if any) to runtime
|
||||||
|
*/
|
||||||
|
|
||||||
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
|
|
||||||
|
R3.API.Curve.call(
|
||||||
|
this,
|
||||||
|
apiComponent,
|
||||||
|
apiComponent.arcLenghDivisions
|
||||||
|
);
|
||||||
|
|
||||||
|
R3.Component.call(
|
||||||
|
this,
|
||||||
|
parent
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class was inherited and Component constructor will call the child class createInstance()
|
||||||
|
* Add any more linking information to the linkedObjects object here
|
||||||
|
*/
|
||||||
|
|
||||||
|
R3.Component.call(
|
||||||
|
this,
|
||||||
|
parent,
|
||||||
|
linkedObjects
|
||||||
|
);
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiCurve)) {
|
|
||||||
apiCurve = {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.API.Curve.call(
|
|
||||||
this,
|
|
||||||
apiCurve.id,
|
|
||||||
apiCurve.name,
|
|
||||||
apiCurve.curveType,
|
|
||||||
apiCurve.parent,
|
|
||||||
apiCurve.arcLenghDivisions
|
|
||||||
);
|
|
||||||
|
|
||||||
var linkedObjects = {};
|
|
||||||
|
|
||||||
switch (this.curveType) {
|
|
||||||
case R3.API.Curve.CURVE_TYPE_PATH :
|
|
||||||
linkedObjects.curves = [R3.Curve];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.Component.call(
|
|
||||||
this,
|
|
||||||
linkedObjects
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Curve.prototype = Object.create(R3.Component.prototype);
|
R3.Curve.prototype = Object.create(R3.Component.prototype);
|
||||||
|
@ -47,14 +57,7 @@ R3.Curve.prototype.constructor = R3.Curve;
|
||||||
* Create Instance
|
* Create Instance
|
||||||
*/
|
*/
|
||||||
R3.Curve.prototype.createInstance = function() {
|
R3.Curve.prototype.createInstance = function() {
|
||||||
|
this.instance = this.graphics.Curve(this.arcLenghDivisions);
|
||||||
if (R3.Utils.UndefinedOrNull(this.instance)) {
|
|
||||||
console.warn('you should not instantiate this curve object directly');
|
|
||||||
this.instance = new THREE.Curve();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance.arcLenghDivisions = this.arcLenghDivisions;
|
|
||||||
|
|
||||||
R3.Component.prototype.createInstance.call(this);
|
R3.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,23 +68,8 @@ R3.Curve.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'arcLenghDivisions') {
|
if (property === 'arcLenghDivisions') {
|
||||||
this.instance.arcLenghDivisions = this.arcLenghDivisions;
|
this.instance.arcLenghDivisions = this.arcLenghDivisions;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.Component.prototype.updateInstance.call(this, property);
|
R3.Component.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Curve to a new R3.API.Curve
|
|
||||||
* @returns {R3.API.Curve}
|
|
||||||
*/
|
|
||||||
R3.Curve.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
return new R3.API.Curve(
|
|
||||||
this.id,
|
|
||||||
this.name,
|
|
||||||
this.curveType,
|
|
||||||
R3.Utils.IdOrNull(this.parent),
|
|
||||||
this.arcLenghDivisions
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,47 +1,70 @@
|
||||||
/**
|
/**
|
||||||
* R3.Curve.Path
|
* R3.Curve.Path
|
||||||
* @param graphics R3.GraphicsRuntime
|
|
||||||
* @param apiCurvePath
|
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @param parent
|
||||||
|
* @param apiComponent
|
||||||
|
* @param linkedObjects
|
||||||
*/
|
*/
|
||||||
R3.Curve.Path = function(
|
R3.Curve.Path = function(
|
||||||
graphics,
|
parent,
|
||||||
apiCurvePath
|
apiComponent,
|
||||||
|
linkedObjects
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiCurvePath)) {
|
/**
|
||||||
apiCurvePath = {
|
* This class behaves in such a way that we can create instances from it - we define the runtime and construct
|
||||||
curveType : R3.API.Curve.CURVE_TYPE_PATH
|
* the api object and upgrade its properties to runtime
|
||||||
|
*/
|
||||||
|
|
||||||
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
|
|
||||||
|
R3.API.Curve.Path.call(
|
||||||
|
this,
|
||||||
|
apiComponent,
|
||||||
|
apiComponent.curves,
|
||||||
|
apiComponent.autoClose
|
||||||
|
);
|
||||||
|
|
||||||
|
this.curves = this.curves.reduce(
|
||||||
|
function(result, curve) {
|
||||||
|
|
||||||
|
if (curve instanceof R3.API.Component) {
|
||||||
|
curve = R3.Component.ConstructFromObject(curve);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.push(curve);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
linkedObjects = {
|
||||||
|
curves : [R3.Curve]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class was inherited and Component constructor will call the child class createInstance()
|
||||||
|
* Add any more linking information to the linkedObjects object here - and pass up the inheritence chain
|
||||||
|
* so more linking information can be attached
|
||||||
|
*/
|
||||||
|
linkedObjects.curves = [R3.Curve];
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.API.Curve.Path.call(
|
/**
|
||||||
this,
|
* Now we call the parent class but with linkedObjects - indicating that its being called from a child class
|
||||||
apiCurvePath,
|
* and should not do any runtime instantiation
|
||||||
apiCurvePath.curves,
|
*/
|
||||||
apiCurvePath.autoClose
|
|
||||||
);
|
|
||||||
|
|
||||||
this.curves = this.curves.map(
|
|
||||||
function(curve) {
|
|
||||||
if (curve instanceof R3.API.Curve) {
|
|
||||||
return new R3.Curve(
|
|
||||||
this.graphics,
|
|
||||||
curve
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
R3.Curve.call(
|
R3.Curve.call(
|
||||||
this,
|
this,
|
||||||
this.graphics,
|
parent,
|
||||||
this
|
apiComponent,
|
||||||
);
|
linkedObjects
|
||||||
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Curve.Path.prototype = Object.create(R3.Curve.prototype);
|
R3.Curve.Path.prototype = Object.create(R3.Curve.prototype);
|
||||||
|
@ -53,20 +76,9 @@ R3.Curve.Path.prototype.constructor = R3.Curve.Path;
|
||||||
*/
|
*/
|
||||||
R3.Curve.Path.prototype.createInstance = function() {
|
R3.Curve.Path.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(this.instance)) {
|
this.instance = this.graphics.CurvePath(this.curves, this.autoClose);
|
||||||
console.warn('you should not instantiate this curve object directly');
|
|
||||||
this.instance = new THREE.CurvePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance.curves = this.curves.map(
|
R3.Component.prototype.createInstance.call(this);
|
||||||
function(curve) {
|
|
||||||
return curve.instance;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this.instance.autoClose = this.autoClose;
|
|
||||||
|
|
||||||
R3.Curve.prototype.createInstance.call(this);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,24 +98,3 @@ R3.Curve.Path.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
R3.Curve.prototype.updateInstance.call(this, property);
|
R3.Curve.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Curve to a R3.API.Curve
|
|
||||||
* @returns {R3.API.Curve}
|
|
||||||
*/
|
|
||||||
R3.Curve.Path.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiCurve = R3.Curve.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
var apiCurvePath = new R3.API.Curve.Path(
|
|
||||||
apiCurve,
|
|
||||||
this.curves.map(
|
|
||||||
function(curve) {
|
|
||||||
return R3.Utils.IdOrNull(curve);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
this.autoClose
|
|
||||||
);
|
|
||||||
|
|
||||||
return apiCurvePath;
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,43 +1,73 @@
|
||||||
/**
|
/**
|
||||||
* R3.Curve.Path.D2
|
* R3.Curve.Path.D2
|
||||||
* @param graphics R3.GraphicsRuntime
|
* @param parent
|
||||||
* @param apiCurvePath
|
* @param apiComponent
|
||||||
|
* @param linkedObjects
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Curve.Path.D2 = function(
|
R3.Curve.Path.D2 = function(
|
||||||
graphics,
|
parent,
|
||||||
apiCurvePath
|
apiComponent,
|
||||||
|
linkedObjects
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiCurvePath)) {
|
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||||
apiCurvePath = {
|
|
||||||
curveType : R3.API.Curve.CURVE_TYPE_PATH_2D
|
/**
|
||||||
};
|
* This class behaves in such a way that we can create instances from it - we define the runtime and construct
|
||||||
|
* the api object and upgrade its properties to runtime
|
||||||
|
*/
|
||||||
|
|
||||||
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
|
|
||||||
|
R3.API.Curve.Path.D2.call(
|
||||||
|
this,
|
||||||
|
apiComponent,
|
||||||
|
apiComponent.points
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class was inherited and Component constructor will call the child class createInstance()
|
||||||
|
* Add any more linking information to the linkedObjects object here -
|
||||||
|
* Points aren't components so they don't get added to linkedObjects
|
||||||
|
* @type {R3.Vector2}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.API.Curve.Path.D2.call(
|
this.points = this.points.reduce(
|
||||||
this,
|
function(result, point) {
|
||||||
apiCurvePath,
|
|
||||||
apiCurvePath.points
|
|
||||||
);
|
|
||||||
|
|
||||||
this.points = this.points.map(
|
/**
|
||||||
function(point) {
|
* Points aren't components so they don't get added to linkedObjects
|
||||||
return new R3.Vector2(
|
* @type {R3.Vector2}
|
||||||
this.graphics,
|
*/
|
||||||
|
point = new R3.Vector2(
|
||||||
|
this,
|
||||||
point
|
point
|
||||||
);
|
);
|
||||||
}.bind(this)
|
|
||||||
|
result.push(point);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now we call the parent class but with linkedObjects - indicating that its being called from a child class
|
||||||
|
* and should not do any runtime instantiation
|
||||||
|
*/
|
||||||
R3.Curve.Path.call(
|
R3.Curve.Path.call(
|
||||||
this,
|
this,
|
||||||
this.graphics,
|
parent,
|
||||||
this
|
apiComponent,
|
||||||
|
linkedObjects
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,17 +80,9 @@ R3.Curve.Path.D2.prototype.constructor = R3.Curve.Path.D2;
|
||||||
*/
|
*/
|
||||||
R3.Curve.Path.D2.prototype.createInstance = function() {
|
R3.Curve.Path.D2.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(this.instance)) {
|
this.instance = this.graphics.Path(this.points);
|
||||||
this.instance = new THREE.Path(
|
|
||||||
this.points.map(
|
|
||||||
function(point) {
|
|
||||||
return point.instance;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.Curve.Path.prototype.createInstance.call(this);
|
R3.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,32 +92,7 @@ R3.Curve.Path.D2.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'points') {
|
if (property === 'points') {
|
||||||
console.warn('todo: update points (and test it)');
|
console.warn('todo: update points (and test it)');
|
||||||
this.instance.points = this.points.map(
|
|
||||||
function(point) {
|
|
||||||
return point.instance;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.Curve.Path.prototype.updateInstance.call(this, property);
|
R3.Curve.Path.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Curve to a R3.API.Curve
|
|
||||||
* @returns {R3.API.Curve}
|
|
||||||
*/
|
|
||||||
R3.Curve.Path.D2.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiCurvePath = R3.Curve.Path.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
return new R3.API.Curve.Path.D2(
|
|
||||||
apiCurvePath,
|
|
||||||
this.points.map(
|
|
||||||
function(point) {
|
|
||||||
return point.toApiObject();
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,34 +1,49 @@
|
||||||
/**
|
/**
|
||||||
* R3.Curve.Path.D2
|
* R3.Curve.Path.D2.Shape
|
||||||
* @param graphics R3.GraphicsRuntime
|
* @param parent
|
||||||
* @param apiCurvePathD2
|
* @param apiComponent
|
||||||
|
* @param linkedObjects
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.Curve.Path.D2.Shape = function(
|
R3.Curve.Path.D2.Shape = function(
|
||||||
graphics,
|
parent,
|
||||||
apiCurvePathD2
|
apiComponent,
|
||||||
|
linkedObjects
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.graphics = graphics;
|
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
/**
|
||||||
|
* This class behaves in such a way that we can create instances from it - we define the runtime and construct
|
||||||
|
* the api object and upgrade its properties to runtime
|
||||||
|
*/
|
||||||
|
|
||||||
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
|
|
||||||
|
R3.API.Curve.Path.D2.Shape.call(
|
||||||
|
this,
|
||||||
|
apiComponent
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class was inherited and Component constructor will call the child class createInstance()
|
||||||
|
* Add any more linking information to the linkedObjects object here
|
||||||
|
*/
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiCurvePathD2)) {
|
|
||||||
apiCurvePathD2 = {
|
|
||||||
curveType : R3.API.Curve.CURVE_TYPE_PATH_2D_SHAPE
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R3.API.Curve.Path.D2.call(
|
/**
|
||||||
this,
|
* Now we call the parent class but with linkedObjects - indicating that its being called from a child class
|
||||||
apiCurvePathD2,
|
* and should not do any runtime instantiation
|
||||||
apiCurvePathD2.points
|
*/
|
||||||
);
|
|
||||||
|
|
||||||
R3.Curve.Path.D2.call(
|
R3.Curve.Path.D2.call(
|
||||||
this,
|
this,
|
||||||
this.graphics,
|
parent,
|
||||||
this
|
apiComponent,
|
||||||
);
|
linkedObjects
|
||||||
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -41,15 +56,9 @@ R3.Curve.Path.D2.Shape.prototype.constructor = R3.Curve.Path.D2.Shape;
|
||||||
*/
|
*/
|
||||||
R3.Curve.Path.D2.Shape.prototype.createInstance = function() {
|
R3.Curve.Path.D2.Shape.prototype.createInstance = function() {
|
||||||
|
|
||||||
this.instance = new THREE.Shape(
|
this.instance = this.graphics.Shape(this.points);
|
||||||
this.points.map(
|
|
||||||
function(point) {
|
|
||||||
return point.instance;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
R3.Curve.Path.D2.prototype.createInstance.call(this);
|
R3.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,17 +67,3 @@ R3.Curve.Path.D2.Shape.prototype.createInstance = function() {
|
||||||
R3.Curve.Path.D2.Shape.prototype.updateInstance = function(property) {
|
R3.Curve.Path.D2.Shape.prototype.updateInstance = function(property) {
|
||||||
R3.Curve.Path.D2.prototype.updateInstance.call(this, property);
|
R3.Curve.Path.D2.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.Curve to a R3.API.Curve
|
|
||||||
* @returns {R3.API.Curve}
|
|
||||||
*/
|
|
||||||
R3.Curve.Path.D2.Shape.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiCurvePathD2 = R3.Curve.Path.D2.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
return new R3.API.Curve.Path.D2.Shape(
|
|
||||||
apiCurvePathD2
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,28 +1,29 @@
|
||||||
/**
|
/**
|
||||||
* Creates a CustomCode object
|
* R3.CustomCode
|
||||||
* @param apiCustomCode R3.API.CustomCode
|
* @param parent
|
||||||
|
* @param apiComponent
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.CustomCode = function(
|
R3.CustomCode = function(
|
||||||
apiCustomCode
|
parent,
|
||||||
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiCustomCode)) {
|
__RUNTIME_COMPONENT_MACRO__;
|
||||||
apiCustomCode = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.API.CustomCode.call(
|
R3.API.CustomCode.call(
|
||||||
this,
|
this,
|
||||||
apiCustomCode.id,
|
apiComponent,
|
||||||
apiCustomCode.name,
|
apiComponent.eventId,
|
||||||
apiCustomCode.eventId,
|
apiComponent.code,
|
||||||
apiCustomCode.code,
|
|
||||||
apiCustomCode.parent
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.editor = null;
|
this.editor = null;
|
||||||
|
|
||||||
R3.Component.call(this);
|
R3.Component.call(
|
||||||
|
this,
|
||||||
|
parent
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.CustomCode.prototype = Object.create(R3.Component.prototype);
|
R3.CustomCode.prototype = Object.create(R3.Component.prototype);
|
||||||
|
@ -31,7 +32,9 @@ R3.CustomCode.prototype.constructor = R3.CustomCode;
|
||||||
R3.CustomCode.prototype.createInstance = function() {
|
R3.CustomCode.prototype.createInstance = function() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.instance = new Function('data', this.code).bind(this);
|
|
||||||
|
this.instance = new Function('data', this.code).bind(this);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
/**
|
/**
|
||||||
* Set the instance to true here to indicate that even though the compilation failed, the instance will be fine and
|
* Set the instance to true here to indicate that even though the compilation failed, the instance will be fine and
|
||||||
|
@ -93,33 +96,8 @@ R3.CustomCode.prototype.updateInstance = function(property) {
|
||||||
R3.Component.prototype.updateInstance.call(this, property);
|
R3.Component.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.CustomCode to a new R3.API.CustomCode
|
|
||||||
* @returns {R3.API.CustomCode}
|
|
||||||
*/
|
|
||||||
R3.CustomCode.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
return new R3.API.CustomCode(
|
|
||||||
this.id,
|
|
||||||
this.name,
|
|
||||||
this.eventId,
|
|
||||||
this.code,
|
|
||||||
R3.Utils.IdOrNull(this.parent)
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.CustomCode.prototype.launchEditor = function(){
|
R3.CustomCode.prototype.launchEditor = function(){
|
||||||
|
|
||||||
R3.Event.Emit(
|
|
||||||
R3.Event.GET_RUNTIME,
|
|
||||||
null,
|
|
||||||
function(runtime) {
|
|
||||||
this.coder = runtime.coder;
|
|
||||||
this.coder.isNotCodeMirrorThrow();
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this instanceof R3.D3.Shader.Vertex) {
|
if (this instanceof R3.D3.Shader.Vertex) {
|
||||||
this.editor = this.coder.instance(
|
this.editor = this.coder.instance(
|
||||||
document.body,
|
document.body,
|
||||||
|
|
|
@ -21,7 +21,7 @@ R3.D3.API.Object = function(
|
||||||
lookAt
|
lookAt
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(useQuaternion)) {
|
if (R3.Utils.UndefinedOrNull(useQuaternion)) {
|
||||||
useQuaternion = true;
|
useQuaternion = true;
|
|
@ -23,7 +23,7 @@ R3.D3.API.Animation = function(
|
||||||
applyToMeshWhenDone
|
applyToMeshWhenDone
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(rotationSpeed)) {
|
if (R3.Utils.UndefinedOrNull(rotationSpeed)) {
|
||||||
rotationSpeed = 0;
|
rotationSpeed = 0;
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
* @param path
|
* @param path
|
||||||
* @param loop
|
* @param loop
|
||||||
* @param volume
|
* @param volume
|
||||||
* @param camera
|
* @param cameraIndex
|
||||||
* @param overplay
|
|
||||||
* @param paused
|
* @param paused
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
|
@ -14,12 +13,11 @@ R3.D3.API.Audio = function(
|
||||||
path,
|
path,
|
||||||
loop,
|
loop,
|
||||||
volume,
|
volume,
|
||||||
camera,
|
cameraIndex,
|
||||||
overplay,
|
|
||||||
paused
|
paused
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(path)) {
|
if (R3.Utils.UndefinedOrNull(path)) {
|
||||||
path = '';
|
path = '';
|
||||||
|
@ -36,15 +34,10 @@ R3.D3.API.Audio = function(
|
||||||
}
|
}
|
||||||
this.volume = volume;
|
this.volume = volume;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(camera)) {
|
if (R3.Utils.UndefinedOrNull(cameraIndex)) {
|
||||||
camera = null;
|
cameraIndex = R3.API.Project.CAMERA_INDEX_RUN;
|
||||||
}
|
}
|
||||||
this.camera = camera;
|
this.cameraIndex = cameraIndex;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(overplay)) {
|
|
||||||
overplay = false;
|
|
||||||
}
|
|
||||||
this.overplay = overplay;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(paused)) {
|
if (R3.Utils.UndefinedOrNull(paused)) {
|
||||||
paused = false;
|
paused = false;
|
||||||
|
|
|
@ -1,13 +1,28 @@
|
||||||
/**
|
/**
|
||||||
* BoneWeight object - associates a vertex to a bone with some weight
|
* R3.D3.API.BoneWeight
|
||||||
* @param boneIndex int
|
* @param apiComponent
|
||||||
* @param weight float
|
* @param boneIndex
|
||||||
|
* @param weight
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.D3.API.BoneWeight = function(
|
R3.D3.API.BoneWeight = function(
|
||||||
|
apiComponent,
|
||||||
boneIndex,
|
boneIndex,
|
||||||
weight
|
weight
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(boneIndex)) {
|
||||||
|
boneIndex = 0;
|
||||||
|
}
|
||||||
this.boneIndex = boneIndex;
|
this.boneIndex = boneIndex;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(weight)) {
|
||||||
|
weight = 0;
|
||||||
|
}
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
R3.D3.API.BoneWeight.prototype = Object.create(R3.API.Component.prototype);
|
||||||
|
R3.D3.API.BoneWeight.prototype.constructor = R3.D3.API.BoneWeight;
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.D3.API.Broadphase = function(
|
||||||
broadphaseType
|
broadphaseType
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(broadphaseType)) {
|
if (R3.Utils.UndefinedOrNull(broadphaseType)) {
|
||||||
broadphaseType = R3.D3.Broadphase.BROADPHASE_TYPE_NAIVE;
|
broadphaseType = R3.D3.Broadphase.BROADPHASE_TYPE_NAIVE;
|
||||||
|
|
|
@ -45,7 +45,7 @@ R3.D3.API.Camera.Cube = function(
|
||||||
this.cubeResolution = cubeResolution;
|
this.cubeResolution = cubeResolution;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||||
renderTarget = null;
|
renderTarget = new R3.D3.API.RenderTarget.Cube();
|
||||||
}
|
}
|
||||||
this.renderTarget = renderTarget;
|
this.renderTarget = renderTarget;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Composer = function(
|
||||||
passes
|
passes
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
||||||
autoUpdateSize = true;
|
autoUpdateSize = true;
|
||||||
|
|
|
@ -14,7 +14,7 @@ R3.D3.API.Effect = function(
|
||||||
height
|
height
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(width)) {
|
if (R3.Utils.UndefinedOrNull(width)) {
|
||||||
width = 512;
|
width = 512;
|
||||||
|
|
|
@ -27,7 +27,7 @@ R3.D3.API.Face = function(
|
||||||
selected
|
selected
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(v0index)) {
|
if (R3.Utils.UndefinedOrNull(v0index)) {
|
||||||
v0index = -1;
|
v0index = -1;
|
||||||
|
|
|
@ -17,7 +17,7 @@ R3.D3.API.Fog = function(
|
||||||
density
|
density
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(exponential)) {
|
if (R3.Utils.UndefinedOrNull(exponential)) {
|
||||||
exponential = false;
|
exponential = false;
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.D3.API.Font = function(
|
||||||
path
|
path
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(path)) {
|
if (R3.Utils.UndefinedOrNull(path)) {
|
||||||
path = '';
|
path = '';
|
||||||
|
|
|
@ -21,7 +21,7 @@ R3.D3.API.FrictionContactMaterial = function(
|
||||||
frictionEquationRelaxation
|
frictionEquationRelaxation
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(materials)) {
|
if (R3.Utils.UndefinedOrNull(materials)) {
|
||||||
materials = [];
|
materials = [];
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.FrictionMaterial = function(
|
||||||
restitution
|
restitution
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(friction)) {
|
if (R3.Utils.UndefinedOrNull(friction)) {
|
||||||
friction = -1;
|
friction = -1;
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry = function(
|
||||||
vertices
|
vertices
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(boundingBox)) {
|
if (R3.Utils.UndefinedOrNull(boundingBox)) {
|
||||||
boundingBox = new R3.API.Box3();
|
boundingBox = new R3.API.Box3();
|
||||||
|
|
|
@ -19,7 +19,7 @@ R3.D3.API.Geometry.Buffer.Box = function(
|
||||||
depthSegments
|
depthSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(width)) {
|
if (R3.Utils.UndefinedOrNull(width)) {
|
||||||
width = 1;
|
width = 1;
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry.Buffer.Circle = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -21,7 +21,7 @@ R3.D3.API.Geometry.Buffer.Cone = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -23,7 +23,7 @@ R3.D3.API.Geometry.Buffer.Cylinder = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radiusTop)) {
|
if (R3.Utils.UndefinedOrNull(radiusTop)) {
|
||||||
radiusTop = 1;
|
radiusTop = 1;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Buffer.Dodecahedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -29,7 +29,7 @@ R3.D3.API.Geometry.Buffer.Extrude = function(
|
||||||
UVGenerator
|
UVGenerator
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(shapes)) {
|
if (R3.Utils.UndefinedOrNull(shapes)) {
|
||||||
shapes = [];
|
shapes = [];
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Buffer.Icosahedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.D3.API.Geometry.Buffer.Instanced = function(
|
||||||
maxInstancedCount
|
maxInstancedCount
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(maxInstancedCount)) {
|
if (R3.Utils.UndefinedOrNull(maxInstancedCount)) {
|
||||||
maxInstancedCount = null;
|
maxInstancedCount = null;
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry.Buffer.Lathe = function(
|
||||||
phiLength
|
phiLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(points)) {
|
if (R3.Utils.UndefinedOrNull(points)) {
|
||||||
points = [];
|
points = [];
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Buffer.Octahedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -13,7 +13,7 @@ R3.D3.API.Geometry.Buffer.Parametric = function(
|
||||||
stacks
|
stacks
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(generatorFn)) {
|
if (R3.Utils.UndefinedOrNull(generatorFn)) {
|
||||||
generatorFn = '';
|
generatorFn = '';
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry.Buffer.Plane = function(
|
||||||
heightSegments
|
heightSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(width)) {
|
if (R3.Utils.UndefinedOrNull(width)) {
|
||||||
width = 1;
|
width = 1;
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry.Buffer.Polyhedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(vertices)) {
|
if (R3.Utils.UndefinedOrNull(vertices)) {
|
||||||
vertices = [];
|
vertices = [];
|
||||||
|
|
|
@ -19,7 +19,7 @@ R3.D3.API.Geometry.Buffer.Ring = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(innerRadius)) {
|
if (R3.Utils.UndefinedOrNull(innerRadius)) {
|
||||||
innerRadius = 0.5;
|
innerRadius = 0.5;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Buffer.Shape = function(
|
||||||
curveSegments
|
curveSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(shapes)) {
|
if (R3.Utils.UndefinedOrNull(shapes)) {
|
||||||
shapes = [];
|
shapes = [];
|
||||||
|
|
|
@ -21,7 +21,7 @@ R3.D3.API.Geometry.Buffer.Sphere = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Buffer.Tetrahedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -25,7 +25,7 @@ R3.D3.API.Geometry.Buffer.Text = function(
|
||||||
bevelSegments
|
bevelSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(text)) {
|
if (R3.Utils.UndefinedOrNull(text)) {
|
||||||
text = '-=<yb4f310';
|
text = '-=<yb4f310';
|
||||||
|
|
|
@ -19,7 +19,7 @@ R3.D3.API.Geometry.Buffer.TorusKnot = function(
|
||||||
q
|
q
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -17,7 +17,7 @@ R3.D3.API.Geometry.Buffer.Torus = function(
|
||||||
arc
|
arc
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -17,7 +17,7 @@ R3.D3.API.Geometry.Buffer.Tube = function(
|
||||||
closed
|
closed
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_BUFFER_MACRO__
|
__API_GEOMETRY_BUFFER_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(path)) {
|
if (R3.Utils.UndefinedOrNull(path)) {
|
||||||
path = null;
|
path = null;
|
||||||
|
|
|
@ -19,7 +19,7 @@ R3.D3.API.Geometry.Normal.Box = function(
|
||||||
depthSegments
|
depthSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(width)) {
|
if (R3.Utils.UndefinedOrNull(width)) {
|
||||||
width = 1;
|
width = 1;
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry.Normal.Circle = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -21,7 +21,7 @@ R3.D3.API.Geometry.Normal.Cone = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -23,7 +23,7 @@ R3.D3.API.Geometry.Normal.Cylinder = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radiusTop)) {
|
if (R3.Utils.UndefinedOrNull(radiusTop)) {
|
||||||
radiusTop = 1;
|
radiusTop = 1;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Normal.Dodecahedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Normal.Edges = function(
|
||||||
thresholdAngle
|
thresholdAngle
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(geometry)) {
|
if (R3.Utils.UndefinedOrNull(geometry)) {
|
||||||
geometry = null;
|
geometry = null;
|
||||||
|
|
|
@ -29,7 +29,7 @@ R3.D3.API.Geometry.Normal.Extrude = function(
|
||||||
UVGenerator
|
UVGenerator
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(shapes)) {
|
if (R3.Utils.UndefinedOrNull(shapes)) {
|
||||||
shapes = [];
|
shapes = [];
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Normal.Icosahedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry.Normal.Lathe = function(
|
||||||
phiLength
|
phiLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(points)) {
|
if (R3.Utils.UndefinedOrNull(points)) {
|
||||||
points = [];
|
points = [];
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Normal.Octahedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -13,7 +13,7 @@ R3.D3.API.Geometry.Normal.Parametric = function(
|
||||||
stacks
|
stacks
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(generatorFn)) {
|
if (R3.Utils.UndefinedOrNull(generatorFn)) {
|
||||||
generatorFn = '';
|
generatorFn = '';
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry.Normal.Plane = function(
|
||||||
heightSegments
|
heightSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(width)) {
|
if (R3.Utils.UndefinedOrNull(width)) {
|
||||||
width = 1;
|
width = 1;
|
||||||
|
|
|
@ -15,7 +15,7 @@ R3.D3.API.Geometry.Normal.Polyhedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(vertices)) {
|
if (R3.Utils.UndefinedOrNull(vertices)) {
|
||||||
vertices = [];
|
vertices = [];
|
||||||
|
|
|
@ -19,7 +19,7 @@ R3.D3.API.Geometry.Normal.Ring = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(innerRadius)) {
|
if (R3.Utils.UndefinedOrNull(innerRadius)) {
|
||||||
innerRadius = 0.5;
|
innerRadius = 0.5;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Normal.Shape = function(
|
||||||
curveSegments
|
curveSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(shapes)) {
|
if (R3.Utils.UndefinedOrNull(shapes)) {
|
||||||
shapes = [];
|
shapes = [];
|
||||||
|
|
|
@ -21,7 +21,7 @@ R3.D3.API.Geometry.Normal.Sphere = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Geometry.Normal.Tetrahedron = function(
|
||||||
detail
|
detail
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -25,7 +25,7 @@ R3.D3.API.Geometry.Normal.Text = function(
|
||||||
bevelSegments
|
bevelSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(text)) {
|
if (R3.Utils.UndefinedOrNull(text)) {
|
||||||
text = '-=<yb4f310';
|
text = '-=<yb4f310';
|
||||||
|
|
|
@ -19,7 +19,7 @@ R3.D3.API.Geometry.Normal.TorusKnot = function(
|
||||||
q
|
q
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -17,7 +17,7 @@ R3.D3.API.Geometry.Normal.Torus = function(
|
||||||
arc
|
arc
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
|
|
|
@ -17,7 +17,7 @@ R3.D3.API.Geometry.Normal.Tube = function(
|
||||||
closed
|
closed
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(path)) {
|
if (R3.Utils.UndefinedOrNull(path)) {
|
||||||
path = null;
|
path = null;
|
||||||
|
|
|
@ -9,7 +9,7 @@ R3.D3.API.Geometry.Normal.Wireframe = function(
|
||||||
geometry
|
geometry
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_GEOMETRY_NORMAL_MACRO__
|
__API_GEOMETRY_NORMAL_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(geometry)) {
|
if (R3.Utils.UndefinedOrNull(geometry)) {
|
||||||
geometry = null;
|
geometry = null;
|
||||||
|
|
|
@ -11,7 +11,7 @@ R3.D3.API.Light = function(
|
||||||
intensity
|
intensity
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT_MACRO__
|
__API_COMPONENT_MACRO__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(color)) {
|
if (R3.Utils.UndefinedOrNull(color)) {
|
||||||
color = new R3.API.Color(this, 1,1,1);
|
color = new R3.API.Color(this, 1,1,1);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue