Browse Source

Added assets and fixed paths for earth, forest and christmas demos

GLScene 2 years ago
parent
commit
a658d31896
44 changed files with 520 additions and 500 deletions
  1. 27 3
      AdvDemos/AdvDemos.groupproj
  2. 7 6
      AdvDemos/Christmas/ChristmasD.dpr
  3. BIN
      AdvDemos/Christmas/Data/PAT0089.jpg
  4. BIN
      AdvDemos/Christmas/Data/STRETCH2.JPG
  5. BIN
      AdvDemos/Christmas/Data/STUCCO4.JPG
  6. BIN
      AdvDemos/Christmas/Data/TUTASH.JPG
  7. BIN
      AdvDemos/Christmas/Data/Tutash_d.jpg
  8. BIN
      AdvDemos/Christmas/Data/Tutash_s.jpg
  9. BIN
      AdvDemos/Christmas/Data/black.jpg
  10. BIN
      AdvDemos/Christmas/Data/clouds.jpg
  11. BIN
      AdvDemos/Christmas/Data/fireplace.3DS
  12. BIN
      AdvDemos/Christmas/Data/firtree.3ds
  13. 117 105
      AdvDemos/Christmas/fChrismasC.cpp
  14. 84 82
      AdvDemos/Christmas/fChrismasC.h
  15. 15 12
      AdvDemos/Christmas/fChrismasD.pas
  16. BIN
      AdvDemos/Earth/Data/land_ocean_ice_4096.jpg
  17. BIN
      AdvDemos/Earth/Data/land_ocean_ice_lights_4096.jpg
  18. BIN
      AdvDemos/Earth/Data/moon_2048.jpg
  19. 29 27
      AdvDemos/Earth/EarthC.cbproj
  20. 5 6
      AdvDemos/Earth/fEarthC.dfm
  21. 10 13
      AdvDemos/Earth/fEarthD.dfm
  22. 81 86
      AdvDemos/Earth/fEarthD.pas
  23. BIN
      AdvDemos/Forest/Data/detailmap.jpg
  24. BIN
      AdvDemos/Forest/Data/imposters.bmp
  25. BIN
      AdvDemos/Forest/Data/zbark_016.jpg
  26. 7 12
      AdvDemos/Forest/fForestD.dfm
  27. 137 148
      AdvDemos/Forest/fForestD.pas
  28. 0 0
      Asset/Audio/Crackling_Fireplace.wav
  29. 0 0
      Asset/Audio/Jingle_Bells_64.mp3
  30. 0 0
      Asset/Data/Constellation_borders.dat
  31. 0 0
      Asset/Data/Constellations.dat
  32. 0 0
      Asset/Data/HighResPack-Readme.txt
  33. 0 0
      Asset/Data/Yale_BSC.stars
  34. 0 0
      Asset/Data/hipparcos_9.0.stars
  35. 0 0
      Asset/Landscape/volcano.htf
  36. 0 0
      Asset/Shader/water_fp.glsl
  37. 0 0
      Asset/Shader/water_vp.glsl
  38. 0 0
      Asset/Texture/Waterbump.jpg
  39. 0 0
      Asset/Texture/caustics.jpg
  40. BIN
      Asset/Texture/detailmap.jpg
  41. 0 0
      Asset/Texture/leaf.tga
  42. 0 0
      Asset/Texture/volcano_trees.jpg
  43. 0 0
      Asset/Texture/volcano_tx_low.jpg
  44. 1 0
      Demos/meshes/skeletal/fSkeletalC.dfm

+ 27 - 3
AdvDemos/AdvDemos.groupproj

@@ -54,6 +54,12 @@
         <Projects Include="Quake3Demo\Q3DemoC.cbproj">
             <Dependencies/>
         </Projects>
+        <Projects Include="Earth\EarthD.dproj">
+            <Dependencies/>
+        </Projects>
+        <Projects Include="Earth\EarthC.cbproj">
+            <Dependencies/>
+        </Projects>
     </ItemGroup>
     <ProjectExtensions>
         <Borland.Personality>Default.Personality.12</Borland.Personality>
@@ -215,14 +221,32 @@
     <Target Name="Q3DemoC:Make">
         <MSBuild Projects="Quake3Demo\Q3DemoC.cbproj" Targets="Make"/>
     </Target>
+    <Target Name="EarthD">
+        <MSBuild Projects="Earth\EarthD.dproj"/>
+    </Target>
+    <Target Name="EarthD:Clean">
+        <MSBuild Projects="Earth\EarthD.dproj" Targets="Clean"/>
+    </Target>
+    <Target Name="EarthD:Make">
+        <MSBuild Projects="Earth\EarthD.dproj" Targets="Make"/>
+    </Target>
+    <Target Name="EarthC">
+        <MSBuild Projects="Earth\EarthC.cbproj"/>
+    </Target>
+    <Target Name="EarthC:Clean">
+        <MSBuild Projects="Earth\EarthC.cbproj" Targets="Clean"/>
+    </Target>
+    <Target Name="EarthC:Make">
+        <MSBuild Projects="Earth\EarthC.cbproj" Targets="Make"/>
+    </Target>
     <Target Name="Build">
-        <CallTarget Targets="Actorms3dD;ActorMS3dC;SplitterD;SplitterC;ArchipelagoD;ArchipelagoC;ChristmasD;ChristmasC;ForestD;GLSViewerD;IntensityMeshD;IntensityMeshC;PanoViewerD;PanoViewerC;TtbD;Q3DemoD;Q3DemoC"/>
+        <CallTarget Targets="Actorms3dD;ActorMS3dC;SplitterD;SplitterC;ArchipelagoD;ArchipelagoC;ChristmasD;ChristmasC;ForestD;GLSViewerD;IntensityMeshD;IntensityMeshC;PanoViewerD;PanoViewerC;TtbD;Q3DemoD;Q3DemoC;EarthD;EarthC"/>
     </Target>
     <Target Name="Clean">
-        <CallTarget Targets="Actorms3dD:Clean;ActorMS3dC:Clean;SplitterD:Clean;SplitterC:Clean;ArchipelagoD:Clean;ArchipelagoC:Clean;ChristmasD:Clean;ChristmasC:Clean;ForestD:Clean;GLSViewerD:Clean;IntensityMeshD:Clean;IntensityMeshC:Clean;PanoViewerD:Clean;PanoViewerC:Clean;TtbD:Clean;Q3DemoD:Clean;Q3DemoC:Clean"/>
+        <CallTarget Targets="Actorms3dD:Clean;ActorMS3dC:Clean;SplitterD:Clean;SplitterC:Clean;ArchipelagoD:Clean;ArchipelagoC:Clean;ChristmasD:Clean;ChristmasC:Clean;ForestD:Clean;GLSViewerD:Clean;IntensityMeshD:Clean;IntensityMeshC:Clean;PanoViewerD:Clean;PanoViewerC:Clean;TtbD:Clean;Q3DemoD:Clean;Q3DemoC:Clean;EarthD:Clean;EarthC:Clean"/>
     </Target>
     <Target Name="Make">
-        <CallTarget Targets="Actorms3dD:Make;ActorMS3dC:Make;SplitterD:Make;SplitterC:Make;ArchipelagoD:Make;ArchipelagoC:Make;ChristmasD:Make;ChristmasC:Make;ForestD:Make;GLSViewerD:Make;IntensityMeshD:Make;IntensityMeshC:Make;PanoViewerD:Make;PanoViewerC:Make;TtbD:Make;Q3DemoD:Make;Q3DemoC:Make"/>
+        <CallTarget Targets="Actorms3dD:Make;ActorMS3dC:Make;SplitterD:Make;SplitterC:Make;ArchipelagoD:Make;ArchipelagoC:Make;ChristmasD:Make;ChristmasC:Make;ForestD:Make;GLSViewerD:Make;IntensityMeshD:Make;IntensityMeshC:Make;PanoViewerD:Make;PanoViewerC:Make;TtbD:Make;Q3DemoD:Make;Q3DemoC:Make;EarthD:Make;EarthC:Make"/>
     </Target>
     <Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
 </Project>

+ 7 - 6
AdvDemos/Christmas/ChristmasD.dpr

@@ -11,27 +11,28 @@
    Assembled from bits from the web, should be royalty free, but I don't have
    the means to check... so if you have clues about any of them:
 
-   Models: from 3DCafe.com<br>
+   Models: from 3DCafe.com
    Textures: various origins, some from 3dtextures.fr.st, others made by Eric Grange
    Music: unknown origin, was in a "royalty free" download package
 
-   http://glscene.org *)
+   https://github.com/GLScene *)
+
 program ChristmasD;
 
 uses
   Vcl.Forms,
   GLS.Sound,
-  fChrismasD in 'fChrismasD.pas' {Main};
+  fChrismasD in 'fChrismasD.pas';
 
 {$E .scr}
 
 {$R *.res}
 
 begin
-   // don't complain about missing sound support
-  vVerboseGLSMErrors:=False;
+  // don't complain about missing sound support
+  vVerboseGLSMErrors := False;
   Application.Initialize;
-  Application.Title := 'GLScene Christmas 2016';
+  Application.Title := 'GLScene Christmas';
   Application.CreateForm(TMain, Main);
   Application.Run;
 end.

BIN
AdvDemos/Christmas/Data/PAT0089.jpg


BIN
AdvDemos/Christmas/Data/STRETCH2.JPG


BIN
AdvDemos/Christmas/Data/STUCCO4.JPG


BIN
AdvDemos/Christmas/Data/TUTASH.JPG


BIN
AdvDemos/Christmas/Data/Tutash_d.jpg


BIN
AdvDemos/Christmas/Data/Tutash_s.jpg


BIN
AdvDemos/Christmas/Data/black.jpg


BIN
AdvDemos/Christmas/Data/clouds.jpg


BIN
AdvDemos/Christmas/Data/fireplace.3DS


BIN
AdvDemos/Christmas/Data/firtree.3ds


+ 117 - 105
AdvDemos/Christmas/fChrismasC.cpp

@@ -36,50 +36,57 @@
 #pragma link "GLS.LensFlare"
 #pragma link "GLS.ParticleFX"
 #pragma resource "*.dfm"
-TForm1 *Form1;
+TForm1* Form1;
 
 // ---------------------------------------------------------------------------
-__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {
-}
-
+__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {}
 // ---------------------------------------------------------------------------
-void __fastcall TForm1::FormCreate(TObject *Sender) {
-	String DataPath;
+
+void __fastcall TForm1::FormCreate(TObject* Sender)
+{
+	Path = GetCurrentAssetPath();
 	Randomize();
-	DataPath = ExtractFilePath(ParamStr(0)) + "data";
-	SetCurrentDir(DataPath);
+
+	SetCurrentDir(Path + "\\model");
 	FFFirTree->LoadFromFile("firtree.3ds");
 	FFFirePlace->LoadFromFile("fireplace.3ds");
 	fireLight = 0.5;
 	FTYear->Text = "";
+
+	// Set current dir for audio files
+	SetCurrentDir(Path + "\\audio");
 }
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::ViewerMouseDown(TObject *Sender, TMouseButton Button,
-	TShiftState Shift, int X, int Y) {
-	mx = X;
-	my = Y;
+void __fastcall TForm1::ViewerMouseDown(
+    TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
+{
+    mx = X;
+    my = Y;
 }
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::ViewerMouseMove(TObject *Sender, TShiftState Shift,
-	int X, int Y) {
-	if (Shift.Contains(ssLeft)) {
-		Camera->MoveAroundTarget(my - Y, mx - X);
-		mx = X;
-		my = Y;
-	}
+void __fastcall TForm1::ViewerMouseMove(
+    TObject* Sender, TShiftState Shift, int X, int Y)
+{
+    if (Shift.Contains(ssLeft)) {
+        Camera->MoveAroundTarget(my - Y, mx - X);
+        mx = X;
+        my = Y;
+    }
 }
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::TimerTimer(TObject *Sender) {
+void __fastcall TForm1::TimerTimer(TObject* Sender)
+{
 	int i;
 	TDateTime t;
 	String buf;
 	Word y, m, d;
 	bool TheChristmas;
 
-	TheChristmas = false; // Merry Christmas or Happy New Year!
+	// if (miMerryCristmas->Checked)
+	TheChristmas = true; // Merry Christmas or Happy New Year!
 	Caption = Format("%.1f FPS", ARRAYOFCONST((Viewer->FramesPerSecond())));
 	Viewer->ResetPerformanceMonitor();
 
@@ -92,118 +99,123 @@ void __fastcall TForm1::TimerTimer(TObject *Sender) {
 	t = EncodeDate(y, 12, 25) - Now(); // Merry Christmas
 	// t = EncodeDate(y+1, 01, 01) - Now(); //Happy New Year!
 	if (TheChristmas) {
-		// if (miMerryCristmas->Checked) {
 		t = EncodeDate(y, 12, 25) - Now();
-		FTCongratulations->Text = "Merry Christmas!";
-	}
-	else {
-		t = EncodeDate(y + 1, 01, 01) - Now();
-		FTCongratulations->Text = "Happy New Year!";
-		FTYear->Text = IntToStr(y + 1);
-	}
-
-	if ((double)t < 0)
-		FTCountDown->Text = "Merry Christmas!";
-	if (((double)t < 1) && ((double)t > -1))
-		DCGifts->Visible = true;
-	if ((double)t >= 2) {
-		buf = IntToStr(Floor((double)t)) + " days, ";
-		i = (Int)(Frac((double)t) * 24);
-		if (i > 1)
-			buf = buf + IntToStr(i) + " hours...";
-		else
-			buf = buf + IntToStr(i) + " hour...";
-		FTCountDown->Text = buf;
-	}
-	else {
-		t = (double)t * 24;
-		if ((double)t > 1) {
-			buf = IntToStr((int)t) + " hours, ";
-			i = RoundInt(Frac((double)t) * 60);
-			if (i > 1)
-				buf = buf + IntToStr(i) + " minutes...";
-			else
-				buf = buf + IntToStr(i) + " minute...";
-			FTCountDown->Text = buf;
-		}
-		else {
-			t = (double)t * 60;
-			i = RoundInt(((double)t - Floor(t)) * 60);
-			FTCountDown->Text = IntToStr((int)t) + " minutes, " + IntToStr(i) +
-				" seconds...";
-		}
-	}
+        FTCongratulations->Text = "Merry Christmas!";
+    } else {
+        t = EncodeDate(y + 1, 01, 01) - Now();
+        FTCongratulations->Text = "Happy New Year!";
+        FTYear->Text = IntToStr(y + 1);
+    }
+
+    if ((double)t < 0)
+        FTCountDown->Text = "Merry Christmas!";
+    if (((double)t < 1) && ((double)t > -1))
+        DCGifts->Visible = true;
+    if ((double)t >= 2) {
+        buf = IntToStr(Floor((double)t)) + " days, ";
+        i = (Int)(Frac((double)t) * 24);
+        if (i > 1)
+            buf = buf + IntToStr(i) + " hours...";
+        else
+            buf = buf + IntToStr(i) + " hour...";
+        FTCountDown->Text = buf;
+    } else {
+        t = (double)t * 24;
+        if ((double)t > 1) {
+            buf = IntToStr((int)t) + " hours, ";
+            i = RoundInt(Frac((double)t) * 60);
+            if (i > 1)
+                buf = buf + IntToStr(i) + " minutes...";
+            else
+                buf = buf + IntToStr(i) + " minute...";
+            FTCountDown->Text = buf;
+        } else {
+            t = (double)t * 60;
+            i = RoundInt(((double)t - Floor(t)) * 60);
+            FTCountDown->Text =
+                IntToStr((int)t) + " minutes, " + IntToStr(i) + " seconds...";
+        }
+    }
 }
 
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::CadencerProgress(TObject *Sender,
-	const double deltaTime, const double newTime) {
-	fireLight = ClampValue(fireLight + Random() * 0.4 - 0.2, 0, 1);
-	LSFire->Diffuse->Color = VectorLerp(clrYellow, VectorMake(0.5, 0, 0, 1),
-		fireLight);
-	LSFire->Position->Y = fireLight * 0.1;
-
-	if (inPreview)
-		HUDSprite->Visible = false;
-	if (Visible) {
-		HUDSprite->Material->FrontProperties->Diffuse->Alpha =
-			HUDSprite->Material->FrontProperties->Diffuse->Alpha -
-			deltaTime * 0.05;
-		if (HUDSprite->Material->FrontProperties->Diffuse->Alpha < 0.01)
-			HUDSprite->Visible = false;
-	}
-	DCFirTree->Turn(deltaTime);
-	Viewer->Invalidate();
+void __fastcall TForm1::CadencerProgress(
+    TObject* Sender, const double deltaTime, const double newTime)
+{
+    fireLight = ClampValue(fireLight + Random() * 0.4 - 0.2, 0, 1);
+    LSFire->Diffuse->Color =
+        VectorLerp(clrYellow, VectorMake(0.5, 0, 0, 1), fireLight);
+    LSFire->Position->Y = fireLight * 0.1;
+
+    if (inPreview)
+        HUDSprite->Visible = false;
+    if (Visible) {
+        HUDSprite->Material->FrontProperties->Diffuse->Alpha =
+            HUDSprite->Material->FrontProperties->Diffuse->Alpha -
+            deltaTime * 0.05;
+        if (HUDSprite->Material->FrontProperties->Diffuse->Alpha < 0.01)
+            HUDSprite->Visible = false;
+    }
+    DCFirTree->Turn(deltaTime);
+    Viewer->Invalidate();
 }
 
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::FormResize(TObject *Sender) {
-	Camera->SceneScale = (float)Width / 640;
-	if (Visible)
-		HUDSprite->Position->X = Width - 200;
-	if (Width >= Screen->Width)
-		ViewerDblClick(Sender);
+void __fastcall TForm1::FormResize(TObject* Sender)
+{
+    Camera->SceneScale = (float)Width / 640;
+    if (Visible)
+        HUDSprite->Position->X = Width - 200;
+    if (Width >= Screen->Width)
+        ViewerDblClick(Sender);
 }
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::FormKeyPress(TObject *Sender, System::WideChar &Key) {
-	Key = '\0';
-	Application->Terminate();
+void __fastcall TForm1::FormKeyPress(TObject* Sender, System::WideChar &Key)
+{
+    Key = '\0';
+    Application->Terminate();
 }
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::ViewerDblClick(TObject *Sender) {
-	if ((!inPreview) && (!inSaver) && (!Application->Terminated) &&
-		(BorderStyle != bsNone)) {
-		BorderStyle = bsNone;
-		FormStyle = fsStayOnTop;
-		Align = alClient;
-	}
+void __fastcall TForm1::ViewerDblClick(TObject* Sender)
+{
+    if ((!inPreview) && (!inSaver) && (!Application->Terminated) &&
+        (BorderStyle != bsNone))
+    {
+        BorderStyle = bsNone;
+        FormStyle = fsStayOnTop;
+        Align = alClient;
+    }
 }
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::ScreenSaverCloseQuery(TObject *Sender, bool &CanClose)
+void __fastcall TForm1::ScreenSaverCloseQuery(TObject* Sender, bool &CanClose)
 
 {
-	Application->Terminate();
-	CanClose = false;
+    Application->Terminate();
+    CanClose = false;
 }
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::ScreenSaverExecute(TObject *Sender) {
-	inSaver = true;
+void __fastcall TForm1::ScreenSaverExecute(TObject* Sender)
+{
+    inSaver = true;
 }
 // ---------------------------------------------------------------------------
 
-void __fastcall TForm1::ScreenSaverPreview(TObject *Sender, HWND previewHwnd) {
-	inPreview = true;
+void __fastcall TForm1::ScreenSaverPreview(TObject* Sender, HWND previewHwnd)
+{
+    inPreview = true;
 }
 
 // ---------------------------------------------------------------------------
-void __fastcall TForm1::FormMouseWheel(TObject *Sender, TShiftState Shift,
-	int WheelDelta, TPoint &MousePos, bool &Handled) {
-	Camera->AdjustDistanceToTarget(Power(1.1, WheelDelta / 120));
+void __fastcall TForm1::FormMouseWheel(TObject* Sender, TShiftState Shift,
+    int WheelDelta, TPoint &MousePos, bool &Handled)
+{
+    Camera->AdjustDistanceToTarget(Power(1.1, WheelDelta / 120));
 }
 // ---------------------------------------------------------------------------
+

+ 84 - 82
AdvDemos/Christmas/fChrismasC.h

@@ -37,98 +37,100 @@
 #include "GLS.ThorFX.hpp"
 #include "GLS.FireFX.hpp"
 #include "GLS.BaseClasses.hpp"
+#include "GLS.Utils.hpp"
 
 //-----------------
 
 class TForm1 : public TForm
 {
-__published:	// IDE-managed Components
-	TGLSceneViewer *Viewer;
-	TGLSMBASS *GLSMBASS;
-	TGLScene *Scene;
-	TGLFreeForm *FFFirePlace;
-	TGLDummyCube *DCFire;
-	TGLLightSource *LSFire;
-	TGLDummyCube *DCFireSource;
-	TGLCylinder *CYLog;
-	TGLDummyCube *DCFirTree;
-	TGLDummyCube *DCTree;
-	TGLFreeForm *FFFirTree;
-	TGLProxyObject *POFirTree2;
-	TGLProxyObject *POFirTree3;
-	TGLCube *GLCube3;
-	TGLCube *GLCube4;
-	TGLDummyCube *DCDecoWhite;
-	TGLProxyObject *POWhiteBall1;
-	TGLProxyObject *POWhiteBall2;
-	TGLProxyObject *POWhiteBall3;
-	TGLDummyCube *DCDecoGold;
-	TGLProxyObject *POGoldBall1;
-	TGLProxyObject *POGoldBall2;
-	TGLProxyObject *POGoldBall3;
-	TGLDummyCube *DCLensFlares;
-	TGLLensFlare *GLLensFlare1;
-	TGLLensFlare *GLLensFlare2;
-	TGLLensFlare *GLLensFlare3;
-	TGLLensFlare *GLLensFlare4;
-	TGLLensFlare *GLLensFlare5;
-	TGLLensFlare *GLLensFlare6;
-	TGLDummyCube *DCGifts;
-	TGLCube *GLCube1;
-	TGLCube *GLCube2;
-	TGLShadowPlane *ShadowPlane;
-	TGLFlatText *FTCountDown;
-	TGLLensFlare *LSFireLens;
-	TGLLightSource *LSRoom;
-	TGLDummyCube *DCCameraTarget;
-	TGLParticleFXRenderer *ParticleFXRenderer;
-	TGLDummyCube *DCBalls;
-	TGLSphere *SPWhiteBall;
-	TGLSphere *SPGoldBall;
-	TGLHUDSprite *HUDSprite;
-	TGLCamera *Camera;
-	TTimer *Timer;
-	TGLCadencer *Cadencer;
-	TGLMaterialLibrary *MaterialLibrary;
-	TGLPolygonPFXManager *PFXFire;
-	TGLSoundLibrary *SoundLibrary;
-	TGLPolygonPFXManager *PFXTree;
-	TGLWindowsBitmapFont *WindowsBitmapFont;
-	TGLScreenSaver *ScreenSaver;
-	TGLFlatText *FTCongratulations;
-	TGLFlatText *FTYear;
-	TGLFireFXManager *GLFireFXManager1;
-//	TScreenSaver *ScreenSaver;
-	void __fastcall FormCreate(TObject *Sender);
-	void __fastcall ViewerMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
-          int X, int Y);
-	void __fastcall ViewerMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
-	void __fastcall TimerTimer(TObject *Sender);
-	void __fastcall CadencerProgress(TObject *Sender, const double deltaTime, const double newTime);
-	void __fastcall FormResize(TObject *Sender);
-	void __fastcall FormKeyPress(TObject *Sender, System::WideChar &Key);
-//	void __fastcall ScreenSaverCloseQuery(TObject *Sender, bool &CanClose);
-//	void __fastcall ScreenSaverPreview(TObject *Sender, HWND previewHwnd);
-//	void __fastcall ScreenSaverExecute(TObject *Sender);
-//	void __fastcall ScreenSaverPropertiesRequested(TObject *Sender);
-	void __fastcall ViewerDblClick(TObject *Sender);
-	void __fastcall ScreenSaverCloseQuery(TObject *Sender, bool &CanClose);
-	void __fastcall ScreenSaverExecute(TObject *Sender);
-	void __fastcall ScreenSaverPreview(TObject *Sender, HWND previewHwnd);
-	void __fastcall FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta,
-          TPoint &MousePos, bool &Handled);
-
-
-private:	// User declarations
+  __published: // IDE-managed Components
+    TGLSceneViewer* Viewer;
+    TGLSMBASS* GLSMBASS;
+    TGLScene* Scene;
+    TGLFreeForm* FFFirePlace;
+    TGLDummyCube* DCFire;
+    TGLLightSource* LSFire;
+    TGLDummyCube* DCFireSource;
+    TGLCylinder* CYLog;
+    TGLDummyCube* DCFirTree;
+    TGLDummyCube* DCTree;
+    TGLFreeForm* FFFirTree;
+    TGLProxyObject* POFirTree2;
+    TGLProxyObject* POFirTree3;
+    TGLCube* GLCube3;
+    TGLCube* GLCube4;
+    TGLDummyCube* DCDecoWhite;
+    TGLProxyObject* POWhiteBall1;
+    TGLProxyObject* POWhiteBall2;
+    TGLProxyObject* POWhiteBall3;
+    TGLDummyCube* DCDecoGold;
+    TGLProxyObject* POGoldBall1;
+    TGLProxyObject* POGoldBall2;
+    TGLProxyObject* POGoldBall3;
+    TGLDummyCube* DCLensFlares;
+    TGLLensFlare* GLLensFlare1;
+    TGLLensFlare* GLLensFlare2;
+    TGLLensFlare* GLLensFlare3;
+    TGLLensFlare* GLLensFlare4;
+    TGLLensFlare* GLLensFlare5;
+    TGLLensFlare* GLLensFlare6;
+    TGLDummyCube* DCGifts;
+    TGLCube* GLCube1;
+    TGLCube* GLCube2;
+    TGLShadowPlane* ShadowPlane;
+    TGLFlatText* FTCountDown;
+    TGLLensFlare* LSFireLens;
+    TGLLightSource* LSRoom;
+    TGLDummyCube* DCCameraTarget;
+    TGLParticleFXRenderer* ParticleFXRenderer;
+    TGLDummyCube* DCBalls;
+    TGLSphere* SPWhiteBall;
+    TGLSphere* SPGoldBall;
+    TGLHUDSprite* HUDSprite;
+    TGLCamera* Camera;
+    TTimer* Timer;
+    TGLCadencer* Cadencer;
+    TGLMaterialLibrary* MaterialLibrary;
+    TGLPolygonPFXManager* PFXFire;
+    TGLSoundLibrary* SoundLibrary;
+    TGLPolygonPFXManager* PFXTree;
+    TGLWindowsBitmapFont* WindowsBitmapFont;
+    TGLScreenSaver* ScreenSaver;
+    TGLFlatText* FTCongratulations;
+    TGLFlatText* FTYear;
+    TGLFireFXManager* GLFireFXManager1;
+    //	TScreenSaver *ScreenSaver;
+    void __fastcall FormCreate(TObject* Sender);
+    void __fastcall ViewerMouseDown(
+        TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
+    void __fastcall ViewerMouseMove(
+        TObject* Sender, TShiftState Shift, int X, int Y);
+    void __fastcall TimerTimer(TObject* Sender);
+    void __fastcall CadencerProgress(
+        TObject* Sender, const double deltaTime, const double newTime);
+    void __fastcall FormResize(TObject* Sender);
+    void __fastcall FormKeyPress(TObject* Sender, System::WideChar &Key);
+    //	void __fastcall ScreenSaverCloseQuery(TObject *Sender, bool &CanClose);
+    //	void __fastcall ScreenSaverPreview(TObject *Sender, HWND previewHwnd);
+    //	void __fastcall ScreenSaverExecute(TObject *Sender);
+    //	void __fastcall ScreenSaverPropertiesRequested(TObject *Sender);
+    void __fastcall ViewerDblClick(TObject* Sender);
+    void __fastcall ScreenSaverCloseQuery(TObject* Sender, bool &CanClose);
+    void __fastcall ScreenSaverExecute(TObject* Sender);
+    void __fastcall ScreenSaverPreview(TObject* Sender, HWND previewHwnd);
+    void __fastcall FormMouseWheel(TObject* Sender, TShiftState Shift,
+        int WheelDelta, TPoint &MousePos, bool &Handled);
+  private: // User declarations
 	int mx, my;
 	float fireLight;
 	bool inPreview, inSaver;
 	Cardinal bStream;
-
-public:		// User declarations
-	__fastcall TForm1(TComponent* Owner);
+	TFileName Path;
+  public: // User declarations
+    __fastcall TForm1(TComponent* Owner);
 };
 //---------------------------------------------------------------------------
-extern PACKAGE TForm1 *Form1;
+extern PACKAGE TForm1* Form1;
 //---------------------------------------------------------------------------
 #endif
+

+ 15 - 12
AdvDemos/Christmas/fChrismasD.pas

@@ -43,7 +43,8 @@ uses
   Sounds.BASS,
   Sounds.BASSImport,
   GLS.FireFX,
-  GLS.FileWAV;
+  GLS.FileWAV,
+  GLS.Utils;
 
 type
   TMain = class(TForm)
@@ -120,11 +121,12 @@ type
     procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
       WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
   public
+    Path: TFileName;
     mx, my: Integer;
     FireLight: Single;
     inPreview, inSaver: Boolean;
     bStream: Cardinal;
-    function LoadTexture(Matname, Filename: string): TGLLibMaterial;
+    function LoadCubemap(Matname, Filename: string): TGLLibMaterial;
   end;
 
 var
@@ -134,7 +136,7 @@ implementation
 
 {$R *.dfm}
 
-function TMain.LoadTexture(Matname, Filename: string): TGLLibMaterial;
+function TMain.LoadCubemap(Matname, Filename: string): TGLLibMaterial;
 begin
   Result := MaterialLibraryCM.AddTextureMaterial(Matname, Filename);
   Result.Material.Texture.Disabled := False;
@@ -142,22 +144,23 @@ begin
 end;
 
 procedure TMain.FormCreate(Sender: TObject);
-var
-  DataPath: String;
 begin
+  Path := GetCurrentAssetPath();
 
   Randomize;
-  DataPath := ExtractFilePath(ParamStr(0)) + 'data';
-  SetCurrentDir(DataPath);
-
-  // Skybox textures
-  //...
-
+  // Load static models
+  SetCurrentDir(Path + '\model');
   FFFirTree.LoadFromFile('firtree.3ds');
   FFFirePlace.LoadFromFile('fireplace.3ds');
 
+  // Loading cubemaps from .dds files to TGLComposite image
+  //... LoadCubemap(); // not implemented
+
   FireLight := 0.5;
   FTYear.Text := '';
+
+  // Set current dir for audio files
+  SetCurrentDir(Path + '\audio');
 end;
 
 procedure TMain.FormResize(Sender: TObject);
@@ -242,7 +245,7 @@ var
   isArrived: Boolean;
 
 begin
-  TheChristmas := False;
+  TheChristmas := true;   // Merry Christmas or Happy New Year!
   Caption := Format('%.1f FPS', [Viewer.FramesPerSecond]);
   Viewer.ResetPerformanceMonitor;
   if SMBASS.Active and (bStream = 0) then

BIN
AdvDemos/Earth/Data/land_ocean_ice_4096.jpg


BIN
AdvDemos/Earth/Data/land_ocean_ice_lights_4096.jpg


BIN
AdvDemos/Earth/Data/moon_2048.jpg


+ 29 - 27
AdvDemos/Earth/EarthC.cbproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{CEB401C0-A824-48EF-A74E-CDF2EED20F5E}</ProjectGuid>
-        <ProjectVersion>19.3</ProjectVersion>
+        <ProjectVersion>19.4</ProjectVersion>
         <FrameworkType>VCL</FrameworkType>
         <AppType>Application</AppType>
         <MainSource>EarthC.cpp</MainSource>
@@ -9,6 +9,7 @@
         <Config Condition="'$(Config)'==''">Debug</Config>
         <Platform Condition="'$(Platform)'==''">Win32</Platform>
         <TargetedPlatforms>1</TargetedPlatforms>
+        <CC_Suffix Condition="'$(CC_Suffix)'==''">c</CC_Suffix>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <Base>true</Base>
@@ -108,6 +109,7 @@
         <AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
         <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
         <LinkPackageImports>rtl.bpi;vcl.bpi</LinkPackageImports>
+        <ILINK_LibraryPath>$(BDSLIB)\$(PLATFORM)$(CC_SUFFIX)\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2)'!=''">
         <Defines>NDEBUG;$(Defines)</Defines>
@@ -157,59 +159,59 @@
                 </Source>
             </CPlusPlusBuilder.Personality>
             <Deployment Version="3">
-                <DeployFile LocalName=".\Win32\Debug\EarthC.exe" Configuration="Debug" Class="ProjectOutput">
-                    <Platform Name="Win32">
-                        <RemoteName>EarthC.exe</RemoteName>
+                <DeployFile Condition="'$(UsingDelphiRTL)'=='true'" LocalName="$(BDS)\bin64\borlndmm.dll" Class="DependencyModule">
+                    <Platform Name="Win64">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true'" LocalName="$(BDS)\Redist\osx32\libcgstl.dylib" Class="DependencyModule">
-                    <Platform Name="OSX32">
+                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin64\cc64280.dll" Class="DependencyModule">
+                    <Platform Name="Win64">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32280mt.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
+                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin64\cc64280mt.dll" Class="DependencyModule">
+                    <Platform Name="Win64">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true'" LocalName="$(BDS)\Redist\osx32\libcgcrtl.dylib" Class="DependencyModule">
-                    <Platform Name="OSX32">
+                <DeployFile Condition="'$(UsingDelphiRTL)'=='true'" LocalName="$(BDS)\bin\borlndmm.dll" Class="DependencyModule">
+                    <Platform Name="Win32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32c280mt.dll" Class="DependencyModule">
+                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32280.dll" Class="DependencyModule">
                     <Platform Name="Win32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(UsingDelphiRTL)'=='true'" LocalName="$(BDS)\bin\borlndmm.dll" Class="DependencyModule">
+                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32280mt.dll" Class="DependencyModule">
                     <Platform Name="Win32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin64\cc64280.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
+                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32c280.dll" Class="DependencyModule">
+                    <Platform Name="Win32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32280.dll" Class="DependencyModule">
+                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin\cc32c280mt.dll" Class="DependencyModule">
                     <Platform Name="Win32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'!='true'" LocalName="$(BDS)\bin\cc32c280.dll" Class="DependencyModule">
-                    <Platform Name="Win32">
+                <DeployFile Condition="'$(DynamicRTL)'=='true'" LocalName="$(BDS)\Redist\osx32\libcgcrtl.dylib" Class="DependencyModule">
+                    <Platform Name="OSX32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(UsingDelphiRTL)'=='true'" LocalName="$(BDS)\bin64\borlndmm.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
+                <DeployFile Condition="'$(DynamicRTL)'=='true'" LocalName="$(BDS)\Redist\osx32\libcgstl.dylib" Class="DependencyModule">
+                    <Platform Name="OSX32">
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
-                <DeployFile Condition="'$(DynamicRTL)'=='true' And '$(Multithreaded)'=='true'" LocalName="$(BDS)\bin64\cc64280mt.dll" Class="DependencyModule">
-                    <Platform Name="Win64">
+                <DeployFile LocalName=".\Win32\Debug\EarthC.exe" Configuration="Debug" Class="ProjectOutput">
+                    <Platform Name="Win32">
+                        <RemoteName>EarthC.exe</RemoteName>
                         <Overwrite>true</Overwrite>
                     </Platform>
                 </DeployFile>
@@ -1018,17 +1020,17 @@
                         <Operation>1</Operation>
                     </Platform>
                 </DeployClass>
+                <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
+                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
+                <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
                 <ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
                 <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
-                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
-                <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
             </Deployment>
             <Platforms>
                 <Platform value="Win32">True</Platform>

+ 5 - 6
AdvDemos/Earth/fEarthC.dfm

@@ -1,15 +1,14 @@
 object Form3: TForm3
   Left = 0
   Top = 0
-  Caption = 'Form3'
-  ClientHeight = 629
-  ClientWidth = 898
+  Caption = 'Earth'
+  ClientHeight = 503
+  ClientWidth = 673
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
-  Font.Height = -15
+  Font.Height = -12
   Font.Name = 'Segoe UI'
   Font.Style = []
-  PixelsPerInch = 120
-  TextHeight = 20
+  TextHeight = 15
 end

+ 10 - 13
AdvDemos/Earth/fEarthD.dfm

@@ -2,12 +2,12 @@ object Form1: TForm1
   Left = 412
   Top = 123
   Caption = 'Earth'
-  ClientHeight = 684
-  ClientWidth = 879
+  ClientHeight = 568
+  ClientWidth = 775
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
-  Font.Height = -14
+  Font.Height = -11
   Font.Name = 'MS Sans Serif'
   Font.Style = []
   KeyPreview = True
@@ -15,27 +15,24 @@ object Form1: TForm1
   OnCreate = FormCreate
   OnKeyPress = FormKeyPress
   OnMouseWheel = FormMouseWheel
-  PixelsPerInch = 120
-  TextHeight = 16
+  TextHeight = 13
   object GLSceneViewer: TGLSceneViewer
     Left = 0
     Top = 0
-    Width = 879
-    Height = 684
-    Margins.Left = 4
-    Margins.Top = 4
-    Margins.Right = 4
-    Margins.Bottom = 4
+    Width = 775
+    Height = 568
     Camera = Camera
     BeforeRender = GLSceneViewerBeforeRender
     Buffer.BackgroundColor = clBlack
-    FieldOfView = 153.668411254882800000
+    FieldOfView = 148.535995483398400000
     PenAsTouch = False
     Align = alClient
     OnDblClick = GLSceneViewerDblClick
     OnMouseDown = GLSceneViewerMouseDown
     OnMouseMove = GLSceneViewerMouseMove
     TabOrder = 0
+    ExplicitWidth = 739
+    ExplicitHeight = 559
   end
   object Scene: TGLScene
     ObjectsSorting = osNone
@@ -75,7 +72,7 @@ object Form1: TForm1
     object dcEarth: TGLDummyCube
       ObjectsSorting = osNone
       CubeSize = 1.000000000000000000
-      object CameraControler: TGLCamera
+      object Cameracontroller: TGLCamera
         DepthOfView = 100.000000000000000000
         FocalLength = 50.000000000000000000
         TargetObject = dcEarth

+ 81 - 86
AdvDemos/Earth/fEarthD.pas

@@ -35,7 +35,6 @@ uses
   GLSL.TextureShaders,
   GLS.BaseClasses;
 
-
 type
   TForm1 = class(TForm)
     Scene: TGLScene;
@@ -52,21 +51,19 @@ type
     GLLensFlare1: TGLLensFlare;
     MatLib: TGLMaterialLibrary;
     EarthCombiner: TGLTexCombineShader;
-    CameraControler: TGLCamera;
+    Cameracontroller: TGLCamera;
     SkyDome: TGLSkyDome;
     ConstellationLines: TGLLines;
     ConstellationBorders: TGLLines;
     procedure FormCreate(Sender: TObject);
     procedure DirectOpenGLRender(Sender: TObject; var rci: TGLRenderContextInfo);
     procedure Timer1Timer(Sender: TObject);
-    procedure CadencerProgress(Sender: TObject; const deltaTime,
-      newTime: Double);
-    procedure GLSceneViewerMouseDown(Sender: TObject;
-      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
-    procedure GLSceneViewerMouseMove(Sender: TObject; Shift: TShiftState;
+    procedure CadencerProgress(Sender: TObject; const deltaTime, newTime: Double);
+    procedure GLSceneViewerMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
       X, Y: Integer);
-    procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
-      WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
+    procedure GLSceneViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
+    procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer;
+      MousePos: TPoint; var Handled: Boolean);
     procedure GLSceneViewerDblClick(Sender: TObject);
     procedure FormKeyPress(Sender: TObject; var Key: Char);
     procedure GLSceneViewerBeforeRender(Sender: TObject);
@@ -80,6 +77,7 @@ type
     sunPos, eyePos, lightingVector: TGLVector;
     diskNormal, diskRight, diskUp: TGLVector;
   private
+    Path: TFileName;
     function LonLatToPos(lon, lat: Single): TAffineVector;
     procedure LoadConstellationLines;
     function AtmosphereColor(const rayStart, rayEnd: TGLVector): TGLColorVector;
@@ -95,28 +93,28 @@ const
   cAtmosphereRadius: Single = 0.55;
   // use value slightly lower than actual radius, for antialiasing effect
   cPlanetRadius: Single = 0.495;
-  cLowAtmColor: TGLColorVector = (X:1; Y:1; Z:1; W:1);
-  cHighAtmColor: TGLColorVector = (X:0; Y:0; Z:1; W:1);
-  cIntDivTable: array[2..20] of Single =
-    (1 / 2, 1 / 3, 1 / 4, 1 / 5, 1 / 6, 1 / 7, 1 / 8, 1 / 9, 1 / 10,
-    1 / 11, 1 / 12, 1 / 13, 1 / 14, 1 / 15, 1 / 16, 1 / 17, 1 / 18, 1 / 19, 1 / 20);
+  cLowAtmColor: TGLColorVector = (X: 1; Y: 1; Z: 1; W: 1);
+  cHighAtmColor: TGLColorVector = (X: 0; Y: 0; Z: 1; W: 1);
+  cIntDivTable: array [2 .. 20] of Single = (1 / 2, 1 / 3, 1 / 4, 1 / 5, 1 / 6, 1 / 7, 1 / 8, 1 / 9,
+    1 / 10, 1 / 11, 1 / 12, 1 / 13, 1 / 14, 1 / 15, 1 / 16, 1 / 17, 1 / 18, 1 / 19, 1 / 20);
 
-//-----------------------------------------
+// -----------------------------------------
 implementation
-//-----------------------------------------
+// -----------------------------------------
 
 {$R *.dfm}
 
 uses
-// accurate movements left for later... or the astute reader
+  // accurate movements left for later... or the astute reader
   USolarSystem;
 
 procedure TForm1.FormCreate(Sender: TObject);
 var
-  FileName: String;
+  FileName: TFileName;
 begin
-  SetCurrentDir(ExtractFilePath(ParamStr(0)));
-  FileName := 'Data\Yale_BSC.stars';
+  Path := GetCurrentAssetPath();
+  SetCurrentDir(Path + '\Data');
+  FileName := 'Yale_BSC.stars';
   SkyDome.Bands.Clear;
   if FileExists(FileName) then
     SkyDome.Stars.LoadStarsFile(FileName);
@@ -132,8 +130,7 @@ begin
   MatLib.Materials[0].Texture2Name := 'earthNight';
 end;
 
-function TForm1.AtmosphereColor(const rayStart, rayEnd: TGLVector)
-  : TGLColorVector;
+function TForm1.AtmosphereColor(const rayStart, rayEnd: TGLVector): TGLColorVector;
 var
   i, n: Integer;
   atmPoint, normal: TGLVector;
@@ -178,7 +175,7 @@ begin
   Result.W := n * contrib * cOpacity * 0.1;
 end;
 
-//---------------------------------------------------------
+// ---------------------------------------------------------
 //
 function TForm1.ComputeColor(var rayDest: TGLVector; mayHitGround: Boolean): TGLColorVector;
 var
@@ -186,12 +183,11 @@ var
   rayVector: TGLVector;
 begin
   rayVector := VectorNormalize(VectorSubtract(rayDest, eyePos));
-  if RayCastSphereIntersect(eyePos, rayVector, NullHmgPoint, cAtmosphereRadius,
-    ai1, ai2) > 1 then
+  if RayCastSphereIntersect(eyePos, rayVector, NullHmgPoint, cAtmosphereRadius, ai1, ai2) > 1 then
   begin
     // atmosphere hit
-    if mayHitGround and (RayCastSphereIntersect(eyePos, rayVector, NullHmgPoint,
-      cPlanetRadius, pi1, pi2) > 0) then
+    if mayHitGround and (RayCastSphereIntersect(eyePos, rayVector, NullHmgPoint, cPlanetRadius, pi1,
+      pi2) > 0) then
     begin
       // hit ground
       Result := AtmosphereColor(ai1, pi1);
@@ -207,14 +203,13 @@ begin
     Result := clrTransparent;
 end;
 
-
 procedure TForm1.DirectOpenGLRender(Sender: TObject; var rci: TGLRenderContextInfo);
 
 const
   cSlices = 60;
 var
   i, j, k0, k1: Integer;
-  cosCache, sinCache: array[0..cSlices] of Single;
+  cosCache, sinCache: array [0 .. cSlices] of Single;
   pVertex, pColor: PVectorArray;
 begin
   sunPos := LSSun.AbsolutePosition;
@@ -249,8 +244,7 @@ begin
     k1 := (cSlices + 1) - k0;
     for j := 0 to cSlices do
     begin
-      VectorCombine(diskRight, diskUp, cosCache[j] * radius, sinCache[j] * radius,
-        pVertex[k0 + j]);
+      VectorCombine(diskRight, diskUp, cosCache[j] * radius, sinCache[j] * radius, pVertex[k0 + j]);
       if i < 13 then
         pColor[k0 + j] := ComputeColor(pVertex[k0 + j], i <= 7);
       if i = 0 then
@@ -323,17 +317,17 @@ var
 begin
   sl := TStringList.Create;
   line := TStringList.Create;
-  sl.LoadFromFile('Data\Constellations.dat');
-///  sl.LoadFromFile('Data\Constellation_borders.dat');
+  sl.LoadFromFile('Constellations.dat');
+  /// sl.LoadFromFile('Constellation_borders.dat');
   for i := 0 to sl.Count - 1 do
   begin
     line.CommaText := sl[i];
     pos1 := LonLatToPos(StrToFloatDef(line[0], 0), StrToFloatDef(line[1], 0));
     ConstellationLines.AddNode(pos1);
-///     ConstellationBorders.AddNode(pos1);
+    /// ConstellationBorders.AddNode(pos1);
     pos2 := LonLatToPos(StrToFloatDef(line[2], 0), StrToFloatDef(line[3], 0));
     ConstellationLines.AddNode(pos2);
-///    ConstellationBorders.AddNode(pos2);
+    /// ConstellationBorders.AddNode(pos2);
   end;
   sl.Free;
   line.Free;
@@ -345,83 +339,80 @@ begin
   GLSceneViewer.ResetPerformanceMonitor;
 end;
 
-procedure TForm1.CadencerProgress(Sender: TObject; const deltaTime,
-  newTime: Double);
-//var
-//   d : Double;
-//   p : TAffineVector;
+procedure TForm1.CadencerProgress(Sender: TObject; const deltaTime, newTime: Double);
+// var
+// d : Double;
+// p : TAffineVector;
 begin
-  //   d:=GMTDateTimeToJulianDay(Now-2+newTime*timeMultiplier);
+  // d := GMTDateTimeToJulianDay(Now-2+newTime*timeMultiplier);
   // make earth rotate
-  SPEarth.TurnAngle := SPEarth.TurnAngle + deltaTime * timeMultiplier;
-  {   p:=ComputePlanetPosition(cSunOrbitalElements, d);
-     ScaleVector(p, 0.5*cAUToKilometers*(1/cEarthRadius));
-     LSSun.Position.AsAffineVector:=p; }
+  SPEarth.TurnAngle := SPEarth.TurnAngle + deltaTime * TimeMultiplier;
+  { p := ComputePlanetPosition(cSunOrbitalElements, d);
+    ScaleVector(p, 0.5*cAUToKilometers*(1/cEarthRadius));
+    LSSun.Position.AsAffineVector:=p; }
 
   // moon rotates on itself and around earth (not sure about the rotation direction!)
 
-  {   p:=ComputePlanetPosition(cMoonOrbitalElements, d);
-     ScaleVector(p, 0.5*cAUToKilometers*(1/cEarthRadius)); }
+  { p := ComputePlanetPosition(cMoonOrbitalElements, d);
+    ScaleVector(p, 0.5*cAUToKilometers*(1/cEarthRadius)); }
 
-  DCMoon.TurnAngle := DCMoon.TurnAngle + deltaTime * timeMultiplier / 29.5;
+  DCMoon.TurnAngle := DCMoon.TurnAngle + deltaTime * TimeMultiplier / 29.5;
   SPMoon.TurnAngle := 180 - DCMoon.TurnAngle;
 
   // honour camera movements
   if (dmy <> 0) or (dmx <> 0) then
   begin
-    CameraControler.MoveAroundTarget(ClampValue(dmy * 0.3, -5, 5),
-      ClampValue(dmx * 0.3, -5, 5));
+    Cameracontroller.MoveAroundTarget(ClampValue(dmy * 0.3, -5, 5), ClampValue(dmx * 0.3, -5, 5));
     dmx := 0;
     dmy := 0;
   end;
   // this gives us smoother camera movements
-  cameraTimeSteps := cameraTimeSteps + deltaTime;
-  while cameraTimeSteps > 0.005 do
+  CameraTimeSteps := CameraTimeSteps + deltaTime;
+  while CameraTimeSteps > 0.005 do
   begin
     Camera.Position.AsVector := VectorLerp(Camera.Position.AsVector,
-      CameraControler.Position.AsVector, 0.05);
+      Cameracontroller.Position.AsVector, 0.05);
     CameraTimeSteps := CameraTimeSteps - 0.005;
   end;
   // smooth constellation appearance/disappearance
-  if ConstellationLines.LineColor.Alpha <> constellationsAlpha then
+  if ConstellationLines.LineColor.Alpha <> ConstellationsAlpha then
   begin
     ConstellationLines.LineColor.Alpha :=
-      ClampValue(ConstellationLines.LineColor.Alpha + Sign(constellationsAlpha -
-                 ConstellationLines.LineColor.Alpha) * deltaTime, 0, 0.5);
+      ClampValue(ConstellationLines.LineColor.Alpha +
+      Sign(ConstellationsAlpha - ConstellationLines.LineColor.Alpha) * deltaTime, 0, 0.5);
     ConstellationLines.Visible := (ConstellationLines.LineColor.Alpha > 0);
   end;
 end;
 
-procedure TForm1.GLSceneViewerMouseDown(Sender: TObject;
-  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+procedure TForm1.GLSceneViewerMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
+  X, Y: Integer);
 begin
-  mx := x;
-  my := y;
+  mx := X;
+  my := Y;
 end;
 
-procedure TForm1.GLSceneViewerMouseMove(Sender: TObject;
-  Shift: TShiftState; X, Y: Integer);
+procedure TForm1.GLSceneViewerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
 begin
   if Shift = [ssLeft] then
   begin
-    dmx := dmx + (mx - x);
-    dmy := dmy + (my - y);
+    dmx := dmx + (mx - X);
+    dmy := dmy + (my - Y);
   end
   else if Shift = [ssRight] then
-    Camera.FocalLength := Camera.FocalLength * Power(1.05, (my - y) * 0.1);
-  mx := x;
-  my := y;
+    Camera.FocalLength := Camera.FocalLength * Power(1.05, (my - Y) * 0.1);
+  mx := X;
+  my := Y;
 end;
 
-procedure TForm1.FormMouseWheel(Sender: TObject; Shift: TShiftState;
-  WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
+procedure TForm1.FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer;
+  MousePos: TPoint; var Handled: Boolean);
 var
   f: Single;
 begin
-  if (WheelDelta > 0) or (CameraControler.Position.VectorLength > 0.90) then
+  if (WheelDelta > 0) or (Cameracontroller.Position.VectorLength > 0.90) then
   begin
     f := Power(1.05, WheelDelta * (1 / 120));
-    CameraControler.AdjustDistanceToTarget(f);
+    Cameracontroller.AdjustDistanceToTarget(f);
   end;
   Handled := True;
 end;
@@ -446,42 +437,44 @@ procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
 
   procedure LoadHighResTexture(LibMat: TGLLibMaterial; const FileName: string);
   begin
-    if FileExists(fileName) then
+    if FileExists(FileName) then
     begin
       LibMat.Material.Texture.Compression := tcStandard;
-      LibMat.Material.Texture.Image.LoadFromFile(fileName);
+      LibMat.Material.Texture.Image.LoadFromFile(FileName);
     end;
   end;
 
 begin
   case Key of
-    #27: Close;
+    #27:
+      Close;
     'm', 'M':
       begin
         Camera.MoveTo(SPMoon);
-        CameraControler.MoveTo(SPMoon);
+        Cameracontroller.MoveTo(SPMoon);
         Camera.TargetObject := SPMoon;
-        CameraControler.TargetObject := SPMoon;
+        Cameracontroller.TargetObject := SPMoon;
       end;
     'e', 'E':
       begin
         Camera.MoveTo(dcEarth);
-        CameraControler.MoveTo(dcEarth);
+        Cameracontroller.MoveTo(dcEarth);
         Camera.TargetObject := dcEarth;
-        CameraControler.TargetObject := dcEarth;
+        Cameracontroller.TargetObject := dcEarth;
       end;
-    'h': if not highResResourcesLoaded then
+    'h':
+      if not HighResResourcesLoaded then
       begin
         GLSceneViewer.Cursor := crHourGlass;
         try
-          if DirectoryExists('Data') then
-            ChDir('Data');
+          SetCurrentDir(Path + '\map');
           with MatLib do
           begin
-            LoadHighResTexture(Materials[0], 'land_ocean_ice_4096.jpg');
-            LoadHighResTexture(Materials[1], 'land_ocean_ice_lights_4096.jpg');
+            LoadHighResTexture(Materials[0], 'earth_ocean_ice_4096.jpg');
+            LoadHighResTexture(Materials[1], 'earth_ocean_ice_lights_4096.jpg');
             LoadHighResTexture(Materials[2], 'moon_2048.jpg');
           end;
+          SetCurrentDir(Path + '\data');
           if FileExists('Hipparcos_9.0.stars') then
           begin
             SkyDome.Stars.Clear;
@@ -492,10 +485,12 @@ begin
         finally
           GLSceneViewer.Cursor := crDefault;
         end;
-        highResResourcesLoaded := True;
+        HighResResourcesLoaded := True;
       end;
-    'c': constellationsAlpha := 0.5 - constellationsAlpha;
-    '0'..'9': timeMultiplier := Power(Integer(Key) - Integer('0'), 3);
+    'c':
+      ConstellationsAlpha := 0.5 - ConstellationsAlpha;
+    '0' .. '9':
+      TimeMultiplier := Power(Integer(Key) - Integer('0'), 3);
   end;
 end;
 

BIN
AdvDemos/Forest/Data/detailmap.jpg


BIN
AdvDemos/Forest/Data/imposters.bmp


BIN
AdvDemos/Forest/Data/zbark_016.jpg


+ 7 - 12
AdvDemos/Forest/fForestD.dfm

@@ -3,12 +3,12 @@ object Form1: TForm1
   Top = 166
   BorderStyle = bsNone
   Caption = 'Form1'
-  ClientHeight = 516
-  ClientWidth = 631
+  ClientHeight = 413
+  ClientWidth = 505
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
-  Font.Height = -14
+  Font.Height = -11
   Font.Name = 'MS Sans Serif'
   Font.Style = []
   WindowState = wsMaximized
@@ -18,17 +18,12 @@ object Form1: TForm1
   OnKeyDown = FormKeyDown
   OnResize = FormResize
   OnShow = FormShow
-  PixelsPerInch = 120
-  TextHeight = 16
+  TextHeight = 13
   object SceneViewer: TGLSceneViewer
     Left = 0
     Top = 0
-    Width = 631
-    Height = 516
-    Margins.Left = 4
-    Margins.Top = 4
-    Margins.Right = 4
-    Margins.Bottom = 4
+    Width = 505
+    Height = 413
     Camera = Camera
     Buffer.FogEnvironment.FogColor.Color = {9CC4403FFED4583F48E17A3F0000803F}
     Buffer.FogEnvironment.FogStart = 3500.000000000000000000
@@ -38,7 +33,7 @@ object Form1: TForm1
     Buffer.FogEnable = True
     Buffer.Lighting = False
     Buffer.AntiAliasing = aaNone
-    FieldOfView = 158.064254760742200000
+    FieldOfView = 152.777770996093800000
     PenAsTouch = False
     Align = alClient
     TabOrder = 0

+ 137 - 148
AdvDemos/Forest/fForestD.pas

@@ -20,30 +20,30 @@ uses
   GLS.OpenGLTokens,
   GLS.SceneViewer,
   GLS.Cadencer,
-  GLS.Texture, 
-  GLS.VectorTypes, 
-  GLS.VectorGeometry, 
+  GLS.Texture,
+  GLS.VectorTypes,
+  GLS.VectorGeometry,
   GLS.Scene,
-  GLS.Objects, 
-  GLS.Tree, 
-  GLS.Keyboard, 
-  GLS.VectorLists, 
-  GLS.BitmapFont, 
+  GLS.Objects,
+  GLS.Tree,
+  GLS.Keyboard,
+  GLS.VectorLists,
+  GLS.BitmapFont,
   GLS.Context,
-  GLS.WindowsFont, 
-  GLS.HUDObjects, 
-  GLS.SkyDome, 
-  GLS.Imposter, 
+  GLS.WindowsFont,
+  GLS.HUDObjects,
+  GLS.SkyDome,
+  GLS.Imposter,
   GLS.ParticleFX,
-  GLS.Graphics, 
+  GLS.Graphics,
   GLS.PersistentClasses,
   GLS.PipelineTransformation,
-  GLS.XOpenGL, 
+  GLS.XOpenGL,
   GLS.BaseClasses,
-  GLS.TextureCombiners, 
-  GLS.TextureFormat, 
-  GLS.Material, 
-  GLS.Coordinates, 
+  GLS.TextureCombiners,
+  GLS.TextureFormat,
+  GLS.Material,
+  GLS.Coordinates,
   GLS.TerrainRenderer,
   GLS.HeightData,
   GLS.HeightTileFileHDS,
@@ -80,48 +80,39 @@ type
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure TerrainGetTerrainBounds(var l, t, r, b: Single);
-    procedure GLCadencerProgress(Sender: TObject; const deltaTime,
-      newTime: Double);
-    procedure FormKeyDown(Sender: TObject; var Key: Word;
-      Shift: TShiftState);
+    procedure GLCadencerProgress(Sender: TObject; const deltaTime, newTime: Double);
+    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
     procedure DOTreesRender(Sender: TObject; var rci: TGLRenderContextInfo);
-    procedure PFXTreesBeginParticles(Sender: TObject;
-      var rci: TGLRenderContextInfo);
+    procedure PFXTreesBeginParticles(Sender: TObject; var rci: TGLRenderContextInfo);
     procedure PFXTreesCreateParticle(Sender: TObject; aParticle: TGLParticle);
     procedure PFXTreesEndParticles(Sender: TObject; var rci: TGLRenderContextInfo);
-    procedure PFXTreesRenderParticle(Sender: TObject;
-      aParticle: TGLParticle; var rci: TGLRenderContextInfo);
-    procedure SIBTreeImposterLoaded(Sender: TObject;
-      impostoredObject: TGLBaseSceneObject; destImposter: TImposter);
-    function SIBTreeLoadingImposter(Sender: TObject;
-      impostoredObject: TGLBaseSceneObject;
+    procedure PFXTreesRenderParticle(Sender: TObject; aParticle: TGLParticle;
+      var rci: TGLRenderContextInfo);
+    procedure SIBTreeImposterLoaded(Sender: TObject; impostoredObject: TGLBaseSceneObject;
+      destImposter: TImposter);
+    function SIBTreeLoadingImposter(Sender: TObject; impostoredObject: TGLBaseSceneObject;
       destImposter: TImposter): TGLBitmap32;
     procedure Timer1Timer(Sender: TObject);
-    procedure PFXTreesProgress(Sender: TObject;
-      const progressTime: TGLProgressTimes; var defaultProgress: Boolean);
+    procedure PFXTreesProgress(Sender: TObject; const progressTime: TGLProgressTimes;
+      var defaultProgress: Boolean);
     function PFXTreesGetParticleCountEvent(Sender: TObject): Integer;
     procedure FormResize(Sender: TObject);
-    procedure DOInitializeReflectionRender(Sender: TObject;
-      var rci: TGLRenderContextInfo);
-    procedure DOGLSLWaterPlaneRender(Sender: TObject;
-      var rci: TGLRenderContextInfo);
-    procedure DOClassicWaterPlaneRender(Sender: TObject;
-      var rci: TGLRenderContextInfo);
+    procedure DOInitializeReflectionRender(Sender: TObject; var rci: TGLRenderContextInfo);
+    procedure DOGLSLWaterPlaneRender(Sender: TObject; var rci: TGLRenderContextInfo);
+    procedure DOClassicWaterPlaneRender(Sender: TObject; var rci: TGLRenderContextInfo);
     procedure FormDeactivate(Sender: TObject);
     procedure FormShow(Sender: TObject);
   private
-     
-//      hscale, mapwidth, mapheight : Single;
+    // hscale, mapwidth, mapheight : Single;
     lmp: TPoint;
     camPitch, camTurn, camTime, curPitch, curTurn: Single;
-
     function GetTextureReflectionMatrix: TGLMatrix;
   public
-     
+    Path: TFileName;
     TestTree: TGLTree;
     TreesShown: Integer;
     nearTrees: TGLPersistentObjectList;
-    imposter: TImposter;
+    Imposter: TImposter;
     densityBitmap: TBitmap;
     mirrorTexture: TGLTextureHandle;
     mirrorTexType: TGLTextureTarget;
@@ -134,9 +125,9 @@ type
 var
   Form1: TForm1;
 
-//-----------------------------------------------
+// -----------------------------------------------
 implementation
-//-----------------------------------------------
+// -----------------------------------------------
 
 {$R *.dfm}
 
@@ -149,28 +140,29 @@ const
 procedure TForm1.FormCreate(Sender: TObject);
 var
   density: TPicture;
-  DataPath : TFileName;
+
 begin
   // go to 1024x768x32
-//  SetFullscreenMode(GetIndexFromResolution(1024, 768, 32), 85);
+  // SetFullscreenMode(GetIndexFromResolution(1024, 768, 32), 85);
   Application.OnDeactivate := FormDeactivate;
 
-  DataPath := ExtractFilePath(ParamStr(0));
-  Delete(DataPath, Length(DataPath) - 12, 12);
-  DataPath := DataPath + 'Data\';
-  SetCurrentDir(DataPath);
+  Path := GetCurrentAssetPath();
+
+  // Load volcano textures
+  SetCurrentDir(Path + '\texture');
 
- // Load volcano textures
   MLTerrain.AddTextureMaterial('Terrain', 'volcano_TX_low.jpg').Texture2Name := 'Detail';
-  MLTerrain.AddTextureMaterial('Detail', 'detailmap.jpg').Material.Texture.TextureMode := tmModulate;
+  MLTerrain.AddTextureMaterial('Detail', 'detailmap.jpg').Material.Texture.TextureMode :=
+    tmModulate;
   MLTerrain.AddTextureMaterial('Detail', 'detailmap.jpg').TextureScale.SetPoint(128, 128, 128);
   Terrain.Material.MaterialLibrary := MLTerrain;
   Terrain.Material.LibMaterialName := 'Terrain';
 
-  // Load tree textures
+  // Load textures for trees
   MLTrees.AddTextureMaterial('Leaf', 'leaf.tga').Material.Texture.TextureFormat := tfRGBA;
   MLTrees.AddTextureMaterial('Leaf', 'leaf.tga').Material.Texture.TextureMode := tmModulate;
-  MLTrees.AddTextureMaterial('Leaf', 'leaf.tga').Material.Texture.MinFilter := miNearestMipmapNearest;
+  MLTrees.AddTextureMaterial('Leaf', 'leaf.tga').Material.Texture.MinFilter :=
+    miNearestMipmapNearest;
   MLTrees.AddTextureMaterial('Leaf', 'leaf.tga').Material.BlendingMode := bmAlphaTest50;
 
   MLTrees.AddTextureMaterial('Bark', 'zbark_016.jpg').Material.Texture.TextureMode := tmModulate;
@@ -200,16 +192,19 @@ begin
   densityBitmap := TBitmap.Create;
   try
     densityBitmap.PixelFormat := pf24bit;
-    Density := TPicture.Create;
+    density := TPicture.Create;
     try
-      Density.LoadFromFile('volcano_trees.jpg');
-      densityBitmap.Width := Density.Width;
-      densityBitmap.Height := Density.Height;
-      densityBitmap.Canvas.Draw(0, 0, Density.Graphic);
+      density.LoadFromFile('volcano_trees.jpg');
+      densityBitmap.Width := density.Width;
+      densityBitmap.Height := density.Height;
+      densityBitmap.Canvas.Draw(0, 0, density.Graphic);
     finally
-      Density.Free;
+      density.Free;
     end;
-    PFXTrees.CreateParticles(10000);
+
+    // Set directory to load landscapes
+    SetCurrentDir(Path + '\landscape');
+      PFXTrees.CreateParticles(10000);
   finally
     densityBitmap.Free;
   end;
@@ -227,11 +222,14 @@ begin
   camTurn := -60;
   enableRectReflection := False;
   enableTex2DReflection := False;
+
 end;
 
+//----------------------------------------------------------------
+
 procedure TForm1.FormDestroy(Sender: TObject);
 begin
-//  RestoreDefaultMode;
+  // RestoreDefaultMode;
 
   ShowCursor(True);
   nearTrees.Free;
@@ -252,8 +250,7 @@ begin
   SetFocus;
 end;
 
-procedure TForm1.GLCadencerProgress(Sender: TObject; const deltaTime,
-  newTime: Double);
+procedure TForm1.GLCadencerProgress(Sender: TObject; const deltaTime, newTime: Double);
 var
   speed, z: Single;
   nmp: TPoint;
@@ -300,17 +297,21 @@ begin
   SceneViewer.Invalidate;
 end;
 
-procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
-  Shift: TShiftState);
+procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
 begin
-  case key of
-    VK_ESCAPE: Form1.Close;
-    VK_ADD: if TreesShown < PFXTrees.Particles.ItemCount then
+  case Key of
+    VK_ESCAPE:
+      Form1.Close;
+    VK_ADD:
+      if TreesShown < PFXTrees.Particles.ItemCount then
         TreesShown := TreesShown + 100;
-    VK_SUBTRACT: if TreesShown > 0 then
+    VK_SUBTRACT:
+      if TreesShown > 0 then
         TreesShown := TreesShown - 100;
-    Word('R'): enableTex2DReflection := not enableTex2DReflection;
-    Word('G'): if supportsGLSL then
+    Word('R'):
+      enableTex2DReflection := not enableTex2DReflection;
+    Word('G'):
+      if supportsGLSL then
       begin
         enableGLSL := not enableGLSL;
         enableTex2DReflection := True;
@@ -337,11 +338,10 @@ begin
   Caption := Format('%.2f', [RenderTrees.LastSortTime]);
 end;
 
-procedure TForm1.PFXTreesCreateParticle(Sender: TObject;
-  aParticle: TGLParticle);
+procedure TForm1.PFXTreesCreateParticle(Sender: TObject; aParticle: TGLParticle);
 var
   u, v, p: Single;
-  //   x, y, i, j, dark : Integer;
+  // x, y, i, j, dark : Integer;
   pixelX, pixelY: Integer;
 begin
   repeat
@@ -361,31 +361,29 @@ begin
 
 end;
 
-procedure TForm1.PFXTreesBeginParticles(Sender: TObject;
-  var rci: TGLRenderContextInfo);
+procedure TForm1.PFXTreesBeginParticles(Sender: TObject; var rci: TGLRenderContextInfo);
 begin
-  imposter := SIBTree.ImposterFor(TestTree);
-  imposter.BeginRender(rci);
+  Imposter := SIBTree.ImposterFor(TestTree);
+  Imposter.BeginRender(rci);
 end;
 
-procedure TForm1.PFXTreesRenderParticle(Sender: TObject;
-  aParticle: TGLParticle; var rci: TGLRenderContextInfo);
+procedure TForm1.PFXTreesRenderParticle(Sender: TObject; aParticle: TGLParticle;
+  var rci: TGLRenderContextInfo);
 const
-  cTreeCenteringOffset: TAffineVector = (X:0; Y:30; Z:0);
+  cTreeCenteringOffset: TAffineVector = (X: 0; Y: 30; z: 0);
 var
   d: Single;
   camPos: TGLVector;
 begin
   if not IsVolumeClipped(VectorAdd(aParticle.Position, cTreeCenteringOffset), 30, rci.rcci.frustum)
   then
-  begin
-    ;
+  begin;
     VectorSubtract(rci.cameraPosition, aParticle.Position, camPos);
     d := VectorNorm(camPos);
     if d > Sqr(180) then
     begin
       RotateVectorAroundY(PAffineVector(@camPos)^, aParticle.Tag * cPIdiv180);
-      imposter.Render(rci, VectorMake(aParticle.Position), camPos, 10);
+      Imposter.Render(rci, VectorMake(aParticle.Position), camPos, 10);
     end
     else
     begin
@@ -394,8 +392,7 @@ begin
   end;
 end;
 
-procedure TForm1.PFXTreesEndParticles(Sender: TObject;
-  var rci: TGLRenderContextInfo);
+procedure TForm1.PFXTreesEndParticles(Sender: TObject; var rci: TGLRenderContextInfo);
 var
   aParticle: TGLParticle;
   camPos: TGLVector;
@@ -406,15 +403,14 @@ begin
     aParticle := TGLParticle(nearTrees.First);
     VectorSubtract(rci.cameraPosition, aParticle.Position, camPos);
     RotateVectorAroundY(PAffineVector(@camPos)^, aParticle.Tag * cPIdiv180);
-    imposter.Render(rci, VectorMake(aParticle.Position), camPos, 10);
+    Imposter.Render(rci, VectorMake(aParticle.Position), camPos, 10);
     nearTrees.Delete(0);
   end;
 
-  imposter.EndRender(rci);
+  Imposter.EndRender(rci);
 end;
 
-procedure TForm1.DOTreesRender(Sender: TObject;
-  var rci: TGLRenderContextInfo);
+procedure TForm1.DOTreesRender(Sender: TObject; var rci: TGLRenderContextInfo);
 var
   i: Integer;
   particle: TGLParticle;
@@ -426,13 +422,14 @@ begin
     particle := TGLParticle(nearTrees[i]);
     TreeModelMatrix := MatrixMultiply(CreateTranslationMatrix(particle.Position),
       rci.PipelineTransformation.ViewMatrix^);
-    TreeModelMatrix := MatrixMultiply(CreateScaleMatrix(VectorMake(10, 10, 10)),
-      TreeModelMatrix);
+    TreeModelMatrix := MatrixMultiply(CreateScaleMatrix(VectorMake(10, 10, 10)), TreeModelMatrix);
     TreeModelMatrix := MatrixMultiply(CreateRotationMatrixY(DegToRad(-particle.Tag)),
       TreeModelMatrix);
-    TreeModelMatrix := MatrixMultiply(CreateRotationMatrixX(DegToRad(Cos(GLCadencer.CurrentTime + particle.ID * 15) * 0.2)),
+    TreeModelMatrix := MatrixMultiply
+      (CreateRotationMatrixX(DegToRad(Cos(GLCadencer.CurrentTime + particle.ID * 15) * 0.2)),
       TreeModelMatrix);
-    TreeModelMatrix := MatrixMultiply(CreateRotationMatrixZ(DegToRad(Cos(GLCadencer.CurrentTime * 1.3 + particle.ID * 15) * 0.2)),
+    TreeModelMatrix := MatrixMultiply
+      (CreateRotationMatrixZ(DegToRad(Cos(GLCadencer.CurrentTime * 1.3 + particle.ID * 15) * 0.2)),
       TreeModelMatrix);
     TestTree.AbsoluteMatrix := TreeModelMatrix;
     TestTree.Render(rci);
@@ -448,8 +445,7 @@ begin
   b := 0;
 end;
 
-function TForm1.SIBTreeLoadingImposter(Sender: TObject;
-  impostoredObject: TGLBaseSceneObject;
+function TForm1.SIBTreeLoadingImposter(Sender: TObject; impostoredObject: TGLBaseSceneObject;
   destImposter: TImposter): TGLBitmap32;
 var
   bmp: TBitmap;
@@ -472,8 +468,8 @@ begin
   bmp.Free;
 end;
 
-procedure TForm1.SIBTreeImposterLoaded(Sender: TObject;
-  impostoredObject: TGLBaseSceneObject; destImposter: TImposter);
+procedure TForm1.SIBTreeImposterLoaded(Sender: TObject; impostoredObject: TGLBaseSceneObject;
+  destImposter: TImposter);
 var
   bmp32: TGLBitmap32;
   bmp: TBitmap;
@@ -494,14 +490,13 @@ begin
   Result := TreesShown;
 end;
 
-procedure TForm1.PFXTreesProgress(Sender: TObject;
-  const progressTime: TGLProgressTimes; var defaultProgress: Boolean);
+procedure TForm1.PFXTreesProgress(Sender: TObject; const progressTime: TGLProgressTimes;
+  var defaultProgress: Boolean);
 begin
   defaultProgress := False;
 end;
 
-procedure TForm1.DOInitializeReflectionRender(Sender: TObject;
-  var rci: TGLRenderContextInfo);
+procedure TForm1.DOInitializeReflectionRender(Sender: TObject; var rci: TGLRenderContextInfo);
 var
   w, h: Integer;
   refMat: TGLMatrix;
@@ -530,7 +525,7 @@ begin
 
   GL.Enable(GL_CLIP_PLANE0);
   SetPlane(clipPlane, PlaneMake(AffineVectorMake(0, 1, 0), VectorNegate(YVector)));
-  GL.ClipPlane(GL_CLIP_PLANE0, @clipPlane);
+  GL.clipPlane(GL_CLIP_PLANE0, @clipPlane);
 
   cameraPosBackup := rci.cameraPosition;
   cameraDirectionBackup := rci.cameraDirection;
@@ -600,8 +595,7 @@ begin
   GL.Clear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT + GL_STENCIL_BUFFER_BIT);
 end;
 
-procedure TForm1.DOClassicWaterPlaneRender(Sender: TObject;
-  var rci: TGLRenderContextInfo);
+procedure TForm1.DOClassicWaterPlaneRender(Sender: TObject; var rci: TGLRenderContextInfo);
 const
   cWaveScale = 7;
   cWaveSpeed = 0.02;
@@ -611,7 +605,7 @@ var
   tWave: Single;
   pos: TAffineVector;
   tex: TTexPoint;
-  x, y: Integer;
+  X, Y: Integer;
 begin
   if enableGLSL and enableTex2DReflection then
     Exit;
@@ -625,8 +619,8 @@ begin
   tex0Matrix := IdentityHmgMatrix;
   tex0Matrix.X.X := 3 * cWaveScale;
   tex0Matrix.Y.Y := 4 * cWaveScale;
-  tex0Matrix.W.X := tWave * 1.1;
-  tex0Matrix.W.Y := tWave * 1.06;
+  tex0Matrix.w.X := tWave * 1.1;
+  tex0Matrix.w.Y := tWave * 1.06;
   rci.GLStates.SetGLTextureMatrix(tex0Matrix);
 
   rci.GLStates.ActiveTexture := 1;
@@ -636,8 +630,8 @@ begin
   tex1Matrix := IdentityHmgMatrix;
   tex1Matrix.X.X := cWaveScale;
   tex1Matrix.Y.Y := cWaveScale;
-  tex1Matrix.W.X := tWave * 0.83;
-  tex1Matrix.W.Y := tWave * 0.79;
+  tex1Matrix.w.X := tWave * 0.83;
+  tex1Matrix.w.Y := tWave * 0.79;
   rci.GLStates.SetGLTextureMatrix(tex1Matrix);
 
   if enableTex2DReflection then
@@ -651,38 +645,38 @@ begin
   rci.GLStates.ActiveTexture := 0;
 
   {
-  if enableTex2DReflection then
-  begin
+    if enableTex2DReflection then
+    begin
     //SetupTextureCombiners('Tex0:=Tex1*Tex0;'#13#10
     GetTextureCombiners('Tex0:=Tex1*Tex0;'#13#10
-      + 'Tex1:=Tex0+Col;'#13#10
-      + 'Tex2:=Tex1+Tex2-0.5;');
+    + 'Tex1 := Tex0+Col;'#13#10
+    + 'Tex2 := Tex1+Tex2-0.5;');
     GL.Color4f(0.0, 0.3, 0.3, 1);
-  end
-  else
-  begin
+    end
+    else
+    begin
     //SetupTextureCombiners('Tex0:=Tex1*Tex0;'#13#10
     GetTextureCombiners('Tex0:=Tex1*Tex0;'#13#10
-      + 'Tex1:=Tex0+Col;');
+    + 'Tex1:=Tex0+Col;');
     GL.Color4f(0.0, 0.4, 0.7, 1);
-  end;
+    end;
   }
   GL.Color4f(0.0, 0.4, 0.7, 1);
 
   rci.GLStates.Disable(stCullFace);
-  for y := -10 to 10 - 1 do
+  for Y := -10 to 10 - 1 do
   begin
     GL.Begin_(GL_QUAD_STRIP);
-    for x := -10 to 10 do
+    for X := -10 to 10 do
     begin
-      SetVector(pos, x * 1500, 0, y * 1500);
-      tex := TexPointMake(x, y);
+      SetVector(pos, X * 1500, 0, Y * 1500);
+      tex := TexPointMake(X, Y);
       GL.MultiTexCoord2fv(GL_TEXTURE0, @tex);
       GL.MultiTexCoord2fv(GL_TEXTURE1, @tex);
       GL.MultiTexCoord3fv(GL_TEXTURE2, @pos);
       GL.Vertex3fv(@pos);
-      SetVector(pos, x * 1500, 0, (y + 1) * 1500);
-      tex := TexPointMake(x, (y + 1));
+      SetVector(pos, X * 1500, 0, (Y + 1) * 1500);
+      tex := TexPointMake(X, (Y + 1));
       GL.MultiTexCoord3fv(GL_TEXTURE0, @tex);
       GL.MultiTexCoord3fv(GL_TEXTURE1, @tex);
       GL.MultiTexCoord3fv(GL_TEXTURE2, @pos);
@@ -694,20 +688,20 @@ begin
   rci.GLStates.ResetGLTextureMatrix;
 end;
 
-procedure TForm1.DOGLSLWaterPlaneRender(Sender: TObject;
-  var rci: TGLRenderContextInfo);
+procedure TForm1.DOGLSLWaterPlaneRender(Sender: TObject; var rci: TGLRenderContextInfo);
 var
-  x, y: Integer;
+  X, Y: Integer;
 begin
-  if not (enableGLSL and enableTex2DReflection) then
+  if not(enableGLSL and enableTex2DReflection) then
     Exit;
-
   if not Assigned(reflectionProgram) then
   begin
+    SetCurrentDir(Path + '\shader');
     reflectionProgram := TGLProgramHandle.CreateAndAllocate;
-
-    reflectionProgram.AddShader(TGLVertexShaderHandle, string(LoadAnsiStringFromFile('water_vp.glsl')),True);
-    reflectionProgram.AddShader(TGLFragmentShaderHandle, string(LoadAnsiStringFromFile('water_fp.glsl')),True);
+    reflectionProgram.AddShader(TGLVertexShaderHandle,
+      string(LoadAnsiStringFromFile('water_vp.glsl')), True);
+    reflectionProgram.AddShader(TGLFragmentShaderHandle,
+      string(LoadAnsiStringFromFile('water_fp.glsl')), True);
     if not reflectionProgram.LinkProgram then
       raise Exception.Create(reflectionProgram.InfoLog);
     if not reflectionProgram.ValidateProgram then
@@ -725,13 +719,13 @@ begin
   rci.GLStates.TextureBinding[1, ttTexture2D] := MLWater.Materials[1].Material.Texture.Handle;
   reflectionProgram.Uniform1i['WaveMap'] := 1;
 
-  for y := -10 to 10 - 1 do
+  for Y := -10 to 10 - 1 do
   begin
     GL.Begin_(GL_QUAD_STRIP);
-    for x := -10 to 10 do
+    for X := -10 to 10 do
     begin
-      GL.Vertex3f(x * 1500, 0, y * 1500);
-      GL.Vertex3f(x * 1500, 0, (y + 1) * 1500);
+      GL.Vertex3f(X * 1500, 0, Y * 1500);
+      GL.Vertex3f(X * 1500, 0, (Y + 1) * 1500);
     end;
     GL.End_;
   end;
@@ -742,14 +736,10 @@ end;
 
 // SetupReflectionMatrix
 //
-
 function TForm1.GetTextureReflectionMatrix: TGLMatrix;
 const
-  cBaseMat: TGLMatrix =
-  (V:((X:0.5; Y:0;   Z:0; W:0),
-      (X:0;   Y:0.5; Z:0; W:0),
-      (X:0;   Y:0; Z:1; W:0),
-      (X:0.5; Y:0.5; Z:0; W:1)));
+  cBaseMat: TGLMatrix = (v: ((X: 0.5; Y: 0; z: 0; w: 0), (X: 0; Y: 0.5; z: 0; w: 0), (X: 0; Y: 0;
+    z: 1; w: 0), (X: 0.5; Y: 0.5; z: 0; w: 1)));
 
 var
   w, h: Single;
@@ -769,10 +759,9 @@ begin
   Result := MatrixMultiply(CreateScaleMatrix(VectorMake(w, h, 0)), Result);
   with CurrentGLContext.PipelineTransformation do
     Result := MatrixMultiply(ViewProjectionMatrix^, Result);
-//  Camera.ApplyPerspective(SceneViewer.Buffer.ViewPort, SceneViewer.Width, SceneViewer.Height, 96);
-//  Camera.Apply;
+  // Camera.ApplyPerspective(SceneViewer.Buffer.ViewPort, SceneViewer.Width, SceneViewer.Height, 96);
+  // Camera.Apply;
   Result := MatrixMultiply(CreateScaleMatrix(VectorMake(1, -1, 1)), Result);
 end;
 
 end.
-

+ 0 - 0
AdvDemos/Christmas/Data/Crackling_Fireplace.wav → Asset/Audio/Crackling_Fireplace.wav


+ 0 - 0
AdvDemos/Christmas/Data/Jingle_Bells_64.mp3 → Asset/Audio/Jingle_Bells_64.mp3


+ 0 - 0
AdvDemos/Earth/Data/Constellation_borders.dat → Asset/Data/Constellation_borders.dat


+ 0 - 0
AdvDemos/Earth/Data/Constellations.dat → Asset/Data/Constellations.dat


+ 0 - 0
AdvDemos/Earth/Data/HighResPack-Readme.txt → Asset/Data/HighResPack-Readme.txt


+ 0 - 0
AdvDemos/Earth/Data/Yale_BSC.stars → Asset/Data/Yale_BSC.stars


+ 0 - 0
AdvDemos/Earth/Data/hipparcos_9.0.stars → Asset/Data/hipparcos_9.0.stars


+ 0 - 0
AdvDemos/Forest/Data/volcano.htf → Asset/Landscape/volcano.htf


+ 0 - 0
AdvDemos/Forest/Data/water_fp.glsl → Asset/Shader/water_fp.glsl


+ 0 - 0
AdvDemos/Forest/Data/water_vp.glsl → Asset/Shader/water_vp.glsl


+ 0 - 0
AdvDemos/Forest/Data/Waterbump.jpg → Asset/Texture/Waterbump.jpg


+ 0 - 0
AdvDemos/Forest/Data/caustics.jpg → Asset/Texture/caustics.jpg


BIN
Asset/Texture/detailmap.jpg


+ 0 - 0
AdvDemos/Forest/Data/leaf.tga → Asset/Texture/leaf.tga


+ 0 - 0
AdvDemos/Forest/Data/volcano_trees.jpg → Asset/Texture/volcano_trees.jpg


+ 0 - 0
AdvDemos/Forest/Data/volcano_tx_low.jpg → Asset/Texture/volcano_tx_low.jpg


+ 1 - 0
Demos/meshes/skeletal/fSkeletalC.dfm

@@ -10,6 +10,7 @@ object Form1: TForm1
   Font.Height = -11
   Font.Name = 'Tahoma'
   Font.Style = []
+  Position = poScreenCenter
   OnCreate = FormCreate
   OnMouseWheel = FormMouseWheel
   TextHeight = 13