Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/threejs/13_fighting/js/functions.js

(Deskargatu)
function draw_line(params)
{
    // Visualize path
    var geometry = new THREE.BufferGeometry();
    var positions = new Float32Array( 2 * 3 ); // 3 vertices per point
    geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
    drawCount = 2; // draw the first 2 points, only
    geometry.setDrawRange( 0, drawCount );
    var material = new THREE.MeshBasicMaterial( { color: params.color, transparent: true , opacity: params.opacity   });
    line = new THREE.Line( geometry,  material );

    params.container.add(line);
    var positions = line.geometry.attributes.position.array;
    positions[0]=params.origin.x;
    positions[1]=params.force_y || params.origin.y;
    positions[2]=params.origin.z;
    positions[3]=params.destination.x;
    positions[4]=params.force_y || params.destination.y;
    positions[5]=params.destination.z;

    return line;
}