fixed MT render stopping and pausing bug,

some other changes
This commit is contained in:
zueuk 2006-03-08 14:21:36 +00:00
parent 163c30677e
commit 85bc00513e
14 changed files with 168 additions and 143 deletions

View File

@ -276,6 +276,8 @@ begin
totValue := 0; totValue := 0;
n := NumXforms; n := NumXforms;
assert(n > 0);
finalXform := @xform[n]; finalXform := @xform[n];
finalXform.Prepare; finalXform.Prepare;
useFinalXform := FinalXformEnabled and HasFinalXform; useFinalXform := FinalXformEnabled and HasFinalXform;

View File

@ -860,7 +860,7 @@ var
begin begin
if (t = Transforms) then if (t = Transforms) then
begin begin
assert(EnableFinalXform); assert(cp.HasFinalXForm or EnableFinalXform);
MainForm.UpdateUndo; MainForm.UpdateUndo;
EnableFinalXform := false; EnableFinalXform := false;
cp.finalXformEnabled := false; cp.finalXformEnabled := false;

View File

@ -250,9 +250,6 @@ end;
procedure TRenderForm.FormDestroy(Sender: TObject); procedure TRenderForm.FormDestroy(Sender: TObject);
begin begin
// if assigned(Renderer) then Renderer.Terminate;
// if assigned(Renderer) then Renderer.WaitFor;
// if assigned(Renderer) then Renderer.Free;
if assigned(Renderer) then begin if assigned(Renderer) then begin
Renderer.Terminate; Renderer.Terminate;
Renderer.WaitFor; Renderer.WaitFor;
@ -336,8 +333,12 @@ begin
btnCancel.Caption := 'Stop'; btnCancel.Caption := 'Stop';
StartTime := Now; StartTime := Now;
// Remaining := 365; // Remaining := 365;
if Assigned(Renderer) then Renderer.Terminate; if Assigned(Renderer) then begin
if Assigned(Renderer) then Renderer.WaitFor; Renderer.Terminate;
Renderer.WaitFor;
Renderer.Free;
Renderer := nil; //?
end;
if not Assigned(Renderer) then if not Assigned(Renderer) then
begin begin
// disable screensaver // disable screensaver
@ -475,6 +476,10 @@ procedure TRenderForm.btnCancelClick(Sender: TObject);
begin begin
if Assigned(Renderer) then if Assigned(Renderer) then
begin begin
if Renderer.Suspended then begin
Renderer.Resume;
btnPause.caption := 'Pause';
end;
Renderer.Terminate; Renderer.Terminate;
Renderer.WaitFor; // --?-- Renderer.WaitFor; // --?--
end end
@ -529,10 +534,10 @@ procedure TRenderForm.btnPauseClick(Sender: TObject);
begin begin
if Assigned(Renderer) then if Assigned(Renderer) then
if Renderer.Suspended = false then begin if Renderer.Suspended = false then begin
renderer.suspend; renderer.Suspend;
btnPause.caption := 'Resume'; btnPause.caption := 'Resume';
end else begin end else begin
renderer.resume; renderer.Resume;
btnPause.caption := 'Pause'; btnPause.caption := 'Pause';
end; end;
end; end;

View File

@ -37,7 +37,7 @@ const
RS_XO = 2; RS_XO = 2;
RS_VO = 3; RS_VO = 3;
AppVersionString = 'Apophysis 2.03d pre-release 1'; AppVersionString = 'Apophysis 2.03d pre-release 2';
type type
TMouseMoveState = (msUsual, msZoomWindow, msZoomOutWindow, msZoomWindowMove, msZoomOutWindowMove, msDrag, msDragMove, msRotate, msRotateMove); TMouseMoveState = (msUsual, msZoomWindow, msZoomOutWindow, msZoomWindowMove, msZoomOutWindowMove, msDrag, msDragMove, msRotate, msRotateMove);
@ -345,7 +345,6 @@ function CleanUPRTitle(ident: string): string;
function GradientString(c: TColorMap): string; function GradientString(c: TColorMap): string;
function PackVariations: cardinal; function PackVariations: cardinal;
procedure UnpackVariations(v: integer); procedure UnpackVariations(v: integer);
function NumXForms(const cp: TControlPoint): integer;
//procedure NormalizeWeights(var cp: TControlPoint); //procedure NormalizeWeights(var cp: TControlPoint);
//procedure EqualizeWeights(var cp: TControlPoint); //procedure EqualizeWeights(var cp: TControlPoint);
procedure MultMatrix(var s: TMatrix; const m: TMatrix); procedure MultMatrix(var s: TMatrix; const m: TMatrix);
@ -442,46 +441,6 @@ begin
end; end;
function NumXForms(const cp: TControlPoint): integer;
var
i: integer;
begin
Result := NXFORMS;
for i := 0 to NXFORMS - 1 do begin
if cp.xform[i].density = 0 then
begin
Result := i;
Break;
end;
end;
end;
{
procedure EqualizeWeights(var cp: TControlPoint);
var
t, i: integer;
begin
t := NumXForms(cp);
for i := 0 to t - 1 do
cp.xform[i].density := 1.0 / t;
end;
procedure NormalizeWeights(var cp: TControlPoint);
var
i: integer;
td: double;
begin
td := 0.0;
for i := 0 to NumXForms(cp) - 1 do
td := td + cp.xform[i].Density;
if (td < 0.001) then
EqualizeWeights(cp)
else
for i := 0 to NumXForms(cp) - 1 do
cp.xform[i].Density := cp.xform[i].Density / td;
end;
}
function PackVariations: cardinal; function PackVariations: cardinal;
{ Packs the variation options into an integer with Linear as lowest bit } { Packs the variation options into an integer with Linear as lowest bit }
var var
@ -580,8 +539,10 @@ end;
procedure TMainForm.StopThread; procedure TMainForm.StopThread;
begin begin
RedrawTimer.Enabled := False; RedrawTimer.Enabled := False;
if Assigned(Renderer) then Renderer.Terminate; if Assigned(Renderer) then begin
if Assigned(Renderer) then Renderer.WaitFor; Renderer.Terminate;
Renderer.WaitFor;
end;
end; end;
procedure EqualizeVars(const x: integer); procedure EqualizeVars(const x: integer);
@ -614,7 +575,7 @@ var
begin begin
inc(MainSeed); inc(MainSeed);
RandSeed := MainSeed; RandSeed := MainSeed;
for i := 0 to NumXForms(cp) - 1 do for i := 0 to cp.NumXForms - 1 do
begin begin
for j := 0 to NRVAR - 1 do for j := 0 to NRVAR - 1 do
cp.xform[i].vars[j] := 0; cp.xform[i].vars[j] := 0;
@ -646,7 +607,7 @@ begin
RandomVariation(cp); RandomVariation(cp);
end end
else else
for i := 0 to NumXForms(cp) - 1 do for i := 0 to cp.NumXForms - 1 do
begin begin
for j := 0 to NRVAR - 1 do for j := 0 to NRVAR - 1 do
cp.xform[i].vars[j] := 0; cp.xform[i].vars[j] := 0;
@ -1377,7 +1338,7 @@ begin
format('vibrancy="%g" ', [cp1.vibrancy]) + hue + url + nick + '>'); format('vibrancy="%g" ', [cp1.vibrancy]) + hue + url + nick + '>');
{ Write transform parameters } { Write transform parameters }
t := NumXForms(cp1); t := cp1.NumXForms;
for i := 0 to t - 1 do for i := 0 to t - 1 do
FileList.Add(cp1.xform[i].ToXMLString); FileList.Add(cp1.xform[i].ToXMLString);
// if cp1.HasFinalXForm then FileList.Add(cp1.finalxform.FinalToXMLString(cp1.finalXformEnabled)); // if cp1.HasFinalXForm then FileList.Add(cp1.finalxform.FinalToXMLString(cp1.finalXformEnabled));
@ -1766,12 +1727,15 @@ end;
procedure TMainForm.DrawFlame; procedure TMainForm.DrawFlame;
begin begin
RedrawTimer.Enabled := False; RedrawTimer.Enabled := False;
if Assigned(Renderer) then Renderer.Terminate;
if Assigned(Renderer) then Renderer.WaitFor;
if Assigned(Renderer) then begin if Assigned(Renderer) then begin
Renderer.Terminate;
Renderer.WaitFor;
Renderer.Free; Renderer.Free;
Renderer := nil; Renderer := nil;
end; end;
assert(Renderer = nil); //...
if not Assigned(Renderer) then if not Assigned(Renderer) then
begin begin
if (MainCp.width <> Image.Width) or (MainCp.height <> Image.height) then if (MainCp.width <> Image.Width) or (MainCp.height <> Image.height) then
@ -2100,7 +2064,7 @@ function TMainForm.UPRString(cp1: TControlPoint; Entry: string): string;
{ Returns a string containing an Ultra Fractal parameter set for copying { Returns a string containing an Ultra Fractal parameter set for copying
or saving to file } or saving to file }
var var
IterDensity, m, i, j: integer; IterDensity, m, i: integer;
scale, a, b, c, d, e, f, p: double; scale, a, b, c, d, e, f, p: double;
GradStrings, Strings: TStringList; GradStrings, Strings: TStringList;
rept, cby, smap, sol: string; rept, cby, smap, sol: string;
@ -2165,9 +2129,9 @@ begin
'p_xf' + inttostr(m) + '_cfd=' + Format('%.6g ', [d])); 'p_xf' + inttostr(m) + '_cfd=' + Format('%.6g ', [d]));
Strings.Add(' p_xf' + inttostr(m) + '_cfe=' + Format('%.6g ', [e]) + Strings.Add(' p_xf' + inttostr(m) + '_cfe=' + Format('%.6g ', [e]) +
' p_xf' + inttostr(m) + '_cff=' + Format('%.6g ', [f])); ' p_xf' + inttostr(m) + '_cff=' + Format('%.6g ', [f]));
for j := 0 to NRVAR - 1 do for i := 0 to NRVAR - 1 do
Strings.Add(' p_xf' + inttostr(m) + '_var' + inttostr(j) + '=' + Strings.Add(' p_xf' + inttostr(m) + '_var' + inttostr(i) + '=' +
floatToStr(cp1.xform[m].vars[j])); floatToStr(cp1.xform[m].vars[i]));
end; end;
Strings.Add('gradient:'); Strings.Add('gradient:');
Strings.Add(GradientString(cp1.cmap)); Strings.Add(GradientString(cp1.cmap));
@ -2772,7 +2736,7 @@ begin
end; end;
FlameString := EntryStrings.Text; FlameString := EntryStrings.Text;
maincp.ParseString(FlameString); maincp.ParseString(FlameString);
Transforms := NumXForms(maincp); Transforms := MainCP.NumXForms;
end end
else else
begin begin
@ -4098,6 +4062,7 @@ var
DestRect: TRect; DestRect: TRect;
SourceRect: TRect; SourceRect: TRect;
begin begin
if button <> mbLeft then exit;
case FMouseMoveState of case FMouseMoveState of
msZoomWindow: msZoomWindow:
begin begin

