Hello, i found how to render 1000 unit in documentation
panda3d.org/manual/index.php/Instancing
I have good performance with “Advanced Instancing”.
But i have question, how can i remove a one instance ?
In my code i generate 1000 human, how can i remove for exemple first human ? or 500 first human, or all ? for cleanup memory
from panda3d.core import *
from direct.actor.Actor import Actor
from direct.showbase.ShowBase import ShowBase
from direct.gui.OnscreenText import OnscreenText
import random
from camera import *
loadPrcFileData('', 'threading-model Cull/Draw')
loadPrcFileData("", "show-frame-rate-meter 1")
loadPrcFileData('', 'sync-video False')
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
#custom camera driver, not important for the demo
base.disable_mouse()
self.cc=CameraControler(pos=(0,0,50.0), offset=(0, 250, 250), speed=1.0, zoom_speed=10.0)
#add some light
spot = Spotlight("spot")
spot.set_color((1.0, 1.0, 0.85, 1))
spot.set_exponent(16)
spot.get_lens().set_near_far(5, 400)
spot.get_lens().set_fov(70)
#spot.show_frustum()
spot_path = render.attach_new_node(spot)
spot_path.set_pos(-80, -80, 180)
spot_path.look_at(Point3(20, 30, 40))
render.set_shader_input('spot',spot_path)
#Advanced Instancing
dancer = Actor("gpu_rocket.bam", {"kick":"a_rocket_walk1.egg"})
dancer.loop("kick")
dancer.setPos(0,0,0)
chorusline = NodePath('chorusline')
for i in range(1000):
placeholder = chorusline.attachNewNode("Dancer-Placeholder")
placeholder.setPos(i*5,0,0)
dancer.instanceTo(placeholder)
placeholder = render.attachNewNode("Line-Placeholder")
placeholder.setPos(0,10,0)
chorusline.instanceTo(placeholder)
#Remove first instance ???
app = MyApp()
app.run()
i have second question, what is difference if i enable or disable this parameter :
loadPrcFileData(’’, ‘threading-model Cull/Draw’)
i not observe multicore in my cpu (I5 with 4 core) ?