Demo_Grass

skorpio

03-11-2007 04:28:51

Hello,

I had a chance to play with the latest release of python-ogre 1.1. It looks great!

I tried running the demo_grass but the grass doesn't seem to move.

Older versions of the code, the grass move quite nicely.

Is this demo broken?

Best regards,

Danaugrs

03-11-2007 12:05:19

I know this doesn't help hehe but
I've experienced the same problem :(

Having a quick look at the codes from both 1.1b and 1.0
I've came to notice they are exactly the same.
This is most confusing, since the change, then, must be inside PythonOgre.

Regards,
Danaugrs

andy

03-11-2007 12:48:04

Had a quick look and the issue is in the waveGrass function in Demo_grasss.py

At about line 105 you should have
offset.x = math.sin(self.xpos) * 5
offset.z = math.sin(self.zpos) * 5

For some reason the demo has *.05 which is wrong

Regards

Andy

Danaugrs

03-11-2007 18:25:09

Yay! :D
Andy has eagle eyes!

Cheers,
Danaugrs

skorpio

04-11-2007 20:38:45

thanks,
that fixed it!

dermont

08-11-2007 20:20:45

On linux the Grass Demo with the code below currently runs at about 40FPS. About a sixth of the speed of the C++ version.


for reg in mStaticGeom.getRegionIterator():
## a little randomness
self.xpos += reg.getCentre().x * 0.001
self.zpos += reg.getCentre().z * 0.001
offset.x = math.sin(self.xpos) * 5
offset.z = math.sin(self.zpos) * 5
for lod in reg.getLODIterator():
for mat in lod.getMaterialIterator():
for geom in mat.getGeometryIterator():
geom.setCustomParameter(OFFSET_PARAM, offset)


If I replace the above code with the following the demo runs at about 160FPS. Has anyone else encountered this on Linux?

rit = mStaticGeom.getRegionIterator()
while rit.hasMoreElements():
reg = rit.getNext()
self.xpos += reg.getCentre().x * 0.001
self.zpos += reg.getCentre().z * 0.001
offset.x = math.sin(self.xpos) * 5
offset.z = math.sin(self.zpos) * 5

lodit = reg.getLODIterator()
while lodit.hasMoreElements():
lod = lodit.getNext()
matit = lod.getMaterialIterator()
while matit.hasMoreElements():
mat = matit.getNext()
geomit = mat.getGeometryIterator()
while geomit.hasMoreElements():
geom = geomit.getNext()
geom.setCustomParameter(OFFSET_PARAM, offset)

saladin

09-11-2007 00:12:49

Yay! :D
Andy has eagle eyes!

Cheers,
Danaugrs


There's something called kdiff... :roll:
and it's free too.

andy

09-11-2007 13:41:30

@dermont

I guess I'll have to take a look at the generator code as it's certainly slower -- I did a quick benchmark and using the nice python 'iterator' interface is about 3 times slower than using the direct calls to the Ogre iterator :?

Cheers
Andy

Game_Ender

09-11-2007 14:58:34

Some of the OgreNewt demos appeared to be running slower as well, but I will have to get the C++ versions running to compare the difference.

dermont

09-11-2007 18:46:36

@andy, thanks for the feedback. Wasn't sure if it was a problem with my build.