done with API classes

beta.r3js.org
cybafelo 2019-07-24 14:45:42 +02:00
parent 659954f7de
commit 567b6b9f38
175 changed files with 2449 additions and 6642 deletions

View File

@ -7,24 +7,144 @@ var replace = require('gulp-string-replace');
gulp.task('build', build); gulp.task('build', build);
gulp.task('monitor', monitor); gulp.task('monitor', monitor);
var code = ' if (R3.Utils.UndefinedOrNull(apiComponent)) {'; var code = 'if (R3.Utils.UndefinedOrNull(apiComponent)) {\n';
code += ' apiComponent = {};'; code += '\t\tapiComponent = {};\n';
code += ' }'; code += '\t}\n';
code += ' this.apiComponent = apiComponent;'; code += '\tthis.apiComponent = apiComponent;\n';
code += '\n'; code += '\n';
code += ' R3.API.Component.call('; code += '\tR3.API.Component.call(\n';
code += ' this,'; code += '\t\tthis,\n';
code += ' this.apiComponent.parent,'; code += '\t\tthis.apiComponent.parent,\n';
code += ' this.apiComponent.id,'; code += '\t\tthis.apiComponent.id,\n';
code += ' this.apiComponent.name'; code += '\t\tthis.apiComponent.name\n';
code += ' );'; 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';
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);';
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';
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);';
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';
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);';
var code5 = 'if (R3.Utils.UndefinedOrNull(apiTexture)) {\n';
code5 += '\t\tapiTexture = {};\n';
code5 += '\t}\n';
code5 += '\tthis.apiTexture = apiTexture;\n';
code5 += '\n';
code5 += '\tR3.D3.API.Texture.call(\n';
code5 += '\t\tthis,\n';
code5 += '\t\tthis.apiTexture,\n';
code5 += '\t\tthis.apiTexture.parentMaterials,\n';
code5 += '\t\tthis.apiTexture.mipmaps,\n';
code5 += '\t\tthis.apiTexture.mapping,\n';
code5 += '\t\tthis.apiTexture.wrapS,\n';
code5 += '\t\tthis.apiTexture.wrapT,\n';
code5 += '\t\tthis.apiTexture.magFilter,\n';
code5 += '\t\tthis.apiTexture.minFilter,\n';
code5 += '\t\tthis.apiTexture.anisotropy,\n';
code5 += '\t\tthis.apiTexture.format,\n';
code5 += '\t\tthis.apiTexture.storageType,\n';
code5 += '\t\tthis.apiTexture.offset,\n';
code5 += '\t\tthis.apiTexture.repeat,\n';
code5 += '\t\tthis.apiTexture.rotation,\n';
code5 += '\t\tthis.apiTexture.center,\n';
code5 += '\t\tthis.apiTexture.matrixAutoUpdate,\n';
code5 += '\t\tthis.apiTexture.generateMipMaps,\n';
code5 += '\t\tthis.apiTexture.premultiplyAlpha,\n';
code5 += '\t\tthis.apiTexture.flipY,\n';
code5 += '\t\tthis.apiTexture.unpackAlignment,\n';
code5 += '\t\tthis.apiTexture.encoding,\n';
code5 += '\t\tthis.apiTexture.version,\n';
code5 += '\t\tthis.apiTexture.animated,\n';
code5 += '\t\tthis.apiTexture.reverseAnimation,\n';
code5 += '\t\tthis.apiTexture.forward\n';
code5 += '\t);';
function build() { function build() {
return gulp.src('./src/r3-*.js') return gulp.src('./src/r3-*.js')
.pipe(sort()) .pipe(sort())
.pipe(concat('r3.js')) .pipe(concat('r3.js'))
.pipe(replace('__DATE__', new Date().toString())) .pipe(replace('__DATE__', new Date().toString()))
.pipe(replace('__API_COMPONENT_MACRO__', code)); .pipe(replace('__API_COMPONENT_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(minify({ .pipe(minify({
ext:{ ext:{
src:'.js', src:'.js',

View File

@ -31,6 +31,84 @@ R3.API.Component = function(
R3.API.Component.prototype.constructor = R3.API.Component; R3.API.Component.prototype.constructor = R3.API.Component;
R3.API.Component.prototype.getParent = function(property, index, constructor) {
if (R3.Utils.UndefinedOrNull(constructor)) {
constructor = null;
}
if (R3.Utils.UndefinedOrNull(index)) {
index = null;
}
if (this.parent) {
/**
* Parent defined
*/
if (this.parent.hasOwnProperty(property)) {
if (constructor) {
if (index) {
if (this.parent[property][index] instanceof constructor) {
return this.parent[property][index];
} else {
if (typeof this.parent.getParent === 'function') {
return this.parent.getParent(property, index, constructor);
} else {
console.warn('getParent not defined on API object : ' + this.parent + ' - you should avoid having these messsages');
return null;
}
}
} else {
if (this.parent[property] instanceof constructor) {
return this.parent[property];
} else {
if (typeof this.parent.getParent === 'function') {
return this.parent.getParent(property, index, constructor);
} else {
console.warn('getParent not defined on API object : ' + this.parent + ' - you should avoid having these messsages');
return null;
}
}
}
} else {
if (index) {
return this.parent[property][index];
} else {
return this.parent[property];
}
}
} else {
/**
* This parent does not have the property - go a level higher
*/
if (typeof this.parent.getParent === 'function') {
return this.parent.getParent(property, index, constructor);
} else {
console.warn('getParent not defined on API object : ' + this.parent + ' - you should avoid having these messsages');
return null;
}
}
} else {
/**
* No parent defined
*/
console.warn('property : ' + property + ' of type ' + constructor + ' was not found in the parent chain');
return null;
}
};
R3.API.Component.prototype.getComponentType = function() { R3.API.Component.prototype.getComponentType = function() {
if (this instanceof R3.API.Box3) { if (this instanceof R3.API.Box3) {
@ -180,6 +258,9 @@ R3.API.Component.prototype.getComponentType = function() {
if (this instanceof R3.D3.API.Effect.Anaglyph) { if (this instanceof R3.D3.API.Effect.Anaglyph) {
return R3.Component.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) { if (this instanceof R3.D3.API.Fog) {
return R3.Component.FOG; return R3.Component.FOG;
} }
@ -369,7 +450,7 @@ R3.API.Component.prototype.getComponentType = function() {
if (this instanceof R3.D3.API.Mesh) { if (this instanceof R3.D3.API.Mesh) {
return R3.Component.MESH; return R3.Component.MESH;
} }
if (this instanceof R3.D3.API.ParticleEngine) { if (this instanceof R3.D3.API.Particle.Engine) {
return R3.Component.PARTICLE_ENGINE; return R3.Component.PARTICLE_ENGINE;
} }
if (this instanceof R3.D3.API.Particle) { if (this instanceof R3.D3.API.Particle) {

View File

@ -281,7 +281,7 @@ R3.Component.PASS_RENDER = 0xd;
R3.Component.SCENE = 0xe; R3.Component.SCENE = 0xe;
R3.Component.RAYCASTER = 0xf; R3.Component.RAYCASTER = 0xf;
R3.Component.TEXT = 0x10; R3.Component.TEXT = 0x10;
R3.Component.UNUSED = 0x11; R3.Component.FACE = 0x11;
R3.Component.VIEWPORT = 0x12; R3.Component.VIEWPORT = 0x12;
R3.Component.SYSTEM = 0x13; R3.Component.SYSTEM = 0x13;
R3.Component.GRAPHICS = 0x14; R3.Component.GRAPHICS = 0x14;
@ -942,10 +942,10 @@ R3.Component.GetComponentInfo = function(number) {
apiConstructor : R3.API.Controls.D3.Orbit apiConstructor : R3.API.Controls.D3.Orbit
}; };
case 0x52 : return { case 0x52 : return {
name : 'R3.D3.ParticleEngine', name : 'R3.D3.Particle.Engine',
runtime : R3.Component.GRAPHICS_RUNTIME, runtime : R3.Component.GRAPHICS_RUNTIME,
constructor : R3.D3.ParticleEngine, constructor : R3.D3.Particle.Engine,
apiConstructor : R3.D3.API.ParticleEngine apiConstructor : R3.D3.API.Particle.Engine
}; };
case 0x53 : return { case 0x53 : return {
name : 'R3.System.Particle', name : 'R3.System.Particle',
@ -1623,6 +1623,9 @@ R3.Component.prototype.getComponentType = function() {
if (this instanceof R3.D3.Effect.Stereo) { if (this instanceof R3.D3.Effect.Stereo) {
return R3.Component.EFFECT_STEREO; return R3.Component.EFFECT_STEREO;
} }
if (this instanceof R3.D3.Face) {
return R3.Component.FACE;
}
if (this instanceof R3.D3.Fog) { if (this instanceof R3.D3.Fog) {
return R3.Component.FOG; return R3.Component.FOG;
} }
@ -1809,7 +1812,7 @@ R3.Component.prototype.getComponentType = function() {
if (this instanceof R3.D3.Mesh) { if (this instanceof R3.D3.Mesh) {
return R3.Component.MESH; return R3.Component.MESH;
} }
if (this instanceof R3.D3.ParticleEngine) { if (this instanceof R3.D3.Particle.Engine) {
return R3.Component.PARTICLE_ENGINE; return R3.Component.PARTICLE_ENGINE;
} }
if (this instanceof R3.D3.Particle) { if (this instanceof R3.D3.Particle) {

View File

@ -1,58 +1,22 @@
/** /**
* R3.API.Controls * R3.API.Controls
* @param parent * @param apiComponent
* @param id
* @param name
* @param canvas * @param canvas
* @constructor * @constructor
*/ */
R3.API.Controls = function( R3.API.Controls = function(
parent, apiComponent,
id,
name,
canvas canvas
) { ) {
R3.API.Component.call(
this,
parent
);
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Controls';
switch (this.componentType) {
case R3.Component.CONTROLS_TOUCH:
name = 'Controls Touch';
break;
case R3.Component.CONTROLS_KEYBOARD :
name = 'Controls Keyboard';
break;
case R3.Component.CONTROLS_MOUSE :
name = 'Controls Mouse';
break;
case R3.Component.CONTROLS_EDITOR :
name = 'Controls Editor';
break;
case R3.Component.CONTROLS_FIRST_PERSON :
name = 'Controls First Person';
break;
case R3.Component.CONTROLS_ORBIT :
name = 'Controls Orbit';
break;
}
name += ' (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(canvas)) { if (R3.Utils.UndefinedOrNull(canvas)) {
canvas = null; /**
* Try to attach the controls to the parent canvas
* @type {null}
*/
canvas = this.getParent('canvas');
} }
this.canvas = canvas; this.canvas = canvas;
}; };

View File

@ -13,14 +13,20 @@ R3.API.Controls.D3 = function(
R3.API.Controls.call( R3.API.Controls.call(
this, this,
apiControls.parent, apiControls,
apiControls.id,
apiControls.name,
apiControls.canvas apiControls.canvas
); );
if (R3.Utils.UndefinedOrNull(camera)) { if (R3.Utils.UndefinedOrNull(camera)) {
camera = null; /**
* Get the cameraIndexEdit of the scene which is responsible for these controls
*/
var cameraIndex = this.getParent('cameraIndexEdit');
/**
* Now get the camera with this index from our project cameras
*/
camera = this.getParent('cameras', cameraIndex);
} }
this.camera = camera; this.camera = camera;
}; };

View File

@ -7,9 +7,7 @@ R3.API.Controls.Keyboard = function(
) { ) {
R3.API.Controls.call( R3.API.Controls.call(
this, this,
apiControls.parent, apiControls,
apiControls.id,
apiControls.name,
apiControls.canvas apiControls.canvas
); );
}; };

View File

@ -7,9 +7,7 @@ R3.API.Controls.Mouse = function(
) { ) {
R3.API.Controls.call( R3.API.Controls.call(
this, this,
apiControls.parent, apiControls,
apiControls.id,
apiControls.name,
apiControls.canvas apiControls.canvas
); );
}; };

View File

@ -10,9 +10,7 @@ R3.API.Controls.Touch = function(
R3.API.Controls.call( R3.API.Controls.call(
this, this,
apiControls.parent, apiControls,
apiControls.id,
apiControls.name,
apiControls.canvas apiControls.canvas
); );

View File

@ -1,88 +1,21 @@
/** /**
* R3.API.Curve * R3.API.Curve
* @param id * @param apiComponent
* @param name
* @param curveType
* @param parent
* @param arcLenghDivisions * @param arcLenghDivisions
* @constructor * @constructor
*/ */
R3.API.Curve = function( R3.API.Curve = function(
parent, apiComponent,
id,
name,
curveType,
arcLenghDivisions arcLenghDivisions
) { ) {
R3.API.Component.call(
this,
parent
);
if (R3.Utils.UndefinedOrNull(curveType)) { __API_COMPONENT_MACRO__
curveType = R3.API.Curve.CURVE_TYPE_NONE;
}
this.curveType = curveType;
if (R3.Utils.UndefinedOrNull(name)) {
switch (this.curveType) {
case R3.API.Curve.CURVE_TYPE_NONE :
name = 'Curve';
break;
case R3.API.Curve.CURVE_TYPE_PATH :
name = 'Curve Path';
break;
default:
console.log('no nice name for curve');
}
name += ' (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(arcLenghDivisions)) { if (R3.Utils.UndefinedOrNull(arcLenghDivisions)) {
arcLenghDivisions = 200; arcLenghDivisions = 200;
} }
this.arcLenghDivisions = arcLenghDivisions; this.arcLenghDivisions = arcLenghDivisions;
R3.API.Component.call(
this,
R3.API.Curve.GetComponentType(this.curveType),
parent
);
}; };
R3.API.Curve.prototype = Object.create(R3.API.Curve.prototype); R3.API.Curve.prototype = Object.create(R3.API.Curve.prototype);
R3.API.Curve.prototype.constructor = R3.API.Curve; R3.API.Curve.prototype.constructor = R3.API.Curve;
R3.API.Curve.GetComponentType = function(curveType) {
var componentType = null;
switch (curveType) {
case R3.API.Curve.CURVE_TYPE_NONE :
componentType = R3.Component.CURVE;
break;
case R3.API.Curve.CURVE_TYPE_PATH :
componentType = R3.Component.CURVE_PATH;
break;
case R3.API.Curve.CURVE_TYPE_PATH_2D :
componentType = R3.Component.CURVE_PATH_D2;
break;
case R3.API.Curve.CURVE_TYPE_PATH_2D_SHAPE :
componentType = R3.Component.CURVE_PATH_D2_SHAPE;
break;
default :
throw new Error('unhandled curve type');
}
return componentType;
};
R3.API.Curve.CURVE_TYPE_NONE = 0x0;
R3.API.Curve.CURVE_TYPE_PATH = 0x1;
R3.API.Curve.CURVE_TYPE_PATH_2D = 0x2;
R3.API.Curve.CURVE_TYPE_PATH_2D_SHAPE = 0x3;

View File

@ -11,14 +11,15 @@ R3.API.Curve.Path = function(
autoClose autoClose
) { ) {
if (R3.Utils.UndefinedOrNull(apiCurve)) { if (R3.Utils.UndefinedOrNull(apiCurve)) {
apiCurve = { apiCurve = {}
curveType: R3.API.Curve.CURVE_TYPE_PATH
};
} }
this.apiCurve = apiCurve;
if (R3.Utils.UndefinedOrNull(apiCurve.curveType)) { R3.API.Curve.call(
apiCurve.curveType = R3.API.Curve.CURVE_TYPE_PATH; this,
} apiCurve,
apiCurve.arcLenghDivisions
);
if (R3.Utils.UndefinedOrNull(curves)) { if (R3.Utils.UndefinedOrNull(curves)) {
curves = []; curves = [];
@ -29,15 +30,6 @@ R3.API.Curve.Path = function(
autoClose = false; autoClose = false;
} }
this.autoClose = autoClose; this.autoClose = autoClose;
R3.API.Curve.call(
this,
apiCurve.id,
apiCurve.name,
apiCurve.curveType,
apiCurve.parent,
apiCurve.arcLenghDivisions
);
}; };
R3.API.Curve.Path.prototype = Object.create(R3.API.Curve.prototype); R3.API.Curve.Path.prototype = Object.create(R3.API.Curve.prototype);

View File

@ -8,20 +8,11 @@ R3.API.Curve.Path.D2 = function(
apiCurvePath, apiCurvePath,
points points
) { ) {
if (R3.Utils.UndefinedOrNull(apiCurvePath)) { if (R3.Utils.UndefinedOrNull(apiCurvePath)) {
apiCurvePath = { apiCurvePath = {}
curveType: R3.API.Curve.CURVE_TYPE_PATH_2D
};
} }
this.apiCurvePath = apiCurvePath;
if (R3.Utils.UndefinedOrNull(apiCurvePath.curveType)) {
apiCurvePath.curveType = R3.API.Curve.CURVE_TYPE_PATH_2D;
}
if (R3.Utils.UndefinedOrNull(points)) {
points = [];
}
this.points = points;
R3.API.Curve.Path.call( R3.API.Curve.Path.call(
this, this,
@ -29,6 +20,12 @@ R3.API.Curve.Path.D2 = function(
apiCurvePath.curves, apiCurvePath.curves,
apiCurvePath.autoClose apiCurvePath.autoClose
); );
if (R3.Utils.UndefinedOrNull(points)) {
points = [];
}
this.points = points;
}; };
R3.API.Curve.Path.D2.prototype = Object.create(R3.API.Curve.Path.prototype); R3.API.Curve.Path.D2.prototype = Object.create(R3.API.Curve.Path.prototype);

View File

@ -7,13 +7,7 @@ R3.API.Curve.Path.D2.Shape = function(
apiCurvePathD2 apiCurvePathD2
) { ) {
if (R3.Utils.UndefinedOrNull(apiCurvePathD2)) { if (R3.Utils.UndefinedOrNull(apiCurvePathD2)) {
apiCurvePathD2 = { apiCurvePathD2 = {};
curveType : R3.API.Curve.CURVE_TYPE_PATH_2D_SHAPE
};
}
if (R3.Utils.UndefinedOrNull(apiCurvePathD2.curveType)) {
apiCurvePathD2.curveType = R3.API.Curve.CURVE_TYPE_PATH_2D_SHAPE ;
} }
R3.API.Curve.Path.call( R3.API.Curve.Path.call(

View File

@ -1,31 +1,20 @@
/** /**
* Custom Code Component * Custom Code Component
* @param id * @param apiComponent
* @param name
* @param eventId * @param eventId
* @param code * @param code
* @param parent
* @constructor * @constructor
*/ */
R3.API.CustomCode = function( R3.API.CustomCode = function(
id, apiComponent,
name,
eventId, eventId,
code, code
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'CustomCode (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(eventId)) { if (R3.Utils.UndefinedOrNull(eventId)) {
eventId = 42; eventId = R3.Event.KEY_UP;
} }
this.eventId = eventId; this.eventId = eventId;
@ -33,12 +22,6 @@ R3.API.CustomCode = function(
code = "return null;\n//@ sourceURL=" + this.name + ".js"; code = "return null;\n//@ sourceURL=" + this.name + ".js";
} }
this.code = code; this.code = code;
R3.API.Component.call(
this,
R3.Component.CUSTOM_CODE,
parent
);
}; };
R3.API.CustomCode.prototype = Object.create(R3.API.Component.prototype); R3.API.CustomCode.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,53 +1,21 @@
/** /**
* API DomElement * API DomElement
* @param id * @param apiComponent
* @param name
* @param domElementId * @param domElementId
* @param parent
* @constructor * @constructor
*/ */
R3.API.DomElement = function( R3.API.DomElement = function(
id, apiComponent,
name, domElementId
domElementId,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'DOM Element (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(domElementId)) { if (R3.Utils.UndefinedOrNull(domElementId)) {
domElementId = ''; domElementId = '';
} }
this.domElementId = domElementId; this.domElementId = domElementId;
R3.API.Component.call(
this,
R3.Component.DOM_ELEMENT,
parent
);
}; };
R3.API.DomElement.prototype = Object.create(R3.API.Component.prototype); R3.API.DomElement.prototype = Object.create(R3.API.Component.prototype);
R3.API.DomElement.prototype.constructor = R3.API.DomElement; R3.API.DomElement.prototype.constructor = R3.API.DomElement;
/**
* Returns an API domElement from an Object domElement
* @param objectDomElement
* @constructor
*/
R3.API.DomElement.FromObject = function(objectDomElement) {
return new R3.API.DomElement(
objectDomElement.id,
objectDomElement.name,
objectDomElement.domElementId,
objectDomElement.parent
)
};

View File

@ -1,28 +1,17 @@
/** /**
* R3.API.Box3 * R3.API.Box3
* @constructor * @constructor
* @param id * @param apiComponent
* @param name
* @param parent
* @param start * @param start
* @param count * @param count
*/ */
R3.API.DrawRange = function( R3.API.DrawRange = function(
id, apiComponent,
name,
parent,
start, start,
count count
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'DrawRange (' + id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(start)) { if (R3.Utils.UndefinedOrNull(start)) {
start = 0; start = 0;
@ -34,11 +23,6 @@ R3.API.DrawRange = function(
} }
this.count = count; this.count = count;
R3.API.Component.call(
this,
R3.Component.DRAW_RANGE,
parent
)
}; };
R3.API.DrawRange.prototype = Object.create(R3.API.Component.prototype); R3.API.DrawRange.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,67 +1,21 @@
/** /**
* Entity API Object (for storing / loading entities to and from API) * Entity API Object (for storing / loading entities to and from API)
* @constructor * @constructor
* @param id * @param apiComponent
* @param name
* @param entities R3.API.Entity[] * @param entities R3.API.Entity[]
* @param defaultEntity
* @param parent
*/ */
R3.API.EntityManager = function( R3.API.EntityManager = function(
id, apiComponent,
name, entities
entities,
defaultEntity,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Entity Manager (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(entities)) { if (R3.Utils.UndefinedOrNull(entities)) {
entities = []; entities = [];
} }
this.entities = entities; this.entities = entities;
if (R3.Utils.UndefinedOrNull(defaultEntity)) {
defaultEntity = null;
}
this.defaultEntity = defaultEntity;
R3.API.Component.call(
this,
R3.Component.ENTITY_MANAGER,
parent
);
}; };
R3.API.EntityManager.prototype = Object.create(R3.API.Component.prototype); R3.API.EntityManager.prototype = Object.create(R3.API.Component.prototype);
R3.API.EntityManager.prototype.constructor = R3.API.EntityManager; R3.API.EntityManager.prototype.constructor = R3.API.EntityManager;
/**
* Creates an API entity manager from an Object entity manager
* @param objectEntityManager
* @constructor
*/
R3.API.EntityManager.FromObject = function(objectEntityManager) {
var apiEntities = objectEntityManager.entities.map(
function(objectEntity) {
return R3.API.Entity.FromObject(objectEntity);
}
);
return new R3.API.EntityManager(
objectEntityManager.id,
objectEntityManager.name,
apiEntities,
objectEntityManager.defaultEntity,
objectEntityManager.parent
);
};

View File

@ -1,58 +1,22 @@
/** /**
* Entity API Object (for storing / loading entities to and from API) * Entity API Object (for storing / loading entities to and from API)
* @param id * @param apiComponent
* @param name * @param components R3.API.Component[]
* @param components R3.Component[]
* @param parent R3.Entity
* @constructor * @constructor
*/ */
R3.API.Entity = function( R3.API.Entity = function(
id, apiComponent,
name, components
components,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Entity (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(components)) { if (R3.Utils.UndefinedOrNull(components)) {
components = []; components = [];
} }
this.components = components; this.components = components;
var componentType = R3.Component.ENTITY;
if (this instanceof R3.API.Project) {
componentType = R3.Component.PROJECT;
}
R3.API.Component.call(
this,
componentType,
parent
);
}; };
R3.API.Entity.prototype = Object.create(R3.API.Component.prototype); R3.API.Entity.prototype = Object.create(R3.API.Component.prototype);
R3.API.Entity.prototype.constructor = R3.API.Entity; R3.API.Entity.prototype.constructor = R3.API.Entity;
/**
* Returns an API entity from an Object entity
* @param objectEntity
* @constructor
*/
R3.API.Entity.FromObject = function(objectEntity) {
return new R3.API.Entity(
objectEntity.id,
objectEntity.name,
objectEntity.components,
objectEntity.parent
)
};

View File

@ -1,30 +1,19 @@
/** /**
* R3.API.Group * R3.API.Group
* @constructor * @constructor
* @param id * @param apiComponent
* @param name
* @param parent
* @param start * @param start
* @param count * @param count
* @param materialIndex * @param materialIndex
*/ */
R3.API.Group = function( R3.API.Group = function(
id, apiComponent,
name,
parent,
start, start,
count, count,
materialIndex materialIndex
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Group (' + id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(start)) { if (R3.Utils.UndefinedOrNull(start)) {
start = 0; start = 0;
@ -40,12 +29,6 @@ R3.API.Group = function(
materialIndex = 0; materialIndex = 0;
} }
this.materialIndex = materialIndex; this.materialIndex = materialIndex;
R3.API.Component.call(
this,
R3.Component.GROUP,
parent
)
}; };
R3.API.Group.prototype = Object.create(R3.API.Component.prototype); R3.API.Group.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,64 +1,21 @@
/** /**
* Raw GUI API object - should always correspond with the GUI Schema * Raw GUI API object - should always correspond with the GUI Schema
* @param id * @param apiComponent
* @param name
* @param domElement * @param domElement
* @param parent
* @constructor * @constructor
*/ */
R3.API.GUI = function( R3.API.GUI = function(
id, apiComponent,
name, domElement
domElement,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'GUI (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(domElement)) { if (R3.Utils.UndefinedOrNull(domElement)) {
domElement = null; domElement = null;
} }
this.domElement = domElement; this.domElement = domElement;
R3.API.Component.call(
this,
R3.Component.GUI,
parent
);
}; };
R3.API.GUI.prototype = Object.create(R3.API.Component.prototype); R3.API.GUI.prototype = Object.create(R3.API.Component.prototype);
R3.API.GUI.prototype.constructor = R3.API.GUI; R3.API.GUI.prototype.constructor = R3.API.GUI;
/**
* Creates an API GUI from an Object GUI
* @param objectGUI
* @constructor
*/
R3.API.GUI.FromObject = function(objectGUI) {
var apiDomElement = null;
if (objectGUI.domElement) {
if (objectGUI.domElement instanceof Object) {
apiDomElement = R3.API.DomElement.FromObject(objectGUI.domElement);
} else {
apiDomElement = objectGUI.domElement;
}
}
return new R3.API.GUI(
objectGUI.id,
objectGUI.name,
apiDomElement,
objectGUI.parent
);
};

View File

@ -1,9 +1,6 @@
/** /**
* R3.API.Image * R3.API.Image
* @param id * @param apiComponent
* @param name
* @param parent
* @param parentTexture
* @param fileName * @param fileName
* @param extension * @param extension
* @param path * @param path
@ -14,10 +11,7 @@
* @constructor * @constructor
*/ */
R3.API.Image = function( R3.API.Image = function(
id, apiComponent,
name,
parent,
parentTexture,
fileName, fileName,
extension, extension,
path, path,
@ -26,20 +20,8 @@ R3.API.Image = function(
width, width,
height height
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Image ' + id;
}
this.name = name;
if (R3.Utils.UndefinedOrNull(parentTexture)) {
parentTexture = null;
}
this.parentTexture = parentTexture;
if (R3.Utils.UndefinedOrNull(fileName)) { if (R3.Utils.UndefinedOrNull(fileName)) {
fileName = R3.Utils.LowerUnderscore(name); fileName = R3.Utils.LowerUnderscore(name);
@ -89,11 +71,6 @@ R3.API.Image = function(
} }
this.height = height; this.height = height;
R3.API.Component.call(
this,
R3.Component.IMAGE,
parent
);
}; };
R3.API.Image.prototype = Object.create(R3.API.Component.prototype); R3.API.Image.prototype = Object.create(R3.API.Component.prototype);

View File

@ -56,33 +56,6 @@ R3.API.Matrix4 = function ApiMatrix4(
this.up = new R3.API.Vector4(); this.up = new R3.API.Vector4();
}; };
/**
* Returns an API matrix from an Object matrix
* @param objectMatrix
* @constructor
*/
R3.API.Matrix4.FromObject = function(objectMatrix) {
if (objectMatrix.rows) {
return new R3.API.Matrix4(
R3.API.Vector4.FromObject(objectMatrix.rows[0]),
R3.API.Vector4.FromObject(objectMatrix.rows[1]),
R3.API.Vector4.FromObject(objectMatrix.rows[2]),
R3.API.Vector4.FromObject(objectMatrix.rows[3])
);
} else if (objectMatrix instanceof Array) {
return new R3.API.Matrix4(
R3.API.Vector4.FromObject(objectMatrix[0]),
R3.API.Vector4.FromObject(objectMatrix[1]),
R3.API.Vector4.FromObject(objectMatrix[2]),
R3.API.Vector4.FromObject(objectMatrix[3])
);
} else {
console.warn('Unsupported object matrix type - whats your DB version?');
throw new Error('Unsupported object matrix type - whats your DB version?');
}
};
R3.API.Matrix4.prototype.rotationMatrixX = function(radians) { R3.API.Matrix4.prototype.rotationMatrixX = function(radians) {
this.identity(); this.identity();
this.rows[1] = new R3.API.Vector4(0, Math.cos(radians), -1 * Math.sin(radians), 0); this.rows[1] = new R3.API.Vector4(0, Math.cos(radians), -1 * Math.sin(radians), 0);

View File

@ -1,28 +1,17 @@
/** /**
* API Mouse * R3.API.Mouse
* @param id * @param apiComponent
* @param name
* @param parent
* @param x * @param x
* @param y * @param y
* @constructor * @constructor
*/ */
R3.API.Mouse = function( R3.API.Mouse = function(
id, apiComponent,
name,
parent,
x, x,
y y
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Mouse (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(x)) { if (R3.Utils.UndefinedOrNull(x)) {
x = 0; x = 0;
@ -34,11 +23,6 @@ R3.API.Mouse = function(
} }
this.y = y; this.y = y;
R3.API.Component.call(
this,
R3.Component.MOUSE,
parent
);
}; };
R3.API.Mouse.prototype = Object.create(R3.API.Component.prototype); R3.API.Mouse.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,20 +1,17 @@
/**
* R3.API.Plane
* @param apiComponent
* @param normal
* @param constant
* @constructor
*/
R3.API.Plane = function( R3.API.Plane = function(
id, apiComponent,
name,
normal, normal,
constant, constant
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Plane (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(normal)) { if (R3.Utils.UndefinedOrNull(normal)) {
normal = new R3.API.Vector3(1,0,0); normal = new R3.API.Vector3(1,0,0);
@ -26,28 +23,8 @@ R3.API.Plane = function(
} }
this.constant = constant; this.constant = constant;
R3.API.Component.call(
this,
R3.Component.PLANE,
parent
);
}; };
R3.API.Plane.prototype = Object.create(R3.API.Component.prototype); R3.API.Plane.prototype = Object.create(R3.API.Component.prototype);
R3.API.Plane.prototype.constructor = R3.API.Plane; R3.API.Plane.prototype.constructor = R3.API.Plane;
/**
* Returns an API vector from an Object vector
* @param objectPlane
* @constructor
*/
R3.API.Plane.FromObject = function(objectPlane) {
return new R3.API.Plane(
objectPlane.id,
objectPlane.name,
R3.API.Vector3.FromObject(objectPlane.normal),
objectPlane.constant,
objectPlane.parent
);
};

View File

@ -1,8 +1,6 @@
/** /**
* API Project * API Project
* @param id * @param apiComponent
* @param name
* @param parent
* @param users * @param users
* @param isPublic * @param isPublic
* @param entities * @param entities
@ -12,9 +10,7 @@
* @constructor * @constructor
*/ */
R3.API.Project = function( R3.API.Project = function(
id, apiComponent,
name,
parent,
users, users,
isPublic, isPublic,
entities, entities,
@ -22,15 +18,8 @@ R3.API.Project = function(
cameras, cameras,
mode mode
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Project (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(users)) { if (R3.Utils.UndefinedOrNull(users)) {
throw new Error('Only registered users can create projects'); throw new Error('Only registered users can create projects');
@ -71,14 +60,6 @@ R3.API.Project = function(
mode = R3.API.Project.APPLICATION_MODE_EDIT; mode = R3.API.Project.APPLICATION_MODE_EDIT;
} }
this.mode = mode; this.mode = mode;
R3.API.Component.call(
this,
this.id,
this.name,
this.components,
this.parent
);
}; };
R3.API.Project.prototype = Object.create(R3.API.Component.prototype); R3.API.Project.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,3 +1,7 @@
/**
* R3.API.Quaternion.Points
* @constructor
*/
R3.API.Quaternion.Points = function() { R3.API.Quaternion.Points = function() {
this.vectors = []; this.vectors = [];
}; };

View File

@ -1,94 +1,19 @@
/** /**
* R3.API.Renderer * R3.API.Renderer
* @param id
* @param name
* @param rendererType
* @param parent
* @param canvas
* @constructor * @constructor
* @param apiComponent
*/ */
R3.API.Renderer = function( R3.API.Renderer = function(
id, apiComponent
name,
parent,
rendererType
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(rendererType)) { __API_COMPONENT_MACRO__
rendererType = R3.API.Renderer.RENDERER_TYPE_NONE;
}
this.rendererType = rendererType;
if (R3.Utils.UndefinedOrNull(name)) {
switch (this.rendererType) {
case R3.API.Renderer.RENDERER_TYPE_NONE :
name = "Renderer";
break;
case R3.API.Renderer.RENDERER_TYPE_2D :
name = "Renderer 2D";
break;
case R3.API.Renderer.RENDERER_TYPE_3D :
name = "Renderer 3D";
break;
default :
console.warn('no nice name for renderer');
break;
}
name += " (" + this.id + ")";
}
this.name = name;
R3.API.Component.call(
this,
R3.API.Renderer.GetComponentType(this.rendererType),
parent
);
}; };
R3.API.Renderer.prototype = Object.create(R3.API.Component.prototype); R3.API.Renderer.prototype = Object.create(R3.API.Component.prototype);
R3.API.Renderer.prototype.constructor = R3.API.Renderer; R3.API.Renderer.prototype.constructor = R3.API.Renderer;
R3.API.Renderer.GetComponentType = function(rendererType) {
var componentType = null;
switch (rendererType) {
case R3.API.Renderer.RENDERER_TYPE_NONE :
componentType = R3.Component.RENDERER;
break;
case R3.API.Renderer.RENDERER_TYPE_2D :
componentType = R3.Component.RENDERER_D2;
break;
case R3.API.Renderer.RENDERER_TYPE_3D_CANVAS :
componentType = R3.Component.RENDERER_D3_CANVAS;
break;
case R3.API.Renderer.RENDERER_TYPE_3D_TARGET :
componentType = R3.Component.RENDERER_D3_TARGET;
break;
case R3.API.Renderer.RENDERER_TYPE_3D_CANVAS_AND_TARGET :
componentType = R3.Component.RENDERER_D3_CANVAS_TARGET;
break;
default :
console.warn('could not determine component type');
break;
}
return componentType;
};
R3.API.Renderer.RENDERER_TYPE_NONE = 0x0;
R3.API.Renderer.RENDERER_TYPE_2D = 0x1;
R3.API.Renderer.RENDERER_TYPE_3D_CANVAS = 0x2;
R3.API.Renderer.RENDERER_TYPE_3D_TARGET = 0x3;
R3.API.Renderer.RENDERER_TYPE_3D_CANVAS_AND_TARGET = 0x4;
R3.API.Renderer.MODE_CANVAS = 0x1; R3.API.Renderer.MODE_CANVAS = 0x1;
R3.API.Renderer.MODE_TARGET = 0x2; R3.API.Renderer.MODE_TARGET = 0x2;
R3.API.Renderer.MODE_CANVAS_AND_TARGET = 0x3; R3.API.Renderer.MODE_CANVAS_AND_TARGET = 0x3;

View File

@ -10,21 +10,13 @@ R3.API.Renderer.D2 = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) { if (R3.Utils.UndefinedOrNull(apiRenderer)) {
apiRenderer = { apiRenderer = {};
rendererType : R3.API.Renderer.RENDERER_TYPE_2D
};
}
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_2D;
} }
this.apiRenderer = apiRenderer;
R3.API.Renderer.call( R3.API.Renderer.call(
this, this,
apiRenderer.id, this.apiRenderer
apiRenderer.name,
apiRenderer.parent,
apiRenderer.rendererType
); );
if (R3.Utils.UndefinedOrNull(canvas)) { if (R3.Utils.UndefinedOrNull(canvas)) {
@ -35,4 +27,4 @@ R3.API.Renderer.D2 = function(
}; };
R3.API.Renderer.D2.prototype = Object.create(R3.API.Renderer.prototype); R3.API.Renderer.D2.prototype = Object.create(R3.API.Renderer.prototype);
R3.API.Renderer.D2.prototype.constructor = R3.API.Renderer.D2; R3.API.Renderer.D2.prototype.constructor = R3.API.Renderer.D2;

View File

@ -1,296 +1,29 @@
/** /**
* R3.API.Renderer.D3 * R3.API.Renderer.D3.Canvas.Target
* @param apiRenderer
* @param renderMode
* @param autoClear
* @param autoClearColor
* @param autoClearDepth
* @param autoClearStencil
* @param gammaFactor
* @param gammaInput
* @param gammaOutput
* @param maxMorphTargets
* @param maxMorphNormals
* @param physicallyCorrectLights
* @param shadowMapEnabled
* @param shadowMapAutoUpdate
* @param shadowMapNeedsUpdate
* @param shadowMapType
* @param shadowMapRenderReverseSided
* @param shadowMapRenderSingleSided
* @param sortObjects
* @param toneMapping
* @param toneMappingExposure
* @param toneMappingWhitePoint
* @param premultipliedAlpha
* @param antialias
* @param stencil
* @param preserveDrawingBuffer
* @param depth
* @param logarithmicDepthBuffer
* @param localClippingEnabled
* @param renderTarget
* @param clippingPlanes
* @param clearColor
* @param viewports
* @param alpha
* @param opacity
* @param composer - only one composer can be active at a time
* @param effect - only one effect can be active at a time
* @param enableComposer
* @param enableEffect
* @constructor * @constructor
* @param apiRendererD3Canvas
* @param target
*/ */
R3.API.Renderer.D3.Canvas.Target = function( R3.API.Renderer.D3.Canvas.Target = function(
apiRenderer, apiRendererD3Canvas,
renderMode, target
autoClear,
autoClearColor,
autoClearDepth,
autoClearStencil,
gammaFactor,
gammaInput,
gammaOutput,
maxMorphTargets,
maxMorphNormals,
physicallyCorrectLights,
shadowMapEnabled,
shadowMapAutoUpdate,
shadowMapNeedsUpdate,
shadowMapType,
shadowMapRenderReverseSided,
shadowMapRenderSingleSided,
sortObjects,
toneMapping,
toneMappingExposure,
toneMappingWhitePoint,
premultipliedAlpha,
antialias,
stencil,
preserveDrawingBuffer,
depth,
logarithmicDepthBuffer,
localClippingEnabled,
renderTarget,
clippingPlanes,
clearColor,
viewports,
alpha,
opacity
) { ) {
if (R3.Utils.UndefinedOrNull(apiRendererD3Canvas)) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) { apiRendererD3Canvas = {};
apiRenderer = {
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
};
} }
this.apiRendererD3Canvas = apiRendererD3Canvas;
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) { R3.API.Renderer.D3.Canvas.call(
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
}
if (R3.Utils.UndefinedOrNull(renderMode)) {
renderMode = R3.API.Renderer.MODE_CANVAS;
}
this.renderMode = renderMode;
if (R3.Utils.UndefinedOrNull(autoClear)) {
autoClear = true;
}
this.autoClear = autoClear;
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
autoClearColor = true;
}
this.autoClearColor = autoClearColor;
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
autoClearDepth = true;
}
this.autoClearDepth = autoClearDepth;
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
autoClearStencil = true;
}
this.autoClearStencil = autoClearStencil;
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
gammaFactor = 2;
}
this.gammaFactor = gammaFactor;
if (R3.Utils.UndefinedOrNull(gammaInput)) {
gammaInput = false;
}
this.gammaInput = gammaInput;
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
gammaOutput = false;
}
this.gammaOutput = gammaOutput;
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
maxMorphTargets = 8;
}
this.maxMorphTargets = maxMorphTargets;
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
maxMorphNormals = 4;
}
this.maxMorphNormals = maxMorphNormals;
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
physicallyCorrectLights = false;
}
this.physicallyCorrectLights = physicallyCorrectLights;
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
shadowMapEnabled = false;
}
this.shadowMapEnabled = shadowMapEnabled;
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
shadowMapAutoUpdate = true;
}
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
shadowMapNeedsUpdate = false;
}
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
}
this.shadowMapType = shadowMapType;
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
shadowMapRenderReverseSided = true;
}
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
shadowMapRenderSingleSided = true;
}
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
if (R3.Utils.UndefinedOrNull(sortObjects)) {
sortObjects = true;
}
this.sortObjects = sortObjects;
if (R3.Utils.UndefinedOrNull(toneMapping)) {
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
}
this.toneMapping = toneMapping;
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
toneMappingExposure = 1;
}
this.toneMappingExposure = toneMappingExposure;
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
toneMappingWhitePoint = 1;
}
this.toneMappingWhitePoint = toneMappingWhitePoint;
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
premultipliedAlpha = true;
}
this.premultipliedAlpha = premultipliedAlpha;
if (R3.Utils.UndefinedOrNull(antialias)) {
antialias = false;
}
this.antialias = antialias;
if (R3.Utils.UndefinedOrNull(stencil)) {
stencil = true;
}
this.stencil = stencil;
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
preserveDrawingBuffer = false;
}
this.preserveDrawingBuffer = preserveDrawingBuffer;
if (R3.Utils.UndefinedOrNull(depth)) {
depth = true;
}
this.depth = depth;
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
logarithmicDepthBuffer = false;
}
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
localClippingEnabled = false;
}
this.localClippingEnabled = localClippingEnabled;
if (R3.Utils.UndefinedOrNull(renderTarget)) {
renderTarget = null;
}
this.renderTarget = renderTarget;
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
clippingPlanes = [];
}
this.clippingPlanes = clippingPlanes;
if (R3.Utils.UndefinedOrNull(clearColor)) {
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
}
this.clearColor = clearColor;
if (R3.Utils.UndefinedOrNull(viewports)) {
viewports = [new R3.D3.API.Viewport()];
}
this.viewports = viewports;
if (R3.Utils.UndefinedOrNull(alpha)) {
alpha = true;
}
this.alpha = alpha;
if (R3.Utils.UndefinedOrNull(opacity)) {
opacity = 1;
}
this.opacity = opacity;
if (R3.Utils.UndefinedOrNull(composer)) {
composer = new R3.API.Composer();
composer.renderer = this.id;
}
this.composer = composer;
if (R3.Utils.UndefinedOrNull(effect)) {
effect = new R3.API.Effect();
effect.renderer = this.id;
}
this.effect = effect;
if (R3.Utils.UndefinedOrNull(enableComposer)) {
enableComposer = false;
}
this.enableComposer = enableComposer;
if (R3.Utils.UndefinedOrNull(enableEffect)) {
enableEffect = false;
}
this.enableEffect = enableEffect;
R3.API.Renderer.call(
this, this,
apiRenderer.id, this.apiRendererD3Canvas,
apiRenderer.name, this.apiRendererD3Canvas.canvas
apiRenderer.parent,
apiRenderer.rendererType,
apiRenderer.canvas
); );
if (R3.Utils.UndefinedOrNull(target)) {
target = new R3.D3.API.RenderTarget();
}
this.target = target;
}; };
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype); R3.API.Renderer.D3.Canvas.Target.prototype = Object.create(R3.API.Renderer.D3.Canvas.prototype);
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3; R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3.Canvas.Target;

