C# Class Horde3DNET.Horde3DUtils

Mostra file Open project: mgottschlag/horde3d

Public Methods

Method Description
createTGAImage ( byte pixels, int width, int height, int bpp, byte &outData, int &outSize ) : bool

This utility function allocates memory for the pointer outData and creates a TGA image from the specified pixel data. The dimensions of the image have to be specified as well as the bit depth of the pixel data. The created TGA-image-data can be used as Texture2D or TexureCube resource in the engine.

The memory allocated by this routine will be freed automatically.

dumpMessages ( ) : bool

This utility function pops all messages from the message queue and writes them to a HTML formated log file 'EngineLog.html'.

freeMem ( IntPtr ptr ) : void

FreeMem is not supported. The purpose is to free memory allocated by the Horde3D library.

getResourcePath ( Horde3D type ) : string

This function returns the search path of a specified resource type.

initOpenGL ( int hDC ) : bool

This utility function initializes an OpenGL rendering context in a specified window component.

loadResourcesFromDisk ( string contenDir ) : bool

This utility function loads previously added and still unloaded resources from a specified directory on a data drive. All resource names are directly converted to filenames when being loaded.

pickNode ( int node, float nwx, float nwy ) : int

This utility function takes normalized window coordinates (ranging from 0 to 1 with the origin being the bottom left corner of the window) and returns the scene node which is visible at that location. The function is especially useful for selecting objects by clicking on them. Currently picking is only working for Meshes.

pickRay ( int cameraNode, float nwx, float nwy, float &ox, float &oy, float &oz, float &dx, float &dy, float &dz ) : void

Calculates the ray originating at the specified camera and window coordinates

releaseOpenGL ( ) : void

This utility function destroys the previously created OpenGL rendering context.

setResourcePath ( Horde3D type, string path ) : void

This function sets the search path for a specified resource type. Whenever a new resource is added, the specified path is concatenated to the name of the created resource.

showFrameStats ( int fontMaterialRes, int panelMaterialRes, int mode ) : void

This utility function displays an info box with statistics for the current frame on the screen. Since the statistic counters are reset after the call, the function should be called exactly once per frame to obtain correct values.

showText ( string text, float x, float y, float size, float colR, float colG, float colB, int fontMatRes, int layer ) : void

This utility function uses overlays to display a text string at a specified position on the screen.

The font texture of the specified font material has to be a regular 16x16 grid containing all ASCII characters in row-major order. The layer corresponds to the layer parameter of overlays.

swapBuffers ( ) : void

This utility function displays the image rendered to the previously initialized OpenGL context on the screen by copying the OpenGL backbuffer to the window front buffer.

Method Details

createTGAImage() public static method

This utility function allocates memory for the pointer outData and creates a TGA image from the specified pixel data. The dimensions of the image have to be specified as well as the bit depth of the pixel data. The created TGA-image-data can be used as Texture2D or TexureCube resource in the engine.
The memory allocated by this routine will be freed automatically.
public static createTGAImage ( byte pixels, int width, int height, int bpp, byte &outData, int &outSize ) : bool
pixels byte pointer to pixel source data from which TGA-image-data is constructed; memory layout: pixel with position (x, y) in image (origin of image is upper left corner) has memory location (y * width + x) * (bpp / 8) in pixels array
width int image width of source data
height int image height of source data
bpp int color bit depth of source data (Valid: 24, 32)
outData byte the created TGA data
outSize int size of TGA data
return bool

dumpMessages() public static method

This utility function pops all messages from the message queue and writes them to a HTML formated log file 'EngineLog.html'.
public static dumpMessages ( ) : bool
return bool

freeMem() public static method

FreeMem is not supported. The purpose is to free memory allocated by the Horde3D library.
public static freeMem ( IntPtr ptr ) : void
ptr System.IntPtr
return void

getResourcePath() public static method

This function returns the search path of a specified resource type.
public static getResourcePath ( Horde3D type ) : string
type Horde3D type of resource
return string

initOpenGL() public static method

This utility function initializes an OpenGL rendering context in a specified window component.
public static initOpenGL ( int hDC ) : bool
hDC int handle to device context for which OpenGL context shall be created
return bool

loadResourcesFromDisk() public static method

This utility function loads previously added and still unloaded resources from a specified directory on a data drive. All resource names are directly converted to filenames when being loaded.
public static loadResourcesFromDisk ( string contenDir ) : bool
contenDir string directory where data is located on the drive
return bool

pickNode() public static method

This utility function takes normalized window coordinates (ranging from 0 to 1 with the origin being the bottom left corner of the window) and returns the scene node which is visible at that location. The function is especially useful for selecting objects by clicking on them. Currently picking is only working for Meshes.
public static pickNode ( int node, float nwx, float nwy ) : int
node int
nwx float normalized window x coordinate
nwy float normalized window y coordinate
return int

pickRay() public static method

Calculates the ray originating at the specified camera and window coordinates
public static pickRay ( int cameraNode, float nwx, float nwy, float &ox, float &oy, float &oz, float &dx, float &dy, float &dz ) : void
cameraNode int camera used for picking
nwx float normalized window coordinates
nwy float normalized window coordinates
ox float calculated ray origin
oy float calculated ray origin
oz float calculated ray origin
dx float calculated ray direction
dy float calculated ray direction
dz float calculated ray direction
return void

releaseOpenGL() public static method

This utility function destroys the previously created OpenGL rendering context.
public static releaseOpenGL ( ) : void
return void

setResourcePath() public static method

This function sets the search path for a specified resource type. Whenever a new resource is added, the specified path is concatenated to the name of the created resource.
public static setResourcePath ( Horde3D type, string path ) : void
type Horde3D type of resource
path string path where the resources can be found (without slash or backslash at the end)
return void

showFrameStats() public static method

This utility function displays an info box with statistics for the current frame on the screen. Since the statistic counters are reset after the call, the function should be called exactly once per frame to obtain correct values.
public static showFrameStats ( int fontMaterialRes, int panelMaterialRes, int mode ) : void
fontMaterialRes int font material resource used for drawing text
panelMaterialRes int material resource used for drawing info box
mode int display mode, specifying which data is shown (<= MaxStatMode)
return void

showText() public static method

This utility function uses overlays to display a text string at a specified position on the screen.
The font texture of the specified font material has to be a regular 16x16 grid containing all ASCII characters in row-major order. The layer corresponds to the layer parameter of overlays.
public static showText ( string text, float x, float y, float size, float colR, float colG, float colB, int fontMatRes, int layer ) : void
text string text string to be displayed
x float x position of the lower left corner of the first character; for more details on coordinate system see overlay documentation
y float y position of the lower left corner of the first character; for more details on coordinate system see overlay documentation
size float size factor of the font
colR float red part of font color
colG float green part of font color
colB float blue part of font color
fontMatRes int font material resource used for rendering
layer int layer index of the font overlays (values: 0-7)
return void

swapBuffers() public static method

This utility function displays the image rendered to the previously initialized OpenGL context on the screen by copying the OpenGL backbuffer to the window front buffer.
public static swapBuffers ( ) : void
return void