OpenRM - RM Library (rmtypes.h)

## Index of OpenRM - RM Library

RMcolor1D

    typedef struct RMcolor1D
    {
        float lum;
    } RMcolor1D;

librm library source file: rmtypes.h

RMcolor2D

    typedef struct RMcolor2D
    {
        float lum, alpha;
    } RMcolor2D;

librm library source file: rmtypes.h

RMcolor3D

    typedef struct RMcolor3D
    {
        float r, g, b;
    } RMcolor3D;

librm library source file: rmtypes.h

RMcolor4D

    typedef struct RMcolor4D
    {
        float r, g, b, a;
    } RMcolor4D;

librm library source file: rmtypes.h

RMvertex2D

    typedef struct RMvertex2D
    {
        float x, y;
    } RMvertex2D;

librm library source file: rmtypes.h

RMvertex3D

    typedef struct RMvertex3D
    {
        float x, y, z;
    } RMvertex3D;

librm library source file: rmtypes.h

RMvertex4D

    typedef struct RMvertex4D
    {
        float x, y, z, w;
    } RMvertex4D;

librm library source file: rmtypes.h

RMmatrix

    typedef struct RMmatrix
    {
        float m[4][4];
    } RMmatrix;

librm library source file: rmtypes.h

RMcacheKey;

    typedef unsigned int RMcacheKey;
    #define RM_CACHEKEY_UNINITIALIZED_VALUE (unsigned int)(-1)

    #if 0
    /* 64 bit cache key */
    typedef unsigned long RMcacheKey;
    #endif

    typedef struct RMinternalMarker2D
    {
        int         npts;
        int         gl_begin_flag;
        RMvertex2D *vlist;
    } RMinternalMarker2D;

librm library source file: rmtypes.h

RMvisMap

    typedef struct RMvisMap
    {
        int   nentries;
        float r[MAX_VIS_CMAP_ENTRIES];
        float g[MAX_VIS_CMAP_ENTRIES];
        float b[MAX_VIS_CMAP_ENTRIES];
        float a[MAX_VIS_CMAP_ENTRIES];
        float transfer_min, transfer_max;
    } RMvisMap;

librm library source file: rmtypes.h

RMbitmap

    typedef struct RMbitmap
    {
        int            w, h;
        int            bytes_per_scanline;
        int            pbsize;
        unsigned char *pixeldata;
    } RMbitmap;

librm library source file: rmtypes.h

RMimage

    typedef struct RMimage
    {
        /* configuration */
        int    ndims;		/* 2 or 3, set implicitly by user */
        int    w, h, d;		/* set by user */
        RMenum image_format;	/* set by user: RM_IMAGE_RGB, etc. */
        RMenum image_type;		/* set by user: RM_IMAGE_BYTE, etc. */
        float  xzoom, yzoom;	/* for 2d images only, user supplied, default 1.0, 1.0 */

        /* pixel data */
        RMenum copy_flag;		 /* set by user */
        void  *pixeldata;		 /* set by user */
        void (*appfreefunc)(void *); /* set by user */

        /* colormap */
        RMvisMap *vismap;		 /* set by user, default NULL */

        /* scale & bias */
        float scale, bias;

        /* internals, private */
        int          bytes_per_component; /* computed by RM */
        int          bytes_per_scanline;  /* computed by RM */
        int          elements;	      /* computed by RM */
    #if 0
        /* display list stuff removed 10/5/2000 */
        int          d1;
        RMenum       dirty_flag;
    #endif
        unsigned int pbsize;

        /* internal, component manager */
        int          compListIndx;

        /* internal, context cache key */
        RMcacheKey   cacheKey;
    } RMimage;

librm library source file: rmtypes.h

RMcamera2D

    typedef struct RMcamera2D
    {
        float xmin, ymin, xmax, ymax;  /* defines extents of camera (like a viewport, but in R2 world coords) */
        float aspect_ratio;
    } RMcamera2D;

librm library source file: rmtypes.h