View File

@ -1,274 +1,63 @@
/** /**
* R3.API.Renderer.D3 * R3.API.Renderer.D3.Canvas
* @param apiRenderer * @param apiRendererD3
* @param renderMode * @param canvas
* @param autoClear
* @param autoClearColor
* @param autoClearDepth
* @param autoClearStencil
* @param gammaFactor
* @param gammaInput
* @param gammaOutput
* @param maxMorphTargets
* @param maxMorphNormals
* @param physicallyCorrectLights
* @param shadowMapEnabled
* @param shadowMapAutoUpdate
* @param shadowMapNeedsUpdate
* @param shadowMapType
* @param shadowMapRenderReverseSided
* @param shadowMapRenderSingleSided
* @param sortObjects
* @param toneMapping
* @param toneMappingExposure
* @param toneMappingWhitePoint
* @param premultipliedAlpha
* @param antialias
* @param stencil
* @param preserveDrawingBuffer
* @param depth
* @param logarithmicDepthBuffer
* @param localClippingEnabled
* @param renderTarget
* @param clippingPlanes
* @param clearColor
* @param viewports
* @param alpha
* @param opacity
* @param composer - only one composer can be active at a time
* @param effect - only one effect can be active at a time
* @param enableComposer
* @param enableEffect
* @constructor * @constructor
*/ */
R3.API.Renderer.D3.Canvas = function( R3.API.Renderer.D3.Canvas = function(
apiRenderer, apiRendererD3,
renderMode, canvas
autoClear,
autoClearColor,
autoClearDepth,
autoClearStencil,
gammaFactor,
gammaInput,
gammaOutput,
maxMorphTargets,
maxMorphNormals,
physicallyCorrectLights,
shadowMapEnabled,
shadowMapAutoUpdate,
shadowMapNeedsUpdate,
shadowMapType,
shadowMapRenderReverseSided,
shadowMapRenderSingleSided,
sortObjects,
toneMapping,
toneMappingExposure,
toneMappingWhitePoint,
premultipliedAlpha,
antialias,
stencil,
preserveDrawingBuffer,
depth,
logarithmicDepthBuffer,
localClippingEnabled,
renderTarget,
clippingPlanes,
clearColor,
viewports,
alpha,
opacity
) { ) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) { if (R3.Utils.UndefinedOrNull(apiRendererD3)) {
apiRenderer = { apiRendererD3 = {};
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
};
} }
this.apiRendererD3 = apiRendererD3;
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) { R3.API.Renderer.D3.call(
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
}
if (R3.Utils.UndefinedOrNull(renderMode)) {
renderMode = R3.API.Renderer.MODE_CANVAS;
}
this.renderMode = renderMode;
if (R3.Utils.UndefinedOrNull(autoClear)) {
autoClear = true;
}
this.autoClear = autoClear;
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
autoClearColor = true;
}
this.autoClearColor = autoClearColor;
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
autoClearDepth = true;
}
this.autoClearDepth = autoClearDepth;
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
autoClearStencil = true;
}
this.autoClearStencil = autoClearStencil;
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
gammaFactor = 2;
}
this.gammaFactor = gammaFactor;
if (R3.Utils.UndefinedOrNull(gammaInput)) {
gammaInput = false;
}
this.gammaInput = gammaInput;
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
gammaOutput = false;
}
this.gammaOutput = gammaOutput;
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
maxMorphTargets = 8;
}
this.maxMorphTargets = maxMorphTargets;
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
maxMorphNormals = 4;
}
this.maxMorphNormals = maxMorphNormals;
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
physicallyCorrectLights = false;
}
this.physicallyCorrectLights = physicallyCorrectLights;
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
shadowMapEnabled = false;
}
this.shadowMapEnabled = shadowMapEnabled;
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
shadowMapAutoUpdate = true;
}
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
shadowMapNeedsUpdate = false;
}
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
}
this.shadowMapType = shadowMapType;
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
shadowMapRenderReverseSided = true;
}
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
shadowMapRenderSingleSided = true;
}
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
if (R3.Utils.UndefinedOrNull(sortObjects)) {
sortObjects = true;
}
this.sortObjects = sortObjects;
if (R3.Utils.UndefinedOrNull(toneMapping)) {
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
}
this.toneMapping = toneMapping;
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
toneMappingExposure = 1;
}
this.toneMappingExposure = toneMappingExposure;
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
toneMappingWhitePoint = 1;
}
this.toneMappingWhitePoint = toneMappingWhitePoint;
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
premultipliedAlpha = true;
}
this.premultipliedAlpha = premultipliedAlpha;
if (R3.Utils.UndefinedOrNull(antialias)) {
antialias = false;
}
this.antialias = antialias;
if (R3.Utils.UndefinedOrNull(stencil)) {
stencil = true;
}
this.stencil = stencil;
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
preserveDrawingBuffer = false;
}
this.preserveDrawingBuffer = preserveDrawingBuffer;
if (R3.Utils.UndefinedOrNull(depth)) {
depth = true;
}
this.depth = depth;
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
logarithmicDepthBuffer = false;
}
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
localClippingEnabled = false;
}
this.localClippingEnabled = localClippingEnabled;
if (R3.Utils.UndefinedOrNull(renderTarget)) {
renderTarget = null;
}
this.renderTarget = renderTarget;
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
clippingPlanes = [];
}
this.clippingPlanes = clippingPlanes;
if (R3.Utils.UndefinedOrNull(clearColor)) {
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
}
this.clearColor = clearColor;
if (R3.Utils.UndefinedOrNull(viewports)) {
viewports = [new R3.D3.API.Viewport()];
}
this.viewports = viewports;
if (R3.Utils.UndefinedOrNull(alpha)) {
alpha = true;
}
this.alpha = alpha;
if (R3.Utils.UndefinedOrNull(opacity)) {
opacity = 1;
}
this.opacity = opacity;
R3.API.Renderer.call(
this, this,
apiRenderer.id, this.apiRendererD3,
apiRenderer.name, this.apiRendererD3.renderMode,
apiRenderer.parent, this.apiRendererD3.autoClear,
apiRenderer.rendererType, this.apiRendererD3.autoClearColor,
apiRenderer.canvas 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
); );
if (R3.Utils.UndefinedOrNull(canvas)) {
canvas = new R3.API.Canvas();
}
this.canvas = canvas;
}; };
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype); R3.API.Renderer.D3.Canvas.prototype = Object.create(R3.API.Renderer.D3.prototype);
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3; R3.API.Renderer.D3.Canvas.prototype.constructor = R3.API.Renderer.D3.Canvas;

View File

@ -1,296 +1,63 @@
/** /**
* R3.API.Renderer.D3 * R3.API.Renderer.D3.Target
* @param apiRenderer
* @param renderMode
* @param autoClear
* @param autoClearColor
* @param autoClearDepth
* @param autoClearStencil
* @param gammaFactor
* @param gammaInput
* @param gammaOutput
* @param maxMorphTargets
* @param maxMorphNormals
* @param physicallyCorrectLights
* @param shadowMapEnabled
* @param shadowMapAutoUpdate
* @param shadowMapNeedsUpdate
* @param shadowMapType
* @param shadowMapRenderReverseSided
* @param shadowMapRenderSingleSided
* @param sortObjects
* @param toneMapping
* @param toneMappingExposure
* @param toneMappingWhitePoint
* @param premultipliedAlpha
* @param antialias
* @param stencil
* @param preserveDrawingBuffer
* @param depth
* @param logarithmicDepthBuffer
* @param localClippingEnabled
* @param renderTarget
* @param clippingPlanes
* @param clearColor
* @param viewports
* @param alpha
* @param opacity
* @param composer - only one composer can be active at a time
* @param effect - only one effect can be active at a time
* @param enableComposer
* @param enableEffect
* @constructor * @constructor
* @param apiRendererD3
* @param target
*/ */
R3.API.Renderer.D3.Target = function( R3.API.Renderer.D3.Target = function(
apiRenderer, apiRendererD3,
renderMode, target
autoClear,
autoClearColor,
autoClearDepth,
autoClearStencil,
gammaFactor,
gammaInput,
gammaOutput,
maxMorphTargets,
maxMorphNormals,
physicallyCorrectLights,
shadowMapEnabled,
shadowMapAutoUpdate,
shadowMapNeedsUpdate,
shadowMapType,
shadowMapRenderReverseSided,
shadowMapRenderSingleSided,
sortObjects,
toneMapping,
toneMappingExposure,
toneMappingWhitePoint,
premultipliedAlpha,
antialias,
stencil,
preserveDrawingBuffer,
depth,
logarithmicDepthBuffer,
localClippingEnabled,
renderTarget,
clippingPlanes,
clearColor,
viewports,
alpha,
opacity
) { ) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) { if (R3.Utils.UndefinedOrNull(apiRendererD3)) {
apiRenderer = { apiRendererD3 = {};
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
};
} }
this.apiRendererD3 = apiRendererD3;
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) { R3.API.Renderer.D3.call(
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
}
if (R3.Utils.UndefinedOrNull(renderMode)) {
renderMode = R3.API.Renderer.MODE_CANVAS;
}
this.renderMode = renderMode;
if (R3.Utils.UndefinedOrNull(autoClear)) {
autoClear = true;
}
this.autoClear = autoClear;
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
autoClearColor = true;
}
this.autoClearColor = autoClearColor;
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
autoClearDepth = true;
}
this.autoClearDepth = autoClearDepth;
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
autoClearStencil = true;
}
this.autoClearStencil = autoClearStencil;
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
gammaFactor = 2;
}
this.gammaFactor = gammaFactor;
if (R3.Utils.UndefinedOrNull(gammaInput)) {
gammaInput = false;
}
this.gammaInput = gammaInput;
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
gammaOutput = false;
}
this.gammaOutput = gammaOutput;
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
maxMorphTargets = 8;
}
this.maxMorphTargets = maxMorphTargets;
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
maxMorphNormals = 4;
}
this.maxMorphNormals = maxMorphNormals;
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
physicallyCorrectLights = false;
}
this.physicallyCorrectLights = physicallyCorrectLights;
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
shadowMapEnabled = false;
}
this.shadowMapEnabled = shadowMapEnabled;
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
shadowMapAutoUpdate = true;
}
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
shadowMapNeedsUpdate = false;
}
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
}
this.shadowMapType = shadowMapType;
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
shadowMapRenderReverseSided = true;
}
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
shadowMapRenderSingleSided = true;
}
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
if (R3.Utils.UndefinedOrNull(sortObjects)) {
sortObjects = true;
}
this.sortObjects = sortObjects;
if (R3.Utils.UndefinedOrNull(toneMapping)) {
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
}
this.toneMapping = toneMapping;
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
toneMappingExposure = 1;
}
this.toneMappingExposure = toneMappingExposure;
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
toneMappingWhitePoint = 1;
}
this.toneMappingWhitePoint = toneMappingWhitePoint;
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
premultipliedAlpha = true;
}
this.premultipliedAlpha = premultipliedAlpha;
if (R3.Utils.UndefinedOrNull(antialias)) {
antialias = false;
}
this.antialias = antialias;
if (R3.Utils.UndefinedOrNull(stencil)) {
stencil = true;
}
this.stencil = stencil;
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
preserveDrawingBuffer = false;
}
this.preserveDrawingBuffer = preserveDrawingBuffer;
if (R3.Utils.UndefinedOrNull(depth)) {
depth = true;
}
this.depth = depth;
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
logarithmicDepthBuffer = false;
}
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
localClippingEnabled = false;
}
this.localClippingEnabled = localClippingEnabled;
if (R3.Utils.UndefinedOrNull(renderTarget)) {
renderTarget = null;
}
this.renderTarget = renderTarget;
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
clippingPlanes = [];
}
this.clippingPlanes = clippingPlanes;
if (R3.Utils.UndefinedOrNull(clearColor)) {
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
}
this.clearColor = clearColor;
if (R3.Utils.UndefinedOrNull(viewports)) {
viewports = [new R3.D3.API.Viewport()];
}
this.viewports = viewports;
if (R3.Utils.UndefinedOrNull(alpha)) {
alpha = true;
}
this.alpha = alpha;
if (R3.Utils.UndefinedOrNull(opacity)) {
opacity = 1;
}
this.opacity = opacity;
if (R3.Utils.UndefinedOrNull(composer)) {
composer = new R3.API.Composer();
composer.renderer = this.id;
}
this.composer = composer;
if (R3.Utils.UndefinedOrNull(effect)) {
effect = new R3.API.Effect();
effect.renderer = this.id;
}
this.effect = effect;
if (R3.Utils.UndefinedOrNull(enableComposer)) {
enableComposer = false;
}
this.enableComposer = enableComposer;
if (R3.Utils.UndefinedOrNull(enableEffect)) {
enableEffect = false;
}
this.enableEffect = enableEffect;
R3.API.Renderer.call(
this, this,
apiRenderer.id, this.apiRendererD3,
apiRenderer.name, this.apiRendererD3.renderMode,
apiRenderer.parent, this.apiRendererD3.autoClear,
apiRenderer.rendererType, this.apiRendererD3.autoClearColor,
apiRenderer.canvas 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
); );
if (R3.Utils.UndefinedOrNull(target)) {
target = new R3.D3.API.RenderTarget();
}
this.target = target;
}; };
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype); R3.API.Renderer.D3.Target.prototype = Object.create(R3.API.Renderer.D3.prototype);
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3; R3.API.Renderer.D3.Target.prototype.constructor = R3.API.Renderer.D3.Target;

View File

@ -29,16 +29,11 @@
* @param depth * @param depth
* @param logarithmicDepthBuffer * @param logarithmicDepthBuffer
* @param localClippingEnabled * @param localClippingEnabled
* @param renderTarget
* @param clippingPlanes * @param clippingPlanes
* @param clearColor * @param clearColor
* @param viewports * @param viewports
* @param alpha * @param alpha
* @param opacity * @param opacity
* @param composer - only one composer can be active at a time
* @param effect - only one effect can be active at a time
* @param enableComposer
* @param enableEffect
* @constructor * @constructor
*/ */
R3.API.Renderer.D3 = function( R3.API.Renderer.D3 = function(
@ -71,7 +66,6 @@ R3.API.Renderer.D3 = function(
depth, depth,
logarithmicDepthBuffer, logarithmicDepthBuffer,
localClippingEnabled, localClippingEnabled,
renderTarget,
clippingPlanes, clippingPlanes,
clearColor, clearColor,
viewports, viewports,
@ -80,14 +74,14 @@ R3.API.Renderer.D3 = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) { if (R3.Utils.UndefinedOrNull(apiRenderer)) {
apiRenderer = { apiRenderer = {};
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
};
} }
this.apiRenderer = apiRenderer;
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) { R3.API.Renderer.call(
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D; this,
} this.apiRenderer
);
if (R3.Utils.UndefinedOrNull(renderMode)) { if (R3.Utils.UndefinedOrNull(renderMode)) {
renderMode = R3.API.Renderer.MODE_CANVAS; renderMode = R3.API.Renderer.MODE_CANVAS;
@ -229,11 +223,6 @@ R3.API.Renderer.D3 = function(
} }
this.localClippingEnabled = localClippingEnabled; this.localClippingEnabled = localClippingEnabled;
if (R3.Utils.UndefinedOrNull(renderTarget)) {
renderTarget = null;
}
this.renderTarget = renderTarget;
if (R3.Utils.UndefinedOrNull(clippingPlanes)) { if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
clippingPlanes = []; clippingPlanes = [];
} }
@ -259,37 +248,6 @@ R3.API.Renderer.D3 = function(
} }
this.opacity = opacity; this.opacity = opacity;
if (R3.Utils.UndefinedOrNull(composer)) {
composer = new R3.API.Composer();
composer.renderer = this.id;
}
this.composer = composer;
if (R3.Utils.UndefinedOrNull(effect)) {
effect = new R3.API.Effect();
effect.renderer = this.id;
}
this.effect = effect;
if (R3.Utils.UndefinedOrNull(enableComposer)) {
enableComposer = false;
}
this.enableComposer = enableComposer;
if (R3.Utils.UndefinedOrNull(enableEffect)) {
enableEffect = false;
}
this.enableEffect = enableEffect;
R3.API.Renderer.call(
this,
apiRenderer.id,
apiRenderer.name,
apiRenderer.parent,
apiRenderer.rendererType,
apiRenderer.canvas
);
}; };
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype); R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);

View File

