CVS times out, how should I get the latest version?

Project5

14-03-2006 15:41:48

It may be me, but when I try to go through sourceforge cvs to get OgreNewt, it times out.

Walaber, it says on your home page that you added fastdelegate to the library, but the version on walaber.com still uses static function pointers, so I figure the version I was able to get is outdated. Would you be able to update the copy there? Thanks a lot. :-)

The problem could very well be me, here's what I'm seeing:

>cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ogre login
Logging in to :pserver:anonymous@cvs.sourceforge.net:2401/cvsroot/ogre
CVS password:
cvs [login aborted]: unrecognized auth response from cvs.sourceforge.net: M -!- Client or Server timeout occurred!


I'm hitting enter at the password propmt like this page tells me to:
http://www.ogre3d.org/index.php?option=com_content&task=view&id=17&Itemid=70

If I'm doing something wrong, let me know :-)

--Ben

walaber

14-03-2006 17:12:41

i just re-checked the binary download from my website, and it has the new fastdelegate stuff in it. look at demo04 or the buoyancy demo for examples.

Project5

14-03-2006 19:34:44

Ah, line 66 in OgreNewt_World.h threw me off:
typedef void(*LeaveWorldCallback)( OgreNewt::Body* me );
and I just assumed I missed out on the latest version.

Thanks for the fast reply :-)

--Ben

walaber

14-03-2006 23:58:10

ah, sorry! I need to update the leave-world callback to the same functionality... I had forgotten about that.

the body class is fully updated.

OvermindDL1

17-03-2006 01:05:44

Speaking of which, can't get functors to work with fast delegate (either that or I give it to it differently, I'm used to boost so...:) ), do you happen to know how? Or should I just give it the link to the operator.

walaber

17-03-2006 01:36:26

for a static function, just pass a pointer to the function to the set...() function.

for a member class, you need to do:


body->setCustomForceandTorqueCallback( fastdelegare::MakeDelegate( &classInstance, TheClass::TheFunction ) );


you can see examples of this in the updated demo04 and the buoyancy demo.

OvermindDL1

17-03-2006 02:02:39

It is not a static or member function, it is a functor (Function Object). Here is an example:
// *Completely* pseudo-code
class someBaseAbstractClassToDoSomethings
{
protected:
Object *myObject;

public:
someBaseAbstractClassToDoSomethings(Object *anInstancedObject) : *myObject(anInstancedObject) )
{
}

virtual void operator()(/*whatever callback params go here*/) = 0;
}

class doGravity : public someBaseAbstractClassToDoSomethings
{
protected:
Vector3 gravityDirection;

public:
doGravity(Object *anInstancedObject, Vector3 gravDir) :
someBaseAbstractClassToDoSomethings(anInstancedObject),
gravityDirection(gravDir)
{
}

virtual void operator()(/*whatever callback params go here*/)
{
myObject->addForce(gravityDirection*-9.8);
}
}

class doPeriodicJump : public doGravity
{
protected:

public:
doPeriodicJump(Object *anInstancedObject) :
doGravity(anInstancedObject,Vector3(0.0f,-1.0f,0.0f)
{
}

virtual void operator()(/*whatever callback params go here*/)
{
doGravity::operator(); // or doGravity() or whatever
if(rand(0,100)>95) myObject->addForce(Vector3(0.0f,100.0f,0.0f));
}
}


Which of course you could have in a class like:
class someObjectClassOrWhatnot : public ObjectOrSomeClassThatInheritsFromObject
{
someBaseAbstractClassToDoSomethings *myPhysics;
/* */
void setupPhysics()
{
myPhysics = ScriptingEngine::GetInstance.getDefaultPhysicsForTypeFromScript("someObjectClassOrWhatnot", this);
body->setSomePhysicsCallback( myPhysics );
}
/* */
}


Stuff like that. And of course, since I am using python (and if I feel like making the physics slow) I could override any of those physics classes (would make them structures actually) inside python and it could return a proper object for callbacks. I use this style in other program types, and I use it exactly as above using boost::function, so there should be a way to do the same with fastdelegate, except I cannot find any examples of such. Could make some wrappers to bump stuff around, but couldn't do that easily when crossing scripting boundries and the likes...