first version compiling

beta.r3js.org
cybafelo 2019-10-06 21:11:18 +02:00
parent 7611567b2c
commit 41645d1ca6
444 changed files with 16287 additions and 17366 deletions

View File

@ -0,0 +1,30 @@
/**
* R3.D3.API.Composer.RenderTarget
* @param apiComponent
*
* @property renderTarget
*
* @constructor
*/
R3.D3.API.Composer.RenderTarget = function(
apiComponent
) {
R3.D3.API.Composer.call(
this,
apiComponent
);
if (R3.Utils.UndefinedOrNull(apiComponent.renderTarget)) {
apiComponent.renderTarget = new R3.D3.API.RenderTarget(
{
parent : this
}
);
}
this.renderTarget = apiComponent.renderTarget
};
R3.D3.API.Composer.RenderTarget.prototype = Object.create(R3.D3.API.Composer.prototype);
R3.D3.API.Composer.RenderTarget.prototype.constructor = R3.D3.API.Composer.RenderTarget;

View File

@ -0,0 +1,26 @@
/**
* R3.D3.API.Composer.Renderer
* @param apiComposer
*
* @property renderer
*
* @constructor
*/
R3.D3.API.Composer.Renderer = function(
apiComposer
) {
R3.D3.API.Composer.call(
this,
apiComponent
);
if (R3.Utils.UndefinedOrNull(apiComponent.renderer)) {
apiComponent.renderer = this.getFirstParent(R3.API.Renderer.D3);
}
this.renderer = apiComponent.renderer;
};
R3.D3.API.Composer.Renderer.prototype = Object.create(R3.D3.API.Composer.prototype);
R3.D3.API.Composer.Renderer.prototype.constructor = R3.D3.API.Composer.Renderer;

View File

@ -7,7 +7,7 @@ R3.D3.Composer.RenderTarget = function(
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.D3.API.Composer.RenderTarget.call( R3.D3.API.Composer.RenderTarget.call(
this, this,
@ -58,7 +58,7 @@ R3.D3.Composer.RenderTarget.prototype.createInstance = function() {
} }
); );
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

View File

@ -7,7 +7,7 @@ R3.D3.Composer.Renderer = function(
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.D3.API.Composer.Renderer.call( R3.D3.API.Composer.Renderer.call(
this, this,
@ -89,7 +89,7 @@ R3.D3.Composer.Renderer.prototype.createInstance = function() {
} }
); );
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

View File

@ -1,2 +0,0 @@
//#define EDITOR__
//#define DEBUG__

View File

@ -1,2 +0,0 @@
//#define RUNTIME__
//#define DEBUG__

View File

@ -21,86 +21,19 @@ code += '\t\tthis.apiComponent.register,\n';
code += '\t\tthis.apiComponent.selected\n'; code += '\t\tthis.apiComponent.selected\n';
code += '\t)'; code += '\t)';
var code2 = 'if (R3.Utils.UndefinedOrNull(apiGeometryBuffer)) {\n'; var code2 = 'R3.D3.API.Geometry.Buffer.call(\n';
code2 += '\t\tapiGeometryBuffer = {};\n';
code2 += '\t}\n';
code2 += '\tthis.apiGeometryBuffer = apiGeometryBuffer;\n';
code2 += '\n';
code2 += '\tR3.D3.API.Geometry.Buffer.call(\n';
code2 += '\t\tthis,\n'; code2 += '\t\tthis,\n';
code2 += '\t\tthis.apiGeometryBuffer,\n'; code2 += '\t\tapiComponent\n';
code2 += '\t\tthis.apiGeometryBuffer.attributes,\n';
code2 += '\t\tthis.apiGeometryBuffer.drawRange,\n';
code2 += '\t\tthis.apiGeometryBuffer.groups,\n';
code2 += '\t\tthis.apiGeometryBuffer.index,\n';
code2 += '\t\tthis.apiGeometryBuffer.morphAttributes\n';
code2 += '\t)'; code2 += '\t)';
var code3 = 'if (R3.Utils.UndefinedOrNull(apiGeometryNormal)) {\n'; var code3 = 'R3.D3.API.Geometry.Normal.call(\n';
code3 += '\t\tapiGeometryNormal = {};\n';
code3 += '\t}\n';
code3 += '\tthis.apiGeometryNormal = apiGeometryNormal;\n';
code3 += '\n';
code3 += '\tR3.D3.API.Geometry.Normal.call(\n';
code3 += '\t\tthis,\n'; code3 += '\t\tthis,\n';
code3 += '\t\tthis.apiGeometryNormal,\n'; code3 += '\t\tapiComponent\n';
code3 += '\t\tthis.apiGeometryNormal.colors,\n';
code3 += '\t\tthis.apiGeometryNormal.lineDistances,\n';
code3 += '\t\tthis.apiGeometryNormal.morphTargets,\n';
code3 += '\t\tthis.apiGeometryNormal.morphNormals,\n';
code3 += '\t\tthis.apiGeometryNormal.skinWeights,\n';
code3 += '\t\tthis.apiGeometryNormal.skinIndices,\n';
code3 += '\t\tthis.apiGeometryNormal.verticesNeedsUpdate,\n';
code3 += '\t\tthis.apiGeometryNormal.elementsNeedUpdate,\n';
code3 += '\t\tthis.apiGeometryNormal.uvsNeedUpdate,\n';
code3 += '\t\tthis.apiGeometryNormal.normalsNeedUpdate,\n';
code3 += '\t\tthis.apiGeometryNormal.colorsNeedUpdate,\n';
code3 += '\t\tthis.apiGeometryNormal.groupsNeedUpdate,\n';
code3 += '\t\tthis.apiGeometryNormal.lineDistancesNeedUpdate\n';
code3 += '\t)'; code3 += '\t)';
var code4 = 'if (R3.Utils.UndefinedOrNull(apiMaterial)) {\n'; var code4 = 'R3.D3.API.Material.call(\n';
code4 += '\t\tapiMaterial = {};\n';
code4 += '\t}\n';
code4 += '\tthis.apiMaterial = apiMaterial;\n';
code4 += '\n';
code4 += '\tR3.D3.API.Material.call(\n';
code4 += '\t\tthis,\n'; code4 += '\t\tthis,\n';
code4 += '\t\tthis.apiMaterial,\n'; code4 += '\t\tapiComponent\n';
code4 += '\t\tthis.apiMaterial.parentMeshes,\n';
code4 += '\t\tthis.apiMaterial.alphaTest,\n';
code4 += '\t\tthis.apiMaterial.blendDst,\n';
code4 += '\t\tthis.apiMaterial.blendDstAlpha,\n';
code4 += '\t\tthis.apiMaterial.blendEquation,\n';
code4 += '\t\tthis.apiMaterial.blendEquationAlpha,\n';
code4 += '\t\tthis.apiMaterial.blending,\n';
code4 += '\t\tthis.apiMaterial.blendSrc,\n';
code4 += '\t\tthis.apiMaterial.blendSrcAlpha,\n';
code4 += '\t\tthis.apiMaterial.clipIntersection,\n';
code4 += '\t\tthis.apiMaterial.clippingPlanes,\n';
code4 += '\t\tthis.apiMaterial.clipShadows,\n';
code4 += '\t\tthis.apiMaterial.colorWrite,\n';
code4 += '\t\tthis.apiMaterial.customDepthMaterial,\n';
code4 += '\t\tthis.apiMaterial.customDistanceMaterial,\n';
code4 += '\t\tthis.apiMaterial.defines,\n';
code4 += '\t\tthis.apiMaterial.depthFunc,\n';
code4 += '\t\tthis.apiMaterial.depthTest,\n';
code4 += '\t\tthis.apiMaterial.depthWrite,\n';
code4 += '\t\tthis.apiMaterial.fog,\n';
code4 += '\t\tthis.apiMaterial.lights,\n';
code4 += '\t\tthis.apiMaterial.opacity,\n';
code4 += '\t\tthis.apiMaterial.overdraw,\n';
code4 += '\t\tthis.apiMaterial.polygonOffset,\n';
code4 += '\t\tthis.apiMaterial.polygonOffsetFactor,\n';
code4 += '\t\tthis.apiMaterial.polygonOffsetUnits,\n';
code4 += '\t\tthis.apiMaterial.precision,\n';
code4 += '\t\tthis.apiMaterial.premultipliedAlpha,\n';
code4 += '\t\tthis.apiMaterial.dithering,\n';
code4 += '\t\tthis.apiMaterial.flatShading,\n';
code4 += '\t\tthis.apiMaterial.side,\n';
code4 += '\t\tthis.apiMaterial.transparent,\n';
code4 += '\t\tthis.apiMaterial.vertexColors,\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';
@ -144,6 +77,7 @@ code6 += '\tthis.apiComponent = apiComponent;\n';
code6 += '\n'; code6 += '\n';
code6 += '\tthis.graphics\t= null;\n'; code6 += '\tthis.graphics\t= null;\n';
code6 += '\tthis.physics\t= null;\n'; code6 += '\tthis.physics\t= null;\n';
code6 += '\tthis.coder\t\t= null;\n';
code6 += '\tthis.gui\t\t= null;\n'; code6 += '\tthis.gui\t\t= null;\n';
code6 += '\tthis.stats\t\t= null;\n'; code6 += '\tthis.stats\t\t= null;\n';
code6 += '\n'; code6 += '\n';
@ -152,23 +86,59 @@ code6 += '\t\tR3.Event.GET_RUNTIME,\n';
code6 += '\t\tfunction(runtime) {\n'; code6 += '\t\tfunction(runtime) {\n';
code6 += '\t\t\tthis.graphics\t= runtime.graphics;\n'; code6 += '\t\t\tthis.graphics\t= runtime.graphics;\n';
code6 += '\t\t\tthis.physics\t= runtime.physics;\n'; code6 += '\t\t\tthis.physics\t= runtime.physics;\n';
code6 += '\t\t\tthis.coder\t= runtime.coder;\n'; code6 += '\t\t\tthis.coder\t\t= runtime.coder;\n';
code6 += '\t\t\tthis.gui\t\t= runtime.gui;\n'; code6 += '\t\t\tthis.gui\t\t= runtime.gui;\n';
code6 += '\t\t\tthis.stats\t\t= runtime.stats;\n'; code6 += '\t\t\tthis.stats\t\t= runtime.stats;\n';
code6 += '\t\t}.bind(this)\n'; code6 += '\t\t}.bind(this)\n';
code6 += '\t)'; code6 += '\t);\n';
code6 += '\n';
code6 += '\tthis.initialize(apiComponent)';
var code7 = 'if (R3.Utils.UndefinedOrNull(apiComponent)) {\n';
code7 += '\t\tapiComponent = {};\n';
code7 += '\t}\n';
code7 += '\n';
code7 += '\tif (R3.Utils.UndefinedOrNull(apiComponent.register)) {\n';
code7 += '\t\tapiComponent.register = false;\n';
code7 += '\t}\n';
code7 += '\n';
code7 += '\tR3.Event.Emit(\n';
code7 += '\t\tR3.Event.GET_REGISTER_FACES,\n';
code7 += '\t\tnull,\n';
code7 += '\t\tfunction(register) {\n';
code7 += '\t\t\tif (register) {\n';
code7 += '\t\t\t\tapiComponent.register = true;\n';
code7 += '\t\t\t}\n';
code7 += '\t\t}\n';
code7 += '\t)';
var code8 = 'R3.Component.call(this)';
var code9 = 'R3.Component.prototype.createInstance.call(this)';
var code10 = 'R3.Component.prototype.updateInstance.call(this, property)';
var code11 = 'R3.D3.Geometry.Buffer.call(\n';
code11 += '\t\tthis,\n';
code11 += '\t\ttrue\n';
code11 += '\t);';
function build() { function build() {
return gulp.src('./src/r3-*.js') return gulp.src('./src/r3-*.js')
.pipe(sort()) .pipe(sort())
.pipe(concat('r3.js')) .pipe(concat('r3.js'))
.pipe(replace('__DATE__', new Date().toString())) .pipe(replace('__DATE__', new Date().toString()))
.pipe(replace('__API_COMPONENT_MACRO__', code)) .pipe(replace('__API_COMPONENT__', code))
.pipe(replace('__API_GEOMETRY_BUFFER_MACRO__', code2)) .pipe(replace('__API_GEOMETRY_BUFFER__', code2))
.pipe(replace('__API_GEOMETRY_NORMAL_MACRO__', code3)) .pipe(replace('__API_GEOMETRY_NORMAL__', code3))
.pipe(replace('__API_MATERIAL_MACRO__', code4)) .pipe(replace('__API_MATERIAL__', code4))
.pipe(replace('__API_TEXTURE_MACRO__', code5)) .pipe(replace('__API_TEXTURE__', code5))
.pipe(replace('__RUNTIME_COMPONENT_MACRO__', code6)) .pipe(replace('__RUNTIME_COMPONENT__', code6))
.pipe(replace('__DEREGISTER_COMPONENT__', code7))
.pipe(replace('__UPGRADE_TO_RUNTIME__', code8))
.pipe(replace('__CREATE_INSTANCE__', code9))
.pipe(replace('__UPDATE_INSTANCE__', code10))
.pipe(replace('__RUNTIME_BUFFER_COMPONENT__', code11))
.pipe(minify({ .pipe(minify({
ext:{ ext:{
src:'.js', src:'.js',

View File

@ -8,7 +8,7 @@
"dependencies": { "dependencies": {
"cannon": "^0.6.2", "cannon": "^0.6.2",
"gulp-cli": "^2.0.1", "gulp-cli": "^2.0.1",
"three": "*" "three": "^0.107.0"
}, },
"devDependencies": { "devDependencies": {
"gulp": "git://github.com/gulpjs/gulp.git#6d71a658c61edb3090221579d8f97dbe086ba2ed", "gulp": "git://github.com/gulpjs/gulp.git#6d71a658c61edb3090221579d8f97dbe086ba2ed",
@ -17,7 +17,7 @@
"gulp-minify": "*", "gulp-minify": "*",
"gulp-sort": "*", "gulp-sort": "*",
"gulp-string-replace": "*", "gulp-string-replace": "*",
"lodash": "^4.17.2", "lodash": "^4.17.15",
"npm": "^6.4.1" "npm": "^6.11.1"
} }
} }

152
src/build_component_lists.php Executable file
View File

@ -0,0 +1,152 @@
#!/usr/bin/php
<?php
$files = scandir('.', SCANDIR_SORT_DESCENDING);
$statement = "/**\
* R3.GetComponentType\
* @returns {number}\
* @constructor\
*/\n";
$statement .= "R3.GetComponentType = function(component) {\n\n";
$componentDefines = '';
$i = 1;
$apiComponents = [];
$components = [];
$componentTypes = [];
foreach ($files as $file) {
if (
!preg_match('/r3\-system/', $file) &&
!preg_match('/r3\-runtime/', $file) &&
!preg_match('/r3\-z\./', $file) &&
!preg_match('/^r3\-a\-.*/', $file) &&
!preg_match('/^\.$/', $file) &&
!preg_match('/^\.$/', $file) &&
preg_match('/.*\.js$/', $file)
) {
$file = str_replace('-', '.', $file);
$file = str_replace('api.y.', '', $file);
$file = str_replace('api.z.', '', $file);
$file = str_replace('api', 'API', $file);
$file = str_replace('gui', 'GUI', $file);
$file = str_replace('ssao', 'SSAO', $file);
$file = str_replace('fxaa', 'FXAA', $file);
$file = str_replace('.0.js', '', $file);
$file = str_replace('.js', '', $file);
$file = str_replace('.0.', '.', $file);
$file = str_replace('.y.', '.', $file);
$file = str_replace('.z.', '.', $file);
$fileParts = explode('.', $file);
$parts = [];
foreach ($fileParts as $filePart) {
array_push($parts, ucfirst($filePart));
}
$file = join('.', $parts);
$componentType = strtoupper($file);
$componentType = str_replace('R3.', '', $componentType);
$componentType = str_replace('API.', '', $componentType);
$componentType = str_replace('.', '_', $componentType);
$componentType = 'R3.COMPONENT_' . $componentType;
if (in_array($componentType, $componentTypes)) {
if (preg_match('/API/', $file)) {
$apiComponents[$componentType] = $file ;
} else {
$components[$componentType] = $file;
}
} else {
if (preg_match('/API/', $file)) {
$apiComponents[$componentType] = $file;
} else {
$components[$componentType] = $file;
}
array_push($componentTypes, $componentType);
$componentDefines .= $componentType . ' = 0x' . dechex($i) . ";\n";
$i++;
}
$statement .= "\tif (component instanceof " . $file . ") {\n";
$statement .= "\t\treturn " . $componentType . ";\n";
$statement .= "\t}\n\n";
}
}
$statement .= "};\n\n";
$componentDefines .= 'R3.MAX_COMPONENTS = 0x' . dechex($i) . ";\n\n";
$getComponentInfo = "R3.GetComponentInfo = function(componentType) {\n\n\tswitch (componentType) {\n\n";
foreach ($componentTypes as $componentType) {
// foreach ($components as $component) {
// if ()
// }
$files = array_keys($components);
$name = $components[$componentType];
$runtime = 'R3.Runtime.DEFAULT';
if (preg_match('/Render|Color|Controls|Curve|Image|Video|Camera|Composer|Effect|Graphics|Fog|Geometry|Light|Material|Mesh|Particle|Pass|Raycaster|Scene|Shader|Shadow|Skeleton|Text|Viewport|Object|Bone/', $name)) {
$runtime = 'R3.Runtime.GRAPHICS';
}
if (preg_match('/Code/', $name)) {
$runtime = 'R3.Runtime.CODER';
}
if (preg_match('/GUI/', $name)) {
$runtime = 'R3.Runtime.GUI';
}
if (preg_match('/Server|Socket/', $name)) {
$runtime = 'R3.Runtime.SOCKETS';
}
if (preg_match('/Friction|Physics|Vehicle|Wheel|Rigid|Shape|Solver|Broadphase/', $name)) {
$runtime = 'R3.Runtime.PHYSICS';
}
$getComponentInfo .= "\t\tcase " . $componentType . " : return {\n";
$getComponentInfo .= "\t\t\tname : '" . $name . "',\n";
$getComponentInfo .= "\t\t\tconstructor : " . $name . ",\n";
$getComponentInfo .= "\t\t\tapiConstructor : " . $apiComponents[$componentType] . ",\n";
$getComponentInfo .= "\t\t\truntime: " . $runtime . "\n";
$getComponentInfo .= "\t\t};\n";
}
$getComponentInfo .= "\t\tdefault : \n";
$getComponentInfo .= "\t\t\tthrow new Error('Invalid component type: ' + componentType);\n\n";
$getComponentInfo .= "\t}\n";
$getComponentInfo .= "};\n";
echo $componentDefines;
echo $statement;
echo $getComponentInfo;
file_put_contents('r3-a-1-component-info.js', $componentDefines . $statement . $getComponentInfo);
?>

View File

@ -1,3 +1,5 @@
console.log("Loading R3 compiled at: __DATE__");
/** /**
* R3 Namespace * R3 Namespace
*/ */
@ -35,7 +37,3 @@ if (typeof R3.D3.Runtime === 'undefined') {
R3.D3.Runtime = function(){}; R3.D3.Runtime = function(){};
} }
/**
* This gets injected by gulp
*/
console.log("Loading R3 compiled at: __DATE__");

2840
src/r3-a-1-component-info.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -15,131 +15,132 @@ R3.Event.OnceSubscriptions = {};
/** /**
* Events we can subscribe to and emit * Events we can subscribe to and emit
*/ */
R3.Event.WINDOW_RESIZE = 0x1; R3.Event.WINDOW_RESIZE = 0x1;
R3.Event.PARENT_SCENE_CHANGE = 0x2; R3.Event.PARENT_SCENE_CHANGE = 0x2;
R3.Event.EXCLUDE_FROM_ENVIRONMENT = 0x3; R3.Event.EXCLUDE_FROM_ENVIRONMENT = 0x3;
R3.Event.INSTANCE_CLONED = 0x4; R3.Event.INSTANCE_CLONED = 0x4;
R3.Event.LOAD_IMAGE = 0x5; R3.Event.LOAD_IMAGE = 0x5;
R3.Event.NEW_ENTITY = 0x6; R3.Event.NEW_ENTITY = 0x6;
R3.Event.MATERIAL_TYPE_CHANGED = 0x7; R3.Event.MATERIAL_TYPE_CHANGED = 0x7;
R3.Event.SAVE_COMPONENT = 0x8; R3.Event.SAVE_COMPONENT = 0x8;
R3.Event.SAVE_COMPONENT_ERROR = 0x9; R3.Event.SAVE_COMPONENT_ERROR = 0x9;
R3.Event.COMPONENT_SAVED = 0xa; R3.Event.COMPONENT_SAVED = 0xa;
R3.Event.LOAD_COMPONENT = 0xb; R3.Event.LOAD_COMPONENT = 0xb;
R3.Event.LOAD_COMPONENT_ERROR = 0xc; R3.Event.LOAD_COMPONENT_ERROR = 0xc;
R3.Event.LOGGED_IN = 0xd; R3.Event.LOGGED_IN = 0xd;
R3.Event.COMPONENT_CREATED = 0xe; R3.Event.COMPONENT_CREATED = 0xe;
R3.Event.COMPONENT_CLONED = 0xf; R3.Event.COMPONENT_CLONED = 0xf;
R3.Event.TEXTURE_ANIMATED_CHANGE = 0x10; R3.Event.TEXTURE_ANIMATED_CHANGE = 0x10;
R3.Event.ANIMATE_TEXTURE_INSTANCE = 0x11; R3.Event.ANIMATE_TEXTURE_INSTANCE = 0x11;
R3.Event.REMOVE_PARTICLE_ENGINE = 0x12; R3.Event.REMOVE_PARTICLE_ENGINE = 0x12;
R3.Event.GAME_PAUSE = 0x13; R3.Event.GAME_PAUSE = 0x13;
R3.Event.SHADER_UPDATE = 0x14; R3.Event.SHADER_UPDATE = 0x14;
R3.Event.PLAY_AUDIO = 0x15; R3.Event.PLAY_AUDIO = 0x15;
R3.Event.MATERIAL_INSTANCE_UPDATED = 0x16; R3.Event.MATERIAL_INSTANCE_UPDATED = 0x16;
R3.Event.PAUSE_AUDIO = 0x17; R3.Event.PAUSE_AUDIO = 0x17;
R3.Event.MESH_INSTANCE_UPDATED = 0x18; R3.Event.MESH_INSTANCE_UPDATED = 0x18;
R3.Event.STOP_AUDIO = 0x19; R3.Event.STOP_AUDIO = 0x19;
R3.Event.LIGHT_INSTANCE_UPDATED = 0x1a; R3.Event.LIGHT_INSTANCE_UPDATED = 0x1a;
R3.Event.DELETE_COMPONENT = 0x1b; R3.Event.DELETE_COMPONENT = 0x1b;
R3.Event.COMPONENT_DOWNLOAD_COMPLETE = 0x1c; R3.Event.COMPONENT_DOWNLOAD_COMPLETE = 0x1c;
R3.Event.COMPONENTS_LINKED = 0x1d; R3.Event.COMPONENTS_LINKED = 0x1d;
R3.Event.UNRESOLVED_DEPENDENCIES_UPDATE = 0x1e; R3.Event.UNRESOLVED_DEPENDENCIES_UPDATE = 0x1e;
R3.Event.REGISTER_UPDATE = 0x1f; R3.Event.REGISTER_UPDATE = 0x1f;
R3.Event.BUILD_GUI = 0x20; R3.Event.BUILD_GUI = 0x20;
R3.Event.REMOVE_MESH = 0x21; R3.Event.REMOVE_MESH = 0x21;
R3.Event.MESH_SELECTED = 0x22; R3.Event.MESH_SELECTED = 0x22;
R3.Event.MESH_DESELECTED = 0x23; R3.Event.MESH_DESELECTED = 0x23;
R3.Event.COMPONENT_REGISTER = 0x24; R3.Event.COMPONENT_REGISTER = 0x24;
R3.Event.IMAGE_NOT_FOUND = 0x25; R3.Event.IMAGE_NOT_FOUND = 0x25;
R3.Event.BLENDER_DATA_RECEIVED = 0x26; R3.Event.BLENDER_DATA_RECEIVED = 0x26;
R3.Event.IMAGE_UPLOAD_COMPLETE = 0x27; R3.Event.IMAGE_UPLOAD_COMPLETE = 0x27;
R3.Event.REMOVE_COMPONENT = 0x28; R3.Event.REMOVE_COMPONENT = 0x28;
R3.Event.KEY_DOWN = 0x29; R3.Event.KEY_DOWN = 0x29;
R3.Event.KEY_UP = 0x2a; R3.Event.KEY_UP = 0x2a;
R3.Event.RENDER = 0x2b; R3.Event.RENDER = 0x2b;
R3.Event.EVENT_LIST = 0x2c; R3.Event.EVENT_LIST = 0x2c;
R3.Event.COMPILE_SUCCESS = 0x2d; R3.Event.COMPILE_SUCCESS = 0x2d;
R3.Event.COMPILE_FAILED = 0x2e; R3.Event.COMPILE_FAILED = 0x2e;
R3.Event.TEXTURE_INSTANCE_UPDATED = 0x2f; R3.Event.TEXTURE_INSTANCE_UPDATED = 0x2f;
R3.Event.EVENT_ID_UPDATE = 0x30; R3.Event.EVENT_ID_UPDATE = 0x30;
R3.Event.MATERIAL_TEXTURES_UPDATED = 0x31; R3.Event.MATERIAL_TEXTURES_UPDATED = 0x31;
R3.Event.DELETE_COMPONENT_ERROR = 0x32; R3.Event.DELETE_COMPONENT_ERROR = 0x32;
R3.Event.COMPONENT_DELETED = 0x33; R3.Event.COMPONENT_DELETED = 0x33;
R3.Event.COMPONENT_TYPES_FETCHED = 0x34; R3.Event.COMPONENT_TYPES_FETCHED = 0x34;
R3.Event.AUDIO_ENDED = 0x35; R3.Event.AUDIO_ENDED = 0x35;
R3.Event.COMPONENT_LINKED = 0x36; R3.Event.COMPONENT_LINKED = 0x36;
R3.Event.DONE_SAVING = 0x37; R3.Event.DONE_SAVING = 0x37;
R3.Event.BEFORE_RENDER = 0x38; R3.Event.BEFORE_RENDER = 0x38;
R3.Event.AFTER_RENDER = 0x39; R3.Event.AFTER_RENDER = 0x39;
R3.Event.ARRAY_ITEM_ADDED = 0x3a; R3.Event.ARRAY_ITEM_ADDED = 0x3a;
R3.Event.INSTANCE_CREATED = 0x3b; R3.Event.INSTANCE_CREATED = 0x3b;
R3.Event.VISUALIZE = 0x3c; R3.Event.VISUALIZE = 0x3c;
R3.Event.STOP_VISUALIZE = 0x3d; R3.Event.STOP_VISUALIZE = 0x3d;
R3.Event.FETCH_COMPONENT_TYPES = 0x3e; R3.Event.FETCH_COMPONENT_TYPES = 0x3e;
R3.Event.FETCH_COMPONENTS = 0x3f; R3.Event.FETCH_COMPONENTS = 0x3f;
R3.Event.GET_API_URL = 0x40; R3.Event.GET_API_URL = 0x40;
R3.Event.GET_RUNTIME = 0x41; R3.Event.GET_RUNTIME = 0x41;
R3.Event.PARENT_WORLD_CHANGE = 0x42; R3.Event.PARENT_WORLD_CHANGE = 0x42;
R3.Event.ANIMATE = 0x43; R3.Event.ANIMATE = 0x43;
R3.Event.ANIMATION_COMPILE_SUCCESS = 0x44; R3.Event.ANIMATION_COMPILE_SUCCESS = 0x44;
R3.Event.ANIMATION_COMPILE_FAILED = 0x45; R3.Event.ANIMATION_COMPILE_FAILED = 0x45;
R3.Event.SAVING = 0x46; R3.Event.SAVING = 0x46;
R3.Event.GAME_OVER = 0x47; R3.Event.GAME_OVER = 0x47;
R3.Event.GAME_START = 0x48; R3.Event.GAME_START = 0x48;
R3.Event.TOUCH_START = 0x49; R3.Event.TOUCH_START = 0x49;
R3.Event.TOUCH_END = 0x4a; R3.Event.TOUCH_END = 0x4a;
R3.Event.TOUCH_MOVE = 0x4b; R3.Event.TOUCH_MOVE = 0x4b;
R3.Event.TOUCH_CANCEL = 0x4c; R3.Event.TOUCH_CANCEL = 0x4c;
R3.Event.GET_REMOTE_API_URL = 0x4d; R3.Event.GET_REMOTE_API_URL = 0x4d;
R3.Event.COMPONENT_TYPES_UPDATE = 0x4e; R3.Event.COMPONENT_TYPES_UPDATE = 0x4e;
R3.Event.PROJECT_LOADED = 0x4f; R3.Event.PROJECT_LOADED = 0x4f;
R3.Event.CAST_SOURCE_CHANGED = 0x50; R3.Event.CAST_SOURCE_CHANGED = 0x50;
R3.Event.RESOLVE_DEPENDENCIES = 0x51; R3.Event.RESOLVE_DEPENDENCIES = 0x51;
R3.Event.NAME_UPDATE = 0x52; R3.Event.NAME_UPDATE = 0x52;
R3.Event.CANVAS_CHANGE = 0x53; R3.Event.CANVAS_CHANGE = 0x53;
R3.Event.AFTER_WINDOW_RESIZE = 0x54; R3.Event.AFTER_WINDOW_RESIZE = 0x54;
R3.Event.LOAD_FONT = 0x55; R3.Event.LOAD_FONT = 0x55;
R3.Event.FONT_NOT_FOUND = 0x56; R3.Event.FONT_NOT_FOUND = 0x56;
R3.Event.STOP_ALL_AUDIO = 0x57; R3.Event.STOP_ALL_AUDIO = 0x57;
R3.Event.REGISTER_DEPENDENCIES = 0x58; R3.Event.REGISTER_DEPENDENCIES = 0x58;
R3.Event.GAME_LOADED = 0x59; R3.Event.GAME_LOADED = 0x59;
R3.Event.COMPONENT_UPDATE = 0x5a; R3.Event.COMPONENT_UPDATE = 0x5a;
R3.Event.LOAD_PROGRESS = 0x5b; R3.Event.LOAD_PROGRESS = 0x5b;
R3.Event.ENTITY_LOADED = 0x5c; R3.Event.ENTITY_LOADED = 0x5c;
R3.Event.MOUSE_DOWN = 0x5d; R3.Event.MOUSE_DOWN = 0x5d;
R3.Event.MOUSE_MOVE = 0x5e; R3.Event.MOUSE_MOVE = 0x5e;
R3.Event.MOUSE_WHEEL = 0x5f; R3.Event.MOUSE_WHEEL = 0x5f;
R3.Event.MOUSE_UP = 0x60; R3.Event.MOUSE_UP = 0x60;
R3.Event.PARTICLE_INSTANCE_UPDATED = 0x61; R3.Event.PARTICLE_INSTANCE_UPDATED = 0x61;
R3.Event.GAME_DATA = 0x62; R3.Event.GAME_DATA = 0x62;
R3.Event.PAUSE_ALL_AUDIO = 0x63; R3.Event.PAUSE_ALL_AUDIO = 0x63;
R3.Event.CONTINUE_ALL_AUDIO = 0x64; R3.Event.CONTINUE_ALL_AUDIO = 0x64;
R3.Event.MUTE_AUDIO = 0x65; R3.Event.MUTE_AUDIO = 0x65;
R3.Event.GAME_STARTED = 0x66; R3.Event.GAME_STARTED = 0x66;
R3.Event.GAME_PAUSED = 0x67; R3.Event.GAME_PAUSED = 0x67;
R3.Event.GAME_RESUMED = 0x68; R3.Event.GAME_RESUMED = 0x68;
R3.Event.CUSTOM_GAME_START = 0x69; R3.Event.CUSTOM_GAME_START = 0x69;
R3.Event.AUDIO_MUTED = 0x6a; R3.Event.AUDIO_MUTED = 0x6a;
R3.Event.AUDIO_UNMUTED = 0x6b; R3.Event.AUDIO_UNMUTED = 0x6b;
R3.Event.RECEIVE_DESTINATION_CHANGED = 0x6c; R3.Event.RECEIVE_DESTINATION_CHANGED = 0x6c;
R3.Event.SELECTION_MODE_CHANGE = 0x6d; R3.Event.SELECTION_MODE_CHANGE = 0x6d;
R3.Event.MESH_FACE_SELECTED = 0x6e; R3.Event.MESH_FACE_SELECTED = 0x6e;
R3.Event.MESH_FACE_DESELECTED = 0x6f; R3.Event.MESH_FACE_DESELECTED = 0x6f;
R3.Event.BEFORE_WINDOW_RESIZE = 0x70; R3.Event.BEFORE_WINDOW_RESIZE = 0x70;
R3.Event.GET_WINDOW_SIZE = 0x71; R3.Event.GET_WINDOW_SIZE = 0x71;
R3.Event.GET_RENDER_CONFIGURATION = 0x72; R3.Event.GET_QUERY_API_URL = 0x72;
R3.Event.SET_ACTIVE_RENDER_CONFIGURATION = 0x73; //R3.Event.SET_ACTIVE_RENDER_CONFIGURATION = 0x73;
R3.Event.REPLACE_COMPONENT = 0x74; R3.Event.REPLACE_COMPONENT = 0x74;
R3.Event.COMPONENT_REPLACED = 0x75; R3.Event.COMPONENT_REPLACED = 0x75;
R3.Event.ENGINE_FIRED_PARTICLES_ZERO = 0x76; R3.Event.ENGINE_FIRED_PARTICLES_ZERO = 0x76;
R3.Event.GET_DEFAULT_SCENE = 0x77; R3.Event.GET_DEFAULT_SCENE = 0x77;
R3.Event.GET_DEFAULT_CAMERA = 0x78; R3.Event.GET_DEFAULT_CAMERA = 0x78;
R3.Event.GET_WEBSOCKET_CONFIG = 0x79; R3.Event.GET_WEBSOCKET_CONFIG = 0x79;
R3.Event.GET_PROJECT = 0x7a; R3.Event.GET_PROJECT = 0x7a;
R3.Event.GET_APPLICATION_MODE = 0x80; R3.Event.GET_APPLICATION_MODE = 0x80;
R3.Event.RENDERER_SIZE_CHANGE = 0x81; R3.Event.RENDERER_SIZE_CHANGE = 0x81;
R3.Event.GET_REGISTER_FACES = 0x82; R3.Event.GET_REGISTER_FACES = 0x82;
R3.Event.GET_PROJECT_CANVAS = 0x83;
/** /**
* Returns string name of event ID * Returns string name of event ID
@ -275,6 +276,7 @@ R3.Event.GetEventName = function(number) {
case 0x80 : return 'get_application_mode'; case 0x80 : return 'get_application_mode';
case 0x81 : return 'renderer_size_change'; case 0x81 : return 'renderer_size_change';
case 0x82 : return 'get_register_faces'; case 0x82 : return 'get_register_faces';
case 0x83 : return 'get_project_canvas';
break; break;
} }

View File

@ -25,7 +25,7 @@ R3.API.Component = function(
} }
this.id = id; this.id = id;
this.componentType = this.getComponentType(); this.componentType = R3.GetComponentType(this);
if (R3.Utils.UndefinedOrNull(name)) { if (R3.Utils.UndefinedOrNull(name)) {
name = R3.Component.GetComponentFriendlyName(this.componentType) + ' (' + this.id + ')'; name = R3.Component.GetComponentFriendlyName(this.componentType) + ' (' + this.id + ')';
@ -64,442 +64,3 @@ R3.API.Component.prototype.getFirstParent = function(constructor) {
R3.API.Component.getParent = function(property, index, constructor) { R3.API.Component.getParent = function(property, index, constructor) {
return R3.D3.GetParent(this, property, index, constructor); return R3.D3.GetParent(this, property, index, constructor);
}; };
R3.API.Component.prototype.getComponentType = function() {
if (this instanceof R3.API.Box3) {
return R3.Component.BOX3;
}
if (this instanceof R3.API.Canvas) {
return R3.Component.CANVAS;
}
if (this instanceof R3.API.Clock) {
return R3.Component.CLOCK;
}
if (this instanceof R3.API.Controls.D3.Editor) {
return R3.Component.CONTROLS_EDITOR;
}
if (this instanceof R3.API.Controls.D3.FirstPerson) {
return R3.Component.CONTROLS_FIRST_PERSON;
}
if (this instanceof R3.API.Controls.D3.Orbit) {
return R3.Component.CONTROLS_ORBIT;
}
if (this instanceof R3.API.Controls.Keyboard) {
return R3.Component.CONTROLS_KEYBOARD;
}
if (this instanceof R3.API.Controls.Mouse) {
return R3.Component.CONTROLS_MOUSE;
}
if (this instanceof R3.API.Controls.Touch) {
return R3.Component.CONTROLS_TOUCH;
}
if (this instanceof R3.API.Curve.Path.D2.Shape) {
return R3.Component.CURVE_PATH_D2_SHAPE;
}
if (this instanceof R3.API.Curve.Path.D2) {
return R3.Component.CURVE_PATH_D2;
}
if (this instanceof R3.API.Curve.Path) {
return R3.Component.CURVE_PATH;
}
if (this instanceof R3.API.Curve) {
return R3.Component.CURVE;
}
if (this instanceof R3.API.CustomCode) {
return R3.Component.CUSTOM_CODE;
}
if (this instanceof R3.API.DomElement) {
return R3.Component.DOM_ELEMENT;
}
if (this instanceof R3.API.DrawRange) {
return R3.Component.DRAW_RANGE;
}
if (this instanceof R3.API.Entity) {
return R3.Component.ENTITY;
}
if (this instanceof R3.API.EntityManager) {
return R3.Component.ENTITY_MANAGER;
}
if (this instanceof R3.API.Group) {
return R3.Component.GROUP;
}
if (this instanceof R3.API.GUI) {
return R3.Component.GUI;
}
if (this instanceof R3.API.Image) {
return R3.Component.IMAGE;
}
if (this instanceof R3.API.Mouse) {
return R3.Component.MOUSE;
}
if (this instanceof R3.API.Plane) {
return R3.Component.PLANE;
}
if (this instanceof R3.API.Project) {
return R3.Component.PROJECT;
}
if (this instanceof R3.API.Renderer.D3.Canvas.Target) {
return R3.Component.RENDERER_D3_CANVAS_TARGET;
}
if (this instanceof R3.API.Renderer.D3.Canvas) {
return R3.Component.RENDERER_D3_CANVAS;
}
if (this instanceof R3.API.Renderer.D3.Target) {
return R3.Component.RENDERER_D3_TARGET;
}
if (this instanceof R3.API.Renderer.D3) {
return R3.Component.RENDERER_D3;
}
if (this instanceof R3.API.Renderer.D2) {
return R3.Component.RENDERER_D2;
}
if (this instanceof R3.API.Server) {
return R3.Component.SERVER;
}
if (this instanceof R3.API.Socket.Receive) {
return R3.Component.SOCKET_RECEIVE;
}
if (this instanceof R3.API.Socket.Cast) {
return R3.Component.SOCKET_CAST;
}
if (this instanceof R3.API.Sphere) {
return R3.Component.SPHERE;
}
if (this instanceof R3.API.Stats) {
return R3.Component.STATS;
}
if (this instanceof R3.API.User) {
return R3.Component.USER;
}
if (this instanceof R3.API.Video) {
return R3.Component.VIDEO;
}
if (this instanceof R3.D3.API.Animation) {
return R3.Component.ANIMATION;
}
if (this instanceof R3.D3.API.Object) {
return R3.Component.OBJECT;
}
if (this instanceof R3.D3.API.Audio) {
return R3.Component.AUDIO;
}
if (this instanceof R3.D3.API.Bone) {
return R3.Component.BONE;
}
if (this instanceof R3.D3.API.Broadphase) {
return R3.Component.BROADPHASE;
}
if (this instanceof R3.D3.API.Camera.Perspective.Stereo) {
return R3.Component.CAMERA_PERSPECTIVE_STEREO;
}
if (this instanceof R3.D3.API.Camera.Perspective) {
return R3.Component.CAMERA_PERSPECTIVE;
}
if (this instanceof R3.D3.API.Camera.Orthographic) {
return R3.Component.CAMERA_ORTHOGRAPHIC;
}
if (this instanceof R3.D3.API.Camera.Cube) {
return R3.Component.CAMERA_CUBE;
}
if (this instanceof R3.D3.API.Composer) {
return R3.Component.COMPOSER;
}
if (this instanceof R3.D3.API.Effect.Stereo) {
return R3.Component.EFFECT_STEREO;
}
if (this instanceof R3.D3.API.Effect.Parallax) {
return R3.Component.EFFECT_PARALLAX;
}
if (this instanceof R3.D3.API.Effect.Anaglyph) {
return R3.Component.EFFECT_ANAGLYPH;
}
if (this instanceof R3.D3.API.Face) {
return R3.Component.FACE;
}
if (this instanceof R3.D3.API.Fog) {
return R3.Component.FOG;
}
if (this instanceof R3.D3.API.Font) {
return R3.Component.FONT;
}
if (this instanceof R3.D3.API.FrictionContactMaterial) {
return R3.Component.FRICTION_CONTACT_MATERIAL;
}
if (this instanceof R3.D3.API.FrictionMaterial) {
return R3.Component.FRICTION_MATERIAL;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Box) {
return R3.Component.GEOMETRY_BUFFER_BOX;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Circle) {
return R3.Component.GEOMETRY_BUFFER_CIRCLE;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Cone) {
return R3.Component.GEOMETRY_BUFFER_CONE;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Cylinder) {
return R3.Component.GEOMETRY_BUFFER_CYLINDER;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Dodecahedron) {
return R3.Component.GEOMETRY_BUFFER_DODECAHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Extrude) {
return R3.Component.GEOMETRY_BUFFER_EXTRUDE;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Icosahedron) {
return R3.Component.GEOMETRY_BUFFER_ICOSAHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Instanced) {
return R3.Component.GEOMETRY_BUFFER_INSTANCED;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Lathe) {
return R3.Component.GEOMETRY_BUFFER_LATHE;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Octahedron) {
return R3.Component.GEOMETRY_BUFFER_OCTAHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Parametric) {
return R3.Component.GEOMETRY_BUFFER_PARAMETRIC;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Plane) {
return R3.Component.GEOMETRY_BUFFER_PLANE;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Polyhedron) {
return R3.Component.GEOMETRY_BUFFER_POLYHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Ring) {
return R3.Component.GEOMETRY_BUFFER_RING;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Shape) {
return R3.Component.GEOMETRY_BUFFER_SHAPE;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Sphere) {
return R3.Component.GEOMETRY_BUFFER_SPHERE;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Tetrahedron) {
return R3.Component.GEOMETRY_BUFFER_TETRAHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Text) {
return R3.Component.GEOMETRY_BUFFER_TEXT;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Torus) {
return R3.Component.GEOMETRY_BUFFER_TORUS;
}
if (this instanceof R3.D3.API.Geometry.Buffer.TorusKnot) {
return R3.Component.GEOMETRY_BUFFER_TORUS_KNOT;
}
if (this instanceof R3.D3.API.Geometry.Buffer.Tube) {
return R3.Component.GEOMETRY_BUFFER_TUBE;
}
if (this instanceof R3.D3.API.Geometry.Buffer) {
return R3.Component.GEOMETRY_BUFFER;
}
if (this instanceof R3.D3.API.Geometry.Normal.Box) {
return R3.Component.GEOMETRY_NORMAL_BOX;
}
if (this instanceof R3.D3.API.Geometry.Normal.Circle) {
return R3.Component.GEOMETRY_NORMAL_CIRCLE;
}
if (this instanceof R3.D3.API.Geometry.Normal.Cone) {
return R3.Component.GEOMETRY_NORMAL_CONE;
}
if (this instanceof R3.D3.API.Geometry.Normal.Cylinder) {
return R3.Component.GEOMETRY_NORMAL_CYLINDER;
}
if (this instanceof R3.D3.API.Geometry.Normal.Dodecahedron) {
return R3.Component.GEOMETRY_NORMAL_DODECAHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Normal.Edges) {
return R3.Component.GEOMETRY_NORMAL_EDGES;
}
if (this instanceof R3.D3.API.Geometry.Normal.Extrude) {
return R3.Component.GEOMETRY_NORMAL_EXTRUDE;
}
if (this instanceof R3.D3.API.Geometry.Normal.Icosahedron) {
return R3.Component.GEOMETRY_NORMAL_ICOSAHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Normal.Lathe) {
return R3.Component.GEOMETRY_NORMAL_LATHE;
}
if (this instanceof R3.D3.API.Geometry.Normal.Octahedron) {
return R3.Component.GEOMETRY_NORMAL_OCTAHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Normal.Parametric) {
return R3.Component.GEOMETRY_NORMAL_PARAMETRIC;
}
if (this instanceof R3.D3.API.Geometry.Normal.Plane) {
return R3.Component.GEOMETRY_NORMAL_PLANE;
}
if (this instanceof R3.D3.API.Geometry.Normal.Polyhedron) {
return R3.Component.GEOMETRY_NORMAL_POLYHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Normal.Ring) {
return R3.Component.GEOMETRY_NORMAL_RING;
}
if (this instanceof R3.D3.API.Geometry.Normal.Shape) {
return R3.Component.GEOMETRY_NORMAL_SHAPE;
}
if (this instanceof R3.D3.API.Geometry.Normal.Sphere) {
return R3.Component.GEOMETRY_NORMAL_SPHERE;
}
if (this instanceof R3.D3.API.Geometry.Normal.Tetrahedron) {
return R3.Component.GEOMETRY_NORMAL_TETRAHEDRON;
}
if (this instanceof R3.D3.API.Geometry.Normal.Text) {
return R3.Component.GEOMETRY_NORMAL_TEXT;
}
if (this instanceof R3.D3.API.Geometry.Normal.Torus) {
return R3.Component.GEOMETRY_NORMAL_TORUS;
}
if (this instanceof R3.D3.API.Geometry.Normal.TorusKnot) {
return R3.Component.GEOMETRY_NORMAL_TORUS_KNOT;
}
if (this instanceof R3.D3.API.Geometry.Normal.Tube) {
return R3.Component.GEOMETRY_NORMAL_TUBE;
}
if (this instanceof R3.D3.API.Geometry.Normal.Wireframe) {
return R3.Component.GEOMETRY_NORMAL_WIREFRAME;
}
if (this instanceof R3.D3.API.Geometry.Normal) {
return R3.Component.GEOMETRY_NORMAL;
}
if (this instanceof R3.D3.API.Geometry) {
return R3.Component.GEOMETRY;
}
if (this instanceof R3.D3.API.Light.Ambient) {
return R3.Component.LIGHT_AMBIENT;
}
if (this instanceof R3.D3.API.Light.Directional) {
return R3.Component.LIGHT_DIRECTIONAL;
}
if (this instanceof R3.D3.API.Light.Hemisphere) {
return R3.Component.LIGHT_HEMISPHERE;
}
if (this instanceof R3.D3.API.Light.Point) {
return R3.Component.LIGHT_POINT;
}
if (this instanceof R3.D3.API.Light.RectArea) {
return R3.Component.LIGHT_RECT_AREA;
}
if (this instanceof R3.D3.API.Light.Spot) {
return R3.Component.LIGHT_SPOT;
}
if (this instanceof R3.D3.API.Material.Basic) {
return R3.Component.MATERIAL_BASIC;
}
if (this instanceof R3.D3.API.Material.Phong) {
return R3.Component.MATERIAL_PHONG;
}
if (this instanceof R3.D3.API.Material.Points) {
return R3.Component.MATERIAL_POINTS;
}
if (this instanceof R3.D3.API.Material.Shader) {
return R3.Component.MATERIAL_SHADER;
}
if (this instanceof R3.D3.API.Material.Shader.Raw) {
return R3.Component.MATERIAL_SHADER_RAW;
}
if (this instanceof R3.D3.API.Material.Standard) {
return R3.Component.MATERIAL_STANDARD;
}
if (this instanceof R3.D3.API.Mesh) {
return R3.Component.MESH;
}
if (this instanceof R3.D3.API.Particle.Engine) {
return R3.Component.PARTICLE_ENGINE;
}
if (this instanceof R3.D3.API.Particle) {
return R3.Component.PARTICLE;
}
if (this instanceof R3.D3.API.Pass.Bloom) {
return R3.Component.PASS_BLOOM;
}
if (this instanceof R3.D3.API.Pass.FXAA) {
return R3.Component.PASS_FXAA;
}
if (this instanceof R3.D3.API.Pass.Render) {
return R3.Component.PASS_RENDER;
}
if (this instanceof R3.D3.API.Pass.SSAO) {
return R3.Component.PASS_SSAO;
}
if (this instanceof R3.D3.API.PhysicsWorld) {
return R3.Component.PHYSICS_WORLD;
}
if (this instanceof R3.D3.API.Raycaster) {
return R3.Component.RAYCASTER;
}
if (this instanceof R3.D3.API.RaycastVehicle) {
return R3.Component.RAYCAST_VEHICLE;
}
if (this instanceof R3.D3.API.RaycastWheel) {
return R3.Component.RAYCAST_WHEEL;
}
if (this instanceof R3.D3.API.RenderTarget.Cube) {
return R3.Component.RENDER_TARGET_CUBE;
}
if (this instanceof R3.D3.API.RenderTarget) {
return R3.Component.RENDER_TARGET;
}
if (this instanceof R3.D3.API.RigidBody) {
return R3.Component.RIGID_BODY;
}
if (this instanceof R3.D3.API.Scene) {
return R3.Component.SCENE;
}
if (this instanceof R3.D3.API.Shader.Vertex) {
return R3.Component.SHADER_VERTEX;
}
if (this instanceof R3.D3.API.Shader.Fragment) {
return R3.Component.SHADER_FRAGMENT;
}
if (this instanceof R3.D3.API.Shader) {
return R3.Component.SHADER;
}
if (this instanceof R3.D3.API.Shadow.Directional) {
return R3.Component.SHADOW_DIRECTIONAL;
}
if (this instanceof R3.D3.API.Shadow.Spot) {
return R3.Component.SHADOW_SPOT;
}
if (this instanceof R3.D3.API.Shadow) {
return R3.Component.SHADOW;
}
if (this instanceof R3.D3.API.Shape) {
return R3.Component.SHAPE;
}
if (this instanceof R3.D3.API.Skeleton) {
return R3.Component.SKELETON;
}
if (this instanceof R3.D3.API.Solver) {
return R3.Component.SOLVER;
}
if (this instanceof R3.D3.API.Spline) {
return R3.Component.SPLINE;
}
if (this instanceof R3.D3.API.Text) {
return R3.Component.TEXT;
}
if (this instanceof R3.D3.API.Texture.Canvas) {
return R3.Component.TEXTURE_CANVAS;
}
if (this instanceof R3.D3.API.Texture.Cube) {
return R3.Component.TEXTURE_CUBE;
}
if (this instanceof R3.D3.API.Texture.Image) {
return R3.Component.TEXTURE_IMAGE;
}
if (this instanceof R3.D3.API.Texture) {
return R3.Component.TEXTURE;
}
if (this instanceof R3.D3.API.Viewport.FixedAspect) {
return R3.Component.VIEWPORT_FIXED_ASPECT;
}
if (this instanceof R3.D3.API.Viewport.ZoomedAspect) {
return R3.Component.VIEWPORT_ZOOMED_ASPECT;
}
if (this instanceof R3.D3.API.Viewport) {
return R3.Component.VIEWPORT;
}
};

View File

@ -124,6 +124,23 @@ R3.Utils.StripImageExtension = function(imagePath) {
return imagePath.replace(/(\.png$|\.gif$|\.jpeg$|\.jpg$)/,'') return imagePath.replace(/(\.png$|\.gif$|\.jpeg$|\.jpg$)/,'')
}; };
/**
* Returns true if unloaded
* @param component
* @returns {boolean}
* @constructor
*/
R3.Utils.Unloaded = function(component) {
if (
R3.Utils.UndefinedOrNull(component) ||
R3.Utils.UndefinedOrNull(component.instance)
) {
return true;
}
return false;
};
R3.Utils.BuildVectorSource = function(result, name, dimension) { R3.Utils.BuildVectorSource = function(result, name, dimension) {
if (dimension === 2) { if (dimension === 2) {

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,38 @@
/** /**
* R3.API.Box3 * R3.API.Box3
* @param apiComponent * @param apiComponent
* @param min
* @param max
* @constructor * @constructor
*/ */
R3.API.Box3 = function( R3.API.Box3 = function(
apiComponent, apiComponent
min,
max
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(min)) { if (R3.Utils.UndefinedOrNull(apiComponent.min)) {
min = new R3.API.Vector3(); apiComponent.min = new R3.API.Vector3(
{
parent : this,
register : true
},
0,
0,
0
);
} }
this.min = min; this.min = apiComponent.min;
if (R3.Utils.UndefinedOrNull(max)) { if (R3.Utils.UndefinedOrNull(apiComponent.max)) {
max = new R3.API.Vector3(1,1,1); apiComponent.max = new R3.API.Vector3(
{
parent : this,
register : true
},
1,
1,
1
);
} }
this.max = max; this.max = apiComponent.max;
}; };
R3.API.Box3.prototype = Object.create(R3.API.Component.prototype); R3.API.Box3.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,62 +1,55 @@
/** /**
* R3.API.Canvas * R3.API.Canvas
* @param apiComponent * @param apiComponent
* @param autoUpdateSize
* @param width
* @param height
* @param offset
* @param tabIndex
* @param texts
* @param textBaseline
* @constructor * @constructor
*/ */
R3.API.Canvas = function( R3.API.Canvas = function(
apiComponent, apiComponent
autoUpdateSize,
width,
height,
offset,
tabIndex,
texts,
textBaseline
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) { if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
autoUpdateSize = true; apiComponent.autoUpdateSize = true;
} }
this.autoUpdateSize = autoUpdateSize; this.autoUpdateSize = apiComponent.autoUpdateSize;
if (R3.Utils.UndefinedOrNull(width)) { if (R3.Utils.UndefinedOrNull(apiComponent.width)) {
width = 512; apiComponent.width = 512;
} }
this.width = width; this.width = apiComponent.width;
if (R3.Utils.UndefinedOrNull(height)) { if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
height = 512; apiComponent.height = 512;
} }
this.height = height; this.height = apiComponent.height;
if (R3.Utils.UndefinedOrNull(offset)) { if (R3.Utils.UndefinedOrNull(apiComponent.offset)) {
offset = new R3.API.Vector2(0,0); apiComponent.offset = new R3.API.Vector2(
{
parent : this,
register : true
},
0,
0
);
} }
this.offset = offset; this.offset = apiComponent.offset;
if (R3.Utils.UndefinedOrNull(tabIndex)) { if (R3.Utils.UndefinedOrNull(apiComponent.tabIndex)) {
tabIndex = 1; apiComponent.tabIndex = 1;
} }
this.tabIndex = tabIndex; this.tabIndex = apiComponent.tabIndex;
if (R3.Utils.UndefinedOrNull(texts)) { if (R3.Utils.UndefinedOrNull(apiComponent.texts)) {
texts = []; apiComponent.texts = [];
} }
this.texts = texts; this.texts = apiComponent.texts;
if (R3.Utils.UndefinedOrNull(textBaseline)) { if (R3.Utils.UndefinedOrNull(apiComponent.textBaseline)) {
textBaseline = 'middle'; apiComponent.textBaseline = 'middle';
} }
this.textBaseline = textBaseline; this.textBaseline = apiComponent.textBaseline;
}; };

View File

@ -7,7 +7,7 @@ R3.API.Clock = function(
apiComponent apiComponent
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
}; };

View File

@ -1,37 +1,35 @@
/** /**
* API Color * API Color
* @param parent * @param apiComponent
* @param r
* @param g
* @param b
* @param a
* @constructor * @constructor
*/ */
R3.API.Color = function( R3.API.Color = function(
r, apiComponent
g,
b,
a
) { ) {
if (R3.Utils.UndefinedOrNull(r)) { __API_COMPONENT__;
r = 1;
}
this.r = r;
if (R3.Utils.UndefinedOrNull(g)) { if (R3.Utils.UndefinedOrNull(apiComponent.r)) {
g = 1; apiComponent.r = 1;
} }
this.g = g; this.r = apiComponent.r;
if (R3.Utils.UndefinedOrNull(b)) { if (R3.Utils.UndefinedOrNull(apiComponent.g)) {
b = 1; apiComponent.g = 1;
} }
this.b = b; this.g = apiComponent.g;
if (R3.Utils.UndefinedOrNull(a)) { if (R3.Utils.UndefinedOrNull(apiComponent.b)) {
a = 0; apiComponent.b = 1;
} }
this.a = a; this.b = apiComponent.b;
if (R3.Utils.UndefinedOrNull(apiComponent.a)) {
apiComponent.a = 0;
}
this.a = apiComponent.a;
}; };
R3.API.Color.prototype = Object.create(R3.API.Component.prototype);
R3.API.Color.prototype.constructor = R3.API.Color;

View File

@ -9,16 +9,20 @@ R3.API.Controls = function(
canvas canvas
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(canvas)) { if (R3.Utils.UndefinedOrNull(apiComponent.canvas)) {
/** R3.Event.Emit(
* Try to attach the controls to the parent canvas R3.Event.GET_PROJECT_CANVAS,
* @type {null} {
*/ controls : this
canvas = this.getFirstParent(R3.API.Canvas); },
function(projectCanvas) {
apiComponent.canvas = projectCanvas;
}
)
} }
this.canvas = canvas; this.canvas = apiComponent.canvas;
}; };
R3.API.Controls.prototype = Object.create(R3.API.Component.prototype); R3.API.Controls.prototype = Object.create(R3.API.Component.prototype);

View File

@ -3,25 +3,20 @@
* @constructor * @constructor
*/ */
R3.API.Controls.D3 = function( R3.API.Controls.D3 = function(
apiControls, apiComponent
camera
) { ) {
if (R3.Utils.UndefinedOrNull(apiControls)) {
apiControls = {};
}
R3.API.Controls.call( R3.API.Controls.call(
this, this,
apiControls, apiComponent
apiControls.canvas
); );
if (R3.Utils.UndefinedOrNull(camera)) { if (R3.Utils.UndefinedOrNull(apiComponent.camera)) {
var project = this.getFirstParent(R3.API.Project); var project = this.getFirstParent(R3.API.Project);
camera = project.cameras[R3.API.Project.CAMERA_INDEX_EDIT]; apiComponent.camera = project.cameras[R3.API.Project.CAMERA_INDEX_EDIT];
} }
this.camera = camera; this.camera = apiComponent.camera;
}; };
R3.API.Controls.D3.prototype = Object.create(R3.API.Controls.prototype); R3.API.Controls.D3.prototype = Object.create(R3.API.Controls.prototype);

View File

@ -1,27 +1,25 @@
/** /**
* @param apiControlsD3 * R3.API.Controls.D3.Editor
* @param raycaster * @param apiComponent
* @constructor * @constructor
*/ */
R3.API.Controls.D3.Editor = function( R3.API.Controls.D3.Editor = function(
apiControlsD3, apiComponent
raycaster
) { ) {
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
apiControlsD3 = {};
}
R3.API.Controls.D3.call( R3.API.Controls.D3.call(
this, this,
apiControlsD3, apiComponent
apiControlsD3.camera
); );
if (R3.Utils.UndefinedOrNull(raycaster)) { if (R3.Utils.UndefinedOrNull(apiComponent.raycaster)) {
raycaster = new R3.D3.API.Raycaster(); apiComponent.raycaster = new R3.D3.API.Raycaster(
{
parent : this
}
);
} }
this.raycaster = raycaster; this.raycaster = apiComponent.raycaster;
}; };

View File

@ -1,121 +0,0 @@
/**
* R3.API.Controls.D3.FirstPerson
* @param apiControlsD3
* @param enabled
* @param movementSpeed
* @param lookSpeed
* @param lookVertical
* @param autoForward
* @param activeLook
* @param heightSpeed
* @param heightCoef
* @param heightMin
* @param heightMax
* @param constrainVertical
* @param verticalMin
* @param verticalMax
* @param autoSpeedFactor
* @constructor
*/
R3.API.Controls.D3.FirstPerson = function(
apiControlsD3,
enabled,
movementSpeed,
lookSpeed,
lookVertical,
autoForward,
activeLook,
heightSpeed,
heightCoef,
heightMin,
heightMax,
constrainVertical,
verticalMin,
verticalMax,
autoSpeedFactor
) {
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
apiControlsD3 = {};
}
R3.API.Controls.D3.call(
this,
apiControlsD3,
apiControlsD3.camera
);
if (R3.Utils.UndefinedOrNull(enabled)) {
enabled = true;
}
this.enabled = enabled;
if (R3.Utils.UndefinedOrNull(movementSpeed)) {
movementSpeed = 1.0;
}
this.movementSpeed = movementSpeed;
if (R3.Utils.UndefinedOrNull(lookSpeed)) {
lookSpeed = 0.005;
}
this.lookSpeed = lookSpeed;
if (R3.Utils.UndefinedOrNull(lookVertical)) {
lookVertical = true;
}
this.lookVertical = lookVertical;
if (R3.Utils.UndefinedOrNull(autoForward)) {
autoForward = false;
}
this.autoForward = autoForward;
if (R3.Utils.UndefinedOrNull(activeLook)) {
activeLook = false;
}
this.activeLook = activeLook;
if (R3.Utils.UndefinedOrNull(heightSpeed)) {
heightSpeed = false;
}
this.heightSpeed = heightSpeed;
if (R3.Utils.UndefinedOrNull(heightCoef)) {
heightCoef = 1.0;
}
this.heightCoef = heightCoef;
if (R3.Utils.UndefinedOrNull(heightMin)) {
heightMin = 0.0;
}
this.heightMin = heightMin;
if (R3.Utils.UndefinedOrNull(heightMax)) {
heightMax = 1.0;
}
this.heightMax = heightMax;
if (R3.Utils.UndefinedOrNull(constrainVertical)) {
constrainVertical = false;
}
this.constrainVertical = constrainVertical;
if (R3.Utils.UndefinedOrNull(verticalMin)) {
verticalMin = 0;
}
this.verticalMin = verticalMin;
if (R3.Utils.UndefinedOrNull(verticalMax)) {
verticalMax = Math.PI;
}
this.verticalMax = verticalMax;
if (R3.Utils.UndefinedOrNull(autoSpeedFactor)) {
autoSpeedFactor = 0;
}
this.autoSpeedFactor = autoSpeedFactor;
};
R3.API.Controls.D3.FirstPerson.prototype = Object.create(R3.API.Controls.D3.prototype);
R3.API.Controls.D3.FirstPerson.prototype.constructor = R3.API.Controls.D3.FirstPerson;

