97 lines
1.8 KiB
C
97 lines
1.8 KiB
C
/*************************************************************************/
|
|
/* Types.h
|
|
/*************************************************************************/
|
|
#ifndef GRAPH_STATE_H
|
|
#define GRAPH_STATE_H
|
|
|
|
#include "types.h"
|
|
#include "stack.h"
|
|
|
|
#define PI 3.1415926535897932384626433832795
|
|
#define NUM_COORD_SYSTEMS 6
|
|
|
|
typedef struct _sdisplay_t
|
|
{
|
|
char *name;
|
|
RtToken type;
|
|
RtToken mode;
|
|
|
|
} display_t;
|
|
|
|
typedef struct _sprojection_t
|
|
{
|
|
RtToken type;
|
|
RtFloat fov;
|
|
uint32_t flags;
|
|
|
|
} projection_t;
|
|
|
|
typedef struct _sformat_t
|
|
{
|
|
RtInt xres;
|
|
RtInt yres;
|
|
RtFloat ar_f;
|
|
RtFloat ar_p;
|
|
|
|
} format_t;
|
|
|
|
typedef struct _sopt_t
|
|
{
|
|
display_t display;
|
|
projection_t projection;
|
|
format_t format;
|
|
RtFloat crop[4];
|
|
RtFloat screen[4];
|
|
RtFloat clipping[2];
|
|
|
|
} opt_t;
|
|
|
|
typedef struct _sattr_t
|
|
{
|
|
RtColor cs;
|
|
RtFloat shadingrate;
|
|
RtPointer ubasis, vbasis;
|
|
RtInt ustep, vstep;
|
|
RtInt nsides;
|
|
|
|
} attr_t;
|
|
|
|
typedef struct _sxform_t
|
|
{
|
|
RtMatrix space[NUM_COORD_SYSTEMS];
|
|
|
|
} xform_t;
|
|
|
|
typedef struct _sgraph_state_t
|
|
{
|
|
uint32_t frame;
|
|
uint32_t context;
|
|
uint32_t curr_xform;
|
|
opt_t *pOpt;
|
|
attr_t *pAttr;
|
|
xform_t *pXform;
|
|
stack_t *pOpt_stack;
|
|
stack_t *pAttr_stack;
|
|
stack_t *pXform_stack;
|
|
RtMatrix *pXform_curr;
|
|
|
|
} graph_state_t;
|
|
|
|
enum eSpaces
|
|
{
|
|
object_space = 0, world_space, camera_space, screen_space, raster_space, ndc_space
|
|
};
|
|
|
|
void GS_init(graph_state_t *pObj);
|
|
void GS_free(graph_state_t *pObj);
|
|
void GS_opt_push(graph_state_t *pObj);
|
|
void GS_opt_pop(graph_state_t *pObj);
|
|
void GS_attr_push(graph_state_t *pObj);
|
|
void GS_attr_pop(graph_state_t *pObj);
|
|
void GS_xform_push(graph_state_t *pObj);
|
|
void GS_xform_pop(graph_state_t *pObj);
|
|
void GS_xform_set(graph_state_t *pObj, uint32_t id);
|
|
|
|
#endif // GRAPH_STATE_H
|
|
|