fixed libresman renamed resman_lookup to resman_add
[antikythera] / src / gear.h
index 7f230e4..5f99dd5 100644 (file)
@@ -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;
 
@@ -52,12 +52,13 @@ public:
         */
        std::string name;
        Vec3 pos, axis; // implicitly defines a plane eqn.
-       float pdist;    // derived: distance of plane from origin
+       float pdist;    // derived from the above: distance of plane from origin
 
        float init_angle;       // initial starting angle
        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,18 +66,29 @@ public:
 
        float bevel;    // bevel size
 
+       // visual surface properties
+       Vec3 color;
+       float roughness;
+       bool metallic;
+
+       Gear *supergear;
+       std::vector<Gear*> subgears;
        std::vector<GearPin> pins;
        std::vector<GearSlot> 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);