N3DDEVICE Interface


Data Structures

class  N3DDEVICE
 Interface to the 3D hardware. More...

Functions

void N3DDEVICE::BeginScene ()
 Begins a scene.
void N3DDEVICE::Clear (const unsigned _flags, const N3DCOLOR &_color, const N3DFLOAT _depth)
 Sets clear properties for the back and depth-buffer.
void N3DDEVICE::DrawPrimitive (const N3DCMDSTREAM &_stream)
 Draws a command buffer.
void N3DDEVICE::EndScene ()
 Ends a scene.
N3DBOOL N3DDEVICE::GetLightEnable (const unsigned _index) const
 Retrieves the enabled or disabled status of a light.
unsigned N3DDEVICE::GetTexture () const
 Gets the current texture.
unsigned N3DDEVICE::GetTexturePalette () const
 Gets the current texture palette.
void N3DDEVICE::GetViewport (N3DVIEWPORT &_viewport) const
 Gets the viewport parameters.
void N3DDEVICE::Init ()
 Initializes the 3D device.
void N3DDEVICE::LightEnable (const unsigned _index, const N3DBOOL _enable)
 Enables or disables a light.
void N3DDEVICE::MultiplyTransform (const N3DTRANSFORMSTATETYPE _state, const N3DMATRIX &_m)
 Multiplies a transformation matrix with the specified matrix.
void N3DDEVICE::Present ()
 Present the content of the back buffer.
void N3DDEVICE::Reset ()
 Resets the 3D device to its default states.
void N3DDEVICE::SetLight (const unsigned _index, const N3DLIGHT &_light)
 Sets lighting properties.
void N3DDEVICE::SetMaterial (const N3DMATERIAL &_material)
 Sets the material properties.
void N3DDEVICE::SetRenderState (const N3DRENDERSTATETYPE _state, const unsigned _value)
 Sets a render-state parameter.
void N3DDEVICE::SetTexture (const unsigned _vramOffset, const unsigned _width, const unsigned _height, const N3DFORMAT _format)
 Sets the current texture.
void N3DDEVICE::SetTexturePalette (const unsigned _vramOffset, const N3DFORMAT _format)
 Sets the current texture palette.
void N3DDEVICE::SetTextureState (const N3DTEXTURESTATETYPE _type, const unsigned _value)
 Sets a texture state.
void N3DDEVICE::SetTransform (const N3DTRANSFORMSTATETYPE _state, const N3DMATRIX &_m)
 Sets a transformation matrix for the specified state.
void N3DDEVICE::SetViewport (const N3DVIEWPORT &_viewport)
 Sets the viewport parameters.

Function Documentation

void N3DDEVICE::BeginScene (  )  [inherited]

Begins a scene.

See also:
EndScene

void N3DDEVICE::Clear ( const unsigned  _flags,
const N3DCOLOR _color,
const N3DFLOAT  _depth 
) [inherited]

Sets clear properties for the back and depth-buffer.

Parameters:
[in] _flags One or more members of the N3DCLEAR enumeration. See remarks.
[in] _color Clear to this color.
[in] _depth Clear depth buffer to this new depth value. Ranges from N3DFLOAT(0) to N3DFLOAT(1).
Remarks:
The hardware always clears the back and depth-buffer, no matter if you call N3DDEVICE::Clear or not. This method can only be used to set the clear color and depth value which the hardware auto-clear mechanism uses.
Example: Set both, the target clear color and new depth value.
N3DDEVICE;

device.Clear(N3DCLEAR_TARGET | N3DCLEAR_DEPTH, N3DCOLOR(0, 0.0f, 0.5f), N3DFLOAT(1.0f));

Example: Only set the target clear color and keep the old depth value.

N3DDEVICE;

device.Clear(N3DCLEAR_TARGET, N3DCOLOR(0, 0.0f, 0.5f), N3DFLOAT(1.0f));

Todo:
The hardware supports an alpha target color value, it's hardcoded to full opaque atm.
Is there a way that the hardware does not automagically clear?

void N3DDEVICE::DrawPrimitive ( const N3DCMDSTREAM _stream  )  [inherited]

Draws a command buffer.

Parameters:
[in] _stream Reference to a source N3DCMDSTREAM structure.
See also:
Mesh Conversion Tool (ogre2n3d.exe)
Todo:
Add documentation Add sample code

void N3DDEVICE::EndScene (  )  [inherited]

Ends a scene.

See also:
BeginScene

N3DBOOL N3DDEVICE::GetLightEnable ( const unsigned  _index  )  const [inherited]

Retrieves the enabled or disabled status of a light.

Parameters:
[in] _index Zero-based index of light.
Returns:
If the light is enabled, the return value is true, otherwise false.
See also:
LightEnable, SetLight

unsigned N3DDEVICE::GetTexture (  )  const [inherited]

Gets the current texture.

See also:
N3DDEVICE::SetTexture, Video Memory Management

unsigned N3DDEVICE::GetTexturePalette (  )  const [inherited]

Gets the current texture palette.

See also:
N3DDEVICE::SetTexturePalette, Video Memory Management

void N3DDEVICE::GetViewport ( N3DVIEWPORT _viewport  )  const [inherited]

Gets the viewport parameters.

Parameters:
[out] _viewport Reference to a N3DVIEWPORT structure.
See also:
SetViewport

void N3DDEVICE::Init (  )  [inherited]

Initializes the 3D device.

Initializes the 3D device and sets several default states.

Remarks:
This method must be called before any other device methods.
See also:
Reset
Todo:
Describe default states

void N3DDEVICE::LightEnable ( const unsigned  _index,
const N3DBOOL  _enable 
) [inherited]

Enables or disables a light.

Parameters:
[in] _index Index of target light. Up to four lights are supported. Parameter can be set to 0, 1, 2 or 3.
[in] _enable TRUE to enable, FALSE to disable light.
See also:
GetLightEnable, SetLight

void N3DDEVICE::MultiplyTransform ( const N3DTRANSFORMSTATETYPE  _state,
const N3DMATRIX _m 
) [inherited]

Multiplies a transformation matrix with the specified matrix.

Parameters:
[in] _state Describes the transformation state. See N3DTRANSFORMSTATETYPE for a list of the supported transformation states.
[in] _m Reference to a N3DMATRIX structure that modifies the current transformation.
See also:
SetTransform
Todo:
Add sample code.
Implement support for viewmatrix multiply.

void N3DDEVICE::Reset (  )  [inherited]

Resets the 3D device to its default states.

See also:
Init

void N3DDEVICE::SetLight ( const unsigned  _index,
const N3DLIGHT _light 
) [inherited]

Sets lighting properties.

Parameters:
[in] _index Index of light.
[in] _light Reference to a source N3DLIGHT structure.
Remarks:
All lights in N3D are directional lights with an infinite distance!
Example:
    N3DDEVICE device;
    N3DLIGHT light;
    
    // Setup a violet light
    light.color.r = N3DFLOAT(1);
    light.color.g = N3DFLOAT(0);
    light.color.b = N3DFLOAT(0.5f);

    // Point along the z-axis
    light.direction.x = N3DFLOAT(0);
    light.direction.y = N3DFLOAT(0);
    light.direction.z = N3DFLOAT(1);

    // Set the light properties
    device.SetLight(0, light);

    // Enable the light
    device.LightEnable(0, true);

See also:
LightEnable

void N3DDEVICE::SetMaterial ( const N3DMATERIAL _material  )  [inherited]

Sets the material properties.

Parameters:
[out] _material Reference to a source N3DMATERIAL structure.
Example:
    N3DDEVICE device;
    N3DMATERIAL material;

    material.ambient.r = N3DFLOAT(0.2f);
    material.ambient.g = N3DFLOAT(0.2f);
    material.ambient.b = N3DFLOAT(0.2f);

    material.diffuse.r = N3DFLOAT(0.4f);
    material.diffuse.g = N3DFLOAT(0.4f);
    material.diffuse.b = N3DFLOAT(0.6f);

    material.specular.r = N3DFLOAT(0.7f);
    material.specular.g = N3DFLOAT(0.7f);
    material.specular.b = N3DFLOAT(1.0f);

    material.emissive.r = N3DFLOAT(0.0f);
    material.emissive.g = N3DFLOAT(0.0f);
    material.emissive.b = N3DFLOAT(0.0f);

    material.alpha = N3DFLOAT(1.0f);

    device.SetMaterial(material);

void N3DDEVICE::SetRenderState ( const N3DRENDERSTATETYPE  _state,
const unsigned  _value 
) [inherited]

Sets a render-state parameter.

Parameters:
[in] _state State variable that is being modified. This parameter can be any member of the N3DRENDERSTATETYPE enumerated type.
[in] _value New value for the render state to be set.
Example:

void N3DDEVICE::SetTexture ( const unsigned  _vramOffset,
const unsigned  _width,
const unsigned  _height,
const N3DFORMAT  _format 
) [inherited]

Sets the current texture.

Parameters:
[in] _vramOffset Texture Vram offset. The texture Vram offset must be aligned on a 8byte boundary.
[in] _width Texture width in pixels.
[in] _height Texture height in pixels.
[in] _format Texture format. One member of the N3DFORMAT enumeration.
Remarks:
This method modifies the texture transformation matrix.
See also:
N3DDEVICE::SetTexturePalette, Texture Sizes, Video Memory Management

void N3DDEVICE::SetTexturePalette ( const unsigned  _vramOffset,
const N3DFORMAT  _format 
) [inherited]

Sets the current texture palette.

Parameters:
[in] _vramOffset Palette Vram offset. The palette Vram offset must be aligned on a 8byte boundary in N3DFMT_P2, all other formats require 16byte alignment.
[in] _format Palette format. One member of the N3DFORMAT enumeration.
See also:
N3DDEVICE::SetTexture, N3DDEVICE::GetTexturePalette, Video Memory Management

void N3DDEVICE::SetTextureState ( const N3DTEXTURESTATETYPE  _type,
const unsigned  _value 
) [inherited]

Sets a texture state.

Parameters:
[in] _type Describes the texture state. See N3DTEXTURESTATETYPE
[in] _value State value. This value depends on the on the _type parameter.

void N3DDEVICE::SetTransform ( const N3DTRANSFORMSTATETYPE  _state,
const N3DMATRIX _m 
) [inherited]

Sets a transformation matrix for the specified state.

Parameters:
[in] _state Describes the transformation state. See N3DTRANSFORMSTATETYPE for a list of the supported transformation states.
[in] _m Reference to a N3DMATRIX structure that is set as the current transformation.
See also:
MultiplyTransform
Todo:
Refactor view-matrix code block.

void N3DDEVICE::SetViewport ( const N3DVIEWPORT _viewport  )  [inherited]

Sets the viewport parameters.

Parameters:
[in] _viewport Reference to a source N3DVIEWPORT structure.
Remarks:
N3D sets the following default values for the Viewport during the initialization process:
    viewport.x = 0;
    viewport.y = 0;
    viewport.width = 256;
    viewport.height = 192;
See also:
GetViewport


Generated on Wed Aug 29 19:48:04 2007 for N3D by  doxygen 1.5.3