Windows NT 4.0 source code leak
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.

262 lines
7.6 KiB

4 years ago
  1. /******************************Module*Header*******************************\
  2. * Module Name: sstext3d.h
  3. *
  4. * Global header for text3D screen saver.
  5. *
  6. * Created: 12-24-94 -by- Marc Fortier [marcfo]
  7. *
  8. * Copyright (c) 1994 Microsoft Corporation
  9. *
  10. \**************************************************************************/
  11. #ifndef __sstext3d_h__
  12. #define __sstext3d_h__
  13. #include <commctrl.h>
  14. #include "dlgs.h"
  15. #include "sscommon.h"
  16. #define PI_OVER_2 (PI/2.0f)
  17. #define PI_OVER_4 (PI/4.0f)
  18. #define TEXT_BUF_SIZE 100 // max length of display text buffer
  19. // (including NULL termination)
  20. #define TEXT_LIMIT 16 // max length of user-inputted display text
  21. #define MAX_IROT 100 // max integer rotation level (from slider)
  22. #define MIN_SLIDER 0
  23. #define MAX_SLIDER 100
  24. // demo types
  25. enum {
  26. DEMO_STRING = 0, // static string
  27. DEMO_CLOCK, // digital clock
  28. DEMO_VSTRING, // variable string (actually a subset of DEMO_STRING)
  29. };
  30. #define MAX_DEMO 1 // max demo index
  31. #define NUM_DEMOS (MAX_DEMO+1)
  32. // surface styles
  33. enum {
  34. SURFSTYLE_SOLID = 0,
  35. SURFSTYLE_TEX,
  36. SURFSTYLE_WIREFRAME
  37. };
  38. // rotation styles
  39. enum {
  40. ROTSTYLE_NONE = 0,
  41. ROTSTYLE_SEESAW,
  42. ROTSTYLE_WOBBLE,
  43. ROTSTYLE_RANDOM,
  44. NUM_ROTSTYLES
  45. };
  46. enum {
  47. X_AXIS = 0,
  48. Y_AXIS,
  49. Z_AXIS,
  50. NUM_AXIS
  51. };
  52. #if defined(max)
  53. #undef max
  54. #endif
  55. #define max( a, b ) ( a >= b ? a : b )
  56. #if defined(clamp)
  57. #undef clamp
  58. #endif
  59. #define clamp( a, lo, hi ) ( (a < lo) ? lo : ((a > hi) ? hi : a) )
  60. #define deg_to_rad( a ) ( (a*PI) / 180.0f )
  61. #define rad_to_deg( a ) ( (a*180.0f) / PI )
  62. typedef struct {
  63. USHORT listNum; // display list number
  64. TCHAR glyph; // glyph value (for extended LUT entries)
  65. LPGLYPHMETRICSFLOAT lpgmf; // ptr to glyphmetrics
  66. } LISTENTRY;
  67. #define SIZE_LIST_LUT 512
  68. #define MAX_DIRECT_LUT 256
  69. typedef struct {
  70. HDC hdc;
  71. int nGlyphs; // number of glyphs
  72. int firstGlyph;
  73. FLOAT chordalDeviation;
  74. FLOAT extrusion;
  75. int type; // WGL_FONT_LINES or WGL_FONT_POLYGONS
  76. LISTENTRY *listLUT; // LUT for cmd list # from glyph
  77. int LUTIndex; // current index for new indirect look-ups
  78. } WglFontContext;
  79. typedef struct {
  80. // registry or registry-derived attributes
  81. int demoType;
  82. BOOL bMaterialCycle;
  83. int matType; // material type from registry
  84. MATERIAL *pMat; // ptr to current material
  85. int surfStyle;
  86. int rotStyle; // rotation style
  87. int texQual;
  88. float fTesselFact;
  89. float fDepth; // extrusion
  90. int iSpeed; // rotation speed
  91. UINT uSize; // window size
  92. TEXFILE texFile; // texture file
  93. TEXTURE texture;
  94. TCHAR szFontName[LF_FACESIZE]; // font face name
  95. BOOL bBold;
  96. BOOL bItalic;
  97. BYTE charSet;
  98. TCHAR szText[TEXT_BUF_SIZE+1]; // display string
  99. USHORT usText[TEXT_BUF_SIZE+1]; // display string converted to cmd lists
  100. // internal attributes
  101. BOOL bTexture;
  102. BOOL bRandomMat;
  103. WglFontContext *pWglFontC;
  104. int textLen;
  105. POINTFLOAT pfTextExtent;
  106. POINTFLOAT pfTextOrigin; // upper left corner of extents
  107. POINT3D p3dBoundingBox; // bounding box, from spin angles
  108. FLOAT fFovy; // field of view in y-dir
  109. FLOAT fAspect; // aspect ratio of GL window
  110. FLOAT fViewDist; // dist to front of bounding box
  111. FLOAT fZtrans; // translation in z
  112. int iRotStep; // rotation step from slider
  113. int iRotMinStep; // min rotation step
  114. int iRotMaxStep; // max rotation step
  115. IPOINT3D ip3dRotStep; // xyz rot step, for random rotation
  116. IPOINT3D ip3dRoti; // current xyz rot step iteration
  117. POINT3D p3dRotMin; // min rotation amplitude
  118. POINT3D p3dRotMax; // max rotation amplitude
  119. POINT3D p3dRotLimit; // current rotation amplitude
  120. POINT3D p3dRot; // current rotation
  121. POINTFLOAT *pTrig; // current trig table
  122. SYSTEMTIME stTime;
  123. BOOL bXMajor; // string either x-major or y-major
  124. SSContext ssc; // screen saver configuration
  125. } AttrContext;
  126. // Global attribute context
  127. extern AttrContext gac;
  128. extern WglFontContext* CreateWglFontContext (
  129. HDC hdc,
  130. int type,
  131. float fExtrusion,
  132. float fChordalDeviation );
  133. extern void DeleteWglFontContext(
  134. WglFontContext *pwfc );
  135. extern void DrawString (
  136. USHORT *string,
  137. int strLen,
  138. WglFontContext *pwfc );
  139. extern int GetStringExtent(
  140. LPTSTR pszString,
  141. POINTFLOAT *extent,
  142. POINTFLOAT *origin,
  143. WglFontContext *pwfc );
  144. extern void ConvertStringToList(
  145. LPTSTR pszSrc,
  146. USHORT *usDst,
  147. WglFontContext *pwfc );
  148. extern void getIniSettings(void);
  149. // Resource constants
  150. #define IDS_SCREENSAVERTITLE 1020
  151. #define IDS_SAVERNAME 1002
  152. // registry attribute strings:
  153. #define IDS_DEMOTYPE 1100
  154. #define IDS_SURFSTYLE 1104
  155. #define IDS_FONT 1109
  156. #define IDS_FONT_ATTRIBUTES 1110
  157. #define IDS_CHARSET 1111
  158. #define IDS_TEXT 1115
  159. #define IDS_SPEED 1120
  160. #define IDS_ROTSTYLE 1124
  161. // demo type strings
  162. #define IDS_DEMO_STRING 1200
  163. #define IDS_DEMO_CLOCK 1201
  164. // rotation resource strings
  165. #define IDS_ROTSTYLE_NONE 1400
  166. #define IDS_ROTSTYLE_SEESAW 1401
  167. #define IDS_ROTSTYLE_WOBBLE 1402
  168. #define IDS_ROTSTYLE_RANDOM 1403
  169. #define DLG_SETUP_HELP 2001
  170. #define DLG_SETUP_TYPES 2002 // object type menu
  171. #define DLG_SETUP_BITMAP 2003
  172. #define DLG_SETUP_ABOUT 2010
  173. #define DLG_SETUP_TESSEL 2012 // tesselation slider
  174. #define DLG_SETUP_SIZE 2014 // size slider
  175. #define DLG_SETUP_TEX 2016 // texture button
  176. #define DLG_SETUP_FONT 2022 // select font button
  177. #define DLG_SETUP_SPEED 2023 // speed slider
  178. // surface styles
  179. #define IDC_RADIO_SOLID 2030
  180. #define IDC_RADIO_TEX 2031
  181. #define IDC_RADIO_WIREFRAME 2032 // not presently used
  182. #define IDC_TO_SURFSTYLE(n) ( (n) - IDC_RADIO_SOLID )
  183. // In order for the IDC_TO_SURFSTYLE conversion macro to work, the radio buttons
  184. // for surface styles must be kept contiguous.
  185. // rotation styles
  186. #define DLG_SETUP_ROTSTYLE 4100
  187. // demo type
  188. #define IDC_DEMO_STRING 5000
  189. #define IDC_DEMO_CLOCK 5001
  190. #define IDC_TO_DEMOTYPE(n) ( (n) - IDC_DEMO_STRING )
  191. // sliders
  192. #define IDC_STATIC_TESS 2051 // box around slider
  193. #define IDC_STATIC_TESS_MIN 2052 // min label
  194. #define IDC_STATIC_TESS_MAX 2053 // max label
  195. #define IDC_STATIC_SIZE 2054
  196. #define IDC_STATIC_SIZE_MIN 2055
  197. #define IDC_STATIC_SIZE_MAX 2056
  198. // rotation sliders
  199. #define IDC_STATIC_ROTATION_GRP 5000
  200. // configure text dialog box stuff
  201. #define IDS_TEXT_TITLE 3001
  202. #define DLG_TEXT_ENTER 3020
  203. #define DLG_TEXT_SHOW 3021
  204. // Choose font template
  205. #define DLG_CF_TEMPLATE 6000
  206. #define IDD_FONT 6001
  207. // Default texture resource
  208. #define IDB_DEFTEX 7000
  209. #define SHELP_CONTENTS 01
  210. #define SHELP_SHAPES 02
  211. #define SHELP_PASSWORD 03
  212. #define SHELP_COLOR 04
  213. #define SHELP_MISC 05
  214. #define SHELP_OVERVIEW 06
  215. #endif // __sstext3d_h__