Source code of Windows XP (NT5)
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.

198 lines
3.8 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: stdafx.h
  3. //
  4. // Desc: Global header for 3D Pipes screen saver.
  5. //
  6. // Copyright (c) 1994-2000 Microsoft Corporation
  7. //-----------------------------------------------------------------------------
  8. #ifndef __STDAFX_H__
  9. #define __STDAFX_H__
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include <stdlib.h>
  13. #include <windows.h>
  14. #include <commdlg.h>
  15. #include <sys/timeb.h>
  16. #include <sys/types.h>
  17. #include <assert.h>
  18. #include <time.h>
  19. #include <math.h>
  20. #include <commctrl.h>
  21. #include <d3dx8.h>
  22. #include <d3d8rgbrast.h>
  23. #include <tchar.h>
  24. #define iXX -1
  25. #define fXX -0.01f
  26. // These are absolute directions, with origin in center of screen,
  27. // looking down -z
  28. enum
  29. {
  30. PLUS_X = 0,
  31. MINUS_X,
  32. PLUS_Y,
  33. MINUS_Y,
  34. PLUS_Z,
  35. MINUS_Z,
  36. NUM_DIRS,
  37. DIR_NONE,
  38. DIR_STRAIGHT
  39. };
  40. enum
  41. {
  42. JOINT_ELBOW=0,
  43. JOINT_BALL,
  44. JOINT_MIXED,
  45. JOINT_CYCLE,
  46. NUM_JOINTTYPES
  47. };
  48. // surface styles
  49. enum
  50. {
  51. SURFSTYLE_SOLID = 0,
  52. SURFSTYLE_TEX,
  53. SURFSTYLE_WIREFRAME
  54. };
  55. #define NUM_DIV 16 // divisions in window in longest dimension
  56. #define MAX_TEXTURES 8
  57. // texture quality level
  58. enum
  59. {
  60. TEXQUAL_DEFAULT = 0,
  61. TEXQUAL_HIGH
  62. };
  63. typedef struct _ipoint2d
  64. {
  65. int x;
  66. int y;
  67. } IPOINT2D;
  68. typedef struct _ipoint3d
  69. {
  70. int x;
  71. int y;
  72. int z;
  73. } IPOINT3D;
  74. typedef struct _texpoint2d
  75. {
  76. float s;
  77. float t;
  78. } TEX_POINT2D;
  79. typedef struct _isize
  80. {
  81. int width;
  82. int height;
  83. } ISIZE;
  84. typedef struct _fsize
  85. {
  86. float width;
  87. float height;
  88. } FSIZE;
  89. typedef struct _glrect
  90. {
  91. int x, y;
  92. int width, height;
  93. } GLRECT;
  94. typedef struct
  95. {
  96. int type;
  97. int name;
  98. } TEX_RES;
  99. typedef struct
  100. {
  101. int nOffset; // filename offset into pathname
  102. TCHAR szPathName[MAX_PATH]; // texture pathname
  103. } TEXFILE;
  104. // texture data
  105. typedef struct
  106. {
  107. LPDIRECT3DTEXTURE8 pTexture;
  108. int width;
  109. int height;
  110. // GLenum format;
  111. // GLsizei components;
  112. float origAspectRatio; // original width/height aspect ratio
  113. // unsigned char *data;
  114. // GLuint texObj; // texture object
  115. // RGBQUAD *pal;
  116. } TEXTUREINFO;
  117. struct D3DVERTEX
  118. {
  119. D3DXVECTOR3 p;
  120. D3DXVECTOR3 n;
  121. FLOAT tu, tv;
  122. };
  123. #define D3DFVF_VERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
  124. struct D3DTLVERTEX // Vertex type used for rendering background
  125. {
  126. D3DXVECTOR4 p;
  127. DWORD color;
  128. };
  129. #define D3DFVF_TLVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
  130. #define PI 3.14159265358979323846f
  131. // double version of PI
  132. #define PI_D 3.14159265358979323846264338327950288419716939937510
  133. #define ONE_OVER_PI (1.0f / PI)
  134. #define ROOT_TWO 1.414213562373f
  135. // degree<->radian macros
  136. #define ONE_OVER_180 (1.0f / 180.0f)
  137. #define SS_DEG_TO_RAD( a ) ( (a*PI) * ONE_OVER_180 )
  138. #define SS_RAD_TO_DEG( a ) ( (a*180.0f) * D3DX_1BYPI )
  139. // Useful macros
  140. #define SS_MAX( a, b ) ( a > b ? a : b )
  141. #define SS_MIN( a, b ) ( a < b ? a : b )
  142. // macro to round up floating values
  143. #define SS_ROUND_UP( fval ) ( (((fval) - (FLOAT)(int)(fval)) > 0.0f) ? (int) ((fval)+1.0f) : (int) (fval) )
  144. // macros to clamp a value within a range
  145. #define SS_CLAMP_TO_RANGE( a, lo, hi ) ( (a < lo) ? lo : ((a > hi) ? hi : a) )
  146. #define SS_CLAMP_TO_RANGE2( a, lo, hi ) ( a = (a < lo) ? lo : ((a > hi) ? hi : a) )
  147. #include "d3dsaver.h"
  148. #include "dxutil.h"
  149. #include "resource.h"
  150. #include "xc.h"
  151. #include "eval.h"
  152. #include "fstate.h"
  153. #include "nstate.h"
  154. #include "node.h"
  155. #include "pipe.h"
  156. #include "npipe.h"
  157. #include "fpipe.h"
  158. #include "objects.h"
  159. #include "view.h"
  160. #include "state.h"
  161. #include "pipes.h"
  162. extern void InitMaterials();
  163. extern D3DMATERIAL8* RandomTexMaterial();
  164. extern D3DMATERIAL8* RandomTeaMaterial();
  165. extern CPipesScreensaver* g_pMyPipesScreensaver;
  166. #endif // __STDAFX_H__