home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / direct3d / d3dwnd.cpp < prev    next >
C/C++ Source or Header  |  1998-03-26  |  3KB  |  75 lines

  1. // d3dwnd.cpp : implementation of CDirect3DWindow & CD3DMatrix
  2. //
  3. // This is a part of the Active Template Library.
  4. // Copyright (C) 1996-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Active Template Library Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Active Template Library product.
  12.  
  13. #include "stdafx.h"
  14. #include "d3dwnd.h"
  15.  
  16.  
  17. // Globals used for selecting the Direct3D device. They are
  18. // globals as it makes it easy for the enumeration callback
  19. // to read and write from them.
  20. BOOL          fDeviceFound              = FALSE;
  21. DWORD         dwDeviceBitDepth          = 0UL;
  22. GUID          guidDevice;
  23. char          szDeviceName[MAX_DEVICE_NAME];
  24. char          szDeviceDesc[MAX_DEVICE_DESC];
  25. D3DDEVICEDESC d3dHWDeviceDesc;
  26. D3DDEVICEDESC d3dSWDeviceDesc;
  27.  
  28. CDirect3DWindow::CDirect3DWindow() :
  29.     d3dWorldMatrix(
  30.         D3DVAL( 1.0), D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 0.0),
  31.         D3DVAL( 0.0), D3DVAL( 1.0), D3DVAL( 0.0), D3DVAL( 0.0),
  32.         D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 1.0), D3DVAL( 0.0),
  33.         D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 1.0)),
  34.     d3dViewMatrix(
  35.         D3DVAL( 1.0), D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 0.0),
  36.         D3DVAL( 0.0), D3DVAL( 1.0), D3DVAL( 0.0), D3DVAL( 0.0),
  37.         D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 1.0), D3DVAL( 0.0),
  38.         D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 5.0), D3DVAL( 1.0)),
  39.     d3dProjMatrix(
  40.         D3DVAL( 2.0), D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 0.0),
  41.         D3DVAL( 0.0), D3DVAL( 2.0), D3DVAL( 0.0), D3DVAL( 0.0),
  42.         D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL( 1.0), D3DVAL( 1.0),
  43.         D3DVAL( 0.0), D3DVAL( 0.0), D3DVAL(-1.0), D3DVAL( 0.0))
  44. {
  45.     m_bShuttingDown = FALSE;
  46.     m_bIsSuspended  = FALSE;
  47.     m_bIsActive     = TRUE;
  48.     m_bDebug        = FALSE;
  49.  
  50.     // DirectDraw interfaces
  51.     lpdd                      = NULL;
  52.     lpddPrimary               = NULL;
  53.     lpddDevice                = NULL;
  54.     lpddZBuffer               = NULL;
  55.     lpddPalette               = NULL;
  56.  
  57.     // Direct3D interfaces
  58.     lpd3d                     = NULL;
  59.     lpd3dDevice               = NULL;
  60.     lpd3dMaterial             = NULL;
  61.     lpd3dBackgroundMaterial   = NULL;
  62.     lpd3dViewport             = NULL;
  63.     lpd3dLight                = NULL;
  64.     lpd3dExecuteBuffer        = NULL;
  65.  
  66.     // Direct3D handles
  67.     hd3dWorldMatrix           = 0UL;
  68.     hd3dViewMatrix            = 0UL;
  69.     hd3dProjMatrix            = 0UL;
  70.     hd3dSurfaceMaterial       = 0UL;
  71.     hd3dBackgroundMaterial    = 0UL;
  72.  
  73.     m_dAngleOfRotation = 0.0;
  74. }
  75.