__declspec(align('16')) and btRigidBody

gusgus
Posts: 2
Joined: Sun May 24, 2009 3:09 pm

__declspec(align('16')) and btRigidBody

Post by gusgus »

Hello.

I want to make class which inherite from btRigid body like this:

Code: Select all

enum PhysicObjectType
{
	PhysicShip,
	PhysicStation,
	PhysicPlanet
};

class PhysicObject: public btRigidBody
{
public:
	PhysicObject(btRigidBody::btRigidBodyConstructionInfo BodyCI,PhysicShip* mOwner):btRigidBody(BodyCI)
	{
		Type = PhysicShip;
		mOwnerShip = mOwner;
		mOwnerPlanet = 0;
		mOwnerStation = 0;
	}

	PhysicObject(btRigidBody::btRigidBodyConstructionInfo BodyCI,PhysicPlanet* mOwner):btRigidBody(BodyCI)
	{
		Type = PhysicPlanet;
		mOwnerPlanet = mOwner;
		mOwnerShip = 0;
		mOwnerStation = 0;
	}

	PhysicObject(btRigidBody::btRigidBodyConstructionInfo BodyCI,PhysicStation* mOwner):btRigidBody(BodyCI)
	{
		Type = PhysicStation;
		mOwnerStation = mOwner;
		mOwnerShip = 0;
		mOwnerPlanet = 0;
	}

	PhysicObjectType Type;

	PhysicShip* mOwnerShip;
	PhysicPlanet* mOwnerPlanet;
	PhysicStation* mOwnerStation;

};
But i get the folowing error:

Code: Select all

1>c:\c++\lne\physicmodule\PhysicObject.h(16) : error C2061: erreur de syntaxe : identificateur 'PhysicShip'
1>c:\c++\lne\physicmodule\PhysicObject.h(16) : error C2719: 'BodyCI' : le paramètre formel avec __declspec(align('16')) ne sera pas aligné
I am using VC 9.

I have searched for a while and found not answere to my probleme (i have defined WIN32 for exemple).

Any Idea?

Thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: __declspec(align('16')) and btRigidBody

Post by Erwin Coumans »

Don't pass parameters by value, but by (const) reference. For example:

Code: Select all

PhysicObject(const btRigidBody::btRigidBodyConstructionInfo& BodyCI, [...]
Hope this helps,
Erwin
gusgus
Posts: 2
Joined: Sun May 24, 2009 3:09 pm

Post by gusgus »

Thanks,it helped :D