Overview
The C3DPortal
class is a CStatic
derived class that I wrote to allow a programmer to drop it into a project and have the ability to load and display 3D objects using Direct3D Retained Mode. I also started toying with manual construction of an object as illustrated in the Test()
function. Just be aware if you want to try this function out, that you must first load a valid object. I could have worked on it and enhanced it, etc, but I'm moving onto Immediate Mode stuff and don't want to get any more involved in RM.
Public Methods
The functions typically used by the host application are documented below.
void BrowseForTexture()
Prompts user to browse for a bitmap for use as a texture (which will subsequently be applied to the loaded object)
bool LoadMesh(LPTSTR lpszMeshName= "")
If lpszMeshName is empty, then the user will be prompted to browse for a X file to be displayed in the control. returns true if load was successful.
void SetColourBackground(COLORREF cr)
Sets the background colour according to the COLORREF parameter supplied.
Example use of C3DPortal
In your header file:
#include "3DPortal.h"
...
class CPortalDemoDlg : public CDialog
{
public:
C3DPortal m_stcPortal;
...
In your implementation file:
BOOL CPortalDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_stcPortal.Create("", WS_VISIBLE|SS_NOTIFY|SS_SUNKEN,
C3DPortal::GetRect(IDC_STATIC_PORTAL, this),(CWnd*)this);
m_stcPortal.LoadMesh();
return TRUE;
}