VRT 2 - Uppsala · PDF fileiii Table of Contents Table of contents VRT Module Index VRT...

175
i VRT 2.0 Stefan Seipel, Hans Molin, Lars Winkler Pettersson, Mikael Erlandsson Version 2.0 9/30/2003

Transcript of VRT 2 - Uppsala · PDF fileiii Table of Contents Table of contents VRT Module Index VRT...

Page 1: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

i

VRT 2.0

Stefan Seipel, Hans Molin, Lars Winkler Pettersson, Mikael Erlandsson Version 2.0 9/30/2003

Page 2: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

ii

Page 3: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

iii

Table of Contents Table of contents

VRT Module Index

VRT Modules Here is a list of all modules:

VRT..........................................................................................................................................................1 Scene .................................................................................................................................................1

Lights .........................................................................................................................................1 Node.........................................................................................................................................27 WoW........................................................................................................................................64 Camera .....................................................................................................................................68 Animation ................................................................................................................................73

System.............................................................................................................................................12 Rendering ........................................................................................................................................18

Texturing..................................................................................................................................19 Pipe ..........................................................................................................................................61 Shadow.....................................................................................................................................79

Geometry.........................................................................................................................................37 Intersections .............................................................................................................................23 Polygon ....................................................................................................................................52 Models .....................................................................................................................................54

Network...........................................................................................................................................77

VRT Data Structure Index

VRT Data Structures Here are the data structures with brief descriptions:

_HPLG (Handle to polygon) ...............................................................................................................79 _nodepath ............................................................................................................................................80 _patch ..................................................................................................................................................81 _VRT_CONTEXT ..............................................................................................................................81 _VRT_DEC_INFO .............................................................................................................................91 _VRT_DEC_VTX ...............................................................................................................................92 _VRT_DepthMap ...............................................................................................................................92 _VRT_Htx (Handle to texture) ...........................................................................................................93 VRT_AnimationKnottag (??) .............................................................................................................94 VRT_Animationtag (??) .....................................................................................................................95

Page 4: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

iv

VRT_Bitmaptag (??) ...........................................................................................................................97 VRT_CB_MSG ...................................................................................................................................98 VRT_Displaytag .................................................................................................................................99 VRT_Geometrytag (Geometry) .......................................................................................................100 VRT_Lighttag ...................................................................................................................................102 VRT_Nodetag (Node) ........................................................................................................................104 VRT_Pipetag .....................................................................................................................................107 VRT_Polygontag (Polygon) ..............................................................................................................108 VRT_PPBtag (??) ..............................................................................................................................109 VRT_Projectortag ............................................................................................................................110 VRT_Vertextag (Vertex) ..................................................................................................................112

VRT File Index

VRT File List Here is a list of all files with brief descriptions:

vrt.h ...................................................................................................................................................113 vrt_core.h ..........................................................................................................................................113 vrt_globals.h ......................................................................................................................................131 vrt_types.h .........................................................................................................................................166

Page 5: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

1

VRT Module Documentation

VRT

Modules • Scene • System • Rendering • Geometry • Network

Scene

Modules • Lights • Node • WoW • Camera • Animation

Lights

Functions • VRT_API void VRT_SetLightModel (int lightmodel)

Setting the current light model.

• VRT_API int VRT_GetLightModel () Retrieving the current light model.

• VRT_API VRT_Light * VRT_LightNew (int light_type) Create a new light source object.

• VRT_API int VRT_LightDelete (VRT_Light *light) Delete a light object and free allocated resources.

• VRT_API int VRT_LightSetColors (VRT_Light *light, float *colors)

Page 6: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

2

Setting the color parameters of a light source object.

• VRT_API int VRT_LightGetColors (VRT_Light *light, float *colors) Retrieve color parameters of a light source.

• VRT_API int VRT_LightSetAttenuation (VRT_Light *light, float *attenuation) Setting the attenuation parameters of a light source object.

• VRT_API int VRT_LightGetAttenuation (VRT_Light *light, float *attenuation) Retrieves the attenuation factors of a light source.

• VRT_API int VRT_LightSetSpotParameters (VRT_Light *light, float exponent, float cutoff) Setting the spotlight light cone parameters.

• VRT_API int VRT_LightGetSpotParameters (VRT_Light *light, float *exponent, float *cutoff) Retrieving the spotlight light cone parameters.

• VRT_API int VRT_LightSetPosition (VRT_Light *light, float x, float y, float z) Setting the explicite position of a light source object.

• VRT_API int VRT_LightGetPosition (VRT_Light *light, float *x, float *y, float *z) Get the explicite position of a light source object.

• VRT_API int VRT_LightSetDirection (VRT_Light *light, float dx, float dy, float dz) Setting the direction of a direction light source object.

• VRT_API int VRT_LightGetDirection (VRT_Light *light, float *dx, float *dy, float *dz) Get the direction of a direction light source object.

• VRT_API int VRT_LightSetPositionNode (VRT_Light *light, VRT_Node *nposition) Setting the position node of a light source object.

• VRT_API VRT_Node * VRT_LightGetPositionNode (VRT_Light *light) Retrieve position node of a light source object.

• VRT_API int VRT_LightSetTargetNode (VRT_Light *light, VRT_Node *ntarget) Setting the target node of a directional light source object.

• VRT_API VRT_Node * VRT_LightGetTargetNode (VRT_Light *light) Retreiving the target node of a directional light.

• VRT_API int VRT_LightSwitchOn (VRT_Light *light) Switching on a light source object.

Page 7: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

3

• VRT_API int VRT_LightSwitchOff (VRT_Light *light) Switching off a light source object.

• VRT_API int VRT_LightGetSwitchState (VRT_Light *light) Retrieving the current switch state of a light source object.

• VRT_API int VRT_LightSetType (VRT_Light *light, int light_type) Setting the type of the specified light source object.

• VRT_API int VRT_LightGetType (VRT_Light *light) Retreives the type of the specified light source object.

Function Documentation

VRT_API int VRT_GetLightModel () Retrieving the current light model. VRT can perform lighting calculations in two different ways. Global lightning (VRT_GLOBAL_LIGHT_MODEL) calculations, take care about the direction and position of lights in relation to the shaded objects surface attitude. In local lighting calculations (VRT_LOCAL_LIGHT_MODEL), in addition the relation between direction of light and direction from object towards the observer considered in illumination calculations. This gives more realistic shading results at the cost of decreased rendering performance. By default, VRT_GLOBAL_LIGHT_MODEL is installed and should only be changed, if specific illumination effects are desired. Returns:

VRT_GLOBAL_LIGHT_MODEL or VRT_LOCAL_LIGHT_MODEL See also:

VRT_SetLightModel

VRT_API int VRT_LightDelete (VRT_Light * light) Delete a light object and free allocated resources. The function removes the light object specified by light from the internal light object list and frees all resources allocated by this object. VRT allows the definition of VRT_LIGHTLIST_MAXLIGHTS different light source objects which are maintained in an internal light list. Lights should only be deleted if they are not used any longer in a simulation. Animation of lights (i.e. switching on and off) should be done using the corresponding switching functions. Parameters:

light a pointer to a light object Returns:

1 if function succeeded, otherwise 0 If 0 is returned also a VRT error code was prompted in the console window.

See also:

Page 8: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

4

VRT_LightNew , VRT_LightSwitchOff , VRT_LightSwitchOn

VRT_API int VRT_LightGetAttenuation (VRT_Light * light, float * attenuation) Retrieves the attenuation factors of a light source. The function retrieves the three light attenuation parameters of the light source specified by light. Every light source carries three attenuation parameters, which describe the proportion of light attenuation depending on the distance between light source and illuminated object. These parameters describe linear and quadric attenuation factors, which are multiplied by the distance measure. Light attenuation is considered for positional lights only (VRT_LIGHT_POSITIONAL, VRT_LIGHT_SPOT). By default, all light sources have their parameters set to [1.0, 0.0, 0.0], which corresponds to non attenuated light. Note that attenuation pointer actually points to an array of three floating point values. VRT does only check if attenuation pointer is not NULL, otherwise VRT can not determine wheather attenuation points to a sufficiently big memory area. However, VRT checks for correctness of light pointer. The function copies the current parameter set of the specified light source to the attenuation pointer array. Parameters:

light a pointer to a valid light source object attenuation a pointer to an array of three floating point values

Returns: 1 if function was successful, otherwise 0.

See also: VRT_LightSetAttenuation

VRT_API int VRT_LightGetColors (VRT_Light * light, float * colors) Retrieve color parameters of a light source. The function retreives the ambient, diffuse and specular color components for the specified light source object. Each color is defined by four floating point values clamped to the range of [0.0 .. 1.0]. The format in which the color values are returened is: AR, AG, AB, AA, DR, DG, DB, DA, SR, SG, SB, SA Note that colors pointer actually points to an array of twelve floating point values. VRT does only check if colors pointer is not NULL, otherwise VRT can not determine wether colors points to a sufficiently big memory area. However, VRT checks for correctness of light pointer. The function copies the current color parameter set of the specified light source to the colors pointer array. Parameters:

light a pointer to a light source object colors a pointer to 12 floating point color value

Returns: 1 if function was successful, otherwise 0.

See also: VRT_LightSetColors

VRT_API int VRT_LightGetDirection (VRT_Light * light, float * dx, float * dy, float * dz) Get the direction of a direction light source object. In VRT, the direction of light is considered for two types of lights: VRT_LIGHT_DIRECTIONAL and VRT_LIGHT_SPOT. For positional light sources, the direction does not care because they radiate to all directions. The directional vector of a light source is defined with regard to the global co- ordinate system. The explicite directional vector is always used unless the light has a target node

Page 9: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

5

defined which it is spotting. Initially, all light sources have the directional vector set to [0, -1.0, 0]. The function Retrieves the currently set direction vector of the specified light source object. Take care, that dx, dy, and dz are valid pointers to single floating point values. Parameters:

light a pointer to a light source object dx a pointer to the floating point x component of the directional vector dy a pointer to the floating point y component of the directional vector dz a pointer to the floating point z component of the directional vector

Returns: 1 if function succeeded, otherwise 0

See also: VRT_LightSetDirection , VRT_LightSetTargetNode

VRT_API int VRT_LightGetPosition (VRT_Light * light, float * x, float * y, float * z) Get the explicite position of a light source object. In VRT, the position of light is considered for two types of lights: VRT_LIGHT_POSITIONAL and VRT_LIGHT_SPOT. For directional light sources, the position does not care because they are assumed to be at infinity. The position of a light source is defined with regard to the global co-ordinate system. The explicite position co-ordinates are always used unless the light has a position node defined. Initially, all light sources have the position to [0, 1.0, 0]. Take care, that x, y, and z are valid pointers to single floating point values. Parameters:

light a pointer to a light source object x a pointer to the floating point x coordinate of the position y a pointer to the floating point y coordinate of the position z a pointer to the floating point z coordinate of the position

Returns: 1 if function succeeded, otherwise 0

See also: VRT_LightSetPosition , VRT_LightSetPositionNode

VRT_API VRT_Node* VRT_LightGetPositionNode (VRT_Light * light) Retrieve position node of a light source object. In VRT, light sources can be attached to any node within the scene graph hierarchy. In that way, light position can be animated very easily, by having a light tracking a specific node. Whenever a light source has its position node set to a valid node in the scene graph hierarchy, VRT will transform the position of this node into global universe co-ordinates and override the explicitly set position values with the transformed position of the position node to be tracked. The function returns the pointer to the currently set position node or NULL. Parameters:

light a pointer to a light source object Returns:

A pointer to a valid node in the scene graph, which is currently being tracked by the light source, or NULL.

See also: VRT_LightSetPositionNode

Page 10: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

6

VRT_API int VRT_LightGetSpotParameters (VRT_Light * light, float * exponent, float * cutoff)

Retrieving the spotlight light cone parameters. For spotlights only, an additional set of parameterws is considered in lighting calculations, to pay attention to the cone angle of the spotlight beam and to the attenuation of light from the center of the light cone towards the light cones borders. Light is being attenuated with the cosine of the angle of light rays from the center of the cone beam raised by a number. The exponent is defining this exponential value. By default, the exponent is set to 0 i.e. distribution of light will not be attenuated within the cone beam at all. Valid values for exponent are in the range of [0.0 .. 128.0]. The cutoff angle defines the opening angle of the light cone measured from the central line of the light direction towards the border of the cone. Objects outside the light cone of a spotlight will not be considered for lighting calculations and will not receive any light from this light source. The initial value for the cutoff angle is 180.0, which means that no spot light at all, instead positional light spreading to all directions. Meaningful values for cutoff are [0.0 .. 90.0]. The function only can test for NULL pointer input. Make sure that exponent and cutoff are referencing sufficiently allocated memory. Parameters:

light a pointer to a light source object exponent a pointer to a floating point exponent parameter cutoff a pointer to a floating point cutoff angle parameter

Returns: 1 if function succeeded, otherwise 0

See also: VRT_LightSetSpotParameters

VRT_API int VRT_LightGetSwitchState (VRT_Light * light) Retrieving the current switch state of a light source object. In VRT lights can be switched on and off in order to flexibly allow for changes in illumination settings. The function returns the current switch state for a light source. Note: There can be at most MAX_GL_LIGHTS simultaneously activated light sources in the scene. The actual value depends on the OpenGL implementation by is usually 8. Parameters:

light a pointer to a light source object Returns:

1 - if light is switched on 0 - if light is switched off,or if light is invalid See also:

VRT_LightSwitchOn , VRT_LightSwitchOff

VRT_API VRT_Node* VRT_LightGetTargetNode (VRT_Light * light) Retreiving the target node of a directional light. In VRT, directional light sources can automatically track an object. By setting a target node to a directional light source object, VRT automatically calculates the light sources direction. Regardles wether the position of the light source is defined explicitely or by tracked with a position node, the direction is calculated from the light´s position towards the target node. The automatically calculated direction is overriding the explicitly set direction vector. This feature allows for easy animation of light direction in the case of directional light sources. Any movement of the target node will cause light to automatically follow. Direction tracking can be de-activated by setting NULL to the target node of a light source object. This function retrieves the currently set target node of the specified light source object.

Page 11: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

7

Parameters: light a pointer to a light source object

Returns: A pointer to a valid node in the scen-graph hierarchy or NULL if not available.

See also: VRT_LightSetTargetNode , VRT_LightSetDirection , VRT_LightGetDirection

VRT_API int VRT_LightGetType (VRT_Light * light) Retreives the type of the specified light source object. VRT can handle three different types of light sources: VRT_LIGHT_DIRECTIONAL: Directional light is located a infinity and has a specific direction. It is a global light which is not attenuated over distance. VRT_LIGHT_POSITIONAL : Positional light has a dedicated puctual position in the scene and emitts light towards all directions from this point. Unlike directional light, positional light is a local light and can be attenuated with distance depending on its attenuation parameters. VRT_LIGHT_SPOT: Spotlights have both a specific location in the scene and sprread light towards a limited are around a specific direction. Spotlights are local lights and can be attenuated with distance depending on their attenuation parameters. The amount of light distribution around the main light direction can be controlled with the exponent and cutoff parameters of the spotlight object. The function returns one of these typea of light for the specified light source. Parameters:

light a pointer to a light source object Returns:

VRT_LIGHT_DIRECTIONAL VRT_LIGHT_POSITIONAL VRT_LIGHT_SPOT See also:

VRT_LightSetType , VRT_LightNew

VRT_API VRT_Light* VRT_LightNew (int light_type) Create a new light source object. The function creates a new light source object, allocates the required resources and adds the light source object to the list of currently defined lights. VRT allows the definition of VRT_LIGHTLIST_MAXLIGHTS (currently 32) different light source objects which are maintained in an internal light list. Observe howerver, that at most MAX_GL_LIGHTS (depending on OpenGL implementation. Usually 8) light sources can be activated simultaneously in the scene. If the internal list of lights is full upon creation of a new light source, a corresponding error will be prompted in the console window of VRT and a NULL pointer will be returned. Otherwise, the function will return a pointer to the light source object. The light type can be either one of: VRT_LIGHT_DIRECTIONAL: Directional light is located a infinity and has a specific direction. It is a global light which is not attenuated over distance. VRT_LIGHT_POSITIONAL: Positional light has a dedicated puctual position in the scene and emitts light towards all directions from this point. Unlike directional light, positional light is a local light and can be attenuated with distance depending on its attenuation parameters. VRT_LIGHT_SPOT: Spotlights have both a specific location in the scene and sprread light towards a limited are around a specific direction. Spotlights are local lights and can be attenuated with distance depending on their attenuation parameters. After creation of a light, it type can still be modified. Observe howerver, that the light parameters of lights (position, direction..) do have different relevance for different types of light. After creation of a new light source, the position is set to [0 1.0 0] and the direction is set to [0 -1.0 0]. Note: Light source objects created with thisa function must be deleted with the function VRT_LightDelete and must not be re-allocated by the calling process. Parameters:

Page 12: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

8

light_type an integer value identifying the light type Returns:

A pointer to a valid light source object if successfully, otherwise a NULL pointer. See also:

VRT_LightDelete , VRT_LightSetType

VRT_API int VRT_LightSetAttenuation (VRT_Light * light, float * attenuation) Setting the attenuation parameters of a light source object. The function sets the three light attenuation parameters of the light source specified by light. Every light source carries three attenuation parameters, which describe the proportion of light attenuation depending on the distance between light source and illuminated object. These parameters describe linear and quadric attenuation factors, which are multiplied by the distance measure. Light attenuation is considered for positional lights only (VRT_LIGHT_POSITIONAL, VRT_LIGHT_SPOT). By default, all light sources have their parameters set to [1.0, 0.0, 0.0], which corresponds to non attenuated light. Note that attenuation pointer actually points to an array of three floating point values, which are initialized to reasonable values (e.g. [0.0 . 1.0]). VRT does only check if attenuation pointer is not NULL, otherwise VRT can not determine wheather attenuation points to a sufficiently big memory area. However, VRT checks for correctness of light pointer. The function copies the values referenced by the attenuation pointer into the local parameter set of the specified light source. Parameters:

light a pointer to a valid light source object attenuation a pointer to an array of three floating point values

Returns: 1 if function was successful, otherwise 0.

See also: VRT_LightGetAttenuation

VRT_API int VRT_LightSetColors (VRT_Light * light, float * colors) Setting the color parameters of a light source object. The function sets the ambient, diffuse and specular color components for the specified light source object. Each color is defined by four floating point values clamped to the range of [0.0 .. 1.0]. The format in which the color values are returened is: AR, AG, AB, AA, DR, DG, DB, DA, SR, SG, SB, SA Note that the colors pointer actually points to an array of twelve floating point values. VRT does only check if colors pointer is not NULL, otherwise VRT can not determine wether colors points to a sufficiently big memory area. However, VRT checks for correctness of light pointer. The function copies the values referenced by the colors pointer array into the local parameter set of the specified light source. Parameters:

light a pointer to a light source object colors a pointer to 12 floating point color value

Returns: 1 if function was successful, otherwise 0.

See also: VRT_LightGetColors

Page 13: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

9

VRT_API int VRT_LightSetDirection (VRT_Light * light, float dx, float dy, float dz) Setting the direction of a direction light source object. In VRT, the direction of light is considered for two types of lights: VRT_LIGHT_DIRECTIONAL and VRT_LIGHT_SPOT. For positional light sources, the direction does not care because they radiate to all directions. The directional vector of a light source is defined with regard to the global co- ordinate system. The explicite directional vector is always used unless the light has a target node defined, which it is spotting. Initially, all light sources have the directional vector set to [0, -1.0, 0]. The function can be used to explicitely set the values of the direction vector components. The vector does not need to be normalized. Parameters:

light a pointer to a light source object dx a floating point value for the x component of the directional vector dy a floating point value for the y component of the directional vector dz a floating point value for the z component of the directional vector

Returns: 1 if function succeeded, otherwise 0

See also: VRT_LightGetDirection , VRT_LightSetTargetNode , VRT_LightGetTargetNode

VRT_API int VRT_LightSetPosition (VRT_Light * light, float x, float y, float z) Setting the explicite position of a light source object. In VRT, the position of light is considered for two types of lights: VRT_LIGHT_POSITIONAL and VRT_LIGHT_SPOT. For directional light sources, the position does not care because they are assumed to be at infinity. The position of a light source is defined with regard to the global co-ordinate system. The explicite position co-ordinates are always used unless the light has a position node defined. Initially, all light sources have the position to [0, 1.0, 0]. This function sets explcitely the positional values of the specified light source object. Parameters:

light a pointer to a light source object x a floating point value for the x coordinate of the position y a floating point value for the y coordinate of the position z a floating point value for the z coordinate of the position

Returns: 1 if function succeeded, otherwise 0

See also: VRT_LightGetPosition , VRT_LightSetPositionNode , VRT_LightGetPositionNode

VRT_API int VRT_LightSetPositionNode (VRT_Light * light, VRT_Node * nposition) Setting the position node of a light source object. In VRT, light sources can be attached to any node within the scene graph hierarchy. In that way, light position can be animated very easily, by having a light tracking a specific node. Whenever a light source has its position node set to a valid node in the scene graph hierarchy, VRT will transform the position of this node into global universe co-ordinates and override the explicitly set position values with the transformed position of the position node to be tracked. The function sets the position node of a the specified light source to the node passed on by nposition. If automatic position tracking of a light source shall be discontinued, the function can be called again with NULL pointer for the nposition parameter.

Page 14: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

10

Parameters: light a pointer to a light source object nposition a valid node of the scene graph to which the light sources position is tracked

Returns: 1 if function succeeded, otherwise 0

See also: VRT_LightGetPositionNode

VRT_API int VRT_LightSetSpotParameters (VRT_Light * light, float exponent, float cutoff) Setting the spotlight light cone parameters. For spotlights only, an additional set of parameterws is considered in lighting calculations, to pay attention to the cone angle of the spotlight beam and to the attenuation of light from the center of the light cone towards the light cones borders. Light is being attenuated with the cosine of the angle of light rays from the center of the cone beam raised by a number. The exponent is defining this exponential value. By default, the exponent is set to 0 i.e. distribution of light will not be attenuated within the cone beam at all. Valid values for exponent are in the range of [0.0 .. 128.0]. The cutoff angle defines the opening angle of the light cone measured from the central line of the light direction towards the border of the cone. Objects outside the light cone of a spotlight will not be considered for lighting calculations and will not receive any light from this light source. The initial value for the cutoff angle is 180.0, which means that no spot light at all, instead positional light spreading to all directions. Meaningful values for cutoff are [0.0 .. 90.0]. The function sets the local parameters of the specified light source object to the values passed by exponent and cutoff. Parameters:

light a pointer to a valid light source object exponent a floating point value for the exponent parameter cutoff a floating point value for the cutoff angle parameter

Returns: 1 if function succeeded, otherwise 0

See also: VRT_LightGetSpotParameters

VRT_API int VRT_LightSetTargetNode (VRT_Light * light, VRT_Node * ntarget) Setting the target node of a directional light source object. In VRT, directional light sources can automatically track an object. By setting a target node to a directional light source object, VRT automatically calculates the light sources direction. Regardles wether the position of the light source is defined explicitely or by tracked with a position node, the direction is calculated from the light´s position towards the target node. The automatically calculated direction is overriding the explicitly set direction vector. This feature allows for easy animation of light direction in the case of directional light sources. Any movement of the target node will cause light to automatically follow. Direction tracking can be de-activated by setting NULL to the target node of a light source object. This function sets the local target_node parameters of the specified light source object to the node pased by the parameter ntarget. Whenever automatic direction tracking using target nodes shall be disabled, the function should be called with a NULL value for the ntarget parameter. Parameters:

light a pointer to a valid light source object ntarget a pointer to a valid node in the scene graph

Returns:

Page 15: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

11

1 if function succeeded, otherwise 0 See also:

VRT_LightGetTargetNode , VRT_LightSetDirection , VRT_LightGetDirection

VRT_API int VRT_LightSetType (VRT_Light * light, int light_type) Setting the type of the specified light source object. VRT can handle three different types of light sources: VRT_LIGHT_DIRECTIONAL: Directional light is located a infinity and has a specific direction. It is a global light which is not attenuated over distance. VRT_LIGHT_POSITIONAL : Positional light has a dedicated puctual position in the scene and emitts light towards all directions from this point. Unlike directional light, positional light is a local light and can be attenuated with distance depending on its attenuation parameters. VRT_LIGHT_SPOT: Spotlights have both a specific location in the scene and sprread light towards a limited are around a specific direction. Spotlights are local lights and can be attenuated with distance depending on their attenuation parameters. The amount of light distribution around the main light direction can be controlled with the exponent and cutoff parameters of the spotlight object. The function sets the type of the specified light source object to the supplied value. Observe that light_type must be either one of the three predefined values: VRT_LIGHT_DIRECTIONAL VRT_LIGHT_POSITIONAL VRT_LIGHT_SPOT Parameters:

light a pointer to a light source object light_type a valid light type value

Returns: 1 if function succeeded, otherwise 0

See also: VRT_LightGetType , VRT_LightNew

VRT_API int VRT_LightSwitchOff (VRT_Light * light) Switching off a light source object. In VRT lights can be switched on and off in order to flexibly allow for changes in illumination settings. The function switches off the specified light source. The light source will remain in the internal list of lights, but it will be ignored in the rendering process. Note: There can be at most MAX_GL_LIGHTS simultaneously activated light sources in the scene. The actual value depends on the OpenGL implementation; but it is usually 8. Parameters:

light a pointer to a light source object Returns:

1 if function succeeded, otherwise 0 See also:

VRT_LightGetSwitchState , VRT_LightSwitchOn

VRT_API int VRT_LightSwitchOn (VRT_Light * light) Switching on a light source object. In VRT lights can be switched on and off in order to flexibly allow for changes in illumination settings. Note: There can be at most MAX_GL_LIGHTS simultaneously activated light sources in the scene. The actual value depends on the OpenGL implementation; but it is usually 8. The function switches on the specified light source. If after switching more than MAX_GL_LIGHTS are activated

Page 16: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

12

at the same time, not all lights will actually be effective. In this situation, the order in which lights have been created determine wether or not a light is visible and not the order in which lights are switched on and off. In other words: The rank in the internal light list determines visibility. In practice, one should avoid to use many lights at the same time, since rendering performance is diminished dramatically for every new light activated source in the scene. Parameters:

light a pointer to a light source object Returns:

1 if function succeeded, otherwise 0 See also:

VRT_LightGetSwitchState , VRT_LightSwitchOff

VRT_API void VRT_SetLightModel (int lightmodel) Setting the current light model. VRT can perform lighting calculations in two different ways. Global lightning (VRT_GLOBAL_LIGHT_MODEL) calculations, take care about the direction and position of lights in relation to the shaded objects surface attitude. In local lighting calculations (VRT_LOCAL_LIGHT_MODEL), in addition the relation between direction of light and direction from object towards the observer considered in illumination calculations. This gives more realistic shading results at the cost of decreased rendering performance. By default, VRT_GLOBAL_LIGHT_MODEL is installed and should only be changed, if specific illumination effects are desired. Lightmodel must be either one of the predefined values: VRT_GLOBAL_LIGHT_MODEL VRT_LOCAL_LIGHT_MODEL Parameters:

lightmodel the name of a VRT light model Returns:

void See also:

VRT_GetLightModel

System

Functions • VRT_API int VRT_GetLastError (char *error_message, int size)

Get error code and error message for the last VRT error.

• VRT_API void VRT_Close () Close the VRT library.

• VRT_API void VRT_SimulationLoop () Start the VRT simulation loop.

Page 17: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

13

• VRT_API void VRT_ExitSimulationLoop () Leave the VRT simulation loop from any point within the user program.

• VRT_API void VRT_PrintSceneGraph () Prints the current scene graph to the VRT console.

• VRT_API float VRT_GetFrameRate () Get the current fram rate of VRT.

• VRT_API float VRT_GetSimulationTime () Get the up-time of the simulation.

• VRT_API void VRT_GetSystemTime (int *h, int *m, int *s) Get the systems current time from midnight.

• VRT_API void VRT_Init (int *argcp, char **argv, char *vrt_h_version, char *vrt_vnc_h_version) Initialize VRT.

• VRT_API VRT_Context * VRT_GetContext () Used to get the current VRT context.

• VRT_API void VRT_SetCallback (VRT_HookPtr hook) Register the VRT callback function.

• VRT_API int VRT_SetDisplay (int mode) Set the VRT display mode and create main window.

• VRT_API int VRT_SaveFrameToBitmap (char *filename) Copy a frame and save it to a bitmap file.

• VRT_API void VRT_PlaySound (char *filename) Plays a sound.

• VRT_API void VRT_FullScreen () requests that the current window be made full screen.

• VRT_API void VRT_ReshapeWindow (int width, int height) requests a change to the size of the current window.

• VRT_API void VRT_PositionWindow (int x, int y) requests a change to the position of the current window.

• VRT_API int VRT_GetModifiers () returns the modifier key state when certain callback messages were generated.

Page 18: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

14

Function Documentation

VRT_API void VRT_Close () Close the VRT library. This function is called to close the VRT library. It frees up any resources allocated by the system during run-time. This includes any nodes as well as geometries remaining in the scene graph. See also:

VRT_Init

VRT_API void VRT_ExitSimulationLoop () Leave the VRT simulation loop from any point within the user program. This function can be used by the application programmer to terminate the simulation loop of VRT at any time of the simulation. After a call to this function, all actions defined within the user callback function will be finished. Upon return to the VRT simulation loop, the kernel will be cleaned up and terminate the system simulation loop without redrawing the scene. The user should issue an VRT_Close command after the call to VRT_SimulationLoop in the main program. See also:

VRT_SimulationLoop , VRT_Close

VRT_API void VRT_FullScreen () requests that the current window be made full screen. VRT_FullScreen requests that the current window be made full screen. The exact semantics of what full screen means may vary by window system. The intent is to make the window as large as possible and disable any window decorations or borders added the window system. The window width and height are not guaranteed to be the same as the screen width and height, but that is the intent of making a window full screen. Subsequent VRT_ReshapeWindow and VRT_PositionWindow requests on the window will disable the full screen status of the window. See also:

VRT_ReshapeWindow , VRT_PositionWindow

VRT_API VRT_Context* VRT_GetContext () Used to get the current VRT context. Wrapper function used to retrieve the global vrtctx pointer. Returns:

Page 19: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

15

The current VRT context.

VRT_API float VRT_GetFrameRate () Get the current fram rate of VRT. This function computes the current frame rate of VRT. Returns:

The current frame rate. See also:

VRT_GetSimulationTime , VRT_GetSystemTime

VRT_API int VRT_GetLastError (char * error_message, int size) Get error code and error message for the last VRT error. This function is used to retrieve the error code and error message corresponding to the most recently occured VRT error. It can be used to print error messages to a file. Parameters:

error_message a string to return the error message in size size of the string

Returns: the error code for the last error

VRT_API int VRT_GetModifiers () returns the modifier key state when certain callback messages were generated. VRT_GetModifiers returns the modifier key state at the time the input event for a keyboard, special, or mouse callback is generated. This routine may only be called while a keyboard, special, or mouse callback is being handled. The window system is permitted to intercept window system defined modifier key strokes or mouse buttons, in which case, no VRT callback message will be generated. This interception will be independent of use of VRT_GetModifiers. The bitmask components of the returned integer value are: VRT_ACTIVE_SHIFT Set if the Shift modifier or Caps Lock is active. VRT_ACTIVE_CTRL Set if the Ctrl modifier is active. VRT_ACTIVE_ALT Set if the Alt modifier is active. Returns:

the modifier key state

VRT_API float VRT_GetSimulationTime () Get the up-time of the simulation. This function returns the time elapsed since the simulation loop has been entered for the first time. The time returned is a floating point value indicating the elapsed time in seconds. Returns:

Time elapsed since simulation start.

Page 20: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

16

See also: VRT_GetFrameRate , VRT_GetSystemTime

VRT_API void VRT_GetSystemTime (int * h, int * m, int * s) Get the systems current time from midnight. This function returns the computer systems current time of the day. Parameters:

h pointer to hour m pointer to minute s pointer to second

See also: VRT_GetFrameRate

VRT_API void VRT_Init (int * argcp, char ** argv, char * vrt_h_version, char * vrt_vnc_h_version)

Initialize VRT. This function initializes VRT for use. All internal states along with the scene graph is set up. No other VRT functions should be called prior to a call to this function. Parameters:

argcp pointer to the program's unmodified argc variable from main. Upon return, the value pointed to by argcp will be updated, because VRT_Init extracts any command line options intended for the VRT library. argv The program's unmodified argv variable from main. Like argcp, the data for argv will be updated because VRT_Init extracts any command line options understood by the VRT library.

See also: VRT_Close

VRT_API void VRT_PlaySound (char * filename) Plays a sound. This function loads the sound resource given by soundfile and plays the sound in asynchronous mode. VRT_PlaySound returns immediately to the calling process while the sound may be played in background. The format of the sound file must be Windows style wave format (.wav). Parameters:

filename filename including path to .wav file

VRT_API void VRT_PositionWindow (int x, int y) requests a change to the position of the current window. VRT_PositionWindow requests a change in the position of the current window. The x and y parameters are pixel offsets from the screen origin. Parameters:

x New X location of window in pixels. y New Y location of window in pixels.

See also:

Page 21: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

17

VRT_ReshapeWindow , VRT_FullScreen

VRT_API void VRT_PrintSceneGraph () Prints the current scene graph to the VRT console. This function prints a text representation of the current scene graph to the VRT console window. See also:

VRT_POut

VRT_API void VRT_ReshapeWindow (int width, int height) requests a change to the size of the current window. VRT_ReshapeWindow requests a change in the size of the current window. The width and height parameters are size extents in pixels. The width and height must be positive values. Parameters:

width New width of window in pixels. height New height of window in pixels.

See also: VRT_FullScreen , VRT_PositionWindow

VRT_API int VRT_SaveFrameToBitmap (char * filename) Copy a frame and save it to a bitmap file. The function can be executed from within the simulation callback function to copy the frame buffer to a bitmap which is automatically stored into a Windows BMP file. Parameters:

filename a string containing a valid file name Returns:

1 on success 0 on failure See also:

VRT_CopyFrameToTexture , VRT_SaveTextureToBitmap

VRT_API void VRT_SetCallback (VRT_HookPtr hook) Register the VRT callback function. This function registers the user-supplied VRT event handler callback function. The callback function prototype is defined as a pointer to a function which returns void and which accepts one parameter of type EventRef: typedef void (*VRT_HookPtr)(EventRef event); Parameters:

hook pointer to the callback function See also:

VRT_SimulationLoop

Page 22: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

18

VRT_API int VRT_SetDisplay (int mode) Set the VRT display mode and create main window. This function sets the VRT display mode which can be mono, stereo, splitted stereo, virtual plane and mirrored, or a combination. It also creates and displays the VRT main window. Parameters:

mode display mode Returns:

Zero on failure.

VRT_API void VRT_SimulationLoop () Start the VRT simulation loop. This function starts the VRT simulation by entering a loop where it continously calls the registered callback function. The loop is exited only when the application is terminated. See also:

VRT_SetCallback

Rendering

Modules • Texturing • Pipe • Shadow

Functions • VRT_API void VRT_SetClearColor (float r, float g, float b, float a)

Sets the VRT clearing color.

• VRT_API void VRT_GetClearColor (float *r, float *g, float *b, float *a) Get the clearing color VRT uses.

Function Documentation

VRT_API void VRT_GetClearColor (float * r, float * g, float * b, float * a) Get the clearing color VRT uses.

Page 23: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

19

This function gets the current clearing color being used by VRT. The color component ranges are 0-1 inclusive. Parameters:

r a pointer to the red component g a pointer to the green comonent b a pointer to the blue component a a pointer to the alpha component

See also: VRT_SetClearColor

VRT_API void VRT_SetClearColor (float r, float g, float b, float a) Sets the VRT clearing color. This function sets the color that VRT uses to clear the main window when redrawing the screen. Parameters:

r color red component g color green component b color blue component a color alpha component

See also: VRT_GetClearColor

Texturing

Functions • VRT_API void VRT_SetTextureModulationMode (int texture_modulation)

Setting the global texture modulation mode.

• VRT_API int VRT_GetTextureModulationMode () Retrieving the currently set texture modulation mode.

• VRT_API VRT_Htx VRT_LoadTexture (char *filename) Load a texture from file.

• VRT_API VRT_Htx VRT_CreateRGBATexture (int sx, int sy, char *texels) Create a texture.

• VRT_API int VRT_DeleteTexture (VRT_Htx *texture) Delete a texture.

• VRT_API int VRT_ReplaceRGBATexture (VRT_Htx *texture, int sx, int sy, char *texels) Replace a texture.

Page 24: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

20

• VRT_API int VRT_ReplaceRGBASubTexture (VRT_Htx *texture, int x, int y, int w, int h, char

*texels) Replaces part of a texture.

• VRT_API VRT_Htx VRT_CopyFrameToTexture () Render a frame to a texture.

• VRT_API int VRT_SaveTextureToBitmap (VRT_Htx *texture, char *filename) Save a texture into a file.

Function Documentation

VRT_API VRT_Htx VRT_CopyFrameToTexture () Render a frame to a texture. The function can be executed from within the simulation callback function to copy the frame buffer to a texture. Returns:

A handle to a texture. See also:

VRT_SaveTextureToBitmap , VRT_SaveFrameToBitmap

VRT_API VRT_Htx VRT_CreateRGBATexture (int sx, int sy, char * texels) Create a texture. This function creates a texture, given dimensions of the texture to be created and texel data. The texel data is a collection of color specifications on the RGBA form. That is, four values an the range of 0-255 (char type) indicating the red, green, blue and alpha components of a color. The texel data is an array of <width*height> such tuples. Note: The current texture mode is affecting the type of texture created. Parameters:

sx width of the texture sy height of the texture texels pointer to an array of texel data

Returns: A texture.

See also: VRT_LoadTexture , VRT_CreateRGBATexture , VRT_DeleteTexture , VRT_ReplaceRGBATexture , VRT_ReplaceRGBASubTexture , VRT_SetTextureModulationMode

Page 25: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

21

VRT_API int VRT_DeleteTexture (VRT_Htx * texture) Delete a texture. This function deletes a texture. Parameters:

texture a texture Returns:

A VRT error code See also:

VRT_LoadTexture , VRT_CreateRGBATexture , VRT_ReplaceRGBATexture , VRT_ReplaceRGBASubTexture

VRT_API int VRT_GetTextureModulationMode () Retrieving the currently set texture modulation mode. The function returns the currently set texture modulation mode. The texture modulation mode is a environment state variable which affects the visual appearnace of textures. Whenever a texture is read from a file or created, the texture modulation mode at the time of texture creation determines how the texture will be created. Decal textures do generally replace the objects or polygons color with the picture contained in the texture. In modulate textures, the color and transparency of texels is multiplied with the color and transparency of the object and the rendered. As a result of this, the alpha channel in a texture can be used to modulate color and transparency of the entire object. In addition, in VRT a zero value texture element will not be rendered at all when a modulate texture is mapped upon a polygon. Therefore, textures can be used to stencil out irregular shapes from objects. Returns:

VRT_TEXTURE_MODULATION_DECAL || VRT_TEXTURE_MODULATION_MODULATE || VRT_TEXTURE_MODULATION_BLEND

See also: VRT_SetTextureModulationMode , VRT_CreateRGBATexture , VRT_LoadTexture

VRT_API VRT_Htx VRT_LoadTexture (char * filename) Load a texture from file. This function loads a texture form a Windows Bitmap (.BMP) file. The bitmap file must contain bitmap of uncompressed true color RGB format , otherwise, the function fails. In addition, the size of the texture is recommended to have a format of nkxnk. If the file identified by filename can not be opened or is not existing, the function will return NULL. Note: The current texture mode is affecting the type of texture created. Parameters:

filename name of texture file Returns:

A handle to a texture. See also:

VRT_LoadOBJ , VRT_GeometrySavePLG , VRT_GeometrySaveVRML , VRT_LoadTexture , VRT_SetTextureModulationMode

Page 26: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

22

VRT_API int VRT_ReplaceRGBASubTexture (VRT_Htx * texture, int x, int y, int w, int h, char * texels)

Replaces part of a texture. This function inserts textels in a larger texture. The texel data is a collection of color specifications on the RGBA form. That is, four values an the range of 0-255 (char type) indicating the red, green, blue and alpha components of a color. The texel data is an array of <w*h> such tuples. Note: The current texture mode is affecting the type of texture created. Parameters:

texture reference to the texure handle. x the number of horizontal texels from the lower left corner of texture to start replacing. y the number of vertical texels from the lower left corner of texture to start replacing. w the widht of the subtexture. h the heigth of the subtexure. texels preference to the raw subtexel data.

Returns: A VRT error code.

See also: VRT_CreateRGBATexture , VRT_PolygonSetTexture , VRT_SetTextureModulationMode , VRT_ReplaceRGBATexture

VRT_API int VRT_ReplaceRGBATexture (VRT_Htx * texture, int sx, int sy, char * texels) Replace a texture. This function replaces a texture by creating a new texture in place of an old one. The texel data is a collection of color specifications on the RGBA form. That is, four values an the range of 0-255 (char type) indicating the red, green, blue and alpha components of a color. The texel data is an array of <width*height> such tuples. Note: The current texture mode is affecting the type of texture created. Parameters:

texture address of (pointer to) a texture handle sx width of texture sy height of texture texels pointer to texel raw data

Returns: Zero on failure.

See also: VRT_CreateRGBATexture , VRT_PolygonSetTexture , VRT_SetTextureModulationMode , VRT_ReplaceRGBASubTexture

VRT_API int VRT_SaveTextureToBitmap (VRT_Htx * texture, char * filename) Save a texture into a file. This function writes a textureidentified by texture into a file. The bitmap is stored as a uncompressed Windows bitmap with 24 bits of true color. If the filename/location is not valid the function returns an error. Parameters:

texture handle to a texture filename name of the file/location where to save the bitmap

Returns: Zero on failure.

Page 27: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

23

See also: VRT_CopyFrameToTexture , VRT_SaveFrameToBitmap

VRT_API void VRT_SetTextureModulationMode (int texture_modulation) Setting the global texture modulation mode. The function sets/changes the currently texture modulation mode. The texture modulation mode is a VRT environment state variable which affects the visual appearnace of textures. Whenever a texture is read from a file or created, the texture modulation mode at the time of texture creation determines how the texture will be created. Decal textures do generally replace the objects or polygons color with the picture contained in the texture. In modulate textures, the color and transparency of texels is multiplied with the color and transparency of the object and the rendered. As a result of this, the alpha channel in a texture can be used to modulate color and transparency of the entire object. In addition, in VRT a zero value texture element will not be rendered at all when a modulate texture is mapped upon a polygon. Therefore, textures can be used to stencil out irregular shapes from objects. Texture_modulation must be either on of the defined values: VRT_TEXTURE_MODULATION_DECAL VRT_TEXTURE_MODULATION_MODULATE VRT_TEXTURE_MODULATION_BLEND Parameters:

texture_modulation the name of a VRT texture modulation mode Returns:

void See also:

VRT_GetTextureModulationMode , VRT_CreateRGBATexture , VRT_ReplaceRGBATexture , VRT_LoadTexture

Intersections

Detailed Description Intersection testing.

Functions • VRT_API int VRT_IntersectRayTriangleUVT (float *p, float *d, float *v1, float *v2, float *v3, float

*uvt) Test for intersection of a ray with a triangle.

• VRT_API int VRT_IntersectRayTriangle (float *p, float *d, float *v1, float *v2, float *v3, float *t) Test for intersection of a ray with a triangle.

• VRT_API int VRT_IntersectTriangleTriangle (float *v1, float *v2, float *v3, float *u1, float *u2, float *u3) Test for triangle-triangle intersection.

Page 28: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

24

• VRT_API int VRT_IntersectRayQuad (float *p, float *d, float *v1, float *v2, float *v3, float *v4, float *t) Test for intersection of a ray with a four sided polygon.

• VRT_API int VRT_IntersectRayNode (float *p, float *d, VRT_Node *anode, float *t, VRT_HPlg *hit_poly) Test for intersection of a ray with a node.

• VRT_API int VRT_NodeIntersectNode (VRT_Node *sn, VRT_Node *tn) Check if two nodes intersect.

Function Documentation

VRT_API int VRT_IntersectRayNode (float * p, float * d, VRT_Node * anode, float * t, VRT_HPlg * hit_poly)

Test for intersection of a ray with a node. This function test whether the ray defined by starting point p and directional vector d is intersecting with the given nodes geometry. This function is one of the most convenient procedures to test for ray-object intersection. This function performs in a three stage procedure in order to improve runtime performance. Observe, that intersection testing is performed for the geometry of the given node with regard to the current attitude of the node specified by the nodes current transformation matrix. Therefore, the rays coordinates are specified in world coordinates, and, if intersection testing is positive, the resulting intersection point is considered in world coordinates. Note that only the nodes geometry is considered for testing and not the children of the node. In case of intersection, the variable t gives the distance of the intersection point i from p along the direction vector d. Hence, the world coordinates of the point of intersection i can be calculated as follows: i = p + t*d. Parameters:

p a pointer to ray starting coordinates d a pointer to ray direction vector components anode a pointer to the node to be tested t a pointer to the distance of the intersection point hit_poly a pointer to the hit polygon.

Returns: Zero, if test fails. Non-zero, if ray intersects with nodes geometry.

See also: VRT_IntersectRayTriangleUVT , VRT_IntersectRayTriangle , VRT_IntersectRayQuad , VRT_NodeIntersectNode

VRT_API int VRT_IntersectRayQuad (float * p, float * d, float * v1, float * v2, float * v3, float * v4, float * t)

Test for intersection of a ray with a four sided polygon. This function tests for intersection of a ray with a quadriliteral polygon. The ray is defined by starting point p and a directional vector d. The quadriliteral polygon is given by four vertices v1, v2, v3, and v4 respectively. If the ray intersects with the polygon, the function returns a non zero value. In that

Page 29: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

25

case, variable t gives the distance of the intersection point i from p along the direction vector d. Hence, the world coordinates of the point of intersection i can be calculated as follows: i = p + t*d. Parameters:

p a pointer to ray starting coordinates d a pointer to ray direction vector components v1 a pointer to polygons first vertex coordinates v2 a pointer to polygons second vertex coordinates v3 a pointer to polygons third vertex coordinates v4 a pointer to polygons fourth vertex coordinates t a pointer to the distance of the intersection point

Returns: Zero, if test fails. Non-zero, if ray intersects with polygon.

See also: VRT_IntersectRayTriangleUVT , VRT_IntersectRayTriangle , VRT_IntersectRayNode , VRT_NodeIntersectNode

VRT_API int VRT_IntersectRayTriangle (float * p, float * d, float * v1, float * v2, float * v3, float * t)

Test for intersection of a ray with a triangle. This function tests for intersection of a ray with a triangle. The ray is defined by starting point p and a directional vector d. The triangle is given by three vertices v1, v2, v3, and v4 respectively. If the ray intersects with the triangle, the function returns a non zero value. In that case, variable t gives the distance of the intersection point i from p along the direction vector d. Hence, the world coordinates of the point of intersection i can be calculated as follows: i = p + t*d. Parameters:

p a pointer to ray starting coordinates d a pointer to ray direction vector components v1 a pointer to triangles first vertex coordinates v2 a pointer to triangles second vertex coordinates v3 a pointer to triangles third vertex coordinates t a pointer to the distance of the intersection point

Returns: Zero, if test fails. Non-zero, if ray intersects with triangle.

See also: VRT_IntersectRayTriangleUVT , VRT_IntersectRayQuad , VRT_IntersectRayNode , VRT_NodeIntersectNode

VRT_API int VRT_IntersectRayTriangleUVT (float * p, float * d, float * v1, float * v2, float * v3, float * uvt)

Test for intersection of a ray with a triangle. Function perfroms in the same way as VRT_IntersectRayTriangle. However, the variable uvt points to an array of three floating point parameters where the first element u, and the second element v represent polygon texture coordinates. In case of intersection, u and v specify the intersection point in terms of the poolygons texture coordinate system. The third element of the array t gives the distance of the intersection point i from p along the direction vector d. Hence, the world coordinates of the point of intersection i can be calculated as follows: i = p + t*d. Note that this function can be used to pick and select texture elements of a given polygon. Parameters:

Page 30: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

26

p a pointer to ray starting co d a pointer to ray direction vector components v1 a pointer to triangles first vertex coordinates v2 a pointer to triangles second vertex coordinates v3 a pointer to triangles third vertex coordinates uvt a pointer to array of three floating point values

Returns: Zero, if test fails. Non-zero, if ray intersects with triangle.

See also: VRT_IntersectRayTriangle , VRT_IntersectRayQuad , VRT_IntersectRayNode , VRT_NodeIntersectNode

VRT_API int VRT_IntersectTriangleTriangle (float * v1, float * v2, float * v3, float * u1, float * u2, float * u3)

Test for triangle-triangle intersection. Explicite function to test whether two triangles do intersect or not. The vertices of both triangles are passed to the function by vertex pointers. Each vertex pointer must reference a triple of 3 floating point values, which contain the explicite co-ordinates of the corresponding vertex. The function supposes, that the triangles are defined in the same coordinate system. Note: If triangles from different nodes in a scene-graph hierarchy are supposed to be tested, it is recommended to either transform the coordinates of both triangles to the root coordinate system, or to transform the coordinates of one triangle into the local reference frame of the other triangle ! Parameters:

v1 pointer to x v2 pointer to x v3 pointer to x u1 pointer to x u2 pointer to x u3 pointer to x

Returns: 1 if intersection occurs, otherwise 0

See also: VRT_IntersectRayQuad , VRT_IntersectRayNode , VRT_IntersectRayTriangle , VRT_IntersectRayTriangleUVT , VRT_NodeIntersectNode

VRT_API int VRT_NodeIntersectNode (VRT_Node * sn, VRT_Node * tn) Check if two nodes intersect. This function checks whether to nodes intersect. Parameters:

sn a pointer to node tn a pointer to another node

Returns: 0 if the nodes do not intersect, 1 if they do.

See also: VRT_IntersectRayTriangleUVT , VRT_IntersectRayTriangle , VRT_IntersectRayQuad , VRT_IntersectRayNode

Page 31: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

27

Node

Functions • VRT_API VRT_Node * VRT_RootNode (void) • VRT_API VRT_Node * VRT_NodeNew (VRT_Node *parent, char *name)

Create a new node.

• VRT_API int VRT_NodeDelete (VRT_Node *anode) Delete a node.

• VRT_API int VRT_DeleteNodeTree (VRT_Node *anode, int flag) Deletes a node tree.

• VRT_API int VRT_NodeAttachNode (VRT_Node *parent, VRT_Node *child) Attach as child to another node.

• VRT_API int VRT_NodeTranslate (VRT_Node *anode, float tx, float ty, float tz) Translate a node.

• VRT_API int VRT_NodeRotate (VRT_Node *anode, float rx, float ry, float rz) Rotate a node.

• VRT_API int VRT_NodeScale (VRT_Node *anode, float sx, float sy, float sz) Change size of a node.

• VRT_API int VRT_NodeSetTranslation (VRT_Node *anode, float tx, float ty, float tz) Set absolute translation of a node.

• VRT_API int VRT_NodeSetRotation (VRT_Node *anode, float rx, float ry, float rz) Set the absolute rotation of a node.

• VRT_API int VRT_NodeSetScale (VRT_Node *anode, float sx, float sy, float sz) Set the absolute scale of a node.

• VRT_API int VRT_NodeSetGeometry (VRT_Node *anode, VRT_Geometry *geom) Attach a geometry to a node.

• VRT_API int VRT_NodeSetDisplayList (VRT_Node *anode, int dpl) Set a display list to a node.

• VRT_API int VRT_NodeGetDisplayList (VRT_Node *anode)

Page 32: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

28

Get a geometrys display list.

• VRT_API VRT_Geometry * VRT_NodeGetGeometry (VRT_Node *anode) Get the geometry of a node.

• VRT_API VRT_NodePath * VRT_NodeGetNodepath (VRT_Node *anode) Get the nodepath of a node.

• VRT_API int VRT_NodeGetTransform (VRT_Node *anode, float *mvm) Get the current transformation matrix of a node.

• VRT_API int VRT_NodeGetLocalTransform (VRT_Node *anode, float *mvm) Get the local transformation matrix of a node.

• VRT_API int VRT_NodeSetLocalTransform (VRT_Node *anode, float *mvm) Setting the local attitude matrix of a node.

• VRT_API int VRT_NodePointAxis (VRT_Node *anode, int axis, float *v) Aligning a specific axis of a node with a direction vector.

• VRT_API int VRT_NodeSwitchOff (VRT_Node *anode) Make a node invisible.

• VRT_API int VRT_NodeSwitchOn (VRT_Node *anode) Make a node visible.

• VRT_API int VRT_NodeGetSwitchState (VRT_Node *anode) Get the switch state of a node.

• VRT_API void VRT_NodeSetPreRenderCallback (VRT_Node *node, VRT_NODE_CALLBACK *cb) Set a pre-render callback function for a node.

• VRT_API void VRT_NodeSetPostRenderCallback (VRT_Node *node, VRT_NODE_CALLBACK *cb) Set a post-render callback function for a node.

• VRT_API void VRT_NodeGetZDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeGetYDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeGetXDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeSetZDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeSetYDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeSetXDirection (VRT_Node *node, float *v)

Page 33: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

29

Function Documentation

VRT_API int VRT_DeleteNodeTree (VRT_Node * anode, int flag) Deletes a node tree. This function deletes the whole node tree from the provided node and down. If flag is set to true the function will also delete the geometries associated to these nodes. Parameters:

anode A pointer to the root of the node tree that shall be removed. flag A flag indicating if the geometries associated with the nodes should be deleted too. Possible values: true or false.

Returns: Zero on failure.

VRT_API int VRT_NodeAttachNode (VRT_Node * parent, VRT_Node * child) Attach as child to another node. This function attaches the node child to the child list of the node parent. The purpose of this function is to attach a node and its children to another node. By doing so, identical objects or hierarchical geometric structures can appear in different places of the scene graph without the need to have duplicate instances of the node. This function allows a more economical handling of identical node structures. Observe however, that this function undermines the straightforward top down approach of a directed a- cyclic scene graph. This function should be used with care in order to avoid side effects. In particular, the attachment of a top level node of the scene graph to a bottom level node will inevitably lead to cyclic recursions which will cause the system stack to overflow. Parameters:

parent a pointer to a parent node child a pointer to a child node

Returns: A VRT error code.

See also: VRT_NodeNew

VRT_API int VRT_NodeDelete (VRT_Node * anode) Delete a node. This function deletes a node and detaches it from the scene- graph. Parameters:

anode a pointer to a node Returns:

Zero on failure. See also:

VRT_NodeNew

VRT_API int VRT_NodeGetDisplayList (VRT_Node * anode) Get a geometrys display list.

Page 34: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

30

This function retrieves the identifier of the nodes display list if available. VRT allows to execute precompiled OpenGL display lists while nodes are processed in under scene-graph traversal. Parameters:

anode a pointer to a node Returns:

An integer value identifying the display list. See also:

VRT_NodeSetDisplayList

VRT_API VRT_Geometry* VRT_NodeGetGeometry (VRT_Node * anode) Get the geometry of a node. This function gets the geometry attached to a node. Parameters:

anode a pointer to a node Returns:

A pointer to a geometry See also:

VRT_SetGeometry

VRT_API int VRT_NodeGetLocalTransform (VRT_Node * anode, float * mvm) Get the local transformation matrix of a node. This function retrieves the local transformation matrix of a node i.e. its relation to its parent node. The matrix is an array of 16 floats, arranged row-wise. Observe that the matrix returned represents only the nodes local transformation matrix which represents the nodes attitude with regard to its parent node. Observe that for all nodes, which are directly linked to the root node both VRT_NodeGetLocalTransform and VRT_NodeGetTransform return the same result. Note: The mvm pointer must reference a sufficiently large memory area, which accomodates 16 floating point matrix values. Parameters:

anode a pointer to a node mvm a pointer to an array of 16 floating point values representing the local transformation matrix

Returns: Zero on failure.

See also: VRT_NodeSetLocalTransform , VRT_NodeGetTransform

VRT_API VRT_NodePath* VRT_NodeGetNodepath (VRT_Node * anode) Get the nodepath of a node. This function gets the path of a node in the scene-graph. The nodepath of a certain node is a list of nodes, starting with the root node and following the scene-graph tree down, visiting all nodes on the way, and ending with the node in question. Parameters:

anode a pointer to a node Returns:

Page 35: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

31

A nodepath.

VRT_API int VRT_NodeGetSwitchState (VRT_Node * anode) Get the switch state of a node. This function returns the switch state of node, that is, either on or off. Parameters:

anode a pointer to a node. Returns:

0 for off, 1 for on. See also:

VRT_NodeSwitchOn , VRT_NodeSwitchOff

VRT_API int VRT_NodeGetTransform (VRT_Node * anode, float * mvm) Get the current transformation matrix of a node. This function retrieves the current transformation matrix of a node with regard to the center of the universe. The matrix is an array of 16 floating point values, arranged row-wise. Observe that the matrix returned represents all concatenated matrices along the nodepath from the root node to the specified node. Usually, this function is used to retrieve a nodes global attitude within the scene. Parameters:

anode a pointer to a node mvm a 4x4 matrix as a float array of 16 elements

Returns: Zero on failure.

See also: VRT_NodeGetLocalTransform , VRT_NodeSetLocalTransform

VRT_API void VRT_NodeGetXDirection (VRT_Node * node, float * v)

VRT_API void VRT_NodeGetYDirection (VRT_Node * node, float * v)

VRT_API void VRT_NodeGetZDirection (VRT_Node * node, float * v)

VRT_API VRT_Node* VRT_NodeNew (VRT_Node * parent, char * name) Create a new node. This function creates a new node and attaches it to a parent node in the scene-graph. Any changes to the parent node will affect all child nodes recursively. Parameters:

parent a pointer to the parent node name a text name for the node

Returns:

Page 36: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

32

A pointer to the new noce. See also:

VRT_NodeDelete

VRT_API int VRT_NodePointAxis (VRT_Node * anode, int axis, float * v) Aligning a specific axis of a node with a direction vector. This function can be used to align one of the three axes of a node with a dedicated direction in the parent nodes reference system. The function calculates a new local transformation matrix for the specified node such that at least the specified axis is pointing towards v 8defined in parent coordinate system). Note that axis must be either one of three values: VRT_X VRT_Y VRT_Z Note also, that the direction vector v points to three valid floating-point direction components, and that the length of the direction vector is not 0! The rotation around the new axis direction can not be manipulated at the same time with this function. Parameters:

anode a pointer to a valid node of the scene graph axis the name of one of the three axes v a pointer to 3 floating point components of a direction vector

Returns: 1 if function was successful, otherwise 0.

See also: VRT_NodeSetLocalTransform

VRT_API int VRT_NodeRotate (VRT_Node * anode, float rx, float ry, float rz) Rotate a node. This function rotates a node using rotation angles for x, y and z dimensions. Any geometries attached to the node are not affected, as the rotation is not performed on the geometries themselves, but kept as a rotation matrix with the node, and applied at the moment of rendering. Parameters:

anode a pointer to a geometry. rx rotation angle around x axis ry rotation angle around y axis rz rotation angle around z axis

Returns: Zero on failure.

See also: VRT_NodeScale , VRT_NodeSetScale , VRT_NodeSetRotation , VRT_NodeSetTranslation , VRT_NodeTranslate

VRT_API int VRT_NodeScale (VRT_Node * anode, float sx, float sy, float sz) Change size of a node. This function scales a node using scaling factors for x, y and z dimensions. Any geometries attached to the node are not affected, as the scaling is not performed on the geometries themselves, but kept as a scaling matrix with the node, and used only when drawing the nodes. Parameters:

anode a pointer to a node

Page 37: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

33

sx x scaling factor sy y scaling factor sz z scaling factor

See also: VRT_NodeRotate , VRT_NodeSetScale , VRT_NodeSetRotation , VRT_NodeSetTranslation , VRT_NodeTranslate

VRT_API int VRT_NodeSetDisplayList (VRT_Node * anode, int dpl) Set a display list to a node. This function sets the identifier of the nodes display list. VRT allows the application programmer to execute precompiled OpenGL display lists while nodes are processed in under scene-graph traversal. Display lists are generally executed after the nodes geometry has been drawn. The ability to link display lists to any node in the scene graph allows to apply performance increasing tricks, or to perform some sort of post processing or post rendering of the simulation window frame buffer. Parameters:

anode a pointer to a node dpl an integer identifier for the OpenGL display list

Returns: An integer value identifying the display list.

See also: VRT_NodeGetDisplayList

VRT_API int VRT_NodeSetGeometry (VRT_Node * anode, VRT_Geometry * geom) Attach a geometry to a node. This function attaches a geometry to a node. A node can only have one geometry attached to it, but a geometry can be attached to several nodes. On the other hand, a node can have several children, each attached to a geometry. When the scene is rendered, each node's geometries, and the children nodes' geomtries, will be drawn according to the nodes' transformation matrices. Parameters:

anode a pointer to a node geom a pointer to a geometry

Returns: Zero on failure.

See also: VRT_NodeGetGeometry

VRT_API int VRT_NodeSetLocalTransform (VRT_Node * anode, float * mvm) Setting the local attitude matrix of a node. This function sets explicitely the local transformation matrix of a node i.e. its attitude in relation to its parent node. The matrix is an array of 16 floats, arranged row-wise order. Observe that the matrix passed to the function only represents the nodes local transformation matrix i.e. the nodes attitude with regard to its parent node. Note: The mvm pointer must reference a sufficiently large memory area, which contains 16 reasonable matrix values. Parameters:

anode pointer to a valid node scene graph

Page 38: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

34

mvm a 4x4 floating point matrix Returns:

1 if function was successful, otherwise 0. See also:

VRT_NodeGetLocalTransform

VRT_API void VRT_NodeSetPostRenderCallback (VRT_Node * node, VRT_NODE_CALLBACK * cb)

Set a post-render callback function for a node. This function installs a callback function to be called from within VRT after any rendering related to a particular node is performed, and after the node's children have been processed. This function, together with the VRT_NodeSetPreRenderCallback function, provides a mechanism to extend VRT's rendering capabilities by performing custom OpenGL rendering. If any OpenGL states have been changed from within the pre-render callback, the post-render callback can be used to restore the OpenGL state so that the rest of the rendering will not be affected. The callback function should be declared using the following prototype: void func(VRT_Node *node); To remove a previously installed callback, call the VRT_NodeSetPreRenderCallback function with a NULL value for the cb parameter. Parameters:

node a pointer to a node cb a pointer to the callback to be installed

See also: VRT_NodeSetPreRenderCallback

VRT_API void VRT_NodeSetPreRenderCallback (VRT_Node * node, VRT_NODE_CALLBACK * cb)

Set a pre-render callback function for a node. This function installs a callback function to be called from within VRT before any rendering related to a particular node is performed. This function, together with the VRT_NodeSetPostRenderCallback function, provides a mechanism to extend VRT's rendering capabilities by performing custom OpenGL rendering. Prior to when the callback function is called, the current OpenGL contex will be set up in the same state as it would be set up to perform the rendering related to the node. Also, the current OpenGL modelview matrix will be set to that of the node, so that any geometry rendered from within the callback function should be specified according to the node's local reference system. The callback function should be declared using the following prototype: void func(VRT_Node *node); To remove a previously installed callback, call the VRT_NodeSetPreRenderCallback function with a NULL value for the cb parameter. Parameters:

node a pointer to a node. cb a pointer to the callback to be installed.

See also: VRT_NodeSetPostRenderCallback

VRT_API int VRT_NodeSetRotation (VRT_Node * anode, float rx, float ry, float rz) Set the absolute rotation of a node.

Page 39: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

35

This function sets the absolute rotation of a node, as opposed to the VRT_NodeRotate, which works incrementally. Parameters:

anode a pointer to a anode rx rotation angle around x ry rotation angle around y rz rotation angle around z

Returns: Zero on failure.

See also: VRT_NodeRotate , VRT_NodeScale , VRT_NodeSetScale , VRT_NodeSetTranslation , VRT_NodeTranslate

VRT_API int VRT_NodeSetScale (VRT_Node * anode, float sx, float sy, float sz) Set the absolute scale of a node. This function sets the absolute scaling of a node, as opposed to the VRT_Scale, which works incrementally. Parameters:

anode a pointer to a node sx x scaling factor sy y scaling factor sz z scaling factor

Returns: Zero on failure.

See also: VRT_NodeRotate , VRT_NodeScale , VRT_NodeSetRotation , VRT_NodeSetTranslation , VRT_NodeTranslate

VRT_API int VRT_NodeSetTranslation (VRT_Node * anode, float tx, float ty, float tz) Set absolute translation of a node. This functions sets the absolute translation of a node, as opposed to the VRT_Translate, which works incrementally. Parameters:

anode a pointer to a node tx translation along x axis ty translation along y axis tz translation along z axis

Returns: Zero on failure.

See also: VRT_NodeRotate , VRT_NodeScale , VRT_NodeSetScale , VRT_NodeSetRotation , VRT_NodeTranslate

VRT_API void VRT_NodeSetXDirection (VRT_Node * node, float * v)

Page 40: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

36

VRT_API void VRT_NodeSetYDirection (VRT_Node * node, float * v)

VRT_API void VRT_NodeSetZDirection (VRT_Node * node, float * v)

VRT_API int VRT_NodeSwitchOff (VRT_Node * anode) Make a node invisible. This function turns off the drawing of a node and all of it's children. Parameters:

anode a pointer to a node. Returns:

true if the nod was switched off, false otherwise. See also:

VRT_NodeGetSwitchState , VRT_NodeSwitchOn

VRT_API int VRT_NodeSwitchOn (VRT_Node * anode) Make a node visible. This function turns on the drawing of a node and all of it's children. Parameters:

anode a pointer to a node. Returns:

true if the nod was switched on, false otherwise. See also:

VRT_NodeGetSwitchState , VRT_NodeSwitchOff

VRT_API int VRT_NodeTranslate (VRT_Node * anode, float tx, float ty, float tz) Translate a node. This function translates a node using translation amounts for x, y and z dimensions. Any geometries attached to the node are not affected, as the translation is not performed on the geometries themselves, but kept as a translation matrix with the node, and applied at the moment of rendering. Parameters:

anode a pointer to a node tx translation along x axis ty translation along y axis tz translation along z axis

Returns: Zero on failure.

See also: VRT_NodeRotate , VRT_NodeScale , VRT_NodeSetScale , VRT_NodeSetRotation , VRT_NodeSetTranslation

Page 41: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

37

VRT_API VRT_Node* VRT_RootNode (void)

Geometry

Modules • Intersections • Polygon • Models

Functions • VRT_API VRT_Geometry * VRT_GeometryNew ()

Create a new geometry.

• VRT_API int VRT_GeometryDelete (VRT_Geometry *geom) Dispose a geometry.

• VRT_API int VRT_GeometryAddVertex (VRT_Geometry *geom, float x, float y, float z, float nx, float ny, float nz, float u, float v) Add a vertex to a geometry.

• VRT_API int VRT_GeometrySetVertex (VRT_Geometry *geom, int i, float x, float y, float z, float nx, float ny, float nz, float u, float v) Set vertex data.

• VRT_API int VRT_GeometryGetVertex (VRT_Geometry *geom, int i, float *x, float *y, float *z, float *nx, float *ny, float *nz, float *u, float *v) Get vertex data.

• VRT_API int VRT_GeometryFlipNormals (VRT_Geometry *geom) Inverts the direction of normal vectors.

• VRT_API VRT_HPlg VRT_GeometryNewTriangle (VRT_Geometry *geom, int v1, int v2, int v3) Add a triangle to a geometry.

• VRT_API VRT_HPlg VRT_GeometryNewQuad (VRT_Geometry *geom, int v1, int v2, int v3, int v4) Add a quad to a geometry.

• VRT_API VRT_HPlg VRT_GeometryNewTriangleStrip (VRT_Geometry *geom, int nv, int *vi) Add a triangle strip to a geometry.

Page 42: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

38

• VRT_API VRT_HPlg VRT_GeometryNewQuadStrip (VRT_Geometry *geom, int nv, int *vi) This function adds a new quadriliteral strip to a geometry.

• VRT_API VRT_HPlg VRT_GeometryNewTriangleFan (VRT_Geometry *geom, int nv, int *vi) Add a triangle fan to a geometry.

• VRT_API int VRT_GeometrySetShadingModel (VRT_Geometry *geom, int shadingmodel) Set the shading model of a geometry.

• VRT_API int VRT_GeometryGetShadingModel (VRT_Geometry *geom, int *shadingmodel) Get the shading model of a geometry.

• VRT_API int VRT_GeometrySetColor (VRT_Geometry *geom, int r, int g, int b, int alpha) Set the color of a geometry.

• VRT_API int VRT_GeometryGetColor (VRT_Geometry *geom, int *r, int *g, int *b, int *alpha) Get the color of a geometry.

• VRT_API int VRT_GeometrySetMaterial (VRT_Geometry *geom, float *material) Set the geometry material properties.

• VRT_API int VRT_GeometryGetMaterial (VRT_Geometry *geom, float *material) The function reads the material parameters of a geometry.

• VRT_API int VRT_GeometryGetBoundingBox (VRT_Geometry *geom, float *bounds) Get the bounding box of a geometry.

• VRT_API int VRT_GeometryCalcVertexNormals (VRT_Geometry *geom) Enable smooth shading of geometry.

• VRT_API int VRT_GeometryLock (VRT_Geometry *geom) Restrict access to geometry.

• VRT_API int VRT_GeometryUnlock (VRT_Geometry *geom) Gain access to geometry.

• VRT_API int VRT_GeometryCalculateBoundingSphere (VRT_Geometry *geom) Set the bounding sphere of a geometry.

• VRT_API int VRT_GeometryGetBoundingSphere (VRT_Geometry *geom, float *cx, float *cy, float *cz, float *radius) Get the bounding sphere of a geometry.

• VRT_API int VRT_GeometryNormalize (VRT_Geometry *geom)

Page 43: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

39

Scale a geometry to unit size.

• VRT_API int VRT_GeometryCompile (VRT_Geometry *geom) Speed up geometry drawing.

• VRT_API void VRT_GeometryReverseFaces (VRT_Geometry *geom) Change facing of a geometrys surface.

• VRT_API int VRT_GeometrySetBothSides (VRT_Geometry *geom, int bs) Render both sides of a geometry's polygons.

• VRT_API int VRT_GeometrySetTexture (VRT_Geometry *geom, VRT_Htx texture) Apply texture to a geometry object.

• VRT_API int VRT_GeometryRemoveTexture (VRT_Geometry *geom) Removes the texture from a geometry object.

• VRT_API VRT_Geometry * VRT_GeometryFromPatch (VRT_Patch p) Create a geometry using patch data.

• VRT_API VRT_Geometry * VRT_GeometryMerge (VRT_Geometry *geomA, VRT_Geometry *geomB) Create a new geometry from two other geometries.

• VRT_API int VRT_GeometryTransform (VRT_Geometry *geom, M4 ATOB) Transform a geometry.

• VRT_API void VRT_GeometrySaveVRML (VRT_Geometry *geom, char *fileName) Save geometry data into external file.

• VRT_API void VRT_GeometrySavePLG (VRT_Geometry *geom, char *fileName) Save geometry data into external file.

• VRT_API int VRT_GeometrySaveOBJ (VRT_Geometry *geom, char *file_name, int texturecoordinates, int normals, int materials) Saves a geometry to OBJ format file.

• VRT_API int VRT_GeometryRenderColorsPerPolygon (VRT_Geometry *geom, int flag) Sets color rendering state.

Page 44: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

40

Function Documentation

VRT_API int VRT_GeometryAddVertex (VRT_Geometry * geom, float x, float y, float z, float nx, float ny, float nz, float u, float v)

Add a vertex to a geometry. This function adds a vertex a geometry. The vertex is internally assigned an index in order of addition to the geometry. This index is used to refer to the vertex when polygons are added to the geometry. Parameters:

geom a pointer to a geometry x vertex x component y vertex y component z vertex z component nx vertex normal x component ny vertex normal y compoent nz vertex normal z component u vertex texture u component v vertex texture v component

Returns: a VRT error code.

See also: VRT_GeometryGetVertex , VRT_GeometrySetVertex

VRT_API int VRT_GeometryCalculateBoundingSphere (VRT_Geometry * geom) Set the bounding sphere of a geometry. This function calculates the bounding sphere of a geometry, and stores the information in it. A geometry's bounding sphere is the smallest sphere containing the geometry. The function calculates the center of gravity and the maximum distance of all geometry vertices with regard to the local reference frame of the geometry. Since this is a time computing procedure, this function should be executed once after a geometry is not modified any longer. In order to retrieve the bounding spheres parameters, use the function VRT_GeometryGetBoundingSphere. Parameters:

geom a pointer to a geometry Returns:

Zero on failure. See also:

VRT_GeometryGetBoundingBox , VRT_GeometryLock , VRT_GeometryGetBoundingSphere

VRT_API int VRT_GeometryCalcVertexNormals (VRT_Geometry * geom) Enable smooth shading of geometry. This function calculates the normals of each vertex in the geometry and stores this information in the vertices. Vertex normals are used for smooth shading. This is not done automatically, because computing the normals is a quite time-consuming operation. In flat shading, the polygon normals are used, thereby resulting in a faceted surface. The polygon normals are automatically computed when a polygon is added to a geometry. Parameters:

geom a pointer to a geometry

Page 45: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

41

Returns: Zero on failure.

VRT_API int VRT_GeometryCompile (VRT_Geometry * geom) Speed up geometry drawing. This function uses OpenGL display lists to speed up drawing of a geometry. This will have a substantial effect on performance when dealing with complex geometries. Note that any modifications to a geometry must be completed prior to a call to VRT_GeometryCompile. Once this function has been executed, geometry manipulation routines will show no effect. Parameters:

geom a pointer to a geometry Returns:

Zero on failure.

VRT_API int VRT_GeometryDelete (VRT_Geometry * geom) Dispose a geometry. This function deletes a geometry from the scene. The geometry is detached from any nodes it has been connected to. The geometries vertex and polygon lists are discarded. Parameters:

geom a pointer to a geometry Returns:

a VRT error code. See also:

VRT_GeometryNew

VRT_API int VRT_GeometryFlipNormals (VRT_Geometry * geom) Inverts the direction of normal vectors. This function inverts the direction of the vertex normal vectors in the specified geometry by multiplying each component of the normal vector with a factor of -1.0. The lengths of the vectors are therefore preserved. This function can come handy if an objects normal vectors have for some reason the wrong direction thus causing erroneous shading of the object. Observe that this function does not influence the polygons vertex order (clockwise / counter- clockwise). Therefore, culling of the objects polygons is not affected. Parameters:

geom geometry that shall be processed Returns:

true upon success, false otherwise. See also:

VRT_GeometryCalcVertexNormals , VRT_GeometryReverseFaces

VRT_API VRT_Geometry* VRT_GeometryFromPatch (VRT_Patch p) Create a geometry using patch data.

Page 46: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

42

This function creates a geometry from a patch by triangulating the patch vertex data. Besides the vertices, the geometry are given default properties. Parameters:

p patch Returns:

A pointer to a new geometry. See also:

VRT_GeometryNew , VRT_GeometryMerge

VRT_API int VRT_GeometryGetBoundingBox (VRT_Geometry * geom, float * bounds) Get the bounding box of a geometry. This function gets the bounding box of a geometry. The supplied variable bounds will be filled with an array of bounding box coordinates on return. The bounding box is defined as two points in space: the lower left, innermost point and the upper right, outermost point of the eigth points making up the box. Parameters:

geom pointer to a geometry bounds an array of bounding coordinates

Returns: Zero on failure.

See also: VRT_CalcBoundingSphere , VRT_GetBoundingSphere

VRT_API int VRT_GeometryGetBoundingSphere (VRT_Geometry * geom, float * cx, float * cy, float * cz, float * radius)

Get the bounding sphere of a geometry. This function gets the bounding sphere parameters of a geometry. The bounding sphere is defined as the center of gravity of all vertices of the object and radius of the bounding sphere. If after modifications to the polygon list or vertex array of a geometry you want to retrieve the latest bounding sphere parameters, please use the function VRT_GeometryCalculateBoundingSphere. Parameters:

geom pointer to a geometry cx pointer to center of gravity x coordinate cy pointer to center of gravity y coordinate cz pointer to center of gravity z coordinate radius pointer to bounding sphere radius

Returns: Zero on failure.

See also: VRT_GeometryGetBoundingBox , VRT_GeometryCalculateBoundingSphere

VRT_API int VRT_GeometryGetColor (VRT_Geometry * geom, int * r, int * g, int * b, int * alpha)

Get the color of a geometry.

Page 47: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

43

This function gets the color of a geometry. The color components are in the range of 0-255. The color of a geometry determines the color of polygons added to the geometry. The polygons get the color of the geometry when they are added. Previously added polygons are not affected. On return, the r, g and b variables will hold the color component values of the geometry. The alpha value of a geometry specifies the transparency of an object. A alpha value of 255 means a completely opaque geometry whereas a alpha value of 0 means a fully transparent object. Parameters:

geom pointer to a geometry r a pointer to red color value g a pointer to green color value b a pointer to blue color value alpha a pointer to the alpha value

Returns: Zero on failure.

See also: VRT_GeometryGetColor , VRT_PolygonSetColor

VRT_API int VRT_GeometryGetMaterial (VRT_Geometry * geom, float * material) The function reads the material parameters of a geometry. The function reads the current material of an object. Materials are defined by a set of 17 floating point values, which define the reflective properties of a surface with regard to different types of light. If the object has no material property assigned at the time of the function call, the parameter list returned will contain zero values only. The order of different parameters in the material array and their valid range is as follows: AR (ambient red [0.0 - 1.0]) AG (ambient green [0.0 - 1.0]) AB (ambient blue [0.0 - 1.0]) AA (ambient alpha [0.0 - 1.0]) DR (diffuse red [0.0 - 1.0]) DG (diffuse green [0.0 - 1.0]) DB (diffuse blue [0.0 - 1.0]) DA (diffuse alpha [0.0 - 1.0]) SR (specular red [0.0 - 1.0]) SG (specular green [0.0 - 1.0]) SB (specular blue [0.0 - 1.0]) SA (specular alpha [0.0 - 1.0]) ER (emission red [0.0 - 1.0]) EG (emission green [0.0 - 1.0]) EB (emission blue [0.0 - 1.0]) EA (emission alpha [0.0 - 1.0]) SC (shininess co-efficient [0.0 - 1.0]) Parameters:

geom a pointer to a geometry object material a pointer to an array of 17 floating point values

Returns: Zero on failure.

See also: VRT_GeometrySetMaterial , VRT_GeometrySetColor

VRT_API int VRT_GeometryGetShadingModel (VRT_Geometry * geom, int * shadingmodel) Get the shading model of a geometry. This function retrieves the shading model of a geometry. The supplied shadingmodel variable will be set to the shading model of the geometry on return of the function. The following shading models are presently available: VRT_SM_UNDEFINED : not defined VRT_SM_WIRE : rendering as wireframe VRT_SM_FLAT : constant shaded polygons VRT_SM_SHADE : Gouraud shaded polygons VRT_SM_TEXTURE : Textured polygons Combinations of these values are possible. Observe that in the mode VRT_SM_SHADE normal vectors must be calculated for any geometry vertex. Parameters:

geom pointer to a geometry shadingmodel the shading model of the geometry

Page 48: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

44

Returns: Zero on failure.

See also: VRT_PolygonGetShadingModel , VRT_PolygonSetShadingModel , VRT_GeometrySetShadingModel

VRT_API int VRT_GeometryGetVertex (VRT_Geometry * geom, int i, float * x, float * y, float * z, float * nx, float * ny, float * nz, float * u, float * v)

Get vertex data. This function gets vertex data from a geometries vertex list. Parameters:

geom a pointer to a geometry i the vertex index x a pointer to vertex x component y a pointer to vertex y component z a pointer to vertex z component nx a pointer to vertex normal x component ny a pointer to vertex normal y compoent nz a pointer to vertex normal z component u a pointer to vertex texture u component v a pointer to vertex texture v component

Returns: Zero on failure.

See also: VRT_GeometryAddVertex , VRT_GeometrySetVertex

VRT_API int VRT_GeometryLock (VRT_Geometry * geom) Restrict access to geometry. This functions locks a geometry from further changes to it. All attempts to change the geometry via the VRT API calls will be denied until the geometry is unlocked by a call to VRT_GeometryUnlock. Any attempts will result in an error message. When the geometry is locked, bounding sphere information is calculated. An unlocked geometry has an undefined bounding sphere. Parameters:

geom a pointer to a geometry Returns:

Zero on failure. See also:

VRT_GeometryUnlock , VRT_GeometryCalculateBounding , VRT_GeometryGetBoundingSphere

VRT_API VRT_Geometry* VRT_GeometryMerge (VRT_Geometry * geomA, VRT_Geometry * geomB)

Create a new geometry from two other geometries. This function creates a new geometry by merging two other geometries. Besides the polygon data, the new geometry gets default properties.

Page 49: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

45

Parameters: geomA a pointer to a geometry geomB a pointer to another geometry

Returns: A pointer to a new geometry.

See also: VRT_GeometryNew , VRT_GeometryFromPatch

VRT_API VRT_Geometry* VRT_GeometryNew () Create a new geometry. This function creates a new, empty geometry with default properties. Returns:

A pointer to a geometry. See also:

VRT_GeometryDelete , VRT_GeometryFromPatch , VRT_GeometryMerge

VRT_API VRT_HPlg VRT_GeometryNewQuad (VRT_Geometry * geom, int v1, int v2, int v3, int v4)

Add a quad to a geometry. This function adds a new quad polygon to a geometry. Four vertex indices are specified to make up the quad. These vertices must have been added previously to the geometry. The order by wich the vertices are specified determine the facing of the polygon. Counter-clockwise order is used for front facing. Parameters:

geom a a pointer to a geometry v1 quad vertex index 1 v2 quad vertex index 2 v3 quad vertex index 3 v4 quad vertex index 4

Returns: A handle to the newly created triangle polygon.

See also: VRT_GeometryNewTriangle , VRT_GeometryNewTriangleStrip , VRT_GeometryNewTriangleFan

VRT_API VRT_HPlg VRT_GeometryNewQuadStrip (VRT_Geometry * geom, int nv, int * vi) This function adds a new quadriliteral strip to a geometry. This function adds a new quadriliteral strip to a geometry. The supplied vertex index array holds [nv] indices, referring to the geometry's vertices. A quadriliteral strip is an optimized way to define a set of several contingous quadriliteral polygon. By minimizing the number of vertices passed to the system, increased rendering performance can be achieved. The figure below shows a quadriliteral strip with eight vertices, which defines 3 adjacend quadriliteral polygons. Note that 12 vertices would otherwise be needed to define the same polygons if the VRT_NewQuad function was used. Parameters:

Page 50: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

46

geom a a pointer to a geometry nv number of vertices supplied vi an array of vertex indices

Returns: A handle of type VRT_HPlg to the created quadriliteral strip

See also: VRT_GeometryNewTriangle , VRT_GeometryNewTriangleFan , VRT_GeometryNewQuad , VRT_GeometryNewQuadStrip

VRT_API VRT_HPlg VRT_GeometryNewTriangle (VRT_Geometry * geom, int v1, int v2, int v3)

Add a triangle to a geometry. This function add a new triangle polygon to a geometry. Three vertex indices are specified to make up the triangle. These vertices must have been added previously to the geometry. The order by wich the vertices are specified determine the facing of the polygon. Counter-clockwise order is used for front facing. Parameters:

geom a a pointer to a geometry v1 triangle vertex index 1 v2 triangle vertex index 2 v3 triangle vertex index 3

Returns: A handle to the newly created triangle polygon.

See also: VRT_GeometryNewQuad , VRT_GeometryNewTriangleStrip , VRT_GeometryNewTriangleFan

VRT_API VRT_HPlg VRT_GeometryNewTriangleFan (VRT_Geometry * geom, int nv, int * vi) Add a triangle fan to a geometry. This function adds a new triangle fan to a geometry. The supplied vertex index array holds [nv] indices, referring to the geometry's vertices. Parameters:

geom a a pointer to a geometry nv number of vertices supplied vi array of vertex indices

Returns: A handle to the newly created triangle fan polygon.

See also: VRT_GeometryNewTriangle , VRT_GeometryNewQuad , VRT_GeometryNewTriangleStrip

VRT_API VRT_HPlg VRT_GeometryNewTriangleStrip (VRT_Geometry * geom, int nv, int * vi)

Add a triangle strip to a geometry. This function adds a new triangle strip to a geometry. The supplied vertex index array holds [nv] indices, referring to the geometry's vertices. Parameters:

Page 51: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

47

geom a a pointer to a geometry nv number of vertices supplied vi an array of vertex indices

Returns: A handle to the newly created triangle strip.

See also: VRT_GeometryNewTriangle , VRT_GeometryNewTriangleFan , VRT_GeometryNewQuad , VRT_GeometryNewQuadStrip

VRT_API int VRT_GeometryNormalize (VRT_Geometry * geom) Scale a geometry to unit size. This function normalizes the dimensions of a geometry. This means scaling the geometry to size 1.0 as well as translating it to the center of the objects reference frame. This operation affects the actual vertex data. Normalizing the geometry does not affect the lengths of the normal vectors. Parameters:

geom a pointer to a geometry Returns:

Zero on failure.

VRT_API int VRT_GeometryRemoveTexture (VRT_Geometry * geom) Removes the texture from a geometry object. This function removes a texture assigned to a geometry with VRT_GeometrySetTexture. It does not remove textures assigned to individual polygons. Also it does not take care of deleting the texture, since it can be used by other geometries. To permanently delete the texture, also use VRT_DeleteTexture. Parameters:

geom a pointer to a geometry from which the texture shall be removed Returns:

1 if function succeeded otherwise 0. See also:

VRT_PolygonSetTexture , VRT_GeometrySetTexture , VRT_PolygonRemoveTexture , VRT_DeleteTexture

VRT_API int VRT_GeometryRenderColorsPerPolygon (VRT_Geometry * geom, int flag) Sets color rendering state. If flag is non-zero the individual color attributes of each polygon in the geometry geom will be rendered. A zero value switches the rendering off. Parameters:

geom The geometry to affect. flag A flag with a zero value meaning off and a non-zero meaning on.

Returns: Zero and a VRT error upon falure. One on success.

Page 52: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

48

VRT_API void VRT_GeometryReverseFaces (VRT_Geometry * geom) Change facing of a geometrys surface. This function reverses the facing of all polygons in a geometry, thereby changing the facing of the geometry's surface. This function can be used whenever the appearance of an object is strange due to the fact that only the inside surface of the object seems to be rendered. Note that it might be required to recalculate the objects normal vectors or to flip the objects normal vectors in order to achieve correct lighting results. Parameters:

geom a pointer to a geometry See also:

VRT_GeometryFlipNormals , VRT_GeometryCalcVertexNormals

VRT_API int VRT_GeometrySaveOBJ (VRT_Geometry * geom, char * file_name, int texturecoordinates, int normals, int materials)

Saves a geometry to OBJ format file. This function saves the vertex and polygon data of an object into a Wafefront OBJ format file.The file type is ASCII so it can be manipulated by hand with a text editor. The function returns an error if the file for some reason could not be created. The flags texturecoordinates and normals can be set to non- zero values if it is desired to save texturte coordinates and/or normal vectors per vertex. Note, that VRT does not append a file extension. The .OBJ suffix must be supplied to the filename by the user. Parameters:

geom a pointer to the object to be saved file_name a NULL terminated string pointer for file name texturecoordinates flag to save texture coordinates normals flag to save vertex normals materials flag to save texture filenames

Returns: 1 if function succeeded. 0 if an error occurred. In this case a VRT error is prompted to the console window.

See also: VRT_GeometrySaveVRML , VRT_GeometrySavePLG , VRT_LoadPLG , VRT_LoadOBJ

VRT_API void VRT_GeometrySavePLG (VRT_Geometry * geom, char * fileName) Save geometry data into external file. This function saves the vertex and polygon data of an object into a proprietary file.The file type is ASCII so it can be manipulated by hand with a text editor. The function returns an error if the file for some reason could not be created. Parameters:

geom a pointer to a geomtry fileName the name of the output file including pathes

See also: VRT_GeometrySaveVRML , VRT_GeometrySaveOBJ , VRT_LoadPLG , VRT_LoadOBJ

VRT_API void VRT_GeometrySaveVRML (VRT_Geometry * geom, char * fileName) Save geometry data into external file.

Page 53: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

49

This function saves the vertex and polygon data of an object into VRML 1.0 compatible file.The file type is ASCII so it can be manipulated by hand with a text editor. Only vertex coordinate data and polygon data are stored. The function returns an error if the file for some reason could not be created. Parameters:

geom a pointer to a geomtry fileName the name of the output file including pathes

Returns: A VRT error code.

See also: VRT_GeometrySaveOBJ , VRT_GeometrySaveVRML , VRT_LoadPLG , VRT_LoadOBJ

VRT_API int VRT_GeometrySetBothSides (VRT_Geometry * geom, int bs) Render both sides of a geometry's polygons. This function turns on or off rendering of both sides of the polygons of a geometry, not only the front (as specified by the ordering of vertices in the polygon). Rendering both sides of polygons is sometimes not necessary, for example in the case of a sphere, where the inside of the sphere isn't required to be rendered, because it cannot be seen. Note that rendering of both sides of an object decreases significantly the performance of your application. Parameters:

geom a pointer to a geomtry bs ON/OFF, 1 or 0

Returns: Zero on failure.

