Thread: [Python-ogre-commit] SF.net SVN: python-ogre:[662] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
From: <and...@us...> - 2008-07-17 10:38:42
|
Revision: 662 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=662&view=rev Author: andy_miller Date: 2008-07-17 10:38:12 +0000 (Thu, 17 Jul 2008) Log Message: ----------- CEGUI Demo updates thanks to Dermont Changes to support CEGUI 0.6.1 Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/demos/cegui/CEGUI_framework.py trunk/python-ogre/demos/cegui/resources.cfg trunk/python-ogre/demos/ogreode/SimpleScenes.py trunk/python-ogre/demos/ogreode/SimpleScenes_Buggy.py trunk/python-ogre/demos/ogreode/SimpleScenes_Chain.py trunk/python-ogre/demos/ogreode/SimpleScenes_Joints.py trunk/python-ogre/demos/ogreode/SimpleScenes_TriMesh.py trunk/python-ogre/environment.py Added Paths: ----------- trunk/python-ogre/demos/cegui/Demo_CEGUI_DragnDropv061.py trunk/python-ogre/demos/cegui/Demo_CEGUI_Falgard1v061.py trunk/python-ogre/demos/cegui/Demo_CEGUI_FirstWindowv061.py trunk/python-ogre/demos/cegui/Demo_CEGUI_FontDemov061.py trunk/python-ogre/demos/cegui/Demo_CEGUI_ScrollablePanev061.py trunk/python-ogre/demos/cegui/Demo_CEGUI_TabControlv061.py trunk/python-ogre/demos/cegui/Demo_CEGUI_Treev061.py trunk/python-ogre/demos/cegui/datafiles/ trunk/python-ogre/demos/cegui/datafiles/configs/ trunk/python-ogre/demos/cegui/datafiles/configs/CEGUIConfig.xsd trunk/python-ogre/demos/cegui/datafiles/fonts/ trunk/python-ogre/demos/cegui/datafiles/fonts/Commonv2c.ttf trunk/python-ogre/demos/cegui/datafiles/fonts/Commonwealth-10.font trunk/python-ogre/demos/cegui/datafiles/fonts/DejaVuSans-10.font trunk/python-ogre/demos/cegui/datafiles/fonts/DejaVuSans.ttf trunk/python-ogre/demos/cegui/datafiles/fonts/FairChar-30.font trunk/python-ogre/demos/cegui/datafiles/fonts/Font.xsd trunk/python-ogre/demos/cegui/datafiles/fonts/Iconified-12.font trunk/python-ogre/demos/cegui/datafiles/fonts/Iconiv2.ttf trunk/python-ogre/demos/cegui/datafiles/fonts/Legal.txt trunk/python-ogre/demos/cegui/datafiles/fonts/README trunk/python-ogre/demos/cegui/datafiles/fonts/common.txt trunk/python-ogre/demos/cegui/datafiles/fonts/fkp-16.font trunk/python-ogre/demos/cegui/datafiles/fonts/fkp.de.pcf trunk/python-ogre/demos/cegui/datafiles/fonts/icon.txt trunk/python-ogre/demos/cegui/datafiles/imagesets/ trunk/python-ogre/demos/cegui/datafiles/imagesets/DriveIcons.imageset trunk/python-ogre/demos/cegui/datafiles/imagesets/DriveIcons.png trunk/python-ogre/demos/cegui/datafiles/imagesets/FairChar.imageset trunk/python-ogre/demos/cegui/datafiles/imagesets/FairChar.tga trunk/python-ogre/demos/cegui/datafiles/imagesets/GPN-2000-001437.tga trunk/python-ogre/demos/cegui/datafiles/imagesets/Imageset.xsd trunk/python-ogre/demos/cegui/datafiles/imagesets/ReadMe.txt trunk/python-ogre/demos/cegui/datafiles/imagesets/TaharezLook.imageset trunk/python-ogre/demos/cegui/datafiles/imagesets/TaharezLook.tga trunk/python-ogre/demos/cegui/datafiles/imagesets/Vanilla.imageset trunk/python-ogre/demos/cegui/datafiles/imagesets/WindowsLook.imageset trunk/python-ogre/demos/cegui/datafiles/imagesets/WindowsLook.tga trunk/python-ogre/demos/cegui/datafiles/imagesets/vanilla.tga trunk/python-ogre/demos/cegui/datafiles/layouts/ trunk/python-ogre/demos/cegui/datafiles/layouts/Console.wnd trunk/python-ogre/demos/cegui/datafiles/layouts/Demo7Windows.layout trunk/python-ogre/demos/cegui/datafiles/layouts/Demo8.layout trunk/python-ogre/demos/cegui/datafiles/layouts/DragDropDemo.layout trunk/python-ogre/demos/cegui/datafiles/layouts/FontDemo.layout trunk/python-ogre/demos/cegui/datafiles/layouts/GUILayout.xsd trunk/python-ogre/demos/cegui/datafiles/layouts/TabControlDemo.layout trunk/python-ogre/demos/cegui/datafiles/layouts/TabPage.layout trunk/python-ogre/demos/cegui/datafiles/layouts/TabPage1.layout trunk/python-ogre/demos/cegui/datafiles/layouts/TabPage2.layout trunk/python-ogre/demos/cegui/datafiles/layouts/TextDemo.layout trunk/python-ogre/demos/cegui/datafiles/layouts/TreeDemoTaharez.layout trunk/python-ogre/demos/cegui/datafiles/layouts/VanillaConsole.layout trunk/python-ogre/demos/cegui/datafiles/layouts/VanillaWindows.layout trunk/python-ogre/demos/cegui/datafiles/looknfeel/ trunk/python-ogre/demos/cegui/datafiles/looknfeel/Falagard.xsd trunk/python-ogre/demos/cegui/datafiles/looknfeel/TaharezLook.looknfeel trunk/python-ogre/demos/cegui/datafiles/looknfeel/Vanilla.looknfeel trunk/python-ogre/demos/cegui/datafiles/looknfeel/WindowsLook.looknfeel trunk/python-ogre/demos/cegui/datafiles/lua_scripts/ trunk/python-ogre/demos/cegui/datafiles/lua_scripts/IConsole.lua trunk/python-ogre/demos/cegui/datafiles/lua_scripts/InstancedInit.lua trunk/python-ogre/demos/cegui/datafiles/lua_scripts/demo8.lua trunk/python-ogre/demos/cegui/datafiles/schemes/ trunk/python-ogre/demos/cegui/datafiles/schemes/Demo8.scheme trunk/python-ogre/demos/cegui/datafiles/schemes/GUIScheme.xsd trunk/python-ogre/demos/cegui/datafiles/schemes/TaharezLook.scheme trunk/python-ogre/demos/cegui/datafiles/schemes/TaharezLookWidgetAliases.scheme trunk/python-ogre/demos/cegui/datafiles/schemes/TaharezLookWidgets.scheme trunk/python-ogre/demos/cegui/datafiles/schemes/VanillaSkin.scheme trunk/python-ogre/demos/cegui/datafiles/schemes/WindowsLook.scheme trunk/python-ogre/demos/cegui/datafiles/schemes/WindowsLookWidgets.scheme trunk/python-ogre/demos/cegui/v061/ trunk/python-ogre/demos/cegui/v061/TreeDemoMaterial.layout trunk/python-ogre/demos/cegui/v061/TreeDemoTaharez.layout trunk/python-ogre/demos/cegui/v061/TreeDemoVanilla.layout Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-07-17 08:53:19 UTC (rev 661) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-07-17 10:38:12 UTC (rev 662) @@ -38,8 +38,7 @@ PATH_THIRDPARTY = os.path.join(module_dir, 'ThirdParty' ) PATH_Ogre = os.path.join(BASE_DIR, 'ogre') PATH_OgreAddons = os.path.join(BASE_DIR, 'OgreAddons') -PATH_CEGUI = os.path.join(BASE_DIR, 'CEGUI-0.5.0') -PATH_CEGUI = os.path.join(BASE_DIR, 'CEGUI-0.6.0') +PATH_CEGUI = os.path.join(BASE_DIR, 'CEGUI-0.6.1') PATH_OIS = os.path.join(BASE_DIR, 'ois' ) ##'ois-1.0RC1') PATH_Newton = os.path.join(BASE_DIR, 'newtonsdk','sdk') @@ -56,7 +55,7 @@ PATH_ogreforests= os.path.join(PATH_THIRDPARTY,'forests') PATH_OGREAL= os.path.join(PATH_THIRDPARTY,'ogreal') -PATH_OGREAL= os.path.join(BASE_DIR,'ogreal') +# PATH_OGREAL= os.path.join(BASE_DIR,'ogreal') PATH_OPCODE= os.path.join(PATH_THIRDPARTY,'opcode') PATH_quickgui= os.path.join(PATH_THIRDPARTY,'quickgui') @@ -107,7 +106,7 @@ PATH_LIB_OgreOdePrefab = os.path.join( PATH_OgreOde, 'prefab/lib/Release' ) PATH_LIB_OgreOdeLoader = os.path.join( PATH_OgreOde, 'loader/lib/Release' ) -PATH_LIB_OgreAL = os.path.join( PATH_OGREAL, 'lib/Release' ) +PATH_LIB_OgreAL = os.path.join( PATH_OGREAL ) # , 'lib/Release' ) PATH_LIB_betagui = PATH_betagui PATH_LIB_quickgui = PATH_quickgui PATH_LIB_NxOgre= os.path.join(PATH_NxOgre, 'lib') @@ -140,7 +139,7 @@ PATH_INCLUDE_OPCODE = PATH_OPCODE PATH_INCLUDE_ODESOURCE = os.path.join( PATH_ODE, 'ode/src') -PATH_INCLUDE_OgreAL = os.path.join( PATH_OGREAL, 'include' ) +PATH_INCLUDE_OgreAL = os.path.join( PATH_OGREAL ) #, 'include' ) PATH_INCLUDE_OPENAL = os.path.join( PATH_OPENAL, 'include') PATH_INCLUDE_OGG= os.path.join( PATH_OGG, 'include' ) PATH_INCLUDE_VORBIS= os.path.join( PATH_VORBIS, 'include' ) Modified: trunk/python-ogre/demos/cegui/CEGUI_framework.py =================================================================== --- trunk/python-ogre/demos/cegui/CEGUI_framework.py 2008-07-17 08:53:19 UTC (rev 661) +++ trunk/python-ogre/demos/cegui/CEGUI_framework.py 2008-07-17 10:38:12 UTC (rev 662) @@ -1,96 +1,96 @@ -import ctypes - -# The follow patch from Tim (Mithro) fixes a loder issue with CEGUI - previously we'd patched CEGUI to -# ensure the CEGUIBase was linked to every module to solve the issue with Python dynamically loading -# the _cegui_.so module without RTLD_GLOBAL set - then when CEGUI opened it's dynamic modules it -# couldn't find all the symbols. - -print ctypes.CDLL("../../../root/usr/lib/libCEGUIBase.so", ctypes.RTLD_GLOBAL ) - -import ogre.gui.CEGUI as CEGUI - -# Another fix for CEGUI to ensure we get a working parser.. -CEGUI.System.setDefaultXMLParserName("TinyXMLParser") - -import ogre.io.OIS as OIS -import SampleFramework - -##----------------------------------------------------------------## -def convertOISMouseButtonToCegui( buttonID): - if buttonID ==0: - return CEGUI.LeftButton - elif buttonID ==1: - return CEGUI.RightButton - elif buttonID ==2: - return CEGUI.MiddleButton - elif buttonID ==3: - return CEGUI.X1Button - else: - return CEGUI.LeftButton - -def _PointHack(x, y): - return CEGUI.Vector2(x, y) -CEGUI.Point = _PointHack - -def cegui_reldim ( x ) : - return CEGUI.UDim((x),0) - -class MouseListener ( OIS.MouseListener ): - def __init__(self): - OIS.MouseListener.__init__( self) - - ##----------------------------------------------------------------## - def mouseMoved( self, arg ): - CEGUI.System.getSingleton().injectMouseMove( arg.get_state().X.rel, arg.get_state().Y.rel ) - return True - - ##----------------------------------------------------------------## - def mousePressed( self, arg, id ): - CEGUI.System.getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id)) - return True - - ##----------------------------------------------------------------## - def mouseReleased( self, arg, id ): - CEGUI.System.getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id)) - return True - - -class GuiFrameListener(SampleFramework.FrameListener , OIS.KeyListener, OIS.MouseListener): - - def __init__(self, renderWindow, camera, CEGUIRenderer): - - SampleFramework.FrameListener.__init__(self, renderWindow, camera, True, True, True) - OIS.KeyListener.__init__(self) - self.mouselistener = MouseListener () - #OIS.MouseListener.__init_(self) - - self.Mouse.setEventCallback(self.mouselistener) - self.Keyboard.setEventCallback(self) - - self.ShutdownRequested = False - self.GUIRenderer = CEGUIRenderer - self.keepRendering = True # whether to continue rendering or not - self.numScreenShots = 0 # screen shot count - - ## Tell the frame listener to exit at the end of the next frame - def requestShutdown( self ): - self.ShutdownRequested = True - - def frameEnded(self, evt): - if self.ShutdownRequested: - return False - else: - return SampleFramework.FrameListener.frameEnded(self, evt) - - ##----------------------------------------------------------------## - def keyPressed( self, arg ): - if arg.key == OIS.KC_ESCAPE: - self.ShutdownRequested = True - CEGUI.System.getSingleton().injectKeyDown( arg.key ) - CEGUI.System.getSingleton().injectChar( arg.text ) - return True - - ##----------------------------------------------------------------## - def keyReleased( self, arg ): - CEGUI.System.getSingleton().injectKeyUp( arg.key ) - return True +import ctypes + +# The follow patch from Tim (Mithro) fixes a loder issue with CEGUI - previously we'd patched CEGUI to +# ensure the CEGUIBase was linked to every module to solve the issue with Python dynamically loading +# the _cegui_.so module without RTLD_GLOBAL set - then when CEGUI opened it's dynamic modules it +# couldn't find all the symbols. + +#print ctypes.CDLL("../../../root/usr/lib/libCEGUIBase.so", ctypes.RTLD_GLOBAL ) + +import ogre.gui.CEGUI as CEGUI + +# Another fix for CEGUI to ensure we get a working parser.. +CEGUI.System.setDefaultXMLParserName("TinyXMLParser") + +import ogre.io.OIS as OIS +import SampleFramework + +##----------------------------------------------------------------## +def convertOISMouseButtonToCegui( buttonID): + if buttonID ==0: + return CEGUI.LeftButton + elif buttonID ==1: + return CEGUI.RightButton + elif buttonID ==2: + return CEGUI.MiddleButton + elif buttonID ==3: + return CEGUI.X1Button + else: + return CEGUI.LeftButton + +def _PointHack(x, y): + return CEGUI.Vector2(x, y) +CEGUI.Point = _PointHack + +def cegui_reldim ( x ) : + return CEGUI.UDim((x),0) + +class MouseListener ( OIS.MouseListener ): + def __init__(self): + OIS.MouseListener.__init__( self) + + ##----------------------------------------------------------------## + def mouseMoved( self, arg ): + CEGUI.System.getSingleton().injectMouseMove( arg.get_state().X.rel, arg.get_state().Y.rel ) + return True + + ##----------------------------------------------------------------## + def mousePressed( self, arg, id ): + CEGUI.System.getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id)) + return True + + ##----------------------------------------------------------------## + def mouseReleased( self, arg, id ): + CEGUI.System.getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id)) + return True + + +class GuiFrameListener(SampleFramework.FrameListener , OIS.KeyListener, OIS.MouseListener): + + def __init__(self, renderWindow, camera, CEGUIRenderer): + + SampleFramework.FrameListener.__init__(self, renderWindow, camera, True, True, True) + OIS.KeyListener.__init__(self) + self.mouselistener = MouseListener () + #OIS.MouseListener.__init_(self) + + self.Mouse.setEventCallback(self.mouselistener) + self.Keyboard.setEventCallback(self) + + self.ShutdownRequested = False + self.GUIRenderer = CEGUIRenderer + self.keepRendering = True # whether to continue rendering or not + self.numScreenShots = 0 # screen shot count + + ## Tell the frame listener to exit at the end of the next frame + def requestShutdown( self ): + self.ShutdownRequested = True + + def frameEnded(self, evt): + if self.ShutdownRequested: + return False + else: + return SampleFramework.FrameListener.frameEnded(self, evt) + + ##----------------------------------------------------------------## + def keyPressed( self, arg ): + if arg.key == OIS.KC_ESCAPE: + self.ShutdownRequested = True + CEGUI.System.getSingleton().injectKeyDown( arg.key ) + CEGUI.System.getSingleton().injectChar( arg.text ) + return True + + ##----------------------------------------------------------------## + def keyReleased( self, arg ): + CEGUI.System.getSingleton().injectKeyUp( arg.key ) + return True Added: trunk/python-ogre/demos/cegui/Demo_CEGUI_DragnDropv061.py =================================================================== --- trunk/python-ogre/demos/cegui/Demo_CEGUI_DragnDropv061.py (rev 0) +++ trunk/python-ogre/demos/cegui/Demo_CEGUI_DragnDropv061.py 2008-07-17 10:38:12 UTC (rev 662) @@ -0,0 +1,167 @@ +#/*************************************************************************** +# * Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team +# * +# * Permission is hereby granted, free of charge, to any person obtaining +# * a copy of this software and associated documentation files (the +# * "Software"), to deal in the Software without restriction, including +# * without limitation the rights to use, copy, modify, merge, publish, +# * distribute, sublicense, and/or sell copies of the Software, and to +# * permit persons to whom the Software is furnished to do so, subject to +# * the following conditions: +# * +# * The above copyright notice and this permission notice shall be +# * included in all copies or substantial portions of the Software. +# * +# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# * OTHER DEALINGS IN THE SOFTWARE. +# ***************************************************************************/ + + +import sys +sys.path.insert(0,'..') +import PythonOgreConfig + +import ogre.renderer.OGRE as ogre +import ogre.io.OIS as OIS +import ogre.gui.CEGUI as CEGUI +import SampleFramework + +from CEGUI_framework import * + + +def createUVector2( x, y): + return CEGUI.UVector2(CEGUI.UDim(x,0), CEGUI.UDim(y,0)) + +def handle_ItemDropped(args): + if not args.window.getChildCount(): + # add dragdrop item as child of target if target has no item already + args.window.addChildWindow(args.dragDropItem) + # Now we must reset the item position from it's 'dropped' location, + # since we're now a child of an entirely different window + args.dragDropItem.setPosition( + createUVector2(0.05, 0.05) ) + return True + + + + +class GEUIApplication(SampleFramework.Application): + + def __init__(self): + SampleFramework.Application.__init__(self) + self.CEGUIRenderer = 0 + self.CEGUISystem = 0 + + def _createScene(self): + + sceneManager = self.sceneManager + sceneManager.ambientLight = ogre.ColourValue(0.25, 0.25, 0.25) + + # initiaslise CEGUI Renderer + self.CEGUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderWindow, + ogre.RenderQueueGroupID.RENDER_QUEUE_OVERLAY, + False, 3000, + self.sceneManager) + + self.CEGUISystem = CEGUI.System(self.CEGUIRenderer) + CEGUI.Logger.getSingleton().loggingLevel = CEGUI.Insane + + # load TaharezLook scheme + CEGUI.SchemeManager.getSingleton().loadScheme("WindowsLook.scheme") + + # load font and setup default if not loaded via scheme + if not CEGUI.FontManager.getSingleton().isFontPresent("DejaVuSans-10.font"): + try: + CEGUI.FontManager.getSingleton().createFont("DejaVuSans-10.font") + except: + ## assume font is defined in loaded scheme + pass + + ## set up defaults + CEGUI.System.getSingleton().setDefaultMouseCursor("WindowsLook", "MouseArrow") + CEGUI.System.getSingleton().setDefaultFont("DejaVuSans-10") + + # load the drive icons imageset + CEGUI.ImagesetManager.getSingleton().createImageset("DriveIcons.imageset") + + ## load the initial layout + CEGUI.System.getSingleton().setGUISheet( + CEGUI.WindowManager.getSingleton().loadWindowLayout("DragDropDemo.layout", False)) + + ## setup events + self._subscribeEvents() + + + def _subscribeEvents(self): + wmgr = CEGUI.WindowManager.getSingleton() + + + # Subscribe the same handler to each of the twelve slots + base_name = "Root/MainWindow/Slot" + for i in range(1,13): + try: + # get the window pointer for this slot + wnd = wmgr.getWindow(base_name + CEGUI.PropertyHelper.intToString(i)) + wnd.subscribeEvent( + CEGUI.Window.EventDragDropItemDropped, handle_ItemDropped,"") + except CEGUI.Exception, e: + print e + + def _createCamera(self): + self.camera = self.sceneManager.createCamera("PlayerCam") + self.camera.nearClipDistance = 5 + + def _createFrameListener(self): + self.frameListener = CEGUIFrameListener(self.renderWindow, self.camera, self.sceneManager) + self.root.addFrameListener(self.frameListener) + self.frameListener.showDebugOverlay(True) + + def __del__(self): + "Clear variables, this is needed to ensure the correct order of deletion" + del self.camera + del self.sceneManager + del self.frameListener + del self.CEGUISystem + del self.CEGUIRenderer + del self.root + del self.renderWindow + +class CEGUIFrameListener(GuiFrameListener): + + def __init__(self, renderWindow, camera, sceneManager): + GuiFrameListener.__init__(self, renderWindow, camera, sceneManager) + + self.keepRendering = True # whether to continue rendering or not + + # Subscribe handler to deal with user closing the frame window + try: + main_wnd = CEGUI.WindowManager.getSingleton().getWindow("Root/MainWindow") + main_wnd.subscribeEvent( + CEGUI.FrameWindow.EventCloseClicked, self, "handle_CloseButton") + + # if something goes wrong, log the issue but do not bomb! + except CEGUI.Exception, e: + print e + + def handle_CloseButton(self, args): + self.keepRendering = False + return True + + def frameStarted(self, evt): + if not self.keepRendering: + return False + else: + return GuiFrameListener.frameStarted(self,evt) + + +if __name__ == '__main__': + try: + ta = GEUIApplication() + ta.go() + except ogre.OgreException, e: + print e Added: trunk/python-ogre/demos/cegui/Demo_CEGUI_Falgard1v061.py =================================================================== --- trunk/python-ogre/demos/cegui/Demo_CEGUI_Falgard1v061.py (rev 0) +++ trunk/python-ogre/demos/cegui/Demo_CEGUI_Falgard1v061.py 2008-07-17 10:38:12 UTC (rev 662) @@ -0,0 +1,283 @@ +#/*************************************************************************** +# * Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team +# * +# * Permission is hereby granted, free of charge, to any person obtaining +# * a copy of this software and associated documentation files (the +# * "Software"), to deal in the Software without restriction, including +# * without limitation the rights to use, copy, modify, merge, publish, +# * distribute, sublicense, and/or sell copies of the Software, and to +# * permit persons to whom the Software is furnished to do so, subject to +# * the following conditions: +# * +# * The above copyright notice and this permission notice shall be +# * included in all copies or substantial portions of the Software. +# * +# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# * OTHER DEALINGS IN THE SOFTWARE. +# ***************************************************************************/ + + +import sys +sys.path.insert(0,'..') +import PythonOgreConfig + +import ogre.renderer.OGRE as ogre +import ogre.io.OIS as OIS +import ogre.gui.CEGUI as CEGUI +import SampleFramework + +from CEGUI_framework import * + + +def cegui_reldim ( x ) : + return CEGUI.UDim((x),0) + +def ceguimax ( x, y ) : + if x>y: return x + return y +def ceguimin ( x, y ) : + if x<y: return x + return y + + + + +class DemoConsole(): + + SubmitButtonID = 1 + EntryBoxID = 2 + HistoryID = 3 + + def __init__(self, id_name, parent=None): + + d_root = CEGUI.WindowManager.getSingleton().loadWindowLayout("VanillaConsole.layout", id_name, 'General') + self.d_historyPos = 0 + self.d_root = d_root + self.d_history = [] + + # we will destroy the console box windows ourselves + d_root.setDestroyedByParent(False) + + + + # Do events wire-up + d_root.subscribeEvent( + CEGUI.Window.EventKeyDown, self, "handleKeyDown") + + d_root.getChild(self.SubmitButtonID).subscribeEvent( + CEGUI.PushButton.EventClicked, self, "handleSubmit") + d_root.getChild(self.EntryBoxID).subscribeEvent( + CEGUI.Editbox.EventTextAccepted, self, "handleSubmit") + + # decide where to attach the console main window + def attachTo(parent, sheet): + if parent : return parent + return sheet + + parent = attachTo(parent , CEGUI.System.getSingleton().getGUISheet() ) + + # attach this window if parent is valid + if parent: + parent.addChildWindow(d_root) + + + def __del__(self): + # destroy the windows that we loaded earlier + CEGUI.WindowManager.getSingleton().destroyWindow(self.d_root) + self.d_root = 0 + + + def toggleVisibility(self): + if self.d_root.isVisible(True): + self.d_root.hide() + else: + self.d_root.show() + + + def isVisible(self): + return self.d_root.isVisible() + + def handleSubmit(self, args): + + # get the text entry editbox + editbox = self.d_root.getChild(self.EntryBoxID) + + # get text out of the editbox + edit_text = editbox.getText() + + # if the string is not empty + if len(edit_text.c_str())>0: + # add this entry to the command history buffer + self.d_history.append(edit_text) + # reset history position + self.d_historyPos = len(self.d_history) + # append newline to this entry + edit_text += '\n' + # get history window + history = self.d_root.getChild(self.HistoryID) + print dir(history) + # append new text to history output + history.setText(history.getText() + edit_text) + # scroll to bottom of history output + history.setCaratIndex(-1) + # erase text in text entry box. + editbox.setText("") + + # re-activate the text entry box + editbox.activate() + + return True + + def handleKeyDown(self, args): + + # get the text entry editbox + editbox = self.d_root.getChild(self.EntryBoxID) + + if args.scancode == CEGUI.Key.ArrowUp : + self.d_historyPos = ceguimax(self.d_historyPos - 1, -1) + if self.d_historyPos >= 0: + editbox.setText(self.d_history[self.d_historyPos]) + editbox.setCaratIndex(-1) + else: + editbox.setText("") + editbox.activate() + + elif args.scancode == CEGUI.Key.ArrowDown : + self.d_historyPos = ceguimin(self.d_historyPos + 1, len(self.d_history) ) + if self.d_historyPos < len(self.d_history): + editbox.setText(self.d_history[self.d_historyPos]) + editbox.setCaratIndex(-1) + else: + editbox.setText("") + + editbox.activate() + + else: + return False + + return True + + +class GEUIApplication(SampleFramework.Application): + + def __init__(self): + SampleFramework.Application.__init__(self) + self.CEGUIRenderer = 0 + self.CEGUISystem = 0 + self.d_console = None + + def _createScene(self): + + sceneManager = self.sceneManager + sceneManager.ambientLight = ogre.ColourValue(0.25, 0.25, 0.25) + + # initiaslise OgreCEGUI Renderer + + self.CEGUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderWindow, + ogre.RenderQueueGroupID.RENDER_QUEUE_OVERLAY, + False, 3000, + self.sceneManager) + self.CEGUISystem = CEGUI.System(self.CEGUIRenderer) + + ## set the logging level + CEGUI.Logger.getSingleton().loggingLevel = CEGUI.Insane + + ## we will make extensive use of the WindowManager. + winMgr = CEGUI.WindowManager.getSingleton() + + # Load the scheme to initialse the VanillaSkin which we use in this sample + CEGUI.SchemeManager.getSingleton().loadScheme("VanillaSkin.scheme") + # set default mouse image + CEGUI.System.getSingleton().setDefaultMouseCursor("Vanilla-Images", "MouseArrow") + + # load an image to use as a background + CEGUI.ImagesetManager.getSingleton().createImagesetFromImageFile("BackgroundImage", "GPN-2000-001437.tga") + + # here we will use a StaticImage as the root, then we can use + # it to place a background image + background = winMgr.createWindow("Vanilla/StaticImage") + # set area rectangle + background.setArea(CEGUI.URect(cegui_reldim(0), cegui_reldim(0), + cegui_reldim(1), cegui_reldim(1))) + # disable frame and standard background + background.setProperty("FrameEnabled", "false") + background.setProperty("BackgroundEnabled", "false") + # set the background image + background.setProperty("Image", "set:BackgroundImage image:full_image") + # install this as the root GUI sheet + CEGUI.System.getSingleton().setGUISheet(background) + + if not CEGUI.FontManager.getSingleton().isFontPresent("Iconified-12"): + CEGUI.FontManager.getSingleton().createFont("Iconified-12.font") + + # load some demo windows and attach to the background 'root' + background.addChildWindow(winMgr.loadWindowLayout("VanillaWindows.layout", False)) + + # create an instance of the console class. + self.d_console = DemoConsole("Demo") + + # listen for key presses on the root window. + background.subscribeEvent( + CEGUI.Window.EventKeyDown, + self, 'handleRootKeyDown') + + # activate the background window + background.activate() + + def handleRootKeyDown(self, args): + keyArgs = args + + if keyArgs.scancode == CEGUI.Key.F12: + self.d_console.toggleVisibility() + + else: + return False + return True + + + + def _createCamera(self): + self.camera = self.sceneManager.createCamera("PlayerCam") + self.camera.nearClipDistance = 5 + + def _createFrameListener(self): + self.frameListener = CEGUIFrameListener(self.renderWindow, self.camera, self.sceneManager) + self.root.addFrameListener(self.frameListener) + self.frameListener.showDebugOverlay(True) + + def cleanUp(self): + print "Cleaning Up" + del self.d_console + + def __del__(self): + "Clear variables, this is needed to ensure the correct order of deletion" + del self.camera + del self.sceneManager + del self.frameListener + del self.CEGUISystem + del self.CEGUIRenderer + del self.root + del self.renderWindow + +class CEGUIFrameListener(GuiFrameListener): + + def __init__(self, renderWindow, camera, sceneManager): + GuiFrameListener.__init__(self, renderWindow, camera, sceneManager) + self.MenuMode=True + self.keepRendering = True # whether to continue rendering or not + + + +if __name__ == '__main__': + try: + ta = GEUIApplication() + ta.go() + ta.cleanUp() + except ogre.OgreException, e: + print e + Added: trunk/python-ogre/demos/cegui/Demo_CEGUI_FirstWindowv061.py =================================================================== --- trunk/python-ogre/demos/cegui/Demo_CEGUI_FirstWindowv061.py (rev 0) +++ trunk/python-ogre/demos/cegui/Demo_CEGUI_FirstWindowv061.py 2008-07-17 10:38:12 UTC (rev 662) @@ -0,0 +1,273 @@ +#/*************************************************************************** +# * Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team +# * +# * Permission is hereby granted, free of charge, to any person obtaining +# * a copy of this software and associated documentation files (the +# * "Software"), to deal in the Software without restriction, including +# * without limitation the rights to use, copy, modify, merge, publish, +# * distribute, sublicense, and/or sell copies of the Software, and to +# * permit persons to whom the Software is furnished to do so, subject to +# * the following conditions: +# * +# * The above copyright notice and this permission notice shall be +# * included in all copies or substantial portions of the Software. +# * +# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# * OTHER DEALINGS IN THE SOFTWARE. +# ***************************************************************************/ + + +import sys +sys.path.insert(0,'..') +import PythonOgreConfig + +import ogre.renderer.OGRE as ogre +import ogre.io.OIS as OIS +import ogre.gui.CEGUI as CEGUI +import SampleFramework + +from CEGUI_framework import * + + + +def cegui_reldim ( x ) : + return CEGUI.UDim((x),0) + +class GEUIApplication(SampleFramework.Application): + + def __init__(self): + SampleFramework.Application.__init__(self) + self.CEGUIRenderer = 0 + self.CEGUISystem = 0 + self.MenuMode = True + self.menuItems = [] + + def _createScene(self): + + sceneManager = self.sceneManager + sceneManager.ambientLight = ogre.ColourValue(0.25, 0.25, 0.25) + + # initiaslise OgreCEGUI Renderer + ## Parameters are: + ## a) OgreRenderWindow object. + ## b) param post_queue + ## set to True to have GUI rendered after render queue + ## queue_id, or False to have the GUI rendered before + ## render queue + ## c) render queue_id. + ## where ogre.RenderQueueGroupID.RENDER_QUEUE_OVERLAY indicates + ## ceguiogre window is rendered above all else + ## d) param max_quads + ## obsolete + ## e) sceneManager + + self.CEGUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderWindow, + ogre.RenderQueueGroupID.RENDER_QUEUE_OVERLAY, + False, 3000, + self.sceneManager) + + ## Note it is also possible to initialise the OgreCEGUI renderer + ## with out the scenemanager, e.g: + ## self.CEGUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderWindow, + ## ogre.RenderQueueGroupID.RENDER_QUEUE_OVERLAY, + ## False, 3000) + ## + ## However you must call setTargetSceneManager before rendering + ## self.CEGUIRenderer.setTargetSceneManager(self.sceneManager) + + self.CEGUISystem = CEGUI.System(self.CEGUIRenderer) + + ## set the logging level + CEGUI.Logger.getSingleton().loggingLevel = CEGUI.Insane + + ## CEGUI relies on various systems being set-up, so this is what we do + ## here first. + ## + ## Note that is is possible, and even usual, for most of these steps to + ## be done automatically via a "scheme" definition, or even from the + ## cegui.conf configuration file, however for completeness, and as an + ## example, virtually everything is being done manually in this example + ## code. + ## + ## Imagesets area a collection of named areas within a texture or image + ## file. Each area becomes an Image, and has a unique name by which it + ## can be referenced. This sample is using the TaharezLook widgets, and + ## these rely upon the TaharezLook Imageset; so we must load this in + ## before doing anything else. Note that the Imageset would normally be + ## specified as part of a scheme file, although as this example is + ## demonstrating, it is not a requirement. + ## + ## Load TaharezLook imageset by making use of the ImagesetManager + ## singleton. + + taharezImages = CEGUI.ImagesetManager.getSingleton().createImageset("TaharezLook.imageset") + + ## The next thing we do is to set a default mouse cursor image. This is + ## not strictly essential, although it is nice to always have a visible + ## cursor if a window or widget does not explicitly set one of its own. + ## + ## The TaharezLook Imageset contains an Image named "MouseArrow" + ## which is the ideal thing to have as a defult mouse cursor image. + + CEGUI.System.getSingleton().setDefaultMouseCursor(taharezImages.getImage("MouseArrow")) + + + ## Now we have the gui imagery side of thigs set up, we should load + ## in a font. + ## You should always load in at least one font, this is to ensure + ## that there is a default available for any gui element which + ## needs to draw text. + ## The first font you load is automatically set as the initial + ## default font, although you can change the default later on + ## if so desired. Again, it is possible to list fonts to be + ## automatically loaded as part of a scheme, so + ## this step may not usually be performed explicitly. + ## + ## Fonts are loaded via the FontManager singleton. + + CEGUI.FontManager.getSingleton().createFont("Commonwealth-10.font") + + ## The widgets that we will be using for this sample are the + ## TaharezLook widgets, + ## and to enable us to use this 'skin' we must load the xml + ## specification - which within cegui is known as a "looknfeel" file. + ## + ## We load the looknfeel via the WidgetLookManager singleton. + + CEGUI.WidgetLookManager.getSingleton().parseLookNFeelSpecification("TaharezLook.looknfeel") + + + ## The final step of basic initialisation that is usually peformed is + ## registering some widgets with the system via a scheme file. + ## The scheme basically states the name of a dynamically loaded module + ## that contains the widget classes that we wish to use. + ## As stated previously, a scheme can actually conatin much more + ## information, though for the sake of this first example, we + ## load a scheme which only contains what is required to register + ## some widgets. + ## + ## Use the SchemeManager singleton to load in a scheme that + ## registers widgets, for TaharezLook. + + CEGUI.SchemeManager.getSingleton().loadScheme("TaharezLookWidgets.scheme") + + + ## Now the system is initialised, we can actually create some + ## UI elements, for this first example, a full-screen 'root' window + ## is set as the active GUI sheet, and then a simple frame window + ## will be created and attached to it. + + ## All windows and widgets are created via the WindowManager singleton. + + winMgr = CEGUI.WindowManager.getSingleton() + + ## Here we create a "DeafultWindow". This is a native type, that is, + ## it does not have to be loaded via a scheme, it is always available. + ## One common use for the DefaultWindow is as a generic container for + ## other windows. Its size defaults to 1.0 x 1.0 using the Relative + ## metrics mode, which means when it is set as the root GUI sheet + ## window, it will cover the entire display. + ## The DefaultWindow does not perform any rendering of its own, + ## so is invisible. + ## + ## Create a DefaultWindow called 'Root'. + + root = winMgr.createWindow("DefaultWindow", "Root") + + # set the GUI root window (also known as the GUI "sheet"), + # so the gui we set up will be visible. + + CEGUI.System.getSingleton().setGUISheet(root) + + ## A FrameWindow is a window with a frame and a titlebar which + ## may be moved around and resized. + ## + ## Create a FrameWindow in the TaharezLook style, and name it + ## 'Demo Window' + + wnd = winMgr.createWindow("TaharezLook/FrameWindow", "Demo Window") + + ## Here we attach the newly created FrameWindow to the previously + ## created DefaultWindow which we will be using as the root of the + ## displayed gui. + + root.addChildWindow(wnd) + + ## Windows are in Relative metrics mode by default. This means that + ## we can specify sizes and positions without having to know the + ## exact pixel size of the elements in advance. The relative + ## metrics mode co-ordinates are relative to the parent of the + ## window where the co-ordinates are being set. + ## This means that if 0.5 is specified as the width for a window, + ## that window will be half as its parent window. + ## + ## Here we set the FrameWindow so that it is half the size of + ## the display, and centered within the display. + ## Note that cegui_reldim in python is a convenience method specified + ## at the strat of this program + + wnd.setPosition(CEGUI.UVector2( cegui_reldim(0.25), + cegui_reldim(0.25))) + wnd.setSize(CEGUI.UVector2( cegui_reldim(0.5), + cegui_reldim(0.5))) + + ## now we set the maximum and minum sizes for the new window. + ## These are specified using relative co-ordinates, but the + ## important thing to note is that these settings are aways + ## relative to the display rather than the parent window. + ## + ## here we set a maximum size for the FrameWindow which is + ## equal to the size of the display, and a minimum size of + ##one tenth of the display. + + wnd.setMaxSize(CEGUI.UVector2( cegui_reldim( 1.0), + cegui_reldim( 1.0))) + wnd.setMinSize(CEGUI.UVector2( cegui_reldim( 0.1), + cegui_reldim( 0.1))) + + ## As a final step in the initialisation of our sample window, + ## we set the window's text to "Hello World!", so that this text + ## will appear as the caption in the FrameWindow's titlebar. + wnd.setText("Hello World!") + + + def _createCamera(self): + self.camera = self.sceneManager.createCamera("PlayerCam") + self.camera.nearClipDistance = 5 + + def _createFrameListener(self): + self.frameListener = CEGUIFrameListener(self.renderWindow, self.camera, self.sceneManager) + self.root.addFrameListener(self.frameListener) + self.frameListener.showDebugOverlay(True) + + def __del__(self): + "Clear variables, this is needed to ensure the correct order of deletion" + del self.camera + del self.sceneManager + del self.frameListener + del self.CEGUISystem + del self.CEGUIRenderer + del self.root + del self.renderWindow + +class CEGUIFrameListener(GuiFrameListener): + + def __init__(self, renderWindow, camera, sceneManager): + GuiFrameListener.__init__(self, renderWindow, camera, sceneManager) + self.MenuMode=True + + def frameStarted(self, evt): + return GuiFrameListener.frameStarted(self,evt) + + +if __name__ == '__main__': + try: + ta = GEUIApplication() + ta.go() + except ogre.OgreException, e: + print e Added: trunk/python-ogre/demos/cegui/Demo_CEGUI_FontDemov061.py =================================================================== --- trunk/python-ogre/demos/cegui/Demo_CEGUI_FontDemov061.py (rev 0) +++ trunk/python-ogre/demos/cegui/Demo_CEGUI_FontDemov061.py 2008-07-17 10:38:12 UTC (rev 662) @@ -0,0 +1,302 @@ +# -*- coding: utf-8 -*- + +#/*************************************************************************** +# * Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team +# * +# * Permission is hereby granted, free of charge, to any person obtaining +# * a copy of this software and associated documentation files (the +# * "Software"), to deal in the Software without restriction, including +# * without limitation the rights to use, copy, modify, merge, publish, +# * distribute, sublicense, and/or sell copies of the Software, and to +# * permit persons to whom the Software is furnished to do so, subject to +# * the following conditions: +# * +# * The above copyright notice and this permission notice shall be +# * included in all copies or substantial portions of the Software. +# * +# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# * OTHER DEALINGS IN THE SOFTWARE. +#/////# -*- coding: latin-1 -*- +# ***************************************************************************/ + + +import sys +sys.path.insert(0,'..') +import PythonOgreConfig + +import ogre.renderer.OGRE as ogre +import ogre.io.OIS as OIS +import ogre.gui.CEGUI as CEGUI +import SampleFramework + +from CEGUI_framework import * + + +def createUVector2( x, y): + return CEGUI.UVector2(CEGUI.UDim(x,0), CEGUI.UDim(y,0)) +def cegui_reldim ( x ) : + return CEGUI.UDim((x),0) + +def getFontDict(): + SCHEME_FONT = {} + SCHEME_FONT['Commonwealth-10'] = "Commonwealth-10.font" + SCHEME_FONT['BlueHighway-12'] = "bluehighway-12.font" + SCHEME_FONT['BlueHighway-10'] = "bluehighway-10.font" + SCHEME_FONT['BlueHighway-8'] = "bluehighway-8.font" + SCHEME_FONT['DejaVuSans-10'] = "DejaVuSans-10.font" + SCHEME_FONT['Commonwealth-10'] = "Commonwealth-10.font" + SCHEME_FONT['Iconified-12'] = "Iconified-12.font" + SCHEME_FONT['fkp-16'] = "fkp-16.font" + SCHEME_FONT['FairChar-30'] = "FairChar-30.font" + return SCHEME_FONT + + +def getLanguageDict(): + LANGUAGE_DICT = {} + LANGUAGE_DICT['English'] = "THIS IS SOME TEXT IN UPPERCASE\n and this is lowercase...\n Try Catching The Brown Fox While It's Jumping Over The Lazy Dog" + LANGUAGE_DICT['Russian'] = u"Всё ускоряющаяся эволюция компьютерных технологий предъявила жёсткие требования к производителям как собственно вычислительной техники, так и периферийных устройств.\n" + LANGUAGE_DICT['Romanian'] = u"CEI PATRU APOSTOLI\n au fost trei:\n Luca şi Matfei\n" + LANGUAGE_DICT['Danish'] = u"FARLIGE STORE BOGSTAVER\n og flere men små...\n Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen Walther spillede på xylofon\n" + LANGUAGE_DICT['French'] = u'La Peña' + return LANGUAGE_DICT + +global MIN_POINT_SIZE +MIN_POINT_SIZE=6.0 + + +class GEUIApplication(SampleFramework.Application): + + def __init__(self): + SampleFramework.Application.__init__(self) + self.CEGUIRenderer = 0 + self.CEGUISystem = 0 + self.MenuMode = True + self.ListItems = [] + + def _createScene(self): + + sceneManager = self.sceneManager + sceneManager.ambientLight = ogre.ColourValue(0.25, 0.25, 0.25) + + # initiaslise CEGUI Renderer + self.CEGUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderWindow, + ogre.RenderQueueGroupID.RENDER_QUEUE_OVERLAY, + False, 3000, + self.sceneManager) + + self.CEGUISystem = CEGUI.System(self.CEGUIRenderer) + CEGUI.Logger.getSingleton().loggingLevel = CEGUI.Insane + + winMgr = CEGUI.WindowManager.getSingleton() + + # load scheme and set up defaults + CEGUI.SchemeManager.getSingleton().loadScheme ("TaharezLook.scheme") + CEGUI.System.getSingleton().setDefaultMouseCursor ("TaharezLook", "MouseArrow") + + # load all the fonts except Commonwealth which has been already loaded + fontDict = getFontDict() + for f in fontDict.keys(): + if not CEGUI.FontManager.getSingleton().isFontPresent(f): + CEGUI.FontManager.getSingleton().createFont(fontDict[f]) + + + # load an image to use as a background + CEGUI.ImagesetManager.getSingleton().createImagesetFromImageFile("BackgroundImage", "GPN-2000-001437.tga") + + # here we will use a StaticImage as the root, then we + # can use it to place a background image + background = winMgr.createWindow ("TaharezLook/StaticImage") + # set area rectangle + background.setArea (CEGUI.URect(cegui_reldim (0), cegui_reldim (0), + cegui_reldim (1), cegui_reldim (1))) + # disable frame and standard background + background.setProperty ("FrameEnabled", "false") + background.setProperty ("BackgroundEnabled", "false") + # set the background image + background.setProperty ("Image", "set:BackgroundImage image:full_image") + # install this as the root GUI sheet + CEGUI.System.getSingleton().setGUISheet (background) + + #/ set tooltip styles (by default there is none) + CEGUI.System.getSingleton().setDefaultTooltip ("TaharezLook/Tooltip") + + # load some demo windows and attach to the background 'root' + background.addChildWindow (winMgr.loadWindowLayout ("FontDemo.layout", False)) + + # Add the font names to the listbox + fontDict = getFontDict() + lbox = winMgr.getWindow ("FontDemo/FontList") + for f in fontDict.keys(): + item = CEGUI.ListboxTextItem(f) + item.setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush") + # ensure Python is in control of it's "deletion" + item.AutoDeleted = False + lbox.addItem( item) + self.ListItems.append(item) + + # set up the font listbox callback + lbox.subscribeEvent( + CEGUI.Listbox.EventSelectionChanged, self, "handleFontSelection") + # select the first font + lbox.setItemSelectState(0, True) + + # Add language list to the listbox + lbox = winMgr.getWindow ("FontDemo/LangList") + languageDict = getLanguageDict() + for l in languageDict.keys(): + item = CEGUI.ListboxTextItem(l) + item.setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush") + # ensure Python is in control of it's "deletion" + item.AutoDeleted = False + lbox.addItem( item) + self.ListItems.append(item) + + # set up the language listbox callback + lbox.subscribeEvent( + CEGUI.Listbox.EventSelectionChanged, self, "handleLangSelection") + # select the first language + lbox.setItemSelectState(0, True) + + winMgr.getWindow("FontDemo/AutoScaled").subscribeEvent( + CEGUI.Checkbox.EventCheckStateChanged, + self, 'handleAutoScaled') + winMgr.getWindow("FontDemo/Antialiased").subscribeEvent ( + CEGUI.Checkbox.EventCheckStateChanged, + self, 'handleAntialiased') + winMgr.getWindow("FontDemo/PointSize").subscribeEvent ( + CEGUI.Scrollbar.EventScrollPositionChanged, + self, 'handlePointSize') + + + + ## Event Handlers ## + def setFontDesc(self): + winMgr = CEGUI.WindowManager.getSingleton() + mle = winMgr.getWindow("FontDemo/FontSample") + f = mle.getFont() + s = f.getProperty("Name") + if f.isPropertyPresent("PointSize"): + s += "." + f.getProperty("PointSize") + winMgr.getWindow("FontDemo/FontDesc").setText(s) + + def handleFontSelection(self,e): + lbox = e.window + if lbox.getFirstSelectedItem(): + f = CEGUI.FontManager.getSingleton().getFont( + lbox.getFirstSelectedItem().getText()) + + winMgr = CEGUI.WindowManager.getSingleton() + winMgr.getWindow("FontDemo/FontSample").setFont(f) + b = f.isPropertyPresent("AutoScaled") + cb = winMgr.getWindow("FontDemo/AutoScaled") + cb.setEnabled(b) + if b: + cb.setSelected(CEGUI.PropertyHelper.stringToBool(f.getProperty ("AutoScaled"))) + + b = f.isPropertyPresent("Antialiased") + cb = winMgr.getWindow("FontDemo/Antialiased") + cb.setEnabled (b) + if b: + cb.setSelected(CEGUI.PropertyHelper.stringToBool(f.getProperty ("Antialiased"))) + + b = f.isPropertyPresent ("PointSize") + sb = winMgr.getWindow("FontDemo/PointSize") + sb.setEnabled(b) + if b: + sb.setScrollPosition ( CEGUI.PropertyHelper.stringToFloat(f.getProperty("PointSize")) - MIN_POINT_SIZE) + + self.setFontDesc() + + return True + + + def handleAutoScaled (self, e): + winMgr = CEGUI.WindowManager.getSingleton() + cb = e.window + mle = winMgr.getWindow("FontDemo/FontSample") + f = mle.getFont() + f.setProperty("AutoScaled", + CEGUI.PropertyHelper.boolToString(cb.isSelected())) + + return True + + + def handleAntialiased(self, e): + winMgr = CEGUI.WindowManager.getSingleton() + cb = e.window + mle = winMgr.getWindow("FontDemo/FontSample") + f = mle.getFont() + f.setProperty ("Antialiased", + CEGUI.PropertyHelper.boolToString(cb.isSelected())) + + return True + + def handlePointSize(self, e): + winMgr = CEGUI.WindowManager.getSingleton() + sb = e.window + f = winMgr.getWindow("FontDemo/FontSample").getFont() + f.setProperty ("PointSize", + CEGUI.PropertyHelper.intToString ( + int(MIN_POINT_SIZE + sb.getScrollPosition ()))) + self.setFontDesc() + + return True + + def handleLangSelection(self, e): + lbox = e.window + if lbox.getFirstSelectedItem(): + idx = lbox.getItemIndex(lbox.getFirstSelectedItem()) + winMgr = CEGUI.WindowManager.getSingleton() + + cs = CEGUI.String() + cs.assign( getLanguageDict().values()[idx].encode("utf-8") ) + winMgr.getWindow("FontDemo/FontSample").setText(cs) + + return True + + + def _createCamera(self): + self.camera = self.sceneManager.createCamera("PlayerCam") + self.camera.nearClipDistance = 5 + + def _createFrameListener(self): + self.frameListener = CEGUIFrameListener(self.renderWindow, self.camera, self.sceneManager) + self.root.addFrameListener(self.frameListener) + self.frameListener.showDebugOverlay(True) + + def __del__(self): + "Clear variables, this is needed to ensure the correct order of deletion" + del self.camera + del self.sceneManager + del self.frameListener + del self.CEGUISystem + del self.CEGUIRenderer + del self.root + del self.renderWindow + +class CEGUIFrameListener(GuiFrameListener): + + def __init__(self, renderWindow, camera, sceneManager): + GuiFrameListener.__init__(self, renderWindow, camera, sceneManager) + + self.keepRendering = True # whether to continue rendering or not + + + def frameStarted(self, evt): + if not self.keepRendering: + return False + else: + return GuiFrameListener.frameStarted(self,evt) + + +if __name__ == '__main__': + try: + ta = GEUIApplication() + ta.go() + except ogre.OgreException, e: + print e Added: trunk/python-ogre/demos/cegui/Demo_CEGUI_ScrollablePanev061.py =================================================================== --- trunk/python-ogre/demos/cegui/Demo_CEGUI_ScrollablePanev061.py (rev 0) +++ trunk/python-ogre/demos/cegui/Demo_CEGUI_ScrollablePanev061.py 2008-07-17 10:38:12 UTC (rev 662) @@ -0,0 +1,252 @@ +#/*************************************************************************** +# * Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team +# * +# * Permission is hereby granted, free of charge, to any person obtaining +# * a copy of this software and associated documentation files (the +# * "Software"), to deal in the Software without restriction, including +# * without limitation the rights to use, copy, modify, merge, publish, +# * distribute, sublicense, and/or sell copies of the Software, and to +# * permit persons to whom the Software is furnished to do so, subject to +# * the following conditions: +# * +# * The above copyright notice and this permission notice shall be +# * included in all copies or substantial portions of the Software. +# * +# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# * OTHER DEALINGS IN THE SOFTWARE. +# ***************************************************************************/ + + +import sys +sys.path.insert(0,'..') +import PythonOgreConfig + +import ogre.renderer.OGRE as ogre +import ogre.io.OIS as OIS +import ogre.gui.CEGUI as CEGUI +import SampleFramework + +from CEGUI_framework import * + + +def createUVector2( x, y): + return CEGUI.UVector2(CEGUI.UDim(x,0), CEGUI.UDim(y,0)) + +# Handler for the 'Demo -> New dialog' menu item +def demoNewDialog(args): + # add a dialog to this pane so we have some more stuff to drag around :) + dlg = CEGUI.WindowManager.getSingletonPtr().createWindow("WindowsLook/FrameWindow") + dlg.setMinSize(CEGUI.UVector2(CEGUI.UDim(0,200),CEGUI.UDim(0,100))) + dlg.setText("Drag me around too!") + + # we put this in the center of the viewport into the scrollable pane + uni_center = CEGUI.UVector2( CEGUI.UDim(0.5,0), CEGUI.UDim(0.5,0) ) + d_root = CEGUI.WindowManager.getSingletonPtr().getWindow("RootWindow") + d_pane = CEGUI.WindowManager.getSingletonPtr().getWindow("DialogPane") + + center = CEGUI.CoordConverter.windowToScreen(d_root, uni_center) + target = CEGUI.CoordConverter.screenToWindow(d_pane.getContentPane(), center) + dlg.setPosition(CEGUI.UVector2( CEGUI.UDim(0,target.d_x-100), + CEGUI.UDim(0,target.d_y-50))) + + d_pane.addChildWindow(dlg) + + return True + +#Handler for global hotkeys +def hotkeysHandler(e): + k = e + if k.scancode == CEGUI.Key.Space: + # space is a hotkey for demo -> new dialog + # this handler does not use the event args at all so this is fine :) + # though maybe a bit hackish... + demoNewDialog(e) + else: + return False + return True + +class GEUIApplication(SampleFramework.Application): + + def __init__(self): + SampleFramework.Application.__init__(self) + self.CEGUIRenderer = 0 + self.CEGUISystem = 0 + self.menuItems = [] + + def _createScene(self): + + sceneManager = self.sceneManager + sceneManager.ambientLight = ogre.ColourValue(0.25, 0.25, 0.25) + + # initiaslise CEGUI Renderer + self.CEGUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderWindow, + ogre.Rende... [truncated message content] |
From: <mi...@us...> - 2008-07-22 09:50:58
|
Revision: 665 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=665&view=rev Author: mithro Date: 2008-07-22 09:51:07 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Fixed boost_python_index for non-deb builds. Modified Paths: -------------- trunk/python-ogre/boost/debian/rules trunk/python-ogre/environment.py Added Paths: ----------- trunk/python-ogre/boost/Makefile Added: trunk/python-ogre/boost/Makefile =================================================================== --- trunk/python-ogre/boost/Makefile (rev 0) +++ trunk/python-ogre/boost/Makefile 2008-07-22 09:51:07 UTC (rev 665) @@ -0,0 +1,25 @@ + +export GCC_VERSION=`gcc --version | head -1 | sed -e's/.*) \([0-9]\)\.\([0-9]\).*/\1\2/'` +export PYTHON_VERSION=`python -V 2>&1 | sed -e's/Python \(2\.[45]\).*/\1/'` + +all: libs/python/src/indexing/indexing_slice.cpp libs/python/src/indexing/python_iterator.cpp + g++ $? \ + -I . \ + -I /usr/include/python${PYTHON_VERSION} \ + -shared -Wl,-soname,libboost_python_index-gcc${GCC_VERSION}-1_34_1.so -o libboost_python_index-gcc${GCC_VERSION}-1_34_1.so -fPIC \ + -lboost_python \ + -lpython${PYTHON_VERSION} + +install: + mkdir -p ${PREFIX}/usr/lib + cp libboost_python_index-gcc${GCC_VERSION}-1_34_1.so ${PREFIX}/usr/lib + ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-1_34_1.so ${PREFIX}/usr/lib/libboost_python_index.so + + mkdir -p ${PREFIX}/usr/include + cp -rvf boost ${PREFIX}/usr/include + rm -rf `find ${PREFIX}/usr/include -name .svn -type d` + +clean: + rm *.so + +.PHONY: install clean Modified: trunk/python-ogre/boost/debian/rules =================================================================== --- trunk/python-ogre/boost/debian/rules 2008-07-22 04:45:24 UTC (rev 664) +++ trunk/python-ogre/boost/debian/rules 2008-07-22 09:51:07 UTC (rev 665) @@ -8,7 +8,9 @@ # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 +export DH_COMPAT=2 export GCC_VERSION=`gcc --version | head -1 | sed -e's/.*) \([0-9]\)\.\([0-9]\).*/\1\2/'` +export PYTHON_VERSION=`python -V 2>&1 | sed -e's/Python \(2\.[45]\).*/\1/'` # shared library versions, option 1 #version=2.0.5 @@ -23,25 +25,15 @@ configure-stamp: dh_testdir # Add here commands to configure the package. - + touch configure-stamp - build: build-stamp build-stamp: configure-stamp dh_testdir - - - # Add here commands to compile the package. - g++ \ - ./libs/python/src/indexing/indexing_slice.cpp \ - ./libs/python/src/indexing/python_iterator.cpp \ - -I . \ - -I /usr/include/python2.5 \ - -shared -Wl,-soname,libboost_python_index-gcc${GCC_VERSION}-1_34_1.so -o libboost_python_index-gcc${GCC_VERSION}-1_34_1.so -fPIC \ - -lboost_python \ - -lpython2.5 - + + make all + touch $@ clean: @@ -51,7 +43,7 @@ # Add here commands to clean up after the build process. rm *.so || true - + dh_clean install: build @@ -59,17 +51,10 @@ dh_testroot dh_clean -k dh_installdirs - + # Add here commands to install the package into debian/tmp - mkdir -p $(CURDIR)/debian/tmp/usr/lib - cp libboost_python_index-gcc${GCC_VERSION}-1_34_1.so $(CURDIR)/debian/tmp/usr/lib - ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-1_34_1.so $(CURDIR)/debian/tmp/usr/lib/libboost_python_index.so + PREFIX=$(CURDIR)/debian/tmp make install - mkdir -p $(CURDIR)/debian/tmp/usr/include - cp -rvf boost $(CURDIR)/debian/tmp/usr/include - rm -rf `find $(CURDIR)/debian/tmp/usr/include -name .svn -type d` - - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -84,7 +69,7 @@ dh_movefiles -plibboost-python1.34.1-index-dev /usr/include/boost dh_movefiles -plibboost-python1.34.1-index /usr/lib - + # dh_install # dh_installmenu # dh_installdebconf Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-07-22 04:45:24 UTC (rev 664) +++ trunk/python-ogre/environment.py 2008-07-22 09:51:07 UTC (rev 665) @@ -528,8 +528,10 @@ ["rm","-rf %s" % (base,), os.getcwd()], ["cp",'-rvf %s/ %s' % (os.path.join('python-ogre','boost'), base), os.getcwd()], ] - # FIXME: This should have build commands! - buildCmds = [] + buildCmds = [ + [0,'make all', os.path.join(os.getcwd(), base)], + [0,'PREFIX=%s make install' % PREFIX, os.path.join(os.getcwd(), base)], + ] lib = boost.lib.replace("python", "python_index") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mi...@us...> - 2008-07-23 10:04:31
|
Revision: 670 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=670&view=rev Author: mithro Date: 2008-07-23 10:04:31 +0000 (Wed, 23 Jul 2008) Log Message: ----------- More fixes to OgreAL. Modified Paths: -------------- trunk/python-ogre/code_generators/ogreal/generate_code.py trunk/python-ogre/debian/changelog trunk/python-ogre/debian/rules trunk/python-ogre/demos/ogreal/Demo_AL_01.py Modified: trunk/python-ogre/code_generators/ogreal/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogreal/generate_code.py 2008-07-23 06:12:17 UTC (rev 669) +++ trunk/python-ogre/code_generators/ogreal/generate_code.py 2008-07-23 10:04:31 UTC (rev 670) @@ -107,7 +107,14 @@ context = main_ns.decl("ALCcontext_struct") context.opaque = True - + + # These symbols are missing from the lib even though they are defined in + # the header file! + main_ns.decl("alSource3i").exclude() + main_ns.decl("alSourceiv").exclude() + main_ns.decl("alGetSource3i").exclude() + main_ns.decl("alGetSourceiv").exclude() + ############################################################ ## ## And things that need to have their argument and call values fixed. @@ -304,9 +311,9 @@ ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. -# common_utils.copyTree ( sourcePath = environment.Config.PATH_Config.PATH_OGREAL, -# destPath = environment.ogreal.generated_dir, -# recursive=False ) + common_utils.copyTree ( sourcePath = environment.Config.PATH_OGREAL, + destPath = environment.ogreal.generated_dir, + recursive=False ) if __name__ == '__main__': start_time = time.clock() Modified: trunk/python-ogre/debian/changelog =================================================================== --- trunk/python-ogre/debian/changelog 2008-07-23 06:12:17 UTC (rev 669) +++ trunk/python-ogre/debian/changelog 2008-07-23 10:04:31 UTC (rev 670) @@ -1,3 +1,13 @@ +python-ogre (0.0.0-4) unstable; urgency=low + + * Fixed ogreal to link against boost_python_index. + + -- Tim 'Mithro' Ansell <mi...@mi...> Wed, 23 Jul 2008 16:13:51 +1000 +python-ogre (0.0.0-3) unstable; urgency=low + + * Really fixed the CEGUI.loadWindowLayout method (now with defaults!). + + -- Tim 'Mithro' Ansell <mi...@mi...> Wed, 16 Jul 2008 18:19:51 +1000 python-ogre (0.0.0-2) unstable; urgency=low * Fixed the CEGUI.loadWindowLayout method. Modified: trunk/python-ogre/debian/rules =================================================================== --- trunk/python-ogre/debian/rules 2008-07-23 06:12:17 UTC (rev 669) +++ trunk/python-ogre/debian/rules 2008-07-23 10:04:31 UTC (rev 670) @@ -26,7 +26,7 @@ LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c et LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c plib LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c ogreforests -# LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c ogreal + LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c ogreal LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c watermesh touch $@ Modified: trunk/python-ogre/demos/ogreal/Demo_AL_01.py =================================================================== --- trunk/python-ogre/demos/ogreal/Demo_AL_01.py 2008-07-23 06:12:17 UTC (rev 669) +++ trunk/python-ogre/demos/ogreal/Demo_AL_01.py 2008-07-23 10:04:31 UTC (rev 670) @@ -135,7 +135,7 @@ OgreAL.SoundManager.getSingleton().getSound("Roar").play() - bgSound = self.soundManager.createSound("ZeroFactor", "Zero Factor - Untitled.ogg", True, True) + bgSound = self.soundManager.createSound("ZeroFactor", "6chan.ogg", True, True) node = sceneManager.getRootSceneNode().createChildSceneNode("CameraNode") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mi...@us...> - 2008-07-23 12:08:35
|
Revision: 673 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=673&view=rev Author: mithro Date: 2008-07-23 12:08:42 +0000 (Wed, 23 Jul 2008) Log Message: ----------- Added support for ffmpeg module. Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_system.py trunk/python-ogre/ThirdParty/ffmpeg/videoPlayer.h trunk/python-ogre/debian/changelog trunk/python-ogre/debian/control trunk/python-ogre/debian/rules Modified: trunk/python-ogre/PythonOgreConfig_system.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_system.py 2008-07-23 11:44:41 UTC (rev 672) +++ trunk/python-ogre/PythonOgreConfig_system.py 2008-07-23 12:08:42 UTC (rev 673) @@ -57,7 +57,7 @@ PATH_Bullet= os.path.join(BASE_DIR, 'bullet-2.66') ###PATH_PhysX= os.path.join(BASE_DIR, 'Physx/v2.7.3/SDKs') PATH_Theora= os.path.join(PATH_OgreAddons,'videoplugin','TheoraVideo') -PATH_ffmpeg= os.path.join(BASE_DIR, 'ffmpeg') +PATH_ffmpeg= os.path.join(BASE_DIR) #, 'ffmpeg') PATH_navi = os.path.join(BASE_DIR, 'navi','Navi') PATH_particleuniverse = os.path.join(PATH_Ogre, 'PlugIns', 'ParticleUniverse' ) PATH_cadunetree= os.path.join(PATH_THIRDPARTY, 'cadunetree') @@ -136,7 +136,7 @@ PATH_INCLUDE_TheoraDemo = os.path.join (PATH_Theora,'..', 'CEGUI_TheoraDemo','include') PATH_INCLUDE_ogrevideoffmpeg = PATH_ogrevideoffmpeg -PATH_INCLUDE_ffmpeg = os.path.join (PATH_ffmpeg,'include') +PATH_INCLUDE_ffmpeg = os.path.join (PATH_ffmpeg,'include', 'ffmpeg') PATH_INCLUDE_plib = PATH_plib PATH_INCLUDE_navi = os.path.join (PATH_navi,'include') PATH_INCLUDE_noise = PATH_noise Modified: trunk/python-ogre/ThirdParty/ffmpeg/videoPlayer.h =================================================================== --- trunk/python-ogre/ThirdParty/ffmpeg/videoPlayer.h 2008-07-23 11:44:41 UTC (rev 672) +++ trunk/python-ogre/ThirdParty/ffmpeg/videoPlayer.h 2008-07-23 12:08:42 UTC (rev 673) @@ -5,13 +5,13 @@ #include "Ogre.h" // // ffmpeg includes -// #include <ffmpeg/avcodec.h> -// #include <ffmpeg/avformat.h> extern "C" { #define __STDC_CONSTANT_MACROS #define __STDC_LIMIT_MACROS -#include <libavformat/avformat.h> -#include <libavcodec/avcodec.h> +#include <ffmpeg/avcodec.h> +#include <ffmpeg/avformat.h> +//#include <libavformat/avformat.h> +//#include <libavcodec/avcodec.h> } using namespace Ogre; Modified: trunk/python-ogre/debian/changelog =================================================================== --- trunk/python-ogre/debian/changelog 2008-07-23 11:44:41 UTC (rev 672) +++ trunk/python-ogre/debian/changelog 2008-07-23 12:08:42 UTC (rev 673) @@ -1,3 +1,8 @@ +python-ogre (0.0.0-5) unstable; urgency=low + + * Fixed the ffmpeg package. + + -- Tim 'Mithro' Ansell <mi...@mi...> Wed, 23 Jul 2008 22:06:51 +1000 python-ogre (0.0.0-4) unstable; urgency=low * Fixed ogreal to link against boost_python_index. Modified: trunk/python-ogre/debian/control =================================================================== --- trunk/python-ogre/debian/control 2008-07-23 11:44:41 UTC (rev 672) +++ trunk/python-ogre/debian/control 2008-07-23 12:08:42 UTC (rev 673) @@ -16,6 +16,7 @@ libceguiogre-dev (>= 1.4) | libogre-dev (<< 1.4.5), libogre-dev (< 1.5), libopenal-dev, libogg-dev, libvorbis-dev, + libavformat-dev, libavcodec-dev, gccxml (>=0.7.0), pygccxml, pyplusplus Standards-Version: 3.7.2 Modified: trunk/python-ogre/debian/rules =================================================================== --- trunk/python-ogre/debian/rules 2008-07-23 11:44:41 UTC (rev 672) +++ trunk/python-ogre/debian/rules 2008-07-23 12:08:42 UTC (rev 673) @@ -27,6 +27,7 @@ LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c plib LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c ogreforests LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c ogreal + LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c ogrevideoffmpeg LD_PRELOAD='' python BuildModule.py --usesystem --failhard -g -c watermesh touch $@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-07-28 06:56:49
|
Revision: 675 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=675&view=rev Author: andy_miller Date: 2008-07-28 06:56:57 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Minor change to windows build messages and Physx wrapper Modified Paths: -------------- trunk/python-ogre/code_generators/physx/python_physx_sizeof.h trunk/python-ogre/demos/theora/demo_video.py trunk/python-ogre/demos/theora/resources.cfg trunk/python-ogre/environment.py Modified: trunk/python-ogre/code_generators/physx/python_physx_sizeof.h =================================================================== --- trunk/python-ogre/code_generators/physx/python_physx_sizeof.h 2008-07-24 12:45:21 UTC (rev 674) +++ trunk/python-ogre/code_generators/physx/python_physx_sizeof.h 2008-07-28 06:56:57 UTC (rev 675) @@ -4,4 +4,10 @@ sizeof(_Nx3F32); sizeof(NxUserEntityReport<unsigned int>); sizeof(NxUserEntityReport<NxShape*>); +sizeof ( NxForceFieldShapeGroup ); +sizeof ( NxArray<NxForceFieldShapeGroup*, NxAllocatorDefault> ); +sizeof ( NxArray<NxShapeDesc*, NxAllocatorDefault> ); +sizeof ( NxArray<NxFluidEmitterDesc, NxAllocatorDefault> ); +sizeof ( NxArray<NxForceFieldShapeDesc*, NxAllocatorDefault> ); +sizeof ( _Nx3F32 ); Modified: trunk/python-ogre/demos/theora/demo_video.py =================================================================== --- trunk/python-ogre/demos/theora/demo_video.py 2008-07-24 12:45:21 UTC (rev 674) +++ trunk/python-ogre/demos/theora/demo_video.py 2008-07-28 06:56:57 UTC (rev 675) @@ -47,7 +47,7 @@ self.Control.setTextureTecPassStateLevel( 0, 0, 0 ) self.Control.setSeekEnabled( False ) - self.Control.setAutoAudioUpdate ( True ) +# self.Control.setAutoAudioUpdate ( True ) mat = ogre.MaterialManager.getSingleton().getByName("Example/TheoraVideoPlayer/Play") #Create the material the first time through this method @@ -97,6 +97,7 @@ ret = sf.FrameListener.frameStarted(self, frameEvent) if self.video and ret: self.video.blitFrameCheck() + self.video.getAudioDriver().autoUpdate() return ret Modified: trunk/python-ogre/demos/theora/resources.cfg =================================================================== --- trunk/python-ogre/demos/theora/resources.cfg 2008-07-24 12:45:21 UTC (rev 674) +++ trunk/python-ogre/demos/theora/resources.cfg 2008-07-28 06:56:57 UTC (rev 675) @@ -3,6 +3,7 @@ # Resource locations to be added to the default path [General] +FileSystem=. FileSystem=../media FileSystem=../media_extra Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-07-24 12:45:21 UTC (rev 674) +++ trunk/python-ogre/environment.py 2008-07-28 06:56:57 UTC (rev 675) @@ -849,7 +849,8 @@ ] buildCmds = [ [0, unzip + " " + os.path.join(downloadPath,base)+".zip", os.getcwd()], - [0, 'echo Please use MSVC to build the CEGUI Release project',''], + [0, 'echo Now run build_vs2008.bat from the CEGUI makefiles\premake directory',''], + [0, 'echo then use MSVC to build the CEGUI Release project',''], [0, 'echo WARNING - Check that RTTI is enabled in the compiler options',''], [0, 'echo Then ensure that OgreGUIRender is compiled with this version of CEGUI',''] ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-07-29 09:34:21
|
Revision: 676 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=676&view=rev Author: andy_miller Date: 2008-07-29 09:34:29 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Initial Implementation for the PCZ Portal Scene Manager Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/demos/theora/demo_video.py trunk/python-ogre/environment.py Added Paths: ----------- trunk/python-ogre/code_generators/ogrepcz/ trunk/python-ogre/code_generators/ogrepcz/customization_data.py trunk/python-ogre/code_generators/ogrepcz/generate_code.py trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz.h trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_aliases.h trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_sizeof.h Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-07-28 06:56:57 UTC (rev 675) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-07-29 09:34:29 UTC (rev 676) @@ -81,6 +81,7 @@ PATH_navi = os.path.join(BASE_DIR, 'navi', 'navi') PATH_particleuniverse = os.path.join(PATH_Ogre, 'PlugIns', 'ParticleUniverse' ) +PATH_ogrepcz = os.path.join(PATH_Ogre, 'PlugIns', 'PCZSceneManager' ) # it's time for the SDK version if SDK: @@ -174,6 +175,7 @@ ##PATH_INCLUDE_ogreforests = os.path.join (PATH_ogreforests,'include') PATH_INCLUDE_ogreforests = PATH_ogreforests PATH_INCLUDE_particleuniverse = os.path.join(PATH_particleuniverse, 'include' ) +PATH_INCLUDE_ogrepcz = os.path.join(PATH_ogrepcz,'include') PATH_INCLUDE_OggVorbisTheora = [ os.path.join(BASE_DIR,'ogg','include') ,os.path.join(BASE_DIR, 'vorbis', 'include') Added: trunk/python-ogre/code_generators/ogrepcz/customization_data.py =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/customization_data.py (rev 0) +++ trunk/python-ogre/code_generators/ogrepcz/customization_data.py 2008-07-29 09:34:29 UTC (rev 676) @@ -0,0 +1,17 @@ + +def header_files( version ): + return ["Ogre.h", + "OgrePortal.h", + "OgrePCZSceneNode.h", + "OgrePCZone.h", + "OgrePCZSceneManager.h", + "OgrePCZSceneQuery.h", + "OgrePCZLight.h", + "OgrePCPlane.h", + "OgrePCZFrustum.h" + + ] + +def huge_classes( version ): + return [] + \ No newline at end of file Added: trunk/python-ogre/code_generators/ogrepcz/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/generate_code.py (rev 0) +++ trunk/python-ogre/code_generators/ogrepcz/generate_code.py 2008-07-29 09:34:29 UTC (rev 676) @@ -0,0 +1,341 @@ +#!/usr/bin/env python +# ----------------------------------------------------------------------------- +# This source file is part of Python-MAIN_NAMESPACE and is covered by the LGPL +# For the latest info, see http://python-ogre.org/ +# +# ----------------------------------------------------------------------------- + +## STARTER TEMPLATE.. +## replace ogrepcz with lowercase project name +## set MAIN_NAMESPACE +## rename and configure .h files + + +import os, sys, time, shutil + +#add environment to the path +sys.path.append( os.path.join( '..', '..' ) ) +#add common utils to the pass +sys.path.append( '..' ) +sys.path.append( '.' ) + +import environment +import common_utils +import customization_data +import hand_made_wrappers + + +from pygccxml import parser +from pygccxml import declarations +from pyplusplus import messages +from pyplusplus import module_builder +from pyplusplus import decl_wrappers + +from pyplusplus import function_transformers as ft +from pyplusplus.module_builder import call_policies +from pyplusplus.module_creator import sort_algorithms + +import common_utils.extract_documentation as exdoc +import common_utils.var_checker as varchecker +import common_utils.ogre_properties as ogre_properties +from common_utils import docit + +MAIN_NAMESPACE = 'Ogre' + +############################################################ +## +## Here is where we manually exclude stuff +## +############################################################ + +def ManualExclude ( mb ): + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + excludes=['::Ogre::PCZCamera', + '::Ogre::PCZSceneManagerFactory' + ] + for e in excludes: + main_ns.class_(e).exclude() + print "Excluded Class:", e + + excludes=['::Ogre::PCZSceneManagerFactory::initMetaData', + '::Ogre::PCZSceneManagerFactory::createInstance', + '::Ogre::PCZSceneManagerFactory::destroyInstance' + ] + for e in excludes: + main_ns.member_functions(e).exclude() + print "Excluded Member Function:", e + + excludes=['::Ogre::PCZSceneManagerFactory::FACTORY_TYPE_NAME' + ] + for e in excludes: + main_ns.variable(e).exclude() + print "Excluded Variable:", e + +############################################################ +## +## And there are things that manually need to be INCLUDED +## +############################################################ + +def ManualInclude ( mb ): + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + +############################################################ +## +## And things that need manual fixes, but not necessarly hand wrapped +## +############################################################ +def ManualFixes ( mb ): + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + for c in global_ns.classes(): + if c.decl_string.startswith("::std::vector<Ogre::PlaneBoundedVolume, std::allocator<Ogre::PlaneBoundedVolume> >"): + print "Excluding:", c + c.include(already_exposed=True) + try: + global_ns.namespace("std").class_('vector<Ogre::PlaneBoundedVolume>, std::allocator<Ogre::BoundedVolume> >').exclude() + print "OK1" + except: + print "FAIL1" + try: + main_ns.class_("std::vector<Ogre::PlaneBoundedVolume, std::allocator<Ogre::PlaneBoundedVolume> >").exclude() + print "OK2" + except: + print "FAIL2" + try: + main_ns.class_("::std::vector<Ogre::PlaneBoundedVolume, std::allocator<Ogre::PlaneBoundedVolume> >").exclude() + print "OK3" + except: + print "FAIL3" + +############################################################ +## +## And things that need to have their argument and call values fixed. +## ie functions that pass pointers in the argument list and of course we need +## to read the updated values - so instead we pass them back +## as new values in a tuple (ETC ETC) +## +############################################################ + +def ManualTransformations ( mb ): + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + + def create_output( size ): + return [ ft.output( i ) for i in range( size ) ] + +# # # this is from the Ogre generate wrapper and is needed to remove vertexData from the camera +# # known = ['indexBuffer', 'vertexData', 'indexData'] +# # for c in mb.classes(): +# # for v in c.variables(allow_empty = True ): +# # if v.name in known: +# # v.apply_smart_ptr_wa = True +# # print "Applying Smart Pointer (know): ", v.name, " of class: ", c.name + + +############################################################################### +## +## Now for the AUTOMATIC stuff that should just work +## +############################################################################### + +def AutoFixes ( mb, MAIN_NAMESPACE ): + """ now we fix a range of things automatically - typically by going through + the entire name space trying to guess stuff and fix it:) + """ + global_ns = mb.global_ns + if MAIN_NAMESPACE: + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + else: + main_ns = global_ns + + # Functions that have void pointers in their argument list need to change to unsigned int's + pointee_types=[] + ignore_names=[] + common_utils.Fix_Void_Ptr_Args ( main_ns ) # , pointee_types, ignore_names ) + + # and change functions that return a variety of pointers to instead return unsigned int's + pointee_types=[] + ignore_names=[] # these are function names we know it's cool to exclude + common_utils.Fix_Pointer_Returns ( main_ns ) # , pointee_types, ignore_names ) + + # functions that need to have implicit conversions turned off + ImplicitClasses=[] + common_utils.Fix_Implicit_Conversions ( main_ns, ImplicitClasses ) + + if os.name =='nt': + Fix_NT( mb ) + elif os.name =='posix': + Fix_Posix( mb ) + + common_utils.Auto_Document( mb, MAIN_NAMESPACE ) + + +############################################################################### +## +## here are the helper functions that do much of the work +## +############################################################################### +def Fix_Posix ( mb ): + """ fixup for posix specific stuff -- note only expect to be called on a posix machine + """ + ## we could do more here if need be... + if sys.platform == 'darwin': + pass + elif sys.platform.startswith ('linux'): + pass + + +def Fix_NT ( mb ): + """ fixup for NT systems + """ + + +# +# the 'main'function +# +def generate_code(): + messages.disable( +# Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X + messages.W1020 + , messages.W1021 + , messages.W1022 + , messages.W1023 + , messages.W1024 + , messages.W1025 + , messages.W1026 + , messages.W1027 + , messages.W1028 + , messages.W1029 + , messages.W1030 + , messages.W1031 + , messages.W1035 + , messages.W1040 + , messages.W1038 + , messages.W1041 + , messages.W1036 # pointer to Python immutable member + , messages.W1033 # unnamed variables + , messages.W1018 # expose unnamed classes + , messages.W1049 # returns reference to local variable + , messages.W1014 # unsupported '=' operator + ) + # + # Use GCCXML to create the controlling XML file. + # If the cache file (../cache/*.xml) doesn't exist it gets created, otherwise it just gets loaded + # NOTE: If you update the source library code you need to manually delete the cache .XML file + # + xml_cached_fc = parser.create_cached_source_fc( + os.path.join( environment.ogrepcz.root_dir, "python_ogrepcz.h" ) + , environment.ogrepcz.cache_file ) + + defined_symbols = [ 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY'] + defined_symbols.append( 'VERSION_' + environment.ogrepcz.version ) + + # + # build the core Py++ system from the GCCXML created source + # + mb = module_builder.module_builder_t( [ xml_cached_fc ] + , gccxml_path=environment.gccxml_bin + , working_directory=environment.root_dir + , include_paths=environment.ogrepcz.include_dirs + , define_symbols=defined_symbols + , indexing_suite_version=2 + , cflags=environment.ogrepcz.cflags + ) + + # if this module depends on another set it here + 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 + + mb.BOOST_PYTHON_MAX_ARITY = 25 + mb.classes().always_expose_using_scope = True + + # + # We filter (both include and exclude) specific classes and functions that we want to wrap + # + global_ns = mb.global_ns + global_ns.exclude() + + # We don't include all of MAIN_NAMESPACE otherwise we get the same full wrapper + # so instead we include classes with names that start with PCZ + main_ns = global_ns.namespace( MAIN_NAMESPACE ) +# main_ns.include() + for c in main_ns.classes(): + if c.name.startswith ('PCZ'): + print "Including ", c + c.include() + + common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) + ManualExclude ( mb ) + common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) + ManualInclude ( mb ) + # here we fixup functions that expect to modifiy their 'passed' variables + ManualTransformations ( mb ) + AutoFixes ( mb, MAIN_NAMESPACE ) + ManualFixes ( mb ) + # + # We need to tell boost how to handle calling (and returning from) certain functions + # + common_utils.Set_DefaultCall_Policies ( mb.global_ns.namespace ( MAIN_NAMESPACE ) ) + + # + # the manual stuff all done here !!! + # + hand_made_wrappers.apply( mb ) + + NoPropClasses = [""] + for cls in main_ns.classes(): + if cls.name not in NoPropClasses: + cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) + + common_utils.add_constants( mb, { 'ogrepcz_version' : '"%s"' % environment.ogrepcz.version.replace("\n", "\\\n") + , 'python_version' : '"%s"' % sys.version.replace("\n", "\\\n" ) } ) + + ## need to create a welcome doc string for this... + common_utils.add_constants( mb, { '__doc__' : '"ogrepcz DESCRIPTION"' } ) + + + ########################################################################################## + # + # Creating the code. After this step you should not modify/customize declarations. + # + ########################################################################################## + extractor = exdoc.doc_extractor() # I'm excluding the UTFstring docs as lots about nothing + mb.build_code_creator (module_name='_ogrepcz_' , doc_extractor= extractor ) + + for inc in environment.ogrepcz.include_dirs: + mb.code_creator.user_defined_directories.append(inc ) + mb.code_creator.user_defined_directories.append( environment.ogrepcz.generated_dir ) + mb.code_creator.replace_included_headers( customization_data.header_files( environment.ogrepcz.version ) ) + + huge_classes = map( mb.class_, customization_data.huge_classes( environment.ogrepcz.version ) ) + + mb.split_module(environment.ogrepcz.generated_dir, huge_classes, use_files_sum_repository=False) + + ## now we need to ensure a series of headers and additional source files are + ## copied to the generated directory.. + +# common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_ogrepcz, +# destPath = environment.ogrepcz.generated_dir, +# recursive=False ) + +if __name__ == '__main__': + start_time = time.clock() + generate_code() + print 'Source code was updated( %f minutes ).' % ( ( time.clock() - start_time )/60 ) Added: trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py (rev 0) +++ trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py 2008-07-29 09:34:29 UTC (rev 676) @@ -0,0 +1,15 @@ +import os +import environment + + + +################################################################################################# +################################################################################################# + +def apply_reg ( class_, code ): + for c in code: + class_.add_registration_code ( c ) + +def apply( mb ): + pass + \ No newline at end of file Added: trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz.h =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz.h (rev 0) +++ trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz.h 2008-07-29 09:34:29 UTC (rev 676) @@ -0,0 +1,27 @@ +#include "Ogre.h" +#include "OgrePortal.h" +#include "OgrePCZSceneNode.h" +#include "OgrePCZone.h" +#include "OgrePCZSceneManager.h" +#include "OgrePCZSceneQuery.h" +#include "OgrePCZLight.h" +#include "OgrePCPlane.h" +#include "OgrePCZFrustum.h" + + +// First we create a magic namespace to hold all our aliases +namespace pyplusplus { namespace aliases { + + #include "python_ogrepcz_aliases.h" +} } + +// then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ +// +namespace python_ogrepcz{ namespace details{ +inline void instantiate(){ + using namespace Ogre; + #include "python_ogrepcz_sizeof.h" + +} } } + + Added: trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_aliases.h =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_aliases.h (rev 0) +++ trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_aliases.h 2008-07-29 09:34:29 UTC (rev 676) @@ -0,0 +1 @@ +// typedef name nicename; Added: trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_sizeof.h =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_sizeof.h (rev 0) +++ trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_sizeof.h 2008-07-29 09:34:29 UTC (rev 676) @@ -0,0 +1 @@ +// sizeof ( variable ); Modified: trunk/python-ogre/demos/theora/demo_video.py =================================================================== --- trunk/python-ogre/demos/theora/demo_video.py 2008-07-28 06:56:57 UTC (rev 675) +++ trunk/python-ogre/demos/theora/demo_video.py 2008-07-29 09:34:29 UTC (rev 676) @@ -42,12 +42,12 @@ if not self.Control: print "\n\nClip not found\n" sys.exit() - self.Control.setInputName( '../media_extra/fish.ogg' ) + self.Control.setInputName( '../media_extra/konqi_ad1_nl.avi.ogg') ##fish.ogg' ) self.Control.setPlayMode(theora.TextureEffectPause ) self.Control.setTextureTecPassStateLevel( 0, 0, 0 ) self.Control.setSeekEnabled( False ) -# self.Control.setAutoAudioUpdate ( True ) + self.Control.setAutoAudioUpdate ( True ) mat = ogre.MaterialManager.getSingleton().getByName("Example/TheoraVideoPlayer/Play") #Create the material the first time through this method @@ -97,7 +97,6 @@ ret = sf.FrameListener.frameStarted(self, frameEvent) if self.video and ret: self.video.blitFrameCheck() - self.video.getAudioDriver().autoUpdate() return ret Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-07-28 06:56:57 UTC (rev 675) +++ trunk/python-ogre/environment.py 2008-07-29 09:34:29 UTC (rev 676) @@ -1569,6 +1569,24 @@ libs=[ boost.lib, 'OgreMain' ] ModuleName="cadunetree" +class ogrepcz: + active = False + pythonModule = True + version="1.0" + name='ogrepcz' + parent="ogre/renderer" + cflags = "" + include_dirs = [ Config.PATH_Boost, + Config.PATH_INCLUDE_Ogre, + Config.PATH_INCLUDE_ogrepcz + ] + lib_dirs = [Config.PATH_LIB_Boost, + Config.PATH_LIB_Ogre_OgreMain + ] + CheckIncludes=[] + libs=[ boost.lib, 'Plugin_PCZSceneManager', 'OgreMain' ] + ModuleName="ogrepcz" + class opensteer: active = False pythonModule = True @@ -1647,6 +1665,7 @@ , 'particleuniverse' : particleuniverse , 'cadunetree' : cadunetree ,'opensteer' : opensteer + ,'ogrepcz' : ogrepcz } # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-07-29 10:24:57
|
Revision: 677 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=677&view=rev Author: andy_miller Date: 2008-07-29 10:25:07 +0000 (Tue, 29 Jul 2008) Log Message: ----------- Add the ogrepcz module to setup.py and the packages directory Modified Paths: -------------- trunk/python-ogre/setup.py Added Paths: ----------- trunk/python-ogre/packages_2.5/ogre/renderer/ogrepcz/ trunk/python-ogre/packages_2.5/ogre/renderer/ogrepcz/__init__.py Added: trunk/python-ogre/packages_2.5/ogre/renderer/ogrepcz/__init__.py =================================================================== --- trunk/python-ogre/packages_2.5/ogre/renderer/ogrepcz/__init__.py (rev 0) +++ trunk/python-ogre/packages_2.5/ogre/renderer/ogrepcz/__init__.py 2008-07-29 10:25:07 UTC (rev 677) @@ -0,0 +1,13 @@ +import sys, os +import warnings +warnings.simplefilter('ignore', RuntimeWarning) + +# Note that we put the Python-Ogre path first to ensure we don't get strange problems with windows +# picking up the wrong dlls -- Thanks to Pelle for tracking down this issue.. +if sys.platform == 'win32': + os.environ['PATH'] = __path__[0] +';' + os.environ['PATH'] + +from _ogrepcz_ import * + +warnings.resetwarnings( ) + Modified: trunk/python-ogre/setup.py =================================================================== --- trunk/python-ogre/setup.py 2008-07-29 09:34:29 UTC (rev 676) +++ trunk/python-ogre/setup.py 2008-07-29 10:25:07 UTC (rev 677) @@ -71,7 +71,8 @@ 'ogre.addons.plib','ogre.gui.navi', 'ogre.addons.ogreforests', 'ogre.addons.et', 'ogre.addons.caelum', 'ogre.addons.noise', 'ogre.addons.watermesh', 'ogre.addons.ofusion', - 'ogre.addons.particleuniverse', 'ogre.addons.cadunetree' ], + 'ogre.addons.particleuniverse', 'ogre.addons.cadunetree', + 'ogre.renderer.ogrepcz' ], "package_dir": {'': 'packages_'+ PythonVersionString }, "package_data": {'': ['*.pyd', '*.dll', '*.so']} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-07-29 12:56:11
|
Revision: 678 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=678&view=rev Author: andy_miller Date: 2008-07-29 12:56:20 +0000 (Tue, 29 Jul 2008) Log Message: ----------- further Portal work (not finished with the demo) Modified Paths: -------------- trunk/python-ogre/code_generators/ogrepcz/generate_code.py trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py trunk/python-ogre/packages_2.5/ogre/renderer/OGRE/sf_OIS.py Added Paths: ----------- trunk/python-ogre/demos/ogrepcz/ trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py trunk/python-ogre/demos/ogrepcz/RoomObject.py trunk/python-ogre/demos/plugins.cfg trunk/python-ogre/demos/resources.cfg Removed Paths: ------------- trunk/python-ogre/demos/ogre/resources.cfg trunk/python-ogre/packages_2.6/ Modified: trunk/python-ogre/code_generators/ogrepcz/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/generate_code.py 2008-07-29 10:25:07 UTC (rev 677) +++ trunk/python-ogre/code_generators/ogrepcz/generate_code.py 2008-07-29 12:56:20 UTC (rev 678) @@ -86,7 +86,14 @@ if MAIN_NAMESPACE: main_ns = global_ns.namespace( MAIN_NAMESPACE ) else: - main_ns = global_ns + main_ns = global_ns + + includes = ['::Ogre::Portal::PORTAL_TYPE', + '::Ogre::Portal::PortalIntersectResult', +# '::Ogre::PCZone::NODE_LIST_TYPE' + ] + for i in includes: + main_ns.enum(i).include() ############################################################ ## @@ -277,9 +284,17 @@ main_ns = global_ns.namespace( MAIN_NAMESPACE ) # main_ns.include() for c in main_ns.classes(): - if c.name.startswith ('PCZ'): + if c.name.startswith ('PCZ') or c.name.startswith ('PCPlane') or c.name.startswith ('Portal'): + c.include() print "Including ", c - c.include() + + for c in ['Portal','PCPlane']: + main_ns.class_(c).include() + print "Including ", c +# for e in c.enums(allow_empty=True): +# e.include() +# for v in c.variables(allow_empty=True): +# v.include() common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualExclude ( mb ) Modified: trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py 2008-07-29 10:25:07 UTC (rev 677) +++ trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py 2008-07-29 12:56:20 UTC (rev 678) @@ -1,7 +1,47 @@ import os import environment +WRAPPER_DEFINITION_General = \ +""" +// The following helper functions are a start and possibly need to be extended to include +// additional scene queries.. +Ogre::PCZSceneNode * General_castAsPCZSceneNode( Ogre::SceneNode * in ){ + return (Ogre::PCZSceneNode*) in; + } +Ogre::PCZSceneManager * General_castAsPCZSceneManager( Ogre::SceneManager * in ){ + return (Ogre::PCZSceneManager*) in; + } +Ogre::PCZRaySceneQuery * General_castAsPCZRaySceneQuery( Ogre::RaySceneQuery * in ){ + return (Ogre::PCZRaySceneQuery*) in; + } + +/// TO HANDLE ?? +/* PCZAxisAlignedBoxSceneQuery : public DefaultAxisAlignedBoxSceneQuery +PCZRaySceneQuery : public DefaultRaySceneQuery +PCZSphereSceneQuery : public DefaultSphereSceneQuery +PCZPlaneBoundedVolumeListSceneQuery : public DefaultPlaneBoundedVolumeListSceneQuery +*/ + + +""" +WRAPPER_REGISTRATION_General = [ + """bp::def( "castAsPCZSceneNode", &General_castAsPCZSceneNode, + "Python-Ogre Helper Function: Casts a SceneNode as a PCZSceneNode.\\n\\ + Input: SceneNode\\n\\ + Ouput: PCZSceneNode",\ + bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""", + """bp::def( "castAsPCZSceneManager", &General_castAsPCZSceneManager, + "Python-Ogre Helper Function: Casts a SceneManager as a PCZSceneManager.\\n\\ + Input: SceneManager\\n\\ + Ouput: PCZSceneManager",\ + bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""", + """bp::def( "castAsPCZRaySceneQuery", &General_castAsPCZRaySceneQuery, + "Python-Ogre Helper Function: Casts a RaySceneQuery as a PCZRaySceneQuery.\\n\\ + Input: RaySceneQuery\\n\\ + Ouput: PCZRaySceneQuery",\ + bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""", +] ################################################################################################# ################################################################################################# @@ -11,5 +51,6 @@ class_.add_registration_code ( c ) def apply( mb ): - pass + mb.add_declaration_code( WRAPPER_DEFINITION_General ) + apply_reg (mb, WRAPPER_REGISTRATION_General ) \ No newline at end of file Deleted: trunk/python-ogre/demos/ogre/resources.cfg =================================================================== --- trunk/python-ogre/demos/ogre/resources.cfg 2008-07-29 10:25:07 UTC (rev 677) +++ trunk/python-ogre/demos/ogre/resources.cfg 2008-07-29 12:56:20 UTC (rev 678) @@ -1,24 +0,0 @@ -[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 - Added: trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py =================================================================== --- trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py (rev 0) +++ trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py 2008-07-29 12:56:20 UTC (rev 678) @@ -0,0 +1,327 @@ +# 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/ +# +# Specialisation of OGRE's framework application to test/demo the +# Portal Connected Zone (PCZ) Scene Manager Plugin. +# +# You may use this sample code for anything you like, it is not covered by the +# LGPL. +# ----------------------------------------------------------------------------- +import sys +import os +sys.path.insert(0,'..') +import PythonOgreConfig + +## this here becase the Plug_PCZSceneManager.dll needs to be accessed by both the python module and the ogre plugins +if sys.platform == 'win32': + newpath = os.path.join ( os.path.abspath(os.path.dirname(__file__)), '../../plugins') + os.environ['PATH'] = newpath +';' + os.environ['PATH'] + +import ogre.renderer.OGRE as ogre +import SampleFramework as sf +import ogre.io.OIS as ois +import ogre.renderer.ogrepcz as pcz + +# import RoomObject + +Global_buildingNode = None #pcz.PCZSceneNode() +Global_buildingTranslate = None # ogre.Vector3() +Global_raySceneQuery = None # ogre.RaySceneQuery() +Global_targetMO = None #ogre.MovableObject() + + +# # class PCZTestFrameListener ( sf.ExampleFrameListener) +# # +# # public: +# # PCZTestFrameListener(RenderWindow* win, Camera* cam) : ExampleFrameListener( win, cam ) +# # +# # self.MoveSpeed = 15.0 +# # self.updateRay=ogre.Ray() +# # +# # +# # void moveCamera() +# # +# # # Make all the spatial changes to the camera's scene node +# # # Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW +# # #(e.g. airplane) +# # self.camera.getParentSceneNode().translate(self.translateVector, Node.TS_LOCAL) +# # self.camera.getParentSceneNode().pitch(mRotY) +# # self.camera.getParentSceneNode().yaw(mRotX, Node.TS_WORLD) +# # Global_buildingNode.translate(Global_buildingTranslate, Node.TS_LOCAL) +# # +# # +# # bool frameRenderingQueued( const FrameEvent& evt ) +# # +# # if( ExampleFrameListener.frameRenderingQueued( evt ) == False ) +# # return False +# # +# # Global_buildingTranslate = ogre.Vector3(0,0,0) +# # if( self.keyboard.isKeyDown( ois.KC_LBRACKET ) ) +# # +# # Global_buildingTranslate = ogre.Vector3(0,-10,0) +# # +# # if( self.keyboard.isKeyDown( ois.KC_RBRACKET ) ) +# # +# # Global_buildingTranslate = ogre.Vector3(0,10,0) +# # +# # +# # if( self.keyboard.isKeyDown( ois.KC_LSHIFT ) || +# # self.keyboard.isKeyDown( ois.KC_RSHIFT )) +# # +# # self.MoveSpeed = 150 +# # +# # else +# # +# # self.MoveSpeed = 15 +# # +# # +# # # test the ray scene query by showing bounding box of whatever the camera is pointing directly at +# # # (takes furthest hit) +# # self.updateRay.setOrigin(self.camera.getParentSceneNode().getPosition()) +# # self.updateRay.setDirection(self.camera.getParentSceneNode().getOrientation()*ogre.Vector3.NEGATIVE_UNIT_Z) +# # Global_raySceneQuery.setRay(updateRay) +# # zone = ((PCZSceneNode*)(self.camera.getParentSceneNode())).getHomeZone() +# # ((PCZRaySceneQuery*)Global_raySceneQuery).setStartZone(zone) +# # ((PCZRaySceneQuery*)Global_raySceneQuery).setExcludeNode(self.camera.getParentSceneNode()) +# # RaySceneQueryResult& qryResult = Global_raySceneQuery.execute() +# # RaySceneQueryResult.iterator i = qryResult.begin() +# # if (i != qryResult.end()) +# # +# # RaySceneQueryResult.reverse_iterator ri = qryResult.rbegin() +# # MovableObject * mo = ri.movable +# # if (Global_targetMO != mo) +# # +# # if (Global_targetMO != 0) +# # +# # Global_targetMO.getParentSceneNode().showBoundingBox(False) +# # +# # Global_targetMO = mo +# # Global_targetMO.getParentSceneNode().showBoundingBox(True) +# # +# # +# # +# # return True + + + +class PCZTestApplication (sf.Application): + def __del__(self): + del Global_raySceneQuery + + + def _chooseSceneManager ( self ): + + # Create the SceneManager, in this case a generic one + self.sceneManager = self.root.createSceneManager("PCZSceneManager", "PCZSceneManager") + # initialize the scene manager using terrain as default zone + zoneTypeName = "ZoneType_Default" + self.pczSM = pcz.castAsPCZSceneManager( self.sceneManager ) # store this for future reference + self.pczSM.init(zoneTypeName) + #self.sceneManager.showBoundingBoxes(True) + +# def _createFrameListener( self ): +# self.frameListener= PCZTestFrameListener(self.renderWindow, self.camera) +# self.root.addFrameListener(self.frameListener) + + def _createCamera(self): + # Create the camera + self.camera = self.sceneManager.createCamera("PlayerCam") + + # NEW: create a node for the camera and control that instead of camera directly. + # We do this because PCZSceneManager requires camera to have a node + self.cameraNode = self.sceneManager.getRootSceneNode().createChildSceneNode("PlayerCamNode") + # attach the camera to the node + self.cameraNode.attachObject(self.camera) + # fix the yaw axis of the camera + self.cameraNode.setFixedYawAxis(True) + + self.camera.setNearClipDistance(2) + self.camera.setFarClipDistance( 1000 ) + # set camera zone +# ((PCZSceneNode*)(self.cameraNode)).setHomeZone(((PCZSceneManager*)(self.sceneManager)).getDefaultZone()) + + + # utility function to create terrain zones easily + def createTerrainZone(self, zoneName, terrain_cfg): + # load terrain into the terrain zone + terrainZone = self.pczSM.createZone("ZoneType_Terrain", zoneName) + terrainZone.notifyCameraCreated(self.camera) + self.pczSM.setZoneGeometry( zoneName, pcz.castAsPCZSceneNode(self.sceneManager.getRootSceneNode()), terrain_cfg ) + + # create aab portal(s) around the terrain + corners =[] + aabb = ogre.AxisAlignedBox() + + # make portal from terrain to default + terrainZone.getAABB(aabb) + portalName = "PortalFrom"+zoneName+"ToDefault_Zone" + p = self.pczSM.createPortal(portalName, pcz.Portal.PORTAL_TYPE_AABB) + corners[0] = aabb.getMinimum() + corners[1] = aabb.getMaximum() + p.setCorner(0, corners[0]) + p.setCorner(1, corners[1]) + p.setDirection(ogre.Vector3.NEGATIVE_UNIT_Z) # this indicates an "inward" pointing normal + # associate the portal with the terrain's main node + p.setNode(terrainZone.getEnclosureNode()) + # IMPORTANT: Update the derived values of the portal + p.updateDerivedValues() + # add the portal to the zone + terrainZone._addPortal(p) + + # make portal from default to terrain + portalName = "PortalFromDefault_ZoneTo"+zoneName + p2 = self.pczSM.createPortal(portalName, pcz.Portal.PORTAL_TYPE_AABB) + corners[0] = aabb.getMinimum() + corners[1] = aabb.getMaximum() + p2.setCorner(0, corners[0]) + p2.setCorner(1, corners[1]) + p2.setDirection(ogre.Vector3.UNIT_Z) # this indicates an "outward" pointing normal + # associate the portal with the terrain's main node + p2.setNode(terrainZone.getEnclosureNode()) + # IMPORTANT: Update the derived values of the portal + p2.updateDerivedValues() + # add the portal to the zone + self.pczSM.getDefaultZone()._addPortal(p2) + + # connect the portals manually + p.setTargetPortal(p2) + p2.setTargetPortal(p) + p.setTargetZone(self.pczSM.getDefaultZone()) + p2.setTargetZone(terrainZone) + + return terrainZone + + + # Just override the mandatory create scene method + def _createScene( self ): + + # Set ambient light + self.sceneManager.setAmbientLight(ogre.ColourValue(0.25, 0.25, 0.25)) + + # Create a skybox + self.sceneManager.setSkyBox(True, "Examples/CloudyNoonSkyBox", 500 ) + # put the skybox node in the default zone +# self.pczSM.setSkyZone(None) + + # Create a light + l = self.sceneManager.createLight("MainLight") + l.setPosition(0,0,0) + l.setAttenuation(500, 0.5, 1.0, 0.0) + # Accept default settings: point light, white diffuse, just set position + # attach light to a scene node so the PCZSM can handle it properly (zone-wise) + # IMPORTANT: Lights (just like cameras) MUST be connected to a scene node! + lightNode = self.cameraNode.createChildSceneNode("light_Node") + lightNode.attachObject(l) + + # Fog + # NB it's VERY important to set this before calling setWorldGeometry + # because the vertex program picked will be different + fadeColour= ogre.ColourValue(0.101, 0.125, 0.1836) + self.sceneManager.setFog( ogre.FOG_LINEAR, fadeColour, .001, 500, 1000) + self.renderWindow.getViewport(0).setBackgroundColour(fadeColour) + + # create a terrain zone + terrain_cfg = "terrain.cfg" + zoneName ="Terrain1_Zone" + terrainZone = self.createTerrainZone(zoneName, terrain_cfg) + +# # /* # Create another terrain zone +# # terrain_cfg = "terrain.cfg" +# # zoneName = "Terrain2_Zone" +# # terrainZone = createTerrainZone(zoneName, terrain_cfg) +# # # move second terrain next to first terrain +# # terrainZone.getEnclosureNode().setPosition(1500, 0, 0) +# # +# # # Create another terrain zone +# # terrain_cfg = "terrain.cfg" +# # zoneName = "Terrain3_Zone" +# # terrainZone = createTerrainZone(zoneName, terrain_cfg) +# # # move terrain next to first terrain +# # terrainZone.getEnclosureNode().setPosition(0, 0, 1500) +# # +# # # Create another terrain zone +# # terrain_cfg = "terrain.cfg" +# # zoneName = "Terrain4_Zone" +# # terrainZone = createTerrainZone(zoneName, terrain_cfg) +# # # move terrain next to first terrain +# # terrainZone.getEnclosureNode().setPosition(-1500, 0, 0) +# # +# # # Create another terrain zone +# # terrain_cfg = "terrain.cfg" +# # zoneName = "Terrain5_Zone" +# # terrainZone = createTerrainZone(zoneName, terrain_cfg) +# # # move terrain next to first terrain +# # terrainZone.getEnclosureNode().setPosition(0, 0, -1500) +# # +# # # Create another terrain zone +# # terrain_cfg = "terrain.cfg" +# # zoneName = "Terrain6_Zone" +# # terrainZone = createTerrainZone(zoneName, terrain_cfg) +# # # move terrain next to first terrain +# # terrainZone.getEnclosureNode().setPosition(1500, 0, 1500) +# # +# # # Create another terrain zone +# # terrain_cfg = "terrain.cfg" +# # zoneName = "Terrain7_Zone" +# # terrainZone = createTerrainZone(zoneName, terrain_cfg) +# # # move terrain next to first terrain +# # terrainZone.getEnclosureNode().setPosition(-1500, 0, -1500) +# # +# # # Create another terrain zone +# # terrain_cfg = "terrain.cfg" +# # zoneName = "Terrain8_Zone" +# # terrainZone = createTerrainZone(zoneName, terrain_cfg) +# # # move terrain next to first terrain +# # terrainZone.getEnclosureNode().setPosition(-1500, 0, 1500) +# # +# # # Create another terrain zone +# # terrain_cfg = "terrain.cfg" +# # zoneName = "Terrain9_Zone" +# # terrainZone = createTerrainZone(zoneName, terrain_cfg) +# # # move terrain next to first terrain +# # terrainZone.getEnclosureNode().setPosition(1500, 0, -1500) +# # */ + # set far clip plane to one terrain zone width (we have a LOT of terrain here, so we need to do far clipping!) + self.camera.setFarClipDistance(1500) + +# # create test buildinig +# RoomObject roomObj +# Global_buildingNode = roomObj.createTestBuilding(self.sceneManager, String("1")) +# Global_buildingNode.setPosition(500, 165, 570) +# #ogre.Radian r = Radian(3.1416/7.0) +# #Global_buildingNode.rotate(ogre.Vector3.UNIT_Y, r) +# +# # create another test buildinig +# RoomObject roomObj2 +# Global_buildingNode = roomObj2.createTestBuilding(self.sceneManager, String("2")) +# Global_buildingNode.setPosition(400, 165, 570) +# #ogre.Radian r = Radian(3.1416/7.0) +# #Global_buildingNode.rotate(ogre.Vector3.UNIT_Y, r) +# +# # Position camera in the center of the building +# self.cameraNode.setPosition(Global_buildingNode.getPosition()) +# # Look back along -Z +# self.camera.lookAt(self.cameraNode._getDerivedPosition() + ogre.Vector3(0,0,-300)) +# # Update bounds for camera +# self.cameraNode._updateBounds() +# +# # create the ray scene query +# Global_raySceneQuery = self.sceneManager.createRayQuery( +# Ray(self.camera.getParentNode().getPosition(), ogre.Vector3.NEGATIVE_UNIT_Z)) +# Global_raySceneQuery.setSortByDistance(True, 5) + + + +if __name__ == '__main__': + import exceptions,sys + try: + application = PCZTestApplication() + application.go() + except ogre.OgreException, e: + print e + Added: trunk/python-ogre/demos/ogrepcz/RoomObject.py =================================================================== --- trunk/python-ogre/demos/ogrepcz/RoomObject.py (rev 0) +++ trunk/python-ogre/demos/ogrepcz/RoomObject.py 2008-07-29 12:56:20 UTC (rev 678) @@ -0,0 +1,1009 @@ +## +## +## +## Filename : RoomObject.cpp + +# # +# # +# # class RoomObject +# # +# # private: +# # Ogre::Vector3 points[32]; +# # int mPortalCount; +# # public: + +DOOR_NONE = 0x00 +DOOR_TOP = 0x01 +DOOR_BOT = 0x02 +DOOR_FRONT = 0x04 +DOOR_BACK = 0x08 +DOOR_LEFT = 0x10 +DOOR_RIGHT = 0x20 +DOOR_ALL = 0xFF + +# # +# # +#include "Ogre.h" +#include "OgreMaterial.h" +#include "RoomObject.h" +#include "OgrePortal.h" + +using namespace Ogre +static int count = 0 + +PCZSceneNode * RoomObject.createTestBuilding(Ogre::SceneManager *scene, String & name) + + count++ + mPortalCount = 0 + Ogre.PCZSceneManager * pczSM = (Ogre::PCZSceneManager*)scene + + ## set points to building exterior size + createPoints(Vector3(60.0, 40.0, 60.0), Vector3(4.0, 10.0, 4.0)) + + ## create the building exterior + Entity *exterior = pczSM->createEntity( name + "_building_exterior", "building_exterior.mesh" ) + + ## make the enclosure a child node of the root scene node + PCZSceneNode * exteriorNode + exteriorNode = (PCZSceneNode*)scene->getRootSceneNode()->createChildSceneNode(name +"_building_exterior_node", Vector3( 0.0, 0.0f, 0.0f ) ) + exteriorNode->attachObject(exterior) + pczSM->addPCZSceneNode(exteriorNode, pczSM->getDefaultZone()) + + ## create portals for the building exterior + createPortals(scene, + exterior, + exteriorNode, + pczSM->getDefaultZone(), + DOOR_FRONT|DOOR_BACK|DOOR_LEFT|DOOR_RIGHT, + True) + + ## reset points to room size + createPoints(Vector3(20.0, 10.0, 20.0), Vector3(4.0, 10.0, 4.0)) + + ## create an interior room + Entity *room = pczSM->createEntity( name +"_room1", "room_nzpz.mesh" ) + + ## add the room as a child node to the enclosure node + PCZSceneNode * roomNode + roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room1_node", Vector3( 0.0, 0.0f, 20.0f ) ) + roomNode->attachObject(room) + + ## room needs it's own zone + Ogre.String zoneType = "ZoneType_Default" + Ogre.String zoneName = name +"_room1_zone" + PCZone * newZone = pczSM->createZone(zoneType, zoneName) + newZone->setEnclosureNode(roomNode) + pczSM->addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + createPortals(scene, + room, + roomNode, + newZone, + DOOR_FRONT|DOOR_BACK, + False) + + ## create another interior room + room = pczSM->createEntity( name +"_room2", "room_nxpxnypynzpz.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room2_node", Vector3( 0.0, 0.0f, 0.0f ) ) + roomNode->attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room2_zone" + newZone = pczSM->createZone(zoneType, zoneName) + newZone->setEnclosureNode(roomNode) + pczSM->addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + createPortals(scene, + room, + roomNode, + newZone, + DOOR_FRONT|DOOR_BACK|DOOR_LEFT|DOOR_RIGHT|DOOR_TOP|DOOR_BOT, + False) + + ## create another interior room + room = pczSM->createEntity( name +"_room3", "room_nzpz.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room3_node", Vector3( 0.0, 0.0f, -20.0f ) ) + roomNode->attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room3_zone" + newZone = pczSM->createZone(zoneType, zoneName) + newZone->setEnclosureNode(roomNode) + pczSM->addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + createPortals(scene, + room, + roomNode, + newZone, + DOOR_FRONT|DOOR_BACK, + False) + + ## create another interior room + room = pczSM->createEntity( name +"_room4", "room_nxpx.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room4_node", Vector3( -20.0, 0.0f, 0.0f ) ) + roomNode->attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room4_zone" + newZone = pczSM->createZone(zoneType, zoneName) + newZone->setEnclosureNode(roomNode) + pczSM->addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + createPortals(scene, + room, + roomNode, + newZone, + DOOR_LEFT|DOOR_RIGHT, + False) + + ## create another interior room + room = pczSM->createEntity( name +"_room5", "room_nxpx.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room5_node", Vector3( 20.0, 0.0f, 0.0f ) ) + roomNode->attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room5_zone" + newZone = pczSM->createZone(zoneType, zoneName) + newZone->setEnclosureNode(roomNode) + pczSM->addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + createPortals(scene, + room, + roomNode, + newZone, + DOOR_LEFT|DOOR_RIGHT, + False) + + ## create another interior room + room = pczSM->createEntity( name +"_room6", "room_ny.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room6_node", Vector3( 0.0, 10.0f, 0.0f ) ) + roomNode->attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room6_zone" + newZone = pczSM->createZone(zoneType, zoneName) + newZone->setEnclosureNode(roomNode) + pczSM->addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + createPortals(scene, + room, + roomNode, + newZone, + DOOR_BOT, + False) + + ## create another interior room + room = pczSM->createEntity( name +"_room7", "room_py.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room7_node", Vector3( 0.0, -50.0f, 0.0f ) ) + roomNode->attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room7_zone" + newZone = pczSM->createZone(zoneType, zoneName) + newZone->setEnclosureNode(roomNode) + pczSM->addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + createPortals(scene, + room, + roomNode, + newZone, + DOOR_TOP, + False) + + ## reset points to tall room size + createPoints(Vector3(20.0, 40.0, 20.0), Vector3(4.0, 10.0, 4.0)) + + ## create another interior room + room = pczSM->createEntity( name +"_room8", "room_nypy_4y.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room8_node", Vector3( 0.0, -25.0f, 0.0f ) ) + roomNode->attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room8_zone" + newZone = pczSM->createZone(zoneType, zoneName) + newZone->setEnclosureNode(roomNode) + pczSM->addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + createPortals(scene, + room, + roomNode, + newZone, + DOOR_BOT|DOOR_TOP, + False) + + + ## resolve portal zone pointers + pczSM->connectPortalsToTargetZonesByLocation() + + return exteriorNode + + + +Ogre.ManualObject* RoomObject::createRoom(Ogre::SceneManager *scene, + Ogre.String &name, + short doorFlags, + bool isEnclosure, + Ogre.Vector3 dimensions, + Ogre.Vector3 doorDimensions) + + addMaterial(name, Ogre.ColourValue(1,1,1,.75), Ogre::SBT_TRANSPARENT_ALPHA) + + Ogre.ManualObject* room = scene->createManualObject(name) + + room->begin(name, Ogre.RenderOperation::OT_TRIANGLE_LIST) + + ## create points + createPoints(dimensions, doorDimensions) + + Ogre.Real fade=.5 + Ogre.Real solid=.8 + Ogre.ColourValue color = ColourValue(0, 0, solid, solid) + + ## copy to room + for (int i=0 i<32;i++) + + room->position(points[i]) + room->colour(color) + + + createWalls(room, doorFlags, isEnclosure) + + room->end() + + return room + + +void RoomObject.addMaterial( Ogre::String &mat, + Ogre.ColourValue &clr, + Ogre.SceneBlendType sbt) + + static int init=False + if(init): + return + else: + init=True + + Ogre.MaterialPtr matptr = Ogre::MaterialManager::getSingleton().create(mat, "General") + matptr->setReceiveShadows(False) + matptr->getTechnique(0)->setLightingEnabled(True) + matptr->getTechnique(0)->getPass(0)->setDiffuse(clr) + matptr->getTechnique(0)->getPass(0)->setAmbient(clr) + matptr->getTechnique(0)->getPass(0)->setSelfIllumination(clr) + matptr->getTechnique(0)->getPass(0)->setSceneBlending(sbt) + matptr->getTechnique(0)->getPass(0)->setLightingEnabled(False) + matptr->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre.TVC_DIFFUSE) + + +void RoomObject.createPoints(Ogre::Vector3 dimensions, + Ogre.Vector3 doorDimensions) + + Ogre.Real l = dimensions.x/2 + Ogre.Real h = dimensions.y/2 + Ogre.Real w = dimensions.z/2 + +## 4 7 +## *-------* +## /| /| +## / | / | y +## / 5| 3/ 6| | +## 0*---*---*---* *-- x +## | / | / / +## | / | / z +## |/ |/ +## 1*-------*2 + + points[0] = Ogre.Vector3(-l, h, w) ##0 + points[1] = Ogre.Vector3(-l, -h, w) ##1 + points[2] = Ogre.Vector3(l, -h, w) ##2 + points[3] = Ogre.Vector3(l, h, w) ##3 + + points[4] = Ogre.Vector3(-l, h, -w) ##4 + points[5] = Ogre.Vector3(-l, -h, -w) ##5 + points[6] = Ogre.Vector3(l, -h, -w) ##6 + points[7] = Ogre.Vector3(l, h, -w) ##7 + + ## doors + Ogre.Real l2 = doorDimensions.x/2 + Ogre.Real h2 = doorDimensions.y/2 + Ogre.Real w2 = doorDimensions.z/2 + + ## front door + points[8] = Ogre.Vector3(-l2, h2, w) ##8 + points[9] = Ogre.Vector3(-l2, -h2, w) ##9 + points[10] = Ogre.Vector3(l2, -h2, w) ##10 + points[11] = Ogre.Vector3(l2, h2, w) ##11 + + ## back door + points[12] = Ogre.Vector3(-l2, h2, -w) ##12 + points[13] = Ogre.Vector3(-l2, -h2, -w) ##13 + points[14] = Ogre.Vector3(l2, -h2, -w) ##14 + points[15] = Ogre.Vector3(l2, h2, -w) ##15 + + ## top door + points[16] = Ogre.Vector3(-l2, h, -w2) ##16 + points[17] = Ogre.Vector3(-l2, h, w2) ##17 + points[18] = Ogre.Vector3(l2, h, w2) ##18 + points[19] = Ogre.Vector3(l2, h, -w2) ##19 + + ## bottom door + points[20] = Ogre.Vector3(-l2, -h, -w2) ##20 + points[21] = Ogre.Vector3(-l2, -h, w2) ##21 + points[22] = Ogre.Vector3(l2, -h, w2) ##22 + points[23] = Ogre.Vector3(l2, -h, -w2) ##23 + + ## left door + points[24] = Ogre.Vector3(-l, h2, w2) ##24 + points[25] = Ogre.Vector3(-l, -h2, w2) ##25 + points[26] = Ogre.Vector3(-l, -h2, -w2) ##26 + points[27] = Ogre.Vector3(-l, h2, -w2) ##27 + + ## right door + points[28] = Ogre.Vector3(l, h2, w2) ##28 + points[29] = Ogre.Vector3(l, -h2, w2) ##29 + points[30] = Ogre.Vector3(l, -h2, -w2) ##30 + points[31] = Ogre.Vector3(l, h2, -w2) ##31 + + +void RoomObject.createWalls(Ogre::ManualObject* room, + short doorFlags, + bool isEnclosure) + + + if (isEnclosure): + + if(doorFlags & DOOR_FRONT): + + ## make front wall outward facing with door + room->quad(0, 8, 11, 3) + room->quad(1, 9, 8, 0) + room->quad(2, 10, 9, 1) + room->quad(3, 11, 10, 2) + + else: + + ## make front wall outward facing without door + room->quad(0, 1, 2, 3) + + if(doorFlags & DOOR_BACK): + + ## make back wall outward facing with door + room->quad(7, 15, 12, 4) + room->quad(6, 14, 15, 7) + room->quad(5, 13, 14, 6) + room->quad(4, 12, 13, 5) + + else: + + ## make back wall outward facing without door + room->quad(7, 6, 5, 4) + + if(doorFlags & DOOR_TOP): + + ## make top wall outward facing with door + room->quad(0, 17, 16, 4) + room->quad(4, 16, 19, 7) + room->quad(7, 19, 18, 3) + room->quad(3, 18, 17, 0) + + else: + + ## make top wall outward facing without door + room->quad(0, 3, 7, 4) + + if(doorFlags & DOOR_BOT): + + ## make bottom wall outward facing with door + room->quad(5, 20, 21, 1) + room->quad(6, 23, 20, 5) + room->quad(2, 22, 23, 6) + room->quad(1, 21, 22, 2) + + else: + + ## make bottom wall outward facing without door + room->quad(2, 1, 5, 6) + + if(doorFlags & DOOR_LEFT): + + ## make left wall outward facing with door + room->quad(0, 24, 25, 1) + room->quad(4, 27, 24, 0) + room->quad(5, 26, 27, 4) + room->quad(1, 25, 26, 5) + + else: + + ## make left side wall outward facing without door + room->quad(1, 0, 4, 5) + + if(doorFlags & DOOR_RIGHT): + + ## make right wall outward facing with door + room->quad(2, 29, 28, 3) + room->quad(6, 30, 29, 2) + room->quad(7, 31, 30, 6) + room->quad(3, 28, 31, 7) + + else: + + ## make right side wall outward facing without door + room->quad(3, 2, 6, 7) + + + else: + + ## front back + if(doorFlags & DOOR_FRONT): + + ## make front wall inward facing with door + room->quad(3, 11, 8, 0) + room->quad(0, 8, 9, 1) + room->quad(1, 9, 10, 2) + room->quad(2, 10, 11, 3) + + else: + + ## make front wall inward facing without door + room->quad(3, 2, 1, 0) + + if(doorFlags & DOOR_BACK): + + ## make back wall inward facing with door + room->quad(4, 12, 15, 7) + room->quad(7, 15, 14, 6) + room->quad(6, 14, 13, 5) + room->quad(5, 13, 12, 4) + + else: + + ## make back wall inward facing without door + room->quad(4, 5, 6, 7) + + ## top bottom + if(doorFlags & DOOR_TOP): + + ## make top wall inward facing with door + room->quad(4, 16, 17, 0) + room->quad(7, 19, 16, 4) + room->quad(3, 18, 19, 7) + room->quad(0, 17, 18, 3) + + else: + + ## make top wall inward facing without door + room->quad(4, 7, 3, 0) + + if(doorFlags & DOOR_BOT): + + ## make bottom wall inward facing with door + room->quad(1, 21, 20, 5) + room->quad(5, 20, 23, 6) + room->quad(6, 23, 22, 2) + room->quad(2, 22, 21, 1) + + else: + + ## make bottom wall inward facing without door + room->quad(6, 5, 1, 2) + + ## end caps + if(doorFlags & DOOR_LEFT): + + ## make left wall inward facing with door + room->quad(1, 25, 24, 0) + room->quad(0, 24, 27, 4) + room->quad(4, 27, 26, 5) + room->quad(5, 26, 25, 1) + + else: + + ## make left side wall inward facing without door + room->quad(5, 4, 0, 1) + + if(doorFlags & DOOR_RIGHT): + + ## make right wall inward facing with door + room->quad(3, 28, 29, 2) + room->quad(2, 29, 30, 6) + room->quad(6, 30, 31, 7) + room->quad(7, 31, 28, 3) + + else: + + ## make right side wall inward facing without door + room->quad(7, 6, 2, 3) + + + + +## Create portals for every door +void RoomObject.createPortals(Ogre::SceneManager *scene, + Ogre.ManualObject* room, + Ogre.SceneNode * roomNode, + Ogre.PCZone * zone, + short doorFlags, + bool isEnclosure) + + Ogre.String portalName + Vector3 corners[4] + + if (isEnclosure): + + if(doorFlags & DOOR_FRONT): + + ## set the corners to the front door corners + corners[0] = points[8] + corners[1] = points[9] + corners[2] = points[10] + corners[3] = points[11] + ## create the portal + portalName = room->getName() + Ogre.String("_FrontDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_BACK): + + ## set the corners to the front door corners + corners[0] = points[15] + corners[1] = points[14] + corners[2] = points[13] + corners[3] = points[12] + ## create the portal + portalName = room->getName() + Ogre.String("_BackDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_TOP): + + ## set the corners to the front door corners + corners[0] = points[16] + corners[1] = points[17] + corners[2] = points[18] + corners[3] = points[19] + ## create the portal + portalName = room->getName() + Ogre.String("_TopDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_BOT): + + ## set the corners to the front door corners + corners[0] = points[23] + corners[1] = points[22] + corners[2] = points[21] + corners[3] = points[20] + ## create the portal + portalName = room->getName() + Ogre.String("_BottomDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_LEFT): + + ## set the corners to the front door corners + corners[0] = points[27] + corners[1] = points[26] + corners[2] = points[25] + corners[3] = points[24] + ## create the portal + portalName = room->getName() + Ogre.String("_LeftDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_RIGHT): + + ## set the corners to the front door corners + corners[0] = points[28] + corners[1] = points[29] + corners[2] = points[30] + corners[3] = points[31] + ## create the portal + portalName = room->getName() + Ogre.String("_RightDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + + else: + + if(doorFlags & DOOR_FRONT): + + ## set the corners to the front door corners + corners[0] = points[11] + corners[1] = points[10] + corners[2] = points[9] + corners[3] = points[8] + ## create the portal + portalName = room->getName() + Ogre.String("_FrontDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_BACK): + + ## set the corners to the front door corners + corners[0] = points[12] + corners[1] = points[13] + corners[2] = points[14] + corners[3] = points[15] + ## create the portal + portalName = room->getName() + Ogre.String("_BackDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_TOP): + + ## set the corners to the front door corners + corners[0] = points[19] + corners[1] = points[18] + corners[2] = points[17] + corners[3] = points[16] + ## create the portal + portalName = room->getName() + Ogre.String("_TopDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_BOT): + + ## set the corners to the front door corners + corners[0] = points[20] + corners[1] = points[21] + corners[2] = points[22] + corners[3] = points[23] + ## create the portal + portalName = room->getName() + Ogre.String("_BottomDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_LEFT): + + ## set the corners to the front door corners + corners[0] = points[24] + corners[1] = points[25] + corners[2] = points[26] + corners[3] = points[27] + ## create the portal + portalName = room->getName() + Ogre.String("_LeftDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_RIGHT): + + ## set the corners to the front door corners + corners[0] = points[31] + corners[1] = points[30] + corners[2] = points[29] + corners[3] = points[28] + ## create the portal + portalName = room->getName() + Ogre.String("_RightDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + + + +## Create portals for every door +void RoomObject.createPortals(Ogre::SceneManager *scene, + Ogre.Entity* room, + Ogre.SceneNode * roomNode, + Ogre.PCZone * zone, + short doorFlags, + bool isEnclosure) + + Ogre.String portalName + Vector3 corners[4] + + if (isEnclosure): + + if(doorFlags & DOOR_FRONT): + + ## set the corners to the front door corners + corners[0] = points[8] + corners[1] = points[9] + corners[2] = points[10] + corners[3] = points[11] + ## create the portal + portalName = room->getName() + Ogre.String("_FrontDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_BACK): + + ## set the corners to the front door corners + corners[0] = points[15] + corners[1] = points[14] + corners[2] = points[13] + corners[3] = points[12] + ## create the portal + portalName = room->getName() + Ogre.String("_BackDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_TOP): + + ## set the corners to the front door corners + corners[0] = points[16] + corners[1] = points[17] + corners[2] = points[18] + corners[3] = points[19] + ## create the portal + portalName = room->getName() + Ogre.String("_TopDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_BOT): + + ## set the corners to the front door corners + corners[0] = points[23] + corners[1] = points[22] + corners[2] = points[21] + corners[3] = points[20] + ## create the portal + portalName = room->getName() + Ogre.String("_BottomDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_LEFT): + + ## set the corners to the front door corners + corners[0] = points[27] + corners[1] = points[26] + corners[2] = points[25] + corners[3] = points[24] + ## create the portal + portalName = room->getName() + Ogre.String("_LeftDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_RIGHT): + + ## set the corners to the front door corners + corners[0] = points[28] + corners[1] = points[29] + corners[2] = points[30] + corners[3] = points[31] + ## create the portal + portalName = room->getName() + Ogre.String("_RightDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + + else: + + if(doorFlags & DOOR_FRONT): + + ## set the corners to the front door corners + corners[0] = points[11] + corners[1] = points[10] + corners[2] = points[9] + corners[3] = points[8] + ## create the portal + portalName = room->getName() + Ogre.String("_FrontDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_BACK): + + ## set the corners to the front door corners + corners[0] = points[12] + corners[1] = points[13] + corners[2] = points[14] + corners[3] = points[15] + ## create the portal + portalName = room->getName() + Ogre.String("_BackDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_TOP): + + ## set the corners to the front door corners + corners[0] = points[19] + corners[1] = points[18] + corners[2] = points[17] + corners[3] = points[16] + ## create the portal + portalName = room->getName() + Ogre.String("_TopDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_BOT): + + ## set the corners to the front door corners + corners[0] = points[20] + corners[1] = points[21] + corners[2] = points[22] + corners[3] = points[23] + ## create the portal + portalName = room->getName() + Ogre.String("_BottomDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_LEFT): + + ## set the corners to the front door corners + corners[0] = points[24] + corners[1] = points[25] + corners[2] = points[26] + corners[3] = points[27] + ## create the portal + portalName = room->getName() + Ogre.String("_LeftDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + if(doorFlags & DOOR_RIGHT): + + ## set the corners to the front door corners + corners[0] = points[31] + corners[1] = points[30] + corners[2] = points[29] + corners[3] = points[28] + ## create the portal + portalName = room->getName() + Ogre.String("_RightDoorPortal") + Portal * p = ((PCZSceneManager*)scene)->createPortal(portalName) + p->setCorners(corners) + ## associate the portal with the roomnode + p->setNode(roomNode) + ## add the portal to the zone + zone->_addPortal(p) + ## update derived values for the portal + p->updateDerivedValues() + + + Added: trunk/python-ogre/demos/plugins.cfg =================================================================== --- trunk/python-ogre/demos/plugins.cfg (rev 0) +++ trunk/python-ogre/demos/plugins.cfg 2008-07-29 12:56:20 UTC (rev 678) @@ -0,0 +1,21 @@ +# Defines plugins to load + +## Use this for Windows +# Define plugin folder +PluginFolder=../../plugins +#home/andy/development/root/usr/lib/OGRE +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=Plugin_PCZSceneManager.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/resources.cfg =================================================================== --- trunk/python-ogre/demos/resources.cfg (rev 0) +++ trunk/python-ogre/demos/resources.cfg 2008-07-29 12:56:20 UTC (rev 678) @@ -0,0 +1,24 @@ +[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 + Modified: trunk/python-ogre/packages_2.5/ogre/renderer/OGRE/sf_OIS.py =================================================================== --- trunk/python-ogre/packages_2.5/ogre/renderer/OGRE/sf_OIS.py 2008-07-29 10:25:07 UTC (rev 677) +++ trunk/python-ogre/packages_2.5/ogre/renderer/OGRE/sf_OIS.py 2008-07-29 12:56:20 UTC (rev 678) @@ -9,6 +9,11 @@ # You may use this sample code for anything you like, it is not covered by the # LGPL. # ----------------------------------------------------------------------------- + +# +# 29 July 2008: Ensured that resources.cfg and plugins.cfg can exist in the parent directory +# + import ogre.renderer.OGRE as ogre import ogre.io.OIS as OIS ###import OgreRefApp @@ -20,7 +25,7 @@ import os.path paths = [os.path.join(os.getcwd(), 'plugins.cfg'), - os.path.join(os.getcwd(), '../plugins.cfg'), + os.path.join(os.getcwd(), '..','plugins.cfg'), '/etc/OGRE/plugins.cfg', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'plugins.cfg')] @@ -107,7 +112,16 @@ """This sets up Ogre's resources, which are required to be in resources.cfg.""" config = ogre.ConfigFile() - config.load('resources.cfg' ) + try: + config.load('resources.cfg') + except ogre.OgreFileNotFoundException: + try: + config.load('../resources.cfg') + except: + raise + except: + raise + seci = config.getSectionIterator() while seci.hasMoreElements(): SectionName = seci.peekNextKey() @@ -276,7 +290,9 @@ self.InputManager.destroyInputObjectJoyStick( self.Joy ) OIS.InputManager.destroyInputSystem(self.InputManager) self.InputManager=None - + + ## NOTE the in Ogre 1.6 (1.7) this is changed to frameRenderingQueued !!! + def frameStarted(self, frameEvent): if(self.renderWindow.isClosed()): return False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-07-30 04:14:08
|
Revision: 680 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=680&view=rev Author: andy_miller Date: 2008-07-30 04:14:17 +0000 (Wed, 30 Jul 2008) Log Message: ----------- Expose 'points' and 'triangles' void * variables in PhysX Modified Paths: -------------- trunk/python-ogre/code_generators/physx/generate_code.py trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py Modified: trunk/python-ogre/code_generators/physx/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/physx/generate_code.py 2008-07-29 13:49:17 UTC (rev 679) +++ trunk/python-ogre/code_generators/physx/generate_code.py 2008-07-30 04:14:17 UTC (rev 680) @@ -135,7 +135,15 @@ def ManualFixes ( mb ): global_ns = mb.global_ns - + known = ['points', 'triangles'] + for c in global_ns.classes(): + if c.name.startswith ('Nx'): + print "Checking", c + for v in c.variables(allow_empty = True ): + if v.name in known: + v.expose_address = True + print "Exposing Address: ", v.name, " of class: ", c.name + sys.exit() ############################################################ ## Modified: trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py =================================================================== --- trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py 2008-07-29 13:49:17 UTC (rev 679) +++ trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py 2008-07-30 04:14:17 UTC (rev 680) @@ -35,80 +35,84 @@ Global_targetMO = None #ogre.MovableObject() -# # class PCZTestFrameListener ( sf.ExampleFrameListener) -# # -# # public: -# # PCZTestFrameListener(RenderWindow* win, Camera* cam) : ExampleFrameListener( win, cam ) -# # -# # self.MoveSpeed = 15.0 -# # self.updateRay=ogre.Ray() -# # -# # -# # void moveCamera() -# # -# # # Make all the spatial changes to the camera's scene node -# # # Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW -# # #(e.g. airplane) -# # self.camera.getParentSceneNode().translate(self.translateVector, Node.TS_LOCAL) -# # self.camera.getParentSceneNode().pitch(mRotY) -# # self.camera.getParentSceneNode().yaw(mRotX, Node.TS_WORLD) -# # Global_buildingNode.translate(Global_buildingTranslate, Node.TS_LOCAL) -# # -# # -# # bool frameRenderingQueued( const FrameEvent& evt ) -# # -# # if( ExampleFrameListener.frameRenderingQueued( evt ) == False ) -# # return False -# # -# # Global_buildingTranslate = ogre.Vector3(0,0,0) -# # if( self.keyboard.isKeyDown( ois.KC_LBRACKET ) ) -# # -# # Global_buildingTranslate = ogre.Vector3(0,-10,0) -# # -# # if( self.keyboard.isKeyDown( ois.KC_RBRACKET ) ) -# # -# # Global_buildingTranslate = ogre.Vector3(0,10,0) -# # -# # -# # if( self.keyboard.isKeyDown( ois.KC_LSHIFT ) || -# # self.keyboard.isKeyDown( ois.KC_RSHIFT )) -# # -# # self.MoveSpeed = 150 -# # -# # else -# # -# # self.MoveSpeed = 15 -# # -# # -# # # test the ray scene query by showing bounding box of whatever the camera is pointing directly at -# # # (takes furthest hit) -# # self.updateRay.setOrigin(self.camera.getParentSceneNode().getPosition()) -# # self.updateRay.setDirection(self.camera.getParentSceneNode().getOrientation()*ogre.Vector3.NEGATIVE_UNIT_Z) -# # Global_raySceneQuery.setRay(updateRay) -# # zone = ((PCZSceneNode*)(self.camera.getParentSceneNode())).getHomeZone() -# # ((PCZRaySceneQuery*)Global_raySceneQuery).setStartZone(zone) -# # ((PCZRaySceneQuery*)Global_raySceneQuery).setExcludeNode(self.camera.getParentSceneNode()) -# # RaySceneQueryResult& qryResult = Global_raySceneQuery.execute() -# # RaySceneQueryResult.iterator i = qryResult.begin() -# # if (i != qryResult.end()) -# # -# # RaySceneQueryResult.reverse_iterator ri = qryResult.rbegin() -# # MovableObject * mo = ri.movable -# # if (Global_targetMO != mo) -# # -# # if (Global_targetMO != 0) -# # -# # Global_targetMO.getParentSceneNode().showBoundingBox(False) -# # -# # Global_targetMO = mo -# # Global_targetMO.getParentSceneNode().showBoundingBox(True) -# # -# # -# # -# # return True +class PCZTestFrameListener ( sf.ExampleFrameListener): + def __init__(self, renderWindow, camera ): + sf.FrameListener.__init__(self, renderWindow, camera) + self.moveSpeed = 15.0 + self.raySceneQueue = sceneManager.createRayQuery(ogre.Ray(camera.getPosition(), + ogre.Vector3.NEGATIVE_UNIT_Y)) + self.camera = camera + self.updateRay=ogre.Ray() + self.pczCameraParentNode = pcz.castAsPCZSceneNode(self.camera.getParentSceneNode()) + + def moveCamera( self ): + # Make all the spatial changes to the camera's scene node + # Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW + #(e.g. airplane) + self.camera.getParentSceneNode().translate(self.translateVector, ogre.Node.TS_LOCAL) + self.camera.getParentSceneNode().pitch(self.rotationY) + self.camera.getParentSceneNode().yaw(self.rotationX, ogre.Node.TS_WORLD) + + Global_buildingNode.translate(Global_buildingTranslate, ogre.Node.TS_LOCAL) + def frameRenderingQueued( self, evt ): + if sf.FrameListener.frameRenderingQueued( evt ) == False: + return False + Global_buildingTranslate = ogre.Vector3(0,0,0) + if self.keyboard.isKeyDown( ois.KC_LBRACKET ): + Global_buildingTranslate = ogre.Vector3(0,-10,0) + if self.keyboard.isKeyDown( ois.KC_RBRACKET ): + Global_buildingTranslate = ogre.Vector3(0,10,0) + if self.keyboard.isKeyDown( ois.KC_LSHIFT ) or self.keyboard.isKeyDown( ois.KC_RSHIFT ): + self.moveSpeed = 150 + else + self.moveSpeed = 15 + # test the ray scene query by showing bounding box of whatever the camera is pointing directly at + # (takes furthest hit) + self.updateRay.setOrigin(self.camera.getParentSceneNode().getPosition()) + self.updateRay.setDirection(self.camera.getParentSceneNode().getOrientation()*ogre.Vector3.NEGATIVE_UNIT_Z) + Global_raySceneQuery.setRay(updateRay) + zone = self.pczCameraParentNode.getHomeZone() + pcz.castAsPCZRaySceneQuery(Global_raySceneQuery).setStartZone(zone) + pcz.castAsPCZRaySceneQuery(Global_raySceneQuery).setExcludeNode(self.camera.getParentSceneNode()) + for queryResult in Global_raySceneQuery.execute(): + ri = qryResult.rbegin() + mo = ri.movable + if Global_targetMO != mo: + if Global_targetMO != 0: + Global_targetMO.getParentSceneNode().showBoundingBox(False) + Global_targetMO = mo + Global_targetMO.getParentSceneNode().showBoundingBox(True) + return True + +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.getPosition(), + ogre.Vector3.NEGATIVE_UNIT_Y)) + self.camera = camera + #self.camera.setPosition (self.camera.getPosition() + ogre.Vector3(0.0, 10.0, 0.0)) + + def frameStarted(self, frameEvent): + # clamp to terrain + updateRay = ogre.Ray() + updateRay.setOrigin (self.camera.getPosition() + ogre.Vector3(0.0, 10.0, 0.0)) + updateRay.setDirection (ogre.Vector3.NEGATIVE_UNIT_Y) + self.raySceneQuery.Ray = updateRay + for queryResult in self.raySceneQuery.execute(): + if queryResult.worldFragment is not None: + pos = self.camera.getPosition() + self.camera.setPosition (pos.x, pos.y - queryResult.distance + 15.0, pos.z) + break + + return sf.FrameListener.frameStarted(self, frameEvent) + + class PCZTestApplication (sf.Application): def __del__(self): del Global_raySceneQuery This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-08-01 15:46:39
|
Revision: 682 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=682&view=rev Author: andy_miller Date: 2008-08-01 15:46:47 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Minor changes to get OgreAL and ET compiling again on Windows Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/demos/ogre/tests/Test_Camera.py trunk/python-ogre/demos/plugins.cfg trunk/python-ogre/environment.py Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-01 03:24:34 UTC (rev 681) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-01 15:46:47 UTC (rev 682) @@ -107,7 +107,7 @@ PATH_LIB_OgreOdePrefab = os.path.join( PATH_OgreOde, 'prefab/lib/Release' ) PATH_LIB_OgreOdeLoader = os.path.join( PATH_OgreOde, 'loader/lib/Release' ) -PATH_LIB_OgreAL = os.path.join( PATH_OGREAL ) # , 'lib/Release' ) +PATH_LIB_OgreAL = os.path.join( PATH_OGREAL ) ##, 'lib/Release' ) PATH_LIB_betagui = PATH_betagui PATH_LIB_quickgui = PATH_quickgui PATH_LIB_NxOgre= os.path.join(PATH_NxOgre, 'lib') Modified: trunk/python-ogre/demos/ogre/tests/Test_Camera.py =================================================================== --- trunk/python-ogre/demos/ogre/tests/Test_Camera.py 2008-08-01 03:24:34 UTC (rev 681) +++ trunk/python-ogre/demos/ogre/tests/Test_Camera.py 2008-08-01 15:46:47 UTC (rev 682) @@ -105,8 +105,13 @@ print v + for r in self.root.getAvailableRenderers(): + print "Renderer: ",r.getName() + cap = r.getCapabilities() + if cap: ## Note the OpenGL doesn't seem to have any capabilities?? + print "Device Name: ", cap.DeviceName + print "Driver Version/release: ", cap.DriverVersion.build, cap.DriverVersion.release - sys.exit() Modified: trunk/python-ogre/demos/plugins.cfg =================================================================== --- trunk/python-ogre/demos/plugins.cfg 2008-08-01 03:24:34 UTC (rev 681) +++ trunk/python-ogre/demos/plugins.cfg 2008-08-01 15:46:47 UTC (rev 682) @@ -10,9 +10,9 @@ Plugin=Plugin_BSPSceneManager.dll Plugin=Plugin_OctreeSceneManager.dll Plugin=Plugin_CgProgramManager.dll -Plugin=Plugin_PCZSceneManager.dll -Plugin=Plugin_OctreeZone.dll -Plugin=Plugin_OctreeSceneManager.dll +#Plugin=Plugin_PCZSceneManager.dll +#Plugin=Plugin_OctreeZone.dll +#Plugin=Plugin_OctreeSceneManager.dll ## Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-01 03:24:34 UTC (rev 681) +++ trunk/python-ogre/environment.py 2008-08-01 15:46:47 UTC (rev 682) @@ -871,7 +871,8 @@ CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19' ModuleName = 'CEGUI' CheckIncludes = ['boost/python.hpp', 'Ogre.h', 'CEGUI.h', 'OgreCEGUIRenderer.h'] - LINKFLAGS = "-l%s" % boost_python_index.lib + if isLinux(): + LINKFLAGS = "-l%s" % boost_python_index.lib class ode: @@ -1297,7 +1298,7 @@ libs=[boost.lib, 'OgreMain', 'ogg_static', 'vorbis_static','vorbisfile_static','vorbisenc_static', - 'OpenAL32', 'EFX-Util', 'OgreAL'] # -- going to compile OgreAL ourselves + 'OpenAL32', 'EFX-Util'] # -- going to compile OgreAL ourselves source = [ ["wget", "http://connect.creativelabs.com/openal/Downloads/OpenAL11CoreSDK.zip",downloadPath], ["wget", "http://downloads.xiph.org/releases/ogg/libogg-1.1.3.zip",downloadPath], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-08-01 03:24:30
|
Revision: 681 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=681&view=rev Author: andy_miller Date: 2008-08-01 03:24:34 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Implemented a CTYPE scheme (thanks to Romans Py++) for exposing void *'s Upgraded ogreforests to R2483 and cadelum to R264 Support for ODE 0.10.1 Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/PythonOgreConfig_posix.py trunk/python-ogre/code_generators/caelum/generate_code.py trunk/python-ogre/code_generators/caelum/python_caelum.h trunk/python-ogre/code_generators/common_utils/__init__.py trunk/python-ogre/code_generators/ode/generate_code.py trunk/python-ogre/code_generators/ogreforests/customization_data.py trunk/python-ogre/code_generators/ogreforests/generate_code.py trunk/python-ogre/code_generators/ogreforests/hand_made_wrappers.py trunk/python-ogre/code_generators/ogreforests/python_forests.h trunk/python-ogre/code_generators/ogreforests/python_forests_aliases.h trunk/python-ogre/code_generators/ogreforests/python_forests_sizeof.h trunk/python-ogre/code_generators/physx/generate_code.py trunk/python-ogre/demos/caelum/Demo_Caelum01.py trunk/python-ogre/environment.py trunk/python-ogre/scripts/compilesource.bat Added Paths: ----------- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp trunk/python-ogre/ThirdParty/caelum/Astronomy.h trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp trunk/python-ogre/ThirdParty/caelum/Caelum.h trunk/python-ogre/ThirdParty/caelum/CaelumExceptions.h trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.cpp trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.h trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h trunk/python-ogre/ThirdParty/caelum/CameraBoundElement.cpp trunk/python-ogre/ThirdParty/caelum/CameraBoundElement.h trunk/python-ogre/ThirdParty/caelum/CloudSystem.cpp trunk/python-ogre/ThirdParty/caelum/CloudSystem.h trunk/python-ogre/ThirdParty/caelum/FlatCloudLayer.cpp trunk/python-ogre/ThirdParty/caelum/FlatCloudLayer.h trunk/python-ogre/ThirdParty/caelum/GeometryFactory.cpp trunk/python-ogre/ThirdParty/caelum/GeometryFactory.h trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp trunk/python-ogre/ThirdParty/caelum/GroundFog.h trunk/python-ogre/ThirdParty/caelum/ImageHelper.cpp trunk/python-ogre/ThirdParty/caelum/ImageHelper.h trunk/python-ogre/ThirdParty/caelum/ImageStarfield.cpp trunk/python-ogre/ThirdParty/caelum/ImageStarfield.h trunk/python-ogre/ThirdParty/caelum/Moon.cpp trunk/python-ogre/ThirdParty/caelum/Moon.h trunk/python-ogre/ThirdParty/caelum/PointStarfield.cpp trunk/python-ogre/ThirdParty/caelum/PointStarfield.h trunk/python-ogre/ThirdParty/caelum/PrecipitationController.cpp trunk/python-ogre/ThirdParty/caelum/PrecipitationController.h trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp trunk/python-ogre/ThirdParty/caelum/SkyDome.h trunk/python-ogre/ThirdParty/caelum/SkyLight.cpp trunk/python-ogre/ThirdParty/caelum/SkyLight.h trunk/python-ogre/ThirdParty/caelum/Sun.cpp trunk/python-ogre/ThirdParty/caelum/Sun.h trunk/python-ogre/ThirdParty/caelum/UniversalClock.cpp trunk/python-ogre/ThirdParty/caelum/UniversalClock.h trunk/python-ogre/ThirdParty/forests/BatchPage.cpp trunk/python-ogre/ThirdParty/forests/BatchPage.h trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp trunk/python-ogre/ThirdParty/forests/GrassLoader.h trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp trunk/python-ogre/ThirdParty/forests/ImpostorPage.h trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp trunk/python-ogre/ThirdParty/forests/PagedGeometry.h trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp trunk/python-ogre/ThirdParty/forests/PropertyMaps.h trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.cpp trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.h trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader2D.h trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader3D.h trunk/python-ogre/ThirdParty/forests/WindBatchPage.cpp trunk/python-ogre/ThirdParty/forests/WindBatchPage.h trunk/python-ogre/ThirdParty/forests/WindBatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/WindBatchedGeometry.h trunk/python-ogre/ThirdParty/forests/orig/ Removed Paths: ------------- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp trunk/python-ogre/ThirdParty/caelum/Astronomy.h trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp trunk/python-ogre/ThirdParty/caelum/Caelum.h trunk/python-ogre/ThirdParty/caelum/CaelumExceptions.h trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.cpp trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.h trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h trunk/python-ogre/ThirdParty/caelum/CameraBoundElement.cpp trunk/python-ogre/ThirdParty/caelum/CameraBoundElement.h trunk/python-ogre/ThirdParty/caelum/GeometryFactory.cpp trunk/python-ogre/ThirdParty/caelum/GeometryFactory.h trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp trunk/python-ogre/ThirdParty/caelum/GroundFog.h trunk/python-ogre/ThirdParty/caelum/ImageHelper.cpp trunk/python-ogre/ThirdParty/caelum/ImageHelper.h trunk/python-ogre/ThirdParty/caelum/ImageStarfield.cpp trunk/python-ogre/ThirdParty/caelum/ImageStarfield.h trunk/python-ogre/ThirdParty/caelum/LayeredClouds.cpp trunk/python-ogre/ThirdParty/caelum/LayeredClouds.h trunk/python-ogre/ThirdParty/caelum/Moon.cpp trunk/python-ogre/ThirdParty/caelum/Moon.h trunk/python-ogre/ThirdParty/caelum/PointStarfield.cpp trunk/python-ogre/ThirdParty/caelum/PointStarfield.h trunk/python-ogre/ThirdParty/caelum/SkyColourModel.cpp trunk/python-ogre/ThirdParty/caelum/SkyColourModel.h trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp trunk/python-ogre/ThirdParty/caelum/SkyDome.h trunk/python-ogre/ThirdParty/caelum/SkyLight.cpp trunk/python-ogre/ThirdParty/caelum/SkyLight.h trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.h trunk/python-ogre/ThirdParty/caelum/Starfield.cpp trunk/python-ogre/ThirdParty/caelum/Starfield.h trunk/python-ogre/ThirdParty/caelum/Sun.cpp trunk/python-ogre/ThirdParty/caelum/Sun.h trunk/python-ogre/ThirdParty/caelum/UniversalClock.cpp trunk/python-ogre/ThirdParty/caelum/UniversalClock.h trunk/python-ogre/ThirdParty/forests/BatchPage.cpp trunk/python-ogre/ThirdParty/forests/BatchPage.h trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp trunk/python-ogre/ThirdParty/forests/GrassLoader.h trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp trunk/python-ogre/ThirdParty/forests/ImpostorPage.h trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp trunk/python-ogre/ThirdParty/forests/PagedGeometry.h trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp trunk/python-ogre/ThirdParty/forests/PropertyMaps.h trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.cpp trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.h trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader2D.h trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader3D.h trunk/python-ogre/ThirdParty/forests/orig/ Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-01 03:24:34 UTC (rev 681) @@ -43,7 +43,7 @@ PATH_OIS = os.path.join(BASE_DIR, 'ois' ) ##'ois-1.0RC1') PATH_Newton = os.path.join(BASE_DIR, 'newtonsdk','sdk') PATH_FMOD = os.path.join(BASE_DIR, 'fmod') -PATH_ODE = os.path.join(BASE_DIR, 'ode-0.9') +PATH_ODE = os.path.join(BASE_DIR, 'ode-0.10.1') PATH_OGG = os.path.join(BASE_DIR, 'ogg') PATH_VORBIS= os.path.join(BASE_DIR, 'vorbis') PATH_OPENAL= os.path.join(BASE_DIR, 'openal') @@ -100,7 +100,7 @@ PATH_LIB_Newton = os.path.join( PATH_Newton ,'dll') ##NOTE Posix platforms this lives in 'lib-mt' PATH_LIB_OIS = os.path.join( PATH_OIS, 'lib') ## NOTE Posix platforms this lives in'lib' not 'dll' PATH_LIB_CEGUI = os.path.join( PATH_CEGUI, 'lib' ) -PATH_LIB_ODE = os.path.join( PATH_ODE, 'lib/releaselib')## probable releaselib for posix +PATH_LIB_ODE = os.path.join( PATH_ODE, 'lib/ReleaseSingleLib')## probable releaselib for posix PATH_LIB_OPCODE = os.path.join( PATH_OPCODE ) PATH_LIB_OgreOde = os.path.join( PATH_OgreOde, 'lib/Release') # # PATH_LIB_OgreBullet = os.path.join( PATH_OgreBullet, 'lib/Release') Modified: trunk/python-ogre/PythonOgreConfig_posix.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_posix.py 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/PythonOgreConfig_posix.py 2008-08-01 03:24:34 UTC (rev 681) @@ -78,6 +78,7 @@ PATH_particleuniverse = os.path.join(PATH_Ogre, 'PlugIns', 'ParticleUniverse' ) PATH_cadunetree= os.path.join(PATH_THIRDPARTY, 'cadunetree') PATH_opensteer = os.path.join(BASE_DIR, 'opensteer', 'trunk') +PATH_ogrepcz = os.path.join(PATH_Ogre, 'PlugIns', 'PCZSceneManager' ) ### @@ -117,6 +118,7 @@ PATH_LIB_navi= os.path.join(PATH_navi, 'lib') PATH_LIB_particleuniverse = os.path.join(PATH_particleuniverse, 'bin', 'release') PATH_LIB_opensteer = os.path.join(LOCAL_LIB) +PATH_INCLUDE_ogrepcz = os.path.join(PATH_ogrepcz,'include') PATH_INCLUDE_Ogre= os.path.join(LOCAL_INCLUDE,'OGRE') # os.path.join(PATH_Ogre,'OgreMain/include') Deleted: trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp 2008-08-01 03:24:34 UTC (rev 681) @@ -1,350 +0,0 @@ -/* -This file is part of Caelum. -See http://www.ogre3d.org/wiki/index.php/Caelum - -Copyright (c) 2008 Caelum team. See Contributors.txt for details. - -Caelum is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Caelum is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with Caelum. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "CaelumPrecompiled.h" -#include "Astronomy.h" - -namespace caelum -{ - const LongReal Astronomy::PI = 3.1415926535897932384626433832795029L; - - const LongReal Astronomy::J2000 = 2451545.0; - - LongReal Astronomy::radToDeg (LongReal value) - { - return value * 180 / PI; - } - - LongReal Astronomy::degToRad (LongReal value) - { - return value * PI / 180; - } - - LongReal Astronomy::sinDeg (LongReal x) { - return std::sin (degToRad (x)); - } - - LongReal Astronomy::cosDeg (LongReal x) { - return std::cos (degToRad (x)); - } - - LongReal Astronomy::atan2Deg (LongReal y, LongReal x) { - return radToDeg(std::atan2 (y, x)); - } - - LongReal Astronomy::normalizeDegrees (LongReal value) - { - value = fmod (value, 360); - if (value < LongReal (0)) { - value += LongReal (360); - } - return value; - } - - void Astronomy::convertEclipticToEquatorialRad ( - LongReal lon, LongReal lat, - LongReal &rasc, LongReal &decl) - { - double ecl = Astronomy::degToRad(23.439281); - - double x = cos(lon) * cos(lat); - double y = cos(ecl) * sin(lon) * cos(lat) - sin(ecl) * sin(lat); - double z = sin(ecl) * sin(lon) * cos(lat) + cos(ecl) * sin(lat); - - double r = sqrt(x * x + y * y); - rasc = atan2(y, x); - decl = atan2(z, r); - } - - void Astronomy::convertRectangularToSpherical ( - LongReal x, LongReal y, LongReal z, - LongReal &rasc, LongReal &decl, LongReal &dist) - { - dist = sqrt (x * x + y * y + z * z); - rasc = atan2Deg (y, x); - decl = atan2Deg (z, sqrt (x * x + y * y)); - } - - void Astronomy::convertSphericalToRectangular ( - LongReal rasc, LongReal decl, LongReal dist, - LongReal &x, LongReal &y, LongReal &z) - { - x = dist * cosDeg (rasc) * cosDeg (decl); - y = dist * sinDeg (rasc) * cosDeg (decl); - z = dist * sinDeg (decl); - } - - void Astronomy::convertEquatorialToHorizontal ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal rasc, LongReal decl, - LongReal &azimuth, LongReal &altitude) - { - LongReal d = jday - 2451543.5; - LongReal w = LongReal (282.9404 + 4.70935E-5 * d); - LongReal M = LongReal (356.0470 + 0.9856002585 * d); - // Sun's mean longitude - LongReal L = w + M; - // Universal time of day in degrees. - LongReal UT = LongReal(fmod(d, 1) * 360); - LongReal hourAngle = longitude + L + LongReal (180) + UT - rasc; - - LongReal x = cosDeg (hourAngle) * cosDeg (decl); - LongReal y = sinDeg (hourAngle) * cosDeg (decl); - LongReal z = sinDeg (decl); - - LongReal xhor = x * sinDeg (latitude) - z * cosDeg (latitude); - LongReal yhor = y; - LongReal zhor = x * cosDeg (latitude) + z * sinDeg (latitude); - - azimuth = atan2Deg (yhor, xhor) + LongReal (180); - altitude = atan2Deg (zhor, sqrt (xhor * xhor + yhor * yhor)); - } - - void Astronomy::getHorizontalSunPosition ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal &azimuth, LongReal &altitude) - { - // 2451544.5 == Astronomy::getJulianDayFromGregorianDateTime(2000, 1, 1, 0, 0, 0)); - // 2451543.5 == Astronomy::getJulianDayFromGregorianDateTime(1999, 12, 31, 0, 0, 0)); - LongReal d = jday - 2451543.5; - - // Sun's Orbital elements: - // argument of perihelion - LongReal w = LongReal (282.9404 + 4.70935E-5 * d); - // eccentricity (0=circle, 0-1=ellipse, 1=parabola) - LongReal e = 0.016709 - 1.151E-9 * d; - // mean anomaly (0 at perihelion; increases uniformly with time) - LongReal M = LongReal(356.0470 + 0.9856002585 * d); - // Obliquity of the ecliptic. - //LongReal oblecl = LongReal (23.4393 - 3.563E-7 * d); - - // Eccentric anomaly - LongReal E = M + radToDeg(e * sinDeg (M) * (1 + e * cosDeg (M))); - - // Sun's Distance(R) and true longitude(L) - LongReal xv = cosDeg (E) - e; - LongReal yv = sinDeg (E) * sqrt (1 - e * e); - //LongReal r = sqrt (xv * xv + yv * yv); - LongReal lon = atan2Deg (yv, xv) + w; - LongReal lat = 0; - - LongReal lambda = degToRad(lon); - LongReal beta = degToRad(lat); - LongReal rasc, decl; - convertEclipticToEquatorialRad (lambda, beta, rasc, decl); - rasc = radToDeg(rasc); - decl = radToDeg(decl); - - // Horizontal spherical. - Astronomy::convertEquatorialToHorizontal ( - jday, longitude, latitude, rasc, decl, azimuth, altitude); - } - - void Astronomy::getHorizontalSunPosition ( - LongReal jday, - Ogre::Degree longitude, Ogre::Degree latitude, - Ogre::Degree &azimuth, Ogre::Degree &altitude) - { - LongReal az, al; - getHorizontalSunPosition(jday, longitude.valueDegrees (), latitude.valueDegrees (), az, al); - azimuth = Ogre::Degree(az); - altitude = Ogre::Degree(al); - } - - void Astronomy::getEclipticMoonPositionRad ( - LongReal jday, - LongReal &lon, LongReal &lat) - { - // Julian centuries since January 1, 2000 - double T = (jday - 2451545.0L) / 36525.0L; - double lprim = 3.8104L + 8399.7091L * T; - double mprim = 2.3554L + 8328.6911L * T; - double m = 6.2300L + 648.3019L * T; - double d = 5.1985L + 7771.3772L * T; - double f = 1.6280L + 8433.4663L * T; - lon = lprim - + 0.1098L * sin(mprim) - + 0.0222L * sin(2.0L * d - mprim) - + 0.0115L * sin(2.0L * d) - + 0.0037L * sin(2.0L * mprim) - - 0.0032L * sin(m) - - 0.0020L * sin(2.0L * f) - + 0.0010L * sin(2.0L * d - 2.0L * mprim) - + 0.0010L * sin(2.0L * d - m - mprim) - + 0.0009L * sin(2.0L * d + mprim) - + 0.0008L * sin(2.0L * d - m) - + 0.0007L * sin(mprim - m) - - 0.0006L * sin(d) - - 0.0005L * sin(m + mprim); - lat = - + 0.0895L * sin(f) - + 0.0049L * sin(mprim + f) - + 0.0048L * sin(mprim - f) - + 0.0030L * sin(2.0L * d - f) - + 0.0010L * sin(2.0L * d + f - mprim) - + 0.0008 * sin(2.0L * d - f - mprim) - + 0.0006L * sin(2.0L * d + f); - } - - void Astronomy::getHorizontalMoonPosition ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal &azimuth, LongReal &altitude) - { - // Ecliptic spherical - LongReal lonecl, latecl; - Astronomy::getEclipticMoonPositionRad (jday, lonecl, latecl); - - // Equatorial spherical - LongReal rasc, decl; - Astronomy::convertEclipticToEquatorialRad (lonecl, latecl, rasc, decl); - - // Radians to degrees (all angles are in radians up to this point) - rasc = radToDeg(rasc); - decl = radToDeg(decl); - - // Equatorial to horizontal - Astronomy::convertEquatorialToHorizontal ( - jday, longitude, latitude, rasc, decl, azimuth, altitude); - } - - void Astronomy::getHorizontalMoonPosition ( - LongReal jday, - Ogre::Degree longitude, Ogre::Degree latitude, - Ogre::Degree &azimuth, Ogre::Degree &altitude) - { - LongReal az, al; - getHorizontalMoonPosition(jday, longitude.valueDegrees (), latitude.valueDegrees (), az, al); - azimuth = Ogre::Degree(az); - altitude = Ogre::Degree(al); - } - - int Astronomy::getJulianDayFromGregorianDate( - int year, int month, int day) - { - // Formulas from http://en.wikipedia.org/wiki/Julian_day - // These are all integer divisions, but I'm not sure it works - // correctly for negative values. - int a = (14 - month) / 12; - int y = year + 4800 - a; - int m = month + 12 * a - 3; - return day + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045; - } - - LongReal Astronomy::getJulianDayFromGregorianDateTime( - int year, int month, int day, - int hour, int minute, LongReal second) - { - int fpmode = Astronomy::enterHighPrecissionFloatingPointMode (); - - int jdn = getJulianDayFromGregorianDate (year, month, day); - // These are NOT integer divisions. - LongReal jd = jdn + (hour - 12) / 24.0 + minute / 1440.0 + second / 86400.0; - - Astronomy::restoreFloatingPointMode(fpmode); - return jd; - } - - LongReal Astronomy::getJulianDayFromGregorianDateTime( - int year, int month, int day, - LongReal secondsFromMidnight) - { - int jdn = getJulianDayFromGregorianDate(year, month, day); - LongReal jd = jdn + secondsFromMidnight / 86400.0 - 0.5; - return jd; - } - - void Astronomy::getGregorianDateFromJulianDay( - int julianDay, int &year, int &month, int &day) - { - // From http://en.wikipedia.org/wiki/Julian_day - int J = julianDay; - int j = J + 32044; - int g = j / 146097; - int dg = j % 146097; - int c = (dg / 36524 + 1) * 3 / 4; - int dc = dg - c * 36524; - int b = dc / 1461; - int db = dc % 1461; - int a = (db / 365 + 1) * 3 / 4; - int da = db - a * 365; - int y = g * 400 + c * 100 + b * 4 + a; - int m = (da * 5 + 308) / 153 - 2; - int d = da - (m + 4) * 153 / 5 + 122; - year = y - 4800 + (m + 2) / 12; - month = (m + 2) % 12 + 1; - day = d + 1; - } - - void Astronomy::getGregorianDateTimeFromJulianDay( - LongReal julianDay, int &year, int &month, int &day, - int &hour, int &minute, LongReal &second) - { - // Integer julian days are at noon. - // static_cast<int)(floor( is more precise than Ogre::Math::IFloor. - // Yes, it does matter. - int ijd = static_cast<int>(floor(julianDay + 0.5)); - getGregorianDateFromJulianDay(ijd, year, month, day); - - LongReal s = (julianDay + 0.5 - ijd) * 86400.0; - hour = static_cast<int>(floor(s / 3600)); - s -= hour * 3600; - minute = static_cast<int>(floor(s / 60)); - s -= minute * 60; - second = s; - } - - void Astronomy::getGregorianDateFromJulianDay( - LongReal julianDay, int &year, int &month, int &day) - { - int hour; - int minute; - LongReal second; - getGregorianDateTimeFromJulianDay(julianDay, year, month, day, hour, minute, second); - } - -#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && (OGRE_COMPILER == OGRE_COMPILER_MSVC) - int Astronomy::enterHighPrecissionFloatingPointMode () - { - int oldMode = ::_controlfp (0, 0); - ::_controlfp (_PC_64, _MCW_PC); - return oldMode; - } - - void Astronomy::restoreFloatingPointMode (int oldMode) - { - ::_controlfp (oldMode, _MCW_PC); - } -#else - int Astronomy::enterHighPrecissionFloatingPointMode () - { - // Meaningless - return 0xC0FFEE; - } - - void Astronomy::restoreFloatingPointMode (int oldMode) - { - // Useless check. - assert(oldMode == 0xC0FFEE); - } -#endif -} Added: trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp 2008-08-01 03:24:34 UTC (rev 681) @@ -0,0 +1,350 @@ +/* +This file is part of Caelum. +See http://www.ogre3d.org/wiki/index.php/Caelum + +Copyright (c) 2008 Caelum team. See Contributors.txt for details. + +Caelum is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Caelum is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with Caelum. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "CaelumPrecompiled.h" +#include "Astronomy.h" + +namespace Caelum +{ + const LongReal Astronomy::PI = 3.1415926535897932384626433832795029L; + + const LongReal Astronomy::J2000 = 2451545.0; + + LongReal Astronomy::radToDeg (LongReal value) + { + return value * 180 / PI; + } + + LongReal Astronomy::degToRad (LongReal value) + { + return value * PI / 180; + } + + LongReal Astronomy::sinDeg (LongReal x) { + return std::sin (degToRad (x)); + } + + LongReal Astronomy::cosDeg (LongReal x) { + return std::cos (degToRad (x)); + } + + LongReal Astronomy::atan2Deg (LongReal y, LongReal x) { + return radToDeg(std::atan2 (y, x)); + } + + LongReal Astronomy::normalizeDegrees (LongReal value) + { + value = fmod (value, 360); + if (value < LongReal (0)) { + value += LongReal (360); + } + return value; + } + + void Astronomy::convertEclipticToEquatorialRad ( + LongReal lon, LongReal lat, + LongReal &rasc, LongReal &decl) + { + double ecl = Astronomy::degToRad(23.439281); + + double x = cos(lon) * cos(lat); + double y = cos(ecl) * sin(lon) * cos(lat) - sin(ecl) * sin(lat); + double z = sin(ecl) * sin(lon) * cos(lat) + cos(ecl) * sin(lat); + + double r = sqrt(x * x + y * y); + rasc = atan2(y, x); + decl = atan2(z, r); + } + + void Astronomy::convertRectangularToSpherical ( + LongReal x, LongReal y, LongReal z, + LongReal &rasc, LongReal &decl, LongReal &dist) + { + dist = sqrt (x * x + y * y + z * z); + rasc = atan2Deg (y, x); + decl = atan2Deg (z, sqrt (x * x + y * y)); + } + + void Astronomy::convertSphericalToRectangular ( + LongReal rasc, LongReal decl, LongReal dist, + LongReal &x, LongReal &y, LongReal &z) + { + x = dist * cosDeg (rasc) * cosDeg (decl); + y = dist * sinDeg (rasc) * cosDeg (decl); + z = dist * sinDeg (decl); + } + + void Astronomy::convertEquatorialToHorizontal ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal rasc, LongReal decl, + LongReal &azimuth, LongReal &altitude) + { + LongReal d = jday - 2451543.5; + LongReal w = LongReal (282.9404 + 4.70935E-5 * d); + LongReal M = LongReal (356.0470 + 0.9856002585 * d); + // Sun's mean longitude + LongReal L = w + M; + // Universal time of day in degrees. + LongReal UT = LongReal(fmod(d, 1) * 360); + LongReal hourAngle = longitude + L + LongReal (180) + UT - rasc; + + LongReal x = cosDeg (hourAngle) * cosDeg (decl); + LongReal y = sinDeg (hourAngle) * cosDeg (decl); + LongReal z = sinDeg (decl); + + LongReal xhor = x * sinDeg (latitude) - z * cosDeg (latitude); + LongReal yhor = y; + LongReal zhor = x * cosDeg (latitude) + z * sinDeg (latitude); + + azimuth = atan2Deg (yhor, xhor) + LongReal (180); + altitude = atan2Deg (zhor, sqrt (xhor * xhor + yhor * yhor)); + } + + void Astronomy::getHorizontalSunPosition ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal &azimuth, LongReal &altitude) + { + // 2451544.5 == Astronomy::getJulianDayFromGregorianDateTime(2000, 1, 1, 0, 0, 0)); + // 2451543.5 == Astronomy::getJulianDayFromGregorianDateTime(1999, 12, 31, 0, 0, 0)); + LongReal d = jday - 2451543.5; + + // Sun's Orbital elements: + // argument of perihelion + LongReal w = LongReal (282.9404 + 4.70935E-5 * d); + // eccentricity (0=circle, 0-1=ellipse, 1=parabola) + LongReal e = 0.016709 - 1.151E-9 * d; + // mean anomaly (0 at perihelion; increases uniformly with time) + LongReal M = LongReal(356.0470 + 0.9856002585 * d); + // Obliquity of the ecliptic. + //LongReal oblecl = LongReal (23.4393 - 3.563E-7 * d); + + // Eccentric anomaly + LongReal E = M + radToDeg(e * sinDeg (M) * (1 + e * cosDeg (M))); + + // Sun's Distance(R) and true longitude(L) + LongReal xv = cosDeg (E) - e; + LongReal yv = sinDeg (E) * sqrt (1 - e * e); + //LongReal r = sqrt (xv * xv + yv * yv); + LongReal lon = atan2Deg (yv, xv) + w; + LongReal lat = 0; + + LongReal lambda = degToRad(lon); + LongReal beta = degToRad(lat); + LongReal rasc, decl; + convertEclipticToEquatorialRad (lambda, beta, rasc, decl); + rasc = radToDeg(rasc); + decl = radToDeg(decl); + + // Horizontal spherical. + Astronomy::convertEquatorialToHorizontal ( + jday, longitude, latitude, rasc, decl, azimuth, altitude); + } + + void Astronomy::getHorizontalSunPosition ( + LongReal jday, + Ogre::Degree longitude, Ogre::Degree latitude, + Ogre::Degree &azimuth, Ogre::Degree &altitude) + { + LongReal az, al; + getHorizontalSunPosition(jday, longitude.valueDegrees (), latitude.valueDegrees (), az, al); + azimuth = Ogre::Degree(az); + altitude = Ogre::Degree(al); + } + + void Astronomy::getEclipticMoonPositionRad ( + LongReal jday, + LongReal &lon, LongReal &lat) + { + // Julian centuries since January 1, 2000 + double T = (jday - 2451545.0L) / 36525.0L; + double lprim = 3.8104L + 8399.7091L * T; + double mprim = 2.3554L + 8328.6911L * T; + double m = 6.2300L + 648.3019L * T; + double d = 5.1985L + 7771.3772L * T; + double f = 1.6280L + 8433.4663L * T; + lon = lprim + + 0.1098L * sin(mprim) + + 0.0222L * sin(2.0L * d - mprim) + + 0.0115L * sin(2.0L * d) + + 0.0037L * sin(2.0L * mprim) + - 0.0032L * sin(m) + - 0.0020L * sin(2.0L * f) + + 0.0010L * sin(2.0L * d - 2.0L * mprim) + + 0.0010L * sin(2.0L * d - m - mprim) + + 0.0009L * sin(2.0L * d + mprim) + + 0.0008L * sin(2.0L * d - m) + + 0.0007L * sin(mprim - m) + - 0.0006L * sin(d) + - 0.0005L * sin(m + mprim); + lat = + + 0.0895L * sin(f) + + 0.0049L * sin(mprim + f) + + 0.0048L * sin(mprim - f) + + 0.0030L * sin(2.0L * d - f) + + 0.0010L * sin(2.0L * d + f - mprim) + + 0.0008 * sin(2.0L * d - f - mprim) + + 0.0006L * sin(2.0L * d + f); + } + + void Astronomy::getHorizontalMoonPosition ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal &azimuth, LongReal &altitude) + { + // Ecliptic spherical + LongReal lonecl, latecl; + Astronomy::getEclipticMoonPositionRad (jday, lonecl, latecl); + + // Equatorial spherical + LongReal rasc, decl; + Astronomy::convertEclipticToEquatorialRad (lonecl, latecl, rasc, decl); + + // Radians to degrees (all angles are in radians up to this point) + rasc = radToDeg(rasc); + decl = radToDeg(decl); + + // Equatorial to horizontal + Astronomy::convertEquatorialToHorizontal ( + jday, longitude, latitude, rasc, decl, azimuth, altitude); + } + + void Astronomy::getHorizontalMoonPosition ( + LongReal jday, + Ogre::Degree longitude, Ogre::Degree latitude, + Ogre::Degree &azimuth, Ogre::Degree &altitude) + { + LongReal az, al; + getHorizontalMoonPosition(jday, longitude.valueDegrees (), latitude.valueDegrees (), az, al); + azimuth = Ogre::Degree(az); + altitude = Ogre::Degree(al); + } + + int Astronomy::getJulianDayFromGregorianDate( + int year, int month, int day) + { + // Formulas from http://en.wikipedia.org/wiki/Julian_day + // These are all integer divisions, but I'm not sure it works + // correctly for negative values. + int a = (14 - month) / 12; + int y = year + 4800 - a; + int m = month + 12 * a - 3; + return day + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045; + } + + LongReal Astronomy::getJulianDayFromGregorianDateTime( + int year, int month, int day, + int hour, int minute, LongReal second) + { + int fpmode = Astronomy::enterHighPrecissionFloatingPointMode (); + + int jdn = getJulianDayFromGregorianDate (year, month, day); + // These are NOT integer divisions. + LongReal jd = jdn + (hour - 12) / 24.0 + minute / 1440.0 + second / 86400.0; + + Astronomy::restoreFloatingPointMode(fpmode); + return jd; + } + + LongReal Astronomy::getJulianDayFromGregorianDateTime( + int year, int month, int day, + LongReal secondsFromMidnight) + { + int jdn = getJulianDayFromGregorianDate(year, month, day); + LongReal jd = jdn + secondsFromMidnight / 86400.0 - 0.5; + return jd; + } + + void Astronomy::getGregorianDateFromJulianDay( + int julianDay, int &year, int &month, int &day) + { + // From http://en.wikipedia.org/wiki/Julian_day + int J = julianDay; + int j = J + 32044; + int g = j / 146097; + int dg = j % 146097; + int c = (dg / 36524 + 1) * 3 / 4; + int dc = dg - c * 36524; + int b = dc / 1461; + int db = dc % 1461; + int a = (db / 365 + 1) * 3 / 4; + int da = db - a * 365; + int y = g * 400 + c * 100 + b * 4 + a; + int m = (da * 5 + 308) / 153 - 2; + int d = da - (m + 4) * 153 / 5 + 122; + year = y - 4800 + (m + 2) / 12; + month = (m + 2) % 12 + 1; + day = d + 1; + } + + void Astronomy::getGregorianDateTimeFromJulianDay( + LongReal julianDay, int &year, int &month, int &day, + int &hour, int &minute, LongReal &second) + { + // Integer julian days are at noon. + // static_cast<int)(floor( is more precise than Ogre::Math::IFloor. + // Yes, it does matter. + int ijd = static_cast<int>(floor(julianDay + 0.5)); + getGregorianDateFromJulianDay(ijd, year, month, day); + + LongReal s = (julianDay + 0.5 - ijd) * 86400.0; + hour = static_cast<int>(floor(s / 3600)); + s -= hour * 3600; + minute = static_cast<int>(floor(s / 60)); + s -= minute * 60; + second = s; + } + + void Astronomy::getGregorianDateFromJulianDay( + LongReal julianDay, int &year, int &month, int &day) + { + int hour; + int minute; + LongReal second; + getGregorianDateTimeFromJulianDay(julianDay, year, month, day, hour, minute, second); + } + +#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && (OGRE_COMPILER == OGRE_COMPILER_MSVC) + int Astronomy::enterHighPrecissionFloatingPointMode () + { + int oldMode = ::_controlfp (0, 0); + ::_controlfp (_PC_64, _MCW_PC); + return oldMode; + } + + void Astronomy::restoreFloatingPointMode (int oldMode) + { + ::_controlfp (oldMode, _MCW_PC); + } +#else + int Astronomy::enterHighPrecissionFloatingPointMode () + { + // Meaningless + return 0xC0FFEE; + } + + void Astronomy::restoreFloatingPointMode (int oldMode) + { + // Useless check. + assert(oldMode == 0xC0FFEE); + } +#endif +} Deleted: trunk/python-ogre/ThirdParty/caelum/Astronomy.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Astronomy.h 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/ThirdParty/caelum/Astronomy.h 2008-08-01 03:24:34 UTC (rev 681) @@ -1,204 +0,0 @@ -/* -This file is part of Caelum. -See http://www.ogre3d.org/wiki/index.php/Caelum - -Copyright (c) 2008 Caelum team. See Contributors.txt for details. - -Caelum is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Caelum is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with Caelum. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef ASTRONOMY_H -#define ASTRONOMY_H - -#include "CaelumPrerequisites.h" - -namespace caelum -{ - /** Static class with astronomy routines. - * This class contains various astronomical routines useful in Caelum. - * - * Most of the formulas are from http://stjarnhimlen.se/comp/ppcomp.html - * That site contains much more than was implemented here; it has code - * for determining the positions of all the planets. Only the sun and - * moon are actually useful for caelum. - * - * The formulas are isolated here in pure procedural code for easier - * testing (Tests are done as assertions in the demo). - * - * Precision is vital here, so this class uses caelum::LongReal(double) - * instead of Ogre::Real(float) for precission. All angles are in degrees - * unless otherwise mentioned. Ogre::Degree and Ogre::Radian use - * Ogre::Real and should be avoided here. - */ - class CAELUM_EXPORT Astronomy - { - private: - Astronomy() {} - - static const LongReal PI; - - /** Normalize an angle to the 0, 360 range. - * @param x The angle to normalize - */ - static LongReal normalizeDegrees (LongReal x); - - /// Convert radians to degrees. - static LongReal radToDeg (LongReal x); - - /// Convert degrees to radians. - static LongReal degToRad (LongReal x); - - static LongReal sinDeg (LongReal x); - static LongReal cosDeg (LongReal x); - static LongReal atan2Deg (LongReal y, LongReal x); - - public: - /// January 1, 2000, noon - static const LongReal J2000; - - /** Convert from ecliptic to ecuatorial spherical coordinates, in radians. - * @param lon Ecliptic longitude - * @param lat Ecliptic latitude - * @param rasc Right ascension - * @param decl Declination - * @warning: This function works in radians. - */ - static void convertEclipticToEquatorialRad ( - LongReal lon, LongReal lat, - LongReal& rasc, LongReal& decl); - - static void convertRectangularToSpherical ( - LongReal x, LongReal y, LongReal z, - LongReal &rasc, LongReal &decl, LongReal &dist); - - static void convertSphericalToRectangular ( - LongReal rasc, LongReal decl, LongReal dist, - LongReal &x, LongReal &y, LongReal &z); - - /** Convert from equatorial to horizontal coordinates. - * This function converts from angles relative to the earth's equator - * to angle relative to the horizon at a given point. - * @param jday Astronomical time as julian day. - * @param longitude Observer's longitude in degrees east. - * @param latitude Observer's latitude in degrees north. - * @param rasc Object's right ascension. - * @param decl Object's declination. - * @param azimuth Object's azimuth (clockwise degrees from true north). - * @param altitude Object's altitude (degrees above the horizon). - */ - static void convertEquatorialToHorizontal ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal rasc, LongReal decl, - LongReal &azimuth, LongReal &altitude); - - /** Get the sun's position in the sky in, relative to the horizon. - * @param jday Astronomical time as julian day. - * @param longitude Observer longitude - * @param latitude Observer latitude - * @param azimuth Astronomical azimuth, measured clockwise from North = 0. - * @param altitude Astronomical altitude, elevation above the horizon. - */ - static void getHorizontalSunPosition ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal &azimuth, LongReal &altitude); - - static void getHorizontalSunPosition ( - LongReal jday, - Ogre::Degree longitude, Ogre::Degree latitude, - Ogre::Degree &azimuth, Ogre::Degree &altitude); - - /// Gets the moon position at a specific time in ecliptic coordinates - /// @param lon: Ecliptic longitude, in radians. - /// @param lat: Ecliptic latitude, in radians. - static void getEclipticMoonPositionRad ( - LongReal jday, - LongReal &lon, - LongReal &lat); - - static void getHorizontalMoonPosition ( - LongReal jday, - LongReal longitude, LongReal latitude, - LongReal &azimuth, LongReal &altitude); - static void getHorizontalMoonPosition ( - LongReal jday, - Ogre::Degree longitude, Ogre::Degree latitude, - Ogre::Degree &azimuth, Ogre::Degree &altitude); - - /** Get astronomical julian day from normal gregorian calendar. - * From wikipedia: the integer number of days that have elapsed - * since the initial epoch defined as - * noon Universal Time (UT) Monday, January 1, 4713 BC - * @note this is the time at noon, not midnight. - */ - static int getJulianDayFromGregorianDate ( - int year, int month, int day); - - /** Get astronomical julian day from normal gregorian calendar. - * Calculate julian day from a day in the normal gregorian calendar. - * Time should be given as UTC. - * @see http://en.wikipedia.org/wiki/Julian_day - */ - static LongReal getJulianDayFromGregorianDateTime ( - int year, int month, int day, - int hour, int minute, LongReal second); - - /** Get astronomical julian day from normal gregorian calendar. - * @see above (I don't know the proper doxygen syntax). - */ - static LongReal getJulianDayFromGregorianDateTime ( - int year, int month, int day, - LongReal secondsFromMidnight); - - /// Get gregorian date from integer julian day. - static void getGregorianDateFromJulianDay ( - int julianDay, int &year, int &month, int &day); - - /// Get gregorian date time from floating point julian day. - static void getGregorianDateTimeFromJulianDay ( - LongReal julianDay, int &year, int &month, int &day, - int &hour, int &minute, LongReal &second); - - /// Get gregorian date from floating point julian day. - static void getGregorianDateFromJulianDay ( - LongReal julianDay, int &year, int &month, int &day); - - /** Enter high-precission floating-point mode. - * - * By default Direct3D decreases the precission of ALL floating - * point calculations, enough to stop Caelum's astronomy routines - * from working correctly. - * - * To trigger this behaviour in a standard ogre demo select the - * Direct3D render system and set "Floating-point mode" to - * "Fastest". Otherwise it's not a problem. - * - * It can be fixed by changing the precission only inside caelum's - * astronomy routines using the _controlfp function. This only works - * for MSVC on WIN32; This is a no-op on other compilers. - * - * @note: Must be paired with restoreFloatingPointMode. - * @return Value to pass to restoreFloatingModeMode. - */ - static int enterHighPrecissionFloatingPointMode (); - - /** Restore old floating point precission. - * @see enterHighPrecissionFloatingPointMode. - */ - static void restoreFloatingPointMode (int oldMode); - }; -} - -#endif // SOLARSYSTEMMODEL_H Added: trunk/python-ogre/ThirdParty/caelum/Astronomy.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Astronomy.h (rev 0) +++ trunk/python-ogre/ThirdParty/caelum/Astronomy.h 2008-08-01 03:24:34 UTC (rev 681) @@ -0,0 +1,204 @@ +/* +This file is part of Caelum. +See http://www.ogre3d.org/wiki/index.php/Caelum + +Copyright (c) 2008 Caelum team. See Contributors.txt for details. + +Caelum is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Caelum is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with Caelum. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef ASTRONOMY_H +#define ASTRONOMY_H + +#include "CaelumPrerequisites.h" + +namespace Caelum +{ + /** Static class with astronomy routines. + * This class contains various astronomical routines useful in Caelum. + * + * Most of the formulas are from http://stjarnhimlen.se/comp/ppcomp.html + * That site contains much more than was implemented here; it has code + * for determining the positions of all the planets. Only the sun and + * moon are actually useful for caelum. + * + * The formulas are isolated here in pure procedural code for easier + * testing (Tests are done as assertions in the demo). + * + * Precision is vital here, so this class uses Caelum::LongReal(double) + * instead of Ogre::Real(float) for precission. All angles are in degrees + * unless otherwise mentioned. Ogre::Degree and Ogre::Radian use + * Ogre::Real and should be avoided here. + */ + class CAELUM_EXPORT Astronomy + { + private: + Astronomy() {} + + static const LongReal PI; + + /** Normalize an angle to the 0, 360 range. + * @param x The angle to normalize + */ + static LongReal normalizeDegrees (LongReal x); + + /// Convert radians to degrees. + static LongReal radToDeg (LongReal x); + + /// Convert degrees to radians. + static LongReal degToRad (LongReal x); + + static LongReal sinDeg (LongReal x); + static LongReal cosDeg (LongReal x); + static LongReal atan2Deg (LongReal y, LongReal x); + + public: + /// January 1, 2000, noon + static const LongReal J2000; + + /** Convert from ecliptic to ecuatorial spherical coordinates, in radians. + * @param lon Ecliptic longitude + * @param lat Ecliptic latitude + * @param rasc Right ascension + * @param decl Declination + * @warning: This function works in radians. + */ + static void convertEclipticToEquatorialRad ( + LongReal lon, LongReal lat, + LongReal& rasc, LongReal& decl); + + static void convertRectangularToSpherical ( + LongReal x, LongReal y, LongReal z, + LongReal &rasc, LongReal &decl, LongReal &dist); + + static void convertSphericalToRectangular ( + LongReal rasc, LongReal decl, LongReal dist, + LongReal &x, LongReal &y, LongReal &z); + + /** Convert from equatorial to horizontal coordinates. + * This function converts from angles relative to the earth's equator + * to angle relative to the horizon at a given point. + * @param jday Astronomical time as julian day. + * @param longitude Observer's longitude in degrees east. + * @param latitude Observer's latitude in degrees north. + * @param rasc Object's right ascension. + * @param decl Object's declination. + * @param azimuth Object's azimuth (clockwise degrees from true north). + * @param altitude Object's altitude (degrees above the horizon). + */ + static void convertEquatorialToHorizontal ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal rasc, LongReal decl, + LongReal &azimuth, LongReal &altitude); + + /** Get the sun's position in the sky in, relative to the horizon. + * @param jday Astronomical time as julian day. + * @param longitude Observer longitude + * @param latitude Observer latitude + * @param azimuth Astronomical azimuth, measured clockwise from North = 0. + * @param altitude Astronomical altitude, elevation above the horizon. + */ + static void getHorizontalSunPosition ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal &azimuth, LongReal &altitude); + + static void getHorizontalSunPosition ( + LongReal jday, + Ogre::Degree longitude, Ogre::Degree latitude, + Ogre::Degree &azimuth, Ogre::Degree &altitude); + + /// Gets the moon position at a specific time in ecliptic coordinates + /// @param lon: Ecliptic longitude, in radians. + /// @param lat: Ecliptic latitude, in radians. + static void getEclipticMoonPositionRad ( + LongReal jday, + LongReal &lon, + LongReal &lat); + + static void getHorizontalMoonPosition ( + LongReal jday, + LongReal longitude, LongReal latitude, + LongReal &azimuth, LongReal &altitude); + static void getHorizontalMoonPosition ( + LongReal jday, + Ogre::Degree longitude, Ogre::Degree latitude, + Ogre::Degree &azimuth, Ogre::Degree &altitude); + + /** Get astronomical julian day from normal gregorian calendar. + * From wikipedia: the integer number of days that have elapsed + * since the initial epoch defined as + * noon Universal Time (UT) Monday, January 1, 4713 BC + * @note this is the time at noon, not midnight. + */ + static int getJulianDayFromGregorianDate ( + int year, int month, int day); + + /** Get astronomical julian day from normal gregorian calendar. + * Calculate julian day from a day in the normal gregorian calendar. + * Time should be given as UTC. + * @see http://en.wikipedia.org/wiki/Julian_day + */ + static LongReal getJulianDayFromGregorianDateTime ( + int year, int month, int day, + int hour, int minute, LongReal second); + + /** Get astronomical julian day from normal gregorian calendar. + * @see above (I don't know the proper doxygen syntax). + */ + static LongReal getJulianDayFromGregorianDateTime ( + int year, int month, int day, + LongReal secondsFromMidnight); + + /// Get gregorian date from integer julian day. + static void getGregorianDateFromJulianDay ( + int julianDay, int &year, int &month, int &day); + + /// Get gregorian date time from floating point julian day. + static void getGregorianDateTimeFromJulianDay ( + LongReal julianDay, int &year, int &month, int &day, + int &hour, int &minute, LongReal &second); + + /// Get gregorian date from floating point julian day. + static void getGregorianDateFromJulianDay ( + LongReal julianDay, int &year, int &month, int &day); + + /** Enter high-precission floating-point mode. + * + * By default Direct3D decreases the precission of ALL floating + * point calculations, enough to stop Caelum's astronomy routines + * from working correctly. + * + * To trigger this behaviour in a standard ogre demo select the + * Direct3D render system and set "Floating-point mode" to + * "Fastest". Otherwise it's not a problem. + * + * It can be fixed by changing the precission only inside caelum's + * astronomy routines using the _controlfp function. This only works + * for MSVC on WIN32; This is a no-op on other compilers. + * + * @note: Must be paired with restoreFloatingPointMode. + * @return Value to pass to restoreFloatingModeMode. + */ + static int enterHighPrecissionFloatingPointMode (); + + /** Restore old floating point precission. + * @see enterHighPrecissionFloatingPointMode. + */ + static void restoreFloatingPointMode (int oldMode); + }; +} + +#endif // SOLARSYSTEMMODEL_H Deleted: trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp 2008-07-30 04:14:17 UTC (rev 680) +++ trunk/python-ogre/ThirdParty/caelum/BrightStarCatalogue.cpp 2008-08-01 03:24:34 UTC (rev 681) @@ -1,9140 +0,0 @@ -/* -This file is part of Caelum. -See http://www.ogre3d.org/wiki/index.php/Caelum - -Copyright (c) 2008 Caelum team. See Contributors.txt for details. - -Caelum is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Caelum is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with Caelum. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "CaelumPrecompiled.h" -#include "PointStarfield.h" - -// Data from http://heasarc.gsfc.nasa.gov/W3Browse/star-catalog/bsc5p.html -// Converted using the following MSVS regexps: -// ^\|0*{:d+} 0*{:d+} 0*{[0-9.]+}\|{[+\-]}0*{:d+} 0*{:d+} 0*{[0-9.]+}\|{.*}\|$ -// { \(2,1), \(2,2), \(5,3), \4\(2,5), \(2,6), \(4,7),\(5, 8) }, -const caelum::BrightStarCatalogueEntry caelum::BrightStarCatalogue[BrightStarCatalogueSize] = { - { 21, 8, 46.20, -88, 57, 23.0, 5.47 }, - { 22, 45, 28.61, -88, 49, 5.9, 6.57 }, - { 15, 28, 19.10, -88, 7, 59.2, 6.48 }, - { 18, 54, 46.90, -87, 36, 20.9, 5.28 }, - { 17, 15, 59.30, -87, 33, 59.0, 6.57 }, - { 23, 28, 3.70, -87, 28, 55.9, 5.49 }, - { 6, 46, 58.70, -87, 1, 30.0, 6.47 }, - { 17, 0, 58.49, -86, 21, 51.8, 6.04 }, - { 12, 25, 37.49, -86, 9, 2.2, 6.33 }, - { 22, 31, 37.39, -85, 58, 1.9, 5.77 }, - { 13, 40, 55.49, -85, 47, 10.0, 5.58 }, - { 8, 56, 41.09, -85, 39, 47.2, 5.42 }, - { 12, 2, 20.11, -85, 37, 54.1, 6.05 }, - { 3, 42, 32.11, -85, 15, 43.9, 6.41 }, - { 18, 1, 34.10, -85, 12, 52.9, 6.45 }, - { 12, 54, 58.61, -85, 7, 23.9, 5.46 }, - { 0, 13, 19.39, -84, 59, 39.1, 5.77 }, - { 21, 32, 4.20, -84, 48, 36.0, 6.45 }, - { 15, 11, 8.30, -84, 47, 15.0, 5.91 }, - { 5, 30, 13.90, -84, 47, 6.0, 6.20 }, - { 1, 37, 28.01, -84, 46, 10.9, 5.69 }, - { 10, 59, 13.80, -84, 35, 38.0, 6.19 }, - { 15, 43, 16.80, -84, 27, 55.1, 5.57 }, - { 14, 26, 54.89, -83, 40, 4.1, 4.32 }, - { 18, 51, 57.89, -83, 18, 59.0, 7.16 }, - { 20, 24, 54.41, -83, 18, 38.2, 6.17 }, - { 16, 45, 53.59, -83, 14, 20.0, 6.57 }, - { 15, 1, 50.81, -83, 13, 40.1, 5.65 }, - { 11, 41, 1.20, -83, 6, .0, 6.33 }, - { 15, 4, 46.70, -83, 2, 17.9, 5.65 }, - { 1, 37, 55.61, -82, 58, 30.0, 5.87 }, - { 4, 22, 50.90, -82, 53, 57.1, 6.76 }, - { 14, 24, 23.30, -82, 50, 55.0, 6.42 }, - { 21, 50, 54.31, -82, 43, 9.1, 5.29 }, - { 21, 33, 54.41, -82, 40, 59.2, 6.38 }, - { 13, 55, 38.71, -82, 39, 58.0, 5.95 }, - { 4, 58, 50.90, -82, 28, 14.2, 5.85 }, - { 0, 10, 2.09, -82, 13, 26.0, 5.28 }, - { 10, 0, 43.70, -82, 12, 52.9, 5.52 }, - { 23, 57, 32.71, -82, 10, 12.0, 5.73 }, - { 23, 52, 6.41, -82, 1, 8.0, 5.11 }, - { 10, 31, 51.00, -81, 55, 16.0, 7.07 }, - { 18, 42, 14.09, -81, 48, 28.1, 6.27 }, - { 4, 20, 57.89, -81, 34, 48.0, 5.79 }, - { 10, 4, 7.61, -81, 33, 56.9, 6.60 }, - { 10, 59, 12.91, -81, 33, 22.0, 6.71 }, - { 5, 12, 25.70, -81, 32, 30.1, 6.51 }, - { 18, 5, 26.69, -81, 29, 11.0, 6.35 }, - { 22, 46, 3.31, -81, 22, 54.1, 4.15 }, - { 19, 56, 1.51, -81, 20, 58.9, 6.39 }, - { 20, 38, 18.60, -81, 17, 20.0, 5.91 }, - { 14, 18, 13.80, -81, 0, 28.1, 4.91 }, - { 20, 33, 17.50, -80, 57, 54.0, 5.77 }, - { 9, 33, 53.21, -80, 56, 29.0, 5.11 }, - { 8, 24, 19.80, -80, 54, 51.1, 5.69 }, - { 23, 12, 12.00, -80, 54, 46.1, 6.41 }, - { 17, 31, 27.29, -80, 51, 33.1, 5.88 }, - { 6, 40, 2.71, -80, 48, 49.0, 5.64 }, - { 9, 24, 9.10, -80, 47, 12.8, 5.36 }, - { 10, 45, 46.80, -80, 32, 25.1, 4.45 }, - { 10, 45, 15.70, -80, 28, 10.9, 5.47 }, - { 5, 37, 9.79, -80, 28, 9.1, 5.65 }, - { 22, 20, 1.51, -80, 26, 22.9, 5.10 }, - { 18, 29, 19.49, -80, 13, 58.1, 5.95 }, - { 4, 17, 59.09, -80, 12, 50.0, 5.69 }, - { 1, 47, 46.51, -80, 10, 36.1, 6.06 }, - { 22, 50, 22.90, -80, 7, 27.1, 5.35 }, - { 14, 22, 22.70, -80, 6, 32.0, 5.06 }, - { 21, 33, 20.59, -80, 2, 21.1, 6.47 }, - { 10, 41, 51.29, -79, 46, 59.9, 5.97 }, - { 11, 18, 34.30, -79, 40, 7.0, 6.35 }, - { 10, 52, 27.50, -79, 33, 33.8, 6.33 }, - { 8, 45, 55.20, -79, 30, 15.8, 5.79 }, - { 23, 8, 23.71, -79, 28, 50.9, 6.12 }, - { 23, 19, 8.11, -79, 28, 22.1, 6.33 }, - { 21, 38, 56.21, -79, 26, 33.0, 6.18 }, - { 6, 56, 34.39, -79, 25, 13.1, 5.45 }, - { 5, 50, 16.70, -79, 21, 41.0, 5.47 }, - { 12, 18, 20.69, -79, 18, 43.9, 4.26 }, - { 11, 42, 55.39, -79, 18, 23.0, 6.39 }, - { 1, 41, 21.31, -79, 8, 53.9, 6.33 }, - { 2, 31, 40.51, -79, 6, 33.8, 5.28 }, - { 7, 25, 37.99, -79, 5, 39.1, 5.53 }, - { 8, 43, 12.41, -79, 4, 10.9, 6.05 }, - { 14, 47, 51.60, -79, 2, 40.9, 3.83 }, - { 3, 7, 31.99, -78, 59, 21.8, 5.57 }, - { 8, 41, 19.51, -78, 57, 47.9, 5.47 }, - { 16, 33, 27.00, -78, 53, 49.9, 3.89 }, - { 5, 35, 36.31, -78, 49, 14.9, 6.05 }, - { 23, 44, 40.70, -78, 47, 29.0, 5.75 }, - { 0, 16, 49.01, -78, 46, 50.2, 6.77 }, - { 22, 35, 26.40, -78, 46, 18.1, 6.15 }, - { 16, 20, 20.81, -78, 41, 44.9, 4.68 }, - { 16, 20, 26.81, -78, 40, 1.9, 5.27 }, - { 10, 35, 28.10, -78, 36, 28.1, 4.11 }, - { 14, 0, 32.81, -78, 35, 24.0, 6.09 }, - { 12, 13, 55.70, -78, 34, 25.0, 6.35 }, - { 1, 33, 39.19, -78, 30, 16.9, 6.11 }, - { 13, 14, 17.21, -78, 26, 49.9, 5.85 }, - { 3, 29, 58.80, -78, 21, 6.8, 5.70 }, - { 1, 55, 50.50, -78, 20, 53.9, 6.16 }, - { 3, 36, 30.00, -78, 19, 23.2, 6.29 }, - { 5, 0, 13.20, -78, 18, 1.1, 6.29 }, - { 11, 59, 37.30, -78, 13, 18.8, 4.91 }, - { 15, 39, 18.29, -77, 55, 5.2, 6.18 }, - { 18, 47, 49.39, -77, 52, 1.9, 6.39 }, - { 14, 16, 54.89, -77, 39, 50.0, 6.47 }, - { 22, 1, 52.10, -77, 39, 45.0, 6.41 }, - { 4, 38, 21.70, -77, 39, 22.0, 6.05 }, - { 7, 36, 4.20, -77, 38, 3.1, 6.18 }, - { 11, 21, 57.10, -77, 36, 29.9, 6.43 }, - { 13, 33, 14.81, -77, 34, 5.9, 6.48 }, - { 16, 43, 4.61, -77, 31, 3.0, 4.24 }, - { 22, 17, 50.50, -77, 30, 42.1, 5.51 }, - { 8, 20, 38.50, -77, 29, 3.8, 4.35 }, - { 0, 21, 28.61, -77, 25, 36... [truncated message content] |
From: <and...@us...> - 2008-08-05 03:02:09
|
Revision: 684 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=684&view=rev Author: andy_miller Date: 2008-08-05 03:02:16 +0000 (Tue, 05 Aug 2008) Log Message: ----------- Further Updates for the PCZ Portal SceneManager Support Also changed paths in the CEGUI package to ensure the right dll's are loaded first Modified Paths: -------------- trunk/python-ogre/code_generators/ogrepcz/generate_code.py trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_sizeof.h trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py trunk/python-ogre/demos/ogrepcz/RoomObject.py trunk/python-ogre/demos/plugins.cfg trunk/python-ogre/packages_2.5/ogre/gui/CEGUI/__init__.py trunk/python-ogre/packages_2.5/ogre/gui/navi/__init__.py Modified: trunk/python-ogre/code_generators/ogrepcz/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/generate_code.py 2008-08-02 02:45:14 UTC (rev 683) +++ trunk/python-ogre/code_generators/ogrepcz/generate_code.py 2008-08-05 03:02:16 UTC (rev 684) @@ -63,18 +63,27 @@ excludes=['::Ogre::PCZSceneManagerFactory::initMetaData', '::Ogre::PCZSceneManagerFactory::createInstance', - '::Ogre::PCZSceneManagerFactory::destroyInstance' + '::Ogre::PCZSceneManagerFactory::destroyInstance', + '::Ogre::Portal::setCorners' # hand wrapped.. ] for e in excludes: main_ns.member_functions(e).exclude() - print "Excluded Member Function:", e + print "Excluded Member Function(s):", e excludes=['::Ogre::PCZSceneManagerFactory::FACTORY_TYPE_NAME' ] for e in excludes: main_ns.variable(e).exclude() print "Excluded Variable:", e - + +# std_ns = global_ns.namespace('std') +# for c in std_ns.classes(): +# if 'map' in c.decl_string or 'Ogre' in c.decl_string: +# print c.name, c.decl_string +# std_ns.class_('::std::vector<Ogre::Plane, std::allocator<Ogre::Plane> >') +# # std_ns.class_('::std::map<std::string, std::allocator<std::string> >') + + ############################################################ ## ## And there are things that manually need to be INCLUDED @@ -93,8 +102,29 @@ # '::Ogre::PCZone::NODE_LIST_TYPE' ] for i in includes: - main_ns.enum(i).include() - + main_ns.enum(i).include() + for c in main_ns.classes(): + if "Singleton" in c.decl_string: + print c, c.name, c.decl_string + includes = ['::Ogre::Singleton<Ogre::PCZoneFactoryManager>', + 'Ogre::Singleton<Ogre::PCZoneFactoryManager>', + '::Ogre::Singleton<::Ogre::PCZoneFactoryManager>', + 'Singleton<PCZoneFactoryManager>' + ] + for i in includes: + try: + main_ns.class_(i).include() + print "Forced Include:", i + except: + pass + + main_ns.class_('RaySceneQuery').include(already_exposed=True) + main_ns.class_('DefaultRaySceneQuery').include(already_exposed=True) + main_ns.class_('SceneQuery').include(already_exposed=True) + main_ns.class_('RaySceneQueryListener').include(already_exposed=True) + + + ############################################################ ## ## And things that need manual fixes, but not necessarly hand wrapped @@ -106,26 +136,24 @@ main_ns = global_ns.namespace( MAIN_NAMESPACE ) else: main_ns = global_ns + + includes_already = ['::std::vector<Ogre::PlaneBoundedVolume, std::allocator<Ogre::PlaneBoundedVolume> >', + '::std::vector<Ogre::Plane, std::allocator<Ogre::Plane> >', + '::std::map<std:string' + ] + includes = ['::Ogre::Singleton<Ogre::PCZoneFactoryManager>' + ] for c in global_ns.classes(): - if c.decl_string.startswith("::std::vector<Ogre::PlaneBoundedVolume, std::allocator<Ogre::PlaneBoundedVolume> >"): - print "Excluding:", c - c.include(already_exposed=True) - try: - global_ns.namespace("std").class_('vector<Ogre::PlaneBoundedVolume>, std::allocator<Ogre::BoundedVolume> >').exclude() - print "OK1" - except: - print "FAIL1" - try: - main_ns.class_("std::vector<Ogre::PlaneBoundedVolume, std::allocator<Ogre::PlaneBoundedVolume> >").exclude() - print "OK2" - except: - print "FAIL2" - try: - main_ns.class_("::std::vector<Ogre::PlaneBoundedVolume, std::allocator<Ogre::PlaneBoundedVolume> >").exclude() - print "OK3" - except: - print "FAIL3" + for i in includes_already: + if c.decl_string.startswith(i): + print "Including Special(already Exposed):", c + c.include(already_exposed=True) + for i in includes: + if c.decl_string.startswith(i): + print "Including Special:", c + c.include() + ############################################################ ## ## And things that need to have their argument and call values fixed. @@ -216,30 +244,30 @@ # the 'main'function # def generate_code(): - messages.disable( -# Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X - messages.W1020 - , messages.W1021 - , messages.W1022 - , messages.W1023 - , messages.W1024 - , messages.W1025 - , messages.W1026 - , messages.W1027 - , messages.W1028 - , messages.W1029 - , messages.W1030 - , messages.W1031 - , messages.W1035 - , messages.W1040 - , messages.W1038 - , messages.W1041 - , messages.W1036 # pointer to Python immutable member - , messages.W1033 # unnamed variables - , messages.W1018 # expose unnamed classes - , messages.W1049 # returns reference to local variable - , messages.W1014 # unsupported '=' operator - ) +# messages.disable( +# # Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X +# messages.W1020 +# , messages.W1021 +# , messages.W1022 +# , messages.W1023 +# , messages.W1024 +# , messages.W1025 +# , messages.W1026 +# , messages.W1027 +# , messages.W1028 +# , messages.W1029 +# , messages.W1030 +# , messages.W1031 +# , messages.W1035 +# , messages.W1040 +# , messages.W1038 +# , messages.W1041 +# , messages.W1036 # pointer to Python immutable member +# , messages.W1033 # unnamed variables +# , messages.W1018 # expose unnamed classes +# , messages.W1049 # returns reference to local variable +# , messages.W1014 # unsupported '=' operator +# ) # # Use GCCXML to create the controlling XML file. # If the cache file (../cache/*.xml) doesn't exist it gets created, otherwise it just gets loaded @@ -279,22 +307,25 @@ global_ns = mb.global_ns global_ns.exclude() +# # +# # I'm assuming that any 'std' classes etc we need will have already been exposed by the Ogre library +# # +# std_ns = global_ns.namespace('std') +# std_ns.include(already_exposed=True) + # We don't include all of MAIN_NAMESPACE otherwise we get the same full wrapper # so instead we include classes with names that start with PCZ main_ns = global_ns.namespace( MAIN_NAMESPACE ) -# main_ns.include() +# # main_ns.include( already_exposed = True ) ## force the ogre class to be exposed as well... + for c in main_ns.classes(): if c.name.startswith ('PCZ') or c.name.startswith ('PCPlane') or c.name.startswith ('Portal'): c.include() - print "Including ", c + print "Including ", c, c.already_exposed for c in ['Portal','PCPlane']: main_ns.class_(c).include() print "Including ", c -# for e in c.enums(allow_empty=True): -# e.include() -# for v in c.variables(allow_empty=True): -# v.include() common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualExclude ( mb ) Modified: trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py 2008-08-02 02:45:14 UTC (rev 683) +++ trunk/python-ogre/code_generators/ogrepcz/hand_made_wrappers.py 2008-08-05 03:02:16 UTC (rev 684) @@ -1,6 +1,13 @@ import os import environment + +# +# these casting calls (in General) shouldn't be needed as by default Python/Boost understands that the objects +# are 'PCZ' ones and it all works.. +# +# However adding casting functions to each class to make them into their Ogre parent types just in case +# WRAPPER_DEFINITION_General = \ """ // The following helper functions are a start and possibly need to be extended to include @@ -21,28 +28,126 @@ PCZSphereSceneQuery : public DefaultSphereSceneQuery PCZPlaneBoundedVolumeListSceneQuery : public DefaultPlaneBoundedVolumeListSceneQuery */ - - """ WRAPPER_REGISTRATION_General = [ - """bp::def( "castAsPCZSceneNode", &General_castAsPCZSceneNode, + """def( "castAsPCZSceneNode", &General_castAsPCZSceneNode, "Python-Ogre Helper Function: Casts a SceneNode as a PCZSceneNode.\\n\\ Input: SceneNode\\n\\ Ouput: PCZSceneNode",\ bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""", - """bp::def( "castAsPCZSceneManager", &General_castAsPCZSceneManager, + """def( "castAsPCZSceneManager", &General_castAsPCZSceneManager, "Python-Ogre Helper Function: Casts a SceneManager as a PCZSceneManager.\\n\\ Input: SceneManager\\n\\ Ouput: PCZSceneManager",\ bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""", - """bp::def( "castAsPCZRaySceneQuery", &General_castAsPCZRaySceneQuery, + """def( "castAsPCZRaySceneQuery", &General_castAsPCZRaySceneQuery, "Python-Ogre Helper Function: Casts a RaySceneQuery as a PCZRaySceneQuery.\\n\\ Input: RaySceneQuery\\n\\ Ouput: PCZRaySceneQuery",\ bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""", ] + +WRAPPER_DEFINITION_PCZSceneNode = \ +""" +Ogre::SceneNode * PCZSceneNode_castAsSceneNode( Ogre::PCZSceneNode * me ){ + return ((Ogre::SceneNode*) me); + } +""" +WRAPPER_REGISTRATION_PCZSceneNode = [ + """def( "castAsSceneNode", &PCZSceneNode_castAsSceneNode, + "Python-Ogre Helper Function: Casts a PCZSceneNode as a SceneNode.\\n\\ + Input: None\\n\\ + Ouput: SceneNode",\ + bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""" + ] + + + +WRAPPER_DEFINITION_PCZSceneManager = \ +""" +Ogre::SceneManager * PCZSceneManager_castAsSceneManager( Ogre::PCZSceneManager * me ){ + return ((Ogre::SceneManager*) me); + } +""" +WRAPPER_REGISTRATION_PCZSceneManager = [ + """def( "castAsSceneManager", &PCZSceneManager_castAsSceneManager, + "Python-Ogre Helper Function: Casts a PCZSceneManager as a SceneManager.\\n\\ + Input: None\\n\\ + Ouput: SceneManager",\ + bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""" + ] + + +WRAPPER_DEFINITION_PCZRaySceneQuery = \ +""" +Ogre::RaySceneQuery * PCZRaySceneQuery_castAsRaySceneQuery( Ogre::PCZRaySceneQuery * me ){ + return ( ( Ogre::RaySceneQuery* ) me ); + } +Ogre::RaySceneQueryResult& PCZRaySceneQuery_execute( Ogre::PCZRaySceneQuery * me ){ + return ((Ogre::RaySceneQuery*) me)->execute(); + } + +""" +WRAPPER_REGISTRATION_PCZRaySceneQuery = [ + """def( "castAsRaySceneQuery", &PCZRaySceneQuery_castAsRaySceneQuery, + "Python-Ogre Helper Function: Casts a PCZRaySceneQuery as a RaySceneQuery.\\n\\ + Input: None\\n\\ + Ouput: RaySceneQuery",\ + bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""", + """def( "execute", &PCZRaySceneQuery_execute, + "Python-Ogre Helper Function: Executes a query.\\n\\ + Input: None\\n\\ + Ouput: RaySceneQueryResult",\ + bp::return_value_policy< bp::default_call_policies >());""" + ] + + +WRAPPER_DEFINITION_PCZAxisAlignedBoxSceneQuery = \ +""" +Ogre::AxisAlignedBoxSceneQuery * General_castAsAxisAlignedBoxSceneQuery( Ogre::PCZAxisAlignedBoxSceneQuery * me ){ + return (Ogre::AxisAlignedBoxSceneQuery*) me; + } +""" + +WRAPPER_DEFINITION_PCZSphereSceneQuery = \ +""" +Ogre::SphereSceneQuery * General_castAsSphereSceneQuery( Ogre::PCZSphereSceneQuery * me ){ + return (Ogre::SphereSceneQuery*) me; + } +""" + +WRAPPER_DEFINITION_PCZAxisAlignedBoxSceneQuery = \ +""" +Ogre::PlaneBoundedVolumeListSceneQuery * General_castAsPlaneBoundedVolumeListSceneQuery( Ogre::PCZPlaneBoundedVolumeListSceneQuery * me ){ + return (Ogre::PlaneBoundedVolumeListSceneQuery*) me; + } +""" + + + + + +WRAPPER_DEFINITION_Portal = """ +void Portal_setCorners( ::Ogre::Portal & me, boost::python::list listin ) +{ + Ogre::Vector3 corners[4]; + size_t maxlen = len ( listin ); + if (maxlen > 4) maxlen = 4; // can only handle upto 4 'corners' + size_t counter = 0; + for (counter=0;counter < maxlen; counter ++ ) + corners[counter] = boost::python::extract<Ogre::Vector3> (listin[counter]); + me.setCorners ( corners); +} +""" +WRAPPER_REGISTRATION_Portal = [ + """def( "setCorners", &::Portal_setCorners,\\ + "Python-Ogre Helper Function: Sets the corners of a portal.\\n\\ + Input: List of Vector3's - either 2 or 4 depending on portal type\\n\\ + Output: None");""" + ] + ################################################################################################# ################################################################################################# @@ -51,6 +156,20 @@ class_.add_registration_code ( c ) def apply( mb ): + rt = mb.class_( 'Portal' ) + rt.add_declaration_code( WRAPPER_DEFINITION_Portal ) + apply_reg (rt, WRAPPER_REGISTRATION_Portal ) + + rt = mb.class_( 'PCZSceneNode' ) + rt.add_declaration_code( WRAPPER_DEFINITION_PCZSceneNode ) + apply_reg (rt, WRAPPER_REGISTRATION_PCZSceneNode ) + rt = mb.class_( 'PCZSceneManager' ) + rt.add_declaration_code( WRAPPER_DEFINITION_PCZSceneManager ) + apply_reg (rt, WRAPPER_REGISTRATION_PCZSceneManager ) + rt = mb.class_( 'PCZRaySceneQuery' ) + rt.add_declaration_code( WRAPPER_DEFINITION_PCZRaySceneQuery ) + apply_reg (rt, WRAPPER_REGISTRATION_PCZRaySceneQuery ) + mb.add_declaration_code( WRAPPER_DEFINITION_General ) apply_reg (mb, WRAPPER_REGISTRATION_General ) \ No newline at end of file Modified: trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_sizeof.h =================================================================== --- trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_sizeof.h 2008-08-02 02:45:14 UTC (rev 683) +++ trunk/python-ogre/code_generators/ogrepcz/python_ogrepcz_sizeof.h 2008-08-05 03:02:16 UTC (rev 684) @@ -1 +1,5 @@ // sizeof ( variable ); +sizeof( PCZCamera ); +sizeof ( ZoneData ); +sizeof ( Ogre::Singleton<Ogre::PCZoneFactoryManager> ); + Modified: trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py =================================================================== --- trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py 2008-08-02 02:45:14 UTC (rev 683) +++ trunk/python-ogre/demos/ogrepcz/Demo_PCZ01.py 2008-08-05 03:02:16 UTC (rev 684) @@ -27,22 +27,24 @@ import ogre.io.OIS as ois import ogre.renderer.ogrepcz as pcz -# import RoomObject +import RoomObject Global_buildingNode = None #pcz.PCZSceneNode() -Global_buildingTranslate = None # ogre.Vector3() -Global_raySceneQuery = None # ogre.RaySceneQuery() -Global_targetMO = None #ogre.MovableObject() -class PCZTestFrameListener ( sf.ExampleFrameListener): - def __init__(self, renderWindow, camera ): +class PCZTestFrameListener ( sf.FrameListener): + def __init__(self, renderWindow, sceneManager,camera ): sf.FrameListener.__init__(self, renderWindow, camera) self.moveSpeed = 15.0 - self.raySceneQueue = sceneManager.createRayQuery(ogre.Ray(camera.getPosition(), + self.targetMO =0 + self.buildingTranslate = ogre.Vector3() + + print "\n\n** :", sceneManager + self.raySceneQuery= sceneManager.createRayQuery(ogre.Ray(camera.getPosition(), ogre.Vector3.NEGATIVE_UNIT_Y)) + + print "\n\n** :", sceneManager, "\n", self.raySceneQuery self.camera = camera - self.updateRay=ogre.Ray() self.pczCameraParentNode = pcz.castAsPCZSceneNode(self.camera.getParentSceneNode()) def moveCamera( self ): @@ -53,84 +55,87 @@ self.camera.getParentSceneNode().pitch(self.rotationY) self.camera.getParentSceneNode().yaw(self.rotationX, ogre.Node.TS_WORLD) - Global_buildingNode.translate(Global_buildingTranslate, ogre.Node.TS_LOCAL) + Global_buildingNode.translate(self.buildingTranslate, ogre.Node.TS_LOCAL) def frameRenderingQueued( self, evt ): - if sf.FrameListener.frameRenderingQueued( evt ) == False: + if sf.FrameListener.frameRenderingQueued( self, evt ) == False: return False - Global_buildingTranslate = ogre.Vector3(0,0,0) - if self.keyboard.isKeyDown( ois.KC_LBRACKET ): - Global_buildingTranslate = ogre.Vector3(0,-10,0) - if self.keyboard.isKeyDown( ois.KC_RBRACKET ): - Global_buildingTranslate = ogre.Vector3(0,10,0) - if self.keyboard.isKeyDown( ois.KC_LSHIFT ) or self.keyboard.isKeyDown( ois.KC_RSHIFT ): + self.buildingTranslate = ogre.Vector3(0,0,0) + if self.Keyboard.isKeyDown( ois.KC_LBRACKET ): + self.buildingTranslate = ogre.Vector3(0,-10,0) + if self.Keyboard.isKeyDown( ois.KC_RBRACKET ): + self.buildingTranslate = ogre.Vector3(0,10,0) + if self.Keyboard.isKeyDown( ois.KC_LSHIFT ) or self.Keyboard.isKeyDown( ois.KC_RSHIFT ): self.moveSpeed = 150 - else + else: self.moveSpeed = 15 # test the ray scene query by showing bounding box of whatever the camera is pointing directly at # (takes furthest hit) - self.updateRay.setOrigin(self.camera.getParentSceneNode().getPosition()) - self.updateRay.setDirection(self.camera.getParentSceneNode().getOrientation()*ogre.Vector3.NEGATIVE_UNIT_Z) - Global_raySceneQuery.setRay(updateRay) + updateRay = ogre.Ray() + updateRay.setOrigin(self.camera.getParentSceneNode().getPosition()) + updateRay.setDirection(self.camera.getParentSceneNode().getOrientation()*ogre.Vector3.NEGATIVE_UNIT_Z) + self.raySceneQuery.setRay(updateRay) zone = self.pczCameraParentNode.getHomeZone() - pcz.castAsPCZRaySceneQuery(Global_raySceneQuery).setStartZone(zone) - pcz.castAsPCZRaySceneQuery(Global_raySceneQuery).setExcludeNode(self.camera.getParentSceneNode()) - for queryResult in Global_raySceneQuery.execute(): - ri = qryResult.rbegin() - mo = ri.movable - if Global_targetMO != mo: - if Global_targetMO != 0: - Global_targetMO.getParentSceneNode().showBoundingBox(False) - Global_targetMO = mo - Global_targetMO.getParentSceneNode().showBoundingBox(True) + pcz.castAsPCZRaySceneQuery(self.raySceneQuery).setStartZone(zone) + pcz.castAsPCZRaySceneQuery(self.raySceneQuery).setExcludeNode(self.camera.getParentSceneNode()) + rq = self.raySceneQuery.castAsRaySceneQuery() +# print "RAYQUERY", rq + for queryResult in self.raySceneQuery.execute(): # + mo = queryResult.movable + if self.targetMO != mo: + if self.targetMO != 0: + self.targetMO.getParentSceneNode().showBoundingBox(False) + self.targetMO = mo + self.targetMO.getParentSceneNode().showBoundingBox(True) return True -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.getPosition(), - ogre.Vector3.NEGATIVE_UNIT_Y)) - self.camera = camera - #self.camera.setPosition (self.camera.getPosition() + ogre.Vector3(0.0, 10.0, 0.0)) +# 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.getPosition(), +# ogre.Vector3.NEGATIVE_UNIT_Y)) +# self.camera = camera +# #self.camera.setPosition (self.camera.getPosition() + ogre.Vector3(0.0, 10.0, 0.0)) +# +# def frameStarted(self, frameEvent): +# # clamp to terrain +# updateRay = ogre.Ray() +# updateRay.setOrigin (self.camera.getPosition() + ogre.Vector3(0.0, 10.0, 0.0)) +# updateRay.setDirection (ogre.Vector3.NEGATIVE_UNIT_Y) +# self.raySceneQuery.Ray = updateRay +# for queryResult in self.raySceneQuery.execute(): +# if queryResult.worldFragment is not None: +# pos = self.camera.getPosition() +# self.camera.setPosition (pos.x, pos.y - queryResult.distance + 15.0, pos.z) +# break +# +# return sf.FrameListener.frameStarted(self, frameEvent) - def frameStarted(self, frameEvent): - # clamp to terrain - updateRay = ogre.Ray() - updateRay.setOrigin (self.camera.getPosition() + ogre.Vector3(0.0, 10.0, 0.0)) - updateRay.setDirection (ogre.Vector3.NEGATIVE_UNIT_Y) - self.raySceneQuery.Ray = updateRay - for queryResult in self.raySceneQuery.execute(): - if queryResult.worldFragment is not None: - pos = self.camera.getPosition() - self.camera.setPosition (pos.x, pos.y - queryResult.distance + 15.0, pos.z) - break - return sf.FrameListener.frameStarted(self, frameEvent) - - class PCZTestApplication (sf.Application): def __del__(self): - del Global_raySceneQuery + del self.raySceneQuery def _chooseSceneManager ( self ): # Create the SceneManager, in this case a generic one self.sceneManager = self.root.createSceneManager("PCZSceneManager", "PCZSceneManager") + print "\n****:", self.sceneManager # initialize the scene manager using terrain as default zone zoneTypeName = "ZoneType_Default" self.pczSM = pcz.castAsPCZSceneManager( self.sceneManager ) # store this for future reference self.pczSM.init(zoneTypeName) #self.sceneManager.showBoundingBoxes(True) -# def _createFrameListener( self ): -# self.frameListener= PCZTestFrameListener(self.renderWindow, self.camera) -# self.root.addFrameListener(self.frameListener) + def _createFrameListener( self ): + self.frameListener= PCZTestFrameListener(self.renderWindow, self.sceneManager,self.camera) + self.root.addFrameListener(self.frameListener) def _createCamera(self): # Create the camera @@ -210,7 +215,7 @@ # Create a skybox self.sceneManager.setSkyBox(True, "Examples/CloudyNoonSkyBox", 500 ) # put the skybox node in the default zone -# self.pczSM.setSkyZone(None) + self.pczSM.setSkyZone(None) # Create a light l = self.sceneManager.createLight("MainLight") @@ -293,31 +298,31 @@ # set far clip plane to one terrain zone width (we have a LOT of terrain here, so we need to do far clipping!) self.camera.setFarClipDistance(1500) -# # create test buildinig -# RoomObject roomObj -# Global_buildingNode = roomObj.createTestBuilding(self.sceneManager, String("1")) -# Global_buildingNode.setPosition(500, 165, 570) -# #ogre.Radian r = Radian(3.1416/7.0) -# #Global_buildingNode.rotate(ogre.Vector3.UNIT_Y, r) -# + # create test buildinig + roomObj = RoomObject.RoomObject() + Global_buildingNode = roomObj.createTestBuilding(self.sceneManager, "1") + Global_buildingNode.setPosition(500, 165, 570) + #ogre.Radian r = Radian(3.1416/7.0) + #Global_buildingNode.rotate(ogre.Vector3.UNIT_Y, r) + # # create another test buildinig -# RoomObject roomObj2 +# roomObj2 = RoomObject.RoomObject() # Global_buildingNode = roomObj2.createTestBuilding(self.sceneManager, String("2")) # Global_buildingNode.setPosition(400, 165, 570) -# #ogre.Radian r = Radian(3.1416/7.0) -# #Global_buildingNode.rotate(ogre.Vector3.UNIT_Y, r) -# -# # Position camera in the center of the building -# self.cameraNode.setPosition(Global_buildingNode.getPosition()) -# # Look back along -Z -# self.camera.lookAt(self.cameraNode._getDerivedPosition() + ogre.Vector3(0,0,-300)) -# # Update bounds for camera -# self.cameraNode._updateBounds() -# + #ogre.Radian r = Radian(3.1416/7.0) + #Global_buildingNode.rotate(ogre.Vector3.UNIT_Y, r) + + # Position camera in the center of the building + self.cameraNode.setPosition(Global_buildingNode.getPosition()) + # Look back along -Z + self.camera.lookAt(self.cameraNode._getDerivedPosition() + ogre.Vector3(0,0,-300)) + # Update bounds for camera + self.cameraNode._updateBounds() + # # create the ray scene query -# Global_raySceneQuery = self.sceneManager.createRayQuery( +# self.raySceneQuery = self.sceneManager.createRayQuery( # Ray(self.camera.getParentNode().getPosition(), ogre.Vector3.NEGATIVE_UNIT_Z)) -# Global_raySceneQuery.setSortByDistance(True, 5) +# self.raySceneQuery.setSortByDistance(True, 5) Modified: trunk/python-ogre/demos/ogrepcz/RoomObject.py =================================================================== --- trunk/python-ogre/demos/ogrepcz/RoomObject.py 2008-08-02 02:45:14 UTC (rev 683) +++ trunk/python-ogre/demos/ogrepcz/RoomObject.py 2008-08-05 03:02:16 UTC (rev 684) @@ -1,1009 +1,684 @@ ## +## Filename : RoomObject.py +## based on C++ demo in Ogre ## -## -## Filename : RoomObject.cpp -# # -# # -# # class RoomObject -# # -# # private: -# # Ogre::Vector3 points[32]; -# # int mPortalCount; -# # public: +import sys +import os +sys.path.insert(0,'..') +import PythonOgreConfig -DOOR_NONE = 0x00 -DOOR_TOP = 0x01 -DOOR_BOT = 0x02 -DOOR_FRONT = 0x04 -DOOR_BACK = 0x08 -DOOR_LEFT = 0x10 -DOOR_RIGHT = 0x20 -DOOR_ALL = 0xFF +## this here becase the Plug_PCZSceneManager.dll needs to be accessed by both the python module and the ogre plugins +if sys.platform == 'win32': + newpath = os.path.join ( os.path.abspath(os.path.dirname(__file__)), '../../plugins') + os.environ['PATH'] = newpath +';' + os.environ['PATH'] -# # -# # -#include "Ogre.h" -#include "OgreMaterial.h" -#include "RoomObject.h" -#include "OgrePortal.h" +import ogre.renderer.OGRE as ogre +import ogre.renderer.ogrepcz as pcz -using namespace Ogre -static int count = 0 +DOOR_NONE = 0x00 +DOOR_TOP = 0x01 +DOOR_BOT = 0x02 +DOOR_FRONT = 0x04 +DOOR_BACK = 0x08 +DOOR_LEFT = 0x10 +DOOR_RIGHT = 0x20 +DOOR_ALL = 0xFF -PCZSceneNode * RoomObject.createTestBuilding(Ogre::SceneManager *scene, String & name) +class RoomObject: + def __init__ ( self ): + self.initMaterial=False + self.count = 0 + self.points =[ogre.Vector3]*32 - count++ - mPortalCount = 0 - Ogre.PCZSceneManager * pczSM = (Ogre::PCZSceneManager*)scene + def createTestBuilding(self, scene,name): + self.count+=1 + pczSM = pcz.castAsPCZSceneManager(scene ) + + ## set points to building exterior size + self.createPoints(ogre.Vector3(60.0, 40.0, 60.0), ogre.Vector3(4.0, 10.0, 4.0)) + + ## create the building exterior + exterior = pczSM.createEntity( name + "_building_exterior", "building_exterior.mesh" ) + + ## make the enclosure a child node of the root scene node + exteriorNode = pcz.castAsPCZSceneNode(scene.getRootSceneNode()).createChildSceneNode(name +"_building_exterior_node", ogre.Vector3( 0, 0, 0 ) ) + exteriorNode.attachObject(exterior) + pczSM.addPCZSceneNode(exteriorNode, pczSM.getDefaultZone()) + + ## create portals for the building exterior + self.createPortals(scene, + exterior, + exteriorNode, + pczSM.getDefaultZone(), + DOOR_FRONT|DOOR_BACK|DOOR_LEFT|DOOR_RIGHT, + True) + + ## reset points to room size + self.createPoints(ogre.Vector3(20.0, 10.0, 20.0), ogre.Vector3(4.0, 10.0, 4.0)) + + ## create an interior room + room = pczSM.createEntity( name +"_room1", "room_nzpz.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = pcz.castAsPCZSceneNode(exteriorNode).createChildSceneNode( name +"_room1_node", ogre.Vector3( 0.0, 0.0, 20.0 ) ) + roomNode.attachObject(room) + + ## room needs it's own zone + zoneType = "ZoneType_Default" + zoneName = name +"_room1_zone" + newZone = pczSM.createZone(zoneType, zoneName) + newZone.setEnclosureNode(roomNode) + pczSM.addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + self.createPortals(scene, + room, + roomNode, + newZone, + DOOR_FRONT|DOOR_BACK, + False) + + ## create another interior room + room = pczSM.createEntity( name +"_room2", "room_nxpxnypynzpz.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = pcz.castAsPCZSceneNode(exteriorNode).createChildSceneNode( name +"_room2_node", ogre.Vector3( 0.0, 0.0, 0.0 ) ) + roomNode.attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room2_zone" + newZone = pczSM.createZone(zoneType, zoneName) + newZone.setEnclosureNode(roomNode) + pczSM.addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + self.createPortals(scene, + room, + roomNode, + newZone, + DOOR_FRONT|DOOR_BACK|DOOR_LEFT|DOOR_RIGHT|DOOR_TOP|DOOR_BOT, + False) + + ## create another interior room + room = pczSM.createEntity( name +"_room3", "room_nzpz.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = pcz.castAsPCZSceneNode(exteriorNode).createChildSceneNode( name +"_room3_node", ogre.Vector3( 0.0, 0.0, -20.0 ) ) + roomNode.attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room3_zone" + newZone = pczSM.createZone(zoneType, zoneName) + newZone.setEnclosureNode(roomNode) + pczSM.addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + self.createPortals(scene, + room, + roomNode, + newZone, + DOOR_FRONT|DOOR_BACK, + False) + + ## create another interior room + room = pczSM.createEntity( name +"_room4", "room_nxpx.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = pcz.castAsPCZSceneNode(exteriorNode).createChildSceneNode( name +"_room4_node", ogre.Vector3( -20.0, 0.0, 0.0 ) ) + roomNode.attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room4_zone" + newZone = pczSM.createZone(zoneType, zoneName) + newZone.setEnclosureNode(roomNode) + pczSM.addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + self.createPortals(scene, + room, + roomNode, + newZone, + DOOR_LEFT|DOOR_RIGHT, + False) + + ## create another interior room + room = pczSM.createEntity( name +"_room5", "room_nxpx.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = pcz.castAsPCZSceneNode(exteriorNode).createChildSceneNode( name +"_room5_node", ogre.Vector3( 20.0, 0.0, 0.0 ) ) + roomNode.attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room5_zone" + newZone = pczSM.createZone(zoneType, zoneName) + newZone.setEnclosureNode(roomNode) + pczSM.addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + self.createPortals(scene, + room, + roomNode, + newZone, + DOOR_LEFT|DOOR_RIGHT, + False) + + ## create another interior room + room = pczSM.createEntity( name +"_room6", "room_ny.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = pcz.castAsPCZSceneNode(exteriorNode).createChildSceneNode( name +"_room6_node", ogre.Vector3( 0.0, 10.0, 0.0 ) ) + roomNode.attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room6_zone" + newZone = pczSM.createZone(zoneType, zoneName) + newZone.setEnclosureNode(roomNode) + pczSM.addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + self.createPortals(scene, + room, + roomNode, + newZone, + DOOR_BOT, + False) + + ## create another interior room + room = pczSM.createEntity( name +"_room7", "room_py.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = pcz.castAsPCZSceneNode(exteriorNode).createChildSceneNode( name +"_room7_node", ogre.Vector3( 0.0, -50.0, 0.0 ) ) + roomNode.attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room7_zone" + newZone = pczSM.createZone(zoneType, zoneName) + newZone.setEnclosureNode(roomNode) + pczSM.addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + self.createPortals(scene, + room, + roomNode, + newZone, + DOOR_TOP, + False) + + ## reset points to tall room size + self.createPoints(ogre.Vector3(20.0, 40.0, 20.0), ogre.Vector3(4.0, 10.0, 4.0)) + + ## create another interior room + room = pczSM.createEntity( name +"_room8", "room_nypy_4y.mesh" ) + + ## add the room as a child node to the enclosure node + roomNode = pcz.castAsPCZSceneNode(exteriorNode).createChildSceneNode( name +"_room8_node", ogre.Vector3( 0.0, -25.0, 0.0 ) ) + roomNode.attachObject(room) + + ## room needs it's own zone + zoneName = name +"_room8_zone" + newZone = pczSM.createZone(zoneType, zoneName) + newZone.setEnclosureNode(roomNode) + pczSM.addPCZSceneNode(roomNode, newZone) + + ## create portals for the room + self.createPortals(scene, + room, + roomNode, + newZone, + DOOR_BOT|DOOR_TOP, + False) + + + ## resolve portal zone pointers + pczSM.connectPortalsToTargetZonesByLocation() + + return exteriorNode - ## set points to building exterior size - createPoints(Vector3(60.0, 40.0, 60.0), Vector3(4.0, 10.0, 4.0)) - ## create the building exterior - Entity *exterior = pczSM->createEntity( name + "_building_exterior", "building_exterior.mesh" ) - ## make the enclosure a child node of the root scene node - PCZSceneNode * exteriorNode - exteriorNode = (PCZSceneNode*)scene->getRootSceneNode()->createChildSceneNode(name +"_building_exterior_node", Vector3( 0.0, 0.0f, 0.0f ) ) - exteriorNode->attachObject(exterior) - pczSM->addPCZSceneNode(exteriorNode, pczSM->getDefaultZone()) + def createRoom(self, scene, name, doorFlags, isEnclosure, dimensions, doorDimensions): + self.addMaterial(name, ogre.ColourValue(1,1,1,.75), Ogre.SBT_TRANSPARENT_ALPHA) + room = scene.createManualObject(name) + room.begin(name, ogre.RenderOperation.OT_TRIANGLE_LIST) + + ## create points + self.createPoints(dimensions, doorDimensions) + + fade=0.5 + solid=0.8 + color = ogre.ColourValue(0, 0, solid, solid) + + ## copy to room + for i in range(32): + room.position(self.self.points[i]) + room.colour(color) + + self.createWalls(room, doorFlags, isEnclosure) + room.end() + return room - ## create portals for the building exterior - createPortals(scene, - exterior, - exteriorNode, - pczSM->getDefaultZone(), - DOOR_FRONT|DOOR_BACK|DOOR_LEFT|DOOR_RIGHT, - True) - ## reset points to room size - createPoints(Vector3(20.0, 10.0, 20.0), Vector3(4.0, 10.0, 4.0)) + def addMaterial( self, mat, clr, sbt): + if(self.initMaterial): + return + else: + self.initMaterial=True + + matptr = ogre.MaterialManager.getSingleton().create(mat, "General") + matptr.setReceiveShadows(False) + matptr.getTechnique(0).setLightingEnabled(True) + matptr.getTechnique(0).getPass(0).setDiffuse(clr) + matptr.getTechnique(0).getPass(0).setAmbient(clr) + matptr.getTechnique(0).getPass(0).setSelfIllumination(clr) + matptr.getTechnique(0).getPass(0).setSceneBlending(sbt) + matptr.getTechnique(0).getPass(0).setLightingEnabled(False) + matptr.getTechnique(0).getPass(0).setVertexColourTracking(Ogre.TVC_DIFFUSE) - ## create an interior room - Entity *room = pczSM->createEntity( name +"_room1", "room_nzpz.mesh" ) - ## add the room as a child node to the enclosure node - PCZSceneNode * roomNode - roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room1_node", Vector3( 0.0, 0.0f, 20.0f ) ) - roomNode->attachObject(room) + def createPoints(self, dimensions, doorDimensions): - ## room needs it's own zone - Ogre.String zoneType = "ZoneType_Default" - Ogre.String zoneName = name +"_room1_zone" - PCZone * newZone = pczSM->createZone(zoneType, zoneName) - newZone->setEnclosureNode(roomNode) - pczSM->addPCZSceneNode(roomNode, newZone) + l = dimensions.x/2 + h = dimensions.y/2 + w = dimensions.z/2 + + ## 4 7 + ## *-------* + ## /| /| + ## / | / | y + ## / 5| 3/ 6| | + ## 0*---*---*---* *-- x + ## | / | / / + ## | / | / z + ## |/ |/ + ## 1*-------*2 + + self.points[0] = ogre.Vector3(-l, h, w) ##0 + self.points[1] = ogre.Vector3(-l, -h, w) ##1 + self.points[2] = ogre.Vector3(l, -h, w) ##2 + self.points[3] = ogre.Vector3(l, h, w) ##3 + + self.points[4] = ogre.Vector3(-l, h, -w) ##4 + self.points[5] = ogre.Vector3(-l, -h, -w) ##5 + self.points[6] = ogre.Vector3(l, -h, -w) ##6 + self.points[7] = ogre.Vector3(l, h, -w) ##7 + + ## doors + l2 = doorDimensions.x/2 + h2 = doorDimensions.y/2 + w2 = doorDimensions.z/2 + + ## front door + self.points[8] = ogre.Vector3(-l2, h2, w) ##8 + self.points[9] = ogre.Vector3(-l2, -h2, w) ##9 + self.points[10] = ogre.Vector3(l2, -h2, w) ##10 + self.points[11] = ogre.Vector3(l2, h2, w) ##11 + + ## back door + self.points[12] = ogre.Vector3(-l2, h2, -w) ##12 + self.points[13] = ogre.Vector3(-l2, -h2, -w) ##13 + self.points[14] = ogre.Vector3(l2, -h2, -w) ##14 + self.points[15] = ogre.Vector3(l2, h2, -w) ##15 + + ## top door + self.points[16] = ogre.Vector3(-l2, h, -w2) ##16 + self.points[17] = ogre.Vector3(-l2, h, w2) ##17 + self.points[18] = ogre.Vector3(l2, h, w2) ##18 + self.points[19] = ogre.Vector3(l2, h, -w2) ##19 + + ## bottom door + self.points[20] = ogre.Vector3(-l2, -h, -w2) ##20 + self.points[21] = ogre.Vector3(-l2, -h, w2) ##21 + self.points[22] = ogre.Vector3(l2, -h, w2) ##22 + self.points[23] = ogre.Vector3(l2, -h, -w2) ##23 + + ## left door + self.points[24] = ogre.Vector3(-l, h2, w2) ##24 + self.points[25] = ogre.Vector3(-l, -h2, w2) ##25 + self.points[26] = ogre.Vector3(-l, -h2, -w2) ##26 + self.points[27] = ogre.Vector3(-l, h2, -w2) ##27 + + ## right door + self.points[28] = ogre.Vector3(l, h2, w2) ##28 + self.points[29] = ogre.Vector3(l, -h2, w2) ##29 + self.points[30] = ogre.Vector3(l, -h2, -w2) ##30 + self.points[31] = ogre.Vector3(l, h2, -w2) ##31 - ## create portals for the room - createPortals(scene, - room, - roomNode, - newZone, - DOOR_FRONT|DOOR_BACK, - False) - ## create another interior room - room = pczSM->createEntity( name +"_room2", "room_nxpxnypynzpz.mesh" ) + def createWalls(self, room, doorFlags, isEnclosure): + if (isEnclosure): + if(doorFlags & DOOR_FRONT): + ## make front wall outward facing with door + room.quad(0, 8, 11, 3) + room.quad(1, 9, 8, 0) + room.quad(2, 10, 9, 1) + room.quad(3, 11, 10, 2) + else: + ## make front wall outward facing without door + room.quad(0, 1, 2, 3) + + if(doorFlags & DOOR_BACK): + ## make back wall outward facing with door + room.quad(7, 15, 12, 4) + room.quad(6, 14, 15, 7) + room.quad(5, 13, 14, 6) + room.quad(4, 12, 13, 5) + else: + ## make back wall outward facing without door + room.quad(7, 6, 5, 4) + + if(doorFlags & DOOR_TOP): + ## make top wall outward facing with door + room.quad(0, 17, 16, 4) + room.quad(4, 16, 19, 7) + room.quad(7, 19, 18, 3) + room.quad(3, 18, 17, 0) + else: + ## make top wall outward facing without door + room.quad(0, 3, 7, 4) + + if(doorFlags & DOOR_BOT): + ## make bottom wall outward facing with door + room.quad(5, 20, 21, 1) + room.quad(6, 23, 20, 5) + room.quad(2, 22, 23, 6) + room.quad(1, 21, 22, 2) + else: + ## make bottom wall outward facing without door + room.quad(2, 1, 5, 6) + + if(doorFlags & DOOR_LEFT): + ## make left wall outward facing with door + room.quad(0, 24, 25, 1) + room.quad(4, 27, 24, 0) + room.quad(5, 26, 27, 4) + room.quad(1, 25, 26, 5) + else: + ## make left side wall outward facing without door + room.quad(1, 0, 4, 5) + + if(doorFlags & DOOR_RIGHT): + ## make right wall outward facing with door + room.quad(2, 29, 28, 3) + room.quad(6, 30, 29, 2) + room.quad(7, 31, 30, 6) + room.quad(3, 28, 31, 7) + else: + ## make right side wall outward facing without door + room.quad(3, 2, 6, 7) + + else: + + ## front back + if(doorFlags & DOOR_FRONT): + ## make front wall inward facing with door + room.quad(3, 11, 8, 0) + room.quad(0, 8, 9, 1) + room.quad(1, 9, 10, 2) + room.quad(2, 10, 11, 3) + else: + ## make front wall inward facing without door + room.quad(3, 2, 1, 0) + + if(doorFlags & DOOR_BACK): + ## make back wall inward facing with door + room.quad(4, 12, 15, 7) + room.quad(7, 15, 14, 6) + room.quad(6, 14, 13, 5) + room.quad(5, 13, 12, 4) + else: + ## make back wall inward facing without door + room.quad(4, 5, 6, 7) + + ## top bottom + if(doorFlags & DOOR_TOP): + ## make top wall inward facing with door + room.quad(4, 16, 17, 0) + room.quad(7, 19, 16, 4) + room.quad(3, 18, 19, 7) + room.quad(0, 17, 18, 3) + else: + ## make top wall inward facing without door + room.quad(4, 7, 3, 0) + + if(doorFlags & DOOR_BOT): + ## make bottom wall inward facing with door + room.quad(1, 21, 20, 5) + room.quad(5, 20, 23, 6) + room.quad(6, 23, 22, 2) + room.quad(2, 22, 21, 1) + else: + ## make bottom wall inward facing without door + room.quad(6, 5, 1, 2) + + ## end caps + if(doorFlags & DOOR_LEFT): + ## make left wall inward facing with door + room.quad(1, 25, 24, 0) + room.quad(0, 24, 27, 4) + room.quad(4, 27, 26, 5) + room.quad(5, 26, 25, 1) + else: + ## make left side wall inward facing without door + room.quad(5, 4, 0, 1) + + if(doorFlags & DOOR_RIGHT): + ## make right wall inward facing with door + room.quad(3, 28, 29, 2) + room.quad(2, 29, 30, 6) + room.quad(6, 30, 31, 7) + room.quad(7, 31, 28, 3) + else: + ## make right side wall inward facing without door + room.quad(7, 6, 2, 3) - ## add the room as a child node to the enclosure node - roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room2_node", Vector3( 0.0, 0.0f, 0.0f ) ) - roomNode->attachObject(room) - - ## room needs it's own zone - zoneName = name +"_room2_zone" - newZone = pczSM->createZone(zoneType, zoneName) - newZone->setEnclosureNode(roomNode) - pczSM->addPCZSceneNode(roomNode, newZone) - - ## create portals for the room - createPortals(scene, - room, - roomNode, - newZone, - DOOR_FRONT|DOOR_BACK|DOOR_LEFT|DOOR_RIGHT|DOOR_TOP|DOOR_BOT, - False) - - ## create another interior room - room = pczSM->createEntity( name +"_room3", "room_nzpz.mesh" ) - - ## add the room as a child node to the enclosure node - roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room3_node", Vector3( 0.0, 0.0f, -20.0f ) ) - roomNode->attachObject(room) - - ## room needs it's own zone - zoneName = name +"_room3_zone" - newZone = pczSM->createZone(zoneType, zoneName) - newZone->setEnclosureNode(roomNode) - pczSM->addPCZSceneNode(roomNode, newZone) - - ## create portals for the room - createPortals(scene, - room, - roomNode, - newZone, - DOOR_FRONT|DOOR_BACK, - False) - - ## create another interior room - room = pczSM->createEntity( name +"_room4", "room_nxpx.mesh" ) - - ## add the room as a child node to the enclosure node - roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room4_node", Vector3( -20.0, 0.0f, 0.0f ) ) - roomNode->attachObject(room) - - ## room needs it's own zone - zoneName = name +"_room4_zone" - newZone = pczSM->createZone(zoneType, zoneName) - newZone->setEnclosureNode(roomNode) - pczSM->addPCZSceneNode(roomNode, newZone) - - ## create portals for the room - createPortals(scene, - room, - roomNode, - newZone, - DOOR_LEFT|DOOR_RIGHT, - False) - - ## create another interior room - room = pczSM->createEntity( name +"_room5", "room_nxpx.mesh" ) - - ## add the room as a child node to the enclosure node - roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room5_node", Vector3( 20.0, 0.0f, 0.0f ) ) - roomNode->attachObject(room) - - ## room needs it's own zone - zoneName = name +"_room5_zone" - newZone = pczSM->createZone(zoneType, zoneName) - newZone->setEnclosureNode(roomNode) - pczSM->addPCZSceneNode(roomNode, newZone) - - ## create portals for the room - createPortals(scene, - room, - roomNode, - newZone, - DOOR_LEFT|DOOR_RIGHT, - False) - - ## create another interior room - room = pczSM->createEntity( name +"_room6", "room_ny.mesh" ) - - ## add the room as a child node to the enclosure node - roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room6_node", Vector3( 0.0, 10.0f, 0.0f ) ) - roomNode->attachObject(room) - - ## room needs it's own zone - zoneName = name +"_room6_zone" - newZone = pczSM->createZone(zoneType, zoneName) - newZone->setEnclosureNode(roomNode) - pczSM->addPCZSceneNode(roomNode, newZone) - - ## create portals for the room - createPortals(scene, - room, - roomNode, - newZone, - DOOR_BOT, - False) - - ## create another interior room - room = pczSM->createEntity( name +"_room7", "room_py.mesh" ) - - ## add the room as a child node to the enclosure node - roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room7_node", Vector3( 0.0, -50.0f, 0.0f ) ) - roomNode->attachObject(room) - - ## room needs it's own zone - zoneName = name +"_room7_zone" - newZone = pczSM->createZone(zoneType, zoneName) - newZone->setEnclosureNode(roomNode) - pczSM->addPCZSceneNode(roomNode, newZone) - - ## create portals for the room - createPortals(scene, - room, - roomNode, - newZone, - DOOR_TOP, - False) - - ## reset points to tall room size - createPoints(Vector3(20.0, 40.0, 20.0), Vector3(4.0, 10.0, 4.0)) - - ## create another interior room - room = pczSM->createEntity( name +"_room8", "room_nypy_4y.mesh" ) - - ## add the room as a child node to the enclosure node - roomNode = (PCZSceneNode*)exteriorNode->createChildSceneNode( name +"_room8_node", Vector3( 0.0, -25.0f, 0.0f ) ) - roomNode->attachObject(room) - - ## room needs it's own zone - zoneName = name +"_room8_zone" - newZone = pczSM->createZone(zoneType, zoneName) - newZone->setEnclosureNode(roomNode) - pczSM->addPCZSceneNode(roomNode, newZone) - - ## create portals for the room - createPortals(scene, - room, - roomNode, - newZone, - DOOR_BOT|DOOR_TOP, - False) - - - ## resolve portal zone pointers - pczSM->connectPortalsToTargetZonesByLocation() - - return exteriorNode - - - -Ogre.ManualObject* RoomObject::createRoom(Ogre::SceneManager *scene, - Ogre.String &name, - short doorFlags, - bool isEnclosure, - Ogre.Vector3 dimensions, - Ogre.Vector3 doorDimensions) - - addMaterial(name, Ogre.ColourValue(1,1,1,.75), Ogre::SBT_TRANSPARENT_ALPHA) - - Ogre.ManualObject* room = scene->createManualObject(name) - - room->begin(name, Ogre.RenderOperation::OT_TRIANGLE_LIST) - - ## create points - createPoints(dimensions, doorDimensions) - - Ogre.Real fade=.5 - Ogre.Real solid=.8 - Ogre.ColourValue color = ColourValue(0, 0, solid, solid) - - ## copy to room - for (int i=0 i<32;i++) - - room->position(points[i]) - room->colour(color) - - - createWalls(room, doorFlags, isEnclosure) - - room->end() - - return room - - -void RoomObject.addMaterial( Ogre::String &mat, - Ogre.ColourValue &clr, - Ogre.SceneBlendType sbt) - - static int init=False - if(init): - return - else: - init=True - - Ogre.MaterialPtr matptr = Ogre::MaterialManager::getSingleton().create(mat, "General") - matptr->setReceiveShadows(False) - matptr->getTechnique(0)->setLightingEnabled(True) - matptr->getTechnique(0)->getPass(0)->setDiffuse(clr) - matptr->getTechnique(0)->getPass(0)->setAmbient(clr) - matptr->getTechnique(0)->getPass(0)->setSelfIllumination(clr) - matptr->getTechnique(0)->getPass(0)->setSceneBlending(sbt) - matptr->getTechnique(0)->getPass(0)->setLightingEnabled(False) - matptr->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre.TVC_DIFFUSE) - - -void RoomObject.createPoints(Ogre::Vector3 dimensions, - Ogre.Vector3 doorDimensions) - - Ogre.Real l = dimensions.x/2 - Ogre.Real h = dimensions.y/2 - Ogre.Real w = dimensions.z/2 - -## 4 7 -## *-------* -## /| /| -## / | / | y -## / 5| 3/ 6| | -## 0*---*---*---* *-- x -## | / | / / -## | / | / z -## |/ |/ -## 1*-------*2 - - points[0] = Ogre.Vector3(-l, h, w) ##0 - points[1] = Ogre.Vector3(-l, -h, w) ##1 - points[2] = Ogre.Vector3(l, -h, w) ##2 - points[3] = Ogre.Vector3(l, h, w) ##3 - - points[4] = Ogre.Vector3(-l, h, -w) ##4 - points[5] = Ogre.Vector3(-l, -h, -w) ##5 - points[6] = Ogre.Vector3(l, -h, -w) ##6 - points[7] = Ogre.Vector3(l, h, -w) ##7 - - ## doors - Ogre.Real l2 = doorDimensions.x/2 - Ogre.Real h2 = doorDimensions.y/2 - Ogre.Real w2 = doorDimensions.z/2 - - ## front door - points[8] = Ogre.Vector3(-l2, h2, w) ##8 - points[9] = Ogre.Vector3(-l2, -h2, w) ##9 - points[10] = Ogre.Vector3(l2, -h2, w) ##10 - points[11] = Ogre.Vector3(l2, h2, w) ##11 - - ## back door - points[12] = Ogre.Vector3(-l2, h2, -w) ##12 - points[13] = Ogre.Vector3(-l2, -h2, -w) ##13 - points[14] = Ogre.Vector3(l2, -h2, -w) ##14 - points[15] = Ogre.Vector3(l2, h2, -w) ##15 - - ## top door - points[16] = Ogre.Vector3(-l2, h, -w2) ##16 - points[17] = Ogre.Vector3(-l2, h, w2) ##17 - points[18] = Ogre.Vector3(l2, h, w2) ##18 - points[19] = Ogre.Vector3(l2, h, -w2) ##19 - - ## bottom door - points[20] = Ogre.Vector3(-l2, -h, -w2) ##20 - points[21] = Ogre.Vector3(-l2, -h, w2) ##21 - points[22] = Ogre.Vector3(l2, -h, w2) ##22 - points[23] = Ogre.Vector3(l2, -h, -w2) ##23 - - ## left door - points[24] = Ogre.Vector3(-l, h2, w2) ##24 - points[25] = Ogre.Vector3(-l, -h2, w2) ##25 - points[26] = Ogre.Vector3(-l, -h2, -w2) ##26 - points[27] = Ogre.Vector3(-l, h2, -w2) ##27 - - ## right door - points[28] = Ogre.Vector3(l, h2, w2) ##28 - points[29] = Ogre.Vector3(l, -h2, w2) ##29 - points[30] = Ogre.Vector3(l, -h2, -w2) ##30 - points[31] = Ogre.Vector3(l, h2, -w2) ##31 - - -void RoomObject.createWalls(Ogre::ManualObject* room, - short doorFlags, - bool isEnclosure) - - - if (isEnclosure): - - if(doorFlags & DOOR_FRONT): - - ## make front wall outward facing with door - room->quad(0, 8, 11, 3) - room->quad(1, 9, 8, 0) - room->quad(2, 10, 9, 1) - room->quad(3, 11, 10, 2) - - else: - - ## make front wall outward facing without door - room->quad(0, 1, 2, 3) - - if(doorFlags & DOOR_BACK): - - ## make back wall outward facing with door - room->quad(7, 15, 12, 4) - room->quad(6, 14, 15, 7) - room->quad(5, 13, 14, 6) - room->quad(4, 12, 13, 5) - - else: - - ## make back wall outward facing without door - room->quad(7, 6, 5, 4) - - if(doorFlags & DOOR_TOP): - - ## make top wall outward facing with door - room->quad(0, 17, 16, 4) - room->quad(4, 16, 19, 7) - room->quad(7, 19, 18, 3) - room->quad(3, 18, 17, 0) - - else: - - ## make top wall outward facing without door - room->quad(0, 3, 7, 4) - - if(doorFlags & DOOR_BOT): - - ## make bottom wall outward facing with door - room->quad(5, 20, 21, 1) - room->quad(6, 23, 20, 5) - room->quad(2, 22, 23, 6) - room->quad(1, 21, 22, 2) - - else: - - ## make bottom wall outward facing without door - room->quad(2, 1, 5, 6) - - if(doorFlags & DOOR_LEFT): - - ## make left wall outward facing with door - room->quad(0, 24, 25, 1) - room->quad(4, 27, 24, 0) - room->quad(5, 26, 27, 4) - room->quad(1, 25, 26, 5) - - else: - - ## make left side wall outward facing without door - room->quad(1, 0, 4, 5) - - if(doorFlags & DOOR_RIGHT): - - ## make right wall outward facing with door - room->quad(2, 29, 28, 3) - room->quad(6, 30, 29, 2) - room->quad(7, 31, 30, 6) - room->quad(3, 28, 31, 7) - - else: - - ## make right side wall outward facing without door - room->quad(3, 2, 6, 7) - - - else: - - ## front back - if(doorFlags & DOOR_FRONT): - - ## make front wall inward facing with door - room->quad(3, 11, 8, 0) - room->quad(0, 8, 9, 1) - room->quad(1, 9, 10, 2) - room->quad(2, 10, 11, 3) - - else: - - ## make front wall inward facing without door - room->quad(3, 2, 1, 0) - - if(doorFlags & DOOR_BACK): - - ## make back wall inward facing with door - room->quad(4, 12, 15, 7) - room->quad(7, 15, 14, 6) - room->quad(6, 14, 13, 5) - room->quad(5, 13, 12, 4) - - else: - - ## make back wall inward facing without door - room->quad(4, 5, 6, 7) - - ## top bottom - if(doorFlags & DOOR_TOP): - - ## make top wall inward facing with door - room->quad(4, 16, 17, 0) - room->quad(7, 19, 16, 4) - room->quad(3, 18, 19, 7) - room->quad(0, 17, 18, 3) - - else: - - ## make top wall inward facing without door - room->quad(4, 7, 3, 0) - - if(doorFlags & DOOR_BOT): - - ## make bottom wall inward facing with door - room->quad(1, 21, 20, 5) - room->quad(5, 20, 23, 6) - room->quad(6, 23, 22, 2) - room->quad(2, 22, 21, 1) - - else: - - ## make bottom wall inward facing without door - room->quad(6, 5, 1, 2) - - ## end caps - if(doorFlags & DOOR_LEFT): - - ## make left wall inward facing with door - room->quad(1, 25, 24, 0) - room->quad(0, 24, 27, 4) - room->quad(4, 27, 26, 5) - room->quad(5, 26, 25, 1) - - else: - - ## make left side wall inward facing without door - room->quad(5, 4, 0, 1) - - if(doorFlags & DOOR_RIGHT): - - ## make right wall inward facing with door - room->quad(3, 28, 29, 2) - room->quad(2, 29, 30, 6) - room->quad(6, 30, 31, 7) - room->quad(7, 31, 28, 3) - - else: - - ## make right sid... [truncated message content] |
From: <and...@us...> - 2008-08-09 21:51:27
|
Revision: 686 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=686&view=rev Author: andy_miller Date: 2008-08-09 21:51:33 +0000 (Sat, 09 Aug 2008) Log Message: ----------- Small but significant change to expose "overlapping" transformed functions in a more useful way (createive alias now generated) New patch (for Ogre 1.6 SVN) to make renderQueue functions work Modified Paths: -------------- trunk/python-ogre/code_generators/common_utils/__init__.py trunk/python-ogre/code_generators/ogre/generate_code.py trunk/python-ogre/code_generators/ogrenewt/generate_code.py Added Paths: ----------- trunk/python-ogre/patch/ogre_1.6.patch Removed Paths: ------------- trunk/python-ogre/patch/ogre_1.7.patch Modified: trunk/python-ogre/code_generators/common_utils/__init__.py =================================================================== --- trunk/python-ogre/code_generators/common_utils/__init__.py 2008-08-05 07:25:40 UTC (rev 685) +++ trunk/python-ogre/code_generators/common_utils/__init__.py 2008-08-09 21:51:33 UTC (rev 686) @@ -1,4 +1,5 @@ import os, shutil +import sys import shared_ptr ##import hashlib ## makes this 2.5 dependent import md5 @@ -216,6 +217,7 @@ def Auto_Functional_Transformation ( mb, ignore_funs=[], special_vars=[]): toprocess = [] + aliases={} for fun in mb.member_functions(allow_empty=True): toprocess.append( fun ) for fun in mb.free_functions(allow_empty=True): @@ -229,6 +231,7 @@ arg_position = 0 trans=[] desc="" + ctypes_conversion = False for arg in fun.arguments: rawarg = declarations.remove_declarated( declarations.remove_const( @@ -245,6 +248,8 @@ trans.append( ft.modify_type(arg_position,_ReturnUnsignedInt ) ) desc = desc +"Argument: "+arg.name+ "( pos:" + str(arg_position) + " - " +\ arg.type.decl_string + " ) takes a CTypes.addressof(xx). \\n" + ctypes_conversion = True + ctypes_arg = arg.type.decl_string.split()[0] elif declarations.is_reference(arg.type): trans.append( ft.inout(arg_position ) ) desc = desc + "Argument: "+arg.name+ "( pos:" + str(arg_position) + " - " +\ @@ -256,17 +261,35 @@ arg_position += 1 if trans: if fun.documentation: # it's already be tweaked: - print "AUTOFT ERROR: Duplicate Tranforms.", fun + print "AUTOFT ERROR: Duplicate Tranforms.", fun, fun.documentation elif fun.virtuality == "pure virtual": print "AUTOFT WARNING: PURE VIRTUAL function requires tranform.", fun else: - print "AUTOFT OK: Tranformed ", fun - fun.add_transformation ( * trans , **{"alias":fun.name} ) + new_alias = fun.name + if ctypes_conversion: # only manage name changes if ctypes changing + # now lets look for a duplicate function name with the same number arguments + f= [None]*len(fun.arguments) + s = mb.member_functions("::" + fullname, arg_types=f, allow_empty=True) + if len (s) > 1: + # there are duplicate names so need to create something unique + ctypes_arg = ctypes_arg.replace("::", "_") # to clean up function names... + new_alias = fun.name + ctypes_arg[0].upper() + ctypes_arg[1:] + # now for REAL ugly code -- we have faked a new alias and it may not be unique + # so we track previous alias + class name to ensure unique names are generated + keyname = fullname + new_alias # we use the full class + function name + alias as the key + if keyname in aliases: # already exists, need to fake another version.. + new_alias = new_alias + "_" + str( aliases[keyname] ) + aliases[keyname] = aliases[keyname] + 1 + else: + aliases[keyname] = 1 + print "INFO: Adjusting Alias as multiple overlapping functions:", new_alias + + print "AUTOFT OK: Tranformed ", fun, "(",new_alias,")" + fun.add_transformation ( * trans , **{"alias":new_alias} ) fun.documentation = docit ("Auto Modified Arguments:", desc, "...") except: - pass - + print "Unexpected error:", sys.exc_info()[0] def Fix_Void_Ptr_Args ( mb, pointee_types=['unsigned int','int', 'float', 'unsigned char', 'char', 'bool'], ignore_names=[] ): """ we modify functions that take void *'s in their argument list to instead take Modified: trunk/python-ogre/code_generators/ogre/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogre/generate_code.py 2008-08-05 07:25:40 UTC (rev 685) +++ trunk/python-ogre/code_generators/ogre/generate_code.py 2008-08-09 21:51:33 UTC (rev 686) @@ -500,10 +500,28 @@ # # # x.documentation = docit ("", "format", "rgba" ) # # # # # # + + + + + # # # ## these need updates to Py++ to handle pointers -# # # # # x = ns.mem_fun('::Ogre::PixelUtil::unpackColour', arg_types=['float *','float *','float *','float *',None,None]) -# # # # # x.add_transformation(ft.output('r'), ft.output('g'), ft.output('b'), ft.output('a') ) -# # # # # x.documentation = docit ("", "Pixelformat, src", "r,g,b,a" ) +# x = ns.mem_fun('::Ogre::PixelUtil::packColour', arg_types=['Ogre::uint8','Ogre::uint8','Ogre::uint8','Ogre::uint8',None,None]) +# x.add_transformation(ft.modify_type(5,_ReturnUnsignedInt ), alias= "packColourUint" ) +# x.documentation = docit ("", "r,g,b,a,Pixelformat, src", "" ) +# +# x = ns.mem_fun('::Ogre::PixelUtil::packColour', arg_types=['float','float','float','float',None,None]) +# x.add_transformation(ft.modify_type(5,_ReturnUnsignedInt ), alias= "packColourFloat" ) +# x.documentation = docit ("", "r,g,b,a,Pixelformat, src", "" ) +# +# x = ns.mem_fun('::Ogre::PixelUtil::unpackColour', arg_types=['float *','float *','float *','float *',None,None]) +# x.add_transformation(ft.output('r'), ft.output('g'), ft.output('b'), ft.output('a'), alias="unpackColourFloat ) +# x.documentation = docit ("", "Pixelformat, src", "r,g,b,a" ) +# +# x = ns.mem_fun('::Ogre::PixelUtil::unpackColour', arg_types=['float *','float *','float *','float *',None,None]) +# x.add_transformation(ft.output('r'), ft.output('g'), ft.output('b'), ft.output('a'), alias="unpackColourFloat ) +# x.documentation = docit ("", "Pixelformat, src", "r,g,b,a" ) + # # # # # # # # x = ns.mem_fun('::Ogre::Frustum::projectSphere') # # # # # x.add_transformation(ft.output('left'), ft.output('top'), ft.output('right'), ft.output('bottom') ) @@ -1038,6 +1056,24 @@ ## need to create a welcome doc string for this... common_utils.add_constants( mb, { '__doc__' : '"Python-Ogre Main Module for OGRE 3D"' } ) + count = 0 + for v in main_ns.variables(): + if not v.ignore: + count +=1 +# v.exclude() + print "\n\nSPECIAL -- variables:", count + count = 0 + for v in main_ns.member_functions(): + if not v.ignore: + count +=1 +# v.exclude() + print "\n\nSPECIAL -- member functions:", count + count=0 + for v in main_ns.classes(): + if not v.ignore: + count +=1 +# v.exclude() + print "\n\nSPECIAL -- Number classes:", count ########################################################################################## # # Creating the code. After this step you should not modify/customize declarations. Modified: trunk/python-ogre/code_generators/ogrenewt/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogrenewt/generate_code.py 2008-08-05 07:25:40 UTC (rev 685) +++ trunk/python-ogre/code_generators/ogrenewt/generate_code.py 2008-08-09 21:51:33 UTC (rev 686) @@ -116,8 +116,7 @@ global_ns.namespace( 'Ogre' ).class_('Node').include(already_exposed=True) global_ns.namespace( 'Ogre' ).class_('Serializer').include(already_exposed=True) - - + def set_call_policies_pointee( mb ): # Set the default policy to deal with pointer/reference return types to reference_existing object # as this is the ogrenewt Default. Added: trunk/python-ogre/patch/ogre_1.6.patch =================================================================== --- trunk/python-ogre/patch/ogre_1.6.patch (rev 0) +++ trunk/python-ogre/patch/ogre_1.6.patch 2008-08-09 21:51:33 UTC (rev 686) @@ -0,0 +1,236 @@ +Index: OgreMain/include/OgreMovableObject.h +=================================================================== +--- OgreMain/include/OgreMovableObject.h (revision 7873) ++++ OgreMain/include/OgreMovableObject.h (working copy) +@@ -482,7 +482,7 @@ + included too. + */ + virtual void visitRenderables(Renderable::Visitor* visitor, +- bool debugRenderables = false) = 0; ++ bool debugRenderables = false) { throw std::runtime_error ( std::string ("Virtual function MovableObject::visitRenderables called!") ); } + + /** Sets whether or not the debug display of this object is enabled. + @remarks +Index: OgreMain/include/OgreRenderQueueListener.h +=================================================================== +--- OgreMain/include/OgreRenderQueueListener.h (revision 7873) ++++ OgreMain/include/OgreRenderQueueListener.h (working copy) +@@ -31,7 +31,9 @@ + + #include "OgrePrerequisites.h" + #include "OgreRenderQueue.h" ++#include <stdexcept> + ++ + namespace Ogre { + + /** Abstract interface which classes must implement if they wish to receive +@@ -64,8 +66,8 @@ + rendered. Note that in this case the renderQueueEnded event will not be raised + for this queue group. + */ +- virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, +- bool& skipThisInvocation) = 0; ++ virtual bool renderQueueStarted(uint8 queueGroupId, const String& invocation, ++ bool skipThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueStarted called!") ); } + + /** Event raised after a queue group is rendered. + @remarks +@@ -79,8 +81,8 @@ + rendered will be repeated, and the renderQueueStarted and renderQueueEnded + events will also be fired for it again. + */ +- virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, +- bool& repeatThisInvocation) = 0; ++ virtual bool renderQueueEnded(uint8 queueGroupId, const String& invocation, ++ bool repeatThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueEnded called!") ); } + }; + + } +Index: OgreMain/include/OgreResourceGroupManager.h +=================================================================== +--- OgreMain/include/OgreResourceGroupManager.h (revision 7873) ++++ OgreMain/include/OgreResourceGroupManager.h (working copy) +@@ -37,6 +37,7 @@ + #include "OgreArchive.h" + #include "OgreIteratorWrappers.h" + #include <ctime> ++#include <stdexcept> + + namespace Ogre { + +@@ -92,7 +93,7 @@ + parsed. Note that in this case the scriptParseEnded event will not be raised + for this script. + */ +- virtual void scriptParseStarted(const String& scriptName, bool& skipThisScript) = 0; ++ virtual bool scriptParseStarted(const String& scriptName, bool skipThisScript) { throw std::runtime_error ( std::string ("Virtual function ResourceGroupListener::scriptParseStarted called!") ); } + + /** This event is fired when the script has been fully parsed. + */ +@@ -350,7 +351,7 @@ + /// Internal event firing method + void fireResourceGroupScriptingStarted(const String& groupName, size_t scriptCount); + /// Internal event firing method +- void fireScriptStarted(const String& scriptName, bool &skipScript); ++ bool fireScriptStarted(const String& scriptName, bool skipScript); + /// Internal event firing method + void fireScriptEnded(const String& scriptName, bool skipped); + /// Internal event firing method +Index: OgreMain/include/OgreDataStream.h +=================================================================== +--- OgreMain/include/OgreDataStream.h (revision 7873) ++++ OgreMain/include/OgreDataStream.h (working copy) +@@ -33,6 +33,7 @@ + #include "OgreString.h" + #include "OgreSharedPtr.h" + #include <istream> ++#include <stdexcept> + + namespace Ogre { + +@@ -79,7 +80,7 @@ + @param count Number of bytes to read + @returns The number of bytes read + */ +- virtual size_t read(void* buf, size_t count) = 0; ++ virtual size_t read(void* buf, size_t count) { throw std::runtime_error ( std::string ("Virtual function DataStream::read called!") ); } + /** Get a single line from the stream. + @remarks + The delimiter character is not included in the data +Index: OgreMain/include/OgreHardwareBuffer.h +=================================================================== +--- OgreMain/include/OgreHardwareBuffer.h (revision 7873) ++++ OgreMain/include/OgreHardwareBuffer.h (working copy) +@@ -31,7 +31,9 @@ + + // Precompiler options + #include "OgrePrerequisites.h" ++#include <stdexcept> + ++ + namespace Ogre { + + /** Abstract class defining common features of hardware buffers. +@@ -244,7 +246,7 @@ + @param pDest The area of memory in which to place the data, must be large enough to + accommodate the data! + */ +- virtual void readData(size_t offset, size_t length, void* pDest) = 0; ++ virtual void readData(size_t offset, size_t length, void* pDest) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::readData called!") ); } + /** Writes data to the buffer from an area of system memory; note that you must + ensure that your buffer is big enough. + @param offset The byte offset from the start of the buffer to start writing +@@ -254,7 +256,7 @@ + such that DMA stalls can be avoided; use if you can. + */ + virtual void writeData(size_t offset, size_t length, const void* pSource, +- bool discardWholeBuffer = false) = 0; ++ bool discardWholeBuffer = false) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::writeData called!") ); } + + /** Copy data from another buffer into this one. + @remarks +Index: OgreMain/include/OgreCompositorChain.h +=================================================================== +--- OgreMain/include/OgreCompositorChain.h (revision 7873) ++++ OgreMain/include/OgreCompositorChain.h (working copy) +@@ -174,10 +174,10 @@ + public: + /** @copydoc RenderQueueListener::renderQueueStarted + */ +- virtual void renderQueueStarted(uint8 id, const String& invocation, bool& skipThisQueue); ++ virtual bool renderQueueStarted(uint8 id, const String& invocation, bool skipThisQueue); + /** @copydoc RenderQueueListener::renderQueueEnded + */ +- virtual void renderQueueEnded(uint8 id, const String& invocation, bool& repeatThisQueue); ++ virtual bool renderQueueEnded(uint8 id, const String& invocation, bool repeatThisQueue); + + /** Set current operation and target */ + void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs); +Index: OgreMain/src/OgreResourceGroupManager.cpp +=================================================================== +--- OgreMain/src/OgreResourceGroupManager.cpp (revision 7873) ++++ OgreMain/src/OgreResourceGroupManager.cpp (working copy) +@@ -929,7 +929,7 @@ + for (FileInfoList::iterator fii = (*flli)->begin(); fii != (*flli)->end(); ++fii) + { + bool skipScript = false; +- fireScriptStarted(fii->filename, skipScript); ++ skipScript = fireScriptStarted(fii->filename, skipScript); + if(skipScript) + { + LogManager::getSingleton().logMessage( +@@ -1218,17 +1218,18 @@ + } + } + //----------------------------------------------------------------------- +- void ResourceGroupManager::fireScriptStarted(const String& scriptName, bool &skipScript) ++ bool ResourceGroupManager::fireScriptStarted(const String& scriptName, bool skipScript) + { + OGRE_LOCK_AUTO_MUTEX + for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin(); + l != mResourceGroupListenerList.end(); ++l) + { + bool temp = false; +- (*l)->scriptParseStarted(scriptName, temp); ++ temp = (*l)->scriptParseStarted(scriptName, temp); + if(temp) + skipScript = true; + } ++ return skipScript; + } + //----------------------------------------------------------------------- + void ResourceGroupManager::fireScriptEnded(const String& scriptName, bool skipped) +Index: OgreMain/src/OgreCompositorChain.cpp +=================================================================== +--- OgreMain/src/OgreCompositorChain.cpp (revision 7873) ++++ OgreMain/src/OgreCompositorChain.cpp (working copy) +@@ -377,8 +377,8 @@ + mViewport = vp; + } + //----------------------------------------------------------------------- +-void CompositorChain::RQListener::renderQueueStarted(uint8 id, +- const String& invocation, bool& skipThisQueue) ++bool CompositorChain::RQListener::renderQueueStarted(uint8 id, ++ const String& invocation, bool skipThisQueue) + { + // Skip when not matching viewport + // shadows update is nested within main viewport update +@@ -392,11 +392,13 @@ + { + skipThisQueue = true; + } ++ return skipThisQueue; + } + //----------------------------------------------------------------------- +-void CompositorChain::RQListener::renderQueueEnded(uint8 id, +- const String& invocation, bool& repeatThisQueue) ++bool CompositorChain::RQListener::renderQueueEnded(uint8 id, ++ const String& invocation, bool repeatThisQueue) + { ++ return repeatThisQueue; + } + //----------------------------------------------------------------------- + void CompositorChain::RQListener::setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs) +Index: OgreMain/src/OgreSceneManager.cpp +=================================================================== +--- OgreMain/src/OgreSceneManager.cpp (revision 7873) ++++ OgreMain/src/OgreSceneManager.cpp (working copy) +@@ -3651,7 +3651,7 @@ + iend = mRenderQueueListeners.end(); + for (i = mRenderQueueListeners.begin(); i != iend; ++i) + { +- (*i)->renderQueueStarted(id, invocation, skip); ++ skip = (*i)->renderQueueStarted(id, invocation, skip); + } + return skip; + } +@@ -3664,7 +3664,7 @@ + iend = mRenderQueueListeners.end(); + for (i = mRenderQueueListeners.begin(); i != iend; ++i) + { +- (*i)->renderQueueEnded(id, invocation, repeat); ++ repeat = (*i)->renderQueueEnded(id, invocation, repeat); + } + return repeat; + } Deleted: trunk/python-ogre/patch/ogre_1.7.patch =================================================================== --- trunk/python-ogre/patch/ogre_1.7.patch 2008-08-05 07:25:40 UTC (rev 685) +++ trunk/python-ogre/patch/ogre_1.7.patch 2008-08-09 21:51:33 UTC (rev 686) @@ -1,119 +0,0 @@ -Index: ogre/OgreMain/include/OgreDataStream.h -=================================================================== ---- ogre/OgreMain/include/OgreDataStream.h (revision 7701) -+++ ogre/OgreMain/include/OgreDataStream.h (working copy) -@@ -33,6 +33,7 @@ - #include "OgreString.h" - #include "OgreSharedPtr.h" - #include <istream> -+#include <stdexcept> - - namespace Ogre { - -@@ -79,7 +80,7 @@ - @param count Number of bytes to read - @returns The number of bytes read - */ -- virtual size_t read(void* buf, size_t count) = 0; -+ virtual size_t read(void* buf, size_t count) { throw std::runtime_error ( std::string ("Virtual function DataStream::read called!") ); } - /** Get a single line from the stream. - @remarks - The delimiter character is not included in the data -Index: ogre/OgreMain/include/OgreHardwareBuffer.h -=================================================================== ---- ogre/OgreMain/include/OgreHardwareBuffer.h (revision 7701) -+++ ogre/OgreMain/include/OgreHardwareBuffer.h (working copy) -@@ -31,7 +31,9 @@ - - // Precompiler options - #include "OgrePrerequisites.h" -+#include <stdexcept> - -+ - namespace Ogre { - - /** Abstract class defining common features of hardware buffers. -@@ -244,7 +246,7 @@ - @param pDest The area of memory in which to place the data, must be large enough to - accommodate the data! - */ -- virtual void readData(size_t offset, size_t length, void* pDest) = 0; -+ virtual void readData(size_t offset, size_t length, void* pDest) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::readData called!") ); } - /** Writes data to the buffer from an area of system memory; note that you must - ensure that your buffer is big enough. - @param offset The byte offset from the start of the buffer to start writing -@@ -254,7 +256,7 @@ - such that DMA stalls can be avoided; use if you can. - */ - virtual void writeData(size_t offset, size_t length, const void* pSource, -- bool discardWholeBuffer = false) = 0; -+ bool discardWholeBuffer = false) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::writeData called!") ); } - - /** Copy data from another buffer into this one. - @remarks -Index: ogre/OgreMain/include/OgreMovableObject.h -=================================================================== ---- ogre/OgreMain/include/OgreMovableObject.h (revision 7701) -+++ ogre/OgreMain/include/OgreMovableObject.h (working copy) -@@ -482,7 +482,7 @@ - included too. - */ - virtual void visitRenderables(Renderable::Visitor* visitor, -- bool debugRenderables = false) = 0; -+ bool debugRenderables = false) { throw std::runtime_error ( std::string ("Virtual function MovableObject::visitRenderables called!") ); } - - /** Sets whether or not the debug display of this object is enabled. - @remarks -Index: ogre/OgreMain/include/OgreRenderQueueListener.h -=================================================================== ---- ogre/OgreMain/include/OgreRenderQueueListener.h (revision 7701) -+++ ogre/OgreMain/include/OgreRenderQueueListener.h (working copy) -@@ -31,7 +31,9 @@ - - #include "OgrePrerequisites.h" - #include "OgreRenderQueue.h" -+#include <stdexcept> - -+ - namespace Ogre { - - /** Abstract interface which classes must implement if they wish to receive -@@ -65,7 +67,7 @@ - for this queue group. - */ - virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, -- bool& skipThisInvocation) = 0; -+ bool& skipThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueStarted called!") ); } - - /** Event raised after a queue group is rendered. - @remarks -@@ -80,7 +82,7 @@ - events will also be fired for it again. - */ - virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, -- bool& repeatThisInvocation) = 0; -+ bool& repeatThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueEnded called!") ); } - }; - - } -Index: ogre/OgreMain/include/OgreResourceGroupManager.h -=================================================================== ---- ogre/OgreMain/include/OgreResourceGroupManager.h (revision 7701) -+++ ogre/OgreMain/include/OgreResourceGroupManager.h (working copy) -@@ -36,6 +36,7 @@ - #include "OgreResource.h" - #include "OgreArchive.h" - #include "OgreIteratorWrappers.h" -+#include <stdexcept> - - namespace Ogre { - -@@ -91,7 +92,7 @@ - parsed. Note that in this case the scriptParseEnded event will not be raised - for this script. - */ -- virtual void scriptParseStarted(const String& scriptName, bool& skipThisScript) = 0; -+ virtual void scriptParseStarted(const String& scriptName, bool& skipThisScript) { throw std::runtime_error ( std::string ("Virtual function ResourceGroupListener::scriptParseStarted called!") ); } - - /** This event is fired when the script has been fully parsed. - */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-08-15 10:44:08
|
Revision: 689 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=689&view=rev Author: andy_miller Date: 2008-08-15 10:44:11 +0000 (Fri, 15 Aug 2008) Log Message: ----------- First go at Hydrax (0.3) module Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/PythonOgreConfig_posix.py trunk/python-ogre/PythonOgreConfig_system.py trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h trunk/python-ogre/ThirdParty/Hydrax/Module.h trunk/python-ogre/ThirdParty/Hydrax/Noise.h trunk/python-ogre/ThirdParty/Hydrax/Perlin.h trunk/python-ogre/ThirdParty/Hydrax/Prerequisites.h trunk/python-ogre/ThirdParty/Hydrax/ProjectedGrid.h trunk/python-ogre/ThirdParty/Hydrax/SimpleGrid.h trunk/python-ogre/code_generators/hydrax/customization_data.py trunk/python-ogre/code_generators/hydrax/generate_code.py trunk/python-ogre/code_generators/hydrax/python_hydrax.h trunk/python-ogre/environment.py trunk/python-ogre/setup.py Added Paths: ----------- trunk/python-ogre/demos/hydrax/ trunk/python-ogre/demos/hydrax/media/ trunk/python-ogre/demos/hydrax/media/Hydrax/ trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_0.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_1.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_10.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_11.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_12.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_13.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_14.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_15.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_16.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_17.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_18.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_19.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_2.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_20.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_21.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_22.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_23.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_24.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_25.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_26.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_27.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_28.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_29.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_3.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_30.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_31.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_4.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_5.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_6.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_7.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_8.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_9.bmp trunk/python-ogre/demos/hydrax/media/Hydrax/Foam.png trunk/python-ogre/demos/hydrax/media/Hydrax/Fresnel.bmp trunk/python-ogre/demos/hydrax/media/materials/ trunk/python-ogre/demos/hydrax/media/materials/programs/ trunk/python-ogre/demos/hydrax/media/materials/programs/OffsetMapping.cg trunk/python-ogre/demos/hydrax/media/materials/scripts/ trunk/python-ogre/demos/hydrax/media/materials/scripts/OffsetMapping.material trunk/python-ogre/demos/hydrax/media/materials/scripts/SkyBox.material trunk/python-ogre/demos/hydrax/media/materials/textures/ trunk/python-ogre/demos/hydrax/media/materials/textures/Island.tga trunk/python-ogre/demos/hydrax/media/materials/textures/IslandNH.tga trunk/python-ogre/demos/hydrax/media/models/ trunk/python-ogre/demos/hydrax/media/models/Island.mesh trunk/python-ogre/demos/hydrax/media/packs/ trunk/python-ogre/demos/hydrax/media/packs/OgreCore.zip trunk/python-ogre/demos/hydrax/media/packs/SkyBoxes.zip trunk/python-ogre/packages_2.5/ogre/addons/hydrax/ trunk/python-ogre/packages_2.5/ogre/addons/hydrax/__init__.py Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-15 10:44:11 UTC (rev 689) @@ -83,6 +83,8 @@ PATH_particleuniverse = os.path.join(PATH_Ogre, 'PlugIns', 'ParticleUniverse' ) PATH_ogrepcz = os.path.join(PATH_Ogre, 'PlugIns', 'PCZSceneManager' ) +PATH_hydrax = os.path.join(PATH_THIRDPARTY, 'hydrax') + # it's time for the SDK version if SDK: PATH_CEGUI = os.path.join(BASE_DIR, 'ogre') @@ -176,6 +178,7 @@ PATH_INCLUDE_ogreforests = PATH_ogreforests PATH_INCLUDE_particleuniverse = os.path.join(PATH_particleuniverse, 'include' ) PATH_INCLUDE_ogrepcz = os.path.join(PATH_ogrepcz,'include') +PATH_INCLUDE_hydrax= PATH_hydrax PATH_INCLUDE_OggVorbisTheora = [ os.path.join(BASE_DIR,'ogg','include') ,os.path.join(BASE_DIR, 'vorbis', 'include') Modified: trunk/python-ogre/PythonOgreConfig_posix.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_posix.py 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/PythonOgreConfig_posix.py 2008-08-15 10:44:11 UTC (rev 689) @@ -79,8 +79,8 @@ PATH_cadunetree= os.path.join(PATH_THIRDPARTY, 'cadunetree') PATH_opensteer = os.path.join(BASE_DIR, 'opensteer', 'trunk') PATH_ogrepcz = os.path.join(PATH_Ogre, 'PlugIns', 'PCZSceneManager' ) +PATH_hydrax = os.path.join(PATH_THIRDPARTY, 'hydrax') - ### ### these paths assume you've left all the directory structure as standard ### Override anything that is different @@ -119,8 +119,8 @@ PATH_LIB_particleuniverse = os.path.join(PATH_particleuniverse, 'bin', 'release') PATH_LIB_opensteer = os.path.join(LOCAL_LIB) PATH_INCLUDE_ogrepcz = os.path.join(PATH_ogrepcz,'include') +PATH_INCLUDE_hydrax= PATH_hydrax - PATH_INCLUDE_Ogre= os.path.join(LOCAL_INCLUDE,'OGRE') # os.path.join(PATH_Ogre,'OgreMain/include') PATH_INCLUDE_Ogre_Dependencies = PATH_INCLUDE_Ogre # os.path.join( PATH_Ogre, 'Dependencies/include') Modified: trunk/python-ogre/PythonOgreConfig_system.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_system.py 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/PythonOgreConfig_system.py 2008-08-15 10:44:11 UTC (rev 689) @@ -62,8 +62,8 @@ PATH_particleuniverse = os.path.join(PATH_Ogre, 'PlugIns', 'ParticleUniverse' ) PATH_cadunetree= os.path.join(PATH_THIRDPARTY, 'cadunetree') PATH_opensteer = os.path.join(BASE_DIR, 'opensteer', 'trunk') +PATH_hydrax = os.path.join(PATH_THIRDPARTY, 'hydrax') - ### ### these paths assume you've left all the directory structure as standard ### Override anything that is different @@ -97,8 +97,8 @@ PATH_LIB_navi= os.path.join(PATH_navi, 'lib') PATH_LIB_particleuniverse = os.path.join(PATH_particleuniverse, 'bin', 'release') PATH_LIB_opensteer = os.path.join(LOCAL_LIB) +PATH_INCLUDE_hydrax= PATH_hydrax - PATH_INCLUDE_Ogre= os.path.join(LOCAL_INCLUDE,'OGRE') # os.path.join(PATH_Ogre,'OgreMain/include') PATH_INCLUDE_Ogre_Dependencies = PATH_INCLUDE_Ogre # os.path.join( PATH_Ogre, 'Dependencies/include') Modified: trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h 2008-08-15 10:44:11 UTC (rev 689) @@ -35,7 +35,7 @@ #include "MaterialManager.h" #include "TextureManager.h" #include "DecalsManager.h" -#include "Modules/Module.h" +#include "Module.h" namespace Hydrax { Modified: trunk/python-ogre/ThirdParty/Hydrax/Module.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Module.h 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/ThirdParty/Hydrax/Module.h 2008-08-15 10:44:11 UTC (rev 689) @@ -25,10 +25,10 @@ #ifndef _Hydrax_Module_H_ #define _Hydrax_Module_H_ -#include "../Prerequisites.h" -#include "../Noise/Noise.h" -#include "../Mesh.h" -#include "../MaterialManager.h" +#include "Prerequisites.h" +#include "Noise.h" +#include "Mesh.h" +#include "MaterialManager.h" namespace Hydrax{ namespace Module { Modified: trunk/python-ogre/ThirdParty/Hydrax/Noise.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Noise.h 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/ThirdParty/Hydrax/Noise.h 2008-08-15 10:44:11 UTC (rev 689) @@ -25,7 +25,7 @@ #ifndef _Hydrax_Noise_H_ #define _Hydrax_Noise_H_ -#include "../Prerequisites.h" +#include "Prerequisites.h" namespace Hydrax{ namespace Noise { Modified: trunk/python-ogre/ThirdParty/Hydrax/Perlin.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Perlin.h 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/ThirdParty/Hydrax/Perlin.h 2008-08-15 10:44:11 UTC (rev 689) @@ -29,9 +29,9 @@ #ifndef _Hydrax_Noise_Perlin_H_ #define _Hydrax_Noise_Perlin_H_ -#include "../../Prerequisites.h" +#include "Prerequisites.h" -#include "../Noise.h" +#include "Noise.h" #define n_bits 5 #define n_size (1<<(n_bits-1)) Modified: trunk/python-ogre/ThirdParty/Hydrax/Prerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Prerequisites.h 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/ThirdParty/Hydrax/Prerequisites.h 2008-08-15 10:44:11 UTC (rev 689) @@ -29,15 +29,15 @@ #include <Ogre.h> /// Define the dll export qualifier if compiling for Windows -#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - #ifdef HYDRAX_LIB - #define DllExport __declspec (dllexport) - #else - #define DllExport __declspec (dllimport) - #endif -#else +// #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 +// #ifdef HYDRAX_LIB +// #define DllExport __declspec (dllexport) +// #else +// #define DllExport __declspec (dllimport) +// #endif +// #else #define DllExport -#endif +// #endif /// Log macro #define HydraxLOG(msg) Ogre::LogManager::getSingleton().logMessage("[Hydrax] " + Ogre::String(msg)); Modified: trunk/python-ogre/ThirdParty/Hydrax/ProjectedGrid.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/ProjectedGrid.h 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/ThirdParty/Hydrax/ProjectedGrid.h 2008-08-15 10:44:11 UTC (rev 689) @@ -31,11 +31,11 @@ #ifndef _Hydrax_Modules_ProjectedGrid_H_ #define _Hydrax_Modules_projectedGrid_H_ -#include "../../Prerequisites.h" +#include "Prerequisites.h" -#include "../../Hydrax.h" -#include "../../Mesh.h" -#include "../Module.h" +#include "Hydrax.h" +#include "Mesh.h" +#include "Module.h" namespace Hydrax{ namespace Module { Modified: trunk/python-ogre/ThirdParty/Hydrax/SimpleGrid.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/SimpleGrid.h 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/ThirdParty/Hydrax/SimpleGrid.h 2008-08-15 10:44:11 UTC (rev 689) @@ -25,11 +25,11 @@ #ifndef _Hydrax_Modules_SimpleGrid_H_ #define _Hydrax_Modules_SimpleGrid_H_ -#include "../../Prerequisites.h" +#include "Prerequisites.h" -#include "../../Hydrax.h" -#include "../../Mesh.h" -#include "../Module.h" +#include "Hydrax.h" +#include "Mesh.h" +#include "Module.h" namespace Hydrax{ namespace Module { Modified: trunk/python-ogre/code_generators/hydrax/customization_data.py =================================================================== --- trunk/python-ogre/code_generators/hydrax/customization_data.py 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/code_generators/hydrax/customization_data.py 2008-08-15 10:44:11 UTC (rev 689) @@ -1,6 +1,6 @@ def header_files( version ): - return [ ''] + return [ 'Hydrax.h'] def huge_classes( version ): return [] Modified: trunk/python-ogre/code_generators/hydrax/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/hydrax/generate_code.py 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/code_generators/hydrax/generate_code.py 2008-08-15 10:44:11 UTC (rev 689) @@ -6,7 +6,7 @@ # ----------------------------------------------------------------------------- ## STARTER TEMPLATE.. -## replace PROJECT with lowercase project name +## replace hydrax with lowercase project name ## set MAIN_NAMESPACE ## rename and configure .h files @@ -40,7 +40,7 @@ import common_utils.ogre_properties as ogre_properties from common_utils import docit -MAIN_NAMESPACE = '' +MAIN_NAMESPACE = 'Hydrax' ############################################################ ## @@ -192,11 +192,11 @@ # NOTE: If you update the source library code you need to manually delete the cache .XML file # xml_cached_fc = parser.create_cached_source_fc( - os.path.join( environment.PROJECT.root_dir, "python_PROJECT.h" ) - , environment.PROJECT.cache_file ) + os.path.join( environment.hydrax.root_dir, "python_hydrax.h" ) + , environment.hydrax.cache_file ) - defined_symbols = [ ] - defined_symbols.append( 'VERSION_' + environment.PROJECT.version ) + defined_symbols = ['OGRE_NONCLIENT_BUILD' ] + defined_symbols.append( 'VERSION_' + environment.hydrax.version ) # # build the core Py++ system from the GCCXML created source @@ -204,10 +204,10 @@ mb = module_builder.module_builder_t( [ xml_cached_fc ] , gccxml_path=environment.gccxml_bin , working_directory=environment.root_dir - , include_paths=environment.PROJECT.include_dirs + , include_paths=environment.hydrax.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 - , cflags=environment.PROJECT.cflags + , cflags=environment.hydrax.cflags ) # if this module depends on another set it here @@ -250,11 +250,11 @@ if cls.name not in NoPropClasses: cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) - common_utils.add_constants( mb, { 'PROJECT_version' : '"%s"' % environment.PROJECT.version.replace("\n", "\\\n") + common_utils.add_constants( mb, { 'hydrax_version' : '"%s"' % environment.hydrax.version.replace("\n", "\\\n") , 'python_version' : '"%s"' % sys.version.replace("\n", "\\\n" ) } ) ## need to create a welcome doc string for this... - common_utils.add_constants( mb, { '__doc__' : '"PROJECT DESCRIPTION"' } ) + common_utils.add_constants( mb, { '__doc__' : '"hydrax DESCRIPTION"' } ) ########################################################################################## @@ -263,23 +263,23 @@ # ########################################################################################## extractor = exdoc.doc_extractor() # I'm excluding the UTFstring docs as lots about nothing - mb.build_code_creator (module_name='_PROJECT_' , doc_extractor= extractor ) + mb.build_code_creator (module_name='_hydrax_' , doc_extractor= extractor ) - for inc in environment.PROJECT.include_dirs: + for inc in environment.hydrax.include_dirs: mb.code_creator.user_defined_directories.append(inc ) - mb.code_creator.user_defined_directories.append( environment.PROJECT.generated_dir ) - mb.code_creator.replace_included_headers( customization_data.header_files( environment.PROJECT.version ) ) + mb.code_creator.user_defined_directories.append( environment.hydrax.generated_dir ) + mb.code_creator.replace_included_headers( customization_data.header_files( environment.hydrax.version ) ) - huge_classes = map( mb.class_, customization_data.huge_classes( environment.PROJECT.version ) ) + huge_classes = map( mb.class_, customization_data.huge_classes( environment.hydrax.version ) ) - mb.split_module(environment.PROJECT.generated_dir, huge_classes, use_files_sum_repository=False) + mb.split_module(environment.hydrax.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. -# common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_PROJECT, -# destPath = environment.PROJECT.generated_dir, -# recursive=False ) + common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_hydrax, + destPath = environment.hydrax.generated_dir, + recursive= False ) if __name__ == '__main__': start_time = time.clock() Modified: trunk/python-ogre/code_generators/hydrax/python_hydrax.h =================================================================== --- trunk/python-ogre/code_generators/hydrax/python_hydrax.h 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/code_generators/hydrax/python_hydrax.h 2008-08-15 10:44:11 UTC (rev 689) @@ -1,18 +1,18 @@ -#include "PROJECT MASTER.h" +#include "Hydrax.h" // First we create a magic namespace to hold all our aliases namespace pyplusplus { namespace aliases { - #include "python_PROJECT_aliases.h" + #include "python_hydrax_aliases.h" } } // then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ // -namespace python_PROJECT{ namespace details{ +namespace python_hydrax{ namespace details{ inline void instantiate(){ - using namespace PROJECT; - #include "python_PROJECT_sizeof.h" + using namespace Hydrax; + #include "python_hydrax_sizeof.h" } } } Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_0.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_1.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_10.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_11.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_12.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_13.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_14.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_15.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_16.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_17.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_18.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_19.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_2.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_20.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_21.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_22.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_23.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_24.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_25.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_26.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_27.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_28.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_29.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_3.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_30.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_31.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_4.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_5.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_6.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_7.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_8.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Caustics_9.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Foam.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/Fresnel.bmp ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/python-ogre/demos/hydrax/media/materials/programs/OffsetMapping.cg =================================================================== --- trunk/python-ogre/demos/hydrax/media/materials/programs/OffsetMapping.cg (rev 0) +++ trunk/python-ogre/demos/hydrax/media/materials/programs/OffsetMapping.cg 2008-08-15 10:44:11 UTC (rev 689) @@ -0,0 +1,100 @@ +/* Bump mapping with Parallax offset vertex program + In this program, we want to calculate the tangent space light end eye vectors + which will get passed to the fragment program to produce the per-pixel bump map + with parallax offset effect. +*/ + +/* Vertex program that moves light and eye vectors into texture tangent space at vertex */ + +void main_vp(float4 position : POSITION, + float3 normal : NORMAL, + float2 uv : TEXCOORD0, + float3 tangent : TANGENT0, + // outputs + out float4 oPosition : POSITION, + out float2 oUv : TEXCOORD0, + out float3 oLightDir : TEXCOORD1, // tangent space + out float3 oEyeDir : TEXCOORD2, // tangent space + out float3 oHalfAngle : TEXCOORD3, // + // parameters + uniform float4 lightPosition, // object space + uniform float3 eyePosition, // object space + uniform float4x4 worldViewProj) +{ + // calculate output position + oPosition = mul(worldViewProj, position); + + // pass the main uvs straight through unchanged + oUv = uv*float2(8, 8); + + // calculate tangent space light vector + // Get object space light direction + float3 lightDir = normalize(lightPosition.xyz - (position * lightPosition.w)); + float3 eyeDir = eyePosition - position.xyz; + + // Calculate the binormal (NB we assume both normal and tangent are + // already normalised) + // NB looks like nvidia cross params are BACKWARDS to what you'd expect + // this equates to NxT, not TxN + float3 binormal = cross(tangent, normal); + + // Form a rotation matrix out of the vectors + float3x3 rotation = float3x3(tangent, binormal, normal); + + // Transform the light vector according to this matrix + lightDir = normalize(mul(rotation, lightDir)); + eyeDir = normalize(mul(rotation, eyeDir)); + + oLightDir = lightDir; + oEyeDir = eyeDir; + oHalfAngle = normalize(eyeDir + lightDir); +} + +// General functions + +// Expand a range-compressed vector +float3 expand(float3 v) +{ + return (v - 0.5) * 2; +} + +void main_fp(float2 uv : TEXCOORD0, + float3 lightDir : TEXCOORD1, + float3 eyeDir : TEXCOORD2, + float3 halfAngle : TEXCOORD3, + uniform float3 lightDiffuse, + uniform float3 lightSpecular, + uniform float4 scaleBias, + uniform sampler2D normalHeightMap, + uniform sampler2D diffuseMap, + out float4 oColor : COLOR) +{ + // get the height using the tex coords + float height = tex2D(normalHeightMap, uv).a; + + // scale and bias factors + float scale = scaleBias.x; + float bias = scaleBias.y; + + // calculate displacement + float displacement = (height * scale) + bias; + + float3 uv2 = float3(uv, 1); + + // calculate the new tex coord to use for normal and diffuse + float2 newTexCoord = ((eyeDir * displacement) + uv2).xy; + + // get the new normal and diffuse values + float3 normal = expand(tex2D(normalHeightMap, newTexCoord).xyz); + float3 diffuse = tex2D(diffuseMap, newTexCoord).xyz; + + float3 specular = pow(saturate(dot(normal, halfAngle)), 32) * lightSpecular; + float diff = saturate(dot(normal, lightDir)); + if(diff<0.3) + diff = 0.3; + float3 col = diffuse * diff * lightDiffuse + specular; + + oColor = float4(col, 1); +} + + Added: trunk/python-ogre/demos/hydrax/media/materials/scripts/OffsetMapping.material =================================================================== --- trunk/python-ogre/demos/hydrax/media/materials/scripts/OffsetMapping.material (rev 0) +++ trunk/python-ogre/demos/hydrax/media/materials/scripts/OffsetMapping.material 2008-08-15 10:44:11 UTC (rev 689) @@ -0,0 +1,60 @@ +// Bump map with Parallax offset vertex program, support for this is required +vertex_program Examples/OffsetMappingVP cg +{ + source OffsetMapping.cg + entry_point main_vp + profiles vs_1_1 arbvp1 +} + +// Bump map with parallax fragment program +fragment_program Examples/OffsetMappingFP cg +{ + source OffsetMapping.cg + entry_point main_fp + profiles ps_2_0 arbfp1 +} + +material Examples/OffsetMapping/Specular +{ + + // This is the preferred technique which uses both vertex and + // fragment programs, supports coloured lights + technique + { + // do the lighting and bump mapping with parallax pass + pass + { + + // Vertex program reference + vertex_program_ref Examples/OffsetMappingVP + { + param_named_auto lightPosition light_position_object_space 0 + param_named_auto eyePosition camera_position_object_space + param_named_auto worldViewProj worldviewproj_matrix + } + + // Fragment program + fragment_program_ref Examples/OffsetMappingFP + { + param_named_auto lightDiffuse light_diffuse_colour 0 + param_named_auto lightSpecular light_specular_colour 0 + // Parallax Height scale and bias + param_named scaleBias float4 0.04 -0.02 1 0 + } + + // Normal + height(alpha) map + texture_unit + { + texture IslandNH.tga + tex_coord_set 0 + } + + // Base diffuse texture map + texture_unit + { + texture Island.tga + tex_coord_set 1 + } + } + } +} Added: trunk/python-ogre/demos/hydrax/media/materials/scripts/SkyBox.material =================================================================== --- trunk/python-ogre/demos/hydrax/media/materials/scripts/SkyBox.material (rev 0) +++ trunk/python-ogre/demos/hydrax/media/materials/scripts/SkyBox.material 2008-08-15 10:44:11 UTC (rev 689) @@ -0,0 +1,107 @@ +material Sky/Evening +{ + technique + { + pass + { + lighting off + depth_write off + + texture_unit + { + cubic_texture evening.jpg separateUV + tex_address_mode clamp + } + } + } +} + +material Sky/EarlyMorning +{ + technique + { + pass + { + lighting off + depth_write off + + texture_unit + { + cubic_texture early_morning.jpg separateUV + tex_address_mode clamp + } + } + } +} + +material Sky/Morning +{ + technique + { + pass + { + lighting off + depth_write off + + texture_unit + { + cubic_texture morning.jpg separateUV + tex_address_mode clamp + } + } + } +} + +material Sky/Stormy +{ + technique + { + pass + { + lighting off + depth_write off + + texture_unit + { + cubic_texture stormy.jpg separateUV + tex_address_mode clamp + } + } + } +} + +material Sky/ClubTropicana +{ + technique + { + pass + { + lighting off + depth_write off + + texture_unit + { + cubic_texture ct.png separateUV + tex_address_mode clamp + } + } + } +} + +material Sky/Clouds +{ + technique + { + pass + { + lighting off + depth_write off + + texture_unit + { + cubic_texture clouds.png separateUV + tex_address_mode clamp + } + } + } +} Property changes on: trunk/python-ogre/demos/hydrax/media/materials/textures/Island.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/materials/textures/IslandNH.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/models/Island.mesh ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/packs/OgreCore.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/python-ogre/demos/hydrax/media/packs/SkyBoxes.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/environment.py 2008-08-15 10:44:11 UTC (rev 689) @@ -1632,19 +1632,15 @@ name='hydrax' parent="ogre/addons" cflags = "" - try: - include_dirs = [ Config.PATH_Boost, - Config.PATH_hydrax - , Config.PATH_INCLUDE_Ogre - ] - lib_dirs = [Config.PATH_LIB_Boost, - Config.PATH_LIB_hydrax, - Config.PATH_LIB_Ogre_OgreMain + include_dirs = [ Config.PATH_Boost, + Config.PATH_INCLUDE_hydrax + , Config.PATH_INCLUDE_Ogre ] - except: - pass + lib_dirs = [Config.PATH_LIB_Boost, + Config.PATH_LIB_Ogre_OgreMain + ] CheckIncludes=[] - libs=[ boost.lib, 'OgreMain', 'hydrax' ] + libs=[ boost.lib, 'OgreMain' ] ModuleName="hydrax" ############################################################################################ @@ -1686,6 +1682,7 @@ , 'cadunetree' : cadunetree ,'opensteer' : opensteer ,'ogrepcz' : ogrepcz + , 'hydrax' : hydrax } # Added: trunk/python-ogre/packages_2.5/ogre/addons/hydrax/__init__.py =================================================================== --- trunk/python-ogre/packages_2.5/ogre/addons/hydrax/__init__.py (rev 0) +++ trunk/python-ogre/packages_2.5/ogre/addons/hydrax/__init__.py 2008-08-15 10:44:11 UTC (rev 689) @@ -0,0 +1 @@ +from _hydrax_ import * Modified: trunk/python-ogre/setup.py =================================================================== --- trunk/python-ogre/setup.py 2008-08-15 08:08:10 UTC (rev 688) +++ trunk/python-ogre/setup.py 2008-08-15 10:44:11 UTC (rev 689) @@ -72,7 +72,7 @@ 'ogre.addons.ogreforests', 'ogre.addons.et', 'ogre.addons.caelum', 'ogre.addons.noise', 'ogre.addons.watermesh', 'ogre.addons.ofusion', 'ogre.addons.particleuniverse', 'ogre.addons.cadunetree', - 'ogre.renderer.ogrepcz' ], + 'ogre.renderer.ogrepcz', 'ogre.addons.hydrax' ], "package_dir": {'': 'packages_'+ PythonVersionString }, "package_data": {'': ['*.pyd', '*.dll', '*.so']} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-08-15 08:04:07
|
Revision: 687 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=687&view=rev Author: andy_miller Date: 2008-08-15 08:04:11 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Updates to Caelum (R282), Forests/PagedGeomerty (R2490) and preparing to put Hydrax 0.3 in the svn Modified Paths: -------------- trunk/python-ogre/ThirdParty/caelum/Astronomy.h trunk/python-ogre/ThirdParty/caelum/CaelumExceptions.h trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h trunk/python-ogre/ThirdParty/caelum/FlatCloudLayer.cpp trunk/python-ogre/ThirdParty/caelum/ImageStarfield.cpp trunk/python-ogre/ThirdParty/caelum/ImageStarfield.h trunk/python-ogre/ThirdParty/caelum/Moon.cpp trunk/python-ogre/ThirdParty/caelum/PointStarfield.cpp trunk/python-ogre/ThirdParty/caelum/PrecipitationController.cpp trunk/python-ogre/ThirdParty/caelum/PrecipitationController.h trunk/python-ogre/ThirdParty/caelum/UniversalClock.cpp trunk/python-ogre/ThirdParty/caelum/UniversalClock.h trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h trunk/python-ogre/code_generators/ogre/generate_code.py trunk/python-ogre/code_generators/ogre/python_ogre_aliases.h Removed Paths: ------------- trunk/python-ogre/ThirdParty/Hydrax/Enums.cpp trunk/python-ogre/ThirdParty/Hydrax/Enums.h trunk/python-ogre/ThirdParty/Hydrax/Help.cpp trunk/python-ogre/ThirdParty/Hydrax/Help.h trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h trunk/python-ogre/ThirdParty/Hydrax/Mesh.cpp trunk/python-ogre/ThirdParty/Hydrax/Mesh.h trunk/python-ogre/ThirdParty/Hydrax/Perlin.cpp trunk/python-ogre/ThirdParty/Hydrax/Perlin.h trunk/python-ogre/ThirdParty/Hydrax/Prerequisites.cpp trunk/python-ogre/ThirdParty/Hydrax/Prerequisites.h trunk/python-ogre/ThirdParty/Hydrax/Structs.cpp trunk/python-ogre/ThirdParty/Hydrax/Structs.h Deleted: trunk/python-ogre/ThirdParty/Hydrax/Enums.cpp =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Enums.cpp 2008-08-09 21:51:33 UTC (rev 686) +++ trunk/python-ogre/ThirdParty/Hydrax/Enums.cpp 2008-08-15 08:04:11 UTC (rev 687) @@ -1,31 +0,0 @@ -/* --------------------------------------------------------------------------------- -This source file is part of Hydrax. -Visit --- - -Copyright (C) 2007 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> - <xa...@gm...> - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/gpl.html. --------------------------------------------------------------------------------- -*/ - -#include "Enums.h" - -namespace Hydrax -{ - -} Deleted: trunk/python-ogre/ThirdParty/Hydrax/Enums.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Enums.h 2008-08-09 21:51:33 UTC (rev 686) +++ trunk/python-ogre/ThirdParty/Hydrax/Enums.h 2008-08-15 08:04:11 UTC (rev 687) @@ -1,69 +0,0 @@ -/* --------------------------------------------------------------------------------- -This source file is part of Hydrax. -Visit --- - -Copyright (C) 2007 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> - <xa...@gm...> - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/gpl.html. --------------------------------------------------------------------------------- -*/ - -#ifndef _Enums_H_ -#define _Enums_H_ - -#include "Prerequisites.h" - -namespace Hydrax -{ - /** Texture quality enumeration(2^n) - */ - enum DllExport TextureQuality - { - TEX_QUA_2 = 2, - TEX_QUA_4 = 4, - TEX_QUA_8 = 8, - TEX_QUA_16 = 16, - TEX_QUA_32 = 32, - TEX_QUA_64 = 64, - TEX_QUA_128 = 128, - TEX_QUA_256 = 256, - TEX_QUA_512 = 512, - TEX_QUA_1024 = 1024 - }; - - /** Hydrax flags for select the components - that we want to use. - 0 for none, 1 for all. - */ - enum DllExport HydraxComponent - { - HYDRAX_COMPONENT_SUN = 1 << 0, - HYDRAX_COMPONENT_FOAM = 1 << 1, - HYDRAX_COMPONENT_DEPTH = 1 << 2, - /// Smooth transitions needs depth component - HYDRAX_COMPONENT_SMOOTH = 1 << 3, - HYDRAX_COMPONENT_CAUSTICS = 1 << 4, - /// See documentation - HYDRAX_COMPONENT_PLSM2 = 1 << 5, - - HYDRAX_COMPONENTS_NONE = 0x0000, - HYDRAX_COMPONENTS_ALL = 0x001F, - }; -} - -#endif Deleted: trunk/python-ogre/ThirdParty/Hydrax/Help.cpp =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Help.cpp 2008-08-09 21:51:33 UTC (rev 686) +++ trunk/python-ogre/ThirdParty/Hydrax/Help.cpp 2008-08-15 08:04:11 UTC (rev 687) @@ -1,31 +0,0 @@ -/* --------------------------------------------------------------------------------- -This source file is part of Hydrax. -Visit --- - -Copyright (C) 2007 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> - <xa...@gm...> - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/gpl.html. --------------------------------------------------------------------------------- -*/ - -#include "Help.h" - -namespace Hydrax -{ - -} Deleted: trunk/python-ogre/ThirdParty/Hydrax/Help.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Help.h 2008-08-09 21:51:33 UTC (rev 686) +++ trunk/python-ogre/ThirdParty/Hydrax/Help.h 2008-08-15 08:04:11 UTC (rev 687) @@ -1,193 +0,0 @@ -/* --------------------------------------------------------------------------------- -This source file is part of Hydrax. -Visit --- - -Copyright (C) 2007 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> - <xa...@gm...> - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/gpl.html. --------------------------------------------------------------------------------- -*/ - -#ifndef _Help_H_ -#define _Help_H_ - -#include "Prerequisites.h" - -#include "../noise/noise.h" -#include "../noise/noiseutils.h" - -namespace Hydrax -{ - /** Struct wich contains an especific width and height value - */ - struct DllExport Size - { - /// Width value - int Width; - /// Height value - int Height; - - /** Default constructor - */ - Size() - { - Width = 0; - Height = 0; - } - - /** Constructor - @param size The width and height values - */ - Size(int size) - { - Width = size; - Height = size; - } - - /** Constructor - @param width Width value - @param height Height value - */ - Size(int width, int height) - { - Width = width; - Height = height; - } - - /** Destructor - */ - ~Size() - { - } - - /** Sets the same width and height value - @param size The width and height values - */ - void setSize(int size) - { - Width = size; - Height = size; - } - - /** Sets the especified values - @param width Width value - @param height Height value - */ - void setSize(int width, int height) - { - Width = width; - Height = height; - } - }; - - /** Struct for store a float** data pointer, its size and its normal map - */ - struct DllExport NoiseBuffer - { - /// Our float pointer data - float** mData; - /// Size - Size mSize; - /// Normal map(its use is optional) - noise::utils::Image mNormalMap; - - /** Default constructor - */ - NoiseBuffer() : mData(0) - { - } - - /** Destructor - */ - ~NoiseBuffer() - { - if (mData) - { - for (int k = 0; k < mSize.Width; k++) - { - delete[] mData[k]; - } - - delete[] mData; - } - } - - /** Constructor - @param Data Data pointer - @param Size Data bidimensional array width/height size - */ - NoiseBuffer(float **Data, Size Size) - { - mData = Data; - mSize = Size; - } - - /** Constructor - @param Data Data pointer - @param Size Data bidimensional array width/height size - @param NormalMap noise::utils::Image that contains our data image normal map - */ - NoiseBuffer(float **Data, Size Size, noise::utils::Image NormalMap) - { - mData = Data; - mSize = Size; - mNormalMap = NormalMap; - } - - /** Set data and size - @param Data Data pointer - @param Size Data bidimensional array width/height size - */ - void Set(float **Data, Size Size) - { - mData = Data; - mSize = Size; - } - - /** Set data, size and normal map image - @param Data Data pointer - @param Size Data bidimensional array width/height size - @param NormalMap noise::utils::Image that contains our data image normal map - */ - void Set(float **Data, Size Size, noise::utils::Image NormalMap) - { - mData = Data; - mSize = Size; - mNormalMap = NormalMap; - } - - /** Get our data pointer - @return Data float** pointer - */ - float** getData() - { - return mData; - } - - /** Get float value from an especific x/y coordinates - @return x/y value of our data - */ - float getData(int x, int y) - { - return mData[x][y]; - } - - }; -} - -#endif Deleted: trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp 2008-08-09 21:51:33 UTC (rev 686) +++ trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp 2008-08-15 08:04:11 UTC (rev 687) @@ -1,1316 +0,0 @@ -/* --------------------------------------------------------------------------------- -This source file is part of Hydrax. -Visit --- - -Copyright (C) 2007 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> - <xa...@gm...> - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/gpl.html. --------------------------------------------------------------------------------- -*/ - -#include "Hydrax.h" - -namespace Hydrax -{ - - Hydrax::Hydrax(Ogre::SceneManager *sm, Ogre::Camera *c) - : mSceneManager(sm) - , mCamera(c) - , mCreated(false) - , mPolygonMode(0) - , mPosition(Ogre::Vector3(0,0,0)) - , mPlanesError(0) - , mVelocity(9.75) - , mFullReflectionDistance(90000000) - , mGlobalTransparency(0.05) - , mNormalDistortion(0.09) - , mSunPosition(Ogre::Vector3(5000,3000,1)) - , mSunStrength(1.75) - , mSunArea(150) - , mSunColor(Ogre::Vector3(1,0.75,0.25)) - , mFoamMaxDistance(75000000) - , mFoamScale(50) - , mFoamStart(0.5) - , mFoamTransparency(1.275) - , mDepthLimit(0) - , mDepthColor(Ogre::Vector3(0,0.1,0.172)) - , mSmoothPower(30) - , mCausticsScale(20) - , mCausticsPower(15) - , mCausticsEnd(0.55) - , mActualTexScrollPosition(0) - , mMesh(new Mesh(sm)) - , mSceneNode(0) - , mRefractionPlane(0) - , mReflectionPlane(0) - , mDepthPlane(0) - , mTextureRefraction(0) - , mTextureReflection(0) - , mTextureDepth(0) - , mPlanesSceneNode(0) - , mComponents(HYDRAX_COMPONENTS_NONE) - { - LOG("[Hydrax] Hydrax object created."); - } - - Hydrax::~Hydrax() - { - if (mSceneNode) - { - mSceneNode->detachAllObjects(); - mSceneNode->getParentSceneNode()->removeAndDestroyChild(mSceneNode->getName()); - - Ogre::TextureManager::getSingleton().remove("HydraxHeight"); - Ogre::TextureManager::getSingleton().remove("HydraxNormalMap"); - - delete mMesh; - } - - if (mPlanesSceneNode) - { - mPlanesSceneNode->detachAllObjects(); - mPlanesSceneNode->getParentSceneNode()->removeAndDestroyChild(mPlanesSceneNode->getName()); - - Ogre::RenderTarget* mRT_TextureRefraction = mTextureRefraction->getBuffer()->getRenderTarget(); - mRT_TextureRefraction->removeAllListeners(); - mRT_TextureRefraction->removeAllViewports(); - - Ogre::RenderTarget* mRT_TextureReflection = mTextureReflection->getBuffer()->getRenderTarget(); - mRT_TextureReflection->removeAllListeners(); - mRT_TextureReflection->removeAllViewports(); - - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - Ogre::RenderTarget* mRT_TextureDepth = mTextureDepth->getBuffer()->getRenderTarget(); - mRT_TextureDepth->removeAllListeners(); - mRT_TextureDepth->removeAllViewports(); - - Ogre::TextureManager::getSingleton().remove("Depth"); - - Ogre::MeshManager::getSingleton().remove("DepthClipPlane"); - } - - Ogre::TextureManager::getSingleton().remove("Reflection"); - Ogre::TextureManager::getSingleton().remove("Refraction"); - - Ogre::MeshManager::getSingleton().remove("RefractionClipPlane"); - Ogre::MeshManager::getSingleton().remove("ReflectionClipPlane"); - } - - mNoiseBuffer[2].Set(mPerlin.getFreeData(), mPerlin.mSize); - mNoiseBuffer.clear(); - - LOG("[Hydrax] Hydrax object removed."); - } - - void Hydrax::create() - { - if (isCreated()) - { - LOG("[Hydrax] Hydrax alredy created, skipping..."); - - return; - } - - LOG("[Hydrax] Creating perlin noise textures and normal maps."); - _createTextures(); - _updateTextures(0); - LOG("[Hydrax] Perlin noise textures and normal maps created."); - - LOG("[Hydrax] Creating water mesh."); - mSceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode(); - mMesh->create(mSceneNode); - mMesh->update(mNoiseBuffer[2]); - LOG("[Hydrax] Water mesh created"); - - LOG("[Hydrax] Creating RTListeners."); - _createRttListeners(); - LOG("[Hydrax] RTListeners created"); - - mCreated = true; - } - - void Hydrax::_createTextures() - { - mPerlin.setSize(mPerlinOptions.TexQuality, mPerlinOptions.TexQuality); - - mNoiseBuffer.reserve(3); - mNoiseBuffer.resize(3); - - mPerlin.mPerlinModule.SetFrequency(mPerlinOptions.Frecuency); - mPerlin.mPerlinModule.SetPersistence(mPerlinOptions.Persistence); - mPerlin.mPerlinModule.SetOctaveCount(mPerlinOptions.Octave); - mPerlin.mPerlinModule.SetLacunarity(mPerlinOptions.Lacunarity); - - mPerlin.createPerlinTexture(Ogre::String("HydraxHeight")); - mPerlin.createNMTexture(Ogre::String("HydraxNormalMap")); - - mPerlin.mPerlinModule.SetSeed(0); - mNoiseBuffer[0].Set(mPerlin.getData(true), mPerlin.mSize, mPerlin.getNormalMap(mPerlinOptions.NMHeight, true)); - mPerlin.mPerlinModule.SetSeed(1); - mNoiseBuffer[1].Set(mPerlin.getData(true), mPerlin.mSize, mPerlin.getNormalMap(mPerlinOptions.NMHeight, true)); - mNoiseBuffer[2].Set(mPerlin.getFreeData(), mPerlin.mSize); - mNoiseBuffer[2].mNormalMap.SetSize(mPerlin.mSize.Width, mPerlin.mSize.Height); - } - - void Hydrax::_updateTextures(Ogre::Real timeSinceLastFrame) - { - int x, y, newY1, newY1a, newY2, newY2a; - float a, b, c, d, diff, diffb; - - float** OriginalA = mNoiseBuffer[0].mData; - float** OriginalB = mNoiseBuffer[1].mData; - - diff = (mActualTexScrollPosition - static_cast<int>(mActualTexScrollPosition))/2; // Divide by 2 to avoid it in: mNoiseBuffer[2].mData[x][y] = (c+d)/2; - diffb = 0.5 - diff; - - for (y = 0; y < mNoiseBuffer[0].mSize.Height; y ++) - { - newY1 = y + static_cast<int>(mActualTexScrollPosition); - if (newY1>mNoiseBuffer[0].mSize.Height-1) - { - newY1-=mNoiseBuffer[0].mSize.Height; - } - - newY1a = (y+1) + static_cast<int>(mActualTexScrollPosition); - if (newY1a>mNoiseBuffer[0].mSize.Height-1) - { - newY1a-=mNoiseBuffer[0].mSize.Height; - } - - newY2 = y - static_cast<int>(mActualTexScrollPosition); - if (newY2<0) - { - newY2+=mNoiseBuffer[0].mSize.Height-1; - } - - newY2a = (y+1) - static_cast<int>(mActualTexScrollPosition); - if (newY2a<0) - { - newY2a+=mNoiseBuffer[0].mSize.Height-1; - } - if (newY2a>mNoiseBuffer[0].mSize.Height-1) - { - newY2a-=mNoiseBuffer[0].mSize.Height; - } - - for (x = 0; x < mNoiseBuffer[0].mSize.Width; x ++) - { - a = OriginalA[newY1][x]; - b = OriginalA[newY1a][x]; - - c=a*diffb+ b*diff; - - a = OriginalB[newY2][x]; - b = OriginalB[newY2a][x]; - - d=a*diff + b*diffb; - - mNoiseBuffer[2].mData[y][x] = (c+d); - } - } - - mActualTexScrollPosition += mVelocity*timeSinceLastFrame; - - if (mActualTexScrollPosition>mNoiseBuffer[0].mSize.Height) - { - mActualTexScrollPosition = 0; - } - - mPerlin.updatePerlinTexture(mNoiseBuffer[2].mData); - _updateNM(); - } - - void Hydrax::_updateNM() - { - int x, y, newY1, newY1a, newY2, newY2a; - float diff, diffb; - - diff = (mActualTexScrollPosition - static_cast<int>(mActualTexScrollPosition))/2; // Divide by 2 to avoid it in the bucle - diffb = 0.5 - diff; - - for (y = 0; y < mNoiseBuffer[0].mSize.Height; y ++) - { - newY1 = y + static_cast<int>(mActualTexScrollPosition); - if (newY1>mNoiseBuffer[0].mSize.Height-1) - { - newY1-=mNoiseBuffer[0].mSize.Height; - } - - newY1a = y+1 + static_cast<int>(mActualTexScrollPosition); - if (newY1a>mNoiseBuffer[0].mSize.Height-1) - { - newY1a-=mNoiseBuffer[0].mSize.Height; - } - - newY2 = y - static_cast<int>(mActualTexScrollPosition); - if (newY2<0) - { - newY2+=mNoiseBuffer[0].mSize.Height-1; - } - - newY2a = (y+1) - static_cast<int>(mActualTexScrollPosition); - if (newY2a<0) - { - newY2a+=mNoiseBuffer[0].mSize.Height-1; - } - if (newY2a>mNoiseBuffer[0].mSize.Height-1) - { - newY2a-=mNoiseBuffer[0].mSize.Height; - } - - for (x = 0; x < mNoiseBuffer[0].mSize.Width; x ++) - { - noise::utils::Color c = - noise::utils::Color( - // Red - (( mNoiseBuffer[1].mNormalMap.GetValue(newY1,x).red *diffb + mNoiseBuffer[1].mNormalMap.GetValue(newY1a,x).red *diff ) - +(mNoiseBuffer[0].mNormalMap.GetValue(newY2,x).red *diff + mNoiseBuffer[0].mNormalMap.GetValue(newY2a,x).red *diffb)), - // Green - (( mNoiseBuffer[1].mNormalMap.GetValue(newY1,x).green *diffb + mNoiseBuffer[1].mNormalMap.GetValue(newY1a,x).green *diff ) - +(mNoiseBuffer[0].mNormalMap.GetValue(newY2,x).green *diff + mNoiseBuffer[0].mNormalMap.GetValue(newY2a,x).green *diffb)), - // Blue - (( mNoiseBuffer[1].mNormalMap.GetValue(newY1,x).blue *diffb + mNoiseBuffer[1].mNormalMap.GetValue(newY1a,x).blue *diff ) - +(mNoiseBuffer[0].mNormalMap.GetValue(newY2,x).blue *diff + mNoiseBuffer[0].mNormalMap.GetValue(newY2a,x).blue *diffb)), - // Alpha - 255); - - mNoiseBuffer[2].mNormalMap.SetValue(y,x,c); - } - } - - mPerlin.updateNMTexture(mNoiseBuffer[2].mNormalMap); - } - - void Hydrax::_createRttListeners() - { - if (!isCreated()) - { - mRefractionPlane = new Ogre::MovablePlane("RefractionPlane"); - mReflectionPlane = new Ogre::MovablePlane("ReflectionPlane"); - - mRefractionPlane->d = 0; - mReflectionPlane->d = 0; - - mRefractionPlane->normal = Ogre::Vector3::NEGATIVE_UNIT_Y; - mReflectionPlane->normal = Ogre::Vector3::UNIT_Y; - - Ogre::MeshManager::getSingleton().createPlane( - "RefractionClipPlane",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - *mRefractionPlane, - mMesh->getSize().Width,mMesh->getSize().Height, - 10,10,true,1,5,5,Ogre::Vector3::UNIT_Z); - - Ogre::MeshManager::getSingleton().createPlane( - "ReflectionClipPlane",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - *mReflectionPlane, - mMesh->getSize().Width,mMesh->getSize().Height, - 10,10,true,1,5,5,Ogre::Vector3::UNIT_Z); - - mRefractionPlane->setCastShadows(false); - mReflectionPlane->setCastShadows(false); - - mPlanesSceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode(); - mPlanesSceneNode->attachObject(mRefractionPlane); - mPlanesSceneNode->attachObject(mReflectionPlane); - - mReflectionListener.mHydrax = this; - mRefractionListener.mHydrax = this; - } - - Ogre::TextureManager::getSingleton().remove("Reflection"); - Ogre::TextureManager::getSingleton().remove("Refraction"); - - mTextureRefraction = Ogre::TextureManager::getSingleton().createManual( - "Refraction", - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - Ogre::TEX_TYPE_2D, - mRttOptions.RefractionQuality, mRttOptions.RefractionQuality, 0, - Ogre::PF_R8G8B8, - Ogre::TU_RENDERTARGET); - - Ogre::RenderTarget* mRT_TextureRefraction = mTextureRefraction->getBuffer()->getRenderTarget(); - { - Ogre::Viewport *v = mRT_TextureRefraction->addViewport(mCamera); - v->setClearEveryFrame(true); - v->setBackgroundColour(Ogre::ColourValue::White); - v->setOverlaysEnabled(false); - - mRT_TextureRefraction->addListener(&mRefractionListener); - - Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); - Ogre::TextureUnitState* t = mat->getTechnique(0)->getPass(0)->getTextureUnitState(2); - t->setTextureName("Refraction"); - } - - mTextureReflection = Ogre::TextureManager::getSingleton().createManual( - "Reflection", - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - Ogre::TEX_TYPE_2D, - mRttOptions.ReflectionQuality, mRttOptions.ReflectionQuality, 0, - Ogre::PF_R8G8B8, - Ogre::TU_RENDERTARGET); - - Ogre::RenderTarget* mRT_TextureReflection = mTextureReflection->getBuffer()->getRenderTarget(); - { - Ogre::Viewport *v = mRT_TextureReflection->addViewport(mCamera); - v->setClearEveryFrame(true); - v->setBackgroundColour(Ogre::ColourValue::White); - v->setOverlaysEnabled(false); - - mRT_TextureReflection->addListener(&mReflectionListener); - - Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); - Ogre::TextureUnitState* t = mat->getTechnique(0)->getPass(0)->getTextureUnitState(1); - t->setTextureName("Reflection"); - } - - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - _createDepthRttListener(); - } - } - - void Hydrax::_createDepthRttListener(bool Create, bool Delete) - { - if (Create) - { - Ogre::TextureManager::getSingleton().remove("Depth"); - - if (!isCreated()) - { - mDepthPlane = new Ogre::MovablePlane("DepthPlane"); - - mDepthPlane->d = 0; - mDepthPlane->normal = Ogre::Vector3::NEGATIVE_UNIT_Y; - - Ogre::MeshManager::getSingleton().createPlane( - "DepthClipPlane",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - *mDepthPlane, - mMesh->getSize().Width,mMesh->getSize().Height, - 10,10,true,1,5,5,Ogre::Vector3::UNIT_Z); - - mDepthPlane->setCastShadows(false); - - mPlanesSceneNode->attachObject(mDepthPlane); - - mDepthListener.mHydrax = this; - } - - mTextureDepth = Ogre::TextureManager::getSingleton().createManual( - "Depth", - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - Ogre::TEX_TYPE_2D, - mRttOptions.DepthQuality, mRttOptions.DepthQuality, 0, - Ogre::PF_R8G8B8, - Ogre::TU_RENDERTARGET); - - Ogre::RenderTarget* mRT_TextureDepth = mTextureDepth->getBuffer()->getRenderTarget(); - { - Ogre::Viewport *v = mRT_TextureDepth->addViewport(mCamera); - v->setClearEveryFrame(true); - v->setBackgroundColour(Ogre::ColourValue::White); - v->setOverlaysEnabled(false); - v->setMaterialScheme("Depth"); - - mRT_TextureDepth->addListener(&mDepthListener); - - Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); - Ogre::TextureUnitState* t = mat->getTechnique(0)->getPass(0)->getTextureUnitState(3); - t->setTextureName("Depth"); - } - - } - if (Delete) - { - Ogre::RenderTarget* mRT_TextureDepth = mTextureDepth->getBuffer()->getRenderTarget(); - mRT_TextureDepth->removeAllListeners(); - mRT_TextureDepth->removeAllViewports(); - - Ogre::TextureManager::getSingleton().remove("Depth"); - - Ogre::MeshManager::getSingleton().remove("DepthClipPlane"); - } - } - - void Hydrax::CReflectionListener::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) - { - mHydrax->mMesh->getEntity()->setVisible(false); - mHydrax->mReflectionPlane->getParentNode()->translate(0,mHydrax->mPlanesError,0); - - mHydrax->mCamera->enableReflection(mHydrax->mReflectionPlane); - mHydrax->mCamera->enableCustomNearClipPlane(mHydrax->mReflectionPlane); - } - - void Hydrax::CReflectionListener::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) - { - mHydrax->mMesh->getEntity()->setVisible(true); - mHydrax->mReflectionPlane->getParentNode()->translate(0,-mHydrax->mPlanesError,0); - - mHydrax->mCamera->disableReflection(); - mHydrax->mCamera->disableCustomNearClipPlane(); - } - - void Hydrax::CRefractionListener::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) - { - mHydrax->mMesh->getEntity()->setVisible(false); - mHydrax->mRefractionPlane->getParentNode()->translate(0,mHydrax->mPlanesError,0); - - mHydrax->mCamera->enableCustomNearClipPlane(mHydrax->mRefractionPlane); - } - - void Hydrax::CRefractionListener::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) - { - mHydrax->mMesh->getEntity()->setVisible(true); - mHydrax->mRefractionPlane->getParentNode()->translate(0,-mHydrax->mPlanesError,0); - - mHydrax->mCamera->disableCustomNearClipPlane(); - } - - void Hydrax::CDepthListener::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) - { - mHydrax->mMesh->getEntity()->setVisible(false); - - Ogre::SceneManager::MovableObjectIterator it = mHydrax->mSceneManager->getMovableObjectIterator("Entity"); - - Ogre::Entity* cur; - mMaterials.empty(); - - while (it.hasMoreElements()) - { - cur = dynamic_cast<Ogre::Entity*>(it.peekNextValue()); - mMaterials.push(cur->getSubEntity(0)->getMaterialName()); - - if (mHydrax->isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - cur->getSubEntity(0)->setMaterialName("HydraxShaderDepthCaustics"); - } - else - { - cur->getSubEntity(0)->setMaterialName("HydraxShaderDepth"); - } - - it.moveNext(); - } - - mHydrax->mDepthPlane->getParentNode()->translate(0,mHydrax->mPlanesError,0); - mHydrax->mCamera->enableCustomNearClipPlane(mHydrax->mDepthPlane); - } - - void Hydrax::CDepthListener::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) - { - Ogre::SceneManager::MovableObjectIterator it = mHydrax->mSceneManager->getMovableObjectIterator("Entity"); - - Ogre::Entity* cur; - - while (it.hasMoreElements()) - { - std::string name = mMaterials.front(); - - cur = dynamic_cast<Ogre::Entity*>(it.peekNextValue()); - if (Ogre::MaterialManager::getSingleton().resourceExists(name)) - cur->setMaterialName(name); - - mMaterials.pop(); - it.moveNext(); - } - - mHydrax->mMesh->getEntity()->setVisible(true); - - mHydrax->mCamera->disableCustomNearClipPlane(); - mHydrax->mDepthPlane->getParentNode()->translate(0,-mHydrax->mPlanesError,0); - } - - void Hydrax::setPerlinOptions(PerlinOptions PerlinOptions) - { - mPerlinOptions = PerlinOptions; - - if (isCreated()) - { - LOG("[Hydrax] Updating perlin options."); - - Ogre::TextureManager::getSingleton().remove("HydraxHeight"); - Ogre::TextureManager::getSingleton().remove("HydraxNormalMap"); - - mNoiseBuffer.clear(); - - _createTextures(); - _updateTextures(0); - - LOG("[Hydrax] Perlin options updated."); - } - } - - void Hydrax::setMeshOptions(MeshOptions MeshOptions) - { - if (isCreated()) - { - Ogre::String MaterialNameTmp = mMesh->getMaterialName(); - - LOG("[Hydrax] Updating water mesh."); - LOG("[Hydrax] Deleting water mesh."); - - delete mMesh; - - LOG("[Hydrax] Water mesh deleted."); - - LOG("[Hydrax] Creating water mesh."); - mMesh = new Mesh(mSceneManager); - mMesh->setMeshOptions(MeshOptions); - mMesh->setMaterialName(MaterialNameTmp); - mMesh->create(mSceneNode); - setPosition(mPosition); - mMesh->update(mNoiseBuffer[2]); - LOG("[Hydrax] Water mesh created"); - - return; - } - - mMesh->setMeshOptions(MeshOptions); - } - - void Hydrax::setRttOptions(RttOptions RttOptions) - { - mRttOptions = RttOptions; - - if (isCreated()) - { - LOG("[Hydrax] Updating Rtt options."); - - Ogre::RenderTarget* mRT_TextureRefraction = mTextureRefraction->getBuffer()->getRenderTarget(); - mRT_TextureRefraction->removeAllListeners(); - mRT_TextureRefraction->removeAllViewports(); - - Ogre::RenderTarget* mRT_TextureReflection = mTextureReflection->getBuffer()->getRenderTarget(); - mRT_TextureReflection->removeAllListeners(); - mRT_TextureReflection->removeAllViewports(); - - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - Ogre::RenderTarget* mRT_TextureDepth = mTextureDepth->getBuffer()->getRenderTarget(); - mRT_TextureDepth->removeAllListeners(); - mRT_TextureDepth->removeAllViewports(); - - Ogre::TextureManager::getSingleton().remove("Depth"); - } - - Ogre::TextureManager::getSingleton().remove("Reflection"); - Ogre::TextureManager::getSingleton().remove("Refraction"); - - _createRttListeners(); - - LOG("[Hydrax] Rtt options updated."); - } - } - - void Hydrax::setPolygonMode(int Tipe) - { - Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); - - if (Tipe == 0) - { - mat->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_SOLID); - } - else if (Tipe == 1) - { - mat->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_WIREFRAME); - } - else if (Tipe == 2) - { - mat->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_POINTS); - } - } - - void Hydrax::update(Ogre::Real timeSinceLastFrame) - { - if (mVelocity == 0) - { - return; - } - - _updateTextures(timeSinceLastFrame); - mMesh->update(mNoiseBuffer[2]); - } - - void Hydrax::setComponents(HydraxComponent Components) - { - // Create/Delete depth rtt listeners if it's necesary - if (isCreated()) - { - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - if (!(Components & HYDRAX_COMPONENT_DEPTH)) - { - _createDepthRttListener(false, true); - } - } - else - { - if (Components & HYDRAX_COMPONENT_DEPTH) - { - _createDepthRttListener(); - } - } - } - - mComponents = Components; - - /* Shaders: - - 1 - Standard - 2 - Standard, Sun - 3 - Standard, Foam - 4 - Standard, Sun, Foam - - 5 - Depth - 6 - Depth, Sun - 7 - Depth, Foam - 8 - Depth, Sun, Foam - - 9 - Depth, Smooth - 10 - Depth, Smooth, Sun - 11 - Depth, Smooth, Foam - 12 - Depth, Smooth, Sun, Foam - - 13 - Depth, Caustics - 14 - Depth, Sun, Caustics - 15 - Depth, Foam, Caustics - 16 - Depth, Sun, Foam, Caustics - - 17 - Depth, Smooth, Caustics - 18 - Depth, Smooth, Sun, Caustics - 19 - Depth, Smooth, Foam, Caustics - 20 - Depth, Smooth, Sun, Foam, Caustics - */ - - int Index = 1; - - if (isComponent(HYDRAX_COMPONENT_SUN)) - { - Index ++; - } - - if (isComponent(HYDRAX_COMPONENT_FOAM)) - { - Index += 2; - } - - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - Index += 4; - } - - if (isComponent(HYDRAX_COMPONENT_SMOOTH) || isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - Index += 4; - - if (isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - Index += 8; - } - } - else - { - // Delete smooth component: Mask flags can't be removed - // so we have to evaluate all posibilities - // and reasign components... - - if (isComponent(HYDRAX_COMPONENT_SUN) && - isComponent(HYDRAX_COMPONENT_FOAM) && - isComponent(HYDRAX_COMPONENT_PLSM2)) - { - mComponents = static_cast<HydraxComponent> - (HYDRAX_COMPONENT_SUN | - HYDRAX_COMPONENT_FOAM | - HYDRAX_COMPONENT_PLSM2); - } - else - if (isComponent(HYDRAX_COMPONENT_SUN) && - isComponent(HYDRAX_COMPONENT_FOAM)) - { - mComponents = static_cast<HydraxComponent> - (HYDRAX_COMPONENT_SUN | - HYDRAX_COMPONENT_FOAM); - } - else - if (isComponent(HYDRAX_COMPONENT_SUN) && - isComponent(HYDRAX_COMPONENT_PLSM2)) - { - mComponents = static_cast<HydraxComponent> - (HYDRAX_COMPONENT_SUN | - HYDRAX_COMPONENT_PLSM2); - } - else - if (isComponent(HYDRAX_COMPONENT_FOAM) && - isComponent(HYDRAX_COMPONENT_PLSM2)) - { - mComponents = static_cast<HydraxComponent> - (HYDRAX_COMPONENT_FOAM | - HYDRAX_COMPONENT_PLSM2); - } - else - if (isComponent(HYDRAX_COMPONENT_SUN)) - { - mComponents = static_cast<HydraxComponent> - (HYDRAX_COMPONENT_SUN); - } - else - if (isComponent(HYDRAX_COMPONENT_FOAM)) - { - mComponents = static_cast<HydraxComponent> - (HYDRAX_COMPONENT_FOAM); - } - else - if (isComponent(HYDRAX_COMPONENT_PLSM2)) - { - mComponents = static_cast<HydraxComponent> - (HYDRAX_COMPONENT_PLSM2); - } - - LOG("[Hydrax] Requested component needs depth component... requested component desactivated."); - } - } - - mMesh->setMaterialName(Ogre::String("HydraxShader"+Ogre::StringConverter::toString(Index))); - } - - bool Hydrax::isComponent(HydraxComponent Component) - { - if (mComponents & Component) - { - return true; - } - - if (Component == HYDRAX_COMPONENTS_NONE && mComponents == HYDRAX_COMPONENTS_NONE) - { - return true; - } - - if (Component == HYDRAX_COMPONENTS_ALL && mComponents == HYDRAX_COMPONENTS_ALL) - { - return true; - } - - return false; - } - - void Hydrax::_setWaterVertexProgramParameter(Ogre::String Param, float Value) - { - Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); - mat->getTechnique(0)->getPass(0)->getVertexProgramParameters()->setNamedConstant(Param, Value); - } - - void Hydrax::_setWaterFragmentProgramParameter(Ogre::String Param, float Value) - { - Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); - mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant(Param, Value); - } - - void Hydrax::_setWaterVertexProgramParameter(Ogre::String Param, Ogre::Vector3 Value) - { - Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); - mat->getTechnique(0)->getPass(0)->getVertexProgramParameters()->setNamedConstant(Param, Value); - } - - void Hydrax::_setWaterFragmentProgramParameter(Ogre::String Param, Ogre::Vector3 Value) - { - Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); - mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant(Param, Value); - } - - void Hydrax::_setDepthVertexProgramParameter(Ogre::String Param, float Value) - { - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - // Entity's depth shader - Ogre::MaterialPtr mat; - - if (isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - mat = Ogre::MaterialManager::getSingleton().getByName("HydraxShaderDepthCaustics"); - } - else - { - mat = Ogre::MaterialManager::getSingleton().getByName("HydraxShaderDepth"); - } - - try - { - if (!mat.isNull()) - { - mat->getTechnique(0)->getPass(0)->getVertexProgramParameters()->setNamedConstant(Param, Value); - } - } - catch (...) - { - } - - // Terrain depth shader - if (isComponent(HYDRAX_COMPONENT_PLSM2)) - { - int w, h; - - mSceneManager->getOption("Width", &w); - mSceneManager->getOption("Height", &h); - - Ogre::String Mapa; - Ogre::String Formato; - - mSceneManager->getOption("CurrentMap", &Mapa); - mSceneManager->getOption("CurrentTextureFormat", &Formato); - - for (int i = 0; i < w; i++) - { - for (int j = 0; j < h; j++) - { - Ogre::String NombreMaterial = Formato + "." + Ogre::StringConverter::toString(i) + "." + Ogre::StringConverter::toString(j) + "." + Mapa; - - mat = Ogre::MaterialManager::getSingleton().getByName(NombreMaterial); - - if (!mat.isNull()) - { - try - { - mat->getTechnique(1)->getPass(0)->getVertexProgramParameters()->setNamedConstant(Param, Value); - } - catch (...) - { - } - } - } - } - } - } - } - - void Hydrax::_setDepthFragmentProgramParameter(Ogre::String Param, float Value) - { - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - // Entity's depth shader - Ogre::MaterialPtr mat; - - if (isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - mat = Ogre::MaterialManager::getSingleton().getByName("HydraxShaderDepthCaustics"); - } - else - { - mat = Ogre::MaterialManager::getSingleton().getByName("HydraxShaderDepth"); - } - - try - { - if (!mat.isNull()) - { - mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant(Param, Value); - } - } - catch (...) - { - } - - // Terrain depth shader - if (isComponent(HYDRAX_COMPONENT_PLSM2)) - { - int w, h; - - mSceneManager->getOption("Width", &w); - mSceneManager->getOption("Height", &h); - - Ogre::String Mapa; - Ogre::String Formato; - - mSceneManager->getOption("CurrentMap", &Mapa); - mSceneManager->getOption("CurrentTextureFormat", &Formato); - - for (int i = 0; i < w; i++) - { - for (int j = 0; j < h; j++) - { - Ogre::String NombreMaterial = Formato + "." + Ogre::StringConverter::toString(i) + "." + Ogre::StringConverter::toString(j) + "." + Mapa; - - mat = Ogre::MaterialManager::getSingleton().getByName(NombreMaterial); - - if (!mat.isNull()) - { - try - { - mat->getTechnique(1)->getPass(0)->getFragmentProgramParameters()->setNamedConstant(Param, Value); - } - catch (...) - { - } - } - } - } - } - } - } - - void Hydrax::_setDepthVertexProgramParameter(Ogre::String Param, Ogre::Vector3 Value) - { - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - // Entity's depth shader - Ogre::MaterialPtr mat; - - if (isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - mat = Ogre::MaterialManager::getSingleton().getByName("HydraxShaderDepthCaustics"); - } - else - { - mat = Ogre::MaterialManager::getSingleton().getByName("HydraxShaderDepth"); - } - - try - { - if (!mat.isNull()) - { - mat->getTechnique(0)->getPass(0)->getVertexProgramParameters()->setNamedConstant(Param, Value); - } - } - catch (...) - { - } - - // Terrain depth shader - if (isComponent(HYDRAX_COMPONENT_PLSM2)) - { - int w, h; - - mSceneManager->getOption("Width", &w); - mSceneManager->getOption("Height", &h); - - Ogre::String Mapa; - Ogre::String Formato; - - mSceneManager->getOption("CurrentMap", &Mapa); - mSceneManager->getOption("CurrentTextureFormat", &Formato); - - for (int i = 0; i < w; i++) - { - for (int j = 0; j < h; j++) - { - Ogre::String NombreMaterial = Formato + "." + Ogre::StringConverter::toString(i) + "." + Ogre::StringConverter::toString(j) + "." + Mapa; - - mat = Ogre::MaterialManager::getSingleton().getByName(NombreMaterial); - - if (!mat.isNull()) - { - try - { - mat->getTechnique(1)->getPass(0)->getVertexProgramParameters()->setNamedConstant(Param, Value); - } - catch (...) - { - } - } - } - } - } - } - } - - void Hydrax::_setDepthFragmentProgramParameter(Ogre::String Param, Ogre::Vector3 Value) - { - if (isComponent(HYDRAX_COMPONENT_DEPTH)) - { - // Entity's depth shader - Ogre::MaterialPtr mat; - - if (isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - mat = Ogre::MaterialManager::getSingleton().getByName("HydraxShaderDepthCaustics"); - } - else - { - mat = Ogre::MaterialManager::getSingleton().getByName("HydraxShaderDepth"); - } - - try - { - if (!mat.isNull()) - { - mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant(Param, Value); - } - } - catch (...) - { - } - - // Terrain depth shader - if (isComponent(HYDRAX_COMPONENT_PLSM2)) - { - int w, h; - - mSceneManager->getOption("Width", &w); - mSceneManager->getOption("Height", &h); - - Ogre::String Mapa; - Ogre::String Formato; - - mSceneManager->getOption("CurrentMap", &Mapa); - mSceneManager->getOption("CurrentTextureFormat", &Formato); - - for (int i = 0; i < w; i++) - { - for (int j = 0; j < h; j++) - { - Ogre::String NombreMaterial = Formato + "." + Ogre::StringConverter::toString(i) + "." + Ogre::StringConverter::toString(j) + "." + Mapa; - - mat = Ogre::MaterialManager::getSingleton().getByName(NombreMaterial); - - if (!mat.isNull()) - { - try - { - mat->getTechnique(1)->getPass(0)->getFragmentProgramParameters()->setNamedConstant(Param, Value); - } - catch (...) - { - } - } - } - } - } - } - } - - void Hydrax::setPosition(Ogre::Vector3 Position) - { - mPosition = Position; - - _setDepthVertexProgramParameter("uPlaneYPos", Position.y); - - mSceneNode->setPosition(Position); - mPlanesSceneNode->setPosition(Position); - } - - void Hydrax::setPlanesError(Ogre::Real PlanesError) - { - mPlanesError = PlanesError; - } - - void Hydrax::setStrength(Ogre::Real Strength) - { - mMesh->setStrength(Strength); - } - - void Hydrax::setVelocity(Ogre::Real Velocity) - { - mVelocity = Velocity; - } - - void Hydrax::setFullReflectionDistance(Ogre::Real FullReflectionDistance) - { - mFullReflectionDistance = FullReflectionDistance; - - _setWaterFragmentProgramParameter("uFullReflectionDistance", FullReflectionDistance); - } - - void Hydrax::setGlobalTransparency(Ogre::Real GlobalTransparency) - { - mGlobalTransparency = GlobalTransparency; - - _setWaterFragmentProgramParameter("uGlobalTransparency", GlobalTransparency); - } - - void Hydrax::setNormalDistortion(Ogre::Real NormalDistortion) - { - mNormalDistortion = NormalDistortion; - - _setWaterFragmentProgramParameter("uNormalDistortion", NormalDistortion); - } - - void Hydrax::setSunPosition(Ogre::Vector3 SunPosition) - { - if (!isComponent(HYDRAX_COMPONENT_SUN)) - { - return; - } - - mSunPosition = SunPosition; - - _setWaterFragmentProgramParameter("uSunPosition", SunPosition); - } - - void Hydrax::setSunStrength(Ogre::Real SunStrength) - { - if (!isComponent(HYDRAX_COMPONENT_SUN)) - { - return; - } - - mSunStrength = SunStrength; - - _setWaterFragmentProgramParameter("uSunStrength", SunStrength); - } - - void Hydrax::setSunArea(Ogre::Real SunArea) - { - if (!isComponent(HYDRAX_COMPONENT_SUN)) - { - return; - } - - mSunArea = SunArea; - - _setWaterFragmentProgramParameter("uSunArea", SunArea); - } - - void Hydrax::setFoamMaxDistance(Ogre::Real FoamMaxDistance) - { - if (!isComponent(HYDRAX_COMPONENT_FOAM)) - { - return; - } - - mFoamMaxDistance = FoamMaxDistance; - - _setWaterFragmentProgramParameter("uFoamMaxDistance", FoamMaxDistance); - } - - void Hydrax::setFoamScale(Ogre::Real FoamScale) - { - if (!isComponent(HYDRAX_COMPONENT_FOAM)) - { - return; - } - - mFoamScale = FoamScale; - - _setWaterFragmentProgramParameter("uFoamScale", FoamScale); - } - - void Hydrax::setFoamStart(Ogre::Real FoamStart) - { - if (!isComponent(HYDRAX_COMPONENT_FOAM)) - { - return; - } - - mFoamStart = FoamStart; - - _setWaterFragmentProgramParameter("uFoamStart", FoamStart); - } - - void Hydrax::setFoamTransparency(Ogre::Real FoamTransparency) - { - if (!isComponent(HYDRAX_COMPONENT_FOAM)) - { - return; - } - - mFoamTransparency = FoamTransparency; - - _setWaterFragmentProgramParameter("uFoamTransparency", FoamTransparency); - } - - void Hydrax::setSunColor(Ogre::Vector3 SunColor) - { - if (!isComponent(HYDRAX_COMPONENT_SUN)) - { - return; - } - - mSunColor = SunColor; - - _setWaterFragmentProgramParameter("uSunColor", SunColor); - } - - void Hydrax::setDepthColor(Ogre::Vector3 DepthColor) - { - if (!isComponent(HYDRAX_COMPONENT_DEPTH)) - { - return; - } - - mDepthColor = DepthColor; - - _setWaterFragmentProgramParameter("uDepthColor", DepthColor); - } - - void Hydrax::setDepthLimit(Ogre::Real DepthLimit) - { - if (!isComponent(HYDRAX_COMPONENT_DEPTH)) - { - return; - } - - if (DepthLimit <= 0) - { - DepthLimit = 1; - } - - mDepthLimit = DepthLimit; - - _setDepthFragmentProgramParameter("uDepthLimit", 1/DepthLimit); - } - - void Hydrax::setSmoothPower(Ogre::Real SmoothPower) - { - if (!isComponent(HYDRAX_COMPONENT_SMOOTH)) - { - return; - } - - mSmoothPower = SmoothPower; - - _setWaterFragmentProgramParameter("uSmoothPower", SmoothPower); - } - - void Hydrax::setCausticsScale(Ogre::Real CausticsScale) - { - if (!isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - return; - } - - mCausticsScale = CausticsScale; - - _setDepthFragmentProgramParameter("uCausticsScale", CausticsScale); - } - - void Hydrax::setCausticsPower(Ogre::Real CausticsPower) - { - if (!isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - return; - } - - mCausticsPower = CausticsPower; - - _setWaterFragmentProgramParameter("uCausticsPower", CausticsPower); - } - - void Hydrax::setCausticsEnd(Ogre::Real CausticsEnd) - { - if (!isComponent(HYDRAX_COMPONENT_CAUSTICS)) - { - return; - } - - mCausticsEnd = CausticsEnd; - - _setWaterFragmentProgramParameter("uCausticsEnd", CausticsEnd); - } -} Deleted: trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h 2008-08-09 21:51:33 UTC (rev 686) +++ trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h 2008-08-15 08:04:11 UTC (rev 687) @@ -1,648 +0,0 @@ -/* --------------------------------------------------------------------------------- -This source file is part of Hydrax. -Visit --- - -Copyright (C) 2007 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> - <xa...@gm...> - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/gpl.html. --------------... [truncated message content] |
From: <and...@us...> - 2008-08-15 08:08:02
|
Revision: 688 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=688&view=rev Author: andy_miller Date: 2008-08-15 08:08:10 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Adding Hydrax 0.3 to the svn Added Paths: ----------- trunk/python-ogre/ThirdParty/Hydrax/DecalsManager.cpp trunk/python-ogre/ThirdParty/Hydrax/DecalsManager.h trunk/python-ogre/ThirdParty/Hydrax/Enums.cpp trunk/python-ogre/ThirdParty/Hydrax/Enums.h trunk/python-ogre/ThirdParty/Hydrax/Help.cpp trunk/python-ogre/ThirdParty/Hydrax/Help.h trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h trunk/python-ogre/ThirdParty/Hydrax/Image.cpp trunk/python-ogre/ThirdParty/Hydrax/Image.h trunk/python-ogre/ThirdParty/Hydrax/MaterialManager.cpp trunk/python-ogre/ThirdParty/Hydrax/MaterialManager.h trunk/python-ogre/ThirdParty/Hydrax/Mesh.cpp trunk/python-ogre/ThirdParty/Hydrax/Mesh.h trunk/python-ogre/ThirdParty/Hydrax/Module.cpp trunk/python-ogre/ThirdParty/Hydrax/Module.h trunk/python-ogre/ThirdParty/Hydrax/Noise.cpp trunk/python-ogre/ThirdParty/Hydrax/Noise.h trunk/python-ogre/ThirdParty/Hydrax/Perlin.cpp trunk/python-ogre/ThirdParty/Hydrax/Perlin.h trunk/python-ogre/ThirdParty/Hydrax/Prerequisites.cpp trunk/python-ogre/ThirdParty/Hydrax/Prerequisites.h trunk/python-ogre/ThirdParty/Hydrax/ProjectedGrid.cpp trunk/python-ogre/ThirdParty/Hydrax/ProjectedGrid.h trunk/python-ogre/ThirdParty/Hydrax/SimpleGrid.cpp trunk/python-ogre/ThirdParty/Hydrax/SimpleGrid.h trunk/python-ogre/ThirdParty/Hydrax/Structs.cpp trunk/python-ogre/ThirdParty/Hydrax/Structs.h trunk/python-ogre/ThirdParty/Hydrax/TextureManager.cpp trunk/python-ogre/ThirdParty/Hydrax/TextureManager.h trunk/python-ogre/code_generators/hydrax/ trunk/python-ogre/code_generators/hydrax/customization_data.py trunk/python-ogre/code_generators/hydrax/generate_code.py trunk/python-ogre/code_generators/hydrax/hand_made_wrappers.py trunk/python-ogre/code_generators/hydrax/python_hydrax.h trunk/python-ogre/code_generators/hydrax/python_hydrax_aliases.h trunk/python-ogre/code_generators/hydrax/python_hydrax_sizeof.h Added: trunk/python-ogre/ThirdParty/Hydrax/DecalsManager.cpp =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/DecalsManager.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/Hydrax/DecalsManager.cpp 2008-08-15 08:08:10 UTC (rev 688) @@ -0,0 +1,271 @@ +/* +-------------------------------------------------------------------------------- +This source file is part of Hydrax. +Visit --- + +Copyright (C) 2008 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> + <xa...@gm...> + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA, or go to +http://www.gnu.org/copyleft/lesser.txt. +-------------------------------------------------------------------------------- +*/ + +#include "DecalsManager.h" + +#include "Hydrax.h" + +namespace Hydrax +{ + Decal::Decal(Hydrax *h, const Ogre::String &TextureName, const int& Id) + : mHydrax(h) + , mTextureName(TextureName) + , mId(Id) + , mRegisteredPass(0) + , mPosition(Ogre::Vector2(0,0)) + , mSize(Ogre::Vector2(1,1)) + , mOrientation(Ogre::Radian(0)) + , mTransparency(1) + , mVisible(true) + { + mProjector = new Ogre::Frustum(); + mProjector->setProjectionType(Ogre::PT_ORTHOGRAPHIC); + + mSceneNode = mHydrax->getSceneManager()->getRootSceneNode()->createChildSceneNode(); + mSceneNode->attachObject(mProjector); + mSceneNode->setPosition(Ogre::Vector3(0,0,0)); + mSceneNode->setOrientation(Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::NEGATIVE_UNIT_X)); + + setPosition(mPosition); + setSize(mSize); + setOrientation(mOrientation); + } + + Decal::~Decal() + { + if (mRegisteredPass) + { + mRegisteredPass->getParent()->removePass(mRegisteredPass->getIndex()); + mRegisteredPass = static_cast<Ogre::Pass*>(NULL); + } + + mSceneNode->getParentSceneNode()->removeAndDestroyChild(mSceneNode->getName()); + + delete mProjector; + } + + void Decal::registerPass(Ogre::Pass* _Pass) + { + if (mRegisteredPass) + { + mRegisteredPass->getParent()->removePass(mRegisteredPass->getIndex()); + mRegisteredPass = static_cast<Ogre::Pass*>(NULL); + } + + _Pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); + _Pass->setDepthBias(1,1); + _Pass->setLightingEnabled(false); + _Pass->setDepthWriteEnabled(false); + + Ogre::TextureUnitState *DecalTexture = _Pass->createTextureUnitState(mTextureName); + DecalTexture->setProjectiveTexturing(true, mProjector); + DecalTexture->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP); + DecalTexture->setTextureFiltering(Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_NONE); + DecalTexture->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_TEXTURE, Ogre::LBS_MANUAL, 1.0, mTransparency); + + mRegisteredPass = _Pass; + } + + void Decal::unregister() + { + if (mRegisteredPass) + { + mRegisteredPass->getParent()->removePass(mRegisteredPass->getIndex()); + mRegisteredPass = static_cast<Ogre::Pass*>(NULL); + } + } + + void Decal::setPosition(const Ogre::Vector2& Position) + { + mPosition = Position; + + mSceneNode->setPosition(Position.x, 0, Position.y); + } + + void Decal::setSize(const Ogre::Vector2& Size) + { + mSize = Size; + + // This method is only available in the CVS HEAD, + // if you have problems compiling, just comment the + // following line: + mProjector->setOrthoWindow(Size.x, Size.y); + } + + void Decal::setOrientation(const Ogre::Radian& Orientation) + { + mSceneNode->rotate(Ogre::Vector3::UNIT_Z, -mOrientation + Orientation); + + mOrientation = Orientation; + } + + void Decal::setTransparency(const Ogre::Real& Transparency) + { + mTransparency = Transparency; + + if (mRegisteredPass) + { + mRegisteredPass->getTextureUnitState(0) + ->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_TEXTURE, Ogre::LBS_MANUAL, 1.0, mTransparency); + } + } + + void Decal::setVisible(const bool& Visible) + { + mVisible = Visible; + + unregister(); + } + + // -------------------------------------------------------------------- + + DecalsManager::DecalsManager(Hydrax *h) + : mHydrax(h) + , mNextId(0) + , mWaterStrength(5) + { + } + + DecalsManager::~DecalsManager() + { + for(DecalIt = mDecals.begin(); DecalIt != mDecals.end(); DecalIt++) + { + delete (*DecalIt); + } + + mDecals.clear(); + } + + void DecalsManager::update() + { + if (mHydrax->getCamera()->getPosition() == mLastPosition && + mHydrax->getCamera()->getOrientation() == mLastOrientation) + { + return; + } + + Ogre::Vector2 DPos; + Ogre::Real HHeight = mHydrax->getPosition().y; + Ogre::Vector2 DSize; + Ogre::AxisAlignedBox DecalBox; + + for(DecalIt = mDecals.begin(); DecalIt != mDecals.end(); DecalIt++) + { + if (!(*DecalIt)->isVisible()) + { + continue; + } + + DPos = (*DecalIt)->getPosition(); + DSize = (*DecalIt)->getSize()/2; + + DecalBox = Ogre::AxisAlignedBox(DPos.x - DSize.x, HHeight - mWaterStrength, DPos.y - DSize.y, + DPos.x + DSize.x, HHeight + mWaterStrength, DPos.y + DSize.y); + + if (mHydrax->getCamera()->isVisible(DecalBox)) + { + if (!(*DecalIt)->getRegisteredPass()) + { + (*DecalIt)->registerPass( + mHydrax->getMaterialManager()->getMaterial(MaterialManager::MAT_WATER)-> + getTechnique(0)->createPass()); + } + } + else + { + (*DecalIt)->unregister(); + } + } + + mLastPosition = mHydrax->getCamera()->getPosition(); + mLastOrientation = mHydrax->getCamera()->getOrientation(); + } + + Decal* DecalsManager::add(const Ogre::String& TextureName) + { + Decal* NewDecal = new Decal(mHydrax, TextureName, mNextId); + + mDecals.push_back(NewDecal); + + if (mHydrax->getMaterialManager()->isCreated()) + { + NewDecal->registerPass( + mHydrax->getMaterialManager()->getMaterial(MaterialManager::MAT_WATER)-> + getTechnique(0)->createPass()); + } + + mNextId++; + + return NewDecal; + } + + Decal* DecalsManager::get(const int& Id) + { + for(DecalIt = mDecals.begin(); DecalIt != mDecals.end(); DecalIt++) + { + if((*DecalIt)->getId() == Id) + { + return (*DecalIt); + } + } + + return static_cast<Decal*>(NULL); + } + + void DecalsManager::remove(const int& Id) + { + for(DecalIt = mDecals.begin(); DecalIt != mDecals.end(); DecalIt++) + { + if((*DecalIt)->getId() == Id) + { + delete (*DecalIt); + mDecals.erase(DecalIt); + + return; + } + } + } + + void DecalsManager::removeAll() + { + for(DecalIt = mDecals.begin(); DecalIt != mDecals.end(); DecalIt++) + { + delete (*DecalIt); + } + + mDecals.clear(); + + mNextId = 0; + } + + void DecalsManager::registerAll() + { + for(DecalIt = mDecals.begin(); DecalIt != mDecals.end(); DecalIt++) + { + (*DecalIt)->registerPass( + mHydrax->getMaterialManager()->getMaterial(MaterialManager::MAT_WATER)-> + getTechnique(0)->createPass()); + } + } +} Added: trunk/python-ogre/ThirdParty/Hydrax/DecalsManager.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/DecalsManager.h (rev 0) +++ trunk/python-ogre/ThirdParty/Hydrax/DecalsManager.h 2008-08-15 08:08:10 UTC (rev 688) @@ -0,0 +1,283 @@ +/* +-------------------------------------------------------------------------------- +This source file is part of Hydrax. +Visit --- + +Copyright (C) 2008 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> + <xa...@gm...> + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA, or go to +http://www.gnu.org/copyleft/lesser.txt. +-------------------------------------------------------------------------------- +*/ + +#ifndef _Hydrax_DecalsManager_H_ +#define _Hydrax_DecalsManager_H_ + +#include "Prerequisites.h" + +namespace Hydrax +{ + class Hydrax; + + /** Decal class. + */ + class DllExport Decal + { + public: + /** Constructor + @param h Hydrax parent pointer + @param TextureName Texture name + @param Id Decal Id + */ + Decal(Hydrax *h, const Ogre::String &TextureName, const int& Id); + + /** Destructor + */ + ~Decal(); + + /** Register the decal int the specified pass + @param _Pass Pass to be registred + */ + void registerPass(Ogre::Pass* _Pass); + + /** Unregister from current technique + */ + void unregister(); + + /** Get decal texture name + @return Decal texture name + */ + inline const Ogre::String& getTextureName() const + { + return mTextureName; + } + + /** Get the decal Id + @return Decal Id + */ + inline const int& getId() const + { + return mId; + } + + /** Get the decal projector + @return Projector frustum + */ + inline Ogre::Frustum* getProjector() + { + return mProjector; + } + + /** Get the decal scene node + @return Decal scene node + */ + inline Ogre::SceneNode* getSceneNode() + { + return mSceneNode; + } + + /** Get the pass the decal is in + @return Registered pass + @remarks return NULL if decal isn't registered + */ + inline Ogre::Pass *getRegisteredPass() + { + return mRegisteredPass; + } + + /** Get decal position + @return Decal position + */ + inline const Ogre::Vector2& getPosition() const + { + return mPosition; + } + + /** Get decal size + @return Decal size + */ + inline const Ogre::Vector2& getSize() const + { + return mSize; + } + + /** Get decal orientation + @return Decal orientation + */ + inline const Ogre::Radian& getOrientation() const + { + return mOrientation; + } + + /** Get decal transparency + @return Decal transparency + */ + inline const Ogre::Real& getTransparency() const + { + return mTransparency; + } + + /** Is decal visile? + @return true if decal is visible + */ + inline const bool& isVisible() const + { + return mVisible; + } + + /** Set decal position + @param Position Decal position + */ + void setPosition(const Ogre::Vector2& Position); + + /** Set decal size + @param Size Decal size in world coordinates + */ + void setSize(const Ogre::Vector2& Size); + + /** Set decal orientation + @param Orientation Decal orientation + */ + void setOrientation(const Ogre::Radian& Orientation); + + /** Set decal transparency + @param Transparency Decal transparency in [0,1] range + @remarks 0 = Full transparent, 1 = Full opacity + */ + void setTransparency(const Ogre::Real& Transparency); + + /** Set decal visibile or not + @param Visible true if yes, false if not + */ + void setVisible(const bool& Visible); + + private: + /// Decal texture name + Ogre::String mTextureName; + /// Decal Id + int mId; + /// Decal projector + Ogre::Frustum *mProjector; + /// Decal scene node + Ogre::SceneNode *mSceneNode; + /// Registered pass + Ogre::Pass *mRegisteredPass; + + /// Position + Ogre::Vector2 mPosition; + /// Size + Ogre::Vector2 mSize; + /// Orientation + Ogre::Radian mOrientation; + /// Transparency + Ogre::Real mTransparency; + /// Is decal visible? + bool mVisible; + + /// Hydrax parent pointer + Hydrax *mHydrax; + }; + + /** Decals manager class. Use it for place any kind of texture + over the water! Like ship trails, overwater vegetables, ... + */ + class DllExport DecalsManager + { + public: + /** Constructor + @param h Hydrax parent pointer + */ + DecalsManager(Hydrax *h); + + /** Destructor + */ + ~DecalsManager(); + + /** Update decal manager + @remarks Call each frame + */ + void update(); + + /** Add decal + @param TextureName Texture name + @return Hydrax::Decal* Use it as a usual Ogre::SceneNode(Decal::getSceneNode()) for position, rotate...etc! + */ + Decal* add(const Ogre::String& TextureName); + + /** Get decal + @param Id Decal Id + @return Hydrax::Decal* + */ + Decal* get(const int& Id); + + /** Remove decal + @param Id Decal Id + */ + void remove(const int& Id); + + /** Remove all decals + */ + void removeAll(); + + /** Register all decals + @remarks Use it when water material is (re)created + */ + void registerAll(); + + /** Get decals std::vector + @return std::vector<Decal*> list + */ + inline std::vector<Decal*> getDecals() + { + return mDecals; + } + + /** Get water strength (used for decals culling) + @return Water strength + */ + inline const Ogre::Real _getWaterStrength() const + { + return mWaterStrength; + } + + /** Set water strength (used for decals culling) + @param WaterStrength Water strength + */ + inline void _setWaterStrength(const Ogre::Real &WaterStrength) + { + mWaterStrength = WaterStrength; + } + + private: + /// Decals std::vector + std::vector<Decal*> mDecals; + /// Decal iterator + std::vector<Decal*>::iterator DecalIt; + /// Next Id + int mNextId; + + /// Water strength (For decals culling) + Ogre::Real mWaterStrength; + + /// Last camera position, orientation + Ogre::Vector3 mLastPosition; + Ogre::Quaternion mLastOrientation; + + /// Hydrax parent pointer + Hydrax *mHydrax; + }; +}; + +#endif \ No newline at end of file Added: trunk/python-ogre/ThirdParty/Hydrax/Enums.cpp =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Enums.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/Hydrax/Enums.cpp 2008-08-15 08:08:10 UTC (rev 688) @@ -0,0 +1,30 @@ +/* +-------------------------------------------------------------------------------- +This source file is part of Hydrax. +Visit --- + +Copyright (C) 2008 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> + <xa...@gm...> + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA, or go to +http://www.gnu.org/copyleft/lesser.txt. +-------------------------------------------------------------------------------- +*/ + +#include "Enums.h" + +namespace Hydrax +{ + +} Added: trunk/python-ogre/ThirdParty/Hydrax/Enums.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Enums.h (rev 0) +++ trunk/python-ogre/ThirdParty/Hydrax/Enums.h 2008-08-15 08:08:10 UTC (rev 688) @@ -0,0 +1,66 @@ +/* +-------------------------------------------------------------------------------- +This source file is part of Hydrax. +Visit --- + +Copyright (C) 2008 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> + <xa...@gm...> + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA, or go to +http://www.gnu.org/copyleft/lesser.txt. +-------------------------------------------------------------------------------- +*/ + +#ifndef _Hydrax_Enums_H_ +#define _Hydrax_Enums_H_ + +#include "Prerequisites.h" + +namespace Hydrax +{ + /** Texture quality enumeration(2^n) + */ + DllExport enum TextureQuality + { + TEX_QUA_2 = 2, + TEX_QUA_4 = 4, + TEX_QUA_8 = 8, + TEX_QUA_16 = 16, + TEX_QUA_32 = 32, + TEX_QUA_64 = 64, + TEX_QUA_128 = 128, + TEX_QUA_256 = 256, + TEX_QUA_512 = 512, + TEX_QUA_1024 = 1024 + }; + + /** Hydrax flags for select the components + that we want to use. + 0 for none, 1 for all. + */ + DllExport enum HydraxComponent + { + HYDRAX_COMPONENT_SUN = 1 << 0, + HYDRAX_COMPONENT_FOAM = 1 << 1, + HYDRAX_COMPONENT_DEPTH = 1 << 2, + /// Smooth transitions and caustics components need depth component + HYDRAX_COMPONENT_SMOOTH = 1 << 3, + HYDRAX_COMPONENT_CAUSTICS = 1 << 4, + + HYDRAX_COMPONENTS_NONE = 0x0000, + HYDRAX_COMPONENTS_ALL = 0x001F, + }; +} + +#endif Added: trunk/python-ogre/ThirdParty/Hydrax/Help.cpp =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Help.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/Hydrax/Help.cpp 2008-08-15 08:08:10 UTC (rev 688) @@ -0,0 +1,74 @@ +/* +-------------------------------------------------------------------------------- +This source file is part of Hydrax. +Visit --- + +Copyright (C) 2008 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> + <xa...@gm...> + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA, or go to +http://www.gnu.org/copyleft/lesser.txt. +-------------------------------------------------------------------------------- +*/ + +#include "Help.h" + +namespace Hydrax +{ + Ogre::Vector2 Math::intersectionOfTwoLines(const Ogre::Vector2 &a, const Ogre::Vector2 &b, + const Ogre::Vector2 &c, const Ogre::Vector2 &d) + { + float r, s, denominator = (b.x - a.x) * (d.y - c.y) - (b.y - a.y) * (d.x - c.x); + + // If the denominator in above is zero, AB & CD are colinear + if (denominator == 0) + { + return Ogre::Vector2::ZERO; + } + + float numeratorR = (a.y - c.y) * (d.x - c.x) - (a.x - c.x) * (d.y - c.y); + // If the numerator above is also zero, AB & CD are collinear. + // If they are collinear, then the segments may be projected to the x- + // or y-axis, and overlap of the projected intervals checked. + + r = numeratorR / denominator; + + float numeratorS = (a.y - c.y) * (b.x - a.x) - (a.x - c.x) * (b.y - a.y); + + s = numeratorS / denominator; + + // If 0<=r<=1 & 0<=s<=1, intersection exists + // r<0 or r>1 or s<0 or s>1 line segments do not intersect + if (r < 0 || r > 1 || s < 0 || s > 1) + { + return Ogre::Vector2::ZERO; + } + + ///* + // Note: + // If the intersection point of the 2 lines are needed (lines in this + // context mean infinite lines) regardless whether the two line + // segments intersect, then + // + // If r>1, P is located on extension of AB + // If r<0, P is located on extension of BA + // If s>1, P is located on extension of CD + // If s<0, P is located on extension of DC + //*/ + + // Find intersection point + return Ogre::Vector2((a.x + (r * (b.x - a.x))), + (a.y + (r * (b.y - a.y)))); + } +} Added: trunk/python-ogre/ThirdParty/Hydrax/Help.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Help.h (rev 0) +++ trunk/python-ogre/ThirdParty/Hydrax/Help.h 2008-08-15 08:08:10 UTC (rev 688) @@ -0,0 +1,118 @@ +/* +-------------------------------------------------------------------------------- +This source file is part of Hydrax. +Visit --- + +Copyright (C) 2008 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> + <xa...@gm...> + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA, or go to +http://www.gnu.org/copyleft/lesser.txt. +-------------------------------------------------------------------------------- +*/ + +#ifndef _Hydrax_Help_H_ +#define _Hydrax_Help_H_ + +#include "Prerequisites.h" + +namespace Hydrax +{ + /** Struct wich contains an especific width and height value + */ + struct DllExport Size + { + /// Width value + int Width; + /// Height value + int Height; + + /** Default constructor + */ + Size() + { + Width = 0; + Height = 0; + } + + /** Constructor + @param size The width and height values + */ + Size(const int &size) + { + Width = size; + Height = size; + } + + /** Constructor + @param width Width value + @param height Height value + */ + Size(const int &width, const int &height) + { + Width = width; + Height = height; + } + + /** Destructor + */ + ~Size() + { + } + + /** Sets the same width and height value + @param size The width and height values + */ + void setSize(const int &size) + { + Width = size; + Height = size; + } + + /** Sets the especified values + @param width Width value + @param height Height value + */ + void setSize(const int &width, const int &height) + { + Width = width; + Height = height; + } + }; + + /** Math class with some help funtions + */ + class Math + { + public: + /** Constructor + */ + Math(){}; + /** Destructor + */ + ~Math(){}; + + /** Find the intersection point of two lines + @param a First line origin + @param b First line final + @param c First line origin + @param d First line final + @return Ogre::Vector2::ZERO if there isn't intersection, intersection point + */ + static Ogre::Vector2 intersectionOfTwoLines(const Ogre::Vector2 &a, const Ogre::Vector2 &b, + const Ogre::Vector2 &c, const Ogre::Vector2 &d); + }; +} + +#endif Added: trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp 2008-08-15 08:08:10 UTC (rev 688) @@ -0,0 +1,1210 @@ +/* +-------------------------------------------------------------------------------- +This source file is part of Hydrax. +Visit --- + +Copyright (C) 2008 Xavier Vergu\xEDn Gonz\xE1lez <xav...@ho...> + <xa...@gm...> + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA, or go to +http://www.gnu.org/copyleft/lesser.txt. +-------------------------------------------------------------------------------- +*/ + +#pragma warning(disable:4355) + +#include "Hydrax.h" + +namespace Hydrax +{ + + Hydrax::Hydrax(Ogre::SceneManager *sm, Ogre::Camera *c) + : mSceneManager(sm) + , mCamera(c) + , mCreated(false) + , mPolygonMode(0) + , mShaderMode(MaterialManager::SM_HLSL) + , mPosition(Ogre::Vector3(0,0,0)) + , mPlanesError(0) + , mFullReflectionDistance(99999997952.0) + , mGlobalTransparency(0.05) + , mNormalDistortion(0.09) + , mSunPosition(Ogre::Vector3(5000,3000,1)) + , mSunStrength(1.75) + , mSunArea(150) + , mSunColor(Ogre::Vector3(1,0.75,0.25)) + , mFoamMaxDistance(75000000.0) + , mFoamScale(0.0075) + , mFoamStart(0) + , mFoamTransparency(1) + , mDepthLimit(0) + , mDepthColor(Ogre::Vector3(0,0.1,0.172)) + , mSmoothPower(30) + , mCausticsScale(20) + , mCausticsPower(15) + , mCausticsEnd(0.55) + , mMesh(new Mesh(this)) + , mTextureManager(new TextureManager(this)) + , mMaterialManager(new MaterialManager(this)) + , mDecalsManager(new DecalsManager(this)) + , mModule(0) + , mSceneNode(0) + , mRefractionPlane(0) + , mReflectionPlane(0) + , mDepthPlane(0) + , mTextureRefraction(0) + , mTextureReflection(0) + , mTextureDepth(0) + , mPlanesSceneNode(0) + , mComponents(HYDRAX_COMPONENTS_NONE) + { + HydraxLOG("Hydrax object created."); + } + + Hydrax::~Hydrax() + { + if (mModule) + { + delete mModule; + } + + if (mSceneNode) + { + mSceneNode->detachAllObjects(); + mSceneNode->getParentSceneNode()->removeAndDestroyChild(mSceneNode->getName()); + + delete mTextureManager; + delete mMaterialManager; + delete mDecalsManager; + delete mMesh; + } + + if (mPlanesSceneNode) + { + mPlanesSceneNode->detachAllObjects(); + mPlanesSceneNode->getParentSceneNode()->removeAndDestroyChild(mPlanesSceneNode->getName()); + + Ogre::RenderTarget* mRT_TextureRefraction = mTextureRefraction->getBuffer()->getRenderTarget(); + mRT_TextureRefraction->removeAllListeners(); + mRT_TextureRefraction->removeAllViewports(); + + Ogre::RenderTarget* mRT_TextureReflection = mTextureReflection->getBuffer()->getRenderTarget(); + mRT_TextureReflection->removeAllListeners(); + mRT_TextureReflection->removeAllViewports(); + + if (isComponent(HYDRAX_COMPONENT_DEPTH)) + { + Ogre::RenderTarget* mRT_TextureDepth = mTextureDepth->getBuffer()->getRenderTarget(); + mRT_TextureDepth->removeAllListeners(); + mRT_TextureDepth->removeAllViewports(); + + Ogre::TextureManager::getSingleton().remove("HydraxDepthMap"); + + Ogre::MeshManager::getSingleton().remove("DepthClipPlane"); + } + + Ogre::TextureManager::getSingleton().remove("HydraxReflectionMap"); + Ogre::TextureManager::getSingleton().remove("HydraxRefractionMap"); + + Ogre::MeshManager::getSingleton().remove("RefractionClipPlane"); + Ogre::MeshManager::getSingleton().remove("ReflectionClipPlane"); + } + + HydraxLOG("Hydrax object removed."); + } + + void Hydrax::create() + { + if (mModule == NULL) + { + HydraxLOG("Module isn't set, skipping..."); + + return; + } + + if (mCreated) + { + HydraxLOG("Hydrax alredy created, skipping..."); + + return; + } + + HydraxLOG("Creating module."); + mModule->create(); + HydraxLOG("Module created."); + + HydraxLOG("Creating RTListeners."); + _createRttListeners(); + HydraxLOG("RTListeners created"); + + HydraxLOG("Registring device restored listener"); + mDeviceRestoredListener.mHydrax = this; + Ogre::Root::getSingleton().getRenderSystem()->addListener(&mDeviceRestoredListener); + HydraxLOG("Device restored listener registred"); + + HydraxLOG("Creating materials,"); + mMaterialManager->createMaterials(mComponents, MaterialManager::Options(mShaderMode, mModule->getNormalMode())); + mMesh->setMaterialName(mMaterialManager->getMaterial(MaterialManager::MAT_WATER)->getName()); + HydraxLOG("Materials created."); + + HydraxLOG("Creating water mesh."); + mSceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode(); + mMesh->setOptions(mModule->getMeshOptions()); + mMesh->create(mSceneNode); + HydraxLOG("Water mesh created"); + + mCreated = true; + } + + void Hydrax::DeviceRestoredListener::eventOccurred(const Ogre::String& eventName, const Ogre::NameValuePairList *parameters) + { + if (eventName == "DeviceRestored") + { + // Restore mesh + HydraxLOG("Restoring water mesh."); + if (mHydrax->mMesh->isCreated()) + { + Ogre::String MaterialNameTmp = mHydrax->mMesh->getMaterialName(); + Mesh::Options MeshOptionsTmp = mHydrax->mMesh->getOptions(); + + HydraxLOG("Updating water mesh."); + + HydraxLOG("Deleting water mesh."); + delete mHydrax->mMesh; + HydraxLOG("Water mesh deleted."); + + HydraxLOG("Creating water mesh."); + mHydrax->mMesh = new Mesh(mHydrax); + mHydrax->mMesh->setOptions(MeshOptionsTmp); + mHydrax->mMesh->setMaterialName(MaterialNameTmp); + mHydrax->mMesh->create(mHydrax->mSceneNode); + mHydrax->setPosition(mHydrax->mPosition); + mHydrax->mModule->update(0); // ??? + HydraxLOG("Water mesh created"); + } + HydraxLOG("Water mesh restored."); + } + } + + void Hydrax::_createRttListeners() + { + if (!mCreated) + { + mRefractionPlane = new Ogre::MovablePlane("RefractionPlane"); + mReflectionPlane = new Ogre::MovablePlane("ReflectionPlane"); + + mRefractionPlane->d = 0; + mReflectionPlane->d = 0; + + mRefractionPlane->normal = Ogre::Vector3::NEGATIVE_UNIT_Y; + mReflectionPlane->normal = Ogre::Vector3::UNIT_Y; + + Ogre::MeshManager::getSingleton().createPlane( + "RefractionClipPlane",HYDRAX_RESOURCE_GROUP, + *mRefractionPlane, + mMesh->getSize().Width,mMesh->getSize().Height, + 10,10,true,1,5,5,Ogre::Vector3::UNIT_Z); + + Ogre::MeshManager::getSingleton().createPlane( + "ReflectionClipPlane",HYDRAX_RESOURCE_GROUP, + *mReflectionPlane, + mMesh->getSize().Width,mMesh->getSize().Height, + 10,10,true,1,5,5,Ogre::Vector3::UNIT_Z); + + mRefractionPlane->setCastShadows(false); + mReflectionPlane->setCastShadows(false); + + mPlanesSceneNode = mSceneManager->getRootSceneNode()->createChildSceneNode(); + mPlanesSceneNode->attachObject(mRefractionPlane); + mPlanesSceneNode->attachObject(mReflectionPlane); + + mReflectionListener.mHydrax = this; + mRefractionListener.mHydrax = this; + + mReflectionListener.mCReflectionQueueListener.mHydrax = this; + mReflectionListener.mCReflectionQueueListener.mActive = false; + mSceneManager->addRenderQueueListener(&mReflectionListener.mCReflectionQueueListener); + } + + Ogre::TextureManager::getSingleton().remove("HydraxReflectionMap"); + Ogre::TextureManager::getSingleton().remove("HydraxRefractionMap"); + + mTextureRefraction = Ogre::TextureManager::getSingleton().createManual( + "HydraxRefractionMap", + HYDRAX_RESOURCE_GROUP, + Ogre::TEX_TYPE_2D, + mRttOptions.RefractionQuality, mRttOptions.RefractionQuality, 0, + Ogre::PF_R8G8B8, + Ogre::TU_RENDERTARGET); + + Ogre::RenderTarget* mRT_TextureRefraction = mTextureRefraction->getBuffer()->getRenderTarget(); + { + Ogre::Viewport *v = mRT_TextureRefraction->addViewport(mCamera); + v->setClearEveryFrame(true); + v->setBackgroundColour(Ogre::ColourValue::White); + v->setOverlaysEnabled(false); + + mRT_TextureRefraction->addListener(&mRefractionListener); + } + + mTextureReflection = Ogre::TextureManager::getSingleton().createManual( + "HydraxReflectionMap", + HYDRAX_RESOURCE_GROUP, + Ogre::TEX_TYPE_2D, + mRttOptions.ReflectionQuality, mRttOptions.ReflectionQuality, 0, + Ogre::PF_R8G8B8, + Ogre::TU_RENDERTARGET); + + Ogre::RenderTarget* mRT_TextureReflection = mTextureReflection->getBuffer()->getRenderTarget(); + { + Ogre::Viewport *v = mRT_TextureReflection->addViewport(mCamera); + v->setClearEveryFrame(true); + v->setBackgroundColour(Ogre::ColourValue::White); + v->setOverlaysEnabled(false); + + mRT_TextureReflection->addListener(&mReflectionListener); + } + + if (isComponent(HYDRAX_COMPONENT_DEPTH)) + { + _createDepthRttListener(); + } + + getMaterialManager()->reload(MaterialManager::MAT_WATER); + } + + void Hydrax::_createDepthRttListener(const bool &Create, const bool &Delete) + { + if (Create) + { + Ogre::TextureManager::getSingleton().remove("HydraxDepthMap"); + + if (!mCreated) + { + mDepthPlane = new Ogre::MovablePlane("DepthPlane"); + + mDepthPlane->d = 0; + mDepthPlane->normal = Ogre::Vector3::NEGATIVE_UNIT_Y; + + Ogre::MeshManager::getSingleton().createPlane( + "DepthClipPlane",HYDRAX_RESOURCE_GROUP, + *mDepthPlane, + mMesh->getSize().Width,mMesh->getSize().Height, + 10,10,true,1,5,5,Ogre::Vector3::UNIT_Z); + + mDepthPlane->setCastShadows(false); + + mPlanesSceneNode->attachObject(mDepthPlane); + + mDepthListener.mHydrax = this; + } + + mTextureDepth = Ogre::TextureManager::getSingleton().createManual( + "HydraxDepthMap", + HYDRAX_RESOURCE_GROUP, + Ogre::TEX_TYPE_2D, + mRttOptions.DepthQuality, mRttOptions.DepthQuality, 0, + Ogre::PF_R8G8B8, + Ogre::TU_RENDERTARGET); + + Ogre::RenderTarget* mRT_TextureDepth = mTextureDepth->getBuffer()->getRenderTarget(); + { + Ogre::Viewport *v = mRT_TextureDepth->addViewport(mCamera); + v->setClearEveryFrame(true); + v->setBackgroundColour(Ogre::ColourValue::Black); + v->setOverlaysEnabled(false); + v->setMaterialScheme("HydraxDepth"); + v->setSkiesEnabled(false); + + mRT_TextureDepth->addListener(&mDepthListener); + } + + getMaterialManager()->reload(MaterialManager::MAT_WATER); + } + if (Delete) + { + Ogre::RenderTarget* mRT_TextureDepth = mTextureDepth->getBuffer()->getRenderTarget(); + mRT_TextureDepth->removeAllListeners(); + mRT_TextureDepth->removeAllViewports(); + + Ogre::TextureManager::getSingleton().remove("HydraxDepthMap"); + + Ogre::MeshManager::getSingleton().remove("DepthClipPlane"); + } + } + + void Hydrax::CReflectionListener::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) + { + mCReflectionQueueListener.mActive = true; + + mHydrax->mMesh->getEntity()->setVisible(false); + mHydrax->mReflectionPlane->getParentNode()->translate(0,mHydrax->mPlanesError,0); + + if (mHydrax->mCamera->getPosition().y < mHydrax->mReflectionPlane->getParentNode()->getPosition().y) + { + mCameraPlaneDiff = mHydrax->mReflectionPlane->getParentNode()->getPosition().y-mHydrax->mCamera->getPosition().y+0.05; + mHydrax->mReflectionPlane->getParentNode()->translate(0,-mCameraPlaneDiff,0); + } + else + { + mCameraPlaneDiff = 0; + } + + mHydrax->mCamera->enableReflection(mHydrax->mReflectionPlane); + mHydrax->mCamera->enableCustomNearClipPlane(mHydrax->mReflectionPlane); + } + + void Hydrax::CReflectionListener::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) + { + mHydrax->mMesh->getEntity()->setVisible(true); + + if (mCameraPlaneDiff != 0) + { + mHydrax->mReflectionPlane->getParentNode()->translate(0,mCameraPlaneDiff,0); + } + + mHydrax->mReflectionPlane->getParentNode()->translate(0,-mHydrax->mPlanesError,0); + + mHydrax->mCamera->disableReflection(); + mHydrax->mCamera->disableCustomNearClipPlane(); + + mCReflectionQueueListener.mActive = false; + } + + void Hydrax::CRefractionListener::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) + { + mHydrax->mMesh->getEntity()->setVisible(false); + mHydrax->mRefractionPlane->getParentNode()->translate(0,mHydrax->mPlanesError,0); + + if (mHydrax->mCamera->getPosition().y < mHydrax->mRefractionPlane->getParentNode()->getPosition().y) + { + mCameraPlaneDiff = mHydrax->mRefractionPlane->getParentNode()->getPosition().y-mHydrax->mCamera->getPosition().y+0.05; + mHydrax->mRefractionPlane->getParentNode()->translate(0,-mCameraPlaneDiff,0); + } + else + { + mCameraPlaneDiff = 0; + } + + mHydrax->mCamera->enableCustomNearClipPlane(mHydrax->mRefractionPlane); + } + + void Hydrax::CRefractionListener::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) + { + mHydrax->mMesh->getEntity()->setVisible(true); + mHydrax->mRefractionPlane->getParentNode()->translate(0,-mHydrax->mPlanesError,0); + + if (mCameraPlaneDiff != 0) + { + mHydrax->mRefractionPlane->getParentNode()->translate(0,mCameraPlaneDiff,0); + } + + mHydrax->mCamera->disableCustomNearClipPlane(); + } + + void Hydrax::CDepthListener::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) + { + mHydrax->mMesh->getEntity()->setVisible(false); + + Ogre::SceneManager::MovableObjectIterator EntityIterator = + mHydrax->mSceneManager->getMovableObjectIterator("Entity"); + Ogre::Entity* CurrentEntity; + unsigned int k; + + mMaterials.empty(); + + while (EntityIterator.hasMoreElements()) + { + CurrentEntity = static_cast<Ogre::Entity*>(EntityIterator.peekNextValue()); + + for(k = 0; k < CurrentEntity->getNumSubEntities(); k++) + { + mMaterials.push(CurrentEntity->getSubEntity(k)->getMaterialName()); + + CurrentEntity->getSubEntity(k)->setMaterialName(mHydrax->getMaterialManager()->getMaterial(MaterialManager::MAT_DEPTH)->getName()); + } + + EntityIterator.moveNext(); + } + + mHydrax->mDepthPlane->getParentNode()->translate(0,mHydrax->mPlanesError,0); + + if (mHydrax->mCamera->getPosition().y < mHydrax->mDepthPlane->getParentNode()->getPosition().y) + { + mCameraPlaneDiff = mHydrax->mDepthPlane->getParentNode()->getPosition().y-mHydrax->mCamera->getPosition().y+0.05; + mHydrax->mDepthPlane->getParentNode()->translate(0,-mCameraPlaneDiff,0); + } + else + { + mCameraPlaneDiff = 0; + } + + mHydrax->mCamera->enableCustomNearClipPlane(mHydrax->mDepthPlane); + } + + void Hydrax::CDepthListener::postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) + { + Ogre::SceneManager::MovableObjectIterator EntityIterator = + mHydrax->mSceneManager->getMovableObjectIterator("Entity"); + Ogre::Entity* CurrentEntity; + unsigned int k; + + while (EntityIterator.hasMoreElements()) + { + CurrentEntity = static_cast<Ogre::Entity*>(EntityIterator.peekNextValue()); + + for(k = 0; k < CurrentEntity->getNumSubEntities(); k++) + { + CurrentEntity->getSubEntity(k)->setMaterialName(mMaterials.front()); + + mMaterials.pop(); + } + + EntityIterator.moveNext(); + } + + mHydrax->mMesh->getEntity()->setVisible(true); + + mHydrax->mCamera->disableCustomNearClipPlane(); + + if (mCameraPlaneDiff != 0) + { + mHydrax->mDepthPlane->getParentNode()->translate(0,mCameraPlaneDiff,0); + } + + mHydrax->mDepthPlane->getParentNode()->translate(0,-mHydrax->mPlanesError,0); + } + + void Hydrax::setRttOptions(const RttOptions &RttOptions) + { + mRttOptions = RttOptions; + + if (mCreated) + { + HydraxLOG("Updating Rtt options."); + + Ogre::RenderTarget* mRT_TextureRefraction = mTextureRefraction->getBuffer()->getRenderTarget(); + mRT_TextureRefraction->removeAllListeners(); + mRT_TextureRefraction->removeAllViewports(); + + Ogre::RenderTarget* mRT_TextureReflection = mTextureReflection->getBuffer()->getRenderTarget(); + mRT_TextureReflection->removeAllListeners(); + mRT_TextureReflection->removeAllViewports(); + + if (isComponent(HYDRAX_COMPONENT_DEPTH)) + { + Ogre::RenderTarget* mRT_TextureDepth = mTextureDepth->getBuffer()->getRenderTarget(); + mRT_TextureDepth->removeAllListeners(); + mRT_TextureDepth->removeAllViewports(); + + Ogre::TextureManager::getSingleton().remove("HydraxDepthMap"); + } + + Ogre::TextureManager::getSingleton().remove("HydraxReflectionMap"); + Ogre::TextureManager::getSingleton().remove("HydraxRefractionMap"); + + _createRttListeners(); + + mMaterialManager->reload(MaterialManager::MAT_WATER); + + HydraxLOG("Rtt options updated."); + } + } + + void Hydrax::setPolygonMode(const int &Tipe) + { + Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName(mMesh->getMaterialName()); + + if (Tipe == 0) + { + mat->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_SOLID); + } + else if (Tipe == 1) + { + mat->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_WIREFRAME); + } + else if (Tipe == 2) + { + mat->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_POINTS); + } + } + + void Hydrax::setShaderMode(const MaterialManager::ShaderMode& ShaderMode) + { + mShaderMode = ShaderMode; + + if (mCreated && mModule) + { + mMaterialManager->createMaterials(mComponents, MaterialManager::Options(mShaderMode, mModule->getNormalMode())); + + mMesh->setMaterialName(mMaterialManager->getMaterial(MaterialManager::MAT_WATER)->getName()); + } + } + + void Hydrax::update(const Ogre::Real &timeSinceLastFrame) + { + if (mCreated && mModule) + { + mModule->update(timeSinceLastFrame); + mDecalsManager->update(); + } + } + + void Hydrax::setComponents(const HydraxComponent &Components) + { + // Create/Delete depth rtt listeners if it's necesary + if (mCreated) + { + if (isComponent(HYDRAX_COMPONENT_DEPTH)) + { + if (!(Components & HYDRAX_COMPONENT_DEPTH)) + { + _createDepthRttListener(false, true); + } + } + else + { + if (Components & HYDRAX_COMPONENT_DEPTH) + { + _createDepthRttListener(); + } + } + } + + mComponents = Components; + + if (isComponent(HYDRAX_COMPONENT_SMOOTH) || isComponent(HYDRAX_COMPONENT_CAUSTICS)) + { + if (!isComponent(HYDRAX_COMPONENT_DEPTH)) + { + // Delete smooth or caustics components + HydraxComponent s = HYDRAX_COMPONENTS_NONE, + f = HYDRAX_COMPONENTS_NONE; + + if(isComponent(HYDRAX_COMPONENT_SUN)) + { + s = HYDRAX_COMPONENT_SUN; + } + if(isComponent(HYDRAX_COMPONENT_FOAM)) + { + f = HYDRAX_COMPONENT_FOAM; + } + + if(isComponent(HYDRAX_COMPONENT_SMOOTH)) + { + HydraxLOG("Smooth component needs depth component... smooth component desactivated."); + } + if(isComponent(HYDRAX_COMPONENT_CAUSTICS)) + { + HydraxLOG("Caustics component needs depth component... cautics component desactivated."); + } + + mComponents = static_cast<HydraxComponent>(s|f); + } + } + + if (!mCreated || !mModule) + { + return; + } + + mMaterialManager->createMaterials(mComponents, MaterialManager::Options(mShaderMode, mModule->getNormalMode())); + + mMesh->setMaterialName(mMaterialManager->getMaterial(MaterialManager::MAT_WATER)->getName()); + } + + void Hydrax::setModule(Module::Module* Module) + { + if (mModule) + { + if (mModule->getNormalMode() != Module->getNormalMode()) + { + mMaterialManager->createMaterials(mComponents, MaterialManager::Options(mShaderMode, Module->getNormalMode())); + + mMesh->setMaterialName(mMaterialManager->getMaterial(MaterialManager::MAT_WATER)->getName()); + } + + delete mModule; + } + + mModule = Module; + + if (mCreated) + { + HydraxLOG("Updating water mesh."); + Ogre::String MaterialNameTmp = mMesh->getMaterialName(); + + HydraxLOG("Deleting water mesh."); + delete mMesh; + HydraxLOG("Water mesh deleted."); + + HydraxLOG("Creating water mesh."); + mMesh = new Mesh(this); + mMesh->setOptions(mModule->getMeshOptions()); + mMesh->setMaterialName(MaterialNameTmp); + mMesh->create(mSceneNode); + setPosition(mPosition); + HydraxLOG("Water mesh created"); + + HydraxLOG("Module set."); + } + } + + bool Hydrax::isComponent(const HydraxComponent &Component) + { + if (mComponents & Component) + { + return true; + } + + if (Component == HYDRAX_COMPONENTS_NONE && mComponents == HYDRAX_COMPONENTS_NONE) + { + return true; + } + + if (Component == HYDRAX_COMPONENTS_ALL && mComponents == HYDRAX_COMPONENTS_ALL) + { + return true; + } + + return false; + } + + void Hydrax::saveCfg(const Ogre::String &FileName) + { + FILE *cfgFile = fopen(FileName.c_str(), "w"); + + if (cfgFile) + { + Ogre::String tmpStr = ""; + + // Hydrax version + tmpStr += "#Version\n"; + tmpStr += "HydraxVersion="+ + // Major + Ogre::StringConverter::toString(HYDRAX_VERSION_MAJOR)+"."+ + // Minor + Ogre::StringConverter::toString(HYDRAX_VERSION_MINOR)+"."+ + // Patch + Ogre::StringConverter::toString(HYDRAX_VERSION_PATCH)+"\n\n"; + + /* // Mesh field + tmpStr += "#Mesh\n"; + tmpStr += "MeshSize="+ + // X + Ogre::StringConverter::toString(mMesh->getSize().Width)+"x"+ + // Z + Ogre::StringConverter::toString(mMesh->getSize().Height)+"\n"; + tmpStr += "MeshComplexity="+Ogre::StringConverter::toString(mMesh->getComplexity())+"\n\n"; +*/ + // Components field + tmpStr += "#Components\n"; + tmpStr += "ComponentSun=" +Ogre::StringConverter::toString(isComponent(HYDRAX_COMPONENT_SUN ))+"\n"; + tmpStr += "ComponentFoam=" +Ogre::StringConverter::toString(isComponent(HYDRAX_COMPONENT_FOAM ))+"\n"; + tmpStr += "ComponentDepth=" +Ogre::StringConverter::toString(isComponent(HYDRAX_COMPONENT_DEPTH ))+"\n"; + tmpStr += "ComponentSmooth=" +Ogre::StringConverter::toString(isComponent(HYDRAX_COMPONENT_SMOOTH ))+"\n"; + tmpStr += "ComponentCaustics="+Ogre::StringConverter::toString(isComponent(HYDRAX_COMPONENT_CAUSTICS))+"\n\n"; + + // Rtt quality field + tmpStr += "#Rtt quality\n"; + tmpStr += "RttReflection="+Ogre::StringConverter::toString(static_cast<int>(getRttOptions().ReflectionQuality))+"\n"; + tmpStr += "RttRefraction="+Ogre::StringConverter::toString(static_cast<int>(getRttOptions().RefractionQuality))+"\n"; + tmpStr += "RttDepth=" +Ogre::StringConverter::toString(static_cast<int>(getRttOptions().DepthQuality)) +"\n\n"; + + // Params fields + // Main + tmpStr += "#Main parameters\n"; + tmpStr += "FullReflectionDistance="+Ogre::StringConverter::toString(getFullReflectionDistance())+"\n"; + tmpStr += "GlobalTransparency=" +Ogre::StringConverter::toString(getGlobalTransparency() )+"\n"; + tmpStr += "NormalDistortion=" +Ogre::StringConverter::toString(getNormalDistortion() )+"\n\n"; + // Sun + if (isComponent(HYDRAX_COMPONENT_SUN)) + { + tmpStr += "#Sun parameters\n"; + tmpStr += "Sun_Position=" + + Ogre::StringConverter::toString(getSunPosition().x)+"x"+ + Ogre::StringConverter::toString(getSunPosition().y)+"x"+ + Ogre::StringConverter::toString(getSunPosition().z)+"\n"; + tmpStr += "Sun_Strength="+Ogre::StringConverter::toString(getSunStrength())+"\n"; + tmpStr += "Sun_Area=" +Ogre::StringConverter::toString(getSunArea() )+"\n"; + tmpStr += "Sun_Color=" + + Ogre::StringConverter::toString(getSunColor().x)+"x"+ + Ogre::StringConverter::toString(getSunColor().y)+"x"+ + Ogre::StringConverter::toString(getSunColor().z)+"\n\n"; + } + // Foam + if (isComponent(HYDRAX_COMPONENT_FOAM)) + { + tmpStr += "#Foam parameters\n"; + tmpStr += "Foam_MaxDistance=" +Ogre::StringConverter::toString(getFoamMaxDistance() )+"\n"; + tmpStr += "Foam_Scale=" +Ogre::StringConverter::toString(getFoamScale() )+"\n"; + tmpStr += "Foam_Start=" +Ogre::StringConverter::toString(getFoamStart() )+"\n"; + tmpStr += "Foam_Transparency="+Ogre::StringConverter::toString(getFoamTransparency())+"\n\n"; + } + // Depth + if (isComponent(HYDRAX_COMPONENT_DEPTH)) + { + tmpStr += "#Depth parameters\n"; + tmpStr += "Depth_Limit=" +Ogre::StringConverter::toString(getDepthLimit())+"\n"; + tmpStr += "Depth_Color=" + + Ogre::StringConverter::toString(getDepthColor().x)+"x"+ + Ogre::StringConverter::toString(getDepthColor().y)+"x"+ + Ogre::StringConverter::toString(getDepthColor().z)+"\n\n"; + } + // Smooth + if (isComponent(HYDRAX_COMPONENT_SMOOTH)) + { + tmpStr += "#Smooth parameters\n"; + tmpStr += "Smooth_Power=" +Ogre::StringConverter::toString(getSmoothPower())+"\n\n"; + } + // Caustics + if (isComponent(HYDRAX_COMPONENT_CAUSTICS)) + { + tmpStr += "#Caustics parameters\n"; + tmpStr += "Caustics_Scale=" +Ogre::StringConverter::toString(getCausticsScale())+"\n"; + tmpStr += "Caustics_Power=" +Ogre::StringConverter::toString(getCausticsPower())+"\n"; + tmpStr += "Caustics_End=" +Ogre::StringConverter::toString(getCausticsEnd()) +"\n\n"; + } + + // Save module config + if (mModule) + { + mModule->saveCfg(tmpStr); + } + + fprintf(cfgFile, "%s", tmpStr.c_str()); + fclose(cfgFile); + + try + { + Ogre::ResourceGroupManager::getSingleton().removeResourceLocation(FileName, HYDRAX_RESOURCE_GROUP); + } + catch(...) + { + } + + Ogre::ResourceGroupManager::getSingleton().addResourceLocation(FileName, "FileSystem", HYDRAX_RESOURCE_GROUP); + } + + HydraxLOG(FileName + " saved."); + } + + void Hydrax::loadCfg(const Ogre::String &FileName) + { + Ogre::ConfigFile CfgFile; + + CfgFile.load(FileName); + + // Check version + if(CfgFile.getSetting("HydraxVersion") != ( + // Major + Ogre::StringConverter::toString(HYDRAX_VERSION_MAJOR)+"."+ + // Minor + Ogre::StringConverter::toString(HYDRAX_VERSION_MINOR)+"."+ + // Patch + Ogre::StringConverter::toString(HYDRAX_VERSION_PATCH))) + { + HydraxLOG("Config file version doesn't correspond with Hydrax version."); + + return; + } + + // Load components + HydraxComponent s = HYDRAX_COMPONENTS_NONE, + f = HYDRAX_COMPONENTS_NONE, + d = HYDRAX_COMPONENTS_NONE, + sm = HYDRAX_COMPONENTS_NONE, + c = HYDRAX_COMPONENTS_NONE; + + if (Ogre::StringConverter::parseBool(CfgFile.getSetting("ComponentSun"))) + { + s = HYDRAX_COMPONENT_SUN; + } + if (Ogre::StringConverter::parseBool(CfgFile.getSetting("ComponentFoam"))) + { + f = HYDRAX_COMPONENT_FOAM; + } + if (Ogre::StringConverter::parseBool(CfgFile.getSetting("ComponentDepth"))) + { + d = HYDRAX_COMPONENT_DEPTH; + } + if (Ogre::StringConverter::parseBool(CfgFile.getSetting("ComponentSmooth"))) + { + sm = HYDRAX_COMPONENT_SMOOTH; + } + if (Ogre::StringConverter::parseBool(CfgFile.getSetting("ComponentCaustics"))) + { + c = HYDRAX_COMPONENT_CAUSTICS; + } + + setComponents(static_cast<HydraxComponent>(s | f | d | sm | c)); + + // Load Rtt options + setRttOptions( + RttOptions( + // Reflection + static_cast<TextureQuality>(Ogre::StringConverter::parseInt(CfgFile.getSetting("RttReflection"))), + // Refraction + static_cast<TextureQuality>(Ogre::StringConverter::parseInt(CfgFile.getSetting("RttRefraction"))), + // Depth + static_cast<TextureQuality>(Ogre::StringConverter::parseInt(CfgFile.getSetting("RttDepth"))))); + + // Load params options + // Main + setFullReflectionDistance(Ogre::StringConverter::parseReal(CfgFile.getSetting("FullReflectionDistance"))); + setGlobalTransparency(Ogre::StringConverter::parseReal(CfgFile.getSetting("GlobalTransparency"))); + setNormalDistortion(Ogre::StringConverter::parseReal(CfgFile.getSetting("NormalDistortion"))); + // Sun + if (isComponent(HYDRAX_COMPONENT_SUN)) + { + setSunPosition( + Ogre::Vector3( + // X + Ogre::StringConverter::parseReal( + Ogre::StringUtil::split(CfgFile.getSetting("Sun_Position"), "x")[0]), + // Y + Ogre::StringConverter::parseReal( + Ogre::StringUtil::split(CfgFile.getSetting("Sun_Position"), "x")[1]), + // Z + Ogre::StringConverter::parseReal( + Ogre::StringUtil::split(CfgFile.getSetting("Sun_Position"), "x")[2]))); + + setSunStrength(Ogre::StringConverter::parseReal(CfgFile.getSetting("Sun_Strength"))); + setSunArea(Ogre::StringConverter::parseReal(CfgFile.getSetting("Sun_Area"))); + + setSunColor( + Ogre::Vector3( + // X + Ogre::StringConverter::parseReal( + Ogre::StringUtil::split(CfgFile.getSetting("Sun_Color"), "x")[0]), + // Y + Ogre::StringConverter::parseReal( + Ogre::StringUtil::split(CfgFile.getSetting("Sun_Color"), "x")[1]), + // Z + Ogre::StringConverter::parseReal( + Ogre::StringUtil::split(CfgFile.getSetting("Sun_Color"), "x")[2]))); + } + // Foam + if (isComponent(HYDRAX_COMPONENT_FOAM)) + { + setFoamMaxDistance(Ogre::StringConverter::parseReal(CfgFile.getSetting("Foam_MaxDistance"))); + setFoamScale(Ogre::StringConverter::parseReal(CfgFile.getSetting("Foam_Scale"))); + setFoamStart(Ogre::StringConverter::parseReal(CfgFile.getSetting("Foam_Start"))); + setFoamTransparency(Ogre::StringConverter::parseReal(CfgFile.getSetting("Foam_Transparency"))); + } + // Depth + if (isComponent(HYDRAX_COMPONENT_DEPTH)) + { + setDepthLimit(Ogre::StringConverter::parseReal(CfgFile.getSetting("Depth_Limit"))); + + setDepthColor( + Ogre::Vector3( + // X + Ogre::StringConverter::parseReal( + Ogre::StringUtil::split(CfgFile.getSetting("Depth_Color"), "x")[0]), + // Y + Ogre::StringConverter::... [truncated message content] |
From: <and...@us...> - 2008-08-17 12:57:19
|
Revision: 690 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=690&view=rev Author: andy_miller Date: 2008-08-17 12:57:28 +0000 (Sun, 17 Aug 2008) Log Message: ----------- Hydra Demo added (hydrax 0.3) and working Modified Paths: -------------- trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h trunk/python-ogre/code_generators/hydrax/customization_data.py trunk/python-ogre/code_generators/hydrax/generate_code.py trunk/python-ogre/code_generators/hydrax/python_hydrax.h trunk/python-ogre/demos/plugins.cfg trunk/python-ogre/environment.py Added Paths: ----------- trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py Modified: trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp 2008-08-15 10:44:11 UTC (rev 689) +++ trunk/python-ogre/ThirdParty/Hydrax/Hydrax.cpp 2008-08-17 12:57:28 UTC (rev 690) @@ -178,8 +178,6 @@ Ogre::String MaterialNameTmp = mHydrax->mMesh->getMaterialName(); Mesh::Options MeshOptionsTmp = mHydrax->mMesh->getOptions(); - HydraxLOG("Updating water mesh."); - HydraxLOG("Deleting water mesh."); delete mHydrax->mMesh; HydraxLOG("Water mesh deleted."); @@ -200,6 +198,7 @@ void Hydrax::_createRttListeners() { if (!mCreated) + { mRefractionPlane = new Ogre::MovablePlane("RefractionPlane"); mReflectionPlane = new Ogre::MovablePlane("ReflectionPlane"); @@ -554,6 +553,7 @@ void Hydrax::update(const Ogre::Real &timeSinceLastFrame) { + if (mCreated && mModule) { mModule->update(timeSinceLastFrame); Modified: trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h =================================================================== --- trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h 2008-08-15 10:44:11 UTC (rev 689) +++ trunk/python-ogre/ThirdParty/Hydrax/Hydrax.h 2008-08-17 12:57:28 UTC (rev 690) @@ -537,7 +537,7 @@ public: /** Called at the start of the queue */ - void renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation) + bool renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool skipThisInvocation) { if ((queueGroupId == Ogre::RENDER_QUEUE_SKIES_EARLY || queueGroupId == Ogre::RENDER_QUEUE_SKIES_LATE) && mActive) @@ -545,11 +545,12 @@ mHydrax->getCamera()->disableCustomNearClipPlane(); Ogre::Root::getSingleton().getRenderSystem()->_setProjectionMatrix(mHydrax->getCamera()->getProjectionMatrixRS()); } + return skipThisInvocation; } /** Called on the end of the queue */ - void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation) + bool renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool skipThisInvocation) { if ((queueGroupId == Ogre::RENDER_QUEUE_SKIES_EARLY || queueGroupId == Ogre::RENDER_QUEUE_SKIES_LATE) && mActive) @@ -557,6 +558,7 @@ mHydrax->getCamera()->enableCustomNearClipPlane(mHydrax->mReflectionPlane); Ogre::Root::getSingleton().getRenderSystem()->_setProjectionMatrix(mHydrax->getCamera()->getProjectionMatrixRS()); } + return skipThisInvocation; } /// Hydrax pointer @@ -731,6 +733,6 @@ /// Pointer to Ogre::Camera Ogre::Camera *mCamera; }; -} +}; #endif Modified: trunk/python-ogre/code_generators/hydrax/customization_data.py =================================================================== --- trunk/python-ogre/code_generators/hydrax/customization_data.py 2008-08-15 10:44:11 UTC (rev 689) +++ trunk/python-ogre/code_generators/hydrax/customization_data.py 2008-08-17 12:57:28 UTC (rev 690) @@ -1,6 +1,10 @@ def header_files( version ): - return [ 'Hydrax.h'] + return [ 'Hydrax.h', + "ProjectedGrid.h", + "SimpleGrid.h", + "Perlin.h" + ] def huge_classes( version ): return [] Modified: trunk/python-ogre/code_generators/hydrax/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/hydrax/generate_code.py 2008-08-15 10:44:11 UTC (rev 689) +++ trunk/python-ogre/code_generators/hydrax/generate_code.py 2008-08-17 12:57:28 UTC (rev 690) @@ -226,7 +226,8 @@ global_ns.exclude() main_ns = global_ns.namespace( MAIN_NAMESPACE ) main_ns.include() - + + common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualExclude ( mb ) common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) Modified: trunk/python-ogre/code_generators/hydrax/python_hydrax.h =================================================================== --- trunk/python-ogre/code_generators/hydrax/python_hydrax.h 2008-08-15 10:44:11 UTC (rev 689) +++ trunk/python-ogre/code_generators/hydrax/python_hydrax.h 2008-08-17 12:57:28 UTC (rev 690) @@ -1,5 +1,8 @@ #include "Hydrax.h" +#include "ProjectedGrid.h" +#include "SimpleGrid.h" +#include "Perlin.h" // First we create a magic namespace to hold all our aliases namespace pyplusplus { namespace aliases { Added: trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py =================================================================== --- trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py (rev 0) +++ trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py 2008-08-17 12:57:28 UTC (rev 690) @@ -0,0 +1,208 @@ +# 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 +sys.path.insert(0,'..') +import PythonOgreConfig +import ogre.renderer.OGRE as ogre +import SampleFramework as sf + +import ogre.addons.hydrax as Hydrax + +_def_SkyBoxNum = 5 +_def_PGComplexity = 256 + +mSkyBoxes = [ "Sky/ClubTropicana", + "Sky/Stormy", + "Sky/EarlyMorning", + "Sky/Evening", + "Sky/Clouds"] + +mSunPosition = [ogre.Vector3(0,10000,-90000), + ogre.Vector3(0,10000,-90000)/2.5, + ogre.Vector3(13000,0,120000)/3, + ogre.Vector3(-50000,-5000,50000), + ogre.Vector3(0,0,0)] + +mSunColor = [ogre.Vector3(1, 0.9, 0.6)/5, + ogre.Vector3(0.75, 0.65, 0.45)/2, + ogre.Vector3(1,0.6,0.4), + ogre.Vector3(1,0.4,0.1), + ogre.Vector3(0,0,0)] + +# print dir (Hydrax) +# print dir( Hydrax.Module) +# print dir ( Hydrax.Noise) +mPGOptions = [Hydrax.ProjectedGrid.Options(_def_PGComplexity), + Hydrax.ProjectedGrid.Options(_def_PGComplexity, 45.5, 7.0, False), + Hydrax.ProjectedGrid.Options(_def_PGComplexity, 32.5, 7.0, False), + Hydrax.ProjectedGrid.Options(_def_PGComplexity, 32.5, 7.0, False), + Hydrax.ProjectedGrid.Options(_def_PGComplexity, 20.0, 7.0, False)] + +mPerlinOptions = [ Hydrax.Perlin.Options(8, 0.085, 0.49, 1.4, 1.27), + Hydrax.Perlin.Options(8, 0.085, 0.49, 1.4, 1.27), + Hydrax.Perlin.Options(8, 0.085, 0.49, 1.4, 1.27), + Hydrax.Perlin.Options(8, 0.075, 0.49, 1.4, 1.27), + Hydrax.Perlin.Options(8, 0.085, 0.49, 1.4, 1.27)] + +mCurrentSkyBox = 0 + +## Event handler to add ability to alter subdivision +class HydraxListener(sf.FrameListener): + def __init__(self, rw, cam, sm , app): + sf.FrameListener.__init__(self, rw, cam) + self.sceneManager=sm + self.renderWindow =rw + self.camera=cam + self.app = app + self.mKeyBuffer=-1 + + def frameStarted(self, e): + if sf.FrameListener.frameStarted(self, e) == False: + return False + self.app.hydrax.update(e.timeSinceLastFrame) +# +# mKeyboard->capture() +# +# if (mKeyboard->isKeyDown(OIS::KC_M) && mKeyBuffer < 0) +# { +# mCurrentSkyBox++ +# +# if(mCurrentSkyBox > (_def_SkyBoxNum-1)) +# { +# mCurrentSkyBox = 0 +# } +# +# changeSkyBox() +# +# mKeyBuffer = 0.5f +# } +# +# mKeyBuffer -= e.timeSinceLastFrame +# + return True + + def changeSkyBox( self ): + # Change skybox + self.sceneManager.setSkyBox(true, mSkyBoxes[mCurrentSkyBox], 99999*3, true) + + # Update Hydrax sun position and colour + app.hydrax.setSunPosition(mSunPosition[mCurrentSkyBox]) + app.hydrax.setSunColor(mSunColor[mCurrentSkyBox]) + + # Update light 0 light position and colour + self.sceneManager.getLight("Light0").setPosition(mSunPosition[mCurrentSkyBox]) + self.sceneManager.getLight("Light0").setSpecularColour(mSunColor[mCurrentSkyBox].x,mSunColor[mCurrentSkyBox].y,mSunColor[mCurrentSkyBox].z) + + # Update perlin noise options + app.hydrax.getModule().getNoise().setOptions(mPerlinOptions[mCurrentSkyBox]) + + # Update projected grid options + app.hydrax.getModule().setOptions(mPGOptions[mCurrentSkyBox]) + +# ogre.LogManager.getSingleton().logMessage("Skybox " + mSkyBoxes[mCurrentSkyBox] + " selected. ("+Ogre::StringConverter::toString(mCurrentSkyBox+1)+"/"+Ogre::StringConverter::toString(_def_SkyBoxNum)+")") + + + +class HydraxApplication(sf.Application): + + def _createScene(self): + sceneManager = self.sceneManager + camera = self.camera + + # Create the SkyBox + sceneManager.setSkyBox(True, mSkyBoxes[mCurrentSkyBox], 99999*3, True) + + # Set some camera params + camera.setFarClipDistance(99999*6) + camera.setPosition(4897.61,76.8614,4709.9) + camera.setOrientation(ogre.Quaternion(0.487431, -0.0391184, 0.869485, 0.0697797)) + + # Create Hydrax object + self.hydrax = Hydrax.Hydrax(sceneManager, camera) + + # Set RTT textures quality + self.hydrax.setRttOptions( + Hydrax.RttOptions(# Reflection tex quality + Hydrax.TEX_QUA_1024, + # Refraction tex quality + Hydrax.TEX_QUA_1024, + # Depth tex quality + Hydrax.TEX_QUA_1024)) + + # Set components + self.hydrax.setComponents( Hydrax.HydraxComponent( Hydrax.HYDRAX_COMPONENT_SUN | + Hydrax.HYDRAX_COMPONENT_FOAM | + Hydrax.HYDRAX_COMPONENT_DEPTH | + Hydrax.HYDRAX_COMPONENT_SMOOTH | + Hydrax.HYDRAX_COMPONENT_CAUSTICS )) + + # Create our projected grid module + self.noise= Hydrax.Perlin() ## Default options (8, 0.085, 0.49, 1.4, 1.27f) + self.Module = Hydrax.ProjectedGrid(# Hydrax parent pointer + self.hydrax, + # Noise module + self.noise, + # Base plane + ogre.Plane(ogre.Vector3(0,1,0), ogre.Vector3(0,0,0)), + # Projected grid options (Can be updated each frame . setOptions(...)) + Hydrax.ProjectedGrid.Options(_def_PGComplexity )) + + # Set our module + self.hydrax.setModule(self.Module) + + # Set our shader mode + self.hydrax.setShaderMode(Hydrax.MaterialManager.SM_HLSL) + + # Create water + self.hydrax.create() + + # Adjust some options + self.hydrax.setPosition(ogre.Vector3(0,0,0)) + self.hydrax.setPlanesError(37.5) + self.hydrax.setDepthLimit(110) + self.hydrax.setSunPosition(mSunPosition[mCurrentSkyBox]) + self.hydrax.setSunColor(mSunColor[mCurrentSkyBox]) + self.hydrax.setNormalDistortion(0.025) + self.hydrax.setDepthColor(ogre.Vector3(0.04,0.135,0.185)) + self.hydrax.setSmoothPower(5) + self.hydrax.setCausticsScale(12) + self.hydrax.setGlobalTransparency(0.1) + self.hydrax.setFullReflectionDistance(99999997952.0) + self.hydrax.setGlobalTransparency(0) + self.hydrax.setPolygonMode(0) + + # Lights + sceneManager.setAmbientLight(ogre.ColourValue(1, 1, 1)) + Light = sceneManager.createLight("Light0") + Light.setPosition(mSunPosition[mCurrentSkyBox]) + Light.setDiffuseColour(1, 1, 1) + Light.setSpecularColour(mSunColor[mCurrentSkyBox].x,mSunColor[mCurrentSkyBox].y,mSunColor[mCurrentSkyBox].z) + + # Island + IslandEntity = sceneManager.createEntity("Island", "Island.mesh") + IslandEntity.setMaterialName("Examples/OffsetMapping/Specular") + IslandSceneNode = sceneManager.getRootSceneNode().createChildSceneNode(ogre.Vector3(5000, -175, 5000)) + IslandSceneNode.setScale(23, 13.5, 23) + IslandSceneNode.attachObject(IslandEntity) + + def _createFrameListener(self): + self.frameListener = HydraxListener(self.renderWindow, self.camera, self.sceneManager, self) + self.root.addFrameListener(self.frameListener) + self.frameListener.showDebugOverlay( True ) + + +if __name__ == '__main__': + try: + application = HydraxApplication() + application.go() + except ogre.OgreException, e: + print e Modified: trunk/python-ogre/demos/plugins.cfg =================================================================== --- trunk/python-ogre/demos/plugins.cfg 2008-08-15 10:44:11 UTC (rev 689) +++ trunk/python-ogre/demos/plugins.cfg 2008-08-17 12:57:28 UTC (rev 690) @@ -10,8 +10,8 @@ Plugin=Plugin_BSPSceneManager.dll Plugin=Plugin_OctreeSceneManager.dll Plugin=Plugin_CgProgramManager.dll -Plugin=Plugin_PCZSceneManager.dll -Plugin=Plugin_OctreeZone.dll +#Plugin=Plugin_PCZSceneManager.dll +#Plugin=Plugin_OctreeZone.dll #Plugin=Plugin_OctreeSceneManager.dll Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-15 10:44:11 UTC (rev 689) +++ trunk/python-ogre/environment.py 2008-08-17 12:57:28 UTC (rev 690) @@ -1628,7 +1628,7 @@ class hydrax: active = True pythonModule = True - version="0.1" + version="0.3" name='hydrax' parent="ogre/addons" cflags = "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-08-18 08:33:02
|
Revision: 695 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=695&view=rev Author: andy_miller Date: 2008-08-18 08:33:08 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Cleaned up some older files Added Particle universe patch Small updates to NxOgre demos -- more is required Modified Paths: -------------- trunk/python-ogre/demos/nxogre/CakeFramework.py trunk/python-ogre/demos/nxogre/Demo_101.py trunk/python-ogre/demos/nxogre/Lesson701.py trunk/python-ogre/demos/nxogre/resources.cfg Added Paths: ----------- trunk/python-ogre/demos/nxogre/media_old/ trunk/python-ogre/demos/nxogre/media_old/ComplexMeshes/ trunk/python-ogre/demos/nxogre/media_old/Env/ trunk/python-ogre/demos/nxogre/media_old/Essential/ trunk/python-ogre/demos/nxogre/media_old/SimpleMeshes/ trunk/python-ogre/demos/nxogre/media_old/resources.cfg trunk/python-ogre/patch/ParticleUniverse_0.8.patch Removed Paths: ------------- trunk/python-ogre/demos/nxogre/media/ trunk/python-ogre/demos/nxogre/media_old/ComplexMeshes/ trunk/python-ogre/demos/nxogre/media_old/Env/ trunk/python-ogre/demos/nxogre/media_old/Essential/ trunk/python-ogre/demos/nxogre/media_old/SimpleMeshes/ trunk/python-ogre/demos/nxogre/media_old/resources.cfg trunk/python-ogre/demos/ogre/plugins.cfg trunk/python-ogre/patch/ogre_svn.patch trunk/python-ogre/scripts_V2/ trunk/python-ogre/setup_dist.py Modified: trunk/python-ogre/demos/nxogre/CakeFramework.py =================================================================== --- trunk/python-ogre/demos/nxogre/CakeFramework.py 2008-08-18 04:12:37 UTC (rev 694) +++ trunk/python-ogre/demos/nxogre/CakeFramework.py 2008-08-18 08:33:08 UTC (rev 695) @@ -21,7 +21,7 @@ import ogre.gui.betagui as BetaGUI import ogre.io.OIS as OIS import ogre.physics.PhysX as PhysX -import ogre.physics.NxOgre_09 as nxogre +import ogre.physics.NxOgre as nxogre from Enums import * @@ -489,11 +489,11 @@ ##/ Grid ##self.SceneMgr.getRootSceneNode().attachObject(self.SceneMgr.createEntity("nx.floor","nx.floor.mesh")) - self.StaticGeom= self.SceneMgr.createStaticGeometry("Grid") - self.StaticGeom.addEntity(self.SceneMgr.createEntity("nx.floor", "nx.floor.mesh"), ogre.Vector3(0,-0.05,0)) - self.StaticGeom.addEntity(self.SceneMgr.createEntity("nx.axis", "nx.body.axis.mesh"), ogre.Vector3(0,0.01,0)) - self.StaticGeom.build() - self.StaticGeom.setCastShadows(False) +# self.StaticGeom= self.SceneMgr.createStaticGeometry("Grid") +# self.StaticGeom.addEntity(self.SceneMgr.createEntity("nx.floor", "nx.floor.mesh"), ogre.Vector3(0,-0.05,0)) +# self.StaticGeom.addEntity(self.SceneMgr.createEntity("nx.axis", "nx.body.axis.mesh"), ogre.Vector3(0,0.01,0)) +# self.StaticGeom.build() +# self.StaticGeom.setCastShadows(False) ## Light mSunLight = self.SceneMgr.createLight("SunLight") Modified: trunk/python-ogre/demos/nxogre/Demo_101.py =================================================================== --- trunk/python-ogre/demos/nxogre/Demo_101.py 2008-08-18 04:12:37 UTC (rev 694) +++ trunk/python-ogre/demos/nxogre/Demo_101.py 2008-08-18 08:33:08 UTC (rev 695) @@ -7,7 +7,7 @@ import ogre.renderer.OGRE as ogre import ogre.physics.PhysX as physx -import ogre.physics.NxOgre_09 as nxogre +import ogre.physics.NxOgre as nxogre import CakeFramework as cf class NxTutorial ( cf.Cake ): @@ -17,9 +17,10 @@ ##//////////////////////////////////////////////////////////////////////////////////////////////// def start(self ): - self.World = nxogre.World("Log: html") + self.World = nxogre.World(nxogre.PhysXParams("Log: html")) - self.Scene = self.World.createScene("Main", self.SceneMgr,"gravity: yes, floor: yes") + self.Scene = self.World.createScene("Main", nxogre.SceneParams("renderer: ogre, controller: accumulator, gravity: yes, floor: yes")) + ### self.SceneMgr,"gravity: yes, floor: yes") self.Scene.createBody('sphere.50cm.mesh',nxogre.SphereShape(0.5), ogre.Vector3(3,1.5,0), "mass: 10" ) @@ -71,4 +72,3 @@ except ogre.OgreException, e: print e - Modified: trunk/python-ogre/demos/nxogre/Lesson701.py =================================================================== --- trunk/python-ogre/demos/nxogre/Lesson701.py 2008-08-18 04:12:37 UTC (rev 694) +++ trunk/python-ogre/demos/nxogre/Lesson701.py 2008-08-18 08:33:08 UTC (rev 695) @@ -1,8 +1,8 @@ ## =============================================================================== -## AGEIA PHYSX SDK TRAINING PROGRAMS -## LESSON 701: WHEEL SHAPES +## AGEIA PHYSX SDK TRAINING PROGRAMS +## LESSON 701: WHEEL SHAPES ## -## Written by Bob Schade, 5-1-06 +## Written by Bob Schade, 5-1-06 ## =============================================================================== @@ -60,29 +60,13 @@ ##//////////////////////////////////////////////////////////////////////////////////////////////// -if __name__ == '__main__': - import exceptions,sys - try: - application = NxTutorial () - application.pre() - application.start() - application.WorldInstance = application.getWorld() - application.startRendering(application) - application.stop() - application.post() +def PrintControls(): - except ogre.OgreException, e: - print e + print("\n Flight Controls:\n ----------------\n w = forward, s = back\n a = strafe left, d = strafe right\n q = up, z = down\n") + print("\n Force Controls:\n ---------------\n i = +z, k = -z\n j = +x, l = -x\n u = +y, m = -y\n") + print("\n Miscellaneous:\n --------------\n p = Pause\n r = Select Next Actor\n f = Toggle Force Mode\n b = Toggle Debug Wireframe Mode\n x = Toggle Shadows\n t = Move Focus Actor to (0,5,0)\n") - -# # # def PrintControls(): -# # # -# # # print("\n Flight Controls:\n ----------------\n w = forward, s = back\n a = strafe left, d = strafe right\n q = up, z = down\n") -# # # print("\n Force Controls:\n ---------------\n i = +z, k = -z\n j = +x, l = -x\n u = +y, m = -y\n") -# # # print("\n Miscellaneous:\n --------------\n p = Pause\n r = Select Next Actor\n f = Toggle Force Mode\n b = Toggle Debug Wireframe Mode\n x = Toggle Shadows\n t = Move Focus Actor to (0,5,0)\n") -# # # -# # # # # # def RenderActors(bool shadows) # # # # # # ## Render all the actors in the scene @@ -91,12 +75,12 @@ # # # while (nbActors--) # # # # # # NxActor* actor = *actors++ -# # # DrawActor(actor, self.SelectedActor, False) +# # # DrawActor(actor, self.SelectedActor, False) # # # # # # ## Handle shadows # # # if (shadows): # # # -# # # DrawActorShadow(actor, False) +# # # DrawActorShadow(actor, False) # # # @@ -107,226 +91,229 @@ actors = self.Scene.getActors() while nbActors > 0: nbActors -= 1 - nbShapes = actors[nbActors].getNbShapes() - shapes = actors[nbActors].getShapes() - while nbShapes > 0: - nbShapes -= 1 + nbShapes = actors[nbActors].getNbShapes() + shapes = actors[nbActors].getShapes() + while nbShapes > 0: + nbShapes -= 1 - shape = shapes[nbShapes] - if (shape.getType() == nxogre.NX_SHAPE_WHEEL): + shape = shapes[nbShapes] + if (shape.getType() == nxogre.NX_SHAPE_WHEEL): -# NxWheelShape* ws = (NxWheelShape*)shape -# ShapeUserData* sud = (ShapeUserData*)(shape.userData) - ws = shape - sud = shape.userData - if sud: - ## Need to save away roll angle in wheel shape user data - rollAngle = sud.wheelShapeRollAngle -## rollAngle += ws.getAxleSpeed() * 1.0/60.0f - rollAngle += ws.getAxleSpeed() * gDeltaTime - while (rollAngle > nxogre.NxTwoPi) ##normally just 1x - rollAngle -= nxogre.NxTwoPi - while (rollAngle < -nxogre.NxTwoPi) ##normally just 1x - rollAngle += nxogre.NxTwoPi +# NxWheelShape* ws = (NxWheelShape*)shape +# ShapeUserData* sud = (ShapeUserData*)(shape.userData) + ws = shape + sud = shape.userData + if sud: + ## Need to save away roll angle in wheel shape user data + rollAngle = sud.wheelShapeRollAngle +## rollAngle += ws.getAxleSpeed() * 1.0/60.0f + rollAngle += ws.getAxleSpeed() * gDeltaTime + while (rollAngle > nxogre.NxTwoPi): ##normally just 1x + rollAngle -= nxogre.NxTwoPi + while (rollAngle < -nxogre.NxTwoPi): ##normally just 1x + rollAngle += nxogre.NxTwoPi - ## We have the roll angle for the wheel now - sud.wheelShapeRollAngle = rollAngle + ## We have the roll angle for the wheel now + sud.wheelShapeRollAngle = rollAngle - pose = ws.getGlobalPose() + pose = ws.getGlobalPose() - wcd = nxogre.NxWheelContactData () - s = ws.getContact(wcd) + wcd = nxogre.NxWheelContactData () + s = ws.getContact(wcd) - r = ws.getRadius() - st = ws.getSuspensionTravel() - steerAngle = ws.getSteerAngle() + r = ws.getRadius() + st = ws.getSuspensionTravel() + steerAngle = ws.getSteerAngle() -## NxWheelShapeDesc state -## ws.saveToDesc(state) +## NxWheelShapeDesc state +## ws.saveToDesc(state) - dir_ = NxVec3 () -# # /* -# # getWorldSegmentFast(seg) -# # seg.computeDirection(dir) -# # dir.normalize() -# # */ - p0 = pose.t ##cast from shape origin - pose.M.getColumn(1, dir_) - dir_ = -dir_ ##cast along -Y. - castLength = r + st ##cast ray self long + dir_ = NxVec3 () +# # /* +# # getWorldSegmentFast(seg) +# # seg.computeDirection(dir) +# # dir.normalize() +# # */ + p0 = pose.t ##cast from shape origin + pose.M.getColumn(1, dir_) + dir_ = -dir_ ##cast along -Y. + castLength = r + st ##cast ray self long -## renderer.addArrow(p0, dir, castLength, 1.0) - - ##have ground contact? - ## This code is from WheelShape.cpp in SDKs/core/common/src - ## if (contactPosition != nxogre.NX_MAX_REAL) : - if s and (wcd.contactForce > -1000) : +## renderer.addArrow(p0, dir, castLength, 1.0) + + ##have ground contact? + ## This code is from WheelShape.cpp in SDKs/core/common/src + ## if (contactPosition != nxogre.NX_MAX_REAL) : + if s and (wcd.contactForce > -1000) : -## pose.t = p0 + dir * wcd.contactPoint -## pose.t -= dir * state.radius //go from contact pos to center pos. - pose.t = wcd.contactPoint - pose.t -= dir_ * r ##go from contact pos to center pos. +## pose.t = p0 + dir * wcd.contactPoint +## pose.t -= dir * state.radius //go from contact pos to center pos. + pose.t = wcd.contactPoint + pose.t -= dir_ * r ##go from contact pos to center pos. - rot = nxogre.NxMat33() - axisRot = nxogre.NxMat33 () - rot.rotY(steerAngle) - axisRot.rotY(0) + rot = nxogre.NxMat33() + axisRot = nxogre.NxMat33 () + rot.rotY(steerAngle) + axisRot.rotY(0) -## NxReal rollAngle = ((ShapeUserData*)(wheel.userData)).rollAngle +## NxReal rollAngle = ((ShapeUserData*)(wheel.userData)).rollAngle - rollRot = nxogre.NxMat33 () - rollRot.rotX(rollAngle) + rollRot = nxogre.NxMat33 () + rollRot.rotX(rollAngle) - pose.M = rot * pose.M * axisRot * rollRot + pose.M = rot * pose.M * axisRot * rollRot - sud.wheelShapePose = pose + sud.wheelShapePose = pose - else: + else: - pose.t = p0 + dir * st - sud.wheelShapePose = pose + pose.t = p0 + dir * st + sud.wheelShapePose = pose def AddWheelToActor(self, actor, wheelDesc): - wheelShapeDesc = nxogre.NxWheelShapeDesc () + wheelShapeDesc = nxogre.NxWheelShapeDesc () - ## Create a shared car wheel material to be used by all wheels - if (!self.wsm): + ## Create a shared car wheel material to be used by all wheels + if not self.wsm: - m = nxogre.NxMaterialDesc () - m.flags |= nxogre.NX_MF_DISABLE_FRICTION - self.wsm = self.Scene.createMaterial(m) + m = nxogre.NxMaterialDesc () + m.flags |= nxogre.NX_MF_DISABLE_FRICTION + self.wsm = self.Scene.createMaterial(m) - wheelShapeDesc.materialIndex = self.wsm.getMaterialIndex() + wheelShapeDesc.materialIndex = self.wsm.getMaterialIndex() - wheelShapeDesc.localPose.t = wheelDesc.position - q = nxogre.NxQuat () - q.fromAngleAxis(90, nxogre.NxVec3(0,1,0)) - wheelShapeDesc.localPose.M.fromQuat(q) + wheelShapeDesc.localPose.t = wheelDesc.position + q = nxogre.NxQuat () + q.fromAngleAxis(90, nxogre.NxVec3(0,1,0)) + wheelShapeDesc.localPose.M.fromQuat(q) - heightModifier = (wheelDesc.wheelSuspension + wheelDesc.wheelRadius) / wheelDesc.wheelSuspension + heightModifier = (wheelDesc.wheelSuspension + wheelDesc.wheelRadius) / wheelDesc.wheelSuspension - wheelShapeDesc.suspension.spring = wheelDesc.springRestitution*heightModifier - wheelShapeDesc.suspension.damper = 0 ##wheelDesc.springDamping*heightModifier; - wheelShapeDesc.suspension.targetValue = wheelDesc.springBias*heightModifier + wheelShapeDesc.suspension.spring = wheelDesc.springRestitution*heightModifier + wheelShapeDesc.suspension.damper = 0 ##wheelDesc.springDamping*heightModifier; + wheelShapeDesc.suspension.targetValue = wheelDesc.springBias*heightModifier - wheelShapeDesc.radius = wheelDesc.wheelRadius - wheelShapeDesc.suspensionTravel = wheelDesc.wheelSuspension - wheelShapeDesc.inverseWheelMass = 0.1 ##not given!? TODO + wheelShapeDesc.radius = wheelDesc.wheelRadius + wheelShapeDesc.suspensionTravel = wheelDesc.wheelSuspension + wheelShapeDesc.inverseWheelMass = 0.1 ##not given!? TODO - ## wheelShapeDesc.lateralTireForceFunction = //TODO - ## wheelShapeDesc.longitudalTireForceFunction = //TODO + ## wheelShapeDesc.lateralTireForceFunction = //TODO + ## wheelShapeDesc.longitudalTireForceFunction = //TODO # # NxWheelShape* wheelShape -# # wheelShape = static_cast<NxWheelShape *>(actor.createShape(wheelShapeDesc)) +# # wheelShape = static_cast<NxWheelShape *>(actor.createShape(wheelShapeDesc)) def CreateCab( self, pos): """ create the cab from a box """ - actor = self.CreateBox(pos + nxogre.NxVec3(0,1,0), nxogre.NxVec3(1,0.5,0.5), 10) - actor.raiseBodyFlag(nxogre.NX_BF_FROZEN_ROT_X) - actor.raiseBodyFlag(nxogre.NX_BF_FROZEN_ROT_Z) - actor.setAngularDamping(0.5) + actor = self.CreateBox(pos + nxogre.NxVec3(0,1,0), nxogre.NxVec3(1,0.5,0.5), 10) + actor.raiseBodyFlag(nxogre.NX_BF_FROZEN_ROT_X) + actor.raiseBodyFlag(nxogre.NX_BF_FROZEN_ROT_Z) + actor.setAngularDamping(0.5) - wheelDesc =nxogre.NxWheelDesc - ##wheelDesc.wheelAxis.set(0,0,1) - ##wheelDesc.downAxis.set(0,-1,0) + wheelDesc =nxogre.NxWheelDesc + ##wheelDesc.wheelAxis.set(0,0,1) + ##wheelDesc.downAxis.set(0,-1,0) wheelDesc.wheelApproximation = 10 - wheelDesc.wheelRadius = 0.5 - wheelDesc.wheelWidth = 0.1 - wheelDesc.wheelSuspension = 0.2 - wheelDesc.springRestitution = 7000 - wheelDesc.springDamping = 800 - wheelDesc.springBias = 0 - wheelDesc.maxBrakeForce = 1 - wheelDesc.frictionToFront = 0.1 - wheelDesc.frictionToSide = 0.99 - wheelDesc.position = nxogre.NxVec3(0,-0.4,0) - wheelDesc.wheelFlags = nxogre.NX_WF_USE_WHEELSHAPE | nxogre.NX_WF_BUILD_LOWER_HALF | nxogre.NX_WF_ACCELERATED | - nxogre.NX_WF_AFFECTED_BY_HANDBRAKE | nxogre.NX_WF_STEERABLE_INPUT | nxogre.NX_WF_BUILD_LOWER_HALF + wheelDesc.wheelRadius = 0.5 + wheelDesc.wheelWidth = 0.1 + wheelDesc.wheelSuspension = 0.2 + wheelDesc.springRestitution = 7000 + wheelDesc.springDamping = 800 + wheelDesc.springBias = 0 + wheelDesc.maxBrakeForce = 1 + wheelDesc.frictionToFront = 0.1 + wheelDesc.frictionToSide = 0.99 + wheelDesc.position = nxogre.NxVec3(0,-0.4,0) + wheelDesc.wheelFlags = nxogre.NX_WF_USE_WHEELSHAPE | nxogre.NX_WF_BUILD_LOWER_HALF | nxogre.NX_WF_ACCELERATED |\ + nxogre.NX_WF_AFFECTED_BY_HANDBRAKE | nxogre.NX_WF_STEERABLE_INPUT | nxogre.NX_WF_BUILD_LOWER_HALF self.AddWheelToActor(actor, wheelDesc) - return actor + return actor -def InitNx() +def InitNx(): - ## Create a memory allocator - gAllocator = new UserAllocator + ## Create a memory allocator + gAllocator = nxogre.UserAllocator () ## Create the physics SDK self.gPhysicsSDK = NxCreatePhysicsSDK(nxogre.NX_PHYSICS_SDK_VERSION, gAllocator) - if (!self.gPhysicsSDK) return : + if not self.gPhysicsSDK : return - ## Set the physics parameters - self.gPhysicsSDK.setParameter(nxogre.NX_SKIN_WIDTH, 0.05) + ## Set the physics parameters + self.gPhysicsSDK.setParameter(nxogre.NX_SKIN_WIDTH, 0.05) - ## Set the debug visualization parameters - self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZATION_SCALE, 1) - self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZE_ACTOR_AXES, 1) - self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZE_COLLISION_SHAPES, 1) + ## Set the debug visualization parameters + self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZATION_SCALE, 1) + self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZE_ACTOR_AXES, 1) + self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZE_COLLISION_SHAPES, 1) - self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZE_CONTACT_POINT, 1) - self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZE_CONTACT_NORMAL, 1) + self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZE_CONTACT_POINT, 1) + self.gPhysicsSDK.setParameter(nxogre.NX_VISUALIZE_CONTACT_NORMAL, 1) ## Create the scene sceneDesc = nxogre.NxSceneDesc () sceneDesc.gravity = gDefaultGravity - sceneDesc.simType = nxogre.NX_SIMULATION_HW - self.Scene = self.gPhysicsSDK.createScene(sceneDesc) - if(!self.Scene){ : - sceneDesc.simType = nxogre.NX_SIMULATION_SW - self.Scene = self.gPhysicsSDK.createScene(sceneDesc) - if(!self.Scene) return : + sceneDesc.simType = nxogre.NX_SIMULATION_HW + self.Scene = self.gPhysicsSDK.createScene(sceneDesc) + if not self.Scene: + sceneDesc.simType = nxogre.NX_SIMULATION_SW + self.Scene = self.gPhysicsSDK.createScene(sceneDesc) + if not self.Scene :return - ## Create the default material - NxMaterial* defaultMaterial = self.Scene.getMaterialFromIndex(0) - defaultMaterial.setRestitution(0.5) - defaultMaterial.setStaticFriction(0.5) - defaultMaterial.setDynamicFriction(0.5) + ## Create the default material + defaultMaterial = self.Scene.getMaterialFromIndex(0) + defaultMaterial.setRestitution(0.5) + defaultMaterial.setStaticFriction(0.5) + defaultMaterial.setDynamicFriction(0.5) - ## Create the objects in the scene - groundPlane = CreateGroundPlane() + ## Create the objects in the scene + groundPlane = CreateGroundPlane() - self.box = CreateBox(NxVec3(5,0,0), NxVec3(0.5,1,0.5), 20) - self.sphere = CreateSphere(NxVec3(0,0,5), 1, 10) - self.capsule = CreateCapsule(NxVec3(-5,0,0), 2, 0.5, 10) + self.box = CreateBox(NxVec3(5,0,0), NxVec3(0.5,1,0.5), 20) + self.sphere = CreateSphere(NxVec3(0,0,5), 1, 10) + self.capsule = CreateCapsule(NxVec3(-5,0,0), 2, 0.5, 10) - ## Reset wheel material - self.wsm = None + ## Reset wheel material + self.wsm = None - self.cab = CreateCab(NxVec3(0,0,0)) + self.cab = CreateCab(NxVec3(0,0,0)) - self.SelectedActor = cab - self.gForceStrength = 35000 + self.SelectedActor = cab + self.gForceStrength = 35000 - ## Turn on all contact notifications - self.Scene.setActorGroupPairFlags(0, 0, NX_NOTIFY_ON_TOUCH) + ## Turn on all contact notifications + self.Scene.setActorGroupPairFlags(0, 0, NX_NOTIFY_ON_TOUCH) AddUserDataToActors(self.Scene) - ## Initialize HUD - InitializeHUD() + ## Initialize HUD + InitializeHUD() - ## Get the current time - UpdateTime() + ## Get the current time + UpdateTime() - ## Start the first frame of the simulation - if (self.Scene) StartPhysics() : + ## Start the first frame of the simulation + if self.Scene :StartPhysics() -int main(int argc, char** argv) +if __name__ == '__main__': + import exceptions,sys + try: + PrintControls() + InitGlut(argc, argv, "Lesson 701: Wheel Shapes") + InitNx() + glutMainLoop() + ReleaseNx() - PrintControls() - InitGlut(argc, argv, "Lesson 701: Wheel Shapes") - InitNx() - glutMainLoop() - ReleaseNx() - return 0 + except ogre.OgreException, e: + print e Deleted: trunk/python-ogre/demos/nxogre/media_old/resources.cfg =================================================================== --- trunk/python-ogre/demos/nxogre/media/resources.cfg 2008-08-17 13:10:15 UTC (rev 691) +++ trunk/python-ogre/demos/nxogre/media_old/resources.cfg 2008-08-18 08:33:08 UTC (rev 695) @@ -1,15 +0,0 @@ -# Resource locations to be added to the 'boostrap' path -# This also contains the minimum you need to use the Ogre example framework -[Bootstrap] -FileSystem=Media/Essential/Boot/ - -# Resource locations to be added to the default path -[General] -FileSystem=Media/ -FileSystem=Media/Essential/ -FileSystem=Media/Essential/BetaGUI/ -FileSystem=Media/Essential/BetaGUIExtended/ -FileSystem=Media/Essential/Fonts/ -FileSystem=Media/SimpleMeshes/ -FileSystem=Media/ComplexMeshes/ -FileSystem=Media/Env/ \ No newline at end of file Copied: trunk/python-ogre/demos/nxogre/media_old/resources.cfg (from rev 694, trunk/python-ogre/demos/nxogre/media/resources.cfg) =================================================================== --- trunk/python-ogre/demos/nxogre/media_old/resources.cfg (rev 0) +++ trunk/python-ogre/demos/nxogre/media_old/resources.cfg 2008-08-18 08:33:08 UTC (rev 695) @@ -0,0 +1,15 @@ +# Resource locations to be added to the 'boostrap' path +# This also contains the minimum you need to use the Ogre example framework +[Bootstrap] +FileSystem=Media/Essential/Boot/ + +# Resource locations to be added to the default path +[General] +FileSystem=Media/ +FileSystem=Media/Essential/ +FileSystem=Media/Essential/BetaGUI/ +FileSystem=Media/Essential/BetaGUIExtended/ +FileSystem=Media/Essential/Fonts/ +FileSystem=Media/SimpleMeshes/ +FileSystem=Media/ComplexMeshes/ +FileSystem=Media/Env/ \ No newline at end of file Modified: trunk/python-ogre/demos/nxogre/resources.cfg =================================================================== --- trunk/python-ogre/demos/nxogre/resources.cfg 2008-08-18 04:12:37 UTC (rev 694) +++ trunk/python-ogre/demos/nxogre/resources.cfg 2008-08-18 08:33:08 UTC (rev 695) @@ -1,15 +1,23 @@ # Resource locations to be added to the 'boostrap' path # This also contains the minimum you need to use the Ogre example framework [Bootstrap] -FileSystem=./media/Essential/Boot/ +#FileSystem=./media/Essential/Boot/ +Zip=../media/packs/OgreCore.zip +Zip=./media_new/cake.zip # Resource locations to be added to the default path [General] -FileSystem=./media/ -FileSystem=./media/Essential/ -FileSystem=./media/Essential/BetaGUI/ -FileSystem=./media/Essential/BetaGUIExtended/ -FileSystem=./media/Essential/Fonts/ -FileSystem=./media/SimpleMeshes/ -FileSystem=./media/ComplexMeshes/ -FileSystem=./media/Env/ \ No newline at end of file +FileSystem=./media_old/ +FileSystem=./media_old/Essential/ +FileSystem=./media_old/Essential/BetaGUI/ +FileSystem=./media_old/Essential/BetaGUIExtended/ +FileSystem=./media_old/Essential/Fonts/ +#FileSystem=./media_old/SimpleMeshes/ +#F#ileSystem=./media_old/ComplexMeshes/ +#F#ileSystem=./media_old/Env/ + +FileSystem=./media_new/gui +FileSystem=./media_new/images +FileSystem=./media_new/materials +FileSystem=./media_new/meshes +FileSystem=./media_new/programs Deleted: trunk/python-ogre/demos/ogre/plugins.cfg =================================================================== --- trunk/python-ogre/demos/ogre/plugins.cfg 2008-08-18 04:12:37 UTC (rev 694) +++ trunk/python-ogre/demos/ogre/plugins.cfg 2008-08-18 08:33:08 UTC (rev 695) @@ -1,15 +0,0 @@ -# Defines plugins to load -# Defines plugins to load - -# Define plugin folder -# CHANGE THIS TO YOUR PATH -PluginFolder=/home/andy/development/root/usr/lib/OGRE - -# Define D3D rendering implementation plugin -Plugin=RenderSystem_GL.so -Plugin=Plugin_ParticleFX.so -Plugin=Plugin_BSPSceneManager.so -Plugin=Plugin_OctreeSceneManager.so -Plugin=Plugin_CgProgramManager.so - - Added: trunk/python-ogre/patch/ParticleUniverse_0.8.patch =================================================================== --- trunk/python-ogre/patch/ParticleUniverse_0.8.patch (rev 0) +++ trunk/python-ogre/patch/ParticleUniverse_0.8.patch 2008-08-18 08:33:08 UTC (rev 695) @@ -0,0 +1,167 @@ +Only in \development\Particle Universe V0.8\Plugins\ParticleUniverse\Docs: desktop.ini +Only in \development\Particle Universe V0.8\Plugins\ParticleUniverse\Docs\html: class_particle_universe_1_1_align_affector_tokens_1_1_resize_token-members.html +Only in \development\Particle Universe V0.8\Plugins\ParticleUniverse\Docs\manual\files\images: Thumbs.db +Only in \development\Particle Universe V0.8\Plugins\ParticleUniverse\Docs: Thumbs.db +diff -r -U 3 .\include\ParticleUniverseHook.h \development\Particle Universe V0.8\Plugins\ParticleUniverse\include\ParticleUniverseHook.h +--- .\include\ParticleUniverseHook.h Mon Aug 18 14:57:32 2008 ++++ \development\Particle Universe V0.8\Plugins\ParticleUniverse\include\ParticleUniverseHook.h Fri Jun 13 09:31:50 2008 +@@ -36,8 +36,8 @@ + if (list->empty()) + return; + +- typename std::vector<T*>::iterator it; +- typename std::vector<T*>::iterator itEnd = list->end(); ++ std::vector<T*>::iterator it; ++ std::vector<T*>::iterator itEnd = list->end(); + for (it = list->begin(); it != itEnd; ++it) + { + (*it)->_prepare(technique); +@@ -51,8 +51,8 @@ + if (list->empty()) + return; + +- typename std::vector<T*>::iterator it; +- typename std::vector<T*>::iterator itEnd = list->end(); ++ std::vector<T*>::iterator it; ++ std::vector<T*>::iterator itEnd = list->end(); + for (it = list->begin(); it != itEnd; ++it) + { + (*it)->_notifyStart(); +@@ -66,8 +66,8 @@ + if (list->empty()) + return; + +- typename std::vector<T*>::iterator it; +- typename std::vector<T*>::iterator itEnd = list->end(); ++ std::vector<T*>::iterator it; ++ std::vector<T*>::iterator itEnd = list->end(); + for (it = list->begin(); it != itEnd; ++it) + { + (*it)->_notifyStop(); +@@ -83,8 +83,8 @@ + if (list->empty()) + return; + +- typename std::vector<T*>::iterator it; +- typename std::vector<T*>::iterator itEnd = list->end(); ++ std::vector<T*>::iterator it; ++ std::vector<T*>::iterator itEnd = list->end(); + for (it = list->begin(); it != itEnd; ++it) + { + (*it)->_preProcessParticles(technique, timeElapsed); +@@ -102,8 +102,8 @@ + if (list->empty()) + return; + +- typename std::vector<T*>::iterator it; +- typename std::vector<T*>::iterator itEnd = list->end(); ++ std::vector<T*>::iterator it; ++ std::vector<T*>::iterator itEnd = list->end(); + for (it = list->begin(); it != itEnd; ++it) + { + (*it)->_processParticle(particleTechnique, particle, timeElapsed, firstParticle); +@@ -119,8 +119,8 @@ + if (list->empty()) + return; + +- typename std::vector<T*>::iterator it; +- typename std::vector<T*>::iterator itEnd = list->end(); ++ std::vector<T*>::iterator it; ++ std::vector<T*>::iterator itEnd = list->end(); + for (it = list->begin(); it != itEnd; ++it) + { + (*it)->_postProcessParticles(technique, timeElapsed); +diff -r -U 3 .\include\ParticleUniverseSpatialHashTable.h \development\Particle Universe V0.8\Plugins\ParticleUniverse\include\ParticleUniverseSpatialHashTable.h +--- .\include\ParticleUniverseSpatialHashTable.h Mon Aug 18 14:59:01 2008 ++++ \development\Particle Universe V0.8\Plugins\ParticleUniverse\include\ParticleUniverseSpatialHashTable.h Fri Jun 13 09:31:51 2008 +@@ -35,7 +35,7 @@ + SpatialHashTable(void) : + mTableSize(50), + mCellDimension(15), +- mCellOverlap(5) ++ mCellOverlap(5), + { + _initialise(); + }; +Only in \development\Particle Universe V0.8\Plugins\ParticleUniverse\misc: Thumbs.db +Only in .: obj +Only in .\scripts: ParticleUniverse.vcproj.JNPR.amiller.user +diff -r -U 3 .\src\Externs\ParticleUniverseBoxColliderExtern.cpp \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\Externs\ParticleUniverseBoxColliderExtern.cpp +--- .\src\Externs\ParticleUniverseBoxColliderExtern.cpp Mon Aug 18 15:02:13 2008 ++++ \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\Externs\ParticleUniverseBoxColliderExtern.cpp Fri Jun 13 09:31:51 2008 +@@ -29,7 +29,7 @@ + if (isAttached()) + { + // Use the position of the parent node in this case. +- position = getParentNode()->getPosition(); ++ position = getParentNode()->getWorldPosition(); + mDerivedPosition = position; + populateAlignedBox(mBox, mDerivedPosition, mWidth, mHeight, mDepth); + _calculateBounds(); +diff -r -U 3 .\src\Externs\ParticleUniverseGravityExtern.cpp \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\Externs\ParticleUniverseGravityExtern.cpp +--- .\src\Externs\ParticleUniverseGravityExtern.cpp Mon Aug 18 15:02:15 2008 ++++ \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\Externs\ParticleUniverseGravityExtern.cpp Fri Jun 13 09:31:51 2008 +@@ -29,7 +29,7 @@ + // Use the position of the parent node in this case. + if (isAttached()) + { +- position = getParentNode()->getPosition(); ++ position = getParentNode()->getWorldPosition(); + mDerivedPosition = position; + } + } +diff -r -U 3 .\src\Externs\ParticleUniverseSphereColliderExtern.cpp \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\Externs\ParticleUniverseSphereColliderExtern.cpp +--- .\src\Externs\ParticleUniverseSphereColliderExtern.cpp Mon Aug 18 15:02:16 2008 ++++ \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\Externs\ParticleUniverseSphereColliderExtern.cpp Fri Jun 13 09:31:51 2008 +@@ -29,7 +29,7 @@ + if (isAttached()) + { + // Use the position of the parent node in this case. +- position = getParentNode()->getPosition(); ++ position = getParentNode()->getWorldPosition(); + mDerivedPosition = position; + mSphere.setCenter(mDerivedPosition); + } +diff -r -U 3 .\src\Externs\ParticleUniverseVortexExtern.cpp \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\Externs\ParticleUniverseVortexExtern.cpp +--- .\src\Externs\ParticleUniverseVortexExtern.cpp Mon Aug 18 15:02:16 2008 ++++ \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\Externs\ParticleUniverseVortexExtern.cpp Fri Jun 13 09:31:51 2008 +@@ -28,7 +28,7 @@ + { + if (isAttached()) + { +- position = getParentNode()->getPosition(); ++ position = getParentNode()->getWorldPosition(); + mDerivedPosition = position; + } + } +diff -r -U 3 .\src\ParticleUniverseSystem.cpp \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\ParticleUniverseSystem.cpp +--- .\src\ParticleUniverseSystem.cpp Mon Aug 18 15:17:00 2008 ++++ \development\Particle Universe V0.8\Plugins\ParticleUniverse\src\ParticleUniverseSystem.cpp Fri Jun 13 09:32:00 2008 +@@ -392,7 +392,7 @@ + if (!mTimeController) + { + mTimeSinceLastVisible = 0; +- mLastVisibleFrame = Ogre::Root::getSingleton().getNextFrameNumber(); ++ mLastVisibleFrame = Ogre::Root::getSingleton().getCurrentFrameNumber(); + Ogre::ControllerManager& controllerManager = Ogre::ControllerManager::getSingleton(); + Ogre::ControllerValueRealPtr particleSystemUpdateValue(new ParticleSystemUpdateValue(this)); + mTimeController = controllerManager.createFrameTimePassthroughController(particleSystemUpdateValue); +@@ -409,7 +409,7 @@ + void ParticleSystem::_notifyCurrentCamera(Ogre::Camera* cam) + { + Ogre::MovableObject::_notifyCurrentCamera(cam); +- mLastVisibleFrame = Ogre::Root::getSingleton().getNextFrameNumber(); ++ mLastVisibleFrame = Ogre::Root::getSingleton().getCurrentFrameNumber(); + mTimeSinceLastVisible = 0.0f; + + // Notify all techniques +@@ -500,7 +500,7 @@ + { + if (mNonvisibleUpdateTimeoutSet) + { +- long frameDiff = Ogre::Root::getSingleton().getNextFrameNumber() - mLastVisibleFrame; ++ long frameDiff = Ogre::Root::getSingleton().getCurrentFrameNumber() - mLastVisibleFrame; + if (frameDiff > 1 || frameDiff < 0) + { + mTimeSinceLastVisible += timeElapsed; +Only in \development\Particle Universe V0.8\Plugins\ParticleUniverse: Thumbs.db Deleted: trunk/python-ogre/patch/ogre_svn.patch =================================================================== --- trunk/python-ogre/patch/ogre_svn.patch 2008-08-18 04:12:37 UTC (rev 694) +++ trunk/python-ogre/patch/ogre_svn.patch 2008-08-18 08:33:08 UTC (rev 695) @@ -1,98 +0,0 @@ -Index: OgreMovableObject.h -=================================================================== ---- OgreMovableObject.h (revision 7604) -+++ OgreMovableObject.h (working copy) -@@ -479,7 +479,7 @@ - included too. - */ - virtual void visitRenderables(Renderable::Visitor* visitor, -- bool debugRenderables = false) = 0; -+ bool debugRenderables = false) { throw std::runtime_error ( std::string ("Virtual function MovableObject::visitRenderables called!") ); } - - /** Sets whether or not the debug display of this object is enabled. - @remarks -Index: OgreRenderQueueListener.h -=================================================================== ---- OgreRenderQueueListener.h (revision 7604) -+++ OgreRenderQueueListener.h (working copy) -@@ -31,7 +31,9 @@ - - #include "OgrePrerequisites.h" - #include "OgreRenderQueue.h" -+#include <stdexcept> - -+ - namespace Ogre { - - /** Abstract interface which classes must implement if they wish to receive -@@ -65,7 +67,7 @@ - for this queue group. - */ - virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, -- bool& skipThisInvocation) = 0; -+ bool& skipThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueStarted called!") ); } - - /** Event raised after a queue group is rendered. - @remarks -@@ -80,7 +82,7 @@ - events will also be fired for it again. - */ - virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, -- bool& repeatThisInvocation) = 0; -+ bool& repeatThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueEnded called!") ); } - }; - - } -Index: OgreDataStream.h -=================================================================== ---- OgreDataStream.h (revision 7604) -+++ OgreDataStream.h (working copy) -@@ -33,6 +33,7 @@ - #include "OgreString.h" - #include "OgreSharedPtr.h" - #include <istream> -+#include <stdexcept> - - namespace Ogre { - -@@ -79,7 +80,7 @@ - @param count Number of bytes to read - @returns The number of bytes read - */ -- virtual size_t read(void* buf, size_t count) = 0; -+ virtual size_t read(void* buf, size_t count) { throw std::runtime_error ( std::string ("Virtual function DataStream::read called!") ); } - /** Get a single line from the stream. - @remarks - The delimiter character is not included in the data -@@ -146,7 +147,7 @@ - /** Returns the total size of the data to be read from the stream, - or 0 if this is indeterminate for this stream. - */ -- size_t size(void) const { return mSize; } -+ virtual size_t size(void) const { return mSize; } - - /** Close the stream; this makes further operations invalid. */ - virtual void close(void) = 0; -Index: OgreHardwareBuffer.h -=================================================================== ---- OgreHardwareBuffer.h (revision 7604) -+++ OgreHardwareBuffer.h (working copy) -@@ -31,7 +31,9 @@ - - // Precompiler options - #include "OgrePrerequisites.h" -+#include <stdexcept> - -+ - namespace Ogre { - - /** Abstract class defining common features of hardware buffers. -@@ -244,7 +246,7 @@ - @param pDest The area of memory in which to place the data, must be large enough to - accommodate the data! - */ -- virtual void readData(size_t offset, size_t length, void* pDest) = 0; -+ virtual void readData(size_t offset, size_t length, void* pDest) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::readData called!") ); } - /** Writes data to the buffer from an area of system memory; note that you must - ensure that your buffer is big enough. - @param offset The byte offset from the start of the buffer to start writing Deleted: trunk/python-ogre/setup_dist.py =================================================================== --- trunk/python-ogre/setup_dist.py 2008-08-18 04:12:37 UTC (rev 694) +++ trunk/python-ogre/setup_dist.py 2008-08-18 08:33:08 UTC (rev 695) @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -# This is the distutils setup script for python-ogre. -# Full instructions are in "install.txt" or "install.html" -# -# To configure, compile, install, just run this script. - -DESCRIPTION = """Python-Ogre is a Python wrapper module for the -OGRE 3D Graphics library. It contains python functions and classes -that will allow you to fully utilitize the Ogre library. It is -Unique in that the python wrappers are created automatically by -Py++, hence making maintainence etc very simple. -This version is built against the Ogre CVS""" - -METADATA = { - "name": "Python-Ogre", - "version": "0.65 CVS", - "license": "LGPL", - "url": "http://python-ogre.python-hosting.com/", - "author": "Lakin Wecker, Roman Yakovenko, Andy", - "author_email": "pyt...@go...", - "description": "Py++ Ogre Python Binding: For CVS version of Ogre", - "long_description": DESCRIPTION, -} -from distutils.core import setup -import os, sys - -def GetFileList ( basepath ): - filesout = [] - for root, dirs, files in os.walk(basepath): - for name in files: - filesout.append(os.path.join(root, name)) - return filesout - -base = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]) ) -demofiles = GetFileList ( os.path.join (base, "demos") ) - -PACKAGEDATA = { - "packages": ['Ogre', 'OIS', 'CEGUI', 'OgreRefApp', 'OgreNewt'], - "package_dir": {'': 'packages'}, - "package_data": {'': ['*.pyd', '*.dll']}, -# "data_files": [(base+'Demos', demofiles),] - -} - -PACKAGEDATA.update(METADATA) -setup(**PACKAGEDATA) - - - \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mi...@us...> - 2008-08-18 08:56:34
|
Revision: 697 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=697&view=rev Author: mithro Date: 2008-08-18 08:56:44 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Fix up the way boost_python_index target is built. Modified Paths: -------------- trunk/python-ogre/boost/Makefile trunk/python-ogre/boost/debian/control trunk/python-ogre/environment.py Added Paths: ----------- trunk/python-ogre/boost/debian/dsc Modified: trunk/python-ogre/boost/Makefile =================================================================== --- trunk/python-ogre/boost/Makefile 2008-08-18 08:35:42 UTC (rev 696) +++ trunk/python-ogre/boost/Makefile 2008-08-18 08:56:44 UTC (rev 697) @@ -1,19 +1,43 @@ -export GCC_VERSION=`gcc --version | head -1 | sed -e's/.*) \([0-9]\)\.\([0-9]\).*/\1\2/'` -export PYTHON_VERSION=`python -V 2>&1 | sed -e's/Python \(2\.[45]\).*/\1/'` +PREFIX := '/usr' +GCC_VERSION=`gcc --version | head -1 | sed -e's/.*) \([0-9]\)\.\([0-9]\).*/\1\2/'` +PYTHON_VERSION=`python -V 2>&1 | sed -e's/Python \(2\.[45]\).*/\1/'` +MT_VERSION=`if [ x${MT} = True ]; then echo "mt-"; fi` +MT_FLAGS=`if [ x${MT} = True ]; then echo "-D_MT"; fi` +CXXFLAGS=-I. \ + -I/usr/include/python${PYTHON_VERSION} \ + -shared \ + -Wl,-soname,libboost_python_index-gcc${GCC_VERSION}-${BOOST_VERSION}.so \ + -o libboost_python_index-gcc${GCC_VERSION}-${BOOST_VERSION}.so -fPIC \ + -lboost_python-gcc${GCC_VERSION}-${MT_VERSION}${BOOST_VERSION} \ + -L${PREFIX}/lib/ \ + -lpython${PYTHON_VERSION} \ + $(MT_FLAGS) + + all: libs/python/src/indexing/indexing_slice.cpp libs/python/src/indexing/python_iterator.cpp - g++ $? \ - -I . \ - -I /usr/include/python${PYTHON_VERSION} \ - -shared -Wl,-soname,libboost_python_index-gcc${GCC_VERSION}-1_34_1.so -o libboost_python_index-gcc${GCC_VERSION}-1_34_1.so -fPIC \ - -lboost_python \ - -lpython${PYTHON_VERSION} + @make version + @echo "Current CXXFLAGS: ${CXXFLAGS}" + @echo "Running g++ ${CXXFLAGS} $?" + @g++ ${CXXFLAGS} $? +version: + @if [ x${BOOST_VERSION} = x ]; then \ + echo "You have not specified a BOOST_VERSION, please do so!"; \ + exit 1; \ + fi + install: + @make version mkdir -p ${PREFIX}/usr/lib - cp libboost_python_index-gcc${GCC_VERSION}-1_34_1.so ${PREFIX}/usr/lib - ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-1_34_1.so ${PREFIX}/usr/lib/libboost_python_index.so + if [ x${MT} = xTrue ]; then \ + cp libboost_python_index-gcc${GCC_VERSION}-mt-${BOOST_VERSION}.so ${PREFIX}/usr/lib; \ + ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-mt-${BOOST_VERSION}.so ${PREFIX}/usr/lib/libboost_python_index.so; \ + else \ + cp libboost_python_index-gcc${GCC_VERSION}-${BOOST_VERSION}.so ${PREFIX}/usr/lib; \ + ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-${BOOST_VERSION}.so ${PREFIX}/usr/lib/libboost_python_index.so; \ + fi mkdir -p ${PREFIX}/usr/include cp -rvf boost ${PREFIX}/usr/include @@ -22,4 +46,4 @@ clean: rm *.so -.PHONY: install clean +.PHONY: install clean version Modified: trunk/python-ogre/boost/debian/control =================================================================== --- trunk/python-ogre/boost/debian/control 2008-08-18 08:35:42 UTC (rev 696) +++ trunk/python-ogre/boost/debian/control 2008-08-18 08:56:44 UTC (rev 697) @@ -1,7 +1,7 @@ Source: boost-python1.34.1-index Priority: extra Maintainer: Tim Ansell <tim@unknown> -Build-Depends: debhelper (>= 5) +Build-Depends: debhelper (>= 5), libboost-python-dev (>= 1.34), libstdc++6-4.1-dev | libstdc++6-4.2-dev, python-dev Standards-Version: 3.7.2 Section: libs Added: trunk/python-ogre/boost/debian/dsc =================================================================== --- trunk/python-ogre/boost/debian/dsc (rev 0) +++ trunk/python-ogre/boost/debian/dsc 2008-08-18 08:56:44 UTC (rev 697) @@ -0,0 +1,10 @@ +Format: 1.0 +Source: boost-python1.34.1-index +Binary: libboost-python1.34.1-index-dev, libboost-python1.34.1-index +Architecture: any +Version: 0.0.0-1 +Maintainer: Tim 'Mithro' Ansell <mi...@mi...> +Standards-Version: 3.7.2 +%%BUILDDEPS%% +Files: + %%MD5SUM%% %%SIZE%% Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-18 08:35:42 UTC (rev 696) +++ trunk/python-ogre/environment.py 2008-08-18 08:56:44 UTC (rev 697) @@ -518,18 +518,19 @@ class boost_python_index: active = True - version = "1.34.1" + version = boost.base[6:] pythonModule = False ModuleName = "" - base = "libboost-python%s-index" % boost.base[6:].replace("_",".") + base = "libboost-python%s-index" % version.replace("_",".") if isLinux() or isMac(): + FLAGS = "PREFIX=%s BOOST_VERSION=%s" % (PREFIX, version) source = [ ["rm","-rf %s" % (base,), os.getcwd()], ["cp",'-rvf %s/ %s' % (os.path.join('python-ogre','boost'), base), os.getcwd()], ] buildCmds = [ - [0,'make all', os.path.join(os.getcwd(), base)], - [0,'PREFIX=%s make install' % PREFIX, os.path.join(os.getcwd(), base)], + [0,'make all %s' % FLAGS, os.path.join(os.getcwd(), base)], + [0,'make install %s' % FLAGS, os.path.join(os.getcwd(), base)], ] lib = boost.lib.replace("python", "python_index") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mi...@us...> - 2008-08-18 09:03:49
|
Revision: 698 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=698&view=rev Author: mithro Date: 2008-08-18 09:03:58 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Fix the MT version and make it the default. Modified Paths: -------------- trunk/python-ogre/boost/Makefile trunk/python-ogre/environment.py Modified: trunk/python-ogre/boost/Makefile =================================================================== --- trunk/python-ogre/boost/Makefile 2008-08-18 08:56:44 UTC (rev 697) +++ trunk/python-ogre/boost/Makefile 2008-08-18 09:03:58 UTC (rev 698) @@ -2,14 +2,14 @@ PREFIX := '/usr' GCC_VERSION=`gcc --version | head -1 | sed -e's/.*) \([0-9]\)\.\([0-9]\).*/\1\2/'` PYTHON_VERSION=`python -V 2>&1 | sed -e's/Python \(2\.[45]\).*/\1/'` -MT_VERSION=`if [ x${MT} = True ]; then echo "mt-"; fi` -MT_FLAGS=`if [ x${MT} = True ]; then echo "-D_MT"; fi` +MT_VERSION=`if [ x${MT} = xTrue ]; then echo "mt-"; fi` +MT_FLAGS=`if [ x${MT} = xTrue ]; then echo "-D_MT"; fi` CXXFLAGS=-I. \ -I/usr/include/python${PYTHON_VERSION} \ -shared \ -Wl,-soname,libboost_python_index-gcc${GCC_VERSION}-${BOOST_VERSION}.so \ - -o libboost_python_index-gcc${GCC_VERSION}-${BOOST_VERSION}.so -fPIC \ + -o libboost_python_index-gcc${GCC_VERSION}-${MT_VERSION}${BOOST_VERSION}.so -fPIC \ -lboost_python-gcc${GCC_VERSION}-${MT_VERSION}${BOOST_VERSION} \ -L${PREFIX}/lib/ \ -lpython${PYTHON_VERSION} \ @@ -31,13 +31,10 @@ install: @make version mkdir -p ${PREFIX}/usr/lib - if [ x${MT} = xTrue ]; then \ - cp libboost_python_index-gcc${GCC_VERSION}-mt-${BOOST_VERSION}.so ${PREFIX}/usr/lib; \ - ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-mt-${BOOST_VERSION}.so ${PREFIX}/usr/lib/libboost_python_index.so; \ - else \ - cp libboost_python_index-gcc${GCC_VERSION}-${BOOST_VERSION}.so ${PREFIX}/usr/lib; \ - ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-${BOOST_VERSION}.so ${PREFIX}/usr/lib/libboost_python_index.so; \ - fi + @echo cp libboost_python_index-gcc${GCC_VERSION}-${MT_VERSION}${BOOST_VERSION}.so ${PREFIX}/usr/lib + @cp libboost_python_index-gcc${GCC_VERSION}-${MT_VERSION}${BOOST_VERSION}.so ${PREFIX}/usr/lib + @echo ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-${MT_VERSION}${BOOST_VERSION}.so ${PREFIX}/usr/lib/libboost_python_index.so + @ln -sf /usr/lib/libboost_python_index-gcc${GCC_VERSION}-${MT_VERSION}${BOOST_VERSION}.so ${PREFIX}/usr/lib/libboost_python_index.so mkdir -p ${PREFIX}/usr/include cp -rvf boost ${PREFIX}/usr/include Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-18 08:56:44 UTC (rev 697) +++ trunk/python-ogre/environment.py 2008-08-18 09:03:58 UTC (rev 698) @@ -523,7 +523,7 @@ ModuleName = "" base = "libboost-python%s-index" % version.replace("_",".") if isLinux() or isMac(): - FLAGS = "PREFIX=%s BOOST_VERSION=%s" % (PREFIX, version) + FLAGS = "PREFIX=%s BOOST_VERSION=%s MT=True" % (PREFIX, version) source = [ ["rm","-rf %s" % (base,), os.getcwd()], ["cp",'-rvf %s/ %s' % (os.path.join('python-ogre','boost'), base), os.getcwd()], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mi...@us...> - 2008-08-20 10:01:10
|
Revision: 704 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=704&view=rev Author: mithro Date: 2008-08-20 10:01:18 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Make deb install both multithreaded and non-multithreaded versions. Fixed deb building when building against boost 1.35.1 (and other versions). Modified Paths: -------------- trunk/python-ogre/BuildModule.py trunk/python-ogre/boost/debian/control trunk/python-ogre/boost/debian/dsc trunk/python-ogre/boost/debian/rules trunk/python-ogre/environment.py Modified: trunk/python-ogre/BuildModule.py =================================================================== --- trunk/python-ogre/BuildModule.py 2008-08-20 09:59:34 UTC (rev 703) +++ trunk/python-ogre/BuildModule.py 2008-08-20 10:01:18 UTC (rev 704) @@ -179,12 +179,12 @@ exit("Was not able to copy the debian directory over") # Rewrite any place holders - ret = spawnTask( "sed --in-place "+debiandir+"/changelog -e \"s|%%SHORTDATE%%|`date +%Y%m%d`|\" -e \"s|%%LONGDATE%%|`date +'%a, %d %b %Y %H:%m:%S %z'`|\"", srcdir) - if ret != 0: - exit("Was not able to update the debian change log.") - ret = spawnTask( "sed --in-place "+debiandir+"/control -e \"s|%%SHORTDATE%%|`date +%Y%m%d`|\" -e \"s|%%LONGDATE%%|`date +'%a, %d %b %Y %H:%m:%S %z'`|\"", srcdir) - if ret != 0: - exit("Was not able to update the debian control file.") + for file in os.listdir(debiandir): + if not os.path.isfile(os.path.join(debiandir, file)): + continue + ret = spawnTask( "sed --in-place "+os.path.join(debiandir,file)+" -e\"s|%%SHORTDATE%%|`date +%Y%m%d`|\" -e\"s|%%LONGDATE%%|`date +'%a, %d %b %Y %H:%m:%S %z'`|\" -e\"s|%%VERSION%%|"+module.source_version+"|\"", srcdir) + if ret != 0: + exit("Was not able to update the debian change log.") # Check that all the dependencies for this package are avaliable c = StringIO() @@ -304,5 +304,3 @@ compileCode ( classList[ moduleName ] ) else: print ( "Module specificed does not need compiling (%s is a supporting module)" % moduleName ) - - Modified: trunk/python-ogre/boost/debian/control =================================================================== --- trunk/python-ogre/boost/debian/control 2008-08-20 09:59:34 UTC (rev 703) +++ trunk/python-ogre/boost/debian/control 2008-08-20 10:01:18 UTC (rev 704) @@ -1,20 +1,20 @@ -Source: boost-python1.34.1-index +Source: boost-python%%VERSION%%-index Priority: extra Maintainer: Tim Ansell <tim@unknown> -Build-Depends: debhelper (>= 5), libboost-python-dev (>= 1.34), libstdc++6-4.1-dev | libstdc++6-4.2-dev, python-dev +Build-Depends: debhelper (>= 5), libboost-python-dev (>= %%VERSION%%), libstdc++6-4.1-dev | libstdc++6-4.2-dev, python-dev Standards-Version: 3.7.2 Section: libs -Package: libboost-python1.34.1-index-dev +Package: libboost-python%%VERSION%%-index-dev Section: libdevel Architecture: any -Depends: libboost-python1.34.1-index (= ${Source-Version}) +Depends: libboost-python%%VERSION%%-index (= ${Source-Version}) Description: Extra index stuff for boost-python This package is the extra index stuff needed by python-ogre (and possibly others). It does not refer to a real upstream object, we expect this to go way once boost-python is updated. -Package: libboost-python1.34.1-index +Package: libboost-python%%VERSION%%-index Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Modified: trunk/python-ogre/boost/debian/dsc =================================================================== --- trunk/python-ogre/boost/debian/dsc 2008-08-20 09:59:34 UTC (rev 703) +++ trunk/python-ogre/boost/debian/dsc 2008-08-20 10:01:18 UTC (rev 704) @@ -1,6 +1,6 @@ Format: 1.0 -Source: boost-python1.34.1-index -Binary: libboost-python1.34.1-index-dev, libboost-python1.34.1-index +Source: boost-python%%VERSION%%-index +Binary: libboost-python%%VERSION%%-index-dev, libboost-python%%VERSION%%-index Architecture: any Version: 0.0.0-1 Maintainer: Tim 'Mithro' Ansell <mi...@mi...> Modified: trunk/python-ogre/boost/debian/rules =================================================================== --- trunk/python-ogre/boost/debian/rules 2008-08-20 09:59:34 UTC (rev 703) +++ trunk/python-ogre/boost/debian/rules 2008-08-20 10:01:18 UTC (rev 704) @@ -11,6 +11,7 @@ export DH_COMPAT=2 export GCC_VERSION=`gcc --version | head -1 | sed -e's/.*) \([0-9]\)\.\([0-9]\).*/\1\2/'` export PYTHON_VERSION=`python -V 2>&1 | sed -e's/Python \(2\.[45]\).*/\1/'` +export BOOST_VERSION=`echo %%VERSION%% | sed -e's/\./_/g'` # shared library versions, option 1 #version=2.0.5 @@ -33,6 +34,7 @@ dh_testdir make all + make all MT=True touch $@ @@ -53,7 +55,8 @@ dh_installdirs # Add here commands to install the package into debian/tmp - PREFIX=$(CURDIR)/debian/tmp make install + make install PREFIX=$(CURDIR)/debian/tmp + make install PREFIX=$(CURDIR)/debian/tmp MT=True # Build architecture-independent files here. binary-indep: build install @@ -67,8 +70,8 @@ dh_installdocs dh_installexamples - dh_movefiles -plibboost-python1.34.1-index-dev /usr/include/boost - dh_movefiles -plibboost-python1.34.1-index /usr/lib + dh_movefiles -plibboost-python%%VERSION%%-index-dev /usr/include/boost + dh_movefiles -plibboost-python%%VERSION%%-index /usr/lib # dh_install # dh_installmenu Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-20 09:59:34 UTC (rev 703) +++ trunk/python-ogre/environment.py 2008-08-20 10:01:18 UTC (rev 704) @@ -304,10 +304,12 @@ active = True base = 'pyplusplus' if _STABLE: + source_version = "1300" source = [ [svn, " co -r 1300 http://pygccxml.svn.sourceforge.net/svnroot/pygccxml/pyplusplus_dev "+base, os.getcwd()] ] else: + source_version = "1362" source = [ [svn, " co -r 1362 http://pygccxml.svn.sourceforge.net/svnroot/pygccxml/pyplusplus_dev "+base, os.getcwd()] ] @@ -518,12 +520,12 @@ class boost_python_index: active = True - version = boost.base[6:] + source_version = boost.base[6:].replace("_",".") pythonModule = False ModuleName = "" - base = "libboost-python%s-index" % version.replace("_",".") + base = "libboost-python%s-index" % source_version #.replace(".", "_") if isLinux() or isMac(): - FLAGS = "PREFIX=%s BOOST_VERSION=%s MT=True" % (PREFIX, version) + FLAGS = "PREFIX=%s BOOST_VERSION=%s MT=True" % (PREFIX, source_version) source = [ ["rm","-rf %s" % (base,), os.getcwd()], ["cp",'-rvf %s/ %s' % (os.path.join('python-ogre','boost'), base), os.getcwd()], @@ -1766,4 +1768,3 @@ cls.PydName = cls.PydName + '.so' elif os.name =='mac': print "WARNING - check the last line of environment.py!!" - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-08-22 08:22:52
|
Revision: 710 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=710&view=rev Author: andy_miller Date: 2008-08-22 08:23:01 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Update to Ogre code based upon Py++ improvements bullet support for 2.70 Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/code_generators/bullet/generate_code.py trunk/python-ogre/code_generators/bullet/python_bullet_aliases.h trunk/python-ogre/code_generators/ogre/generate_code.py trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py trunk/python-ogre/demos/bullet/test01.py trunk/python-ogre/environment.py Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-21 02:26:07 UTC (rev 709) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-22 08:23:01 UTC (rev 710) @@ -74,7 +74,7 @@ PATH_opensteer = os.path.join(BASE_DIR, 'opensteer', 'trunk') PATH_ogrevideoffmpeg = os.path.join(PATH_THIRDPARTY,'ffmpeg') -PATH_Bullet= os.path.join(BASE_DIR, 'bullet-2.69') +PATH_Bullet= os.path.join(BASE_DIR, 'bullet-2.70') PATH_PhysX= "c:/program files/NVIDIA Corporation/NVIDIA Physx SDK/v2.8.1/SDKs" PATH_Theora= os.path.join(PATH_OgreAddons,'videoplugin','TheoraVideo') PATH_ffmpeg= os.path.join(PATH_THIRDPARTY,'extra') Modified: trunk/python-ogre/code_generators/bullet/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/bullet/generate_code.py 2008-08-21 02:26:07 UTC (rev 709) +++ trunk/python-ogre/code_generators/bullet/generate_code.py 2008-08-22 08:23:01 UTC (rev 710) @@ -94,6 +94,7 @@ ,'::btAxisSweep3Internal<unsigned short>::processAllOverlappingPairs' ,'::btMultiSapBroadphase::createProxy' ,'::btMultiSapBroadphase::quicksort' + ,'::btBvhTriangleMeshShape::setOptimizedBvh' # new in 2.70 ] @@ -114,7 +115,7 @@ ,'btAlignedAllocator<btRaycastVehicle*, 16u>' ,'btAlignedAllocator<btBroadphaseInterface*, 16u>' - ,'btAlignedAllocator<btDbvt::Node const*, 16u>' + ,'btAlignedAllocator<btDbvtNode const*, 16u>' # ,'btAlignedObjectArray<short>' # ,'btAlignedAllocator<btDbvt::sStkNN, 16u>' # ,'btAlignedAllocator<btDbvt::sStkNP, 16u>' @@ -126,7 +127,8 @@ # ,'btAlignedAllocator<btOdeSolverBody, 16u>' ,'btAlignedAllocator<btOdeSolverBody*, 16u>' # ,'btAlignedAllocator<btOdeTypedJoint, 16u>' - ,'btAlignedAllocator<short, 16u>' + ,'btAlignedAllocator<unsigned int, 16u>' + ,'btAlignedAllocator<unsigned short, 16u>' # ,'btAlignedObjectArray<btDbvt::Node const*>' # ,'btAlignedObjectArray<btDbvt::sStkNN>' # ,'btAlignedObjectArray<btDbvt::sStkNP>' @@ -197,6 +199,12 @@ for a in c.arguments: if a.default_value and "&0.0" in a.default_value: a.default_value = "::btVector3( (0.0), (0.0), (0.0) )" + + ## Bug ingccxml where it doesn't get the namespace for default values + ## btCollisionWorld::addCollisionObject + f=main_ns.class_('btCollisionWorld').mem_fun('addCollisionObject') + f.arguments[1].default_value = 'btBroadphaseProxy::DefaultFilter' # (short int)(btBroadphaseProxy::DefaultFilter) + f.arguments[2].default_value = 'btBroadphaseProxy::AllFilter' # (short int)(btBroadphaseProxy::AllFilter) ############################################################ ## Modified: trunk/python-ogre/code_generators/bullet/python_bullet_aliases.h =================================================================== --- trunk/python-ogre/code_generators/bullet/python_bullet_aliases.h 2008-08-21 02:26:07 UTC (rev 709) +++ trunk/python-ogre/code_generators/bullet/python_bullet_aliases.h 2008-08-22 08:23:01 UTC (rev 710) @@ -25,7 +25,7 @@ typedef btAlignedAllocator<btBroadphaseInterface*, 16> BroadphaseInterfacePtr16; // new changes -typedef btAlignedAllocator<btDbvt::Node const*, 16u> AlignedAllocatorDbvtNode; +typedef btAlignedAllocator<btDbvtNode const*, 16u> AlignedAllocatorDbvtNode; typedef btAlignedObjectArray<short> AlignedObjectArrayShort; typedef btAlignedAllocator<btDbvt::sStkNN, 16u> AlignedAllocatorsStkNN; typedef btAlignedAllocator<btDbvt::sStkNP, 16u> AlignedAllocatorsStkNP; @@ -38,7 +38,7 @@ typedef btAlignedAllocator<btOdeSolverBody*, 16u> AlignedAllocatorOdeSolverBodyPtr; typedef btAlignedAllocator<btOdeTypedJoint, 16u> AlignedAllocatorOdeTypedJoint; typedef btAlignedAllocator<short, 16u> AlignedAllocatorShort16; -typedef btAlignedObjectArray<btDbvt::Node const*> AlignedObjectArrayDbvtNode; +typedef btAlignedObjectArray<btDbvtNode const*> AlignedObjectArrayDbvtNode; typedef btAlignedObjectArray<btDbvt::sStkNN> AlignedObjectArrayDbvtsStkNN; typedef btAlignedObjectArray<btDbvt::sStkNP> AlignedObjectArrayDbvtsStkNP; typedef btAlignedObjectArray<btDbvt::sStkNPS> AlignedObjectArrayDbvtsStkNPS; Modified: trunk/python-ogre/code_generators/ogre/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogre/generate_code.py 2008-08-21 02:26:07 UTC (rev 709) +++ trunk/python-ogre/code_generators/ogre/generate_code.py 2008-08-22 08:23:01 UTC (rev 710) @@ -764,7 +764,11 @@ def Fix_NT ( mb ): """ fixup for NT systems """ - mb.global_ns.class_( 'vector<Ogre::Vector4, std::allocator<Ogre::Vector4> >' ).exclude( ) + try: + # change in py++ so this doesn't get found? + mb.global_ns.class_( 'vector<Ogre::Vector4, std::allocator<Ogre::Vector4> >' ).exclude( ) + except: + pass Skeleton = mb.namespace( MAIN_NAMESPACE ).class_( 'Skeleton' ).constructors().exclude() ## handle the hashmaps -- TODO FIX under LINUX ??? Modified: trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py =================================================================== --- trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py 2008-08-21 02:26:07 UTC (rev 709) +++ trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py 2008-08-22 08:23:01 UTC (rev 710) @@ -887,7 +887,19 @@ Input: None\\n\\ Ouput: List containing particles" );""" ] - + +# ################################################################################################# +# WRAPPER_DEFINITION_Vector3 =\ +# """ +# int Vector3_len( Ogre::Vector3 & me ) { +# return 3; +# } +# """ +# WRAPPER_REGISTRATION_Vector3 = [ +# """def( "__len__", &Vector3_len, +# "Python-Ogre Helper Function: return length of Vector3");""", +# ] +# ################################################################################################# def iter_as_generator_vector( cls ): @@ -928,6 +940,10 @@ rt.add_declaration_code( WRAPPER_DEFINITION_RenderTarget ) apply_reg (rt, WRAPPER_REGISTRATION_RenderTarget ) +# rt = mb.class_( 'Vector3' ) +# rt.add_declaration_code( WRAPPER_DEFINITION_Vector3 ) +# apply_reg (rt, WRAPPER_REGISTRATION_Vector3 ) + rt = mb.class_( 'ResourceManager' ) rt.add_declaration_code( WRAPPER_DEFINITION_ResourceManager ) apply_reg (rt, WRAPPER_REGISTRATION_ResourceManager ) Modified: trunk/python-ogre/demos/bullet/test01.py =================================================================== --- trunk/python-ogre/demos/bullet/test01.py 2008-08-21 02:26:07 UTC (rev 709) +++ trunk/python-ogre/demos/bullet/test01.py 2008-08-22 08:23:01 UTC (rev 710) @@ -22,13 +22,18 @@ solver = bullet.btSequentialImpulseConstraintSolver() -world = bullet.btDiscreteDynamicsWorld(dispatcher, broadphase , solver) +world = bullet.btDiscreteDynamicsWorld(dispatcher, broadphase , solver, collisionConfiguration) world.getDispatchInfo().m_enableSPU = True world.setGravity(bullet.btVector3(0,-10,0)) print world +print dir(world) print solver print broadphase print dispatcher print collisionConfiguration - +for x in range (30): + world.stepSimulation( x * 1/30) + +world.stepSimulation(0) +world.stepSimulation(-0.333) Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-21 02:26:07 UTC (rev 709) +++ trunk/python-ogre/environment.py 2008-08-22 08:23:01 UTC (rev 710) @@ -1426,7 +1426,7 @@ class bullet: active = True pythonModule = True - version= "2.69" + version= "2.70" name='bullet' base = "bullet-" + version baseDir = os.path.join(os.getcwd(), base) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-08-22 10:45:16
|
Revision: 711 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=711&view=rev Author: andy_miller Date: 2008-08-22 10:45:22 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Fix to OgreBullet due to api change in bullet 2.70 Fixed compiler options as extra command ignored on windows Modified Paths: -------------- trunk/python-ogre/BuildModule.py trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsRay.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.h trunk/python-ogre/demos/bullet/test01.py trunk/python-ogre/environment.py Modified: trunk/python-ogre/BuildModule.py =================================================================== --- trunk/python-ogre/BuildModule.py 2008-08-22 08:23:01 UTC (rev 710) +++ trunk/python-ogre/BuildModule.py 2008-08-22 10:45:22 UTC (rev 711) @@ -83,7 +83,11 @@ for FLAGS in "CFLAGS", "CXXFLAGS", "CCFLAGS", "LDFLAGS": if not FLAGS in env: env[FLAGS] = "" - env["CFLAGS"]+=" "+"-I"+os.path.join(PREFIX,"include")+ " -L"+os.path.join(PREFIX,"lib") + if environment.isWindows(): + env["CFLAGS"]+=" "+"-I"+os.path.join(PREFIX,"include") + else: + env["CFLAGS"]+=" "+"-I"+os.path.join(PREFIX,"include")+ " -L"+os.path.join(PREFIX,"lib") + env["CXXFLAGS"]+=" "+env["CFLAGS"] env["CCFLAGS"]+=" "+env["CFLAGS"] env["LDFLAGS"]+="-Wl,-rpath='$$ORIGIN/../../lib' -Wl,-rpath='$$ORIGIN' -Wl,-z,origin" Modified: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsRay.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsRay.cpp 2008-08-22 08:23:01 UTC (rev 710) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsRay.cpp 2008-08-22 10:45:22 UTC (rev 711) @@ -75,7 +75,7 @@ // ------------------------------------------------------------------------- bool CollisionRayResultCallback::doesCollide() const { - return mRayResultCallback->HasHit(); + return mRayResultCallback->hasHit(); } // ------------------------------------------------------------------------- Object *CollisionClosestRayResultCallback::getCollidedObject () const Modified: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.cpp =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.cpp 2008-08-22 08:23:01 UTC (rev 710) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.cpp 2008-08-22 10:45:22 UTC (rev 711) @@ -213,13 +213,12 @@ } // ------------------------------------------------------------------------- - void CollisionsWorld::launchRay(CollisionRayResultCallback &rayresult, short int collisionFilterMask) + void CollisionsWorld::launchRay(CollisionRayResultCallback &rayresult) { mWorld->rayTest( OgreBtConverter::to(rayresult.getRayStartPoint()), OgreBtConverter::to(rayresult.getRayEndPoint()), - *rayresult.getBulletRay (), - collisionFilterMask); + *rayresult.getBulletRay ()); } } Modified: trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.h =================================================================== --- trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.h 2008-08-22 08:23:01 UTC (rev 710) +++ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.h 2008-08-22 10:45:22 UTC (rev 711) @@ -64,7 +64,7 @@ Ogre::SceneManager *getSceneManager() const {return mScnMgr;} btCollisionWorld *getBulletCollisionWorld() const {return mWorld;} - void launchRay (CollisionRayResultCallback &ray, short int collisionFilterMask = -1); + void launchRay (CollisionRayResultCallback &ray); protected: btCollisionWorld* mWorld; Modified: trunk/python-ogre/demos/bullet/test01.py =================================================================== --- trunk/python-ogre/demos/bullet/test01.py 2008-08-22 08:23:01 UTC (rev 710) +++ trunk/python-ogre/demos/bullet/test01.py 2008-08-22 10:45:22 UTC (rev 711) @@ -2,7 +2,7 @@ sys.path.insert(0,'..') import PythonOgreConfig -import ogre.renderer.OGRE +import ogre.renderer.OGRE as ogre import ogre.physics.bullet as bullet t = bullet.btTransform() ms = bullet.btDefaultMotionState (t) @@ -37,3 +37,21 @@ world.stepSimulation(0) world.stepSimulation(-0.333) + + +class OgreMotionState(bullet.btMotionState): + def __init__(self, initalPosition): + bullet.btMotionState.__init__(self) + self.Pos=initalPosition + self.Position=ogre.Vector3() + self.Quaternion=ogre.Quaternion() + def getWorldTransform(self, WorldTrans): + worldTrans=self.Pos + def setWorldTransform(WorldTrans): + self.Position=ogre.Vector3(WorldTrans.getOrigin().x(),WorldTrans.getOrigin().y(),WorldTrans.getOrigin().z()) + self.Quaternion=ogre.Quaternion(WorldTrans.getRoation().w(),WorldTrans.getRoation().x(),WorldTrans.getRoation().y(),WorldTrans.getRoation().z()) + +shape=bullet.btCapsuleShape(10, 20) +motionState=OgreMotionState(bullet.btTransform()) +Object=bullet.btRigidBody(10.0, motionState, shape) # ...this should work in my eyes +#Object=bullet.btRigidBody(bullet.btRigidBodyConstructionInfo()) ...well obviously not in bullet 2.6.9 \ No newline at end of file Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-22 08:23:01 UTC (rev 710) +++ trunk/python-ogre/environment.py 2008-08-22 10:45:22 UTC (rev 711) @@ -1472,7 +1472,7 @@ libs = [boost.lib, 'OgreMain', 'LibBulletCollision', 'LibBulletDynamics' ] - if os.name == 'nt': + if isWindows(): libs.append('LibBulletMath') include_dirs = [Config.PATH_Boost , Config.PATH_INCLUDE_Bullet @@ -1484,7 +1484,7 @@ ,Config.PATH_LIB_Bullet , Config.PATH_LIB_Ogre_OgreMain ] - if os.name=="nt": + if isWindows(): CCFLAGS = ' -DWIN32 -DNDEBUG -D_WINDOWS -D_PRECOMP ' else: CCFLAGS = ' -D_PRECOMP ' @@ -1501,7 +1501,7 @@ libs = [boost.lib, 'OgreMain', 'LibBulletCollision', 'LibBulletDynamics' ] - if os.name == 'nt': + if isWindows(): libs.append('LibBulletMath') include_dirs = [Config.PATH_Boost , Config.PATH_INCLUDE_Bullet @@ -1514,7 +1514,7 @@ ,Config.PATH_LIB_Bullet , Config.PATH_LIB_Ogre_OgreMain ] - if os.name=="nt": + if isWindows(): CCFLAGS = ' -DWIN32 -DNDEBUG -D_WINDOWS -D_PRECOMP ' else: CCFLAGS = ' -D_PRECOMP ' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2008-08-31 01:29:08
|
Revision: 713 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=713&view=rev Author: andy_miller Date: 2008-08-31 01:29:13 +0000 (Sun, 31 Aug 2008) Log Message: ----------- Updates ready for next release (1.6 RC1) Fix to QuickGui due to OGRE api change (_setAlphaRejects) Depreciated Dshow and FFMPEG modules Disabled Navi module (issue with MSVC runtimes) Support for hikari module Modified Paths: -------------- trunk/python-ogre/ChangeLog.txt trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/PythonOgreConfig_posix.py trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp trunk/python-ogre/code_generators/ogre/generate_code.py trunk/python-ogre/demos/bullet/test01.py trunk/python-ogre/environment.py trunk/python-ogre/patch/ogre_1.6.patch trunk/python-ogre/scripts/compilesource.bat trunk/python-ogre/setup.py Added Paths: ----------- trunk/python-ogre/packages_2.5/ogre/gui/hikari/ trunk/python-ogre/packages_2.5/ogre/gui/hikari/__init__.py Modified: trunk/python-ogre/ChangeLog.txt =================================================================== --- trunk/python-ogre/ChangeLog.txt 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/ChangeLog.txt 2008-08-31 01:29:13 UTC (rev 713) @@ -1,10 +1,23 @@ -???? ?? 2008 : SVN Updates.. -============================ -Added CEGUI::Tree to handmadewrapper (Thanks Dermont) -Change to CEGUI_framework.py to force loading of CEGUIBase lib in the correct mode under Linux - means we don't need to -patch the CEGUI source... - - +August 29 2008 : Release 1.6 RC1 +================================ +Version numbering change to match the Ogre release versions. +Ogre 1.6 RC1 +OIS 1.2 +CEGUI 0.6.1 +Particle Universe 0.8 +Hydrax 0.3 +Bullet 2.70 +OgreBullet - patched to match API change in Bullet 2.7 +PhysX (NVIDA) 2.8.1 +ODE 0.10.1 +QuickGui R350 +OgreAL R115 + +Added CEGUI::Tree to handmadewrapper (Thanks Dermont) +Change to CEGUI_framework.py to force loading of CEGUIBase lib in the correct mode under Linux - means we don't need to +patch the CEGUI source... + + June 20 2008: Release 1.2 RC2 =============================' OK, so it's been a while -- what can I say, I have to live in the real world as well as the opensource one :) Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-08-31 01:29:13 UTC (rev 713) @@ -13,16 +13,14 @@ ## path to the root of your boost dir, should have 'libs', 'boost' subdirectories -# # # # # # PATH_Boost = os.path.join(BASE_DIR, 'boost_1_34_1') -# PATH_Boost = os.path.join(BASE_DIR, 'boost_1_35_0') -PATH_Boost = os.path.join(BASE_DIR, 'boost-trunk') +PATH_Boost = os.path.join(BASE_DIR, 'boost_1_36_0' ) #-trunk') ## Path to your boost_pythonxxxx lib file -# PATH_LIB_Boost = os.path.join(BASE_DIR, PATH_Boost,'bin.v2/libs/python/build/msvc-8.0/release/threading-multi') -# # # # # # # PATH_LIB_Boost = os.path.join(PATH_Boost, 'bin.v2/libs/python/build/msvc/release/threading-multi') PATH_LIB_Boost = os.path.join(PATH_Boost, 'bin.v2/libs/python/build/msvc-9.0/release/threading-multi') + ## and the name of the boost python library -LIB_Boost = r'boost_python-vc90-mt-1_36' +## now part of class boos tin environtment.py +# LIB_Boost = r'boost_python-vc90-mt-1_37' # # LIB_Boost = r'boost_python-vc80-mt-1_34_1' # LIB_Boost = r'boost_python-vc-mt-1_35' @@ -84,6 +82,7 @@ PATH_ogrepcz = os.path.join(PATH_Ogre, 'PlugIns', 'PCZSceneManager' ) PATH_hydrax = os.path.join(PATH_THIRDPARTY, 'hydrax') +PATH_hikari = os.path.join(BASE_DIR, 'hikari', 'hikari') # it's time for the SDK version if SDK: @@ -130,6 +129,7 @@ PATH_LIB_CEGUI = os.path.join( PATH_Ogre, 'lib' ) PATH_LIB_opensteer = os.path.join(PATH_opensteer, 'win32','release') +PATH_LIB_hikari = os.path.join(PATH_hikari, 'lib') PATH_INCLUDE_Ogre= os.path.join(PATH_Ogre,'OgreMain/include') @@ -179,6 +179,7 @@ PATH_INCLUDE_particleuniverse = os.path.join(PATH_particleuniverse, 'include' ) PATH_INCLUDE_ogrepcz = os.path.join(PATH_ogrepcz,'include') PATH_INCLUDE_hydrax= PATH_hydrax +PATH_INCLUDE_hikari = os.path.join(PATH_hikari, 'include') PATH_INCLUDE_OggVorbisTheora = [ os.path.join(BASE_DIR,'ogg','include') ,os.path.join(BASE_DIR, 'vorbis', 'include') Modified: trunk/python-ogre/PythonOgreConfig_posix.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_posix.py 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/PythonOgreConfig_posix.py 2008-08-31 01:29:13 UTC (rev 713) @@ -80,6 +80,7 @@ PATH_opensteer = os.path.join(BASE_DIR, 'opensteer', 'trunk') PATH_ogrepcz = os.path.join(PATH_Ogre, 'PlugIns', 'PCZSceneManager' ) PATH_hydrax = os.path.join(PATH_THIRDPARTY, 'hydrax') +PATH_hikari = os.path.join(BASE_DIR, 'hikari', 'hikari') ### ### these paths assume you've left all the directory structure as standard @@ -118,8 +119,7 @@ PATH_LIB_navi= os.path.join(PATH_navi, 'lib') PATH_LIB_particleuniverse = os.path.join(PATH_particleuniverse, 'bin', 'release') PATH_LIB_opensteer = os.path.join(LOCAL_LIB) -PATH_INCLUDE_ogrepcz = os.path.join(PATH_ogrepcz,'include') -PATH_INCLUDE_hydrax= PATH_hydrax +PATH_LIB_hikari = os.path.join(PATH_hikari, 'lib') PATH_INCLUDE_Ogre= os.path.join(LOCAL_INCLUDE,'OGRE') # os.path.join(PATH_Ogre,'OgreMain/include') PATH_INCLUDE_Ogre_Dependencies = PATH_INCLUDE_Ogre # os.path.join( PATH_Ogre, 'Dependencies/include') @@ -188,3 +188,7 @@ ] PATH_INCLUDE_opensteer = os.path.join(LOCAL_INCLUDE, 'OpenSteer') PATH_INCLUDE_opensteer_opensteer = os.path.join(LOCAL_INCLUDE, 'OpenSteer') +PATH_INCLUDE_ogrepcz = os.path.join(PATH_ogrepcz,'include') +PATH_INCLUDE_hydrax= PATH_hydrax +PATH_INCLUDE_hikari = os.path.join(PATH_hikari, 'include') + Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp 2008-08-31 01:29:13 UTC (rev 713) @@ -122,7 +122,7 @@ mRenderSystem->_setTextureUnitFiltering(0, Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_POINT); mRenderSystem->_setTextureAddressingMode(0, mTextureAddressMode); mRenderSystem->_setTextureMatrix(0, Ogre::Matrix4::IDENTITY); - mRenderSystem->_setAlphaRejectSettings(Ogre::CMPF_ALWAYS_PASS, 0); + mRenderSystem->_setAlphaRejectSettings(Ogre::CMPF_ALWAYS_PASS, 0, false); mRenderSystem->_setTextureBlendMode(0, mColorBlendMode); mRenderSystem->_setTextureBlendMode(0, mAlphaBlendMode); mRenderSystem->_disableTextureUnitsFrom(1); Modified: trunk/python-ogre/code_generators/ogre/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogre/generate_code.py 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/code_generators/ogre/generate_code.py 2008-08-31 01:29:13 UTC (rev 713) @@ -238,8 +238,8 @@ main_ns.class_(c).noncopyable = True - # changes for Ogre 1.7 - if environment.ogre.version =="1.7": + # changes for Ogre 1.6 and on + if environment.ogre.version =="1.7" or environment.ogre.version =="1.6": # main_ns.class_("ResourceBackgroundQueue").exclude() # Ogre::ResourceBackgroundQueue::_fireBackgroundLoadingComplete isn't implemented main_ns.class_("ResourceGroupManager").mem_fun("_notifyWorldGeometryPrepareStageEnded").exclude() main_ns.class_("ResourceGroupManager").mem_fun("_notifyWorldGeometryPrepareStageStarted").exclude() Modified: trunk/python-ogre/demos/bullet/test01.py =================================================================== --- trunk/python-ogre/demos/bullet/test01.py 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/demos/bullet/test01.py 2008-08-31 01:29:13 UTC (rev 713) @@ -45,13 +45,34 @@ self.Pos=initalPosition self.Position=ogre.Vector3() self.Quaternion=ogre.Quaternion() + def getWorldTransform(self, WorldTrans): - worldTrans=self.Pos - def setWorldTransform(WorldTrans): + print WorldTrans + print WorldTrans.Rotation.x(),WorldTrans.Rotation.y(),WorldTrans.Rotation.z() + print self.Pos.getOrigin() + WorldTrans.setOrigin(self.Pos.getOrigin()) + WorldTrans.setBasis(self.Pos.getBasis()) + + print WorldTrans.Rotation.x(),WorldTrans.Rotation.y(),WorldTrans.Rotation.z() + print WorldTrans + print "Pos", self.Pos + t=self.Pos + print "T", t + t.setOrigin(WorldTrans.getOrigin()) + print "T1", t + + + + + def setWorldTransform(WorldTrans): + print "setWorldTrans", WorldTrans self.Position=ogre.Vector3(WorldTrans.getOrigin().x(),WorldTrans.getOrigin().y(),WorldTrans.getOrigin().z()) self.Quaternion=ogre.Quaternion(WorldTrans.getRoation().w(),WorldTrans.getRoation().x(),WorldTrans.getRoation().y(),WorldTrans.getRoation().z()) + print "setWorldTrans", WorldTrans shape=bullet.btCapsuleShape(10, 20) -motionState=OgreMotionState(bullet.btTransform()) +print "Creating motionState" +motionState=OgreMotionState(bullet.btTransform(bullet.btMatrix3x3(1.0,1.0,1.0,-1.0,-1.0,-1.0,2,-2,-1))) Object=bullet.btRigidBody(10.0, motionState, shape) # ...this should work in my eyes + #Object=bullet.btRigidBody(bullet.btRigidBodyConstructionInfo()) ...well obviously not in bullet 2.6.9 \ No newline at end of file Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/environment.py 2008-08-31 01:29:13 UTC (rev 713) @@ -452,13 +452,13 @@ version = "3.5" pythonModule = False ModuleName = "" - # AJM Changed so stable is 1.35 as this seems fine.... + if _STABLE: - base = 'boost_1_34_1' - lib= 'boost_python-vc90-mt-1_34_1' + base = 'boost_1_36_0' + lib= 'boost_python-vc90-mt-1_36' else: - base = 'boost_1_35_0' - lib = 'boost_python-vc90-mt-1_36' + base = 'boost_1_37' + lib = 'boost_python-vc90-mt-1_37' if isLinux() or isMac(): bjambase = 'boost-jam-3.1.16' @@ -506,7 +506,7 @@ [0,'sed -i s/"BOOST_PYTHON_MAX_ARITY 15"/"BOOST_PYTHON_MAX_ARITY 19"/ '+base+'/boost/python/detail/preprocessor.hpp', ''], [0,'sed -i s/"# include <boost\/preprocessor\/cat.hpp>"/"\\n#define BOOST_PYTHON_NO_PY_SIGNATURES\\n# include <boost\/preprocessor\/cat.hpp>"/ '+base+'/boost/python/detail/preprocessor.hpp', '' ], [0,'sed -i s/BJAM_CONFIG=\"\"/BJAM_CONFIG=release/ '+base+'/boost/python/detail/preprocessor.hpp', '' ], - [0,os.path.join(os.getcwd(), bjambase, "bjam.exe") + ' release --with-python --toolset=msvc-8',os.path.join(os.getcwd(),base)] + [0,os.path.join(os.getcwd(), bjambase, "bjam.exe") + ' release --with-python ',os.path.join(os.getcwd(),base)] # --toolset=msvc-8 ] if not isWindows(): # Figure out the gcc version we are running - this is needed by Boost @@ -547,7 +547,7 @@ active = True pythonModule = True if _STABLE: - version="1.4" + version="1.6" else: version = "1.7" name='ogre' @@ -562,16 +562,29 @@ if isWindows(): - source = [ - [ wget, "http://downloads.sourceforge.net/ogre/OgreDependencies_VC8SP1_Eihort_20071227.zip", downloadPath], - [ wget, "http://downloads.sourceforge.net/ogre/ogre-win32-v1-4-9.zip", downloadPath], - ] - buildCmds = [ - [0, unzip + os.path.join(downloadPath,"ogre-win32-v1-4-9.zip"),os.getcwd() ], - [0, unzip + os.path.join(downloadPath,"OgreDependencies_VC8SP1_Eihort_20071227.zip"), - os.path.join(os.getcwd(), 'ogrenew') ], - [0, "patch -s -N -i ./python-ogre/patch/ogre.patch -p0 ", os.getcwd()] - ] + if _STABLE: + source = [ + [ wget, "http://downloads.sourceforge.net/ogre/OgreDependencies_VC9_Eihort_20080203.zip", downloadPath], + [ wget, "http://downloads.sourceforge.net/ogre/ogre-v1-6-0RC1.zip", downloadPath], + ] + buildCmds = [ + [0, unzip + os.path.join(downloadPath,"ogre-v1-6-0RC1.zip"),os.getcwd() ], + [0, unzip + os.path.join(downloadPath,"OgreDependencies_VC9_Eihort_20080203.zip"), + os.path.join(os.getcwd(), 'ogre') ], + [0, "patch -s -N -i ./python-ogre/patch/ogre_1.6.patch -p0 ", os.getcwd()], + [0,'echo Please use MSVC Express Edition to build Ogre Release.',''] + ] + else: + source = [ + [ wget, "http://downloads.sourceforge.net/ogre/OgreDependencies_VC9_Eihort_20080203.zip", downloadPath], + [ svn, "https://svn.ogre3d.org/svnroot/ogre/branches/v1-6", os.path.join(os.getcwd(), 'ogre')] + ] + buildCmds = [ + [0, unzip + os.path.join(downloadPath,"OgreDependencies_VC9_Eihort_20080203.zip"), + os.path.join(os.getcwd(), 'ogre') ], + [0, "patch -s -N -i ./python-ogre/patch/ogre_1.6.patch -p0 ", os.getcwd()], + [0,'echo Please use MSVC Express Edition to build Ogre Release.',''] + ] # requirements to build a precompiled header on the fly if _PreCompiled: @@ -591,7 +604,7 @@ ] CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19 ' LINKFLAGS = '' - externalFiles=['OgreMain.dll', 'OgreGuiRender.dll', Config.LIB_Boost+'.dll'] + externalFiles=['OgreMain.dll', 'OgreGuiRender.dll', boost.lib+'.dll'] elif isLinux(): version = "1.4" #### UGLY OVERRIDE AT MOMENT... libs=[boost.lib, 'OgreMain' ] #, 'OgreGUIRenderer', 'CEGUIBase'] @@ -1351,7 +1364,7 @@ class ogrevideoffmpeg: - active = True + active = False pythonModule = True version="0.2.1" name='ogrevideoffmpeg' @@ -1378,7 +1391,7 @@ ModuleName="ogrevideoffmpeg" class ogredshow: - active = True + active = False pythonModule = True version="0.1" name='ogredshow' @@ -1646,7 +1659,26 @@ CheckIncludes=[] libs=[ boost.lib, 'OgreMain' ] ModuleName="hydrax" - + +class hikari: + active = True + pythonModule = True + version="0.22" + name='hikari' + parent="ogre/gui" + cflags = "" + include_dirs = [ Config.PATH_Boost, + Config.PATH_INCLUDE_hikari + , Config.PATH_INCLUDE_Ogre + ] + lib_dirs = [Config.PATH_LIB_Boost, + Config.PATH_LIB_Ogre_OgreMain, + Config.PATH_LIB_hikari + ] + CheckIncludes=[] + libs=[ boost.lib, 'OgreMain', 'hikari' ] + ModuleName="hikari" + ############################################################################################ ## Here is the master list.... @@ -1684,9 +1716,10 @@ , 'ofusion' : ofusion , 'particleuniverse' : particleuniverse , 'cadunetree' : cadunetree - ,'opensteer' : opensteer - ,'ogrepcz' : ogrepcz + , 'opensteer' : opensteer + , 'ogrepcz' : ogrepcz , 'hydrax' : hydrax + , 'hikari' : hikari } # Added: trunk/python-ogre/packages_2.5/ogre/gui/hikari/__init__.py =================================================================== --- trunk/python-ogre/packages_2.5/ogre/gui/hikari/__init__.py (rev 0) +++ trunk/python-ogre/packages_2.5/ogre/gui/hikari/__init__.py 2008-08-31 01:29:13 UTC (rev 713) @@ -0,0 +1 @@ +from _hikari_ import * Modified: trunk/python-ogre/patch/ogre_1.6.patch =================================================================== --- trunk/python-ogre/patch/ogre_1.6.patch 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/patch/ogre_1.6.patch 2008-08-31 01:29:13 UTC (rev 713) @@ -3,234 +3,234 @@ --- OgreMain/include/OgreMovableObject.h (revision 7873) +++ OgreMain/include/OgreMovableObject.h (working copy) @@ -482,7 +482,7 @@ - included too. - */ - virtual void visitRenderables(Renderable::Visitor* visitor, -- bool debugRenderables = false) = 0; -+ bool debugRenderables = false) { throw std::runtime_error ( std::string ("Virtual function MovableObject::visitRenderables called!") ); } - - /** Sets whether or not the debug display of this object is enabled. - @remarks + included too. + */ + virtual void visitRenderables(Renderable::Visitor* visitor, +- bool debugRenderables = false) = 0; ++ bool debugRenderables = false) { throw std::runtime_error ( std::string ("Virtual function MovableObject::visitRenderables called!") ); } + + /** Sets whether or not the debug display of this object is enabled. + @remarks Index: OgreMain/include/OgreRenderQueueListener.h =================================================================== --- OgreMain/include/OgreRenderQueueListener.h (revision 7873) +++ OgreMain/include/OgreRenderQueueListener.h (working copy) @@ -31,7 +31,9 @@ - - #include "OgrePrerequisites.h" - #include "OgreRenderQueue.h" -+#include <stdexcept> - -+ - namespace Ogre { - - /** Abstract interface which classes must implement if they wish to receive -@@ -64,8 +66,8 @@ - rendered. Note that in this case the renderQueueEnded event will not be raised - for this queue group. - */ -- virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, -- bool& skipThisInvocation) = 0; -+ virtual bool renderQueueStarted(uint8 queueGroupId, const String& invocation, -+ bool skipThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueStarted called!") ); } - - /** Event raised after a queue group is rendered. - @remarks + + #include "OgrePrerequisites.h" + #include "OgreRenderQueue.h" ++#include <stdexcept> + ++ + namespace Ogre { + + /** Abstract interface which classes must implement if they wish to receive +@@ -66,8 +68,8 @@ + rendered. Note that in this case the renderQueueEnded event will not be raised + for this queue group. + */ +- virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, +- bool& skipThisInvocation) = 0; ++ virtual bool renderQueueStarted(uint8 queueGroupId, const String& invocation, ++ bool skipThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueStarted called!") ); } + + /** Event raised after a queue group is rendered. + @remarks @@ -79,8 +81,8 @@ - rendered will be repeated, and the renderQueueStarted and renderQueueEnded - events will also be fired for it again. - */ -- virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, -- bool& repeatThisInvocation) = 0; -+ virtual bool renderQueueEnded(uint8 queueGroupId, const String& invocation, -+ bool repeatThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueEnded called!") ); } - }; - - } + rendered will be repeated, and the renderQueueStarted and renderQueueEnded + events will also be fired for it again. + */ +- virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, +- bool& repeatThisInvocation) = 0; ++ virtual bool renderQueueEnded(uint8 queueGroupId, const String& invocation, ++ bool repeatThisInvocation) { throw std::runtime_error ( std::string ("Virtual function RenderQueueListener::renderQueueEnded called!") ); } + }; + + } Index: OgreMain/include/OgreResourceGroupManager.h =================================================================== --- OgreMain/include/OgreResourceGroupManager.h (revision 7873) +++ OgreMain/include/OgreResourceGroupManager.h (working copy) @@ -37,6 +37,7 @@ - #include "OgreArchive.h" - #include "OgreIteratorWrappers.h" - #include <ctime> -+#include <stdexcept> - - namespace Ogre { - + #include "OgreArchive.h" + #include "OgreIteratorWrappers.h" + #include <ctime> ++#include <stdexcept> + + namespace Ogre { + @@ -92,7 +93,7 @@ - parsed. Note that in this case the scriptParseEnded event will not be raised - for this script. - */ -- virtual void scriptParseStarted(const String& scriptName, bool& skipThisScript) = 0; -+ virtual bool scriptParseStarted(const String& scriptName, bool skipThisScript) { throw std::runtime_error ( std::string ("Virtual function ResourceGroupListener::scriptParseStarted called!") ); } - - /** This event is fired when the script has been fully parsed. - */ + parsed. Note that in this case the scriptParseEnded event will not be raised + for this script. + */ +- virtual void scriptParseStarted(const String& scriptName, bool& skipThisScript) = 0; ++ virtual bool scriptParseStarted(const String& scriptName, bool skipThisScript) { throw std::runtime_error ( std::string ("Virtual function ResourceGroupListener::scriptParseStarted called!") ); } + + /** This event is fired when the script has been fully parsed. + */ @@ -350,7 +351,7 @@ - /// Internal event firing method - void fireResourceGroupScriptingStarted(const String& groupName, size_t scriptCount); - /// Internal event firing method -- void fireScriptStarted(const String& scriptName, bool &skipScript); -+ bool fireScriptStarted(const String& scriptName, bool skipScript); - /// Internal event firing method - void fireScriptEnded(const String& scriptName, bool skipped); - /// Internal event firing method + /// Internal event firing method + void fireResourceGroupScriptingStarted(const String& groupName, size_t scriptCount); + /// Internal event firing method +- void fireScriptStarted(const String& scriptName, bool &skipScript); ++ bool fireScriptStarted(const String& scriptName, bool skipScript); + /// Internal event firing method + void fireScriptEnded(const String& scriptName, bool skipped); + /// Internal event firing method Index: OgreMain/include/OgreDataStream.h =================================================================== --- OgreMain/include/OgreDataStream.h (revision 7873) +++ OgreMain/include/OgreDataStream.h (working copy) @@ -33,6 +33,7 @@ - #include "OgreString.h" - #include "OgreSharedPtr.h" - #include <istream> -+#include <stdexcept> - - namespace Ogre { - + #include "OgreString.h" + #include "OgreSharedPtr.h" + #include <istream> ++#include <stdexcept> + + namespace Ogre { + @@ -79,7 +80,7 @@ - @param count Number of bytes to read - @returns The number of bytes read - */ -- virtual size_t read(void* buf, size_t count) = 0; -+ virtual size_t read(void* buf, size_t count) { throw std::runtime_error ( std::string ("Virtual function DataStream::read called!") ); } - /** Get a single line from the stream. - @remarks - The delimiter character is not included in the data + @param count Number of bytes to read + @returns The number of bytes read + */ +- virtual size_t read(void* buf, size_t count) = 0; ++ virtual size_t read(void* buf, size_t count) { throw std::runtime_error ( std::string ("Virtual function DataStream::read called!") ); } + /** Get a single line from the stream. + @remarks + The delimiter character is not included in the data Index: OgreMain/include/OgreHardwareBuffer.h =================================================================== --- OgreMain/include/OgreHardwareBuffer.h (revision 7873) +++ OgreMain/include/OgreHardwareBuffer.h (working copy) @@ -31,7 +31,9 @@ - - // Precompiler options - #include "OgrePrerequisites.h" -+#include <stdexcept> - -+ - namespace Ogre { - - /** Abstract class defining common features of hardware buffers. + + // Precompiler options + #include "OgrePrerequisites.h" ++#include <stdexcept> + ++ + namespace Ogre { + + /** Abstract class defining common features of hardware buffers. @@ -244,7 +246,7 @@ - @param pDest The area of memory in which to place the data, must be large enough to - accommodate the data! - */ -- virtual void readData(size_t offset, size_t length, void* pDest) = 0; -+ virtual void readData(size_t offset, size_t length, void* pDest) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::readData called!") ); } - /** Writes data to the buffer from an area of system memory; note that you must - ensure that your buffer is big enough. - @param offset The byte offset from the start of the buffer to start writing + @param pDest The area of memory in which to place the data, must be large enough to + accommodate the data! + */ +- virtual void readData(size_t offset, size_t length, void* pDest) = 0; ++ virtual void readData(size_t offset, size_t length, void* pDest) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::readData called!") ); } + /** Writes data to the buffer from an area of system memory; note that you must + ensure that your buffer is big enough. + @param offset The byte offset from the start of the buffer to start writing @@ -254,7 +256,7 @@ - such that DMA stalls can be avoided; use if you can. - */ - virtual void writeData(size_t offset, size_t length, const void* pSource, -- bool discardWholeBuffer = false) = 0; -+ bool discardWholeBuffer = false) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::writeData called!") ); } - - /** Copy data from another buffer into this one. - @remarks + such that DMA stalls can be avoided; use if you can. + */ + virtual void writeData(size_t offset, size_t length, const void* pSource, +- bool discardWholeBuffer = false) = 0; ++ bool discardWholeBuffer = false) { throw std::runtime_error ( std::string ("Virtual function HardwareBuffer::writeData called!") ); } + + /** Copy data from another buffer into this one. + @remarks Index: OgreMain/include/OgreCompositorChain.h =================================================================== --- OgreMain/include/OgreCompositorChain.h (revision 7873) +++ OgreMain/include/OgreCompositorChain.h (working copy) @@ -174,10 +174,10 @@ - public: - /** @copydoc RenderQueueListener::renderQueueStarted - */ -- virtual void renderQueueStarted(uint8 id, const String& invocation, bool& skipThisQueue); -+ virtual bool renderQueueStarted(uint8 id, const String& invocation, bool skipThisQueue); - /** @copydoc RenderQueueListener::renderQueueEnded - */ -- virtual void renderQueueEnded(uint8 id, const String& invocation, bool& repeatThisQueue); -+ virtual bool renderQueueEnded(uint8 id, const String& invocation, bool repeatThisQueue); - - /** Set current operation and target */ - void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs); + public: + /** @copydoc RenderQueueListener::renderQueueStarted + */ +- virtual void renderQueueStarted(uint8 id, const String& invocation, bool& skipThisQueue); ++ virtual bool renderQueueStarted(uint8 id, const String& invocation, bool skipThisQueue); + /** @copydoc RenderQueueListener::renderQueueEnded + */ +- virtual void renderQueueEnded(uint8 id, const String& invocation, bool& repeatThisQueue); ++ virtual bool renderQueueEnded(uint8 id, const String& invocation, bool repeatThisQueue); + + /** Set current operation and target */ + void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs); Index: OgreMain/src/OgreResourceGroupManager.cpp =================================================================== --- OgreMain/src/OgreResourceGroupManager.cpp (revision 7873) +++ OgreMain/src/OgreResourceGroupManager.cpp (working copy) @@ -929,7 +929,7 @@ - for (FileInfoList::iterator fii = (*flli)->begin(); fii != (*flli)->end(); ++fii) - { - bool skipScript = false; -- fireScriptStarted(fii->filename, skipScript); -+ skipScript = fireScriptStarted(fii->filename, skipScript); - if(skipScript) - { - LogManager::getSingleton().logMessage( + for (FileInfoList::iterator fii = (*flli)->begin(); fii != (*flli)->end(); ++fii) + { + bool skipScript = false; +- fireScriptStarted(fii->filename, skipScript); ++ skipScript = fireScriptStarted(fii->filename, skipScript); + if(skipScript) + { + LogManager::getSingleton().logMessage( @@ -1218,17 +1218,18 @@ - } - } - //----------------------------------------------------------------------- -- void ResourceGroupManager::fireScriptStarted(const String& scriptName, bool &skipScript) -+ bool ResourceGroupManager::fireScriptStarted(const String& scriptName, bool skipScript) - { - OGRE_LOCK_AUTO_MUTEX - for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin(); - l != mResourceGroupListenerList.end(); ++l) - { - bool temp = false; -- (*l)->scriptParseStarted(scriptName, temp); -+ temp = (*l)->scriptParseStarted(scriptName, temp); - if(temp) - skipScript = true; - } -+ return skipScript; - } - //----------------------------------------------------------------------- - void ResourceGroupManager::fireScriptEnded(const String& scriptName, bool skipped) + } + } + //----------------------------------------------------------------------- +- void ResourceGroupManager::fireScriptStarted(const String& scriptName, bool &skipScript) ++ bool ResourceGroupManager::fireScriptStarted(const String& scriptName, bool skipScript) + { + OGRE_LOCK_AUTO_MUTEX + for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin(); + l != mResourceGroupListenerList.end(); ++l) + { + bool temp = false; +- (*l)->scriptParseStarted(scriptName, temp); ++ temp = (*l)->scriptParseStarted(scriptName, temp); + if(temp) + skipScript = true; + } ++ return skipScript; + } + //----------------------------------------------------------------------- + void ResourceGroupManager::fireScriptEnded(const String& scriptName, bool skipped) Index: OgreMain/src/OgreCompositorChain.cpp =================================================================== --- OgreMain/src/OgreCompositorChain.cpp (revision 7873) +++ OgreMain/src/OgreCompositorChain.cpp (working copy) @@ -377,8 +377,8 @@ - mViewport = vp; - } - //----------------------------------------------------------------------- --void CompositorChain::RQListener::renderQueueStarted(uint8 id, -- const String& invocation, bool& skipThisQueue) -+bool CompositorChain::RQListener::renderQueueStarted(uint8 id, -+ const String& invocation, bool skipThisQueue) - { - // Skip when not matching viewport - // shadows update is nested within main viewport update + mViewport = vp; + } + //----------------------------------------------------------------------- +-void CompositorChain::RQListener::renderQueueStarted(uint8 id, +- const String& invocation, bool& skipThisQueue) ++bool CompositorChain::RQListener::renderQueueStarted(uint8 id, ++ const String& invocation, bool skipThisQueue) + { + // Skip when not matching viewport + // shadows update is nested within main viewport update @@ -392,11 +392,13 @@ - { - skipThisQueue = true; - } -+ return skipThisQueue; - } - //----------------------------------------------------------------------- --void CompositorChain::RQListener::renderQueueEnded(uint8 id, -- const String& invocation, bool& repeatThisQueue) -+bool CompositorChain::RQListener::renderQueueEnded(uint8 id, -+ const String& invocation, bool repeatThisQueue) - { -+ return repeatThisQueue; - } - //----------------------------------------------------------------------- - void CompositorChain::RQListener::setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs) + { + skipThisQueue = true; + } ++ return skipThisQueue; + } + //----------------------------------------------------------------------- +-void CompositorChain::RQListener::renderQueueEnded(uint8 id, +- const String& invocation, bool& repeatThisQueue) ++bool CompositorChain::RQListener::renderQueueEnded(uint8 id, ++ const String& invocation, bool repeatThisQueue) + { ++ return repeatThisQueue; + } + //----------------------------------------------------------------------- + void CompositorChain::RQListener::setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs) Index: OgreMain/src/OgreSceneManager.cpp =================================================================== --- OgreMain/src/OgreSceneManager.cpp (revision 7873) +++ OgreMain/src/OgreSceneManager.cpp (working copy) @@ -3651,7 +3651,7 @@ - iend = mRenderQueueListeners.end(); - for (i = mRenderQueueListeners.begin(); i != iend; ++i) - { -- (*i)->renderQueueStarted(id, invocation, skip); -+ skip = (*i)->renderQueueStarted(id, invocation, skip); - } - return skip; - } + iend = mRenderQueueListeners.end(); + for (i = mRenderQueueListeners.begin(); i != iend; ++i) + { +- (*i)->renderQueueStarted(id, invocation, skip); ++ skip = (*i)->renderQueueStarted(id, invocation, skip); + } + return skip; + } @@ -3664,7 +3664,7 @@ - iend = mRenderQueueListeners.end(); - for (i = mRenderQueueListeners.begin(); i != iend; ++i) - { -- (*i)->renderQueueEnded(id, invocation, repeat); -+ repeat = (*i)->renderQueueEnded(id, invocation, repeat); - } - return repeat; - } + iend = mRenderQueueListeners.end(); + for (i = mRenderQueueListeners.begin(); i != iend; ++i) + { +- (*i)->renderQueueEnded(id, invocation, repeat); ++ repeat = (*i)->renderQueueEnded(id, invocation, repeat); + } + return repeat; + } Modified: trunk/python-ogre/scripts/compilesource.bat =================================================================== --- trunk/python-ogre/scripts/compilesource.bat 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/scripts/compilesource.bat 2008-08-31 01:29:13 UTC (rev 713) @@ -10,7 +10,7 @@ rem %_VCBUILD% /useenv NxOgre.VC8.Windows.sln "Release|Win32" cd %_ROOT%\\ogreaddons\\ogreode\\scripts\\vc8 -%_VCBUILD% /useenv OgreOde_CVS.sln "Release|Win32" +%_VCBUILD% /useenv OgreOde_Source.sln "Release|Win32" cd %_ROOT%\\ogreaddons\\ogrenewt %_VCBUILD% /useenv OgreNewt.sln "Release|Win32" Modified: trunk/python-ogre/setup.py =================================================================== --- trunk/python-ogre/setup.py 2008-08-31 01:25:05 UTC (rev 712) +++ trunk/python-ogre/setup.py 2008-08-31 01:29:13 UTC (rev 713) @@ -67,12 +67,13 @@ 'ogre.physics.bullet','ogre.physics.PhysX','ogre.physics.NxOgre', 'ogre.physics.OgreBulletC', 'ogre.physics.OgreBulletD', 'ogre.addons','ogre.addons.theora', - 'ogre.addons.ogrevideoffmpeg', 'ogre.addons.ogredshow', - 'ogre.addons.plib','ogre.gui.navi', + # 'ogre.addons.ogrevideoffmpeg', 'ogre.addons.ogredshow', + 'ogre.addons.plib', # 'ogre.gui.navi', 'ogre.addons.ogreforests', 'ogre.addons.et', 'ogre.addons.caelum', - 'ogre.addons.noise', 'ogre.addons.watermesh', 'ogre.addons.ofusion', + 'ogre.addons.noise', 'ogre.addons.watermesh', # 'ogre.addons.ofusion', 'ogre.addons.particleuniverse', 'ogre.addons.cadunetree', - 'ogre.renderer.ogrepcz', 'ogre.addons.hydrax' ], + 'ogre.renderer.ogrepcz', 'ogre.addons.hydrax', + 'ogre.gui.hikari' ], "package_dir": {'': 'packages_'+ PythonVersionString }, "package_data": {'': ['*.pyd', '*.dll', '*.so']} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mi...@us...> - 2008-09-01 11:45:47
|
Revision: 715 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=715&view=rev Author: mithro Date: 2008-09-01 11:45:49 +0000 (Mon, 01 Sep 2008) Log Message: ----------- Add support for Ogre 1.6RC1 in Linux. Fixed CEGUI pointing to version 0.6.0. Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_posix.py trunk/python-ogre/environment.py Modified: trunk/python-ogre/PythonOgreConfig_posix.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_posix.py 2008-09-01 06:06:29 UTC (rev 714) +++ trunk/python-ogre/PythonOgreConfig_posix.py 2008-09-01 11:45:49 UTC (rev 715) @@ -39,7 +39,7 @@ PATH_THIRDPARTY = os.path.join(module_dir, 'ThirdParty' ) PATH_Ogre = os.path.join(BASE_DIR,'ogre') PATH_OgreAddons = os.path.join(BASE_DIR, 'ogreaddons') -PATH_CEGUI = os.path.join(BASE_DIR, 'CEGUI-0.6.0' ) +PATH_CEGUI = os.path.join(BASE_DIR, 'CEGUI-0.6.1' ) PATH_OIS = os.path.join(BASE_DIR, 'ois-1.0RC1') if SDK: Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-09-01 06:06:29 UTC (rev 714) +++ trunk/python-ogre/environment.py 2008-09-01 11:45:49 UTC (rev 715) @@ -546,10 +546,6 @@ class ogre: active = True pythonModule = True - if _STABLE: - version="1.6" - else: - version = "1.7" name='ogre' ModuleName='OGRE' cflags = "" @@ -563,6 +559,7 @@ if isWindows(): if _STABLE: + version="1.6" source = [ [ wget, "http://downloads.sourceforge.net/ogre/OgreDependencies_VC9_Eihort_20080203.zip", downloadPath], [ wget, "http://downloads.sourceforge.net/ogre/ogre-v1-6-0RC1.zip", downloadPath], @@ -574,7 +571,9 @@ [0, "patch -s -N -i ./python-ogre/patch/ogre_1.6.patch -p0 ", os.getcwd()], [0,'echo Please use MSVC Express Edition to build Ogre Release.',''] ] - else: + else: + + version="1.7" source = [ [ wget, "http://downloads.sourceforge.net/ogre/OgreDependencies_VC9_Eihort_20080203.zip", downloadPath], [ svn, "https://svn.ogre3d.org/svnroot/ogre/branches/v1-6", os.path.join(os.getcwd(), 'ogre')] @@ -591,8 +590,8 @@ pchstop = 'python_ogre_precompiled.h' pchbuild = 'buildpch.cpp' pchincludes = ['python_ogre_precompiled.h'] -# - libs=[boost.lib, 'OgreMain' ] #, 'OgreGUIRenderer', 'CEGUIBase'] + + libs=[boost.lib, 'OgreMain'] lib_dirs = [ Config.PATH_LIB_Boost , Config.PATH_LIB_Ogre_CEGUIRenderer , Config.PATH_LIB_Ogre_OgreMain @@ -606,33 +605,33 @@ LINKFLAGS = '' externalFiles=['OgreMain.dll', 'OgreGuiRender.dll', boost.lib+'.dll'] elif isLinux(): - version = "1.4" #### UGLY OVERRIDE AT MOMENT... - libs=[boost.lib, 'OgreMain' ] #, 'OgreGUIRenderer', 'CEGUIBase'] - base = "ogre-v1-4-9" + if _STABLE: + version = "1.4" + base = "ogre-v1-4-9" + else: + version = "1.6" + base = "ogre-v1-6-0RC1" + + libs=[boost.lib, boost_python_index.lib, 'OgreMain'] + lib_dirs=[Config.LOCAL_LIB] + include_dirs=[Config.PATH_Boost, Config.PATH_INCLUDE_Ogre] + CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19' + source = [ [wget, "http://downloads.sourceforge.net/ogre/"+base+".tar.bz2",downloadPath], ] buildCmds = [ - # [0, "env >1", ''], - [0, tar + " jxf " + os.path.join(downloadPath,base)+".tar.bz2 --overwrite",os.getcwd() ], - [0, "patch -s -N -i ./python-ogre/patch/ogre.patch -p0 ", os.getcwd()], - [0, "aclocal", os.path.join(os.getcwd(), 'ogre')], - [0, "./bootstrap", os.path.join(os.getcwd(), 'ogre')], - #[1, "import os\nos.environ['ZZIPLIB_LIBS']='-lzzip'", ''], - [0, "./configure --prefix=%s --with-gui=Xt --disable-devil" % PREFIX, os.path.join(os.getcwd(), 'ogre')], - #export ZZIPLIB_LIBS="-lzzip" - [0, "make", os.path.join(os.getcwd(), 'ogre')], - [0, "make install", os.path.join(os.getcwd(), 'ogre')], - ] - - libs=[boost.lib, boost_python_index.lib, 'OgreMain' ] #, 'OgreGUIRenderer', 'CEGUIBase'] - lib_dirs = [ Config.LOCAL_LIB - ] - include_dirs = [ Config.PATH_Boost - , Config.PATH_INCLUDE_Ogre - ] - CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19' + [0, tar + " jxf " + os.path.join(downloadPath,base)+".tar.bz2 --overwrite",os.getcwd() ], + [0, "patch -s -N -i ./python-ogre/patch/ogre.patch -p0 ", os.getcwd()], + [0, "aclocal", os.path.join(os.getcwd(), 'ogre')], + [0, "./bootstrap", os.path.join(os.getcwd(), 'ogre')], + [0, "./configure --prefix=%s --with-gui=Xt --disable-devil" % PREFIX, os.path.join(os.getcwd(), 'ogre')], + [0, "make", os.path.join(os.getcwd(), 'ogre')], + [0, "make install", os.path.join(os.getcwd(), 'ogre')], + ] + elif isMac(): + version = "1.4" base = "ogre-linux_osx-v1-4-9" basedep = "OgreDependenciesOSX_20070929" source = [ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |