3dPageNURB.cpp
资源名称:gloop.zip [点击查看]
上传用户:shxiangxiu
上传日期:2007-01-03
资源大小:1101k
文件大小:6k
源码类别:
OpenGL
开发平台:
Visual C++
- /////////////////////////////////////////////////////////////////////////////
- // 3dPageNURB.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
- //////////////////////////////////////////////////////////////////
- // C3dPageNURB
- IMPLEMENT_DYNCREATE(C3dPageNURB, CPropertyPage)
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageNURB dialog construction
- C3dPageNURB::C3dPageNURB()
- : CPropertyPage(C3dPageNURB::IDD)
- {
- m_bInitVertices = FALSE;
- //{{AFX_DATA_INIT(C3dPageNURB)
- m_fDepth = 0.0f;
- m_fWidth = 0.0f;
- m_szName = _T("");
- m_iNumUCtrlPoints = 0;
- m_iNumVCtrlPoints = 0;
- m_iUSegments = 0;
- m_iVSegments = 0;
- //}}AFX_DATA_INIT
- }
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageNURB Destructor
- C3dPageNURB::~C3dPageNURB()
- {
- }
- void C3dPageNURB::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(C3dPageNURB)
- DDX_Text(pDX, IDC_DEPTH, m_fDepth);
- DDX_Text(pDX, IDC_WIDTH, m_fWidth);
- DDX_Text(pDX, IDC_NAME, m_szName);
- DDV_MaxChars(pDX, m_szName, 40);
- DDX_Text(pDX, IDC_GRID_POINTS_X, m_iNumUCtrlPoints);
- DDV_MinMaxInt(pDX, m_iNumUCtrlPoints, 3, 10000);
- DDX_Text(pDX, IDC_GRID_POINTS_Y, m_iNumVCtrlPoints);
- DDV_MinMaxInt(pDX, m_iNumVCtrlPoints, 3, 10000);
- DDX_Text(pDX, IDC_SEGMENTS_X, m_iUSegments);
- DDV_MinMaxInt(pDX, m_iUSegments, 3, 10000);
- DDX_Text(pDX, IDC_SEGMENTS_Y, m_iVSegments);
- DDV_MinMaxInt(pDX, m_iVSegments, 3, 10000);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(C3dPageNURB, CPropertyPage)
- //{{AFX_MSG_MAP(C3dPageNURB)
- ON_EN_CHANGE(IDC_DEPTH, OnChangeDepth)
- ON_EN_CHANGE(IDC_WIDTH, OnChangeWidth)
- ON_EN_CHANGE(IDC_GRID_POINTS_X, OnChangeGridPointsX)
- ON_EN_CHANGE(IDC_GRID_POINTS_Y, OnChangeGridPointsY)
- ON_EN_CHANGE(IDC_SEGMENTS_X, OnChangeSegmentsX)
- ON_EN_CHANGE(IDC_SEGMENTS_Y, OnChangeSegmentsY)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageNURB message handlers
- BOOL C3dPageNURB::OnInitDialog()
- {
- // Set our local values to the Objects' values
- m_szName = m_pObject->m_szName;
- m_fDepth = m_pObject->m_fDepth;
- m_fWidth = m_pObject->m_fWidth;
- m_iUSegments = m_pObject->m_iUSegments;
- m_iVSegments = m_pObject->m_iVSegments;
- m_iNumUCtrlPoints = m_pObject->m_iNumUCtrlPoints;
- m_iNumVCtrlPoints = m_pObject->m_iNumVCtrlPoints;
- 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
- }
- BOOL C3dPageNURB::OnApply()
- {
- // Dialog box is being initialized (FALSE)
- // or data is being retrieved (TRUE).
- UpdateData(TRUE);
- // Set the Objects member variables
- m_pObject->m_szName = m_szName;
- m_pObject->m_fDepth = m_fDepth;
- m_pObject->m_fWidth = m_fWidth;
- m_pObject->m_iUSegments = m_iUSegments;
- m_pObject->m_iVSegments = m_iVSegments;
- m_pObject->m_iNumUCtrlPoints = m_iNumUCtrlPoints;
- m_pObject->m_iNumVCtrlPoints = m_iNumVCtrlPoints;
- // Force the object to rebuild its' display list
- m_pObject->m_bBuildLists = TRUE;
- // Rebuild our objects vertices?
- if(m_bInitVertices)
- m_pObject->InitVertices();
- return CPropertyPage::OnApply();
- }
- void C3dPageNURB::OnOK()
- {
- // Call the OnApply function to set our objects data
- // members
- // OnApply();
- CPropertyPage::OnOK();
- }
- void C3dPageNURB::OnChangeDepth()
- {
- // User has modified the planes depth, so set our vertice
- // initialization flag
- m_bInitVertices = TRUE;
- // The property page settings have been modified, so
- // Enable (TRUE) or disable (FALSE) the Apply Now button
- SetModified(TRUE);
- }
- void C3dPageNURB::OnChangeWidth()
- {
- // User has modified the planes width depth, so set our vertice
- // initialization flag
- m_bInitVertices = TRUE;
- // The property page settings have been modified, so
- // Enable (TRUE) or disable (FALSE) the Apply Now button
- SetModified(TRUE);
- }
- void C3dPageNURB::OnChangeGridPointsX()
- {
- // User has modified the planes width depth, so set our vertice
- // initialization flag
- m_bInitVertices = TRUE;
- // The property page settings have been modified, so
- // Enable (TRUE) or disable (FALSE) the Apply Now button
- SetModified(TRUE);
- }
- void C3dPageNURB::OnChangeGridPointsY()
- {
- // User has modified the planes width depth, so set our vertice
- // initialization flag
- m_bInitVertices = TRUE;
- // The property page settings have been modified, so
- // Enable (TRUE) or disable (FALSE) the Apply Now button
- SetModified(TRUE);
- }
- void C3dPageNURB::OnChangeSegmentsX()
- {
- // The property page settings have been modified, so
- // Enable (TRUE) or disable (FALSE) the Apply Now button
- SetModified(TRUE);
- }
- void C3dPageNURB::OnChangeSegmentsY()
- {
- // The property page settings have been modified, so
- // Enable (TRUE) or disable (FALSE) the Apply Now button
- SetModified(TRUE);
- }