Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RpNormMap
[Lighting]


Enumerations

enum  RpNormMapAtomicPipeline {
  rpNANORMMAPATOMICPIPELINE = 0, rpNORMMAPATOMICSTATICPIPELINE = 1, rpNORMMAPATOMICSKINNEDPIPELINE = 2, rpNORMMAPATOMICPIPELINEMAX,
  rpNORMMAPATOMICPIPELINEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT
}

Functions

void RpNormMapAtomicInitialize (RpAtomic *atomic, RpNormMapAtomicPipeline pipeline)
void RpNormMapWorldEnable (RpWorld *world)
RxPipelineRpNormMapGetAtomicPipeline (RpNormMapAtomicPipeline pipeline)
RpMaterialRpNormMapMaterialSetNormMapTexture (RpMaterial *material, RwTexture *normalmap)
RwTextureRpNormMapMaterialGetNormMapTexture (const RpMaterial *material)
RpMaterialRpNormMapMaterialSetEnvMapTexture (RpMaterial *material, RwTexture *envmap)
RwTextureRpNormMapMaterialGetEnvMapTexture (const RpMaterial *material)
RpMaterialRpNormMapMaterialSetEnvMapCoefficient (RpMaterial *material, RwReal coef)
RwReal RpNormMapMaterialGetEnvMapCoefficient (const RpMaterial *material)
RpMaterialRpNormMapMaterialSetEnvMapFrame (RpMaterial *material, RwFrame *frame)
RwFrameRpNormMapMaterialGetEnvMapFrame (RpMaterial *material)
RpMaterialRpNormMapMaterialModulateEnvMap (RpMaterial *material, RwBool modulate)
RwBool RpNormMapMaterialIsEnvMapModulated (const RpMaterial *material)
RwBool RpNormMapPluginAttach (void)
RwBool RpNormMapAtomicIsInitialized (const RpAtomic *atomic)
void RpNormMapWorldSectorInitialize (RpWorldSector *worldsector)
RwBool RpNormMapWorldSectorIsInitialized (const RpWorldSector *worldsector)
RwBool RpNormMapWorldIsEnabled (const RpWorld *world)
RxPipelineRpNormMapGetWorldSectorPipeline (void)
void RpNormMapSetActiveLights (RpLight *mainLight, RpLight *ambientLight)

Detailed Description

Normal Maps Plugin for RenderWare Graphics.

RpNormMap Plugin Overview

Requirements for rpnormmap library
Requirements for rpnormmapskin library
The rpnormmapskin.lib library contains both the rpNORMMAPATOMICSTATICPIPELINE and rpNORMMAPATOMICSKINNEDPIPELINE pipelines.

Overview

This plugin provides facilities for using normal maps. Normal maps are textures that store a normal per pixel encoded as a color, converting the components of the normals from the range [-1..1] to [0..255]. These packed normals are later unpacked in the pixel shader and are used to calculate the light contribution per pixel.
Note:
Light distance attenuation for point lights or spotlights is still calculated per vertex.
The normal map plugin only supports one ambient light and one non-ambient light. You can directly specify the lights to be used by the plugin by calling the function RpNormMapSetActiveLights.
Note:
In order to apply more than one non-ambient light to the same object, you have to render additional additive passes for each light, setting the ambient light color to black for all but the first light. To force blending in additional passes for opaque objects, you have to set their materials color alpha values to 254 during each pass.
You can calculate a normal map from any RwImage using the toolkit RtNormMap.

The normal map plugin supports static and skinned atomics, and world sectors. Environment maps are also supported

Before any of the plugin functions are used, the plugin should be attached using RpNormMapPluginAttach.

Atomics
The normal maps pipeline must be initialized with RpNormMapAtomicInitialize for each atomic that contains normal maps.
World Sectors
The normal maps pipeline must be enabled with RpNormMapWorldEnable and RpNormMapWorldSectorInitialize for each world sector that contains normal maps.
Normal Maps
Normal Maps need to be setup for each material:
Environment Mapping
These functions are available if environment mapping is used:
See also:
RtNormMap

Enumeration Type Documentation

enum RpNormMapAtomicPipeline
 

RpNormMapAtomicPipeline rendering pipelines available within the RpNormMap plugin. Use RpNormMapGetAtomicPipeline to retrieve the required RxPipeline.

Enumeration values:
rpNORMMAPATOMICSTATICPIPELINE  Static atomics normal map rendering pipeline.
rpNORMMAPATOMICSKINNEDPIPELINE  Skinned atomics normal map rendering pipeline.


Function Documentation

void RpNormMapAtomicInitialize RpAtomic   atomic,
RpNormMapAtomicPipeline    pipeline
 

RpNormMapAtomicInitialize initializes the required normal map rendering pipeline on an atomic.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
atomic  Pointer to the RpAtomic to initialize the normal maps pipeline on.
pipeline  Atomic rendering type.
See also:
RpNormMapPluginAttach , RpNormMapAtomicIsInitialized , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture

RwBool RpNormMapAtomicIsInitialized const RpAtomic   atomic
 

RpNormMapAtomicIsInitialized is used to check if the normal maps plugin has been initialized on an atomic.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

This function must be used before the RpAtomic is rendered or pre-instanced.

Parameters:
atomic  Pointer to the RpAtomic.
Returns:
True if the normal maps plugin has been initialized on the atomic, false otherwise.
See also:
RpNormMapPluginAttach , RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapWorldIsEnabled , RpNormMapMaterialSetNormMapTexture

RxPipeline* RpNormMapGetAtomicPipeline RpNormMapAtomicPipeline    pipeline
 

RpNormMapGetAtomicPipeline returns one of the RpNormMap internal atomic pipelines.

The RpNormMap plugin must be attached before using this function.

Parameters:
pipeline  Type of the requested pipeline.
Returns:
The RxPipeline requested from the plugin, or NULL if the pipeline wasn't constructed.
See also:
RpNormMapPluginAttach , RpNormMapAtomicInitialize , RpNormMapWorldIsEnabled , RpNormMapGetWorldSectorPipeline

RxPipeline* RpNormMapGetWorldSectorPipeline void   
 

RpNormMapGetWorldSectorPipeline returns the RpNormMap internal world sector pipeline.

The RpNormMap plugin must be attached before using this function.

Returns:
The RxPipeline requested from the plugin, or NULL if the pipeline wasn't constructed.
See also:
RpNormMapPluginAttach , RpNormMapAtomicInitialize , RpNormMapWorldIsEnabled , RpNormMapGetAtomicPipeline

RwReal RpNormMapMaterialGetEnvMapCoefficient const RpMaterial   material
 

RpNormMapMaterialGetEnvMapCoefficient is used to retrieve the environment coefficient.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  A const pointer to a RpMaterial.
Returns:
Returns environment coefficient value.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialModulateEnvMap. , RpNormMapMaterialIsEnvMapModulated.

RwFrame* RpNormMapMaterialGetEnvMapFrame RpMaterial   material
 

RpNormMapMaterialGetEnvMapFrame is used to retrieve the RwFrame used for projecting the environment map.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  Pointer to a RpMaterial.
Returns:
Returns a pointer to the environment map's RwFrame.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialModulateEnvMap. , RpNormMapMaterialIsEnvMapModulated.

RwTexture* RpNormMapMaterialGetEnvMapTexture const RpMaterial   material
 

RpNormMapMaterialGetEnvMapTexture is used to retrieve the texture used for the environment map effect.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  A pointer to a RpMaterial.
Returns:
Returns a pointer to the environment map's RwTexture.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialModulateEnvMap. , RpNormMapMaterialIsEnvMapModulated.

RwTexture* RpNormMapMaterialGetNormMapTexture const RpMaterial   material
 

RpNormMapMaterialGetNormMapTexture is used to retrieve the normal map texture from a material.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  Pointer to the RpMaterial to retrieve the normal map texture from.
Returns:
The normal map texture used on success, NULL otherwise.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialModulateEnvMap. , RpNormMapMaterialIsEnvMapModulated.

RwBool RpNormMapMaterialIsEnvMapModulated const RpMaterial   material
 

RpNormMapMaterialIsEnvMapModulated determines whether the environment map is modulate by the base texture before applying it.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  Const pointer to a RpMaterial.
Returns:
TRUE if the modulation of the environment map is enabled for this material, FALSE otherwise.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialModulateEnvMap.

RpMaterial* RpNormMapMaterialModulateEnvMap RpMaterial   material,
RwBool    modulate
 

RpNormMapMaterialModulateEnvMap forces the environment map to be modulated by the base texture before applying it, when modulate is TRUE. By default the modulation is disabled. Modulating the environment map by the base texture may be used, for example, to simulate metallic materials.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  Pointer to the RpMaterial.
modulate  RwBool indicates whether or not the environment map will be modulated with the base texture.
Returns:
The material used on success, NULL otherwise.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialIsEnvMapModulated.

RpMaterial* RpNormMapMaterialSetEnvMapCoefficient RpMaterial   material,
RwReal    coef
 

RpNormMapMaterialSetEnvMapCoefficient affects the reflectivity of the material, i.e. the intensity of the environment map.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  Pointer to the RpMaterial.
coef  RwReal representing the reflection coefficient of the material
Returns:
The material used on success, NULL otherwise.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialModulateEnvMap. , RpNormMapMaterialIsEnvMapModulated.

RpMaterial* RpNormMapMaterialSetEnvMapFrame RpMaterial   material,
RwFrame   frame
 

RpNormMapMaterialSetEnvMapFrame sets the frame associated with the environment mapping material effect. This will affect the position of the environment map on the object.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  Pointer to the RpMaterial.
frame  Pointer to the RwFrame affecting environment mapping.
Returns:
The material used on success, NULL otherwise.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialModulateEnvMap. , RpNormMapMaterialIsEnvMapModulated.

RpMaterial* RpNormMapMaterialSetEnvMapTexture RpMaterial   material,
RwTexture   envmap
 

RpNormMapMaterialSetEnvMapTexture sets the texture for a environment mapping material effect using the normal map. The texture is rendered with dynamically generated UVs using a spherical environment mapping.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  Pointer to the RpMaterial.
envmap  Pointer to the RwTexture for the environment map. Environment mapping is disabled if the pointer is NULL.
Returns:
The material used on success, NULL otherwise.
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialModulateEnvMap. , RpNormMapMaterialIsEnvMapModulated.

RpMaterial* RpNormMapMaterialSetNormMapTexture RpMaterial   material,
RwTexture   normalmap
 

RpNormMapMaterialSetNormMapTexture is used to setup the normal map texture for a material.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
material  Pointer to the RpMaterial to setup the normal map texture on.
normalmap  Pointer to the RwTexture to use as the normal map.
Returns:
The source RpMaterial on success, NULL otherwise
See also:
RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetEnvMapTexture. , RpNormMapMaterialSetEnvMapCoefficient. , RpNormMapMaterialGetNormMapTexture , RpNormMapMaterialSetEnvMapFrame. , RpNormMapMaterialGetEnvMapTexture. , RpNormMapMaterialGetEnvMapCoefficient. , RpNormMapMaterialGetEnvMapFrame. , RpNormMapMaterialModulateEnvMap. , RpNormMapMaterialIsEnvMapModulated.

RwBool RpNormMapPluginAttach void   
 

RpNormMapPluginAttach is called by the application to indicate that the normal maps plugin should be used. The call to this function should be placed between RwEngineInit and RwEngineOpen and the world plugin must already be attached.

Warning:
The include files rpnormmap.h and rpworld.h are also required and must be included by an application wishing to use normal maps.
Warning:
The normal maps plugin requires
  • the normal maps plugin rpnormmap.lib and
  • the world plugin rpworld.lib to be linked into the application and attached at run time.
Returns:
True on success, false otherwise
See also:
RpWorldPluginAttach , RpNormMapAtomicInitialize , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture

void RpNormMapSetActiveLights RpLight   mainLight,
RpLight   ambientLight
 

RpNormMapSetActiveLights is called to define the ambient and the main light the normal maps plugin should use to light the atomics or the world sectors. The normal maps plugin only supports a custom light mode of a single main light and a single ambient light.

If the parameters passed to this function are not NULL, then any lights added to the world will be ignored whilst using the normal maps pipelines.

Parameters:
mainLight  Pointer to the main light.
ambientLight  Pointer to the ambient light.
See also:
RpNormMapPluginAttach , RpNormMapAtomicInitialize , RpNormMapWorldIsEnabled , RpNormMapGetAtomicPipeline , RpNormMapGetWorldSectorPipeline

void RpNormMapWorldEnable RpWorld   world
 

RpNormMapWorldEnable is used to enable the normal maps object pipeline on a world.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

This function must be used before the RpWorld is rendered or pre-instanced.

Parameters:
world  Pointer to the world to enable the normal maps pipeline on.
Returns:
True if the normal maps plugin has been enabled on the world, false otherwise.
See also:
RpNormMapPluginAttach , RpNormMapAtomicInitialize , RpNormMapAtomicIsInitialized , RpNormMapWorldSectorInitialize , RpNormMapWorldIsEnabled , RpNormMapMaterialSetNormMapTexture

RwBool RpNormMapWorldIsEnabled const RpWorld   world
 

RpNormMapWorldIsEnabled is used to check if the normal maps plugin has been enabled on a world.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
world  Pointer to the world.
See also:
RpNormMapPluginAttach , RpNormMapAtomicInitialize , RpNormMapAtomicIsInitialized , RpNormMapWorldEnable , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture

void RpNormMapWorldSectorInitialize RpWorldSector   worldsector
 

RpNormMapWorldSectorInitialize is used to initialize the normal maps object pipeline on a world sector.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
worldsector  Pointer to the world sector to initialize the normal maps pipeline on.
Returns:
True if the normal maps plugin has been initialized on the worldsector, false otherwise.
See also:
RpNormMapPluginAttach , RpNormMapAtomicInitialize , RpNormMapAtomicIsInitialized , RpNormMapWorldEnable , RpNormMapWorldIsEnabled , RpNormMapWorldSectorIsInitialized , RpNormMapMaterialSetNormMapTexture

RwBool RpNormMapWorldSectorIsInitialized const RpWorldSector   worldsector
 

RpNormMapWorldSectorIsInitialized is used to check if the normal maps plugin has been initialized on a world sector.

The world and normal maps plugins must be attached before using this function. The header file rpnormmap.h is required.

Parameters:
worldsector  Const pointer to the RpWorldSector.
Returns:
True if the normal maps plugin has been initialized on the world sector, false otherwise.
See also:
RpNormMapPluginAttach , RpNormMapAtomicInitialize , RpNormMapAtomicIsInitialized , RpNormMapWorldEnable , RpNormMapWorldIsEnabled , RpNormMapWorldSectorInitialize , RpNormMapMaterialSetNormMapTexture


Criterion Software © 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:47:05 2004. Send Feedback