RMcamera3D

    typedef struct RMcamera3D
    {
        /* camera points */
        RMvertex3D eye;
        RMvertex3D at;
        RMvertex3D up;

        float  hither, yon; 		/* near & far */
        float  fov;				/* field of view angle in degrees in the Y direction */
        float  aspect;			/* aspect ratio (width / height) --> field of view angle in X direction */
        RMenum projection;			/* may be RM_PROJECTION_PERSPECTIVE or RM_PROJECTION_ORTHOGRAPHIC */
        RMenum isStereo;			/* flag for stereo (RM_TRUE or RM_FALSE) */
        float  degrees_eye_separation;	/* for stereo cameras only */
        float  focalDistance;		/* for stereo cameras only */
    } RMcamera3D;

librm library source file: rmtypes.h

RMtextProps

    typedef struct RMtextProps
    {
        int    fontEnum;		/* one of RM_FONT_SERIF,RM_FONT_SANS, RM_FONT_MONO, RM_FONT_SYMBOL */
        RMenum    italicEnum;		/* RM_TRUE or RM_FALSE */
        RMenum    boldEnum;		/* RM_TRUE or RM_FALSE */
        int    sizeEnum; 		/* enum of RM_FONT_XXS, RM_FONT_XS, RM_FONT_S, RM_FONT_M, RM_FONT_L, RM_FONT_XL, RM_FONT_XXL */
        RMenum hJustify, vJustify;
        int    listbase;		/* OpenGL dislay list base (computed by RM at runtime) */
        int    listoffset;		/* OpenGL display list stuff (computed by RM at runtime) */
        void  *fontinfo;

        int    compListIndx;
    } RMtextProps;

librm library source file: rmtypes.h

RMclipPlane

    typedef struct RMclipPlane
    {
        RMenum     enabled;		/* RM_TRUE, RM_FALSE */
        RMvertex3D point;
        RMvertex3D normal;		/* (point, normal) parametrization */
       float       a, b, c, d;	/* plane equation */
    } RMclipPlane;

librm library source file: rmtypes.h

RMlight

    typedef struct RMlight
    {
       /* individual light ala OpenGL Light (see glLight) */
        RMenum     ltype;			/* RM_LIGHT_POINT, RM_LIGHT_DIRECTIONAL, RM_SPOT */
        RMcolor4D  ambientLightColor;
        RMcolor4D  diffuseLightColor;
        RMcolor4D  specularLightColor;
        RMvertex3D lightXYZ;		/* position for point and spot lights, direction for directional light sources */
        float      spotCutoff;		/* [0.0, 90.0] degrees */
        float      spotExponent;		/* default = 0.0, higher numbers produce more focused spots */
        RMvertex3D spotDirection;
        float      constantAttenuation;
        float      linearAttenuation;
        float      quadraticAttenuation;
        RMenum     enabled;			/* RM_TRUE or RM_FALSE */
    } RMlight;

librm library source file: rmtypes.h

RMlightModel

    typedef struct RMlightModel
    {
        /* light model parms ala OpenGL Light Model (see glLightModel) */
        RMcolor4D globalAmbient;
        GLenum    twoSideEnable;
        GLenum    localViewerEnable;
    } RMlightModel;

librm library source file: rmtypes.h

RMtexture

    typedef struct RMtexture
    {
        RMimage   *images[RM_MAX_MIPMAPS];

        int       dims;			/* 1, 2 or 3d texture */
        int       nmipmaps;			/* number of mipmaps associated w/this texture */
    #if 0
        GLuint    tname;			/* generated by glGenTextures */
    #endif

        /* flags for OpenGL */
        GLenum    mag_filter_mode;		/* for GL_TEXTURE_MAG_FILTER */
        GLenum    min_filter_mode;		/* for GL_TEXTURE_MIN_FILTER */
        GLenum    wrap_mode;		/* applied to each of u, v, w */

        /* OpenGL has extra options for texel storage modes */
        GLenum    *oglTexelFormat;		/* GL_RGBA, GL_RGB, etc. default is GL_RGBA */

        /* environment modes */
        GLenum     envMode;			/* see man glTexEnv */
        RMcolor4D *blendColor;		/* see man glTexEnv */

        int        borderWidth;		/* texture border */

        /* residency status currently not used. */
        RMenum     residency_status;	/* internal: RM_TRUE or RM_FALSE */

        /* for the component manager */
        int        compListIndx;

        /* internal, context cache keys for texture IDs and texture data */
        RMcacheKey  cacheKeyID;
        RMcacheKey  cacheKeyData;

        /* reference counting - indicates whether or not a shared texture is
           assigned as a scene parameter to an RMnode */
        int         refCount;
    } RMtexture;

