support cross-compatibility of 32-bit and 64-bit bam files

This commit is contained in:
David Rose 2011-10-31 22:24:35 +00:00
parent a1e13af431
commit 8ebd82fbcc
28 changed files with 661 additions and 344 deletions

View File

@ -18,7 +18,13 @@
// Description: Constructs an empty datagram.
////////////////////////////////////////////////////////////////////
INLINE Datagram::
Datagram() {
Datagram() :
#ifdef STDFLOAT_DOUBLE
_stdfloat_double(true)
#else
_stdfloat_double(false)
#endif
{
}
////////////////////////////////////////////////////////////////////
@ -27,7 +33,13 @@ Datagram() {
// Description: Constructs a datagram from an existing block of data.
////////////////////////////////////////////////////////////////////
INLINE Datagram::
Datagram(const void *data, size_t size) {
Datagram(const void *data, size_t size) :
#ifdef STDFLOAT_DOUBLE
_stdfloat_double(true)
#else
_stdfloat_double(false)
#endif
{
append_data(data, size);
}
@ -37,7 +49,13 @@ Datagram(const void *data, size_t size) {
// Description: Constructs a datagram from an existing block of data.
////////////////////////////////////////////////////////////////////
INLINE Datagram::
Datagram(const string &data) {
Datagram(const string &data) :
#ifdef STDFLOAT_DOUBLE
_stdfloat_double(true)
#else
_stdfloat_double(false)
#endif
{
append_data(data);
}
@ -48,7 +66,8 @@ Datagram(const string &data) {
////////////////////////////////////////////////////////////////////
INLINE Datagram::
Datagram(const Datagram &copy) :
_data(copy._data)
_data(copy._data),
_stdfloat_double(copy._stdfloat_double)
{
}
@ -60,6 +79,7 @@ Datagram(const Datagram &copy) :
INLINE void Datagram::
operator = (const Datagram &copy) {
_data = copy._data;
_stdfloat_double = copy._stdfloat_double;
}
////////////////////////////////////////////////////////////////////
@ -187,16 +207,15 @@ add_float64(PN_float64 value) {
// Function: Datagram::add_stdfloat
// Access: Public
// Description: Adds either a 32-bit or a 64-bit floating-point
// number, according to the current Panda build
// configuration.
// number, according to set_stdfloat_double().
////////////////////////////////////////////////////////////////////
INLINE void Datagram::
add_stdfloat(PN_stdfloat value) {
#ifndef STDFLOAT_DOUBLE
add_float32(value);
#else
add_float64(value);
#endif
if (_stdfloat_double) {
add_float64(value);
} else {
add_float32(value);
}
}
////////////////////////////////////////////////////////////////////
@ -462,6 +481,33 @@ modify_array() {
return _data;
}
////////////////////////////////////////////////////////////////////
// Function: Datagram::set_stdfloat_double
// Access: Public
// Description: Changes the stdfloat_double flag, which defines the
// operation performed by add_stdfloat() and
// DatagramIterator::get_stdfloat(). When this is true,
// add_stdfloat() adds a 64-bit floating-point number;
// when it is false, it adds a 32-bit floating-point
// number. The default is based on the STDFLOAT_DOUBLE
// compilation flag.
////////////////////////////////////////////////////////////////////
INLINE void Datagram::
set_stdfloat_double(bool stdfloat_double) {
_stdfloat_double = stdfloat_double;
}
////////////////////////////////////////////////////////////////////
// Function: Datagram::get_stdfloat_double
// Access: Public
// Description: Returns the stdfloat_double flag. See
// set_stdfloat_double().
////////////////////////////////////////////////////////////////////
INLINE bool Datagram::
get_stdfloat_double() const {
return _stdfloat_double;
}
////////////////////////////////////////////////////////////////////
// Function: Datagram::operator ==
// Access: Public

View File

@ -168,6 +168,12 @@ append_data(const void *data, size_t size) {
(const unsigned char *)data + size);
}
////////////////////////////////////////////////////////////////////
// Function: Datagram::assign
// Access: Public
// Description: Replaces the datagram's data with the indicated
// block.
////////////////////////////////////////////////////////////////////
void Datagram::
assign(const void *data, size_t size) {
nassertv((int)size >= 0);
@ -176,8 +182,9 @@ assign(const void *data, size_t size) {
_data.v().insert(_data.v().end(), (const unsigned char *)data,
(const unsigned char *)data + size);
}
////////////////////////////////////////////////////////////////////
// Function : output
// Function : Datagram::output
// Access : Public
// Description : Write a string representation of this instance to
// <out>.
@ -190,7 +197,7 @@ output(ostream &out) const {
}
////////////////////////////////////////////////////////////////////
// Function : write
// Function : Datagram::write
// Access : Public
// Description : Write a string representation of this instance to
// <out>.

View File

@ -99,6 +99,9 @@ PUBLISHED:
INLINE CPTA_uchar get_array() const;
INLINE PTA_uchar modify_array();
INLINE void set_stdfloat_double(bool stdfloat_double);
INLINE bool get_stdfloat_double() const;
INLINE bool operator == (const Datagram &other) const;
INLINE bool operator != (const Datagram &other) const;
INLINE bool operator < (const Datagram &other) const;
@ -108,7 +111,7 @@ PUBLISHED:
private:
PTA_uchar _data;
bool _stdfloat_double;
public:

View File

@ -299,16 +299,16 @@ get_float64() {
// Function: DatagramIterator::get_stdfloat
// Access: Public
// Description: Extracts either a 32-bit or a 64-bit floating-point
// number, according to the current Panda build
// configuration.
// number, according to Datagram::set_stdfloat_double().
////////////////////////////////////////////////////////////////////
INLINE PN_stdfloat DatagramIterator::
get_stdfloat() {
#ifndef STDFLOAT_DOUBLE
return get_float32();
#else
return get_float64();
#endif
nassertr(_datagram != (const Datagram *)NULL, 0.0);
if (_datagram->get_stdfloat_double()) {
return (PN_stdfloat)get_float64();
} else {
return (PN_stdfloat)get_float32();
}
}
////////////////////////////////////////////////////////////////////

View File

@ -98,6 +98,9 @@ operator << (ostream &out, GeomEnums::NumericType numeric_type) {
case GeomEnums::NT_float64:
return out << "float64";
case GeomEnums::NT_stdfloat:
return out << "stdfloat";
}
return out << "**invalid numeric type (" << (int)numeric_type << ")**";

View File

@ -2272,6 +2272,10 @@ set_num_rows(int n) {
pointer += stride;
}
break;
case NT_stdfloat:
// Shouldn't have this type in the format.
nassertr(false, false);
}
}

View File

@ -46,7 +46,7 @@ operator [](int i) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Row::size
// Access: Public, Static
// Access: Published, Static
// Description: Returns 3: the number of columns of a LMatrix3.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH int FLOATNAME(LMatrix3)::Row::
@ -76,7 +76,7 @@ operator [](int i) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::CRow::size
// Access: Public, Static
// Access: Published, Static
// Description: Returns 3: the number of columns of a LMatrix3.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH int FLOATNAME(LMatrix3)::CRow::
@ -86,7 +86,7 @@ size() {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::ident_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns an identity matrix.
//
// This function definition must appear first, since
@ -99,7 +99,7 @@ ident_mat() {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Default Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3)::
@ -108,7 +108,7 @@ FLOATNAME(LMatrix3)() {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Copy Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3)::
@ -120,7 +120,7 @@ FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) &copy) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Copy Assignment Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
@ -133,7 +133,7 @@ operator = (const FLOATNAME(LMatrix3) &copy) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Fill Assignment Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
@ -144,7 +144,7 @@ operator = (FLOATTYPE fill_value) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3)::
@ -165,7 +165,7 @@ FLOATNAME(LMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::set
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LMatrix3)::
@ -186,7 +186,7 @@ set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::set_row
// Access: Public
// Access: Published
// Description: Replaces the indicated row of the matrix from a
// three-component vector.
////////////////////////////////////////////////////////////////////
@ -199,7 +199,7 @@ set_row(int row, const FLOATNAME(LVecBase3) &v) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::set_column
// Access: Public
// Access: Published
// Description: Replaces the indicated column of the matrix from a
// three-component vector.
////////////////////////////////////////////////////////////////////
@ -212,7 +212,7 @@ set_col(int col, const FLOATNAME(LVecBase3) &v) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::set_row
// Access: Public
// Access: Published
// Description: Replaces the indicated row of the matrix from a
// two-component vector, ignoring the last column.
////////////////////////////////////////////////////////////////////
@ -224,7 +224,7 @@ set_row(int row, const FLOATNAME(LVecBase2) &v) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::set_column
// Access: Public
// Access: Published
// Description: Replaces the indicated column of the matrix from a
// two-component vector, ignoring the last row.
////////////////////////////////////////////////////////////////////
@ -236,7 +236,7 @@ set_col(int col, const FLOATNAME(LVecBase2) &v) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_row
// Access: Public
// Access: Published
// Description: Returns the indicated row of the matrix as a
// three-component vector.
////////////////////////////////////////////////////////////////////
@ -254,7 +254,7 @@ get_row(FLOATNAME(LVecBase3) &result_vec,int row) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_col
// Access: Public
// Access: Published
// Description: Returns the indicated column of the matrix as a
// three-component vector.
////////////////////////////////////////////////////////////////////
@ -265,7 +265,7 @@ get_col(int col) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_row2
// Access: Public
// Access: Published
// Description: Returns the indicated row of the matrix as a
// two-component vector, ignoring the last column.
////////////////////////////////////////////////////////////////////
@ -276,7 +276,7 @@ get_row2(int row) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_col2
// Access: Public
// Access: Published
// Description: Returns the indicated column of the matrix as a
// two-component vector, ignoring the last row.
////////////////////////////////////////////////////////////////////
@ -287,7 +287,7 @@ get_col2(int col) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Indexing operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE &FLOATNAME(LMatrix3)::
@ -298,7 +298,7 @@ operator () (int row, int col) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Indexing operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
@ -309,7 +309,7 @@ operator () (int row, int col) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Indexing Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3)::CRow FLOATNAME(LMatrix3)::
@ -320,7 +320,7 @@ operator [](int i) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Indexing Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3)::Row FLOATNAME(LMatrix3)::
@ -331,7 +331,7 @@ operator [](int i) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::size
// Access: Public, Static
// Access: Published, Static
// Description: Returns 3: the number of rows of a LMatrix3.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH int FLOATNAME(LMatrix3)::
@ -341,7 +341,7 @@ size() {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::is_nan
// Access: Public
// Access: Published
// Description: Returns true if any component of the matrix is
// not-a-number, false otherwise.
////////////////////////////////////////////////////////////////////
@ -356,7 +356,7 @@ is_nan() const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_cell
// Access: Public
// Access: Published
// Description: Returns a particular element of the matrix.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
@ -367,7 +367,7 @@ get_cell(int row, int col) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::set_cell
// Access: Public
// Access: Published
// Description: Changes a particular element of the matrix.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LMatrix3)::
@ -378,7 +378,7 @@ set_cell(int row, int col, FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_data
// Access: Public
// 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.
@ -390,7 +390,7 @@ get_data() const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_num_components
// Access: Public
// Access: Published
// Description: Returns the number of elements in the matrix, nine.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH int FLOATNAME(LMatrix3)::
@ -400,7 +400,7 @@ get_num_components() const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::begin
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -411,7 +411,7 @@ begin() {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::end
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -422,7 +422,7 @@ end() {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::begin
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -433,7 +433,7 @@ begin() const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::end
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -444,7 +444,7 @@ end() const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Ordering Operator
// Access: Public
// Access: Published
// Description: This performs a lexicographical comparison. It's of
// questionable mathematical meaning, but sometimes has
// a practical purpose for sorting unique vectors,
@ -458,7 +458,7 @@ operator < (const FLOATNAME(LMatrix3) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Equality Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH bool FLOATNAME(LMatrix3)::
@ -468,7 +468,7 @@ operator == (const FLOATNAME(LMatrix3) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::Inequality Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH bool FLOATNAME(LMatrix3)::
@ -478,7 +478,7 @@ operator != (const FLOATNAME(LMatrix3) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::compare_to
// Access: Public
// Access: Published
// Description: This flavor of compare_to uses a default threshold
// value based on the numeric type.
////////////////////////////////////////////////////////////////////
@ -489,7 +489,7 @@ compare_to(const FLOATNAME(LMatrix3) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_hash
// Access: Public
// Access: Published
// Description: Returns a suitable hash for phash_map.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LMatrix3)::
@ -499,7 +499,7 @@ get_hash() const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::get_hash
// Access: Public
// Access: Published
// Description: Returns a suitable hash for phash_map.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LMatrix3)::
@ -509,7 +509,7 @@ get_hash(FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::add_hash
// Access: Public
// Access: Published
// Description: Adds the vector into the running hash.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LMatrix3)::
@ -519,7 +519,7 @@ add_hash(size_t hash) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::add_hash
// Access: Public
// Access: Published
// Description: Adds the vector into the running hash.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LMatrix3)::
@ -549,7 +549,7 @@ v_res._v.v._2 = v._v.v._0*mat._m.m._02 + v._v.v._1*mat._m.m._12 + v._v.v._2*mat.
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::xform
// Access: Public
// Access: Published
// Description: 3-component vector or point times matrix.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
@ -563,7 +563,7 @@ xform(const FLOATNAME(LVecBase3) &v) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::xform_point
// Access: Public
// Access: Published
// Description: The matrix transforms a 2-component point (including
// translation component) and returns the result. This
// assumes the matrix is an affine transform.
@ -583,7 +583,7 @@ xform_point(const FLOATNAME(LVecBase2) &v) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::xform_vec
// Access: Public
// Access: Published
// Description: The matrix transforms a 2-component vector (without
// translation component) and returns the result. This
// assumes the matrix is an affine transform.
@ -607,7 +607,7 @@ xform_vec(const FLOATNAME(LVecBase2) &v) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::xform_vec
// Access: Public
// Access: Published
// Description: The matrix transforms a 3-component vector and
// returns the result. This assumes the matrix is an
// orthonormal transform.
@ -630,7 +630,7 @@ xform_vec(const FLOATNAME(LVecBase3) &v) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::xform_vec_general
// Access: Public
// Access: Published
// Description: The matrix transforms a 3-component vector (without
// translation component) and returns the result, as a
// fully general operation.
@ -670,7 +670,7 @@ res._m.m._22 = a._m.m._20*b._m.m._02 + a._m.m._21*b._m.m._12 + a._m.m._22*b._m.m
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::matrix * matrix
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
@ -695,7 +695,7 @@ multiply(const FLOATNAME(LMatrix3) &other1, const FLOATNAME(LMatrix3) &other2) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::matrix * scalar
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
@ -720,7 +720,7 @@ operator * (FLOATTYPE scalar) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::matrix / scalar
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
@ -731,7 +731,7 @@ operator / (FLOATTYPE scalar) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::matrix += matrix
// Access: Public
// Access: Published
// Description: Performs a memberwise addition between two matrices.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
@ -754,7 +754,7 @@ operator += (const FLOATNAME(LMatrix3) &other) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::matrix -= matrix
// Access: Public
// Access: Published
// Description: Performs a memberwise subtraction between two matrices.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
@ -777,7 +777,7 @@ operator -= (const FLOATNAME(LMatrix3) &other) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::matrix *= matrix
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
@ -791,7 +791,7 @@ operator *= (const FLOATNAME(LMatrix3) &other) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::matrix *= scalar
// Access: Public
// Access: Published
// Description: Performs a memberwise scale.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
@ -814,7 +814,7 @@ operator *= (FLOATTYPE scalar) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::matrix /= scalar
// Access: Public
// Access: Published
// Description: Performs a memberwise scale.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
@ -838,7 +838,7 @@ operator /= (FLOATTYPE scalar) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::transpose_from
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LMatrix3)::
@ -860,7 +860,7 @@ transpose_from(const FLOATNAME(LMatrix3) &other) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::transpose_in_place
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LMatrix3)::
@ -897,7 +897,7 @@ det2(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e10, FLOATTYPE e11) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::determinant
// Access: Public
// Access: Published
// Description: Returns the determinant of the matrix.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
@ -909,7 +909,7 @@ determinant() const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::invert_from
// Access: Public
// Access: Published
// Description: Computes the inverse of the other matrix, and stores
// the result in this matrix. This is a fully general
// operation and makes no assumptions about the type of
@ -960,7 +960,7 @@ invert_from(const FLOATNAME(LMatrix3) &other) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::invert_in_place
// Access: Public
// Access: Published
// Description: Inverts the current matrix. Returns true if the
// inverse is successful, false if the matrix was
// singular.
@ -974,7 +974,7 @@ invert_in_place() {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::invert_transpose_from
// Access: Public
// Access: Published
// Description: Simultaneously computes the inverse of the indicated
// matrix, and then the transpose of that inverse.
////////////////////////////////////////////////////////////////////
@ -1010,7 +1010,7 @@ invert_transpose_from(const FLOATNAME(LMatrix3) &other) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::invert_transpose_from
// Access: Public
// Access: Published
// Description: Simultaneously computes the inverse of the indicated
// matrix, and then the transpose of that inverse.
////////////////////////////////////////////////////////////////////
@ -1046,7 +1046,7 @@ invert_transpose_from(const FLOATNAME(LMatrix4) &other) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::set_translate_mat
// Access: Public
// Access: Published
// Description: Fills mat with a matrix that applies the indicated
// translation.
////////////////////////////////////////////////////////////////////
@ -1059,7 +1059,7 @@ set_translate_mat(const FLOATNAME(LVecBase2) &trans) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::set_rotate_mat
// Access: Public
// Access: Published
// Description: Fills mat with a matrix that rotates by the given
// angle in degrees counterclockwise.
////////////////////////////////////////////////////////////////////
@ -1076,7 +1076,7 @@ set_rotate_mat(FLOATTYPE angle) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::set_scale_mat
// Access: Public
// Access: Published
// Description: Fills mat with a matrix that applies the indicated
// scale in each of the two axes.
////////////////////////////////////////////////////////////////////
@ -1089,7 +1089,7 @@ set_scale_mat(const FLOATNAME(LVecBase2) &scale) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::translate_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// translation.
////////////////////////////////////////////////////////////////////
@ -1102,7 +1102,7 @@ translate_mat(const FLOATNAME(LVecBase2) &trans) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::translate_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// translation.
////////////////////////////////////////////////////////////////////
@ -1115,7 +1115,7 @@ translate_mat(FLOATTYPE tx, FLOATTYPE ty) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::rotate_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that rotates by the given angle in
// degrees counterclockwise.
////////////////////////////////////////////////////////////////////
@ -1128,7 +1128,7 @@ rotate_mat(FLOATTYPE angle) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::scale_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// scale in each of the two axes.
////////////////////////////////////////////////////////////////////
@ -1141,7 +1141,7 @@ scale_mat(const FLOATNAME(LVecBase2) &scale) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::scale_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// scale in each of the two axes.
////////////////////////////////////////////////////////////////////
@ -1154,7 +1154,7 @@ scale_mat(FLOATTYPE sx, FLOATTYPE sy) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::rotate_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that rotates by the given angle in
// degrees counterclockwise about the indicated vector.
////////////////////////////////////////////////////////////////////
@ -1168,7 +1168,7 @@ rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis,
////////////////////////////////////////////////////////////////////
// Function: LMatrix::rotate_mat_normaxis
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that rotates by the given angle in
// degrees counterclockwise about the indicated vector.
// Assumes axis has been normalized.
@ -1183,7 +1183,7 @@ rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis,
////////////////////////////////////////////////////////////////////
// Function: LMatrix::set_scale_mat
// Access: Public
// Access: Published
// Description: Fills mat with a matrix that applies the indicated
// scale in each of the three axes.
////////////////////////////////////////////////////////////////////
@ -1196,7 +1196,7 @@ set_scale_mat(const FLOATNAME(LVecBase3) &scale) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::scale_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// scale in each of the three axes.
////////////////////////////////////////////////////////////////////
@ -1209,7 +1209,7 @@ scale_mat(const FLOATNAME(LVecBase3) &scale) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::scale_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// scale in each of the three axes.
////////////////////////////////////////////////////////////////////
@ -1222,7 +1222,7 @@ scale_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::set_shear_mat
// Access: Public
// Access: Published
// Description: Fills mat with a matrix that applies the indicated
// shear in each of the three planes.
////////////////////////////////////////////////////////////////////
@ -1234,7 +1234,7 @@ set_shear_mat(const FLOATNAME(LVecBase3) &shear, CoordinateSystem cs) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::shear_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// shear in each of the three planes.
////////////////////////////////////////////////////////////////////
@ -1247,7 +1247,7 @@ shear_mat(const FLOATNAME(LVecBase3) &shear, CoordinateSystem cs) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::shear_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// shear in each of the three planes.
////////////////////////////////////////////////////////////////////
@ -1260,7 +1260,7 @@ shear_mat(FLOATTYPE shxy, FLOATTYPE shxz, FLOATTYPE shyz, CoordinateSystem cs) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::scale_shear_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// scale and shear.
////////////////////////////////////////////////////////////////////
@ -1275,7 +1275,7 @@ scale_shear_mat(const FLOATNAME(LVecBase3) &scale,
////////////////////////////////////////////////////////////////////
// Function: LMatrix::scale_shear_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that applies the indicated
// scale and shear.
////////////////////////////////////////////////////////////////////
@ -1291,7 +1291,7 @@ scale_shear_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz,
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::almost_equal
// Access: Public
// Access: Published
// Description: Returns true if two matrices are memberwise equal
// within a default tolerance based on the numeric type.
////////////////////////////////////////////////////////////////////
@ -1302,7 +1302,7 @@ almost_equal(const FLOATNAME(LMatrix3) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::generate_hash
// Access: Public
// Access: Published
// Description: Adds the vector to the indicated hash generator.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LMatrix3)::

View File

@ -47,7 +47,7 @@ const FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::_ly_to_rz_mat =
////////////////////////////////////////////////////////////////////
// Function: LMatrix::set_scale_shear_mat
// Access: Public
// Access: Published
// Description: Fills mat with a matrix that applies the indicated
// scale and shear.
////////////////////////////////////////////////////////////////////
@ -126,7 +126,7 @@ set_scale_shear_mat(const FLOATNAME(LVecBase3) &scale,
////////////////////////////////////////////////////////////////////
// Function: LMatrix::convert_mat
// Access: Public, Static
// Access: Published, Static
// Description: Returns a matrix that transforms from the indicated
// coordinate system to the indicated coordinate system.
////////////////////////////////////////////////////////////////////
@ -191,7 +191,7 @@ convert_mat(CoordinateSystem from, CoordinateSystem to) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::fill
// Access: Public
// Access: Published
// Description: Sets each element of the matrix to the indicated
// fill_value. This is of questionable value, but is
// sometimes useful when initializing to zero.
@ -206,7 +206,7 @@ fill(FLOATTYPE fill_value) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::compare_to
// Access: Public
// Access: Published
// Description: Sorts matrices lexicographically, componentwise.
// Returns a number less than 0 if this matrix sorts
// before the other one, greater than zero if it sorts
@ -226,7 +226,7 @@ compare_to(const FLOATNAME(LMatrix3) &other, FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix::set_rotate_mat
// Access: Public
// Access: Published
// Description: Fills mat with a matrix that rotates by the given
// angle in degrees counterclockwise about the indicated
// vector.
@ -287,7 +287,7 @@ set_rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis,
////////////////////////////////////////////////////////////////////
// Function: LMatrix::set_rotate_mat_normaxis
// Access: Public
// Access: Published
// Description: Fills mat with a matrix that rotates by the given
// angle in degrees counterclockwise about the indicated
// vector. Assumes axis has been normalized.
@ -339,7 +339,7 @@ set_rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis,
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::almost_equal
// Access: Public
// Access: Published
// Description: Returns true if two matrices are memberwise equal
// within a specified tolerance.
////////////////////////////////////////////////////////////////////
@ -360,7 +360,7 @@ almost_equal(const FLOATNAME(LMatrix3) &other, FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::output
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix3)::
@ -382,7 +382,7 @@ output(ostream &out) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::write
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix3)::
@ -406,7 +406,7 @@ write(ostream &out, int indent_level) const {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::generate_hash
// Access: Public
// Access: Published
// Description: Adds the vector to the indicated hash generator.
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix3)::
@ -419,28 +419,76 @@ generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const {
}
}
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::write_datagram_fixed
// Access: Published
// Description: Writes the matrix to the Datagram using add_float32()
// or add_float64(), depending on the type of floats in
// the matrix, regardless of the setting of
// Datagram::set_stdfloat_double(). This is appropriate
// when you want to write a fixed-width value to the
// datagram, especially when you are not writing a bam
// file.
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix3)::
write_datagram_fixed(Datagram &destination) const {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
#if FLOATTOKEN == 'f'
destination.add_float32(get_cell(i,j));
#else
destination.add_float64(get_cell(i,j));
#endif
}
}
}
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::read_datagram_fixed
// Access: Published
// Description: Reads the matrix from the Datagram using get_float32()
// or get_float64(). See write_datagram_fixed().
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix3)::
read_datagram_fixed(DatagramIterator &scan) {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
#if FLOATTOKEN == 'f'
set_cell(i, j, scan.get_float32());
#else
set_cell(i, j, scan.get_float64());
#endif
}
}
}
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::write_datagram
// Description: Writes the matrix to the datagram
// Access: Published
// Description: Writes the matrix to the Datagram using
// add_stdfloat(). This is appropriate when you want to
// write the matrix using the standard width setting,
// especially when you are writing a bam file.
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix3)::
write_datagram(Datagram &destination) const {
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
destination.add_float32(get_cell(i,j));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
destination.add_stdfloat(get_cell(i,j));
}
}
}
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::read_datagram
// Description: Reads itself out of the datagram
// Access: Published
// Description: Reads the matrix from the Datagram using get_stdfloat().
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix3)::
read_datagram(DatagramIterator &scan) {
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
set_cell(i, j, scan.get_float32());
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
set_cell(i, j, scan.get_stdfloat());
}
}
}
@ -448,7 +496,7 @@ read_datagram(DatagramIterator &scan) {
////////////////////////////////////////////////////////////////////
// Function: LMatrix3::init_type
// Access: Public, Static
// Access: Published, Static
// Description:
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix3)::

