[Python-ogre-commit] SF.net SVN: python-ogre: [492] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
|
From: <and...@us...> - 2007-12-07 09:28:18
|
Revision: 492
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=492&view=rev
Author: andy_miller
Date: 2007-12-07 01:28:19 -0800 (Fri, 07 Dec 2007)
Log Message:
-----------
ParticleUniverse Update --compiling and loading -- demos needs updating
Modified Paths:
--------------
trunk/python-ogre/code_generators/particleuniverse/customization_data.py
trunk/python-ogre/code_generators/particleuniverse/generate_code.py
trunk/python-ogre/code_generators/template/generate_code.py
Added Paths:
-----------
trunk/python-ogre/demos/particleuniverse/
trunk/python-ogre/demos/particleuniverse/Demo_Particle.py
trunk/python-ogre/demos/particleuniverse/SampleFramework.py
trunk/python-ogre/demos/particleuniverse/ogre.cfg
trunk/python-ogre/demos/particleuniverse/plugins.cfg
trunk/python-ogre/demos/particleuniverse/resources.cfg
trunk/python-ogre/packages_2.5/ogre/addons/particleuniverse/
trunk/python-ogre/packages_2.5/ogre/addons/particleuniverse/__init__.py
Modified: trunk/python-ogre/code_generators/particleuniverse/customization_data.py
===================================================================
--- trunk/python-ogre/code_generators/particleuniverse/customization_data.py 2007-12-07 05:28:32 UTC (rev 491)
+++ trunk/python-ogre/code_generators/particleuniverse/customization_data.py 2007-12-07 09:28:19 UTC (rev 492)
@@ -1,6 +1,8 @@
def header_files( version ):
- return [ "ParticleUniverseSystemManager.h"]
+ return [ 'ParticleUniverseSystemManager.h',
+ 'ParticleRenderers/ParticleUniverseBox.h'
+ ]
def huge_classes( version ):
return []
Modified: trunk/python-ogre/code_generators/particleuniverse/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/particleuniverse/generate_code.py 2007-12-07 05:28:32 UTC (rev 491)
+++ trunk/python-ogre/code_generators/particleuniverse/generate_code.py 2007-12-07 09:28:19 UTC (rev 492)
@@ -53,6 +53,11 @@
main_ns = global_ns.namespace( MAIN_NAMESPACE )
else:
main_ns = global_ns
+
+ NotExported=['ParticleSystemManagerTokens' ## this one is defined in a strange way within the header so lets not use it...
+ ]
+ for c in NotExported:
+ main_ns.class_( c ).exclude()
############################################################
##
@@ -210,7 +215,7 @@
)
# if this module depends on another set it here
- ## mb.register_module_dependency ( environment.ogre.generated_dir )
+ mb.register_module_dependency ( environment.ogre.generated_dir )
# normally implicit conversions work OK, however they can cause strange things to happen so safer to leave off
mb.constructors().allow_implicit_conversion = False
@@ -234,6 +239,9 @@
ManualTransformations ( mb )
AutoFixes ( mb, MAIN_NAMESPACE )
ManualFixes ( mb )
+
+ common_utils.Auto_Functional_Transformation ( main_ns, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] )
+
#
# We need to tell boost how to handle calling (and returning from) certain functions
#
@@ -268,6 +276,7 @@
mb.code_creator.user_defined_directories.append(inc )
mb.code_creator.user_defined_directories.append( environment.particleuniverse.generated_dir )
mb.code_creator.replace_included_headers( customization_data.header_files( environment.particleuniverse.version ) )
+ print "1111", customization_data.header_files( environment.particleuniverse.version )
huge_classes = map( mb.class_, customization_data.huge_classes( environment.particleuniverse.version ) )
Modified: trunk/python-ogre/code_generators/template/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/template/generate_code.py 2007-12-07 05:28:32 UTC (rev 491)
+++ trunk/python-ogre/code_generators/template/generate_code.py 2007-12-07 09:28:19 UTC (rev 492)
@@ -23,8 +23,8 @@
import common_utils
import customization_data
import hand_made_wrappers
-import register_exceptions
+
from pygccxml import parser
from pygccxml import declarations
from pyplusplus import messages
@@ -211,7 +211,7 @@
)
# if this module depends on another set it here
- ## mb.register_module_dependency ( environment.ogre.generated_dir )
+ mb.register_module_dependency ( environment.ogre.generated_dir )
# normally implicit conversions work OK, however they can cause strange things to happen so safer to leave off
mb.constructors().allow_implicit_conversion = False
Added: trunk/python-ogre/demos/particleuniverse/Demo_Particle.py
===================================================================
--- trunk/python-ogre/demos/particleuniverse/Demo_Particle.py (rev 0)
+++ trunk/python-ogre/demos/particleuniverse/Demo_Particle.py 2007-12-07 09:28:19 UTC (rev 492)
@@ -0,0 +1,70 @@
+# This code is in the Public Domain
+# -----------------------------------------------------------------------------
+# This source file is part of Python-Ogre
+# For the latest info, see http://python-ogre.org/
+#
+# It is likely based on original code from OGRE and/or PyOgre
+# For the latest info, see http://www.ogre3d.org/
+#
+# You may use this sample code for anything you like, it is not covered by the
+# LGPL.
+# -----------------------------------------------------------------------------
+import sys,os
+sys.path.insert(0,'..')
+sys.path.insert(0,'.')
+
+## this here becase the ParticelUnivser.dll needs to be access by both the python module and the ogre plugins
+## need a better fix ling term
+if sys.platform == 'win32':
+ newpath = os.path.join ( os.path.abspath(os.path.dirname(__file__)), '../../plugins')
+ os.environ['PATH'] = newpath +';' + os.environ['PATH']
+
+import PythonOgreConfig
+import ogre.renderer.OGRE as ogre
+import ogre.addons.particleuniverse as PU
+import SampleFramework as sf
+
+
+class SmokeApplication(sf.Application):
+ def _createScene(self):
+ sceneManager = self.sceneManager
+ camera = self.camera
+
+ sceneManager.ambientLight = ogre.ColourValue(0.5, 0.5, 0.5)
+# sceneManager.setSkyDome(True, 'Examples/CloudySky', 5.0, 8.0)
+
+ self.fountainNode = sceneManager.getRootSceneNode().createChildSceneNode()
+
+ print dir(PU)
+ sm = PU.ParticleSystemManager.getSingletonPtr()
+ print sm
+# std::vector<Ogre::String> names;
+# mParticleSystemManager->particleSystemTemplateNames(names);
+# std::vector<Ogre::String>::iterator it;
+# std::vector<Ogre::String>::iterator itEnd = names.end();
+# CEGUI::ListboxTextItem* item;
+# for (it = names.begin(); it != itEnd; ++it)
+# {
+# item = new CEGUI::ListboxTextItem((*it), 0);
+# mListBox->addItem(item);
+# }
+
+
+
+# particleSystem1 = sceneManager.createParticleSystem('fountain1', 'Examples/Smoke')
+
+ particleSystem2 = PU.ParticleSystemManager.getSingleton().createParticleSystem("mySystem", "example_003", sceneManager)
+ print particleSystem2
+
+ node = self.fountainNode.createChildSceneNode()
+ node.attachObject(particleSystem2)
+
+
+
+
+if __name__ == '__main__':
+ try:
+ application = SmokeApplication()
+ application.go()
+ except ogre.OgreException, e:
+ print e
Added: trunk/python-ogre/demos/particleuniverse/SampleFramework.py
===================================================================
--- trunk/python-ogre/demos/particleuniverse/SampleFramework.py (rev 0)
+++ trunk/python-ogre/demos/particleuniverse/SampleFramework.py 2007-12-07 09:28:19 UTC (rev 492)
@@ -0,0 +1,468 @@
+# This code is in the Public Domain
+# -----------------------------------------------------------------------------
+# This source file is part of Python-Ogre
+# For the latest info, see http://python-ogre.org/
+#
+# It is likely based on original code from OGRE and/or PyOgre
+# For the latest info, see http://www.ogre3d.org/
+#
+# You may use this sample code for anything you like, it is not covered by the
+# LGPL.
+# -----------------------------------------------------------------------------
+import ogre.renderer.OGRE as ogre
+import ogre.io.OIS as OIS
+
+from Enums import *
+
+Action = Enum ('QUIT','SCREENSHOT','DEBUG_MODE','RESET_SCENE', 'PAUSE', 'SLOWER', 'FASTER',
+ 'OPTION_1','OPTION_2','OPTION_3','OPTION_4',
+ 'PAN_FORWARD','PAN_BACKWARD','PAN_LEFT','PAN_RIGHT','PAN_UP','PAN_DOWN',
+ 'X','NEG_X','Y','NEG_Y','Z','NEG_Z','MODIFIER',
+ 'MOUSE_PRIMARY','MOUSE_ALT','MOUSE_NONE','MOUSE_BOTH', 'MOUSE_LOOK' )
+
+def getPluginPath():
+ """Return the absolute path to a valid plugins.cfg file."""
+ import sys
+ import os
+ import os.path
+
+ paths = [os.path.join(os.getcwd(), 'plugins.cfg'),
+ '/etc/OGRE/plugins.cfg',
+ os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ 'plugins.cfg')]
+ for path in paths:
+ if os.path.exists(path):
+ return path
+
+ sys.stderr.write("\n"
+ "** Warning: Unable to locate a suitable plugins.cfg file.\n"
+ "** Warning: Please check your ogre installation and copy a\n"
+ "** Warning: working plugins.cfg file to the current directory.\n\n")
+ raise ogre.Exception(0, "can't locate the 'plugins.cfg' file", "")
+
+class Application(object):
+ "This class is the base for an Ogre application."
+ debugText=""
+
+ def __init__(self):
+ self.frameListener = None
+ self.root = None
+ self.camera = None
+ self.renderWindow = None
+ self.sceneManager = None
+ self.world = None
+
+ def __del__(self):
+ "Clear variables, this should not actually be needed."
+ del self.camera
+ del self.sceneManager
+ del self.frameListener
+ if self.world:
+ del self.world
+ del self.root
+ del self.renderWindow
+
+ def go(self):
+ "Starts the rendering loop."
+ if not self._setUp():
+ return
+ if self._isPsycoEnabled():
+ self._activatePsyco()
+ self.root.startRendering()
+
+ def goOneFrame(self):
+ "Starts the rendering loop. Show how to use the renderOneFrame Method"
+ if not self._setUp():
+ return
+ if self._isPsycoEnabled():
+ self._activatePsyco()
+
+ self.root.getRenderSystem()._initRenderTargets()
+ while True:
+ ogre.WindowEventUtilities().messagePump()
+ if not self.root.renderOneFrame():
+ break
+
+
+
+ def _setUp(self):
+ """This sets up the ogre application, and returns false if the user
+ hits "cancel" in the dialog box."""
+ self.root = ogre.Root(getPluginPath())
+ self.root.setFrameSmoothingPeriod (5.0)
+
+ self._setUpResources()
+ if not self._configure():
+ return False
+
+ self._chooseSceneManager()
+ self._createWorld()
+ self._createCamera()
+ self._createViewports()
+
+ ogre.TextureManager.getSingleton().setDefaultNumMipmaps (5)
+
+ self._createResourceListener()
+ self._loadResources()
+
+ self._createScene()
+ self._createFrameListener()
+ return True
+
+ def _setUpResources(self):
+ """This sets up Ogre's resources, which are required to be in
+ resources.cfg."""
+ config = ogre.ConfigFile()
+ config.load('resources.cfg' )
+ seci = config.getSectionIterator()
+ while seci.hasMoreElements():
+ SectionName = seci.peekNextKey()
+ Section = seci.getNext()
+ for item in Section:
+ ogre.ResourceGroupManager.getSingleton().\
+ addResourceLocation(item.value, item.key, SectionName)
+
+ def _createResourceListener(self):
+ """This method is here if you want to add a resource listener to check
+ the status of resources loading."""
+ pass
+
+ def _createWorld ( self ):
+ """ this should be overridden when supporting the OgreRefApp framework. Also note you
+ will have to override __createCamera"""
+ pass
+
+ def _loadResources(self):
+ """This loads all initial resources. Redefine this if you do not want
+ to load all resources at startup."""
+ ogre.ResourceGroupManager.getSingleton().initialiseAllResourceGroups()
+
+ def _configure(self):
+ """This shows the config dialog and creates the renderWindow."""
+ carryOn = self.root.showConfigDialog()
+ if carryOn:
+ self.renderWindow = self.root.initialise(True, "OGRE Render Window")
+ return carryOn
+
+ def _chooseSceneManager(self):
+ """Chooses a default SceneManager."""
+ #typedef uint16 SceneTypeMask;
+ #md=ogre.SceneManagerMetaData()
+ #md.sceneTypeMask=ogre.ST_GENERIC
+ #print dir(self.root)
+ self.sceneManager = self.root.createSceneManager(ogre.ST_GENERIC,"ExampleSMInstance")
+
+ def _createCamera(self):
+ """Creates the camera."""
+ self.camera = self.sceneManager.createCamera('PlayerCam')
+ self.camera.setPosition(ogre.Vector3(0, 0, 500))
+ self.camera.lookAt(ogre.Vector3(0, 0, -300))
+ self.camera.NearClipDistance = 5
+
+ def _createViewports(self):
+ """Creates the Viewport."""
+ ## We want a single sampleframework so this work around is to support OgreRefApp Framework
+ ## if using the RefApp camera is based upon World etc etc
+ try:
+ self.viewport = self.renderWindow.addViewport(self.camera.getRealCamera())
+ except AttributeError:
+ self.viewport = self.renderWindow.addViewport(self.camera)
+ self.viewport.BackgroundColour = ogre.ColourValue(0,0,0)
+
+ def _createScene(self):
+ """Creates the scene. Override this with initial scene contents."""
+ pass
+
+ def _createFrameListener(self):
+ """Creates the FrameListener."""
+ #,self.frameListener, self.frameListener.Mouse
+ self.frameListener = FrameListener(self.renderWindow, self.camera)
+ self.frameListener.showDebugOverlay(True)
+ self.root.addFrameListener(self.frameListener)
+
+ def _isPsycoEnabled(self):
+ """Override this function and return True to turn on Psyco"""
+ return False
+
+ def _activatePsyco(self):
+ """Import Psyco if available"""
+ try:
+ import psyco
+ psyco.full()
+ except ImportError:
+ pass
+
+
+class FrameListener(ogre.FrameListener, ogre.WindowEventListener):
+ """A default frame listener, which takes care of basic mouse and keyboard
+ input."""
+
+ def __init__(self, renderWindow, camera, bufferedKeys = False, bufferedMouse = True, bufferedJoy = False):
+ ogre.FrameListener.__init__(self)
+ ogre.WindowEventListener.__init__(self)
+ self.camera = camera
+ self.renderWindow = renderWindow
+ self.statisticsOn = True
+ self.numScreenShots = 0
+ self.timeUntilNextToggle = 0
+ self.sceneDetailIndex = 0
+ self.moveScale = 0.0
+ self.rotationScale = 0.0
+ self.translateVector = ogre.Vector3(0.0,0.0,0.0)
+ self.filtering = ogre.TFO_BILINEAR
+ self.showDebugOverlay(True)
+ self.moveSpeed = 100.0
+ self.rotationSpeed = 8.0
+ self.displayCameraDetails = False
+ self.bufferedKeys = bufferedKeys
+ self.bufferedMouse = bufferedMouse
+ self.bufferedJoy = bufferedJoy
+ self.MenuMode = False # lets understand a simple menu function
+ ## we can tell if we are using OgreRefapp based upon the camera class
+
+ if self.camera.__class__ == ogre.Camera:
+ self.RefAppEnable = False
+ else:
+ self.RefAppEnable = True
+ self._setupInput()
+
+ def __del__ (self ):
+ ogre.WindowEventUtilities.removeWindowEventListener(self.renderWindow, self)
+ self.windowClosed(self.renderWindow)
+
+ def _setupInput(self):
+ # ignore buffered input
+
+ windowHnd = self.renderWindow.getCustomAttributeInt("WINDOW")
+ self.InputManager = \
+ OIS.createPythonInputSystem([("WINDOW",str(windowHnd))])
+
+ #pl = OIS.ParamList()
+ #windowHndStr = str ( windowHnd)
+ #pl.insert("WINDOW", windowHndStr)
+ #im = OIS.InputManager.createInputSystem( pl )
+
+ #Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse)
+ self.Keyboard = self.InputManager.createInputObjectKeyboard( OIS.OISKeyboard, self.bufferedKeys )
+ self.Mouse = self.InputManager.createInputObjectMouse( OIS.OISMouse, self.bufferedMouse )
+ try:
+ self.Joy = self.InputManager.createInputObjectJoyStick( OIS.OISJoyStick, self.bufferedJoy )
+ except:
+ self.Joy = False
+#
+ #Set initial mouse clipping size
+ self.windowResized(self.renderWindow)
+
+ self.showDebugOverlay(True)
+
+ #Register as a Window listener
+ ogre.WindowEventUtilities.addWindowEventListener(self.renderWindow, self);
+
+ def setMenuMode(self, mode):
+ self.MenuMode = mode
+
+ def _UpdateSimulation( self, frameEvent ):
+ # create a real version of this to update the simulation
+ pass
+
+ def windowResized (self, rw):
+ [width, height, depth, left, top] = rw.getMetrics() # Note the wrapped function as default needs unsigned int's
+ ms = self.Mouse.getMouseState()
+ ms.width = width
+ ms.height = height
+
+ def windowClosed(self, rw):
+ #Only close for window that created OIS (mWindow)
+ if( rw == self.renderWindow ):
+ if( self.InputManager ):
+ self.InputManager.destroyInputObjectMouse( self.Mouse )
+ self.InputManager.destroyInputObjectKeyboard( self.Keyboard )
+ if self.Joy:
+ self.InputManager.destroyInputObjectJoyStick( self.Joy )
+ OIS.InputManager.destroyInputSystem(self.InputManager)
+ self.InputManager=None
+
+ def frameStarted(self, frameEvent):
+ if(self.renderWindow.isClosed()):
+ return False
+
+ ##Need to capture/update each device - this will also trigger any listeners
+ self.Keyboard.capture()
+ self.Mouse.capture()
+ if( self.Joy ):
+ self.Joy.capture()
+
+ ##bool buffJ = (mJoy) ? mJoy->buffered() : true;
+
+ if self.timeUntilNextToggle >= 0:
+ self.timeUntilNextToggle -= frameEvent.timeSinceLastFrame
+
+ if frameEvent.timeSinceLastFrame == 0:
+ self.moveScale = 1
+ self.rotationScale = 0.1
+ else:
+ self.moveScale = self.moveSpeed * frameEvent.timeSinceLastFrame
+ self.rotationScale = self.rotationSpeed * frameEvent.timeSinceLastFrame
+
+ self.rotationX = ogre.Degree(0.0)
+ self.rotationY = ogre.Degree(0.0)
+ self.translateVector = ogre.Vector3(0.0, 0.0, 0.0)
+ if not self._processUnbufferedKeyInput(frameEvent):
+ return False
+
+ if not self.MenuMode: # if we are in Menu mode we don't move the camera..
+ self._processUnbufferedMouseInput(frameEvent)
+ self._moveCamera()
+ # Perform simulation step only if using OgreRefApp. For simplicity create a function that simply does
+ ### "OgreRefApp.World.getSingleton().simulationStep(frameEvent.timeSinceLastFrame)"
+
+ if self.RefAppEnable:
+ self._UpdateSimulation( frameEvent )
+ return True
+
+ def frameEnded(self, frameEvent):
+ self._updateStatistics()
+ return True
+
+ def showDebugOverlay(self, show):
+ """Turns the debug overlay (frame statistics) on or off."""
+ overlay = ogre.OverlayManager.getSingleton().getByName('Core/DebugOverlay')
+ if overlay is None:
+ raise ogre.Exception(111, "Could not find overlay Core/DebugOverlay", "SampleFramework.py")
+ if show:
+ overlay.show()
+ else:
+ overlay.hide()
+
+ def _processUnbufferedKeyInput(self, frameEvent):
+ if self.Keyboard.isKeyDown(OIS.KC_A):
+ self.translateVector.x = -self.moveScale
+
+ if self.Keyboard.isKeyDown(OIS.KC_D):
+ self.translateVector.x = self.moveScale
+
+ if self.Keyboard.isKeyDown(OIS.KC_UP) or self.Keyboard.isKeyDown(OIS.KC_W):
+ self.translateVector.z = -self.moveScale
+
+ if self.Keyboard.isKeyDown(OIS.KC_DOWN) or self.Keyboard.isKeyDown(OIS.KC_S):
+ self.translateVector.z = self.moveScale
+
+ if self.Keyboard.isKeyDown(OIS.KC_PGUP):
+ self.translateVector.y = self.moveScale
+
+ if self.Keyboard.isKeyDown(OIS.KC_PGDOWN):
+ self.translateVector.y = - self.moveScale
+
+ if self.Keyboard.isKeyDown(OIS.KC_RIGHT):
+ self.rotationX = - self.rotationScale
+
+ if self.Keyboard.isKeyDown(OIS.KC_LEFT):
+ self.rotationX = self.rotationScale
+
+ if self.Keyboard.isKeyDown(OIS.KC_ESCAPE) or self.Keyboard.isKeyDown(OIS.KC_Q):
+ return False
+
+ if( self.Keyboard.isKeyDown(OIS.KC_F) and self.timeUntilNextToggle <= 0 ):
+ self.statisticsOn = not self.statisticsOn
+ self.showDebugOverlay(self.statisticsOn)
+ self.timeUntilNextToggle = 1
+
+ if self.Keyboard.isKeyDown(OIS.KC_T) and self.timeUntilNextToggle <= 0:
+ if self.filtering == ogre.TFO_BILINEAR:
+ self.filtering = ogre.TFO_TRILINEAR
+ self.Aniso = 1
+ elif self.filtering == ogre.TFO_TRILINEAR:
+ self.filtering = ogre.TFO_ANISOTROPIC
+ self.Aniso = 8
+ else:
+ self.filtering = ogre.TFO_BILINEAR
+ self.Aniso = 1
+
+ ogre.MaterialManager.getSingleton().setDefaultTextureFiltering(self.filtering)
+ ogre.MaterialManager.getSingleton().setDefaultAnisotropy(self.Aniso)
+ self.showDebugOverlay(self.statisticsOn)
+ self.timeUntilNextToggle = 1
+
+ if self.Keyboard.isKeyDown(OIS.KC_SYSRQ) and self.timeUntilNextToggle <= 0:
+ path = 'screenshot_%d.png' % self.numScreenShots
+ self.numScreenShots += 1
+ self.renderWindow.writeContentsToFile(path)
+ Application.debugText = 'screenshot taken: ' + path
+ self.timeUntilNextToggle = 0.5
+
+ if self.Keyboard.isKeyDown(OIS.KC_R) and self.timeUntilNextToggle <= 0:
+ detailsLevel = [ ogre.PM_SOLID,
+ ogre.PM_WIREFRAME,
+ ogre.PM_POINTS ]
+ self.sceneDetailIndex = (self.sceneDetailIndex + 1) % len(detailsLevel)
+ self.camera.polygonMode=detailsLevel[self.sceneDetailIndex]
+ self.timeUntilNextToggle = 0.5
+
+ if self.Keyboard.isKeyDown(OIS.KC_F) and self.timeUntilNextToggle <= 0:
+ self.statisticsOn = not self.statisticsOn
+ self.showDebugOverlay(self.statisticsOn)
+ self.timeUntilNextToggle = 1
+
+ if self.Keyboard.isKeyDown(OIS.KC_P) and self.timeUntilNextToggle <= 0:
+ self.displayCameraDetails = not self.displayCameraDetails
+ if not self.displayCameraDetails:
+ Application.debugText = ""
+
+ if self.displayCameraDetails:
+ # Print camera details
+ pos = self.camera.getDerivedPosition()
+ o = self.camera.getDerivedOrientation()
+ Application.debugText = "P: %.3f %.3f %.3f O: %.3f %.3f %.3f %.3f" \
+ % (pos.x,pos.y,pos.z, o.w,o.x,o.y,o.z)
+ return True
+
+ def _isToggleKeyDown(self, keyCode, toggleTime = 1.0):
+ if self.Keyboard.isKeyDown(keyCode)and self.timeUntilNextToggle <=0:
+ self.timeUntilNextToggle = toggleTime
+ return True
+ return False
+
+ def _isToggleMouseDown(self, Button, toggleTime = 1.0):
+ ms = self.Mouse.getMouseState()
+ if ms.buttonDown( Button ) and self.timeUntilNextToggle <=0:
+ self.timeUntilNextToggle = toggleTime
+ return True
+ return False
+
+ def _processUnbufferedMouseInput(self, frameEvent):
+ ms = self.Mouse.getMouseState()
+ if ms.buttonDown( OIS.MB_Right ):
+ self.translateVector.x += ms.X.rel * 0.13
+ self.translateVector.y -= ms.Y.rel * 0.13
+ else:
+ self.rotationX = ogre.Degree(- ms.X.rel * 0.13)
+ self.rotationY = ogre.Degree(- ms.Y.rel * 0.13)
+
+ def _moveCamera(self):
+ self.camera.yaw(self.rotationX)
+ self.camera.pitch(self.rotationY)
+ try:
+ self.camera.translate(self.translateVector) # for using OgreRefApp
+ except AttributeError:
+ self.camera.moveRelative(self.translateVector)
+
+ def _updateStatistics(self):
+ statistics = self.renderWindow
+ self._setGuiCaption('Core/AverageFps', 'Average FPS: %f' % statistics.getAverageFPS())
+ self._setGuiCaption('Core/CurrFps', 'Current FPS: %f' % statistics.getLastFPS())
+ self._setGuiCaption('Core/BestFps',
+ 'Best FPS: %f %d ms' % (statistics.getBestFPS(), statistics.getBestFrameTime()))
+ self._setGuiCaption('Core/WorstFps',
+ 'Worst FPS: %f %d ms' % (statistics.getWorstFPS(), statistics.getWorstFrameTime()))
+ self._setGuiCaption('Core/NumTris', 'Triangle Count: %d' % statistics.getTriangleCount())
+ self._setGuiCaption('Core/DebugText', Application.debugText)
+
+ def _setGuiCaption(self, elementName, text):
+ element = ogre.OverlayManager.getSingleton().getOverlayElement(elementName, False)
+ ##d=ogre.UTFString("hell0")
+ ##element.setCaption(d)
+
+ #element.caption="hello"
+
+ #element.setCaption("help")
+ element.setCaption(text) # ogre.UTFString(text))
Added: trunk/python-ogre/demos/particleuniverse/ogre.cfg
===================================================================
--- trunk/python-ogre/demos/particleuniverse/ogre.cfg (rev 0)
+++ trunk/python-ogre/demos/particleuniverse/ogre.cfg 2007-12-07 09:28:19 UTC (rev 492)
@@ -0,0 +1,19 @@
+Render System=Direct3D9 Rendering Subsystem
+
+[OpenGL Rendering Subsystem]
+Colour Depth=32
+Display Frequency=60
+FSAA=0
+Full Screen=Yes
+RTT Preferred Mode=FBO
+VSync=No
+Video Mode=1024 x 768
+
+[Direct3D9 Rendering Subsystem]
+Allow NVPerfHUD=No
+Anti aliasing=None
+Floating-point mode=Fastest
+Full Screen=No
+Rendering Device=ATI Mobility Radeon X1300
+VSync=No
+Video Mode=800 x 600 @ 32-bit colour
Added: trunk/python-ogre/demos/particleuniverse/plugins.cfg
===================================================================
--- trunk/python-ogre/demos/particleuniverse/plugins.cfg (rev 0)
+++ trunk/python-ogre/demos/particleuniverse/plugins.cfg 2007-12-07 09:28:19 UTC (rev 492)
@@ -0,0 +1,21 @@
+# Defines plugins to load
+
+## Use this for Windows
+# Define plugin folder
+#PluginFolder=c:/pythonogre/plugins
+PluginFolder=../../plugins
+Plugin=RenderSystem_GL.dll
+Plugin=RenderSystem_Direct3D9.dll
+Plugin=Plugin_ParticleFX.dll
+Plugin=Plugin_BSPSceneManager.dll
+Plugin=Plugin_OctreeSceneManager.dll
+Plugin=Plugin_CgProgramManager.dll
+Plugin=ParticleUniverse.dll
+
+##
+## NOTE use this for MacOS or Linux
+# Plugin=RenderSystem_GL
+# Plugin=Plugin_ParticleFX
+# Plugin=Plugin_BSPSceneManager
+# Plugin=Plugin_OctreeSceneManager
+# Plugin=Plugin_CgProgramManager
Added: trunk/python-ogre/demos/particleuniverse/resources.cfg
===================================================================
--- trunk/python-ogre/demos/particleuniverse/resources.cfg (rev 0)
+++ trunk/python-ogre/demos/particleuniverse/resources.cfg 2007-12-07 09:28:19 UTC (rev 492)
@@ -0,0 +1,34 @@
+[Bootstrap]
+Zip=../media/packs/OgreCore.zip
+
+# Resource locations to be added to the default path
+[General]
+FileSystem=../media
+FileSystem=../media/fonts
+FileSystem=../media/sounds
+FileSystem=../media/Audio
+FileSystem=../media/materials/programs
+FileSystem=../media/materials/scripts
+FileSystem=../media/materials/textures
+FileSystem=../media/models
+FileSystem=../media/overlays
+FileSystem=../media/particle
+FileSystem=../media/gui
+Zip=../media/packs/cubemap.zip
+Zip=../media/packs/cubemapsJS.zip
+Zip=../media/packs/dragon.zip
+Zip=../media/packs/fresneldemo.zip
+Zip=../media/packs/ogretestmap.zip
+Zip=../media/packs/skybox.zip
+#Zip=../media/packs/chiropteraDM.pk3
+
+FileSystem=./Media/ParticleUniverse
+FileSystem=./Media/ParticleUniverse/material
+FileSystem=./Media/ParticleUniverse/scripts
+FileSystem=./Media/ParticleUniverse/models
+FileSystem=./Media/ParticleUniverse/gui
+FileSystem=./Media/ParticleUniverse/textures/32x32
+FileSystem=./Media/ParticleUniverse/textures/64x64
+FileSystem=./Media/ParticleUniverse/textures/128x128
+FileSystem=./Media/ParticleUniverse/textures/256x256
+FileSystem=./Media/ParticleUniverse/textures/various
\ No newline at end of file
Added: trunk/python-ogre/packages_2.5/ogre/addons/particleuniverse/__init__.py
===================================================================
--- trunk/python-ogre/packages_2.5/ogre/addons/particleuniverse/__init__.py (rev 0)
+++ trunk/python-ogre/packages_2.5/ogre/addons/particleuniverse/__init__.py 2007-12-07 09:28:19 UTC (rev 492)
@@ -0,0 +1 @@
+from _particleuniverse_ import *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|