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 (origin 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.

More...

Public Member Functions

 CComputedString (bool bSetupVB=true)
 Default constructor.
CVector getHotSpotVector (THotSpot hotspot)
 Get the string's origin.
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.
void render2DClip (IDriver &driver, CRenderStringBuffer &rdrBuffer, float x, float z, float xmin=0, float ymin=0, float xmax=1, float ymax=1)
 Special for interface.
void render2DUnProjected (IDriver &driver, CRenderStringBuffer &rdrBuffer, class NL3D::CFrustum &frustum, const NLMISC::CMatrix &scaleMatrix, float x, float z, float depth, float xmin=0, float ymin=0, float xmax=1, float ymax=1)
 Special for interface.
void render3D (IDriver &driver, CMatrix matrix, THotSpot hotspot=MiddleMiddle)
 Render the unicode string in a driver, in 3D with a user matrix.

Public Attributes

CVertexBuffer Vertices
CMaterialMaterial
CRGBA Color
float StringWidth
 The width of the string, in pixels (eg: 30).
float StringHeight
 The height of the string, in pixels (eg: 10).
float XMin
 The BBox of all vertices. used for render2DClip().
float ZMin
float XMax
float ZMax
float StringLine
 StringLine is the size from bottom of the whole string image to the hotspot in pixels.
uint32 SelectStart
 Optionnal: each render*() method can draw a subset of letters. Default is 0/FFFFFFFF.
uint32 SelectSize
CLetterColors LetterColors

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 176 of file computed_string.h.


Member Enumeration Documentation

Hotspot positions (origin 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.

Enumerator:
BottomLeft 
MiddleLeft 
TopLeft 
MiddleBottom 
MiddleMiddle 
MiddleTop 
BottomRight 
MiddleRight 
TopRight 
HotSpotCount 

Definition at line 209 of file computed_string.h.


Constructor & Destructor Documentation

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

Member Function Documentation

CVector NL3D::CComputedString::getHotSpotVector ( THotSpot  hotspot  ) 

Get the string's origin.

Parameters:
hotspot the origin of the string

Definition at line 46 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 81 of file computed_string.cpp.

References NL3D::IDriver::activeVertexBuffer(), NL3D::CMaterial::always, Color, getHotSpotVector(), NL3D::CVertexBuffer::getNumVertices(), NLMISC::CMatrix::getPos(), NL3D::IDriver::getWindowSize(), NLMISC::CMatrix::identity(), Material, min, NL3D::IDriver::renderRawQuads(), NLMISC::CMatrix::rotateY(), NLMISC::CMatrix::scale(), SelectSize, SelectStart, NL3D::CMaterial::setColor(), NL3D::IDriver::setFrustum(), NLMISC::CMatrix::setPos(), NL3D::IDriver::setupModelMatrix(), NL3D::IDriver::setupViewMatrix(), NL3D::CMaterial::setZFunc(), NL3D::CMaterial::setZWrite(), NLMISC::CMatrix::translate(), Vertices, NLMISC::CVector::x, and NLMISC::CVector::z.

Referenced by NL3D::CTextContext::printAt(), and NL3D::CTextContext::printfAt().

void NL3D::CComputedString::render2DClip ( IDriver driver,
CRenderStringBuffer rdrBuffer,
float  x,
float  z,
float  xmin = 0,
float  ymin = 0,
float  xmax = 1,
float  ymax = 1 
)
void NL3D::CComputedString::render2DUnProjected ( IDriver driver,
CRenderStringBuffer rdrBuffer,
class NL3D::CFrustum frustum,
const NLMISC::CMatrix scaleMatrix,
float  x,
float  z,
float  depth,
float  xmin = 0,
float  ymin = 0,
float  xmax = 1,
float  ymax = 1 
)
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 148 of file computed_string.cpp.

References NL3D::IDriver::activeVertexBuffer(), Color, getHotSpotVector(), NL3D::CVertexBuffer::getNumVertices(), NL3D::IDriver::getWindowSize(), NL3D::CMaterial::lessequal, Material, min, NL3D::IDriver::renderRawQuads(), NLMISC::CMatrix::scale(), SelectSize, SelectStart, NL3D::CMaterial::setColor(), NL3D::IDriver::setupModelMatrix(), NL3D::CMaterial::setZFunc(), NL3D::CMaterial::setZWrite(), NLMISC::CMatrix::translate(), and Vertices.

Referenced by NL3D::CInstanceGroup::displayDebugClusters(), NL3D::CPSUtil::print(), and NL3D::CTextContextUser::render3D().


Member Data Documentation

Definition at line 202 of file computed_string.h.

Referenced by render2DClip().

Definition at line 182 of file computed_string.h.

Referenced by NL3D::CFontManager::computeString(), render2D(), and render3D().

Optionnal: each render*() method can draw a subset of letters. Default is 0/FFFFFFFF.

Definition at line 199 of file computed_string.h.

Referenced by CComputedString(), render2D(), render2DClip(), render2DUnProjected(), render3D(), NL3D::CTextContextUser::resetStringSelection(), and NL3D::CTextContextUser::setStringSelection().

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 196 of file computed_string.h.

Referenced by NL3D::CFontManager::computeString(), NL3D::CFontManager::computeStringInfo(), and NL3D::CTextContextUser::getStringInfo().

The BBox of all vertices. used for render2DClip().

Definition at line 189 of file computed_string.h.

Referenced by NL3D::CFontManager::computeString(), render2DClip(), and render2DUnProjected().


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

Generated on Thu Jan 7 08:30:03 2010 for NeL by  doxygen 1.6.1