var Class = require('../../utils/Class'); var Components = require('../components'); var GameObject = require('../GameObject'); var MeshRender = require('./MeshRender'); var NOOP = require('../../utils/NOOP'); var Mesh = new Class({ Extends: GameObject, Mixins: [Components.BlendMode, Components.Depth, Components.Mask, Components.Pipeline, Components.Size, Components.Texture, Components.Transform, Components.Visible, Components.ScrollFactor, MeshRender] , initialize: function Mesh(scene, x, y, vertices, uv, colors, alphas, texture, frame){ GameObject.call(this, scene, 'Mesh'); if ((_AN_Read_length('length', vertices)) !== (_AN_Read_length('length', uv))) { throw new Error('Mesh Vertex count must match UV count') } var verticesUB = (_AN_Read_length('length', vertices) / 2) | 0; if ((_AN_Read_length('length', colors)) > 0 && (_AN_Read_length('length', colors)) < verticesUB) { throw new Error('Mesh Color count must match Vertex count') } if ((_AN_Read_length('length', alphas)) > 0 && (_AN_Read_length('length', alphas)) < verticesUB) { throw new Error('Mesh Alpha count must match Vertex count') } var i; if ((_AN_Read_length('length', colors)) === 0) { for (i = 0; i < verticesUB; ++i){ colors[i] = 16777215; } } if ((_AN_Read_length('length', alphas)) === 0) { for (i = 0; i < verticesUB; ++i){ alphas[i] = 1; } } this.vertices = new Float32Array(vertices); this.uv = new Float32Array(uv); this.colors = new Uint32Array(colors); this.alphas = new Float32Array(alphas); this.tintFill = false ; this.setTexture(texture, frame); this.setPosition(x, y); this.setSizeToFrame(); this.initPipeline(); } , setAlpha: NOOP} ); module.exports = Mesh;