diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index da8e24ae0f..a05c4487e4 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -32,6 +32,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Fix RAM caching of 2D texture arrays * Fix Ctrl+C interrupt propagation to runtime applications * Support for InvSphere, Box and Tube solids in bam2egg +* Preserve "intangible" and "level" collide flags in bam2egg * Add normalized() method to vectors * asyncFlattenStrong with inPlace=True caused node to disappear * Fix asyncFlattenStrong called on nodes without parent @@ -43,6 +44,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Fix exception when creating intervals before ShowBase is started * Fix rare X11 .ico cursor bug; also now supports PNG-compressed icons * Add keyword argument support to make() methods such as Shader.make() +* Fix compilation errors with Bullet 2.84 ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/bullet/bulletCharacterControllerNode.cxx b/panda/src/bullet/bulletCharacterControllerNode.cxx index 929aaa8001..8d9dfdf434 100644 --- a/panda/src/bullet/bulletCharacterControllerNode.cxx +++ b/panda/src/bullet/bulletCharacterControllerNode.cxx @@ -13,6 +13,10 @@ #include "bulletCharacterControllerNode.h" +#if BT_BULLET_VERSION >= 285 +static const btVector3 up_vectors[3] = {btVector3(1.0f, 0.0f, 0.0f), btVector3(0.0f, 1.0f, 0.0f), btVector3(0.0f, 0.0f, 1.0f)}; +#endif + TypeHandle BulletCharacterControllerNode::_type_handle; /** @@ -54,8 +58,13 @@ BulletCharacterControllerNode(BulletShape *shape, PN_stdfloat step_height, const _angular_movement = 0.0f; // Character controller +#if BT_BULLET_VERSION >= 285 + _character = new btKinematicCharacterController(_ghost, convex, step_height, up_vectors[_up]); + _character->setGravity(up_vectors[_up] * -(btScalar)9.81f); +#else _character = new btKinematicCharacterController(_ghost, convex, step_height, _up); _character->setGravity((btScalar)9.81f); +#endif // Retain a pointer to the shape _shape = shape; @@ -268,8 +277,11 @@ get_max_slope() const { */ PN_stdfloat BulletCharacterControllerNode:: get_gravity() const { - +#if BT_BULLET_VERSION >= 285 + return -(PN_stdfloat)_character->getGravity()[_up]; +#else return (PN_stdfloat)_character->getGravity(); +#endif } /** @@ -277,8 +289,11 @@ get_gravity() const { */ void BulletCharacterControllerNode:: set_gravity(PN_stdfloat gravity) { - +#if BT_BULLET_VERSION >= 285 + _character->setGravity(up_vectors[_up] * -(btScalar)gravity); +#else _character->setGravity((btScalar)gravity); +#endif } diff --git a/panda/src/bullet/bulletManifoldPoint.I b/panda/src/bullet/bulletManifoldPoint.I index 0086f3020b..6730d2f349 100644 --- a/panda/src/bullet/bulletManifoldPoint.I +++ b/panda/src/bullet/bulletManifoldPoint.I @@ -24,8 +24,15 @@ INLINE BulletManifoldPoint:: */ INLINE void BulletManifoldPoint:: set_lateral_friction_initialized(bool value) { - +#if BT_BULLET_VERSION >= 285 + if (value) { + _pt.m_contactPointFlags |= BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED; + } else { + _pt.m_contactPointFlags &= ~BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED; + } +#else _pt.m_lateralFrictionInitialized = value; +#endif } /** @@ -33,8 +40,11 @@ set_lateral_friction_initialized(bool value) { */ INLINE bool BulletManifoldPoint:: get_lateral_friction_initialized() const { - +#if BT_BULLET_VERSION >= 285 + return (_pt.m_contactPointFlags & BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED) != 0; +#else return _pt.m_lateralFrictionInitialized; +#endif } /** @@ -195,8 +205,9 @@ get_applied_impulse_lateral2() const { */ INLINE void BulletManifoldPoint:: set_contact_cfm1(PN_stdfloat value) { - +#if BT_BULLET_VERSION < 285 _pt.m_contactCFM1 = (btScalar)value; +#endif } /** @@ -204,8 +215,11 @@ set_contact_cfm1(PN_stdfloat value) { */ INLINE PN_stdfloat BulletManifoldPoint:: get_contact_cfm1() const { - +#if BT_BULLET_VERSION < 285 return (PN_stdfloat)_pt.m_contactCFM1; +#else + return 0; +#endif } /** @@ -213,8 +227,9 @@ get_contact_cfm1() const { */ INLINE void BulletManifoldPoint:: set_contact_cfm2(PN_stdfloat value) { - +#if BT_BULLET_VERSION < 285 _pt.m_contactCFM2 = (btScalar)value; +#endif } /** @@ -222,6 +237,9 @@ set_contact_cfm2(PN_stdfloat value) { */ INLINE PN_stdfloat BulletManifoldPoint:: get_contact_cfm2() const { - +#if BT_BULLET_VERSION < 285 return (PN_stdfloat)_pt.m_contactCFM2; +#else + return 0; +#endif } diff --git a/panda/src/egg2pg/eggSaver.cxx b/panda/src/egg2pg/eggSaver.cxx index bce14af761..fc41f15535 100644 --- a/panda/src/egg2pg/eggSaver.cxx +++ b/panda/src/egg2pg/eggSaver.cxx @@ -436,8 +436,20 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, // traverse solids for (int i = 0; i < num_solids; i++) { CPT(CollisionSolid) child = node->get_solid(i); + int flags = EggGroup::CF_descend; + + if (!child->is_tangible()) { + flags |= EggGroup::CF_intangible; + } + + if (child->has_effective_normal() && + child->get_effective_normal() == LVector3::up()) { + flags |= EggGroup::CF_level; + } + if (child->is_of_type(CollisionPolygon::get_class_type())) { egg_group->set_cs_type(EggGroup::CST_polyset); + egg_group->set_collide_flags(flags); EggPolygon *egg_poly = new EggPolygon; egg_group->add_child(egg_poly); @@ -463,7 +475,6 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_sphere = egg_group; } else { egg_sphere = new EggGroup; - egg_sphere->set_collide_flags(EggGroup::CF_descend); egg_group->add_child(egg_sphere); } @@ -472,6 +483,7 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, } else { egg_sphere->set_cs_type(EggGroup::CST_sphere); } + egg_sphere->set_collide_flags(flags); EggVertex ev1, ev2; ev1.set_pos(LCAST(double, (center + offset) * net_mat)); @@ -505,10 +517,10 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_plane = egg_group; } else { egg_plane = new EggGroup; - egg_plane->set_collide_flags(EggGroup::CF_descend); egg_group->add_child(egg_plane); } egg_plane->set_cs_type(EggGroup::CST_plane); + egg_plane->set_collide_flags(flags); EggVertex ev0, ev1, ev2; ev0.set_pos(LCAST(double, origin * net_mat)); @@ -532,10 +544,10 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_box = egg_group; } else { egg_box = new EggGroup; - egg_box->set_collide_flags(EggGroup::CF_descend); egg_group->add_child(egg_box); } egg_box->set_cs_type(EggGroup::CST_box); + egg_box->set_collide_flags(flags); // Just add the min and max points. EggVertex ev0, ev1; @@ -571,10 +583,10 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_tube = egg_group; } else { egg_tube = new EggGroup; - egg_tube->set_collide_flags(EggGroup::CF_descend); egg_group->add_child(egg_tube); } egg_tube->set_cs_type(EggGroup::CST_tube); + egg_tube->set_collide_flags(flags); // Add two points for the endcaps, and then two points around the // centroid to indicate the radius. diff --git a/pandatool/src/maxegg/maxEggLoader.cxx b/pandatool/src/maxegg/maxEggLoader.cxx index 222738493e..ba4c705965 100644 --- a/pandatool/src/maxegg/maxEggLoader.cxx +++ b/pandatool/src/maxegg/maxEggLoader.cxx @@ -279,7 +279,7 @@ void MaxEggJoint::CreateMaxBone(void) _node->SetRenderable(FALSE); #ifdef _UNICODE - TCHAR *wname [1024]; + TCHAR wname[1024]; wname[1023] = 0; mbstowcs(wname, _egg_joint->get_name().c_str(), 1023); _node->SetName(wname); @@ -452,7 +452,14 @@ MaxEggMesh *MaxEggLoader::GetMesh(EggVertexPool *pool) result->_tvert_count = 0; result->_cvert_count = 0; result->_face_count = 0; - result->_node->SetName(TSTR(name.c_str())); +#ifdef _UNICODE + TCHAR wname[1024]; + wname[1023] = 0; + mbstowcs(wname, name.c_str(), 1023); + result->_node->SetName(wname); +#else + result->_node->SetName((char*) name.c_str()); +#endif _mesh_tab[pool] = result; } return result; diff --git a/pandatool/src/maxegg/maxToEggConverter.cxx b/pandatool/src/maxegg/maxToEggConverter.cxx index f0df22ddca..b07c1fd77d 100644 --- a/pandatool/src/maxegg/maxToEggConverter.cxx +++ b/pandatool/src/maxegg/maxToEggConverter.cxx @@ -565,7 +565,14 @@ make_nurbs_curve(INode *max_node, NURBSCVCurve *curve, return false; } +#ifdef _UNICODE + char mbname[1024]; + mbname[1023] = 0; + wcstombs(mbname, max_node->GetName(), 1023); + string name(mbname); +#else string name = max_node->GetName(); +#endif string vpool_name = name + ".cvs"; EggVertexPool *vpool = new EggVertexPool(vpool_name); @@ -624,7 +631,15 @@ make_polyset(INode *max_node, Mesh *mesh, // separate vertices. So instead of adding all the vertices up front, // we'll start with an empty vpool, and add vertices to it on the fly. +#ifdef _UNICODE + char mbname[1024]; + mbname[1023] = 0; + wcstombs(mbname, max_node->GetName(), 1023); + string node_name(mbname); +#else string node_name = max_node->GetName(); +#endif + string vpool_name = node_name + ".verts"; EggVertexPool *vpool = new EggVertexPool(vpool_name); egg_group->add_child(vpool);