/* * Copyright 2012, kaj dijkstra , * Author, Kaj Dijkstra. * All rights reserved. * */ import transform from './transform.js'; import {matrix4} from './math.js'; /** * Entity object **/ class entity{ constructor( ) { this._className = 'entity'; this.subEntitys = []; this.name; this.mesh; this.drawType = gl.TRIANGLES; this.transform = new transform(); this.transform.entity = this; this.bone = false; this.children = []; this.parent = false; this.objectTransform; this.attenuation = 1.0; this.sourceRadius = 0.4; this.sourceLength = 0.2; this.attenuation = 1.; this.sourceRadius = 0.0; this.sourceLength = 0.0; this.id = kepler.entityID++; this.type = "Actor"; } /** * Translate entity to coordinate * @param {(float x, float y, float z)} Position **/ translateTo( x, y, z ) { this.transform.world = matrix4.translate(matrix4.identity(), kepler.vector3(x,y,z) ); } addChild( entity ) { entity.parent = this; this.children.push(entity); } getChildren() { return this.children; } getChildByName( name ) { for(var c=0;c