Browse Source

Merge branch 'release/1.10.x'

rdb 4 years ago
parent
commit
c73c94c862

+ 2 - 1
BACKERS.md

@@ -10,11 +10,12 @@ This is a list of all the people who are contributing financially to Panda3D.  I
 
 
 ## Bronze Sponsors
 ## Bronze Sponsors
 
 
-![Bronze Sponsors](https://opencollective.com/panda3d/tiers/bronze-sponsor.svg?avatarHeight=48&width=600)
+[<img src="https://www.panda3d.org/wp-content/uploads/2021/02/changecrab_logo.png" alt="ChangeCrab" height="48">](https://changecrab.com/) ![Bronze Sponsors](https://opencollective.com/panda3d/tiers/bronze-sponsor.svg?avatarHeight=48&width=600)
 
 
 * [Mitchell Stokes](https://opencollective.com/mitchell-stokes)
 * [Mitchell Stokes](https://opencollective.com/mitchell-stokes)
 * [Daniel Stokes](https://opencollective.com/daniel-stokes)
 * [Daniel Stokes](https://opencollective.com/daniel-stokes)
 * [David Rose](https://opencollective.com/david-rose)
 * [David Rose](https://opencollective.com/david-rose)
+* [ChangeCrab](https://changecrab.com)
 
 
 ## Benefactors
 ## Benefactors
 
 

+ 10 - 0
dtool/src/prc/configPageManager.h

@@ -63,6 +63,16 @@ PUBLISHED:
 
 
   static ConfigPageManager *get_global_ptr();
   static ConfigPageManager *get_global_ptr();
 
 
+PUBLISHED:
+  MAKE_PROPERTY(search_path, get_search_path);
+
+  MAKE_SEQ_PROPERTY(prc_patterns, get_num_prc_patterns, get_prc_pattern);
+  MAKE_SEQ_PROPERTY(prc_encrypted_patterns, get_num_prc_encrypted_patterns, get_prc_encrypted_pattern);
+  MAKE_SEQ_PROPERTY(prc_executable_patterns, get_num_prc_executable_patterns, get_prc_executable_pattern);
+
+  MAKE_SEQ_PROPERTY(implicit_pages, get_num_implicit_pages, get_implicit_page);
+  MAKE_SEQ_PROPERTY(explicit_pages, get_num_explicit_pages, get_explicit_page);
+
 public:
 public:
   INLINE void mark_unsorted();
   INLINE void mark_unsorted();
 
 

+ 57 - 0
panda/src/bullet/bulletGhostNode.cxx

@@ -41,6 +41,39 @@ BulletGhostNode(const char *name) : BulletBodyNode(name) {
   _ghost->setCollisionShape(_shape);
   _ghost->setCollisionShape(_shape);
 }
 }
 
 
+/**
+ * Do not call the copy constructor directly; instead, use make_copy() or
+ * copy_subgraph() to make a copy of a node.
+ */
+BulletGhostNode::
+BulletGhostNode(const BulletGhostNode &copy) :
+  BulletBodyNode(copy),
+  _sync(TransformState::make_identity()),
+  _sync_disable(false),
+  _sync_local(false)
+{
+  // Initial transform - the node has no parent yet, so this is the local one
+  btTransform trans = TransformState_to_btTrans(get_transform());
+
+  // Ghost object
+  _ghost = new btPairCachingGhostObject();
+  _ghost->setUserPointer(this);
+  _ghost->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
+  _ghost->setWorldTransform(trans);
+  _ghost->setInterpolationWorldTransform(trans);
+  _ghost->setCollisionShape(_shape);
+}
+
+/**
+ * Returns a newly-allocated PandaNode that is a shallow copy of this one.  It
+ * will be a different pointer, but its internal data may or may not be shared
+ * with that of the original PandaNode.  No children will be copied.
+ */
+PandaNode *BulletGhostNode::
+make_copy() const {
+  return new BulletGhostNode(*this);
+}
+
 /**
 /**
  *
  *
  */
  */
@@ -171,3 +204,27 @@ do_sync_b2p() {
     _sync_disable = false;
     _sync_disable = false;
   }
   }
 }
 }
+
+/**
+ * Tells the BamReader how to create objects of type BulletGhostNode.
+ */
+void BulletGhostNode::
+register_with_read_factory() {
+  BamReader::get_factory()->register_factory(get_class_type(), make_from_bam);
+}
+
+/**
+ * This function is called by the BamReader's factory when a new object of
+ * this type is encountered in the Bam file.  It should create the ghost node.
+ */
+TypedWritable *BulletGhostNode::
+make_from_bam(const FactoryParams &params) {
+  BulletGhostNode *param = new BulletGhostNode;
+  DatagramIterator scan;
+  BamReader *manager;
+
+  parse_params(params, scan, manager);
+  param->fillin(scan, manager);
+
+  return param;
+}

+ 8 - 0
panda/src/bullet/bulletGhostNode.h

@@ -59,6 +59,14 @@ private:
 
 
   void do_transform_changed();
   void do_transform_changed();
 
 
+public:
+  static void register_with_read_factory();
+  virtual PandaNode *make_copy() const;
+
+protected:
+  BulletGhostNode(const BulletGhostNode &copy);
+  static TypedWritable *make_from_bam(const FactoryParams &params);
+
 public:
 public:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {
     return _type_handle;
     return _type_handle;

+ 1 - 0
panda/src/bullet/config_bullet.cxx

@@ -189,6 +189,7 @@ init_libbullet() {
   BulletDebugNode::register_with_read_factory();
   BulletDebugNode::register_with_read_factory();
   BulletPlaneShape::register_with_read_factory();
   BulletPlaneShape::register_with_read_factory();
   BulletRigidBodyNode::register_with_read_factory();
   BulletRigidBodyNode::register_with_read_factory();
+  BulletGhostNode::register_with_read_factory();
   BulletSphereShape::register_with_read_factory();
   BulletSphereShape::register_with_read_factory();
   BulletTriangleMesh::register_with_read_factory();
   BulletTriangleMesh::register_with_read_factory();
   BulletTriangleMeshShape::register_with_read_factory();
   BulletTriangleMeshShape::register_with_read_factory();

+ 31 - 4
panda/src/collide/collisionBox.cxx

@@ -30,6 +30,7 @@
 #include "cmath.h"
 #include "cmath.h"
 #include "mathNumbers.h"
 #include "mathNumbers.h"
 #include "geom.h"
 #include "geom.h"
+#include "geomLines.h"
 #include "geomTriangles.h"
 #include "geomTriangles.h"
 #include "geomVertexWriter.h"
 #include "geomVertexWriter.h"
 #include "config_mathutil.h"
 #include "config_mathutil.h"
@@ -1024,11 +1025,37 @@ fill_viz_geom() {
   tris->add_vertices(3, 7, 0);
   tris->add_vertices(3, 7, 0);
   tris->add_vertices(0, 7, 4);
   tris->add_vertices(0, 7, 4);
 
 
-  PT(Geom) geom = new Geom(vdata);
-  geom->add_primitive(tris);
+  PT(GeomLines) lines = new GeomLines(Geom::UH_static);
 
 
-  _viz_geom->add_geom(geom, get_solid_viz_state());
-  _bounds_viz_geom->add_geom(geom, get_solid_bounds_viz_state());
+  // Bottom
+  lines->add_vertices(0, 1);
+  lines->add_vertices(1, 2);
+  lines->add_vertices(0, 3);
+  lines->add_vertices(2, 3);
+
+  // Top
+  lines->add_vertices(4, 5);
+  lines->add_vertices(5, 6);
+  lines->add_vertices(4, 7);
+  lines->add_vertices(6, 7);
+
+  // Sides
+  lines->add_vertices(0, 4);
+  lines->add_vertices(1, 5);
+  lines->add_vertices(2, 6);
+  lines->add_vertices(3, 7);
+
+  PT(Geom) geom1 = new Geom(vdata);
+  geom1->add_primitive(tris);
+
+  PT(Geom) geom2 = new Geom(vdata);
+  geom2->add_primitive(lines);
+
+  _viz_geom->add_geom(geom1, get_solid_viz_state());
+  _viz_geom->add_geom(geom2, get_wireframe_viz_state());
+
+  _bounds_viz_geom->add_geom(geom1, get_solid_bounds_viz_state());
+  _bounds_viz_geom->add_geom(geom2, get_wireframe_viz_state());
 }
 }
 
 
 /**
 /**

+ 7 - 0
panda/src/event/asyncFuture_ext.cxx

@@ -205,6 +205,9 @@ result(PyObject *timeout) const {
           exc_type = PyObject_GetAttrString(module, "TimeoutError");
           exc_type = PyObject_GetAttrString(module, "TimeoutError");
           Py_DECREF(module);
           Py_DECREF(module);
         }
         }
+        else {
+          PyErr_Clear();
+        }
         // If we can't get that, we should pretend and make our own.
         // If we can't get that, we should pretend and make our own.
         if (exc_type == nullptr) {
         if (exc_type == nullptr) {
 #if PY_VERSION_HEX >= 0x03080000
 #if PY_VERSION_HEX >= 0x03080000
@@ -315,6 +318,10 @@ get_cancelled_error_type() {
       exc_type = PyObject_GetAttrString(module, "CancelledError");
       exc_type = PyObject_GetAttrString(module, "CancelledError");
       Py_DECREF(module);
       Py_DECREF(module);
     }
     }
+    else {
+      PyErr_Clear();
+    }
+
     // If we can't get that, we should pretend and make our own.
     // If we can't get that, we should pretend and make our own.
     if (exc_type == nullptr) {
     if (exc_type == nullptr) {
 #if PY_VERSION_HEX >= 0x03080000
 #if PY_VERSION_HEX >= 0x03080000

+ 9 - 3
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -1039,8 +1039,10 @@ reset() {
 #endif
 #endif
     _supports_tex_storage = true;
     _supports_tex_storage = true;
 
 
+#ifndef OPENGLES
     _glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)
     _glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)
       get_extension_func("glTexStorage1D");
       get_extension_func("glTexStorage1D");
+#endif
     _glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)
     _glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)
       get_extension_func("glTexStorage2D");
       get_extension_func("glTexStorage2D");
     _glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)
     _glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)
@@ -1050,8 +1052,6 @@ reset() {
   else if (has_extension("GL_EXT_texture_storage")) {
   else if (has_extension("GL_EXT_texture_storage")) {
     _supports_tex_storage = true;
     _supports_tex_storage = true;
 
 
-    _glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)
-      get_extension_func("glTexStorage1DEXT");
     _glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)
     _glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)
       get_extension_func("glTexStorage2DEXT");
       get_extension_func("glTexStorage2DEXT");
     _glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)
     _glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)
@@ -1060,7 +1060,11 @@ reset() {
 #endif
 #endif
 
 
   if (_supports_tex_storage) {
   if (_supports_tex_storage) {
-    if (_glTexStorage1D == nullptr || _glTexStorage2D == nullptr || _glTexStorage3D == nullptr) {
+    if (
+#ifndef OPENGLES
+        _glTexStorage1D == nullptr ||
+#endif
+        _glTexStorage2D == nullptr || _glTexStorage3D == nullptr) {
       GLCAT.warning()
       GLCAT.warning()
         << "Immutable texture storage advertised as supported by OpenGL runtime, but could not get pointers to extension functions.\n";
         << "Immutable texture storage advertised as supported by OpenGL runtime, but could not get pointers to extension functions.\n";
       _supports_tex_storage = false;
       _supports_tex_storage = false;
@@ -13230,8 +13234,10 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
       case Texture::TT_buffer_texture:
       case Texture::TT_buffer_texture:
         // Won't get here, but squelch compiler warning
         // Won't get here, but squelch compiler warning
       case Texture::TT_1d_texture:
       case Texture::TT_1d_texture:
+#ifndef OPENGLES
         _glTexStorage1D(target, num_levels, internal_format, width);
         _glTexStorage1D(target, num_levels, internal_format, width);
         break;
         break;
+#endif
       case Texture::TT_2d_texture:
       case Texture::TT_2d_texture:
       case Texture::TT_cube_map:
       case Texture::TT_cube_map:
       case Texture::TT_1d_texture_array:
       case Texture::TT_1d_texture_array:

+ 2 - 0
panda/src/glstuff/glGraphicsStateGuardian_src.h

@@ -789,7 +789,9 @@ public:
 #endif
 #endif
 
 
   bool _supports_tex_storage;
   bool _supports_tex_storage;
+#ifndef OPENGLES
   PFNGLTEXSTORAGE1DPROC _glTexStorage1D;
   PFNGLTEXSTORAGE1DPROC _glTexStorage1D;
+#endif
   PFNGLTEXSTORAGE2DPROC _glTexStorage2D;
   PFNGLTEXSTORAGE2DPROC _glTexStorage2D;
   PFNGLTEXSTORAGE3DPROC _glTexStorage3D;
   PFNGLTEXSTORAGE3DPROC _glTexStorage3D;
 
 

+ 4 - 0
panda/src/glstuff/glShaderContext_src.cxx

@@ -1017,6 +1017,10 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
         else if (noprefix.compare(7, string::npos, "Emission") == 0) {
         else if (noprefix.compare(7, string::npos, "Emission") == 0) {
           bind._part = Shader::STO_stage_emission_i;
           bind._part = Shader::STO_stage_emission_i;
         }
         }
+        else {
+          GLCAT.error()
+            << "Unrecognized shader input name: p3d_" << noprefix << "\n";
+        }
 
 
         for (bind._stage = 0; bind._stage < param_size; ++bind._stage) {
         for (bind._stage = 0; bind._stage < param_size; ++bind._stage) {
           _glgsg->_glUniform1i(p + bind._stage, _shader->_tex_spec.size());
           _glgsg->_glUniform1i(p + bind._stage, _shader->_tex_spec.size());

+ 7 - 3
panda/src/gobj/geomVertexArrayData.cxx

@@ -59,8 +59,10 @@ ALLOC_DELETED_CHAIN_DEF(GeomVertexArrayDataHandle);
  * file.
  * file.
  */
  */
 GeomVertexArrayData::
 GeomVertexArrayData::
-GeomVertexArrayData() : SimpleLruPage(0) {
-  _contexts = nullptr;
+GeomVertexArrayData() :
+  SimpleLruPage(0),
+  _array_format(nullptr),
+  _contexts(nullptr) {
 
 
   // Can't put it in the LRU until it has been read in and made valid.
   // Can't put it in the LRU until it has been read in and made valid.
 }
 }
@@ -180,7 +182,8 @@ set_usage_hint(GeomVertexArrayData::UsageHint usage_hint) {
  */
  */
 void GeomVertexArrayData::
 void GeomVertexArrayData::
 output(std::ostream &out) const {
 output(std::ostream &out) const {
-  out << get_num_rows() << " rows: " << *get_array_format();
+  nassertv(_array_format != nullptr);
+  out << get_num_rows() << " rows: " << *_array_format;
 }
 }
 
 
 /**
 /**
@@ -188,6 +191,7 @@ output(std::ostream &out) const {
  */
  */
 void GeomVertexArrayData::
 void GeomVertexArrayData::
 write(std::ostream &out, int indent_level) const {
 write(std::ostream &out, int indent_level) const {
+  nassertv(_array_format != nullptr);
   _array_format->write_with_data(out, indent_level, this);
   _array_format->write_with_data(out, indent_level, this);
 }
 }
 
 

+ 1 - 0
panda/src/gobj/geomVertexData.I

@@ -605,6 +605,7 @@ CacheEntry(GeomVertexData *source, CacheKey &&key) noexcept :
  */
  */
 INLINE GeomVertexData::CData::
 INLINE GeomVertexData::CData::
 CData() :
 CData() :
+  _format(nullptr),
   _usage_hint(UH_unspecified)
   _usage_hint(UH_unspecified)
 {
 {
 }
 }

+ 12 - 3
panda/src/gobj/geomVertexData.cxx

@@ -1268,7 +1268,9 @@ output(ostream &out) const {
   if (!get_name().empty()) {
   if (!get_name().empty()) {
     out << get_name() << " ";
     out << get_name() << " ";
   }
   }
-  out << get_num_rows() << " rows: " << *get_format();
+  const GeomVertexFormat *format = get_format();
+  nassertv(format != nullptr);
+  out << get_num_rows() << " rows: " << *format;
 }
 }
 
 
 /**
 /**
@@ -1279,8 +1281,15 @@ write(ostream &out, int indent_level) const {
   if (!get_name().empty()) {
   if (!get_name().empty()) {
     indent(out, indent_level) << get_name() << "\n";
     indent(out, indent_level) << get_name() << "\n";
   }
   }
-  get_format()->write_with_data(out, indent_level + 2, this);
-  CPT(TransformBlendTable) table = get_transform_blend_table();
+  CPT(TransformBlendTable) table;
+  const GeomVertexFormat *format = nullptr;
+  {
+    CDReader cdata(_cycler);
+    format = cdata->_format;
+    table = cdata->_transform_blend_table.get_read_pointer();
+  }
+  nassertv(format != nullptr);
+  format->write_with_data(out, indent_level + 2, this);
   if (table != nullptr) {
   if (table != nullptr) {
     indent(out, indent_level)
     indent(out, indent_level)
       << "Transform blend table:\n";
       << "Transform blend table:\n";

+ 9 - 0
tests/bullet/test_bullet_bam.py

@@ -131,3 +131,12 @@ def test_sphere_shape():
     assert shape.margin == shape2.margin
     assert shape.margin == shape2.margin
     assert shape.name == shape2.name
     assert shape.name == shape2.name
     assert shape.radius == shape2.radius
     assert shape.radius == shape2.radius
+
+
+def test_ghost():
+    node = bullet.BulletGhostNode("some ghost node")
+
+    node2 = reconstruct(node)
+
+    assert type(node) is type(node2)
+    assert node.name == node2.name