NxOgre for other engine ?

elementarladung

03-07-2006 09:37:25

Hello,
please forgive me to ask these question in a Ogre Forum :-D

Is it easy possible to use the NXOgre for other engines like Irrlicht or Torque Game engine ?
Or is it especially for OGRE ?

Thx forward.

betajaen

03-07-2006 10:26:34

Not really, it's quite tied down to it, hence the name:

From the top of my head, you'd have to modify:

- World to be an independent timer.
- Body to update Irrlicht's or Torque's version of a SceneNode
- Rewrite meshShape to read Irrlicht or Torques fileformat.
- Rewrite most of the particle system
- Rewrite the debugging system
- And more.

Personally, I would just use Ogre :wink:

elementarladung

04-07-2006 13:42:49

Hi,
thx for reply.
If you allow i will start with porting it to the newest engine of Torque.
My results will post in the Torque forum so everybody will have something of it. But the forum is only for torque owners. It's clear that your name will stay in front !

It would be great if you allow me to ask you somethimes questions about your stuff and physx ?

Thanks forward and Greetings.

Game_Ender

04-07-2006 15:18:24

NxOgre is under but if the LGPL you have to release the source of any modified versions of NxOgre that you release. You also have to remember that PhysX requires quite a bit of money to be used in commerical projects (last I heard they didn't have a cheap/shareware licenese), so if you intended to sell you Torque based games using NxTorque you will have pay the company that made PhysX.

Other than that, good luck.

betajaen

04-07-2006 17:09:22

Of course you can, but as Game_Ender said under the terms of the LGPL you have to release the source as LPGL and you can't "NxTorque" either as it would be in violation of the non-commerical licence with Ageia.

Also remember to include a link or two at our Wiki ;)

Wretched_Wyx

04-07-2006 17:12:29

On top of the last few comments, someone has already made a PhysX wrapper for Torque. If you're a licensed Torque developer, you should know where to search on the Torque site for the "resource". I'll be nice and save you the time though: http://www.garagegames.com/blogs/49233/10233 Scroll to the bottom (or read through the post for some nice tidbits of info) to find the link to the resource.


[Edited by Betajaen]

Fixed your link for you.

betajaen

04-07-2006 17:14:08

On top of the last few comments, someone has already made a PhysX wrapper for Torque.

I believe NxOgre is the most in depth and featured filled PhysX wrapper there is (not tooting my own horn here, but I believe it is).

And the PhysX torque wrapper only covers the basics from what I hear.

elementarladung

04-07-2006 17:29:51

Hi,
thx for reply.

Let me explain: I already know the existing wrapper for torque. It creates a world, a scene, and three types of Rigid Bodies. That is my basic how to implement it into the engine. See here. This link is better.
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10258

I've spoken to the creator of these wrapper and he told me that he do not have any time to work on it further. I've played a little bit arround with it but it's not deep enought for me.
I'm not a really good c++ programmer. I know the basics but it's still difficult for me to handle with it. So it's easier for me to learn how an other guy have done it and than i can implement it into the torque engine. But i don't want to steel what someone other has done !!!!

The license:
I know that the wrapper is under GNU license. Torque is not free. But it's not a problem i think (hope so). I will post my stuff (the complete code; if i will be able to do it ^^) in the same way as shown in the link above.

I know the license issues of PhysX. And i have an contact line to Ageia to make somethings clear. At the moment i want to test how powerfull PhysX is and if it's possible to realise my idea with it. If yes. Then we will see further.

Thx and greetings

elementarladung

06-07-2006 10:31:46

Hi, i hope it's ok to post it here but no one can help me on my (torque) forum.

I'm during convertig nxOgre for Torque and i get one error i cannot find the reason for it:

error message:

PhysXWorld.h(105) : error C2040: 'PhysXWorld::mScene' : 'std::vector<_Ty>' differs in levels of indirection from 'PhysXScene *'


here is the coresponded code line:


protected:

// Variables shared between "friends"
// ----------------------------------

std::vector < PhysXScene* > mScene;


and here is my PhysXScene class. All for the firsat step not needed lines are comment out and the datatypes are changed for torque:


#ifndef __PhysXScene_H__
#define __PhysXScene_H__

#include "PhysX.h"