View File

@ -270,11 +270,15 @@ PUBLISHED:
void write(ostream &out, int indent_level = 0) const;
EXTENSION(void python_repr(ostream &out, const string &class_name) const);
public:
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
void generate_hash(
ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const;
void write_datagram_fixed(Datagram &destination) const;
void read_datagram_fixed(DatagramIterator &scan);
void write_datagram(Datagram &destination) const;
void read_datagram(DatagramIterator &source);
public:
union {
struct {
@ -300,11 +304,6 @@ private:
static const FLOATNAME(LMatrix3) _lz_to_ry_mat;
static const FLOATNAME(LMatrix3) _ly_to_rz_mat;
//Functionality for reading and writing from/to a binary source
public:
void write_datagram(Datagram& destination) const;
void read_datagram(DatagramIterator& scan);
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -503,28 +503,75 @@ back_sub_mat(int index[4], FLOATNAME(LMatrix4) &inv, int row) const {
}
////////////////////////////////////////////////////////////////////
// Function: LMatrix4::write_datagram
// Description: Writes the matrix to the datagram
// Function: LMatrix4::write_datagram_fixed
// Access: Published
// Description: Writes the matrix to the Datagram using add_float32()
// or add_float64(), depending on the type of floats in
// the matrix, regardless of the setting of
// Datagram::set_stdfloat_double(). This is appropriate
// when you want to write a fixed-width value to the
// datagram, especially when you are not writing a bam
// file.
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix4)::
write_datagram(Datagram &destination) const {
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 4; j++) {
write_datagram_fixed(Datagram &destination) const {
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
#if FLOATTOKEN == 'f'
destination.add_float32(get_cell(i,j));
#else
destination.add_float64(get_cell(i,j));
#endif
}
}
}
////////////////////////////////////////////////////////////////////
// Function: LMatrix4::read_datagram_fixed
// Access: Published
// Description: Reads the matrix from the Datagram using get_float32()
// or get_float64(). See write_datagram_fixed().
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix4)::
read_datagram_fixed(DatagramIterator &scan) {
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
#if FLOATTOKEN == 'f'
set_cell(i, j, scan.get_float32());
#else
set_cell(i, j, scan.get_float64());
#endif
}
}
}
////////////////////////////////////////////////////////////////////
// Function: LMatrix4::write_datagram
// Access: Published
// Description: Writes the matrix to the Datagram using
// add_stdfloat(). This is appropriate when you want to
// write the matrix using the standard width setting,
// especially when you are writing a bam file.
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix4)::
write_datagram(Datagram &destination) const {
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
destination.add_stdfloat(get_cell(i,j));
}
}
}
////////////////////////////////////////////////////////////////////
// Function: LMatrix4::read_datagram
// Description: Reads itself out of the datagram
// Access: Published
// Description: Reads the matrix from the Datagram using get_stdfloat().
////////////////////////////////////////////////////////////////////
void FLOATNAME(LMatrix4)::
read_datagram(DatagramIterator &scan) {
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 4; j++) {
set_cell(i, j, scan.get_float32());
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
set_cell(i, j, scan.get_stdfloat());
}
}
}

