         #remove voxel from scene
         scene.remove intersect.object  unless intersect.object is plane
       else
-        #add voxel to scene
+        #draw cube
         normalMatrix.getNormalMatrix intersect.object.matrixWorld
         normal = intersect.face.normal.clone()
         normal.applyMatrix3(normalMatrix).normalize()
         position = new THREE.Vector3().addVectors(intersect.point, normal)
-        geometry = new THREE.CubeGeometry(1,1,1)
-        i = 0
-        while i < geometry.faces.length
-          geometry.faces[i].color.setHex 0x00ff80
-          i++
+        geometry = MYTHREE.getCubeGeometry()
         material = new THREE.MeshLambertMaterial(vertexColors: THREE.FaceColors)
         voxel = new THREE.Mesh(geometry, material)
-        voxel.position.x = Math.floor(position.x / 1) * 1 + 0.5
-        voxel.position.y = Math.floor(position.y / 1) * 1 + 0.5
-        voxel.position.z = Math.floor(position.z / 1) * 1 + 0.5
-
-        voxel.position.x = 0
-        voxel.position.y = 0
-        voxel.position.z = 0
-        console.log 'voxel.position', voxel.position
+        voxel.position.x = Math.floor(position.x) + 0.5
+        voxel.position.y = Math.floor(position.y) + 0.5
+        voxel.position.z = Math.floor(position.z) + 0.5
         voxel.matrixAutoUpdate = false
         voxel.updateMatrix()
         scene.add voxel

  light = new THREE.DirectionalLight( 0xffffff, 3 ); 
  light

MYTHREE.global = {}
MYTHREE.global.voxels = {};









#---組み立て---


  onDocumentMouseMove = ( event ) ->
    event.preventDefault()
    offsetY = $("#header").height()
    #ブラウザの左上からのピクセル位置 = event.clientX,Y
    canvasX = event.clientX
    canvasY = event.clientY - offsetY
    mouse2D.x = ( canvasX / MYTHREE.const.W ) * 2 - 1 #-1~+1
    mouse2D.y = - ( canvasY / MYTHREE.const.H ) * 2 + 1 #-1~+1
    intersects = raycaster.intersectObjects( scene.children )
    #ray hit color
    # if intersects.length > 0
    #   ROLLOVERED = getColoredIntersect(intersects)
    #   ROLLOVERED.color.setHex( 0xff8000 )
  
  #複数の交差点からfaceがセットされているものを返す
  getFacedIntersect = (intersects) ->