View File

@ -0,0 +1,88 @@
/**
* R3.API.Controls.D3.FirstPerson
* @param apiComponent
* @constructor
*/
R3.API.Controls.D3.FirstPerson = function(
apiComponent
) {
R3.API.Controls.D3.call(
this,
apiComponent
);
if (R3.Utils.UndefinedOrNull(apiComponent.enabled)) {
apiComponent.enabled = true;
}
this.enabled = apiComponent.enabled;
if (R3.Utils.UndefinedOrNull(apiComponent.movementSpeed)) {
apiComponent.movementSpeed = 1.0;
}
this.movementSpeed = apiComponent.movementSpeed;
if (R3.Utils.UndefinedOrNull(apiComponent.lookSpeed)) {
apiComponent.lookSpeed = 0.005;
}
this.lookSpeed = apiComponent.lookSpeed;
if (R3.Utils.UndefinedOrNull(apiComponent.lookVertical)) {
apiComponent.lookVertical = true;
}
this.lookVertical = apiComponent.lookVertical;
if (R3.Utils.UndefinedOrNull(apiComponent.autoForward)) {
apiComponent.autoForward = false;
}
this.autoForward = apiComponent.autoForward;
if (R3.Utils.UndefinedOrNull(apiComponent.activeLook)) {
apiComponent.activeLook = false;
}
this.activeLook = apiComponent.activeLook;
if (R3.Utils.UndefinedOrNull(apiComponent.heightSpeed)) {
apiComponent.heightSpeed = false;
}
this.heightSpeed = apiComponent.heightSpeed;
if (R3.Utils.UndefinedOrNull(apiComponent.heightCoef)) {
apiComponent.heightCoef = 1.0;
}
this.heightCoef = apiComponent.heightCoef;
if (R3.Utils.UndefinedOrNull(apiComponent.heightMin)) {
apiComponent.heightMin = 0.0;
}
this.heightMin = apiComponent.heightMin;
if (R3.Utils.UndefinedOrNull(apiComponent.heightMax)) {
apiComponent.heightMax = 1.0;
}
this.heightMax = apiComponent.heightMax;
if (R3.Utils.UndefinedOrNull(apiComponent.constrainVertical)) {
apiComponent.constrainVertical = false;
}
this.constrainVertical = apiComponent.constrainVertical;
if (R3.Utils.UndefinedOrNull(apiComponent.verticalMin)) {
apiComponent.verticalMin = 0;
}
this.verticalMin = apiComponent.verticalMin;
if (R3.Utils.UndefinedOrNull(apiComponent.verticalMax)) {
apiComponent.verticalMax = Math.PI;
}
this.verticalMax = apiComponent.verticalMax;
if (R3.Utils.UndefinedOrNull(apiComponent.autoSpeedFactor)) {
apiComponent.autoSpeedFactor = 0;
}
this.autoSpeedFactor = apiComponent.autoSpeedFactor;
};
R3.API.Controls.D3.FirstPerson.prototype = Object.create(R3.API.Controls.D3.prototype);
R3.API.Controls.D3.FirstPerson.prototype.constructor = R3.API.Controls.D3.FirstPerson;

View File

@ -1,126 +1,91 @@
/** /**
* R3.API.Controls.D3.Orbit * R3.API.Controls.D3.Orbit
* @param apiControlsD3 * @param apiComponent
* @param target
* @param enabled
* @param minPolarAngle
* @param maxPolarAngle
* @param enableDamping
* @param dampingFactor
* @param enableZoom
* @param zoomSpeed
* @param enableRotate
* @param rotateSpeed
* @param enablePan
* @param keyPanSpeed
* @param autoRotate
* @param autoRotateSpeed
* @param enableKeys
* @constructor * @constructor
*/ */
R3.API.Controls.D3.Orbit = function( R3.API.Controls.D3.Orbit = function(
apiControlsD3, apiComponent
target,
enabled,
minPolarAngle,
maxPolarAngle,
enableDamping,
dampingFactor,
enableZoom,
zoomSpeed,
enableRotate,
rotateSpeed,
enablePan,
keyPanSpeed,
autoRotate,
autoRotateSpeed,
enableKeys
) { ) {
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
apiControlsD3 = {};
}
R3.API.Controls.D3.call( R3.API.Controls.D3.call(
this, this,
apiControlsD3, apiComponent
apiControlsD3.camera
); );
if (R3.Utils.UndefinedOrNull(target)) { if (R3.Utils.UndefinedOrNull(apiComponent.target)) {
target = null; apiComponent.target = null;
} }
this.target = target; this.target = apiComponent.target;
if (R3.Utils.UndefinedOrNull(enabled)) { if (R3.Utils.UndefinedOrNull(apiComponent.enabled)) {
enabled = true; apiComponent.enabled = true;
} }
this.enabled = enabled; this.enabled = apiComponent.enabled;
if (R3.Utils.UndefinedOrNull(minPolarAngle)) { if (R3.Utils.UndefinedOrNull(apiComponent.minPolarAngle)) {
minPolarAngle = 0; apiComponent.minPolarAngle = 0;
} }
this.minPolarAngle = minPolarAngle; this.minPolarAngle = apiComponent.minPolarAngle;
if (R3.Utils.UndefinedOrNull(maxPolarAngle)) { if (R3.Utils.UndefinedOrNull(apiComponent.maxPolarAngle)) {
maxPolarAngle = Math.PI; apiComponent.maxPolarAngle = Math.PI;
} }
this.maxPolarAngle = maxPolarAngle; this.maxPolarAngle = apiComponent.maxPolarAngle;
if (R3.Utils.UndefinedOrNull(enableDamping)) { if (R3.Utils.UndefinedOrNull(apiComponent.enableDamping)) {
enableDamping = false; apiComponent.enableDamping = false;
} }
this.enableDamping = enableDamping; this.enableDamping = apiComponent.enableDamping;
if (R3.Utils.UndefinedOrNull(dampingFactor)) { if (R3.Utils.UndefinedOrNull(apiComponent.dampingFactor)) {
dampingFactor = 0.25; apiComponent.dampingFactor = 0.25;
} }
this.dampingFactor = dampingFactor; this.dampingFactor = apiComponent.dampingFactor;
if (R3.Utils.UndefinedOrNull(enableZoom)) { if (R3.Utils.UndefinedOrNull(apiComponent.enableZoom)) {
enableZoom = true; apiComponent.enableZoom = true;
} }
this.enableZoom = enableZoom; this.enableZoom = apiComponent.enableZoom;
if (R3.Utils.UndefinedOrNull(zoomSpeed)) { if (R3.Utils.UndefinedOrNull(apiComponent.zoomSpeed)) {
zoomSpeed = 1.0; apiComponent.zoomSpeed = 1.0;
} }
this.zoomSpeed = zoomSpeed; this.zoomSpeed = apiComponent.zoomSpeed;
if (R3.Utils.UndefinedOrNull(enableRotate)) { if (R3.Utils.UndefinedOrNull(apiComponent.enableRotate)) {
enableRotate = true; apiComponent.enableRotate = true;
} }
this.enableRotate = enableRotate; this.enableRotate = apiComponent.enableRotate;
if (R3.Utils.UndefinedOrNull(rotateSpeed)) { if (R3.Utils.UndefinedOrNull(apiComponent.rotateSpeed)) {
rotateSpeed = 1.0; apiComponent.rotateSpeed = 1.0;
} }
this.rotateSpeed = rotateSpeed; this.rotateSpeed = apiComponent.rotateSpeed;
if (R3.Utils.UndefinedOrNull(enablePan)) { if (R3.Utils.UndefinedOrNull(apiComponent.enablePan)) {
enablePan = true; apiComponent.enablePan = true;
} }
this.enablePan = enablePan; this.enablePan = apiComponent.enablePan;
if (R3.Utils.UndefinedOrNull(keyPanSpeed)) { if (R3.Utils.UndefinedOrNull(apiComponent.keyPanSpeed)) {
keyPanSpeed = 7.0; apiComponent.keyPanSpeed = 7.0;
} }
this.keyPanSpeed = keyPanSpeed; this.keyPanSpeed = apiComponent.keyPanSpeed;
if (R3.Utils.UndefinedOrNull(autoRotate)) { if (R3.Utils.UndefinedOrNull(apiComponent.autoRotate)) {
autoRotate = false; apiComponent.autoRotate = false;
} }
this.autoRotate = autoRotate; this.autoRotate = apiComponent.autoRotate;
if (R3.Utils.UndefinedOrNull(autoRotateSpeed)) { if (R3.Utils.UndefinedOrNull(apiComponent.autoRotateSpeed)) {
autoRotateSpeed = 2.0; apiComponent.autoRotateSpeed = 2.0;
} }
this.autoRotateSpeed = autoRotateSpeed; this.autoRotateSpeed = apiComponent.autoRotateSpeed;
if (R3.Utils.UndefinedOrNull(enableKeys)) { if (R3.Utils.UndefinedOrNull(apiComponent.enableKeys)) {
enableKeys = false; apiComponent.enableKeys = false;
} }
this.enableKeys = enableKeys; this.enableKeys = apiComponent.enableKeys;
}; };

View File

@ -1,14 +1,14 @@
/** /**
* @param apiControls * R3.API.Controls.Keyboard
* @param apiComponent
* @constructor * @constructor
*/ */
R3.API.Controls.Keyboard = function( R3.API.Controls.Keyboard = function(
apiControls apiComponent
) { ) {
R3.API.Controls.call( R3.API.Controls.call(
this, this,
apiControls, apiComponent
apiControls.canvas
); );
}; };

View File

@ -1,14 +1,14 @@
/** /**
* @param apiControls * R3.API.Controls.Mouse
* @param apiComponent
* @constructor * @constructor
*/ */
R3.API.Controls.Mouse = function( R3.API.Controls.Mouse = function(
apiControls apiComponent
) { ) {
R3.API.Controls.call( R3.API.Controls.call(
this, this,
apiControls, apiComponent
apiControls.canvas
); );
}; };

View File

@ -14,10 +14,10 @@ R3.API.Controls.Touch = function(
apiControls.canvas apiControls.canvas
); );
if (R3.Utils.UndefinedOrNull(sensitivity)) { if (R3.Utils.UndefinedOrNull(apiComponent.sensitivity)) {
sensitivity = 5; apiComponent.sensitivity = 5;
} }
this.sensitivity = sensitivity; this.sensitivity = apiComponent.sensitivity;
}; };

View File

@ -1,20 +1,19 @@
/** /**
* R3.API.Curve * R3.API.Curve
* @param apiComponent * @param apiComponent
* @param arcLenghDivisions
* @constructor * @constructor
*/ */
R3.API.Curve = function( R3.API.Curve = function(
apiComponent, apiComponent
arcLenghDivisions
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(arcLenghDivisions)) { if (R3.Utils.UndefinedOrNull(apiComponent.arcLenghDivisions)) {
arcLenghDivisions = 200; apiComponent.arcLenghDivisions = 200;
} }
this.arcLenghDivisions = arcLenghDivisions; this.arcLenghDivisions = apiComponent.arcLenghDivisions;
}; };
R3.API.Curve.prototype = Object.create(R3.API.Curve.prototype); R3.API.Curve.prototype = Object.create(R3.API.Curve.prototype);

View File

@ -10,10 +10,10 @@ R3.API.Curve.Path = function(
curves, curves,
autoClose autoClose
) { ) {
if (R3.Utils.UndefinedOrNull(apiCurve)) { if (R3.Utils.UndefinedOrNull(apiComponent.apiCurve)) {
apiCurve = {} apiComponent.apiCurve = {}
} }
this.apiCurve = apiCurve; this.apiCurve = apiComponent.apiCurve;
R3.API.Curve.call( R3.API.Curve.call(
this, this,
@ -21,15 +21,15 @@ R3.API.Curve.Path = function(
apiCurve.arcLenghDivisions apiCurve.arcLenghDivisions
); );
if (R3.Utils.UndefinedOrNull(curves)) { if (R3.Utils.UndefinedOrNull(apiComponent.curves)) {
curves = []; apiComponent.curves = [];
} }
this.curves = curves; this.curves = apiComponent.curves;
if (R3.Utils.UndefinedOrNull(autoClose)) { if (R3.Utils.UndefinedOrNull(apiComponent.autoClose)) {
autoClose = false; apiComponent.autoClose = false;
} }
this.autoClose = autoClose; this.autoClose = apiComponent.autoClose;
}; };
R3.API.Curve.Path.prototype = Object.create(R3.API.Curve.prototype); R3.API.Curve.Path.prototype = Object.create(R3.API.Curve.prototype);

View File

@ -9,10 +9,10 @@ R3.API.Curve.Path.D2 = function(
points points
) { ) {
if (R3.Utils.UndefinedOrNull(apiCurvePath)) { if (R3.Utils.UndefinedOrNull(apiComponent.apiCurvePath)) {
apiCurvePath = {} apiComponent.apiCurvePath = {}
} }
this.apiCurvePath = apiCurvePath; this.apiCurvePath = apiComponent.apiCurvePath;
R3.API.Curve.Path.call( R3.API.Curve.Path.call(
this, this,
@ -21,10 +21,10 @@ R3.API.Curve.Path.D2 = function(
apiCurvePath.autoClose apiCurvePath.autoClose
); );
if (R3.Utils.UndefinedOrNull(points)) { if (R3.Utils.UndefinedOrNull(apiComponent.points)) {
points = []; apiComponent.points = [];
} }
this.points = points; this.points = apiComponent.points;
}; };

View File

@ -6,8 +6,8 @@
R3.API.Curve.Path.D2.Shape = function( R3.API.Curve.Path.D2.Shape = function(
apiCurvePathD2 apiCurvePathD2
) { ) {
if (R3.Utils.UndefinedOrNull(apiCurvePathD2)) { if (R3.Utils.UndefinedOrNull(apiComponent.apiCurvePathD2)) {
apiCurvePathD2 = {}; apiComponent.apiCurvePathD2 = {};
} }
R3.API.Curve.Path.call( R3.API.Curve.Path.call(

View File

@ -1,28 +0,0 @@
/**
* Custom Code Component
* @param apiComponent
* @param eventId
* @param code
* @constructor
*/
R3.API.CustomCode = function(
apiComponent,
eventId,
code
) {
__API_COMPONENT_MACRO__;
if (R3.Utils.UndefinedOrNull(eventId)) {
eventId = R3.Event.KEY_UP;
}
this.eventId = eventId;
if (R3.Utils.UndefinedOrNull(code)) {
code = "return null;\n//@ sourceURL=" + this.name + ".js";
}
this.code = code;
};
R3.API.CustomCode.prototype = Object.create(R3.API.Component.prototype);
R3.API.CustomCode.prototype.constructor = R3.API.CustomCode;

24
src/r3-api-customCode.js Normal file
View File

@ -0,0 +1,24 @@
/**
* R3.API.CustomCode
* @param apiComponent
* @constructor
*/
R3.API.CustomCode = function(
apiComponent
) {
__API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(apiComponent.eventId)) {
apiComponent.eventId = R3.Event.KEY_UP;
}
this.eventId = apiComponent.eventId;
if (R3.Utils.UndefinedOrNull(apiComponent.code)) {
apiComponent.code = "return null;\n//@ sourceURL=" + this.name + ".js";
}
this.code = apiComponent.code;
};
R3.API.CustomCode.prototype = Object.create(R3.API.Component.prototype);
R3.API.CustomCode.prototype.constructor = R3.API.CustomCode;

View File

@ -1,20 +1,18 @@
/** /**
* API DomElement * API DomElement
* @param apiComponent * @param apiComponent
* @param domElementId
* @constructor * @constructor
*/ */
R3.API.DomElement = function( R3.API.DomElement = function(
apiComponent, apiComponent
domElementId
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(domElementId)) { if (R3.Utils.UndefinedOrNull(apiComponent.domElementId)) {
domElementId = ''; apiComponent.domElementId = '';
} }
this.domElementId = domElementId; this.domElementId = apiComponent.domElementId;
}; };
R3.API.DomElement.prototype = Object.create(R3.API.Component.prototype); R3.API.DomElement.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,29 +0,0 @@
/**
* R3.API.Box3
* @constructor
* @param apiComponent
* @param start
* @param count
*/
R3.API.DrawRange = function(
apiComponent,
start,
count
) {
__API_COMPONENT_MACRO__;
if (R3.Utils.UndefinedOrNull(start)) {
start = 0;
}
this.start = start;
if (R3.Utils.UndefinedOrNull(count)) {
count = Infinity;
}
this.count = count;
};
R3.API.DrawRange.prototype = Object.create(R3.API.Component.prototype);
R3.API.DrawRange.prototype.constructor = R3.API.DrawRange;

25
src/r3-api-drawRange.js Normal file
View File

@ -0,0 +1,25 @@
/**
* R3.API.DrawRange
* @param apiComponent
* @constructor
*/
R3.API.DrawRange = function(
apiComponent
) {
__API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(apiComponent.start)) {
apiComponent.start = 0;
}
this.start = apiComponent.start;
if (R3.Utils.UndefinedOrNull(apiComponent.count)) {
apiComponent.count = Infinity;
}
this.count = apiComponent.count;
};
R3.API.DrawRange.prototype = Object.create(R3.API.Component.prototype);
R3.API.DrawRange.prototype.constructor = R3.API.DrawRange;

View File

@ -1,21 +0,0 @@
/**
* Entity API Object (for storing / loading entities to and from API)
* @constructor
* @param apiComponent
* @param entities R3.API.Entity[]
*/
R3.API.EntityManager = function(
apiComponent,
entities
) {
__API_COMPONENT_MACRO__;
if (R3.Utils.UndefinedOrNull(entities)) {
entities = [];
}
this.entities = entities;
};
R3.API.EntityManager.prototype = Object.create(R3.API.Component.prototype);
R3.API.EntityManager.prototype.constructor = R3.API.EntityManager;

View File

@ -1,20 +1,18 @@
/** /**
* Entity API Object (for storing / loading entities to and from API) * R3.API.Entity
* @param apiComponent * @param apiComponent
* @param components R3.API.Component[]
* @constructor * @constructor
*/ */
R3.API.Entity = function( R3.API.Entity = function(
apiComponent, apiComponent
components
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(components)) { if (R3.Utils.UndefinedOrNull(apiComponent.components)) {
components = []; apiComponent.components = [];
} }
this.components = components; this.components = apiComponent.components;
}; };

View File

@ -0,0 +1,19 @@
/**
* R3.API.EntityManager
* @param apiComponent
* @constructor
*/
R3.API.EntityManager = function(
apiComponent
) {
__API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(apiComponent.entities)) {
apiComponent.entities = [];
}
this.entities = apiComponent.entities;
};
R3.API.EntityManager.prototype = Object.create(R3.API.Component.prototype);
R3.API.EntityManager.prototype.constructor = R3.API.EntityManager;

View File

@ -1,20 +1,18 @@
/** /**
* R3.D3.API.Font * R3.API.Font
* @param apiComponent * @param apiComponent
* @param path - Relative to API URL
* @constructor * @constructor
*/ */
R3.API.Font = function( R3.API.Font = function(
apiComponent, apiComponent
path
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(path)) { if (R3.Utils.UndefinedOrNull(apiComponent.path)) {
path = ''; apiComponent.path = '';
} }
this.path = path; this.path = apiComponent.path;
}; };

23
src/r3-api-graph-0.js Normal file
View File

@ -0,0 +1,23 @@
/**
* R3.API.Graph
* @param apiComponent
*
* @property domElement
*
* @constructor
*/
R3.API.Graph = function(
apiComponent
) {
__API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(apiComponent.domElement)) {
apiComponent.domElement = null;
}
this.domElement = apiComponent.domElement;
};
R3.API.Graph.prototype = Object.create(R3.API.Component.prototype);
R3.API.Graph.prototype.constructor = R3.API.Graph;

View File

@ -0,0 +1,18 @@
/**
* R3.API.Graph.Barchart
* @param apiComponent
* @constructor
*/
R3.API.Graph.Barchart = function(
apiComponent
) {
R3.API.Graph.call(
this,
apiComponent
);
};
R3.API.Graph.Barchart.prototype = Object.create(R3.API.Graph.prototype);
R3.API.Graph.Barchart.prototype.constructor = R3.API.Graph.Barchart;

View File

@ -0,0 +1,18 @@
/**
* R3.API.Graph.Barchart
* @param apiComponent
* @constructor
*/
R3.API.Graph.Barchart.Stacked = function(
apiComponent
) {
R3.API.Graph.Barchart.call(
this,
apiComponent
);
};
R3.API.Graph.Barchart.prototype = Object.create(R3.API.Graph.Barchart.prototype);
R3.API.Graph.Barchart.prototype.constructor = R3.API.Graph.Barchart;

View File

@ -0,0 +1,18 @@
/**
* R3.API.Graph.Metric
* @param apiComponent
* @constructor
*/
R3.API.Graph.Metric = function(
apiComponent
) {
R3.API.Graph.call(
this,
apiComponent
);
};
R3.API.Graph.Metric.prototype = Object.create(R3.API.Graph.prototype);
R3.API.Graph.Metric.prototype.constructor = R3.API.Graph.Metric;

18
src/r3-api-graph-table.js Normal file
View File

@ -0,0 +1,18 @@
/**
* R3.API.Graph.Table
* @param apiComponent
* @constructor
*/
R3.API.Graph.Table = function(
apiComponent
) {
R3.API.Graph.call(
this,
apiComponent
);
};
R3.API.Graph.Table.prototype = Object.create(R3.API.Graph.prototype);
R3.API.Graph.Table.prototype.constructor = R3.API.Graph.Table;

View File

@ -1,34 +1,28 @@
/** /**
* R3.API.Group * R3.API.Group
* @constructor
* @param apiComponent * @param apiComponent
* @param start * @constructor
* @param count
* @param materialIndex
*/ */
R3.API.Group = function( R3.API.Group = function(
apiComponent, apiComponent
start,
count,
materialIndex
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(start)) { if (R3.Utils.UndefinedOrNull(apiComponent.start)) {
start = 0; apiComponent.start = 0;
} }
this.start = start; this.start = apiComponent.start;
if (R3.Utils.UndefinedOrNull(count)) { if (R3.Utils.UndefinedOrNull(apiComponent.count)) {
count = 0; apiComponent.count = 0;
} }
this.count = count; this.count = apiComponent.count;
if (R3.Utils.UndefinedOrNull(materialIndex)) { if (R3.Utils.UndefinedOrNull(apiComponent.materialIndex)) {
materialIndex = 0; apiComponent.materialIndex = 0;
} }
this.materialIndex = materialIndex; this.materialIndex = apiComponent.materialIndex;
}; };
R3.API.Group.prototype = Object.create(R3.API.Component.prototype); R3.API.Group.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,20 +1,18 @@
/** /**
* Raw GUI API object - should always correspond with the GUI Schema * Raw GUI API object - should always correspond with the GUI Schema
* @param apiComponent * @param apiComponent
* @param domElement
* @constructor * @constructor
*/ */
R3.API.GUI = function( R3.API.GUI = function(
apiComponent, apiComponent
domElement
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(domElement)) { if (R3.Utils.UndefinedOrNull(apiComponent.domElement)) {
domElement = null; apiComponent.domElement = null;
} }
this.domElement = domElement; this.domElement = apiComponent.domElement;
}; };
R3.API.GUI.prototype = Object.create(R3.API.Component.prototype); R3.API.GUI.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,75 +1,61 @@
/** /**
* R3.API.Image * R3.API.Image
* @param apiComponent * @param apiComponent
* @param fileName
* @param extension
* @param path
* @param contentType
* @param size
* @param width
* @param height
* @constructor * @constructor
*/ */
R3.API.Image = function( R3.API.Image = function(
apiComponent, apiComponent
fileName,
extension,
path,
contentType,
size,
width,
height
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(fileName)) { if (R3.Utils.UndefinedOrNull(apiComponent.fileName)) {
fileName = R3.Utils.LowerUnderscore(name); apiComponent.fileName = R3.Utils.LowerUnderscore(name);
} }
this.fileName = fileName; this.fileName = apiComponent.fileName;
if (R3.Utils.UndefinedOrNull(extension)) { if (R3.Utils.UndefinedOrNull(apiComponent.extension)) {
extension = '.unknown'; apiComponent.extension = '.unknown';
} }
this.extension = extension; this.extension = apiComponent.extension;
if (R3.Utils.UndefinedOrNull(path)) { if (R3.Utils.UndefinedOrNull(apiComponent.path)) {
path = '/'; apiComponent.path = '/';
} }
this.path = path; this.path = apiComponent.path;
if (R3.Utils.UndefinedOrNull(contentType)) { if (R3.Utils.UndefinedOrNull(apiComponent.contentType)) {
contentType = 'application/octet-stream'; apiComponent.contentType = 'application/octet-stream';
if (this.extension.match(/(png)$/i)) { if (this.extension.match(/(png)$/i)) {
contentType = 'image/png'; apiComponent.contentType = 'image/png';
} }
if (this.extension.match(/(jpg|jpeg)$/i)) { if (this.extension.match(/(jpg|jpeg)$/i)) {
contentType = 'image/jpeg'; apiComponent.contentType = 'image/jpeg';
} }
if (this.extension.match(/(gif)$/i)) { if (this.extension.match(/(gif)$/i)) {
contentType = 'image/gif'; apiComponent.contentType = 'image/gif';
} }
} }
this.contentType = contentType; this.contentType = apiComponent.contentType;
if (R3.Utils.UndefinedOrNull(size)) { if (R3.Utils.UndefinedOrNull(apiComponent.size)) {
size = 0; apiComponent.size = 0;
} }
this.size = size; this.size = apiComponent.size;
if (R3.Utils.UndefinedOrNull(width)) { if (R3.Utils.UndefinedOrNull(apiComponent.width)) {
width = 0; apiComponent.width = 0;
} }
this.width = width; this.width = apiComponent.width;
if (R3.Utils.UndefinedOrNull(height)) { if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
height = 0; apiComponent.height = 0;
} }
this.height = height; this.height = apiComponent.height;
}; };

View File

@ -1,89 +1,165 @@
/** /**
* Api Matrix 4 * R3.API.Matrix4
* @param row0 R3.API.Vector4 * @param apiComponent
* @param row1 R3.API.Vector4 *
* @param row2 R3.API.Vector4 * @property rows [R3.API.Vector4]
* @param row3 R3.API.Vector4 *
* @constructor * @constructor
*/ */
R3.API.Matrix4 = function ApiMatrix4( R3.API.Matrix4 = function (
row0, apiComponent
row1,
row2,
row3
) { ) {
this.rows = []; __DEREGISTER_COMPONENT__;
if (R3.Utils.UndefinedOrNull(row0)) { __API_COMPONENT__;
row0 = new R3.API.Vector4(1, 0, 0, 0);
if (R3.Utils.UndefinedOrNull(apiComponent.rows)) {
apiComponent.rows = [];
apiComponent.rows.push(
new R3.API.Vector4(
{
parent : this,
register : this.register,
x : 1,
y : 0,
z : 0,
w : 0
}
)
);
apiComponent.rows.push(
new R3.API.Vector4(
{
parent : this,
register : this.register,
x : 0,
y : 1,
z : 0,
w : 0
}
)
);
apiComponent.rows.push(
new R3.API.Vector4(
{
parent : this,
register : this.register,
x : 0,
y : 0,
z : 1,
w : 0
}
)
);
apiComponent.rows.push(
new R3.API.Vector4(
{
parent : this,
register : this.register,
x : 0,
y : 0,
z : 0,
w : 1
}
)
);
} }
this.rows[0] = row0; this.rows = apiComponent.rows;
if (R3.Utils.UndefinedOrNull(row1)) {
row1 = new R3.API.Vector4(0, 1, 0, 0);
}
this.rows[1] = row1;
if (R3.Utils.UndefinedOrNull(row2)) {
row2 = new R3.API.Vector4(0, 0, 1, 0);
}
this.rows[2] = row2;
if (R3.Utils.UndefinedOrNull(row3)) {
row3 = new R3.API.Vector4(0, 0, 0, 1);
}
this.rows[3] = row3;
this.temp = [];
this.temp.push(
new R3.API.Vector4()
);
this.temp.push(
new R3.API.Vector4()
);
this.temp.push(
new R3.API.Vector4()
);
this.temp.push(
new R3.API.Vector4()
);
this.forward = new R3.API.Vector4();
this.left = new R3.API.Vector4();
this.up = new R3.API.Vector4();
}; };
R3.API.Matrix4.prototype = Object.create(R3.API.Component.prototype);
R3.API.Matrix4.prototype.constructor = R3.API.Matrix4;
R3.API.Matrix4.prototype.rotationMatrixX = function(radians) { R3.API.Matrix4.prototype.rotationMatrixX = function(radians) {
this.identity(); this.identity();
this.rows[1] = new R3.API.Vector4(0, Math.cos(radians), -1 * Math.sin(radians), 0);
this.rows[2] = new R3.API.Vector4(0, Math.sin(radians), Math.cos(radians), 0); this.rows[1] = new R3.API.Vector4(
{
parent : this,
register : this.register,
x : 0,
y : Math.cos(radians),
z : -1 * Math.sin(radians),
w : 0
}
);
this.rows[2] = new R3.API.Vector4(
{
parent : this,
register : this.register,
x : 0,
y : Math.sin(radians),
z : Math.cos(radians),
w : 0
}
);
return this; return this;
}; };
R3.API.Matrix4.prototype.rotationMatrixY = function(radians) { R3.API.Matrix4.prototype.rotationMatrixY = function(radians) {
this.identity(); this.identity();
this.rows[0] = new R3.API.Vector4( this.rows[0] = new R3.API.Vector4(
Math.cos(radians), {
0, parent : this,
Math.sin(radians), register : this.register,
0 x : Math.cos(radians),
y : 0,
z : Math.sin(radians),
w : 0
}
); );
this.rows[2] = new R3.API.Vector4( this.rows[2] = new R3.API.Vector4(
-1 * Math.sin(radians), {
0, parent : this,
Math.cos(radians), register : this.register,
0 x : -1 * Math.sin(radians),
y : 0,
z : Math.cos(radians),
w : 0
}
); );
return this; return this;
}; };
R3.API.Matrix4.prototype.rotationMatrixZ = function(radians) { R3.API.Matrix4.prototype.rotationMatrixZ = function(radians) {
this.identity(); this.identity();
this.rows[0] = new R3.API.Vector4(Math.cos(radians), -1 * Math.sin(radians), 0, 0);
this.rows[1] = new R3.API.Vector4(Math.sin(radians), Math.cos(radians), 0, 0); this.rows[0] = new R3.API.Vector4(
{
parent : this,
register : this.register,
x : Math.cos(radians),
y : -1 * Math.sin(radians),
z : 0,
w : 0
}
);
this.rows[1] = new R3.API.Vector4(
{
parent : this,
register : this.register,
x : Math.sin(radians),
y : Math.cos(radians),
z : 0,
w : 0
}
);
return this; return this;
}; };
@ -108,25 +184,48 @@ R3.API.Matrix4.prototype.rotateZ = function(radians, point) {
R3.API.Matrix4.prototype.multiply = function(mvp) { R3.API.Matrix4.prototype.multiply = function(mvp) {
if (mvp instanceof R3.API.Quaternion || mvp instanceof R3.API.Vector4) { if (mvp instanceof R3.API.Quaternion || mvp instanceof R3.API.Vector4) {
return new R3.API.Quaternion( return new R3.API.Quaternion(
this.rows[0].x * mvp.x + this.rows[0].y * mvp.y + this.rows[0].z * mvp.z + this.rows[0].w * mvp.w, {
this.rows[1].x * mvp.x + this.rows[1].y * mvp.y + this.rows[1].z * mvp.z + this.rows[1].w * mvp.w, parent : this,
this.rows[2].x * mvp.x + this.rows[2].y * mvp.y + this.rows[2].z * mvp.z + this.rows[2].w * mvp.w, register : this.register,
this.rows[3].x * mvp.x + this.rows[3].y * mvp.y + this.rows[3].z * mvp.z + this.rows[3].w * mvp.w x : this.rows[0].x * mvp.x + this.rows[0].y * mvp.y + this.rows[0].z * mvp.z + this.rows[0].w * mvp.w,
y : this.rows[1].x * mvp.x + this.rows[1].y * mvp.y + this.rows[1].z * mvp.z + this.rows[1].w * mvp.w,
z : this.rows[2].x * mvp.x + this.rows[2].y * mvp.y + this.rows[2].z * mvp.z + this.rows[2].w * mvp.w,
w : this.rows[3].x * mvp.x + this.rows[3].y * mvp.y + this.rows[3].z * mvp.z + this.rows[3].w * mvp.w
}
); );
} else if (mvp instanceof R3.API.Vector3) { } else if (mvp instanceof R3.API.Vector3) {
return new R3.API.Vector3( return new R3.API.Vector3(
this.rows[0].x * mvp.x + this.rows[0].y * mvp.y + this.rows[0].z * mvp.z, {
this.rows[1].x * mvp.x + this.rows[1].y * mvp.y + this.rows[1].z * mvp.z, parent : this,
this.rows[2].x * mvp.x + this.rows[2].y * mvp.y + this.rows[2].z * mvp.z register : this.register,
x : this.rows[0].x * mvp.x + this.rows[0].y * mvp.y + this.rows[0].z * mvp.z,
y : this.rows[1].x * mvp.x + this.rows[1].y * mvp.y + this.rows[1].z * mvp.z,
z : this.rows[2].x * mvp.x + this.rows[2].y * mvp.y + this.rows[2].z * mvp.z
}
); );
} }
}; };
R3.API.Matrix4.prototype.identity = function() { R3.API.Matrix4.prototype.identity = function() {
this.rows = [
new R3.API.Vector4(1, 0, 0, 0), this.rows[0].x = 1;
new R3.API.Vector4(0, 1, 0, 0), this.rows[0].y = 0;
new R3.API.Vector4(0, 0, 1, 0), this.rows[0].z = 0;
new R3.API.Vector4(0, 0, 0, 1) this.rows[0].w = 0;
];
this.rows[1].x = 0;
this.rows[1].y = 1;
this.rows[1].z = 0;
this.rows[1].w = 0;
this.rows[2].x = 0;
this.rows[2].y = 0;
this.rows[2].z = 1;
this.rows[2].w = 0;
this.rows[3].x = 0;
this.rows[3].y = 0;
this.rows[3].z = 0;
this.rows[3].w = 1;
}; };

View File

@ -1,27 +1,23 @@
/** /**
* R3.API.Mouse * R3.API.Mouse
* @param apiComponent * @param apiComponent
* @param x
* @param y
* @constructor * @constructor
*/ */
R3.API.Mouse = function( R3.API.Mouse = function(
apiComponent, apiComponent
x,
y
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(x)) { if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
x = 0; apiComponent.x = 0;
} }
this.x = x; this.x = apiComponent.x;
if (R3.Utils.UndefinedOrNull(y)) { if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
y = 0; apiComponent.y = 0;
} }
this.y = y; this.y = apiComponent.y;
}; };

View File

@ -1,27 +1,31 @@
/** /**
* R3.API.Plane * R3.API.Plane
* @param apiComponent * @param apiComponent
* @param normal
* @param constant
* @constructor * @constructor
*/ */
R3.API.Plane = function( R3.API.Plane = function(
apiComponent, apiComponent
normal,
constant
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(normal)) { if (R3.Utils.UndefinedOrNull(apiComponent.normal)) {
normal = new R3.API.Vector3(1,0,0); apiComponent.normal = new R3.API.Vector3(
{
register : true,
parent : this,
x : 0,
y : 0,
z : 0
}
);
} }
this.normal = normal; this.normal = apiComponent.normal;
if (R3.Utils.UndefinedOrNull(constant)) { if (R3.Utils.UndefinedOrNull(apiComponent.constant)) {
constant = 0; apiComponent.constant = 0;
} }
this.constant = constant; this.constant = apiComponent.constant;
}; };

View File

@ -1,56 +1,51 @@
/** /**
* API Project * R3.API.Project
* @param apiComponent * @param apiComponent
* @param users *
* @param isPublic * @property users
* @param entities * @property isPublic
* @param renderers * @property entities
* @param renderTargets * @property renderers
* @param cameras * @property renderTargets
* @param audios * @property cameras
* @param applicationMode * @property controls
* @property audios
* @property applicationMode
*
* @constructor * @constructor
*/ */
R3.API.Project = function( R3.API.Project = function(
apiComponent, apiComponent
users,
isPublic,
entities,
renderers,
renderTargets,
cameras,
audios,
applicationMode
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(users)) { if (R3.Utils.UndefinedOrNull(apiComponent.users)) {
throw new Error('Only registered users can create projects'); throw new Error('Only registered users can create projects');
} }
this.users = users; this.users = apiComponent.users;
if (R3.Utils.UndefinedOrNull(isPublic)) { if (R3.Utils.UndefinedOrNull(apiComponent.isPublic)) {
isPublic = true; apiComponent.isPublic = true;
} }
this.isPublic = isPublic; this.isPublic = apiComponent.isPublic;
if (R3.Utils.UndefinedOrNull(entities)) { if (R3.Utils.UndefinedOrNull(apiComponent.entities)) {
entities = []; apiComponent.entities = [];
} }
this.entities = entities; this.entities = apiComponent.entities;
if (R3.Utils.UndefinedOrNull(renderers)) { if (R3.Utils.UndefinedOrNull(apiComponent.renderers)) {
renderers = [new R3.API.Renderer.D3()]; apiComponent.renderers = [new R3.API.Renderer.D3()];
} }
this.renderers = renderers; this.renderers = apiComponent.renderers;
if (R3.Utils.UndefinedOrNull(renderTargets)) { if (R3.Utils.UndefinedOrNull(apiComponent.renderTargets)) {
renderTargets = []; apiComponent.renderTargets = [];
} }
this.renderTargets = renderTargets; this.renderTargets = apiComponent.renderTargets;
if (R3.Utils.UndefinedOrNull(cameras)) { if (R3.Utils.UndefinedOrNull(apiComponent.cameras)) {
var editCamera = new R3.D3.API.Camera.Perspective( var editCamera = new R3.D3.API.Camera.Perspective(
{ {
name : 'Edit Camera' name : 'Edit Camera'
@ -61,30 +56,35 @@ R3.API.Project = function(
name : 'Run Camera' name : 'Run Camera'
} }
); );
cameras = [editCamera, runCamera]; apiComponent.cameras = [editCamera, runCamera];
} }
this.cameras = cameras; this.cameras = apiComponent.cameras;
if (R3.Utils.UndefinedOrNull(audios)) { if (R3.Utils.UndefinedOrNull(apiComponent.controls)) {
audios = []; apiComponent.controls = [];
} }
this.audios = audios; this.controls = apiComponent.controls;
if (R3.Utils.UndefinedOrNull(applicationMode)) { if (R3.Utils.UndefinedOrNull(apiComponent.audios)) {
applicationMode = R3.API.Project.APPLICATION_MODE_EDIT; apiComponent.audios = [];
} }
this.applicationMode = applicationMode; this.audios = apiComponent.audios;
if (R3.Utils.UndefinedOrNull(apiComponent.applicationMode)) {
apiComponent.applicationMode = R3.API.Project.APPLICATION_MODE_EDIT;
}
this.applicationMode = apiComponent.applicationMode;
}; };
R3.API.Project.prototype = Object.create(R3.API.Component.prototype); R3.API.Project.prototype = Object.create(R3.API.Component.prototype);
R3.API.Project.prototype.constructor = R3.API.Project; R3.API.Project.prototype.constructor = R3.API.Project;
R3.API.Project.APPLICATION_MODE_RUN = 0x1;
R3.API.Project.APPLICATION_MODE_EDIT = 0x2;
R3.API.Project.CAMERA_INDEX_EDIT = 0x0; R3.API.Project.CAMERA_INDEX_EDIT = 0x0;
R3.API.Project.CAMERA_INDEX_RUN = 0x1; R3.API.Project.CAMERA_INDEX_RUN = 0x1;
R3.API.Project.APPLICATION_MODE_EDIT = R3.API.Project.CAMERA_INDEX_EDIT;
R3.API.Project.APPLICATION_MODE_RUN = R3.API.Project.CAMERA_INDEX_RUN;
R3.API.Project.RENDERER_INDEX_MAIN = 0x0; R3.API.Project.RENDERER_INDEX_MAIN = 0x0;
R3.API.Project.RENDER_TARGET_INDEX_NONE = -0x1; R3.API.Project.RENDER_TARGET_INDEX_NONE = -0x1;

View File

