Google

Softbody support - New bindings

A discussion on Python-Ogre, the library which allows you to drive OGRE directly from Python

Moderators: OGRE Team, Python-Ogre Moderators

Re: Softbody support - New bindings

Postby igrok » Sun Oct 16, 2011 2:24 am

I would also like to register my gratitude. Using dermont's patch I was able to build Bullet 2.79 (rev2440) and run the bullet demos. This was particularly helpful as the stock bullet (r2243) was reporting symbol errors while loading.
User avatar
igrok
Gnoblar
 
Posts: 11
Kudos: 0
Joined: 01 Feb 2009
Location: Boston, MA

Re: Softbody support - New bindings

Postby dermont » Sat Oct 22, 2011 7:13 pm

Some more updates for bullet:
https://sourceforge.net/tracker/downloa ... id=3422961

a) Number fixes for btAlignedObjectArray classes
b) Update bullet.makeSoftBody so it works properly (??)
Code: Select all
### ---------------------------------
class CTypeOgreMesh():
### ---------------------------------
    def __init__(self, numtriangles, numvertices, gVertices, gTriangles ):
        ''' Create ctypes bullet trimesh '''
        self.NUM_TRIANGLES = numtriangles
        self.NUM_INDICES = numtriangles*3
        self.NUM_VERTICES = numvertices*3

        storageclass2 = ctypes.c_ulong * self.NUM_INDICES
        indices=storageclass2(0)
        ctypes.memset ( indices, 0, self.NUM_INDICES )

        ind = 0
        for f in gTriangles:
            indices[ind] = f[0]
            indices[ind+1] = f[1]
            indices[ind+2] = f[2]
            print f[0],f[1],f[2]
            ind+=3
   
        storageclass = ctypes.c_float * self.NUM_VERTICES
        vertices=storageclass(0.0)
        ctypes.memset ( vertices, 0, self.NUM_VERTICES )
        ind=0
        for v in gVertices:
            vertices[ind]=v[0]
            vertices[ind+1]=v[1]
            vertices[ind+2]=v[2]
            ind+=3

        ''' Need to store mesh indices/vertices whilst being used by bullet '''
        self.indices = indices
        self.vertices = vertices

    def __del__(self):
        del self.indices
        del self.vertices

.....

    def _convertVerticesToBullet(self, vertices, remove_duplicates=False):
        '''Convert flat float vertex array into array of bullet vectors'''
        v = vertices
        if remove_duplicates:
            v = list(set(vertices))

        return[ bullet.btVector3(v[i][0],v[i][1],v[i][2] )
                for i in range(len(v)) ]

    def createTriMeshSBFromHelper(self, m_softBodyWorldInfo):
        unqv = list(set(self.vertices))

        def lookup_index(tri_ind):
            return unqv.index(self.vertices[tri_ind])

        tris = []
        for tr in self.triangles:
            i1 = lookup_index(tr[0])
            i2 = lookup_index(tr[1])
            i3 = lookup_index(tr[2])
            tris.append((i1,i2,i3))

        c = CTypeOgreMesh(
            len(tris),
            len(unqv),
            unqv,
            tris )
        self.ctypesmeshes.append(c)
        psb=bullet.btSoftBodyHelpers.CreateFromTriMesh(
            m_softBodyWorldInfo,
            ctypes.addressof(c.vertices),
            ctypes.addressof(c.indices),
            c.NUM_TRIANGLES,True)
        return psb

    def createTriMeshSBManual(self, m_softBodyWorldInfo):
        ''' Manually add faces to soft body'''
        v = self._convertVerticesToBullet(self.vertices)
        unqv = list(set(self.vertices))
        psb = bullet.makeSoftBody(m_softBodyWorldInfo,len(unqv), self._convertVerticesToBullet(unqv), [])

        def lookup_index(tri_ind):
            return unqv.index(self.vertices[tri_ind])

        #tris = []
        for tr in self.triangles:
            i1 = lookup_index(tr[0])
            i2 = lookup_index(tr[1])
            i3 = lookup_index(tr[2])
            psb.appendFace(i1,i2,i3)
            psb.appendLink(i1,i2)
            psb.appendLink(i2,i3)
            psb.appendLink(i3,i1)
        return psb


c) Renamed tArray<class_name> classes to btAlignedObjectArray_<classname> as
per rest of Array classes
d) Added bullet.HullLibrary and makeHullDesc convenience function,e.g:
bullet.makeHullDesc(bullet.QF_DEFAULT ,len(newverts), newverts, sizeof_btVector3)
Code: Select all
import sys
sys.path.insert(0,'..')
import PythonOgreConfig

import ogre.renderer.OGRE as ogre
import SampleFramework as sf

import ogre.sound.ogreoggsound as sound
import ogre.physics.bullet as bullet
import ogre.physics.btogre as btogre
import ogre.io.OIS as OIS

import os
import time
import random
import ctypes

def GetIndices ( indexData ) :
    outbuff = []
    numTris = indexData.indexCount
    if numTris == 0 : return outbuff
    else : numTris /= 3
       
    ibuf = indexData.indexBuffer
    if ibuf.getType() == ogre.HardwareIndexBuffer.IT_32BIT:
        Use32Bit = True
    else: Use32Bit = False
       
    buffer = ibuf.lock(ogre.HardwareBuffer.HBL_READ_ONLY)
    address = ogre.castAsInt ( buffer )
           
    for i in range( numTris ):
        if Use32Bit:
            l = ogre.getUint32 ( ogre.castAsVoidPtr ( address ), 3 )
            address += ibuf.getIndexSize() * 3
        else:
            l = ogre.getUint16 ( ogre.castAsVoidPtr ( address ), 3 )
            address += ibuf.getIndexSize() * 3
        #outbuff.append(tuple(l))
        outbuff.append((l[0],l[1],l[2]))
    ibuf.unlock()
    return outbuff


def GetVertices ( vertex_data, transform ) :
    outbuff = []
    # get the start of the element
    posElem = vertex_data.vertexDeclaration.findElementBySemantic(ogre.VertexElementSemantic.VES_POSITION)
    vbuf = vertex_data.vertexBufferBinding.getBuffer(posElem.getSource())
       
    # get the start of the actual buffer
    vertex = vbuf.lock(ogre.HardwareBuffer.HBL_READ_ONLY)
    # what we need is the actual address of the buffer, so we have to check if there's an offset as well
    # the is basically what baseVertexPointerToElement does
    newaddress = posElem.getOffset() + ogre.castAsInt(vertex) # note the cast to int to get the address
    for i in range (vertex_data.vertexCount):
        points = ogre.getFloat( ogre.castAsVoidPtr ( newaddress), 3 ) # note the getFloat and Cast back to a pointer :)

        #_transform
        vec = transform * ogre.Vector3(points[0],points[1],points[2])
        outbuff.append(tuple((vec.x,vec.y,vec.z)))
        #self.boundingbox.merge(vec)
        newaddress += vbuf.getVertexSize()
    vbuf.unlock()
    return outbuff


## -----------------------------------------------------------------
class DebugObject(ogre.ManualObject):
## -----------------------------------------------------------------
    def __init__(self, name, entity):
        ogre.ManualObject.__init__(self,name)
        self.setRenderQueueGroup(ogre.RENDER_QUEUE_6 )

        renderop = ogre.RenderOperation.OT_LINE_LIST
##            ogre.RenderOperation.OT_POINT_LIST,
##            ogre.RenderOperation.OT_TRIANGLE_LIST]
           
        groupsubMesh = True

        ### create debug materials
        mat = ogre.MaterialManager.getSingleton().create('debug',"General")
        r,g,b = (1,0,0)
        mat.setReceiveShadows(False)
        mat.getTechnique(0).setLightingEnabled(True)
        mat.getTechnique(0).getPass(0).setSelfIllumination(r,g,b)
        mat.getTechnique(0).getPass(0).setDiffuse(r,g,b,1.0)
        mat.getTechnique(0).getPass(0).setAmbient(r,g,b)
        mat.getTechnique(0).getPass(0).setShininess(110)
        mat.getTechnique(0).getPass(0).setDepthBias(1.0)

        sizeof_btVector3=16
        vertices=[]   
        triangles=[]   
        for i in range(entity.getMesh().numSubMeshes):
            sm = entity.getMesh().getSubMesh(i)
            ## retrieve vertex and index data
            vertices+= GetVertices (
                sm.vertexData,
                entity.getParentSceneNode()._getFullTransform())
            triangles+= GetIndices (
                sm.indexData)

        newverts = []
        for t in triangles:
            v1 = vertices[t[0]]
            v2 = vertices[t[1]]
            v3 = vertices[t[2]]
            newverts.append( bullet.btVector3( v1[0], v1[1], v1[2]) )
            newverts.append( bullet.btVector3( v2[0], v2[1], v2[2]) )
            newverts.append( bullet.btVector3( v3[0], v3[1], v3[2]) )
         
        hdsc = bullet.makeHullDesc(bullet.QF_DEFAULT ,len(newverts), newverts, sizeof_btVector3)

        ## manually create our convex hull
        hlib = bullet.HullLibrary()
        hdsc.mMaxVertices=len(newverts) #100 - set to your own value to reduce vertices
        hres = bullet.HullResult()
        hlib.CreateConvexHull(hdsc,hres)
        print dir(hlib)
        print "Number Hull Faces "     , hres.mNumFaces
        print "Number Hull Vertices "  , hres.mNumOutputVertices
        print "Vertex Stride "    , hdsc.mVertexStride
        print "Num Input Vertices " , hdsc.mVcount
        print "Max Num Vertices Considered" , hdsc.mMaxVertices
        print "Max Num Faces Considered" , hdsc.mMaxFaces
        print "Duplicate Epsilon" , hdsc.mNormalEpsilon

        self.begin(mat.getName() , renderop )

        if renderop == ogre.RenderOperation.OT_TRIANGLE_LIST:
            for i in range(hres.m_OutputVertices.size()):
                v = hres.m_OutputVertices[i]
                self.position(v.x(), v.y(), v.z())
            for i in range(hres.mNumFaces):
                self.triangle(
                    hres.m_Indices[i*3+0],
                    hres.m_Indices[i*3+1],
                    hres.m_Indices[i*3+2] )
        elif renderop == ogre.RenderOperation.OT_LINE_LIST:
            ## retrieve face vertices
            for i in range(hres.mNumFaces):
                v1 = hres.m_OutputVertices[hres.m_Indices[i*3+ 0]]
                v2 = hres.m_OutputVertices[hres.m_Indices[i*3+ 1]]
                v3 = hres.m_OutputVertices[hres.m_Indices[i*3+ 2]]

                self.position(v1.x(), v1.y(), v1.z())
                self.position(v2.x(), v2.y(), v2.z())

                self.position(v2.x(), v2.y(), v2.z())
                self.position(v3.x(), v3.y(), v3.z())

                self.position(v3.x(), v3.y(), v3.z())
                self.position(v1.x(), v1.y(), v1.z())
        self.end()

        ## cleanup
        hlib.ReleaseResult(hres)
        del hres
        del hlib
        del hdsc
        del vertices
        del triangles
        del newverts

    def __del__(self):
        n = self.getParentSceneNode()
        n.detachObject(self)
        #ogre.ManualObject.__del__(self)

class EdgesApplication(sf.Application):
    def __init__(self):
        sf.Application.__init__(self)
        self.debugObject = None

    def __del__(self):
        del self.debugObject
        sf.Application.__del__(self)

    def _createScene(self):
        sceneManager = self.sceneManager
        camera = self.camera
        ogre.Animation.setDefaultInterpolationMode(ogre.Animation.IM_SPLINE)
        sceneManager.AmbientLight = ogre.ColourValue(0.9, 0.9, 0.9)

        entity = sceneManager.createEntity('head', 'ogrehead.mesh')
        node = sceneManager.getRootSceneNode().createChildSceneNode(ogre.Vector3(-30, 0, 0))
        node.attachObject(entity)
        node.scale(10.7,10.7,10.7)
        self.entity = entity
        #self.entity.setVisible(False)
   
        light = sceneManager.createLight('BlueLight')
        light.setPosition (-200, -80, -100)
        light.setDiffuseColour (ogre.ColourValue(0.5, 0.5, 1.0) )

        light = sceneManager.createLight('GreenLight')
        light.setPosition (0, 0, -100)
        light.setDiffuseColour (0.5, 1.0, 0.5)

        self.debugObject = DebugObject("TEST", entity)
        n = self.sceneManager.getRootSceneNode().createChildSceneNode()
        n.attachObject(self.debugObject)
        n.scale(1.01,1.01,1.01)

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

class SkeletalAnimationFrameListener(sf.FrameListener):
    def __init__(self, renderWindow, camera):
        sf.FrameListener.__init__(self, renderWindow, camera)

    def frameStarted(self, frameEvent):
        return sf.FrameListener.frameStarted(self, frameEvent)

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

dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

Re: Softbody support - New bindings

Postby thios » Mon Oct 24, 2011 8:50 am

Thank you!
thios
Gnoblar
 
Posts: 19
Kudos: 0
Joined: 05 Feb 2011

Re: Softbody support - New bindings

Postby dermont » Thu Mar 29, 2012 7:35 am

For anyone still using python-ogre/bullet some minor updates for latest version bullet-2.80-rev2527.

Replace code_generators/bullet with contents of bullet-2.80-rev2527.tar.bz2, update bullet module in environment.py (version = "2.80") and generate/compile etc. Also update, if soft body support required, packages_2.7/physics/bullet/__init__.py (example included) for some soft body variables:

packages_2.7/physics/bullet/__init__.py
Code: Select all
from _bullet_ import *
import sys
SIMD_2_PI =6.283185307179586232
SIMD_PI   = SIMD_2_PI * 0.5
SIMD_HALF_PI  = SIMD_2_PI * 0.25
SIMD_RADS_PER_DEG = SIMD_2_PI / 360.0
SIMD_DEGS_PER_RAD = 360.0 / SIMD_2_PI
SIMDSQRT12 = 0.7071067811865475244008443621048490
def btRecipSqrt(x):
    return (float((float(1.0)/_bullet_.btSqrt(float(x)))) )
SIMD_EPSILON=sys.float_info.epsilon
SIMD_INFINITY=sys.float_info.max


No new functionality added so if something is missing or broken let me know.

<Edit>
Apparently the board quota for uploads is exceeded (??) so I've uploaded to sourceforge instead.
https://sourceforge.net/tracker/downloa ... id=3422961

For this message the author dermont has received 2 kudos
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

Re: Softbody support - New bindings

Postby igrok » Thu Mar 29, 2012 4:03 pm

For anyone still using python-ogre/bullet


Thank you! I'm certainly still using Bullet.

Just out of curiosity, is there a different package the majority of developers have switched to?
User avatar
igrok
Gnoblar
 
Posts: 11
Kudos: 0
Joined: 01 Feb 2009
Location: Boston, MA

Re: Softbody support - New bindings

Postby thios » Fri Mar 30, 2012 8:00 am

I'm also still interested in bullet, so the update is certainly welcome! Thanks!

I'd also like to ask, do you have any plans to use these with python3 linux/windows?
thios
Gnoblar
 
Posts: 19
Kudos: 0
Joined: 05 Feb 2011

Re: Softbody support - New bindings

Postby dermont » Wed Apr 04, 2012 6:18 am

@igrok

Hi, not sure what you mean by "different package". I currently use svn trunk modified to build against the latest 1.8 branch of Ogre from Mercurial. There is a patch here for Ogre core modules, only tested on Linux (stiil a couple of problems to iron out).

http://sourceforge.net/tracker/?func=de ... tid=916690

There has also been discussions on the python-ogre developers group regarding switching to Git/Mercurial and other discussions regarding switching from py++ to other forms of code generation.

http://groups.google.com/group/python-o ... f830972891

I don't know the status of the above discussions or when the next updates will take place i.e. maybe when Ogre 1.8 is released??? I know there may be issues with gccxml and VS2010/tr1 which may not be as easily resolved as the fudge to disable tr1 on Linux.

Normally Andy will move to the latest versions of the underlying libs when doing a round of updates but last I heard he didn't have the time to devote to python-ogre.

Hopefully one of the developers can better answer your question.

@thios
No plans to use on Windows, there is a branch for building python-ogre for python3 which requires some updates for the logging module.

http://python-ogre.svn.sourceforge.net/ ... ython-3.x/

http://groups.google.com/group/python-o ... 5f186eb6fc

viewtopic.php?f=3&t=14338

It should be fairly straightforward to convert the bullet module to run under python3 for both Windows and Linux.
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

Re: Softbody support - New bindings

Postby thios » Thu Apr 05, 2012 8:10 am

Ah, I see you're using python2 to run the scripts...

Thanks Dermont, I'll see what I can come up with, at least on linux.

Otherwise, let's hope Andy will find the time to support python3 after 1.8 is released.
thios
Gnoblar
 
Posts: 19
Kudos: 0
Joined: 05 Feb 2011

Re: Softbody support - New bindings

Postby thios » Fri Apr 06, 2012 10:46 pm

I'd just like to report that the 2.80-rev2527 updates work like a charm on x64 linux, but fail while generating the bindings under XP/VS9:

Code: Select all
04-06 23:39 PythonOgre.BuildModule DEBUG    INFO Creating xml file "C:\development\python-ogre\code_generators\cache\bullet_rev2527_cache.xml" from source file "C:\development\python-ogre\code_generators\bullet\python_bullet.h" ... 

INFO gccxml cmd: ""C:\development\gccxml\bin\release\gccxml.exe"   -D"_HAS_TR1=0"    -I"C:\development\python-ogre" -I"C:\development\boost_1_45_0" -I"C:\development\bullet-2.80-rev2527\src" -I"C:\development\bullet-2.80-rev2527"  -D"BULLET_EXPORTS" -D"__GCCXML__" -D"_MSC_VER" -D"__MINGW32__" -D"VERSION_rev2527"  "C:\development\python-ogre\code_generators\bullet\python_bullet.h" -fxml="C:\development\python-ogre\code_generators\cache\bullet_rev2527_cache.xml""

INFO Parsing xml file "C:\development\python-ogre\code_generators\cache\bullet_rev2527_cache.xml" ...

INFO GCCXML version - 0.9( 1.128 )

Traceback (most recent call last):

  File "generate_code.py", line 1037, in <module>

    generate_code()

  File "generate_code.py", line 947, in generate_code

    ManualExclude ( mb )

  File "generate_code.py", line 593, in ManualExclude

    main_ns.class_(c).noncopyable = True

  File "c:\python27\lib\site-packages\pygccxml\declarations\scopedef.py", line 409, in class_

    , recursive=recursive)

  File "c:\python27\lib\site-packages\pygccxml\declarations\scopedef.py", line 357, in _find_single

    found = matcher_module.matcher.get_single( matcher, decls, False )

  File "c:\python27\lib\site-packages\pygccxml\declarations\matcher.py", line 82, in get_single

    raise matcher.declaration_not_found_t( decl_matcher )

pygccxml.declarations.matcher.declaration_not_found_t: Unable to find declaration.  matcher: [(decl type==class_t) and (name==btThreadSupportInterface)]


Removing the btThreadSupportInterface line from generate_code.py passes the generation stage, but results in a compilation error:

