Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NodePath cube = window->load_model(render, "box");
- cube.node()->set_bounds(new OmniBoundingVolume()); //TODO: Correct this bounds
- cube.node()->set_final(true);
- int k_ = 16;
- int k = (256);
- PTA_LVecBase4f offsets = PTA_LVecBase4f::empty_array(k);
- int count = 0;
- for(int i = 0; i < k_; i++){
- for(int j = 0; j < k_; j++){
- offsets[count] = LVecBase4f(i * 2, j * -2, 0, 0);
- count++;
- }
- }
- cube.set_shader(ShaderPool::load_shader("instance.cg"));
- cube.set_shader_input("offsets", offsets);
- cube.set_instance_count(k);
- /* Duplicate Moah! */
- for(int i = 0; i < 10; i++){
- for(int j = 0; j < 10; j++){
- NodePath test = render.attach_new_node("teste");
- cube.instance_to(test);
- test.set_pos(50*i, 50*j, 0);
- }
- }
- framework.main_loop();
Add Comment
Please, Sign In to add comment