VRT_API int VRT_GeometrySetColor (VRT_Geometry * geom, int r, int g, int b, int alpha) Set the color of a geometry. This function sets the color of a geometry. The color components are in the range of 0-255. The color of a geometry determines the color of polygons added to the geometry. The polygons get the color of the geometry when they are added. Previously added polygons are not affected. The alpha value of a geometry specifies the transparency of an object. A alpha value of 255 means a completely opaque geometry whereas a alpha value of 0 means a fully transparent object. Parameters:

geom pointer to a geometry r red color value g green color value b blue color value alpha alpha or transparency value

Returns: Zero on failure.

See also: VRT_GeometryGetColor , VRT_GeometrySetMaterial , VRT_PolygonSetColor

VRT_API int VRT_GeometrySetMaterial (VRT_Geometry * geom, float * material) Set the geometry material properties.

Page 54: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

50

This function sets material parameters of a geometry. If the shading mode of a geometry is set to VRT_SM_SHADE then the material properties of an object are used to calculate shading and lightning of an object. It is also advisable that the vertex normal for any vertex in the object are available for the lightning calculations to succeed. The material properties are defined by an array of 10 floating point values in the range from 0.0 to 1.0: AMBIENT : 3 RGB values DIFFUSE : 3 RGB values SPECULAR : 3 RGB values SHININESS : 1 exponent value VRT provides currently 25 different build in materials which are named VRT_MAT_1 through VRT_MAT_25. Parameters:

geom pointer to a geometry material pointer to an array of material parameters

Returns: Zero on failure.

See also: VRT_GeometryGetColor , VRT_GeometrySetColor

VRT_API int VRT_GeometrySetShadingModel (VRT_Geometry * geom, int shadingmodel) Set the shading model of a geometry. This function sets the shading model of a geometry. The shading model of a geometry determines the shading mode of polygons added to the geometry. The polygons get the shade model of the geometry when the polygon is added. Previously added polygons are not affected. Parameters:

geom a a pointer to a geometry shadingmodel the shading model to set

Returns: Zero on failure.

See also: VRT_GeometryGetShadingModel , VRT_PolygonGetShadingModel , VRT_PolygonSetShadingModel

VRT_API int VRT_GeometrySetTexture (VRT_Geometry * geom, VRT_Htx texture) Apply texture to a geometry object. The function applies a texture to a geometry. The function does not check, if the supplied texture handle is valid! If , in addition, the geometries texture shading model is VRT_SM_TEXTURE, all polygons of the geometries will be textured using the applied texture. Texturing a geometry requires a valid handle of a texture, which has been created prior to the call to VRT_GeometrySetTexture. Note also, that the texture coordinates of the polygons in that geometry must have meaningful values in order to yield reasonable texturing results. Parameters:

geom a pointer to a geometry to which the texture shall be applied texture a handle to the texture to be applied

Returns: 1 if function succeeded otherwise 0.

See also: VRT_CreateRGBATexture , VRT_LoadTexture , VRT_GeometrySetShadingModel , VRT_PolygonSetTexture

Page 55: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

51

VRT_API int VRT_GeometrySetVertex (VRT_Geometry * geom, int i, float x, float y, float z, float nx, float ny, float nz, float u, float v)

Set vertex data. This function sets vertex data. Previous data are overwritten. Parameters:

geom a pointer to a geometry i the vertex index x vertex x component y vertex y component z vertex z component nx vertex normal x component ny vertex normal y compoent nz vertex normal z component u vertex texture u component v vertex texture v component

Returns: a VRT error code.

See also: VRT_GeometryAddVertex , VRT_GeometryGetVertex

VRT_API int VRT_GeometryTransform (VRT_Geometry * geom, M4 ATOB) Transform a geometry. This function transforms the vertices of a geometry by applying the tranformation matrix to each. The transformation matrix is a 4 by 4 matrix. Note that mirroring of the geometry leads to turning the geometry “inside out”, due to the winding of the polygons in the geometry. Here VRT_GeoemtryReverseFaces might come in handy. Parameters:

geom a pointer to a geometry ATOB transformation matrix

Returns: zero (and setting a VRT error) on failure. One on success.

See also: VRT_GeometryReverseFaces

VRT_API int VRT_GeometryUnlock (VRT_Geometry * geom) Gain access to geometry. This function unlocks a geometry that was previously locked, thereby allowing changes to be made to it. Parameters:

geom a pointer to a geometry Returns:

Zero on failure. See also:

VRT_GeometryLock

Page 56: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

52

Polygon

Functions • VRT_API int VRT_PolygonSetShadingModel (VRT_HPlg poly, int rendermode)

Set the shading mode of a polygon.

• VRT_API int VRT_PolygonSetColor (VRT_HPlg poly, int r, int g, int b, int a) Set the color of a polygon.

• VRT_API int VRT_PolygonSetTexture (VRT_HPlg poly, VRT_Htx texture) Set the texture of a polygon.

• VRT_API int VRT_PolygonRemoveTexture (VRT_HPlg poly) Removes the texture from a polygon.

• VRT_API int VRT_PolygonGetShadingModel (VRT_HPlg poly, int *rendermode) • VRT_API int VRT_PolygonGetColor (VRT_HPlg poly, int *r, int *g, int *b, int *a)

Get the color of a polygon.

• VRT_API VRT_Htx VRT_PolygonGetTexture (VRT_HPlg poly) Get the color of a polygon.

Function Documentation

VRT_API int VRT_PolygonGetColor (VRT_HPlg poly, int * r, int * g, int * b, int * a) Get the color of a polygon. This function gets the color and alpha value of a polygon. Parameters:

poly a polygon handle r red color component g green color component b blue color component a alpha component

Returns: Zero on failure.

See also: VRT_GeometryGetColor , VRT_GeometrySetColor , VRT_PolygonSetColor

Page 57: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

53

VRT_API int VRT_PolygonGetShadingModel (VRT_HPlg poly, int * rendermode) This function gets the current shading mode of a polygon. The following shading models are presently available: VRT_SM_UNDEFINED : not defined VRT_SM_WIRE : rendering as wireframe VRT_SM_FLAT : constant shaded polygons VRT_SM_SHADE : Gouraud shaded polygons VRT_SM_TEXTURE : Textured polygons Combinations of these values are possible. Observe that in the mode VRT_SM_SHADE normal vectors must be calculated for any geometry vertex. Parameters:

poly a polygon handle rendermode a shading model

Returns: Zero on failure.

See also: VRT_PolygonSetShadingMode

VRT_API VRT_Htx VRT_PolygonGetTexture (VRT_HPlg poly) Get the color of a polygon. This function gets the texture of a polygon. Parameters:

poly a polygon handle Returns:

A texture handle. See also:

VRT_PolygonSetTexture

VRT_API int VRT_PolygonRemoveTexture (VRT_HPlg poly) Removes the texture from a polygon. This function removes a texture assigned to a polygon with VRT_PolygonSetTexture. It does not remove textures assigned to the whole geometry. Also it does not take care of deleting the texture, since it can be used by other geometries / polygons. To permanently delete the texture, also use VRT_DeleteTexture. Parameters:

poly a handle to a polygon from which the texture shall be removed Returns:

1 if function succeeded otherwise 0. See also:

VRT_PolygonSetTexture , VRT_GeometrySetTexture , VRT_GeometryRemoveTexture , VRT_DeleteTexture

VRT_API int VRT_PolygonSetColor (VRT_HPlg poly, int r, int g, int b, int a) Set the color of a polygon. This function sets the color and alpha value of a polygon. Parameters:

poly a polygon handle r red color component

Page 58: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

54

g green color comonent b blue color component a alpha component

Returns: Zero on failure.

See also: VRT_GeometryGetColor , VRT_GeometrySetColor , VRT_PolygonGetColor

VRT_API int VRT_PolygonSetShadingModel (VRT_HPlg poly, int rendermode) Set the shading mode of a polygon. This function sets the shading model of a polygon. The following shading models are presently available: VRT_SM_UNDEFINED : not defined VRT_SM_WIRE : rendering as wireframe VRT_SM_FLAT : constant shaded polygons VRT_SM_SHADE : Gouraud shaded polygons VRT_SM_TEXTURE : Textured polygons Combinations of these values are possible. Observe that in the mode VRT_SM_SHADE normal vectors must be calculated for any geometry vertex. Parameters:

poly a polygon handle rendermode a shading model

Returns: a VRT error code.

See also: VRT_PolygonGetShadingModel

VRT_API int VRT_PolygonSetTexture (VRT_HPlg poly, VRT_Htx texture) Set the texture of a polygon. This function sets the texture of a polygon. The texture need be previosly loaded with for example a call to VRT_LoadTexture. Parameters:

poly a polygon handle texture a texture handle

Returns: Zero on failure.

See also: VRT_PolygonGetTexture

Models

Functions • VRT_API VRT_Geometry * VRT_Pyramid ()

Create a pyramid geometry.

Page 59: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

55

• VRT_API VRT_Geometry * VRT_Cube (float size) Create a cube geometry.

• VRT_API VRT_Geometry * VRT_Flat () Create a flat box geometry.

• VRT_API VRT_Geometry * VRT_Box (float dx, float dy, float dz) Create a box geometry.

• VRT_API VRT_Geometry * VRT_Plate (float size, char *tname) Create a plate geometry.

• VRT_API VRT_Geometry * VRT_Button (float w, float h, float d, char *texturename) Create a button geometry.

• VRT_API VRT_Geometry * VRT_Arrow (float x) Create an arrow geometry.

• VRT_API VRT_Geometry * VRT_TurnArrow (float x) Create a turn arrow geometry.

• VRT_API VRT_Geometry * VRT_Cone (float tr, float br, float height, int resolution) Create a cone geometry.

• VRT_API VRT_Geometry * VRT_Tube (float tr, float br, float height, int resolution) Creates a tube shaped geometry.

• VRT_API VRT_Geometry * VRT_BulbLock (float diameter, float height, int resolution) Creates a concave circular disc geometry shape.

• VRT_API VRT_Geometry * VRT_Sphere (float diameter, int resolution) Create a sphere geometry.

• VRT_API VRT_Geometry * VRT_ConstantPipe (float radius, int resolution, int numsamples, float *controls) Create a pipe with constant radius along a central poly-line.

• VRT_API VRT_Geometry * VRT_ModulatedPipe (int resolution, int numsamples, float *controls, float *radius) Create a pipe with variable radius along a central poly-line.

• VRT_API VRT_Geometry * VRT_LoadPLG (char *file_name) Load a geometry from file.

Page 60: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

56

• VRT_API VRT_Geometry * VRT_LoadOBJ (char *file_name) Load a geometry from Wafefront ASCII file.

• VRT_API void VRT_NodePreRenderCallback (VRT_Node *node, VRT_NODE_CALLBACK *cb) • VRT_API void VRT_NodePostRenderCallback (VRT_Node *node, VRT_NODE_CALLBACK *cb)

Function Documentation

VRT_API VRT_Geometry* VRT_Arrow (float x) Create an arrow geometry. This function creates an simple arrow geometry, consisting of a cylinder and a cone, centered at the origin. Parameters:

x The length of the arrow Returns:

A pointer to an arrow geometry. See also:

VRT_Box , VRT_Button , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_Box (float dx, float dy, float dz) Create a box geometry. This function creates a simple box geometry of size dx x dy x dz, centered at (dx/2, dy/2, -dz/2). Parameters:

dx width of the box dy height of the box dz depth of the box

Returns: An pointer to a box geometry.

See also: VRT_Arrow , VRT_Button , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_BulbLock (float diameter, float height, int resolution) Creates a concave circular disc geometry shape. This function creates a disk shaped geometry with a convexity into the direction of the positive y-axis. Depending on the height parameter, the shape of the created geometry looks like a satellite dish. Parameters:

diameter diameter of the disk height the height of the concave disc (i.e. convexity) resolution number of segments

Returns: A pointer to the created geometry ot NULL if function failed.

See also:

Page 61: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

57

VRT_Arrow , VRT_Box , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_Button (float w, float h, float d, char * texturename) Create a button geometry. This function creates an object with the appearance of a standard GUI-button. A texture is applied to the top of the button. Parameters:

w width of the button h height of the button d depth of the button. texturename name of texture to be applied to the button

Returns: A pointer to a button geometry.

See also: VRT_Arrow , VRT_Box , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_Cone (float tr, float br, float height, int resolution) Create a cone geometry. This function creates a cone geometry centered at the origin. The sides of the cone is made up of triangles. The number of triangles used is determined by the resolution of the cone. The bottom of the cone is a polygon connecting to the bottom edges of the triangles. Parameters:

tr radius of the cone at the top br radius of the cone at the bottom height height of the cone resolution number of sides in the cone

Returns: A pointer to a cone geometry.

See also: VRT_Arrow , VRT_Button , VRT_Box , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_ConstantPipe (float radius, int resolution, int numsamples, float * controls)

Create a pipe with constant radius along a central poly-line. This function creates a pipe shaped geometry with a circular crossectional shape. The pipes is generated along a central line which is defined by a number of control points in 3D space. The controls pointer must point to an array of at least 3 x numsamples coordinates in the format: x y z x y z x y z . Parameters:

radius the radius of the pipe. resolution the number of segments around the curvature numsamples the number of control points of the central poly controls a pointer to an array of control points

Returns: A pointer to a geometry.

Page 62: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

58

See also: VRT_ModulatedPipe , VRT_Box , VRT_Button , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_Cube (float size) Create a cube geometry. This function creates a simple cube geometry, centered at the orgigin. Parameters:

size size of the cone's sides Returns:

A pointer to a cube geometry. See also:

VRT_Arrow , VRT_Button , VRT_Box , VRT_Cone , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_Flat () Create a flat box geometry. This function creates a box geometry with width 2, height 0.4 and depth 3, centered at the origin. Returns:

A pointer to a flat box geometry. See also:

VRT_Arrow , VRT_Button , VRT_Box , VRT_Cone , VRT_Cube , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_LoadOBJ (char * file_name) Load a geometry from Wafefront ASCII file. This function reads a Wafefront object file and creates a corresponding geometry from the data. The function recognizes a subset of the obj-tags. In the present implementation vertex lists, texture coordinates, normal vector lists, facelists, and material statements are recognized. Observe that the material name in the usemtl statement must represent the name of a texture file. The LoadOBJ function evaluates only the texture property of a material. Therefore, it tries to read and allocate a texture which is identified by the material name. Parameters:

file_name name of the OBJ file Returns:

A pointer to a geometry. See also:

VRT_LoadPLG , VRT_GeometrySavePLG , VRT_GeometrySaveVRML , VRT_LoadTexture

VRT_API VRT_Geometry* VRT_LoadPLG (char * file_name) Load a geometry from file. This function reads a polygon file and creates a geometry from the data. Besides polygon data the geometry are given default properties.

Page 63: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

59

Parameters: file_name name of polygon file

Returns: A pointer to a geometry.

See also: VRT_LoadOBJ , VRT_GeometrySavePLG , VRT_GeometrySaveVRML , VRT_LoadTexture

VRT_API VRT_Geometry* VRT_ModulatedPipe (int resolution, int numsamples, float * controls, float * radius)

Create a pipe with variable radius along a central poly-line. This function creates a pipe shaped geometry with a circular crossectional shape. The pipes is generated along a central line which is defined by a number of control points in 3D space. The radius of the pipe along the central line is modulated by an array of floating point values, which define the current radius at each of the control points of the central poly-line. The radius pointer must point to an array of at least numsamples floating point values. The controls pointer must point to an array of at least 3 x numsamples coordinates in the format: x y z x y z x y z Parameters:

resolution the number of segments around the curvature numsamples the number of control points of the central poly controls a pointer to an array of control points radius a pointer to an array of radius values

Returns: A pointer to a geometry.

See also: VRT_ModulatedPipe , VRT_Box , VRT_Button , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API void VRT_NodePostRenderCallback (VRT_Node * node, VRT_NODE_CALLBACK * cb)

VRT_API void VRT_NodePreRenderCallback (VRT_Node * node, VRT_NODE_CALLBACK * cb)

VRT_API VRT_Geometry* VRT_Plate (float size, char * tname) Create a plate geometry. This function creates a plate geometry and applies a texture to it. Parameters:

size the size of the plate tname a texture file name

Returns: A pointer to a geometry.

See also: VRT_Arrow , VRT_Box , VRT_Button , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

Page 64: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

60

VRT_API VRT_Geometry* VRT_Pyramid () Create a pyramid geometry. This function creates a simple pyramid geometry, with four sides and of unit size. Returns:

A pointer to a geometry. See also:

VRT_Arrow , VRT_Box , VRT_Button , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate

VRT_API VRT_Geometry* VRT_Sphere (float diameter, int resolution) Create a sphere geometry. This function creates a sphere geometry. Parameters:

diameter diameter of the sphere resolution number of segments created to approximate sphere

Returns: A pointer to the geometry or NULL

VRT_API VRT_Geometry* VRT_Tube (float tr, float br, float height, int resolution) Creates a tube shaped geometry. This function creates a tube geometry centered at the origin. The side wall of the cone is made up of triangles. The number of triangles used is determined by the resolution of the cone. Parameters:

tr radius of the cone at the top br radius of the cone at the bottom height height of the cone resolution number of sides in the cone

Returns: A pointer to a tube geometry.

See also: VRT_Arrow , VRT_Button , VRT_Box , VRT_Cube , VRT_Cone , VRT_Flat , VRT_Plate , VRT_Pyramid

VRT_API VRT_Geometry* VRT_TurnArrow (float x) Create a turn arrow geometry. This function creates a turning arrow geometry centered at the origin. Parameters:

x size of turn arrow Returns:

A pointer to a geometry. See also:

Page 65: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

61

VRT_Arrow , VRT_Box , VRT_Button , VRT_Cone , VRT_Cube , VRT_Flat , VRT_Plate , VRT_Pyramid

Pipe

Functions • VRT_API VRT_Pipe * VRT_PipeNew ()

Creates a new rendering pipe.

• VRT_API int VRT_PipeDelete (VRT_Pipe *pipe) Delets a pipe.

• VRT_API int VRT_PipeSetProjector (VRT_Pipe *pipe, VRT_Projector *projector) Connects a projector to a rendering pipe.

• VRT_API int VRT_PipeSetViewport (VRT_Pipe *pipe, float left, float bottom, float width, float height) Sets the viewport for a rendering pipe.

• VRT_API int VRT_PipeSetSpecialFlags (VRT_Pipe *pipe, int stereo, int h_mirror, int v_mirror) Used to set stereom and mirror properties.

• VRT_API VRT_Projector * VRT_PipeGetProjector (VRT_Pipe *pipe) Get the projector connected to a pipe.

• VRT_API int VRT_PipeGetViewport (VRT_Pipe *pipe, float *left, float *bottom, float *width, float *height) Retrieves the viewport properties of a pipe.

• VRT_API int VRT_PipeGetSpecialFlags (VRT_Pipe *pipe, int *stereo, int *h_mirror, int *v_mirror) Retrieves the special flags of a pipe.

• VRT_API int VRT_PipeCount () Returns the number of pipes currently in the PipeList.

• VRT_API VRT_Pipe * VRT_PipeGetByIndex (int index) Retrieves a pipe from the PipeList by it's index.

Page 66: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

62

Function Documentation

VRT_API int VRT_PipeCount () Returns the number of pipes currently in the PipeList. Used to get the number of pipes in the PipeList. Returns:

The number of pipes.

VRT_API int VRT_PipeDelete (VRT_Pipe * pipe) Delets a pipe. Removes a pipe from the PipeList and delets the memory referenced by the pointer. Parameters:

pipe A pointer to the pipe to delete. Returns:

Zero and a VRT error on failure. See also:

VRT_PipeNew

VRT_API VRT_Pipe* VRT_PipeGetByIndex (int index) Retrieves a pipe from the PipeList by it's index. Used to get a pipe from the PipeList by using the index in the list. The index must be non-negative. Parameters:

index the list index. Returns:

The pipe. NULL on error.

VRT_API VRT_Projector* VRT_PipeGetProjector (VRT_Pipe * pipe) Get the projector connected to a pipe. Returns a the projector associated with a pipe. NULL if nop projector exists. Parameters:

pipe the pipe of the desired projector. Returns:

The projector associated with pipe. See also:

VRT_PipeSetProjector

VRT_API int VRT_PipeGetSpecialFlags (VRT_Pipe * pipe, int * stereo, int * h_mirror, int * v_mirror)

Retrieves the special flags of a pipe.

Page 67: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

63

Sets the reference parameters to the corresponding special flags of the pipe. A non-zero flag implies a feature turned on. Parameters:

pipe pointer to the pipe to query. stereo pointer to an int value where the stereo flag value should be stored. h_mirror pointer to an int value where the horizontal mirroring flag value should be stored. v_mirror pointer to an int value where the vertical mirroring flag value should be stored.

Returns: Zero and a VRT error on failure.

See also: VRT_PipeSetSpecialFlags

VRT_API int VRT_PipeGetViewport (VRT_Pipe * pipe, float * left, float * bottom, float * width, float * height)

Retrieves the viewport properties of a pipe. Sets the reference parameters to the corresponding viewport values of the pipe. After a call left, bottom contains the lower left corner of the viewport and width and height the size. Parameters:

pipe pointer to the target pipe. left pointer to a float where the left corner of the viewport should be stored. bottom pointer to a float where the bottom corner of the viewport should be stored. width pointer to a float where the width of the viewport should be stored. height pointer to a float where the height of the viewport should be stored.

Returns: Zero and a VRT error on failure.

See also: VRT_PipeSetViewport

VRT_API VRT_Pipe* VRT_PipeNew () Creates a new rendering pipe. Creates a new rendering pipe and adds it to the PipeList. Returns:

A pointer to the newly created pipe. See also:

VRT_PipeDelete

VRT_API int VRT_PipeSetProjector (VRT_Pipe * pipe, VRT_Projector * projector) Connects a projector to a rendering pipe. Associates a projector with a pipe, so that the pipe will render the view of the projector. Parameters:

pipe the rendering pipe. projector the projector to use.

Returns:

Page 68: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

64

Zero and a VRT error on failure. See also:

VRT_PipeGetProjector

VRT_API int VRT_PipeSetSpecialFlags (VRT_Pipe * pipe, int stereo, int h_mirror, int v_mirror)

Used to set stereom and mirror properties. Sets properties for special rendering pipes requering stereo and/or mirrored output. Non-zero values of the flags stereo, h_mirror and v_mirror turns on stereo rendering, horizontal mirroring of the rendering and vertical mirroring of the rendering respectivly. A zero value turns the corresponding property off. Parameters:

pipe the target rendering pipe. stereo A flag for setting stero rendering on or off. h_mirror A flag for setting horizontal mirroring on or off. v_mirror A flag for setting vertical mirroring on or off.

Returns: Zero and a VRT error on failure.

See also: VRT_PipeGetSpecialFlags

VRT_API int VRT_PipeSetViewport (VRT_Pipe * pipe, float left, float bottom, float width, float height)

Sets the viewport for a rendering pipe. Specifies the viewport for a rendering pipe. The viewport is specified by setting the lower left corner together with the width and height. Note: left, bottom, width and height must be grater or equal then zero. Parameters:

pipe the target rendering pipe. left the left corner of the viewport. bottom the bottom corner of the viewport. width the width of the viewport. height the height of the viewport.

Returns: Zero and a VRT error on failure.

See also: VRT_PipeGetViewport

WoW

Functions • VRT_API VRT_WOW * VRT_WoWNew (VRT_Node *eye, VRT_Node *window)

Creates a new WoW projector.

Page 69: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

65

• VRT_API int VRT_WoWDelete (VRT_WOW *wow)

Removes a WoW projector.

• VRT_API int VRT_WoWSetNodes (VRT_WOW *wow, VRT_Node *eye, VRT_Node *window) Set the eye and window nodes of a projector.

• VRT_API int VRT_WoWSetWidthAndHeight (VRT_WOW *wow, float width, float height) Sets dimensions of the WoW window.

• VRT_API int VRT_WoWSetClipDistances (VRT_WOW *wow, float nearparam, float farparam) Sets clipping distances for a WoW projector.

• VRT_API int VRT_WoWGetNodes (VRT_WOW *wow, VRT_Node **eye, VRT_Node **window) Retrieves the eye and window nodes.

• VRT_API int VRT_WoWGetWidthAndHeight (VRT_WOW *wow, float *width, float *height) Retrieves window dimensions of a Node.

• VRT_API int VRT_WoWGetClipDistances (VRT_WOW *wow, float *nearparam, float *farparam) Retrieves the clip distance.

• VRT_API void VRT_WoWSetPreloadMatrix (VRT_WOW *wow, float *preload) Sets the preload matrix.

Function Documentation

VRT_API int VRT_WoWDelete (VRT_WOW * wow) Removes a WoW projector. This function will try to remove a WoW projector from the list of projectors. Parameters:

wow a pointer to the WoW projector. See also:

VRT_WoWNew

VRT_API int VRT_WoWGetClipDistances (VRT_WOW * wow, float * nearparam, float * farparam)

Retrieves the clip distance. This function is used to get the clipping distances of a WoW projector. After a call to the function the nearparam and farparam will contain the clipping disances.

Page 70: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

66

Parameters: wow the WoW to query. nearparam a pointer to a float. farparam a pointer to a float.

See also: VRT_WoWGetClipDistances

VRT_API int VRT_WoWGetNodes (VRT_WOW * wow, VRT_Node ** eye, VRT_Node ** window)

Retrieves the eye and window nodes. This function retrieves pointers to eye and window nodes of a WoW. After a call to the function the eye and window parameters will point to the respective nodes. Parameters:

wow thw WoW to query. eye an address to a node pointer for the eye node. window an address to a nod pointer for the window node.

See also: VRT_WoWSetNodes

VRT_API int VRT_WoWGetWidthAndHeight (VRT_WOW * wow, float * width, float * height) Retrieves window dimensions of a Node. This function is used to get the size of a WoW window. The default window size is 1.0x1.0 . After a call to the function the parameters widht and height will hold the window dimensions. Parameters:

wow the WoW projector to query. width a pointer to an int. height a pointer to an int.

Returns: Zero on failure.

See also: VRT_WoWSetWidthAndHeight

VRT_API VRT_WOW* VRT_WoWNew (VRT_Node * eye, VRT_Node * window) Creates a new WoW projector. This fuction creates a projector always viewing a specific node in the world from a position constrained to another node. The default window widht and height is set to 1.0 . Parameters:

eye a pointer to a node serving as a view point. window a pointer to a node serving as target of the view.

Returns: A pointer to a WoW structure.

See also: VRT_WoWDelete , VRT_WoWSetWidthAndHeight

Page 71: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

67

VRT_API int VRT_WoWSetClipDistances (VRT_WOW * wow, float nearparam, float farparam)

Sets clipping distances for a WoW projector. This function will place the clippingplanes on the vector between the eye and window nodes. The parameters describes the distance of the planes from the eye node. The near clipping plane must naturally be closer to the eye node than the far planne. Returns:

Zero on failure. See also:

VRT_WoWGetClipDistances

VRT_API int VRT_WoWSetNodes (VRT_WOW * wow, VRT_Node * eye, VRT_Node * window)

Set the eye and window nodes of a projector. This function is used to set the window and eye nodes of a WoW projector. The projector will always view the window node from the position of the eye node. Parameters:

wow a pointer to the projector. eye a pointer to the eye node. window a pointer to the window node.

Returns: Zero on failure.

See also: VRT_WoWGetNodes

VRT_API void VRT_WoWSetPreloadMatrix (VRT_WOW * wow, float * preload) Sets the preload matrix. This function ís used to set the preload matrix (the transforms before any view frustum operations in the matrix chain). Parameters:

wow a pointer to the WoW projector. preload a 16 float array containing the 4x4 matrix.

VRT_API int VRT_WoWSetWidthAndHeight (VRT_WOW * wow, float width, float height) Sets dimensions of the WoW window. This function sets the window widht and height of the WoW window. The default size of the window when WoW is created is 1.0x1.0 . Parameters:

wow a pointer to the WoW projector. width the new widht of the window. height the new height of the window.

Returns: Zero on failure.

Page 72: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

68

See also: VRT_WoWGetWidthAndHeight

Camera

Functions • VRT_API VRT_Camera * VRT_CameraNew ()

Creates a new camera.

• VRT_API int VRT_CameraDelete (VRT_Camera *camera) Deletes a camera.

• VRT_API int VRT_CameraSetNode (VRT_Camera *camera, VRT_Node *node) Attaches a camera to a node.

• VRT_API int VRT_CameraSetFOV (VRT_Camera *camera, float fov) Sets the field of view.

• VRT_API int VRT_CameraSetClipDistances (VRT_Camera *camera, float nearparam, float farparam) Sets near and far clipping planes.

• VRT_API VRT_Node * VRT_CameraGetNode (VRT_Camera *camera) returns the node a camera is attached to.

• VRT_API float VRT_CameraGetFOV (VRT_Camera *camera) Returns the field of view.

• VRT_API int VRT_CameraGetClipDistances (VRT_Camera *camera, float *nearparam, float *farparam) Retrievs the clippping plane distances.

• VRT_API void VRT_ResetDefaultCamera () Resets the camera to default position.

• VRT_API void VRT_SetDefaultCamera (float ex, float ey, float ez, float cx, float cy, float cz, float ux, float uy, float uz) Set the camera properties.

• VRT_API void VRT_GetDefaultCamera (float *ex, float *ey, float *ez, float *cx, float *cy, float *cz, float *ux, float *uy, float *uz) Get the current viewing parameters of the camera.

Page 73: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

69

• VRT_API int VRT_AttachCameraToNode (VRT_Node *node)

Attaches the camera to any node in the scene graph.

• VRT_API void VRT_SetCameraFieldOfView (float fov) Set the current cameras field of view.

• VRT_API void VRT_CameraSetPreloadMatrix (VRT_Camera *camera, float *preload) Sets the preload matrix.

Function Documentation

