/* Public domain */ #ifndef _FREESG_SG_VIEW_H_ #define _FREESG_SG_VIEW_H_ #include struct sg_camera; /* Managed per-view texture. */ typedef struct sg_view_texture { void *node; /* Pointer to parent node */ struct sg_view *sv; /* Pointer to SG_View */ Uint name; /* GL texture handle */ int frame; /* Animation frame (optional) */ AG_TexCoord tc; /* Texture coordinates */ AG_TAILQ_ENTRY(sg_view_texture) textures; } SG_ViewTexture; /* Managed per-view display list. */ typedef struct sg_view_list { void *node; /* Pointer to parent node */ struct sg_view *sv; /* Pointer to SG_View */ Uint name; /* GL display list handle */ int frame; /* Animation frame (optional) */ AG_TAILQ_ENTRY(sg_view_list) lists; } SG_ViewList; typedef struct sg_view { struct ag_glview _inherit; Uint flags; #define SG_VIEW_HFILL 0x001 #define SG_VIEW_VFILL 0x002 #define SG_VIEW_EXPAND (SG_VIEW_HFILL|SG_VIEW_VFILL) #define SG_VIEW_NO_LIGHTING 0x004 /* Disable lighting */ #define SG_VIEW_NO_DEPTH_TEST 0x008 /* Disable Z-buffering */ #define SG_VIEW_UPDATE_PROJ 0x010 /* Update projection at next draw */ #define SG_VIEW_PANNING 0x020 /* Mouse panning in progress */ #define SG_VIEW_CAMERA_STATUS 0x040 /* Display camera status overlay */ #define SG_VIEW_EDIT 0x080 /* Allow edition commands */ #define SG_VIEW_EDIT_STATUS 0x080 /* Display edition status overlay */ #define SG_VIEW_BGFILL 0x100 /* Clear with background color */ SG *sg; /* Scene graph */ SG *sgTrans; /* For SG_ViewTransition */ Uint transFlags; #define SG_VIEW_TRANSFADE 0x01 /* Fade-out/fade-in */ AG_Timeout toTransFade; /* Timeout for fade */ float transProgress; /* Transition state */ AG_Color transFadeColor; /* Color for fade */ Uint transDuration; /* Duration for transition (ms) */ struct sg_camera *cam; /* Current camera */ struct sg_camera *camTrans; /* Transitioning to camera */ struct { int lx, ly; /* Last mouse position (for rotation) */ M_Vector3 rsens; /* Rotation sensitivity vector */ M_Vector3 tsens; /* Translation sensitivity vector */ } mouse; AG_PopupMenu *popup; /* Popup menu for context */ AG_Widget *editArea; /* Edit container widget */ SG_Node *editNode; /* Node being edited */ M_Real rot_yaw_incr; /* Base yaw increment */ M_Real rot_pitch_incr; /* Base pitch increment */ M_Real rot_roll_incr; /* Base roll increment */ M_Real trans_x_incr; /* Base translation increment */ M_Real trans_y_incr; M_Real trans_z_incr; int rot_vel_min; /* Rotation speed */ int rot_vel_accel; int rot_vel_max; int trans_vel_min; /* Translation speed */ int trans_vel_accel; int trans_vel_max; /* Internals used for rotation */ M_Real trans_x, trans_y, trans_z; M_Real rot_yaw, rot_pitch, rot_roll; AG_Timeout to_rot_yaw, to_rot_pitch, to_rot_roll; AG_Timeout to_trans_x, to_trans_y, to_trans_z; AG_Timeout to_move; char editStatus[128]; /* Edit status text */ } SG_View; #define SG_ViewSetBgColor(sv,c) AG_GLViewSetBgColor(AGGLVIEW(sv),c) __BEGIN_DECLS extern AG_WidgetClass sgViewClass; SG_View *SG_ViewNew(void *, SG *, Uint); int SG_ViewTransition(SG_View *, SG *, SG_Camera *, Uint); void SG_ViewSetFadeColor(SG_View *, AG_Color); void SG_ViewSetFadeDuration(SG_View *, Uint); void SG_ViewUnProject(SG_View *, int, int, M_Vector3 *, M_Vector3 *); void SG_ViewSetCamera(SG_View *, struct sg_camera *); __END_DECLS #include #endif /* _FREESG_SG_VIEW_H_ */