View File

@ -1,6 +1,6 @@
object MutateForm: TMutateForm object MutateForm: TMutateForm
Left = 858 Left = 407
Top = 312 Top = 207
BorderIcons = [biSystemMenu, biMinimize] BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle BorderStyle = bsSingle
Caption = 'Mutation' Caption = 'Mutation'

View File

@ -343,10 +343,12 @@ begin
finally finally
Registry.Free; Registry.Free;
end; end;
if cps[0].xform[0].density <> 0 then begin // hmm...!?
Interpolate; Interpolate;
ShowMain; ShowMain;
ShowMutants; ShowMutants;
end; end;
end;
procedure TMutateForm.FormCreate(Sender: TObject); procedure TMutateForm.FormCreate(Sender: TObject);
var var

View File

@ -74,6 +74,7 @@ type
procedure SaveImage(const FileName: String); virtual; procedure SaveImage(const FileName: String); virtual;
procedure Stop; virtual; procedure Stop; virtual;
procedure Pause(paused: boolean); virtual;
property OnProgress: TOnProgress property OnProgress: TOnProgress
read FOnProgress read FOnProgress
@ -285,6 +286,11 @@ begin
FStop := True; FStop := True;
end; end;
procedure TBaseRenderer.Pause(paused: boolean);
begin
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
destructor TBaseRenderer.Destroy; destructor TBaseRenderer.Destroy;
begin begin

View File

@ -210,8 +210,6 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64.InitValues; procedure TRenderer64.InitValues;
var
i, n: integer;
begin begin
InitBuffers; InitBuffers;
CreateCamera; CreateCamera;

View File

@ -73,9 +73,10 @@ type
function GetImage: TBitmap; override; function GetImage: TBitmap; override;
procedure Render; override;
procedure Stop; override; procedure Stop; override;
procedure Render; override; procedure Pause(paused: boolean); override;
procedure UpdateImage(CP: TControlPoint); override; procedure UpdateImage(CP: TControlPoint); override;
procedure SaveImage(const FileName: String); override; procedure SaveImage(const FileName: String); override;
@ -133,20 +134,7 @@ begin
t3 := (2 * max_gutter_width - gutter_width) / (oversample * ppuy); t3 := (2 * max_gutter_width - gutter_width) / (oversample * ppuy);
corner_x := fcp.center[0] - fcp.Width / ppux / 2.0; corner_x := fcp.center[0] - fcp.Width / ppux / 2.0;
corner_y := fcp.center[1] - fcp.Height / ppuy / 2.0; corner_y := fcp.center[1] - fcp.Height / ppuy / 2.0;
{
bounds[0] := corner0 - t0;
bounds[1] := corner1 - t1 + shift;
bounds[2] := corner0 + fcp.Width / ppux + t2;
bounds[3] := corner1 + fcp.Height / ppuy + t3; //+ shift;
if abs(bounds[2] - bounds[0]) > 0.01 then
size[0] := 1.0 / (bounds[2] - bounds[0])
else
size[0] := 1;
if abs(bounds[3] - bounds[1]) > 0.01 then
size[1] := 1.0 / (bounds[3] - bounds[1])
else
size[1] := 1;
}
camX0 := corner_x - t0; camX0 := corner_x - t0;
camY0 := corner_y - t1 + shift; camY0 := corner_y - t1 + shift;
camX1 := corner_x + fcp.Width / ppux + t2; camX1 := corner_x + fcp.Width / ppux + t2;
@ -240,7 +228,6 @@ begin
fcp.Prepare; fcp.Prepare;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64MT.SetPixelsMT; procedure TRenderer64MT.SetPixelsMT;
var var
@ -287,10 +274,24 @@ procedure TRenderer64MT.Stop;
var var
i: integer; i: integer;
begin begin
inherited;
for i := 0 to NrOfTreads - 1 do for i := 0 to NrOfTreads - 1 do
WorkingThreads[i].Terminate; WorkingThreads[i].Terminate;
inherited;
end;
procedure TRenderer64MT.Pause(paused: boolean);
var
i: integer;
begin
if paused then begin
for i := 0 to NrOfTreads - 1 do
WorkingThreads[i].Suspend;
end
else begin
for i := 0 to NrOfTreads - 1 do
WorkingThreads[i].Resume;
end;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -346,19 +347,11 @@ end;
function TRenderer64MT.NewThread: TBucketFillerThread; function TRenderer64MT.NewThread: TBucketFillerThread;
begin begin
Result := TBucketFillerThread.Create(fcp); Result := TBucketFillerThread.Create(fcp);
assert(Result<>nil);
Result.BucketWidth := BucketWidth; Result.BucketWidth := BucketWidth;
Result.BucketHeight := BucketHeight; Result.BucketHeight := BucketHeight;
Result.Buckets := @Buckets; Result.Buckets := @Buckets;
{
Result.size[0] := size[0];
Result.size[1] := size[1];
Result.bounds[0] := Bounds[0];
Result.bounds[1] := Bounds[1];
Result.bounds[2] := Bounds[2];
Result.bounds[3] := Bounds[3];
Result.RotationCenter[0] := FCP.Center[0];
Result.RotationCenter[1] := FCP.Center[1];
}
Result.camX0 := camX0; Result.camX0 := camX0;
Result.camY0 := camY0; Result.camY0 := camY0;
Result.camW := camW; Result.camW := camW;

View File

@ -208,8 +208,6 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64.InitValues; procedure TRendererMM64.InitValues;
var
i: integer;
begin begin
image_height := fcp.Height; image_height := fcp.Height;
image_Width := fcp.Width; image_Width := fcp.Width;

View File

@ -84,6 +84,9 @@ type
procedure SaveImage(const FileName: String); override; procedure SaveImage(const FileName: String); override;
procedure Render; override; procedure Render; override;
procedure Stop; override;
procedure Pause(paused: boolean); override;
property NrOfTreads: integer property NrOfTreads: integer
read FNrOfTreads read FNrOfTreads
@ -134,20 +137,7 @@ begin
t1 := gutter_width / (oversample * ppuy); t1 := gutter_width / (oversample * ppuy);
corner_x := fcp.center[0] - image_width / ppux / 2.0; corner_x := fcp.center[0] - image_width / ppux / 2.0;
corner_y := fcp.center[1] - image_height / ppuy / 2.0; corner_y := fcp.center[1] - image_height / ppuy / 2.0;
{
bounds[0] := corner0 - t0;
bounds[1] := corner1 - t1 + shift;
bounds[2] := corner0 + image_width / ppux + t0;
bounds[3] := corner1 + image_height / ppuy + t1; //+ shift;
if abs(bounds[2] - bounds[0]) > 0.01 then
size[0] := 1.0 / (bounds[2] - bounds[0])
else
size[0] := 1;
if abs(bounds[3] - bounds[1]) > 0.01 then
size[1] := 1.0 / (bounds[3] - bounds[1])
else
size[1] := 1;
}
camX0 := corner_x - t0; camX0 := corner_x - t0;
camY0 := corner_y - t1 + shift; camY0 := corner_y - t1 + shift;
camX1 := corner_x + image_width / ppux + t0; camX1 := corner_x + image_width / ppux + t0;
@ -220,8 +210,6 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64_MT.InitValues; procedure TRendererMM64_MT.InitValues;
var
i, n: integer;
begin begin
image_height := fcp.Height; image_height := fcp.Height;
image_Width := fcp.Width; image_Width := fcp.Width;
@ -333,6 +321,31 @@ begin
Progress(1); Progress(1);
end; end;
///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64_MT.Stop;
var
i: integer;
begin
for i := 0 to NrOfTreads - 1 do
WorkingThreads[i].Terminate;
inherited;
end;
procedure TRendererMM64_MT.Pause(paused: boolean);
var
i: integer;
begin
if paused then begin
for i := 0 to NrOfTreads - 1 do
WorkingThreads[i].Suspend;
end
else begin
for i := 0 to NrOfTreads - 1 do
WorkingThreads[i].Resume;
end;
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
constructor TRendererMM64_MT.Create; constructor TRendererMM64_MT.Create;
begin begin

View File

@ -59,6 +59,8 @@ type
function GetRenderer: TBaseRenderer; function GetRenderer: TBaseRenderer;
procedure Terminate; procedure Terminate;
procedure Suspend;
procedure Resume;
property OnProgress: TOnProgress property OnProgress: TOnProgress
read FOnProgress read FOnProgress
@ -167,6 +169,22 @@ begin
inherited Terminate; inherited Terminate;
end; end;
procedure TRenderThread.Suspend;
begin
if NrThreads > 1 then
if assigned(FRenderer) then FRenderer.Pause(true);
inherited;
end;
procedure TRenderThread.Resume;
begin
if NrThreads > 1 then
if assigned(FRenderer) then FRenderer.Pause(false);
inherited;
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
function TRenderThread.GetNrSlices: integer; function TRenderThread.GetNrSlices: integer;
begin begin
@ -204,18 +222,18 @@ begin
FRenderer := nil; FRenderer := nil;
end; end;
///////////////////////////////////////////////////////////////////////////////end. ///////////////////////////////////////////////////////////////////////////////
procedure TRenderThread.SetNrThreads(const Value: Integer); procedure TRenderThread.SetNrThreads(const Value: Integer);
begin begin
FNrThreads := Value; FNrThreads := Value;
end; end;
///////////////////////////////////////////////////////////////////////////////end. ///////////////////////////////////////////////////////////////////////////////
procedure TRenderThread.SaveImage(const FileName: String); procedure TRenderThread.SaveImage(const FileName: String);
begin begin
if assigned(FRenderer) then if assigned(FRenderer) then
FRenderer.SaveImage(FileName); FRenderer.SaveImage(FileName);
end; end;
///////////////////////////////////////////////////////////////////////////////end. ///////////////////////////////////////////////////////////////////////////////
end. end.

View File

