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.

176 lines
4.6 KiB

  1. //**************************************************************************
  2. //
  3. // Copyright (C) Microsoft Corporation, 1998 - 1999 All Rights Reserved.
  4. //
  5. // File: frmsave.h
  6. //
  7. // Description: Save LPDIRECT3DRMFRAME to an x file.
  8. //
  9. // History:
  10. // 011/06/98 CongpaY Created
  11. //
  12. //**************************************************************************
  13. typedef struct _Header {
  14. WORD major;
  15. WORD minor;
  16. DWORD flags;
  17. } Header;
  18. typedef struct _ColorRGBA {
  19. float r;
  20. float g;
  21. float b;
  22. float a;
  23. } ColorRGBA;
  24. typedef struct _ColorRGB {
  25. float r;
  26. float g;
  27. float b;
  28. } ColorRGB;
  29. typedef struct _IndexedColor {
  30. DWORD index;
  31. ColorRGBA color;
  32. } IndexedColor;
  33. typedef struct _VertexColors {
  34. DWORD cVertices;
  35. IndexedColor vertexColors[1];
  36. } VertexColors;
  37. typedef struct _Boolean2d {
  38. BOOL u;
  39. BOOL v;
  40. } Boolean2d;
  41. typedef struct _FaceWraps {
  42. DWORD cFaces;
  43. Boolean2d faceWraps[1];
  44. } FaceWraps;
  45. typedef struct _Coords2d {
  46. float u;
  47. float v;
  48. } Coords2d;
  49. typedef struct _TextureCoords {
  50. DWORD cVertices;
  51. Coords2d textureCoords[1];
  52. } TextureCoords;
  53. typedef struct _FaceMaterials {
  54. DWORD cMaterials;
  55. DWORD cFaceIndexes;
  56. DWORD faceIndexes[1];
  57. } FaceMaterials;
  58. typedef struct _BaseMaterial {
  59. ColorRGBA faceColor;
  60. float power;
  61. ColorRGB specularColor;
  62. ColorRGB emissiveColor;
  63. } BaseMaterial;
  64. typedef struct _FaceMaterial {
  65. D3DCOLOR faceColor;
  66. LPDIRECT3DRMMATERIAL pMaterial;
  67. LPDIRECT3DRMTEXTURE pTexture;
  68. _FaceMaterial *pNext;
  69. } FaceMaterial;
  70. typedef void (__stdcall *CREATEXFILE)( IDirectXFile **);
  71. class FaceMaterialList
  72. {
  73. DWORD cElements;
  74. FaceMaterial *pFirst;
  75. public:
  76. FaceMaterialList();
  77. ~FaceMaterialList();
  78. DWORD Find(D3DCOLOR faceColor,
  79. LPDIRECT3DRMMATERIAL pMaterial,
  80. LPDIRECT3DRMTEXTURE pTexture);
  81. DWORD Count() { return cElements; }
  82. FaceMaterial *First() { return pFirst; }
  83. };
  84. class NameEntry {
  85. public:
  86. LPSTR pName;
  87. NameEntry *pNext;
  88. };
  89. class NameList
  90. {
  91. NameEntry *pFirst;
  92. NameEntry **ppLast;
  93. public:
  94. NameList();
  95. ~NameList();
  96. void Add(LPSTR pName);
  97. };
  98. class Saver {
  99. public:
  100. Saver();
  101. ~Saver();
  102. HRESULT Init(LPCSTR filename,
  103. D3DRMXOFFORMAT d3dFormat,
  104. D3DRMSAVEOPTIONS d3dSaveFlags);
  105. HRESULT SaveHeaderObject();
  106. HRESULT SaveFrame(LPDIRECT3DRMFRAME3 pFrame,
  107. LPDIRECT3DRMFRAME3 pRefFrame = NULL,
  108. LPDIRECTXFILEDATA pRefFrameObj = NULL);
  109. private:
  110. LPDIRECTXFILE pXFile;
  111. LPDIRECTXFILESAVEOBJECT pSave;
  112. D3DRMXOFFORMAT d3dFormat;
  113. D3DRMSAVEOPTIONS d3dSaveFlags;
  114. NameList lNames;
  115. HRESULT SaveFrameTransform(LPDIRECTXFILEDATA pFrameObj,
  116. LPDIRECT3DRMFRAME3 pFrame,
  117. LPDIRECT3DRMFRAME3 pRefFrame);
  118. HRESULT SaveMeshBuilder(LPDIRECTXFILEDATA pFrameObj,
  119. LPDIRECT3DRMMESHBUILDER3 pMeshBuilder);
  120. HRESULT CreateMeshObject(DWORD cVertices,
  121. DWORD cFaces,
  122. DWORD dwFaceData,
  123. LPDWORD pdwFaceData,
  124. LPDIRECT3DRMMESHBUILDER3 pMeshBuilder,
  125. LPDIRECTXFILEDATA *ppMeshObj);
  126. HRESULT CreateNormalsObject(LPDIRECTXFILEDATA pMeshObj,
  127. DWORD cNormals,
  128. DWORD cFaces,
  129. DWORD dwFaceData,
  130. LPDWORD pdwFaceData,
  131. LPDIRECT3DRMMESHBUILDER3 pMeshBuilder);
  132. HRESULT CreateVertexColorsObject(LPDIRECTXFILEDATA pMeshObj,
  133. DWORD cVertices,
  134. LPDIRECT3DRMMESHBUILDER3 pMeshBuilder);
  135. HRESULT CreateMaterialListObject(LPDIRECTXFILEDATA pMeshObj,
  136. LPDIRECT3DRMFACEARRAY pFaceArray);
  137. HRESULT CreateMaterialObject(LPDIRECTXFILEDATA pMatListObj,
  138. FaceMaterial *pMat);
  139. HRESULT CreateTextureWrapsObject(LPDIRECTXFILEDATA pMeshObj,
  140. LPDIRECT3DRMFACEARRAY pFaceArray);
  141. HRESULT CreateTextureCoordsObject(LPDIRECTXFILEDATA pMeshObj,
  142. DWORD cVertices,
  143. LPDIRECT3DRMMESHBUILDER3 pMeshBuilder);
  144. };