/** * API Spline * @param id String * @param name String * @param vertices GameLib.API.Vector3[] * @param parentEntity * @constructor */ GameLib.D3.API.Spline = function( id, name, vertices, parentEntity ) { if (GameLib.Utils.UndefinedOrNull(id)) { id = GameLib.Utils.RandomId(); } this.id = id; if (GameLib.Utils.UndefinedOrNull(name)) { name = 'Spline (unknown)'; } this.name = name; if (GameLib.Utils.UndefinedOrNull(vertices)) { vertices = []; } this.vertices = vertices; if (GameLib.Utils.UndefinedOrNull(parentEntity)) { parentEntity = null; } this.parentEntity = parentEntity; }; GameLib.D3.API.Spline.prototype = Object.create(GameLib.Component.prototype); GameLib.D3.API.Spline.prototype.constructor = GameLib.D3.API.Spline; /** * Object to GameLib.D3.API.Spline * @param objectComponent * @constructor */ GameLib.D3.API.Spline.FromObject = function(objectComponent) { return new GameLib.D3.API.Spline( objectComponent.id, objectComponent.name, objectComponent.vertices.map( function (objectVertex) { return GameLib.API.Vector3.FromObject(objectVertex); } ), objectComponent.parentEntity ); };