var Flake = function(){
    PartBase.call(this);
    this.setEdgeDetection();
    this.setBloom(2);

    this.texture1 = TDEMO.TEXTURES.getTextures().flake;
    //this.texture1 = TDEMO.TEXTURES.getTextures().flake2; //mopoversio,vaihda aiempaan lopullisessa versiossa 
    var material = new THREE.MeshBasicMaterial({map: this.texture1, side: THREE.BackSide});
    var geometry = new THREE.SphereGeometry(400, 32, 32);
    this.sphere1 = new THREE.Mesh(geometry, material);
    
    this.texture2 = TDEMO.TEXTURES.getTextures().flake;
    var material2 = new THREE.MeshBasicMaterial({map: this.texture2, side: THREE.BackSide});
    var geometry2 = new THREE.SphereGeometry(200, 32, 32);
    this.sphere2 = new THREE.Mesh(geometry, material);
    
    this.bgtexture = TDEMO.TEXTURES.getTextures().flake_repeat;
    var bgmaterial = new THREE.MeshBasicMaterial({map: this.bgtexture, side: THREE.BackSide});
    var bggeom = new THREE.SphereGeometry(1200, 32, 32);
    this.bg = new THREE.Mesh(bggeom, bgmaterial);
    
    this.scene.add(this.sphere1);
    this.scene.add(this.bg);
};


Flake.prototype = PartBase.prototype.inheritance();

Flake.prototype.animate = function(elapsedTime, delta){
    PartBase.prototype.animate.call(this, elapsedTime, delta, true);
    var hb = TDEMO.SYNC.getHeartBeat();
    this.texture1.offset.x = hb;
    this.texture1.needsUpdate = true;
    console.log("asdasdasd");
    //this.sphere1.rotation.x += 0.2;
    //this.sphere1.rotation.y += 0.3;
};
