Status on PLSM2

deficite

16-04-2006 14:26:35

I know clay's been gone, but does anybody have any information on the status of the PLSM2 port he was working on? Has anybody else been working on it?

dermont

17-04-2006 10:22:45

AFAIK there has been nothing done on PLSM2. Currently PLSM2 will run with pyOgre1.0.6.

You'll need to download and compile the version of PLMS2 for Ogre1.0.6 - check on the PLMS2 website. This assumes that your compiling pyOgre and have compiled Ogre from source or are using the Ogre SDK.

As with the other plugins you will only be able to access any available properties via the SceneManager get/setters (some of these may have to be updated in pyOgre).

You'll need to set up your PLMS2 data, check the wiki.

adding PLSM2 to plugins.cfg :

Plugin=Plugin_PagingLandScapeSceneManager2


updating your resources file with something like:

[PLSM2]
FileSystem=../../../Media/paginglandscape
FileSystem=../../../Media/paginglandscape/terragen16bits
FileSystem=../../../Media/paginglandscape/ps_height_1k
FileSystem=../../../Media/paginglandscape/gcanyon_height_4k2k
FileSystem=../../../Media/paginglandscape/alpes
FileSystem=../../../Media/paginglandscape/datasrcs
FileSystem=../../../Media/paginglandscape/TsmTerrain



# This code is in the public domain
import pyogre.ogre as ogre
import SampleFramework as sf

class TerrainApplication(sf.Application):
def _chooseSceneManager(self):
self.sceneManager = self.root.getSceneManager(ogre.ST_EXTERIOR_REAL_FAR)

def _createCamera(self):
self.camera = self.sceneManager.createCamera('PlayerCam')
self.camera.position = (128, 100, 128)
self.camera.lookAt((0, 0, -300))
self.camera.nearClipDistance = 1


# infinte far clip plane?
if self.root.renderSystem.capabilities.hasCapability(ogre.RSC_INFINITE_FAR_PLANE):
self.camera.farClipDistance = 0
else:
self.camera.farClipDistance = 1000



def _createScene(self):
sceneManager = self.sceneManager
camera = self.camera

sceneManager.AmbientLight = (0.5, 0.5, 0.5)

self.player = sceneManager.createEntity('Player', 'ninja.mesh')
player_node = sceneManager.rootSceneNode.createChildSceneNode(ogre.Vector3(0,0,0))
player_node.attachObject(self.player)

fadeColour = ogre.ColourValue(0.93, 0.86, 0.76)
sceneManager.setFog(ogre.FOG_LINEAR, fadeColour, 0, 500.0, 1000.0)
self.renderWindow.getViewport(0).backgroundColour = fadeColour

sceneManager.setWorldGeometry('paginglandscape2.cfg')

def _createFrameListener(self):
self.frameListener = TerrainListener(self.renderWindow, self.camera, self.sceneManager)
self.root.addFrameListener(self.frameListener)

class TerrainListener(sf.FrameListener):
def __init__(self, renderWindow, camera, sceneManager):
sf.FrameListener.__init__(self, renderWindow, camera)
self.sceneManager = sceneManager
self.moveSpeed = 50.0
self.raySceneQuery = sceneManager.createRayQuery(ogre.Ray(camera.position,
ogre.Vector3.NEGATIVE_UNIT_Y))
self.camera = camera
self.camera.position = self.camera.position + ogre.Vector3(0.0, 10.0, 0.0)

def frameStarted(self, frameEvent):
# clamp to terrain
updateRay = ogre.Ray()
updateRay.origin = self.camera.position + ogre.Vector3(0.0, 10.0, 0.0)
updateRay.direction = ogre.Vector3.NEGATIVE_UNIT_Y
self.raySceneQuery.ray = updateRay
for queryResult in self.raySceneQuery.execute():
if queryResult.worldFragment is not None:
pos = self.camera.position
if (pos.y<18700):
self.camera.position = (pos.x, pos.y - queryResult.distance + 15.0, pos.z)
break

return sf.FrameListener.frameStarted(self, frameEvent)

if __name__ == '__main__':
try:
application = TerrainApplication()
application.go()
except ogre.OgreException, e:
print e

deficite

18-04-2006 02:25:49

I already knew about that, I was asking about the task on PyOgre's project page. Thanks anyway.