coeng

diff src/co_phys.h @ 6:2f872a179914

first component test: - prs, xform, physics components with dependencies - topological sort of components to update them in the correct order - debug visualization component todo: remove draw() from components, doesn't make sense
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 14 Feb 2015 07:27:12 +0200
parents 0e5da17d589c
children 8cce82794f90
line diff
     1.1 --- a/src/co_phys.h	Sat Feb 14 01:35:42 2015 +0200
     1.2 +++ b/src/co_phys.h	Sat Feb 14 07:27:12 2015 +0200
     1.3 @@ -3,15 +3,27 @@
     1.4  
     1.5  #include <vmath/vmath.h>
     1.6  #include "comp.h"
     1.7 +#include "co_xform.h"
     1.8 +
     1.9 +class SimWorld;
    1.10  
    1.11  class CoRigid : public Component {
    1.12 +protected:
    1.13 +	CoPRS *co_prs; // cached PRS component of the parent object
    1.14 +
    1.15 +	const char **update_before() const;
    1.16 +
    1.17  public:
    1.18 +	SimWorld *world;
    1.19  	float mass, elast, friction;
    1.20 -	Vector3 pos, vel;
    1.21 +	Vector3 vel, force;
    1.22 +	Vector3 impulse;
    1.23  
    1.24  	CoRigid();
    1.25  
    1.26 -	void update();
    1.27 +	void add_impulse(const Vector3 &v);
    1.28 +
    1.29 +	void update(float dt);
    1.30  };
    1.31  
    1.32  #endif	// COMP_PHYS_H_