Bullet physics ported with FLASHCC

Software: Away3D 4.x

Avatar
Luca, Sr. Member
Posted: 24 February 2013 10:01 AM   Total Posts: 230

I have a little experience with unix compiler tool like CMAKE or GCC ( for me Visual Studio are a great IDE and i have all the docs i need to build Windows apps. Windows SDK, DirectX SDK, Kinect SDK and so on ) and i don’t have any PC that uses UBUNTU or FEDORA or RED HAT or any other Linux OS.

So on my Windows PC i need to use CYGWIN or a Virtual Machine…

Now, with FlashCC i can build a simple that uses Bullet with Away but, car physiscs, and softbody physics are not allowed to be compiled.
This is because in the make file the library needed are not specified…

When i try to add a reference ( raycast vehicle ) to the library file that contains the WHEEL definition i have one errore related to nested struc or class.
This is all i use and i get…

( Bullet 2.81 are precompiled )

BULLETDIR:=bullet-2.81
#EXTRA_CFLAGS:=-DUSE_PTHREADS
#EXTRA_OPTS:=-pthread
#EXTRA_LIBS:=-lBulletMultiThreaded
EXTRA_CFLAGS:=
EXTRA_OPTS:=
EXTRA_LIBS:=
FLASCC:=C:/FlashCC/sdk
FLEX:=C:/FlashCC/4.6.0
AS3COMPILER:=asc2.jar
BASE_CFLAGS:=-Werror -Wno-write-strings -Wno-trigraphs
T09:
@if [ -d $(FLASCC)/usr/bin ] ; then true ;
else echo “Couldn’t locate FLASCC sdk directory, please invoke make with “make FLASCC=/path/to/FLASCC/sdk ...”” ; exit 1 ;
fi
@if [ -d “$(FLEX)/bin” ] ; then true ;
else echo “Couldn’t locate Flex sdk directory, please invoke make with “make FLEX=/path/to/flex ...”” ; exit 1 ;
fi

@echo “————Example: Bullet————”

#mkdir -p build
#cd build && PATH=”$(call unixpath,$(FLASCC)/usr/bin):$(PATH)” cmake
# -DCMAKE_CXX_FLAGS=”-fno-exceptions -fno-rtti -O4”
# -DUSE_DOUBLE_PRECISION:BOOL=ON -DBUILD_EXTRAS:BOOL=OFF -DBUILD_DEMOS:BOOL=OFF
# ../$(BULLETDIR)/
make recompile
recompile:
#cd build && PATH=”$(call unixpath,$(FLASCC)/usr/bin):$(PATH)” make -j8

make swc
swc:
# Generate the SWIG wrappers
PATH=”$(call unixpath,$(FLASCC)/usr/bin):$(PATH)” swig -as3 -package bulletphysics -c++ -DBT_USE_DOUBLE_PRECISION $(EXTRA_CFLAGS) -I$(BULLETDIR)/src -module Bullet bullet.i &> build/swig.log
mv bullet_wrap.cxx build
mv Bullet.as build

