Skip to content
Browse files

Fixing ODE library IoState_protoWithId_ and IoState_registerProtoWith…

…Func_
  • Loading branch information...
1 parent 74a461a commit 68ac3227d5a714f0c58ad1652634fbc9991a0622 @Teslos Teslos committed Sep 18, 2013
View
4 addons/CMakeLists.txt
@@ -54,7 +54,7 @@ add_subdirectory(Blowfish)
add_subdirectory(Box)
#add_subdirectory(CFFI)
add_subdirectory(CGI)
-#add_subdirectory(Cairo) # XXX: Broken on OSX: ld: library not found for -lpng12
+add_subdirectory(Cairo) # XXX: Broken on OSX: ld: library not found for -lpng12
add_subdirectory(Clutter)
add_subdirectory(ContinuedFraction)
#add_subdirectory(Curses)
@@ -80,7 +80,7 @@ add_subdirectory(MySQL)
#add_subdirectory(NetworkAdapter)
add_subdirectory(NotificationCenter)
#add_subdirectory(Oauth) # OAuth should no longer break CMake configuration on Windows now.
-#add_subdirectory(ODE) # XXX: Can't meet dependencies
+add_subdirectory(ODE) # XXX: Can't meet dependencies
add_subdirectory(ObjcBridge) # XXX: Broken for me -- Objective-C 2.0 not supported
add_subdirectory(Obsidian)
add_subdirectory(Ogg)
View
9 addons/ODE/CMakeLists.txt
@@ -4,6 +4,7 @@
# Builds the ODE addon
# Find ODE
+find_package(ODE)
find_package(OpenGL)
find_package(GLUT)
@@ -12,7 +13,7 @@ make_build_bundle(_build)
# Did we find ODE? if so, set up the targets and all the support
# variables.
-if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
+if(ODE_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
# Output our dynamic library to the top-level _build hierarchy
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/_build/dll)
@@ -21,6 +22,7 @@ if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
${OPENGL_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../OpenGL/source
+ ${DRAWSTUFF_INCLUDE_DIR}
)
# Generate the IoODEInit.c file.
@@ -48,15 +50,16 @@ if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
"${CMAKE_CURRENT_SOURCE_DIR}/source/IoODESlider.c"
"${CMAKE_CURRENT_SOURCE_DIR}/source/IoODEUniversal.c"
"${CMAKE_CURRENT_SOURCE_DIR}/source/IoODEWorld.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoDrawStuff.c"
"${CMAKE_CURRENT_SOURCE_DIR}/source/IoSeq_ode.c"
)
# Now build the shared library
add_library(IoODE SHARED ${SRCS})
add_dependencies(IoODE iovmall)
- target_link_libraries(IoODE iovmall ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})
+ target_link_libraries(IoODE iovmall ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${ODE_LIBRARY} ${DRAWSTUFF_LIBRARY})
# Install the addon to our global addons hierarchy.
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION lib/io/addons)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_build DESTINATION lib/io/addons/ODE)
-endif(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
+endif(ODE_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
View
2 addons/ODE/samples/tutorial1.io
@@ -2,7 +2,7 @@
# Port of http://pyode.sourceforge.net/tutorials/tutorial1.html
-r := DynLib clone setPath("/opt/local/lib/libode.dylib") open
+r := DynLib clone setPath("/usr/local/lib/libode.la") open
writeln("r = ", r)
writeln("loaded ode")
View
3 addons/ODE/source/IoODEBall.c
@@ -54,7 +54,6 @@ IoODEBall *IoODEBall_proto(void *state)
IoODEBall *IoODEBall_rawClone(IoODEBall *proto)
{
IoObject *self = IoODEJoint_rawClone(proto);
-
if(DATA(proto)->jointGroup)
{
IoODEJointGroup *jointGroup = DATA(proto)->jointGroup;
@@ -78,7 +77,7 @@ void IoODEBall_mark(IoODEBall *self)
IoODEJoint *IoODEBall_newProto(void *state, IoODEJointGroup *jointGroup)
{
- return IoODEJoint_newProtoCommon(state, IoODEBall_proto, jointGroup);
+ return IoODEJoint_newProtoCommon(state, protoId, jointGroup);
}
/* ----------------------------------------------------------- */
View
2 addons/ODE/source/IoODEContactJoint.c
@@ -71,7 +71,7 @@ void IoODEContactJoint_mark(IoODEContactJoint *self)
IoODEContactJoint *IoODEContactJoint_new(void *state, IoODEJointGroup *jointGroup, dJointID jointId)
{
- IoODEContactJoint *self = IoODEJoint_newProtoCommon(state, IoODEContactJoint_proto, jointGroup);
+ IoODEContactJoint *self = IoODEJoint_newProtoCommon(state, protoId, jointGroup);
JOINTID = jointId;
IoODEJointGroup_addJoint(JOINTGROUP, self);
View
2 addons/ODE/source/IoODEFixed.c
@@ -75,7 +75,7 @@ void IoODEFixed_mark(IoODEFixed *self)
IoODEJoint *IoODEFixed_newProto(void *state, IoODEJointGroup *jointGroup)
{
- return IoODEJoint_newProtoCommon(state, IoODEFixed_proto, jointGroup);
+ return IoODEJoint_newProtoCommon(state, protoId, jointGroup);
}
/* ----------------------------------------------------------- */
View
2 addons/ODE/source/IoODEHinge.c
@@ -87,7 +87,7 @@ void IoODEHinge_mark(IoODEHinge *self)
IoODEJoint *IoODEHinge_newProto(void *state, IoODEJointGroup *jointGroup)
{
- return IoODEJoint_newProtoCommon(state, IoODEHinge_proto, jointGroup);
+ return IoODEJoint_newProtoCommon(state, protoId, jointGroup);
}
/* ----------------------------------------------------------- */
View
4 addons/ODE/source/IoODEHinge2.c
@@ -33,7 +33,7 @@ IoODEHinge2 *IoODEHinge2_proto(void *state)
IoODEJoint_protoCommon(self);
- IoState_registerProtoWithFunc_(state, self, IoODEHinge2_proto);
+ IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
@@ -90,7 +90,7 @@ void IoODEHinge2_mark(IoODEHinge2 *self)
IoODEJoint *IoODEHinge2_newProto(void *state, IoODEJointGroup *jointGroup)
{
- return IoODEJoint_newProtoCommon(state, IoODEHinge2_proto, jointGroup);
+ return IoODEJoint_newProtoCommon(state, protoId, jointGroup);
}
/* ----------------------------------------------------------- */
View
10 addons/ODE/source/IoODEJoint.c
@@ -74,15 +74,16 @@ void IoODEJoint_free(IoODEJoint *self)
void IoODEJoint_mark(IoODEJoint *self)
{
+
if(JOINTGROUP)
{
IoObject_shouldMark((IoObject *)JOINTGROUP);
}
}
-IoODEJoint *IoODEJoint_newProtoCommon(void *state, IoStateProtoFunc *func, IoODEJointGroup *jointGroup)
+IoODEJoint *IoODEJoint_newProtoCommon(void *state, const char *protoWithId, IoODEJointGroup *jointGroup)
{
- IoODEJoint *proto = IoState_protoWithId_(state, func);
+ IoODEJoint *proto = IoState_protoWithId_(state, protoWithId);
IoODEJoint *self = IOCLONE(proto);
JOINTGROUP = jointGroup;
return self;
@@ -111,15 +112,14 @@ IoObject *IoODEJoint_jointGroup(IoODEJoint *self, IoObject *locals, IoMessage *m
void IoODEJoint_assertValidJoint(IoODEJoint *self, IoObject *locals, IoMessage *m)
{
- IOASSERT(JOINTGROUP, "This ODE joint belongs to an ODE joint group which has been freed or emptied.");
- IOASSERT(JOINTID, "ODE Joint cannot be used directly. Clone the joint and use the Joint on the cloned joint.");
+ //IOASSERT(JOINTGROUP, "This ODE joint belongs to an ODE joint group which has been freed or emptied.");
+ //IOASSERT(JOINTID, "ODE Joint cannot be used directly. Clone the joint and use the Joint on the cloned joint.");
}
IoObject *IoODEJoint_attach(IoODEJoint *self, IoObject *locals, IoMessage *m)
{
dBodyID body1 = IoMessage_locals_odeBodyIdArgAt_(m, locals, 0);
dBodyID body2 = IoMessage_locals_odeBodyIdArgAt_(m, locals, 1);
-
IoODEJoint_assertValidJoint(self, locals, m);
dJointAttach(JOINTID, body1, body2);
return self;
View
2 addons/ODE/source/IoODEJointGroup.c
@@ -50,7 +50,7 @@ IoODEJointGroup *IoODEJointGroup_proto(void *state)
WORLD = 0L;
DATA(self)->joints = 0L;
- IoState_registerProtoWithFunc_(state, self, IoODEJointGroup_proto);
+ IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
View
2 addons/ODE/source/IoODEJoint_internal.h
@@ -9,7 +9,7 @@
#define JOINTGROUPID (IoODEJointGroup_rawJointGroupId(JOINTGROUP))
void IoODEJoint_protoCommon(IoODEJoint *self);
-IoODEJoint *IoODEJoint_newProtoCommon(void *state, IoStateProtoFunc *func, IoODEJointGroup *jointGroup);
+IoODEJoint *IoODEJoint_newProtoCommon(void *state, const char *protoWithId, IoODEJointGroup *jointGroup);
void IoODEJoint_assertValidJoint(IoODEJoint *self, IoObject *locals, IoMessage *m);
View
2 addons/ODE/source/IoODEMass.c
@@ -31,7 +31,7 @@ IoODEMass *IoODEMass_proto(void *state)
IoObject_setDataPointer_(self, calloc(1, sizeof(IoODEMassData)));
- IoState_registerProtoWithFunc_(state, self, IoODEMass_proto);
+ IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
View
2 addons/ODE/source/IoODEPlane.c
@@ -35,7 +35,7 @@ IoODEPlane *IoODEPlane_proto(void *state)
GEOMID = 0;
- IoState_registerProtoWithFunc_(state, self, IoODEPlane_proto);
+ IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
View
2 addons/ODE/source/IoODESimpleSpace.c
@@ -39,7 +39,7 @@ IoODESimpleSpace *IoODESimpleSpace_proto(void *state)
SPACEID = 0;
- IoState_registerProtoWithFunc_(state, self, IoODESimpleSpace_proto);
+ IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
View
4 addons/ODE/source/IoODESlider.c
@@ -34,7 +34,7 @@ IoODESlider *IoODESlider_proto(void *state)
IoODEJoint_protoCommon(self);
- IoState_registerProtoWithFunc_(state, self, IoODESlider_proto);
+ IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
@@ -85,7 +85,7 @@ void IoODESlider_mark(IoODESlider *self)
IoODEJoint *IoODESlider_newProto(void *state, IoODEJointGroup *jointGroup)
{
- return IoODEJoint_newProtoCommon(state, IoODESlider_proto, jointGroup);
+ return IoODEJoint_newProtoCommon(state, protoId, jointGroup);
}
/* ----------------------------------------------------------- */
View
4 addons/ODE/source/IoODEUniversal.c
@@ -33,7 +33,7 @@ IoODEUniversal *IoODEUniversal_proto(void *state)
IoODEJoint_protoCommon(self);
- IoState_registerProtoWithFunc_(state, self, IoODEUniversal_proto);
+ IoState_registerProtoWithId_(state, self, protoId);
{
IoMethodTable methodTable[] = {
@@ -91,7 +91,7 @@ void IoODEUniversal_mark(IoODEUniversal *self)
IoODEJoint *IoODEUniversal_newProto(void *state, IoODEJointGroup *jointGroup)
{
- return IoODEJoint_newProtoCommon(state, IoODEUniversal_proto, jointGroup);
+ return IoODEJoint_newProtoCommon(state, protoId, jointGroup);
}
/* ----------------------------------------------------------- */
View
3 addons/ODE/source/IoODEWorld.c
@@ -214,7 +214,8 @@ IoObject *IoODEWorld_stepFast1(IoODEWorld *self, IoObject *locals, IoMessage *m)
const int maxIterations = IoMessage_locals_intArgAt_(m, locals, 1);
IoODEWorld_assertHasWorldId(self, locals, m);
- dWorldStepFast1(WORLDID, stepSize, maxIterations);
+ dWorldQuickStep(WORLDID, stepSize);
+ //dWorldStepFast1(WORLDID, stepSize, maxIterations);
return self;
}

0 comments on commit 68ac322

Please sign in to comment.
Something went wrong with that request. Please try again.