import * as THREE from 'three'
import { UNIT, CHUNK_SIZE } from "@/lib/constants";

export function getChunkCoordinates3D(x: number, y: number, z: number) {  
  return {
    chunkX: (x>0?1:-1) * (Math.floor((Math.abs(x) - 0.5 * UNIT) / UNIT)+1),
    chunkY: (y>0?1:-1) * (Math.floor((Math.abs(y) - 0.5 * UNIT) / UNIT)+1),
    chunkZ: (z>0?1:-1) * (Math.floor((Math.abs(z) - 0.5 * UNIT) / UNIT)+1),
  };
}


export function offset(index:number) {
  const _size = 0.5 * UNIT/CHUNK_SIZE
  return new THREE.Vector3 (((index % 7)-3.5)*_size, ((index % 3)-1.5)*_size, ((index % 11)-5.5)*_size)
  return new THREE.Vector3 (0, 0, 0)
}