From 9284a3cd9cbeb75169cf949c882f7e1b3b87f063 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 17 Mar 2019 00:09:07 -0600 Subject: [PATCH 1/5] contrib: Fix several includes, and a missing copyright header The copyright header was removed, apparently by mistake, in c310c29a7712a06fe68fcb838b8c8a64caa5914b. I've put the header back, carefully referencing the original to be certain that I'm not inadvertently changing the copyright status. --- contrib/src/ai/aiBehaviors.cxx | 11 +++++++++++ contrib/src/ai/aiGlobals.h | 1 - contrib/src/ai/arrival.cxx | 3 +++ contrib/src/ai/obstacleAvoidance.cxx | 2 ++ contrib/src/ai/pathFind.cxx | 2 ++ contrib/src/ai/pathFollow.cxx | 14 ++++++++++++++ contrib/src/rplight/shadowAtlas.h | 2 +- 7 files changed, 33 insertions(+), 2 deletions(-) diff --git a/contrib/src/ai/aiBehaviors.cxx b/contrib/src/ai/aiBehaviors.cxx index 1ace436e5b..62f577241b 100644 --- a/contrib/src/ai/aiBehaviors.cxx +++ b/contrib/src/ai/aiBehaviors.cxx @@ -13,6 +13,17 @@ #include "aiBehaviors.h" +#include "arrival.h" +#include "evade.h" +#include "flee.h" +#include "flock.h" +#include "obstacleAvoidance.h" +#include "pathFind.h" +#include "pathFollow.h" +#include "pursue.h" +#include "seek.h" +#include "wander.h" + using std::cout; using std::endl; using std::string; diff --git a/contrib/src/ai/aiGlobals.h b/contrib/src/ai/aiGlobals.h index 1d8e8a9c41..f068bd4594 100644 --- a/contrib/src/ai/aiGlobals.h +++ b/contrib/src/ai/aiGlobals.h @@ -15,7 +15,6 @@ #define _AI_GLOBALS_H #include "config_ai.h" -#include "pandaFramework.h" #include "textNode.h" #include "pandaSystem.h" diff --git a/contrib/src/ai/arrival.cxx b/contrib/src/ai/arrival.cxx index 966a6b2611..3ce0f706da 100644 --- a/contrib/src/ai/arrival.cxx +++ b/contrib/src/ai/arrival.cxx @@ -13,6 +13,9 @@ #include "arrival.h" +#include "pursue.h" +#include "seek.h" + Arrival::Arrival(AICharacter *ai_ch, double distance) { _ai_char = ai_ch; diff --git a/contrib/src/ai/obstacleAvoidance.cxx b/contrib/src/ai/obstacleAvoidance.cxx index 87ce79026b..42c301e033 100644 --- a/contrib/src/ai/obstacleAvoidance.cxx +++ b/contrib/src/ai/obstacleAvoidance.cxx @@ -13,6 +13,8 @@ #include "obstacleAvoidance.h" +#include "aiWorld.h" + ObstacleAvoidance:: ObstacleAvoidance(AICharacter *ai_char, float feeler_length) { _ai_char = ai_char; diff --git a/contrib/src/ai/pathFind.cxx b/contrib/src/ai/pathFind.cxx index ee58f4940d..5813c9d503 100644 --- a/contrib/src/ai/pathFind.cxx +++ b/contrib/src/ai/pathFind.cxx @@ -13,6 +13,8 @@ #include "pathFind.h" +#include "pathFollow.h" + using std::cout; using std::endl; using std::string; diff --git a/contrib/src/ai/pathFollow.cxx b/contrib/src/ai/pathFollow.cxx index dd7720e318..942d7c7daa 100644 --- a/contrib/src/ai/pathFollow.cxx +++ b/contrib/src/ai/pathFollow.cxx @@ -1,6 +1,20 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file pathFind.cxx + * @author Deepak, John, Navin + * @date 2009-10-24 + */ #include "pathFollow.h" +#include "pathFind.h" + PathFollow::PathFollow(AICharacter *ai_ch, float follow_wt) { _follow_weight = follow_wt; _curr_path_waypoint = -1; diff --git a/contrib/src/rplight/shadowAtlas.h b/contrib/src/rplight/shadowAtlas.h index e3f0958a50..d6296e7658 100644 --- a/contrib/src/rplight/shadowAtlas.h +++ b/contrib/src/rplight/shadowAtlas.h @@ -28,7 +28,7 @@ #define SHADOWATLAS_H #include "pandabase.h" -#include "lvecBase4.h" +#include "luse.h" NotifyCategoryDecl(shadowatlas, EXPORT_CLASS, EXPORT_TEMPL); From 0840e80f54f98f6bd1cd2a9e0083eb2362be6557 Mon Sep 17 00:00:00 2001 From: deflected Date: Sun, 17 Mar 2019 10:19:52 +0200 Subject: [PATCH 2/5] makepanda: Fixed building of FreeBSD installer - Include the python bindings when building the FreeBSD installer Signed-off-by: deflected Closes #585 --- makepanda/makepackage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index 9b34192e94..9994b8fe78 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -748,7 +748,7 @@ def MakeInstallerOSX(version, runtime=False, python_versions=[], **kwargs): oscmd('rm -f Panda3D-rw.dmg') -def MakeInstallerFreeBSD(version, runtime=False, **kwargs): +def MakeInstallerFreeBSD(version, runtime=False, python_versions=[], **kwargs): outputdir = GetOutputDir() oscmd("rm -rf targetroot +DESC pkg-plist +MANIFEST") @@ -758,7 +758,7 @@ def MakeInstallerFreeBSD(version, runtime=False, **kwargs): if runtime: InstallRuntime(destdir="targetroot", prefix="/usr/local", outputdir=outputdir) else: - InstallPanda(destdir="targetroot", prefix="/usr/local", outputdir=outputdir) + InstallPanda(destdir="targetroot", prefix="/usr/local", outputdir=outputdir, python_versions=python_versions) if not os.path.exists("/usr/sbin/pkg"): exit("Cannot create an installer without pkg") From 768dce9244e00a9c3f37c9bdffc525d830d34785 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 17 Mar 2019 16:02:52 +0100 Subject: [PATCH 3/5] makepanda: fix locating UCRT shipped with more recent Win 10 SDK --- makepanda/makepandacore.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 386570a0d8..46ab62cbf9 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2797,8 +2797,14 @@ def SetupVisualStudioEnviron(): elif not win_kit.endswith('\\'): win_kit += '\\' - AddToPathEnv("LIB", win_kit + "Lib\\10.0.10150.0\\ucrt\\" + arch) - AddToPathEnv("INCLUDE", win_kit + "Include\\10.0.10150.0\\ucrt") + for vnum in 10150, 10240, 10586, 14393, 15063, 16299, 17134, 17763: + version = "10.0.{0}.0".format(vnum) + if os.path.isfile(win_kit + "Include\\" + version + "\\ucrt\\assert.h"): + print("Using Universal CRT %s" % (version)) + break + + AddToPathEnv("LIB", "%s\\Lib\\%s\\ucrt\\%s" % (win_kit, version, arch)) + AddToPathEnv("INCLUDE", "%s\\Include\\%s\\ucrt" % (win_kit, version)) # Copy the DLLs to the bin directory. CopyAllFiles(GetOutputDir() + "/bin/", win_kit + "Redist\\ucrt\\DLLs\\" + arch + "\\") From e486bbcb3f6ceab7a2f42fdedfb26191b6348e76 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 17 Mar 2019 18:56:39 +0100 Subject: [PATCH 4/5] collide: fix printing CollisionBox --- panda/src/collide/collisionBox.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/panda/src/collide/collisionBox.cxx b/panda/src/collide/collisionBox.cxx index 8528e7bc27..2f5385b9bf 100644 --- a/panda/src/collide/collisionBox.cxx +++ b/panda/src/collide/collisionBox.cxx @@ -186,6 +186,7 @@ get_test_pcollector() { */ void CollisionBox:: output(std::ostream &out) const { + out << "box, (" << get_min() << ") to (" << get_max() << ")"; } /** From 4f94b3aa0ed9535d51e4112294c4927f300576ac Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 17 Mar 2019 19:07:47 +0100 Subject: [PATCH 5/5] egg2pg: fix CollisionBox generation for transformed objects Rather than xforming after the fact, which does not work properly for boxes, we need to apply the transform to the vertices around which the box is generated. Fixes #506 --- panda/src/egg2pg/eggLoader.cxx | 42 ++++++++++++++++++++++++---------- panda/src/egg2pg/eggLoader.h | 2 ++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/panda/src/egg2pg/eggLoader.cxx b/panda/src/egg2pg/eggLoader.cxx index 6aeb84f54f..b9620cbbe3 100644 --- a/panda/src/egg2pg/eggLoader.cxx +++ b/panda/src/egg2pg/eggLoader.cxx @@ -1814,10 +1814,11 @@ make_node(EggGroup *egg_group, PandaNode *parent) { // A collision group: create collision geometry. node = new CollisionNode(egg_group->get_name()); + // Piggy-back the desired transform to apply onto the node, since we can't + // break the ABI in 1.10. + node->set_transform(TransformState::make_mat(LCAST(PN_stdfloat, egg_group->get_vertex_to_node()))); make_collision_solids(egg_group, egg_group, (CollisionNode *)node.p()); - - // Transform all of the collision solids into local space. - node->xform(LCAST(PN_stdfloat, egg_group->get_vertex_to_node())); + node->clear_transform(); if ((egg_group->get_collide_flags() & EggGroup::CF_keep) != 0) { // If we also specified to keep the geometry, continue the traversal. @@ -2773,7 +2774,7 @@ make_sphere(EggGroup *egg_group, EggGroup::CollideFlags flags, */ bool EggLoader:: make_box(EggGroup *egg_group, EggGroup::CollideFlags flags, - LPoint3 &min_p, LPoint3 &max_p, LColor &color) { + const LMatrix4 &xform, LPoint3 &min_p, LPoint3 &max_p) { EggGroup *geom_group = find_collision_geometry(egg_group, flags); if (geom_group != nullptr) { // Collect all of the vertices. @@ -2802,13 +2803,12 @@ make_box(EggGroup *egg_group, EggGroup::CollideFlags flags, } EggVertex *vertex = (*vi); - LVertexd min_pd = vertex->get_pos3(); - LVertexd max_pd = min_pd; - color = vertex->get_color(); + LPoint3 min_pd = LCAST(PN_stdfloat, vertex->get_pos3()) * xform; + LPoint3 max_pd = min_pd; for (++vi; vi != vertices.end(); ++vi) { vertex = (*vi); - const LVertexd &pos = vertex->get_pos3(); + LPoint3 pos = LCAST(PN_stdfloat, vertex->get_pos3()) * xform; min_pd.set(min(min_pd[0], pos[0]), min(min_pd[1], pos[1]), min(min_pd[2], pos[2])); @@ -2817,13 +2817,25 @@ make_box(EggGroup *egg_group, EggGroup::CollideFlags flags, max(max_pd[2], pos[2])); } - min_p = LCAST(PN_stdfloat, min_pd); - max_p = LCAST(PN_stdfloat, max_pd); + min_p = min_pd; + max_p = max_pd; return (min_pd != max_pd); } return false; } +/** + * Creates a single generic Box corresponding to the polygons associated with + * this group. This box is used by make_collision_box. + */ +bool EggLoader:: +make_box(EggGroup *egg_group, EggGroup::CollideFlags flags, + LPoint3 &min_p, LPoint3 &max_p, LColor &color) { + + color.set(1.0, 1.0, 1.0, 1.0); + return make_box(egg_group, flags, LMatrix4::ident_mat(), min_p, max_p); +} + /** * Creates CollisionSolids corresponding to the collision geometry indicated * at the given node and below. @@ -2904,6 +2916,7 @@ make_collision_plane(EggGroup *egg_group, CollisionNode *cnode, create_collision_plane(DCAST(EggPolygon, *ci), egg_group); if (csplane != nullptr) { apply_collision_flags(csplane, flags); + csplane->xform(cnode->get_transform()->get_mat()); cnode->add_solid(csplane); return; } @@ -3004,6 +3017,7 @@ make_collision_sphere(EggGroup *egg_group, CollisionNode *cnode, CollisionSphere *cssphere = new CollisionSphere(center, radius); apply_collision_flags(cssphere, flags); + cssphere->xform(cnode->get_transform()->get_mat()); cnode->add_solid(cssphere); } } @@ -3017,8 +3031,8 @@ make_collision_box(EggGroup *egg_group, CollisionNode *cnode, EggGroup::CollideFlags flags) { LPoint3 min_p; LPoint3 max_p; - LColor dummycolor; - if (make_box(egg_group, flags, min_p, max_p, dummycolor)) { + CPT(TransformState) transform = cnode->get_transform(); + if (make_box(egg_group, flags, transform->get_mat(), min_p, max_p)) { CollisionBox *csbox = new CollisionBox(min_p, max_p); apply_collision_flags(csbox, flags); @@ -3040,6 +3054,7 @@ make_collision_inv_sphere(EggGroup *egg_group, CollisionNode *cnode, CollisionInvSphere *cssphere = new CollisionInvSphere(center, radius); apply_collision_flags(cssphere, flags); + cssphere->xform(cnode->get_transform()->get_mat()); cnode->add_solid(cssphere); } } @@ -3234,6 +3249,7 @@ make_collision_capsule(EggGroup *egg_group, CollisionNode *cnode, new CollisionCapsule(LCAST(PN_stdfloat, point_a), LCAST(PN_stdfloat, point_b), radius); apply_collision_flags(cscapsule, flags); + cscapsule->xform(cnode->get_transform()->get_mat()); cnode->add_solid(cscapsule); } } @@ -3395,6 +3411,7 @@ create_collision_polygons(CollisionNode *cnode, EggPolygon *egg_poly, new CollisionPolygon(vertices_begin, vertices_end); if (cspoly->is_valid()) { apply_collision_flags(cspoly, flags); + cspoly->xform(cnode->get_transform()->get_mat()); cnode->add_solid(cspoly); } } @@ -3485,6 +3502,7 @@ create_collision_floor_mesh(CollisionNode *cnode, CollisionFloorMesh::TriangleIndices triangle = *ti; csfloor->add_triangle(triangle.p1, triangle.p2, triangle.p3); } + csfloor->xform(cnode->get_transform()->get_mat()); cnode->add_solid(csfloor); } diff --git a/panda/src/egg2pg/eggLoader.h b/panda/src/egg2pg/eggLoader.h index 0f974f41c2..ab11214e19 100644 --- a/panda/src/egg2pg/eggLoader.h +++ b/panda/src/egg2pg/eggLoader.h @@ -163,6 +163,8 @@ private: bool make_sphere(EggGroup *start_group, EggGroup::CollideFlags flags, LPoint3 ¢er, PN_stdfloat &radius, LColor &color); + bool make_box(EggGroup *start_group, EggGroup::CollideFlags flags, + const LMatrix4 &xform, LPoint3 &min_p, LPoint3 &max_p); bool make_box(EggGroup *start_group, EggGroup::CollideFlags flags, LPoint3 &min_p, LPoint3 &max_p, LColor &color);