r3-legacy/src/game-lib-d3-api-scene.js

112 lines
2.6 KiB
JavaScript
Raw Normal View History

2016-11-29 12:54:25 +01:00
/**
* Raw Scene API object - should always correspond with the Scene Schema
* @param id String
* @param path String
* @param name String
* @param meshes GameLib.D3.API.Mesh []
2016-12-15 14:53:39 +01:00
* @param position GameLib.API.Vector3
2016-12-15 15:28:00 +01:00
* @param quaternion GameLib.API.Quaternion
2016-12-15 14:53:39 +01:00
* @param scale GameLib.API.Vector3
2016-11-29 12:54:25 +01:00
* @param parentSceneId
* @param lights GameLib.D3.API.Light[]
* @param worlds GameLib.D3.API.World[]
2016-12-15 15:28:00 +01:00
* @param entityManager GameLib.EntityManager
2016-11-29 12:54:25 +01:00
* @param shapes GameLib.D3.API.Shape[]
* @param cameras
* @param activeCameraIndex
2016-12-02 16:03:03 +01:00
* @param splines GameLib.D3.API.Spline[]
2016-11-29 12:54:25 +01:00
* @constructor
*/
GameLib.D3.API.Scene = function(
id,
path,
name,
meshes,
position,
2016-12-15 15:28:00 +01:00
quaternion,
2016-11-29 12:54:25 +01:00
scale,
parentSceneId,
lights,
worlds,
2016-12-15 15:28:00 +01:00
entityManager,
2016-11-29 12:54:25 +01:00
shapes,
cameras,
activeCameraIndex,
splines
) {
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
2016-11-29 12:54:25 +01:00
}
this.id = id;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(path)) {
2016-11-29 12:54:25 +01:00
path = null;
}
this.path = path;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(name)) {
2016-11-29 12:54:25 +01:00
name = 'unnamed';
}
this.name = name;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(meshes)) {
2016-11-29 12:54:25 +01:00
meshes = [];
}
this.meshes = meshes;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(position)) {
position = new GameLib.API.Vector3();
2016-11-29 12:54:25 +01:00
}
this.position = position;
2016-12-15 15:28:00 +01:00
if (GameLib.Utils.UndefinedOrNull(quaternion)) {
quaternion = new GameLib.API.Quaternion();
}
this.quaternion = quaternion;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(scale)) {
scale = new GameLib.API.Vector3(1,1,1);
2016-11-29 12:54:25 +01:00
}
this.scale = scale;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(parentSceneId)) {
2016-11-29 12:54:25 +01:00
parentSceneId = null;
}
this.parentSceneId = parentSceneId;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(lights)) {
2016-11-29 12:54:25 +01:00
lights = [];
}
this.lights = lights;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(worlds)) {
2016-11-29 12:54:25 +01:00
worlds = [];
}
this.worlds = worlds;
2016-12-15 15:28:00 +01:00
if (GameLib.Utils.UndefinedOrNull(entityManager)) {
entityManager = new GameLib.API.EntityManager();
2016-11-29 12:54:25 +01:00
}
2016-12-15 15:28:00 +01:00
this.entityManager = entityManager;
2016-11-29 12:54:25 +01:00
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(shapes)) {
2016-11-29 12:54:25 +01:00
shapes = [];
}
this.shapes = shapes;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(cameras)) {
2016-11-29 12:54:25 +01:00
cameras = [];
}
this.cameras = cameras;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(activeCameraIndex)) {
2016-11-29 12:54:25 +01:00
activeCameraIndex = 0;
}
this.activeCameraIndex = activeCameraIndex;
2016-12-15 14:53:39 +01:00
if (GameLib.Utils.UndefinedOrNull(splines)) {
2016-11-29 12:54:25 +01:00
splines = [];
}
this.splines = splines;
};