class PhysXScene: public NxUserTriggerReport{

friend PhysXWorld;
/*friend body;
friend controllable;*/

public:

// *structors
PhysXScene(StringTableEntry _name, PhysXWorld *_world);
~PhysXScene();


void simulate(F32 _time, bool _cleanupFrame = false);
bool simulateClearFrame();
// Class related
StringTableEntry getName();


// Creators
//group* createGroup(Ogre::String _name);
//stage* createStage(Ogre::String _name, Ogre::Vector3 _from, Ogre::Vector3 _to);
//body* createBody(Ogre::String _name, Ogre::String _meshName, nxOgre::shape *_shape, float _density, Ogre::Vector3 _pos);
//shape* createShape(shape *_shape);
//body* createStaticBody(Ogre::String _name, Ogre::String _meshName, nxOgre::shape *_shape, Ogre::Vector3 _pos);
//character* createCharacter(Ogre::String _name, Ogre::String _meshName, Ogre::Vector3 _position, Ogre::Vector3 _bounds);
//material* createMaterial(Ogre::String _name,float _staticFriction, float _dynamicFriction, float _bounce);
//rayCaster* createRayCaster(Ogre::Vector3 _pos, Ogre::Vector3 _direction, float _length = 100.0f);
//joint* createJoint(joint *_joint);
//particleEmitter* createParticleEmitter(particleEmitter *_emitter);
/*void createContactPair(body *a, body *b, bool _start = true, bool _touch = true, bool _end = true);*/

//motorisedJoint* createMotorisedJoint(body *_first, body *_second, Ogre::Vector3 _anchor, Ogre::Vector3 _axis, bool _collisions = false);
//motorisedJoint* createMotorisedJoint(body *_first, Ogre::Vector3 _anchor, Ogre::Vector3 _axis);

//void createMaterialAlias(Ogre::String _name, material *_material);
//stateTrigger* createStateTrigger(Ogre::String _name, stateType _stateType, Ogre::Vector3 _pos, shape *_shape);
//callbackTrigger* createCallbackTrigger(callbackTrigger *_trigger);

bool createCollection();
bool createCharacter();

/*void addPrefab(Prefabs::prefab *_prefab);
void removePrefab(Ogre::String _name);*/
// Finders
/*group* findGroup(Ogre::String);*/
U32 findGroupIndex(StringTableEntry);

/*body* findBody(StringTableEntry);
material* findMaterial(StringTableEntry _matName);
NxMaterialIndex findMaterialIndex(StringTableEntry _matName);*/
bool hasMaterial(StringTableEntry _matName);

//bool join(body *_body1, body *_body2, Ogre::Vector3 _pos, int _type);
//bool joinToWorld(body *_body, Ogre::Vector3 _pos, int _type);

void pause();
void resume();

// Misc.


void hasFloor(bool _f = true);
void hasGravity(VectorF _g = VectorF(0,-9.80665,0));
void setWind(VectorF _wind);
VectorF PhysXScene::getWind();

NxPhysicsSDK *mPhysicsSDK;
NxScene* mScene;
/*Ogre::SceneManager *mSceneMgr;*/

/*material *mDefaultMaterial;*/


void onTrigger(NxShape &,NxShape &,NxTriggerFlag);


// Use this function wisely!
U32 getBodyCount();
/*stateMachine *mStateMachine;
contactReporter* mContactReporter;*/

private:

StringTableEntry mName;

PhysXWorld *mWorld;

// Novodex simulator bits:-
NxReal maxTimestep;
NxTimeStepMethod method;
NxU32 maxIter;
NxU32 numSubSteps;

S32 mNextGroupID;


// Containers

//std::vector < nxOgre::body* > mBody;
//std::vector < nxOgre::controllable* > mControllable;
//std::vector < nxOgre::Prefabs::prefab* > mPrefab;
//std::vector < nxOgre::joint* > mJoint;
//std::vector < nxOgre::particleEmitter* > mParticleEmitter;
//std::vector < nxOgre::trigger* > mTrigger;

NxActor* mFloorActor;


/*std::vector< material* > mMaterials;*/
//std::map< Ogre::String, nxOgre::material* > mMaterialAlias;
//std::map< Ogre::String, nxOgre::group* > mGroup;

// Scene that we are focused on to.
//stage *mFocusedScene;

NxVec3 mWindDirection;

protected:

/*static bool _NxScene_create(TiXmlElement *_scenedef, world *_world, Ogre::SceneManager *_mgr);*/

};



#endif



I hope it's ok for asking for help here ? I'm really glad that there is someone who are really professional in PhysX and c++.

Thanks forward !

betajaen

06-07-2006 11:40:12

Hmm, that is odd. I think it may down to Body not being defined properly. (Thats what Google said anyway).

Also, why the sudden name changes for everything, Can't you do a search and replace for NxOgre to NxTorque ;)

elementarladung

06-07-2006 11:59:25

hmm.
i've thought about if and decided to go an other way. I will implement nxOgre in same way as you planned it to implement it into Ogre.
The result of this it that dont have to change too much :-D

betajaen

06-07-2006 12:22:31

