00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <PVLE/Entity/Commons.h>
00028 #include <PVLE/Entity/3DPhy.h>
00029 #include <PVLE/3D/Commons.h>
00030 #include <PVLE/3D/Utility3D.h>
00031 #include <PVLE/Physics/Geom.h>
00032 #include <PVLE/Physics/Utility.h>
00033
00034 C3DPhy * createFixedBox3DPhy(const osg::Vec3 & size, const osg::Vec3 & pos, const osg::Quat & orientation) {
00035 Physics::Geom * pGeom = Physics::createCanonicalBoxGeom(size);
00036 dGeomSetPosition(*pGeom, pos);
00037 dGeomSetQuaternion(*pGeom, orientation);
00038 return new C3DPhy(createShapeGeodeBox(size), pGeom, C3DPhy::INIT_BIND_ONCE);
00039 }
00040
00041 C3DPhy * createBox3DPhy(Physics::World * pPhyWorld, const osg::Vec3 & size, const float mass, const osg::Vec3 & pos, const osg::Quat & orientation) {
00042 Physics::Geom * pGeom = Physics::createCanonicalBox(pPhyWorld, size, mass);
00043 dGeomSetPosition(*pGeom, pos);
00044 dGeomSetQuaternion(*pGeom, orientation);
00045 return new C3DPhy(createShapeGeodeBox(size), pGeom, C3DPhy::INIT_AUTO_BIND);
00046 }
00047
00048
00049 C3DPhy * createFixedSphere3DPhy(const float radius, const osg::Vec3 & pos, const osg::Quat & orientation) {
00050 Physics::Geom * pGeom = Physics::createCanonicalSphereGeom(radius);
00051 dGeomSetPosition(*pGeom, pos);
00052 dGeomSetQuaternion(*pGeom, orientation);
00053 return new C3DPhy(createShapeGeodeSphere(radius), pGeom, C3DPhy::INIT_BIND_ONCE);
00054 }
00055
00056 C3DPhy * createSphere3DPhy(Physics::World * pPhyWorld, const float radius, const float mass, const osg::Vec3 & pos, const osg::Quat & orientation) {
00057 Physics::Geom * pGeom = Physics::createCanonicalSphere(pPhyWorld, radius, mass);
00058 dGeomSetPosition(*pGeom, pos);
00059 dGeomSetQuaternion(*pGeom, orientation);
00060 return new C3DPhy(createShapeGeodeSphere(radius), pGeom, C3DPhy::INIT_AUTO_BIND);
00061 }
00062
00063
00064 C3DPhy * createFixedCapsule3DPhy(const float radius, const float length, const osg::Vec3 & pos, const osg::Quat & orientation) {
00065 Physics::Geom * pGeom = Physics::createCanonicalCapsuleGeom(radius, length);
00066 dGeomSetPosition(*pGeom, pos);
00067 dGeomSetQuaternion(*pGeom, orientation);
00068 return new C3DPhy(createShapeGeodeCapsule(radius, length), pGeom, C3DPhy::INIT_BIND_ONCE);
00069 }
00070
00071 C3DPhy * createCapsule3DPhy(Physics::World * pPhyWorld, const float radius, const float length, const float mass, const osg::Vec3 & pos, const osg::Quat & orientation) {
00072 Physics::Geom * pGeom = Physics::createCanonicalCapsule(pPhyWorld, radius, length, mass);
00073 dGeomSetPosition(*pGeom, pos);
00074 dGeomSetQuaternion(*pGeom, orientation);
00075 return new C3DPhy(createShapeGeodeCapsule(radius, length), pGeom, C3DPhy::INIT_AUTO_BIND);
00076 }
00077
00078
00079 C3DPhy * createFixedCylinder3DPhy(const float radius, const float length, const osg::Vec3 & pos, const osg::Quat & orientation) {
00080 Physics::Geom * pGeom = Physics::createCanonicalCylinderGeom(radius, length);
00081 dGeomSetPosition(*pGeom, pos);
00082 dGeomSetQuaternion(*pGeom, orientation);
00083 return new C3DPhy(createShapeGeodeCylinder(radius, length), pGeom, C3DPhy::INIT_BIND_ONCE);
00084 }
00085
00086 C3DPhy * createCylinder3DPhy(Physics::World * pPhyWorld, const float radius, const float length, const float mass, const osg::Vec3 & pos, const osg::Quat & orientation) {
00087
00088
00089 Physics::Geom * pGeom = Physics::createCanonicalCylinder(pPhyWorld, radius, length, mass);
00090 dGeomSetPosition(*pGeom, pos);
00091 dGeomSetQuaternion(*pGeom, orientation);
00092 return new C3DPhy(createShapeGeodeCylinder(radius, length), pGeom, C3DPhy::INIT_AUTO_BIND);
00093 }