coil textures

with orbitControls, XZgrid, info

HTML

<div id="info">coil textures
</div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r70/three.min.js"></script>
<script src="https://dl.dropboxusercontent.com/u/3587259/Code/Threejs/OrbitControls.js">    
</script>

CSS

#info {
    position: absolute;
    top: 0px;
    width: 100%;
    padding: 10px;
    text-align: center;
    color: #ffff00
}
body {
    overflow: hidden;
}

JavaScript

var camera, scene, renderer, geometry, material, mesh, light, controls;
var headPos = new THREE.Vector3 (0,300,400);

init();
animate();

function init() {
    scene = new THREE.Scene();

    camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000);
    camera.position.z = 500;
    scene.add(camera);
    
    THREE.ImageUtils.crossOrigin = '';
    var coilTex = THREE.ImageUtils.loadTexture('http://i.imgur.com/SioC0Bw.png');
    var coilBumpTex = THREE.ImageUtils.loadTexture('http://i.imgur.com/CTc2vA9.png');
    geometry = new THREE.CylinderGeometry(20,20,80,20,1,true);
    material = new THREE.MeshPhongMaterial({
        color:0xffffff,
        specular:0xff0000,
        map: coilTex,
        //transparent:true,
        bumpMap: coilBumpTex,
        bumpScale: 0.8,
        side: THREE.DoubleSide
    });

    mesh = new THREE.Mesh(geometry, material);
    scene.add(mesh);

    light = new THREE.PointLight(0xffffff);
    light.position.set(100, 300, 200);
    scene.add(light);

    var gridXZ = new THREE.GridHelper(100, 10);
    gridXZ.setColors(new THREE.Color(0xff0000), new THREE.Color(0xffffff));
    scene.add(gridXZ);

    renderer = new THREE.WebGLRenderer();
    renderer.setSize(window.innerWidth, window.innerHeight);
    renderer.setClearColor(0x888888);

    controls = new THREE.OrbitControls(camera, renderer.domElement);

    document.body.appendChild(renderer.domElement);
}

function animate() {
    controls.update();
    // apply transform of camera to get (light's) world coordinate
    light.position.copy (headPos.clone().applyMatrix4(camera.matrix));

    requestAnimationFrame(animate);
    render();
}

function render() {
    renderer.render(scene, camera);
}