From abb6ee0542b24da8dc9147e2bb55022873c4122d Mon Sep 17 00:00:00 2001 From: deflected Date: Thu, 8 Sep 2016 21:30:42 +0300 Subject: [PATCH 1/4] gobj: Fixed wrong texture pool key for 2D texture arrays - 2D texture arrays are added to internal storage with specific unique name, so keep it as texture pool key instead of filename. --- panda/src/gobj/texturePool.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/gobj/texturePool.cxx b/panda/src/gobj/texturePool.cxx index 4377767089..987e1947b5 100644 --- a/panda/src/gobj/texturePool.cxx +++ b/panda/src/gobj/texturePool.cxx @@ -772,7 +772,7 @@ ns_load_cube_map(const Filename &filename_pattern, bool read_mipmaps, nassertr(tex != (Texture *)NULL, NULL); tex->set_filename(filename_pattern); tex->set_fullpath(filename); - tex->_texture_pool_key = filename; + tex->_texture_pool_key = unique_filename; { MutexHolder holder(_lock); From 25cfec3760e1839eaff1877af4410e1e4b58df75 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 8 Sep 2016 22:09:45 +0200 Subject: [PATCH 2/4] Pass Ctrl+C on to child process when running panda3d from cmd-line --- direct/src/plugin/p3dInstanceManager.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/direct/src/plugin/p3dInstanceManager.cxx b/direct/src/plugin/p3dInstanceManager.cxx index fa8c70def2..7e67aeb945 100644 --- a/direct/src/plugin/p3dInstanceManager.cxx +++ b/direct/src/plugin/p3dInstanceManager.cxx @@ -1528,6 +1528,17 @@ create_runtime_environment() { } } +#ifndef _WIN32 + // If we're running from the console, make sure that terminating the parent + // process will cause the child process to terminate as well. + if (_console_environment) { + struct sigaction ignore; + memset(&ignore, 0, sizeof(ignore)); + ignore.sa_handler = SIG_IGN; + sigaction(SIGINT, &ignore, NULL); + } +#endif + _created_runtime_environment = true; } From 206d361f49d3d46dc6e35db73816a6b9184e2d6c Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 8 Sep 2016 22:14:44 +0200 Subject: [PATCH 3/4] Support for CollisionBox, InvSphere and Tube in bam2egg --- panda/src/egg2pg/eggSaver.cxx | 81 ++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/panda/src/egg2pg/eggSaver.cxx b/panda/src/egg2pg/eggSaver.cxx index ba4ee35d7f..99a36c50a7 100644 --- a/panda/src/egg2pg/eggSaver.cxx +++ b/panda/src/egg2pg/eggSaver.cxx @@ -479,7 +479,12 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_sphere->set_collide_flags(EggGroup::CF_descend); egg_group->add_child(egg_sphere); } - egg_sphere->set_cs_type(EggGroup::CST_sphere); + + if (child->is_of_type(CollisionInvSphere::get_class_type())) { + egg_sphere->set_cs_type(EggGroup::CST_inv_sphere); + } else { + egg_sphere->set_cs_type(EggGroup::CST_sphere); + } EggVertex ev1, ev2; ev1.set_pos(LCAST(double, (center + offset) * net_mat)); @@ -531,13 +536,77 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_poly->add_vertex(cvpool->create_unique_vertex(ev2)); } else if (child->is_of_type(CollisionBox::get_class_type())) { - nout << "Encountered unhandled collsion type: CollisionBox" << "\n"; - } else if (child->is_of_type(CollisionInvSphere::get_class_type())) { - nout << "Encountered unhandled collsion type: CollisionInvSphere" << "\n"; + CPT(CollisionBox) box = DCAST(CollisionBox, child); + LPoint3 min_point = box->get_min(); + LPoint3 max_point = box->get_max(); + + EggGroup *egg_box; + if (num_solids == 1) { + 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); + + // Just add the min and max points. + EggVertex ev0, ev1; + ev0.set_pos(LCAST(double, min_point * net_mat)); + ev1.set_pos(LCAST(double, max_point * net_mat)); + + EggLine *egg_poly = new EggLine; + egg_box->add_child(egg_poly); + + egg_poly->add_vertex(cvpool->create_unique_vertex(ev0)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev1)); + } else if (child->is_of_type(CollisionTube::get_class_type())) { - nout << "Encountered unhandled collsion type: CollisionTube" << "\n"; + CPT(CollisionTube) tube = DCAST(CollisionTube, child); + LPoint3 point_a = tube->get_point_a(); + LPoint3 point_b = tube->get_point_b(); + LPoint3 centroid = (point_a + point_b) * 0.5f; + + // Also get an arbitrary vector perpendicular to the tube. + LVector3 axis = point_b - point_a; + LVector3 sideways; + if (abs(axis[2]) > abs(axis[1])) { + sideways = axis.cross(LVector3(0, 1, 0)); + } else { + sideways = axis.cross(LVector3(0, 0, 1)); + } + sideways.normalize(); + sideways *= tube->get_radius(); + LVector3 extend = axis.normalized() * tube->get_radius(); + + EggGroup *egg_tube; + if (num_solids == 1) { + 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); + + // Add two points for the endcaps, and then two points around the + // centroid to indicate the radius. + EggVertex ev0, ev1, ev2, ev3; + ev0.set_pos(LCAST(double, (point_a - extend) * net_mat)); + ev1.set_pos(LCAST(double, (centroid + sideways) * net_mat)); + ev2.set_pos(LCAST(double, (point_b + extend) * net_mat)); + ev3.set_pos(LCAST(double, (centroid - sideways) * net_mat)); + + EggPolygon *egg_poly = new EggPolygon; + egg_tube->add_child(egg_poly); + + egg_poly->add_vertex(cvpool->create_unique_vertex(ev0)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev1)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev2)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev3)); + } else { - nout << "Encountered unknown CollisionSolid" << "\n"; + nout << "Encountered unknown collision solid type " << child->get_type() << "\n"; } } } From b74905ca9cfa5d7194aadca9e3d63adb90b7769d Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 8 Sep 2016 22:16:50 +0200 Subject: [PATCH 4/4] Add to ReleaseNotes --- doc/ReleaseNotes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 04fa87010d..f3bebcc191 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -29,6 +29,9 @@ This issue fixes several bugs that were still found in 1.9.2. * Fix race condition reading string config var * Fix interrogate parsing issue with "const static" * Add back missing libp3pystub.a to Mac OS X SDK +* Fix RAM caching of 2D texture arrays +* Fix Ctrl+C interrupt propagation to runtime applications +* Support for InvSphere, Box and Tube solids in bam2egg ------------------------ RELEASE 1.9.2 ------------------------