View File

@ -234,10 +234,14 @@ PUBLISHED:
void write(ostream &out, int indent_level = 0) const;
EXTENSION(void python_repr(ostream &out, const string &class_name) const);
public:
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
void generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE scale) const;
void write_datagram_fixed(Datagram &destination) const;
void read_datagram_fixed(DatagramIterator &scan);
void write_datagram(Datagram &destination) const;
void read_datagram(DatagramIterator &source);
public:
union {
struct {
@ -265,11 +269,6 @@ private:
static const FLOATNAME(LMatrix4) _lz_to_ry_mat;
static const FLOATNAME(LMatrix4) _ly_to_rz_mat;
//Functionality for reading and writing from/to a binary source
public:
void write_datagram(Datagram& destination) const;
void read_datagram(DatagramIterator& scan);
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -15,7 +15,7 @@
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Default Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2)::
@ -24,7 +24,7 @@ FLOATNAME(LVecBase2)() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Copy Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2)::
@ -37,7 +37,7 @@ FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) &copy) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Copy Assignment Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
@ -51,7 +51,7 @@ operator = (const FLOATNAME(LVecBase2) &copy) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Fill Assignment Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
@ -62,7 +62,7 @@ operator = (FLOATTYPE fill_value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2)::
@ -72,7 +72,7 @@ FLOATNAME(LVecBase2)(FLOATTYPE fill_value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2)::
@ -85,7 +85,7 @@ FLOATNAME(LVecBase2)(FLOATTYPE x, FLOATTYPE y) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::zero Named Constructor
// Access: Public
// Access: Published
// Description: Returns a zero-length vector.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
@ -95,7 +95,7 @@ zero() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::unit_x Named Constructor
// Access: Public
// Access: Published
// Description: Returns a unit X vector.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
@ -105,7 +105,7 @@ unit_x() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::unit_y Named Constructor
// Access: Public
// Access: Published
// Description: Returns a unit Y vector.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
@ -115,7 +115,7 @@ unit_y() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Destructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2)::
@ -124,7 +124,7 @@ INLINE_LINMATH FLOATNAME(LVecBase2)::
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Indexing Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
@ -135,7 +135,7 @@ operator [](int i) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::Indexing Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE &FLOATNAME(LVecBase2)::
@ -146,7 +146,7 @@ operator [](int i) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::size
// Access: Public, Static
// Access: Published, Static
// Description: Returns 2: the number of components of a LVecBase2.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH int FLOATNAME(LVecBase2)::
@ -156,7 +156,7 @@ size() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::is_nan
// Access: Public
// Access: Published
// Description: Returns true if any component of the vector is
// not-a-number, false otherwise.
////////////////////////////////////////////////////////////////////
@ -168,7 +168,7 @@ is_nan() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::get_cell
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
@ -179,7 +179,7 @@ get_cell(int i) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::get_x
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
@ -189,7 +189,7 @@ get_x() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::get_y
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
@ -199,7 +199,7 @@ get_y() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::set_cell
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -210,7 +210,7 @@ set_cell(int i, FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::set_x
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -220,7 +220,7 @@ set_x(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::set_y
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -230,7 +230,7 @@ set_y(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::add_to_cell
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -241,7 +241,7 @@ add_to_cell(int i, FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::add_x
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -251,7 +251,7 @@ add_x(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::add_y
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -261,7 +261,7 @@ add_y(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::get_data
// Access: Public
// Access: Published
// Description: Returns the address of the first of the two data
// elements in the vector. The next element
// occupies the next position consecutively in memory.
@ -273,7 +273,7 @@ get_data() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::get_num_components
// Access: Public
// Access: Published
// Description: Returns the number of elements in the vector, two.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH int FLOATNAME(LVecBase2)::
@ -283,7 +283,7 @@ get_num_components() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::begin
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -294,7 +294,7 @@ begin() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::end
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -305,7 +305,7 @@ end() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::begin
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -316,7 +316,7 @@ begin() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::end
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -327,7 +327,7 @@ end() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::fill
// Access: Public
// Access: Published
// Description: Sets each element of the vector to the indicated
// fill_value. This is particularly useful for
// initializing to zero.
@ -341,7 +341,7 @@ fill(FLOATTYPE fill_value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::set
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -353,7 +353,7 @@ set(FLOATTYPE x, FLOATTYPE y) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::length
// Access: Public
// Access: Published
// Description: Returns the length of the vector, by the Pythagorean
// theorem.
////////////////////////////////////////////////////////////////////
@ -364,7 +364,7 @@ length() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::length_squared
// Access: Public
// Access: Published
// Description: Returns the square of the vector's length, cheap and
// easy.
////////////////////////////////////////////////////////////////////
@ -375,7 +375,7 @@ length_squared() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::normalize
// Access: Public
// Access: Published
// Description: Normalizes the vector in place. Returns true if the
// vector was normalized, false if it was a zero-length
// vector.
@ -396,7 +396,7 @@ normalize() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::dot
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
@ -419,7 +419,7 @@ project(const FLOATNAME(LVecBase2) &onto) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::operator <
// Access: Public
// Access: Published
// Description: This performs a lexicographical comparison. It's of
// questionable mathematical meaning, but sometimes has
// a practical purpose for sorting unique vectors,
@ -434,7 +434,7 @@ operator < (const FLOATNAME(LVecBase2) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::operator ==
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH bool FLOATNAME(LVecBase2)::
@ -446,7 +446,7 @@ operator == (const FLOATNAME(LVecBase2) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::operator !=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH bool FLOATNAME(LVecBase2)::
@ -456,7 +456,7 @@ operator != (const FLOATNAME(LVecBase2) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::compare_to
// Access: Public
// Access: Published
// Description: This flavor of compare_to uses a default threshold
// value based on the numeric type.
////////////////////////////////////////////////////////////////////
@ -468,7 +468,7 @@ compare_to(const FLOATNAME(LVecBase2) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::compare_to
// Access: Public
// Access: Published
// Description: Sorts vectors lexicographically, componentwise.
// Returns a number less than 0 if this vector sorts
// before the other one, greater than zero if it sorts
@ -489,7 +489,7 @@ compare_to(const FLOATNAME(LVecBase2) &other, FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::get_hash
// Access: Public
// Access: Published
// Description: Returns a suitable hash for phash_map.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LVecBase2)::
@ -500,7 +500,7 @@ get_hash() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::get_hash
// Access: Public
// Access: Published
// Description: Returns a suitable hash for phash_map.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LVecBase2)::
@ -511,7 +511,7 @@ get_hash(FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::add_hash
// Access: Public
// Access: Published
// Description: Adds the vector into the running hash.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LVecBase2)::
@ -522,7 +522,7 @@ add_hash(size_t hash) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::add_hash
// Access: Public
// Access: Published
// Description: Adds the vector into the running hash.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LVecBase2)::
@ -536,7 +536,7 @@ add_hash(size_t hash, FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::unary -
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
@ -546,7 +546,7 @@ operator - () const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::vector + vector
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
@ -557,7 +557,7 @@ operator + (const FLOATNAME(LVecBase2) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::vector - vector
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
@ -568,7 +568,7 @@ operator - (const FLOATNAME(LVecBase2) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::vector * scalar
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
@ -579,7 +579,7 @@ operator * (FLOATTYPE scalar) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::vector / scalar
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
@ -591,7 +591,7 @@ operator / (FLOATTYPE scalar) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::operator +=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -602,7 +602,7 @@ operator += (const FLOATNAME(LVecBase2) &other) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::operator -=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -613,7 +613,7 @@ operator -= (const FLOATNAME(LVecBase2) &other) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::operator *=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -624,7 +624,7 @@ operator *= (FLOATTYPE scalar) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::operator /=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -636,7 +636,7 @@ operator /= (FLOATTYPE scalar) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::fmax
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
@ -648,7 +648,7 @@ fmax(const FLOATNAME(LVecBase2) &other) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::fmin
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
@ -660,7 +660,7 @@ fmin(const FLOATNAME(LVecBase2) &other) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::almost_equal
// Access: Public
// Access: Published
// Description: Returns true if two vectors are memberwise equal
// within a specified tolerance.
////////////////////////////////////////////////////////////////////
@ -673,7 +673,7 @@ almost_equal(const FLOATNAME(LVecBase2) &other, FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::almost_equal
// Access: Public
// Access: Published
// Description: Returns true if two vectors are memberwise equal
// within a default tolerance based on the numeric type.
////////////////////////////////////////////////////////////////////
@ -685,7 +685,7 @@ almost_equal(const FLOATNAME(LVecBase2) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::output
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -696,7 +696,7 @@ output(ostream &out) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::generate_hash
// Access: Public
// Access: Published
// Description: Adds the vector to the indicated hash generator.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -706,7 +706,7 @@ generate_hash(ChecksumHashGenerator &hashgen) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::generate_hash
// Access: Public
// Access: Published
// Description: Adds the vector to the indicated hash generator.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
@ -716,12 +716,18 @@ generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const {
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::write_datagram
// Access: Public
// Description: Function to write itself into a datagram
// Function: LVecBase2::write_datagram_fixed
// Access: Published
// Description: Writes the vector to the Datagram using add_float32()
// or add_float64(), depending on the type of floats in
// the vector, regardless of the setting of
// Datagram::set_stdfloat_double(). This is appropriate
// when you want to write a fixed-width value to the
// datagram, especially when you are not writing a bam
// file.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
write_datagram(Datagram &destination) const {
write_datagram_fixed(Datagram &destination) const {
#if FLOATTOKEN == 'f'
destination.add_float32(_v.v._0);
destination.add_float32(_v.v._1);
@ -732,12 +738,13 @@ write_datagram(Datagram &destination) const {
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::read_datagram
// Access: Public
// Description: Function to read itself from a datagramIterator
// Function: LVecBase2::read_datagram_fixed
// Access: Published
// Description: Reads the vector from the Datagram using get_float32()
// or get_float64(). See write_datagram_fixed().
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
read_datagram(DatagramIterator &source) {
read_datagram_fixed(DatagramIterator &source) {
#if FLOATTOKEN == 'f'
_v.v._0 = source.get_float32();
_v.v._1 = source.get_float32();
@ -747,3 +754,27 @@ read_datagram(DatagramIterator &source) {
#endif
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::write_datagram
// Access: Published
// Description: Writes the vector to the Datagram using
// add_stdfloat(). This is appropriate when you want to
// write the vector using the standard width setting,
// especially when you are writing a bam file.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
write_datagram(Datagram &destination) const {
destination.add_stdfloat(_v.v._0);
destination.add_stdfloat(_v.v._1);
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase2::read_datagram
// Access: Published
// Description: Reads the vector from the Datagram using get_stdfloat().
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase2)::
read_datagram(DatagramIterator &source) {
_v.v._0 = source.get_stdfloat();
_v.v._1 = source.get_stdfloat();
}

View File

@ -125,11 +125,15 @@ PUBLISHED:
INLINE_LINMATH void output(ostream &out) const;
EXTENSION(INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const);
public:
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen,
FLOATTYPE threshold) const;
INLINE_LINMATH void write_datagram_fixed(Datagram &destination) const;
INLINE_LINMATH void read_datagram_fixed(DatagramIterator &source);
INLINE_LINMATH void write_datagram(Datagram &destination) const;
INLINE_LINMATH void read_datagram(DatagramIterator &source);
public:
union {
FLOATTYPE data[2];
@ -141,10 +145,6 @@ private:
static const FLOATNAME(LVecBase2) _unit_x;
static const FLOATNAME(LVecBase2) _unit_y;
public:
INLINE_LINMATH void write_datagram(Datagram &destination) const;
INLINE_LINMATH void read_datagram(DatagramIterator &source);
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -864,7 +864,7 @@ output(ostream &out) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::generate_hash
// Access: Public
// Access: Published
// Description: Adds the vector to the indicated hash generator.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
@ -875,7 +875,7 @@ generate_hash(ChecksumHashGenerator &hashgen) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::generate_hash
// Access: Public
// Access: Published
// Description: Adds the vector to the indicated hash generator.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
@ -887,12 +887,18 @@ generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const {
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::write_datagram
// Access: Public
// Description: Function to write itself into a datagram
// Function: LVecBase3::write_datagram_fixed
// Access: Published
// Description: Writes the vector to the Datagram using add_float32()
// or add_float64(), depending on the type of floats in
// the vector, regardless of the setting of
// Datagram::set_stdfloat_double(). This is appropriate
// when you want to write a fixed-width value to the
// datagram, especially when you are not writing a bam
// file.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
write_datagram(Datagram &destination) const {
write_datagram_fixed(Datagram &destination) const {
#if FLOATTOKEN == 'f'
destination.add_float32(_v.v._0);
destination.add_float32(_v.v._1);
@ -905,12 +911,13 @@ write_datagram(Datagram &destination) const {
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::read_datagram
// Access: Public
// Description: Function to read itself from a datagramIterator
// Function: LVecBase3::read_datagram_fixed
// Access: Published
// Description: Reads the vector from the Datagram using get_float32()
// or get_float64(). See write_datagram_fixed().
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
read_datagram(DatagramIterator &source) {
read_datagram_fixed(DatagramIterator &source) {
#if FLOATTOKEN == 'f'
_v.v._0 = source.get_float32();
_v.v._1 = source.get_float32();
@ -921,3 +928,30 @@ read_datagram(DatagramIterator &source) {
_v.v._2 = source.get_float64();
#endif
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::write_datagram
// Access: Published
// Description: Writes the vector to the Datagram using
// add_stdfloat(). This is appropriate when you want to
// write the vector using the standard width setting,
// especially when you are writing a bam file.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
write_datagram(Datagram &destination) const {
destination.add_stdfloat(_v.v._0);
destination.add_stdfloat(_v.v._1);
destination.add_stdfloat(_v.v._2);
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase3::read_datagram
// Access: Published
// Description: Reads the vector from the Datagram using get_stdfloat().
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase3)::
read_datagram(DatagramIterator &source) {
_v.v._0 = source.get_stdfloat();
_v.v._1 = source.get_stdfloat();
_v.v._2 = source.get_stdfloat();
}

View File

@ -135,11 +135,15 @@ PUBLISHED:
INLINE_LINMATH void output(ostream &out) const;
EXTENSION(INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const);
public:
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen,
FLOATTYPE threshold) const;
INLINE_LINMATH void write_datagram_fixed(Datagram &destination) const;
INLINE_LINMATH void read_datagram_fixed(DatagramIterator &source);
INLINE_LINMATH void write_datagram(Datagram &destination) const;
INLINE_LINMATH void read_datagram(DatagramIterator &source);
public:
union {
FLOATTYPE data[3];
@ -152,10 +156,6 @@ private:
static const FLOATNAME(LVecBase3) _unit_y;
static const FLOATNAME(LVecBase3) _unit_z;
public:
INLINE_LINMATH void write_datagram(Datagram &destination) const;
INLINE_LINMATH void read_datagram(DatagramIterator &source);
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -15,7 +15,7 @@
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Default Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4)::
@ -24,7 +24,7 @@ FLOATNAME(LVecBase4)() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Copy Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4)::
@ -39,7 +39,7 @@ FLOATNAME(LVecBase4)(const FLOATNAME(LVecBase4) &copy) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Copy Assignment Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
@ -55,7 +55,7 @@ operator = (const FLOATNAME(LVecBase4) &copy) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Fill Assignment Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
@ -66,7 +66,7 @@ operator = (FLOATTYPE fill_value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4)::
@ -76,7 +76,7 @@ FLOATNAME(LVecBase4)(FLOATTYPE fill_value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Constructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4)::
@ -91,7 +91,7 @@ FLOATNAME(LVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Destructor
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4)::
@ -100,7 +100,7 @@ INLINE_LINMATH FLOATNAME(LVecBase4)::
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::zero Named Constructor
// Access: Public
// Access: Published
// Description: Returns a zero-length vector.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
@ -110,7 +110,7 @@ zero() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::unit_x Named Constructor
// Access: Public
// Access: Published
// Description: Returns a unit X vector.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
@ -120,7 +120,7 @@ unit_x() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::unit_y Named Constructor
// Access: Public
// Access: Published
// Description: Returns a unit Y vector.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
@ -130,7 +130,7 @@ unit_y() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::unit_z Named Constructor
// Access: Public
// Access: Published
// Description: Returns a unit Z vector.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
@ -140,7 +140,7 @@ unit_z() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::unit_w Named Constructor
// Access: Public
// Access: Published
// Description: Returns a unit W vector.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
@ -150,7 +150,7 @@ unit_w() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Indexing Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
@ -161,7 +161,7 @@ operator [](int i) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::Indexing Operator
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE &FLOATNAME(LVecBase4)::
@ -172,7 +172,7 @@ operator [](int i) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::size
// Access: Public, Static
// Access: Published, Static
// Description: Returns 4: the number of components of a LVecBase4.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH int FLOATNAME(LVecBase4)::
@ -182,7 +182,7 @@ size() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::is_nan
// Access: Public
// Access: Published
// Description: Returns true if any component of the vector is
// not-a-number, false otherwise.
////////////////////////////////////////////////////////////////////
@ -194,7 +194,7 @@ is_nan() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_cell
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
@ -205,7 +205,7 @@ get_cell(int i) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_x
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
@ -215,7 +215,7 @@ get_x() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_y
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
@ -225,7 +225,7 @@ get_y() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_z
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
@ -235,7 +235,7 @@ get_z() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_w
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
@ -245,7 +245,7 @@ get_w() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::set_cell
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -256,7 +256,7 @@ set_cell(int i, FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::set_x
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -266,7 +266,7 @@ set_x(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::set_y
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -276,7 +276,7 @@ set_y(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::set_z
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -286,7 +286,7 @@ set_z(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::set_w
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -296,7 +296,7 @@ set_w(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_to_cell
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -307,7 +307,7 @@ add_to_cell(int i, FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_x
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -317,7 +317,7 @@ add_x(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_y
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -327,7 +327,7 @@ add_y(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_z
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -337,7 +337,7 @@ add_z(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_w
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -347,7 +347,7 @@ add_w(FLOATTYPE value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_data
// Access: Public
// Access: Published
// Description: Returns the address of the first of the four data
// elements in the vector. The remaining elements
// occupy the next positions consecutively in memory.
@ -359,7 +359,7 @@ get_data() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_num_components
// Access: Public
// Access: Published
// Description: Returns the number of elements in the vector, four.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH int FLOATNAME(LVecBase4)::
@ -369,7 +369,7 @@ get_num_components() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::begin
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -380,7 +380,7 @@ begin() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::end
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -391,7 +391,7 @@ end() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::begin
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -402,7 +402,7 @@ begin() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::end
// Access: Public
// Access: Published
// Description: Returns an iterator that may be used to traverse the
// elements of the matrix, STL-style.
////////////////////////////////////////////////////////////////////
@ -413,7 +413,7 @@ end() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::fill
// Access: Public
// Access: Published
// Description: Sets each element of the vector to the indicated
// fill_value. This is particularly useful for
// initializing to zero.
@ -429,7 +429,7 @@ fill(FLOATTYPE fill_value) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::set
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -443,7 +443,7 @@ set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::length
// Access: Public
// Access: Published
// Description: Returns the length of the vector, by the Pythagorean
// theorem.
////////////////////////////////////////////////////////////////////
@ -454,7 +454,7 @@ length() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::length_squared
// Access: Public
// Access: Published
// Description: Returns the square of the vector's length, cheap and
// easy.
////////////////////////////////////////////////////////////////////
@ -465,7 +465,7 @@ length_squared() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::normalize
// Access: Public
// Access: Published
// Description: Normalizes the vector in place. Returns true if the
// vector was normalized, false if it was a zero-length
// vector.
@ -486,7 +486,7 @@ normalize() {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::dot
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
@ -511,7 +511,7 @@ project(const FLOATNAME(LVecBase4) &onto) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::operator <
// Access: Public
// Access: Published
// Description: This performs a lexicographical comparison. It's of
// questionable mathematical meaning, but sometimes has
// a practical purpose for sorting unique vectors,
@ -526,7 +526,7 @@ operator < (const FLOATNAME(LVecBase4) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::operator ==
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH bool FLOATNAME(LVecBase4)::
@ -540,7 +540,7 @@ operator == (const FLOATNAME(LVecBase4) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::operator !=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH bool FLOATNAME(LVecBase4)::
@ -550,7 +550,7 @@ operator != (const FLOATNAME(LVecBase4) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::compare_to
// Access: Public
// Access: Published
// Description: This flavor of compare_to uses a default threshold
// value based on the numeric type.
////////////////////////////////////////////////////////////////////
@ -562,7 +562,7 @@ compare_to(const FLOATNAME(LVecBase4) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::compare_to
// Access: Public
// Access: Published
// Description: Sorts vectors lexicographically, componentwise.
// Returns a number less than 0 if this vector sorts
// before the other one, greater than zero if it sorts
@ -589,7 +589,7 @@ compare_to(const FLOATNAME(LVecBase4) &other, FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_hash
// Access: Public
// Access: Published
// Description: Returns a suitable hash for phash_map.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LVecBase4)::
@ -600,7 +600,7 @@ get_hash() const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::get_hash
// Access: Public
// Access: Published
// Description: Returns a suitable hash for phash_map.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LVecBase4)::
@ -611,7 +611,7 @@ get_hash(FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_hash
// Access: Public
// Access: Published
// Description: Adds the vector into the running hash.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LVecBase4)::
@ -622,7 +622,7 @@ add_hash(size_t hash) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::add_hash
// Access: Public
// Access: Published
// Description: Adds the vector into the running hash.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH size_t FLOATNAME(LVecBase4)::
@ -638,7 +638,7 @@ add_hash(size_t hash, FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::unary -
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
@ -648,7 +648,7 @@ operator - () const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::vector + vector
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
@ -661,7 +661,7 @@ operator + (const FLOATNAME(LVecBase4) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::vector - vector
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
@ -674,7 +674,7 @@ operator - (const FLOATNAME(LVecBase4) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::vector * scalar
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
@ -687,7 +687,7 @@ operator * (FLOATTYPE scalar) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::vector / scalar
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
@ -701,7 +701,7 @@ operator / (FLOATTYPE scalar) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::operator +=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -714,7 +714,7 @@ operator += (const FLOATNAME(LVecBase4) &other) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::operator -=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -727,7 +727,7 @@ operator -= (const FLOATNAME(LVecBase4) &other) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::operator *=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -740,7 +740,7 @@ operator *= (FLOATTYPE scalar) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::operator /=
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -754,7 +754,7 @@ operator /= (FLOATTYPE scalar) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::fmax
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
@ -768,7 +768,7 @@ fmax(const FLOATNAME(LVecBase4) &other) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::fmin
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
@ -782,7 +782,7 @@ fmin(const FLOATNAME(LVecBase4) &other) {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::almost_equal
// Access: Public
// Access: Published
// Description: Returns true if two vectors are memberwise equal
// within a specified tolerance.
////////////////////////////////////////////////////////////////////
@ -797,7 +797,7 @@ almost_equal(const FLOATNAME(LVecBase4) &other, FLOATTYPE threshold) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::almost_equal
// Access: Public
// Access: Published
// Description: Returns true if two vectors are memberwise equal
// within a default tolerance based on the numeric type.
////////////////////////////////////////////////////////////////////
@ -809,7 +809,7 @@ almost_equal(const FLOATNAME(LVecBase4) &other) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::output
// Access: Public
// Access: Published
// Description:
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -822,7 +822,7 @@ output(ostream &out) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::generate_hash
// Access: Public
// Access: Published
// Description: Adds the vector to the indicated hash generator.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -833,7 +833,7 @@ generate_hash(ChecksumHashGenerator &hashgen) const {
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::generate_hash
// Access: Public
// Access: Published
// Description: Adds the vector to the indicated hash generator.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
@ -846,12 +846,18 @@ generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const {
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::write_datagram
// Access: Public
// Description: Function to write itself into a datagram
// Function: LVecBase4::write_datagram_fixed
// Access: Published
// Description: Writes the vector to the Datagram using add_float32()
// or add_float64(), depending on the type of floats in
// the vector, regardless of the setting of
// Datagram::set_stdfloat_double(). This is appropriate
// when you want to write a fixed-width value to the
// datagram, especially when you are not writing a bam
// file.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
write_datagram(Datagram &destination) const {
write_datagram_fixed(Datagram &destination) const {
#if FLOATTOKEN == 'f'
destination.add_float32(_v.v._0);
destination.add_float32(_v.v._1);
@ -866,12 +872,13 @@ write_datagram(Datagram &destination) const {
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::read_datagram
// Access: Public
// Description: Function to read itself from a datagramIterator
// Function: LVecBase4::read_datagram_fixed
// Access: Published
// Description: Reads the vector from the Datagram using get_float32()
// or get_float64(). See write_datagram_fixed().
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
read_datagram(DatagramIterator &source) {
read_datagram_fixed(DatagramIterator &source) {
#if FLOATTOKEN == 'f'
_v.v._0 = source.get_float32();
_v.v._1 = source.get_float32();
@ -884,3 +891,32 @@ read_datagram(DatagramIterator &source) {
_v.v._3 = source.get_float64();
#endif
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::write_datagram
// Access: Published
// Description: Writes the vector to the Datagram using
// add_stdfloat(). This is appropriate when you want to
// write the vector using the standard width setting,
// especially when you are writing a bam file.
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
write_datagram(Datagram &destination) const {
destination.add_stdfloat(_v.v._0);
destination.add_stdfloat(_v.v._1);
destination.add_stdfloat(_v.v._2);
destination.add_stdfloat(_v.v._3);
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::read_datagram
// Access: Published
// Description: Reads the vector from the Datagram using get_stdfloat().
////////////////////////////////////////////////////////////////////
INLINE_LINMATH void FLOATNAME(LVecBase4)::
read_datagram(DatagramIterator &source) {
_v.v._0 = source.get_stdfloat();
_v.v._1 = source.get_stdfloat();
_v.v._2 = source.get_stdfloat();
_v.v._3 = source.get_stdfloat();
}

View File

@ -133,11 +133,15 @@ PUBLISHED:
INLINE_LINMATH void output(ostream &out) const;
EXTENSION(INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const);
public:
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen,
FLOATTYPE threshold) const;
INLINE_LINMATH void write_datagram_fixed(Datagram &destination) const;
INLINE_LINMATH void read_datagram_fixed(DatagramIterator &source);
INLINE_LINMATH void write_datagram(Datagram &destination) const;
INLINE_LINMATH void read_datagram(DatagramIterator &source);
public:
union {
FLOATTYPE data[4];
@ -151,10 +155,6 @@ private:
static const FLOATNAME(LVecBase4) _unit_z;
static const FLOATNAME(LVecBase4) _unit_w;
public:
INLINE_LINMATH void write_datagram(Datagram &destination) const;
INLINE_LINMATH void read_datagram(DatagramIterator &source);
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -47,10 +47,44 @@ write(ostream &out, int indent_level) const {
indent(out, indent_level) << *this << "\n";
}
////////////////////////////////////////////////////////////////////
// Function: LParabola::write_datagram_fixed
// Access: Public
// Description: Writes the parabola to the Datagram using add_float32()
// or add_float64(), depending on the type of floats in
// the parabola, regardless of the setting of
// Datagram::set_stdfloat_double(). This is appropriate
// when you want to write a fixed-width value to the
// datagram, especially when you are not writing a bam
// file.
////////////////////////////////////////////////////////////////////
void FLOATNAME(LParabola)::
write_datagram_fixed(Datagram &destination) const {
_a.write_datagram_fixed(destination);
_b.write_datagram_fixed(destination);
_c.write_datagram_fixed(destination);
}
////////////////////////////////////////////////////////////////////
// Function: LParabola::read_datagram_fixed
// Access: Public
// Description: Reads the parabola from the Datagram using get_float32()
// or get_float64(). See write_datagram_fixed().
////////////////////////////////////////////////////////////////////
void FLOATNAME(LParabola)::
read_datagram_fixed(DatagramIterator &source) {
_a.read_datagram_fixed(source);
_b.read_datagram_fixed(source);
_c.read_datagram_fixed(source);
}
////////////////////////////////////////////////////////////////////
// Function: LParabola::write_datagram
// Access: Public
// Description: Function to write itself into a datagram
// Description: Writes the parabola to the Datagram using
// add_stdfloat(). This is appropriate when you want to
// write the vector using the standard width setting,
// especially when you are writing a bam file.
////////////////////////////////////////////////////////////////////
void FLOATNAME(LParabola)::
write_datagram(Datagram &destination) const {
@ -60,9 +94,9 @@ write_datagram(Datagram &destination) const {
}
////////////////////////////////////////////////////////////////////
// Function: LVecBase4::read_datagram
// Function: LParabola::read_datagram
// Access: Public
// Description: Function to read itself from a datagramIterator
// Description: Reads the parabola from the Datagram using get_stdfloat().
////////////////////////////////////////////////////////////////////
void FLOATNAME(LParabola)::
read_datagram(DatagramIterator &source) {

View File

@ -42,7 +42,8 @@ PUBLISHED:
void output(ostream &out) const;
void write(ostream &out, int indent_level = 0) const;
public:
void write_datagram_fixed(Datagram &destination) const;
void read_datagram_fixed(DatagramIterator &source);
void write_datagram(Datagram &destination) const;
void read_datagram(DatagramIterator &source);

View File

@ -344,6 +344,25 @@ get_file_endian() const {
return bam_endian;
}
////////////////////////////////////////////////////////////////////
// Function: BamFile::get_file_stdfloat_double
// Access: Public
// Description: Returns true if the file stores all "standard"
// floats as 64-bit doubles, or false if they are 32-bit
// floats.
////////////////////////////////////////////////////////////////////
bool BamFile::
get_file_stdfloat_double() const {
if (_writer != (BamWriter *)NULL) {
return _writer->get_file_stdfloat_double();
}
if (_reader != (BamReader *)NULL) {
return _reader->get_file_stdfloat_double();
}
return bam_stdfloat_double;
}
////////////////////////////////////////////////////////////////////
// Function: BamFile::get_current_major_ver
// Access: Public

View File

@ -70,6 +70,7 @@ PUBLISHED:
int get_file_major_ver();
int get_file_minor_ver();
BamEndian get_file_endian() const;
bool get_file_stdfloat_double() const;
int get_current_major_ver();
int get_current_minor_ver();

View File

@ -751,9 +751,11 @@ public:
static void init_type() {
TypedWritable::init_type();
ReferenceCount::init_type();
Namable::init_type();
register_type(_type_handle, "PandaNode",
TypedWritable::get_class_type(),
ReferenceCount::get_class_type());
ReferenceCount::get_class_type(),
Namable::get_class_type());
CData::init_type();
Down::init_type();
Up::init_type();

View File

@ -127,9 +127,6 @@ get_file_endian() const {
// floats as 64-bit doubles, or false if they are 32-bit
// floats. This is determined by the compilation flags
// of the version of Panda that generated this file.
//
// If this doesn't match the current version of Panda,
// the file cannot be read.
////////////////////////////////////////////////////////////////////
INLINE bool BamReader::
get_file_stdfloat_double() const {
@ -244,7 +241,12 @@ get_datagram(Datagram &datagram) {
return false;
}
return _source->get_datagram(datagram);
if (!_source->get_datagram(datagram)) {
return false;
}
datagram.set_stdfloat_double(_file_stdfloat_double);
return true;
}
////////////////////////////////////////////////////////////////////

View File

@ -142,26 +142,6 @@ init() {
_file_stdfloat_double = scan.get_bool();
}
#ifndef STDFLOAT_DOUBLE
bool need_stdfloat_double = false;
#else
bool need_stdfloat_double = true;
#endif
if (_file_stdfloat_double != need_stdfloat_double) {
if (_file_stdfloat_double) {
bam_cat.error()
<< "This bam file was written with 64-bit floats.\n";
bam_cat.error()
<< "This program can only read bam files with 32-bit floats.\n";
} else {
bam_cat.error()
<< "This bam file was written with 32-bit floats.\n";
bam_cat.error()
<< "This program can only read bam files with 64-bit floats.\n";
}
return false;
}
return true;
}

View File

@ -45,11 +45,7 @@ BamWriter(DatagramSink *target) :
_long_pta_id = false;
_file_endian = bam_endian;
#ifndef STDFLOAT_DOUBLE
_file_stdfloat_double = false;
#else
_file_stdfloat_double = true;
#endif
_file_stdfloat_double = bam_stdfloat_double;
_file_texture_mode = bam_texture_mode;
}
@ -689,6 +685,7 @@ flush_queue() {
}
Datagram dg;
dg.set_stdfloat_double(_file_stdfloat_double);
dg.add_uint8(_next_boc);
_next_boc = BOC_adjunct;

View File

@ -60,6 +60,19 @@ ConfigVariableEnum<BamEnums::BamEndian> bam_endian
"may set it to \"littleendian\" or \"bigendian\" to target a "
"particular platform."));
ConfigVariableBool bam_stdfloat_double
("bam-stdfloat-double",
#ifdef STDFLOAT_DOUBLE
true,
#else
false,
#endif
PRC_DESC("The default width of floating-point numbers to write to a bam "
"file. Set this true to force doubles (64-bit floats), or false "
"to force sinles (32-bit floats). The default is whichever width "
"Panda has been compiled to use natively. Normally, this setting "
"should not be changed from the default."));
ConfigVariableEnum<BamEnums::BamTextureMode> bam_texture_mode
("bam-texture-mode", BamEnums::BTM_relative,
PRC_DESC("Set this to specify how textures should be written into Bam files."

View File

@ -36,6 +36,7 @@ NotifyCategoryDecl(bam, EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL);
//extern EXPCL_PANDA_PUTIL const bool track_memory_usage;
extern EXPCL_PANDA_PUTIL ConfigVariableEnum<BamEnums::BamEndian> bam_endian;
extern EXPCL_PANDA_PUTIL ConfigVariableBool bam_stdfloat_double;
extern EXPCL_PANDA_PUTIL ConfigVariableEnum<BamEnums::BamTextureMode> bam_texture_mode;
BEGIN_PUBLISH

View File

@ -125,8 +125,18 @@ get_info(const Filename &filename) {
return false;
}
const char *endian = "little-endian";
if (bam_file.get_file_endian() == BamEnums::BE_bigendian) {
endian = "big-endian";
}
int float_width = 32;
if (bam_file.get_file_stdfloat_double()) {
float_width = 64;
}
nout << filename << " : Bam version " << bam_file.get_file_major_ver()
<< "." << bam_file.get_file_minor_ver() << "\n";
<< "." << bam_file.get_file_minor_ver()
<< ", " << endian << ", " << float_width << "-bit floats.\n";
Objects objects;
TypedWritable *object = bam_file.read_object();