diff --git a/.r3_history b/.r3_history index a18f784..da55a96 100644 --- a/.r3_history +++ b/.r3_history @@ -1,50 +1,52 @@ +r3 create R3 base ./ +r3 create Event base ./ +r3 create Graph base ./ +r3 create Node base ./ +r3 create Utils base ./ +r3 create R3Object object_base ./r3-object/ +r3 create Project object_extends R3Object ./r3-object/ r3 create Component component_base ./r3-component/ -r3 create ComponentCanvas component_extends ComponentDOM ./r3-component/ -r3 create ComponentDOM component_extends Component ./r3-component/ -r3 create ComponentGraphics component_extends Component ./r3-component/ -r3 create ComponentImage component_extends ComponentGraphics ./r3-component/ -r3 create ComponentInput component_extends Component ./r3-component/ -r3 create ComponentMaterial component_extends ComponentGraphics ./r3-component/ -r3 create ComponentMesh component_extends ComponentGraphics ./r3-component/ -r3 create ComponentTexture component_extends ComponentGraphics ./r3-component/ -r3 create ComponentTouch component_extends ComponentInput ./r3-component/ +r3 create ComponentCode component_extends Component ./r3-component/ RuntimeCode +r3 create ComponentCodeJS component_extends ComponentCode ./r3-component/ RuntimeCode +r3 create ComponentDOM component_extends Component ./r3-component/ RuntimeDOM +r3 create ComponentGraphics component_extends Component ./r3-component/ RuntimeGraphics +r3 create ComponentInput component_extends Component ./r3-component/ RuntimeDOM +r3 create ComponentDOMImage component_extends ComponentDOM ./r3-component/ RuntimeDOM +r3 create ComponentDOMCanvas component_extends ComponentDOM ./r3-component/ RuntimeDOM +r3 create ComponentGraphicsGeometry component_extends ComponentGraphics ./r3-component/ RuntimeGraphics +r3 create ComponentGraphicsImage component_extends ComponentGraphics ./r3-component/ RuntimeGraphics +r3 create ComponentGraphicsGeometryBuffer component_extends ComponentGraphicsGeometry ./r3-component/ RuntimeGraphics +r3 create ComponentGraphicsGeometryBufferPlane component_extends ComponentGraphicsGeometryBuffer ./r3-component/ RuntimeGraphics +r3 create ComponentGraphicsMaterial component_extends ComponentGraphics ./r3-component/ RuntimeGraphics +r3 create ComponentGraphicsMesh component_extends ComponentGraphics ./r3-component/ RuntimeGraphics +r3 create ComponentGraphicsTexture component_extends ComponentGraphics ./r3-component/ RuntimeGraphics +r3 create ComponentInputTouch component_extends ComponentInput ./r3-component/ RuntimeDOM r3 create Entity entity_base ./r3-entity/ r3 create EntitySlider entity_extends Entity ./r3-entity/ -r3 create Event base ./ -r3 create Project object_extends R3Object ./r3-object/ -r3 create R3 base ./ -r3 create RuntimeBullet runtime_extends RuntimePhysics ./r3-runtime/ -r3 create RuntimeCodeMirror runtime_extends RuntimeCoder ./r3-runtime/ +r3 create Runtime base ./r3-runtime/ +r3 create RuntimeAudio runtime_base ./r3-runtime/ +r3 create RuntimeAudioThree runtime_extends RuntimeAudio ./r3-runtime/ ClientSide +r3 create RuntimeCode runtime_base ./r3-runtime/ +r3 create RuntimeCodeJS runtime_extends RuntimeCode ./r3-runtime/ ClientServerSide Default r3 create RuntimeCoder runtime_base ./r3-runtime/ -r3 create RuntimeControlKit runtime_extends RuntimeGUI ./r3-runtime/ -r3 create RuntimeDOM runtime_base ./r3-runtime/ +r3 create RuntimeCoderCodeMirror runtime_extends RuntimeCoder ./r3-runtime/ ClientSide Default r3 create RuntimeGUI runtime_base ./r3-runtime/ +r3 create RuntimeGUIControlKit runtime_extends RuntimeGUI ./r3-runtime/ ClientSide Default +r3 create RuntimeDOM runtime_base ./r3-runtime/ +r3 create RuntimeDOMJS runtime_extends RuntimeDOM ./r3-runtime/ ServerSide Default +r3 create RuntimeDOMWeb runtime_extends RuntimeDOM ./r3-runtime/ ClientSide Default r3 create RuntimeGraphics runtime_base ./r3-runtime/ +r3 create RuntimeGraphicsThree runtime_extends RuntimeGraphics ./r3-runtime/ ClientSide Default r3 create RuntimePhysics runtime_base ./r3-runtime/ +r3 create RuntimePhysicsBullet runtime_extends RuntimePhysics ./r3-runtime/ ServerSide Default r3 create RuntimeSocket runtime_base ./r3-runtime/ r3 create RuntimeStatistics runtime_base ./r3-runtime/ -r3 create RuntimeStats runtime_extends RuntimeStatistics ./r3-runtime/ -r3 create RuntimeThree runtime_extends RuntimeGraphics ./r3-runtime/ +r3 create RuntimeStatisticsStats runtime_extends RuntimeStatistics ./r3-runtime/ ClientSide Default r3 create System system_base ./r3-system/ r3 create SystemDOM system_extends System ./r3-system/ r3 create SystemInput system_extends System ./r3-system/ r3 create SystemLinking system_extends System ./r3-system/ +r3 create SystemRender system_extends System ./r3-system/ r3 create SystemRuntime system_extends System ./r3-system/ r3 create SystemSocket system_extends System ./r3-system/ -r3 create Utils base ./ -r3 create SystemRender system_extends System ./r3-system/ -r3 create SystemStorage system_extends System ./r3-system/ -r3 create Runtime base ./r3-runtime/ -r3 create ComponentCode component_extends Component ./r3-component/ -r3 create R3Object object_base ./r3-object/ -r3 create ComponentMaterial component_extends Component ./r3-component/ -r3 create ComponentTexture component_extends Component ./r3-component/ -r3 create ComponentMesh component_extends Component ./r3-component/ -r3 create ComponentGeometry component_extends Component ./r3-component/ -r3 create ComponentBufferGeometry component_extends ComponentGeometry ./r3-component/ -r3 create ComponentPlaneGeometry component_extends ComponentBufferGeometry ./r3-component/ -r3 create Graph base ./ -r3 create Node base ./ -r3 create RuntimeJSDOM runtime_extends RuntimeDOM ./r3-runtime/ -r3 create RuntimeWebDOM runtime_extends RuntimeDOM ./r3-runtime/ -r3 create ComponentTest component_extends ComponentDOM ./r3-component/ RuntimeDOM +r3 create SystemStorage system_extends System ./r3-system/ diff --git a/dist/r3-node/index.js b/dist/r3-node/index.js index 656b40e..5aa7f26 100644 --- a/dist/r3-node/index.js +++ b/dist/r3-node/index.js @@ -1,6 +1,57 @@ +//GENERATED_IMPORTS_START const R3 = require('./r3.js'); +const System = require('./r3-system/'); +const Runtime = require('./r3-runtime/'); +const Event = require('./r3-event.js'); +const Graph = require('./r3-graph.js'); +const Node = require('./r3-node.js'); +const Utils = require('./r3-utils.js'); +const R3Object = require('./r3-object/'); +const Project = require('./r3-object/r3-project.js'); +const Entity = require('./r3-entity/'); +const Component = require('./r3-component/'); +//GENERATED_IMPORTS_END -R3.System.Linking.start(); -R3.System.Socket.start(); +//GENERATED_DEFINES_START +R3.System = System; +R3.Runtime = Runtime; +R3.Event = Event; +R3.Graph = Graph; +R3.Node = Node; +R3.Utils = Utils; +R3.Object = R3Object; +R3.Project = Project; +R3.Entity = Entity; +R3.Component = Component; +R3.JS = R3Object.Component.Code.JS; +R3.Canvas = R3Object.Component.DOM.Canvas; +R3.DOM = R3Object.Component.DOM; +R3.DOM.Image = R3Object.Component.DOM.Image; +R3.Plane = R3Object.Component.Graphics.Geometry.Buffer.Plane; +R3.Graphics = R3Object.Component.Graphics; +R3.Graphics.Image = R3Object.Component.Graphics.Image; +R3.Material = R3Object.Component.Graphics.Material; +R3.Mesh = R3Object.Component.Graphics.Mesh; +R3.Texture = R3Object.Component.Graphics.Texture; +R3.Touch = R3Object.Component.Input.Touch; +//GENERATED_DEFINES_END + +//CUSTOM_DEFINES_START +//CUSTOM_DEFINES_END + +//GENERATED_SOURCE_START +//GENERATED_SOURCE_END + +console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate); + +//GENERATED_SYSTEM_START +R3.System.DOM.Start(); +R3.System.Input.Start(); +R3.System.Linking.Start(); +R3.System.Render.Start(); +R3.System.Runtime.Start(); +R3.System.Socket.Start(); +R3.System.Storage.Start(); +//GENERATED_SYSTEM_END module.exports = R3; diff --git a/dist/r3-node/r3-component.js b/dist/r3-node/r3-component.js deleted file mode 100644 index 201c0d4..0000000 --- a/dist/r3-node/r3-component.js +++ /dev/null @@ -1,172 +0,0 @@ -const Event = require('r3-event'); -const Utils = require('r3-utils'); -const R3Object = require('r3-r3-object.js'); - -/** - - OPTIONS_START - runtime='default' - OPTIONS_END - - INSTANCE_OPTIONS_MAPPING_START - INSTANCE_OPTIONS_MAPPING_END - - LINKED_OBJECTS_START - LINKED_OBJECTS_END - - EXCLUDED_FROM_INSTANCE_OPTIONS_START - runtime - EXCLUDED_FROM_INSTANCE_OPTIONS_END - - **/ - -class Component extends R3Object { - - //CONSTRUCTOR_EXTENDS_TEMPLATE_START - constructor(options) { - - if (Utils.UndefinedOrNull(options)) { - options = {}; - } - - super(options); - - this.emit(Event.OBJECT_CREATED, this); - - //OPTIONS_INIT_START - if (typeof options === 'undefined') { - options = {}; - } - if (Utils.UndefinedOrNull(options.runtime)) { - options.runtime = 'default'; - } - //OPTIONS_INIT_END - - //CUSTOM_OPTIONS_INIT_START - //CUSTOM_OPTIONS_INIT_END - - Object.assign(this, options); - - //CUSTOM_BEFORE_INIT_START - this.emit(Event.COMPONENT_INITIALIZED, this); - //CUSTOM_BEFORE_INIT_END - - this.emit(Event.OBJECT_INITIALIZED, this); - } - //CONSTRUCTOR_EXTENDS_TEMPLATE_END - - //CREATE_INSTANCE_TEMPLATE_START - createInstance() { - - //CREATE_INSTANCE_BEFORE_START - this.emit(Event.CREATE_INSTANCE_BEFORE, this); - //CREATE_INSTANCE_BEFORE_END - - //CUSTOM_CREATE_INSTANCE_START - //CUSTOM_CREATE_INSTANCE_END - - //CREATE_INSTANCE_AFTER_START - this[this.runtime].createInstance( - this, - { - //CREATE_INSTANCE_OPTIONS_START - //CREATE_INSTANCE_OPTIONS_END - } - ) - - this.emit(Event.INSTANCE_CREATED, this); - //CREATE_INSTANCE_AFTER_END - - } - //CREATE_INSTANCE_TEMPLATE_END - - //UPDATE_INSTANCE_TEMPLATE_START - updateInstance(property) { - - //UPDATE_INSTANCE_BEFORE_START - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - //UPDATE_INSTANCE_BEFORE_END - - //UPDATE_INSTANCE_OPTIONS_START - //UPDATE_INSTANCE_OPTIONS_END - - //CUSTOM_UPDATE_INSTANCE_START - //CUSTOM_UPDATE_INSTANCE_END - - //UPDATE_INSTANCE_AFTER_START - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - //UPDATE_INSTANCE_AFTER_END - - } - //UPDATE_INSTANCE_TEMPLATE_END - - //UPDATE_FROM_INSTANCE_TEMPLATE_START - updateFromInstance(property) { - - //UPDATE_FROM_INSTANCE_BEFORE_START - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - //UPDATE_FROM_INSTANCE_BEFORE_END - - //UPDATE_FROM_INSTANCE_OPTIONS_START - //UPDATE_FROM_INSTANCE_OPTIONS_END - - //CUSTOM_UPDATE_FROM_INSTANCE_START - //CUSTOM_UPDATE_FROM_INSTANCE_END - - //UPDATE_FROM_INSTANCE_AFTER_START - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - //UPDATE_FROM_INSTANCE_AFTER_END - - } - //UPDATE_FROM_INSTANCE_TEMPLATE_END - - //DISPOSE_TEMPLATE_START - dispose() { - - //DISPOSE_BEFORE_START - this.subscribe( - Event.INSTANCE_DISPOSED, - function(object) { - if (object === this) { - this.emit(Event.DISPOSE_OBJECT, this); - } - } - ); - //DISPOSE_BEFORE_END - - //CUSTOM_DISPOSE_START - //CUSTOM_DISPOSE_END - - //DISPOSE_AFTER_START - this.disposeInstance(); - //DISPOSE_AFTER_END - - } - //DISPOSE_TEMPLATE_END - - //DISPOSE_INSTANCE_TEMPLATE_START - disposeInstance() { - - //DISPOSE_INSTANCE_BEFORE_START - console.log('Disposing instance of ' + this.name); - //DISPOSE_INSTANCE_BEFORE_END - - //CUSTOM_DISPOSE_INSTANCE_START - //CUSTOM_DISPOSE_INSTANCE_END - - //DISPOSE_INSTANCE_AFTER_START - this.emit(Event.DISPOSE_INSTANCE, this); - //DISPOSE_INSTANCE_AFTER_END - - } - //DISPOSE_INSTANCE_TEMPLATE_END - - //CUSTOM_IMPLEMENTATION_START - //CUSTOM_IMPLEMENTATION_END - -} - -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END - -module.exports = Component; \ No newline at end of file diff --git a/dist/r3-node/r3-event.js b/dist/r3-node/r3-event.js index de8d73d..1ee7b02 100644 --- a/dist/r3-node/r3-event.js +++ b/dist/r3-node/r3-event.js @@ -1,24 +1,62 @@ -const Utils = require('r3-utils'); +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +const Utils = require('./r3-utils.js'); +//CUSTOM_IMPORTS_END /** - OPTIONS_START - OPTIONS_END + GENERATED_INHERITED_START + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_METHODS_START + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments + emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments + subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the error as argument. + Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after the event result is obtained, passing it the result. If an exception occurs during execution, the clientErrorCallback is called with the error as argument. + Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised @return {Object} - A handle to the subscription which can be removed by calling handle.remove() + CUSTOM_STATIC_METHODS_END **/ class Event { - //CONSTRUCTOR_TEMPLATE_START + //GENERATED_CONSTRUCTOR_START constructor(options) { - Event.Emit(Event.OBJECT_CREATED, this); - - //OPTIONS_INIT_START if (typeof options === 'undefined') { - options = {}; + options = {}; } - //OPTIONS_INIT_END + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END //CUSTOM_OPTIONS_INIT_START //CUSTOM_OPTIONS_INIT_END @@ -28,150 +66,130 @@ class Event { //CUSTOM_BEFORE_INIT_START //CUSTOM_BEFORE_INIT_END - Event.Emit(Event.OBJECT_INITIALIZED, this); + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END } - //CONSTRUCTOR_TEMPLATE_END + //GENERATED_CONSTRUCTOR_END - //CUSTOM_IMPLEMENTATION_START + //GENERATED_TEMPLATE_METHODS_START + //GENERATED_TEMPLATE_METHODS_END - /** - * Some nice Events handling - * @type {{}} - */ - static Subscriptions = {}; + //GENERATED_METHODS_START - static Subscribe( - eventName, - fn - ) { - /** - * Todo - maybe eventually store a boolean which indicates if the function has been executed - */ - let subscriptionId = Utils.RandomId(10); + /** + * async() + * - Simply calls 'Async()' passing it the arguments + * @param eventId + * @param data + * @param clientCallback + * @param clientErrorCallback + */ + async( + eventId, + data, + clientCallback, + clientErrorCallback + ) { - if (Event.Subscriptions.hasOwnProperty(eventName)) { + //GENERATED_ASYNC_METHOD_START + //GENERATED_ASYNC_METHOD_END - if (Event.Subscriptions[eventName][subscriptionId]) { - throw new Error('A component can only subscribe to a particular event ID once'); - } - - Event.Subscriptions[eventName][subscriptionId] = fn; - } else { - Event.Subscriptions[eventName] = {}; - Event.Subscriptions[eventName][subscriptionId] = fn; - } - - /** - * Return a handle to the caller to allow us to unsubscribe to this event - */ - return { - fn: fn, - remove: function (eventId, subscriptionId) { - - return function () { - - /** - * Stop listening for this event from this component - */ - delete Event.Subscriptions[eventId][subscriptionId]; - - /** - * If the length of listeners is 0, stop referencing this event - * @type {string[]} - */ - let listeners = Object.keys(Event.Subscriptions[eventId]); - if (listeners.length === 0) { - delete Event.Subscriptions[eventId]; - } - } - - }(eventName, subscriptionId), - subscriptionId : subscriptionId - }; - }; - - /** - * Subscribe to some events - * @param eventName - * @param callback - */ - subscribe( - eventName, - callback - ) { - return Event.Subscribe(eventName, callback.bind(this)); - }; - - /** - * Static Synchronous Event - Calls clientCallback directly after the event result is obtained - * @param eventId - * @param data - * @param clientCallback is executed ideally when the event completed - * @param clientErrorCallback - * @returns {number} of callbacks executed - * @constructor - */ - static Emit( - eventId, - data, - clientCallback, - clientErrorCallback - ) { - if (Event.Subscriptions.hasOwnProperty(eventId)) { - - let subscriptionIds = Object.keys(Event.Subscriptions[eventId]); - - subscriptionIds.map( - function(subscriptionId) { - try { - let result = Event.Subscriptions[eventId][subscriptionId](data); - - if (clientCallback) { - clientCallback(result); - } - } catch (error) { - if (clientErrorCallback) { - clientErrorCallback(error); - } else { - console.error(error); - throw error; - } - } - } - ) - } - } - - emit( - eventName, - data, - clientCallback, - clientErrorCallback - ) { - return Event.Emit( - eventName, + //CUSTOM_ASYNC_METHOD_START + return Event.Async( + eventId, data, clientCallback, clientErrorCallback ); - } + //CUSTOM_ASYNC_METHOD_END - /** - * Execute the functions which subscribe to this event, but don't process the client callback - the subscription function - * should execute the client callback - * @param eventId - * @param data - * @param clientCallback - * @param clientErrorCallback - * @returns {number} - * @constructor - */ - static Async( - eventId, - data, - clientCallback, - clientErrorCallback - ) { + //GENERATED_ASYNC_METHOD_AFTER_START + //GENERATED_ASYNC_METHOD_AFTER_END + + } + + /** + * emit() + * - Simply calls 'Emit()' passing it the arguments + * @param eventId + * @param data + * @param clientCallback + * @param clientErrorCallback + */ + emit( + eventId, + data, + clientCallback, + clientErrorCallback + ) { + + //GENERATED_EMIT_METHOD_START + //GENERATED_EMIT_METHOD_END + + //CUSTOM_EMIT_METHOD_START + return Event.Emit( + eventId, + data, + clientCallback, + clientErrorCallback + ); + //CUSTOM_EMIT_METHOD_END + + //GENERATED_EMIT_METHOD_AFTER_START + //GENERATED_EMIT_METHOD_AFTER_END + + } + + /** + * subscribe() + * - Simply calls 'Subscribe()' passing it the arguments + * @param eventId + * @param callback + */ + subscribe( + eventId, + callback + ) { + + //GENERATED_SUBSCRIBE_METHOD_START + //GENERATED_SUBSCRIBE_METHOD_END + + //CUSTOM_SUBSCRIBE_METHOD_START + return Event.Subscribe(eventId, callback.bind(this)); + //CUSTOM_SUBSCRIBE_METHOD_END + + //GENERATED_SUBSCRIBE_METHOD_AFTER_START + //GENERATED_SUBSCRIBE_METHOD_AFTER_END + + } + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + + /** + * Async() + * - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + * arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + * error as argument. + * @param eventId + * @param data + * @param clientCallback + * @param clientErrorCallback + */ + static Async( + eventId, + data, + clientCallback, + clientErrorCallback + ) { + + //GENERATED_STATIC_ASYNC_METHOD_START + //GENERATED_STATIC_ASYNC_METHOD_END + + //CUSTOM_STATIC_ASYNC_METHOD_START if (Event.Subscriptions.hasOwnProperty(eventId)) { let subscriptionIds = Object.keys(Event.Subscriptions[eventId]); @@ -191,60 +209,260 @@ class Event { } ) } - }; + //CUSTOM_STATIC_ASYNC_METHOD_END + + } + + /** + * Emit() + * - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + * the event result is obtained, passing it the result. If an exception occurs during execution, the + * clientErrorCallback is called with the error as argument. + * @param eventId + * @param data + * @param clientCallback + * @param clientErrorCallback + */ + static Emit( + eventId, + data, + clientCallback, + clientErrorCallback + ) { + + //GENERATED_STATIC_EMIT_METHOD_START + //GENERATED_STATIC_EMIT_METHOD_END + + //CUSTOM_STATIC_EMIT_METHOD_START + if (Event.Subscriptions.hasOwnProperty(eventId)) { + + let subscriptionIds = Object.keys(Event.Subscriptions[eventId]); + + subscriptionIds.map( + function(subscriptionId) { + try { + + let result = Event.Subscriptions[eventId][subscriptionId](data); + + if (clientCallback) { + clientCallback(result); + } + + } catch (error) { + + if (clientErrorCallback) { + clientErrorCallback(error); + } else { + console.error(error); + throw error; + } + + } + } + ) + } else { + if (clientCallback) { + clientCallback(); + } + } + + //CUSTOM_STATIC_EMIT_METHOD_END + + } + + /** + * Subscribe() + * - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + * @param eventId + * @param callback + * @returns {Object} - A handle to the subscription which can be removed by calling handle.remove() + */ + static Subscribe( + eventId, + callback + ) { + + //GENERATED_STATIC_SUBSCRIBE_METHOD_START + //GENERATED_STATIC_SUBSCRIBE_METHOD_END + + //CUSTOM_STATIC_SUBSCRIBE_METHOD_START + let subscriptionId = Utils.RandomId(10); + + if (Event.Subscriptions.hasOwnProperty(eventId)) { + + if (Event.Subscriptions[eventId][subscriptionId]) { + throw new Error('A component can only subscribe to a particular event ID once'); + } + + Event.Subscriptions[eventId][subscriptionId] = callback; + + } else { + Event.Subscriptions[eventId] = {}; + Event.Subscriptions[eventId][subscriptionId] = callback; + } + + /** + * Return a handle to the caller to allow us to unsubscribe to this event + */ + return { + fn: callback, + remove: function (eventId, subscriptionId) { + + return function () { + + /** + * Stop listening for this event from this component + */ + delete Event.Subscriptions[eventId][subscriptionId]; + + /** + * If the length of listeners is 0, stop referencing this event + * @type {string[]} + */ + let listeners = Object.keys(Event.Subscriptions[eventId]); + if (listeners.length === 0) { + delete Event.Subscriptions[eventId]; + } + + return true; + } + + }(eventId, subscriptionId), + subscriptionId : subscriptionId + }; + //CUSTOM_STATIC_SUBSCRIBE_METHOD_END + + } + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + + /** + * Some nice Events handling + * @type {{}} + */ + static Subscriptions = {}; + //CUSTOM_IMPLEMENTATION_END } +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START -//EVENT_GENERATED_START -Event.COMPONENT_INITIALIZED = 0x1; -Event.CREATE_INSTANCE_BEFORE = 0x2; -Event.DISPOSE_INSTANCE = 0x3; -Event.DISPOSE_OBJECT = 0x4; -Event.GET_RUNTIME = 0x5; -Event.GET_WINDOW_SIZE = 0x6; -Event.INSTANCE_CREATED = 0x7; -Event.INSTANCE_DISPOSED = 0x8; -Event.OBJECT_CREATED = 0x9; -Event.OBJECT_INITIALIZED = 0xa; -Event.PAUSE = 0xb; -Event.RESTART = 0xc; -Event.START = 0xd; -Event.UPDATE_FROM_INSTANCE_AFTER = 0xe; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0xf; -Event.UPDATE_INSTANCE_AFTER = 0x10; -Event.UPDATE_INSTANCE_BEFORE = 0x11; -Event.MAX_EVENTS = 0x12; +//GENERATED_EVENTS_START +Event.BEFORE_RENDER = 0x1; +Event.BLACKLISTED_COMPONENT_INSTANCE_REQUEST = 0x2; +Event.COMPONENT_CREATED = 0x3; +Event.COMPONENT_INITIALIZED = 0x4; +Event.CREATE_INSTANCE_BEFORE = 0x5; +Event.DISPOSE_INSTANCE = 0x6; +Event.DISPOSE_OBJECT = 0x7; +Event.DOM_COMPONENT_INITIALIZED = 0x8; +Event.ENTITY_CREATED = 0x9; +Event.ENTITY_INITIALIZED = 0xa; +Event.ENTITY_STARTED = 0xb; +Event.FINAL_INITIALIZE = 0xc; +Event.GET_API_URL = 0xd; +Event.GET_RUNTIME = 0xe; +Event.GET_WINDOW_SIZE = 0xf; +Event.GRAPHICS_COMPONENT_INITIALIZED = 0x10; +Event.IMAGE_INSTANCE_CREATED = 0x11; +Event.INPUT_COMPONENT_INITIALIZED = 0x12; +Event.INSTANCE_CREATED = 0x13; +Event.INSTANCE_DISPOSED = 0x14; +Event.KEYBOARD_DOWN = 0x15; +Event.KEYBOARD_UP = 0x16; +Event.MOUSE_DOWN = 0x17; +Event.MOUSE_MOVE = 0x18; +Event.MOUSE_UP = 0x19; +Event.MOUSE_WHEEL = 0x1a; +Event.OBJECT_CREATED = 0x1b; +Event.OBJECT_PROPERTY_UPDATE = 0x1c; +Event.OBJECT_PROPERTY_UPDATED = 0x1d; +Event.ON_READY_STATE_CHANGE = 0x1e; +Event.PAUSE = 0x1f; +Event.PROJECT_INITIALIZED = 0x20; +Event.RESTART = 0x21; +Event.RUNTIME_CREATED = 0x22; +Event.SLIDER_ENTITY_INITIALIZED = 0x23; +Event.START = 0x24; +Event.TOUCH_CANCEL = 0x25; +Event.TOUCH_END = 0x26; +Event.TOUCH_MOVE = 0x27; +Event.TOUCH_START = 0x28; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x29; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x2a; +Event.UPDATE_INSTANCE_AFTER = 0x2b; +Event.UPDATE_INSTANCE_BEFORE = 0x2c; +Event.UPDATE_INSTANCE_PROPERTY = 0x2d; +Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2e; +Event.MAX_EVENTS = 0x2f; Event.GetEventName = function(eventId) { switch(eventId) { - case 0x1 : return 'component_initialized'; - case 0x2 : return 'create_instance_before'; - case 0x3 : return 'dispose_instance'; - case 0x4 : return 'dispose_object'; - case 0x5 : return 'get_runtime'; - case 0x6 : return 'get_window_size'; - case 0x7 : return 'instance_created'; - case 0x8 : return 'instance_disposed'; - case 0x9 : return 'object_created'; - case 0xa : return 'object_initialized'; - case 0xb : return 'pause'; - case 0xc : return 'restart'; - case 0xd : return 'start'; - case 0xe : return 'update_from_instance_after'; - case 0xf : return 'update_from_instance_before'; - case 0x10 : return 'update_instance_after'; - case 0x11 : return 'update_instance_before'; + case 0x1 : return 'before_render'; + case 0x2 : return 'blacklisted_component_instance_request'; + case 0x3 : return 'component_created'; + case 0x4 : return 'component_initialized'; + case 0x5 : return 'create_instance_before'; + case 0x6 : return 'dispose_instance'; + case 0x7 : return 'dispose_object'; + case 0x8 : return 'dom_component_initialized'; + case 0x9 : return 'entity_created'; + case 0xa : return 'entity_initialized'; + case 0xb : return 'entity_started'; + case 0xc : return 'final_initialize'; + case 0xd : return 'get_api_url'; + case 0xe : return 'get_runtime'; + case 0xf : return 'get_window_size'; + case 0x10 : return 'graphics_component_initialized'; + case 0x11 : return 'image_instance_created'; + case 0x12 : return 'input_component_initialized'; + case 0x13 : return 'instance_created'; + case 0x14 : return 'instance_disposed'; + case 0x15 : return 'keyboard_down'; + case 0x16 : return 'keyboard_up'; + case 0x17 : return 'mouse_down'; + case 0x18 : return 'mouse_move'; + case 0x19 : return 'mouse_up'; + case 0x1a : return 'mouse_wheel'; + case 0x1b : return 'object_created'; + case 0x1c : return 'object_property_update'; + case 0x1d : return 'object_property_updated'; + case 0x1e : return 'on_ready_state_change'; + case 0x1f : return 'pause'; + case 0x20 : return 'project_initialized'; + case 0x21 : return 'restart'; + case 0x22 : return 'runtime_created'; + case 0x23 : return 'slider_entity_initialized'; + case 0x24 : return 'start'; + case 0x25 : return 'touch_cancel'; + case 0x26 : return 'touch_end'; + case 0x27 : return 'touch_move'; + case 0x28 : return 'touch_start'; + case 0x29 : return 'update_from_instance_after'; + case 0x2a : return 'update_from_instance_before'; + case 0x2b : return 'update_instance_after'; + case 0x2c : return 'update_instance_before'; + case 0x2d : return 'update_instance_property'; + case 0x2e : return 'update_property_from_instance'; default : throw new Error('Event type not defined : ' + eventId); } }; -//EVENT_GENERATED_END +//GENERATED_EVENTS_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = Event; \ No newline at end of file +module.exports = Event; diff --git a/dist/r3-node/r3-project.js b/dist/r3-node/r3-project.js deleted file mode 100644 index 87ff87f..0000000 --- a/dist/r3-node/r3-project.js +++ /dev/null @@ -1,209 +0,0 @@ -const Event = require('r3-event'); -const Utils = require('r3-utils'); -const R3Object = require('r3-r3-object.js'); - -/** - - OPTIONS_START - isPublic=true - applicationMode=Project.APPLICATION_MODE_EDIT - OPTIONS_END - - INSTANCE_OPTIONS_MAPPING_START - INSTANCE_OPTIONS_MAPPING_END - - LINKED_OBJECTS_START - entities=[Entity] - controls=[Control] - images=[Image] - code=[CustomCode] - LINKED_OBJECTS_END - - EXCLUDED_FROM_INSTANCE_OPTIONS_START - EXCLUDED_FROM_INSTANCE_OPTIONS_END - - **/ - -class Project extends R3Object { - - //CONSTRUCTOR_EXTENDS_TEMPLATE_START - constructor(options) { - - if (Utils.UndefinedOrNull(options)) { - options = {}; - } - - super(options); - - this.emit(Event.OBJECT_CREATED, this); - - //OPTIONS_INIT_START - if (typeof options === 'undefined') { - options = {}; - } - if (Utils.UndefinedOrNull(options.isPublic)) { - options.isPublic = true; - } - if (Utils.UndefinedOrNull(options.applicationMode)) { - options.applicationMode = Project.APPLICATION_MODE_EDIT; - } - //OPTIONS_INIT_END - - //CUSTOM_OPTIONS_INIT_START - //CUSTOM_OPTIONS_INIT_END - - Object.assign(this, options); - - //CUSTOM_BEFORE_INIT_START - //CUSTOM_BEFORE_INIT_END - - this.emit(Event.OBJECT_INITIALIZED, this); - } - //CONSTRUCTOR_EXTENDS_TEMPLATE_END - - //CREATE_INSTANCE_TEMPLATE_START - createInstance() { - - //CREATE_INSTANCE_BEFORE_START - this.emit(Event.CREATE_INSTANCE_BEFORE, this); - //CREATE_INSTANCE_BEFORE_END - - //CUSTOM_CREATE_INSTANCE_START - //CUSTOM_CREATE_INSTANCE_END - - //CREATE_INSTANCE_AFTER_START - this[this.runtime].createInstance( - this, - { - //CREATE_INSTANCE_OPTIONS_START - 'isPublic': this.isPublic, - 'applicationMode': this.applicationMode - //CREATE_INSTANCE_OPTIONS_END - } - ) - - this.emit(Event.INSTANCE_CREATED, this); - //CREATE_INSTANCE_AFTER_END - - } - //CREATE_INSTANCE_TEMPLATE_END - - //UPDATE_INSTANCE_TEMPLATE_START - updateInstance(property) { - - //UPDATE_INSTANCE_BEFORE_START - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - //UPDATE_INSTANCE_BEFORE_END - - //UPDATE_INSTANCE_OPTIONS_START - if (property === 'isPublic') { - this.instance.isPublic = this.isPublic; - return; - } - if (property === 'applicationMode') { - this.instance.applicationMode = this.applicationMode; - return; - } - //UPDATE_INSTANCE_OPTIONS_END - - //CUSTOM_UPDATE_INSTANCE_START - //CUSTOM_UPDATE_INSTANCE_END - - //UPDATE_INSTANCE_AFTER_START - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - //UPDATE_INSTANCE_AFTER_END - - } - //UPDATE_INSTANCE_TEMPLATE_END - - //UPDATE_FROM_INSTANCE_TEMPLATE_START - updateFromInstance(property) { - - //UPDATE_FROM_INSTANCE_BEFORE_START - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - //UPDATE_FROM_INSTANCE_BEFORE_END - - //UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'isPublic' || property === 'all') { - this.isPublic = this.instance.isPublic; - if (property !== 'all') { - return; - } - } - if (property === 'applicationMode' || property === 'all') { - this.applicationMode = this.instance.applicationMode; - if (property !== 'all') { - return; - } - } - //UPDATE_FROM_INSTANCE_OPTIONS_END - - //CUSTOM_UPDATE_FROM_INSTANCE_START - //CUSTOM_UPDATE_FROM_INSTANCE_END - - //UPDATE_FROM_INSTANCE_AFTER_START - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - //UPDATE_FROM_INSTANCE_AFTER_END - - } - //UPDATE_FROM_INSTANCE_TEMPLATE_END - - //DISPOSE_TEMPLATE_START - dispose() { - - //DISPOSE_BEFORE_START - this.subscribe( - Event.INSTANCE_DISPOSED, - function(object) { - if (object === this) { - this.emit(Event.DISPOSE_OBJECT, this); - } - } - ); - //DISPOSE_BEFORE_END - - //CUSTOM_DISPOSE_START - //CUSTOM_DISPOSE_END - - //DISPOSE_AFTER_START - this.disposeInstance(); - //DISPOSE_AFTER_END - - } - //DISPOSE_TEMPLATE_END - - //DISPOSE_INSTANCE_TEMPLATE_START - disposeInstance() { - - //DISPOSE_INSTANCE_BEFORE_START - console.log('Disposing instance of ' + this.name); - //DISPOSE_INSTANCE_BEFORE_END - - //CUSTOM_DISPOSE_INSTANCE_START - //CUSTOM_DISPOSE_INSTANCE_END - - //DISPOSE_INSTANCE_AFTER_START - this.emit(Event.DISPOSE_INSTANCE, this); - //DISPOSE_INSTANCE_AFTER_END - - } - //DISPOSE_INSTANCE_TEMPLATE_END - - //CUSTOM_IMPLEMENTATION_START - //CUSTOM_IMPLEMENTATION_END - -} - -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START -Project.CAMERA_INDEX_EDIT = 0x0; -Project.CAMERA_INDEX_RUN = 0x1; - -Project.APPLICATION_MODE_EDIT = Project.CAMERA_INDEX_EDIT; -Project.APPLICATION_MODE_RUN = Project.CAMERA_INDEX_RUN; - -Project.RENDERER_INDEX_MAIN = 0x0; - -Project.RENDER_TARGET_INDEX_NONE = -0x1; -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END - -module.exports = Project; \ No newline at end of file diff --git a/dist/r3-node/r3-r3-object.js b/dist/r3-node/r3-r3-object.js deleted file mode 100644 index 9dc48aa..0000000 --- a/dist/r3-node/r3-r3-object.js +++ /dev/null @@ -1,180 +0,0 @@ -const Utils = require('r3-utils'); -const Event = require('r3-event.js'); - -/** - - OPTIONS_START - id=Utils.RandomId(10) - name=this.constructor.name + '(' + options.id + ')' - register=true - OPTIONS_END - - INSTANCE_OPTIONS_MAPPING_START - INSTANCE_OPTIONS_MAPPING_END - - LINKED_OBJECTS_START - LINKED_OBJECTS_END - - EXCLUDED_FROM_INSTANCE_OPTIONS_START - id - name - register - EXCLUDED_FROM_INSTANCE_OPTIONS_END - - **/ - -class R3Object extends Event { - - //CONSTRUCTOR_EXTENDS_TEMPLATE_START - constructor(options) { - - if (Utils.UndefinedOrNull(options)) { - options = {}; - } - - super(options); - - this.emit(Event.OBJECT_CREATED, this); - - //OPTIONS_INIT_START - if (typeof options === 'undefined') { - options = {}; - } - if (Utils.UndefinedOrNull(options.id)) { - options.id = Utils.RandomId(10); - } - if (Utils.UndefinedOrNull(options.name)) { - options.name = this.constructor.name + '(' + options.id + ')'; - } - if (Utils.UndefinedOrNull(options.register)) { - options.register = true; - } - //OPTIONS_INIT_END - - //CUSTOM_OPTIONS_INIT_START - //CUSTOM_OPTIONS_INIT_END - - Object.assign(this, options); - - //CUSTOM_BEFORE_INIT_START - //CUSTOM_BEFORE_INIT_END - - this.emit(Event.OBJECT_INITIALIZED, this); - } - //CONSTRUCTOR_EXTENDS_TEMPLATE_END - - //CREATE_INSTANCE_TEMPLATE_START - createInstance() { - - //CREATE_INSTANCE_BEFORE_START - this.emit(Event.CREATE_INSTANCE_BEFORE, this); - //CREATE_INSTANCE_BEFORE_END - - //CUSTOM_CREATE_INSTANCE_START - //CUSTOM_CREATE_INSTANCE_END - - //CREATE_INSTANCE_AFTER_START - this[this.runtime].createInstance( - this, - { - //CREATE_INSTANCE_OPTIONS_START - //CREATE_INSTANCE_OPTIONS_END - } - ) - - this.emit(Event.INSTANCE_CREATED, this); - //CREATE_INSTANCE_AFTER_END - - } - //CREATE_INSTANCE_TEMPLATE_END - - //UPDATE_INSTANCE_TEMPLATE_START - updateInstance(property) { - - //UPDATE_INSTANCE_BEFORE_START - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - //UPDATE_INSTANCE_BEFORE_END - - //UPDATE_INSTANCE_OPTIONS_START - //UPDATE_INSTANCE_OPTIONS_END - - //CUSTOM_UPDATE_INSTANCE_START - //CUSTOM_UPDATE_INSTANCE_END - - //UPDATE_INSTANCE_AFTER_START - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - //UPDATE_INSTANCE_AFTER_END - - } - //UPDATE_INSTANCE_TEMPLATE_END - - //UPDATE_FROM_INSTANCE_TEMPLATE_START - updateFromInstance(property) { - - //UPDATE_FROM_INSTANCE_BEFORE_START - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - //UPDATE_FROM_INSTANCE_BEFORE_END - - //UPDATE_FROM_INSTANCE_OPTIONS_START - //UPDATE_FROM_INSTANCE_OPTIONS_END - - //CUSTOM_UPDATE_FROM_INSTANCE_START - //CUSTOM_UPDATE_FROM_INSTANCE_END - - //UPDATE_FROM_INSTANCE_AFTER_START - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - //UPDATE_FROM_INSTANCE_AFTER_END - - } - //UPDATE_FROM_INSTANCE_TEMPLATE_END - - //DISPOSE_TEMPLATE_START - dispose() { - - //DISPOSE_BEFORE_START - this.subscribe( - Event.INSTANCE_DISPOSED, - function(object) { - if (object === this) { - this.emit(Event.DISPOSE_OBJECT, this); - } - } - ); - //DISPOSE_BEFORE_END - - //CUSTOM_DISPOSE_START - //CUSTOM_DISPOSE_END - - //DISPOSE_AFTER_START - this.disposeInstance(); - //DISPOSE_AFTER_END - - } - //DISPOSE_TEMPLATE_END - - //DISPOSE_INSTANCE_TEMPLATE_START - disposeInstance() { - - //DISPOSE_INSTANCE_BEFORE_START - console.log('Disposing instance of ' + this.name); - //DISPOSE_INSTANCE_BEFORE_END - - //CUSTOM_DISPOSE_INSTANCE_START - //CUSTOM_DISPOSE_INSTANCE_END - - //DISPOSE_INSTANCE_AFTER_START - this.emit(Event.DISPOSE_INSTANCE, this); - //DISPOSE_INSTANCE_AFTER_END - - } - //DISPOSE_INSTANCE_TEMPLATE_END - - //CUSTOM_IMPLEMENTATION_START - //CUSTOM_IMPLEMENTATION_END - -} - -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END - -module.exports = R3Object; \ No newline at end of file diff --git a/dist/r3-node/r3-system/index.js b/dist/r3-node/r3-system/index.js index c810768..f7dfba4 100644 --- a/dist/r3-node/r3-system/index.js +++ b/dist/r3-node/r3-system/index.js @@ -1,9 +1,24 @@ +//GENERATED_IMPORTS_START const System = require('./r3-system.js'); +const SystemDOM = require('./r3-system-d-o-m.js'); +const SystemInput = require('./r3-system-input.js'); const SystemLinking = require('./r3-system-linking.js'); +const SystemRender = require('./r3-system-render.js'); +const SystemRuntime = require('./r3-system-runtime.js'); const SystemSocket = require('./r3-system-socket.js'); +const SystemStorage = require('./r3-system-storage.js'); +//GENERATED_IMPORTS_END -module.exports = { - System, - SystemLinking, - SystemSocket -} \ No newline at end of file +//GENERATED_INDEX_BODY_START +System.DOM = SystemDOM; +System.Input = SystemInput; +System.Linking = SystemLinking; +System.Render = SystemRender; +System.Runtime = SystemRuntime; +System.Socket = SystemSocket; +System.Storage = SystemStorage; +//GENERATED_INDEX_BODY_END + +//GENERATED_EXPORTS_START +module.exports = System; +//GENERATED_EXPORTS_END diff --git a/dist/r3-node/r3-system/r3-system-linking.js b/dist/r3-node/r3-system/r3-system-linking.js index 05a36c1..6f0c45d 100644 --- a/dist/r3-node/r3-system/r3-system-linking.js +++ b/dist/r3-node/r3-system/r3-system-linking.js @@ -1,28 +1,996 @@ -const System = require('./r3-system'); -const R3Object = require('../r3-r3-object'); -const Event = require('../r3-event'); +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END -class LinkingSystem extends System { +//CUSTOM_IMPORTS_START +const R3Object = require('../r3-object/r3-object.js'); +const Utils = require('../r3-utils.js'); +const Entity = require('../r3-entity/r3-entity.js'); +const Component = require('../r3-component/r3-component.js'); +const Graph = require('../r3-graph.js'); +const Node = require('../r3-node.js'); +//CUSTOM_IMPORTS_END - static start() { +const Event = require('.././r3-event'); +const System = require('./r3-system.js'); - super.start(); - - console.log('starting linking system'); +/** - Event.Subscribe( - Event.OBJECT_CREATED, - () => { - console.log('linking system discovered an object'); - } - ); + GENERATED_INHERITED_START - let object = new R3Object(); + Class R3.System.Linking + [Inherited from System] - return true; + Inherited Properties: - } + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemLinking] + + Properties: + + + + Static Properties: + + - BlacklistedComponents (Default value [] - A list of component constructors which should not be + permitted to create instances immediately) + + Methods: + + + + Static Methods: + + - SanityChecks(r3Object, property, value) + When an object gets some value assigned to a property, we need to check if this property is a required + property, and if so, the value assigned to this property needs to conform to the type restrictions enforced by + the requirements objects. + + - SetParentChildRelationships(r3Object, property, value) + When an object gets some value assigned to a property, and it is a required property, we need to ensure that + the proper parent and child relationships are maintained + + - DetermineFutureReadyState(r3Object, property, value) + When an object is assigned some value to one of its required properties, we should determine the future + 'readiness' state of this R3 Object. Only if its ready state becomes false, we need to cascade this + information to all parents forcing them to emit a Only if its ready state becomes false, we force all parents + to emit a READY_STATE_PENDING_FALSE event. + + - CascadeFutureReadyState(r3Object, readyState) + We start at the current node - emit READY_STATE_PENDING_FALSE event, afterwards calling asking all parents to + emit a READY_STATE_PENDING_FALSE event. This allows the SystemLinking to stop Entities before the cleanup + occurs. + + - CascadeActualReadyState(r3Object) + We start at the current node, determine its current ready state (it triggers the appropriate events), + afterwards we work from the first parent upwards, determining it's ready state, taking appropriate action and + cascading upwards. + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + Started=false - Indicates whether or not this system is running or not + Subscriptions={} - An association object which hold the subscription handles for Events this system is listening to. The system can stop receiving events by calling remove() on a handle. + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + BlacklistedComponents=[] - A list of component constructors which should not be permitted to create instances immediately + CUSTOM_STATIC_OPTIONS_END + + CUSTOM_EVENT_LISTENERS_START + CUSTOM_EVENT_LISTENERS_END + + CUSTOM_STATIC_EVENT_LISTENERS_START + Event.OBJECT_CREATED + Event.COMPONENT_INITIALIZED + Event.ENTITY_INITIALIZED + Event.INSTANCE_CREATED + Event.CREATE_INSTANCE_BEFORE - @returns boolean delayInstance which indicates whether or not instance creation is delayed (handled) by another system. (i.e. where instance creation order is of importance) + Event.OBJECT_PROPERTY_UPDATE + Event.OBJECT_PROPERTY_UPDATED + Event.ON_READY_STATE_CHANGE + Event.FINAL_INITIALIZE + CUSTOM_STATIC_EVENT_LISTENERS_END + + TEMPLATE_METHODS_START + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + Start(options) - Starts the system by registering subscriptions to events + Stop(options) - Stops the system by removing these subscriptions to events + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + SanityChecks(r3Object, property, value) - When an object gets some value assigned to a property, we need to check if this property is a required property, and if so, the value assigned to this property needs to conform to the type restrictions enforced by the requirements objects. + SetParentChildRelationships(r3Object, property, value) - When an object gets some value assigned to a property, and it is a required property, we need to ensure that the proper parent and child relationships are maintained + DetermineFutureReadyState(r3Object, property, value) - When an object is assigned some value to one of its required properties, we should determine the future 'readiness' state of this R3 Object. Only if its ready state becomes false, we need to cascade this information to all parents forcing them to emit a Only if its ready state becomes false, we force all parents to emit a READY_STATE_PENDING_FALSE event. + CascadeFutureReadyState(r3Object, readyState) - We start at the current node - emit READY_STATE_PENDING_FALSE event, afterwards calling asking all parents to emit a READY_STATE_PENDING_FALSE event. This allows the SystemLinking to stop Entities before the cleanup occurs. + CascadeActualReadyState(r3Object) - We start at the current node, determine its current ready state (it triggers the appropriate events), afterwards we work from the first parent upwards, determining it's ready state, taking appropriate action and cascading upwards. + CUSTOM_STATIC_METHODS_END + + **/ + +class SystemLinking extends System { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + Object.assign(this, options); + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + //GENERATED_STATIC_START_METHOD_START + + //GENERATED_STATIC_EVENT_LISTENERS_START_START + SystemLinking.Subscriptions['OBJECT_CREATED'] = Event.Subscribe( + Event.OBJECT_CREATED, + SystemLinking.OnObjectCreated + ); + + SystemLinking.Subscriptions['COMPONENT_INITIALIZED'] = Event.Subscribe( + Event.COMPONENT_INITIALIZED, + SystemLinking.OnComponentInitialized + ); + + SystemLinking.Subscriptions['ENTITY_INITIALIZED'] = Event.Subscribe( + Event.ENTITY_INITIALIZED, + SystemLinking.OnEntityInitialized + ); + + SystemLinking.Subscriptions['INSTANCE_CREATED'] = Event.Subscribe( + Event.INSTANCE_CREATED, + SystemLinking.OnInstanceCreated + ); + + SystemLinking.Subscriptions['CREATE_INSTANCE_BEFORE'] = Event.Subscribe( + Event.CREATE_INSTANCE_BEFORE, + SystemLinking.OnCreateInstanceBefore + ); + + SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATE'] = Event.Subscribe( + Event.OBJECT_PROPERTY_UPDATE, + SystemLinking.OnObjectPropertyUpdate + ); + + SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATED'] = Event.Subscribe( + Event.OBJECT_PROPERTY_UPDATED, + SystemLinking.OnObjectPropertyUpdated + ); + + SystemLinking.Subscriptions['ON_READY_STATE_CHANGE'] = Event.Subscribe( + Event.ON_READY_STATE_CHANGE, + SystemLinking.OnOnReadyStateChange + ); + + SystemLinking.Subscriptions['FINAL_INITIALIZE'] = Event.Subscribe( + Event.FINAL_INITIALIZE, + SystemLinking.OnFinalInitialize + ); + + //GENERATED_STATIC_EVENT_LISTENERS_START_END + + //CUSTOM_BEFORE_STATIC_SYSTEM_START_START + //CUSTOM_BEFORE_STATIC_SYSTEM_START_END + + SystemLinking.Started = true; + + console.log('Started system: SystemLinking'); + + //GENERATED_STATIC_START_METHOD_END + + //CUSTOM_STATIC_START_METHOD_START + //CUSTOM_STATIC_START_METHOD_END + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + //GENERATED_STATIC_STOP_METHOD_START + + //GENERATED_STATIC_EVENT_LISTENERS_STOP_START + SystemLinking.Subscriptions['OBJECT_CREATED'].remove(); + delete SystemLinking.Subscriptions['OBJECT_CREATED']; + + SystemLinking.Subscriptions['COMPONENT_INITIALIZED'].remove(); + delete SystemLinking.Subscriptions['COMPONENT_INITIALIZED']; + + SystemLinking.Subscriptions['ENTITY_INITIALIZED'].remove(); + delete SystemLinking.Subscriptions['ENTITY_INITIALIZED']; + + SystemLinking.Subscriptions['INSTANCE_CREATED'].remove(); + delete SystemLinking.Subscriptions['INSTANCE_CREATED']; + + SystemLinking.Subscriptions['CREATE_INSTANCE_BEFORE'].remove(); + delete SystemLinking.Subscriptions['CREATE_INSTANCE_BEFORE']; + + SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATE'].remove(); + delete SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATE']; + + SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATED'].remove(); + delete SystemLinking.Subscriptions['OBJECT_PROPERTY_UPDATED']; + + SystemLinking.Subscriptions['ON_READY_STATE_CHANGE'].remove(); + delete SystemLinking.Subscriptions['ON_READY_STATE_CHANGE']; + + SystemLinking.Subscriptions['FINAL_INITIALIZE'].remove(); + delete SystemLinking.Subscriptions['FINAL_INITIALIZE']; + + //GENERATED_STATIC_EVENT_LISTENERS_STOP_END + + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END + + SystemLinking.Started = false; + + console.log('Stopped system: SystemLinking'); + + //GENERATED_STATIC_STOP_METHOD_END + + //CUSTOM_STATIC_STOP_METHOD_START + //CUSTOM_STATIC_STOP_METHOD_END + + } + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + + /** + * SanityChecks() + * - When an object gets some value assigned to a property, we need to check if this property is a required + * property, and if so, the value assigned to this property needs to conform to the type restrictions enforced by + * the requirements objects. + * @param r3Object + * @param property + * @param value + */ + static SanityChecks( + r3Object, + property, + value + ) { + + //GENERATED_STATIC_SANITY_CHECKS_METHOD_START + //GENERATED_STATIC_SANITY_CHECKS_METHOD_END + + //CUSTOM_STATIC_SANITY_CHECKS_METHOD_START + + for (let r = 0; r < r3Object.required.length; r++) { + + /** + * First we check if this is a required property + */ + if (!r3Object.required[r].hasOwnProperty(property)) { + return; + } + + /** + * We know this property is required - so continue.. + */ + if (r3Object.required[r][property] instanceof Array) { + + /** + * First we need to check that this value conforms to the requirement of being an Array + */ + if (!(value instanceof Array)) { + + if (r3Object.underConstruction) { + /** + * We are about to throw during a construction process. This means this r3Object will not + * be created - and so we need tell all of its children that this object is no longer their + * parent so that it can be garbage collected + */ + r3Object.children.map( + function(child) { + Utils.RemoveFromArray(child.parents, r3Object); + } + ); + } + + throw new TypeError('The property ' + property + ' of ' + r3Object.name + ' was not properly defined - it should be an array'); + } + + if (value.length === 0) { + return; + } + + /** + * Check all items in the array are valid objects of type r3Object.required[property] + */ + for (let i = 0; i < value.length; i++) { + r3Object.required[r][property].map( + function (constructor) { + if (!(value[i] instanceof constructor)) { + + if (r3Object.underConstruction) { + /** + * We are about to throw during a construction process. This means this r3Object will not + * be created - and so we need tell all of its children that this object is no longer their + * parent so that it can be garbage collected + */ + r3Object.children.map( + function(child) { + Utils.RemoveFromArray(child.parents, r3Object); + } + ); + } + + throw new TypeError('The child item inside ' + property + '[] of this object is not of the correct type'); + } + } + ); + } + } else { + + if (value === null) { + return; + } + + if (typeof value === 'undefined') { + return; + } + + if (!(value instanceof r3Object.required[r][property])) { + + if (r3Object.underConstruction) { + /** + * We are about to throw during a construction process. This means this r3Object will not + * be created - and so we need tell all of its children that this object is no longer their + * parent so that it can be garbage collected + */ + r3Object.children.map( + function(child) { + Utils.RemoveFromArray(child.parents, r3Object); + } + ); + } + + throw new TypeError('The property ' + property + ' of ' + r3Object.name + ' is not of the correct type') + } + + } + + } + //CUSTOM_STATIC_SANITY_CHECKS_METHOD_END + + } + + /** + * SetParentChildRelationships() + * - When an object gets some value assigned to a property, and it is a required property, we need to ensure that + * the proper parent and child relationships are maintained + * @param r3Object + * @param property + * @param value + */ + static SetParentChildRelationships( + r3Object, + property, + value + ) { + + //GENERATED_STATIC_SET_PARENT_CHILD_RELATIONSHIPS_METHOD_START + //GENERATED_STATIC_SET_PARENT_CHILD_RELATIONSHIPS_METHOD_END + + //CUSTOM_STATIC_SET_PARENT_CHILD_RELATIONSHIPS_METHOD_START + if (value instanceof Array) { + + /** + * We need to check if we removed an item from the existing array + */ + if (r3Object[property].length > 0) { + /** + * Find the missing value (if any) from the old array + */ + + let unlinked = r3Object[property].reduce( + function(result, object) { + if (value.indexOf(object) === -1) { + result.push(object); + } + return result; + }, + [] + ); + + unlinked.map( + function(unlinkObject) { + Utils.RemoveFromArray(unlinkObject.parents, r3Object); + Utils.RemoveFromArray(r3Object.children, unlinkObject); + if (r3Object instanceof Entity) { + Utils.RemoveFromArray(r3Object.components, unlinkObject); + } + } + ); + + } + + for (let i = 0; i < value.length; i++) { + if (value[i] instanceof R3Object) { + Utils.PushUnique(value[i].parents, r3Object); + Utils.PushUnique(r3Object.children, value[i]); + if (r3Object instanceof Entity) { + Utils.PushUnique(r3Object.components, value[i]); + } + } + } + + } + + if (value instanceof R3Object) { + Utils.PushUnique(value.parents, r3Object); + Utils.PushUnique(r3Object.children, value); + if (r3Object instanceof Entity) { + Utils.PushUnique(r3Object.components, value); + } + } + + if (value === null || typeof value === 'undefined') { + + if (r3Object[property] instanceof R3Object) { + Utils.RemoveFromArray(r3Object[property].parents, r3Object); + Utils.RemoveFromArray(r3Object.children, r3Object[property]); + if (r3Object instanceof Entity) { + Utils.RemoveFromArray(r3Object.components, r3Object[property]); + } + } + + } + + //CUSTOM_STATIC_SET_PARENT_CHILD_RELATIONSHIPS_METHOD_END + + } + + /** + * DetermineFutureReadyState() + * - When an object is assigned some value to one of its required properties, we should determine the future + * 'readiness' state of this R3 Object. Only if its ready state becomes false, we need to cascade this + * information to all parents forcing them to emit a Only if its ready state becomes false, we force all parents + * to emit a READY_STATE_PENDING_FALSE event. + * @param r3Object + * @param property + * @param value + */ + static DetermineFutureReadyState( + r3Object, + property, + value + ) { + + //GENERATED_STATIC_DETERMINE_FUTURE_READY_STATE_METHOD_START + //GENERATED_STATIC_DETERMINE_FUTURE_READY_STATE_METHOD_END + + //CUSTOM_STATIC_DETERMINE_FUTURE_READY_STATE_METHOD_START + console.log('Determining future ready state of ' + r3Object.name + ' because of property change : ' + property); + + for (let r = 0; r < r3Object.required.length; r++) { + + if (r3Object.ready[r]) { + + /** + * This object is currently ready - we need to check if this object will fall out of a ready state. + * We only need to compare the current property. + */ + + let ready = true; + + let requirements = r3Object.required[r]; + + if (requirements.hasOwnProperty(property)) { + ready = r3Object.requirementValueCheck(requirements[property], value); + } + + if (!ready) { + /** + * This object will fall out of readiness state - notify all systems + */ + console.log('Future ready state will transition from true to false'); + SystemLinking.CascadeFutureReadyState(r3Object, R3Object.READY_STATE_PENDING_FALSE); + } + } + } + + //CUSTOM_STATIC_DETERMINE_FUTURE_READY_STATE_METHOD_END + + } + + /** + * CascadeFutureReadyState() + * - We start at the current node - emit READY_STATE_PENDING_FALSE event, afterwards calling asking all parents to + * emit a READY_STATE_PENDING_FALSE event. This allows the SystemLinking to stop Entities before the cleanup + * occurs. + * @param r3Object + * @param readyState + */ + static CascadeFutureReadyState( + r3Object, + readyState + ) { + + //GENERATED_STATIC_CASCADE_FUTURE_READY_STATE_METHOD_START + //GENERATED_STATIC_CASCADE_FUTURE_READY_STATE_METHOD_END + + //CUSTOM_STATIC_CASCADE_FUTURE_READY_STATE_METHOD_START + + let node = new Node( + { + object : r3Object + } + ); + + let graph = new Graph( + { + startNode : node, + relevant : ['parents'] + } + ) + + let nodes = graph.closed; + + /** + * nodes contains a list of current node and parent Objects which are affected by the ready state of this object. + */ + for (let n = 0; n < nodes.length; n++) { + + let node = nodes[n]; + + /** + * The parent does not know directly why it falls out of ready state necessarily - because from its perspective + * it may have all its children requirements met - however a child of one of its children is going out of ready + * state. So - without adding too much complexity here, we just notify all parents (including the current node) + * that it's impending ready state will be false. We don't care about the readyStateIndex because of this. (for + * the sake of complexity) + */ + Event.Emit( + Event.ON_READY_STATE_CHANGE, + { + r3Object: node.object, + readyState: readyState + } + ); + } + + //CUSTOM_STATIC_CASCADE_FUTURE_READY_STATE_METHOD_END + + } + + /** + * CascadeActualReadyState() + * - We start at the current node, determine its current ready state (it triggers the appropriate events), + * afterwards we work from the first parent upwards, determining it's ready state, taking appropriate action and + * cascading upwards. + * @param r3Object + */ + static CascadeActualReadyState(r3Object) { + + //GENERATED_STATIC_CASCADE_ACTUAL_READY_STATE_METHOD_START + //GENERATED_STATIC_CASCADE_ACTUAL_READY_STATE_METHOD_END + + //CUSTOM_STATIC_CASCADE_ACTUAL_READY_STATE_METHOD_START + console.log('Cascading actual ready state of ' + r3Object.name); + + let node = new Node( + { + object : r3Object + } + ); + + let graph = new Graph( + { + startNode : node, + relevant : ['parents'] + } + ) + + let nodes = graph.closed; + + /** + * nodes contains the current node as it's first object, followed by its parents + */ + for (let n = 0; n < nodes.length; n++) { + + let node = nodes[n]; + + /** + * A simple node.object.isReady() check will trigger the required READY_STATE_CHANGE events + */ + node.object.isReady(); + } + //CUSTOM_STATIC_CASCADE_ACTUAL_READY_STATE_METHOD_END + + } + //GENERATED_STATIC_METHODS_END + + //GENERATED_EVENT_LISTENER_METHODS_START + //GENERATED_EVENT_LISTENER_METHODS_END + + //GENERATED_STATIC_EVENT_LISTENER_METHODS_START + + /** + * OnObjectCreated() + * - Listens to events of type Event.OBJECT_CREATED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return + */ + static OnObjectCreated(object) { + + //GENERATED_STATIC_ON_OBJECT_CREATED_METHOD_START + //GENERATED_STATIC_ON_OBJECT_CREATED_METHOD_END + + //CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD_START + console.log('Object created : ' + object.name); + //CUSTOM_STATIC_ON_OBJECT_CREATED_METHOD_END + + } + + /** + * OnComponentInitialized() + * - Listens to events of type Event.COMPONENT_INITIALIZED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return + */ + static OnComponentInitialized(object) { + + //GENERATED_STATIC_ON_COMPONENT_INITIALIZED_METHOD_START + //GENERATED_STATIC_ON_COMPONENT_INITIALIZED_METHOD_END + + //CUSTOM_STATIC_ON_COMPONENT_INITIALIZED_METHOD_START + console.log('component initialized'); + //CUSTOM_STATIC_ON_COMPONENT_INITIALIZED_METHOD_END + + } + + /** + * OnEntityInitialized() + * - Listens to events of type Event.ENTITY_INITIALIZED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return + */ + static OnEntityInitialized(object) { + + //GENERATED_STATIC_ON_ENTITY_INITIALIZED_METHOD_START + //GENERATED_STATIC_ON_ENTITY_INITIALIZED_METHOD_END + + //CUSTOM_STATIC_ON_ENTITY_INITIALIZED_METHOD_START + console.log('entity initialized'); + //CUSTOM_STATIC_ON_ENTITY_INITIALIZED_METHOD_END + + } + + /** + * OnInstanceCreated() + * - Listens to events of type Event.INSTANCE_CREATED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return + */ + static OnInstanceCreated(object) { + + //GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD_START + //GENERATED_STATIC_ON_INSTANCE_CREATED_METHOD_END + + //CUSTOM_STATIC_ON_INSTANCE_CREATED_METHOD_START + console.log('instance created'); + //CUSTOM_STATIC_ON_INSTANCE_CREATED_METHOD_END + + } + + /** + * OnCreateInstanceBefore() + * - Listens to events of type Event.CREATE_INSTANCE_BEFORE and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return boolean delayInstance which indicates whether or not instance creation is delayed (handled) by + * another system. (i.e. where instance creation order is of importance) + */ + static OnCreateInstanceBefore(object) { + + //GENERATED_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD_START + //GENERATED_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD_END + + //CUSTOM_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD_START + for (let i = 0; i < SystemLinking.BlacklistedComponents.length; i++) { + if (object instanceof SystemLinking.BlacklistedComponents) { + + /** + * If an object is 'Blacklisted' - we need to fire an event + * to notify other systems that this component requests + * to have its instance created. + * + * Should no system respond to this event we should continue + * to create the instance + */ + + let delayInstance = false; + + Event.Emit( + Event.BLACKLISTED_COMPONENT_INSTANCE_REQUEST, + object, + function(response) { + delayInstance = response; + } + ); + + return delayInstance; + } + } + + return false; + //CUSTOM_STATIC_ON_CREATE_INSTANCE_BEFORE_METHOD_END + + } + + /** + * OnObjectPropertyUpdate() + * - Listens to events of type Event.OBJECT_PROPERTY_UPDATE and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return + */ + static OnObjectPropertyUpdate(object) { + + //GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_START + //GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_END + + //CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_START + let {value, property, r3Object} = object; + + // object = object.object; + + console.log('Object property update: ' + r3Object.constructor.name + '.' + property); + + /** + * First we need to perform some sanity checks on the property + */ + SystemLinking.SanityChecks(r3Object, property, value); + + /** + * Set the parent relationships + */ + SystemLinking.SetParentChildRelationships(r3Object, property, value); + + /** + * Determine the future ready state of the r3Object + */ + SystemLinking.DetermineFutureReadyState(r3Object, property, value); + + /** + * The value was unassigned - remove the parent relationships of the existing + * components (if available) + */ + // if (value === null || typeof value === 'undefined') { + // if (r3Object[property] instanceof R3Object) { + // r3Object.dirty = true; + // Utils.RemoveFromArray(r3Object[property].parents, r3Object); + // } + // } + // + // if (!r3Object.underConstruction) { + // + // if (r3Object.initialized) { + // /** + // * Check if this object will still be initialized after this assignment completes + // */ + // r3Object.setInitialized(property, value); + // if (!r3Object.initialized) { + // //We set this object back to initialized because it is still initialized - it WILL be not initialized in the future + // r3Object.initialized = true; + // r3Object.stop(); + // } + // } + // } + + //CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATE_METHOD_END + + } + + /** + * OnObjectPropertyUpdated() + * - Listens to events of type Event.OBJECT_PROPERTY_UPDATED and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return + */ + static OnObjectPropertyUpdated(object) { + + //GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_START + //GENERATED_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_END + + //CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_START + let {r3Object} = object; + + /** + * Determine the actual ready state of the r3Object + */ + SystemLinking.CascadeActualReadyState(r3Object); + + //CUSTOM_STATIC_ON_OBJECT_PROPERTY_UPDATED_METHOD_END + + } + + /** + * OnOnReadyStateChange() + * - Listens to events of type Event.ON_READY_STATE_CHANGE and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return + */ + static OnOnReadyStateChange(object) { + + //GENERATED_STATIC_ON_ON_READY_STATE_CHANGE_METHOD_START + //GENERATED_STATIC_ON_ON_READY_STATE_CHANGE_METHOD_END + + //CUSTOM_STATIC_ON_ON_READY_STATE_CHANGE_METHOD_START + + let {r3Object, readyState, readyStateIndex} = object; + + + if (readyState === R3Object.READY_STATE_TRUE) { + + console.log('Ready state changed to true for ' + r3Object.name + ' by passing requirements set ' + readyStateIndex); + + /** + * If it is a Component and it has no instance, call its createInstance(). + */ + if (r3Object instanceof Component && !r3Object.instance) { + r3Object.createInstance(); + } + + /** + * If it is an Entity and it is stopped, call the start() method. + */ + if (r3Object instanceof Entity && r3Object.started === false) { + r3Object.start(); + } + + } + + if (readyState === R3Object.READY_STATE_FALSE) { + console.log('Ready state false for : ' + r3Object.name); + + /** + * If it is a Component and it has an instance, dispose of it + */ + if (r3Object instanceof Component && r3Object.instance) { + r3Object.disposeInstance(); + } + } + + if (readyState === R3Object.READY_STATE_PENDING_FALSE) { + console.log('Ready state pending false for : ' + r3Object.name); + + /** + * If it is an Entity and is started, stop it. + */ + if (r3Object instanceof Entity && r3Object.started === true) { + r3Object.stop(); + } + } + + if (readyState === R3Object.READY_STATE_PENDING_TRUE) { + + /** + * We don't do anything at the moment - we just log this information. + */ + console.log('Ready state pending true for ' + r3Object.name + ' by passing requirements set ' + readyStateIndex); + } + + //CUSTOM_STATIC_ON_ON_READY_STATE_CHANGE_METHOD_END + + } + + /** + * OnFinalInitialize() + * - Listens to events of type Event.FINAL_INITIALIZE and executes this function. + * @param object (The event data passed as argument - typically an R3Object) + * @return + */ + static OnFinalInitialize(object) { + + //GENERATED_STATIC_ON_FINAL_INITIALIZE_METHOD_START + //GENERATED_STATIC_ON_FINAL_INITIALIZE_METHOD_END + + //CUSTOM_STATIC_ON_FINAL_INITIALIZE_METHOD_START + if (object instanceof Component) { + if (object.required.length === 0) { + object.createInstance(); + } + } + + if (object instanceof Entity) { + if (object.required.length === 0) { + object.start(); + } + } + //CUSTOM_STATIC_ON_FINAL_INITIALIZE_METHOD_END + + } + //GENERATED_STATIC_EVENT_LISTENER_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END } -module.exports = LinkingSystem; +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemLinking.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is + * listening to. The system can stop receiving events by calling remove() on a handle. + */ +SystemLinking.Subscriptions = {}; + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +/** + * static BlacklistedComponents - A list of component constructors which should not be permitted to create instances + * immediately + */ +SystemLinking.BlacklistedComponents = []; + +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = SystemLinking; diff --git a/dist/r3-node/r3-system/r3-system-socket.js b/dist/r3-node/r3-system/r3-system-socket.js index d6ad7c2..469dd07 100644 --- a/dist/r3-node/r3-system/r3-system-socket.js +++ b/dist/r3-node/r3-system/r3-system-socket.js @@ -1,17 +1,214 @@ +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('.././r3-event'); const System = require('./r3-system.js'); -class SocketSystem extends System { +/** - static start() { + GENERATED_INHERITED_START - super.start(); - - console.log('starting socket system'); + Class R3.System.Socket + [Inherited from System] - return true; + Inherited Properties: - } + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to SystemSocket] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + Started=false - Indicates whether or not this system is running or not + Subscriptions={} - An association object which hold the subscription handles for Events this system is listening to. The system can stop receiving events by calling remove() on a handle. + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + CUSTOM_EVENT_LISTENERS_START + CUSTOM_EVENT_LISTENERS_END + + CUSTOM_STATIC_EVENT_LISTENERS_START + CUSTOM_STATIC_EVENT_LISTENERS_END + + TEMPLATE_METHODS_START + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + Start(options) - Starts the system by registering subscriptions to events + Stop(options) - Stops the system by removing these subscriptions to events + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class SystemSocket extends System { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + Object.assign(this, options); + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + + /** + * Start() + * - Starts the system by registering subscriptions to events + * @param options + */ + static Start(options) { + + //GENERATED_STATIC_START_METHOD_START + + //GENERATED_STATIC_EVENT_LISTENERS_START_START + + //GENERATED_STATIC_EVENT_LISTENERS_START_END + + //CUSTOM_BEFORE_STATIC_SYSTEM_START_START + //CUSTOM_BEFORE_STATIC_SYSTEM_START_END + + SystemSocket.Started = true; + + console.log('Started system: SystemSocket'); + + //GENERATED_STATIC_START_METHOD_END + + //CUSTOM_STATIC_START_METHOD_START + //CUSTOM_STATIC_START_METHOD_END + + } + + /** + * Stop() + * - Stops the system by removing these subscriptions to events + * @param options + */ + static Stop(options) { + + //GENERATED_STATIC_STOP_METHOD_START + + //GENERATED_STATIC_EVENT_LISTENERS_STOP_START + //GENERATED_STATIC_EVENT_LISTENERS_STOP_END + + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_START + //CUSTOM_BEFORE_STATIC_SYSTEM_STOP_END + + SystemSocket.Started = false; + + console.log('Stopped system: SystemSocket'); + + //GENERATED_STATIC_STOP_METHOD_END + + //CUSTOM_STATIC_STOP_METHOD_START + //CUSTOM_STATIC_STOP_METHOD_END + + } + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //GENERATED_EVENT_LISTENER_METHODS_START + //GENERATED_EVENT_LISTENER_METHODS_END + + //GENERATED_STATIC_EVENT_LISTENER_METHODS_START + //GENERATED_STATIC_EVENT_LISTENER_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END } -module.exports = SocketSystem; \ No newline at end of file +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +/** + * static Started - Indicates whether or not this system is running or not + */ +SystemSocket.Started = false; + +/** + * static Subscriptions - An association object which hold the subscription handles for Events this system is + * listening to. The system can stop receiving events by calling remove() on a handle. + */ +SystemSocket.Subscriptions = {}; + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = SystemSocket; diff --git a/dist/r3-node/r3-system/r3-system.js b/dist/r3-node/r3-system/r3-system.js index 6cca63b..7f7f9af 100644 --- a/dist/r3-node/r3-system/r3-system.js +++ b/dist/r3-node/r3-system/r3-system.js @@ -1,9 +1,111 @@ +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('.././r3-event'); +const Utils = require('.././r3-utils'); + +/** + + GENERATED_INHERITED_START + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + CUSTOM_EVENT_LISTENERS_START + CUSTOM_EVENT_LISTENERS_END + + CUSTOM_STATIC_EVENT_LISTENERS_START + CUSTOM_STATIC_EVENT_LISTENERS_END + + TEMPLATE_METHODS_START + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + class System { - static start() { - console.log('starting a system'); - } + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + Object.assign(this, options); + + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //GENERATED_EVENT_LISTENER_METHODS_START + //GENERATED_EVENT_LISTENER_METHODS_END + + //GENERATED_STATIC_EVENT_LISTENER_METHODS_START + //GENERATED_STATIC_EVENT_LISTENER_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END } +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +System.DOM = 0x0; +System.INPUT = 0x1; +System.LINKING = 0x2; +System.RENDER = 0x3; +System.RUNTIME = 0x4; +System.SOCKET = 0x5; +System.STORAGE = 0x6; +System.MAX_SYSTEM = 0x7; +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + module.exports = System; diff --git a/dist/r3-node/r3-utils.js b/dist/r3-node/r3-utils.js index 250ffeb..22bdcf7 100644 --- a/dist/r3-node/r3-utils.js +++ b/dist/r3-node/r3-utils.js @@ -1,24 +1,55 @@ -const Event = require('r3-event'); +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END /** - OPTIONS_START - OPTIONS_END + GENERATED_INHERITED_START + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_METHODS_START + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END **/ class Utils { - //CONSTRUCTOR_TEMPLATE_START + //GENERATED_CONSTRUCTOR_START constructor(options) { - Event.Emit(Event.OBJECT_CREATED, this); - - //OPTIONS_INIT_START if (typeof options === 'undefined') { - options = {}; + options = {}; } - //OPTIONS_INIT_END + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END //CUSTOM_OPTIONS_INIT_START //CUSTOM_OPTIONS_INIT_END @@ -28,9 +59,22 @@ class Utils { //CUSTOM_BEFORE_INIT_START //CUSTOM_BEFORE_INIT_END - Event.Emit(Event.OBJECT_INITIALIZED, this); + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END } - //CONSTRUCTOR_TEMPLATE_END + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END //CUSTOM_IMPLEMENTATION_START static GetFirstParent(object, constructor) { @@ -56,7 +100,7 @@ class Utils { json = JSON.stringify(json, undefined, 2); } json = json.replace(/&/g, '&').replace(//g, '>'); - return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { + return json.replace(/("(\u[a-zA-Z0-9]{4}|\[^u]|[^\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { let cls = 'number'; if (/^"/.test(match)) { if (/:$/.test(match)) { @@ -391,39 +435,6 @@ class Utils { result[name].w = false; }; - static ObjectPropertiesAsBoolean(object) { - return Object.keys(object).reduce( - function(result, propertyId) { - - if (typeof object[propertyId] === 'function') { - return result; - } - - result[propertyId] = false; - - // if (object[propertyId] instanceof R3.Vector2) { - // Utils.BuildVectorSource(result, propertyId, 2); - // } - // - // if (object[propertyId] instanceof R3.Vector3) { - // Utils.BuildVectorSource(result, propertyId, 3); - // } - // - // if (object[propertyId] instanceof R3.Vector4) { - // Utils.BuildVectorSource(result, propertyId, 4); - // } - // - // if (object[propertyId] instanceof R3.Quaternion) { - // Utils.BuildQuaternionSource(result, propertyId); - // } - - return result; - - }.bind(this), - {} - ); - }; - static GetRuntime() { let result = null; @@ -471,7 +482,6 @@ class Utils { object.height = size.height; }; - /** * Returns id of object with the name if it exists in the array, otherwise null * @param name @@ -498,15 +508,6 @@ class Utils { ); }; - static LoadIdsFromArrayToIdObject(array, idToObject) { - - }; - - static LoadIdsFromObjectToIdObject(object, idToObject) { - - - }; - /** * Gets random int exclusive of maximum but inclusive of minimum * @param min @@ -591,8 +592,8 @@ class Utils { let FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; let FN_ARG_SPLIT = /,/; - let FN_ARG = /^\s*(_?)(.+?)\1\s*$/; - let STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,\)]*(('(?:\\'|[^'\r\n])*')|("(?:\\"|[^"\r\n])*"))|(\s*=[^,\)]*))/mg; + let FN_ARG = /^\s*(_?)(.+?)\s*$/; + let STRIP_COMMENTS = /(\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s*=[^,\)]*(('(?:\'|[^'\r\n])*')|("(?:\"|[^"\r\n])*"))|(\s*=[^,\)]*))/mg; let parameters, fnText, @@ -683,26 +684,6 @@ class Utils { } }; - /** - * Links an object to its parent through idToObject array - * @param propertyString - * @param idToObject - * @param parentObject - * @param id - * @constructor - */ - static Link(propertyString, idToObject, parentObject, id) { - - if (!Utils.UndefinedOrNull(parentObject[propertyString])) { - - if (!idToObject.hasOwnProperty(id)) { - console.warn('Linking failed for object:' + parentObject.name); - } - - parentObject[propertyString] = idToObject[id]; - } - }; - /** * Generates a random ID * @returns {string} @@ -1139,12 +1120,18 @@ class Utils { * @constructor */ static PushUnique(array, object) { - if (array.indexOf(object) === -1) { array.push(object); } }; + static RemoveFromArray(array, object) { + let index = array.indexOf(object); + if (index !== -1) { + array.splice(index, 1); + } + } + /** * Checks whether or not the object is empty * @param obj @@ -1269,7 +1256,16 @@ class Utils { } +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = Utils; \ No newline at end of file +module.exports = Utils; diff --git a/dist/r3-node/r3.js b/dist/r3-node/r3.js index 3abc49a..4368137 100644 --- a/dist/r3-node/r3.js +++ b/dist/r3-node/r3.js @@ -1,20 +1,108 @@ -const {System, SystemLinking, SystemSocket} = require('./r3-system'); -const R3Object = require('./r3-r3-object'); +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +/** + + GENERATED_INHERITED_START + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + Version='__VERSION__' - Current R3 version + CompileDate='__COMPILE_DATE__' - Current compile date of R3 + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_METHODS_START + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ class R3 { - constructor() { - } + //GENERATED_CONSTRUCTOR_START + constructor(options) { - static version() { - return 'Sun Jun 20 2021 18:45:42 GMT+0000 (Coordinated Universal Time)'; - } + if (typeof options === 'undefined') { + options = {}; + } + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + Object.assign(this, options); + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END } -R3.R3Object = R3Object; -R3.System = System; -R3.System.Linking = SystemLinking; -R3.System.Socket = SystemSocket; +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +/** + * static Version - Current R3 version + */ +R3.Version = '3.0.426'; + +/** + * static CompileDate - Current compile date of R3 + */ +R3.CompileDate = '2021 Oct 24 - 08:43:26 am'; + +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END module.exports = R3; diff --git a/dist/r3.js b/dist/r3.js index cb3e74c..eb4c21c 100644 --- a/dist/r3.js +++ b/dist/r3.js @@ -17,12 +17,12 @@ class R3 { /** * static Version - Current R3 version */ -R3.Version = '3.0.348'; +R3.Version = '3.0.426'; /** * static CompileDate - Current compile date of R3 */ -R3.CompileDate = '2021 Oct 10 - 20:47:06 pm'; +R3.CompileDate = '2021 Oct 24 - 08:43:26 am'; class System { @@ -1485,39 +1485,205 @@ class SystemRuntime extends System { */ static OnGetRuntime(object) { - /** - * DOM and Input Components are typically managed through - * the DOM. - */ - if ( - object.runtimeClass === RuntimeDOM - ) { + if (object.runtimeClass === RuntimeAudio) { + if (SystemRuntime.CurrentProject === null) { - + /** + * We use the default runtime + */ if (SystemRuntime.ServerSide) { - - if (!SystemRuntime.RuntimeDOM.JS) { - SystemRuntime.RuntimeDOM.JS = new RuntimeJSDOM(); - } - - return SystemRuntime.RuntimeDOM.JS; - + throw new Error('No server side implementation for RuntimeAudio'); } else { - - if (!SystemRuntime.RuntimeDOM.Web) { - SystemRuntime.RuntimeDOM.Web = new RuntimeWebDOM(); + if (typeof SystemRuntime.RuntimeAudio.Three === 'undefined') { + SystemRuntime.RuntimeAudio.Three = new RuntimeAudioThree(); } - - return SystemRuntime.RuntimeDOM.Web; - + return SystemRuntime.RuntimeAudio.Three; } } else { - console.log('TODO: implement a project based DOM runtime'); + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); } } - if (object instanceof ComponentCode) { + if (object.runtimeClass === RuntimeCode) { + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + if (typeof SystemRuntime.RuntimeCode.JS === 'undefined') { + SystemRuntime.RuntimeCode.JS = new RuntimeCodeJS(); + } + return SystemRuntime.RuntimeCode.JS; + } else { + if (typeof SystemRuntime.RuntimeCode.JS === 'undefined') { + SystemRuntime.RuntimeCode.JS = new RuntimeCodeJS(); + } + return SystemRuntime.RuntimeCode.JS; + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeCoder) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + throw new Error('No server side implementation for RuntimeCoder'); + } else { + if (typeof SystemRuntime.RuntimeCoder.CodeMirror === 'undefined') { + SystemRuntime.RuntimeCoder.CodeMirror = new RuntimeCoderCodeMirror(); + } + return SystemRuntime.RuntimeCoder.CodeMirror; + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeDOM) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + if (typeof SystemRuntime.RuntimeDOM.JS === 'undefined') { + SystemRuntime.RuntimeDOM.JS = new RuntimeDOMJS(); + } + return SystemRuntime.RuntimeDOM.JS; + } else { + if (typeof SystemRuntime.RuntimeDOM.Web === 'undefined') { + SystemRuntime.RuntimeDOM.Web = new RuntimeDOMWeb(); + } + return SystemRuntime.RuntimeDOM.Web; + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeGUI) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + throw new Error('No server side implementation for RuntimeGUI'); + } else { + if (typeof SystemRuntime.RuntimeGUI.ControlKit === 'undefined') { + SystemRuntime.RuntimeGUI.ControlKit = new RuntimeGUIControlKit(); + } + return SystemRuntime.RuntimeGUI.ControlKit; + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeGraphics) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + throw new Error('No server side implementation for RuntimeGraphics'); + } else { + if (typeof SystemRuntime.RuntimeGraphics.Three === 'undefined') { + SystemRuntime.RuntimeGraphics.Three = new RuntimeGraphicsThree(); + } + return SystemRuntime.RuntimeGraphics.Three; + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimePhysics) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + if (typeof SystemRuntime.RuntimePhysics.Bullet === 'undefined') { + SystemRuntime.RuntimePhysics.Bullet = new RuntimePhysicsBullet(); + } + return SystemRuntime.RuntimePhysics.Bullet; + } else { + throw new Error('No client side implementation for RuntimePhysics'); + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeSocket) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + throw new Error('No server side implementation for RuntimeSocket'); + } else { + throw new Error('No client side implementation for RuntimeSocket'); + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeStatistics) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + throw new Error('No server side implementation for RuntimeStatistics'); + } else { + if (typeof SystemRuntime.RuntimeStatistics.Stats === 'undefined') { + SystemRuntime.RuntimeStatistics.Stats = new RuntimeStatisticsStats(); + } + return SystemRuntime.RuntimeStatistics.Stats; + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } } } @@ -1590,6 +1756,8 @@ SystemRuntime.CurrentProject = null; */ SystemRuntime.ServerSide = (typeof process !== 'undefined'); +SystemRuntime.RuntimeAudio = {}; +SystemRuntime.RuntimeCode = {}; SystemRuntime.RuntimeCoder = {}; SystemRuntime.RuntimeDOM = {}; SystemRuntime.RuntimeGUI = {}; @@ -1826,20 +1994,362 @@ class Runtime { } -Runtime.BASE_CODER = 0x0; -Runtime.BASE_DOM = 0x1; -Runtime.BASE_GUI = 0x2; -Runtime.BASE_GRAPHICS = 0x3; -Runtime.BASE_PHYSICS = 0x4; -Runtime.BASE_SOCKET = 0x5; -Runtime.BASE_STATISTICS = 0x6; -Runtime.CODE_MIRROR = 0x7; -Runtime.JSDOM = 0x8; -Runtime.WEB_DOM = 0x9; -Runtime.CONTROL_KIT = 0xa; -Runtime.THREE = 0xb; -Runtime.BULLET = 0xc; -Runtime.STATS = 0xd; +Runtime.BASE_AUDIO = 0x0; +Runtime.BASE_CODE = 0x1; +Runtime.BASE_CODER = 0x2; +Runtime.BASE_DOM = 0x3; +Runtime.BASE_GUI = 0x4; +Runtime.BASE_GRAPHICS = 0x5; +Runtime.BASE_PHYSICS = 0x6; +Runtime.BASE_SOCKET = 0x7; +Runtime.BASE_STATISTICS = 0x8; +Runtime.AUDIO_THREE = 0x9; +Runtime.CODE_JS = 0xa; +Runtime.CODER_CODE_MIRROR = 0xb; +Runtime.DOMJS = 0xc; +Runtime.DOM_WEB = 0xd; +Runtime.GUI_CONTROL_KIT = 0xe; +Runtime.GRAPHICS_THREE = 0xf; +Runtime.PHYSICS_BULLET = 0x10; +Runtime.STATISTICS_STATS = 0x11; + +/** + + Class R3.Runtime.Audio + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeAudio] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeAudio extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + /** + * name - Name of the runtime + */ + if (typeof options.name === 'undefined') { + options.name = this.constructor.name; + } + + Object.assign(this, options); + + Event.Emit(Event.RUNTIME_CREATED, this); + } + +} + +/** + + Class R3.Runtime.Audio.Three + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeAudio] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeAudioThree] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeAudioThree extends RuntimeAudio { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates a runtime instance object based on the R3.Component representing it. + * @param component + */ + buildInstance(component) { + + } + +} + +/** + + Class R3.Runtime.Code + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeCode] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeCode extends Runtime { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + /** + * name - Name of the runtime + */ + if (typeof options.name === 'undefined') { + options.name = this.constructor.name; + } + + Object.assign(this, options); + + Event.Emit(Event.RUNTIME_CREATED, this); + } + +} + +/** + + Class R3.Runtime.Code.JS + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeCode] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeCodeJS] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeCodeJS extends RuntimeCode { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = true; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates a runtime instance object based on the R3.Component representing it. + * @param component + */ + buildInstance(component) { + + } + +} /** @@ -1945,7 +2455,7 @@ class RuntimeCoder extends Runtime { - [Belonging to RuntimeCodeMirror] + [Belonging to RuntimeCoderCodeMirror] Properties: @@ -1965,7 +2475,7 @@ class RuntimeCoder extends Runtime { **/ -class RuntimeCodeMirror extends RuntimeCoder { +class RuntimeCoderCodeMirror extends RuntimeCoder { constructor(options) { @@ -1975,6 +2485,26 @@ class RuntimeCodeMirror extends RuntimeCoder { super(options); + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + Object.assign(this, options); } @@ -2057,7 +2587,7 @@ class RuntimeDOM extends Runtime { /** - Class R3.Runtime.DOM.JSDOM + Class R3.Runtime.DOM.JS [Inherited from Runtime] Inherited Properties: @@ -2094,106 +2624,7 @@ class RuntimeDOM extends Runtime { - [Belonging to RuntimeJSDOM] - - Properties: - - - dom (Default value new JSDOM(`