@ -29,6 +29,22 @@ type
type type
TXForm = class TXForm = class
public
vars: array of double; // {normalized} interp coefs between variations
c: array[0..2, 0..1] of double; // the coefs to the affine part of the function
p: array[0..2, 0..1] of double; // post-transform coefs!
density: double; // prob is this function is chosen
color: double; // color coord for this function. 0 - 1
color2: double; // Second color coord for this function. 0 - 1
symmetry: double;
c00, c01, c10, c11, c20, c21: double;
p00, p01, p10, p11, p20, p21: double;
// nx,ny,x,y: double;
// script: TatPascalScripter;
Orientationtype: integer;
private private
FNrFunctions: Integer; FNrFunctions: Integer;
FFunctionList: array of TCalcMethod; FFunctionList: array of TCalcMethod;
@ -92,21 +108,6 @@ type
procedure AddRegVariations; procedure AddRegVariations;
public public
vars: array of double; // {normalized} interp coefs between variations
c: array[0..2, 0..1] of double; // the coefs to the affine part of the function
p: array[0..2, 0..1] of double; // post-transform coefs!
density: double; // prob is this function is chosen
color: double; // color coord for this function. 0 - 1
color2: double; // Second color coord for this function. 0 - 1
symmetry: double;
c00, c01, c10, c11, c20, c21: double;
p00, p01, p10, p11, p20, p21: double;
// nx,ny,x,y: double;
// script: TatPascalScripter;
Orientationtype: integer;
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; procedure Clear;
@ -141,7 +142,7 @@ uses
const const
EPS: double = 1E-6; EPS: double = 1E-6;
procedure SinCos(const Theta: double; var Sin, Cos: double); // I'm not sure, but maybe it'll help... procedure SinCos(const Theta: double; var Sin, Cos: double); // to avoid using 'extended' type
asm asm
FLD Theta FLD Theta
FSINCOS FSINCOS
@ -298,15 +299,26 @@ begin
end; end;
procedure TXForm.PrecalcAngle; procedure TXForm.PrecalcAngle;
{$ifndef _ASM_}
begin
FAngle := arctan2(FTx, FTy);
{$else}
asm asm
fld qword ptr [eax + FTx] fld qword ptr [eax + FTx]
fld qword ptr [eax + FTy] fld qword ptr [eax + FTy]
fpatan fpatan
fstp qword ptr [eax + FAngle] fstp qword ptr [eax + FAngle]
fwait //fwait
{$endif}
end; end;
procedure TXForm.PrecalcSinCos; procedure TXForm.PrecalcSinCos;
{$ifndef _ASM_}
begin
FLength := sqrt(sqr(FTx) + sqr(FTy)) + EPS;
FSinA := FTx / FLength;
FCosA := FTy / FLength;
{$else}
asm asm
fld qword ptr [eax + FTx] fld qword ptr [eax + FTx]
fld qword ptr [eax + FTy] fld qword ptr [eax + FTy]
@ -322,10 +334,18 @@ asm
fstp qword ptr [eax + FLength] fstp qword ptr [eax + FLength]
fstp qword ptr [eax + FCosA] fstp qword ptr [eax + FCosA]
fstp qword ptr [eax + FSinA] fstp qword ptr [eax + FSinA]
fwait //fwait
{$endif}
end; end;
procedure TXForm.PrecalcAll; procedure TXForm.PrecalcAll;
{$ifndef _ASM_}
begin
FLength := sqrt(sqr(FTx) + sqr(FTy)) + EPS;
FSinA := FTx / FLength;
FCosA := FTy / FLength;
FAngle := arctan2(FTx, FTy);
{$else}
asm asm
fld qword ptr [eax + FTx] fld qword ptr [eax + FTx]
fld qword ptr [eax + FTy] fld qword ptr [eax + FTy]
@ -345,12 +365,16 @@ asm
fstp qword ptr [eax + FLength] fstp qword ptr [eax + FLength]
fstp qword ptr [eax + FCosA] fstp qword ptr [eax + FCosA]
fstp qword ptr [eax + FSinA] fstp qword ptr [eax + FSinA]
fwait //fwait
{$endif}
end; end;
procedure TXForm.DoPostTransform; procedure TXForm.DoPostTransform;
// x := p00 * FPx + p10 * FPy + p20; {$ifndef _ASM_}
// y := p01 * FPx + p11 * FPy + p21; begin
x := p00 * FPx + p10 * FPy + p20;
y := p01 * FPx + p11 * FPy + p21;
{$else}
asm asm
fld qword ptr [eax + FPy] fld qword ptr [eax + FPy]
fld qword ptr [eax + FPx] fld qword ptr [eax + FPx]
@ -368,6 +392,7 @@ asm
fadd qword ptr [eax + p21] fadd qword ptr [eax + p21]
fstp qword ptr [eax + FPy] fstp qword ptr [eax + FPy]
fwait fwait
{$endif}
end; end;
//--0--//////////////////////////////////////////////////////////////////////// //--0--////////////////////////////////////////////////////////////////////////
@ -1488,9 +1513,9 @@ var
r, sinr, cosr: double; r, sinr, cosr: double;
begin begin
SinCos(random * 2*pi, sinr, cosr); SinCos(random * 2*pi, sinr, cosr);
r := vars[27]*random;//(sqrt(sqr(ftx)+sqr(fty)) + eps); r := vars[27]*random;
FPx := FPx + {FTx*}r*cosr; FPx := FPx + FTx*r*cosr;
FPy := FPy + {FTy*}r*sinr; FPy := FPy + FTy*r*sinr;
{$else} {$else}
asm asm
mov edx, [ebx + vars] mov edx, [ebx + vars]