-
Notifications
You must be signed in to change notification settings - Fork 9
/
GBECylinderExtend.pas
114 lines (97 loc) · 3.04 KB
/
GBECylinderExtend.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
unit GBECylinderExtend;
interface
uses
System.SysUtils, System.Classes, FMX.Types, FMX.Controls3D, FMX.Objects3D, FMX.Types3D, FMX.MaterialSources, System.Math.Vectors;
type
TCustomMeshHelper = class(TCustomMesh);
TGBECylinderExtend = class(TCylinder)
private
{ Déclarations privées }
fDiskTop, fDiskBottom : TDisk;
FMaterialSourceTop, FMaterialSourceBottom : TMaterialSource;
procedure CreateGBECylinder;
procedure setMaterialSourceBottom(const Value: TMaterialSource);
procedure setMaterialSourceTop(const Value: TMaterialSource);
protected
{ Déclarations protégées }
public
{ Déclarations publiques }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Render; override;
published
{ Déclarations publiées }
property MaterialSourceTop : TMaterialSource read FMaterialSourceTop write setMaterialSourceTop;
property MaterialSourceBottom : TMaterialSource read FMaterialSourceBottom write setMaterialSourceBottom;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('GBE3D', [TGBECylinderExtend]);
end;
{ TMesh1 }
constructor TGBECylinderExtend.Create(AOwner: TComponent);
begin
inherited;
CreateGBECylinder;
end;
procedure TGBECylinderExtend.CreateGBECylinder;
begin
fDiskTop:=TDisk.Create(nil);
fDiskTop.Locked := true;
fDiskTop.Stored := false;
fDiskTop.SubdivisionsAxes:=SubdivisionsAxes;
fDiskTop.SubdivisionsCap:=SubdivisionsCap;
fDiskTop.Parent := self;
fDiskTop.Position.Y := - fHeight * 0.5;
fDiskTop.Height := fHeight;
fDiskTop.Width := fWidth;
fDiskTop.Depth := fDepth;
fDiskTop.MaterialSource := MaterialSourceTop;
fDiskBottom:=TDisk.Create(nil);
fDiskBottom.Locked := true;
fDiskBottom.Stored := false;
fDiskBottom.SubdivisionsAxes:=SubdivisionsAxes;
fDiskBottom.SubdivisionsCap:=SubdivisionsCap;
fDiskBottom.Parent := self;
fDiskBottom.Position.Y := fHeight * 0.5 + 0.001;
fDiskBottom.Height := fHeight;
fDiskBottom.Width := fWidth;
fDiskBottom.Depth := fDepth;
fDiskBottom.MaterialSource := MaterialSourceBottom;
end;
destructor TGBECylinderExtend.Destroy;
begin
DoDeleteChildren;
inherited;
end;
procedure TGBECylinderExtend.Render;
begin
inherited;
fDiskTop.SubdivisionsAxes:=SubdivisionsAxes;
fDiskTop.SubdivisionsCap:=SubdivisionsCap;
fDiskTop.Position.Y := - fHeight * 0.5;
fDiskTop.Height := fHeight;
fDiskTop.Width := fWidth;
fDiskTop.Depth := fDepth;
fDiskBottom.SubdivisionsAxes:=SubdivisionsAxes;
fDiskBottom.SubdivisionsCap:=SubdivisionsCap;
fDiskBottom.Position.Y := fHeight * 0.5 + 0.001;
fDiskBottom.Height := fHeight;
fDiskBottom.Width := fWidth;
fDiskBottom.Depth := fDepth;
end;
procedure TGBECylinderExtend.setMaterialSourceBottom(
const Value: TMaterialSource);
begin
FMaterialSourceBottom := Value;
fDiskBottom.MaterialSource := FMaterialSourceBottom;
end;
procedure TGBECylinderExtend.setMaterialSourceTop(
const Value: TMaterialSource);
begin
FMaterialSourceTop := Value;
fDiskTop.MaterialSource := FMaterialSourceTop;
end;
end.