start restructure

beta.r3js.org
cybafelo 2019-07-24 08:08:02 +02:00
parent 452842cb45
commit 659954f7de
236 changed files with 5607 additions and 2509 deletions

View File

@ -2,7 +2,7 @@
* R3.API.AR
* @param id
* @param name
* @param parentEntity
* @param parent
* @param video
* @param pathCamera
* @param pathMarker
@ -15,7 +15,7 @@
R3.API.AR = function(
id,
name,
parentEntity,
parent,
video,
pathCamera,
pathMarker,
@ -79,7 +79,7 @@ R3.API.AR = function(
R3.API.Component.call(
this,
R3.Component.AR,
parentEntity
parent
);
};

View File

@ -3,14 +3,14 @@
* @param id
* @param name
* @param graphicsType
* @param parentEntity
* @param parent
* @constructor
*/
R3.API.GraphicsRuntime = function(
id,
name,
graphicsType,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -30,7 +30,7 @@ R3.API.GraphicsRuntime = function(
R3.API.Component.call(
this,
R3.API.GraphicsRuntime.GetComponentType(this.graphicsType),
parentEntity
parent
);
};

View File

@ -21,7 +21,7 @@ R3.API.GraphicsRuntime.Impact = function(
apiGraphicsRuntime.id,
apiGraphicsRuntime.name,
apiGraphicsRuntime.graphicsType,
apiGraphicsRuntime.parentEntity
apiGraphicsRuntime.parent
);
};

View File

@ -21,7 +21,7 @@ R3.API.GraphicsRuntime.Three = function(
apiGraphicsRuntime.id,
apiGraphicsRuntime.name,
apiGraphicsRuntime.graphicsType,
apiGraphicsRuntime.parentEntity
apiGraphicsRuntime.parent
);
};

View File

@ -6,7 +6,7 @@
* @param min
* @param max
*/
R3.API.Number = function (
R3.API.Number = function(
value,
grain,
min,

View File

@ -19,7 +19,7 @@ R3.AR = function(
this,
apiAR.id,
apiAR.name,
apiAR.parentEntity,
apiAR.parent,
apiAR.video,
apiAR.pathCamera,
apiAR.pathMarker,
@ -435,7 +435,7 @@ R3.AR.prototype.toApiObject = function() {
return new R3.API.AR(
this.id,
this.name,
R3.Utils.IdOrNull(this.parentEntity),
R3.Utils.IdOrNull(this.parent),
R3.Utils.IdOrNull(this.video),
this.pathCamera,
this.pathMarker,

View File

@ -3,7 +3,7 @@
* @param apiGraphicsRuntimeImpact
* @constructor
*/
R3.GraphicsRuntime.Impact = function (
R3.GraphicsRuntime.Impact = function(
apiGraphicsRuntimeImpact
) {

View File

@ -4,7 +4,7 @@
* @param parentObject
* @constructor
*/
R3.Number = function (
R3.Number = function(
apiNumber,
parentObject
) {

View File

@ -7,11 +7,24 @@ 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;';
code += '\n';
code += ' R3.API.Component.call(';
code += ' this,';
code += ' this.apiComponent.parent,';
code += ' this.apiComponent.id,';
code += ' this.apiComponent.name';
code += ' );';
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(minify({
ext:{
src:'.js',
@ -32,4 +45,4 @@ gulp.task(
build,
monitor
)
);
);

View File

@ -2,7 +2,11 @@
* Event Core
* @constructor
*/
R3.Event = function() {
R3.Event = function(parent) {
if (!parent) {
parent = null;
}
this.parent = parent;
};
/**
@ -13,7 +17,7 @@ R3.Event.Subscriptions = {};
R3.Event.OnceSubscriptions = {};
/**
* Events we can subscribe to and publish
* Events we can subscribe to and emit
*/
R3.Event.WINDOW_RESIZE = 0x1;
R3.Event.PARENT_SCENE_CHANGE = 0x2;
@ -93,7 +97,7 @@ R3.Event.TOUCH_MOVE = 0x4b;
R3.Event.TOUCH_CANCEL = 0x4c;
R3.Event.GET_REMOTE_API_URL = 0x4d;
R3.Event.COMPONENT_TYPES_UPDATE = 0x4e;
R3.Event.DELAYED_INSTANCE_ENCOUNTERED = 0x4f;
R3.Event.PROJECT_LOADED = 0x4f;
R3.Event.CAST_SOURCE_CHANGED = 0x50;
R3.Event.RESOLVE_DEPENDENCIES = 0x51;
R3.Event.NAME_UPDATE = 0x52;
@ -225,7 +229,7 @@ R3.Event.GetEventName = function(number) {
case 0x4c : return 'touch_cancel';
case 0x4d : return 'get_remote_api_url';
case 0x4e : return 'component_types_update';
case 0x4f : return 'delayed_instance_encountered';
case 0x4f : return 'project_loaded';
case 0x50 : return 'cast_source_changed';
case 0x51 : return 'resolve_dependencies';;
case 0x52 : return 'name_update';
@ -335,7 +339,7 @@ R3.Event.prototype.subscribe = function(
* @param clientErrorCallback
* @returns {number} of callbacks executed
*/
R3.Event.prototype.publish = function(
R3.Event.prototype.emit = function(
eventName,
data,
clientCallback,

View File

@ -69,7 +69,7 @@ R3.Utils.SortFacesByMaterialIndex = function(faces) {
* Sorts faces according to material index because later we will create
* groups for each vertice group
*/
faces.sort(function (a, b) {
faces.sort(function(a, b) {
if (a.materialIndex < b.materialIndex) {
return -1;
@ -158,7 +158,7 @@ R3.Utils.GetWindowSize = function() {
R3.Event.Emit(
R3.Event.GET_WINDOW_SIZE,
null,
function (data) {
function(data) {
size = data;
}.bind(this)
);
@ -242,7 +242,7 @@ R3.Utils.GetRandomIntInclusive = function(min, max) {
R3.Utils.InterpolateArray = function(data, fitCount) {
var linearInterpolate = function (before, after, atPoint) {
var linearInterpolate = function(before, after, atPoint) {
return before + (after - before) * atPoint;
};
@ -271,7 +271,7 @@ R3.Utils.InterpolateArray = function(data, fitCount) {
* @returns {boolean}
* @constructor
*/
R3.Utils.UndefinedOrNull = function (
R3.Utils.UndefinedOrNull = function(
variable
) {
return typeof variable === 'undefined' || variable === null;
@ -283,7 +283,7 @@ R3.Utils.UndefinedOrNull = function (
* @returns {boolean}
* @constructor
*/
R3.Utils.Defined = function (
R3.Utils.Defined = function(
variable
) {
return typeof variable !== 'undefined' && variable !== null;
@ -327,7 +327,7 @@ R3.Utils.GetParameters = function(fn) {
* @returns {null}
* @constructor
*/
R3.Utils.IdOrNull = function (object) {
R3.Utils.IdOrNull = function(object) {
if (R3.Utils.UndefinedOrNull(object)) {
return null;
} else {
@ -374,7 +374,7 @@ R3.Utils.LimitToPI = function(property, objectProperty) {
* @returns []
* @constructor
*/
R3.Utils.IdArrayOrEmptyArray = function (array) {
R3.Utils.IdArrayOrEmptyArray = function(array) {
if (R3.Utils.UndefinedOrNull(array)) {
return [];
} else {
@ -448,7 +448,7 @@ R3.Utils.InvertWindingOrder = function(triangles) {
R3.Utils.InvertMeshWindingOrder = function(mesh) {
mesh.faces.forEach(
function (face) {
function(face) {
var tmpV1 = face.v1;
face.v1 = face.v2;
@ -767,7 +767,7 @@ R3.Utils.MovingAverage = function(period) {
}
};
R3.Utils.Intersect = function (a, b) {
R3.Utils.Intersect = function(a, b) {
var t;
@ -786,7 +786,7 @@ R3.Utils.Intersect = function (a, b) {
* @param e
* @returns {boolean}
*/
function (e) {
function(e) {
return (b.indexOf(e) > -1);
}
).filter(
@ -797,13 +797,13 @@ R3.Utils.Intersect = function (a, b) {
* @param c
* @returns {boolean}
*/
function (e, i, c) {
function(e, i, c) {
return c.indexOf(e) === i;
}
);
};
R3.Utils.Difference = function (a, b) {
R3.Utils.Difference = function(a, b) {
var t;
@ -822,7 +822,7 @@ R3.Utils.Difference = function (a, b) {
* @param e
* @returns {boolean}
*/
function (e) {
function(e) {
return (b.indexOf(e) === -1);
}
).filter(
@ -833,7 +833,7 @@ R3.Utils.Difference = function (a, b) {
* @param c
* @returns {boolean}
*/
function (e, i, c) {
function(e, i, c) {
return c.indexOf(e) === i;
}
);

468
src/r3-a-3-api-component.js Normal file
View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
/**
* API Component Interface - Do not construct objects of this type directly
* @param componentType
* @param parentEntity
* @constructor
*/
R3.API.Component = function(
componentType,
parentEntity
) {
this.componentType = componentType;
if (R3.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
this.parentEntity = parentEntity;
};
R3.API.Component.prototype.constructor = R3.API.Component;

View File

@ -1,31 +1,29 @@
/**
* R3.API.Box3
* @param id
* @param name
* @param parentEntity
* @param apiComponent
* @param min
* @param max
* @constructor
*/
R3.API.Box3 = function (
id,
name,
parentEntity,
R3.API.Box3 = function(
apiComponent,
min,
max
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
if (R3.Utils.UndefinedOrNull(apiComponent)) {
apiComponent = {};
}
this.id = id;
this.apiComponent = apiComponent;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Box (' + id + ')';
}
this.name = name;
R3.API.Component.call(
this,
this.apiComponent.parent,
this.apiComponent.id,
this.apiComponent.name
);
if (R3.Utils.UndefinedOrNull(min)) {
min = new R3.API.Vector3(0,0,0);
min = new R3.API.Vector3();
}
this.min = min;
@ -33,12 +31,6 @@ R3.API.Box3 = function (
max = new R3.API.Vector3(1,1,1);
}
this.max = max;
R3.API.Component.call(
this,
R3.Component.BOX3,
parentEntity
)
};
R3.API.Box3.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,9 +1,6 @@
/**
* R3.API.Canvas
* @param id
* @param name
* @param parentEntity
* @param parentTexture
* @param apiComponent
* @param autoUpdateSize
* @param width
* @param height
@ -14,10 +11,7 @@
* @constructor
*/
R3.API.Canvas = function(
id,
name,
parentEntity,
parentTexture,
apiComponent,
autoUpdateSize,
width,
height,
@ -26,20 +20,18 @@ R3.API.Canvas = function(
texts,
textBaseline
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Canvas (' + id + ')';
if (R3.Utils.UndefinedOrNull(apiComponent)) {
apiComponent = {};
}
this.name = name;
this.apiComponent = apiComponent;
if (R3.Utils.UndefinedOrNull(parentTexture)) {
parentTexture = null;
}
this.parentTexture = parentTexture;
R3.API.Component.call(
this,
this.apiComponent.parent,
this.apiComponent.id,
this.apiComponent.name
);
if (R3.Utils.UndefinedOrNull(autoUpdateSize)) {
autoUpdateSize = true;
@ -76,11 +68,6 @@ R3.API.Canvas = function(
}
this.textBaseline = textBaseline;
R3.API.Component.call(
this,
R3.Component.CANVAS,
parentEntity
);
};
R3.API.Canvas.prototype = Object.create(R3.API.Component.prototype);

View File

@ -1,47 +1,15 @@
/**
* Raw Clock API object - should always correspond with the Clock Schema
* R3.API.Clock
* @constructor
* @param id
* @param name
* @param parentEntity
* @param apiComponent
*/
R3.API.Clock = function(
id,
name,
parentEntity
apiComponent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
__API_COMPONENT_MACRO__
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Clock (' + this.id + ')';
}
this.name = name;
R3.API.Component.call(
this,
R3.Component.CLOCK,
parentEntity
);
};
R3.API.Clock.prototype = Object.create(R3.API.Component.prototype);
R3.API.Clock.prototype.constructor = R3.API.Clock;
/**
* Creates an API camera from an Object camera
* @param objectClock
* @constructor
*/
R3.API.Clock.FromObject = function(objectClock) {
return new R3.API.Clock(
objectClock.id,
objectClock.name,
objectClock.parentEntity
);
};

View File

@ -1,13 +1,19 @@
/**
* API Color
* @param parent
* @param r
* @param g
* @param b
* @param a
* @constructor
*/
R3.API.Color = function (r, g, b, a) {
R3.API.Color = function(
r,
g,
b,
a
) {
if (R3.Utils.UndefinedOrNull(r)) {
r = 1;
}
@ -29,23 +35,3 @@ R3.API.Color = function (r, g, b, a) {
this.a = a;
};
/**
* Returns an API color from an Object color
* @param objectColor
* @constructor
*/
R3.API.Color.FromObject = function(objectColor) {
if (R3.Utils.UndefinedOrNull(objectColor)){
objectColor = {};
}
return new R3.API.Color(
objectColor.r,
objectColor.g,
objectColor.b,
objectColor.a
);
};

View File

@ -1,51 +1,48 @@
/**
* Raw Controls API object
* R3.API.Controls
* @param parent
* @param id
* @param controlsType
* @param name
* @param canvas
* @param parentEntity
* @property controlsType
* @constructor
*/
R3.API.Controls = function(
parent,
id,
name,
controlsType,
canvas,
parentEntity
canvas
) {
R3.API.Component.call(
this,
parent
);
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
if (R3.Utils.UndefinedOrNull(controlsType)) {
controlsType = R3.API.Controls.CONTROLS_TYPE_NONE;
}
this.controlsType = controlsType;
if (R3.Utils.UndefinedOrNull(name)) {
name = 'Controls';
switch (this.controlsType) {
case R3.API.Controls.CONTROLS_TYPE_TOUCH :
switch (this.componentType) {
case R3.Component.CONTROLS_TOUCH:
name = 'Controls Touch';
break;
case R3.API.Controls.CONTROLS_TYPE_KEYBOARD :
case R3.Component.CONTROLS_KEYBOARD :
name = 'Controls Keyboard';
break;
case R3.API.Controls.CONTROLS_TYPE_MOUSE :
case R3.Component.CONTROLS_MOUSE :
name = 'Controls Mouse';
break;
case R3.API.Controls.CONTROLS_TYPE_EDITOR :
case R3.Component.CONTROLS_EDITOR :
name = 'Controls Editor';
break;
case R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON :
case R3.Component.CONTROLS_FIRST_PERSON :
name = 'Controls First Person';
break;
case R3.API.Controls.CONTROLS_TYPE_ORBIT :
case R3.Component.CONTROLS_ORBIT :
name = 'Controls Orbit';
break;
}
@ -58,61 +55,7 @@ R3.API.Controls = function(
canvas = null;
}
this.canvas = canvas;
R3.API.Component.call(
this,
R3.API.Controls.GetComponentType(this.controlsType),
parentEntity
);
};
R3.API.Controls.prototype = Object.create(R3.API.Component.prototype);
R3.API.Controls.prototype.constructor = R3.API.Controls;
R3.API.Controls.GetComponentType = function(controlsType) {
var componentType = null;
switch (controlsType) {
case R3.API.Controls.CONTROLS_TYPE_NONE :
componentType = R3.Component.CONTROLS;
break;
case R3.API.Controls.CONTROLS_TYPE_TOUCH :
componentType = R3.Component.CONTROLS_TOUCH;
break;
case R3.API.Controls.CONTROLS_TYPE_KEYBOARD :
componentType = R3.Component.CONTROLS_KEYBOARD;
break;
case R3.API.Controls.CONTROLS_TYPE_MOUSE :
componentType = R3.Component.CONTROLS_MOUSE;
break;
case R3.API.Controls.CONTROLS_TYPE_EDITOR :
componentType = R3.Component.CONTROLS_EDITOR;
break;
case R3.API.Controls.CONTROLS_TYPE_ORBIT :
componentType = R3.Component.CONTROLS_ORBIT;
break;
default :
throw new Error('unhandled controls type: ' + controlsType);
break;
}
return componentType;
};
/**
* Controls Type
* @type {number}
*/
R3.API.Controls.CONTROLS_TYPE_NONE = 0x0;
R3.API.Controls.CONTROLS_TYPE_TOUCH = 0x1;
R3.API.Controls.CONTROLS_TYPE_KEYBOARD = 0x2;
R3.API.Controls.CONTROLS_TYPE_MOUSE = 0x3;
R3.API.Controls.CONTROLS_TYPE_EDITOR = 0x4;
R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON = 0x5;
R3.API.Controls.CONTROLS_TYPE_ORBIT = 0x6;
R3.API.Controls.D3 = function() {};
R3.API.Controls.D3.prototype = Object.create(R3.API.Controls.prototype);
R3.API.Controls.D3.prototype.constructor = R3.API.Controls.D3;

View File

@ -1,43 +1,28 @@
/**
* @param apiControls
* @param apiControlsD3
* @param raycaster
* @param camera
* @constructor
*/
R3.API.Controls.D3.Editor = function(
apiControls,
raycaster,
camera
apiControlsD3,
raycaster
) {
if (R3.Utils.UndefinedOrNull(apiControls)) {
apiControls = {
controlsType : R3.API.Controls.CONTROLS_TYPE_EDITOR
};
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
apiControlsD3 = {};
}
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_EDITOR;
}
R3.API.Controls.D3.call(
this,
apiControlsD3,
apiControlsD3.camera
);
if (R3.Utils.UndefinedOrNull(raycaster)) {
raycaster = new R3.D3.API.Raycaster();
}
this.raycaster = raycaster;
if (R3.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
R3.API.Controls.call(
this,
apiControls.id,
apiControls.name,
apiControls.controlsType,
apiControls.canvas,
apiControls.parentEntity
);
};
R3.API.Controls.D3.Editor.prototype = Object.create(R3.API.Controls.D3.prototype);

View File

@ -1,7 +1,6 @@
/**
* R3.API.Controls.D3.FirstPerson
* @param apiControls
* @param camera
* @param apiControlsD3
* @param enabled
* @param movementSpeed
* @param lookSpeed
@ -19,8 +18,7 @@
* @constructor
*/
R3.API.Controls.D3.FirstPerson = function(
apiControls,
camera,
apiControlsD3,
enabled,
movementSpeed,
lookSpeed,
@ -37,20 +35,15 @@ R3.API.Controls.D3.FirstPerson = function(
autoSpeedFactor
) {
if (R3.Utils.UndefinedOrNull(apiControls)) {
apiControls = {
controlsType : R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON
};
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
apiControlsD3 = {};
}
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON;
}
if (R3.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
R3.API.Controls.D3.call(
this,
apiControlsD3,
apiControlsD3.camera
);
if (R3.Utils.UndefinedOrNull(enabled)) {
enabled = true;
@ -122,14 +115,6 @@ R3.API.Controls.D3.FirstPerson = function(
}
this.autoSpeedFactor = autoSpeedFactor;
R3.API.Controls.call(
this,
apiControls.id,
apiControls.name,
apiControls.controlsType,
apiControls.canvas,
apiControls.parentEntity
);
};
R3.API.Controls.D3.FirstPerson.prototype = Object.create(R3.API.Controls.D3.prototype);

View File

@ -1,13 +1,8 @@
/**
* R3.API.Controls.D3.Orbit
* @param apiControls
* @param camera
* @param apiControlsD3
* @param target
* @param enabled
* @param minDistance
* @param maxDistance
* @param minZoom
* @param maxZoom
* @param minPolarAngle
* @param maxPolarAngle
* @param enableDamping
@ -24,8 +19,7 @@
* @constructor
*/
R3.API.Controls.D3.Orbit = function(
apiControls,
camera,
apiControlsD3,
target,
enabled,
minPolarAngle,
@ -43,20 +37,15 @@ R3.API.Controls.D3.Orbit = function(
enableKeys
) {
if (R3.Utils.UndefinedOrNull(apiControls)) {
apiControls = {
controlsType : R3.API.Controls.CONTROLS_TYPE_ORBIT
};
if (R3.Utils.UndefinedOrNull(apiControlsD3)) {
apiControlsD3 = {};
}
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_ORBIT;
}
if (R3.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
R3.API.Controls.D3.call(
this,
apiControlsD3,
apiControlsD3.camera
);
if (R3.Utils.UndefinedOrNull(target)) {
target = null;
@ -133,14 +122,6 @@ R3.API.Controls.D3.Orbit = function(
}
this.enableKeys = enableKeys;
R3.API.Controls.call(
this,
apiControls.id,
apiControls.name,
apiControls.controlsType,
apiControls.canvas,
apiControls.parentEntity
);
};
R3.API.Controls.D3.Orbit.prototype = Object.create(R3.API.Controls.D3.prototype);

29
src/r3-api-controls-d3.js Normal file
View File

@ -0,0 +1,29 @@
/**
* Raw Controls API object
* @constructor
*/
R3.API.Controls.D3 = function(
apiControls,
camera
) {
if (R3.Utils.UndefinedOrNull(apiControls)) {
apiControls = {};
}
R3.API.Controls.call(
this,
apiControls.parent,
apiControls.id,
apiControls.name,
apiControls.canvas
);
if (R3.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
};
R3.API.Controls.D3.prototype = Object.create(R3.API.Controls.prototype);
R3.API.Controls.D3.prototype.constructor = R3.API.Controls.D3;

View File

@ -5,24 +5,12 @@
R3.API.Controls.Keyboard = function(
apiControls
) {
if (R3.Utils.UndefinedOrNull(apiControls)) {
apiControls = {
controlsType : R3.API.Controls.CONTROLS_TYPE_KEYBOARD
};
}
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_KEYBOARD;
}
R3.API.Controls.call(
this,
apiControls.parent,
apiControls.id,
apiControls.name,
apiControls.controlsType,
apiControls.canvas,
apiControls.parentEntity
apiControls.canvas
);
};

View File

@ -5,27 +5,14 @@
R3.API.Controls.Mouse = function(
apiControls
) {
if (R3.Utils.UndefinedOrNull(apiControls)) {
apiControls = {
controlsType : R3.API.Controls.CONTROLS_TYPE_MOUSE
};
}
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_MOUSE;
}
R3.API.Controls.call(
this,
apiControls.parent,
apiControls.id,
apiControls.name,
apiControls.controlsType,
apiControls.canvas,
apiControls.parentEntity
apiControls.canvas
);
};
R3.API.Controls.Mouse.prototype = Object.create(R3.API.Controls.prototype);
R3.API.Controls.Mouse.prototype.constructor = R3.API.Controls.Mouse;

View File

@ -8,29 +8,19 @@ R3.API.Controls.Touch = function(
sensitivity
) {
if (R3.Utils.UndefinedOrNull(apiControls)) {
apiControls = {
controlsType : R3.API.Controls.CONTROLS_TYPE_TOUCH
};
}
if (R3.Utils.UndefinedOrNull(apiControls.controlsType)) {
apiControls.controlsType = R3.API.Controls.CONTROLS_TYPE_TOUCH;
}
R3.API.Controls.call(
this,
apiControls.parent,
apiControls.id,
apiControls.name,
apiControls.canvas
);
if (R3.Utils.UndefinedOrNull(sensitivity)) {
sensitivity = 5;
}
this.sensitivity = sensitivity;
R3.API.Controls.call(
this,
apiControls.id,
apiControls.name,
apiControls.controlsType,
apiControls.canvas,
apiControls.parentEntity
);
};
R3.API.Controls.Touch.prototype = Object.create(R3.API.Controls.prototype);

View File

@ -3,22 +3,21 @@
* @param id
* @param name
* @param curveType
* @param parentEntity
* @param parent
* @param arcLenghDivisions
* @constructor
*/
R3.API.Curve = function (
R3.API.Curve = function(
parent,
id,
name,
curveType,
parentEntity,
arcLenghDivisions
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
this.id = id;
R3.API.Component.call(
this,
parent
);
if (R3.Utils.UndefinedOrNull(curveType)) {
curveType = R3.API.Curve.CURVE_TYPE_NONE;
@ -50,7 +49,7 @@ R3.API.Curve = function (
R3.API.Component.call(
this,
R3.API.Curve.GetComponentType(this.curveType),
parentEntity
parent
);
};

View File

@ -5,7 +5,7 @@
* @param curves
* @param autoClose
*/
R3.API.Curve.Path = function (
R3.API.Curve.Path = function(
apiCurve,
curves,
autoClose
@ -35,7 +35,7 @@ R3.API.Curve.Path = function (
apiCurve.id,
apiCurve.name,
apiCurve.curveType,
apiCurve.parentEntity,
apiCurve.parent,
apiCurve.arcLenghDivisions
);
};

View File

@ -4,7 +4,7 @@
* @param apiCurvePath
* @param points
*/
R3.API.Curve.Path.D2 = function (
R3.API.Curve.Path.D2 = function(
apiCurvePath,
points
) {

View File

@ -3,7 +3,7 @@
* @constructor
* @param apiCurvePathD2
*/
R3.API.Curve.Path.D2.Shape = function (
R3.API.Curve.Path.D2.Shape = function(
apiCurvePathD2
) {
if (R3.Utils.UndefinedOrNull(apiCurvePathD2)) {

View File

@ -4,15 +4,15 @@
* @param name
* @param eventId
* @param code
* @param parentEntity
* @param parent
* @constructor
*/
R3.API.CustomCode = function (
R3.API.CustomCode = function(
id,
name,
eventId,
code,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -37,7 +37,7 @@ R3.API.CustomCode = function (
R3.API.Component.call(
this,
R3.Component.CUSTOM_CODE,
parentEntity
parent
);
};

View File

@ -3,14 +3,14 @@
* @param id
* @param name
* @param domElementId
* @param parentEntity
* @param parent
* @constructor
*/
R3.API.DomElement = function(
id,
name,
domElementId,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -31,7 +31,7 @@ R3.API.DomElement = function(
R3.API.Component.call(
this,
R3.Component.DOM_ELEMENT,
parentEntity
parent
);
};
@ -43,11 +43,11 @@ R3.API.DomElement.prototype.constructor = R3.API.DomElement;
* @param objectDomElement
* @constructor
*/
R3.API.DomElement.FromObject = function (objectDomElement) {
R3.API.DomElement.FromObject = function(objectDomElement) {
return new R3.API.DomElement(
objectDomElement.id,
objectDomElement.name,
objectDomElement.domElementId,
objectDomElement.parentEntity
objectDomElement.parent
)
};

View File

@ -3,14 +3,14 @@
* @constructor
* @param id
* @param name
* @param parentEntity
* @param parent
* @param start
* @param count
*/
R3.API.DrawRange = function (
R3.API.DrawRange = function(
id,
name,
parentEntity,
parent,
start,
count
) {
@ -37,7 +37,7 @@ R3.API.DrawRange = function (
R3.API.Component.call(
this,
R3.Component.DRAW_RANGE,
parentEntity
parent
)
};

View File

@ -5,14 +5,14 @@
* @param name
* @param entities R3.API.Entity[]
* @param defaultEntity
* @param parentEntity
* @param parent
*/
R3.API.EntityManager = function(
id,
name,
entities,
defaultEntity,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -37,7 +37,7 @@ R3.API.EntityManager = function(
R3.API.Component.call(
this,
R3.Component.ENTITY_MANAGER,
parentEntity
parent
);
};
@ -52,7 +52,7 @@ R3.API.EntityManager.prototype.constructor = R3.API.EntityManager;
R3.API.EntityManager.FromObject = function(objectEntityManager) {
var apiEntities = objectEntityManager.entities.map(
function (objectEntity) {
function(objectEntity) {
return R3.API.Entity.FromObject(objectEntity);
}
);
@ -62,6 +62,6 @@ R3.API.EntityManager.FromObject = function(objectEntityManager) {
objectEntityManager.name,
apiEntities,
objectEntityManager.defaultEntity,
objectEntityManager.parentEntity
objectEntityManager.parent
);
};

View File

@ -3,14 +3,14 @@
* @param id
* @param name
* @param components R3.Component[]
* @param parentEntity R3.Entity
* @param parent R3.Entity
* @constructor
*/
R3.API.Entity = function(
id,
name,
components,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -27,10 +27,16 @@ R3.API.Entity = function(
}
this.components = components;
var componentType = R3.Component.ENTITY;
if (this instanceof R3.API.Project) {
componentType = R3.Component.PROJECT;
}
R3.API.Component.call(
this,
R3.Component.ENTITY,
parentEntity
componentType,
parent
);
};
@ -47,6 +53,6 @@ R3.API.Entity.FromObject = function(objectEntity) {
objectEntity.id,
objectEntity.name,
objectEntity.components,
objectEntity.parentEntity
objectEntity.parent
)
};

View File

@ -3,15 +3,15 @@
* @constructor
* @param id
* @param name
* @param parentEntity
* @param parent
* @param start
* @param count
* @param materialIndex
*/
R3.API.Group = function (
R3.API.Group = function(
id,
name,
parentEntity,
parent,
start,
count,
materialIndex
@ -44,7 +44,7 @@ R3.API.Group = function (
R3.API.Component.call(
this,
R3.Component.GROUP,
parentEntity
parent
)
};

View File

@ -3,14 +3,14 @@
* @param id
* @param name
* @param domElement
* @param parentEntity
* @param parent
* @constructor
*/
R3.API.GUI = function(
id,
name,
domElement,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -31,7 +31,7 @@ R3.API.GUI = function(
R3.API.Component.call(
this,
R3.Component.GUI,
parentEntity
parent
);
};
@ -58,7 +58,7 @@ R3.API.GUI.FromObject = function(objectGUI) {
objectGUI.id,
objectGUI.name,
apiDomElement,
objectGUI.parentEntity
objectGUI.parent
);
};

View File

@ -2,7 +2,7 @@
* R3.API.Image
* @param id
* @param name
* @param parentEntity
* @param parent
* @param parentTexture
* @param fileName
* @param extension
@ -16,7 +16,7 @@
R3.API.Image = function(
id,
name,
parentEntity,
parent,
parentTexture,
fileName,
extension,
@ -92,7 +92,7 @@ R3.API.Image = function(
R3.API.Component.call(
this,
R3.Component.IMAGE,
parentEntity
parent
);
};

View File

@ -83,14 +83,14 @@ R3.API.Matrix4.FromObject = function(objectMatrix) {
}
};
R3.API.Matrix4.prototype.rotationMatrixX = function (radians) {
R3.API.Matrix4.prototype.rotationMatrixX = function(radians) {
this.identity();
this.rows[1] = new R3.API.Vector4(0, Math.cos(radians), -1 * Math.sin(radians), 0);
this.rows[2] = new R3.API.Vector4(0, Math.sin(radians), Math.cos(radians), 0);
return this;
};
R3.API.Matrix4.prototype.rotationMatrixY = function (radians) {
R3.API.Matrix4.prototype.rotationMatrixY = function(radians) {
this.identity();
this.rows[0] = new R3.API.Vector4(
Math.cos(radians),
@ -107,32 +107,32 @@ R3.API.Matrix4.prototype.rotationMatrixY = function (radians) {
return this;
};
R3.API.Matrix4.prototype.rotationMatrixZ = function (radians) {
R3.API.Matrix4.prototype.rotationMatrixZ = function(radians) {
this.identity();
this.rows[0] = new R3.API.Vector4(Math.cos(radians), -1 * Math.sin(radians), 0, 0);
this.rows[1] = new R3.API.Vector4(Math.sin(radians), Math.cos(radians), 0, 0);
return this;
};
R3.API.Matrix4.prototype.rotateX = function (radians, point) {
R3.API.Matrix4.prototype.rotateX = function(radians, point) {
this.identity();
this.rotationMatrixX(radians);
return this.multiply(point);
};
R3.API.Matrix4.prototype.rotateY = function (radians, point) {
R3.API.Matrix4.prototype.rotateY = function(radians, point) {
this.identity();
this.rotationMatrixY(radians);
return this.multiply(point);
};
R3.API.Matrix4.prototype.rotateZ = function (radians, point) {
R3.API.Matrix4.prototype.rotateZ = function(radians, point) {
this.identity();
this.rotationMatrixZ(radians);
return this.multiply(point);
};
R3.API.Matrix4.prototype.multiply = function (mvp) {
R3.API.Matrix4.prototype.multiply = function(mvp) {
if (mvp instanceof R3.API.Quaternion || mvp instanceof R3.API.Vector4) {
return new R3.API.Quaternion(
this.rows[0].x * mvp.x + this.rows[0].y * mvp.y + this.rows[0].z * mvp.z + this.rows[0].w * mvp.w,
@ -149,7 +149,7 @@ R3.API.Matrix4.prototype.multiply = function (mvp) {
}
};
R3.API.Matrix4.prototype.identity = function () {
R3.API.Matrix4.prototype.identity = function() {
this.rows = [
new R3.API.Vector4(1, 0, 0, 0),
new R3.API.Vector4(0, 1, 0, 0),

View File

@ -2,7 +2,7 @@
* API Mouse
* @param id
* @param name
* @param parentEntity
* @param parent
* @param x
* @param y
* @constructor
@ -10,7 +10,7 @@
R3.API.Mouse = function(
id,
name,
parentEntity,
parent,
x,
y
) {
@ -37,7 +37,7 @@ R3.API.Mouse = function(
R3.API.Component.call(
this,
R3.Component.MOUSE,
parentEntity
parent
);
};

View File

@ -1,9 +1,9 @@
R3.API.Plane = function (
R3.API.Plane = function(
id,
name,
normal,
constant,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -29,7 +29,7 @@ R3.API.Plane = function (
R3.API.Component.call(
this,
R3.Component.PLANE,
parentEntity
parent
);
};
@ -42,12 +42,12 @@ R3.API.Plane.prototype.constructor = R3.API.Plane;
* @param objectPlane
* @constructor
*/
R3.API.Plane.FromObject = function (objectPlane) {
R3.API.Plane.FromObject = function(objectPlane) {
return new R3.API.Plane(
objectPlane.id,
objectPlane.name,
R3.API.Vector3.FromObject(objectPlane.normal),
objectPlane.constant,
objectPlane.parentEntity
objectPlane.parent
);
};

View File

@ -2,28 +2,24 @@
* API Project
* @param id
* @param name
* @param parentEntity
* @param parent
* @param users
* @param isPublic
* @param entities
* @param renderers
* @param cameras
* @param cameraIndex
* @param controls
* @param mode
* @constructor
*/
R3.API.Project = function(
id,
name,
parentEntity,
parent,
users,
isPublic,
entities,
renderers,
cameras,
cameraIndex,
controls,
mode
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -71,38 +67,25 @@ R3.API.Project = function(
}
this.cameras = cameras;
if (R3.Utils.UndefinedOrNull(cameraIndex)) {
cameraIndex = R3.API.Project.CAMERA_INDEX_EDIT;
}
this.cameraIndex = cameraIndex;
if (R3.Utils.UndefinedOrNull(controls)) {
controls = new R3.API.Controls.D3.Orbit(
{
canvas: this.renderer.canvas
},
this.cameras[this.cameraIndex]
)
}
this.controls = controls;
if (R3.Utils.UndefinedOrNull(mode)) {
mode = R3.API.Project.DEFAULT_MODE_EDIT;
mode = R3.API.Project.APPLICATION_MODE_EDIT;
}
this.mode = mode;
R3.API.Component.call(
this,
R3.Component.PROJECT,
parentEntity
this.id,
this.name,
this.components,
this.parent
);
};
R3.API.Project.prototype = Object.create(R3.API.Component.prototype);
R3.API.Project.prototype.constructor = R3.API.Project;
R3.API.Project.DEFAULT_MODE_RUN = 0x1;
R3.API.Project.DEFAULT_MODE_EDIT = 0x2;
R3.API.Project.APPLICATION_MODE_RUN = 0x1;
R3.API.Project.APPLICATION_MODE_EDIT = 0x2;
R3.API.Project.CAMERA_INDEX_EDIT = 0x0;
R3.API.Project.CAMERA_INDEX_RUN = 0x1;

View File

@ -8,7 +8,7 @@
* @param angle
* @constructor
*/
R3.API.Quaternion = function (
R3.API.Quaternion = function(
x,
y,
z,
@ -48,14 +48,14 @@ R3.API.Quaternion = function (
this.angle = angle;
};
R3.API.Quaternion.prototype.translate = function (v) {
R3.API.Quaternion.prototype.translate = function(v) {
this.x += v.x;
this.y += v.y;
this.z += v.z;
return this;
};
R3.API.Quaternion.prototype.copy = function () {
R3.API.Quaternion.prototype.copy = function() {
return new R3.API.Quaternion(
this.x,
this.y,
@ -67,7 +67,7 @@ R3.API.Quaternion.prototype.copy = function () {
/**
* Note, this normalize function leaves 'w' component untouched
*/
R3.API.Quaternion.prototype.normalize = function () {
R3.API.Quaternion.prototype.normalize = function() {
var EPSILON = 0.000001;
@ -84,7 +84,7 @@ R3.API.Quaternion.prototype.normalize = function () {
this.z *= invLength;
};
R3.API.Quaternion.prototype.multiply = function (q) {
R3.API.Quaternion.prototype.multiply = function(q) {
var x, y, z, w;
var a = q;
@ -124,7 +124,7 @@ R3.API.Quaternion.prototype.multiply = function (q) {
}
};
R3.API.Quaternion.prototype.setFromAngle = function (angle) {
R3.API.Quaternion.prototype.setFromAngle = function(angle) {
this.instance.setFromAxisAngle(this.axis.instance, angle);
@ -136,7 +136,7 @@ R3.API.Quaternion.prototype.setFromAngle = function (angle) {
return this;
};
R3.API.Quaternion.prototype.subtract = function (v) {
R3.API.Quaternion.prototype.subtract = function(v) {
if (v instanceof R3.API.Vector3) {
this.x -= v.x;
@ -154,7 +154,7 @@ R3.API.Quaternion.prototype.subtract = function (v) {
return this;
};
R3.API.Quaternion.prototype.magnitude = function () {
R3.API.Quaternion.prototype.magnitude = function() {
return Math.sqrt(
(this.x * this.x) +
(this.y * this.y) +
@ -163,7 +163,7 @@ R3.API.Quaternion.prototype.magnitude = function () {
);
};
R3.API.Quaternion.prototype.normalize = function () {
R3.API.Quaternion.prototype.normalize = function() {
var magnitude = this.magnitude();
@ -199,7 +199,7 @@ R3.API.Quaternion.prototype.setFromRotationMatrix = function(matrix4) {
* @param t
* @returns {R3.Quaternion}
*/
R3.API.Quaternion.prototype.slerp = function (quaternion, t) {
R3.API.Quaternion.prototype.slerp = function(quaternion, t) {
this.updateInstance();
@ -218,7 +218,7 @@ R3.API.Quaternion.prototype.slerp = function (quaternion, t) {
* @param objectQuaternion
* @constructor
*/
R3.API.Quaternion.FromObject = function (objectQuaternion) {
R3.API.Quaternion.FromObject = function(objectQuaternion) {
var apiAxis = null;

View File

@ -1,8 +1,8 @@
R3.API.Quaternion.Points = function () {
R3.API.Quaternion.Points = function() {
this.vectors = [];
};
R3.API.Quaternion.Points.prototype.add = function (vector) {
R3.API.Quaternion.Points.prototype.add = function(vector) {
if (vector instanceof R3.API.Vector3) {
vector = new R3.API.Quaternion(
@ -23,7 +23,7 @@ R3.API.Quaternion.Points.prototype.add = function (vector) {
return this;
};
R3.API.Quaternion.Points.prototype.copy = function () {
R3.API.Quaternion.Points.prototype.copy = function() {
var vectors = [];
@ -34,7 +34,7 @@ R3.API.Quaternion.Points.prototype.copy = function () {
return vectors;
};
R3.API.Quaternion.Points.prototype.maximizeXDistance = function (grain) {
R3.API.Quaternion.Points.prototype.maximizeXDistance = function(grain) {
// console.log("vectors (before): " + JSON.stringify(this.vectors, null, 2));
@ -79,7 +79,7 @@ R3.API.Quaternion.Points.prototype.maximizeXDistance = function (grain) {
};
R3.API.Quaternion.Points.prototype.maximizeYDistance = function (grain) {
R3.API.Quaternion.Points.prototype.maximizeYDistance = function(grain) {
// console.log("vectors (before): " + JSON.stringify(this.vectors, null, 2));
@ -124,7 +124,7 @@ R3.API.Quaternion.Points.prototype.maximizeYDistance = function (grain) {
};
R3.API.Quaternion.Points.prototype.lookAt = function (at, up) {
R3.API.Quaternion.Points.prototype.lookAt = function(at, up) {
var polyCenter = this.average();
@ -145,7 +145,7 @@ R3.API.Quaternion.Points.prototype.lookAt = function (at, up) {
}
};
R3.API.Quaternion.Points.prototype.distances = function () {
R3.API.Quaternion.Points.prototype.distances = function() {
var minX = this.vectors[0].x;
var minY = this.vectors[0].y;
@ -184,7 +184,7 @@ R3.API.Quaternion.Points.prototype.distances = function () {
)
};
R3.API.Quaternion.Points.prototype.average = function () {
R3.API.Quaternion.Points.prototype.average = function() {
var averageX = 0;
var averageY = 0;
var averageZ = 0;
@ -202,7 +202,7 @@ R3.API.Quaternion.Points.prototype.average = function () {
);
};
R3.API.Quaternion.Points.prototype.negate = function () {
R3.API.Quaternion.Points.prototype.negate = function() {
for (var i = 0; i < this.vectors.length; i++) {
this.vectors[i].x *= -1;
@ -214,7 +214,7 @@ R3.API.Quaternion.Points.prototype.negate = function () {
};
R3.API.Quaternion.Points.prototype.toOrigin = function () {
R3.API.Quaternion.Points.prototype.toOrigin = function() {
var distanceFromOrigin = this.average().negate();

View File

@ -3,22 +3,15 @@
* @param id
* @param name
* @param rendererType
* @param parentEntity
* @param width
* @param height
* @param offset
* @param parent
* @param canvas
* @constructor
*/
R3.API.Renderer = function (
R3.API.Renderer = function(
id,
name,
rendererType,
parentEntity,
width,
height,
offset,
canvas
parent,
rendererType
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -51,30 +44,10 @@ R3.API.Renderer = function (
}
this.name = name;
if (R3.Utils.UndefinedOrNull(width)) {
width = 1;
}
this.width = width;
if (R3.Utils.UndefinedOrNull(height)) {
height = 1;
}
this.height = height;
if (R3.Utils.UndefinedOrNull(offset)) {
offset = new R3.API.Vector2(0,0);
}
this.offset = offset;
if (R3.Utils.UndefinedOrNull(canvas)) {
canvas = new R3.API.Canvas();
}
this.canvas = canvas;
R3.API.Component.call(
this,
R3.API.Renderer.GetComponentType(this.rendererType),
parentEntity
parent
);
};
@ -93,8 +66,14 @@ R3.API.Renderer.GetComponentType = function(rendererType) {
case R3.API.Renderer.RENDERER_TYPE_2D :
componentType = R3.Component.RENDERER_D2;
break;
case R3.API.Renderer.RENDERER_TYPE_3D :
componentType = R3.Component.RENDERER_D3;
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');
@ -104,9 +83,11 @@ R3.API.Renderer.GetComponentType = function(rendererType) {
return componentType;
};
R3.API.Renderer.RENDERER_TYPE_NONE = 0x0;
R3.API.Renderer.RENDERER_TYPE_2D = 0x1;
R3.API.Renderer.RENDERER_TYPE_3D = 0x2;
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;
@ -120,15 +101,3 @@ R3.API.Renderer.TONE_MAPPING_LINEAR = 1;
R3.API.Renderer.TONE_MAPPING_REINHARD = 2;
R3.API.Renderer.TONE_MAPPING_UNCHARTED_2 = 3;
R3.API.Renderer.TONE_MAPPING_CINEON = 4;
R3.API.Renderer.ASPECT_RATIO_NONE = 0x1;
R3.API.Renderer.ASPECT_RATIO_4_3 = 0x2;
R3.API.Renderer.ASPECT_RATIO_3_2 = 0x3;
R3.API.Renderer.ASPECT_RATIO_16_10 = 0x4;
R3.API.Renderer.ASPECT_RATIO_17_10 = 0x5;
R3.API.Renderer.ASPECT_RATIO_16_9 = 0x6;
R3.API.Renderer.SCALE_MODE_NONE = 0x1;
R3.API.Renderer.SCALE_MODE_LETTERBOX = 0x2;
R3.API.Renderer.SCALE_MODE_ZOOM_TO_BIGGER = 0x3;
R3.API.Renderer.SCALE_MODE_NON_UNIFORM = 0x4;

View File

@ -2,9 +2,11 @@
* R3.API.Renderer.D2
* @constructor
* @param apiRenderer
* @param canvas
*/
R3.API.Renderer.D2 = function (
apiRenderer
R3.API.Renderer.D2 = function(
apiRenderer,
canvas
) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
@ -21,14 +23,15 @@ R3.API.Renderer.D2 = function (
this,
apiRenderer.id,
apiRenderer.name,
apiRenderer.rendererType,
apiRenderer.parentEntity,
apiRenderer.width,
apiRenderer.height,
apiRenderer.offset,
apiRenderer.canvas
apiRenderer.parent,
apiRenderer.rendererType
);
if (R3.Utils.UndefinedOrNull(canvas)) {
canvas = new R3.API.Canvas();
}
this.canvas = canvas;
};
R3.API.Renderer.D2.prototype = Object.create(R3.API.Renderer.prototype);

View File

@ -0,0 +1,296 @@
/**
* 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
* @constructor
*/
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
) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
apiRenderer = {
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
};
}
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(
this,
apiRenderer.id,
apiRenderer.name,
apiRenderer.parent,
apiRenderer.rendererType,
apiRenderer.canvas
);
};
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3;

View File

@ -0,0 +1,274 @@
/**
* 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
* @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
) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
apiRenderer = {
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
};
}
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(
this,
apiRenderer.id,
apiRenderer.name,
apiRenderer.parent,
apiRenderer.rendererType,
apiRenderer.canvas
);
};
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3;

View File

@ -0,0 +1,296 @@
/**
* 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
* @constructor
*/
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
) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
apiRenderer = {
rendererType : R3.API.Renderer.RENDERER_TYPE_3D
};
}
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(
this,
apiRenderer.id,
apiRenderer.name,
apiRenderer.parent,
apiRenderer.rendererType,
apiRenderer.canvas
);
};
R3.API.Renderer.D3.prototype = Object.create(R3.API.Renderer.prototype);
R3.API.Renderer.D3.prototype.constructor = R3.API.Renderer.D3;

View File

@ -35,17 +35,13 @@
* @param viewports
* @param alpha
* @param opacity
* @param logicalSize
* @param aspectRatio
* @param scaleMode
* @param scenes
* @param composers
* @param effects
* @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 enableEffects
* @param enableEffect
* @constructor
*/
R3.API.Renderer.D3 = function (
R3.API.Renderer.D3 = function(
apiRenderer,
renderMode,
autoClear,
@ -80,12 +76,7 @@ R3.API.Renderer.D3 = function (
clearColor,
viewports,
alpha,
opacity,
scenes,
composers,
effect,
enableComposer,
enableEffect
opacity
) {
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
@ -249,19 +240,12 @@ R3.API.Renderer.D3 = function (
this.clippingPlanes = clippingPlanes;
if (R3.Utils.UndefinedOrNull(clearColor)) {
clearColor = new R3.API.Color(0.11, 0.11, 0.11);
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(
null,
null,
1,
1,
0,
0
)];
viewports = [new R3.D3.API.Viewport()];
}
this.viewports = viewports;
@ -275,15 +259,34 @@ 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.parentEntity,
apiRenderer.width,
apiRenderer.height,
apiRenderer.offset,
apiRenderer.canvas
);

View File

@ -10,7 +10,7 @@
* @param preferIp - Set to true to use IP instead of resolving DNS at getUrl() runtime
* @param port
* @param protocols
* @param parentEntity
* @param parent
* @constructor
*/
R3.API.Server = function(
@ -24,7 +24,7 @@ R3.API.Server = function(
preferIp,
port,
protocols,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -80,7 +80,7 @@ R3.API.Server = function(
R3.API.Component.call(
this,
R3.Component.SERVER,
parentEntity
parent
);
};

View File

@ -6,7 +6,7 @@
* @param roomId
* @param peerId
* @param server R3.Server
* @param parentEntity
* @param parent
* @constructor
*/
R3.API.Socket = function(
@ -16,7 +16,7 @@ R3.API.Socket = function(
roomId,
peerId,
server,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -87,7 +87,7 @@ R3.API.Socket = function(
R3.API.Component.call(
this,
R3.API.Socket.GetComponentType(this.socketType),
parentEntity
parent
);
};

View File

@ -46,7 +46,7 @@ R3.API.Socket.Cast = function(
apiSocket.roomId,
apiSocket.peerId,
apiSocket.server,
apiSocket.parentEntity
apiSocket.parent
);
};

View File

@ -46,7 +46,7 @@ R3.API.Socket.Receive = function(
apiSocket.roomId,
apiSocket.peerId,
apiSocket.server,
apiSocket.parentEntity
apiSocket.parent
);
};

View File

@ -4,7 +4,7 @@
* @param center
* @param radius
*/
R3.API.Sphere = function (
R3.API.Sphere = function(
center,
radius
) {

View File

@ -3,14 +3,14 @@
* @param id
* @param name
* @param domElement
* @param parentEntity
* @param parent
* @constructor
*/
R3.API.Stats = function(
id,
name,
domElement,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -31,7 +31,7 @@ R3.API.Stats = function(
R3.API.Component.call(
this,
R3.Component.STATS,
parentEntity
parent
);
};
@ -58,7 +58,7 @@ R3.API.Stats.FromObject = function(objectStats) {
objectStats.id,
objectStats.name,
apiDomElement,
objectStats.parentEntity
objectStats.parent
);
};

View File

@ -3,14 +3,14 @@
* @param id String
* @param name String
* @param systemType
* @param parentEntity
* @param parent
* @constructor
*/
R3.API.System = function (
R3.API.System = function(
id,
name,
systemType,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -81,7 +81,7 @@ R3.API.System = function (
R3.API.Component.call(
this,
componentType,
parentEntity
parent
);
};
@ -99,6 +99,6 @@ R3.API.System.FromObject = function(objectComponent) {
objectComponent.id,
objectComponent.name,
objectComponent.systemType,
objectComponent.parentEntity
objectComponent.parent
);
};

View File

@ -2,7 +2,7 @@
* API User
* @param id
* @param name
* @param parentEntity
* @param parent
* @param googleId
* @param fullName
* @param givenName
@ -16,7 +16,7 @@
R3.API.User = function(
id,
name,
parentEntity,
parent,
googleId,
fullName,
givenName,
@ -79,7 +79,7 @@ R3.API.User = function(
R3.API.Component.call(
this,
R3.Component.USER,
parentEntity
parent
);
};

View File

@ -1,4 +1,10 @@
R3.API.Vector2 = function (x, y) {
/**
* R3.API.Vector2
* @param x
* @param y
* @constructor
*/
R3.API.Vector2 = function(x, y) {
if (R3.Utils.UndefinedOrNull(x)) {
x = 0;
@ -9,34 +15,134 @@ R3.API.Vector2 = function (x, y) {
y = 0;
}
this.y = y;
};
R3.API.Vector2.prototype.copy = function () {
return new R3.API.Vector2(
this.x,
this.y
);
};
R3.API.Vector2.prototype.equals = function (v) {
return this.x === v.x && this.y === v.y;
};
/**
* Returns an API vector from an Object vector
* @param objectVector
* @constructor
* Equals
* TODO: Test
* @param v
* @returns {boolean}
*/
R3.API.Vector2.FromObject = function (objectVector) {
R3.API.Vector2.prototype.equals = function(v) {
if (R3.Utils.UndefinedOrNull(objectVector)) {
console.warn('vector from db undefined - stale version in db');
objectVector = {};
if ((this.x === v.x) &&
(this.y === v.y)) {
return true;
} else {
return false;
}
return new R3.API.Vector2(
objectVector.x,
objectVector.y
)
};
/**
* Add
* TODO: Test
* @param v
*/
R3.API.Vector2.prototype.add = function(v) {
this.x += v.x;
this.y += v.y;
return this;
};
/**
* Subtract
* TODO: Test
* @param v
*/
R3.API.Vector2.prototype.subtract = function(v) {
this.x -= v.x;
this.y -= v.y;
return this;
};
/**
* Multiply
* TODO: Test
* @param v
*/
R3.API.Vector2.prototype.multiply = function(v) {
this.x *= v.x;
this.y *= v.y;
return this;
};
/**
* Divide
* TODO: Test
* @param v
*/
R3.API.Vector2.prototype.divide = function(v) {
this.x *= (1.0 / v.x);
this.y *= (1.0 / v.y);
return this;
};
/**
* Clamp
* TODO: Test
* @param min R3.API.Vector2
* @param max R3.API.Vector2
* @returns {R3.API.Vector2}
*/
R3.API.Vector2.prototype.clamp = function(min, max) {
this.x = Math.max(min.x, Math.min(max.x, this.x));
this.y = Math.max(min.y, Math.min(max.y, this.y));
return this;
};
/**
* Length
* TODO: Test
* @returns {number}
*/
R3.API.Vector2.prototype.length = function() {
return Math.sqrt(
this.x * this.x + this.y * this.y
);
};
/**
* Dot product
* TODO: Test
* @param v
* @returns {number}
*/
R3.API.Vector2.prototype.dot = function(v) {
return this.x * v.x + this.y * v.y;
};
/**
* Normalize
* TODO: Test
*/
R3.API.Vector2.prototype.normalize = function() {
return this.multiply(1.0 / this.length());
};
/**
* TODO: Test
* Angle between this vector and origin
* @returns {number}
*/
R3.API.Vector2.prototype.angle = function() {
var angle = Math.atan2(this.y, this.x);
if ( angle < 0 ) angle += 2 * Math.PI;
return angle;
};
/**
* Interpolate to v from here
* TODO: Test
* @param v
* @param alpha
* @returns {R3.API.Vector2}
*/
R3.API.Vector2.prototype.lerp = function( v, alpha ) {
this.x += ( v.x - this.x ) * alpha;
this.y += ( v.y - this.y ) * alpha;
return this;
};

View File

@ -1,4 +1,11 @@
R3.API.Vector3 = function (x, y, z) {
/**
* R3.API.Vector3
* @param x
* @param y
* @param z
* @constructor
*/
R3.API.Vector3 = function(x, y, z) {
if (R3.Utils.UndefinedOrNull(x)) {
x = 0;
@ -17,6 +24,13 @@ R3.API.Vector3 = function (x, y, z) {
};
R3.API.Vector3.prototype.setFrom = function(vector3) {
this.x = vector3.x;
this.y = vector3.y;
this.z = vector3.z;
return this;
};
R3.API.Vector3.prototype.negate = function() {
this.x = -this.x;
this.y = -this.y;
@ -24,71 +38,55 @@ R3.API.Vector3.prototype.negate = function() {
return this;
};
R3.API.Vector3.prototype.subtract = function (v) {
return new R3.API.Vector3(
this.x - v.x,
this.y - v.y,
this.z - v.z
);
R3.API.Vector3.prototype.subtract = function(v) {
this.x -= v.x;
this.y -= v.y;
this.z -= v.z;
return this;
};
R3.API.Vector3.prototype.sub = function (v) {
return new R3.API.Vector3(
this.x - v.x,
this.y - v.y,
this.z - v.z
);
R3.API.Vector3.prototype.sub = function(v) {
return this.subtract(v);
};
R3.API.Vector3.prototype.equals = function (v) {
R3.API.Vector3.prototype.equals = function(v) {
return this.x === v.x && this.y === v.y && this.z === v.z;
};
R3.API.Vector3.prototype.cross = function (v) {
return new R3.API.Vector3(
this.y * v.z - this.z * v.y,
this.z * v.x - this.x * v.z,
this.x * v.y - this.y * v.x
);
R3.API.Vector3.prototype.cross = function(v) {
var x = this.y * v.z - this.z * v.y;
var y = this.z * v.x - this.x * v.z;
var z = this.x * v.y - this.y * v.x;
this.x = x;
this.y = y;
this.z = z;
return this;
};
R3.API.Vector3.clockwise = function (u, v, w, viewPoint) {
var normal = R3.API.Vector3.normal(u, v, w);
var uv = u.copy();
var winding = normal.dot(uv.subtract(viewPoint));
return (winding > 0);
};
R3.API.Vector3.normal = function (u, v, w) {
var vv = v.copy();
var wv = w.copy();
return vv.subtract(u).cross(wv.subtract(u));
};
R3.API.Vector3.prototype.lookAt = function (at, up) {
R3.API.Vector3.prototype.lookAt = function(at, up) {
var lookAtMatrix = R3.API.Matrix4.lookAt(this, at, up);
return this.multiply(lookAtMatrix);
};
R3.API.Vector3.prototype.translate = function (v) {
R3.API.Vector3.prototype.translate = function(v) {
this.x += v.x;
this.y += v.y;
this.z += v.z;
return this;
};
R3.API.Vector3.prototype.add = function (v) {
R3.API.Vector3.prototype.add = function(v) {
this.x += v.x;
this.y += v.y;
this.z += v.z;
return this;
};
R3.API.Vector3.prototype.squared = function () {
R3.API.Vector3.prototype.squared = function() {
return this.x * this.x + this.y * this.y + this.z * this.z;
};
R3.API.Vector3.prototype.copy = function () {
R3.API.Vector3.prototype.copy = function() {
return new R3.API.Vector3(
this.x,
this.y,
@ -96,18 +94,23 @@ R3.API.Vector3.prototype.copy = function () {
);
};
R3.API.Vector3.prototype.set = function (x, y, z) {
R3.API.Vector3.prototype.set = function(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
};
R3.API.Vector3.prototype.lerp = function ( v, alpha ) {
return new R3.API.Vector3(
this.x + ( v.x - this.x ) * alpha,
this.y + ( v.y - this.y ) * alpha,
this.z + ( v.z - this.z ) * alpha
);
R3.API.Vector3.prototype.lerp = function( v, alpha ) {
var x = this.x + ( v.x - this.x ) * alpha;
var y = this.y + ( v.y - this.y ) * alpha;
var z = this.z + ( v.z - this.z ) * alpha;
this.x = x;
this.y = y;
this.z = z;
return this;
};
R3.API.Vector3.prototype.distanceTo = function(v) {
@ -135,11 +138,11 @@ R3.API.Vector3.AngleDirection = function(forward, directionToCheck, up) {
/**
* Multiplies this vector with a scalar, vector or matrix. If you want a copy, copy() it first
* @param object {Number | R3.API.Vector3 | R3.API.Vector4 | R3.API.Matrix3 | R3.API.Matrix4}
* @param object {Number | R3.API.Vector3 | R3.Vector4 | R3.API.Matrix3 | R3.API.Matrix4}
* @param cross boolean true if you want the cross product, otherwise returns the scalar (dot or inner) product
* @returns {R3.API.Vector3 | Number}
*/
R3.API.Vector3.prototype.multiply = function (object, cross) {
R3.API.Vector3.prototype.multiply = function(object, cross) {
var x, y, z;
@ -188,11 +191,11 @@ R3.API.Vector3.prototype.multiply = function (object, cross) {
};
R3.API.Vector3.prototype.dot = function (v) {
R3.API.Vector3.prototype.dot = function(v) {
return (this.x * v.x) + (this.y * v.y) + (this.z * v.z);
};
R3.API.Vector3.prototype.normalize = function () {
R3.API.Vector3.prototype.normalize = function() {
var EPSILON = 0.000001;
var v2 = this.squared();
@ -201,19 +204,12 @@ R3.API.Vector3.prototype.normalize = function () {
}
var invLength = 1.0 / Math.sqrt(v2);
return new R3.API.Vector3(
this.x * invLength,
this.y * invLength,
this.z * invLength
);
};
R3.API.Vector3.prototype.clone = function () {
return new R3.API.Vector3(
this.x,
this.y,
this.z
);
this.x *= invLength;
this.y *= invLength;
this.z *= invLength;
return this;
};
R3.API.Vector3.prototype.applyQuaternion = function(q) {
@ -252,26 +248,7 @@ R3.API.Vector3.prototype.reflect = function(normal) {
return this.sub( v1.copy( normal ).multiply( 2 * this.dot( normal ) ) );
};
R3.API.Vector3.prototype.angleTo = function (v) {
R3.API.Vector3.prototype.angleTo = function(v) {
var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) );
return Math.acos( exports.Math.clamp( theta, - 1, 1 ) );
};
/**
* Returns an API vector from an Object vector
* @param objectVector
* @constructor
*/
R3.API.Vector3.FromObject = function (objectVector) {
if (R3.Utils.UndefinedOrNull(objectVector)) {
console.warn('vector from db undefined - stale version in db');
objectVector = {};
}
return new R3.API.Vector3(
objectVector.x,
objectVector.y,
objectVector.z
)
};

View File

@ -1,46 +1,31 @@
R3.API.Vector4 = function (x, y, z, w) {
if (R3.Utils.UndefinedOrNull(x)) {
x = 0;
}
this.x = x;
if (R3.Utils.UndefinedOrNull(y)) {
y = 0;
}
this.y = y;
if (R3.Utils.UndefinedOrNull(z)) {
z = 0;
}
this.z = z;
if (R3.Utils.UndefinedOrNull(w)) {
w = 1;
}
this.w = w;
};
R3.API.Vector4.prototype.equals = function (v) {
return this.x === v.x && this.y === v.y && this.z === v.z && this.w === v.w;
};
/**
* Returns an API vector from an Object vector
* @param objectVector
* R3.API.Vector4
* @param x
* @param y
* @param z
* @param w
* @constructor
*/
R3.API.Vector4.FromObject = function (objectVector) {
R3.API.Vector4 = function(x, y, z, w) {
if (R3.Utils.UndefinedOrNull(objectVector)) {
console.warn('vector from db undefined - stale version in db');
objectVector = {};
}
if (R3.Utils.UndefinedOrNull(x)) {
x = 0;
}
this.x = x;
if (R3.Utils.UndefinedOrNull(y)) {
y = 0;
}
this.y = y;
if (R3.Utils.UndefinedOrNull(z)) {
z = 0;
}
this.z = z;
if (R3.Utils.UndefinedOrNull(w)) {
w = 0;
}
this.w = w;
return new R3.API.Vector4(
objectVector.x,
objectVector.y,
objectVector.z,
objectVector.w
)
};

View File

@ -2,7 +2,7 @@
* R3.API.Video
* @param id
* @param name
* @param parentEntity
* @param parent
* @param autoUpdateSize
* @param width
* @param height
@ -13,7 +13,7 @@
R3.API.Video = function(
id,
name,
parentEntity,
parent,
autoUpdateSize,
width,
height,
@ -60,7 +60,7 @@ R3.API.Video = function(
R3.API.Component.call(
this,
R3.Component.VIDEO,
parentEntity
parent
);
};

View File

@ -1,49 +1,46 @@
/**
* R3.Box3
* @param implementation
* @param apiBox3
* @param parentObject
* @constructor
*/
R3.Box3 = function (
implementation,
apiBox3,
parentObject
R3.Box3 = function(
apiBox3
) {
this.implementation = implementation;
this.implementation.isNotThreeThrow();
if (R3.Utils.UndefinedOrNull(parentObject)) {
parentObject = null;
}
this.parentObject = parentObject;
if (R3.Utils.UndefinedOrNull(apiBox3)) {
apiBox3 = {};
}
R3.API.Box3.call(
R3.API.Box3.call(
this,
apiBox3.id,
apiBox3.name,
apiBox3.parentEntity,
apiBox3,
apiBox3.min,
apiBox3.max
);
this.min = new R3.Vector3(
this.implementation,
this,
this.min,
this
);
this.max = new R3.Vector3(
this.implementation,
this.max,
this
this,
this.max
);
this.graphics = null;
this.physics = null;
R3.Event.Emit(
R3.Event.GET_RUNTIME,
function(runtime) {
this.graphics = runtime.graphics;
this.physics = runtime.physics;
}.bind(this)
);
this.componentRuntime = R3.Component.GetComponentRuntime(parent);
this.createInstance();
};
@ -56,10 +53,22 @@ R3.Box3.prototype.constructor = R3.Box3;
*/
R3.Box3.prototype.createInstance = function() {
this.instance = new THREE.Box3(
this.min.instance,
this.max.instance
);
switch (this.componentRuntime) {
case R3.Component.GRAPHICS_RUNTIME :
this.instance = this.graphics.Box3(
this.min,
this.max
);
break;
case R3.Component.PHYSICS_RUNTIME :
this.instance = this.physics.Box3(
this.min,
this.max
);
break;
default:
throw new Error('unhandled component runtime: ' + this.componentRuntime);
}
};
@ -88,9 +97,11 @@ R3.Box3.prototype.updateInstance = function(property) {
*/
R3.Box3.prototype.toApiObject = function() {
return new R3.API.Box3(
this.id,
this.name,
R3.Utils.IdOrNull(this.parentEntity),
new R3.API.Component(
this.parent,
this.id,
this.name
),
this.min.toApiObject(),
this.max.toApiObject()
);

View File

@ -19,7 +19,7 @@ R3.Canvas = function(
this,
apiCanvas.id,
apiCanvas.name,
apiCanvas.parentEntity,
apiCanvas.parent,
apiCanvas.parentTexture,
apiCanvas.autoUpdateSize,
apiCanvas.width,
@ -163,7 +163,7 @@ R3.Canvas.prototype.toApiObject = function() {
return new R3.API.Canvas(
this.id,
this.name,
R3.Utils.IdOrNull(this.parentEntity),
R3.Utils.IdOrNull(this.parent),
R3.Utils.IdOrNull(this.parentTexture),
this.autoUpdateSize,
this.width,

View File

@ -20,7 +20,7 @@ R3.Clock = function(
this,
apiClock.id,
apiClock.name,
apiClock.parentEntity
apiClock.parent
);
R3.Component.call(this);
@ -72,7 +72,7 @@ R3.Clock.prototype.toApiObject = function() {
return new R3.API.Clock(
this.id,
this.name,
R3.Utils.IdOrNull(this.parentEntity)
R3.Utils.IdOrNull(this.parent)
);
};

View File

@ -6,7 +6,7 @@
* @param grain Number
* @constructor
*/
R3.Color = function (
R3.Color = function(
graphics,
apiColor,
parentObject,
@ -76,7 +76,7 @@ R3.Color.prototype.updateInstance = function(property) {
* @returns {R3.API.Color}
*/
R3.Color.prototype.toApiObject = function() {
return new R3.API.Color(
return new R3.API.Color(this,
this.r,
this.g,
this.b,

View File

@ -4,7 +4,7 @@
* @property controlsType
* @constructor
*/
R3.Controls = function (
R3.Controls = function(
apiControls
) {
@ -16,9 +16,8 @@ R3.Controls = function (
this,
apiControls.id,
apiControls.name,
apiControls.controlsType,
apiControls.canvas,
apiControls.parentEntity
apiControls.parent
);
var linkedObjects = {
@ -93,7 +92,7 @@ R3.Controls.prototype.toApiObject = function() {
this.name,
this.controlsType,
R3.Utils.IdOrNull(this.canvas),
R3.Utils.IdOrNull(this.parentEntity)
R3.Utils.IdOrNull(this.parent)
);
return apiControls;

View File

@ -4,7 +4,7 @@
* @param apiEditorControls
* @constructor
*/
R3.Controls.D3.Editor = function (
R3.Controls.D3.Editor = function(
graphics,
apiEditorControls
) {

View File

@ -4,7 +4,7 @@
* @param apiFirstPersonControls
* @constructor
*/
R3.Controls.D3.FirstPerson = function (
R3.Controls.D3.FirstPerson = function(
graphics,
apiFirstPersonControls
) {

View File

@ -4,7 +4,7 @@
* @param apiOrbitControls
* @constructor
*/
R3.Controls.D3.Orbit = function (
R3.Controls.D3.Orbit = function(
graphics,
apiOrbitControls
) {

View File

@ -3,7 +3,7 @@
* @param apiKeyboardControls R3.API.Controls
* @constructor
*/
R3.Controls.Keyboard = function (
R3.Controls.Keyboard = function(
apiKeyboardControls
) {

View File

@ -3,7 +3,7 @@
* @param apiMouseControls R3.API.Controls
* @constructor
*/
R3.Controls.Mouse = function (
R3.Controls.Mouse = function(
apiMouseControls
) {

View File

@ -3,7 +3,7 @@
* @constructor
* @param apiTouchControls
*/
R3.Controls.Touch = function (
R3.Controls.Touch = function(
apiTouchControls
) {

View File

@ -22,7 +22,7 @@ R3.Curve = function(
apiCurve.id,
apiCurve.name,
apiCurve.curveType,
apiCurve.parentEntity,
apiCurve.parent,
apiCurve.arcLenghDivisions
);
@ -80,7 +80,7 @@ R3.Curve.prototype.toApiObject = function() {
this.id,
this.name,
this.curveType,
R3.Utils.IdOrNull(this.parentEntity),
R3.Utils.IdOrNull(this.parent),
this.arcLenghDivisions
);

View File

@ -17,7 +17,7 @@ R3.CustomCode = function(
apiCustomCode.name,
apiCustomCode.eventId,
apiCustomCode.code,
apiCustomCode.parentEntity
apiCustomCode.parent
);
this.editor = null;
@ -62,7 +62,7 @@ R3.CustomCode.prototype.updateInstance = function(property) {
try {
this.instance = new Function('data', this.code).bind(this);
this.publish(
this.emit(
R3.Event.COMPILE_SUCCESS,
{
component: this
@ -70,7 +70,7 @@ R3.CustomCode.prototype.updateInstance = function(property) {
)
} catch (error) {
this.instance = new Function('data', "console.log('compilation update failed for : " + this.name + "');").bind(this);
this.publish(
this.emit(
R3.Event.COMPILE_FAILED,
{
component: this
@ -82,7 +82,7 @@ R3.CustomCode.prototype.updateInstance = function(property) {
}
if (property === 'eventId') {
this.publish(
this.emit(
R3.Event.EVENT_ID_UPDATE,
{
component : this
@ -104,7 +104,7 @@ R3.CustomCode.prototype.toApiObject = function() {
this.name,
this.eventId,
this.code,
R3.Utils.IdOrNull(this.parentEntity)
R3.Utils.IdOrNull(this.parent)
);
};

View File

@ -3,7 +3,7 @@
* @param id
* @param name
* @param objectType
* @param parentEntity
* @param parent
* @param useQuaternion
* @param position
* @param quaternion
@ -17,7 +17,7 @@ R3.D3.API.Object = function(
id,
name,
objectType,
parentEntity,
parent,
useQuaternion,
position,
quaternion,
@ -115,7 +115,7 @@ R3.D3.API.Object = function(
R3.API.Component.call(
this,
R3.D3.API.Object.GetComponentType(this.objectType),
parentEntity
parent
);
};

View File

@ -11,10 +11,10 @@
* @param blocking
* @param applyToMeshWhenDone
* @param meshes
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.Animation = function (
R3.D3.API.Animation = function(
id,
name,
rotationSpeed,
@ -26,7 +26,7 @@ R3.D3.API.Animation = function (
blocking,
applyToMeshWhenDone,
meshes,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -90,7 +90,7 @@ R3.D3.API.Animation = function (
R3.API.Component.call(
this,
R3.Component.ANIMATION,
parentEntity
parent
);
};
@ -116,6 +116,6 @@ R3.D3.API.Animation.FromObject = function(objectComponent) {
objectComponent.blocking,
objectComponent.applyToMeshWhenDone,
objectComponent.meshes,
objectComponent.parentEntity
objectComponent.parent
);
};

View File

@ -8,7 +8,7 @@
* @param camera
* @param overplay
* @param paused
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.Audio = function(
@ -20,7 +20,7 @@ R3.D3.API.Audio = function(
camera,
overplay,
paused,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -66,7 +66,7 @@ R3.D3.API.Audio = function(
R3.API.Component.call(
this,
R3.Component.AUDIO,
parentEntity
parent
);
};
@ -98,7 +98,7 @@ R3.D3.API.Audio.FromObject = function(objectAudio) {
apiCamera,
objectAudio.overplay,
objectAudio.paused,
objectAudio.parentEntity
objectAudio.parent
);
};

View File

@ -4,7 +4,7 @@
* @param weight float
* @constructor
*/
R3.D3.API.BoneWeight = function (
R3.D3.API.BoneWeight = function(
boneIndex,
weight
) {

View File

@ -5,7 +5,7 @@
* @param parentBoneIds
* @constructor
*/
R3.D3.API.Bone = function (
R3.D3.API.Bone = function(
apiD3Object,
childBoneIds,
parentBoneIds
@ -36,7 +36,7 @@ R3.D3.API.Bone = function (
apiD3Object.id,
apiD3Object.name,
apiD3Object.objectType,
apiD3Object.parentEntity,
apiD3Object.parent,
apiD3Object.useQuaternion,
apiD3Object.position,
apiD3Object.quaternion,

View File

@ -3,14 +3,14 @@
* @param id
* @param name
* @param broadphaseType
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.Broadphase = function(
id,
name,
broadphaseType,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -31,7 +31,7 @@ R3.D3.API.Broadphase = function(
R3.API.Component.call(
this,
R3.Component.BROADPHASE,
parentEntity
parent
);
};
@ -48,7 +48,7 @@ R3.D3.API.Broadphase.FromObject = function(objectBroadphase) {
objectBroadphase.id,
objectBroadphase.name,
objectBroadphase.broadphaseType,
objectBroadphase.parentEntity
objectBroadphase.parent
);
};

View File

@ -37,7 +37,7 @@ R3.D3.API.Camera = function(
apiD3Object.id,
apiD3Object.name,
apiD3Object.objectType,
apiD3Object.parentEntity,
apiD3Object.parent,
apiD3Object.useQuaternion,
apiD3Object.position,
apiD3Object.quaternion,

View File

@ -2,7 +2,7 @@
* R3.D3.API.Composer
* @param id
* @param name
* @param parentEntity
* @param parent
* @param autoUpdateSize
* @param width
* @param height
@ -11,10 +11,10 @@
* @param passes
* @constructor
*/
R3.D3.API.Composer = function (
R3.D3.API.Composer = function(
parent,
id,
name,
parentEntity,
autoUpdateSize,
width,
height,
@ -22,6 +22,12 @@ R3.D3.API.Composer = function (
renderTarget,
passes
) {
if (R3.Utils.UndefinedOrNull(parent)) {
parent = null;
}
this.parent = parent;
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
}
@ -48,7 +54,13 @@ R3.D3.API.Composer = function (
this.height = height;
if (R3.Utils.UndefinedOrNull(renderer)) {
renderer = null;
if (this.parent && this.parent.parent.renderer) {
renderer = this.parent.parent.renderer;
} else {
renderer = null;
}
}
this.renderer = renderer;
@ -65,7 +77,7 @@ R3.D3.API.Composer = function (
R3.API.Component.call(
this,
R3.Component.COMPOSER,
parentEntity
parent
);
};

View File

@ -3,7 +3,7 @@
* @param id
* @param name
* @param effectType
* @param parentEntity
* @param parent
* @param renderer
* @param width
* @param height
@ -16,7 +16,7 @@ R3.D3.API.Effect = function(
id,
name,
effectType,
parentEntity,
parent,
renderer,
width,
height
@ -87,7 +87,7 @@ R3.D3.API.Effect = function(
R3.API.Component.call(
this,
componentType,
parentEntity
parent
);
};

View File

@ -22,7 +22,7 @@ R3.D3.API.Effect.Anaglyph = function(
apiEffect.id,
apiEffect.name,
apiEffect.effectType,
apiEffect.parentEntity,
apiEffect.parent,
apiEffect.renderer,
apiEffect.width,
apiEffect.height

View File

@ -22,7 +22,7 @@ R3.D3.API.Effect.Parallax = function(
apiEffect.id,
apiEffect.name,
apiEffect.effectType,
apiEffect.parentEntity,
apiEffect.parent,
apiEffect.renderer,
apiEffect.width,
apiEffect.height

View File

@ -29,7 +29,7 @@ R3.D3.API.Effect.Stereo = function(
apiEffect.id,
apiEffect.name,
apiEffect.effectType,
apiEffect.parentEntity,
apiEffect.parent,
apiEffect.renderer,
apiEffect.width,
apiEffect.height

View File

@ -13,7 +13,7 @@
* @param normal
* @param selected
* @param parentGeometry
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.Face = function(
@ -30,7 +30,7 @@ R3.D3.API.Face = function(
normal,
selected,
parentGeometry,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -69,15 +69,15 @@ R3.D3.API.Face = function(
this.uvs = uvs;
if (R3.Utils.UndefinedOrNull(color)) {
color = new R3.API.Color();
color = new R3.API.Color(this);
}
this.color = color;
if (R3.Utils.UndefinedOrNull(vertexColors)) {
vertexColors = [
new R3.API.Color(),
new R3.API.Color(),
new R3.API.Color()
new R3.API.Color(this),
new R3.API.Color(this),
new R3.API.Color(this)
];
}
this.vertexColors = vertexColors;
@ -105,7 +105,7 @@ R3.D3.API.Face = function(
R3.API.Component.call(
this,
R3.Component.FACE,
parentEntity
parent
);
};

View File

@ -7,7 +7,7 @@
* @param near
* @param far
* @param density
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.Fog = function(
@ -18,7 +18,7 @@ R3.D3.API.Fog = function(
near,
far,
density,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -37,7 +37,7 @@ R3.D3.API.Fog = function(
this.exponential = exponential;
if (R3.Utils.UndefinedOrNull(color)) {
color = new R3.API.Color(1, 1, 1, 1)
color = new R3.API.Color(this, 1, 1, 1, 1)
}
this.color = color;
@ -59,7 +59,7 @@ R3.D3.API.Fog = function(
R3.API.Component.call(
this,
R3.Component.FOG,
parentEntity
parent
);
};

View File

@ -3,14 +3,14 @@
* @param id
* @param name
* @param url
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.Font = function(
id,
name,
url,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -30,7 +30,7 @@ R3.D3.API.Font = function(
R3.API.Component.call(
this,
R3.Component.FONT,
parentEntity
parent
);
};
@ -47,6 +47,6 @@ R3.D3.API.Font.FromObject = function(objectFont) {
objectFont.id,
objectFont.name,
objectFont.url,
objectFont.parentEntity
objectFont.parent
);
};

View File

@ -9,7 +9,7 @@
* @param contactEquationRelaxation
* @param frictionEquationStiffness
* @param frictionEquationRelaxation
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.FrictionContactMaterial = function(
@ -22,7 +22,7 @@ R3.D3.API.FrictionContactMaterial = function(
contactEquationRelaxation,
frictionEquationStiffness,
frictionEquationRelaxation,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -73,7 +73,7 @@ R3.D3.API.FrictionContactMaterial = function(
R3.API.Component.call(
this,
R3.Component.FRICTION_CONTACT_MATERIAL,
parentEntity
parent
);
};
@ -96,7 +96,7 @@ R3.D3.API.FrictionContactMaterial.FromObject = function(objectFrictionContactMat
objectFrictionContactMaterial.contactEquationRelaxation,
objectFrictionContactMaterial.frictionEquationStiffness,
objectFrictionContactMaterial.frictionEquationRelaxation,
objectFrictionContactMaterial.parentEntity
objectFrictionContactMaterial.parent
);
};

View File

@ -4,7 +4,7 @@
* @param name
* @param friction
* @param restitution
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.FrictionMaterial = function(
@ -12,7 +12,7 @@ R3.D3.API.FrictionMaterial = function(
name,
friction,
restitution,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
@ -38,7 +38,7 @@ R3.D3.API.FrictionMaterial = function(
R3.API.Component.call(
this,
R3.Component.FRICTION_MATERIAL,
parentEntity
parent
);
};
@ -56,7 +56,7 @@ R3.D3.API.FrictionMaterial.FromObject = function(objectFrictionMaterial) {
objectFrictionMaterial.name,
objectFrictionMaterial.friction,
objectFrictionMaterial.restitution,
objectFrictionMaterial.parentEntity
objectFrictionMaterial.parent
);
};

View File

@ -3,7 +3,7 @@
* @param id
* @param name
* @param geometryType
* @param parentEntity
* @param parent
* @param parentMesh
* @param boundingBox
* @param boundingSphere
@ -15,7 +15,7 @@ R3.D3.API.Geometry = function(
id,
name,
geometryType,
parentEntity,
parent,
parentMesh,
boundingBox,
boundingSphere,
@ -207,7 +207,7 @@ R3.D3.API.Geometry = function(
R3.API.Component.call(
this,
R3.D3.API.Geometry.GetComponentType(this.geometryType),
parentEntity
parent
);
};

View File

@ -56,7 +56,7 @@ R3.D3.API.Geometry.Buffer = function(
apiGeometry.id,
apiGeometry.name,
apiGeometry.geometryType,
apiGeometry.parentEntity,
apiGeometry.parent,
apiGeometry.parentMesh,
apiGeometry.boundingBox,
apiGeometry.boundingSphere,

View File

@ -112,7 +112,7 @@ R3.D3.API.Geometry.Normal = function(
apiGeometry.id,
apiGeometry.name,
apiGeometry.geometryType,
apiGeometry.parentEntity,
apiGeometry.parent,
apiGeometry.parentMesh,
apiGeometry.boundingBox,
apiGeometry.boundingSphere,

View File

@ -6,7 +6,7 @@
* @param color
* @param intensity
* @param parentScene
* @param parentEntity
* @param parent
* @constructor
*/
R3.D3.API.Light = function(
@ -16,7 +16,7 @@ R3.D3.API.Light = function(
color,
intensity,
parentScene,
parentEntity
parent
) {
if (R3.Utils.UndefinedOrNull(id)) {
id = R3.Utils.RandomId();
@ -59,7 +59,7 @@ R3.D3.API.Light = function(
this.name = name;
if (R3.Utils.UndefinedOrNull(color)) {
color = new R3.API.Color(1,1,1);
color = new R3.API.Color(this, 1,1,1);
}
this.color = color;
@ -78,7 +78,7 @@ R3.D3.API.Light = function(
R3.API.Component.call(
this,
componentType,
parentEntity
parent
);
};

View File

@ -25,7 +25,7 @@ R3.D3.API.Light.Ambient = function(
apiLight.color,
apiLight.intensity,
apiLight.parentScene,
apiLight.parentEntity
apiLight.parent
);
};

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