@ -1,7 +1,6 @@
/** /**
* R3.API.Server * R3.API.Server
* @param id * @param apiComponent
* @param name
* @param protocol * @param protocol
* @param context * @param context
* @param application * @param application
@ -10,12 +9,10 @@
* @param preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime * @param preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime
* @param port * @param port
* @param protocols * @param protocols
* @param parent
* @constructor * @constructor
*/ */
R3.API.Server = function( R3.API.Server = function(
id, apiComponent,
name,
protocol, protocol,
context, context,
application, application,
@ -23,19 +20,10 @@ R3.API.Server = function(
ip, ip,
preferIp, preferIp,
port, port,
protocols, protocols
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Server (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(protocol)) { if (R3.Utils.UndefinedOrNull(protocol)) {
protocol = R3.API.Server.PROTOCOL_HTTP_SSL; protocol = R3.API.Server.PROTOCOL_HTTP_SSL;
@ -76,12 +64,6 @@ R3.API.Server = function(
protocols = []; protocols = [];
} }
this.protocols = protocols; this.protocols = protocols;
R3.API.Component.call(
this,
R3.Component.SERVER,
parent
);
}; };
R3.API.Server.prototype = Object.create(R3.API.Component.prototype); R3.API.Server.prototype = Object.create(R3.API.Component.prototype);
@ -93,4 +75,4 @@ R3.API.Server.PROTOCOL_WEBSOCKET = 'ws';
R3.API.Server.PROTOCOL_WEBSOCKET_SSL = 'wss'; R3.API.Server.PROTOCOL_WEBSOCKET_SSL = 'wss';
R3.API.Server.PORT_INSECURE = 80; R3.API.Server.PORT_INSECURE = 80;
R3.API.Server.PORT_SECURE = 443; R3.API.Server.PORT_SECURE = 443;

View File

@ -1,51 +1,19 @@
/** /**
* R3.API.Socket * R3.API.Socket
* @param id * @param apiComponent
* @param name
* @param socketType
* @param roomId * @param roomId
* @param peerId * @param peerId
* @param server R3.Server * @param server R3.Server
* @param parent
* @constructor * @constructor
*/ */
R3.API.Socket = function( R3.API.Socket = function(
id, apiComponent,
name,
socketType,
roomId, roomId,
peerId, peerId,
server, server
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(socketType)) {
socketType = R3.API.Socket.SOCKET_TYPE_CAST;
}
this.socketType = socketType;
if (R3.Utils.UndefinedOrNull(name)) {
switch (this.socketType) {
case R3.API.Socket.SOCKET_TYPE_CAST :
name = 'Socket Cast';
break;
case R3.API.Socket.SOCKET_TYPE_RECEIVE:
name = 'Socket Receive';
break;
default :
console.warn('no nice name for socket');
name = 'socket';
}
name += ' (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(roomId)) { if (R3.Utils.UndefinedOrNull(roomId)) {
roomId = 'room_' + R3.Utils.RandomId(); roomId = 'room_' + R3.Utils.RandomId();
@ -84,33 +52,7 @@ R3.API.Socket = function(
} }
this.server = server; this.server = server;
R3.API.Component.call(
this,
R3.API.Socket.GetComponentType(this.socketType),
parent
);
};
R3.API.Socket.GetComponentType = function(socketType) {
var componentType = null;
switch (socketType) {
case R3.API.Socket.SOCKET_TYPE_CAST :
componentType = R3.Component.SOCKET_CAST;
break;
case R3.API.Socket.SOCKET_TYPE_RECEIVE :
componentType = R3.Component.SOCKET_RECEIVE;
break;
default :
console.error('could not determine socket component type')
}
return componentType;
}; };
R3.API.Socket.prototype = Object.create(R3.API.Component.prototype); R3.API.Socket.prototype = Object.create(R3.API.Component.prototype);
R3.API.Socket.prototype.constructor = R3.API.Socket; R3.API.Socket.prototype.constructor = R3.API.Socket;
R3.API.Socket.SOCKET_TYPE_CAST = 0x1;
R3.API.Socket.SOCKET_TYPE_RECEIVE = 0x2;

View File

@ -14,14 +14,17 @@ R3.API.Socket.Cast = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiSocket)) { if (R3.Utils.UndefinedOrNull(apiSocket)) {
apiSocket = { apiSocket = {}
socketType : R3.API.Socket.SOCKET_TYPE_CAST
};
} }
this.apiSocket = apiSocket;
if (R3.Utils.UndefinedOrNull(apiSocket.socketType)) { R3.API.Socket.call(
apiSocket.socketType = R3.API.Socket.SOCKET_TYPE_CAST; this,
} this.apiSocket,
this.apiSocket.roomId,
this.apiSocket.peerId,
this.apiSocket.server
);
if (R3.Utils.UndefinedOrNull(castType)) { if (R3.Utils.UndefinedOrNull(castType)) {
castType = R3.API.Socket.Cast.CAST_TYPE_ROOM; castType = R3.API.Socket.Cast.CAST_TYPE_ROOM;
@ -38,16 +41,6 @@ R3.API.Socket.Cast = function(
} }
this.sourceProperties = sourceProperties; this.sourceProperties = sourceProperties;
R3.API.Socket.call(
this,
apiSocket.id,
apiSocket.name,
apiSocket.socketType,
apiSocket.roomId,
apiSocket.peerId,
apiSocket.server,
apiSocket.parent
);
}; };
R3.API.Socket.Cast.prototype = Object.create(R3.API.Socket.prototype); R3.API.Socket.Cast.prototype = Object.create(R3.API.Socket.prototype);
@ -56,4 +49,4 @@ R3.API.Socket.Cast.prototype.constructor = R3.API.Socket.Cast;
R3.API.Socket.Cast.CAST_TYPE_ROOM = 0x1; R3.API.Socket.Cast.CAST_TYPE_ROOM = 0x1;
R3.API.Socket.Cast.CAST_TYPE_PEER = 0x2; R3.API.Socket.Cast.CAST_TYPE_PEER = 0x2;
R3.API.Socket.Cast.CAST_TYPE_ALL = 0x3; R3.API.Socket.Cast.CAST_TYPE_ALL = 0x3;
R3.API.Socket.Cast.CAST_TYPE_ALL_BUT_PEER = 0x4; R3.API.Socket.Cast.CAST_TYPE_ALL_BUT_PEER = 0x4;

View File

@ -14,14 +14,17 @@ R3.API.Socket.Receive = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiSocket)) { if (R3.Utils.UndefinedOrNull(apiSocket)) {
apiSocket = { apiSocket = {}
socketType : R3.API.Socket.SOCKET_TYPE_RECEIVE
};
} }
this.apiSocket = apiSocket;
if (R3.Utils.UndefinedOrNull(apiSocket.socketType)) { R3.API.Socket.call(
apiSocket.socketType = R3.API.Socket.SOCKET_TYPE_RECEIVE; this,
} this.apiSocket,
this.apiSocket.roomId,
this.apiSocket.peerId,
this.apiSocket.server
);
if (R3.Utils.UndefinedOrNull(receiveType)) { if (R3.Utils.UndefinedOrNull(receiveType)) {
receiveType = R3.API.Socket.Receive.RECEIVE_TYPE_ROOM; receiveType = R3.API.Socket.Receive.RECEIVE_TYPE_ROOM;
@ -38,16 +41,6 @@ R3.API.Socket.Receive = function(
} }
this.destinationProperties = destinationProperties; this.destinationProperties = destinationProperties;
R3.API.Socket.call(
this,
apiSocket.id,
apiSocket.name,
apiSocket.socketType,
apiSocket.roomId,
apiSocket.peerId,
apiSocket.server,
apiSocket.parent
);
}; };
R3.API.Socket.Receive.prototype = Object.create(R3.API.Socket.prototype); R3.API.Socket.Receive.prototype = Object.create(R3.API.Socket.prototype);

View File

@ -1,13 +1,18 @@
/** /**
* R3.API.Sphere * R3.API.Sphere
* @constructor * @constructor
* @param apiComponent
* @param center * @param center
* @param radius * @param radius
*/ */
R3.API.Sphere = function( R3.API.Sphere = function(
apiComponent,
center, center,
radius radius
) { ) {
__API_COMPONENT_MACRO__
if (R3.Utils.UndefinedOrNull(center)) { if (R3.Utils.UndefinedOrNull(center)) {
center = new R3.API.Vector3(0,0,0); center = new R3.API.Vector3(0,0,0);
} }
@ -18,3 +23,6 @@ R3.API.Sphere = function(
} }
this.radius = radius; this.radius = radius;
}; };
R3.API.Sphere.prototype = Object.create(R3.API.Sphere.prototype);
R3.API.Sphere.prototype.constructor = R3.API.Sphere;

View File

@ -1,64 +1,22 @@
/** /**
* Raw Stats API object - should always correspond with the Stats Schema * Raw Stats API object - should always correspond with the Stats Schema
* @param id * @param apiComponent
* @param name
* @param domElement * @param domElement
* @param parent
* @constructor * @constructor
*/ */
R3.API.Stats = function( R3.API.Stats = function(
id, apiComponent,
name, domElement
domElement,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Stats (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(domElement)) { if (R3.Utils.UndefinedOrNull(domElement)) {
domElement = null; domElement = null;
} }
this.domElement = domElement; this.domElement = domElement;
R3.API.Component.call(
this,
R3.Component.STATS,
parent
);
}; };
R3.API.Stats.prototype = Object.create(R3.API.Component.prototype); R3.API.Stats.prototype = Object.create(R3.API.Component.prototype);
R3.API.Stats.prototype.constructor = R3.API.Stats; R3.API.Stats.prototype.constructor = R3.API.Stats;
/**
* Creates an API Stats from an Object Stats
* @param objectStats
* @constructor
*/
R3.API.Stats.FromObject = function(objectStats) {
var apiDomElement = null;
if (objectStats.domElement) {
if (objectStats.domElement instanceof Object) {
apiDomElement = R3.API.DomElement.FromObject(objectStats.domElement);
} else {
apiDomElement = objectStats.domElement;
}
}
return new R3.API.Stats(
objectStats.id,
objectStats.name,
apiDomElement,
objectStats.parent
);
};

View File

@ -1,104 +0,0 @@
/**
* This component renders a scene
* @param id String
* @param name String
* @param systemType
* @param parent
* @constructor
*/
R3.API.System = function(
id,
name,
systemType,
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = "System (" + this.id + ")";
}
this.name = name;
if (R3.Utils.UndefinedOrNull(systemType)) {
systemType = R3.System.SYSTEM_TYPE_NONE;
}
this.systemType = systemType;
var componentType = R3.Component.SYSTEM;
if (this.systemType === R3.System.SYSTEM_TYPE_NONE) {
componentType = R3.Component.SYSTEM;
}
if (this.systemType === R3.System.SYSTEM_TYPE_ANIMATION) {
componentType = R3.Component.SYSTEM_ANIMATION;
}
if (this.systemType === R3.System.SYSTEM_TYPE_CUSTOM) {
componentType = R3.Component.SYSTEM_CUSTOM_CODE;
}
if (this.systemType === R3.System.SYSTEM_TYPE_GUI) {
componentType = R3.Component.SYSTEM_GUI;
}
if (this.systemType === R3.System.SYSTEM_TYPE_INPUT) {
componentType = R3.Component.SYSTEM_INPUT;
}
if (this.systemType === R3.System.SYSTEM_TYPE_LINKING) {
componentType = R3.Component.SYSTEM_LINKING;
}
if (this.systemType === R3.System.SYSTEM_TYPE_PHYSICS) {
componentType = R3.Component.SYSTEM_PHYSICS;
}
if (this.systemType === R3.System.SYSTEM_TYPE_RENDER) {
componentType = R3.Component.SYSTEM_RENDER;
}
if (this.systemType === R3.System.SYSTEM_TYPE_STORAGE) {
componentType = R3.Component.SYSTEM_STORAGE;
}
if (this.systemType === R3.System.SYSTEM_TYPE_VISUALIZATION) {
componentType = R3.Component.SYSTEM_VISUALIZATION;
}
if (this.systemType === R3.System.SYSTEM_TYPE_PARTICLE) {
componentType = R3.Component.SYSTEM_PARTICLE;
}
if (this.systemType === R3.System.SYSTEM_TYPE_AUDIO) {
componentType = R3.Component.SYSTEM_AUDIO;
}
R3.API.Component.call(
this,
componentType,
parent
);
};
R3.API.System.prototype = Object.create(R3.API.Component.prototype);
R3.API.System.prototype.constructor = R3.API.System;
/**
* Object to R3.D3.API.System
* @param objectComponent
* @constructor
*/
R3.API.System.FromObject = function(objectComponent) {
return new R3.API.System(
objectComponent.id,
objectComponent.name,
objectComponent.systemType,
objectComponent.parent
);
};

View File

@ -1,8 +1,6 @@
/** /**
* API User * API User
* @param id * @param apiComponent
* @param name
* @param parent
* @param googleId * @param googleId
* @param fullName * @param fullName
* @param givenName * @param givenName
@ -14,9 +12,7 @@
* @constructor * @constructor
*/ */
R3.API.User = function( R3.API.User = function(
id, apiComponent,
name,
parent,
googleId, googleId,
fullName, fullName,
givenName, givenName,
@ -26,15 +22,8 @@ R3.API.User = function(
uploadFolder, uploadFolder,
idToken idToken
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'User (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(googleId)) { if (R3.Utils.UndefinedOrNull(googleId)) {
throw new Error('invalid user - no google ID'); throw new Error('invalid user - no google ID');
@ -75,12 +64,7 @@ R3.API.User = function(
idToken = 'unknown ID token'; idToken = 'unknown ID token';
} }
this.idToken = idToken; this.idToken = idToken;
R3.API.Component.call(
this,
R3.Component.USER,
parent
);
}; };
R3.API.User.prototype = Object.create(R3.API.Component.prototype); R3.API.User.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,8 +1,6 @@
/** /**
* R3.API.Video * R3.API.Video
* @param id * @param apiComponent
* @param name
* @param parent
* @param autoUpdateSize * @param autoUpdateSize
* @param width * @param width
* @param height * @param height
@ -11,24 +9,15 @@
* @constructor * @constructor
*/ */
R3.API.Video = function( R3.API.Video = function(
id, apiComponent,
name,
parent,
autoUpdateSize, autoUpdateSize,
width, width,
height, height,
offset, offset,
source source
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Video (' + id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) { if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
autoUpdateSize = true; autoUpdateSize = true;
@ -57,11 +46,6 @@ R3.API.Video = function(
} }
this.source = source; this.source = source;
R3.API.Component.call(
this,
R3.Component.VIDEO,
parent
);
}; };
R3.API.Video.prototype = Object.create(R3.API.Component.prototype); R3.API.Video.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,21 +1,29 @@
/** /**
* R3.Box3 * R3.Box3
* @param parent
* @param apiBox3 * @param apiBox3
* @constructor * @constructor
*/ */
R3.Box3 = function( R3.Box3 = function(
parent,
apiBox3 apiBox3
) { ) {
if (R3.Utils.UndefinedOrNull(parent)) {
parent = null;
}
this.parent = parent;
if (R3.Utils.UndefinedOrNull(apiBox3)) { if (R3.Utils.UndefinedOrNull(apiBox3)) {
apiBox3 = {}; apiBox3 = {};
} }
this.apiBox3 = apiBox3;
R3.API.Box3.call( R3.API.Box3.call(
this, this,
apiBox3, this.apiBox3,
apiBox3.min, this.apiBox3.min,
apiBox3.max this.apiBox3.max
); );
this.min = new R3.Vector3( this.min = new R3.Vector3(
@ -39,7 +47,7 @@ R3.Box3 = function(
}.bind(this) }.bind(this)
); );
this.componentRuntime = R3.Component.GetComponentRuntime(parent); this.componentRuntime = R3.Component.GetComponentRuntime(this.parent);
this.createInstance(); this.createInstance();
}; };

View File

@ -1,42 +1,44 @@
/** /**
* Runtime color for updating instance objects * Runtime color for updating instance objects
* @param graphics R3.GraphicsRuntime * @param parent
* @param parentObject R3.D3.*
* @param apiColor R3.API.Color * @param apiColor R3.API.Color
* @param grain Number
* @constructor * @constructor
*/ */
R3.Color = function( R3.Color = function(
graphics, parent,
apiColor, apiColor
parentObject,
grain
) { ) {
this.graphics = graphics; if (R3.Utils.UndefinedOrNull(parent)) {
this.graphics.isNotThreeThrow(); parent = null;
}
this.parent = parent;
if (R3.Utils.UndefinedOrNull(apiColor)) { if (R3.Utils.UndefinedOrNull(apiColor)) {
apiColor = {}; apiColor = {};
} }
this.apiColor = apiColor;
R3.API.Color.call( R3.API.Color.call(
this, this,
apiColor.r, this.apiColor.r,
apiColor.g, this.apiColor.g,
apiColor.b, this.apiColor.b,
apiColor.a this.apiColor.a
); );
if (R3.Utils.UndefinedOrNull(parentObject)) { this.graphics = null;
parentObject = null; this.physics = null;
}
this.parentObject = parentObject;
if (R3.Utils.UndefinedOrNull(grain)) { R3.Event.Emit(
grain = 0.001; R3.Event.GET_RUNTIME,
} function(runtime) {
this.grain = grain; this.graphics = runtime.graphics;
this.physics = runtime.physics;
}.bind(this)
);
this.componentRuntime = R3.Component.GetComponentRuntime(parent);
this.createInstance(); this.createInstance();
}; };
@ -49,11 +51,17 @@ R3.Color.prototype.constructor = R3.Color;
* @returns {*} * @returns {*}
*/ */
R3.Color.prototype.createInstance = function() { R3.Color.prototype.createInstance = function() {
this.instance = new THREE.Color(
this.r, switch (this.componentRuntime) {
this.g, case R3.Component.GRAPHICS_RUNTIME :
this.b this.instance = this.graphics.Color(
); this.r,
this.g,
this.b,
this.a
);
break;
}
}; };
/** /**

View File

@ -1,9 +1,6 @@
/** /**
* R3.D3.API.Object * R3.D3.API.Object
* @param id * @param apiComponent
* @param name
* @param objectType
* @param parent
* @param useQuaternion * @param useQuaternion
* @param position * @param position
* @param quaternion * @param quaternion
@ -14,10 +11,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Object = function( R3.D3.API.Object = function(
id, apiComponent,
name,
objectType,
parent,
useQuaternion, useQuaternion,
position, position,
quaternion, quaternion,
@ -26,56 +20,8 @@ R3.D3.API.Object = function(
up, up,
lookAt lookAt
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(objectType)) { __API_COMPONENT_MACRO__
objectType = 0;
}
this.objectType = objectType;
if (R3.Utils.UndefinedOrNull(name)) {
switch (this.objectType) {
case R3.D3.API.Object.OBJECT_TYPE_NONE :
name = 'Object';
break;
/**
* Cameras
*/
case R3.D3.API.Object.OBJECT_TYPE_CAMERA :
name = 'Camera';
break;
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC :
name = 'Camera Orthographic';
break;
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE :
name = 'Camera Perspective';
break;
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE :
name = 'Camera Cube';
break;
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE_STEREO :
name = 'Camera Stereo';
break;
/**
* Meshes
*/
case R3.D3.API.Object.OBJECT_TYPE_MESH :
name = 'Mesh';
break;
/**
* Bones
*/
case R3.D3.API.Object.OBJECT_TYPE_BONE :
name = 'Bone';
break;
}
name += ' (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(useQuaternion)) { if (R3.Utils.UndefinedOrNull(useQuaternion)) {
useQuaternion = true; useQuaternion = true;
@ -111,81 +57,8 @@ R3.D3.API.Object = function(
lookAt = new R3.API.Vector3(); lookAt = new R3.API.Vector3();
} }
this.lookAt = lookAt; this.lookAt = lookAt;
R3.API.Component.call(
this,
R3.D3.API.Object.GetComponentType(this.objectType),
parent
);
}; };
R3.D3.API.Object.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Object.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.Object.prototype.constructor = R3.D3.API.Object; R3.D3.API.Object.prototype.constructor = R3.D3.API.Object;
R3.D3.API.Object.GetComponentType = function(objectType) {
var componentType = null;
switch (objectType) {
case R3.D3.API.Object.OBJECT_TYPE_NONE :
componentType = R3.Component.OBJECT;
break;
/**
* Cameras
*/
case R3.D3.API.Object.OBJECT_TYPE_CAMERA :
componentType = R3.Component.CAMERA;
break;
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE :
componentType = R3.Component.CAMERA_PERSPECTIVE;
break;
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC :
componentType = R3.Component.CAMERA_ORTHOGRAPHIC;
break;
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_STEREO :
componentType = R3.Component.CAMERA_PERSPECTIVE_STEREO;
break;
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE :
componentType = R3.Component.CAMERA_CUBE;
break;
/**
* Meshes
*/
case R3.D3.API.Object.OBJECT_TYPE_MESH :
componentType = R3.Component.MESH;
break;
/**
* Bones
*/
case R3.D3.API.Object.OBJECT_TYPE_BONE :
componentType = R3.Component.BONE;
break;
default:
throw new Error('unsupported camera type: ' + objectType);
}
return componentType;
};
R3.D3.API.Object.OBJECT_TYPE_NONE = 0x0;
/**
* Cameras
* @type {number}
*/
R3.D3.API.Object.OBJECT_TYPE_CAMERA = 0x11;
R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE = 0x12;//0x1;
R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC = 0x13;//0x2;
R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE_STEREO = 0x14;//0x3;
R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE = 0x15;//0x4;
/**
* Meshes
* @type {number}
*/
R3.D3.API.Object.OBJECT_TYPE_MESH = 0x21;
/**
* Bones
*/
R3.D3.API.Object.OBJECT_TYPE_BONE = 0x31;

View File

@ -1,7 +1,6 @@
/** /**
* Animation Component * R3.D3.API.Animation
* @param id * @param apiComponent
* @param name
* @param rotationSpeed * @param rotationSpeed
* @param translationSpeed * @param translationSpeed
* @param scaleSpeed * @param scaleSpeed
@ -10,13 +9,10 @@
* @param scaleFn * @param scaleFn
* @param blocking * @param blocking
* @param applyToMeshWhenDone * @param applyToMeshWhenDone
* @param meshes
* @param parent
* @constructor * @constructor
*/ */
R3.D3.API.Animation = function( R3.D3.API.Animation = function(
id, apiComponent,
name,
rotationSpeed, rotationSpeed,
translationSpeed, translationSpeed,
scaleSpeed, scaleSpeed,
@ -24,19 +20,10 @@ R3.D3.API.Animation = function(
translationFn, translationFn,
scaleFn, scaleFn,
blocking, blocking,
applyToMeshWhenDone, applyToMeshWhenDone
meshes,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Animation (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(rotationSpeed)) { if (R3.Utils.UndefinedOrNull(rotationSpeed)) {
rotationSpeed = 0; rotationSpeed = 0;
@ -82,40 +69,7 @@ R3.D3.API.Animation = function(
} }
this.applyToMeshWhenDone = applyToMeshWhenDone; this.applyToMeshWhenDone = applyToMeshWhenDone;
if (R3.Utils.UndefinedOrNull(meshes)) {
meshes = [];
}
this.meshes = meshes;
R3.API.Component.call(
this,
R3.Component.ANIMATION,
parent
);
}; };
R3.D3.API.Animation.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Animation.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.Animation.prototype.constructor = R3.D3.API.Animation; R3.D3.API.Animation.prototype.constructor = R3.D3.API.Animation;
/**
* Object to R3.D3.API.Animation
* @param objectComponent
* @returns {R3.D3.API.Animation}
* @constructor
*/
R3.D3.API.Animation.FromObject = function(objectComponent) {
return new R3.D3.API.Animation(
objectComponent.id,
objectComponent.name,
objectComponent.rotationSpeed,
objectComponent.translationSpeed,
objectComponent.scaleSpeed,
objectComponent.rotationFn,
objectComponent.translationFn,
objectComponent.scaleFn,
objectComponent.blocking,
objectComponent.applyToMeshWhenDone,
objectComponent.meshes,
objectComponent.parent
);
};

View File

@ -1,37 +1,25 @@
/** /**
* Raw Audio API object - should always correspond with the Audio Schema * R3.D3.API.Audio
* @param id * @param apiComponent
* @param name
* @param path * @param path
* @param loop * @param loop
* @param volume * @param volume
* @param camera * @param camera
* @param overplay * @param overplay
* @param paused * @param paused
* @param parent
* @constructor * @constructor
*/ */
R3.D3.API.Audio = function( R3.D3.API.Audio = function(
id, apiComponent,
name,
path, path,
loop, loop,
volume, volume,
camera, camera,
overplay, overplay,
paused, paused
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Audio (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(path)) { if (R3.Utils.UndefinedOrNull(path)) {
path = ''; path = '';
@ -63,42 +51,7 @@ R3.D3.API.Audio = function(
} }
this.paused = paused; this.paused = paused;
R3.API.Component.call(
this,
R3.Component.AUDIO,
parent
);
}; };
R3.D3.API.Audio.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Audio.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.Audio.prototype.constructor = R3.D3.API.Audio; R3.D3.API.Audio.prototype.constructor = R3.D3.API.Audio;
/**
* Creates an API Audio from an Object Audio
* @param objectAudio
* @constructor
*/
R3.D3.API.Audio.FromObject = function(objectAudio) {
var apiCamera = null;
if (objectAudio.camera) {
if (objectAudio.camera instanceof Object) {
apiCamera = R3.D3.API.Camera.FromObject(objectAudio.camera);
} else {
apiCamera = objectAudio.camera;
}
}
return new R3.D3.API.Audio(
objectAudio.id,
objectAudio.name,
objectAudio.path,
objectAudio.loop,
objectAudio.volume,
apiCamera,
objectAudio.overplay,
objectAudio.paused,
objectAudio.parent
);
};

View File

@ -12,14 +12,21 @@ R3.D3.API.Bone = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiD3Object)) { if (R3.Utils.UndefinedOrNull(apiD3Object)) {
apiD3Object = { apiD3Object = {};
objectType : R3.D3.API.Object.OBJECT_TYPE_BONE
};
} }
this.apiD3Object = apiD3Object;
if (R3.Utils.UndefinedOrNull(apiD3Object.objectType)) { R3.D3.API.Object.call(
apiD3Object.objectType = R3.D3.API.Object.OBJECT_TYPE_BONE; this,
} this.apiD3Object,
this.apiD3Object.useQuaternion,
this.apiD3Object.position,
this.apiD3Object.quaternion,
this.apiD3Object.rotation,
this.apiD3Object.scale,
this.apiD3Object.up,
this.apiD3Object.lookAt
);
if (R3.Utils.UndefinedOrNull(childBoneIds)) { if (R3.Utils.UndefinedOrNull(childBoneIds)) {
childBoneIds = []; childBoneIds = [];
@ -31,20 +38,6 @@ R3.D3.API.Bone = function(
} }
this.parentBoneIds = parentBoneIds; this.parentBoneIds = parentBoneIds;
R3.D3.API.Object.call(
this,
apiD3Object.id,
apiD3Object.name,
apiD3Object.objectType,
apiD3Object.parent,
apiD3Object.useQuaternion,
apiD3Object.position,
apiD3Object.quaternion,
apiD3Object.rotation,
apiD3Object.scale,
apiD3Object.up,
apiD3Object.lookAt
);
}; };
R3.D3.API.Bone.prototype = Object.create(R3.D3.API.Object.prototype); R3.D3.API.Bone.prototype = Object.create(R3.D3.API.Object.prototype);

View File

@ -1,54 +1,22 @@
/** /**
* Raw Broadphase API object - should always correspond with the Broadphase Schema * Raw Broadphase API object - should always correspond with the Broadphase Schema
* @param id * @param apiComponent
* @param name
* @param broadphaseType * @param broadphaseType
* @param parent
* @constructor * @constructor
*/ */
R3.D3.API.Broadphase = function( R3.D3.API.Broadphase = function(
id, apiComponent,
name, broadphaseType
broadphaseType,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Broadphase (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(broadphaseType)) { if (R3.Utils.UndefinedOrNull(broadphaseType)) {
broadphaseType = R3.D3.Broadphase.BROADPHASE_TYPE_NAIVE; broadphaseType = R3.D3.Broadphase.BROADPHASE_TYPE_NAIVE;
} }
this.broadphaseType = broadphaseType; this.broadphaseType = broadphaseType;
R3.API.Component.call(
this,
R3.Component.BROADPHASE,
parent
);
}; };
R3.D3.API.Broadphase.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Broadphase.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.Broadphase.prototype.constructor = R3.D3.API.Broadphase; R3.D3.API.Broadphase.prototype.constructor = R3.D3.API.Broadphase;
/**
* Creates an API Broadphase from an Object Broadphase
* @param objectBroadphase
* @constructor
*/
R3.D3.API.Broadphase.FromObject = function(objectBroadphase) {
return new R3.D3.API.Broadphase(
objectBroadphase.id,
objectBroadphase.name,
objectBroadphase.broadphaseType,
objectBroadphase.parent
);
};

View File

@ -10,19 +10,9 @@ R3.D3.API.Camera = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiD3Object)) { if (R3.Utils.UndefinedOrNull(apiD3Object)) {
apiD3Object = { apiD3Object = {};
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA
};
} }
this.apiD3Object = apiD3Object;
if (R3.Utils.UndefinedOrNull(apiD3Object.objectType)) {
apiD3Object.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA;
}
if (R3.Utils.UndefinedOrNull(aspect)) {
aspect = 1;
}
this.aspect = aspect;
if (R3.Utils.UndefinedOrNull(apiD3Object.position)) { if (R3.Utils.UndefinedOrNull(apiD3Object.position)) {
apiD3Object.position = new R3.API.Vector3( apiD3Object.position = new R3.API.Vector3(
@ -34,19 +24,28 @@ R3.D3.API.Camera = function(
R3.D3.API.Object.call( R3.D3.API.Object.call(
this, this,
apiD3Object.id, this.apiD3Object,
apiD3Object.name, this.apiD3Object.useQuaternion,
apiD3Object.objectType, this.apiD3Object.position,
apiD3Object.parent, this.apiD3Object.quaternion,
apiD3Object.useQuaternion, this.apiD3Object.rotation,
apiD3Object.position, this.apiD3Object.scale,
apiD3Object.quaternion, this.apiD3Object.up,
apiD3Object.rotation, this.apiD3Object.lookAt
apiD3Object.scale,
apiD3Object.up,
apiD3Object.lookAt
); );
if (R3.Utils.UndefinedOrNull(aspect)) {
aspect = 1;
}
this.aspect = aspect;
}; };
R3.D3.API.Camera.prototype = Object.create(R3.D3.API.Object.prototype); R3.D3.API.Camera.prototype = Object.create(R3.D3.API.Object.prototype);
R3.D3.API.Camera.prototype.constructor = R3.D3.API.Camera; R3.D3.API.Camera.prototype.constructor = R3.D3.API.Camera;
R3.D3.API.Camera.ASPECT_RATIO_1_1 = 0x1;
R3.D3.API.Camera.ASPECT_RATIO_3_2 = 0x2;
R3.D3.API.Camera.ASPECT_RATIO_4_3 = 0x3;
R3.D3.API.Camera.ASPECT_RATIO_16_9 = 0x4;
R3.D3.API.Camera.ASPECT_RATIO_16_10 = 0x5;

View File

@ -1,29 +1,33 @@
/** /**
* R3.D3.API.Camera.Cube * R3.D3.API.Camera.Cube
*
* CubeCamera's have hardcoded fov=90 and aspect=1
*
* @constructor * @constructor
* @param apiD3ObjectCamera * @param apiD3Camera
* @param near * @param near
* @param far * @param far
* @param cubeResolution * @param cubeResolution
* @param renderTarget * @param renderTarget
*/ */
R3.D3.API.Camera.Cube = function( R3.D3.API.Camera.Cube = function(
apiD3ObjectCamera, apiD3Camera,
near, near,
far, far,
cubeResolution, cubeResolution,
renderTarget renderTarget
) { ) {
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera)) { if (R3.Utils.UndefinedOrNull(apiD3Camera)) {
apiD3ObjectCamera = { apiD3Camera = {};
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE
};
} }
this.apiD3Camera = apiD3Camera;
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.objectType)) { R3.D3.API.Camera.call(
apiD3ObjectCamera.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE; this,
} this.apiD3Camera,
this.apiD3Camera.aspect
);
if (R3.Utils.UndefinedOrNull(near)) { if (R3.Utils.UndefinedOrNull(near)) {
near = 0.1; near = 0.1;
@ -45,14 +49,6 @@ R3.D3.API.Camera.Cube = function(
} }
this.renderTarget = renderTarget; this.renderTarget = renderTarget;
/**
* CubeCamera's have hardcoded fov=90 and aspect=1
*/
R3.D3.API.Camera.call(
this,
apiD3ObjectCamera,
apiD3ObjectCamera.aspect
);
}; };
R3.D3.API.Camera.Cube.prototype = Object.create(R3.D3.API.Camera.prototype); R3.D3.API.Camera.Cube.prototype = Object.create(R3.D3.API.Camera.prototype);

View File

@ -0,0 +1,37 @@
/**
* R3.D3.API.Camera.Orthographic.FixedAspect
*
* This camera calculates left, right, top and bottom coordinates from the provided aspect ratio. It uses the inherited
* default values for near and far values for the Z space
*
* @param apiD3CameraOrthographic
* @param aspectRatio
* @constructor
*/
R3.D3.API.Camera.Orthographic.FixedAspect = function(
apiD3CameraOrthographic,
aspectRatio
) {
if (R3.Utils.UndefinedOrNull(apiD3CameraOrthographic)) {
apiD3CameraOrthographic = {};
}
this.apiD3CameraOrthographic = apiD3CameraOrthographic;
R3.D3.API.Camera.Orthographic.call(
this,
this.apiD3CameraOrthographic,
this.apiD3CameraOrthographic.near,
this.apiD3CameraOrthographic.far,
this.apiD3CameraOrthographic.zoom
);
if (R3.Utils.UndefinedOrNull(aspectRatio)) {
aspectRatio = R3.D3.API.Camera.ASPECT_RATIO_1_1;
}
this.aspectRatio = aspectRatio;
};
R3.D3.API.Camera.Orthographic.FixedAspect.prototype = Object.create(R3.D3.API.Camera.Orthographic.prototype);
R3.D3.API.Camera.Orthographic.FixedAspect.prototype.constructor = R3.D3.API.Camera.Orthographic.FixedAspect;

View File

@ -0,0 +1,59 @@
/**
* R3.D3.API.Camera.Orthographic.ZoomedAspect
*
* This camera does not automatically adjust its left, right, top and bottom values - it assumes they have been defined
* and are correct. It uses the inherited default near and far values for the Z space. It essentially ignores aspect
* ratio (you should manage that yourself to get things looking pretty)
*
* @param apiD3CameraOrthographic
* @param left
* @param right
* @param top
* @param bottom
* @constructor
*/
R3.D3.API.Camera.Orthographic.ZoomedAspect = function(
apiD3CameraOrthographic,
left,
right,
top,
bottom
) {
if (R3.Utils.UndefinedOrNull(apiD3CameraOrthographic)) {
apiD3CameraOrthographic = {};
}
this.apiD3CameraOrthographic = apiD3CameraOrthographic;
R3.D3.API.Camera.Orthographic.call(
this,
this.apiD3CameraOrthographic,
this.apiD3CameraOrthographic.near,
this.apiD3CameraOrthographic.far,
this.apiD3CameraOrthographic.zoom
);
if (R3.Utils.UndefinedOrNull(left)) {
left = -5;
}
this.left = left;
if (R3.Utils.UndefinedOrNull(right)) {
right = 5;
}
this.right = right;
if (R3.Utils.UndefinedOrNull(top)) {
top = 5;
}
this.top = top;
if (R3.Utils.UndefinedOrNull(bottom)) {
bottom = -5;
}
this.bottom = bottom;
};
R3.D3.API.Camera.Orthographic.ZoomedAspect.prototype = Object.create(R3.D3.API.Camera.Orthographic.prototype);
R3.D3.API.Camera.Orthographic.ZoomedAspect.prototype.constructor = R3.D3.API.Camera.Orthographic.ZoomedAspect;

View File

@ -1,98 +1,48 @@
/** /**
* R3.D3.API.Camera.Orthographic * R3.D3.API.Camera.Orthographic
* *
* OK - since the introduction of fixed aspect ratio's for our canvases, we only need to know * Base class for Orthographic Cameras - do define an aspect ratio for the camera, use FixedAspect child class, to
* the aspect ratio and width - then we calculate the left, right, up and down coords - * manually set the camera size, use the ZoomedAspect child class
*
* for the Z space - we simply use the values in near and far - you should know what you are doing when you
* create an orthographic camera
*
* There are two ways to update the camera - one is by affecting the aspect ratio - the other is modifying the left,
* right, top and bottom values - this also affects the aspect ratio.
*
* In both modes - the camera is assumed to be at position 0,0,10 and facing direction 0,0,-1 (in the positive Z facing
* the negative Z direction seeing what happens around the origin)
*
* Also - the offset is always respected
* *
* @constructor * @constructor
* @param apiD3ObjectCamera * @param apiD3Camera
* @param aspectRatioMode
* @param minWidth
* @param minHeight
* @param width
* @param height
* @param near * @param near
* @param far * @param far
* @param left
* @param right
* @param top
* @param bottom
* @param zoom * @param zoom
*/ */
R3.D3.API.Camera.Orthographic = function( R3.D3.API.Camera.Orthographic = function(
apiD3ObjectCamera, apiD3Camera,
aspectRatioMode,
minWidth,
minHeight,
width,
height,
near, near,
far, far,
left,
right,
top,
bottom,
zoom zoom
) { ) {
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera)) { if (R3.Utils.UndefinedOrNull(apiD3Camera)) {
apiD3ObjectCamera = { apiD3Camera = {};
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC }
}; this.apiD3Camera = apiD3Camera;
if (R3.Utils.UndefinedOrNull(this.apiD3Camera.position)) {
this.apiD3Camera.position = new R3.API.Vector3(
0,
0,
10
);
} }
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.objectType)) { if (R3.Utils.UndefinedOrNull(this.apiD3Camera.lookAt)) {
apiD3ObjectCamera.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC; this.apiD3Camera.lookAt = new R3.API.Vector3(
0,
0,
-10
);
} }
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.position)) { R3.D3.API.Camera.call(
apiD3ObjectCamera.position = new R3.API.Vector3(0,0,10); this,
} this.apiD3Camera,
this.apiD3Camera.aspect
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.lookAt)) { );
apiD3ObjectCamera.lookAt = new R3.API.Vector3(0,0,-10);
}
if (R3.Utils.UndefinedOrNull(aspectRatioMode)) {
aspectRatioMode = R3.D3.API.Camera.Orthographic.ASPECT_RATIO_MODE_BASED_ON_CURRENT;
}
this.aspectRatioMode = aspectRatioMode;
if (R3.Utils.UndefinedOrNull(minWidth)) {
minWidth = 10;
}
this.minWidth = minWidth;
if (R3.Utils.UndefinedOrNull(minHeight)) {
minHeight = 10;
}
this.minHeight = minHeight;
if (R3.Utils.UndefinedOrNull(height)) {
height = 10;
}
this.height = height;
if (R3.Utils.UndefinedOrNull(width)) {
width = 10;
}
this.width = width;
if (R3.Utils.UndefinedOrNull(height)) {
height = 10;
}
this.height = height;
if (R3.Utils.UndefinedOrNull(near)) { if (R3.Utils.UndefinedOrNull(near)) {
near = 0.1; near = 0.1;
@ -104,41 +54,12 @@ R3.D3.API.Camera.Orthographic = function(
} }
this.far = far; this.far = far;
if (R3.Utils.UndefinedOrNull(left)) {
left = -5;
}
this.left = left;
if (R3.Utils.UndefinedOrNull(right)) {
right = 5;
}
this.right = right;
if (R3.Utils.UndefinedOrNull(top)) {
top = 5;
}
this.top = top;
if (R3.Utils.UndefinedOrNull(bottom)) {
bottom = -5;
}
this.bottom = bottom;
if (R3.Utils.UndefinedOrNull(zoom)) { if (R3.Utils.UndefinedOrNull(zoom)) {
zoom = 1; zoom = 1;
} }
this.zoom = zoom; this.zoom = zoom;
R3.D3.API.Camera.call(
this,
apiD3ObjectCamera,
apiD3ObjectCamera.aspect
);
}; };
R3.D3.API.Camera.Orthographic.prototype = Object.create(R3.D3.API.Camera.prototype); R3.D3.API.Camera.Orthographic.prototype = Object.create(R3.D3.API.Camera.prototype);
R3.D3.API.Camera.Orthographic.prototype.constructor = R3.D3.API.Camera.Orthographic; R3.D3.API.Camera.Orthographic.prototype.constructor = R3.D3.API.Camera.Orthographic;
R3.D3.API.Camera.Orthographic.ASPECT_RATIO_MODE_NONE = 0x0;
R3.D3.API.Camera.Orthographic.ASPECT_RATIO_MODE_FIXED = 0x1;
R3.D3.API.Camera.Orthographic.ASPECT_RATIO_MODE_BASED_ON_CURRENT = 0x2;

View File

@ -1,40 +1,36 @@
/** /**
* R3.D3.API.Camera.Perspective.Stereo * R3.D3.API.Camera.Perspective.Stereo
* @constructor * @constructor
* @param apiD3ObjectCameraPerspective * @param apiD3CameraPerspective
* @param stereoMode * @param stereoMode
*/ */
R3.D3.API.Camera.Perspective.Stereo = function( R3.D3.API.Camera.Perspective.Stereo = function(
apiD3ObjectCameraPerspective, apiD3CameraPerspective,
stereoMode stereoMode
) { ) {
if (R3.Utils.UndefinedOrNull(apiD3ObjectCameraPerspective)) { if (R3.Utils.UndefinedOrNull(apiD3CameraPerspective)) {
apiD3ObjectCameraPerspective = { apiD3CameraPerspective = {};
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE_STEREO
};
} }
this.apiD3CameraPerspective = apiD3CameraPerspective;
if (R3.Utils.UndefinedOrNull(apiD3ObjectCameraPerspective.objectType)) { R3.D3.API.Camera.Perspective.call(
apiD3ObjectCameraPerspective.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE_STEREO; this,
} this.apiD3CameraPerspective,
this.apiD3CameraPerspective.near,
this.apiD3CameraPerspective.far,
this.apiD3CameraPerspective.fov,
this.apiD3CameraPerspective.filmGauge,
this.apiD3CameraPerspective.filmOffset,
this.apiD3CameraPerspective.focus,
this.apiD3CameraPerspective.zoom
);
if (R3.Utils.UndefinedOrNull(stereoMode)) { if (R3.Utils.UndefinedOrNull(stereoMode)) {
stereoMode = R3.D3.API.Camera.Perspective.Stereo.STEREO_MODE_STEREO; stereoMode = R3.D3.API.Camera.Perspective.Stereo.STEREO_MODE_STEREO;
} }
this.stereoMode = stereoMode; this.stereoMode = stereoMode;
R3.D3.API.Camera.Perspective.call(
this,
apiD3ObjectCameraPerspective,
apiD3ObjectCameraPerspective.near,
apiD3ObjectCameraPerspective.far,
apiD3ObjectCameraPerspective.fov,
apiD3ObjectCameraPerspective.filmGauge,
apiD3ObjectCameraPerspective.filmOffset,
apiD3ObjectCameraPerspective.focus,
apiD3ObjectCameraPerspective.zoom
);
}; };
R3.D3.API.Camera.Perspective.Stereo.prototype = Object.create(R3.D3.API.Camera.Perspective.prototype); R3.D3.API.Camera.Perspective.Stereo.prototype = Object.create(R3.D3.API.Camera.Perspective.prototype);

View File

@ -1,7 +1,7 @@
/** /**
* R3.D3.API.Camera.Perspective * R3.D3.API.Camera.Perspective
* @constructor * @constructor
* @param apiD3ObjectCamera * @param apiD3Camera
* @param fov * @param fov
* @param near * @param near
* @param far * @param far
@ -11,7 +11,7 @@
* @param zoom * @param zoom
*/ */
R3.D3.API.Camera.Perspective = function( R3.D3.API.Camera.Perspective = function(
apiD3ObjectCamera, apiD3Camera,
near, near,
far, far,
fov, fov,
@ -21,64 +21,53 @@ R3.D3.API.Camera.Perspective = function(
zoom zoom
) { ) {
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera)) { if (R3.Utils.UndefinedOrNull(apiD3Camera)) {
apiD3ObjectCamera = { apiD3Camera = {};
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE
};
} }
this.apiD3Camera = apiD3Camera;
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.objectType)) { R3.D3.API.Camera.call(
apiD3ObjectCamera.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE; this,
} this.apiD3Camera,
this.apiD3Camera.aspect
);
if (R3.Utils.UndefinedOrNull(near)) { if (R3.Utils.UndefinedOrNull(near)) {
// near = new R3.API.Number(0.1, 0.001, 0.001, 2000);
near = 0.1; near = 0.1;
} }
this.near = near; this.near = near;
if (R3.Utils.UndefinedOrNull(far)) { if (R3.Utils.UndefinedOrNull(far)) {
// far = new R3.API.Number(2000, 1, 1, 4000);
far = 2000; far = 2000;
} }
this.far = far; this.far = far;
if (R3.Utils.UndefinedOrNull(fov)) { if (R3.Utils.UndefinedOrNull(fov)) {
// fov = new R3.API.Number(50, 1, 0, 180);
fov = 50; fov = 50;
} }
this.fov = fov; this.fov = fov;
if (R3.Utils.UndefinedOrNull(filmGauge)) { if (R3.Utils.UndefinedOrNull(filmGauge)) {
// filmGauge = new R3.API.Number(35, 1, 0, 200);
filmGauge = 35; filmGauge = 35;
} }
this.filmGauge = filmGauge; this.filmGauge = filmGauge;
if (R3.Utils.UndefinedOrNull(filmOffset)) { if (R3.Utils.UndefinedOrNull(filmOffset)) {
// filmOffset = new R3.API.Number(0, 1, 0, 200);
filmOffset = 0; filmOffset = 0;
} }
this.filmOffset = filmOffset; this.filmOffset = filmOffset;
if (R3.Utils.UndefinedOrNull(focus)) { if (R3.Utils.UndefinedOrNull(focus)) {
// focus = new R3.API.Number(10, 0.1, 0, 200);
focus = 10; focus = 10;
} }
this.focus = focus; this.focus = focus;
if (R3.Utils.UndefinedOrNull(zoom)) { if (R3.Utils.UndefinedOrNull(zoom)) {
// zoom = new R3.API.Number(1, 0.01, 0, 10);
zoom = 1; zoom = 1;
} }
this.zoom = zoom; this.zoom = zoom;
R3.D3.API.Camera.call(
this,
apiD3ObjectCamera,
apiD3ObjectCamera.aspect
);
}; };
R3.D3.API.Camera.Perspective.prototype = Object.create(R3.D3.API.Camera.prototype); R3.D3.API.Camera.Perspective.prototype = Object.create(R3.D3.API.Camera.prototype);
R3.D3.API.Camera.Perspective.prototype.constructor = R3.D3.API.Camera.Perspective; R3.D3.API.Camera.Perspective.prototype.constructor = R3.D3.API.Camera.Perspective;

View File

@ -1,42 +1,21 @@
/** /**
* R3.D3.API.Composer * R3.D3.API.Composer
* @param id * @param apiComponent
* @param name
* @param parent
* @param autoUpdateSize * @param autoUpdateSize
* @param width * @param width
* @param height * @param height
* @param renderer
* @param renderTarget
* @param passes * @param passes
* @constructor * @constructor
*/ */
R3.D3.API.Composer = function( R3.D3.API.Composer = function(
parent, apiComponent,
id,
name,
autoUpdateSize, autoUpdateSize,
width, width,
height, height,
renderer,
renderTarget,
passes passes
) { ) {
if (R3.Utils.UndefinedOrNull(parent)) { __API_COMPONENT_MACRO__
parent = null;
}
this.parent = parent;
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Composer (' + id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) { if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
autoUpdateSize = true; autoUpdateSize = true;
@ -53,32 +32,11 @@ R3.D3.API.Composer = function(
} }
this.height = height; this.height = height;
if (R3.Utils.UndefinedOrNull(renderer)) {
if (this.parent && this.parent.parent.renderer) {
renderer = this.parent.parent.renderer;
} else {
renderer = null;
}
}
this.renderer = renderer;
if (R3.Utils.UndefinedOrNull(renderTarget)) {
renderTarget = null;
}
this.renderTarget = renderTarget;
if (R3.Utils.UndefinedOrNull(passes)) { if (R3.Utils.UndefinedOrNull(passes)) {
passes = []; passes = [];
} }
this.passes = passes; this.passes = passes;
R3.API.Component.call(
this,
R3.Component.COMPOSER,
parent
);
}; };
R3.D3.API.Composer.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Composer.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,10 +1,6 @@
/** /**
* R3.D3.API.Effect * R3.D3.API.Effect
* @param id * @param apiComponent
* @param name
* @param effectType
* @param parent
* @param renderer
* @param width * @param width
* @param height * @param height
* *
@ -13,50 +9,12 @@
* @constructor * @constructor
*/ */
R3.D3.API.Effect = function( R3.D3.API.Effect = function(
id, apiComponent,
name,
effectType,
parent,
renderer,
width, width,
height height
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(effectType)) {
effectType = R3.D3.API.Effect.EFFECT_TYPE_NONE;
}
this.effectType = effectType;
if (R3.Utils.UndefinedOrNull(name)) {
switch (this.effectType) {
case R3.D3.API.Effect.EFFECT_TYPE_ANAGLYPH :
name = 'Effect Anaglyph';
break;
case R3.D3.API.Effect.EFFECT_TYPE_PARALLAX :
name = 'Effect Parallax';
break;
case R3.D3.API.Effect.EFFECT_TYPE_STEREO :
name = 'Effect Stereo';
break;
default :
console.warn('no nice name for effect');
name = 'Effect';
}
name += ' (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(renderer)) {
renderer = null;
}
this.renderer = renderer;
if (R3.Utils.UndefinedOrNull(width)) { if (R3.Utils.UndefinedOrNull(width)) {
width = 512; width = 512;
@ -67,34 +25,7 @@ R3.D3.API.Effect = function(
height = 512; height = 512;
} }
this.height = height; this.height = height;
var componentType = null;
switch (this.effectType) {
case R3.D3.API.Effect.EFFECT_TYPE_STEREO :
componentType = R3.Component.EFFECT_STEREO;
break;
case R3.D3.API.Effect.EFFECT_TYPE_ANAGLYPH :
componentType = R3.Component.EFFECT_ANAGLYPH;
break;
case R3.D3.API.Effect.EFFECT_TYPE_PARALLAX :
componentType = R3.Component.EFFECT_PARALLAX;
break;
default:
throw new Error('unsupported effect type: ' + this.effectType);
}
R3.API.Component.call(
this,
componentType,
parent
);
}; };
R3.D3.API.Effect.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Effect.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.Effect.prototype.constructor = R3.D3.API.Effect; R3.D3.API.Effect.prototype.constructor = R3.D3.API.Effect;
R3.D3.API.Effect.EFFECT_TYPE_NONE = 0x0;
R3.D3.API.Effect.EFFECT_TYPE_STEREO = 0x1;
R3.D3.API.Effect.EFFECT_TYPE_ANAGLYPH = 0x2;
R3.D3.API.Effect.EFFECT_TYPE_PARALLAX = 0x3;

View File

@ -8,27 +8,18 @@ R3.D3.API.Effect.Anaglyph = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiEffect)) { if (R3.Utils.UndefinedOrNull(apiEffect)) {
apiEffect = { apiEffect = {};
effectType : R3.D3.API.Effect.EFFECT_TYPE_ANAGLYPH
};
}
if (R3.Utils.UndefinedOrNull(apiEffect.cameraType)) {
apiEffect.effectType = R3.D3.API.Effect.EFFECT_TYPE_ANAGLYPH;
} }
this.apiEffect = apiEffect;
R3.D3.API.Effect.call( R3.D3.API.Effect.call(
this, this,
apiEffect.id, this.apiEffect,
apiEffect.name, this.apiEffect.width,
apiEffect.effectType, this.apiEffect.height
apiEffect.parent,
apiEffect.renderer,
apiEffect.width,
apiEffect.height
); );
}; };
R3.D3.API.Effect.Anaglyph.prototype = Object.create(R3.D3.API.Effect.prototype); R3.D3.API.Effect.Anaglyph.prototype = Object.create(R3.D3.API.Effect.prototype);
R3.D3.API.Effect.Anaglyph.prototype.constructor = R3.D3.API.Effect.Anaglyph; R3.D3.API.Effect.Anaglyph.prototype.constructor = R3.D3.API.Effect.Anaglyph;

View File

@ -8,24 +8,15 @@ R3.D3.API.Effect.Parallax = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiEffect)) { if (R3.Utils.UndefinedOrNull(apiEffect)) {
apiEffect = { apiEffect = {};
effectType : R3.D3.API.Effect.EFFECT_TYPE_PARALLAX
};
}
if (R3.Utils.UndefinedOrNull(apiEffect.cameraType)) {
apiEffect.effectType = R3.D3.API.Effect.EFFECT_TYPE_PARALLAX;
} }
this.apiEffect = apiEffect;
R3.D3.API.Effect.call( R3.D3.API.Effect.call(
this, this,
apiEffect.id, this.apiEffect,
apiEffect.name, this.apiEffect.width,
apiEffect.effectType, this.apiEffect.height
apiEffect.parent,
apiEffect.renderer,
apiEffect.width,
apiEffect.height
); );
}; };

View File

@ -10,31 +10,22 @@ R3.D3.API.Effect.Stereo = function(
) { ) {
if (R3.Utils.UndefinedOrNull(apiEffect)) { if (R3.Utils.UndefinedOrNull(apiEffect)) {
apiEffect = { apiEffect = {};
effectType : R3.D3.API.Effect.EFFECT_TYPE_STEREO
};
} }
this.apiEffect = apiEffect;
if (R3.Utils.UndefinedOrNull(apiEffect.cameraType)) { R3.D3.API.Effect.call(
apiEffect.effectType = R3.D3.API.Effect.EFFECT_TYPE_STEREO; this,
} this.apiEffect,
this.apiEffect.width,
this.apiEffect.height
);
if (R3.Utils.UndefinedOrNull(eyeSeperation)) { if (R3.Utils.UndefinedOrNull(eyeSeperation)) {
eyeSeperation = 0.064; eyeSeperation = 0.064;
} }
this.eyeSeperation = eyeSeperation; this.eyeSeperation = eyeSeperation;
R3.D3.API.Effect.call(
this,
apiEffect.id,
apiEffect.name,
apiEffect.effectType,
apiEffect.parent,
apiEffect.renderer,
apiEffect.width,
apiEffect.height
);
}; };
R3.D3.API.Effect.Stereo.prototype = Object.create(R3.D3.API.Effect.prototype); R3.D3.API.Effect.Stereo.prototype = Object.create(R3.D3.API.Effect.prototype);

View File

@ -1,7 +1,6 @@
/** /**
* Face * R3.D3.API.Face
* @param id * @param apiComponent
* @param name
* @param v0index * @param v0index
* @param v1index * @param v1index
* @param v2index * @param v2index
@ -12,13 +11,10 @@
* @param vertexNormals * @param vertexNormals
* @param normal * @param normal
* @param selected * @param selected
* @param parentGeometry
* @param parent
* @constructor * @constructor
*/ */
R3.D3.API.Face = function( R3.D3.API.Face = function(
id, apiComponent,
name,
v0index, v0index,
v1index, v1index,
v2index, v2index,
@ -28,20 +24,10 @@ R3.D3.API.Face = function(
vertexColors, vertexColors,
vertexNormals, vertexNormals,
normal, normal,
selected, selected
parentGeometry,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Face ' + id;
}
this.name = name;
if (R3.Utils.UndefinedOrNull(v0index)) { if (R3.Utils.UndefinedOrNull(v0index)) {
v0index = -1; v0index = -1;
@ -69,15 +55,15 @@ R3.D3.API.Face = function(
this.uvs = uvs; this.uvs = uvs;
if (R3.Utils.UndefinedOrNull(color)) { if (R3.Utils.UndefinedOrNull(color)) {
color = new R3.API.Color(this); color = new R3.API.Color();
} }
this.color = color; this.color = color;
if (R3.Utils.UndefinedOrNull(vertexColors)) { if (R3.Utils.UndefinedOrNull(vertexColors)) {
vertexColors = [ vertexColors = [
new R3.API.Color(this), new R3.API.Color(),
new R3.API.Color(this), new R3.API.Color(),
new R3.API.Color(this) new R3.API.Color()
]; ];
} }
this.vertexColors = vertexColors; this.vertexColors = vertexColors;
@ -97,16 +83,6 @@ R3.D3.API.Face = function(
} }
this.selected = selected; this.selected = selected;
if (R3.Utils.UndefinedOrNull(parentGeometry)) {
parentGeometry = null;
}
this.parentGeometry = parentGeometry;
R3.API.Component.call(
this,
R3.Component.FACE,
parent
);
}; };
/** /**
@ -116,75 +92,13 @@ R3.D3.API.Face = function(
R3.D3.API.Face.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Face.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.Face.prototype.constructor = R3.D3.API.Face; R3.D3.API.Face.prototype.constructor = R3.D3.API.Face;
/**
* Returns an API Face from a data object
* @constructor
* @param objectFace
*/
// R3.D3.API.Face.FromObject = function(objectFace) {
//
// var apiUvs = objectFace.uvs.reduce(
//
// function(result, uvArray, index) {
//
// result[index] = uvArray.reduce(
// function(uvResult, uv) {
// uvResult.push(R3.API.Vector2.FromObject(uv));
// return uvResult;
// },
// []
// );
//
// return result;
// },
// []
// );
//
// var apiVertexColors = objectFace.vertexColors.map(
// function(vertexColor) {
// return R3.API.Color.FromObject(vertexColor);
// }
// );
//
// var apiColor = null;
// if (objectFace.color) {
// apiColor = R3.API.Color.FromObject(objectFace.color);
// }
//
// var apiVertexNormals = objectFace.vertexNormals.map(
// function(vertexNormal) {
// return R3.API.Vector3.FromObject(vertexNormal);
// }
// );
//
// var apiNormal = null;
// if (objectFace.normal) {
// apiNormal = R3.API.Vector3.FromObject(objectFace.normal);
// }
//
// return new R3.D3.API.Face(
// objectFace.id,
// objectFace.name,
// objectFace.v0index,
// objectFace.v1index,
// objectFace.v2index,
// objectFace.materialIndex,
// apiUvs,
// apiColor,
// apiVertexColors,
// apiVertexNormals,
// apiNormal
// );
// };
//
/** /**
* Clone a Face * Clone a Face
* @returns {R3.D3.API.Face} * @returns {R3.D3.API.Face}
*/ */
R3.D3.API.Face.prototype.clone = function(){ R3.D3.API.Face.prototype.clone = function(){
return new R3.D3.API.Face( return new R3.D3.API.Face(
this.id, null,
this.name,
this.v0index, this.v0index,
this.v1index, this.v1index,
this.v2index, this.v2index,
@ -193,7 +107,8 @@ R3.D3.API.Face.prototype.clone = function(){
this.color, this.color,
this.vertexColors, this.vertexColors,
this.vertexNormals, this.vertexNormals,
this.normal this.normal,
this.selected
); );
}; };

View File

@ -1,35 +1,23 @@
/** /**
* Raw Fog API object - should always correspond with the Fog Schema * R3.D3.API.Fog
* @param id String * @param apiComponent
* @param name String
* @param exponential * @param exponential
* @param color * @param color
* @param near * @param near
* @param far * @param far
* @param density * @param density
* @param parent
* @constructor * @constructor
*/ */
R3.D3.API.Fog = function( R3.D3.API.Fog = function(
id, apiComponent,
name,
exponential, exponential,
color, color,
near, near,
far, far,
density, density
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Fog (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(exponential)) { if (R3.Utils.UndefinedOrNull(exponential)) {
exponential = false; exponential = false;
@ -56,11 +44,6 @@ R3.D3.API.Fog = function(
} }
this.density = density; this.density = density;
R3.API.Component.call(
this,
R3.Component.FOG,
parent
);
}; };
R3.D3.API.Fog.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Fog.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,52 +1,22 @@
/** /**
* Raw Font API object - should always correspond with the Font Schema * R3.D3.API.Font
* @param id * @param apiComponent
* @param name * @param path - Relative to API URL
* @param url
* @param parent
* @constructor * @constructor
*/ */
R3.D3.API.Font = function( R3.D3.API.Font = function(
id, apiComponent,
name, path
url,
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) { __API_COMPONENT_MACRO__
name = 'Font (' + id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(url)) { if (R3.Utils.UndefinedOrNull(path)) {
url = '/apiRelative/path/to/font'; path = '';
} }
this.url = url; this.path = path;
R3.API.Component.call(
this,
R3.Component.FONT,
parent
);
}; };
R3.D3.API.Font.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Font.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.Font.prototype.constructor = R3.D3.API.Font; R3.D3.API.Font.prototype.constructor = R3.D3.API.Font;
/**
* Returns an API light from an Object light
* @param objectFont
* @constructor
*/
R3.D3.API.Font.FromObject = function(objectFont) {
return new R3.D3.API.Font(
objectFont.id,
objectFont.name,
objectFont.url,
objectFont.parent
);
};

View File

@ -1,7 +1,6 @@
/** /**
* Raw FrictionContactMaterial API object - should always correspond with the FrictionContactMaterial Schema * R3.D3.API.FrictionContactMaterial
* @param id * @param apiComponent
* @param name
* @param materials * @param materials
* @param friction * @param friction
* @param restitution * @param restitution
@ -9,31 +8,20 @@
* @param contactEquationRelaxation * @param contactEquationRelaxation
* @param frictionEquationStiffness * @param frictionEquationStiffness
* @param frictionEquationRelaxation * @param frictionEquationRelaxation
* @param parent
* @constructor * @constructor
*/ */
R3.D3.API.FrictionContactMaterial = function( R3.D3.API.FrictionContactMaterial = function(
id, apiComponent,
name,
materials, materials,
friction, friction,
restitution, restitution,
contactEquationStiffness, contactEquationStiffness,
contactEquationRelaxation, contactEquationRelaxation,
frictionEquationStiffness, frictionEquationStiffness,
frictionEquationRelaxation, frictionEquationRelaxation
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Friction Material (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(materials)) { if (R3.Utils.UndefinedOrNull(materials)) {
materials = []; materials = [];
@ -70,33 +58,7 @@ R3.D3.API.FrictionContactMaterial = function(
} }
this.frictionEquationRelaxation = frictionEquationRelaxation; this.frictionEquationRelaxation = frictionEquationRelaxation;
R3.API.Component.call(
this,
R3.Component.FRICTION_CONTACT_MATERIAL,
parent
);
}; };
R3.D3.API.FrictionContactMaterial.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.FrictionContactMaterial.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.FrictionContactMaterial.prototype.constructor = R3.D3.API.FrictionContactMaterial; R3.D3.API.FrictionContactMaterial.prototype.constructor = R3.D3.API.FrictionContactMaterial;
/**
* Creates an API FrictionContactMaterial from an Object FrictionContactMaterial
* @param objectFrictionContactMaterial
* @constructor
*/
R3.D3.API.FrictionContactMaterial.FromObject = function(objectFrictionContactMaterial) {
return new R3.D3.API.FrictionContactMaterial(
objectFrictionContactMaterial.id,
objectFrictionContactMaterial.name,
objectFrictionContactMaterial.materials,
objectFrictionContactMaterial.friction,
objectFrictionContactMaterial.restitution,
objectFrictionContactMaterial.contactEquationStiffness,
objectFrictionContactMaterial.contactEquationRelaxation,
objectFrictionContactMaterial.frictionEquationStiffness,
objectFrictionContactMaterial.frictionEquationRelaxation,
objectFrictionContactMaterial.parent
);
};

View File

@ -1,29 +1,17 @@
/** /**
* Raw FrictionMaterial API object - should always correspond with the FrictionMaterial Schema * R3.D3.API.FrictionMaterial
* @param id * @param apiComponent
* @param name
* @param friction * @param friction
* @param restitution * @param restitution
* @param parent
* @constructor * @constructor
*/ */
R3.D3.API.FrictionMaterial = function( R3.D3.API.FrictionMaterial = function(
id, apiComponent,
name,
friction, friction,
restitution, restitution
parent
) { ) {
if (R3.Utils.UndefinedOrNull(id)) { __API_COMPONENT_MACRO__
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Friction Material (' + this.id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(friction)) { if (R3.Utils.UndefinedOrNull(friction)) {
friction = -1; friction = -1;
@ -35,28 +23,7 @@ R3.D3.API.FrictionMaterial = function(
} }
this.restitution = restitution; this.restitution = restitution;
R3.API.Component.call(
this,
R3.Component.FRICTION_MATERIAL,
parent
);
}; };
R3.D3.API.FrictionMaterial.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.FrictionMaterial.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.FrictionMaterial.prototype.constructor = R3.D3.API.FrictionMaterial; R3.D3.API.FrictionMaterial.prototype.constructor = R3.D3.API.FrictionMaterial;
/**
* Creates an API FrictionMaterial from an Object FrictionMaterial
* @param objectFrictionMaterial
* @constructor
*/
R3.D3.API.FrictionMaterial.FromObject = function(objectFrictionMaterial) {
return new R3.D3.API.FrictionMaterial(
objectFrictionMaterial.id,
objectFrictionMaterial.name,
objectFrictionMaterial.friction,
objectFrictionMaterial.restitution,
objectFrictionMaterial.parent
);
};

View File

@ -1,10 +1,6 @@
/** /**
* R3.D3.API.Geometry * R3.D3.API.Geometry
* @param id * @param apiComponent
* @param name
* @param geometryType
* @param parent
* @param parentMesh
* @param boundingBox * @param boundingBox
* @param boundingSphere * @param boundingSphere
* @param faces * @param faces
@ -12,177 +8,14 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry = function( R3.D3.API.Geometry = function(
id, apiComponent,
name,
geometryType,
parent,
parentMesh,
boundingBox, boundingBox,
boundingSphere, boundingSphere,
faces, faces,
vertices vertices
) { ) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(geometryType)) { __API_COMPONENT_MACRO__
geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NONE;
}
this.geometryType = geometryType;
if (R3.Utils.UndefinedOrNull(name)) {
switch (this.geometryType) {
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL :
name = 'Geometry';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX :
name = 'Geometry Normal Box';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE :
name = 'Geometry Normal Circle';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE :
name = 'Geometry Normal Cone';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER :
name = 'Geometry Normal Cylinder';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON :
name = 'Geometry Normal Dodecahedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES :
name = 'Geometry Normal Edges';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE :
name = 'Geometry Normal Extrude';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON :
name = 'Geometry Normal Icosahedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE :
name = 'Geometry Normal Lathe';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON :
name = 'Geometry Normal Octahedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC :
name = 'Geometry Normal Parametric';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE :
name = 'Geometry Normal Plane';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_POLYHEDRON :
name = 'Geometry Normal Polyhedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_RING :
name = 'Geometry Normal Ring';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE :
name = 'Geometry Normal Shape';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE :
name = 'Geometry Normal Sphere';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TETRAHEDRON :
name = 'Geometry Normal Tetrahedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT :
name = 'Geometry Normal Text';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS :
name = 'Geometry Normal Torus';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS_KNOT :
name = 'Geometry Normal Torus Knot';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TUBE :
name = 'Geometry Normal Tube';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME :
name = 'Geometry Normal Wireframe';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER :
name = 'Geometry Buffer';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX :
name = 'Geometry Buffer Box';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE :
name = 'Geometry Buffer Circle';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE :
name = 'Geometry Buffer Cone';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER :
name = 'Geometry Buffer Cylinder';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON :
name = 'Geometry Buffer Dodecahedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE :
name = 'Geometry Buffer Extrude';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON :
name = 'Geometry Buffer Icosahedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE :
name = 'Geometry Buffer Lathe';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON :
name = 'Geometry Buffer Octahedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC :
name = 'Geometry Buffer Parametric';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE :
name = 'Geometry Buffer Plane';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON :
name = 'Geometry Buffer Polyhedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING :
name = 'Geometry Buffer Ring';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE :
name = 'Geometry Buffer Shape';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE :
name = 'Geometry Buffer Sphere';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON :
name = 'Geometry Buffer Tetrahedron';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT :
name = 'Geometry Buffer Text';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS :
name = 'Geometry Buffer Torus';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT :
name = 'Geometry Buffer Torus Knot';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE :
name = 'Geometry Buffer Tube';
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_INSTANCED :
name = 'Geometry Buffer Instanced';
break;
default :
console.warn('no nice name for geometry');
name = 'Geometry';
}
name += ' (' + id + ')';
}
this.name = name;
if (R3.Utils.UndefinedOrNull(parentMesh)) {
parentMesh = null;
}
this.parentMesh = parentMesh;
if (R3.Utils.UndefinedOrNull(boundingBox)) { if (R3.Utils.UndefinedOrNull(boundingBox)) {
boundingBox = new R3.API.Box3(); boundingBox = new R3.API.Box3();
@ -203,211 +36,7 @@ R3.D3.API.Geometry = function(
vertices = []; vertices = [];
} }
this.vertices = vertices; this.vertices = vertices;
R3.API.Component.call(
this,
R3.D3.API.Geometry.GetComponentType(this.geometryType),
parent
);
}; };
R3.D3.API.Geometry.prototype = Object.create(R3.API.Component.prototype); R3.D3.API.Geometry.prototype = Object.create(R3.API.Component.prototype);
R3.D3.API.Geometry.prototype.constructor = R3.D3.API.Geometry; R3.D3.API.Geometry.prototype.constructor = R3.D3.API.Geometry;
R3.D3.API.Geometry.GetComponentType = function(geometryType) {
var componentType = null;
switch (geometryType) {
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL :
componentType = R3.Component.GEOMETRY_NORMAL;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX :
componentType = R3.Component.GEOMETRY_NORMAL_BOX;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE :
componentType = R3.Component.GEOMETRY_NORMAL_CIRCLE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE :
componentType = R3.Component.GEOMETRY_NORMAL_CONE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER :
componentType = R3.Component.GEOMETRY_NORMAL_CYLINDER;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON :
componentType = R3.Component.GEOMETRY_NORMAL_DODECAHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES :
componentType = R3.Component.GEOMETRY_NORMAL_EDGES;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE :
componentType = R3.Component.GEOMETRY_NORMAL_EXTRUDE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON :
componentType = R3.Component.GEOMETRY_NORMAL_ICOSAHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE :
componentType = R3.Component.GEOMETRY_NORMAL_LATHE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON :
componentType = R3.Component.GEOMETRY_NORMAL_OCTAHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC :
componentType = R3.Component.GEOMETRY_NORMAL_PARAMETRIC;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE :
componentType = R3.Component.GEOMETRY_NORMAL_PLANE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_POLYHEDRON :
componentType = R3.Component.GEOMETRY_NORMAL_POLYHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_RING :
componentType = R3.Component.GEOMETRY_NORMAL_RING;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE :
componentType = R3.Component.GEOMETRY_NORMAL_SHAPE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE :
componentType = R3.Component.GEOMETRY_NORMAL_SPHERE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TETRAHEDRON :
componentType = R3.Component.GEOMETRY_NORMAL_TETRAHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT :
componentType = R3.Component.GEOMETRY_NORMAL_TEXT;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS :
componentType = R3.Component.GEOMETRY_NORMAL_TORUS;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS_KNOT :
componentType = R3.Component.GEOMETRY_NORMAL_TORUS_KNOT;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TUBE :
componentType = R3.Component.GEOMETRY_NORMAL_TUBE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME :
componentType = R3.Component.GEOMETRY_NORMAL_WIREFRAME;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER :
componentType = R3.Component.GEOMETRY_BUFFER;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX :
componentType = R3.Component.GEOMETRY_BUFFER_BOX;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE :
componentType = R3.Component.GEOMETRY_BUFFER_CIRCLE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE :
componentType = R3.Component.GEOMETRY_BUFFER_CONE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER :
componentType = R3.Component.GEOMETRY_BUFFER_CYLINDER;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON :
componentType = R3.Component.GEOMETRY_BUFFER_DODECAHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE :
componentType = R3.Component.GEOMETRY_BUFFER_EXTRUDE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON :
componentType = R3.Component.GEOMETRY_BUFFER_ICOSAHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE :
componentType = R3.Component.GEOMETRY_BUFFER_LATHE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON :
componentType = R3.Component.GEOMETRY_BUFFER_OCTAHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC:
componentType = R3.Component.GEOMETRY_BUFFER_PARAMETRIC;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE :
componentType = R3.Component.GEOMETRY_BUFFER_PLANE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON :
componentType = R3.Component.GEOMETRY_BUFFER_POLYHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING:
componentType = R3.Component.GEOMETRY_BUFFER_RING;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE :
componentType = R3.Component.GEOMETRY_BUFFER_SHAPE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE :
componentType = R3.Component.GEOMETRY_BUFFER_SPHERE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON :
componentType = R3.Component.GEOMETRY_BUFFER_TETRAHEDRON;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT :
componentType = R3.Component.GEOMETRY_BUFFER_TEXT;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS :
componentType = R3.Component.GEOMETRY_BUFFER_TORUS;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT :
componentType = R3.Component.GEOMETRY_BUFFER_TORUS_KNOT;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE :
componentType = R3.Component.GEOMETRY_BUFFER_TUBE;
break;
case R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_INSTANCED :
componentType = R3.Component.GEOMETRY_BUFFER_INSTANCED;
break;
default:
throw new Error('unhandled geometry type: ' + geometryType);
}
return componentType;
};
/**
* Geometry Type
* @type {number}
*/
R3.D3.API.Geometry.GEOMETRY_TYPE_NONE = 0x0;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL = 0x1;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX = 0x2;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE = 0x3;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE = 0x4;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER = 0x5;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON = 0x6;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES = 0x7;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE = 0x8;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON = 0x9;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE = 0xa;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON = 0xb;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC = 0xc;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE = 0xd;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_POLYHEDRON = 0xe;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_RING = 0xf;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE = 0x10;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE = 0x11;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TETRAHEDRON = 0x12;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT = 0x13;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS = 0x14;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS_KNOT = 0x15;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TUBE = 0x16;
R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME = 0x17;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER = 0x18;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX = 0x19;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE = 0x1a;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE = 0x1b;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER = 0x1c;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON = 0x1d;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE = 0x1e;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON = 0x1f;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE = 0x20;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON = 0x21;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC = 0x22;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE = 0x23;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON = 0x24;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING = 0x25;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE = 0x26;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE = 0x27;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON = 0x28;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT = 0x29;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS = 0x2a;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT = 0x2b;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE = 0x2c;
R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_INSTANCED = 0x2d;

View File

@ -17,14 +17,18 @@ R3.D3.API.Geometry.Buffer = function(
morphAttributes morphAttributes
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { if (R3.Utils.UndefinedOrNull(apiGeometry)) {
apiGeometry = { apiGeometry = {};
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER
};
} }
this.apiGeometry = apiGeometry;
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) { R3.D3.API.Geometry.call(
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER; this,
} this.apiGeometry,
this.apiGeometry.boundingBox,
this.apiGeometry.boundingSphere,
this.apiGeometry.faces,
this.apiGeometry.vertices
);
if (R3.Utils.UndefinedOrNull(attributes)) { if (R3.Utils.UndefinedOrNull(attributes)) {
attributes = []; attributes = [];
@ -51,18 +55,6 @@ R3.D3.API.Geometry.Buffer = function(
} }
this.morphAttributes = morphAttributes; this.morphAttributes = morphAttributes;
R3.D3.API.Geometry.call(
this,
apiGeometry.id,
apiGeometry.name,
apiGeometry.geometryType,
apiGeometry.parent,
apiGeometry.parentMesh,
apiGeometry.boundingBox,
apiGeometry.boundingSphere,
apiGeometry.faces,
apiGeometry.vertices
);
}; };
R3.D3.API.Geometry.Buffer.prototype = Object.create(R3.D3.API.Geometry.prototype); R3.D3.API.Geometry.Buffer.prototype = Object.create(R3.D3.API.Geometry.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Box * R3.D3.API.Geometry.Buffer.Box
* @param apiGeometry * @param apiGeometryBuffer
* @param width * @param width
* @param height * @param height
* @param depth * @param depth
@ -10,7 +10,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Box = function( R3.D3.API.Geometry.Buffer.Box = function(
apiGeometry, apiGeometryBuffer,
width, width,
height, height,
depth, depth,
@ -19,15 +19,7 @@ R3.D3.API.Geometry.Buffer.Box = function(
depthSegments depthSegments
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX;
}
if (R3.Utils.UndefinedOrNull(width)) { if (R3.Utils.UndefinedOrNull(width)) {
width = 1; width = 1;
@ -58,16 +50,7 @@ R3.D3.API.Geometry.Buffer.Box = function(
depthSegments = 1; depthSegments = 1;
} }
this.depthSegments = depthSegments; this.depthSegments = depthSegments;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Box.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Box.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Circle * R3.D3.API.Geometry.Buffer.Circle
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param segments * @param segments
* @param thetaStart * @param thetaStart
@ -8,22 +8,14 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Circle = function( R3.D3.API.Geometry.Buffer.Circle = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
segments, segments,
thetaStart, thetaStart,
thetaLength thetaLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -44,16 +36,6 @@ R3.D3.API.Geometry.Buffer.Circle = function(
thetaLength = Math.PI * 2; thetaLength = Math.PI * 2;
} }
this.thetaLength = thetaLength; this.thetaLength = thetaLength;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Circle.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Circle.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Cone * R3.D3.API.Geometry.Buffer.Cone
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param height * @param height
* @param radialSegments * @param radialSegments
@ -11,7 +11,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Cone = function( R3.D3.API.Geometry.Buffer.Cone = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
height, height,
radialSegments, radialSegments,
@ -21,15 +21,7 @@ R3.D3.API.Geometry.Buffer.Cone = function(
thetaLength thetaLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -66,15 +58,6 @@ R3.D3.API.Geometry.Buffer.Cone = function(
} }
this.thetaLength = thetaLength; this.thetaLength = thetaLength;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Cone.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Cone.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Cylinder * R3.D3.API.Geometry.Buffer.Cylinder
* @param apiGeometry * @param apiGeometryBuffer
* @param radiusTop * @param radiusTop
* @param radiusBottom * @param radiusBottom
* @param height * @param height
@ -12,7 +12,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Cylinder = function( R3.D3.API.Geometry.Buffer.Cylinder = function(
apiGeometry, apiGeometryBuffer,
radiusTop, radiusTop,
radiusBottom, radiusBottom,
height, height,
@ -23,15 +23,7 @@ R3.D3.API.Geometry.Buffer.Cylinder = function(
thetaLength thetaLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER;
}
if (R3.Utils.UndefinedOrNull(radiusTop)) { if (R3.Utils.UndefinedOrNull(radiusTop)) {
radiusTop = 1; radiusTop = 1;
@ -73,15 +65,6 @@ R3.D3.API.Geometry.Buffer.Cylinder = function(
} }
this.thetaLength = thetaLength; this.thetaLength = thetaLength;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Cylinder.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Cylinder.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Buffer.Dodecahedron * R3.D3.API.Geometry.Buffer.Dodecahedron
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param detail * @param detail
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Dodecahedron = function( R3.D3.API.Geometry.Buffer.Dodecahedron = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
detail detail
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Dodecahedron = function(
} }
this.detail = detail; this.detail = detail;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Dodecahedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Dodecahedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Extrude * R3.D3.API.Geometry.Buffer.Extrude
* @param apiGeometry * @param apiGeometryBuffer
* @param shapes * @param shapes
* @param curveSegments * @param curveSegments
* @param steps * @param steps
@ -15,7 +15,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Extrude = function( R3.D3.API.Geometry.Buffer.Extrude = function(
apiGeometry, apiGeometryBuffer,
shapes, shapes,
curveSegments, curveSegments,
steps, steps,
@ -29,15 +29,7 @@ R3.D3.API.Geometry.Buffer.Extrude = function(
UVGenerator UVGenerator
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE;
}
if (R3.Utils.UndefinedOrNull(shapes)) { if (R3.Utils.UndefinedOrNull(shapes)) {
shapes = []; shapes = [];
@ -89,15 +81,6 @@ R3.D3.API.Geometry.Buffer.Extrude = function(
} }
this.UVGenerator = UVGenerator; this.UVGenerator = UVGenerator;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Extrude.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Extrude.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Buffer.Icosahedron * R3.D3.API.Geometry.Buffer.Icosahedron
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param detail * @param detail
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Icosahedron = function( R3.D3.API.Geometry.Buffer.Icosahedron = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
detail detail
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Icosahedron = function(
} }
this.detail = detail; this.detail = detail;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Icosahedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Icosahedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,38 +1,21 @@
/** /**
* R3.D3.API.Geometry.Buffer.Instanced * R3.D3.API.Geometry.Buffer.Instanced
* @param apiGeometry * @param apiGeometryBuffer
* @param maxInstancedCount * @param maxInstancedCount
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Instanced = function( R3.D3.API.Geometry.Buffer.Instanced = function(
apiGeometry, apiGeometryBuffer,
maxInstancedCount maxInstancedCount
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_INSTANCED
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_INSTANCED;
}
if (R3.Utils.UndefinedOrNull(maxInstancedCount)) { if (R3.Utils.UndefinedOrNull(maxInstancedCount)) {
maxInstancedCount = null; maxInstancedCount = null;
} }
this.maxInstancedCount = maxInstancedCount; this.maxInstancedCount = maxInstancedCount;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Instanced.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Instanced.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Lathe * R3.D3.API.Geometry.Buffer.Lathe
* @param apiGeometry * @param apiGeometryBuffer
* @param points [R3.Vector2] (x must be larger than 0) * @param points [R3.Vector2] (x must be larger than 0)
* @param segments * @param segments
* @param phiStart * @param phiStart
@ -8,22 +8,14 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Lathe = function( R3.D3.API.Geometry.Buffer.Lathe = function(
apiGeometry, apiGeometryBuffer,
points, points,
segments, segments,
phiStart, phiStart,
phiLength phiLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE;
}
if (R3.Utils.UndefinedOrNull(points)) { if (R3.Utils.UndefinedOrNull(points)) {
points = []; points = [];
@ -45,15 +37,6 @@ R3.D3.API.Geometry.Buffer.Lathe = function(
} }
this.phiLength = phiLength; this.phiLength = phiLength;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Lathe.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Lathe.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Buffer.Octahedron * R3.D3.API.Geometry.Buffer.Octahedron
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param detail * @param detail
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Octahedron = function( R3.D3.API.Geometry.Buffer.Octahedron = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
detail detail
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Octahedron = function(
} }
this.detail = detail; this.detail = detail;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Octahedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Octahedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,27 +1,19 @@
/** /**
* R3.D3.API.Geometry.Buffer.Parametric * R3.D3.API.Geometry.Buffer.Parametric
* @param apiGeometry * @param apiGeometryBuffer
* @param generatorFn(u,v) => returns Vector3, u and v is values between 0 and 1 * @param generatorFn(u,v) => returns Vector3, u and v is values between 0 and 1
* @param slices * @param slices
* @param stacks * @param stacks
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Parametric = function( R3.D3.API.Geometry.Buffer.Parametric = function(
apiGeometry, apiGeometryBuffer,
generatorFn, generatorFn,
slices, slices,
stacks stacks
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC;
}
if (R3.Utils.UndefinedOrNull(generatorFn)) { if (R3.Utils.UndefinedOrNull(generatorFn)) {
generatorFn = ''; generatorFn = '';
@ -38,15 +30,6 @@ R3.D3.API.Geometry.Buffer.Parametric = function(
} }
this.stacks = stacks; this.stacks = stacks;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Parametric.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Parametric.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Plane * R3.D3.API.Geometry.Buffer.Plane
* @param apiGeometry * @param apiGeometryBuffer
* @param width * @param width
* @param height * @param height
* @param widthSegments * @param widthSegments
@ -8,22 +8,14 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Plane = function( R3.D3.API.Geometry.Buffer.Plane = function(
apiGeometry, apiGeometryBuffer,
width, width,
height, height,
widthSegments, widthSegments,
heightSegments heightSegments
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE;
}
if (R3.Utils.UndefinedOrNull(width)) { if (R3.Utils.UndefinedOrNull(width)) {
width = 1; width = 1;
@ -45,15 +37,6 @@ R3.D3.API.Geometry.Buffer.Plane = function(
} }
this.heightSegments = heightSegments; this.heightSegments = heightSegments;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Plane.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Plane.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Polyhedron * R3.D3.API.Geometry.Buffer.Polyhedron
* @param apiGeometry * @param apiGeometryBuffer
* @param vertices * @param vertices
* @param indices * @param indices
* @param radius * @param radius
@ -8,22 +8,14 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Polyhedron = function( R3.D3.API.Geometry.Buffer.Polyhedron = function(
apiGeometry, apiGeometryBuffer,
vertices, vertices,
indices, indices,
radius, radius,
detail detail
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON;
}
if (R3.Utils.UndefinedOrNull(vertices)) { if (R3.Utils.UndefinedOrNull(vertices)) {
vertices = []; vertices = [];
@ -45,15 +37,6 @@ R3.D3.API.Geometry.Buffer.Polyhedron = function(
} }
this.detail = detail; this.detail = detail;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Polyhedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Polyhedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Ring * R3.D3.API.Geometry.Buffer.Ring
* @param apiGeometry * @param apiGeometryBuffer
* @param innerRadius * @param innerRadius
* @param outerRadius * @param outerRadius
* @param thetaSegments * @param thetaSegments
@ -10,7 +10,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Ring = function( R3.D3.API.Geometry.Buffer.Ring = function(
apiGeometry, apiGeometryBuffer,
innerRadius, innerRadius,
outerRadius, outerRadius,
thetaSegments, thetaSegments,
@ -19,15 +19,7 @@ R3.D3.API.Geometry.Buffer.Ring = function(
thetaLength thetaLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING;
}
if (R3.Utils.UndefinedOrNull(innerRadius)) { if (R3.Utils.UndefinedOrNull(innerRadius)) {
innerRadius = 0.5; innerRadius = 0.5;
@ -59,15 +51,6 @@ R3.D3.API.Geometry.Buffer.Ring = function(
} }
this.thetaLength = thetaLength; this.thetaLength = thetaLength;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Ring.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Ring.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Buffer.Shape * R3.D3.API.Geometry.Buffer.Shape
* @param apiGeometry * @param apiGeometryBuffer
* @param shapes * @param shapes
* @param curveSegments * @param curveSegments
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Shape = function( R3.D3.API.Geometry.Buffer.Shape = function(
apiGeometry, apiGeometryBuffer,
shapes, shapes,
curveSegments curveSegments
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE;
}
if (R3.Utils.UndefinedOrNull(shapes)) { if (R3.Utils.UndefinedOrNull(shapes)) {
shapes = []; shapes = [];
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Shape = function(
} }
this.curveSegments = curveSegments; this.curveSegments = curveSegments;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Shape.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Shape.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Sphere * R3.D3.API.Geometry.Buffer.Sphere
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param widthSegments * @param widthSegments
* @param heightSegments * @param heightSegments
@ -11,7 +11,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Sphere = function( R3.D3.API.Geometry.Buffer.Sphere = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
widthSegments, widthSegments,
heightSegments, heightSegments,
@ -21,15 +21,7 @@ R3.D3.API.Geometry.Buffer.Sphere = function(
thetaLength thetaLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -66,15 +58,6 @@ R3.D3.API.Geometry.Buffer.Sphere = function(
} }
this.thetaLength = thetaLength; this.thetaLength = thetaLength;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Sphere.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Sphere.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Buffer.Tetrahedron * R3.D3.API.Geometry.Buffer.Tetrahedron
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param detail * @param detail
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Tetrahedron = function( R3.D3.API.Geometry.Buffer.Tetrahedron = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
detail detail
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Tetrahedron = function(
} }
this.detail = detail; this.detail = detail;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Tetrahedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Tetrahedron.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Text * R3.D3.API.Geometry.Buffer.Text
* @param apiGeometry * @param apiGeometryBuffer
* @param text * @param text
* @param font * @param font
* @param size * @param size
@ -13,7 +13,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Text = function( R3.D3.API.Geometry.Buffer.Text = function(
apiGeometry, apiGeometryBuffer,
text, text,
font, font,
size, size,
@ -25,15 +25,7 @@ R3.D3.API.Geometry.Buffer.Text = function(
bevelSegments bevelSegments
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT;
}
if (R3.Utils.UndefinedOrNull(text)) { if (R3.Utils.UndefinedOrNull(text)) {
text = '-=<yb4f310'; text = '-=<yb4f310';
@ -80,15 +72,6 @@ R3.D3.API.Geometry.Buffer.Text = function(
} }
this.bevelSegments = bevelSegments; this.bevelSegments = bevelSegments;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Text.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Text.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.TorusKnot * R3.D3.API.Geometry.Buffer.TorusKnot
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param tube * @param tube
* @param radialSegments * @param radialSegments
@ -10,7 +10,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.TorusKnot = function( R3.D3.API.Geometry.Buffer.TorusKnot = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
tube, tube,
radialSegments, radialSegments,
@ -19,15 +19,7 @@ R3.D3.API.Geometry.Buffer.TorusKnot = function(
q q
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -59,15 +51,6 @@ R3.D3.API.Geometry.Buffer.TorusKnot = function(
} }
this.q = q; this.q = q;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.TorusKnot.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.TorusKnot.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Torus * R3.D3.API.Geometry.Buffer.Torus
* @param apiGeometry * @param apiGeometryBuffer
* @param radius * @param radius
* @param tube * @param tube
* @param radialSegments * @param radialSegments
@ -9,7 +9,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Torus = function( R3.D3.API.Geometry.Buffer.Torus = function(
apiGeometry, apiGeometryBuffer,
radius, radius,
tube, tube,
radialSegments, radialSegments,
@ -17,15 +17,7 @@ R3.D3.API.Geometry.Buffer.Torus = function(
arc arc
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -52,15 +44,6 @@ R3.D3.API.Geometry.Buffer.Torus = function(
} }
this.arc = arc; this.arc = arc;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Torus.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Torus.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Buffer.Tube * R3.D3.API.Geometry.Buffer.Tube
* @param apiGeometry * @param apiGeometryBuffer
* @param path * @param path
* @param tubularSegments * @param tubularSegments
* @param radius * @param radius
@ -9,7 +9,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Buffer.Tube = function( R3.D3.API.Geometry.Buffer.Tube = function(
apiGeometry, apiGeometryBuffer,
path, path,
tubularSegments, tubularSegments,
radius, radius,
@ -17,15 +17,7 @@ R3.D3.API.Geometry.Buffer.Tube = function(
closed closed
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_BUFFER_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE;
}
if (R3.Utils.UndefinedOrNull(path)) { if (R3.Utils.UndefinedOrNull(path)) {
path = null; path = null;
@ -52,15 +44,6 @@ R3.D3.API.Geometry.Buffer.Tube = function(
} }
this.closed = closed; this.closed = closed;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
}; };
R3.D3.API.Geometry.Buffer.Tube.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype); R3.D3.API.Geometry.Buffer.Tube.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);

View File

@ -32,15 +32,20 @@ R3.D3.API.Geometry.Normal = function(
groupsNeedUpdate, groupsNeedUpdate,
lineDistancesNeedUpdate lineDistancesNeedUpdate
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) { if (R3.Utils.UndefinedOrNull(apiGeometry)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL; apiGeometry = {};
} }
this.apiGeometry = apiGeometry;
R3.D3.API.Geometry.call(
this,
this.apiGeometry,
this.apiGeometry.boundingBox,
this.apiGeometry.boundingSphere,
this.apiGeometry.faces,
this.apiGeometry.vertices
);
if (R3.Utils.UndefinedOrNull(colors)) { if (R3.Utils.UndefinedOrNull(colors)) {
colors = []; colors = [];
@ -106,19 +111,6 @@ R3.D3.API.Geometry.Normal = function(
lineDistancesNeedUpdate = false; lineDistancesNeedUpdate = false;
} }
this.lineDistancesNeedUpdate = lineDistancesNeedUpdate; this.lineDistancesNeedUpdate = lineDistancesNeedUpdate;
R3.D3.API.Geometry.call(
this,
apiGeometry.id,
apiGeometry.name,
apiGeometry.geometryType,
apiGeometry.parent,
apiGeometry.parentMesh,
apiGeometry.boundingBox,
apiGeometry.boundingSphere,
apiGeometry.faces,
apiGeometry.vertices
);
}; };
R3.D3.API.Geometry.Normal.prototype = Object.create(R3.D3.API.Geometry.prototype); R3.D3.API.Geometry.Normal.prototype = Object.create(R3.D3.API.Geometry.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Normal.Box * R3.D3.API.Geometry.Normal.Box
* @param apiGeometry * @param apiGeometryNormal
* @param width * @param width
* @param height * @param height
* @param depth * @param depth
@ -10,7 +10,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Box = function( R3.D3.API.Geometry.Normal.Box = function(
apiGeometry, apiGeometryNormal,
width, width,
height, height,
depth, depth,
@ -19,15 +19,7 @@ R3.D3.API.Geometry.Normal.Box = function(
depthSegments depthSegments
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX;
}
if (R3.Utils.UndefinedOrNull(width)) { if (R3.Utils.UndefinedOrNull(width)) {
width = 1; width = 1;
@ -58,24 +50,7 @@ R3.D3.API.Geometry.Normal.Box = function(
depthSegments = 1; depthSegments = 1;
} }
this.depthSegments = depthSegments; this.depthSegments = depthSegments;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Box.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Box.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Normal.Circle * R3.D3.API.Geometry.Normal.Circle
* @param apiGeometry * @param apiGeometryNormal
* @param radius * @param radius
* @param segments * @param segments
* @param thetaStart * @param thetaStart
@ -8,22 +8,14 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Circle = function( R3.D3.API.Geometry.Normal.Circle = function(
apiGeometry, apiGeometryNormal,
radius, radius,
segments, segments,
thetaStart, thetaStart,
thetaLength thetaLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -45,23 +37,6 @@ R3.D3.API.Geometry.Normal.Circle = function(
} }
this.thetaLength = thetaLength; this.thetaLength = thetaLength;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Circle.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Circle.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Normal.Cone * R3.D3.API.Geometry.Normal.Cone
* @param apiGeometry * @param apiGeometryNormal
* @param radius * @param radius
* @param height * @param height
* @param radialSegments * @param radialSegments
@ -11,7 +11,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Cone = function( R3.D3.API.Geometry.Normal.Cone = function(
apiGeometry, apiGeometryNormal,
radius, radius,
height, height,
radialSegments, radialSegments,
@ -21,15 +21,7 @@ R3.D3.API.Geometry.Normal.Cone = function(
thetaLength thetaLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -66,23 +58,6 @@ R3.D3.API.Geometry.Normal.Cone = function(
} }
this.thetaLength = thetaLength; this.thetaLength = thetaLength;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Cone.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Cone.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Normal.Cylinder * R3.D3.API.Geometry.Normal.Cylinder
* @param apiGeometry * @param apiGeometryNormal
* @param radiusTop * @param radiusTop
* @param radiusBottom * @param radiusBottom
* @param height * @param height
@ -12,7 +12,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Cylinder = function( R3.D3.API.Geometry.Normal.Cylinder = function(
apiGeometry, apiGeometryNormal,
radiusTop, radiusTop,
radiusBottom, radiusBottom,
height, height,
@ -23,15 +23,7 @@ R3.D3.API.Geometry.Normal.Cylinder = function(
thetaLength thetaLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER;
}
if (R3.Utils.UndefinedOrNull(radiusTop)) { if (R3.Utils.UndefinedOrNull(radiusTop)) {
radiusTop = 1; radiusTop = 1;
@ -73,23 +65,6 @@ R3.D3.API.Geometry.Normal.Cylinder = function(
} }
this.thetaLength = thetaLength; this.thetaLength = thetaLength;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Cylinder.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Cylinder.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Normal.Dodecahedron * R3.D3.API.Geometry.Normal.Dodecahedron
* @param apiGeometry * @param apiGeometryNormal
* @param radius * @param radius
* @param detail * @param detail
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Dodecahedron = function( R3.D3.API.Geometry.Normal.Dodecahedron = function(
apiGeometry, apiGeometryNormal,
radius, radius,
detail detail
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -31,23 +23,6 @@ R3.D3.API.Geometry.Normal.Dodecahedron = function(
} }
this.detail = detail; this.detail = detail;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Dodecahedron.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Dodecahedron.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Normal.Edges * R3.D3.API.Geometry.Normal.Edges
* @param apiGeometry * @param apiGeometryNormal
* @param geometry * @param geometry
* @param thresholdAngle (degrees) * @param thresholdAngle (degrees)
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Edges = function( R3.D3.API.Geometry.Normal.Edges = function(
apiGeometry, apiGeometryNormal,
geometry, geometry,
thresholdAngle thresholdAngle
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES;
}
if (R3.Utils.UndefinedOrNull(geometry)) { if (R3.Utils.UndefinedOrNull(geometry)) {
geometry = null; geometry = null;
@ -31,23 +23,6 @@ R3.D3.API.Geometry.Normal.Edges = function(
} }
this.thresholdAngle = thresholdAngle; this.thresholdAngle = thresholdAngle;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Edges.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Edges.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Normal.Extrude * R3.D3.API.Geometry.Normal.Extrude
* @param apiGeometry * @param apiGeometryNormal
* @param shapes * @param shapes
* @param curveSegments * @param curveSegments
* @param steps * @param steps
@ -15,7 +15,7 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Extrude = function( R3.D3.API.Geometry.Normal.Extrude = function(
apiGeometry, apiGeometryNormal,
shapes, shapes,
curveSegments, curveSegments,
steps, steps,
@ -29,15 +29,7 @@ R3.D3.API.Geometry.Normal.Extrude = function(
UVGenerator UVGenerator
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE;
}
if (R3.Utils.UndefinedOrNull(shapes)) { if (R3.Utils.UndefinedOrNull(shapes)) {
shapes = []; shapes = [];
@ -89,23 +81,6 @@ R3.D3.API.Geometry.Normal.Extrude = function(
} }
this.UVGenerator = UVGenerator; this.UVGenerator = UVGenerator;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Extrude.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Extrude.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Normal.Icosahedron * R3.D3.API.Geometry.Normal.Icosahedron
* @param apiGeometry * @param apiGeometryNormal
* @param radius * @param radius
* @param detail * @param detail
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Icosahedron = function( R3.D3.API.Geometry.Normal.Icosahedron = function(
apiGeometry, apiGeometryNormal,
radius, radius,
detail detail
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -31,23 +23,6 @@ R3.D3.API.Geometry.Normal.Icosahedron = function(
} }
this.detail = detail; this.detail = detail;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Icosahedron.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Icosahedron.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Normal.Lathe * R3.D3.API.Geometry.Normal.Lathe
* @param apiGeometry * @param apiGeometryNormal
* @param points [R3.Vector2] * @param points [R3.Vector2]
* @param segments * @param segments
* @param phiStart * @param phiStart
@ -8,22 +8,14 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Lathe = function( R3.D3.API.Geometry.Normal.Lathe = function(
apiGeometry, apiGeometryNormal,
points, points,
segments, segments,
phiStart, phiStart,
phiLength phiLength
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE;
}
if (R3.Utils.UndefinedOrNull(points)) { if (R3.Utils.UndefinedOrNull(points)) {
points = []; points = [];
@ -45,23 +37,6 @@ R3.D3.API.Geometry.Normal.Lathe = function(
} }
this.phiLength = phiLength; this.phiLength = phiLength;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Lathe.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Lathe.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,25 +1,17 @@
/** /**
* R3.D3.API.Geometry.Normal.Octahedron * R3.D3.API.Geometry.Normal.Octahedron
* @param apiGeometry * @param apiGeometryNormal
* @param radius * @param radius
* @param detail * @param detail
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Octahedron = function( R3.D3.API.Geometry.Normal.Octahedron = function(
apiGeometry, apiGeometryNormal,
radius, radius,
detail detail
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON;
}
if (R3.Utils.UndefinedOrNull(radius)) { if (R3.Utils.UndefinedOrNull(radius)) {
radius = 1; radius = 1;
@ -31,23 +23,6 @@ R3.D3.API.Geometry.Normal.Octahedron = function(
} }
this.detail = detail; this.detail = detail;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Octahedron.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Octahedron.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,27 +1,19 @@
/** /**
* R3.D3.API.Geometry.Normal.Parametric * R3.D3.API.Geometry.Normal.Parametric
* @param apiGeometry * @param apiGeometryNormal
* @param generatorFn(u,v) => returns Vector3, u and v is values between 0 and 1 * @param generatorFn(u,v) => returns Vector3, u and v is values between 0 and 1
* @param slices * @param slices
* @param stacks * @param stacks
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Parametric = function( R3.D3.API.Geometry.Normal.Parametric = function(
apiGeometry, apiGeometryNormal,
generatorFn, generatorFn,
slices, slices,
stacks stacks
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC;
}
if (R3.Utils.UndefinedOrNull(generatorFn)) { if (R3.Utils.UndefinedOrNull(generatorFn)) {
generatorFn = ''; generatorFn = '';
@ -38,23 +30,6 @@ R3.D3.API.Geometry.Normal.Parametric = function(
} }
this.stacks = stacks; this.stacks = stacks;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Parametric.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Parametric.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

View File

@ -1,6 +1,6 @@
/** /**
* R3.D3.API.Geometry.Normal.Plane * R3.D3.API.Geometry.Normal.Plane
* @param apiGeometry * @param apiGeometryNormal
* @param width * @param width
* @param height * @param height
* @param widthSegments * @param widthSegments
@ -8,22 +8,14 @@
* @constructor * @constructor
*/ */
R3.D3.API.Geometry.Normal.Plane = function( R3.D3.API.Geometry.Normal.Plane = function(
apiGeometry, apiGeometryNormal,
width, width,
height, height,
widthSegments, widthSegments,
heightSegments heightSegments
) { ) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) { __API_GEOMETRY_NORMAL_MACRO__
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE;
}
if (R3.Utils.UndefinedOrNull(width)) { if (R3.Utils.UndefinedOrNull(width)) {
width = 1; width = 1;
@ -45,23 +37,6 @@ R3.D3.API.Geometry.Normal.Plane = function(
} }
this.heightSegments = heightSegments; this.heightSegments = heightSegments;
R3.D3.API.Geometry.Normal.call(
this,
apiGeometry,
apiGeometry.colors,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
}; };
R3.D3.API.Geometry.Normal.Plane.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype); R3.D3.API.Geometry.Normal.Plane.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);

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