void right_thigh(){ glPushMatrix(); glColor3f(1.0, 1.0, 1.0); glTranslatef(0.33, -1.33, 0.0); glScalef(0.33, 1.0, 0.0); glRotatef(theta[0], 1.0, 0.0, 0.0); drawCube(); right_leg(); glPopMatrix(); }
void robot(){ matrixPush(ModelView); matrixRotate(ModelView, torso_angle, 0, 0, 1); torso(); matrixPush(ModelView); matrixTranslate(ModelView, 0, 10.2, 0); matrixRotate(ModelView, head_angle, 0, 0, 1); head(); matrixPush(ModelView); matrixTranslate(ModelView, .5, 2.5, 0); eye(); matrixPop(ModelView); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, -4.5, 7, 0); matrixRotate(ModelView, -45, 0, 0, 1); arm(left_upper_arm_angle, left_lower_arm_angle, left_wrist_angle); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, 4.5, 7, 0); matrixRotate(ModelView, 45, 0, 0, 1); arm(right_upper_arm_angle, right_lower_arm_angle, right_wrist_angle); matrixPop(ModelView); matrixPush(ModelView); lower_torso(); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, -2, -1.5, 0); matrixRotate(ModelView, -30, 0, 0, 1); leg(left_upper_leg_angle, left_lower_leg_angle, left_foot_angle); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, 2, -1.5, 0); matrixRotate(ModelView, 30, 0, 0, 1); right_leg(right_upper_leg_angle, right_lower_leg_angle, right_foot_angle); matrixPop(ModelView); matrixPop(ModelView); }
int main() { std::cout << "Robot with semaphore" << std::endl; robot_semaphore i_am_robot; std::thread right_leg(step_func<robot_semaphore>, std::ref(i_am_robot), right); std::thread left_leg(step_func<robot_semaphore>, std::ref(i_am_robot), left); right_leg.join(); left_leg.join(); std::cout << "Robot with cv" << std::endl; robot_cv i_am_robot_too; right_leg = std::thread(step_func<robot_cv>, std::ref(i_am_robot_too), right); left_leg = std::thread(step_func<robot_cv>, std::ref(i_am_robot_too), left); right_leg.join(); left_leg.join(); return 0; }
Body::Body() { Leg left_leg( p21, p22, p23, LEFT ); Leg right_leg( p24, p25, p26, RIGHT ); }