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/2020 */
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
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
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
RMtexture
typedef struct RMtexture
{
RMimage *images[RM_MAX_MIPMAPS];
GLuint *appTextureID; /* these two could go in a union
since both are not simultaneously usable. */
int dims; /* 1, 2 or 3d texture */
int nmipmaps; /* number of mipmaps associated w/this texture */
/* 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
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 renderPassDims; /* to distinguish between 3D/2D traversals */
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
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 *);
/*
* 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);
/*
* new in 1.6.0 - special capabilities of the OpenGL implementation. */
RMpipeOGLCapabilities *caps;
/* new in 1.6.0 - RMpipe-level framebuffer clear controls. We use a
SG node to hold the RMpipe-level fbclear parameters as a roundabout
way of providing internal structure consistency for the routines that
generate PS output to avoid having yet another table of structs
for the fbclear objects. The extra level of indirection is something
of a PITA, but is less so than doing yet another managed table. */
RMnode *fbClearNode;
/*
* Each pipe has stack used to hold the attrib masks associated with
* each attrib push/pop. In some cases, we need to twiddle our local
* state tracker cache on pops to reflect changes to the actual
* OpenGL state that occur on push/pops. The local stack allows us to
* do so w/o having to query OpenGL, which would add some small cost. *
* The MAX_MASK_STACK_DEPTH value of 64 is >> the usual OpenGL
* attrib stack depth, which is usually around 8 or 16. */
#define MAX_MASK_STACK_DEPTH 64
GLuint localMaskStack[MAX_MASK_STACK_DEPTH];
int localMaskStackTop;
} RMpipe;
librm library source file: rmtypes.h
RMprimitive
typedef struct RMprimitive
{
RMenum type;
RMprimitiveDataBlob *blobs; /* verts, colors, norms, texture coords, etc. */
/* Feb 2005 - add support for multitextures */
RMprimitiveDataBlob *multiTextureCoordBlobs; /* only multitexture coords */
int multiTextureCoordBlobsMask;
int numMultiTextureCoordBlobs;
/* 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;
/* used by some primitives to track state of textures, etc. */
RMcacheKey utilCacheKey;
/* bounding box stuff */
RMvertex3D *bmin, *bmax;
RMenum (*primitiveComputeBoundingBoxFunc)(struct RMprimitive *);
} RMprimitive;
librm library source file: rmtypes.h