Code: Select all
cl /FoC:\temp\build_dir_2.7\bullet_rev2527\bt32BitAxisSweep3.pypp.obj /c generated\bullet_rev2527\bt32BitAxisSweep3.pypp.cpp /nologo /DBOOST_PYTHON_MAX_ARITY=19 /DBOOST_PYTHON_NO_PY_SIGNATURES /nologo -Zm200 /W3 /wd4675 /TP /MD /Zc:forScope /EHs /c /Ob2 /Oi /O2 /Ot /Oy /GS- /GR /Ox -IC:\development\python-ogre\generated\bullet_rev2527 -D"NDEBUG" -D"_CONSOLE" -D"WIN32" -D"_MBCS" /fp:fast /Gy /GF -Iinclude /TP /nologo /DBOOST_PYTHON_MAX_ARITY=19 /DBOOST_PYTHON_NO_PY_SIGNATURES /nologo -Zm200 /W3 /wd4675 /TP /MD /Zc:forScope /EHs /c /Ob2 /Oi /O2 /Ot /Oy /GS- /GR /Ox -IC:\development\python-ogre\generated\bullet_rev2527 -D"NDEBUG" -D"_CONSOLE" -D"WIN32" -D"_MBCS" /fp:fast /Gy /GF -Iinclude /IC:\development\boost_1_45_0 /IC:\development\bullet-2.80-rev2527\src /IC:\development\bullet-2.80-rev2527 /IC:\Python27\include /IC:\development\boost_1_45_0

bt32BitAxisSweep3.pypp.cpp

C:\development\boost_1_45_0\boost/python/converter/as_to_python_function.hpp(21) : error C2719: 'unnamed-parameter': formal parameter with __declspec(align('16')) won't be aligned

        C:\development\boost_1_45_0\boost/python/to_python_converter.hpp(88) : see reference to class template instantiation 'boost::python::converter::as_to_python_function<T,ToPython>' being compiled

        with

        [

            T=bt32BitAxisSweep3,

            ToPython=boost::python::objects::class_cref_wrapper<bt32BitAxisSweep3,boost::python::objects::make_instance<bt32BitAxisSweep3,boost::python::objects::value_holder<bt32BitAxisSweep3_wrapper>>>

        ]

        C:\development\boost_1_45_0\boost/python/to_python_converter.hpp(82) : while compiling class template member function 'boost::python::to_python_converter<T,Conversion,has_get_pytype>::to_python_converter(void)'

        with

        [

            T=bt32BitAxisSweep3,

            Conversion=boost::python::objects::class_cref_wrapper<bt32BitAxisSweep3,boost::python::objects::make_instance<bt32BitAxisSweep3,boost::python::objects::value_holder<bt32BitAxisSweep3_wrapper>>>,

            has_get_pytype=true

        ]

        C:\development\boost_1_45_0\boost/python/object/class_wrapper.hpp(26) : see reference to class template instantiation 'boost::python::to_python_converter<T,Conversion,has_get_pytype>' being compiled

        with

        [

            T=bt32BitAxisSweep3,

            Conversion=boost::python::objects::class_cref_wrapper<bt32BitAxisSweep3,boost::python::objects::make_instance<bt32BitAxisSweep3,boost::python::objects::value_holder<bt32BitAxisSweep3_wrapper>>>,

            has_get_pytype=true

        ]

        C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(272) : see reference to class template instantiation 'boost::python::objects::class_cref_wrapper<Src,MakeInstance>' being compiled

        with

        [

            Src=bt32BitAxisSweep3,

            MakeInstance=boost::python::objects::make_instance<bt32BitAxisSweep3,boost::python::objects::value_holder<bt32BitAxisSweep3_wrapper>>

        ]

        C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(229) : see reference to function template instantiation 'void boost::python::objects::class_metadata<T,X1,X2,X3>::maybe_register_class_to_python<T2>(T2 *,boost::mpl::false_)' being compiled

        with

        [

            T=bt32BitAxisSweep3_wrapper,

            X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

            X2=boost::python::detail::not_specified,

            X3=boost::python::detail::not_specified,

            T2=bt32BitAxisSweep3

        ]

        C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(213) : see reference to function template instantiation 'void boost::python::objects::class_metadata<T,X1,X2,X3>::register_aux2<T2,boost::mpl::bool_<C_>>(T2 *,Callback)' being compiled

        with

        [

            T=bt32BitAxisSweep3_wrapper,

            X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

            X2=boost::python::detail::not_specified,

            X3=boost::python::detail::not_specified,

            T2=bt32BitAxisSweep3,

            C_=true,

            Callback=boost::mpl::bool_<true>

        ]

        C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(205) : see reference to function template instantiation 'void boost::python::objects::class_metadata<T,X1,X2,X3>::register_aux<bt32BitAxisSweep3>(boost::python::wrapper<bt32BitAxisSweep3> *)' being compiled

        with

        [

            T=bt32BitAxisSweep3_wrapper,

            X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

            X2=boost::python::detail::not_specified,

            X3=boost::python::detail::not_specified

        ]

        C:\development\boost_1_45_0\boost/python/object/class_metadata.hpp(204) : while compiling class template member function 'void boost::python::objects::class_metadata<T,X1,X2,X3>::register_(void)'

        with

        [

            T=bt32BitAxisSweep3_wrapper,

            X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

            X2=boost::python::detail::not_specified,

            X3=boost::python::detail::not_specified

        ]

        C:\development\boost_1_45_0\boost/python/class.hpp(174) : see reference to class template instantiation 'boost::python::objects::class_metadata<T,X1,X2,X3>' being compiled

        with

        [

            T=bt32BitAxisSweep3_wrapper,

            X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

            X2=boost::python::detail::not_specified,

            X3=boost::python::detail::not_specified

        ]

        C:\development\boost_1_45_0\boost/python/class.hpp(213) : see reference to class template instantiation 'boost::python::class_<W,X1>::id_vector' being compiled

        with

        [

            W=bt32BitAxisSweep3_wrapper,

            X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>

        ]

        generated\bullet_rev2527\bt32BitAxisSweep3.pypp.cpp(191) : see reference to function template instantiation 'boost::python::class_<W,X1>::class_<boost::python::init<T0,T1,T2>>(const char *,const char *,const boost::python::init_base<DerivedT> &)' being compiled

        with

        [

            W=bt32BitAxisSweep3_wrapper,

            X1=boost::python::bases<btAxisSweep3Internal<unsigned int>>,

            T0=const btVector3 &,

            T1=const btVector3 &,

            T2=boost::python::optional<unsigned int,btOverlappingPairCache *,bool>,

            DerivedT=boost::python::init<const btVector3 &,const btVector3 &,boost::python::optional<unsigned int,btOverlappingPairCache *,bool>>

        ]

