systems to doms

beta.r3js.org
Theunis J. Botha 2017-01-20 13:40:27 +01:00
parent ba1aa215b7
commit c3d51b5549
17 changed files with 926 additions and 439 deletions

View File

@ -28,7 +28,7 @@ GameLib.Component = function(
GameLib.Component.prototype = Object.create(GameLib.API.Component.prototype);
GameLib.Component.prototype.constructor = GameLib.Component;
GameLib.Component.COMPONENT_PATH_FOLLOWING = 0x1;
GameLib.Component.COMPONENT_PATH_FOLLOWING = 0x1;
GameLib.Component.COMPONENT_MATERIAL = 0x2;
GameLib.Component.COMPONENT_RENDERER = 0x3;
GameLib.Component.COMPONENT_LOOK_AT = 0x5;
@ -54,6 +54,7 @@ GameLib.Component.COMPONENT_MOUSE = 0x18;
GameLib.Component.COMPONENT_SKELETON = 0x19;
GameLib.Component.COMPONENT_TEXTURE = 0x1a;
GameLib.Component.COMPONENT_ENTITY_MANAGER = 0x1b;
GameLib.Component.COMPONENT_DOM_ELEMENT = 0x1c;
/**
* Components are linked at runtime - for storing, we just store the ID

View File

@ -0,0 +1,60 @@
/**
* API DomElement
* @param id
* @param name
* @param domElementId
* @param parentEntity
* @constructor
*/
GameLib.API.DomElement = function(
id,
name,
domElementId,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
this.parentEntity = parentEntity;
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_DOM_ELEMENT,
null,
null,
parentEntity
);
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'DOM Element (' + this.id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(domElementId)) {
domElementId = '';
}
this.domElementId = domElementId;
};
GameLib.API.DomElement.prototype = Object.create(GameLib.Component.prototype);
GameLib.API.DomElement.prototype.constructor = GameLib.API.DomElement;
/**
* Returns an API domElement from an Object domElement
* @param objectDomElement
* @constructor
*/
GameLib.API.DomElement.FromObjectDomElement = function (objectDomElement) {
return new GameLib.API.DomElement(
objectDomElement.id,
objectDomElement.name,
objectDomElement.domElementId,
objectDomElement.parentEntity
)
};

View File

@ -26,32 +26,6 @@ GameLib.API.Entity = function(
this.components = components;
};
/**
* Adds a components to the entity
* @param component GameLib.Component
*/
GameLib.API.Entity.prototype.addComponent = function(component) {
this.components.push(component);
};
/**
* Removes a component from this entity
* @param component GameLib.Component
*/
GameLib.API.Entity.prototype.removeComponent = function(component) {
var index = this.components.indexOf(component);
if (index == -1) {
console.log('failed to remove component');
return false;
}
this.components.splice(index, 1);
return true;
};
/**
* Returns an API entity from an Object entity
* @param objectEntity

View File

@ -4,6 +4,8 @@
* @param name String
* @param systemType
* @param entityManager
* @param domElement
* @param domStats
* @param parentEntity
* @constructor
*/
@ -12,13 +14,19 @@ GameLib.API.System = function (
name,
systemType,
entityManager,
domElement,
domStats,
parentEntity
) {
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_SYSTEM,
null,
{
'entityManager' : GameLib.EntityManager,
'domElement' : GameLib.DomElement,
'domStats' : GameLib.DomElement
},
null,
parentEntity
);
@ -42,6 +50,16 @@ GameLib.API.System = function (
entityManager = null;
}
this.entityManager = entityManager;
if (GameLib.Utils.UndefinedOrNull(domElement)){
domElement = null;
}
this.domElement = domElement;
if (GameLib.Utils.UndefinedOrNull(domStats)){
domStats = null;
}
this.domStats = domStats;
};
GameLib.API.System.prototype = Object.create(GameLib.Component.prototype);
@ -58,6 +76,8 @@ GameLib.API.System.FromObjectComponent = function(objectComponent) {
objectComponent.name,
objectComponent.systemType,
objectComponent.entityManager,
objectComponent.domElement,
objectComponent.domStats,
objectComponent.parentEntity
);
};

View File