librm library source file: rmtypes.h

RMfog

    typedef struct RMfog
    {
        GLenum    fogMode;		/* GL_LINEAR, GL_EXP or GL_EXP2, def GL_LINEAR */
        GLfloat   fogDensity;	/* default = 1.0 */
        GLfloat   fogStart;		/* default is 0.0 */
        GLfloat   fogEnd;		/* default is 1 */
        RMcolor4D fogColor;		/* default is 0,0,0,0 */
    } RMfog;

librm library source file: rmtypes.h

RMstate

    typedef struct RMstate
    {
        RMmatrix      model;		/* model transformations */
        RMmatrix      view;			/* viewing transformations */
        RMmatrix      modelView;		/* combined model & view (OGL style) */
        RMmatrix      projection;		/* projection matrix */
        RMmatrix      composite;	        /* model*view*projection */
        RMmatrix      pick;			/* pick matrix */
        RMmatrix      textureMatrix;	/* texture matrix */
        RMmatrix      projection_inverse;	/* inverse of the concatenated view & projection matrices  (?) */
        RMmatrix      vpm;			/* viewport matrix - from NDC to window */
        float         vp[4];		/* (x, y) VP location + (w, h) VP width & height */
        float         aspect_ratio;
        float         focal_length;
        int           w, h;			/* window width & height */
        RMenum        rendermode;
        RMenum        renderpass;
        RMenum        which_channel;	/* used */
        RMtexture    *texture;		/* current texture */
        int           texture_mode;		/* if current texture, GL_TEXTURE_2D, etc. */
        int           attrib_stack_depth;	/* current attribute stack depth */

        /* material properties */
        RMcolor4D     ambient;
        RMcolor4D     diffuse;
        RMcolor4D     specular;
        RMcolor4D     emissive;
        RMcolor4D     unlit_color;
        float         specular_exponent;
        float         opacity;

        /* line & point style */
        float         pointsize;
        RMenum        linewidth;
        RMenum        linestyle;

        /* render mode parms */
        RMenum        shademodel;

        /* polygon face properties */
        RMenum        poly_mode_face;
        RMenum        poly_mode_drawstyle;
        RMenum        cull_mode;		/* cull faces? [RM_CULL_NONE, RM_CULL_FRONT, RM_CULL_BACK, RM_CULL_FRONT_AND_BACK] */
        RMenum        front_face;   	/* vertex winding? [RM_CCW, RM_CW] */

        /* clip planes */
        RMclipPlane  *cp0;
        RMclipPlane  *cp1;
        RMclipPlane  *cp2;
        RMclipPlane  *cp3;
        RMclipPlane  *cp4;
        RMclipPlane  *cp5;

        /* fog */
        RMenum       fogActive;	/* RM_TRUE if fog is active */
        RMfog        fog;		/* rather than creating copies */

        /* lighting */
        RMlightModel *lmodel;
        RMlight      *lightSources[RM_MAX_LIGHTS];

        /* text */
        RMtextProps  *textProps;

        int          frameNumber;

        /* internal use only */
        RMenum       colorMaterialActive;
        RMenum       lightingActive;
    } RMstate;

librm library source file: rmtypes.h

