minor change

This commit is contained in:
Dave Schuyler 2003-08-06 02:52:50 +00:00
parent 3450df314f
commit a24f21767f
6 changed files with 20 additions and 15 deletions

View File

@ -133,7 +133,6 @@ handle_entries() {
LVecBase3f pos = trans->get_pos(); LVecBase3f pos = trans->get_pos();
pos[2] += adjust; pos[2] += adjust;
def._node->set_transform(trans->set_pos(pos)); def._node->set_transform(trans->set_pos(pos));
} else { } else {
// Otherwise, go ahead and do the matrix math to do things // Otherwise, go ahead and do the matrix math to do things
// the old and clumsy way. // the old and clumsy way.

View File

@ -228,7 +228,7 @@ get_global_clock() {
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE TimeVal:: INLINE TimeVal::
TimeVal(void) { TimeVal() {
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -237,7 +237,7 @@ TimeVal(void) {
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE ulong TimeVal:: INLINE ulong TimeVal::
get_sec(void) const { get_sec() const {
return tv[0]; return tv[0];
} }
@ -247,6 +247,6 @@ get_sec(void) const {
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE ulong TimeVal:: INLINE ulong TimeVal::
get_usec(void) const { get_usec() const {
return tv[1]; return tv[1];
} }

View File

@ -26,9 +26,9 @@
class EXPCL_PANDAEXPRESS TimeVal { class EXPCL_PANDAEXPRESS TimeVal {
PUBLISHED: PUBLISHED:
INLINE TimeVal(void); INLINE TimeVal();
INLINE ulong get_sec(void) const; INLINE ulong get_sec() const;
INLINE ulong get_usec(void) const; INLINE ulong get_usec() const;
ulong tv[2]; ulong tv[2];
}; };

View File

@ -22,6 +22,12 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE void LinearFrictionForce:: INLINE void LinearFrictionForce::
set_coef(float coef) { set_coef(float coef) {
// friction shouldn't be outside of [0, 1]
if (coef < 0.0f) {
coef = 0.0f;
} else if (coef > 1.0f) {
coef = 1.0f;
}
_coef = coef; _coef = coef;
} }
@ -30,6 +36,6 @@ set_coef(float coef) {
// Access : public // Access : public
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE float LinearFrictionForce:: INLINE float LinearFrictionForce::
get_coef(void) const { get_coef() const {
return _coef; return _coef;
} }

View File

@ -29,10 +29,10 @@ class EXPCL_PANDAPHYSICS LinearFrictionForce : public LinearForce {
PUBLISHED: PUBLISHED:
LinearFrictionForce(float coef = 1.0f, float a = 1.0f, bool m = false); LinearFrictionForce(float coef = 1.0f, float a = 1.0f, bool m = false);
LinearFrictionForce(const LinearFrictionForce &copy); LinearFrictionForce(const LinearFrictionForce &copy);
virtual ~LinearFrictionForce(void); virtual ~LinearFrictionForce();
INLINE void set_coef(float coef); INLINE void set_coef(float coef);
INLINE float get_coef(void) const; INLINE float get_coef() const;
virtual void output(ostream &out) const; virtual void output(ostream &out) const;
virtual void write(ostream &out, unsigned int indent=0) const; virtual void write(ostream &out, unsigned int indent=0) const;
@ -40,19 +40,19 @@ PUBLISHED:
private: private:
float _coef; float _coef;
virtual LinearForce *make_copy(void); virtual LinearForce *make_copy();
virtual LVector3f get_child_vector(const PhysicsObject *); virtual LVector3f get_child_vector(const PhysicsObject *);
public: public:
static TypeHandle get_class_type(void) { static TypeHandle get_class_type() {
return _type_handle; return _type_handle;
} }
static void init_type(void) { static void init_type() {
LinearForce::init_type(); LinearForce::init_type();
register_type(_type_handle, "LinearFrictionForce", register_type(_type_handle, "LinearFrictionForce",
LinearForce::get_class_type()); LinearForce::get_class_type());
} }
virtual TypeHandle get_type(void) const { virtual TypeHandle get_type() const {
return get_class_type(); return get_class_type();
} }
virtual TypeHandle force_init_type() {init_type(); return get_class_type();} virtual TypeHandle force_init_type() {init_type(); return get_class_type();}

View File

@ -97,7 +97,7 @@ make_copy() const {
LMatrix4f PhysicsObject:: LMatrix4f PhysicsObject::
get_lcs() const { get_lcs() const {
LMatrix4f m = LMatrix4f::translate_mat(_position); LMatrix4f m = LMatrix4f::translate_mat(_position);
if (_oriented == true) { if (_oriented) {
m=m*_orientation; m=m*_orientation;
} }
return m; return m;