3dObjectList.cpp
资源名称:gloop.zip [点击查看]
上传用户:shxiangxiu
上传日期:2007-01-03
资源大小:1101k
文件大小:3k
源码类别:
OpenGL
开发平台:
Visual C++
- /////////////////////////////////////////////////////////////////////////////
- // C3dObjectList.cpp : implementation file
- //
- // glOOP (OpenGL Object Oriented Programming library)
- // Copyright (c) Craig Fahrnbach 1997, 1998
- //
- // OpenGL is a registered trademark of Silicon Graphics
- //
- //
- // This program is provided for educational and personal use only and
- // is provided without guarantee or warrantee expressed or implied.
- //
- // Commercial use is strickly prohibited without written permission
- // from ImageWare Development.
- //
- // This program is -not- in the public domain.
- //
- /////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "glOOP.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- //////////////////////////////////////////////////////////////////
- // CC3dObjectList
- //IMPLEMENT_DYNAMIC(C3dObjectList, CObList)
- /////////////////////////////////////////////////////////////////////////////
- // C3dObjectList construction
- C3dObjectList::C3dObjectList()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
- /////////////////////////////////////////////////////////////////////////////
- // C3dObjectList Destructor
- C3dObjectList::~C3dObjectList()
- {
- DeleteAll();
- }
- /////////////////////////////////////////////////////////////////////////////
- // C3dObjectList function implimentation
- void C3dObjectList::Append(C3dObject* pObject)
- {
- if (!pObject) return;
- CObList::AddTail(pObject);
- }
- void C3dObjectList::Remove(C3dObject* pObject)
- {
- if (!pObject) return;
- POSITION pos = CObList::Find(pObject);
- if (pos) {
- RemoveAt(pos);
- }
- }
- void C3dObjectList::Delete(C3dObject* pObject)
- {
- if (!pObject) return;
- Remove(pObject);
- delete pObject;
- }
- void C3dObjectList::DeleteAll()
- {
- while (!IsEmpty()) {
- C3dObject* pObject = (C3dObject*) RemoveHead();
- delete pObject;
- }
- }
- #if 0 // not used
- // See if the list contains a shape with the same frame and
- // visual attachments
- C3dObject* C3dObjectList::Find(C3dObject* pObject)
- {
- if (!pObject) return NULL;
- IDirect3DRMFrame* pIFrame = pObject->GetInterface();
- IDirect3DRMVisual* pIVisual = pObject->GetVisual();
- C3dObject* pListEntry = NULL;
- // walk the list
- POSITION pos = GetHeadPosition();
- while (pos) {
- pListEntry = GetNext(pos);
- if ((pListEntry->GetInterface() == pIFrame)
- && (pListEntry->GetVisual() == pIVisual)) {
- return pListEntry;
- }
- }
- return NULL; // end of list
- }
- #endif