procedure ApplicationInitialize; const TestClip = false;
TestClipLine: TVector3Single = (0.5, -1, 0); // 这个是错的。 TestClipLine: TVector3Single = (data:(0.5, -1, 0)); // 这个是对的
因为tvector3single 定义的关系。
注意 常量定义。记录用分号, 数组用逗号
========================================================================================
TGenericVector3 = record public type TIndex = 0..2; strict private function GetItems(const Index: TIndex): TGenericScalar; inline; procedure SetItems(const Index: TIndex; const Value: TGenericScalar); inline; function GetItemsInt(const Index: Integer): TGenericScalar; inline; procedure SetItemsInt(const Index: Integer; const Value: TGenericScalar); inline; {$ifndef ENABLE_SELF_RECORD_CONSTANTS} class function GetOne(const Index: TIndex): TGenericVector3; inline; static; {$endif} public var Data: array [TIndex] of TGenericScalar; {$ifdef ENABLE_SELF_RECORD_CONSTANTS} const Zero: TGenericVector3 = (Data: (0, 0, 0)); { Vectors with a single component equal 1, others equal 0. } One: array [TIndex] of TGenericVector3 = ( (Data: (1, 0, 0)), (Data: (0, 1, 0)), (Data: (0, 0, 1)) ); {$endif}
class operator {$ifdef FPC}+{$else}Add{$endif} (const A, B: TGenericVector3): TGenericVector3; inline; class operator {$ifdef FPC}-{$else}Subtract{$endif} (const A, B: TGenericVector3): TGenericVector3; inline; class operator {$ifdef FPC}-{$else}Negative{$endif} (const V: TGenericVector3): TGenericVector3; inline; class operator {$ifdef FPC}*{$else}Multiply{$endif} (const V: TGenericVector3; const Scalar: TGenericScalar): TGenericVector3; inline; class operator {$ifdef FPC}*{$else}Multiply{$endif} (const Scalar: TGenericScalar; const V: TGenericVector3): TGenericVector3; inline; { Vector * vector makes a component-wise multiplication. This is consistent with GLSL and other vector APIs. } class operator {$ifdef FPC}*{$else}Multiply{$endif} (const V1, V2: TGenericVector3): TGenericVector3; inline; class operator {$ifdef FPC}/{$else}Divide{$endif} (const V: TGenericVector3; const Scalar: TGenericScalar): TGenericVector3; inline;
procedure Init(const X, Y, Z: TGenericScalar); inline; function ToString: string;
{ Convert to string using the most precise (not always easily readable by humans) float format. This may use the exponential (scientific) notation to represent the floating-point value, if needed.
This is suitable for storing the value in a file, with a best precision possible. } function ToRawString: string;