本文整理汇总了C++中CList::GoToFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ CList::GoToFirst方法的具体用法?C++ CList::GoToFirst怎么用?C++ CList::GoToFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::GoToFirst方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SortByDepth
void CWorld::SortByDepth(CDesktop* desktop)
{
int i, degree = objectList.GetDegree();
if(!degree) return;
CComponent3D* object;
double m[16];
double* depthList;
CVirtualWebCam* vWebCam;
depthList = new double[degree];
int* idList = new int[degree];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if(CARDeskTop::mode == CARDeskTop::kAR) {
arglCameraViewRH(desktop->trans, m, VIEW_SCALEFACTOR);
glLoadMatrixd(m);
glMultMatrixd(matrix);
} else if(CARDeskTop::mode == CARDeskTop::kVR) {
glLoadMatrixd(matrix);
vWebCam = (CVirtualWebCam*) CARDeskTop::arDeskTop->window->webCamList[0];
}
objectList.GoToFirst();
for(i = 0; i < degree; i++) {
object = (CComponent3D*) objectList.GetKey();
idList[i] = object->GetID();
glPushMatrix();
glMultMatrixd(object->matrix);
glGetDoublev(GL_MODELVIEW_MATRIX, m);
if(CARDeskTop::mode == CARDeskTop::kAR) {
depthList[i] = m[12] * m[12] + m[13] * m[13] + m[14] * m[14];
} else if(CARDeskTop::mode == CARDeskTop::kVR) {
depthList[i] = -(vWebCam->newPos[0] * m[12] + vWebCam->newPos[1] * m[13] + vWebCam->newPos[2] * m[14]);
// depthList[i] = -m[14];
}
glPopMatrix();
objectList.GoToNext();
}
glPopMatrix();
BubbleSortd(depthList, idList, degree);
CList list;
int j, degree2;
objectList.MoveAllLinkTo(&list);
for(i = 0; i < degree; i++) {
list.GoToFirst();
degree2 = list.GetDegree();
for(j = 0; j < degree2; j++) {
object = (CComponent3D*) list.GetKey();
if(idList[i] == object->GetID()) {
objectList.Push(list.Remove(object));
break;
}
list.GoToNext();
}
}
delete depthList;
delete idList;
}