本文整理汇总了C++中MFMatrix::LookAt方法的典型用法代码示例。如果您正苦于以下问题:C++ MFMatrix::LookAt方法的具体用法?C++ MFMatrix::LookAt怎么用?C++ MFMatrix::LookAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFMatrix
的用法示例。
在下文中一共展示了MFMatrix::LookAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void EditorScreen::Draw()
{
GHScreen::DrawScreens();
MFRenderer_ClearScreen(MFRCF_Depth);
MFMatrix mat;
mat.LookAt(MakeVector(2.0,1.5,-1.0), MakeVector(1.0,0.3f,1.0f));
MFView_SetCameraMatrix(mat);
// pScene->Draw();
}
示例2: Draw
void Fretboard::Draw(float time, dBChart *pSong, int track)
{
MFCALLSTACKc;
MFView_Push();
MFRect rect;
MFView_GetViewport(&rect);
float aspect = rect.width / rect.height;
aspect = MFClamp(0.82f, aspect, 2.0f);
MFView_SetAspectRatio(aspect);
if(viewPoint == 0)
{
// incoming
MFView_ConfigureProjection(MFDEGREES(65.0f)/aspect, 1.0f, 100.0f);
// Setup the Camera in 3D space.
MFMatrix cameraMatrix;
MFVector start = MakeVector( 0, 8, 3 );
MFVector dir = MakeVector( 0, 5, -8 );
dir = (dir-start) * (1.0f/1.777777777f);
cameraMatrix.LookAt(start + dir*aspect, MakeVector(0.0f, 0.0f, 5.0f));
MFView_SetCameraMatrix(cameraMatrix);
}
else if(viewPoint == 1)
{
// overhead
MFView_ConfigureProjection(MFDEGREES(45.0f), 1.0f, 100.0f);
/*
float aspect = MFDisplay_GetNativeAspectRatio();
MFView_SetAspectRatio(aspect);
MFRect projRect;
projRect.y = 15;
projRect.height = -30;
projRect.x = -projRect.y * aspect;
projRect.width = -projRect.height * aspect;
MFView_SetOrtho(&projRect);
*/
// Setup the Camera in 3D space.
MFMatrix cameraMatrix;
cameraMatrix.LookAt(MakeVector(0, 30, 10), MakeVector(0, 0, 10), MakeVector(0, 0, 1));
MFView_SetCameraMatrix(cameraMatrix);
}
else if(viewPoint == 2)
{
// overhead
MFView_ConfigureProjection(MFDEGREES(45.0f), 1.0f, 100.0f);
/*
float aspect = MFDisplay_GetNativeAspectRatio();
MFView_SetAspectRatio(aspect);
MFRect projRect;
projRect.y = 15;
projRect.height = -30;
projRect.x = -projRect.y * aspect;
projRect.width = -projRect.height * aspect;
MFView_SetOrtho(&projRect);
*/
// Setup the Camera in 3D space.
MFMatrix cameraMatrix;
cameraMatrix.LookAt(MakeVector(0, 20, 13), MakeVector(0, 0, 13), MakeVector(-1, 0, 0));
MFView_SetCameraMatrix(cameraMatrix);
}
MFView_SetProjection();
MFMaterial *pFB = pSong->pFretboard ? pSong->pFretboard : pFretboard;
MFMaterial_SetMaterial(pFB);
MFPrimitive(PT_TriStrip, 0);
int start = -4;
int end = 60;
int fadeStart = end - 10;
float fretboardRepeat = 15.0f;
float fretboardWidth = 7.0f;
float columnWidth = fretboardWidth / 5.0f;
float ringBorder = 0.1f;
// draw the fretboard...
MFBegin(((end-start) / 4) * 2 + 2);
MFSetColourV(MFVector::white);
float halfFB = fretboardWidth*0.5f;
float offset = time*scrollSpeed;
float topTime = time + end/scrollSpeed;
float bottomTime = time + start/scrollSpeed;
int a;
float textureOffset = fmodf(offset, fretboardRepeat);
for(a=start; a<end; a+=4)
{
float z = (float)a;
//.........这里部分代码省略.........