From 49a7605ff5a1105a3f8fd728e3163a9d4c912e0d Mon Sep 17 00:00:00 2001 From: Theunis Johannes Botha Date: Mon, 9 Apr 2018 10:05:13 +0200 Subject: [PATCH] rename --- README.md | 2 +- bak/game-lib-d3-api-camera-stereo-normal.js | 32 --- bak/game-lib-d3-api-follow.js | 98 --------- bak/game-lib-d3-api-graphics.js | 39 ---- bak/game-lib-d3-api-helper.js | 87 -------- bak/game-lib-d3-api-input-a.js | 5 - bak/game-lib-d3-api-input-editor.bak | 50 ----- bak/game-lib-d3-api-input-fly.bak | 46 ---- bak/game-lib-d3-api-look-at.js | 85 -------- bak/game-lib-d3-api-path-following.js | 203 ------------------ bak/game-lib-d3-engine.js | 63 ------ bak/game-lib-d3-input-a.js | 5 - bak/game-lib-d3-input-editor.js | 90 -------- bak/game-lib-d3-mesh-line.js | 77 ------- bak/game-lib-d3-rigid-wheel.js | 20 -- ...js => r3-d3-api-camera-stereo-anaglyph.js} | 34 +-- bak/r3-d3-api-camera-stereo-normal.js | 32 +++ ...b-d3-api-editor.js => r3-d3-api-editor.js} | 92 ++++---- bak/r3-d3-api-follow.js | 98 +++++++++ ...e-lib-d3-api-game.js => r3-d3-api-game.js} | 76 +++---- bak/r3-d3-api-graphics.js | 39 ++++ bak/r3-d3-api-helper.js | 87 ++++++++ ...-factory.js => r3-d3-api-image-factory.js} | 20 +- bak/r3-d3-api-input-a.js | 5 + ...nput-drive.js => r3-d3-api-input-drive.js} | 44 ++-- bak/r3-d3-api-input-editor.bak | 50 +++++ ...ut-editor.js => r3-d3-api-input-editor.js} | 26 +-- bak/r3-d3-api-input-fly.bak | 46 ++++ bak/r3-d3-api-look-at.js | 85 ++++++++ ...-api-mesh-box.js => r3-d3-api-mesh-box.js} | 24 +-- ...-mesh-curve.js => r3-d3-api-mesh-curve.js} | 20 +- ...cylinder.js => r3-d3-api-mesh-cylinder.js} | 34 +-- ...pi-mesh-line.js => r3-d3-api-mesh-line.js} | 20 +- ...-mesh-plane.js => r3-d3-api-mesh-plane.js} | 46 ++-- ...esh-sphere.js => r3-d3-api-mesh-sphere.js} | 24 +-- ...pi-mesh-text.js => r3-d3-api-mesh-text.js} | 38 ++-- bak/r3-d3-api-path-following.js | 203 ++++++++++++++++++ ...object.js => r3-d3-api-selected-object.js} | 16 +- ...{game-lib-d3-editor.js => r3-d3-editor.js} | 142 ++++++------ bak/r3-d3-engine.js | 63 ++++++ ...-fly-controls.js => r3-d3-fly-controls.js} | 2 +- ...{game-lib-d3-follow.js => r3-d3-follow.js} | 42 ++-- bak/{game-lib-d3-game.js => r3-d3-game.js} | 108 +++++----- ...lib-d3-heightmap.js => r3-d3-heightmap.js} | 16 +- ...mage-factory.js => r3-d3-image-factory.js} | 54 ++--- bak/r3-d3-input-a.js | 5 + ...d3-input-drive.js => r3-d3-input-drive.js} | 66 +++--- ...nput-editor.bak => r3-d3-input-editor.bak} | 32 +-- bak/r3-d3-input-editor.js | 90 ++++++++ ...b-d3-input-fly.bak => r3-d3-input-fly.bak} | 48 ++--- ...ame-lib-d3-look-at.js => r3-d3-look-at.js} | 62 +++--- ...e-lib-d3-mesh-box.js => r3-d3-mesh-box.js} | 36 ++-- ...b-d3-mesh-curve.js => r3-d3-mesh-curve.js} | 30 +-- ...esh-cylinder.js => r3-d3-mesh-cylinder.js} | 38 ++-- bak/r3-d3-mesh-line.js | 77 +++++++ ...b-d3-mesh-plane.js => r3-d3-mesh-plane.js} | 72 +++---- ...d3-mesh-sphere.js => r3-d3-mesh-sphere.js} | 68 +++--- ...lib-d3-mesh-text.js => r3-d3-mesh-text.js} | 40 ++-- ...h-following.js => r3-d3-path-following.js} | 82 +++---- ...ame-lib-d3-physics.js => r3-d3-physics.js} | 8 +- ...st-vehicle.js => r3-d3-raycast-vehicle.js} | 30 +-- ...aycast-wheel.js => r3-d3-raycast-wheel.js} | 6 +- ...vehicle.js => r3-d3-rigid-body-vehicle.js} | 20 +- ...b-d3-rigid-body.js => r3-d3-rigid-body.js} | 38 ++-- bak/r3-d3-rigid-wheel.js | 20 ++ ...ted-object.js => r3-d3-selected-object.js} | 12 +- bak/{game-lib-d3-shape.js => r3-d3-shape.js} | 62 +++--- ...ame-lib-d3-sky-box.js => r3-d3-sky-box.js} | 6 +- bak/{game-lib-d3-world.js => r3-d3-world.js} | 80 +++---- bak/{game-lib-dom.js => r3-dom.js} | 2 +- bak/{game-lib-matrix-3.js => r3-matrix-3.js} | 16 +- gulpfile.js | 2 +- test/test.gameLib.js | 50 ++--- 73 files changed, 1793 insertions(+), 1793 deletions(-) delete mode 100644 bak/game-lib-d3-api-camera-stereo-normal.js delete mode 100644 bak/game-lib-d3-api-follow.js delete mode 100644 bak/game-lib-d3-api-graphics.js delete mode 100644 bak/game-lib-d3-api-helper.js delete mode 100644 bak/game-lib-d3-api-input-a.js delete mode 100644 bak/game-lib-d3-api-input-editor.bak delete mode 100644 bak/game-lib-d3-api-input-fly.bak delete mode 100644 bak/game-lib-d3-api-look-at.js delete mode 100644 bak/game-lib-d3-api-path-following.js delete mode 100644 bak/game-lib-d3-engine.js delete mode 100644 bak/game-lib-d3-input-a.js delete mode 100644 bak/game-lib-d3-input-editor.js delete mode 100644 bak/game-lib-d3-mesh-line.js delete mode 100644 bak/game-lib-d3-rigid-wheel.js rename bak/{game-lib-d3-api-camera-stereo-anaglyph.js => r3-d3-api-camera-stereo-anaglyph.js} (56%) create mode 100644 bak/r3-d3-api-camera-stereo-normal.js rename bak/{game-lib-d3-api-editor.js => r3-d3-api-editor.js} (59%) create mode 100644 bak/r3-d3-api-follow.js rename bak/{game-lib-d3-api-game.js => r3-d3-api-game.js} (59%) create mode 100644 bak/r3-d3-api-graphics.js create mode 100644 bak/r3-d3-api-helper.js rename bak/{game-lib-d3-api-image-factory.js => r3-d3-api-image-factory.js} (58%) create mode 100644 bak/r3-d3-api-input-a.js rename bak/{game-lib-d3-api-input-drive.js => r3-d3-api-input-drive.js} (62%) create mode 100644 bak/r3-d3-api-input-editor.bak rename bak/{game-lib-d3-api-input-editor.js => r3-d3-api-input-editor.js} (54%) create mode 100644 bak/r3-d3-api-input-fly.bak create mode 100644 bak/r3-d3-api-look-at.js rename bak/{game-lib-d3-api-mesh-box.js => r3-d3-api-mesh-box.js} (62%) rename bak/{game-lib-d3-api-mesh-curve.js => r3-d3-api-mesh-curve.js} (62%) rename bak/{game-lib-d3-api-mesh-cylinder.js => r3-d3-api-mesh-cylinder.js} (63%) rename bak/{game-lib-d3-api-mesh-line.js => r3-d3-api-mesh-line.js} (62%) rename bak/{game-lib-d3-api-mesh-plane.js => r3-d3-api-mesh-plane.js} (60%) rename bak/{game-lib-d3-api-mesh-sphere.js => r3-d3-api-mesh-sphere.js} (63%) rename bak/{game-lib-d3-api-mesh-text.js => r3-d3-api-mesh-text.js} (62%) create mode 100644 bak/r3-d3-api-path-following.js rename bak/{game-lib-d3-api-selected-object.js => r3-d3-api-selected-object.js} (64%) rename bak/{game-lib-d3-editor.js => r3-d3-editor.js} (74%) create mode 100644 bak/r3-d3-engine.js rename bak/{game-lib-d3-fly-controls.js => r3-d3-fly-controls.js} (92%) rename bak/{game-lib-d3-follow.js => r3-d3-follow.js} (75%) rename bak/{game-lib-d3-game.js => r3-d3-game.js} (75%) rename bak/{game-lib-d3-heightmap.js => r3-d3-heightmap.js} (91%) rename bak/{game-lib-d3-image-factory.js => r3-d3-image-factory.js} (63%) create mode 100644 bak/r3-d3-input-a.js rename bak/{game-lib-d3-input-drive.js => r3-d3-input-drive.js} (67%) rename bak/{game-lib-d3-input-editor.bak => r3-d3-input-editor.bak} (56%) create mode 100644 bak/r3-d3-input-editor.js rename bak/{game-lib-d3-input-fly.bak => r3-d3-input-fly.bak} (82%) rename bak/{game-lib-d3-look-at.js => r3-d3-look-at.js} (62%) rename bak/{game-lib-d3-mesh-box.js => r3-d3-mesh-box.js} (55%) rename bak/{game-lib-d3-mesh-curve.js => r3-d3-mesh-curve.js} (51%) rename bak/{game-lib-d3-mesh-cylinder.js => r3-d3-mesh-cylinder.js} (71%) create mode 100644 bak/r3-d3-mesh-line.js rename bak/{game-lib-d3-mesh-plane.js => r3-d3-mesh-plane.js} (77%) rename bak/{game-lib-d3-mesh-sphere.js => r3-d3-mesh-sphere.js} (61%) rename bak/{game-lib-d3-mesh-text.js => r3-d3-mesh-text.js} (70%) rename bak/{game-lib-d3-path-following.js => r3-d3-path-following.js} (68%) rename bak/{game-lib-d3-physics.js => r3-d3-physics.js} (73%) rename bak/{game-lib-d3-raycast-vehicle.js => r3-d3-raycast-vehicle.js} (61%) rename bak/{game-lib-d3-raycast-wheel.js => r3-d3-raycast-wheel.js} (97%) rename bak/{game-lib-d3-rigid-body-vehicle.js => r3-d3-rigid-body-vehicle.js} (71%) rename bak/{game-lib-d3-rigid-body.js => r3-d3-rigid-body.js} (84%) create mode 100644 bak/r3-d3-rigid-wheel.js rename bak/{game-lib-d3-selected-object.js => r3-d3-selected-object.js} (66%) rename bak/{game-lib-d3-shape.js => r3-d3-shape.js} (64%) rename bak/{game-lib-d3-sky-box.js => r3-d3-sky-box.js} (94%) rename bak/{game-lib-d3-world.js => r3-d3-world.js} (91%) rename bak/{game-lib-dom.js => r3-dom.js} (89%) rename bak/{game-lib-matrix-3.js => r3-matrix-3.js} (50%) diff --git a/README.md b/README.md index e7286e8..312ba63 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -#GameLib 3D (and 2D eventually) +#R3 3D (and 2D eventually) diff --git a/bak/game-lib-d3-api-camera-stereo-normal.js b/bak/game-lib-d3-api-camera-stereo-normal.js deleted file mode 100644 index c8f4d76..0000000 --- a/bak/game-lib-d3-api-camera-stereo-normal.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * GameLib.D3.API.Camera.Stereo.Normal - * @constructor - * @param apiStereoCamera - */ -GameLib.D3.API.Camera.Stereo.Normal = function( - apiStereoCamera -) { - - if (GameLib.Utils.UndefinedOrNull(apiStereoCamera)) { - apiStereoCamera = { - stereoType : GameLib.D3.API.Camera.Stereo.STEREO_TYPE_NORMAL - }; - } - - if (GameLib.Utils.UndefinedOrNull(apiStereoCamera.stereoType)) { - apiStereoCamera.stereoType = GameLib.D3.API.Camera.Stereo.STEREO_TYPE_NORMAL; - } - - GameLib.D3.API.Camera.Stereo.call( - this, - apiStereoCamera, - apiStereoCamera.stereoType, - apiStereoCamera.eyeSep, - apiStereoCamera.main, - apiStereoCamera.cameraL, - apiStereoCamera.cameraR - ); -}; - -GameLib.D3.API.Camera.Stereo.Normal.prototype = Object.create(GameLib.D3.API.Camera.Stereo.prototype); -GameLib.D3.API.Camera.Stereo.Normal.prototype.constructor = GameLib.D3.API.Camera.Stereo.Normal; \ No newline at end of file diff --git a/bak/game-lib-d3-api-follow.js b/bak/game-lib-d3-api-follow.js deleted file mode 100644 index 05b0e2e..0000000 --- a/bak/game-lib-d3-api-follow.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Follow Component - * @param id - * @param name - * @param currentComponent GameLib.Component - * @param targetComponent GameLib.Component - * @param targetPositionOffset GameLib.API.Vector3 - * @param minDistance - * @param moveSpeed - * @param parentEntity - * @constructor - */ -GameLib.D3.API.Follow = function ( - id, - name, - currentComponent, - targetComponent, - targetPositionOffset, - minDistance, - moveSpeed, - parentEntity -) { - - GameLib.Component.call( - this, - GameLib.Component.COMPONENT_FOLLOW, - { - 'currentComponent': GameLib.Component, - 'targetComponent': GameLib.Component - }, - parentEntity - ); - - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); - } - this.id = id; - - if (GameLib.Utils.UndefinedOrNull(name)) { - name = this.constructor.name; - } - this.name = name; - - if (GameLib.Utils.UndefinedOrNull(currentComponent)) { - currentComponent = null; - } - this.currentComponent = currentComponent; - - if (GameLib.Utils.UndefinedOrNull(targetComponent)) { - targetComponent = null; - } - this.targetComponent = targetComponent; - - if(GameLib.Utils.UndefinedOrNull(targetPositionOffset)) { - targetPositionOffset = new GameLib.API.Vector3(0, 0, 0); - } - this.targetPositionOffset = targetPositionOffset; - - if (GameLib.Utils.UndefinedOrNull(minDistance)) { - minDistance = 2; - } - this.minDistance = minDistance; - - if (GameLib.Utils.UndefinedOrNull(moveSpeed)) { - moveSpeed = 12.5; - } - this.moveSpeed = moveSpeed; - - this.target = new GameLib.API.Vector3(0, 0, 0); - - this.targetToParent = new GameLib.API.Vector3(0, 0, 0); - - this.rotatedTargetOffset = new GameLib.API.Vector3(0, 0, 0); - - this.rotated = new GameLib.API.Quaternion(); -}; - -GameLib.D3.API.Follow.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Follow.prototype.constructor = GameLib.D3.API.Follow; - -/** - * Object to GameLib.D3.API.Follow - * @param objectComponent - * @returns {GameLib.D3.API.Follow} - * @constructor - */ -GameLib.D3.API.Follow.FromObject = function(objectComponent) { - return new GameLib.D3.API.Follow( - objectComponent.id, - objectComponent.name, - objectComponent.currentComponent, - objectComponent.targetComponent, - GameLib.API.Vector3.FromObject(objectComponent.targetPositionOffset), - objectComponent.minDistance, - objectComponent.moveSpeed, - objectComponent.parentEntity - ); -}; diff --git a/bak/game-lib-d3-api-graphics.js b/bak/game-lib-d3-api-graphics.js deleted file mode 100644 index e704a7d..0000000 --- a/bak/game-lib-d3-api-graphics.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Graphics API - * @param id String - * @param name - * @param graphicsType - * @param parentEntity - * @constructor - */ -GameLib.D3.API.Graphics = function ( - parentEntity -) { - - GameLib.Component.call( - this, - GameLib.Component.COMPONENT_GRAPHICS, - null, - null, - parentEntity - ); - - -}; - -GameLib.D3.API.Graphics.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Graphics.prototype.constructor = GameLib.D3.API.Graphics; - -/** - * Object to GameLib.D3.API.Graphics - * @param objectComponent - * @constructor - */ -GameLib.D3.API.Graphics.FromObjectComponent = function(objectComponent) { - return new GameLib.D3.API.Graphics( - objectComponent.id, - objectComponent.name, - objectComponent.graphicsType, - objectComponent.parentEntity - ); -}; diff --git a/bak/game-lib-d3-api-helper.js b/bak/game-lib-d3-api-helper.js deleted file mode 100644 index 3bc0c9d..0000000 --- a/bak/game-lib-d3-api-helper.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * This component renders a scene - * @param id String - * @param name String - * @param helperType - * @param object - * @param parentEntity - * @constructor - */ -GameLib.D3.API.Helper = function ( - id, - name, - helperType, - object, - parentEntity -) { - - GameLib.Component.call( - this, - GameLib.Component.COMPONENT_HELPER, - null, - null, - parentEntity - ); - - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); - } - this.id = id; - - if (GameLib.Utils.UndefinedOrNull(name)) { - name = 'Helper (' + id + ')'; - } - this.name = name; - - if (GameLib.Utils.UndefinedOrNull(object)) { - console.warn('Cannot create a helper for an Object which does not exist'); - throw new Error('Cannot create a helper for an Object which does not exist'); - } - - if (GameLib.Utils.UndefinedOrNull(helperType)) { - if ( - object instanceof GameLib.D3.Mesh && - object.meshType != GameLib.D3.Mesh.TYPE_CURVE - ) { - helperType = GameLib.D3.Helper.HELPER_TYPE_WIREFRAME; - } - - if (object instanceof GameLib.D3.Light) { - if (object.lightType == GameLib.D3.Light.LIGHT_TYPE_DIRECTIONAL) { - helperType = GameLib.D3.Helper.HELPER_TYPE_DIRECTIONAL_LIGHT; - } - - if (object.lightType == GameLib.D3.Light.LIGHT_TYPE_POINT) { - helperType = GameLib.D3.Helper.HELPER_TYPE_POINT_LIGHT; - } - - if (object.lightType == GameLib.D3.Light.LIGHT_TYPE_SPOT) { - helperType = GameLib.D3.Helper.HELPER_TYPE_SPOT_LIGHT; - } - } - - if (object instanceof GameLib.D3.Skeleton) { - helperType = GameLib.D3.Helper.HELPER_TYPE_SKELETON; - } - } - this.helperType = helperType; - -}; - -GameLib.D3.API.Helper.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Helper.prototype.constructor = GameLib.D3.API.Helper; - -/** - * Object to GameLib.D3.API.Helper - * @param objectComponent - * @constructor - */ -GameLib.D3.API.Helper.FromObjectComponent = function(objectComponent) { - return new GameLib.D3.API.Helper( - objectComponent.id, - objectComponent.name, - objectComponent.helperType, - objectComponent.object, - objectComponent.parentEntity - ); -}; diff --git a/bak/game-lib-d3-api-input-a.js b/bak/game-lib-d3-api-input-a.js deleted file mode 100644 index 0d159a7..0000000 --- a/bak/game-lib-d3-api-input-a.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * GameLib.D3.API.Input namespace - * @constructor - */ -GameLib.D3.API.Input = function() {}; diff --git a/bak/game-lib-d3-api-input-editor.bak b/bak/game-lib-d3-api-input-editor.bak deleted file mode 100644 index c102050..0000000 --- a/bak/game-lib-d3-api-input-editor.bak +++ /dev/null @@ -1,50 +0,0 @@ -/** - * This component makes the parentEntity (ex. car) follow the path provided by the spline - * @param id String - * @param name String - * @param domElementId - * @param camera GameLib.D3.Camera - * @param parentEntity - * @constructor - */ -GameLib.D3.API.Input.Editor = function ( - id, - name, - domElementId, - camera, - parentEntity -) { - GameLib.Component.call( - this, - GameLib.Component.COMPONENT_EDITOR_INPUT, - { - 'camera' : GameLib.D3.Camera - }, - null, - parentEntity - ); - - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); - } - this.id = id; - - if (GameLib.Utils.UndefinedOrNull(name)) { - name = this.constructor.name; - } - this.name = name; - - if (GameLib.Utils.UndefinedOrNull(domElementId)) { - domElementId = "divCanvas"; - } - this.domElementId = domElementId; - - if (GameLib.Utils.UndefinedOrNull(camera)) { - camera = null; - } - this.camera = camera; - -}; - -GameLib.D3.API.Input.Editor.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Input.Editor.prototype.constructor = GameLib.D3.API.Input.Editor; diff --git a/bak/game-lib-d3-api-input-fly.bak b/bak/game-lib-d3-api-input-fly.bak deleted file mode 100644 index b5cc2d8..0000000 --- a/bak/game-lib-d3-api-input-fly.bak +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This component makes the parentEntity (ex. car) follow the path provided by the spline - * @param id String - * @param name String - * @param domElementId - * @param camera GameLib.D3.Camera - * @constructor - */ -GameLib.D3.API.Input.Fly = function ( - id, - name, - domElementId, - camera -) { - GameLib.Component.call( - this, - GameLib.Component.COMPONENT_FLY_INPUT, - { - 'camera' : GameLib.D3.Camera - } - ); - - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); - } - this.id = id; - - if (GameLib.Utils.UndefinedOrNull(name)) { - name = this.constructor.name; - } - this.name = name; - - if (GameLib.Utils.UndefinedOrNull(domElementId)) { - domElementId = "divCanvas"; - } - this.domElementId = domElementId; - - if (GameLib.Utils.UndefinedOrNull(camera)) { - camera = null; - } - this.camera = camera; - -}; - -GameLib.D3.API.Input.Fly.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Input.Fly.prototype.constructor = GameLib.D3.API.Input.Fly; diff --git a/bak/game-lib-d3-api-look-at.js b/bak/game-lib-d3-api-look-at.js deleted file mode 100644 index 776d604..0000000 --- a/bak/game-lib-d3-api-look-at.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Looks from currentPosition to targetPosition (default up is 0,1,0) - * @param id - * @param name - * @param currentComponent GameLib.Component - * @param targetComponent GameLib.Component - * @param targetPositionOffset GameLib.API.Vector3 - * @param rotationSpeed Number - * @param parentEntity - * @constructor - */ -GameLib.D3.API.LookAt = function ( - id, - name, - currentComponent, - targetComponent, - targetPositionOffset, - rotationSpeed, - parentEntity -) { - - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); - } - this.id = id; - - if (GameLib.Utils.UndefinedOrNull(name)) { - name = this.constructor.name; - } - this.name = name; - - if(GameLib.Utils.UndefinedOrNull(currentComponent)) { - currentComponent = null; - } - this.currentComponent = currentComponent; - - if(GameLib.Utils.UndefinedOrNull(targetComponent)) { - targetComponent = null; - } - this.targetComponent = targetComponent; - - if(GameLib.Utils.UndefinedOrNull(targetPositionOffset)) { - targetPositionOffset = new GameLib.API.Vector3(0, 0, 0); - } - this.targetPositionOffset = targetPositionOffset; - - if (GameLib.Utils.UndefinedOrNull(rotationSpeed)) { - rotationSpeed = 22.0; - } - this.rotationSpeed = rotationSpeed; - - this.lookAtMatrix = new GameLib.API.Matrix4(); - - this.up = new GameLib.API.Vector3(0, 1, 0); - - this.currentRotation = new GameLib.API.Quaternion(); - - this.targetPosition = new GameLib.API.Vector3(); - - if(GameLib.Utils.UndefinedOrNull(parentEntity)) { - parentEntity = null; - } - this.parentEntity = parentEntity; -}; - -GameLib.D3.API.LookAt.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.LookAt.prototype.constructor = GameLib.D3.API.LookAt; - -/** - * Object to GameLib.D3.API.LookAt - * @param objectComponent - * @returns {GameLib.D3.API.LookAt} - * @constructor - */ -GameLib.D3.API.LookAt.FromObject = function(objectComponent) { - return new GameLib.D3.API.LookAt( - objectComponent.id, - objectComponent.name, - objectComponent.currentComponent, - objectComponent.targetComponent, - GameLib.API.Vector3.FromObject(objectComponent.targetPositionOffset), - objectComponent.rotationSpeed, - objectComponent.parentEntity - ); -}; diff --git a/bak/game-lib-d3-api-path-following.js b/bak/game-lib-d3-api-path-following.js deleted file mode 100644 index 41fbd47..0000000 --- a/bak/game-lib-d3-api-path-following.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * This component makes the parentEntity (ex. car) follow the path provided by the spline - * @param id String - * @param name String - * @param spline GameLib.D3.API.Spline - * @param mesh GameLib.D3.API.Mesh - * @param raytraceMesh GameLib.D3.API.Mesh - * @param accelleration Number - * @param maxSpeed Number - * @param baseOffset GameLib.API.Vector - * @param maxOffset GameLib.API.Vector - * @param steeringSpeed Number - * @param targetOffset GameLib.API.Vector3 - * @param currentOffset GameLib.API.Vector3 - * @param currentPathValue Number - * @param currentSpeed Number - * @param direction Number - * @param raycaster GameLib.D3.Raycaster - * @param currentPosition GameLib.API.Vector3 - * @param futurePosition GameLib.API.Vector3 - * @param up GameLib.API.Vector3 - * @param rotationMatrix GameLib.API.Matrix4 - * @param rotationVector GameLib.API.Quaternion - * @param parentEntity - * @constructor - */ -GameLib.D3.API.PathFollowing = function ( - id, - name, - spline, - mesh, - raytraceMesh, - accelleration, - maxSpeed, - baseOffset, - maxOffset, - steeringSpeed, - targetOffset, - currentOffset, - currentPathValue, - currentSpeed, - direction, - raycaster, - currentPosition, - futurePosition, - up, - rotationMatrix, - rotationVector, - parentEntity -) { - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); - } - this.id = id; - - if (GameLib.Utils.UndefinedOrNull(name)) { - name = this.constructor.name; - } - this.name = name; - - if (GameLib.Utils.UndefinedOrNull(spline)) { - spline = null; - } - this.spline = spline; - - if (GameLib.Utils.UndefinedOrNull(mesh)) { - mesh = null; - } - this.mesh = mesh; - - if (GameLib.Utils.UndefinedOrNull(raytraceMesh)) { - raytraceMesh = null; - } - this.raytraceMesh = raytraceMesh; - - if (GameLib.Utils.UndefinedOrNull(maxSpeed)) { - maxSpeed = 0.03; - } - this.maxSpeed = maxSpeed; - - if (GameLib.Utils.UndefinedOrNull(accelleration)) { - accelleration = 0.1; - } - this.accelleration = accelleration; - - if (GameLib.Utils.UndefinedOrNull(baseOffset)) { - baseOffset = new GameLib.API.Vector3(); - } - this.baseOffset = baseOffset; - - if (GameLib.Utils.UndefinedOrNull(maxOffset)) { - maxOffset = new GameLib.API.Vector3(); - } - this.maxOffset = maxOffset; - - if (GameLib.Utils.UndefinedOrNull(steeringSpeed)) { - steeringSpeed = 1.0; - } - this.steeringSpeed = steeringSpeed; - - if (GameLib.Utils.UndefinedOrNull(targetOffset)) { - targetOffset = new GameLib.API.Vector3(); - } - this.targetOffset = targetOffset; - - if (GameLib.Utils.UndefinedOrNull(currentOffset)) { - currentOffset = new GameLib.API.Vector3(); - } - this.currentOffset = currentOffset; - - if (GameLib.Utils.UndefinedOrNull(currentPathValue)) { - currentPathValue = 0; - } - this.currentPathValue = currentPathValue; - - if (GameLib.Utils.UndefinedOrNull(currentSpeed)) { - currentSpeed = 0; - } - this.currentSpeed = currentSpeed; - - if (GameLib.Utils.UndefinedOrNull(direction)) { - direction = 1; - } - this.direction = direction; - - if (GameLib.Utils.UndefinedOrNull(raycaster)) { - raycaster = new GameLib.D3.API.Raycaster(); - } - this.raycaster = raycaster; - - if (GameLib.Utils.UndefinedOrNull(currentPosition)) { - currentPosition = new GameLib.API.Vector3(); - } - this.currentPosition = currentPosition; - - if (GameLib.Utils.UndefinedOrNull(futurePosition)) { - futurePosition = new GameLib.API.Vector3(); - } - this.futurePosition = futurePosition; - - if(GameLib.Utils.UndefinedOrNull(up)) { - up = new GameLib.API.Vector3(0, 1, 0); - } - this.up = up; - - if (GameLib.Utils.UndefinedOrNull(rotationMatrix)) { - rotationMatrix = new GameLib.API.Matrix4(); - } - this.rotationMatrix = rotationMatrix; - - if (GameLib.Utils.UndefinedOrNull(rotationVector)) { - rotationVector = new GameLib.API.Quaternion(); - } - this.rotationVector = rotationVector; - - if (GameLib.Utils.UndefinedOrNull(parentEntity)) { - parentEntity = null; - } - this.parentEntity = parentEntity; - -}; - -GameLib.D3.API.PathFollowing.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.PathFollowing.prototype.constructor = GameLib.D3.API.PathFollowing; - -/** - * Returns an API path following component from an Object path following component - * @param objectComponent - * @constructor - */ -GameLib.D3.API.PathFollowing.FromObject = function(objectComponent) { - - var apiRaycaster = null; - - if (objectComponent.raycaster) { - apiRaycaster = GameLib.D3.API.Raycaster.FromObject(objectComponent.raycaster); - } - - return new GameLib.D3.API.PathFollowing( - objectComponent.id, - objectComponent.name, - objectComponent.spline, - objectComponent.mesh, - objectComponent.raytraceMesh, - objectComponent.accelleration, - objectComponent.maxSpeed, - GameLib.API.Vector3.FromObject(objectComponent.baseOffset), - GameLib.API.Vector3.FromObject(objectComponent.maxOffset), - objectComponent.steeringSpeed, - GameLib.API.Vector3.FromObject(objectComponent.targetOffset), - GameLib.API.Vector3.FromObject(objectComponent.currentOffset), - objectComponent.currentPathValue, - objectComponent.currentSpeed, - objectComponent.direction, - apiRaycaster, - GameLib.API.Vector3.FromObject(objectComponent.currentPosition), - GameLib.API.Vector3.FromObject(objectComponent.futurePosition), - GameLib.API.Vector3.FromObject(objectComponent.up), - GameLib.API.Matrix4.FromObject(objectComponent.rotationMatrix), - GameLib.API.Quaternion.FromObject(objectComponent.rotationVector), - objectComponent.parentEntity - ); -}; diff --git a/bak/game-lib-d3-engine.js b/bak/game-lib-d3-engine.js deleted file mode 100644 index dd80dfd..0000000 --- a/bak/game-lib-d3-engine.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Engine Superset - * @param engineType - * @param instance {CANNON | Ammo | Goblin} - * @constructor - */ -GameLib.D3.Engine = function Engine( - engineType, - instance -) { - this.engineType = engineType; - this.instance = instance; -}; - -GameLib.D3.Engine.prototype.toApiEngine = function() { - - //TODO: create API.Engine sometime - return { - engineType : this.engineType - } -}; - -/** - * True if CANNON physics - * @returns {boolean} - */ -GameLib.D3.Engine.prototype.isCannon = function() { - return (this.engineType == GameLib.D3.Engine.ENGINE_TYPE_CANNON) -}; - -/** - * Logs a warning and throws an error if not cannon - */ -GameLib.D3.Engine.prototype.isNotCannonThrow = function() { - if (this.engineType != GameLib.D3.Engine.ENGINE_TYPE_CANNON) { - console.warn('Only CANNON supported for this function'); - throw new Error('Only CANNON supported for this function'); - } -}; - -/** - * True if Ammo physics - * @returns {boolean} - */ -GameLib.D3.Engine.prototype.isAmmo = function() { - return (this.engineType == GameLib.D3.Engine.ENGINE_TYPE_AMMO) -}; - -/** - * True if Goblin physics - * @returns {boolean} - */ -GameLib.D3.Engine.prototype.isGoblin = function() { - return (this.engineType == GameLib.D3.Engine.ENGINE_TYPE_GOBLIN) -}; - -/** - * Physics GameLib.D3.Engine Types - * @type {number} - */ -GameLib.D3.Engine.ENGINE_TYPE_CANNON = 0x1; -GameLib.D3.Engine.ENGINE_TYPE_AMMO = 0x2; -GameLib.D3.Engine.ENGINE_TYPE_GOBLIN = 0x3; \ No newline at end of file diff --git a/bak/game-lib-d3-input-a.js b/bak/game-lib-d3-input-a.js deleted file mode 100644 index 0591667..0000000 --- a/bak/game-lib-d3-input-a.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * GameLib.D3.Input namespace - * @constructor - */ -GameLib.D3.Input = function () {}; diff --git a/bak/game-lib-d3-input-editor.js b/bak/game-lib-d3-input-editor.js deleted file mode 100644 index a1fb987..0000000 --- a/bak/game-lib-d3-input-editor.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Input parent class - * @param graphics GameLib.D3.Graphics - * @param apiInputEditor GameLib.D3.API.Input.Editor - * @constructor - */ -GameLib.D3.Input.Editor = function ( - graphics, - apiInputEditor -) { - - this.graphics = graphics; - this.graphics.isNotThreeThrow(); - - if (GameLib.Utils.UndefinedOrNull(apiInputEditor)) { - apiInputEditor = {}; - } - - if (apiInputEditor instanceof GameLib.D3.Input.Editor) { - return apiInputEditor; - } - - GameLib.D3.API.Input.Editor.call( - this, - apiInputEditor.id, - apiInputEditor.name, - apiInputEditor.domElement, - apiInputEditor.camera, - apiInputEditor.parentEntity - ); - - if (this.domElement instanceof GameLib.API.DomElement) { - this.domElement = new GameLib.DomElement( - this.domElement - ) - } - - if (this.camera instanceof GameLib.D3.API.Camera) { - this.camera = new GameLib.D3.Camera( - this.graphics, - this.camera - ) - } - - GameLib.Component.call( - this, - GameLib.Component.COMPONENT_INPUT_EDITOR, - { - 'camera' : GameLib.D3.Camera - } - ); -}; - -GameLib.D3.Input.Editor.prototype = Object.create(GameLib.D3.API.Input.Editor.prototype); -GameLib.D3.Input.Editor.prototype.constructor = GameLib.D3.Input.Editor; - -GameLib.D3.Input.Editor.prototype.createInstance = function() { - return true; -}; - -GameLib.D3.Input.Editor.prototype.updateInstance = function() { -}; - -/** - * GameLib.D3.Input.Editor to GameLib.D3.API.Input.Editor - * @returns {GameLib.D3.API.Input.Editor} - */ -GameLib.D3.Input.Editor.prototype.toApiObject = function() { - - var apiInputEditor = new GameLib.D3.API.Input.Editor( - this.id, - this.name, - this.domElementId, - GameLib.Utils.IdOrNull(this.camera), - GameLib.Utils.IdOrNull(this.parentEntity) - ); - - return apiInputEditor; -}; - -GameLib.D3.Input.Editor.FromObject = function(graphics, objectComponent) { - - var apiInputEditor = GameLib.D3.API.Input.Editor.FromObject(objectComponent); - - return new GameLib.D3.Input.Editor( - graphics, - apiInputEditor - ); -}; - diff --git a/bak/game-lib-d3-mesh-line.js b/bak/game-lib-d3-mesh-line.js deleted file mode 100644 index 3060702..0000000 --- a/bak/game-lib-d3-mesh-line.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created - * @param graphics GameLib.GraphicsRuntime - * @param apiMeshLine - * @constructor - */ -GameLib.D3.Mesh.Line = function ( - graphics, - apiMeshLine -) { - this.graphics = graphics; - this.graphics.isNotThreeThrow(); - - if (GameLib.Utils.UndefinedOrNull(apiMeshLine)) { - apiMeshLine = { - meshType: GameLib.D3.API.Mesh.MESH_TYPE_LINE - }; - } - - GameLib.D3.API.Mesh.Line.call( - this, - apiMeshLine, - apiMeshLine.lineWidth - ); - - GameLib.D3.Mesh.call( - this, - this.graphics, - this - ); -}; - -GameLib.D3.Mesh.Line.prototype = Object.create(GameLib.D3.Mesh.prototype); -GameLib.D3.Mesh.Line.prototype.constructor = GameLib.D3.Mesh.Line; - -GameLib.D3.Mesh.Line.prototype.createInstance = function() { - - var geometry = new THREE.Geometry(); - - geometry.vertices.push( - this.vertices.map( - function(vertex){ - return vertex.instance; - } - ) - ); - - this.instance = new THREE.Line(geometry); - - GameLib.D3.Mesh.prototype.createInstance.call(this); - - this.instance.userData.lineWidth = this.lineWidth; -}; - -GameLib.D3.Mesh.Line.prototype.updateInstance = function(property) { - - this.instance.linewidth = this.lineWidth; - - GameLib.D3.Mesh.prototype.updateInstance.call(this, property); - -}; - -/** - * Converts a GameLib.D3.Mesh.Line to a GameLib.D3.API.Mesh.Line - * @returns {GameLib.D3.API.Mesh.Line} - */ -GameLib.D3.Mesh.Line.prototype.toApiObject = function() { - - var apiMesh = GameLib.D3.Mesh.prototype.toApiObject.call(this); - - var apiMeshLine = new GameLib.D3.API.Mesh.Line( - apiMesh, - this.lineWidth - ); - - return apiMeshLine; -}; diff --git a/bak/game-lib-d3-rigid-wheel.js b/bak/game-lib-d3-rigid-wheel.js deleted file mode 100644 index da781cb..0000000 --- a/bak/game-lib-d3-rigid-wheel.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Rigid Wheel superset - * @param body GameLib.D3.RigidBody - * @param position GameLib.API.Vector3 - * @param axis GameLib.API.Vector3 - * @param direction GameLib.API.Vector3 - * @constructor - */ -GameLib.D3.RigidWheel = function( - body, - position, - axis, - direction -) { - this.id = GameLib.Utils.RandomId(); - this.body = body; - this.position = position; - this.axis = axis; - this.direction = direction; -}; diff --git a/bak/game-lib-d3-api-camera-stereo-anaglyph.js b/bak/r3-d3-api-camera-stereo-anaglyph.js similarity index 56% rename from bak/game-lib-d3-api-camera-stereo-anaglyph.js rename to bak/r3-d3-api-camera-stereo-anaglyph.js index f23b2f0..5ba0989 100644 --- a/bak/game-lib-d3-api-camera-stereo-anaglyph.js +++ b/bak/r3-d3-api-camera-stereo-anaglyph.js @@ -1,5 +1,5 @@ /** - * GameLib.D3.API.Camera.Stereo.Anaglyph + * R3.D3.API.Camera.Stereo.Anaglyph * @constructor * @param apiStereoCamera * @param colorMatrixLeft @@ -7,7 +7,7 @@ * @param orthographicCamera * @param orthographicScene */ -GameLib.D3.API.Camera.Stereo.Anaglyph = function( +R3.D3.API.Camera.Stereo.Anaglyph = function( apiStereoCamera, colorMatrixLeft, colorMatrixRight, @@ -19,17 +19,17 @@ GameLib.D3.API.Camera.Stereo.Anaglyph = function( meshPlane ) { - if (GameLib.Utils.UndefinedOrNull(apiStereoCamera)) { + if (R3.Utils.UndefinedOrNull(apiStereoCamera)) { apiStereoCamera = { - stereoType : GameLib.D3.API.Camera.Stereo.STEREO_MODE_ANAGLYPH + stereoType : R3.D3.API.Camera.Stereo.STEREO_MODE_ANAGLYPH }; } - if (GameLib.Utils.UndefinedOrNull(apiStereoCamera.stereoType)) { - apiStereoCamera.stereoType = GameLib.D3.API.Camera.Stereo.STEREO_MODE_ANAGLYPH; + if (R3.Utils.UndefinedOrNull(apiStereoCamera.stereoType)) { + apiStereoCamera.stereoType = R3.D3.API.Camera.Stereo.STEREO_MODE_ANAGLYPH; } - if (GameLib.Utils.UndefinedOrNull(colorMatrixLeft)) { + if (R3.Utils.UndefinedOrNull(colorMatrixLeft)) { colorMatrixLeft = [ 1.0671679973602295, -0.0016435992438346148, 0.0001777536963345483, // r out -0.028107794001698494, -0.00019593400065787137, -0.0002875397040043026, // g out @@ -38,7 +38,7 @@ GameLib.D3.API.Camera.Stereo.Anaglyph = function( } this.colorMatrixLeft = colorMatrixLeft; - if (GameLib.Utils.UndefinedOrNull(colorMatrixRight)) { + if (R3.Utils.UndefinedOrNull(colorMatrixRight)) { colorMatrixRight = [ -0.0355340838432312, -0.06440307199954987, 0.018319187685847282, // r out -0.10269022732973099, 0.8079727292060852, -0.04835830628871918, // g out @@ -47,18 +47,18 @@ GameLib.D3.API.Camera.Stereo.Anaglyph = function( } this.colorMatrixRight = colorMatrixRight; - if (GameLib.Utils.UndefinedOrNull(orthographicCamera)) { - orthographicCamera = new GameLib.D3.API.Camera.Orthographic(null, null, 0, 1, -1, 1, 1, -1); + if (R3.Utils.UndefinedOrNull(orthographicCamera)) { + orthographicCamera = new R3.D3.API.Camera.Orthographic(null, null, 0, 1, -1, 1, 1, -1); } this.orthographicCamera = orthographicCamera; - if (GameLib.Utils.UndefinedOrNull(orthographicScene)) { - orthographicScene = new GameLib.D3.API.Scene(null, 'Orthographic Stereo Anaglyph Scene'); + if (R3.Utils.UndefinedOrNull(orthographicScene)) { + orthographicScene = new R3.D3.API.Scene(null, 'Orthographic Stereo Anaglyph Scene'); } this.orthographicScene = orthographicScene; // - // if (GameLib.Utils.UndefinedOrNull(renderTargetL)) { - // renderTargetL = new GameLib.D3.API.RenderTarget(null, null, null, ) + // if (R3.Utils.UndefinedOrNull(renderTargetL)) { + // renderTargetL = new R3.D3.API.RenderTarget(null, null, null, ) // } // // renderTargetL, @@ -66,7 +66,7 @@ GameLib.D3.API.Camera.Stereo.Anaglyph = function( // shaderMaterial, // meshPlane - GameLib.D3.API.Camera.Stereo.call( + R3.D3.API.Camera.Stereo.call( this, apiStereoCamera, apiStereoCamera.stereoType, @@ -77,5 +77,5 @@ GameLib.D3.API.Camera.Stereo.Anaglyph = function( ); }; -GameLib.D3.API.Camera.Stereo.Anaglyph.prototype = Object.create(GameLib.D3.API.Camera.Stereo.prototype); -GameLib.D3.API.Camera.Stereo.Anaglyph.prototype.constructor = GameLib.D3.API.Camera.Stereo.Anaglyph; +R3.D3.API.Camera.Stereo.Anaglyph.prototype = Object.create(R3.D3.API.Camera.Stereo.prototype); +R3.D3.API.Camera.Stereo.Anaglyph.prototype.constructor = R3.D3.API.Camera.Stereo.Anaglyph; diff --git a/bak/r3-d3-api-camera-stereo-normal.js b/bak/r3-d3-api-camera-stereo-normal.js new file mode 100644 index 0000000..4445e16 --- /dev/null +++ b/bak/r3-d3-api-camera-stereo-normal.js @@ -0,0 +1,32 @@ +/** + * R3.D3.API.Camera.Stereo.Normal + * @constructor + * @param apiStereoCamera + */ +R3.D3.API.Camera.Stereo.Normal = function( + apiStereoCamera +) { + + if (R3.Utils.UndefinedOrNull(apiStereoCamera)) { + apiStereoCamera = { + stereoType : R3.D3.API.Camera.Stereo.STEREO_TYPE_NORMAL + }; + } + + if (R3.Utils.UndefinedOrNull(apiStereoCamera.stereoType)) { + apiStereoCamera.stereoType = R3.D3.API.Camera.Stereo.STEREO_TYPE_NORMAL; + } + + R3.D3.API.Camera.Stereo.call( + this, + apiStereoCamera, + apiStereoCamera.stereoType, + apiStereoCamera.eyeSep, + apiStereoCamera.main, + apiStereoCamera.cameraL, + apiStereoCamera.cameraR + ); +}; + +R3.D3.API.Camera.Stereo.Normal.prototype = Object.create(R3.D3.API.Camera.Stereo.prototype); +R3.D3.API.Camera.Stereo.Normal.prototype.constructor = R3.D3.API.Camera.Stereo.Normal; \ No newline at end of file diff --git a/bak/game-lib-d3-api-editor.js b/bak/r3-d3-api-editor.js similarity index 59% rename from bak/game-lib-d3-api-editor.js rename to bak/r3-d3-api-editor.js index 5be3fc1..2caa4f3 100644 --- a/bak/game-lib-d3-api-editor.js +++ b/bak/r3-d3-api-editor.js @@ -5,7 +5,7 @@ * @param baseUrl * @param path * @param imageFactory - * @param games [GameLib.API.D3.Game] + * @param games [R3.API.D3.Game] * @param scenes * @param cameras * @param composers @@ -19,7 +19,7 @@ * @param parentEntity * @constructor */ -GameLib.D3.API.Editor = function( +R3.D3.API.Editor = function( id, name, baseUrl, @@ -38,116 +38,116 @@ GameLib.D3.API.Editor = function( selectedObjects, parentEntity ) { - GameLib.Component.call( + R3.Component.call( this, - GameLib.Component.COMPONENT_EDITOR, + R3.Component.COMPONENT_EDITOR, { - 'imageFactory' : GameLib.D3.ImageFactory, - 'games' : [GameLib.D3.Game], - 'scenes' : [GameLib.D3.Scene], - 'cameras' : [GameLib.D3.Camera], - 'composers' : [GameLib.D3.Composer], - 'viewports' : [GameLib.D3.Viewport], - 'renderers' : [GameLib.D3.Renderer], - 'renderTargets' : [GameLib.D3.RenderTarget], - 'systems' : [GameLib.System], - 'entityManager' : GameLib.EntityManager + 'imageFactory' : R3.D3.ImageFactory, + 'games' : [R3.D3.Game], + 'scenes' : [R3.D3.Scene], + 'cameras' : [R3.D3.Camera], + 'composers' : [R3.D3.Composer], + 'viewports' : [R3.D3.Viewport], + 'renderers' : [R3.D3.Renderer], + 'renderTargets' : [R3.D3.RenderTarget], + 'systems' : [R3.System], + 'entityManager' : R3.EntityManager }, null, parentEntity ); - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); } this.id = id; - if (GameLib.Utils.UndefinedOrNull(name)) { + if (R3.Utils.UndefinedOrNull(name)) { name = 'Editor (' + this.id + ')'; } this.name = name; - if (GameLib.Utils.UndefinedOrNull(baseUrl)) { + if (R3.Utils.UndefinedOrNull(baseUrl)) { baseUrl = ''; } this.baseUrl = baseUrl; - if (GameLib.Utils.UndefinedOrNull(path)) { + if (R3.Utils.UndefinedOrNull(path)) { path = ''; } this.path = path; - if (GameLib.Utils.UndefinedOrNull(imageFactory)) { + if (R3.Utils.UndefinedOrNull(imageFactory)) { imageFactory = null; } this.imageFactory = imageFactory; - if (GameLib.Utils.UndefinedOrNull(games)) { + if (R3.Utils.UndefinedOrNull(games)) { games = []; } this.games = games; - if (GameLib.Utils.UndefinedOrNull(scenes)) { + if (R3.Utils.UndefinedOrNull(scenes)) { scenes = []; } this.scenes = scenes; - if (GameLib.Utils.UndefinedOrNull(cameras)) { + if (R3.Utils.UndefinedOrNull(cameras)) { cameras = []; } this.cameras = cameras; - if (GameLib.Utils.UndefinedOrNull(composers)) { + if (R3.Utils.UndefinedOrNull(composers)) { composers = []; } this.composers = composers; - if (GameLib.Utils.UndefinedOrNull(viewports)) { + if (R3.Utils.UndefinedOrNull(viewports)) { viewports = []; } this.viewports = viewports; - if (GameLib.Utils.UndefinedOrNull(renderers)) { + if (R3.Utils.UndefinedOrNull(renderers)) { renderers = []; } this.renderers = renderers; - if (GameLib.Utils.UndefinedOrNull(renderTargets)) { + if (R3.Utils.UndefinedOrNull(renderTargets)) { renderTargets = []; } this.renderTargets = renderTargets; - if (GameLib.Utils.UndefinedOrNull(systems)) { + if (R3.Utils.UndefinedOrNull(systems)) { systems = []; } this.systems = systems; - if (GameLib.Utils.UndefinedOrNull(entityManager)) { - entityManager = new GameLib.API.EntityManager(); + if (R3.Utils.UndefinedOrNull(entityManager)) { + entityManager = new R3.API.EntityManager(); } this.entityManager = entityManager; - if (GameLib.Utils.UndefinedOrNull(allSelected)) { + if (R3.Utils.UndefinedOrNull(allSelected)) { allSelected = false; } this.allSelected = allSelected; - if (GameLib.Utils.UndefinedOrNull(selectedObjects)) { + if (R3.Utils.UndefinedOrNull(selectedObjects)) { selectedObjects = []; } this.selectedObjects = selectedObjects; }; -GameLib.D3.API.Editor.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Editor.prototype.constructor = GameLib.D3.API.Editor; +R3.D3.API.Editor.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Editor.prototype.constructor = R3.D3.API.Editor; /** * Creates an API Editor from an Object Editor * @param objectEditor * @constructor */ -GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { +R3.D3.API.Editor.FromObjectEditor = function(objectEditor) { var apiImageFactory = null; var apiGames = []; @@ -161,13 +161,13 @@ GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { var apiEntityManager = null; if (objectEditor.imageFactory) { - apiImageFactory = GameLib.D3.API.ImageFactory.FromObjectImageFactory(objectEditor.imageFactory); + apiImageFactory = R3.D3.API.ImageFactory.FromObjectImageFactory(objectEditor.imageFactory); } if (objectEditor.games) { apiGames = objectEditor.games.map( function(objectGame){ - return GameLib.D3.API.Game.FromObjectGame(objectGame); + return R3.D3.API.Game.FromObjectGame(objectGame); } ); } @@ -175,7 +175,7 @@ GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { if (objectEditor.scenes) { apiScenes = objectEditor.scenes.map( function(objectScene){ - return GameLib.D3.API.Scene.FromObjectScene(objectScene); + return R3.D3.API.Scene.FromObjectScene(objectScene); } ); } @@ -183,7 +183,7 @@ GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { if (objectEditor.cameras) { apiCameras = objectEditor.cameras.map( function(objectCamera){ - return GameLib.D3.API.Camera.FromObjectCamera(objectCamera); + return R3.D3.API.Camera.FromObjectCamera(objectCamera); } ); } @@ -191,7 +191,7 @@ GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { if (objectEditor.composers) { apiComposers = objectEditor.composers.map( function(objectComposer){ - return GameLib.D3.API.Composer.FromObjectComponent(objectComposer); + return R3.D3.API.Composer.FromObjectComponent(objectComposer); } ); } @@ -199,7 +199,7 @@ GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { if (objectEditor.viewports) { apiViewports = objectEditor.viewports.map( function(objectViewport){ - return GameLib.D3.API.Viewport.FromObjectViewport(objectViewport); + return R3.D3.API.Viewport.FromObjectViewport(objectViewport); } ); } @@ -207,7 +207,7 @@ GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { if (objectEditor.renderers) { apiRenderers = objectEditor.renderers.map( function(objectRenderer){ - return GameLib.D3.API.Renderer.FromObjectComponent(objectRenderer); + return R3.D3.API.Renderer.FromObjectComponent(objectRenderer); } ); } @@ -215,7 +215,7 @@ GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { if (objectEditor.renderTargets) { apiRenderTargets = objectEditor.renderTargets.map( function(objectRenderTarget){ - return GameLib.D3.API.RenderTarget.FromObjectComponent(objectRenderTarget); + return R3.D3.API.RenderTarget.FromObjectComponent(objectRenderTarget); } ); } @@ -223,16 +223,16 @@ GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) { if (objectEditor.systems) { apiSystems = objectEditor.systems.map( function(objectSystem){ - return GameLib.API.System.FromObjectComponent(objectSystem); + return R3.API.System.FromObjectComponent(objectSystem); } ); } if (objectEditor.entityManager) { - apiEntityManager = GameLib.API.EntityManager.FromObjectEntityManager(objectEditor.entityManager); + apiEntityManager = R3.API.EntityManager.FromObjectEntityManager(objectEditor.entityManager); } - return new GameLib.D3.API.Editor( + return new R3.D3.API.Editor( objectEditor.id, objectEditor.name, objectEditor.baseUrl, diff --git a/bak/r3-d3-api-follow.js b/bak/r3-d3-api-follow.js new file mode 100644 index 0000000..2f36174 --- /dev/null +++ b/bak/r3-d3-api-follow.js @@ -0,0 +1,98 @@ +/** + * Follow Component + * @param id + * @param name + * @param currentComponent R3.Component + * @param targetComponent R3.Component + * @param targetPositionOffset R3.API.Vector3 + * @param minDistance + * @param moveSpeed + * @param parentEntity + * @constructor + */ +R3.D3.API.Follow = function ( + id, + name, + currentComponent, + targetComponent, + targetPositionOffset, + minDistance, + moveSpeed, + parentEntity +) { + + R3.Component.call( + this, + R3.Component.COMPONENT_FOLLOW, + { + 'currentComponent': R3.Component, + 'targetComponent': R3.Component + }, + parentEntity + ); + + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); + } + this.id = id; + + if (R3.Utils.UndefinedOrNull(name)) { + name = this.constructor.name; + } + this.name = name; + + if (R3.Utils.UndefinedOrNull(currentComponent)) { + currentComponent = null; + } + this.currentComponent = currentComponent; + + if (R3.Utils.UndefinedOrNull(targetComponent)) { + targetComponent = null; + } + this.targetComponent = targetComponent; + + if(R3.Utils.UndefinedOrNull(targetPositionOffset)) { + targetPositionOffset = new R3.API.Vector3(0, 0, 0); + } + this.targetPositionOffset = targetPositionOffset; + + if (R3.Utils.UndefinedOrNull(minDistance)) { + minDistance = 2; + } + this.minDistance = minDistance; + + if (R3.Utils.UndefinedOrNull(moveSpeed)) { + moveSpeed = 12.5; + } + this.moveSpeed = moveSpeed; + + this.target = new R3.API.Vector3(0, 0, 0); + + this.targetToParent = new R3.API.Vector3(0, 0, 0); + + this.rotatedTargetOffset = new R3.API.Vector3(0, 0, 0); + + this.rotated = new R3.API.Quaternion(); +}; + +R3.D3.API.Follow.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Follow.prototype.constructor = R3.D3.API.Follow; + +/** + * Object to R3.D3.API.Follow + * @param objectComponent + * @returns {R3.D3.API.Follow} + * @constructor + */ +R3.D3.API.Follow.FromObject = function(objectComponent) { + return new R3.D3.API.Follow( + objectComponent.id, + objectComponent.name, + objectComponent.currentComponent, + objectComponent.targetComponent, + R3.API.Vector3.FromObject(objectComponent.targetPositionOffset), + objectComponent.minDistance, + objectComponent.moveSpeed, + objectComponent.parentEntity + ); +}; diff --git a/bak/game-lib-d3-api-game.js b/bak/r3-d3-api-game.js similarity index 59% rename from bak/game-lib-d3-api-game.js rename to bak/r3-d3-api-game.js index 3242ac0..343cc3f 100644 --- a/bak/game-lib-d3-api-game.js +++ b/bak/r3-d3-api-game.js @@ -18,7 +18,7 @@ * @param parentEntity * @constructor */ -GameLib.D3.API.Game = function( +R3.D3.API.Game = function( id, name, baseUrl, @@ -34,100 +34,100 @@ GameLib.D3.API.Game = function( entityManager, parentEntity ) { - GameLib.Component.call( + R3.Component.call( this, - GameLib.Component.COMPONENT_GAME, + R3.Component.COMPONENT_GAME, { - 'imageFactory' : GameLib.D3.ImageFactory, - 'cameras' : [GameLib.D3.Camera], - 'composers' : [GameLib.D3.Composer], - 'viewports' : [GameLib.D3.Viewport], - 'renderers' : [GameLib.D3.Renderer], - 'renderTargets' : [GameLib.D3.RenderTarget], - 'systems' : [GameLib.System], - 'entityManager' : GameLib.EntityManager + 'imageFactory' : R3.D3.ImageFactory, + 'cameras' : [R3.D3.Camera], + 'composers' : [R3.D3.Composer], + 'viewports' : [R3.D3.Viewport], + 'renderers' : [R3.D3.Renderer], + 'renderTargets' : [R3.D3.RenderTarget], + 'systems' : [R3.System], + 'entityManager' : R3.EntityManager }, null, parentEntity ); - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); } this.id = id; - if (GameLib.Utils.UndefinedOrNull(name)) { + if (R3.Utils.UndefinedOrNull(name)) { name = 'Game (' + this.id + ')'; } this.name = name; - if (GameLib.Utils.UndefinedOrNull(baseUrl)) { + if (R3.Utils.UndefinedOrNull(baseUrl)) { baseUrl = ''; console.warn('The base URL required for downloading images is not set - textured meshes will not render properly'); } this.baseUrl = baseUrl; - if (GameLib.Utils.UndefinedOrNull(path)) { + if (R3.Utils.UndefinedOrNull(path)) { path = ''; } this.path = path; - if (GameLib.Utils.UndefinedOrNull(imageFactory)) { + if (R3.Utils.UndefinedOrNull(imageFactory)) { imageFactory = null; } this.imageFactory = imageFactory; - if (GameLib.Utils.UndefinedOrNull(gameType)) { - gameType = GameLib.D3.Game.GAME_TYPE_VR_PONG; + if (R3.Utils.UndefinedOrNull(gameType)) { + gameType = R3.D3.Game.GAME_TYPE_VR_PONG; } this.gameType = gameType; - if (GameLib.Utils.UndefinedOrNull(cameras)) { + if (R3.Utils.UndefinedOrNull(cameras)) { cameras = []; } this.cameras = cameras; - if (GameLib.Utils.UndefinedOrNull(composers)) { + if (R3.Utils.UndefinedOrNull(composers)) { composers = []; } this.composers = composers; - if (GameLib.Utils.UndefinedOrNull(viewports)) { + if (R3.Utils.UndefinedOrNull(viewports)) { viewports = []; } this.viewports = viewports; - if (GameLib.Utils.UndefinedOrNull(renderers)) { + if (R3.Utils.UndefinedOrNull(renderers)) { renderers = []; } this.renderers = renderers; - if (GameLib.Utils.UndefinedOrNull(renderTargets)) { + if (R3.Utils.UndefinedOrNull(renderTargets)) { renderTargets = []; } this.renderTargets = renderTargets; - if (GameLib.Utils.UndefinedOrNull(systems)) { + if (R3.Utils.UndefinedOrNull(systems)) { systems = []; } this.systems = systems; - if (GameLib.Utils.UndefinedOrNull(entityManager)) { + if (R3.Utils.UndefinedOrNull(entityManager)) { entityManager = null; } this.entityManager = entityManager; }; -GameLib.D3.API.Game.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Game.prototype.constructor = GameLib.D3.API.Game; +R3.D3.API.Game.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Game.prototype.constructor = R3.D3.API.Game; /** * Creates an API camera from an Object camera * @param objectGame * @constructor */ -GameLib.D3.API.Game.FromObjectGame = function(objectGame) { +R3.D3.API.Game.FromObjectGame = function(objectGame) { var apiImageFactory = null; var apiCameras = []; @@ -140,13 +140,13 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) { var apiEntityManager = null; if (objectGame.imageFactory) { - apiImageFactory = GameLib.D3.API.ImageFactory.FromObjectImageFactory(objectGame.imageFactory); + apiImageFactory = R3.D3.API.ImageFactory.FromObjectImageFactory(objectGame.imageFactory); } if (objectGame.cameras) { apiCameras = objectGame.cameras.map( function(objectCamera){ - return GameLib.D3.API.Camera.FromObjectCamera(objectCamera); + return R3.D3.API.Camera.FromObjectCamera(objectCamera); } ); } @@ -154,7 +154,7 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) { if (objectGame.composers) { apiComposers = objectGame.composers.map( function(objectComposer){ - return GameLib.D3.API.Composer.FromObjectComponent(objectComposer); + return R3.D3.API.Composer.FromObjectComponent(objectComposer); } ); } @@ -162,7 +162,7 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) { if (objectGame.viewports) { apiViewports = objectGame.viewports.map( function(objectViewport){ - return GameLib.D3.API.Viewport.FromObjectViewport(objectViewport); + return R3.D3.API.Viewport.FromObjectViewport(objectViewport); } ); } @@ -170,7 +170,7 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) { if (objectGame.renderers) { apiRenderers = objectGame.renderers.map( function(objectRenderer){ - return GameLib.D3.API.Renderer.FromObjectComponent(objectRenderer); + return R3.D3.API.Renderer.FromObjectComponent(objectRenderer); } ); } @@ -178,7 +178,7 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) { if (objectGame.renderTargets) { apiRenderTargets = objectGame.renderTargets.map( function(objectRenderTarget){ - return GameLib.D3.API.RenderTarget.FromObjectComponent(objectRenderTarget); + return R3.D3.API.RenderTarget.FromObjectComponent(objectRenderTarget); } ); } @@ -186,16 +186,16 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) { if (objectGame.systems) { apiSystems = objectGame.systems.map( function(objectSystem){ - return GameLib.API.System.FromObjectComponent(objectSystem); + return R3.API.System.FromObjectComponent(objectSystem); } ); } if (objectGame.entityManager) { - apiEntityManager = GameLib.API.EntityManager.FromObjectEntityManager(objectGame.entityManager); + apiEntityManager = R3.API.EntityManager.FromObjectEntityManager(objectGame.entityManager); } - return new GameLib.D3.API.Game( + return new R3.D3.API.Game( objectGame.id, objectGame.name, objectGame.baseUrl, diff --git a/bak/r3-d3-api-graphics.js b/bak/r3-d3-api-graphics.js new file mode 100644 index 0000000..d88fb90 --- /dev/null +++ b/bak/r3-d3-api-graphics.js @@ -0,0 +1,39 @@ +/** + * Graphics API + * @param id String + * @param name + * @param graphicsType + * @param parentEntity + * @constructor + */ +R3.D3.API.Graphics = function ( + parentEntity +) { + + R3.Component.call( + this, + R3.Component.COMPONENT_GRAPHICS, + null, + null, + parentEntity + ); + + +}; + +R3.D3.API.Graphics.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Graphics.prototype.constructor = R3.D3.API.Graphics; + +/** + * Object to R3.D3.API.Graphics + * @param objectComponent + * @constructor + */ +R3.D3.API.Graphics.FromObjectComponent = function(objectComponent) { + return new R3.D3.API.Graphics( + objectComponent.id, + objectComponent.name, + objectComponent.graphicsType, + objectComponent.parentEntity + ); +}; diff --git a/bak/r3-d3-api-helper.js b/bak/r3-d3-api-helper.js new file mode 100644 index 0000000..36a9548 --- /dev/null +++ b/bak/r3-d3-api-helper.js @@ -0,0 +1,87 @@ +/** + * This component renders a scene + * @param id String + * @param name String + * @param helperType + * @param object + * @param parentEntity + * @constructor + */ +R3.D3.API.Helper = function ( + id, + name, + helperType, + object, + parentEntity +) { + + R3.Component.call( + this, + R3.Component.COMPONENT_HELPER, + null, + null, + parentEntity + ); + + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); + } + this.id = id; + + if (R3.Utils.UndefinedOrNull(name)) { + name = 'Helper (' + id + ')'; + } + this.name = name; + + if (R3.Utils.UndefinedOrNull(object)) { + console.warn('Cannot create a helper for an Object which does not exist'); + throw new Error('Cannot create a helper for an Object which does not exist'); + } + + if (R3.Utils.UndefinedOrNull(helperType)) { + if ( + object instanceof R3.D3.Mesh && + object.meshType != R3.D3.Mesh.TYPE_CURVE + ) { + helperType = R3.D3.Helper.HELPER_TYPE_WIREFRAME; + } + + if (object instanceof R3.D3.Light) { + if (object.lightType == R3.D3.Light.LIGHT_TYPE_DIRECTIONAL) { + helperType = R3.D3.Helper.HELPER_TYPE_DIRECTIONAL_LIGHT; + } + + if (object.lightType == R3.D3.Light.LIGHT_TYPE_POINT) { + helperType = R3.D3.Helper.HELPER_TYPE_POINT_LIGHT; + } + + if (object.lightType == R3.D3.Light.LIGHT_TYPE_SPOT) { + helperType = R3.D3.Helper.HELPER_TYPE_SPOT_LIGHT; + } + } + + if (object instanceof R3.D3.Skeleton) { + helperType = R3.D3.Helper.HELPER_TYPE_SKELETON; + } + } + this.helperType = helperType; + +}; + +R3.D3.API.Helper.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Helper.prototype.constructor = R3.D3.API.Helper; + +/** + * Object to R3.D3.API.Helper + * @param objectComponent + * @constructor + */ +R3.D3.API.Helper.FromObjectComponent = function(objectComponent) { + return new R3.D3.API.Helper( + objectComponent.id, + objectComponent.name, + objectComponent.helperType, + objectComponent.object, + objectComponent.parentEntity + ); +}; diff --git a/bak/game-lib-d3-api-image-factory.js b/bak/r3-d3-api-image-factory.js similarity index 58% rename from bak/game-lib-d3-api-image-factory.js rename to bak/r3-d3-api-image-factory.js index 48425d9..61754ea 100644 --- a/bak/game-lib-d3-api-image-factory.js +++ b/bak/r3-d3-api-image-factory.js @@ -6,44 +6,44 @@ * @param parentEntity * @constructor */ -GameLib.D3.API.ImageFactory = function( +R3.D3.API.ImageFactory = function( id, name, baseUrl, parentEntity ) { - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); } this.id = id; - if (GameLib.Utils.UndefinedOrNull(name)) { + if (R3.Utils.UndefinedOrNull(name)) { name = 'ImageFactory (' + this.id + ')'; } this.name = name; - if (GameLib.Utils.UndefinedOrNull(baseUrl)) { + if (R3.Utils.UndefinedOrNull(baseUrl)) { baseUrl = ''; console.warn('No baseURL defined for image factory'); } this.baseUrl = baseUrl; - if (GameLib.Utils.UndefinedOrNull(parentEntity)) { + if (R3.Utils.UndefinedOrNull(parentEntity)) { parentEntity = null; } this.parentEntity = parentEntity; }; -GameLib.D3.API.ImageFactory.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.ImageFactory.prototype.constructor = GameLib.D3.API.ImageFactory; +R3.D3.API.ImageFactory.prototype = Object.create(R3.Component.prototype); +R3.D3.API.ImageFactory.prototype.constructor = R3.D3.API.ImageFactory; /** * Returns an API ImageFactory from an Object ImageFactory * @param objectImageFactory * @constructor */ -GameLib.D3.API.ImageFactory.FromObject = function(objectImageFactory) { - return new GameLib.D3.API.ImageFactory( +R3.D3.API.ImageFactory.FromObject = function(objectImageFactory) { + return new R3.D3.API.ImageFactory( objectImageFactory.id, objectImageFactory.name, objectImageFactory.baseUrl, diff --git a/bak/r3-d3-api-input-a.js b/bak/r3-d3-api-input-a.js new file mode 100644 index 0000000..ce88a99 --- /dev/null +++ b/bak/r3-d3-api-input-a.js @@ -0,0 +1,5 @@ +/** + * R3.D3.API.Input namespace + * @constructor + */ +R3.D3.API.Input = function() {}; diff --git a/bak/game-lib-d3-api-input-drive.js b/bak/r3-d3-api-input-drive.js similarity index 62% rename from bak/game-lib-d3-api-input-drive.js rename to bak/r3-d3-api-input-drive.js index bca249a..648e159 100644 --- a/bak/game-lib-d3-api-input-drive.js +++ b/bak/r3-d3-api-input-drive.js @@ -3,7 +3,7 @@ * @param id String * @param name String * @param domElementId - * @param pathFollowingComponent GameLib.D3.Mesh + * @param pathFollowingComponent R3.D3.Mesh * @param parentEntity * @param wheelFL * @param wheelFR @@ -15,7 +15,7 @@ * @param rotationFactor * @constructor */ -GameLib.D3.API.Input.Drive = function ( +R3.D3.API.Input.Drive = function ( id, name, domElementId, @@ -30,84 +30,84 @@ GameLib.D3.API.Input.Drive = function ( distanceGrain, rotationFactor ) { - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); } this.id = id; - if (GameLib.Utils.UndefinedOrNull(name)) { + if (R3.Utils.UndefinedOrNull(name)) { name = 'Input.Drive (' + this.id + ')'; } this.name = name; - if (GameLib.Utils.UndefinedOrNull(domElementId)) { + if (R3.Utils.UndefinedOrNull(domElementId)) { domElementId = "divCanvas"; } this.domElementId = domElementId; - if (GameLib.Utils.UndefinedOrNull(pathFollowingComponent)) { + if (R3.Utils.UndefinedOrNull(pathFollowingComponent)) { pathFollowingComponent = null; } this.pathFollowingComponent = pathFollowingComponent; - if (GameLib.Utils.UndefinedOrNull(parentEntity)) { + if (R3.Utils.UndefinedOrNull(parentEntity)) { parentEntity = null; } this.parentEntity = parentEntity; - if (GameLib.Utils.UndefinedOrNull(wheelFL)) { + if (R3.Utils.UndefinedOrNull(wheelFL)) { wheelFL = null; } this.wheelFL = wheelFL; - if (GameLib.Utils.UndefinedOrNull(wheelFR)) { + if (R3.Utils.UndefinedOrNull(wheelFR)) { wheelFR = null; } this.wheelFR = wheelFR; - if (GameLib.Utils.UndefinedOrNull(wheelRL)) { + if (R3.Utils.UndefinedOrNull(wheelRL)) { wheelRL = null; } this.wheelRL = wheelRL; - if (GameLib.Utils.UndefinedOrNull(wheelRR)) { + if (R3.Utils.UndefinedOrNull(wheelRR)) { wheelRR = null; } this.wheelRR = wheelRR; - if (GameLib.Utils.UndefinedOrNull(heightOffset)) { + if (R3.Utils.UndefinedOrNull(heightOffset)) { heightOffset = 0; } this.heightOffset = heightOffset; - if (GameLib.Utils.UndefinedOrNull(distance)) { + if (R3.Utils.UndefinedOrNull(distance)) { distance = 0; } this.distance = distance; - if (GameLib.Utils.UndefinedOrNull(distanceGrain)) { + if (R3.Utils.UndefinedOrNull(distanceGrain)) { distanceGrain = 0.1; } this.distanceGrain = distanceGrain; - if (GameLib.Utils.UndefinedOrNull(rotationFactor)) { + if (R3.Utils.UndefinedOrNull(rotationFactor)) { rotationFactor = 0.1; } this.rotationFactor = rotationFactor; }; -GameLib.D3.API.Input.Drive.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Input.Drive.prototype.constructor = GameLib.D3.API.Input.Drive; +R3.D3.API.Input.Drive.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Input.Drive.prototype.constructor = R3.D3.API.Input.Drive; /** - * Object to GameLib.D3.API.Input.Drive + * Object to R3.D3.API.Input.Drive * @param objectComponent - * @returns {GameLib.D3.API.Input.Drive} + * @returns {R3.D3.API.Input.Drive} * @constructor */ -GameLib.D3.API.Input.Drive.FromObject = function(objectComponent) { - return new GameLib.D3.API.Input.Drive( +R3.D3.API.Input.Drive.FromObject = function(objectComponent) { + return new R3.D3.API.Input.Drive( objectComponent.id, objectComponent.name, objectComponent.domElementId, diff --git a/bak/r3-d3-api-input-editor.bak b/bak/r3-d3-api-input-editor.bak new file mode 100644 index 0000000..fa371e9 --- /dev/null +++ b/bak/r3-d3-api-input-editor.bak @@ -0,0 +1,50 @@ +/** + * This component makes the parentEntity (ex. car) follow the path provided by the spline + * @param id String + * @param name String + * @param domElementId + * @param camera R3.D3.Camera + * @param parentEntity + * @constructor + */ +R3.D3.API.Input.Editor = function ( + id, + name, + domElementId, + camera, + parentEntity +) { + R3.Component.call( + this, + R3.Component.COMPONENT_EDITOR_INPUT, + { + 'camera' : R3.D3.Camera + }, + null, + parentEntity + ); + + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); + } + this.id = id; + + if (R3.Utils.UndefinedOrNull(name)) { + name = this.constructor.name; + } + this.name = name; + + if (R3.Utils.UndefinedOrNull(domElementId)) { + domElementId = "divCanvas"; + } + this.domElementId = domElementId; + + if (R3.Utils.UndefinedOrNull(camera)) { + camera = null; + } + this.camera = camera; + +}; + +R3.D3.API.Input.Editor.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Input.Editor.prototype.constructor = R3.D3.API.Input.Editor; diff --git a/bak/game-lib-d3-api-input-editor.js b/bak/r3-d3-api-input-editor.js similarity index 54% rename from bak/game-lib-d3-api-input-editor.js rename to bak/r3-d3-api-input-editor.js index ddea8c6..48cffe8 100644 --- a/bak/game-lib-d3-api-input-editor.js +++ b/bak/r3-d3-api-input-editor.js @@ -7,7 +7,7 @@ * @param parentEntity * @constructor */ -GameLib.D3.API.Input.Editor = function ( +R3.D3.API.Input.Editor = function ( id, name, domElement, @@ -15,44 +15,44 @@ GameLib.D3.API.Input.Editor = function ( parentEntity ) { - if (GameLib.Utils.UndefinedOrNull(id)) { - id = GameLib.Utils.RandomId(); + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); } this.id = id; - if (GameLib.Utils.UndefinedOrNull(name)) { + if (R3.Utils.UndefinedOrNull(name)) { name = 'Input Editor (' + this.id + ')'; } this.name = name; - if (GameLib.Utils.UndefinedOrNull(domElement)) { + if (R3.Utils.UndefinedOrNull(domElement)) { domElement = null; } this.domElement = domElement; - if (GameLib.Utils.UndefinedOrNull(camera)) { + if (R3.Utils.UndefinedOrNull(camera)) { camera = null; } this.camera = camera; - if (GameLib.Utils.UndefinedOrNull(parentEntity)) { + if (R3.Utils.UndefinedOrNull(parentEntity)) { parentEntity = null; } this.parentEntity = parentEntity; }; -GameLib.D3.API.Input.Editor.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Input.Editor.prototype.constructor = GameLib.D3.API.Input.Editor; +R3.D3.API.Input.Editor.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Input.Editor.prototype.constructor = R3.D3.API.Input.Editor; /** - * Object to GameLib.D3.API.Input.Editor + * Object to R3.D3.API.Input.Editor * @param objectComponent - * @returns {GameLib.D3.API.Input.Editor} + * @returns {R3.D3.API.Input.Editor} * @constructor */ -GameLib.D3.API.Input.Editor.FromObject = function(objectComponent) { - return new GameLib.D3.API.Input.Editor( +R3.D3.API.Input.Editor.FromObject = function(objectComponent) { + return new R3.D3.API.Input.Editor( objectComponent.id, objectComponent.name, objectComponent.domElement, diff --git a/bak/r3-d3-api-input-fly.bak b/bak/r3-d3-api-input-fly.bak new file mode 100644 index 0000000..e4778f3 --- /dev/null +++ b/bak/r3-d3-api-input-fly.bak @@ -0,0 +1,46 @@ +/** + * This component makes the parentEntity (ex. car) follow the path provided by the spline + * @param id String + * @param name String + * @param domElementId + * @param camera R3.D3.Camera + * @constructor + */ +R3.D3.API.Input.Fly = function ( + id, + name, + domElementId, + camera +) { + R3.Component.call( + this, + R3.Component.COMPONENT_FLY_INPUT, + { + 'camera' : R3.D3.Camera + } + ); + + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); + } + this.id = id; + + if (R3.Utils.UndefinedOrNull(name)) { + name = this.constructor.name; + } + this.name = name; + + if (R3.Utils.UndefinedOrNull(domElementId)) { + domElementId = "divCanvas"; + } + this.domElementId = domElementId; + + if (R3.Utils.UndefinedOrNull(camera)) { + camera = null; + } + this.camera = camera; + +}; + +R3.D3.API.Input.Fly.prototype = Object.create(R3.Component.prototype); +R3.D3.API.Input.Fly.prototype.constructor = R3.D3.API.Input.Fly; diff --git a/bak/r3-d3-api-look-at.js b/bak/r3-d3-api-look-at.js new file mode 100644 index 0000000..7e51376 --- /dev/null +++ b/bak/r3-d3-api-look-at.js @@ -0,0 +1,85 @@ +/** + * Looks from currentPosition to targetPosition (default up is 0,1,0) + * @param id + * @param name + * @param currentComponent R3.Component + * @param targetComponent R3.Component + * @param targetPositionOffset R3.API.Vector3 + * @param rotationSpeed Number + * @param parentEntity + * @constructor + */ +R3.D3.API.LookAt = function ( + id, + name, + currentComponent, + targetComponent, + targetPositionOffset, + rotationSpeed, + parentEntity +) { + + if (R3.Utils.UndefinedOrNull(id)) { + id = R3.Utils.RandomId(); + } + this.id = id; + + if (R3.Utils.UndefinedOrNull(name)) { + name = this.constructor.name; + } + this.name = name; + + if(R3.Utils.UndefinedOrNull(currentComponent)) { + currentComponent = null; + } + this.currentComponent = currentComponent; + + if(R3.Utils.UndefinedOrNull(targetComponent)) { + targetComponent = null; + } + this.targetComponent = targetComponent; + + if(R3.Utils.UndefinedOrNull(targetPositionOffset)) { + targetPositionOffset = new R3.API.Vector3(0, 0, 0); + } + this.targetPositionOffset = targetPositionOffset; + + if (R3.Utils.UndefinedOrNull(rotationSpeed)) { + rotationSpeed = 22.0; + } + this.rotationSpeed = rotationSpeed; + + this.lookAtMatrix = new R3.API.Matrix4(); + + this.up = new R3.API.Vector3(0, 1, 0); + + this.currentRotation = new R3.API.Quaternion(); + + this.targetPosition = new R3.API.Vector3(); + + if(R3.Utils.UndefinedOrNull(parentEntity)) { + parentEntity = null; + } + this.parentEntity = parentEntity; +}; + +R3.D3.API.LookAt.prototype = Object.create(R3.Component.prototype); +R3.D3.API.LookAt.prototype.constructor = R3.D3.API.LookAt; + +/** + * Object to R3.D3.API.LookAt + * @param objectComponent + * @returns {R3.D3.API.LookAt} + * @constructor + */ +R3.D3.API.LookAt.FromObject = function(objectComponent) { + return new R3.D3.API.LookAt( + objectComponent.id, + objectComponent.name, + objectComponent.currentComponent, + objectComponent.targetComponent, + R3.API.Vector3.FromObject(objectComponent.targetPositionOffset), + objectComponent.rotationSpeed, + objectComponent.parentEntity + ); +}; diff --git a/bak/game-lib-d3-api-mesh-box.js b/bak/r3-d3-api-mesh-box.js similarity index 62% rename from bak/game-lib-d3-api-mesh-box.js rename to bak/r3-d3-api-mesh-box.js index f901e9a..0c22169 100644 --- a/bak/game-lib-d3-api-mesh-box.js +++ b/bak/r3-d3-api-mesh-box.js @@ -1,44 +1,44 @@ /** - * GameLib.D3.API.Mesh.Box + * R3.D3.API.Mesh.Box * @constructor * @param apiMesh * @param width * @param height * @param depth */ -GameLib.D3.API.Mesh.Box = function( +R3.D3.API.Mesh.Box = function( apiMesh, width, height, depth ) { - if (GameLib.Utils.UndefinedOrNull(apiMesh)) { + if (R3.Utils.UndefinedOrNull(apiMesh)) { apiMesh = { - meshType : GameLib.D3.API.Mesh.MESH_TYPE_BOX + meshType : R3.D3.API.Mesh.MESH_TYPE_BOX }; } - if (GameLib.Utils.UndefinedOrNull(apiMesh.meshType)) { - apiMesh.meshType = GameLib.D3.API.Mesh.MESH_TYPE_BOX; + if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) { + apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_BOX; } - if (GameLib.Utils.UndefinedOrNull(width)) { + if (R3.Utils.UndefinedOrNull(width)) { width = 1; } this.width = width; - if (GameLib.Utils.UndefinedOrNull(height)) { + if (R3.Utils.UndefinedOrNull(height)) { height = 1; } this.height = height; - if (GameLib.Utils.UndefinedOrNull(depth)) { + if (R3.Utils.UndefinedOrNull(depth)) { depth = 1; } this.depth = depth; - GameLib.D3.API.Mesh.call( + R3.D3.API.Mesh.call( this, apiMesh.id, apiMesh.name, @@ -68,5 +68,5 @@ GameLib.D3.API.Mesh.Box = function( ); }; -GameLib.D3.API.Mesh.Box.prototype = Object.create(GameLib.D3.API.Mesh.prototype); -GameLib.D3.API.Mesh.Box.prototype.constructor = GameLib.D3.API.Mesh.Box; +R3.D3.API.Mesh.Box.prototype = Object.create(R3.D3.API.Mesh.prototype); +R3.D3.API.Mesh.Box.prototype.constructor = R3.D3.API.Mesh.Box; diff --git a/bak/game-lib-d3-api-mesh-curve.js b/bak/r3-d3-api-mesh-curve.js similarity index 62% rename from bak/game-lib-d3-api-mesh-curve.js rename to bak/r3-d3-api-mesh-curve.js index 9321808..d5c6b4e 100644 --- a/bak/game-lib-d3-api-mesh-curve.js +++ b/bak/r3-d3-api-mesh-curve.js @@ -1,30 +1,30 @@ /** - * GameLib.D3.API.Mesh.Curve + * R3.D3.API.Mesh.Curve * @constructor * @param apiMesh * @param pointSize */ -GameLib.D3.API.Mesh.Curve = function( +R3.D3.API.Mesh.Curve = function( apiMesh, pointSize ) { - if (GameLib.Utils.UndefinedOrNull(apiMesh)) { + if (R3.Utils.UndefinedOrNull(apiMesh)) { apiMesh = { - meshType : GameLib.D3.API.Mesh.MESH_TYPE_CURVE + meshType : R3.D3.API.Mesh.MESH_TYPE_CURVE }; } - if (GameLib.Utils.UndefinedOrNull(apiMesh.meshType)) { - apiMesh.meshType = GameLib.D3.API.Mesh.MESH_TYPE_CURVE; + if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) { + apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_CURVE; } - if (GameLib.Utils.UndefinedOrNull(pointSize)) { + if (R3.Utils.UndefinedOrNull(pointSize)) { pointSize = 1; } this.pointSize = pointSize; - GameLib.D3.API.Mesh.call( + R3.D3.API.Mesh.call( this, apiMesh.id, apiMesh.name, @@ -54,5 +54,5 @@ GameLib.D3.API.Mesh.Curve = function( ); }; -GameLib.D3.API.Mesh.Curve.prototype = Object.create(GameLib.D3.API.Mesh.prototype); -GameLib.D3.API.Mesh.Curve.prototype.constructor = GameLib.D3.API.Mesh.Curve; +R3.D3.API.Mesh.Curve.prototype = Object.create(R3.D3.API.Mesh.prototype); +R3.D3.API.Mesh.Curve.prototype.constructor = R3.D3.API.Mesh.Curve; diff --git a/bak/game-lib-d3-api-mesh-cylinder.js b/bak/r3-d3-api-mesh-cylinder.js similarity index 63% rename from bak/game-lib-d3-api-mesh-cylinder.js rename to bak/r3-d3-api-mesh-cylinder.js index 49d6743..7a8b341 100644 --- a/bak/game-lib-d3-api-mesh-cylinder.js +++ b/bak/r3-d3-api-mesh-cylinder.js @@ -1,5 +1,5 @@ /** - * GameLib.D3.API.Mesh.Cylinder + * R3.D3.API.Mesh.Cylinder * @constructor * @param apiMesh * @param radiusTop @@ -11,7 +11,7 @@ * @param thetaStart * @param thetaLength */ -GameLib.D3.API.Mesh.Cylinder = function( +R3.D3.API.Mesh.Cylinder = function( apiMesh, radiusTop, radiusBottom, @@ -22,57 +22,57 @@ GameLib.D3.API.Mesh.Cylinder = function( thetaStart, thetaLength ) { - if (GameLib.Utils.UndefinedOrNull(apiMesh)) { + if (R3.Utils.UndefinedOrNull(apiMesh)) { apiMesh = { - meshType : GameLib.D3.API.Mesh.MESH_TYPE_CYLINDER + meshType : R3.D3.API.Mesh.MESH_TYPE_CYLINDER }; } - if (GameLib.Utils.UndefinedOrNull(apiMesh.meshType)) { - apiMesh.meshType = GameLib.D3.API.Mesh.MESH_TYPE_CYLINDER; + if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) { + apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_CYLINDER; } - if (GameLib.Utils.UndefinedOrNull(radiusTop)) { + if (R3.Utils.UndefinedOrNull(radiusTop)) { radiusTop = 1; } this.radiusTop = radiusTop; - if (GameLib.Utils.UndefinedOrNull(radiusBottom)) { + if (R3.Utils.UndefinedOrNull(radiusBottom)) { radiusBottom = 1; } this.radiusBottom = radiusBottom; - if (GameLib.Utils.UndefinedOrNull(height)) { + if (R3.Utils.UndefinedOrNull(height)) { height = 5; } this.height = height; - if (GameLib.Utils.UndefinedOrNull(radiusSegments)) { + if (R3.Utils.UndefinedOrNull(radiusSegments)) { radiusSegments = 10; } this.radiusSegments = radiusSegments; - if (GameLib.Utils.UndefinedOrNull(heightSegments)) { + if (R3.Utils.UndefinedOrNull(heightSegments)) { heightSegments = 10; } this.heightSegments = heightSegments; - if (GameLib.Utils.UndefinedOrNull(openEnded)) { + if (R3.Utils.UndefinedOrNull(openEnded)) { openEnded = false; } this.openEnded = openEnded; - if (GameLib.Utils.UndefinedOrNull(thetaStart)) { + if (R3.Utils.UndefinedOrNull(thetaStart)) { thetaStart = 0; } this.thetaStart = thetaStart; - if (GameLib.Utils.UndefinedOrNull(thetaLength)) { + if (R3.Utils.UndefinedOrNull(thetaLength)) { thetaLength = Math.PI * 2; } this.thetaLength = thetaLength; - GameLib.D3.API.Mesh.call( + R3.D3.API.Mesh.call( this, apiMesh.id, apiMesh.name, @@ -102,5 +102,5 @@ GameLib.D3.API.Mesh.Cylinder = function( ); }; -GameLib.D3.API.Mesh.Cylinder.prototype = Object.create(GameLib.D3.API.Mesh.prototype); -GameLib.D3.API.Mesh.Cylinder.prototype.constructor = GameLib.D3.API.Mesh.Cylinder; +R3.D3.API.Mesh.Cylinder.prototype = Object.create(R3.D3.API.Mesh.prototype); +R3.D3.API.Mesh.Cylinder.prototype.constructor = R3.D3.API.Mesh.Cylinder; diff --git a/bak/game-lib-d3-api-mesh-line.js b/bak/r3-d3-api-mesh-line.js similarity index 62% rename from bak/game-lib-d3-api-mesh-line.js rename to bak/r3-d3-api-mesh-line.js index e920897..a893841 100644 --- a/bak/game-lib-d3-api-mesh-line.js +++ b/bak/r3-d3-api-mesh-line.js @@ -1,30 +1,30 @@ /** - * GameLib.D3.API.Mesh.Line + * R3.D3.API.Mesh.Line * @constructor * @param apiMesh * @param lineWidth */ -GameLib.D3.API.Mesh.Line = function( +R3.D3.API.Mesh.Line = function( apiMesh, lineWidth ) { - if (GameLib.Utils.UndefinedOrNull(apiMesh)) { + if (R3.Utils.UndefinedOrNull(apiMesh)) { apiMesh = { - meshType : GameLib.D3.API.Mesh.MESH_TYPE_LINE + meshType : R3.D3.API.Mesh.MESH_TYPE_LINE }; } - if (GameLib.Utils.UndefinedOrNull(apiMesh.meshType)) { - apiMesh.meshType = GameLib.D3.API.Mesh.MESH_TYPE_LINE; + if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) { + apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_LINE; } - if (GameLib.Utils.UndefinedOrNull(lineWidth)) { + if (R3.Utils.UndefinedOrNull(lineWidth)) { lineWidth = 1; } this.lineWidth = lineWidth; - GameLib.D3.API.Mesh.call( + R3.D3.API.Mesh.call( this, apiMesh.id, apiMesh.name, @@ -54,5 +54,5 @@ GameLib.D3.API.Mesh.Line = function( ); }; -GameLib.D3.API.Mesh.Line.prototype = Object.create(GameLib.D3.API.Mesh.prototype); -GameLib.D3.API.Mesh.Line.prototype.constructor = GameLib.D3.API.Mesh.Line; +R3.D3.API.Mesh.Line.prototype = Object.create(R3.D3.API.Mesh.prototype); +R3.D3.API.Mesh.Line.prototype.constructor = R3.D3.API.Mesh.Line; diff --git a/bak/game-lib-d3-api-mesh-plane.js b/bak/r3-d3-api-mesh-plane.js similarity index 60% rename from bak/game-lib-d3-api-mesh-plane.js rename to bak/r3-d3-api-mesh-plane.js index 6533d02..610d4c8 100644 --- a/bak/game-lib-d3-api-mesh-plane.js +++ b/bak/r3-d3-api-mesh-plane.js @@ -1,5 +1,5 @@ /** - * GameLib.D3.API.Mesh.Plane + * R3.D3.API.Mesh.Plane * @constructor * @param apiMesh * @param width @@ -14,7 +14,7 @@ * @param dotMapWeight * @param dotObject */ -GameLib.D3.API.Mesh.Plane = function( +R3.D3.API.Mesh.Plane = function( apiMesh, width, height, @@ -29,72 +29,72 @@ GameLib.D3.API.Mesh.Plane = function( dotObject ) { - if (GameLib.Utils.UndefinedOrNull(apiMesh)) { + if (R3.Utils.UndefinedOrNull(apiMesh)) { apiMesh = { - meshType : GameLib.D3.API.Mesh.MESH_TYPE_PLANE + meshType : R3.D3.API.Mesh.MESH_TYPE_PLANE }; } - if (GameLib.Utils.UndefinedOrNull(apiMesh.meshType)) { - apiMesh.meshType = GameLib.D3.API.Mesh.MESH_TYPE_PLANE; + if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) { + apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_PLANE; } - if (GameLib.Utils.UndefinedOrNull(width)) { + if (R3.Utils.UndefinedOrNull(width)) { width = 1; } this.width = width; - if (GameLib.Utils.UndefinedOrNull(height)) { + if (R3.Utils.UndefinedOrNull(height)) { height = 1; } this.height = height; - if (GameLib.Utils.UndefinedOrNull(widthSegments)) { + if (R3.Utils.UndefinedOrNull(widthSegments)) { widthSegments = 5; } this.widthSegments = widthSegments; - if (GameLib.Utils.UndefinedOrNull(heightSegments)) { + if (R3.Utils.UndefinedOrNull(heightSegments)) { heightSegments = 5; } this.heightSegments = heightSegments; - if (GameLib.Utils.UndefinedOrNull(heightMapScale)) { + if (R3.Utils.UndefinedOrNull(heightMapScale)) { heightMapScale = 1; } this.heightMapScale = heightMapScale; - if (GameLib.Utils.UndefinedOrNull(isHeightMap)) { + if (R3.Utils.UndefinedOrNull(isHeightMap)) { isHeightMap = false; } this.isHeightMap = isHeightMap; - if (GameLib.Utils.UndefinedOrNull(isDotMap)) { + if (R3.Utils.UndefinedOrNull(isDotMap)) { isDotMap = false; } this.isDotMap = isDotMap; - if (GameLib.Utils.UndefinedOrNull(dotMapScale)) { - dotMapScale = new GameLib.API.Vector3(0.01, 0.01, 0.01); + if (R3.Utils.UndefinedOrNull(dotMapScale)) { + dotMapScale = new R3.API.Vector3(0.01, 0.01, 0.01); } this.dotMapScale = dotMapScale; - if (GameLib.Utils.UndefinedOrNull(dotMapOffset)) { - dotMapOffset = new GameLib.API.Vector3(1, -1, 5); + if (R3.Utils.UndefinedOrNull(dotMapOffset)) { + dotMapOffset = new R3.API.Vector3(1, -1, 5); } this.dotMapOffset = dotMapOffset; - if (GameLib.Utils.UndefinedOrNull(dotMapWeight)) { - dotMapWeight = new GameLib.API.Vector3(1, 1, 1); + if (R3.Utils.UndefinedOrNull(dotMapWeight)) { + dotMapWeight = new R3.API.Vector3(1, 1, 1); } this.dotMapWeight = dotMapWeight; - if (GameLib.Utils.UndefinedOrNull(dotObject)) { + if (R3.Utils.UndefinedOrNull(dotObject)) { dotObject = null; } this.dotObject = dotObject; - GameLib.D3.API.Mesh.call( + R3.D3.API.Mesh.call( this, apiMesh.id, apiMesh.name, @@ -124,5 +124,5 @@ GameLib.D3.API.Mesh.Plane = function( ); }; -GameLib.D3.API.Mesh.Plane.prototype = Object.create(GameLib.D3.API.Mesh.prototype); -GameLib.D3.API.Mesh.Plane.prototype.constructor = GameLib.D3.API.Mesh.Plane; +R3.D3.API.Mesh.Plane.prototype = Object.create(R3.D3.API.Mesh.prototype); +R3.D3.API.Mesh.Plane.prototype.constructor = R3.D3.API.Mesh.Plane; diff --git a/bak/game-lib-d3-api-mesh-sphere.js b/bak/r3-d3-api-mesh-sphere.js similarity index 63% rename from bak/game-lib-d3-api-mesh-sphere.js rename to bak/r3-d3-api-mesh-sphere.js index 3f5093c..2becca0 100644 --- a/bak/game-lib-d3-api-mesh-sphere.js +++ b/bak/r3-d3-api-mesh-sphere.js @@ -1,44 +1,44 @@ /** - * GameLib.D3.API.Mesh.Sphere + * R3.D3.API.Mesh.Sphere * @constructor * @param apiMesh * @param radius * @param widthSegments * @param heightSegments */ -GameLib.D3.API.Mesh.Sphere = function( +R3.D3.API.Mesh.Sphere = function( apiMesh, radius, widthSegments, heightSegments ) { - if (GameLib.Utils.UndefinedOrNull(apiMesh)) { + if (R3.Utils.UndefinedOrNull(apiMesh)) { apiMesh = { - meshType : GameLib.D3.API.Mesh.MESH_TYPE_SPHERE + meshType : R3.D3.API.Mesh.MESH_TYPE_SPHERE }; } - if (GameLib.Utils.UndefinedOrNull(apiMesh.meshType)) { - apiMesh.meshType = GameLib.D3.API.Mesh.MESH_TYPE_SPHERE; + if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) { + apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_SPHERE; } - if (GameLib.Utils.UndefinedOrNull(radius)) { + if (R3.Utils.UndefinedOrNull(radius)) { radius = 1; } this.radius = radius; - if (GameLib.Utils.UndefinedOrNull(widthSegments)) { + if (R3.Utils.UndefinedOrNull(widthSegments)) { widthSegments = 5; } this.widthSegments = widthSegments; - if (GameLib.Utils.UndefinedOrNull(heightSegments)) { + if (R3.Utils.UndefinedOrNull(heightSegments)) { heightSegments = 5; } this.heightSegments = heightSegments; - GameLib.D3.API.Mesh.call( + R3.D3.API.Mesh.call( this, apiMesh.id, apiMesh.name, @@ -68,5 +68,5 @@ GameLib.D3.API.Mesh.Sphere = function( ); }; -GameLib.D3.API.Mesh.Sphere.prototype = Object.create(GameLib.D3.API.Mesh.prototype); -GameLib.D3.API.Mesh.Sphere.prototype.constructor = GameLib.D3.API.Mesh.Sphere; +R3.D3.API.Mesh.Sphere.prototype = Object.create(R3.D3.API.Mesh.prototype); +R3.D3.API.Mesh.Sphere.prototype.constructor = R3.D3.API.Mesh.Sphere; diff --git a/bak/game-lib-d3-api-mesh-text.js b/bak/r3-d3-api-mesh-text.js similarity index 62% rename from bak/game-lib-d3-api-mesh-text.js rename to bak/r3-d3-api-mesh-text.js index 6961fec..f74b29c 100644 --- a/bak/game-lib-d3-api-mesh-text.js +++ b/bak/r3-d3-api-mesh-text.js @@ -1,5 +1,5 @@ /** - * GameLib.D3.API.Mesh.Text + * R3.D3.API.Mesh.Text * @constructor * @param apiMesh * @param text @@ -12,7 +12,7 @@ * @param bevelSize * @param bevelSegments */ -GameLib.D3.API.Mesh.Text = function( +R3.D3.API.Mesh.Text = function( apiMesh, text, font, @@ -25,62 +25,62 @@ GameLib.D3.API.Mesh.Text = function( bevelSegments ) { - if (GameLib.Utils.UndefinedOrNull(apiMesh)) { + if (R3.Utils.UndefinedOrNull(apiMesh)) { apiMesh = { - meshType : GameLib.D3.API.Mesh.MESH_TYPE_TEXT + meshType : R3.D3.API.Mesh.MESH_TYPE_TEXT }; } - if (GameLib.Utils.UndefinedOrNull(apiMesh.meshType)) { - apiMesh.meshType = GameLib.D3.API.Mesh.MESH_TYPE_TEXT; + if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) { + apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_TEXT; } - if (GameLib.Utils.UndefinedOrNull(text)) { + if (R3.Utils.UndefinedOrNull(text)) { text = '-=