code editor in again
parent
d13e4fb350
commit
b9c87ca33f
15
gulpfile.js
15
gulpfile.js
|
@ -18,13 +18,24 @@ code += '\t\tapiComponent.parent,\n';
|
||||||
code += '\t\tapiComponent.id,\n';
|
code += '\t\tapiComponent.id,\n';
|
||||||
code += '\t\tapiComponent.name,\n';
|
code += '\t\tapiComponent.name,\n';
|
||||||
code += '\t\tapiComponent.register,\n';
|
code += '\t\tapiComponent.register,\n';
|
||||||
code += '\t\tapiComponent.selected\n';
|
code += '\t\tapiComponent.selected,\n';
|
||||||
code += '\t)';
|
code += '\t\tapiComponent.isPublic\n';
|
||||||
|
code += '\t)\n';
|
||||||
|
code += '\n';
|
||||||
|
code += '\tif (R3.Utils.UndefinedOrNull(apiComponent.guiInfo)) {\n';
|
||||||
|
code += '\t\tapiComponent.guiInfo = {};\n';
|
||||||
|
code += '\t}\n';
|
||||||
|
code += '\tthis.guiInfo = apiComponent.guiInfo;\n';
|
||||||
|
|
||||||
//__DEFINE_API_COMPONENT__
|
//__DEFINE_API_COMPONENT__
|
||||||
var code1 = 'if (R3.Utils.UndefinedOrNull(apiComponent)) {\n';
|
var code1 = 'if (R3.Utils.UndefinedOrNull(apiComponent)) {\n';
|
||||||
code1 += '\t\tapiComponent = {};\n';
|
code1 += '\t\tapiComponent = {};\n';
|
||||||
code1 += '\t}\n';
|
code1 += '\t}\n';
|
||||||
|
code1 += '\n';
|
||||||
|
code1 += '\tif (R3.Utils.UndefinedOrNull(apiComponent.guiInfo)) {\n';
|
||||||
|
code1 += '\t\tapiComponent.guiInfo = {};\n';
|
||||||
|
code1 += '\t}\n';
|
||||||
|
code1 += '\tthis.guiInfo = apiComponent.guiInfo;\n';
|
||||||
|
|
||||||
var code2 = 'R3.D3.API.Geometry.Buffer.call(\n';
|
var code2 = 'R3.D3.API.Geometry.Buffer.call(\n';
|
||||||
code2 += '\t\tthis,\n';
|
code2 += '\t\tthis,\n';
|
||||||
|
|
|
@ -15,191 +15,192 @@ R3.COMPONENT_RENDERER_D3_CANVAS = 0xe;
|
||||||
R3.COMPONENT_RENDERER_D3 = 0xf;
|
R3.COMPONENT_RENDERER_D3 = 0xf;
|
||||||
R3.COMPONENT_RENDERER_D2 = 0x10;
|
R3.COMPONENT_RENDERER_D2 = 0x10;
|
||||||
R3.COMPONENT_RENDERER = 0x11;
|
R3.COMPONENT_RENDERER = 0x11;
|
||||||
R3.COMPONENT_QUERY_LOGINS_VPN = 0x12;
|
R3.COMPONENT_QUERY_USERDEVICES = 0x12;
|
||||||
R3.COMPONENT_QUERY_LOGINS_DEVICES = 0x13;
|
R3.COMPONENT_QUERY_LOGINS_VPN = 0x13;
|
||||||
R3.COMPONENT_QUERY_LOGINS_APPLICATIONS = 0x14;
|
R3.COMPONENT_QUERY_LOGINS_DEVICES = 0x14;
|
||||||
R3.COMPONENT_QUERY_LOGINS = 0x15;
|
R3.COMPONENT_QUERY_LOGINS_APPLICATIONS = 0x15;
|
||||||
R3.COMPONENT_QUERY_DEVICES_UNKNOWN = 0x16;
|
R3.COMPONENT_QUERY_LOGINS = 0x16;
|
||||||
R3.COMPONENT_QUERY_DEVICES_KNOWN = 0x17;
|
R3.COMPONENT_QUERY_DEVICES_UNKNOWN = 0x17;
|
||||||
R3.COMPONENT_QUERY_DEVICES = 0x18;
|
R3.COMPONENT_QUERY_DEVICES_KNOWN = 0x18;
|
||||||
R3.COMPONENT_QUERY_ALERTS_TIMESERIES = 0x19;
|
R3.COMPONENT_QUERY_DEVICES = 0x19;
|
||||||
R3.COMPONENT_QUERY_ALERTS_SUMMARY = 0x1a;
|
R3.COMPONENT_QUERY_ALERTS_TIMESERIES = 0x1a;
|
||||||
R3.COMPONENT_QUERY_ALERTS_LIST = 0x1b;
|
R3.COMPONENT_QUERY_ALERTS_SUMMARY = 0x1b;
|
||||||
R3.COMPONENT_QUERY_ALERTS_FIRSTTIMELOGIN_VPN = 0x1c;
|
R3.COMPONENT_QUERY_ALERTS_LIST = 0x1c;
|
||||||
R3.COMPONENT_QUERY_ALERTS_FIRSTTIMELOGIN_DEVICES = 0x1d;
|
R3.COMPONENT_QUERY_ALERTS_FIRSTTIMELOGIN_VPN = 0x1d;
|
||||||
R3.COMPONENT_QUERY_ALERTS_FIRSTTIMELOGIN_APPLICATIONS = 0x1e;
|
R3.COMPONENT_QUERY_ALERTS_FIRSTTIMELOGIN_DEVICES = 0x1e;
|
||||||
R3.COMPONENT_QUERY_ALERTS_FIRSTTIMELOGIN = 0x1f;
|
R3.COMPONENT_QUERY_ALERTS_FIRSTTIMELOGIN_APPLICATIONS = 0x1f;
|
||||||
R3.COMPONENT_QUERY_ALERTS_BUCKETS = 0x20;
|
R3.COMPONENT_QUERY_ALERTS_FIRSTTIMELOGIN = 0x20;
|
||||||
R3.COMPONENT_QUERY_ALERTS = 0x21;
|
R3.COMPONENT_QUERY_ALERTS_BUCKETS = 0x21;
|
||||||
R3.COMPONENT_QUERY = 0x22;
|
R3.COMPONENT_QUERY_ALERTS = 0x22;
|
||||||
R3.COMPONENT_QUATERNION_POINTS = 0x23;
|
R3.COMPONENT_QUERY = 0x23;
|
||||||
R3.COMPONENT_QUATERNION = 0x24;
|
R3.COMPONENT_QUATERNION_POINTS = 0x24;
|
||||||
R3.COMPONENT_PROJECT_D3_VR = 0x25;
|
R3.COMPONENT_QUATERNION = 0x25;
|
||||||
R3.COMPONENT_PROJECT_D3 = 0x26;
|
R3.COMPONENT_PROJECT_D3_VR = 0x26;
|
||||||
R3.COMPONENT_PROJECT_D2 = 0x27;
|
R3.COMPONENT_PROJECT_D3 = 0x27;
|
||||||
R3.COMPONENT_PROJECT = 0x28;
|
R3.COMPONENT_PROJECT_D2 = 0x28;
|
||||||
R3.COMPONENT_PLANE = 0x29;
|
R3.COMPONENT_PROJECT = 0x29;
|
||||||
R3.COMPONENT_MOUSE = 0x2a;
|
R3.COMPONENT_PLANE = 0x2a;
|
||||||
R3.COMPONENT_MATRIX4 = 0x2b;
|
R3.COMPONENT_MOUSE = 0x2b;
|
||||||
R3.COMPONENT_IMAGE = 0x2c;
|
R3.COMPONENT_MATRIX4 = 0x2c;
|
||||||
R3.COMPONENT_GROUP = 0x2d;
|
R3.COMPONENT_IMAGE = 0x2d;
|
||||||
R3.COMPONENT_GRAPH_TABLE = 0x2e;
|
R3.COMPONENT_GROUP = 0x2e;
|
||||||
R3.COMPONENT_GRAPH_METRIC = 0x2f;
|
R3.COMPONENT_GRAPH_TABLE = 0x2f;
|
||||||
R3.COMPONENT_GRAPH_BARCHART_STACKED = 0x30;
|
R3.COMPONENT_GRAPH_METRIC = 0x30;
|
||||||
R3.COMPONENT_GRAPH_BARCHART = 0x31;
|
R3.COMPONENT_GRAPH_BARCHART_STACKED = 0x31;
|
||||||
R3.COMPONENT_GRAPH = 0x32;
|
R3.COMPONENT_GRAPH_BARCHART = 0x32;
|
||||||
R3.COMPONENT_FONT = 0x33;
|
R3.COMPONENT_GRAPH = 0x33;
|
||||||
R3.COMPONENT_ENTITY = 0x34;
|
R3.COMPONENT_FONT = 0x34;
|
||||||
R3.COMPONENT_DRAWRANGE = 0x35;
|
R3.COMPONENT_ENTITY = 0x35;
|
||||||
R3.COMPONENT_DOMELEMENT = 0x36;
|
R3.COMPONENT_DRAWRANGE = 0x36;
|
||||||
R3.COMPONENT_D3_VIEWPORT_ZOOMEDASPECT = 0x37;
|
R3.COMPONENT_DOMELEMENT = 0x37;
|
||||||
R3.COMPONENT_D3_VIEWPORT_FIXEDASPECT_VR = 0x38;
|
R3.COMPONENT_D3_VIEWPORT_ZOOMEDASPECT = 0x38;
|
||||||
R3.COMPONENT_D3_VIEWPORT_FIXEDASPECT = 0x39;
|
R3.COMPONENT_D3_VIEWPORT_FIXEDASPECT_VR = 0x39;
|
||||||
R3.COMPONENT_D3_VIEWPORT = 0x3a;
|
R3.COMPONENT_D3_VIEWPORT_FIXEDASPECT = 0x3a;
|
||||||
R3.COMPONENT_D3_VERTEX = 0x3b;
|
R3.COMPONENT_D3_VIEWPORT = 0x3b;
|
||||||
R3.COMPONENT_D3_TEXTURE_IMAGE = 0x3c;
|
R3.COMPONENT_D3_VERTEX = 0x3c;
|
||||||
R3.COMPONENT_D3_TEXTURE_CUBE = 0x3d;
|
R3.COMPONENT_D3_TEXTURE_IMAGE = 0x3d;
|
||||||
R3.COMPONENT_D3_TEXTURE_CANVAS = 0x3e;
|
R3.COMPONENT_D3_TEXTURE_CUBE = 0x3e;
|
||||||
R3.COMPONENT_D3_TEXTURE = 0x3f;
|
R3.COMPONENT_D3_TEXTURE_CANVAS = 0x3f;
|
||||||
R3.COMPONENT_D3_TEXT = 0x40;
|
R3.COMPONENT_D3_TEXTURE = 0x40;
|
||||||
R3.COMPONENT_D3_SPLINE = 0x41;
|
R3.COMPONENT_D3_TEXT = 0x41;
|
||||||
R3.COMPONENT_D3_SOLVER = 0x42;
|
R3.COMPONENT_D3_SPLINE = 0x42;
|
||||||
R3.COMPONENT_D3_SKELETON = 0x43;
|
R3.COMPONENT_D3_SOLVER = 0x43;
|
||||||
R3.COMPONENT_D3_SHAPE_TRIMESH = 0x44;
|
R3.COMPONENT_D3_SKELETON = 0x44;
|
||||||
R3.COMPONENT_D3_SHAPE_SPHERE = 0x45;
|
R3.COMPONENT_D3_SHAPE_TRIMESH = 0x45;
|
||||||
R3.COMPONENT_D3_SHAPE_PLANE = 0x46;
|
R3.COMPONENT_D3_SHAPE_SPHERE = 0x46;
|
||||||
R3.COMPONENT_D3_SHAPE_HEIGHTMAP = 0x47;
|
R3.COMPONENT_D3_SHAPE_PLANE = 0x47;
|
||||||
R3.COMPONENT_D3_SHAPE_CONVEXHULL_CYLINDER = 0x48;
|
R3.COMPONENT_D3_SHAPE_HEIGHTMAP = 0x48;
|
||||||
R3.COMPONENT_D3_SHAPE_CONVEXHULL = 0x49;
|
R3.COMPONENT_D3_SHAPE_CONVEXHULL_CYLINDER = 0x49;
|
||||||
R3.COMPONENT_D3_SHAPE_BOX = 0x4a;
|
R3.COMPONENT_D3_SHAPE_CONVEXHULL = 0x4a;
|
||||||
R3.COMPONENT_D3_SHAPE = 0x4b;
|
R3.COMPONENT_D3_SHAPE_BOX = 0x4b;
|
||||||
R3.COMPONENT_D3_SHADOW_SPOT = 0x4c;
|
R3.COMPONENT_D3_SHAPE = 0x4c;
|
||||||
R3.COMPONENT_D3_SHADOW_DIRECTIONAL = 0x4d;
|
R3.COMPONENT_D3_SHADOW_SPOT = 0x4d;
|
||||||
R3.COMPONENT_D3_SHADOW = 0x4e;
|
R3.COMPONENT_D3_SHADOW_DIRECTIONAL = 0x4e;
|
||||||
R3.COMPONENT_D3_SHADER_VERTEX = 0x4f;
|
R3.COMPONENT_D3_SHADOW = 0x4f;
|
||||||
R3.COMPONENT_D3_SHADER_FRAGMENT = 0x50;
|
R3.COMPONENT_D3_SHADER_VERTEX = 0x50;
|
||||||
R3.COMPONENT_D3_SHADER = 0x51;
|
R3.COMPONENT_D3_SHADER_FRAGMENT = 0x51;
|
||||||
R3.COMPONENT_D3_SCENE = 0x52;
|
R3.COMPONENT_D3_SHADER = 0x52;
|
||||||
R3.COMPONENT_D3_RIGIDBODY = 0x53;
|
R3.COMPONENT_D3_SCENE = 0x53;
|
||||||
R3.COMPONENT_D3_RENDERTARGET_CUBE = 0x54;
|
R3.COMPONENT_D3_RIGIDBODY = 0x54;
|
||||||
R3.COMPONENT_D3_RENDERTARGET = 0x55;
|
R3.COMPONENT_D3_RENDERTARGET_CUBE = 0x55;
|
||||||
R3.COMPONENT_D3_RAYCASTER = 0x56;
|
R3.COMPONENT_D3_RENDERTARGET = 0x56;
|
||||||
R3.COMPONENT_D3_RAYCASTWHEEL = 0x57;
|
R3.COMPONENT_D3_RAYCASTER = 0x57;
|
||||||
R3.COMPONENT_D3_RAYCASTVEHICLE = 0x58;
|
R3.COMPONENT_D3_RAYCASTWHEEL = 0x58;
|
||||||
R3.COMPONENT_D3_PHYSICSWORLD = 0x59;
|
R3.COMPONENT_D3_RAYCASTVEHICLE = 0x59;
|
||||||
R3.COMPONENT_D3_PASS_RENDER_SSAO = 0x5a;
|
R3.COMPONENT_D3_PHYSICSWORLD = 0x5a;
|
||||||
R3.COMPONENT_D3_PASS_RENDER = 0x5b;
|
R3.COMPONENT_D3_PASS_RENDER_SSAO = 0x5b;
|
||||||
R3.COMPONENT_D3_PASS_FXAA = 0x5c;
|
R3.COMPONENT_D3_PASS_RENDER = 0x5c;
|
||||||
R3.COMPONENT_D3_PASS_COPY = 0x5d;
|
R3.COMPONENT_D3_PASS_FXAA = 0x5d;
|
||||||
R3.COMPONENT_D3_PASS_BLOOM = 0x5e;
|
R3.COMPONENT_D3_PASS_COPY = 0x5e;
|
||||||
R3.COMPONENT_D3_PASS = 0x5f;
|
R3.COMPONENT_D3_PASS_BLOOM = 0x5f;
|
||||||
R3.COMPONENT_D3_MESH_SKELETON = 0x60;
|
R3.COMPONENT_D3_PASS = 0x60;
|
||||||
R3.COMPONENT_D3_MESH_PARTICLE_ENGINE = 0x61;
|
R3.COMPONENT_D3_MESH_SKELETON = 0x61;
|
||||||
R3.COMPONENT_D3_MESH_PARTICLE = 0x62;
|
R3.COMPONENT_D3_MESH_PARTICLE_ENGINE = 0x62;
|
||||||
R3.COMPONENT_D3_MESH = 0x63;
|
R3.COMPONENT_D3_MESH_PARTICLE = 0x63;
|
||||||
R3.COMPONENT_D3_MATERIAL_STANDARD = 0x64;
|
R3.COMPONENT_D3_MESH = 0x64;
|
||||||
R3.COMPONENT_D3_MATERIAL_SHADER_RAW = 0x65;
|
R3.COMPONENT_D3_MATERIAL_STANDARD = 0x65;
|
||||||
R3.COMPONENT_D3_MATERIAL_SHADER = 0x66;
|
R3.COMPONENT_D3_MATERIAL_SHADER_RAW = 0x66;
|
||||||
R3.COMPONENT_D3_MATERIAL_POINTS = 0x67;
|
R3.COMPONENT_D3_MATERIAL_SHADER = 0x67;
|
||||||
R3.COMPONENT_D3_MATERIAL_PHONG = 0x68;
|
R3.COMPONENT_D3_MATERIAL_POINTS = 0x68;
|
||||||
R3.COMPONENT_D3_MATERIAL_BASIC = 0x69;
|
R3.COMPONENT_D3_MATERIAL_PHONG = 0x69;
|
||||||
R3.COMPONENT_D3_MATERIAL = 0x6a;
|
R3.COMPONENT_D3_MATERIAL_BASIC = 0x6a;
|
||||||
R3.COMPONENT_D3_LIGHT_SPOT = 0x6b;
|
R3.COMPONENT_D3_MATERIAL = 0x6b;
|
||||||
R3.COMPONENT_D3_LIGHT_RECTAREA = 0x6c;
|
R3.COMPONENT_D3_LIGHT_SPOT = 0x6c;
|
||||||
R3.COMPONENT_D3_LIGHT_POINT = 0x6d;
|
R3.COMPONENT_D3_LIGHT_RECTAREA = 0x6d;
|
||||||
R3.COMPONENT_D3_LIGHT_HEMISPHERE = 0x6e;
|
R3.COMPONENT_D3_LIGHT_POINT = 0x6e;
|
||||||
R3.COMPONENT_D3_LIGHT_DIRECTIONAL = 0x6f;
|
R3.COMPONENT_D3_LIGHT_HEMISPHERE = 0x6f;
|
||||||
R3.COMPONENT_D3_LIGHT_AMBIENT = 0x70;
|
R3.COMPONENT_D3_LIGHT_DIRECTIONAL = 0x70;
|
||||||
R3.COMPONENT_D3_LIGHT = 0x71;
|
R3.COMPONENT_D3_LIGHT_AMBIENT = 0x71;
|
||||||
R3.COMPONENT_D3_HELPER = 0x72;
|
R3.COMPONENT_D3_LIGHT = 0x72;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_WIREFRAME = 0x73;
|
R3.COMPONENT_D3_HELPER = 0x73;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_TUBE = 0x74;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_WIREFRAME = 0x74;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_TORUSKNOT = 0x75;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_TUBE = 0x75;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_TORUS = 0x76;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_TORUSKNOT = 0x76;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_TEXT = 0x77;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_TORUS = 0x77;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_TETRAHEDRON = 0x78;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_TEXT = 0x78;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_SPHERE = 0x79;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_TETRAHEDRON = 0x79;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_SHAPE = 0x7a;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_SPHERE = 0x7a;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_RING = 0x7b;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_SHAPE = 0x7b;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_POLYHEDRON = 0x7c;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_RING = 0x7c;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_PLANE = 0x7d;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_POLYHEDRON = 0x7d;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_PARAMETRIC = 0x7e;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_PLANE = 0x7e;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_OCTAHEDRON = 0x7f;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_PARAMETRIC = 0x7f;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_LATHE = 0x80;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_OCTAHEDRON = 0x80;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_ICOSAHEDRON = 0x81;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_LATHE = 0x81;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_EXTRUDE = 0x82;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_ICOSAHEDRON = 0x82;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_EDGES = 0x83;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_EXTRUDE = 0x83;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_DODECAHEDRON = 0x84;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_EDGES = 0x84;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_CYLINDER = 0x85;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_DODECAHEDRON = 0x85;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_CONE = 0x86;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_CYLINDER = 0x86;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_CIRCLE = 0x87;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_CONE = 0x87;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL_BOX = 0x88;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_CIRCLE = 0x88;
|
||||||
R3.COMPONENT_D3_GEOMETRY_NORMAL = 0x89;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL_BOX = 0x89;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_TUBE = 0x8a;
|
R3.COMPONENT_D3_GEOMETRY_NORMAL = 0x8a;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_TORUSKNOT = 0x8b;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_TUBE = 0x8b;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_TORUS = 0x8c;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_TORUSKNOT = 0x8c;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_TEXT = 0x8d;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_TORUS = 0x8d;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_TETRAHEDRON = 0x8e;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_TEXT = 0x8e;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_SPHERE = 0x8f;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_TETRAHEDRON = 0x8f;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_SHAPE = 0x90;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_SPHERE = 0x90;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_RING = 0x91;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_SHAPE = 0x91;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_POLYHEDRON = 0x92;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_RING = 0x92;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_PLANE = 0x93;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_POLYHEDRON = 0x93;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_PARAMETRIC = 0x94;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_PLANE = 0x94;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_OCTAHEDRON = 0x95;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_PARAMETRIC = 0x95;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_LATHE = 0x96;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_OCTAHEDRON = 0x96;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_INSTANCED = 0x97;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_LATHE = 0x97;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_ICOSAHEDRON = 0x98;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_INSTANCED = 0x98;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_EXTRUDE = 0x99;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_ICOSAHEDRON = 0x99;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_DODECAHEDRON = 0x9a;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_EXTRUDE = 0x9a;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_CYLINDER = 0x9b;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_DODECAHEDRON = 0x9b;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_CONE = 0x9c;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_CYLINDER = 0x9c;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_CIRCLE = 0x9d;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_CONE = 0x9d;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER_BOX = 0x9e;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_CIRCLE = 0x9e;
|
||||||
R3.COMPONENT_D3_GEOMETRY_BUFFER = 0x9f;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER_BOX = 0x9f;
|
||||||
R3.COMPONENT_D3_GEOMETRY = 0xa0;
|
R3.COMPONENT_D3_GEOMETRY_BUFFER = 0xa0;
|
||||||
R3.COMPONENT_D3_FRICTIONMATERIAL = 0xa1;
|
R3.COMPONENT_D3_GEOMETRY = 0xa1;
|
||||||
R3.COMPONENT_D3_FRICTIONCONTACTMATERIAL = 0xa2;
|
R3.COMPONENT_D3_FRICTIONMATERIAL = 0xa2;
|
||||||
R3.COMPONENT_D3_FOG_NORMAL = 0xa3;
|
R3.COMPONENT_D3_FRICTIONCONTACTMATERIAL = 0xa3;
|
||||||
R3.COMPONENT_D3_FOG_EXP = 0xa4;
|
R3.COMPONENT_D3_FOG_NORMAL = 0xa4;
|
||||||
R3.COMPONENT_D3_FOG = 0xa5;
|
R3.COMPONENT_D3_FOG_EXP = 0xa5;
|
||||||
R3.COMPONENT_D3_FACE_GRAPHICS = 0xa6;
|
R3.COMPONENT_D3_FOG = 0xa6;
|
||||||
R3.COMPONENT_D3_FACE = 0xa7;
|
R3.COMPONENT_D3_FACE_GRAPHICS = 0xa7;
|
||||||
R3.COMPONENT_D3_EFFECT_STEREO = 0xa8;
|
R3.COMPONENT_D3_FACE = 0xa8;
|
||||||
R3.COMPONENT_D3_EFFECT_PARALLAX = 0xa9;
|
R3.COMPONENT_D3_EFFECT_STEREO = 0xa9;
|
||||||
R3.COMPONENT_D3_EFFECT_ANAGLYPH = 0xaa;
|
R3.COMPONENT_D3_EFFECT_PARALLAX = 0xaa;
|
||||||
R3.COMPONENT_D3_EFFECT = 0xab;
|
R3.COMPONENT_D3_EFFECT_ANAGLYPH = 0xab;
|
||||||
R3.COMPONENT_D3_COMPOSER = 0xac;
|
R3.COMPONENT_D3_EFFECT = 0xac;
|
||||||
R3.COMPONENT_D3_CAMERA_PERSPECTIVE_STEREO = 0xad;
|
R3.COMPONENT_D3_COMPOSER = 0xad;
|
||||||
R3.COMPONENT_D3_CAMERA_PERSPECTIVE = 0xae;
|
R3.COMPONENT_D3_CAMERA_PERSPECTIVE_STEREO = 0xae;
|
||||||
R3.COMPONENT_D3_CAMERA_ORTHOGRAPHIC_SCALEDASPECT = 0xaf;
|
R3.COMPONENT_D3_CAMERA_PERSPECTIVE = 0xaf;
|
||||||
R3.COMPONENT_D3_CAMERA_ORTHOGRAPHIC_FIXEDASPECT = 0xb0;
|
R3.COMPONENT_D3_CAMERA_ORTHOGRAPHIC_SCALEDASPECT = 0xb0;
|
||||||
R3.COMPONENT_D3_CAMERA_ORTHOGRAPHIC = 0xb1;
|
R3.COMPONENT_D3_CAMERA_ORTHOGRAPHIC_FIXEDASPECT = 0xb1;
|
||||||
R3.COMPONENT_D3_CAMERA_CUBE = 0xb2;
|
R3.COMPONENT_D3_CAMERA_ORTHOGRAPHIC = 0xb2;
|
||||||
R3.COMPONENT_D3_CAMERA = 0xb3;
|
R3.COMPONENT_D3_CAMERA_CUBE = 0xb3;
|
||||||
R3.COMPONENT_D3_BROADPHASE = 0xb4;
|
R3.COMPONENT_D3_CAMERA = 0xb4;
|
||||||
R3.COMPONENT_D3_BONEWEIGHT = 0xb5;
|
R3.COMPONENT_D3_BROADPHASE = 0xb5;
|
||||||
R3.COMPONENT_D3_BONE = 0xb6;
|
R3.COMPONENT_D3_BONEWEIGHT = 0xb6;
|
||||||
R3.COMPONENT_D3_AUDIO = 0xb7;
|
R3.COMPONENT_D3_BONE = 0xb7;
|
||||||
R3.COMPONENT_D3_ANIMATION = 0xb8;
|
R3.COMPONENT_D3_AUDIO = 0xb8;
|
||||||
R3.COMPONENT_D3_OBJECT = 0xb9;
|
R3.COMPONENT_D3_ANIMATION = 0xb9;
|
||||||
R3.COMPONENT_CUSTOMCODE = 0xba;
|
R3.COMPONENT_D3_OBJECT = 0xba;
|
||||||
R3.COMPONENT_CURVE_PATH_D2_SHAPE = 0xbb;
|
R3.COMPONENT_CUSTOMCODE = 0xbb;
|
||||||
R3.COMPONENT_CURVE_PATH_D2 = 0xbc;
|
R3.COMPONENT_CURVE_PATH_D2_SHAPE = 0xbc;
|
||||||
R3.COMPONENT_CURVE_PATH = 0xbd;
|
R3.COMPONENT_CURVE_PATH_D2 = 0xbd;
|
||||||
R3.COMPONENT_CURVE = 0xbe;
|
R3.COMPONENT_CURVE_PATH = 0xbe;
|
||||||
R3.COMPONENT_CONTROLS_TOUCH = 0xbf;
|
R3.COMPONENT_CURVE = 0xbf;
|
||||||
R3.COMPONENT_CONTROLS_MOUSE = 0xc0;
|
R3.COMPONENT_CONTROLS_TOUCH = 0xc0;
|
||||||
R3.COMPONENT_CONTROLS_KEYBOARD = 0xc1;
|
R3.COMPONENT_CONTROLS_MOUSE = 0xc1;
|
||||||
R3.COMPONENT_CONTROLS_D3_ORBIT = 0xc2;
|
R3.COMPONENT_CONTROLS_KEYBOARD = 0xc2;
|
||||||
R3.COMPONENT_CONTROLS_D3_FIRSTPERSON = 0xc3;
|
R3.COMPONENT_CONTROLS_D3_ORBIT = 0xc3;
|
||||||
R3.COMPONENT_CONTROLS_D3 = 0xc4;
|
R3.COMPONENT_CONTROLS_D3_FIRSTPERSON = 0xc4;
|
||||||
R3.COMPONENT_CONTROLS = 0xc5;
|
R3.COMPONENT_CONTROLS_D3 = 0xc5;
|
||||||
R3.COMPONENT_COLOR = 0xc6;
|
R3.COMPONENT_CONTROLS = 0xc6;
|
||||||
R3.COMPONENT_CLOCK = 0xc7;
|
R3.COMPONENT_COLOR = 0xc7;
|
||||||
R3.COMPONENT_CANVAS = 0xc8;
|
R3.COMPONENT_CLOCK = 0xc8;
|
||||||
R3.COMPONENT_BOX3 = 0xc9;
|
R3.COMPONENT_CANVAS = 0xc9;
|
||||||
R3.MAX_COMPONENTS = 0xca;
|
R3.COMPONENT_BOX3 = 0xca;
|
||||||
|
R3.MAX_COMPONENTS = 0xcb;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* R3.GetComponentType
|
* R3.GetComponentType
|
||||||
|
@ -276,6 +277,10 @@ R3.GetComponentType = function(component) {
|
||||||
return R3.COMPONENT_RENDERER;
|
return R3.COMPONENT_RENDERER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (component instanceof R3.Query.UserDevices) {
|
||||||
|
return R3.COMPONENT_QUERY_USERDEVICES;
|
||||||
|
}
|
||||||
|
|
||||||
if (component instanceof R3.Query.Logins.VPN) {
|
if (component instanceof R3.Query.Logins.VPN) {
|
||||||
return R3.COMPONENT_QUERY_LOGINS_VPN;
|
return R3.COMPONENT_QUERY_LOGINS_VPN;
|
||||||
}
|
}
|
||||||
|
@ -1604,6 +1609,10 @@ R3.GetComponentType = function(component) {
|
||||||
return R3.COMPONENT_RENDERER;
|
return R3.COMPONENT_RENDERER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (component instanceof R3.API.Query.UserDevices) {
|
||||||
|
return R3.COMPONENT_QUERY_USERDEVICES;
|
||||||
|
}
|
||||||
|
|
||||||
if (component instanceof R3.API.Query.Logins.VPN) {
|
if (component instanceof R3.API.Query.Logins.VPN) {
|
||||||
return R3.COMPONENT_QUERY_LOGINS_VPN;
|
return R3.COMPONENT_QUERY_LOGINS_VPN;
|
||||||
}
|
}
|
||||||
|
@ -1924,6 +1933,12 @@ R3.GetComponentInfo = function(componentType) {
|
||||||
apiConstructor : R3.API.Renderer,
|
apiConstructor : R3.API.Renderer,
|
||||||
runtime: R3.Runtime.GRAPHICS
|
runtime: R3.Runtime.GRAPHICS
|
||||||
};
|
};
|
||||||
|
case R3.COMPONENT_QUERY_USERDEVICES : return {
|
||||||
|
name : 'R3.Query.UserDevices',
|
||||||
|
constructor : R3.Query.UserDevices,
|
||||||
|
apiConstructor : R3.API.Query.UserDevices,
|
||||||
|
runtime: R3.Runtime.DEFAULT
|
||||||
|
};
|
||||||
case R3.COMPONENT_QUERY_LOGINS_VPN : return {
|
case R3.COMPONENT_QUERY_LOGINS_VPN : return {
|
||||||
name : 'R3.Query.Logins.VPN',
|
name : 'R3.Query.Logins.VPN',
|
||||||
constructor : R3.Query.Logins.VPN,
|
constructor : R3.Query.Logins.VPN,
|
||||||
|
@ -3092,6 +3107,9 @@ R3.GetAPIConstructor = function(runtimeComponent) {
|
||||||
if (runtimeComponent instanceof R3.Renderer){
|
if (runtimeComponent instanceof R3.Renderer){
|
||||||
return R3.API.Renderer;
|
return R3.API.Renderer;
|
||||||
}
|
}
|
||||||
|
if (runtimeComponent instanceof R3.Query.UserDevices){
|
||||||
|
return R3.API.Query.UserDevices;
|
||||||
|
}
|
||||||
if (runtimeComponent instanceof R3.Query.Logins.VPN){
|
if (runtimeComponent instanceof R3.Query.Logins.VPN){
|
||||||
return R3.API.Query.Logins.VPN;
|
return R3.API.Query.Logins.VPN;
|
||||||
}
|
}
|
||||||
|
@ -3706,6 +3724,9 @@ R3.GetConstructor = function(apiComponent) {
|
||||||
if (apiComponent instanceof R3.API.Renderer){
|
if (apiComponent instanceof R3.API.Renderer){
|
||||||
return R3.Renderer;
|
return R3.Renderer;
|
||||||
}
|
}
|
||||||
|
if (apiComponent instanceof R3.API.Query.UserDevices){
|
||||||
|
return R3.Query.UserDevices;
|
||||||
|
}
|
||||||
if (apiComponent instanceof R3.API.Query.Logins.VPN){
|
if (apiComponent instanceof R3.API.Query.Logins.VPN){
|
||||||
return R3.Query.Logins.VPN;
|
return R3.Query.Logins.VPN;
|
||||||
}
|
}
|
||||||
|
@ -4288,6 +4309,7 @@ R3.GetConstructorFromComponentType = function(componentType) {
|
||||||
case R3.COMPONENT_RENDERER_D3: return R3.Renderer.D3;
|
case R3.COMPONENT_RENDERER_D3: return R3.Renderer.D3;
|
||||||
case R3.COMPONENT_RENDERER_D2: return R3.Renderer.D2;
|
case R3.COMPONENT_RENDERER_D2: return R3.Renderer.D2;
|
||||||
case R3.COMPONENT_RENDERER: return R3.Renderer;
|
case R3.COMPONENT_RENDERER: return R3.Renderer;
|
||||||
|
case R3.COMPONENT_QUERY_USERDEVICES: return R3.Query.UserDevices;
|
||||||
case R3.COMPONENT_QUERY_LOGINS_VPN: return R3.Query.Logins.VPN;
|
case R3.COMPONENT_QUERY_LOGINS_VPN: return R3.Query.Logins.VPN;
|
||||||
case R3.COMPONENT_QUERY_LOGINS_DEVICES: return R3.Query.Logins.Devices;
|
case R3.COMPONENT_QUERY_LOGINS_DEVICES: return R3.Query.Logins.Devices;
|
||||||
case R3.COMPONENT_QUERY_LOGINS_APPLICATIONS: return R3.Query.Logins.Applications;
|
case R3.COMPONENT_QUERY_LOGINS_APPLICATIONS: return R3.Query.Logins.Applications;
|
||||||
|
@ -4536,6 +4558,9 @@ R3.GetComponentName = function(runtimeComponent) {
|
||||||
if (runtimeComponent instanceof R3.Renderer){
|
if (runtimeComponent instanceof R3.Renderer){
|
||||||
return 'R3.Renderer';
|
return 'R3.Renderer';
|
||||||
}
|
}
|
||||||
|
if (runtimeComponent instanceof R3.Query.UserDevices){
|
||||||
|
return 'R3.Query.UserDevices';
|
||||||
|
}
|
||||||
if (runtimeComponent instanceof R3.Query.Logins.VPN){
|
if (runtimeComponent instanceof R3.Query.Logins.VPN){
|
||||||
return 'R3.Query.Logins.VPN';
|
return 'R3.Query.Logins.VPN';
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,8 @@ R3.API.Component = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
register,
|
register,
|
||||||
selected
|
selected,
|
||||||
|
isPublic
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(parent)) {
|
if (R3.Utils.UndefinedOrNull(parent)) {
|
||||||
|
@ -42,6 +43,11 @@ R3.API.Component = function(
|
||||||
}
|
}
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(isPublic)) {
|
||||||
|
isPublic = true;
|
||||||
|
}
|
||||||
|
this.isPublic = isPublic;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Component.prototype.constructor = R3.API.Component;
|
R3.API.Component.prototype.constructor = R3.API.Component;
|
||||||
|
|
|
@ -243,6 +243,20 @@ R3.Utils.Unloaded = function(component) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param component
|
||||||
|
* @returns {boolean}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.Utils.Loaded = function(component) {
|
||||||
|
if (component && component.instance) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
R3.Utils.BuildVectorSource = function(result, name, dimension) {
|
R3.Utils.BuildVectorSource = function(result, name, dimension) {
|
||||||
|
|
||||||
if (dimension === 2) {
|
if (dimension === 2) {
|
||||||
|
|
|
@ -116,6 +116,7 @@ R3.Component.prototype.removeComponent = function(data) {
|
||||||
*/
|
*/
|
||||||
if (
|
if (
|
||||||
component instanceof R3.Color ||
|
component instanceof R3.Color ||
|
||||||
|
component instanceof R3.Scalar ||
|
||||||
component instanceof R3.Vector2 ||
|
component instanceof R3.Vector2 ||
|
||||||
component instanceof R3.Vector3 ||
|
component instanceof R3.Vector3 ||
|
||||||
component instanceof R3.Vector4 ||
|
component instanceof R3.Vector4 ||
|
||||||
|
@ -256,6 +257,7 @@ R3.Component.prototype.buildVectoredComponents = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
this[property] instanceof R3.API.Scalar ||
|
||||||
this[property] instanceof R3.API.Vector2 ||
|
this[property] instanceof R3.API.Vector2 ||
|
||||||
this[property] instanceof R3.API.Vector3 ||
|
this[property] instanceof R3.API.Vector3 ||
|
||||||
this[property] instanceof R3.API.Vector4 ||
|
this[property] instanceof R3.API.Vector4 ||
|
||||||
|
@ -265,6 +267,29 @@ R3.Component.prototype.buildVectoredComponents = function() {
|
||||||
) {
|
) {
|
||||||
var constructor = R3.GetConstructor(this[property]);
|
var constructor = R3.GetConstructor(this[property]);
|
||||||
this[property] = new constructor(this[property]);
|
this[property] = new constructor(this[property]);
|
||||||
|
|
||||||
|
// if (this[property] instanceof R3.Scalar) {
|
||||||
|
// this['scalar' + property] = this[property];
|
||||||
|
// //this.__defineGetter__(property, function(_property){return function() { return this['scalar' + _property].value; }}(property).bind(this));
|
||||||
|
//
|
||||||
|
// Object.defineProperty(
|
||||||
|
// this,
|
||||||
|
// property,
|
||||||
|
// {
|
||||||
|
// get: function(_property) {
|
||||||
|
// return function() {
|
||||||
|
// return this['scalar' + _property].value;
|
||||||
|
// };
|
||||||
|
// }(property),
|
||||||
|
// set: function(_property) {
|
||||||
|
// return function(_value) {
|
||||||
|
// this['scalar' + _property].value = _value;
|
||||||
|
// };
|
||||||
|
// }(property)
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -577,24 +602,8 @@ R3.Component.prototype.performInstanceCreation = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function goes through all children objects of this component, updates the 'parent' property to
|
* The mother of all createInstance.
|
||||||
* be the newly constructed runtime component (and not the old API component)
|
|
||||||
*/
|
*/
|
||||||
R3.Component.prototype.updateParentsToRuntime = function() {
|
|
||||||
Object.keys(this.idToObject).map(
|
|
||||||
function(id) {
|
|
||||||
|
|
||||||
var child = this.idToObject[id];
|
|
||||||
|
|
||||||
if (child.parent) {
|
|
||||||
if (child.parent.id === this.id) {
|
|
||||||
child.parent = this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.Component.prototype.createInstance = function() {
|
R3.Component.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(this.instance)) {
|
if (R3.Utils.UndefinedOrNull(this.instance)) {
|
||||||
|
@ -611,7 +620,6 @@ R3.Component.prototype.createInstance = function() {
|
||||||
/**
|
/**
|
||||||
* idToObject can now be trusted
|
* idToObject can now be trusted
|
||||||
*/
|
*/
|
||||||
//this.updateParentsToRuntime();
|
|
||||||
|
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
|
|
||||||
|
@ -842,7 +850,7 @@ R3.Component.prototype.getPropertyValue = function(item) {
|
||||||
* If we get to this point and we still have an Object - we throw an error
|
* If we get to this point and we still have an Object - we throw an error
|
||||||
*/
|
*/
|
||||||
if (R3.Utils.IsObject(item)) {
|
if (R3.Utils.IsObject(item)) {
|
||||||
throw new Error('We still have an object here which is trying to get saved: ' + item);
|
return JSON.stringify(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
@ -879,6 +887,7 @@ R3.Component.prototype.toApiObject = function() {
|
||||||
var apiObject = new apiConstructor();
|
var apiObject = new apiConstructor();
|
||||||
|
|
||||||
for (var property in apiObject) {
|
for (var property in apiObject) {
|
||||||
|
|
||||||
if (apiObject.hasOwnProperty(property)) {
|
if (apiObject.hasOwnProperty(property)) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -945,26 +954,28 @@ R3.Component.prototype.toApiObject = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return apiObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all children components of this Object (all linked objects only - no object references i.e. string ids)
|
* Gets all children components of this Object (all linked objects only - no object references i.e. string ids)
|
||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
R3.Component.prototype.getChildrenComponents = function() {
|
// R3.Component.prototype.getChildrenComponents = function() {
|
||||||
|
//
|
||||||
var components = [];
|
// var components = [];
|
||||||
|
//
|
||||||
Object.keys(this.idToObject).map(
|
// Object.keys(this.idToObject).map(
|
||||||
function(objectId) {
|
// function(objectId) {
|
||||||
if (this.id !== objectId) {
|
// if (this.id !== objectId) {
|
||||||
components.push(this.idToObject[objectId]);
|
// components.push(this.idToObject[objectId]);
|
||||||
}
|
// }
|
||||||
}.bind(this)
|
// }.bind(this)
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
return components;
|
// return components;
|
||||||
};
|
// };
|
||||||
//
|
//
|
||||||
// R3.Component.prototype.processComponent = function(object) {
|
// R3.Component.prototype.processComponent = function(object) {
|
||||||
// if (object instanceof R3.Component) {
|
// if (object instanceof R3.Component) {
|
||||||
|
@ -1103,84 +1114,84 @@ R3.Component.prototype.generateNewIds = function() {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// R3.Component.prototype.replace = function(componentType) {
|
||||||
|
//
|
||||||
|
// var replacement = R3.Component.Construct(componentType);
|
||||||
|
//
|
||||||
|
// R3.Event.Emit(
|
||||||
|
// R3.Event.REPLACE_COMPONENT,
|
||||||
|
// {
|
||||||
|
// current : this,
|
||||||
|
// replacement : replacement
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (this.parent && this.parent.loaded) {
|
||||||
|
// this.parent.addComponent(replacement);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// this.remove();
|
||||||
|
//
|
||||||
|
// R3.Event.Emit(
|
||||||
|
// R3.Event.COMPONENT_REPLACED
|
||||||
|
// );
|
||||||
|
// };
|
||||||
|
|
||||||
|
//
|
||||||
R3.Component.prototype.replace = function(componentType) {
|
// R3.Component.prototype.clone = function() {
|
||||||
|
//
|
||||||
var replacement = R3.Component.Construct(componentType);
|
// var apiObject = this.toApiObject();
|
||||||
|
//
|
||||||
R3.Event.Emit(
|
// this.cloneNumber += 1;
|
||||||
R3.Event.REPLACE_COMPONENT,
|
//
|
||||||
{
|
// apiObject.id = R3.Utils.RandomId();
|
||||||
current : this,
|
//
|
||||||
replacement : replacement
|
// apiObject.name = this.name + ' Clone (' + this.cloneNumber + ')';
|
||||||
}
|
//
|
||||||
);
|
// var runtimeComponent = R3.Component.ConstructFromObject(apiObject);
|
||||||
|
//
|
||||||
if (this.parent && this.parent.loaded) {
|
// runtimeComponent.isClone = true;
|
||||||
this.parent.addComponent(replacement);
|
//
|
||||||
}
|
// R3.Event.Emit(
|
||||||
|
// R3.Event.COMPONENT_CLONED,
|
||||||
this.remove();
|
// {
|
||||||
|
// parent : this,
|
||||||
R3.Event.Emit(
|
// component : runtimeComponent
|
||||||
R3.Event.COMPONENT_REPLACED
|
// }
|
||||||
);
|
// );
|
||||||
};
|
//
|
||||||
|
// runtimeComponent.parent = null;
|
||||||
|
//
|
||||||
R3.Component.prototype.clone = function() {
|
// return runtimeComponent;
|
||||||
|
// };
|
||||||
var apiObject = this.toApiObject();
|
//
|
||||||
|
// /**
|
||||||
this.cloneNumber += 1;
|
// * Clones only the instance
|
||||||
|
// */
|
||||||
apiObject.id = R3.Utils.RandomId();
|
// R3.Component.prototype.cloneInstance = function() {
|
||||||
|
//
|
||||||
apiObject.name = this.name + ' Clone (' + this.cloneNumber + ')';
|
// var clone = null;
|
||||||
|
//
|
||||||
var runtimeComponent = R3.Component.ConstructFromObject(apiObject);
|
// if (
|
||||||
|
// this.instance &&
|
||||||
runtimeComponent.isClone = true;
|
// this.instance.clone &&
|
||||||
|
// typeof (this.instance.clone === 'function')) {
|
||||||
R3.Event.Emit(
|
//
|
||||||
R3.Event.COMPONENT_CLONED,
|
// clone = this.instance.clone();
|
||||||
{
|
//
|
||||||
parent : this,
|
// R3.Event.Emit(
|
||||||
component : runtimeComponent
|
// R3.Event.INSTANCE_CLONED,
|
||||||
}
|
// {
|
||||||
);
|
// component : this,
|
||||||
|
// instance : clone
|
||||||
runtimeComponent.parent = null;
|
// }
|
||||||
|
// )
|
||||||
return runtimeComponent;
|
// }
|
||||||
};
|
//
|
||||||
|
// return clone;
|
||||||
/**
|
// };
|
||||||
* Clones only the instance
|
|
||||||
*/
|
|
||||||
R3.Component.prototype.cloneInstance = function() {
|
|
||||||
|
|
||||||
var clone = null;
|
|
||||||
|
|
||||||
if (
|
|
||||||
this.instance &&
|
|
||||||
this.instance.clone &&
|
|
||||||
typeof (this.instance.clone === 'function')) {
|
|
||||||
|
|
||||||
clone = this.instance.clone();
|
|
||||||
|
|
||||||
R3.Event.Emit(
|
|
||||||
R3.Event.INSTANCE_CLONED,
|
|
||||||
{
|
|
||||||
component : this,
|
|
||||||
instance : clone
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return clone;
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.Component.prototype.saveToRemoteAPI = function() {
|
R3.Component.prototype.saveToRemoteAPI = function() {
|
||||||
this.save(true);
|
this.save(true);
|
||||||
|
@ -1188,110 +1199,10 @@ R3.Component.prototype.saveToRemoteAPI = function() {
|
||||||
|
|
||||||
R3.Component.prototype.save = function(remote) {
|
R3.Component.prototype.save = function(remote) {
|
||||||
|
|
||||||
var toSave = [];
|
|
||||||
var saved = [];
|
|
||||||
var failed = [];
|
|
||||||
|
|
||||||
if (this.saveSubscription || this.saveErrorSubscription) {
|
|
||||||
console.warn('another save is in progress');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.SAVING,
|
|
||||||
{
|
|
||||||
component: this
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this.saveSubscription = R3.Event.Subscribe(
|
|
||||||
R3.Event.COMPONENT_SAVED,
|
|
||||||
function(data) {
|
|
||||||
|
|
||||||
saved.push(data.component);
|
|
||||||
|
|
||||||
if (failed.length + saved.length === toSave.length) {
|
|
||||||
|
|
||||||
this.saveSubscription.remove();
|
|
||||||
|
|
||||||
this.saveSubscription = null;
|
|
||||||
|
|
||||||
this.saveErrorSubscription.remove();
|
|
||||||
|
|
||||||
this.saveErrorSubscription = null;
|
|
||||||
|
|
||||||
R3.Event.Emit(
|
|
||||||
R3.Event.DONE_SAVING,
|
|
||||||
{
|
|
||||||
failed: failed,
|
|
||||||
saved: saved
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.saveErrorSubscription = R3.Event.Subscribe(
|
|
||||||
R3.Event.SAVE_COMPONENT_ERROR,
|
|
||||||
function(data) {
|
|
||||||
|
|
||||||
failed.push(data.component);
|
|
||||||
|
|
||||||
if (failed.length + saved.length === toSave.length) {
|
|
||||||
|
|
||||||
this.saveSubscription.remove();
|
|
||||||
|
|
||||||
this.saveSubscription = null;
|
|
||||||
|
|
||||||
this.saveErrorSubscription.remove();
|
|
||||||
|
|
||||||
this.saveErrorSubscription = null;
|
|
||||||
|
|
||||||
R3.Event.Emit(
|
|
||||||
R3.Event.DONE_SAVING,
|
|
||||||
{
|
|
||||||
failed: failed,
|
|
||||||
saved: saved
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Object.keys(this.idToObject).map(
|
|
||||||
function(componentId) {
|
|
||||||
|
|
||||||
var component = this.idToObject[componentId];
|
|
||||||
|
|
||||||
if (this instanceof R3.Entity) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We don't store children objects of entities which are not explicitly defined as children of this entity.
|
|
||||||
*/
|
|
||||||
if (
|
|
||||||
this.components.indexOf(component) === -1 &&
|
|
||||||
this !== component
|
|
||||||
) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We don't want to store this component - but other components may depend on it
|
|
||||||
*/
|
|
||||||
console.warn(component.name + ' is being stored because a component depends on it - even though it was not explicitly added to this entity.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiObject = component.toApiObject();
|
|
||||||
|
|
||||||
toSave.push(apiObject);
|
|
||||||
|
|
||||||
this.emit(
|
|
||||||
R3.Event.SAVE_COMPONENT,
|
R3.Event.SAVE_COMPONENT,
|
||||||
{
|
{
|
||||||
apiObject: apiObject,
|
component : this,
|
||||||
remote : remote
|
remote : remote
|
||||||
},
|
},
|
||||||
function success(result) {
|
function success(result) {
|
||||||
|
@ -1302,96 +1213,94 @@ R3.Component.prototype.save = function(remote) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {null|Object}
|
* @return {null|Object}
|
||||||
*/
|
*/
|
||||||
R3.Component.GetRuntimeObject = function(info) {
|
// R3.Component.GetRuntimeObject = function(info) {
|
||||||
|
//
|
||||||
|
// var runtime = null;
|
||||||
|
//
|
||||||
|
// R3.Event.Emit(
|
||||||
|
// R3.Event.GET_RUNTIME,
|
||||||
|
// null,
|
||||||
|
// function(runtimeObject) {
|
||||||
|
// runtime = runtimeObject;
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (info.runtime instanceof R3.Runtime.Graphics) {
|
||||||
|
//
|
||||||
|
// if (R3.Utils.UndefinedOrNull(runtime.graphics)) {
|
||||||
|
// console.warn('no runtime graphics: ', info);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return runtime.graphics;
|
||||||
|
//
|
||||||
|
// } else if (info.runtime === R3.Runtime.PHYSICS) {
|
||||||
|
//
|
||||||
|
// if (R3.Utils.UndefinedOrNull(runtime.physics)) {
|
||||||
|
// console.warn('no runtime physics ', info);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return runtime.physics;
|
||||||
|
//
|
||||||
|
// } else if (info.runtime === R3.Runtime.GUI) {
|
||||||
|
//
|
||||||
|
// if (R3.Utils.UndefinedOrNull(runtime.gui)) {
|
||||||
|
// console.warn('no runtime gui ', info);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return runtime.gui;
|
||||||
|
//
|
||||||
|
// } else if (info.runtime === R3.Runtime.SOCKETS) {
|
||||||
|
//
|
||||||
|
// if (R3.Utils.UndefinedOrNull(runtime.sockets)) {
|
||||||
|
// console.warn('no runtime sockets ', info);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return runtime.sockets;
|
||||||
|
//
|
||||||
|
// } else if (info.runtime === R3.Runtime.STATISTICS) {
|
||||||
|
//
|
||||||
|
// if (R3.Utils.UndefinedOrNull(runtime.statistics)) {
|
||||||
|
// console.warn('no runtime statistics ', info);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return runtime.statistics;
|
||||||
|
//
|
||||||
|
// } else if (info.runtime === R3.Runtime.DEFAULT) {
|
||||||
|
//
|
||||||
|
// return null;
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// throw new Error('unknown runtime object found: ' + info);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return null;
|
||||||
|
// };
|
||||||
|
|
||||||
var runtime = null;
|
// R3.Component.Construct = function(componentType) {
|
||||||
|
//
|
||||||
R3.Event.Emit(
|
// var info = R3.GetComponentInfo(componentType);
|
||||||
R3.Event.GET_RUNTIME,
|
//
|
||||||
null,
|
// var componentClass = info.constructor;
|
||||||
function(runtimeObject) {
|
//
|
||||||
runtime = runtimeObject;
|
// var runtime = R3.Component.GetRuntimeObject(info);
|
||||||
}
|
//
|
||||||
);
|
// if (runtime) {
|
||||||
|
// return new componentClass(runtime);
|
||||||
if (info.runtime instanceof R3.Runtime.Graphics) {
|
// } else {
|
||||||
|
// return new componentClass();
|
||||||
if (R3.Utils.UndefinedOrNull(runtime.graphics)) {
|
// }
|
||||||
console.warn('no runtime graphics: ', info);
|
//
|
||||||
return null;
|
// };
|
||||||
}
|
|
||||||
|
|
||||||
return runtime.graphics;
|
|
||||||
|
|
||||||
} else if (info.runtime === R3.Runtime.PHYSICS) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(runtime.physics)) {
|
|
||||||
console.warn('no runtime physics ', info);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return runtime.physics;
|
|
||||||
|
|
||||||
} else if (info.runtime === R3.Runtime.GUI) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(runtime.gui)) {
|
|
||||||
console.warn('no runtime gui ', info);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return runtime.gui;
|
|
||||||
|
|
||||||
} else if (info.runtime === R3.Runtime.SOCKETS) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(runtime.sockets)) {
|
|
||||||
console.warn('no runtime sockets ', info);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return runtime.sockets;
|
|
||||||
|
|
||||||
} else if (info.runtime === R3.Runtime.STATISTICS) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(runtime.statistics)) {
|
|
||||||
console.warn('no runtime statistics ', info);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return runtime.statistics;
|
|
||||||
|
|
||||||
} else if (info.runtime === R3.Runtime.DEFAULT) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throw new Error('unknown runtime object found: ' + info);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.Component.Construct = function(componentType) {
|
|
||||||
|
|
||||||
var info = R3.GetComponentInfo(componentType);
|
|
||||||
|
|
||||||
var componentClass = info.constructor;
|
|
||||||
|
|
||||||
var runtime = R3.Component.GetRuntimeObject(info);
|
|
||||||
|
|
||||||
if (runtime) {
|
|
||||||
return new componentClass(runtime);
|
|
||||||
} else {
|
|
||||||
return new componentClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.Component.ConstructFromObject = function(rawComponentObject) {
|
R3.Component.ConstructFromObject = function(rawComponentObject) {
|
||||||
|
|
||||||
|
|
|
@ -18,29 +18,31 @@ R3.API.Canvas = function(
|
||||||
apiComponent.width = 450;
|
apiComponent.width = 450;
|
||||||
}
|
}
|
||||||
this.width = apiComponent.width;
|
this.width = apiComponent.width;
|
||||||
|
this.guiInfo.width = {
|
||||||
|
range: [0, 5120],
|
||||||
|
step: 1,
|
||||||
|
dp: 0
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
|
||||||
apiComponent.height = 450;
|
apiComponent.height = 450;
|
||||||
}
|
}
|
||||||
this.height = apiComponent.height;
|
this.height = apiComponent.height;
|
||||||
|
this.guiInfo.height = {
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.offset)) {
|
range: [0, 5120],
|
||||||
apiComponent.offset = new R3.API.Vector2(
|
step: 1,
|
||||||
{
|
dp: 0
|
||||||
parent : this,
|
};
|
||||||
register : true,
|
|
||||||
name : this.name + ' - Offset',
|
|
||||||
x : 0,
|
|
||||||
y : 0
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.offset = apiComponent.offset;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.tabIndex)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.tabIndex)) {
|
||||||
apiComponent.tabIndex = 1;
|
apiComponent.tabIndex = 1;
|
||||||
}
|
}
|
||||||
this.tabIndex = apiComponent.tabIndex;
|
this.tabIndex = apiComponent.tabIndex;
|
||||||
|
this.guiInfo.tabIndex = {
|
||||||
|
range: [0, 100],
|
||||||
|
step: 1,
|
||||||
|
dp: 0
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.texts)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.texts)) {
|
||||||
apiComponent.texts = [];
|
apiComponent.texts = [];
|
||||||
|
|
|
@ -9,6 +9,11 @@ R3.API.Clock = function(
|
||||||
|
|
||||||
__API_COMPONENT__;
|
__API_COMPONENT__;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.delta)) {
|
||||||
|
apiComponent.delta = 0;
|
||||||
|
}
|
||||||
|
this.delta = apiComponent.delta;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Clock.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Clock.prototype = Object.create(R3.API.Component.prototype);
|
||||||
|
|
|
@ -18,11 +18,6 @@ R3.API.Project = function(
|
||||||
|
|
||||||
__DEFINE_API_COMPONENT__
|
__DEFINE_API_COMPONENT__
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.isPublic)) {
|
|
||||||
apiComponent.isPublic = true;
|
|
||||||
}
|
|
||||||
this.isPublic = apiComponent.isPublic;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.entities)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.entities)) {
|
||||||
apiComponent.entities = [];
|
apiComponent.entities = [];
|
||||||
}
|
}
|
||||||
|
@ -111,6 +106,7 @@ R3.API.Project = function(
|
||||||
apiComponent.applicationMode = R3.API.Project.APPLICATION_MODE_EDIT;
|
apiComponent.applicationMode = R3.API.Project.APPLICATION_MODE_EDIT;
|
||||||
}
|
}
|
||||||
this.applicationMode = apiComponent.applicationMode;
|
this.applicationMode = apiComponent.applicationMode;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Project.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Project.prototype = Object.create(R3.API.Component.prototype);
|
||||||
|
|
|
@ -57,8 +57,6 @@ R3.API.Project.D2 = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Project.D2.prototype = Object.create(R3.API.Project.prototype);
|
R3.API.Project.D2.prototype = Object.create(R3.API.Project.prototype);
|
||||||
|
|
|
@ -121,6 +121,23 @@ R3.API.Project.D3 = function(
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.composer)) {
|
||||||
|
apiComponent.composer = new R3.D3.API.Composer(
|
||||||
|
{
|
||||||
|
parent : this,
|
||||||
|
name : this.name + ' - Composer',
|
||||||
|
renderer : this.renderers[0],
|
||||||
|
camera : this.cameras[0]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.composer = apiComponent.composer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.effect)) {
|
||||||
|
apiComponent.effect = null;
|
||||||
|
}
|
||||||
|
this.effect = apiComponent.effect;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.renderTargets)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.renderTargets)) {
|
||||||
apiComponent.renderTargets = [];
|
apiComponent.renderTargets = [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,14 @@ R3.API.Project.D3.VR = function(
|
||||||
new R3.D3.API.Viewport.FixedAspect.VR(
|
new R3.D3.API.Viewport.FixedAspect.VR(
|
||||||
{
|
{
|
||||||
parent : this,
|
parent : this,
|
||||||
name : this.name + ' - FA VR Left Viewport',
|
name : this.name + ' - Fixed Aspect VR Left Viewport',
|
||||||
side : R3.D3.API.Viewport.FixedAspect.VR.VIEWPORT_LEFT
|
side : R3.D3.API.Viewport.FixedAspect.VR.VIEWPORT_LEFT
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
new R3.D3.API.Viewport.FixedAspect.VR(
|
new R3.D3.API.Viewport.FixedAspect.VR(
|
||||||
{
|
{
|
||||||
parent : this,
|
parent : this,
|
||||||
name : this.name + ' - FA VR Right Viewport',
|
name : this.name + ' - Fixed Aspect VR Right Viewport',
|
||||||
side : R3.D3.API.Viewport.FixedAspect.VR.VIEWPORT_RIGHT
|
side : R3.D3.API.Viewport.FixedAspect.VR.VIEWPORT_RIGHT
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -47,6 +47,11 @@ R3.API.Query = function(
|
||||||
}
|
}
|
||||||
this.text = apiComponent.text;
|
this.text = apiComponent.text;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.httpMethod)) {
|
||||||
|
apiComponent.httpMethod = 'POST';
|
||||||
|
}
|
||||||
|
this.httpMethod = apiComponent.httpMethod;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Query.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Query.prototype = Object.create(R3.API.Component.prototype);
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/**
|
||||||
|
* R3.API.Query.UserDevices
|
||||||
|
* @param apiComponent
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.API.Query.UserDevices = function(
|
||||||
|
apiComponent
|
||||||
|
) {
|
||||||
|
|
||||||
|
__DEFINE_API_COMPONENT__
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.path)) {
|
||||||
|
apiComponent.path = '/crud/user_devices.json';
|
||||||
|
}
|
||||||
|
this.path = apiComponent.path;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.httpMethod)) {
|
||||||
|
apiComponent.httpMethod = 'GET';
|
||||||
|
}
|
||||||
|
this.httpMethod = apiComponent.httpMethod;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.text)) {
|
||||||
|
apiComponent.text = '';
|
||||||
|
}
|
||||||
|
this.text = apiComponent.text;
|
||||||
|
|
||||||
|
R3.API.Query.call(
|
||||||
|
this,
|
||||||
|
apiComponent
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.API.Query.UserDevices.prototype = Object.create(R3.API.Query.prototype);
|
||||||
|
R3.API.Query.UserDevices.prototype.constructor = R3.API.Query.UserDevices;
|
|
@ -20,7 +20,9 @@ R3.API.Renderer.SHADOW_MAP_TYPE_BASIC = 0;
|
||||||
R3.API.Renderer.SHADOW_MAP_TYPE_PCF = 1;
|
R3.API.Renderer.SHADOW_MAP_TYPE_PCF = 1;
|
||||||
R3.API.Renderer.SHADOW_MAP_TYPE_PCF_SOFT = 2;
|
R3.API.Renderer.SHADOW_MAP_TYPE_PCF_SOFT = 2;
|
||||||
|
|
||||||
|
R3.API.Renderer.TONE_MAPPING_NONE = 0;
|
||||||
R3.API.Renderer.TONE_MAPPING_LINEAR = 1;
|
R3.API.Renderer.TONE_MAPPING_LINEAR = 1;
|
||||||
R3.API.Renderer.TONE_MAPPING_REINHARD = 2;
|
R3.API.Renderer.TONE_MAPPING_REINHARD = 2;
|
||||||
R3.API.Renderer.TONE_MAPPING_UNCHARTED_2 = 3;
|
R3.API.Renderer.TONE_MAPPING_UNCHARTED_2 = 3;
|
||||||
R3.API.Renderer.TONE_MAPPING_CINEON = 4;
|
R3.API.Renderer.TONE_MAPPING_CINEON = 4;
|
||||||
|
R3.API.Renderer.TONE_MAPPING_ACES_FILMIC = 5;
|
||||||
|
|
|
@ -123,16 +123,54 @@ R3.API.Renderer.D3 = function(
|
||||||
apiComponent.toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
|
apiComponent.toneMapping = R3.API.Renderer.TONE_MAPPING_LINEAR;
|
||||||
}
|
}
|
||||||
this.toneMapping = apiComponent.toneMapping;
|
this.toneMapping = apiComponent.toneMapping;
|
||||||
|
this.guiInfo.toneMapping = {
|
||||||
|
options : [
|
||||||
|
{
|
||||||
|
name : 'none',
|
||||||
|
value : R3.API.Renderer.TONE_MAPPING_NONE
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'linear',
|
||||||
|
value : R3.API.Renderer.TONE_MAPPING_LINEAR
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'reinhard',
|
||||||
|
value : R3.API.Renderer.TONE_MAPPING_REINHARD
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'uncharted 2',
|
||||||
|
value : R3.API.Renderer.TONE_MAPPING_UNCHARTED_2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'cineon',
|
||||||
|
value : R3.API.Renderer.TONE_MAPPING_CINEON
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name : 'filmic',
|
||||||
|
value : R3.API.Renderer.TONE_MAPPING_ACES_FILMIC
|
||||||
|
},
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.toneMappingExposure)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.toneMappingExposure)) {
|
||||||
apiComponent.toneMappingExposure = 1;
|
apiComponent.toneMappingExposure = 1;
|
||||||
}
|
}
|
||||||
this.toneMappingExposure = apiComponent.toneMappingExposure;
|
this.toneMappingExposure = apiComponent.toneMappingExposure;
|
||||||
|
this.guiInfo.toneMappingExposure = {
|
||||||
|
range: [0, 16],
|
||||||
|
step: 0.001,
|
||||||
|
dp: 3
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.toneMappingWhitePoint)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.toneMappingWhitePoint)) {
|
||||||
apiComponent.toneMappingWhitePoint = 1;
|
apiComponent.toneMappingWhitePoint = 1;
|
||||||
}
|
}
|
||||||
this.toneMappingWhitePoint = apiComponent.toneMappingWhitePoint;
|
this.toneMappingWhitePoint = apiComponent.toneMappingWhitePoint;
|
||||||
|
this.guiInfo.toneMappingWhitePoint = {
|
||||||
|
range: [0, 16],
|
||||||
|
step: 0.001,
|
||||||
|
dp: 3
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.premultipliedAlpha)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.premultipliedAlpha)) {
|
||||||
apiComponent.premultipliedAlpha = true;
|
apiComponent.premultipliedAlpha = true;
|
||||||
|
@ -180,9 +218,9 @@ R3.API.Renderer.D3 = function(
|
||||||
parent : this,
|
parent : this,
|
||||||
register : true,
|
register : true,
|
||||||
name : this.name + ' - Clear Color',
|
name : this.name + ' - Clear Color',
|
||||||
r : 0.11,
|
r : 0,
|
||||||
g : 0.11,
|
g : 0.129,
|
||||||
b : 0.11
|
b : 0.184
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +231,7 @@ R3.API.Renderer.D3 = function(
|
||||||
new R3.D3.API.Viewport.FixedAspect(
|
new R3.D3.API.Viewport.FixedAspect(
|
||||||
{
|
{
|
||||||
parent : this,
|
parent : this,
|
||||||
name : this.name + ' - FA Viewport'
|
name : this.name + ' - Fixed Aspect Viewport'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
@ -220,11 +258,31 @@ R3.API.Renderer.D3 = function(
|
||||||
apiComponent.opacity = 1;
|
apiComponent.opacity = 1;
|
||||||
}
|
}
|
||||||
this.opacity = apiComponent.opacity;
|
this.opacity = apiComponent.opacity;
|
||||||
|
this.guiInfo.opacity = {
|
||||||
|
range: [0, 1],
|
||||||
|
step: 0.001,
|
||||||
|
dp: 3
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.pixelRatio)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.pixelRatio)) {
|
||||||
apiComponent.pixelRatio = window.devicePixelRatio;
|
apiComponent.pixelRatio = window.devicePixelRatio;
|
||||||
}
|
}
|
||||||
this.pixelRatio = apiComponent.pixelRatio;
|
this.pixelRatio = apiComponent.pixelRatio;
|
||||||
|
this.guiInfo.pixelRatio = {
|
||||||
|
range: [0, 4],
|
||||||
|
step: 0.001,
|
||||||
|
dp: 3
|
||||||
|
};
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.enableComposer)) {
|
||||||
|
apiComponent.enableComposer = true;
|
||||||
|
}
|
||||||
|
this.enableComposer = apiComponent.enableComposer;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.enableEffect)) {
|
||||||
|
apiComponent.enableEffect = false;
|
||||||
|
}
|
||||||
|
this.enableEffect = apiComponent.enableEffect;
|
||||||
|
|
||||||
R3.API.Renderer.call(
|
R3.API.Renderer.call(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -20,6 +20,21 @@ R3.API.Scalar = function(
|
||||||
}
|
}
|
||||||
this.value = apiComponent.value;
|
this.value = apiComponent.value;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.range)) {
|
||||||
|
apiComponent.range = [-1, 1];
|
||||||
|
}
|
||||||
|
this.range = apiComponent.range;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.step)) {
|
||||||
|
apiComponent.step = 0.01;
|
||||||
|
}
|
||||||
|
this.step = apiComponent.step;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.dp)) {
|
||||||
|
apiComponent.dp = 2;
|
||||||
|
}
|
||||||
|
this.dp = apiComponent.dp;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Scalar.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.Scalar.prototype = Object.create(R3.API.Component.prototype);
|
||||||
|
|
|
@ -43,12 +43,6 @@ R3.Canvas.prototype.updateInstance = function(property) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'offset') {
|
|
||||||
this.instance.style.left = this.offset.x + 'px';
|
|
||||||
this.instance.style.top = this.offset.y + 'px';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'tabIndex') {
|
if (property === 'tabIndex') {
|
||||||
this.instance.setAttribute('tabIndex', this.tabIndex);
|
this.instance.setAttribute('tabIndex', this.tabIndex);
|
||||||
return;
|
return;
|
||||||
|
@ -56,7 +50,7 @@ R3.Canvas.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'width') {
|
if (property === 'width') {
|
||||||
this.instance.setAttribute('width', this.width);
|
this.instance.setAttribute('width', this.width);
|
||||||
this.instance.setAttribute('style', 'left: ' + this.offset.x + 'px;top: ' + this.offset.y + 'px;width:' + this.width + 'px;height:' + this.height + 'px');
|
this.instance.setAttribute('style', 'width:' + this.width + 'px;height:' + this.height + 'px');
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.CANVAS_RESIZE,
|
R3.Event.CANVAS_RESIZE,
|
||||||
this
|
this
|
||||||
|
@ -66,7 +60,7 @@ R3.Canvas.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'height') {
|
if (property === 'height') {
|
||||||
this.instance.setAttribute('height', this.height);
|
this.instance.setAttribute('height', this.height);
|
||||||
this.instance.setAttribute('style', 'left: ' + this.offset.x + 'px;top: ' + this.offset.y + 'px;width:' + this.width + 'px;height:' + this.height + 'px');
|
this.instance.setAttribute('style', 'width:' + this.width + 'px;height:' + this.height + 'px');
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.CANVAS_RESIZE,
|
R3.Event.CANVAS_RESIZE,
|
||||||
this
|
this
|
||||||
|
|
|
@ -38,6 +38,8 @@ R3.Clock.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
R3.Clock.prototype.getDelta = function() {
|
R3.Clock.prototype.getDelta = function() {
|
||||||
|
|
||||||
return this.instance.getDelta();
|
this.delta = this.instance.getDelta();
|
||||||
|
|
||||||
|
return this.delta;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -116,6 +116,7 @@ R3.CustomCode.prototype.launchEditor = function(){
|
||||||
{
|
{
|
||||||
value: this.code,
|
value: this.code,
|
||||||
mode: 'javascript',
|
mode: 'javascript',
|
||||||
|
theme : 'darcula',
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
scrollbarStyle: 'overlay',
|
scrollbarStyle: 'overlay',
|
||||||
indentWithTabs: true,
|
indentWithTabs: true,
|
||||||
|
@ -124,6 +125,13 @@ R3.CustomCode.prototype.launchEditor = function(){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.editor.setOption("extraKeys", {
|
||||||
|
'Ctrl-/': function() {
|
||||||
|
this.editor.execCommand('toggleComment')
|
||||||
|
}.bind(this)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.editor.on('change', function(){
|
this.editor.on('change', function(){
|
||||||
|
|
||||||
this.code = this.editor.getValue();
|
this.code = this.editor.getValue();
|
||||||
|
|
|
@ -16,6 +16,11 @@ R3.D3.API.Camera = function(
|
||||||
apiComponent.aspectRatio = R3.D3.API.Camera.ASPECT_RATIO_1_1;
|
apiComponent.aspectRatio = R3.D3.API.Camera.ASPECT_RATIO_1_1;
|
||||||
}
|
}
|
||||||
this.aspectRatio = apiComponent.aspectRatio;
|
this.aspectRatio = apiComponent.aspectRatio;
|
||||||
|
this.guiInfo.aspectRatio = {
|
||||||
|
range: [0, 4],
|
||||||
|
step: 0.0001,
|
||||||
|
dp: 4
|
||||||
|
};
|
||||||
|
|
||||||
R3.D3.API.Object.call(
|
R3.D3.API.Object.call(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -39,36 +39,71 @@ R3.D3.API.Camera.Perspective = function(
|
||||||
apiComponent.near = 0.1;
|
apiComponent.near = 0.1;
|
||||||
}
|
}
|
||||||
this.near = apiComponent.near;
|
this.near = apiComponent.near;
|
||||||
|
this.guiInfo.near = {
|
||||||
|
range: [0, 100],
|
||||||
|
step: 0.01,
|
||||||
|
dp: 2
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.far)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.far)) {
|
||||||
apiComponent.far = 2000;
|
apiComponent.far = 2000;
|
||||||
}
|
}
|
||||||
this.far = apiComponent.far;
|
this.far = apiComponent.far;
|
||||||
|
this.guiInfo.far = {
|
||||||
|
range: [0, 2000],
|
||||||
|
step: 2,
|
||||||
|
dp: 0
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.fov)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.fov)) {
|
||||||
apiComponent.fov = 50;
|
apiComponent.fov = 50;
|
||||||
}
|
}
|
||||||
this.fov = apiComponent.fov;
|
this.fov = apiComponent.fov;
|
||||||
|
this.guiInfo.fov = {
|
||||||
|
range: [0, 150],
|
||||||
|
step: 1,
|
||||||
|
dp: 0
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.filmGauge)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.filmGauge)) {
|
||||||
apiComponent.filmGauge = 35;
|
apiComponent.filmGauge = 35;
|
||||||
}
|
}
|
||||||
this.filmGauge = apiComponent.filmGauge;
|
this.filmGauge = apiComponent.filmGauge;
|
||||||
|
this.guiInfo.filmGauge = {
|
||||||
|
range: [0, 35],
|
||||||
|
step: 1,
|
||||||
|
dp: 0
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.filmOffset)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.filmOffset)) {
|
||||||
apiComponent.filmOffset = 0;
|
apiComponent.filmOffset = 0;
|
||||||
}
|
}
|
||||||
this.filmOffset = apiComponent.filmOffset;
|
this.filmOffset = apiComponent.filmOffset;
|
||||||
|
this.guiInfo.filmGauge = {
|
||||||
|
range: [0, 1],
|
||||||
|
step: 0.01,
|
||||||
|
dp: 2
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.focus)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.focus)) {
|
||||||
apiComponent.focus = 10;
|
apiComponent.focus = 10;
|
||||||
}
|
}
|
||||||
this.focus = apiComponent.focus;
|
this.focus = apiComponent.focus;
|
||||||
|
this.guiInfo.focus = {
|
||||||
|
range: [0.1, 25],
|
||||||
|
step: 0.001,
|
||||||
|
dp:3
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.zoom)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.zoom)) {
|
||||||
apiComponent.zoom = 1;
|
apiComponent.zoom = 1;
|
||||||
}
|
}
|
||||||
this.zoom = apiComponent.zoom;
|
this.zoom = apiComponent.zoom;
|
||||||
|
this.guiInfo.zoom = {
|
||||||
|
range: [0, 100],
|
||||||
|
step: 0.1,
|
||||||
|
dp: 1
|
||||||
|
};
|
||||||
|
|
||||||
R3.D3.API.Camera.call(
|
R3.D3.API.Camera.call(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -13,6 +13,11 @@ R3.D3.API.Camera.Perspective.Stereo = function(
|
||||||
apiComponent.eyeSeperation = 0.064;
|
apiComponent.eyeSeperation = 0.064;
|
||||||
}
|
}
|
||||||
this.eyeSeperation = apiComponent.eyeSeperation;
|
this.eyeSeperation = apiComponent.eyeSeperation;
|
||||||
|
this.guiInfo.eyeSeperation = {
|
||||||
|
range: [0, 0.3],
|
||||||
|
step: 0.0001,
|
||||||
|
dp: 4
|
||||||
|
};
|
||||||
|
|
||||||
R3.D3.API.Camera.Perspective.call(
|
R3.D3.API.Camera.Perspective.call(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
*
|
*
|
||||||
* @property size
|
* @property size
|
||||||
* @property renderer
|
* @property renderer
|
||||||
* @property viewport
|
* @property renderTarget - Specify this to render to target instead
|
||||||
* @property renderTargetA
|
* @property renderTargetA - Used internally during render process
|
||||||
* @property renderTargetB
|
* @property renderTargetB - Used internally during render process
|
||||||
* @property passes
|
* @property passes
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
|
@ -22,6 +22,7 @@ R3.D3.API.Composer = function(
|
||||||
{
|
{
|
||||||
parent : this,
|
parent : this,
|
||||||
register : true,
|
register : true,
|
||||||
|
name : this.name + ' - Size',
|
||||||
x : 512,
|
x : 512,
|
||||||
y : 512
|
y : 512
|
||||||
}
|
}
|
||||||
|
@ -30,35 +31,72 @@ R3.D3.API.Composer = function(
|
||||||
this.size = apiComponent.size;
|
this.size = apiComponent.size;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.renderer)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.renderer)) {
|
||||||
apiComponent.renderer = this.getFirstParent(R3.API.Renderer.D3);
|
apiComponent.renderer = null;
|
||||||
}
|
}
|
||||||
this.renderer = apiComponent.renderer;
|
this.renderer = apiComponent.renderer;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.viewport)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.camera)) {
|
||||||
apiComponent.viewport = this.getFirstParent(R3.D3.API.Viewport);
|
apiComponent.camera = null;
|
||||||
}
|
}
|
||||||
this.viewport = apiComponent.viewport;
|
this.camera = apiComponent.camera;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.rendererTarget)) {
|
||||||
|
apiComponent.rendererTarget = null;
|
||||||
|
}
|
||||||
|
this.rendererTarget = apiComponent.rendererTarget;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.rendererTargetA)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.rendererTargetA)) {
|
||||||
apiComponent.rendererTargetA = new R3.D3.API.RenderTarget(
|
apiComponent.rendererTargetA = null;
|
||||||
{
|
|
||||||
parent : this
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
this.rendererTargetA = apiComponent.rendererTargetA;
|
this.rendererTargetA = apiComponent.rendererTargetA;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.renderTargetB)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.renderTargetB)) {
|
||||||
apiComponent.renderTargetB = new R3.D3.API.RenderTarget(
|
apiComponent.renderTargetB = null;
|
||||||
{
|
|
||||||
parent : this
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
this.renderTargetB = apiComponent.renderTargetB;
|
this.renderTargetB = apiComponent.renderTargetB;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.passes)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.passes)) {
|
||||||
apiComponent.passes = [];
|
|
||||||
|
apiComponent.passes = this.renderer.scenes.reduce(
|
||||||
|
function(result, scene) {
|
||||||
|
|
||||||
|
result.push(
|
||||||
|
new R3.D3.API.Pass.Render(
|
||||||
|
{
|
||||||
|
parent : this,
|
||||||
|
scene : scene,
|
||||||
|
name : this.name + ' - Render Pass',
|
||||||
|
camera : this.camera
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}.bind(this),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
apiComponent.passes.push(
|
||||||
|
new R3.D3.API.Pass.Bloom(
|
||||||
|
{
|
||||||
|
parent : this,
|
||||||
|
name : this.name + ' - Bloom Pass',
|
||||||
|
renderer : this.renderer
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
apiComponent.passes.push(
|
||||||
|
new R3.D3.API.Pass.FXAA(
|
||||||
|
{
|
||||||
|
parent : this,
|
||||||
|
name : this.name + ' - FXAA Pass',
|
||||||
|
renderer : this.renderer
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
this.passes = apiComponent.passes;
|
this.passes = apiComponent.passes;
|
||||||
|
|
||||||
|
|
|
@ -10,22 +10,21 @@ R3.D3.API.Fog = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT__;
|
__DEFINE_API_COMPONENT__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.color)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.color)) {
|
||||||
apiComponent.color = new R3.API.Color(
|
apiComponent.fogColor = new R3.API.Color(
|
||||||
{
|
{
|
||||||
parent : this,
|
parent : this,
|
||||||
register : true,
|
register : true,
|
||||||
name : this.name + ' - Color',
|
name : this.name + ' - Color',
|
||||||
r : 1,
|
r : 0,
|
||||||
g : 1,
|
g : 0.129,
|
||||||
b : 1,
|
b : 0.184
|
||||||
a : 1
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.color = apiComponent.color;
|
this.fogColor = apiComponent.fogColor;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,16 +10,22 @@ R3.D3.API.Fog.Exp = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
R3.D3.API.Fog.call(
|
__API_COMPONENT__;
|
||||||
this,
|
|
||||||
apiComponent
|
|
||||||
);
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.density)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.density)) {
|
||||||
apiComponent.density = 0.00025;
|
apiComponent.density = 0.00025;
|
||||||
}
|
}
|
||||||
this.density = apiComponent.density;
|
this.density = apiComponent.density;
|
||||||
|
this.guiInfo.density = {
|
||||||
|
range: [0, 0.001],
|
||||||
|
step: 0.00001,
|
||||||
|
dp: 5
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.D3.API.Fog.call(
|
||||||
|
this,
|
||||||
|
apiComponent
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.D3.API.Fog.Exp.prototype = Object.create(R3.D3.API.Fog.prototype);
|
R3.D3.API.Fog.Exp.prototype = Object.create(R3.D3.API.Fog.prototype);
|
||||||
|
|
|
@ -11,20 +11,32 @@ R3.D3.API.Fog.Normal = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
R3.D3.API.Fog.call(
|
__API_COMPONENT__
|
||||||
this,
|
|
||||||
apiComponent
|
|
||||||
);
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.near)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.near)) {
|
||||||
apiComponent.near = 1;
|
apiComponent.near = 1;
|
||||||
}
|
}
|
||||||
this.near = apiComponent.near;
|
this.near = apiComponent.near;
|
||||||
|
this.guiInfo.near = {
|
||||||
|
range: [0, 100],
|
||||||
|
step: 0.1,
|
||||||
|
dp: 1
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.far)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.far)) {
|
||||||
apiComponent.far = 1000;
|
apiComponent.far = 50;
|
||||||
}
|
}
|
||||||
this.far = apiComponent.far;
|
this.far = apiComponent.far;
|
||||||
|
this.guiInfo.far = {
|
||||||
|
range: [0, 1000],
|
||||||
|
step: 1,
|
||||||
|
dp: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.D3.API.Fog.call(
|
||||||
|
this,
|
||||||
|
apiComponent
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ R3.D3.API.Pass = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
__API_COMPONENT__;
|
__DEFINE_API_COMPONENT__;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.enabled)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.enabled)) {
|
||||||
apiComponent.enabled = true;
|
apiComponent.enabled = true;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
*
|
*
|
||||||
* @property autoUpdateSize
|
* @property autoUpdateSize
|
||||||
* @property renderer
|
* @property renderer
|
||||||
* @property viewport
|
|
||||||
* @property size
|
* @property size
|
||||||
* @property strength
|
* @property strength
|
||||||
* @property radius
|
* @property radius
|
||||||
|
@ -16,10 +15,7 @@ R3.D3.API.Pass.Bloom = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
R3.D3.API.Pass.call(
|
__API_COMPONENT__;
|
||||||
this,
|
|
||||||
apiComponent
|
|
||||||
);
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
|
||||||
apiComponent.autoUpdateSize = true;
|
apiComponent.autoUpdateSize = true;
|
||||||
|
@ -27,15 +23,10 @@ R3.D3.API.Pass.Bloom = function(
|
||||||
this.autoUpdateSize = apiComponent.autoUpdateSize;
|
this.autoUpdateSize = apiComponent.autoUpdateSize;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.renderer)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.renderer)) {
|
||||||
apiComponent.renderer = this.getFirstParent(R3.API.Renderer.D3);
|
apiComponent.renderer = null;
|
||||||
}
|
}
|
||||||
this.renderer = apiComponent.renderer;
|
this.renderer = apiComponent.renderer;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.viewport)) {
|
|
||||||
apiComponent.viewport = this.getFirstParent(R3.D3.API.Viewport);
|
|
||||||
}
|
|
||||||
this.viewport = apiComponent.viewport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We don't update the size of this component if autoUpdateSize is set until runtime - since the components
|
* We don't update the size of this component if autoUpdateSize is set until runtime - since the components
|
||||||
* could still be loading
|
* could still be loading
|
||||||
|
@ -54,19 +45,40 @@ R3.D3.API.Pass.Bloom = function(
|
||||||
this.size = apiComponent.size;
|
this.size = apiComponent.size;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.strength)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.strength)) {
|
||||||
apiComponent.strength = 1.5;
|
apiComponent.strength = 1.097;
|
||||||
}
|
}
|
||||||
this.strength = apiComponent.strength;
|
this.strength = apiComponent.strength;
|
||||||
|
this.guiInfo.strength = {
|
||||||
|
range: [0, 5],
|
||||||
|
step: 0.001,
|
||||||
|
dp: 3
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.radius)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.radius)) {
|
||||||
apiComponent.radius = 0.4;
|
apiComponent.radius = 1.817;
|
||||||
}
|
}
|
||||||
this.radius = apiComponent.radius;
|
this.radius = apiComponent.radius;
|
||||||
|
this.guiInfo.radius = {
|
||||||
|
range: [0, 5],
|
||||||
|
step: 0.001,
|
||||||
|
dp: 3
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.threshold)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.threshold)) {
|
||||||
apiComponent.threshold = 0.85;
|
apiComponent.threshold = 0.5;
|
||||||
}
|
}
|
||||||
this.threshold = apiComponent.threshold;
|
this.threshold = apiComponent.threshold;
|
||||||
|
this.guiInfo.threshold = {
|
||||||
|
range: [0, 1],
|
||||||
|
step: 0.0001,
|
||||||
|
dp: 4
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.D3.API.Pass.call(
|
||||||
|
this,
|
||||||
|
apiComponent
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,7 @@ R3.D3.API.Pass.Copy = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
/**
|
__API_COMPONENT__;
|
||||||
* Normally - copy pass is the last pass to be in a composer pass list and renders to the canvas (if renderTargetA
|
|
||||||
* is current render target)
|
|
||||||
*/
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent)) {
|
|
||||||
apiComponent = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.renderToScreen)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.renderToScreen)) {
|
||||||
apiComponent.renderToScreen = true;
|
apiComponent.renderToScreen = true;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
*
|
*
|
||||||
* @property autoUpdateSize
|
* @property autoUpdateSize
|
||||||
* @property renderer - we need a handle on the renderer to get the size of this pass (if autoUpdateSize is enabled)
|
* @property renderer - we need a handle on the renderer to get the size of this pass (if autoUpdateSize is enabled)
|
||||||
* @property viewport
|
|
||||||
* @property width
|
* @property width
|
||||||
* @property height
|
* @property height
|
||||||
*
|
*
|
||||||
|
@ -14,10 +13,7 @@ R3.D3.API.Pass.FXAA = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
R3.D3.API.Pass.call(
|
__API_COMPONENT__;
|
||||||
this,
|
|
||||||
apiComponent
|
|
||||||
);
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
|
||||||
apiComponent.autoUpdateSize = true;
|
apiComponent.autoUpdateSize = true;
|
||||||
|
@ -25,15 +21,10 @@ R3.D3.API.Pass.FXAA = function(
|
||||||
this.autoUpdateSize = apiComponent.autoUpdateSize;
|
this.autoUpdateSize = apiComponent.autoUpdateSize;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.renderer)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.renderer)) {
|
||||||
apiComponent.renderer = this.getFirstParent(R3.API.Renderer.D3);
|
apiComponent.renderer = null;
|
||||||
}
|
}
|
||||||
this.renderer = apiComponent.renderer;
|
this.renderer = apiComponent.renderer;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.viewport)) {
|
|
||||||
apiComponent.viewport = this.getFirstParent(R3.D3.API.Viewport);
|
|
||||||
}
|
|
||||||
this.viewport = apiComponent.viewport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We don't update the size of this component if autoUpdateSize is set until runtime - since the components
|
* We don't update the size of this component if autoUpdateSize is set until runtime - since the components
|
||||||
* could still be loading
|
* could still be loading
|
||||||
|
@ -49,6 +40,11 @@ R3.D3.API.Pass.FXAA = function(
|
||||||
}
|
}
|
||||||
this.height = apiComponent.height;
|
this.height = apiComponent.height;
|
||||||
|
|
||||||
|
R3.D3.API.Pass.call(
|
||||||
|
this,
|
||||||
|
apiComponent
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.D3.API.Pass.FXAA.prototype = Object.create(R3.D3.API.Pass.prototype);
|
R3.D3.API.Pass.FXAA.prototype = Object.create(R3.D3.API.Pass.prototype);
|
||||||
|
|
|
@ -11,32 +11,29 @@ R3.D3.API.Pass.Render = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
__API_COMPONENT__;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.scene)) {
|
||||||
|
apiComponent.scene = null;
|
||||||
|
}
|
||||||
|
this.scene = apiComponent.scene;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.camera)) {
|
||||||
|
apiComponent.camera = null;
|
||||||
|
}
|
||||||
|
this.camera = apiComponent.camera;
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(apiComponent.clear)) {
|
||||||
|
apiComponent.clear = true;
|
||||||
|
}
|
||||||
|
this.clear = apiComponent.clear;
|
||||||
|
|
||||||
|
|
||||||
R3.D3.API.Pass.call(
|
R3.D3.API.Pass.call(
|
||||||
this,
|
this,
|
||||||
apiComponent
|
apiComponent
|
||||||
);
|
);
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.scene)) {
|
|
||||||
apiComponent.scene = this.getFirstParent(R3.D3.API.Scene);
|
|
||||||
}
|
|
||||||
this.scene = apiComponent.scene;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.camera)) {
|
|
||||||
|
|
||||||
R3.Event.Emit(
|
|
||||||
R3.Event.GET_PROJECT,
|
|
||||||
null,
|
|
||||||
function(project){
|
|
||||||
apiComponent.camera = project.cameras[project.applicationMode];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.camera)) {
|
|
||||||
throw new Error('could not get valid camera');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.camera = apiComponent.camera;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.D3.API.Pass.Render.prototype = Object.create(R3.D3.API.Pass.prototype);
|
R3.D3.API.Pass.Render.prototype = Object.create(R3.D3.API.Pass.prototype);
|
||||||
|
|
|
@ -17,10 +17,7 @@ R3.D3.API.Pass.Render.SSAO = function(
|
||||||
apiComponent
|
apiComponent
|
||||||
) {
|
) {
|
||||||
|
|
||||||
R3.D3.API.Pass.Render.call(
|
__API_COMPONENT__;
|
||||||
this,
|
|
||||||
apiComponent
|
|
||||||
);
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.autoUpdateSize)) {
|
||||||
apiComponent.autoUpdateSize = true;
|
apiComponent.autoUpdateSize = true;
|
||||||
|
@ -32,11 +29,6 @@ R3.D3.API.Pass.Render.SSAO = function(
|
||||||
}
|
}
|
||||||
this.renderer = apiComponent.renderer;
|
this.renderer = apiComponent.renderer;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.viewport)) {
|
|
||||||
apiComponent.viewport = this.getFirstParent(R3.D3.API.Viewport);
|
|
||||||
}
|
|
||||||
this.viewport = apiComponent.viewport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We don't update the size of this component if autoUpdateSize is set until runtime - since the components
|
* We don't update the size of this component if autoUpdateSize is set until runtime - since the components
|
||||||
* could still be loading
|
* could still be loading
|
||||||
|
@ -73,6 +65,12 @@ R3.D3.API.Pass.Render.SSAO = function(
|
||||||
apiComponent.lumInfluence = 0.7;
|
apiComponent.lumInfluence = 0.7;
|
||||||
}
|
}
|
||||||
this.lumInfluence = apiComponent.lumInfluence;
|
this.lumInfluence = apiComponent.lumInfluence;
|
||||||
|
|
||||||
|
R3.D3.API.Pass.Render.call(
|
||||||
|
this,
|
||||||
|
apiComponent
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.D3.API.Pass.Render.SSAO.prototype = Object.create(R3.D3.API.Pass.Render.prototype);
|
R3.D3.API.Pass.Render.SSAO.prototype = Object.create(R3.D3.API.Pass.Render.prototype);
|
||||||
|
|
|
@ -38,16 +38,6 @@ R3.D3.API.Scene = function(
|
||||||
}
|
}
|
||||||
this.lights = apiComponent.lights;
|
this.lights = apiComponent.lights;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.textures)) {
|
|
||||||
apiComponent.textures = [];
|
|
||||||
}
|
|
||||||
this.textures = apiComponent.textures;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.materials)) {
|
|
||||||
apiComponent.materials = [];
|
|
||||||
}
|
|
||||||
this.materials = apiComponent.materials;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.fog)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.fog)) {
|
||||||
apiComponent.fog = new R3.D3.API.Fog.Normal(
|
apiComponent.fog = new R3.D3.API.Fog.Normal(
|
||||||
{
|
{
|
||||||
|
@ -69,9 +59,14 @@ R3.D3.API.Scene = function(
|
||||||
this.showAxis = apiComponent.showAxis;
|
this.showAxis = apiComponent.showAxis;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.gridSize)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.gridSize)) {
|
||||||
apiComponent.gridSize = 10;
|
apiComponent.gridSize = 45;
|
||||||
}
|
}
|
||||||
this.gridSize = apiComponent.gridSize;
|
this.gridSize = apiComponent.gridSize;
|
||||||
|
this.guiInfo.gridSize = {
|
||||||
|
range: [0, 100],
|
||||||
|
step: 1,
|
||||||
|
dp: 0
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.gridColor)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.gridColor)) {
|
||||||
apiComponent.gridColor = new R3.API.Color({
|
apiComponent.gridColor = new R3.API.Color({
|
||||||
|
@ -100,36 +95,6 @@ R3.D3.API.Scene = function(
|
||||||
}
|
}
|
||||||
this.cubeCameras = apiComponent.cubeCameras;
|
this.cubeCameras = apiComponent.cubeCameras;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.composer)) {
|
|
||||||
apiComponent.composer = new R3.D3.API.Composer(
|
|
||||||
{
|
|
||||||
parent : this,
|
|
||||||
name : this.name + ' - Composer'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.composer = apiComponent.composer;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.effect)) {
|
|
||||||
apiComponent.effect = new R3.D3.API.Effect(
|
|
||||||
{
|
|
||||||
parent : this,
|
|
||||||
name : this.name + ' - Effect'
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.effect = apiComponent.effect;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.enableComposer)) {
|
|
||||||
apiComponent.enableComposer = false;
|
|
||||||
}
|
|
||||||
this.enableComposer = apiComponent.enableComposer;
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.enableEffect)) {
|
|
||||||
apiComponent.enableEffect = false;
|
|
||||||
}
|
|
||||||
this.enableEffect = apiComponent.enableEffect;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default scenes have no viewport so they are able to render outside of viewports (svg rendering, rendertargets, etc)
|
* By default scenes have no viewport so they are able to render outside of viewports (svg rendering, rendertargets, etc)
|
||||||
* But if they do the renderer system will pick it up and render them in their appropriate viewport
|
* But if they do the renderer system will pick it up and render them in their appropriate viewport
|
||||||
|
|
|
@ -24,34 +24,41 @@ R3.D3.API.Viewport = function(
|
||||||
apiComponent.x = 0;
|
apiComponent.x = 0;
|
||||||
}
|
}
|
||||||
this.x = apiComponent.x;
|
this.x = apiComponent.x;
|
||||||
|
this.guiInfo.x = {
|
||||||
|
range: [-1, 1],
|
||||||
|
step: 0.0001,
|
||||||
|
dp: 4
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.y)) {
|
||||||
apiComponent.y = 0;
|
apiComponent.y = 0;
|
||||||
}
|
}
|
||||||
this.y = apiComponent.y;
|
this.y = apiComponent.y;
|
||||||
|
this.guiInfo.y = {
|
||||||
|
range: [-1, 1],
|
||||||
|
step: 0.0001,
|
||||||
|
dp: 4
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.width)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.width)) {
|
||||||
apiComponent.width = 1;
|
apiComponent.width = 1;
|
||||||
}
|
}
|
||||||
this.width = apiComponent.width;
|
this.width = apiComponent.width;
|
||||||
|
this.guiInfo.width = {
|
||||||
|
range: [0, 1],
|
||||||
|
step: 0.0001,
|
||||||
|
dp: 4
|
||||||
|
};
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
|
if (R3.Utils.UndefinedOrNull(apiComponent.height)) {
|
||||||
apiComponent.height = 1;
|
apiComponent.height = 1;
|
||||||
}
|
}
|
||||||
this.height = apiComponent.height;
|
this.height = apiComponent.height;
|
||||||
|
this.guiInfo.height = {
|
||||||
if (R3.Utils.UndefinedOrNull(apiComponent.offset)) {
|
range: [0, 1],
|
||||||
apiComponent.offset = new R3.API.Vector2(
|
step: 0.0001,
|
||||||
{
|
dp: 4
|
||||||
name : this.name + 'Offset',
|
};
|
||||||
parent : this,
|
|
||||||
register : true,
|
|
||||||
x : 0,
|
|
||||||
y : 0
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.offset = apiComponent.offset;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,11 @@ R3.D3.API.Viewport.FixedAspect = function(
|
||||||
apiComponent.aspectRatio = R3.D3.API.Viewport.ASPECT_RATIO_1_1;
|
apiComponent.aspectRatio = R3.D3.API.Viewport.ASPECT_RATIO_1_1;
|
||||||
}
|
}
|
||||||
this.aspectRatio = apiComponent.aspectRatio;
|
this.aspectRatio = apiComponent.aspectRatio;
|
||||||
|
this.guiInfo.aspectRatio = {
|
||||||
|
range: [0, 4],
|
||||||
|
step: 0.0001,
|
||||||
|
dp: 4
|
||||||
|
};
|
||||||
|
|
||||||
R3.D3.API.Viewport.call(
|
R3.D3.API.Viewport.call(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -9,6 +9,13 @@ R3.D3.Composer = function(
|
||||||
|
|
||||||
__RUNTIME_COMPONENT__;
|
__RUNTIME_COMPONENT__;
|
||||||
|
|
||||||
|
this.linkedComponents.renderer = R3.Renderer.D3;
|
||||||
|
this.linkedComponents.rendererTarget = R3.D3.RenderTarget;
|
||||||
|
this.linkedComponents.rendererTargetA = R3.D3.RenderTarget;
|
||||||
|
this.linkedComponents.rendererTargetB = R3.D3.RenderTarget;
|
||||||
|
this.linkedComponents.passes = [R3.D3.Pass];
|
||||||
|
this.linkedComponents.camera = R3.D3.Camera;
|
||||||
|
|
||||||
__UPGRADE_TO_RUNTIME__;
|
__UPGRADE_TO_RUNTIME__;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,20 +24,10 @@ R3.D3.Composer.prototype.constructor = R3.D3.Composer;
|
||||||
|
|
||||||
R3.D3.Composer.prototype.createInstance = function() {
|
R3.D3.Composer.prototype.createInstance = function() {
|
||||||
|
|
||||||
this.setSize();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Right - now we should have the right size of the composer - we can continue
|
* Right - now we should have the right size of the composer - we can continue
|
||||||
*/
|
*/
|
||||||
this.instance = this.graphics.Composer(
|
this.instance = this.graphics.Composer(this);
|
||||||
renderer,
|
|
||||||
null,
|
|
||||||
this.passes,
|
|
||||||
{
|
|
||||||
width : size.width,
|
|
||||||
height : size.height
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
__CREATE_INSTANCE__;
|
__CREATE_INSTANCE__;
|
||||||
};
|
};
|
||||||
|
@ -41,12 +38,11 @@ R3.D3.Composer.prototype.createInstance = function() {
|
||||||
*/
|
*/
|
||||||
R3.D3.Composer.prototype.updateInstance = function(property) {
|
R3.D3.Composer.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (
|
if (property === 'size') {
|
||||||
property === 'width' ||
|
this.instance.setSize(
|
||||||
property === 'height'
|
this.size.x,
|
||||||
) {
|
this.size.y
|
||||||
|
);
|
||||||
this.graphics.updateInstance(this, 'size');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,26 +69,6 @@ R3.D3.Composer.prototype.updateInstance = function(property) {
|
||||||
__UPDATE_INSTANCE__;
|
__UPDATE_INSTANCE__;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience function to set size
|
|
||||||
*/
|
|
||||||
R3.D3.Composer.prototype.setSize = function() {
|
|
||||||
|
|
||||||
if (R3.Utils.Unloaded(this.renderer)) {
|
|
||||||
throw new Error('R3.D3.Composer.prototype.renderer not loaded at time of R3.D3.Composer.prototype.setSize');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.Unloaded(this.viewport)) {
|
|
||||||
throw new Error('R3.D3.Composer.prototype.viewport not loaded at time of R3.D3.Composer.prototype.setSize');
|
|
||||||
}
|
|
||||||
|
|
||||||
var size = this.renderer.getSize(this.viewport);
|
|
||||||
|
|
||||||
this.width = size.width;
|
|
||||||
this.height = size.height;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function to render
|
* Convenience function to render
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,7 +17,7 @@ R3.D3.Fog.prototype.constructor = R3.D3.Fog;
|
||||||
|
|
||||||
R3.D3.Fog.prototype.updateInstance = function(property) {
|
R3.D3.Fog.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'color') {
|
if (property === 'fogColor') {
|
||||||
this.graphics.updateInstance(this, property);
|
this.graphics.updateInstance(this, property);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,38 +396,38 @@ R3.D3.Mesh.prototype.applyPositionRotationScale = function() {
|
||||||
* Gets all children components of this Mesh (all linked objects only - no object references i.e. string ids)
|
* Gets all children components of this Mesh (all linked objects only - no object references i.e. string ids)
|
||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
R3.D3.Mesh.prototype.getChildrenComponents = function() {
|
// R3.D3.Mesh.prototype.getChildrenComponents = function() {
|
||||||
|
//
|
||||||
var children = R3.Component.prototype.getChildrenComponents.call(this);
|
// var children = R3.Component.prototype.getChildrenComponents.call(this);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Push RigidBodies
|
// * Push RigidBodies
|
||||||
*/
|
// */
|
||||||
R3.EntityManager.Instance.queryComponents(R3.Component.RIGID_BODY).map(
|
// R3.EntityManager.Instance.queryComponents(R3.Component.RIGID_BODY).map(
|
||||||
function(rigidBody) {
|
// function(rigidBody) {
|
||||||
|
//
|
||||||
if (rigidBody.parentMesh === this) {
|
// if (rigidBody.parentMesh === this) {
|
||||||
R3.Utils.PushUnique(children, rigidBody);
|
// R3.Utils.PushUnique(children, rigidBody);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}.bind(this)
|
// }.bind(this)
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Push Shapes
|
// * Push Shapes
|
||||||
*/
|
// */
|
||||||
R3.EntityManager.Instance.queryComponents(R3.Component.SHAPE).map(
|
// R3.EntityManager.Instance.queryComponents(R3.Component.SHAPE).map(
|
||||||
function(shape) {
|
// function(shape) {
|
||||||
|
//
|
||||||
if (shape.parentMesh === this) {
|
// if (shape.parentMesh === this) {
|
||||||
R3.Utils.PushUnique(children, shape);
|
// R3.Utils.PushUnique(children, shape);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}.bind(this)
|
// }.bind(this)
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
return children;
|
// return children;
|
||||||
};
|
// };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function for creating a helper for this Mesh - should be called from Systems only
|
* Convenience function for creating a helper for this Mesh - should be called from Systems only
|
||||||
|
|
|
@ -7,12 +7,7 @@ R3.D3.Pass = function(
|
||||||
inherited
|
inherited
|
||||||
) {
|
) {
|
||||||
|
|
||||||
/**
|
__INHERIT_ONLY__;
|
||||||
* This class is intended to be inherited only
|
|
||||||
*/
|
|
||||||
if (R3.Utils.UndefinedOrNull(inherited)) {
|
|
||||||
throw new Error('This class can only be inherited');
|
|
||||||
}
|
|
||||||
|
|
||||||
__UPGRADE_TO_RUNTIME__;
|
__UPGRADE_TO_RUNTIME__;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ R3.D3.Pass.Bloom = function(
|
||||||
|
|
||||||
__RUNTIME_COMPONENT__;
|
__RUNTIME_COMPONENT__;
|
||||||
|
|
||||||
|
this.linkedComponents.renderer = R3.Renderer.D3;
|
||||||
|
|
||||||
R3.D3.Pass.call(this, true);
|
R3.D3.Pass.call(this, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,27 +23,7 @@ R3.D3.Pass.Bloom.prototype.constructor = R3.D3.Pass.Bloom;
|
||||||
*/
|
*/
|
||||||
R3.D3.Pass.Bloom.prototype.createInstance = function() {
|
R3.D3.Pass.Bloom.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new this.graphics.PassBloom(this);
|
||||||
if (this.autoUpdateSize) {
|
|
||||||
|
|
||||||
if (R3.Utils.Unloaded(this.renderer)) {
|
|
||||||
throw new Error('Renderer not loaded but R3.D3.Pass.Bloom.prototype.autoUpdateSize is set - problem with storage or linking system');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.Unloaded(this.viewport)) {
|
|
||||||
throw new Error('Viewport not loaded but R3.D3.Pass.Bloom.prototype.autoUpdateSize is set - problem with storage or linking system');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setSize();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance = new this.graphics.PassBloom(
|
|
||||||
this.size,
|
|
||||||
this.strength,
|
|
||||||
this.radius,
|
|
||||||
this.threshold
|
|
||||||
);
|
|
||||||
|
|
||||||
R3.D3.Pass.prototype.createInstance.call(this);
|
R3.D3.Pass.prototype.createInstance.call(this);
|
||||||
|
|
||||||
|
@ -51,36 +33,41 @@ R3.D3.Pass.Bloom.prototype.createInstance = function() {
|
||||||
* Update Pass.Bloom instance
|
* Update Pass.Bloom instance
|
||||||
*/
|
*/
|
||||||
R3.D3.Pass.Bloom.prototype.updateInstance = function(property) {
|
R3.D3.Pass.Bloom.prototype.updateInstance = function(property) {
|
||||||
|
//
|
||||||
if (
|
// if (
|
||||||
property === 'autoUpdateSize' ||
|
// property === 'autoUpdateSize' ||
|
||||||
property === 'renderer' ||
|
// property === 'renderer' ||
|
||||||
property === 'viewport'
|
// property === 'viewport'
|
||||||
|
//
|
||||||
) {
|
// ) {
|
||||||
|
//
|
||||||
if (this.autoUpdateSize) {
|
// if (this.autoUpdateSize) {
|
||||||
|
//
|
||||||
this.setSize();
|
// this.setSize();
|
||||||
|
//
|
||||||
this.graphics.updateInstance(this, 'size');
|
// this.graphics.updateInstance(this, 'size');
|
||||||
|
//
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (property === 'size') {
|
if (property === 'size') {
|
||||||
|
|
||||||
if (this.autoUpdateSize) {
|
// if (this.autoUpdateSize) {
|
||||||
console.warn('Modifying the width and height while R3.D3.Pass.Bloom.prototype.autoUpdateSize is set has no effect');
|
// console.warn('Modifying the width and height while R3.D3.Pass.Bloom.prototype.autoUpdateSize is set has no effect');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.graphics.updateInstance(this, 'size');
|
//this.graphics.updateInstance(this, 'size');
|
||||||
|
|
||||||
|
this.instance.setSize(
|
||||||
|
this.size.x,
|
||||||
|
this.size.y
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -101,21 +88,21 @@ R3.D3.Pass.Bloom.prototype.updateInstance = function(property) {
|
||||||
/**
|
/**
|
||||||
* Convenience function to set size
|
* Convenience function to set size
|
||||||
*/
|
*/
|
||||||
R3.D3.Pass.Bloom.prototype.setSize = function() {
|
// R3.D3.Pass.Bloom.prototype.setSize = function() {
|
||||||
|
//
|
||||||
if (R3.Utils.Unloaded(this.renderer)) {
|
// if (R3.Utils.Unloaded(this.renderer)) {
|
||||||
console.warn('R3.D3.Pass.Render.Bloom.prototype.renderer unloaded');
|
// console.warn('R3.D3.Pass.Render.Bloom.prototype.renderer unloaded');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (R3.Utils.Unloaded(this.viewport)) {
|
// if (R3.Utils.Unloaded(this.viewport)) {
|
||||||
console.warn('R3.D3.Pass.Render.Bloom.prototype.viewport unloaded');
|
// console.warn('R3.D3.Pass.Render.Bloom.prototype.viewport unloaded');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
var size = this.renderer.getSize(this.viewport);
|
// var size = this.renderer.getSize(this.viewport);
|
||||||
|
//
|
||||||
this.size.x = size.width;
|
// this.size.x = size.width;
|
||||||
this.size.y = size.height;
|
// this.size.y = size.height;
|
||||||
|
//
|
||||||
};
|
// };
|
||||||
|
|
|
@ -22,6 +22,8 @@ R3.D3.Pass.Copy.prototype.constructor = R3.D3.Pass.Copy;
|
||||||
*/
|
*/
|
||||||
R3.D3.Pass.Copy.prototype.createInstance = function() {
|
R3.D3.Pass.Copy.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = this.graphics.PassCopy();
|
||||||
|
|
||||||
R3.D3.Pass.prototype.createInstance.call(this);
|
R3.D3.Pass.prototype.createInstance.call(this);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,8 @@ R3.D3.Pass.FXAA = function(
|
||||||
|
|
||||||
__RUNTIME_COMPONENT__;
|
__RUNTIME_COMPONENT__;
|
||||||
|
|
||||||
|
this.linkedComponents.renderer = R3.Renderer.D3;
|
||||||
|
|
||||||
R3.D3.Pass.call(this, true);
|
R3.D3.Pass.call(this, true);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -22,16 +24,13 @@ R3.D3.Pass.FXAA.prototype.constructor = R3.D3.Pass.FXAA;
|
||||||
*/
|
*/
|
||||||
R3.D3.Pass.FXAA.prototype.createInstance = function() {
|
R3.D3.Pass.FXAA.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (this.autoUpdateSize) {
|
// if (this.autoUpdateSize) {
|
||||||
|
//
|
||||||
|
// this.setSize();
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
this.setSize();
|
this.instance = this.graphics.PassFXAA(this);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance = this.graphics.PassFXAA(
|
|
||||||
this.width,
|
|
||||||
this.height
|
|
||||||
);
|
|
||||||
|
|
||||||
R3.D3.Pass.prototype.createInstance.call(this);
|
R3.D3.Pass.prototype.createInstance.call(this);
|
||||||
|
|
||||||
|
@ -42,38 +41,44 @@ R3.D3.Pass.FXAA.prototype.createInstance = function() {
|
||||||
*/
|
*/
|
||||||
R3.D3.Pass.FXAA.prototype.updateInstance = function(property) {
|
R3.D3.Pass.FXAA.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (
|
// if (
|
||||||
property === 'autoUpdateSize' ||
|
// property === 'autoUpdateSize' ||
|
||||||
property === 'renderer' ||
|
// property === 'renderer' ||
|
||||||
property === 'viewport'
|
// property === 'viewport'
|
||||||
|
//
|
||||||
) {
|
// ) {
|
||||||
|
//
|
||||||
if (this.autoUpdateSize) {
|
// if (this.autoUpdateSize) {
|
||||||
|
//
|
||||||
this.setSize();
|
// this.setSize();
|
||||||
|
//
|
||||||
this.graphics.updateInstance(this, 'size');
|
// this.graphics.updateInstance(this, 'size');
|
||||||
|
//
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (
|
if (
|
||||||
property === 'width' ||
|
property === 'width' ||
|
||||||
property === 'height'
|
property === 'height' ||
|
||||||
|
property === 'size'
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (this.autoUpdateSize) {
|
// if (this.autoUpdateSize) {
|
||||||
console.warn('Modifying the width and height while R3.D3.Pass.FXAA.prototype.autoUpdateSize is set has no effect');
|
// console.warn('Modifying the width and height while R3.D3.Pass.FXAA.prototype.autoUpdateSize is set has no effect');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.graphics.updateInstance(this, 'size');
|
this.instance.uniforms['resolution'].value.set(
|
||||||
|
1 / this.width,
|
||||||
|
1 / this.height
|
||||||
|
);
|
||||||
|
|
||||||
|
//this.graphics.updateInstance(this, 'size');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -85,22 +90,22 @@ R3.D3.Pass.FXAA.prototype.updateInstance = function(property) {
|
||||||
/**
|
/**
|
||||||
* Convenience function to set size
|
* Convenience function to set size
|
||||||
*/
|
*/
|
||||||
R3.D3.Pass.FXAA.prototype.setSize = function() {
|
// R3.D3.Pass.FXAA.prototype.setSize = function() {
|
||||||
|
//
|
||||||
if (R3.Utils.Unloaded(this.renderer)) {
|
// // if (R3.Utils.Unloaded(this.renderer)) {
|
||||||
console.warn('R3.D3.Pass.Render.FXAA.prototype.renderer unloaded');
|
// // console.warn('R3.D3.Pass.Render.FXAA.prototype.renderer unloaded');
|
||||||
return;
|
// // return;
|
||||||
}
|
// // }
|
||||||
|
// //
|
||||||
if (R3.Utils.Unloaded(this.viewport)) {
|
// // if (R3.Utils.Unloaded(this.viewport)) {
|
||||||
console.warn('R3.D3.Pass.Render.FXAA.prototype.viewport unloaded');
|
// // console.warn('R3.D3.Pass.Render.FXAA.prototype.viewport unloaded');
|
||||||
return;
|
// // return;
|
||||||
}
|
// // }
|
||||||
|
// //
|
||||||
var size = this.renderer.getSize(this.viewport);
|
// // var size = this.renderer.getSize(this.viewport);
|
||||||
|
//
|
||||||
this.width = size.width;
|
// this.width = size.width;
|
||||||
this.height = size.height;
|
// this.height = size.height;
|
||||||
|
//
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
|
|
|
@ -9,13 +9,15 @@ R3.D3.Pass.Render = function(
|
||||||
inherited
|
inherited
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(inherited)) {
|
__INHERIT_AND_INSTANTIATE__;
|
||||||
|
|
||||||
__RUNTIME_COMPONENT__;
|
this.linkedComponents.scene = R3.D3.Scene;
|
||||||
|
this.linkedComponents.camera = R3.D3.Camera;
|
||||||
|
|
||||||
}
|
R3.D3.Pass.call(
|
||||||
|
this,
|
||||||
R3.D3.Pass.call(this, true);
|
true
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,10 +38,7 @@ R3.D3.Pass.Render.prototype.createInstance = function() {
|
||||||
throw new Error('R3.D3.Pass.Render.prototype.camera not ready - loading or linking error');
|
throw new Error('R3.D3.Pass.Render.prototype.camera not ready - loading or linking error');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.instance = this.graphics.PassRender(
|
this.instance = this.graphics.PassRender(this);
|
||||||
this.scene,
|
|
||||||
this.camera
|
|
||||||
);
|
|
||||||
|
|
||||||
R3.D3.Pass.prototype.createInstance.call(this);
|
R3.D3.Pass.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,11 +11,8 @@ R3.D3.Scene = function(
|
||||||
|
|
||||||
this.linkedComponents.meshes = [R3.D3.Mesh];
|
this.linkedComponents.meshes = [R3.D3.Mesh];
|
||||||
this.linkedComponents.lights = [R3.D3.Light];
|
this.linkedComponents.lights = [R3.D3.Light];
|
||||||
this.linkedComponents.textures = [R3.D3.Texture];
|
|
||||||
this.linkedComponents.materials = [R3.D3.Material];
|
|
||||||
this.linkedComponents.fog = R3.D3.Fog;
|
|
||||||
this.linkedComponents.viewports = [R3.D3.Viewport];
|
this.linkedComponents.viewports = [R3.D3.Viewport];
|
||||||
this.linkedComponents.camera = R3.D3.Camera;
|
this.linkedComponents.fog = R3.D3.Fog;
|
||||||
|
|
||||||
this.helpers = [];
|
this.helpers = [];
|
||||||
|
|
||||||
|
@ -286,6 +283,10 @@ R3.D3.Scene.prototype.drawGrid = function() {
|
||||||
|
|
||||||
for (var y = -this.gridSize; y <= this.gridSize; y += 1) {
|
for (var y = -this.gridSize; y <= this.gridSize; y += 1) {
|
||||||
|
|
||||||
|
if (y === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var Xgeometry = new THREE.Geometry();
|
var Xgeometry = new THREE.Geometry();
|
||||||
Xgeometry.vertices.push(
|
Xgeometry.vertices.push(
|
||||||
new THREE.Vector3( y, 0, this.gridSize * -1 ),
|
new THREE.Vector3( y, 0, this.gridSize * -1 ),
|
||||||
|
@ -328,6 +329,10 @@ R3.D3.Scene.prototype.drawAxis = function() {
|
||||||
color: 0xff0000,
|
color: 0xff0000,
|
||||||
linewidth: 2
|
linewidth: 2
|
||||||
});
|
});
|
||||||
|
var Xmaterial2 = new THREE.LineBasicMaterial({
|
||||||
|
color: 0x440000,
|
||||||
|
linewidth: 2
|
||||||
|
});
|
||||||
|
|
||||||
var Xgeometry = new THREE.Geometry();
|
var Xgeometry = new THREE.Geometry();
|
||||||
Xgeometry.vertices.push(
|
Xgeometry.vertices.push(
|
||||||
|
@ -335,33 +340,56 @@ R3.D3.Scene.prototype.drawAxis = function() {
|
||||||
new THREE.Vector3( 100, 0, 0 )
|
new THREE.Vector3( 100, 0, 0 )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var Xgeometry2 = new THREE.Geometry();
|
||||||
|
Xgeometry2.vertices.push(
|
||||||
|
new THREE.Vector3( 0, 0, 0 ),
|
||||||
|
new THREE.Vector3( -100, 0, 0 )
|
||||||
|
);
|
||||||
|
|
||||||
var lineX = new THREE.Line(Xgeometry, Xmaterial);
|
var lineX = new THREE.Line(Xgeometry, Xmaterial);
|
||||||
|
|
||||||
this.instance.add(lineX);
|
this.instance.add(lineX);
|
||||||
|
this.axis.push(lineX);
|
||||||
|
|
||||||
|
lineX = new THREE.Line(Xgeometry2, Xmaterial2);
|
||||||
|
this.instance.add(lineX);
|
||||||
this.axis.push(lineX);
|
this.axis.push(lineX);
|
||||||
|
|
||||||
var Ymaterial = new THREE.LineBasicMaterial({
|
var Ymaterial = new THREE.LineBasicMaterial({
|
||||||
color: 0x00ff00,
|
color: 0x00ff00,
|
||||||
linewidth: 2
|
linewidth: 2
|
||||||
});
|
});
|
||||||
|
// var Ymaterial2 = new THREE.LineBasicMaterial({
|
||||||
|
// color: 0x008800,
|
||||||
|
// linewidth: 2
|
||||||
|
// });
|
||||||
|
|
||||||
var Ygeometry = new THREE.Geometry();
|
var Ygeometry = new THREE.Geometry();
|
||||||
Ygeometry.vertices.push(
|
Ygeometry.vertices.push(
|
||||||
new THREE.Vector3( 0, 0, 0 ),
|
new THREE.Vector3( 0, 0, 0 ),
|
||||||
new THREE.Vector3( 0, 100, 0 )
|
new THREE.Vector3( 0, 100, 0 )
|
||||||
);
|
);
|
||||||
|
// var Ygeometry2 = new THREE.Geometry();
|
||||||
|
// Ygeometry2.vertices.push(
|
||||||
|
// new THREE.Vector3( 0, 0, 0 ),
|
||||||
|
// new THREE.Vector3( 0, -100, 0 )
|
||||||
|
// );
|
||||||
|
|
||||||
var lineY = new THREE.Line(Ygeometry, Ymaterial);
|
var lineY = new THREE.Line(Ygeometry, Ymaterial);
|
||||||
|
|
||||||
this.instance.add(lineY);
|
this.instance.add(lineY);
|
||||||
|
|
||||||
this.axis.push(lineY);
|
this.axis.push(lineY);
|
||||||
|
|
||||||
|
// lineY = new THREE.Line(Ygeometry2, Ymaterial2);
|
||||||
|
// this.instance.add(lineY);
|
||||||
|
// this.axis.push(lineY);
|
||||||
|
|
||||||
var Zmaterial = new THREE.LineBasicMaterial({
|
var Zmaterial = new THREE.LineBasicMaterial({
|
||||||
color: 0x0000ff,
|
color: 0x0000ff,
|
||||||
linewidth: 2
|
linewidth: 2
|
||||||
});
|
});
|
||||||
|
var Zmaterial2 = new THREE.LineBasicMaterial({
|
||||||
|
color: 0x000044,
|
||||||
|
linewidth: 2
|
||||||
|
});
|
||||||
|
|
||||||
var Zgeometry = new THREE.Geometry();
|
var Zgeometry = new THREE.Geometry();
|
||||||
Zgeometry.vertices.push(
|
Zgeometry.vertices.push(
|
||||||
|
@ -369,10 +397,18 @@ R3.D3.Scene.prototype.drawAxis = function() {
|
||||||
new THREE.Vector3( 0, 0, 100 )
|
new THREE.Vector3( 0, 0, 100 )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var Zgeometry2 = new THREE.Geometry();
|
||||||
|
Zgeometry2.vertices.push(
|
||||||
|
new THREE.Vector3( 0, 0, 0 ),
|
||||||
|
new THREE.Vector3( 0, 0, -100 )
|
||||||
|
);
|
||||||
|
|
||||||
var lineZ = new THREE.Line(Zgeometry, Zmaterial);
|
var lineZ = new THREE.Line(Zgeometry, Zmaterial);
|
||||||
|
|
||||||
this.instance.add(lineZ);
|
this.instance.add(lineZ);
|
||||||
|
this.axis.push(lineZ);
|
||||||
|
|
||||||
|
lineZ = new THREE.Line(Zgeometry2, Zmaterial2);
|
||||||
|
this.instance.add(lineZ);
|
||||||
this.axis.push(lineZ);
|
this.axis.push(lineZ);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,16 +25,12 @@ R3.D3.Viewport.prototype.constructor = R3.D3.Viewport;
|
||||||
R3.D3.Viewport.prototype.updateInstance = function(property) {
|
R3.D3.Viewport.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'x') {
|
if (property === 'x') {
|
||||||
this.instance.x = this.x + this.offset.x;
|
this.instance.x = this.x;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'y') {
|
if (property === 'y') {
|
||||||
this.instance.y = this.y + this.offset.y;
|
this.instance.y = this.y;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'offset') {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ R3.D3.Viewport.FixedAspect = function(
|
||||||
R3.D3.Viewport.FixedAspect.prototype = Object.create(R3.D3.Viewport.prototype);
|
R3.D3.Viewport.FixedAspect.prototype = Object.create(R3.D3.Viewport.prototype);
|
||||||
R3.D3.Viewport.FixedAspect.prototype.constructor = R3.D3.Viewport.FixedAspect;
|
R3.D3.Viewport.FixedAspect.prototype.constructor = R3.D3.Viewport.FixedAspect;
|
||||||
|
|
||||||
|
|
||||||
R3.D3.Viewport.FixedAspect.prototype.createInstance = function() {
|
R3.D3.Viewport.FixedAspect.prototype.createInstance = function() {
|
||||||
|
|
||||||
this.calculateDimensions();
|
this.calculateDimensions();
|
||||||
|
@ -196,7 +197,4 @@ R3.D3.Viewport.FixedAspect.prototype.calculateDimensions = function() {
|
||||||
this.x = 0;
|
this.x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.x += this.offset.x;
|
|
||||||
this.y += this.offset.y;
|
|
||||||
|
|
||||||
};
|
};
|
|
@ -177,18 +177,11 @@ R3.D3.Viewport.FixedAspect.VR.prototype.calculateDimensions = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.side === R3.D3.API.Viewport.FixedAspect.VR.VIEWPORT_RIGHT) {
|
if (this.side === R3.D3.API.Viewport.FixedAspect.VR.VIEWPORT_RIGHT) {
|
||||||
this.offset.x = this.width / 2;
|
this.x += this.width / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.side === R3.D3.API.Viewport.FixedAspect.VR.VIEWPORT_LEFT) {
|
if (this.side === R3.D3.API.Viewport.FixedAspect.VR.VIEWPORT_LEFT) {
|
||||||
this.offset.x = -1 * (this.width / 2);
|
this.x -= this.width / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.x = this.x + this.offset.x;
|
|
||||||
this.y = this.y + this.offset.y;
|
|
||||||
/**
|
|
||||||
* Now we need to modify the x and width dimensions of this viewport
|
|
||||||
*/
|
|
||||||
console.log('vr viewport update');
|
|
||||||
|
|
||||||
};
|
};
|
|
@ -108,7 +108,6 @@ R3.GUI.prototype.addPanel = function(component) {
|
||||||
return this.gui.addPanel(this, component);
|
return this.gui.addPanel(this, component);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
R3.GUI.prototype.addNumber = function(panel, component, property) {
|
R3.GUI.prototype.addNumber = function(panel, component, property) {
|
||||||
return this.gui.addNumber(this, panel, component, property);
|
return this.gui.addNumber(this, panel, component, property);
|
||||||
};
|
};
|
||||||
|
@ -121,10 +120,19 @@ R3.GUI.prototype.addButton = function(panel, component, property) {
|
||||||
return this.gui.addButton(this, panel, component, property);
|
return this.gui.addButton(this, panel, component, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.GUI.prototype.addRange = function(panel, component, property) {
|
R3.GUI.prototype.addColor = function(panel, component, property) {
|
||||||
return this.gui.addRange(this, panel);
|
return this.gui.addColor(this, panel, component, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
R3.GUI.prototype.addCheckbox = function(panel, component, property) {
|
||||||
|
return this.gui.addCheckbox(this, panel, component, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.GUI.prototype.addSelect = function(panel, component, property) {
|
||||||
|
return this.gui.addSelect(this, panel, component, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
R3.GUI.prototype.addComponent = function(component) {
|
R3.GUI.prototype.addComponent = function(component) {
|
||||||
this.gui.addComponent(this, component);
|
this.gui.addComponent(this, component);
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,8 @@ R3.Project.D3 = function(
|
||||||
this.linkedComponents.mouse = R3.Mouse;
|
this.linkedComponents.mouse = R3.Mouse;
|
||||||
this.linkedComponents.raycaster = R3.D3.Raycaster;
|
this.linkedComponents.raycaster = R3.D3.Raycaster;
|
||||||
this.linkedComponents.clock = R3.Clock;
|
this.linkedComponents.clock = R3.Clock;
|
||||||
|
this.linkedComponents.composer = R3.D3.Composer;
|
||||||
|
this.linkedComponents.effect = R3.D3.Effect;
|
||||||
|
|
||||||
R3.Project.call(
|
R3.Project.call(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
/**
|
||||||
|
* R3.Query.UserDevices
|
||||||
|
* @param apiComponent
|
||||||
|
* @param inherited
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
R3.Query.UserDevices = function(
|
||||||
|
apiComponent,
|
||||||
|
inherited
|
||||||
|
) {
|
||||||
|
|
||||||
|
__RUNTIME_COMPONENT__
|
||||||
|
|
||||||
|
R3.Query.call(
|
||||||
|
this,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.Query.UserDevices.prototype = Object.create(R3.Query.prototype);
|
||||||
|
R3.Query.UserDevices.prototype.constructor = R3.Query.UserDevices;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
R3.Query.UserDevices.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = true;
|
||||||
|
|
||||||
|
__CREATE_INSTANCE__;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
R3.Query.UserDevices.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
R3.Query.prototype.updateInstance.call(this, property);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.Query.UserDevices.prototype.parse = function(data) {
|
||||||
|
|
||||||
|
this.columns = [
|
||||||
|
{
|
||||||
|
type: 'string',
|
||||||
|
name: 'Name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'string',
|
||||||
|
name: 'Family Name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'string',
|
||||||
|
name: 'Host'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'string',
|
||||||
|
name: 'DNS Suffix'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'datetime',
|
||||||
|
name: 'Created'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
this.rows = data.userDevices.reduce(
|
||||||
|
function(result, userDevice){
|
||||||
|
result.push(
|
||||||
|
[
|
||||||
|
userDevice.user.given_name,
|
||||||
|
userDevice.user.family_name,
|
||||||
|
userDevice.device.hostname,
|
||||||
|
userDevice.device.dns_suffix,
|
||||||
|
userDevice.created
|
||||||
|
]
|
||||||
|
)
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
|
@ -8,6 +8,8 @@ R3.Runtime.Coder.CodeMirror = function() {
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.editor = null;
|
||||||
|
|
||||||
this.createInstance();
|
this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,3 +19,17 @@ R3.Runtime.Coder.CodeMirror.prototype.constructor = R3.Runtime.Coder.CodeMirror;
|
||||||
R3.Runtime.Coder.CodeMirror.prototype.createInstance = function() {
|
R3.Runtime.Coder.CodeMirror.prototype.createInstance = function() {
|
||||||
this.instance = CodeMirror;
|
this.instance = CodeMirror;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
R3.Runtime.Coder.CodeMirror.prototype.launchEditor = function(
|
||||||
|
runtimeComponent,
|
||||||
|
property
|
||||||
|
) {
|
||||||
|
this.editor = CodeMirror.fromTextArea(myTextarea, {
|
||||||
|
lineNumbers: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.Runtime.Coder.CodeMirror.prototype.closeEditor = function() {
|
||||||
|
this.editor.close();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ R3.Runtime.Graphics.Pixi.prototype.Canvas = function(runtimeObject) {
|
||||||
|
|
||||||
instance.setAttribute('height', runtimeObject.height);
|
instance.setAttribute('height', runtimeObject.height);
|
||||||
|
|
||||||
instance.setAttribute('style', 'left: ' + runtimeObject.offset.x + 'px;top: ' + runtimeObject.offset.y + 'px;width:' + runtimeObject.width + 'px;height:' + runtimeObject.height + 'px');
|
instance.setAttribute('style', 'width:' + runtimeObject.width + 'px;height:' + runtimeObject.height + 'px');
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
|
@ -34,7 +34,7 @@ R3.Runtime.Graphics.Three.prototype.Canvas = function(runtimeObject) {
|
||||||
|
|
||||||
instance.setAttribute('height', runtimeObject.height);
|
instance.setAttribute('height', runtimeObject.height);
|
||||||
|
|
||||||
instance.setAttribute('style', 'left: ' + runtimeObject.offset.x + 'px;top: ' + runtimeObject.offset.y + 'px;width:' + runtimeObject.width + 'px;height:' + runtimeObject.height + 'px');
|
instance.setAttribute('style', 'width:' + runtimeObject.width + 'px;height:' + runtimeObject.height + 'px');
|
||||||
|
|
||||||
if (this.autoUpdateSize) {
|
if (this.autoUpdateSize) {
|
||||||
/**
|
/**
|
||||||
|
@ -595,41 +595,35 @@ R3.Runtime.Graphics.Three.prototype.RenderTarget = function(
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.Graphics.Three.prototype.Composer = function(
|
R3.Runtime.Graphics.Three.prototype.Composer = function(
|
||||||
renderer,
|
runtimeObject
|
||||||
renderTarget,
|
|
||||||
passes,
|
|
||||||
size
|
|
||||||
) {
|
) {
|
||||||
if (!renderer.instance) {
|
if (R3.Utils.Unloaded(runtimeObject.renderer)) {
|
||||||
throw new Error('no renderer instance');
|
throw new Error('no renderer instance');
|
||||||
}
|
}
|
||||||
|
|
||||||
var renderTargetInstance = undefined;
|
var renderTargetInstance = undefined;
|
||||||
|
|
||||||
if (renderTarget && renderTarget.instance) {
|
if (R3.Utils.Loaded(runtimeObject.renderTarget)) {
|
||||||
renderTargetInstance;
|
renderTargetInstance = runtimeObject.renderTarget.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
var composer = new THREE.EffectComposer(
|
var composer = new THREE.EffectComposer(
|
||||||
renderer.instance,
|
runtimeObject.renderer.instance,
|
||||||
renderTargetInstance
|
renderTargetInstance
|
||||||
);
|
);
|
||||||
|
|
||||||
passes.map(
|
runtimeObject.passes.map(
|
||||||
function(pass) {
|
function(pass) {
|
||||||
|
|
||||||
if (!pass.instance) {
|
if (R3.Utils.Unloaded(pass)) {
|
||||||
throw new Error('Pass instance not set');
|
throw new Error('Pass not loaded yet.');
|
||||||
}
|
}
|
||||||
|
|
||||||
composer.addPass(pass.instance);
|
composer.addPass(pass.instance);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
composer.setSize(
|
return composer;
|
||||||
size.width,
|
|
||||||
size.height
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.Graphics.Three.prototype.Renderer3D = function(runtimeObject){
|
R3.Runtime.Graphics.Three.prototype.Renderer3D = function(runtimeObject){
|
||||||
|
@ -714,14 +708,14 @@ R3.Runtime.Graphics.Three.prototype.Face = function(
|
||||||
|
|
||||||
R3.Runtime.Graphics.Three.prototype.FogExp = function(runtimeObject) {
|
R3.Runtime.Graphics.Three.prototype.FogExp = function(runtimeObject) {
|
||||||
return new THREE.FogExp2(
|
return new THREE.FogExp2(
|
||||||
runtimeObject.color.toHex(),
|
runtimeObject.fogColor.toHex(),
|
||||||
runtimeObject.density
|
runtimeObject.density
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.Graphics.Three.prototype.Fog = function(runtimeObject) {
|
R3.Runtime.Graphics.Three.prototype.Fog = function(runtimeObject) {
|
||||||
return new THREE.Fog(
|
return new THREE.Fog(
|
||||||
runtimeObject.color.toHex(),
|
runtimeObject.fogColor.toHex(),
|
||||||
runtimeObject.near,
|
runtimeObject.near,
|
||||||
runtimeObject.far
|
runtimeObject.far
|
||||||
);
|
);
|
||||||
|
@ -760,31 +754,32 @@ R3.Runtime.Graphics.Three.prototype.Sphere = function(
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.Graphics.Three.prototype.PassFXAA = function (
|
R3.Runtime.Graphics.Three.prototype.PassFXAA = function (runtimeObject) {
|
||||||
width,
|
|
||||||
height
|
|
||||||
) {
|
|
||||||
var instance = new THREE.ShaderPass(THREE.FXAAShader);
|
var instance = new THREE.ShaderPass(THREE.FXAAShader);
|
||||||
|
|
||||||
instance.uniforms['resolution'].value.set(
|
instance.uniforms['resolution'].value.set(
|
||||||
1 / width,
|
1 / runtimeObject.width,
|
||||||
1 / height
|
1 / runtimeObject.height
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// instance.renderToScreen = this.renderToScreen;
|
||||||
|
//
|
||||||
|
// instance.enabled = this.enabled;
|
||||||
|
//
|
||||||
|
// instance.clear = this.clear;
|
||||||
|
//
|
||||||
|
// instance.needsSwap = this.needsSwap;
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.Graphics.Three.prototype.PassBloom = function (
|
R3.Runtime.Graphics.Three.prototype.PassBloom = function (runtimeObject) {
|
||||||
size,
|
return new THREE.UnrealBloomPass(
|
||||||
strength,
|
runtimeObject.size.instance,
|
||||||
radius,
|
runtimeObject.strength,
|
||||||
threshold
|
runtimeObject.radius,
|
||||||
) {
|
runtimeObject.threshold
|
||||||
return new THREE.BloomPass(
|
|
||||||
size.instance,
|
|
||||||
strength,
|
|
||||||
radius,
|
|
||||||
threshold
|
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -793,13 +788,10 @@ R3.Runtime.Graphics.Three.prototype.PassCopy = function () {
|
||||||
return new THREE.ShaderPass(THREE.CopyShader);
|
return new THREE.ShaderPass(THREE.CopyShader);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.Graphics.Three.prototype.PassRender = function (
|
R3.Runtime.Graphics.Three.prototype.PassRender = function (runtimeObject) {
|
||||||
scene,
|
|
||||||
camera
|
|
||||||
) {
|
|
||||||
return new THREE.RenderPass(
|
return new THREE.RenderPass(
|
||||||
scene.instance,
|
runtimeObject.scene.instance,
|
||||||
camera.instance
|
runtimeObject.camera.instance
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1813,14 +1805,14 @@ R3.Runtime.Graphics.Three.prototype.updateInstance = function (runtimeObject, pr
|
||||||
if (runtimeObject instanceof R3.D3.Fog) {
|
if (runtimeObject instanceof R3.D3.Fog) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
property === 'color'
|
property === 'fogColor'
|
||||||
) {
|
) {
|
||||||
runtimeObject.color.instance.setRGB(
|
runtimeObject.fogColor.instance.setRGB(
|
||||||
runtimeObject.color.r,
|
runtimeObject.fogColor.r,
|
||||||
runtimeObject.color.g,
|
runtimeObject.fogColor.g,
|
||||||
runtimeObject.color.b
|
runtimeObject.fogColor.b
|
||||||
);
|
);
|
||||||
instance.color = runtimeObject.color.instance;
|
instance.color = runtimeObject.fogColor.instance;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1907,8 +1899,8 @@ R3.Runtime.Graphics.Three.prototype.updateInstance = function (runtimeObject, pr
|
||||||
if (property === 'size') {
|
if (property === 'size') {
|
||||||
|
|
||||||
instance.setSize(
|
instance.setSize(
|
||||||
runtimeObject.width,
|
runtimeObject.size.x,
|
||||||
runtimeObject.height
|
runtimeObject.size.y
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,7 +17,9 @@ R3.Runtime.GUI.ControlKit.prototype = Object.create(R3.Runtime.GUI.prototype);
|
||||||
R3.Runtime.GUI.ControlKit.prototype.constructor = R3.Runtime.GUI.ControlKit;
|
R3.Runtime.GUI.ControlKit.prototype.constructor = R3.Runtime.GUI.ControlKit;
|
||||||
|
|
||||||
R3.Runtime.GUI.ControlKit.prototype.createInstance = function() {
|
R3.Runtime.GUI.ControlKit.prototype.createInstance = function() {
|
||||||
return new ControlKit();
|
return new ControlKit({
|
||||||
|
panelsClosable : true
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.GUI.ControlKit.prototype.addComponent = function(gui, component) {
|
R3.Runtime.GUI.ControlKit.prototype.addComponent = function(gui, component) {
|
||||||
|
@ -46,7 +48,9 @@ R3.Runtime.GUI.ControlKit.prototype.addPanel = function(gui, name) {
|
||||||
return gui.instance.addPanel({
|
return gui.instance.addPanel({
|
||||||
label : name,
|
label : name,
|
||||||
width : 600,
|
width : 600,
|
||||||
fixed : false
|
fixed : false,
|
||||||
|
position : [0, 57],
|
||||||
|
align : 'right'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,8 +58,26 @@ R3.Runtime.GUI.ControlKit.prototype.addRamge = function(gui, panel) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.GUI.ControlKit.prototype.componentUpdate = function(component, property) {
|
R3.Runtime.GUI.ControlKit.prototype.componentUpdate = function(obj, component, property) {
|
||||||
return function() {
|
return function(index) {
|
||||||
|
|
||||||
|
if (obj.options && R3.Utils.Defined(index)) {
|
||||||
|
component[property] = obj.values[index];
|
||||||
|
} else if (component[property] instanceof R3.Color) {
|
||||||
|
component[property].fromHex(obj.color);
|
||||||
|
} else {
|
||||||
|
component[property] = obj.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The instance could have been destroyed already
|
||||||
|
*/
|
||||||
|
if (R3.Utils.UndefinedOrNull(component.instance)) {
|
||||||
|
console.warn('This GUI should be closed - the instance has alread been destroyed');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Here we update the property that changed of the component
|
* Here we update the property that changed of the component
|
||||||
*/
|
*/
|
||||||
|
@ -83,32 +105,123 @@ R3.Runtime.GUI.ControlKit.prototype.componentUpdate = function(component, proper
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
R3.Runtime.GUI.ControlKit.prototype.addColor = function(gui, panel, component, property) {
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
color : component[property].toHex()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var name = property.replace('Color','');
|
||||||
|
name = name.replace('color','');
|
||||||
|
|
||||||
|
panel.addColor(
|
||||||
|
obj,
|
||||||
|
'color',
|
||||||
|
{
|
||||||
|
colorMode : 'hex',
|
||||||
|
onChange : this.componentUpdate(obj, component, property),
|
||||||
|
label : name + ' color'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.Runtime.GUI.ControlKit.prototype.addSelect = function(gui, panel, component, property) {
|
||||||
|
|
||||||
|
var values = component.guiInfo[property].options.reduce(
|
||||||
|
function(result, option) {
|
||||||
|
result.push(option.value);
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
var options = component.guiInfo[property].options.reduce(
|
||||||
|
function(result, option) {
|
||||||
|
result.push(option.name);
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
options : options,
|
||||||
|
values : values,
|
||||||
|
value : options[values.indexOf(component[property])]
|
||||||
|
};
|
||||||
|
|
||||||
|
panel.addSelect(
|
||||||
|
obj,
|
||||||
|
'options',
|
||||||
|
{
|
||||||
|
onChange : this.componentUpdate(obj, component, property),
|
||||||
|
label : property,
|
||||||
|
target : 'value'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
R3.Runtime.GUI.ControlKit.prototype.addNumber = function(gui, panel, component, property) {
|
R3.Runtime.GUI.ControlKit.prototype.addNumber = function(gui, panel, component, property) {
|
||||||
|
|
||||||
component.range = this.range;
|
// component.range = this.range;
|
||||||
|
|
||||||
|
// var subgroup = null;
|
||||||
|
|
||||||
|
|
||||||
|
if (component.guiInfo && component.guiInfo[property]) {
|
||||||
|
//
|
||||||
|
// subgroup = panel.addSubGroup(
|
||||||
|
// {
|
||||||
|
// label : property
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
panel.addRange(
|
panel.addRange(
|
||||||
component,
|
component.guiInfo[property],
|
||||||
'range'
|
|
||||||
);
|
|
||||||
panel.addSlider(
|
|
||||||
component,
|
|
||||||
property,
|
|
||||||
'range',
|
'range',
|
||||||
{
|
{
|
||||||
dp : 4,
|
label : property + ' range'
|
||||||
onChange : this.componentUpdate(component, property),
|
|
||||||
onFinish : this.componentUpdate(component, property)
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
value : component[property],
|
||||||
|
range : component.guiInfo[property].range
|
||||||
|
};
|
||||||
|
|
||||||
|
panel.addSlider(
|
||||||
|
obj,
|
||||||
|
'value',
|
||||||
|
'range',
|
||||||
|
{
|
||||||
|
dp: component.guiInfo[property].dp,
|
||||||
|
onChange: this.componentUpdate(obj, component, property),
|
||||||
|
onFinish: this.componentUpdate(obj, component, property)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// var group = null;
|
||||||
|
//
|
||||||
|
// if (subgroup) {
|
||||||
|
// group = subgroup;
|
||||||
|
// } else {
|
||||||
|
// group = panel.getGroups()[panel.getGroups().length - 1];
|
||||||
|
// }
|
||||||
|
|
||||||
panel.addNumberOutput(
|
panel.addNumberOutput(
|
||||||
component,
|
component,
|
||||||
property,
|
property,
|
||||||
{
|
{
|
||||||
|
label : property + ' (read-only)',
|
||||||
dp : 4
|
dp : 4
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.Runtime.GUI.ControlKit.prototype.addString = function(gui, panel, component, property) {
|
R3.Runtime.GUI.ControlKit.prototype.addString = function(gui, panel, component, property) {
|
||||||
|
@ -118,10 +231,25 @@ R3.Runtime.GUI.ControlKit.prototype.addString = function(gui, panel, component,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
R3.Runtime.GUI.ControlKit.prototype.addCheckbox = function(gui, panel, component, property) {
|
||||||
|
|
||||||
|
var obj = {
|
||||||
|
value : component[property]
|
||||||
|
};
|
||||||
|
|
||||||
|
panel.addCheckbox(
|
||||||
|
obj,
|
||||||
|
'value', {
|
||||||
|
onChange: this.componentUpdate(obj, component, property),
|
||||||
|
label : property
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
R3.Runtime.GUI.ControlKit.prototype.addButton = function(gui, panel, component, property) {
|
R3.Runtime.GUI.ControlKit.prototype.addButton = function(gui, panel, component, property) {
|
||||||
panel.addButton(
|
panel.addButton(
|
||||||
component,
|
property,
|
||||||
property
|
component[property].bind(component)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ R3.System.GUI = function(options) {
|
||||||
|
|
||||||
this.beforeRenderSubscription = null;
|
this.beforeRenderSubscription = null;
|
||||||
|
|
||||||
|
this.removeComponentSubscription = null;
|
||||||
|
|
||||||
// this.faces = [];
|
// this.faces = [];
|
||||||
//
|
//
|
||||||
|
@ -61,7 +62,6 @@ R3.System.GUI = function(options) {
|
||||||
R3.System.GUI.prototype = Object.create(R3.System.prototype);
|
R3.System.GUI.prototype = Object.create(R3.System.prototype);
|
||||||
R3.System.GUI.prototype.constructor = R3.System.GUI;
|
R3.System.GUI.prototype.constructor = R3.System.GUI;
|
||||||
|
|
||||||
|
|
||||||
R3.System.GUI.prototype.start = function() {
|
R3.System.GUI.prototype.start = function() {
|
||||||
|
|
||||||
this.guiCreatedSubscription = R3.Event.Subscribe(
|
this.guiCreatedSubscription = R3.Event.Subscribe(
|
||||||
|
@ -89,6 +89,11 @@ R3.System.GUI.prototype.start = function() {
|
||||||
this.beforeRender.bind(this)
|
this.beforeRender.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.removeComponentSubscription = R3.Event.Subscribe(
|
||||||
|
R3.Event.REMOVE_COMPONENT,
|
||||||
|
this.removeComponent.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
R3.System.prototype.start.call(this);
|
R3.System.prototype.start.call(this);
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +156,6 @@ R3.System.GUI.prototype.start = function() {
|
||||||
// };
|
// };
|
||||||
|
|
||||||
R3.System.GUI.prototype.beforeRender = function() {
|
R3.System.GUI.prototype.beforeRender = function() {
|
||||||
|
|
||||||
this.guis.map(
|
this.guis.map(
|
||||||
function(gui) {
|
function(gui) {
|
||||||
if (typeof gui.instance.update === 'function') {
|
if (typeof gui.instance.update === 'function') {
|
||||||
|
@ -159,6 +163,21 @@ R3.System.GUI.prototype.beforeRender = function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
R3.System.GUI.prototype.removeComponent = function(data) {
|
||||||
|
|
||||||
|
this.guis.map(
|
||||||
|
function(gui) {
|
||||||
|
gui.instance._panels.map(
|
||||||
|
function(panel) {
|
||||||
|
if (panel._label === data.component.name) {
|
||||||
|
panel.getNode().getElement().parentElement.removeChild(panel.getNode().getElement())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -257,6 +276,9 @@ R3.System.GUI.prototype.guiRemoved = function(gui) {
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* clear GUI
|
||||||
|
*/
|
||||||
R3.System.GUI.prototype.clearGUI = function() {
|
R3.System.GUI.prototype.clearGUI = function() {
|
||||||
this.guis.map(
|
this.guis.map(
|
||||||
function(gui) {
|
function(gui) {
|
||||||
|
@ -265,7 +287,7 @@ R3.System.GUI.prototype.clearGUI = function() {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.System.GUI.prototype.buildGUI = function(__component) {
|
R3.System.GUI.prototype.buildGUI = function(component) {
|
||||||
|
|
||||||
this.guis.map(
|
this.guis.map(
|
||||||
function(gui) {
|
function(gui) {
|
||||||
|
@ -275,44 +297,221 @@ R3.System.GUI.prototype.buildGUI = function(__component) {
|
||||||
*/
|
*/
|
||||||
gui.clear();
|
gui.clear();
|
||||||
|
|
||||||
var panel = gui.addPanel(__component.name);
|
var addComponent = function(group, component, property) {
|
||||||
|
if (
|
||||||
Object.keys(__component.idToObject).map(
|
component.hasOwnProperty(property) ||
|
||||||
function(id) {
|
typeof component[property] === 'function'
|
||||||
|
) {
|
||||||
var component = R3.EntityManager.Instance.findComponentById(id);
|
|
||||||
|
|
||||||
var group = gui.addGroup(panel, component.name);
|
|
||||||
|
|
||||||
Object.keys(component).map(
|
|
||||||
function(property) {
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
property === 'id' ||
|
property === 'componentType' ||
|
||||||
property === 'componentType'
|
property === 'register' ||
|
||||||
|
property === 'linked' ||
|
||||||
|
property === 'loaded' ||
|
||||||
|
property === 'selected'
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (component.hasOwnProperty(property)) {
|
if (component.guiInfo && component.guiInfo[property] && component.guiInfo[property].options) {
|
||||||
|
gui.addSelect(group, component, property);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component[property] instanceof R3.Color) {
|
||||||
|
gui.addColor(group, component, property);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof component[property] === 'boolean') {
|
||||||
|
gui.addCheckbox(group, component, property);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof component[property] === 'number') {
|
if (typeof component[property] === 'number') {
|
||||||
gui.addNumber(group, component, property)
|
gui.addNumber(group, component, property);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof component[property] === 'string') {
|
if (typeof component[property] === 'string') {
|
||||||
gui.addString(group, component, property)
|
gui.addString(group, component, property);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof component[property] === 'function') {
|
if (typeof component[property] === 'function') {
|
||||||
gui.addButton(group, component, property)
|
gui.addButton(group, component, property);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var panel = gui.addPanel(component.name);
|
||||||
|
|
||||||
|
gui.addGroup(panel, 'Main');
|
||||||
|
|
||||||
|
var traverseComponent = function(component) {
|
||||||
|
|
||||||
|
var properties = Object.keys(component);
|
||||||
|
|
||||||
|
properties.sort();
|
||||||
|
|
||||||
|
properties.splice(properties.indexOf('id'), 1);
|
||||||
|
properties.splice(properties.indexOf('name'), 1);
|
||||||
|
|
||||||
|
properties.unshift('name');
|
||||||
|
properties.unshift('id');
|
||||||
|
|
||||||
|
properties.map(
|
||||||
|
function(property) {
|
||||||
|
if (component.hasOwnProperty(property)) {
|
||||||
|
|
||||||
|
if (component.guiInfo && component.guiInfo.hasOwnProperty(property)) {
|
||||||
|
/**
|
||||||
|
* Skip properties in guiInfos - they need to go into subgroups
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
addComponent(panel, component, property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
properties.map(
|
||||||
|
function(property) {
|
||||||
|
if (component.hasOwnProperty(property)) {
|
||||||
|
|
||||||
|
if (!(component.guiInfo && component.guiInfo.hasOwnProperty(property))) {
|
||||||
|
/**
|
||||||
|
* Skip properties *NOT* in guiInfos
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var group = panel.addSubGroup(
|
||||||
|
{
|
||||||
|
label : property
|
||||||
|
}
|
||||||
|
);
|
||||||
|
addComponent(group, component, property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
traverseComponent(component);
|
||||||
|
|
||||||
|
Object.keys(component.idToObject).map(
|
||||||
|
function(id) {
|
||||||
|
|
||||||
|
var _component = R3.EntityManager.Instance.findComponentById(id);
|
||||||
|
|
||||||
|
if (_component.id === component.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_component instanceof R3.Color) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gui.addGroup(panel, _component.name);
|
||||||
|
|
||||||
|
traverseComponent(_component);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var functions = [];
|
||||||
|
|
||||||
|
for (var fn in component) {
|
||||||
|
if (
|
||||||
|
typeof component[fn] === 'function') {
|
||||||
|
if (
|
||||||
|
// fn === 'clone' ||
|
||||||
|
fn === 'remove' ||
|
||||||
|
fn === 'save'
|
||||||
|
// fn === 'saveToRemoteAPI'
|
||||||
|
) {
|
||||||
|
functions.push(fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
functions.sort();
|
||||||
|
|
||||||
|
var actions = gui.addGroup(panel, 'Actions');
|
||||||
|
|
||||||
|
functions.map(
|
||||||
|
function(fn) {
|
||||||
|
addComponent(actions, component, fn);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
// var guiInfos = Object.keys(__component.guiInfo);
|
||||||
);
|
//
|
||||||
|
// var linkedObjects = Object.keys(__component.idToObject);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// .reduce(
|
||||||
|
// function(result, key) {
|
||||||
|
//
|
||||||
|
// var
|
||||||
|
//
|
||||||
|
// result.push(key);
|
||||||
|
// return result;
|
||||||
|
// },
|
||||||
|
// []
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// var numberGroup = panel.addGroup(
|
||||||
|
// {
|
||||||
|
// label : 'Numbers'
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// var stringGroup = panel.addGroup(
|
||||||
|
// {
|
||||||
|
// label : 'Strings'
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// var addComponent = function(group, component) {
|
||||||
|
// return function(property) {
|
||||||
|
// if (component.hasOwnProperty(property)) {
|
||||||
|
//
|
||||||
|
// if (typeof component[property] === 'number') {
|
||||||
|
// gui.addNumber(numberGroup, component, property)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (typeof component[property] === 'string') {
|
||||||
|
// gui.addString(stringGroup, component, property)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (typeof component[property] === 'function') {
|
||||||
|
// gui.addButton(group, component, property)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// Object.keys(__component).map(addComponent(panel, __component));
|
||||||
|
//
|
||||||
|
// Object.keys(__component.idToObject).map(
|
||||||
|
// function(id) {
|
||||||
|
//
|
||||||
|
// if (id === __component.id) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// var component = R3.EntityManager.Instance.findComponentById(id);
|
||||||
|
//
|
||||||
|
// var group = gui.addGroup(panel, component.name);
|
||||||
|
//
|
||||||
|
// Object.keys(component).map(addComponent(group, component));
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
@ -778,6 +977,8 @@ R3.System.GUI.prototype.stop = function() {
|
||||||
|
|
||||||
this.beforeRenderSubscription.remove();
|
this.beforeRenderSubscription.remove();
|
||||||
|
|
||||||
|
this.removeComponentSubscription.remove();
|
||||||
|
|
||||||
R3.System.prototype.stop.call(this);
|
R3.System.prototype.stop.call(this);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -89,7 +89,7 @@ R3.System.Query.prototype.query = function(data) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
xhr.open(
|
xhr.open(
|
||||||
'POST',
|
query.httpMethod,
|
||||||
data.queryApiUrl + query.path
|
data.queryApiUrl + query.path
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ R3.System.Render.prototype.canvasResize = function(canvas) {
|
||||||
project.renderers.map(
|
project.renderers.map(
|
||||||
function(renderer) {
|
function(renderer) {
|
||||||
if (renderer.canvas === canvas) {
|
if (renderer.canvas === canvas) {
|
||||||
|
if (renderer.viewports) {
|
||||||
renderer.viewports.map(
|
renderer.viewports.map(
|
||||||
function (viewport) {
|
function (viewport) {
|
||||||
viewport.updateInstance('size');
|
viewport.updateInstance('size');
|
||||||
|
@ -182,6 +183,7 @@ R3.System.Render.prototype.canvasResize = function(canvas) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -611,14 +613,21 @@ R3.System.Render.prototype.render = function() {
|
||||||
|
|
||||||
if (renderer.autoClear) {
|
if (renderer.autoClear) {
|
||||||
resetAutoClear = true;
|
resetAutoClear = true;
|
||||||
|
renderer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer.autoClear = false;
|
renderer.autoClear = false;
|
||||||
renderer.updateInstance('autoClear');
|
renderer.updateInstance('autoClear');
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (renderer.autoClear) {
|
||||||
renderer.clear();
|
renderer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
renderer.viewports.map(
|
renderer.viewports.map(
|
||||||
|
|
||||||
function (viewport) {
|
function (viewport) {
|
||||||
|
@ -628,11 +637,16 @@ R3.System.Render.prototype.render = function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var actualSize = {
|
||||||
|
width : viewport.width * size.width,
|
||||||
|
height : viewport.height * size.height
|
||||||
|
};
|
||||||
|
|
||||||
renderer.instance.setViewport(
|
renderer.instance.setViewport(
|
||||||
viewport.x * size.width,
|
viewport.x * size.width,
|
||||||
viewport.y * size.height,
|
viewport.y * size.height,
|
||||||
viewport.width * size.width,
|
actualSize.width,
|
||||||
viewport.height * size.height
|
actualSize.height
|
||||||
);
|
);
|
||||||
|
|
||||||
scenes.map(
|
scenes.map(
|
||||||
|
@ -722,7 +736,6 @@ R3.System.Render.prototype.render = function() {
|
||||||
|
|
||||||
if (camera instanceof R3.D3.Camera.Perspective.Stereo) {
|
if (camera instanceof R3.D3.Camera.Perspective.Stereo) {
|
||||||
|
|
||||||
|
|
||||||
if (!viewport instanceof R3.D3.Viewport.FixedAspect.VR) {
|
if (!viewport instanceof R3.D3.Viewport.FixedAspect.VR) {
|
||||||
console.warn('stereo cameras should work with VR viewports');
|
console.warn('stereo cameras should work with VR viewports');
|
||||||
} else {
|
} else {
|
||||||
|
@ -781,22 +794,56 @@ R3.System.Render.prototype.render = function() {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (scene.enableComposer) {
|
if (renderer.enableComposer) {
|
||||||
|
|
||||||
|
if (!project.composer) {
|
||||||
|
console.warn('enabling a composer when no composer is specified has no effect');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!project.composer.ready()) {
|
||||||
|
console.warn('the composer is not ready yet: ' + project.composer.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// renderer.instance.setSize(
|
||||||
|
// actualSize.width,
|
||||||
|
// actualSize.height
|
||||||
|
// )
|
||||||
//
|
//
|
||||||
// if (!scene.composer) {
|
// project.composer.instance.setSize(
|
||||||
// console.warn('enabling a composer when no composer is specified on the scene has no effect');
|
// actualSize.width,
|
||||||
// return;
|
// actualSize.height
|
||||||
// }
|
// )
|
||||||
//
|
|
||||||
// if (!scene.composer.ready()) {
|
project.composer.size.x = actualSize.width;
|
||||||
// console.warn('the composer is not ready yet: ' + scene.composer.name);
|
project.composer.size.y = actualSize.height;
|
||||||
// }
|
|
||||||
//
|
project.composer.updateInstance('size');
|
||||||
// scene.composer.render();
|
|
||||||
//
|
project.composer.passes.map(
|
||||||
// console.warn('todo: check if have to return from composer render here');
|
function(pass) {
|
||||||
// //return;
|
if (pass instanceof R3.D3.Pass.Render) {
|
||||||
// }
|
pass.instance.camera = cameraInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pass instanceof R3.D3.Pass.FXAA) {
|
||||||
|
pass.width = actualSize.width;
|
||||||
|
pass.height = actualSize.height;
|
||||||
|
pass.updateInstance('size');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pass instanceof R3.D3.Pass.Bloom) {
|
||||||
|
pass.size.x = actualSize.width;
|
||||||
|
pass.size.y = actualSize.height;
|
||||||
|
pass.updateInstance('size');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
project.composer.render();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (renderer.target) {
|
if (renderer.target) {
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,13 @@ R3.System.Storage = function() {
|
||||||
this.loadSubscription = null;
|
this.loadSubscription = null;
|
||||||
this.signInSubscription = null;
|
this.signInSubscription = null;
|
||||||
this.signOutSubscription = null;
|
this.signOutSubscription = null;
|
||||||
|
this.saveSubscription = null;
|
||||||
|
|
||||||
|
this.savedSubscription = null;
|
||||||
|
this.savedErrorSubscription = null;
|
||||||
|
|
||||||
// this.otherDependencies = [];
|
// this.otherDependencies = [];
|
||||||
|
|
||||||
// this.saveSubscription = null;
|
|
||||||
// this.loadImageSubscription = null;
|
// this.loadImageSubscription = null;
|
||||||
// this.blenderDataSubscription = null;
|
// this.blenderDataSubscription = null;
|
||||||
// this.imageUploadCompleteSubscription = null;
|
// this.imageUploadCompleteSubscription = null;
|
||||||
|
@ -48,10 +51,11 @@ R3.System.Storage.prototype.start = function() {
|
||||||
this.load.bind(this)
|
this.load.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
// this.saveSubscription = this.subscribe(
|
this.saveSubscription = R3.Event.Subscribe(
|
||||||
// R3.Event.SAVE_COMPONENT,
|
R3.Event.SAVE_COMPONENT,
|
||||||
// this.save
|
this.save.bind(this)
|
||||||
// );
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// this.loadSubscription = this.subscribe(
|
// this.loadSubscription = this.subscribe(
|
||||||
// R3.Event.LOAD_COMPONENT,
|
// R3.Event.LOAD_COMPONENT,
|
||||||
|
@ -263,7 +267,89 @@ R3.System.Storage.prototype.delete = function(data) {
|
||||||
/**
|
/**
|
||||||
* 'Saves' data to somewhere
|
* 'Saves' data to somewhere
|
||||||
*/
|
*/
|
||||||
R3.System.Storage.prototype.save = function(data) {
|
R3.System.Storage.prototype.save = function(data, callback, errorCallback) {
|
||||||
|
|
||||||
|
var toSave = [];
|
||||||
|
var saved = [];
|
||||||
|
var failed = [];
|
||||||
|
|
||||||
|
if (this.savedSubscription || this.savedErrorSubscription) {
|
||||||
|
console.warn('another save is in progress');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
R3.Event.Emit(
|
||||||
|
R3.Event.SAVING,
|
||||||
|
{
|
||||||
|
component: this
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this.savedSubscription = R3.Event.Subscribe(
|
||||||
|
R3.Event.COMPONENT_SAVED,
|
||||||
|
function(data) {
|
||||||
|
|
||||||
|
saved.push(data.component);
|
||||||
|
|
||||||
|
if (failed.length + saved.length === toSave.length) {
|
||||||
|
|
||||||
|
this.savedSubscription.remove();
|
||||||
|
|
||||||
|
this.savedSubscription = null;
|
||||||
|
|
||||||
|
this.savedErrorSubscription.remove();
|
||||||
|
|
||||||
|
this.savedErrorSubscription = null;
|
||||||
|
|
||||||
|
R3.Event.Emit(
|
||||||
|
R3.Event.DONE_SAVING,
|
||||||
|
{
|
||||||
|
failed: failed,
|
||||||
|
saved: saved
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.savedErrorSubscription = R3.Event.Subscribe(
|
||||||
|
R3.Event.SAVE_COMPONENT_ERROR,
|
||||||
|
function(data) {
|
||||||
|
|
||||||
|
failed.push(data.component);
|
||||||
|
|
||||||
|
if (errorCallback) {
|
||||||
|
errorCallback(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failed.length + saved.length === toSave.length) {
|
||||||
|
|
||||||
|
this.savedSubscription.remove();
|
||||||
|
|
||||||
|
this.savedSubscription = null;
|
||||||
|
|
||||||
|
this.savedErrorSubscription.remove();
|
||||||
|
|
||||||
|
this.savedErrorSubscription = null;
|
||||||
|
|
||||||
|
R3.Event.Emit(
|
||||||
|
R3.Event.DONE_SAVING,
|
||||||
|
{
|
||||||
|
failed: failed,
|
||||||
|
saved: saved
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
var apiUrl = null;
|
||||||
|
|
||||||
var event = R3.Event.GET_API_URL;
|
var event = R3.Event.GET_API_URL;
|
||||||
|
|
||||||
|
@ -271,69 +357,102 @@ R3.System.Storage.prototype.save = function(data) {
|
||||||
event = R3.Event.GET_REMOTE_API_URL
|
event = R3.Event.GET_REMOTE_API_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emit(
|
R3.Event.Emit(
|
||||||
event,
|
event,
|
||||||
null,
|
null,
|
||||||
function(urlData) {
|
function(urlData) {
|
||||||
|
apiUrl = urlData.apiUrl
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var apiObjects = Object.keys(data.component.idToObject).reduce(
|
||||||
|
|
||||||
|
function(result, componentId) {
|
||||||
|
|
||||||
|
var component = R3.EntityManager.Instance.findComponentById(componentId);
|
||||||
|
|
||||||
|
var apiObject = component.toApiObject();
|
||||||
|
|
||||||
|
result.push(apiObject);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}.bind(this),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
if (typeof XMLHttpRequest === 'undefined') {
|
if (typeof XMLHttpRequest === 'undefined') {
|
||||||
console.log('Implement server side save here');
|
console.log('Implement server side save here');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apiObjects.map(
|
||||||
|
function(apiObject) {
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
xhr.open(
|
xhr.open(
|
||||||
'POST',
|
'POST',
|
||||||
urlData.apiUrl + '/component/create'
|
apiUrl + '/component/create'
|
||||||
);
|
);
|
||||||
|
|
||||||
xhr.setRequestHeader("Accept", "application/json");
|
xhr.setRequestHeader("Accept", "application/json");
|
||||||
xhr.setRequestHeader("Content-Type", "application/json");
|
xhr.setRequestHeader("Content-Type", "application/json");
|
||||||
xhr.setRequestHeader("x-authorization", urlData.passwoid);
|
xhr.setRequestHeader("x-api-authorization", apiAuthorization);
|
||||||
|
xhr.setRequestHeader('x-api-user-token', this.apiUserToken);
|
||||||
|
|
||||||
|
xhr.onload = function() {
|
||||||
|
|
||||||
xhr.onreadystatechange = function() {
|
|
||||||
if (this.readyState === 4) {
|
|
||||||
try {
|
try {
|
||||||
var response = JSON.parse(this.responseText)
|
|
||||||
|
var response = JSON.parse(xhr.responseText);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.SAVE_COMPONENT_ERROR,
|
R3.Event.SAVE_COMPONENT_ERROR,
|
||||||
{
|
{
|
||||||
message: this.responseText,
|
message: this.responseText,
|
||||||
component : data.apiObject
|
component : apiObject
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.result === 'success') {
|
if (response.result === 'success') {
|
||||||
|
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.COMPONENT_SAVED,
|
R3.Event.COMPONENT_SAVED,
|
||||||
{
|
{
|
||||||
message: response.message || 'Successfully saved the component',
|
message: response.message || 'Successfully saved the component',
|
||||||
component : data.apiObject
|
component : apiObject
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.SAVE_COMPONENT_ERROR,
|
R3.Event.SAVE_COMPONENT_ERROR,
|
||||||
{
|
{
|
||||||
message: response.message || 'The server responded but failed to save the component',
|
message: response.message || 'The server responded but failed to save the component',
|
||||||
component : data.apiObject
|
component : apiObject
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
xhr.send(JSON.stringify({
|
var data = JSON.stringify(apiObject);
|
||||||
component : data.apiObject,
|
|
||||||
session : this.token
|
xhr.send(
|
||||||
}));
|
{
|
||||||
},
|
component : data
|
||||||
function error(error){
|
|
||||||
console.error(error);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1048,6 +1167,7 @@ R3.System.Storage.prototype.stop = function() {
|
||||||
this.signInSubscription.remove();
|
this.signInSubscription.remove();
|
||||||
this.loadSubscription.remove();
|
this.loadSubscription.remove();
|
||||||
this.signOutSubscription.remove();
|
this.signOutSubscription.remove();
|
||||||
|
this.saveSubscription.remove();
|
||||||
|
|
||||||
this.loaded = [];
|
this.loaded = [];
|
||||||
this.failed = [];
|
this.failed = [];
|
||||||
|
@ -1055,7 +1175,6 @@ R3.System.Storage.prototype.stop = function() {
|
||||||
|
|
||||||
R3.System.prototype.stop.call(this);
|
R3.System.prototype.stop.call(this);
|
||||||
|
|
||||||
// this.saveSubscription.remove();
|
|
||||||
// this.loadImageSubscription.remove();
|
// this.loadImageSubscription.remove();
|
||||||
// this.loadFontSubscription.remove();
|
// this.loadFontSubscription.remove();
|
||||||
// this.blenderDataSubscription.remove();
|
// this.blenderDataSubscription.remove();
|
||||||
|
|
Loading…
Reference in New Issue