Split off epvector.h into its own file in an attempt to cut down compilation time

This commit is contained in:
rdb 2014-09-14 22:04:36 +00:00
parent 5437a3e5a9
commit 87910799b6
23 changed files with 148 additions and 117 deletions

View File

@ -114,7 +114,7 @@ enable (bool enable) {
// Description: Set the GeomNode. // Description: Set the GeomNode.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CMotionTrail:: void CMotionTrail::
set_geom_node (PT(GeomNode) geom_node) { set_geom_node (GeomNode *geom_node) {
_geom_node = geom_node; _geom_node = geom_node;
} }

View File

@ -24,7 +24,7 @@
#include "luse.h" #include "luse.h"
#include "nurbsCurveEvaluator.h" #include "nurbsCurveEvaluator.h"
#include "plist.h" #include "plist.h"
#include "pvector.h" #include "epvector.h"
class CMotionTrailVertex { class CMotionTrailVertex {
public: public:
@ -82,33 +82,30 @@ public:
// corresponds to time and the v coordinate // corresponds to time and the v coordinate
// corresponds to the "shape" of the motion trail. // corresponds to the "shape" of the motion trail.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class EXPCL_DIRECT CMotionTrail : public TypedReferenceCount { class EXPCL_DIRECT CMotionTrail : public TypedReferenceCount {
PUBLISHED: PUBLISHED:
CMotionTrail();
~CMotionTrail();
CMotionTrail ( ); void reset();
~CMotionTrail ( ); void reset_vertex_list();
void reset ( ); void enable(bool enable);
void reset_vertex_list ( );
void enable (bool enable); void set_geom_node(GeomNode *geom_node);
void add_vertex(LVector4 *vertex, LVector4 *start_color, LVector4 *end_color, PN_stdfloat v);
void set_geom_node (PT(GeomNode) geom_node); void set_parameters(PN_stdfloat sampling_time, PN_stdfloat time_window, bool use_texture, bool calculate_relative_matrix, bool use_nurbs, PN_stdfloat resolution_distance);
void add_vertex (LVector4 *vertex, LVector4 *start_color, LVector4 *end_color, PN_stdfloat v);
void set_parameters (PN_stdfloat sampling_time, PN_stdfloat time_window, bool use_texture, bool calculate_relative_matrix, bool use_nurbs, PN_stdfloat resolution_distance); int check_for_update(PN_stdfloat current_time);
void update_motion_trail(PN_stdfloat current_time, LMatrix4 *transform);
int check_for_update (PN_stdfloat current_time);
void update_motion_trail (PN_stdfloat current_time, LMatrix4 *transform);
public: public:
void begin_geometry ( ); void begin_geometry();
void add_geometry_quad (LVector3 &v0, LVector3 &v1, LVector3 &v2, LVector3 &v3, LVector4 &c0, LVector4 &c1, LVector4 &c2, LVector4 &c3, LVector2 &t0, LVector2 &t1, LVector2 &t2, LVector2 &t3); void add_geometry_quad(LVector3 &v0, LVector3 &v1, LVector3 &v2, LVector3 &v3, LVector4 &c0, LVector4 &c1, LVector4 &c2, LVector4 &c3, LVector2 &t0, LVector2 &t1, LVector2 &t2, LVector2 &t3);
void add_geometry_quad (LVector4 &v0, LVector4 &v1, LVector4 &v2, LVector4 &v3, LVector4 &c0, LVector4 &c1, LVector4 &c2, LVector4 &c3, LVector2 &t0, LVector2 &t1, LVector2 &t2, LVector2 &t3); void add_geometry_quad(LVector4 &v0, LVector4 &v1, LVector4 &v2, LVector4 &v3, LVector4 &c0, LVector4 &c1, LVector4 &c2, LVector4 &c3, LVector2 &t0, LVector2 &t1, LVector2 &t2, LVector2 &t3);
void end_geometry ( ); void end_geometry();
int _active; int _active;
int _enable; int _enable;

View File

@ -39,7 +39,8 @@
typeRegistryNode.I typeRegistryNode.h \ typeRegistryNode.I typeRegistryNode.h \
typedObject.I typedObject.h \ typedObject.I typedObject.h \
pallocator.T pallocator.h \ pallocator.T pallocator.h \
pdeque.h plist.h pmap.h pset.h pvector.h \ pdeque.h plist.h pmap.h pset.h \
pvector.h epvector.h \
lookup3.h lookup3.c \ lookup3.h lookup3.c \
dlmalloc_src.cxx ptmalloc2_smp_src.cxx dlmalloc_src.cxx ptmalloc2_smp_src.cxx
@ -97,7 +98,8 @@
typeRegistryNode.I typeRegistryNode.h \ typeRegistryNode.I typeRegistryNode.h \
typedObject.I typedObject.h \ typedObject.I typedObject.h \
pallocator.T pallocator.h \ pallocator.T pallocator.h \
pdeque.h plist.h pmap.h pset.h pvector.h \ pdeque.h plist.h pmap.h pset.h \
pvector.h epvector.h \
lookup3.h lookup3.h
#end lib_target #end lib_target

View File

@ -0,0 +1,61 @@
// Filename: epvector.h
// Created by: drose (19Dec11)
//
////////////////////////////////////////////////////////////////////
//
// 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 EPVECTOR_H
#define EPVECTOR_H
#include "pvector.h"
#if defined(HAVE_EIGEN) && defined(_WIN32) && !defined(CPPPARSER)
#include <Eigen/StdVector>
////////////////////////////////////////////////////////////////////
// Class : epvector
// Description : Unfortunately, on Windows, std::vector can't be used
// for classes with explicitly alignment requirements,
// due to a minor mistake in the template definition
// (one of the vector methods receives a concrete
// object, which the compiler flags as an error, even if
// the method is never called).
//
// As a workaround, Eigen provides their own
// specialization of vector, using their own aligned
// allocator. We define that here as epvector, which is
// meant to be a drop-in replacement for pvector for
// classes that include a linmath object that requires
// alignment. Unfortunately, this means we can't use
// the Panda allocator, so memory allocated for this
// vector class won't be tracked as part of Panda's
// memory tracking system. Them's the breaks, kids.
////////////////////////////////////////////////////////////////////
template<class Type>
class epvector : public vector<Type, Eigen::aligned_allocator<Type> > {
public:
typedef Eigen::aligned_allocator<Type> allocator;
typedef vector<Type, allocator> base_class;
typedef TYPENAME base_class::size_type size_type;
epvector(TypeHandle type_handle = pvector_type_handle) : base_class(allocator()) { }
epvector(const epvector<Type> &copy) : base_class(copy) { }
epvector(size_type n, TypeHandle type_handle = pvector_type_handle) : base_class(n, Type(), allocator()) { }
epvector(size_type n, const Type &value, TypeHandle type_handle = pvector_type_handle) : base_class(n, value, allocator()) { }
epvector(const Type *begin, const Type *end, TypeHandle type_handle = pvector_type_handle) : base_class(begin, end, allocator()) { }
};
#else // HAVE_EIGEN
#define epvector pvector
#endif // HAVE_EIGEN
#endif

View File

@ -51,46 +51,4 @@ public:
#endif // USE_STL_ALLOCATOR #endif // USE_STL_ALLOCATOR
#if defined(HAVE_EIGEN) && defined(_WIN32) && !defined(CPPPARSER)
#include <Eigen/StdVector>
////////////////////////////////////////////////////////////////////
// Class : epvector
// Description : Unfortunately, on Windows, std::vector can't be used
// for classes with explicitly alignment requirements,
// due to a minor mistake in the template definition
// (one of the vector methods receives a concrete
// object, which the compiler flags as an error, even if
// the method is never called).
//
// As a workaround, Eigen provides their own
// specialization of vector, using their own aligned
// allocator. We define that here as epvector, which is
// meant to be a drop-in replacement for pvector for
// classes that include a linmath object that requires
// alignment. Unfortunately, this means we can't use
// the Panda allocator, so memory allocated for this
// vector class won't be tracked as part of Panda's
// memory tracking system. Them's the breaks, kids.
////////////////////////////////////////////////////////////////////
template<class Type>
class epvector : public vector<Type, Eigen::aligned_allocator<Type> > {
public:
typedef Eigen::aligned_allocator<Type> allocator;
typedef vector<Type, allocator> base_class;
typedef TYPENAME base_class::size_type size_type;
epvector(TypeHandle type_handle = pvector_type_handle) : base_class(allocator()) { }
epvector(const epvector<Type> &copy) : base_class(copy) { }
epvector(size_type n, TypeHandle type_handle = pvector_type_handle) : base_class(n, Type(), allocator()) { }
epvector(size_type n, const Type &value, TypeHandle type_handle = pvector_type_handle) : base_class(n, value, allocator()) { }
epvector(const Type *begin, const Type *end, TypeHandle type_handle = pvector_type_handle) : base_class(begin, end, allocator()) { }
};
#else // HAVE_EIGEN
#define epvector pvector
#endif // HAVE_EIGEN
#endif #endif

View File

@ -18,6 +18,7 @@
#include "collisionPolygon.h" #include "collisionPolygon.h"
#include "config_collide.h" #include "config_collide.h"
#include "dcast.h" #include "dcast.h"
#include "epvector.h"
TypeHandle CollisionHandlerPusher::_type_handle; TypeHandle CollisionHandlerPusher::_type_handle;
@ -110,13 +111,13 @@ handle_entries() {
LPoint3 interior_point; LPoint3 interior_point;
if (!entry->get_all(def._target, surface_point, normal, interior_point)) { if (!entry->get_all(def._target, surface_point, normal, interior_point)) {
#ifndef NDEBUG #ifndef NDEBUG
if (collide_cat.is_debug()) { if (collide_cat.is_debug()) {
collide_cat.debug() collide_cat.debug()
<< "Cannot shove on " << from_node_path << " for collision into " << "Cannot shove on " << from_node_path << " for collision into "
<< entry->get_into_node_path() << "; no normal/depth information.\n"; << entry->get_into_node_path() << "; no normal/depth information.\n";
} }
#endif #endif
} else { } else {
// Shove it just enough to clear the volume. // Shove it just enough to clear the volume.
if (!surface_point.almost_equal(interior_point)) { if (!surface_point.almost_equal(interior_point)) {

View File

@ -37,6 +37,7 @@
#include "geomLinestrips.h" #include "geomLinestrips.h"
#include "geomVertexWriter.h" #include "geomVertexWriter.h"
#include "renderState.h" #include "renderState.h"
#include "epvector.h"
#include <algorithm> #include <algorithm>

View File

@ -25,6 +25,7 @@
#include "eggVertex.h" #include "eggVertex.h"
#include "eggTextureCollection.h" #include "eggTextureCollection.h"
#include "eggMaterialCollection.h" #include "eggMaterialCollection.h"
#include "epvector.h"
#include "pt_EggTexture.h" #include "pt_EggTexture.h"
#include "pt_EggMaterial.h" #include "pt_EggMaterial.h"
#include "config_egg.h" #include "config_egg.h"

View File

@ -21,7 +21,7 @@
#include "indent.h" #include "indent.h"
#include "pvector.h" #include "epvector.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : EggMorphList // Class : EggMorphList

View File

@ -28,6 +28,7 @@
#include "pta_LVecBase4.h" #include "pta_LVecBase4.h"
#include "pta_LVecBase3.h" #include "pta_LVecBase3.h"
#include "pta_LVecBase2.h" #include "pta_LVecBase2.h"
#include "epvector.h"
#ifdef HAVE_CG #ifdef HAVE_CG
// I don't want to include the Cg header file into panda as a // I don't want to include the Cg header file into panda as a

View File

@ -17,7 +17,7 @@
#include "pandabase.h" #include "pandabase.h"
#include "perlinNoise3.h" #include "perlinNoise3.h"
#include "pvector.h" #include "epvector.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : StackedPerlinNoise3 // Class : StackedPerlinNoise3

View File

@ -17,7 +17,7 @@
#include "pandabase.h" #include "pandabase.h"
#include "luse.h" #include "luse.h"
#include "pvector.h" #include "epvector.h"
#include "pmap.h" #include "pmap.h"
class NurbsVertex; class NurbsVertex;

View File

@ -20,10 +20,10 @@
#include "datagramIterator.h" #include "datagramIterator.h"
#include "bamWriter.h" #include "bamWriter.h"
#include "bamReader.h" #include "bamReader.h"
#include "epvector.h"
TypeHandle NurbsCurve::_type_handle; TypeHandle NurbsCurve::_type_handle;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: NurbsCurve::Constructor // Function: NurbsCurve::Constructor
// Access: Published // Access: Published

View File

@ -20,6 +20,7 @@
#include "piecewiseCurve.h" #include "piecewiseCurve.h"
#include "nurbsCurveInterface.h" #include "nurbsCurveInterface.h"
#include "cubicCurveseg.h" #include "cubicCurveseg.h"
#include "epvector.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : NurbsCurve // Class : NurbsCurve
@ -112,7 +113,6 @@ protected:
epvector<CV> _cvs; epvector<CV> _cvs;
// TypedWritable stuff // TypedWritable stuff
public: public:
static void register_with_read_factory(); static void register_with_read_factory();

View File

@ -22,6 +22,7 @@
#include "pointerTo.h" #include "pointerTo.h"
#include "vector_stdfloat.h" #include "vector_stdfloat.h"
#include "pvector.h" #include "pvector.h"
#include "epvector.h"
#include "nodePath.h" #include "nodePath.h"
#include "referenceCount.h" #include "referenceCount.h"
#include "luse.h" #include "luse.h"

View File

@ -19,6 +19,7 @@
#include "referenceCount.h" #include "referenceCount.h"
#include "nurbsBasisVector.h" #include "nurbsBasisVector.h"
#include "vector_stdfloat.h" #include "vector_stdfloat.h"
#include "epvector.h"
class NurbsVertex; class NurbsVertex;

View File

@ -22,6 +22,7 @@
#include "pointerTo.h" #include "pointerTo.h"
#include "vector_stdfloat.h" #include "vector_stdfloat.h"
#include "pvector.h" #include "pvector.h"
#include "epvector.h"
#include "nodePath.h" #include "nodePath.h"
#include "referenceCount.h" #include "referenceCount.h"
#include "luse.h" #include "luse.h"

View File

@ -18,6 +18,7 @@
#include "pandabase.h" #include "pandabase.h"
#include "referenceCount.h" #include "referenceCount.h"
#include "nurbsBasisVector.h" #include "nurbsBasisVector.h"
#include "epvector.h"
class NurbsVertex; class NurbsVertex;

View File

@ -24,6 +24,7 @@
#include "angularForce.h" #include "angularForce.h"
#include "pvector.h" #include "pvector.h"
#include "epvector.h"
class Physical; class Physical;

View File

@ -25,6 +25,8 @@
#include "geomPrimitive.h" #include "geomPrimitive.h"
#include "geomNode.h" #include "geomNode.h"
#include "pandaNode.h" #include "pandaNode.h"
#include "pvector.h"
#include "epvector.h"
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : ObjToEggConverter // Class : ObjToEggConverter

View File

@ -15,6 +15,7 @@
#include "pandatoolbase.h" #include "pandatoolbase.h"
#include "pvector.h" #include "pvector.h"
#include "epvector.h"
#include "pset.h" #include "pset.h"
#include "eggPolygon.h" #include "eggPolygon.h"
#include "eggVertex.h" #include "eggVertex.h"

View File

@ -17,7 +17,7 @@
#include "pandatoolbase.h" #include "pandatoolbase.h"
#include "pmap.h" #include "pmap.h"
#include "pvector.h" #include "epvector.h"
#include "luse.h" #include "luse.h"
#include "namable.h" #include "namable.h"

View File

@ -17,6 +17,7 @@
#include "pandatoolbase.h" #include "pandatoolbase.h"
#include "pvector.h" #include "pvector.h"
#include "epvector.h"
#include "pmap.h" #include "pmap.h"
#include "indirectCompareTo.h" #include "indirectCompareTo.h"
#include "namable.h" #include "namable.h"