|
@@ -1,10 +1,9 @@
|
|
|
-unit GBE.omOceanWaves;
|
|
|
+unit GXS.OceanWaves;
|
|
|
(*
|
|
|
- Om: TTwoWavesOceanSurface
|
|
|
- TGBEPlaneExtend has one wave. Added a second to TTwoWavesOceanSurface
|
|
|
+ Omar: TgxTwoWavesOceanSurface
|
|
|
+ TGBEPlaneExtend has one wave. Added a second to TgxTwoWavesOceanSurface
|
|
|
actually 3 waves... and counting
|
|
|
set21: increased the wave system from 3 to 5 waves
|
|
|
- jun22: fixed boat pitch calculation
|
|
|
*)
|
|
|
interface
|
|
|
|
|
@@ -26,7 +25,7 @@ uses
|
|
|
GBE.PlaneExtend; // TGBEPlaneExtend and WaveRec
|
|
|
|
|
|
type
|
|
|
- TWaveSystem = class(TComponent)
|
|
|
+ TgxWaveSystem = class(TComponent)
|
|
|
// collection of sea surface sinoid waves (3 for now)
|
|
|
private
|
|
|
fTime: Single; // Om: movd stuff to protected
|
|
@@ -85,9 +84,9 @@ type
|
|
|
property Vitesse5: Single read fVitesse5 write fVitesse5;
|
|
|
end;
|
|
|
|
|
|
- TOceanSurface = class(TPlane)
|
|
|
+ TgxOceanSurface = class(TPlane)
|
|
|
private
|
|
|
- fWaveSystem: TWaveSystem;
|
|
|
+ fWaveSystem: TgxWaveSystem;
|
|
|
procedure CalcWaves;
|
|
|
protected
|
|
|
fNbMesh: integer; // number of tiles in the mesh
|
|
@@ -109,17 +108,17 @@ type
|
|
|
published
|
|
|
property ActiveWaves: boolean read fActiveWaves write fActiveWaves;
|
|
|
property ShowLines: boolean read fShowlines write fShowlines;
|
|
|
- property WaveSystem: TWaveSystem read fWaveSystem write fWaveSystem;
|
|
|
+ property WaveSystem: TgxWaveSystem read fWaveSystem write fWaveSystem;
|
|
|
property MaterialLines: TColorMaterialSource read fMaterialLignes
|
|
|
write fMaterialLignes;
|
|
|
property DivPerM: TPoint3D read fDivPerM;
|
|
|
end;
|
|
|
|
|
|
- TWindArrowSurface = class(TPlane)
|
|
|
+ TgxWindArrowSurface = class(TPlane)
|
|
|
// Ondulating wind arrow. Less CPU intensive then OceanSurface
|
|
|
private
|
|
|
fVersion: integer;
|
|
|
- fWaveSystem: TWaveSystem; // using only wave 1 here
|
|
|
+ fWaveSystem: TgxWaveSystem; // using only wave 1 here
|
|
|
procedure CalcArrowMesh;
|
|
|
procedure setVersion(const Value: integer);
|
|
|
protected
|
|
@@ -143,15 +142,15 @@ type
|
|
|
Property version: integer read fVersion write setVersion;
|
|
|
end;
|
|
|
|
|
|
- TTwoWavesOceanSurface = class(TOceanSurface); // compatibility w/ old forms
|
|
|
+ TgxTwoWavesOceanSurface = class(TgxOceanSurface); // compatibility w/ old forms
|
|
|
|
|
|
procedure Register;
|
|
|
|
|
|
implementation //--------------------------------------------------------------
|
|
|
|
|
|
-// TWaveSystem
|
|
|
+// TgxWaveSystem
|
|
|
|
|
|
-constructor TWaveSystem.Create(AOwner: TComponent);
|
|
|
+constructor TgxWaveSystem.Create(AOwner: TComponent);
|
|
|
begin
|
|
|
inherited;
|
|
|
|
|
@@ -184,44 +183,44 @@ begin
|
|
|
fOrigine5 := Point3D(7, -8, 1);
|
|
|
end;
|
|
|
|
|
|
-destructor TWaveSystem.Destroy;
|
|
|
+destructor TgxWaveSystem.Destroy;
|
|
|
begin
|
|
|
inherited;
|
|
|
end;
|
|
|
|
|
|
-function TWaveSystem.GetWaveParams1: TPoint3D;
|
|
|
+function TgxWaveSystem.GetWaveParams1: TPoint3D;
|
|
|
begin
|
|
|
Result := Point3D(Amplitude, Longueur, Vitesse); // pack wave params
|
|
|
end;
|
|
|
|
|
|
-function TWaveSystem.GetWaveParams2: TPoint3D;
|
|
|
+function TgxWaveSystem.GetWaveParams2: TPoint3D;
|
|
|
begin
|
|
|
Result := Point3D(fAmplitude2, fLongueur2, fVitesse2);
|
|
|
end;
|
|
|
|
|
|
-function TWaveSystem.GetWaveParams3: TPoint3D;
|
|
|
+function TgxWaveSystem.GetWaveParams3: TPoint3D;
|
|
|
begin
|
|
|
Result := Point3D(fAmplitude3, fLongueur3, fVitesse3);
|
|
|
end;
|
|
|
|
|
|
-function TWaveSystem.GetWaveParams4: TPoint3D;
|
|
|
+function TgxWaveSystem.GetWaveParams4: TPoint3D;
|
|
|
begin
|
|
|
Result := Point3D(fAmplitude4, fLongueur4, fVitesse4);
|
|
|
end;
|
|
|
|
|
|
-function TWaveSystem.GetWaveParams5: TPoint3D;
|
|
|
+function TgxWaveSystem.GetWaveParams5: TPoint3D;
|
|
|
begin
|
|
|
Result := Point3D(fAmplitude5, fLongueur5, fVitesse5);
|
|
|
end;
|
|
|
|
|
|
-procedure TWaveSystem.IncTime;
|
|
|
+procedure TgxWaveSystem.IncTime;
|
|
|
begin
|
|
|
fTime := fTime + 0.010; // advance wave time.. slow advance
|
|
|
end;
|
|
|
|
|
|
-{ TOceanSurface }
|
|
|
+{ TgxOceanSurface }
|
|
|
|
|
|
-constructor TOceanSurface.Create(AOwner: TComponent);
|
|
|
+constructor TgxOceanSurface.Create(AOwner: TComponent);
|
|
|
begin
|
|
|
inherited;
|
|
|
|
|
@@ -238,7 +237,7 @@ begin
|
|
|
fVirtualSeaOrigin := Point3D(0, 0, 0);
|
|
|
end;
|
|
|
|
|
|
-destructor TOceanSurface.Destroy;
|
|
|
+destructor TgxOceanSurface.Destroy;
|
|
|
begin
|
|
|
inherited;
|
|
|
end;
|
|
@@ -251,7 +250,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
// MoveTextureBy uses existent mesh, by just displacing the tex pts
|
|
|
-procedure TOceanSurface.MoveTextureBy(var dx, dy: Single);
|
|
|
+procedure TgxOceanSurface.MoveTextureBy(var dx, dy: Single);
|
|
|
// dx,dy in 3d units (m)
|
|
|
var
|
|
|
M: TMeshData;
|
|
@@ -305,7 +304,7 @@ begin
|
|
|
// M.TexCoordinates :=
|
|
|
end;
|
|
|
|
|
|
-procedure TOceanSurface.GetPointsTexCoordinates(var P, TC: String);
|
|
|
+procedure TgxOceanSurface.GetPointsTexCoordinates(var P, TC: String);
|
|
|
var
|
|
|
M: TMeshData;
|
|
|
begin
|
|
@@ -315,7 +314,7 @@ begin
|
|
|
TC := M.TexCoordinates;
|
|
|
end;
|
|
|
|
|
|
-procedure TOceanSurface.CalcWaves; // Wx = Point3D(Amplitude, Longueur, Vitesse)
|
|
|
+procedure TgxOceanSurface.CalcWaves; // Wx = Point3D(Amplitude, Longueur, Vitesse)
|
|
|
var
|
|
|
M: TMeshData;
|
|
|
x, y: integer;
|
|
@@ -387,7 +386,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
// P in m
|
|
|
-function TOceanSurface.calcWaveAmplitudeAndPitch(P: TPoint3D;
|
|
|
+function TgxOceanSurface.calcWaveAmplitudeAndPitch(P: TPoint3D;
|
|
|
const aCap: Single; var aAmplitude, aPitch: Single): boolean; // Om:
|
|
|
var
|
|
|
waveRec1, waveRec2, waveRec3, waveRec4, waveRec5: TWaveRec;
|
|
@@ -459,7 +458,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
|
|
|
-// function TOceanSurface.calcWaveAmplitudeAndPitch(P:TPoint3d; const aCap:Single; var aAmplitude,aPitch:Single ):boolean; //Om:
|
|
|
+// function TgxOceanSurface.calcWaveAmplitudeAndPitch(P:TPoint3d; const aCap:Single; var aAmplitude,aPitch:Single ):boolean; //Om:
|
|
|
// var
|
|
|
// M:TMeshData;
|
|
|
// x,y,z,x1,y1,z1 : integer;
|
|
@@ -502,7 +501,7 @@ end;
|
|
|
// else Result := false;
|
|
|
// end;
|
|
|
|
|
|
-procedure TOceanSurface.Render;
|
|
|
+procedure TgxOceanSurface.Render;
|
|
|
begin
|
|
|
inherited;
|
|
|
|
|
@@ -527,14 +526,14 @@ begin
|
|
|
TMaterialSource.ValidMaterial(fMaterialLignes), 1);
|
|
|
end;
|
|
|
|
|
|
-{ TWindArrowSurface }
|
|
|
+{ TgxWindArrowSurface }
|
|
|
|
|
|
-constructor TWindArrowSurface.Create(AOwner: TComponent);
|
|
|
+constructor TgxWindArrowSurface.Create(AOwner: TComponent);
|
|
|
begin
|
|
|
inherited; // TPlane.Create
|
|
|
|
|
|
// create an own wave system
|
|
|
- fWaveSystem := TWaveSystem.Create(nil);
|
|
|
+ fWaveSystem := TgxWaveSystem.Create(nil);
|
|
|
|
|
|
fWaveSystem.Amplitude := 0.8; // set wave 1
|
|
|
fWaveSystem.Vitesse := 20.0;
|
|
@@ -558,14 +557,14 @@ begin
|
|
|
fVersion := 0;
|
|
|
end;
|
|
|
|
|
|
-destructor TWindArrowSurface.Destroy;
|
|
|
+destructor TgxWindArrowSurface.Destroy;
|
|
|
begin
|
|
|
fWaveSystem.Free;
|
|
|
inherited;
|
|
|
end;
|
|
|
|
|
|
// transforms a plane into an arrow, by squeezing the x coordinate
|
|
|
-procedure TWindArrowSurface.CalcArrowMesh; //
|
|
|
+procedure TgxWindArrowSurface.CalcArrowMesh; //
|
|
|
var // 0.0
|
|
|
M: TMeshData; // Y /\ 0.5
|
|
|
x, y: integer; // / \
|
|
@@ -642,7 +641,7 @@ begin
|
|
|
fWaveSystem.IncTime; // adv time by 0.01 sec
|
|
|
end;
|
|
|
|
|
|
-procedure TWindArrowSurface.Render;
|
|
|
+procedure TgxWindArrowSurface.Render;
|
|
|
begin
|
|
|
inherited;
|
|
|
|
|
@@ -667,7 +666,7 @@ begin
|
|
|
TMaterialSource.ValidMaterial(fMaterialLignes), 1);
|
|
|
end;
|
|
|
|
|
|
-procedure TWindArrowSurface.setVersion(const Value: integer);
|
|
|
+procedure TgxWindArrowSurface.setVersion(const Value: integer);
|
|
|
begin
|
|
|
if (fVersion <> Value) then
|
|
|
begin
|
|
@@ -676,7 +675,7 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-procedure TWindArrowSurface.SetDepth(const Value: Single);
|
|
|
+procedure TgxWindArrowSurface.SetDepth(const Value: Single);
|
|
|
// override TPlane tendency to set Depth to 0.01
|
|
|
begin
|
|
|
if (self.fDepth <> Value) then // this copies what TPlane removed
|
|
@@ -697,8 +696,8 @@ end;
|
|
|
|
|
|
procedure Register;
|
|
|
begin
|
|
|
- RegisterComponents('GXScene GBE', [TWaveSystem, TOceanSurface,
|
|
|
- TTwoWavesOceanSurface, TWindArrowSurface]);
|
|
|
+ RegisterComponents('GLXEngine', [TgxWaveSystem, TgxOceanSurface,
|
|
|
+ TgxTwoWavesOceanSurface, TgxWindArrowSurface]);
|
|
|
end;
|
|
|
|
|
|
end.
|