# Compile the SWIG AS3 wrappers
java -jar $(call nativepath,$(FLASCC)/usr/lib/asc2.jar) -import $(call nativepath,$(FLASCC)/usr/lib/builtin.abc) -import $(call nativepath,$(FLASCC)/usr/lib/playerglobal.abc) build/Bullet.as
# Compile the SWIG C++ wrappers
cd build && PATH=”$(call unixpath,$(FLASCC)/usr/bin):$(PATH)” g++ $(BASE_CFLAGS) -DBT_USE_DOUBLE_PRECISION -I../$(BULLETDIR)/src
-Lsrc/BulletCollision -Lsrc/BulletDynamics -Lsrc/LinearMath -Lsrc/BulletMultiThreaded
bullet_wrap.cxx -O4 -c
# protect the required symbols in the LTO exports file
cp -f exports.txt build/
chmod u+rw build/exports.txt
PATH=”$(call unixpath,$(FLASCC)/usr/bin):$(PATH)” nm build/bullet_wrap.o | grep ” T ” | awk ‘{print $$3}’ | sed ‘s/__/_/’ >> build/exports.txt
# Link the final library
cd build && PATH=”$(call unixpath,$(FLASCC)/usr/bin):$(PATH)” g++ $(BASE_CFLAGS) -DBT_USE_DOUBLE_PRECISION -I../$(BULLETDIR)/src ../main.cpp
-Lsrc/BulletCollision -Lsrc/BulletDynamics -Lsrc/LinearMath -Lsrc/BulletMultiThreaded
bullet_wrap.o Bullet.abc
-Wl,—start-group
$(EXTRA_LIBS) -lBulletDynamics -lBulletCollision -lLinearMath
-Wl,—end-group
-emit-swc=bulletphysics -O4 -flto-api=exports.txt $(EXTRA_OPTS) -o Bullet.swc
$?UNAME=$(shell uname -s)
ifneq (,$(findstring CYGWIN,$(UNAME)))
$?nativepath=$(shell cygpath -at mixed $(1))
$?unixpath=$(shell cygpath -at unix $(1))
else
$?nativepath=$(abspath $(1))
$?unixpath=$(abspath $(1))
endif
ifneq (,$(findstring “asc2.jar”,”$(AS3COMPILER)”))
$?AS3COMPILERARGS=java $(JVMARGS) -jar $(call nativepath,$(FLASCC)/usr/lib/$(AS3COMPILER)) -merge -md
else
echo “ASC is no longer supported” ; exit 1 ;
endif
clean:
rm -rf build

Then in the file Bullet.i i can a reference to the library that must be added to the SWC… but at this point i have…

g++ -Werror -Wn o-write-strings -Wno-trigraphs -DBT_USE_DOUBLE_PRECISION -I../bullet-2.81/src
-Lsrc/BulletCollision -Lsrc/BulletDynamics -Lsrc/LinearMath -Lsrc/BulletMultiThreaded
bullet_wrap.cxx -O4 -c
bullet_wrap.cxx:31312: error: expected unqualified-id before ‘const’
bullet_wrap.cxx:31312: error: expected `)’ before ‘const’
../bullet-2.81/src/LinearMath/btAlignedObjectArray.h: In member function ‘void btAlignedObjectAr ray<T>::resize(int, const T&) [with T = btWheelInfo]’:
../bullet-2.81/src/LinearMath/btAlignedObjectArray.h:505: instantiated from ‘void btAlignedObj ectArray<T>::copyFromArray(const btAlignedObjectArray<T>&) [with T = btWheelInfo]’
../bullet-2.81/src/LinearMath/btAlignedObjectArray.h:61: instantiated from ‘btAlignedObjectArr ay<T>& btAlignedObjectArray<T>::operator=(const btAlignedObjectArray<T>&) [with T = btWheelInfo] ’
bullet_wrap.cxx:33322: instantiated from here
../bullet-2.81/src/LinearMath/btAlignedObjectArray.h:505: error: no matching function for call t o ‘btWheelInfo::btWheelInfo()’
../bullet-2.81/src/BulletDynamics/Vehicle/btWheelInfo.h:82: note: candidates are: btWheelInfo::b tWheelInfo(btWheelInfoConstructionInfo&)
../bullet-2.81/src/BulletDynamics/Vehicle/btWheelInfo.h:39: note: btWheelInfo::b tWheelInfo(const btWheelInfo&)

So valid candidate are… but adding the code of the structure on the .i file doesn’t resolve the error…
Someone have a solution to get the final SWC working ? smile

   

Avatar
Ringo Blanken, Administrator
Posted: 24 February 2013 11:03 PM   Total Posts: 120   [ # 1 ]

At github ‘away3d physic core’ at the dev branch you can find the flascc version. Softbody’s are not supported (yet) though.

 Signature 

Freelancer: http://www.ringo.nl/en/
http://www.jiglibflash.com
http://www.awayphysics.com
http://www.away3d.com

   

Avatar
Luca, Sr. Member
Posted: 25 February 2013 07:40 AM   Total Posts: 230   [ # 2 ]

Thx Ringo for the reply…
( I have all the away source from the first to to the lats from this site and from SVN. smile )

OK, Once downloaded the source, i can navigate through all the folder, and if i go in the Alchemy folder i can’t found any make file.

So, i don’t need to use CMAKE and SWIG to build the SWC but only compile with G++ and specify the right output format ( SWC not EXE ) ?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X