Revision: 534
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=534&view=rev
Author: andy_miller
Date: 2008-01-08 04:38:37 -0800 (Tue, 08 Jan 2008)
Log Message:
-----------
Various updates for the 1.2 release
Modified Paths:
--------------
trunk/python-ogre/code_generators/common_utils/extract_documentation.py
trunk/python-ogre/code_generators/et/generate_code.py
trunk/python-ogre/code_generators/navi/generate_code.py
trunk/python-ogre/code_generators/navi/hand_made_wrappers.py
trunk/python-ogre/code_generators/navi/python_navi_sizeof.h
trunk/python-ogre/code_generators/nxogre/customization_data.py
trunk/python-ogre/code_generators/nxogre/generate_code.py
trunk/python-ogre/code_generators/nxogre/python_nxogre.h
trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h
trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h
trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h
trunk/python-ogre/demos/ogre/Demo_Water.py
Modified: trunk/python-ogre/code_generators/common_utils/extract_documentation.py
===================================================================
--- trunk/python-ogre/code_generators/common_utils/extract_documentation.py 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/common_utils/extract_documentation.py 2008-01-08 12:38:37 UTC (rev 534)
@@ -194,7 +194,10 @@
_str = clean(_str, "@ref", "@see")
_str = clean(_str, "\\ref", "@see")
_str = clean(_str, "@copydoc", "Ref: ")
+ _str = clean(_str, "\\verbatim", "" )
+ _str = clean(_str, "\\endverbatim", "" )
+
_str = clean(_str, "\\sa", "@see") # comment _string in OgreNewt
_str = clean(_str, "\\codeblock", "::")
_str = clean(_str, "\\code", "::")
@@ -246,4 +249,4 @@
print doc_extractor("")(x_decl("myfunc(int x, int y)","c:/development/ocvs/ogrenew/ogremain/include/OgreSceneManager.h",218))
print doc_extractor("")(x_decl("","c:/development/ocvs/ogrenew/ogremain/include/OgreSceneManager.h",223))
- print doc_extractor("")(x_decl("","c:/development/CEGUI-0.5.0/include/CEGUIEvent.h",139))
+ print doc_extractor("")(x_decl("","c:/development/CEGUI-0.5.0/include/CEGUIEvent.h",139))
Modified: trunk/python-ogre/code_generators/et/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/et/generate_code.py 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/et/generate_code.py 2008-01-08 12:38:37 UTC (rev 534)
@@ -223,7 +223,7 @@
)
# if this module depends on another set it here
- ## mb.register_module_dependency ( environment.ogre.generated_dir )
+ mb.register_module_dependency ( environment.ogre.generated_dir )
# normally implicit conversions work OK, however they can cause strange things to happen so safer to leave off
mb.constructors().allow_implicit_conversion = False
Modified: trunk/python-ogre/code_generators/navi/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/navi/generate_code.py 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/navi/generate_code.py 2008-01-08 12:38:37 UTC (rev 534)
@@ -96,8 +96,14 @@
c.exclude()
### Variables
- excludes = []
+# cls = main_ns.class_('::NaviLibrary::detail::ClosurePtr< void (NaviLibrary::detail::GenericClass::*)(NaviLibrary::NaviData const&), void (*)(NaviLibrary::NaviData const&), void (*)(NaviLibrary::NaviData const&) >')
+# cls.variable("ClosureMemPtr").exclude()
+# cls.variable("StaticFunction").exclude()
+#
+
+ excludes = []# 'FastDelegate1::m_Closure']
for e in excludes:
+ print "Excluding Var", e
main_ns.variable(e).exclude()
### Typedefs
@@ -117,7 +123,7 @@
# if 'NxVec3' in a.type.decl_string or 'NxQuat' in a.type.decl_string:
# c.exclude()
# break
-
+ main_ns.namespace('detail').exclude()
############################################################
##
@@ -201,30 +207,50 @@
main_ns = global_ns.namespace( MAIN_NAMESPACE )
-def AutoFixes ( mb ):
+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
- main_ns = global_ns.namespace( MAIN_NAMESPACE )
+ if MAIN_NAMESPACE:
+ main_ns = global_ns.namespace( MAIN_NAMESPACE )
+ else:
+ main_ns = global_ns
- # arguments passed as refs but not const are not liked by boost
- #Fix_Ref_Not_Const ( main_ns )
+ # Allow conversion between Vectors/Colourvalue etc and Python lists
+ Add_Auto_Conversions( mb )
+
# Functions that have void pointers in their argument list need to change to unsigned int's
- Fix_Void_Ptr_Args ( main_ns )
-
+ pointee_types=['unsigned int','int', 'float', '::Ogre::Real', '::Ogre::uchar', '::Ogre::uint8', '::Ogre::uint16'
+ 'unsigned char', 'char', 'bool']
+ ignore_names=['Matrices', 'Vertices', 'ExceptionFactory', 'UTFString' ]
+ ## Now done with auto transform....
+# # # 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
- Fix_Pointer_Returns ( main_ns )
+ pointee_types=['unsigned int','int', 'float', '::Ogre::Real', '::Ogre::uchar', '::Ogre::uint8', 'unsigned char', 'char']
+ ignore_names=['ptr', 'useCountPointer'] # 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
- Fix_Implicit_Conversions ( main_ns)
+ ImplicitClasses=[]
+ common_utils.Fix_Implicit_Conversions ( main_ns, ImplicitClasses )
+ # variables that are readonly and mutable need to be changed from 'vars' to properties so there
+ # is a copy made of the C++ variable before passing into Python
+ ToFixClasses=[]
+ knownNonMutable=['unsigned int','int', 'float','::Ogre::Real', '::Ogre::uchar',
+ '::Ogre::uint8', 'unsigned char', 'char']
+ common_utils.Fix_ReadOnly_Vars ( mb, ToFixClasses, knownNonMutable )
+
if os.name =='nt':
Fix_NT( mb )
elif os.name =='posix':
Fix_Posix( mb )
+ common_utils.Auto_Document( mb, MAIN_NAMESPACE )
+
###############################################################################
##
@@ -456,18 +482,22 @@
main_ns = global_ns.namespace( MAIN_NAMESPACE )
main_ns.include()
-
- AutoExclude ( mb )
+
+ common_utils.AutoExclude ( mb, MAIN_NAMESPACE )
ManualExclude ( mb )
- AutoInclude ( mb )
+ common_utils.AutoInclude ( mb, MAIN_NAMESPACE )
ManualInclude ( mb )
- # here we fixup functions that expect to modifiy their 'passed' variables
+
+ # here we fixup functions that expect to modifiy their 'passed' variables and are not autmatically fixed
ManualTransformations ( mb )
- AutoFixes ( mb )
+ AutoFixes ( mb, MAIN_NAMESPACE )
ManualFixes ( mb )
-
-
+
+ common_utils.Auto_Functional_Transformation ( main_ns, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] )
+
+
+
#
# We need to tell boost how to handle calling (and returning from) certain functions
#
Modified: trunk/python-ogre/code_generators/navi/hand_made_wrappers.py
===================================================================
--- trunk/python-ogre/code_generators/navi/hand_made_wrappers.py 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/navi/hand_made_wrappers.py 2008-01-08 12:38:37 UTC (rev 534)
@@ -67,6 +67,6 @@
def apply( mb ):
rt = mb.class_( 'NaviManager' )
- rt.add_declaration_code( WRAPPER_DEFINITION_NaviManager )
- apply_reg (rt, WRAPPER_REGISTRATION_NaviManager )
+# # # rt.add_declaration_code( WRAPPER_DEFINITION_NaviManager )
+# # # apply_reg (rt, WRAPPER_REGISTRATION_NaviManager )
\ No newline at end of file
Modified: trunk/python-ogre/code_generators/navi/python_navi_sizeof.h
===================================================================
--- trunk/python-ogre/code_generators/navi/python_navi_sizeof.h 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/navi/python_navi_sizeof.h 2008-01-08 12:38:37 UTC (rev 534)
@@ -1,3 +1,5 @@
+sizeof ( NaviUtilities::Strings );
+sizeof ( NaviUtilities::Args );
Modified: trunk/python-ogre/code_generators/nxogre/customization_data.py
===================================================================
--- trunk/python-ogre/code_generators/nxogre/customization_data.py 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/nxogre/customization_data.py 2008-01-08 12:38:37 UTC (rev 534)
@@ -2,10 +2,11 @@
def header_files( version ):
return [ 'NxOgre.h'
,'NxOgreSkeleton.h'
- , 'Ogre.h'
- ,'OgrePlugin.h'
- ,'NxPhysics.h'
- ]
+ ,'NxOgreResourceMesh.h'
+ ,'Ogre.h'
+ ,'OgrePlugin.h'
+ ,'NxPhysics.h'
+ ]
def huge_classes( version ):
return []
Modified: trunk/python-ogre/code_generators/nxogre/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/nxogre/generate_code.py 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/nxogre/generate_code.py 2008-01-08 12:38:37 UTC (rev 534)
@@ -86,6 +86,11 @@
# problem with a constructor on Cloth
main_ns.class_('::NxOgre::Cloth').constructor(arg_types=[None,'::NxClothDesc','::NxMeshData',None,None]).exclude()
+
+ # functions specified in the headers but not implemented
+ main_ns.class_('::NxOgre::Blueprints::ActorBlueprint').member_function('unserialise',arg_types=[None]).exclude()
+
+
# # #
# # # ### Member Functions
excludes=[
@@ -97,48 +102,16 @@
,'::NxOgre::Container<std::string, NxOgre::FluidDrain*>::_next'
,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::_begin'
,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::_next'
-
,'::NxOgre::Container<std::string, NxOgre::FluidEmitter*>::getFirst'
,'::NxOgre::List<NxOgre::RemoteDebuggerConnection::Camera>::destroyAndEraseAll'
,'::NxOgre::List<NxOgre::RemoteDebuggerConnection::Camera>::dumpToConsole'
-
-
-# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::dumpToConsole'
-# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::count'
-# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::empty'
-# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::insert'
-# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::lock'
-# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::isLocked'
-# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::has'
-# ,'::NxOgre::Container<std::string, NxOgre::Joint*>::getFirst'
-
-
,'::NxOgre::UserAllocator::realloc'
-# # # # not yet implemented in source
- ,'::NxOgre::WheelSet::attachNewWheel'
- ,'::NxOgre::WheelSet::createThreeWheelSet'
- ,'::NxOgre::WheelSet::createSixWheelSet'
- ,'::NxOgre::Wheel::addEntity'
,'::NxOgre::Cloth::duplicate'
,'::NxOgre::ClothRayCaster::getClosestCloth'
,'::NxOgre::Joint::getBreakableMaxForce'
,'::NxOgre::Joint::getBreakableMaxTorque'
,'::NxOgre::Joint::getGlobalAxis'
,'::NxOgre::Joint::setGlobalAxis'
-# # # ,'::NxOgre::Joint::getType'
-# ,'::NxOgre::Joint::hasMoreLimitPlanes'
-# ,'::NxOgre::Joint::purgeLimitPlanes'
-# ,'::NxOgre::Joint::resetLimitPlaneIterator'
-# ,'::NxOgre::Joint::addLimitPlane'
-# ,'::NxOgre::Joint::setBreakable'
-# ,'::NxOgre::Joint::getGlobalAnchor'
-# ,'::NxOgre::Joint::setGlobalAnchor'
-# ,'::NxOgre::Joint::getState'
-# ,'::NxOgre::Joint::getNextLimitPlane'
-# ,'::NxOgre::Joint::setLimitPoint'
-# ,'::NxOgre::Joint::getLimitPoint'
-# ,'::NxOgre::Joint::getActorA'
-# ,'::NxOgre::Joint::getActorB'
,'::NxOgre::JointParams::setSpring'
,'::NxOgre::JointParams::setMotor'
,'::NxOgre::JointParams::setLimits'
@@ -158,11 +131,30 @@
,'::NxOgre::SimpleIntersection::getResult'
,'::NxOgre::SoftBody::simulate'
,'::NxOgre::SoftBody::render'
- ,'::NxOgre::PhysXDriver::stop'
- ,'::NxOgre::PhysXDriver::start'
- ,'::NxOgre::PhysXDriver::reset'
- ,'::NxOgre::PhysXDriver::hasHardware'
-
+
+ ,'::NxOgre::FileResourceSystem::getStream' # takes ::NxOgre::ResourceIdentifier as argument which needs fixing
+ ,'::NxOgre::OgreResourceSystem::getStream'
+ ,'::NxOgre::ResourceSystem::getStream'
+ ,'::NxOgre::RenderableSource::getStringType' # so we don't need a wrapper as it doesn't compile
+ ,'::NxOgre::RenderableSource::getType'
+ ,'::NxOgre::UserAllocator::mallocDEBUG'
+
+# ,'::NxOgre::Blueprints::ActorFactory' # not implemented, only in header..
+ ,'::NxOgre::ContactStream::getShape'
+ ,'::NxOgre::ContactStream::getPatchNormal'
+ ,'::NxOgre::ContactStream::getPoint'
+ ,'::NxOgre::ContactStream::getNxActor'
+ ,'::NxOgre::ContactStream::getActor'
+ ,'::NxOgre::MemoryStream::skip'
+ ,'::NxOgre::MemoryStream::seek'
+ ,'::NxOgre::WheelSet::setMotorTorque'
+ ,'::NxOgre::WheelSet::setBrakeTorque'
+ ,'::NxOgre::WheelSet::turn'
+ ,'::NxOgre::Material::setDirOfAnisotropy'
+ ,'::NxOgre::OgreNodeRenderable::addSceneNode'
+# ,'::NxOgre::ResourceStreamPtr::ResourceStreamPtr'
+ ,'::NxOgre::MaterialAlias::generateConversionList'
+
]
for e in excludes:
print "excluding ", e
@@ -184,18 +176,20 @@
main_ns.free_functions(e).exclude()
## Classes
- excludes = ['::NxOgre::BaseCharacterHitReport'
- ,'::NxOgre::CharacterHitReport'
- ,'::NxOgre::Blueprints::ActorBlueprint'
- ,'::NxOgre::Blueprints::ActorFactory'
- ,'::NxOgre::Blueprints::WorldBlueprint'
- ,'::NxOgre::Serialiser::SerialiserBase'
- ,'::NxOgre::UserAllocator'
- ,'::NxOgre::State'
-
- # not yet implemented in source
+ excludes = [
+ 'DistanceJoint' ## constructor issue TOFIX
+ ,'JointCallback' ## also no suitable/defaul constructor TOFIX
+ ,'Character' ## defined in header but not very much implementation
+# ,'RenderableSource'
+ ,'ResourceManager'
+# ,'ResourceStreamPtr'
+ ,'::NxOgre::Blueprints::ActorFactory'
+ ,'State'
+ ,'MeshResource'
+ ,'::NxOgre::Serialiser::SerialiserBase'
]
for e in excludes:
+ print "Excluding", e
main_ns.class_(e).exclude()
# # #
# # #
@@ -222,13 +216,14 @@
f.exclude()
### Variables
- excludes = ['::NxOgre::CharacterController::mHitReports'
+ excludes = ['::NxOgre::WheelSet::mEngine' # desctuctor in WheelSet is protected so can't wrap this..
]
for e in excludes:
main_ns.variable(e).exclude()
### Typedefs
- excludes = ['::NxOgre::CharacterHitReports']
+ excludes = [
+ ]
for e in excludes:
main_ns.typedefs(e).exclude()
@@ -264,26 +259,26 @@
m.exclude()
c.member_function('getGlobalPosition').include() ## this is the only function implemented
- global_ns.namespace( 'Ogre' ).class_('AxisAlignedBox').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Radian').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('SceneNode').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('IndexData').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('SceneManager').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Matrix4').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Degree').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Quaternion').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Node').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Serializer').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('FrameListener').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Matrix3').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Material').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Camera').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('MeshPtr').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('FrameEvent').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Root').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('Entity').include(already_exposed=True)
- global_ns.namespace( 'Ogre' ).class_('SubMesh').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('AxisAlignedBox').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Radian').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('SceneNode').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('IndexData').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('SceneManager').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Matrix4').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Degree').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Quaternion').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Node').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Serializer').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('FrameListener').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Matrix3').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Material').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Camera').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('MeshPtr').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('FrameEvent').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Root').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('Entity').include(already_exposed=True)
+# # global_ns.namespace( 'Ogre' ).class_('SubMesh').include(already_exposed=True)
@@ -298,6 +293,7 @@
# fix issue where the namespace isn't in the default values
main_ns = global_ns.namespace( MAIN_NAMESPACE )
+
for c in main_ns.constructors():
for a in c.arguments:
if a.default_value and a.default_value.startswith("param"):
@@ -327,9 +323,9 @@
def create_output( size ):
return [ ft.output( i ) for i in range( size ) ]
- c = main_ns.mem_fun('::NxOgre::Cloth::raycast')
- c.add_transformation(ft.inout('vertexId'))
- c.documentation = docit('','VertexId is in/out','bool, vertexId')
+# c = main_ns.mem_fun('::NxOgre::Cloth::raycast')
+# c.add_transformation(ft.inout('vertexId'))
+# c.documentation = docit('','VertexId is in/out','bool, vertexId')
# for x in ns.member_functions('::NxOgre::Params::Set'):
# x.add_transformation(ft.inout("arg2"))
@@ -402,19 +398,25 @@
#Fix_Ref_Not_Const ( main_ns )
# Functions that have void pointers in their argument list need to change to unsigned int's
- Fix_Void_Ptr_Args ( main_ns )
+# # Fix_Void_Ptr_Args ( main_ns )
+
+ # and change functions that return a variety of pointers to instead return unsigned int's
+ pointee_types=['unsigned int','int', 'float', '::Ogre::Real', '::Ogre::uchar', '::Ogre::uint8', 'unsigned char', 'char']
+ ignore_names=['ptr', 'useCountPointer'] # these are function names we know it's cool to exclude
+ common_utils.Fix_Pointer_Returns ( main_ns, pointee_types, ignore_names )
- # and change functions that return a variety of pointers to instead return unsigned int's
- Fix_Pointer_Returns ( main_ns )
+ # functions that need to have implicit conversions turned off
+ ImplicitClasses=[]
+ common_utils.Fix_Implicit_Conversions ( main_ns, ImplicitClasses )
- # functions that need to have implicit conversions turned off
- Fix_Implicit_Conversions ( main_ns)
if os.name =='nt':
Fix_NT( mb )
elif os.name =='posix':
Fix_Posix( mb )
+ common_utils.Auto_Document( mb, MAIN_NAMESPACE )
+
###############################################################################
##
@@ -459,7 +461,10 @@
print "OK"
else:
print "NOT OK"
-
+ for op in mb.class_(className).operators():
+ print "Checking **", op.decl_string
+
+
def Add_Auto_Conversions( mb ):
pass
@@ -629,7 +634,7 @@
os.path.join( environment.nxogre.root_dir, "python_nxogre.h" )
, environment.nxogre.cache_file )
if os.name == 'nt':
- defined_symbols = [ 'NXOGRE_EXPORTS','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32']
+ defined_symbols = [ 'NxExport','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32']#NXOGRE_EXPORTS'
else:
defined_symbols = [ 'LINUX','NX_LINUX', 'NX_DISABLE_FLUIDS', 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY']
@@ -675,6 +680,7 @@
AutoInclude ( mb )
ManualInclude ( mb )
# here we fixup functions that expect to modifiy their 'passed' variables
+ common_utils.Auto_Functional_Transformation ( main_ns ) #, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] )
ManualTransformations ( mb )
AutoFixes ( mb )
@@ -685,6 +691,22 @@
#
Set_Call_Policies ( mb.global_ns.namespace (MAIN_NAMESPACE) )
+# # for op in main_ns.operators():
+# # print "op1", op
+# # # if op.allow_implicit_conversion:
+# # # print "Implicit conversion on operator ", op
+# # print dir(op)
+# # for op in main_ns.constructors():
+# # print "con1", op
+# # if op.allow_implicit_conversion:
+# # print "Implicit conversion on constructor ", op
+# # print dir(op)
+# # for op in main_ns.free_operators():
+# # print "op2", op
+# # # if op.allow_implicit_conversion:
+# # # print "Implicit conversion on free operator ", op
+# # print dir(op)
+
#
# the manual stuff all done here !!!
#
Modified: trunk/python-ogre/code_generators/nxogre/python_nxogre.h
===================================================================
--- trunk/python-ogre/code_generators/nxogre/python_nxogre.h 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/nxogre/python_nxogre.h 2008-01-08 12:38:37 UTC (rev 534)
@@ -1,6 +1,7 @@
#include "NxOgre.h"
#include "NxOgreSkeleton.h" //missing ??
+#include "NxOgreResourceMesh.h" // not included anywhere by default...
#include "Ogre.h"
#include "OgrePlugin.h"
#include <NxPhysics.h>
Modified: trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h
===================================================================
--- trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h 2008-01-08 12:38:37 UTC (rev 534)
@@ -13,7 +13,7 @@
typedef NxOgre::List<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > ListString;
typedef NxOgre::List<NxOgre::Blueprints::ActorBlueprint*> ListBlueprints;
typedef NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&> ContainerShapeBlueprint;
-typedef NxOgre::Container<std::string, NxOgre::ActorBlueprint> ContainerActorBlueprint;
+//typedef NxOgre::Container<std::string, NxOgre::ActorBlueprint> ContainerActorBlueprint;
//typedef NxOgre::Container<NxOgre::Scene::Renderables, float> ContainerSceneRencerables;
typedef std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,float,std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, float> > >\
MapStrings;
@@ -35,20 +35,20 @@
MapContainerActor;
typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Cloth*>::Containee, std::less<std::string> >\
MapContainerCloth;
-typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Helper*>::Containee, std::less<std::string> >\
- MapContainerHelper;
+// typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Helper*>::Containee, std::less<std::string> >\
+// MapContainerHelper;
typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Joint*>::Containee, std::less<std::string> >\
MapContainerJoint;
typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Material*>::Containee, std::less<std::string> >\
MapContainerMaterial;
typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Character*>::Containee, std::less<std::string> >\
MapContainerCharacter;
-//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Fluid*>::Containee, std::less<std::string> >\
-// MapContainerFluid;
-//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidDrain*>::Containee, std::less<std::string> >\
-// MapContainerFluidDrain;
-//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidEmitter*>::Containee, std::less<std::string> >\
-// MapContainerFluidEmitter;
+typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Fluid*>::Containee, std::less<std::string> >\
+ MapContainerFluid;
+typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidDrain*>::Containee, std::less<std::string> >\
+ MapContainerFluidDrain;
+typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidEmitter*>::Containee, std::less<std::string> >\
+ MapContainerFluidEmitter;
typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::SoftBody*>::Containee, std::less<std::string> >\
MapContainerSoftBody;
@@ -92,21 +92,31 @@
typedef NxOgre::List<NxOgre::Wheel*> Wheels;
typedef NxOgre::Container<NxOgre::NxString, NxOgre::Character*> Characters;
typedef NxOgre::List<NxOgre::CharacterHitReport*> CharacterHitReports;
-//typedef NxOgre::Container<NxOgre::NxString, NxOgre::Fluid*> Fluids;
-//typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidDrain*> FluidDrains;
-//typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidEmitter*> FluidEmitters;
+typedef NxOgre::Container<NxOgre::NxString, NxOgre::Fluid*> Fluids;
+typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidDrain*> FluidDrains;
+typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidEmitter*> FluidEmitters;
typedef NxOgre::Container<NxOgre::NxString, NxOgre::SoftBody*> SoftBodies;
typedef std::pair<NxOgre::NxString,NxOgre::NxString> Parameter;
typedef std::vector<Parameter> Parameters;
typedef Ogre::String NxString;
typedef NxOgre::Container<NxOgre::NxString, NxOgre::Actor*> Actors;
+
+typedef NxOgre::Container<std::string, NxConvexMesh*> NxConvexMeshes;
+typedef NxOgre::Container<std::string, NxTriangleMesh*> NxTriangleMeshes;
+typedef NxOgre::Container<std::string, NxOgre::MaterialAlias*> MaterialAliases;
+
+typedef NxOgre::Container<unsigned int, NxTriangleMesh*> NxTriangleMesheInts;
+typedef NxOgre::Container<unsigned int, NxOgre::ResourceSystem*> ResourceSystemInts;
+typedef NxOgre::Container<unsigned int, NxOgre::MaterialAlias*> MaterialAliasInts;
+typedef NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*> CharacterMovementModelInts;
+
// typedef NxOgre::Container<NxOgre::NxString, ::ActorGroup*> ActorGroups;
// typedef NxOgre::Container<NxOgre::NxActorGroup, NxOgre::ActorGroup*> ActorGroupsByIndex;
typedef NxOgre::Container<NxOgre::NxShapeIndex, NxOgre::Shape*> CollisionModel;
//typedef NxOgre::Container<NxOgre::NxShapeIndex, const NxOgre::ShapeDescription&> CollisionDescriptionModel;
typedef NxOgre::Container<NxOgre::NxString, NxOgre::Cloth*> Cloths;
typedef NxOgre::Container<NxOgre::NxErrorIndex, NxOgre::ErrorReporter*> ErrorReporterList;
-typedef NxOgre::Container<NxOgre::NxString, NxOgre::Helper*> Helpers;
+// // typedef NxOgre::Container<NxOgre::NxString, NxOgre::Helper*> Helpers;
typedef NxOgre::Container<NxOgre::NxString, NxOgre::Joint*> JointsClass;
typedef NxOgre::Container<NxOgre::NxString, NxOgre::Material*> MaterialList;
// typedef NxOgre::Container<NxOgre::NxMaterialIndex, NxOgre::Material*> MaterialListByIndex;
@@ -115,8 +125,8 @@
// typedef std::vector<NxOgre::Feature> FeatureSet;
typedef std::map<std::string, NxOgre::Container<std::string, std::string>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, std::string>::Containee> > >\
MapContainerString;
-typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee> > >\
- MapContainerActorBlueprint;
+//typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::ActorBlueprint>::Containee> > >\
+// MapContainerActorBlueprint;
typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::ForceField*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::ForceField*>::Containee> > >\
MapContainerForceField;
typedef std::map<unsigned, NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&>::Containee, std::less<unsigned>, std::allocator<std::pair<unsigned const, NxOgre::Container<unsigned, NxOgre::ShapeBlueprint const&>::Containee> > >\
@@ -128,4 +138,32 @@
typedef std::map<unsigned, NxOgre::Container<unsigned, NxOgre::Joint*>::Containee, std::less<unsigned>, std::allocator<std::pair<unsigned const, NxOgre::Container<unsigned, NxOgre::Joint*>::Containee> > >\
MapContainerJointContainee;
typedef std::map<unsigned short, NxOgre::Container<unsigned short, NxOgre::DominanceGroup*>::Containee, std::less<unsigned short>, std::allocator<std::pair<unsigned short const, NxOgre::Container<unsigned short, NxOgre::DominanceGroup*>::Containee> > >\
- MapContainerDominanceGroupContainee;
+ MapContainerDominanceGroupContainee;
+
+typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::ShapeBlueprint*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::ShapeBlueprint*>::Containee> > >\
+ MapContainerShapeBluePrint;
+typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::Machine*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::Machine*>::Containee> > >\
+ MapContainerMachine;
+typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::Wheel*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::Wheel*>::Containee> > >\
+ MapContainerWheel;
+typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::RenderableSource*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::RenderableSource*>::Containee> > >\
+ MapContainerRenderableSource;
+
+typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee> > >\
+ MapContainerCharacterMovementModel;
+typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee> > >\
+ MapContainerMaterialAlias;
+typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee> > >\
+ MapContainerResourceSystem;
+typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxTriangleMesh*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxTriangleMesh*>::Containee> > >\
+ MapContainerNxTriangleMesh;
+
+typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee> > >\
+ MapStringContainerMaterialAlias;
+typedef std::map<std::string, NxOgre::Container<std::string, NxTriangleMesh*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxTriangleMesh*>::Containee> > >\
+ MapStringContainerNxTriangleMesh;
+typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee> > >\
+ MapStringContainerCharacterMovementModel;
+typedef std::map<std::string, NxOgre::Container<std::string, NxConvexMesh*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxConvexMesh*>::Containee> > >\
+ MapStringContainerNxConvexMesh;
+
\ No newline at end of file
Modified: trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h
===================================================================
--- trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h 2008-01-08 12:38:37 UTC (rev 534)
@@ -1,21 +1,21 @@
-sizeof ( NxControllersHit );
+// sizeof ( NxControllersHit );
sizeof ( NxBoxShapeDesc );
sizeof ( NxPlaneShapeDesc );
sizeof ( NxControllerManager );
-sizeof ( NxControllerShapeHit );
+// sizeof ( NxControllerShapeHit );
sizeof ( NxPruningStructure );
sizeof ( NxVec3 );
sizeof ( NxSceneLimits );
sizeof ( NxWheelShapeDesc );
-sizeof ( NxController );
+// sizeof ( NxController );
sizeof ( NxUserRaycastReport );
-sizeof ( NxControllerAction );
+// sizeof ( NxControllerAction );
sizeof ( NxWheelShape );
sizeof ( NxHeightFieldShapeDesc );
sizeof ( NxClothMesh );
sizeof ( NxConvexShapeDesc );
sizeof ( NxMeshData );
-//sizeof ( NxFluid );
+sizeof ( NxFluid );
sizeof ( NxHeightFieldAxis );
sizeof ( NxTriangleMeshShapeDesc );
sizeof ( NxTriangleMesh );
@@ -27,7 +27,7 @@
sizeof ( NxHeightField );
sizeof ( NxUserContactReport );
//sizeof ( NxOgre::FluidDrain );
-//sizeof ( NxImplicitScreenMesh );
+sizeof ( NxImplicitScreenMesh );
sizeof ( NxMemoryType );
sizeof ( NxJointState );
sizeof ( NxBounds3 );
@@ -45,14 +45,15 @@
sizeof ( NxContactPair );
sizeof ( NxSceneLimits );
sizeof ( NxWheelShape );
-sizeof ( NxUserControllerHitReport );
+// sizeof ( NxUserControllerHitReport );
sizeof ( NxSceneDesc );
sizeof ( NxScene );
sizeof ( NxPhysicsSDK );
sizeof ( NxShape );
sizeof ( NxGroupsMask );
-sizeof ( NxControllersHit );
-
+// sizeof ( NxControllersHit );
+sizeof ( JointCallback );
+sizeof ( JointCallback::JointBreakCallback );
sizeof(std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >);
sizeof ( std::pair<std::string, std::string> );
Modified: trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h
===================================================================
--- trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/code_generators/ogreode/python_ogreode_aliases.h 2008-01-08 12:38:37 UTC (rev 534)
@@ -1,5 +1,8 @@
-#include "../ogre/python_ogre_aliases.h"
+// #include "../ogre/python_ogre_aliases.h"
+typedef std::list<Ogre::Plane> StdListPlane;
+typedef std::map< std::string, std::string > StdMapStringString;
+typedef std::vector< std::string > StdVectorString;
typedef OgreOde::CircularBuffer<OgreOde::BodyState*> CircularBufferBodyStatePtr;
typedef OgreOde::MaintainedList<OgreOde::Geometry> MaintainedListGeometry;
Modified: trunk/python-ogre/demos/ogre/Demo_Water.py
===================================================================
--- trunk/python-ogre/demos/ogre/Demo_Water.py 2008-01-08 03:38:13 UTC (rev 533)
+++ trunk/python-ogre/demos/ogre/Demo_Water.py 2008-01-08 12:38:37 UTC (rev 534)
@@ -20,7 +20,8 @@
#include "ExampleApplication.h"
import ogre.renderer.OGRE as Ogre
import ogre.io.OIS as OIS
-import WaterMesh as WaterMesh
+#import WaterMesh as WaterMesh
+import ogre.addons.watermesh as WaterMesh
import math
import SampleFramework as sf
import random
@@ -39,7 +40,7 @@
RAIN_HEIGHT_RANDOM = 5
RAIN_HEIGHT_CONSTANT = 5
-circles_MATERIAL ="Examples/Water/self.circles"
+circles_MATERIAL ="Examples/Water/Circles"
##
## Note that this function makes use of CTypes and def ptr casting to access Ogre Library functions
@@ -89,172 +90,164 @@
-# /* =========================================================================*/
-# /* WaterCircle class */
-# /* =========================================================================*/
-CIRCLE_SIZE = 500.0
-CIRCLE_TIME = 0.5
-class WaterCircle:
- def __init_(self):
- self.name = ""
-# SceneNode *node
-# MeshPtr mesh
-# SubMesh *subMesh
-# Entity *entity
-# Real tm
-# static bool first
-# ## some buffers shared by all self.circles
-# static HardwareVertexBufferSharedPtr posnormVertexBuffer
-# static HardwareIndexBufferSharedPtr indexBuffer ## indices for 2 faces
-# static HardwareVertexBufferSharedPtr *texcoordsVertexBuffers
-
-# float *texBufData
- self.headNode = None
- self.waterOverlay = None
- self.particleSystem = None
- self.particleEmitter = None
- self.sceneMgr = None
+# # # # /* =========================================================================*/
+# # # # /* WaterCircle class */
+# # # # /* =========================================================================*/
+# # # CIRCLE_SIZE = 500.0
+# # # CIRCLE_TIME = 0.5
+# # # class WaterCircle:
+# # #
+# # #
+# # # def _prepareMesh(self ):
+# # #
+# # # mesh = Ogre.MeshManager.getSingleton().createManual(self.name,
+# # # Ogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)
+# # # subMesh = mesh.createSubMesh()
+# # # subMesh.useSharedVertices=False
+# # # numVertices = 4
+# # # first = True
+# # #
+# # # if (first) : ## first Circle, create some static common data:
+# # # first = False
+# # #
+# # # ## static buffer for position and normals
+# # # size = 2 * Ogre.VertexElement.getTypeSize(Ogre.VertexElementType.VET_FLOAT3) ## 6 * float
+# # # posnormVertexBuffer = \
+# # # Ogre.HardwareBufferManager.getSingleton().createVertexBuffer(
+# # # size, ## size of one vertex data 6 * float
+# # # 4, ## number of vertices
+# # # Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY, ## usage
+# # # False) ## no shadow buffer
+# # # posnormBufData = posnormVertexBuffer.lock(Ogre.HardwareBuffer.HBL_DISCARD)
+# # #
+# # # buf=[]
+# # # for i in range(numVertices):
+# # # buf.append(((i%2)-0.5)*CIRCLE_SIZE ) ## pos X
+# # # buf.append(0) ## pos Y
+# # # buf.append(((i/2)-0.5)*CIRCLE_SIZE ) ## pos Z
+# # # buf.append(0) ## normal X
+# # # buf.append(1) ## normal Y
+# # # buf.append(0) ## normal Z
+# # # Ogre.setFloat( posnormBufData , buf ) # write unsigned ints...
+# # # posnormVertexBuffer.unlock()
+# # #
+# # # ## static buffers for 16 sets of texture coordinates
+# # # texcoordsVertexBuffers = []
+# # # for lvl in range (16):
+# # # texcoordsVertexBuffers.append(
+# # # Ogre.HardwareBufferManager.getSingleton().createVertexBuffer(
+# # # Ogre.VertexElement.getTypeSize(Ogre.VertexElementType.VET_FLOAT2), ## size of one vertex data
+# # # numVertices, ## number of vertices
+# # # Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY, ## usage
+# # # False) ## no shadow buffer
+# # # )
+# # # texcoordsBufData = texcoordsVertexBuffers[lvl].lock(Ogre.HardwareBuffer.HBL_DISCARD)
+# # # x0 = (lvl % 4) * 0.25
+# # # y0 = (lvl / 4) * 0.25
+# # # y0 = 0.75-y0 ## upside down
+# # # # # # # for i in range (4):
+# # # # # # # texcoordsBufData[i*2 + 0]= \
+# # # # # # # x0 + 0.25 * (i%2)
+# # # # # # # texcoordsBufData[i*2 + 1]= \
+# # # # # # # y0 + 0.25 * (i/2)
+# # #
+# # # texcoordsVertexBuffers[lvl].unlock()
+# # #
+# # #
+# # # ## Index buffer for 2 faces
+# # # faces = []
+# # # faces[:]= (2,1,0,2,3,1)
+# # # indexBuffer = \
+# # # Ogre.HardwareBufferManager.getSingleton().createIndexBuffer(
+# # # Ogre.HardwareIndexBuffer.IT_16BIT,
+# # # 6,
+# # # Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY)
+# # # # # # # indexBuffer.writeData(0,
+# # # # # # # indexBuffer.getSizeInBytes(),
+# # # # # # # faces,
+# # # # # # # True) ## true?
+# # #
+# # #
+# # # ## Initialize vertex data
+# # # subMesh.vertexData = Ogre.VertexData()
+# # # subMesh.vertexData.vertexStart = 0
+# # # subMesh.vertexData.vertexCount = 4
+# # # ## first, set vertex buffer bindings
+# # # vbind = subMesh.vertexData.vertexBufferBinding
+# # # vbind.setBinding(0, posnormVertexBuffer)
+# # # vbind.setBinding(1, texcoordsVertexBuffers[0])
+# # # ## now, set vertex buffer declaration
+# # # vdecl = subMesh.vertexData.vertexDeclaration
+# # # vdecl.addElement(0, 0, Ogre.VET_FLOAT3, Ogre.VES_POSITION)
+# # # vdecl.addElement(0, 3*4, Ogre.VET_FLOAT3, Ogre.VES_NORMAL)
+# # # vdecl.addElement(1, 0, Ogre.VET_FLOAT2, Ogre.VES_TEXTURE_COORDINATES)
+# # #
+# # # ## Initialize index data
+# # # subMesh.indexData.indexBuffer = indexBuffer
+# # # subMesh.indexData.indexStart = 0
+# # # subMesh.indexData.indexCount = 6
+# # #
+# # # ## set mesh bounds
+# # # circleBounds= Ogre.AxisAlignedBox (-CIRCLE_SIZE/2.0, 0, -CIRCLE_SIZE/2.0,
+# # # CIRCLE_SIZE/2.0, 0, CIRCLE_SIZE/2.0)
+# # # mesh._setBounds(circleBounds)
+# # # mesh.load()
+# # # mesh.touch()
+# # #
+# # # def setTextureLevel():
+# # # subMesh.vertexData.vertexBufferBinding.setBinding(1, texcoordsVertexBuffers[lvl])
+# # #
+# # # def __init__( self, name, x, y):
+# # # # static HardwareVertexBufferSharedPtr posnormVertexBuffer
+# # # # static HardwareIndexBufferSharedPtr indexBuffer ## indices for 2 faces
+# # # # static HardwareVertexBufferSharedPtr *texcoordsVertexBuffers
+# # #
+# # # self.headNode = None
+# # # self.waterOverlay = None
+# # # self.particleSystem = None
+# # # self.particleEmitter = None
+# # # self.sceneMgr = None
+# # # self.name = name
+# # # self._prepareMesh()
+# # #
+# # # node = self.sceneMgr.getRootSceneNode().createChild(name)
+# # # node.translate(x*(PLANE_SIZE/COMPLEXITY), 10, y*(PLANE_SIZE/COMPLEXITY))
+# # # entity = self.sceneMgr.createEntity(name, name)
+# # # entity.setMaterialName(self.circles_MATERIAL)
+# # # node.attachObject(entity)
+# # # tm = 0
+# # # lvl = 0
+# # # setTextureLevel()
+# # #
+# # # def __del__(self, ):
+# # # Ogre.MeshManager.getSingleton().remove(mesh.getHandle())
+# # # self.sceneMgr.destroyEntity(entity.getName())
+# # # self.sceneMgr.getRootSceneNode().removeChildnode.getName()
+# # #
+# # # def animate(self, timeSinceLastFrame):
+# # # lastlvl = lvl
+# # # tm += timeSinceLastFrame
+# # # lvl = (int) ( (Real)(tm)/CIRCLE_TIME * 16 )
+# # # if (lvl<16 and lvl!=lastlvl) :
+# # # setTextureLevel()
+# # #
+# # #
+# # # def clearStaticBuffers(self):
+# # # posnormVertexBuffer = Ogre.HardwareVertexBufferSharedPtr()
+# # # indexBuffer = Ogre.HardwareIndexBufferSharedPtr()
+# # # for i in range (16):
+# # # texcoordsVertexBuffers[i] = Ogre.HardwareVertexBufferSharedPtr()
+# # #
+# # # del texcoordsVertexBuffers
+# # #
+# # #
+# # # # bool WaterCircle.first = True
+# # # # HardwareVertexBufferSharedPtr WaterCircle.posnormVertexBuffer =
+# # # # HardwareVertexBufferSharedPtr()
+# # # # HardwareIndexBufferSharedPtr WaterCircle.indexBuffer =
+# # # # HardwareIndexBufferSharedPtr()
+# # # # HardwareVertexBufferSharedPtr* WaterCircle.texcoordsVertexBuffers = 0
- _prepareMesh()
-
- mesh = Ogre.MeshManager.getSingleton().createManual(name,
- Ogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)
- subMesh = mesh.createSubMesh()
- subMesh.useSharedVertices=False
- numVertices = 4
- first = True
-
- if (first) : ## first Circle, create some static common data:
- first = False
-
- ## static buffer for position and normals
- size = 2 * Ogre.VertexElement.getTypeSize(Ogre.VertexElementType.VET_FLOAT3) ## 6 * float
- posnormVertexBuffer = \
- Ogre.HardwareBufferManager.getSingleton().createVertexBuffer(
- size, ## size of one vertex data 6 * float
- 4, ## number of vertices
- Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY, ## usage
- False) ## no shadow buffer
- posnormBufData = posnormVertexBuffer.lock(Ogre.HardwareBuffer.HBL_DISCARD)
-
- buff=[]
- for i in range(numVertices):
- buf.append(((i%2)-0.5)*CIRCLE_SIZE ) ## pos X
- buf.append(0) ## pos Y
- buf.append(((i/2)-0.5)*CIRCLE_SIZE ) ## pos Z
- buf.append(0) ## normal X
- buf.append(1) ## normal Y
- buf.append(0) ## normal Z
- Ogre.setFloat( posnormBufData , buff ) # write unsigned ints...
- posnormVertexBuffer.unlock()
-
- ## static buffers for 16 sets of texture coordinates
- texcoordsVertexBuffers = []
- for lvl in range (16):
- texcoordsVertexBuffers.append(
- Ogre.HardwareBufferManager.getSingleton().createVertexBuffer(
- Ogre.VertexElement.getTypeSize(Ogre.VertexElementType.VET_FLOAT2), ## size of one vertex data
- numVertices, ## number of vertices
- Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY, ## usage
- False) ## no shadow buffer
- )
- texcoordsBufData = texcoordsVertexBuffers[lvl].lock(Ogre.HardwareBuffer.HBL_DISCARD)
- x0 = (lvl % 4) * 0.25
- y0 = (lvl / 4) * 0.25
- y0 = 0.75-y0 ## upside down
- for i in range (4):
- texcoordsBufData[i*2 + 0]= \
- x0 + 0.25 * (i%2)
- texcoordsBufData[i*2 + 1]= \
- y0 + 0.25 * (i/2)
-
- texcoordsVertexBuffers[lvl].unlock()
-
-
- ## Index buffer for 2 faces
- faces[6] = (2,1,0, 2,3,1)
- indexBuffer = \
- Ogre.HardwareBufferManager.getSingleton().createIndexBuffer(
- Ogre.HardwareIndexBuffer.IT_16BIT,
- 6,
- Ogre.HardwareBuffer.HBU_STATIC_WRITE_ONLY)
- indexBuffer.writeData(0,
- indexBuffer.getSizeInBytes(),
- faces,
- True) ## true?
-
-
- ## Initialize vertex data
- subMesh.vertexData = Ogre.VertexData()
- subMesh.vertexData.vertexStart = 0
- subMesh.vertexData.vertexCount = 4
- ## first, set vertex buffer bindings
- vbind = subMesh.vertexData.vertexBufferBinding
- vbind.setBinding(0, posnormVertexBuffer)
- vbind.setBinding(1, texcoordsVertexBuffers[0])
- ## now, set vertex buffer declaration
- vdecl = subMesh.vertexData.vertexDeclaration
- vdecl.addElement(0, 0, Ogre.VET_FLOAT3, VOgre.ES_POSITION)
- vdecl.addElement(0, 3*4, Ogre.VET_FLOAT3, Ogre.VES_NORMAL)
- vdecl.addElement(1, 0, Ogre.VET_FLOAT2, Ogre.VES_TEXTURE_COORDINATES)
-
- ## Initialize index data
- subMesh.indexData.indexBuffer = indexBuffer
- subMesh.indexData.indexStart = 0
- subMesh.indexData.indexCount = 6
-
- ## set mesh bounds
- circleBounds(-CIRCLE_SIZE/2.0, 0, -CIRCLE_SIZE/2.0,
- CIRCLE_SIZE/2.0, 0, CIRCLE_SIZE/2.0)
- mesh._setBounds(circleBounds)
- mesh.load()
- mesh.touch()
-
- def setTextureLevel():
- subMesh.vertexData.vertexBufferBinding.setBinding(1, texcoordsVertexBuffers[lvl])
-
- def WaterCircle( name, x, y):
-
- self.name = name
- _prepareMesh()
- node = self.sceneMgr.getRootSceneNode().createChild(name)
- node.translate(x*(PLANE_SIZE/COMPLEXITY), 10, y*(PLANE_SIZE/COMPLEXITY))
- entity = self.sceneMgr.createEntity(name, name)
- entity.setMaterialName(self.circles_MATERIAL)
- node.attachObject(entity)
- tm = 0
- lvl = 0
- setTextureLevel()
-
- def __del__(self, ):
- Ogre.MeshManager.getSingleton().remove(mesh.getHandle())
- self.sceneMgr.destroyEntity(entity.getName())
- self.sceneMgr.getRootSceneNode().removeChildnode.getName()
-
- def animate(self, timeSinceLastFrame):
- lastlvl = lvl
- tm += timeSinceLastFrame
- lvl = (int) ( (Real)(tm)/CIRCLE_TIME * 16 )
- if (lvl<16 and lvl!=lastlvl) :
- setTextureLevel()
-
-
- def clearStaticBuffers(self):
- posnormVertexBuffer = Ogre.HardwareVertexBufferSharedPtr()
- indexBuffer = Ogre.HardwareIndexBufferSharedPtr()
- for i in range (16):
- texcoordsVertexBuffers[i] = Ogre.HardwareVertexBufferSharedPtr()
-
- del texcoordsVertexBuffers
-
-
-# bool WaterCircle.first = True
-# HardwareVertexBufferSharedPtr WaterCircle.posnormVertexBuffer =
-# HardwareVertexBufferSharedPtr()
-# HardwareIndexBufferSharedPtr WaterCircle.indexBuffer =
-# HardwareIndexBufferSharedPtr()
-# HardwareVertexBufferSharedPtr* WaterCircle.texcoordsVertexBuffers = 0
-
# /* =========================================================================*/
# /* WaterListener class */
# /* =========================================================================*/
@@ -264,8 +257,17 @@
def processcircles(self,timeSinceLastFrame):
for i in self.circles :
- self.circles[i].animate(timeSinceLastFrame)
-
+ i.animate(timeSinceLastFrame)
+ found = False
+# while not found:
+ for count in range (len(self.circles)):
+ if self.circles[count].lvl >= 16:
+ c = self.circles[count]
+ del self.circles[count]
+ del c
+ found = True
+ break
+
# # # do :
# # # found = False
# # # for it = self.circles :
@@ -310,9 +312,9 @@
if (y>COMPLEXITY-1):
y=COMPLEXITY-1
self.WaterMesh.push(x,y,-h)
-# circle = self.WaterCircle( "Circle#"+str(self.pindex), x, y)
-# self.pindex+=1
-# self.circles.push_back(circle)
+ circle = WaterMesh.WaterCircle( "Circle#"+str(self.pindex), x, y, self.app.sceneManager)
+ self.pindex+=1
+ self.circles.append(circle)
@@ -489,31 +491,32 @@
_macro
- ADJUST_RANGE(self.headDepth, OIS.KC_U, OIS.KC_J, 0, 10, 0.5*changeSpeed, self.updateInfoHeadDepth())
-
- ADJUST_RANGE(self.WaterMesh.PARAM_C, OIS.KC_2, OIS.KC_1, 0, 10, 0.1*changeSpeed, self.updateInfoParamC())
-
- ADJUST_RANGE(self.WaterMesh.PARAM_D, OIS.KC_4, OIS.KC_3, 0.1, 10, 0.1*changeSpeed, self.updateInfoParamD())
-
- ADJUST_RANGE(self.WaterMesh.PARAM_U, OIS.KC_6, OIS.KC_5, -2, 10, 0.1*changeSpeed, self.updateInfoParamU())
-
- ADJUST_RANGE(self.WaterMesh.PARAM_T, OIS.KC_8, OIS.KC_7, 0, 10, 0.1*changeSpeed, self.updateInfoParamT())
-
+# ADJUST_RANGE(self.headDepth, OIS.KC_U, OIS.KC_J, 0, 10, 0.5*changeSpeed, self.updateInfoHeadDepth())
+#
+# ADJUST_RANGE(self.WaterMesh.PARAM_C, OIS.KC_2, OIS.KC_1, 0, 10, 0.1*changeSpeed, self.updateInfoParamC())
+#
+# ADJUST_RANGE(self.WaterMesh.PARAM_D, OIS.KC_4, OIS.KC_3, 0.1, 10, 0.1*changeSpeed, self.updateInfoParamD())
+#
+# ADJUST_RANGE(self.WaterMesh.PARAM_U, OIS.KC_6, OIS.KC_5, -2, 10, 0.1*changeSpeed, self.updateInfoParamU())
+#
+# ADJUST_RANGE(self.WaterMesh.PARAM_T, OIS.KC_8, OIS.KC_7, 0, 10, 0.1*changeSpeed, self.updateInfoParamT())
+#
self.timeoutDelay-=evt.timeSinceLastFrame
if (self.timeoutDelay<=0):
self.timeoutDelay = 0
def SWITCH_VALUE(_key,_timeDelay, _macro):
- if (self.Keyboard.isKeyDown(_key) and self.timeoutDelay==0) :
+ res = self.Keyboard.isKeyDown(_key)
+ if self.Keyboard.isKeyDown(_key) and self.timeoutDelay==0 :
self.timeoutDelay = _timeDelay
- _macro
+ _macro ()
- SWITCH_VALUE(OIS.KC_N, 0.5, self.switchNormals())
+ SWITCH_VALUE(OIS.KC_N, 0.5, self.switchNormals)
- SWITCH_VALUE(OIS.KC_M, 0.5, self.switchMaterial())
+ SWITCH_VALUE(OIS.KC_M, 0.5, self.switchMaterial)
- SWITCH_VALUE(OIS.KC_B, 0.5, self.switchSkyBox())
-
+ SWITCH_VALUE(OIS.KC_B, 0.5, self.switchSkyBox)
+
self.animateHead(evt.timeSinceLastFrame)
self.WaterMesh.updateMesh(evt.timeSinceLastFrame)
@@ -527,7 +530,6 @@
## Just override the mandatory create scene method
def _createScene(self):
global PLANE_SIZE, MESH_NAME, COMPLEXITY, ENTITY_NAME
- print "\n\n\n***********"
sceneManager = self.sceneManager
camera = self.camera
## Set ambient light
@@ -544,7 +546,7 @@
## self.waterEntity.setMaterialName(MATERIAL_NAME)
waterNode = sceneManager.getRootSceneNode().createChildSceneNode()
-# waterNode.attachObject(self.waterEntity)
+ waterNode.attachObject(self.waterEntity)
## Add a head, give it it's own node
self.headNode = waterNode.createChildSceneNode()
@@ -602,12 +604,11 @@
## Fast-forward the rain so it looks more natural
self.particleSystem.fastForward(20)
## It can't be set in .particle file, and we need it )
-# static_cast<BillboardParticleRenderer*>(self.particleSystem.getRenderer()).setBillboardOrigin(BBO_BOTTOM_CENTER)
+ self.particleSystem.getRenderer().setBillboardOrigin(Ogre.BBO_BOTTOM_CENTER)
- prepareCircleMaterial()
- print "\n\n\n***********"
+ WaterMesh.prepareCircleMaterial()
+
-
# ## Create new frame listener
def _createFrameListener(self):
self.frameListener = WaterListener(self.renderWindow, self.camera,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|