/*
* netrix_cube.js
*/

function netrix_cube(x,y,z){
	var bloco_texture=new THREE.ImageUtils.loadTexture("images/bloco_512.png");
	bloco_texture.minFilter = THREE.LinearMipMapNearestFilter;
	bloco_texture.magFilter = THREE.LinearFilter;
	var blocoMaterial = new THREE.MeshLambertMaterial({ map:bloco_texture, side:THREE.DoubleSide });
	var cuboGeometria=new THREE.CubeGeometry(2.0, 2.0, 2.0);
	var blocoMaterialPhysic=Physijs.createMaterial(blocoMaterial,.8,.3);
	cubo = new Physijs.BoxMesh(cuboGeometria, blocoMaterialPhysic,0);
	cubo.setCcdMotionThreshold(1);
	cubo.position.set(x, y, z);
	cubo.name="BLOCO_CUBE";
	cubo.addEventListener("collision",function(object,relative_vel,relative_rot,contact_normal){
		console.log(object);
	});
	cubo.addEventListener("ready",function(){
		console.log("Bloco cube ready!");
	});
	/*this.setPosition=function(x,y,z){
		cubo.position.set(x,y,z);
		cubo.position.__dirtyPosition=true;
	};*/
	this.mesh=cubo;
	
}
function netrix_player(){
	var materials = [
       new THREE.MeshLambertMaterial({
           map: THREE.ImageUtils.loadTexture('images/bloco-front.png')
       }),
       new THREE.MeshLambertMaterial({
           map: THREE.ImageUtils.loadTexture('images/money.png')
       }),
       new THREE.MeshLambertMaterial({
           map: THREE.ImageUtils.loadTexture('images/money.png')
       }),
       new THREE.MeshLambertMaterial({
           map: THREE.ImageUtils.loadTexture('images/money.png')
       }),
       new THREE.MeshLambertMaterial({
           map: THREE.ImageUtils.loadTexture('images/money.png')
       }),
       new THREE.MeshLambertMaterial({
           map: THREE.ImageUtils.loadTexture('images/heart.png')
       })
    ];
	//var matPlayer=new THREE.MeshLambertMaterial({map: new THREE.ImageUtils.loadTexture("images/bloco-front.png")});
	var geoPlayer=new THREE.CubeGeometry(0.5,1.0,0.5);
	var xpherePlayer=new Physijs.BoxMesh(geoPlayer,Physijs.createMaterial(new THREE.MeshFaceMaterial(materials),.8,.3),1);
	xpherePlayer.visible=true;
	xpherePlayer.position.set(10.0,0.0,0.0);
	xpherePlayer.setCcdMotionThreshold(1);
	xpherePlayer.addEventListener("collision",function(object){
		console.log("COLLISION!");
		console.log(object);
	});
	xpherePlayer.addEventListener("ready",function(){
		console.log("Object Ready!");
	});
	//xpherePlayer._physijs.id="PLAYER";
	//xpherePlayer.setDamping(1,1);
	this.mesh=xpherePlayer;

}
//netrix_cube.prototype=new bloco_cube();