ProjTextures.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*: Projected Textures example.
  2. Controls:
  3. Left Mouse Button: Rotate
  4. Right Mouse Button: Adjust Distance
  5. 'S': Change styles
  6. The TGLProjectedTextures object can be used to simulate
  7. projected lights or other special effects. To use it, add
  8. it to the scene and set all objects that should receive
  9. the projected textures as children. Then, add a number
  10. of TGLTextureEmitter and load the texture that should
  11. be projected into it. Add this emitter to the "emitters"
  12. list of the projtex and that's it.
  13. There are two styles of projection: original and inverse.
  14. On the original method (developed by Tom Nuyens of
  15. www.delphi3d.net) the scene is rendered and the textures
  16. are projected into it. This is useful to simulate all
  17. kinds of special effects from bullet holes, to shadow
  18. maps (using tmBlend texture mode).
  19. On the inverse method, first all emitters are rendered,
  20. creating an "illumination mask". Then the scene is blended
  21. to this mask, so that only lit pixels are drawn. This can
  22. be used to create a projected-texture only illumination system.
  23. */
  24. //---------------------------------------------------------------------------
  25. #include <vcl.h>
  26. #pragma hdrstop
  27. USEFORM("Unit1.cpp", Form1);
  28. //---------------------------------------------------------------------------
  29. WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
  30. {
  31. try
  32. {
  33. Application->Initialize();
  34. Application->CreateForm(__classid(TForm1), &Form1);
  35. Application->Run();
  36. }
  37. catch (Exception &exception)
  38. {
  39. Application->ShowException(&exception);
  40. }
  41. return 0;
  42. }
  43. //---------------------------------------------------------------------------