first version compiling
parent
7611567b2c
commit
41645d1ca6
|
@ -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;
|
|
@ -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;
|
|
@ -7,7 +7,7 @@ R3.D3.Composer.RenderTarget = function(
|
|||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.D3.API.Composer.RenderTarget.call(
|
||||
this,
|
||||
|
@ -58,7 +58,7 @@ R3.D3.Composer.RenderTarget.prototype.createInstance = function() {
|
|||
}
|
||||
);
|
||||
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
|
@ -7,7 +7,7 @@ R3.D3.Composer.Renderer = function(
|
|||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.D3.API.Composer.Renderer.call(
|
||||
this,
|
||||
|
@ -89,7 +89,7 @@ R3.D3.Composer.Renderer.prototype.createInstance = function() {
|
|||
}
|
||||
);
|
||||
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
|
@ -1,2 +0,0 @@
|
|||
//#define EDITOR__
|
||||
//#define DEBUG__
|
|
@ -1,2 +0,0 @@
|
|||
//#define RUNTIME__
|
||||
//#define DEBUG__
|
132
gulpfile.js
132
gulpfile.js
|
@ -21,86 +21,19 @@ code += '\t\tthis.apiComponent.register,\n';
|
|||
code += '\t\tthis.apiComponent.selected\n';
|
||||
code += '\t)';
|
||||
|
||||
var code2 = 'if (R3.Utils.UndefinedOrNull(apiGeometryBuffer)) {\n';
|
||||
code2 += '\t\tapiGeometryBuffer = {};\n';
|
||||
code2 += '\t}\n';
|
||||
code2 += '\tthis.apiGeometryBuffer = apiGeometryBuffer;\n';
|
||||
code2 += '\n';
|
||||
code2 += '\tR3.D3.API.Geometry.Buffer.call(\n';
|
||||
var code2 = 'R3.D3.API.Geometry.Buffer.call(\n';
|
||||
code2 += '\t\tthis,\n';
|
||||
code2 += '\t\tthis.apiGeometryBuffer,\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\tapiComponent\n';
|
||||
code2 += '\t)';
|
||||
|
||||
var code3 = 'if (R3.Utils.UndefinedOrNull(apiGeometryNormal)) {\n';
|
||||
code3 += '\t\tapiGeometryNormal = {};\n';
|
||||
code3 += '\t}\n';
|
||||
code3 += '\tthis.apiGeometryNormal = apiGeometryNormal;\n';
|
||||
code3 += '\n';
|
||||
code3 += '\tR3.D3.API.Geometry.Normal.call(\n';
|
||||
var code3 = 'R3.D3.API.Geometry.Normal.call(\n';
|
||||
code3 += '\t\tthis,\n';
|
||||
code3 += '\t\tthis.apiGeometryNormal,\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\tapiComponent\n';
|
||||
code3 += '\t)';
|
||||
|
||||
var code4 = 'if (R3.Utils.UndefinedOrNull(apiMaterial)) {\n';
|
||||
code4 += '\t\tapiMaterial = {};\n';
|
||||
code4 += '\t}\n';
|
||||
code4 += '\tthis.apiMaterial = apiMaterial;\n';
|
||||
code4 += '\n';
|
||||
code4 += '\tR3.D3.API.Material.call(\n';
|
||||
var code4 = 'R3.D3.API.Material.call(\n';
|
||||
code4 += '\t\tthis,\n';
|
||||
code4 += '\t\tthis.apiMaterial,\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\tapiComponent\n';
|
||||
code4 += '\t)';
|
||||
|
||||
var code5 = 'if (R3.Utils.UndefinedOrNull(apiTexture)) {\n';
|
||||
|
@ -144,6 +77,7 @@ code6 += '\tthis.apiComponent = apiComponent;\n';
|
|||
code6 += '\n';
|
||||
code6 += '\tthis.graphics\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.stats\t\t= null;\n';
|
||||
code6 += '\n';
|
||||
|
@ -152,23 +86,59 @@ code6 += '\t\tR3.Event.GET_RUNTIME,\n';
|
|||
code6 += '\t\tfunction(runtime) {\n';
|
||||
code6 += '\t\t\tthis.graphics\t= runtime.graphics;\n';
|
||||
code6 += '\t\t\tthis.physics\t= runtime.physics;\n';
|
||||
code6 += '\t\t\tthis.coder\t= runtime.coder;\n';
|
||||
code6 += '\t\t\tthis.coder\t\t= runtime.coder;\n';
|
||||
code6 += '\t\t\tthis.gui\t\t= runtime.gui;\n';
|
||||
code6 += '\t\t\tthis.stats\t\t= runtime.stats;\n';
|
||||
code6 += '\t\t}.bind(this)\n';
|
||||
code6 += '\t)';
|
||||
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() {
|
||||
return gulp.src('./src/r3-*.js')
|
||||
.pipe(sort())
|
||||
.pipe(concat('r3.js'))
|
||||
.pipe(replace('__DATE__', new Date().toString()))
|
||||
.pipe(replace('__API_COMPONENT_MACRO__', code))
|
||||
.pipe(replace('__API_GEOMETRY_BUFFER_MACRO__', code2))
|
||||
.pipe(replace('__API_GEOMETRY_NORMAL_MACRO__', code3))
|
||||
.pipe(replace('__API_MATERIAL_MACRO__', code4))
|
||||
.pipe(replace('__API_TEXTURE_MACRO__', code5))
|
||||
.pipe(replace('__RUNTIME_COMPONENT_MACRO__', code6))
|
||||
.pipe(replace('__API_COMPONENT__', code))
|
||||
.pipe(replace('__API_GEOMETRY_BUFFER__', code2))
|
||||
.pipe(replace('__API_GEOMETRY_NORMAL__', code3))
|
||||
.pipe(replace('__API_MATERIAL__', code4))
|
||||
.pipe(replace('__API_TEXTURE__', code5))
|
||||
.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({
|
||||
ext:{
|
||||
src:'.js',
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"dependencies": {
|
||||
"cannon": "^0.6.2",
|
||||
"gulp-cli": "^2.0.1",
|
||||
"three": "*"
|
||||
"three": "^0.107.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "git://github.com/gulpjs/gulp.git#6d71a658c61edb3090221579d8f97dbe086ba2ed",
|
||||
|
@ -17,7 +17,7 @@
|
|||
"gulp-minify": "*",
|
||||
"gulp-sort": "*",
|
||||
"gulp-string-replace": "*",
|
||||
"lodash": "^4.17.2",
|
||||
"npm": "^6.4.1"
|
||||
"lodash": "^4.17.15",
|
||||
"npm": "^6.11.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
?>
|
|
@ -1,3 +1,5 @@
|
|||
console.log("Loading R3 compiled at: __DATE__");
|
||||
|
||||
/**
|
||||
* R3 Namespace
|
||||
*/
|
||||
|
@ -35,7 +37,3 @@ if (typeof R3.D3.Runtime === 'undefined') {
|
|||
R3.D3.Runtime = function(){};
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets injected by gulp
|
||||
*/
|
||||
console.log("Loading R3 compiled at: __DATE__");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,131 +15,132 @@ R3.Event.OnceSubscriptions = {};
|
|||
/**
|
||||
* Events we can subscribe to and emit
|
||||
*/
|
||||
R3.Event.WINDOW_RESIZE = 0x1;
|
||||
R3.Event.PARENT_SCENE_CHANGE = 0x2;
|
||||
R3.Event.EXCLUDE_FROM_ENVIRONMENT = 0x3;
|
||||
R3.Event.INSTANCE_CLONED = 0x4;
|
||||
R3.Event.LOAD_IMAGE = 0x5;
|
||||
R3.Event.NEW_ENTITY = 0x6;
|
||||
R3.Event.MATERIAL_TYPE_CHANGED = 0x7;
|
||||
R3.Event.SAVE_COMPONENT = 0x8;
|
||||
R3.Event.SAVE_COMPONENT_ERROR = 0x9;
|
||||
R3.Event.COMPONENT_SAVED = 0xa;
|
||||
R3.Event.LOAD_COMPONENT = 0xb;
|
||||
R3.Event.LOAD_COMPONENT_ERROR = 0xc;
|
||||
R3.Event.LOGGED_IN = 0xd;
|
||||
R3.Event.COMPONENT_CREATED = 0xe;
|
||||
R3.Event.COMPONENT_CLONED = 0xf;
|
||||
R3.Event.TEXTURE_ANIMATED_CHANGE = 0x10;
|
||||
R3.Event.ANIMATE_TEXTURE_INSTANCE = 0x11;
|
||||
R3.Event.REMOVE_PARTICLE_ENGINE = 0x12;
|
||||
R3.Event.GAME_PAUSE = 0x13;
|
||||
R3.Event.SHADER_UPDATE = 0x14;
|
||||
R3.Event.PLAY_AUDIO = 0x15;
|
||||
R3.Event.MATERIAL_INSTANCE_UPDATED = 0x16;
|
||||
R3.Event.PAUSE_AUDIO = 0x17;
|
||||
R3.Event.MESH_INSTANCE_UPDATED = 0x18;
|
||||
R3.Event.STOP_AUDIO = 0x19;
|
||||
R3.Event.LIGHT_INSTANCE_UPDATED = 0x1a;
|
||||
R3.Event.DELETE_COMPONENT = 0x1b;
|
||||
R3.Event.COMPONENT_DOWNLOAD_COMPLETE = 0x1c;
|
||||
R3.Event.COMPONENTS_LINKED = 0x1d;
|
||||
R3.Event.UNRESOLVED_DEPENDENCIES_UPDATE = 0x1e;
|
||||
R3.Event.REGISTER_UPDATE = 0x1f;
|
||||
R3.Event.BUILD_GUI = 0x20;
|
||||
R3.Event.REMOVE_MESH = 0x21;
|
||||
R3.Event.MESH_SELECTED = 0x22;
|
||||
R3.Event.MESH_DESELECTED = 0x23;
|
||||
R3.Event.COMPONENT_REGISTER = 0x24;
|
||||
R3.Event.IMAGE_NOT_FOUND = 0x25;
|
||||
R3.Event.BLENDER_DATA_RECEIVED = 0x26;
|
||||
R3.Event.IMAGE_UPLOAD_COMPLETE = 0x27;
|
||||
R3.Event.REMOVE_COMPONENT = 0x28;
|
||||
R3.Event.KEY_DOWN = 0x29;
|
||||
R3.Event.KEY_UP = 0x2a;
|
||||
R3.Event.RENDER = 0x2b;
|
||||
R3.Event.EVENT_LIST = 0x2c;
|
||||
R3.Event.COMPILE_SUCCESS = 0x2d;
|
||||
R3.Event.COMPILE_FAILED = 0x2e;
|
||||
R3.Event.TEXTURE_INSTANCE_UPDATED = 0x2f;
|
||||
R3.Event.EVENT_ID_UPDATE = 0x30;
|
||||
R3.Event.MATERIAL_TEXTURES_UPDATED = 0x31;
|
||||
R3.Event.DELETE_COMPONENT_ERROR = 0x32;
|
||||
R3.Event.COMPONENT_DELETED = 0x33;
|
||||
R3.Event.COMPONENT_TYPES_FETCHED = 0x34;
|
||||
R3.Event.AUDIO_ENDED = 0x35;
|
||||
R3.Event.COMPONENT_LINKED = 0x36;
|
||||
R3.Event.DONE_SAVING = 0x37;
|
||||
R3.Event.BEFORE_RENDER = 0x38;
|
||||
R3.Event.AFTER_RENDER = 0x39;
|
||||
R3.Event.ARRAY_ITEM_ADDED = 0x3a;
|
||||
R3.Event.INSTANCE_CREATED = 0x3b;
|
||||
R3.Event.VISUALIZE = 0x3c;
|
||||
R3.Event.STOP_VISUALIZE = 0x3d;
|
||||
R3.Event.FETCH_COMPONENT_TYPES = 0x3e;
|
||||
R3.Event.FETCH_COMPONENTS = 0x3f;
|
||||
R3.Event.GET_API_URL = 0x40;
|
||||
R3.Event.GET_RUNTIME = 0x41;
|
||||
R3.Event.PARENT_WORLD_CHANGE = 0x42;
|
||||
R3.Event.ANIMATE = 0x43;
|
||||
R3.Event.ANIMATION_COMPILE_SUCCESS = 0x44;
|
||||
R3.Event.ANIMATION_COMPILE_FAILED = 0x45;
|
||||
R3.Event.SAVING = 0x46;
|
||||
R3.Event.GAME_OVER = 0x47;
|
||||
R3.Event.GAME_START = 0x48;
|
||||
R3.Event.TOUCH_START = 0x49;
|
||||
R3.Event.TOUCH_END = 0x4a;
|
||||
R3.Event.TOUCH_MOVE = 0x4b;
|
||||
R3.Event.TOUCH_CANCEL = 0x4c;
|
||||
R3.Event.GET_REMOTE_API_URL = 0x4d;
|
||||
R3.Event.COMPONENT_TYPES_UPDATE = 0x4e;
|
||||
R3.Event.PROJECT_LOADED = 0x4f;
|
||||
R3.Event.CAST_SOURCE_CHANGED = 0x50;
|
||||
R3.Event.RESOLVE_DEPENDENCIES = 0x51;
|
||||
R3.Event.NAME_UPDATE = 0x52;
|
||||
R3.Event.CANVAS_CHANGE = 0x53;
|
||||
R3.Event.AFTER_WINDOW_RESIZE = 0x54;
|
||||
R3.Event.LOAD_FONT = 0x55;
|
||||
R3.Event.FONT_NOT_FOUND = 0x56;
|
||||
R3.Event.STOP_ALL_AUDIO = 0x57;
|
||||
R3.Event.REGISTER_DEPENDENCIES = 0x58;
|
||||
R3.Event.GAME_LOADED = 0x59;
|
||||
R3.Event.COMPONENT_UPDATE = 0x5a;
|
||||
R3.Event.LOAD_PROGRESS = 0x5b;
|
||||
R3.Event.ENTITY_LOADED = 0x5c;
|
||||
R3.Event.MOUSE_DOWN = 0x5d;
|
||||
R3.Event.MOUSE_MOVE = 0x5e;
|
||||
R3.Event.MOUSE_WHEEL = 0x5f;
|
||||
R3.Event.MOUSE_UP = 0x60;
|
||||
R3.Event.PARTICLE_INSTANCE_UPDATED = 0x61;
|
||||
R3.Event.GAME_DATA = 0x62;
|
||||
R3.Event.PAUSE_ALL_AUDIO = 0x63;
|
||||
R3.Event.CONTINUE_ALL_AUDIO = 0x64;
|
||||
R3.Event.MUTE_AUDIO = 0x65;
|
||||
R3.Event.GAME_STARTED = 0x66;
|
||||
R3.Event.GAME_PAUSED = 0x67;
|
||||
R3.Event.GAME_RESUMED = 0x68;
|
||||
R3.Event.CUSTOM_GAME_START = 0x69;
|
||||
R3.Event.AUDIO_MUTED = 0x6a;
|
||||
R3.Event.AUDIO_UNMUTED = 0x6b;
|
||||
R3.Event.RECEIVE_DESTINATION_CHANGED = 0x6c;
|
||||
R3.Event.SELECTION_MODE_CHANGE = 0x6d;
|
||||
R3.Event.MESH_FACE_SELECTED = 0x6e;
|
||||
R3.Event.MESH_FACE_DESELECTED = 0x6f;
|
||||
R3.Event.BEFORE_WINDOW_RESIZE = 0x70;
|
||||
R3.Event.GET_WINDOW_SIZE = 0x71;
|
||||
R3.Event.GET_RENDER_CONFIGURATION = 0x72;
|
||||
R3.Event.SET_ACTIVE_RENDER_CONFIGURATION = 0x73;
|
||||
R3.Event.REPLACE_COMPONENT = 0x74;
|
||||
R3.Event.COMPONENT_REPLACED = 0x75;
|
||||
R3.Event.ENGINE_FIRED_PARTICLES_ZERO = 0x76;
|
||||
R3.Event.GET_DEFAULT_SCENE = 0x77;
|
||||
R3.Event.GET_DEFAULT_CAMERA = 0x78;
|
||||
R3.Event.GET_WEBSOCKET_CONFIG = 0x79;
|
||||
R3.Event.GET_PROJECT = 0x7a;
|
||||
R3.Event.GET_APPLICATION_MODE = 0x80;
|
||||
R3.Event.RENDERER_SIZE_CHANGE = 0x81;
|
||||
R3.Event.GET_REGISTER_FACES = 0x82;
|
||||
R3.Event.WINDOW_RESIZE = 0x1;
|
||||
R3.Event.PARENT_SCENE_CHANGE = 0x2;
|
||||
R3.Event.EXCLUDE_FROM_ENVIRONMENT = 0x3;
|
||||
R3.Event.INSTANCE_CLONED = 0x4;
|
||||
R3.Event.LOAD_IMAGE = 0x5;
|
||||
R3.Event.NEW_ENTITY = 0x6;
|
||||
R3.Event.MATERIAL_TYPE_CHANGED = 0x7;
|
||||
R3.Event.SAVE_COMPONENT = 0x8;
|
||||
R3.Event.SAVE_COMPONENT_ERROR = 0x9;
|
||||
R3.Event.COMPONENT_SAVED = 0xa;
|
||||
R3.Event.LOAD_COMPONENT = 0xb;
|
||||
R3.Event.LOAD_COMPONENT_ERROR = 0xc;
|
||||
R3.Event.LOGGED_IN = 0xd;
|
||||
R3.Event.COMPONENT_CREATED = 0xe;
|
||||
R3.Event.COMPONENT_CLONED = 0xf;
|
||||
R3.Event.TEXTURE_ANIMATED_CHANGE = 0x10;
|
||||
R3.Event.ANIMATE_TEXTURE_INSTANCE = 0x11;
|
||||
R3.Event.REMOVE_PARTICLE_ENGINE = 0x12;
|
||||
R3.Event.GAME_PAUSE = 0x13;
|
||||
R3.Event.SHADER_UPDATE = 0x14;
|
||||
R3.Event.PLAY_AUDIO = 0x15;
|
||||
R3.Event.MATERIAL_INSTANCE_UPDATED = 0x16;
|
||||
R3.Event.PAUSE_AUDIO = 0x17;
|
||||
R3.Event.MESH_INSTANCE_UPDATED = 0x18;
|
||||
R3.Event.STOP_AUDIO = 0x19;
|
||||
R3.Event.LIGHT_INSTANCE_UPDATED = 0x1a;
|
||||
R3.Event.DELETE_COMPONENT = 0x1b;
|
||||
R3.Event.COMPONENT_DOWNLOAD_COMPLETE = 0x1c;
|
||||
R3.Event.COMPONENTS_LINKED = 0x1d;
|
||||
R3.Event.UNRESOLVED_DEPENDENCIES_UPDATE = 0x1e;
|
||||
R3.Event.REGISTER_UPDATE = 0x1f;
|
||||
R3.Event.BUILD_GUI = 0x20;
|
||||
R3.Event.REMOVE_MESH = 0x21;
|
||||
R3.Event.MESH_SELECTED = 0x22;
|
||||
R3.Event.MESH_DESELECTED = 0x23;
|
||||
R3.Event.COMPONENT_REGISTER = 0x24;
|
||||
R3.Event.IMAGE_NOT_FOUND = 0x25;
|
||||
R3.Event.BLENDER_DATA_RECEIVED = 0x26;
|
||||
R3.Event.IMAGE_UPLOAD_COMPLETE = 0x27;
|
||||
R3.Event.REMOVE_COMPONENT = 0x28;
|
||||
R3.Event.KEY_DOWN = 0x29;
|
||||
R3.Event.KEY_UP = 0x2a;
|
||||
R3.Event.RENDER = 0x2b;
|
||||
R3.Event.EVENT_LIST = 0x2c;
|
||||
R3.Event.COMPILE_SUCCESS = 0x2d;
|
||||
R3.Event.COMPILE_FAILED = 0x2e;
|
||||
R3.Event.TEXTURE_INSTANCE_UPDATED = 0x2f;
|
||||
R3.Event.EVENT_ID_UPDATE = 0x30;
|
||||
R3.Event.MATERIAL_TEXTURES_UPDATED = 0x31;
|
||||
R3.Event.DELETE_COMPONENT_ERROR = 0x32;
|
||||
R3.Event.COMPONENT_DELETED = 0x33;
|
||||
R3.Event.COMPONENT_TYPES_FETCHED = 0x34;
|
||||
R3.Event.AUDIO_ENDED = 0x35;
|
||||
R3.Event.COMPONENT_LINKED = 0x36;
|
||||
R3.Event.DONE_SAVING = 0x37;
|
||||
R3.Event.BEFORE_RENDER = 0x38;
|
||||
R3.Event.AFTER_RENDER = 0x39;
|
||||
R3.Event.ARRAY_ITEM_ADDED = 0x3a;
|
||||
R3.Event.INSTANCE_CREATED = 0x3b;
|
||||
R3.Event.VISUALIZE = 0x3c;
|
||||
R3.Event.STOP_VISUALIZE = 0x3d;
|
||||
R3.Event.FETCH_COMPONENT_TYPES = 0x3e;
|
||||
R3.Event.FETCH_COMPONENTS = 0x3f;
|
||||
R3.Event.GET_API_URL = 0x40;
|
||||
R3.Event.GET_RUNTIME = 0x41;
|
||||
R3.Event.PARENT_WORLD_CHANGE = 0x42;
|
||||
R3.Event.ANIMATE = 0x43;
|
||||
R3.Event.ANIMATION_COMPILE_SUCCESS = 0x44;
|
||||
R3.Event.ANIMATION_COMPILE_FAILED = 0x45;
|
||||
R3.Event.SAVING = 0x46;
|
||||
R3.Event.GAME_OVER = 0x47;
|
||||
R3.Event.GAME_START = 0x48;
|
||||
R3.Event.TOUCH_START = 0x49;
|
||||
R3.Event.TOUCH_END = 0x4a;
|
||||
R3.Event.TOUCH_MOVE = 0x4b;
|
||||
R3.Event.TOUCH_CANCEL = 0x4c;
|
||||
R3.Event.GET_REMOTE_API_URL = 0x4d;
|
||||
R3.Event.COMPONENT_TYPES_UPDATE = 0x4e;
|
||||
R3.Event.PROJECT_LOADED = 0x4f;
|
||||
R3.Event.CAST_SOURCE_CHANGED = 0x50;
|
||||
R3.Event.RESOLVE_DEPENDENCIES = 0x51;
|
||||
R3.Event.NAME_UPDATE = 0x52;
|
||||
R3.Event.CANVAS_CHANGE = 0x53;
|
||||
R3.Event.AFTER_WINDOW_RESIZE = 0x54;
|
||||
R3.Event.LOAD_FONT = 0x55;
|
||||
R3.Event.FONT_NOT_FOUND = 0x56;
|
||||
R3.Event.STOP_ALL_AUDIO = 0x57;
|
||||
R3.Event.REGISTER_DEPENDENCIES = 0x58;
|
||||
R3.Event.GAME_LOADED = 0x59;
|
||||
R3.Event.COMPONENT_UPDATE = 0x5a;
|
||||
R3.Event.LOAD_PROGRESS = 0x5b;
|
||||
R3.Event.ENTITY_LOADED = 0x5c;
|
||||
R3.Event.MOUSE_DOWN = 0x5d;
|
||||
R3.Event.MOUSE_MOVE = 0x5e;
|
||||
R3.Event.MOUSE_WHEEL = 0x5f;
|
||||
R3.Event.MOUSE_UP = 0x60;
|
||||
R3.Event.PARTICLE_INSTANCE_UPDATED = 0x61;
|
||||
R3.Event.GAME_DATA = 0x62;
|
||||
R3.Event.PAUSE_ALL_AUDIO = 0x63;
|
||||
R3.Event.CONTINUE_ALL_AUDIO = 0x64;
|
||||
R3.Event.MUTE_AUDIO = 0x65;
|
||||
R3.Event.GAME_STARTED = 0x66;
|
||||
R3.Event.GAME_PAUSED = 0x67;
|
||||
R3.Event.GAME_RESUMED = 0x68;
|
||||
R3.Event.CUSTOM_GAME_START = 0x69;
|
||||
R3.Event.AUDIO_MUTED = 0x6a;
|
||||
R3.Event.AUDIO_UNMUTED = 0x6b;
|
||||
R3.Event.RECEIVE_DESTINATION_CHANGED = 0x6c;
|
||||
R3.Event.SELECTION_MODE_CHANGE = 0x6d;
|
||||
R3.Event.MESH_FACE_SELECTED = 0x6e;
|
||||
R3.Event.MESH_FACE_DESELECTED = 0x6f;
|
||||
R3.Event.BEFORE_WINDOW_RESIZE = 0x70;
|
||||
R3.Event.GET_WINDOW_SIZE = 0x71;
|
||||
R3.Event.GET_QUERY_API_URL = 0x72;
|
||||
//R3.Event.SET_ACTIVE_RENDER_CONFIGURATION = 0x73;
|
||||
R3.Event.REPLACE_COMPONENT = 0x74;
|
||||
R3.Event.COMPONENT_REPLACED = 0x75;
|
||||
R3.Event.ENGINE_FIRED_PARTICLES_ZERO = 0x76;
|
||||
R3.Event.GET_DEFAULT_SCENE = 0x77;
|
||||
R3.Event.GET_DEFAULT_CAMERA = 0x78;
|
||||
R3.Event.GET_WEBSOCKET_CONFIG = 0x79;
|
||||
R3.Event.GET_PROJECT = 0x7a;
|
||||
R3.Event.GET_APPLICATION_MODE = 0x80;
|
||||
R3.Event.RENDERER_SIZE_CHANGE = 0x81;
|
||||
R3.Event.GET_REGISTER_FACES = 0x82;
|
||||
R3.Event.GET_PROJECT_CANVAS = 0x83;
|
||||
|
||||
/**
|
||||
* Returns string name of event ID
|
||||
|
@ -275,6 +276,7 @@ R3.Event.GetEventName = function(number) {
|
|||
case 0x80 : return 'get_application_mode';
|
||||
case 0x81 : return 'renderer_size_change';
|
||||
case 0x82 : return 'get_register_faces';
|
||||
case 0x83 : return 'get_project_canvas';
|
||||
break;
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ R3.API.Component = function(
|
|||
}
|
||||
this.id = id;
|
||||
|
||||
this.componentType = this.getComponentType();
|
||||
this.componentType = R3.GetComponentType(this);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
};
|
|
@ -124,6 +124,23 @@ R3.Utils.StripImageExtension = function(imagePath) {
|
|||
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) {
|
||||
|
||||
if (dimension === 2) {
|
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,38 @@
|
|||
/**
|
||||
* R3.API.Box3
|
||||
* @param apiComponent
|
||||
* @param min
|
||||
* @param max
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Box3 = function(
|
||||
apiComponent,
|
||||
min,
|
||||
max
|
||||
apiComponent
|
||||
) {
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(min)) {
|
||||
min = new R3.API.Vector3();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.min)) {
|
||||
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)) {
|
||||
max = new R3.API.Vector3(1,1,1);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.max)) {
|
||||
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);
|
||||
|
|
|
@ -1,62 +1,55 @@
|
|||
/**
|
||||
* R3.API.Canvas
|
||||
* @param apiComponent
|
||||
* @param autoUpdateSize
|
||||
* @param width
|
||||
* @param height
|
||||
* @param offset
|
||||
* @param tabIndex
|
||||
* @param texts
|
||||
* @param textBaseline
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Canvas = function(
|
||||
apiComponent,
|
||||
autoUpdateSize,
|
||||
width,
|
||||
height,
|
||||
offset,
|
||||
tabIndex,
|
||||
texts,
|
||||
textBaseline
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
||||
autoUpdateSize = true;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
|
||||
apiComponent.autoUpdateSize = true;
|
||||
}
|
||||
this.autoUpdateSize = autoUpdateSize;
|
||||
this.autoUpdateSize = apiComponent.autoUpdateSize;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(width)) {
|
||||
width = 512;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.width)) {
|
||||
apiComponent.width = 512;
|
||||
}
|
||||
this.width = width;
|
||||
this.width = apiComponent.width;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(height)) {
|
||||
height = 512;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
|
||||
apiComponent.height = 512;
|
||||
}
|
||||
this.height = height;
|
||||
this.height = apiComponent.height;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(offset)) {
|
||||
offset = new R3.API.Vector2(0,0);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.offset)) {
|
||||
apiComponent.offset = new R3.API.Vector2(
|
||||
{
|
||||
parent : this,
|
||||
register : true
|
||||
},
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
this.offset = offset;
|
||||
this.offset = apiComponent.offset;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(tabIndex)) {
|
||||
tabIndex = 1;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.tabIndex)) {
|
||||
apiComponent.tabIndex = 1;
|
||||
}
|
||||
this.tabIndex = tabIndex;
|
||||
this.tabIndex = apiComponent.tabIndex;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(texts)) {
|
||||
texts = [];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.texts)) {
|
||||
apiComponent.texts = [];
|
||||
}
|
||||
this.texts = texts;
|
||||
this.texts = apiComponent.texts;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(textBaseline)) {
|
||||
textBaseline = 'middle';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.textBaseline)) {
|
||||
apiComponent.textBaseline = 'middle';
|
||||
}
|
||||
this.textBaseline = textBaseline;
|
||||
this.textBaseline = apiComponent.textBaseline;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ R3.API.Clock = function(
|
|||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,37 +1,35 @@
|
|||
/**
|
||||
* API Color
|
||||
* @param parent
|
||||
* @param r
|
||||
* @param g
|
||||
* @param b
|
||||
* @param a
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Color = function(
|
||||
r,
|
||||
g,
|
||||
b,
|
||||
a
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(r)) {
|
||||
r = 1;
|
||||
}
|
||||
this.r = r;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(g)) {
|
||||
g = 1;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.r)) {
|
||||
apiComponent.r = 1;
|
||||
}
|
||||
this.g = g;
|
||||
this.r = apiComponent.r;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(b)) {
|
||||
b = 1;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.g)) {
|
||||
apiComponent.g = 1;
|
||||
}
|
||||
this.b = b;
|
||||
this.g = apiComponent.g;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(a)) {
|
||||
a = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.b)) {
|
||||
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;
|
||||
|
|
|
@ -9,16 +9,20 @@ R3.API.Controls = function(
|
|||
canvas
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(canvas)) {
|
||||
/**
|
||||
* Try to attach the controls to the parent canvas
|
||||
* @type {null}
|
||||
*/
|
||||
canvas = this.getFirstParent(R3.API.Canvas);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.canvas)) {
|
||||
R3.Event.Emit(
|
||||
R3.Event.GET_PROJECT_CANVAS,
|
||||
{
|
||||
controls : this
|
||||
},
|
||||
function(projectCanvas) {
|
||||
apiComponent.canvas = projectCanvas;
|
||||
}
|
||||
)
|
||||
}
|
||||
this.canvas = canvas;
|
||||
this.canvas = apiComponent.canvas;
|
||||
};
|
||||
|
||||
R3.API.Controls.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -3,25 +3,20 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.API.Controls.D3 = function(
|
||||
apiControls,
|
||||
camera
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiControls)) {
|
||||
apiControls = {};
|
||||
}
|
||||
|
||||
R3.API.Controls.call(
|
||||
this,
|
||||
apiControls,
|
||||
apiControls.canvas
|
||||
apiComponent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(camera)) {
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.camera)) {
|
||||
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);
|
|
@ -1,27 +1,25 @@
|
|||
/**
|
||||
* @param apiControlsD3
|
||||
* @param raycaster
|
||||
* R3.API.Controls.D3.Editor
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Controls.D3.Editor = function(
|
||||
apiControlsD3,
|
||||
raycaster
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
|
||||
apiControlsD3 = {};
|
||||
}
|
||||
|
||||
R3.API.Controls.D3.call(
|
||||
this,
|
||||
apiControlsD3,
|
||||
apiControlsD3.camera
|
||||
apiComponent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(raycaster)) {
|
||||
raycaster = new R3.D3.API.Raycaster();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.raycaster)) {
|
||||
apiComponent.raycaster = new R3.D3.API.Raycaster(
|
||||
{
|
||||
parent : this
|
||||
}
|
||||
);
|
||||
}
|
||||
this.raycaster = raycaster;
|
||||
this.raycaster = apiComponent.raycaster;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -1,126 +1,91 @@
|
|||
/**
|
||||
* R3.API.Controls.D3.Orbit
|
||||
* @param apiControlsD3
|
||||
* @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
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Controls.D3.Orbit = function(
|
||||
apiControlsD3,
|
||||
target,
|
||||
enabled,
|
||||
minPolarAngle,
|
||||
maxPolarAngle,
|
||||
enableDamping,
|
||||
dampingFactor,
|
||||
enableZoom,
|
||||
zoomSpeed,
|
||||
enableRotate,
|
||||
rotateSpeed,
|
||||
enablePan,
|
||||
keyPanSpeed,
|
||||
autoRotate,
|
||||
autoRotateSpeed,
|
||||
enableKeys
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
|
||||
apiControlsD3 = {};
|
||||
}
|
||||
|
||||
R3.API.Controls.D3.call(
|
||||
this,
|
||||
apiControlsD3,
|
||||
apiControlsD3.camera
|
||||
apiComponent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(target)) {
|
||||
target = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.target)) {
|
||||
apiComponent.target = null;
|
||||
}
|
||||
this.target = target;
|
||||
this.target = apiComponent.target;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enabled)) {
|
||||
enabled = true;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.enabled)) {
|
||||
apiComponent.enabled = true;
|
||||
}
|
||||
this.enabled = enabled;
|
||||
this.enabled = apiComponent.enabled;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(minPolarAngle)) {
|
||||
minPolarAngle = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.minPolarAngle)) {
|
||||
apiComponent.minPolarAngle = 0;
|
||||
}
|
||||
this.minPolarAngle = minPolarAngle;
|
||||
this.minPolarAngle = apiComponent.minPolarAngle;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(maxPolarAngle)) {
|
||||
maxPolarAngle = Math.PI;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.maxPolarAngle)) {
|
||||
apiComponent.maxPolarAngle = Math.PI;
|
||||
}
|
||||
this.maxPolarAngle = maxPolarAngle;
|
||||
this.maxPolarAngle = apiComponent.maxPolarAngle;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enableDamping)) {
|
||||
enableDamping = false;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.enableDamping)) {
|
||||
apiComponent.enableDamping = false;
|
||||
}
|
||||
this.enableDamping = enableDamping;
|
||||
this.enableDamping = apiComponent.enableDamping;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(dampingFactor)) {
|
||||
dampingFactor = 0.25;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.dampingFactor)) {
|
||||
apiComponent.dampingFactor = 0.25;
|
||||
}
|
||||
this.dampingFactor = dampingFactor;
|
||||
this.dampingFactor = apiComponent.dampingFactor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enableZoom)) {
|
||||
enableZoom = true;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.enableZoom)) {
|
||||
apiComponent.enableZoom = true;
|
||||
}
|
||||
this.enableZoom = enableZoom;
|
||||
this.enableZoom = apiComponent.enableZoom;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(zoomSpeed)) {
|
||||
zoomSpeed = 1.0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.zoomSpeed)) {
|
||||
apiComponent.zoomSpeed = 1.0;
|
||||
}
|
||||
this.zoomSpeed = zoomSpeed;
|
||||
this.zoomSpeed = apiComponent.zoomSpeed;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enableRotate)) {
|
||||
enableRotate = true;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.enableRotate)) {
|
||||
apiComponent.enableRotate = true;
|
||||
}
|
||||
this.enableRotate = enableRotate;
|
||||
this.enableRotate = apiComponent.enableRotate;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(rotateSpeed)) {
|
||||
rotateSpeed = 1.0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.rotateSpeed)) {
|
||||
apiComponent.rotateSpeed = 1.0;
|
||||
}
|
||||
this.rotateSpeed = rotateSpeed;
|
||||
this.rotateSpeed = apiComponent.rotateSpeed;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enablePan)) {
|
||||
enablePan = true;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.enablePan)) {
|
||||
apiComponent.enablePan = true;
|
||||
}
|
||||
this.enablePan = enablePan;
|
||||
this.enablePan = apiComponent.enablePan;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(keyPanSpeed)) {
|
||||
keyPanSpeed = 7.0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.keyPanSpeed)) {
|
||||
apiComponent.keyPanSpeed = 7.0;
|
||||
}
|
||||
this.keyPanSpeed = keyPanSpeed;
|
||||
this.keyPanSpeed = apiComponent.keyPanSpeed;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoRotate)) {
|
||||
autoRotate = false;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.autoRotate)) {
|
||||
apiComponent.autoRotate = false;
|
||||
}
|
||||
this.autoRotate = autoRotate;
|
||||
this.autoRotate = apiComponent.autoRotate;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoRotateSpeed)) {
|
||||
autoRotateSpeed = 2.0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.autoRotateSpeed)) {
|
||||
apiComponent.autoRotateSpeed = 2.0;
|
||||
}
|
||||
this.autoRotateSpeed = autoRotateSpeed;
|
||||
this.autoRotateSpeed = apiComponent.autoRotateSpeed;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enableKeys)) {
|
||||
enableKeys = false;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.enableKeys)) {
|
||||
apiComponent.enableKeys = false;
|
||||
}
|
||||
this.enableKeys = enableKeys;
|
||||
this.enableKeys = apiComponent.enableKeys;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/**
|
||||
* @param apiControls
|
||||
* R3.API.Controls.Keyboard
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Controls.Keyboard = function(
|
||||
apiControls
|
||||
apiComponent
|
||||
) {
|
||||
R3.API.Controls.call(
|
||||
this,
|
||||
apiControls,
|
||||
apiControls.canvas
|
||||
apiComponent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/**
|
||||
* @param apiControls
|
||||
* R3.API.Controls.Mouse
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Controls.Mouse = function(
|
||||
apiControls
|
||||
apiComponent
|
||||
) {
|
||||
R3.API.Controls.call(
|
||||
this,
|
||||
apiControls,
|
||||
apiControls.canvas
|
||||
apiComponent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ R3.API.Controls.Touch = function(
|
|||
apiControls.canvas
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(sensitivity)) {
|
||||
sensitivity = 5;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.sensitivity)) {
|
||||
apiComponent.sensitivity = 5;
|
||||
}
|
||||
this.sensitivity = sensitivity;
|
||||
this.sensitivity = apiComponent.sensitivity;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
/**
|
||||
* R3.API.Curve
|
||||
* @param apiComponent
|
||||
* @param arcLenghDivisions
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Curve = function(
|
||||
apiComponent,
|
||||
arcLenghDivisions
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(arcLenghDivisions)) {
|
||||
arcLenghDivisions = 200;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.arcLenghDivisions)) {
|
||||
apiComponent.arcLenghDivisions = 200;
|
||||
}
|
||||
this.arcLenghDivisions = arcLenghDivisions;
|
||||
this.arcLenghDivisions = apiComponent.arcLenghDivisions;
|
||||
|
||||
};
|
||||
|
||||
R3.API.Curve.prototype = Object.create(R3.API.Curve.prototype);
|
||||
|
|
|
@ -10,10 +10,10 @@ R3.API.Curve.Path = function(
|
|||
curves,
|
||||
autoClose
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(apiCurve)) {
|
||||
apiCurve = {}
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.apiCurve)) {
|
||||
apiComponent.apiCurve = {}
|
||||
}
|
||||
this.apiCurve = apiCurve;
|
||||
this.apiCurve = apiComponent.apiCurve;
|
||||
|
||||
R3.API.Curve.call(
|
||||
this,
|
||||
|
@ -21,15 +21,15 @@ R3.API.Curve.Path = function(
|
|||
apiCurve.arcLenghDivisions
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(curves)) {
|
||||
curves = [];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.curves)) {
|
||||
apiComponent.curves = [];
|
||||
}
|
||||
this.curves = curves;
|
||||
this.curves = apiComponent.curves;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClose)) {
|
||||
autoClose = false;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.autoClose)) {
|
||||
apiComponent.autoClose = false;
|
||||
}
|
||||
this.autoClose = autoClose;
|
||||
this.autoClose = apiComponent.autoClose;
|
||||
};
|
||||
|
||||
R3.API.Curve.Path.prototype = Object.create(R3.API.Curve.prototype);
|
|
@ -9,10 +9,10 @@ R3.API.Curve.Path.D2 = function(
|
|||
points
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiCurvePath)) {
|
||||
apiCurvePath = {}
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.apiCurvePath)) {
|
||||
apiComponent.apiCurvePath = {}
|
||||
}
|
||||
this.apiCurvePath = apiCurvePath;
|
||||
this.apiCurvePath = apiComponent.apiCurvePath;
|
||||
|
||||
R3.API.Curve.Path.call(
|
||||
this,
|
||||
|
@ -21,10 +21,10 @@ R3.API.Curve.Path.D2 = function(
|
|||
apiCurvePath.autoClose
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(points)) {
|
||||
points = [];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.points)) {
|
||||
apiComponent.points = [];
|
||||
}
|
||||
this.points = points;
|
||||
this.points = apiComponent.points;
|
||||
|
||||
};
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
R3.API.Curve.Path.D2.Shape = function(
|
||||
apiCurvePathD2
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(apiCurvePathD2)) {
|
||||
apiCurvePathD2 = {};
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.apiCurvePathD2)) {
|
||||
apiComponent.apiCurvePathD2 = {};
|
||||
}
|
||||
|
||||
R3.API.Curve.Path.call(
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -1,20 +1,18 @@
|
|||
/**
|
||||
* API DomElement
|
||||
* @param apiComponent
|
||||
* @param domElementId
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.DomElement = function(
|
||||
apiComponent,
|
||||
domElementId
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(domElementId)) {
|
||||
domElementId = '';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.domElementId)) {
|
||||
apiComponent.domElementId = '';
|
||||
}
|
||||
this.domElementId = domElementId;
|
||||
this.domElementId = apiComponent.domElementId;
|
||||
};
|
||||
|
||||
R3.API.DomElement.prototype = Object.create(R3.API.Component.prototype);
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -1,20 +1,18 @@
|
|||
/**
|
||||
* Entity API Object (for storing / loading entities to and from API)
|
||||
* R3.API.Entity
|
||||
* @param apiComponent
|
||||
* @param components R3.API.Component[]
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Entity = function(
|
||||
apiComponent,
|
||||
components
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(components)) {
|
||||
components = [];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.components)) {
|
||||
apiComponent.components = [];
|
||||
}
|
||||
this.components = components;
|
||||
this.components = apiComponent.components;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
|
@ -1,20 +1,18 @@
|
|||
/**
|
||||
* R3.D3.API.Font
|
||||
* R3.API.Font
|
||||
* @param apiComponent
|
||||
* @param path - Relative to API URL
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Font = function(
|
||||
apiComponent,
|
||||
path
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(path)) {
|
||||
path = '';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.path)) {
|
||||
apiComponent.path = '';
|
||||
}
|
||||
this.path = path;
|
||||
this.path = apiComponent.path;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -1,34 +1,28 @@
|
|||
/**
|
||||
* R3.API.Group
|
||||
* @constructor
|
||||
* @param apiComponent
|
||||
* @param start
|
||||
* @param count
|
||||
* @param materialIndex
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Group = function(
|
||||
apiComponent,
|
||||
start,
|
||||
count,
|
||||
materialIndex
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(start)) {
|
||||
start = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.start)) {
|
||||
apiComponent.start = 0;
|
||||
}
|
||||
this.start = start;
|
||||
this.start = apiComponent.start;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(count)) {
|
||||
count = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.count)) {
|
||||
apiComponent.count = 0;
|
||||
}
|
||||
this.count = count;
|
||||
this.count = apiComponent.count;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(materialIndex)) {
|
||||
materialIndex = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.materialIndex)) {
|
||||
apiComponent.materialIndex = 0;
|
||||
}
|
||||
this.materialIndex = materialIndex;
|
||||
this.materialIndex = apiComponent.materialIndex;
|
||||
};
|
||||
|
||||
R3.API.Group.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
/**
|
||||
* Raw GUI API object - should always correspond with the GUI Schema
|
||||
* @param apiComponent
|
||||
* @param domElement
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.GUI = function(
|
||||
apiComponent,
|
||||
domElement
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(domElement)) {
|
||||
domElement = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.domElement)) {
|
||||
apiComponent.domElement = null;
|
||||
}
|
||||
this.domElement = domElement;
|
||||
this.domElement = apiComponent.domElement;
|
||||
};
|
||||
|
||||
R3.API.GUI.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,75 +1,61 @@
|
|||
/**
|
||||
* R3.API.Image
|
||||
* @param apiComponent
|
||||
* @param fileName
|
||||
* @param extension
|
||||
* @param path
|
||||
* @param contentType
|
||||
* @param size
|
||||
* @param width
|
||||
* @param height
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Image = function(
|
||||
apiComponent,
|
||||
fileName,
|
||||
extension,
|
||||
path,
|
||||
contentType,
|
||||
size,
|
||||
width,
|
||||
height
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(fileName)) {
|
||||
fileName = R3.Utils.LowerUnderscore(name);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.fileName)) {
|
||||
apiComponent.fileName = R3.Utils.LowerUnderscore(name);
|
||||
}
|
||||
this.fileName = fileName;
|
||||
this.fileName = apiComponent.fileName;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(extension)) {
|
||||
extension = '.unknown';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.extension)) {
|
||||
apiComponent.extension = '.unknown';
|
||||
}
|
||||
this.extension = extension;
|
||||
this.extension = apiComponent.extension;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(path)) {
|
||||
path = '/';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.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)) {
|
||||
contentType = 'image/png';
|
||||
apiComponent.contentType = 'image/png';
|
||||
}
|
||||
|
||||
if (this.extension.match(/(jpg|jpeg)$/i)) {
|
||||
contentType = 'image/jpeg';
|
||||
apiComponent.contentType = 'image/jpeg';
|
||||
}
|
||||
|
||||
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)) {
|
||||
size = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.size)) {
|
||||
apiComponent.size = 0;
|
||||
}
|
||||
this.size = size;
|
||||
this.size = apiComponent.size;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(width)) {
|
||||
width = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.width)) {
|
||||
apiComponent.width = 0;
|
||||
}
|
||||
this.width = width;
|
||||
this.width = apiComponent.width;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(height)) {
|
||||
height = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
|
||||
apiComponent.height = 0;
|
||||
}
|
||||
this.height = height;
|
||||
this.height = apiComponent.height;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,89 +1,165 @@
|
|||
/**
|
||||
* Api Matrix 4
|
||||
* @param row0 R3.API.Vector4
|
||||
* @param row1 R3.API.Vector4
|
||||
* @param row2 R3.API.Vector4
|
||||
* @param row3 R3.API.Vector4
|
||||
* R3.API.Matrix4
|
||||
* @param apiComponent
|
||||
*
|
||||
* @property rows [R3.API.Vector4]
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Matrix4 = function ApiMatrix4(
|
||||
row0,
|
||||
row1,
|
||||
row2,
|
||||
row3
|
||||
R3.API.Matrix4 = function (
|
||||
apiComponent
|
||||
) {
|
||||
this.rows = [];
|
||||
__DEREGISTER_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(row0)) {
|
||||
row0 = new R3.API.Vector4(1, 0, 0, 0);
|
||||
__API_COMPONENT__;
|
||||
|
||||
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) {
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
R3.API.Matrix4.prototype.rotationMatrixY = function(radians) {
|
||||
|
||||
this.identity();
|
||||
|
||||
this.rows[0] = new R3.API.Vector4(
|
||||
Math.cos(radians),
|
||||
0,
|
||||
Math.sin(radians),
|
||||
0
|
||||
{
|
||||
parent : this,
|
||||
register : this.register,
|
||||
x : Math.cos(radians),
|
||||
y : 0,
|
||||
z : Math.sin(radians),
|
||||
w : 0
|
||||
}
|
||||
);
|
||||
|
||||
this.rows[2] = new R3.API.Vector4(
|
||||
-1 * Math.sin(radians),
|
||||
0,
|
||||
Math.cos(radians),
|
||||
0
|
||||
{
|
||||
parent : this,
|
||||
register : this.register,
|
||||
x : -1 * Math.sin(radians),
|
||||
y : 0,
|
||||
z : Math.cos(radians),
|
||||
w : 0
|
||||
}
|
||||
);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
R3.API.Matrix4.prototype.rotationMatrixZ = function(radians) {
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -108,25 +184,48 @@ R3.API.Matrix4.prototype.rotateZ = function(radians, point) {
|
|||
R3.API.Matrix4.prototype.multiply = function(mvp) {
|
||||
if (mvp instanceof R3.API.Quaternion || mvp instanceof R3.API.Vector4) {
|
||||
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,
|
||||
this.rows[2].x * mvp.x + this.rows[2].y * mvp.y + this.rows[2].z * mvp.z + this.rows[2].w * mvp.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
|
||||
{
|
||||
parent : this,
|
||||
register : this.register,
|
||||
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) {
|
||||
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,
|
||||
this.rows[2].x * mvp.x + this.rows[2].y * mvp.y + this.rows[2].z * mvp.z
|
||||
{
|
||||
parent : this,
|
||||
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() {
|
||||
this.rows = [
|
||||
new R3.API.Vector4(1, 0, 0, 0),
|
||||
new R3.API.Vector4(0, 1, 0, 0),
|
||||
new R3.API.Vector4(0, 0, 1, 0),
|
||||
new R3.API.Vector4(0, 0, 0, 1)
|
||||
];
|
||||
|
||||
this.rows[0].x = 1;
|
||||
this.rows[0].y = 0;
|
||||
this.rows[0].z = 0;
|
||||
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;
|
||||
|
||||
};
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
/**
|
||||
* R3.API.Mouse
|
||||
* @param apiComponent
|
||||
* @param x
|
||||
* @param y
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Mouse = function(
|
||||
apiComponent,
|
||||
x,
|
||||
y
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
x = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
|
||||
apiComponent.x = 0;
|
||||
}
|
||||
this.x = x;
|
||||
this.x = apiComponent.x;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(y)) {
|
||||
y = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
|
||||
apiComponent.y = 0;
|
||||
}
|
||||
this.y = y;
|
||||
this.y = apiComponent.y;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,27 +1,31 @@
|
|||
/**
|
||||
* R3.API.Plane
|
||||
* @param apiComponent
|
||||
* @param normal
|
||||
* @param constant
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Plane = function(
|
||||
apiComponent,
|
||||
normal,
|
||||
constant
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(normal)) {
|
||||
normal = new R3.API.Vector3(1,0,0);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.normal)) {
|
||||
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)) {
|
||||
constant = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.constant)) {
|
||||
apiComponent.constant = 0;
|
||||
}
|
||||
this.constant = constant;
|
||||
this.constant = apiComponent.constant;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,56 +1,51 @@
|
|||
/**
|
||||
* API Project
|
||||
* R3.API.Project
|
||||
* @param apiComponent
|
||||
* @param users
|
||||
* @param isPublic
|
||||
* @param entities
|
||||
* @param renderers
|
||||
* @param renderTargets
|
||||
* @param cameras
|
||||
* @param audios
|
||||
* @param applicationMode
|
||||
*
|
||||
* @property users
|
||||
* @property isPublic
|
||||
* @property entities
|
||||
* @property renderers
|
||||
* @property renderTargets
|
||||
* @property cameras
|
||||
* @property controls
|
||||
* @property audios
|
||||
* @property applicationMode
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Project = function(
|
||||
apiComponent,
|
||||
users,
|
||||
isPublic,
|
||||
entities,
|
||||
renderers,
|
||||
renderTargets,
|
||||
cameras,
|
||||
audios,
|
||||
applicationMode
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__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');
|
||||
}
|
||||
this.users = users;
|
||||
this.users = apiComponent.users;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(isPublic)) {
|
||||
isPublic = true;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.isPublic)) {
|
||||
apiComponent.isPublic = true;
|
||||
}
|
||||
this.isPublic = isPublic;
|
||||
this.isPublic = apiComponent.isPublic;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(entities)) {
|
||||
entities = [];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.entities)) {
|
||||
apiComponent.entities = [];
|
||||
}
|
||||
this.entities = entities;
|
||||
this.entities = apiComponent.entities;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderers)) {
|
||||
renderers = [new R3.API.Renderer.D3()];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.renderers)) {
|
||||
apiComponent.renderers = [new R3.API.Renderer.D3()];
|
||||
}
|
||||
this.renderers = renderers;
|
||||
this.renderers = apiComponent.renderers;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderTargets)) {
|
||||
renderTargets = [];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.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(
|
||||
{
|
||||
name : 'Edit Camera'
|
||||
|
@ -61,30 +56,35 @@ R3.API.Project = function(
|
|||
name : 'Run Camera'
|
||||
}
|
||||
);
|
||||
cameras = [editCamera, runCamera];
|
||||
apiComponent.cameras = [editCamera, runCamera];
|
||||
}
|
||||
this.cameras = cameras;
|
||||
this.cameras = apiComponent.cameras;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(audios)) {
|
||||
audios = [];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.controls)) {
|
||||
apiComponent.controls = [];
|
||||
}
|
||||
this.audios = audios;
|
||||
this.controls = apiComponent.controls;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(applicationMode)) {
|
||||
applicationMode = R3.API.Project.APPLICATION_MODE_EDIT;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.audios)) {
|
||||
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.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_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.RENDER_TARGET_INDEX_NONE = -0x1;
|
|
@ -1,53 +1,55 @@
|
|||
/**
|
||||
* Quaternion
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param w
|
||||
* @param axis
|
||||
* @param angle
|
||||
* R3.API.Quaternion
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Quaternion = function(
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
w,
|
||||
axis,
|
||||
angle
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
x = 0;
|
||||
}
|
||||
this.x = x;
|
||||
__DEREGISTER_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(y)) {
|
||||
y = 0;
|
||||
}
|
||||
this.y = y;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(z)) {
|
||||
z = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
|
||||
apiComponent.x = 0;
|
||||
}
|
||||
this.z = z;
|
||||
this.x = apiComponent.x;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(w)) {
|
||||
w = 1;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
|
||||
apiComponent.y = 0;
|
||||
}
|
||||
this.w = w;
|
||||
this.y = apiComponent.y;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(axis)) {
|
||||
axis = new R3.API.Vector3();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.z)) {
|
||||
apiComponent.z = 0;
|
||||
}
|
||||
this.axis = axis;
|
||||
this.z = apiComponent.z;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(angle)) {
|
||||
angle = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.w)) {
|
||||
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) {
|
||||
this.x += v.x;
|
||||
this.y += v.y;
|
||||
|
@ -57,10 +59,7 @@ R3.API.Quaternion.prototype.translate = function(v) {
|
|||
|
||||
R3.API.Quaternion.prototype.copy = function() {
|
||||
return new R3.API.Quaternion(
|
||||
this.x,
|
||||
this.y,
|
||||
this.z,
|
||||
this.w
|
||||
this
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -212,26 +211,3 @@ R3.API.Quaternion.prototype.slerp = function(quaternion, t) {
|
|||
|
||||
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
|
||||
)
|
||||
};
|
|
@ -1,19 +1,36 @@
|
|||
/**
|
||||
* R3.API.Quaternion.Points
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Quaternion.Points = function() {
|
||||
this.vectors = [];
|
||||
R3.API.Quaternion.Points = function(
|
||||
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) {
|
||||
|
||||
if (vector instanceof R3.API.Vector3) {
|
||||
vector = new R3.API.Quaternion(
|
||||
vector.x,
|
||||
vector.y,
|
||||
vector.z,
|
||||
1
|
||||
{
|
||||
parent : this,
|
||||
register : true,
|
||||
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 rotationMatrixY = new R3.API.Matrix4().rotationMatrixY(grain);
|
||||
var rotationMatrixY = new R3.API.Matrix4(
|
||||
{
|
||||
parent : this
|
||||
}
|
||||
).rotationMatrixY(grain);
|
||||
|
||||
var totalRadians = 0;
|
||||
|
||||
|
@ -73,7 +94,12 @@ R3.API.Quaternion.Points.prototype.maximizeXDistance = function(grain) {
|
|||
|
||||
// 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++) {
|
||||
this.vectors[k] = maxRotationMatrix.multiply(this.vectors[k]);
|
||||
|
@ -89,7 +115,12 @@ R3.API.Quaternion.Points.prototype.maximizeYDistance = function(grain) {
|
|||
|
||||
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;
|
||||
|
||||
|
@ -117,7 +148,12 @@ R3.API.Quaternion.Points.prototype.maximizeYDistance = function(grain) {
|
|||
|
||||
// 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++) {
|
||||
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));
|
||||
|
||||
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[1] = new R3.API.Quaternion(0, 0, 1, 0);
|
||||
lookAtMatrix.rows[2] = new R3.API.Quaternion(0, 1, 0, 0);
|
||||
lookAtMatrix.rows[0] = new R3.API.Quaternion(
|
||||
{
|
||||
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));
|
||||
|
||||
|
@ -182,13 +249,17 @@ R3.API.Quaternion.Points.prototype.distances = function() {
|
|||
}
|
||||
|
||||
return new R3.API.Vector3(
|
||||
Math.abs(maxX - minX),
|
||||
Math.abs(maxY - minY),
|
||||
Math.abs(maxY - minZ)
|
||||
{
|
||||
parent : this,
|
||||
x : Math.abs(maxX - minX),
|
||||
y : Math.abs(maxY - minY),
|
||||
z : Math.abs(maxY - minZ)
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
R3.API.Quaternion.Points.prototype.average = function() {
|
||||
|
||||
var averageX = 0;
|
||||
var averageY = 0;
|
||||
var averageZ = 0;
|
||||
|
@ -200,9 +271,13 @@ R3.API.Quaternion.Points.prototype.average = function() {
|
|||
}
|
||||
|
||||
return new R3.API.Vector3(
|
||||
averageX / this.vectors.length,
|
||||
averageY / this.vectors.length,
|
||||
averageZ / this.vectors.length
|
||||
{
|
||||
parent : this,
|
||||
register : true,
|
||||
x : averageX / this.vectors.length,
|
||||
y : averageY / this.vectors.length,
|
||||
z : averageZ / this.vectors.length
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -7,7 +7,7 @@ R3.API.Renderer = function(
|
|||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
};
|
||||
|
|
@ -1,28 +1,28 @@
|
|||
/**
|
||||
* R3.API.Renderer.D2
|
||||
* @param apiComponent
|
||||
*
|
||||
* @property canvas
|
||||
*
|
||||
* @constructor
|
||||
* @param apiRenderer
|
||||
* @param canvas
|
||||
*/
|
||||
R3.API.Renderer.D2 = function(
|
||||
apiRenderer,
|
||||
canvas
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||
apiRenderer = {};
|
||||
}
|
||||
this.apiRenderer = apiRenderer;
|
||||
|
||||
R3.API.Renderer.call(
|
||||
this,
|
||||
this.apiRenderer
|
||||
apiComponent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(canvas)) {
|
||||
canvas = new R3.API.Canvas();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.canvas)) {
|
||||
apiComponent.canvas = new R3.API.Canvas(
|
||||
{
|
||||
parent : this
|
||||
}
|
||||
);
|
||||
}
|
||||
this.canvas = canvas;
|
||||
this.canvas = apiComponent.canvas;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
|
@ -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
|
||||
}
|
||||
|
||||
};
|
|
@ -1,28 +1,28 @@
|
|||
/**
|
||||
* R3.API.Renderer.D3.Canvas.Target
|
||||
* @param apiComponent
|
||||
*
|
||||
* @property target
|
||||
*
|
||||
* @constructor
|
||||
* @param apiRendererD3Canvas
|
||||
* @param target
|
||||
*/
|
||||
R3.API.Renderer.D3.Canvas.Target = function(
|
||||
apiRendererD3Canvas,
|
||||
target
|
||||
apiComponent
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(apiRendererD3Canvas)) {
|
||||
apiRendererD3Canvas = {};
|
||||
}
|
||||
this.apiRendererD3Canvas = apiRendererD3Canvas;
|
||||
|
||||
R3.API.Renderer.D3.Canvas.call(
|
||||
this,
|
||||
this.apiRendererD3Canvas,
|
||||
this.apiRendererD3Canvas.canvas
|
||||
apiComponent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(target)) {
|
||||
target = new R3.D3.API.RenderTarget();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.target)) {
|
||||
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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
};
|
|
@ -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;
|
|
@ -1,69 +1,61 @@
|
|||
/**
|
||||
* R3.API.Server
|
||||
* @param apiComponent
|
||||
* @param protocol
|
||||
* @param context
|
||||
* @param application
|
||||
* @param domain
|
||||
* @param ip
|
||||
* @param preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime
|
||||
* @param port
|
||||
* @param protocols
|
||||
* @property protocol
|
||||
* @property context
|
||||
* @property application
|
||||
* @property domain
|
||||
* @property ip
|
||||
* @property preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime
|
||||
* @property port
|
||||
* @property protocols
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Server = function(
|
||||
apiComponent,
|
||||
protocol,
|
||||
context,
|
||||
application,
|
||||
domain,
|
||||
ip,
|
||||
preferIp,
|
||||
port,
|
||||
protocols
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(protocol)) {
|
||||
protocol = R3.API.Server.PROTOCOL_HTTP_SSL;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.protocol)) {
|
||||
apiComponent.protocol = R3.API.Server.PROTOCOL_HTTP_SSL;
|
||||
}
|
||||
this.protocol = protocol;
|
||||
this.protocol = apiComponent.protocol;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(context)) {
|
||||
context = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.context)) {
|
||||
apiComponent.context = null;
|
||||
}
|
||||
this.context = context;
|
||||
this.context = apiComponent.context;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(application)) {
|
||||
application = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.application)) {
|
||||
apiComponent.application = null;
|
||||
}
|
||||
this.application = application;
|
||||
this.application = apiComponent.application;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(domain)) {
|
||||
domain = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.domain)) {
|
||||
apiComponent.domain = null;
|
||||
}
|
||||
this.domain = domain;
|
||||
this.domain = apiComponent.domain;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(ip)) {
|
||||
ip = '127.0.0.1';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.ip)) {
|
||||
apiComponent.ip = '127.0.0.1';
|
||||
}
|
||||
this.ip = ip;
|
||||
this.ip = apiComponent.ip;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(preferIp)) {
|
||||
preferIp = false;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.preferIp)) {
|
||||
apiComponent.preferIp = false;
|
||||
}
|
||||
this.preferIp = preferIp;
|
||||
this.preferIp = apiComponent.preferIp;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(port)) {
|
||||
port = R3.API.Server.PORT_SECURE;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.port)) {
|
||||
apiComponent.port = R3.API.Server.PORT_SECURE;
|
||||
}
|
||||
this.port = port;
|
||||
this.port = apiComponent.port;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(protocols)) {
|
||||
protocols = [];
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.protocols)) {
|
||||
apiComponent.protocols = [];
|
||||
}
|
||||
this.protocols = protocols;
|
||||
this.protocols = apiComponent.protocols;
|
||||
};
|
||||
|
||||
R3.API.Server.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,56 +1,55 @@
|
|||
/**
|
||||
* R3.API.Socket
|
||||
* @param apiComponent
|
||||
* @param roomId
|
||||
* @param peerId
|
||||
* @param server R3.Server
|
||||
* @property roomId
|
||||
* @property peerId
|
||||
* @property server
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Socket = function(
|
||||
apiComponent,
|
||||
roomId,
|
||||
peerId,
|
||||
server
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(roomId)) {
|
||||
roomId = 'room_' + R3.Utils.RandomId();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.roomId)) {
|
||||
apiComponent.roomId = 'room_' + R3.Utils.RandomId();
|
||||
}
|
||||
this.roomId = roomId;
|
||||
this.roomId = apiComponent.roomId;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(peerId)) {
|
||||
peerId = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.peerId)) {
|
||||
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.GET_WEBSOCKET_CONFIG,
|
||||
'hello',
|
||||
function(websocketConfig) {
|
||||
if (websocketConfig) {
|
||||
server = new R3.API.Server(
|
||||
null,
|
||||
null,
|
||||
websocketConfig.protocol,
|
||||
websocketConfig.context,
|
||||
websocketConfig.application,
|
||||
websocketConfig.domain
|
||||
apiComponent.server = new R3.API.Server(
|
||||
{
|
||||
parent : this,
|
||||
protocol : websocketConfig.protocol,
|
||||
context : websocketConfig.context,
|
||||
application : websocketConfig.application,
|
||||
domain : websocketConfig.domain
|
||||
}
|
||||
);
|
||||
} else {
|
||||
server = new R3.API.Server(
|
||||
null,
|
||||
null,
|
||||
R3.API.Server.PROTOCOL_WEBSOCKET_SSL
|
||||
apiComponent.server = new R3.API.Server(
|
||||
{
|
||||
parent : this,
|
||||
protocol : R3.API.Server.PROTOCOL_WEBSOCKET_SSL
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
this.server = server;
|
||||
this.server = apiComponent.server;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,45 +1,34 @@
|
|||
/**
|
||||
* R3.API.Socket.Cast
|
||||
* @param apiSocket
|
||||
* @param castType
|
||||
* @param source
|
||||
* @param sourceProperties
|
||||
* @param apiComponent
|
||||
* @property castType
|
||||
* @property source
|
||||
* @property sourceProperties
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Socket.Cast = function(
|
||||
apiSocket,
|
||||
castType,
|
||||
source,
|
||||
sourceProperties
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiSocket)) {
|
||||
apiSocket = {}
|
||||
}
|
||||
this.apiSocket = apiSocket;
|
||||
|
||||
R3.API.Socket.call(
|
||||
this,
|
||||
this.apiSocket,
|
||||
this.apiSocket.roomId,
|
||||
this.apiSocket.peerId,
|
||||
this.apiSocket.server
|
||||
apiComponent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(castType)) {
|
||||
castType = R3.API.Socket.Cast.CAST_TYPE_ROOM;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.castType)) {
|
||||
apiComponent.castType = R3.API.Socket.Cast.CAST_TYPE_ROOM;
|
||||
}
|
||||
this.castType = castType;
|
||||
this.castType = apiComponent.castType;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(source)) {
|
||||
source = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.source)) {
|
||||
apiComponent.source = null;
|
||||
}
|
||||
this.source = source;
|
||||
this.source = apiComponent.source;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(sourceProperties)) {
|
||||
sourceProperties = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.sourceProperties)) {
|
||||
apiComponent.sourceProperties = null;
|
||||
}
|
||||
this.sourceProperties = sourceProperties;
|
||||
this.sourceProperties = apiComponent.sourceProperties;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,45 +1,34 @@
|
|||
/**
|
||||
* R3.API.Socket.Receive
|
||||
* @param apiSocket
|
||||
* @param receiveType
|
||||
* @param destination
|
||||
* @param destinationProperties
|
||||
* @param apiComponent
|
||||
* @property receiveType
|
||||
* @property destination
|
||||
* @property destinationProperties
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Socket.Receive = function(
|
||||
apiSocket,
|
||||
receiveType,
|
||||
destination,
|
||||
destinationProperties
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiSocket)) {
|
||||
apiSocket = {}
|
||||
}
|
||||
this.apiSocket = apiSocket;
|
||||
|
||||
R3.API.Socket.call(
|
||||
this,
|
||||
this.apiSocket,
|
||||
this.apiSocket.roomId,
|
||||
this.apiSocket.peerId,
|
||||
this.apiSocket.server
|
||||
apiComponent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(receiveType)) {
|
||||
receiveType = R3.API.Socket.Receive.RECEIVE_TYPE_ROOM;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.receiveType)) {
|
||||
apiComponent.receiveType = R3.API.Socket.Receive.RECEIVE_TYPE_ROOM;
|
||||
}
|
||||
this.receiveType = receiveType;
|
||||
this.receiveType = apiComponent.receiveType;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(destination)) {
|
||||
destination = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.destination)) {
|
||||
apiComponent.destination = null;
|
||||
}
|
||||
this.destination = destination;
|
||||
this.destination = apiComponent.destination;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(destinationProperties)) {
|
||||
destinationProperties = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.destinationProperties)) {
|
||||
apiComponent.destinationProperties = null;
|
||||
}
|
||||
this.destinationProperties = destinationProperties;
|
||||
this.destinationProperties = apiComponent.destinationProperties;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,27 +1,34 @@
|
|||
/**
|
||||
* R3.API.Sphere
|
||||
* @constructor
|
||||
* @param apiComponent
|
||||
* @param center
|
||||
* @param radius
|
||||
*
|
||||
* @property center
|
||||
* @property radius
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Sphere = function(
|
||||
apiComponent,
|
||||
center,
|
||||
radius
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(center)) {
|
||||
center = new R3.API.Vector3(0,0,0);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.center)) {
|
||||
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)) {
|
||||
radius = 1;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.radius)) {
|
||||
apiComponent.radius = 1;
|
||||
}
|
||||
this.radius = radius;
|
||||
this.radius = apiComponent.radius;
|
||||
};
|
||||
|
||||
R3.API.Sphere.prototype = Object.create(R3.API.Sphere.prototype);
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
/**
|
||||
* Raw Stats API object - should always correspond with the Stats Schema
|
||||
* @param apiComponent
|
||||
* @param domElement
|
||||
*
|
||||
* @property domElement
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Stats = function(
|
||||
apiComponent,
|
||||
domElement
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(domElement)) {
|
||||
domElement = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.domElement)) {
|
||||
apiComponent.domElement = null;
|
||||
}
|
||||
this.domElement = domElement;
|
||||
this.domElement = apiComponent.domElement;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,69 +1,63 @@
|
|||
/**
|
||||
* API User
|
||||
* R3.API.User
|
||||
* @param apiComponent
|
||||
* @param googleId
|
||||
* @param fullName
|
||||
* @param givenName
|
||||
* @param familyName
|
||||
* @param imageUrl
|
||||
* @param email
|
||||
* @param uploadFolder
|
||||
* @param idToken
|
||||
*
|
||||
* @property googleId
|
||||
* @property fullName
|
||||
* @property givenName
|
||||
* @property familyName
|
||||
* @property imageUrl
|
||||
* @property email
|
||||
* @property uploadFolder
|
||||
* @property idToken
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.User = function(
|
||||
apiComponent,
|
||||
googleId,
|
||||
fullName,
|
||||
givenName,
|
||||
familyName,
|
||||
imageUrl,
|
||||
email,
|
||||
uploadFolder,
|
||||
idToken
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(googleId)) {
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.googleId)) {
|
||||
throw new Error('invalid user - no google ID');
|
||||
}
|
||||
this.googleId = googleId;
|
||||
this.googleId = apiComponent.googleId;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(fullName)) {
|
||||
fullName = 'unknown full name';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.fullName)) {
|
||||
apiComponent.fullName = 'unknown full name';
|
||||
}
|
||||
this.fullName = fullName;
|
||||
this.fullName = apiComponent.fullName;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(givenName)) {
|
||||
givenName = 'unknown given name';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.givenName)) {
|
||||
apiComponent.givenName = 'unknown given name';
|
||||
}
|
||||
this.givenName = givenName;
|
||||
this.givenName = apiComponent.givenName;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(familyName)) {
|
||||
familyName = 'unknown family name';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.familyName)) {
|
||||
apiComponent.familyName = 'unknown family name';
|
||||
}
|
||||
this.familyName = familyName;
|
||||
this.familyName = apiComponent.familyName;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(imageUrl)) {
|
||||
imageUrl = 'unknown image URL';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.imageUrl)) {
|
||||
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');
|
||||
}
|
||||
this.email = email;
|
||||
this.email = apiComponent.email;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(uploadFolder)) {
|
||||
uploadFolder = email.replace('/','_DS_');
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.uploadFolder)) {
|
||||
apiComponent.uploadFolder = email.replace('/','_DS_');
|
||||
}
|
||||
this.uploadFolder = uploadFolder;
|
||||
this.uploadFolder = apiComponent.uploadFolder;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(idToken)) {
|
||||
idToken = 'unknown ID token';
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.idToken)) {
|
||||
apiComponent.idToken = 'unknown ID token';
|
||||
}
|
||||
this.idToken = idToken;
|
||||
this.idToken = apiComponent.idToken;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,22 +1,34 @@
|
|||
/**
|
||||
* R3.API.Vector2
|
||||
* @param x
|
||||
* @param y
|
||||
* @param apiComponent
|
||||
*
|
||||
* @property x
|
||||
* @property y
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Vector2 = function(x, y) {
|
||||
R3.API.Vector2 = function(
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
x = 0;
|
||||
}
|
||||
this.x = x;
|
||||
__DEREGISTER_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(y)) {
|
||||
y = 0;
|
||||
__API_COMPONENT__;
|
||||
|
||||
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
|
||||
* TODO: Test
|
||||
|
|
|
@ -1,29 +1,41 @@
|
|||
/**
|
||||
* R3.API.Vector3
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param apiComponent
|
||||
*
|
||||
* @property x
|
||||
* @property y
|
||||
* @property z
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Vector3 = function(x, y, z) {
|
||||
R3.API.Vector3 = function(
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
x = 0;
|
||||
}
|
||||
this.x = x;
|
||||
__DEREGISTER_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(y)) {
|
||||
y = 0;
|
||||
}
|
||||
this.y = y;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(z)) {
|
||||
z = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
|
||||
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) {
|
||||
this.x = vector3.x;
|
||||
this.y = vector3.y;
|
||||
|
@ -64,8 +76,9 @@ R3.API.Vector3.prototype.cross = function(v) {
|
|||
};
|
||||
|
||||
R3.API.Vector3.prototype.lookAt = function(at, up) {
|
||||
var lookAtMatrix = R3.API.Matrix4.lookAt(this, at, up);
|
||||
return this.multiply(lookAtMatrix);
|
||||
console.warn('todo: implement R3.API.Vector3.prototype.lookAt()');
|
||||
// var lookAtMatrix = R3.API.Matrix4.lookAt(this, at, up);
|
||||
// return this.multiply(lookAtMatrix);
|
||||
};
|
||||
|
||||
R3.API.Vector3.prototype.translate = function(v) {
|
||||
|
@ -88,9 +101,7 @@ R3.API.Vector3.prototype.squared = function() {
|
|||
|
||||
R3.API.Vector3.prototype.copy = function() {
|
||||
return new R3.API.Vector3(
|
||||
this.x,
|
||||
this.y,
|
||||
this.z
|
||||
this
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -149,7 +160,7 @@ R3.API.Vector3.prototype.multiply = function(object, cross) {
|
|||
var a = object;
|
||||
var b = this;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(cross)) {
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.cross)) {
|
||||
cross = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +1,43 @@
|
|||
/**
|
||||
* R3.API.Vector4
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param w
|
||||
* @param apiComponent
|
||||
*
|
||||
* @property x
|
||||
* @property y
|
||||
* @property z
|
||||
* @property w
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Vector4 = function(x, y, z, w) {
|
||||
R3.API.Vector4 = function(
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
x = 0;
|
||||
}
|
||||
this.x = x;
|
||||
__DEREGISTER_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(y)) {
|
||||
y = 0;
|
||||
}
|
||||
this.y = y;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(z)) {
|
||||
z = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.x)) {
|
||||
apiComponent.x = 0;
|
||||
}
|
||||
this.z = z;
|
||||
this.x = apiComponent.x;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(w)) {
|
||||
w = 0;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
|
||||
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;
|
||||
|
|
|
@ -1,50 +1,54 @@
|
|||
/**
|
||||
* R3.API.Video
|
||||
* @param apiComponent
|
||||
* @param autoUpdateSize
|
||||
* @param width
|
||||
* @param height
|
||||
* @param offset
|
||||
* @param source
|
||||
*
|
||||
* @property autoUpdateSize
|
||||
* @property width
|
||||
* @property height
|
||||
* @property offset
|
||||
* @property source
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Video = function(
|
||||
apiComponent,
|
||||
autoUpdateSize,
|
||||
width,
|
||||
height,
|
||||
offset,
|
||||
source
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
||||
autoUpdateSize = true;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
|
||||
apiComponent.autoUpdateSize = true;
|
||||
}
|
||||
this.autoUpdateSize = autoUpdateSize;
|
||||
this.autoUpdateSize = apiComponent.autoUpdateSize;
|
||||
|
||||
var size = R3.Utils.GetWindowSize();
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(width)) {
|
||||
width = size.width;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.width)) {
|
||||
apiComponent.width = size.width;
|
||||
}
|
||||
this.width = width;
|
||||
this.width = apiComponent.width;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(height)) {
|
||||
height = size.height;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
|
||||
apiComponent.height = size.height;
|
||||
}
|
||||
this.height = height;
|
||||
this.height = apiComponent.height;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(offset)) {
|
||||
offset = new R3.API.Vector2(0,0);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.offset)) {
|
||||
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)) {
|
||||
source = null;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.source)) {
|
||||
apiComponent.source = null;
|
||||
}
|
||||
this.source = source;
|
||||
this.source = apiComponent.source;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -7,28 +7,9 @@ R3.Box3 = function(
|
|||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.API.Box3.call(
|
||||
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);
|
||||
__UPGRADE_TO_RUNTIME__;
|
||||
};
|
||||
|
||||
R3.Box3.prototype = Object.create(R3.Component.prototype);
|
||||
|
@ -40,14 +21,14 @@ R3.Box3.prototype.constructor = R3.Box3;
|
|||
*/
|
||||
R3.Box3.prototype.createInstance = function() {
|
||||
|
||||
switch (this.componentRuntime) {
|
||||
case R3.Component.GRAPHICS_RUNTIME :
|
||||
switch (this.parent.runtime) {
|
||||
case R3.Runtime.GRAPHICS :
|
||||
this.instance = this.graphics.Box3(
|
||||
this.min,
|
||||
this.max
|
||||
);
|
||||
break;
|
||||
case R3.Component.PHYSICS_RUNTIME :
|
||||
case R3.Runtime.PHYSICS :
|
||||
this.instance = this.physics.Box3(
|
||||
this.min,
|
||||
this.max
|
||||
|
@ -57,6 +38,8 @@ R3.Box3.prototype.createInstance = function() {
|
|||
throw new Error('unhandled component runtime: ' + this.componentRuntime);
|
||||
}
|
||||
|
||||
__CREATE_INSTANCE__;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -79,6 +62,6 @@ R3.Box3.prototype.updateInstance = function(property) {
|
|||
return;
|
||||
}
|
||||
|
||||
R3.Component.prototype.updateInstance.call(this, property);
|
||||
__UPDATE_INSTANCE__;
|
||||
|
||||
};
|
||||
|
|
|
@ -1,41 +1,18 @@
|
|||
/**
|
||||
* R3.Canvas
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Canvas = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
|
||||
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
|
||||
);
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
this.context = null;
|
||||
|
||||
R3.Component.call(
|
||||
this,
|
||||
{
|
||||
'texts' : [R3.D3.Text]
|
||||
}
|
||||
);
|
||||
__UPGRADE_TO_RUNTIME__;
|
||||
|
||||
};
|
||||
|
||||
R3.Canvas.prototype = Object.create(R3.Component.prototype);
|
||||
|
@ -69,7 +46,7 @@ R3.Canvas.prototype.createInstance = function() {
|
|||
this.instance.height = this.height;
|
||||
}
|
||||
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -142,7 +119,7 @@ R3.Canvas.prototype.updateInstance = function(property) {
|
|||
return;
|
||||
}
|
||||
|
||||
R3.Component.prototype.updateInstance.call(this, property);
|
||||
__UPDATE_INSTANCE__;
|
||||
};
|
||||
|
||||
R3.Canvas.prototype.writeText = function() {
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/**
|
||||
* R3.Clock
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Clock = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.API.Clock.call(
|
||||
this,
|
||||
apiComponent
|
||||
);
|
||||
__UPGRADE_TO_RUNTIME__;
|
||||
|
||||
R3.Component.call(
|
||||
this,
|
||||
parent
|
||||
);
|
||||
} ;
|
||||
|
||||
R3.Clock.prototype = Object.create(R3.Component.prototype);
|
||||
|
@ -32,7 +23,7 @@ R3.Clock.prototype.createInstance = function() {
|
|||
|
||||
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.Component.prototype.updateInstance.call(this, property);
|
||||
__UPDATE_INSTANCE;
|
||||
|
||||
};
|
||||
|
||||
R3.Clock.prototype.getDelta = function() {
|
||||
|
||||
var delta = this.instance.getDelta();
|
||||
return this.instance.getDelta();
|
||||
|
||||
/**
|
||||
* clamp the delta to 1/60
|
||||
*/
|
||||
if (delta > (1 / 30.0)) {
|
||||
// console.log('clipped ' + (delta - (1/30.0)) + ' seconds - essentially lost time');
|
||||
delta = (1 / 30.0);
|
||||
}
|
||||
// if (delta > (1 / 30.0)) {
|
||||
// console.warn('clipping delta - todo: do we still need this?');
|
||||
// // console.log('clipped ' + (delta - (1/30.0)) + ' seconds - essentially lost time');
|
||||
// delta = (1 / 30.0);
|
||||
// }
|
||||
|
||||
return delta;
|
||||
//return delta;
|
||||
};
|
||||
|
|
|
@ -1,36 +1,21 @@
|
|||
/**
|
||||
* R3.Color
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Color = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
/**
|
||||
* Color does not extend component so initialize the parent
|
||||
*/
|
||||
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||
parent = null;
|
||||
}
|
||||
this.parent = parent;
|
||||
__DEREGISTER_COMPONENT__;
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.API.Color.call(
|
||||
this,
|
||||
apiComponent.r,
|
||||
apiComponent.g,
|
||||
apiComponent.b,
|
||||
apiComponent.a
|
||||
);
|
||||
__UPGRADE_TO_RUNTIME__;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -46,6 +31,8 @@ R3.Color.prototype.createInstance = function() {
|
|||
this.a
|
||||
);
|
||||
|
||||
__CREATE_INSTANCE__;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -72,20 +59,10 @@ R3.Color.prototype.updateInstance = function(property) {
|
|||
this.instance.a = this.a;
|
||||
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)
|
||||
|
@ -152,4 +129,4 @@ R3.Color.prototype.fromHex = function(hex) {
|
|||
this.instance.r = this.r;
|
||||
this.instance.g = this.g;
|
||||
this.instance.b = this.b;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,29 +1,11 @@
|
|||
/**
|
||||
* R3.Controls is an R3.Component
|
||||
* @param parent
|
||||
* @param linkedObjects
|
||||
* R3.Controls
|
||||
* @constructor
|
||||
*/
|
||||
R3.Controls = function(
|
||||
parent,
|
||||
linkedObjects
|
||||
) {
|
||||
R3.Controls = function() {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||
linkedObjects = {};
|
||||
}
|
||||
__UPGRADE_TO_RUNTIME__;
|
||||
|
||||
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);
|
||||
|
@ -37,7 +19,7 @@ R3.Controls.prototype.updateInstance = function(property) {
|
|||
|
||||
if (property === 'canvas') {
|
||||
R3.Event.Emit(
|
||||
R3.Event.CANVAS_CHANGE,
|
||||
R3.Event.CONTROLS_CANVAS_CHANGE,
|
||||
{
|
||||
component: this
|
||||
}
|
||||
|
@ -45,5 +27,5 @@ R3.Controls.prototype.updateInstance = function(property) {
|
|||
return;
|
||||
}
|
||||
|
||||
R3.Component.prototype.updateInstance.call(this, property);
|
||||
__UPDATE_INSTANCE__;
|
||||
};
|
||||
|
|
|
@ -1,24 +1,10 @@
|
|||
/**
|
||||
* R3.Controls.D3 is an R3.Controls
|
||||
* @param parent
|
||||
* @param linkedObjects
|
||||
* R3.Controls.D3
|
||||
* @constructor
|
||||
*/
|
||||
R3.Controls.D3 = function(
|
||||
parent,
|
||||
linkedObjects
|
||||
) {
|
||||
R3.Controls.D3 = function() {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||
linkedObjects = {};
|
||||
}
|
||||
linkedObjects.camera = R3.D3.Camera;
|
||||
|
||||
R3.Controls.call(
|
||||
this,
|
||||
parent,
|
||||
linkedObjects
|
||||
);
|
||||
R3.Controls.call(this);
|
||||
|
||||
};
|
||||
|
|
@ -1,35 +1,18 @@
|
|||
/**
|
||||
* R3.Controls.D3.Editor is an R3.Controls.D3
|
||||
* @param parent
|
||||
* R3.Controls.D3.Editor
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Controls.D3.Editor = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
|
||||
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
|
||||
};
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.Controls.D3.call(
|
||||
this,
|
||||
parent,
|
||||
linkedObjects
|
||||
)
|
||||
this
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -46,7 +29,7 @@ R3.Controls.D3.Editor.prototype.createInstance = function() {
|
|||
|
||||
this.instance = this.graphics.EditorControls(this.canvas, this.camera);
|
||||
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,39 +1,15 @@
|
|||
/**
|
||||
* R3.Controls.D3.FirstPerson is an R3.Controls.D3
|
||||
* @param parent
|
||||
* R3.Controls.D3.FirstPerson
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Controls.D3.FirstPerson = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.API.Controls.D3.FirstPerson.call(
|
||||
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
|
||||
)
|
||||
R3.Controls.D3.call(this);
|
||||
|
||||
};
|
||||
|
||||
|
@ -68,7 +44,7 @@ R3.Controls.D3.FirstPerson.prototype.createInstance = function() {
|
|||
this.autoSpeedFactor
|
||||
);
|
||||
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
|
@ -1,49 +1,15 @@
|
|||
/**
|
||||
* R3.Controls.D3.Orbit is an R3.Controls.D3
|
||||
* @param parent
|
||||
* R3.Controls.D3.Orbit
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Controls.D3.Orbit = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.API.Controls.D3.Orbit.call(
|
||||
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
|
||||
)
|
||||
R3.Controls.D3.call(this);
|
||||
|
||||
};
|
||||
|
||||
|
@ -75,7 +41,7 @@ R3.Controls.D3.Orbit.prototype.createInstance = function() {
|
|||
this.enableKeys
|
||||
);
|
||||
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,24 +1,16 @@
|
|||
/**
|
||||
* R3.Controls.Keyboard is an R3.Controls
|
||||
* @param parent
|
||||
* R3.Controls.Keyboard
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Controls.Keyboard = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
|
||||
R3.API.Controls.Keyboard.call(
|
||||
this,
|
||||
apiComponent
|
||||
);
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.Controls.call(
|
||||
this,
|
||||
parent
|
||||
this
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -35,7 +27,7 @@ R3.Controls.Keyboard.prototype.constructor = R3.Controls.Keyboard;
|
|||
*/
|
||||
R3.Controls.Keyboard.prototype.createInstance = function() {
|
||||
this.instance = true;
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,24 +1,16 @@
|
|||
/**
|
||||
* R3.Controls.Mouse
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Controls.Mouse = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
|
||||
R3.API.Controls.Mouse.call(
|
||||
this,
|
||||
apiComponent
|
||||
);
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.Controls.call(
|
||||
this,
|
||||
parent
|
||||
this
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -35,7 +27,7 @@ R3.Controls.Mouse.prototype.constructor = R3.Controls.Mouse;
|
|||
*/
|
||||
R3.Controls.Mouse.prototype.createInstance = function() {
|
||||
this.instance = true;
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/**
|
||||
* Touch Controls
|
||||
* @constructor
|
||||
* @param parent
|
||||
* R3.Controls.Touch
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.Controls.Touch = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
|
||||
R3.API.Controls.Touch.call(
|
||||
this,
|
||||
apiComponent,
|
||||
apiComponent.sensitivity
|
||||
);
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
R3.Controls.call(
|
||||
this,
|
||||
parent
|
||||
this
|
||||
);
|
||||
|
||||
};
|
||||
|
@ -37,7 +28,7 @@ R3.Controls.Touch.prototype.constructor = R3.Controls.Touch;
|
|||
*/
|
||||
R3.Controls.Touch.prototype.createInstance = function() {
|
||||
this.instance = true;
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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__;
|
||||
|
||||
};
|
|
@ -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);
|
||||
};
|
|
@ -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);
|
||||
};
|
|
@ -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);
|
||||
};
|
|
@ -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);
|
||||
};
|
|
@ -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);
|
||||
};
|
|
@ -1,48 +1,35 @@
|
|||
/**
|
||||
* R3.Curve.Path.D2.Shape
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param linkedObjects
|
||||
* @param inherited
|
||||
* @constructor
|
||||
*/
|
||||
R3.Curve.Path.D2.Shape = function(
|
||||
parent,
|
||||
apiComponent,
|
||||
linkedObjects
|
||||
inherited
|
||||
) {
|
||||
|
||||
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.Shape.call(
|
||||
this,
|
||||
apiComponent
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* This class was inherited and Component constructor will call the child class createInstance()
|
||||
* Add any more linking information to the linkedObjects object here
|
||||
*/
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(inherited)) {
|
||||
inherited = false;
|
||||
}
|
||||
|
||||
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
|
||||
* and should not do any runtime instantiation
|
||||
*/
|
||||
R3.Curve.Path.D2.call(
|
||||
this,
|
||||
parent,
|
||||
apiComponent,
|
||||
linkedObjects
|
||||
true
|
||||
)
|
||||
|
||||
};
|
||||
|
@ -58,7 +45,7 @@ R3.Curve.Path.D2.Shape.prototype.createInstance = function() {
|
|||
|
||||
this.instance = this.graphics.Shape(this.points);
|
||||
|
||||
R3.Component.prototype.createInstance.call(this);
|
||||
__CREATE_INSTANCE__;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,29 +1,17 @@
|
|||
/**
|
||||
* R3.CustomCode
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @constructor
|
||||
*/
|
||||
R3.CustomCode = function(
|
||||
parent,
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__RUNTIME_COMPONENT_MACRO__;
|
||||
|
||||
R3.API.CustomCode.call(
|
||||
this,
|
||||
apiComponent,
|
||||
apiComponent.eventId,
|
||||
apiComponent.code,
|
||||
);
|
||||
__RUNTIME_COMPONENT__;
|
||||
|
||||
this.editor = null;
|
||||
|
||||
R3.Component.call(
|
||||
this,
|
||||
parent
|
||||
);
|
||||
__UPGRADE_TO_RUNTIME__;
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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(){
|
|
@ -1,62 +1,93 @@
|
|||
/**
|
||||
* R3.D3.API.Object
|
||||
* @param apiComponent
|
||||
* @param useQuaternion
|
||||
* @param position
|
||||
* @param quaternion
|
||||
* @param rotation
|
||||
* @param scale
|
||||
* @param up
|
||||
* @param lookAt
|
||||
*
|
||||
* @property useQuaternion
|
||||
* @property position
|
||||
* @property quaternion
|
||||
* @property rotation
|
||||
* @property scale
|
||||
* @property up
|
||||
* @property lookAt
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Object = function(
|
||||
apiComponent,
|
||||
useQuaternion,
|
||||
position,
|
||||
quaternion,
|
||||
rotation,
|
||||
scale,
|
||||
up,
|
||||
lookAt
|
||||
apiComponent
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__;
|
||||
__API_COMPONENT__;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(useQuaternion)) {
|
||||
useQuaternion = true;
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.useQuaternion)) {
|
||||
apiComponent.useQuaternion = false;
|
||||
}
|
||||
this.useQuaternion = useQuaternion;
|
||||
this.useQuaternion = apiComponent.useQuaternion;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(position)) {
|
||||
position = new R3.API.Vector3();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.position)) {
|
||||
apiComponent.position = new R3.API.Vector3(
|
||||
{
|
||||
parent : this,
|
||||
register : true
|
||||
}
|
||||
);
|
||||
}
|
||||
this.position = position;
|
||||
this.position = apiComponent.position;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(quaternion)) {
|
||||
quaternion = new R3.API.Quaternion();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.quaternion)) {
|
||||
apiComponent.quaternion = new R3.API.Quaternion(
|
||||
{
|
||||
parent : this,
|
||||
register : true
|
||||
}
|
||||
);
|
||||
}
|
||||
this.quaternion = quaternion;
|
||||
this.quaternion = apiComponent.quaternion;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(rotation)) {
|
||||
rotation = new R3.API.Vector3();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.rotation)) {
|
||||
apiComponent.rotation = new R3.API.Vector3(
|
||||
{
|
||||
parent : this,
|
||||
register : true
|
||||
}
|
||||
);
|
||||
}
|
||||
this.rotation = rotation;
|
||||
this.rotation = apiComponent.rotation;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(scale)) {
|
||||
scale = new R3.API.Vector3(1,1,1);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.scale)) {
|
||||
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)) {
|
||||
up = new R3.API.Vector3(0,1,0);
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.up)) {
|
||||
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)) {
|
||||
lookAt = new R3.API.Vector3();
|
||||
if (R3.Utils.UndefinedOrNull(apiComponent.lookAt)) {
|
||||
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
Loading…
Reference in New Issue