RMnode

    typedef struct RMnode
    {
        /* scene graph topology */
        struct RMnode  *parent;
        int             nchildren;
        struct RMnode **children;

        /* here's the geometry */
        int             nprims;
        void          **prims;

        /* properties */
        _surface_properties    *sprops;
        _rendermode_properties *rprops;
        internals_RMsceneParms *scene_parms;

        /* fb clear control */
        internals_RMfbClear    *fbClear;

        /* bounding box info */
        _bounding_box           bbox;
        RMvertex3D              center;

        /* transformation info */
        internals_RMtransformationStruct *transforms;

        /* misc scheduling info about the object */
        _object_info object_info;

        /* callbacks */
        int (*viewPretraverseCallback)    (const struct RMnode *, const RMstate *);
        int (*viewPosttraverseCallback)   (const struct RMnode *, const RMstate *);

        int (*renderPretraverseCallback)    (const struct RMnode *, const RMstate *);
        int (*renderPosttraverseCallback)   (const struct RMnode *, const RMstate *);
        int (*viewSwitchCallback) (const struct RMnode *, const RMstate *);
        /*
         * 7/22/02. added view (stage) render order callback. note that the
         * switch callback and renderOrder callbacks are (or should be)
         * mutually-exclusive. such mutual-exclusivity is not reflected in
         * the data structure or in the API at this time.
         */
        int (*viewRenderOrderCallback) (const struct RMnode *, const RMstate *, int *orderIndices, int nChildren);

        /* client data stuff - not multistage safe! (1/2001) */
        void  *clientData;
        void (*clientDataFreeFunc) (struct RMnode *, void *);

        int  refcount;

        /* attribute mask */
        GLuint   attribMask;

        /* optional mutex */
        RMmutex *nodeMutex;

        /* internal, component manager */
        int          compListIndx;
    } RMnode;

librm library source file: rmtypes.h

RMcontextCache

    typedef struct RMcontextCache
    {
        /* for RMprimitives */
        GLuint      *primDisplayListIDs;
        RMcacheKey  *primCacheKeys;
        int          numPrimDisplayListIDs;
        int          numPrimCacheKeys;

        /* for RMimages */
        GLuint      *imgDisplayListIDs;
        RMcacheKey  *imgCacheKeys;
        int          numImgDisplayListIDs;
        int          numImgCacheKeys;

        /* for RMtextures */
        GLuint      *textureIDs;
        RMcacheKey  *textureIDCacheKeys; /* textureID management */
        RMcacheKey  *textureDataCacheKeys; /* texture image data status */
        int          numTextureIDs;
        int          numTextureIDCacheKeys;
        int          numTextureDataCacheKeys;

        /* need to add this stuff VVVV  */

        /* RM-built display lists for quadrics objects */
        GLuint      *sphereIDs;
        GLuint      *coneIDs, *flipConeIDs;
        GLuint      *cylinderIDs, *flipCylinderIDs;

        /* pre-rendered bitmap font glyph display list IDs  */
        RMfontRegistry *pipeFontRegistry;

    } RMcontextCache;

librm library source file: rmtypes.h

