SO3Engine
|
OgreNewt_CollisionPrimitives.cpp
Go to the documentation of this file.
28 Box::Box(const World* world, const Ogre::Vector3& size, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos) : ConvexCollision(world)
39 m_col = NewtonCreateBox(m_world->getNewtonWorld(), dFloat(size.x), dFloat(size.y), dFloat(size.z), id, &matrix[0]);
51 Ellipsoid::Ellipsoid(const World* world, const Ogre::Vector3& size, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos) : ConvexCollision(world)
93 m_col = NewtonCreateCylinder(m_world->getNewtonWorld(), dFloat(radius), dFloat(height), id, &matrix[0]);
116 m_col = NewtonCreateCapsule(m_world->getNewtonWorld(), dFloat(radius), dFloat((height - (radius * 2.0))), id, &matrix[0]);
139 m_col = NewtonCreateCone(m_world->getNewtonWorld(), dFloat(radius), dFloat(height), id, &matrix[0]);
149 ChamferCylinder::ChamferCylinder(const World* world, Ogre::Real radius, Ogre::Real height, int id,
161 m_col = NewtonCreateChamferCylinder(m_world->getNewtonWorld(), dFloat(radius), dFloat(height), id, &matrix[0]);
173 ConvexHull::ConvexHull(const World* world, Ogre::Entity* obj, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance, const Ogre::Vector3& scale) : ConvexCollision(world)
247 Ogre::HardwareVertexBufferSharedPtr v_sptr = v_data->vertexBufferBinding->getBuffer(p_elem->getSource());
248 unsigned char* v_ptr = static_cast<unsigned char*>(v_sptr->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
283 m_col = NewtonCreateConvexHull(m_world->getNewtonWorld(), (int)total_verts, (float*)&vertices[0].x, sizeof(Ogre::Vector3), tolerance, id, &matrix[0]);
294 ConvexHull::ConvexHull(const World* world, const Ogre::Vector3* verts, int vertcount, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance) : ConvexCollision(world)
306 m_col = NewtonCreateConvexHull(m_world->getNewtonWorld(), vertcount, (float*)&verts[0].x, sizeof(Ogre::Vector3), tolerance, id, &matrix[0]);
316 ConcaveHull::ConcaveHull(const World* world, Ogre::Entity* obj, int id, Ogre::Real tolerance, const Ogre::Vector3& scale) : ConvexCollision(world)
353 Ogre::HardwareVertexBufferSharedPtr v_sptr = v_data->vertexBufferBinding->getBuffer(p_elem->getSource());
354 unsigned char* v_ptr = static_cast<unsigned char*>(v_sptr->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
435 NewtonMesh* const omesh = NewtonMeshApproximateConvexDecomposition(nmesh, 0.5f, 0.1f, 10, 1000, NULL, NULL);
446 m_col = NewtonCreateCompoundCollisionFromMesh(m_world->getNewtonWorld(), omesh, tolerance, id, id);
458 ConcaveHull::ConcaveHull(const World* world, const Ogre::Vector3* verts, int vertcount, int id, Ogre::Real tolerance) : ConvexCollision(world)
468 TreeCollision::TreeCollision(const World* world, Ogre::Entity* obj, bool optimize, int id, FaceWinding fw, const Ogre::Vector3& scale) : Collision(world)
499 Ogre::HardwareVertexBufferSharedPtr v_sptr = v_data->vertexBufferBinding->getBuffer(p_elem->getSource());
500 unsigned char* v_ptr = static_cast<unsigned char*>(v_sptr->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
636 TreeCollision::TreeCollision(const World* world, const Ogre::SceneNode* node, bool optimize, int id, FaceWinding fw, const Ogre::Vector3& scale) : Collision(world)
643 TreeCollision::TreeCollision(const OgreNewt::World *world, int numVertices, int numIndices, const float *vertices, const int *indices, bool optimize, int id, FaceWinding fw) : OgreNewt::Collision(world)
684 TreeCollision::TreeCollision(const World* world, int numVertices, Ogre::Vector3* vertices, Ogre::IndexData* indexData, bool optimize, int id, FaceWinding fw) : Collision(world)
747 void TreeCollision::AddEntities(const Ogre::SceneNode* node, const Ogre::SceneNode* mainNode, const Ogre::Vector3 scale, FaceWinding fw)
785 Ogre::HardwareVertexBufferSharedPtr v_sptr = v_data->vertexBufferBinding->getBuffer(p_elem->getSource());
786 unsigned char* v_ptr = static_cast<unsigned char*>(v_sptr->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
833 poly_verts[j] = mainNode->_getDerivedOrientation().Inverse() * ((nquat * (poly_verts[j] * nscale)) + npos - mainNode->_getDerivedPosition()) / mainNode->_getDerivedScale() * scale;
932 dFloat _CDECL TreeCollision::newtonRayCastCallback(const NewtonBody* const body, const NewtonCollision* const treeCollision, dFloat distance, dFloat *normal, int faceId, void *userData)
940 ((Raycast*)userData)->userCallback(bod, Ogre::Real(distance), Ogre::Vector3(Ogre::Real(normal[0]), Ogre::Real(normal[1]), Ogre::Real(normal[2])), faceId);
948 float _CDECL TreeCollision::newtonRayCastCallback(float interception, float *normal, int faceId, void *userData)
956 ((Raycast*)userData)->userCallback( bod, interception, Ogre::Vector3(normal[0], normal[1], normal[2]), faceId );
978 void TreeCollisionSceneParser::parseScene(Ogre::SceneNode *startNode, int id, bool optimize, FaceWinding fw)
994 void TreeCollisionSceneParser::_parseNode(Ogre::SceneNode *node, const Ogre::Quaternion &curOrient, const Ogre::Vector3 &curPos, const Ogre::Vector3 &curScale, FaceWinding fw)
1050 Ogre::HardwareVertexBufferSharedPtr v_sptr = v_data->vertexBufferBinding->getBuffer(p_elem->getSource());
1051 unsigned char* v_ptr = static_cast<unsigned char*>(v_sptr->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
1152 CompoundCollision::CompoundCollision(const World* world, std::vector<OgreNewt::CollisionPtr> col_array, int id) : Collision(world)
1170 NewtonCompoundCollisionAddSubCollision(m_col, (NewtonCollision*)col_array[i]->getNewtonCollision());
1181 Pyramid::Pyramid(const World* world, const Ogre::Vector3& size, int id, const Ogre::Quaternion& orient, const Ogre::Vector3& pos, Ogre::Real tolerance) : ConvexCollision(world)
1216 m_col = NewtonCreateConvexHull(m_world->getNewtonWorld(), 5, vertices, sizeof(dFloat) * 3, tolerance, id, &matrix[0]);
1224 HeightField::HeightField(const OgreNewt::World *world, int width, int height, int gridsDiagonals, unsigned short *elevationMap, char *attributeMap, Ogre::Real horizontalScale, Ogre::Real verticleScale, int shapeID) : OgreNewt::Collision (world)
1226 m_col = NewtonCreateHeightFieldCollision(world->getNewtonWorld(),width,height,gridsDiagonals,elevationMap,attributeMap,float(horizontalScale),float(verticleScale),shapeID);
1229 HeightField::HeightField(const OgreNewt::World *world, Ogre::Terrain *terrain, int shapeID) : OgreNewt::Collision (world)
1257 createHeightFieldCollision(world, width, height, gridsDiagonals, elevations, attributes, horizontalScale, float(1 / verticleScale), shapeID);
1263 void HeightField::createHeightFieldCollision(const OgreNewt::World *world, int width, int height, int gridsDiagonals, unsigned short *elevationMap, char *attributeMap, Ogre::Real horizontalScale, Ogre::Real verticleScale, int shapeID)
1265 m_col = NewtonCreateHeightFieldCollision(world->getNewtonWorld(), width, height, gridsDiagonals, elevationMap, attributeMap, float(horizontalScale), float(verticleScale), shapeID);
NewtonCollision *const getNewtonCollision() const
retrieve the Newton pointer
Definition OgreNewt_Collision.h:70
TreeCollision - complex polygonal collision.
Definition OgreNewt_CollisionPrimitives.h:305
static dFloat _CDECL newtonRayCastCallback(const NewtonBody *const body, const NewtonCollision *const treeCollision, dFloat distance, dFloat *normal, int faceId, void *userData)
used internally
Definition OgreNewt_CollisionPrimitives.cpp:932
void AddEntities(const Ogre::SceneNode *node, const Ogre::SceneNode *mainNode, const Ogre::Vector3 scale, FaceWinding fw=FW_DEFAULT)
Definition OgreNewt_CollisionPrimitives.cpp:747
void setRayCastCallbackactive(bool active=true)
set RayCastCallback active/disabled
Definition OgreNewt_CollisionPrimitives.h:373
void addPoly(Ogre::Vector3 *polys, unsigned int ID)
add a poly to the tree collision
Definition OgreNewt_CollisionPrimitives.cpp:904
virtual bool entityFilter(const Ogre::SceneNode *currentNode, const Ogre::Entity *currentEntity, FaceWinding &fw)
this is a user-inherited function that lets you filter which Entities will be added to the treeCollis...
Definition OgreNewt_CollisionPrimitives.h:414
void parseScene(Ogre::SceneNode *startNode, int id, bool optimize=true, FaceWinding fw=FW_DEFAULT)
parse the scene.
Definition OgreNewt_CollisionPrimitives.cpp:978
TreeCollisionSceneParser(OgreNewt::World *world)
Definition OgreNewt_CollisionPrimitives.cpp:974
represents a collision shape that is explicitly convex.
Definition OgreNewt_Collision.h:121
NewtonWorld * getNewtonWorld() const
retrieves a pointer to the NewtonWorld
Definition OgreNewt_World.h:284
_OgreNewtExport void QuatPosToMatrix(const Ogre::Quaternion &quat, const Ogre::Vector3 &pos, dFloat *matrix)
Take a Quaternion and Position Matrix and create a Newton-happy float matrix!
Definition OgreNewt_Tools.cpp:33
Generated by 1.9.8