BRender x86 Installation Guide:Kasan 3DMAX Support
Next|Prev|Up

Kasan 3DMAX Support

KasanGfxBegin()
KasanGfxEnd()
KasanZbSceneRender()

A number of functions are provided to allow you to use Kasan 3DMAX glasses with BRender. These functions, documented below, can be found on the KASAN disk included with your BRender pack.

This disk contains 4 directories:

Batch files are supplied that pass sensible parameters to the demonstration program, stereo.exe. Run the relevant batch file, smooth.bat or flat.bat, to view the demo. Use the mouse to move around inside the demo. Use the left mouse button to zoom in, the right mouse button to zoom out, both mouse buttons together to quit the program.

Three functions, documented below, are provided to allow the 3DMAX glasses to be used with BRender programs. Function prototypes can be found in stereo.h, function definitions in stereo.c. kasan.c contains a low level wrapper that provides access to the KASAN drivers. The files kasan.c and stereo.c must be added to your project. Note that kasan.c contains calls specific to Watcom C and cannot be used with any other compiler. Complete program listing for kasan.c, stereo.c and main.c (the files included in the demo project) can be found at the back of the Programs Listings section of this guide.

Only a few lines of code need to be changed to convert a BRender program to support the 3DMAX glasses. A converted version of BRTUTOR1.C is listed on pages 70 and 71 of this guide. Required changes and additions are highlighted in bold.

Note that:


KasanGfxBegin()

Description:
Similar to DOSGfxBegin(). Sets up the stereo glasses and the screen. Each eye will see an image with a vertical resolution half that specified.

Declaration:
br_pixelmap* KasanGfxBegin(char* pNew_setup_string);

Arguments:
char * pNew_setup_string

An options string, given in the following format:

VESA|MCGA,[W:<width>],[H:<height>],[B:<bits/pixel>],[M:<mode number>]

Result:
br_pixelmap *

Returns a pointer to a pixelmap representing the graphics hardware screen. Returns NULL if the glasses can't be initialised.


KasanGfxEnd()

Description:
Closes down KasanGfx.

Declaration:
void KasanGfxEnd(void);


KasanZbSceneRender()

Description:
Similar to BrZbSceneRender but renders the scene twice, from slightly different cameras, to produce the images to be seen from the left and right eyes. The first four arguments are the same.

pInterocular_distance is the distance between the 'eyes' in the camera's coordinate space. If the camera is scaled relative to the world then the interocular distance will be too. The left camera is half the interocular distance from *pCamera. The right camera is an equal distance the other way. The 'correct' value for the interocular distance depends on the units used in defining the scene.

pCamera_yaw is the angle between each of the left and right cameras and the Z-axis of *pCamera. The 'correct' value is camera_yaw = BR_ATAN2(interocular_distance, 2 * monitor_distance). A camera yaw of 0 corresponds to an infinitely large monitor infinitely distant. So no matter how far away an object is it will appear to be in front of the monitor. Positive values of camera yaw allow distant objects to appear as though they are behind the screen. Values which are too large tend to result in images which are hard for users to 'fuse'. A value of 1 degree gives images which are fairly easy to view.

Declaration:
void KasanZbSceneRender(br_actor* pWorld, br_actor* pCamera, br_pixelmap* pCol_buffer, br_pixelmap* pDepth_buffer, br_scalar pInterocular_distance, br_angle pCamera_yaw);

Arguments:
br_actor * pWorld

A non-NULL pointer to the root actor of a scene.

br_actor * pCamera

A non-NULL pointer to a camera actor that is a descendant of the root actor.

br_pixelmap * pCol_buffer

A non-NULL pointer to the pixelmap to render the scene into, whose type is colour_type as supplied to BrZbBegin().

br_pixelmap * pDepth_buffer

A non-NULL pointer to the pixelmap to be used as a depth buffer whose type is depth_type as supplied to BrZbBegin(). It must have the same width and height as the colour buffer. See BrPixelmapMatch().

br_scalar pInterocular_distance

The distance between the 'eyes' in the camera's coordinate space.

br_angle pCamera_yaw

The angle between each of the left and right cameras and the Z-axis of *pCamera.

Preconditions:
Between BrBegin() & BrEnd().Between BrZbBegin() & BrZbEnd(). Not currently rendering.


Generated with
CERN WebMaker