RMpipe

    typedef struct RMpipe
    {
        /* stuff common to all environments/OpenGL implementations */
        RMenum       offscreen; /* RM_TRUE for offscreen formats, RM_FALSE otherwise */
        RMenum       processingMode;

        RMenum       channel_format;
        int          xwindow_width, xwindow_height;
        int          xflags;
        RMenum       opaque3DEnable, transparent3DEnable, opaque2DEnable;
        RMenum       initMatrixStack;	/* RM_TRUE or RM_FALSE */
        int          frameNumber;

        /* global control over use of display lists */
        RMenum       displayListEnableBool;

        /* Context Cache stuff */
        RMcontextCache *contextCache; /* the context cache */

        void *displayLists;     /* multistage rendering buffers. Note: these are
    			     NOT OpenGL display lists!! This buffer contains
    			     structures generated by the view-stage traversal
    			     that are consumed by the draw-stage traversal */

        void *mtControl;        /* multistage process/thread control structure */

    #ifdef RM_X
        /* stuff specific to X */
        Display     *xdisplay;
        XVisualInfo *xvisual;
        Window       xdrawable;
        GLXContext   glxcontext;
        Colormap     xcolormap;
    #endif

    #ifdef RM_WIN
        /* stuff specific to Win32 */
        HDC    hdc;
        HWND   hwnd;
        HGLRC  hRC;
    #endif

    #ifdef RM_CR
        /* stuff specific to Chromium */
        int    contextCR;
        RMpipeCRvariables *crStuff;  /* see rmcr.c */
    #endif

        int myRank, globalNPE;
        RMenum targetPlatform;

        /* pipe callbacks, all platforms */
        /* 1. render function */
        void (*channel_render_func)(RMnode *t, struct RMpipe *p);

        /*
         * 2. optional app callback invoked after rendering, but before
         * the "swapbuffers" call. can be used to perform synchronization
         * between multiple rendering engines.
         */
        void (*postRenderBarrierFunc)(struct RMpipe *p);

        /* 3. color and depth buffer acquisition, swap buffer function */
        void (*postrenderfunc)(const RMimage *, RMenum whichBufferEnum);
        void (*postrender_depthbufferfunc)(const RMimage *, RMenum whichBufferEnum);
        /* 4. swap buffers func */
        RMenum (*swapBuffersFunc)(const struct RMpipe *);

        /* 5. shutdown function */
        void (*shutdownFunc)(struct RMpipe *);

        /* private stuff */
        /*
         * 12/26/02 - specialized barrier functions added during Chromium work.
         * for now, these funcs are added outside of the RM_CR def to minimize
         * the amount of arch-specific stuff.
         */
        void (*postFBClearBarrierFunc)(const struct RMpipe *p);

        /*
         * context creation function - a per-platform thing
         */
        RMenum (*createContextFunc)(struct RMpipe *p);

        /*
         * stuff related to constant time rendering
         */
    #define MAX_FRAME_SAMPLES 6
        int          targetFrameRate; /* frames per sec, set by user */
        RMtime       timePerFrame;    /* fps converted to sec/usec */
        double       timePerFrameMS;  /* ms per frame */
        RMtime       lastTimeStart;        /* when was last frame started? */
        RMtime       lastRenderTime;  /* elapsed time for last rendering */

        /* the timeSyncFunc is used as a post-render, pre-swapbuffers
           rendezvous point */
        void         (*timeSyncFunc)(struct RMpipe *p);
    } RMpipe;

librm library source file: rmtypes.h

RMprimitiveDataBlob

    typedef struct RMprimitiveDataBlob
    {
        void  *ptr;				/* pointer to the stuff */
        RMenum copyflag;
        int    nthings;			/* how many things there are */
        int    blobtype;			/* what kind of blob? */
        int    stride;			/* size of individual thing */
        int    veclen;			/* vector length of data supplied */
        void (*appfreefunc)(void *);	/* the app-supplied free function for when the copy-flag is set to RM_DONT_COPY_DATA */
    } RMprimitiveDataBlob;

librm library source file: rmtypes.h

RMprimitive

    typedef struct RMprimitive
    {
        RMenum               type;
        RMprimitiveDataBlob *blobs;

        /* methods, data, flags */
        void (*renderfunc)  OGLPRIMPARMLIST();	/* RMprimitive stores a pointer to the primitive draw method */
        void  *clientData;
        void (*clientDataFreeFunc) (struct RMprimitive *p, void *cd);
        void  *p1;					/* stuff that doesn't really fit into blobs */

        /* misc stuff - usage depends upon app */
        unsigned int flags1;
        unsigned int model_flag;
        int          display_list_enable;

        /* old stuff for compatibility */
        int    utility;

        /* internal, component manager */
        int          compListIndx;

        /* internal, context cache key */
        RMcacheKey   cacheKey;

        /* bounding box stuff */
        RMvertex3D   *bmin, *bmax;
        RMenum       (*primitiveComputeBoundingBoxFunc)(struct RMprimitive *);

    } RMprimitive;

librm library source file: rmtypes.h

RMpick

    typedef struct RMpick
    {
        RMnode      *node;
        float        zval;		/* NDC z-value */
        unsigned int index;		/* object index */
        unsigned int prim_index;	/* primitive index */
    } RMpick;

librm library source file: rmtypes.h