Stray "using" decleration

mysterycoder

21-04-2006 05:39:31

I'm using the latest OgreNewt release off of Walaber's website(as of April 20) It has worked great for me, but I think in OgreNewt_Tools.h, I think there is a "using namespace Ogre", in the header instead of the source file. I was including it and getting naming conflicts, had me baffled for a while :lol:

Again thank you for your great work Walaber :D, just wanted to let you know.

mysterycoder

21-04-2006 05:53:28

Ah, I forgot to metion what is affected, first in OgreNewt_CollisionPrimitives.cpp, on line 394:

void* indices=hwIndexBuffer->lock(HardwareBuffer::HBL_READ_ONLY);

to

void* indices=hwIndexBuffer->lock(Ogre::HardwareBuffer::HBL_READ_ONLY);

and in OgreNewt_Tools.h:
remove

using namespace Ogre;

change, on line 33

_OgreNewtExport void MatrixToQuatPos( const float* matrix, Quaternion& quat, Vector3 &pos );

to

_OgreNewtExport void MatrixToQuatPos( const float* matrix, Ogre::Quaternion& quat, Ogre::Vector3 &pos );

on line 41

_OgreNewtExport void QuatPosToMatrix( const Quaternion& quat, const Vector3 &pos, float* matrix );

to

_OgreNewtExport void QuatPosToMatrix( const Ogre::Quaternion& quat, const Ogre::Vector3 &pos, float* matrix );


And I think thats it :), Dewa Matta

mysterycoder

21-04-2006 07:54:59

Nope, I was wrong, in line3d.h remove using namespace std and using namespace Ogre, and add them into Line.cpp. Then, line.h should be this:


#ifndef __LINE3D_H__
#define __LINE3D_H__

#include "Ogre.h"
#include <vector>

#define POSITION_BINDING 0
#define TEXCOORD_BINDING 1

class Line3D:public Ogre::SimpleRenderable
{
public:
Line3D(void);
~Line3D(void);

void addPoint(const Ogre::Vector3 &p);
const Ogre::Vector3 &getPoint(unsigned short index) const;
unsigned short getNumPoints(void) const;
void updatePoint(unsigned short index, const Ogre::Vector3 &value);
void drawLine(Ogre::Vector3 &start, Ogre::Vector3 &end);
void drawLines(void);

Ogre::Real getSquaredViewDepth(const Ogre::Camera *cam) const;
Ogre::Real getBoundingRadius(void) const;
protected:
//void getWorldTransforms(Matrix4 *xform) const;
const Ogre::Quaternion &getWorldOrientation(void) const;
const Ogre::Vector3 &getWorldPosition(void) const;

std::vector<Ogre::Vector3> mPoints;
bool mDrawn;
};

#endif /* __LINE3D_H__ */

mysterycoder

21-04-2006 07:58:33

Oh yeah, need to add the disclaimer :wink:, Walaber, I have no intention of telling you how to code(you're a way better coder than me anyway), I am simply telling you about some changes that would make OgreNewt more friendly to use, since it gets rid of naming conflicts. Also, if this is already in cvs, then ignore these posts :wink:. I just put this here to make sure my posts wouldn't be mis-intepreted :wink:

praetor

21-04-2006 21:35:11

Yes I noticed a stray using declaration in an h file as well. I typedef a String as well in my code, and just including OgreNewt causes all sorts of problems with collisions between Ogre::String and Odyssey::String. Thanks for finding all the occurances.

mysterycoder

22-04-2006 07:59:03

No problem :wink:, I'm glad I could help someone.

walaber

22-04-2006 08:12:07

thanks for the help, I appreciate it! don't worry about insulting me, I love all the help I can get.

I have made the changes and committed to CVS.

mysterycoder

22-04-2006 08:27:38

Sweet :D , is there a reason why the anonymous OgreNewt cvs is still using the non-boost version? I think the version on your website is later than the current anonymous cvs. Is something messed up on the server, or did I screw something up on my end?

bravery

22-04-2006 16:54:19

thats right walaber I also think that the OgreNewt on your site is newer than the ine on the cvs, colud you please make a topic and sticky it so we can know exactly when there is a new version or fix to OgreNewt and how can we get it.

thanks in advance.

walaber

22-04-2006 23:14:02

I have committed the boost stuff to CVS several days ago, but maybe anonymous hasn't updated yet... I never seem to have mush luck with CVS :(