jhylands

Untitled

Oct 26th, 2022
1,847
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function add_face_x(mesh, x, face){
  2.   const ndx = mesh.vertices.length / 3;
  3.   var [start_greedy, width, start_increment, height] = face;
  4.   mesh.vertices.push(
  5.     x, start_greedy, start_increment,
  6.     x, start_greedy + width + 1, start_increment,
  7.     x, start_greedy , start_increment + height + 1,
  8.     x, start_greedy + width + 1, start_increment + height + 1);
  9.   mesh.normals.push(-1,0,0);
  10.   mesh.uvs.push(x*16*16+start_greedy,start_increment);
  11.   mesh.uvs.push(x*16*16+start_greedy+width+1, start_increment);
  12.   mesh.uvs.push(x*16*16+start_greedy,start_increment + height+1);
  13.   mesh.uvs.push(x*16*16+start_greedy+width+1,start_increment + height+1);
  14.   mesh.indices.push(
  15.     ndx, ndx + 1, ndx + 2,
  16.     ndx + 2, ndx + 1, ndx + 3,
  17.   );
  18. }
Advertisement
Add Comment
Please, Sign In to add comment