Guest User

Untitled

a guest
Oct 11th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1.     NodePath cube = window->load_model(render, "box");
  2.     cube.node()->set_bounds(new OmniBoundingVolume()); //TODO: Correct this bounds
  3.     cube.node()->set_final(true);
  4.  
  5.     int k_ = 16;
  6.     int k = (256);
  7.     PTA_LVecBase4f offsets = PTA_LVecBase4f::empty_array(k);
  8.  
  9.     int count = 0;
  10.     for(int i = 0; i < k_; i++){
  11.         for(int j = 0; j < k_; j++){
  12.             offsets[count] = LVecBase4f(i * 2, j * -2, 0, 0);
  13.             count++;
  14.         }
  15.     }
  16.  
  17.     cube.set_shader(ShaderPool::load_shader("instance.cg"));
  18.     cube.set_shader_input("offsets", offsets);
  19.     cube.set_instance_count(k);
  20.  
  21.     /* Duplicate Moah! */
  22.     for(int i = 0; i < 10; i++){
  23.         for(int j = 0; j < 10; j++){
  24.             NodePath test = render.attach_new_node("teste");
  25.             cube.instance_to(test);
  26.             test.set_pos(50*i, 50*j, 0);
  27.         }
  28.     }
  29.  
  30.  
  31.     framework.main_loop();
Add Comment
Please, Sign In to add comment