scons: building terminated because of errors.


04-06 23:33 PythonOgre.BuildModule DEBUG    scons: *** [C:\temp\build_dir_2.7\bullet_rev2527\bt32BitAxisSweep3.pypp.obj] Error 2
thios
Gnoblar
 
Posts: 19
Kudos: 0
Joined: 05 Feb 2011

Re: Softbody support - New bindings

Postby dermont » Mon Apr 09, 2012 4:29 am

I'll try and take a look on Windows in the next couple of days.
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

Re: Softbody support - New bindings

Postby dermont » Tue Apr 10, 2012 1:09 am

@thios
Did you manually patch btScalar.h, as suggested by Andy, in environment.py Windows Build Notes?

Code: Select all
class bullet(pymodule):
    """ Windows Build Notes: --
    patch src/LinearMath/btScaler.h -- around line 39 (removes the align 16 issues) to look like:
        #ifdef WIN32

            #if 1 || defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300)

    build ReleaseDLL and copy generated libs into a single directory ie (PATH_Bullet, 'out/release_dll8/libs')


For this message the author dermont has received kudos
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

Re: Softbody support - New bindings

Postby thios » Wed Apr 11, 2012 9:17 am

Um... I'd forgotten about that, as it wasn't previously necessary...

Bullet once again builds fine... Thanks again!
thios
Gnoblar
 
Posts: 19
Kudos: 0
Joined: 05 Feb 2011

Re: Softbody support - New bindings

Postby dermont » Tue Jul 03, 2012 5:24 am

Updates for bullet 2.80 rev 2531 code generators and simple convex demo to test latest changes, only tested on Linux.

Updates:
Code: Select all
btConvexHullShape
-----------------
- Constructor btConvexHullShape (const btScalar *points=0, int numPoints=0, int stride=sizeof(btVector3))
  first argument is not wrapped.

   Previously to add points (where verts is a list of btVector3) you need to specify the following:
        shape = bullet.btConvexHullShape()
        for n in verts:
            shape.addPoint(n)

     New :   
        shape = bullet.makeConvexHullShape(verts,len(verts))

- getUnscaledPoints (return btVector3 *) updated to return returns list of btVector3s 
- getPoints         (return btVector3 *) updated to return returns list of btVector3s 

btHullShape
-----------------
- getVertexPointer
  removed (returns const btVector3 *)
  replaced by getVertices() (returns list of btVector3)
- getIndexPointer
- removed (returns unsigned int *)
  replaced by getIndices() (returns list of ints)

btCollisionShape
----------------
- getUserData(getUserPointer) typo in handwrapped ::btCollisionObject should be ::btCollisionShape

enums
-----
- Added missing enums:   
    'ICHullError',
    'eStatus',
    'SolverTypes',
    'eGIMPACT_SHAPE_TYPE',
    'HullError',
    'BroadphaseNativeTypes',
    'CollisionFlags',
    'CollisionObjectTypes',
    'sStatus',
    'eBT_PLANE_INTERSECTION_TYPE',
    'CollisionFilterGroups',
    'BufferTypes',
    'DebugDrawModes',
    'HullFlag'
    'EFlags',
    'DispatchFunc'

HACD
--------
Wrapped no testing.


In environment.py you need to add HACD to your link flags.
Code: Select all
        LINKFLAGS ='''-L/usr/local/lib -Wl,-Bstatic -Wl,--whole-archive -lBulletWorldImporter -lHACD -lBulletSoftBody -lBulletDynamics -lBulletCollision -lBulletMultiThreaded -lConvexDecomposition -lGIMPACTUtils -Wl,--no-whole-archive  -lLinearMath -lBulletFileLoader -Wl,-Bdynamic'''
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

Re: Softbody support - New bindings

Postby pradhoom » Tue Nov 27, 2012 6:03 am

I have used OGRE in C++ a little and know the basics. I recently decided to try the python binding. I just successfully built and tested python-ogre from svn trunk with ogre 1.7.4. I followed discussion on this thread and sucessfully built bullet-2.80-rev2527 and tested the demos. I sincerely want to thank dermont & thios for such valuable infos and your works.

As I have been following, I see you guys mentioning btOgre module for python-ogre, if I am not mistaken, but I can't seem to find any further info or download link to that. I would greatly appreciate if you could give me some info regarding that.
pradhoom
Gnoblar
 
Posts: 7
Kudos: 0
Joined: 27 Nov 2012
Location: Kathmandu, Nepal

Re: Softbody support - New bindings

Postby dermont » Fri Nov 30, 2012 4:53 pm

pradhoom wrote:I have used OGRE in C++ a little and know the basics. I recently decided to try the python binding. I just successfully built and tested python-ogre from svn trunk with ogre 1.7.4. I followed discussion on this thread and sucessfully built bullet-2.80-rev2527 and tested the demos. I sincerely want to thank dermont & thios for such valuable infos and your works.

As I have been following, I see you guys mentioning btOgre module for python-ogre, if I am not mistaken, but I can't seem to find any further info or download link to that. I would greatly appreciate if you could give me some info regarding that.

Yeah the btOgre module was pretty much a one-off based on the link supplied by thois ie. a demo that showed bullet softbody support with ogre. The build files AFAIR was uploaded to the forum but removed due to a problem with the forum and exceeded quota upload limit.

Unfortunately other than very simple meshes bullet softbody and updating ogre meshes is just too slow.

The python demos that I did were based on the bullet ones, creating a softbody from an ogre mesh and displaying the softbody debug data; that was as far as I took it.

If you really want that version of btogre I'll try and dig it out and build it against the later version of bullet or if you want to use softbody support with python-ogre I'll try and help.
dermont
Bugbear
 
Posts: 895
Kudos: 37
Joined: 27 Sep 2005

PreviousNext

Return to Python-Ogre

Who is online

Users browsing this forum: No registered users and 3 guests