@ -2,28 +2,53 @@
* Raw Editor API object - should always correspond with the Editor Schema
* @param id
* @param name
* @param game [GameLib.API.D3.Game]
* @param baseUrl
* @param path
* @param games [GameLib.API.D3.Game]
* @param scenes
* @param cameras
* @param composers
* @param viewports
* @param renderers
* @param renderTargets
* @param systems
* @param entityManager
* @param allSelected
* @param selectedObjects
* @param viewports
* @param parentEntity
* @constructor
*/
GameLib.D3.API.Editor = function(
id,
name,
game,
baseUrl,
path,
games,
scenes,
cameras,
composers,
viewports,
renderers,
renderTargets,
systems,
entityManager,
allSelected,
selectedObjects,
viewports,
parentEntity
) {
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_EDITOR,
{
'game' : GameLib.D3.Game,
'viewports' : [GameLib.D3.Viewport]
'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
},
null,
parentEntity
@ -39,11 +64,61 @@ GameLib.D3.API.Editor = function(
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(game)) {
game = null;
if (GameLib.Utils.UndefinedOrNull(baseUrl)) {
baseUrl = '';
}
this.game = game;
this.baseUrl = baseUrl;
if (GameLib.Utils.UndefinedOrNull(path)) {
path = '';
}
this.path = path;
if (GameLib.Utils.UndefinedOrNull(games)) {
games = [];
}
this.games = games;
if (GameLib.Utils.UndefinedOrNull(scenes)) {
scenes = [];
}
this.scenes = scenes;
if (GameLib.Utils.UndefinedOrNull(cameras)) {
cameras = [];
}
this.cameras = cameras;
if (GameLib.Utils.UndefinedOrNull(composers)) {
composers = [];
}
this.composers = composers;
if (GameLib.Utils.UndefinedOrNull(viewports)) {
viewports = [];
}
this.viewports = viewports;
if (GameLib.Utils.UndefinedOrNull(renderers)) {
renderers = [];
}
this.renderers = renderers;
if (GameLib.Utils.UndefinedOrNull(renderTargets)) {
renderTargets = [];
}
this.renderTargets = renderTargets;
if (GameLib.Utils.UndefinedOrNull(systems)) {
systems = [];
}
this.systems = systems;
if (GameLib.Utils.UndefinedOrNull(entityManager)) {
entityManager = new GameLib.API.EntityManager();
}
this.entityManager = entityManager;
if (GameLib.Utils.UndefinedOrNull(allSelected)) {
allSelected = false;
}
@ -54,11 +129,6 @@ GameLib.D3.API.Editor = function(
}
this.selectedObjects = selectedObjects;
if (GameLib.Utils.UndefinedOrNull(viewports)) {
viewports = [];
}
this.viewports = viewports;
};
GameLib.D3.API.Editor.prototype = Object.create(GameLib.Component.prototype);
@ -70,14 +140,102 @@ GameLib.D3.API.Editor.prototype.constructor = GameLib.D3.API.Editor;
* @constructor
*/
GameLib.D3.API.Editor.FromObjectEditor = function(objectEditor) {
var apiGames = [];
var apiScenes = [];
var apiCameras = [];
var apiComposers = [];
var apiViewports = [];
var apiRenderers = [];
var apiRenderTargets = [];
var apiSystems = [];
var apiEntityManager = null;
if (objectEditor.games) {
apiGames = objectEditor.games.map(
function(objectGame){
return GameLib.D3.API.Game.FromObjectGame(objectGame);
}
);
}
if (objectEditor.scenes) {
apiScenes = objectEditor.scenes.map(
function(objectScene){
return GameLib.D3.API.Scene.FromObjectScene(objectScene);
}
);
}
if (objectEditor.cameras) {
apiCameras = objectEditor.cameras.map(
function(objectCamera){
return GameLib.D3.API.Camera.FromObjectCamera(objectCamera);
}
);
}
if (objectEditor.composers) {
apiComposers = objectEditor.composers.map(
function(objectComposer){
return GameLib.D3.API.Composer.FromObjectComponent(objectComposer);
}
);
}
if (objectEditor.viewports) {
apiViewports = objectEditor.viewports.map(
function(objectViewport){
return GameLib.D3.API.Viewport.FromObjectViewport(objectViewport);
}
);
}
if (objectEditor.renderers) {
apiRenderers = objectEditor.renderers.map(
function(objectRenderer){
return GameLib.D3.API.Renderer.FromObjectComponent(objectRenderer);
}
);
}
if (objectEditor.renderTargets) {
apiRenderTargets = objectEditor.renderTargets.map(
function(objectRenderTarget){
return GameLib.D3.API.RenderTarget.FromObjectComponent(objectRenderTarget);
}
);
}
if (objectEditor.systems) {
apiSystems = objectEditor.systems.map(
function(objectSystem){
return GameLib.API.System.FromObjectComponent(objectSystem);
}
);
}
if (objectEditor.entityManager) {
apiEntityManager = GameLib.API.EntityManager.FromObjectEntityManager(objectEditor.entityManager);
}
return new GameLib.D3.API.Editor(
objectEditor.id,
objectEditor.name,
objectEditor.game,
objectEditor.baseUrl,
objectEditor.path,
apiGames,
apiScenes,
apiCameras,
apiComposers,
apiViewports,
apiRenderers,
apiRenderTargets,
apiSystems,
apiEntityManager,
objectEditor.allSelected,
objectEditor.selectedObjects,
objectEditor.viewports,
objectEditor.parentEntity
objectEditor.parentEntity
);
};

View File

@ -7,10 +7,10 @@
* @param height
* @param baseUrl
* @param path
* @param scenes
* @param cameras
* @param renderers
* @param composers
* @param renderTargets
* @param systems
* @param viewports
* @param entityManager
@ -26,12 +26,12 @@ GameLib.D3.API.Game = function(
gameType,
width,
height,
scenes,
cameras,
renderers,
composers,
viewports,
renderers,
renderTargets,
systems,
viewports,
entityManager,
mouse,
parentEntity
@ -40,12 +40,12 @@ GameLib.D3.API.Game = function(
this,
GameLib.Component.COMPONENT_GAME,
{
'scenes' : [GameLib.D3.Scene],
'cameras' : [GameLib.D3.Camera],
'renderers' : [GameLib.D3.Renderer],
'composers' : [GameLib.D3.Composer],
'viewports' : [GameLib.D3.Viewport],
'renderers' : [GameLib.D3.Renderer],
'renderTargets' : [GameLib.D3.RenderTarget],
'systems' : [GameLib.System],
'viewports' : [GameLib.D3.Viewport],
'entityManager' : GameLib.EntityManager,
'mouse' : GameLib.Mouse
},
@ -70,7 +70,7 @@ GameLib.D3.API.Game = function(
this.baseUrl = baseUrl;
if (GameLib.Utils.UndefinedOrNull(path)) {
path = null;
path = '';
}
this.path = path;
@ -89,36 +89,36 @@ GameLib.D3.API.Game = function(
}
this.height = height;
if (GameLib.Utils.UndefinedOrNull(scenes)) {
scenes = [];
}
this.scenes = scenes;
if (GameLib.Utils.UndefinedOrNull(cameras)) {
cameras = [];
}
this.cameras = cameras;
if (GameLib.Utils.UndefinedOrNull(renderers)) {
renderers = [];
}
this.renderers = renderers;
if (GameLib.Utils.UndefinedOrNull(composers)) {
composers = [];
}
this.composers = composers;
if (GameLib.Utils.UndefinedOrNull(viewports)) {
viewports = [];
}
this.viewports = viewports;
if (GameLib.Utils.UndefinedOrNull(renderers)) {
renderers = [];
}
this.renderers = renderers;
if (GameLib.Utils.UndefinedOrNull(renderTargets)) {
renderTargets = [];
}
this.renderTargets = renderTargets;
if (GameLib.Utils.UndefinedOrNull(systems)) {
systems = [];
}
this.systems = systems;
if (GameLib.Utils.UndefinedOrNull(viewports)) {
viewports = [];
}
this.viewports = viewports;
if (GameLib.Utils.UndefinedOrNull(entityManager)) {
entityManager = new GameLib.API.EntityManager();
}
@ -140,24 +140,16 @@ GameLib.D3.API.Game.prototype.constructor = GameLib.D3.API.Game;
*/
GameLib.D3.API.Game.FromObjectGame = function(objectGame) {
var apiScenes = [];
var apiCameras = [];
var apiRenderers = [];
var apiComposers = [];
var apiSystems = [];
var apiViewports = [];
var apiCameras = [];
var apiComposers = [];
var apiViewports = [];
var apiRenderers = [];
var apiRenderTargets = [];
var apiSystems = [];
var apiEntityManager = null;
var apiMouse = null;
if (objectGame.scenes) {
apiScenes = objectGame.scenes.map(
function(objectScene){
return GameLib.D3.API.Scene.FromObjectScene(objectScene);
}
);
}
if (objectGame.cameras) {
apiCameras = objectGame.cameras.map(
function(objectCamera){
@ -166,14 +158,6 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) {
);
}
if (objectGame.renderers) {
apiRenderers = objectGame.renderers.map(
function(objectRenderer){
return GameLib.D3.API.Renderer.FromObjectComponent(objectRenderer);
}
);
}
if (objectGame.composers) {
apiComposers = objectGame.composers.map(
function(objectComposer){
@ -182,6 +166,30 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) {
);
}
if (objectGame.viewports) {
apiViewports = objectGame.viewports.map(
function(objectViewport){
return GameLib.D3.API.Viewport.FromObjectViewport(objectViewport);
}
);
}
if (objectGame.renderers) {
apiRenderers = objectGame.renderers.map(
function(objectRenderer){
return GameLib.D3.API.Renderer.FromObjectComponent(objectRenderer);
}
);
}
if (objectGame.renderTargets) {
apiRenderTargets = objectGame.renderTargets.map(
function(objectRenderTarget){
return GameLib.D3.API.RenderTarget.FromObjectComponent(objectRenderTarget);
}
);
}
if (objectGame.systems) {
apiSystems = objectGame.systems.map(
function(objectSystem){
@ -190,14 +198,6 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) {
);
}
if (objectGame.viewports) {
apiViewports = objectGame.viewports.map(
function(objectViewport){
return GameLib.D3.API.Viewport.FromObjectViewport(objectViewport);
}
);
}
if (objectGame.entityManager) {
apiEntityManager = GameLib.API.EntityManager.FromObjectEntityManager(objectGame.entityManager);
}
@ -214,12 +214,12 @@ GameLib.D3.API.Game.FromObjectGame = function(objectGame) {
objectGame.gameType,
objectGame.width,
objectGame.height,
apiScenes,
apiCameras,
apiRenderers,
apiComposers,
apiViewports,
apiRenderers,
apiRenderTargets,
apiSystems,
apiViewports,
apiEntityManager,
apiMouse,
objectGame.parentEntity

View File

@ -142,6 +142,7 @@ GameLib.D3.API.Material = function(
specularMap,
parentEntity
) {
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_MATERIAL,

View File

@ -27,7 +27,8 @@ GameLib.D3.API.Scene = function(
GameLib.Component.COMPONENT_SCENE,
{
'meshes' : [GameLib.D3.Mesh],
'lights' : [GameLib.D3.Light]
'lights' : [GameLib.D3.Light],
'imageFactory' : GameLib.D3.ImageFactory
},
false,
parentEntity

View File

@ -26,42 +26,156 @@ GameLib.D3.Editor = function(
this,
apiEditor.id,
apiEditor.name,
apiEditor.game,
apiEditor.baseUrl,
apiEditor.path,
apiEditor.games,
apiEditor.scenes,
apiEditor.cameras,
apiEditor.composers,
apiEditor.viewports,
apiEditor.renderers,
apiEditor.renderTargets,
apiEditor.systems,
apiEditor.entityManager,
apiEditor.allSelected,
apiEditor.selectedObjects,
apiEditor.viewports,
apiEditor.selectedObjects,
apiEditor.parentEntity
);
if (this.game) {
if (this.game instanceof GameLib.D3.API.Game) {
this.game = new GameLib.D3.Game(
this.graphics,
this.game
)
}
else {
console.warn('Game not of type API.Game');
throw new Error('Game not of type API.Game');
}
}
this.viewports = this.viewports.map(
function(apiViewport) {
this.imageFactory = new GameLib.D3.ImageFactory(
this.graphics,
this.baseUrl + this.path
);
if (this.games) {
this.games = this.games.map(
function (apiGame) {
if (apiGame instanceof GameLib.D3.API.Game) {
return new GameLib.D3.Game(
this.graphics,
apiGame
)
}
else {
console.warn('game not of type API.Game');
throw new Error('game not of type API.Game');
}
}.bind(this)
)
}
this.scenes = this.scenes.map(
function (apiScene) {
if (apiScene instanceof GameLib.D3.API.Scene) {
return new GameLib.D3.Scene(
this.graphics,
apiScene,
this.imageFactory,
true
)
} else {
console.warn('apiScene not of type API.Scene');
throw new Error('apiScene not of type API.Scene');
}
}.bind(this)
);
this.cameras = this.cameras.map(
function (apiCamera) {
if (apiCamera instanceof GameLib.D3.API.Camera) {
return new GameLib.D3.Camera(
this.graphics,
apiCamera
)
} else {
console.warn('apiCamera not of type API.Camera');
throw new Error('apiCamera not of type API.Camera');
}
}.bind(this)
);
this.composers = this.composers.map(
function (apiComposer) {
if (apiComposer instanceof GameLib.D3.API.Composer) {
return new GameLib.D3.Composer(
this.graphics,
apiComposer
)
} else {
console.warn('apiComposer not of type API.Composer');
throw new Error('apiComposer not of type API.Composer');
}
}.bind(this)
);
this.viewports = this.viewports.map(
function (apiViewport) {
if (apiViewport instanceof GameLib.D3.API.Viewport) {
return GameLib.D3.Viewport(
this.graphics,
apiViewport
)
} else {
console.warn('Viewport not of type API.Viewport');
throw new Error('Viewport not of type API.Viewport');
console.warn('apiViewport not of type API.Viewport');
throw new Error('apiViewport not of type API.Viewport');
}
}.bind(this)
);
this.renderers = this.renderers.map(
function (apiRenderer) {
if (apiRenderer instanceof GameLib.D3.API.Renderer) {
return GameLib.D3.Renderer(
this.graphics,
apiRenderer
)
} else {
console.warn('apiRenderer not of type API.Renderer');
throw new Error('apiRenderer not of type API.Renderer');
}
}.bind(this)
);
this.renderTargets = this.renderTargets.map(
function (apiRenderTarget) {
if (apiRenderTarget instanceof GameLib.D3.API.RenderTarget) {
return GameLib.D3.RenderTarget(
this.graphics,
apiRenderTarget
)
} else {
console.warn('apiRenderTarget not of type API.RenderTarget');
throw new Error('apiRenderTarget not of type API.RenderTarget');
}
}.bind(this)
);
this.systems = this.systems.map(
function (apiSystem) {
if (apiSystem instanceof GameLib.D3.API.System) {
return GameLib.D3.System(
this.graphics,
apiSystem
)
} else {
console.warn('apiSystem not of type API.System');
throw new Error('apiSystem not of type API.System');
}
}.bind(this)
);
if (this.entityManager) {
if (this.entityManager instanceof GameLib.API.EntityManager) {
this.entityManager = new GameLib.EntityManager(
this.graphics,
this.entityManager
);
} else {
console.warn('entityManager not of type API.EntityManager');
throw new Error('entityManager not of type API.EntityManager');
}
}
if (GameLib.Utils.UndefinedOrNull(onSelectionChanged)) {
onSelectionChanged = null;
}
@ -113,37 +227,145 @@ GameLib.D3.Editor.prototype.updateInstance = function() {
*/
GameLib.D3.Editor.prototype.toApiEditor = function() {
var apiGame = null;
if (this.game) {
if (this.game instanceof GameLib.D3.Game) {
apiGame = this.game.toApiGame();
} else {
console.warn('Game not an instance of Game');
throw new Error('Game not an instance of Game');
var apiGames = [];
var apiScenes = [];
var apiCameras = [];
var apiComposers = [];
var apiViewports = [];
var apiRenderers = [];
var apiRenderTargets = [];
var apiSystems = [];
var apiEntityManager = null;
if (this.games) {
apiGames = this.games.map(
function(game) {
if (game instanceof GameLib.D3.Game) {
return game.toApiGame();
} else {
console.warn('game not an instance of Game');
throw new Error('game not an instance of Game');
}
}
);
}
if (this.scenes) {
apiScenes = this.scenes.map(
function(scene) {
if (scene instanceof GameLib.D3.Scene) {
return scene.toApiScene();
} else {
console.warn('scene not an instance of Scene');
throw new Error('scene not an instance of Scene');
}
}
);
}
if (this.cameras) {
apiCameras = this.cameras.map(
function(camera) {
if (camera instanceof GameLib.D3.Camera) {
return camera.toApiCamera();
} else {
console.warn('camera not an instance of Camera');
throw new Error('camera not an instance of Camera');
}
}
);
}
if (this.composers) {
apiComposers = this.composers.map(
function(composer) {
if (composer instanceof GameLib.D3.Composer) {
return composer.toApiComponent();
} else {
console.warn('composer not an instance of Composer');
throw new Error('composer not an instance of Composer');
}
}
);
}
if (this.viewports) {
apiViewports = this.viewports.map(
function(viewport) {
if (viewport instanceof GameLib.D3.Viewport) {
return viewport.toApiComponent();
} else {
console.warn('viewport not an instance of Viewport');
throw new Error('viewport not an instance of Viewport');
}
}
);
}
if (this.renderers) {
apiRenderers = this.renderers.map(
function(renderer) {
if (renderer instanceof GameLib.D3.Renderer) {
return renderer.toApiComponent();
} else {
console.warn('renderer not an instance of Renderer');
throw new Error('renderer not an instance of Renderer');
}
}
);
}
if (this.renderTargets) {
apiRenderTargets = this.renderTargets.map(
function(renderTarget) {
if (renderTarget instanceof GameLib.D3.RenderTarget) {
return renderTarget.toApiComponent();
} else {
console.warn('renderTarget not an instance of RenderTarget');
throw new Error('renderTarget not an instance of RenderTarget');
}
}
);
}
if (this.systems) {
apiSystems = this.systems.map(
function(system) {
if (system instanceof GameLib.System) {
return system.toApiComponent();
} else {
console.warn('system not an instance of System');
throw new Error('system not an instance of System');
}
}
);
}
if (this.entityManager) {
if (this.entityManager instanceof GameLib.EntityManager) {
apiEntityManager = this.entityManager.toApiEntityManager();
} else {
console.warn('entityManager not an instance of EntityManager');
throw new Error('entityManager not an instance of EntityManager');
}
}
var apiViewports = [];
if (this.viewports) {
apiViewports = this.viewports.map(
function(viewport) {
if (viewport instanceof GameLib.D3.Viewport) {
return viewport.toApiComponent();
} else {
console.warn('Viewport not an instance of Viewport');
throw new Error('Viewport not an instance of Viewport');
}
}
);
}
}
return new GameLib.D3.API.Editor(
this.id,
this.name,
apiGame,
this.baseUrl,
this.path,
apiGames,
apiScenes,
apiCameras,
apiComposers,
apiViewports,
apiRenderers,
apiRenderTargets,
apiSystems,
apiEntityManager,
this.allSelected,
this.selectedObjects,
apiViewports,
GameLib.Utils.IdOrNull(this.parentEntity)
);

View File

@ -2,7 +2,7 @@
* Game Runtime
* @param graphics GameLib.D3.Graphics
* @param apiGame GameLib.D3.API.Game
* @param imageFactory
* @param imageFactory GameLib.D3.ImageFactory
* @constructor
*/
GameLib.D3.Game = function (
@ -22,136 +22,124 @@ GameLib.D3.Game = function (
this,
apiGame.id,
apiGame.name,
apiGame.baseUrl,
apiGame.path,
apiGame.baseUrl,
apiGame.path,
apiGame.gameType,
apiGame.width,
apiGame.height,
apiGame.scenes,
apiGame.cameras,
apiGame.renderers,
apiGame.composers,
apiGame.systems,
apiGame.viewports,
apiGame.renderers,
apiGame.renderTargets,
apiGame.systems,
apiGame.entityManager,
apiGame.mouse,
apiGame.parentEntity
apiGame.parentEntity
);
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
imageFactory = GameLib.D3.ImageFactory(
this.graphics,
this.baseUrl
this.baseUrl + this.path
);
}
this.imageFactory = imageFactory;
this.scenes = this.scenes.map(
function(apiScene) {
if (apiScene instanceof GameLib.D3.API.Scene) {
return new GameLib.D3.Scene(
this.graphics,
apiScene,
this.imageFactory,
true
)
} else {
console.warn('Scene not of type API.Scene');
throw new Error('Scene not of type API.Scene');
}
this.cameras = this.cameras.map(
function (apiCamera) {
if (apiCamera instanceof GameLib.D3.API.Camera) {
return new GameLib.D3.Camera(
this.graphics,
apiCamera
)
} else {
console.warn('apiCamera not of type API.Camera');
throw new Error('apiCamera not of type API.Camera');
}
}.bind(this)
);
this.cameras = this.cameras.map(
function(apiCamera) {
this.composers = this.composers.map(
function (apiComposer) {
if (apiComposer instanceof GameLib.D3.API.Composer) {
return new GameLib.D3.Composer(
this.graphics,
apiComposer
)
} else {
console.warn('apiComposer not of type API.Composer');
throw new Error('apiComposer not of type API.Composer');
}
}.bind(this)
);
if (apiCamera instanceof GameLib.D3.API.Camera) {
return new GameLib.D3.Camera(
this.graphics,
apiCamera
)
} else {
console.warn('Camera not of type API.Camera');
throw new Error('Camera not of type API.Camera');
}
this.viewports = this.viewports.map(
function (apiViewport) {
if (apiViewport instanceof GameLib.D3.API.Viewport) {
return GameLib.D3.Viewport(
this.graphics,
apiViewport
)
} else {
console.warn('apiViewport not of type API.Viewport');
throw new Error('apiViewport not of type API.Viewport');
}
}.bind(this)
);
}.bind(this)
);
this.renderers = this.renderers.map(
function (apiRenderer) {
if (apiRenderer instanceof GameLib.D3.API.Renderer) {
return GameLib.D3.Renderer(
this.graphics,
apiRenderer
)
} else {
console.warn('apiRenderer not of type API.Renderer');
throw new Error('apiRenderer not of type API.Renderer');
}
}.bind(this)
);
this.renderers = this.renderers.map(
function(apiRenderer) {
this.renderTargets = this.renderTargets.map(
function (apiRenderTarget) {
if (apiRenderTarget instanceof GameLib.D3.API.RenderTarget) {
return GameLib.D3.RenderTarget(
this.graphics,
apiRenderTarget
)
} else {
console.warn('apiRenderTarget not of type API.RenderTarget');
throw new Error('apiRenderTarget not of type API.RenderTarget');
}
}.bind(this)
);
if (apiRenderer instanceof GameLib.D3.API.Renderer) {
return new GameLib.D3.Renderer(
this.graphics,
apiRenderer
)
} else {
console.warn('Renderer not of type API.Renderer');
throw new Error('Renderer not of type API.Renderer');
}
this.systems = this.systems.map(
function (apiSystem) {
if (apiSystem instanceof GameLib.D3.API.System) {
return GameLib.D3.System(
this.graphics,
apiSystem
)
} else {
console.warn('apiSystem not of type API.System');
throw new Error('apiSystem not of type API.System');
}
}.bind(this)
);
}.bind(this)
);
this.composers = this.composers.map(
function(apiComposer) {
if (apiComposer instanceof GameLib.D3.API.Composer) {
return new GameLib.D3.Composer(
this.graphics,
apiComposer
)
} else {
console.warn('Composer not of type API.Composer');
throw new Error('Composer not of type API.Composer');
}
}.bind(this)
);
this.systems = this.systems.map(
function(apiSystem) {
if (apiSystem instanceof GameLib.D3.API.System) {
return new GameLib.D3.System(
this.graphics,
apiSystem
)
} else {
console.warn('System not of type API.System');
throw new Error('System not of type API.System');
}
}.bind(this)
);
this.viewports = this.viewports.map(
function(apiViewport) {
if (apiViewport instanceof GameLib.D3.API.Viewport) {
return new GameLib.D3.Viewport(
this.graphics,
apiViewport
)
} else {
console.warn('Viewport not of type API.Viewport');
throw new Error('Viewport not of type API.Viewport');
}
}.bind(this)
);
if (this.entityManager instanceof GameLib.API.EntityManager) {
this.entityManager = new GameLib.EntityManager(
this.graphics,
this.entityManager
);
} else {
console.warn('EntityManager not of type API.EntityManager');
throw new Error('EntityManager not of type API.EntityManager');
if (this.entityManager) {
if (this.entityManager instanceof GameLib.API.EntityManager) {
this.entityManager = new GameLib.EntityManager(
this.graphics,
this.entityManager
);
} else {
console.warn('entityManager not of type API.EntityManager');
throw new Error('entityManager not of type API.EntityManager');
}
}
if (this.mouse instanceof GameLib.API.Mouse) {
@ -226,101 +214,102 @@ GameLib.D3.Game.prototype.updateInstance = function() {
*/
GameLib.D3.Game.prototype.toApiGame = function() {
var apiScenes = [];
if (this.scenes) {
apiScenes = this.scenes.map(
function(scene) {
if (scene instanceof GameLib.D3.Scene) {
return scene.toApiScene();
} else {
console.warn('Scene not an instance of Scene');
throw new Error('Scene not an instance of Scene');
}
}
);
}
var apiCameras = [];
var apiComposers = [];
var apiViewports = [];
var apiRenderers = [];
var apiRenderTargets = [];
var apiSystems = [];
var apiEntityManager = null;
var apiMouse = null;
var apiCameras = [];
if (this.cameras) {
apiCameras = this.cameras.map(
function(camera) {
if (camera instanceof GameLib.D3.Camera) {
return camera.toApiCamera();
} else {
console.warn('Camera not an instance of Camera');
throw new Error('Camera not an instance of Camera');
}
}
);
}
if (this.cameras) {
apiCameras = this.cameras.map(
function(camera) {
if (camera instanceof GameLib.D3.Camera) {
return camera.toApiCamera();
} else {
console.warn('camera not an instance of Camera');
throw new Error('camera not an instance of Camera');
}
}
);
}
var apiRenderers = [];
if (this.renderers) {
apiRenderers = this.renderers.map(
function(renderer) {
if (renderer instanceof GameLib.D3.Renderer) {
return renderer.toApiRenderer();
} else {
console.warn('Renderer not an instance of Renderer');
throw new Error('Renderer not an instance of Renderer');
}
}
);
}
if (this.composers) {
apiComposers = this.composers.map(
function(composer) {
if (composer instanceof GameLib.D3.Composer) {
return composer.toApiComponent();
} else {
console.warn('composer not an instance of Composer');
throw new Error('composer not an instance of Composer');
}
}
);
}
var apiComposers = [];
if (this.composers) {
apiComposers = this.composers.map(
function(composer) {
if (composer instanceof GameLib.D3.Composer) {
return composer.toApiComposer();
} else {
console.warn('Composer not an instance of Composer');
throw new Error('Composer not an instance of Composer');
}
}
);
}
if (this.viewports) {
apiViewports = this.viewports.map(
function(viewport) {
if (viewport instanceof GameLib.D3.Viewport) {
return viewport.toApiComponent();
} else {
console.warn('viewport not an instance of Viewport');
throw new Error('viewport not an instance of Viewport');
}
}
);
}
var apiSystems = [];
if (this.systems) {
apiSystems = this.systems.map(
function(system) {
if (system instanceof GameLib.System) {
return system.toApiSystem();
} else {
console.warn('System not an instance of System');
throw new Error('System not an instance of System');
}
}
);
}
if (this.renderers) {
apiRenderers = this.renderers.map(
function(renderer) {
if (renderer instanceof GameLib.D3.Renderer) {
return renderer.toApiComponent();
} else {
console.warn('renderer not an instance of Renderer');
throw new Error('renderer not an instance of Renderer');
}
}
);
}
var apiViewports = [];
if (this.viewports) {
apiViewports = this.viewports.map(
function(viewport) {
if (viewport instanceof GameLib.D3.Viewport) {
return viewport.toApiViewport();
} else {
console.warn('Viewport not an instance of Viewport');
throw new Error('Viewport not an instance of Viewport');
}
}
);
}
if (this.renderTargets) {
apiRenderTargets = this.renderTargets.map(
function(renderTarget) {
if (renderTarget instanceof GameLib.D3.RenderTarget) {
return renderTarget.toApiComponent();
} else {
console.warn('renderTarget not an instance of RenderTarget');
throw new Error('renderTarget not an instance of RenderTarget');
}
}
);
}
var apiEntityManager = null;
if (this.entityManager) {
if (this.entityManager instanceof GameLib.EntityManager) {
apiEntityManager = this.entityManager.toApiEntityManager();
} else {
console.warn('EntityManager not an instance of EntityManager');
throw new Error('EntityManager not an instance of EntityManager');
}
}
if (this.systems) {
apiSystems = this.systems.map(
function(system) {
if (system instanceof GameLib.System) {
return system.toApiComponent();
} else {
console.warn('system not an instance of System');
throw new Error('system not an instance of System');
}
}
);
}
if (this.entityManager) {
if (this.entityManager instanceof GameLib.EntityManager) {
apiEntityManager = this.entityManager.toApiEntityManager();
} else {
console.warn('entityManager not an instance of EntityManager');
throw new Error('entityManager not an instance of EntityManager');
}
}
var apiMouse = null;
if (this.mouse) {
if (this.mouse instanceof GameLib.Mouse) {
apiMouse = this.mouse.toApiMouse();
@ -338,12 +327,12 @@ GameLib.D3.Game.prototype.toApiGame = function() {
this.gameType,
this.width,
this.height,
apiScenes,
apiCameras,
apiRenderers,
apiComposers,
apiSystems,
apiViewports,
apiRenderers,
apiRenderTargets,
apiSystems,
apiEntityManager,
apiMouse,
GameLib.Utils.IdOrNull(this.parentEntity)

View File

@ -221,22 +221,16 @@ GameLib.D3.Input.Editor.prototype.onKeyPress = function(event) {
this.editor.selectedObjects = [];
if (this.editor.allSelected) {
this.editor.games.map(
function(game) {
for (var property in game.idToObject) {
if (game.idToObject.hasOwnProperty(property)) {
this.editor.selectedObjects.push(
new GameLib.D3.SelectedObject(
this.graphics,
game.idToObject(property)
)
)
}
}
}.bind(this)
);
for (var property in this.editor.idToObject) {
if (this.editor.idToObject.hasOwnProperty(property)) {
this.editor.selectedObjects.push(
new GameLib.D3.SelectedObject(
this.graphics,
this.editor.idToObject(property)
)
)
}
}
}
if (this.editor.onSelectionChanged) {
@ -310,18 +304,15 @@ GameLib.D3.Input.Editor.prototype.onMouseDown = function(event) {
event.stopPropagation();
}
var meshCollections = this.editor.game.scenes.map(
function(scene) {
return scene.meshes;
}
);
var meshes = [];
var meshes = meshCollections.reduce(
function(result, meshCollection) {
return result.concat(meshCollection);
},
[]
);
for (var property in this.editor.idToObject) {
if (this.editor.idToObject.hasOwnProperty(property)) {
if (this.editor.idToObject[property] instanceof GameLib.D3.Mesh) {
meshes.push(this.editor.idToObject[property]);
}
}
}
var intersects = this.raycaster.getIntersectedObjects(meshes);

View File

@ -21,9 +21,10 @@ GameLib.D3.Material = function Material(
}
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
console.warn('Cannot create a material without specifying an ImageFactory');
throw new Error('Cannot create a material without specifying an ImageFactory');
console.warn('Cannot create a Material fully without specifying an ImageFactory');
imageFactory = null;
}
this.imageFactory = imageFactory;
GameLib.D3.API.Material.call(
this,
@ -121,7 +122,7 @@ GameLib.D3.Material = function Material(
this.alphaMap = new GameLib.D3.Texture(
this.graphics,
this.alphaMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.alphaMap is not an instance of API.Texture');
@ -134,7 +135,7 @@ GameLib.D3.Material = function Material(
this.aoMap = new GameLib.D3.Texture(
this.graphics,
this.aoMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.aoMap is not an instance of API.Texture');
@ -147,7 +148,7 @@ GameLib.D3.Material = function Material(
this.bumpMap = new GameLib.D3.Texture(
this.graphics,
this.bumpMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.bumpMap is not an instance of API.Texture');
@ -160,7 +161,7 @@ GameLib.D3.Material = function Material(
this.diffuseMap = new GameLib.D3.Texture(
this.graphics,
this.diffuseMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.diffuseMap is not an instance of API.Texture');
@ -173,7 +174,7 @@ GameLib.D3.Material = function Material(
this.displacementMap = new GameLib.D3.Texture(
this.graphics,
this.displacementMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.displacementMap is not an instance of API.Texture');
@ -186,7 +187,7 @@ GameLib.D3.Material = function Material(
this.emissiveMap = new GameLib.D3.Texture(
this.graphics,
this.emissiveMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.emissiveMap is not an instance of API.Texture');
@ -199,7 +200,7 @@ GameLib.D3.Material = function Material(
this.environmentMap = new GameLib.D3.Texture(
this.graphics,
this.environmentMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.environmentMap is not an instance of API.Texture');
@ -212,7 +213,7 @@ GameLib.D3.Material = function Material(
this.lightMap = new GameLib.D3.Texture(
this.graphics,
this.lightMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.lightMap is not an instance of API.Texture');
@ -225,7 +226,7 @@ GameLib.D3.Material = function Material(
this.metalnessMap = new GameLib.D3.Texture(
this.graphics,
this.metalnessMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.metalnessMap is not an instance of API.Texture');
@ -238,7 +239,7 @@ GameLib.D3.Material = function Material(
this.normalMap = new GameLib.D3.Texture(
this.graphics,
this.normalMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.normalMap is not an instance of API.Texture');
@ -251,7 +252,7 @@ GameLib.D3.Material = function Material(
this.roughnessMap = new GameLib.D3.Texture(
this.graphics,
this.roughnessMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.roughnessMap is not an instance of API.Texture');
@ -264,7 +265,7 @@ GameLib.D3.Material = function Material(
this.specularMap = new GameLib.D3.Texture(
this.graphics,
this.specularMap,
imageFactory
this.imageFactory
);
} else {
console.warn('this.specularMap is not an instance of API.Texture');

View File

@ -1,16 +1,16 @@
/**
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
* @param graphics GameLib.D3.Graphics
* @param computeNormals Boolean
* @param apiMesh GameLib.D3.API.Mesh
* @param imageFactory GameLib.D3.ImageFactory
* @param computeNormals Boolean
* @constructor
*/
GameLib.D3.Mesh = function (
graphics,
apiMesh,
computeNormals,
imageFactory
imageFactory,
computeNormals
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
@ -25,9 +25,10 @@ GameLib.D3.Mesh = function (
this.computeNormals = computeNormals;
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
console.warn('Cannot create a Mesh without specifying an ImageFactory');
throw new Error('Cannot create a Mesh without specifying an ImageFactory');
console.warn('Cannot create Meshes fully without specifying an ImageFactory for downloading Textures');
imageFactory = null;
}
this.imageFactory = imageFactory;
GameLib.D3.API.Mesh.call(
this,
@ -62,7 +63,7 @@ GameLib.D3.Mesh = function (
return new GameLib.D3.Material(
this.graphics,
apiMaterial,
imageFactory
this.imageFactory
)
} else {
console.warn('API material not of instance API.Material');
@ -77,7 +78,6 @@ GameLib.D3.Mesh = function (
this.graphics,
this.skeleton
);
}
this.vertices = this.vertices.map(

View File

@ -41,12 +41,11 @@ GameLib.D3.Scene = function (
);
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
console.warn('Cannot create a Scene without specifying an ImageFactory');
throw new Error('Cannot create a Scene without specifying an ImageFactory');
console.warn('Creating a scene without an ImageFactory');
imageFactory = null;
}
this.imageFactory = imageFactory;
this.meshes = this.meshes.map(
function(apiMesh) {
@ -173,16 +172,16 @@ GameLib.D3.Scene.prototype.toApiScene = function() {
* Converts a scene Object to a GameLib.D3.Scene object
* @param graphics GameLib.D3.Graphics
* @param objectScene Object
* @param computeNormals boolean to indicate whether or not to recalculate normals
* @param imageFactory GameLib.D3.ImageFactory
* @param computeNormals boolean to indicate whether or not to recalculate normals
* @returns {GameLib.D3.Scene}
* @constructor
*/
GameLib.D3.Scene.FromObjectScene = function(
graphics,
objectScene,
computeNormals,
imageFactory
imageFactory,
computeNormals
) {
var apiScene = GameLib.D3.API.Scene.FromObjectScene(objectScene);
@ -214,8 +213,8 @@ GameLib.D3.Scene.LoadScene = function(
var scene = GameLib.D3.Scene.FromObjectScene(
graphics,
objectScene,
computeNormals,
imageFactory
imageFactory,
computeNormals
);
onLoaded(scene);

View File

@ -3,14 +3,12 @@
* created
* @param apiTexture
* @param graphics GameLib.D3.Graphics
* @param imageFactory GameLib.D3.ImageFactory result
* @param imageFactory GameLib.D3.ImageFactory
* @constructor
*/
GameLib.D3.Texture = function Texture(
graphics,
apiTexture,
// parentMaterial,
// parentMaterialInstanceMapId,
imageFactory
) {
this.graphics = graphics;
@ -21,9 +19,10 @@ GameLib.D3.Texture = function Texture(
}
if (GameLib.Utils.UndefinedOrNull(imageFactory)) {
console.warn('Cannot create a material without specifying an ImageFactory');
throw new Error('Cannot create a material without specifying an ImageFactory');
console.warn('Cannot create a Texture without specifying an ImageFactory');
imageFactory = null;
}
this.imageFactory = imageFactory;
GameLib.D3.API.Texture.call(
this,
@ -63,15 +62,11 @@ GameLib.D3.Texture = function Texture(
this
);
// this.parentMaterial = parentMaterial;
//
// this.parentMaterialInstanceMapId = parentMaterialInstanceMapId;
this.imageInstance = null;
this.instance = null;
this.loadTexture(imageFactory);
this.loadTexture();
};
GameLib.D3.Texture.prototype = Object.create(GameLib.D3.API.Texture.prototype);
@ -79,18 +74,15 @@ GameLib.D3.Texture.prototype.constructor = GameLib.D3.Texture;
/**
* Loads a texture from the image factory, it could already have downloaded, and then it updates the instance
* @param imageFactory
*/
GameLib.D3.Texture.prototype.loadTexture = function(imageFactory) {
GameLib.D3.Texture.prototype.loadTexture = function() {
this.imageData = imageFactory(this.imagePath);
this.imageData = this.imageFactory(this.imagePath);
this.imageData.then(
function (imageInstance){
this.imageInstance = imageInstance;
this.instance = this.createInstance();
// this.parentMaterial.instance[this.parentMaterialInstanceMapId] = this.instance;
// this.parentMaterial.instance.needsUpdate = true;
}.bind(this),
function onRejected() {
}
@ -221,12 +213,6 @@ GameLib.D3.Texture.prototype.createInstance = function(update) {
instance.premultiplyAlpha = this.premultiplyAlpha;
instance.textureType = this.textureType;
// if (this.parentMaterial &&
// this.parentMaterial.instance &&
// this.parentMaterialInstanceMapId) {
// this.parentMaterial.instance[this.parentMaterialInstanceMapId] = instance;
// }
instance.needsUpdate = true;
return instance;
@ -290,8 +276,6 @@ GameLib.D3.Texture.prototype.toApiTexture = function() {
GameLib.D3.Texture.FromObjectTexture = function(
graphics,
objectTexture,
// gameLibMaterial,
// instanceMapId,
imageFactory
) {
var apiTexture = GameLib.D3.API.Texture.FromObjectTexture(objectTexture);

View File

@ -0,0 +1,71 @@
/**
* Runtime domElement for updating instance objects
* @param graphics GameLib.D3.Graphics
* @param apiDomElement GameLib.API.DomElement
* @constructor
*/
GameLib.DomElement = function (graphics, apiDomElement) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
GameLib.API.DomElement.call(
this,
apiDomElement.id,
apiDomElement.name,
apiDomElement.domElementId,
apiDomElement.parentEntity
);
this.instance = this.createInstance();
};
GameLib.DomElement.prototype = Object.create(GameLib.API.DomElement.prototype);
GameLib.DomElement.prototype.constructor = GameLib.DomElement;
/**
* Creates an instance domElement
* @param update
* @returns {*}
*/
GameLib.DomElement.prototype.createInstance = function(update) {
var instance = document.getElementById(this.domElementId);
return instance;
};
/**
* Updates the instance vector, calls updateInstance on the parent object
*/
GameLib.DomElement.prototype.updateInstance = function() {
this.createInstance(true);
};
/**
* Converts runtime vector to API Vector
* @returns {GameLib.API.DomElement}
*/
GameLib.DomElement.prototype.toApiDomElement = function() {
return new GameLib.API.DomElement(
this.id,
this.name,
this.domElementId,
this.parentEntity
);
};
/**
* Appends domInstance to DOM instance
* @param domInstance
*/
GameLib.DomElement.prototype.append = function(domInstance) {
this.instance.appendChild(domInstance);
};
/**
* Clears DOM instance
*/
GameLib.DomElement.prototype.clear = function() {
this.instance.innerHTML = '';
};

View File

@ -1,34 +1,32 @@
/**
* System takes care of updating all the entities (based on their component data)
* @param graphics
* @param apiSystem GameLib.API.System
* @param domElement
* @param domStats
* @constructor
*/
GameLib.System = function(
apiSystem,
domElement,
domStats
graphics,
apiSystem
) {
GameLib.API.System.call(
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (GameLib.Utils.UndefinedOrNull(apiSystem)) {
apiSystem = {};
}
GameLib.API.System.call(
this,
apiSystem.id,
apiSystem.name,
apiSystem.systemType,
apiSystem.entityManager,
apiSystem.domElement,
apiSystem.domStats,
apiSystem.parentEntity
);
if (GameLib.Utils.UndefinedOrNull(domElement)){
domElement = null;
}
this.domElement = domElement;
if (GameLib.Utils.UndefinedOrNull(domStats)){
domStats = null;
}
this.domStats = domStats;
};
@ -174,3 +172,20 @@ GameLib.System.prototype.stop = function() {
}
};
/**
* Converts runtime vector to API Vector
* @returns {GameLib.API.Mouse}
*/
GameLib.System.prototype.toApiSystem = function() {
//TODO
return new GameLib.API.System(
this.id,
this.name,
this.systemType,
this.domElement.toApiDo,
this.domStats,
GameLib.Utils.IdOrNull(this.parentEntity)
);
};