*** empty log message ***

This commit is contained in:
zueuk 2009-04-20 08:15:24 +00:00
parent a608daa29b
commit 7fd503cdec
2 changed files with 0 additions and 636 deletions

View File

@ -1,409 +0,0 @@
{
Flame screensaver Copyright (C) 2002 Ronald Hordijk
Apophysis Copyright (C) 2001-2004 Mark Townsend
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
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 Render64;
interface
uses
Windows, Classes, Forms, Graphics, ImageMaker,
RenderST, RenderTypes, Xform, ControlPoint;
type
TRenderer64 = class(TBaseSTRenderer)
protected
Buckets: TBucket64Array;
ColorMap: TColorMapArray;
function GetBits: integer; override;
function GetBucketsPtr: pointer; override;
procedure AllocateBuckets; override;
procedure ClearBuckets; override;
procedure CreateColorMap; override;
protected
procedure IterateBatch; override;
procedure IterateBatchAngle; override;
procedure IterateBatchFX; override;
procedure IterateBatchAngleFX; override;
end;
// ----------------------------------------------------------------------------
type
TRenderer64MM = class(TRenderer64)
protected
procedure CalcBufferSize; override;
public
procedure Render; override;
end;
implementation
{$define _ASM_}
uses
Math, Sysutils;
{ TRenderer64 }
///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64.ClearBuckets;
var
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;
end;
end;
///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64.CreateColorMap;
var
i: integer;
begin
{$IFDEF TESTVARIANT}
for i := 0 to 255 do begin
ColorMap[i].Red := i;
ColorMap[i].Green := i;
ColorMap[i].Blue := i;
// cmap[i][3] := fcp.white_level;
end;
{$ELSE}
for i := 0 to 255 do begin
ColorMap[i].Red := (fcp.CMap[i][0] * fcp.white_level) div 256;
ColorMap[i].Green := (fcp.CMap[i][1] * fcp.white_level) div 256;
ColorMap[i].Blue := (fcp.CMap[i][2] * fcp.white_level) div 256;
// cmap[i][3] := fcp.white_level;
end;
{$ENDIF}
end;
///////////////////////////////////////////////////////////////////////////////
function TRenderer64.GetBits: integer;
begin
Result := BITS_64;
end;
function TRenderer64.GetBucketsPtr: pointer;
begin
Result := Buckets;
end;
procedure TRenderer64.AllocateBuckets;
begin
SetLength(buckets, BucketHeight, BucketWidth);
end;
///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64.IterateBatch;
var
i: integer;
px, py: double;
Bucket: PBucket64;
MapColor: PColorMapColor;
p: TCPPoint;
xf: TXForm;
begin
{$ifndef _ASM_}
p.x := 2 * random - 1;
p.y := 2 * random - 1;
p.c := random;
{$else}
asm
fld1
call System.@RandExt
fadd st, st
fsub st, st(1)
fstp qword ptr [p.x]
call System.@RandExt
fadd st, st
fsubrp st(1), st
fstp qword ptr [p.y]
call System.@RandExt
fstp qword ptr [p.c]
end;
{$endif}
try
xf := fcp.xform[0];//random(fcp.NumXForms)];
xf.NextPoint(p);
for i := 0 to FUSE do begin
xf := xf.PropTable[Random(PROP_TABLE_SIZE)];
xf.NextPoint(p);
end;
for i := 0 to SUB_BATCH_SIZE-1 do begin
xf := xf.PropTable[Random(PROP_TABLE_SIZE)];
xf.NextPoint(p);
if (xf.plotMode < 0) then continue
else if (xf.plotMode = 0) and (random > xf.opacity) then continue;
px := p.x - camX0;
if (px < 0) or (px > camW) then continue;
py := p.y - camY0;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bhs * py)][Round(bws * px)];
MapColor := @ColorMap[Round(p.c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
on EMathError do begin
exit;
end;
end;
end;
procedure TRenderer64.IterateBatchAngle;
var
i: integer;
px, py: double;
Bucket: PBucket64;
MapColor: PColorMapColor;
p: TCPPoint;
xf: TXForm;
begin
{$ifndef _ASM_}
p.x := 2 * random - 1;
p.y := 2 * random - 1;
p.c := random;
{$else}
asm
fld1
call System.@RandExt
fadd st, st
fsub st, st(1)
fstp qword ptr [p.x]
call System.@RandExt
fadd st, st
fsubrp st(1), st
fstp qword ptr [p.y]
call System.@RandExt
fstp qword ptr [p.c]
end;
{$endif}
try
xf := fcp.xform[0];//random(fcp.NumXForms)];
xf.NextPoint(p);
for i := 0 to FUSE do begin
xf := xf.PropTable[Random(PROP_TABLE_SIZE)];
xf.NextPoint(p);
end;
for i := 0 to SUB_BATCH_SIZE-1 do begin
xf := xf.PropTable[Random(PROP_TABLE_SIZE)];
xf.NextPoint(p);
if (xf.plotMode < 0) then continue
else if (xf.plotMode = 0) and (random > xf.opacity) then continue;
px := p.x * cosa + p.y * sina + rcX;
if (px < 0) or (px > camW) then continue;
py := p.y * cosa - p.x * sina + rcY;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bhs * py)][Round(bws * px)];
MapColor := @ColorMap[Round(p.c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
on EMathError do begin
exit;
end;
end;
end;
procedure TRenderer64.IterateBatchFX;
var
i: integer;
px, py: double;
Bucket: PBucket64;
MapColor: PColorMapColor;
p, q: TCPPoint;
xf: TXForm;
begin
{$ifndef _ASM_}
p.x := 2 * random - 1;
p.y := 2 * random - 1;
p.c := random;
{$else}
asm
fld1
call System.@RandExt
fadd st, st
fsub st, st(1)
fstp qword ptr [p.x]
call System.@RandExt
fadd st, st
fsubrp st(1), st
fstp qword ptr [p.y]
call System.@RandExt
fstp qword ptr [p.c]
end;
{$endif}
try
xf := fcp.xform[0];//random(fcp.NumXForms)];
xf.NextPoint(p);
for i := 0 to FUSE do begin
xf := xf.PropTable[Random(PROP_TABLE_SIZE)];
xf.NextPoint(p);
end;
for i := 0 to SUB_BATCH_SIZE-1 do begin
xf := xf.PropTable[Random(PROP_TABLE_SIZE)];
xf.NextPoint(p);
if (xf.plotMode < 0) then continue
else if (xf.plotMode = 0) and (random > xf.opacity) then continue;
finalXform.NextPointTo(p, q);
px := q.x - camX0;
if (px < 0) or (px > camW) then continue;
py := q.y - camY0;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bhs * py)][Round(bws * px)];
MapColor := @ColorMap[Round(q.c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
on EMathError do begin
exit;
end;
end;
end;
procedure TRenderer64.IterateBatchAngleFX;
var
i: integer;
px, py: double;
Bucket: PBucket64;
MapColor: PColorMapColor;
p, q: TCPPoint;
xf: TXForm;
begin
{$ifndef _ASM_}
p.x := 2 * random - 1;
p.y := 2 * random - 1;
p.c := random;
{$else}
asm
fld1
call System.@RandExt
fadd st, st
fsub st, st(1)
fstp qword ptr [p.x]
call System.@RandExt
fadd st, st
fsubrp st(1), st
fstp qword ptr [p.y]
call System.@RandExt
fstp qword ptr [p.c]
end;
{$endif}
try
xf := fcp.xform[0];//random(fcp.NumXForms)];
xf.NextPoint(p);
for i := 0 to FUSE do begin
xf := xf.PropTable[Random(PROP_TABLE_SIZE)];
xf.NextPoint(p);
end;
for i := 0 to SUB_BATCH_SIZE-1 do begin
xf := xf.PropTable[Random(PROP_TABLE_SIZE)];
xf.NextPoint(p);
if (xf.plotMode < 0) then continue
else if (xf.plotMode = 0) and (random > xf.opacity) then continue;
finalXform.NextPointTo(p, q);
px := q.x * cosa + q.y * sina + rcX;
if (px < 0) or (px > camW) then continue;
py := q.y * cosa - q.x * sina + rcY;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bhs * py)][Round(bws * px)];
MapColor := @ColorMap[Round(q.c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
on EMathError do begin
exit;
end;
end;
end;
// -- { TRenderer32MM } -------------------------------------------------------
procedure TRenderer64MM.CalcBufferSize;
begin
CalcBufferSizeMM;
end;
procedure TRenderer64MM.Render;
begin
RenderMM;
end;
end.

View File

@ -1,227 +0,0 @@
{
Apophysis Copyright (C) 2001-2004 Mark Townsend
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
Apophysis Copyright (C) 2007 Piotr Borys, Peter Sdobnov
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 varSuperShape;
interface
uses
BaseVariation, XFormMan, XForm;
type
TVariationSuperShape = class(TBaseVariation)
private
m, n1, n2, n3, rnd, holes : double;
public
constructor Create;
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
function GetNrVariables: integer; override;
function GetVariableNameAt(const Index: integer): string; override;
function SetVariable(const Name: string; var value: double): boolean; override;
function GetVariable(const Name: string; var value: double): boolean; override;
procedure CalcFunction; override;
end;
implementation
uses
Math;
{ TVariationSuperShape }
///////////////////////////////////////////////////////////////////////////////
procedure SinCos(const Theta: double; var Sin, Cos: double);
asm
FLD Theta
FSINCOS
FSTP qword ptr [edx] // Cos
FSTP qword ptr [eax] // Sin
FWAIT
end;
function atan2(const y, x: double): double;
asm
FLD y
FLD x
FPATAN
end;
procedure TVariationSuperShape.CalcFunction;
var
r, theta : double;
t1, t2 : double;
dist: double;
t1a, t2a: double;
begin
theta := 0;
if n1 = 0 then
r := 0
else begin
theta := atan2(FTy^, FTx^);
SinCos((m*theta+pi)/4, t2, t1);
t1 := abs(t1);
t1 := power(t1, n2);
t2 := abs(t2);
t2 := power(t2, n3);
if rnd < 1.0 then
dist := sqrt(sqr(FTx^)+sqr(FTy^))
else
dist := 0;
r := (rnd*random + (1.0-rnd)*dist - holes) * power(t1+t2, -1/n1);
end;
if (abs(r) = 0) then
begin
FPx^ := FPx^;
FPy^ := FPy^;
end
else
begin
SinCos(theta, t2a, t1a);
FPx^ := FPx^ + vvar*r*t1a;
FPy^ := FPy^ + vvar*r*t2a;
end;
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationSuperShape.GetName: string;
begin
Result := 'super_shape';
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationSuperShape.GetVariableNameAt(const Index: integer): string;
begin
case Index Of
0: Result := 'super_shape_m';
1: Result := 'super_shape_n1';
2: Result := 'super_shape_n2';
3: Result := 'super_shape_n3';
4: Result := 'super_shape_rnd';
5: Result := 'super_shape_holes';
else
Result := '';
end
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationSuperShape.GetNrVariables: integer;
begin
Result := 6;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationSuperShape.SetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
if Name = 'super_shape_m' then begin
m := Value;
Result := True;
end else if Name = 'super_shape_n1' then begin
n1 := Value;
Result := True;
end
else if Name = 'super_shape_n2' then begin
n2 := Value;
Result := True;
end
else if Name = 'super_shape_n3' then begin
n3 := Value;
Result := True;
end
else if Name = 'super_shape_rnd' then begin
if Value > 1.0 then
rnd := 1.0
else if Value < 0.0 then
rnd := 0.0
else
rnd := Value;
Result := True;
end
else if Name = 'super_shape_holes' then begin
holes := Value;
Result := True;
end
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationSuperShape.GetVariable(const Name: string; var value: double): boolean;
begin
Result := False;
if Name = 'super_shape_m' then begin
Value := m;
Result := True;
end else if Name = 'super_shape_n1' then begin
Value := n1;
Result := True;
end
else if Name = 'super_shape_n2' then begin
Value := n2;
Result := True;
end
else if Name = 'super_shape_n3' then begin
Value := n3;
Result := True;
end
else if Name = 'super_shape_rnd' then begin
Value := rnd;
Result := True;
end
else if Name = 'super_shape_holes' then begin
Value := holes;
Result := True;
end
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationSuperShape.Create;
begin
inherited Create;
m := 5.0;
n1 := 2.0;
n2 := 0.3;
n3 := 0.3;
rnd := 0.0;
holes := 1.0;
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationSuperShape.GetInstance: TBaseVariation;
begin
Result := TVariationSuperShape.Create;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationSuperShape));
end.