done with API classes
parent
659954f7de
commit
567b6b9f38
142
gulpfile.js
142
gulpfile.js
|
@ -7,24 +7,144 @@ var replace = require('gulp-string-replace');
|
|||
gulp.task('build', build);
|
||||
gulp.task('monitor', monitor);
|
||||
|
||||
var code = ' if (R3.Utils.UndefinedOrNull(apiComponent)) {';
|
||||
code += ' apiComponent = {};';
|
||||
code += ' }';
|
||||
code += ' this.apiComponent = apiComponent;';
|
||||
var code = 'if (R3.Utils.UndefinedOrNull(apiComponent)) {\n';
|
||||
code += '\t\tapiComponent = {};\n';
|
||||
code += '\t}\n';
|
||||
code += '\tthis.apiComponent = apiComponent;\n';
|
||||
code += '\n';
|
||||
code += ' R3.API.Component.call(';
|
||||
code += ' this,';
|
||||
code += ' this.apiComponent.parent,';
|
||||
code += ' this.apiComponent.id,';
|
||||
code += ' this.apiComponent.name';
|
||||
code += ' );';
|
||||
code += '\tR3.API.Component.call(\n';
|
||||
code += '\t\tthis,\n';
|
||||
code += '\t\tthis.apiComponent.parent,\n';
|
||||
code += '\t\tthis.apiComponent.id,\n';
|
||||
code += '\t\tthis.apiComponent.name\n';
|
||||
code += '\t);';
|
||||
|
||||
var code2 = 'if (R3.Utils.UndefinedOrNull(apiGeometryBuffer)) {\n';
|
||||
code2 += '\t\tapiGeometryBuffer = {};\n';
|
||||
code2 += '\t}\n';
|
||||
code2 += '\tthis.apiGeometryBuffer = apiGeometryBuffer;\n';
|
||||
code2 += '\n';
|
||||
code2 += '\tR3.D3.API.Geometry.Buffer.call(\n';
|
||||
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() {
|
||||
return gulp.src('./src/r3-*.js')
|
||||
.pipe(sort())
|
||||
.pipe(concat('r3.js'))
|
||||
.pipe(replace('__DATE__', new Date().toString()))
|
||||
.pipe(replace('__API_COMPONENT_MACRO__', code));
|
||||
.pipe(replace('__API_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({
|
||||
ext:{
|
||||
src:'.js',
|
||||
|
|
|
@ -31,6 +31,84 @@ R3.API.Component = function(
|
|||
|
||||
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() {
|
||||
|
||||
if (this instanceof R3.API.Box3) {
|
||||
|
@ -180,6 +258,9 @@ R3.API.Component.prototype.getComponentType = function() {
|
|||
if (this instanceof R3.D3.API.Effect.Anaglyph) {
|
||||
return R3.Component.EFFECT_ANAGLYPH;
|
||||
}
|
||||
if (this instanceof R3.D3.API.Face) {
|
||||
return R3.Component.FACE;
|
||||
}
|
||||
if (this instanceof R3.D3.API.Fog) {
|
||||
return R3.Component.FOG;
|
||||
}
|
||||
|
@ -369,7 +450,7 @@ R3.API.Component.prototype.getComponentType = function() {
|
|||
if (this instanceof R3.D3.API.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;
|
||||
}
|
||||
if (this instanceof R3.D3.API.Particle) {
|
||||
|
|
|
@ -281,7 +281,7 @@ R3.Component.PASS_RENDER = 0xd;
|
|||
R3.Component.SCENE = 0xe;
|
||||
R3.Component.RAYCASTER = 0xf;
|
||||
R3.Component.TEXT = 0x10;
|
||||
R3.Component.UNUSED = 0x11;
|
||||
R3.Component.FACE = 0x11;
|
||||
R3.Component.VIEWPORT = 0x12;
|
||||
R3.Component.SYSTEM = 0x13;
|
||||
R3.Component.GRAPHICS = 0x14;
|
||||
|
@ -942,10 +942,10 @@ R3.Component.GetComponentInfo = function(number) {
|
|||
apiConstructor : R3.API.Controls.D3.Orbit
|
||||
};
|
||||
case 0x52 : return {
|
||||
name : 'R3.D3.ParticleEngine',
|
||||
name : 'R3.D3.Particle.Engine',
|
||||
runtime : R3.Component.GRAPHICS_RUNTIME,
|
||||
constructor : R3.D3.ParticleEngine,
|
||||
apiConstructor : R3.D3.API.ParticleEngine
|
||||
constructor : R3.D3.Particle.Engine,
|
||||
apiConstructor : R3.D3.API.Particle.Engine
|
||||
};
|
||||
case 0x53 : return {
|
||||
name : 'R3.System.Particle',
|
||||
|
@ -1623,6 +1623,9 @@ R3.Component.prototype.getComponentType = function() {
|
|||
if (this instanceof R3.D3.Effect.Stereo) {
|
||||
return R3.Component.EFFECT_STEREO;
|
||||
}
|
||||
if (this instanceof R3.D3.Face) {
|
||||
return R3.Component.FACE;
|
||||
}
|
||||
if (this instanceof R3.D3.Fog) {
|
||||
return R3.Component.FOG;
|
||||
}
|
||||
|
@ -1809,7 +1812,7 @@ R3.Component.prototype.getComponentType = function() {
|
|||
if (this instanceof R3.D3.Mesh) {
|
||||
return R3.Component.MESH;
|
||||
}
|
||||
if (this instanceof R3.D3.ParticleEngine) {
|
||||
if (this instanceof R3.D3.Particle.Engine) {
|
||||
return R3.Component.PARTICLE_ENGINE;
|
||||
}
|
||||
if (this instanceof R3.D3.Particle) {
|
||||
|
|
|
@ -1,58 +1,22 @@
|
|||
/**
|
||||
* R3.API.Controls
|
||||
* @param parent
|
||||
* @param id
|
||||
* @param name
|
||||
* @param apiComponent
|
||||
* @param canvas
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Controls = function(
|
||||
parent,
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
canvas
|
||||
) {
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
parent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
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;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -13,14 +13,20 @@ R3.API.Controls.D3 = function(
|
|||
|
||||
R3.API.Controls.call(
|
||||
this,
|
||||
apiControls.parent,
|
||||
apiControls.id,
|
||||
apiControls.name,
|
||||
apiControls,
|
||||
apiControls.canvas
|
||||
);
|
||||
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -7,9 +7,7 @@ R3.API.Controls.Keyboard = function(
|
|||
) {
|
||||
R3.API.Controls.call(
|
||||
this,
|
||||
apiControls.parent,
|
||||
apiControls.id,
|
||||
apiControls.name,
|
||||
apiControls,
|
||||
apiControls.canvas
|
||||
);
|
||||
};
|
||||
|
|
|
@ -7,9 +7,7 @@ R3.API.Controls.Mouse = function(
|
|||
) {
|
||||
R3.API.Controls.call(
|
||||
this,
|
||||
apiControls.parent,
|
||||
apiControls.id,
|
||||
apiControls.name,
|
||||
apiControls,
|
||||
apiControls.canvas
|
||||
);
|
||||
};
|
||||
|
|
|
@ -10,9 +10,7 @@ R3.API.Controls.Touch = function(
|
|||
|
||||
R3.API.Controls.call(
|
||||
this,
|
||||
apiControls.parent,
|
||||
apiControls.id,
|
||||
apiControls.name,
|
||||
apiControls,
|
||||
apiControls.canvas
|
||||
);
|
||||
|
||||
|
|
|
@ -1,88 +1,21 @@
|
|||
/**
|
||||
* R3.API.Curve
|
||||
* @param id
|
||||
* @param name
|
||||
* @param curveType
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param arcLenghDivisions
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Curve = function(
|
||||
parent,
|
||||
id,
|
||||
name,
|
||||
curveType,
|
||||
apiComponent,
|
||||
arcLenghDivisions
|
||||
) {
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
parent
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(curveType)) {
|
||||
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;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(arcLenghDivisions)) {
|
||||
arcLenghDivisions = 200;
|
||||
}
|
||||
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.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;
|
||||
|
||||
|
||||
|
|
|
@ -11,14 +11,15 @@ R3.API.Curve.Path = function(
|
|||
autoClose
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(apiCurve)) {
|
||||
apiCurve = {
|
||||
curveType: R3.API.Curve.CURVE_TYPE_PATH
|
||||
};
|
||||
apiCurve = {}
|
||||
}
|
||||
this.apiCurve = apiCurve;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiCurve.curveType)) {
|
||||
apiCurve.curveType = R3.API.Curve.CURVE_TYPE_PATH;
|
||||
}
|
||||
R3.API.Curve.call(
|
||||
this,
|
||||
apiCurve,
|
||||
apiCurve.arcLenghDivisions
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(curves)) {
|
||||
curves = [];
|
||||
|
@ -29,15 +30,6 @@ R3.API.Curve.Path = function(
|
|||
autoClose = false;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -8,20 +8,11 @@ R3.API.Curve.Path.D2 = function(
|
|||
apiCurvePath,
|
||||
points
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiCurvePath)) {
|
||||
apiCurvePath = {
|
||||
curveType: R3.API.Curve.CURVE_TYPE_PATH_2D
|
||||
};
|
||||
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;
|
||||
this.apiCurvePath = apiCurvePath;
|
||||
|
||||
R3.API.Curve.Path.call(
|
||||
this,
|
||||
|
@ -29,6 +20,12 @@ R3.API.Curve.Path.D2 = function(
|
|||
apiCurvePath.curves,
|
||||
apiCurvePath.autoClose
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(points)) {
|
||||
points = [];
|
||||
}
|
||||
this.points = points;
|
||||
|
||||
};
|
||||
|
||||
R3.API.Curve.Path.D2.prototype = Object.create(R3.API.Curve.Path.prototype);
|
||||
|
|
|
@ -7,13 +7,7 @@ R3.API.Curve.Path.D2.Shape = function(
|
|||
apiCurvePathD2
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(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 ;
|
||||
apiCurvePathD2 = {};
|
||||
}
|
||||
|
||||
R3.API.Curve.Path.call(
|
||||
|
|
|
@ -1,31 +1,20 @@
|
|||
/**
|
||||
* Custom Code Component
|
||||
* @param id
|
||||
* @param name
|
||||
* @param apiComponent
|
||||
* @param eventId
|
||||
* @param code
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.CustomCode = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
eventId,
|
||||
code,
|
||||
parent
|
||||
code
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'CustomCode (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(eventId)) {
|
||||
eventId = 42;
|
||||
eventId = R3.Event.KEY_UP;
|
||||
}
|
||||
this.eventId = eventId;
|
||||
|
||||
|
@ -33,12 +22,6 @@ R3.API.CustomCode = function(
|
|||
code = "return null;\n//@ sourceURL=" + this.name + ".js";
|
||||
}
|
||||
this.code = code;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.CUSTOM_CODE,
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
R3.API.CustomCode.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,53 +1,21 @@
|
|||
/**
|
||||
* API DomElement
|
||||
* @param id
|
||||
* @param name
|
||||
* @param apiComponent
|
||||
* @param domElementId
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.DomElement = function(
|
||||
id,
|
||||
name,
|
||||
domElementId,
|
||||
parent
|
||||
apiComponent,
|
||||
domElementId
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'DOM Element (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(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.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
|
||||
)
|
||||
};
|
||||
|
|
|
@ -1,28 +1,17 @@
|
|||
/**
|
||||
* R3.API.Box3
|
||||
* @constructor
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param start
|
||||
* @param count
|
||||
*/
|
||||
R3.API.DrawRange = function(
|
||||
id,
|
||||
name,
|
||||
parent,
|
||||
apiComponent,
|
||||
start,
|
||||
count
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'DrawRange (' + id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(start)) {
|
||||
start = 0;
|
||||
|
@ -34,11 +23,6 @@ R3.API.DrawRange = function(
|
|||
}
|
||||
this.count = count;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.DRAW_RANGE,
|
||||
parent
|
||||
)
|
||||
};
|
||||
|
||||
R3.API.DrawRange.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,67 +1,21 @@
|
|||
/**
|
||||
* Entity API Object (for storing / loading entities to and from API)
|
||||
* @constructor
|
||||
* @param id
|
||||
* @param name
|
||||
* @param apiComponent
|
||||
* @param entities R3.API.Entity[]
|
||||
* @param defaultEntity
|
||||
* @param parent
|
||||
*/
|
||||
R3.API.EntityManager = function(
|
||||
id,
|
||||
name,
|
||||
entities,
|
||||
defaultEntity,
|
||||
parent
|
||||
apiComponent,
|
||||
entities
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Entity Manager (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(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.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
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,58 +1,22 @@
|
|||
/**
|
||||
* Entity API Object (for storing / loading entities to and from API)
|
||||
* @param id
|
||||
* @param name
|
||||
* @param components R3.Component[]
|
||||
* @param parent R3.Entity
|
||||
* @param apiComponent
|
||||
* @param components R3.API.Component[]
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Entity = function(
|
||||
id,
|
||||
name,
|
||||
components,
|
||||
parent
|
||||
apiComponent,
|
||||
components
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Entity (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(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.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
|
||||
)
|
||||
};
|
||||
|
|
|
@ -1,30 +1,19 @@
|
|||
/**
|
||||
* R3.API.Group
|
||||
* @constructor
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param start
|
||||
* @param count
|
||||
* @param materialIndex
|
||||
*/
|
||||
R3.API.Group = function(
|
||||
id,
|
||||
name,
|
||||
parent,
|
||||
apiComponent,
|
||||
start,
|
||||
count,
|
||||
materialIndex
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Group (' + id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(start)) {
|
||||
start = 0;
|
||||
|
@ -40,12 +29,6 @@ R3.API.Group = function(
|
|||
materialIndex = 0;
|
||||
}
|
||||
this.materialIndex = materialIndex;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.GROUP,
|
||||
parent
|
||||
)
|
||||
};
|
||||
|
||||
R3.API.Group.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,64 +1,21 @@
|
|||
/**
|
||||
* Raw GUI API object - should always correspond with the GUI Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* @param apiComponent
|
||||
* @param domElement
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.GUI = function(
|
||||
id,
|
||||
name,
|
||||
domElement,
|
||||
parent
|
||||
apiComponent,
|
||||
domElement
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'GUI (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(domElement)) {
|
||||
domElement = null;
|
||||
}
|
||||
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.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
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
/**
|
||||
* R3.API.Image
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parent
|
||||
* @param parentTexture
|
||||
* @param apiComponent
|
||||
* @param fileName
|
||||
* @param extension
|
||||
* @param path
|
||||
|
@ -14,10 +11,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.API.Image = function(
|
||||
id,
|
||||
name,
|
||||
parent,
|
||||
parentTexture,
|
||||
apiComponent,
|
||||
fileName,
|
||||
extension,
|
||||
path,
|
||||
|
@ -26,20 +20,8 @@ R3.API.Image = function(
|
|||
width,
|
||||
height
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Image ' + id;
|
||||
}
|
||||
this.name = name;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(parentTexture)) {
|
||||
parentTexture = null;
|
||||
}
|
||||
this.parentTexture = parentTexture;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(fileName)) {
|
||||
fileName = R3.Utils.LowerUnderscore(name);
|
||||
|
@ -89,11 +71,6 @@ R3.API.Image = function(
|
|||
}
|
||||
this.height = height;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.IMAGE,
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
R3.API.Image.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -56,33 +56,6 @@ R3.API.Matrix4 = function ApiMatrix4(
|
|||
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) {
|
||||
this.identity();
|
||||
this.rows[1] = new R3.API.Vector4(0, Math.cos(radians), -1 * Math.sin(radians), 0);
|
||||
|
|
|
@ -1,28 +1,17 @@
|
|||
/**
|
||||
* API Mouse
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parent
|
||||
* R3.API.Mouse
|
||||
* @param apiComponent
|
||||
* @param x
|
||||
* @param y
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Mouse = function(
|
||||
id,
|
||||
name,
|
||||
parent,
|
||||
apiComponent,
|
||||
x,
|
||||
y
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Mouse (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
x = 0;
|
||||
|
@ -34,11 +23,6 @@ R3.API.Mouse = function(
|
|||
}
|
||||
this.y = y;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.MOUSE,
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
R3.API.Mouse.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
/**
|
||||
* R3.API.Plane
|
||||
* @param apiComponent
|
||||
* @param normal
|
||||
* @param constant
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Plane = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
normal,
|
||||
constant,
|
||||
parent
|
||||
constant
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Plane (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(normal)) {
|
||||
normal = new R3.API.Vector3(1,0,0);
|
||||
|
@ -26,28 +23,8 @@ R3.API.Plane = function(
|
|||
}
|
||||
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.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
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* API Project
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param users
|
||||
* @param isPublic
|
||||
* @param entities
|
||||
|
@ -12,9 +10,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.API.Project = function(
|
||||
id,
|
||||
name,
|
||||
parent,
|
||||
apiComponent,
|
||||
users,
|
||||
isPublic,
|
||||
entities,
|
||||
|
@ -22,15 +18,8 @@ R3.API.Project = function(
|
|||
cameras,
|
||||
mode
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Project (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(users)) {
|
||||
throw new Error('Only registered users can create projects');
|
||||
|
@ -71,14 +60,6 @@ R3.API.Project = function(
|
|||
mode = R3.API.Project.APPLICATION_MODE_EDIT;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/**
|
||||
* R3.API.Quaternion.Points
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Quaternion.Points = function() {
|
||||
this.vectors = [];
|
||||
};
|
||||
|
|
|
@ -1,94 +1,19 @@
|
|||
/**
|
||||
* R3.API.Renderer
|
||||
* @param id
|
||||
* @param name
|
||||
* @param rendererType
|
||||
* @param parent
|
||||
* @param canvas
|
||||
* @constructor
|
||||
* @param apiComponent
|
||||
*/
|
||||
R3.API.Renderer = function(
|
||||
id,
|
||||
name,
|
||||
parent,
|
||||
rendererType
|
||||
apiComponent
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(rendererType)) {
|
||||
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
|
||||
);
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
};
|
||||
|
||||
R3.API.Renderer.prototype = Object.create(R3.API.Component.prototype);
|
||||
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_TARGET = 0x2;
|
||||
R3.API.Renderer.MODE_CANVAS_AND_TARGET = 0x3;
|
||||
|
|
|
@ -10,21 +10,13 @@ R3.API.Renderer.D2 = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||
apiRenderer = {
|
||||
rendererType : R3.API.Renderer.RENDERER_TYPE_2D
|
||||
};
|
||||
}
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
|
||||
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_2D;
|
||||
apiRenderer = {};
|
||||
}
|
||||
this.apiRenderer = apiRenderer;
|
||||
|
||||
R3.API.Renderer.call(
|
||||
this,
|
||||
apiRenderer.id,
|
||||
apiRenderer.name,
|
||||
apiRenderer.parent,
|
||||
apiRenderer.rendererType
|
||||
this.apiRenderer
|
||||
);
|
||||
|
||||
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.constructor = R3.API.Renderer.D2;
|
||||
R3.API.Renderer.D2.prototype.constructor = R3.API.Renderer.D2;
|
||||
|
|
|
@ -1,296 +1,29 @@
|
|||
/**
|
||||
* R3.API.Renderer.D3
|
||||
* @param apiRenderer
|
||||
* @param renderMode
|
||||
* @param autoClear
|
||||
* @param autoClearColor
|
||||
* @param autoClearDepth
|
||||
* @param autoClearStencil
|
||||
* @param gammaFactor
|
||||
* @param gammaInput
|
||||
* @param gammaOutput
|
||||
* @param maxMorphTargets
|
||||
* @param maxMorphNormals
|
||||
* @param physicallyCorrectLights
|
||||
* @param shadowMapEnabled
|
||||
* @param shadowMapAutoUpdate
|
||||
* @param shadowMapNeedsUpdate
|
||||
* @param shadowMapType
|
||||
* @param shadowMapRenderReverseSided
|
||||
* @param shadowMapRenderSingleSided
|
||||
* @param sortObjects
|
||||
* @param toneMapping
|
||||
* @param toneMappingExposure
|
||||
* @param toneMappingWhitePoint
|
||||
* @param premultipliedAlpha
|
||||
* @param antialias
|
||||
* @param stencil
|
||||
* @param preserveDrawingBuffer
|
||||
* @param depth
|
||||
* @param logarithmicDepthBuffer
|
||||
* @param localClippingEnabled
|
||||
* @param renderTarget
|
||||
* @param clippingPlanes
|
||||
* @param clearColor
|
||||
* @param viewports
|
||||
* @param alpha
|
||||
* @param opacity
|
||||
* @param composer - only one composer can be active at a time
|
||||
* @param effect - only one effect can be active at a time
|
||||
* @param enableComposer
|
||||
* @param enableEffect
|
||||
* R3.API.Renderer.D3.Canvas.Target
|
||||
* @constructor
|
||||
* @param apiRendererD3Canvas
|
||||
* @param target
|
||||
*/
|
||||
R3.API.Renderer.D3.Canvas.Target = function(
|
||||
apiRenderer,
|
||||
renderMode,
|
||||
autoClear,
|
||||
autoClearColor,
|
||||
autoClearDepth,
|
||||
autoClearStencil,
|
||||
gammaFactor,
|
||||
gammaInput,
|
||||
gammaOutput,
|
||||
maxMorphTargets,
|
||||
maxMorphNormals,
|
||||
physicallyCorrectLights,
|
||||
shadowMapEnabled,
|
||||
shadowMapAutoUpdate,
|
||||
shadowMapNeedsUpdate,
|
||||
shadowMapType,
|
||||
shadowMapRenderReverseSided,
|
||||
shadowMapRenderSingleSided,
|
||||
sortObjects,
|
||||
toneMapping,
|
||||
toneMappingExposure,
|
||||
toneMappingWhitePoint,
|
||||
premultipliedAlpha,
|
||||
antialias,
|
||||
stencil,
|
||||
preserveDrawingBuffer,
|
||||
depth,
|
||||
logarithmicDepthBuffer,
|
||||
localClippingEnabled,
|
||||
renderTarget,
|
||||
clippingPlanes,
|
||||
clearColor,
|
||||
viewports,
|
||||
alpha,
|
||||
opacity
|
||||
apiRendererD3Canvas,
|
||||
target
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||
apiRenderer = {
|
||||
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
|
||||
};
|
||||
if (R3.Utils.UndefinedOrNull(apiRendererD3Canvas)) {
|
||||
apiRendererD3Canvas = {};
|
||||
}
|
||||
this.apiRendererD3Canvas = apiRendererD3Canvas;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
|
||||
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
|
||||
}
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderMode)) {
|
||||
renderMode = R3.API.Renderer.MODE_CANVAS;
|
||||
}
|
||||
this.renderMode = renderMode;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClear)) {
|
||||
autoClear = true;
|
||||
}
|
||||
this.autoClear = autoClear;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
|
||||
autoClearColor = true;
|
||||
}
|
||||
this.autoClearColor = autoClearColor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
|
||||
autoClearDepth = true;
|
||||
}
|
||||
this.autoClearDepth = autoClearDepth;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
|
||||
autoClearStencil = true;
|
||||
}
|
||||
this.autoClearStencil = autoClearStencil;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
|
||||
gammaFactor = 2;
|
||||
}
|
||||
this.gammaFactor = gammaFactor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaInput)) {
|
||||
gammaInput = false;
|
||||
}
|
||||
this.gammaInput = gammaInput;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
|
||||
gammaOutput = false;
|
||||
}
|
||||
this.gammaOutput = gammaOutput;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
|
||||
maxMorphTargets = 8;
|
||||
}
|
||||
this.maxMorphTargets = maxMorphTargets;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
|
||||
maxMorphNormals = 4;
|
||||
}
|
||||
this.maxMorphNormals = maxMorphNormals;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
|
||||
physicallyCorrectLights = false;
|
||||
}
|
||||
this.physicallyCorrectLights = physicallyCorrectLights;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
|
||||
shadowMapEnabled = false;
|
||||
}
|
||||
this.shadowMapEnabled = shadowMapEnabled;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
|
||||
shadowMapAutoUpdate = true;
|
||||
}
|
||||
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
|
||||
shadowMapNeedsUpdate = false;
|
||||
}
|
||||
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
|
||||
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
|
||||
}
|
||||
this.shadowMapType = shadowMapType;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
|
||||
shadowMapRenderReverseSided = true;
|
||||
}
|
||||
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
|
||||
shadowMapRenderSingleSided = true;
|
||||
}
|
||||
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(sortObjects)) {
|
||||
sortObjects = true;
|
||||
}
|
||||
this.sortObjects = sortObjects;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMapping)) {
|
||||
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
|
||||
}
|
||||
this.toneMapping = toneMapping;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
|
||||
toneMappingExposure = 1;
|
||||
}
|
||||
this.toneMappingExposure = toneMappingExposure;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
|
||||
toneMappingWhitePoint = 1;
|
||||
}
|
||||
this.toneMappingWhitePoint = toneMappingWhitePoint;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
|
||||
premultipliedAlpha = true;
|
||||
}
|
||||
this.premultipliedAlpha = premultipliedAlpha;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(antialias)) {
|
||||
antialias = false;
|
||||
}
|
||||
this.antialias = antialias;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(stencil)) {
|
||||
stencil = true;
|
||||
}
|
||||
this.stencil = stencil;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
|
||||
preserveDrawingBuffer = false;
|
||||
}
|
||||
this.preserveDrawingBuffer = preserveDrawingBuffer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(depth)) {
|
||||
depth = true;
|
||||
}
|
||||
this.depth = depth;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
|
||||
logarithmicDepthBuffer = false;
|
||||
}
|
||||
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
|
||||
localClippingEnabled = false;
|
||||
}
|
||||
this.localClippingEnabled = localClippingEnabled;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||
renderTarget = null;
|
||||
}
|
||||
this.renderTarget = renderTarget;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
|
||||
clippingPlanes = [];
|
||||
}
|
||||
this.clippingPlanes = clippingPlanes;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(clearColor)) {
|
||||
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
|
||||
}
|
||||
this.clearColor = clearColor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(viewports)) {
|
||||
viewports = [new R3.D3.API.Viewport()];
|
||||
}
|
||||
this.viewports = viewports;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(alpha)) {
|
||||
alpha = true;
|
||||
}
|
||||
this.alpha = alpha;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(opacity)) {
|
||||
opacity = 1;
|
||||
}
|
||||
this.opacity = opacity;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(composer)) {
|
||||
composer = new R3.API.Composer();
|
||||
composer.renderer = this.id;
|
||||
}
|
||||
this.composer = composer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(effect)) {
|
||||
effect = new R3.API.Effect();
|
||||
effect.renderer = this.id;
|
||||
}
|
||||
this.effect = effect;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enableComposer)) {
|
||||
enableComposer = false;
|
||||
}
|
||||
this.enableComposer = enableComposer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enableEffect)) {
|
||||
enableEffect = false;
|
||||
}
|
||||
this.enableEffect = enableEffect;
|
||||
|
||||
R3.API.Renderer.call(
|
||||
R3.API.Renderer.D3.Canvas.call(
|
||||
this,
|
||||
apiRenderer.id,
|
||||
apiRenderer.name,
|
||||
apiRenderer.parent,
|
||||
apiRenderer.rendererType,
|
||||
apiRenderer.canvas
|
||||
this.apiRendererD3Canvas,
|
||||
this.apiRendererD3Canvas.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.prototype.constructor = R3.API.Renderer.D3;
|
||||
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.Canvas.Target;
|
||||
|
|
|
@ -1,274 +1,63 @@
|
|||
/**
|
||||
* R3.API.Renderer.D3
|
||||
* @param apiRenderer
|
||||
* @param renderMode
|
||||
* @param autoClear
|
||||
* @param autoClearColor
|
||||
* @param autoClearDepth
|
||||
* @param autoClearStencil
|
||||
* @param gammaFactor
|
||||
* @param gammaInput
|
||||
* @param gammaOutput
|
||||
* @param maxMorphTargets
|
||||
* @param maxMorphNormals
|
||||
* @param physicallyCorrectLights
|
||||
* @param shadowMapEnabled
|
||||
* @param shadowMapAutoUpdate
|
||||
* @param shadowMapNeedsUpdate
|
||||
* @param shadowMapType
|
||||
* @param shadowMapRenderReverseSided
|
||||
* @param shadowMapRenderSingleSided
|
||||
* @param sortObjects
|
||||
* @param toneMapping
|
||||
* @param toneMappingExposure
|
||||
* @param toneMappingWhitePoint
|
||||
* @param premultipliedAlpha
|
||||
* @param antialias
|
||||
* @param stencil
|
||||
* @param preserveDrawingBuffer
|
||||
* @param depth
|
||||
* @param logarithmicDepthBuffer
|
||||
* @param localClippingEnabled
|
||||
* @param renderTarget
|
||||
* @param clippingPlanes
|
||||
* @param clearColor
|
||||
* @param viewports
|
||||
* @param alpha
|
||||
* @param opacity
|
||||
* @param composer - only one composer can be active at a time
|
||||
* @param effect - only one effect can be active at a time
|
||||
* @param enableComposer
|
||||
* @param enableEffect
|
||||
* R3.API.Renderer.D3.Canvas
|
||||
* @param apiRendererD3
|
||||
* @param canvas
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Renderer.D3.Canvas = function(
|
||||
apiRenderer,
|
||||
renderMode,
|
||||
autoClear,
|
||||
autoClearColor,
|
||||
autoClearDepth,
|
||||
autoClearStencil,
|
||||
gammaFactor,
|
||||
gammaInput,
|
||||
gammaOutput,
|
||||
maxMorphTargets,
|
||||
maxMorphNormals,
|
||||
physicallyCorrectLights,
|
||||
shadowMapEnabled,
|
||||
shadowMapAutoUpdate,
|
||||
shadowMapNeedsUpdate,
|
||||
shadowMapType,
|
||||
shadowMapRenderReverseSided,
|
||||
shadowMapRenderSingleSided,
|
||||
sortObjects,
|
||||
toneMapping,
|
||||
toneMappingExposure,
|
||||
toneMappingWhitePoint,
|
||||
premultipliedAlpha,
|
||||
antialias,
|
||||
stencil,
|
||||
preserveDrawingBuffer,
|
||||
depth,
|
||||
logarithmicDepthBuffer,
|
||||
localClippingEnabled,
|
||||
renderTarget,
|
||||
clippingPlanes,
|
||||
clearColor,
|
||||
viewports,
|
||||
alpha,
|
||||
opacity
|
||||
apiRendererD3,
|
||||
canvas
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||
apiRenderer = {
|
||||
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
|
||||
};
|
||||
if (R3.Utils.UndefinedOrNull(apiRendererD3)) {
|
||||
apiRendererD3 = {};
|
||||
}
|
||||
this.apiRendererD3 = apiRendererD3;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
|
||||
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
|
||||
}
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderMode)) {
|
||||
renderMode = R3.API.Renderer.MODE_CANVAS;
|
||||
}
|
||||
this.renderMode = renderMode;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClear)) {
|
||||
autoClear = true;
|
||||
}
|
||||
this.autoClear = autoClear;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
|
||||
autoClearColor = true;
|
||||
}
|
||||
this.autoClearColor = autoClearColor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
|
||||
autoClearDepth = true;
|
||||
}
|
||||
this.autoClearDepth = autoClearDepth;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
|
||||
autoClearStencil = true;
|
||||
}
|
||||
this.autoClearStencil = autoClearStencil;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
|
||||
gammaFactor = 2;
|
||||
}
|
||||
this.gammaFactor = gammaFactor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaInput)) {
|
||||
gammaInput = false;
|
||||
}
|
||||
this.gammaInput = gammaInput;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
|
||||
gammaOutput = false;
|
||||
}
|
||||
this.gammaOutput = gammaOutput;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
|
||||
maxMorphTargets = 8;
|
||||
}
|
||||
this.maxMorphTargets = maxMorphTargets;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
|
||||
maxMorphNormals = 4;
|
||||
}
|
||||
this.maxMorphNormals = maxMorphNormals;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
|
||||
physicallyCorrectLights = false;
|
||||
}
|
||||
this.physicallyCorrectLights = physicallyCorrectLights;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
|
||||
shadowMapEnabled = false;
|
||||
}
|
||||
this.shadowMapEnabled = shadowMapEnabled;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
|
||||
shadowMapAutoUpdate = true;
|
||||
}
|
||||
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
|
||||
shadowMapNeedsUpdate = false;
|
||||
}
|
||||
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
|
||||
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
|
||||
}
|
||||
this.shadowMapType = shadowMapType;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
|
||||
shadowMapRenderReverseSided = true;
|
||||
}
|
||||
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
|
||||
shadowMapRenderSingleSided = true;
|
||||
}
|
||||
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(sortObjects)) {
|
||||
sortObjects = true;
|
||||
}
|
||||
this.sortObjects = sortObjects;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMapping)) {
|
||||
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
|
||||
}
|
||||
this.toneMapping = toneMapping;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
|
||||
toneMappingExposure = 1;
|
||||
}
|
||||
this.toneMappingExposure = toneMappingExposure;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
|
||||
toneMappingWhitePoint = 1;
|
||||
}
|
||||
this.toneMappingWhitePoint = toneMappingWhitePoint;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
|
||||
premultipliedAlpha = true;
|
||||
}
|
||||
this.premultipliedAlpha = premultipliedAlpha;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(antialias)) {
|
||||
antialias = false;
|
||||
}
|
||||
this.antialias = antialias;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(stencil)) {
|
||||
stencil = true;
|
||||
}
|
||||
this.stencil = stencil;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
|
||||
preserveDrawingBuffer = false;
|
||||
}
|
||||
this.preserveDrawingBuffer = preserveDrawingBuffer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(depth)) {
|
||||
depth = true;
|
||||
}
|
||||
this.depth = depth;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
|
||||
logarithmicDepthBuffer = false;
|
||||
}
|
||||
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
|
||||
localClippingEnabled = false;
|
||||
}
|
||||
this.localClippingEnabled = localClippingEnabled;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||
renderTarget = null;
|
||||
}
|
||||
this.renderTarget = renderTarget;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
|
||||
clippingPlanes = [];
|
||||
}
|
||||
this.clippingPlanes = clippingPlanes;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(clearColor)) {
|
||||
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
|
||||
}
|
||||
this.clearColor = clearColor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(viewports)) {
|
||||
viewports = [new R3.D3.API.Viewport()];
|
||||
}
|
||||
this.viewports = viewports;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(alpha)) {
|
||||
alpha = true;
|
||||
}
|
||||
this.alpha = alpha;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(opacity)) {
|
||||
opacity = 1;
|
||||
}
|
||||
this.opacity = opacity;
|
||||
|
||||
R3.API.Renderer.call(
|
||||
R3.API.Renderer.D3.call(
|
||||
this,
|
||||
apiRenderer.id,
|
||||
apiRenderer.name,
|
||||
apiRenderer.parent,
|
||||
apiRenderer.rendererType,
|
||||
apiRenderer.canvas
|
||||
this.apiRendererD3,
|
||||
this.apiRendererD3.renderMode,
|
||||
this.apiRendererD3.autoClear,
|
||||
this.apiRendererD3.autoClearColor,
|
||||
this.apiRendererD3.autoClearDepth,
|
||||
this.apiRendererD3.autoClearStencil,
|
||||
this.apiRendererD3.gammaFactor,
|
||||
this.apiRendererD3.gammaInput,
|
||||
this.apiRendererD3.gammaOutput,
|
||||
this.apiRendererD3.maxMorphTargets,
|
||||
this.apiRendererD3.maxMorphNormals,
|
||||
this.apiRendererD3.physicallyCorrectLights,
|
||||
this.apiRendererD3.shadowMapEnabled,
|
||||
this.apiRendererD3.shadowMapAutoUpdate,
|
||||
this.apiRendererD3.shadowMapNeedsUpdate,
|
||||
this.apiRendererD3.shadowMapType,
|
||||
this.apiRendererD3.shadowMapRenderReverseSided,
|
||||
this.apiRendererD3.shadowMapRenderSingleSided,
|
||||
this.apiRendererD3.sortObjects,
|
||||
this.apiRendererD3.toneMapping,
|
||||
this.apiRendererD3.toneMappingExposure,
|
||||
this.apiRendererD3.toneMappingWhitePoint,
|
||||
this.apiRendererD3.premultipliedAlpha,
|
||||
this.apiRendererD3.antialias,
|
||||
this.apiRendererD3.stencil,
|
||||
this.apiRendererD3.preserveDrawingBuffer,
|
||||
this.apiRendererD3.depth,
|
||||
this.apiRendererD3.logarithmicDepthBuffer,
|
||||
this.apiRendererD3.localClippingEnabled,
|
||||
this.apiRendererD3.clippingPlanes,
|
||||
this.apiRendererD3.clearColor,
|
||||
this.apiRendererD3.viewports,
|
||||
this.apiRendererD3.alpha,
|
||||
this.apiRendererD3.opacity
|
||||
);
|
||||
|
||||
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.prototype.constructor = R3.API.Renderer.D3;
|
||||
R3.API.Renderer.D3.Canvas.prototype = Object.create(R3.API.Renderer.D3.prototype);
|
||||
R3.API.Renderer.D3.Canvas.prototype.constructor = R3.API.Renderer.D3.Canvas;
|
|
@ -1,296 +1,63 @@
|
|||
/**
|
||||
* R3.API.Renderer.D3
|
||||
* @param apiRenderer
|
||||
* @param renderMode
|
||||
* @param autoClear
|
||||
* @param autoClearColor
|
||||
* @param autoClearDepth
|
||||
* @param autoClearStencil
|
||||
* @param gammaFactor
|
||||
* @param gammaInput
|
||||
* @param gammaOutput
|
||||
* @param maxMorphTargets
|
||||
* @param maxMorphNormals
|
||||
* @param physicallyCorrectLights
|
||||
* @param shadowMapEnabled
|
||||
* @param shadowMapAutoUpdate
|
||||
* @param shadowMapNeedsUpdate
|
||||
* @param shadowMapType
|
||||
* @param shadowMapRenderReverseSided
|
||||
* @param shadowMapRenderSingleSided
|
||||
* @param sortObjects
|
||||
* @param toneMapping
|
||||
* @param toneMappingExposure
|
||||
* @param toneMappingWhitePoint
|
||||
* @param premultipliedAlpha
|
||||
* @param antialias
|
||||
* @param stencil
|
||||
* @param preserveDrawingBuffer
|
||||
* @param depth
|
||||
* @param logarithmicDepthBuffer
|
||||
* @param localClippingEnabled
|
||||
* @param renderTarget
|
||||
* @param clippingPlanes
|
||||
* @param clearColor
|
||||
* @param viewports
|
||||
* @param alpha
|
||||
* @param opacity
|
||||
* @param composer - only one composer can be active at a time
|
||||
* @param effect - only one effect can be active at a time
|
||||
* @param enableComposer
|
||||
* @param enableEffect
|
||||
* R3.API.Renderer.D3.Target
|
||||
* @constructor
|
||||
* @param apiRendererD3
|
||||
* @param target
|
||||
*/
|
||||
R3.API.Renderer.D3.Target = function(
|
||||
apiRenderer,
|
||||
renderMode,
|
||||
autoClear,
|
||||
autoClearColor,
|
||||
autoClearDepth,
|
||||
autoClearStencil,
|
||||
gammaFactor,
|
||||
gammaInput,
|
||||
gammaOutput,
|
||||
maxMorphTargets,
|
||||
maxMorphNormals,
|
||||
physicallyCorrectLights,
|
||||
shadowMapEnabled,
|
||||
shadowMapAutoUpdate,
|
||||
shadowMapNeedsUpdate,
|
||||
shadowMapType,
|
||||
shadowMapRenderReverseSided,
|
||||
shadowMapRenderSingleSided,
|
||||
sortObjects,
|
||||
toneMapping,
|
||||
toneMappingExposure,
|
||||
toneMappingWhitePoint,
|
||||
premultipliedAlpha,
|
||||
antialias,
|
||||
stencil,
|
||||
preserveDrawingBuffer,
|
||||
depth,
|
||||
logarithmicDepthBuffer,
|
||||
localClippingEnabled,
|
||||
renderTarget,
|
||||
clippingPlanes,
|
||||
clearColor,
|
||||
viewports,
|
||||
alpha,
|
||||
opacity
|
||||
apiRendererD3,
|
||||
target
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||
apiRenderer = {
|
||||
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
|
||||
};
|
||||
if (R3.Utils.UndefinedOrNull(apiRendererD3)) {
|
||||
apiRendererD3 = {};
|
||||
}
|
||||
this.apiRendererD3 = apiRendererD3;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
|
||||
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
|
||||
}
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderMode)) {
|
||||
renderMode = R3.API.Renderer.MODE_CANVAS;
|
||||
}
|
||||
this.renderMode = renderMode;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClear)) {
|
||||
autoClear = true;
|
||||
}
|
||||
this.autoClear = autoClear;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearColor)) {
|
||||
autoClearColor = true;
|
||||
}
|
||||
this.autoClearColor = autoClearColor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearDepth)) {
|
||||
autoClearDepth = true;
|
||||
}
|
||||
this.autoClearDepth = autoClearDepth;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoClearStencil)) {
|
||||
autoClearStencil = true;
|
||||
}
|
||||
this.autoClearStencil = autoClearStencil;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaFactor)) {
|
||||
gammaFactor = 2;
|
||||
}
|
||||
this.gammaFactor = gammaFactor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaInput)) {
|
||||
gammaInput = false;
|
||||
}
|
||||
this.gammaInput = gammaInput;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(gammaOutput)) {
|
||||
gammaOutput = false;
|
||||
}
|
||||
this.gammaOutput = gammaOutput;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(maxMorphTargets)) {
|
||||
maxMorphTargets = 8;
|
||||
}
|
||||
this.maxMorphTargets = maxMorphTargets;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(maxMorphNormals)) {
|
||||
maxMorphNormals = 4;
|
||||
}
|
||||
this.maxMorphNormals = maxMorphNormals;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(physicallyCorrectLights)) {
|
||||
physicallyCorrectLights = false;
|
||||
}
|
||||
this.physicallyCorrectLights = physicallyCorrectLights;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapEnabled)) {
|
||||
shadowMapEnabled = false;
|
||||
}
|
||||
this.shadowMapEnabled = shadowMapEnabled;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapAutoUpdate)) {
|
||||
shadowMapAutoUpdate = true;
|
||||
}
|
||||
this.shadowMapAutoUpdate = shadowMapAutoUpdate;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapNeedsUpdate)) {
|
||||
shadowMapNeedsUpdate = false;
|
||||
}
|
||||
this.shadowMapNeedsUpdate = shadowMapNeedsUpdate;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapType)) {
|
||||
shadowMapType = R3.API.Renderer.SHADOW_MAP_TYPE_BASIC;
|
||||
}
|
||||
this.shadowMapType = shadowMapType;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapRenderReverseSided)) {
|
||||
shadowMapRenderReverseSided = true;
|
||||
}
|
||||
this.shadowMapRenderReverseSided = shadowMapRenderReverseSided;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shadowMapRenderSingleSided)) {
|
||||
shadowMapRenderSingleSided = true;
|
||||
}
|
||||
this.shadowMapRenderSingleSided = shadowMapRenderSingleSided;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(sortObjects)) {
|
||||
sortObjects = true;
|
||||
}
|
||||
this.sortObjects = sortObjects;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMapping)) {
|
||||
toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
|
||||
}
|
||||
this.toneMapping = toneMapping;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMappingExposure)) {
|
||||
toneMappingExposure = 1;
|
||||
}
|
||||
this.toneMappingExposure = toneMappingExposure;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(toneMappingWhitePoint)) {
|
||||
toneMappingWhitePoint = 1;
|
||||
}
|
||||
this.toneMappingWhitePoint = toneMappingWhitePoint;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(premultipliedAlpha)) {
|
||||
premultipliedAlpha = true;
|
||||
}
|
||||
this.premultipliedAlpha = premultipliedAlpha;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(antialias)) {
|
||||
antialias = false;
|
||||
}
|
||||
this.antialias = antialias;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(stencil)) {
|
||||
stencil = true;
|
||||
}
|
||||
this.stencil = stencil;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(preserveDrawingBuffer)) {
|
||||
preserveDrawingBuffer = false;
|
||||
}
|
||||
this.preserveDrawingBuffer = preserveDrawingBuffer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(depth)) {
|
||||
depth = true;
|
||||
}
|
||||
this.depth = depth;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(logarithmicDepthBuffer)) {
|
||||
logarithmicDepthBuffer = false;
|
||||
}
|
||||
this.logarithmicDepthBuffer = logarithmicDepthBuffer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(localClippingEnabled)) {
|
||||
localClippingEnabled = false;
|
||||
}
|
||||
this.localClippingEnabled = localClippingEnabled;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||
renderTarget = null;
|
||||
}
|
||||
this.renderTarget = renderTarget;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
|
||||
clippingPlanes = [];
|
||||
}
|
||||
this.clippingPlanes = clippingPlanes;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(clearColor)) {
|
||||
clearColor = new R3.API.Color(this, 0.11, 0.11, 0.11);
|
||||
}
|
||||
this.clearColor = clearColor;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(viewports)) {
|
||||
viewports = [new R3.D3.API.Viewport()];
|
||||
}
|
||||
this.viewports = viewports;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(alpha)) {
|
||||
alpha = true;
|
||||
}
|
||||
this.alpha = alpha;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(opacity)) {
|
||||
opacity = 1;
|
||||
}
|
||||
this.opacity = opacity;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(composer)) {
|
||||
composer = new R3.API.Composer();
|
||||
composer.renderer = this.id;
|
||||
}
|
||||
this.composer = composer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(effect)) {
|
||||
effect = new R3.API.Effect();
|
||||
effect.renderer = this.id;
|
||||
}
|
||||
this.effect = effect;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enableComposer)) {
|
||||
enableComposer = false;
|
||||
}
|
||||
this.enableComposer = enableComposer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(enableEffect)) {
|
||||
enableEffect = false;
|
||||
}
|
||||
this.enableEffect = enableEffect;
|
||||
|
||||
R3.API.Renderer.call(
|
||||
R3.API.Renderer.D3.call(
|
||||
this,
|
||||
apiRenderer.id,
|
||||
apiRenderer.name,
|
||||
apiRenderer.parent,
|
||||
apiRenderer.rendererType,
|
||||
apiRenderer.canvas
|
||||
this.apiRendererD3,
|
||||
this.apiRendererD3.renderMode,
|
||||
this.apiRendererD3.autoClear,
|
||||
this.apiRendererD3.autoClearColor,
|
||||
this.apiRendererD3.autoClearDepth,
|
||||
this.apiRendererD3.autoClearStencil,
|
||||
this.apiRendererD3.gammaFactor,
|
||||
this.apiRendererD3.gammaInput,
|
||||
this.apiRendererD3.gammaOutput,
|
||||
this.apiRendererD3.maxMorphTargets,
|
||||
this.apiRendererD3.maxMorphNormals,
|
||||
this.apiRendererD3.physicallyCorrectLights,
|
||||
this.apiRendererD3.shadowMapEnabled,
|
||||
this.apiRendererD3.shadowMapAutoUpdate,
|
||||
this.apiRendererD3.shadowMapNeedsUpdate,
|
||||
this.apiRendererD3.shadowMapType,
|
||||
this.apiRendererD3.shadowMapRenderReverseSided,
|
||||
this.apiRendererD3.shadowMapRenderSingleSided,
|
||||
this.apiRendererD3.sortObjects,
|
||||
this.apiRendererD3.toneMapping,
|
||||
this.apiRendererD3.toneMappingExposure,
|
||||
this.apiRendererD3.toneMappingWhitePoint,
|
||||
this.apiRendererD3.premultipliedAlpha,
|
||||
this.apiRendererD3.antialias,
|
||||
this.apiRendererD3.stencil,
|
||||
this.apiRendererD3.preserveDrawingBuffer,
|
||||
this.apiRendererD3.depth,
|
||||
this.apiRendererD3.logarithmicDepthBuffer,
|
||||
this.apiRendererD3.localClippingEnabled,
|
||||
this.apiRendererD3.clippingPlanes,
|
||||
this.apiRendererD3.clearColor,
|
||||
this.apiRendererD3.viewports,
|
||||
this.apiRendererD3.alpha,
|
||||
this.apiRendererD3.opacity
|
||||
);
|
||||
|
||||
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.prototype.constructor = R3.API.Renderer.D3;
|
||||
R3.API.Renderer.D3.Target.prototype = Object.create(R3.API.Renderer.D3.prototype);
|
||||
R3.API.Renderer.D3.Target.prototype.constructor = R3.API.Renderer.D3.Target;
|
||||
|
|
|
@ -29,16 +29,11 @@
|
|||
* @param depth
|
||||
* @param logarithmicDepthBuffer
|
||||
* @param localClippingEnabled
|
||||
* @param renderTarget
|
||||
* @param clippingPlanes
|
||||
* @param clearColor
|
||||
* @param viewports
|
||||
* @param alpha
|
||||
* @param opacity
|
||||
* @param composer - only one composer can be active at a time
|
||||
* @param effect - only one effect can be active at a time
|
||||
* @param enableComposer
|
||||
* @param enableEffect
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Renderer.D3 = function(
|
||||
|
@ -71,7 +66,6 @@ R3.API.Renderer.D3 = function(
|
|||
depth,
|
||||
logarithmicDepthBuffer,
|
||||
localClippingEnabled,
|
||||
renderTarget,
|
||||
clippingPlanes,
|
||||
clearColor,
|
||||
viewports,
|
||||
|
@ -80,14 +74,14 @@ R3.API.Renderer.D3 = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||
apiRenderer = {
|
||||
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
|
||||
};
|
||||
apiRenderer = {};
|
||||
}
|
||||
this.apiRenderer = apiRenderer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiRenderer.rendererType)) {
|
||||
apiRenderer.rendererType = R3.API.Renderer.RENDERER_TYPE_3D;
|
||||
}
|
||||
R3.API.Renderer.call(
|
||||
this,
|
||||
this.apiRenderer
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderMode)) {
|
||||
renderMode = R3.API.Renderer.MODE_CANVAS;
|
||||
|
@ -229,11 +223,6 @@ R3.API.Renderer.D3 = function(
|
|||
}
|
||||
this.localClippingEnabled = localClippingEnabled;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||
renderTarget = null;
|
||||
}
|
||||
this.renderTarget = renderTarget;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(clippingPlanes)) {
|
||||
clippingPlanes = [];
|
||||
}
|
||||
|
@ -259,37 +248,6 @@ R3.API.Renderer.D3 = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* R3.API.Server
|
||||
* @param id
|
||||
* @param name
|
||||
* @param apiComponent
|
||||
* @param protocol
|
||||
* @param context
|
||||
* @param application
|
||||
|
@ -10,12 +9,10 @@
|
|||
* @param preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime
|
||||
* @param port
|
||||
* @param protocols
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Server = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
protocol,
|
||||
context,
|
||||
application,
|
||||
|
@ -23,19 +20,10 @@ R3.API.Server = function(
|
|||
ip,
|
||||
preferIp,
|
||||
port,
|
||||
protocols,
|
||||
parent
|
||||
protocols
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Server (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(protocol)) {
|
||||
protocol = R3.API.Server.PROTOCOL_HTTP_SSL;
|
||||
|
@ -76,12 +64,6 @@ R3.API.Server = function(
|
|||
protocols = [];
|
||||
}
|
||||
this.protocols = protocols;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.SERVER,
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
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.PORT_INSECURE = 80;
|
||||
R3.API.Server.PORT_SECURE = 443;
|
||||
R3.API.Server.PORT_SECURE = 443;
|
||||
|
|
|
@ -1,51 +1,19 @@
|
|||
/**
|
||||
* R3.API.Socket
|
||||
* @param id
|
||||
* @param name
|
||||
* @param socketType
|
||||
* @param apiComponent
|
||||
* @param roomId
|
||||
* @param peerId
|
||||
* @param server R3.Server
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Socket = function(
|
||||
id,
|
||||
name,
|
||||
socketType,
|
||||
apiComponent,
|
||||
roomId,
|
||||
peerId,
|
||||
server,
|
||||
parent
|
||||
server
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
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;
|
||||
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(roomId)) {
|
||||
roomId = 'room_' + R3.Utils.RandomId();
|
||||
|
@ -84,33 +52,7 @@ R3.API.Socket = function(
|
|||
}
|
||||
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.constructor = R3.API.Socket;
|
||||
|
||||
R3.API.Socket.SOCKET_TYPE_CAST = 0x1;
|
||||
R3.API.Socket.SOCKET_TYPE_RECEIVE = 0x2;
|
||||
|
|
|
@ -14,14 +14,17 @@ R3.API.Socket.Cast = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiSocket)) {
|
||||
apiSocket = {
|
||||
socketType : R3.API.Socket.SOCKET_TYPE_CAST
|
||||
};
|
||||
apiSocket = {}
|
||||
}
|
||||
this.apiSocket = apiSocket;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiSocket.socketType)) {
|
||||
apiSocket.socketType = R3.API.Socket.SOCKET_TYPE_CAST;
|
||||
}
|
||||
R3.API.Socket.call(
|
||||
this,
|
||||
this.apiSocket,
|
||||
this.apiSocket.roomId,
|
||||
this.apiSocket.peerId,
|
||||
this.apiSocket.server
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(castType)) {
|
||||
castType = R3.API.Socket.Cast.CAST_TYPE_ROOM;
|
||||
|
@ -38,16 +41,6 @@ R3.API.Socket.Cast = function(
|
|||
}
|
||||
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);
|
||||
|
@ -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_PEER = 0x2;
|
||||
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;
|
||||
|
|
|
@ -14,14 +14,17 @@ R3.API.Socket.Receive = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiSocket)) {
|
||||
apiSocket = {
|
||||
socketType : R3.API.Socket.SOCKET_TYPE_RECEIVE
|
||||
};
|
||||
apiSocket = {}
|
||||
}
|
||||
this.apiSocket = apiSocket;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiSocket.socketType)) {
|
||||
apiSocket.socketType = R3.API.Socket.SOCKET_TYPE_RECEIVE;
|
||||
}
|
||||
R3.API.Socket.call(
|
||||
this,
|
||||
this.apiSocket,
|
||||
this.apiSocket.roomId,
|
||||
this.apiSocket.peerId,
|
||||
this.apiSocket.server
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(receiveType)) {
|
||||
receiveType = R3.API.Socket.Receive.RECEIVE_TYPE_ROOM;
|
||||
|
@ -38,16 +41,6 @@ R3.API.Socket.Receive = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
/**
|
||||
* R3.API.Sphere
|
||||
* @constructor
|
||||
* @param apiComponent
|
||||
* @param center
|
||||
* @param radius
|
||||
*/
|
||||
R3.API.Sphere = function(
|
||||
apiComponent,
|
||||
center,
|
||||
radius
|
||||
) {
|
||||
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(center)) {
|
||||
center = new R3.API.Vector3(0,0,0);
|
||||
}
|
||||
|
@ -18,3 +23,6 @@ R3.API.Sphere = function(
|
|||
}
|
||||
this.radius = radius;
|
||||
};
|
||||
|
||||
R3.API.Sphere.prototype = Object.create(R3.API.Sphere.prototype);
|
||||
R3.API.Sphere.prototype.constructor = R3.API.Sphere;
|
||||
|
|
|
@ -1,64 +1,22 @@
|
|||
/**
|
||||
* Raw Stats API object - should always correspond with the Stats Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* @param apiComponent
|
||||
* @param domElement
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Stats = function(
|
||||
id,
|
||||
name,
|
||||
domElement,
|
||||
parent
|
||||
apiComponent,
|
||||
domElement
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Stats (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(domElement)) {
|
||||
domElement = null;
|
||||
}
|
||||
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.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
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* API User
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param googleId
|
||||
* @param fullName
|
||||
* @param givenName
|
||||
|
@ -14,9 +12,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.API.User = function(
|
||||
id,
|
||||
name,
|
||||
parent,
|
||||
apiComponent,
|
||||
googleId,
|
||||
fullName,
|
||||
givenName,
|
||||
|
@ -26,15 +22,8 @@ R3.API.User = function(
|
|||
uploadFolder,
|
||||
idToken
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'User (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(googleId)) {
|
||||
throw new Error('invalid user - no google ID');
|
||||
|
@ -75,12 +64,7 @@ R3.API.User = function(
|
|||
idToken = 'unknown ID token';
|
||||
}
|
||||
this.idToken = idToken;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.USER,
|
||||
parent
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
R3.API.User.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/**
|
||||
* R3.API.Video
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param autoUpdateSize
|
||||
* @param width
|
||||
* @param height
|
||||
|
@ -11,24 +9,15 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.API.Video = function(
|
||||
id,
|
||||
name,
|
||||
parent,
|
||||
apiComponent,
|
||||
autoUpdateSize,
|
||||
width,
|
||||
height,
|
||||
offset,
|
||||
source
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Video (' + id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
||||
autoUpdateSize = true;
|
||||
|
@ -57,11 +46,6 @@ R3.API.Video = function(
|
|||
}
|
||||
this.source = source;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.VIDEO,
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
R3.API.Video.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,21 +1,29 @@
|
|||
/**
|
||||
* R3.Box3
|
||||
* @param parent
|
||||
* @param apiBox3
|
||||
* @constructor
|
||||
*/
|
||||
R3.Box3 = function(
|
||||
parent,
|
||||
apiBox3
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||
parent = null;
|
||||
}
|
||||
this.parent = parent;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiBox3)) {
|
||||
apiBox3 = {};
|
||||
}
|
||||
this.apiBox3 = apiBox3;
|
||||
|
||||
R3.API.Box3.call(
|
||||
this,
|
||||
apiBox3,
|
||||
apiBox3.min,
|
||||
apiBox3.max
|
||||
this.apiBox3,
|
||||
this.apiBox3.min,
|
||||
this.apiBox3.max
|
||||
);
|
||||
|
||||
this.min = new R3.Vector3(
|
||||
|
@ -39,7 +47,7 @@ R3.Box3 = function(
|
|||
}.bind(this)
|
||||
);
|
||||
|
||||
this.componentRuntime = R3.Component.GetComponentRuntime(parent);
|
||||
this.componentRuntime = R3.Component.GetComponentRuntime(this.parent);
|
||||
|
||||
this.createInstance();
|
||||
};
|
||||
|
|
|
@ -1,42 +1,44 @@
|
|||
/**
|
||||
* Runtime color for updating instance objects
|
||||
* @param graphics R3.GraphicsRuntime
|
||||
* @param parentObject R3.D3.*
|
||||
* @param parent
|
||||
* @param apiColor R3.API.Color
|
||||
* @param grain Number
|
||||
* @constructor
|
||||
*/
|
||||
R3.Color = function(
|
||||
graphics,
|
||||
apiColor,
|
||||
parentObject,
|
||||
grain
|
||||
parent,
|
||||
apiColor
|
||||
) {
|
||||
|
||||
this.graphics = graphics;
|
||||
this.graphics.isNotThreeThrow();
|
||||
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||
parent = null;
|
||||
}
|
||||
this.parent = parent;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiColor)) {
|
||||
apiColor = {};
|
||||
}
|
||||
this.apiColor = apiColor;
|
||||
|
||||
R3.API.Color.call(
|
||||
this,
|
||||
apiColor.r,
|
||||
apiColor.g,
|
||||
apiColor.b,
|
||||
apiColor.a
|
||||
this.apiColor.r,
|
||||
this.apiColor.g,
|
||||
this.apiColor.b,
|
||||
this.apiColor.a
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(parentObject)) {
|
||||
parentObject = null;
|
||||
}
|
||||
this.parentObject = parentObject;
|
||||
this.graphics = null;
|
||||
this.physics = null;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(grain)) {
|
||||
grain = 0.001;
|
||||
}
|
||||
this.grain = grain;
|
||||
R3.Event.Emit(
|
||||
R3.Event.GET_RUNTIME,
|
||||
function(runtime) {
|
||||
this.graphics = runtime.graphics;
|
||||
this.physics = runtime.physics;
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
this.componentRuntime = R3.Component.GetComponentRuntime(parent);
|
||||
|
||||
this.createInstance();
|
||||
};
|
||||
|
@ -49,11 +51,17 @@ R3.Color.prototype.constructor = R3.Color;
|
|||
* @returns {*}
|
||||
*/
|
||||
R3.Color.prototype.createInstance = function() {
|
||||
this.instance = new THREE.Color(
|
||||
this.r,
|
||||
this.g,
|
||||
this.b
|
||||
);
|
||||
|
||||
switch (this.componentRuntime) {
|
||||
case R3.Component.GRAPHICS_RUNTIME :
|
||||
this.instance = this.graphics.Color(
|
||||
this.r,
|
||||
this.g,
|
||||
this.b,
|
||||
this.a
|
||||
);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Object
|
||||
* @param id
|
||||
* @param name
|
||||
* @param objectType
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param useQuaternion
|
||||
* @param position
|
||||
* @param quaternion
|
||||
|
@ -14,10 +11,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Object = function(
|
||||
id,
|
||||
name,
|
||||
objectType,
|
||||
parent,
|
||||
apiComponent,
|
||||
useQuaternion,
|
||||
position,
|
||||
quaternion,
|
||||
|
@ -26,56 +20,8 @@ R3.D3.API.Object = function(
|
|||
up,
|
||||
lookAt
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(objectType)) {
|
||||
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;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(useQuaternion)) {
|
||||
useQuaternion = true;
|
||||
|
@ -111,81 +57,8 @@ R3.D3.API.Object = function(
|
|||
lookAt = new R3.API.Vector3();
|
||||
}
|
||||
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.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;
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* Animation Component
|
||||
* @param id
|
||||
* @param name
|
||||
* R3.D3.API.Animation
|
||||
* @param apiComponent
|
||||
* @param rotationSpeed
|
||||
* @param translationSpeed
|
||||
* @param scaleSpeed
|
||||
|
@ -10,13 +9,10 @@
|
|||
* @param scaleFn
|
||||
* @param blocking
|
||||
* @param applyToMeshWhenDone
|
||||
* @param meshes
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Animation = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
rotationSpeed,
|
||||
translationSpeed,
|
||||
scaleSpeed,
|
||||
|
@ -24,19 +20,10 @@ R3.D3.API.Animation = function(
|
|||
translationFn,
|
||||
scaleFn,
|
||||
blocking,
|
||||
applyToMeshWhenDone,
|
||||
meshes,
|
||||
parent
|
||||
applyToMeshWhenDone
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Animation (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(rotationSpeed)) {
|
||||
rotationSpeed = 0;
|
||||
|
@ -82,40 +69,7 @@ R3.D3.API.Animation = function(
|
|||
}
|
||||
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.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
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,37 +1,25 @@
|
|||
/**
|
||||
* Raw Audio API object - should always correspond with the Audio Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* R3.D3.API.Audio
|
||||
* @param apiComponent
|
||||
* @param path
|
||||
* @param loop
|
||||
* @param volume
|
||||
* @param camera
|
||||
* @param overplay
|
||||
* @param paused
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Audio = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
path,
|
||||
loop,
|
||||
volume,
|
||||
camera,
|
||||
overplay,
|
||||
paused,
|
||||
parent
|
||||
paused
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Audio (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(path)) {
|
||||
path = '';
|
||||
|
@ -63,42 +51,7 @@ R3.D3.API.Audio = function(
|
|||
}
|
||||
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.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
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -12,14 +12,21 @@ R3.D3.API.Bone = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3Object)) {
|
||||
apiD3Object = {
|
||||
objectType : R3.D3.API.Object.OBJECT_TYPE_BONE
|
||||
};
|
||||
apiD3Object = {};
|
||||
}
|
||||
this.apiD3Object = apiD3Object;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3Object.objectType)) {
|
||||
apiD3Object.objectType = R3.D3.API.Object.OBJECT_TYPE_BONE;
|
||||
}
|
||||
R3.D3.API.Object.call(
|
||||
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)) {
|
||||
childBoneIds = [];
|
||||
|
@ -31,20 +38,6 @@ R3.D3.API.Bone = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,54 +1,22 @@
|
|||
/**
|
||||
* Raw Broadphase API object - should always correspond with the Broadphase Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* @param apiComponent
|
||||
* @param broadphaseType
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Broadphase = function(
|
||||
id,
|
||||
name,
|
||||
broadphaseType,
|
||||
parent
|
||||
apiComponent,
|
||||
broadphaseType
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Broadphase (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(broadphaseType)) {
|
||||
broadphaseType = R3.D3.Broadphase.BROADPHASE_TYPE_NAIVE;
|
||||
}
|
||||
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.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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -10,19 +10,9 @@ R3.D3.API.Camera = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3Object)) {
|
||||
apiD3Object = {
|
||||
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA
|
||||
};
|
||||
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;
|
||||
this.apiD3Object = apiD3Object;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3Object.position)) {
|
||||
apiD3Object.position = new R3.API.Vector3(
|
||||
|
@ -34,19 +24,28 @@ R3.D3.API.Camera = function(
|
|||
|
||||
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
|
||||
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(aspect)) {
|
||||
aspect = 1;
|
||||
}
|
||||
this.aspect = aspect;
|
||||
|
||||
};
|
||||
|
||||
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.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;
|
|
@ -1,29 +1,33 @@
|
|||
/**
|
||||
* R3.D3.API.Camera.Cube
|
||||
*
|
||||
* CubeCamera's have hardcoded fov=90 and aspect=1
|
||||
*
|
||||
* @constructor
|
||||
* @param apiD3ObjectCamera
|
||||
* @param apiD3Camera
|
||||
* @param near
|
||||
* @param far
|
||||
* @param cubeResolution
|
||||
* @param renderTarget
|
||||
*/
|
||||
R3.D3.API.Camera.Cube = function(
|
||||
apiD3ObjectCamera,
|
||||
apiD3Camera,
|
||||
near,
|
||||
far,
|
||||
cubeResolution,
|
||||
renderTarget
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera)) {
|
||||
apiD3ObjectCamera = {
|
||||
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE
|
||||
};
|
||||
if (R3.Utils.UndefinedOrNull(apiD3Camera)) {
|
||||
apiD3Camera = {};
|
||||
}
|
||||
this.apiD3Camera = apiD3Camera;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.objectType)) {
|
||||
apiD3ObjectCamera.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE;
|
||||
}
|
||||
R3.D3.API.Camera.call(
|
||||
this,
|
||||
this.apiD3Camera,
|
||||
this.apiD3Camera.aspect
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(near)) {
|
||||
near = 0.1;
|
||||
|
@ -45,14 +49,6 @@ R3.D3.API.Camera.Cube = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -1,98 +1,48 @@
|
|||
/**
|
||||
* R3.D3.API.Camera.Orthographic
|
||||
*
|
||||
* OK - since the introduction of fixed aspect ratio's for our canvases, we only need to know
|
||||
* the aspect ratio and width - then we calculate the left, right, up and down coords -
|
||||
*
|
||||
* 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
|
||||
* Base class for Orthographic Cameras - do define an aspect ratio for the camera, use FixedAspect child class, to
|
||||
* manually set the camera size, use the ZoomedAspect child class
|
||||
*
|
||||
* @constructor
|
||||
* @param apiD3ObjectCamera
|
||||
* @param aspectRatioMode
|
||||
* @param minWidth
|
||||
* @param minHeight
|
||||
* @param width
|
||||
* @param height
|
||||
* @param apiD3Camera
|
||||
* @param near
|
||||
* @param far
|
||||
* @param left
|
||||
* @param right
|
||||
* @param top
|
||||
* @param bottom
|
||||
* @param zoom
|
||||
*/
|
||||
R3.D3.API.Camera.Orthographic = function(
|
||||
apiD3ObjectCamera,
|
||||
aspectRatioMode,
|
||||
minWidth,
|
||||
minHeight,
|
||||
width,
|
||||
height,
|
||||
apiD3Camera,
|
||||
near,
|
||||
far,
|
||||
left,
|
||||
right,
|
||||
top,
|
||||
bottom,
|
||||
zoom
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera)) {
|
||||
apiD3ObjectCamera = {
|
||||
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC
|
||||
};
|
||||
if (R3.Utils.UndefinedOrNull(apiD3Camera)) {
|
||||
apiD3Camera = {};
|
||||
}
|
||||
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)) {
|
||||
apiD3ObjectCamera.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC;
|
||||
if (R3.Utils.UndefinedOrNull(this.apiD3Camera.lookAt)) {
|
||||
this.apiD3Camera.lookAt = new R3.API.Vector3(
|
||||
0,
|
||||
0,
|
||||
-10
|
||||
);
|
||||
}
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.position)) {
|
||||
apiD3ObjectCamera.position = new R3.API.Vector3(0,0,10);
|
||||
}
|
||||
|
||||
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;
|
||||
R3.D3.API.Camera.call(
|
||||
this,
|
||||
this.apiD3Camera,
|
||||
this.apiD3Camera.aspect
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(near)) {
|
||||
near = 0.1;
|
||||
|
@ -104,41 +54,12 @@ R3.D3.API.Camera.Orthographic = function(
|
|||
}
|
||||
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)) {
|
||||
zoom = 1;
|
||||
}
|
||||
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.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;
|
||||
|
|
|
@ -1,40 +1,36 @@
|
|||
/**
|
||||
* R3.D3.API.Camera.Perspective.Stereo
|
||||
* @constructor
|
||||
* @param apiD3ObjectCameraPerspective
|
||||
* @param apiD3CameraPerspective
|
||||
* @param stereoMode
|
||||
*/
|
||||
R3.D3.API.Camera.Perspective.Stereo = function(
|
||||
apiD3ObjectCameraPerspective,
|
||||
apiD3CameraPerspective,
|
||||
stereoMode
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCameraPerspective)) {
|
||||
apiD3ObjectCameraPerspective = {
|
||||
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE_STEREO
|
||||
};
|
||||
if (R3.Utils.UndefinedOrNull(apiD3CameraPerspective)) {
|
||||
apiD3CameraPerspective = {};
|
||||
}
|
||||
this.apiD3CameraPerspective = apiD3CameraPerspective;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCameraPerspective.objectType)) {
|
||||
apiD3ObjectCameraPerspective.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE_STEREO;
|
||||
}
|
||||
R3.D3.API.Camera.Perspective.call(
|
||||
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)) {
|
||||
stereoMode = R3.D3.API.Camera.Perspective.Stereo.STEREO_MODE_STEREO;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* R3.D3.API.Camera.Perspective
|
||||
* @constructor
|
||||
* @param apiD3ObjectCamera
|
||||
* @param apiD3Camera
|
||||
* @param fov
|
||||
* @param near
|
||||
* @param far
|
||||
|
@ -11,7 +11,7 @@
|
|||
* @param zoom
|
||||
*/
|
||||
R3.D3.API.Camera.Perspective = function(
|
||||
apiD3ObjectCamera,
|
||||
apiD3Camera,
|
||||
near,
|
||||
far,
|
||||
fov,
|
||||
|
@ -21,64 +21,53 @@ R3.D3.API.Camera.Perspective = function(
|
|||
zoom
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera)) {
|
||||
apiD3ObjectCamera = {
|
||||
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE
|
||||
};
|
||||
if (R3.Utils.UndefinedOrNull(apiD3Camera)) {
|
||||
apiD3Camera = {};
|
||||
}
|
||||
this.apiD3Camera = apiD3Camera;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.objectType)) {
|
||||
apiD3ObjectCamera.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE;
|
||||
}
|
||||
R3.D3.API.Camera.call(
|
||||
this,
|
||||
this.apiD3Camera,
|
||||
this.apiD3Camera.aspect
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(near)) {
|
||||
// near = new R3.API.Number(0.1, 0.001, 0.001, 2000);
|
||||
near = 0.1;
|
||||
}
|
||||
this.near = near;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(far)) {
|
||||
// far = new R3.API.Number(2000, 1, 1, 4000);
|
||||
far = 2000;
|
||||
}
|
||||
this.far = far;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(fov)) {
|
||||
// fov = new R3.API.Number(50, 1, 0, 180);
|
||||
fov = 50;
|
||||
}
|
||||
this.fov = fov;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(filmGauge)) {
|
||||
// filmGauge = new R3.API.Number(35, 1, 0, 200);
|
||||
filmGauge = 35;
|
||||
}
|
||||
this.filmGauge = filmGauge;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(filmOffset)) {
|
||||
// filmOffset = new R3.API.Number(0, 1, 0, 200);
|
||||
filmOffset = 0;
|
||||
}
|
||||
this.filmOffset = filmOffset;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(focus)) {
|
||||
// focus = new R3.API.Number(10, 0.1, 0, 200);
|
||||
focus = 10;
|
||||
}
|
||||
this.focus = focus;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(zoom)) {
|
||||
// zoom = new R3.API.Number(1, 0.01, 0, 10);
|
||||
zoom = 1;
|
||||
}
|
||||
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.constructor = R3.D3.API.Camera.Perspective;
|
||||
R3.D3.API.Camera.Perspective.prototype.constructor = R3.D3.API.Camera.Perspective;
|
||||
|
|
|
@ -1,42 +1,21 @@
|
|||
/**
|
||||
* R3.D3.API.Composer
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parent
|
||||
* @param apiComponent
|
||||
* @param autoUpdateSize
|
||||
* @param width
|
||||
* @param height
|
||||
* @param renderer
|
||||
* @param renderTarget
|
||||
* @param passes
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Composer = function(
|
||||
parent,
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
autoUpdateSize,
|
||||
width,
|
||||
height,
|
||||
renderer,
|
||||
renderTarget,
|
||||
passes
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||
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;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
|
||||
autoUpdateSize = true;
|
||||
|
@ -53,32 +32,11 @@ R3.D3.API.Composer = function(
|
|||
}
|
||||
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)) {
|
||||
passes = [];
|
||||
}
|
||||
this.passes = passes;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.COMPOSER,
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
R3.D3.API.Composer.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Effect
|
||||
* @param id
|
||||
* @param name
|
||||
* @param effectType
|
||||
* @param parent
|
||||
* @param renderer
|
||||
* @param apiComponent
|
||||
* @param width
|
||||
* @param height
|
||||
*
|
||||
|
@ -13,50 +9,12 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Effect = function(
|
||||
id,
|
||||
name,
|
||||
effectType,
|
||||
parent,
|
||||
renderer,
|
||||
apiComponent,
|
||||
width,
|
||||
height
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
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;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(width)) {
|
||||
width = 512;
|
||||
|
@ -67,34 +25,7 @@ R3.D3.API.Effect = function(
|
|||
height = 512;
|
||||
}
|
||||
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.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;
|
||||
|
|
|
@ -8,27 +8,18 @@ R3.D3.API.Effect.Anaglyph = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(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;
|
||||
apiEffect = {};
|
||||
}
|
||||
this.apiEffect = apiEffect;
|
||||
|
||||
R3.D3.API.Effect.call(
|
||||
this,
|
||||
apiEffect.id,
|
||||
apiEffect.name,
|
||||
apiEffect.effectType,
|
||||
apiEffect.parent,
|
||||
apiEffect.renderer,
|
||||
apiEffect.width,
|
||||
apiEffect.height
|
||||
this.apiEffect,
|
||||
this.apiEffect.width,
|
||||
this.apiEffect.height
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
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;
|
||||
|
|
|
@ -8,24 +8,15 @@ R3.D3.API.Effect.Parallax = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(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;
|
||||
apiEffect = {};
|
||||
}
|
||||
this.apiEffect = apiEffect;
|
||||
|
||||
R3.D3.API.Effect.call(
|
||||
this,
|
||||
apiEffect.id,
|
||||
apiEffect.name,
|
||||
apiEffect.effectType,
|
||||
apiEffect.parent,
|
||||
apiEffect.renderer,
|
||||
apiEffect.width,
|
||||
apiEffect.height
|
||||
this.apiEffect,
|
||||
this.apiEffect.width,
|
||||
this.apiEffect.height
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -10,31 +10,22 @@ R3.D3.API.Effect.Stereo = function(
|
|||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiEffect)) {
|
||||
apiEffect = {
|
||||
effectType : R3.D3.API.Effect.EFFECT_TYPE_STEREO
|
||||
};
|
||||
apiEffect = {};
|
||||
}
|
||||
this.apiEffect = apiEffect;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiEffect.cameraType)) {
|
||||
apiEffect.effectType = R3.D3.API.Effect.EFFECT_TYPE_STEREO;
|
||||
}
|
||||
R3.D3.API.Effect.call(
|
||||
this,
|
||||
this.apiEffect,
|
||||
this.apiEffect.width,
|
||||
this.apiEffect.height
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(eyeSeperation)) {
|
||||
eyeSeperation = 0.064;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* Face
|
||||
* @param id
|
||||
* @param name
|
||||
* R3.D3.API.Face
|
||||
* @param apiComponent
|
||||
* @param v0index
|
||||
* @param v1index
|
||||
* @param v2index
|
||||
|
@ -12,13 +11,10 @@
|
|||
* @param vertexNormals
|
||||
* @param normal
|
||||
* @param selected
|
||||
* @param parentGeometry
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Face = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
v0index,
|
||||
v1index,
|
||||
v2index,
|
||||
|
@ -28,20 +24,10 @@ R3.D3.API.Face = function(
|
|||
vertexColors,
|
||||
vertexNormals,
|
||||
normal,
|
||||
selected,
|
||||
parentGeometry,
|
||||
parent
|
||||
selected
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Face ' + id;
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(v0index)) {
|
||||
v0index = -1;
|
||||
|
@ -69,15 +55,15 @@ R3.D3.API.Face = function(
|
|||
this.uvs = uvs;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(color)) {
|
||||
color = new R3.API.Color(this);
|
||||
color = new R3.API.Color();
|
||||
}
|
||||
this.color = color;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(vertexColors)) {
|
||||
vertexColors = [
|
||||
new R3.API.Color(this),
|
||||
new R3.API.Color(this),
|
||||
new R3.API.Color(this)
|
||||
new R3.API.Color(),
|
||||
new R3.API.Color(),
|
||||
new R3.API.Color()
|
||||
];
|
||||
}
|
||||
this.vertexColors = vertexColors;
|
||||
|
@ -97,16 +83,6 @@ R3.D3.API.Face = function(
|
|||
}
|
||||
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.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
|
||||
* @returns {R3.D3.API.Face}
|
||||
*/
|
||||
R3.D3.API.Face.prototype.clone = function(){
|
||||
return new R3.D3.API.Face(
|
||||
this.id,
|
||||
this.name,
|
||||
null,
|
||||
this.v0index,
|
||||
this.v1index,
|
||||
this.v2index,
|
||||
|
@ -193,7 +107,8 @@ R3.D3.API.Face.prototype.clone = function(){
|
|||
this.color,
|
||||
this.vertexColors,
|
||||
this.vertexNormals,
|
||||
this.normal
|
||||
this.normal,
|
||||
this.selected
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,35 +1,23 @@
|
|||
/**
|
||||
* Raw Fog API object - should always correspond with the Fog Schema
|
||||
* @param id String
|
||||
* @param name String
|
||||
* R3.D3.API.Fog
|
||||
* @param apiComponent
|
||||
* @param exponential
|
||||
* @param color
|
||||
* @param near
|
||||
* @param far
|
||||
* @param density
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Fog = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
exponential,
|
||||
color,
|
||||
near,
|
||||
far,
|
||||
density,
|
||||
parent
|
||||
density
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Fog (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(exponential)) {
|
||||
exponential = false;
|
||||
|
@ -56,11 +44,6 @@ R3.D3.API.Fog = function(
|
|||
}
|
||||
this.density = density;
|
||||
|
||||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.FOG,
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
R3.D3.API.Fog.prototype = Object.create(R3.API.Component.prototype);
|
||||
|
|
|
@ -1,52 +1,22 @@
|
|||
/**
|
||||
* Raw Font API object - should always correspond with the Font Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* @param url
|
||||
* @param parent
|
||||
* R3.D3.API.Font
|
||||
* @param apiComponent
|
||||
* @param path - Relative to API URL
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Font = function(
|
||||
id,
|
||||
name,
|
||||
url,
|
||||
parent
|
||||
apiComponent,
|
||||
path
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Font (' + id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(url)) {
|
||||
url = '/apiRelative/path/to/font';
|
||||
if (R3.Utils.UndefinedOrNull(path)) {
|
||||
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.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
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* Raw FrictionContactMaterial API object - should always correspond with the FrictionContactMaterial Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* R3.D3.API.FrictionContactMaterial
|
||||
* @param apiComponent
|
||||
* @param materials
|
||||
* @param friction
|
||||
* @param restitution
|
||||
|
@ -9,31 +8,20 @@
|
|||
* @param contactEquationRelaxation
|
||||
* @param frictionEquationStiffness
|
||||
* @param frictionEquationRelaxation
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.FrictionContactMaterial = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
materials,
|
||||
friction,
|
||||
restitution,
|
||||
contactEquationStiffness,
|
||||
contactEquationRelaxation,
|
||||
frictionEquationStiffness,
|
||||
frictionEquationRelaxation,
|
||||
parent
|
||||
frictionEquationRelaxation
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Friction Material (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(materials)) {
|
||||
materials = [];
|
||||
|
@ -70,33 +58,7 @@ R3.D3.API.FrictionContactMaterial = function(
|
|||
}
|
||||
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.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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,29 +1,17 @@
|
|||
/**
|
||||
* Raw FrictionMaterial API object - should always correspond with the FrictionMaterial Schema
|
||||
* @param id
|
||||
* @param name
|
||||
* R3.D3.API.FrictionMaterial
|
||||
* @param apiComponent
|
||||
* @param friction
|
||||
* @param restitution
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.FrictionMaterial = function(
|
||||
id,
|
||||
name,
|
||||
apiComponent,
|
||||
friction,
|
||||
restitution,
|
||||
parent
|
||||
restitution
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(name)) {
|
||||
name = 'Friction Material (' + this.id + ')';
|
||||
}
|
||||
this.name = name;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(friction)) {
|
||||
friction = -1;
|
||||
|
@ -35,28 +23,7 @@ R3.D3.API.FrictionMaterial = function(
|
|||
}
|
||||
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.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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry
|
||||
* @param id
|
||||
* @param name
|
||||
* @param geometryType
|
||||
* @param parent
|
||||
* @param parentMesh
|
||||
* @param apiComponent
|
||||
* @param boundingBox
|
||||
* @param boundingSphere
|
||||
* @param faces
|
||||
|
@ -12,177 +8,14 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry = function(
|
||||
id,
|
||||
name,
|
||||
geometryType,
|
||||
parent,
|
||||
parentMesh,
|
||||
apiComponent,
|
||||
boundingBox,
|
||||
boundingSphere,
|
||||
faces,
|
||||
vertices
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
id = R3.Utils.RandomId();
|
||||
}
|
||||
this.id = id;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(geometryType)) {
|
||||
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;
|
||||
__API_COMPONENT_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(boundingBox)) {
|
||||
boundingBox = new R3.API.Box3();
|
||||
|
@ -203,211 +36,7 @@ R3.D3.API.Geometry = function(
|
|||
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.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;
|
||||
|
|
|
@ -17,14 +17,18 @@ R3.D3.API.Geometry.Buffer = function(
|
|||
morphAttributes
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
apiGeometry = {
|
||||
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER
|
||||
};
|
||||
apiGeometry = {};
|
||||
}
|
||||
this.apiGeometry = apiGeometry;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER;
|
||||
}
|
||||
R3.D3.API.Geometry.call(
|
||||
this,
|
||||
this.apiGeometry,
|
||||
this.apiGeometry.boundingBox,
|
||||
this.apiGeometry.boundingSphere,
|
||||
this.apiGeometry.faces,
|
||||
this.apiGeometry.vertices
|
||||
);
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(attributes)) {
|
||||
attributes = [];
|
||||
|
@ -51,18 +55,6 @@ R3.D3.API.Geometry.Buffer = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Box
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param width
|
||||
* @param height
|
||||
* @param depth
|
||||
|
@ -10,7 +10,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Box = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
|
@ -19,15 +19,7 @@ R3.D3.API.Geometry.Buffer.Box = function(
|
|||
depthSegments
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(width)) {
|
||||
width = 1;
|
||||
|
@ -58,16 +50,7 @@ R3.D3.API.Geometry.Buffer.Box = function(
|
|||
depthSegments = 1;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Circle
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param segments
|
||||
* @param thetaStart
|
||||
|
@ -8,22 +8,14 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Circle = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
segments,
|
||||
thetaStart,
|
||||
thetaLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -44,16 +36,6 @@ R3.D3.API.Geometry.Buffer.Circle = function(
|
|||
thetaLength = Math.PI * 2;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Cone
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param height
|
||||
* @param radialSegments
|
||||
|
@ -11,7 +11,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Cone = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
height,
|
||||
radialSegments,
|
||||
|
@ -21,15 +21,7 @@ R3.D3.API.Geometry.Buffer.Cone = function(
|
|||
thetaLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -66,15 +58,6 @@ R3.D3.API.Geometry.Buffer.Cone = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Cylinder
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radiusTop
|
||||
* @param radiusBottom
|
||||
* @param height
|
||||
|
@ -12,7 +12,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Cylinder = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radiusTop,
|
||||
radiusBottom,
|
||||
height,
|
||||
|
@ -23,15 +23,7 @@ R3.D3.API.Geometry.Buffer.Cylinder = function(
|
|||
thetaLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radiusTop)) {
|
||||
radiusTop = 1;
|
||||
|
@ -73,15 +65,6 @@ R3.D3.API.Geometry.Buffer.Cylinder = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Dodecahedron
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param detail
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Dodecahedron = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
detail
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Dodecahedron = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Extrude
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param shapes
|
||||
* @param curveSegments
|
||||
* @param steps
|
||||
|
@ -15,7 +15,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Extrude = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
shapes,
|
||||
curveSegments,
|
||||
steps,
|
||||
|
@ -29,15 +29,7 @@ R3.D3.API.Geometry.Buffer.Extrude = function(
|
|||
UVGenerator
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shapes)) {
|
||||
shapes = [];
|
||||
|
@ -89,15 +81,6 @@ R3.D3.API.Geometry.Buffer.Extrude = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Icosahedron
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param detail
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Icosahedron = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
detail
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Icosahedron = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,38 +1,21 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Instanced
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param maxInstancedCount
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Instanced = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
maxInstancedCount
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(maxInstancedCount)) {
|
||||
maxInstancedCount = null;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Lathe
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param points [R3.Vector2] (x must be larger than 0)
|
||||
* @param segments
|
||||
* @param phiStart
|
||||
|
@ -8,22 +8,14 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Lathe = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
points,
|
||||
segments,
|
||||
phiStart,
|
||||
phiLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(points)) {
|
||||
points = [];
|
||||
|
@ -45,15 +37,6 @@ R3.D3.API.Geometry.Buffer.Lathe = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Octahedron
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param detail
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Octahedron = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
detail
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Octahedron = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,27 +1,19 @@
|
|||
/**
|
||||
* 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 slices
|
||||
* @param stacks
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Parametric = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
generatorFn,
|
||||
slices,
|
||||
stacks
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(generatorFn)) {
|
||||
generatorFn = '';
|
||||
|
@ -38,15 +30,6 @@ R3.D3.API.Geometry.Buffer.Parametric = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Plane
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param width
|
||||
* @param height
|
||||
* @param widthSegments
|
||||
|
@ -8,22 +8,14 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Plane = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
width,
|
||||
height,
|
||||
widthSegments,
|
||||
heightSegments
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(width)) {
|
||||
width = 1;
|
||||
|
@ -45,15 +37,6 @@ R3.D3.API.Geometry.Buffer.Plane = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Polyhedron
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param vertices
|
||||
* @param indices
|
||||
* @param radius
|
||||
|
@ -8,22 +8,14 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Polyhedron = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
vertices,
|
||||
indices,
|
||||
radius,
|
||||
detail
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(vertices)) {
|
||||
vertices = [];
|
||||
|
@ -45,15 +37,6 @@ R3.D3.API.Geometry.Buffer.Polyhedron = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Ring
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param innerRadius
|
||||
* @param outerRadius
|
||||
* @param thetaSegments
|
||||
|
@ -10,7 +10,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Ring = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
innerRadius,
|
||||
outerRadius,
|
||||
thetaSegments,
|
||||
|
@ -19,15 +19,7 @@ R3.D3.API.Geometry.Buffer.Ring = function(
|
|||
thetaLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(innerRadius)) {
|
||||
innerRadius = 0.5;
|
||||
|
@ -59,15 +51,6 @@ R3.D3.API.Geometry.Buffer.Ring = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Shape
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param shapes
|
||||
* @param curveSegments
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Shape = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
shapes,
|
||||
curveSegments
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shapes)) {
|
||||
shapes = [];
|
||||
|
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Shape = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Sphere
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param widthSegments
|
||||
* @param heightSegments
|
||||
|
@ -11,7 +11,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Sphere = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
widthSegments,
|
||||
heightSegments,
|
||||
|
@ -21,15 +21,7 @@ R3.D3.API.Geometry.Buffer.Sphere = function(
|
|||
thetaLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -66,15 +58,6 @@ R3.D3.API.Geometry.Buffer.Sphere = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Tetrahedron
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param detail
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Tetrahedron = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
detail
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -31,15 +23,6 @@ R3.D3.API.Geometry.Buffer.Tetrahedron = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Text
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param text
|
||||
* @param font
|
||||
* @param size
|
||||
|
@ -13,7 +13,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Text = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
text,
|
||||
font,
|
||||
size,
|
||||
|
@ -25,15 +25,7 @@ R3.D3.API.Geometry.Buffer.Text = function(
|
|||
bevelSegments
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(text)) {
|
||||
text = '-=<yb4f310';
|
||||
|
@ -80,15 +72,6 @@ R3.D3.API.Geometry.Buffer.Text = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.TorusKnot
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param tube
|
||||
* @param radialSegments
|
||||
|
@ -10,7 +10,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.TorusKnot = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
tube,
|
||||
radialSegments,
|
||||
|
@ -19,15 +19,7 @@ R3.D3.API.Geometry.Buffer.TorusKnot = function(
|
|||
q
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -59,15 +51,6 @@ R3.D3.API.Geometry.Buffer.TorusKnot = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Torus
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param radius
|
||||
* @param tube
|
||||
* @param radialSegments
|
||||
|
@ -9,7 +9,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Torus = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
radius,
|
||||
tube,
|
||||
radialSegments,
|
||||
|
@ -17,15 +17,7 @@ R3.D3.API.Geometry.Buffer.Torus = function(
|
|||
arc
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -52,15 +44,6 @@ R3.D3.API.Geometry.Buffer.Torus = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Buffer.Tube
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryBuffer
|
||||
* @param path
|
||||
* @param tubularSegments
|
||||
* @param radius
|
||||
|
@ -9,7 +9,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Buffer.Tube = function(
|
||||
apiGeometry,
|
||||
apiGeometryBuffer,
|
||||
path,
|
||||
tubularSegments,
|
||||
radius,
|
||||
|
@ -17,15 +17,7 @@ R3.D3.API.Geometry.Buffer.Tube = function(
|
|||
closed
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_BUFFER_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(path)) {
|
||||
path = null;
|
||||
|
@ -52,15 +44,6 @@ R3.D3.API.Geometry.Buffer.Tube = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -32,15 +32,20 @@ R3.D3.API.Geometry.Normal = function(
|
|||
groupsNeedUpdate,
|
||||
lineDistancesNeedUpdate
|
||||
) {
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
apiGeometry = {
|
||||
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL
|
||||
};
|
||||
}
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL;
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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)) {
|
||||
colors = [];
|
||||
|
@ -106,19 +111,6 @@ R3.D3.API.Geometry.Normal = function(
|
|||
lineDistancesNeedUpdate = false;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Box
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param width
|
||||
* @param height
|
||||
* @param depth
|
||||
|
@ -10,7 +10,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Box = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
width,
|
||||
height,
|
||||
depth,
|
||||
|
@ -19,15 +19,7 @@ R3.D3.API.Geometry.Normal.Box = function(
|
|||
depthSegments
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(width)) {
|
||||
width = 1;
|
||||
|
@ -58,24 +50,7 @@ R3.D3.API.Geometry.Normal.Box = function(
|
|||
depthSegments = 1;
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Circle
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param radius
|
||||
* @param segments
|
||||
* @param thetaStart
|
||||
|
@ -8,22 +8,14 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Circle = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
radius,
|
||||
segments,
|
||||
thetaStart,
|
||||
thetaLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -45,23 +37,6 @@ R3.D3.API.Geometry.Normal.Circle = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Cone
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param radius
|
||||
* @param height
|
||||
* @param radialSegments
|
||||
|
@ -11,7 +11,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Cone = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
radius,
|
||||
height,
|
||||
radialSegments,
|
||||
|
@ -21,15 +21,7 @@ R3.D3.API.Geometry.Normal.Cone = function(
|
|||
thetaLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -66,23 +58,6 @@ R3.D3.API.Geometry.Normal.Cone = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Cylinder
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param radiusTop
|
||||
* @param radiusBottom
|
||||
* @param height
|
||||
|
@ -12,7 +12,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Cylinder = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
radiusTop,
|
||||
radiusBottom,
|
||||
height,
|
||||
|
@ -23,15 +23,7 @@ R3.D3.API.Geometry.Normal.Cylinder = function(
|
|||
thetaLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radiusTop)) {
|
||||
radiusTop = 1;
|
||||
|
@ -73,23 +65,6 @@ R3.D3.API.Geometry.Normal.Cylinder = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Dodecahedron
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param radius
|
||||
* @param detail
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Dodecahedron = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
radius,
|
||||
detail
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -31,23 +23,6 @@ R3.D3.API.Geometry.Normal.Dodecahedron = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Edges
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param geometry
|
||||
* @param thresholdAngle (degrees)
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Edges = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
geometry,
|
||||
thresholdAngle
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(geometry)) {
|
||||
geometry = null;
|
||||
|
@ -31,23 +23,6 @@ R3.D3.API.Geometry.Normal.Edges = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Extrude
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param shapes
|
||||
* @param curveSegments
|
||||
* @param steps
|
||||
|
@ -15,7 +15,7 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Extrude = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
shapes,
|
||||
curveSegments,
|
||||
steps,
|
||||
|
@ -29,15 +29,7 @@ R3.D3.API.Geometry.Normal.Extrude = function(
|
|||
UVGenerator
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(shapes)) {
|
||||
shapes = [];
|
||||
|
@ -89,23 +81,6 @@ R3.D3.API.Geometry.Normal.Extrude = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Icosahedron
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param radius
|
||||
* @param detail
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Icosahedron = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
radius,
|
||||
detail
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -31,23 +23,6 @@ R3.D3.API.Geometry.Normal.Icosahedron = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Lathe
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param points [R3.Vector2]
|
||||
* @param segments
|
||||
* @param phiStart
|
||||
|
@ -8,22 +8,14 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Lathe = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
points,
|
||||
segments,
|
||||
phiStart,
|
||||
phiLength
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(points)) {
|
||||
points = [];
|
||||
|
@ -45,23 +37,6 @@ R3.D3.API.Geometry.Normal.Lathe = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Octahedron
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param radius
|
||||
* @param detail
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Octahedron = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
radius,
|
||||
detail
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(radius)) {
|
||||
radius = 1;
|
||||
|
@ -31,23 +23,6 @@ R3.D3.API.Geometry.Normal.Octahedron = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,27 +1,19 @@
|
|||
/**
|
||||
* 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 slices
|
||||
* @param stacks
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Parametric = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
generatorFn,
|
||||
slices,
|
||||
stacks
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(generatorFn)) {
|
||||
generatorFn = '';
|
||||
|
@ -38,23 +30,6 @@ R3.D3.API.Geometry.Normal.Parametric = function(
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* R3.D3.API.Geometry.Normal.Plane
|
||||
* @param apiGeometry
|
||||
* @param apiGeometryNormal
|
||||
* @param width
|
||||
* @param height
|
||||
* @param widthSegments
|
||||
|
@ -8,22 +8,14 @@
|
|||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Geometry.Normal.Plane = function(
|
||||
apiGeometry,
|
||||
apiGeometryNormal,
|
||||
width,
|
||||
height,
|
||||
widthSegments,
|
||||
heightSegments
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||||
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;
|
||||
}
|
||||
__API_GEOMETRY_NORMAL_MACRO__
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(width)) {
|
||||
width = 1;
|
||||
|
@ -45,23 +37,6 @@ R3.D3.API.Geometry.Normal.Plane = function(
|
|||
}
|
||||
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);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue