2017-05-16 23:07:52 +00:00
|
|
|
var Mesh = require('./Mesh');
|
|
|
|
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
|
|
|
var GetValue = require('../../utils/object/GetValue');
|
|
|
|
var BuildGameObject = require('../BuildGameObject');
|
|
|
|
|
|
|
|
var BuildFromConfig = function (state, config)
|
|
|
|
{
|
|
|
|
var key = GetAdvancedValue(config, 'key', null);
|
|
|
|
var frame = GetAdvancedValue(config, 'frame', null);
|
|
|
|
var vertices = GetValue(config, 'vertices', []);
|
2017-05-18 19:57:05 +00:00
|
|
|
var indices = GetValue(config, 'indices', []);
|
2017-05-16 23:07:52 +00:00
|
|
|
var uv = GetValue(config, 'uv', []);
|
|
|
|
|
2017-05-18 19:57:05 +00:00
|
|
|
var mesh = new Mesh(state, 0, 0, vertices, uv, indices, key, frame);
|
2017-05-16 23:07:52 +00:00
|
|
|
|
|
|
|
BuildGameObject(state, mesh, config);
|
|
|
|
|
|
|
|
return mesh;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = BuildFromConfig;
|