VRT_API int VRT_AttachCameraToNode (VRT_Node * node) Attaches the camera to any node in the scene graph. In order to ease the animation of the scene camera, VRT allows to attach the camera to any node of the scene. Doing so, the camera viewing parameters are automatically updated as the node travels through the scene. Observe that the camera viewing direction is down the negative z-axis of the nodes reference frame, while the up-vector of the camera corresponds to the y-vector of the nodes reference frame. The field of view of the camera is independently controlled with the function VRT_SetCameraFieldOfView. A camera will remain attached to a node until VRT_AttachCameraToNode is called with NULL as a node parameter or until the application places the camera explicitly with a call to VRT_SetDefaultCamera. Parameters:

node node to which camera is to be attached Returns:

Zero on failure. See also:

VRT_SetCameraFieldOfView , VRT_SetDefaultCamera , VRT_GetDefaultCamera

VRT_API int VRT_CameraDelete (VRT_Camera * camera) Deletes a camera. Removes a camera from VRT, returning allocated memory. Parameters:

camera pointer to the camera. Returns:

Zero and a VRT error on failure.

VRT_API int VRT_CameraGetClipDistances (VRT_Camera * camera, float * nearparam, float * farparam)

Retrievs the clippping plane distances. This function retrieves the clipping plane distances as coordinates on the camera view vector.

Page 74: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

70

Parameters: camera pointer to the camera to query. nearparam float pointer to varaible for the near clipping parameter. farparam float pointer to varaible for the far clipping parameter.

Returns: Zero and a VRT error on failure.

See also: VRT_CameraSetClipDistance

VRT_API float VRT_CameraGetFOV (VRT_Camera * camera) Returns the field of view. This function is used to query a camera for the field of view. Parameters:

camera the camera ti query. See also:

VRT_CameraSetFOV

VRT_API VRT_Node* VRT_CameraGetNode (VRT_Camera * camera) returns the node a camera is attached to. If a the camera has been attached to a node, this node is returned. The default node is the root node. Parameters:

camera the camera to query. Returns:

the node the camera is attached to. See also:

VRT_CameraSetNode

VRT_API VRT_Camera* VRT_CameraNew () Creates a new camera. Creates a new camera setting it's parameters to standard values. The following values are used: Field of view: 45 degrees. Near clipping plane: 1.0 . Far clipping plande: 10000.0 . Returns:

A pointer to the new camera. See also:

VRT_CameraDelete

VRT_API int VRT_CameraSetClipDistances (VRT_Camera * camera, float nearparam, float farparam)

Sets near and far clipping planes. The near and far clipping planes of a camera descibes viewing distance of a camera. Everything closer to respectively further away than the clipping planes is not visible. The values represent coordinates on

Page 75: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

71

the viewing axis of the camera, the greater value the further away a plane is located. Naturally a far plane cannot be closer than the near. Parameters:

camera a pointer to the camera. nearparam the position of the near clipping plane. farparam the position of the far clipping plane.

Returns: Zero and a VRT error on failure.

See also: VRT_CameraGetClipDistances

VRT_API int VRT_CameraSetFOV (VRT_Camera * camera, float fov) Sets the field of view. This function is used to set the field of view (in degrees) of a camera. Parameters:

camera a pointer to the camera. fov the fiewl of view in degrees.

Returns: Zero and a VRT error on failure.

See also: VRT_CameraGetFOV , VRT_SetCameraFieldOfView

VRT_API int VRT_CameraSetNode (VRT_Camera * camera, VRT_Node * node) Attaches a camera to a node. This function is used to connect a camera to any node in the scene. The cameras rotation and position will then change with the node, so that the view-at and view-up vectors of the camera always is aligned with the negative z-axis and positive y-axis of the node reference frame respectivly. Parameters:

camera The camera to attach. node The destination node.

Returns: Zero and a VRT error on failure.

See also: VRT_AttachCameraToNode;

VRT_API void VRT_CameraSetPreloadMatrix (VRT_Camera * camera, float * preload) Sets the preload matrix. This function ís used to set the preload matrix (the transforms before any view frustum operations in the matrix chain). Parameters:

camera a pointer to the camera. preload a 16 float array containing the 4x4 matrix.

Page 76: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

72

VRT_API void VRT_GetDefaultCamera (float * ex, float * ey, float * ez, float * cx, float * cy, float * cz, float * ux, float * uy, float * uz)

Get the current viewing parameters of the camera. This function retrieves the current viewing parameters of the camera. This function is in particular useful if the camera has been attached to a node in the scene graph. In that case, the camera is travelling according to the nodes movements and therefore it is not known to the application at which world coordinate the camera is positioned and oriented. This function is useful to retireve the cameras current looking direction and position. Parameters:

ex a pointer to eye position x ey a pointer to eye position y ez a pointer to eye position z cx a pointer to camera target point x coordinate cy a pointer to camera target point y coordinate cz a pointer to camera target point z coordinate ux a pointer to the camera up vector x component uy a pointer to the camera up vector y component uz a pointer to the camera up vector z component

Returns: void

See also: VRT_SetDefaultCamera , VRT_AttachCameraToNode

VRT_API void VRT_ResetDefaultCamera () Resets the camera to default position. This function resets the camera to a default position at (0, 0, 8), looking at (0, 0, 0), with up vector (0, 1, 0). See also:

VRT_SetDefaultCamera

VRT_API void VRT_SetCameraFieldOfView (float fov) Set the current cameras field of view. This function sets the horizontal field of view for the current camera. The field of view is given as horizontal viewing angle specified in degrees. The horizontal field of view is automatically adapted depending on the aspect ratio of the current display. Note that a narrow field of view causes a zooming-effect (scene is enlarged) whereas a wide field of view reduces the extend of the rendered scene. Parameters:

fov field of view (angle in degrees) See also:

VRT_SetDefaultCamera , VRT_ResetDefaultCamera

Page 77: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

73

VRT_API void VRT_SetDefaultCamera (float ex, float ey, float ez, float cx, float cy, float cz, float ux, float uy, float uz)

Set the camera properties. This function sets the camera properties with respect to position of the camera, look-at vector and up-vector. Parameters:

ex camera x position ey camera y position ez camera z position cx camera look at vector x component cy camera look at vector y component cz camera look at vector z component ux camera up vector x component uy camera up vector y component uz camera up vector z component

See also: VRT_ResetDefaultCamera , VRT_SetCameraFieldOfView

Animation

Functions • VRT_API VRT_Animation * VRT_AnimationNew ()

Create a new animation.

• VRT_API void VRT_AnimationDelete (VRT_Animation *anim) Dispose an animation.

• VRT_API void VRT_AnimationAddPositionKnot (VRT_Animation *anim, float time, float x, float y, float z, float tension, float bias, float continuity) Add a position knot to an animation.

• VRT_API void VRT_AnimationAddRotationKnot (VRT_Animation *anim, float time, float angle, float x, float y, float z, float tension, float bias, float continuity) Add a rotation knot to an animation.

• VRT_API void VRT_AnimationAddScaleKnot (VRT_Animation *anim, float time, float x, float y, float z, float tension, float bias, float continuity) Add a scale knot to an animation.

• VRT_API void VRT_AnimationSetMode (VRT_Animation *anim, int mode) Set the time mode of an animation.

• VRT_API int VRT_AnimationGetMode (VRT_Animation *anim)

Page 78: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

74

Get the current time mode of an animation.

• VRT_API void VRT_AnimationSetTime (VRT_Animation *anim, float t) Set the internal time counter of an animation.

• VRT_API float VRT_AnimationGetTime (VRT_Animation *anim) Get the internal time counter of an animation.

• VRT_API void VRT_AnimationStart (VRT_Animation *anim) Start an animation.

• VRT_API void VRT_AnimationStop (VRT_Animation *anim) Stop an animation.

• VRT_API int VRT_AnimationIsStarted (VRT_Animation *anim) Get the start/stop state of an animation.

Function Documentation

VRT_API void VRT_AnimationAddPositionKnot (VRT_Animation * anim, float time, float x, float y, float z, float tension, float bias, float continuity)

Add a position knot to an animation. This function adds a position knot to an animation. Parameters:

anim The animation to add the knot to time The time, in seconds, where the knot is to be added x The knot's x y The knot's y z The knot's z tension The knot's tension bias The knot's bias continuity The knot's continuity

See also: VRT_AnimationNew , VRT_AnimationAddRotationKnot , VRT_AnimationAddScaleKnot

VRT_API void VRT_AnimationAddRotationKnot (VRT_Animation * anim, float time, float angle, float x, float y, float z, float tension, float bias, float continuity)

Add a rotation knot to an animation. This function adds a rotation knot to an animation. Parameters:

anim The animation to add the knot to time The time, in seconds, where the knot is to be added

Page 79: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

75

angle Amount of degrees to rotate around the axis x X component of the rotation axis y Y component of the rotation axis z Z component of the rotation axis tension The knot's tension bias The knot's bias continuity The knot's continuity

See also: VRT_AnimationNew , VRT_AnimationAddPositionKnot , VRT_AnimationAddScaleKnot

VRT_API void VRT_AnimationAddScaleKnot (VRT_Animation * anim, float time, float x, float y, float z, float tension, float bias, float continuity)

Add a scale knot to an animation. This function adds a scale knot to an animation. Parameters:

anim The animation to add the knot to time The time, in seconds, where the knot is to be added x The knot's scale factor along the x axis y The knot's scale factor along the y axis z The knot's scale factor along the z axis tension The knot's tension bias The knot's bias continuity The knot's continuity

See also: VRT_AnimationNew , VRT_AnimationAddPositionKnot , VRT_AnimationAddRotationKnot

VRT_API void VRT_AnimationDelete (VRT_Animation * anim) Dispose an animation. This function deletes an animation. The animation is detached from any nodes it has been attached to. Parameters:

anim The animation to be disposed See also:

VRT_AnimationNew

VRT_API int VRT_AnimationGetMode (VRT_Animation * anim) Get the current time mode of an animation. This function retreives the current time mode of an animation. For a discussion on animation time modes, see the documentation for the VRT_AnimationGetMode function. Parameters:

anim The animation See also:

VRT_AnimationSetMode

Page 80: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

76

VRT_API float VRT_AnimationGetTime (VRT_Animation * anim) Get the internal time counter of an animation. This function retreives the inte internal time counter of an animation. Parameters:

anim The animation See also:

VRT_AnimationSetTime

VRT_API int VRT_AnimationIsStarted (VRT_Animation * anim) Get the start/stop state of an animation. This function determines wheather an animation is currently started. Parameters:

anim The animation Returns:

Non zero if the animation is started, and zero is the animation is stopped. See also:

VRT_AnimationStart , VRT_AnimationStop

VRT_API VRT_Animation* VRT_AnimationNew () Create a new animation. This function creates a new, empty animation with default properties. Returns:

A pointer to an animation. See also:

VRT_AnimationDelete

VRT_API void VRT_AnimationSetMode (VRT_Animation * anim, int mode) Set the time mode of an animation. This function sets the time mode of an animation. The time mode determines what should happen when the animation's internal time counter counts beyond the last knot of the animation. There are three different possible time modes: VRT_ANIMATION_ONCE The animation will stop. VRT_ANIMATION_REPEAT The animation will be restarted from the beginning. VRT_ANIMATION_PINGPONG The animation will be played backwards to the beginning, then restarted. The default mode is VRT_ANIMATION_REPEAT. Parameters:

anim The animation mode Timing mode of the animation

See also: VRT_AnimationGetMode

Page 81: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

77

VRT_API void VRT_AnimationSetTime (VRT_Animation * anim, float t) Set the internal time counter of an animation. This function sets the current internat time counter of an animation. If the animation is started, i.e. with the function VRT_AnimationStart, this counter will be updated automatically so there is no need to use this function to make the animation run continously. Instead, use this function in the cases where it is necessary to explicitly jump to a different location, for example to restart the animation. Parameters:

anim The animation t The new internal time counter

See also: VRT_AnimationGetTime , VRT_AnimationStart

VRT_API void VRT_AnimationStart (VRT_Animation * anim) Start an animation. This function starts an animation, so that it's internal time counter will automatically be updated. A newly created animation will be started as default. Parameters:

anim The animation See also:

VRT_AnimationStop , VRT_AnimationIsStarted

VRT_API void VRT_AnimationStop (VRT_Animation * anim) Stop an animation. This function stop an animation, so that it's internal time counter will not be automatically updated. A newly created animation will be started as default. Parameters:

anim The animation See also:

VRT_AnimationStart , VRT_AnimationIsStarted

Network

Functions • VRT_API int VRT_NetConnect (int port)

Creates/Connects to VRT distributed node server.

• VRT_API int VRT_NetDisconnect () Dissconects from a VRT server.

• VRT_API VRT_Node * VRT_SharedNodeNew (VRT_Node *parent, char *name)

Page 82: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

78

Creates a new shared node.

Function Documentation

VRT_API int VRT_NetConnect (int port) Creates/Connects to VRT distributed node server. This function starts by opening the file server.ini and searches for a server and port to conenct to. If this should fail (either because the file is missing or the server can not be contacted) it tries to find a server by connecting to the port given as parameter at the computers in the local network. Should no server be found the calling application will be set up to work as a server. Parameters:

port the default port to connect to. Returns:

Zero on failure. See also:

VRT_NetDisconnect

VRT_API int VRT_NetDisconnect () Dissconects from a VRT server. This function disconnects the calling application from any VRT server. Returns:

Zero on failure. See also:

VRT_NetConnect

VRT_API VRT_Node* VRT_SharedNodeNew (VRT_Node * parent, char * name) Creates a new shared node. This function creates a new node and adds it to the server repositry to make it known to all the clients. If the application is not connected to any server a regular node is returned. Parameters:

parent a pointer to the parent node. name a unique name for the node.

Returns: A pointer to the new node.

See also: VRT_NodeNew

Page 83: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

79

Shadow

Functions • int VRT_ExtensionSupported (const char *extension) • void VRT_ShadowSetLight (double position[3], double look_at[3], double up[3]) • void VRT_ShadowSetDimension (int width, int height) • void VRT_ShadowSetPolygonOffset (float polygon_scale, float polygon_bias) • void VRT_ShadowSetTextureOffset (float coordinate_scale, float coordinate_bias) • int VRT_ShadowSwitchOn () • void VRT_ShadowSwitchOff ()

Function Documentation

int VRT_ExtensionSupported (const char * extension)

void VRT_ShadowSetDimension (int width, int height)

void VRT_ShadowSetLight (double position[3], double look_at[3], double up[3])

void VRT_ShadowSetPolygonOffset (float polygon_scale, float polygon_bias)

void VRT_ShadowSetTextureOffset (float coordinate_scale, float coordinate_bias)

void VRT_ShadowSwitchOff ()

int VRT_ShadowSwitchOn ()

VRT Data Structure Documentation

_HPLG Struct Reference

Page 84: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

80

Detailed Description Handle to polygon.

Data Fields • VRT_Geometry * geom • int pi

Field Documentation

VRT_Geometry* _HPLG::geom

int _HPLG::pi

The documentation for this struct was generated from the following file:

• vrt_types.h

_nodepath Struct Reference

Data Fields • int depth • VRT_Node * nodes [VRT_NODEPATH_MAXDEPTH]

Field Documentation

int _nodepath::depth

VRT_Node* _nodepath::nodes[VRT_NODEPATH_MAXDEPTH]

The documentation for this struct was generated from the following file:

• vrt_types.h

Page 85: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

81

_patch Struct Reference

Data Fields • VRT_Vertex * v • int w • int h • int hp • int vp

Field Documentation

int _patch::h

int _patch::hp

VRT_Vertex* _patch::v

int _patch::vp

int _patch::w

The documentation for this struct was generated from the following file:

• vrt_types.h

_VRT_CONTEXT Struct Reference

Data Fields • VRT_Animation * AnimList [VRT_ANIMLIST_MAXANIMS] • VRT_Projector * ProjectorList [VRT_PROJECTORLIST_MAXPROJECTORS] • VRT_Geometry * GeomList [VRT_GEOMLIST_MAXGEOMS] • VRT_Node * NodeList [VRT_NODELIST_MAXNODES]

Page 86: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

82

• VRT_Light * LightList [VRT_LIGHTLIST_MAXLIGHTS] • VRT_Pipe * PipeList [VRT_PIPELIST_MAXPIPES] • VRT_Htx * TextureList [VRT_TEXTURELIST_MAXTEXTURES] • int animcount • int projectorcount • int geomcount • int nodecount • int lightcount • int pipecount • int texturecount • float lastupdate • VRT_Node * root • VRT_Projector * default_camera • VRT_Node * default_camera_node • VRT_Light * default_light • VRT_Pipe * default_pipe • float dc_ex • float dc_ey • float dc_ez • float dc_cx • float dc_cy • float dc_cz • float dc_ux • float dc_uy • float dc_uz • VRT_HookPtr VRT_SIMULATION_HOOK • VRT_PostRenderHookPtr VRT_POSTRENDER_HOOK • int VRT_TEXTURE_MODULATION • int VRT_LIGHT_MODEL • int VRT_ERROR • int VRT_INIT • int VRT_DISP_MODE • int VRT_DISP_WND • int toy • int li • char * polines [160] • VRT_Htx NULL_TEXTURE • GLenum GL_LIGHT_HANDLES [MAX_GL_LIGHTS] • float VRT_MAT_1 [17] • float VRT_MAT_2 [17] • float VRT_MAT_3 [17] • float VRT_MAT_4 [17] • float VRT_MAT_5 [17] • float VRT_MAT_6 [17] • float VRT_MAT_7 [17] • float VRT_MAT_8 [17] • float VRT_MAT_9 [17] • float VRT_MAT_10 [17] • float VRT_MAT_11 [17] • float VRT_MAT_12 [17] • float VRT_MAT_13 [17] • float VRT_MAT_14 [17] • float VRT_MAT_15 [17]

Page 87: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

83

• float VRT_MAT_16 [17] • float VRT_MAT_17 [17] • float VRT_MAT_18 [17] • float VRT_MAT_19 [17] • float VRT_MAT_20 [17] • float VRT_MAT_21 [17] • float VRT_MAT_22 [17] • float VRT_MAT_23 [17] • float VRT_MAT_24 [17] • float VRT_MAT_25 [17] • float VRT_MAT_26 [17] • int rd • int print • unsigned char tabstring [256] • float dc_eyex • float dc_eyey • float dc_eyez • float dc_fov • VRT_Node * dc_camera_node • float dccr • float dccg • float dccb • float dcca • int VRT_PRIMITIVE_COUNT • VRT_Display VRT_DISPLAY • VRT_PPB VRT_PROJECTION • VRT_Time clocks [MAXTIMESTAMPS] • VRT_Time start_clock • float vrt_simulation_time • int clock_cnt • int _vrt_EXIT_SIMULATION_LOOP • int full_frame • SR * sr • int VRT_NET_INIT • char * clientlist • int ourindex • int dirtybit • int current_pipe • int render_shadow • int render_shadow_this_pass • int shadow_width • int shadow_height • float shadow_polygon_scale • float shadow_polygon_bias • float shadow_coordinate_scale • float shadow_coordinate_bias • double shadow_light_position [3] • double shadow_light_look_at [3] • double shadow_light_up [3] • float shadow_mvm [16] • VRT_HookPtr VRT_PIPE_PRERENDER_CALLBACK • VRT_HookPtr VRT_PIPE_POSTRENDER_CALLBACK

Page 88: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

84

Field Documentation

int _VRT_CONTEXT::_vrt_EXIT_SIMULATION_LOOP

int _VRT_CONTEXT::animcount

VRT_Animation* _VRT_CONTEXT::AnimList[VRT_ANIMLIST_MAXANIMS]

char* _VRT_CONTEXT::clientlist

int _VRT_CONTEXT::clock_cnt

VRT_Time _VRT_CONTEXT::clocks[MAXTIMESTAMPS]

int _VRT_CONTEXT::current_pipe

VRT_Node* _VRT_CONTEXT::dc_camera_node

float _VRT_CONTEXT::dc_cx

float _VRT_CONTEXT::dc_cy

float _VRT_CONTEXT::dc_cz

float _VRT_CONTEXT::dc_ex

float _VRT_CONTEXT::dc_ey

Page 89: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

85

float _VRT_CONTEXT::dc_eyex

float _VRT_CONTEXT::dc_eyey

float _VRT_CONTEXT::dc_eyez

float _VRT_CONTEXT::dc_ez

float _VRT_CONTEXT::dc_fov

float _VRT_CONTEXT::dc_ux

float _VRT_CONTEXT::dc_uy

float _VRT_CONTEXT::dc_uz

float _VRT_CONTEXT::dcca

float _VRT_CONTEXT::dccb

float _VRT_CONTEXT::dccg

float _VRT_CONTEXT::dccr

VRT_Projector* _VRT_CONTEXT::default_camera

VRT_Node* _VRT_CONTEXT::default_camera_node

VRT_Light* _VRT_CONTEXT::default_light

Page 90: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

86

VRT_Pipe* _VRT_CONTEXT::default_pipe

int _VRT_CONTEXT::dirtybit

int _VRT_CONTEXT::full_frame

int _VRT_CONTEXT::geomcount

VRT_Geometry* _VRT_CONTEXT::GeomList[VRT_GEOMLIST_MAXGEOMS]

GLenum _VRT_CONTEXT::GL_LIGHT_HANDLES[MAX_GL_LIGHTS]

float _VRT_CONTEXT::lastupdate

int _VRT_CONTEXT::li

int _VRT_CONTEXT::lightcount

VRT_Light* _VRT_CONTEXT::LightList[VRT_LIGHTLIST_MAXLIGHTS]

int _VRT_CONTEXT::nodecount

VRT_Node* _VRT_CONTEXT::NodeList[VRT_NODELIST_MAXNODES]

VRT_Htx _VRT_CONTEXT::NULL_TEXTURE

int _VRT_CONTEXT::ourindex

int _VRT_CONTEXT::pipecount

Page 91: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

87

VRT_Pipe* _VRT_CONTEXT::PipeList[VRT_PIPELIST_MAXPIPES]

char* _VRT_CONTEXT::polines[160]

int _VRT_CONTEXT::print

int _VRT_CONTEXT::projectorcount

VRT_Projector* _VRT_CONTEXT::ProjectorList[VRT_PROJECTORLIST_MAXPROJECTORS]

int _VRT_CONTEXT::rd

int _VRT_CONTEXT::render_shadow

int _VRT_CONTEXT::render_shadow_this_pass

VRT_Node* _VRT_CONTEXT::root

float _VRT_CONTEXT::shadow_coordinate_bias

float _VRT_CONTEXT::shadow_coordinate_scale

int _VRT_CONTEXT::shadow_height

double _VRT_CONTEXT::shadow_light_look_at[3]

double _VRT_CONTEXT::shadow_light_position[3]

double _VRT_CONTEXT::shadow_light_up[3]

Page 92: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

88

float _VRT_CONTEXT::shadow_mvm[16]

float _VRT_CONTEXT::shadow_polygon_bias

float _VRT_CONTEXT::shadow_polygon_scale

int _VRT_CONTEXT::shadow_width

SR* _VRT_CONTEXT::sr

VRT_Time _VRT_CONTEXT::start_clock

unsigned char _VRT_CONTEXT::tabstring[256]

int _VRT_CONTEXT::texturecount

VRT_Htx* _VRT_CONTEXT::TextureList[VRT_TEXTURELIST_MAXTEXTURES]

int _VRT_CONTEXT::toy

int _VRT_CONTEXT::VRT_DISP_MODE

int _VRT_CONTEXT::VRT_DISP_WND

VRT_Display _VRT_CONTEXT::VRT_DISPLAY

int _VRT_CONTEXT::VRT_ERROR

int _VRT_CONTEXT::VRT_INIT

Page 93: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

89

int _VRT_CONTEXT::VRT_LIGHT_MODEL

float _VRT_CONTEXT::VRT_MAT_1[17]

float _VRT_CONTEXT::VRT_MAT_10[17]

float _VRT_CONTEXT::VRT_MAT_11[17]

float _VRT_CONTEXT::VRT_MAT_12[17]

float _VRT_CONTEXT::VRT_MAT_13[17]

float _VRT_CONTEXT::VRT_MAT_14[17]

float _VRT_CONTEXT::VRT_MAT_15[17]

float _VRT_CONTEXT::VRT_MAT_16[17]

float _VRT_CONTEXT::VRT_MAT_17[17]

float _VRT_CONTEXT::VRT_MAT_18[17]

float _VRT_CONTEXT::VRT_MAT_19[17]

float _VRT_CONTEXT::VRT_MAT_2[17]

float _VRT_CONTEXT::VRT_MAT_20[17]

float _VRT_CONTEXT::VRT_MAT_21[17]

Page 94: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

90

float _VRT_CONTEXT::VRT_MAT_22[17]

float _VRT_CONTEXT::VRT_MAT_23[17]

float _VRT_CONTEXT::VRT_MAT_24[17]

float _VRT_CONTEXT::VRT_MAT_25[17]

float _VRT_CONTEXT::VRT_MAT_26[17]

float _VRT_CONTEXT::VRT_MAT_3[17]

float _VRT_CONTEXT::VRT_MAT_4[17]

float _VRT_CONTEXT::VRT_MAT_5[17]

float _VRT_CONTEXT::VRT_MAT_6[17]

float _VRT_CONTEXT::VRT_MAT_7[17]

float _VRT_CONTEXT::VRT_MAT_8[17]

float _VRT_CONTEXT::VRT_MAT_9[17]

int _VRT_CONTEXT::VRT_NET_INIT

VRT_HookPtr _VRT_CONTEXT::VRT_PIPE_POSTRENDER_CALLBACK

VRT_HookPtr _VRT_CONTEXT::VRT_PIPE_PRERENDER_CALLBACK

Page 95: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

91

VRT_PostRenderHookPtr _VRT_CONTEXT::VRT_POSTRENDER_HOOK

int _VRT_CONTEXT::VRT_PRIMITIVE_COUNT

VRT_PPB _VRT_CONTEXT::VRT_PROJECTION

VRT_HookPtr _VRT_CONTEXT::VRT_SIMULATION_HOOK

float _VRT_CONTEXT::vrt_simulation_time

int _VRT_CONTEXT::VRT_TEXTURE_MODULATION

The documentation for this struct was generated from the following file:

• vrt_types.h

_VRT_DEC_INFO Struct Reference

Data Fields • VRT_Geometry * geom • int num_dec_vertices • VRT_DEC_VTX * dvertices

Field Documentation

VRT_DEC_VTX* _VRT_DEC_INFO::dvertices

VRT_Geometry* _VRT_DEC_INFO::geom

int _VRT_DEC_INFO::num_dec_vertices

Page 96: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

92

The documentation for this struct was generated from the following file: • vrt_types.h

_VRT_DEC_VTX Struct Reference

Data Fields • int vertex • int num_adjacent_polys • int * polys

Field Documentation

int _VRT_DEC_VTX::num_adjacent_polys

int* _VRT_DEC_VTX::polys

int _VRT_DEC_VTX::vertex

The documentation for this struct was generated from the following file:

• vrt_types.h

_VRT_DepthMap Struct Reference

Data Fields • int DMW • int DMH • float * dmv • float scx • float scy • float scz • float thresh • int state • VRT_Htx texture

Page 97: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

93

Field Documentation

int _VRT_DepthMap::DMH

float* _VRT_DepthMap::dmv

int _VRT_DepthMap::DMW

float _VRT_DepthMap::scx

float _VRT_DepthMap::scy

float _VRT_DepthMap::scz

int _VRT_DepthMap::state

VRT_Htx _VRT_DepthMap::texture

float _VRT_DepthMap::thresh

The documentation for this struct was generated from the following file:

• vrt_types.h

_VRT_Htx Struct Reference

Detailed Description Handle to texture.

Page 98: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

94

Data Fields • unsigned char * rawdata • GLuint texname • GLuint modulation • int width • int height • char * filename • int indexInList

Field Documentation

char* _VRT_Htx::filename

int _VRT_Htx::height

int _VRT_Htx::indexInList

GLuint _VRT_Htx::modulation

unsigned char* _VRT_Htx::rawdata

GLuint _VRT_Htx::texname

int _VRT_Htx::width

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_AnimationKnottag Struct Reference

Page 99: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

95

Detailed Description ??

Data Fields • float t • float tension • float bias • float continuity • float values [4]

Field Documentation

float VRT_AnimationKnottag::bias

float VRT_AnimationKnottag::continuity

float VRT_AnimationKnottag::t

float VRT_AnimationKnottag::tension

float VRT_AnimationKnottag::values[4]

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_Animationtag Struct Reference

Detailed Description ??

Page 100: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

96

Data Fields • int npk • int nrk • int nsk • int spkl • int srkl • int sskl • VRT_AnimationKnot * pk • VRT_AnimationKnot * rk • VRT_AnimationKnot * sk • float time • float calculatedtime • int started • int mode • float transform [16] • int indexInList

Field Documentation

float VRT_Animationtag::calculatedtime

int VRT_Animationtag::indexInList

int VRT_Animationtag::mode

int VRT_Animationtag::npk

int VRT_Animationtag::nrk

int VRT_Animationtag::nsk

VRT_AnimationKnot* VRT_Animationtag::pk

VRT_AnimationKnot * VRT_Animationtag::rk

VRT_AnimationKnot * VRT_Animationtag::sk

Page 101: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

97

int VRT_Animationtag::spkl

int VRT_Animationtag::srkl

int VRT_Animationtag::sskl

int VRT_Animationtag::started

float VRT_Animationtag::time

float VRT_Animationtag::transform[16]

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_Bitmaptag Struct Reference

Detailed Description ??

Data Fields • unsigned int width • unsigned int height • unsigned int bpp • unsigned char * data

Field Documentation

unsigned int VRT_Bitmaptag::bpp

Page 102: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

98

unsigned char* VRT_Bitmaptag::data

unsigned int VRT_Bitmaptag::height

unsigned int VRT_Bitmaptag::width

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_CB_MSG Struct Reference

Data Fields • int id • int arg1 • int arg2 • int arg3 • int arg4

Field Documentation

int VRT_CB_MSG::arg1

int VRT_CB_MSG::arg2

int VRT_CB_MSG::arg3

int VRT_CB_MSG::arg4

int VRT_CB_MSG::id

The documentation for this struct was generated from the following file:

Page 103: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

99

• vrt_types.h

VRT_Displaytag Struct Reference

Data Fields • int type • int pipes • int stereo • int vp_left [10] • int vp_bottom [10] • int vp_width [10] • int vp_height [10] • int glbuffer [10] • VRT_PPB ppb [10] • VRT_Node * camera [10]

Field Documentation

VRT_Node* VRT_Displaytag::camera[10]

int VRT_Displaytag::glbuffer[10]

int VRT_Displaytag::pipes

VRT_PPB VRT_Displaytag::ppb[10]

int VRT_Displaytag::stereo

int VRT_Displaytag::type

int VRT_Displaytag::vp_bottom[10]

Page 104: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

100

int VRT_Displaytag::vp_height[10]

int VRT_Displaytag::vp_left[10]

int VRT_Displaytag::vp_width[10]

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_Geometrytag Struct Reference

Detailed Description Geometry.

Data Fields • int nv • int np • int svl • int spl • int lock • int compile • int colors_per_polygon • int nc • VRT_Vertex * vtx • VRT_Polygon * ply • int cr • int cg • int cb • int alpha • VRT_Htx texture • int shademodel • int bothsides • float cx • float cy • float cz • float radius • float * material • int indexInList

Page 105: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

101

Field Documentation

int VRT_Geometrytag::alpha

int VRT_Geometrytag::bothsides

int VRT_Geometrytag::cb

int VRT_Geometrytag::cg

int VRT_Geometrytag::colors_per_polygon

int VRT_Geometrytag::compile

int VRT_Geometrytag::cr

float VRT_Geometrytag::cx

float VRT_Geometrytag::cy

float VRT_Geometrytag::cz

int VRT_Geometrytag::indexInList

int VRT_Geometrytag::lock

float* VRT_Geometrytag::material

Page 106: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

102

int VRT_Geometrytag::nc

int VRT_Geometrytag::np

int VRT_Geometrytag::nv

VRT_Polygon* VRT_Geometrytag::ply

float VRT_Geometrytag::radius

int VRT_Geometrytag::shademodel

int VRT_Geometrytag::spl

int VRT_Geometrytag::svl

VRT_Htx VRT_Geometrytag::texture

VRT_Vertex* VRT_Geometrytag::vtx

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_Lighttag Struct Reference

Data Fields • int type • int switch_state • float ambient [4] • float diffuse [4] • float specular [4]

Page 107: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

103

• float spot_cutoff • float spot_exponent • float constant_attenuation • float linear_attenuation • float quadric_attenuation • float position [3] • float direction [3] • VRT_Node * position_node • VRT_Node * target_node • int indexInList

Field Documentation

float VRT_Lighttag::ambient[4]

float VRT_Lighttag::constant_attenuation

float VRT_Lighttag::diffuse[4]

float VRT_Lighttag::direction[3]

int VRT_Lighttag::indexInList

float VRT_Lighttag::linear_attenuation

float VRT_Lighttag::position[3]

VRT_Node* VRT_Lighttag::position_node

float VRT_Lighttag::quadric_attenuation

float VRT_Lighttag::specular[4]

float VRT_Lighttag::spot_cutoff

Page 108: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

104

float VRT_Lighttag::spot_exponent

int VRT_Lighttag::switch_state

VRT_Node* VRT_Lighttag::target_node

int VRT_Lighttag::type

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_Nodetag Struct Reference

Detailed Description Node.

Data Fields • char * name • float tx • float ty • float tz • float rx • float ry • float rz • float sx • float sy • float sz • float LTM [16] • int num_children • int active • int display_list • void * shared_data • void * user_data • int user_tag • int net_creator • VRT_NODE_CALLBACK * prerender • VRT_NODE_CALLBACK * postrender

Page 109: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

105

• VRT_Geometry * geom • VRT_Node * parent • void * children [VRT_NODE_MAXCHILDREN] • VRT_Animation * animation • int indexInList

Field Documentation

int VRT_Nodetag::active

VRT_Animation* VRT_Nodetag::animation

void* VRT_Nodetag::children[VRT_NODE_MAXCHILDREN]

int VRT_Nodetag::display_list

VRT_Geometry* VRT_Nodetag::geom

int VRT_Nodetag::indexInList

float VRT_Nodetag::LTM[16]

char* VRT_Nodetag::name

int VRT_Nodetag::net_creator

int VRT_Nodetag::num_children

VRT_Node* VRT_Nodetag::parent

VRT_NODE_CALLBACK * VRT_Nodetag::postrender

Page 110: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

106

VRT_NODE_CALLBACK* VRT_Nodetag::prerender

float VRT_Nodetag::rx

float VRT_Nodetag::ry

float VRT_Nodetag::rz

void* VRT_Nodetag::shared_data

float VRT_Nodetag::sx

float VRT_Nodetag::sy

float VRT_Nodetag::sz

float VRT_Nodetag::tx

float VRT_Nodetag::ty

float VRT_Nodetag::tz

void* VRT_Nodetag::user_data

int VRT_Nodetag::user_tag

The documentation for this struct was generated from the following file:

• vrt_types.h

Page 111: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

107

VRT_Pipetag Struct Reference

Data Fields • int stereo • int v_mirror • int h_mirror • float left • float bottom • float width • float height • VRT_Projector * projector • int indexInList

Field Documentation

float VRT_Pipetag::bottom

int VRT_Pipetag::h_mirror

float VRT_Pipetag::height

int VRT_Pipetag::indexInList

float VRT_Pipetag::left

VRT_Projector* VRT_Pipetag::projector

int VRT_Pipetag::stereo

int VRT_Pipetag::v_mirror

float VRT_Pipetag::width

The documentation for this struct was generated from the following file:

Page 112: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

108

• vrt_types.h

VRT_Polygontag Struct Reference

Detailed Description Polygon.

Data Fields • int nv • int * vi • int optimized • VRT_Htx texture • int cr • int cg • int cb • int alpha • float nx • float ny • float nz • int shademodel

Field Documentation

int VRT_Polygontag::alpha

int VRT_Polygontag::cb

int VRT_Polygontag::cg

int VRT_Polygontag::cr

int VRT_Polygontag::nv

Page 113: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

109

float VRT_Polygontag::nx

float VRT_Polygontag::ny

float VRT_Polygontag::nz

int VRT_Polygontag::optimized

int VRT_Polygontag::shademodel

VRT_Htx VRT_Polygontag::texture

int* VRT_Polygontag::vi

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_PPBtag Struct Reference

Detailed Description ??

Data Fields • double sc [3] • double sn [3] • double su [3] • double vp [3] • double width • double height • double front • double back • float preloadmatrix [16]

Page 114: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

110

Field Documentation

double VRT_PPBtag::back

double VRT_PPBtag::front

double VRT_PPBtag::height

float VRT_PPBtag::preloadmatrix[16]

double VRT_PPBtag::sc[3]

double VRT_PPBtag::sn[3]

double VRT_PPBtag::su[3]

double VRT_PPBtag::vp[3]

double VRT_PPBtag::width

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT_Projectortag Struct Reference

Data Fields • int type • float fov • float near_clip_distance

Page 115: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

111

• float far_clip_distance • float window_width • float window_height • VRT_Node * eye_node • VRT_Node * window_node • VRT_PPB raw_ppb • float preloadmatrix [16] • int indexInList

Field Documentation

VRT_Node* VRT_Projectortag::eye_node

float VRT_Projectortag::far_clip_distance

float VRT_Projectortag::fov

int VRT_Projectortag::indexInList

float VRT_Projectortag::near_clip_distance

float VRT_Projectortag::preloadmatrix[16]

VRT_PPB VRT_Projectortag::raw_ppb

int VRT_Projectortag::type

float VRT_Projectortag::window_height

VRT_Node* VRT_Projectortag::window_node

float VRT_Projectortag::window_width

Page 116: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

112

The documentation for this struct was generated from the following file: • vrt_types.h

VRT_Vertextag Struct Reference

Detailed Description Vertex.

Data Fields • float x • float y • float z • float nx • float ny • float nz • float u • float v

Field Documentation

float VRT_Vertextag::nx

float VRT_Vertextag::ny

float VRT_Vertextag::nz

float VRT_Vertextag::u

float VRT_Vertextag::v

float VRT_Vertextag::x

Page 117: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

113

float VRT_Vertextag::y

float VRT_Vertextag::z

The documentation for this struct was generated from the following file:

• vrt_types.h

VRT File Documentation

vrt.h File Reference

Defines • #define __VRT_UNIX__ • #define __VRT_BIG_ENDIAN__ • #define VRT_API • #define VRT_Init(x, y) VRT_Init((x), (y), VRT_H_VER, VRT_VNC_H_VER)

Define Documentation

#define __VRT_BIG_ENDIAN__

#define __VRT_UNIX__

#define VRT_API

#define VRT_Init(x, y) VRT_Init((x), (y), VRT_H_VER, VRT_VNC_H_VER)

vrt_core.h File Reference

Page 118: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

114

Functions • VRT_API int VRT_GetLastError (char *error_message, int size)

Get error code and error message for the last VRT error.

• VRT_API void VRT_Close () Close the VRT library.

• VRT_API void VRT_SimulationLoop () Start the VRT simulation loop.

• VRT_API void VRT_ExitSimulationLoop () Leave the VRT simulation loop from any point within the user program.

• VRT_API void VRT_PrintSceneGraph () Prints the current scene graph to the VRT console.

• VRT_API float VRT_GetFrameRate () Get the current fram rate of VRT.

• VRT_API float VRT_GetSimulationTime () Get the up-time of the simulation.

• VRT_API void VRT_SetClearColor (float r, float g, float b, float a) Sets the VRT clearing color.

• VRT_API void VRT_GetClearColor (float *r, float *g, float *b, float *a) Get the clearing color VRT uses.

• VRT_API void VRT_SetLightModel (int lightmodel) Setting the current light model.

• VRT_API int VRT_GetLightModel () Retrieving the current light model.

• VRT_API void VRT_SetTextureModulationMode (int texture_modulation) Setting the global texture modulation mode.

• VRT_API int VRT_GetTextureModulationMode () Retrieving the currently set texture modulation mode.

• VRT_API VRT_Htx VRT_LoadTexture (char *filename) Load a texture from file.

Page 119: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

115

• VRT_API VRT_Htx VRT_CreateRGBATexture (int sx, int sy, char *texels) Create a texture.

• VRT_API int VRT_DeleteTexture (VRT_Htx *texture) Delete a texture.

• VRT_API int VRT_ReplaceRGBATexture (VRT_Htx *texture, int sx, int sy, char *texels) Replace a texture.

• VRT_API int VRT_ReplaceRGBASubTexture (VRT_Htx *texture, int x, int y, int w, int h, char *texels) Replaces part of a texture.

• VRT_API int VRT_DeleteNodePath (VRT_NodePath *np) Delete a nodepath.

• VRT_API void VRT_TransformVertex3D (float *v, float *ctm) Transform a single vertex.

• VRT_API int VRT_IntersectRayTriangleUVT (float *p, float *d, float *v1, float *v2, float *v3, float *uvt) Test for intersection of a ray with a triangle.

• VRT_API int VRT_IntersectRayTriangle (float *p, float *d, float *v1, float *v2, float *v3, float *t) Test for intersection of a ray with a triangle.

• VRT_API int VRT_IntersectTriangleTriangle (float *v1, float *v2, float *v3, float *u1, float *u2, float *u3) Test for triangle-triangle intersection.

• VRT_API int VRT_IntersectRayQuad (float *p, float *d, float *v1, float *v2, float *v3, float *v4, float *t) Test for intersection of a ray with a four sided polygon.

• VRT_API int VRT_IntersectRayNode (float *p, float *d, VRT_Node *anode, float *t, VRT_HPlg *hit_poly) Test for intersection of a ray with a node.

• VRT_API int VRT_NodeIntersectNode (VRT_Node *sn, VRT_Node *tn) Check if two nodes intersect.

• VRT_API void VRT_SplineCurve (VRT_Vertex *spline, int knots, int samples) Calculates an interpolated Beziér-Spline.

• VRT_API VRT_Node * VRT_RootNode (void)

Page 120: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

116

• VRT_API VRT_Node * VRT_NodeNew (VRT_Node *parent, char *name) Create a new node.

• VRT_API int VRT_NodeDelete (VRT_Node *anode) Delete a node.

• VRT_API int VRT_DeleteNodeTree (VRT_Node *anode, int flag) Deletes a node tree.

• VRT_API int VRT_NodeAttachNode (VRT_Node *parent, VRT_Node *child) Attach as child to another node.

• VRT_API int VRT_NodeTranslate (VRT_Node *anode, float tx, float ty, float tz) Translate a node.

• VRT_API int VRT_NodeRotate (VRT_Node *anode, float rx, float ry, float rz) Rotate a node.

• VRT_API int VRT_NodeScale (VRT_Node *anode, float sx, float sy, float sz) Change size of a node.

• VRT_API int VRT_NodeSetTranslation (VRT_Node *anode, float tx, float ty, float tz) Set absolute translation of a node.

• VRT_API int VRT_NodeSetRotation (VRT_Node *anode, float rx, float ry, float rz) Set the absolute rotation of a node.

• VRT_API int VRT_NodeSetScale (VRT_Node *anode, float sx, float sy, float sz) Set the absolute scale of a node.

• VRT_API int VRT_NodeSetGeometry (VRT_Node *anode, VRT_Geometry *geom) Attach a geometry to a node.

• VRT_API int VRT_NodeSetDisplayList (VRT_Node *anode, int dpl) Set a display list to a node.

• VRT_API int VRT_NodeGetDisplayList (VRT_Node *anode) Get a geometrys display list.

• VRT_API VRT_Geometry * VRT_NodeGetGeometry (VRT_Node *anode) Get the geometry of a node.

• VRT_API VRT_NodePath * VRT_NodeGetNodepath (VRT_Node *anode) Get the nodepath of a node.

Page 121: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

117

• VRT_API int VRT_NodeGetTransform (VRT_Node *anode, float *mvm)

Get the current transformation matrix of a node.

• VRT_API int VRT_NodeGetLocalTransform (VRT_Node *anode, float *mvm) Get the local transformation matrix of a node.

• VRT_API int VRT_NodeSetLocalTransform (VRT_Node *anode, float *mvm) Setting the local attitude matrix of a node.

• VRT_API int VRT_NodePointAxis (VRT_Node *anode, int axis, float *v) Aligning a specific axis of a node with a direction vector.

• VRT_API int VRT_NodeSwitchOff (VRT_Node *anode) Make a node invisible.

• VRT_API int VRT_NodeSwitchOn (VRT_Node *anode) Make a node visible.

• VRT_API int VRT_NodeGetSwitchState (VRT_Node *anode) Get the switch state of a node.

• VRT_API void VRT_NodeSetPreRenderCallback (VRT_Node *node, VRT_NODE_CALLBACK *cb) Set a pre-render callback function for a node.

• VRT_API void VRT_NodeSetPostRenderCallback (VRT_Node *node, VRT_NODE_CALLBACK *cb) Set a post-render callback function for a node.

• VRT_API VRT_Geometry * VRT_GeometryNew () Create a new geometry.

• VRT_API int VRT_GeometryDelete (VRT_Geometry *geom) Dispose a geometry.

• VRT_API int VRT_GeometryAddVertex (VRT_Geometry *geom, float x, float y, float z, float nx, float ny, float nz, float u, float v) Add a vertex to a geometry.

• VRT_API int VRT_GeometrySetVertex (VRT_Geometry *geom, int i, float x, float y, float z, float nx, float ny, float nz, float u, float v) Set vertex data.

Page 122: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

118

• VRT_API int VRT_GeometryGetVertex (VRT_Geometry *geom, int i, float *x, float *y, float *z, float *nx, float *ny, float *nz, float *u, float *v) Get vertex data.

• VRT_API int VRT_GeometryFlipNormals (VRT_Geometry *geom) Inverts the direction of normal vectors.

• VRT_API VRT_HPlg VRT_GeometryNewTriangle (VRT_Geometry *geom, int v1, int v2, int v3) Add a triangle to a geometry.

• VRT_API VRT_HPlg VRT_GeometryNewQuad (VRT_Geometry *geom, int v1, int v2, int v3, int v4) Add a quad to a geometry.

• VRT_API VRT_HPlg VRT_GeometryNewTriangleStrip (VRT_Geometry *geom, int nv, int *vi) Add a triangle strip to a geometry.

• VRT_API VRT_HPlg VRT_GeometryNewQuadStrip (VRT_Geometry *geom, int nv, int *vi) This function adds a new quadriliteral strip to a geometry.

• VRT_API VRT_HPlg VRT_GeometryNewTriangleFan (VRT_Geometry *geom, int nv, int *vi) Add a triangle fan to a geometry.

• VRT_API int VRT_GeometrySetShadingModel (VRT_Geometry *geom, int shadingmodel) Set the shading model of a geometry.

• VRT_API int VRT_GeometryGetShadingModel (VRT_Geometry *geom, int *shadingmodel) Get the shading model of a geometry.

• VRT_API int VRT_GeometrySetColor (VRT_Geometry *geom, int r, int g, int b, int alpha) Set the color of a geometry.

• VRT_API int VRT_GeometryGetColor (VRT_Geometry *geom, int *r, int *g, int *b, int *alpha) Get the color of a geometry.

• VRT_API int VRT_GeometrySetMaterial (VRT_Geometry *geom, float *material) Set the geometry material properties.

• VRT_API int VRT_GeometryGetMaterial (VRT_Geometry *geom, float *material) The function reads the material parameters of a geometry.

• VRT_API int VRT_GeometryGetBoundingBox (VRT_Geometry *geom, float *bounds) Get the bounding box of a geometry.

• VRT_API int VRT_GeometryCalcVertexNormals (VRT_Geometry *geom)

Page 123: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

119

Enable smooth shading of geometry.

• VRT_API int VRT_GeometryLock (VRT_Geometry *geom) Restrict access to geometry.

• VRT_API int VRT_GeometryUnlock (VRT_Geometry *geom) Gain access to geometry.

• VRT_API int VRT_GeometryCalculateBoundingSphere (VRT_Geometry *geom) Set the bounding sphere of a geometry.

• VRT_API int VRT_GeometryGetBoundingSphere (VRT_Geometry *geom, float *cx, float *cy, float *cz, float *radius) Get the bounding sphere of a geometry.

• VRT_API int VRT_GeometryNormalize (VRT_Geometry *geom) Scale a geometry to unit size.

• VRT_API int VRT_GeometryCompile (VRT_Geometry *geom) Speed up geometry drawing.

• VRT_API void VRT_GeometryReverseFaces (VRT_Geometry *geom) Change facing of a geometrys surface.

• VRT_API int VRT_GeometrySetBothSides (VRT_Geometry *geom, int bs) Render both sides of a geometry's polygons.

• VRT_API int VRT_GeometrySetTexture (VRT_Geometry *geom, VRT_Htx texture) Apply texture to a geometry object.

• VRT_API int VRT_GeometryRemoveTexture (VRT_Geometry *geom) Removes the texture from a geometry object.

• VRT_API VRT_Geometry * VRT_GeometryFromPatch (VRT_Patch p) Create a geometry using patch data.

• VRT_API VRT_Geometry * VRT_GeometryMerge (VRT_Geometry *geomA, VRT_Geometry *geomB) Create a new geometry from two other geometries.

• VRT_API int VRT_GeometryTransform (VRT_Geometry *geom, M4 ATOB) Transform a geometry.

• VRT_API void VRT_GeometrySaveVRML (VRT_Geometry *geom, char *fileName)

Page 124: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

120

Save geometry data into external file.

• VRT_API void VRT_GeometrySavePLG (VRT_Geometry *geom, char *fileName) Save geometry data into external file.

• VRT_API int VRT_GeometrySaveOBJ (VRT_Geometry *geom, char *file_name, int texturecoordinates, int normals, int materials) Saves a geometry to OBJ format file.

• VRT_API int VRT_GeometryRenderColorsPerPolygon (VRT_Geometry *geom, int flag) Sets color rendering state.

• VRT_API VRT_Light * VRT_LightNew (int light_type) Create a new light source object.

• VRT_API int VRT_LightDelete (VRT_Light *light) Delete a light object and free allocated resources.

• VRT_API int VRT_LightSetColors (VRT_Light *light, float *colors) Setting the color parameters of a light source object.

• VRT_API int VRT_LightGetColors (VRT_Light *light, float *colors) Retrieve color parameters of a light source.

• VRT_API int VRT_LightSetAttenuation (VRT_Light *light, float *attenuation) Setting the attenuation parameters of a light source object.

• VRT_API int VRT_LightGetAttenuation (VRT_Light *light, float *attenuation) Retrieves the attenuation factors of a light source.

• VRT_API int VRT_LightSetSpotParameters (VRT_Light *light, float exponent, float cutoff) Setting the spotlight light cone parameters.

• VRT_API int VRT_LightGetSpotParameters (VRT_Light *light, float *exponent, float *cutoff) Retrieving the spotlight light cone parameters.

• VRT_API int VRT_LightSetPosition (VRT_Light *light, float x, float y, float z) Setting the explicite position of a light source object.

• VRT_API int VRT_LightGetPosition (VRT_Light *light, float *x, float *y, float *z) Get the explicite position of a light source object.

• VRT_API int VRT_LightSetDirection (VRT_Light *light, float dx, float dy, float dz) Setting the direction of a direction light source object.

Page 125: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

121

• VRT_API int VRT_LightGetDirection (VRT_Light *light, float *dx, float *dy, float *dz)

Get the direction of a direction light source object.

• VRT_API int VRT_LightSetPositionNode (VRT_Light *light, VRT_Node *nposition) Setting the position node of a light source object.

• VRT_API VRT_Node * VRT_LightGetPositionNode (VRT_Light *light) Retrieve position node of a light source object.

• VRT_API int VRT_LightSetTargetNode (VRT_Light *light, VRT_Node *ntarget) Setting the target node of a directional light source object.

• VRT_API VRT_Node * VRT_LightGetTargetNode (VRT_Light *light) Retreiving the target node of a directional light.

• VRT_API int VRT_LightSwitchOn (VRT_Light *light) Switching on a light source object.

• VRT_API int VRT_LightSwitchOff (VRT_Light *light) Switching off a light source object.

• VRT_API int VRT_LightGetSwitchState (VRT_Light *light) Retrieving the current switch state of a light source object.

• VRT_API int VRT_LightSetType (VRT_Light *light, int light_type) Setting the type of the specified light source object.

• VRT_API int VRT_LightGetType (VRT_Light *light) Retreives the type of the specified light source object.

• VRT_API VRT_Patch VRT_PatchInterpolate (VRT_Patch p, int w, int h) Increase the resolution of a patch.

• VRT_API int VRT_PolygonSetShadingModel (VRT_HPlg poly, int rendermode) Set the shading mode of a polygon.

• VRT_API int VRT_PolygonSetColor (VRT_HPlg poly, int r, int g, int b, int a) Set the color of a polygon.

• VRT_API int VRT_PolygonSetTexture (VRT_HPlg poly, VRT_Htx texture) Set the texture of a polygon.

• VRT_API int VRT_PolygonRemoveTexture (VRT_HPlg poly)

Page 126: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

122

Removes the texture from a polygon.

• VRT_API int VRT_PolygonGetShadingModel (VRT_HPlg poly, int *rendermode) • VRT_API int VRT_PolygonGetColor (VRT_HPlg poly, int *r, int *g, int *b, int *a)

Get the color of a polygon.

• VRT_API VRT_Htx VRT_PolygonGetTexture (VRT_HPlg poly) Get the color of a polygon.

• VRT_API VRT_Geometry * VRT_Pyramid () Create a pyramid geometry.

• VRT_API VRT_Geometry * VRT_Cube (float size) Create a cube geometry.

• VRT_API VRT_Geometry * VRT_Flat () Create a flat box geometry.

• VRT_API VRT_Geometry * VRT_Box (float dx, float dy, float dz) Create a box geometry.

• VRT_API VRT_Geometry * VRT_Plate (float size, char *tname) Create a plate geometry.

• VRT_API VRT_Geometry * VRT_Button (float w, float h, float d, char *texturename) Create a button geometry.

• VRT_API VRT_Geometry * VRT_Arrow (float x) Create an arrow geometry.

• VRT_API VRT_Geometry * VRT_TurnArrow (float x) Create a turn arrow geometry.

• VRT_API VRT_Geometry * VRT_Cone (float tr, float br, float height, int resolution) Create a cone geometry.

• VRT_API VRT_Geometry * VRT_Tube (float tr, float br, float height, int resolution) Creates a tube shaped geometry.

• VRT_API VRT_Geometry * VRT_BulbLock (float diameter, float height, int resolution) Creates a concave circular disc geometry shape.

• VRT_API VRT_Geometry * VRT_Sphere (float diameter, int resolution) Create a sphere geometry.

Page 127: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

123

• VRT_API VRT_Geometry * VRT_ConstantPipe (float radius, int resolution, int numsamples, float

*controls) Create a pipe with constant radius along a central poly-line.

• VRT_API VRT_Geometry * VRT_ModulatedPipe (int resolution, int numsamples, float *controls, float *radius) Create a pipe with variable radius along a central poly-line.

• VRT_API VRT_Geometry * VRT_LoadPLG (char *file_name) Load a geometry from file.

• VRT_API VRT_Geometry * VRT_LoadOBJ (char *file_name) Load a geometry from Wafefront ASCII file.

• VRT_API void VRT_NodePreRenderCallback (VRT_Node *node, VRT_NODE_CALLBACK *cb) • VRT_API void VRT_NodePostRenderCallback (VRT_Node *node, VRT_NODE_CALLBACK *cb) • VRT_API VRT_Pipe * VRT_PipeNew ()

Creates a new rendering pipe.

• VRT_API int VRT_PipeDelete (VRT_Pipe *pipe) Delets a pipe.

• VRT_API int VRT_PipeSetProjector (VRT_Pipe *pipe, VRT_Projector *projector) Connects a projector to a rendering pipe.

• VRT_API int VRT_PipeSetViewport (VRT_Pipe *pipe, float left, float bottom, float width, float height) Sets the viewport for a rendering pipe.

• VRT_API int VRT_PipeSetSpecialFlags (VRT_Pipe *pipe, int stereo, int h_mirror, int v_mirror) Used to set stereom and mirror properties.

• VRT_API VRT_Projector * VRT_PipeGetProjector (VRT_Pipe *pipe) Get the projector connected to a pipe.

• VRT_API int VRT_PipeGetViewport (VRT_Pipe *pipe, float *left, float *bottom, float *width, float *height) Retrieves the viewport properties of a pipe.

• VRT_API int VRT_PipeGetSpecialFlags (VRT_Pipe *pipe, int *stereo, int *h_mirror, int *v_mirror) Retrieves the special flags of a pipe.

• VRT_API int VRT_PipeCount () Returns the number of pipes currently in the PipeList.

Page 128: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

124

• VRT_API VRT_Pipe * VRT_PipeGetByIndex (int index)

Retrieves a pipe from the PipeList by it's index.

• VRT_API VRT_WOW * VRT_WoWNew (VRT_Node *eye, VRT_Node *window) Creates a new WoW projector.

• VRT_API int VRT_WoWDelete (VRT_WOW *wow) Removes a WoW projector.

• VRT_API int VRT_WoWSetNodes (VRT_WOW *wow, VRT_Node *eye, VRT_Node *window) Set the eye and window nodes of a projector.

• VRT_API int VRT_WoWSetWidthAndHeight (VRT_WOW *wow, float width, float height) Sets dimensions of the WoW window.

• VRT_API int VRT_WoWSetClipDistances (VRT_WOW *wow, float nearparam, float farparam) Sets clipping distances for a WoW projector.

• VRT_API int VRT_WoWGetNodes (VRT_WOW *wow, VRT_Node **eye, VRT_Node **window) Retrieves the eye and window nodes.

• VRT_API int VRT_WoWGetWidthAndHeight (VRT_WOW *wow, float *width, float *height) Retrieves window dimensions of a Node.

• VRT_API int VRT_WoWGetClipDistances (VRT_WOW *wow, float *nearparam, float *farparam) Retrieves the clip distance.

• VRT_API void VRT_WoWSetPreloadMatrix (VRT_WOW *wow, float *preload) Sets the preload matrix.

• VRT_API VRT_Camera * VRT_CameraNew () Creates a new camera.

• VRT_API int VRT_CameraDelete (VRT_Camera *camera) Deletes a camera.

• VRT_API int VRT_CameraSetNode (VRT_Camera *camera, VRT_Node *node) Attaches a camera to a node.

• VRT_API int VRT_CameraSetFOV (VRT_Camera *camera, float fov) Sets the field of view.

• VRT_API int VRT_CameraSetClipDistances (VRT_Camera *camera, float nearparam, float farparam)

Page 129: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

125

Sets near and far clipping planes.

• VRT_API VRT_Node * VRT_CameraGetNode (VRT_Camera *camera) returns the node a camera is attached to.

• VRT_API float VRT_CameraGetFOV (VRT_Camera *camera) Returns the field of view.

• VRT_API int VRT_CameraGetClipDistances (VRT_Camera *camera, float *nearparam, float *farparam) Retrievs the clippping plane distances.

• VRT_API void VRT_ResetDefaultCamera () Resets the camera to default position.

• VRT_API void VRT_SetDefaultCamera (float ex, float ey, float ez, float cx, float cy, float cz, float ux, float uy, float uz) Set the camera properties.

• VRT_API void VRT_GetDefaultCamera (float *ex, float *ey, float *ez, float *cx, float *cy, float *cz, float *ux, float *uy, float *uz) Get the current viewing parameters of the camera.

• VRT_API int VRT_AttachCameraToNode (VRT_Node *node) Attaches the camera to any node in the scene graph.

• VRT_API void VRT_SetCameraFieldOfView (float fov) Set the current cameras field of view.

• VRT_API void VRT_CameraSetPreloadMatrix (VRT_Camera *camera, float *preload) Sets the preload matrix.

• VRT_API VRT_Animation * VRT_AnimationNew () Create a new animation.

• VRT_API void VRT_AnimationDelete (VRT_Animation *anim) Dispose an animation.

• VRT_API void VRT_AnimationAddPositionKnot (VRT_Animation *anim, float time, float x, float y, float z, float tension, float bias, float continuity) Add a position knot to an animation.

• VRT_API void VRT_AnimationAddRotationKnot (VRT_Animation *anim, float time, float angle, float x, float y, float z, float tension, float bias, float continuity) Add a rotation knot to an animation.

Page 130: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

126

• VRT_API void VRT_AnimationAddScaleKnot (VRT_Animation *anim, float time, float x, float y,

float z, float tension, float bias, float continuity) Add a scale knot to an animation.

• VRT_API void VRT_AnimationSetMode (VRT_Animation *anim, int mode) Set the time mode of an animation.

• VRT_API int VRT_AnimationGetMode (VRT_Animation *anim) Get the current time mode of an animation.

• VRT_API void VRT_AnimationSetTime (VRT_Animation *anim, float t) Set the internal time counter of an animation.

• VRT_API float VRT_AnimationGetTime (VRT_Animation *anim) Get the internal time counter of an animation.

• VRT_API void VRT_AnimationStart (VRT_Animation *anim) Start an animation.

• VRT_API void VRT_AnimationStop (VRT_Animation *anim) Stop an animation.

• VRT_API int VRT_AnimationIsStarted (VRT_Animation *anim) Get the start/stop state of an animation.

• VRT_API int VRT_NetConnect (int port) Creates/Connects to VRT distributed node server.

• VRT_API int VRT_NetDisconnect () Dissconects from a VRT server.

• VRT_API VRT_Node * VRT_SharedNodeNew (VRT_Node *parent, char *name) Creates a new shared node.

• VRT_API void Identity () • VRT_API void IdentityMat4 (M4 M) • VRT_API void Translate (mReal tx, mReal ty, mReal tz) • VRT_API void MultMatrix (M4 A, M4 B, M4 C) • VRT_API void AddMatrix (M4 A, M4 B, M4 C) • VRT_API void SubMatrix (M4 A, M4 B, M4 C) • VRT_API void Rotate (mReal x, mReal y, mReal z, mReal angle) • VRT_API void MultVecMat (V4 A, M4 B) • VRT_API void TransformPoint (double *X, double *Y, double *Z) • VRT_API void Cross (V4 A, V4 B, V4 C) • VRT_API double Dot (V4 A, V4 B)

Page 131: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

127

• VRT_API void Normalize (V4 A) • VRT_API void ScaleVector (V4 A, double F) • VRT_API void VectorAlign (V4 A, V4 B, M4 C) • VRT_API void Euler2Mat4 (float a, float e, float r, M4 M) • VRT_API void TranslateMat4 (float tx, float ty, float tz, M4 M) • VRT_API void RotateMat4 (M4 MR, mReal x, mReal y, mReal z, mReal angle) • VRT_API void InverseMat4 (M4 M) • VRT_API void TransposeMat4 (M4 M) • VRT_API void VRT_GetSystemTime (int *h, int *m, int *s)

Get the systems current time from midnight.

• VRT_API void VRT_Init (int *argcp, char **argv, char *vrt_h_version, char *vrt_vnc_h_version) Initialize VRT.

• VRT_API VRT_Context * VRT_GetContext () Used to get the current VRT context.

• VRT_API void VRT_SetCallback (VRT_HookPtr hook) Register the VRT callback function.

• VRT_API int VRT_SetDisplay (int mode) Set the VRT display mode and create main window.

• VRT_API int VRT_SaveFrameToBitmap (char *filename) Copy a frame and save it to a bitmap file.

• VRT_API VRT_Htx VRT_CopyFrameToTexture () Render a frame to a texture.

• VRT_API int VRT_SaveTextureToBitmap (VRT_Htx *texture, char *filename) Save a texture into a file.

• VRT_API void VRT_PlaySound (char *filename) Plays a sound.

• VRT_API void VRT_LoadDepthMap (char *fname, VRT_DepthMap *dm) • VRT_API void VRT_SmoothDepthMap (VRT_DepthMap *dm) • VRT_API VRT_Geometry * VRT_CreateGeometryFromDepthMap (VRT_DepthMap *dm) • VRT_API int VRT_GeometryDecimate (VRT_Geometry *geom, float fuzz_factor) • VRT_API void VRT_GeometryCalcFaceNormals (VRT_Geometry *geom) • VRT_API void VRT_CalcPickingRay (int x, int y, float *rayPos, float *rayDir) • VRT_API int VRT_PickTexelCoordinate (int x, int y, VRT_Node *node, VRT_HPlg poly, float *u,

float *v) • VRT_API VRT_Node * VRT_CreateWorldReferenceFrame () • VRT_API int VRT_GeometryScale (VRT_Geometry *geom, float scx, float scy, float scz) • VRT_API void VRT_SetTextureAlpha (VRT_Htx *texture, unsigned char alpha) • VRT_API void VRT_NodeGetZDirection (VRT_Node *node, float *v)

Page 132: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

128

• VRT_API void VRT_NodeGetYDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeGetXDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeSetZDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeSetYDirection (VRT_Node *node, float *v) • VRT_API void VRT_NodeSetXDirection (VRT_Node *node, float *v) • VRT_API void VRT_FullScreen ()

requests that the current window be made full screen.

• VRT_API void VRT_ReshapeWindow (int width, int height) requests a change to the size of the current window.

• VRT_API void VRT_PositionWindow (int x, int y) requests a change to the position of the current window.

• VRT_API int VRT_GetModifiers () returns the modifier key state when certain callback messages were generated.

• int VRT_ExtensionSupported (const char *extension) • void VRT_ShadowSetLight (double position[3], double look_at[3], double up[3]) • void VRT_ShadowSetDimension (int width, int height) • void VRT_ShadowSetPolygonOffset (float polygon_scale, float polygon_bias) • void VRT_ShadowSetTextureOffset (float coordinate_scale, float coordinate_bias) • int VRT_ShadowSwitchOn () • void VRT_ShadowSwitchOff () • VRT_API void VRT_PipePreRender () • VRT_API void VRT_PipePostRender ()

Function Documentation

VRT_API void AddMatrix (M4 A, M4 B, M4 C)

VRT_API void Cross (V4 A, V4 B, V4 C)

VRT_API double Dot (V4 A, V4 B)

VRT_API void Euler2Mat4 (float a, float e, float r, M4 M)

VRT_API void Identity ()

Page 133: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

129

VRT_API void IdentityMat4 (M4 M)

VRT_API void InverseMat4 (M4 M)

VRT_API void MultMatrix (M4 A, M4 B, M4 C)

VRT_API void MultVecMat (V4 A, M4 B)

VRT_API void Normalize (V4 A)

VRT_API void Rotate (mReal x, mReal y, mReal z, mReal angle)

VRT_API void RotateMat4 (M4 MR, mReal x, mReal y, mReal z, mReal angle)

VRT_API void ScaleVector (V4 A, double F)

VRT_API void SubMatrix (M4 A, M4 B, M4 C)

VRT_API void TransformPoint (double * X, double * Y, double * Z)

VRT_API void Translate (mReal tx, mReal ty, mReal tz)

VRT_API void TranslateMat4 (float tx, float ty, float tz, M4 M)

VRT_API void TransposeMat4 (M4 M)

VRT_API void VectorAlign (V4 A, V4 B, M4 C)

VRT_API void VRT_CalcPickingRay (int x, int y, float * rayPos, float * rayDir)

Page 134: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

130

VRT_API VRT_Geometry* VRT_CreateGeometryFromDepthMap (VRT_DepthMap * dm)

VRT_API VRT_Node* VRT_CreateWorldReferenceFrame ()

VRT_API int VRT_DeleteNodePath (VRT_NodePath * np) Delete a nodepath. This function disposes a nodepath. Parameters:

np a pointer to a nodepath Returns:

Zero on failure. See also:

NodeGetNodePath

VRT_API void VRT_GeometryCalcFaceNormals (VRT_Geometry * geom)

VRT_API int VRT_GeometryDecimate (VRT_Geometry * geom, float fuzz_factor)

VRT_API int VRT_GeometryScale (VRT_Geometry * geom, float scx, float scy, float scz)

VRT_API void VRT_LoadDepthMap (char * fname, VRT_DepthMap * dm)

VRT_API VRT_Patch VRT_PatchInterpolate (VRT_Patch p, int w, int h) Increase the resolution of a patch. This function changes the resolution of a patch by interpolating in x, y and z dimensions to get <w*h> vertices in the patch. The resolution cannot be decreased, so w and h must equal to or larger than the original values. Parameters:

p patch w new width of patch h new height of patch

Returns: The interpolated patch of p.

VRT_API int VRT_PickTexelCoordinate (int x, int y, VRT_Node * node, VRT_HPlg poly, float * u, float * v)

Page 135: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

131

VRT_API void VRT_PipePostRender ()

VRT_API void VRT_PipePreRender ()

VRT_API void VRT_SetTextureAlpha (VRT_Htx * texture, unsigned char alpha)

VRT_API void VRT_SmoothDepthMap (VRT_DepthMap * dm)

VRT_API void VRT_SplineCurve (VRT_Vertex * spline, int knots, int samples) Calculates an interpolated Beziér-Spline. This function interpolates a number of given control points using a Beziér-Spline interpolation method. At least 5 control points are required to calculate a spline curve. The resolution of the resulting spline is given by the number of samples. The function requires that the application supplies sufficient memory referenced by spline. If e.g. a spline curve of 100 samples is supposed to be calculated, the application must allocate at least 100*sizeof(VRT_Vertex) bytes of memory. The first knots entires of the vertex array are interpreted as thecontrol points by the function. They will be overwritten after the function returns. Calculating splines is in particular interesting if smooth movements/animations of objects or other features are desired. Note that the data supplied must not necessarily represent geometric vertex data but can represent other information such as greyvalues etc. Parameters:

spline array of control points knots number of control points supplied samples desired number of resulting spline

VRT_API void VRT_TransformVertex3D (float * v, float * ctm) Transform a single vertex. This function transforms a single vertex using a transformation matrix. The vertex data is a 3-element array with x, y and z coordinates. The transformation matrix is a 16 element array of matrix coefficients. Parameters:

v array of vertex data ctm 4 by 4 transformation matrix

vrt_globals.h File Reference

Page 136: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

132

Defines • #define VRT_H_VER "2.0a" • #define VRT_VNC_H_VER "0.5" • #define VRT_LIB_VER "2.0a" • #define M_PI (3.1415926535897932384626433832795) • #define VRT_NET_MAXCLIENTS 64

Maximum allowed network clients.

• #define VRT_ANIMLIST_MAXANIMS 1024 The maximum number of open animations.

• #define VRT_POLY_MAXVERTICES 4 • #define VRT_GEOMETRY_DEFVTXNO 4096

The maximal number of vertices per geometry.

• #define VRT_GEOMETRY_DEFPLYNO 512 The maximal number of polygons per geometry.

• #define VRT_NODE_MAXCHILDREN 256 The maximal number of children any single node can have.

• #define VRT_NODELIST_MAXNODES 1024 The maximal number of nodes in a VRT context.

• #define VRT_GEOMLIST_MAXGEOMS 1024 The maximal number of geometries in a VRT context.

• #define VRT_LIGHTLIST_MAXLIGHTS 32 The maximal number of lights in a VRT context.

• #define VRT_NODEPATH_MAXDEPTH 64 The maximal depth of a nodepath.

• #define VRT_PROJECTORLIST_MAXPROJECTORS 128 The maximal number of projectors in a VRT context.

• #define VRT_TEXTURELIST_MAXTEXTURES 128 The maximal number of projectors in a VRT context.

• #define VRT_PIPELIST_MAXPIPES 8 The maximum number of pipes in a VRT context.

• #define VRT_ERR_UNKNOWN -1 Unrecognized error code.

Page 137: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

133

• #define VRT_ERR_NOINIT 99

VRT is not initialized when a function is called.

• #define VRT_ERR_NODELISTOVERFLOW 100 Maximum number of nodes reached.

• #define VRT_ERR_PARENTISNULL 101 Invalid node parent specified.

• #define VRT_ERR_DELETENULLNODE 102 Trying to delete a deleted or non-initialized node.

• #define VRT_ERR_DELETEINVALIDNODE 103 Trying to delete an invalid node.

• #define VRT_ERR_DELETEROOTNODE 104 Trying to delete the root node.

• #define VRT_ERR_TRANSLATENULLNODE 105 Trying to translate a deleted or non-initialized node.

• #define VRT_ERR_TRANSLATEROOTNODE 106 Trying to translate the root node.

• #define VRT_ERR_TRANSLATEINVALIDNODE 107 Trying to translate an invalid node.

• #define VRT_ERR_ROTATENULLNODE 108 Trying to rotate a deleted or non-initialized node.

• #define VRT_ERR_ROTATEROOTNODE 109 Trying to rotate the root node.

• #define VRT_ERR_ROTATEINVALIDNODE 110 Trying to rotate an invalid node.

• #define VRT_ERR_INVALIDNODE 111 Trying to use an invalid node.

• #define VRT_ERR_GEOMETRYLISTOVERFLOW 112 Reached maximum number of geometries.

• #define VRT_ERR_GEOMETRYINVALID 113

Page 138: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

134

Trying to use an invalid geometry.

• #define VRT_ERR_GEOMETRYISNULL 114 Trying to use a deleted or non-initialized geometry.

• #define VRT_ERR_REALLOCVERTEXLISTFAILED 115 Vertex couldn’t be added to geometry because of low memory.

• #define VRT_ERR_INVALIDVERTEXINDEX 116 Trying to use an invalid vertex index.

• #define VRT_ERR_REALLOCPOLYGONLISTFAILED 117 Polygon couldn’t be added to geometry because of low memory.

• #define VRT_ERR_POLYGONISNULL 118 Trying to use a deleted or non-initialized polygon.

• #define VRT_ERR_INVALIDPOLYGONHANDLE 119 Trying to use an invalid polygon handle.

• #define VRT_ERR_NODEPATHOVERFLOW 120 Maximum depth of scene-graph reached.

• #define VRT_ERR_NODEPATHISNULL 121 Trying to use an empty nodepath.

• #define VRT_ERR_TEXTUREFILEOPEN 122 Trying to read a non existing or unaccessible texture bitmap file.

• #define VRT_ERR_TEXTUREFILEWRONGCOLORFORMAT 123 Trying to use a texture bitmap file that has a non-supported color format.

• #define VRT_ERR_TEXTUREINVALID 124 Trying to use a invalid texture.

• #define VRT_ERR_SUBTEXTURE_OUT_OF_BOUND 132 Tried to perform an operation outside of subtexture bounds.

• #define VRT_ERR_GEOMETRYISLOCKED 125 Trying to change a locked geometry.

• #define VRT_ERR_CHILDLISTOVERFLOW 126 Maximum number of node children reached.

Page 139: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

135

• #define VRT_ERR_CHILDISNULL 127 A NULL-node was attempted to be attached to a parent node.

• #define VRT_ERR_TEXTUREINVALIDMODE 128 An invalid texture modulation mode was specified.

• #define VRT_ERR_FOPEN_SAVE 129 File I/O error occurred in saving operation.

• #define VRT_ERR_INTERSECTNULLNODE 130 NULL node passed to intersection function.

• #define VRT_ERR_INTERSECTROOTNODE 131 Root node illegaly passed to intersection function.

• #define VRT_ERR_LIGHTLISTOVERFLOW 150 Too many lights are being created.

• #define VRT_ERR_LIGHTISNULL 151 NULL pointer passed as light handle to light function.

• #define VRT_ERR_LIGHTINVALID 152 Pointer passed to light function refers not a valid light object.

• #define VRT_ERR_TOOMANYLIGHTS 153 There are more than MAX_GL_LIGHTS lights activated at the same time.

• #define VRT_ERR_LIGHTINVALIDTYPE 154 Unknown light type passed to light function.

• #define VRT_ERR_PROJECTORLISTOVERFLOW 170 Could not add projector, the maximum number of projectors/cameras (VRT_PROJECTORLIST_MAXPROJECTORS) has been reached.

• #define VRT_ERR_CAMERAISNULL 171 Tried to perform a camera opoeration on a NULL camera reference.

• #define VRT_ERR_CAMERAINVALID 172 Tried to perform an operation on a camera not in the list of projectors.

• #define VRT_ERR_CAMERAINVALIDFOV 173 Tried to set camera field of view to a negative value or a value bigger than 180 degres.

• #define VRT_ERR_CAMERAINVALIDCLIP 174

Page 140: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

136

Tried to set invalid parameters of camera clippingplanes.

• #define VRT_ERR_CAMERANODEISNULL 175 Tried to attach a NULL valued camera to a node.

• #define VRT_ERR_WOWISNULL 180 Tried to perform an operation on a non existent (unallocated, pointer is NULL) WoW projector.

• #define VRT_ERR_WOWINVALID 181 Tried to perform an operation on an invalid WoW projector.

• #define VRT_ERR_WOWINVALIDCLIP 182 The WoW clippingplane distances are wrong.

• #define VRT_ERR_WOWNODEISNULL 183 Either the eye or the window node parameters to a WoW function is null-valued.

• #define VRT_ERR_PIPELISTOVERFLOW 190 Could not add pipe, the maximum number of pipes (VRT_PIPELIST_MAXPIPES) has been reached.

• #define VRT_ERR_PIPEISNULL 191 Tried to perform a pipe opoeration on a NULL pipe reference.

• #define VRT_ERR_PIPEINVALID 192 Tried to perform an operation on a pipe not in the list of pipes.

• #define VRT_ERR_PROJECTORISNULL 193 Tried to connect a NULL projector to a pipe.

• #define VRT_ERR_PIPEINVALIDPARAMS 194 Tried to set invalid viewport parameters to a pipe.

• #define VRT_ERR_PIPEINVALIDINDEX 195 Tried to retrive an nonexistent pipe from the pipelist.

• #define VRT_ERR_NODEISNOTSHAREDNODE 500 Tried to use a regulare node as a networked shared node.

• #define VRT_ERR_SHAREDMEMORYNOINIT 501 Tried to use networked, shared nodes withoud initializing the shared memory.

• #define VRT_ERR_ANIMATIONLISTOVERFLOW 600 There are more then VRT_ANIMLIST_MAXANIMS animations created.

Page 141: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

137

• #define VRT_ERR_ANIMATIONINVALID 601 Tried to process an invalid animation.

• #define VRT_ERR_ANIMATIONISNULL 602 The animation object processed is null.

• #define VRT_ERR_REALLOCANIMKNOTLISTFAILED 603 Could not resize the animknot list.

• #define VRT_VNC_ERR_VNCWINDOW_IS_NULL 701 • #define VRT_VNC_ERR_SERVER_HUNG_UP 702 • #define VRT_VNC_ERR_NO_SUCH_SERVER 703 • #define VRT_VNC_ERR_WRONG_PASSWORD 704 • #define VRT_VNC_ERR_NO_STATE_POINTER 705 • #define VRT_VNC_ERR_UNKNOWN 706 • #define VRT_ERR_TEXTURELISTOVERFLOW 800

Could not load texture, the maximum number of texture (VRT_TEXTURELIST_MAXTEXTURES) has been reached.

• #define VRT_MONO 1 Standard monoscopic rendering.

• #define VRT_STEREO_VSPLIT 4 Double-buffered rendering using stereo with vertically split display and sync-doubler unit.

• #define VRT_STEREO_HSPLIT 8 Stereo, horizontally split display using mirror arrangement.

• #define VRT_VIP 16 Virtual Plane using quad-buffered stereo rendering system.

• #define VRT_VMIRROR 32 Vertically mirrored picture on screen.

• #define VRT_HMIRROR 64 Horizontally mirrored picture on screen.

• #define VRT_WORKBENCH 48 Using quad-buffered stereo rendering with vertically mirrored output for use with VirtualWorkbench/ReachIn.

• #define VRT_DEFAULT 1 Default mode.

• #define VRT_VIPPLUS 128

Page 142: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

138

• #define VRT_VIPPLUS_VS_1 1024 • #define VRT_VIPPLUS_VS_2 2048 • #define VRT_VIPPLUS_HS_1 4096 • #define VRT_VIPPLUS_HS_2 8192 • #define VRT_VIP_SPLIT 16384

Virtual Plane using double-buffered stereo with sync-doubler unit (requires split screen stereo rendering).

• #define VRT_PIPED_DISPLAY 32768 • #define VRT_SM_UNDEFINED 0

Shading model are undefined.

• #define VRT_SM_WIRE 1 Points are connected with lines.

• #define VRT_SM_FLAT 2 Polygon faces are shaded in one color.

• #define VRT_SM_SHADE 4 Polygon faces are shaded smoothly if normal vectors are supplied for vertices.

• #define VRT_SM_TEXTURE 8 Textures are applied.

• #define VRT_OPT_GEOMETRY_NONE 0 Generic geometry, not optimized.

• #define VRT_OPT_GEOMETRY_QUADSTRIP 1 Geometry optimized for quadstrips.

• #define VRT_OPT_GEOMETRY_TRIANGLESTRIP 2 Geometry optimized for trianglestrips.

• #define VRT_OPT_GEOMETRY_TRIANGLEFAN 3 Geometry optimized for trianglestrips.

• #define VRT_LIGHT_DIRECTIONAL 1 Defines a lightsource as directional.

• #define VRT_LIGHT_POSITIONAL 2 Defines a lightsource ans positional.

• #define VRT_LIGHT_SPOT 3 Defines a lighsource as a spotlight.

Page 143: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

139

• #define VRT_PROJECTOR_CAMERA 1 Defines a projector type to camera.

• #define VRT_PROJECTOR_WOW 2 Defines a projector type to WoW.

• #define VRT_PROJECTOR_WOW_RAW 3 • #define VRT_X 0

Constant used to access the x component in certain VRT arrays.

• #define VRT_Y 1 Constant used to access the y component in certain VRT arrays.

• #define VRT_Z 2 Constant used to access the z component in certain VRT arrays.

• #define VRT_LOCAL_LIGHT_MODEL 0 Lighting calculations are based upon the direction of light in relation to the orientation of the object surface and the observer’s position.

• #define VRT_GLOBAL_LIGHT_MODEL 1 Lighting calculations are based upon the direction of light in relation to the orientation of the object surface.

• #define VRT_TEXTURE_MODULATION_DECAL GL_DECAL Texture fragments are combined by decal.

• #define VRT_TEXTURE_MODULATION_MODULATE GL_MODULATE Texture fragments are combined by modulation.

• #define VRT_TEXTURE_MODULATION_BLEND GL_BLEND Texture fragments are combined by alpha blending.

• #define VRT_ANIMATION_ONCE 1 Run animation once.

• #define VRT_ANIMATION_REPEAT 2 Repeat animation.

• #define VRT_ANIMATION_PINGPONG 3 Run animation back and forth.

• #define VRT_ANIM_DEFKNOTNO 256 The maximum number of animation knots.

Page 144: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

140

• #define MAX_GL_LIGHTS 8

Maximum number of OpenGL supported lights.

• #define MAXTIMESTAMPS 20 A somewhat blabla.

• #define USE_DEPTH_BUFFER If this variable is defined VRT will compile to use depth buffer.

• #define DISP_WND_TEXT ("VRT Simulation Window, Version " VRT_H_VER) VRT Startup text.

• #define VRT_MSG_BUTTON_BOX 101 Dial & button box button callback message for the current window.

• #define VRT_MSG_DIALS 102 The dial & button box dials callback message for a window is sent when the window has dial & button box input focus (normally, when the mouse is in the window) and the user generates dial & button box dial changes.

• #define VRT_MSG_DISPLAY 103 When VRT determines that the normal plane for the window needs to be redisplayed, the display callback for the window is called.

• #define VRT_MSG_IDLE 105 The idle message is sent when other window system events are not being received.

• #define VRT_MSG_JOYSTICK 106 Joystick callback message, not used.

• #define VRT_MSG_KEYBOARD_DOWN 107 When a user types into the window, each key press generating an ASCII character will generate a keyboard down callback message.

• #define VRT_MSG_KEYBOARD_UP 108 When a user types into the window, each key release matching an ASCII character will generate a keyboard up callback message.

• #define VRT_MSG_MENU_STATE 109 DEPRECATED.

• #define VRT_MSG_MENU_STATUS 110

Page 145: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

141

The menu status callback message will be sent with the value VRT_MENU_IN_USE for its arg1 parameter when pop-up menus are in use by the user; and the callback will be called with the value VRT_MENU_NOT_IN_USE for its arg1 parameter when pop-up menus are no longer in use. arg2 indicate the x location in window coordinates of the button press that caused the menu to go into use, or the location where the menu was released (may be outside the window). arg3 indicate the y location in window coordinates of the button press that caused the menu to go into use, or the location where the menu was released (may be outside the window).

• #define VRT_MSG_MOUSE_BUTTON 111 When a user presses and releases mouse buttons in the window, each press and each release generates a mouse callback message.

• #define VRT_MSG_MOUSE_ENTRY 104 The mouse entry callback message is sent whenever the mouse pointer leaves or enters the window.

• #define VRT_MSG_MOUSE_MOTION 112 The motion callback message for a window is sent when the mouse moves within the window while one or more mouse buttons are pressed.

• #define VRT_MSG_MOUSE_PASSIVE_MOTION 113 The passive motion callback message for a window is sent when the mouse moves within the window while no mouse buttons are pressed.

• #define VRT_MSG_OVERLAY_DISPLAY 114 Overlay display callback message, not used.

• #define VRT_MSG_RESHAPE 115 The reshape callback message is sent when a window is reshaped.

• #define VRT_MSG_SPACEBALL_BUTTON 116 The Spaceball button callback message for a window is sent when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball button presses.

• #define VRT_MSG_SPACEBALL_MOTION 117 The Spaceball motion callback message for a window is sent when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball translations.

• #define VRT_MSG_SPACEBALL_ROTATE 118 The Spaceball rotate callback message for a window is sent when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball rotations.

• #define VRT_MSG_SPECIAL_DOWN 119 The special keyboard callback message is sent when keyboard function or directional keys are pressed.

• #define VRT_MSG_SPECIAL_UP 120

Page 146: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

142

The special keyboard up callback message is sent when keyboard function or directional keys are released.

• #define VRT_MSG_TABLET_BUTTON 121 The tablet button callback message for a window is sent when the window has tablet input focus (normally, when the mouse is in the window) and the user generates tablet button presses.

• #define VRT_MSG_TABLET_MOTION 122 The tablet motion callback message for a window is sent when the window has tablet input focus (normally, when the mouse is in the window) and the user generates tablet motion.

• #define VRT_MSG_TIMER 123 Timer callback message, not used.

• #define VRT_MSG_VISIBILITY 124 The visibility callback message for a window is sent when the visibility of a window changes.

• #define VRT_MSG_WINDOW_STATUS 125 The window status callback message for a window is sent when the window status (visibility) of a window changes.

• #define VRT_ACTIVE_SHIFT 1 • #define VRT_ACTIVE_CTRL 2 • #define VRT_ACTIVE_ALT 4 • #define VRT_RGB 0 • #define VRT_RGBA VRT_RGB • #define VRT_INDEX 1 • #define VRT_SINGLE 0 • #define VRT_DOUBLE 2 • #define VRT_ACCUM 4 • #define VRT_ALPHA 8 • #define VRT_DEPTH 16 • #define VRT_STENCIL 32 • #define VRT_MULTISAMPLE 128 • #define VRT_STEREO 256 • #define VRT_LUMINANCE 512 • #define VRT_LEFT_BUTTON 0 • #define VRT_MIDDLE_BUTTON 1 • #define VRT_RIGHT_BUTTON 2 • #define VRT_DOWN 0 • #define VRT_UP 1 • #define VRT_KEY_F1 1 • #define VRT_KEY_F2 2 • #define VRT_KEY_F3 3 • #define VRT_KEY_F4 4 • #define VRT_KEY_F5 5 • #define VRT_KEY_F6 6 • #define VRT_KEY_F7 7 • #define VRT_KEY_F8 8

Page 147: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

143

• #define VRT_KEY_F9 9 • #define VRT_KEY_F10 10 • #define VRT_KEY_F11 11 • #define VRT_KEY_F12 12 • #define VRT_KEY_LEFT 100 • #define VRT_KEY_UP 101 • #define VRT_KEY_RIGHT 102 • #define VRT_KEY_DOWN 103 • #define VRT_KEY_PAGE_UP 104 • #define VRT_KEY_PAGE_DOWN 105 • #define VRT_KEY_HOME 106 • #define VRT_KEY_END 107 • #define VRT_KEY_INSERT 108 • #define VRT_LEFT 0 • #define VRT_ENTERED 1 • #define VRT_MENU_NOT_IN_USE 0 • #define VRT_MENU_IN_USE 1 • #define VRT_NOT_VISIBLE 0 • #define VRT_VISIBLE 1 • #define VRT_HIDDEN 0 • #define VRT_FULLY_RETAINED 1 • #define VRT_PARTIALLY_RETAINED 2 • #define VRT_FULLY_COVERED 3

Variables • const char * vrt_h_ver • const char * vrt_lib_ver

Define Documentation

#define DISP_WND_TEXT ("VRT Simulation Window, Version " VRT_H_VER) VRT Startup text.

#define M_PI (3.1415926535897932384626433832795)

#define MAX_GL_LIGHTS 8 Maximum number of OpenGL supported lights.

#define MAXTIMESTAMPS 20 A somewhat blabla.

Page 148: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

144

#define USE_DEPTH_BUFFER If this variable is defined VRT will compile to use depth buffer.

#define VRT_ACCUM 4

#define VRT_ACTIVE_ALT 4

#define VRT_ACTIVE_CTRL 2

#define VRT_ACTIVE_SHIFT 1

#define VRT_ALPHA 8

#define VRT_ANIM_DEFKNOTNO 256 The maximum number of animation knots. See also:

VRT_Animation

#define VRT_ANIMATION_ONCE 1 Run animation once.

#define VRT_ANIMATION_PINGPONG 3 Run animation back and forth.

#define VRT_ANIMATION_REPEAT 2 Repeat animation.

#define VRT_ANIMLIST_MAXANIMS 1024 The maximum number of open animations.

#define VRT_DEFAULT 1 Default mode.

Page 149: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

145

#define VRT_DEPTH 16

#define VRT_DOUBLE 2

#define VRT_DOWN 0

#define VRT_ENTERED 1

#define VRT_ERR_ANIMATIONINVALID 601 Tried to process an invalid animation.

#define VRT_ERR_ANIMATIONISNULL 602 The animation object processed is null.

#define VRT_ERR_ANIMATIONLISTOVERFLOW 600 There are more then VRT_ANIMLIST_MAXANIMS animations created.

#define VRT_ERR_CAMERAINVALID 172 Tried to perform an operation on a camera not in the list of projectors.

#define VRT_ERR_CAMERAINVALIDCLIP 174 Tried to set invalid parameters of camera clippingplanes.

#define VRT_ERR_CAMERAINVALIDFOV 173 Tried to set camera field of view to a negative value or a value bigger than 180 degres.

#define VRT_ERR_CAMERAISNULL 171 Tried to perform a camera opoeration on a NULL camera reference.

#define VRT_ERR_CAMERANODEISNULL 175 Tried to attach a NULL valued camera to a node.

Page 150: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

146

#define VRT_ERR_CHILDISNULL 127 A NULL-node was attempted to be attached to a parent node.

#define VRT_ERR_CHILDLISTOVERFLOW 126 Maximum number of node children reached.

#define VRT_ERR_DELETEINVALIDNODE 103 Trying to delete an invalid node.

#define VRT_ERR_DELETENULLNODE 102 Trying to delete a deleted or non-initialized node.

#define VRT_ERR_DELETEROOTNODE 104 Trying to delete the root node.

#define VRT_ERR_FOPEN_SAVE 129 File I/O error occurred in saving operation.

#define VRT_ERR_GEOMETRYINVALID 113 Trying to use an invalid geometry.

#define VRT_ERR_GEOMETRYISLOCKED 125 Trying to change a locked geometry.

#define VRT_ERR_GEOMETRYISNULL 114 Trying to use a deleted or non-initialized geometry.

#define VRT_ERR_GEOMETRYLISTOVERFLOW 112 Reached maximum number of geometries.

#define VRT_ERR_INTERSECTNULLNODE 130 NULL node passed to intersection function.

Page 151: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

147

#define VRT_ERR_INTERSECTROOTNODE 131 Root node illegaly passed to intersection function.

#define VRT_ERR_INVALIDNODE 111 Trying to use an invalid node.

#define VRT_ERR_INVALIDPOLYGONHANDLE 119 Trying to use an invalid polygon handle.

#define VRT_ERR_INVALIDVERTEXINDEX 116 Trying to use an invalid vertex index.

#define VRT_ERR_LIGHTINVALID 152 Pointer passed to light function refers not a valid light object.

#define VRT_ERR_LIGHTINVALIDTYPE 154 Unknown light type passed to light function.

#define VRT_ERR_LIGHTISNULL 151 NULL pointer passed as light handle to light function.

#define VRT_ERR_LIGHTLISTOVERFLOW 150 Too many lights are being created. Limit of VRT_LIGHTLIST_MAXLIGHTS = 32 reached

#define VRT_ERR_NODEISNOTSHAREDNODE 500 Tried to use a regulare node as a networked shared node.

#define VRT_ERR_NODELISTOVERFLOW 100 Maximum number of nodes reached.

Page 152: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

148

#define VRT_ERR_NODEPATHISNULL 121 Trying to use an empty nodepath.

#define VRT_ERR_NODEPATHOVERFLOW 120 Maximum depth of scene-graph reached.

#define VRT_ERR_NOINIT 99 VRT is not initialized when a function is called.

#define VRT_ERR_PARENTISNULL 101 Invalid node parent specified.

#define VRT_ERR_PIPEINVALID 192 Tried to perform an operation on a pipe not in the list of pipes.

#define VRT_ERR_PIPEINVALIDINDEX 195 Tried to retrive an nonexistent pipe from the pipelist.

#define VRT_ERR_PIPEINVALIDPARAMS 194 Tried to set invalid viewport parameters to a pipe.

#define VRT_ERR_PIPEISNULL 191 Tried to perform a pipe opoeration on a NULL pipe reference.

#define VRT_ERR_PIPELISTOVERFLOW 190 Could not add pipe, the maximum number of pipes (VRT_PIPELIST_MAXPIPES) has been reached.

#define VRT_ERR_POLYGONISNULL 118 Trying to use a deleted or non-initialized polygon.

#define VRT_ERR_PROJECTORISNULL 193 Tried to connect a NULL projector to a pipe.

Page 153: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

149

#define VRT_ERR_PROJECTORLISTOVERFLOW 170 Could not add projector, the maximum number of projectors/cameras (VRT_PROJECTORLIST_MAXPROJECTORS) has been reached.

#define VRT_ERR_REALLOCANIMKNOTLISTFAILED 603 Could not resize the animknot list. Memory allocation error.

#define VRT_ERR_REALLOCPOLYGONLISTFAILED 117 Polygon couldn’t be added to geometry because of low memory.

#define VRT_ERR_REALLOCVERTEXLISTFAILED 115 Vertex couldn’t be added to geometry because of low memory.

#define VRT_ERR_ROTATEINVALIDNODE 110 Trying to rotate an invalid node.

#define VRT_ERR_ROTATENULLNODE 108 Trying to rotate a deleted or non-initialized node.

#define VRT_ERR_ROTATEROOTNODE 109 Trying to rotate the root node.

#define VRT_ERR_SHAREDMEMORYNOINIT 501 Tried to use networked, shared nodes withoud initializing the shared memory.

#define VRT_ERR_SUBTEXTURE_OUT_OF_BOUND 132 Tried to perform an operation outside of subtexture bounds.

#define VRT_ERR_TEXTUREFILEOPEN 122 Trying to read a non existing or unaccessible texture bitmap file.

#define VRT_ERR_TEXTUREFILEWRONGCOLORFORMAT 123 Trying to use a texture bitmap file that has a non-supported color format.

Page 154: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

150

#define VRT_ERR_TEXTUREINVALID 124 Trying to use a invalid texture.

#define VRT_ERR_TEXTUREINVALIDMODE 128 An invalid texture modulation mode was specified. Error created by function VRT_SetTextureModulationMode.

#define VRT_ERR_TEXTURELISTOVERFLOW 800 Could not load texture, the maximum number of texture (VRT_TEXTURELIST_MAXTEXTURES) has been reached.

#define VRT_ERR_TOOMANYLIGHTS 153 There are more than MAX_GL_LIGHTS lights activated at the same time.

#define VRT_ERR_TRANSLATEINVALIDNODE 107 Trying to translate an invalid node.

#define VRT_ERR_TRANSLATENULLNODE 105 Trying to translate a deleted or non-initialized node.

#define VRT_ERR_TRANSLATEROOTNODE 106 Trying to translate the root node.

#define VRT_ERR_UNKNOWN -1 Unrecognized error code.

#define VRT_ERR_WOWINVALID 181 Tried to perform an operation on an invalid WoW projector.

#define VRT_ERR_WOWINVALIDCLIP 182 The WoW clippingplane distances are wrong. E.g. near param greater than far param.

Page 155: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

151

#define VRT_ERR_WOWISNULL 180 Tried to perform an operation on a non existent (unallocated, pointer is NULL) WoW projector.

#define VRT_ERR_WOWNODEISNULL 183 Either the eye or the window node parameters to a WoW function is null-valued.

#define VRT_FULLY_COVERED 3

#define VRT_FULLY_RETAINED 1

#define VRT_GEOMETRY_DEFPLYNO 512 The maximal number of polygons per geometry.

#define VRT_GEOMETRY_DEFVTXNO 4096 The maximal number of vertices per geometry.

#define VRT_GEOMLIST_MAXGEOMS 1024 The maximal number of geometries in a VRT context.

#define VRT_GLOBAL_LIGHT_MODEL 1 Lighting calculations are based upon the direction of light in relation to the orientation of the object surface. Calculations are based upon the global co-ordinate system.

#define VRT_H_VER "2.0a"

#define VRT_HIDDEN 0

#define VRT_HMIRROR 64 Horizontally mirrored picture on screen.

#define VRT_INDEX 1

Page 156: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

152

#define VRT_KEY_DOWN 103

#define VRT_KEY_END 107

#define VRT_KEY_F1 1

#define VRT_KEY_F10 10

#define VRT_KEY_F11 11

#define VRT_KEY_F12 12

#define VRT_KEY_F2 2

#define VRT_KEY_F3 3

#define VRT_KEY_F4 4

#define VRT_KEY_F5 5

#define VRT_KEY_F6 6

#define VRT_KEY_F7 7

#define VRT_KEY_F8 8

#define VRT_KEY_F9 9

#define VRT_KEY_HOME 106

Page 157: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

153

#define VRT_KEY_INSERT 108

#define VRT_KEY_LEFT 100

#define VRT_KEY_PAGE_DOWN 105

#define VRT_KEY_PAGE_UP 104

#define VRT_KEY_RIGHT 102

#define VRT_KEY_UP 101

#define VRT_LEFT 0

#define VRT_LEFT_BUTTON 0

#define VRT_LIB_VER "2.0a"

#define VRT_LIGHT_DIRECTIONAL 1 Defines a lightsource as directional.

#define VRT_LIGHT_POSITIONAL 2 Defines a lightsource ans positional.

#define VRT_LIGHT_SPOT 3 Defines a lighsource as a spotlight.

#define VRT_LIGHTLIST_MAXLIGHTS 32 The maximal number of lights in a VRT context.

Page 158: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

154

#define VRT_LOCAL_LIGHT_MODEL 0 Lighting calculations are based upon the direction of light in relation to the orientation of the object surface and the observer’s position. Calculations are based upon the varying viewing co-ordinate system of the local observer.

#define VRT_LUMINANCE 512

#define VRT_MENU_IN_USE 1

#define VRT_MENU_NOT_IN_USE 0

#define VRT_MIDDLE_BUTTON 1

#define VRT_MONO 1 Standard monoscopic rendering.

#define VRT_MSG_BUTTON_BOX 101 Dial & button box button callback message for the current window. The dial & button box button callback message for a window is sent when the window has dial & button box input focus (normally, when the mouse is in the window) and the user generates dial & button box button presses. arg1 will be the button number (starting at one). arg2 is the state which is either VRT_UP or VRT_DOWN indicating whether the callback message was due to a release or press respectively.

#define VRT_MSG_DIALS 102 The dial & button box dials callback message for a window is sent when the window has dial & button box input focus (normally, when the mouse is in the window) and the user generates dial & button box dial changes. arg1 will be the dial number (starting at one). arg2 measures the absolute rotation in degrees. Dial values do not "roll over" with each complete rotation but continue to accumulate degrees (until the int dial value overflows).

#define VRT_MSG_DISPLAY 103 When VRT determines that the normal plane for the window needs to be redisplayed, the display callback for the window is called.

Page 159: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

155

#define VRT_MSG_IDLE 105 The idle message is sent when other window system events are not being received. VRT program can perform background processing tasks or continuous animation at this point.

#define VRT_MSG_JOYSTICK 106 Joystick callback message, not used.

#define VRT_MSG_KEYBOARD_DOWN 107 When a user types into the window, each key press generating an ASCII character will generate a keyboard down callback message. arg1 is the generated ASCII character. The state of modifier keys such as Shift cannot be determined directly; their only effect will be on the returned ASCII data. arg2 indicate the mouse x location in window relative coordinates when the key was pressed. arg3 indicate the mouse y location in window relative coordinates when the key was pressed. During a keyboard callback, VRT_GetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred.

#define VRT_MSG_KEYBOARD_UP 108 When a user types into the window, each key release matching an ASCII character will generate a keyboard up callback message. arg1 is the generated ASCII character. The state of modifier keys such as Shift cannot be determined directly; their only effect will be on the returned ASCII data. arg2 indicate the mouse x location in window relative coordinates when the key was pressed. arg3 indicate the mouse y location in window relative coordinates when the key was pressed. During a keyboard up callback, VRT_GetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred. There is no guarantee that the keyboard press callback will match the exact ASCII character as the keyboard up callback. For example, the key down may be for a lowercase b, but the key release may report an uppercase B if the shift state has changed. The same applies to symbols and control characters. The precise behavior is window system dependent.

#define VRT_MSG_MENU_STATE 109 DEPRECATED.

#define VRT_MSG_MENU_STATUS 110 The menu status callback message will be sent with the value VRT_MENU_IN_USE for its arg1 parameter when pop-up menus are in use by the user; and the callback will be called with the value VRT_MENU_NOT_IN_USE for its arg1 parameter when pop-up menus are no longer in use. arg2 indicate the x location in window coordinates of the button press that caused the menu to go into use, or the location where the menu was released (may be outside the window).

Page 160: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

156

arg3 indicate the y location in window coordinates of the button press that caused the menu to go into use, or the location where the menu was released (may be outside the window).

#define VRT_MSG_MOUSE_BUTTON 111 When a user presses and releases mouse buttons in the window, each press and each release generates a mouse callback message. arg1 is one of VRT_LEFT_BUTTON, VRT_MIDDLE_BUTTON, or VRT_RIGHT_BUTTON. For systems with only two mouse buttons, it may not be possible to generate VRT_MIDDLE_BUTTON callback. For systems with a single mouse button, it may be possible to generate only a VRT_LEFT_BUTTON callback. arg2 is either VRT_UP or VRT_DOWN indicating whether the callback message was due to a release or press respectively. arg3 indicate the window relative x coordinate when the mouse button state changed. arg4 indicate the window relative y coordinate when the mouse button state changed. If a VRT_DOWN callback for a specific button is triggered, the program can assume a VRT_UP callback for the same button will be generated when the mouse button is released even if the mouse has moved outside the window. During a mouse callback, VRT_GetModifiers may be called to determine the state of modifier keys when the mouse event generating the callback occurred.

#define VRT_MSG_MOUSE_ENTRY 104 The mouse entry callback message is sent whenever the mouse pointer leaves or enters the window. arg1 is either VRT_LEFT or VRT_ENTERED depending on if the mouse pointer has last left or entered the window.

#define VRT_MSG_MOUSE_MOTION 112 The motion callback message for a window is sent when the mouse moves within the window while one or more mouse buttons are pressed. arg1 indicate the mouse x location in window relative coordinates. arg2 indicate the mouse y location in window relative coordinates.

#define VRT_MSG_MOUSE_PASSIVE_MOTION 113 The passive motion callback message for a window is sent when the mouse moves within the window while no mouse buttons are pressed. arg1 indicate the mouse x location in window relative coordinates. arg2 indicate the mouse y location in window relative coordinates.

#define VRT_MSG_OVERLAY_DISPLAY 114 Overlay display callback message, not used.

Page 161: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

157

#define VRT_MSG_RESHAPE 115 The reshape callback message is sent when a window is reshaped. A reshape callback message is also sent immediately before a window's first display callback message after a window is created. arg1 specify the new window width in pixels. arg2 specify the new window height in pixels.

#define VRT_MSG_SPACEBALL_BUTTON 116 The Spaceball button callback message for a window is sent when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball button presses. arg1 will be the button number (starting at one). arg2 is either VRT_UP or VRT_DOWN indicating whether the callback was due to a release or press respectively.

#define VRT_MSG_SPACEBALL_MOTION 117 The Spaceball motion callback message for a window is sent when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball translations. arg1 indicate the translations along the X axis. arg2 indicate the translations along the Y axis. arg3 indicate the translations along the Z axis. The callback parameters are normalized to be within the range of -1000 to 1000 inclusive.

#define VRT_MSG_SPACEBALL_ROTATE 118 The Spaceball rotate callback message for a window is sent when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball rotations. arg1 indicate the rotation along the X axis. arg2 indicate the rotation along the Y axis. arg3 indicate the rotation along the Z axis. The callback parameters are normalized to be within the range of -1800 to 1800 inclusive.

#define VRT_MSG_SPECIAL_DOWN 119 The special keyboard callback message is sent when keyboard function or directional keys are pressed. arg1 is a VRT_KEY_* constant for the special key pressed. arg2 indicate the mouse in window relative x coordinates when the key was pressed. arg3 indicate the mouse in window relative y coordinates when the key was pressed. During a special callback, VRT_GetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred. An implementation should do its best to provide ways to generate all the VRT_KEY_* special keys. The available VRT_KEY_* values are: VRT_KEY_F1

Page 162: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

158

F1 function key. VRT_KEY_F2 F2 function key. VRT_KEY_F3 F3 function key. VRT_KEY_F4 F4 function key. VRT_KEY_F5 F5 function key. VRT_KEY_F6 F6 function key. VRT_KEY_F7 F7 function key. VRT_KEY_F8 F8 function key. VRT_KEY_F9 F9 function key. VRT_KEY_F10 F10 functio key. VRT_KEY_F11 F11 function key. VRT_KEY_F12 F12 function key. VRT_KEY_LEFT Left directional key. VRT_KEY_UP Up directional key. VRT_KEY_RIGHT Right directional key. VRT_KEY_DOWN Down directional key. VRT_KEY_PAGE_UP Page up directional key. VRT_KEY_PAGE_DOWN Page down directional key. VRT_KEY_HOME Home directional key. VRT_KEY_END End directional key. VRT_KEY_INSERT

Page 163: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

159

Inset directional key. Note that the escape, backspace, and delete keys are generated as an ASCII character.

#define VRT_MSG_SPECIAL_UP 120 The special keyboard up callback message is sent when keyboard function or directional keys are released. arg1 is a VRT_KEY_* constant for the special key pressed. arg2 indicate the mouse in window relative x coordinates when the key was pressed. arg3 indicate the mouse in window relative y coordinates when the key was pressed. During a special up callback, VRT_GetModifiers may be called to determine the state of modifier keys when the key release generating the callback occurred. An implementation should do its best to provide ways to generate all the VRT_KEY_* special keys. The available VRT_KEY_* values are: VRT_KEY_F1 F1 function key. VRT_KEY_F2 F2 function key. VRT_KEY_F3 F3 function key. VRT_KEY_F4 F4 function key. VRT_KEY_F5 F5 function key. VRT_KEY_F6 F6 function key. VRT_KEY_F7 F7 function key. VRT_KEY_F8 F8 function key. VRT_KEY_F9 F9 function key. VRT_KEY_F10 F10 functio key. VRT_KEY_F11 F11 function key. VRT_KEY_F12 F12 function key. VRT_KEY_LEFT Left directional key.

Page 164: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

160

VRT_KEY_UP Up directional key. VRT_KEY_RIGHT Right directional key. VRT_KEY_DOWN Down directional key. VRT_KEY_PAGE_UP Page up directional key. VRT_KEY_PAGE_DOWN Page down directional key. VRT_KEY_HOME Home directional key. VRT_KEY_END End directional key. VRT_KEY_INSERT Inset directional key. Note that the escape, backspace, and delete keys are generated as an ASCII character.

#define VRT_MSG_TABLET_BUTTON 121 The tablet button callback message for a window is sent when the window has tablet input focus (normally, when the mouse is in the window) and the user generates tablet button presses. arg1 will be the button number (starting at one). arg2 is either VRT_UP or VRT_DOWN indicating whether the callback was due to a release or press respectively. arg3 indicate the window relative x coordinates when the tablet button state changed. arg4 indicate the window relative y coordinates when the tablet button state changed.

#define VRT_MSG_TABLET_MOTION 122 The tablet motion callback message for a window is sent when the window has tablet input focus (normally, when the mouse is in the window) and the user generates tablet motion. arg1 indicate the absolute x position of the tablet "puck" on the tablet. arg2 indicate the absolute y position of the tablet "puck" on the tablet. The callback parameters are normalized to be within the range of 0 to 2000 inclusive.

#define VRT_MSG_TIMER 123 Timer callback message, not used.

Page 165: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

161

#define VRT_MSG_VISIBILITY 124 The visibility callback message for a window is sent when the visibility of a window changes. arg1 is either VRT_NOT_VISIBLE or VRT_VISIBLE depending on the current visibility of the window. VRT_VISIBLE does not distinguish a window being totally versus partially visible. VRT_NOT_VISIBLE means no part of the window is visible, i.e., until the window's visibility changes, all further rendering to the window is discarded. VRT considers a window visible if any pixel of the window is visible or any pixel of any descendant window is visible on the screen.

#define VRT_MSG_WINDOW_STATUS 125 The window status callback message for a window is sent when the window status (visibility) of a window changes. arg1 is one of VRT_HIDDEN, VRT_FULLY_RETAINED, VRT_PARTIALLY_RETAINED, or VRT_FULLY_COVERED depending on the current window status of the window. VRT_HIDDEN means that the window is either not shown (often meaning that the window is iconified). VRT_FULLY_RETAINED means that the window is fully retained (no pixels belonging to the window are covered by other windows). VRT_PARTIALLY_RETAINED means that the window is partially retained (some but not all pixels belonging to the window are covered by other windows). VRT_FULLY_COVERED means the window is shown but no part of the window is visible, i.e., until the window's status changes, all further rendering to the window is discarded. VRT considers a window visible if any pixel of the window is visible or any pixel of any descendant window is visible on the screen. VRT applications are encouraged to disable rendering and/or animation when windows have a status of either VRT_HIDDEN or VRT_FULLY_COVERED.

#define VRT_MULTISAMPLE 128

#define VRT_NET_MAXCLIENTS 64 Maximum allowed network clients.

#define VRT_NODE_MAXCHILDREN 256 The maximal number of children any single node can have.

#define VRT_NODELIST_MAXNODES 1024 The maximal number of nodes in a VRT context.

#define VRT_NODEPATH_MAXDEPTH 64 The maximal depth of a nodepath. I.e. the maximum depth a nodetree will be traversed.

Page 166: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

162

#define VRT_NOT_VISIBLE 0

#define VRT_OPT_GEOMETRY_NONE 0 Generic geometry, not optimized.

#define VRT_OPT_GEOMETRY_QUADSTRIP 1 Geometry optimized for quadstrips.

#define VRT_OPT_GEOMETRY_TRIANGLEFAN 3 Geometry optimized for trianglestrips.

#define VRT_OPT_GEOMETRY_TRIANGLESTRIP 2 Geometry optimized for trianglestrips.

#define VRT_PARTIALLY_RETAINED 2

#define VRT_PIPED_DISPLAY 32768

#define VRT_PIPELIST_MAXPIPES 8 The maximum number of pipes in a VRT context.

#define VRT_POLY_MAXVERTICES 4

#define VRT_PROJECTOR_CAMERA 1 Defines a projector type to camera. See also:

VRT_Camera

#define VRT_PROJECTOR_WOW 2 Defines a projector type to WoW. See also:

VRT_WoW

Page 167: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

163

#define VRT_PROJECTOR_WOW_RAW 3

#define VRT_PROJECTORLIST_MAXPROJECTORS 128 The maximal number of projectors in a VRT context.

#define VRT_RGB 0

#define VRT_RGBA VRT_RGB

#define VRT_RIGHT_BUTTON 2

#define VRT_SINGLE 0

#define VRT_SM_FLAT 2 Polygon faces are shaded in one color.

#define VRT_SM_SHADE 4 Polygon faces are shaded smoothly if normal vectors are supplied for vertices. Material properties work only correct in this shading mode.

#define VRT_SM_TEXTURE 8 Textures are applied. Observe that texture u/v coordinated must be supplied for the vertices to yield correct results.Remark: In VRT, a black texel value of RGB=(0,0,0) will cause the corresponding fragment not to be rendered i.e. the scene behind that fragment will remain visible and z-buffer is not affected. This is in particular useful if fine structures are supposed to be modeled using masked textures. If black texels are desired the a RGB value of RGB = (1,1,1) should be used.

#define VRT_SM_UNDEFINED 0 Shading model are undefined.

#define VRT_SM_WIRE 1 Points are connected with lines.

Page 168: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

164

#define VRT_STENCIL 32

#define VRT_STEREO 256

#define VRT_STEREO_HSPLIT 8 Stereo, horizontally split display using mirror arrangement.

#define VRT_STEREO_VSPLIT 4 Double-buffered rendering using stereo with vertically split display and sync-doubler unit.

#define VRT_TEXTURE_MODULATION_BLEND GL_BLEND Texture fragments are combined by alpha blending.

#define VRT_TEXTURE_MODULATION_DECAL GL_DECAL Texture fragments are combined by decal.

#define VRT_TEXTURE_MODULATION_MODULATE GL_MODULATE Texture fragments are combined by modulation.

#define VRT_TEXTURELIST_MAXTEXTURES 128 The maximal number of projectors in a VRT context.

#define VRT_UP 1

#define VRT_VIP 16 Virtual Plane using quad-buffered stereo rendering system.

#define VRT_VIP_SPLIT 16384 Virtual Plane using double-buffered stereo with sync-doubler unit (requires split screen stereo rendering).

Page 169: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

165

#define VRT_VIPPLUS 128

#define VRT_VIPPLUS_HS_1 4096

#define VRT_VIPPLUS_HS_2 8192

#define VRT_VIPPLUS_VS_1 1024

#define VRT_VIPPLUS_VS_2 2048

#define VRT_VISIBLE 1

#define VRT_VMIRROR 32 Vertically mirrored picture on screen.

#define VRT_VNC_ERR_NO_STATE_POINTER 705

#define VRT_VNC_ERR_NO_SUCH_SERVER 703

#define VRT_VNC_ERR_SERVER_HUNG_UP 702

#define VRT_VNC_ERR_UNKNOWN 706

#define VRT_VNC_ERR_VNCWINDOW_IS_NULL 701

#define VRT_VNC_ERR_WRONG_PASSWORD 704

#define VRT_VNC_H_VER "0.5"

Page 170: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

166

#define VRT_WORKBENCH 48 Using quad-buffered stereo rendering with vertically mirrored output for use with VirtualWorkbench/ReachIn.

#define VRT_X 0 Constant used to access the x component in certain VRT arrays.

#define VRT_Y 1 Constant used to access the y component in certain VRT arrays.

#define VRT_Z 2 Constant used to access the z component in certain VRT arrays.

Variable Documentation

const char* vrt_h_ver

const char* vrt_lib_ver

vrt_types.h File Reference

Data Structures • struct _HPLG

Handle to polygon.

• struct _nodepath • struct _patch • struct _VRT_CONTEXT • struct _VRT_DEC_INFO • struct _VRT_DEC_VTX • struct _VRT_DepthMap • struct _VRT_Htx

Page 171: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

167

Handle to texture.

• struct VRT_AnimationKnottag ??

• struct VRT_Animationtag ??

• struct VRT_Bitmaptag ??

• struct VRT_CB_MSG • struct VRT_Displaytag • struct VRT_Geometrytag

Geometry.

• struct VRT_Lighttag • struct VRT_Nodetag

Node.

• struct VRT_Pipetag • struct VRT_Polygontag

Polygon.

• struct VRT_PPBtag ??

• struct VRT_Projectortag • struct VRT_Vertextag

Vertex.

Typedefs • typedef _VRT_Htx VRT_Htx

Handle to texture.

• typedef VRT_Bitmaptag VRT_Bitmap ??

• typedef VRT_PPBtag VRT_PPB ??

• typedef VRT_Vertextag VRT_Vertex Vertex.

Page 172: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

168

• typedef VRT_Polygontag VRT_Polygon

Polygon.

• typedef VRT_Geometrytag VRT_Geometry Geometry.

• typedef VRT_AnimationKnottag VRT_AnimationKnot ??

• typedef VRT_Nodetag VRT_Node • typedef void VRT_NODE_CALLBACK (VRT_Node *node) • typedef VRT_Animationtag VRT_Animation

??

• typedef VRT_Displaytag VRT_Display • typedef VRT_Lighttag VRT_Light • typedef VRT_Projectortag VRT_Projector • typedef VRT_Projector VRT_Camera • typedef VRT_Projector VRT_WOW • typedef VRT_Pipetag VRT_Pipe • typedef _HPLG VRT_HPlg

Handle to polygon.

• typedef _nodepath VRT_NodePath • typedef _patch VRT_Patch • typedef clock_t VRT_Time • typedef void(* VRT_HookPtr )(VRT_CB_MSG *msg) • typedef void(* VRT_PostRenderHookPtr )(void) • typedef void SR • typedef _VRT_CONTEXT VRT_Context • typedef _VRT_DepthMap VRT_DepthMap • typedef double M4 [4][4] • typedef double V4 [4] • typedef double mReal • typedef _VRT_DEC_VTX VRT_DEC_VTX • typedef _VRT_DEC_INFO VRT_DEC_INFO

Typedef Documentation

typedef double M4[4][4]

typedef double mReal

Page 173: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

169

typedef void SR

typedef double V4[4]

typedef struct VRT_Animationtag VRT_Animation ??

typedef struct VRT_AnimationKnottag VRT_AnimationKnot ??

typedef struct VRT_Bitmaptag VRT_Bitmap ??

typedef VRT_Projector VRT_Camera

typedef struct _VRT_CONTEXT VRT_Context

typedef struct _VRT_DEC_INFO VRT_DEC_INFO

typedef struct _VRT_DEC_VTX VRT_DEC_VTX

typedef struct _VRT_DepthMap VRT_DepthMap

typedef struct VRT_Displaytag VRT_Display

typedef struct VRT_Geometrytag VRT_Geometry Geometry.

typedef void(* VRT_HookPtr)(VRT_CB_MSG *msg)

typedef struct _HPLG VRT_HPlg Handle to polygon.

Page 174: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

170

typedef struct _VRT_Htx VRT_Htx Handle to texture.

typedef struct VRT_Lighttag VRT_Light

typedef struct VRT_Nodetag VRT_Node

typedef void VRT_NODE_CALLBACK(VRT_Node *node)

typedef struct _nodepath VRT_NodePath

typedef struct _patch VRT_Patch

typedef struct VRT_Pipetag VRT_Pipe

typedef struct VRT_Polygontag VRT_Polygon Polygon.

typedef void(* VRT_PostRenderHookPtr)(void)

typedef struct VRT_PPBtag VRT_PPB ??

typedef struct VRT_Projectortag VRT_Projector

typedef clock_t VRT_Time

typedef struct VRT_Vertextag VRT_Vertex Vertex.

Page 175: VRT 2 - Uppsala  · PDF fileiii Table of Contents Table of contents VRT Module Index VRT Modules Here is a list of all modules: VRT.....1

171

typedef VRT_Projector VRT_WOW

Index INDEX