diff --git a/panda/src/collide/Sources.pp b/panda/src/collide/Sources.pp index b73e6db73f..f24712747c 100644 --- a/panda/src/collide/Sources.pp +++ b/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 \ diff --git a/panda/src/collide/collisionNode.h b/panda/src/collide/collisionNode.h index d02036d218..c006ea27c7 100644 --- a/panda/src/collide/collisionNode.h +++ b/panda/src/collide/collisionNode.h @@ -9,8 +9,8 @@ #include #include "collisionSolid.h" -#include "collideMask.h" +#include #include //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/Sources.pp b/panda/src/egg/Sources.pp index ab4e249a2c..ed79f7281d 100644 --- a/panda/src/egg/Sources.pp +++ b/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 \ diff --git a/panda/src/egg/eggTexture.cxx b/panda/src/egg/eggTexture.cxx index 07e98f267c..7754bbd51a 100644 --- a/panda/src/egg/eggTexture.cxx +++ b/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: diff --git a/panda/src/egg/eggTexture.h b/panda/src/egg/eggTexture.h index 990072bd15..f5f51a9606 100644 --- a/panda/src/egg/eggTexture.h +++ b/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, diff --git a/panda/src/egg2sg/Sources.pp b/panda/src/egg2sg/Sources.pp index e1fda2fb2a..6ddbcd4f7b 100644 --- a/panda/src/egg2sg/Sources.pp +++ b/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 \ diff --git a/panda/src/egg2sg/eggLoader.cxx b/panda/src/egg2sg/eggLoader.cxx index 3d562cb02a..1ea9aff8f7 100644 --- a/panda/src/egg2sg/eggLoader.cxx +++ b/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. diff --git a/panda/src/glgsg/glGraphicsStateGuardian.cxx b/panda/src/glgsg/glGraphicsStateGuardian.cxx index e3b450a066..5312b5204c 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.cxx +++ b/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; diff --git a/panda/src/gobj/pixelBuffer.cxx b/panda/src/gobj/pixelBuffer.cxx index 35ac2e0a7f..1d45420be9 100644 --- a/panda/src/gobj/pixelBuffer.cxx +++ b/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: diff --git a/panda/src/gobj/pixelBuffer.h b/panda/src/gobj/pixelBuffer.h index 0111b898d2..e1e6d94d81 100644 --- a/panda/src/gobj/pixelBuffer.h +++ b/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 diff --git a/panda/src/putil/Sources.pp b/panda/src/putil/Sources.pp index 80b3e55bd7..3780e28600 100644 --- a/panda/src/putil/Sources.pp +++ b/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 \ diff --git a/panda/src/collide/collideMask.h b/panda/src/putil/collideMask.h similarity index 62% rename from panda/src/collide/collideMask.h rename to panda/src/putil/collideMask.h index eb546482dd..11a6a9685d 100644 --- a/panda/src/collide/collideMask.h +++ b/panda/src/putil/collideMask.h @@ -8,12 +8,17 @@ #include -#include +#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 diff --git a/panda/src/shader/planarReflector.cxx b/panda/src/shader/planarReflector.cxx index 772ee23e05..21ac30566a 100644 --- a/panda/src/shader/planarReflector.cxx +++ b/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);