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.

134 lines
3.3 KiB

  1. #include <stdio.h>
  2. #include <windows.h>
  3. #include <gl\gl.h>
  4. #include "skeltest.h"
  5. #include "hugetest.h"
  6. #include "ui_huge.h"
  7. HugeTest::HugeTest()
  8. {
  9. SetThisType("Huge");
  10. SetThisVersion("1.0");
  11. td.swapbuffers = TRUE;
  12. td.iDuration = 10000;
  13. td.iX = 0;
  14. td.iY = 0;
  15. td.iW = 640;
  16. td.iH = 480;
  17. sprintf(td.acName,"Huge");
  18. bd.uiClear = 0;
  19. bd.cColorBits = 8;
  20. bd.cDepthBits = 16;
  21. InitFD(&fd);
  22. InitRD(&rd);
  23. InitLD(&ld);
  24. InitXD(&xd);
  25. afDrawColor[0] = 0.0;
  26. afDrawColor[1] = 1.0;
  27. afDrawColor[2] = 0.0;
  28. range.fxMin = 0;
  29. range.fxMax = 640;
  30. range.fyMin = 0;
  31. range.fyMax = 480;
  32. range.fzMin = -1;
  33. range.fzMax = 1;
  34. UI_init();
  35. } // HugeTest::HugeTest();
  36. int HugeTest::Save(HANDLE hFile)
  37. {
  38. ulong ul,p;
  39. p = parent::Save(hFile);
  40. if (p < 0) return p;
  41. ul = 0;
  42. if (!WriteFile(hFile, (void*) &afDrawColor, sizeof(afDrawColor), &ul, NULL))
  43. return -2;
  44. if (ul != sizeof(afDrawColor)) return -2;
  45. if (!WriteFile(hFile, (void*) &range, sizeof(range), &ul, NULL))
  46. return -2;
  47. if (ul != sizeof(range)) return -2;
  48. if (!WriteFile(hFile, (void*) &fd, sizeof(fd), &ul, NULL))
  49. return -2;
  50. if (ul != sizeof(fd)) return -2;
  51. if (!WriteFile(hFile, (void*) &rd, sizeof(rd), &ul, NULL))
  52. return -2;
  53. if (ul != sizeof(rd)) return -2;
  54. if (!WriteFile(hFile, (void*) &ld, sizeof(ld), &ul, NULL))
  55. return -2;
  56. if (ul != sizeof(ld)) return -2;
  57. if (!WriteFile(hFile, (void*) &xd, sizeof(xd), &ul, NULL))
  58. return -2;
  59. if (ul != sizeof(xd)) return -2;
  60. FlushFileBuffers(hFile);
  61. return p + sizeof(afDrawColor) + sizeof(range) + sizeof(fd)
  62. + sizeof(rd) + sizeof(ld);
  63. }
  64. int HugeTest::Load(HANDLE hFile)
  65. {
  66. ulong ul,p;
  67. p = parent::Load(hFile);
  68. if (p < 0) return p;
  69. ul = 0;
  70. if (!ReadFile(hFile, (void*) &afDrawColor, sizeof(afDrawColor), &ul, NULL))
  71. return -2;
  72. if (ul != sizeof(afDrawColor)) return -2;
  73. if (!ReadFile(hFile, (void*) &range, sizeof(range), &ul, NULL))
  74. return -2;
  75. if (ul != sizeof(range)) return -2;
  76. if (!ReadFile(hFile, (void*) &fd, sizeof(fd), &ul, NULL))
  77. return -2;
  78. if (ul != sizeof(fd)) return -2;
  79. if (!ReadFile(hFile, (void*) &rd, sizeof(rd), &ul, NULL))
  80. return -2;
  81. if (ul != sizeof(rd)) return -2;
  82. if (!ReadFile(hFile, (void*) &ld, sizeof(ld), &ul, NULL))
  83. return -2;
  84. if (ul != sizeof(ld)) return -2;
  85. if (!ReadFile(hFile, (void*) &xd, sizeof(xd), &ul, NULL))
  86. return -2;
  87. if (ul != sizeof(xd)) return -2;
  88. return p + sizeof(afDrawColor) + sizeof(range) + sizeof(fd)
  89. + sizeof(rd) + sizeof(ld);
  90. }
  91. void HugeTest::INITFUNCTION()
  92. {
  93. if(h == 0) h = 1;
  94. glViewport(0, 0, w, h);
  95. glMatrixMode(GL_PROJECTION);
  96. glLoadIdentity();
  97. glOrtho(range.fxMin, range.fxMax,
  98. range.fyMin, range.fyMax,
  99. range.fzMin, range.fzMax);
  100. glMatrixMode(GL_MODELVIEW);
  101. glLoadIdentity();
  102. glClearColor(bd.fClearColor[0],bd.fClearColor[1],
  103. bd.fClearColor[2],bd.fClearColor[3]);
  104. buffers_init(bd);
  105. fog_init(fd);
  106. raster_init(rd);
  107. lighting_init(ld);
  108. texture_init(xd);
  109. } // HugeTest::INITFUNCTION()
  110. void HugeTest::RENDFUNCTION()
  111. {
  112. glClearColor(bd.fClearColor[0],bd.fClearColor[1],
  113. bd.fClearColor[2],bd.fClearColor[3]);
  114. glClear(bd.uiClear);
  115. glFlush();
  116. } // HugeTest::RENDFUNCTION()