X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=antikythera;a=blobdiff_plain;f=src%2Fgear.h;h=fac245c19152c859d41c3b0e9cd5927c4ca135d5;hp=e8796e90c56de7cdb1125a9c9d7b2d03a895c3f2;hb=b27d1ee9fe9f75f2af783e4f9574366879f5e849;hpb=80bcc959131067cc774b85cc1f63e81d8b5a012a diff --git a/src/gear.h b/src/gear.h index e8796e9..fac245c 100644 --- a/src/gear.h +++ b/src/gear.h @@ -39,7 +39,7 @@ class Gear { private: Mesh *mesh; - mutable Mat4 xform, dir_xform; + mutable Mat4 xform, dir_xform, axel_xform; mutable bool xform_valid; void calc_matrix() const; @@ -58,6 +58,7 @@ public: float angle; // current angle of the gear int nteeth; // number of teeth + float tooth_pitch; float radius; // total radius of the gear, including teeth float teeth_length; // how far teeth extend past the radius @@ -65,19 +66,31 @@ public: float bevel; // bevel size + // visual surface properties + Vec3 color; + float roughness; + bool metallic; + + Gear *supergear; + std::vector subgears; std::vector pins; std::vector slots; Gear(); ~Gear(); + void attach(Gear *g); + bool detach(Gear *g); + Gear *get_super() const; + void set_angular_offset(float offs); float get_angular_offset() const; // sets the supplied number of teeth, and calculates the radius // of the gear, to achieve the required tooth pitch - void set_teeth(int nt, float tooth_pitch); + void set_teeth(int nt, float tooth_pitch = 0.0f); void set_axis(const Vec3 &axis); + const Vec3 &get_axis() const; void set_position(const Vec3 &pos); const Vec3 &get_position() const; Vec3 get_global_position() const; // taking parent gear into account