# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CComputedString Struct Reference

CComputedString A CComputedString is a structure which permits to render a string in a driver. More...

#include <computed_string.h>

List of all members.

Public Types

enum  THotSpot {
  BottomLeft = 0, MiddleLeft, TopLeft, MiddleBottom,
  MiddleMiddle, MiddleTop, BottomRight, MiddleRight,
  TopRight, HotSpotCount
}
 Hotspot positions (origine for the string placement) You should take care that for vertical hotspot, an imaginary line is defined under letters with no leg (like m,b,c etc..) between the leg of p and the loop of the p. More...


Public Methods

 CComputedString (bool bSetupVB=true)
 Default constructor. More...

CVector getHotSpotVector (THotSpot hotspot)
 Get the string's origin. More...

void render2D (IDriver &driver, float x, float z, THotSpot hotspot=BottomLeft, float scaleX=1, float scaleZ=1, float rotateY=0, bool useScreenAR43=false, bool roundToNearestPixel=true)
 Render the unicode string in a driver. More...

void render2DClip (IDriver &driver, float x, float z, float xmin=0, float ymin=0, float xmax=1, float ymax=1)
 same as render2D but clip the quads to xmin,ymin/xmax,ymax. More...

void render3D (IDriver &driver, CMatrix matrix, THotSpot hotspot=MiddleMiddle)
 Render the unicode string in a driver, in 3D with a user matrix. More...


Public Attributes

CVertexBuffer Vertices
CVertexBuffer VerticesClipped
CMaterialMaterial
CRGBA Color
float StringWidth
 The width of the string, in pixels (eg: 30). More...

float StringHeight
 The height of the string, in pixels (eg: 10). More...

float StringLine
 StringLine is the size from bottom of the whole string image to the hotspot in pixels. More...


Detailed Description

CComputedString A CComputedString is a structure which permits to render a string in a driver.

It computes 4 vertices per char the renderer draw quads from them.

Author:
Stephane Coutelas , Nevrax France
Date:
2000

Definition at line 59 of file computed_string.h.


Member Enumeration Documentation

enum NL3D::CComputedString::THotSpot
 

Hotspot positions (origine for the string placement) You should take care that for vertical hotspot, an imaginary line is defined under letters with no leg (like m,b,c etc..) between the leg of p and the loop of the p.

Enumeration values:
BottomLeft 
MiddleLeft 
TopLeft 
MiddleBottom 
MiddleMiddle 
MiddleTop 
BottomRight 
MiddleRight 
TopRight 
HotSpotCount 

Definition at line 84 of file computed_string.h.


Constructor & Destructor Documentation

NL3D::CComputedString::CComputedString bool    bSetupVB = true [inline]
 

Default constructor.

Definition at line 102 of file computed_string.h.

References StringHeight, StringWidth, Vertices, and VerticesClipped.


Member Function Documentation

CVector NL3D::CComputedString::getHotSpotVector THotSpot    hotspot
 

Get the string's origin.

Parameters:
hotspot  the origin of the string

Definition at line 48 of file computed_string.cpp.

References BottomRight, MiddleBottom, MiddleLeft, MiddleMiddle, MiddleRight, MiddleTop, StringHeight, StringWidth, TopLeft, and TopRight.

Referenced by render2D, and render3D.

void NL3D::CComputedString::render2D IDriver   driver,
float    x,
float    z,
THotSpot    hotspot = BottomLeft,
float    scaleX = 1,
float    scaleZ = 1,
float    rotateY = 0,
bool    useScreenAR43 = false,
bool    roundToNearestPixel = true
 

Render the unicode string in a driver.

Parameters:
driver  the driver where to render the primitives
x  abscissa
y  ordinate
hotspot  position of string origine
scaleX  abscissa scale
scaleY  ordinate scale
rotateY  rotation angle (axe perpendicular to screen)
useScreenAR43  if false then string is displayed with a pixel Ratio 1:1 (independent of window resolution). if true, the string is scaled according to window width and height, to support 4:3 aspect ratio even on weird screen resolution such as 640*240 (ie the char still look square, but the pixel ratio is 2:1)
roundToNearestPixel  if true, snap the final string position to the nearest pixel. if set to true, and if useScreenAR43= false, you are sure that texels of the fonts fit exactly on centers of pixels (no apparent bi-linear).

Definition at line 83 of file computed_string.cpp.

References Color, getHotSpotVector, Material, matrix, Vertices, x, and z.

void NL3D::CComputedString::render2DClip IDriver   driver,
float    x,
float    z,
float    xmin = 0,
float    ymin = 0,
float    xmax = 1,
float    ymax = 1
 

same as render2D but clip the quads to xmin,ymin/xmax,ymax.

NB: behavior is same as render2D with: Hotspot = bottomLeft, scaleX=1, scaleZ=1, rotateY=0, useScreenAR43= false, roundToNearestPixel= false

Definition at line 147 of file computed_string.cpp.

References Color, Material, matrix, Vertices, VerticesClipped, x, and z.

void NL3D::CComputedString::render3D IDriver   driver,
CMatrix    matrix,
THotSpot    hotspot = MiddleMiddle
 

Render the unicode string in a driver, in 3D with a user matrix.

NB: size of the string is first scaled by 1/windowHeight.

Parameters:
driver  the driver where to render the primitives
matrix  transformation matrix
hotspot  position of string origine

Definition at line 268 of file computed_string.cpp.

References Color, getHotSpotVector, Material, matrix, and Vertices.


Member Data Documentation

CRGBA NL3D::CComputedString::Color
 

Definition at line 66 of file computed_string.h.

Referenced by render2D, render2DClip, and render3D.

CMaterial* NL3D::CComputedString::Material
 

Definition at line 65 of file computed_string.h.

Referenced by render2D, render2DClip, and render3D.

float NL3D::CComputedString::StringHeight
 

The height of the string, in pixels (eg: 10).

Definition at line 70 of file computed_string.h.

Referenced by CComputedString, and getHotSpotVector.

float NL3D::CComputedString::StringLine
 

StringLine is the size from bottom of the whole string image to the hotspot in pixels.

for instance if the hotspot is bottomLeft the imaginary line of the string "bpc" is under the b, under the loop of the p but over the leg of the p. So StringLine is a positive value in this case. It may be a negative value for the string "^" for example.

Definition at line 77 of file computed_string.h.

float NL3D::CComputedString::StringWidth
 

The width of the string, in pixels (eg: 30).

Definition at line 68 of file computed_string.h.

Referenced by CComputedString, and getHotSpotVector.

CVertexBuffer NL3D::CComputedString::Vertices
 

Definition at line 63 of file computed_string.h.

Referenced by CComputedString, render2D, render2DClip, and render3D.

CVertexBuffer NL3D::CComputedString::VerticesClipped
 

Definition at line 64 of file computed_string.h.

Referenced by CComputedString, and render2DClip.


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