I think so to, you were looking to much into it there, and all it is to get it basically working is a timer thread and adjusting the body simulate code to work with Torque's equivalent of a Scene Node.

elementarladung

06-07-2006 21:48:54

does anybody know how to deal with this error message ?


5>PhysXWorld.obj : error LNK2005: "void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) already defined in winMemory.obj

betajaen

06-07-2006 22:25:58

Wow, what have you done to NxOgre to get that!? :wink:

elementarladung

07-07-2006 08:46:05

Hi,
i've taken nxOgre and removed all from project except Scene, World, includes and nxOgre.h
I've changed all for Torque and all for a simple world and scene unneded stuff. (only for a first beginning. If it will work then i will implement all step by step). Ive compiled it to nxOgre.dll and nxOgre.lib

Everything ok till here.

I've opened the Torque source code and added the files to it

PhysX.h


#ifndef _PHYSX_H_
#define _PHYSX_H_

#ifndef _TORQUE_TYPES_H_
#include "platform/types.h"
#endif

#if defined(TORQUE_OS_MAC)
#define __APPLE__
#elif defined(TORQUE_OS_LINUX)
#define LINUX
#elif defined(TORQUE_OS_WIN32)
#define WIN32
#endif

#define _WHOLE_TERRAIN_
#define _DONT_USE_SHAPEBASE_

#include "nxOgre.h"
#pragma comment(lib, "nxOgre.lib")
#endif



a PhysXWorld.h


#ifndef _PHYSX_WORLD_H_
#define _PHYSX_WORLD_H_

#include "physX/PhysX.h"

#ifndef _NETOBJECT_H_
#include "sim/netObject.h"
#endif
#ifndef _ITICKABLE_H_
#include "core/iTickable.h"
#endif

class ShapeBase;
class PhysXWorld : public NetObject, public virtual ITickable
{
private:
typedef NetObject Parent;
public:
PhysXWorld(void);

};

#endif



and a PhysXWorld.cpp



#include "physX/PhysXWorld.h"

PhysXWorld::PhysXWorld()
{

}


the i will get these error..and it's saying me nothing ^^

betajaen

07-07-2006 09:15:29

What is the error log?

elementarladung

07-07-2006 09:19:50

do you mean this ?


5>Linking...
5>PhysXWorld.obj : error LNK2005: "void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) already defined in winMemory.obj
5>../example/TSE.exe : fatal error LNK1169: one or more multiply defined symbols found
5>Build log was saved at "file://c:\copy\torque\TSE\engine\out.vc7.win32.release\BuildLog.htm"




C++ is just a hard stuff ^^ i'm wondering thats some guys of the world understand it :-D

betajaen

07-07-2006 09:21:58

That is just weird..

What have you done to the source code that produces that error?

Do you mind PM'ing me a copy of your "NxTorque" code so I can have a look at it.

elementarladung

07-07-2006 09:33:58

Will send i one mintes to you e-Mail

THX

ColeZero

07-07-2006 13:04:39

So it seems that this is not a problem with the code its definitive a linker error.
So maybe this helps:

http://support.microsoft.com/default.as ... us;q148652

or this at the end of the page:
http://www.experts-exchange.com/Program ... 86556.html

betajaen

07-07-2006 14:30:20

I think Colezero has the solution there, I've just had a quick run through the source he gave me and it seems okay.

elementarladung

07-07-2006 16:09:46

Thx for helping,

there are many infos on the listed links and i know these links already but it helps me not.

I'm too stupid for it.

elementarladung

08-07-2006 10:12:07

I've got a solution. Not the best but it's working.

Torque has a own VectorT class. I've included nxOgre directly into the source code of the engine (not as a library) and now everything is working.

Puuh. hard.
Now i've been able to implement it step by step. hpefully.

I thank you very much for helping.

I will post my results here :-D

Greetings

elementarladung

10-07-2006 12:46:53

Hi,

i've done many conversion at weekend but now i'm hanging on following thing:



// Clear all groups.
if (mGroup.size() > 0) {
for(Map< StringTableEntry, nxOgre::group* >::Iterator i = mGroup.begin();i != mGroup.end();++i) {
delete static_cast<group*> (i->second);
}
}

mGroup.empty();



i've got the following error message:



..\engine\nxOgre\nxOgre_scene.cpp(104) : error C2039: 'second' : is not a member of 'HashTable<Key,Value>::Pair'

..\engine\nxOgre\nxOgre_scene.cpp(108) : error C2039: 'empty' : is not a member of 'Map<Key,Value>'



The problem is i cannot use "std::map" because i will get trouble with the memory manager. Torque have a own class called "Map". I think there is something missing.

any idea ?

betajaen

10-07-2006 13:07:59

.second is the value (pointer) stored in the hash.

.empty just clears the map.