You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
634 B
32 lines
634 B
#ifndef _CONTROL_H
|
|
#define _CONTROL_H
|
|
|
|
#include "main.h"
|
|
#include <gfx/vec3.h>
|
|
|
|
#define DEG_TO_RAD(angle) (angle*M_PI/180.0)
|
|
#define RAD_TO_DEG(angle) (angle*180.0/M_PI)
|
|
|
|
// a set of controls for objects and the camera. directly corresponds to
|
|
// OpenGL calls.
|
|
class Control {
|
|
public:
|
|
Vec3f pos;
|
|
double rot_angle; // in degrees
|
|
Vec3f rot_axis;
|
|
|
|
Control() : rot_angle(0)
|
|
{}
|
|
void apply_transform()
|
|
{
|
|
glTranslated(pos[0], pos[1], pos[2]);
|
|
glRotated(rot_angle, rot_axis[0], rot_axis[1], rot_axis[2]);
|
|
#if 0
|
|
// we don't use this
|
|
glScaled(scale[0], scale[1], scale[2]);
|
|
#endif
|
|
}
|
|
};
|
|
|
|
#endif // _CONTROL_H
|