本文整理汇总了C++中MFMatrix::Translate方法的典型用法代码示例。如果您正苦于以下问题:C++ MFMatrix::Translate方法的具体用法?C++ MFMatrix::Translate怎么用?C++ MFMatrix::Translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFMatrix
的用法示例。
在下文中一共展示了MFMatrix::Translate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Game_Draw
void Game_Draw()
{
MFCALLSTACK;
MFRenderer_SetClearColour(0.f, 0.f, 0.2f, 1.f);
MFRenderer_ClearScreen();
// Set identity camera (no camera)
MFView_Push();
MFView_SetAspectRatio(MFDisplay_GetNativeAspectRatio());
MFView_SetProjection();
MFMaterial_SetMaterial(MFMaterial_GetStockMaterial(MFMat_White));
// set the world matrix to identity
MFMatrix world = MFMatrix::identity;
// move the box into the scene (along the z axis)
world.Translate(MakeVector(0, 0, 5));
// increment rotation
static float rotation = 0.0f;
rotation += MFSystem_TimeDelta();
// rotate the box
world.RotateYPR(rotation, rotation * 2.0f, rotation * 0.5f);
// begin rendering the box
MFPrimitive(PT_TriList);
MFSetMatrix(world);
// begin rendering 12 triangles (12 * 3 vertices)
MFBegin(3 * 12);
// draw a bunch of triangles
MFSetColour(1,0,0,1);
MFSetPosition(-1,-1, -1);
MFSetPosition(-1, 1, -1);
MFSetPosition( 1, 1, -1);
MFSetPosition(-1,-1, -1);
MFSetPosition( 1, 1, -1);
MFSetPosition( 1,-1, -1);
MFSetColour(0,1,0,1);
MFSetPosition(-1,-1,1);
MFSetPosition( 1,-1,1);
MFSetPosition( 1, 1,1);
MFSetPosition(-1,-1,1);
MFSetPosition( 1, 1,1);
MFSetPosition(-1, 1,1);
MFSetColour(0,0,1,1);
MFSetPosition( 1,-1,1);
MFSetPosition( 1,-1,-1);
MFSetPosition( 1, 1,-1);
MFSetPosition( 1,-1,1);
MFSetPosition( 1, 1,-1);
MFSetPosition( 1, 1,1);
MFSetColour(1,0,1,1);
MFSetPosition(-1,-1,1);
MFSetPosition(-1, 1,1);
MFSetPosition(-1, 1,-1);
MFSetPosition(-1,-1,1);
MFSetPosition(-1, 1,-1);
MFSetPosition(-1,-1,-1);
MFSetColour(1,1,0,1);
MFSetPosition(-1, 1,1);
MFSetPosition( 1, 1,1);
MFSetPosition( 1, 1,-1);
MFSetPosition(-1, 1,1);
MFSetPosition( 1, 1,-1);
MFSetPosition(-1, 1,-1);
MFSetColour(0,1,1,1);
MFSetPosition(-1,-1,1);
MFSetPosition(-1,-1,-1);
MFSetPosition( 1,-1,-1);
MFSetPosition(-1,-1,1);
MFSetPosition( 1,-1,-1);
MFSetPosition( 1,-1,1);
MFEnd();
MFRect disp;
MFDisplay_GetDisplayRect(&disp);
MFView_SetOrtho(&disp);
pUI->Draw();
MFView_Pop();
}
示例2: Draw
//.........这里部分代码省略.........
// TODO: we could consider not drawing this part of the hold line.. seems reasonable that it terminates at the line...
if(gEditor.state == GHPS_Stopped)
{
if(position < 0.0f)
{
MFBegin(4);
MFSetColourV(gColours[key]);
MFSetPosition(xoffset - 0.2f, 0.0f, MFMin(whammyTop, 0.0f));
MFSetPosition(xoffset + 0.2f, 0.0f, MFMin(whammyTop, 0.0f));
MFSetPosition(xoffset - 0.2f, 0.0f, position);
MFSetPosition(xoffset + 0.2f, 0.0f, position);
MFEnd();
}
}
if(whammyTop > 0.0f)
{
// this half could have waves cruising down it if we wanted to support the whammy...
MFBegin(4);
MFSetColourV(gColours[key]);
MFSetPosition(xoffset - 0.2f, 0.0f, MFMin(whammyTop, (float)end));
MFSetPosition(xoffset + 0.2f, 0.0f, MFMin(whammyTop, (float)end));
MFSetPosition(xoffset - 0.2f, 0.0f, MFMax(position, 0.0f));
MFSetPosition(xoffset + 0.2f, 0.0f, MFMax(position, 0.0f));
MFEnd();
}
}
if(evTime >= bottomTime)
{
MFMatrix mat;
mat.SetScale(MakeVector(0.5f/20, 0.5f/20, 0.5f/20));
mat.Translate(MakeVector(xoffset, 0.03f, position));
MFModel_SetWorldMatrix(pButton, mat);
MFStateBlock *pSB = MFStateBlock_CreateTemporary(64);
MFStateBlock_SetVector(pSB, MFSCV_DiffuseColour, pEv->played == -1 ? MakeVector(0.3f, 0.3f, 0.3f, 1.0f) : MFVector::white);
// MFStateBlock_SetVector(pSB, MFSCV_DiffuseColour, position < 0.0f ? MakeVector(0.3f, 0.3f, 0.3f, 1.0f) : MFVector::white);
// MFRenderer_SetRenderStateOverride(MFRS_MaterialOverride, (uint32&)(tap ? pButtonMat[key] : pButtonRing[key]));
MFRenderer_AddModel(pButton, pSB, MFView_GetViewState());
// render the note time
if(bRenderNoteTimes)
{
MFView_Push();
MFView_SetOrtho(&rect);
MFVector pos;
MFView_TransformPoint3DTo2D(MakeVector(xoffset, 0.0f, position), &pos);
pos.x += 16.0f;
pos.y -= 26.0f;
int minutes = (int)(pEv->time / 60000000);
int seconds = (int)((pEv->time % 60000000) / 1000000);
int milliseconds = (int)((pEv->time % 1000000) / 1000);
MFFont_DrawTextf(pText, pos, 20.0f, MFVector::yellow, "%s: %d:%02d.%d\nTick: %g", MFTranslation_GetString(pStrings, TRACK_TIME), minutes, seconds, milliseconds, (float)pEv->tick/res);
MFView_Pop();
}
}
}
if(pEv->event == GHE_Special)
{