2005-09-03 07:25:44 -04:00
|
|
|
{
|
|
|
|
Flame screensaver Copyright (C) 2002 Ronald Hordijk
|
|
|
|
Apophysis Copyright (C) 2001-2004 Mark Townsend
|
2006-03-22 08:52:27 -05:00
|
|
|
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
|
2005-09-03 07:25:44 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
}
|
|
|
|
unit Render64MT;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2006-03-22 08:52:27 -05:00
|
|
|
Windows, Forms, Classes, Graphics,
|
2006-08-22 09:35:52 -04:00
|
|
|
Render, RenderMT, ControlPoint, ImageMaker, RenderTypes;
|
2005-09-03 07:25:44 -04:00
|
|
|
|
|
|
|
type
|
2006-08-22 09:35:52 -04:00
|
|
|
TRenderer64MT = class(TBaseMTRenderer)
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-03-22 08:52:27 -05:00
|
|
|
protected
|
2006-08-22 09:35:52 -04:00
|
|
|
Buckets: TBucket64Array;
|
|
|
|
// ColorMap: TColorMapArray;
|
2006-03-22 08:52:27 -05:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
function GetBits: integer; override;
|
|
|
|
function GetBucketsPtr: pointer; override;
|
|
|
|
procedure AllocateBuckets; override;
|
2006-03-22 08:52:27 -05:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
procedure ClearBuckets; override;
|
|
|
|
// procedure CreateColorMap; override;
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
procedure AddPointsToBuckets(const points: TPointsArray); override;
|
|
|
|
procedure AddPointsToBucketsAngle(const points: TPointsArray); override;
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
end;
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
type
|
|
|
|
TRenderer64MT_MM = class(TRenderer64MT)
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
protected
|
|
|
|
procedure CalcBufferSize; override;
|
2005-09-03 07:25:44 -04:00
|
|
|
|
|
|
|
public
|
2006-03-08 09:21:36 -05:00
|
|
|
procedure Render; override;
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
end;
|
2005-09-03 07:25:44 -04:00
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
Math, Sysutils;
|
|
|
|
|
|
|
|
{ TRenderer64MT }
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2006-08-22 09:35:52 -04:00
|
|
|
function TRenderer64MT.GetBits: integer;
|
2005-09-03 07:25:44 -04:00
|
|
|
begin
|
2006-08-22 09:35:52 -04:00
|
|
|
Result := BITS_64;
|
2005-09-03 07:25:44 -04:00
|
|
|
end;
|
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
function TRenderer64MT.GetBucketsPtr: pointer;
|
2005-09-03 07:25:44 -04:00
|
|
|
begin
|
2006-08-22 09:35:52 -04:00
|
|
|
Result := Buckets;
|
2005-09-03 07:25:44 -04:00
|
|
|
end;
|
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
procedure TRenderer64MT.AllocateBuckets;
|
2005-09-03 07:25:44 -04:00
|
|
|
begin
|
2006-08-22 09:35:52 -04:00
|
|
|
SetLength(buckets, BucketHeight, BucketWidth);
|
2005-09-03 07:25:44 -04:00
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2006-08-22 09:35:52 -04:00
|
|
|
procedure TRenderer64MT.ClearBuckets;
|
2005-09-03 07:25:44 -04:00
|
|
|
var
|
2006-08-22 09:35:52 -04:00
|
|
|
i, j: integer;
|
|
|
|
begin
|
|
|
|
for j := 0 to BucketHeight - 1 do
|
|
|
|
for i := 0 to BucketWidth - 1 do
|
|
|
|
with Buckets[j][i] do begin
|
|
|
|
Red := 0;
|
|
|
|
Green := 0;
|
|
|
|
Blue := 0;
|
|
|
|
Count := 0;
|
2006-03-22 08:52:27 -05:00
|
|
|
end;
|
2005-09-03 07:25:44 -04:00
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2006-08-22 09:35:52 -04:00
|
|
|
procedure TRenderer64MT.AddPointsToBuckets(const points: TPointsArray);
|
2005-09-03 07:25:44 -04:00
|
|
|
var
|
|
|
|
i: integer;
|
2006-08-22 09:35:52 -04:00
|
|
|
px, py: double;
|
|
|
|
// R: double;
|
|
|
|
// V1, v2, v3: integer;
|
|
|
|
Bucket: PBucket64;
|
|
|
|
MapColor: PColorMapColor;
|
|
|
|
begin
|
|
|
|
for i := SUB_BATCH_SIZE - 1 downto 0 do begin
|
|
|
|
// if FStop then Exit;
|
|
|
|
|
|
|
|
px := points[i].x - camX0;
|
|
|
|
if (px < 0) or (px > camW) then continue;
|
|
|
|
py := points[i].y - camY0;
|
|
|
|
if (py < 0) or (py > camH) then continue;
|
|
|
|
|
|
|
|
Bucket := @Buckets[Round(bhs * py)][Round(bws * px)];
|
|
|
|
MapColor := @ColorMap[Round(points[i].c * 255)];
|
|
|
|
|
|
|
|
Inc(Bucket.Red, MapColor.Red);
|
|
|
|
Inc(Bucket.Green, MapColor.Green);
|
|
|
|
Inc(Bucket.Blue, MapColor.Blue);
|
|
|
|
Inc(Bucket.Count);
|
2005-09-03 07:25:44 -04:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2006-08-22 09:35:52 -04:00
|
|
|
procedure TRenderer64MT.AddPointsToBucketsAngle(const points: TPointsArray);
|
2005-09-03 07:25:44 -04:00
|
|
|
var
|
|
|
|
i: integer;
|
2006-08-22 09:35:52 -04:00
|
|
|
px, py: double;
|
|
|
|
Bucket: PBucket64;
|
|
|
|
MapColor: PColorMapColor;
|
2005-09-03 07:25:44 -04:00
|
|
|
begin
|
2006-08-22 09:35:52 -04:00
|
|
|
for i := SUB_BATCH_SIZE - 1 downto 0 do begin
|
|
|
|
// if FStop then Exit;
|
2006-03-08 09:21:36 -05:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
px := points[i].x * cosa + points[i].y * sina + rcX;
|
|
|
|
if (px < 0) or (px > camW) then continue;
|
|
|
|
py := points[i].y * cosa - points[i].x * sina + rcY;
|
|
|
|
if (py < 0) or (py > camH) then continue;
|
2006-03-08 09:21:36 -05:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
Bucket := @Buckets[Round(bhs * py)][Round(bws * px)];
|
|
|
|
MapColor := @ColorMap[Round(points[i].c * 255)];
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
Inc(Bucket.Red, MapColor.Red);
|
|
|
|
Inc(Bucket.Green, MapColor.Green);
|
|
|
|
Inc(Bucket.Blue, MapColor.Blue);
|
|
|
|
Inc(Bucket.Count);
|
2005-09-03 07:25:44 -04:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
// -- { TRenderer64MT_MM } ----------------------------------------------------
|
2005-09-03 07:25:44 -04:00
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
procedure TRenderer64MT_MM.CalcBufferSize;
|
2005-09-03 07:25:44 -04:00
|
|
|
begin
|
2006-08-22 09:35:52 -04:00
|
|
|
CalcBufferSizeMM;
|
2005-09-03 07:25:44 -04:00
|
|
|
end;
|
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
procedure TRenderer64MT_MM.Render;
|
2005-09-03 07:25:44 -04:00
|
|
|
begin
|
2006-08-22 09:35:52 -04:00
|
|
|
RenderMM;
|
2005-09-03 07:25:44 -04:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|
|
|
|
|