3dPageOrigin.cpp
资源名称:gloop.zip [点击查看]
上传用户:shxiangxiu
上传日期:2007-01-03
资源大小:1101k
文件大小:3k
源码类别:
OpenGL
开发平台:
Visual C++
- /////////////////////////////////////////////////////////////////////////////
- // 3dPageOrigin.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"
- #include "3dObjectDialog.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
- //////////////////////////////////////////////////////////////////
- // C3dObjectOrigin
- IMPLEMENT_DYNCREATE(C3dPageOrigin, CPropertyPage)
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageOrigin dialog construction
- C3dPageOrigin::C3dPageOrigin()
- : CPropertyPage(C3dPageOrigin::IDD)
- {
- m_pObject = NULL;
- m_pCamera = NULL;
- //{{AFX_DATA_INIT(C3dPageOrigin)
- m_fOriginX = 0.0f;
- m_fOriginY = 0.0f;
- m_fOriginZ = 0.0f;
- //}}AFX_DATA_INIT
- }
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageOrigin Destructor
- C3dPageOrigin::~C3dPageOrigin()
- {
- }
- void C3dPageOrigin::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(C3dPageOrigin)
- DDX_Text(pDX, IDC_X_AXIS, m_fOriginX);
- DDX_Text(pDX, IDC_Y_AXIS, m_fOriginY);
- DDX_Text(pDX, IDC_Z_AXIS, m_fOriginZ);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(C3dPageOrigin, CPropertyPage)
- //{{AFX_MSG_MAP(C3dPageOrigin)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageOrigin message handlers
- BOOL C3dPageOrigin::OnInitDialog()
- {
- if(m_pObject)
- {
- // Set our local values to the Objects' values
- m_fOriginX = m_pObject->m_fOrigin[0];
- m_fOriginY = m_pObject->m_fOrigin[1];
- m_fOriginZ = m_pObject->m_fOrigin[2];
- }
- else if(m_pCamera)
- {
- // Set our local values to the Cameras' values
- m_fOriginX = m_pCamera->m_fOrigin[0];
- m_fOriginY = m_pCamera->m_fOrigin[1];
- m_fOriginZ = m_pCamera->m_fOrigin[2];
- }
- CPropertyPage::OnInitDialog(); // let the base class do the default work
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void C3dPageOrigin::OnOK()
- {
- // Dialog box is being initialized (FALSE)
- // or data is being retrieved (TRUE).
- UpdateData(TRUE);
- if(m_pObject)
- {
- // Set the Objects Origin..
- m_pObject->m_fOrigin[0] = m_fOriginX;
- m_pObject->m_fOrigin[1] = m_fOriginY;
- m_pObject->m_fOrigin[2] = m_fOriginZ;
- // Force the object to rebuild its' display list
- m_pObject->m_bBuildLists = TRUE;
- }
- else if(m_pCamera)
- {
- // Set the Cameras Origin..
- m_pCamera->m_fOrigin[0] = m_fOriginX;
- m_pCamera->m_fOrigin[1] = m_fOriginY;
- m_pCamera->m_fOrigin[2] = m_fOriginZ;
- // Force the camera to rebuild its' display list
- m_pCamera->m_bBuildLists = TRUE;
- }
- CPropertyPage::OnOK();
- }