Ignore:
Timestamp:
Dec 22, 2016, 8:49:19 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Updated BGRABitmap package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Packages/bgrabitmap/part3d.inc

    r472 r494  
    1414    FCoordPool: TBGRACoordPool3D;
    1515    FNormalPool: TBGRANormalPool3D;
     16    FObject3D: TBGRAObject3D;
    1617  public
    17     constructor Create(AContainer: IBGRAPart3D);
     18    constructor Create(AObject3D: TBGRAObject3D; AContainer: IBGRAPart3D);
    1819    destructor Destroy; override;
    1920    procedure Clear(ARecursive: boolean);
     
    214215end;
    215216
    216 constructor TBGRAPart3D.Create(AContainer: IBGRAPart3D);
    217 begin
     217constructor TBGRAPart3D.Create(AObject3D: TBGRAObject3D; AContainer: IBGRAPart3D);
     218begin
     219  FObject3D := AObject3D;
    218220  FContainer := AContainer;
    219221  FMatrix := MatrixIdentity3D;
     
    229231  FVertexCount := 0;
    230232  if FCoordPool.UsedCapacity > 0 then
    231     raise Exception.Create('Coordinate pool still used');
     233    raise Exception.Create('Coordinate pool still used. Please set vertex references to nil before destroying the scene.');
    232234  FreeAndNil(FCoordPool);
    233235  if Assigned(FNormalPool) then
     
    258260function TBGRAPart3D.Add(x, y, z: single): IBGRAVertex3D;
    259261begin
    260   result := TBGRAVertex3D.Create(FCoordPool,Point3D(x,y,z));
     262  result := TBGRAVertex3D.Create(FObject3D,FCoordPool,Point3D(x,y,z));
    261263  Add(result);
    262264end;
     
    264266function TBGRAPart3D.Add(pt: TPoint3D): IBGRAVertex3D;
    265267begin
    266   result := TBGRAVertex3D.Create(FCoordPool,pt);
     268  result := TBGRAVertex3D.Create(FObject3D,FCoordPool,pt);
    267269  Add(result);
    268270end;
     
    270272function TBGRAPart3D.Add(pt: TPoint3D; normal: TPoint3D): IBGRAVertex3D;
    271273begin
    272   result := TBGRAVertex3D.Create(FCoordPool,pt);
     274  result := TBGRAVertex3D.Create(FObject3D,FCoordPool,pt);
    273275  result.CustomNormal := normal;
    274276  Add(result);
     
    277279function TBGRAPart3D.Add(pt: TPoint3D_128): IBGRAVertex3D;
    278280begin
    279   result := TBGRAVertex3D.Create(FCoordPool,pt);
     281  result := TBGRAVertex3D.Create(FObject3D,FCoordPool,pt);
    280282  Add(result);
    281283end;
     
    283285function TBGRAPart3D.Add(pt: TPoint3D_128; normal: TPoint3D_128): IBGRAVertex3D;
    284286begin
    285   result := TBGRAVertex3D.Create(FCoordPool,pt);
     287  result := TBGRAVertex3D.Create(FObject3D,FCoordPool,pt);
    286288  result.CustomNormal := Point3D(normal);
    287289  Add(result);
     
    312314  setlength(result, length(pts));
    313315  for i := 0 to high(pts) do
    314     result[i] := TBGRAVertex3D.Create(FCoordPool,pts[i]);
     316    result[i] := TBGRAVertex3D.Create(FObject3D,FCoordPool,pts[i]);
    315317  Add(result);
    316318end;
     
    323325  setlength(result, length(pts));
    324326  for i := 0 to high(pts) do
    325     result[i] := TBGRAVertex3D.Create(FCoordPool,pts[i]);
     327    result[i] := TBGRAVertex3D.Create(FObject3D,FCoordPool,pts[i]);
    326328  Add(result);
    327329end;
     
    490492end;
    491493
     494{$PUSH}{$OPTIMIZATION OFF} //avoids Internal error 2012090607
    492495procedure TBGRAPart3D.ComputeWithMatrix(const AMatrix: TMatrix3D; const AProjection: TProjection3D);
    493496var
     
    501504    FParts[i].ComputeWithMatrix(Composed,AProjection);
    502505end;
     506{$POP}
    503507
    504508function TBGRAPart3D.ComputeCoordinate(var ASceneCoord: TPoint3D_128; const AProjection: TProjection3D): TPointF;
     
    550554  if FPartCount = length(FParts) then
    551555    setlength(FParts, FPartCount*2+1);
    552   result := TBGRAPart3D.Create(self);
     556  result := TBGRAPart3D.Create(FObject3D,self);
    553557  FParts[FPartCount] := result;
    554558  inc(FPartCount);
Note: See TracChangeset for help on using the changeset viewer.