Browse Source

Merge branch 'release/1.10.x'

rdb 3 years ago
parent
commit
9768cbb6c2

+ 27 - 1
direct/src/filter/CommonFilters.py

@@ -17,7 +17,7 @@ These filters are written in the Cg shading language.
 # clunky approach.  - Josh
 
 from panda3d.core import LVecBase4, LPoint2
-from panda3d.core import AuxBitplaneAttrib
+from panda3d.core import AuxBitplaneAttrib, AntialiasAttrib
 from panda3d.core import Texture, Shader, ATSNone
 from panda3d.core import FrameBufferProperties
 from panda3d.core import getDefaultCoordinateSystem, CS_zup_right, CS_zup_left
@@ -189,11 +189,22 @@ class CommonFilters:
                 fbprops.setSrgbColor(False)
                 clamping = False
 
+            if "MSAA" in configuration:
+                if fbprops is None:
+                    fbprops = FrameBufferProperties()
+                fbprops.setMultisamples(configuration["MSAA"].samples)
+
             self.finalQuad = self.manager.renderSceneInto(textures = self.textures, auxbits=auxbits, fbprops=fbprops, clamping=clamping)
             if self.finalQuad is None:
                 self.cleanup()
                 return False
 
+            if "MSAA" in configuration:
+                camNode = self.manager.camera.node()
+                state = camNode.getInitialState()
+                state.setAttrib(AntialiasAttrib.make(AntialiasAttrib.M_multisample))
+                camNode.setInitialState(state)
+
             if "BlurSharpen" in configuration:
                 blur0 = self.textures["blur0"]
                 blur1 = self.textures["blur1"]
@@ -454,6 +465,19 @@ class CommonFilters:
         if task is not None:
             return task.cont
 
+    def setMSAA(self, samples):
+        fullrebuild = "MSAA" not in self.configuration or self.configuration["MSAA"].samples != samples
+        newconfig = FilterConfig()
+        newconfig.samples = samples
+        self.configuration["MSAA"] = newconfig
+        return self.reconfigure(fullrebuild, "MSAA")
+
+    def delMSAA(self):
+        if "MSAA" in self.configuration:
+            del self.configuration["MSAA"]
+            return self.reconfigure(True, "MSAA")
+        return True
+
     def setCartoonInk(self, separation=1, color=(0, 0, 0, 1)):
         fullrebuild = ("CartoonInk" not in self.configuration)
         newconfig = FilterConfig()
@@ -679,6 +703,8 @@ class CommonFilters:
         return True
 
     #snake_case alias:
+    set_msaa = setMSAA
+    del_msaa = delMSAA
     del_cartoon_ink = delCartoonInk
     set_half_pixel_shift = setHalfPixelShift
     del_half_pixel_shift = delHalfPixelShift

+ 2 - 2
dtool/src/cppparser/cppPreprocessor.h

@@ -72,10 +72,10 @@ public:
   typedef std::map<std::string, CPPManifest *> Manifests;
   Manifests _manifests;
 
-  typedef pvector<CPPManifest *> ManifestStack;
+  typedef std::vector<CPPManifest *> ManifestStack;
   std::map<std::string, ManifestStack> _manifest_stack;
 
-  pvector<CPPFile::Source> _quote_include_kind;
+  std::vector<CPPFile::Source> _quote_include_kind;
   DSearchPath _quote_include_path;
   DSearchPath _angle_include_path;
   bool _noangles;

+ 1 - 4
panda/src/bullet/bulletAllHitsRayResult.I

@@ -18,10 +18,7 @@
 INLINE BulletAllHitsRayResult BulletAllHitsRayResult::
 empty() {
 
-  btVector3 from;
-  btVector3 to;
-
-  return BulletAllHitsRayResult(from, to, CollideMask::all_on());
+  return BulletAllHitsRayResult(btVector3(0, 0, 0), btVector3(0, 0, 0), CollideMask::all_on());
 }
 
 /**

+ 0 - 14
panda/src/bullet/bulletWheel.I

@@ -26,17 +26,3 @@ INLINE BulletWheelRaycastInfo::
 ~BulletWheelRaycastInfo() {
 
 }
-
-/**
- * Named constructor intended to be used for asserts with have to return a
- * concrete value.
- */
-INLINE BulletWheel BulletWheel::
-empty() {
-
-  btWheelInfoConstructionInfo ci {};
-  btWheelInfo info(ci);
-
-  return BulletWheel(info);
-}
-

+ 13 - 0
panda/src/bullet/bulletWheel.cxx

@@ -23,6 +23,19 @@ BulletWheel(btWheelInfo &info) : _info(info) {
 
 }
 
+/**
+ * Named constructor intended to be used for asserts with have to return a
+ * concrete value.
+ */
+BulletWheel BulletWheel::
+empty() {
+
+  static btWheelInfoConstructionInfo ci {};
+  static btWheelInfo info(ci);
+
+  return BulletWheel(info);
+}
+
 /**
  *
  */

+ 1 - 1
panda/src/bullet/bulletWheel.h

@@ -143,7 +143,7 @@ PUBLISHED:
 public:
   BulletWheel(btWheelInfo &info);
 
-  INLINE static BulletWheel empty();
+  static BulletWheel empty();
 
 private:
   btWheelInfo &_info;

+ 5 - 4
panda/src/bullet/bullet_utils.cxx

@@ -60,8 +60,9 @@ LPoint3 btVector3_to_LPoint3(const btVector3 &p) {
  */
 btMatrix3x3 LMatrix3_to_btMatrix3x3(const LMatrix3 &m) {
 
+  LMatrix4 m4(m);
   btMatrix3x3 result;
-  result.setFromOpenGLSubMatrix((const btScalar *)m.get_data());
+  result.setFromOpenGLSubMatrix((const btScalar *)m4.get_data());
   return result;
 }
 
@@ -70,11 +71,11 @@ btMatrix3x3 LMatrix3_to_btMatrix3x3(const LMatrix3 &m) {
  */
 LMatrix3 btMatrix3x3_to_LMatrix3(const btMatrix3x3 &m) {
 
-  btScalar cells[9];
+  btScalar cells[12];
   m.getOpenGLSubMatrix(cells);
   return LMatrix3((PN_stdfloat)cells[0], (PN_stdfloat)cells[1], (PN_stdfloat)cells[2],
-                  (PN_stdfloat)cells[3], (PN_stdfloat)cells[4], (PN_stdfloat)cells[5],
-                  (PN_stdfloat)cells[6], (PN_stdfloat)cells[7], (PN_stdfloat)cells[8]);
+                  (PN_stdfloat)cells[4], (PN_stdfloat)cells[5], (PN_stdfloat)cells[6],
+                  (PN_stdfloat)cells[8], (PN_stdfloat)cells[9], (PN_stdfloat)cells[10]);
 }
 
 /**

+ 12 - 1
panda/src/glstuff/glGraphicsBuffer_src.cxx

@@ -2005,11 +2005,22 @@ resolve_multisamples() {
     }
   }
 
+#ifndef OPENGLES
+  if (_have_any_color) {
+    glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+    glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
+  } else {
+    glDrawBuffer(GL_NONE);
+    glReadBuffer(GL_NONE);
+  }
+#endif
+
   if (do_depth_blit) {
     glgsg->_glBlitFramebuffer(0, 0, _rb_size_x, _rb_size_y, 0, 0, _rb_size_x, _rb_size_y,
                               GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT,
                               GL_NEAREST);
-  } else {
+  }
+  else if (_have_any_color) {
     glgsg->_glBlitFramebuffer(0, 0, _rb_size_x, _rb_size_y, 0, 0, _rb_size_x, _rb_size_y,
                               GL_COLOR_BUFFER_BIT,
                               GL_NEAREST);

+ 4 - 5
panda/src/pgraph/pandaNode.cxx

@@ -3261,8 +3261,6 @@ update_cached(bool update_bounds, int pipeline_stage, PandaNode::CDLockedStageRe
       off_clip_planes = ClipPlaneAttrib::make();
     }
 
-    int num_vertices = cdata->_internal_vertices;
-
     // Also get the list of the node's children.  When the cdataw destructs, it
     // will also release the lock, since we've got all the data we need from the
     // node.
@@ -3307,6 +3305,7 @@ update_cached(bool update_bounds, int pipeline_stage, PandaNode::CDLockedStageRe
     }
 
     // Now expand those contents to include all of our children.
+    int child_vertices = 0;
 
     for (int i = 0; i < num_children; ++i) {
       DownConnection &connection = (*down)[i];
@@ -3402,7 +3401,7 @@ update_cached(bool update_bounds, int pipeline_stage, PandaNode::CDLockedStageRe
             nassertr(child_volumes_i < num_children + 1, CDStageWriter(_cycler, pipeline_stage, cdata));
             child_volumes[child_volumes_i++] = child_cdataw->_external_bounds;
           }
-          num_vertices += child_cdataw->_nested_vertices;
+          child_vertices += child_cdataw->_nested_vertices;
 
           connection._external_bounds = child_cdataw->_external_bounds->as_geometric_bounding_volume();
         }
@@ -3461,7 +3460,7 @@ update_cached(bool update_bounds, int pipeline_stage, PandaNode::CDLockedStageRe
             nassertr(child_volumes_i < num_children + 1, CDStageWriter(_cycler, pipeline_stage, cdata));
             child_volumes[child_volumes_i++] = child_cdata->_external_bounds;
           }
-          num_vertices += child_cdata->_nested_vertices;
+          child_vertices += child_cdata->_nested_vertices;
 
           connection._external_bounds = child_cdata->_external_bounds->as_geometric_bounding_volume();
         }
@@ -3516,7 +3515,7 @@ update_cached(bool update_bounds, int pipeline_stage, PandaNode::CDLockedStageRe
         cdataw->_off_clip_planes = off_clip_planes;
 
         if (update_bounds) {
-          cdataw->_nested_vertices = num_vertices;
+          cdataw->_nested_vertices = cdataw->_internal_vertices + child_vertices;
 
           BoundingVolume::BoundsType btype = cdataw->_bounds_type;
           if (btype == BoundingVolume::BT_default) {