From 42e8f806f1e7f3bbbbf40e8e6a8e7000483edeb0 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 19 Dec 2011 14:17:26 +0000 Subject: [PATCH] leave lvecbase2/3 and lmatrix3 unaligned; it's so much cleaner --- panda/src/chan/animChannelMatrixXfmTable.cxx | 6 +- panda/src/collide/collisionPolygon.h | 1 + panda/src/collide/collisionTraverser.cxx | 8 +- panda/src/collide/collisionTube.cxx | 2 +- panda/src/egg/eggMesherStrip.h | 2 +- panda/src/gobj/config_gobj.cxx | 4 +- panda/src/linmath/aa_luse.h | 6 - panda/src/linmath/config_linmath.cxx | 6 - panda/src/linmath/lmatrix3_src.I | 154 ------------------ panda/src/linmath/lmatrix3_src.cxx | 16 -- panda/src/linmath/lmatrix3_src.h | 59 +------ panda/src/linmath/lmatrix4_src.h | 7 +- panda/src/linmath/lorientation_src.h | 2 +- panda/src/linmath/lpoint2_src.h | 2 +- panda/src/linmath/lpoint3_src.h | 2 +- panda/src/linmath/lpoint4_src.h | 2 +- panda/src/linmath/lquaternion_src.h | 2 +- panda/src/linmath/lrotation_src.h | 2 +- panda/src/linmath/lsimpleMatrix.h | 9 +- panda/src/linmath/lvecBase2_ext_src.I | 11 -- panda/src/linmath/lvecBase2_src.I | 149 ----------------- panda/src/linmath/lvecBase2_src.cxx | 17 -- panda/src/linmath/lvecBase2_src.h | 63 ++----- panda/src/linmath/lvecBase3_ext_src.I | 11 -- panda/src/linmath/lvecBase3_src.I | 150 ----------------- panda/src/linmath/lvecBase3_src.cxx | 17 -- panda/src/linmath/lvecBase3_src.h | 58 +------ panda/src/linmath/lvecBase4_src.h | 7 +- panda/src/linmath/lvector2_src.h | 2 +- panda/src/linmath/lvector3_src.h | 2 +- panda/src/linmath/lvector4_src.h | 2 +- panda/src/mathutil/boundingBox.cxx | 10 +- panda/src/mathutil/boundingBox.h | 4 +- panda/src/mathutil/boundingSphere.cxx | 12 +- panda/src/mathutil/boundingSphere.h | 4 +- panda/src/mathutil/config_mathutil.N | 24 +-- panda/src/mathutil/fftCompressor.cxx | 6 +- panda/src/mathutil/fftCompressor.h | 6 +- panda/src/mathutil/geometricBoundingVolume.I | 2 +- .../src/mathutil/geometricBoundingVolume.cxx | 2 +- panda/src/mathutil/geometricBoundingVolume.h | 7 +- panda/src/mathutil/omniBoundingVolume.cxx | 2 +- panda/src/mathutil/omniBoundingVolume.h | 4 +- panda/src/mathutil/pta_LMatrix3.h | 32 ++-- panda/src/mathutil/pta_LVecBase2.h | 32 ++-- panda/src/mathutil/pta_LVecBase3.h | 32 ++-- panda/src/mathutil/triangulator.I | 4 +- panda/src/mathutil/triangulator.cxx | 4 +- panda/src/mathutil/triangulator.h | 4 +- panda/src/parametrics/nurbsCurveEvaluator.h | 2 +- panda/src/parametrics/nurbsSurfaceEvaluator.h | 2 +- panda/src/pgraph/occluderNode.I | 2 +- panda/src/pgraph/occluderNode.cxx | 13 +- panda/src/pgraph/occluderNode.h | 4 +- panda/src/pgraph/portalNode.I | 2 +- panda/src/pgraph/portalNode.cxx | 8 +- panda/src/pgraph/portalNode.h | 6 +- panda/src/pgui/pgItem.h | 2 +- panda/src/text/textNode.cxx | 2 +- pandatool/src/eggcharbase/eggJointData.cxx | 2 +- 60 files changed, 163 insertions(+), 854 deletions(-) diff --git a/panda/src/chan/animChannelMatrixXfmTable.cxx b/panda/src/chan/animChannelMatrixXfmTable.cxx index 948807f308..af6ba5e1da 100644 --- a/panda/src/chan/animChannelMatrixXfmTable.cxx +++ b/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 hprs; + pvector 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 UnalignedLVecBase3 *hprs_array = NULL; + const LVecBase3 *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 hprs; + pvector 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()); diff --git a/panda/src/collide/collisionPolygon.h b/panda/src/collide/collisionPolygon.h index c319f65516..e9c2c4a75c 100644 --- a/panda/src/collide/collisionPolygon.h +++ b/panda/src/collide/collisionPolygon.h @@ -51,6 +51,7 @@ PUBLISHED: INLINE LPoint3 get_point(int n) const; MAKE_SEQ(get_points, get_num_points, get_point); + INLINE static bool verify_points(const LPoint3 &a, const LPoint3 &b, const LPoint3 &c); INLINE static bool verify_points(const LPoint3 &a, const LPoint3 &b, diff --git a/panda/src/collide/collisionTraverser.cxx b/panda/src/collide/collisionTraverser.cxx index 37669b2031..288a2461ad 100644 --- a/panda/src/collide/collisionTraverser.cxx +++ b/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()) { - UnalignedLVecBase3 v[3]; + LPoint3 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(LVecBase3(v[0]), LVecBase3(v[1]), LVecBase3(v[2]))) { + if (CollisionPolygon::verify_points(v[0], v[1], v[2])) { bool within_solid_bounds = true; if (from_node_gbv != (GeometricBoundingVolume *)NULL) { PT(BoundingSphere) sphere = new BoundingSphere; @@ -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) { - UnalignedLVecBase3 v[3]; + LPoint3 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(LVecBase3(v[0]), LVecBase3(v[1]), LVecBase3(v[2]))) { + if (CollisionPolygon::verify_points(v[0], v[1], v[2])) { bool within_solid_bounds = true; if (from_node_gbv != (GeometricBoundingVolume *)NULL) { PT(BoundingSphere) sphere = new BoundingSphere; diff --git a/panda/src/collide/collisionTube.cxx b/panda/src/collide/collisionTube.cxx index 5fa2a70707..20feabc9a5 100644 --- a/panda/src/collide/collisionTube.cxx +++ b/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. - UnalignedLVecBase3 points[2]; + LPoint3 points[2]; points[0] = _a - vec * _radius; points[1] = _b + vec * _radius; diff --git a/panda/src/egg/eggMesherStrip.h b/panda/src/egg/eggMesherStrip.h index a6468b13b9..366be0d23a 100644 --- a/panda/src/egg/eggMesherStrip.h +++ b/panda/src/egg/eggMesherStrip.h @@ -140,7 +140,7 @@ public: MesherStatus _status; bool _planar; - UnalignedLVecBase3d _plane_normal; + LNormald _plane_normal; PN_stdfloat _plane_offset; int _row_id, _row_distance; MesherOrigin _origin; diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index fff2a9d1dd..0095971869 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -281,7 +281,9 @@ ConfigVariableInt vertex_column_alignment "alignment requirements on a per-column basis as you construct a " "GeomVertexFormat. Setting this value globally could result in " "much needless wasted space in all vertex data objects, but it " - "could be useful for simple experiments.")); + "could be useful for simple experiments. Also see " + "egg-vertex-animation-align-16 for a variable that controls " + "this alignment for the vertex-animation columns only.")); ConfigVariableEnum textures_power_2 ("textures-power-2", ATS_down, diff --git a/panda/src/linmath/aa_luse.h b/panda/src/linmath/aa_luse.h index 1a47506b73..68f77d9636 100644 --- a/panda/src/linmath/aa_luse.h +++ b/panda/src/linmath/aa_luse.h @@ -120,10 +120,7 @@ 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. @@ -167,10 +164,7 @@ 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. diff --git a/panda/src/linmath/config_linmath.cxx b/panda/src/linmath/config_linmath.cxx index c3394e8c65..ca15d71f91 100644 --- a/panda/src/linmath/config_linmath.cxx +++ b/panda/src/linmath/config_linmath.cxx @@ -71,10 +71,7 @@ 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(); @@ -88,10 +85,7 @@ 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(); diff --git a/panda/src/linmath/lmatrix3_src.I b/panda/src/linmath/lmatrix3_src.I index 6c50b7f24e..89d616cd81 100644 --- a/panda/src/linmath/lmatrix3_src.I +++ b/panda/src/linmath/lmatrix3_src.I @@ -115,16 +115,6 @@ INLINE_LINMATH FLOATNAME(LMatrix3):: FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) ©) : _m(copy._m) { } -//////////////////////////////////////////////////////////////////// -// Function: LMatrix3::Copy Constructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(LMatrix3):: -FLOATNAME(LMatrix3)(const FLOATNAME(UnalignedLMatrix3) ©) { - operator = (copy); -} - //////////////////////////////////////////////////////////////////// // Function: LMatrix3::Copy Assignment Operator // Access: Published @@ -138,19 +128,6 @@ operator = (const FLOATNAME(LMatrix3) ©) { return *this; } -//////////////////////////////////////////////////////////////////// -// Function: LMatrix3::Copy Assignment Operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3):: -operator = (const FLOATNAME(UnalignedLMatrix3) ©) { - 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 @@ -1517,134 +1494,3 @@ 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) ©) { - operator = (copy); -} - -//////////////////////////////////////////////////////////////////// -// Function: UnalignedLMatrix3::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(UnalignedLMatrix3):: -FLOATNAME(UnalignedLMatrix3)(const FLOATNAME(UnalignedLMatrix3) ©) : _m(copy._m) { -} - -//////////////////////////////////////////////////////////////////// -// Function: UnalignedLMatrix3::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(UnalignedLMatrix3) &FLOATNAME(UnalignedLMatrix3):: -operator = (const FLOATNAME(LMatrix3) ©) { - 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) ©) { - 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; -} diff --git a/panda/src/linmath/lmatrix3_src.cxx b/panda/src/linmath/lmatrix3_src.cxx index 9372664cb1..b5352a11cb 100644 --- a/panda/src/linmath/lmatrix3_src.cxx +++ b/panda/src/linmath/lmatrix3_src.cxx @@ -13,7 +13,6 @@ //////////////////////////////////////////////////////////////////// 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, @@ -515,18 +514,3 @@ 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); - } -} diff --git a/panda/src/linmath/lmatrix3_src.h b/panda/src/linmath/lmatrix3_src.h index 57a6f1445d..2a510ed864 100644 --- a/panda/src/linmath/lmatrix3_src.h +++ b/panda/src/linmath/lmatrix3_src.h @@ -13,7 +13,6 @@ //////////////////////////////////////////////////////////////////// class FLOATNAME(LMatrix4); -class FLOATNAME(UnalignedLMatrix3); //////////////////////////////////////////////////////////////////// // Class : LMatrix3 @@ -23,7 +22,7 @@ class FLOATNAME(UnalignedLMatrix3); // (rotation, scale, translation) in 2-d, e.g. for a // texture matrix. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LMatrix3) { +class EXPCL_PANDA_LINMATH FLOATNAME(LMatrix3) { public: typedef const FLOATTYPE *iterator; typedef const FLOATTYPE *const_iterator; @@ -55,11 +54,8 @@ 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, @@ -300,7 +296,10 @@ PUBLISHED: public: // The underlying implementation is via the Eigen library, if available. - typedef LINMATH_MATRIX(FLOATTYPE, 3, 3) EMatrix3; + + // We don't bother to align LMatrix3, since it won't benefit from + // SSE2 optimizations anyway (it's an add number of floats). + typedef UNALIGNED_LINMATH_MATRIX(FLOATTYPE, 3, 3) EMatrix3; EMatrix3 _m; INLINE_LINMATH FLOATNAME(LMatrix3)(const EMatrix3 &m) : _m(m) { } @@ -324,54 +323,6 @@ 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) ©); - INLINE_LINMATH FLOATNAME(UnalignedLMatrix3)(const FLOATNAME(UnalignedLMatrix3) ©); - INLINE_LINMATH FLOATNAME(UnalignedLMatrix3) &operator = (const FLOATNAME(LMatrix3) ©); - INLINE_LINMATH FLOATNAME(UnalignedLMatrix3) &operator = (const FLOATNAME(UnalignedLMatrix3) ©); - 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); return out; diff --git a/panda/src/linmath/lmatrix4_src.h b/panda/src/linmath/lmatrix4_src.h index 91d7255826..afb8f07f84 100644 --- a/panda/src/linmath/lmatrix4_src.h +++ b/panda/src/linmath/lmatrix4_src.h @@ -263,6 +263,11 @@ PUBLISHED: public: // The underlying implementation is via the Eigen library, if available. + + // Unlike LMatrix3, we fully align LMatrix4 to 16-byte boundaries, + // to take advantage of SSE2 optimizations when available. + // Sometimes this alignment requirement is inconvenient, so we also + // provide UnalignedLMatrix4, below. typedef LINMATH_MATRIX(FLOATTYPE, 4, 4) EMatrix4; EMatrix4 _m; @@ -328,7 +333,7 @@ PUBLISHED: INLINE_LINMATH int get_num_components() const; public: - typedef SIMPLE_MATRIX(FLOATTYPE, 4, 4) UMatrix4; + typedef UNALIGNED_LINMATH_MATRIX(FLOATTYPE, 4, 4) UMatrix4; UMatrix4 _m; public: diff --git a/panda/src/linmath/lorientation_src.h b/panda/src/linmath/lorientation_src.h index 56fa40653b..350922667f 100644 --- a/panda/src/linmath/lorientation_src.h +++ b/panda/src/linmath/lorientation_src.h @@ -18,7 +18,7 @@ class FLOATNAME(LRotation); // Class : LOrientation // Description : This is a unit quaternion representing an orientation. //////////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LOrientation) : public FLOATNAME(LQuaternion) { +class EXPCL_PANDA_LINMATH FLOATNAME(LOrientation) : public FLOATNAME(LQuaternion) { PUBLISHED: INLINE_LINMATH FLOATNAME(LOrientation)(); INLINE_LINMATH FLOATNAME(LOrientation)(const FLOATNAME(LQuaternion)&); diff --git a/panda/src/linmath/lpoint2_src.h b/panda/src/linmath/lpoint2_src.h index 3568824867..02b26fc8f5 100644 --- a/panda/src/linmath/lpoint2_src.h +++ b/panda/src/linmath/lpoint2_src.h @@ -17,7 +17,7 @@ // Class : LPoint2 // Description : This is a two-component point in space. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LPoint2) : public FLOATNAME(LVecBase2) { +class EXPCL_PANDA_LINMATH FLOATNAME(LPoint2) : public FLOATNAME(LVecBase2) { PUBLISHED: INLINE_LINMATH FLOATNAME(LPoint2)(); INLINE_LINMATH FLOATNAME(LPoint2)(const FLOATNAME(LVecBase2) ©); diff --git a/panda/src/linmath/lpoint3_src.h b/panda/src/linmath/lpoint3_src.h index 7752b28925..24c8e7eecb 100644 --- a/panda/src/linmath/lpoint3_src.h +++ b/panda/src/linmath/lpoint3_src.h @@ -22,7 +22,7 @@ // vector, while addition of a vector and a point yields // a point. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LPoint3) : public FLOATNAME(LVecBase3) { +class EXPCL_PANDA_LINMATH FLOATNAME(LPoint3) : public FLOATNAME(LVecBase3) { PUBLISHED: INLINE_LINMATH FLOATNAME(LPoint3)(); INLINE_LINMATH FLOATNAME(LPoint3)(const FLOATNAME(LVecBase3) ©); diff --git a/panda/src/linmath/lpoint4_src.h b/panda/src/linmath/lpoint4_src.h index 1632abf214..f38ac9df1d 100644 --- a/panda/src/linmath/lpoint4_src.h +++ b/panda/src/linmath/lpoint4_src.h @@ -16,7 +16,7 @@ // Class : LPoint4 // Description : This is a four-component point in space. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LPoint4) : public FLOATNAME(LVecBase4) { +class EXPCL_PANDA_LINMATH FLOATNAME(LPoint4) : public FLOATNAME(LVecBase4) { PUBLISHED: INLINE_LINMATH FLOATNAME(LPoint4)(); INLINE_LINMATH FLOATNAME(LPoint4)(const FLOATNAME(LVecBase4) ©); diff --git a/panda/src/linmath/lquaternion_src.h b/panda/src/linmath/lquaternion_src.h index 63a6486c85..730c39e637 100644 --- a/panda/src/linmath/lquaternion_src.h +++ b/panda/src/linmath/lquaternion_src.h @@ -16,7 +16,7 @@ // Class : FLOATNAME(LQuaternion) // Description : This is the base quaternion class //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LQuaternion) : public FLOATNAME(LVecBase4) { +class EXPCL_PANDA_LINMATH FLOATNAME(LQuaternion) : public FLOATNAME(LVecBase4) { PUBLISHED: INLINE_LINMATH FLOATNAME(LQuaternion)(); INLINE_LINMATH FLOATNAME(LQuaternion)(const FLOATNAME(LVecBase4) ©); diff --git a/panda/src/linmath/lrotation_src.h b/panda/src/linmath/lrotation_src.h index 5473c5ce4f..f71a53a3e5 100644 --- a/panda/src/linmath/lrotation_src.h +++ b/panda/src/linmath/lrotation_src.h @@ -16,7 +16,7 @@ // Class : LRotation // Description : This is a unit quaternion representing a rotation. //////////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LRotation) : public FLOATNAME(LQuaternion) { +class EXPCL_PANDA_LINMATH FLOATNAME(LRotation) : public FLOATNAME(LQuaternion) { PUBLISHED: INLINE_LINMATH FLOATNAME(LRotation)(); INLINE_LINMATH FLOATNAME(LRotation)(const FLOATNAME(LQuaternion) &); diff --git a/panda/src/linmath/lsimpleMatrix.h b/panda/src/linmath/lsimpleMatrix.h index 52cfddf6c2..310dd23d03 100644 --- a/panda/src/linmath/lsimpleMatrix.h +++ b/panda/src/linmath/lsimpleMatrix.h @@ -47,18 +47,19 @@ private: // Now, do we actually use LSimpleMatrix, or do we use Eigen::Matrix? #ifdef HAVE_EIGEN +#define UNALIGNED_LINMATH_MATRIX(FloatType, NumRows, NumCols) Eigen::Matrix + #ifdef LINMATH_ALIGN #define LINMATH_MATRIX(FloatType, NumRows, NumCols) Eigen::Matrix #else // LINMATH_ALIGN -#define LINMATH_MATRIX(FloatType, NumRows, NumCols) Eigen::Matrix +#define LINMATH_MATRIX(FloatType, NumRows, NumCols) UNALIGNED_LINMATH_MATRIX(FloatType, NumRows, NumCols) #endif // LINMATH_ALIGN #else // HAVE_EIGEN -#define LINMATH_MATRIX(FloatType, NumRows, NumCols) LSimpleMatrix +#define UNALIGNED_LINMATH_MATRIX(FloatType, NumRows, NumCols) LSimpleMatrix +#define LINMATH_MATRIX(FloatType, NumRows, NumCols) UNALIGNED_LINMATH_MATRIX(FloatType, NumRows, NumCols) #endif // HAVE_EIGEN -#define SIMPLE_MATRIX(FloatType, NumRows, NumCols) LSimpleMatrix - // This is as good a place as any to define this alignment macro. #ifdef LINMATH_ALIGN #define ALIGN_LINMATH ALIGN_16BYTE diff --git a/panda/src/linmath/lvecBase2_ext_src.I b/panda/src/linmath/lvecBase2_ext_src.I index 43b1b96eb3..b5c50b34f4 100644 --- a/panda/src/linmath/lvecBase2_ext_src.I +++ b/panda/src/linmath/lvecBase2_ext_src.I @@ -187,14 +187,3 @@ __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; -} diff --git a/panda/src/linmath/lvecBase2_src.I b/panda/src/linmath/lvecBase2_src.I index 22b9e369bb..37ad3f0f20 100644 --- a/panda/src/linmath/lvecBase2_src.I +++ b/panda/src/linmath/lvecBase2_src.I @@ -31,16 +31,6 @@ INLINE_LINMATH FLOATNAME(LVecBase2):: FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) ©) : _v(copy._v) { } -//////////////////////////////////////////////////////////////////// -// Function: LVecBase2::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(LVecBase2):: -FLOATNAME(LVecBase2)(const FLOATNAME(UnalignedLVecBase2) ©) { - set(copy[0], copy[1]); -} - //////////////////////////////////////////////////////////////////// // Function: LVecBase2::Copy Assignment Operator // Access: Published @@ -53,17 +43,6 @@ operator = (const FLOATNAME(LVecBase2) ©) { return *this; } -//////////////////////////////////////////////////////////////////// -// Function: LVecBase2::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2):: -operator = (const FLOATNAME(UnalignedLVecBase2) ©) { - set(copy[0], copy[1]); - return *this; -} - //////////////////////////////////////////////////////////////////// // Function: LVecBase2::Fill Assignment Operator // Access: Published @@ -837,131 +816,3 @@ 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) ©) { - set(copy[0], copy[1]); -} - -//////////////////////////////////////////////////////////////////// -// Function: UnalignedLVecBase2::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(UnalignedLVecBase2):: -FLOATNAME(UnalignedLVecBase2)(const FLOATNAME(UnalignedLVecBase2) ©) : _v(copy._v) { -} - -//////////////////////////////////////////////////////////////////// -// Function: UnalignedLVecBase2::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(UnalignedLVecBase2) &FLOATNAME(UnalignedLVecBase2):: -operator = (const FLOATNAME(LVecBase2) ©) { - 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) ©) { - 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; -} diff --git a/panda/src/linmath/lvecBase2_src.cxx b/panda/src/linmath/lvecBase2_src.cxx index 59755a8dee..a4b591564d 100644 --- a/panda/src/linmath/lvecBase2_src.cxx +++ b/panda/src/linmath/lvecBase2_src.cxx @@ -13,7 +13,6 @@ //////////////////////////////////////////////////////////////////// TypeHandle FLOATNAME(LVecBase2)::_type_handle; -TypeHandle FLOATNAME(UnalignedLVecBase2)::_type_handle; const FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::_zero = FLOATNAME(LVecBase2)(0.0f, 0.0f); @@ -36,19 +35,3 @@ init_type() { register_type(_type_handle, name); } } - -//////////////////////////////////////////////////////////////////// -// 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); - } -} - diff --git a/panda/src/linmath/lvecBase2_src.h b/panda/src/linmath/lvecBase2_src.h index 4ec59b741c..e98ee8510e 100644 --- a/panda/src/linmath/lvecBase2_src.h +++ b/panda/src/linmath/lvecBase2_src.h @@ -13,23 +13,19 @@ //////////////////////////////////////////////////////////////////// -class FLOATNAME(UnalignedLVecBase2); - //////////////////////////////////////////////////////////////////// // Class : LVecBase2 // Description : This is the base class for all two-component // vectors and points. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LVecBase2) { +class EXPCL_PANDA_LINMATH FLOATNAME(LVecBase2) { PUBLISHED: typedef const FLOATTYPE *iterator; typedef const FLOATTYPE *const_iterator; INLINE_LINMATH FLOATNAME(LVecBase2)(); INLINE_LINMATH FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) ©); - INLINE_LINMATH FLOATNAME(LVecBase2)(const FLOATNAME(UnalignedLVecBase2) ©); INLINE_LINMATH FLOATNAME(LVecBase2) &operator = (const FLOATNAME(LVecBase2) ©); - INLINE_LINMATH FLOATNAME(LVecBase2) &operator = (const FLOATNAME(UnalignedLVecBase2) ©); INLINE_LINMATH FLOATNAME(LVecBase2) &operator = (FLOATTYPE fill_value); INLINE_LINMATH FLOATNAME(LVecBase2)(FLOATTYPE fill_value); INLINE_LINMATH FLOATNAME(LVecBase2)(FLOATTYPE x, FLOATTYPE y); @@ -138,7 +134,15 @@ PUBLISHED: public: // The underlying implementation is via the Eigen library, if available. - typedef LINMATH_MATRIX(FLOATTYPE, 1, 2) EVector2; + + // We don't bother to align LVecBase2. The float version is too + // small to benefit from SSE2 optimizations. The double version + // *would* benefit, but we use this class infrequently throughout + // the Panda codebase, and the nuisance value of maintaining aligned + // and unaligned versions of this class outweighs the benefits of + // having SSE2 optimizations in the stdfloat-double compilation + // mode. + typedef UNALIGNED_LINMATH_MATRIX(FLOATTYPE, 1, 2) EVector2; EVector2 _v; INLINE_LINMATH FLOATNAME(LVecBase2)(const EVector2 &v) : _v(v) { } @@ -158,53 +162,6 @@ 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) ©); - INLINE_LINMATH FLOATNAME(UnalignedLVecBase2)(const FLOATNAME(UnalignedLVecBase2) ©); - INLINE_LINMATH FLOATNAME(UnalignedLVecBase2) &operator = (const FLOATNAME(LVecBase2) ©); - INLINE_LINMATH FLOATNAME(UnalignedLVecBase2) &operator = (const FLOATNAME(UnalignedLVecBase2) ©); - 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); return out; diff --git a/panda/src/linmath/lvecBase3_ext_src.I b/panda/src/linmath/lvecBase3_ext_src.I index fdf3ffd20e..9992d3e456 100644 --- a/panda/src/linmath/lvecBase3_ext_src.I +++ b/panda/src/linmath/lvecBase3_ext_src.I @@ -189,14 +189,3 @@ __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; -} diff --git a/panda/src/linmath/lvecBase3_src.I b/panda/src/linmath/lvecBase3_src.I index 311b2744b4..f5848dfa3c 100644 --- a/panda/src/linmath/lvecBase3_src.I +++ b/panda/src/linmath/lvecBase3_src.I @@ -30,16 +30,6 @@ INLINE_LINMATH FLOATNAME(LVecBase3):: FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) ©) : _v(copy._v) { } -//////////////////////////////////////////////////////////////////// -// Function: LVecBase3::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(LVecBase3):: -FLOATNAME(LVecBase3)(const FLOATNAME(UnalignedLVecBase3) ©) { - set(copy[0], copy[1], copy[2]); -} - //////////////////////////////////////////////////////////////////// // Function: LVecBase3::Copy Assignment Operator // Access: Public @@ -52,17 +42,6 @@ operator = (const FLOATNAME(LVecBase3) ©) { return *this; } -//////////////////////////////////////////////////////////////////// -// Function: LVecBase3::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3):: -operator = (const FLOATNAME(UnalignedLVecBase3) ©) { - set(copy[0], copy[1], copy[2]); - return *this; -} - //////////////////////////////////////////////////////////////////// // Function: LVecBase3::Fill Assignment Operator // Access: Public @@ -1016,132 +995,3 @@ 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) ©) { - set(copy[0], copy[1], copy[2]); -} - -//////////////////////////////////////////////////////////////////// -// Function: UnalignedLVecBase3::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(UnalignedLVecBase3):: -FLOATNAME(UnalignedLVecBase3)(const FLOATNAME(UnalignedLVecBase3) ©) : _v(copy._v) { -} - -//////////////////////////////////////////////////////////////////// -// Function: UnalignedLVecBase3::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_LINMATH FLOATNAME(UnalignedLVecBase3) &FLOATNAME(UnalignedLVecBase3):: -operator = (const FLOATNAME(LVecBase3) ©) { - 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) ©) { - 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; -} diff --git a/panda/src/linmath/lvecBase3_src.cxx b/panda/src/linmath/lvecBase3_src.cxx index 25469d0c07..cfa0d6505e 100644 --- a/panda/src/linmath/lvecBase3_src.cxx +++ b/panda/src/linmath/lvecBase3_src.cxx @@ -14,7 +14,6 @@ TypeHandle FLOATNAME(LVecBase3)::_type_handle; -TypeHandle FLOATNAME(UnalignedLVecBase3)::_type_handle; const FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::_zero = FLOATNAME(LVecBase3)(0.0f, 0.0f, 0.0f); @@ -40,19 +39,3 @@ 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); - } -} - diff --git a/panda/src/linmath/lvecBase3_src.h b/panda/src/linmath/lvecBase3_src.h index 075a175afd..c152a33857 100644 --- a/panda/src/linmath/lvecBase3_src.h +++ b/panda/src/linmath/lvecBase3_src.h @@ -13,23 +13,19 @@ //////////////////////////////////////////////////////////////////// -class FLOATNAME(UnalignedLVecBase3); - //////////////////////////////////////////////////////////////////// // Class : LVecBase3 // Description : This is the base class for all three-component // vectors and points. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LVecBase3) { +class EXPCL_PANDA_LINMATH FLOATNAME(LVecBase3) { PUBLISHED: typedef const FLOATTYPE *iterator; typedef const FLOATTYPE *const_iterator; INLINE_LINMATH FLOATNAME(LVecBase3)(); INLINE_LINMATH FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) ©); - INLINE_LINMATH FLOATNAME(LVecBase3)(const FLOATNAME(UnalignedLVecBase3) ©); INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (const FLOATNAME(LVecBase3) ©); - INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (const FLOATNAME(UnalignedLVecBase3) ©); 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); @@ -151,7 +147,10 @@ PUBLISHED: public: // The underlying implementation is via the Eigen library, if available. - typedef LINMATH_MATRIX(FLOATTYPE, 1, 3) EVector3; + + // We don't bother to align LVecBase3, since it won't benefit from + // SSE2 optimizations anyway (it's an add number of floats). + typedef UNALIGNED_LINMATH_MATRIX(FLOATTYPE, 1, 3) EVector3; EVector3 _v; INLINE_LINMATH FLOATNAME(LVecBase3)(const EVector3 &v) : _v(v) { } @@ -173,53 +172,6 @@ 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) ©); - INLINE_LINMATH FLOATNAME(UnalignedLVecBase3)(const FLOATNAME(UnalignedLVecBase3) ©); - INLINE_LINMATH FLOATNAME(UnalignedLVecBase3) &operator = (const FLOATNAME(LVecBase3) ©); - INLINE_LINMATH FLOATNAME(UnalignedLVecBase3) &operator = (const FLOATNAME(UnalignedLVecBase3) ©); - 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; diff --git a/panda/src/linmath/lvecBase4_src.h b/panda/src/linmath/lvecBase4_src.h index 1fa02d1d7a..a27bace6ae 100644 --- a/panda/src/linmath/lvecBase4_src.h +++ b/panda/src/linmath/lvecBase4_src.h @@ -147,6 +147,11 @@ PUBLISHED: public: // The underlying implementation is via the Eigen library, if available. + + // Unlike LVecBase2 and LVecBase3, we fully align LVecBase4 to + // 16-byte boundaries, to take advantage of SSE2 optimizations when + // available. Sometimes this alignment requirement is inconvenient, + // so we also provide UnalignedLVecBase4, below. typedef LINMATH_MATRIX(FLOATTYPE, 1, 4) EVector4; EVector4 _v; @@ -202,7 +207,7 @@ PUBLISHED: INLINE_LINMATH int get_num_components() const; public: - typedef SIMPLE_MATRIX(FLOATTYPE, 1, 4) UVector4; + typedef UNALIGNED_LINMATH_MATRIX(FLOATTYPE, 1, 4) UVector4; UVector4 _v; public: diff --git a/panda/src/linmath/lvector2_src.h b/panda/src/linmath/lvector2_src.h index 542b628942..f5eda0838c 100644 --- a/panda/src/linmath/lvector2_src.h +++ b/panda/src/linmath/lvector2_src.h @@ -16,7 +16,7 @@ // Class : LVector2 // Description : This is a two-component vector offset. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LVector2) : public FLOATNAME(LVecBase2) { +class EXPCL_PANDA_LINMATH FLOATNAME(LVector2) : public FLOATNAME(LVecBase2) { PUBLISHED: INLINE_LINMATH FLOATNAME(LVector2)(); INLINE_LINMATH FLOATNAME(LVector2)(const FLOATNAME(LVecBase2) ©); diff --git a/panda/src/linmath/lvector3_src.h b/panda/src/linmath/lvector3_src.h index b12f75c956..65b3f099a3 100644 --- a/panda/src/linmath/lvector3_src.h +++ b/panda/src/linmath/lvector3_src.h @@ -22,7 +22,7 @@ // vector, while addition of a vector and a point yields // a point. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LVector3) : public FLOATNAME(LVecBase3) { +class EXPCL_PANDA_LINMATH FLOATNAME(LVector3) : public FLOATNAME(LVecBase3) { PUBLISHED: INLINE_LINMATH FLOATNAME(LVector3)(); INLINE_LINMATH FLOATNAME(LVector3)(const FLOATNAME(LVecBase3) ©); diff --git a/panda/src/linmath/lvector4_src.h b/panda/src/linmath/lvector4_src.h index a82e8ee975..d5b69e508a 100644 --- a/panda/src/linmath/lvector4_src.h +++ b/panda/src/linmath/lvector4_src.h @@ -16,7 +16,7 @@ // Class : LVector4 // Description : This is a four-component vector distance. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_LINMATH ALIGN_LINMATH FLOATNAME(LVector4) : public FLOATNAME(LVecBase4) { +class EXPCL_PANDA_LINMATH FLOATNAME(LVector4) : public FLOATNAME(LVecBase4) { PUBLISHED: INLINE_LINMATH FLOATNAME(LVector4)(); INLINE_LINMATH FLOATNAME(LVector4)(const FLOATNAME(LVecBase4) ©); diff --git a/panda/src/mathutil/boundingBox.cxx b/panda/src/mathutil/boundingBox.cxx index 92e0cba735..ceb3ef6756 100644 --- a/panda/src/mathutil/boundingBox.cxx +++ b/panda/src/mathutil/boundingBox.cxx @@ -284,16 +284,16 @@ extend_by_finite(const FiniteBoundingVolume *volume) { // Description: //////////////////////////////////////////////////////////////////// bool BoundingBox:: -around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) { +around_points(const LPoint3 *first, const LPoint3 *last) { nassertr(first != last, false); // Get the minmax of all the points to construct a bounding box. - const UnalignedLVecBase3 *p = first; + const LPoint3 *p = first; #ifndef NDEBUG // Skip any NaN points. int skipped_nan = 0; - while (p != last && LPoint3(*p).is_nan()) { + while (p != last && (*p).is_nan()) { ++p; ++skipped_nan; } @@ -310,7 +310,7 @@ around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) { #ifndef NDEBUG // Skip more NaN points. - while (p != last && LPoint3(*p).is_nan()) { + while (p != last && (*p).is_nan()) { ++p; ++skipped_nan; } @@ -319,7 +319,7 @@ around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) { while (p != last) { #ifndef NDEBUG // Skip more NaN points. - if (LPoint3(*p).is_nan()) { + if ((*p).is_nan()) { ++skipped_nan; } else #endif diff --git a/panda/src/mathutil/boundingBox.h b/panda/src/mathutil/boundingBox.h index 3de7a1ff1b..f166de283c 100644 --- a/panda/src/mathutil/boundingBox.h +++ b/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 UnalignedLVecBase3 *first, - const UnalignedLVecBase3 *last); + virtual bool around_points(const LPoint3 *first, + const LPoint3 *last); virtual bool around_spheres(const BoundingVolume **first, const BoundingVolume **last); virtual bool around_boxes(const BoundingVolume **first, diff --git a/panda/src/mathutil/boundingSphere.cxx b/panda/src/mathutil/boundingSphere.cxx index b9e98ec5dd..abd4b13c0e 100644 --- a/panda/src/mathutil/boundingSphere.cxx +++ b/panda/src/mathutil/boundingSphere.cxx @@ -297,17 +297,17 @@ extend_by_finite(const FiniteBoundingVolume *volume) { // Description: //////////////////////////////////////////////////////////////////// bool BoundingSphere:: -around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) { +around_points(const LPoint3 *first, const LPoint3 *last) { nassertr(first != last, false); // First, get the box of all the points to construct a bounding // box. - const UnalignedLVecBase3 *p = first; + const LPoint3 *p = first; #ifndef NDEBUG // Skip any NaN points. int skipped_nan = 0; - while (p != last && LPoint3(*p).is_nan()) { + while (p != last && (*p).is_nan()) { ++p; ++skipped_nan; } @@ -324,7 +324,7 @@ around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) { #ifndef NDEBUG // Skip more NaN points. - while (p != last && LPoint3(*p).is_nan()) { + while (p != last && (*p).is_nan()) { ++p; ++skipped_nan; } @@ -342,7 +342,7 @@ around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) { while (p != last) { #ifndef NDEBUG // Skip more NaN points. - if (LPoint3(*p).is_nan()) { + if ((*p).is_nan()) { ++skipped_nan; } else #endif @@ -363,7 +363,7 @@ around_points(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *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 = LPoint3(*p) - _center; + LVector3 v = (*p) - _center; PN_stdfloat dist2 = dot(v, v); max_dist2 = max(max_dist2, dist2); } diff --git a/panda/src/mathutil/boundingSphere.h b/panda/src/mathutil/boundingSphere.h index 5ed7341d4d..c75c156944 100644 --- a/panda/src/mathutil/boundingSphere.h +++ b/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 UnalignedLVecBase3 *first, - const UnalignedLVecBase3 *last); + virtual bool around_points(const LPoint3 *first, + const LPoint3 *last); virtual bool around_spheres(const BoundingVolume **first, const BoundingVolume **last); virtual bool around_boxes(const BoundingVolume **first, diff --git a/panda/src/mathutil/config_mathutil.N b/panda/src/mathutil/config_mathutil.N index 25a49fbecd..2462341234 100644 --- a/panda/src/mathutil/config_mathutil.N +++ b/panda/src/mathutil/config_mathutil.N @@ -7,8 +7,8 @@ forcetype PointerToArrayBase forcetype PTA_LMatrix4f forcetype CPTA_LMatrix4f -forcetype PointerToBase > -forcetype PointerToArrayBase +forcetype PointerToBase > +forcetype PointerToArrayBase forcetype PTA_LMatrix3f forcetype CPTA_LMatrix3f @@ -17,13 +17,13 @@ forcetype PointerToArrayBase forcetype PTA_LVecBase4f forcetype CPTA_LVecBase4f -forcetype PointerToBase > -forcetype PointerToArrayBase +forcetype PointerToBase > +forcetype PointerToArrayBase forcetype PTA_LVecBase3f forcetype CPTA_LVecBase3f -forcetype PointerToBase > -forcetype PointerToArrayBase +forcetype PointerToBase > +forcetype PointerToArrayBase forcetype PTA_LVecBase2f forcetype CPTA_LVecBase2f @@ -32,8 +32,8 @@ forcetype PointerToArrayBase forcetype PTA_LMatrix4d forcetype CPTA_LMatrix4d -forcetype PointerToBase > -forcetype PointerToArrayBase +forcetype PointerToBase > +forcetype PointerToArrayBase forcetype PTA_LMatrix3d forcetype CPTA_LMatrix3d @@ -42,12 +42,12 @@ forcetype PointerToArrayBase forcetype PTA_LVecBase4d forcetype CPTA_LVecBase4d -forcetype PointerToBase > -forcetype PointerToArrayBase +forcetype PointerToBase > +forcetype PointerToArrayBase forcetype PTA_LVecBase3d forcetype CPTA_LVecBase3d -forcetype PointerToBase > -forcetype PointerToArrayBase +forcetype PointerToBase > +forcetype PointerToArrayBase forcetype PTA_LVecBase2d forcetype CPTA_LVecBase2d diff --git a/panda/src/mathutil/fftCompressor.cxx b/panda/src/mathutil/fftCompressor.cxx index 8aa11e769f..84bb08a510 100644 --- a/panda/src/mathutil/fftCompressor.cxx +++ b/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 UnalignedLVecBase3 *array, int length) { +write_hprs(Datagram &datagram, const LVecBase3 *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 &array, bool new_hpr) { +read_hprs(DatagramIterator &di, pvector &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 &array, bool new_hpr // ensure that the array is initially empty. //////////////////////////////////////////////////////////////////// bool FFTCompressor:: -read_hprs(DatagramIterator &di, pvector &array) { +read_hprs(DatagramIterator &di, pvector &array) { return read_hprs(di, array, temp_hpr_fix); } diff --git a/panda/src/mathutil/fftCompressor.h b/panda/src/mathutil/fftCompressor.h index 45f5a7954e..ccc693501a 100644 --- a/panda/src/mathutil/fftCompressor.h +++ b/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 UnalignedLVecBase3 *array, int length); + void write_hprs(Datagram &datagram, const LVecBase3 *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 &array, + bool read_hprs(DatagramIterator &di, pvector &array, bool new_hpr); - bool read_hprs(DatagramIterator &di, pvector &array); + bool read_hprs(DatagramIterator &di, pvector &array); static void free_storage(); diff --git a/panda/src/mathutil/geometricBoundingVolume.I b/panda/src/mathutil/geometricBoundingVolume.I index 3604de8888..3bce5116be 100644 --- a/panda/src/mathutil/geometricBoundingVolume.I +++ b/panda/src/mathutil/geometricBoundingVolume.I @@ -63,7 +63,7 @@ around(const GeometricBoundingVolume **first, // indicated. //////////////////////////////////////////////////////////////////// INLINE_MATHUTIL bool GeometricBoundingVolume:: -around(const UnalignedLVecBase3 *first, const UnalignedLVecBase3 *last) { +around(const LPoint3 *first, const LPoint3 *last) { _flags = F_empty; if (first != last) { return around_points(first, last); diff --git a/panda/src/mathutil/geometricBoundingVolume.cxx b/panda/src/mathutil/geometricBoundingVolume.cxx index 2a4a74385d..756f86dca0 100644 --- a/panda/src/mathutil/geometricBoundingVolume.cxx +++ b/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 UnalignedLVecBase3 *, const UnalignedLVecBase3 *) { +around_points(const LPoint3 *, const LPoint3 *) { _flags = F_empty; return false; } diff --git a/panda/src/mathutil/geometricBoundingVolume.h b/panda/src/mathutil/geometricBoundingVolume.h index 0350e2418e..768db6063d 100644 --- a/panda/src/mathutil/geometricBoundingVolume.h +++ b/panda/src/mathutil/geometricBoundingVolume.h @@ -41,8 +41,7 @@ PUBLISHED: // impossible for virtual functions. INLINE_MATHUTIL bool around(const GeometricBoundingVolume **first, const GeometricBoundingVolume **last); - INLINE_MATHUTIL bool around(const UnalignedLVecBase3 *first, - const UnalignedLVecBase3 *last); + INLINE_MATHUTIL bool around(const LPoint3 *first, const LPoint3 *last); INLINE_MATHUTIL int contains(const GeometricBoundingVolume *vol) const; INLINE_MATHUTIL int contains(const LPoint3 &point) const; @@ -59,8 +58,8 @@ protected: // operations on points in 3-d space. virtual bool extend_by_point(const LPoint3 &point); - virtual bool around_points(const UnalignedLVecBase3 *first, - const UnalignedLVecBase3 *last); + virtual bool around_points(const LPoint3 *first, + const LPoint3 *last); virtual int contains_point(const LPoint3 &point) const; virtual int contains_lineseg(const LPoint3 &a, const LPoint3 &b) const; diff --git a/panda/src/mathutil/omniBoundingVolume.cxx b/panda/src/mathutil/omniBoundingVolume.cxx index d44f9819e7..9a406909e8 100644 --- a/panda/src/mathutil/omniBoundingVolume.cxx +++ b/panda/src/mathutil/omniBoundingVolume.cxx @@ -139,7 +139,7 @@ extend_by_hexahedron(const BoundingHexahedron *) { // Description: //////////////////////////////////////////////////////////////////// bool OmniBoundingVolume:: -around_points(const UnalignedLVecBase3 *, const UnalignedLVecBase3 *) { +around_points(const LPoint3 *, const LPoint3 *) { return true; } diff --git a/panda/src/mathutil/omniBoundingVolume.h b/panda/src/mathutil/omniBoundingVolume.h index f0e8924bde..e6d1e69e06 100644 --- a/panda/src/mathutil/omniBoundingVolume.h +++ b/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 UnalignedLVecBase3 *first, - const UnalignedLVecBase3 *last); + virtual bool around_points(const LPoint3 *first, + const LPoint3 *last); virtual bool around_spheres(const BoundingVolume **first, const BoundingVolume **last); virtual bool around_boxes(const BoundingVolume **first, diff --git a/panda/src/mathutil/pta_LMatrix3.h b/panda/src/mathutil/pta_LMatrix3.h index 22ae823037..004e058fd7 100644 --- a/panda/src/mathutil/pta_LMatrix3.h +++ b/panda/src/mathutil/pta_LMatrix3.h @@ -26,19 +26,15 @@ // 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 >) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase >) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) -typedef PointerToArray PTA_LMatrix3f; -typedef ConstPointerToArray CPTA_LMatrix3f; +typedef PointerToArray PTA_LMatrix3f; +typedef ConstPointerToArray CPTA_LMatrix3f; //////////////////////////////////////////////////////////////////// // Class : PTA_LMatrix3d @@ -47,19 +43,15 @@ typedef ConstPointerToArray 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 >) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase >) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) -typedef PointerToArray PTA_LMatrix3d; -typedef ConstPointerToArray CPTA_LMatrix3d; +typedef PointerToArray PTA_LMatrix3d; +typedef ConstPointerToArray CPTA_LMatrix3d; #ifndef STDFLOAT_DOUBLE typedef PTA_LMatrix3f PTA_LMatrix3; diff --git a/panda/src/mathutil/pta_LVecBase2.h b/panda/src/mathutil/pta_LVecBase2.h index 6ef40d6a13..c1dba12a10 100644 --- a/panda/src/mathutil/pta_LVecBase2.h +++ b/panda/src/mathutil/pta_LVecBase2.h @@ -26,19 +26,15 @@ // 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 >) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase >) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) -typedef PointerToArray PTA_LVecBase2f; -typedef ConstPointerToArray CPTA_LVecBase2f; +typedef PointerToArray PTA_LVecBase2f; +typedef ConstPointerToArray CPTA_LVecBase2f; //////////////////////////////////////////////////////////////////// // Class : PTA_LVecBase2d @@ -47,19 +43,15 @@ typedef ConstPointerToArray 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 >) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase >) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) -typedef PointerToArray PTA_LVecBase2d; -typedef ConstPointerToArray CPTA_LVecBase2d; +typedef PointerToArray PTA_LVecBase2d; +typedef ConstPointerToArray CPTA_LVecBase2d; #ifndef STDFLOAT_DOUBLE typedef PTA_LVecBase2f PTA_LVecBase2; diff --git a/panda/src/mathutil/pta_LVecBase3.h b/panda/src/mathutil/pta_LVecBase3.h index 10dfc2611a..5a9531aca6 100644 --- a/panda/src/mathutil/pta_LVecBase3.h +++ b/panda/src/mathutil/pta_LVecBase3.h @@ -26,19 +26,15 @@ // 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 >) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase >) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) -typedef PointerToArray PTA_LVecBase3f; -typedef ConstPointerToArray CPTA_LVecBase3f; +typedef PointerToArray PTA_LVecBase3f; +typedef ConstPointerToArray CPTA_LVecBase3f; //////////////////////////////////////////////////////////////////// // Class : PTA_LVecBase3d @@ -47,19 +43,15 @@ typedef ConstPointerToArray 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 >) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToBase >) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArrayBase) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, PointerToArray) +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_MATHUTIL, EXPTP_PANDA_MATHUTIL, ConstPointerToArray) -typedef PointerToArray PTA_LVecBase3d; -typedef ConstPointerToArray CPTA_LVecBase3d; +typedef PointerToArray PTA_LVecBase3d; +typedef ConstPointerToArray CPTA_LVecBase3d; #ifndef STDFLOAT_DOUBLE typedef PTA_LVecBase3f PTA_LVecBase3; diff --git a/panda/src/mathutil/triangulator.I b/panda/src/mathutil/triangulator.I index 6e52cf4802..21cd1de49a 100644 --- a/panda/src/mathutil/triangulator.I +++ b/panda/src/mathutil/triangulator.I @@ -43,10 +43,10 @@ get_num_vertices() const { // Access: Published // Description: Returns the nth vertex. //////////////////////////////////////////////////////////////////// -INLINE LPoint2d Triangulator:: +INLINE const LPoint2d &Triangulator:: get_vertex(int n) const { nassertr(n >= 0 && n < (int)_vertices.size(), LPoint2d::zero()); - return LPoint2d(_vertices[n]); + return _vertices[n]; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/mathutil/triangulator.cxx b/panda/src/mathutil/triangulator.cxx index 3ba27a855e..dcc5027812 100644 --- a/panda/src/mathutil/triangulator.cxx +++ b/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 UnalignedLVecBase2d &p0 = _vertices[range[j]]; - const UnalignedLVecBase2d &p1 = _vertices[range[i]]; + const LPoint2d &p0 = _vertices[range[j]]; + const LPoint2d &p1 = _vertices[range[i]]; area += p0[0] * p1[1] - p0[1] * p1[0]; j = i; } diff --git a/panda/src/mathutil/triangulator.h b/panda/src/mathutil/triangulator.h index 62a3352be6..f47ee109c0 100644 --- a/panda/src/mathutil/triangulator.h +++ b/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 LPoint2d get_vertex(int n) const; + INLINE const 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 Vertices; + typedef pvector Vertices; Vertices _vertices; vector_int _polygon; diff --git a/panda/src/parametrics/nurbsCurveEvaluator.h b/panda/src/parametrics/nurbsCurveEvaluator.h index c39354a1da..f7ccb9e549 100644 --- a/panda/src/parametrics/nurbsCurveEvaluator.h +++ b/panda/src/parametrics/nurbsCurveEvaluator.h @@ -82,7 +82,7 @@ PUBLISHED: public: typedef epvector Vert4Array; - typedef pvector Vert3Array; + typedef pvector Vert3Array; void get_vertices(Vert4Array &verts, const NodePath &rel_to) const; void get_vertices(Vert3Array &verts, const NodePath &rel_to) const; diff --git a/panda/src/parametrics/nurbsSurfaceEvaluator.h b/panda/src/parametrics/nurbsSurfaceEvaluator.h index 864666d470..5cd8f39a7d 100644 --- a/panda/src/parametrics/nurbsSurfaceEvaluator.h +++ b/panda/src/parametrics/nurbsSurfaceEvaluator.h @@ -84,7 +84,7 @@ PUBLISHED: public: typedef epvector Vert4Array; - typedef pvector Vert3Array; + typedef pvector Vert3Array; void get_vertices(Vert4Array &verts, const NodePath &rel_to) const; void get_vertices(Vert3Array &verts, const NodePath &rel_to) const; diff --git a/panda/src/pgraph/occluderNode.I b/panda/src/pgraph/occluderNode.I index 33be0be5f7..30342404e6 100644 --- a/panda/src/pgraph/occluderNode.I +++ b/panda/src/pgraph/occluderNode.I @@ -47,7 +47,7 @@ get_num_vertices() const { // Access: Published // Description: Returns the nth vertex of the occluder polygon. //////////////////////////////////////////////////////////////////// -INLINE LPoint3 OccluderNode:: +INLINE const LPoint3 &OccluderNode:: get_vertex(int n) const { nassertr(n >= 0 && n < (int)_vertices.size(), LPoint3::zero()); return LPoint3(_vertices[n]); diff --git a/panda/src/pgraph/occluderNode.cxx b/panda/src/pgraph/occluderNode.cxx index 9d0ea8b13f..4ddc936812 100644 --- a/panda/src/pgraph/occluderNode.cxx +++ b/panda/src/pgraph/occluderNode.cxx @@ -131,7 +131,7 @@ xform(const LMatrix4 &mat) { for (Vertices::iterator vi = _vertices.begin(); vi != _vertices.end(); ++vi) { - (*vi) = LPoint3(*vi) * mat; + (*vi) = (*vi) * mat; } } @@ -233,8 +233,8 @@ compute_internal_bounds(CPT(BoundingVolume) &internal_bounds, // Now actually compute the bounding volume by putting it around all // of our vertices. if (!_vertices.empty()) { - const UnalignedLVecBase3 *vertices_begin = &_vertices[0]; - const UnalignedLVecBase3 *vertices_end = vertices_begin + _vertices.size(); + const LPoint3 *vertices_begin = &_vertices[0]; + const LPoint3 *vertices_end = vertices_begin + _vertices.size(); gbv->around(vertices_begin, vertices_end); } @@ -262,10 +262,7 @@ get_occluder_viz(CullTraverser *trav, CullTraverserData &data) { (get_name(), GeomVertexFormat::get_v3n3t2(), Geom::UH_static); // Compute the polygon normal from the first three vertices. - LPoint3 a(_vertices[0]); - LPoint3 b(_vertices[1]); - LPoint3 c(_vertices[2]); - LPlane plane(a, b, c); + LPlane plane(_vertices[0], _vertices[1], _vertices[2]); LVector3 poly_normal = plane.get_normal(); GeomVertexWriter vertex(vdata, InternalName::get_vertex()); @@ -391,7 +388,7 @@ write_datagram(BamWriter *manager, Datagram &dg) { for (Vertices::const_iterator vi = _vertices.begin(); vi != _vertices.end(); ++vi) { - LPoint3(*vi).write_datagram(dg); + (*vi).write_datagram(dg); } } diff --git a/panda/src/pgraph/occluderNode.h b/panda/src/pgraph/occluderNode.h index 10163c7377..8bae1497c4 100644 --- a/panda/src/pgraph/occluderNode.h +++ b/panda/src/pgraph/occluderNode.h @@ -58,7 +58,7 @@ PUBLISHED: INLINE void set_vertices(const LPoint3 &v0, const LPoint3 &v1, const LPoint3 &v2, const LPoint3 &v3); INLINE int get_num_vertices() const; - INLINE LPoint3 get_vertex(int n) const; + INLINE const LPoint3 &get_vertex(int n) const; MAKE_SEQ(get_vertices, get_num_vertices, get_vertex); protected: @@ -73,7 +73,7 @@ protected: private: bool _double_sided; PN_stdfloat _min_coverage; - typedef pvector Vertices; + typedef pvector Vertices; Vertices _vertices; PT(Geom) _occluder_viz, _frame_viz; diff --git a/panda/src/pgraph/portalNode.I b/panda/src/pgraph/portalNode.I index 15257cbf04..a298e4f6fc 100755 --- a/panda/src/pgraph/portalNode.I +++ b/panda/src/pgraph/portalNode.I @@ -158,7 +158,7 @@ get_num_vertices() const { // Access: Published // Description: Returns the nth vertex of the portal polygon. //////////////////////////////////////////////////////////////////// -INLINE LPoint3 PortalNode:: +INLINE const LPoint3 &PortalNode:: get_vertex(int n) const { nassertr(n >= 0 && n < (int)_vertices.size(), LPoint3::zero()); return LPoint3(_vertices[n]); diff --git a/panda/src/pgraph/portalNode.cxx b/panda/src/pgraph/portalNode.cxx index 33c8d37d6d..de021bbadc 100755 --- a/panda/src/pgraph/portalNode.cxx +++ b/panda/src/pgraph/portalNode.cxx @@ -62,7 +62,7 @@ PortalNode(const string &name) : // to create an arbitrary portal and setup from Python //////////////////////////////////////////////////////////////////// PortalNode:: -PortalNode(const string &name, const LPoint3 &pos, PN_stdfloat scale) : +PortalNode(const string &name, LPoint3 pos, PN_stdfloat scale) : PandaNode(name), _from_portal_mask(PortalMask::all_on()), _into_portal_mask(PortalMask::all_on()), @@ -394,8 +394,8 @@ compute_internal_bounds(CPT(BoundingVolume) &internal_bounds, // Now actually compute the bounding volume by putting it around all // of our vertices. - const UnalignedLVecBase3 *vertices_begin = &_vertices[0]; - const UnalignedLVecBase3 *vertices_end = vertices_begin + _vertices.size(); + const LPoint3 *vertices_begin = &_vertices[0]; + const LPoint3 *vertices_end = vertices_begin + _vertices.size(); // Now actually compute the bounding volume by putting it around all gbv->around(vertices_begin, vertices_end); @@ -452,7 +452,7 @@ write_datagram(BamWriter *manager, Datagram &dg) { for (Vertices::const_iterator vi = _vertices.begin(); vi != _vertices.end(); ++vi) { - LPoint3(*vi).write_datagram(dg); + (*vi).write_datagram(dg); } } diff --git a/panda/src/pgraph/portalNode.h b/panda/src/pgraph/portalNode.h index 73a4091467..8a82e39498 100755 --- a/panda/src/pgraph/portalNode.h +++ b/panda/src/pgraph/portalNode.h @@ -34,7 +34,7 @@ class EXPCL_PANDA_PGRAPH PortalNode : public PandaNode { PUBLISHED: PortalNode(const string &name); - PortalNode(const string &name, const LPoint3 &pos, PN_stdfloat scale=10.0); + PortalNode(const string &name, LPoint3 pos, PN_stdfloat scale=10.0); protected: PortalNode(const PortalNode ©); @@ -67,7 +67,7 @@ PUBLISHED: INLINE void add_vertex(const LPoint3 &vertex); INLINE int get_num_vertices() const; - INLINE LPoint3 get_vertex(int n) const; + INLINE const LPoint3 &get_vertex(int n) const; MAKE_SEQ(get_vertices, get_num_vertices, get_vertex); INLINE void set_cell_in(const NodePath &cell); @@ -111,7 +111,7 @@ private: }; int _flags; - typedef pvector Vertices; + typedef pvector Vertices; Vertices _vertices; NodePath _cell_in; // This is the cell it resides in diff --git a/panda/src/pgui/pgItem.h b/panda/src/pgui/pgItem.h index 50705d8afd..6fe950d29f 100644 --- a/panda/src/pgui/pgItem.h +++ b/panda/src/pgui/pgItem.h @@ -201,7 +201,7 @@ private: PN_stdfloat &largest_area, const LVecBase4 *new_frame); - typedef pvector ClipPoints; + typedef pvector ClipPoints; bool clip_frame(ClipPoints &source_points, const LPlane &plane) const; protected: diff --git a/panda/src/text/textNode.cxx b/panda/src/text/textNode.cxx index 24a255df95..aea9c3552d 100644 --- a/panda/src/text/textNode.cxx +++ b/panda/src/text/textNode.cxx @@ -732,7 +732,7 @@ compute_internal_bounds(CPT(BoundingVolume) &internal_bounds, // measured it. check_measure(); - UnalignedLVecBase3 vertices[8]; + LPoint3 vertices[8]; vertices[0].set(_ul3d[0], _ul3d[1], _ul3d[2]); vertices[1].set(_ul3d[0], _ul3d[1], _lr3d[2]); vertices[2].set(_ul3d[0], _lr3d[1], _ul3d[2]); diff --git a/pandatool/src/eggcharbase/eggJointData.cxx b/pandatool/src/eggcharbase/eggJointData.cxx index b702f7f6c7..79966d8148 100644 --- a/pandatool/src/eggcharbase/eggJointData.cxx +++ b/pandatool/src/eggcharbase/eggJointData.cxx @@ -199,7 +199,7 @@ score_reparent_to(EggJointData *new_parent, EggCharacterDb &db) { // would receive in all frames of all models, were it reparented to // the indicated joint. vector_stdfloat i, j, k, a, b, c, x, y, z; - pvector hprs; + pvector hprs; int num_rows = 0; int num_models = get_num_models();