Browse Source

UnalignedLVecBase etc, remove lerp etc, moving towards Eigen on win32

David Rose 14 years ago
parent
commit
c5c21a566a
100 changed files with 1480 additions and 1184 deletions
  1. 1 1
      direct/metalibs/direct/Sources.pp
  2. 0 1
      direct/src/interval/ActorInterval.py
  3. 0 1
      direct/src/interval/AnimControlInterval.py
  4. 1 1
      direct/src/interval/IndirectInterval.py
  5. 1 1
      direct/src/interval/LerpBlendHelpers.py
  6. 1 1
      direct/src/interval/LerpInterval.py
  7. 3 1
      direct/src/interval/Sources.pp
  8. 6 0
      direct/src/interval/config_interval.cxx
  9. 0 0
      direct/src/interval/lerpblend.cxx
  10. 6 6
      direct/src/interval/lerpblend.h
  11. 0 1
      direct/src/motiontrail/Sources.pp
  12. 3 3
      direct/src/plugin/Sources.pp
  13. 1 1
      direct/src/showbase/Sources.pp
  14. 5 0
      dtool/src/dtoolbase/pvector.h
  15. 0 17
      makepanda/makepanda.py
  16. 1 1
      panda/metalibs/panda/Sources.pp
  17. 3 3
      panda/src/chan/animChannelMatrixXfmTable.cxx
  18. 1 1
      panda/src/collide/collisionBox.h
  19. 5 7
      panda/src/collide/collisionFloorMesh.cxx
  20. 2 4
      panda/src/collide/collisionFloorMesh.h
  21. 1 1
      panda/src/collide/collisionHandlerPusher.cxx
  22. 2 2
      panda/src/collide/collisionPolygon.cxx
  23. 1 1
      panda/src/collide/collisionPolygon.h
  24. 6 6
      panda/src/collide/collisionTraverser.cxx
  25. 5 4
      panda/src/collide/collisionTube.cxx
  26. 1 1
      panda/src/collide/collisionTube.h
  27. 1 1
      panda/src/collide/collisionVisualizer.h
  28. 1 1
      panda/src/cull/Sources.pp
  29. 1 1
      panda/src/egg/eggGroupNode.cxx
  30. 2 2
      panda/src/egg/eggGroupNode.h
  31. 6 4
      panda/src/egg/eggMesherStrip.cxx
  32. 1 1
      panda/src/egg/eggMesherStrip.h
  33. 1 21
      panda/src/egg/eggMorphList.h
  34. 1 1
      panda/src/gobj/shader.h
  35. 4 4
      panda/src/grutil/geoMipTerrain.I
  36. 4 4
      panda/src/grutil/geoMipTerrain.h
  37. 1 1
      panda/src/grutil/lineSegs.h
  38. 3 3
      panda/src/grutil/meshDrawer.I
  39. 24 23
      panda/src/grutil/meshDrawer.cxx
  40. 18 18
      panda/src/grutil/meshDrawer.h
  41. 6 6
      panda/src/grutil/meshDrawer2D.I
  42. 3 3
      panda/src/grutil/meshDrawer2D.cxx
  43. 9 9
      panda/src/grutil/meshDrawer2D.h
  44. 1 1
      panda/src/grutil/pfmFile.h
  45. 0 23
      panda/src/lerp/Sources.pp
  46. 0 58
      panda/src/lerp/config_lerp.cxx
  47. 0 24
      panda/src/lerp/config_lerp.h
  48. 0 203
      panda/src/lerp/lerp.cxx
  49. 0 124
      panda/src/lerp/lerp.h
  50. 0 99
      panda/src/lerp/lerpchans.h
  51. 0 58
      panda/src/lerp/lerpfunctor.cxx
  52. 0 290
      panda/src/lerp/lerpfunctor.h
  53. 0 5
      panda/src/lerp/p3lerp_composite1.cxx
  54. 12 0
      panda/src/linmath/aa_luse.h
  55. 10 0
      panda/src/linmath/config_linmath.cxx
  56. 155 1
      panda/src/linmath/lmatrix3_src.I
  57. 17 1
      panda/src/linmath/lmatrix3_src.cxx
  58. 53 2
      panda/src/linmath/lmatrix3_src.h
  59. 168 0
      panda/src/linmath/lmatrix4_src.I
  60. 16 0
      panda/src/linmath/lmatrix4_src.cxx
  61. 55 1
      panda/src/linmath/lmatrix4_src.h
  62. 2 0
      panda/src/linmath/lsimpleMatrix.h
  63. 11 0
      panda/src/linmath/lvecBase2_ext_src.I
  64. 149 0
      panda/src/linmath/lvecBase2_src.I
  65. 16 0
      panda/src/linmath/lvecBase2_src.cxx
  66. 50 0
      panda/src/linmath/lvecBase2_src.h
  67. 11 0
      panda/src/linmath/lvecBase3_ext_src.I
  68. 150 0
      panda/src/linmath/lvecBase3_src.I
  69. 17 0
      panda/src/linmath/lvecBase3_src.cxx
  70. 52 0
      panda/src/linmath/lvecBase3_src.h
  71. 11 0
      panda/src/linmath/lvecBase4_ext_src.I
  72. 151 0
      panda/src/linmath/lvecBase4_src.I
  73. 17 0
      panda/src/linmath/lvecBase4_src.cxx
  74. 49 0
      panda/src/linmath/lvecBase4_src.h
  75. 5 5
      panda/src/mathutil/boundingBox.cxx
  76. 2 2
      panda/src/mathutil/boundingBox.h
  77. 8 8
      panda/src/mathutil/boundingSphere.cxx
  78. 2 2
      panda/src/mathutil/boundingSphere.h
  79. 20 20
      panda/src/mathutil/config_mathutil.N
  80. 3 3
      panda/src/mathutil/fftCompressor.cxx
  81. 3 3
      panda/src/mathutil/fftCompressor.h
  82. 1 1
      panda/src/mathutil/geometricBoundingVolume.I
  83. 1 1
      panda/src/mathutil/geometricBoundingVolume.cxx
  84. 5 5
      panda/src/mathutil/geometricBoundingVolume.h
  85. 1 1
      panda/src/mathutil/omniBoundingVolume.cxx
  86. 2 2
      panda/src/mathutil/omniBoundingVolume.h
  87. 20 12
      panda/src/mathutil/pta_LMatrix3.h
  88. 20 12
      panda/src/mathutil/pta_LMatrix4.h
  89. 20 12
      panda/src/mathutil/pta_LVecBase2.h
  90. 20 12
      panda/src/mathutil/pta_LVecBase3.h
  91. 20 12
      panda/src/mathutil/pta_LVecBase4.h
  92. 1 1
      panda/src/mathutil/stackedPerlinNoise2.h
  93. 1 1
      panda/src/mathutil/stackedPerlinNoise3.h
  94. 2 2
      panda/src/mathutil/triangulator.I
  95. 2 2
      panda/src/mathutil/triangulator.cxx
  96. 2 2
      panda/src/mathutil/triangulator.h
  97. 1 1
      panda/src/parametrics/curveFitter.h
  98. 1 1
      panda/src/parametrics/hermiteCurve.h
  99. 1 1
      panda/src/parametrics/nurbsBasisVector.h
  100. 1 1
      panda/src/parametrics/nurbsCurve.cxx

+ 1 - 1
direct/metalibs/direct/Sources.pp

@@ -20,7 +20,7 @@
   p3express:c p3pstatclient:c p3prc:c p3pandabase:c p3linmath:c \
   p3putil:c p3display:c p3event:c p3pgraph:c p3pgraphnodes:c \
   p3gsgbase:c p3gobj:c p3mathutil:c \
-  p3lerp:c p3downloader:c p3pnmimage:c p3chan:c \
+  p3downloader:c p3pnmimage:c p3chan:c \
   p3pipeline:c p3cull:c \
   $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c]
 

+ 0 - 1
direct/src/interval/ActorInterval.py

@@ -6,7 +6,6 @@ from pandac.PandaModules import *
 from direct.directnotify.DirectNotifyGlobal import *
 import Interval
 import math
-from direct.showbase import LerpBlendHelpers
 
 class ActorInterval(Interval.Interval):
 

+ 0 - 1
direct/src/interval/AnimControlInterval.py

@@ -6,7 +6,6 @@ from pandac.PandaModules import *
 from direct.directnotify.DirectNotifyGlobal import *
 import Interval
 import math
-from direct.showbase import LerpBlendHelpers
 
 class AnimControlInterval(Interval.Interval):
 

+ 1 - 1
direct/src/interval/IndirectInterval.py

@@ -5,7 +5,7 @@ __all__ = ['IndirectInterval']
 from pandac.PandaModules import *
 from direct.directnotify.DirectNotifyGlobal import *
 import Interval
-from direct.showbase import LerpBlendHelpers
+import LerpBlendHelpers
 
 class IndirectInterval(Interval.Interval):
     """

+ 1 - 1
direct/src/showbase/LerpBlendHelpers.py → direct/src/interval/LerpBlendHelpers.py

@@ -2,7 +2,7 @@
 
 __all__ = ['getBlend']
 
-from pandac.PandaModules import *
+from panda3d.direct import *
 
 """global lerp blend types for lerp function"""
     

+ 1 - 1
direct/src/interval/LerpInterval.py

@@ -15,7 +15,7 @@ __all__ = [
 from pandac.PandaModules import *
 from direct.directnotify.DirectNotifyGlobal import *
 import Interval
-from direct.showbase import LerpBlendHelpers
+import LerpBlendHelpers
 
 #
 # Most of the intervals defined in this module--the group up here at

+ 3 - 1
direct/src/interval/Sources.pp

@@ -3,7 +3,7 @@
   #define LOCAL_LIBS \
     p3directbase
   #define OTHER_LIBS \
-    p3downloader:c p3linmath:c p3lerp:c \
+    p3downloader:c p3linmath:c \
     p3chan:c p3event:c p3gobj:c p3pnmimage:c p3mathutil:c \
     p3pgraph:c p3putil:c panda:m p3express:c pandaexpress:m \
     p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \
@@ -26,6 +26,7 @@
     cLerpAnimEffectInterval.cxx cLerpAnimEffectInterval.I cLerpAnimEffectInterval.h \
     cMetaInterval.cxx cMetaInterval.I cMetaInterval.h \
     hideInterval.cxx hideInterval.I hideInterval.h \
+    lerpblend.cxx lerpblend.h \
     showInterval.cxx showInterval.I showInterval.h \
     waitInterval.cxx waitInterval.I waitInterval.h \
     lerp_helpers.h
@@ -44,6 +45,7 @@
     cLerpAnimEffectInterval.I cLerpAnimEffectInterval.h \
     cMetaInterval.I cMetaInterval.h \
     hideInterval.I hideInterval.h \
+    lerpblend.h \
     showInterval.I showInterval.h \
     waitInterval.I waitInterval.h \
     lerp_helpers.h

+ 6 - 0
direct/src/interval/config_interval.cxx

@@ -26,6 +26,7 @@
 #include "showInterval.h"
 #include "hideInterval.h"
 #include "waitInterval.h"
+#include "lerpblend.h"
 
 #include "dconfig.h"
 
@@ -76,5 +77,10 @@ init_libinterval() {
   ShowInterval::init_type();
   HideInterval::init_type();
   WaitInterval::init_type();
+  LerpBlendType::init_type();
+  EaseInBlendType::init_type();
+  EaseOutBlendType::init_type();
+  EaseInOutBlendType::init_type();
+  NoBlendType::init_type();
 }
 

+ 0 - 0
panda/src/lerp/lerpblend.cxx → direct/src/interval/lerpblend.cxx


+ 6 - 6
panda/src/lerp/lerpblend.h → direct/src/interval/lerpblend.h

@@ -15,10 +15,10 @@
 #ifndef __LERPBLEND_H__
 #define __LERPBLEND_H__
 
-#include "pandabase.h"
+#include "directbase.h"
 #include "typedReferenceCount.h"
 
-class EXPCL_PANDA_LERP LerpBlendType : public TypedReferenceCount {
+class EXPCL_DIRECT LerpBlendType : public TypedReferenceCount {
 PUBLISHED:
   LerpBlendType() {}
   virtual ~LerpBlendType();
@@ -48,7 +48,7 @@ private:
   static TypeHandle _type_handle;
 };
 
-class EXPCL_PANDA_LERP EaseInBlendType : public LerpBlendType {
+class EXPCL_DIRECT EaseInBlendType : public LerpBlendType {
 PUBLISHED:
   EaseInBlendType() {}
   virtual ~EaseInBlendType();
@@ -78,7 +78,7 @@ private:
   static TypeHandle _type_handle;
 };
 
-class EXPCL_PANDA_LERP EaseOutBlendType : public LerpBlendType {
+class EXPCL_DIRECT EaseOutBlendType : public LerpBlendType {
 PUBLISHED:
   EaseOutBlendType() {}
   virtual ~EaseOutBlendType();
@@ -108,7 +108,7 @@ private:
   static TypeHandle _type_handle;
 };
 
-class EXPCL_PANDA_LERP EaseInOutBlendType : public LerpBlendType {
+class EXPCL_DIRECT EaseInOutBlendType : public LerpBlendType {
 PUBLISHED:
   EaseInOutBlendType() {}
   virtual ~EaseInOutBlendType();
@@ -137,7 +137,7 @@ private:
   static TypeHandle _type_handle;
 };
 
-class EXPCL_PANDA_LERP NoBlendType : public LerpBlendType {
+class EXPCL_DIRECT NoBlendType : public LerpBlendType {
 PUBLISHED:
   NoBlendType() {}
   virtual ~NoBlendType();

+ 0 - 1
direct/src/motiontrail/Sources.pp

@@ -14,7 +14,6 @@
     p3pnmimage:c \
     $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \
     p3pgraph:c \
-    p3lerp:c \
     panda:m \
     p3express:c \
     p3downloader:c \

+ 3 - 3
direct/src/plugin/Sources.pp

@@ -246,7 +246,7 @@
     p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \
     p3express:c pandaexpress:m p3dxml:c \
     p3pgraph:c p3pgraphnodes:c p3cull:c p3gsgbase:c p3gobj:c \
-    p3mathutil:c p3lerp:c p3downloader:c p3pnmimage:c \
+    p3mathutil:c p3downloader:c p3pnmimage:c \
     p3prc:c p3pstatclient:c p3pandabase:c p3linmath:c p3putil:c \
     p3pipeline:c p3event:c p3display:c panda:m \
     $[if $[WANT_NATIVE_NET],p3nativenet:c] \
@@ -296,7 +296,7 @@
     p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \
     p3express:c pandaexpress:m p3dxml:c \
     p3pgraph:c p3pgraphnodes:c p3cull:c p3gsgbase:c p3gobj:c \
-    p3mathutil:c p3lerp:c p3downloader:c p3pnmimage:c \
+    p3mathutil:c p3downloader:c p3pnmimage:c \
     p3prc:c p3pstatclient:c p3pandabase:c p3linmath:c p3putil:c \
     p3pipeline:c p3event:c p3display:c panda:m \
     $[if $[WANT_NATIVE_NET],p3nativenet:c] \
@@ -342,7 +342,7 @@
     p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \
     p3express:c pandaexpress:m p3dxml:c \
     p3pgraph:c p3pgraphnodes:c p3cull:c p3gsgbase:c p3gobj:c \
-    p3mathutil:c p3lerp:c p3downloader:c p3pnmimage:c \
+    p3mathutil:c p3downloader:c p3pnmimage:c \
     p3prc:c p3pstatclient:c p3pandabase:c p3linmath:c p3putil:c \
     p3pipeline:c p3event:c p3display:c panda:m \
     $[if $[WANT_NATIVE_NET],p3nativenet:c] \

+ 1 - 1
direct/src/showbase/Sources.pp

@@ -4,7 +4,7 @@
     p3directbase
   #define OTHER_LIBS \
     p3pgraph:c p3pgraphnodes:c p3gsgbase:c p3gobj:c p3mathutil:c p3pstatclient:c \
-    p3lerp:c p3downloader:c p3pandabase:c p3pnmimage:c p3prc:c \
+    p3downloader:c p3pandabase:c p3pnmimage:c p3prc:c \
     p3pipeline:c p3cull:c \
     $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \
     p3display:c p3linmath:c p3event:c p3putil:c panda:m \

+ 5 - 0
dtool/src/dtoolbase/pvector.h

@@ -50,5 +50,10 @@ public:
 };
 
 #endif  // USE_STL_ALLOCATOR
+
+// Temporary.  We'll replace this with a vector that uses Eigen's
+// allocator to avoid Win32 issues.
+#define epvector pvector
+
 #endif
 

+ 0 - 17
makepanda/makepanda.py

@@ -2085,7 +2085,6 @@ CopyAllHeaders('panda/src/net')
 CopyAllHeaders('panda/src/pstatclient')
 CopyAllHeaders('panda/src/gobj')
 CopyAllHeaders('panda/src/movies')
-CopyAllHeaders('panda/src/lerp')
 CopyAllHeaders('panda/src/pgraphnodes')
 CopyAllHeaders('panda/src/pgraph')
 CopyAllHeaders('panda/src/cull')
@@ -2646,19 +2645,6 @@ if (not RUNTIME):
   TargetAdd('libp3gobj.in', opts=['IMOD:panda', 'ILIB:libp3gobj', 'SRCDIR:panda/src/gobj'])
   TargetAdd('libp3gobj_igate.obj', input='libp3gobj.in', opts=["DEPENDENCYONLY"])
 
-#
-# DIRECTORY: panda/src/lerp/
-#
-
-if (not RUNTIME):
-  OPTS=['DIR:panda/src/lerp', 'BUILDING:PANDA']
-  TargetAdd('p3lerp_composite1.obj', opts=OPTS, input='p3lerp_composite1.cxx')
-  IGATEFILES=GetDirectoryContents('panda/src/lerp', ["*.h", "*_composite*.cxx"])
-  IGATEFILES.remove("lerpchans.h")
-  TargetAdd('libp3lerp.in', opts=OPTS, input=IGATEFILES)
-  TargetAdd('libp3lerp.in', opts=['IMOD:panda', 'ILIB:libp3lerp', 'SRCDIR:panda/src/lerp'])
-  TargetAdd('libp3lerp_igate.obj', input='libp3lerp.in', opts=["DEPENDENCYONLY"])
-
 #
 # DIRECTORY: panda/src/pgraphnodes/
 #
@@ -2964,7 +2950,6 @@ if (not RUNTIME):
   TargetAdd('libpanda_module.obj', input='libp3pnmimage.in')
   TargetAdd('libpanda_module.obj', input='libp3text.in')
   TargetAdd('libpanda_module.obj', input='libp3tform.in')
-  TargetAdd('libpanda_module.obj', input='libp3lerp.in')
   TargetAdd('libpanda_module.obj', input='libp3putil.in')
   TargetAdd('libpanda_module.obj', input='libp3audio.in')
   TargetAdd('libpanda_module.obj', input='libp3nativenet.in')
@@ -3049,8 +3034,6 @@ if (not RUNTIME):
   TargetAdd('libpanda.dll', input='p3tform_composite1.obj')
   TargetAdd('libpanda.dll', input='p3tform_composite2.obj')
   TargetAdd('libpanda.dll', input='libp3tform_igate.obj')
-  TargetAdd('libpanda.dll', input='p3lerp_composite1.obj')
-  TargetAdd('libpanda.dll', input='libp3lerp_igate.obj')
   TargetAdd('libpanda.dll', input='p3putil_composite1.obj')
   TargetAdd('libpanda.dll', input='p3putil_composite2.obj')
   TargetAdd('libpanda.dll', input='libp3putil_igate.obj')

+ 1 - 1
panda/metalibs/panda/Sources.pp

@@ -16,7 +16,7 @@
     p3linmath p3mathutil p3movies p3net p3nativenet \
     p3parametrics \
     p3pnmimagetypes p3pnmimage \
-    p3pnmtext p3text p3tform p3lerp p3putil \
+    p3pnmtext p3text p3tform p3putil \
     p3audio p3pgui p3pandabase p3dxml
 
 #define LOCAL_LIBS \

+ 3 - 3
panda/src/chan/animChannelMatrixXfmTable.cxx

@@ -407,7 +407,7 @@ write_datagram(BamWriter *manager, Datagram &me) {
 
     // Now, write out the joint angles.  For these we need to build up
     // a HPR array.
-    pvector<LVecBase3> hprs;
+    pvector<UnalignedLVecBase3> hprs;
     int hprs_length = max(max(_tables[6].size(), _tables[7].size()), _tables[8].size());
     hprs.reserve(hprs_length);
     for (i = 0; i < hprs_length; i++) {
@@ -416,7 +416,7 @@ write_datagram(BamWriter *manager, Datagram &me) {
       PN_stdfloat r = _tables[8].empty() ? 0.0f : _tables[8][i % _tables[8].size()];
       hprs.push_back(LVecBase3(h, p, r));
     }
-    const LVecBase3 *hprs_array = NULL;
+    const UnalignedLVecBase3 *hprs_array = NULL;
     if (hprs_length != 0) {
       hprs_array = &hprs[0];
     }
@@ -518,7 +518,7 @@ fillin(DatagramIterator &scan, BamReader *manager) {
     }
 
     // Read in the HPR array and store it back in the joint angles.
-    pvector<LVecBase3> hprs;
+    pvector<UnalignedLVecBase3> hprs;
     compressor.read_hprs(scan, hprs, new_hpr);
     PTA_stdfloat h_table = PTA_stdfloat::empty_array(hprs.size(), get_class_type());
     PTA_stdfloat p_table = PTA_stdfloat::empty_array(hprs.size(), get_class_type());

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

@@ -115,7 +115,7 @@ public:
     LPoint2 _p;  // the point in 2-d space
     LVector2 _v; // the normalized vector to the next point
   };
-  typedef pvector<PointDef> Points;
+  typedef epvector<PointDef> Points;
 
   static void compute_vectors(Points &points);
   void draw_polygon(GeomNode *viz_geom_node, GeomNode *bounds_viz_geom_node,

+ 5 - 7
panda/src/collide/collisionFloorMesh.cxx

@@ -55,13 +55,12 @@ make_copy() {
 ////////////////////////////////////////////////////////////////////
 void CollisionFloorMesh::
 xform(const LMatrix4 &mat) {
-
-  pvector<LPoint3>::iterator vi;
+  Vertices::iterator vi;
   for (vi=_vertices.begin();vi!=_vertices.end();++vi) {
     LPoint3 pt = (*vi) * mat;
     (*vi).set(pt[0],pt[1],pt[2]);
   }
-  pvector<CollisionFloorMesh::TriangleIndices>::iterator ti;
+  Triangles::iterator ti;
   for (ti=_triangles.begin();ti!=_triangles.end();++ti) {
     CollisionFloorMesh::TriangleIndices tri = *ti;
     LPoint3 v1 = _vertices[tri.p1];
@@ -113,8 +112,7 @@ compute_internal_bounds() const {
     return new BoundingBox;
   }
 
-
-  pvector<LPoint3>::const_iterator pi = _vertices.begin();
+  Vertices::const_iterator pi = _vertices.begin();
   LPoint3 p = (*pi);
 
   LPoint3 x = p;
@@ -295,8 +293,8 @@ fill_viz_geom() {
 
   PT(GeomTriangles) mesh = new GeomTriangles(Geom::UH_static);
   PT(GeomLinestrips) wire = new GeomLinestrips(Geom::UH_static);
-  pvector<CollisionFloorMesh::TriangleIndices>::iterator ti;
-  pvector<LPoint3>::iterator vi;
+  Triangles::iterator ti;
+  Vertices::iterator vi;
   for (vi = _vertices.begin(); vi != _vertices.end(); vi++) {
     LPoint3 vert = *vi;
     vertex.add_data3(vert);

+ 2 - 4
panda/src/collide/collisionFloorMesh.h

@@ -85,13 +85,11 @@ protected:
   virtual void fill_viz_geom();
 
 private:
-  typedef pvector< LPoint3 > Vertices;
-
-  typedef pvector< TriangleIndices > Triangles;
+  typedef epvector<LPoint3> Vertices;
+  typedef epvector<TriangleIndices> Triangles;
 
   Vertices _vertices;
   Triangles _triangles;
-
   
   static PStatCollector _volume_pcollector;
   static PStatCollector _test_pcollector;

+ 1 - 1
panda/src/collide/collisionHandlerPusher.cxx

@@ -96,7 +96,7 @@ handle_entries() {
         // share nearly the same direction, and if so, we keep only the
         // longer of the two.
         
-        typedef pvector<ShoveData> Shoves;
+        typedef epvector<ShoveData> Shoves;
         Shoves shoves;
 
         Entries::const_iterator ei;

+ 2 - 2
panda/src/collide/collisionPolygon.cxx

@@ -205,7 +205,7 @@ xform(const LMatrix4 &mat) {
     LMatrix4 to_3d_mat;
     rederive_to_3d_mat(to_3d_mat);
 
-    pvector<LPoint3> verts;
+    epvector<LPoint3> verts;
     verts.reserve(_points.size());
     Points::const_iterator pi;
     for (pi = _points.begin(); pi != _points.end(); ++pi) {
@@ -1491,7 +1491,7 @@ fillin(DatagramIterator &scan, BamReader *manager) {
       LMatrix4 to_3d_mat;
       rederive_to_3d_mat(to_3d_mat);
       
-      pvector<LPoint3> verts;
+      epvector<LPoint3> verts;
       verts.reserve(_points.size());
       Points::const_iterator pi;
       for (pi = _points.begin(); pi != _points.end(); ++pi) {

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

@@ -110,7 +110,7 @@ private:
     LPoint2 _p;  // the point in 2-d space
     LVector2 _v; // the normalized vector to the next point
   };
-  typedef pvector<PointDef> Points;
+  typedef epvector<PointDef> Points;
 
   static void compute_vectors(Points &points);
   void draw_polygon(GeomNode *viz_geom_node, GeomNode *bounds_viz_geom_node,

+ 6 - 6
panda/src/collide/collisionTraverser.cxx

@@ -1328,7 +1328,7 @@ compare_collider_to_geom(CollisionEntry &entry, const Geom *geom,
           // Indexed case.
           GeomVertexReader index(tris->get_vertices(), 0);
           while (!index.is_at_end()) {
-            LVertex v[3];
+            UnalignedLVecBase3 v[3];
             
             vertex.set_row_unsafe(index.get_data1i());
             v[0] = vertex.get_data3();
@@ -1339,7 +1339,7 @@ compare_collider_to_geom(CollisionEntry &entry, const Geom *geom,
             
             // Generate a temporary CollisionGeom on the fly for each
             // triangle in the Geom.
-            if (CollisionPolygon::verify_points(v[0], v[1], v[2])) {
+            if (CollisionPolygon::verify_points(LVecBase3(v[0]), LVecBase3(v[1]), LVecBase3(v[2]))) {
               bool within_solid_bounds = true;
               if (from_node_gbv != (GeometricBoundingVolume *)NULL) {
                 PT(BoundingSphere) sphere = new BoundingSphere;
@@ -1350,7 +1350,7 @@ compare_collider_to_geom(CollisionEntry &entry, const Geom *geom,
 #endif  // DO_PSTATS
               }
               if (within_solid_bounds) {
-                PT(CollisionGeom) cgeom = new CollisionGeom(v[0], v[1], v[2]);
+                PT(CollisionGeom) cgeom = new CollisionGeom(LVecBase3(v[0]), LVecBase3(v[1]), LVecBase3(v[2]));
                 entry._into = cgeom;
                 entry.test_intersection((*ci).second, this);
               }
@@ -1361,7 +1361,7 @@ compare_collider_to_geom(CollisionEntry &entry, const Geom *geom,
           vertex.set_row_unsafe(primitive->get_first_vertex());
           int num_vertices = primitive->get_num_vertices();
           for (int i = 0; i < num_vertices; i += 3) {
-            LVertex v[3];
+            UnalignedLVecBase3 v[3];
             
             v[0] = vertex.get_data3();
             v[1] = vertex.get_data3();
@@ -1369,7 +1369,7 @@ compare_collider_to_geom(CollisionEntry &entry, const Geom *geom,
             
             // Generate a temporary CollisionGeom on the fly for each
             // triangle in the Geom.
-            if (CollisionPolygon::verify_points(v[0], v[1], v[2])) {
+            if (CollisionPolygon::verify_points(LVecBase3(v[0]), LVecBase3(v[1]), LVecBase3(v[2]))) {
               bool within_solid_bounds = true;
               if (from_node_gbv != (GeometricBoundingVolume *)NULL) {
                 PT(BoundingSphere) sphere = new BoundingSphere;
@@ -1380,7 +1380,7 @@ compare_collider_to_geom(CollisionEntry &entry, const Geom *geom,
 #endif  // DO_PSTATS
               }
               if (within_solid_bounds) {
-                PT(CollisionGeom) cgeom = new CollisionGeom(v[0], v[1], v[2]);
+                PT(CollisionGeom) cgeom = new CollisionGeom(LVecBase3(v[0]), LVecBase3(v[1]), LVecBase3(v[2]));
                 entry._into = cgeom;
                 entry.test_intersection((*ci).second, this);
               }

+ 5 - 4
panda/src/collide/collisionTube.cxx

@@ -132,7 +132,7 @@ compute_internal_bounds() const {
     if (vec.normalize()) {
       // The bounding volume includes both endpoints, plus a little
       // bit more to include the radius in both directions.
-      LPoint3 points[2];
+      UnalignedLVecBase3 points[2];
       points[0] = _a - vec * _radius;
       points[1] = _b + vec * _radius;
 
@@ -625,11 +625,12 @@ calc_sphere2_vertex(int ri, int si, int num_rings, int num_slices,
 ////////////////////////////////////////////////////////////////////
 bool CollisionTube::
 intersects_line(double &t1, double &t2,
-                LPoint3 from, LVector3 delta, PN_stdfloat inflate_radius) const {
+                const LPoint3 &from0, const LVector3 &delta0, 
+                PN_stdfloat inflate_radius) const {
   // Convert the line into our canonical coordinate space: the tube is
   // aligned with the y axis.
-  from = from * _inv_mat;
-  delta = delta * _inv_mat;
+  LPoint3 from = from0 * _inv_mat;
+  LVector3 delta = delta0 * _inv_mat;
 
   PN_stdfloat radius = _radius + inflate_radius;
 

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

@@ -90,7 +90,7 @@ private:
                               PN_stdfloat length);
 
   bool intersects_line(double &t1, double &t2,
-                       LPoint3 from, LVector3 delta,
+                       const LPoint3 &from, const LVector3 &delta,
                        PN_stdfloat inflate_radius) const;
   bool sphere_intersects_line(double &t1, double &t2, PN_stdfloat center_y,
                               const LPoint3 &from, const LVector3 &delta,

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

@@ -80,7 +80,7 @@ private:
     LVector3 _surface_normal;
     LPoint3 _interior_point;
   };
-  typedef pvector<CollisionPoint> Points;
+  typedef epvector<CollisionPoint> Points;
 
   class VizInfo {
   public:

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

@@ -1,7 +1,7 @@
 #define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \
                    p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c
 #define LOCAL_LIBS \
-    p3pgraph p3lerp p3event p3gsgbase p3gobj p3putil p3linmath \
+    p3pgraph p3event p3gsgbase p3gobj p3putil p3linmath \
     p3downloader p3express p3pandabase p3pstatclient 
  
 

+ 1 - 1
panda/src/egg/eggGroupNode.cxx

@@ -1309,7 +1309,7 @@ rebuild_vertex_pools(EggVertexPools &vertex_pools, unsigned int max_vertices,
         vertices.push_back(*pi);
       }
 
-      typedef pvector<EggAttributes> Attributes;
+      typedef epvector<EggAttributes> Attributes;
       Attributes attributes;
 
       if (prim->is_of_type(EggCompositePrimitive::get_class_type())) {

+ 2 - 2
panda/src/egg/eggGroupNode.h

@@ -202,7 +202,7 @@ private:
     LNormald _normal;
     size_t _vertex;
   };
-  typedef pvector<NVertexReference> NVertexGroup;
+  typedef epvector<NVertexReference> NVertexGroup;
   typedef pmap<LVertexd, NVertexGroup> NVertexCollection;
 
   void r_collect_vertex_normals(NVertexCollection &collection,
@@ -226,7 +226,7 @@ private:
     LTexCoordd _uv;
     bool _facing;
   };
-  typedef pvector<TBNVertexReference> TBNVertexGroup;
+  typedef epvector<TBNVertexReference> TBNVertexGroup;
   typedef pmap<TBNVertexValue, TBNVertexGroup> TBNVertexCollection;
 
   void r_collect_tangent_binormal(const GlobPattern &uv_name,

+ 6 - 4
panda/src/egg/eggMesherStrip.cxx

@@ -83,7 +83,9 @@ EggMesherStrip(const EggPrimitive *prim, int index,
     // Although for the most part we ignore the actual value of the
     // vertices, we will ask the polygon for its plane equation
     // (i.e. its normal).
-    if (DCAST(EggPolygon, prim)->calculate_normal(_plane_normal)) {
+    LNormald normal;
+    if (DCAST(EggPolygon, prim)->calculate_normal(normal)) {
+      _plane_normal = normal;
       _planar = true;
       LPoint3d p1 = prim->get_vertex(0)->get_pos3();
       _plane_offset = -dot(_plane_normal, p1);
@@ -822,7 +824,7 @@ convex_quad(EggMesherEdge *common_edge, EggMesherStrip &front,
 
   nassertr(front._planar, false);
 
-  const LNormald &n = front._plane_normal;
+  LNormald n(front._plane_normal);
   int xi, yi;
 
   // Find the largest dimension of the normal.
@@ -1415,8 +1417,8 @@ pick_sheet_mate(const EggMesherStrip &a_strip,
                 const EggMesherStrip &b_strip) const {
   // First, try to get the poly which is closest to our own normal.
   if (_planar && a_strip._planar && b_strip._planar) {
-    double a_diff = dot(_plane_normal, a_strip._plane_normal);
-    double b_diff = dot(_plane_normal, b_strip._plane_normal);
+    double a_diff = dot(LNormald(_plane_normal), LNormald(a_strip._plane_normal));
+    double b_diff = dot(LNormald(_plane_normal), LNormald(b_strip._plane_normal));
 
     if (fabs(a_diff - b_diff) > 0.0001) {
       return a_diff > b_diff;

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

@@ -140,7 +140,7 @@ public:
   MesherStatus _status;
 
   bool _planar;
-  LNormald _plane_normal;
+  UnalignedLVecBase3d _plane_normal;
   PN_stdfloat _plane_offset;
   int _row_id, _row_distance;
   MesherOrigin _origin;

+ 1 - 21
panda/src/egg/eggMorphList.h

@@ -30,7 +30,7 @@
 template<class MorphType>
 class EggMorphList {
 private:
-  typedef pvector<MorphType> Morphs;
+  typedef epvector<MorphType> Morphs;
 
 public:
   typedef TYPENAME Morphs::iterator iterator;
@@ -65,26 +65,6 @@ private:
   Morphs _morphs;
 };
 
-// Export all of the vectors.
-
-#define EXPCL EXPCL_PANDAEGG
-#define EXPTP EXPTP_PANDAEGG
-#define TYPE LVector3d
-#define NAME vector_LVector3d
-#include "vector_src.h"
-
-#define EXPCL EXPCL_PANDAEGG
-#define EXPTP EXPTP_PANDAEGG
-#define TYPE LVector2d
-#define NAME vector_LVector2d
-#include "vector_src.h"
-
-#define EXPCL EXPCL_PANDAEGG
-#define EXPTP EXPTP_PANDAEGG
-#define TYPE LVector4
-#define NAME vector_LVector4
-#include "vector_src.h"
-
 typedef EggMorphList<EggMorphVertex> EggMorphVertexList;
 typedef EggMorphList<EggMorphNormal> EggMorphNormalList;
 typedef EggMorphList<EggMorphTexCoord> EggMorphTexCoordList;

+ 1 - 1
panda/src/gobj/shader.h

@@ -461,7 +461,7 @@ public:
 
  public:
   pvector <ShaderPtrSpec> _ptr_spec; 
-  pvector <ShaderMatSpec> _mat_spec;
+  epvector <ShaderMatSpec> _mat_spec;
   pvector <ShaderTexSpec> _tex_spec;
   pvector <ShaderVarSpec> _var_spec;
   

+ 4 - 4
panda/src/grutil/geoMipTerrain.I

@@ -140,19 +140,19 @@ set_focal_point(double x, double y) {
   _focal_is_temporary = true;
 }
 INLINE void GeoMipTerrain::
-set_focal_point(LPoint2d fp) {
+set_focal_point(const LPoint2d &fp) {
   set_focal_point(fp.get_x(), fp.get_y());
 }
 INLINE void GeoMipTerrain::
-set_focal_point(LPoint2f fp) {
+set_focal_point(const LPoint2f &fp) {
   set_focal_point(double(fp.get_x()), double(fp.get_y()));
 }
 INLINE void GeoMipTerrain::
-set_focal_point(LPoint3d fp) {
+set_focal_point(const LPoint3d &fp) {
   set_focal_point(fp.get_x(), fp.get_y());
 }
 INLINE void GeoMipTerrain::
-set_focal_point(LPoint3f fp) {
+set_focal_point(const LPoint3f &fp) {
   set_focal_point(double(fp.get_x()), double(fp.get_y()));
 }
 INLINE void GeoMipTerrain::

+ 4 - 4
panda/src/grutil/geoMipTerrain.h

@@ -81,10 +81,10 @@ PUBLISHED:
   // highest quality (lowest level of detail). Parts farther away from
   // the focal point will have a lower quality (higher level of detail).
   // The focal point is not taken in respect if bruteforce is set true.
-  INLINE void set_focal_point(LPoint2d fp);
-  INLINE void set_focal_point(LPoint2f fp);
-  INLINE void set_focal_point(LPoint3d fp);
-  INLINE void set_focal_point(LPoint3f fp);
+  INLINE void set_focal_point(const LPoint2d &fp);
+  INLINE void set_focal_point(const LPoint2f &fp);
+  INLINE void set_focal_point(const LPoint3d &fp);
+  INLINE void set_focal_point(const LPoint3f &fp);
   INLINE void set_focal_point(double x, double y);
   INLINE void set_focal_point(NodePath fnp);
   INLINE NodePath get_focal_point() const;

+ 1 - 1
panda/src/grutil/lineSegs.h

@@ -79,7 +79,7 @@ private:
     LColor _color;
   };
 
-  typedef pvector<Point> SegmentList;
+  typedef epvector<Point> SegmentList;
   typedef pvector<SegmentList> LineList;
 
   LineList _list;

+ 3 - 3
panda/src/grutil/meshDrawer.I

@@ -86,9 +86,9 @@ get_budget() {
 //       Access: Published
 //  Description: Draws a triangle with the given parameters.
 ////////////////////////////////////////////////////////////////////
-INLINE void MeshDrawer::tri(LVector3 v1, LVector4 c1, LVector2 uv1,
-                            LVector3 v2, LVector4 c2, LVector2 uv2,
-                            LVector3 v3, LVector4 c3, LVector2 uv3) {
+INLINE void MeshDrawer::tri(const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1,
+                            const LVector3 &v2, const LVector4 &c2, const LVector2 &uv2,
+                            const LVector3 &v3, const LVector4 &c3, const LVector2 &uv3) {
 
   if( _clear_index > _end_clear_index) return;
 

+ 24 - 23
panda/src/grutil/meshDrawer.cxx

@@ -155,8 +155,8 @@ void MeshDrawer::end() {
 //               but has an extra rotation component.
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
-void MeshDrawer::particle(LVector3 pos, LVector4 frame, PN_stdfloat size, 
-  LVector4 color, PN_stdfloat rotation) {
+void MeshDrawer::particle(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, 
+  const LVector4 &color, PN_stdfloat rotation) {
 
   rotation = rotation / 57.29578;
 
@@ -187,14 +187,15 @@ void MeshDrawer::particle(LVector3 pos, LVector4 frame, PN_stdfloat size,
 //               a blend (from 0 to 1) component between them
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
-void MeshDrawer::blended_particle(LVector3 pos, LVector4 frame1, 
-  LVector4 frame2, PN_stdfloat blend, PN_stdfloat size, LVector4 color, PN_stdfloat rotation) {
+void MeshDrawer::blended_particle(const LVector3 &pos, const LVector4 &frame1, 
+  const LVector4 &frame2, PN_stdfloat blend, PN_stdfloat size, const LVector4 &color, PN_stdfloat rotation) {
 
-  PN_stdfloat original_w = color.get_w();
-  color.set_w((1.f-blend)*original_w);
-  particle(pos,frame1,size,color,rotation);
-  color.set_w(blend*original_w);
-  particle(pos,frame2,size,color,rotation);
+  LVector4 c2 = color;
+  PN_stdfloat original_w = c2.get_w();
+  c2.set_w((1.f-blend)*original_w);
+  particle(pos,frame1,size,c2,rotation);
+  c2.set_w(blend*original_w);
+  particle(pos,frame2,size,c2,rotation);
 
 }
 
@@ -205,8 +206,8 @@ void MeshDrawer::blended_particle(LVector3 pos, LVector4 frame1,
 //               Billboards always face the camera.
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
-void MeshDrawer::billboard(LVector3 pos, LVector4 frame, PN_stdfloat size, 
-  LVector4 _color) {
+void MeshDrawer::billboard(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, 
+  const LVector4 &_color) {
 
   LVector3 v1 = pos + _b1*size;
   LVector3 v2 = pos + _b2*size;
@@ -236,8 +237,8 @@ void MeshDrawer::billboard(LVector3 pos, LVector4 frame, PN_stdfloat size,
 //               billboarding effect.
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
-void MeshDrawer::segment(LVector3 start, LVector3 stop, LVector4 frame,
-                         PN_stdfloat thickness, LVector4 color) {
+void MeshDrawer::segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame,
+                         PN_stdfloat thickness, const LVector4 &color) {
   link_segment(start, frame, thickness, color);
   link_segment(stop, frame, thickness, color);
   link_segment_end(frame, color);
@@ -251,8 +252,8 @@ void MeshDrawer::segment(LVector3 start, LVector3 stop, LVector4 frame,
 //               Stars at start and ends at stop.
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
-void MeshDrawer::cross_segment(LVector3 start, LVector3 stop, LVector4 frame,
-                               PN_stdfloat thickness, LVector4 color) {
+void MeshDrawer::cross_segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame,
+                               PN_stdfloat thickness, const LVector4 &color) {
   
   PN_stdfloat u = frame.get_x();
   PN_stdfloat v = frame.get_y();
@@ -296,9 +297,9 @@ void MeshDrawer::cross_segment(LVector3 start, LVector3 stop, LVector4 frame,
 //               Stars at start and ends at stop.
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
-void MeshDrawer::uneven_segment(LVector3 start, LVector3 stop,
-  LVector4 frame, PN_stdfloat thickness_start, LVector4 color_start,
-  PN_stdfloat thickness_stop, LVector4 color_stop) {
+void MeshDrawer::uneven_segment(const LVector3 &start, const LVector3 &stop,
+  const LVector4 &frame, PN_stdfloat thickness_start, const LVector4 &color_start,
+  PN_stdfloat thickness_stop, const LVector4 &color_stop) {
 
   PN_stdfloat u = frame.get_x();
   PN_stdfloat v = frame.get_y();
@@ -337,7 +338,7 @@ void MeshDrawer::uneven_segment(LVector3 start, LVector3 stop,
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::explosion(
-  LVector3 pos, LVector4 frame, PN_stdfloat size, LVector4 _color,
+  const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, const LVector4 &_color,
   int seed, int number, PN_stdfloat distance) {
   srand(seed);
   LVector3 relative_pos;
@@ -356,7 +357,7 @@ void MeshDrawer::explosion(
 //               shift dictated by the offset.
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
-void MeshDrawer::stream(LVector3 start, LVector3 stop, LVector4 frame, PN_stdfloat size, LVector4 _color,
+void MeshDrawer::stream(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat size, const LVector4 &_color,
         int number, PN_stdfloat offset) {
 
   offset = offset-floor(offset);
@@ -448,8 +449,8 @@ void MeshDrawer::geometry(NodePath draw_node) {
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
 void MeshDrawer::
-link_segment(LVector3 pos, LVector4 frame,
-         PN_stdfloat thickness, LVector4 color) {
+link_segment(const LVector3 &pos, const LVector4 &frame,
+         PN_stdfloat thickness, const LVector4 &color) {
   assert(_render.get_error_type() == NodePath::ET_ok);
   assert(_camera.get_error_type() == NodePath::ET_ok);
   /*
@@ -550,7 +551,7 @@ link_segment(LVector3 pos, LVector4 frame,
 //               the linked segment.
 //               Frame contains u,v,u-size,v-size quadruple.
 ////////////////////////////////////////////////////////////////////
-void MeshDrawer::link_segment_end(LVector4 frame, LVector4 color)
+void MeshDrawer::link_segment_end(const LVector4 &frame, const LVector4 &color)
 {
   PN_stdfloat u = frame.get_x();
   PN_stdfloat v = frame.get_y();

+ 18 - 18
panda/src/grutil/meshDrawer.h

@@ -66,26 +66,26 @@ PUBLISHED:
   INLINE NodePath get_root();
 
   void begin(NodePath camera, NodePath render);
-  INLINE void tri(LVector3 v1, LVector4 c1, LVector2 uv1,
-                  LVector3 v2, LVector4 c2, LVector2 uv2,
-                  LVector3 v3, LVector4 c3, LVector2 uv3);
+  INLINE void tri(const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1,
+                  const LVector3 &v2, const LVector4 &c2, const LVector2 &uv2,
+                  const LVector3 &v3, const LVector4 &c3, const LVector2 &uv3);
                   
-  void particle(LVector3 pos, LVector4 frame, PN_stdfloat size, LVector4 color, PN_stdfloat rotation);
-  void blended_particle(LVector3 pos, LVector4 frame1, LVector4 frame2,
-    PN_stdfloat blend, PN_stdfloat size, LVector4 color, PN_stdfloat rotation);
-  void billboard(LVector3 pos, LVector4 frame, PN_stdfloat size, LVector4 color);
-  void segment(LVector3 start, LVector3 stop, LVector4 frame, PN_stdfloat thickness, LVector4 color);
-  void cross_segment(LVector3 start, LVector3 stop, LVector4 frame, PN_stdfloat thickness, LVector4 color);
-  void uneven_segment(LVector3 start, LVector3 stop,
-    LVector4 frame, PN_stdfloat thickness_start, LVector4 color_start,
-    PN_stdfloat thickness_stop, LVector4 color_stop);
-
-  void link_segment(LVector3 pos, LVector4 frame, PN_stdfloat thickness, LVector4 color);
-  void link_segment_end(LVector4 frame, LVector4 color);
-
-  void explosion(LVector3 pos, LVector4 frame, PN_stdfloat size, LVector4 color,
+  void particle(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, const LVector4 &color, PN_stdfloat rotation);
+  void blended_particle(const LVector3 &pos, const LVector4 &frame1, const LVector4 &frame2,
+    PN_stdfloat blend, PN_stdfloat size, const LVector4 &color, PN_stdfloat rotation);
+  void billboard(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, const LVector4 &color);
+  void segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat thickness, const LVector4 &color);
+  void cross_segment(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat thickness, const LVector4 &color);
+  void uneven_segment(const LVector3 &start, const LVector3 &stop,
+    const LVector4 &frame, PN_stdfloat thickness_start, const LVector4 &color_start,
+    PN_stdfloat thickness_stop, const LVector4 &color_stop);
+
+  void link_segment(const LVector3 &pos, const LVector4 &frame, PN_stdfloat thickness, const LVector4 &color);
+  void link_segment_end(const LVector4 &frame, const LVector4 &color);
+
+  void explosion(const LVector3 &pos, const LVector4 &frame, PN_stdfloat size, const LVector4 &color,
     int seed, int number, PN_stdfloat distance);
-  void stream(LVector3 start, LVector3 stop, LVector4 frame, PN_stdfloat size, LVector4 color,
+  void stream(const LVector3 &start, const LVector3 &stop, const LVector4 &frame, PN_stdfloat size, const LVector4 &color,
     int number, PN_stdfloat offset);
   void geometry(NodePath node);
   void end();

+ 6 - 6
panda/src/grutil/meshDrawer2D.I

@@ -98,10 +98,10 @@ set_clip(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h) {
 //               Ignores the cliping rectangle
 ////////////////////////////////////////////////////////////////////
 INLINE void MeshDrawer2D::
-quad_raw(LVector3 v1, LVector4 c1, LVector2 uv1,
-     LVector3 v2, LVector4 c2, LVector2 uv2,
-     LVector3 v3, LVector4 c3, LVector2 uv3,
-     LVector3 v4, LVector4 c4, LVector2 uv4
+quad_raw(const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1,
+     const LVector3 &v2, const LVector4 &c2, const LVector2 &uv2,
+     const LVector3 &v3, const LVector4 &c3, const LVector2 &uv3,
+     const LVector3 &v4, const LVector4 &c4, const LVector2 &uv4
 ) {
 
   if( _clear_index > _end_clear_index) return;
@@ -129,7 +129,7 @@ quad_raw(LVector3 v1, LVector4 c1, LVector2 uv1,
 INLINE void MeshDrawer2D::
 rectangle_raw(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, 
      PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, 
-     LVector4 color
+     const LVector4 &color
 ) {
     
   quad_raw( 
@@ -148,7 +148,7 @@ rectangle_raw(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
 INLINE void MeshDrawer2D::
 rectangle(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, 
      PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, 
-     LVector4 color
+     const LVector4 &color
 ) {
     
   if( w == 0 &&  h == 0 ) return; // no size return 

+ 3 - 3
panda/src/grutil/meshDrawer2D.cxx

@@ -146,7 +146,7 @@ void MeshDrawer2D::end() {
 void MeshDrawer2D::
 rectangle_tiled(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h, 
      PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, 
-     LVector4 color
+     const LVector4 &color
 ) {
 
   PN_stdfloat x_fit = w/us;
@@ -202,7 +202,7 @@ rectangle_border(
     PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b,
     PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb,
     PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, 
-    LVector4 color){
+    const LVector4 &color){
     
     rectangle(x,y,w,h,u,v,us,vs,color); // center
     
@@ -234,7 +234,7 @@ rectangle_border_tiled(
     PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b,
     PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb,
     PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs, 
-    LVector4 color){
+    const LVector4 &color){
     
     rectangle_tiled(x,y,w,h,u,v,us,vs,color); // center
     

+ 9 - 9
panda/src/grutil/meshDrawer2D.h

@@ -56,41 +56,41 @@ PUBLISHED:
   INLINE NodePath get_root();
 
   INLINE void quad_raw(
-    LVector3 v1, LVector4 c1, LVector2 uv1,
-    LVector3 v2, LVector4 c2, LVector2 uv2,
-    LVector3 v3, LVector4 c3, LVector2 uv3,
-    LVector3 v4, LVector4 c4, LVector2 uv4);
+    const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1,
+    const LVector3 &v2, const LVector4 &c2, const LVector2 &uv2,
+    const LVector3 &v3, const LVector4 &c3, const LVector2 &uv3,
+    const LVector3 &v4, const LVector4 &c4, const LVector2 &uv4);
 
   INLINE void rectangle_raw(
     PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
     PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
-    LVector4 color);
+    const LVector4 &color);
 
   INLINE void set_clip(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h);
 
   INLINE void rectangle(
     PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
     PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
-    LVector4 color);
+    const LVector4 &color);
 
   void rectangle_border(
       PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
       PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b,
       PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb,
       PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
-      LVector4 color);
+      const LVector4 &color);
 
   void rectangle_border_tiled(
       PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
       PN_stdfloat r, PN_stdfloat t, PN_stdfloat l, PN_stdfloat b,
       PN_stdfloat tr, PN_stdfloat tt, PN_stdfloat tl, PN_stdfloat tb,
       PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
-      LVector4 color);
+      const LVector4 &color);
 
   void rectangle_tiled(
     PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
     PN_stdfloat u, PN_stdfloat v, PN_stdfloat us, PN_stdfloat vs,
-    LVector4 color);
+    const LVector4 &color);
 
   void begin();
   void end();

+ 1 - 1
panda/src/grutil/pfmFile.h

@@ -104,7 +104,7 @@ private:
                       int xi, int yi, int dist, int ti) const;
 
 private:
-  typedef pvector<LPoint3> Table;
+  typedef epvector<LPoint3> Table;
   Table _table;
 
   int _x_size;

+ 0 - 23
panda/src/lerp/Sources.pp

@@ -1,23 +0,0 @@
-#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \
-                   p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c
-
-#begin lib_target
-  #define TARGET p3lerp
-  #define LOCAL_LIBS \
-    p3event p3linmath p3putil
-
-  #define COMBINED_SOURCES $[TARGET]_composite1.cxx 
-
-  #define SOURCES \
-    config_lerp.h lerp.h lerpblend.h lerpfunctor.h
-    
-  #define INCLUDED_SOURCES \
-    config_lerp.cxx lerp.cxx lerpblend.cxx lerpfunctor.cxx 
-
-  #define INSTALL_HEADERS \
-    lerp.h lerpblend.h lerpfunctor.h
-    
-  #define IGATESCAN all
-
-#end lib_target
-

+ 0 - 58
panda/src/lerp/config_lerp.cxx

@@ -1,58 +0,0 @@
-// Filename: config_lerp.cxx
-// Created by:  frang (30May00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) Carnegie Mellon University.  All rights reserved.
-//
-// All use of this software is subject to the terms of the revised BSD
-// license.  You should have received a copy of this license along
-// with this source code in a file named "LICENSE."
-//
-////////////////////////////////////////////////////////////////////
-
-
-#include "lerp.h"
-#include "lerpfunctor.h"
-
-#include "config_lerp.h"
-
-Configure(config_lerp);
-NotifyCategoryDef(lerp, "");
-
-ConfigureFn(config_lerp) {
-  Lerp::init_type();
-  AutonomousLerp::init_type();
-
-  LerpFunctor::init_type();
-  SimpleLerpFunctor<int>::init_type();
-  SimpleLerpFunctor<PN_stdfloat>::init_type();
-  SimpleLerpFunctor<LPoint2>::init_type();
-  SimpleLerpFunctor<LPoint3>::init_type();
-  SimpleLerpFunctor<LPoint4>::init_type();
-  SimpleLerpFunctor<LVecBase2>::init_type();
-  SimpleLerpFunctor<LVecBase3>::init_type();
-  SimpleLerpFunctor<LVecBase4>::init_type();
-  SimpleLerpFunctor<LVector2>::init_type();
-  SimpleLerpFunctor<LVector3>::init_type();
-  SimpleLerpFunctor<LVector4>::init_type();
-  SimpleQueryLerpFunctor<int>::init_type();
-  SimpleQueryLerpFunctor<PN_stdfloat>::init_type();
-  SimpleQueryLerpFunctor<LPoint2>::init_type();
-  SimpleQueryLerpFunctor<LPoint3>::init_type();
-  SimpleQueryLerpFunctor<LPoint4>::init_type();
-  SimpleQueryLerpFunctor<LVecBase2>::init_type();
-  SimpleQueryLerpFunctor<LVecBase3>::init_type();
-  SimpleQueryLerpFunctor<LVecBase4>::init_type();
-  SimpleQueryLerpFunctor<LVector2>::init_type();
-  SimpleQueryLerpFunctor<LVector3>::init_type();
-  SimpleQueryLerpFunctor<LVector4>::init_type();
-  MultiLerpFunctor::init_type();
-
-  LerpBlendType::init_type();
-  EaseInBlendType::init_type();
-  EaseOutBlendType::init_type();
-  EaseInOutBlendType::init_type();
-  NoBlendType::init_type();
-}

+ 0 - 24
panda/src/lerp/config_lerp.h

@@ -1,24 +0,0 @@
-// Filename: config_lerp.h
-// Created by:  frang (30May00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) Carnegie Mellon University.  All rights reserved.
-//
-// All use of this software is subject to the terms of the revised BSD
-// license.  You should have received a copy of this license along
-// with this source code in a file named "LICENSE."
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __CONFIG_LERP_H__
-#define __CONFIG_LERP_H__
-
-#include "pandabase.h"
-#include "dconfig.h"
-#include "notifyCategoryProxy.h"
-
-NotifyCategoryDecl(lerp, EXPCL_PANDA_LERP, EXPTP_PANDA_LERP);
-
-#endif /* __CONFIG_LERP_H__ */

+ 0 - 203
panda/src/lerp/lerp.cxx

@@ -1,203 +0,0 @@
-// Filename: lerp.cxx
-// Created by:  frang (30May00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) Carnegie Mellon University.  All rights reserved.
-//
-// All use of this software is subject to the terms of the revised BSD
-// license.  You should have received a copy of this license along
-// with this source code in a file named "LICENSE."
-//
-////////////////////////////////////////////////////////////////////
-
-
-#include "lerp.h"
-
-#include "clockObject.h"
-#include "throw_event.h"
-
-TypeHandle Lerp::_type_handle;
-TypeHandle AutonomousLerp::_type_handle;
-
-static INLINE PN_stdfloat scale_t(PN_stdfloat t, PN_stdfloat start, PN_stdfloat end) {
-  PN_stdfloat ret = t;
-  if (ret < start)
-    ret = start;
-  if (ret > end)
-    ret = end;
-  // Avoid a possible divide-by-zero
-  if (end == 0.0f)
-      return 0.0f;
-  return ret / end;
-}
-
-Lerp::Lerp(LerpFunctor* func, PN_stdfloat endt, LerpBlendType* blend)
-  : _blend(blend), _func(func), _startt(0.), _endt(endt),
-    _delta(1.), _t(0.) {}
-
-Lerp::Lerp(LerpFunctor* func, PN_stdfloat startt, PN_stdfloat endt,
-           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),
-                            _delta(c._delta), _t(c._t) {}
-
-Lerp::~Lerp() {}
-
-Lerp& Lerp::operator=(const Lerp& c) {
-  _blend = c._blend;
-  _func = c._func;
-  _event = c._event;
-  _startt = c._startt;
-  _endt = c._endt;
-  _delta = c._delta;
-  _t = c._t;
-  return *this;
-}
-
-void Lerp::step() {
-  _t += _delta;
-  if (is_done()) {
-    (*_func)(1.0);
-    if (!_event.empty()) {
-      throw_event(_event);
-    }
-  } else {
-    PN_stdfloat t = scale_t(_t, _startt, _endt);
-    t = (_blend==(LerpBlendType*)0L)?t:(*_blend)(t);
-    (*_func)(t);
-  }
-}
-
-void Lerp::set_step_size(PN_stdfloat delta) {
-  _delta = delta;
-}
-
-PN_stdfloat Lerp::get_step_size() const {
-  return _delta;
-}
-
-void Lerp::set_t(PN_stdfloat t) {
-  _t = t;
-  PN_stdfloat x = scale_t(_t, _startt, _endt);
-  x = (_blend==(LerpBlendType*)0L)?x:(*_blend)(x);
-  (*_func)(x);
-}
-
-PN_stdfloat Lerp::get_t() const {
-  return _t;
-}
-
-bool Lerp::is_done() const {
-  return (_t >= _endt);
-}
-
-LerpFunctor* Lerp::get_functor() const {
-  return _func;
-}
-
-void Lerp::set_end_event(const std::string& event) {
-  _event = event;
-}
-
-std::string Lerp::get_end_event() const {
-  return _event;
-}
-
-AutonomousLerp::AutonomousLerp(LerpFunctor* func, PN_stdfloat endt,
-                               LerpBlendType* blend, EventHandler* handler)
-  : _blend(blend), _func(func), _handler(handler),
-    _startt(0.), _endt(endt), _t(0.) {}
-
-AutonomousLerp::AutonomousLerp(LerpFunctor* func, PN_stdfloat startt, PN_stdfloat endt,
-                               LerpBlendType* blend, EventHandler* handler)
-  : _blend(blend), _func(func), _handler(handler),
-    _startt(startt), _endt(endt), _t(startt) {}
-
-AutonomousLerp::AutonomousLerp(const AutonomousLerp& c) : _blend(c._blend),
-                                                          _func(c._func),
-                                                          _handler(c._handler),
-                                                          _event(c._event),
-                                                          _startt(c._startt),
-                                                          _endt(c._endt),
-                                                          _t(c._t) {}
-
-AutonomousLerp::~AutonomousLerp() {}
-
-AutonomousLerp& AutonomousLerp::operator=(const AutonomousLerp& c) {
-  _blend = c._blend;
-  _func = c._func;
-  _handler = c._handler;
-  _event = c._event;
-  _startt = c._startt;
-  _endt = c._endt;
-  _t = c._t;
-  return *this;
-}
-
-void AutonomousLerp::start() {
-  _t = _startt;
-  _handler->add_hook("NewFrame", handle_event, this);
-}
-
-void AutonomousLerp::stop() {
-  _handler->remove_hook("NewFrame", handle_event, this);
-}
-
-void AutonomousLerp::resume() {
-  _handler->add_hook("NewFrame", handle_event, this);
-}
-
-bool AutonomousLerp::is_done() const {
-  return (_t >= _endt);
-}
-
-LerpFunctor* AutonomousLerp::get_functor() const {
-  return _func;
-}
-
-void AutonomousLerp::set_t(PN_stdfloat t) {
-  _t = t;
-  PN_stdfloat x = scale_t(_t, _startt, _endt);
-  x = (_blend==(LerpBlendType*)0L)?x:(*_blend)(x);
-  (*_func)(x);
-}
-
-PN_stdfloat AutonomousLerp::get_t() const {
-  return _t;
-}
-
-void AutonomousLerp::set_end_event(const std::string& event) {
-  _event = event;
-}
-
-std::string AutonomousLerp::get_end_event() const {
-  return _event;
-}
-
-void AutonomousLerp::step() {
-  // Probably broken because it does not set the final value when t
-  // exceeds end_t. see fixed Lerp::step() above
-  if (is_done()) {
-    stop();
-    return;
-  }
-  PN_stdfloat delta = ClockObject::get_global_clock()->get_dt();
-  _t += delta;
-  PN_stdfloat t = scale_t(_t, _startt, _endt);
-  t = (_blend==(LerpBlendType*)0L)?t:(*_blend)(t);
-  (*_func)(t);
-  if (is_done() && !_event.empty())
-    throw_event(_event);
-}
-
-void AutonomousLerp::handle_event(const Event *, void* data) {
-  AutonomousLerp* l = (AutonomousLerp*)data;
-  l->step();
-}

+ 0 - 124
panda/src/lerp/lerp.h

@@ -1,124 +0,0 @@
-// Filename: lerp.h
-// Created by:  frang (18Apr00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) Carnegie Mellon University.  All rights reserved.
-//
-// All use of this software is subject to the terms of the revised BSD
-// license.  You should have received a copy of this license along
-// with this source code in a file named "LICENSE."
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __LERP_H__
-#define __LERP_H__
-
-#include "pandabase.h"
-
-#include "lerpfunctor.h"
-#include "lerpblend.h"
-
-#include "typedReferenceCount.h"
-#include "eventHandler.h"
-
-class EXPCL_PANDA_LERP Lerp : public TypedReferenceCount {
-private:
-  PT(LerpBlendType) _blend;
-  PT(LerpFunctor) _func;
-  std::string _event;
-  PN_stdfloat _startt;
-  PN_stdfloat _endt;
-  PN_stdfloat _delta;
-  PN_stdfloat _t;
-
-PUBLISHED:
-  Lerp(LerpFunctor* func, PN_stdfloat endt, LerpBlendType* blend);
-  Lerp(LerpFunctor* func, PN_stdfloat startt, PN_stdfloat endt, LerpBlendType* blend);
-  Lerp(const Lerp&);
-  virtual ~Lerp();
-  Lerp& operator=(const Lerp&);
-  void step();
-  void set_step_size(PN_stdfloat);
-  PN_stdfloat get_step_size() const;
-  void set_t(PN_stdfloat);
-  PN_stdfloat get_t() const;
-  bool is_done() const;
-  LerpFunctor* get_functor() const;
-  void set_end_event(const std::string&);
-  std::string get_end_event() const;
-
-public:
-  // now for typehandle stuff
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    TypedReferenceCount::init_type();
-    register_type(_type_handle, "Lerp", TypedReferenceCount::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-class EXPCL_PANDA_LERP AutonomousLerp : public TypedReferenceCount {
-private:
-  PT(LerpBlendType) _blend;
-  PT(LerpFunctor) _func;
-  EventHandler* _handler;
-  std::string _event;
-  PN_stdfloat _startt;
-  PN_stdfloat _endt;
-  PN_stdfloat _t;
-
-  virtual void step();
-  static void handle_event(const Event *, void*);
-
-PUBLISHED:
-  AutonomousLerp(LerpFunctor* func, PN_stdfloat endt, LerpBlendType* blend,
-                 EventHandler* handler);
-  AutonomousLerp(LerpFunctor* func, PN_stdfloat startt, PN_stdfloat endt,
-                 LerpBlendType* blend, EventHandler* handler);
-  AutonomousLerp(const AutonomousLerp&);
-  virtual ~AutonomousLerp();
-  AutonomousLerp& operator=(const AutonomousLerp&);
-  void start();
-  void stop();
-  void resume();
-  bool is_done() const;
-  LerpFunctor* get_functor() const;
-  void set_t(PN_stdfloat);
-  PN_stdfloat get_t() const;
-  void set_end_event(const std::string&);
-  std::string get_end_event() const;
-
-public:
-  // now for typehandle stuff
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    TypedReferenceCount::init_type();
-    register_type(_type_handle, "AutonomousLerp",
-                  TypedReferenceCount::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#endif /* __LERP_H__ */

+ 0 - 99
panda/src/lerp/lerpchans.h

@@ -1,99 +0,0 @@
-// Filename: lerpchans.h
-// Created by:  frang (11Apr00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) Carnegie Mellon University.  All rights reserved.
-//
-// All use of this software is subject to the terms of the revised BSD
-// license.  You should have received a copy of this license along
-// with this source code in a file named "LICENSE."
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __LERPCHANS_H__
-#define __LERPCHANS_H__
-
-// There are three fundamental types of lerp channel: tabular/keyframe,
-// procedural, and composite.  Tabular channels may have an interpolator
-// associated with them, to determine values between samples.  Proceedural
-// channels compute each data point as needed.  Composite channels can be
-// either blending or concatenation objects.  Blending objects take some
-// number of channels as input, apply a blending function to them in order
-// to yield what appears to be a single channel.  Concatenation objects
-// take some number of channels as input and string them end-to-end to yield
-// what appears to be a single channel.
-
-class LerpChannelRange {
-private:
-  PN_stdfloat _low, _high;
-public:
-  INLINE LerpChannelRange(PN_stdfloat low, PN_stdfloat high) : _low(low), _high(high) {
-    if (low > high) {
-      _low = high;
-      _high = low;
-    }
-  }
-  INLINE LerpChannelRange(const LerpChannelRange& c) : _low(c._low),
-                                                       _high(c._high) {}
-  INLINE ~LerpChannelRange() {}
-  INLINE PN_stdfloat GetLow() { return _low; }
-  INLINE PN_stdfloat GetHigh() { return _high; }
-  INLINE void SetLow(PN_stdfloat l) {
-    if (l > _high) {
-      _low = _high;
-      _high = l;
-    } else
-      _low = l;
-  }
-  INLINE void SetHigh(PN_stdfloat h) {
-    if (h < _low) {
-      _high = _low;
-      _low = h;
-    } else
-      _high = h;
-  }
-  INLINE void SetRange(PN_stdfloat l, PN_stdfloat h) {
-    if (l > h) {
-      _low = h;
-      _high = l;
-    } else {
-      _low = l;
-      _high = h;
-    }
-  }
-  INLINE LerpChannelRange& operator=(const LerpChannelRange& c) {
-    _low = c._low;
-    _high = c._high;
-    return *this;
-  }
-};
-
-template <class value>
-class LerpChannel {
-public:
-  virtual GetValue(PN_stdfloat p);
-};
-
-template <class value>
-class TabularChannel : public LerpChannel {
-};
-
-template <class value>
-class ProceduralChannel : public LerpChannel {
-};
-
-template <class value>
-class CompositeChannel : public LerpChannel {
-};
-
-template <class value>
-class BlendChannel : public CompositeChannel {
-};
-
-template <class value>
-class ConcatenationChannel : public CompositeChannel {
-};
-
-#endif /* __LERPCHANS_H__ */

+ 0 - 58
panda/src/lerp/lerpfunctor.cxx

@@ -1,58 +0,0 @@
-// Filename: lerpfunctor.cxx
-// Created by:  frang (26May00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) Carnegie Mellon University.  All rights reserved.
-//
-// All use of this software is subject to the terms of the revised BSD
-// license.  You should have received a copy of this license along
-// with this source code in a file named "LICENSE."
-//
-////////////////////////////////////////////////////////////////////
-
-#include "lerpfunctor.h"
-
-TypeHandle LerpFunctor::_type_handle;
-TypeHandle MultiLerpFunctor::_type_handle;
-
-LerpFunctor::LerpFunctor(const LerpFunctor&)
-{
-}
-
-LerpFunctor::~LerpFunctor()
-{
-}
-
-LerpFunctor& LerpFunctor::operator=(const LerpFunctor&) {
-  return *this;
-}
-
-void LerpFunctor::operator()(PN_stdfloat) {
-  // should not be here
-}
-
-MultiLerpFunctor::MultiLerpFunctor(const MultiLerpFunctor& c)
-  : LerpFunctor(c), _funcs(c._funcs) {}
-
-MultiLerpFunctor::~MultiLerpFunctor() {}
-
-MultiLerpFunctor& MultiLerpFunctor::operator=(const MultiLerpFunctor& c) {
-  _funcs = c._funcs;
-  LerpFunctor::operator=(c);
-  return *this;
-}
-
-void MultiLerpFunctor::operator()(PN_stdfloat f) {
-  for (Functors::iterator i=_funcs.begin(); i!=_funcs.end(); ++i)
-    (*(*i))(f);
-}
-
-void MultiLerpFunctor::add_functor(LerpFunctor* func) {
-  _funcs.insert(func);
-}
-
-void MultiLerpFunctor::remove_functor(LerpFunctor* func) {
-  _funcs.erase(func);
-}

+ 0 - 290
panda/src/lerp/lerpfunctor.h

@@ -1,290 +0,0 @@
-// Filename: lerpfunctor.h
-// Created by:  frang (26May00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) Carnegie Mellon University.  All rights reserved.
-//
-// All use of this software is subject to the terms of the revised BSD
-// license.  You should have received a copy of this license along
-// with this source code in a file named "LICENSE."
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __LERPFUNCTOR_H__
-#define __LERPFUNCTOR_H__
-
-#include "pandabase.h"
-#include "typedReferenceCount.h"
-
-class EXPCL_PANDA_LERP LerpFunctor : public TypedReferenceCount {
-public:
-  LerpFunctor() {}
-  LerpFunctor(const LerpFunctor&);
-  virtual ~LerpFunctor();
-  LerpFunctor& operator=(const LerpFunctor&);
-  virtual void operator()(PN_stdfloat) = 0;
-
-PUBLISHED:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-
-public:
-  static void init_type() {
-    TypedReferenceCount::init_type();
-    register_type(_type_handle, "LerpFunctor",
-                  TypedReferenceCount::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-template <class value>
-class SimpleLerpFunctor : public LerpFunctor {
-protected:
-  value _start;
-  value _end;
-  value _diff_cache;
-
-  SimpleLerpFunctor(value start, value end) : LerpFunctor(), _start(start),
-                                              _end(end), _diff_cache(end-start)
-    {}
-  SimpleLerpFunctor(const SimpleLerpFunctor<value>&);
-public:
-  virtual ~SimpleLerpFunctor();
-  SimpleLerpFunctor<value>& operator=(const SimpleLerpFunctor<value>&);
-  virtual void operator()(PN_stdfloat);
-
-PUBLISHED:
-  value interpolate(PN_stdfloat);
-  INLINE const value &get_start() const { return _start; }
-  INLINE const value &get_end() const { return _end; }
-
-public:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    LerpFunctor::init_type();
-    do_init_type(value);
-    ostringstream os;
-    os << "SimpleLerpFunctor<" << get_type_handle(value).get_name() << ">";
-    register_type(_type_handle, os.str(), LerpFunctor::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-template <class value>
-TypeHandle SimpleLerpFunctor<value>::_type_handle;
-
-template <class value>
-class SimpleQueryLerpFunctor : public SimpleLerpFunctor<value> {
-private:
-  value _save;
-protected:
-  /*
-  SimpleQueryLerpFunctor(const SimpleQueryLerpFucntor<value>& c);
-  */
-public:
-  SimpleQueryLerpFunctor(value start, value end)
-    : SimpleLerpFunctor<value>(start, end) {}
-  virtual ~SimpleQueryLerpFunctor();
-  SimpleQueryLerpFunctor<value>& operator=(const SimpleQueryLerpFunctor<value>&);
-  virtual void operator()(PN_stdfloat);
-PUBLISHED:
-  value get_value();
-
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-public:
-  static void init_type() {
-    SimpleLerpFunctor<value>::init_type();
-    ostringstream os;
-    os << "SimpleQueryLerpFunctor<" << get_type_handle(value).get_name()
-       << ">";
-    register_type(_type_handle, os.str(),
-                  SimpleLerpFunctor<value>::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-template <class value>
-TypeHandle SimpleQueryLerpFunctor<value>::_type_handle;
-
-#include "luse.h"
-
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<int>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<PN_stdfloat>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LPoint2>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LPoint3>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LPoint4>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LVecBase2>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LVecBase3>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LVecBase4>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LVector2>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LVector3>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleLerpFunctor<LVector4>)
-
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<int>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<PN_stdfloat>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LPoint2>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LPoint3>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LPoint4>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LVecBase2>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LVecBase3>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LVecBase4>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LVector2>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LVector3>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_LERP, EXPTP_PANDA_LERP, SimpleQueryLerpFunctor<LVector4>)
-
-typedef SimpleLerpFunctor<int> IntLerpFunctor;
-typedef SimpleLerpFunctor<PN_stdfloat> StdfloatLerpFunctor;
-typedef SimpleLerpFunctor<LPoint2> LPoint2LerpFunctor;
-typedef SimpleLerpFunctor<LPoint3> LPoint3LerpFunctor;
-typedef SimpleLerpFunctor<LPoint4> LPoint4LerpFunctor;
-typedef SimpleLerpFunctor<LVecBase2> LVecBase2LerpFunctor;
-typedef SimpleLerpFunctor<LVecBase3> LVecBase3LerpFunctor;
-typedef SimpleLerpFunctor<LVecBase4> LVecBase4LerpFunctor;
-typedef SimpleLerpFunctor<LVector2> LVector2LerpFunctor;
-typedef SimpleLerpFunctor<LVector3> LVector3LerpFunctor;
-typedef SimpleLerpFunctor<LVector4> LVector4LerpFunctor;
-
-typedef SimpleQueryLerpFunctor<int> IntQueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<PN_stdfloat> StdfloatQueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LPoint2> LPoint2QueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LPoint3> LPoint3QueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LPoint4> LPoint4QueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LVecBase2> LVecBase2QueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LVecBase3> LVecBase3QueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LVecBase4> LVecBase4QueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LVector2> LVector2QueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LVector3> LVector3QueryLerpFunctor;
-typedef SimpleQueryLerpFunctor<LVector4> LVector4QueryLerpFunctor;
-
-#include "pset.h"
-#include "pointerTo.h"
-
-class EXPCL_PANDA_LERP MultiLerpFunctor : public LerpFunctor {
-private:
-  typedef phash_set< PT(LerpFunctor) > Functors;
-  Functors _funcs;
-public:
-  MultiLerpFunctor() {}
-  MultiLerpFunctor(const MultiLerpFunctor&);
-  virtual ~MultiLerpFunctor();
-  MultiLerpFunctor& operator=(const MultiLerpFunctor&);
-  virtual void operator()(PN_stdfloat);
-  void add_functor(LerpFunctor*);
-  void remove_functor(LerpFunctor*);
-
-PUBLISHED:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-
-public:
-  static void init_type() {
-    LerpFunctor::init_type();
-    register_type(_type_handle, "MultiLerpFunctor",
-                  LerpFunctor::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-//
-// template implementation
-//
-
-template <class value>
-SimpleLerpFunctor<value>::SimpleLerpFunctor(const SimpleLerpFunctor<value>& c)
-  : LerpFunctor(c), _start(c._start), _end(c._end), _diff_cache(c._diff_cache)
-  {}
-
-template <class value>
-SimpleLerpFunctor<value>::~SimpleLerpFunctor()
-{
-}
-
-template <class value>
-SimpleLerpFunctor<value>&
-SimpleLerpFunctor<value>::operator=(const SimpleLerpFunctor& c) {
-  _start = c._start;
-  _end = c._end;
-  _diff_cache = c._diff_cache;
-  LerpFunctor::operator=(c);
-  return *this;
-}
-
-template <class value>
-void SimpleLerpFunctor<value>::operator()(PN_stdfloat) {
-  // should not be here
-}
-
-template <class value>
-value SimpleLerpFunctor<value>::interpolate(PN_stdfloat t) {
-  return ((t * _diff_cache) + _start);
-}
-
-/*
-template <class value>
-SimpleQueryLerpFunctor<value>::SimpleQueryLerpFunctor(const SimpleQueryLerpFunctor& c) : SimpleLerpFunctor<value>(c), _save(c._save) {}
-*/
-
-template <class value>
-SimpleQueryLerpFunctor<value>::~SimpleQueryLerpFunctor()
-{
-}
-
-template <class value>
-SimpleQueryLerpFunctor<value>&
-SimpleQueryLerpFunctor<value>::operator=(const SimpleQueryLerpFunctor& c) {
-  _save = c._save;
-  SimpleLerpFunctor<value>::operator=(c);
-  return *this;
-}
-
-template <class value>
-void SimpleQueryLerpFunctor<value>::operator()(PN_stdfloat t) {
-  _save = this->interpolate(t);
-}
-
-template <class value>
-value SimpleQueryLerpFunctor<value>::get_value() {
-  return _save;
-}
-
-#endif /* __LERPFUNCTOR_H__ */

+ 0 - 5
panda/src/lerp/p3lerp_composite1.cxx

@@ -1,5 +0,0 @@
-
-#include "config_lerp.cxx"
-#include "lerp.cxx"
-#include "lerpblend.cxx"
-#include "lerpfunctor.cxx"

+ 12 - 0
panda/src/linmath/aa_luse.h

@@ -120,6 +120,12 @@ typedef LTexCoord3f LTexCoord3;
 typedef LColorf LColor;
 typedef LRGBColorf LRGBColor;
 
+typedef UnalignedLVecBase2f UnalignedLVecBase2;
+typedef UnalignedLVecBase3f UnalignedLVecBase3;
+typedef UnalignedLVecBase4f UnalignedLVecBase4;
+typedef UnalignedLMatrix3f UnalignedLMatrix3;
+typedef UnalignedLMatrix4f UnalignedLMatrix4;
+
 // Bogus typedefs for interrogate and legacy Python code.
 #ifdef CPPPARSER
 typedef LMatrix4f Mat4;
@@ -161,6 +167,12 @@ typedef LTexCoord3d LTexCoord3;
 typedef LColord LColor;
 typedef LRGBColord LRGBColor;
 
+typedef UnalignedLVecBase2d UnalignedLVecBase2;
+typedef UnalignedLVecBase3d UnalignedLVecBase3;
+typedef UnalignedLVecBase4d UnalignedLVecBase4;
+typedef UnalignedLMatrix3d UnalignedLMatrix3;
+typedef UnalignedLMatrix4d UnalignedLMatrix4;
+
 // Bogus typedefs for interrogate and legacy Python code.
 #ifdef CPPPARSER
 typedef LMatrix4d Mat4;

+ 10 - 0
panda/src/linmath/config_linmath.cxx

@@ -71,6 +71,11 @@ init_liblinmath() {
   LPoint4f::init_type();
   LMatrix3f::init_type();
   LMatrix4f::init_type();
+  UnalignedLVecBase2f::init_type();
+  UnalignedLVecBase3f::init_type();
+  UnalignedLVecBase4f::init_type();
+  UnalignedLMatrix3f::init_type();
+  UnalignedLMatrix4f::init_type();
 
   LVecBase2d::init_type();
   LVecBase3d::init_type();
@@ -83,6 +88,11 @@ init_liblinmath() {
   LPoint4d::init_type();
   LMatrix3d::init_type();
   LMatrix4d::init_type();
+  UnalignedLVecBase2d::init_type();
+  UnalignedLVecBase3d::init_type();
+  UnalignedLVecBase4d::init_type();
+  UnalignedLMatrix3d::init_type();
+  UnalignedLMatrix4d::init_type();
 
   LQuaternionf::init_type();
   LRotationf::init_type();

+ 155 - 1
panda/src/linmath/lmatrix3_src.I

@@ -115,6 +115,16 @@ INLINE_LINMATH FLOATNAME(LMatrix3)::
 FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) &copy) : _m(copy._m) {
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LMatrix3::Copy Constructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LMatrix3)::
+FLOATNAME(LMatrix3)(const FLOATNAME(UnalignedLMatrix3) &copy) {
+  operator = (copy);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix3::Copy Assignment Operator
 //       Access: Published
@@ -128,6 +138,19 @@ operator = (const FLOATNAME(LMatrix3) &copy) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LMatrix3::Copy Assignment Operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
+operator = (const FLOATNAME(UnalignedLMatrix3) &copy) {
+  TAU_PROFILE("void LMatrix3::operator = (const UnalignedLMatrix3 &)", " ", TAU_USER);
+
+  memcpy(&_m(0, 0), copy.get_data(), sizeof(FLOATTYPE) * get_num_components());
+  return *this;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix3::Fill Assignment Operator
 //       Access: Published
@@ -1314,7 +1337,7 @@ scale_mat(FLOATTYPE sx, FLOATTYPE sy) {
 //               degrees counterclockwise about the indicated vector.
 ////////////////////////////////////////////////////////////////////
 INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
-rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis,
+rotate_mat(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis,
            CoordinateSystem cs) {
   FLOATNAME(LMatrix3) mat;
   mat.set_rotate_mat(angle, axis, cs);
@@ -1494,3 +1517,134 @@ invert(const FLOATNAME(LMatrix3) &a) {
 #endif
   return result;
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::Default Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)::
+FLOATNAME(UnalignedLMatrix3)() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)::
+FLOATNAME(UnalignedLMatrix3)(const FLOATNAME(LMatrix3) &copy) {
+  operator = (copy);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)::
+FLOATNAME(UnalignedLMatrix3)(const FLOATNAME(UnalignedLMatrix3) &copy) : _m(copy._m) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix3) &FLOATNAME(UnalignedLMatrix3)::
+operator = (const FLOATNAME(LMatrix3) &copy) {
+  memcpy(&_m(0, 0), copy.get_data(), sizeof(FLOATTYPE) * get_num_components());
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix3) &FLOATNAME(UnalignedLMatrix3)::
+operator = (const FLOATNAME(UnalignedLMatrix3) &copy) {
+  TAU_PROFILE("void UnalignedLMatrix3::operator =(UnalignedLMatrix3 &)", " ", TAU_USER);
+  _m = copy._m;
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)::
+FLOATNAME(UnalignedLMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
+                             FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
+                             FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22) {
+  TAU_PROFILE("UnalignedLMatrix3::UnalignedLMatrix3(FLOATTYPE, ...)", " ", TAU_USER);
+  set(e00, e01, e02,
+      e10, e11, e12,
+      e20, e21, e22);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::set
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH void FLOATNAME(UnalignedLMatrix3)::
+set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
+    FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
+    FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22) {
+  TAU_PROFILE("void UnalignedLMatrix3::set()", " ", TAU_USER);
+  _m(0, 0) = e00;
+  _m(0, 1) = e01;
+  _m(0, 2) = e02;
+  _m(1, 0) = e10;
+  _m(1, 1) = e11;
+  _m(1, 2) = e12;
+  _m(2, 0) = e20;
+  _m(2, 1) = e21;
+  _m(2, 2) = e22;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::Indexing operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE &FLOATNAME(UnalignedLMatrix3)::
+operator () (int row, int col) {
+  nassertr(row >= 0 && row < 3 && col >= 0 && col < 3, _m(0, 0));
+  return _m(row, col);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::Indexing operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE FLOATNAME(UnalignedLMatrix3)::
+operator () (int row, int col) const {
+  nassertr(row >= 0 && row < 3 && col >= 0 && col < 3, 0.0);
+  return _m(row, col);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::get_data
+//       Access: Published
+//  Description: Returns the address of the first of the nine data
+//               elements in the matrix.  The remaining elements
+//               occupy the next eight positions in row-major order.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH const FLOATTYPE *FLOATNAME(UnalignedLMatrix3)::
+get_data() const {
+  return &_m(0, 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::get_num_components
+//       Access: Published
+//  Description: Returns the number of elements in the matrix, nine.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH int FLOATNAME(UnalignedLMatrix3)::
+get_num_components() const {
+  return 9;
+}

+ 17 - 1
panda/src/linmath/lmatrix3_src.cxx

@@ -13,6 +13,7 @@
 ////////////////////////////////////////////////////////////////////
 
 TypeHandle FLOATNAME(LMatrix3)::_type_handle;
+TypeHandle FLOATNAME(UnalignedLMatrix3)::_type_handle;
 
 const FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::_ident_mat =
   FLOATNAME(LMatrix3)(1.0f, 0.0f, 0.0f,
@@ -238,7 +239,7 @@ compare_to(const FLOATNAME(LMatrix3) &other, FLOATTYPE threshold) const {
 //               vector.
 ////////////////////////////////////////////////////////////////////
 void FLOATNAME(LMatrix3)::
-set_rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis,
+set_rotate_mat(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis,
                CoordinateSystem cs) {
   TAU_PROFILE("void LMatrix3::set_rotate_mat(FLOATTYPE, LVecBase3, CoordinateSystem)", " ", TAU_USER);
   if (cs == CS_default) {
@@ -514,3 +515,18 @@ init_type() {
     register_type(_type_handle, name);
   }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix3::init_type
+//       Access: Published, Static
+//  Description:
+////////////////////////////////////////////////////////////////////
+void FLOATNAME(UnalignedLMatrix3)::
+init_type() {
+  if (_type_handle == TypeHandle::none()) {
+    // Format a string to describe the type.
+    string name = "UnalignedLMatrix3";
+    name += FLOATTOKEN;
+    register_type(_type_handle, name);
+  }
+}

+ 53 - 2
panda/src/linmath/lmatrix3_src.h

@@ -13,6 +13,7 @@
 ////////////////////////////////////////////////////////////////////
 
 class FLOATNAME(LMatrix4);
+class FLOATNAME(UnalignedLMatrix3);
 
 ////////////////////////////////////////////////////////////////////
 //       Class : LMatrix3
@@ -54,8 +55,11 @@ PUBLISHED:
 
   INLINE_LINMATH FLOATNAME(LMatrix3)();
   INLINE_LINMATH FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) &other);
+  INLINE_LINMATH FLOATNAME(LMatrix3)(const FLOATNAME(UnalignedLMatrix3) &other);
   INLINE_LINMATH FLOATNAME(LMatrix3) &operator = (
       const FLOATNAME(LMatrix3) &other);
+  INLINE_LINMATH FLOATNAME(LMatrix3) &operator = (
+      const FLOATNAME(UnalignedLMatrix3) &other);
   INLINE_LINMATH FLOATNAME(LMatrix3) &operator = (FLOATTYPE fill_value);
   INLINE_LINMATH FLOATNAME(LMatrix3)(
     FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
@@ -220,7 +224,7 @@ PUBLISHED:
   // scale/rotate transforms in 3-d coordinate space.
   void
     set_rotate_mat(FLOATTYPE angle,
-                   FLOATNAME(LVecBase3) axis,
+                   const FLOATNAME(LVecBase3) &axis,
                    CoordinateSystem cs = CS_default);
   void
     set_rotate_mat_normaxis(FLOATTYPE angle,
@@ -229,7 +233,7 @@ PUBLISHED:
 
   static INLINE_LINMATH FLOATNAME(LMatrix3)
     rotate_mat(FLOATTYPE angle,
-               FLOATNAME(LVecBase3) axis,
+               const FLOATNAME(LVecBase3) &axis,
                CoordinateSystem cs = CS_default);
   static INLINE_LINMATH FLOATNAME(LMatrix3)
     rotate_mat_normaxis(FLOATTYPE angle,
@@ -320,6 +324,53 @@ private:
   static TypeHandle _type_handle;
 };
 
+////////////////////////////////////////////////////////////////////
+//       Class : UnalignedLMatrix3
+// Description : This is an "unaligned" LMatrix3.  It has no
+//               functionality other than to store numbers, and it
+//               will pack them in as tightly as possible, avoiding
+//               any SSE2 alignment requirements shared by the primary
+//               LMatrix3 class.
+//
+//               Use it only when you need to pack numbers tightly
+//               without respect to alignment, and then copy it to a
+//               proper LMatrix3 to get actual use from it.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDA_LINMATH FLOATNAME(UnalignedLMatrix3) {
+PUBLISHED:
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)();
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)(const FLOATNAME(LMatrix3) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)(const FLOATNAME(UnalignedLMatrix3) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix3) &operator = (const FLOATNAME(LMatrix3) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix3) &operator = (const FLOATNAME(UnalignedLMatrix3) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
+                                              FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
+                                              FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22);
+
+  INLINE_LINMATH void set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
+                          FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
+                          FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22);
+
+  INLINE_LINMATH FLOATTYPE &operator () (int row, int col);
+  INLINE_LINMATH FLOATTYPE operator () (int row, int col) const;
+
+  INLINE_LINMATH const FLOATTYPE *get_data() const;
+  INLINE_LINMATH int get_num_components() const;
+
+public:
+  typedef SIMPLE_MATRIX(FLOATTYPE, 3, 3) UMatrix3;
+  UMatrix3 _m;
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type();
+
+private:
+  static TypeHandle _type_handle;
+};
+
 
 INLINE ostream &operator << (ostream &out, const FLOATNAME(LMatrix3) &mat) {
   mat.output(out);

+ 168 - 0
panda/src/linmath/lmatrix4_src.I

@@ -135,6 +135,16 @@ INLINE_LINMATH FLOATNAME(LMatrix4)::
 FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix4) &copy) : _m(copy._m) {
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LMatrix4::Copy Constructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LMatrix4)::
+FLOATNAME(LMatrix4)(const FLOATNAME(UnalignedLMatrix4) &copy) {
+  operator = (copy);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix4::Copy Assignment Operator
 //       Access: Public
@@ -147,6 +157,19 @@ operator = (const FLOATNAME(LMatrix4) &copy) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LMatrix4::Copy Assignment Operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LMatrix4) &FLOATNAME(LMatrix4)::
+operator = (const FLOATNAME(UnalignedLMatrix4) &copy) {
+  TAU_PROFILE("void LMatrix4::operator = (const UnalignedLMatrix4 &)", " ", TAU_USER);
+
+  memcpy(&_m(0, 0), copy.get_data(), sizeof(FLOATTYPE) * get_num_components());
+  return *this;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LMatrix4::Fill Assignment Operator
 //       Access: Public
@@ -1713,3 +1736,148 @@ invert(const FLOATNAME(LMatrix4) &a) {
   return result;
 }
 
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::Default Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix4)::
+FLOATNAME(UnalignedLMatrix4)() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix4)::
+FLOATNAME(UnalignedLMatrix4)(const FLOATNAME(LMatrix4) &copy) {
+  operator = (copy);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix4)::
+FLOATNAME(UnalignedLMatrix4)(const FLOATNAME(UnalignedLMatrix4) &copy) : _m(copy._m) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix4) &FLOATNAME(UnalignedLMatrix4)::
+operator = (const FLOATNAME(LMatrix4) &copy) {
+  memcpy(&_m(0, 0), copy.get_data(), sizeof(FLOATTYPE) * get_num_components());
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix4) &FLOATNAME(UnalignedLMatrix4)::
+operator = (const FLOATNAME(UnalignedLMatrix4) &copy) {
+  TAU_PROFILE("void UnalignedLMatrix4::operator =(UnalignedLMatrix4 &)", " ", TAU_USER);
+  _m = copy._m;
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLMatrix4)::
+FLOATNAME(UnalignedLMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
+                             FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13,
+                             FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23,
+                             FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33) {
+  TAU_PROFILE("UnalignedLMatrix4::UnalignedLMatrix4(FLOATTYPE, ...)", " ", TAU_USER);
+  set(e00, e01, e02, e03,
+      e10, e11, e12, e13,
+      e20, e21, e22, e23,
+      e30, e31, e32, e33);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::set
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH void FLOATNAME(UnalignedLMatrix4)::
+set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
+    FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13,
+    FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23,
+    FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33) {
+  TAU_PROFILE("void UnalignedLMatrix4::set()", " ", TAU_USER);
+
+  _m(0, 0) = e00;
+  _m(0, 1) = e01;
+  _m(0, 2) = e02;
+  _m(0, 3) = e03;
+
+  _m(1, 0) = e10;
+  _m(1, 1) = e11;
+  _m(1, 2) = e12;
+  _m(1, 3) = e13;
+
+  _m(2, 0) = e20;
+  _m(2, 1) = e21;
+  _m(2, 2) = e22;
+  _m(2, 3) = e23;
+
+  _m(3, 0) = e30;
+  _m(3, 1) = e31;
+  _m(3, 2) = e32;
+  _m(3, 3) = e33;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::Indexing operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE &FLOATNAME(UnalignedLMatrix4)::
+operator () (int row, int col) {
+  nassertr(row >= 0 && row < 4 && col >= 0 && col < 4, _m(0, 0));
+  return _m(row, col);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::Indexing operator
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE FLOATNAME(UnalignedLMatrix4)::
+operator () (int row, int col) const {
+  nassertr(row >= 0 && row < 4 && col >= 0 && col < 4, 0.0);
+  return _m(row, col);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::get_data
+//       Access: Published
+//  Description: Returns the address of the first of the nine data
+//               elements in the matrix.  The remaining elements
+//               occupy the next eight positions in row-major order.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH const FLOATTYPE *FLOATNAME(UnalignedLMatrix4)::
+get_data() const {
+  return &_m(0, 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::get_num_components
+//       Access: Published
+//  Description: Returns the number of elements in the matrix, sixteen.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH int FLOATNAME(UnalignedLMatrix4)::
+get_num_components() const {
+  return 16;
+}

+ 16 - 0
panda/src/linmath/lmatrix4_src.cxx

@@ -13,6 +13,7 @@
 ////////////////////////////////////////////////////////////////////
 
 TypeHandle FLOATNAME(LMatrix4)::_type_handle;
+TypeHandle FLOATNAME(UnalignedLMatrix4)::_type_handle;
 
 const FLOATNAME(LMatrix4) FLOATNAME(LMatrix4)::_ident_mat =
   FLOATNAME(LMatrix4)(1.0f, 0.0f, 0.0f, 0.0f,
@@ -592,3 +593,18 @@ init_type() {
     register_type(_type_handle, name);
   }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLMatrix4::init_type
+//       Access: Published, Static
+//  Description:
+////////////////////////////////////////////////////////////////////
+void FLOATNAME(UnalignedLMatrix4)::
+init_type() {
+  if (_type_handle == TypeHandle::none()) {
+    // Format a string to describe the type.
+    string name = "UnalignedLMatrix4";
+    name += FLOATTOKEN;
+    register_type(_type_handle, name);
+  }
+}

+ 55 - 1
panda/src/linmath/lmatrix4_src.h

@@ -12,6 +12,7 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+class FLOATNAME(UnalignedLMatrix4);
 
 ////////////////////////////////////////////////////////////////////
 //       Class : LMatrix4
@@ -49,7 +50,11 @@ PUBLISHED:
 
   INLINE_LINMATH FLOATNAME(LMatrix4)();
   INLINE_LINMATH FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix4) &other);
-  INLINE_LINMATH FLOATNAME(LMatrix4) &operator = (const FLOATNAME(LMatrix4) &other);
+  INLINE_LINMATH FLOATNAME(LMatrix4)(const FLOATNAME(UnalignedLMatrix4) &other);
+  INLINE_LINMATH FLOATNAME(LMatrix4) &operator = (
+      const FLOATNAME(LMatrix4) &other);
+  INLINE_LINMATH FLOATNAME(LMatrix4) &operator = (
+      const FLOATNAME(UnalignedLMatrix4) &other);
   INLINE_LINMATH FLOATNAME(LMatrix4) &operator = (FLOATTYPE fill_value);
 
   INLINE_LINMATH FLOATNAME(LMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
@@ -287,6 +292,55 @@ private:
   static TypeHandle _type_handle;
 };
 
+////////////////////////////////////////////////////////////////////
+//       Class : UnalignedLMatrix4
+// Description : This is an "unaligned" LMatrix4.  It has no
+//               functionality other than to store numbers, and it
+//               will pack them in as tightly as possible, avoiding
+//               any SSE2 alignment requirements shared by the primary
+//               LMatrix4 class.
+//
+//               Use it only when you need to pack numbers tightly
+//               without respect to alignment, and then copy it to a
+//               proper LMatrix4 to get actual use from it.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDA_LINMATH FLOATNAME(UnalignedLMatrix4) {
+PUBLISHED:
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix4)();
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix4)(const FLOATNAME(LMatrix4) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix4)(const FLOATNAME(UnalignedLMatrix4) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix4) &operator = (const FLOATNAME(LMatrix4) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix4) &operator = (const FLOATNAME(UnalignedLMatrix4) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
+                                              FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13,
+                                              FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23,
+                                              FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33);
+
+  INLINE_LINMATH void set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
+                          FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13,
+                          FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23,
+                          FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33);
+
+  INLINE_LINMATH FLOATTYPE &operator () (int row, int col);
+  INLINE_LINMATH FLOATTYPE operator () (int row, int col) const;
+
+  INLINE_LINMATH const FLOATTYPE *get_data() const;
+  INLINE_LINMATH int get_num_components() const;
+
+public:
+  typedef SIMPLE_MATRIX(FLOATTYPE, 4, 4) UMatrix4;
+  UMatrix4 _m;
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type();
+
+private:
+  static TypeHandle _type_handle;
+};
+
 
 INLINE ostream &operator << (ostream &out, const FLOATNAME(LMatrix4) &mat) {
   mat.output(out);

+ 2 - 0
panda/src/linmath/lsimpleMatrix.h

@@ -57,6 +57,8 @@ private:
 #define LINMATH_MATRIX(FloatType, NumRows, NumCols) LSimpleMatrix<FloatType, NumRows, NumCols>
 #endif  // HAVE_EIGEN
 
+#define SIMPLE_MATRIX(FloatType, NumRows, NumCols) LSimpleMatrix<FloatType, NumRows, NumCols>
+
 // This is as good a place as any to define this alignment macro.
 #ifdef LINMATH_ALIGN
 #define ALIGN_LINMATH ALIGN_16BYTE

+ 11 - 0
panda/src/linmath/lvecBase2_ext_src.I

@@ -187,3 +187,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
 
   return 0;
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::__setitem__
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void EXT_METHOD_ARGS(FLOATNAME(UnalignedLVecBase2),
+__setitem__, int i, FLOATTYPE v) {
+  nassertv(i >= 0 && i < 2);
+  this->_v(i) = v;
+}

+ 149 - 0
panda/src/linmath/lvecBase2_src.I

@@ -31,6 +31,16 @@ INLINE_LINMATH FLOATNAME(LVecBase2)::
 FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) &copy) : _v(copy._v) {
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LVecBase2::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LVecBase2)::
+FLOATNAME(LVecBase2)(const FLOATNAME(UnalignedLVecBase2) &copy) {
+  set(copy[0], copy[1]);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LVecBase2::Copy Assignment Operator
 //       Access: Published
@@ -43,6 +53,17 @@ operator = (const FLOATNAME(LVecBase2) &copy) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LVecBase2::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
+operator = (const FLOATNAME(UnalignedLVecBase2) &copy) {
+  set(copy[0], copy[1]);
+  return *this;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LVecBase2::Fill Assignment Operator
 //       Access: Published
@@ -816,3 +837,131 @@ read_datagram(DatagramIterator &source) {
   _v(0) = source.get_stdfloat();
   _v(1) = source.get_stdfloat();
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::Default Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)::
+FLOATNAME(UnalignedLVecBase2)() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)::
+FLOATNAME(UnalignedLVecBase2)(const FLOATNAME(LVecBase2) &copy) {
+  set(copy[0], copy[1]);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)::
+FLOATNAME(UnalignedLVecBase2)(const FLOATNAME(UnalignedLVecBase2) &copy) : _v(copy._v) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase2) &FLOATNAME(UnalignedLVecBase2)::
+operator = (const FLOATNAME(LVecBase2) &copy) {
+  set(copy[0], copy[1]);
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase2) &FLOATNAME(UnalignedLVecBase2)::
+operator = (const FLOATNAME(UnalignedLVecBase2) &copy) {
+  TAU_PROFILE("void UnalignedLVecBase2::operator =(UnalignedLVecBase2 &)", " ", TAU_USER);
+  _v = copy._v;
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)::
+FLOATNAME(UnalignedLVecBase2)(FLOATTYPE x, FLOATTYPE y) {
+  TAU_PROFILE("UnalignedLVecBase2::UnalignedLVecBase2(FLOATTYPE, ...)", " ", TAU_USER);
+  set(x, y);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::set
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH void FLOATNAME(UnalignedLVecBase2)::
+set(FLOATTYPE x, FLOATTYPE y) {
+  TAU_PROFILE("void UnalignedLVecBase2::set()", " ", TAU_USER);
+  _v(0) = x;
+  _v(1) = y;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::Indexing Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE FLOATNAME(UnalignedLVecBase2)::
+operator [](int i) const {
+  nassertr(i >= 0 && i < 2, 0.0);
+  return _v(i);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::Indexing Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE &FLOATNAME(UnalignedLVecBase2)::
+operator [](int i) {
+  nassertr(i >= 0 && i < 2, _v(0));
+  return _v(i);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::size
+//       Access: Public, Static
+//  Description: Returns 2: the number of components of a LVecBase2.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH int FLOATNAME(UnalignedLVecBase2)::
+size() {
+  return 2;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::get_data
+//       Access: Public
+//  Description: Returns the address of the first of the three data
+//               elements in the vector.  The remaining elements
+//               occupy the next positions consecutively in memory.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH const FLOATTYPE *FLOATNAME(UnalignedLVecBase2)::
+get_data() const {
+  return &_v(0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::get_num_components
+//       Access: Public
+//  Description: Returns the number of elements in the vector, 2.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH int FLOATNAME(UnalignedLVecBase2)::
+get_num_components() const {
+  return 2;
+}

+ 16 - 0
panda/src/linmath/lvecBase2_src.cxx

@@ -13,6 +13,7 @@
 ////////////////////////////////////////////////////////////////////
 
 TypeHandle FLOATNAME(LVecBase2)::_type_handle;
+TypeHandle FLOATNAME(UnalignedLVecBase2)::_type_handle;
 
 const FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::_zero =
   FLOATNAME(LVecBase2)(0.0f, 0.0f);
@@ -36,3 +37,18 @@ init_type() {
   }
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase2::init_type
+//       Access: Public, Static
+//  Description:
+////////////////////////////////////////////////////////////////////
+void FLOATNAME(UnalignedLVecBase2)::
+init_type() {
+  if (_type_handle == TypeHandle::none()) {
+    // Format a string to describe the type.
+    string name = "UnalignedLVecBase2";
+    name += FLOATTOKEN;
+    register_type(_type_handle, name);
+  }
+}
+

+ 50 - 0
panda/src/linmath/lvecBase2_src.h

@@ -13,6 +13,8 @@
 ////////////////////////////////////////////////////////////////////
 
 
+class FLOATNAME(UnalignedLVecBase2);
+
 ////////////////////////////////////////////////////////////////////
 //       Class : LVecBase2
 // Description : This is the base class for all two-component
@@ -25,7 +27,9 @@ PUBLISHED:
 
   INLINE_LINMATH FLOATNAME(LVecBase2)();
   INLINE_LINMATH FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) &copy);
+  INLINE_LINMATH FLOATNAME(LVecBase2)(const FLOATNAME(UnalignedLVecBase2) &copy);
   INLINE_LINMATH FLOATNAME(LVecBase2) &operator = (const FLOATNAME(LVecBase2) &copy);
+  INLINE_LINMATH FLOATNAME(LVecBase2) &operator = (const FLOATNAME(UnalignedLVecBase2) &copy);
   INLINE_LINMATH FLOATNAME(LVecBase2) &operator = (FLOATTYPE fill_value);
   INLINE_LINMATH FLOATNAME(LVecBase2)(FLOATTYPE fill_value);
   INLINE_LINMATH FLOATNAME(LVecBase2)(FLOATTYPE x, FLOATTYPE y);
@@ -154,6 +158,52 @@ private:
   static TypeHandle _type_handle;
 };
 
+////////////////////////////////////////////////////////////////////
+//       Class : UnalignedLVecBase2
+// Description : This is an "unaligned" LVecBase2.  It has no
+//               functionality other than to store numbers, and it
+//               will pack them in as tightly as possible, avoiding
+//               any SSE2 alignment requirements shared by the primary
+//               LVecBase2 class.
+//
+//               Use it only when you need to pack numbers tightly
+//               without respect to alignment, and then copy it to a
+//               proper LVecBase2 to get actual use from it.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDA_LINMATH FLOATNAME(UnalignedLVecBase2) {
+PUBLISHED:
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)();
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)(const FLOATNAME(LVecBase2) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)(const FLOATNAME(UnalignedLVecBase2) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase2) &operator = (const FLOATNAME(LVecBase2) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase2) &operator = (const FLOATNAME(UnalignedLVecBase2) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)(FLOATTYPE x, FLOATTYPE y);
+
+  INLINE_LINMATH void set(FLOATTYPE x, FLOATTYPE y);
+
+  INLINE_LINMATH FLOATTYPE operator [](int i) const;
+  INLINE_LINMATH FLOATTYPE &operator [](int i);
+
+  EXTENSION(INLINE_LINMATH void __setitem__(int i, FLOATTYPE v));
+  INLINE_LINMATH static int size();
+
+  INLINE_LINMATH const FLOATTYPE *get_data() const;
+  INLINE_LINMATH int get_num_components() const;
+
+public:
+  typedef SIMPLE_MATRIX(FLOATTYPE, 1, 2) UVector2;
+  UVector2 _v;
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type();
+
+private:
+  static TypeHandle _type_handle;
+};
+
 
 INLINE ostream &operator << (ostream &out, const FLOATNAME(LVecBase2) &vec) {
   vec.output(out);

+ 11 - 0
panda/src/linmath/lvecBase3_ext_src.I

@@ -189,3 +189,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
   return 0;
 }
 
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::__setitem__
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void EXT_METHOD_ARGS(FLOATNAME(UnalignedLVecBase3),
+__setitem__, int i, FLOATTYPE v) {
+  nassertv(i >= 0 && i < 3);
+  this->_v(i) = v;
+}

+ 150 - 0
panda/src/linmath/lvecBase3_src.I

@@ -30,6 +30,16 @@ INLINE_LINMATH FLOATNAME(LVecBase3)::
 FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) &copy) : _v(copy._v) {
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LVecBase3::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LVecBase3)::
+FLOATNAME(LVecBase3)(const FLOATNAME(UnalignedLVecBase3) &copy) {
+  set(copy[0], copy[1], copy[2]);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LVecBase3::Copy Assignment Operator
 //       Access: Public
@@ -42,6 +52,17 @@ operator = (const FLOATNAME(LVecBase3) &copy) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LVecBase3::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
+operator = (const FLOATNAME(UnalignedLVecBase3) &copy) {
+  set(copy[0], copy[1], copy[2]);
+  return *this;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LVecBase3::Fill Assignment Operator
 //       Access: Public
@@ -995,3 +1016,132 @@ read_datagram(DatagramIterator &source) {
   _v(1) = source.get_stdfloat();
   _v(2) = source.get_stdfloat();
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::Default Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)::
+FLOATNAME(UnalignedLVecBase3)() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)::
+FLOATNAME(UnalignedLVecBase3)(const FLOATNAME(LVecBase3) &copy) {
+  set(copy[0], copy[1], copy[2]);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)::
+FLOATNAME(UnalignedLVecBase3)(const FLOATNAME(UnalignedLVecBase3) &copy) : _v(copy._v) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase3) &FLOATNAME(UnalignedLVecBase3)::
+operator = (const FLOATNAME(LVecBase3) &copy) {
+  set(copy[0], copy[1], copy[2]);
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase3) &FLOATNAME(UnalignedLVecBase3)::
+operator = (const FLOATNAME(UnalignedLVecBase3) &copy) {
+  TAU_PROFILE("void UnalignedLVecBase3::operator =(UnalignedLVecBase3 &)", " ", TAU_USER);
+  _v = copy._v;
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)::
+FLOATNAME(UnalignedLVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
+  TAU_PROFILE("UnalignedLVecBase3::UnalignedLVecBase3(FLOATTYPE, ...)", " ", TAU_USER);
+  set(x, y, z);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::set
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH void FLOATNAME(UnalignedLVecBase3)::
+set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
+  TAU_PROFILE("void UnalignedLVecBase3::set()", " ", TAU_USER);
+  _v(0) = x;
+  _v(1) = y;
+  _v(2) = z;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::Indexing Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE FLOATNAME(UnalignedLVecBase3)::
+operator [](int i) const {
+  nassertr(i >= 0 && i < 3, 0.0);
+  return _v(i);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::Indexing Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE &FLOATNAME(UnalignedLVecBase3)::
+operator [](int i) {
+  nassertr(i >= 0 && i < 3, _v(0));
+  return _v(i);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::size
+//       Access: Public, Static
+//  Description: Returns 3: the number of components of a LVecBase3.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH int FLOATNAME(UnalignedLVecBase3)::
+size() {
+  return 3;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::get_data
+//       Access: Public
+//  Description: Returns the address of the first of the three data
+//               elements in the vector.  The remaining elements
+//               occupy the next positions consecutively in memory.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH const FLOATTYPE *FLOATNAME(UnalignedLVecBase3)::
+get_data() const {
+  return &_v(0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::get_num_components
+//       Access: Public
+//  Description: Returns the number of elements in the vector, 3.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH int FLOATNAME(UnalignedLVecBase3)::
+get_num_components() const {
+  return 3;
+}

+ 17 - 0
panda/src/linmath/lvecBase3_src.cxx

@@ -14,6 +14,7 @@
 
 
 TypeHandle FLOATNAME(LVecBase3)::_type_handle;
+TypeHandle FLOATNAME(UnalignedLVecBase3)::_type_handle;
 
 const FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::_zero =
   FLOATNAME(LVecBase3)(0.0f, 0.0f, 0.0f);
@@ -39,3 +40,19 @@ init_type() {
   }
 }
 
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase3::init_type
+//       Access: Public, Static
+//  Description:
+////////////////////////////////////////////////////////////////////
+void FLOATNAME(UnalignedLVecBase3)::
+init_type() {
+  if (_type_handle == TypeHandle::none()) {
+    // Format a string to describe the type.
+    string name = "UnalignedLVecBase3";
+    name += FLOATTOKEN;
+    register_type(_type_handle, name);
+  }
+}
+

+ 52 - 0
panda/src/linmath/lvecBase3_src.h

@@ -12,6 +12,9 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+
+class FLOATNAME(UnalignedLVecBase3);
+
 ////////////////////////////////////////////////////////////////////
 //       Class : LVecBase3
 // Description : This is the base class for all three-component
@@ -24,7 +27,9 @@ PUBLISHED:
 
   INLINE_LINMATH FLOATNAME(LVecBase3)();
   INLINE_LINMATH FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) &copy);
+  INLINE_LINMATH FLOATNAME(LVecBase3)(const FLOATNAME(UnalignedLVecBase3) &copy);
   INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (const FLOATNAME(LVecBase3) &copy);
+  INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (const FLOATNAME(UnalignedLVecBase3) &copy);
   INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (FLOATTYPE fill_value);
   INLINE_LINMATH FLOATNAME(LVecBase3)(FLOATTYPE fill_value);
   INLINE_LINMATH FLOATNAME(LVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
@@ -168,6 +173,53 @@ private:
 };
 
 
+////////////////////////////////////////////////////////////////////
+//       Class : UnalignedLVecBase3
+// Description : This is an "unaligned" LVecBase3.  It has no
+//               functionality other than to store numbers, and it
+//               will pack them in as tightly as possible, avoiding
+//               any SSE2 alignment requirements shared by the primary
+//               LVecBase3 class.
+//
+//               Use it only when you need to pack numbers tightly
+//               without respect to alignment, and then copy it to a
+//               proper LVecBase3 to get actual use from it.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDA_LINMATH FLOATNAME(UnalignedLVecBase3) {
+PUBLISHED:
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)();
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)(const FLOATNAME(LVecBase3) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)(const FLOATNAME(UnalignedLVecBase3) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase3) &operator = (const FLOATNAME(LVecBase3) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase3) &operator = (const FLOATNAME(UnalignedLVecBase3) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
+
+  INLINE_LINMATH void set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
+
+  INLINE_LINMATH FLOATTYPE operator [](int i) const;
+  INLINE_LINMATH FLOATTYPE &operator [](int i);
+
+  EXTENSION(INLINE_LINMATH void __setitem__(int i, FLOATTYPE v));
+  INLINE_LINMATH static int size();
+
+  INLINE_LINMATH const FLOATTYPE *get_data() const;
+  INLINE_LINMATH int get_num_components() const;
+
+public:
+  typedef SIMPLE_MATRIX(FLOATTYPE, 1, 3) UVector3;
+  UVector3 _v;
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type();
+
+private:
+  static TypeHandle _type_handle;
+};
+
+
 INLINE ostream &operator << (ostream &out, const FLOATNAME(LVecBase3) &vec) {
   vec.output(out);
   return out;

+ 11 - 0
panda/src/linmath/lvecBase4_ext_src.I

@@ -194,3 +194,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) {
   return 0;
 }
 
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::__setitem__
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE void EXT_METHOD_ARGS(FLOATNAME(UnalignedLVecBase4),
+__setitem__, int i, FLOATTYPE v) {
+  nassertv(i >= 0 && i < 4);
+  this->_v(i) = v;
+}

+ 151 - 0
panda/src/linmath/lvecBase4_src.I

@@ -31,6 +31,16 @@ INLINE_LINMATH FLOATNAME(LVecBase4)::
 FLOATNAME(LVecBase4)(const FLOATNAME(LVecBase4) &copy) : _v(copy._v) {
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LVecBase4::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LVecBase4)::
+FLOATNAME(LVecBase4)(const FLOATNAME(UnalignedLVecBase4) &copy) {
+  set(copy[0], copy[1], copy[2], copy[3]);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LVecBase4::Copy Assignment Operator
 //       Access: Published
@@ -43,6 +53,17 @@ operator = (const FLOATNAME(LVecBase4) &copy) {
   return *this;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: LVecBase4::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
+operator = (const FLOATNAME(UnalignedLVecBase4) &copy) {
+  set(copy[0], copy[1], copy[2], copy[3]);
+  return *this;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: LVecBase4::Fill Assignment Operator
 //       Access: Published
@@ -950,3 +971,133 @@ read_datagram(DatagramIterator &source) {
   _v(2) = source.get_stdfloat();
   _v(3) = source.get_stdfloat();
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::Default Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase4)::
+FLOATNAME(UnalignedLVecBase4)() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase4)::
+FLOATNAME(UnalignedLVecBase4)(const FLOATNAME(LVecBase4) &copy) {
+  set(copy[0], copy[1], copy[2], copy[3]);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::Copy Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase4)::
+FLOATNAME(UnalignedLVecBase4)(const FLOATNAME(UnalignedLVecBase4) &copy) : _v(copy._v) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase4) &FLOATNAME(UnalignedLVecBase4)::
+operator = (const FLOATNAME(LVecBase4) &copy) {
+  set(copy[0], copy[1], copy[2], copy[3]);
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::Copy Assignment Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase4) &FLOATNAME(UnalignedLVecBase4)::
+operator = (const FLOATNAME(UnalignedLVecBase4) &copy) {
+  TAU_PROFILE("void UnalignedLVecBase4::operator =(UnalignedLVecBase4 &)", " ", TAU_USER);
+  _v = copy._v;
+  return *this;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(UnalignedLVecBase4)::
+FLOATNAME(UnalignedLVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) {
+  TAU_PROFILE("UnalignedLVecBase4::UnalignedLVecBase4(FLOATTYPE, ...)", " ", TAU_USER);
+  set(x, y, z, w);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::set
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH void FLOATNAME(UnalignedLVecBase4)::
+set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) {
+  TAU_PROFILE("void UnalignedLVecBase4::set()", " ", TAU_USER);
+  _v(0) = x;
+  _v(1) = y;
+  _v(2) = z;
+  _v(3) = w;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::Indexing Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE FLOATNAME(UnalignedLVecBase4)::
+operator [](int i) const {
+  nassertr(i >= 0 && i < 4, 0.0);
+  return _v(i);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::Indexing Operator
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATTYPE &FLOATNAME(UnalignedLVecBase4)::
+operator [](int i) {
+  nassertr(i >= 0 && i < 4, _v(0));
+  return _v(i);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::size
+//       Access: Public, Static
+//  Description: Returns 4: the number of components of a LVecBase4.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH int FLOATNAME(UnalignedLVecBase4)::
+size() {
+  return 4;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::get_data
+//       Access: Public
+//  Description: Returns the address of the first of the three data
+//               elements in the vector.  The remaining elements
+//               occupy the next positions consecutively in memory.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH const FLOATTYPE *FLOATNAME(UnalignedLVecBase4)::
+get_data() const {
+  return &_v(0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::get_num_components
+//       Access: Public
+//  Description: Returns the number of elements in the vector, 4.
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH int FLOATNAME(UnalignedLVecBase4)::
+get_num_components() const {
+  return 4;
+}

+ 17 - 0
panda/src/linmath/lvecBase4_src.cxx

@@ -13,6 +13,7 @@
 ////////////////////////////////////////////////////////////////////
 
 TypeHandle FLOATNAME(LVecBase4)::_type_handle;
+TypeHandle FLOATNAME(UnalignedLVecBase4)::_type_handle;
 
 const FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::_zero =
   FLOATNAME(LVecBase4)(0.0f, 0.0f, 0.0f, 0.0f);
@@ -40,3 +41,19 @@ init_type() {
   }
 }
 
+
+////////////////////////////////////////////////////////////////////
+//     Function: UnalignedLVecBase4::init_type
+//       Access: Public, Static
+//  Description:
+////////////////////////////////////////////////////////////////////
+void FLOATNAME(UnalignedLVecBase4)::
+init_type() {
+  if (_type_handle == TypeHandle::none()) {
+    // Format a string to describe the type.
+    string name = "UnalignedLVecBase4";
+    name += FLOATTOKEN;
+    register_type(_type_handle, name);
+  }
+}
+

+ 49 - 0
panda/src/linmath/lvecBase4_src.h

@@ -14,6 +14,7 @@
 
 class FLOATNAME(LVecBase2);
 class FLOATNAME(LVecBase3);
+class FLOATNAME(UnalignedLVecBase4);
 
 ////////////////////////////////////////////////////////////////////
 //       Class : LVecBase4
@@ -27,7 +28,9 @@ PUBLISHED:
 
   INLINE_LINMATH FLOATNAME(LVecBase4)();
   INLINE_LINMATH FLOATNAME(LVecBase4)(const FLOATNAME(LVecBase4) &copy);
+  INLINE_LINMATH FLOATNAME(LVecBase4)(const FLOATNAME(UnalignedLVecBase4) &copy);
   INLINE_LINMATH FLOATNAME(LVecBase4) &operator = (const FLOATNAME(LVecBase4) &copy);
+  INLINE_LINMATH FLOATNAME(LVecBase4) &operator = (const FLOATNAME(UnalignedLVecBase4) &copy);
   INLINE_LINMATH FLOATNAME(LVecBase4) &operator = (FLOATTYPE fill_value);
   INLINE_LINMATH FLOATNAME(LVecBase4)(FLOATTYPE fill_value);
   INLINE_LINMATH FLOATNAME(LVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
@@ -166,6 +169,52 @@ private:
   static TypeHandle _type_handle;
 };
 
+////////////////////////////////////////////////////////////////////
+//       Class : UnalignedLVecBase4
+// Description : This is an "unaligned" LVecBase4.  It has no
+//               functionality other than to store numbers, and it
+//               will pack them in as tightly as possible, avoiding
+//               any SSE2 alignment requirements shared by the primary
+//               LVecBase4 class.
+//
+//               Use it only when you need to pack numbers tightly
+//               without respect to alignment, and then copy it to a
+//               proper LVecBase4 to get actual use from it.
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDA_LINMATH FLOATNAME(UnalignedLVecBase4) {
+PUBLISHED:
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase4)();
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase4)(const FLOATNAME(LVecBase4) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase4)(const FLOATNAME(UnalignedLVecBase4) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase4) &operator = (const FLOATNAME(LVecBase4) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase4) &operator = (const FLOATNAME(UnalignedLVecBase4) &copy);
+  INLINE_LINMATH FLOATNAME(UnalignedLVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
+
+  INLINE_LINMATH void set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
+
+  INLINE_LINMATH FLOATTYPE operator [](int i) const;
+  INLINE_LINMATH FLOATTYPE &operator [](int i);
+
+  EXTENSION(INLINE_LINMATH void __setitem__(int i, FLOATTYPE v));
+  INLINE_LINMATH static int size();
+
+  INLINE_LINMATH const FLOATTYPE *get_data() const;
+  INLINE_LINMATH int get_num_components() const;
+
+public:
+  typedef SIMPLE_MATRIX(FLOATTYPE, 1, 4) UVector4;
+  UVector4 _v;
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type();
+
+private:
+  static TypeHandle _type_handle;
+};
+
 INLINE ostream &operator << (ostream &out, const FLOATNAME(LVecBase4) &vec) {
   vec.output(out);
   return out;

+ 5 - 5
panda/src/mathutil/boundingBox.cxx

@@ -284,16 +284,16 @@ extend_by_finite(const FiniteBoundingVolume *volume) {
 //  Description: 
 ////////////////////////////////////////////////////////////////////
 bool BoundingBox::
-around_points(const LPoint3 *first, const LPoint3 *last) {
+around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) {
   nassertr(first != last, false);
 
   // Get the minmax of all the points to construct a bounding box.
-  const LPoint3 *p = first;
+  const UnalignedLVecBase3 *p = first;
 
 #ifndef NDEBUG
   // Skip any NaN points.
   int skipped_nan = 0;
-  while (p != last && (*p).is_nan()) {
+  while (p != last && LPoint3(*p).is_nan()) {
     ++p;
     ++skipped_nan;
   }
@@ -310,7 +310,7 @@ around_points(const LPoint3 *first, const LPoint3 *last) {
 
 #ifndef NDEBUG
   // Skip more NaN points.
-  while (p != last && (*p).is_nan()) {
+  while (p != last && LPoint3(*p).is_nan()) {
     ++p;
     ++skipped_nan;
   }
@@ -319,7 +319,7 @@ around_points(const LPoint3 *first, const LPoint3 *last) {
   while (p != last) {
 #ifndef NDEBUG
     // Skip more NaN points.
-    if ((*p).is_nan()) {
+    if (LPoint3(*p).is_nan()) {
       ++skipped_nan;
     } else
 #endif

+ 2 - 2
panda/src/mathutil/boundingBox.h

@@ -76,8 +76,8 @@ protected:
   virtual bool extend_by_hexahedron(const BoundingHexahedron *hexahedron);
   bool extend_by_finite(const FiniteBoundingVolume *volume);
 
-  virtual bool around_points(const LPoint3 *first,
-                             const LPoint3 *last);
+  virtual bool around_points(const UnalignedLVecBase3 *first,
+                             const UnalignedLVecBase3 *last);
   virtual bool around_spheres(const BoundingVolume **first,
                               const BoundingVolume **last);
   virtual bool around_boxes(const BoundingVolume **first,

+ 8 - 8
panda/src/mathutil/boundingSphere.cxx

@@ -297,17 +297,17 @@ extend_by_finite(const FiniteBoundingVolume *volume) {
 //  Description: 
 ////////////////////////////////////////////////////////////////////
 bool BoundingSphere::
-around_points(const LPoint3 *first, const LPoint3 *last) {
+around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) {
   nassertr(first != last, false);
 
   // First, get the box of all the points to construct a bounding
   // box.
-  const LPoint3 *p = first;
+  const UnalignedLVecBase3 *p = first;
 
 #ifndef NDEBUG
   // Skip any NaN points.
   int skipped_nan = 0;
-  while (p != last && (*p).is_nan()) {
+  while (p != last && LPoint3(*p).is_nan()) {
     ++p;
     ++skipped_nan;
   }
@@ -318,13 +318,13 @@ around_points(const LPoint3 *first, const LPoint3 *last) {
   }
 #endif
 
-  LPoint3 min_box = *p;
-  LPoint3 max_box = *p;
+  LPoint3 min_box(*p);
+  LPoint3 max_box(*p);
   ++p;
 
 #ifndef NDEBUG
   // Skip more NaN points.
-  while (p != last && (*p).is_nan()) {
+  while (p != last && LPoint3(*p).is_nan()) {
     ++p;
     ++skipped_nan;
   }
@@ -342,7 +342,7 @@ around_points(const LPoint3 *first, const LPoint3 *last) {
     while (p != last) {
 #ifndef NDEBUG
       // Skip more NaN points.
-      if ((*p).is_nan()) {
+      if (LPoint3(*p).is_nan()) {
         ++skipped_nan;
       } else
 #endif
@@ -363,7 +363,7 @@ around_points(const LPoint3 *first, const LPoint3 *last) {
     // Now walk back through to get the max distance from center.
     PN_stdfloat max_dist2 = 0.0f;
     for (p = first; p != last; ++p) {
-      LVector3 v = (*p) - _center;
+      LVector3 v = LPoint3(*p) - _center;
       PN_stdfloat dist2 = dot(v, v);
       max_dist2 = max(max_dist2, dist2);
     }

+ 2 - 2
panda/src/mathutil/boundingSphere.h

@@ -64,8 +64,8 @@ protected:
   virtual bool extend_by_hexahedron(const BoundingHexahedron *hexahedron);
   bool extend_by_finite(const FiniteBoundingVolume *volume);
 
-  virtual bool around_points(const LPoint3 *first,
-                             const LPoint3 *last);
+  virtual bool around_points(const UnalignedLVecBase3 *first,
+                             const UnalignedLVecBase3 *last);
   virtual bool around_spheres(const BoundingVolume **first,
                               const BoundingVolume **last);
   virtual bool around_boxes(const BoundingVolume **first,

+ 20 - 20
panda/src/mathutil/config_mathutil.N

@@ -2,52 +2,52 @@ noinclude frustum_src.h
 noinclude look_at_src.h
 noinclude plane_src.h
 
-forcetype PointerToBase<ReferenceCountedVector<LMatrix4f> >
-forcetype PointerToArrayBase<LMatrix4f>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLMatrix4f> >
+forcetype PointerToArrayBase<UnalignedLMatrix4f>
 forcetype PTA_LMatrix4f
 forcetype CPTA_LMatrix4f
 
-forcetype PointerToBase<ReferenceCountedVector<LMatrix3f> >
-forcetype PointerToArrayBase<LMatrix3f>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLMatrix3f> >
+forcetype PointerToArrayBase<UnalignedLMatrix3f>
 forcetype PTA_LMatrix3f
 forcetype CPTA_LMatrix3f
 
-forcetype PointerToBase<ReferenceCountedVector<LVecBase4f> >
-forcetype PointerToArrayBase<LVecBase4f>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLVecBase4f> >
+forcetype PointerToArrayBase<UnalignedLVecBase4f>
 forcetype PTA_LVecBase4f
 forcetype CPTA_LVecBase4f
 
-forcetype PointerToBase<ReferenceCountedVector<LVecBase3f> >
-forcetype PointerToArrayBase<LVecBase3f>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLVecBase3f> >
+forcetype PointerToArrayBase<UnalignedLVecBase3f>
 forcetype PTA_LVecBase3f
 forcetype CPTA_LVecBase3f
 
-forcetype PointerToBase<ReferenceCountedVector<LVecBase2f> >
-forcetype PointerToArrayBase<LVecBase2f>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLVecBase2f> >
+forcetype PointerToArrayBase<UnalignedLVecBase2f>
 forcetype PTA_LVecBase2f
 forcetype CPTA_LVecBase2f
 
-forcetype PointerToBase<ReferenceCountedVector<LMatrix4d> >
-forcetype PointerToArrayBase<LMatrix4d>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLMatrix4d> >
+forcetype PointerToArrayBase<UnalignedLMatrix4d>
 forcetype PTA_LMatrix4d
 forcetype CPTA_LMatrix4d
 
-forcetype PointerToBase<ReferenceCountedVector<LMatrix3d> >
-forcetype PointerToArrayBase<LMatrix3d>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLMatrix3d> >
+forcetype PointerToArrayBase<UnalignedLMatrix3d>
 forcetype PTA_LMatrix3d
 forcetype CPTA_LMatrix3d
 
-forcetype PointerToBase<ReferenceCountedVector<LVecBase4d> >
-forcetype PointerToArrayBase<LVecBase4d>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLVecBase4d> >
+forcetype PointerToArrayBase<UnalignedLVecBase4d>
 forcetype PTA_LVecBase4d
 forcetype CPTA_LVecBase4d
 
-forcetype PointerToBase<ReferenceCountedVector<LVecBase3d> >
-forcetype PointerToArrayBase<LVecBase3d>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLVecBase3d> >
+forcetype PointerToArrayBase<UnalignedLVecBase3d>
 forcetype PTA_LVecBase3d
 forcetype CPTA_LVecBase3d
 
-forcetype PointerToBase<ReferenceCountedVector<LVecBase2d> >
-forcetype PointerToArrayBase<LVecBase2d>
+forcetype PointerToBase<ReferenceCountedVector<UnalignedLVecBase2d> >
+forcetype PointerToArrayBase<UnalignedLVecBase2d>
 forcetype PTA_LVecBase2d
 forcetype CPTA_LVecBase2d

+ 3 - 3
panda/src/mathutil/fftCompressor.cxx

@@ -389,7 +389,7 @@ write_reals(Datagram &datagram, const PN_stdfloat *array, int length) {
 //               datagram.
 ////////////////////////////////////////////////////////////////////
 void FFTCompressor::
-write_hprs(Datagram &datagram, const LVecBase3 *array, int length) {
+write_hprs(Datagram &datagram, const UnalignedLVecBase3 *array, int length) {
 #ifndef NDEBUG
   if (_quality >= 104) {
     // If quality level is at least 104, we don't even convert hpr at
@@ -689,7 +689,7 @@ read_reals(DatagramIterator &di, vector_stdfloat &array) {
 //               calculation.  See temp_hpr_fix.
 ////////////////////////////////////////////////////////////////////
 bool FFTCompressor::
-read_hprs(DatagramIterator &di, pvector<LVecBase3> &array, bool new_hpr) {
+read_hprs(DatagramIterator &di, pvector<UnalignedLVecBase3> &array, bool new_hpr) {
 #ifndef NDEBUG
   if (_quality >= 104) {
     // If quality level is at least 104, we don't even convert hpr to
@@ -819,7 +819,7 @@ read_hprs(DatagramIterator &di, pvector<LVecBase3> &array, bool new_hpr) {
 //               ensure that the array is initially empty.
 ////////////////////////////////////////////////////////////////////
 bool FFTCompressor::
-read_hprs(DatagramIterator &di, pvector<LVecBase3> &array) {
+read_hprs(DatagramIterator &di, pvector<UnalignedLVecBase3> &array) {
   return read_hprs(di, array, temp_hpr_fix);
 }
 

+ 3 - 3
panda/src/mathutil/fftCompressor.h

@@ -59,13 +59,13 @@ public:
 
   void write_header(Datagram &datagram);
   void write_reals(Datagram &datagram, const PN_stdfloat *array, int length);
-  void write_hprs(Datagram &datagram, const LVecBase3 *array, int length);
+  void write_hprs(Datagram &datagram, const UnalignedLVecBase3 *array, int length);
 
   bool read_header(DatagramIterator &di, int bam_minor_version);
   bool read_reals(DatagramIterator &di, vector_stdfloat &array);
-  bool read_hprs(DatagramIterator &di, pvector<LVecBase3> &array,
+  bool read_hprs(DatagramIterator &di, pvector<UnalignedLVecBase3> &array,
                  bool new_hpr);
-  bool read_hprs(DatagramIterator &di, pvector<LVecBase3> &array);
+  bool read_hprs(DatagramIterator &di, pvector<UnalignedLVecBase3> &array);
 
   static void free_storage();
 

+ 1 - 1
panda/src/mathutil/geometricBoundingVolume.I

@@ -63,7 +63,7 @@ around(const GeometricBoundingVolume **first,
 //               indicated.
 ////////////////////////////////////////////////////////////////////
 INLINE_MATHUTIL bool GeometricBoundingVolume::
-around(const LPoint3 *first, const LPoint3 *last) {
+around(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) {
   _flags = F_empty;
   if (first != last) {
     return around_points(first, last);

+ 1 - 1
panda/src/mathutil/geometricBoundingVolume.cxx

@@ -47,7 +47,7 @@ extend_by_point(const LPoint3 &) {
 //               identified by an STL-style begin/end list.
 ////////////////////////////////////////////////////////////////////
 bool GeometricBoundingVolume::
-around_points(const LPoint3 *, const LPoint3 *) {
+around_points(const UnalignedLVecBase3 *, const UnalignedLVecBase3 *) {
   _flags = F_empty;
   return false;
 }

+ 5 - 5
panda/src/mathutil/geometricBoundingVolume.h

@@ -40,9 +40,9 @@ PUBLISHED:
   // could have true STL-style first/last iterators, but that's
   // impossible for virtual functions.
   INLINE_MATHUTIL bool around(const GeometricBoundingVolume **first,
-                     const GeometricBoundingVolume **last);
-  INLINE_MATHUTIL bool around(const LPoint3 *first,
-                     const LPoint3 *last);
+                              const GeometricBoundingVolume **last);
+  INLINE_MATHUTIL bool around(const UnalignedLVecBase3 *first, 
+                              const UnalignedLVecBase3 *last);
 
   INLINE_MATHUTIL int contains(const GeometricBoundingVolume *vol) const;
   INLINE_MATHUTIL int contains(const LPoint3 &point) const;
@@ -59,8 +59,8 @@ protected:
   // operations on points in 3-d space.
 
   virtual bool extend_by_point(const LPoint3 &point);
-  virtual bool around_points(const LPoint3 *first,
-                             const LPoint3 *last);
+  virtual bool around_points(const UnalignedLVecBase3 *first,
+                             const UnalignedLVecBase3 *last);
   virtual int contains_point(const LPoint3 &point) const;
   virtual int contains_lineseg(const LPoint3 &a, const LPoint3 &b) const;
 

+ 1 - 1
panda/src/mathutil/omniBoundingVolume.cxx

@@ -139,7 +139,7 @@ extend_by_hexahedron(const BoundingHexahedron *) {
 //  Description:
 ////////////////////////////////////////////////////////////////////
 bool OmniBoundingVolume::
-around_points(const LPoint3 *, const LPoint3 *) {
+around_points(const UnalignedLVecBase3 *, const UnalignedLVecBase3 *) {
   return true;
 }
 

+ 2 - 2
panda/src/mathutil/omniBoundingVolume.h

@@ -49,8 +49,8 @@ protected:
   virtual bool extend_by_box(const BoundingBox *box);
   virtual bool extend_by_hexahedron(const BoundingHexahedron *hexahedron);
 
-  virtual bool around_points(const LPoint3 *first,
-                             const LPoint3 *last);
+  virtual bool around_points(const UnalignedLVecBase3 *first,
+                             const UnalignedLVecBase3 *last);
   virtual bool around_spheres(const BoundingVolume **first,
                               const BoundingVolume **last);
   virtual bool around_boxes(const BoundingVolume **first,

+ 20 - 12
panda/src/mathutil/pta_LMatrix3.h

@@ -26,15 +26,19 @@
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLMatrix3f, in case we are
+//               building with SSE2 and LMatrix3f requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LMatrix3f> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LMatrix3f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LMatrix3f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LMatrix3f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLMatrix3f> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLMatrix3f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLMatrix3f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLMatrix3f>)
 
-typedef PointerToArray<LMatrix3f> PTA_LMatrix3f;
-typedef ConstPointerToArray<LMatrix3f> CPTA_LMatrix3f;
+typedef PointerToArray<UnalignedLMatrix3f> PTA_LMatrix3f;
+typedef ConstPointerToArray<UnalignedLMatrix3f> CPTA_LMatrix3f;
 
 ////////////////////////////////////////////////////////////////////
 //       Class : PTA_LMatrix3d
@@ -43,15 +47,19 @@ typedef ConstPointerToArray<LMatrix3f> CPTA_LMatrix3f;
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLMatrix3d, in case we are
+//               building with SSE2 and LMatrix3d requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LMatrix3d> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LMatrix3d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LMatrix3d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LMatrix3d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLMatrix3d> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLMatrix3d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLMatrix3d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLMatrix3d>)
 
-typedef PointerToArray<LMatrix3d> PTA_LMatrix3d;
-typedef ConstPointerToArray<LMatrix3d> CPTA_LMatrix3d;
+typedef PointerToArray<UnalignedLMatrix3d> PTA_LMatrix3d;
+typedef ConstPointerToArray<UnalignedLMatrix3d> CPTA_LMatrix3d;
 
 #ifndef STDFLOAT_DOUBLE
 typedef PTA_LMatrix3f PTA_LMatrix3;

+ 20 - 12
panda/src/mathutil/pta_LMatrix4.h

@@ -26,15 +26,19 @@
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLMatrix4f, in case we are
+//               building with SSE2 and LMatrix4f requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LMatrix4f> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LMatrix4f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LMatrix4f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LMatrix4f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLMatrix4f> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLMatrix4f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLMatrix4f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLMatrix4f>)
 
-typedef PointerToArray<LMatrix4f> PTA_LMatrix4f;
-typedef ConstPointerToArray<LMatrix4f> CPTA_LMatrix4f;
+typedef PointerToArray<UnalignedLMatrix4f> PTA_LMatrix4f;
+typedef ConstPointerToArray<UnalignedLMatrix4f> CPTA_LMatrix4f;
 
 ////////////////////////////////////////////////////////////////////
 //       Class : PTA_LMatrix4d
@@ -43,15 +47,19 @@ typedef ConstPointerToArray<LMatrix4f> CPTA_LMatrix4f;
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLMatrix4d, in case we are
+//               building with SSE2 and LMatrix4d requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LMatrix4d> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LMatrix4d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LMatrix4d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LMatrix4d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLMatrix4d> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLMatrix4d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLMatrix4d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLMatrix4d>)
 
-typedef PointerToArray<LMatrix4d> PTA_LMatrix4d;
-typedef ConstPointerToArray<LMatrix4d> CPTA_LMatrix4d;
+typedef PointerToArray<UnalignedLMatrix4d> PTA_LMatrix4d;
+typedef ConstPointerToArray<UnalignedLMatrix4d> CPTA_LMatrix4d;
 
 #ifndef STDFLOAT_DOUBLE
 typedef PTA_LMatrix4f PTA_LMatrix4;

+ 20 - 12
panda/src/mathutil/pta_LVecBase2.h

@@ -26,15 +26,19 @@
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLVecBase2f, in case we are
+//               building with SSE2 and LVecBase2f requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LVecBase2f> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LVecBase2f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LVecBase2f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LVecBase2f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLVecBase2f> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLVecBase2f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLVecBase2f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLVecBase2f>)
 
-typedef PointerToArray<LVecBase2f> PTA_LVecBase2f;
-typedef ConstPointerToArray<LVecBase2f> CPTA_LVecBase2f;
+typedef PointerToArray<UnalignedLVecBase2f> PTA_LVecBase2f;
+typedef ConstPointerToArray<UnalignedLVecBase2f> CPTA_LVecBase2f;
 
 ////////////////////////////////////////////////////////////////////
 //       Class : PTA_LVecBase2d
@@ -43,15 +47,19 @@ typedef ConstPointerToArray<LVecBase2f> CPTA_LVecBase2f;
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLVecBase2d, in case we are
+//               building with SSE2 and LVecBase2d requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LVecBase2d> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LVecBase2d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LVecBase2d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LVecBase2d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLVecBase2d> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLVecBase2d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLVecBase2d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLVecBase2d>)
 
-typedef PointerToArray<LVecBase2d> PTA_LVecBase2d;
-typedef ConstPointerToArray<LVecBase2d> CPTA_LVecBase2d;
+typedef PointerToArray<UnalignedLVecBase2d> PTA_LVecBase2d;
+typedef ConstPointerToArray<UnalignedLVecBase2d> CPTA_LVecBase2d;
 
 #ifndef STDFLOAT_DOUBLE
 typedef PTA_LVecBase2f PTA_LVecBase2;

+ 20 - 12
panda/src/mathutil/pta_LVecBase3.h

@@ -26,15 +26,19 @@
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLVecBase3f, in case we are
+//               building with SSE2 and LVecBase3f requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LVecBase3f> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LVecBase3f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LVecBase3f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LVecBase3f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLVecBase3f> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLVecBase3f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLVecBase3f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLVecBase3f>)
 
-typedef PointerToArray<LVecBase3f> PTA_LVecBase3f;
-typedef ConstPointerToArray<LVecBase3f> CPTA_LVecBase3f;
+typedef PointerToArray<UnalignedLVecBase3f> PTA_LVecBase3f;
+typedef ConstPointerToArray<UnalignedLVecBase3f> CPTA_LVecBase3f;
 
 ////////////////////////////////////////////////////////////////////
 //       Class : PTA_LVecBase3d
@@ -43,15 +47,19 @@ typedef ConstPointerToArray<LVecBase3f> CPTA_LVecBase3f;
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLVecBase3d, in case we are
+//               building with SSE2 and LVecBase3d requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LVecBase3d> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LVecBase3d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LVecBase3d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LVecBase3d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLVecBase3d> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLVecBase3d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLVecBase3d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLVecBase3d>)
 
-typedef PointerToArray<LVecBase3d> PTA_LVecBase3d;
-typedef ConstPointerToArray<LVecBase3d> CPTA_LVecBase3d;
+typedef PointerToArray<UnalignedLVecBase3d> PTA_LVecBase3d;
+typedef ConstPointerToArray<UnalignedLVecBase3d> CPTA_LVecBase3d;
 
 #ifndef STDFLOAT_DOUBLE
 typedef PTA_LVecBase3f PTA_LVecBase3;

+ 20 - 12
panda/src/mathutil/pta_LVecBase4.h

@@ -26,15 +26,19 @@
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLVecBase4f, in case we are
+//               building with SSE2 and LVecBase4f requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LVecBase4f> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LVecBase4f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LVecBase4f>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LVecBase4f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLVecBase4f> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLVecBase4f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLVecBase4f>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLVecBase4f>)
 
-typedef PointerToArray<LVecBase4f> PTA_LVecBase4f;
-typedef ConstPointerToArray<LVecBase4f> CPTA_LVecBase4f;
+typedef PointerToArray<UnalignedLVecBase4f> PTA_LVecBase4f;
+typedef ConstPointerToArray<UnalignedLVecBase4f> CPTA_LVecBase4f;
 
 ////////////////////////////////////////////////////////////////////
 //       Class : PTA_LVecBase4d
@@ -43,15 +47,19 @@ typedef ConstPointerToArray<LVecBase4f> CPTA_LVecBase4f;
 //               to use a pta of this type (whether they need to
 //               export it or not) should include this header file,
 //               rather than defining the pta again.
+//
+//               We actually wrap UnalignedLVecBase4d, in case we are
+//               building with SSE2 and LVecBase4d requires strict
+//               alignment.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<LVecBase4d> >)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<LVecBase4d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<LVecBase4d>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<LVecBase4d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase<ReferenceCountedVector<UnalignedLVecBase4d> >)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase<UnalignedLVecBase4d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray<UnalignedLVecBase4d>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray<UnalignedLVecBase4d>)
 
-typedef PointerToArray<LVecBase4d> PTA_LVecBase4d;
-typedef ConstPointerToArray<LVecBase4d> CPTA_LVecBase4d;
+typedef PointerToArray<UnalignedLVecBase4d> PTA_LVecBase4d;
+typedef ConstPointerToArray<UnalignedLVecBase4d> CPTA_LVecBase4d;
 
 #ifndef STDFLOAT_DOUBLE
 typedef PTA_LVecBase4f PTA_LVecBase4;

+ 1 - 1
panda/src/mathutil/stackedPerlinNoise2.h

@@ -52,7 +52,7 @@ private:
     double _amp;
   };
 
-  typedef pvector<Noise> Noises;
+  typedef epvector<Noise> Noises;
   Noises _noises;
 };
 

+ 1 - 1
panda/src/mathutil/stackedPerlinNoise3.h

@@ -52,7 +52,7 @@ private:
     double _amp;
   };
 
-  typedef pvector<Noise> Noises;
+  typedef epvector<Noise> Noises;
   Noises _noises;
 };
 

+ 2 - 2
panda/src/mathutil/triangulator.I

@@ -43,10 +43,10 @@ get_num_vertices() const {
 //       Access: Published
 //  Description: Returns the nth vertex.
 ////////////////////////////////////////////////////////////////////
-INLINE const LPoint2d &Triangulator::
+INLINE LPoint2d Triangulator::
 get_vertex(int n) const {
   nassertr(n >= 0 && n < (int)_vertices.size(), LPoint2d::zero());
-  return _vertices[n];
+  return LPoint2d(_vertices[n]);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 2
panda/src/mathutil/triangulator.cxx

@@ -333,8 +333,8 @@ check_left_winding(const vector_int &range) const {
   double area = 0.0;
   size_t j = range.size() - 1;
   for (size_t i = 0; i < range.size(); ++i) {
-    const LPoint2d &p0 = _vertices[range[j]];
-    const LPoint2d &p1 = _vertices[range[i]];
+    const UnalignedLVecBase2d &p0 = _vertices[range[j]];
+    const UnalignedLVecBase2d &p1 = _vertices[range[i]];
     area += p0[0] * p1[1] - p0[1] * p1[0];
     j = i;
   }

+ 2 - 2
panda/src/mathutil/triangulator.h

@@ -44,7 +44,7 @@ PUBLISHED:
   INLINE int add_vertex(double x, double y);
 
   INLINE int get_num_vertices() const;
-  INLINE const LPoint2d &get_vertex(int n) const;
+  INLINE LPoint2d get_vertex(int n) const;
   MAKE_SEQ(get_vertices, get_num_vertices, get_vertex);
 
   void clear_polygon();
@@ -62,7 +62,7 @@ PUBLISHED:
   int get_triangle_v2(int n) const;
 
 private:
-  typedef pvector<LPoint2d> Vertices;
+  typedef pvector<UnalignedLVecBase2d> Vertices;
   Vertices _vertices;
 
   vector_int _polygon;

+ 1 - 1
panda/src/parametrics/curveFitter.h

@@ -75,7 +75,7 @@ public:
     LVecBase3 _hpr_tangent;
   };
 
-  typedef pvector<DataPoint> Data;
+  typedef epvector<DataPoint> Data;
   Data _data;
 
   bool _got_xyz;

+ 1 - 1
panda/src/parametrics/hermiteCurve.h

@@ -152,7 +152,7 @@ protected:
   int find_cv(PN_stdfloat t);
   void recompute_basis();
 
-  pvector<HermiteCurveCV> _points;
+  epvector<HermiteCurveCV> _points;
 
 // TypedWritable stuff
 public:

+ 1 - 1
panda/src/parametrics/nurbsBasisVector.h

@@ -71,7 +71,7 @@ private:
     LMatrix4 _basis;
   };
 
-  typedef pvector<Segment> Segments;
+  typedef epvector<Segment> Segments;
   Segments _segments;
 };
 

+ 1 - 1
panda/src/parametrics/nurbsCurve.cxx

@@ -457,7 +457,7 @@ stitch(const ParametricCurve *a, const ParametricCurve *b) {
   PN_stdfloat t = na->get_max_t();
 
   // Now add all the new CV's.
-  pvector<CV>::iterator ci;
+  epvector<CV>::iterator ci;
   for (ci = nb->_cvs.begin(); ci != nb->_cvs.end(); ++ci) {
     CV new_cv = (*ci);
     new_cv._t += t;

Some files were not shown because too many files changed in this diff