/* Public domain */ typedef struct sg_camera_polymode { enum { SG_CAMERA_POINTS, SG_CAMERA_WIREFRAME, SG_CAMERA_FLAT_SHADED, SG_CAMERA_SMOOTH_SHADED } mode; int cull; } SG_CameraPolyMode; typedef struct sg_camera { struct sg_node _inherit; Uint flags; #define SG_CAMERA_ROT_I 0x01 /* Artificial rotation around i (debug) */ #define SG_CAMERA_ROT_J 0x02 /* Artificial rotation around j (debug) */ #define SG_CAMERA_ROT_K 0x04 /* Artificial rotation around k (debug) */ enum sg_camera_pmode { SG_CAMERA_PERSPECTIVE, /* Perspective projection */ SG_CAMERA_ORTHOGRAPHIC, /* Parallel projection */ SG_CAMERA_USER_PROJ /* User-specified */ } pmode; SG_CameraPolyMode polyFace; /* Front-facing polygon modes */ SG_CameraPolyMode polyBack; /* Back-facing polygon modes */ M_Real fov; /* Field of view (radians) */ M_Real aspect; /* Aspect ratio */ M_Real near, far; /* Clipping planes */ M_Matrix44 userProj; /* User projection matrix (column-major) */ enum sg_camera_rotctrl { SG_CAMERA_ROT_IGNORE, /* Disable rotation control */ SG_CAMERA_ROT_CIRCULAR, /* Circular path (1 node) */ SG_CAMERA_ROT_ELLIPTIC /* Elliptic path (2 nodes) */ } rotCtrl; SG_Node *focus[2]; /* Center nodes */ M_Real rotSpeed; /* For artificial rotate */ } SG_Camera; __BEGIN_DECLS extern SG_NodeClass sgCameraClass; SG_Camera *SG_CameraNew(void *, const char *); SG_Camera *SG_CameraNewDuplicate(void *, const char *, const SG_Camera *); void SG_CameraFrustum(SG_Camera *, M_Rectangle3 *, M_Rectangle3 *); void SG_CameraProject(SG_Camera *); void SG_CameraGetProjection(SG_Camera *, M_Matrix44 *); void SG_CameraSetBackPolyMode(SG_Camera *, const SG_CameraPolyMode *); void SG_CameraSetFacePolyMode(SG_Camera *, const SG_CameraPolyMode *); void SG_CameraSetPerspective(SG_Camera *, M_Real, M_Real); void SG_CameraSetOrthographic(SG_Camera *); void SG_CameraSetUser(SG_Camera *, const M_Matrix44 *); void SG_CameraSetClipPlanes(SG_Camera *, M_Real, M_Real); void SG_CameraSetup(SG_Camera *); void SG_CameraRotMouse(SG_Camera *, struct sg_view *, int, int); void SG_CameraSetRotCtrlCircular(SG_Camera *, SG_Node *); void SG_CameraSetRotCtrlElliptic(SG_Camera *, SG_Node *, SG_Node *); __END_DECLS