瀏覽代碼

*** empty log message ***

David Rose 25 年之前
父節點
當前提交
beb480ebd3

+ 1 - 1
panda/src/collide/Sources.pp

@@ -25,7 +25,7 @@
     collisionTraverser.h config_collide.cxx config_collide.h
 
   #define INSTALL_HEADERS \
-    collideMask.h collisionEntry.I collisionEntry.h collisionHandler.h \
+    collisionEntry.I collisionEntry.h collisionHandler.h \
     collisionHandlerEvent.I collisionHandlerEvent.h \
     collisionHandlerFloor.I collisionHandlerFloor.h \
     collisionHandlerPhysical.I collisionHandlerPhysical.h \

+ 1 - 1
panda/src/collide/collisionNode.h

@@ -9,8 +9,8 @@
 #include <pandabase.h>
 
 #include "collisionSolid.h"
-#include "collideMask.h"
 
+#include <collideMask.h>
 #include <namedNode.h>
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 1
panda/src/egg/Sources.pp

@@ -5,7 +5,7 @@
 #begin lib_target
   #define TARGET egg
   #define LOCAL_LIBS \
-    linmath putil collide
+    linmath putil
 
   #define SOURCES \
     config_egg.cxx config_egg.h eggAlphaMode.I eggAlphaMode.cxx \

+ 4 - 0
panda/src/egg/eggTexture.cxx

@@ -368,6 +368,8 @@ EggTexture::Format EggTexture::
 string_format(const string &string) {
   if (cmp_nocase_uh(string, "rgba") == 0) {
     return F_rgba;
+  } else if (cmp_nocase_uh(string, "rgbm") == 0) {
+    return F_rgbm;
   } else if (cmp_nocase_uh(string, "rgba12") == 0) {
     return F_rgba12;
   } else if (cmp_nocase_uh(string, "rgba8") == 0) {
@@ -499,6 +501,8 @@ ostream &operator << (ostream &out, EggTexture::Format format) {
 
   case EggTexture::F_rgba:
     return out << "rgba";
+  case EggTexture::F_rgbm:
+    return out << "rgbm";
   case EggTexture::F_rgba12:
     return out << "rgba12";
   case EggTexture::F_rgba8:

+ 1 - 1
panda/src/egg/eggTexture.h

@@ -44,7 +44,7 @@ public:
 
   enum Format {
     F_unspecified, 
-    F_rgba, F_rgba12, F_rgba8, F_rgba4, F_rgba5,
+    F_rgba, F_rgbm, F_rgba12, F_rgba8, F_rgba4, F_rgba5,
     F_rgb, F_rgb12, F_rgb8, F_rgb5, F_rgb332,
     F_luminance_alpha,
     F_red, F_green, F_blue, F_alpha, F_luminance, 

+ 1 - 1
panda/src/egg2sg/Sources.pp

@@ -3,7 +3,7 @@
 #begin lib_target
   #define TARGET egg2sg
   #define LOCAL_LIBS \
-    egg builder loader chan char switchnode cull
+    collide egg builder loader chan char switchnode cull
 
   #define SOURCES \
     animBundleMaker.cxx animBundleMaker.h characterMaker.cxx \

+ 3 - 3
panda/src/egg2sg/eggLoader.cxx

@@ -774,9 +774,6 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) {
     case EggTexture::F_rgb5:
       tex->_pbuffer->set_format(PixelBuffer::F_rgb5);
       break;
-    case EggTexture::F_rgba5:
-      tex->_pbuffer->set_format(PixelBuffer::F_rgba5);
-      break;
     case EggTexture::F_rgb332:
       tex->_pbuffer->set_format(PixelBuffer::F_rgb332);
       break;
@@ -795,6 +792,9 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) {
     case EggTexture::F_rgba:
       tex->_pbuffer->set_format(PixelBuffer::F_rgba);
       break;
+    case EggTexture::F_rgbm:
+      tex->_pbuffer->set_format(PixelBuffer::F_rgbm);
+      break;
     case EggTexture::F_rgba12:
       if (tex->_pbuffer->get_component_width() >= 2) {
 	// Only do this if the component width supports it.

+ 3 - 0
panda/src/glgsg/glGraphicsStateGuardian.cxx

@@ -2032,6 +2032,7 @@ draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr,
   case PixelBuffer::F_rgb8:
   case PixelBuffer::F_rgb12:
   case PixelBuffer::F_rgba:
+  case PixelBuffer::F_rgbm:
   case PixelBuffer::F_rgba4:
   case PixelBuffer::F_rgba5:
   case PixelBuffer::F_rgba8:
@@ -3550,6 +3551,7 @@ get_external_image_format(PixelBuffer::Format format) {
   case PixelBuffer::F_rgb332:
     return GL_RGB;
   case PixelBuffer::F_rgba:
+  case PixelBuffer::F_rgbm:
   case PixelBuffer::F_rgba4:
   case PixelBuffer::F_rgba5:
   case PixelBuffer::F_rgba8:
@@ -3576,6 +3578,7 @@ GLenum GLGraphicsStateGuardian::
 get_internal_image_format(PixelBuffer::Format format) {
   switch (format) {
   case PixelBuffer::F_rgba:
+  case PixelBuffer::F_rgbm:
     return GL_RGBA;
   case PixelBuffer::F_rgba4:
     return GL_RGBA4;

+ 2 - 18
panda/src/gobj/pixelBuffer.cxx

@@ -95,27 +95,11 @@ bool PixelBuffer::load(const PNMImage& pnmimage)
     break;
 
   case PNMImage::CT_color:
-    // Choose a suitable default format based on the depth of the
-    // image components.
-    if (maxval > 255) {
-      _format = F_rgb12;
-    } else if (maxval > 31) {
-      _format = F_rgb8;
-    } else {
-      _format = F_rgb5;
-    }
+    _format = F_rgb;
     break;
 
   case PNMImage::CT_four_channel:
-    // Choose a suitable default format based on the depth of the
-    // image components.
-    if (maxval > 255) {
-      _format = F_rgba12;
-    } else if (maxval > 15) {
-      _format = F_rgba8;
-    } else {
-      _format = F_rgba4;
-    }
+    _format = F_rgba;
     break;
 
   default:

+ 3 - 2
panda/src/gobj/pixelBuffer.h

@@ -44,12 +44,13 @@ public:
     F_green,
     F_blue,
     F_alpha,
-    F_rgb,
+    F_rgb,     // any suitable RGB mode, whatever the hardware prefers
     F_rgb5,    // specifically, 5 bits per R,G,B channel
     F_rgb8,    // 8 bits per R,G,B channel
     F_rgb12,   // 12 bits per R,G,B channel
     F_rgb332,  // 3 bits per R & G, 2 bits for B
-    F_rgba,
+    F_rgba,    // any suitable RGBA mode, whatever the hardware prefers
+    F_rgbm,    // as above, but only requires 1 bit for alpha (i.e. mask)
     F_rgba4,   // 4 bits per R,G,B,A channel
     F_rgba5,   // 5 bits per R,G,B channel, 1 bit alpha
     F_rgba8,   // 8 bits per R,G,B,A channel

+ 3 - 1
panda/src/putil/Sources.pp

@@ -11,6 +11,7 @@
     bamWriter.h bitMask.I bitMask.cxx bitMask.h buttonEvent.I \
     buttonEvent.cxx buttonEvent.h buttonHandle.I buttonHandle.cxx \
     buttonHandle.h buttonRegistry.I buttonRegistry.cxx buttonRegistry.h \
+    collideMask.h \
     config_util.N config_util.cxx config_util.h configurable.cxx \
     configurable.h factoryBase.I factoryBase.cxx factoryBase.h \
     factoryParam.I factoryParam.cxx factoryParam.h factoryParams.I \
@@ -42,7 +43,8 @@
     bam.h bamReader.I bamReader.h bamReaderParam.I bamReaderParam.h \
     bamWriter.I bamWriter.h bitMask.I bitMask.h buttonEvent.I \
     buttonEvent.h buttonHandle.I buttonHandle.h buttonRegistry.I \
-    buttonRegistry.h config_util.h configurable.h factory.I factory.h \
+    buttonRegistry.h collideMask.h \
+    config_util.h configurable.h factory.I factory.h \
     factoryBase.I factoryBase.h factoryParam.I factoryParam.h \
     factoryParams.I factoryParams.h globPattern.I globPattern.h \
     globalPointerRegistry.I globalPointerRegistry.h indirectCompareTo.I \

+ 6 - 1
panda/src/collide/collideMask.h → panda/src/putil/collideMask.h

@@ -8,12 +8,17 @@
 
 #include <pandabase.h>
 
-#include <bitMask.h>
+#include "bitMask.h"
 
 // This is the data type of the collision mask: the set of bits that
 // every CollisionNode has, and that any two nodes must have some in
 // common in order to be tested for a mutual intersection.
 
+// This file used to live in the collide directory, but since it's
+// such a trivial definition that a few other directories (like egg)
+// need without necessarily having to pull in all of collide, it
+// seemed better to move it to putil.
+
 typedef BitMask32 CollideMask;
 
 #endif

+ 0 - 1
panda/src/shader/planarReflector.cxx

@@ -252,7 +252,6 @@ apply(Node *node, const AllAttributesWrapper &init_state,
     NamedNodeVector::iterator c;
     for (c = _casters.begin(); c != _casters.end(); ++c) {
       Node *caster = (*c);
-      NamedNode *output = DCAST(NamedNode, caster);
 
       LMatrix4f mat;
       get_rel_mat(caster, _plane_node, mat);