DirectXDialog.cpp
资源名称:estereo2.zip [点击查看]
上传用户:fengshi120
上传日期:2014-07-17
资源大小:6155k
文件大小:2k
源码类别:
3D图形编程
开发平台:
C/C++
- // DirectXDialog.cpp : implementation file
- //
- #include "stdafx.h"
- #include "StereoPlus.h"
- #include "DirectXDialog.h"
- #include "3DWindow.h"
- #include ".directxdialog.h"
- // CDirectXDialog dialog
- IMPLEMENT_DYNAMIC(CDirectXDialog, CDialog)
- CDirectXDialog::CDirectXDialog(CWnd* pParent /*=NULL*/)
- : CDialog(CDirectXDialog::IDD, pParent)
- {
- m_pX = NULL;
- m_pY = NULL;
- m_pZ = NULL;
- m_pX = NULL;
- m_pC = NULL;
- m_nPoints = 0;
- }
- CDirectXDialog::~CDirectXDialog()
- {
- // dealloc Color
- if (m_pC) delete[] m_pC;
- }
- void CDirectXDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- }
- BEGIN_MESSAGE_MAP(CDirectXDialog, CDialog)
- END_MESSAGE_MAP()
- void CDirectXDialog::SetData(int nPoints,float* pX,float* pY,float* pZ,
- unsigned char* pC,float* pS)
- {
- m_pX = pX;
- m_pY = pY;
- m_pZ = pZ;
- m_pS = pS;
- m_nPoints = nPoints;
- // convert *uchar to *Color
- if (m_pC) delete[] m_pC;
- m_pC = new Color[nPoints];
- for (int i=0; i<nPoints; ++i, pC+=4) {
- m_pC[i] = Color::MakeARGB(255,*pC,*(pC+1),*(pC+2));
- }
- }
- // CDirectXDialog message handlers
- BOOL CDirectXDialog::OnInitDialog()
- {
- CDialog::OnInitDialog();
- CWnd* pParent = GetParent();
- CRect rcParent;
- pParent->GetWindowRect(&rcParent);
- MoveWindow(&rcParent);
- C3DWindow* p3DWindow = (C3DWindow*)GetDlgItem(IDC_3D_CONTROL);
- if(p3DWindow)
- {
- CRect rcControl;
- GetClientRect(&rcControl);
- rcControl.DeflateRect(10,10,10,10);
- p3DWindow->MoveWindow(&rcControl);
- p3DWindow->SetRegistryKey("3D Reconstruction");//arcball params should be kept separate
- p3DWindow->Start(false);
- p3DWindow->CreateVB(m_nPoints,m_pX,m_pY,m_pZ,m_pC,m_pS);
- }
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }