CComputedString A CComputedString is a structure which permits to render a string in a driver. More...
#include <computed_string.h>
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 |
| CMaterial * | Material |
| 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 |
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.
Definition at line 176 of file computed_string.h.
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.
| BottomLeft | |
| MiddleLeft | |
| TopLeft | |
| MiddleBottom | |
| MiddleMiddle | |
| MiddleTop | |
| BottomRight | |
| MiddleRight | |
| TopRight | |
| HotSpotCount |
Definition at line 209 of file computed_string.h.
| NL3D::CComputedString::CComputedString | ( | bool | bSetupVB = true |
) | [inline] |
Default constructor.
Definition at line 227 of file computed_string.h.
References NL3D::CVertexBuffer::PositionFlag, NL3D::CVertexBuffer::RAMVolatile, SelectSize, SelectStart, NL3D::CVertexBuffer::setName(), NL3D::CVertexBuffer::setPreferredMemory(), NL3D::CVertexBuffer::setVertexFormat(), StringHeight, StringWidth, NL3D::CVertexBuffer::TexCoord0Flag, and Vertices.
Get the string's origin.
| 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.
| 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 | |||
| ) |
Special for interface.
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 Additionnaly, this method doesn't render directly to the driver but add primitives to a CRenderStringBuffer Use the method CRenderStringBuffer::flush() to flush it all.
Definition at line 180 of file computed_string.cpp.
References CHECK_VBA_RANGE, Color, NL3D::CLetterColors::empty(), NL3D::CLetterColors::getColor(), NL3D::CVertexBuffer::getColorOff(), NL3D::CLetterColors::getIndex(), NL3D::CVertexBuffer::getNumVertices(), NL3D::CVertexBuffer::getTexCoordOff(), NL3D::IDriver::getVertexColorFormat(), NL3D::CVertexBufferReadWrite::getVertexCoordPointer(), NL3D::CVertexBuffer::getVertexSize(), NL3D::IDriver::getWindowSize(), LetterColors, NL3D::CVertexBuffer::lock(), min, NLMISC::CRGBA::modulateFromColor(), NL3D::CRenderStringBuffer::NumQuads, SelectSize, SelectStart, NL3D::CVertexBuffer::setNumVertices(), NL3D::CVertexBuffer::setVertexColorFormat(), NL3D::CLetterColors::size(), NL3D::CVertexBuffer::TRGBA, NLMISC::CUV::U, NLMISC::CUV::V, NL3D::CRenderStringBuffer::Vertices, Vertices, NLMISC::CVector::x, XMax, XMin, NLMISC::CVector::z, ZMax, and ZMin.
| 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 | |||
| ) |
Special for interface.
same as render2DClip but unproject the vertices using a frustum and a scale matrix Use the method CRenderStringBuffer::flush() to flush it all.
Definition at line 437 of file computed_string.cpp.
References CHECK_VBA_RANGE, Color, NL3D::CVertexBuffer::getColorOff(), NL3D::CVertexBuffer::getNumVertices(), NL3D::CVertexBuffer::getTexCoordOff(), NL3D::IDriver::getVertexColorFormat(), NL3D::CVertexBufferReadWrite::getVertexCoordPointer(), NL3D::CVertexBuffer::getVertexSize(), NL3D::IDriver::getWindowSize(), NL3D::CVertexBuffer::lock(), min, NL3D::CRenderStringBuffer::NumQuads, SelectSize, SelectStart, NL3D::CVertexBuffer::setNumVertices(), NL3D::CVertexBuffer::setVertexColorFormat(), NL3D::CVertexBuffer::TRGBA, NLMISC::CUV::U, NL3D::CFrustum::unProjectZ(), NLMISC::CUV::V, NL3D::CRenderStringBuffer::Vertices, Vertices, NLMISC::CVector::x, XMax, XMin, NLMISC::CVector::y, NLMISC::CVector::z, ZMax, and ZMin.
| 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.
| 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().
Definition at line 183 of file computed_string.h.
Referenced by NL3D::CFontManager::computeString(), NL3D::CFontManager::computeStringInfo(), NL3D::CTextContext::printAt(), NL3D::CTextContext::printfAt(), render2D(), render2DClip(), render2DUnProjected(), render3D(), and NL3D::CTextContextUser::setStringColor().
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().
Definition at line 200 of file computed_string.h.
Referenced by CComputedString(), render2D(), render2DClip(), render2DUnProjected(), render3D(), NL3D::CTextContextUser::resetStringSelection(), and NL3D::CTextContextUser::setStringSelection().
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().
The height of the string, in pixels (eg: 10).
Definition at line 187 of file computed_string.h.
Referenced by CComputedString(), NL3D::CFontManager::computeString(), NL3D::CFontManager::computeStringInfo(), getHotSpotVector(), and NL3D::CTextContextUser::getStringInfo().
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 width of the string, in pixels (eg: 30).
Definition at line 185 of file computed_string.h.
Referenced by CComputedString(), NL3D::CFontManager::computeString(), NL3D::CFontManager::computeStringInfo(), getHotSpotVector(), and NL3D::CTextContextUser::getStringInfo().
Definition at line 181 of file computed_string.h.
Referenced by CComputedString(), NL3D::CFontManager::computeString(), render2D(), render2DClip(), render2DUnProjected(), and render3D().
Definition at line 189 of file computed_string.h.
Referenced by NL3D::CFontManager::computeString(), render2DClip(), and render2DUnProjected().
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().
Definition at line 189 of file computed_string.h.
Referenced by NL3D::CFontManager::computeString(), render2DClip(), and render2DUnProjected().
Definition at line 189 of file computed_string.h.
Referenced by NL3D::CFontManager::computeString(), render2DClip(), and render2DUnProjected().
1.6.1