@ -1,53 +1,55 @@
/** /**
* Quaternion * R3.API.Quaternion
* @param x * @param apiComponent
* @param y
* @param z
* @param w
* @param axis
* @param angle
* @constructor * @constructor
*/ */
R3.API.Quaternion = function( R3.API.Quaternion = function(
x, apiComponent
y,
z,
w,
axis,
angle
) { ) {
if (R3.Utils.UndefinedOrNull(x)) { __DEREGISTER_COMPONENT__;
x = 0;
}
this.x = x;
if (R3.Utils.UndefinedOrNull(y)) { __API_COMPONENT__;
y = 0;
}
this.y = y;
if (R3.Utils.UndefinedOrNull(z)) { if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
z = 0; apiComponent.x = 0;
} }
this.z = z; this.x = apiComponent.x;
if (R3.Utils.UndefinedOrNull(w)) { if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
w = 1; apiComponent.y = 0;
} }
this.w = w; this.y = apiComponent.y;
if (R3.Utils.UndefinedOrNull(axis)) { if (R3.Utils.UndefinedOrNull(apiComponent.z)) {
axis = new R3.API.Vector3(); apiComponent.z = 0;
} }
this.axis = axis; this.z = apiComponent.z;
if (R3.Utils.UndefinedOrNull(angle)) { if (R3.Utils.UndefinedOrNull(apiComponent.w)) {
angle = 0; apiComponent.w = 1;
} }
this.angle = angle; this.w = apiComponent.w;
if (R3.Utils.UndefinedOrNull(apiComponent.axis)) {
apiComponent.axis = new R3.API.Vector3(
{
parent : this,
register : this.register
}
);
}
this.axis = apiComponent.axis;
if (R3.Utils.UndefinedOrNull(apiComponent.angle)) {
apiComponent.angle = 0;
}
this.angle = apiComponent.angle;
}; };
R3.API.Quaternion.prototype = Object.create(R3.API.Component.prototype);
R3.API.Quaternion.prototype.constructor = R3.API.Quaternion;
R3.API.Quaternion.prototype.translate = function(v) { R3.API.Quaternion.prototype.translate = function(v) {
this.x += v.x; this.x += v.x;
this.y += v.y; this.y += v.y;
@ -57,10 +59,7 @@ R3.API.Quaternion.prototype.translate = function(v) {
R3.API.Quaternion.prototype.copy = function() { R3.API.Quaternion.prototype.copy = function() {
return new R3.API.Quaternion( return new R3.API.Quaternion(
this.x, this
this.y,
this.z,
this.w
); );
}; };
@ -212,26 +211,3 @@ R3.API.Quaternion.prototype.slerp = function(quaternion, t) {
return this; return this;
}; };
/**
* Returns an API quaternion from an Object quaternion
* @param objectQuaternion
* @constructor
*/
R3.API.Quaternion.FromObject = function(objectQuaternion) {
var apiAxis = null;
if (objectQuaternion.axis) {
apiAxis = R3.API.Vector3.FromObject(objectQuaternion.axis);
}
return new R3.API.Quaternion(
objectQuaternion.x,
objectQuaternion.y,
objectQuaternion.z,
objectQuaternion.w,
apiAxis,
objectQuaternion.angle
)
};

View File

@ -1,19 +1,36 @@
/** /**
* R3.API.Quaternion.Points * R3.API.Quaternion.Points
* @param apiComponent
* @constructor * @constructor
*/ */
R3.API.Quaternion.Points = function() { R3.API.Quaternion.Points = function(
this.vectors = []; apiComponent
) {
__API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(apiComponent.vectors)) {
apiComponent.vectors = [];
}
this.vectors = apiComponent.vectors;
}; };
R3.API.Quaternion.Points.prototype = Object.create(R3.API.Component.prototype);
R3.API.Quaternion.Points.prototype.constructor = R3.API.Quaternion.Points;
R3.API.Quaternion.Points.prototype.add = function(vector) { R3.API.Quaternion.Points.prototype.add = function(vector) {
if (vector instanceof R3.API.Vector3) { if (vector instanceof R3.API.Vector3) {
vector = new R3.API.Quaternion( vector = new R3.API.Quaternion(
vector.x, {
vector.y, parent : this,
vector.z, register : true,
1 x : vector.x,
y : vector.y,
z : vector.z,
w : 1
}
) )
} }
@ -44,7 +61,11 @@ R3.API.Quaternion.Points.prototype.maximizeXDistance = function(grain) {
var multiplier = 0; var multiplier = 0;
var rotationMatrixY = new R3.API.Matrix4().rotationMatrixY(grain); var rotationMatrixY = new R3.API.Matrix4(
{
parent : this
}
).rotationMatrixY(grain);
var totalRadians = 0; var totalRadians = 0;
@ -73,7 +94,12 @@ R3.API.Quaternion.Points.prototype.maximizeXDistance = function(grain) {
// console.log("distance: " + maxXDistance + " radians : " + totalRadians); // console.log("distance: " + maxXDistance + " radians : " + totalRadians);
var maxRotationMatrix = new R3.API.Matrix4().rotationMatrixY(totalRadians); var maxRotationMatrix = new R3.API.Matrix4(
{
parent : this,
register : true
}
).rotationMatrixY(totalRadians);
for (var k = 0; k < this.vectors.length; k++) { for (var k = 0; k < this.vectors.length; k++) {
this.vectors[k] = maxRotationMatrix.multiply(this.vectors[k]); this.vectors[k] = maxRotationMatrix.multiply(this.vectors[k]);
@ -89,7 +115,12 @@ R3.API.Quaternion.Points.prototype.maximizeYDistance = function(grain) {
var multiplier = 0; var multiplier = 0;
var rotationMatrixX = new R3.API.Matrix4().rotationMatrixX(grain); var rotationMatrixX = new R3.API.Matrix4(
{
parent : this,
register : true
}
).rotationMatrixX(grain);
var totalRadians = 0; var totalRadians = 0;
@ -117,7 +148,12 @@ R3.API.Quaternion.Points.prototype.maximizeYDistance = function(grain) {
// console.log("distance: " + maxYDistance + " radians : " + totalRadians); // console.log("distance: " + maxYDistance + " radians : " + totalRadians);
var maxRotationMatrix = new R3.API.Matrix4().rotationMatrixX(totalRadians); var maxRotationMatrix = new R3.API.Matrix4(
{
parent : this,
register : true
}
).rotationMatrixX(totalRadians);
for (var k = 0; k < this.vectors.length; k++) { for (var k = 0; k < this.vectors.length; k++) {
this.vectors[k] = maxRotationMatrix.multiply(this.vectors[k]); this.vectors[k] = maxRotationMatrix.multiply(this.vectors[k]);
@ -134,11 +170,42 @@ R3.API.Quaternion.Points.prototype.lookAt = function(at, up) {
console.log("poly center : " + JSON.stringify(polyCenter)); console.log("poly center : " + JSON.stringify(polyCenter));
var lookAtMatrix = new R3.API.Matrix4().lookAt(polyCenter, at, up); var lookAtMatrix = new R3.API.Matrix4({
parent : this
}).lookAt(polyCenter, at, up);
lookAtMatrix.rows[0] = new R3.API.Quaternion(1, 0, 0, 0); lookAtMatrix.rows[0] = new R3.API.Quaternion(
lookAtMatrix.rows[1] = new R3.API.Quaternion(0, 0, 1, 0); {
lookAtMatrix.rows[2] = new R3.API.Quaternion(0, 1, 0, 0); parent : this,
register : true,
x : 1,
y : 0,
z : 0,
w : 0
}
);
lookAtMatrix.rows[1] = new R3.API.Quaternion(
{
parent : this,
register : true,
x : 0,
y : 0,
z : 1,
w : 0
}
);
lookAtMatrix.rows[2] = new R3.API.Quaternion(
{
parent : this,
register : true,
x : 0,
y : 1,
z : 0,
w : 0
}
);
console.log("look at matrix : " + JSON.stringify(lookAtMatrix, null, 2)); console.log("look at matrix : " + JSON.stringify(lookAtMatrix, null, 2));
@ -182,13 +249,17 @@ R3.API.Quaternion.Points.prototype.distances = function() {
} }
return new R3.API.Vector3( return new R3.API.Vector3(
Math.abs(maxX - minX), {
Math.abs(maxY - minY), parent : this,
Math.abs(maxY - minZ) x : Math.abs(maxX - minX),
y : Math.abs(maxY - minY),
z : Math.abs(maxY - minZ)
}
) )
}; };
R3.API.Quaternion.Points.prototype.average = function() { R3.API.Quaternion.Points.prototype.average = function() {
var averageX = 0; var averageX = 0;
var averageY = 0; var averageY = 0;
var averageZ = 0; var averageZ = 0;
@ -200,9 +271,13 @@ R3.API.Quaternion.Points.prototype.average = function() {
} }
return new R3.API.Vector3( return new R3.API.Vector3(
averageX / this.vectors.length, {
averageY / this.vectors.length, parent : this,
averageZ / this.vectors.length register : true,
x : averageX / this.vectors.length,
y : averageY / this.vectors.length,
z : averageZ / this.vectors.length
}
); );
}; };

68
src/r3-api-query-0.js Normal file
View File

@ -0,0 +1,68 @@
/**
* R3.API.Query
* @param apiComponent
*
* @property path
* @property start
* @property end
* @property timezone
* @property size
* @property text
* @property onData
*
* @constructor
*/
R3.API.Query = function(
apiComponent
) {
__API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(apiComponent.path)) {
apiComponent.path = null;
}
this.path = apiComponent.path;
if (R3.Utils.UndefinedOrNull(apiComponent.start)) {
apiComponent.start = 'now-7d';
}
this.start = apiComponent.start;
if (R3.Utils.UndefinedOrNull(apiComponent.end)) {
apiComponent.end = 'now+4h';
}
this.end = apiComponent.end;
if (R3.Utils.UndefinedOrNull(apiComponent.timezone)) {
apiComponent.timezone = 'Europe/Berlin';
}
this.timezone = apiComponent.timezone;
if (R3.Utils.UndefinedOrNull(apiComponent.size)) {
apiComponent.size = 0;
}
this.size = apiComponent.size;
if (R3.Utils.UndefinedOrNull(apiComponent.text)) {
apiComponent.text = '{}';
}
this.text = apiComponent.text;
if (R3.Utils.UndefinedOrNull(apiComponent.onData)) {
apiComponent.onData = function() {
console.log('todo: implement this query onData event');
};
}
this.onData = apiComponent.onData;
};
R3.API.Query.prototype = Object.create(R3.API.Component.prototype);
R3.API.Query.prototype.constructor = R3.API.Query;
R3.API.Query.QUERY_SIZE = 'QUERY_SIZE';
R3.API.Query.QUERY_START = 'QUERY_START';
R3.API.Query.QUERY_END = 'QUERY_END';
R3.API.Query.QUERY_TIMEZONE = 'QUERY_TIMEZONE';
R3.API.Query.QUERY_BUCKET_FIELD = 'QUERY_BUCKET_FIELD';

View File

@ -0,0 +1,24 @@
/**
* R3.API.Query.Alerts
* @param apiComponent
* @constructor
*/
R3.API.Query.Alerts = function(
apiComponent
) {
R3.API.Query.call(
this,
apiComponent
);
if (R3.Utils.UndefinedOrNull(apiComponent.path)) {
apiComponent.path = '/alerts/_search';
}
this.path = apiComponent.path;
};
R3.API.Query.Alerts.prototype = Object.create(R3.API.Query.prototype);
R3.API.Query.Alerts.prototype.constructor = R3.API.Query.Alerts;

View File

@ -0,0 +1,75 @@
/**
* R3.API.Query.Alerts.Buckets
* @param apiComponent
*
* @property bucketField BUCKET_FIELD
*
* @constructor
*/
R3.API.Query.Alerts.Buckets = function(
apiComponent
) {
R3.API.Query.Alerts.call(
this,
apiComponent
);
if (R3.Utils.UndefinedOrNull(apiComponent.bucketField)) {
apiComponent.bucketField = null;
}
this.bucketField = apiComponent.bucketField;
this.text = '{\
"version": false,\
"size": ' + R3.API.Query.QUERY_SIZE + ',\
"sort": [\
{\
"priority": {\
"order": "asc"\
},\
"acknowledged": {\
"order": "asc"\
},\
"' + R3.API.Query.QUERY_BUCKET_FIELD + '": {\
"order": "asc"\
}\
}\
],\
"_source": {\
"includes": ["*"]\
},\
"aggs": {\
"descriptions": {\
"terms" : { "field" : "' + R3.API.Query.QUERY_BUCKET_FIELD + '" },\
"aggs": {\
"priorities": {\
"histogram": {\
"field": "priority",\
"interval": "1",\
"min_doc_count": 0\
}\
}\
}\
}\
},\
"query": {\
"bool": {\
"must": [\
{\
"range": {\
"timestamp": {\
"format": "strict_date_optional_time",\
"gte" : "' + R3.API.Query.QUERY_START + '",\
"lt" : "' + R3.API.Query.QUERY_END + '"\
}\
}\
}\
]\
}\
}\
}';
};
R3.API.Query.Alerts.Buckets.prototype = Object.create(R3.API.Query.Alerts.prototype);
R3.API.Query.Alerts.Buckets.prototype.constructor = R3.API.Query.Alerts.Buckets;

View File

@ -0,0 +1,62 @@
/**
* R3.API.Query.Alerts.List
* @param apiComponent
* @constructor
*/
R3.API.Query.Alerts.List = function(
apiComponent
) {
R3.API.Query.Alerts.call(
this,
apiComponent
);
if (R3.Utils.UndefinedOrNull(apiComponent.size)) {
apiComponent.size = 100;
}
this.size = apiComponent.size;
this.text = '{\
"version": false,\
"size": ' + R3.API.Query.QUERY_SIZE + ',\
"sort": [\
{\
"timestamp": {\
"order": "desc",\
"unmapped_type": "boolean"\
}\
}\
],\
"_source": {\
"includes": ["*"]\
},\
"aggs": {\
"priorities": {\
"histogram": {\
"field": "priority",\
"interval": "1",\
"min_doc_count": 0\
}\
}\
},\
"query": {\
"bool": {\
"must": [\
{\
"range": {\
"timestamp": {\
"format": "strict_date_optional_time",\
"gte": "' + R3.API.Query.QUERY_START + '",\
"lt": "' + R3.API.Query.QUERY_END + '"\
}\
}\
}\
]\
}\
}\
}';
};
R3.API.Query.Alerts.List.prototype = Object.create(R3.API.Query.Alerts.prototype);
R3.API.Query.Alerts.List.prototype.constructor = R3.API.Query.Alerts.List;

View File

@ -0,0 +1,57 @@
/**
* R3.API.Query.Alerts.Summary
* @param apiComponent
* @constructor
*/
R3.API.Query.Alerts.Summary = function(
apiComponent
) {
R3.API.Query.Alerts.call(
this,
apiComponent
);
this.text = '{\
"version": false,\
"size": ' + R3.API.Query.QUERY_SIZE + ',\
"sort": [\
{\
"timestamp": {\
"order": "desc",\
"unmapped_type": "boolean"\
}\
}\
],\
"_source": {\
"includes": ["*"]\
},\
"aggs": {\
"priorities": {\
"histogram": {\
"field": "priority",\
"interval": "1",\
"min_doc_count": 0\
}\
}\
},\
"query": {\
"bool": {\
"must": [\
{\
"range": {\
"timestamp": {\
"format": "strict_date_optional_time",\
"gte": "' + R3.API.Query.QUERY_START + '",\
"lt": "' + R3.API.Query.QUERY_END + '"\
}\
}\
}\
]\
}\
}\
}';
};
R3.API.Query.Alerts.Summary.prototype = Object.create(R3.API.Query.Alerts.prototype);
R3.API.Query.Alerts.Summary.prototype.constructor = R3.API.Query.Alerts.Summary;

View File

@ -0,0 +1,68 @@
/**
* R3.API.Query.Alerts.Timeseries
* @param apiComponent
* @constructor
*/
R3.API.Query.Alerts.Timeseries = function(
apiComponent
) {
R3.API.Query.Alerts.call(
this,
apiComponent
);
this.text = '{\
"version": false,\
"size": ' + R3.API.Query.QUERY_SIZE + ',\
"sort": [\
{\
"timestamp": {\
"order": "desc",\
"unmapped_type": "boolean"\
}\
}\
],\
"_source": {\
"includes": ["*"]\
},\
"aggs": {\
"mins": {\
"date_histogram": {\
"field": "timestamp",\
"calendar_interval": "1d",\
"time_zone": "' + R3.API.Query.QUERY_TIMEZONE + '",\
"min_doc_count": 0,\
"format" : "yyyy-MM-dd"\
},\
"aggs": {\
"priorities": {\
"histogram": {\
"field": "priority",\
"interval": "1",\
"min_doc_count": 0\
}\
}\
}\
}\
},\
"query": {\
"bool": {\
"must": [\
{\
"range": {\
"timestamp": {\
"format": "strict_date_optional_time",\
"gte" : "' + R3.API.Query.QUERY_START + '",\
"lt" : "' + R3.API.Query.QUERY_END + '"\
}\
}\
}\
]\
}\
}\
}';
};
R3.API.Query.Alerts.Timeseries.prototype = Object.create(R3.API.Query.Alerts.prototype);
R3.API.Query.Alerts.Timeseries.prototype.constructor = R3.API.Query.Alerts.Timeseries;

View File

@ -7,7 +7,7 @@ R3.API.Renderer = function(
apiComponent apiComponent
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
}; };

View File

@ -1,28 +1,28 @@
/** /**
* R3.API.Renderer.D2 * R3.API.Renderer.D2
* @param apiComponent
*
* @property canvas
*
* @constructor * @constructor
* @param apiRenderer
* @param canvas
*/ */
R3.API.Renderer.D2 = function( R3.API.Renderer.D2 = function(
apiRenderer, apiComponent
canvas
) { ) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
apiRenderer = {};
}
this.apiRenderer = apiRenderer;
R3.API.Renderer.call( R3.API.Renderer.call(
this, this,
this.apiRenderer apiComponent
); );
if (R3.Utils.UndefinedOrNull(canvas)) { if (R3.Utils.UndefinedOrNull(apiComponent.canvas)) {
canvas = new R3.API.Canvas(); apiComponent.canvas = new R3.API.Canvas(
{
parent : this
}
);
} }
this.canvas = canvas; this.canvas = apiComponent.canvas;
}; };

231
src/r3-api-renderer-d3-0.js Normal file
View File

@ -0,0 +1,231 @@
/**
* R3.API.Renderer.D3
* @param apiComponent
*
* @property autoClear
* @property autoClearColor
* @property autoClearDepth
* @property autoClearStencil
* @property gammaFactor
* @property gammaInput
* @property gammaOutput
* @property maxMorphTargets
* @property maxMorphNormals
* @property physicallyCorrectLights
* @property shadowMapEnabled
* @property shadowMapAutoUpdate
* @property shadowMapNeedsUpdate
* @property shadowMapType
* @property shadowMapRenderReverseSided
* @property shadowMapRenderSingleSided
* @property sortObjects
* @property toneMapping
* @property toneMappingExposure
* @property toneMappingWhitePoint
* @property premultipliedAlpha
* @property antialias
* @property stencil
* @property preserveDrawingBuffer
* @property depth
* @property logarithmicDepthBuffer
* @property localClippingEnabled
* @property clippingPlanes
* @property clearColor
* @property viewports
* @property alpha
* @property opacity
* @property pixelRatio
*
* @constructor
*/
R3.API.Renderer.D3 = function(
apiComponent
) {
R3.API.Renderer.call(
this,
apiComponent
);
if (R3.Utils.UndefinedOrNull(apiComponent.autoClear)) {
apiComponent.autoClear = true;
}
this.autoClear = apiComponent.autoClear;
if (R3.Utils.UndefinedOrNull(apiComponent.autoClearColor)) {
apiComponent.autoClearColor = true;
}
this.autoClearColor = apiComponent.autoClearColor;
if (R3.Utils.UndefinedOrNull(apiComponent.autoClearDepth)) {
apiComponent.autoClearDepth = true;
}
this.autoClearDepth = apiComponent.autoClearDepth;
if (R3.Utils.UndefinedOrNull(apiComponent.autoClearStencil)) {
apiComponent.autoClearStencil = true;
}
this.autoClearStencil = apiComponent.autoClearStencil;
if (R3.Utils.UndefinedOrNull(apiComponent.gammaFactor)) {
apiComponent.gammaFactor = 2;
}
this.gammaFactor = apiComponent.gammaFactor;
if (R3.Utils.UndefinedOrNull(apiComponent.gammaInput)) {
apiComponent.gammaInput = false;
}
this.gammaInput = apiComponent.gammaInput;
if (R3.Utils.UndefinedOrNull(apiComponent.gammaOutput)) {
apiComponent.gammaOutput = false;
}
this.gammaOutput = apiComponent.gammaOutput;
if (R3.Utils.UndefinedOrNull(apiComponent.maxMorphTargets)) {
apiComponent.maxMorphTargets = 8;
}
this.maxMorphTargets = apiComponent.maxMorphTargets;
if (R3.Utils.UndefinedOrNull(apiComponent.maxMorphNormals)) {
apiComponent.maxMorphNormals = 4;
}
this.maxMorphNormals = apiComponent.maxMorphNormals;
if (R3.Utils.UndefinedOrNull(apiComponent.physicallyCorrectLights)) {
apiComponent.physicallyCorrectLights = false;
}
this.physicallyCorrectLights = apiComponent.physicallyCorrectLights;
if (R3.Utils.UndefinedOrNull(apiComponent.shadowMapEnabled)) {
apiComponent.shadowMapEnabled = false;
}
this.shadowMapEnabled = apiComponent.shadowMapEnabled;
if (R3.Utils.UndefinedOrNull(apiComponent.shadowMapAutoUpdate)) {
apiComponent.shadowMapAutoUpdate = true;
}
this.shadowMapAutoUpdate = apiComponent.shadowMapAutoUpdate;
if (R3.Utils.UndefinedOrNull(apiComponent.shadowMapNeedsUpdate)) {
apiComponent.shadowMapNeedsUpdate = false;
}
this.shadowMapNeedsUpdate = apiComponent.shadowMapNeedsUpdate;
if (R3.Utils.UndefinedOrNull(apiComponent.shadowMapType)) {
apiComponent.shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
}
this.shadowMapType = apiComponent.shadowMapType;
if (R3.Utils.UndefinedOrNull(apiComponent.shadowMapRenderReverseSided)) {
apiComponent.shadowMapRenderReverseSided = true;
}
this.shadowMapRenderReverseSided = apiComponent.shadowMapRenderReverseSided;
if (R3.Utils.UndefinedOrNull(apiComponent.shadowMapRenderSingleSided)) {
apiComponent.shadowMapRenderSingleSided = true;
}
this.shadowMapRenderSingleSided = apiComponent.shadowMapRenderSingleSided;
if (R3.Utils.UndefinedOrNull(apiComponent.sortObjects)) {
apiComponent.sortObjects = true;
}
this.sortObjects = apiComponent.sortObjects;
if (R3.Utils.UndefinedOrNull(apiComponent.toneMapping)) {
apiComponent.toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
}
this.toneMapping = apiComponent.toneMapping;
if (R3.Utils.UndefinedOrNull(apiComponent.toneMappingExposure)) {
apiComponent.toneMappingExposure = 1;
}
this.toneMappingExposure = apiComponent.toneMappingExposure;
if (R3.Utils.UndefinedOrNull(apiComponent.toneMappingWhitePoint)) {
apiComponent.toneMappingWhitePoint = 1;
}
this.toneMappingWhitePoint = apiComponent.toneMappingWhitePoint;
if (R3.Utils.UndefinedOrNull(apiComponent.premultipliedAlpha)) {
apiComponent.premultipliedAlpha = true;
}
this.premultipliedAlpha = apiComponent.premultipliedAlpha;
if (R3.Utils.UndefinedOrNull(apiComponent.antialias)) {
apiComponent.antialias = false;
}
this.antialias = apiComponent.antialias;
if (R3.Utils.UndefinedOrNull(apiComponent.stencil)) {
apiComponent.stencil = true;
}
this.stencil = apiComponent.stencil;
if (R3.Utils.UndefinedOrNull(apiComponent.preserveDrawingBuffer)) {
apiComponent.preserveDrawingBuffer = false;
}
this.preserveDrawingBuffer = apiComponent.preserveDrawingBuffer;
if (R3.Utils.UndefinedOrNull(apiComponent.depth)) {
apiComponent.depth = true;
}
this.depth = apiComponent.depth;
if (R3.Utils.UndefinedOrNull(apiComponent.logarithmicDepthBuffer)) {
apiComponent.logarithmicDepthBuffer = false;
}
this.logarithmicDepthBuffer = apiComponent.logarithmicDepthBuffer;
if (R3.Utils.UndefinedOrNull(apiComponent.localClippingEnabled)) {
apiComponent.localClippingEnabled = false;
}
this.localClippingEnabled = apiComponent.localClippingEnabled;
if (R3.Utils.UndefinedOrNull(apiComponent.clippingPlanes)) {
apiComponent.clippingPlanes = [];
}
this.clippingPlanes = apiComponent.clippingPlanes;
if (R3.Utils.UndefinedOrNull(apiComponent.clearColor)) {
apiComponent.clearColor = new R3.API.Color(
{
parent : this,
r : 0.11,
g : 0.11,
b : 0.11
}
);
}
this.clearColor = apiComponent.clearColor;
if (R3.Utils.UndefinedOrNull(apiComponent.viewports)) {
apiComponent.viewports = [
new R3.D3.API.Viewport(
{
parent : this
}
)
];
}
this.viewports = apiComponent.viewports;
if (R3.Utils.UndefinedOrNull(apiComponent.alpha)) {
apiComponent.alpha = true;
}
this.alpha = apiComponent.alpha;
if (R3.Utils.UndefinedOrNull(apiComponent.opacity)) {
apiComponent.opacity = 1;
}
this.opacity = apiComponent.opacity;
if (R3.Utils.UndefinedOrNull(apiComponent.pixelRatio)) {
apiComponent.pixelRatio = window.devicePixelRatio;
}
this.pixelRatio = apiComponent.pixelRatio;
};
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3;

View File

@ -0,0 +1,50 @@
/**
* R3.API.Renderer.D3.Canvas
* @param apiComponent
*
* @property canvas
*
* @constructor
*/
R3.API.Renderer.D3.Canvas = function(
apiComponent
) {
R3.API.Renderer.D3.call(
this,
apiComponent
);
if (R3.Utils.UndefinedOrNull(apiComponent.canvas)) {
apiComponent.canvas = new R3.API.Canvas(
{
parent : this
}
);
}
this.canvas = apiComponent.canvas;
};
R3.API.Renderer.D3.Canvas.prototype = Object.create(R3.API.Renderer.D3.prototype);
R3.API.Renderer.D3.Canvas.prototype.constructor = R3.API.Renderer.D3.Canvas;
R3.API.Renderer.D3.Canvas.prototype.getSize = function(viewport) {
if (R3.Utils.UndefinedOrNull(viewport)) {
viewport = null;
}
if (viewport) {
return {
width : this.canvas.width * viewport.width,
height : this.canvas.height * viewport.height
}
}
return {
width : this.canvas.width,
height : this.canvas.height
}
};

View File

@ -1,28 +1,28 @@
/** /**
* R3.API.Renderer.D3.Canvas.Target * R3.API.Renderer.D3.Canvas.Target
* @param apiComponent
*
* @property target
*
* @constructor * @constructor
* @param apiRendererD3Canvas
* @param target
*/ */
R3.API.Renderer.D3.Canvas.Target = function( R3.API.Renderer.D3.Canvas.Target = function(
apiRendererD3Canvas, apiComponent
target
) { ) {
if (R3.Utils.UndefinedOrNull(apiRendererD3Canvas)) {
apiRendererD3Canvas = {};
}
this.apiRendererD3Canvas = apiRendererD3Canvas;
R3.API.Renderer.D3.Canvas.call( R3.API.Renderer.D3.Canvas.call(
this, this,
this.apiRendererD3Canvas, apiComponent
this.apiRendererD3Canvas.canvas
); );
if (R3.Utils.UndefinedOrNull(target)) { if (R3.Utils.UndefinedOrNull(apiComponent.target)) {
target = new R3.D3.API.RenderTarget(); apiComponent.target = new R3.D3.API.RenderTarget(
{
parent : this
}
);
} }
this.target = target; this.target = apiComponent.target;
}; };
R3.API.Renderer.D3.Canvas.Target.prototype = Object.create(R3.API.Renderer.D3.Canvas.prototype); R3.API.Renderer.D3.Canvas.Target.prototype = Object.create(R3.API.Renderer.D3.Canvas.prototype);

View File

@ -1,72 +0,0 @@
/**
* R3.API.Renderer.D3.Canvas
* @param apiRendererD3
* @param canvas
* @constructor
*/
R3.API.Renderer.D3.Canvas = function(
apiRendererD3,
canvas
) {
if (R3.Utils.UndefinedOrNull(apiRendererD3)) {
apiRendererD3 = {};
}
this.apiRendererD3 = apiRendererD3;
R3.API.Renderer.D3.call(
this,
this.apiRendererD3,
this.apiRendererD3.autoClear,
this.apiRendererD3.autoClearColor,
this.apiRendererD3.autoClearDepth,
this.apiRendererD3.autoClearStencil,
this.apiRendererD3.gammaFactor,
this.apiRendererD3.gammaInput,
this.apiRendererD3.gammaOutput,
this.apiRendererD3.maxMorphTargets,
this.apiRendererD3.maxMorphNormals,
this.apiRendererD3.physicallyCorrectLights,
this.apiRendererD3.shadowMapEnabled,
this.apiRendererD3.shadowMapAutoUpdate,
this.apiRendererD3.shadowMapNeedsUpdate,
this.apiRendererD3.shadowMapType,
this.apiRendererD3.shadowMapRenderReverseSided,
this.apiRendererD3.shadowMapRenderSingleSided,
this.apiRendererD3.sortObjects,
this.apiRendererD3.toneMapping,
this.apiRendererD3.toneMappingExposure,
this.apiRendererD3.toneMappingWhitePoint,
this.apiRendererD3.premultipliedAlpha,
this.apiRendererD3.antialias,
this.apiRendererD3.stencil,
this.apiRendererD3.preserveDrawingBuffer,
this.apiRendererD3.depth,
this.apiRendererD3.logarithmicDepthBuffer,
this.apiRendererD3.localClippingEnabled,
this.apiRendererD3.clippingPlanes,
this.apiRendererD3.clearColor,
this.apiRendererD3.viewports,
this.apiRendererD3.alpha,
this.apiRendererD3.opacity,
this.apiRendererD3.pixelRatio
);
if (R3.Utils.UndefinedOrNull(canvas)) {
canvas = new R3.API.Canvas();
}
this.canvas = canvas;
};
R3.API.Renderer.D3.Canvas.prototype = Object.create(R3.API.Renderer.D3.prototype);
R3.API.Renderer.D3.Canvas.prototype.constructor = R3.API.Renderer.D3.Canvas;
R3.API.Renderer.D3.Canvas.prototype.getSize = function() {
return {
width : this.canvas.width,
height : this.canvas.height
}
};

View File

@ -1,254 +0,0 @@
/**
* R3.API.Renderer.D3
* @param apiRenderer
* @param autoClear
* @param autoClearColor
* @param autoClearDepth
* @param autoClearStencil
* @param gammaFactor
* @param gammaInput
* @param gammaOutput
* @param maxMorphTargets
* @param maxMorphNormals
* @param physicallyCorrectLights
* @param shadowMapEnabled
* @param shadowMapAutoUpdate
* @param shadowMapNeedsUpdate
* @param shadowMapType
* @param shadowMapRenderReverseSided
* @param shadowMapRenderSingleSided
* @param sortObjects
* @param toneMapping
* @param toneMappingExposure
* @param toneMappingWhitePoint
* @param premultipliedAlpha
* @param antialias
* @param stencil
* @param preserveDrawingBuffer
* @param depth
* @param logarithmicDepthBuffer
* @param localClippingEnabled
* @param clippingPlanes
* @param clearColor
* @param viewports
* @param alpha
* @param opacity
* @param pixelRatio
* @constructor
*/
R3.API.Renderer.D3 = function(
apiRenderer,
autoClear,
autoClearColor,
autoClearDepth,
autoClearStencil,
gammaFactor,
gammaInput,
gammaOutput,
maxMorphTargets,
maxMorphNormals,
physicallyCorrectLights,
shadowMapEnabled,
shadowMapAutoUpdate,
shadowMapNeedsUpdate,
shadowMapType,
shadowMapRenderReverseSided,
shadowMapRenderSingleSided,
sortObjects,
toneMapping,
toneMappingExposure,
toneMappingWhitePoint,
premultipliedAlpha,
antialias,
stencil,
preserveDrawingBuffer,
depth,
logarithmicDepthBuffer,
localClippingEnabled,
clippingPlanes,
clearColor,
viewports,
alpha,
opacity,
pixelRatio
) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
apiRenderer = {};
}
this.apiRenderer = apiRenderer;
R3.API.Renderer.call(
this,
this.apiRenderer
);
if (R3.Utils.UndefinedOrNull(autoClear)) {
autoClear = true;
}
this.autoClear = autoClear;
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
autoClearColor = true;
}
this.autoClearColor = autoClearColor;
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
autoClearDepth = true;
}
this.autoClearDepth = autoClearDepth;
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
autoClearStencil = true;
}
this.autoClearStencil = autoClearStencil;
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
gammaFactor = 2;
}
this.gammaFactor = gammaFactor;
if (R3.Utils.UndefinedOrNull(gammaInput)) {
gammaInput = false;
}
this.gammaInput = gammaInput;
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
gammaOutput = false;
}
this.gammaOutput = gammaOutput;
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
maxMorphTargets = 8;
}
this.maxMorphTargets = maxMorphTargets;
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
maxMorphNormals = 4;
}
this.maxMorphNormals = maxMorphNormals;
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
physicallyCorrectLights = false;
}
this.physicallyCorrectLights = physicallyCorrectLights;
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
shadowMapEnabled = false;
}
this.shadowMapEnabled = shadowMapEnabled;
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
shadowMapAutoUpdate = true;
}
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
shadowMapNeedsUpdate = false;
}
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
}
this.shadowMapType = shadowMapType;
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
shadowMapRenderReverseSided = true;
}
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
shadowMapRenderSingleSided = true;
}
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
if (R3.Utils.UndefinedOrNull(sortObjects)) {
sortObjects = true;
}
this.sortObjects = sortObjects;
if (R3.Utils.UndefinedOrNull(toneMapping)) {
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
}
this.toneMapping = toneMapping;
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
toneMappingExposure = 1;
}
this.toneMappingExposure = toneMappingExposure;
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
toneMappingWhitePoint = 1;
}
this.toneMappingWhitePoint = toneMappingWhitePoint;
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
premultipliedAlpha = true;
}
this.premultipliedAlpha = premultipliedAlpha;
if (R3.Utils.UndefinedOrNull(antialias)) {
antialias = false;
}
this.antialias = antialias;
if (R3.Utils.UndefinedOrNull(stencil)) {
stencil = true;
}
this.stencil = stencil;
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
preserveDrawingBuffer = false;
}
this.preserveDrawingBuffer = preserveDrawingBuffer;
if (R3.Utils.UndefinedOrNull(depth)) {
depth = true;
}
this.depth = depth;
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
logarithmicDepthBuffer = false;
}
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
localClippingEnabled = false;
}
this.localClippingEnabled = localClippingEnabled;
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
clippingPlanes = [];
}
this.clippingPlanes = clippingPlanes;
if (R3.Utils.UndefinedOrNull(clearColor)) {
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
}
this.clearColor = clearColor;
if (R3.Utils.UndefinedOrNull(viewports)) {
viewports = [new R3.D3.API.Viewport()];
}
this.viewports = viewports;
if (R3.Utils.UndefinedOrNull(alpha)) {
alpha = true;
}
this.alpha = alpha;
if (R3.Utils.UndefinedOrNull(opacity)) {
opacity = 1;
}
this.opacity = opacity;
if (R3.Utils.UndefinedOrNull(pixelRatio)) {
pixelRatio = window.devicePixelRatio;
}
this.pixelRatio = pixelRatio;
};
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3;

View File

@ -1,69 +1,61 @@
/** /**
* R3.API.Server * R3.API.Server
* @param apiComponent * @param apiComponent
* @param protocol * @property protocol
* @param context * @property context
* @param application * @property application
* @param domain * @property domain
* @param ip * @property ip
* @param preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime * @property preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime
* @param port * @property port
* @param protocols * @property protocols
* @constructor * @constructor
*/ */
R3.API.Server = function( R3.API.Server = function(
apiComponent, apiComponent
protocol,
context,
application,
domain,
ip,
preferIp,
port,
protocols
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(protocol)) { if (R3.Utils.UndefinedOrNull(apiComponent.protocol)) {
protocol = R3.API.Server.PROTOCOL_HTTP_SSL; apiComponent.protocol = R3.API.Server.PROTOCOL_HTTP_SSL;
} }
this.protocol = protocol; this.protocol = apiComponent.protocol;
if (R3.Utils.UndefinedOrNull(context)) { if (R3.Utils.UndefinedOrNull(apiComponent.context)) {
context = null; apiComponent.context = null;
} }
this.context = context; this.context = apiComponent.context;
if (R3.Utils.UndefinedOrNull(application)) { if (R3.Utils.UndefinedOrNull(apiComponent.application)) {
application = null; apiComponent.application = null;
} }
this.application = application; this.application = apiComponent.application;
if (R3.Utils.UndefinedOrNull(domain)) { if (R3.Utils.UndefinedOrNull(apiComponent.domain)) {
domain = null; apiComponent.domain = null;
} }
this.domain = domain; this.domain = apiComponent.domain;
if (R3.Utils.UndefinedOrNull(ip)) { if (R3.Utils.UndefinedOrNull(apiComponent.ip)) {
ip = '127.0.0.1'; apiComponent.ip = '127.0.0.1';
} }
this.ip = ip; this.ip = apiComponent.ip;
if (R3.Utils.UndefinedOrNull(preferIp)) { if (R3.Utils.UndefinedOrNull(apiComponent.preferIp)) {
preferIp = false; apiComponent.preferIp = false;
} }
this.preferIp = preferIp; this.preferIp = apiComponent.preferIp;
if (R3.Utils.UndefinedOrNull(port)) { if (R3.Utils.UndefinedOrNull(apiComponent.port)) {
port = R3.API.Server.PORT_SECURE; apiComponent.port = R3.API.Server.PORT_SECURE;
} }
this.port = port; this.port = apiComponent.port;
if (R3.Utils.UndefinedOrNull(protocols)) { if (R3.Utils.UndefinedOrNull(apiComponent.protocols)) {
protocols = []; apiComponent.protocols = [];
} }
this.protocols = protocols; this.protocols = apiComponent.protocols;
}; };
R3.API.Server.prototype = Object.create(R3.API.Component.prototype); R3.API.Server.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,56 +1,55 @@
/** /**
* R3.API.Socket * R3.API.Socket
* @param apiComponent * @param apiComponent
* @param roomId * @property roomId
* @param peerId * @property peerId
* @param server R3.Server * @property server
* @constructor * @constructor
*/ */
R3.API.Socket = function( R3.API.Socket = function(
apiComponent, apiComponent
roomId,
peerId,
server
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(roomId)) { if (R3.Utils.UndefinedOrNull(apiComponent.roomId)) {
roomId = 'room_' + R3.Utils.RandomId(); apiComponent.roomId = 'room_' + R3.Utils.RandomId();
} }
this.roomId = roomId; this.roomId = apiComponent.roomId;
if (R3.Utils.UndefinedOrNull(peerId)) { if (R3.Utils.UndefinedOrNull(apiComponent.peerId)) {
peerId = null; apiComponent.peerId = null;
} }
this.peerId = peerId; this.peerId = apiComponent.peerId;
if (R3.Utils.UndefinedOrNull(server)) { if (R3.Utils.UndefinedOrNull(apiComponent.server)) {
R3.Event.Emit( R3.Event.Emit(
R3.Event.GET_WEBSOCKET_CONFIG, R3.Event.GET_WEBSOCKET_CONFIG,
'hello', 'hello',
function(websocketConfig) { function(websocketConfig) {
if (websocketConfig) { if (websocketConfig) {
server = new R3.API.Server( apiComponent.server = new R3.API.Server(
null, {
null, parent : this,
websocketConfig.protocol, protocol : websocketConfig.protocol,
websocketConfig.context, context : websocketConfig.context,
websocketConfig.application, application : websocketConfig.application,
websocketConfig.domain domain : websocketConfig.domain
}
); );
} else { } else {
server = new R3.API.Server( apiComponent.server = new R3.API.Server(
null, {
null, parent : this,
R3.API.Server.PROTOCOL_WEBSOCKET_SSL protocol : R3.API.Server.PROTOCOL_WEBSOCKET_SSL
}
); );
} }
} }
); );
} }
this.server = server; this.server = apiComponent.server;
}; };

View File

@ -1,45 +1,34 @@
/** /**
* R3.API.Socket.Cast * R3.API.Socket.Cast
* @param apiSocket * @param apiComponent
* @param castType * @property castType
* @param source * @property source
* @param sourceProperties * @property sourceProperties
* @constructor * @constructor
*/ */
R3.API.Socket.Cast = function( R3.API.Socket.Cast = function(
apiSocket, apiComponent
castType,
source,
sourceProperties
) { ) {
if (R3.Utils.UndefinedOrNull(apiSocket)) {
apiSocket = {}
}
this.apiSocket = apiSocket;
R3.API.Socket.call( R3.API.Socket.call(
this, this,
this.apiSocket, apiComponent
this.apiSocket.roomId,
this.apiSocket.peerId,
this.apiSocket.server
); );
if (R3.Utils.UndefinedOrNull(castType)) { if (R3.Utils.UndefinedOrNull(apiComponent.castType)) {
castType = R3.API.Socket.Cast.CAST_TYPE_ROOM; apiComponent.castType = R3.API.Socket.Cast.CAST_TYPE_ROOM;
} }
this.castType = castType; this.castType = apiComponent.castType;
if (R3.Utils.UndefinedOrNull(source)) { if (R3.Utils.UndefinedOrNull(apiComponent.source)) {
source = null; apiComponent.source = null;
} }
this.source = source; this.source = apiComponent.source;
if (R3.Utils.UndefinedOrNull(sourceProperties)) { if (R3.Utils.UndefinedOrNull(apiComponent.sourceProperties)) {
sourceProperties = null; apiComponent.sourceProperties = null;
} }
this.sourceProperties = sourceProperties; this.sourceProperties = apiComponent.sourceProperties;
}; };

View File

@ -1,45 +1,34 @@
/** /**
* R3.API.Socket.Receive * R3.API.Socket.Receive
* @param apiSocket * @param apiComponent
* @param receiveType * @property receiveType
* @param destination * @property destination
* @param destinationProperties * @property destinationProperties
* @constructor * @constructor
*/ */
R3.API.Socket.Receive = function( R3.API.Socket.Receive = function(
apiSocket, apiComponent
receiveType,
destination,
destinationProperties
) { ) {
if (R3.Utils.UndefinedOrNull(apiSocket)) {
apiSocket = {}
}
this.apiSocket = apiSocket;
R3.API.Socket.call( R3.API.Socket.call(
this, this,
this.apiSocket, apiComponent
this.apiSocket.roomId,
this.apiSocket.peerId,
this.apiSocket.server
); );
if (R3.Utils.UndefinedOrNull(receiveType)) { if (R3.Utils.UndefinedOrNull(apiComponent.receiveType)) {
receiveType = R3.API.Socket.Receive.RECEIVE_TYPE_ROOM; apiComponent.receiveType = R3.API.Socket.Receive.RECEIVE_TYPE_ROOM;
} }
this.receiveType = receiveType; this.receiveType = apiComponent.receiveType;
if (R3.Utils.UndefinedOrNull(destination)) { if (R3.Utils.UndefinedOrNull(apiComponent.destination)) {
destination = null; apiComponent.destination = null;
} }
this.destination = destination; this.destination = apiComponent.destination;
if (R3.Utils.UndefinedOrNull(destinationProperties)) { if (R3.Utils.UndefinedOrNull(apiComponent.destinationProperties)) {
destinationProperties = null; apiComponent.destinationProperties = null;
} }
this.destinationProperties = destinationProperties; this.destinationProperties = apiComponent.destinationProperties;
}; };

View File

@ -1,27 +1,34 @@
/** /**
* R3.API.Sphere * R3.API.Sphere
* @constructor
* @param apiComponent * @param apiComponent
* @param center *
* @param radius * @property center
* @property radius
*
* @constructor
*/ */
R3.API.Sphere = function( R3.API.Sphere = function(
apiComponent, apiComponent
center,
radius
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(center)) { if (R3.Utils.UndefinedOrNull(apiComponent.center)) {
center = new R3.API.Vector3(0,0,0); apiComponent.center = new R3.API.Vector3(
{
parent : this,
x : 0,
y : 0,
z : 0
}
);
} }
this.center = center; this.center = apiComponent.center;
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(apiComponent.radius)) {
radius = 1; apiComponent.radius = 1;
} }
this.radius = radius; this.radius = apiComponent.radius;
}; };
R3.API.Sphere.prototype = Object.create(R3.API.Sphere.prototype); R3.API.Sphere.prototype = Object.create(R3.API.Sphere.prototype);

View File

@ -1,20 +1,21 @@
/** /**
* Raw Stats API object - should always correspond with the Stats Schema * Raw Stats API object - should always correspond with the Stats Schema
* @param apiComponent * @param apiComponent
* @param domElement *
* @property domElement
*
* @constructor * @constructor
*/ */
R3.API.Stats = function( R3.API.Stats = function(
apiComponent, apiComponent
domElement
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(domElement)) { if (R3.Utils.UndefinedOrNull(apiComponent.domElement)) {
domElement = null; apiComponent.domElement = null;
} }
this.domElement = domElement; this.domElement = apiComponent.domElement;
}; };

View File

@ -1,69 +1,63 @@
/** /**
* API User * R3.API.User
* @param apiComponent * @param apiComponent
* @param googleId *
* @param fullName * @property googleId
* @param givenName * @property fullName
* @param familyName * @property givenName
* @param imageUrl * @property familyName
* @param email * @property imageUrl
* @param uploadFolder * @property email
* @param idToken * @property uploadFolder
* @property idToken
*
* @constructor * @constructor
*/ */
R3.API.User = function( R3.API.User = function(
apiComponent, apiComponent
googleId,
fullName,
givenName,
familyName,
imageUrl,
email,
uploadFolder,
idToken
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(googleId)) { if (R3.Utils.UndefinedOrNull(apiComponent.googleId)) {
throw new Error('invalid user - no google ID'); throw new Error('invalid user - no google ID');
} }
this.googleId = googleId; this.googleId = apiComponent.googleId;
if (R3.Utils.UndefinedOrNull(fullName)) { if (R3.Utils.UndefinedOrNull(apiComponent.fullName)) {
fullName = 'unknown full name'; apiComponent.fullName = 'unknown full name';
} }
this.fullName = fullName; this.fullName = apiComponent.fullName;
if (R3.Utils.UndefinedOrNull(givenName)) { if (R3.Utils.UndefinedOrNull(apiComponent.givenName)) {
givenName = 'unknown given name'; apiComponent.givenName = 'unknown given name';
} }
this.givenName = givenName; this.givenName = apiComponent.givenName;
if (R3.Utils.UndefinedOrNull(familyName)) { if (R3.Utils.UndefinedOrNull(apiComponent.familyName)) {
familyName = 'unknown family name'; apiComponent.familyName = 'unknown family name';
} }
this.familyName = familyName; this.familyName = apiComponent.familyName;
if (R3.Utils.UndefinedOrNull(imageUrl)) { if (R3.Utils.UndefinedOrNull(apiComponent.imageUrl)) {
imageUrl = 'unknown image URL'; apiComponent.imageUrl = 'unknown image URL';
} }
this.imageUrl = imageUrl; this.imageUrl = apiComponent.imageUrl;
if (R3.Utils.UndefinedOrNull(email)) { if (R3.Utils.UndefinedOrNull(apiComponent.email)) {
throw new Error('invalid user - no email address'); throw new Error('invalid user - no email address');
} }
this.email = email; this.email = apiComponent.email;
if (R3.Utils.UndefinedOrNull(uploadFolder)) { if (R3.Utils.UndefinedOrNull(apiComponent.uploadFolder)) {
uploadFolder = email.replace('/','_DS_'); apiComponent.uploadFolder = email.replace('/','_DS_');
} }
this.uploadFolder = uploadFolder; this.uploadFolder = apiComponent.uploadFolder;
if (R3.Utils.UndefinedOrNull(idToken)) { if (R3.Utils.UndefinedOrNull(apiComponent.idToken)) {
idToken = 'unknown ID token'; apiComponent.idToken = 'unknown ID token';
} }
this.idToken = idToken; this.idToken = apiComponent.idToken;
}; };

View File

@ -1,22 +1,34 @@
/** /**
* R3.API.Vector2 * R3.API.Vector2
* @param x * @param apiComponent
* @param y *
* @property x
* @property y
*
* @constructor * @constructor
*/ */
R3.API.Vector2 = function(x, y) { R3.API.Vector2 = function(
apiComponent
) {
if (R3.Utils.UndefinedOrNull(x)) { __DEREGISTER_COMPONENT__;
x = 0;
}
this.x = x;
if (R3.Utils.UndefinedOrNull(y)) { __API_COMPONENT__;
y = 0;
if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
apiComponent.x = 0;
} }
this.y = y; this.x = apiComponent.x;
if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
apiComponent.y = 0;
}
this.y = apiComponent.y;
}; };
R3.API.Vector2.prototype = Object.create(R3.API.Component.prototype);
R3.API.Vector2.prototype.constructor = R3.API.Vector2;
/** /**
* Equals * Equals
* TODO: Test * TODO: Test

View File

@ -1,29 +1,41 @@
/** /**
* R3.API.Vector3 * R3.API.Vector3
* @param x * @param apiComponent
* @param y *
* @param z * @property x
* @property y
* @property z
*
* @constructor * @constructor
*/ */
R3.API.Vector3 = function(x, y, z) { R3.API.Vector3 = function(
apiComponent
) {
if (R3.Utils.UndefinedOrNull(x)) { __DEREGISTER_COMPONENT__;
x = 0;
}
this.x = x;
if (R3.Utils.UndefinedOrNull(y)) { __API_COMPONENT__;
y = 0;
}
this.y = y;
if (R3.Utils.UndefinedOrNull(z)) { if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
z = 0; apiComponent.x = 0;
} }
this.z = z; this.x = apiComponent.x;
if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
apiComponent.y = 0;
}
this.y = apiComponent.y;
if (R3.Utils.UndefinedOrNull(apiComponent.z)) {
apiComponent.z = 0;
}
this.z = apiComponent.z;
}; };
R3.API.Vector3.prototype = Object.create(R3.API.Component.prototype);
R3.API.Vector3.prototype.constructor = R3.API.Vector3;
R3.API.Vector3.prototype.setFrom = function(vector3) { R3.API.Vector3.prototype.setFrom = function(vector3) {
this.x = vector3.x; this.x = vector3.x;
this.y = vector3.y; this.y = vector3.y;
@ -64,8 +76,9 @@ R3.API.Vector3.prototype.cross = function(v) {
}; };
R3.API.Vector3.prototype.lookAt = function(at, up) { R3.API.Vector3.prototype.lookAt = function(at, up) {
var lookAtMatrix = R3.API.Matrix4.lookAt(this, at, up); console.warn('todo: implement R3.API.Vector3.prototype.lookAt()');
return this.multiply(lookAtMatrix); // var lookAtMatrix = R3.API.Matrix4.lookAt(this, at, up);
// return this.multiply(lookAtMatrix);
}; };
R3.API.Vector3.prototype.translate = function(v) { R3.API.Vector3.prototype.translate = function(v) {
@ -88,9 +101,7 @@ R3.API.Vector3.prototype.squared = function() {
R3.API.Vector3.prototype.copy = function() { R3.API.Vector3.prototype.copy = function() {
return new R3.API.Vector3( return new R3.API.Vector3(
this.x, this
this.y,
this.z
); );
}; };
@ -149,7 +160,7 @@ R3.API.Vector3.prototype.multiply = function(object, cross) {
var a = object; var a = object;
var b = this; var b = this;
if (R3.Utils.UndefinedOrNull(cross)) { if (R3.Utils.UndefinedOrNull(apiComponent.cross)) {
cross = false; cross = false;
} }

View File

@ -1,31 +1,43 @@
/** /**
* R3.API.Vector4 * R3.API.Vector4
* @param x * @param apiComponent
* @param y *
* @param z * @property x
* @param w * @property y
* @property z
* @property w
*
* @constructor * @constructor
*/ */
R3.API.Vector4 = function(x, y, z, w) { R3.API.Vector4 = function(
apiComponent
) {
if (R3.Utils.UndefinedOrNull(x)) { __DEREGISTER_COMPONENT__;
x = 0;
}
this.x = x;
if (R3.Utils.UndefinedOrNull(y)) { __API_COMPONENT__;
y = 0;
}
this.y = y;
if (R3.Utils.UndefinedOrNull(z)) { if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
z = 0; apiComponent.x = 0;
} }
this.z = z; this.x = apiComponent.x;
if (R3.Utils.UndefinedOrNull(w)) { if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
w = 0; apiComponent.y = 0;
} }
this.w = w; this.y = apiComponent.y;
if (R3.Utils.UndefinedOrNull(apiComponent.z)) {
apiComponent.z = 0;
}
this.z = apiComponent.z;
if (R3.Utils.UndefinedOrNull(apiComponent.w)) {
apiComponent.w = 0;
}
this.w = apiComponent.w;
}; };
R3.API.Vector4.prototype = Object.create(R3.API.Component.prototype);
R3.API.Vector4.prototype.constructor = R3.API.Vector4;

View File

@ -1,50 +1,54 @@
/** /**
* R3.API.Video * R3.API.Video
* @param apiComponent * @param apiComponent
* @param autoUpdateSize *
* @param width * @property autoUpdateSize
* @param height * @property width
* @param offset * @property height
* @param source * @property offset
* @property source
*
* @constructor * @constructor
*/ */
R3.API.Video = function( R3.API.Video = function(
apiComponent, apiComponent,
autoUpdateSize,
width,
height,
offset,
source
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) { if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
autoUpdateSize = true; apiComponent.autoUpdateSize = true;
} }
this.autoUpdateSize = autoUpdateSize; this.autoUpdateSize = apiComponent.autoUpdateSize;
var size = R3.Utils.GetWindowSize(); var size = R3.Utils.GetWindowSize();
if (R3.Utils.UndefinedOrNull(width)) { if (R3.Utils.UndefinedOrNull(apiComponent.width)) {
width = size.width; apiComponent.width = size.width;
} }
this.width = width; this.width = apiComponent.width;
if (R3.Utils.UndefinedOrNull(height)) { if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
height = size.height; apiComponent.height = size.height;
} }
this.height = height; this.height = apiComponent.height;
if (R3.Utils.UndefinedOrNull(offset)) { if (R3.Utils.UndefinedOrNull(apiComponent.offset)) {
offset = new R3.API.Vector2(0,0); apiComponent.offset = new R3.API.Vector2(
{
parent : this,
register : true,
x : 0,
y : 0
}
);
} }
this.offset = offset; this.offset = apiComponent.offset;
if (R3.Utils.UndefinedOrNull(source)) { if (R3.Utils.UndefinedOrNull(apiComponent.source)) {
source = null; apiComponent.source = null;
} }
this.source = source; this.source = apiComponent.source;
}; };

View File

