r3-legacy/src/r3-a-3-api-component.js

468 lines
15 KiB
JavaScript
Raw Normal View History

2019-07-24 08:08:02 +02:00
/**
* 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;
}
};