start restructure
parent
452842cb45
commit
659954f7de
|
@ -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
|
||||
);
|
||||
};
|
||||
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
|
@ -21,7 +21,7 @@ R3.API.GraphicsRuntime.Impact = function(
|
|||
apiGraphicsRuntime.id,
|
||||
apiGraphicsRuntime.name,
|
||||
apiGraphicsRuntime.graphicsType,
|
||||
apiGraphicsRuntime.parentEntity
|
||||
apiGraphicsRuntime.parent
|
||||
);
|
||||
|
||||
};
|
|
@ -21,7 +21,7 @@ R3.API.GraphicsRuntime.Three = function(
|
|||
apiGraphicsRuntime.id,
|
||||
apiGraphicsRuntime.name,
|
||||
apiGraphicsRuntime.graphicsType,
|
||||
apiGraphicsRuntime.parentEntity
|
||||
apiGraphicsRuntime.parent
|
||||
);
|
||||
|
||||
};
|
|
@ -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,
|
13
gulpfile.js
13
gulpfile.js
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
|
@ -2,17 +2,26 @@
|
|||
* Component Interface
|
||||
* @constructor
|
||||
* @param linkedObjects
|
||||
* @param delayed
|
||||
* @param parent
|
||||
*/
|
||||
R3.Component = function(
|
||||
linkedObjects,
|
||||
delayed
|
||||
parent,
|
||||
linkedObjects
|
||||
) {
|
||||
/**
|
||||
* Call the Event constructor first so we can set the parent right away
|
||||
*/
|
||||
R3.Event.call(
|
||||
this,
|
||||
parent
|
||||
);
|
||||
|
||||
this.componentType = this.getComponentType();
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(linkedObjects)) {
|
||||
linkedObjects = {};
|
||||
}
|
||||
this.linkedObjects = linkedObjects;
|
||||
this.linkedObjects.parentEntity = R3.Entity;
|
||||
|
||||
this.idToObject = {};
|
||||
|
||||
|
@ -30,14 +39,9 @@ R3.Component = function(
|
|||
|
||||
this.generateNewImageIds = false;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(delayed)) {
|
||||
delayed = false;
|
||||
}
|
||||
this.delayed = delayed;
|
||||
|
||||
this.dependencies = this.getDependencies();
|
||||
|
||||
R3.Event.Emit(
|
||||
this.emit(
|
||||
R3.Event.COMPONENT_REGISTER,
|
||||
{
|
||||
component : this
|
||||
|
@ -49,7 +53,7 @@ R3.Component = function(
|
|||
this.performInstanceCreation();
|
||||
|
||||
} else {
|
||||
R3.Event.Emit(
|
||||
this.emit(
|
||||
R3.Event.REGISTER_DEPENDENCIES,
|
||||
{
|
||||
component : this
|
||||
|
@ -68,7 +72,6 @@ R3.Component.prototype.constructor = R3.Component;
|
|||
* Ensure we have no dependencies
|
||||
* Build a list of all child components - if they are all linked, we are ready to create an instance
|
||||
* Ensure we are linked
|
||||
* Ensure we are not delayed
|
||||
* Try to create the instance
|
||||
* Error Log if failed
|
||||
* Don't do anything if we are not fully linked
|
||||
|
@ -101,38 +104,16 @@ R3.Component.prototype.performInstanceCreation = function() {
|
|||
* Don't try to create an instance of this object until it is fully linked
|
||||
*/
|
||||
if (this.linked) {
|
||||
if (!this.delayed) {
|
||||
try {
|
||||
this.createInstance();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* Some systems require an instance creation at an exact time, like System.Input for Edit Controls -
|
||||
* we need to give them the opportunity to handle this situation
|
||||
*/
|
||||
R3.Event.Emit(
|
||||
R3.Event.DELAYED_INSTANCE_ENCOUNTERED,
|
||||
{
|
||||
component : this
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
R3.Component.prototype.createInstance = function() {
|
||||
|
||||
// console.log('create instance : '+ this.name);
|
||||
|
||||
/**
|
||||
* When you do actually call 'createInstance' - it is wise to state we are no longer delayed - we assume the caller
|
||||
* knows when to call createInstance, so we do the housekeeping here
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.delayed = false;
|
||||
|
||||
if (this.instance) {
|
||||
|
||||
this.loaded = true;
|
||||
|
@ -153,6 +134,15 @@ R3.Component.prototype.createInstance = function() {
|
|||
}
|
||||
|
||||
if (this instanceof R3.Entity) {
|
||||
|
||||
if (this instanceof R3.Project) {
|
||||
R3.Event.Emit(
|
||||
R3.Event.PROJECT_LOADED,
|
||||
{
|
||||
entity:this
|
||||
}
|
||||
)
|
||||
} else {
|
||||
R3.Event.Emit(
|
||||
R3.Event.ENTITY_LOADED,
|
||||
{
|
||||
|
@ -160,6 +150,7 @@ R3.Component.prototype.createInstance = function() {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -174,7 +165,6 @@ R3.Component.prototype.getDependencies = function() {
|
|||
|
||||
if (
|
||||
this.linkedObjects.hasOwnProperty(property) &&
|
||||
property.indexOf('parent') !== 0 &&
|
||||
this.hasOwnProperty(property)
|
||||
){
|
||||
if (typeof this[property] === 'string') {
|
||||
|
@ -210,25 +200,63 @@ R3.Component.prototype.getDependencies = function() {
|
|||
};
|
||||
|
||||
R3.Component.prototype.updateInstance = function(property) {
|
||||
console.warn('TODO: update instance for parent change');
|
||||
|
||||
if (property === 'parentEntity') {
|
||||
//
|
||||
// if (property === 'parent') {
|
||||
//
|
||||
// if (this.parent instanceof R3.Entity) {
|
||||
// this.parent.addComponent(this);
|
||||
//
|
||||
// this.buildIdToObject();
|
||||
//
|
||||
// Object.keys(this.idToObject).map(
|
||||
// function(componentId) {
|
||||
//
|
||||
// if (this.id !== componentId) {
|
||||
// this.parent.addComponent(this.idToObject[componentId]);
|
||||
// }
|
||||
//
|
||||
// }.bind(this)
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
if (this.parentEntity instanceof R3.Entity) {
|
||||
this.parentEntity.addComponent(this);
|
||||
};
|
||||
|
||||
this.buildIdToObject();
|
||||
/**
|
||||
* R3.Component.prototype.getParent traverses the parent chain looking for the first parent which has a certain
|
||||
* property. If the constructor is given, then not only does the property have to exist - it also has to match the
|
||||
* constructor
|
||||
* @param property
|
||||
* @param constructor
|
||||
* @returns {null|*}
|
||||
*/
|
||||
R3.Component.prototype.getParent = function(property, constructor) {
|
||||
|
||||
Object.keys(this.idToObject).map(
|
||||
function(componentId) {
|
||||
|
||||
if (this.id !== componentId) {
|
||||
this.parentEntity.addComponent(this.idToObject[componentId]);
|
||||
if (R3.Utils.UndefinedOrNull(constructor)) {
|
||||
constructor = null;
|
||||
}
|
||||
|
||||
}.bind(this)
|
||||
)
|
||||
}
|
||||
if (this.parent) {
|
||||
if (this.parent.hasOwnProperty(property)) {
|
||||
|
||||
if (constructor) {
|
||||
if (this.parent[property] instanceof constructor) {
|
||||
return this.parent[property];
|
||||
} else {
|
||||
return this.parent.getParent(property, constructor);
|
||||
}
|
||||
} else {
|
||||
return this.parent[property];
|
||||
}
|
||||
} else {
|
||||
return this.parent.getParent(property, constructor);
|
||||
}
|
||||
} else {
|
||||
console.warn('property : ' + property + ' of type ' + constructor + ' was not found in the parent chain');
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -242,7 +270,7 @@ R3.Component.MATERIAL_STANDARD = 0x2;
|
|||
R3.Component.RENDERER = 0x3;
|
||||
R3.Component.SERVER = 0x4;
|
||||
R3.Component.CAMERA_PERSPECTIVE = 0x5;
|
||||
//R3.Component.SOCKET = 0x6;
|
||||
R3.Component.UNUSED = 0x6;
|
||||
R3.Component.MESH = 0x7;
|
||||
R3.Component.SPLINE = 0x8;
|
||||
R3.Component.SHADOW_DIRECTIONAL = 0x9;
|
||||
|
@ -253,7 +281,7 @@ R3.Component.PASS_RENDER = 0xd;
|
|||
R3.Component.SCENE = 0xe;
|
||||
R3.Component.RAYCASTER = 0xf;
|
||||
R3.Component.TEXT = 0x10;
|
||||
R3.Component.FACE = 0x11;
|
||||
R3.Component.UNUSED = 0x11;
|
||||
R3.Component.VIEWPORT = 0x12;
|
||||
R3.Component.SYSTEM = 0x13;
|
||||
R3.Component.GRAPHICS = 0x14;
|
||||
|
@ -295,21 +323,21 @@ R3.Component.CLOCK = 0x37;
|
|||
R3.Component.ANIMATION = 0x38;
|
||||
R3.Component.CONTROLS_KEYBOARD = 0x39;
|
||||
R3.Component.CONTROLS_MOUSE = 0x3a;
|
||||
R3.Component.GRAPHICS_THREE = 0x3b;
|
||||
R3.Component.RENDERER_D3_CANVAS_TARGET = 0x3b;
|
||||
R3.Component.FONT = 0x3c;
|
||||
R3.Component.CANVAS = 0x3d;
|
||||
R3.Component.BONE = 0x3e;
|
||||
R3.Component.GRAPHICS_IMPACT = 0x3f;
|
||||
R3.Component.RENDERER_D3_CANVAS = 0x3f;
|
||||
R3.Component.CONTROLS_FIRST_PERSON = 0x40;
|
||||
R3.Component.SYSTEM_ANIMATION = 0x41;
|
||||
R3.Component.SYSTEM_CUSTOM_CODE = 0x42;
|
||||
R3.Component.SYSTEM_GUI = 0x43;
|
||||
R3.Component.SYSTEM_INPUT = 0x44;
|
||||
R3.Component.SYSTEM_LINKING = 0x45;
|
||||
R3.Component.SYSTEM_PHYSICS = 0x46;
|
||||
R3.Component.SYSTEM_RENDER = 0x47;
|
||||
R3.Component.SYSTEM_STORAGE = 0x48;
|
||||
R3.Component.SYSTEM_VISUALIZATION = 0x49;
|
||||
R3.Component.RENDERER_D3_TARGET = 0x41;
|
||||
R3.Component.SPHERE = 0x42;
|
||||
R3.Component.UNUSED = 0x43;
|
||||
R3.Component.UNUSED = 0x44;
|
||||
R3.Component.UNUSED = 0x45;
|
||||
R3.Component.UNUSED = 0x46;
|
||||
R3.Component.UNUSED = 0x47;
|
||||
R3.Component.UNUSED = 0x48;
|
||||
R3.Component.UNUSED = 0x49;
|
||||
R3.Component.LIGHT_AMBIENT = 0x4a;
|
||||
R3.Component.LIGHT_DIRECTIONAL = 0x4b;
|
||||
R3.Component.LIGHT_HEMISPHERE = 0x4c;
|
||||
|
@ -409,8 +437,10 @@ R3.Component.MATERIAL_POINTS = 0xa3;
|
|||
R3.Component.VIDEO = 0xa4;
|
||||
R3.Component.USER = 0xa5;
|
||||
R3.Component.PROJECT = 0xa6;
|
||||
R3.Component.VIEWPORT_FIXED_ASPECT = 0xa7;
|
||||
R3.Component.VIEWPORT_ZOOMED_ASPECT = 0xa8;
|
||||
|
||||
R3.Component.MAX_COMPONENTS = 0xa7;
|
||||
R3.Component.MAX_COMPONENTS = 0xa9;
|
||||
|
||||
R3.Component.GRAPHICS_RUNTIME = 0x1;
|
||||
R3.Component.PHYSICS_RUNTIME = 0x2;
|
||||
|
@ -420,13 +450,6 @@ R3.Component.DEFAULT_RUNTIME = 0x5;
|
|||
R3.Component.GUI_RUNTIME = 0x6;
|
||||
R3.Component.CODER_RUNTIME = 0x7;
|
||||
|
||||
R3.Component.GetCompentTypes = function(constructor) {
|
||||
|
||||
if (constructor === R3.Component) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns string name for component number
|
||||
* @param number
|
||||
|
@ -434,6 +457,7 @@ R3.Component.GetCompentTypes = function(constructor) {
|
|||
* @constructor
|
||||
*/
|
||||
R3.Component.GetComponentInfo = function(number) {
|
||||
|
||||
switch(number) {
|
||||
case 0x1 : return {
|
||||
name : 'R3.Socket.Receive',
|
||||
|
@ -465,12 +489,12 @@ R3.Component.GetComponentInfo = function(number) {
|
|||
constructor : R3.D3.Camera.Perspective,
|
||||
apiConstructor : R3.D3.API.Camera.Perspective
|
||||
};
|
||||
case 0x6 : return;/*{
|
||||
name : 'R3.Socket',
|
||||
runtime : R3.Component.SOCKET_RUNTIME,
|
||||
constructor : R3.Socket,
|
||||
apiConstructor : R3.API.Socket
|
||||
};*/
|
||||
case 0x6 : return {
|
||||
name : 'R3.Color',
|
||||
runtime : R3.Component.GRAPHICS_RUNTIME,
|
||||
constructor : R3.Color,
|
||||
apiConstructor : R3.API.Color
|
||||
};
|
||||
case 0x7 : return {
|
||||
name : 'R3.D3.Mesh',
|
||||
runtime : R3.Component.GRAPHICS_RUNTIME,
|
||||
|
@ -780,10 +804,10 @@ R3.Component.GetComponentInfo = function(number) {
|
|||
apiConstructor : R3.API.Controls
|
||||
};
|
||||
case 0x3b : return {
|
||||
name : 'R3.GraphicsRuntime.Three',
|
||||
runtime : R3.Component.DEFAULT_RUNTIME,
|
||||
constructor : R3.GraphicsRuntime.Three,
|
||||
apiConstructor : R3.API.GraphicsRuntime.Three
|
||||
name : 'R3.Renderer.D3.Canvas.Target',
|
||||
runtime : R3.Component.GRAPHICS_RUNTIME,
|
||||
constructor : R3.Renderer.D3.Canvas.Target,
|
||||
apiConstructor : R3.API.Renderer.D3.Canvas.Target
|
||||
};
|
||||
case 0x3c : return {
|
||||
name : 'R3.D3.Font',
|
||||
|
@ -804,10 +828,10 @@ R3.Component.GetComponentInfo = function(number) {
|
|||
apiConstructor : R3.D3.API.Bone
|
||||
};
|
||||
case 0x3f : return {
|
||||
name : 'R3.GraphicsRuntime.Impact',
|
||||
runtime : R3.Component.DEFAULT_RUNTIME,
|
||||
constructor : R3.GraphicsRuntime.Impact,
|
||||
apiConstructor : R3.API.GraphicsRuntime.Impact
|
||||
name : 'R3.Renderer.D3.Canvas',
|
||||
runtime : R3.Component.GRAPHICS_RUNTIME,
|
||||
constructor : R3.Renderer.D3.Canvas,
|
||||
apiConstructor : R3.API.Renderer.D3.Canvas
|
||||
};
|
||||
case 0x40 : return {
|
||||
name : 'R3.Controls.D3.FirstPerson',
|
||||
|
@ -816,16 +840,16 @@ R3.Component.GetComponentInfo = function(number) {
|
|||
apiConstructor : R3.API.Controls.D3.FirstPerson
|
||||
};
|
||||
case 0x41 : return {
|
||||
name : 'R3.System.Animation',
|
||||
runtime : R3.Component.DEFAULT_RUNTIME,
|
||||
constructor : R3.System.Animation,
|
||||
apiConstructor : R3.API.System
|
||||
name : 'R3.Renderer.D3.Target',
|
||||
runtime : R3.Component.GRAPHICS_RUNTIME,
|
||||
constructor : R3.Renderer.D3.Target,
|
||||
apiConstructor : R3.API.Renderer.D3.Target
|
||||
};
|
||||
case 0x42 : return {
|
||||
name : 'R3.System.CustomCode',
|
||||
name : 'R3.Sphere',
|
||||
runtime : R3.Component.DEFAULT_RUNTIME,
|
||||
constructor : R3.System.CustomCode,
|
||||
apiConstructor : R3.API.System
|
||||
constructor : R3.Sphere,
|
||||
apiConstructor : R3.API.Sphere
|
||||
};
|
||||
case 0x43 : return {
|
||||
name : 'R3.System.GUI',
|
||||
|
@ -1436,7 +1460,7 @@ R3.Component.GetComponentInfo = function(number) {
|
|||
/**
|
||||
* Returns the runtime friendly name
|
||||
* @param runtime
|
||||
* @returns {*}
|
||||
* @returns string
|
||||
* @constructor
|
||||
*/
|
||||
R3.Component.GetRuntimeName = function(runtime) {
|
||||
|
@ -1482,6 +1506,22 @@ R3.Component.GetComponentName = function(componentType) {
|
|||
return 'unused';
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets a friendly name for the component
|
||||
* @param componentType
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
R3.Component.GetComponentFriendlyName = function(componentType) {
|
||||
|
||||
var name = R3.Component.GetComponentName(componentType);
|
||||
|
||||
name = name.replace('R3.D3.','');
|
||||
name = name.replace('.', ' ');
|
||||
|
||||
return name;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {null || Object}
|
||||
*/
|
||||
|
@ -1495,6 +1535,470 @@ R3.Component.GetComponentRuntime = function(componentType) {
|
|||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the component type based on the constructor
|
||||
* @returns {number}
|
||||
* @constructor
|
||||
*/
|
||||
R3.Component.prototype.getComponentType = function() {
|
||||
|
||||
if (this instanceof R3.Box3) {
|
||||
return R3.Component.BOX3;
|
||||
}
|
||||
if (this instanceof R3.Canvas) {
|
||||
return R3.Component.CANVAS;
|
||||
}
|
||||
if (this instanceof R3.Clock) {
|
||||
return R3.Component.CLOCK;
|
||||
}
|
||||
if (this instanceof R3.Controls.D3.Orbit) {
|
||||
return R3.Component.CONTROLS_ORBIT;
|
||||
}
|
||||
if (this instanceof R3.Controls.D3.FirstPerson) {
|
||||
return R3.Component.CONTROLS_FIRST_PERSON;
|
||||
}
|
||||
if (this instanceof R3.Controls.D3.Editor) {
|
||||
return R3.Component.CONTROLS_EDITOR;
|
||||
}
|
||||
if (this instanceof R3.Controls.Keyboard) {
|
||||
return R3.Component.CONTROLS_KEYBOARD;
|
||||
}
|
||||
if (this instanceof R3.Controls.Mouse) {
|
||||
return R3.Component.CONTROLS_MOUSE;
|
||||
}
|
||||
if (this instanceof R3.Controls.Touch) {
|
||||
return R3.Component.CONTROLS_TOUCH;
|
||||
}
|
||||
if (this instanceof R3.Curve.Path.D2.Shape) {
|
||||
return R3.Component.CURVE_PATH_D2_SHAPE;
|
||||
}
|
||||
if (this instanceof R3.Curve.Path.D2) {
|
||||
return R3.Component.CURVE_PATH_D2;
|
||||
}
|
||||
if (this instanceof R3.Curve.Path) {
|
||||
return R3.Component.CURVE_PATH;
|
||||
}
|
||||
if (this instanceof R3.Curve) {
|
||||
return R3.Component.CURVE;
|
||||
}
|
||||
if (this instanceof R3.CustomCode) {
|
||||
return R3.Component.CUSTOM_CODE;
|
||||
}
|
||||
if (this instanceof R3.D3.Animation) {
|
||||
return R3.Component.ANIMATION;
|
||||
}
|
||||
if (this instanceof R3.D3.Object) {
|
||||
return R3.Component.OBJECT;
|
||||
}
|
||||
if (this instanceof R3.D3.Audio) {
|
||||
return R3.Component.AUDIO;
|
||||
}
|
||||
if (this instanceof R3.D3.Bone) {
|
||||
return R3.Component.BONE;
|
||||
}
|
||||
if (this instanceof R3.D3.Broadphase) {
|
||||
return R3.Component.BROADPHASE;
|
||||
}
|
||||
if (this instanceof R3.D3.Camera.Cube) {
|
||||
return R3.Component.CAMERA_CUBE;
|
||||
}
|
||||
if (this instanceof R3.D3.Camera.Orthographic) {
|
||||
return R3.Component.CAMERA_ORTHOGRAPHIC;
|
||||
}
|
||||
if (this instanceof R3.D3.Camera.Perspective) {
|
||||
return R3.Component.CAMERA_PERSPECTIVE;
|
||||
}
|
||||
if (this instanceof R3.D3.Camera.Perspective.Stereo) {
|
||||
return R3.Component.CAMERA_PERSPECTIVE_STEREO;
|
||||
}
|
||||
if (this instanceof R3.D3.Composer) {
|
||||
return R3.Component.COMPOSER;
|
||||
}
|
||||
if (this instanceof R3.D3.Effect.Anaglyph) {
|
||||
return R3.Component.EFFECT_ANAGLYPH;
|
||||
}
|
||||
if (this instanceof R3.D3.Effect.Parallax) {
|
||||
return R3.Component.EFFECT_PARALLAX;
|
||||
}
|
||||
if (this instanceof R3.D3.Effect.Stereo) {
|
||||
return R3.Component.EFFECT_STEREO;
|
||||
}
|
||||
if (this instanceof R3.D3.Fog) {
|
||||
return R3.Component.FOG;
|
||||
}
|
||||
if (this instanceof R3.D3.Font) {
|
||||
return R3.Component.FONT;
|
||||
}
|
||||
if (this instanceof R3.D3.FrictionContactMaterial) {
|
||||
return R3.Component.FRICTION_CONTACT_MATERIAL;
|
||||
}
|
||||
if (this instanceof R3.D3.FrictionMaterial) {
|
||||
return R3.Component.FRICTION_MATERIAL;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Box) {
|
||||
return R3.Component.GEOMETRY_BUFFER_BOX;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Circle) {
|
||||
return R3.Component.GEOMETRY_BUFFER_CIRCLE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Cone) {
|
||||
return R3.Component.GEOMETRY_BUFFER_CONE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Cylinder) {
|
||||
return R3.Component.GEOMETRY_BUFFER_CYLINDER;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Dodecahedron) {
|
||||
return R3.Component.GEOMETRY_BUFFER_DODECAHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Extrude) {
|
||||
return R3.Component.GEOMETRY_BUFFER_EXTRUDE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Icosahedron) {
|
||||
return R3.Component.GEOMETRY_BUFFER_ICOSAHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Instanced) {
|
||||
return R3.Component.GEOMETRY_BUFFER_INSTANCED;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Lathe) {
|
||||
return R3.Component.GEOMETRY_BUFFER_LATHE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Octahedron) {
|
||||
return R3.Component.GEOMETRY_BUFFER_OCTAHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Parametric) {
|
||||
return R3.Component.GEOMETRY_BUFFER_PARAMETRIC;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Plane) {
|
||||
return R3.Component.GEOMETRY_BUFFER_PLANE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Polyhedron) {
|
||||
return R3.Component.GEOMETRY_BUFFER_POLYHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Ring) {
|
||||
return R3.Component.GEOMETRY_BUFFER_RING;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Shape) {
|
||||
return R3.Component.GEOMETRY_BUFFER_SHAPE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Sphere) {
|
||||
return R3.Component.GEOMETRY_BUFFER_SPHERE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Tetrahedron) {
|
||||
return R3.Component.GEOMETRY_BUFFER_TETRAHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Text) {
|
||||
return R3.Component.GEOMETRY_BUFFER_TEXT;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Torus) {
|
||||
return R3.Component.GEOMETRY_BUFFER_TORUS_KNOT;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.TorusKnot) {
|
||||
return R3.Component.GEOMETRY_BUFFER_TORUS_KNOT;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer.Tube) {
|
||||
return R3.Component.GEOMETRY_BUFFER_TUBE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Buffer) {
|
||||
return R3.Component.GEOMETRY_BUFFER;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Box) {
|
||||
return R3.Component.GEOMETRY_NORMAL_BOX;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Circle) {
|
||||
return R3.Component.GEOMETRY_NORMAL_CIRCLE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Cone) {
|
||||
return R3.Component.GEOMETRY_NORMAL_CONE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Cylinder) {
|
||||
return R3.Component.GEOMETRY_NORMAL_CYLINDER;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Dodecahedron) {
|
||||
return R3.Component.GEOMETRY_NORMAL_DODECAHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Edges) {
|
||||
return R3.Component.GEOMETRY_NORMAL_EDGES;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Extrude) {
|
||||
return R3.Component.GEOMETRY_NORMAL_EXTRUDE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Icosahedron) {
|
||||
return R3.Component.GEOMETRY_NORMAL_ICOSAHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Lathe) {
|
||||
return R3.Component.GEOMETRY_NORMAL_LATHE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Octahedron) {
|
||||
return R3.Component.GEOMETRY_NORMAL_OCTAHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Parametric) {
|
||||
return R3.Component.GEOMETRY_NORMAL_PARAMETRIC;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Plane) {
|
||||
return R3.Component.GEOMETRY_NORMAL_PLANE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Polyhedron) {
|
||||
return R3.Component.GEOMETRY_NORMAL_POLYHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Ring) {
|
||||
return R3.Component.GEOMETRY_NORMAL_RING;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Shape) {
|
||||
return R3.Component.GEOMETRY_NORMAL_SHAPE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Sphere) {
|
||||
return R3.Component.GEOMETRY_NORMAL_SPHERE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Tetrahedron) {
|
||||
return R3.Component.GEOMETRY_NORMAL_TETRAHEDRON;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Text) {
|
||||
return R3.Component.GEOMETRY_NORMAL_TEXT;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Torus) {
|
||||
return R3.Component.GEOMETRY_NORMAL_TORUS;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.TorusKnot) {
|
||||
return R3.Component.GEOMETRY_NORMAL_TORUS_KNOT;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Tube) {
|
||||
return R3.Component.GEOMETRY_NORMAL_TUBE;
|
||||
}
|
||||
if (this instanceof R3.D3.Geometry.Normal.Wireframe) {
|
||||
return R3.Component.GEOMETRY_NORMAL_WIREFRAME;
|
||||
}
|
||||
if (this instanceof R3.D3.Helper) {
|
||||
return R3.Component.HELPER;
|
||||
}
|
||||
if (this instanceof R3.D3.Light.Ambient) {
|
||||
return R3.Component.LIGHT_AMBIENT;
|
||||
}
|
||||
if (this instanceof R3.D3.Light.Directional) {
|
||||
return R3.Component.LIGHT_DIRECTIONAL;
|
||||
}
|
||||
if (this instanceof R3.D3.Light.Hemisphere) {
|
||||
return R3.Component.LIGHT_HEMISPHERE;
|
||||
}
|
||||
if (this instanceof R3.D3.Light.Point) {
|
||||
return R3.Component.LIGHT_POINT;
|
||||
}
|
||||
if (this instanceof R3.D3.Light.RectArea) {
|
||||
return R3.Component.LIGHT_RECT_AREA;
|
||||
}
|
||||
if (this instanceof R3.D3.Light.Spot) {
|
||||
return R3.Component.LIGHT_SPOT;
|
||||
}
|
||||
if (this instanceof R3.D3.Material.Basic) {
|
||||
return R3.Component.MATERIAL_BASIC;
|
||||
}
|
||||
if (this instanceof R3.D3.Material.Phong) {
|
||||
return R3.Component.MATERIAL_PHONG;
|
||||
}
|
||||
if (this instanceof R3.D3.Material.Points) {
|
||||
return R3.Component.MATERIAL_POINTS;
|
||||
}
|
||||
if (this instanceof R3.D3.Material.Shader) {
|
||||
return R3.Component.MATERIAL_SHADER;
|
||||
}
|
||||
if (this instanceof R3.D3.Material.Shader.Raw) {
|
||||
return R3.Component.MATERIAL_SHADER_RAW;
|
||||
}
|
||||
if (this instanceof R3.D3.Material.Standard) {
|
||||
return R3.Component.MATERIAL_STANDARD;
|
||||
}
|
||||
if (this instanceof R3.D3.Mesh) {
|
||||
return R3.Component.MESH;
|
||||
}
|
||||
if (this instanceof R3.D3.ParticleEngine) {
|
||||
return R3.Component.PARTICLE_ENGINE;
|
||||
}
|
||||
if (this instanceof R3.D3.Particle) {
|
||||
return R3.Component.PARTICLE;
|
||||
}
|
||||
if (this instanceof R3.D3.Pass.Bloom) {
|
||||
return R3.Component.PASS_BLOOM;
|
||||
}
|
||||
if (this instanceof R3.D3.Pass.FXAA) {
|
||||
return R3.Component.PASS_FXAA;
|
||||
}
|
||||
if (this instanceof R3.D3.Pass.Render) {
|
||||
return R3.Component.PASS_RENDER;
|
||||
}
|
||||
if (this instanceof R3.D3.Pass.SSAO) {
|
||||
return R3.Component.PASS_SSAO;
|
||||
}
|
||||
if (this instanceof R3.D3.PhysicsWorld) {
|
||||
return R3.Component.PHYSICS_WORLD;
|
||||
}
|
||||
if (this instanceof R3.D3.Raycaster) {
|
||||
return R3.Component.RAYCASTER;
|
||||
}
|
||||
if (this instanceof R3.D3.RaycastVehicle) {
|
||||
return R3.Component.RAYCAST_VEHICLE;
|
||||
}
|
||||
if (this instanceof R3.D3.RaycastWheel) {
|
||||
return R3.Component.RAYCAST_WHEEL;
|
||||
}
|
||||
if (this instanceof R3.D3.RenderTarget.Cube) {
|
||||
return R3.Component.RENDER_TARGET_CUBE;
|
||||
}
|
||||
if (this instanceof R3.D3.RenderTarget) {
|
||||
return R3.Component.RENDER_TARGET;
|
||||
}
|
||||
if (this instanceof R3.D3.RigidBody) {
|
||||
return R3.Component.RIGID_BODY;
|
||||
}
|
||||
if (this instanceof R3.D3.Scene) {
|
||||
return R3.Component.SCENE;
|
||||
}
|
||||
if (this instanceof R3.D3.Shader.Fragment) {
|
||||
return R3.Component.SHADER_FRAGMENT;
|
||||
}
|
||||
if (this instanceof R3.D3.Shader.Vertex) {
|
||||
return R3.Component.SHADER_VERTEX;
|
||||
}
|
||||
if (this instanceof R3.D3.Shader) {
|
||||
return R3.Component.SHADER;
|
||||
}
|
||||
if (this instanceof R3.D3.Shadow.Directional) {
|
||||
return R3.Component.SHADOW_DIRECTIONAL;
|
||||
}
|
||||
if (this instanceof R3.D3.Shadow.Spot) {
|
||||
return R3.Component.SHADOW_SPOT;
|
||||
}
|
||||
if (this instanceof R3.D3.Shadow) {
|
||||
return R3.Component.SHADOW;
|
||||
}
|
||||
if (this instanceof R3.D3.Shape.Box) {
|
||||
return R3.Component.SHAPE_BOX;
|
||||
}
|
||||
if (this instanceof R3.D3.Shape.ConvexHull) {
|
||||
return R3.Component.SHAPE_CONVEX_HULL;
|
||||
}
|
||||
if (this instanceof R3.D3.Shape.ConvexHull.Cylinder) {
|
||||
return R3.Component.SHAPE_CONVEX_HULL_CYLINDER;
|
||||
}
|
||||
if (this instanceof R3.D3.Shape.HeightMap) {
|
||||
return R3.Component.SHAPE_HEIGHT_MAP;
|
||||
}
|
||||
if (this instanceof R3.D3.Shape.Plane) {
|
||||
return R3.Component.SHAPE_PLANE;
|
||||
}
|
||||
if (this instanceof R3.D3.Shape.Sphere) {
|
||||
return R3.Component.SHAPE_SPHERE;
|
||||
}
|
||||
if (this instanceof R3.D3.Shape.TriMesh) {
|
||||
return R3.Component.SHAPE_TRI_MESH;
|
||||
}
|
||||
if (this instanceof R3.D3.Shape) {
|
||||
return R3.Component.SHAPE;
|
||||
}
|
||||
if (this instanceof R3.D3.Solver) {
|
||||
return R3.Component.SOLVER;
|
||||
}
|
||||
if (this instanceof R3.D3.Spline) {
|
||||
return R3.Component.SPLINE;
|
||||
}
|
||||
if (this instanceof R3.D3.Text) {
|
||||
return R3.Component.TEXT;
|
||||
}
|
||||
if (this instanceof R3.D3.Texture.Canvas) {
|
||||
return R3.Component.TEXTURE_CANVAS;
|
||||
}
|
||||
if (this instanceof R3.D3.Texture.Cube) {
|
||||
return R3.Component.TEXTURE_CUBE;
|
||||
}
|
||||
if (this instanceof R3.D3.Texture.Image) {
|
||||
return R3.Component.TEXTURE_IMAGE;
|
||||
}
|
||||
if (this instanceof R3.D3.Texture) {
|
||||
return R3.Component.TEXTURE;
|
||||
}
|
||||
if (this instanceof R3.D3.Viewport.Fixed.Aspect) {
|
||||
return R3.Component.VIEWPORT_FIXED_ASPECT;
|
||||
}
|
||||
if (this instanceof R3.D3.Viewport.Zoomed.Aspect) {
|
||||
return R3.Component.VIEWPORT_ZOOMED_ASPECT;
|
||||
}
|
||||
if (this instanceof R3.D3.Viewport) {
|
||||
return R3.Component.VIEWPORT;
|
||||
}
|
||||
if (this instanceof R3.DomElement) {
|
||||
return R3.Component.DOM_ELEMENT;
|
||||
}
|
||||
if (this instanceof R3.DrawRange) {
|
||||
return R3.Component.DRAW_RANGE;
|
||||
}
|
||||
if (this instanceof R3.Entity) {
|
||||
return R3.Component.ENTITY;
|
||||
}
|
||||
if (this instanceof R3.EntityManager) {
|
||||
return R3.Component.ENTITY_MANAGER;
|
||||
}
|
||||
if (this instanceof R3.Group) {
|
||||
return R3.Component.GROUP;
|
||||
}
|
||||
if (this instanceof R3.GUI) {
|
||||
return R3.Component.GUI;
|
||||
}
|
||||
if (this instanceof R3.GUIRuntime) {
|
||||
return R3.Component.GUI_RUNTIME;
|
||||
}
|
||||
if (this instanceof R3.Image) {
|
||||
return R3.Component.IMAGE;
|
||||
}
|
||||
if (this instanceof R3.Mouse) {
|
||||
return R3.Component.MOUSE;
|
||||
}
|
||||
if (this instanceof R3.Plane) {
|
||||
return R3.Component.PLANE;
|
||||
}
|
||||
if (this instanceof R3.Project) {
|
||||
return R3.Component.PROJECT;
|
||||
}
|
||||
if (this instanceof R3.Renderer.D3.Canvas.Target) {
|
||||
return R3.Component.RENDERER_D3_CANVAS_TARGET;
|
||||
}
|
||||
if (this instanceof R3.Renderer.D3.Canvas) {
|
||||
return R3.Component.RENDERER_D3_CANVAS;
|
||||
}
|
||||
if (this instanceof R3.Renderer.D3.Target) {
|
||||
return R3.Component.RENDERER_D3_TARGET;
|
||||
}
|
||||
if (this instanceof R3.Renderer.D2) {
|
||||
return R3.Component.RENDERER_D2;
|
||||
}
|
||||
if (this instanceof R3.Renderer.D3) {
|
||||
return R3.Component.RENDERER_D3;
|
||||
}
|
||||
if (this instanceof R3.Renderer) {
|
||||
return R3.Component.RENDERER;
|
||||
}
|
||||
if (this instanceof R3.Server) {
|
||||
return R3.Component.SERVER;
|
||||
}
|
||||
if (this instanceof R3.Socket.Cast) {
|
||||
return R3.Component.SOCKET_CAST;
|
||||
}
|
||||
if (this instanceof R3.Socket.Receive) {
|
||||
return R3.Component.SOCKET_RECEIVE;
|
||||
}
|
||||
if (this instanceof R3.Sphere) {
|
||||
return R3.Component.SPHERE;
|
||||
}
|
||||
if (this instanceof R3.Stats) {
|
||||
return R3.Component.STATS;
|
||||
}
|
||||
if (this instanceof R3.User) {
|
||||
return R3.Component.USER;
|
||||
}
|
||||
if (this instanceof R3.Video) {
|
||||
return R3.Component.VIDEO;
|
||||
}
|
||||
|
||||
console.warn('Component Type not Registered' + this);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {null || Object}
|
||||
|
@ -1723,8 +2227,8 @@ R3.Component.prototype.replace = function(componentType) {
|
|||
}
|
||||
);
|
||||
|
||||
if (this.parentEntity && this.parentEntity.loaded) {
|
||||
this.parentEntity.addComponent(replacement);
|
||||
if (this.parent && this.parent.loaded) {
|
||||
this.parent.addComponent(replacement);
|
||||
}
|
||||
|
||||
this.remove();
|
||||
|
@ -1757,7 +2261,7 @@ R3.Component.prototype.clone = function() {
|
|||
}
|
||||
);
|
||||
|
||||
runtimeComponent.parentEntity = null;
|
||||
runtimeComponent.parent = null;
|
||||
|
||||
return runtimeComponent;
|
||||
};
|
||||
|
@ -1896,7 +2400,7 @@ R3.Component.prototype.save = function(remote) {
|
|||
|
||||
toSave.push(apiObject);
|
||||
|
||||
this.publish(
|
||||
this.emit(
|
||||
R3.Event.SAVE_COMPONENT,
|
||||
{
|
||||
apiObject: apiObject,
|
||||
|
@ -1917,7 +2421,7 @@ R3.Component.prototype.save = function(remote) {
|
|||
/**
|
||||
* @return {null|Object}
|
||||
*/
|
||||
R3.Component.GetRuntimeObject = function(runtimeInfo) {
|
||||
R3.Component.GetRuntimeObject = function(info) {
|
||||
|
||||
var runtime = null;
|
||||
|
||||
|
@ -1929,55 +2433,57 @@ R3.Component.GetRuntimeObject = function(runtimeInfo) {
|
|||
}
|
||||
);
|
||||
|
||||
if (runtimeInfo === R3.Component.GRAPHICS_RUNTIME) {
|
||||
if (info.runtime === R3.Component.GRAPHICS_RUNTIME) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(runtime.graphics)) {
|
||||
console.warn('no runtime graphics');
|
||||
console.warn('no runtime graphics: ', info);
|
||||
return null;
|
||||
}
|
||||
|
||||
return runtime.graphics;
|
||||
|
||||
} else if (runtimeInfo === R3.Component.PHYSICS_RUNTIME) {
|
||||
} else if (info.runtime === R3.Component.PHYSICS_RUNTIME) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(runtime.physics)) {
|
||||
console.warn('no runtime physics');
|
||||
console.warn('no runtime physics ', info);
|
||||
return null;
|
||||
}
|
||||
|
||||
return runtime.physics;
|
||||
|
||||
} else if (runtimeInfo === R3.Component.GUI_RUNTIME) {
|
||||
} else if (info.runtime === R3.Component.GUI_RUNTIME) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(runtime.gui)) {
|
||||
console.warn('no runtime gui');
|
||||
console.warn('no runtime gui ', info);
|
||||
return null;
|
||||
}
|
||||
|
||||
return runtime.gui;
|
||||
|
||||
} else if (runtimeInfo === R3.Component.SOCKET_RUNTIME) {
|
||||
} else if (info.runtime === R3.Component.SOCKET_RUNTIME) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(runtime.sockets)) {
|
||||
console.warn('no runtime sockets');
|
||||
console.warn('no runtime sockets ', info);
|
||||
return null;
|
||||
}
|
||||
|
||||
return runtime.sockets;
|
||||
|
||||
} else if (runtimeInfo === R3.Component.STATISTICS_RUNTIME) {
|
||||
} else if (info.runtime === R3.Component.STATISTICS_RUNTIME) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(runtime.statistics)) {
|
||||
console.warn('no runtime statistics');
|
||||
console.warn('no runtime statistics ', info);
|
||||
return null;
|
||||
}
|
||||
|
||||
return runtime.statistics;
|
||||
|
||||
} else if (runtimeInfo === R3.Component.DEFAULT_RUNTIME) {
|
||||
} else if (info.runtime === R3.Component.DEFAULT_RUNTIME) {
|
||||
|
||||
return null;
|
||||
|
||||
} else {
|
||||
console.log('unknown runtime object found : ' + info.runtime);
|
||||
throw new Error('unknown runtime object found: ' + info);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1989,7 +2495,7 @@ R3.Component.Construct = function(componentType) {
|
|||
|
||||
var componentClass = info.constructor;
|
||||
|
||||
var runtime = R3.Component.GetRuntimeObject(info.runtime);
|
||||
var runtime = R3.Component.GetRuntimeObject(info);
|
||||
|
||||
if (runtime) {
|
||||
return new componentClass(runtime);
|
||||
|
@ -2005,7 +2511,7 @@ R3.Component.ConstructFromObject = function(rawComponentObject) {
|
|||
|
||||
var info = R3.Component.GetComponentInfo(rawComponentObject.componentType);
|
||||
|
||||
var runtime = R3.Component.GetRuntimeObject(info.runtime);
|
||||
var runtime = R3.Component.GetRuntimeObject(info);
|
||||
|
||||
if (runtime) {
|
||||
runtimeComponent = new info.constructor(runtime, rawComponentObject);
|
|
@ -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;
|
|
@ -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,
|
||||
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
/**
|
||||
* 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
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -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;
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -3,22 +3,21 @@
|
|||
* @param id
|
||||
* @param name
|
||||
* @param curveType
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @param arcLenghDivisions
|
||||
* @constructor
|
||||
*/
|
||||
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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ R3.API.Curve.Path = function (
|
|||
apiCurve.id,
|
||||
apiCurve.name,
|
||||
apiCurve.curveType,
|
||||
apiCurve.parentEntity,
|
||||
apiCurve.parent,
|
||||
apiCurve.arcLenghDivisions
|
||||
);
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @param name
|
||||
* @param eventId
|
||||
* @param code
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.CustomCode = function(
|
||||
|
@ -12,7 +12,7 @@ R3.API.CustomCode = function (
|
|||
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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -48,6 +48,6 @@ R3.API.DomElement.FromObject = function (objectDomElement) {
|
|||
objectDomElement.id,
|
||||
objectDomElement.name,
|
||||
objectDomElement.domElementId,
|
||||
objectDomElement.parentEntity
|
||||
objectDomElement.parent
|
||||
)
|
||||
};
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
* @constructor
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @param start
|
||||
* @param count
|
||||
*/
|
||||
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
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -62,6 +62,6 @@ R3.API.EntityManager.FromObject = function(objectEntityManager) {
|
|||
objectEntityManager.name,
|
||||
apiEntities,
|
||||
objectEntityManager.defaultEntity,
|
||||
objectEntityManager.parentEntity
|
||||
objectEntityManager.parent
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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
|
||||
)
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @constructor
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @param start
|
||||
* @param count
|
||||
* @param materialIndex
|
||||
|
@ -11,7 +11,7 @@
|
|||
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
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ R3.API.Plane = function (
|
|||
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
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -48,6 +48,6 @@ R3.API.Plane.FromObject = function (objectPlane) {
|
|||
objectPlane.name,
|
||||
R3.API.Vector3.FromObject(objectPlane.normal),
|
||||
objectPlane.constant,
|
||||
objectPlane.parentEntity
|
||||
objectPlane.parent
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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;
|
|
@ -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(
|
||||
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');
|
||||
|
@ -106,7 +85,9 @@ R3.API.Renderer.GetComponentType = function(rendererType) {
|
|||
|
||||
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_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;
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
* R3.API.Renderer.D2
|
||||
* @constructor
|
||||
* @param apiRenderer
|
||||
* @param canvas
|
||||
*/
|
||||
R3.API.Renderer.D2 = function(
|
||||
apiRenderer
|
||||
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);
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -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;
|
|
@ -35,14 +35,10 @@
|
|||
* @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(
|
||||
|
@ -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
|
||||
);
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ R3.API.Socket.Cast = function(
|
|||
apiSocket.roomId,
|
||||
apiSocket.peerId,
|
||||
apiSocket.server,
|
||||
apiSocket.parentEntity
|
||||
apiSocket.parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ R3.API.Socket.Receive = function(
|
|||
apiSocket.roomId,
|
||||
apiSocket.peerId,
|
||||
apiSocket.server,
|
||||
apiSocket.parentEntity
|
||||
apiSocket.parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
* @param id String
|
||||
* @param name String
|
||||
* @param systemType
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
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
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/**
|
||||
* R3.API.Vector2
|
||||
* @param x
|
||||
* @param y
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Vector2 = function(x, y) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
|
@ -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;
|
||||
};
|
|
@ -1,3 +1,10 @@
|
|||
/**
|
||||
* R3.API.Vector3
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Vector3 = function(x, y, z) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
|
@ -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;
|
||||
|
@ -25,19 +39,14 @@ R3.API.Vector3.prototype.negate = function() {
|
|||
};
|
||||
|
||||
R3.API.Vector3.prototype.subtract = function(v) {
|
||||
return new R3.API.Vector3(
|
||||
this.x - v.x,
|
||||
this.y - v.y,
|
||||
this.z - v.z
|
||||
);
|
||||
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
|
||||
);
|
||||
return this.subtract(v);
|
||||
};
|
||||
|
||||
R3.API.Vector3.prototype.equals = function(v) {
|
||||
|
@ -45,24 +54,13 @@ R3.API.Vector3.prototype.equals = function (v) {
|
|||
};
|
||||
|
||||
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.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));
|
||||
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.prototype.lookAt = function(at, up) {
|
||||
|
@ -103,11 +101,16 @@ R3.API.Vector3.prototype.set = function (x, y, 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
|
||||
);
|
||||
|
||||
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,7 +138,7 @@ 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}
|
||||
*/
|
||||
|
@ -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) {
|
||||
|
@ -256,22 +252,3 @@ 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
|
||||
)
|
||||
};
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
/**
|
||||
* R3.API.Vector4
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param w
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Vector4 = function(x, y, z, w) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(x)) {
|
||||
|
@ -16,31 +24,8 @@ R3.API.Vector4 = function (x, y, z, w) {
|
|||
this.z = z;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(w)) {
|
||||
w = 1;
|
||||
w = 0;
|
||||
}
|
||||
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
|
||||
* @constructor
|
||||
*/
|
||||
R3.API.Vector4.FromObject = function (objectVector) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(objectVector)) {
|
||||
console.warn('vector from db undefined - stale version in db');
|
||||
objectVector = {};
|
||||
}
|
||||
|
||||
return new R3.API.Vector4(
|
||||
objectVector.x,
|
||||
objectVector.y,
|
||||
objectVector.z,
|
||||
objectVector.w
|
||||
)
|
||||
|
||||
};
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,49 +1,46 @@
|
|||
/**
|
||||
* R3.Box3
|
||||
* @param implementation
|
||||
* @param apiBox3
|
||||
* @param parentObject
|
||||
* @constructor
|
||||
*/
|
||||
R3.Box3 = function(
|
||||
implementation,
|
||||
apiBox3,
|
||||
parentObject
|
||||
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(
|
||||
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(
|
||||
new R3.API.Component(
|
||||
this.parent,
|
||||
this.id,
|
||||
this.name,
|
||||
R3.Utils.IdOrNull(this.parentEntity),
|
||||
this.name
|
||||
),
|
||||
this.min.toApiObject(),
|
||||
this.max.toApiObject()
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* @param blocking
|
||||
* @param applyToMeshWhenDone
|
||||
* @param meshes
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Animation = function(
|
||||
|
@ -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
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* R3.D3.API.Composer
|
||||
* @param id
|
||||
* @param name
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @param autoUpdateSize
|
||||
* @param width
|
||||
* @param height
|
||||
|
@ -12,9 +12,9 @@
|
|||
* @constructor
|
||||
*/
|
||||
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,8 +54,14 @@ R3.D3.API.Composer = function (
|
|||
this.height = height;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderer)) {
|
||||
|
||||
if (this.parent && this.parent.parent.renderer) {
|
||||
renderer = this.parent.parent.renderer;
|
||||
} else {
|
||||
renderer = null;
|
||||
}
|
||||
|
||||
}
|
||||
this.renderer = renderer;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(renderTarget)) {
|
||||
|
@ -65,7 +77,7 @@ R3.D3.API.Composer = function (
|
|||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.COMPOSER,
|
||||
parentEntity
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ R3.D3.API.Light.Ambient = function(
|
|||
apiLight.color,
|
||||
apiLight.intensity,
|
||||
apiLight.parentScene,
|
||||
apiLight.parentEntity
|
||||
apiLight.parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ R3.D3.API.Light.Directional = function(
|
|||
apiLight.color,
|
||||
apiLight.intensity,
|
||||
apiLight.parentScene,
|
||||
apiLight.parentEntity
|
||||
apiLight.parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ R3.D3.API.Light.Hemisphere = function(
|
|||
this.position = position;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(groundColor)) {
|
||||
groundColor = new R3.API.Color(1,1,1);
|
||||
groundColor = new R3.API.Color(this, 1,1,1);
|
||||
}
|
||||
this.groundColor = groundColor;
|
||||
|
||||
|
@ -42,7 +42,7 @@ R3.D3.API.Light.Hemisphere = function(
|
|||
apiLight.color,
|
||||
apiLight.intensity,
|
||||
apiLight.parentScene,
|
||||
apiLight.parentEntity
|
||||
apiLight.parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ R3.D3.API.Light.Point = function(
|
|||
apiLight.color,
|
||||
apiLight.intensity,
|
||||
apiLight.parentScene,
|
||||
apiLight.parentEntity
|
||||
apiLight.parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ R3.D3.API.Light.RectArea = function(
|
|||
apiLight.color,
|
||||
apiLight.intensity,
|
||||
apiLight.parentScene,
|
||||
apiLight.parentEntity
|
||||
apiLight.parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ R3.D3.API.Light.Spot = function(
|
|||
apiLight.color,
|
||||
apiLight.intensity,
|
||||
apiLight.parentScene,
|
||||
apiLight.parentEntity
|
||||
apiLight.parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @param id
|
||||
* @param name
|
||||
* @param materialType
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @param parentMeshes
|
||||
* @param alphaTest
|
||||
* @param blendDst
|
||||
|
@ -44,7 +44,7 @@ R3.D3.API.Material = function(
|
|||
id,
|
||||
name,
|
||||
materialType,
|
||||
parentEntity,
|
||||
parent,
|
||||
parentMeshes,
|
||||
alphaTest,
|
||||
blendDst,
|
||||
|
@ -308,7 +308,7 @@ R3.D3.API.Material = function(
|
|||
R3.API.Component.call(
|
||||
this,
|
||||
componentType,
|
||||
parentEntity
|
||||
parent
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -69,7 +69,7 @@ R3.D3.API.Material.Basic = function(
|
|||
this.aoMapIntensity = aoMapIntensity;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -148,7 +148,7 @@ R3.D3.API.Material.Basic = function(
|
|||
apiMaterial.id,
|
||||
apiMaterial.name,
|
||||
apiMaterial.materialType,
|
||||
apiMaterial.parentEntity,
|
||||
apiMaterial.parent,
|
||||
apiMaterial.parentMeshes,
|
||||
apiMaterial.alphaTest,
|
||||
apiMaterial.blendDst,
|
||||
|
|
|
@ -105,7 +105,7 @@ R3.D3.API.Material.Phong = function(
|
|||
this.bumpScale = bumpScale;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -130,7 +130,7 @@ R3.D3.API.Material.Phong = function(
|
|||
this.displacementScale = displacementScale;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(emissive)) {
|
||||
emissive = new R3.API.Color(0, 0, 0, 0);
|
||||
emissive = new R3.API.Color(this, 0, 0, 0, 0);
|
||||
}
|
||||
this.emissive = emissive;
|
||||
|
||||
|
@ -205,7 +205,7 @@ R3.D3.API.Material.Phong = function(
|
|||
this.skinning = skinning;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(specular)) {
|
||||
specular = new R3.API.Color(0.06, 0.06, 0.06, 0);
|
||||
specular = new R3.API.Color(this, 0.06, 0.06, 0.06, 0);
|
||||
}
|
||||
this.specular = specular;
|
||||
|
||||
|
@ -239,7 +239,7 @@ R3.D3.API.Material.Phong = function(
|
|||
apiMaterial.id,
|
||||
apiMaterial.name,
|
||||
apiMaterial.materialType,
|
||||
apiMaterial.parentEntity,
|
||||
apiMaterial.parent,
|
||||
apiMaterial.parentMeshes,
|
||||
apiMaterial.alphaTest,
|
||||
apiMaterial.blendDst,
|
||||
|
|
|
@ -26,7 +26,7 @@ R3.D3.API.Material.Points = function(
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -50,7 +50,7 @@ R3.D3.API.Material.Points = function(
|
|||
apiMaterial.id,
|
||||
apiMaterial.name,
|
||||
apiMaterial.materialType,
|
||||
apiMaterial.parentEntity,
|
||||
apiMaterial.parent,
|
||||
apiMaterial.parentMeshes,
|
||||
apiMaterial.alphaTest,
|
||||
apiMaterial.blendDst,
|
||||
|
|
|
@ -127,7 +127,7 @@ R3.D3.API.Material.Shader = function(
|
|||
apiMaterial.id,
|
||||
apiMaterial.name,
|
||||
apiMaterial.materialType,
|
||||
apiMaterial.parentEntity,
|
||||
apiMaterial.parent,
|
||||
apiMaterial.parentMeshes,
|
||||
apiMaterial.alphaTest,
|
||||
apiMaterial.blendDst,
|
||||
|
|
|
@ -105,7 +105,7 @@ R3.D3.API.Material.Standard = function(
|
|||
this.bumpScale = bumpScale;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -125,7 +125,7 @@ R3.D3.API.Material.Standard = function(
|
|||
this.displacementScale = displacementScale;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(emissive)) {
|
||||
emissive = new R3.API.Color(0, 0, 0, 0);
|
||||
emissive = new R3.API.Color(this, 0, 0, 0, 0);
|
||||
}
|
||||
this.emissive = emissive;
|
||||
|
||||
|
@ -239,7 +239,7 @@ R3.D3.API.Material.Standard = function(
|
|||
apiMaterial.id,
|
||||
apiMaterial.name,
|
||||
apiMaterial.materialType,
|
||||
apiMaterial.parentEntity,
|
||||
apiMaterial.parent,
|
||||
apiMaterial.parentMeshes,
|
||||
apiMaterial.alphaTest,
|
||||
apiMaterial.blendDst,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* @param materials
|
||||
* @param parentMesh
|
||||
* @param parentScene
|
||||
* @param excludeFromEnvironment
|
||||
* @param excludeFromEnvironmentMapMap
|
||||
* @param skeleton
|
||||
* @param renderOrder
|
||||
* @param visible
|
||||
|
@ -23,7 +23,7 @@ R3.D3.API.Mesh = function(
|
|||
materials,
|
||||
parentMesh,
|
||||
parentScene,
|
||||
excludeFromEnvironment,
|
||||
excludeFromEnvironmentMapMap,
|
||||
skeleton,
|
||||
renderOrder,
|
||||
visible,
|
||||
|
@ -79,10 +79,10 @@ R3.D3.API.Mesh = function(
|
|||
}
|
||||
this.parentScene = parentScene;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(excludeFromEnvironment)) {
|
||||
excludeFromEnvironment = false;
|
||||
if (R3.Utils.UndefinedOrNull(excludeFromEnvironmentMapMap)) {
|
||||
excludeFromEnvironmentMapMap = false;
|
||||
}
|
||||
this.excludeFromEnvironment = excludeFromEnvironment;
|
||||
this.excludeFromEnvironmentMapMap = excludeFromEnvironmentMapMap;
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(skeleton)) {
|
||||
skeleton = null;
|
||||
|
@ -134,7 +134,7 @@ R3.D3.API.Mesh = function(
|
|||
apiD3Object.id,
|
||||
apiD3Object.name,
|
||||
apiD3Object.objectType,
|
||||
apiD3Object.parentEntity,
|
||||
apiD3Object.parent,
|
||||
apiD3Object.useQuaternion,
|
||||
apiD3Object.position,
|
||||
apiD3Object.quaternion,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* @param camera
|
||||
* @param pulse
|
||||
* @param fired
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.ParticleEngine = function(
|
||||
|
@ -28,7 +28,7 @@ R3.D3.API.ParticleEngine = function(
|
|||
camera,
|
||||
pulse,
|
||||
fired,
|
||||
parentEntity
|
||||
parent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
|
@ -94,7 +94,7 @@ R3.D3.API.ParticleEngine = function(
|
|||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.PARTICLE_ENGINE,
|
||||
parentEntity
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -150,7 +150,7 @@ R3.D3.API.ParticleEngine.FromObject = function(objectParticleEngine) {
|
|||
objectParticleEngine.elapsed,
|
||||
apiCamera,
|
||||
objectParticleEngine.pulse,
|
||||
objectParticleEngine.parentEntity
|
||||
objectParticleEngine.parent
|
||||
|
||||
);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* @param rotationType
|
||||
* @param rotationFn
|
||||
* @param parentParticleEngine
|
||||
* @param parentEntity
|
||||
* @param parent
|
||||
* @constructor
|
||||
*/
|
||||
R3.D3.API.Particle = function(
|
||||
|
@ -54,7 +54,7 @@ R3.D3.API.Particle = function(
|
|||
rotation,
|
||||
rotationFn,
|
||||
parentParticleEngine,
|
||||
parentEntity
|
||||
parent
|
||||
) {
|
||||
|
||||
if (R3.Utils.UndefinedOrNull(id)) {
|
||||
|
@ -185,7 +185,7 @@ R3.D3.API.Particle = function(
|
|||
R3.API.Component.call(
|
||||
this,
|
||||
R3.Component.PARTICLE,
|
||||
parentEntity
|
||||
parent
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue