From cfcf91c1c1e99ea0bbc6d497b60efdfefd135094 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 6 Jun 2015 16:24:59 +0200 Subject: [PATCH 1/4] Support far clip distance of infinity --- panda/src/gobj/perspectiveLens.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/panda/src/gobj/perspectiveLens.cxx b/panda/src/gobj/perspectiveLens.cxx index b1fdb0ab6e..fcc8868662 100644 --- a/panda/src/gobj/perspectiveLens.cxx +++ b/panda/src/gobj/perspectiveLens.cxx @@ -82,12 +82,18 @@ do_compute_projection_mat(Lens::CData *lens_cdata) { PN_stdfloat fl = do_get_focal_length(lens_cdata); PN_stdfloat fFar = do_get_far(lens_cdata); PN_stdfloat fNear = do_get_near(lens_cdata); - PN_stdfloat far_minus_near = fFar-fNear; - PN_stdfloat a = (fFar + fNear); - PN_stdfloat b = -2.0f * fFar * fNear; + PN_stdfloat a, b; - a /= far_minus_near; - b /= far_minus_near; + if (cinf(fFar)) { + a = 1; + b = -2 * fNear; + } else { + PN_stdfloat far_minus_near = fFar-fNear; + a = (fFar + fNear); + b = -2 * fFar * fNear; + a /= far_minus_near; + b /= far_minus_near; + } LMatrix4 canonical; switch (cs) { From 3c380d9006758b8dfbeb8bcd28fb896d25c3d9b3 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 6 Jun 2015 16:46:43 +0200 Subject: [PATCH 2/4] Support collision sphere and plane solids in bam2egg --- panda/src/egg2pg/eggSaver.cxx | 70 +++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/panda/src/egg2pg/eggSaver.cxx b/panda/src/egg2pg/eggSaver.cxx index 051c3b6f54..ba4ee35d7f 100644 --- a/panda/src/egg2pg/eggSaver.cxx +++ b/panda/src/egg2pg/eggSaver.cxx @@ -431,7 +431,6 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, apply_node_properties(egg_group, node, false); // turn it into a collision node - egg_group->set_cs_type(EggGroup::CST_polyset); egg_group->set_collide_flags(EggGroup::CF_descend); NodePath np = node_path.get_node_path(); @@ -451,6 +450,8 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, for (int i = 0; i < num_solids; i++) { CPT(CollisionSolid) child = node->get_solid(i); if (child->is_of_type(CollisionPolygon::get_class_type())) { + egg_group->set_cs_type(EggGroup::CST_polyset); + EggPolygon *egg_poly = new EggPolygon; egg_group->add_child(egg_poly); @@ -464,10 +465,71 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, EggVertex *new_egg_vert = cvpool->create_unique_vertex(egg_vert); egg_poly->add_vertex(new_egg_vert); } - } else if (child->is_of_type(CollisionPlane::get_class_type())) { - nout << "Encountered unhandled collsion type: CollisionPlane" << "\n"; + } else if (child->is_of_type(CollisionSphere::get_class_type())) { - nout << "Encountered unhandled collsion type: CollisionSphere" << "\n"; + CPT(CollisionSphere) sphere = DCAST(CollisionSphere, child); + LPoint3 center = sphere->get_center(); + LVector3 offset(sphere->get_radius(), 0, 0); + + EggGroup *egg_sphere; + if (num_solids == 1) { + egg_sphere = egg_group; + } else { + egg_sphere = new EggGroup; + egg_sphere->set_collide_flags(EggGroup::CF_descend); + egg_group->add_child(egg_sphere); + } + egg_sphere->set_cs_type(EggGroup::CST_sphere); + + EggVertex ev1, ev2; + ev1.set_pos(LCAST(double, (center + offset) * net_mat)); + ev2.set_pos(LCAST(double, (center - offset) * net_mat)); + + EggPolygon *egg_poly = new EggPolygon; + egg_sphere->add_child(egg_poly); + + egg_poly->add_vertex(cvpool->create_unique_vertex(ev1)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev2)); + + } else if (child->is_of_type(CollisionPlane::get_class_type())) { + LPlane plane = DCAST(CollisionPlane, child)->get_plane(); + LPoint3 origin = plane.get_point(); + LVector3 normal = plane.get_normal(); + + // Get an arbitrary vector on the plane by taking the cross product + // with any vector, as long as it is different. + LVector3 vec1; + if (abs(normal[2]) > abs(normal[1])) { + vec1 = normal.cross(LVector3(0, 1, 0)); + } else { + vec1 = normal.cross(LVector3(0, 0, 1)); + } + + // Find a second vector perpendicular to the two. + LVector3 vec2 = normal.cross(vec1); + + EggGroup *egg_plane; + if (num_solids == 1) { + 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); + + EggVertex ev0, ev1, ev2; + ev0.set_pos(LCAST(double, origin * net_mat)); + ev1.set_pos(LCAST(double, (origin + vec1) * net_mat)); + ev2.set_pos(LCAST(double, (origin + vec2) * net_mat)); + + EggPolygon *egg_poly = new EggPolygon; + egg_plane->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)); + } 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())) { From 9edf75aa7bc4128ff2fc62e1b09e5a1b549d426c Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 6 Jun 2015 16:47:00 +0200 Subject: [PATCH 3/4] Release notes for 1.9.1 --- doc/ReleaseNotes | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 64513c39d3..3bb5d7f829 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -1,3 +1,34 @@ +------------------------ RELEASE 1.9.1 ------------------------ + +This minor release fixes some important regressions and bugs found +in 1.9.0, but also introduces a few minor features. + +It also reintroduces the deployment pipeline that was absent from +the previous release. + +* Textures were not being scaled to power-of-2 in some cases +* Fix various issues with shader inputs +* Bullet step function accidentally defaulted to step size of 0 +* Use model-path for finding libRocket assets +* Fix inconsistent behavior with non-power-of-2 textures in rocket +* Fix regression with memoryviews +* Fix symbol error when loading libp3ffmpeg on Mac OS X +* Fix issues running maya2egg on Mac OS X +* PStats now tracks memory residency of graphics buffers +* Support wireframe and point rendering modes in OpenGL ES +* Add missing keys to libRocket keymap +* Fix incorrect parsing of numbers with exponents in Config.prc +* Various performance optimizations +* Fix for reading URLs mounted via the virtual file system +* Improve GLSL error reporting +* Fix issue with model disappearing in rare cases with GLSL +* Fix shader generator memory leaks and runtime performance +* Add M_confined mouse mode that keeps cursor in window +* Expose _NET_WM_PID to window managers in X11 +* bam2egg supports collision sphere and plane solids +* Add sample program demonstrating mouse modes +* Add -L (lighting) and -P (graphics pipe) pview options + ------------------------ RELEASE 1.9.0 ------------------------ This is a major release with many exciting new features! From 4d46172fba98913d650e7e2e6f516e8e1131e2ec Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 6 Jun 2015 16:55:33 +0200 Subject: [PATCH 4/4] Revert non-Windows template export changes from 1.9.x, they're less stable than I thought --- dtool/src/dtoolbase/dtoolbase.h | 2 +- dtool/src/dtoolbase/dtoolbase_cc.h | 2 +- panda/src/display/displayRegion.h | 2 -- panda/src/egg/eggMorphList.h | 3 --- panda/src/gobj/shader.h | 2 -- 5 files changed, 2 insertions(+), 9 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index 50efeab52d..4c8b9b28cb 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -436,7 +436,7 @@ #define IMPORT_CLASS #endif /* "extern template" is now part of the C++11 standard. */ -#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) +#if defined(WIN32_VC) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) #define EXPORT_TEMPL #define IMPORT_TEMPL extern #else diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index efefd36e9e..cb6f1db130 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -174,7 +174,7 @@ typedef ios::seekdir ios_seekdir; # define MOVE(x) x #endif -#if !defined(LINK_ALL_STATIC) && defined(EXPORT_TEMPLATES) +#if defined(WIN32_VC) && !defined(LINK_ALL_STATIC) && defined(EXPORT_TEMPLATES) // This macro must be used to export an instantiated template class // from a DLL. If the template class name itself contains commas, it // may be necessary to first define a macro for the class name, to diff --git a/panda/src/display/displayRegion.h b/panda/src/display/displayRegion.h index 3741dd395d..811b913e5c 100644 --- a/panda/src/display/displayRegion.h +++ b/panda/src/display/displayRegion.h @@ -360,8 +360,6 @@ private: static TypeHandle _type_handle; }; -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_DISPLAY, EXPTP_PANDA_DISPLAY, epvector); - #include "displayRegion.I" #endif /* DISPLAYREGION_H */ diff --git a/panda/src/egg/eggMorphList.h b/panda/src/egg/eggMorphList.h index 6461a9278f..fb6013190e 100644 --- a/panda/src/egg/eggMorphList.h +++ b/panda/src/egg/eggMorphList.h @@ -65,9 +65,6 @@ private: Morphs _morphs; }; -EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList >); -EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, EggMorphList >); - typedef EggMorphList EggMorphVertexList; typedef EggMorphList EggMorphNormalList; typedef EggMorphList EggMorphTexCoordList; diff --git a/panda/src/gobj/shader.h b/panda/src/gobj/shader.h index debc5039ca..45bcab70f9 100644 --- a/panda/src/gobj/shader.h +++ b/panda/src/gobj/shader.h @@ -607,8 +607,6 @@ private: static TypeHandle _type_handle; }; -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_GOBJ, EXPTP_PANDA_GOBJ, epvector); - #include "shader.I" #endif