fPostEffectC.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <tchar.h>
  4. #pragma hdrstop
  5. #include "fPostEffectC.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "GLS.BaseClasses"
  9. #pragma link "GLS.Cadencer"
  10. #pragma link "GLS.Coordinates"
  11. #pragma link "GLS.Material"
  12. #pragma link "GLS.Scene"
  13. #pragma link "GLS.SimpleNavigation"
  14. #pragma link "GLS.VectorFileObjects"
  15. #pragma link "GLS.SceneViewer"
  16. #pragma link "GLSL.PostEffects"
  17. #pragma link "GLS.FileMD2"
  18. #pragma resource "*.dfm"
  19. TMainForm *MainForm;
  20. //---------------------------------------------------------------------------
  21. __fastcall TMainForm::TMainForm(TComponent* Owner)
  22. : TForm(Owner)
  23. {
  24. }
  25. //---------------------------------------------------------------------------
  26. void __fastcall TMainForm::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  27. const double newTime)
  28. {
  29. GLSceneViewer1->Invalidate();
  30. }
  31. //---------------------------------------------------------------------------
  32. void __fastcall TMainForm::FormCreate(TObject *Sender)
  33. {
  34. TFileName Path = GetCurrentAssetPath();
  35. SetCurrentDir(Path + "\\modelext");
  36. GLActor1->LoadFromFile("waste.md2");
  37. GLMaterialLibrary1->TexturePaths = GetCurrentDir();
  38. GLActor1->Material->Texture->Image->LoadFromFile("waste.jpg");
  39. GLActor1->Material->Texture->Enabled = True;
  40. /// GLActor1->SwitchToAnimation(GLActor1->Animations[0]);
  41. GLActor1->AnimationMode = aamLoop;
  42. //GLActor1->ObjectStyle = GLActor1->ObjectStyle + [osDirectDraw];
  43. GLActor1->Reference = aarMorph;
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TMainForm::ComboBox1Change(TObject *Sender)
  47. {
  48. switch (ComboBox1->ItemIndex) {
  49. case 0: GLPostEffect1->Preset = pepNone; break;
  50. case 1: GLPostEffect1->Preset = pepGray; break;
  51. case 2: GLPostEffect1->Preset = pepNegative; break;
  52. case 3: GLPostEffect1->Preset = pepDistort; break;
  53. case 4: GLPostEffect1->Preset = pepNoise; break;
  54. case 5: GLPostEffect1->Preset = pepNightVision; break;
  55. case 6: GLPostEffect1->Preset = pepBlur; break;
  56. case 7: GLPostEffect1->Preset = pepCustom; break;
  57. default:;
  58. }
  59. }
  60. //---------------------------------------------------------------------------
  61. void __fastcall TMainForm::GLPostEffect1CustomEffect(TObject *Sender, TGLRenderContextInfo &rci,
  62. TGLPostEffectBuffer &Buffer)
  63. {
  64. int i;
  65. for (i = 0; i <= 7; i++) {
  66. /// &Buffer[i]->r = (int)(&Buffer[i + 5]->r * 2);
  67. /// &Buffer[i]->g = (int)(&Buffer[i]->g * 1.5);
  68. /// &Buffer[i]->b = (int)(&Buffer[i + 5]->b * 1.5);
  69. }
  70. }
  71. //---------------------------------------------------------------------------