Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.7 KiB

  1. /*****************************************************************************\
  2. FILE: object.h
  3. DESCRIPTION:
  4. The caller will tell us what shape they want. Normally a rectangle on a
  5. plane or a sphere. We will then create the number vertexs the caller wants
  6. for that objectand create texture coordinates.
  7. BryanSt 12/24/2000
  8. Copyright (C) Microsoft Corp 2000-2001. All rights reserved.
  9. \*****************************************************************************/
  10. #ifndef OBJECT_H
  11. #define OBJECT_H
  12. #include "main.h"
  13. struct MYVERTEX
  14. {
  15. D3DXVECTOR3 pos;
  16. D3DXVECTOR3 norm;
  17. float tu;
  18. float tv;
  19. MYVERTEX() { }
  20. MYVERTEX(const D3DXVECTOR3& v, const D3DXVECTOR3& n, float _tu, float _tv)
  21. { pos = v; norm = n;
  22. tu = _tu; tv = _tv;
  23. }
  24. };
  25. #define D3DFVF_MYVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
  26. //-----------------------------------------------------------------------------
  27. // Defines, constants, and global variables
  28. //-----------------------------------------------------------------------------
  29. extern int g_nTrianglesRenderedInThisFrame;
  30. class C3DObject
  31. {
  32. public:
  33. HRESULT InitPlane(CTexture * pTexture, IDirect3DDevice8 * pD3DDevice, D3DXVECTOR3 vLocation, D3DXVECTOR3 vSize, D3DXVECTOR3 vNormal,
  34. int nNumVertexX, int nNumVertexY, float fTextureScaleX, float fTextureScaleY,
  35. DWORD dwMaxPixelSize, float fVisibleRadius);
  36. HRESULT InitPlaneStretch(CTexture * pTexture, IDirect3DDevice8 * pD3DDevice, D3DXVECTOR3 vLocation, D3DXVECTOR3 vSize, D3DXVECTOR3 vNormal,
  37. int nNumVertexX, int nNumVertexY, DWORD dwMaxPixelSize);
  38. HRESULT Render(IDirect3DDevice8 * pDev);
  39. HRESULT FinalCleanup(void);
  40. HRESULT DeleteDeviceObjects(void);
  41. HRESULT SetNextObject(C3DObject * pNextObject);
  42. HRESULT CombineObject(IDirect3DDevice8 * pD3DDevice, C3DObject * pObjToMerge);
  43. BOOL IsObjectViewable(IDirect3DDevice8 * pD3DDevice);
  44. C3DObject(CMSLogoDXScreenSaver * pMain);
  45. virtual ~C3DObject();
  46. public:
  47. D3DXMATRIX m_matIdentity;
  48. CTexture * m_pTexture;
  49. IDirect3DVertexBuffer8 * m_pVB[10];
  50. IDirect3DIndexBuffer8 * m_pIndexBuff[10];
  51. MYVERTEX * m_pvVertexs;
  52. DWORD m_dwNumVer;
  53. LPWORD m_pdwIndices;
  54. DWORD m_dwNumIndeces;
  55. C3DObject * m_pNextObject;
  56. CMSLogoDXScreenSaver * m_pMain; // Weak reference
  57. D3DXVECTOR3 m_vMin;
  58. D3DXVECTOR3 m_vMax;
  59. private:
  60. // Functions:
  61. HRESULT _PurgeDeviceObjects(void);
  62. HRESULT _GenerateDeviceObjects(void);
  63. HRESULT _ForPositiveSize(D3DXVECTOR3 * pvLocation, D3DXVECTOR3 * pvSize);
  64. };
  65. #endif // OBJECT_H