本文整理汇总了C++中MyMatrix::SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMatrix::SetPosition方法的具体用法?C++ MyMatrix::SetPosition怎么用?C++ MyMatrix::SetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMatrix
的用法示例。
在下文中一共展示了MyMatrix::SetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateString
//.........这里部分代码省略.........
bool moretexttocome = true;
const char* stringpos = stringtodraw;
while( moretexttocome )
{
numlines++;
char singlelinebuffer[300];
singlelinebuffer[0] = 0;
char* singlelinebufferpos = singlelinebuffer;
// word wrap if width of text is not 0.
if( size.x != 0 )
{
float linewidth = -1;// = GetStringSize( fontheight, Vector2(0,0), singlelinebuffer ).x;
while( linewidth < size.x &&
*stringpos != 0 )
{
*singlelinebufferpos = *stringpos;
singlelinebufferpos++;
*singlelinebufferpos = 0;
stringpos++;
linewidth = GetStringSize( fontheight, Vector2(0,0), singlelinebuffer ).x;
assert( singlelinebufferpos < singlelinebuffer + 300 );
}
int numcharswewentback = 0;
while( ( *(singlelinebufferpos-1) != ' ' && *stringpos != 0 ) &&
singlelinebufferpos > singlelinebuffer )
{
singlelinebufferpos--;
numcharswewentback++;
}
if( singlelinebufferpos != singlelinebuffer )
{
*singlelinebufferpos = 0;
stringpos -= numcharswewentback;
}
if( *stringpos == 0 )
moretexttocome = false;
stringtodraw = singlelinebuffer;
}
else
{
moretexttocome = false;
}
//// don't bother drawing if fontheight is zero... still doing logic above so the currect number of lines will be returned.
//if( g_pRTQGlobals->m_WordWrapCountLinesOnly )
// continue;
Vertex_XYZUV_RGBA* pVertsToDraw = (Vertex_XYZUV_RGBA*)GetVerts( true );
int newverts = (int)strlen( stringtodraw ) * 4;
#if _DEBUG
m_MostLettersAttemptedToDrawThisFrame += newverts/4;
if( m_MostLettersAttemptedToDrawThisFrame > m_MostLettersAttemptedToDrawEver )
m_MostLettersAttemptedToDrawEver = m_MostLettersAttemptedToDrawThisFrame;
#endif
if( m_NumVertsToDraw + newverts > GetNumVerts() )
{
#if _DEBUG
LOGInfo( LOGTag, "TextMesh buffer isn't big enough for string (%s) - %d of %d letters used - most letters needed (%d)\n", stringtodraw, m_NumVertsToDraw/4, GetNumVerts()/4, m_MostLettersAttemptedToDrawEver );
#endif
//assert( false ); // drawing more than we have room for.
return 0;
}
pVertsToDraw += m_NumVertsToDraw;
unsigned int textstrlen = m_pFont->m_pFont->GenerateVerts( stringtodraw, true, pVertsToDraw, fontheight, GL_TRIANGLES, justificationflags, color );
m_NumVertsToDraw += (unsigned short)(textstrlen * 4);
m_NumIndicesToDraw += textstrlen * 6;
MyMatrix position;
position.SetIdentity();
position.Rotate( rotz, 0, 0, 1 );
position.SetPosition( x, y - (numlines-1)*fontheight, z );
//position.SetPosition( x, y - (numlines-1)*g_pRTQGlobals->m_WordWrapLineIncSize, z );
//position.SetPosition( x, y, z );
for( unsigned int i=0; i<textstrlen*4; i++ )
{
Vector3 out = position.TransformVector3( *(Vector3*)&pVertsToDraw[i].x );
pVertsToDraw[i].x = out.x;
pVertsToDraw[i].y = out.y;
pVertsToDraw[i].z = out.z;
}
}
return numlines;
}