-
Notifications
You must be signed in to change notification settings - Fork 12
/
Mundus.Mesh.pas
58 lines (49 loc) · 1.19 KB
/
Mundus.Mesh.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
unit Mundus.Mesh;
interface
uses
Types,
Classes,
SysUtils,
Generics.Collections,
Mundus.Math,
Mundus.Types,
Mundus.Shader;
type
TMesh = class
private
FShader: TShaderClass;
protected
FVertexList: TArray<TVector>;
FTriangleList: TObjectList<TTriangleClass>;
FUV: TArray<TFloat2>;
FRotation: TFloat3;
FPosition: TFloat3;
public
constructor Create();
destructor Destroy(); override;
procedure AddVertice(AVertice: TVector);
property Triangles: TObjectList<TTriangleClass> read FTriangleList;
property Vertices: TArray<TVector> read FVertexList;
property UV: TArray<TFloat2> read FUV;
property Position: TFloat3 read FPosition write FPosition;
property Rotation: TFloat3 read FRotation write Frotation;
property Shader: TShaderClass read FShader write FShader;
end;
implementation
{ TBaseMesh }
procedure TMesh.AddVertice(AVertice: TVector);
begin
SetLength(FVertexList, Length(FVertexList)+1);
FVertexList[High(FVertexList)] := AVertice;
end;
constructor TMesh.Create;
begin
inherited;
FTriangleList := TObjectList<TTriangleClass>.Create();
end;
destructor TMesh.Destroy;
begin
FTriangleList.Free();
inherited;
end;
end.