From 231e35795279e1e19e895f4c952016a2b3dd496f Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 24 Oct 2000 02:38:00 +0000 Subject: [PATCH] *** empty log message *** --- dtool/pptempl/Template.unix.pp | 4 +- panda/src/chan/movingPart.I | 13 ++-- panda/src/chancfg/chancfg.cxx | 6 +- panda/src/char/character.I | 2 +- panda/src/char/computedVertices.cxx | 22 +++--- panda/src/char/computedVerticesMorph.I | 2 +- panda/src/chat/chatInput.cxx | 2 +- panda/src/collide/collisionEntry.I | 56 ++++++++++++-- panda/src/collide/collisionEntry.h | 3 + panda/src/collide/collisionHandlerEvent.I | 12 +++ panda/src/collide/collisionHandlerEvent.h | 1 + panda/src/collide/collisionHandlerQueue.cxx | 49 ++++++++++++ panda/src/collide/collisionHandlerQueue.h | 2 + panda/src/collide/collisionLevelState.I | 18 ++--- panda/src/collide/collisionNode.I | 7 +- panda/src/collide/collisionPolygon.I | 35 +++++++++ panda/src/collide/collisionPolygon.cxx | 72 +++++++++++------- panda/src/collide/collisionPolygon.h | 7 ++ panda/src/collide/collisionTraverser.cxx | 16 ++-- panda/src/cull/geomBinBackToFront.cxx | 2 - panda/src/cull/geomBinFixed.cxx | 2 - panda/src/cull/geomBinUnsorted.cxx | 1 - panda/src/device/adinputNode.cxx | 2 +- panda/src/device/clientBase.cxx | 4 +- panda/src/device/trackerNode.cxx | 2 +- panda/src/display/displayRegion.cxx | 12 ++- panda/src/display/graphicsPipe.h | 2 +- panda/src/display/graphicsStateGuardian.h | 2 +- panda/src/display/graphicsWindow.N | 1 - panda/src/display/graphicsWindow.cxx | 4 +- panda/src/display/graphicsWindow.h | 4 +- panda/src/downloader/asyncUtility.h | 2 +- panda/src/downloader/decompressor.cxx | 2 +- panda/src/downloader/decompressor.h | 2 +- panda/src/downloader/downloader.h | 2 +- panda/src/downloader/extractor.h | 2 +- panda/src/downloader/patcher.h | 2 +- panda/src/effects/lensFlareNode.cxx | 20 ++--- panda/src/express/tokenBoard.h | 2 +- panda/src/framework/framework.cxx | 3 +- panda/src/glgsg/glGraphicsStateGuardian.cxx | 74 ++++++++++--------- panda/src/glxdisplay/glxGraphicsWindow.cxx | 5 +- panda/src/gobj/geom.cxx | 3 + panda/src/gobj/geomQuad.cxx | 2 +- panda/src/gobj/geomTri.cxx | 3 +- panda/src/gobj/geomTrifan.cxx | 3 +- panda/src/gobj/geomTristrip.cxx | 2 +- panda/src/gobj/pixelBuffer.I | 8 +- panda/src/graph/dftraverser.I | 31 ++++---- panda/src/graph/dftraverser.h | 20 ++--- panda/src/graph/wrt.I | 3 +- panda/src/grutil/lineSegs.I | 8 +- panda/src/grutil/lineSegs.cxx | 2 +- panda/src/lerp/lerp.cxx | 20 ++--- panda/src/lerp/lerpfunctor.h | 2 +- panda/src/light/light.h | 2 +- panda/src/light/spotlight.cxx | 6 +- panda/src/linmath/ioPtaDatagramLinMath.I | 2 +- panda/src/linmath/lmatrix3.I | 2 - panda/src/linmath/lmatrix4.I | 7 ++ panda/src/linmath/lvector3.I | 16 ++-- .../src/particlesystem/baseParticleRenderer.I | 25 +++---- .../particlesystem/geomParticleRenderer.cxx | 6 +- .../particlesystem/lineParticleRenderer.cxx | 8 +- panda/src/particlesystem/particleSystem.cxx | 7 +- .../particlesystem/particleSystemManager.cxx | 2 +- .../particlesystem/pointParticleRenderer.cxx | 17 ++--- .../sparkleParticleRenderer.cxx | 13 ++-- .../particlesystem/spriteParticleRenderer.cxx | 20 ++--- panda/src/physics/forceNode.I | 2 +- panda/src/physics/forceNode.cxx | 2 +- panda/src/physics/linearEulerIntegrator.cxx | 2 +- panda/src/physics/physicalNode.I | 2 +- panda/src/physics/physicalNode.cxx | 2 +- panda/src/switchnode/LODNode.I | 2 +- panda/src/tform/driveInterface.cxx | 3 + 76 files changed, 470 insertions(+), 268 deletions(-) diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp index 8ac9da82e8..131f324cef 100644 --- a/dtool/pptempl/Template.unix.pp +++ b/dtool/pptempl/Template.unix.pp @@ -108,7 +108,7 @@ // $[target_ipath] is the proper ipath to put on the command line, // from the context of a particular target. -#defer target_ipath $[other_trees:%=%/include] $[TOPDIR] $[sort $[complete_ipath]] $[get_ipath] +#defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees:%=%/include] $[get_ipath] // $[file_ipath] is the ipath from the context of a particular source // file, given in $[file]. It uses the all_sources map to look up @@ -129,7 +129,7 @@ // $[lpath] is like $[target_ipath]: it's the list of directories we // should add to our -L list, from the context of a particular target. -#defer lpath $[other_trees:%=%/lib] $[sort $[complete_lpath]] $[get_lpath] +#defer lpath $[sort $[complete_lpath]] $[other_trees:%=%/lib] $[get_lpath] // And $[libs] is the set of libraries we will link with. #defer libs $[unique $[complete_local_libs] $[patsubst %:m,,%:c %,%,$[OTHER_LIBS]] $[get_libs]] diff --git a/panda/src/chan/movingPart.I b/panda/src/chan/movingPart.I index 90d3f41349..556d168f55 100644 --- a/panda/src/chan/movingPart.I +++ b/panda/src/chan/movingPart.I @@ -28,8 +28,8 @@ template INLINE MovingPart:: MovingPart(const MovingPart ©) : MovingPartBase(copy), - _initial_value(copy._initial_value), - _value(copy._value) + _value(copy._value), + _initial_value(copy._initial_value) { } @@ -41,10 +41,11 @@ MovingPart(const MovingPart ©) : template INLINE MovingPart:: MovingPart(PartGroup *parent, const string &name, - const ValueType &initial_value) - : MovingPartBase(parent, name), - _initial_value(initial_value), - _value(initial_value) { + const ValueType &initial_value) : + MovingPartBase(parent, name), + _value(initial_value), + _initial_value(initial_value) +{ } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/chancfg/chancfg.cxx b/panda/src/chancfg/chancfg.cxx index 6c37653d40..0094ecda2f 100644 --- a/panda/src/chancfg/chancfg.cxx +++ b/panda/src/chancfg/chancfg.cxx @@ -189,7 +189,11 @@ SetupFOV ChanResolveFOV(SetupFOV& fov, float sizeX, float sizeY) { chancfg_cat->debug() << "ChanResolveFOV:: setting horiz = " << horiz << " and vert = " << vert << endl; break; + + default: + break; } + ret.setFOV(horiz, vert); return ret; } @@ -340,7 +344,7 @@ PT(GraphicsWindow) ChanConfig(GraphicsPipe* pipe, std::string cfg, bool border = !chanconfig.GetBool("no-border", !W.getBorder()); bool fullscreen = chanconfig.GetBool("fullscreen", false); - bool cursor = chanconfig.GetBool("cursor-visible", W.getCursor()); + // bool cursor = chanconfig.GetBool("cursor-visible", W.getCursor()); int want_depth_bits = chanconfig.GetInt("want-depth-bits", 1); int want_color_bits = chanconfig.GetInt("want-color-bits", 1); diff --git a/panda/src/char/character.I b/panda/src/char/character.I index a1c50f5366..b6d7c61105 100644 --- a/panda/src/char/character.I +++ b/panda/src/char/character.I @@ -45,6 +45,6 @@ get_num_parts() const { //////////////////////////////////////////////////////////////////// INLINE PartGroup *Character:: get_part(int n) const { - nassertr(n >= 0 && n < _parts.size(), NULL); + nassertr(n >= 0 && n < (int)_parts.size(), NULL); return _parts[n]; } diff --git a/panda/src/char/computedVertices.cxx b/panda/src/char/computedVertices.cxx index 50709ab37c..057835c877 100644 --- a/panda/src/char/computedVertices.cxx +++ b/panda/src/char/computedVertices.cxx @@ -79,12 +79,12 @@ write_datagram(Datagram &dest) dest.add_int16(_joint_index); dest.add_float64(_effect); dest.add_uint16(_vindex.size()); - for(i = 0; i < _vindex.size(); i++) + for(i = 0; i < (int)_vindex.size(); i++) { dest.add_uint16(_vindex[i]); } dest.add_uint16(_nindex.size()); - for(i = 0; i < _nindex.size(); i++) + for(i = 0; i < (int)_nindex.size(); i++) { dest.add_uint16(_nindex[i]); } @@ -158,7 +158,9 @@ update(Character *character) { // We have some uv morphs. These don't particularly need to be // done before the joints are computed, but do them now anyway. int table_size = sizeof(TexCoordf) * _orig_texcoords.size(); - TexCoordf *morphed_texcoords = (TexCoordf *)alloca(table_size); + + // **** Is this right? Test it! + // TexCoordf *morphed_texcoords = (TexCoordf *)alloca(table_size); memcpy(character->_cv._texcoords, _orig_texcoords, table_size); compute_morphs(character->_cv._texcoords.p(), _texcoord_morphs, character); @@ -167,7 +169,9 @@ update(Character *character) { if (!_color_morphs.empty()) { // We have some color morphs. Do these now too. int table_size = sizeof(Colorf) * _orig_colors.size(); - Colorf *morphed_colors = (Colorf *)alloca(table_size); + + // **** Is this right? Test it! + // Colorf *morphed_colors = (Colorf *)alloca(table_size); memcpy(character->_cv._colors, _orig_colors, table_size); compute_morphs(character->_cv._colors.p(), _color_morphs, character); @@ -308,27 +312,27 @@ write_datagram(BamWriter *manager, Datagram &me) int i; me.add_uint16(_transforms.size()); - for(i = 0; i < _transforms.size(); i++){ + for(i = 0; i < (int)_transforms.size(); i++){ _transforms[i].write_datagram(me); } me.add_uint16(_vertex_morphs.size()); - for(i = 0; i < _vertex_morphs.size(); i++){ + for(i = 0; i < (int)_vertex_morphs.size(); i++){ _vertex_morphs[i].write_datagram(me); } me.add_uint16(_normal_morphs.size()); - for(i = 0; i < _normal_morphs.size(); i++){ + for(i = 0; i < (int)_normal_morphs.size(); i++){ _normal_morphs[i].write_datagram(me); } me.add_uint16(_texcoord_morphs.size()); - for(i = 0; i < _texcoord_morphs.size(); i++){ + for(i = 0; i < (int)_texcoord_morphs.size(); i++){ _texcoord_morphs[i].write_datagram(me); } me.add_uint16(_color_morphs.size()); - for(i = 0; i < _color_morphs.size(); i++){ + for(i = 0; i < (int)_color_morphs.size(); i++){ _color_morphs[i].write_datagram(me); } diff --git a/panda/src/char/computedVerticesMorph.I b/panda/src/char/computedVerticesMorph.I index ef809fde70..668e6215fe 100644 --- a/panda/src/char/computedVerticesMorph.I +++ b/panda/src/char/computedVerticesMorph.I @@ -111,7 +111,7 @@ write_datagram(Datagram &dest) { dest.add_int16(_slider_index); dest.add_uint16(_morphs.size()); - for(int i = 0; i < _morphs.size(); i++) + for(int i = 0; i < (int)_morphs.size(); i++) { _morphs[i].write_datagram(dest); } diff --git a/panda/src/chat/chatInput.cxx b/panda/src/chat/chatInput.cxx index ee14c7572d..0336998f47 100644 --- a/panda/src/chat/chatInput.cxx +++ b/panda/src/chat/chatInput.cxx @@ -73,7 +73,7 @@ void ChatInput::transmit_data(NodeAttributes &data) { char ch = be._button.get_ascii_equivalent(); if (isprint(ch)) { - if (has_max_chars() && _str.size() >= get_max_chars()) { + if (has_max_chars() && (int)_str.size() >= get_max_chars()) { throw_event("chat_overflow"); } else { _str += ch; diff --git a/panda/src/collide/collisionEntry.I b/panda/src/collide/collisionEntry.I index ff0fddf38d..7545905292 100644 --- a/panda/src/collide/collisionEntry.I +++ b/panda/src/collide/collisionEntry.I @@ -138,7 +138,9 @@ set_into_intersection_point(const LPoint3f &point) { //////////////////////////////////////////////////////////////////// // Function: CollisionEntry::has_into_intersection_point // Access: Public -// Description: +// Description: Returns true if the detected collision knows its +// intersection point in the coordinate space of the +// collided-into object, false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool CollisionEntry:: has_into_intersection_point() const { @@ -148,7 +150,10 @@ has_into_intersection_point() const { //////////////////////////////////////////////////////////////////// // Function: CollisionEntry::get_into_intersection_point // Access: Public -// Description: +// Description: Returns the intersection point in the coordinate +// space of the collided-into object. It is an error to +// call this if has_into_intersection_point() returns +// false. //////////////////////////////////////////////////////////////////// INLINE const LPoint3f &CollisionEntry:: get_into_intersection_point() const { @@ -156,6 +161,33 @@ get_into_intersection_point() const { return _into_intersection_point; } +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::has_from_intersection_point +// Access: Public +// Description: Returns true if the detected collision knows its +// intersection point in the coordinate space of the +// colliding object, false otherwise. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionEntry:: +has_from_intersection_point() const { + // Since we derive the from_intersection_point from the + // into_intersection_point, this is really the same question. + return has_into_intersection_point(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionEntry::get_from_intersection_point +// Access: Public +// Description: Returns the intersection point in the coordinate +// space of the colliding object. It is an error to +// call this if has_from_intersection_point() returns +// false. +//////////////////////////////////////////////////////////////////// +INLINE LPoint3f CollisionEntry:: +get_from_intersection_point() const { + return get_into_intersection_point() * get_inv_wrt_space(); +} + //////////////////////////////////////////////////////////////////// // Function: CollisionEntry::set_into_surface_normal // Access: Public @@ -170,7 +202,9 @@ set_into_surface_normal(const LVector3f &normal) { //////////////////////////////////////////////////////////////////// // Function: CollisionEntry::has_into_surface_normal // Access: Public -// Description: +// Description: Returns true if the detected collision knows the +// surface normal of the collided-into object at the +// point of the collision, false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool CollisionEntry:: has_into_surface_normal() const { @@ -180,7 +214,10 @@ has_into_surface_normal() const { //////////////////////////////////////////////////////////////////// // Function: CollisionEntry::get_into_surface_normal // Access: Public -// Description: +// Description: Returns the surface normal of the collided-into +// object at the point of the collision. It is an error +// to call this if has_into_surface_normal() returns +// false. //////////////////////////////////////////////////////////////////// INLINE const LVector3f &CollisionEntry:: get_into_surface_normal() const { @@ -203,7 +240,10 @@ set_into_depth(float depth) { //////////////////////////////////////////////////////////////////// // Function: CollisionEntry::has_into_depth // Access: Public -// Description: +// Description: Returns true if the collision entry knows how "deep" +// the collision was into the collided-into object; that +// is, how far into the surface of the collided-into +// object the colliding object has penetrated. //////////////////////////////////////////////////////////////////// INLINE bool CollisionEntry:: has_into_depth() const { @@ -213,7 +253,11 @@ has_into_depth() const { //////////////////////////////////////////////////////////////////// // Function: CollisionEntry::get_into_depth // Access: Public -// Description: +// Description: Returns how "deep" the collision was into the +// collided-into object; that is, how far into the +// surface of the collided-into object the colliding +// object has penetrated. It is an error to call this +// if has_into_depth() returns false. //////////////////////////////////////////////////////////////////// INLINE float CollisionEntry:: get_into_depth() const { diff --git a/panda/src/collide/collisionEntry.h b/panda/src/collide/collisionEntry.h index 44e0db7d2c..fff0737c20 100644 --- a/panda/src/collide/collisionEntry.h +++ b/panda/src/collide/collisionEntry.h @@ -51,6 +51,9 @@ public: INLINE bool has_into_intersection_point() const; INLINE const LPoint3f &get_into_intersection_point() const; + INLINE bool has_from_intersection_point() const; + INLINE LPoint3f get_from_intersection_point() const; + INLINE void set_into_surface_normal(const LVector3f &normal); INLINE bool has_into_surface_normal() const; INLINE const LVector3f &get_into_surface_normal() const; diff --git a/panda/src/collide/collisionHandlerEvent.I b/panda/src/collide/collisionHandlerEvent.I index 3d5636a21e..045ad796e6 100644 --- a/panda/src/collide/collisionHandlerEvent.I +++ b/panda/src/collide/collisionHandlerEvent.I @@ -22,6 +22,18 @@ operator () (const PT(CollisionEntry) &a, return false; } +//////////////////////////////////////////////////////////////////// +// Function: CollisionHandlerEvent::SortEntries::operator = +// Access: Public +// Description: The assignment operator does absolutely nothing, +// since this is just a function object class that +// stores no data. We define it just to quiet up g++ in +// -Wall mode. +//////////////////////////////////////////////////////////////////// +INLINE void CollisionHandlerEvent::SortEntries:: +operator = (const CollisionHandlerEvent::SortEntries &) { +} + //////////////////////////////////////////////////////////////////// // Function: CollisionHandlerEvent::set_in_pattern // Access: Public diff --git a/panda/src/collide/collisionHandlerEvent.h b/panda/src/collide/collisionHandlerEvent.h index 8721cfdb4c..cd1e1d35ee 100644 --- a/panda/src/collide/collisionHandlerEvent.h +++ b/panda/src/collide/collisionHandlerEvent.h @@ -49,6 +49,7 @@ private: INLINE bool operator () (const PT(CollisionEntry) &a, const PT(CollisionEntry) &b) const; + INLINE void operator = (const SortEntries &other); }; typedef set Colliding; diff --git a/panda/src/collide/collisionHandlerQueue.cxx b/panda/src/collide/collisionHandlerQueue.cxx index bc012e6e5d..d295eb56b4 100644 --- a/panda/src/collide/collisionHandlerQueue.cxx +++ b/panda/src/collide/collisionHandlerQueue.cxx @@ -8,6 +8,21 @@ TypeHandle CollisionHandlerQueue::_type_handle; +// This class is used in sort_entries(), below. +class CollisionEntrySorter { +public: + CollisionEntrySorter(CollisionEntry *entry) { + _entry = entry; + _dist = (entry->get_from_intersection_point() - LPoint3f::origin()).length(); + } + bool operator < (const CollisionEntrySorter &other) const { + return _dist < other._dist; + } + + CollisionEntry *_entry; + double _dist; +}; + //////////////////////////////////////////////////////////////////// // Function: CollisionHandlerQueue::Constructor // Access: Public @@ -42,6 +57,40 @@ add_entry(CollisionEntry *entry) { _entries.push_back(entry); } +//////////////////////////////////////////////////////////////////// +// Function: CollisionHandlerQueue::sort_entries +// Access: Public +// Description: Sorts all the detected collisions front-to-back by +// from_intersection_point() so that those intersection +// points closest to the origin appear first. +//////////////////////////////////////////////////////////////////// +void CollisionHandlerQueue:: +sort_entries() { + // Build up a temporary vector of entries so we can sort the + // pointers. This uses the class defined above. + typedef vector Sorter; + Sorter sorter; + sorter.reserve(_entries.size()); + + Entries::const_iterator ei; + for (ei = _entries.begin(); ei != _entries.end(); ++ei) { + sorter.push_back(CollisionEntrySorter(*ei)); + } + + sort(sorter.begin(), sorter.end()); + nassertv(sorter.size() == _entries.size()); + + // Now that they're sorted, get them back. + Entries sorted_entries; + sorted_entries.reserve(sorter.size()); + Sorter::const_iterator si; + for (si = sorter.begin(); si != sorter.end(); ++si) { + sorted_entries.push_back((*si)._entry); + } + + _entries.swap(sorted_entries); +} + //////////////////////////////////////////////////////////////////// // Function: CollisionHandlerQueue::get_num_entries // Access: Public diff --git a/panda/src/collide/collisionHandlerQueue.h b/panda/src/collide/collisionHandlerQueue.h index 98be3119b9..8b5634941c 100644 --- a/panda/src/collide/collisionHandlerQueue.h +++ b/panda/src/collide/collisionHandlerQueue.h @@ -27,6 +27,8 @@ public: virtual void begin_group(); virtual void add_entry(CollisionEntry *entry); + void sort_entries(); + int get_num_entries() const; CollisionEntry *get_entry(int n) const; diff --git a/panda/src/collide/collisionLevelState.I b/panda/src/collide/collisionLevelState.I index 257c68e907..6b098122bc 100644 --- a/panda/src/collide/collisionLevelState.I +++ b/panda/src/collide/collisionLevelState.I @@ -21,7 +21,7 @@ get_num_colliders() const { //////////////////////////////////////////////////////////////////// INLINE bool CollisionLevelState:: has_collider(int n) const { - nassertr(n >= 0 && n < _colliders.size(), false); + nassertr(n >= 0 && n < (int)_colliders.size(), false); return (_current & get_mask(n)) != 0; } @@ -34,7 +34,7 @@ has_collider(int n) const { //////////////////////////////////////////////////////////////////// INLINE bool CollisionLevelState:: has_collider_with_geom(int n) const { - nassertr(n >= 0 && n < _colliders.size(), false); + nassertr(n >= 0 && n < (int)_colliders.size(), false); return (_current & _colliders_with_geom & get_mask(n)) != 0; } @@ -80,7 +80,7 @@ reached_collision_node() { //////////////////////////////////////////////////////////////////// INLINE CollisionSolid *CollisionLevelState:: get_collider(int n) const { - nassertr(n >= 0 && n < _colliders.size(), NULL); + nassertr(n >= 0 && n < (int)_colliders.size(), NULL); nassertr(has_collider(n), NULL); return _colliders[n]._collider; @@ -93,7 +93,7 @@ get_collider(int n) const { //////////////////////////////////////////////////////////////////// INLINE CollisionNode *CollisionLevelState:: get_node(int n) const { - nassertr(n >= 0 && n < _colliders.size(), NULL); + nassertr(n >= 0 && n < (int)_colliders.size(), NULL); nassertr(has_collider(n), NULL); return _colliders[n]._node; @@ -106,7 +106,7 @@ get_node(int n) const { //////////////////////////////////////////////////////////////////// INLINE const LMatrix4f &CollisionLevelState:: get_space(int n) const { - nassertr(n >= 0 && n < _colliders.size(), LMatrix4f::ident_mat()); + nassertr(n >= 0 && n < (int)_colliders.size(), LMatrix4f::ident_mat()); nassertr(has_collider(n), LMatrix4f::ident_mat()); return _colliders[n]._space; @@ -119,7 +119,7 @@ get_space(int n) const { //////////////////////////////////////////////////////////////////// INLINE const LMatrix4f &CollisionLevelState:: get_inv_space(int n) const { - nassertr(n >= 0 && n < _colliders.size(), LMatrix4f::ident_mat()); + nassertr(n >= 0 && n < (int)_colliders.size(), LMatrix4f::ident_mat()); nassertr(has_collider(n), LMatrix4f::ident_mat()); return _colliders[n]._inv_space; @@ -132,9 +132,9 @@ get_inv_space(int n) const { //////////////////////////////////////////////////////////////////// INLINE const GeometricBoundingVolume *CollisionLevelState:: get_local_bound(int n) const { - nassertr(n >= 0 && n < _colliders.size(), NULL); + nassertr(n >= 0 && n < (int)_colliders.size(), NULL); nassertr(has_collider(n), NULL); - nassertr(n >= 0 && n < _local_bounds.size(), NULL); + nassertr(n >= 0 && n < (int)_local_bounds.size(), NULL); return _local_bounds[n]; } @@ -145,7 +145,7 @@ get_local_bound(int n) const { //////////////////////////////////////////////////////////////////// INLINE void CollisionLevelState:: omit_collider(int n) { - nassertv(n >= 0 && n < _colliders.size()); + nassertv(n >= 0 && n < (int)_colliders.size()); nassertv(has_collider(n)); _current &= ~get_mask(n); diff --git a/panda/src/collide/collisionNode.I b/panda/src/collide/collisionNode.I index 84bda3dc83..128b1080f7 100644 --- a/panda/src/collide/collisionNode.I +++ b/panda/src/collide/collisionNode.I @@ -128,7 +128,8 @@ get_solid(int n) const { //////////////////////////////////////////////////////////////////// // Function: CollisionNode::remove_solid // Access: Public -// Description: +// Description: Removes the solid with the indicated index. This +// will shift all subsequent indices down by one. //////////////////////////////////////////////////////////////////// INLINE void CollisionNode:: remove_solid(int n) { @@ -140,7 +141,9 @@ remove_solid(int n) { //////////////////////////////////////////////////////////////////// // Function: CollisionNode::add_solid // Access: Public -// Description: +// Description: Adds the indicated solid to the node. Returns the +// index of the new solid within the node's list of +// solids. //////////////////////////////////////////////////////////////////// INLINE int CollisionNode:: add_solid(CollisionSolid *solid) { diff --git a/panda/src/collide/collisionPolygon.I b/panda/src/collide/collisionPolygon.I index c6bdc82966..cb9011de54 100644 --- a/panda/src/collide/collisionPolygon.I +++ b/panda/src/collide/collisionPolygon.I @@ -53,3 +53,38 @@ CollisionPolygon(const LPoint3f *begin, const LPoint3f *end) { INLINE CollisionPolygon:: CollisionPolygon(void) { } + +//////////////////////////////////////////////////////////////////// +// Function: CollisionPolygon::verify_points +// Access: Public, Static +// Description: Verifies that the indicated set of points will define +// a valid CollisionPolygon: that is, at least three +// non-collinear points, with no points repeated. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionPolygon:: +verify_points(const LPoint3f &a, const LPoint3f &b, + const LPoint3f &c) { + LPoint3f array[3]; + array[0] = a; + array[1] = b; + array[2] = c; + return verify_points(array, array + 3); +} + +//////////////////////////////////////////////////////////////////// +// Function: CollisionPolygon::verify_points +// Access: Public, Static +// Description: Verifies that the indicated set of points will define +// a valid CollisionPolygon: that is, at least three +// non-collinear points, with no points repeated. +//////////////////////////////////////////////////////////////////// +INLINE bool CollisionPolygon:: +verify_points(const LPoint3f &a, const LPoint3f &b, + const LPoint3f &c, const LPoint3f &d) { + LPoint3f array[4]; + array[0] = a; + array[1] = b; + array[2] = c; + array[3] = d; + return verify_points(array, array + 4); +} diff --git a/panda/src/collide/collisionPolygon.cxx b/panda/src/collide/collisionPolygon.cxx index 8d54ee9c51..d442b737d8 100644 --- a/panda/src/collide/collisionPolygon.cxx +++ b/panda/src/collide/collisionPolygon.cxx @@ -60,6 +60,45 @@ make_copy() { return new CollisionPolygon(*this); } +//////////////////////////////////////////////////////////////////// +// Function: CollisionPolygon::verify_points +// Access: Public, Static +// Description: Verifies that the indicated set of points will define +// a valid CollisionPolygon: that is, at least three +// non-collinear points, with no points repeated. +//////////////////////////////////////////////////////////////////// +bool CollisionPolygon:: +verify_points(const LPoint3f *begin, const LPoint3f *end) { + int num_points = end - begin; + if (num_points < 3) { + return false; + } + + // Create a plane to determine the planarity of the first three + // points. + Planef plane(begin[0], begin[1], begin[2]); + LVector3f normal = plane.get_normal(); + float normal_length = normal.length(); + bool all_ok = IS_THRESHOLD_EQUAL(normal_length, 1.0, 0.001); + + const LPoint3f *pi; + for (pi = begin; pi != end && all_ok; ++pi) { + if ((*pi).is_nan()) { + all_ok = false; + } else { + // Make sure no points are repeated. + const LPoint3f *pj; + for (pj = begin; pj != pi && all_ok; ++pj) { + if ((*pj).almost_equal(*pi)) { + all_ok = false; + } + } + } + } + + return all_ok; +} + //////////////////////////////////////////////////////////////////// // Function: CollisionPolygon::test_intersection // Access: Public, Virtual @@ -360,7 +399,7 @@ is_inside(const LPoint2f &p) const { // order, a point is interior to the polygon iff the point is not right of // each of the edges. - for (int i = 0; i < _points.size() - 1; i++) { + for (int i = 0; i < (int)_points.size() - 1; i++) { if (is_right(p - _points[i], _points[i+1] - _points[i])) { return false; } @@ -396,33 +435,16 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) { #ifndef NDEBUG // Make sure all the source points are good. { - float normal_length = normal.length(); - bool all_ok = IS_THRESHOLD_EQUAL(normal_length, 1.0, 0.001); - - const LPoint3f *pi; - for (pi = begin; pi != end && all_ok; ++pi) { - if ((*pi).is_nan()) { - all_ok = false; - } else { - // Make sure no points are repeated. - const LPoint3f *pj; - for (pj = begin; pj != pi && all_ok; ++pj) { - if ((*pj).almost_equal(*pi)) { - all_ok = false; - } - } - } - } - - if (!all_ok) { - collide_cat.error() << "Invalid points passed to CollisionPolygon:\n"; + if (!verify_points(begin, end)) { + collide_cat.error() << "Invalid points in CollisionPolygon:\n"; + const LPoint3f *pi; for (pi = begin; pi != end; ++pi) { collide_cat.error(false) << " " << (*pi) << "\n"; } collide_cat.error(false) - << " normal " << normal << " with length " << normal_length << "\n"; + << " normal " << normal << " with length " << normal.length() << "\n"; - nassertv(false); + return; } } @@ -497,7 +519,7 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) { // be convex) is also a point within the polygon. _median = _points[0]; - for (int n = 1; n < _points.size(); n++) { + for (int n = 1; n < (int)_points.size(); n++) { _median += _points[n]; } _median /= _points.size(); @@ -580,7 +602,7 @@ write_datagram(BamWriter *manager, Datagram &me) CollisionPlane::write_datagram(manager, me); me.add_uint16(_points.size()); - for(i = 0; i < _points.size(); i++) + for(i = 0; i < (int)_points.size(); i++) { _points[i].write_datagram(me); } diff --git a/panda/src/collide/collisionPolygon.h b/panda/src/collide/collisionPolygon.h index 2aed5a7cca..c85c01ed99 100644 --- a/panda/src/collide/collisionPolygon.h +++ b/panda/src/collide/collisionPolygon.h @@ -27,6 +27,13 @@ public: virtual CollisionSolid *make_copy(); + INLINE static bool verify_points(const LPoint3f &a, const LPoint3f &b, + const LPoint3f &c); + INLINE static bool verify_points(const LPoint3f &a, const LPoint3f &b, + const LPoint3f &c, const LPoint3f &d); + static bool verify_points(const LPoint3f *begin, const LPoint3f *end); + + virtual int test_intersection(CollisionHandler *record, const CollisionEntry &entry, diff --git a/panda/src/collide/collisionTraverser.cxx b/panda/src/collide/collisionTraverser.cxx index 2447d018da..761b415485 100644 --- a/panda/src/collide/collisionTraverser.cxx +++ b/panda/src/collide/collisionTraverser.cxx @@ -541,12 +541,16 @@ compare_collider_to_geom(CollisionEntry &entry, Geom *geom, PTA_ushort tris = geom->get_tris(); for (int i = 0; i < (int)tris.size(); i += 3) { - // Generate a temporary CollisionPolygon on the fly for each - // triangle in the Geom. - CollisionPolygon poly(coords[tris[i]], coords[tris[i + 1]], - coords[tris[i + 2]]); - if (entry.get_from()->test_intersection((*ci).second, entry, &poly) != 0) { - return; + if (CollisionPolygon::verify_points(coords[tris[i]], + coords[tris[i + 1]], + coords[tris[i + 2]])) { + // Generate a temporary CollisionPolygon on the fly for each + // triangle in the Geom. + CollisionPolygon poly(coords[tris[i]], coords[tris[i + 1]], + coords[tris[i + 2]]); + if (entry.get_from()->test_intersection((*ci).second, entry, &poly) != 0) { + return; + } } } } diff --git a/panda/src/cull/geomBinBackToFront.cxx b/panda/src/cull/geomBinBackToFront.cxx index 7272d33e74..6aea6679be 100644 --- a/panda/src/cull/geomBinBackToFront.cxx +++ b/panda/src/cull/geomBinBackToFront.cxx @@ -39,8 +39,6 @@ void GeomBinBackToFront:: record_current_state(GraphicsStateGuardian *gsg, CullState *cs, int, CullTraverser *trav) { // Get the transform matrix from the state. - LMatrix4f mat; - TransformAttribute *trans_attrib = NULL; get_attribute_into(trans_attrib, cs->get_attributes(), TransformTransition::get_class_type()); diff --git a/panda/src/cull/geomBinFixed.cxx b/panda/src/cull/geomBinFixed.cxx index 3ae47a6d09..7f598b8161 100644 --- a/panda/src/cull/geomBinFixed.cxx +++ b/panda/src/cull/geomBinFixed.cxx @@ -40,8 +40,6 @@ void GeomBinFixed:: record_current_state(GraphicsStateGuardian *, CullState *cs, int draw_order, CullTraverser *) { // Get the transform matrix from the state. - LMatrix4f mat; - TransformAttribute *trans_attrib = NULL; get_attribute_into(trans_attrib, cs->get_attributes(), TransformTransition::get_class_type()); diff --git a/panda/src/cull/geomBinUnsorted.cxx b/panda/src/cull/geomBinUnsorted.cxx index 6da44bfac5..fbdd8f848b 100644 --- a/panda/src/cull/geomBinUnsorted.cxx +++ b/panda/src/cull/geomBinUnsorted.cxx @@ -68,7 +68,6 @@ void GeomBinUnsorted:: draw(CullTraverser *trav) { PStatTimer timer(CullTraverser::_draw_pcollector); GraphicsStateGuardian *gsg = trav->get_gsg(); - TypeHandle graph_type = trav->get_graph_type(); if (cull_cat.is_spam()) { cull_cat.spam() diff --git a/panda/src/device/adinputNode.cxx b/panda/src/device/adinputNode.cxx index a2ebda2f49..cb49bfb014 100644 --- a/panda/src/device/adinputNode.cxx +++ b/panda/src/device/adinputNode.cxx @@ -30,7 +30,7 @@ TypeHandle ADInputNode::_channels_type; //////////////////////////////////////////////////////////////////// ADInputNode:: ADInputNode(PT(ClientBase) client, const string &adinput) : - DataNode(adinput), _adinput(adinput), _client(client) + DataNode(adinput), _client(client), _adinput(adinput) { _client->add_remote_analog(_adinput); _client->add_remote_button(_adinput); diff --git a/panda/src/device/clientBase.cxx b/panda/src/device/clientBase.cxx index 5d1bafa1ef..46bd0092e8 100644 --- a/panda/src/device/clientBase.cxx +++ b/panda/src/device/clientBase.cxx @@ -17,8 +17,8 @@ TypeHandle ClientBase::_type_handle; //////////////////////////////////////////////////////////////////// ClientBase:: ClientBase(const string &server) : - _server(server), _sleep_time(1000000/60), - _shutdown(false), _forked(false) + _sleep_time(1000000/60), _server(server), + _forked(false), _shutdown(false) { } diff --git a/panda/src/device/trackerNode.cxx b/panda/src/device/trackerNode.cxx index 771eb07ceb..85bc188897 100644 --- a/panda/src/device/trackerNode.cxx +++ b/panda/src/device/trackerNode.cxx @@ -33,7 +33,7 @@ TypeHandle TrackerNode::_aquat_dt_type; TrackerNode:: TrackerNode(PT(ClientBase) client, const string &tracker, int sensor) : - DataNode(tracker), _tracker(tracker), _client(client), _sensor(sensor) + DataNode(tracker), _client(client), _tracker(tracker), _sensor(sensor) { _client->add_remote_tracker(_tracker, _sensor); diff --git a/panda/src/display/displayRegion.cxx b/panda/src/display/displayRegion.cxx index 3b562aa36d..2f29d90f98 100644 --- a/panda/src/display/displayRegion.cxx +++ b/panda/src/display/displayRegion.cxx @@ -16,8 +16,10 @@ // Description: //////////////////////////////////////////////////////////////////// DisplayRegion:: -DisplayRegion(GraphicsLayer *layer) : _layer(layer), - _l(0.), _r(1.), _b(0.), _t(1.), _active(true) +DisplayRegion(GraphicsLayer *layer) : + _l(0.), _r(1.), _b(0.), _t(1.), + _layer(layer), + _active(true) { } @@ -29,7 +31,9 @@ DisplayRegion(GraphicsLayer *layer) : _layer(layer), DisplayRegion:: DisplayRegion(GraphicsLayer *layer, const float l, const float r, const float b, const float t) - : _layer(layer), _l(l), _r(r), _b(b), _t(t), _active(true) + : _l(l), _r(r), _b(b), _t(t), + _layer(layer), + _active(true) { } @@ -42,9 +46,9 @@ DisplayRegion(GraphicsLayer *layer, const float l, //////////////////////////////////////////////////////////////////// DisplayRegion:: DisplayRegion(int xsize, int ysize) : - _layer((GraphicsLayer *)0L), _l(0.), _r(1.), _b(0.), _t(1.), _pl(0), _pr(xsize), _pb(0), _pt(ysize), + _layer((GraphicsLayer *)0L), _active(true) { } diff --git a/panda/src/display/graphicsPipe.h b/panda/src/display/graphicsPipe.h index 90eaeffc8b..7c1bbd2897 100644 --- a/panda/src/display/graphicsPipe.h +++ b/panda/src/display/graphicsPipe.h @@ -68,7 +68,7 @@ public: class EXPCL_PANDA PipeSpec : public PipeParam { public: INLINE PipeSpec(void) : PipeParam() {} - INLINE PipeSpec(PipeSpecifier& p) : _p(p), PipeParam() {} + INLINE PipeSpec(PipeSpecifier& p) : PipeParam(), _p(p) {} virtual ~PipeSpec(void); INLINE const PipeSpecifier &get_specifier(void) { return _p; } public: diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index 34c3e1073d..69a6675dd0 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -164,7 +164,7 @@ public: // Make a factory parameter type for the window pointer class EXPCL_PANDA GsgWindow : public GsgParam { public: - INLINE GsgWindow(GraphicsWindow* w) : _w(w), GsgParam() {} + INLINE GsgWindow(GraphicsWindow* w) : GsgParam(), _w(w) {} virtual ~GsgWindow(void); INLINE GraphicsWindow* get_window(void) { return _w; } public: diff --git a/panda/src/display/graphicsWindow.N b/panda/src/display/graphicsWindow.N index 56a37260ef..cb6fcfa125 100644 --- a/panda/src/display/graphicsWindow.N +++ b/panda/src/display/graphicsWindow.N @@ -1,4 +1,3 @@ -ignoreconstruct GraphicsWindow ignoremember get_properties ignoremember set_draw_callback ignoremember set_idle_callback diff --git a/panda/src/display/graphicsWindow.cxx b/panda/src/display/graphicsWindow.cxx index c97a28e32a..29aba57c10 100644 --- a/panda/src/display/graphicsWindow.cxx +++ b/panda/src/display/graphicsWindow.cxx @@ -313,9 +313,9 @@ flag_redisplay() { void GraphicsWindow:: declare_channel(int index, GraphicsChannel *chan) { nassertv(index >= 0); - if (index >= _channels.size()) { + if (index >= (int)_channels.size()) { _channels.reserve(index); - while (index >= _channels.size()) { + while (index >= (int)_channels.size()) { _channels.push_back(NULL); } } diff --git a/panda/src/display/graphicsWindow.h b/panda/src/display/graphicsWindow.h index 18a0540aea..5c2efa907d 100644 --- a/panda/src/display/graphicsWindow.h +++ b/panda/src/display/graphicsWindow.h @@ -202,7 +202,7 @@ public: class EXPCL_PANDA WindowProps : public FactoryParam { public: INLINE WindowProps(void) : WindowParam() {} - INLINE WindowProps(const Properties& p) : _p(p), WindowParam() {} + INLINE WindowProps(const Properties& p) : WindowParam(), _p(p) {} virtual ~WindowProps(void); INLINE Properties get_properties(void) { return _p; } public: @@ -217,7 +217,7 @@ public: // make a factory parameter type for the GraphicsPipe* class EXPCL_PANDA WindowPipe : public FactoryParam { public: - INLINE WindowPipe(GraphicsPipe* p) : _p(p), WindowParam() {} + INLINE WindowPipe(GraphicsPipe* p) : WindowParam(), _p(p) {} virtual ~WindowPipe(void); INLINE GraphicsPipe* get_pipe(void) { return _p; } public: diff --git a/panda/src/downloader/asyncUtility.h b/panda/src/downloader/asyncUtility.h index 60d75938df..074455c5f0 100644 --- a/panda/src/downloader/asyncUtility.h +++ b/panda/src/downloader/asyncUtility.h @@ -23,7 +23,7 @@ class EXPCL_PANDAEXPRESS AsyncUtility { public: AsyncUtility(float frequency = 0.2); - ~AsyncUtility(void); + virtual ~AsyncUtility(void); void create_thread(void); diff --git a/panda/src/downloader/decompressor.cxx b/panda/src/downloader/decompressor.cxx index 86aff55166..6dd9be2fb4 100644 --- a/panda/src/downloader/decompressor.cxx +++ b/panda/src/downloader/decompressor.cxx @@ -301,7 +301,7 @@ decompress(Filename &source_file, Filename &dest_file) { dest_buffer_length, write_stream); if (ret == ZCompressorBase::S_error) return false; - if (decompressor.get_total_in() == source_file_length && + if ((int)decompressor.get_total_in() == source_file_length && avail_out == dest_buffer_length) handled_all_input = true; } diff --git a/panda/src/downloader/decompressor.h b/panda/src/downloader/decompressor.h index 0f8bd9d580..e49480643a 100644 --- a/panda/src/downloader/decompressor.h +++ b/panda/src/downloader/decompressor.h @@ -26,7 +26,7 @@ class EXPCL_PANDAEXPRESS Decompressor : public AsyncUtility { public: Decompressor(void); Decompressor(PT(Buffer) buffer); - ~Decompressor(void); + virtual ~Decompressor(void); int request_decompress(const Filename &source_file, const string &event_name); diff --git a/panda/src/downloader/downloader.h b/panda/src/downloader/downloader.h index ff96aaf3bf..027d3bdc6d 100644 --- a/panda/src/downloader/downloader.h +++ b/panda/src/downloader/downloader.h @@ -30,7 +30,7 @@ class EXPCL_PANDAEXPRESS Downloader : public AsyncUtility { public: Downloader(void); Downloader(PT(Buffer) buffer); - ~Downloader(void); + virtual ~Downloader(void); bool connect_to_server(const string &name, uint port=80); void disconnect_from_server(void); diff --git a/panda/src/downloader/extractor.h b/panda/src/downloader/extractor.h index 74e0c3675b..abe7400684 100644 --- a/panda/src/downloader/extractor.h +++ b/panda/src/downloader/extractor.h @@ -26,7 +26,7 @@ class EXPCL_PANDAEXPRESS Extractor : public AsyncUtility { public: Extractor(void); Extractor(PT(Buffer) buffer); - ~Extractor(void); + virtual ~Extractor(void); int request_extract(const Filename &source_file, const string &event_name, const Filename &rel_path = ""); diff --git a/panda/src/downloader/patcher.h b/panda/src/downloader/patcher.h index 210a2f61b1..2225168282 100644 --- a/panda/src/downloader/patcher.h +++ b/panda/src/downloader/patcher.h @@ -26,7 +26,7 @@ class EXPCL_PANDAEXPRESS Patcher : public AsyncUtility { public: Patcher(void); Patcher(PT(Buffer) buffer); - ~Patcher(void); + virtual ~Patcher(void); int request_patch(const Filename &patch, const Filename &infile, const string &event_name); diff --git a/panda/src/effects/lensFlareNode.cxx b/panda/src/effects/lensFlareNode.cxx index 56bb41c44c..8c3a97a7be 100644 --- a/panda/src/effects/lensFlareNode.cxx +++ b/panda/src/effects/lensFlareNode.cxx @@ -110,7 +110,7 @@ set_geometry(GeomSprite *sprite, const PTA_float &geom_scales, nassertv(geom_colors.size() == geom_offsets.size()); float world_scale = _texel_scale * _global_scale; - for(int i = 0; i < geom_scales.size(); i++) + for(int i = 0; i < (int)geom_scales.size(); i++) { LVector3f position = (delta * geom_offsets[i]) + light; float view_scale; @@ -158,7 +158,7 @@ prepare_flares(const LVector3f &delta, const LPoint3f &light, const float &angle { if (_flares.size() > _flare_arcs.size()) { - for(int i = _flare_arcs.size(); i < _flares.size(); i++) + for(int i = _flare_arcs.size(); i < (int)_flares.size(); i++) { GeomSprite *sprite = new GeomSprite(); GeomNode *node = new GeomNode(); @@ -187,7 +187,7 @@ prepare_flares(const LVector3f &delta, const LPoint3f &light, const float &angle } } - for(int i = 0; i < _flares.size(); i++) + for(int i = 0; i < (int)_flares.size(); i++) { GeomNode *node = DCAST(GeomNode, _flare_arcs[i]->get_child()); GeomSprite *sprite = DCAST(GeomSprite, node->get_geom(0)); @@ -282,7 +282,7 @@ void LensFlareNode:: render_children(const vector_relation &arcs, const AllAttributesWrapper &attrib, AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg) { - for(int i = 0; i < arcs.size(); i++) + for(int i = 0; i < (int)arcs.size(); i++) { render_child(arcs[i], attrib, trans, gsg); } @@ -377,38 +377,38 @@ write_datagram(BamWriter *manager, Datagram &me) { Node::write_datagram(manager, me); me.add_uint16(_flares.size()); - for(i = 0; i < _flares.size(); i++) + for(i = 0; i < (int)_flares.size(); i++) { manager->write_pointer(me, _flares[i]); } manager->write_pointer(me, _blind); me.add_uint16(_flare_arcs.size()); - for(i = 0; i < _flare_arcs.size(); i++) + for(i = 0; i < (int)_flare_arcs.size(); i++) { manager->write_pointer(me, _flare_arcs[i]); } me.add_uint16(_flare_scales.size()); - for(i = 0; i < _flare_scales.size(); i++) + for(i = 0; i < (int)_flare_scales.size(); i++) { WRITE_PTA(manager, me, IPD_float::write_datagram, _flare_scales[i]) } me.add_uint16(_flare_angle_scales.size()); - for(i = 0; i < _flare_angle_scales.size(); i++) + for(i = 0; i < (int)_flare_angle_scales.size(); i++) { WRITE_PTA(manager, me, IPD_float::write_datagram, _flare_angle_scales[i]) } me.add_uint16(_flare_offsets.size()); - for(i = 0; i < _flare_offsets.size(); i++) + for(i = 0; i < (int)_flare_offsets.size(); i++) { WRITE_PTA(manager, me, IPD_float::write_datagram, _flare_offsets[i]) } me.add_uint16(_flare_colors.size()); - for(i = 0; i < _flare_colors.size(); i++) + for(i = 0; i < (int)_flare_colors.size(); i++) { WRITE_PTA(manager, me, IPD_Colorf::write_datagram, _flare_colors[i]) } diff --git a/panda/src/express/tokenBoard.h b/panda/src/express/tokenBoard.h index 356030fec2..480aa97e75 100644 --- a/panda/src/express/tokenBoard.h +++ b/panda/src/express/tokenBoard.h @@ -28,7 +28,7 @@ public: _want_id = id; } bool operator()(PT(TokenType) tok) const { - return tok->_id == _want_id; + return (int)tok->_id == _want_id; } int _want_id; }; diff --git a/panda/src/framework/framework.cxx b/panda/src/framework/framework.cxx index 6501fed065..67f403c98d 100644 --- a/panda/src/framework/framework.cxx +++ b/panda/src/framework/framework.cxx @@ -490,8 +490,7 @@ void setup_framerate(void) { if (framerate_font != (NamedNode *)0L) { framerate_text = new TextNode("framerate_text"); - RenderRelation *text_arc = new RenderRelation(framerate_node, - framerate_text); + new RenderRelation(framerate_node, framerate_text); LMatrix4f mat = LMatrix4f::scale_mat(0.05) * LMatrix4f::translate_mat(-0.95, 0.0, 0.95); diff --git a/panda/src/glgsg/glGraphicsStateGuardian.cxx b/panda/src/glgsg/glGraphicsStateGuardian.cxx index 157c2d9894..5f5498ee88 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.cxx +++ b/panda/src/glgsg/glGraphicsStateGuardian.cxx @@ -990,7 +990,7 @@ draw_sprite(const GeomSprite *geom) { if (x_overall == true) scaled_width = geom->_x_texel_ratio[0] * half_width; else { - nassertv((geom->_x_texel_ratio.size() >= geom->get_num_prims())); + nassertv(((int)geom->_x_texel_ratio.size() >= geom->get_num_prims())); x_walk = &geom->_x_texel_ratio[0]; } @@ -998,7 +998,7 @@ draw_sprite(const GeomSprite *geom) { if (y_overall == true) scaled_height = geom->_y_texel_ratio[0] * half_height * aspect_ratio; else { - nassertv((geom->_y_texel_ratio.size() >= geom->get_num_prims())); + nassertv(((int)geom->_y_texel_ratio.size() >= geom->get_num_prims())); y_walk = &geom->_y_texel_ratio[0]; } @@ -1007,7 +1007,7 @@ draw_sprite(const GeomSprite *geom) { if (theta_overall == true) theta = geom->_theta[0]; else { - nassertv((geom->_theta.size() >= geom->get_num_prims())); + nassertv(((int)geom->_theta.size() >= geom->get_num_prims())); theta_walk = &geom->_theta[0]; } } @@ -3455,9 +3455,11 @@ get_image_type(PixelBuffer::Type type) { #endif case PixelBuffer::T_float: return GL_FLOAT; + + default: + glgsg_cat.error() << "Invalid PixelBuffer::Type value!\n"; + return GL_UNSIGNED_BYTE; } - glgsg_cat.error() << "Invalid PixelBuffer::Type value!\n"; - return GL_UNSIGNED_BYTE; } //////////////////////////////////////////////////////////////////// @@ -3548,12 +3550,13 @@ get_internal_image_format(PixelBuffer::Format format) { case PixelBuffer::F_blue: case PixelBuffer::F_luminance: return GL_LUMINANCE; - } - glgsg_cat.error() - << "Invalid image format in get_internal_image_format(): " - << (int)format << "\n"; - return GL_RGB; + default: + glgsg_cat.error() + << "Invalid image format in get_internal_image_format(): " + << (int)format << "\n"; + return GL_RGB; + } } //////////////////////////////////////////////////////////////////// @@ -3586,20 +3589,21 @@ get_texture_apply_mode_type( TextureApplyProperty::Mode am ) const GLenum GLGraphicsStateGuardian:: get_depth_func_type(DepthTestProperty::Mode m) const { - switch(m) - { - case DepthTestProperty::M_never: return GL_NEVER; - case DepthTestProperty::M_less: return GL_LESS; - case DepthTestProperty::M_equal: return GL_EQUAL; - case DepthTestProperty::M_less_equal: return GL_LEQUAL; - case DepthTestProperty::M_greater: return GL_GREATER; - case DepthTestProperty::M_not_equal: return GL_NOTEQUAL; - case DepthTestProperty::M_greater_equal: return GL_GEQUAL; - case DepthTestProperty::M_always: return GL_ALWAYS; - } + switch(m) { + case DepthTestProperty::M_never: return GL_NEVER; + case DepthTestProperty::M_less: return GL_LESS; + case DepthTestProperty::M_equal: return GL_EQUAL; + case DepthTestProperty::M_less_equal: return GL_LEQUAL; + case DepthTestProperty::M_greater: return GL_GREATER; + case DepthTestProperty::M_not_equal: return GL_NOTEQUAL; + case DepthTestProperty::M_greater_equal: return GL_GEQUAL; + case DepthTestProperty::M_always: return GL_ALWAYS; + + default: glgsg_cat.error() << "Invalid DepthTestProperty::Mode value" << endl; return GL_LESS; + } } //////////////////////////////////////////////////////////////////// @@ -3610,19 +3614,21 @@ get_depth_func_type(DepthTestProperty::Mode m) const GLenum GLGraphicsStateGuardian:: get_stencil_func_type(StencilProperty::Mode m) const { - switch(m) { - case StencilProperty::M_never: return GL_NEVER; - case StencilProperty::M_less: return GL_LESS; - case StencilProperty::M_equal: return GL_EQUAL; - case StencilProperty::M_less_equal: return GL_LEQUAL; - case StencilProperty::M_greater: return GL_GREATER; - case StencilProperty::M_not_equal: return GL_NOTEQUAL; - case StencilProperty::M_greater_equal: return GL_GEQUAL; - case StencilProperty::M_always: return GL_ALWAYS; - } + switch(m) { + case StencilProperty::M_never: return GL_NEVER; + case StencilProperty::M_less: return GL_LESS; + case StencilProperty::M_equal: return GL_EQUAL; + case StencilProperty::M_less_equal: return GL_LEQUAL; + case StencilProperty::M_greater: return GL_GREATER; + case StencilProperty::M_not_equal: return GL_NOTEQUAL; + case StencilProperty::M_greater_equal: return GL_GEQUAL; + case StencilProperty::M_always: return GL_ALWAYS; + + default: glgsg_cat.error() << "Invalid StencilProperty::Mode value" << endl; return GL_LESS; + } } //////////////////////////////////////////////////////////////////// @@ -3660,9 +3666,11 @@ get_fog_mode_type(Fog::Mode m) const { #ifdef GL_FOG_FUNC_SGIS case Fog::M_spline: return GL_FOG_FUNC_SGIS; #endif + + default: + glgsg_cat.error() << "Invalid Fog::Mode value" << endl; + return GL_EXP; } - glgsg_cat.error() << "Invalid Fog::Mode value" << endl; - return GL_EXP; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index 39e272608e..24626246fb 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -993,9 +993,6 @@ void glxGraphicsWindow::handle_changes(void) //////////////////////////////////////////////////////////////////// void glxGraphicsWindow::process_event(XEvent event) { - glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe); - bool down = false; - switch (event.type) { case MappingNotify: break; @@ -1096,7 +1093,7 @@ void glxGraphicsWindow::process_event(XEvent event) //////////////////////////////////////////////////////////////////// void glxGraphicsWindow::process_events(void) { - XEvent event, ahead; + XEvent event; int got_event; glxGraphicsWindow* window; diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index aa9f3101e1..bf2e0513be 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -641,6 +641,9 @@ describe_attr(ostream &out, const Geom *geom, case G_OVERALL: out << "Overall:" << pad << array[0]; + + case G_OFF: + break; } out << "\n"; } diff --git a/panda/src/gobj/geomQuad.cxx b/panda/src/gobj/geomQuad.cxx index 7c865166d9..f62438349e 100644 --- a/panda/src/gobj/geomQuad.cxx +++ b/panda/src/gobj/geomQuad.cxx @@ -95,7 +95,7 @@ get_tris() const { tris.push_back(indices[3]); } - nassertr(tris.size() == num_tris * 3, PTA_ushort()); + nassertr((int)tris.size() == num_tris * 3, PTA_ushort()); return tris; } diff --git a/panda/src/gobj/geomTri.cxx b/panda/src/gobj/geomTri.cxx index cf3ae958c3..01ff07c785 100644 --- a/panda/src/gobj/geomTri.cxx +++ b/panda/src/gobj/geomTri.cxx @@ -198,7 +198,6 @@ get_tris() const { int k = 0; for (int i = 0; i < _numprims; i++) { - ushort indices[3]; if (_vindex.empty()) { for (int j = 0; j < 3; j++) { tris.push_back(k++); @@ -210,7 +209,7 @@ get_tris() const { } } - nassertr(tris.size() == num_tris * 3, PTA_ushort()); + nassertr((int)tris.size() == num_tris * 3, PTA_ushort()); return tris; } diff --git a/panda/src/gobj/geomTrifan.cxx b/panda/src/gobj/geomTrifan.cxx index 9273eb4c4c..52d02517dd 100644 --- a/panda/src/gobj/geomTrifan.cxx +++ b/panda/src/gobj/geomTrifan.cxx @@ -356,7 +356,6 @@ get_tris() const { v1 = _vindex[k++]; } - bool even = true; int len = _primlengths[i] - 2; for (int j = 0; j < len; j++) { @@ -374,7 +373,7 @@ get_tris() const { } } - nassertr(tris.size() == num_tris * 3, PTA_ushort()); + nassertr((int)tris.size() == num_tris * 3, PTA_ushort()); return tris; } diff --git a/panda/src/gobj/geomTristrip.cxx b/panda/src/gobj/geomTristrip.cxx index 97eb13eb27..22ba5db018 100644 --- a/panda/src/gobj/geomTristrip.cxx +++ b/panda/src/gobj/geomTristrip.cxx @@ -484,7 +484,7 @@ get_tris() const { } } - nassertr(tris.size() == num_tris * 3, PTA_ushort()); + nassertr((int)tris.size() == num_tris * 3, PTA_ushort()); return tris; } diff --git a/panda/src/gobj/pixelBuffer.I b/panda/src/gobj/pixelBuffer.I index 5a24721b25..f6a23d050d 100644 --- a/panda/src/gobj/pixelBuffer.I +++ b/panda/src/gobj/pixelBuffer.I @@ -320,7 +320,7 @@ set_uchar_rgb_texel(const uchar color[3], int x, int y, int width) //////////////////////////////////////////////////////////////////// INLINE void PixelBuffer:: store_unsigned_byte(int &index, double value) { - nassertv(index >= 0 && index < _image.size()); + nassertv(index >= 0 && index < (int)_image.size()); _image[index++] = (uchar)(value * 255.0); } @@ -334,7 +334,7 @@ store_unsigned_byte(int &index, double value) { //////////////////////////////////////////////////////////////////// INLINE void PixelBuffer:: store_unsigned_short(int &index, double value) { - nassertv(index >= 0 && index+1 < _image.size()); + nassertv(index >= 0 && index+1 < (int)_image.size()); union { ushort us; uchar uc[2]; @@ -354,7 +354,7 @@ store_unsigned_short(int &index, double value) { //////////////////////////////////////////////////////////////////// INLINE double PixelBuffer:: get_unsigned_byte(int &index) const { - nassertr(index >= 0 && index < _image.size(), 0.0); + nassertr(index >= 0 && index < (int)_image.size(), 0.0); return (double)_image[index++] / 255.0; } @@ -368,7 +368,7 @@ get_unsigned_byte(int &index) const { //////////////////////////////////////////////////////////////////// INLINE double PixelBuffer:: get_unsigned_short(int &index) const { - nassertr(index >= 0 && index+1 < _image.size(), 0.0); + nassertr(index >= 0 && index+1 < (int)_image.size(), 0.0); union { ushort us; uchar uc[2]; diff --git a/panda/src/graph/dftraverser.I b/panda/src/graph/dftraverser.I index e5f3dd9f5d..d90d573b36 100644 --- a/panda/src/graph/dftraverser.I +++ b/panda/src/graph/dftraverser.I @@ -14,39 +14,38 @@ //////////////////////////////////////////////////////////////////// template INLINE DFTraverser:: -DFTraverser(NodeRelation *arc, - Visitor &visitor, +DFTraverser(Visitor &visitor, const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, TypeHandle graph_type) : _visitor(visitor), _initial_render_state(initial_render_state), _graph_type(graph_type) { +} + +//////////////////////////////////////////////////////////////////// +// Function: DFTraverser::start +// Access: Public +// Description: Starts the traversal from the indicated arc. +//////////////////////////////////////////////////////////////////// +template +INLINE void DFTraverser:: +start(NodeRelation *arc, const LevelState &initial_level_state) { traverse(arc, _initial_render_state, initial_level_state); } //////////////////////////////////////////////////////////////////// -// Function: DFTraverser::Constructor +// Function: DFTraverser::start // Access: Public -// Description: +// Description: Starts the traversal from the indicated node. //////////////////////////////////////////////////////////////////// template -INLINE DFTraverser:: -DFTraverser(Node *root, - Visitor &visitor, - const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, - TypeHandle graph_type) : - _visitor(visitor), - _initial_render_state(initial_render_state), - _graph_type(graph_type) -{ +INLINE void DFTraverser:: +start(Node *root, const LevelState &initial_level_state) { LevelState level_state(initial_level_state); traverse(root, _initial_render_state, level_state); } - //////////////////////////////////////////////////////////////////// // Function: DFTraverser::Traverse // Access: Public diff --git a/panda/src/graph/dftraverser.h b/panda/src/graph/dftraverser.h index d700d6cb7b..df55c3a8a0 100644 --- a/panda/src/graph/dftraverser.h +++ b/panda/src/graph/dftraverser.h @@ -26,17 +26,13 @@ public: typedef TYPENAME Visitor::TransitionWrapper TransitionWrapper; typedef TYPENAME Visitor::AttributeWrapper AttributeWrapper; - INLINE DFTraverser(NodeRelation *arc, - Visitor &visitor, + INLINE DFTraverser(Visitor &visitor, const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, - TypeHandle graph_type); - INLINE DFTraverser(Node *root, - Visitor &visitor, - const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, TypeHandle graph_type); + INLINE void start(NodeRelation *arc, const LevelState &initial_level_state); + INLINE void start(Node *root, const LevelState &initial_level_state); + protected: void traverse(NodeRelation *arc, AttributeWrapper render_state, @@ -58,8 +54,8 @@ df_traverse(NodeRelation *arc, Visitor &visitor, const LevelState &initial_level_state, TypeHandle graph_type) { DFTraverser - dft(arc, visitor, initial_render_state, - initial_level_state, graph_type); + dft(visitor, initial_render_state, graph_type); + dft.start(arc, initial_level_state); } template @@ -69,8 +65,8 @@ df_traverse(Node *root, Visitor &visitor, const LevelState &initial_level_state, TypeHandle graph_type) { DFTraverser - dft(root, visitor, initial_render_state, - initial_level_state, graph_type); + dft(visitor, initial_render_state, graph_type); + dft.start(root, initial_level_state); } #include "dftraverser.I" diff --git a/panda/src/graph/wrt.I b/panda/src/graph/wrt.I index 32b304b181..ae69ce1f66 100644 --- a/panda/src/graph/wrt.I +++ b/panda/src/graph/wrt.I @@ -328,8 +328,7 @@ uncached_wrt_base(const Node *from, InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, TransitionWrapper &result, TypeHandle graph_type) { - - UpdateSeq now = last_graph_update[graph_type]; + // UpdateSeq now = last_graph_update[graph_type]; TransitionWrapper net_from_trans = TransitionWrapper::init_from(result); get_uncached_net_transition(from, from_arcs_begin, from_arcs_end, diff --git a/panda/src/grutil/lineSegs.I b/panda/src/grutil/lineSegs.I index bc787e39e8..0eb9b66258 100644 --- a/panda/src/grutil/lineSegs.I +++ b/panda/src/grutil/lineSegs.I @@ -155,7 +155,7 @@ get_num_vertices() const { //////////////////////////////////////////////////////////////////// INLINE Vertexf LineSegs:: get_vertex(int vertex) const { - nassertr(vertex >= 0 && vertex < _created_verts.size(), + nassertr(vertex >= 0 && vertex < (int)_created_verts.size(), Vertexf(0.0, 0.0, 0.0)); return _created_verts[vertex]; } @@ -171,7 +171,7 @@ get_vertex(int vertex) const { //////////////////////////////////////////////////////////////////// INLINE void LineSegs:: set_vertex(int vertex, const Vertexf &vert) { - nassertv(vertex >= 0 && vertex < _created_verts.size()); + nassertv(vertex >= 0 && vertex < (int)_created_verts.size()); _created_verts[vertex] = vert; } @@ -196,7 +196,7 @@ set_vertex(int vertex, float x, float y, float z) { //////////////////////////////////////////////////////////////////// INLINE Colorf LineSegs:: get_vertex_color(int vertex) const { - nassertr(vertex >= 0 && vertex < _created_colors.size(), + nassertr(vertex >= 0 && vertex < (int)_created_colors.size(), Colorf(0.0, 0.0, 0.0, 0.0)); return _created_colors[vertex]; } @@ -209,7 +209,7 @@ get_vertex_color(int vertex) const { //////////////////////////////////////////////////////////////////// INLINE void LineSegs:: set_vertex_color(int vertex, const Colorf &color) { - nassertv(vertex >= 0 && vertex < _created_verts.size()); + nassertv(vertex >= 0 && vertex < (int)_created_verts.size()); _created_colors[vertex] = color; } diff --git a/panda/src/grutil/lineSegs.cxx b/panda/src/grutil/lineSegs.cxx index 4d0c04389c..9591a32b0d 100644 --- a/panda/src/grutil/lineSegs.cxx +++ b/panda/src/grutil/lineSegs.cxx @@ -163,7 +163,7 @@ create(GeomNode *previous, bool) { _created_verts.push_back((*sl)._point); _created_colors.push_back((*sl)._color); v++; - nassertr(v == _created_verts.size(), previous); + nassertr(v == (int)_created_verts.size(), previous); } } diff --git a/panda/src/lerp/lerp.cxx b/panda/src/lerp/lerp.cxx index ea78d61a41..6430b36724 100644 --- a/panda/src/lerp/lerp.cxx +++ b/panda/src/lerp/lerp.cxx @@ -20,13 +20,15 @@ static INLINE float scale_t(float t, float start, float end) { } Lerp::Lerp(LerpFunctor* func, float endt, LerpBlendType* blend) - : _func(func), _startt(0.), _endt(endt), _blend(blend), _t(0.), - _delta(1.) {} + : _blend(blend), _func(func), _startt(0.), _endt(endt), + _delta(1.), _t(0.) {} Lerp::Lerp(LerpFunctor* func, float startt, float endt, - LerpBlendType* blend) : _func(func), _startt(startt), - _endt(endt), _blend(blend), - _t(startt), _delta(1.) {} + LerpBlendType* blend) : _blend(blend), _func(func), + _startt(startt), + _endt(endt), + _delta(1.), + _t(startt) {} Lerp::Lerp(const Lerp& c) : _blend(c._blend), _func(c._func), _event(c._event), _startt(c._startt), _endt(c._endt), @@ -93,13 +95,13 @@ std::string Lerp::get_end_event(void) const { AutonomousLerp::AutonomousLerp(LerpFunctor* func, float endt, LerpBlendType* blend, EventHandler* handler) - : _func(func), _startt(0.), _endt(endt), _blend(blend), _t(0.), - _handler(handler) {} + : _blend(blend), _func(func), _handler(handler), + _startt(0.), _endt(endt), _t(0.) {} AutonomousLerp::AutonomousLerp(LerpFunctor* func, float startt, float endt, LerpBlendType* blend, EventHandler* handler) - : _func(func), _startt(startt), _endt(endt), _blend(blend), _t(startt), - _handler(handler) {} + : _blend(blend), _func(func), _handler(handler), + _startt(startt), _endt(endt), _t(startt) {} AutonomousLerp::AutonomousLerp(const AutonomousLerp& c) : _blend(c._blend), _func(c._func), diff --git a/panda/src/lerp/lerpfunctor.h b/panda/src/lerp/lerpfunctor.h index 07347bf0bd..32ba965399 100644 --- a/panda/src/lerp/lerpfunctor.h +++ b/panda/src/lerp/lerpfunctor.h @@ -148,7 +148,7 @@ private: template SimpleLerpFunctor::SimpleLerpFunctor(const SimpleLerpFunctor& c) - : _start(c._start), _end(c._end), _diff_cache(c._diff_cache), LerpFunctor(c) + : LerpFunctor(c), _start(c._start), _end(c._end), _diff_cache(c._diff_cache) {} template diff --git a/panda/src/light/light.h b/panda/src/light/light.h index 859121e73c..f6420ec449 100644 --- a/panda/src/light/light.h +++ b/panda/src/light/light.h @@ -28,7 +28,7 @@ class EXPCL_PANDA Light : virtual public ReferenceCount public: Light( void ) { _color.set(0.0, 0.0, 0.0, 1.0); } - ~Light( void ) { } + virtual ~Light( void ) { } virtual void apply( GraphicsStateGuardian* gsg ) = 0; diff --git a/panda/src/light/spotlight.cxx b/panda/src/light/spotlight.cxx index 5e1d018ea9..be52a245b0 100644 --- a/panda/src/light/spotlight.cxx +++ b/panda/src/light/spotlight.cxx @@ -115,9 +115,9 @@ bool Spotlight::make_image(Texture* texture, float radius) color[1] = (int)(_color[1] * 255.0f); color[2] = (int)(_color[2] * 255.0f); - float cutoff = get_cutoff_angle(); - float dist = 1 / (float)tan(cutoff); - int bufsize = size * size * 3; + // float cutoff = get_cutoff_angle(); + // float dist = 1 / (float)tan(cutoff); + // int bufsize = size * size * 3; int half_width = (size - 2) / 2; float dXY = 1 / (float)half_width; float Y = dXY + dXY; diff --git a/panda/src/linmath/ioPtaDatagramLinMath.I b/panda/src/linmath/ioPtaDatagramLinMath.I index c09b719e5f..0c73bd82ce 100644 --- a/panda/src/linmath/ioPtaDatagramLinMath.I +++ b/panda/src/linmath/ioPtaDatagramLinMath.I @@ -14,7 +14,7 @@ void IoPtaDatagramLinMath:: write_datagram(Datagram &dest, CPTA(LinMathElement) array) { dest.add_uint32(array.size()); - for(int i = 0; i < array.size(); i++) + for(int i = 0; i < (int)array.size(); i++) { array[i].write_datagram(dest); } diff --git a/panda/src/linmath/lmatrix3.I b/panda/src/linmath/lmatrix3.I index 4ce2baa0be..75c381e84b 100644 --- a/panda/src/linmath/lmatrix3.I +++ b/panda/src/linmath/lmatrix3.I @@ -821,8 +821,6 @@ translate_mat(NumType tx, NumType ty) { template LMatrix3 LMatrix3:: rotate_mat(NumType angle) { - LMatrix3 mat; - double s = sin(deg_2_rad(angle)); double c = cos(deg_2_rad(angle)); diff --git a/panda/src/linmath/lmatrix4.I b/panda/src/linmath/lmatrix4.I index 566012267b..d2c2de645c 100644 --- a/panda/src/linmath/lmatrix4.I +++ b/panda/src/linmath/lmatrix4.I @@ -1161,6 +1161,7 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) { case CS_yup_left: return z_to_y_up_mat(); case CS_zup_right: return scale_mat(1.0, -1.0, 1.0); case CS_yup_right: return scale_mat(1.0, -1.0, 1.0) * z_to_y_up_mat(); + default: break; } break; @@ -1170,6 +1171,7 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) { case CS_yup_left: return ident_mat(); case CS_zup_right: return scale_mat(1.0, 1.0, -1.0) * y_to_z_up_mat(); case CS_yup_right: return scale_mat(1.0, 1.0, -1.0); + default: break; } break; @@ -1179,6 +1181,7 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) { case CS_yup_left: return scale_mat(1.0, -1.0, 1.0) * z_to_y_up_mat(); case CS_zup_right: return ident_mat(); case CS_yup_right: return z_to_y_up_mat(); + default: break; } break; @@ -1188,8 +1191,12 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) { case CS_yup_left: return scale_mat(1.0, 1.0, -1.0); case CS_zup_right: return y_to_z_up_mat(); case CS_yup_right: return ident_mat(); + default: break; } break; + + default: + break; } linmath_cat.error() diff --git a/panda/src/linmath/lvector3.I b/panda/src/linmath/lvector3.I index 59feac91cf..5e73b977b9 100644 --- a/panda/src/linmath/lvector3.I +++ b/panda/src/linmath/lvector3.I @@ -275,10 +275,12 @@ up(CoordinateSystem cs) { case CS_yup_right: case CS_yup_left: return LVector3(0.0, 1.0, 0.0); + + default: + linmath_cat.error() + << "Invalid coordinate system!\n"; + return LVector3(0.0, 0.0, 0.0); } - linmath_cat.error() - << "Invalid coordinate system!\n"; - return LVector3(0.0, 0.0, 0.0); } //////////////////////////////////////////////////////////////////// @@ -317,10 +319,12 @@ forward(CoordinateSystem cs) { case CS_yup_left: return LVector3(0.0, 0.0, 1.0); + + default: + linmath_cat.error() + << "Invalid coordinate system!\n"; + return LVector3(0.0, 0.0, 0.0); } - linmath_cat.error() - << "Invalid coordinate system!\n"; - return LVector3(0.0, 0.0, 0.0); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/baseParticleRenderer.I b/panda/src/particlesystem/baseParticleRenderer.I index 546af84e7a..20133b80c9 100644 --- a/panda/src/particlesystem/baseParticleRenderer.I +++ b/panda/src/particlesystem/baseParticleRenderer.I @@ -76,18 +76,17 @@ get_user_alpha(void) const { //////////////////////////////////////////////////////////////////// INLINE float BaseParticleRenderer:: get_cur_alpha(BaseParticle* bp) { - switch(_alpha_mode) - { - case PR_ALPHA_OUT: - return 1.0f - bp->get_parameterized_age(); - break; - case PR_ALPHA_IN: - return bp->get_parameterized_age(); - break; - case PR_ALPHA_USER: - return _user_alpha; - break; + switch(_alpha_mode) { + case PR_ALPHA_OUT: + return 1.0f - bp->get_parameterized_age(); + + case PR_ALPHA_IN: + return bp->get_parameterized_age(); + + case PR_ALPHA_USER: + return _user_alpha; + + default: + return 1.0; // should not get here } - - return 1.0; // should not get here } diff --git a/panda/src/particlesystem/geomParticleRenderer.cxx b/panda/src/particlesystem/geomParticleRenderer.cxx index 93ccb71810..0f399134bc 100644 --- a/panda/src/particlesystem/geomParticleRenderer.cxx +++ b/panda/src/particlesystem/geomParticleRenderer.cxx @@ -17,7 +17,7 @@ GeomParticleRenderer:: GeomParticleRenderer(ParticleRendererAlphaMode am, Node *geom_node) : - _geom_node(geom_node), _pool_size(0), BaseParticleRenderer(am) { + BaseParticleRenderer(am), _geom_node(geom_node), _pool_size(0) { _dead_particle_parent_node = new Node; @@ -33,7 +33,7 @@ GeomParticleRenderer(ParticleRendererAlphaMode am, Node *geom_node) : GeomParticleRenderer:: GeomParticleRenderer(const GeomParticleRenderer& copy) : - _pool_size(0), BaseParticleRenderer(copy) { + BaseParticleRenderer(copy), _pool_size(0) { _dead_particle_parent_node = new Node; @@ -133,7 +133,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { // run through the particle vector - for (i = 0; i < po_vector.size(); i++) { + for (i = 0; i < (int)po_vector.size(); i++) { RenderRelation *cur_arc; cur_particle = (BaseParticle *) po_vector[i].p(); diff --git a/panda/src/particlesystem/lineParticleRenderer.cxx b/panda/src/particlesystem/lineParticleRenderer.cxx index d34f86ca92..12d9801454 100644 --- a/panda/src/particlesystem/lineParticleRenderer.cxx +++ b/panda/src/particlesystem/lineParticleRenderer.cxx @@ -31,8 +31,9 @@ LineParticleRenderer:: LineParticleRenderer(const Colorf& head, const Colorf& tail, ParticleRendererAlphaMode alpha_mode) : - _head_color(head), _tail_color(tail), - BaseParticleRenderer(alpha_mode) { + BaseParticleRenderer(alpha_mode), + _head_color(head), _tail_color(tail) +{ _line_primitive = new GeomLine; init_geoms(); } @@ -140,7 +141,6 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { BaseParticle *cur_particle; - int cur_index = 0; int remaining_particles = ttl_particles; int i; @@ -154,7 +154,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { // run through the array - for (i = 0; i < po_vector.size(); i++) { + for (i = 0; i < (int)po_vector.size(); i++) { cur_particle = (BaseParticle *) po_vector[i].p(); if (cur_particle->get_alive() == false) diff --git a/panda/src/particlesystem/particleSystem.cxx b/panda/src/particlesystem/particleSystem.cxx index 9e7d538408..a31ba09e19 100644 --- a/panda/src/particlesystem/particleSystem.cxx +++ b/panda/src/particlesystem/particleSystem.cxx @@ -29,7 +29,7 @@ //////////////////////////////////////////////////////////////////// ParticleSystem:: ParticleSystem(int pool_size) : - _particle_pool_size(pool_size), Physical(pool_size, false) + Physical(pool_size, false), _particle_pool_size(pool_size) { _birth_rate = 0.0f; _tics_since_birth = _birth_rate; @@ -64,9 +64,10 @@ ParticleSystem(int pool_size) : //////////////////////////////////////////////////////////////////// ParticleSystem:: ParticleSystem(const ParticleSystem& copy) : + Physical(copy), _system_age(0.0f), - _template_system_flag(false), - Physical(copy) { + _template_system_flag(false) +{ _particle_pool_size = copy._particle_pool_size; _birth_rate = copy._birth_rate; diff --git a/panda/src/particlesystem/particleSystemManager.cxx b/panda/src/particlesystem/particleSystemManager.cxx index 5c02d3457d..62cdd84211 100644 --- a/panda/src/particlesystem/particleSystemManager.cxx +++ b/panda/src/particlesystem/particleSystemManager.cxx @@ -67,7 +67,7 @@ do_particles(float dt) { cur = _ps_list.begin(); // cout << "PSM::do_particles on a vector of size " << _ps_list.size() << endl; - int cs = 0; + // int cs = 0; while (cur != _ps_list.end()) { ParticleSystem *cur_ps = *cur; diff --git a/panda/src/particlesystem/pointParticleRenderer.cxx b/panda/src/particlesystem/pointParticleRenderer.cxx index 6b3907ba8b..f210239d2b 100644 --- a/panda/src/particlesystem/pointParticleRenderer.cxx +++ b/panda/src/particlesystem/pointParticleRenderer.cxx @@ -18,11 +18,11 @@ PointParticleRenderer(ParticleRendererAlphaMode am, PointParticleBlendType bt, ParticleRendererBlendMethod bm, const Colorf& sc, const Colorf& ec) : - _point_size(point_size), - _blend_type(bt), _blend_method(bm), + BaseParticleRenderer(am), _start_color(sc), _end_color(ec), - BaseParticleRenderer(am) { - + _point_size(point_size), + _blend_type(bt), _blend_method(bm) +{ _point_primitive = new GeomPoint; init_geoms(); } @@ -35,9 +35,9 @@ PointParticleRenderer(ParticleRendererAlphaMode am, PointParticleRenderer:: PointParticleRenderer(const PointParticleRenderer& copy) : - _max_pool_size(0), - BaseParticleRenderer(copy) { - + BaseParticleRenderer(copy), + _max_pool_size(0) +{ _blend_type = copy._blend_type; _blend_method = copy._blend_method; _start_color = copy._start_color; @@ -197,7 +197,6 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { BaseParticle *cur_particle; - int cur_index = 0; int remaining_particles = ttl_particles; int i; @@ -211,7 +210,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { // run through every filled slot - for (i = 0; i < po_vector.size(); i++) { + for (i = 0; i < (int)po_vector.size(); i++) { cur_particle = (BaseParticle *) po_vector[i].p(); if (cur_particle->get_alive() == false) diff --git a/panda/src/particlesystem/sparkleParticleRenderer.cxx b/panda/src/particlesystem/sparkleParticleRenderer.cxx index d06394f38d..a14a173249 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.cxx +++ b/panda/src/particlesystem/sparkleParticleRenderer.cxx @@ -15,10 +15,11 @@ SparkleParticleRenderer:: SparkleParticleRenderer(void) : + BaseParticleRenderer(PR_ALPHA_NONE), _center_color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)), _edge_color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)), - _birth_radius(0.1f), _death_radius(0.1f), - BaseParticleRenderer(PR_ALPHA_NONE) { + _birth_radius(0.1f), _death_radius(0.1f) +{ _line_primitive = new GeomLine; init_geoms(); } @@ -34,9 +35,10 @@ SparkleParticleRenderer(const Colorf& center, const Colorf& edge, float birth_radius, float death_radius, SparkleParticleLifeScale life_scale, ParticleRendererAlphaMode alpha_mode) : + BaseParticleRenderer(alpha_mode), _center_color(center), _edge_color(edge), _birth_radius(birth_radius), - _death_radius(death_radius), _life_scale(life_scale), - BaseParticleRenderer(alpha_mode) { + _death_radius(death_radius), _life_scale(life_scale) +{ _line_primitive = new GeomLine; init_geoms(); } @@ -147,7 +149,6 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { BaseParticle *cur_particle; - int cur_index = 0; int remaining_particles = ttl_particles; int i; @@ -161,7 +162,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { // run through the array - for (i = 0; i < po_vector.size(); i++) { + for (i = 0; i < (int)po_vector.size(); i++) { cur_particle = (BaseParticle *) po_vector[i].p(); if (cur_particle->get_alive() == false) diff --git a/panda/src/particlesystem/spriteParticleRenderer.cxx b/panda/src/particlesystem/spriteParticleRenderer.cxx index aa241e1759..fd05fd2c1f 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.cxx +++ b/panda/src/particlesystem/spriteParticleRenderer.cxx @@ -15,18 +15,19 @@ //////////////////////////////////////////////////////////////////// SpriteParticleRenderer:: SpriteParticleRenderer(Texture *tex) : - _animate_x_ratio(false), - _animate_y_ratio(false), - _animate_theta(false), - _blend_method(PP_BLEND_LINEAR), - _pool_size(0), + BaseParticleRenderer(PR_ALPHA_NONE), + _color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)), _initial_x_texel_ratio(0.02f), _final_x_texel_ratio(0.02f), _initial_y_texel_ratio(0.02f), _final_y_texel_ratio(0.02f), _theta(0.0f), - _color(Colorf(1.0f, 1.0f, 1.0f, 1.0f)), - BaseParticleRenderer(PR_ALPHA_NONE) { + _animate_x_ratio(false), + _animate_y_ratio(false), + _animate_theta(false), + _blend_method(PP_BLEND_LINEAR), + _pool_size(0) +{ _sprite_primitive = new GeomSprite(tex); init_geoms(); } @@ -38,7 +39,7 @@ SpriteParticleRenderer(Texture *tex) : //////////////////////////////////////////////////////////////////// SpriteParticleRenderer:: SpriteParticleRenderer(const SpriteParticleRenderer& copy) : - _pool_size(0), BaseParticleRenderer(copy) { + BaseParticleRenderer(copy), _pool_size(0) { _animate_x_ratio = copy._animate_x_ratio; _animate_y_ratio = copy._animate_y_ratio; _animate_theta = copy._animate_theta; @@ -170,7 +171,6 @@ void SpriteParticleRenderer:: render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { BaseParticle *cur_particle; - int cur_index = 0; int remaining_particles = ttl_particles; int i; @@ -194,7 +194,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { _aabb_max.set(-99999.0f, -99999.0f, -99999.0f); // run through every filled slot - for (i = 0; i < po_vector.size(); i++) { + for (i = 0; i < (int)po_vector.size(); i++) { cur_particle = (BaseParticle *) po_vector[i].p(); if (cur_particle->get_alive() == false) diff --git a/panda/src/physics/forceNode.I b/panda/src/physics/forceNode.I index af6f4084b3..c739f18e03 100644 --- a/panda/src/physics/forceNode.I +++ b/panda/src/physics/forceNode.I @@ -18,7 +18,7 @@ clear(void) { //////////////////////////////////////////////////////////////////// INLINE BaseForce *ForceNode:: get_force(int index) const { - nassertr(index >= 0 && index < _forces.size(), + nassertr(index >= 0 && index < (int)_forces.size(), (BaseForce *) NULL); return _forces[index]; } diff --git a/panda/src/physics/forceNode.cxx b/panda/src/physics/forceNode.cxx index 14621eedde..ae155b2c8f 100644 --- a/panda/src/physics/forceNode.cxx +++ b/panda/src/physics/forceNode.cxx @@ -82,7 +82,7 @@ add_forces_from(const ForceNode &other) { //////////////////////////////////////////////////////////////////// void ForceNode:: remove_force(int index) { - nassertv(index >= 0 && index <= _forces.size()); + nassertv(index >= 0 && index <= (int)_forces.size()); vector< PT(BaseForce) >::iterator remove; remove = _forces.begin() + index; diff --git a/panda/src/physics/linearEulerIntegrator.cxx b/panda/src/physics/linearEulerIntegrator.cxx index 4884e8f8a4..7c6aeae1d3 100644 --- a/panda/src/physics/linearEulerIntegrator.cxx +++ b/panda/src/physics/linearEulerIntegrator.cxx @@ -80,7 +80,7 @@ child_integrate(Physical *physical, // run through each acting force and sum it LVector3f f; - LMatrix4f force_to_object_xform; + // LMatrix4f force_to_object_xform; ForceNode *force_node; vector< PT(LinearForce) >::const_iterator f_cur; diff --git a/panda/src/physics/physicalNode.I b/panda/src/physics/physicalNode.I index a3328205a5..3b74c5e058 100644 --- a/panda/src/physics/physicalNode.I +++ b/panda/src/physics/physicalNode.I @@ -18,7 +18,7 @@ clear(void) { //////////////////////////////////////////////////////////////////// INLINE Physical *PhysicalNode:: get_physical(int index) const { - nassertr(index >= 0 && index < _physicals.size(), + nassertr(index >= 0 && index < (int)_physicals.size(), (Physical *) NULL); return _physicals[index]; } diff --git a/panda/src/physics/physicalNode.cxx b/panda/src/physics/physicalNode.cxx index 5cc10eb4d8..c62fa4b3b6 100644 --- a/panda/src/physics/physicalNode.cxx +++ b/panda/src/physics/physicalNode.cxx @@ -82,7 +82,7 @@ add_physicals_from(const PhysicalNode &other) { //////////////////////////////////////////////////////////////////// void PhysicalNode:: remove_physical(int index) { - nassertv(index >= 0 && index <= _physicals.size()); + nassertv(index >= 0 && index <= (int)_physicals.size()); vector< PT(Physical) >::iterator remove; remove = _physicals.begin() + index; diff --git a/panda/src/switchnode/LODNode.I b/panda/src/switchnode/LODNode.I index 48f00bf51a..6ae6aed3d2 100644 --- a/panda/src/switchnode/LODNode.I +++ b/panda/src/switchnode/LODNode.I @@ -56,7 +56,7 @@ add_switch(float in, float out) { //////////////////////////////////////////////////////////////////// INLINE bool LODNode:: set_switch(int index, float in, float out) { - nassertr(index >= 0 && index < _lod._switch_vector.size(), false); + nassertr(index >= 0 && index < (int)_lod._switch_vector.size(), false); _lod._switch_vector[index].set_range(in, out); return true; } diff --git a/panda/src/tform/driveInterface.cxx b/panda/src/tform/driveInterface.cxx index 05b6bf3142..e641d79488 100644 --- a/panda/src/tform/driveInterface.cxx +++ b/panda/src/tform/driveInterface.cxx @@ -707,6 +707,9 @@ apply(double x, double y, bool any_button) { case CS_yup_left: step[1] = 0.0; break; + + default: + break; } _xyz += step;