Sirikata
|
00001 // Copyright (c) 2011 Sirikata Authors. All rights reserved. 00002 // Use of this source code is governed by a BSD-style license that can 00003 // be found in the LICENSE file. 00004 00005 #ifndef _SIRIKATA_BULLET_PHYSICS_DEFS_HPP_ 00006 #define _SIRIKATA_BULLET_PHYSICS_DEFS_HPP_ 00007 00008 #include <sirikata/core/util/Platform.hpp> 00009 #include <sirikata/core/util/UUID.hpp> 00010 #include <sirikata/mesh/Meshdata.hpp> 00011 #include <sirikata/core/util/PresenceProperties.hpp> 00012 00013 namespace Sirikata { 00014 00015 #define BULLETLOG(lvl, msg) SILOG(BulletPhysics, lvl, msg) 00016 00017 class SirikataMotionState; 00018 class BulletObject; 00019 class BulletPhysicsService; 00020 00021 //FIXME Enums for manual treatment of objects and bboxes 00022 //IGNORE = Bullet shouldn't know about this object 00023 //STATIC = Bullet thinks this is a static (not moving) object 00024 //DYNAMIC = Bullet thinks this is a dynamic (moving) object 00025 //LINEAR_DYNAMIC = Turn off rotational effects, but make the object 00026 //dynamic. This means you can push it around and gravity affects it, but it 00027 //should never rotate. 00028 //VERTICAL_DYNAMIC = Turn off all but vertical movement. Useful for 00029 //placing objects on the ground. 00030 enum bulletObjTreatment { 00031 BULLET_OBJECT_TREATMENT_IGNORE, 00032 BULLET_OBJECT_TREATMENT_STATIC, 00033 BULLET_OBJECT_TREATMENT_DYNAMIC, 00034 BULLET_OBJECT_TREATMENT_LINEAR_DYNAMIC, 00035 BULLET_OBJECT_TREATMENT_VERTICAL_DYNAMIC, 00036 BULLET_OBJECT_TREATMENT_CHARACTER 00037 }; 00038 String ToString(bulletObjTreatment treatment); 00039 00040 enum bulletObjCollisionMaskGroup { 00041 BULLET_OBJECT_COLLISION_GROUP_STATIC = 1, 00042 BULLET_OBJECT_COLLISION_GROUP_DYNAMIC = 1 << 1, 00043 BULLET_OBJECT_COLLISION_GROUP_CONSTRAINED = 1 << 2 00044 }; 00045 00046 //ENTIRE_OBJECT = Bullet creates an AABB encompassing the entire object 00047 //PER_TRIANGLE = Bullet creates a series of AABBs for each triangle in the object 00048 // This option is useful for polygon soups - terrain, for example 00049 //SPHERE = Bullet creates a bounding sphere based on the bounds.radius 00050 enum bulletObjBBox { 00051 BULLET_OBJECT_BOUNDS_ENTIRE_OBJECT, 00052 BULLET_OBJECT_BOUNDS_PER_TRIANGLE, 00053 BULLET_OBJECT_BOUNDS_SPHERE 00054 }; 00055 String ToString(bulletObjBBox bnds); 00056 00057 #define DEFAULT_TREATMENT BULLET_OBJECT_TREATMENT_IGNORE 00058 #define DEFAULT_BOUNDS BULLET_OBJECT_BOUNDS_SPHERE 00059 #define DEFAULT_MASS 1.f 00060 00061 00062 00063 struct LocationInfo { 00064 LocationInfo() 00065 : props(), 00066 local(), 00067 aggregate(), 00068 simObject(NULL) 00069 {} 00070 00071 // Regular location info that we need to maintain for all objects 00072 SequencedPresenceProperties props; 00073 // NOTE: This is a copy of props.mesh(), which *is not always valid*. It's 00074 // only used for the accessor, when returning by const& since we don't have 00075 // a String version within props. DO NOT use anywhere else. 00076 String mesh_copied_str; 00077 String physics_copied_str; 00078 00079 bool local; 00080 bool aggregate; 00081 00082 BulletObject* simObject; 00083 }; 00084 00085 } // namespace Sirikata 00086 00087 #endif //_SIRIKATA_BULLET_PHYSICS_DEFS_HPP_