本文整理汇总了C++中SVector3::getNormalized方法的典型用法代码示例。如果您正苦于以下问题:C++ SVector3::getNormalized方法的具体用法?C++ SVector3::getNormalized怎么用?C++ SVector3::getNormalized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVector3
的用法示例。
在下文中一共展示了SVector3::getNormalized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: perform
//.........这里部分代码省略.........
if( hasSelected ) {
SVector3 selPos = selEntity->mWorldMat.getOrigin();
if( !gAppSettings.followMode ) {
selPos.y = VIEWER_Y;
SVector3 newPos = smoothCD( gViewer.getOrigin(), selPos, gViewerVel, 0.25f, dt );
gTryPositionViewer( newPos, selPos );
} else {
//SVector3 selPrevPos = selEntity.samplePos( gi.getTime() - 10.0f );
// TBD
SVector3 selPrevPos = selPos;
selPrevPos.y = (selPrevPos.y + VIEWER_Y)*0.5f;
selPos.y = selPrevPos.y;
SVector3 dirZ = selPos - selPrevPos;
dirZ.y = 0.0f;
const float MIN_DIST = 2.0f;
if( dirZ.lengthSq() < MIN_DIST*MIN_DIST ) {
dirZ = gViewer.getAxisZ();
selPrevPos = selPrevPos - dirZ * MIN_DIST;
}
const float PREF_DIST = 5.0f;
if( dirZ.lengthSq() < PREF_DIST*PREF_DIST ) {
dirZ.normalize();
selPrevPos = selPos - dirZ * PREF_DIST;
} else {
dirZ.normalize();
}
const float SMOOTHT = 0.5f;
SVector3 newPos = smoothCD( gViewer.getOrigin(), selPrevPos, gViewerVel, SMOOTHT, dt );
gTryPositionViewer( newPos, selPrevPos );
dirZ = smoothCD( gViewer.getAxisZ(), dirZ, gViewerZVel, SMOOTHT, dt );
if( dirZ.lengthSq() < 0.5f ) {
dirZ = gViewer.getAxisZ();
} else {
gViewer.getAxisZ() = dirZ.getNormalized();
}
gViewer.getAxisY().set(0,1,0);
gViewer.getAxisX() = gViewer.getAxisY().cross( gViewer.getAxisZ() );
}
} else {
gViewerVel.set(0,0,0);
gViewerZVel.set(0,0,0);
}
//
// check if current viewer's position is valid
{
SVector3 testViewerPos = gViewer.getOrigin();
int cx = testViewerPos.x;
int cy = -testViewerPos.z;
if( cx >= 0 && cy >= 0 && cx < gmap.getCellsX() && cy < gmap.getCellsY() && gmap.isBlood( gmap.getCell(cx,cy).type ) ) {
gi.getLevelMesh().fitSphere( testViewerPos, VIEWER_R*2.0f );
const float SMALL_FIT = 0.2f;
if( SVector3(testViewerPos - gViewer.getOrigin()).lengthSq() < SMALL_FIT * SMALL_FIT ) {
gLastViewerValidPos = testViewerPos;
}
}
}
SMatrix4x4& mm = gCamera.mWorldMat;
mm = gViewer;
float camnear, camfar, camfov, fognear, fogfar;
if( !insideView ) {
float tilt = gAppSettings.megaTilt;
float zoom = gAppSettings.megaZoom;
if( gameSetupActive ) {