R3 NodeJS DOM

`);) - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class RuntimeJSDOM extends RuntimeDOM { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - super(options); - - /** - * dom - No comment - */ - if (typeof options.dom === 'undefined') { - options.dom = new JSDOM(`

R3 NodeJS DOM

`);; - } - - Object.assign(this, options); - - } - - /** - * buildInstance() - * - Creates a runtime instance object based on the R3.Component representing it. - * @param component - */ - buildInstance(component) { - - if (component instanceof ComponentCanvas) { - let canvas = this.dom.window.document.createElement('canvas'); - canvas.setAttribute('width', component.width); - canvas.setAttribute('height', component.height); - canvas.setAttribute('style', component.style); - return canvas; - } - - } - -} - -/** - - Class R3.Runtime.DOM.WebDOM - [Inherited from Runtime] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from RuntimeDOM] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to RuntimeWebDOM] + [Belonging to RuntimeDOMJS] Properties: @@ -2213,7 +2644,7 @@ class RuntimeJSDOM extends RuntimeDOM { **/ -class RuntimeWebDOM extends RuntimeDOM { +class RuntimeDOMJS extends RuntimeDOM { constructor(options) { @@ -2223,6 +2654,26 @@ class RuntimeWebDOM extends RuntimeDOM { super(options); + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = true; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = false; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + Object.assign(this, options); } @@ -2234,20 +2685,109 @@ class RuntimeWebDOM extends RuntimeDOM { */ buildInstance(component) { - if (component instanceof ComponentCanvas) { - let canvas = document.createElement('canvas'); - canvas.setAttribute('width', component.width); - canvas.setAttribute('height', component.height); - canvas.setAttribute('style', component.style); - return canvas; + } + +} + +/** + + Class R3.Runtime.DOM.Web + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeDOM] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeDOMWeb] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class RuntimeDOMWeb extends RuntimeDOM { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; } - if (component instanceof ComponentImage) { - let image = document.createElement('img'); - image.setAttribute('src', component.src); - image.setAttribute('alt', component.alt); - return image; + super(options); + + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + + Object.assign(this, options); + + } + + /** + * buildInstance() + * - Creates a runtime instance object based on the R3.Component representing it. + * @param component + */ + buildInstance(component) { } @@ -2357,7 +2897,7 @@ class RuntimeGUI extends Runtime { - [Belonging to RuntimeControlKit] + [Belonging to RuntimeGUIControlKit] Properties: @@ -2377,7 +2917,7 @@ class RuntimeGUI extends Runtime { **/ -class RuntimeControlKit extends RuntimeGUI { +class RuntimeGUIControlKit extends RuntimeGUI { constructor(options) { @@ -2387,6 +2927,26 @@ class RuntimeControlKit extends RuntimeGUI { super(options); + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + Object.assign(this, options); } @@ -2506,7 +3066,7 @@ class RuntimeGraphics extends Runtime { - [Belonging to RuntimeThree] + [Belonging to RuntimeGraphicsThree] Properties: @@ -2526,7 +3086,7 @@ class RuntimeGraphics extends Runtime { **/ -class RuntimeThree extends RuntimeGraphics { +class RuntimeGraphicsThree extends RuntimeGraphics { constructor(options) { @@ -2536,6 +3096,26 @@ class RuntimeThree extends RuntimeGraphics { super(options); + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + Object.assign(this, options); } @@ -2655,7 +3235,7 @@ class RuntimePhysics extends Runtime { - [Belonging to RuntimeBullet] + [Belonging to RuntimePhysicsBullet] Properties: @@ -2675,7 +3255,7 @@ class RuntimePhysics extends Runtime { **/ -class RuntimeBullet extends RuntimePhysics { +class RuntimePhysicsBullet extends RuntimePhysics { constructor(options) { @@ -2685,6 +3265,26 @@ class RuntimeBullet extends RuntimePhysics { super(options); + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = true; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = false; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + Object.assign(this, options); } @@ -2869,7 +3469,7 @@ class RuntimeStatistics extends Runtime { - [Belonging to RuntimeStats] + [Belonging to RuntimeStatisticsStats] Properties: @@ -2889,7 +3489,7 @@ class RuntimeStatistics extends Runtime { **/ -class RuntimeStats extends RuntimeStatistics { +class RuntimeStatisticsStats extends RuntimeStatistics { constructor(options) { @@ -2899,6 +3499,26 @@ class RuntimeStats extends RuntimeStatistics { super(options); + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + Object.assign(this, options); } @@ -3148,107 +3768,101 @@ class Event { Event.BEFORE_RENDER = 0x1; Event.BLACKLISTED_COMPONENT_INSTANCE_REQUEST = 0x2; -Event.CANVAS_COMPONENT_INITIALIZED = 0x3; -Event.COMPONENT_CREATED = 0x4; -Event.COMPONENT_INITIALIZED = 0x5; -Event.CREATE_INSTANCE_BEFORE = 0x6; -Event.DISPOSE_INSTANCE = 0x7; -Event.DISPOSE_OBJECT = 0x8; -Event.DOM_COMPONENT_INITIALIZED = 0x9; -Event.ENTITY_CREATED = 0xa; -Event.ENTITY_INITIALIZED = 0xb; -Event.ENTITY_STARTED = 0xc; -Event.FINAL_INITIALIZE = 0xd; -Event.GET_API_URL = 0xe; -Event.GET_RUNTIME = 0xf; -Event.GET_WINDOW_SIZE = 0x10; -Event.GRAPHICS_COMPONENT_INITIALIZED = 0x11; -Event.IMAGE_COMPONENT_INITIALIZED = 0x12; -Event.IMAGE_INSTANCE_CREATED = 0x13; -Event.INPUT_COMPONENT_INITIALIZED = 0x14; -Event.INSTANCE_CREATED = 0x15; -Event.INSTANCE_DISPOSED = 0x16; -Event.KEYBOARD_DOWN = 0x17; -Event.KEYBOARD_UP = 0x18; -Event.MOUSE_DOWN = 0x19; -Event.MOUSE_MOVE = 0x1a; -Event.MOUSE_UP = 0x1b; -Event.MOUSE_WHEEL = 0x1c; -Event.OBJECT_CREATED = 0x1d; -Event.OBJECT_PROPERTY_UPDATE = 0x1e; -Event.OBJECT_PROPERTY_UPDATED = 0x1f; -Event.ON_READY_STATE_CHANGE = 0x20; -Event.PAUSE = 0x21; -Event.PROJECT_INITIALIZED = 0x22; -Event.RESTART = 0x23; -Event.RUNTIME_CREATED = 0x24; -Event.SLIDER_ENTITY_INITIALIZED = 0x25; -Event.START = 0x26; -Event.TOUCH_CANCEL = 0x27; -Event.TOUCH_COMPONENT_INITIALIZED = 0x28; -Event.TOUCH_END = 0x29; -Event.TOUCH_MOVE = 0x2a; -Event.TOUCH_START = 0x2b; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x2c; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x2d; -Event.UPDATE_INSTANCE_AFTER = 0x2e; -Event.UPDATE_INSTANCE_BEFORE = 0x2f; -Event.UPDATE_INSTANCE_PROPERTY = 0x30; -Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x31; -Event.MAX_EVENTS = 0x32; +Event.COMPONENT_CREATED = 0x3; +Event.COMPONENT_INITIALIZED = 0x4; +Event.CREATE_INSTANCE_BEFORE = 0x5; +Event.DISPOSE_INSTANCE = 0x6; +Event.DISPOSE_OBJECT = 0x7; +Event.DOM_COMPONENT_INITIALIZED = 0x8; +Event.ENTITY_CREATED = 0x9; +Event.ENTITY_INITIALIZED = 0xa; +Event.ENTITY_STARTED = 0xb; +Event.FINAL_INITIALIZE = 0xc; +Event.GET_API_URL = 0xd; +Event.GET_RUNTIME = 0xe; +Event.GET_WINDOW_SIZE = 0xf; +Event.GRAPHICS_COMPONENT_INITIALIZED = 0x10; +Event.IMAGE_INSTANCE_CREATED = 0x11; +Event.INPUT_COMPONENT_INITIALIZED = 0x12; +Event.INSTANCE_CREATED = 0x13; +Event.INSTANCE_DISPOSED = 0x14; +Event.KEYBOARD_DOWN = 0x15; +Event.KEYBOARD_UP = 0x16; +Event.MOUSE_DOWN = 0x17; +Event.MOUSE_MOVE = 0x18; +Event.MOUSE_UP = 0x19; +Event.MOUSE_WHEEL = 0x1a; +Event.OBJECT_CREATED = 0x1b; +Event.OBJECT_PROPERTY_UPDATE = 0x1c; +Event.OBJECT_PROPERTY_UPDATED = 0x1d; +Event.ON_READY_STATE_CHANGE = 0x1e; +Event.PAUSE = 0x1f; +Event.PROJECT_INITIALIZED = 0x20; +Event.RESTART = 0x21; +Event.RUNTIME_CREATED = 0x22; +Event.SLIDER_ENTITY_INITIALIZED = 0x23; +Event.START = 0x24; +Event.TOUCH_CANCEL = 0x25; +Event.TOUCH_END = 0x26; +Event.TOUCH_MOVE = 0x27; +Event.TOUCH_START = 0x28; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x29; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x2a; +Event.UPDATE_INSTANCE_AFTER = 0x2b; +Event.UPDATE_INSTANCE_BEFORE = 0x2c; +Event.UPDATE_INSTANCE_PROPERTY = 0x2d; +Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2e; +Event.MAX_EVENTS = 0x2f; Event.GetEventName = function(eventId) { switch(eventId) { case 0x1 : return 'before_render'; case 0x2 : return 'blacklisted_component_instance_request'; - case 0x3 : return 'canvas_component_initialized'; - case 0x4 : return 'component_created'; - case 0x5 : return 'component_initialized'; - case 0x6 : return 'create_instance_before'; - case 0x7 : return 'dispose_instance'; - case 0x8 : return 'dispose_object'; - case 0x9 : return 'dom_component_initialized'; - case 0xa : return 'entity_created'; - case 0xb : return 'entity_initialized'; - case 0xc : return 'entity_started'; - case 0xd : return 'final_initialize'; - case 0xe : return 'get_api_url'; - case 0xf : return 'get_runtime'; - case 0x10 : return 'get_window_size'; - case 0x11 : return 'graphics_component_initialized'; - case 0x12 : return 'image_component_initialized'; - case 0x13 : return 'image_instance_created'; - case 0x14 : return 'input_component_initialized'; - case 0x15 : return 'instance_created'; - case 0x16 : return 'instance_disposed'; - case 0x17 : return 'keyboard_down'; - case 0x18 : return 'keyboard_up'; - case 0x19 : return 'mouse_down'; - case 0x1a : return 'mouse_move'; - case 0x1b : return 'mouse_up'; - case 0x1c : return 'mouse_wheel'; - case 0x1d : return 'object_created'; - case 0x1e : return 'object_property_update'; - case 0x1f : return 'object_property_updated'; - case 0x20 : return 'on_ready_state_change'; - case 0x21 : return 'pause'; - case 0x22 : return 'project_initialized'; - case 0x23 : return 'restart'; - case 0x24 : return 'runtime_created'; - case 0x25 : return 'slider_entity_initialized'; - case 0x26 : return 'start'; - case 0x27 : return 'touch_cancel'; - case 0x28 : return 'touch_component_initialized'; - case 0x29 : return 'touch_end'; - case 0x2a : return 'touch_move'; - case 0x2b : return 'touch_start'; - case 0x2c : return 'update_from_instance_after'; - case 0x2d : return 'update_from_instance_before'; - case 0x2e : return 'update_instance_after'; - case 0x2f : return 'update_instance_before'; - case 0x30 : return 'update_instance_property'; - case 0x31 : return 'update_property_from_instance'; + case 0x3 : return 'component_created'; + case 0x4 : return 'component_initialized'; + case 0x5 : return 'create_instance_before'; + case 0x6 : return 'dispose_instance'; + case 0x7 : return 'dispose_object'; + case 0x8 : return 'dom_component_initialized'; + case 0x9 : return 'entity_created'; + case 0xa : return 'entity_initialized'; + case 0xb : return 'entity_started'; + case 0xc : return 'final_initialize'; + case 0xd : return 'get_api_url'; + case 0xe : return 'get_runtime'; + case 0xf : return 'get_window_size'; + case 0x10 : return 'graphics_component_initialized'; + case 0x11 : return 'image_instance_created'; + case 0x12 : return 'input_component_initialized'; + case 0x13 : return 'instance_created'; + case 0x14 : return 'instance_disposed'; + case 0x15 : return 'keyboard_down'; + case 0x16 : return 'keyboard_up'; + case 0x17 : return 'mouse_down'; + case 0x18 : return 'mouse_move'; + case 0x19 : return 'mouse_up'; + case 0x1a : return 'mouse_wheel'; + case 0x1b : return 'object_created'; + case 0x1c : return 'object_property_update'; + case 0x1d : return 'object_property_updated'; + case 0x1e : return 'on_ready_state_change'; + case 0x1f : return 'pause'; + case 0x20 : return 'project_initialized'; + case 0x21 : return 'restart'; + case 0x22 : return 'runtime_created'; + case 0x23 : return 'slider_entity_initialized'; + case 0x24 : return 'start'; + case 0x25 : return 'touch_cancel'; + case 0x26 : return 'touch_end'; + case 0x27 : return 'touch_move'; + case 0x28 : return 'touch_start'; + case 0x29 : return 'update_from_instance_after'; + case 0x2a : return 'update_from_instance_before'; + case 0x2b : return 'update_instance_after'; + case 0x2c : return 'update_instance_before'; + case 0x2d : return 'update_instance_property'; + case 0x2e : return 'update_property_from_instance'; default : throw new Error('Event type not defined : ' + eventId); } @@ -3559,20 +4173,21 @@ R3Object.ENTITY = 0x1; R3Object.ENTITY_SLIDER = 0x2; R3Object.COMPONENT = 0x3; R3Object.COMPONENT_CODE = 0x4; -R3Object.COMPONENT_DOM = 0x5; -R3Object.COMPONENT_CANVAS = 0x6; -R3Object.COMPONENT_TEST = 0x7; -R3Object.COMPONENT_GEOMETRY = 0x8; -R3Object.COMPONENT_BUFFER_GEOMETRY = 0x9; -R3Object.COMPONENT_PLANE_GEOMETRY = 0xa; -R3Object.COMPONENT_GRAPHICS = 0xb; -R3Object.COMPONENT_IMAGE = 0xc; -R3Object.COMPONENT_INPUT = 0xd; -R3Object.COMPONENT_TOUCH = 0xe; -R3Object.COMPONENT_MATERIAL = 0xf; -R3Object.COMPONENT_MESH = 0x10; -R3Object.COMPONENT_TEXTURE = 0x11; -R3Object.MAX_R3OBJECT = 0x12; +R3Object.COMPONENT_CODE_JS = 0x5; +R3Object.COMPONENT_DOM = 0x6; +R3Object.COMPONENT_DOM_CANVAS = 0x7; +R3Object.COMPONENT_DOM_IMAGE = 0x8; +R3Object.COMPONENT_GRAPHICS = 0x9; +R3Object.COMPONENT_GRAPHICS_GEOMETRY = 0xa; +R3Object.COMPONENT_GRAPHICS_GEOMETRY_BUFFER = 0xb; +R3Object.COMPONENT_GRAPHICS_GEOMETRY_BUFFER_PLANE = 0xc; +R3Object.COMPONENT_GRAPHICS_IMAGE = 0xd; +R3Object.COMPONENT_GRAPHICS_MATERIAL = 0xe; +R3Object.COMPONENT_GRAPHICS_MESH = 0xf; +R3Object.COMPONENT_GRAPHICS_TEXTURE = 0x10; +R3Object.COMPONENT_INPUT = 0x11; +R3Object.COMPONENT_INPUT_TOUCH = 0x12; +R3Object.MAX_R3OBJECT = 0x13; R3Object.READY_STATE_FALSE = 0x1; R3Object.READY_STATE_PENDING_FALSE = 0x2; @@ -4506,20 +5121,21 @@ class Component extends R3Object { } Component.CODE = 0x0; -Component.DOM = 0x1; -Component.CANVAS = 0x2; -Component.TEST = 0x3; -Component.GEOMETRY = 0x4; -Component.BUFFER_GEOMETRY = 0x5; -Component.PLANE_GEOMETRY = 0x6; -Component.GRAPHICS = 0x7; -Component.IMAGE = 0x8; -Component.INPUT = 0x9; -Component.TOUCH = 0xa; -Component.MATERIAL = 0xb; -Component.MESH = 0xc; -Component.TEXTURE = 0xd; -Component.MAX_COMPONENT = 0xe; +Component.CODE_JS = 0x1; +Component.DOM = 0x2; +Component.DOM_CANVAS = 0x3; +Component.DOM_IMAGE = 0x4; +Component.GRAPHICS = 0x5; +Component.GRAPHICS_GEOMETRY = 0x6; +Component.GRAPHICS_GEOMETRY_BUFFER = 0x7; +Component.GRAPHICS_GEOMETRY_BUFFER_PLANE = 0x8; +Component.GRAPHICS_IMAGE = 0x9; +Component.GRAPHICS_MATERIAL = 0xa; +Component.GRAPHICS_MESH = 0xb; +Component.GRAPHICS_TEXTURE = 0xc; +Component.INPUT = 0xd; +Component.INPUT_TOUCH = 0xe; +Component.MAX_COMPONENT = 0xf; /** @@ -4644,6 +5260,234 @@ class ComponentCode extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeCode; + } + + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + super.initialize(); + + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Code.JS + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentCode] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentCodeJS] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentCodeJS extends ComponentCode { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeCode; + } for (let r = 0; r < this.required.length; r++) { this.ready[r] = true; @@ -4786,8 +5630,7 @@ class ComponentCode extends Component { Properties: - - instance (Default value null - Holds the current instance of this object as determined (built) by - the runtime object.) + Static Properties: @@ -4831,12 +5674,17 @@ class ComponentDOM extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. + * runtime - Holds the current runtime instance of this Component based on the Runtime Class */ - if (typeof options.instance === 'undefined') { - options.instance = null; + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; } for (let r = 0; r < this.required.length; r++) { @@ -4884,21 +5732,6 @@ class ComponentDOM extends Component { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - if (property === 'instance') { - this.instance.instance = this.instance; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'instance', - instanceProperty : 'instance' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_INSTANCE_AFTER, this); } @@ -4912,21 +5745,6 @@ class ComponentDOM extends Component { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - if (property === 'instance' || property === 'all') { - this.instance = this.instance.instance; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'instance', - instanceProperty : 'instance' - } - ); - if (property !== 'all') { - return; - } - } - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); } @@ -5012,8 +5830,7 @@ class ComponentDOM extends Component { Inherited Properties: - - instance (Default value null - Holds the current instance of this object as determined (built) by - the runtime object.) + Inherited Static Properties: @@ -5027,11 +5844,10 @@ class ComponentDOM extends Component { - [Belonging to ComponentCanvas] + [Belonging to ComponentDOMCanvas] Properties: - - type (Default value 'canvas') - width (Default value 500 - The initial width of the canvas (You can override it with CSS)) - height (Default value 500 - The initial height of the canvas (You can override it with CSS)) - style (Default value 'border:1px solid #00bb00;') @@ -5050,7 +5866,7 @@ class ComponentDOM extends Component { **/ -class ComponentCanvas extends ComponentDOM { +class ComponentDOMCanvas extends ComponentDOM { constructor(options) { @@ -5078,13 +5894,19 @@ class ComponentCanvas extends ComponentDOM { if (typeof options.instance === 'undefined') { options.instance = null; } - /** - * type - No comment + * runtime - Holds the current runtime instance of this Component based on the Runtime Class */ - if (typeof options.type === 'undefined') { - options.type = 'canvas'; + if (typeof options.runtime === 'undefined') { + options.runtime = null; } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; + } + /** * width - The initial width of the canvas (You can override it with CSS) */ @@ -5130,8 +5952,6 @@ class ComponentCanvas extends ComponentDOM { super.initialize(); - Event.Emit(Event.CANVAS_COMPONENT_INITIALIZED, this); - if (this.initializeDepth === this.maxDepth) { this.emit(Event.FINAL_INITIALIZE, this); } else { @@ -5256,7 +6076,7 @@ class ComponentCanvas extends ComponentDOM { /** - Class R3.Event.Object.Component.DOM.Test + Class R3.Event.Object.Component.DOM.Image [Inherited from Event] Inherited Properties: @@ -5333,8 +6153,7 @@ class ComponentCanvas extends ComponentDOM { Inherited Properties: - - instance (Default value null - Holds the current instance of this object as determined (built) by - the runtime object.) + Inherited Static Properties: @@ -5348,11 +6167,27 @@ class ComponentCanvas extends ComponentDOM { - [Belonging to ComponentTest] + [Belonging to ComponentDOMImage] Properties: - + - src (Default value + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TpSotDu0g4pChumhBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIm5uToouU+L+k0CLWg+N+vLv3uHsHCPUy06yucUDTbTOViIuZ7KoYeEUvwgghgFGZWcacJCXRcXzdw8fXuxjP6nzuzxFScxYDfCLxLDNMm3iDeHrTNjjvE0dYUVaJz4nHTLog8SPXFY/fOBdcFnhmxEyn5okjxGKhjZU2ZkVTI54ijqqaTvlCxmOV8xZnrVxlzXvyFwZz+soy12kOIYFFLEGCCAVVlFCGjRitOikWUrQf7+AfdP0SuRRylcDIsYAKNMiuH/wPfndr5ScnvKRgHOh+cZyPYSCwCzRqjvN97DiNE8D/DFzpLX+lDsx8kl5radEjoH8buLhuacoecLkDDDwZsim7kp+mkM8D72f0TVkgfAv0rXm9Nfdx+gCkqavkDXBwCIwUKHu9w7t72nv790yzvx9QEXKZwXQv9wAAAAZiS0dEADIANAAxUB4d7wAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+UJEw0JHX/9/lIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADUlEQVQI12Ng+M+gBgADKAEm2Ka93QAAAABJRU5ErkJggg) + - alt (Default value '15% opaque 1x1 green pixel' - The alt attribute of this image) + - fileName (Default value Utils.LowerUnderscore(options.name) - Name of the image under which it is + stored) + - extension (Default value '.png' - Extension of the file name including the '.' (ex. '.jpg')) + - external_path (Default value '/images/' + options.id + '.png' - Path to the image relative to the + project defined API URL) + - internal_path (Default value '/tmp/' + options.id + '.png' - Server side path on the server to the + file, excluding filename) + - contentType (Default value 'image/png' - Content type of the file (based on the extension, ex. + 'image/jpeg')) + - size (Default value 565 - Size of the file in bytes) + - width (Default value 1 - Width of the image in pixels) + - height (Default value 1 - height of the image in pixels) + - orientation (Default value 'square' - The orientation of the image, one of 'square', 'landscape', + 'portrait') Static Properties: @@ -5368,7 +6203,7 @@ class ComponentCanvas extends ComponentDOM { **/ -class ComponentTest extends ComponentDOM { +class ComponentDOMImage extends ComponentDOM { constructor(options) { @@ -5409,1084 +6244,6 @@ class ComponentTest extends ComponentDOM { options.runtimeClass = RuntimeDOM; } - for (let r = 0; r < this.required.length; r++) { - this.ready[r] = true; - } - - this.underConstruction = true; - - Object.assign(this, options); - - this.underConstruction = false; - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Notifies all systems listening that this component initialized. - */ - initialize() { - - super.initialize(); - - if (this.initializeDepth === this.maxDepth) { - this.emit(Event.FINAL_INITIALIZE, this); - } else { - this.initializeDepth++; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - if (property === 'runtime') { - this.instance.runtime = this.runtime; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'runtime', - instanceProperty : 'runtime' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'runtimeClass') { - this.instance.runtimeClass = this.runtimeClass; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'runtimeClass', - instanceProperty : 'runtimeClass' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - if (property === 'runtime' || property === 'all') { - this.runtime = this.instance.runtime; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'runtime', - instanceProperty : 'runtime' - } - ); - if (property !== 'all') { - return; - } - } - if (property === 'runtimeClass' || property === 'all') { - this.runtimeClass = this.instance.runtimeClass; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'runtimeClass', - instanceProperty : 'runtimeClass' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Geometry - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentGeometry] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentGeometry extends Component { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = 0; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - options.maxDepth = options.callDepth; - - super(options); - - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - for (let r = 0; r < this.required.length; r++) { - this.ready[r] = true; - } - - this.underConstruction = true; - - Object.assign(this, options); - - this.underConstruction = false; - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Notifies all systems listening that this component initialized. - */ - initialize() { - - super.initialize(); - - if (this.initializeDepth === this.maxDepth) { - this.emit(Event.FINAL_INITIALIZE, this); - } else { - this.initializeDepth++; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Geometry.BufferGeometry - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentGeometry] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentBufferGeometry] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentBufferGeometry extends ComponentGeometry { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = 0; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - options.maxDepth = options.callDepth; - - super(options); - - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - for (let r = 0; r < this.required.length; r++) { - this.ready[r] = true; - } - - this.underConstruction = true; - - Object.assign(this, options); - - this.underConstruction = false; - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Notifies all systems listening that this component initialized. - */ - initialize() { - - super.initialize(); - - if (this.initializeDepth === this.maxDepth) { - this.emit(Event.FINAL_INITIALIZE, this); - } else { - this.initializeDepth++; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Geometry.BufferGeometry.PlaneGeometry - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentGeometry] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentBufferGeometry] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentPlaneGeometry] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentPlaneGeometry extends ComponentBufferGeometry { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = 0; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - options.maxDepth = options.callDepth; - - super(options); - - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - for (let r = 0; r < this.required.length; r++) { - this.ready[r] = true; - } - - this.underConstruction = true; - - Object.assign(this, options); - - this.underConstruction = false; - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Notifies all systems listening that this component initialized. - */ - initialize() { - - super.initialize(); - - if (this.initializeDepth === this.maxDepth) { - this.emit(Event.FINAL_INITIALIZE, this); - } else { - this.initializeDepth++; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Graphics - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentGraphics] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentGraphics extends Component { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = 0; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - options.maxDepth = options.callDepth; - - super(options); - - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - for (let r = 0; r < this.required.length; r++) { - this.ready[r] = true; - } - - this.underConstruction = true; - - Object.assign(this, options); - - this.underConstruction = false; - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Notifies all systems listening that this component initialized. - */ - initialize() { - - super.initialize(); - - Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this); - - if (this.initializeDepth === this.maxDepth) { - this.emit(Event.FINAL_INITIALIZE, this); - } else { - this.initializeDepth++; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Graphics.Image - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentGraphics] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentImage] - - Properties: - - - src (Default value - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TpSotDu0g4pChumhBVMRRq1CECqFWaNXB5NIvaNKQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIm5uToouU+L+k0CLWg+N+vLv3uHsHCPUy06yucUDTbTOViIuZ7KoYeEUvwgghgFGZWcacJCXRcXzdw8fXuxjP6nzuzxFScxYDfCLxLDNMm3iDeHrTNjjvE0dYUVaJz4nHTLog8SPXFY/fOBdcFnhmxEyn5okjxGKhjZU2ZkVTI54ijqqaTvlCxmOV8xZnrVxlzXvyFwZz+soy12kOIYFFLEGCCAVVlFCGjRitOikWUrQf7+AfdP0SuRRylcDIsYAKNMiuH/wPfndr5ScnvKRgHOh+cZyPYSCwCzRqjvN97DiNE8D/DFzpLX+lDsx8kl5radEjoH8buLhuacoecLkDDDwZsim7kp+mkM8D72f0TVkgfAv0rXm9Nfdx+gCkqavkDXBwCIwUKHu9w7t72nv790yzvx9QEXKZwXQv9wAAAAZiS0dEADIANAAxUB4d7wAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+UJEw0JHX/9/lIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADUlEQVQI12Ng+M+gBgADKAEm2Ka93QAAAABJRU5ErkJggg) - - alt (Default value '15% opaque 1x1 green pixel' - The alt attribute of this image) - - fileName (Default value Utils.LowerUnderscore(options.name) - Name of the image under which it is - stored) - - extension (Default value '.png' - Extension of the file name including the '.' (ex. '.jpg')) - - external_path (Default value '/images/' + options.id + '.png' - Path to the image relative to the - project defined API URL) - - internal_path (Default value '/tmp/' + options.id + '.png' - Server side path on the server to the - file, excluding filename) - - contentType (Default value 'image/png' - Content type of the file (based on the extension, ex. - 'image/jpeg')) - - size (Default value 565 - Size of the file in bytes) - - width (Default value 1 - Width of the image in pixels) - - height (Default value 1 - height of the image in pixels) - - orientation (Default value 'square' - The orientation of the image, one of 'square', 'landscape', - 'portrait') - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - **/ - -class ComponentImage extends ComponentGraphics { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = 0; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - options.maxDepth = options.callDepth; - - super(options); - - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - /** * src - The src attribute of this image, defaults to a 15% opaque 1x1 green pixel */ @@ -6558,30 +6315,6 @@ class ComponentImage extends ComponentGraphics { this.ready[r] = true; } - if (options.extension.match(/(png)$/i)) { - options.contentType = 'image/png'; - } - - if (options.extension.match(/(jpg|jpeg)$/i)) { - options.contentType = 'image/jpeg'; - } - - if (options.extension.match(/(gif)$/i)) { - options.contentType = 'image/gif'; - } - - if (options.width > options.height) { - options.orientation = 'landscape'; - } - - if (options.width < options.height) { - options.orientation = 'portrait'; - } - - if (options.width === options.height) { - options.orientation = 'square'; - } - this.underConstruction = true; Object.assign(this, options); @@ -6604,8 +6337,6 @@ class ComponentImage extends ComponentGraphics { super.initialize(); - Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this); - if (this.initializeDepth === this.maxDepth) { this.emit(Event.FINAL_INITIALIZE, this); } else { @@ -6870,7 +6601,7 @@ class ComponentImage extends ComponentGraphics { /** - Class R3.Event.Object.Component.Input + Class R3.Event.Object.Component.Graphics [Inherited from Event] Inherited Properties: @@ -6943,7 +6674,7 @@ class ComponentImage extends ComponentGraphics { - [Belonging to ComponentInput] + [Belonging to ComponentGraphics] Properties: @@ -6963,7 +6694,7 @@ class ComponentImage extends ComponentGraphics { **/ -class ComponentInput extends Component { +class ComponentGraphics extends Component { constructor(options) { @@ -6991,6 +6722,18 @@ class ComponentInput extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } for (let r = 0; r < this.required.length; r++) { this.ready[r] = true; @@ -7018,7 +6761,7 @@ class ComponentInput extends Component { super.initialize(); - Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this); + Event.Emit(Event.GRAPHICS_COMPONENT_INITIALIZED, this); if (this.initializeDepth === this.maxDepth) { this.emit(Event.FINAL_INITIALIZE, this); @@ -7058,7 +6801,7 @@ class ComponentInput extends Component { /** - Class R3.Event.Object.Component.Input.Touch + Class R3.Event.Object.Component.Graphics.Geometry [Inherited from Event] Inherited Properties: @@ -7131,7 +6874,7 @@ class ComponentInput extends Component { - [Inherited from ComponentInput] + [Inherited from ComponentGraphics] Inherited Properties: @@ -7149,280 +6892,7 @@ class ComponentInput extends Component { - [Belonging to ComponentTouch] - - Properties: - - - domComponent (Default value null - A Touch Component requires a Canvas component to bind to.) - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - [0]domComponent=ComponentDOM - - **/ - -class ComponentTouch extends ComponentInput { - - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = 0; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - options.maxDepth = options.callDepth; - - super(options); - - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - - /** - * domComponent - A Touch Component requires a Canvas component to bind to. - */ - if (typeof options.domComponent === 'undefined') { - options.domComponent = null; - } - - /** - * domComponent - No comment - */ - if (typeof options.required[0] === 'undefined') { - options.required[0] = {}; - } - - options.required[0].domComponent = ComponentDOM; - - if (typeof this._cache === 'undefined') { - this._cache = {}; - } - - this._cache['domComponent'] = options.domComponent; - Object.defineProperty( - this, - 'domComponent', - { - configurable : true, - enumerable : true, - set: (x) => { - Event.Emit( - Event.OBJECT_PROPERTY_UPDATE, - { - r3Object : this, - property : 'domComponent', - value : x - } - ); - this._cache['domComponent'] = x; - Event.Emit( - Event.OBJECT_PROPERTY_UPDATED, - { - r3Object : this, - property : 'domComponent', - value : x - } - ); - return x; - }, - get : () => { - return this._cache['domComponent']; - } - } - ) - - for (let r = 0; r < this.required.length; r++) { - this.ready[r] = true; - } - - this.underConstruction = true; - - Object.assign(this, options); - - this.underConstruction = false; - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - } - - /** - * initialize() - * - Notifies all systems listening that this component initialized. - */ - initialize() { - - super.initialize(); - - Event.Emit(Event.TOUCH_COMPONENT_INITIALIZED, this); - - if (this.initializeDepth === this.maxDepth) { - this.emit(Event.FINAL_INITIALIZE, this); - } else { - this.initializeDepth++; - } - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - if (property === 'domComponent') { - this.instance.domComponent = this.domComponent; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'domComponent', - instanceProperty : 'domComponent' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - if (property === 'domComponent' || property === 'all') { - this.domComponent = this.instance.domComponent; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'domComponent', - instanceProperty : 'domComponent' - } - ); - if (property !== 'all') { - return; - } - } - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - } - -} - -/** - - Class R3.Event.Object.Component.Material - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentMaterial] + [Belonging to ComponentGraphicsGeometry] Properties: @@ -7442,7 +6912,7 @@ class ComponentTouch extends ComponentInput { **/ -class ComponentMaterial extends Component { +class ComponentGraphicsGeometry extends ComponentGraphics { constructor(options) { @@ -7470,6 +6940,18 @@ class ComponentMaterial extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } for (let r = 0; r < this.required.length; r++) { this.ready[r] = true; @@ -7535,7 +7017,7 @@ class ComponentMaterial extends Component { /** - Class R3.Event.Object.Component.Mesh + Class R3.Event.Object.Component.Graphics.Geometry.Buffer [Inherited from Event] Inherited Properties: @@ -7608,11 +7090,948 @@ class ComponentMaterial extends Component { - [Belonging to ComponentMesh] + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphicsGeometry] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsGeometryBuffer] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentGraphicsGeometryBuffer extends ComponentGraphicsGeometry { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + super.initialize(); + + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics.Geometry.Buffer.Plane + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphicsGeometry] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphicsGeometryBuffer] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsGeometryBufferPlane] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentGraphicsGeometryBufferPlane extends ComponentGraphicsGeometryBuffer { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + super.initialize(); + + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics.Image + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsImage] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentGraphicsImage extends ComponentGraphics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + super.initialize(); + + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics.Material + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsMaterial] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentGraphicsMaterial extends ComponentGraphics { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + super.initialize(); + + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Graphics.Mesh + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsMesh] Properties: - material (Default value null) + - geometry (Default value null) Static Properties: @@ -7633,7 +8052,7 @@ class ComponentMaterial extends Component { **/ -class ComponentMesh extends Component { +class ComponentGraphicsMesh extends ComponentGraphics { constructor(options) { @@ -7661,6 +8080,18 @@ class ComponentMesh extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } /** * material - No comment @@ -7668,6 +8099,12 @@ class ComponentMesh extends Component { if (typeof options.material === 'undefined') { options.material = null; } + /** + * geometry - No comment + */ + if (typeof options.geometry === 'undefined') { + options.geometry = null; + } /** * material - No comment @@ -7904,6 +8341,20 @@ class ComponentMesh extends Component { return; } } + if (property === 'geometry') { + this.instance.geometry = this.geometry; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'geometry', + instanceProperty : 'geometry' + } + ); + if (property !== 'all') { + return; + } + } this.emit(Event.UPDATE_INSTANCE_AFTER, this); @@ -7932,6 +8383,20 @@ class ComponentMesh extends Component { return; } } + if (property === 'geometry' || property === 'all') { + this.geometry = this.instance.geometry; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'geometry', + instanceProperty : 'geometry' + } + ); + if (property !== 'all') { + return; + } + } this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); @@ -7941,7 +8406,7 @@ class ComponentMesh extends Component { /** - Class R3.Event.Object.Component.Texture + Class R3.Event.Object.Component.Graphics.Texture [Inherited from Event] Inherited Properties: @@ -8014,7 +8479,25 @@ class ComponentMesh extends Component { - [Belonging to ComponentTexture] + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsTexture] Properties: @@ -8034,7 +8517,7 @@ class ComponentMesh extends Component { **/ -class ComponentTexture extends Component { +class ComponentGraphicsTexture extends ComponentGraphics { constructor(options) { @@ -8062,6 +8545,434 @@ class ComponentTexture extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + super.initialize(); + + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Input + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentInput] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentInput extends Component { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; + } + + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + } + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + super.initialize(); + + Event.Emit(Event.INPUT_COMPONENT_INITIALIZED, this); + + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + } + +} + +/** + + Class R3.Event.Object.Component.Input.Touch + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentInput] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentInputTouch] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + **/ + +class ComponentInputTouch extends ComponentInput { + + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; + } for (let r = 0; r < this.required.length; r++) { this.ready[r] = true; @@ -9679,52 +10590,58 @@ class Utils { console.log('r3.js - version ' + R3.Version + ' compiled ' + R3.CompileDate); Component.Code = ComponentCode; +Component.Code.JS = ComponentCodeJS; Component.DOM = ComponentDOM; -Component.DOM.Canvas = ComponentCanvas; -Component.DOM.Test = ComponentTest; -Component.Geometry = ComponentGeometry; -Component.Geometry.BufferGeometry = ComponentBufferGeometry; -Component.Geometry.BufferGeometry.PlaneGeometry = ComponentPlaneGeometry; +Component.DOM.Canvas = ComponentDOMCanvas; +Component.DOM.Image = ComponentDOMImage; Component.Graphics = ComponentGraphics; -Component.Graphics.Image = ComponentImage; +Component.Graphics.Geometry = ComponentGraphicsGeometry; +Component.Graphics.Geometry.Buffer = ComponentGraphicsGeometryBuffer; +Component.Graphics.Geometry.Buffer.Plane = ComponentGraphicsGeometryBufferPlane; +Component.Graphics.Image = ComponentGraphicsImage; +Component.Graphics.Material = ComponentGraphicsMaterial; +Component.Graphics.Mesh = ComponentGraphicsMesh; +Component.Graphics.Texture = ComponentGraphicsTexture; Component.Input = ComponentInput; -Component.Input.Touch = ComponentTouch; -Component.Material = ComponentMaterial; -Component.Mesh = ComponentMesh; -Component.Texture = ComponentTexture; +Component.Input.Touch = ComponentInputTouch; Entity.Slider = EntitySlider; R3Object.Project = Project; R3Object.Entity = Entity; R3Object.Entity.Slider = EntitySlider; R3Object.Component = Component; R3Object.Component.Code = ComponentCode; +R3Object.Component.Code.JS = ComponentCodeJS; R3Object.Component.DOM = ComponentDOM; -R3Object.Component.DOM.Canvas = ComponentCanvas; -R3Object.Component.DOM.Test = ComponentTest; -R3Object.Component.Geometry = ComponentGeometry; -R3Object.Component.Geometry.BufferGeometry = ComponentBufferGeometry; -R3Object.Component.Geometry.BufferGeometry.PlaneGeometry = ComponentPlaneGeometry; +R3Object.Component.DOM.Canvas = ComponentDOMCanvas; +R3Object.Component.DOM.Image = ComponentDOMImage; R3Object.Component.Graphics = ComponentGraphics; -R3Object.Component.Graphics.Image = ComponentImage; +R3Object.Component.Graphics.Geometry = ComponentGraphicsGeometry; +R3Object.Component.Graphics.Geometry.Buffer = ComponentGraphicsGeometryBuffer; +R3Object.Component.Graphics.Geometry.Buffer.Plane = ComponentGraphicsGeometryBufferPlane; +R3Object.Component.Graphics.Image = ComponentGraphicsImage; +R3Object.Component.Graphics.Material = ComponentGraphicsMaterial; +R3Object.Component.Graphics.Mesh = ComponentGraphicsMesh; +R3Object.Component.Graphics.Texture = ComponentGraphicsTexture; R3Object.Component.Input = ComponentInput; -R3Object.Component.Input.Touch = ComponentTouch; -R3Object.Component.Material = ComponentMaterial; -R3Object.Component.Mesh = ComponentMesh; -R3Object.Component.Texture = ComponentTexture; +R3Object.Component.Input.Touch = ComponentInputTouch; +Runtime.Audio = RuntimeAudio; +Runtime.Audio.Three = RuntimeAudioThree; +Runtime.Code = RuntimeCode; +Runtime.Code.JS = RuntimeCodeJS; Runtime.Coder = RuntimeCoder; -Runtime.Coder.CodeMirror = RuntimeCodeMirror; +Runtime.Coder.CodeMirror = RuntimeCoderCodeMirror; Runtime.DOM = RuntimeDOM; -Runtime.DOM.JSDOM = RuntimeJSDOM; -Runtime.DOM.WebDOM = RuntimeWebDOM; +Runtime.DOM.JS = RuntimeDOMJS; +Runtime.DOM.Web = RuntimeDOMWeb; Runtime.GUI = RuntimeGUI; -Runtime.GUI.ControlKit = RuntimeControlKit; +Runtime.GUI.ControlKit = RuntimeGUIControlKit; Runtime.Graphics = RuntimeGraphics; -Runtime.Graphics.Three = RuntimeThree; +Runtime.Graphics.Three = RuntimeGraphicsThree; Runtime.Physics = RuntimePhysics; -Runtime.Physics.Bullet = RuntimeBullet; +Runtime.Physics.Bullet = RuntimePhysicsBullet; Runtime.Socket = RuntimeSocket; Runtime.Statistics = RuntimeStatistics; -Runtime.Statistics.Stats = RuntimeStats; +Runtime.Statistics.Stats = RuntimeStatisticsStats; System.DOM = SystemDOM; System.Input = SystemInput; System.Linking = SystemLinking; @@ -9742,15 +10659,17 @@ R3.Object = R3Object; R3.Project = Project; R3.Entity = Entity; R3.Component = Component; -R3.Code = R3Object.Component.Code; +R3.JS = R3Object.Component.Code.JS; R3.Canvas = R3Object.Component.DOM.Canvas; -R3.Test = R3Object.Component.DOM.Test; -R3.PlaneGeometry = R3Object.Component.Geometry.BufferGeometry.PlaneGeometry; -R3.Image = R3Object.Component.Graphics.Image; +R3.DOM = R3Object.Component.DOM; +R3.DOM.Image = R3Object.Component.DOM.Image; +R3.Plane = R3Object.Component.Graphics.Geometry.Buffer.Plane; +R3.Graphics = R3Object.Component.Graphics; +R3.Graphics.Image = R3Object.Component.Graphics.Image; +R3.Material = R3Object.Component.Graphics.Material; +R3.Mesh = R3Object.Component.Graphics.Mesh; +R3.Texture = R3Object.Component.Graphics.Texture; R3.Touch = R3Object.Component.Input.Touch; -R3.Material = R3Object.Component.Material; -R3.Mesh = R3Object.Component.Mesh; -R3.Texture = R3Object.Component.Texture; R3.System.DOM.Start(); R3.System.Input.Start(); R3.System.Linking.Start(); diff --git a/graph.php b/graph.php index 2febab8..85290c8 100644 --- a/graph.php +++ b/graph.php @@ -307,6 +307,9 @@ class Node public $parent = null; public $children = []; public $isBaseClass = null; + public $serverSide = false; + public $clientSide = false; + public $default = false; function __construct( $__file, @@ -315,7 +318,10 @@ class Node $__nameSpaceClassName = '', $__parent = null, $__children = [], - $__isBaseClass = null + $__isBaseClass = null, + $__serverSide = false, + $__clientSide = false, + $__default = false ) { $this->file = $__file; @@ -325,6 +331,9 @@ class Node $this->parent = $__parent; $this->children = $__children; $this->isBaseClass = $__isBaseClass; + $this->serverSide = $__serverSide; + $this->clientSide = $__clientSide; + $this->default = $__default; } } \ No newline at end of file diff --git a/package.json b/package.json index fcdfb18..78412a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r3", - "version": "3.0.363", + "version": "3.0.433", "description": "", "private": true, "dependencies": { diff --git a/r3.php b/r3.php index 0fd6593..91c04dc 100755 --- a/r3.php +++ b/r3.php @@ -1541,12 +1541,50 @@ function generateR3($nodes, $graph) $children = $graph->flatten($component); + $leafNodes = []; + foreach ($children as $child) { + if (sizeof($child->children) === 0) { - array_push($defines, 'R3.' . $child->nameSpaceClassName . ' = ' . $child->nameSpace); + array_push($leafNodes, $child); } } + for ($i = 0; $i < sizeof($leafNodes); $i++) { + + $leafNode = $leafNodes[$i]; + + $duplicate = false; + + for ($n = 0; $n < sizeof($leafNodes); $n++) { + if ($n !== $i && $leafNode->nameSpaceClassName === $leafNodes[$n]->nameSpaceClassName) { + $duplicate = true; + } + } + + if ($duplicate) { + + $nameSpaces = preg_split('/\./', $leafNode->nameSpace); + + $nameSpaceClassName = $nameSpaces[sizeof($nameSpaces) - 2] . '.' . $nameSpaces[sizeof($nameSpaces) - 1]; + + array_pop($nameSpaces); + + $alternateNamespace = join(".", $nameSpaces); + + array_push($defines, 'R3.' . $nameSpaces[sizeof($nameSpaces) - 1] . ' = ' . $alternateNamespace); + + /** + * Below is not strictly needed because the parent namespace has already been linked. + */ + // array_push($defines, 'R3.' . $nameSpaceClassName . ' = ' . $leafNode->nameSpace); + } else { + array_push($defines, 'R3.' . $leafNode->nameSpaceClassName . ' = ' . $leafNode->nameSpace); + } + + + } + $r3Index = 'src/r3/index.js'; save($r3Index, getTokens(['CUSTOM'])); @@ -1913,6 +1951,37 @@ function buildNodeList($file) $nameSpace = ''; $nameSpaceClassName = $class; + $serverSide = false; + $clientSide = false; + $default = false; + + if (preg_match('/Runtime/', $extends)) { + /** + * Search for serverSide and default options + */ + $found = false; + while (!feof($fn) && !$found) { + $line = fgets($fn); + + $matches = []; + + if (preg_match('/^\s*options\.serverSide\s*=\s*(.*);/', $line, $matches)) { + $serverSide = ($matches[1]==="true"); + } + + if (preg_match('/^\s*options\.clientSide\s*=\s*(.*);/', $line, $matches)) { + $clientSide = ($matches[1]==="true"); + } + + if (preg_match('/^\s*options\.default\s*=\s*(.*);/', $line, $matches)) { + $default = ($matches[1]==="true"); + $found = true; + } + + } + + } + $needles = [ 'Component', 'Entity', @@ -1944,7 +2013,10 @@ function buildNodeList($file) $nameSpaceClassName, $extends, [], - $isBaseClass + $isBaseClass, + $serverSide, + $clientSide, + $default ); array_push($nodeList, $node); @@ -2055,6 +2127,146 @@ function buildRuntimeOutOfClassDefines(&$outOfClassDefines, $node, $depth = 1) } } +function getDefaultRuntime($serverSide, $runtimeBase) +{ + foreach ($runtimeBase->children as $runtime) { + + } +} + +function replaceSection($string, $token, $updates, $separator = "\n") +{ + + if (getType($updates) === 'array') { + $updates = implode($separator, $updates); + } + + if (strlen($updates) <= 0) { + echo "No contents to be updated for token $token\n"; + return false; + } + + if (substr($updates, -1) !== "\n") { + $updates .= "\n"; + } + + $whiteSpaceObject = getWhitespace($string, $token . '_END'); + + if ($whiteSpaceObject === null) { + /** + * This file does not contain the token which requires an update - we can return here + */ + echo "Skipping token $token because it was not found but it could be generated soon...\n"; + return $token; + } + + $endToken = $token . "_END"; + + if ($whiteSpaceObject['inline-comment']) { + $endToken = '//' . $endToken; + } + + $whiteSpace = $whiteSpaceObject['white-space']; + + $string = preg_replace( + '/\b' . $token . '_START\b.*?\b' . $token . '_END\b/s', + $token . "_START\n" . $updates . $whiteSpace . $endToken, + $string + ); + + return $string; +} + +function getRuntimeInfo($node) +{ + return [ + 'runtimeBase' => $node->parent->name, + 'runtimeDefaultShort' => $node->nameSpaceClassName, + 'className' => $node->name + ]; +} + +function updateRuntimeDefaultSection($node, $defaultRuntimeTemplate) +{ + $info = getRuntimeInfo($node); + + $updates = str_replace('RUNTIME_BASE', $info['runtimeBase'], $defaultRuntimeTemplate); + $updates = str_replace('RUNTIME_DEFAULT_SHORT', $info['runtimeDefaultShort'], $updates); + return str_replace('RUNTIME_CLASS', $info['className'], $updates); + +} + +/** + * @param $runtimeLocators + * @param $node + * @param int $depth + * @throws Exception + */ +function buildGenerateRuntimeLocator(&$runtimeLocators, $node, $depth = 1) +{ + $template = file_get_contents('./src/templates/generated_runtime_locator.template'); + $defaultRuntimeTemplate = file_get_contents('src/templates/generated_default_runtime.template'); + + foreach ($node->children as $runtimeBaseNode) { + $updated = str_replace('RUNTIME_CLASS', $runtimeBaseNode->name, $template); + + $defaultServerRuntime=[]; + $defaultClientRuntime=[]; + + foreach ($runtimeBaseNode->children as $runtimeImplementation) { + + if ($runtimeImplementation->default && $runtimeImplementation->serverSide) { + array_push($defaultServerRuntime, $runtimeImplementation); + } + + if ($runtimeImplementation->default && $runtimeImplementation->clientSide) { + array_push($defaultClientRuntime, $runtimeImplementation); + } + + } + + if (sizeof($defaultClientRuntime) > 1) { + throw new Exception('Too many default client runtimes defined'); + } + + if (sizeof($defaultServerRuntime) > 1) { + throw new Exception('Too many default server runtimes defined'); + } + + $defaultClient = null; + + if (sizeof($defaultClientRuntime) === 1) { + $defaultClient = $defaultClientRuntime[0]; + } + + $defaultServer = null; + + if (sizeof($defaultServerRuntime) === 1) { + $defaultServer = $defaultServerRuntime[0]; + } + + if ($defaultClient) { + $updates = updateRuntimeDefaultSection($defaultClient, $defaultRuntimeTemplate); + $updated = replaceSection($updated, "GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME", $updates); + } + + if ($defaultServer) { + $updates = updateRuntimeDefaultSection($defaultServer, $defaultRuntimeTemplate); + $updated = replaceSection($updated, "GENERATED_DEFAULT_SERVER_SIDE_RUNTIME", $updates); + } + + array_push($runtimeLocators, $updated); + } +} + + + +function generateR3NodeDist() +{ + rrmdir('dist/r3-node'); + recursive_copy('src/r3/', 'dist/r3-node'); +} + function generateRuntimeSystem($graph) { @@ -2070,8 +2282,12 @@ function generateRuntimeSystem($graph) buildRuntimeOutOfClassDefines($outOfClassDefines, $node, 0); + $runtimeLocators = []; + buildGenerateRuntimeLocator($runtimeLocators, $node); + updateSection('./src/r3/r3-system/r3-system-runtime.js', 'GENERATED_IMPORTS', $imports, "\n"); updateSection('./src/r3/r3-system/r3-system-runtime.js', 'GENERATED_OUT_OF_CLASS_IMPLEMENTATION', $outOfClassDefines, "\n"); + updateSection('./src/r3/r3-system/r3-system-runtime.js', 'GENERATED_RUNTIME_LOCATOR', $runtimeLocators, "\n"); } @@ -2282,6 +2498,7 @@ if ($argv[2] == 'build-dist') { generateR3($nodes, $graph); generateR3Dist($nodes); + generateR3NodeDist(); foreach ($files as $file) { diff --git a/src/r3/index.js b/src/r3/index.js index b42aa5a..5aa7f26 100644 --- a/src/r3/index.js +++ b/src/r3/index.js @@ -23,15 +23,17 @@ R3.Object = R3Object; R3.Project = Project; R3.Entity = Entity; R3.Component = Component; -R3.Code = R3Object.Component.Code; +R3.JS = R3Object.Component.Code.JS; R3.Canvas = R3Object.Component.DOM.Canvas; -R3.Test = R3Object.Component.DOM.Test; -R3.PlaneGeometry = R3Object.Component.Geometry.BufferGeometry.PlaneGeometry; -R3.Image = R3Object.Component.Graphics.Image; +R3.DOM = R3Object.Component.DOM; +R3.DOM.Image = R3Object.Component.DOM.Image; +R3.Plane = R3Object.Component.Graphics.Geometry.Buffer.Plane; +R3.Graphics = R3Object.Component.Graphics; +R3.Graphics.Image = R3Object.Component.Graphics.Image; +R3.Material = R3Object.Component.Graphics.Material; +R3.Mesh = R3Object.Component.Graphics.Mesh; +R3.Texture = R3Object.Component.Graphics.Texture; R3.Touch = R3Object.Component.Input.Touch; -R3.Material = R3Object.Component.Material; -R3.Mesh = R3Object.Component.Mesh; -R3.Texture = R3Object.Component.Texture; //GENERATED_DEFINES_END //CUSTOM_DEFINES_START diff --git a/src/r3/r3-component/index.js b/src/r3/r3-component/index.js index 2ebbcdd..1559dab 100644 --- a/src/r3/r3-component/index.js +++ b/src/r3/r3-component/index.js @@ -1,36 +1,38 @@ //GENERATED_IMPORTS_START const Component = require('./r3-component.js'); const ComponentCode = require('./r3-component-code.js'); +const ComponentCodeJS = require('./r3-component-code-j-s.js'); const ComponentDOM = require('./r3-component-d-o-m.js'); -const ComponentCanvas = require('./r3-component-canvas.js'); -const ComponentTest = require('./r3-component-test.js'); -const ComponentGeometry = require('./r3-component-geometry.js'); -const ComponentBufferGeometry = require('./r3-component-buffer-geometry.js'); -const ComponentPlaneGeometry = require('./r3-component-plane-geometry.js'); +const ComponentDOMCanvas = require('./r3-component-d-o-m-canvas.js'); +const ComponentDOMImage = require('./r3-component-d-o-m-image.js'); const ComponentGraphics = require('./r3-component-graphics.js'); -const ComponentImage = require('./r3-component-image.js'); +const ComponentGraphicsGeometry = require('./r3-component-graphics-geometry.js'); +const ComponentGraphicsGeometryBuffer = require('./r3-component-graphics-geometry-buffer.js'); +const ComponentGraphicsGeometryBufferPlane = require('./r3-component-graphics-geometry-buffer-plane.js'); +const ComponentGraphicsImage = require('./r3-component-graphics-image.js'); +const ComponentGraphicsMaterial = require('./r3-component-graphics-material.js'); +const ComponentGraphicsMesh = require('./r3-component-graphics-mesh.js'); +const ComponentGraphicsTexture = require('./r3-component-graphics-texture.js'); const ComponentInput = require('./r3-component-input.js'); -const ComponentTouch = require('./r3-component-touch.js'); -const ComponentMaterial = require('./r3-component-material.js'); -const ComponentMesh = require('./r3-component-mesh.js'); -const ComponentTexture = require('./r3-component-texture.js'); +const ComponentInputTouch = require('./r3-component-input-touch.js'); //GENERATED_IMPORTS_END //GENERATED_INDEX_BODY_START Component.Code = ComponentCode; +Component.Code.JS = ComponentCodeJS; Component.DOM = ComponentDOM; -Component.DOM.Canvas = ComponentCanvas; -Component.DOM.Test = ComponentTest; -Component.Geometry = ComponentGeometry; -Component.Geometry.BufferGeometry = ComponentBufferGeometry; -Component.Geometry.BufferGeometry.PlaneGeometry = ComponentPlaneGeometry; +Component.DOM.Canvas = ComponentDOMCanvas; +Component.DOM.Image = ComponentDOMImage; Component.Graphics = ComponentGraphics; -Component.Graphics.Image = ComponentImage; +Component.Graphics.Geometry = ComponentGraphicsGeometry; +Component.Graphics.Geometry.Buffer = ComponentGraphicsGeometryBuffer; +Component.Graphics.Geometry.Buffer.Plane = ComponentGraphicsGeometryBufferPlane; +Component.Graphics.Image = ComponentGraphicsImage; +Component.Graphics.Material = ComponentGraphicsMaterial; +Component.Graphics.Mesh = ComponentGraphicsMesh; +Component.Graphics.Texture = ComponentGraphicsTexture; Component.Input = ComponentInput; -Component.Input.Touch = ComponentTouch; -Component.Material = ComponentMaterial; -Component.Mesh = ComponentMesh; -Component.Texture = ComponentTexture; +Component.Input.Touch = ComponentInputTouch; //GENERATED_INDEX_BODY_END //GENERATED_EXPORTS_START diff --git a/src/r3/r3-component/r3-component-plane-geometry.js b/src/r3/r3-component/r3-component-code-j-s.js similarity index 90% rename from src/r3/r3-component/r3-component-plane-geometry.js rename to src/r3/r3-component/r3-component-code-j-s.js index 795912c..bc819ee 100644 --- a/src/r3/r3-component/r3-component-plane-geometry.js +++ b/src/r3/r3-component/r3-component-code-j-s.js @@ -5,15 +5,15 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); -const ComponentBufferGeometry = require('./r3-component-buffer-geometry.js'); +const ComponentCode = require('./r3-component-code.js'); +const RuntimeCode = require('../r3-runtime/r3-runtime-code.js'); /** GENERATED_INHERITED_START - Class R3.Event.Object.Component.Geometry.BufferGeometry.PlaneGeometry + Class R3.Event.Object.Component.Code.JS [Inherited from Event] Inherited Properties: @@ -86,7 +86,7 @@ const ComponentBufferGeometry = require('./r3-component-buffer-geometry.js'); - [Inherited from ComponentGeometry] + [Inherited from ComponentCode] Inherited Properties: @@ -104,25 +104,7 @@ const ComponentBufferGeometry = require('./r3-component-buffer-geometry.js'); - [Inherited from ComponentBufferGeometry] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentPlaneGeometry] + [Belonging to ComponentCodeJS] Properties: @@ -144,6 +126,8 @@ const ComponentBufferGeometry = require('./r3-component-buffer-geometry.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeCode TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -166,6 +150,8 @@ const ComponentBufferGeometry = require('./r3-component-buffer-geometry.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -188,7 +174,7 @@ const ComponentBufferGeometry = require('./r3-component-buffer-geometry.js'); **/ -class ComponentPlaneGeometry extends ComponentBufferGeometry { +class ComponentCodeJS extends ComponentCode { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -218,6 +204,18 @@ class ComponentPlaneGeometry extends ComponentBufferGeometry { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeCode; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -361,4 +359,4 @@ class ComponentPlaneGeometry extends ComponentBufferGeometry { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = ComponentPlaneGeometry; +module.exports = ComponentCodeJS; diff --git a/src/r3/r3-component/r3-component-code.js b/src/r3/r3-component/r3-component-code.js index e0b2207..7223830 100644 --- a/src/r3/r3-component/r3-component-code.js +++ b/src/r3/r3-component/r3-component-code.js @@ -5,8 +5,8 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); +const RuntimeCode = require('../r3-runtime/r3-runtime-code.js'); /** @@ -107,6 +107,8 @@ const Event = require('../r3-event.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeCode TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -129,6 +131,8 @@ const Event = require('../r3-event.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -181,6 +185,18 @@ class ComponentCode extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeCode; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START diff --git a/src/r3/r3-component/r3-component-canvas.js b/src/r3/r3-component/r3-component-d-o-m-canvas.js similarity index 94% rename from src/r3/r3-component/r3-component-canvas.js rename to src/r3/r3-component/r3-component-d-o-m-canvas.js index cb545b3..6374207 100644 --- a/src/r3/r3-component/r3-component-canvas.js +++ b/src/r3/r3-component/r3-component-d-o-m-canvas.js @@ -5,9 +5,9 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); const ComponentDOM = require('./r3-component-d-o-m.js'); +const RuntimeDOM = require('../r3-runtime/r3-runtime-d-o-m.js'); /** @@ -90,8 +90,7 @@ const ComponentDOM = require('./r3-component-d-o-m.js'); Inherited Properties: - - instance (Default value null - Holds the current instance of this object as determined (built) by - the runtime object.) + Inherited Static Properties: @@ -105,11 +104,10 @@ const ComponentDOM = require('./r3-component-d-o-m.js'); - [Belonging to ComponentCanvas] + [Belonging to ComponentDOMCanvas] Properties: - - type (Default value 'canvas') - width (Default value 500 - The initial width of the canvas (You can override it with CSS)) - height (Default value 500 - The initial height of the canvas (You can override it with CSS)) - style (Default value 'border:1px solid #00bb00;') @@ -130,10 +128,11 @@ const ComponentDOM = require('./r3-component-d-o-m.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeDOM TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START - type='canvas' width=500 - The initial width of the canvas (You can override it with CSS) height=500 - The initial height of the canvas (You can override it with CSS) style='border:1px solid #00bb00;' @@ -156,10 +155,11 @@ const ComponentDOM = require('./r3-component-d-o-m.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START - type CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END TEMPLATE_METHODS_START @@ -179,7 +179,7 @@ const ComponentDOM = require('./r3-component-d-o-m.js'); **/ -class ComponentCanvas extends ComponentDOM { +class ComponentDOMCanvas extends ComponentDOM { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -209,15 +209,21 @@ class ComponentCanvas extends ComponentDOM { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START - /** - * type - No comment - */ - if (typeof options.type === 'undefined') { - options.type = 'canvas'; - } /** * width - The initial width of the canvas (You can override it with CSS) */ @@ -283,7 +289,6 @@ class ComponentCanvas extends ComponentDOM { //GENERATED_INITIALIZE_METHOD_END //CUSTOM_INITIALIZE_METHOD_START - Event.Emit(Event.CANVAS_COMPONENT_INITIALIZED, this); //CUSTOM_INITIALIZE_METHOD_END //GENERATED_INITIALIZE_METHOD_AFTER_START @@ -461,4 +466,4 @@ class ComponentCanvas extends ComponentDOM { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = ComponentCanvas; +module.exports = ComponentDOMCanvas; diff --git a/src/r3/r3-component/r3-component-image.js b/src/r3/r3-component/r3-component-d-o-m-image.js similarity index 95% rename from src/r3/r3-component/r3-component-image.js rename to src/r3/r3-component/r3-component-d-o-m-image.js index bdb0936..e33bbce 100644 --- a/src/r3/r3-component/r3-component-image.js +++ b/src/r3/r3-component/r3-component-d-o-m-image.js @@ -3,18 +3,17 @@ const Entity = require('../r3-entity/r3-entity.js'); //GENERATED_IMPORTS_END //CUSTOM_IMPORTS_START -const Utils = require('../r3-utils.js'); //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); -const ComponentGraphics = require('./r3-component-graphics.js'); +const ComponentDOM = require('./r3-component-d-o-m.js'); +const RuntimeDOM = require('../r3-runtime/r3-runtime-d-o-m.js'); /** GENERATED_INHERITED_START - Class R3.Event.Object.Component.Graphics.Image + Class R3.Event.Object.Component.DOM.Image [Inherited from Event] Inherited Properties: @@ -87,7 +86,7 @@ const ComponentGraphics = require('./r3-component-graphics.js'); - [Inherited from ComponentGraphics] + [Inherited from ComponentDOM] Inherited Properties: @@ -105,7 +104,7 @@ const ComponentGraphics = require('./r3-component-graphics.js'); - [Belonging to ComponentImage] + [Belonging to ComponentDOMImage] Properties: @@ -143,6 +142,8 @@ const ComponentGraphics = require('./r3-component-graphics.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeDOM TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -176,6 +177,8 @@ const ComponentGraphics = require('./r3-component-graphics.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -202,7 +205,7 @@ const ComponentGraphics = require('./r3-component-graphics.js'); **/ -class ComponentImage extends ComponentGraphics { +class ComponentDOMImage extends ComponentDOM { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -232,6 +235,18 @@ class ComponentImage extends ComponentGraphics { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -313,35 +328,9 @@ class ComponentImage extends ComponentGraphics { //GENERATED_AFTER_REQUIRED_COMPONENTS_END //CUSTOM_OPTIONS_INIT_START - - if (options.extension.match(/(png)$/i)) { - options.contentType = 'image/png'; - } - - if (options.extension.match(/(jpg|jpeg)$/i)) { - options.contentType = 'image/jpeg'; - } - - if (options.extension.match(/(gif)$/i)) { - options.contentType = 'image/gif'; - } - //CUSTOM_OPTIONS_INIT_END //CUSTOM_BEFORE_INIT_START - - if (options.width > options.height) { - options.orientation = 'landscape'; - } - - if (options.width < options.height) { - options.orientation = 'portrait'; - } - - if (options.width === options.height) { - options.orientation = 'square'; - } - //CUSTOM_BEFORE_INIT_END this.underConstruction = true; @@ -374,7 +363,6 @@ class ComponentImage extends ComponentGraphics { //GENERATED_INITIALIZE_METHOD_END //CUSTOM_INITIALIZE_METHOD_START - Event.Emit(Event.IMAGE_COMPONENT_INITIALIZED, this); //CUSTOM_INITIALIZE_METHOD_END //GENERATED_INITIALIZE_METHOD_AFTER_START @@ -692,4 +680,4 @@ class ComponentImage extends ComponentGraphics { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = ComponentImage; +module.exports = ComponentDOMImage; diff --git a/src/r3/r3-component/r3-component-d-o-m.js b/src/r3/r3-component/r3-component-d-o-m.js index 1254819..10e85d0 100644 --- a/src/r3/r3-component/r3-component-d-o-m.js +++ b/src/r3/r3-component/r3-component-d-o-m.js @@ -5,8 +5,8 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); +const RuntimeDOM = require('../r3-runtime/r3-runtime-d-o-m.js'); /** @@ -89,8 +89,7 @@ const Event = require('../r3-event.js'); Properties: - - instance (Default value null - Holds the current instance of this object as determined (built) by - the runtime object.) + Static Properties: @@ -108,10 +107,11 @@ const Event = require('../r3-event.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeDOM TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START - instance=null - Holds the current instance of this object as determined (built) by the runtime object. CUSTOM_OPTIONS_END CUSTOM_REQUIRED_COMPONENTS_START @@ -131,6 +131,8 @@ const Event = require('../r3-event.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -183,15 +185,21 @@ class ComponentDOM extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } //GENERATED_OPTIONS_INIT_END //GENERATED_REQUIRED_COMPONENTS_START @@ -263,20 +271,6 @@ class ComponentDOM extends Component { this.emit(Event.UPDATE_INSTANCE_BEFORE, this); //GENERATED_UPDATE_INSTANCE_OPTIONS_START - if (property === 'instance') { - this.instance.instance = this.instance; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'instance', - instanceProperty : 'instance' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START @@ -304,20 +298,6 @@ class ComponentDOM extends Component { this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'instance' || property === 'all') { - this.instance = this.instance.instance; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'instance', - instanceProperty : 'instance' - } - ); - if (property !== 'all') { - return; - } - } //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START diff --git a/src/r3/r3-component/r3-component-graphics-geometry-buffer-plane.js b/src/r3/r3-component/r3-component-graphics-geometry-buffer-plane.js new file mode 100644 index 0000000..878f7b2 --- /dev/null +++ b/src/r3/r3-component/r3-component-graphics-geometry-buffer-plane.js @@ -0,0 +1,398 @@ +//GENERATED_IMPORTS_START +const Entity = require('../r3-entity/r3-entity.js'); +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('../r3-event.js'); +const ComponentGraphicsGeometryBuffer = require('./r3-component-graphics-geometry-buffer.js'); +const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Event.Object.Component.Graphics.Geometry.Buffer.Plane + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphicsGeometry] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphicsGeometryBuffer] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsGeometryBufferPlane] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeGraphics + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_REQUIRED_COMPONENTS_START + CUSTOM_REQUIRED_COMPONENTS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_INSTANCE_OPTIONS_MAPPING_START + TEMPLATE_INSTANCE_OPTIONS_MAPPING_END + + CUSTOM_INSTANCE_OPTIONS_MAPPING_START + CUSTOM_INSTANCE_OPTIONS_MAPPING_END + + TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START + instance + runtime + runtimeClass + TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + TEMPLATE_METHODS_START + initialize() - Notifies all systems listening that this component initialized. + updateInstance(property) - Updates this object by copying the values of the current object into it's instance object. + updateFromInstance(property) - Updates this object by copying the values of its instance into the current object. + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class ComponentGraphicsGeometryBufferPlane extends ComponentGraphicsGeometryBuffer { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //GENERATED_REQUIRED_COMPONENTS_START + //GENERATED_REQUIRED_COMPONENTS_END + + //GENERATED_AFTER_REQUIRED_COMPONENTS_START + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + //GENERATED_AFTER_REQUIRED_COMPONENTS_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + //GENERATED_INITIALIZE_METHOD_START + super.initialize(); + //GENERATED_INITIALIZE_METHOD_END + + //CUSTOM_INITIALIZE_METHOD_START + //CUSTOM_INITIALIZE_METHOD_END + + //GENERATED_INITIALIZE_METHOD_AFTER_START + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + //GENERATED_INITIALIZE_METHOD_AFTER_END + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + //GENERATED_UPDATE_INSTANCE_METHOD_START + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + //GENERATED_UPDATE_INSTANCE_OPTIONS_START + //GENERATED_UPDATE_INSTANCE_OPTIONS_END + + //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START + //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + //GENERATED_UPDATE_INSTANCE_METHOD_END + + //CUSTOM_UPDATE_INSTANCE_METHOD_START + //CUSTOM_UPDATE_INSTANCE_METHOD_END + + //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START + //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_START + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START + //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END + + //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START + //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_END + + //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START + //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END + + } + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = ComponentGraphicsGeometryBufferPlane; diff --git a/src/r3/r3-component/r3-component-graphics-geometry-buffer.js b/src/r3/r3-component/r3-component-graphics-geometry-buffer.js new file mode 100644 index 0000000..935c06a --- /dev/null +++ b/src/r3/r3-component/r3-component-graphics-geometry-buffer.js @@ -0,0 +1,380 @@ +//GENERATED_IMPORTS_START +const Entity = require('../r3-entity/r3-entity.js'); +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('../r3-event.js'); +const ComponentGraphicsGeometry = require('./r3-component-graphics-geometry.js'); +const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Event.Object.Component.Graphics.Geometry.Buffer + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphicsGeometry] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsGeometryBuffer] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeGraphics + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_REQUIRED_COMPONENTS_START + CUSTOM_REQUIRED_COMPONENTS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_INSTANCE_OPTIONS_MAPPING_START + TEMPLATE_INSTANCE_OPTIONS_MAPPING_END + + CUSTOM_INSTANCE_OPTIONS_MAPPING_START + CUSTOM_INSTANCE_OPTIONS_MAPPING_END + + TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START + instance + runtime + runtimeClass + TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + TEMPLATE_METHODS_START + initialize() - Notifies all systems listening that this component initialized. + updateInstance(property) - Updates this object by copying the values of the current object into it's instance object. + updateFromInstance(property) - Updates this object by copying the values of its instance into the current object. + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class ComponentGraphicsGeometryBuffer extends ComponentGraphicsGeometry { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //GENERATED_REQUIRED_COMPONENTS_START + //GENERATED_REQUIRED_COMPONENTS_END + + //GENERATED_AFTER_REQUIRED_COMPONENTS_START + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + //GENERATED_AFTER_REQUIRED_COMPONENTS_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + //GENERATED_INITIALIZE_METHOD_START + super.initialize(); + //GENERATED_INITIALIZE_METHOD_END + + //CUSTOM_INITIALIZE_METHOD_START + //CUSTOM_INITIALIZE_METHOD_END + + //GENERATED_INITIALIZE_METHOD_AFTER_START + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + //GENERATED_INITIALIZE_METHOD_AFTER_END + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + //GENERATED_UPDATE_INSTANCE_METHOD_START + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + //GENERATED_UPDATE_INSTANCE_OPTIONS_START + //GENERATED_UPDATE_INSTANCE_OPTIONS_END + + //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START + //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + //GENERATED_UPDATE_INSTANCE_METHOD_END + + //CUSTOM_UPDATE_INSTANCE_METHOD_START + //CUSTOM_UPDATE_INSTANCE_METHOD_END + + //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START + //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_START + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START + //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END + + //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START + //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_END + + //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START + //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END + + } + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = ComponentGraphicsGeometryBuffer; diff --git a/src/r3/r3-component/r3-component-graphics-geometry.js b/src/r3/r3-component/r3-component-graphics-geometry.js new file mode 100644 index 0000000..88c06c7 --- /dev/null +++ b/src/r3/r3-component/r3-component-graphics-geometry.js @@ -0,0 +1,362 @@ +//GENERATED_IMPORTS_START +const Entity = require('../r3-entity/r3-entity.js'); +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('../r3-event.js'); +const ComponentGraphics = require('./r3-component-graphics.js'); +const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Event.Object.Component.Graphics.Geometry + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsGeometry] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeGraphics + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_REQUIRED_COMPONENTS_START + CUSTOM_REQUIRED_COMPONENTS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_INSTANCE_OPTIONS_MAPPING_START + TEMPLATE_INSTANCE_OPTIONS_MAPPING_END + + CUSTOM_INSTANCE_OPTIONS_MAPPING_START + CUSTOM_INSTANCE_OPTIONS_MAPPING_END + + TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START + instance + runtime + runtimeClass + TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + TEMPLATE_METHODS_START + initialize() - Notifies all systems listening that this component initialized. + updateInstance(property) - Updates this object by copying the values of the current object into it's instance object. + updateFromInstance(property) - Updates this object by copying the values of its instance into the current object. + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class ComponentGraphicsGeometry extends ComponentGraphics { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //GENERATED_REQUIRED_COMPONENTS_START + //GENERATED_REQUIRED_COMPONENTS_END + + //GENERATED_AFTER_REQUIRED_COMPONENTS_START + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + //GENERATED_AFTER_REQUIRED_COMPONENTS_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + //GENERATED_INITIALIZE_METHOD_START + super.initialize(); + //GENERATED_INITIALIZE_METHOD_END + + //CUSTOM_INITIALIZE_METHOD_START + //CUSTOM_INITIALIZE_METHOD_END + + //GENERATED_INITIALIZE_METHOD_AFTER_START + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + //GENERATED_INITIALIZE_METHOD_AFTER_END + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + //GENERATED_UPDATE_INSTANCE_METHOD_START + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + //GENERATED_UPDATE_INSTANCE_OPTIONS_START + //GENERATED_UPDATE_INSTANCE_OPTIONS_END + + //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START + //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + //GENERATED_UPDATE_INSTANCE_METHOD_END + + //CUSTOM_UPDATE_INSTANCE_METHOD_START + //CUSTOM_UPDATE_INSTANCE_METHOD_END + + //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START + //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_START + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START + //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END + + //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START + //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_END + + //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START + //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END + + } + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = ComponentGraphicsGeometry; diff --git a/src/r3/r3-component/r3-component-material.js b/src/r3/r3-component/r3-component-graphics-image.js similarity index 87% rename from src/r3/r3-component/r3-component-material.js rename to src/r3/r3-component/r3-component-graphics-image.js index 1344815..14ae519 100644 --- a/src/r3/r3-component/r3-component-material.js +++ b/src/r3/r3-component/r3-component-graphics-image.js @@ -5,14 +5,15 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); +const ComponentGraphics = require('./r3-component-graphics.js'); +const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js'); /** GENERATED_INHERITED_START - Class R3.Event.Object.Component.Material + Class R3.Event.Object.Component.Graphics.Image [Inherited from Event] Inherited Properties: @@ -85,7 +86,25 @@ const Event = require('../r3-event.js'); - [Belonging to ComponentMaterial] + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsImage] Properties: @@ -107,6 +126,8 @@ const Event = require('../r3-event.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeGraphics TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -129,6 +150,8 @@ const Event = require('../r3-event.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -151,7 +174,7 @@ const Event = require('../r3-event.js'); **/ -class ComponentMaterial extends Component { +class ComponentGraphicsImage extends ComponentGraphics { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -181,6 +204,18 @@ class ComponentMaterial extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -324,4 +359,4 @@ class ComponentMaterial extends Component { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = ComponentMaterial; +module.exports = ComponentGraphicsImage; diff --git a/src/r3/r3-component/r3-component-graphics-material.js b/src/r3/r3-component/r3-component-graphics-material.js new file mode 100644 index 0000000..e98ddc4 --- /dev/null +++ b/src/r3/r3-component/r3-component-graphics-material.js @@ -0,0 +1,362 @@ +//GENERATED_IMPORTS_START +const Entity = require('../r3-entity/r3-entity.js'); +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('../r3-event.js'); +const ComponentGraphics = require('./r3-component-graphics.js'); +const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Event.Object.Component.Graphics.Material + [Inherited from Event] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + - async(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Async()' passing it the arguments + + - emit(eventId, data, clientCallback, clientErrorCallback) + Simply calls 'Emit()' passing it the arguments + + - subscribe(eventId, callback) + Simply calls 'Subscribe()' passing it the arguments + + Inherited Static Methods: + + - Async(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as + arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the + error as argument. + + - Emit(eventId, data, clientCallback, clientErrorCallback) + Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after + the event result is obtained, passing it the result. If an exception occurs during execution, the + clientErrorCallback is called with the error as argument. + + - Subscribe(eventId, callback) + Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised + + [Inherited from R3Object] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from Component] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsMaterial] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeGraphics + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + CUSTOM_REQUIRED_COMPONENTS_START + CUSTOM_REQUIRED_COMPONENTS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_INSTANCE_OPTIONS_MAPPING_START + TEMPLATE_INSTANCE_OPTIONS_MAPPING_END + + CUSTOM_INSTANCE_OPTIONS_MAPPING_START + CUSTOM_INSTANCE_OPTIONS_MAPPING_END + + TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START + instance + runtime + runtimeClass + TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START + CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END + + TEMPLATE_METHODS_START + initialize() - Notifies all systems listening that this component initialized. + updateInstance(property) - Updates this object by copying the values of the current object into it's instance object. + updateFromInstance(property) - Updates this object by copying the values of its instance into the current object. + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class ComponentGraphicsMaterial extends ComponentGraphics { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + if (typeof options.maxDepth === 'undefined') { + options.maxDepth = 0; + } + + if (typeof options.callDepth === 'undefined') { + options.callDepth = 0; + } else { + options.callDepth++; + } + + options.maxDepth = options.callDepth; + + super(options); + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * instance - Holds the current instance of this object as determined (built) by the runtime object. + */ + if (typeof options.instance === 'undefined') { + options.instance = null; + } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + //GENERATED_REQUIRED_COMPONENTS_START + //GENERATED_REQUIRED_COMPONENTS_END + + //GENERATED_AFTER_REQUIRED_COMPONENTS_START + for (let r = 0; r < this.required.length; r++) { + this.ready[r] = true; + } + //GENERATED_AFTER_REQUIRED_COMPONENTS_END + + //CUSTOM_OPTIONS_INIT_START + //CUSTOM_OPTIONS_INIT_END + + //CUSTOM_BEFORE_INIT_START + //CUSTOM_BEFORE_INIT_END + + this.underConstruction = true; + + Object.assign(this, options); + + this.underConstruction = false; + + if (options.callDepth === 0) { + this.initialize(); + } else { + options.callDepth--; + } + + //CUSTOM_AFTER_INIT_START + //CUSTOM_AFTER_INIT_END + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + + /** + * initialize() + * - Notifies all systems listening that this component initialized. + */ + initialize() { + + //GENERATED_INITIALIZE_METHOD_START + super.initialize(); + //GENERATED_INITIALIZE_METHOD_END + + //CUSTOM_INITIALIZE_METHOD_START + //CUSTOM_INITIALIZE_METHOD_END + + //GENERATED_INITIALIZE_METHOD_AFTER_START + if (this.initializeDepth === this.maxDepth) { + this.emit(Event.FINAL_INITIALIZE, this); + } else { + this.initializeDepth++; + } + //GENERATED_INITIALIZE_METHOD_AFTER_END + + } + + /** + * updateInstance() + * - Updates this object by copying the values of the current object into it's instance object. + * @param property + */ + updateInstance(property) { + + //GENERATED_UPDATE_INSTANCE_METHOD_START + this.emit(Event.UPDATE_INSTANCE_BEFORE, this); + + //GENERATED_UPDATE_INSTANCE_OPTIONS_START + //GENERATED_UPDATE_INSTANCE_OPTIONS_END + + //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START + //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END + + this.emit(Event.UPDATE_INSTANCE_AFTER, this); + //GENERATED_UPDATE_INSTANCE_METHOD_END + + //CUSTOM_UPDATE_INSTANCE_METHOD_START + //CUSTOM_UPDATE_INSTANCE_METHOD_END + + //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START + //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END + + } + + /** + * updateFromInstance() + * - Updates this object by copying the values of its instance into the current object. + * @param property + */ + updateFromInstance(property) { + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_START + this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); + + //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START + //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END + + //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START + //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END + + this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_END + + //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START + //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END + + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START + //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END + + } + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = ComponentGraphicsMaterial; diff --git a/src/r3/r3-component/r3-component-mesh.js b/src/r3/r3-component/r3-component-graphics-mesh.js similarity index 86% rename from src/r3/r3-component/r3-component-mesh.js rename to src/r3/r3-component/r3-component-graphics-mesh.js index a12c16a..34b166a 100644 --- a/src/r3/r3-component/r3-component-mesh.js +++ b/src/r3/r3-component/r3-component-graphics-mesh.js @@ -5,14 +5,15 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); +const ComponentGraphics = require('./r3-component-graphics.js'); +const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js'); /** GENERATED_INHERITED_START - Class R3.Event.Object.Component.Mesh + Class R3.Event.Object.Component.Graphics.Mesh [Inherited from Event] Inherited Properties: @@ -85,11 +86,30 @@ const Event = require('../r3-event.js'); - [Belonging to ComponentMesh] + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsMesh] Properties: - material (Default value null) + - geometry (Default value null) Static Properties: @@ -107,10 +127,13 @@ const Event = require('../r3-event.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeGraphics TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START material=null + geometry=null CUSTOM_OPTIONS_END CUSTOM_REQUIRED_COMPONENTS_START @@ -134,6 +157,8 @@ const Event = require('../r3-event.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -156,7 +181,7 @@ const Event = require('../r3-event.js'); **/ -class ComponentMesh extends Component { +class ComponentGraphicsMesh extends ComponentGraphics { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -186,6 +211,18 @@ class ComponentMesh extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -195,6 +232,12 @@ class ComponentMesh extends Component { if (typeof options.material === 'undefined') { options.material = null; } + /** + * geometry - No comment + */ + if (typeof options.geometry === 'undefined') { + options.geometry = null; + } //GENERATED_OPTIONS_INIT_END //GENERATED_REQUIRED_COMPONENTS_START @@ -456,6 +499,20 @@ class ComponentMesh extends Component { return; } } + if (property === 'geometry') { + this.instance.geometry = this.geometry; + this.emit( + Event.UPDATE_INSTANCE_PROPERTY, + { + component : this, + property : 'geometry', + instanceProperty : 'geometry' + } + ); + if (property !== 'all') { + return; + } + } //GENERATED_UPDATE_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START @@ -497,6 +554,20 @@ class ComponentMesh extends Component { return; } } + if (property === 'geometry' || property === 'all') { + this.geometry = this.instance.geometry; + this.emit( + Event.UPDATE_PROPERTY_FROM_INSTANCE, + { + component : this, + property : 'geometry', + instanceProperty : 'geometry' + } + ); + if (property !== 'all') { + return; + } + } //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START @@ -540,4 +611,4 @@ class ComponentMesh extends Component { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = ComponentMesh; +module.exports = ComponentGraphicsMesh; diff --git a/src/r3/r3-component/r3-component-geometry.js b/src/r3/r3-component/r3-component-graphics-texture.js similarity index 87% rename from src/r3/r3-component/r3-component-geometry.js rename to src/r3/r3-component/r3-component-graphics-texture.js index 9bbcd91..19ec9c1 100644 --- a/src/r3/r3-component/r3-component-geometry.js +++ b/src/r3/r3-component/r3-component-graphics-texture.js @@ -5,14 +5,15 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); +const ComponentGraphics = require('./r3-component-graphics.js'); +const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js'); /** GENERATED_INHERITED_START - Class R3.Event.Object.Component.Geometry + Class R3.Event.Object.Component.Graphics.Texture [Inherited from Event] Inherited Properties: @@ -85,7 +86,25 @@ const Event = require('../r3-event.js'); - [Belonging to ComponentGeometry] + [Inherited from ComponentGraphics] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to ComponentGraphicsTexture] Properties: @@ -107,6 +126,8 @@ const Event = require('../r3-event.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeGraphics TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -129,6 +150,8 @@ const Event = require('../r3-event.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -151,7 +174,7 @@ const Event = require('../r3-event.js'); **/ -class ComponentGeometry extends Component { +class ComponentGraphicsTexture extends ComponentGraphics { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -181,6 +204,18 @@ class ComponentGeometry extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -324,4 +359,4 @@ class ComponentGeometry extends Component { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = ComponentGeometry; +module.exports = ComponentGraphicsTexture; diff --git a/src/r3/r3-component/r3-component-graphics.js b/src/r3/r3-component/r3-component-graphics.js index b1844d2..d374165 100644 --- a/src/r3/r3-component/r3-component-graphics.js +++ b/src/r3/r3-component/r3-component-graphics.js @@ -5,8 +5,8 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); +const RuntimeGraphics = require('../r3-runtime/r3-runtime-graphics.js'); /** @@ -107,6 +107,8 @@ const Event = require('../r3-event.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeGraphics TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -129,6 +131,8 @@ const Event = require('../r3-event.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -181,6 +185,18 @@ class ComponentGraphics extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeGraphics; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START diff --git a/src/r3/r3-component/r3-component-buffer-geometry.js b/src/r3/r3-component/r3-component-input-touch.js similarity index 90% rename from src/r3/r3-component/r3-component-buffer-geometry.js rename to src/r3/r3-component/r3-component-input-touch.js index 4f791e6..ee6c4ee 100644 --- a/src/r3/r3-component/r3-component-buffer-geometry.js +++ b/src/r3/r3-component/r3-component-input-touch.js @@ -5,15 +5,15 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); -const ComponentGeometry = require('./r3-component-geometry.js'); +const ComponentInput = require('./r3-component-input.js'); +const RuntimeDOM = require('../r3-runtime/r3-runtime-d-o-m.js'); /** GENERATED_INHERITED_START - Class R3.Event.Object.Component.Geometry.BufferGeometry + Class R3.Event.Object.Component.Input.Touch [Inherited from Event] Inherited Properties: @@ -86,7 +86,7 @@ const ComponentGeometry = require('./r3-component-geometry.js'); - [Inherited from ComponentGeometry] + [Inherited from ComponentInput] Inherited Properties: @@ -104,7 +104,7 @@ const ComponentGeometry = require('./r3-component-geometry.js'); - [Belonging to ComponentBufferGeometry] + [Belonging to ComponentInputTouch] Properties: @@ -126,6 +126,8 @@ const ComponentGeometry = require('./r3-component-geometry.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeDOM TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -148,6 +150,8 @@ const ComponentGeometry = require('./r3-component-geometry.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -170,7 +174,7 @@ const ComponentGeometry = require('./r3-component-geometry.js'); **/ -class ComponentBufferGeometry extends ComponentGeometry { +class ComponentInputTouch extends ComponentInput { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -200,6 +204,18 @@ class ComponentBufferGeometry extends ComponentGeometry { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -343,4 +359,4 @@ class ComponentBufferGeometry extends ComponentGeometry { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = ComponentBufferGeometry; +module.exports = ComponentInputTouch; diff --git a/src/r3/r3-component/r3-component-input.js b/src/r3/r3-component/r3-component-input.js index 4375ba1..6a56f74 100644 --- a/src/r3/r3-component/r3-component-input.js +++ b/src/r3/r3-component/r3-component-input.js @@ -5,8 +5,8 @@ const Entity = require('../r3-entity/r3-entity.js'); //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); +const RuntimeDOM = require('../r3-runtime/r3-runtime-d-o-m.js'); /** @@ -107,6 +107,8 @@ const Event = require('../r3-event.js'); TEMPLATE_OPTIONS_START instance=null - Holds the current instance of this object as determined (built) by the runtime object. + runtime=null - Holds the current runtime instance of this Component based on the Runtime Class + runtimeClass=RuntimeDOM TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -129,6 +131,8 @@ const Event = require('../r3-event.js'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START @@ -181,6 +185,18 @@ class ComponentInput extends Component { if (typeof options.instance === 'undefined') { options.instance = null; } + /** + * runtime - Holds the current runtime instance of this Component based on the Runtime Class + */ + if (typeof options.runtime === 'undefined') { + options.runtime = null; + } + /** + * runtimeClass - No comment + */ + if (typeof options.runtimeClass === 'undefined') { + options.runtimeClass = RuntimeDOM; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START diff --git a/src/r3/r3-component/r3-component-texture.js b/src/r3/r3-component/r3-component-texture.js deleted file mode 100644 index 71da96d..0000000 --- a/src/r3/r3-component/r3-component-texture.js +++ /dev/null @@ -1,327 +0,0 @@ -//GENERATED_IMPORTS_START -const Entity = require('../r3-entity/r3-entity.js'); -//GENERATED_IMPORTS_END - -//CUSTOM_IMPORTS_START -//CUSTOM_IMPORTS_END - -const Component = require('../r3-component/r3-component.js'); -const Event = require('../r3-event.js'); - -/** - - GENERATED_INHERITED_START - - Class R3.Event.Object.Component.Texture - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentTexture] - - Properties: - - - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - GENERATED_INHERITED_END - - TEMPLATE_OPTIONS_START - instance=null - Holds the current instance of this object as determined (built) by the runtime object. - TEMPLATE_OPTIONS_END - - CUSTOM_OPTIONS_START - CUSTOM_OPTIONS_END - - CUSTOM_REQUIRED_COMPONENTS_START - CUSTOM_REQUIRED_COMPONENTS_END - - TEMPLATE_STATIC_OPTIONS_START - TEMPLATE_STATIC_OPTIONS_END - - CUSTOM_STATIC_OPTIONS_START - CUSTOM_STATIC_OPTIONS_END - - TEMPLATE_INSTANCE_OPTIONS_MAPPING_START - TEMPLATE_INSTANCE_OPTIONS_MAPPING_END - - CUSTOM_INSTANCE_OPTIONS_MAPPING_START - CUSTOM_INSTANCE_OPTIONS_MAPPING_END - - TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START - instance - TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END - - CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START - CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END - - TEMPLATE_METHODS_START - initialize() - Notifies all systems listening that this component initialized. - updateInstance(property) - Updates this object by copying the values of the current object into it's instance object. - updateFromInstance(property) - Updates this object by copying the values of its instance into the current object. - TEMPLATE_METHODS_END - - CUSTOM_METHODS_START - CUSTOM_METHODS_END - - TEMPLATE_STATIC_METHODS_START - TEMPLATE_STATIC_METHODS_END - - CUSTOM_STATIC_METHODS_START - CUSTOM_STATIC_METHODS_END - - **/ - -class ComponentTexture extends Component { - - //GENERATED_CONSTRUCTOR_START - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = 0; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - options.maxDepth = options.callDepth; - - super(options); - - //GENERATED_TEMPLATE_OPTIONS_INIT_START - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - //GENERATED_TEMPLATE_OPTIONS_INIT_END - - //GENERATED_OPTIONS_INIT_START - //GENERATED_OPTIONS_INIT_END - - //GENERATED_REQUIRED_COMPONENTS_START - //GENERATED_REQUIRED_COMPONENTS_END - - //GENERATED_AFTER_REQUIRED_COMPONENTS_START - for (let r = 0; r < this.required.length; r++) { - this.ready[r] = true; - } - //GENERATED_AFTER_REQUIRED_COMPONENTS_END - - //CUSTOM_OPTIONS_INIT_START - //CUSTOM_OPTIONS_INIT_END - - //CUSTOM_BEFORE_INIT_START - //CUSTOM_BEFORE_INIT_END - - this.underConstruction = true; - - Object.assign(this, options); - - this.underConstruction = false; - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - //CUSTOM_AFTER_INIT_START - //CUSTOM_AFTER_INIT_END - } - //GENERATED_CONSTRUCTOR_END - - //GENERATED_TEMPLATE_METHODS_START - - /** - * initialize() - * - Notifies all systems listening that this component initialized. - */ - initialize() { - - //GENERATED_INITIALIZE_METHOD_START - super.initialize(); - //GENERATED_INITIALIZE_METHOD_END - - //CUSTOM_INITIALIZE_METHOD_START - //CUSTOM_INITIALIZE_METHOD_END - - //GENERATED_INITIALIZE_METHOD_AFTER_START - if (this.initializeDepth === this.maxDepth) { - this.emit(Event.FINAL_INITIALIZE, this); - } else { - this.initializeDepth++; - } - //GENERATED_INITIALIZE_METHOD_AFTER_END - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - //GENERATED_UPDATE_INSTANCE_METHOD_START - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - //GENERATED_UPDATE_INSTANCE_OPTIONS_START - //GENERATED_UPDATE_INSTANCE_OPTIONS_END - - //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - //GENERATED_UPDATE_INSTANCE_METHOD_END - - //CUSTOM_UPDATE_INSTANCE_METHOD_START - //CUSTOM_UPDATE_INSTANCE_METHOD_END - - //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START - //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - //GENERATED_UPDATE_FROM_INSTANCE_METHOD_START - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START - //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END - - //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - //GENERATED_UPDATE_FROM_INSTANCE_METHOD_END - - //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START - //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END - - //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START - //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END - - } - //GENERATED_TEMPLATE_METHODS_END - - //GENERATED_METHODS_START - //GENERATED_METHODS_END - - //GENERATED_TEMPLATE_STATIC_METHODS_START - //GENERATED_TEMPLATE_STATIC_METHODS_END - - //GENERATED_STATIC_METHODS_START - //GENERATED_STATIC_METHODS_END - - //CUSTOM_IMPLEMENTATION_START - //CUSTOM_IMPLEMENTATION_END -} - -//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START -//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END - -//GENERATED_STATIC_OPTIONS_INIT_START -//GENERATED_STATIC_OPTIONS_INIT_END - -//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END - -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END - -module.exports = ComponentTexture; diff --git a/src/r3/r3-component/r3-component-touch.js b/src/r3/r3-component/r3-component-touch.js deleted file mode 100644 index 861e279..0000000 --- a/src/r3/r3-component/r3-component-touch.js +++ /dev/null @@ -1,429 +0,0 @@ -//GENERATED_IMPORTS_START -const Entity = require('../r3-entity/r3-entity.js'); -//GENERATED_IMPORTS_END - -//CUSTOM_IMPORTS_START -const ComponentDOM = require('../r3-component/r3-component-d-o-m.js'); -//CUSTOM_IMPORTS_END - -const Component = require('../r3-component/r3-component.js'); -const Event = require('../r3-event.js'); -const ComponentInput = require('./r3-component-input.js'); - -/** - - GENERATED_INHERITED_START - - Class R3.Event.Object.Component.Input.Touch - [Inherited from Event] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - async(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Async()' passing it the arguments - - - emit(eventId, data, clientCallback, clientErrorCallback) - Simply calls 'Emit()' passing it the arguments - - - subscribe(eventId, callback) - Simply calls 'Subscribe()' passing it the arguments - - Inherited Static Methods: - - - Async(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data, clientCallback and clientErrorCallback as - arguments. If an error occurs during clientCallback it additionally will execute clientErrorCallback with the - error as argument. - - - Emit(eventId, data, clientCallback, clientErrorCallback) - Calls all subscription functions registered to eventId with data as arg. Calls clientCallback directly after - the event result is obtained, passing it the result. If an exception occurs during execution, the - clientErrorCallback is called with the error as argument. - - - Subscribe(eventId, callback) - Subscribes to 'eventName', ex. Event.BEFORE_RENDER and executes 'callback()' when eventName is raised - - [Inherited from R3Object] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from Component] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Inherited from ComponentInput] - - Inherited Properties: - - - - Inherited Static Properties: - - - - Inherited Methods: - - - - Inherited Static Methods: - - - - [Belonging to ComponentTouch] - - Properties: - - - domComponent (Default value null - A Touch Component requires a Canvas component to bind to.) - - Static Properties: - - - - Methods: - - - - Static Methods: - - - - GENERATED_INHERITED_END - - TEMPLATE_OPTIONS_START - instance=null - Holds the current instance of this object as determined (built) by the runtime object. - TEMPLATE_OPTIONS_END - - CUSTOM_OPTIONS_START - domComponent=null - A Touch Component requires a Canvas component to bind to. - CUSTOM_OPTIONS_END - - CUSTOM_REQUIRED_COMPONENTS_START - [0]domComponent=ComponentDOM - CUSTOM_REQUIRED_COMPONENTS_END - - TEMPLATE_STATIC_OPTIONS_START - TEMPLATE_STATIC_OPTIONS_END - - CUSTOM_STATIC_OPTIONS_START - CUSTOM_STATIC_OPTIONS_END - - TEMPLATE_INSTANCE_OPTIONS_MAPPING_START - TEMPLATE_INSTANCE_OPTIONS_MAPPING_END - - CUSTOM_INSTANCE_OPTIONS_MAPPING_START - CUSTOM_INSTANCE_OPTIONS_MAPPING_END - - TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START - instance - TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END - - CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START - CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_END - - TEMPLATE_METHODS_START - initialize() - Notifies all systems listening that this component initialized. - updateInstance(property) - Updates this object by copying the values of the current object into it's instance object. - updateFromInstance(property) - Updates this object by copying the values of its instance into the current object. - TEMPLATE_METHODS_END - - CUSTOM_METHODS_START - CUSTOM_METHODS_END - - TEMPLATE_STATIC_METHODS_START - TEMPLATE_STATIC_METHODS_END - - CUSTOM_STATIC_METHODS_START - CUSTOM_STATIC_METHODS_END - - **/ - -class ComponentTouch extends ComponentInput { - - //GENERATED_CONSTRUCTOR_START - constructor(options) { - - if (typeof options === 'undefined') { - options = {}; - } - - if (typeof options.maxDepth === 'undefined') { - options.maxDepth = 0; - } - - if (typeof options.callDepth === 'undefined') { - options.callDepth = 0; - } else { - options.callDepth++; - } - - options.maxDepth = options.callDepth; - - super(options); - - //GENERATED_TEMPLATE_OPTIONS_INIT_START - /** - * instance - Holds the current instance of this object as determined (built) by the runtime object. - */ - if (typeof options.instance === 'undefined') { - options.instance = null; - } - //GENERATED_TEMPLATE_OPTIONS_INIT_END - - //GENERATED_OPTIONS_INIT_START - /** - * domComponent - A Touch Component requires a Canvas component to bind to. - */ - if (typeof options.domComponent === 'undefined') { - options.domComponent = null; - } - //GENERATED_OPTIONS_INIT_END - - //GENERATED_REQUIRED_COMPONENTS_START - /** - * domComponent - No comment - */ - if (typeof options.required[0] === 'undefined') { - options.required[0] = {}; - } - - options.required[0].domComponent = ComponentDOM; - - if (typeof this._cache === 'undefined') { - this._cache = {}; - } - - this._cache['domComponent'] = options.domComponent; - Object.defineProperty( - this, - 'domComponent', - { - configurable : true, - enumerable : true, - set: (x) => { - Event.Emit( - Event.OBJECT_PROPERTY_UPDATE, - { - r3Object : this, - property : 'domComponent', - value : x - } - ); - this._cache['domComponent'] = x; - Event.Emit( - Event.OBJECT_PROPERTY_UPDATED, - { - r3Object : this, - property : 'domComponent', - value : x - } - ); - return x; - }, - get : () => { - return this._cache['domComponent']; - } - } - ) - //GENERATED_REQUIRED_COMPONENTS_END - - //GENERATED_AFTER_REQUIRED_COMPONENTS_START - for (let r = 0; r < this.required.length; r++) { - this.ready[r] = true; - } - //GENERATED_AFTER_REQUIRED_COMPONENTS_END - - //CUSTOM_OPTIONS_INIT_START - //CUSTOM_OPTIONS_INIT_END - - //CUSTOM_BEFORE_INIT_START - //CUSTOM_BEFORE_INIT_END - - this.underConstruction = true; - - Object.assign(this, options); - - this.underConstruction = false; - - if (options.callDepth === 0) { - this.initialize(); - } else { - options.callDepth--; - } - - //CUSTOM_AFTER_INIT_START - //CUSTOM_AFTER_INIT_END - } - //GENERATED_CONSTRUCTOR_END - - //GENERATED_TEMPLATE_METHODS_START - - /** - * initialize() - * - Notifies all systems listening that this component initialized. - */ - initialize() { - - //GENERATED_INITIALIZE_METHOD_START - super.initialize(); - //GENERATED_INITIALIZE_METHOD_END - - //CUSTOM_INITIALIZE_METHOD_START - Event.Emit(Event.TOUCH_COMPONENT_INITIALIZED, this); - //CUSTOM_INITIALIZE_METHOD_END - - //GENERATED_INITIALIZE_METHOD_AFTER_START - if (this.initializeDepth === this.maxDepth) { - this.emit(Event.FINAL_INITIALIZE, this); - } else { - this.initializeDepth++; - } - //GENERATED_INITIALIZE_METHOD_AFTER_END - - } - - /** - * updateInstance() - * - Updates this object by copying the values of the current object into it's instance object. - * @param property - */ - updateInstance(property) { - - //GENERATED_UPDATE_INSTANCE_METHOD_START - this.emit(Event.UPDATE_INSTANCE_BEFORE, this); - - //GENERATED_UPDATE_INSTANCE_OPTIONS_START - if (property === 'domComponent') { - this.instance.domComponent = this.domComponent; - this.emit( - Event.UPDATE_INSTANCE_PROPERTY, - { - component : this, - property : 'domComponent', - instanceProperty : 'domComponent' - } - ); - if (property !== 'all') { - return; - } - } - //GENERATED_UPDATE_INSTANCE_OPTIONS_END - - //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_START - //GENERATED_TEMPLATE_UPDATE_INSTANCE_OPTIONS_END - - this.emit(Event.UPDATE_INSTANCE_AFTER, this); - //GENERATED_UPDATE_INSTANCE_METHOD_END - - //CUSTOM_UPDATE_INSTANCE_METHOD_START - //CUSTOM_UPDATE_INSTANCE_METHOD_END - - //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_START - //GENERATED_UPDATE_INSTANCE_METHOD_AFTER_END - - } - - /** - * updateFromInstance() - * - Updates this object by copying the values of its instance into the current object. - * @param property - */ - updateFromInstance(property) { - - //GENERATED_UPDATE_FROM_INSTANCE_METHOD_START - this.emit(Event.UPDATE_FROM_INSTANCE_BEFORE, this); - - //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_START - if (property === 'domComponent' || property === 'all') { - this.domComponent = this.instance.domComponent; - this.emit( - Event.UPDATE_PROPERTY_FROM_INSTANCE, - { - component : this, - property : 'domComponent', - instanceProperty : 'domComponent' - } - ); - if (property !== 'all') { - return; - } - } - //GENERATED_UPDATE_FROM_INSTANCE_OPTIONS_END - - //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_START - //GENERATED_TEMPLATE_UPDATE_FROM_INSTANCE_OPTIONS_END - - this.emit(Event.UPDATE_FROM_INSTANCE_AFTER, this); - - //GENERATED_UPDATE_FROM_INSTANCE_METHOD_END - - //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_START - //CUSTOM_UPDATE_FROM_INSTANCE_METHOD_END - - //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_START - //GENERATED_UPDATE_FROM_INSTANCE_METHOD_AFTER_END - - } - //GENERATED_TEMPLATE_METHODS_END - - //GENERATED_METHODS_START - //GENERATED_METHODS_END - - //GENERATED_TEMPLATE_STATIC_METHODS_START - //GENERATED_TEMPLATE_STATIC_METHODS_END - - //GENERATED_STATIC_METHODS_START - //GENERATED_STATIC_METHODS_END - - //CUSTOM_IMPLEMENTATION_START - //CUSTOM_IMPLEMENTATION_END -} - -//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START -//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END - -//GENERATED_STATIC_OPTIONS_INIT_START -//GENERATED_STATIC_OPTIONS_INIT_END - -//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END - -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START -//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END - -module.exports = ComponentTouch; diff --git a/src/r3/r3-component/r3-component.js b/src/r3/r3-component/r3-component.js index 2899bc3..c207d0a 100644 --- a/src/r3/r3-component/r3-component.js +++ b/src/r3/r3-component/r3-component.js @@ -329,20 +329,21 @@ class Component extends R3Object { //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START Component.CODE = 0x0; -Component.DOM = 0x1; -Component.CANVAS = 0x2; -Component.TEST = 0x3; -Component.GEOMETRY = 0x4; -Component.BUFFER_GEOMETRY = 0x5; -Component.PLANE_GEOMETRY = 0x6; -Component.GRAPHICS = 0x7; -Component.IMAGE = 0x8; -Component.INPUT = 0x9; -Component.TOUCH = 0xa; -Component.MATERIAL = 0xb; -Component.MESH = 0xc; -Component.TEXTURE = 0xd; -Component.MAX_COMPONENT = 0xe; +Component.CODE_JS = 0x1; +Component.DOM = 0x2; +Component.DOM_CANVAS = 0x3; +Component.DOM_IMAGE = 0x4; +Component.GRAPHICS = 0x5; +Component.GRAPHICS_GEOMETRY = 0x6; +Component.GRAPHICS_GEOMETRY_BUFFER = 0x7; +Component.GRAPHICS_GEOMETRY_BUFFER_PLANE = 0x8; +Component.GRAPHICS_IMAGE = 0x9; +Component.GRAPHICS_MATERIAL = 0xa; +Component.GRAPHICS_MESH = 0xb; +Component.GRAPHICS_TEXTURE = 0xc; +Component.INPUT = 0xd; +Component.INPUT_TOUCH = 0xe; +Component.MAX_COMPONENT = 0xf; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-event.js b/src/r3/r3-event.js index 331d18f..1ee7b02 100644 --- a/src/r3/r3-event.js +++ b/src/r3/r3-event.js @@ -361,107 +361,101 @@ class Event { //GENERATED_EVENTS_START Event.BEFORE_RENDER = 0x1; Event.BLACKLISTED_COMPONENT_INSTANCE_REQUEST = 0x2; -Event.CANVAS_COMPONENT_INITIALIZED = 0x3; -Event.COMPONENT_CREATED = 0x4; -Event.COMPONENT_INITIALIZED = 0x5; -Event.CREATE_INSTANCE_BEFORE = 0x6; -Event.DISPOSE_INSTANCE = 0x7; -Event.DISPOSE_OBJECT = 0x8; -Event.DOM_COMPONENT_INITIALIZED = 0x9; -Event.ENTITY_CREATED = 0xa; -Event.ENTITY_INITIALIZED = 0xb; -Event.ENTITY_STARTED = 0xc; -Event.FINAL_INITIALIZE = 0xd; -Event.GET_API_URL = 0xe; -Event.GET_RUNTIME = 0xf; -Event.GET_WINDOW_SIZE = 0x10; -Event.GRAPHICS_COMPONENT_INITIALIZED = 0x11; -Event.IMAGE_COMPONENT_INITIALIZED = 0x12; -Event.IMAGE_INSTANCE_CREATED = 0x13; -Event.INPUT_COMPONENT_INITIALIZED = 0x14; -Event.INSTANCE_CREATED = 0x15; -Event.INSTANCE_DISPOSED = 0x16; -Event.KEYBOARD_DOWN = 0x17; -Event.KEYBOARD_UP = 0x18; -Event.MOUSE_DOWN = 0x19; -Event.MOUSE_MOVE = 0x1a; -Event.MOUSE_UP = 0x1b; -Event.MOUSE_WHEEL = 0x1c; -Event.OBJECT_CREATED = 0x1d; -Event.OBJECT_PROPERTY_UPDATE = 0x1e; -Event.OBJECT_PROPERTY_UPDATED = 0x1f; -Event.ON_READY_STATE_CHANGE = 0x20; -Event.PAUSE = 0x21; -Event.PROJECT_INITIALIZED = 0x22; -Event.RESTART = 0x23; -Event.RUNTIME_CREATED = 0x24; -Event.SLIDER_ENTITY_INITIALIZED = 0x25; -Event.START = 0x26; -Event.TOUCH_CANCEL = 0x27; -Event.TOUCH_COMPONENT_INITIALIZED = 0x28; -Event.TOUCH_END = 0x29; -Event.TOUCH_MOVE = 0x2a; -Event.TOUCH_START = 0x2b; -Event.UPDATE_FROM_INSTANCE_AFTER = 0x2c; -Event.UPDATE_FROM_INSTANCE_BEFORE = 0x2d; -Event.UPDATE_INSTANCE_AFTER = 0x2e; -Event.UPDATE_INSTANCE_BEFORE = 0x2f; -Event.UPDATE_INSTANCE_PROPERTY = 0x30; -Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x31; -Event.MAX_EVENTS = 0x32; +Event.COMPONENT_CREATED = 0x3; +Event.COMPONENT_INITIALIZED = 0x4; +Event.CREATE_INSTANCE_BEFORE = 0x5; +Event.DISPOSE_INSTANCE = 0x6; +Event.DISPOSE_OBJECT = 0x7; +Event.DOM_COMPONENT_INITIALIZED = 0x8; +Event.ENTITY_CREATED = 0x9; +Event.ENTITY_INITIALIZED = 0xa; +Event.ENTITY_STARTED = 0xb; +Event.FINAL_INITIALIZE = 0xc; +Event.GET_API_URL = 0xd; +Event.GET_RUNTIME = 0xe; +Event.GET_WINDOW_SIZE = 0xf; +Event.GRAPHICS_COMPONENT_INITIALIZED = 0x10; +Event.IMAGE_INSTANCE_CREATED = 0x11; +Event.INPUT_COMPONENT_INITIALIZED = 0x12; +Event.INSTANCE_CREATED = 0x13; +Event.INSTANCE_DISPOSED = 0x14; +Event.KEYBOARD_DOWN = 0x15; +Event.KEYBOARD_UP = 0x16; +Event.MOUSE_DOWN = 0x17; +Event.MOUSE_MOVE = 0x18; +Event.MOUSE_UP = 0x19; +Event.MOUSE_WHEEL = 0x1a; +Event.OBJECT_CREATED = 0x1b; +Event.OBJECT_PROPERTY_UPDATE = 0x1c; +Event.OBJECT_PROPERTY_UPDATED = 0x1d; +Event.ON_READY_STATE_CHANGE = 0x1e; +Event.PAUSE = 0x1f; +Event.PROJECT_INITIALIZED = 0x20; +Event.RESTART = 0x21; +Event.RUNTIME_CREATED = 0x22; +Event.SLIDER_ENTITY_INITIALIZED = 0x23; +Event.START = 0x24; +Event.TOUCH_CANCEL = 0x25; +Event.TOUCH_END = 0x26; +Event.TOUCH_MOVE = 0x27; +Event.TOUCH_START = 0x28; +Event.UPDATE_FROM_INSTANCE_AFTER = 0x29; +Event.UPDATE_FROM_INSTANCE_BEFORE = 0x2a; +Event.UPDATE_INSTANCE_AFTER = 0x2b; +Event.UPDATE_INSTANCE_BEFORE = 0x2c; +Event.UPDATE_INSTANCE_PROPERTY = 0x2d; +Event.UPDATE_PROPERTY_FROM_INSTANCE = 0x2e; +Event.MAX_EVENTS = 0x2f; Event.GetEventName = function(eventId) { switch(eventId) { case 0x1 : return 'before_render'; case 0x2 : return 'blacklisted_component_instance_request'; - case 0x3 : return 'canvas_component_initialized'; - case 0x4 : return 'component_created'; - case 0x5 : return 'component_initialized'; - case 0x6 : return 'create_instance_before'; - case 0x7 : return 'dispose_instance'; - case 0x8 : return 'dispose_object'; - case 0x9 : return 'dom_component_initialized'; - case 0xa : return 'entity_created'; - case 0xb : return 'entity_initialized'; - case 0xc : return 'entity_started'; - case 0xd : return 'final_initialize'; - case 0xe : return 'get_api_url'; - case 0xf : return 'get_runtime'; - case 0x10 : return 'get_window_size'; - case 0x11 : return 'graphics_component_initialized'; - case 0x12 : return 'image_component_initialized'; - case 0x13 : return 'image_instance_created'; - case 0x14 : return 'input_component_initialized'; - case 0x15 : return 'instance_created'; - case 0x16 : return 'instance_disposed'; - case 0x17 : return 'keyboard_down'; - case 0x18 : return 'keyboard_up'; - case 0x19 : return 'mouse_down'; - case 0x1a : return 'mouse_move'; - case 0x1b : return 'mouse_up'; - case 0x1c : return 'mouse_wheel'; - case 0x1d : return 'object_created'; - case 0x1e : return 'object_property_update'; - case 0x1f : return 'object_property_updated'; - case 0x20 : return 'on_ready_state_change'; - case 0x21 : return 'pause'; - case 0x22 : return 'project_initialized'; - case 0x23 : return 'restart'; - case 0x24 : return 'runtime_created'; - case 0x25 : return 'slider_entity_initialized'; - case 0x26 : return 'start'; - case 0x27 : return 'touch_cancel'; - case 0x28 : return 'touch_component_initialized'; - case 0x29 : return 'touch_end'; - case 0x2a : return 'touch_move'; - case 0x2b : return 'touch_start'; - case 0x2c : return 'update_from_instance_after'; - case 0x2d : return 'update_from_instance_before'; - case 0x2e : return 'update_instance_after'; - case 0x2f : return 'update_instance_before'; - case 0x30 : return 'update_instance_property'; - case 0x31 : return 'update_property_from_instance'; + case 0x3 : return 'component_created'; + case 0x4 : return 'component_initialized'; + case 0x5 : return 'create_instance_before'; + case 0x6 : return 'dispose_instance'; + case 0x7 : return 'dispose_object'; + case 0x8 : return 'dom_component_initialized'; + case 0x9 : return 'entity_created'; + case 0xa : return 'entity_initialized'; + case 0xb : return 'entity_started'; + case 0xc : return 'final_initialize'; + case 0xd : return 'get_api_url'; + case 0xe : return 'get_runtime'; + case 0xf : return 'get_window_size'; + case 0x10 : return 'graphics_component_initialized'; + case 0x11 : return 'image_instance_created'; + case 0x12 : return 'input_component_initialized'; + case 0x13 : return 'instance_created'; + case 0x14 : return 'instance_disposed'; + case 0x15 : return 'keyboard_down'; + case 0x16 : return 'keyboard_up'; + case 0x17 : return 'mouse_down'; + case 0x18 : return 'mouse_move'; + case 0x19 : return 'mouse_up'; + case 0x1a : return 'mouse_wheel'; + case 0x1b : return 'object_created'; + case 0x1c : return 'object_property_update'; + case 0x1d : return 'object_property_updated'; + case 0x1e : return 'on_ready_state_change'; + case 0x1f : return 'pause'; + case 0x20 : return 'project_initialized'; + case 0x21 : return 'restart'; + case 0x22 : return 'runtime_created'; + case 0x23 : return 'slider_entity_initialized'; + case 0x24 : return 'start'; + case 0x25 : return 'touch_cancel'; + case 0x26 : return 'touch_end'; + case 0x27 : return 'touch_move'; + case 0x28 : return 'touch_start'; + case 0x29 : return 'update_from_instance_after'; + case 0x2a : return 'update_from_instance_before'; + case 0x2b : return 'update_instance_after'; + case 0x2c : return 'update_instance_before'; + case 0x2d : return 'update_instance_property'; + case 0x2e : return 'update_property_from_instance'; default : throw new Error('Event type not defined : ' + eventId); } diff --git a/src/r3/r3-object/index.js b/src/r3/r3-object/index.js index b8c9846..6d6eaba 100644 --- a/src/r3/r3-object/index.js +++ b/src/r3/r3-object/index.js @@ -5,19 +5,20 @@ const Entity = require('../r3-entity/r3-entity.js'); const EntitySlider = require('../r3-entity/r3-entity-slider.js'); const Component = require('../r3-component/r3-component.js'); const ComponentCode = require('../r3-component/r3-component-code.js'); +const ComponentCodeJS = require('../r3-component/r3-component-code-j-s.js'); const ComponentDOM = require('../r3-component/r3-component-d-o-m.js'); -const ComponentCanvas = require('../r3-component/r3-component-canvas.js'); -const ComponentTest = require('../r3-component/r3-component-test.js'); -const ComponentGeometry = require('../r3-component/r3-component-geometry.js'); -const ComponentBufferGeometry = require('../r3-component/r3-component-buffer-geometry.js'); -const ComponentPlaneGeometry = require('../r3-component/r3-component-plane-geometry.js'); +const ComponentDOMCanvas = require('../r3-component/r3-component-d-o-m-canvas.js'); +const ComponentDOMImage = require('../r3-component/r3-component-d-o-m-image.js'); const ComponentGraphics = require('../r3-component/r3-component-graphics.js'); -const ComponentImage = require('../r3-component/r3-component-image.js'); +const ComponentGraphicsGeometry = require('../r3-component/r3-component-graphics-geometry.js'); +const ComponentGraphicsGeometryBuffer = require('../r3-component/r3-component-graphics-geometry-buffer.js'); +const ComponentGraphicsGeometryBufferPlane = require('../r3-component/r3-component-graphics-geometry-buffer-plane.js'); +const ComponentGraphicsImage = require('../r3-component/r3-component-graphics-image.js'); +const ComponentGraphicsMaterial = require('../r3-component/r3-component-graphics-material.js'); +const ComponentGraphicsMesh = require('../r3-component/r3-component-graphics-mesh.js'); +const ComponentGraphicsTexture = require('../r3-component/r3-component-graphics-texture.js'); const ComponentInput = require('../r3-component/r3-component-input.js'); -const ComponentTouch = require('../r3-component/r3-component-touch.js'); -const ComponentMaterial = require('../r3-component/r3-component-material.js'); -const ComponentMesh = require('../r3-component/r3-component-mesh.js'); -const ComponentTexture = require('../r3-component/r3-component-texture.js'); +const ComponentInputTouch = require('../r3-component/r3-component-input-touch.js'); //GENERATED_IMPORTS_END //GENERATED_INDEX_BODY_START @@ -26,19 +27,20 @@ R3Object.Entity = Entity; R3Object.Entity.Slider = EntitySlider; R3Object.Component = Component; R3Object.Component.Code = ComponentCode; +R3Object.Component.Code.JS = ComponentCodeJS; R3Object.Component.DOM = ComponentDOM; -R3Object.Component.DOM.Canvas = ComponentCanvas; -R3Object.Component.DOM.Test = ComponentTest; -R3Object.Component.Geometry = ComponentGeometry; -R3Object.Component.Geometry.BufferGeometry = ComponentBufferGeometry; -R3Object.Component.Geometry.BufferGeometry.PlaneGeometry = ComponentPlaneGeometry; +R3Object.Component.DOM.Canvas = ComponentDOMCanvas; +R3Object.Component.DOM.Image = ComponentDOMImage; R3Object.Component.Graphics = ComponentGraphics; -R3Object.Component.Graphics.Image = ComponentImage; +R3Object.Component.Graphics.Geometry = ComponentGraphicsGeometry; +R3Object.Component.Graphics.Geometry.Buffer = ComponentGraphicsGeometryBuffer; +R3Object.Component.Graphics.Geometry.Buffer.Plane = ComponentGraphicsGeometryBufferPlane; +R3Object.Component.Graphics.Image = ComponentGraphicsImage; +R3Object.Component.Graphics.Material = ComponentGraphicsMaterial; +R3Object.Component.Graphics.Mesh = ComponentGraphicsMesh; +R3Object.Component.Graphics.Texture = ComponentGraphicsTexture; R3Object.Component.Input = ComponentInput; -R3Object.Component.Input.Touch = ComponentTouch; -R3Object.Component.Material = ComponentMaterial; -R3Object.Component.Mesh = ComponentMesh; -R3Object.Component.Texture = ComponentTexture; +R3Object.Component.Input.Touch = ComponentInputTouch; //GENERATED_INDEX_BODY_END //GENERATED_EXPORTS_START diff --git a/src/r3/r3-object/r3-object.js b/src/r3/r3-object/r3-object.js index 58d0494..624b214 100644 --- a/src/r3/r3-object/r3-object.js +++ b/src/r3/r3-object/r3-object.js @@ -416,20 +416,21 @@ R3Object.ENTITY = 0x1; R3Object.ENTITY_SLIDER = 0x2; R3Object.COMPONENT = 0x3; R3Object.COMPONENT_CODE = 0x4; -R3Object.COMPONENT_DOM = 0x5; -R3Object.COMPONENT_CANVAS = 0x6; -R3Object.COMPONENT_TEST = 0x7; -R3Object.COMPONENT_GEOMETRY = 0x8; -R3Object.COMPONENT_BUFFER_GEOMETRY = 0x9; -R3Object.COMPONENT_PLANE_GEOMETRY = 0xa; -R3Object.COMPONENT_GRAPHICS = 0xb; -R3Object.COMPONENT_IMAGE = 0xc; -R3Object.COMPONENT_INPUT = 0xd; -R3Object.COMPONENT_TOUCH = 0xe; -R3Object.COMPONENT_MATERIAL = 0xf; -R3Object.COMPONENT_MESH = 0x10; -R3Object.COMPONENT_TEXTURE = 0x11; -R3Object.MAX_R3OBJECT = 0x12; +R3Object.COMPONENT_CODE_JS = 0x5; +R3Object.COMPONENT_DOM = 0x6; +R3Object.COMPONENT_DOM_CANVAS = 0x7; +R3Object.COMPONENT_DOM_IMAGE = 0x8; +R3Object.COMPONENT_GRAPHICS = 0x9; +R3Object.COMPONENT_GRAPHICS_GEOMETRY = 0xa; +R3Object.COMPONENT_GRAPHICS_GEOMETRY_BUFFER = 0xb; +R3Object.COMPONENT_GRAPHICS_GEOMETRY_BUFFER_PLANE = 0xc; +R3Object.COMPONENT_GRAPHICS_IMAGE = 0xd; +R3Object.COMPONENT_GRAPHICS_MATERIAL = 0xe; +R3Object.COMPONENT_GRAPHICS_MESH = 0xf; +R3Object.COMPONENT_GRAPHICS_TEXTURE = 0x10; +R3Object.COMPONENT_INPUT = 0x11; +R3Object.COMPONENT_INPUT_TOUCH = 0x12; +R3Object.MAX_R3OBJECT = 0x13; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-runtime/index.js b/src/r3/r3-runtime/index.js index a70ad53..be4e8c6 100644 --- a/src/r3/r3-runtime/index.js +++ b/src/r3/r3-runtime/index.js @@ -1,36 +1,44 @@ //GENERATED_IMPORTS_START const Runtime = require('./r3-runtime.js'); +const RuntimeAudio = require('./r3-runtime-audio.js'); +const RuntimeAudioThree = require('./r3-runtime-audio-three.js'); +const RuntimeCode = require('./r3-runtime-code.js'); +const RuntimeCodeJS = require('./r3-runtime-code-j-s.js'); const RuntimeCoder = require('./r3-runtime-coder.js'); -const RuntimeCodeMirror = require('./r3-runtime-code-mirror.js'); +const RuntimeCoderCodeMirror = require('./r3-runtime-coder-code-mirror.js'); const RuntimeDOM = require('./r3-runtime-d-o-m.js'); -const RuntimeJSDOM = require('./r3-runtime-j-s-d-o-m.js'); -const RuntimeWebDOM = require('./r3-runtime-web-d-o-m.js'); +const RuntimeDOMJS = require('./r3-runtime-d-o-m-j-s.js'); +const RuntimeDOMWeb = require('./r3-runtime-d-o-m-web.js'); const RuntimeGUI = require('./r3-runtime-g-u-i.js'); -const RuntimeControlKit = require('./r3-runtime-control-kit.js'); +const RuntimeGUIControlKit = require('./r3-runtime-g-u-i-control-kit.js'); const RuntimeGraphics = require('./r3-runtime-graphics.js'); -const RuntimeThree = require('./r3-runtime-three.js'); +const RuntimeGraphicsThree = require('./r3-runtime-graphics-three.js'); const RuntimePhysics = require('./r3-runtime-physics.js'); -const RuntimeBullet = require('./r3-runtime-bullet.js'); +const RuntimePhysicsBullet = require('./r3-runtime-physics-bullet.js'); const RuntimeSocket = require('./r3-runtime-socket.js'); const RuntimeStatistics = require('./r3-runtime-statistics.js'); -const RuntimeStats = require('./r3-runtime-stats.js'); +const RuntimeStatisticsStats = require('./r3-runtime-statistics-stats.js'); //GENERATED_IMPORTS_END //GENERATED_INDEX_BODY_START +Runtime.Audio = RuntimeAudio; +Runtime.Audio.Three = RuntimeAudioThree; +Runtime.Code = RuntimeCode; +Runtime.Code.JS = RuntimeCodeJS; Runtime.Coder = RuntimeCoder; -Runtime.Coder.CodeMirror = RuntimeCodeMirror; +Runtime.Coder.CodeMirror = RuntimeCoderCodeMirror; Runtime.DOM = RuntimeDOM; -Runtime.DOM.JSDOM = RuntimeJSDOM; -Runtime.DOM.WebDOM = RuntimeWebDOM; +Runtime.DOM.JS = RuntimeDOMJS; +Runtime.DOM.Web = RuntimeDOMWeb; Runtime.GUI = RuntimeGUI; -Runtime.GUI.ControlKit = RuntimeControlKit; +Runtime.GUI.ControlKit = RuntimeGUIControlKit; Runtime.Graphics = RuntimeGraphics; -Runtime.Graphics.Three = RuntimeThree; +Runtime.Graphics.Three = RuntimeGraphicsThree; Runtime.Physics = RuntimePhysics; -Runtime.Physics.Bullet = RuntimeBullet; +Runtime.Physics.Bullet = RuntimePhysicsBullet; Runtime.Socket = RuntimeSocket; Runtime.Statistics = RuntimeStatistics; -Runtime.Statistics.Stats = RuntimeStats; +Runtime.Statistics.Stats = RuntimeStatisticsStats; //GENERATED_INDEX_BODY_END //GENERATED_EXPORTS_START diff --git a/src/r3/r3-runtime/r3-runtime-audio-three.js b/src/r3/r3-runtime/r3-runtime-audio-three.js new file mode 100644 index 0000000..7c90bf8 --- /dev/null +++ b/src/r3/r3-runtime/r3-runtime-audio-three.js @@ -0,0 +1,190 @@ +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('.././r3-event'); +const Utils = require('.././r3-utils'); +const RuntimeAudio = require('./r3-runtime-audio.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Runtime.Audio.Three + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeAudio] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeAudioThree] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + serverSide=false - Flag which indicates whether or not this runtime is intended for server side + clientSide=true - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_METHODS_START + buildInstance(component) - Creates a runtime instance object based on the R3.Component representing it. + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class RuntimeAudioThree extends RuntimeAudio { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + Object.assign(this, options); + + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + + /** + * buildInstance() + * - Creates a runtime instance object based on the R3.Component representing it. + * @param component + */ + buildInstance(component) { + + //GENERATED_BUILD_INSTANCE_METHOD_START + //GENERATED_BUILD_INSTANCE_METHOD_END + + //CUSTOM_BUILD_INSTANCE_METHOD_START + //CUSTOM_BUILD_INSTANCE_METHOD_END + + //GENERATED_BUILD_INSTANCE_METHOD_AFTER_START + //GENERATED_BUILD_INSTANCE_METHOD_AFTER_END + + } + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END + +} + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = RuntimeAudioThree; diff --git a/src/r3/r3-runtime/r3-runtime-audio.js b/src/r3/r3-runtime/r3-runtime-audio.js new file mode 100644 index 0000000..d089f6b --- /dev/null +++ b/src/r3/r3-runtime/r3-runtime-audio.js @@ -0,0 +1,137 @@ +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('.././r3-event'); +const Runtime = require('./r3-runtime.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Runtime.Audio + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeAudio] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + name=this.constructor.name - Name of the runtime + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_METHODS_START + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class RuntimeAudio extends Runtime { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * name - Name of the runtime + */ + if (typeof options.name === 'undefined') { + options.name = this.constructor.name; + } + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + Object.assign(this, options); + + Event.Emit(Event.RUNTIME_CREATED, this); + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = RuntimeAudio; diff --git a/src/r3/r3-runtime/r3-runtime-code-j-s.js b/src/r3/r3-runtime/r3-runtime-code-j-s.js new file mode 100644 index 0000000..e647c58 --- /dev/null +++ b/src/r3/r3-runtime/r3-runtime-code-j-s.js @@ -0,0 +1,190 @@ +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('.././r3-event'); +const Utils = require('.././r3-utils'); +const RuntimeCode = require('./r3-runtime-code.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Runtime.Code.JS + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Inherited from RuntimeCode] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeCodeJS] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + serverSide=true - Flag which indicates whether or not this runtime is intended for server side + clientSide=true - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_METHODS_START + buildInstance(component) - Creates a runtime instance object based on the R3.Component representing it. + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class RuntimeCodeJS extends RuntimeCode { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = true; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + Object.assign(this, options); + + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + + /** + * buildInstance() + * - Creates a runtime instance object based on the R3.Component representing it. + * @param component + */ + buildInstance(component) { + + //GENERATED_BUILD_INSTANCE_METHOD_START + //GENERATED_BUILD_INSTANCE_METHOD_END + + //CUSTOM_BUILD_INSTANCE_METHOD_START + //CUSTOM_BUILD_INSTANCE_METHOD_END + + //GENERATED_BUILD_INSTANCE_METHOD_AFTER_START + //GENERATED_BUILD_INSTANCE_METHOD_AFTER_END + + } + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END + +} + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = RuntimeCodeJS; diff --git a/src/r3/r3-runtime/r3-runtime-code.js b/src/r3/r3-runtime/r3-runtime-code.js new file mode 100644 index 0000000..e83a4bc --- /dev/null +++ b/src/r3/r3-runtime/r3-runtime-code.js @@ -0,0 +1,137 @@ +//GENERATED_IMPORTS_START +//GENERATED_IMPORTS_END + +//CUSTOM_IMPORTS_START +//CUSTOM_IMPORTS_END + +const Event = require('.././r3-event'); +const Runtime = require('./r3-runtime.js'); + +/** + + GENERATED_INHERITED_START + + Class R3.Runtime.Code + [Inherited from Runtime] + + Inherited Properties: + + + + Inherited Static Properties: + + + + Inherited Methods: + + + + Inherited Static Methods: + + + + [Belonging to RuntimeCode] + + Properties: + + + + Static Properties: + + + + Methods: + + + + Static Methods: + + + + GENERATED_INHERITED_END + + TEMPLATE_OPTIONS_START + name=this.constructor.name - Name of the runtime + TEMPLATE_OPTIONS_END + + CUSTOM_OPTIONS_START + CUSTOM_OPTIONS_END + + TEMPLATE_STATIC_OPTIONS_START + TEMPLATE_STATIC_OPTIONS_END + + CUSTOM_STATIC_OPTIONS_START + CUSTOM_STATIC_OPTIONS_END + + TEMPLATE_METHODS_START + TEMPLATE_METHODS_END + + CUSTOM_METHODS_START + CUSTOM_METHODS_END + + TEMPLATE_STATIC_METHODS_START + TEMPLATE_STATIC_METHODS_END + + CUSTOM_STATIC_METHODS_START + CUSTOM_STATIC_METHODS_END + + **/ + +class RuntimeCode extends Runtime { + + //GENERATED_CONSTRUCTOR_START + constructor(options) { + + if (typeof options === 'undefined') { + options = {}; + } + + super(options); + + //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * name - Name of the runtime + */ + if (typeof options.name === 'undefined') { + options.name = this.constructor.name; + } + //GENERATED_TEMPLATE_OPTIONS_INIT_END + + //GENERATED_OPTIONS_INIT_START + //GENERATED_OPTIONS_INIT_END + + Object.assign(this, options); + + Event.Emit(Event.RUNTIME_CREATED, this); + } + //GENERATED_CONSTRUCTOR_END + + //GENERATED_TEMPLATE_METHODS_START + //GENERATED_TEMPLATE_METHODS_END + + //GENERATED_METHODS_START + //GENERATED_METHODS_END + + //GENERATED_TEMPLATE_STATIC_METHODS_START + //GENERATED_TEMPLATE_STATIC_METHODS_END + + //GENERATED_STATIC_METHODS_START + //GENERATED_STATIC_METHODS_END + + //CUSTOM_IMPLEMENTATION_START + //CUSTOM_IMPLEMENTATION_END +} + +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_START +//GENERATED_TEMPLATE_STATIC_OPTIONS_INIT_END + +//GENERATED_STATIC_OPTIONS_INIT_START +//GENERATED_STATIC_OPTIONS_INIT_END + +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +//GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END + +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START +//CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END + +module.exports = RuntimeCode; diff --git a/src/r3/r3-runtime/r3-runtime-code-mirror.js b/src/r3/r3-runtime/r3-runtime-coder-code-mirror.js similarity index 73% rename from src/r3/r3-runtime/r3-runtime-code-mirror.js rename to src/r3/r3-runtime/r3-runtime-coder-code-mirror.js index aee18d7..264147b 100644 --- a/src/r3/r3-runtime/r3-runtime-code-mirror.js +++ b/src/r3/r3-runtime/r3-runtime-coder-code-mirror.js @@ -49,7 +49,7 @@ const RuntimeCoder = require('./r3-runtime-coder.js'); - [Belonging to RuntimeCodeMirror] + [Belonging to RuntimeCoderCodeMirror] Properties: @@ -70,6 +70,9 @@ const RuntimeCoder = require('./r3-runtime-coder.js'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + serverSide=false - Flag which indicates whether or not this runtime is intended for server side + clientSide=true - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -96,7 +99,7 @@ const RuntimeCoder = require('./r3-runtime-coder.js'); **/ -class RuntimeCodeMirror extends RuntimeCoder { +class RuntimeCoderCodeMirror extends RuntimeCoder { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -108,6 +111,25 @@ class RuntimeCodeMirror extends RuntimeCoder { super(options); //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -165,4 +187,4 @@ class RuntimeCodeMirror extends RuntimeCoder { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = RuntimeCodeMirror; +module.exports = RuntimeCoderCodeMirror; diff --git a/src/r3/r3-runtime/r3-runtime-web-d-o-m.js b/src/r3/r3-runtime/r3-runtime-d-o-m-j-s.js similarity index 73% rename from src/r3/r3-runtime/r3-runtime-web-d-o-m.js rename to src/r3/r3-runtime/r3-runtime-d-o-m-j-s.js index 46619b0..371c129 100644 --- a/src/r3/r3-runtime/r3-runtime-web-d-o-m.js +++ b/src/r3/r3-runtime/r3-runtime-d-o-m-j-s.js @@ -2,8 +2,6 @@ //GENERATED_IMPORTS_END //CUSTOM_IMPORTS_START -const ComponentCanvas = require('../r3-component/r3-component-canvas'); -const ComponentImage = require('../r3-component/r3-component-image'); //CUSTOM_IMPORTS_END const Event = require('.././r3-event'); @@ -14,7 +12,7 @@ const RuntimeDOM = require('./r3-runtime-d-o-m.js'); GENERATED_INHERITED_START - Class R3.Runtime.DOM.WebDOM + Class R3.Runtime.DOM.JS [Inherited from Runtime] Inherited Properties: @@ -51,7 +49,7 @@ const RuntimeDOM = require('./r3-runtime-d-o-m.js'); - [Belonging to RuntimeWebDOM] + [Belonging to RuntimeDOMJS] Properties: @@ -72,6 +70,9 @@ const RuntimeDOM = require('./r3-runtime-d-o-m.js'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + serverSide=true - Flag which indicates whether or not this runtime is intended for server side + clientSide=false - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -98,7 +99,7 @@ const RuntimeDOM = require('./r3-runtime-d-o-m.js'); **/ -class RuntimeWebDOM extends RuntimeDOM { +class RuntimeDOMJS extends RuntimeDOM { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -110,6 +111,25 @@ class RuntimeWebDOM extends RuntimeDOM { super(options); //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = true; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = false; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -133,20 +153,6 @@ class RuntimeWebDOM extends RuntimeDOM { //GENERATED_BUILD_INSTANCE_METHOD_END //CUSTOM_BUILD_INSTANCE_METHOD_START - if (component instanceof ComponentCanvas) { - let canvas = document.createElement('canvas'); - canvas.setAttribute('width', component.width); - canvas.setAttribute('height', component.height); - canvas.setAttribute('style', component.style); - return canvas; - } - - if (component instanceof ComponentImage) { - let image = document.createElement('img'); - image.setAttribute('src', component.src); - image.setAttribute('alt', component.alt); - return image; - } //CUSTOM_BUILD_INSTANCE_METHOD_END //GENERATED_BUILD_INSTANCE_METHOD_AFTER_START @@ -181,4 +187,4 @@ class RuntimeWebDOM extends RuntimeDOM { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = RuntimeWebDOM; +module.exports = RuntimeDOMJS; diff --git a/src/r3/r3-runtime/r3-runtime-j-s-d-o-m.js b/src/r3/r3-runtime/r3-runtime-d-o-m-web.js similarity index 73% rename from src/r3/r3-runtime/r3-runtime-j-s-d-o-m.js rename to src/r3/r3-runtime/r3-runtime-d-o-m-web.js index 2b7383a..abb15f5 100644 --- a/src/r3/r3-runtime/r3-runtime-j-s-d-o-m.js +++ b/src/r3/r3-runtime/r3-runtime-d-o-m-web.js @@ -2,9 +2,6 @@ //GENERATED_IMPORTS_END //CUSTOM_IMPORTS_START -const jsdom = require('jsdom'); -const {JSDOM} = jsdom; -const ComponentCanvas = require('../r3-component/r3-component-canvas'); //CUSTOM_IMPORTS_END const Event = require('.././r3-event'); @@ -15,7 +12,7 @@ const RuntimeDOM = require('./r3-runtime-d-o-m.js'); GENERATED_INHERITED_START - Class R3.Runtime.DOM.JSDOM + Class R3.Runtime.DOM.Web [Inherited from Runtime] Inherited Properties: @@ -52,11 +49,11 @@ const RuntimeDOM = require('./r3-runtime-d-o-m.js'); - [Belonging to RuntimeJSDOM] + [Belonging to RuntimeDOMWeb] Properties: - - dom (Default value new JSDOM(`

R3 NodeJS DOM

`);) + Static Properties: @@ -73,10 +70,12 @@ const RuntimeDOM = require('./r3-runtime-d-o-m.js'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + serverSide=false - Flag which indicates whether or not this runtime is intended for server side + clientSide=true - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START - dom=new JSDOM(`

R3 NodeJS DOM

`); CUSTOM_OPTIONS_END TEMPLATE_STATIC_OPTIONS_START @@ -100,7 +99,7 @@ const RuntimeDOM = require('./r3-runtime-d-o-m.js'); **/ -class RuntimeJSDOM extends RuntimeDOM { +class RuntimeDOMWeb extends RuntimeDOM { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -112,15 +111,28 @@ class RuntimeJSDOM extends RuntimeDOM { super(options); //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START - /** - * dom - No comment - */ - if (typeof options.dom === 'undefined') { - options.dom = new JSDOM(`

R3 NodeJS DOM

`);; - } //GENERATED_OPTIONS_INIT_END Object.assign(this, options); @@ -141,13 +153,6 @@ class RuntimeJSDOM extends RuntimeDOM { //GENERATED_BUILD_INSTANCE_METHOD_END //CUSTOM_BUILD_INSTANCE_METHOD_START - if (component instanceof ComponentCanvas) { - let canvas = this.dom.window.document.createElement('canvas'); - canvas.setAttribute('width', component.width); - canvas.setAttribute('height', component.height); - canvas.setAttribute('style', component.style); - return canvas; - } //CUSTOM_BUILD_INSTANCE_METHOD_END //GENERATED_BUILD_INSTANCE_METHOD_AFTER_START @@ -182,4 +187,4 @@ class RuntimeJSDOM extends RuntimeDOM { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = RuntimeJSDOM; +module.exports = RuntimeDOMWeb; diff --git a/src/r3/r3-runtime/r3-runtime-control-kit.js b/src/r3/r3-runtime/r3-runtime-g-u-i-control-kit.js similarity index 73% rename from src/r3/r3-runtime/r3-runtime-control-kit.js rename to src/r3/r3-runtime/r3-runtime-g-u-i-control-kit.js index 4753301..d75dd1e 100644 --- a/src/r3/r3-runtime/r3-runtime-control-kit.js +++ b/src/r3/r3-runtime/r3-runtime-g-u-i-control-kit.js @@ -49,7 +49,7 @@ const RuntimeGUI = require('./r3-runtime-g-u-i.js'); - [Belonging to RuntimeControlKit] + [Belonging to RuntimeGUIControlKit] Properties: @@ -70,6 +70,9 @@ const RuntimeGUI = require('./r3-runtime-g-u-i.js'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + serverSide=false - Flag which indicates whether or not this runtime is intended for server side + clientSide=true - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -96,7 +99,7 @@ const RuntimeGUI = require('./r3-runtime-g-u-i.js'); **/ -class RuntimeControlKit extends RuntimeGUI { +class RuntimeGUIControlKit extends RuntimeGUI { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -108,6 +111,25 @@ class RuntimeControlKit extends RuntimeGUI { super(options); //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -165,4 +187,4 @@ class RuntimeControlKit extends RuntimeGUI { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = RuntimeControlKit; +module.exports = RuntimeGUIControlKit; diff --git a/src/r3/r3-runtime/r3-runtime-three.js b/src/r3/r3-runtime/r3-runtime-graphics-three.js similarity index 73% rename from src/r3/r3-runtime/r3-runtime-three.js rename to src/r3/r3-runtime/r3-runtime-graphics-three.js index 4872662..ab24f48 100644 --- a/src/r3/r3-runtime/r3-runtime-three.js +++ b/src/r3/r3-runtime/r3-runtime-graphics-three.js @@ -49,7 +49,7 @@ const RuntimeGraphics = require('./r3-runtime-graphics.js'); - [Belonging to RuntimeThree] + [Belonging to RuntimeGraphicsThree] Properties: @@ -70,6 +70,9 @@ const RuntimeGraphics = require('./r3-runtime-graphics.js'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + serverSide=false - Flag which indicates whether or not this runtime is intended for server side + clientSide=true - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -96,7 +99,7 @@ const RuntimeGraphics = require('./r3-runtime-graphics.js'); **/ -class RuntimeThree extends RuntimeGraphics { +class RuntimeGraphicsThree extends RuntimeGraphics { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -108,6 +111,25 @@ class RuntimeThree extends RuntimeGraphics { super(options); //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -165,4 +187,4 @@ class RuntimeThree extends RuntimeGraphics { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = RuntimeThree; +module.exports = RuntimeGraphicsThree; diff --git a/src/r3/r3-runtime/r3-runtime-bullet.js b/src/r3/r3-runtime/r3-runtime-physics-bullet.js similarity index 73% rename from src/r3/r3-runtime/r3-runtime-bullet.js rename to src/r3/r3-runtime/r3-runtime-physics-bullet.js index 6ab2986..067d829 100644 --- a/src/r3/r3-runtime/r3-runtime-bullet.js +++ b/src/r3/r3-runtime/r3-runtime-physics-bullet.js @@ -49,7 +49,7 @@ const RuntimePhysics = require('./r3-runtime-physics.js'); - [Belonging to RuntimeBullet] + [Belonging to RuntimePhysicsBullet] Properties: @@ -70,6 +70,9 @@ const RuntimePhysics = require('./r3-runtime-physics.js'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + serverSide=true - Flag which indicates whether or not this runtime is intended for server side + clientSide=false - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -96,7 +99,7 @@ const RuntimePhysics = require('./r3-runtime-physics.js'); **/ -class RuntimeBullet extends RuntimePhysics { +class RuntimePhysicsBullet extends RuntimePhysics { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -108,6 +111,25 @@ class RuntimeBullet extends RuntimePhysics { super(options); //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = true; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = false; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -165,4 +187,4 @@ class RuntimeBullet extends RuntimePhysics { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = RuntimeBullet; +module.exports = RuntimePhysicsBullet; diff --git a/src/r3/r3-runtime/r3-runtime-stats.js b/src/r3/r3-runtime/r3-runtime-statistics-stats.js similarity index 73% rename from src/r3/r3-runtime/r3-runtime-stats.js rename to src/r3/r3-runtime/r3-runtime-statistics-stats.js index 6762544..e9064ee 100644 --- a/src/r3/r3-runtime/r3-runtime-stats.js +++ b/src/r3/r3-runtime/r3-runtime-statistics-stats.js @@ -49,7 +49,7 @@ const RuntimeStatistics = require('./r3-runtime-statistics.js'); - [Belonging to RuntimeStats] + [Belonging to RuntimeStatisticsStats] Properties: @@ -70,6 +70,9 @@ const RuntimeStatistics = require('./r3-runtime-statistics.js'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + serverSide=false - Flag which indicates whether or not this runtime is intended for server side + clientSide=true - Flag which indicates whether or not this runtime is intended for client side + default=true - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START @@ -96,7 +99,7 @@ const RuntimeStatistics = require('./r3-runtime-statistics.js'); **/ -class RuntimeStats extends RuntimeStatistics { +class RuntimeStatisticsStats extends RuntimeStatistics { //GENERATED_CONSTRUCTOR_START constructor(options) { @@ -108,6 +111,25 @@ class RuntimeStats extends RuntimeStatistics { super(options); //GENERATED_TEMPLATE_OPTIONS_INIT_START + /** + * serverSide - Flag which indicates whether or not this runtime is intended for server side + */ + if (typeof options.serverSide === 'undefined') { + options.serverSide = false; + } + /** + * clientSide - Flag which indicates whether or not this runtime is intended for client side + */ + if (typeof options.clientSide === 'undefined') { + options.clientSide = true; + } + /** + * default - Flag which indicates whether or not this runtime is the default when there is no project + * specified runtime. + */ + if (typeof options.default === 'undefined') { + options.default = true; + } //GENERATED_TEMPLATE_OPTIONS_INIT_END //GENERATED_OPTIONS_INIT_START @@ -165,4 +187,4 @@ class RuntimeStats extends RuntimeStatistics { //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_END -module.exports = RuntimeStats; +module.exports = RuntimeStatisticsStats; diff --git a/src/r3/r3-runtime/r3-runtime.js b/src/r3/r3-runtime/r3-runtime.js index d9b5507..346eb61 100644 --- a/src/r3/r3-runtime/r3-runtime.js +++ b/src/r3/r3-runtime/r3-runtime.js @@ -88,20 +88,24 @@ class Runtime { //GENERATED_STATIC_OPTIONS_INIT_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START -Runtime.BASE_CODER = 0x0; -Runtime.BASE_DOM = 0x1; -Runtime.BASE_GUI = 0x2; -Runtime.BASE_GRAPHICS = 0x3; -Runtime.BASE_PHYSICS = 0x4; -Runtime.BASE_SOCKET = 0x5; -Runtime.BASE_STATISTICS = 0x6; -Runtime.CODE_MIRROR = 0x7; -Runtime.JSDOM = 0x8; -Runtime.WEB_DOM = 0x9; -Runtime.CONTROL_KIT = 0xa; -Runtime.THREE = 0xb; -Runtime.BULLET = 0xc; -Runtime.STATS = 0xd; +Runtime.BASE_AUDIO = 0x0; +Runtime.BASE_CODE = 0x1; +Runtime.BASE_CODER = 0x2; +Runtime.BASE_DOM = 0x3; +Runtime.BASE_GUI = 0x4; +Runtime.BASE_GRAPHICS = 0x5; +Runtime.BASE_PHYSICS = 0x6; +Runtime.BASE_SOCKET = 0x7; +Runtime.BASE_STATISTICS = 0x8; +Runtime.AUDIO_THREE = 0x9; +Runtime.CODE_JS = 0xa; +Runtime.CODER_CODE_MIRROR = 0xb; +Runtime.DOMJS = 0xc; +Runtime.DOM_WEB = 0xd; +Runtime.GUI_CONTROL_KIT = 0xe; +Runtime.GRAPHICS_THREE = 0xf; +Runtime.PHYSICS_BULLET = 0x10; +Runtime.STATISTICS_STATS = 0x11; //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_END //CUSTOM_OUT_OF_CLASS_IMPLEMENTATION_START diff --git a/src/r3/r3-system/r3-system-runtime.js b/src/r3/r3-system/r3-system-runtime.js index 210c3aa..060a6d0 100644 --- a/src/r3/r3-system/r3-system-runtime.js +++ b/src/r3/r3-system/r3-system-runtime.js @@ -1,4 +1,6 @@ //GENERATED_IMPORTS_START +const RuntimeAudio = require('../r3-runtime/r3-runtime-audio.js'); +const RuntimeCode = require('../r3-runtime/r3-runtime-code.js'); const RuntimeCoder = require('../r3-runtime/r3-runtime-coder.js'); const RuntimeDOM = require('../r3-runtime/r3-runtime-d-o-m.js'); const RuntimeGUI = require('../r3-runtime/r3-runtime-g-u-i.js'); @@ -7,30 +9,35 @@ const RuntimePhysics = require('../r3-runtime/r3-runtime-physics.js'); const RuntimeSocket = require('../r3-runtime/r3-runtime-socket.js'); const RuntimeStatistics = require('../r3-runtime/r3-runtime-statistics.js'); +// RuntimeAudio Runtimes +const RuntimeAudioThree = require('../r3-runtime/r3-runtime-audio-three.js'); + +// RuntimeCode Runtimes +const RuntimeCodeJS = require('../r3-runtime/r3-runtime-code-j-s.js'); + // RuntimeCoder Runtimes -const RuntimeCodeMirror = require('../r3-runtime/r3-runtime-code-mirror.js'); +const RuntimeCoderCodeMirror = require('../r3-runtime/r3-runtime-coder-code-mirror.js'); // RuntimeDOM Runtimes -const RuntimeJSDOM = require('../r3-runtime/r3-runtime-j-s-d-o-m.js'); -const RuntimeWebDOM = require('../r3-runtime/r3-runtime-web-d-o-m.js'); +const RuntimeDOMJS = require('../r3-runtime/r3-runtime-d-o-m-j-s.js'); +const RuntimeDOMWeb = require('../r3-runtime/r3-runtime-d-o-m-web.js'); // RuntimeGUI Runtimes -const RuntimeControlKit = require('../r3-runtime/r3-runtime-control-kit.js'); +const RuntimeGUIControlKit = require('../r3-runtime/r3-runtime-g-u-i-control-kit.js'); // RuntimeGraphics Runtimes -const RuntimeThree = require('../r3-runtime/r3-runtime-three.js'); +const RuntimeGraphicsThree = require('../r3-runtime/r3-runtime-graphics-three.js'); // RuntimePhysics Runtimes -const RuntimeBullet = require('../r3-runtime/r3-runtime-bullet.js'); +const RuntimePhysicsBullet = require('../r3-runtime/r3-runtime-physics-bullet.js'); // RuntimeSocket Runtimes // RuntimeStatistics Runtimes -const RuntimeStats = require('../r3-runtime/r3-runtime-stats.js'); +const RuntimeStatisticsStats = require('../r3-runtime/r3-runtime-statistics-stats.js'); //GENERATED_IMPORTS_END //CUSTOM_IMPORTS_START -const ComponentCode = require('../r3-component/r3-component-code.js'); const Utils = require('.././r3-utils.js'); //CUSTOM_IMPORTS_END @@ -280,46 +287,246 @@ class SystemRuntime extends System { //GENERATED_STATIC_ON_GET_RUNTIME_METHOD_START //GENERATED_RUNTIME_LOCATOR_START + if (object.runtimeClass === RuntimeAudio) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + throw new Error('No server side implementation for RuntimeAudio'); + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeAudio.Three === 'undefined') { + SystemRuntime.RuntimeAudio.Three = new RuntimeAudioThree(); + } + return SystemRuntime.RuntimeAudio.Three; + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeCode) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeCode.JS === 'undefined') { + SystemRuntime.RuntimeCode.JS = new RuntimeCodeJS(); + } + return SystemRuntime.RuntimeCode.JS; + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeCode.JS === 'undefined') { + SystemRuntime.RuntimeCode.JS = new RuntimeCodeJS(); + } + return SystemRuntime.RuntimeCode.JS; + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeCoder) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + throw new Error('No server side implementation for RuntimeCoder'); + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeCoder.CodeMirror === 'undefined') { + SystemRuntime.RuntimeCoder.CodeMirror = new RuntimeCoderCodeMirror(); + } + return SystemRuntime.RuntimeCoder.CodeMirror; + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeDOM) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeDOM.JS === 'undefined') { + SystemRuntime.RuntimeDOM.JS = new RuntimeDOMJS(); + } + return SystemRuntime.RuntimeDOM.JS; + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeDOM.Web === 'undefined') { + SystemRuntime.RuntimeDOM.Web = new RuntimeDOMWeb(); + } + return SystemRuntime.RuntimeDOM.Web; + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeGUI) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + throw new Error('No server side implementation for RuntimeGUI'); + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeGUI.ControlKit === 'undefined') { + SystemRuntime.RuntimeGUI.ControlKit = new RuntimeGUIControlKit(); + } + return SystemRuntime.RuntimeGUI.ControlKit; + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeGraphics) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + throw new Error('No server side implementation for RuntimeGraphics'); + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeGraphics.Three === 'undefined') { + SystemRuntime.RuntimeGraphics.Three = new RuntimeGraphicsThree(); + } + return SystemRuntime.RuntimeGraphics.Three; + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimePhysics) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimePhysics.Bullet === 'undefined') { + SystemRuntime.RuntimePhysics.Bullet = new RuntimePhysicsBullet(); + } + return SystemRuntime.RuntimePhysics.Bullet; + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + throw new Error('No client side implementation for RuntimePhysics'); + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeSocket) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + throw new Error('No server side implementation for RuntimeSocket'); + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + throw new Error('No client side implementation for RuntimeSocket'); + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } + + if (object.runtimeClass === RuntimeStatistics) { + + if (SystemRuntime.CurrentProject === null) { + /** + * We use the default runtime + */ + if (SystemRuntime.ServerSide) { + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_START + throw new Error('No server side implementation for RuntimeStatistics'); + //GENERATED_DEFAULT_SERVER_SIDE_RUNTIME_END + } else { + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_START + if (typeof SystemRuntime.RuntimeStatistics.Stats === 'undefined') { + SystemRuntime.RuntimeStatistics.Stats = new RuntimeStatisticsStats(); + } + return SystemRuntime.RuntimeStatistics.Stats; + //GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME_END + } + } else { + /** + * Get runtime from project + */ + console.log('todo : implement project based runtime here'); + } + } //GENERATED_RUNTIME_LOCATOR_END //GENERATED_STATIC_ON_GET_RUNTIME_METHOD_END //CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_START - /** - * DOM and Input Components are typically managed through - * the DOM. - */ - if ( - object.runtimeClass === RuntimeDOM - ) { - if (SystemRuntime.CurrentProject === null) { - - if (SystemRuntime.ServerSide) { - - if (!SystemRuntime.RuntimeDOM.JS) { - SystemRuntime.RuntimeDOM.JS = new RuntimeJSDOM(); - } - - return SystemRuntime.RuntimeDOM.JS; - - } else { - - if (!SystemRuntime.RuntimeDOM.Web) { - SystemRuntime.RuntimeDOM.Web = new RuntimeWebDOM(); - } - - return SystemRuntime.RuntimeDOM.Web; - - } - } else { - console.log('TODO: implement a project based DOM runtime'); - } - } - - - - if (object instanceof ComponentCode) { - - } //CUSTOM_STATIC_ON_GET_RUNTIME_METHOD_END } @@ -412,6 +619,8 @@ SystemRuntime.ServerSide = (typeof process !== 'undefined'); //GENERATED_STATIC_OPTIONS_INIT_END //GENERATED_OUT_OF_CLASS_IMPLEMENTATION_START +SystemRuntime.RuntimeAudio = {}; +SystemRuntime.RuntimeCode = {}; SystemRuntime.RuntimeCoder = {}; SystemRuntime.RuntimeDOM = {}; SystemRuntime.RuntimeGUI = {}; diff --git a/src/r3/r3.js b/src/r3/r3.js index af13ff4..4368137 100644 --- a/src/r3/r3.js +++ b/src/r3/r3.js @@ -90,12 +90,12 @@ class R3 { /** * static Version - Current R3 version */ -R3.Version = '3.0.348'; +R3.Version = '3.0.426'; /** * static CompileDate - Current compile date of R3 */ -R3.CompileDate = '2021 Oct 10 - 20:47:06 pm'; +R3.CompileDate = '2021 Oct 24 - 08:43:26 am'; //GENERATED_STATIC_OPTIONS_INIT_END diff --git a/src/templates/component_extends.template b/src/templates/component_extends.template index 7220d7a..138b4c1 100644 --- a/src/templates/component_extends.template +++ b/src/templates/component_extends.template @@ -4,7 +4,6 @@ //CUSTOM_IMPORTS_START //CUSTOM_IMPORTS_END -const Component = require('../r3-component/r3-component.js'); const Event = require('../r3-event.js'); const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME'); const RUNTIME_CLASS = require('../r3-runtime/RUNTIME_CLASS_FILE_NAME'); @@ -41,6 +40,8 @@ const RUNTIME_CLASS = require('../r3-runtime/RUNTIME_CLASS_FILE_NAME'); TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_START instance + runtime + runtimeClass TEMPLATE_EXCLUDED_FROM_INSTANCE_OPTIONS_END CUSTOM_EXCLUDED_FROM_INSTANCE_OPTIONS_START diff --git a/src/templates/generated_default_runtime.template b/src/templates/generated_default_runtime.template new file mode 100644 index 0000000..bb2d818 --- /dev/null +++ b/src/templates/generated_default_runtime.template @@ -0,0 +1,4 @@ + if (typeof SystemRuntime.RUNTIME_BASE.RUNTIME_DEFAULT_SHORT === 'undefined') { + SystemRuntime.RUNTIME_BASE.RUNTIME_DEFAULT_SHORT = new RUNTIME_CLASS(); + } + return SystemRuntime.RUNTIME_BASE.RUNTIME_DEFAULT_SHORT; diff --git a/src/templates/generated_runtime_locator.template b/src/templates/generated_runtime_locator.template index 35febf5..3a62cf3 100644 --- a/src/templates/generated_runtime_locator.template +++ b/src/templates/generated_runtime_locator.template @@ -1,6 +1,4 @@ - if ( - object.runtimeClass === RUNTIME_CLASS - ) { + if (object.runtimeClass === RUNTIME_CLASS) { if (SystemRuntime.CurrentProject === null) { /** @@ -21,4 +19,4 @@ */ console.log('todo : implement project based runtime here'); } - } \ No newline at end of file + } diff --git a/src/templates/runtime_extends.template b/src/templates/runtime_extends.template index 63b7f06..9793870 100644 --- a/src/templates/runtime_extends.template +++ b/src/templates/runtime_extends.template @@ -15,6 +15,9 @@ const EXTEND_CLASS = require('./EXTEND_CLASS_FILE_NAME'); GENERATED_INHERITED_END TEMPLATE_OPTIONS_START + serverSide=RUNTIME_IS_SERVER_SIDE - Flag which indicates whether or not this runtime is intended for server side + clientSide=RUNTIME_IS_CLIENT_SIDE - Flag which indicates whether or not this runtime is intended for client side + default=RUNTIME_IS_DEFAULT - Flag which indicates whether or not this runtime is the default when there is no project specified runtime. TEMPLATE_OPTIONS_END CUSTOM_OPTIONS_START diff --git a/src/templates/token.db b/src/templates/token.db index e952655..2b0a4d3 100644 --- a/src/templates/token.db +++ b/src/templates/token.db @@ -10,6 +10,8 @@ GENERATED_BUILD_SOLUTION_METHOD_AFTER GENERATED_CONSTRUCTOR GENERATED_CREATE_INSTANCE_METHOD GENERATED_CREATE_INSTANCE_METHOD_AFTER +GENERATED_DEFAULT_CLIENT_SIDE_RUNTIME +GENERATED_DEFAULT_SERVER_SIDE_RUNTIME GENERATED_DEFINES GENERATED_DISPOSE_INSTANCE_METHOD GENERATED_DISPOSE_INSTANCE_METHOD_AFTER diff --git a/test/R3.test.js b/test/R3.test.js index 5d9fc94..b93f595 100644 --- a/test/R3.test.js +++ b/test/R3.test.js @@ -3,19 +3,20 @@ const Event = require('../src/r3/r3-event.js'); //GENERATED_COMPONENT_IMPORTS_START const ComponentCode = require('../src/r3/r3-component/./r3-component-code.js'); +const ComponentCodeJS = require('../src/r3/r3-component/./r3-component-code-j-s.js'); const ComponentDOM = require('../src/r3/r3-component/./r3-component-d-o-m.js'); -const ComponentCanvas = require('../src/r3/r3-component/./r3-component-canvas.js'); -const ComponentTest = require('../src/r3/r3-component/./r3-component-test.js'); -const ComponentGeometry = require('../src/r3/r3-component/./r3-component-geometry.js'); -const ComponentBufferGeometry = require('../src/r3/r3-component/./r3-component-buffer-geometry.js'); -const ComponentPlaneGeometry = require('../src/r3/r3-component/./r3-component-plane-geometry.js'); +const ComponentDOMCanvas = require('../src/r3/r3-component/./r3-component-d-o-m-canvas.js'); +const ComponentDOMImage = require('../src/r3/r3-component/./r3-component-d-o-m-image.js'); const ComponentGraphics = require('../src/r3/r3-component/./r3-component-graphics.js'); -const ComponentImage = require('../src/r3/r3-component/./r3-component-image.js'); +const ComponentGraphicsGeometry = require('../src/r3/r3-component/./r3-component-graphics-geometry.js'); +const ComponentGraphicsGeometryBuffer = require('../src/r3/r3-component/./r3-component-graphics-geometry-buffer.js'); +const ComponentGraphicsGeometryBufferPlane = require('../src/r3/r3-component/./r3-component-graphics-geometry-buffer-plane.js'); +const ComponentGraphicsImage = require('../src/r3/r3-component/./r3-component-graphics-image.js'); +const ComponentGraphicsMaterial = require('../src/r3/r3-component/./r3-component-graphics-material.js'); +const ComponentGraphicsMesh = require('../src/r3/r3-component/./r3-component-graphics-mesh.js'); +const ComponentGraphicsTexture = require('../src/r3/r3-component/./r3-component-graphics-texture.js'); const ComponentInput = require('../src/r3/r3-component/./r3-component-input.js'); -const ComponentTouch = require('../src/r3/r3-component/./r3-component-touch.js'); -const ComponentMaterial = require('../src/r3/r3-component/./r3-component-material.js'); -const ComponentMesh = require('../src/r3/r3-component/./r3-component-mesh.js'); -const ComponentTexture = require('../src/r3/r3-component/./r3-component-texture.js'); +const ComponentInputTouch = require('../src/r3/r3-component/./r3-component-input-touch.js'); //GENERATED_COMPONENT_IMPORTS_END //GENERATED_ENTITY_IMPORTS_START @@ -23,20 +24,24 @@ const EntitySlider = require('../src/r3/r3-entity/./r3-entity-slider.js'); //GENERATED_ENTITY_IMPORTS_END //GENERATED_RUNTIME_IMPORTS_START +const RuntimeAudio = require('../src/r3/r3-runtime/./r3-runtime-audio.js'); +const RuntimeAudioThree = require('../src/r3/r3-runtime/./r3-runtime-audio-three.js'); +const RuntimeCode = require('../src/r3/r3-runtime/./r3-runtime-code.js'); +const RuntimeCodeJS = require('../src/r3/r3-runtime/./r3-runtime-code-j-s.js'); const RuntimeCoder = require('../src/r3/r3-runtime/./r3-runtime-coder.js'); -const RuntimeCodeMirror = require('../src/r3/r3-runtime/./r3-runtime-code-mirror.js'); +const RuntimeCoderCodeMirror = require('../src/r3/r3-runtime/./r3-runtime-coder-code-mirror.js'); const RuntimeDOM = require('../src/r3/r3-runtime/./r3-runtime-d-o-m.js'); -const RuntimeJSDOM = require('../src/r3/r3-runtime/./r3-runtime-j-s-d-o-m.js'); -const RuntimeWebDOM = require('../src/r3/r3-runtime/./r3-runtime-web-d-o-m.js'); +const RuntimeDOMJS = require('../src/r3/r3-runtime/./r3-runtime-d-o-m-j-s.js'); +const RuntimeDOMWeb = require('../src/r3/r3-runtime/./r3-runtime-d-o-m-web.js'); const RuntimeGUI = require('../src/r3/r3-runtime/./r3-runtime-g-u-i.js'); -const RuntimeControlKit = require('../src/r3/r3-runtime/./r3-runtime-control-kit.js'); +const RuntimeGUIControlKit = require('../src/r3/r3-runtime/./r3-runtime-g-u-i-control-kit.js'); const RuntimeGraphics = require('../src/r3/r3-runtime/./r3-runtime-graphics.js'); -const RuntimeThree = require('../src/r3/r3-runtime/./r3-runtime-three.js'); +const RuntimeGraphicsThree = require('../src/r3/r3-runtime/./r3-runtime-graphics-three.js'); const RuntimePhysics = require('../src/r3/r3-runtime/./r3-runtime-physics.js'); -const RuntimeBullet = require('../src/r3/r3-runtime/./r3-runtime-bullet.js'); +const RuntimePhysicsBullet = require('../src/r3/r3-runtime/./r3-runtime-physics-bullet.js'); const RuntimeSocket = require('../src/r3/r3-runtime/./r3-runtime-socket.js'); const RuntimeStatistics = require('../src/r3/r3-runtime/./r3-runtime-statistics.js'); -const RuntimeStats = require('../src/r3/r3-runtime/./r3-runtime-stats.js'); +const RuntimeStatisticsStats = require('../src/r3/r3-runtime/./r3-runtime-statistics-stats.js'); //GENERATED_RUNTIME_IMPORTS_END //GENERATED_R3_OBJECT_IMPORTS_START @@ -67,32 +72,34 @@ describe('R3 Tests', () => { //GENERATED_COMPONENT_CREATE_START const componentCode = new ComponentCode(); assert.isTrue(componentCode.initialized); + const componentCodeJS = new ComponentCodeJS(); + assert.isTrue(componentCodeJS.initialized); const componentDOM = new ComponentDOM(); assert.isTrue(componentDOM.initialized); - const componentCanvas = new ComponentCanvas(); - assert.isTrue(componentCanvas.initialized); - const componentTest = new ComponentTest(); - assert.isTrue(componentTest.initialized); - const componentGeometry = new ComponentGeometry(); - assert.isTrue(componentGeometry.initialized); - const componentBufferGeometry = new ComponentBufferGeometry(); - assert.isTrue(componentBufferGeometry.initialized); - const componentPlaneGeometry = new ComponentPlaneGeometry(); - assert.isTrue(componentPlaneGeometry.initialized); + const componentDOMCanvas = new ComponentDOMCanvas(); + assert.isTrue(componentDOMCanvas.initialized); + const componentDOMImage = new ComponentDOMImage(); + assert.isTrue(componentDOMImage.initialized); const componentGraphics = new ComponentGraphics(); assert.isTrue(componentGraphics.initialized); - const componentImage = new ComponentImage(); - assert.isTrue(componentImage.initialized); + const componentGraphicsGeometry = new ComponentGraphicsGeometry(); + assert.isTrue(componentGraphicsGeometry.initialized); + const componentGraphicsGeometryBuffer = new ComponentGraphicsGeometryBuffer(); + assert.isTrue(componentGraphicsGeometryBuffer.initialized); + const componentGraphicsGeometryBufferPlane = new ComponentGraphicsGeometryBufferPlane(); + assert.isTrue(componentGraphicsGeometryBufferPlane.initialized); + const componentGraphicsImage = new ComponentGraphicsImage(); + assert.isTrue(componentGraphicsImage.initialized); + const componentGraphicsMaterial = new ComponentGraphicsMaterial(); + assert.isTrue(componentGraphicsMaterial.initialized); + const componentGraphicsMesh = new ComponentGraphicsMesh(); + assert.isTrue(componentGraphicsMesh.initialized); + const componentGraphicsTexture = new ComponentGraphicsTexture(); + assert.isTrue(componentGraphicsTexture.initialized); const componentInput = new ComponentInput(); assert.isTrue(componentInput.initialized); - const componentTouch = new ComponentTouch(); - assert.isTrue(componentTouch.initialized); - const componentMaterial = new ComponentMaterial(); - assert.isTrue(componentMaterial.initialized); - const componentMesh = new ComponentMesh(); - assert.isTrue(componentMesh.initialized); - const componentTexture = new ComponentTexture(); - assert.isTrue(componentTexture.initialized); + const componentInputTouch = new ComponentInputTouch(); + assert.isTrue(componentInputTouch.initialized); //GENERATED_COMPONENT_CREATE_END } @@ -115,20 +122,24 @@ describe('R3 Tests', () => { () => { //GENERATED_RUNTIME_CREATE_START + const runtimeAudio = new RuntimeAudio(); + const runtimeAudioThree = new RuntimeAudioThree(); + const runtimeCode = new RuntimeCode(); + const runtimeCodeJS = new RuntimeCodeJS(); const runtimeCoder = new RuntimeCoder(); - const runtimeCodeMirror = new RuntimeCodeMirror(); + const runtimeCoderCodeMirror = new RuntimeCoderCodeMirror(); const runtimeDOM = new RuntimeDOM(); - const runtimeJSDOM = new RuntimeJSDOM(); - const runtimeWebDOM = new RuntimeWebDOM(); + const runtimeDOMJS = new RuntimeDOMJS(); + const runtimeDOMWeb = new RuntimeDOMWeb(); const runtimeGUI = new RuntimeGUI(); - const runtimeControlKit = new RuntimeControlKit(); + const runtimeGUIControlKit = new RuntimeGUIControlKit(); const runtimeGraphics = new RuntimeGraphics(); - const runtimeThree = new RuntimeThree(); + const runtimeGraphicsThree = new RuntimeGraphicsThree(); const runtimePhysics = new RuntimePhysics(); - const runtimeBullet = new RuntimeBullet(); + const runtimePhysicsBullet = new RuntimePhysicsBullet(); const runtimeSocket = new RuntimeSocket(); const runtimeStatistics = new RuntimeStatistics(); - const runtimeStats = new RuntimeStats(); + const runtimeStatisticsStats = new RuntimeStatisticsStats(); //GENERATED_RUNTIME_CREATE_END } diff --git a/utils.php b/utils.php index b0f27ac..8ea882f 100644 --- a/utils.php +++ b/utils.php @@ -1,5 +1,37 @@