google-login
parent
cf89b2cc7d
commit
4b1a6c0330
|
@ -136,6 +136,7 @@ R3.Event.ENGINE_FIRED_PARTICLES_ZERO = 0x76;
|
||||||
R3.Event.GET_DEFAULT_SCENE = 0x77;
|
R3.Event.GET_DEFAULT_SCENE = 0x77;
|
||||||
R3.Event.GET_DEFAULT_CAMERA = 0x78;
|
R3.Event.GET_DEFAULT_CAMERA = 0x78;
|
||||||
R3.Event.GET_WEBSOCKET_CONFIG = 0x79;
|
R3.Event.GET_WEBSOCKET_CONFIG = 0x79;
|
||||||
|
R3.Event.GET_PROJECT = 0x7a;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string name of event ID
|
* Returns string name of event ID
|
||||||
|
@ -267,6 +268,7 @@ R3.Event.GetEventName = function(number) {
|
||||||
case 0x77 : return 'get_default_scene';
|
case 0x77 : return 'get_default_scene';
|
||||||
case 0x78 : return 'get_default_camera';
|
case 0x78 : return 'get_default_camera';
|
||||||
case 0x79 : return 'get_websocket_config';
|
case 0x79 : return 'get_websocket_config';
|
||||||
|
case 0x7a : return 'get_project';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,7 @@ R3.Component.AUDIO = 0x55;
|
||||||
R3.Component.SYSTEM_AUDIO = 0x56;
|
R3.Component.SYSTEM_AUDIO = 0x56;
|
||||||
R3.Component.SOCKET_CAST = 0x57;
|
R3.Component.SOCKET_CAST = 0x57;
|
||||||
R3.Component.CAMERA_ORTHOGRAPHIC = 0x58;
|
R3.Component.CAMERA_ORTHOGRAPHIC = 0x58;
|
||||||
R3.Component.CAMERA_STEREO = 0x59;
|
R3.Component.CAMERA_PERSPECTIVE_STEREO = 0x59;
|
||||||
R3.Component.CAMERA_CUBE = 0x5a;
|
R3.Component.CAMERA_CUBE = 0x5a;
|
||||||
R3.Component.SHADOW = 0x5b;
|
R3.Component.SHADOW = 0x5b;
|
||||||
R3.Component.RENDER_TARGET_CUBE = 0x5c;
|
R3.Component.RENDER_TARGET_CUBE = 0x5c;
|
||||||
|
@ -407,9 +407,10 @@ R3.Component.GEOMETRY_BUFFER_INSTANCED = 0xa1;
|
||||||
R3.Component.MATERIAL_SHADER_RAW = 0xa2;
|
R3.Component.MATERIAL_SHADER_RAW = 0xa2;
|
||||||
R3.Component.MATERIAL_POINTS = 0xa3;
|
R3.Component.MATERIAL_POINTS = 0xa3;
|
||||||
R3.Component.VIDEO = 0xa4;
|
R3.Component.VIDEO = 0xa4;
|
||||||
R3.Component.AR = 0xa5;
|
R3.Component.USER = 0xa5;
|
||||||
|
R3.Component.PROJECT = 0xa6;
|
||||||
|
|
||||||
R3.Component.MAX_COMPONENTS = 0xa6;
|
R3.Component.MAX_COMPONENTS = 0xa7;
|
||||||
|
|
||||||
R3.Component.GRAPHICS_RUNTIME = 0x1;
|
R3.Component.GRAPHICS_RUNTIME = 0x1;
|
||||||
R3.Component.PHYSICS_RUNTIME = 0x2;
|
R3.Component.PHYSICS_RUNTIME = 0x2;
|
||||||
|
@ -418,7 +419,6 @@ R3.Component.STATISTICS_RUNTIME = 0x4;
|
||||||
R3.Component.DEFAULT_RUNTIME = 0x5;
|
R3.Component.DEFAULT_RUNTIME = 0x5;
|
||||||
R3.Component.GUI_RUNTIME = 0x6;
|
R3.Component.GUI_RUNTIME = 0x6;
|
||||||
R3.Component.CODER_RUNTIME = 0x7;
|
R3.Component.CODER_RUNTIME = 0x7;
|
||||||
R3.Component.AUGMENTED_RUNTIME = 0x8;
|
|
||||||
|
|
||||||
R3.Component.GetCompentTypes = function(constructor) {
|
R3.Component.GetCompentTypes = function(constructor) {
|
||||||
|
|
||||||
|
@ -960,10 +960,10 @@ R3.Component.GetComponentInfo = function(number) {
|
||||||
apiConstructor : R3.D3.API.Camera.Orthographic
|
apiConstructor : R3.D3.API.Camera.Orthographic
|
||||||
};
|
};
|
||||||
case 0x59 : return {
|
case 0x59 : return {
|
||||||
name : 'R3.D3.Camera.Stereo',
|
name : 'R3.D3.Camera.Perspective.Stereo',
|
||||||
runtime : R3.Component.GRAPHICS_RUNTIME,
|
runtime : R3.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : R3.D3.Camera.Stereo,
|
constructor : R3.D3.Camera.Perspective.Stereo,
|
||||||
apiConstructor : R3.D3.API.Camera.Stereo
|
apiConstructor : R3.D3.API.Camera.Perspective.Stereo
|
||||||
};
|
};
|
||||||
case 0x5a : return {
|
case 0x5a : return {
|
||||||
name : 'R3.D3.Camera.Cube',
|
name : 'R3.D3.Camera.Cube',
|
||||||
|
@ -1416,10 +1416,16 @@ R3.Component.GetComponentInfo = function(number) {
|
||||||
apiConstructor : R3.API.Video
|
apiConstructor : R3.API.Video
|
||||||
};
|
};
|
||||||
case 0xa5 : return {
|
case 0xa5 : return {
|
||||||
name : 'R3.AR',
|
name : 'R3.User',
|
||||||
runtime : R3.Component.AUGMENTED_RUNTIME,
|
runtime : R3.Component.DEFAULT_RUNTIME,
|
||||||
constructor : R3.AR,
|
constructor : R3.User,
|
||||||
apiConstructor : R3.API.AR
|
apiConstructor : R3.API.User
|
||||||
|
};
|
||||||
|
case 0xa6 : return {
|
||||||
|
name : 'R3.Project',
|
||||||
|
runtime : R3.Component.DEFAULT_RUNTIME,
|
||||||
|
constructor : R3.Project,
|
||||||
|
apiConstructor : R3.API.Project
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1459,10 +1465,6 @@ R3.Component.GetRuntimeName = function(runtime) {
|
||||||
return 'Coder';
|
return 'Coder';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runtime === R3.Component.AUGMENTED_RUNTIME) {
|
|
||||||
return 'Augmented';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'Default';
|
return 'Default';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1972,15 +1974,6 @@ R3.Component.GetRuntimeObject = function(runtimeInfo) {
|
||||||
|
|
||||||
return runtime.statistics;
|
return runtime.statistics;
|
||||||
|
|
||||||
} else if (runtimeInfo === R3.Component.AUGMENTED_RUNTIME) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(runtime.augmented)) {
|
|
||||||
console.warn('no augmented runtime');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return runtime.augmented;
|
|
||||||
|
|
||||||
} else if (runtimeInfo === R3.Component.DEFAULT_RUNTIME) {
|
} else if (runtimeInfo === R3.Component.DEFAULT_RUNTIME) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -2010,13 +2003,6 @@ R3.Component.ConstructFromObject = function(rawComponentObject) {
|
||||||
|
|
||||||
var runtimeComponent = null;
|
var runtimeComponent = null;
|
||||||
|
|
||||||
// if (
|
|
||||||
// rawComponentObject.componentType === 34 &&
|
|
||||||
// rawComponentObject.name.indexOf('Mesh') !== -1
|
|
||||||
// ) {
|
|
||||||
// rawComponentObject.componentType = 7;
|
|
||||||
// }
|
|
||||||
|
|
||||||
var info = R3.Component.GetComponentInfo(rawComponentObject.componentType);
|
var info = R3.Component.GetComponentInfo(rawComponentObject.componentType);
|
||||||
|
|
||||||
var runtime = R3.Component.GetRuntimeObject(info.runtime);
|
var runtime = R3.Component.GetRuntimeObject(info.runtime);
|
||||||
|
|
|
@ -100,8 +100,6 @@ R3.API.Controls.GetComponentType = function(controlsType) {
|
||||||
return componentType;
|
return componentType;
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.D3 = function() {};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls Type
|
* Controls Type
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -113,3 +111,8 @@ R3.API.Controls.CONTROLS_TYPE_MOUSE = 0x3;
|
||||||
R3.API.Controls.CONTROLS_TYPE_EDITOR = 0x4;
|
R3.API.Controls.CONTROLS_TYPE_EDITOR = 0x4;
|
||||||
R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON = 0x5;
|
R3.API.Controls.CONTROLS_TYPE_FIRST_PERSON = 0x5;
|
||||||
R3.API.Controls.CONTROLS_TYPE_ORBIT = 0x6;
|
R3.API.Controls.CONTROLS_TYPE_ORBIT = 0x6;
|
||||||
|
|
||||||
|
|
||||||
|
R3.API.Controls.D3 = function() {};
|
||||||
|
R3.API.Controls.D3.prototype = Object.create(R3.API.Controls.prototype);
|
||||||
|
R3.API.Controls.D3.prototype.constructor = R3.API.Controls.D3;
|
|
@ -40,5 +40,5 @@ R3.API.Controls.D3.Editor = function(
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.D3.Editor.prototype = Object.create(R3.API.Controls.prototype);
|
R3.API.Controls.D3.Editor.prototype = Object.create(R3.API.Controls.D3.prototype);
|
||||||
R3.API.Controls.D3.Editor.prototype.constructor = R3.API.Controls.D3.Editor;
|
R3.API.Controls.D3.Editor.prototype.constructor = R3.API.Controls.D3.Editor;
|
||||||
|
|
|
@ -132,5 +132,5 @@ R3.API.Controls.D3.FirstPerson = function(
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.D3.FirstPerson.prototype = Object.create(R3.API.Controls.prototype);
|
R3.API.Controls.D3.FirstPerson.prototype = Object.create(R3.API.Controls.D3.prototype);
|
||||||
R3.API.Controls.D3.FirstPerson.prototype.constructor = R3.API.Controls.D3.FirstPerson;
|
R3.API.Controls.D3.FirstPerson.prototype.constructor = R3.API.Controls.D3.FirstPerson;
|
||||||
|
|
|
@ -143,5 +143,5 @@ R3.API.Controls.D3.Orbit = function(
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.API.Controls.D3.Orbit.prototype = Object.create(R3.API.Controls.prototype);
|
R3.API.Controls.D3.Orbit.prototype = Object.create(R3.API.Controls.D3.prototype);
|
||||||
R3.API.Controls.D3.Orbit.prototype.constructor = R3.API.Controls.D3.Orbit;
|
R3.API.Controls.D3.Orbit.prototype.constructor = R3.API.Controls.D3.Orbit;
|
||||||
|
|
|
@ -21,18 +21,7 @@ R3.API.RenderConfiguration = function (
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parentEntity,
|
parentEntity,
|
||||||
logicalSize,
|
|
||||||
aspectRatio,
|
|
||||||
scaleMode,
|
|
||||||
activeCamera,
|
|
||||||
activeScene,
|
|
||||||
activeScenes,
|
|
||||||
activeRenderer,
|
|
||||||
activeComposer,
|
|
||||||
activeEffect,
|
|
||||||
enableComposer,
|
|
||||||
enableEffect,
|
|
||||||
defaultMode
|
|
||||||
) {
|
) {
|
||||||
if (R3.Utils.UndefinedOrNull(id)) {
|
if (R3.Utils.UndefinedOrNull(id)) {
|
||||||
id = R3.Utils.RandomId();
|
id = R3.Utils.RandomId();
|
||||||
|
@ -102,10 +91,7 @@ R3.API.RenderConfiguration = function (
|
||||||
}
|
}
|
||||||
this.enableEffect = enableEffect;
|
this.enableEffect = enableEffect;
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(defaultMode)) {
|
|
||||||
defaultMode = R3.API.RenderConfiguration.DEFAULT_MODE_IN_GAME;
|
|
||||||
}
|
|
||||||
this.defaultMode = defaultMode;
|
|
||||||
|
|
||||||
R3.API.Component.call(
|
R3.API.Component.call(
|
||||||
this,
|
this,
|
||||||
|
@ -118,17 +104,4 @@ R3.API.RenderConfiguration = function (
|
||||||
R3.API.RenderConfiguration.prototype = Object.create(R3.API.Component.prototype);
|
R3.API.RenderConfiguration.prototype = Object.create(R3.API.Component.prototype);
|
||||||
R3.API.RenderConfiguration.prototype.constructor = R3.API.RenderConfiguration;
|
R3.API.RenderConfiguration.prototype.constructor = R3.API.RenderConfiguration;
|
||||||
|
|
||||||
R3.API.RenderConfiguration.ASPECT_RATIO_NONE = 0x1;
|
|
||||||
R3.API.RenderConfiguration.ASPECT_RATIO_4_3 = 0x2;
|
|
||||||
R3.API.RenderConfiguration.ASPECT_RATIO_3_2 = 0x3;
|
|
||||||
R3.API.RenderConfiguration.ASPECT_RATIO_16_10 = 0x4;
|
|
||||||
R3.API.RenderConfiguration.ASPECT_RATIO_17_10 = 0x5;
|
|
||||||
R3.API.RenderConfiguration.ASPECT_RATIO_16_9 = 0x6;
|
|
||||||
|
|
||||||
R3.API.RenderConfiguration.SCALE_MODE_NONE = 0x1;
|
|
||||||
R3.API.RenderConfiguration.SCALE_MODE_LETTERBOX = 0x2;
|
|
||||||
R3.API.RenderConfiguration.SCALE_MODE_ZOOM_TO_BIGGER = 0x3;
|
|
||||||
R3.API.RenderConfiguration.SCALE_MODE_NON_UNIFORM = 0x4;
|
|
||||||
|
|
||||||
R3.API.RenderConfiguration.DEFAULT_MODE_IN_GAME = 0x1;
|
|
||||||
R3.API.RenderConfiguration.DEFAULT_MODE_EDIT = 0x2;
|
|
||||||
|
|
|
@ -120,3 +120,15 @@ 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.ASPECT_RATIO_NONE = 0x1;
|
||||||
|
R3.API.Renderer.ASPECT_RATIO_4_3 = 0x2;
|
||||||
|
R3.API.Renderer.ASPECT_RATIO_3_2 = 0x3;
|
||||||
|
R3.API.Renderer.ASPECT_RATIO_16_10 = 0x4;
|
||||||
|
R3.API.Renderer.ASPECT_RATIO_17_10 = 0x5;
|
||||||
|
R3.API.Renderer.ASPECT_RATIO_16_9 = 0x6;
|
||||||
|
|
||||||
|
R3.API.Renderer.SCALE_MODE_NONE = 0x1;
|
||||||
|
R3.API.Renderer.SCALE_MODE_LETTERBOX = 0x2;
|
||||||
|
R3.API.Renderer.SCALE_MODE_ZOOM_TO_BIGGER = 0x3;
|
||||||
|
R3.API.Renderer.SCALE_MODE_NON_UNIFORM = 0x4;
|
||||||
|
|
|
@ -35,6 +35,14 @@
|
||||||
* @param viewports
|
* @param viewports
|
||||||
* @param alpha
|
* @param alpha
|
||||||
* @param opacity
|
* @param opacity
|
||||||
|
* @param logicalSize
|
||||||
|
* @param aspectRatio
|
||||||
|
* @param scaleMode
|
||||||
|
* @param scenes
|
||||||
|
* @param composers
|
||||||
|
* @param effects
|
||||||
|
* @param enableComposer
|
||||||
|
* @param enableEffects
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.API.Renderer.D3 = function (
|
R3.API.Renderer.D3 = function (
|
||||||
|
@ -72,7 +80,12 @@ R3.API.Renderer.D3 = function (
|
||||||
clearColor,
|
clearColor,
|
||||||
viewports,
|
viewports,
|
||||||
alpha,
|
alpha,
|
||||||
opacity
|
opacity,
|
||||||
|
scenes,
|
||||||
|
composers,
|
||||||
|
effect,
|
||||||
|
enableComposer,
|
||||||
|
enableEffect
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
if (R3.Utils.UndefinedOrNull(apiRenderer)) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ R3.D3.API.Object = function(
|
||||||
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE :
|
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE :
|
||||||
name = 'Camera Cube';
|
name = 'Camera Cube';
|
||||||
break;
|
break;
|
||||||
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_STEREO :
|
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE_STEREO :
|
||||||
name = 'Camera Stereo';
|
name = 'Camera Stereo';
|
||||||
break;
|
break;
|
||||||
/**
|
/**
|
||||||
|
@ -143,7 +143,7 @@ R3.D3.API.Object.GetComponentType = function(objectType) {
|
||||||
componentType = R3.Component.CAMERA_ORTHOGRAPHIC;
|
componentType = R3.Component.CAMERA_ORTHOGRAPHIC;
|
||||||
break;
|
break;
|
||||||
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_STEREO :
|
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_STEREO :
|
||||||
componentType = R3.Component.CAMERA_STEREO;
|
componentType = R3.Component.CAMERA_PERSPECTIVE_STEREO;
|
||||||
break;
|
break;
|
||||||
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE :
|
case R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE :
|
||||||
componentType = R3.Component.CAMERA_CUBE;
|
componentType = R3.Component.CAMERA_CUBE;
|
||||||
|
@ -173,11 +173,11 @@ R3.D3.API.Object.OBJECT_TYPE_NONE = 0x0;
|
||||||
* Cameras
|
* Cameras
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
R3.D3.API.Object.OBJECT_TYPE_CAMERA = 0x11;
|
R3.D3.API.Object.OBJECT_TYPE_CAMERA = 0x11;
|
||||||
R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE = 0x12;//0x1;
|
R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE = 0x12;//0x1;
|
||||||
R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC = 0x13;//0x2;
|
R3.D3.API.Object.OBJECT_TYPE_CAMERA_ORTHOGRAPHIC = 0x13;//0x2;
|
||||||
R3.D3.API.Object.OBJECT_TYPE_CAMERA_STEREO = 0x14;//0x3;
|
R3.D3.API.Object.OBJECT_TYPE_CAMERA_PERSPECTIVE_STEREO = 0x14;//0x3;
|
||||||
R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE = 0x15;//0x4;
|
R3.D3.API.Object.OBJECT_TYPE_CAMERA_CUBE = 0x15;//0x4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Meshes
|
* Meshes
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/**
|
|
||||||
* R3.D3.API.Camera.Stereo
|
|
||||||
* @constructor
|
|
||||||
* @param apiD3ObjectCamera
|
|
||||||
* @param stereoMode
|
|
||||||
*/
|
|
||||||
R3.D3.API.Camera.Stereo = function(
|
|
||||||
apiD3ObjectCamera,
|
|
||||||
stereoMode
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera)) {
|
|
||||||
apiD3ObjectCamera = {
|
|
||||||
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_STEREO
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectCamera.objectType)) {
|
|
||||||
apiD3ObjectCamera.objectType = R3.D3.API.Object.OBJECT_TYPE_CAMERA_STEREO;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(stereoMode)) {
|
|
||||||
stereoMode = R3.D3.API.Camera.Stereo.STEREO_MODE_STEREO;
|
|
||||||
}
|
|
||||||
this.stereoMode = stereoMode;
|
|
||||||
|
|
||||||
R3.D3.API.Camera.call(
|
|
||||||
this,
|
|
||||||
apiD3ObjectCamera,
|
|
||||||
apiD3ObjectCamera.aspect
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.D3.API.Camera.Stereo.prototype = Object.create(R3.D3.API.Camera.prototype);
|
|
||||||
R3.D3.API.Camera.Stereo.prototype.constructor = R3.D3.API.Camera.Stereo;
|
|
||||||
|
|
||||||
R3.D3.API.Camera.Stereo.STEREO_MODE_STEREO = 0x1;
|
|
||||||
R3.D3.API.Camera.Stereo.STEREO_MODE_ANAGLYPH = 0x2;
|
|
||||||
R3.D3.API.Camera.Stereo.STEREO_MODE_PARALLAX = 0x3;
|
|
|
@ -1,87 +0,0 @@
|
||||||
/**
|
|
||||||
* R3.D3.Camera.Stereo
|
|
||||||
* @param graphics R3.GraphicsRuntime
|
|
||||||
* @param apiD3ObjectStereoCamera
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
R3.D3.Camera.Stereo = function(
|
|
||||||
graphics,
|
|
||||||
apiD3ObjectStereoCamera
|
|
||||||
) {
|
|
||||||
|
|
||||||
this.graphics = graphics;
|
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (R3.Utils.UndefinedOrNull(apiD3ObjectStereoCamera)) {
|
|
||||||
apiD3ObjectStereoCamera = {
|
|
||||||
objectType : R3.D3.API.Object.OBJECT_TYPE_CAMERA_STEREO
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.D3.API.Camera.Stereo.call(
|
|
||||||
this,
|
|
||||||
apiD3ObjectStereoCamera,
|
|
||||||
apiD3ObjectStereoCamera.stereoMode
|
|
||||||
);
|
|
||||||
|
|
||||||
R3.D3.Camera.call(
|
|
||||||
this,
|
|
||||||
this.graphics,
|
|
||||||
this
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.D3.Camera.Stereo.prototype = Object.create(R3.D3.Camera.prototype);
|
|
||||||
R3.D3.Camera.Stereo.prototype.constructor = R3.D3.Camera.Stereo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a camera instance
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
R3.D3.Camera.Stereo.prototype.createInstance = function() {
|
|
||||||
|
|
||||||
this.instance = new THREE.PerspectiveCamera();
|
|
||||||
|
|
||||||
var instance = new THREE.StereoCamera();
|
|
||||||
|
|
||||||
for (var property in instance) {
|
|
||||||
if (
|
|
||||||
instance.hasOwnProperty(property) ||
|
|
||||||
typeof instance[property] === 'function'
|
|
||||||
) {
|
|
||||||
this.instance[property] = instance[property];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.D3.Camera.prototype.createInstance.call(this);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the instance with the current state
|
|
||||||
*/
|
|
||||||
R3.D3.Camera.Stereo.prototype.updateInstance = function(property) {
|
|
||||||
|
|
||||||
if (property === 'stereoMode') {
|
|
||||||
console.warn('todo: update stereo mode');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
R3.D3.Camera.prototype.updateInstance.call(this, property);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a R3.D3.Camera to a R3.D3.API.Camera
|
|
||||||
* @returns {R3.D3.API.Camera}
|
|
||||||
*/
|
|
||||||
R3.D3.Camera.Stereo.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiCamera = R3.D3.Camera.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
var apiStereoCamera = new R3.D3.API.Camera.Stereo(
|
|
||||||
apiCamera,
|
|
||||||
this.stereoMode
|
|
||||||
);
|
|
||||||
|
|
||||||
return apiStereoCamera;
|
|
||||||
};
|
|
|
@ -30,6 +30,20 @@ R3.Entity = function (
|
||||||
|
|
||||||
this.idRegister = {};
|
this.idRegister = {};
|
||||||
|
|
||||||
|
var components = [];
|
||||||
|
|
||||||
|
this.components.map(
|
||||||
|
function (component) {
|
||||||
|
if (component instanceof R3.API.Component) {
|
||||||
|
components.push(R3.Component.ConstructFromObject(component));
|
||||||
|
} else {
|
||||||
|
components.push(component)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this.components = components;
|
||||||
|
|
||||||
R3.Component.call(
|
R3.Component.call(
|
||||||
this,
|
this,
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
R3.System.Render = function(
|
R3.System.Render = function(
|
||||||
apiSystem,
|
apiSystem
|
||||||
graphicsRuntime
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
R3.System.call(
|
R3.System.call(
|
||||||
|
@ -14,36 +13,68 @@ R3.System.Render = function(
|
||||||
apiSystem
|
apiSystem
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.graphics = null;
|
||||||
|
|
||||||
|
R3.Event.Emit(
|
||||||
|
R3.Event.GET_RUNTIME,
|
||||||
|
function(runtime) {
|
||||||
|
this.graphics = runtime.graphics;
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (R3.Utils.UndefinedOrNull(this.graphics)) {
|
||||||
|
throw new Error('Need a graphics runtime in order to create a Render System');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.project = null;
|
||||||
|
|
||||||
|
R3.Event.Emit(
|
||||||
|
R3.Event.GET_PROJECT,
|
||||||
|
function(project) {
|
||||||
|
this.project = project;
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.clock = new R3.Clock(this.graphics);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the time delta sinc the last render
|
||||||
|
* @type {null}
|
||||||
|
*/
|
||||||
|
this.delta = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This hook stores a reference to the current render frame - so we can break out of the render loop if needed
|
||||||
|
* @type {null}
|
||||||
|
*/
|
||||||
|
this.animationFrameHook = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to some important events when this system starts
|
||||||
|
* @type {null}
|
||||||
|
*/
|
||||||
|
this.excludeFromEnvironmentSubscription = null;
|
||||||
|
|
||||||
|
this.instanceCreatedSubscription = null;
|
||||||
|
|
||||||
|
this.removeComponentSubscription = null;
|
||||||
|
|
||||||
this.renderSubscription = null;
|
this.renderSubscription = null;
|
||||||
|
|
||||||
this.replaceComponentSubscription = null;
|
this.replaceComponentSubscription = null;
|
||||||
|
|
||||||
this.clock = new R3.Clock(graphicsRuntime);
|
|
||||||
|
|
||||||
this.delta = null;
|
|
||||||
|
|
||||||
this.animationFrameHook = null;
|
|
||||||
|
|
||||||
this.activeRenderConfiguration = null;
|
|
||||||
|
|
||||||
this.excludeFromEnvironmentSubscription = null;
|
|
||||||
|
|
||||||
this.shaderUpdateSubscription = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Images
|
|
||||||
*/
|
|
||||||
this.textureUpdatedSubscription = null;
|
this.textureUpdatedSubscription = null;
|
||||||
|
|
||||||
this.renderConfigurations = [];
|
this.windowResizeSubscription = null;
|
||||||
|
|
||||||
this.renderers = [];
|
|
||||||
|
|
||||||
this.composers = [];
|
|
||||||
|
|
||||||
this.statistics = [];
|
this.statistics = [];
|
||||||
|
|
||||||
this.cubeCameras = [];
|
this.excludedFromEnvironment = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a handle on the project(s)
|
||||||
|
*/
|
||||||
|
this.projects = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.System.Render.prototype = Object.create(R3.System.prototype);
|
R3.System.Render.prototype = Object.create(R3.System.prototype);
|
||||||
|
@ -56,19 +87,46 @@ R3.System.Render.prototype.start = function() {
|
||||||
|
|
||||||
R3.System.prototype.start.call(this);
|
R3.System.prototype.start.call(this);
|
||||||
|
|
||||||
this.renderConfigurations = R3.EntityManager.Instance.queryComponents(R3.Component.RENDER_CONFIGURATION);
|
this.excludeFromEnvironmentSubscription = this.subscribe(
|
||||||
|
R3.Event.EXCLUDE_FROM_ENVIRONMENT,
|
||||||
|
this.excludeFromEnvironmentUpdate
|
||||||
|
);
|
||||||
|
|
||||||
this.renderers = R3.EntityManager.Instance.queryComponentsByConstructor(R3.Renderer);
|
this.instanceCreatedSubscription = this.subscribe(
|
||||||
|
R3.Event.INSTANCE_CREATED,
|
||||||
|
this.instanceCreated
|
||||||
|
);
|
||||||
|
|
||||||
this.composers = R3.EntityManager.Instance.queryComponents(R3.Component.COMPOSER);
|
this.removeComponentSubscription = this.subscribe(
|
||||||
|
R3.Event.REMOVE_COMPONENT,
|
||||||
|
this.removeComponent
|
||||||
|
);
|
||||||
|
|
||||||
|
this.renderSubscription = this.subscribe(
|
||||||
|
R3.Event.RENDER,
|
||||||
|
this.render
|
||||||
|
);
|
||||||
|
|
||||||
|
this.replaceComponentSubscription = this.subscribe(
|
||||||
|
R3.Event.REPLACE_COMPONENT,
|
||||||
|
this.replaceComponent
|
||||||
|
);
|
||||||
|
|
||||||
|
this.textureUpdatedSubscription = this.subscribe(
|
||||||
|
R3.Event.TEXTURE_INSTANCE_UPDATED,
|
||||||
|
this.textureUpdated
|
||||||
|
);
|
||||||
|
|
||||||
|
this.windowResizeSubscription = this.subscribe(
|
||||||
|
R3.Event.WINDOW_RESIZE,
|
||||||
|
this.windowResize
|
||||||
|
);
|
||||||
|
|
||||||
this.statistics = R3.EntityManager.Instance.queryComponents(R3.Component.STATS);
|
this.statistics = R3.EntityManager.Instance.queryComponents(R3.Component.STATS);
|
||||||
|
|
||||||
this.cubeCameras = R3.EntityManager.Instance.queryComponents(R3.Component.CAMERA_CUBE);
|
this.projects = R3.EntityManager.Instance.queryComponents(R3.Component.PROJECT);
|
||||||
|
|
||||||
this.arComponents = R3.EntityManager.Instance.queryComponents(R3.Component.AR);
|
this.excludedFromEnvironment = [];
|
||||||
|
|
||||||
this.excludedFromEnvironment = [];
|
|
||||||
|
|
||||||
R3.EntityManager.Instance.queryComponentsByConstructor(R3.D3.Mesh).map(
|
R3.EntityManager.Instance.queryComponentsByConstructor(R3.D3.Mesh).map(
|
||||||
function(mesh) {
|
function(mesh) {
|
||||||
|
@ -78,89 +136,9 @@ R3.System.Render.prototype.start = function() {
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.excludeFromEnvironmentSubscription = this.subscribe(
|
|
||||||
R3.Event.EXCLUDE_FROM_ENVIRONMENT,
|
|
||||||
this.excludeFromEnvironmentUpdate
|
|
||||||
);
|
|
||||||
|
|
||||||
this.instanceCreatedSubscription = R3.Event.Subscribe(
|
|
||||||
R3.Event.INSTANCE_CREATED,
|
|
||||||
this.instanceCreated.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.removeComponentSubscription = R3.Event.Subscribe(
|
|
||||||
R3.Event.REMOVE_COMPONENT,
|
|
||||||
this.removeComponent.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.replaceComponentSubscription = R3.Event.Subscribe(
|
|
||||||
R3.Event.REPLACE_COMPONENT,
|
|
||||||
this.replaceComponent.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.renderSubscription = this.subscribe(
|
|
||||||
R3.Event.RENDER,
|
|
||||||
this.render
|
|
||||||
);
|
|
||||||
|
|
||||||
this.windowResizeSubscription = this.subscribe(
|
|
||||||
R3.Event.WINDOW_RESIZE,
|
|
||||||
this.windowResize
|
|
||||||
);
|
|
||||||
|
|
||||||
this.textureUpdatedSubscription = this.subscribe(
|
|
||||||
R3.Event.TEXTURE_INSTANCE_UPDATED,
|
|
||||||
this.textureUpdated
|
|
||||||
);
|
|
||||||
|
|
||||||
this.getRenderConfigurationSubscription = this.subscribe(
|
|
||||||
R3.Event.GET_RENDER_CONFIGURATION,
|
|
||||||
this.getRenderConfiguration
|
|
||||||
);
|
|
||||||
|
|
||||||
this.setActiveRenderConfigurationSubscription = this.subscribe(
|
|
||||||
R3.Event.SET_ACTIVE_RENDER_CONFIGURATION,
|
|
||||||
this.setActiveRenderConfiguration
|
|
||||||
);
|
|
||||||
|
|
||||||
this.shaderUpdateSubscription = R3.Event.Subscribe(
|
|
||||||
R3.Event.SHADER_UPDATE,
|
|
||||||
this.shaderUpdate.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
// this.delayedInstanceEncounteredSubscription = R3.Event.Subscribe(
|
|
||||||
// R3.Event.DELAYED_INSTANCE_ENCOUNTERED,
|
|
||||||
// this.delayedInstanceEncountered.bind(this)
|
|
||||||
// );
|
|
||||||
|
|
||||||
// window.addEventListener(
|
|
||||||
// 'resize',
|
|
||||||
// this.nativeWindowResize,
|
|
||||||
// false
|
|
||||||
// );
|
|
||||||
|
|
||||||
// window.addEventListener(
|
|
||||||
// "orientationchangeend",
|
|
||||||
// this.nativeWindowResize,
|
|
||||||
// false
|
|
||||||
// );
|
|
||||||
|
|
||||||
// R3.Event.Emit(
|
|
||||||
// R3.Event.WINDOW_RESIZE,
|
|
||||||
// {
|
|
||||||
// width : window.screen.availWidth,
|
|
||||||
// height : window.screen.availHeight
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
|
|
||||||
this.run();
|
this.run();
|
||||||
|
|
||||||
};
|
};
|
||||||
//
|
|
||||||
// R3.System.Render.prototype.delayedInstanceEncountered = function() {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
|
|
||||||
R3.System.Render.prototype.run = function() {
|
R3.System.Render.prototype.run = function() {
|
||||||
|
|
||||||
|
@ -177,20 +155,6 @@ R3.System.Render.prototype.run = function() {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// R3.System.Render.prototype.nativeWindowResize = function() {
|
|
||||||
// R3.Event.Emit(
|
|
||||||
// R3.Event.WINDOW_RESIZE,
|
|
||||||
// {
|
|
||||||
// width : window.screen.availWidth,
|
|
||||||
// height : window.screen.availHeight
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
R3.System.Render.prototype.getRenderConfiguration = function (data, callback) {
|
|
||||||
callback(this.activeRenderConfiguration);
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.System.Render.prototype.excludeFromEnvironmentUpdate = function (data) {
|
R3.System.Render.prototype.excludeFromEnvironmentUpdate = function (data) {
|
||||||
|
|
||||||
if (data.component.excludeFromEnvironment) {
|
if (data.component.excludeFromEnvironment) {
|
||||||
|
@ -205,23 +169,6 @@ R3.System.Render.prototype.excludeFromEnvironmentUpdate = function (data) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
R3.System.Render.prototype.setActiveRenderConfiguration = function (data) {
|
|
||||||
|
|
||||||
if (this.renderConfigurations.indexOf(data.renderConfiguration) !== -1) {
|
|
||||||
this.activeRenderConfiguration = data.renderConfiguration;
|
|
||||||
} else {
|
|
||||||
console.warn('active render configuration not found in render system');
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.System.Render.prototype.getOffset = function (el) {
|
|
||||||
var rect = el.getBoundingClientRect(),
|
|
||||||
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
|
|
||||||
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
||||||
return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
|
|
||||||
};
|
|
||||||
|
|
||||||
R3.System.Render.prototype.windowResize = function(data) {
|
R3.System.Render.prototype.windowResize = function(data) {
|
||||||
|
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
|
@ -293,11 +240,11 @@ R3.System.Render.prototype.windowResize = function(data) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
R3.EntityManager.Instance.queryComponentsByConstructor(R3.AR).map(
|
// R3.EntityManager.Instance.queryComponentsByConstructor(R3.AR).map(
|
||||||
function(ar) {
|
// function(ar) {
|
||||||
ar.resize();
|
// ar.resize();
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
R3.Event.Emit(
|
R3.Event.Emit(
|
||||||
R3.Event.AFTER_WINDOW_RESIZE,
|
R3.Event.AFTER_WINDOW_RESIZE,
|
||||||
|
@ -305,19 +252,19 @@ R3.System.Render.prototype.windowResize = function(data) {
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
//
|
||||||
R3.System.Render.prototype.shaderUpdate = function(data) {
|
// R3.System.Render.prototype.shaderUpdate = function(data) {
|
||||||
|
//
|
||||||
this.activeRenderConfiguration.activeScenes.map(
|
// this.activeRenderConfiguration.activeScenes.map(
|
||||||
function(scene){
|
// function(scene){
|
||||||
this.activeRenderConfiguration.activeRenderer.instance.compile(
|
// this.activeRenderConfiguration.activeRenderer.instance.compile(
|
||||||
scene.instance,
|
// scene.instance,
|
||||||
this.activeRenderConfiguration.activeCamera.instance
|
// this.activeRenderConfiguration.activeCamera.instance
|
||||||
);
|
// );
|
||||||
}.bind(this)
|
// }.bind(this)
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
};
|
// };
|
||||||
|
|
||||||
R3.System.Render.prototype.textureUpdated = function(data) {
|
R3.System.Render.prototype.textureUpdated = function(data) {
|
||||||
|
|
||||||
|
@ -349,14 +296,14 @@ R3.System.Render.prototype.textureUpdated = function(data) {
|
||||||
*/
|
*/
|
||||||
R3.System.Render.prototype.instanceCreated = function(data) {
|
R3.System.Render.prototype.instanceCreated = function(data) {
|
||||||
|
|
||||||
if (data.component instanceof R3.RenderConfiguration) {
|
// if (data.component instanceof R3.RenderConfiguration) {
|
||||||
console.log('adding render configuration to render system');
|
// console.log('adding render configuration to render system');
|
||||||
this.renderConfigurations.push(data.component);
|
// this.renderConfigurations.push(data.component);
|
||||||
|
//
|
||||||
if (this.renderConfigurations.length === 1) {
|
// if (this.renderConfigurations.length === 1) {
|
||||||
this.activeRenderConfiguration = this.renderConfigurations[0];
|
// this.activeRenderConfiguration = this.renderConfigurations[0];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (data.component instanceof R3.Renderer) {
|
if (data.component instanceof R3.Renderer) {
|
||||||
console.log('adding renderer to render system');
|
console.log('adding renderer to render system');
|
||||||
|
@ -376,9 +323,9 @@ R3.System.Render.prototype.instanceCreated = function(data) {
|
||||||
this.cubeCameras.push(data.component);
|
this.cubeCameras.push(data.component);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.component instanceof R3.AR) {
|
// if (data.component instanceof R3.AR) {
|
||||||
this.arComponents.push(data.component);
|
// this.arComponents.push(data.component);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (
|
if (
|
||||||
data.component instanceof R3.D3.Mesh &&
|
data.component instanceof R3.D3.Mesh &&
|
||||||
|
@ -490,35 +437,35 @@ R3.System.Render.prototype.replaceComponent = function(data) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
// if (
|
||||||
data.current instanceof R3.Renderer &&
|
// data.current instanceof R3.Renderer &&
|
||||||
data.replacement instanceof R3.Renderer
|
// data.replacement instanceof R3.Renderer
|
||||||
) {
|
// ) {
|
||||||
data.replacement.canvas.remove();
|
// data.replacement.canvas.remove();
|
||||||
data.replacement.canvas = data.current.canvas;
|
// data.replacement.canvas = data.current.canvas;
|
||||||
data.current.canvas = null;
|
// data.current.canvas = null;
|
||||||
|
//
|
||||||
if (this.activeRenderConfiguration.activeRenderer === data.current) {
|
// if (this.activeRenderConfiguration.activeRenderer === data.current) {
|
||||||
this.activeRenderConfiguration.activeRenderer = data.replacement;
|
// this.activeRenderConfiguration.activeRenderer = data.replacement;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (this.activeRenderConfiguration.activeRenderer instanceof R3.Renderer.D2) {
|
// if (this.activeRenderConfiguration.activeRenderer instanceof R3.Renderer.D2) {
|
||||||
|
//
|
||||||
if (this.activeRenderConfiguration.activeCamera) {
|
// if (this.activeRenderConfiguration.activeCamera) {
|
||||||
this.activeRenderConfiguration.activeCamera.remove();
|
// this.activeRenderConfiguration.activeCamera.remove();
|
||||||
this.activeRenderConfiguration.activeCamera = null;
|
// this.activeRenderConfiguration.activeCamera = null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
this.activeRenderConfiguration.activeScenes.map(
|
// this.activeRenderConfiguration.activeScenes.map(
|
||||||
function(scene) {
|
// function(scene) {
|
||||||
scene.remove();
|
// scene.remove();
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
this.activeRenderConfiguration.activeScenes = [];
|
// this.activeRenderConfiguration.activeScenes = [];
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -529,27 +476,27 @@ R3.System.Render.prototype.removeComponent = function(data) {
|
||||||
|
|
||||||
var index;
|
var index;
|
||||||
|
|
||||||
if (data.component instanceof R3.RenderConfiguration) {
|
// if (data.component instanceof R3.RenderConfiguration) {
|
||||||
|
//
|
||||||
index = this.renderConfigurations.indexOf(data.component);
|
// index = this.renderConfigurations.indexOf(data.component);
|
||||||
|
//
|
||||||
if (index !== -1) {
|
// if (index !== -1) {
|
||||||
console.log('removing renderer configuration from system');
|
// console.log('removing renderer configuration from system');
|
||||||
|
//
|
||||||
this.renderConfigurations.splice(index, 1);
|
// this.renderConfigurations.splice(index, 1);
|
||||||
|
//
|
||||||
} else {
|
// } else {
|
||||||
console.log('failed to find the render configuration in the system : ' + data.component.name);
|
// console.log('failed to find the render configuration in the system : ' + data.component.name);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (this.renderConfigurations.length === 0) {
|
// if (this.renderConfigurations.length === 0) {
|
||||||
this.activeRenderConfiguration = null;
|
// this.activeRenderConfiguration = null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (this.renderConfigurations.length === 1) {
|
// if (this.renderConfigurations.length === 1) {
|
||||||
this.activeRenderConfiguration = this.renderConfigurations[0];
|
// this.activeRenderConfiguration = this.renderConfigurations[0];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (data.component instanceof R3.Renderer) {
|
if (data.component instanceof R3.Renderer) {
|
||||||
|
|
||||||
|
@ -607,19 +554,19 @@ R3.System.Render.prototype.removeComponent = function(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.component instanceof R3.AR) {
|
// if (data.component instanceof R3.AR) {
|
||||||
|
//
|
||||||
index = this.arComponents.indexOf(data.component);
|
// index = this.arComponents.indexOf(data.component);
|
||||||
|
//
|
||||||
if (index !== -1) {
|
// if (index !== -1) {
|
||||||
console.log('removing ar component from render system');
|
// console.log('removing ar component from render system');
|
||||||
|
//
|
||||||
this.arComponents.splice(index, 1);
|
// this.arComponents.splice(index, 1);
|
||||||
|
//
|
||||||
} else {
|
// } else {
|
||||||
console.log('failed to find the ar component in the render system : ' + data.component.name);
|
// console.log('failed to find the ar component in the render system : ' + data.component.name);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (data.component instanceof R3.D3.Mesh) {
|
if (data.component instanceof R3.D3.Mesh) {
|
||||||
index = this.excludedFromEnvironment.indexOf(data.component);
|
index = this.excludedFromEnvironment.indexOf(data.component);
|
||||||
|
@ -648,19 +595,40 @@ R3.System.Render.prototype.render = function(data) {
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
|
|
||||||
var configuration = this.activeRenderConfiguration;
|
// var configuration = this.activeRenderConfiguration;
|
||||||
|
//
|
||||||
|
// if (!configuration) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// var renderer = configuration.activeRenderer;
|
||||||
|
//
|
||||||
|
// if (renderer instanceof R3.Renderer.D2) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
if (!configuration) {
|
this.projects.map(
|
||||||
return;
|
function(project) {
|
||||||
}
|
|
||||||
|
|
||||||
var renderer = configuration.activeRenderer;
|
project.renderers.map(
|
||||||
|
function (renderer) {
|
||||||
|
|
||||||
if (renderer instanceof R3.Renderer.D2) {
|
var scenes = renderer.scenes;
|
||||||
return;
|
|
||||||
}
|
var camera = project.cameras[project.cameraIndex];
|
||||||
|
|
||||||
|
var effect = renderer.effect;
|
||||||
|
|
||||||
|
var composer = renderer.composer
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
var scenes = configuration.activeScenes;
|
|
||||||
|
|
||||||
var camera = configuration.activeCamera;
|
var camera = configuration.activeCamera;
|
||||||
|
|
||||||
|
@ -694,20 +662,20 @@ R3.System.Render.prototype.render = function(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var arComponent = null;
|
// var arComponent = null;
|
||||||
|
//
|
||||||
if (this.arComponents.length > 1) {
|
// if (this.arComponents.length > 1) {
|
||||||
console.warn('only one AR component supported at this time');
|
// console.warn('only one AR component supported at this time');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (this.arComponents.length === 1) {
|
// if (this.arComponents.length === 1) {
|
||||||
arComponent = this.arComponents[0];
|
// arComponent = this.arComponents[0];
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (arComponent) {
|
// if (arComponent) {
|
||||||
arComponent.instance.arScene.process();
|
// arComponent.instance.arScene.process();
|
||||||
}
|
// }
|
||||||
|
|
||||||
var resetAutoClear = false;
|
var resetAutoClear = false;
|
||||||
|
|
||||||
|
@ -838,62 +806,24 @@ R3.System.Render.prototype.stop = function() {
|
||||||
|
|
||||||
cancelAnimationFrame(this.animationFrameHook);
|
cancelAnimationFrame(this.animationFrameHook);
|
||||||
|
|
||||||
|
this.excludeFromEnvironmentSubscription.remove();
|
||||||
|
|
||||||
this.instanceCreatedSubscription.remove();
|
this.instanceCreatedSubscription.remove();
|
||||||
|
|
||||||
this.removeComponentSubscription.remove();
|
this.removeComponentSubscription.remove();
|
||||||
|
|
||||||
this.replaceComponentSubscription.remove();
|
|
||||||
|
|
||||||
this.renderSubscription.remove();
|
this.renderSubscription.remove();
|
||||||
|
|
||||||
this.getRenderConfigurationSubscription.remove();
|
this.replaceComponentSubscription.remove();
|
||||||
|
|
||||||
this.setActiveRenderConfigurationSubscription.remove();
|
|
||||||
|
|
||||||
this.excludeFromEnvironmentSubscription.remove();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Images
|
|
||||||
*/
|
|
||||||
this.textureUpdatedSubscription.remove();
|
this.textureUpdatedSubscription.remove();
|
||||||
|
|
||||||
this.shaderUpdateSubscription.remove();
|
|
||||||
|
|
||||||
// this.delayedInstanceEncounteredSubscription.remove();
|
|
||||||
|
|
||||||
// window.removeEventListener(
|
|
||||||
// 'resize',
|
|
||||||
// this.nativeWindowResize,
|
|
||||||
// false
|
|
||||||
// );
|
|
||||||
|
|
||||||
// window.removeEventListener(
|
|
||||||
// 'orientationchangeend',
|
|
||||||
// this.nativeWindowResize,
|
|
||||||
// false
|
|
||||||
// );
|
|
||||||
|
|
||||||
this.windowResizeSubscription.remove();
|
this.windowResizeSubscription.remove();
|
||||||
|
|
||||||
this.renderers.map(
|
|
||||||
function(renderer) {
|
|
||||||
if (renderer.statistics) {
|
|
||||||
renderer.statistics.resize();
|
|
||||||
renderer.canvas.instance.parentElement.removeChild(renderer.statistics.instance.dom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this.renderConfigurations = [];
|
|
||||||
|
|
||||||
this.renderers = [];
|
this.renderers = [];
|
||||||
|
|
||||||
this.composers = [];
|
|
||||||
|
|
||||||
this.statistics = [];
|
this.statistics = [];
|
||||||
|
|
||||||
this.cubeCameras = [];
|
this.excludedFromEnvironment = [];
|
||||||
|
|
||||||
this.arComponents = [];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue