REC: shared data segment - Camera & Lighting(1997R2 camera & light memory formats.) |
|
Main Page Document index Camera section. Light section. Data Block diagrams. |
To support interoption with other external editing tools, REC will create and monitor shared memory segments with its current camera and lighting information. Camera information is stored in the 'MCCM' block, and includes the current camera position, direction, and flags for signalling changes. Lighting information is stored in the 'MCLT' block, and includes an ambient entry, 24 light entries, and an array for signalling changes at the individual light level.
The module mcshar_access.c provides interfaces for linking into the two shared memory blocks:
These functions are prototyped in mcshare.h as well as all the camera and lighting data structures described below. Camera information is stored as a position vector (floats) and an orientation quaternion (floats). typedef struct { mc_vector position; float s, i, j, k; } mc_camera;In addition, the camera memory area includes signalling flags indicating the current camera number, if changes have been made, and if the current visual in REC is mirrored. The entire memory space of 'MCCM' is thus: typedef struct { long count, changecamera, ismirror; mc_camera current; } mcshare_camera;REC owns and updates CAMERA and marks CHANGECAM as necessary.
Light information is stored as a mc_ambient record, an array of 24 mc_light records, and associated update/change flags. Ambient lighting is stored as brightness & color values (float), its structure is: typedef struct { float i, r, g, b; } mc_ambient;Lights include the same color information as well as a four entry position vector (x, y, z, w): typedef struct { float i, r, g, b; mc_extvector position; } mc_light;The entire 'MCLT' includes mc_ambient, an array of 24 mc_light elements, a light count, a change flag, and markers for updates in each individual light element: typedef struct { long count, changelight; mc_ambient ambient; mc_light light[24]; unsigned char marker_ambient[1], marker_light[24]; } mcshare_light; Operational NotesREC initializes the lighting array with its starting configuration and will update the array of lights with reloaded changes if no external tools are running. While it is doing this, it will set count to the negative of the number of lights. When an external tool connects to this shared memory block and wants to exert control, it needs to do the following:
At that point, REC will recognize that an external tool is running and discontinue updating the lighting array itself. Shutdown options
REC shutdown
Any external tool is required to exit at that point. (It may optionally save its current state.)
|
type | size | description |
COUNT | long:4 bytes | Current camera number. Set by REC |
CHANGECAM | long:4 bytes | Attribute that camera field has changed. Set by REC |
MIRROR | long:4 bytes | Flag that visual is mirrored horizontally along the axis of the camera. |
POSITION | vector: 12 bytes | Camera Position |
DIRECTION | quaternion: 16 bytes | Camera Orientation |
COUNT | long:4 bytes | Number of lights (set by FL or REC), or zero if record is invalid. When FL is update, N > 0. When REC is updating, N < 0. (-number of lights). |
CHANGELIGHT | long:4 bytes | Attribyter that lights have changed. Set by FL. |
AMBIENT V | float:4 bytes | Ambient light brightness |
AMBIENT COLOR | 3 floats: 12 bytes | Ambient light color. |
LIGHT[] | light: N x 32 bytes | Light Data |
Light Brightness | ||
Light Color | ||
Light Position (4D) | ||
A MARKER | 1 byte | Marker that ambient has changed |
L MARKER[] | 24 bytes | Markers for each light for changes. |