@ -7,28 +7,9 @@ R3.Box3 = function(
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Box3.call( __UPGRADE_TO_RUNTIME__;
this,
apiComponent,
apiComponent.min,
apiComponent.max
);
this.min = new R3.Vector3(
this,
this.min,
);
this.max = new R3.Vector3(
this,
this.max
);
this.componentRuntime = R3.Component.GetComponentRuntime(this.parent);
R3.Component.call(this);
}; };
R3.Box3.prototype = Object.create(R3.Component.prototype); R3.Box3.prototype = Object.create(R3.Component.prototype);
@ -40,14 +21,14 @@ R3.Box3.prototype.constructor = R3.Box3;
*/ */
R3.Box3.prototype.createInstance = function() { R3.Box3.prototype.createInstance = function() {
switch (this.componentRuntime) { switch (this.parent.runtime) {
case R3.Component.GRAPHICS_RUNTIME : case R3.Runtime.GRAPHICS :
this.instance = this.graphics.Box3( this.instance = this.graphics.Box3(
this.min, this.min,
this.max this.max
); );
break; break;
case R3.Component.PHYSICS_RUNTIME : case R3.Runtime.PHYSICS :
this.instance = this.physics.Box3( this.instance = this.physics.Box3(
this.min, this.min,
this.max this.max
@ -57,6 +38,8 @@ R3.Box3.prototype.createInstance = function() {
throw new Error('unhandled component runtime: ' + this.componentRuntime); throw new Error('unhandled component runtime: ' + this.componentRuntime);
} }
__CREATE_INSTANCE__;
}; };
/** /**
@ -79,6 +62,6 @@ R3.Box3.prototype.updateInstance = function(property) {
return; return;
} }
R3.Component.prototype.updateInstance.call(this, property); __UPDATE_INSTANCE__;
}; };

View File

@ -1,41 +1,18 @@
/** /**
* R3.Canvas * R3.Canvas
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.Canvas = function( R3.Canvas = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Canvas.call(
this,
apiComponent,
apiComponent.autoUpdateSize,
apiComponent.width,
apiComponent.height,
apiComponent.offset,
apiComponent.tabIndex,
apiComponent.texts,
apiComponent.textBaseline
);
this.offset = new R3.Vector2(
this,
this.offset
);
this.context = null; this.context = null;
R3.Component.call( __UPGRADE_TO_RUNTIME__;
this,
{
'texts' : [R3.D3.Text]
}
);
}; };
R3.Canvas.prototype = Object.create(R3.Component.prototype); R3.Canvas.prototype = Object.create(R3.Component.prototype);
@ -69,7 +46,7 @@ R3.Canvas.prototype.createInstance = function() {
this.instance.height = this.height; this.instance.height = this.height;
} }
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**
@ -142,7 +119,7 @@ R3.Canvas.prototype.updateInstance = function(property) {
return; return;
} }
R3.Component.prototype.updateInstance.call(this, property); __UPDATE_INSTANCE__;
}; };
R3.Canvas.prototype.writeText = function() { R3.Canvas.prototype.writeText = function() {

View File

@ -1,25 +1,16 @@
/** /**
* R3.Clock * R3.Clock
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.Clock = function( R3.Clock = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Clock.call( __UPGRADE_TO_RUNTIME__;
this,
apiComponent
);
R3.Component.call(
this,
parent
);
} ; } ;
R3.Clock.prototype = Object.create(R3.Component.prototype); R3.Clock.prototype = Object.create(R3.Component.prototype);
@ -32,7 +23,7 @@ R3.Clock.prototype.createInstance = function() {
this.instance = this.graphics.Clock(); this.instance = this.graphics.Clock();
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**
@ -41,21 +32,22 @@ R3.Clock.prototype.createInstance = function() {
*/ */
R3.Clock.prototype.updateInstance = function(property) { R3.Clock.prototype.updateInstance = function(property) {
R3.Component.prototype.updateInstance.call(this, property); __UPDATE_INSTANCE;
}; };
R3.Clock.prototype.getDelta = function() { R3.Clock.prototype.getDelta = function() {
var delta = this.instance.getDelta(); return this.instance.getDelta();
/** /**
* 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.warn('clipping delta - todo: do we still need this?');
delta = (1 / 30.0); // // console.log('clipped ' + (delta - (1/30.0)) + ' seconds - essentially lost time');
} // delta = (1 / 30.0);
// }
return delta; //return delta;
}; };

View File

@ -1,36 +1,21 @@
/** /**
* R3.Color * R3.Color
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.Color = function( R3.Color = function(
parent,
apiComponent apiComponent
) { ) {
/** __DEREGISTER_COMPONENT__;
* Color does not extend component so initialize the parent
*/
if (R3.Utils.UndefinedOrNull(parent)) {
parent = null;
}
this.parent = parent;
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Color.call( __UPGRADE_TO_RUNTIME__;
this,
apiComponent.r,
apiComponent.g,
apiComponent.b,
apiComponent.a
);
this.createInstance();
}; };
R3.Color.prototype = Object.create(R3.API.Color.prototype); R3.Color.prototype = Object.create(R3.Component.prototype);
R3.Color.prototype.constructor = R3.Color; R3.Color.prototype.constructor = R3.Color;
/** /**
@ -46,6 +31,8 @@ R3.Color.prototype.createInstance = function() {
this.a this.a
); );
__CREATE_INSTANCE__;
}; };
/** /**
@ -72,20 +59,10 @@ R3.Color.prototype.updateInstance = function(property) {
this.instance.a = this.a; this.instance.a = this.a;
return; return;
} }
__UPDATE_INSTANCE__;
}; };
/**
* Converts runtime color to API Color
* @returns {R3.API.Color}
*/
R3.Color.prototype.toApiObject = function() {
return new R3.API.Color(this,
this.r,
this.g,
this.b,
this.a
);
};
/** /**
* Converts the current color to HTML hex format (ex. #ffffff) * Converts the current color to HTML hex format (ex. #ffffff)
@ -152,4 +129,4 @@ R3.Color.prototype.fromHex = function(hex) {
this.instance.r = this.r; this.instance.r = this.r;
this.instance.g = this.g; this.instance.g = this.g;
this.instance.b = this.b; this.instance.b = this.b;
}; };

View File

@ -1,29 +1,11 @@
/** /**
* R3.Controls is an R3.Component * R3.Controls
* @param parent
* @param linkedObjects
* @constructor * @constructor
*/ */
R3.Controls = function( R3.Controls = function() {
parent,
linkedObjects
) {
if (R3.Utils.UndefinedOrNull(linkedObjects)) { __UPGRADE_TO_RUNTIME__;
linkedObjects = {};
}
if (this.canvas instanceof R3.API.Component) {
this.canvas = R3.Component.ConstructFromObject(this.canvas);
}
linkedObjects.canvas = R3.Canvas;
R3.Component.call(
this,
parent,
linkedObjects
);
}; };
R3.Controls.prototype = Object.create(R3.Component.prototype); R3.Controls.prototype = Object.create(R3.Component.prototype);
@ -37,7 +19,7 @@ R3.Controls.prototype.updateInstance = function(property) {
if (property === 'canvas') { if (property === 'canvas') {
R3.Event.Emit( R3.Event.Emit(
R3.Event.CANVAS_CHANGE, R3.Event.CONTROLS_CANVAS_CHANGE,
{ {
component: this component: this
} }
@ -45,5 +27,5 @@ R3.Controls.prototype.updateInstance = function(property) {
return; return;
} }
R3.Component.prototype.updateInstance.call(this, property); __UPDATE_INSTANCE__;
}; };

View File

@ -1,24 +1,10 @@
/** /**
* R3.Controls.D3 is an R3.Controls * R3.Controls.D3
* @param parent
* @param linkedObjects
* @constructor * @constructor
*/ */
R3.Controls.D3 = function( R3.Controls.D3 = function() {
parent,
linkedObjects
) {
if (R3.Utils.UndefinedOrNull(linkedObjects)) { R3.Controls.call(this);
linkedObjects = {};
}
linkedObjects.camera = R3.D3.Camera;
R3.Controls.call(
this,
parent,
linkedObjects
);
}; };

View File

@ -1,35 +1,18 @@
/** /**
* R3.Controls.D3.Editor is an R3.Controls.D3 * R3.Controls.D3.Editor
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.Controls.D3.Editor = function( R3.Controls.D3.Editor = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Controls.D3.Editor.call(
this,
apiComponent,
apiComponent.raycaster
);
if (this.raycaster instanceof R3.API.Component) {
this.raycaster = R3.Component.ConstructFromObject(this.raycaster);
}
var linkedObjects = {
raycaster : R3.D3.Raycaster
};
R3.Controls.D3.call( R3.Controls.D3.call(
this, this
parent, );
linkedObjects
)
}; };
/** /**
@ -46,7 +29,7 @@ R3.Controls.D3.Editor.prototype.createInstance = function() {
this.instance = this.graphics.EditorControls(this.canvas, this.camera); this.instance = this.graphics.EditorControls(this.canvas, this.camera);
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

View File

@ -1,39 +1,15 @@
/** /**
* R3.Controls.D3.FirstPerson is an R3.Controls.D3 * R3.Controls.D3.FirstPerson
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.Controls.D3.FirstPerson = function( R3.Controls.D3.FirstPerson = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Controls.D3.FirstPerson.call( R3.Controls.D3.call(this);
this,
apiComponent,
apiComponent.enabled,
apiComponent.movementSpeed,
apiComponent.lookSpeed,
apiComponent.lookVertical,
apiComponent.autoForward,
apiComponent.activeLook,
apiComponent.heightSpeed,
apiComponent.heightCoef,
apiComponent.heightMin,
apiComponent.heightMax,
apiComponent.constrainVertical,
apiComponent.verticalMin,
apiComponent.verticalMax,
apiComponent.autoSpeedFactor
);
R3.Controls.D3.call(
this,
parent
)
}; };
@ -68,7 +44,7 @@ R3.Controls.D3.FirstPerson.prototype.createInstance = function() {
this.autoSpeedFactor this.autoSpeedFactor
); );
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

View File

@ -1,49 +1,15 @@
/** /**
* R3.Controls.D3.Orbit is an R3.Controls.D3 * R3.Controls.D3.Orbit
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.Controls.D3.Orbit = function( R3.Controls.D3.Orbit = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Controls.D3.Orbit.call( R3.Controls.D3.call(this);
this,
apiComponent,
apiComponent.target,
apiComponent.enabled,
apiComponent.minPolarAngle,
apiComponent.maxPolarAngle,
apiComponent.enableDamping,
apiComponent.dampingFactor,
apiComponent.enableZoom,
apiComponent.zoomSpeed,
apiComponent.enableRotate,
apiComponent.rotateSpeed,
apiComponent.enablePan,
apiComponent.keyPanSpeed,
apiComponent.autoRotate,
apiComponent.autoRotateSpeed,
apiComponent.enableKeys
);
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,
parent,
linkedObjects
)
}; };
@ -75,7 +41,7 @@ R3.Controls.D3.Orbit.prototype.createInstance = function() {
this.enableKeys this.enableKeys
); );
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

View File

@ -1,24 +1,16 @@
/** /**
* R3.Controls.Keyboard is an R3.Controls * R3.Controls.Keyboard
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.Controls.Keyboard = function( R3.Controls.Keyboard = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Controls.Keyboard.call(
this,
apiComponent
);
R3.Controls.call( R3.Controls.call(
this, this
parent
); );
}; };
@ -35,7 +27,7 @@ R3.Controls.Keyboard.prototype.constructor = R3.Controls.Keyboard;
*/ */
R3.Controls.Keyboard.prototype.createInstance = function() { R3.Controls.Keyboard.prototype.createInstance = function() {
this.instance = true; this.instance = true;
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

View File

@ -1,24 +1,16 @@
/** /**
* R3.Controls.Mouse * R3.Controls.Mouse
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.Controls.Mouse = function( R3.Controls.Mouse = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Controls.Mouse.call(
this,
apiComponent
);
R3.Controls.call( R3.Controls.call(
this, this
parent
); );
}; };
@ -35,7 +27,7 @@ R3.Controls.Mouse.prototype.constructor = R3.Controls.Mouse;
*/ */
R3.Controls.Mouse.prototype.createInstance = function() { R3.Controls.Mouse.prototype.createInstance = function() {
this.instance = true; this.instance = true;
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

View File

@ -1,25 +1,16 @@
/** /**
* Touch Controls * R3.Controls.Touch
* @constructor
* @param parent
* @param apiComponent * @param apiComponent
* @constructor
*/ */
R3.Controls.Touch = function( R3.Controls.Touch = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.Controls.Touch.call(
this,
apiComponent,
apiComponent.sensitivity
);
R3.Controls.call( R3.Controls.call(
this, this
parent
); );
}; };
@ -37,7 +28,7 @@ R3.Controls.Touch.prototype.constructor = R3.Controls.Touch;
*/ */
R3.Controls.Touch.prototype.createInstance = function() { R3.Controls.Touch.prototype.createInstance = function() {
this.instance = true; this.instance = true;
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

56
src/r3-curve-0.js Normal file
View File

@ -0,0 +1,56 @@
/**
* R3.Curve
* @param apiComponent
* @param inherited
* @constructor
*/
R3.Curve = function(
apiComponent,
inherited
) {
if (R3.Utils.UndefinedOrNull(inherited)) {
inherited = false;
}
if (inherited) {
/**
* Do not construct a runtime object of this class - the child is the runtime object
*/
} else {
__RUNTIME_COMPONENT__;
}
__UPGRADE_TO_RUNTIME__;
};
R3.Curve.prototype = Object.create(R3.Component.prototype);
R3.Curve.prototype.constructor = R3.Curve;
/**
* Create Instance
*/
R3.Curve.prototype.createInstance = function() {
this.instance = this.graphics.Curve(this.arcLenghDivisions);
__CREATE_INSTANCE__;
};
/**
* Updates the instance with the current state
*/
R3.Curve.prototype.updateInstance = function(property) {
if (property === 'arcLenghDivisions') {
this.instance.arcLenghDivisions = this.arcLenghDivisions;
return;
}
__UPDATE_INSTANCE__;
};

View File

@ -1,68 +0,0 @@
/**
* R3.Curve
* @param parent
* @param apiComponent
* @param linkedObjects
* @constructor
*/
R3.Curve = function(
parent,
apiComponent,
linkedObjects
) {
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
/**
* 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
);
} 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
);
};
R3.Curve.prototype = Object.create(R3.Component.prototype);
R3.Curve.prototype.constructor = R3.Curve;
/**
* Create Instance
*/
R3.Curve.prototype.createInstance = function() {
this.instance = this.graphics.Curve(this.arcLenghDivisions);
R3.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
R3.Curve.prototype.updateInstance = function(property) {
if (property === 'arcLenghDivisions') {
this.instance.arcLenghDivisions = this.arcLenghDivisions;
return;
}
R3.Component.prototype.updateInstance.call(this, property);
};

63
src/r3-curve-path-0.js Normal file
View File

@ -0,0 +1,63 @@
/**
* R3.Curve.Path
* @param apiComponent
* @param inherited
* @constructor
*/
R3.Curve.Path = function(
apiComponent,
inherited
) {
if (R3.Utils.UndefinedOrNull(inherited)) {
inherited = false;
}
if (inherited) {
/**
* Do not construct a runtime object of this class - the child is the runtime object
*/
} else {
__RUNTIME_COMPONENT__;
}
R3.Curve.call(
this,
apiComponent,
true
)
};
R3.Curve.Path.prototype = Object.create(R3.Curve.prototype);
R3.Curve.Path.prototype.constructor = R3.Curve.Path;
/**
* Creates a camera instance
* @returns {*}
*/
R3.Curve.Path.prototype.createInstance = function() {
this.instance = this.graphics.CurvePath(this.curves, this.autoClose);
__CREATE_INSTANCE__;
};
/**
* Updates the instance with the current state
*/
R3.Curve.Path.prototype.updateInstance = function(property) {
if (property === 'curves') {
console.warn('todo: update curves');
return;
}
if (property === 'autoClose') {
this.instance.autoClose = this.autoClose;
return;
}
R3.Curve.prototype.updateInstance.call(this, property);
};

View File

@ -1,100 +0,0 @@
/**
* R3.Curve.Path
* @constructor
* @param parent
* @param apiComponent
* @param linkedObjects
*/
R3.Curve.Path = function(
parent,
apiComponent,
linkedObjects
) {
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
/**
* 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.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];
}
/**
* 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.call(
this,
parent,
apiComponent,
linkedObjects
)
};
R3.Curve.Path.prototype = Object.create(R3.Curve.prototype);
R3.Curve.Path.prototype.constructor = R3.Curve.Path;
/**
* Creates a camera instance
* @returns {*}
*/
R3.Curve.Path.prototype.createInstance = function() {
this.instance = this.graphics.CurvePath(this.curves, this.autoClose);
R3.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
R3.Curve.Path.prototype.updateInstance = function(property) {
if (property === 'curves') {
console.warn('todo: update curves');
return;
}
if (property === 'autoClose') {
this.instance.autoClose = this.autoClose;
return;
}
R3.Curve.prototype.updateInstance.call(this, property);
};

59
src/r3-curve-path-d2-0.js Normal file
View File

@ -0,0 +1,59 @@
/**
* R3.Curve.Path.D2
* @param apiComponent
* @param inherited
* @constructor
*/
R3.Curve.Path.D2 = function(
apiComponent,
inherited
) {
if (R3.Utils.UndefinedOrNull(inherited)) {
inherited = false;
}
if (inherited) {
/**
* Do not construct a runtime object of this class - the child is the runtime object
*/
} else {
__RUNTIME_COMPONENT__;
}
R3.Curve.Path.call(
this,
apiComponent,
true
);
};
R3.Curve.Path.D2.prototype = Object.create(R3.Curve.Path.prototype);
R3.Curve.Path.D2.prototype.constructor = R3.Curve.Path.D2;
/**
* Creates a camera instance
* @returns {*}
*/
R3.Curve.Path.D2.prototype.createInstance = function() {
this.instance = this.graphics.Path(this.points);
__CREATE_INSTANCE__;
};
/**
* Updates the instance with the current state
*/
R3.Curve.Path.D2.prototype.updateInstance = function(property) {
if (property === 'points') {
console.warn('todo: update points (and test it)');
}
R3.Curve.Path.prototype.updateInstance.call(this, property);
};

View File

@ -1,98 +0,0 @@
/**
* R3.Curve.Path.D2
* @param parent
* @param apiComponent
* @param linkedObjects
* @constructor
*/
R3.Curve.Path.D2 = function(
parent,
apiComponent,
linkedObjects
) {
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
/**
* 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}
*/
}
this.points = this.points.reduce(
function(result, point) {
/**
* Points aren't components so they don't get added to linkedObjects
* @type {R3.Vector2}
*/
point = new R3.Vector2(
this,
point
);
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(
this,
parent,
apiComponent,
linkedObjects
);
};
R3.Curve.Path.D2.prototype = Object.create(R3.Curve.Path.prototype);
R3.Curve.Path.D2.prototype.constructor = R3.Curve.Path.D2;
/**
* Creates a camera instance
* @returns {*}
*/
R3.Curve.Path.D2.prototype.createInstance = function() {
this.instance = this.graphics.Path(this.points);
R3.Component.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
R3.Curve.Path.D2.prototype.updateInstance = function(property) {
if (property === 'points') {
console.warn('todo: update points (and test it)');
}
R3.Curve.Path.prototype.updateInstance.call(this, property);
};

View File

@ -1,48 +1,35 @@
/** /**
* R3.Curve.Path.D2.Shape * R3.Curve.Path.D2.Shape
* @param parent
* @param apiComponent * @param apiComponent
* @param linkedObjects * @param inherited
* @constructor * @constructor
*/ */
R3.Curve.Path.D2.Shape = function( R3.Curve.Path.D2.Shape = function(
parent,
apiComponent, apiComponent,
linkedObjects inherited
) { ) {
if (R3.Utils.UndefinedOrNull(linkedObjects)) { if (R3.Utils.UndefinedOrNull(inherited)) {
inherited = false;
/**
* 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 (inherited) {
/**
* Do not construct a runtime object of this class - the child is the runtime object
*/
} else {
__RUNTIME_COMPONENT__;
}
/** /**
* Now we call the parent class but with linkedObjects - indicating that its being called from a child class * 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 * and should not do any runtime instantiation
*/ */
R3.Curve.Path.D2.call( R3.Curve.Path.D2.call(
this, this,
parent,
apiComponent, apiComponent,
linkedObjects true
) )
}; };
@ -58,7 +45,7 @@ R3.Curve.Path.D2.Shape.prototype.createInstance = function() {
this.instance = this.graphics.Shape(this.points); this.instance = this.graphics.Shape(this.points);
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**

View File

@ -1,29 +1,17 @@
/** /**
* R3.CustomCode * R3.CustomCode
* @param parent
* @param apiComponent * @param apiComponent
* @constructor * @constructor
*/ */
R3.CustomCode = function( R3.CustomCode = function(
parent,
apiComponent apiComponent
) { ) {
__RUNTIME_COMPONENT_MACRO__; __RUNTIME_COMPONENT__;
R3.API.CustomCode.call(
this,
apiComponent,
apiComponent.eventId,
apiComponent.code,
);
this.editor = null; this.editor = null;
R3.Component.call( __UPGRADE_TO_RUNTIME__;
this,
parent
);
}; };
R3.CustomCode.prototype = Object.create(R3.Component.prototype); R3.CustomCode.prototype = Object.create(R3.Component.prototype);
@ -43,7 +31,7 @@ R3.CustomCode.prototype.createInstance = function() {
this.instance = new Function('data', "console.log('compilation failed for : " + this.name + "');").bind(this); this.instance = new Function('data', "console.log('compilation failed for : " + this.name + "');").bind(this);
} }
R3.Component.prototype.createInstance.call(this); __CREATE_INSTANCE__;
}; };
/** /**
@ -93,7 +81,7 @@ R3.CustomCode.prototype.updateInstance = function(property) {
) )
} }
R3.Component.prototype.updateInstance.call(this, property); __UPDATE_INSTANCE__;
}; };
R3.CustomCode.prototype.launchEditor = function(){ R3.CustomCode.prototype.launchEditor = function(){

View File

@ -1,62 +1,93 @@
/** /**
* R3.D3.API.Object * R3.D3.API.Object
* @param apiComponent * @param apiComponent
* @param useQuaternion *
* @param position * @property useQuaternion
* @param quaternion * @property position
* @param rotation * @property quaternion
* @param scale * @property rotation
* @param up * @property scale
* @param lookAt * @property up
* @property lookAt
*
* @constructor * @constructor
*/ */
R3.D3.API.Object = function( R3.D3.API.Object = function(
apiComponent, apiComponent
useQuaternion,
position,
quaternion,
rotation,
scale,
up,
lookAt
) { ) {
__API_COMPONENT_MACRO__; __API_COMPONENT__;
if (R3.Utils.UndefinedOrNull(useQuaternion)) { if (R3.Utils.UndefinedOrNull(apiComponent.useQuaternion)) {
useQuaternion = true; apiComponent.useQuaternion = false;
} }
this.useQuaternion = useQuaternion; this.useQuaternion = apiComponent.useQuaternion;
if (R3.Utils.UndefinedOrNull(position)) { if (R3.Utils.UndefinedOrNull(apiComponent.position)) {
position = new R3.API.Vector3(); apiComponent.position = new R3.API.Vector3(
{
parent : this,
register : true
}
);
} }
this.position = position; this.position = apiComponent.position;
if (R3.Utils.UndefinedOrNull(quaternion)) { if (R3.Utils.UndefinedOrNull(apiComponent.quaternion)) {
quaternion = new R3.API.Quaternion(); apiComponent.quaternion = new R3.API.Quaternion(
{
parent : this,
register : true
}
);
} }
this.quaternion = quaternion; this.quaternion = apiComponent.quaternion;
if (R3.Utils.UndefinedOrNull(rotation)) { if (R3.Utils.UndefinedOrNull(apiComponent.rotation)) {
rotation = new R3.API.Vector3(); apiComponent.rotation = new R3.API.Vector3(
{
parent : this,
register : true
}
);
} }
this.rotation = rotation; this.rotation = apiComponent.rotation;
if (R3.Utils.UndefinedOrNull(scale)) { if (R3.Utils.UndefinedOrNull(apiComponent.scale)) {
scale = new R3.API.Vector3(1,1,1); apiComponent.scale = new R3.API.Vector3(
{
parent : this,
register : true,
x : 1,
y : 1,
z : 1
}
);
} }
this.scale = scale; this.scale = apiComponent.scale;
if (R3.Utils.UndefinedOrNull(up)) { if (R3.Utils.UndefinedOrNull(apiComponent.up)) {
up = new R3.API.Vector3(0,1,0); apiComponent.up = new R3.API.Vector3(
{
parent : this,
register : true,
x : 0,
y : 1,
z : 0
}
);
} }
this.up = up; this.up = apiComponent.up;
if (R3.Utils.UndefinedOrNull(lookAt)) { if (R3.Utils.UndefinedOrNull(apiComponent.lookAt)) {
lookAt = new R3.API.Vector3(); apiComponent.lookAt = new R3.API.Vector3(
{
parent : this,
register : true
}
);
} }
this.lookAt = lookAt; this.lookAt = apiComponent.lookAt;
}; };

Some files were not shown because too many files have changed in this diff Show More