3dPageDisk.cpp
资源名称:gloop.zip [点击查看]
上传用户:shxiangxiu
上传日期:2007-01-03
资源大小:1101k
文件大小:4k
源码类别:
OpenGL
开发平台:
Visual C++
- /////////////////////////////////////////////////////////////////////////////
- // 3dPageDisk.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
- //////////////////////////////////////////////////////////////////
- // C3dObjectTorus
- IMPLEMENT_DYNCREATE(C3dPageDisk, CPropertyPage)
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageDisk dialog construction
- C3dPageDisk::C3dPageDisk()
- : CPropertyPage(C3dPageDisk::IDD)
- {
- m_bInitVertices = FALSE;
- //{{AFX_DATA_INIT(C3dPageDisk)
- m_fInnerRadius = 0.0f;
- m_fOuterRadius = 0.0f;
- m_iSegments = 0;
- m_szName = _T("");
- m_fSweepAngle = 0.0f;
- //}}AFX_DATA_INIT
- }
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageDisk Destructor
- C3dPageDisk::~C3dPageDisk()
- {
- }
- void C3dPageDisk::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(C3dPageDisk)
- DDX_Text(pDX, IDC_INNER_RADIUS, m_fInnerRadius);
- DDX_Text(pDX, IDC_OUTER_RADIUS, m_fOuterRadius);
- DDX_Text(pDX, IDC_SEGMENTS, m_iSegments);
- DDX_Text(pDX, IDC_NAME, m_szName);
- DDV_MaxChars(pDX, m_szName, 40);
- DDX_Text(pDX, IDC_SWEEP_ANGLE, m_fSweepAngle);
- DDV_MinMaxFloat(pDX, m_fSweepAngle, 1.f, 360.f);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(C3dPageDisk, CPropertyPage)
- //{{AFX_MSG_MAP(C3dPageDisk)
- ON_EN_CHANGE(IDC_INNER_RADIUS, OnChangeInnerRadius)
- ON_EN_CHANGE(IDC_OUTER_RADIUS, OnChangeOuterRadius)
- ON_EN_CHANGE(IDC_SEGMENTS, OnChangeSegments)
- ON_EN_CHANGE(IDC_SWEEP_ANGLE, OnChangeSweepAngle)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageDisk message handlers
- BOOL C3dPageDisk::OnInitDialog()
- {
- // Set our local values to the Objects' values
- m_szName = m_pObject->m_szName;
- m_fInnerRadius = m_pObject->m_fInnerRadius;
- m_fOuterRadius = m_pObject->m_fOuterRadius;
- m_iSegments = m_pObject->m_iSegments;
- m_fSweepAngle = m_pObject->m_fSweepAngle;
- 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 C3dPageDisk::OnOK()
- {
- // Dialog box is being initialized (FALSE)
- // or data is being retrieved (TRUE).
- UpdateData(TRUE);
- // Set our Objects' values to the local values
- m_pObject->m_szName = m_szName;
- m_pObject->m_fInnerRadius = m_fInnerRadius;
- m_pObject->m_fOuterRadius = m_fOuterRadius;
- m_pObject->m_iSegments = m_iSegments;
- m_pObject->m_fSweepAngle = m_fSweepAngle;
- // Force the object to rebuild its' display list
- m_pObject->m_bBuildLists = TRUE;
- // Rebuild our objects vertices?
- if(m_bInitVertices)
- m_pObject->InitVertices();
- CPropertyPage::OnOK();
- }
- void C3dPageDisk::OnChangeInnerRadius()
- {
- // User has modified the disks inner radius, so set our vertice
- // initialization flag
- m_bInitVertices = TRUE;
- }
- void C3dPageDisk::OnChangeOuterRadius()
- {
- // User has modified the disks outer radius, so set our vertice
- // initialization flag
- m_bInitVertices = TRUE;
- }
- void C3dPageDisk::OnChangeSegments()
- {
- // User has modified the number of disk segments, so set our vertice
- // initialization flag
- m_bInitVertices = TRUE;
- }
- void C3dPageDisk::OnChangeSweepAngle()
- {
- // User has modified the number of disk segments, so set our vertice
- // initialization flag
- m_bInitVertices = TRUE;
- }