Advertisement
Guest User

p5js obj glitch

a guest
May 28th, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. function preload(){
  4.     obj = loadModel('includes/demos-data/3d/teapot.obj')
  5. }
  6.  
  7. function setup() {
  8.     createCanvas(windowWidth, windowHeight, WEBGL)
  9.     // print(JSON.stringify(obj))
  10. }
  11.  
  12. function draw() {
  13.     clear()
  14.     scale(-4)
  15.    
  16.     // for(let f of obj.faces){
  17.     //  f[1] =1
  18.     // }
  19.    
  20.     for(let v of obj.vertices){
  21.         v.x += random(20)
  22.     }
  23.    
  24.     // ?? how to rebuild after each change??
  25.    
  26.     // obj.buildGeometry(); // doesn't work
  27.     model(obj)
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement