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.

129 lines
3.4 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: state.h
  3. *
  4. * STATE
  5. *
  6. * Copyright (c) 1995 Microsoft Corporation
  7. *
  8. \**************************************************************************/
  9. #ifndef __state_h__
  10. #define __state_h__
  11. #include "sscommon.hxx"
  12. #include "pipe.h"
  13. #include "node.h"
  14. #include "view.h"
  15. #include "nstate.h"
  16. #include "fstate.h"
  17. #define MAX_DRAW_THREADS 4
  18. #define TEAPOT 66
  19. #define MAX_TESS 3
  20. // type(s) of pipes that are drawn
  21. enum {
  22. DRAW_NORMAL,
  23. DRAW_FLEX,
  24. DRAW_BOTH // not currently used
  25. };
  26. // Reset status
  27. #define RESET_STARTUP_BIT (1L << 0)
  28. #define RESET_NORMAL_BIT (1L << 1)
  29. #define RESET_RESIZE_BIT (1L << 2)
  30. #define RESET_REPAINT_BIT (1L << 3)
  31. // Frame draw schemes
  32. enum {
  33. FRAME_SCHEME_RANDOM, // pipes draw randomly
  34. FRAME_SCHEME_CHASE, // pipes chase a lead pipe
  35. };
  36. class DRAW_THREAD {
  37. private:
  38. HDC hdc;
  39. HTEXTURE htex;
  40. public:
  41. HGLRC hglrc; // rc to draw with (public so STATE can delete)
  42. int priority;
  43. DRAW_THREAD();
  44. ~DRAW_THREAD();
  45. PIPE *pPipe; // generic pipe ptr
  46. void SetRCDC( HGLRC rc, HDC hdc );
  47. BOOL HasRC();
  48. HGLRC GetRC();
  49. void MakeRCCurrent();
  50. void SetTexture( HTEXTURE htex );
  51. void SetPipe( PIPE *pipe );
  52. BOOL StartPipe();
  53. void DrawPipe();
  54. void KillPipe();
  55. };
  56. // Program existence instance
  57. class NORMAL_STATE;
  58. class FLEX_STATE;
  59. class STATE {
  60. public:
  61. HGLRC shareRC; // RC that objects are shared from
  62. PIPE *pLeadPipe; // lead pipe for chase scenarios
  63. int nSlices; // reference # of slices around a pipe
  64. BOOL bTexture; // global texture enable
  65. int nTextures;
  66. TEXTURE texture[MAX_TEXTURES];
  67. IPOINT2D texRep[MAX_TEXTURES];
  68. VIEW view; // viewing parameters
  69. float radius; // 'reference' pipe radius value
  70. NODE_ARRAY *nodes; // for keeping track of draw space
  71. NORMAL_STATE *pNState;
  72. FLEX_STATE *pFState;
  73. STATE( BOOL bFlexMode, BOOL bMultiPipes );
  74. ~STATE();
  75. void Reshape( int width, int height, void *data );
  76. void Repaint( LPRECT pRect, void *data );
  77. void Draw( void *data );
  78. void Finish( void *data );
  79. private:
  80. int drawMode; // drawing mode (flex or normal for now)
  81. int drawScheme; // random or chase
  82. int maxPipesPerFrame; // max number of separate pipes/frame
  83. int nPipesDrawn; // number of pipes drawn or drawing in frame
  84. int maxDrawThreads; // max number of concurrently drawing pipes
  85. int nDrawThreads; // number of live threads
  86. DRAW_THREAD drawThreads[MAX_DRAW_THREADS];
  87. int resetStatus;
  88. SS_DIGITAL_DISSOLVE_CLEAR ddClear;
  89. int bCalibrateClear;
  90. void GLInit();
  91. void DrawValidate(); // validation to do before each Draw
  92. void ResetView();
  93. void FrameReset();
  94. void Clear();
  95. void ChooseNewLeadPipe();
  96. void CompactThreadList();
  97. BOOL LoadTextureFiles();
  98. BOOL LoadTextureFiles( TEXFILE *pTexFile, int nTexFiles,
  99. TEX_RES *pTexRes );
  100. void CalcTexRepFactors();
  101. int CalcMaxPipesPerFrame();
  102. };
  103. #endif // __state_h__