build on linux

This commit is contained in:
David Rose 2005-09-06 18:18:56 +00:00
parent 9ad64a6b4b
commit dd28bafc68
4 changed files with 44 additions and 9 deletions

View File

@ -122,7 +122,7 @@ parse_rest(string &result) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool Shader:: bool Shader::
parse_eof(void) { parse_eof(void) {
return _text.size() == _parse; return (int)_text.size() == _parse;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -131,7 +131,7 @@ parse_eof(void) {
// Description: Allocates an integer index to the given // Description: Allocates an integer index to the given
// shader parameter name. // shader parameter name.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE int Shader:: int Shader::
arg_index(const string &id) { arg_index(const string &id) {
for (int i=0; i<(int)(_args.size()); i++) for (int i=0; i<(int)(_args.size()); i++)
if (_args[i] == id) if (_args[i] == id)

View File

@ -62,7 +62,6 @@ protected:
private: private:
Planef _plane; Planef _plane;
public: public:
static TypeHandle get_class_type() { static TypeHandle get_class_type() {
return _type_handle; return _type_handle;
@ -79,6 +78,8 @@ public:
private: private:
static TypeHandle _type_handle; static TypeHandle _type_handle;
friend class BoundingSphere;
}; };
#include "boundingPlane.I" #include "boundingPlane.I"

View File

@ -63,7 +63,7 @@ xform(const LMatrix4f &mat) {
if (!is_empty() && !is_infinite()) { if (!is_empty() && !is_infinite()) {
// First, determine the longest axis of the matrix, in case it // First, determine the longest axis of the matrix, in case it
// contains a non-proportionate scale. // contains a non-uniform scale.
/* /*
LVector3f x,y,z; LVector3f x,y,z;
@ -77,18 +77,18 @@ xform(const LMatrix4f &mat) {
*/ */
float xd,yd,zd,scale; float xd,yd,zd,scale;
#define ROW_DOTTED(mat,ROWNUM) \ #define ROW_DOTTED(mat,ROWNUM) \
(mat._m.m._##ROWNUM##0*mat._m.m._##ROWNUM##0 + \ (mat._m.m._##ROWNUM##0*mat._m.m._##ROWNUM##0 + \
mat._m.m._##ROWNUM##1*mat._m.m._##ROWNUM##1 + \ mat._m.m._##ROWNUM##1*mat._m.m._##ROWNUM##1 + \
mat._m.m._##ROWNUM##2*mat._m.m._##ROWNUM##2) mat._m.m._##ROWNUM##2*mat._m.m._##ROWNUM##2)
xd = ROW_DOTTED(mat,0); xd = ROW_DOTTED(mat,0);
yd = ROW_DOTTED(mat,1); yd = ROW_DOTTED(mat,1);
zd = ROW_DOTTED(mat,2); zd = ROW_DOTTED(mat,2);
scale = max(xd,yd); scale = max(xd,yd);
scale = max(scale,zd); scale = max(scale,zd);
scale = sqrtf(scale); scale = sqrtf(scale);
// Transform the radius // Transform the radius
_radius *= scale; _radius *= scale;
@ -439,6 +439,13 @@ contains_lineseg(const LPoint3f &a, const LPoint3f &b) const {
} }
} }
////////////////////////////////////////////////////////////////////
// Function: BoundingSphere::contains_sphere
// Access: Protected, Virtual
// Description: Double-dispatch support: called by contains_other()
// when the type we're testing for intersection is known
// to be a sphere.
////////////////////////////////////////////////////////////////////
int BoundingSphere:: int BoundingSphere::
contains_sphere(const BoundingSphere *sphere) const { contains_sphere(const BoundingSphere *sphere) const {
nassertr(!is_empty() && !is_infinite(), 0); nassertr(!is_empty() && !is_infinite(), 0);
@ -462,12 +469,38 @@ contains_sphere(const BoundingSphere *sphere) const {
} }
} }
////////////////////////////////////////////////////////////////////
// Function: BoundingSphere::contains_hexahedron
// Access: Protected, Virtual
// Description: Double-dispatch support: called by contains_other()
// when the type we're testing for intersection is known
// to be a hexahedron.
////////////////////////////////////////////////////////////////////
int BoundingSphere:: int BoundingSphere::
contains_hexahedron(const BoundingHexahedron *hexahedron) const { contains_hexahedron(const BoundingHexahedron *hexahedron) const {
return hexahedron->contains_sphere(this) & ~IF_all; return hexahedron->contains_sphere(this) & ~IF_all;
} }
////////////////////////////////////////////////////////////////////
// Function: BoundingSphere::contains_line
// Access: Protected, Virtual
// Description: Double-dispatch support: called by contains_other()
// when the type we're testing for intersection is known
// to be a line.
////////////////////////////////////////////////////////////////////
int BoundingSphere:: int BoundingSphere::
contains_line(const BoundingLine *line) const { contains_line(const BoundingLine *line) const {
return line->contains_sphere(this) & ~IF_all; return line->contains_sphere(this) & ~IF_all;
} }
////////////////////////////////////////////////////////////////////
// Function: BoundingSphere::contains_plane
// Access: Protected, Virtual
// Description: Double-dispatch support: called by contains_other()
// when the type we're testing for intersection is known
// to be a plane.
////////////////////////////////////////////////////////////////////
int BoundingSphere::
contains_plane(const BoundingPlane *plane) const {
return plane->contains_sphere(this) & ~IF_all;
}

View File

@ -76,6 +76,7 @@ protected:
virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const; virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const;
virtual int contains_sphere(const BoundingSphere *sphere) const; virtual int contains_sphere(const BoundingSphere *sphere) const;
virtual int contains_line(const BoundingLine *line) const; virtual int contains_line(const BoundingLine *line) const;
virtual int contains_plane(const BoundingPlane *plane) const;
private: private:
LPoint3f _center; LPoint3f _center;