-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuAnimTex.pas
64 lines (52 loc) · 1.19 KB
/
uAnimTex.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
unit uAnimTex;
interface
uses
GLScene, GLMaterial, GLTexture, SysUtils, Classes, uCLasses;
type
TFramesList = array of String;
TAnimTex = class
private
FFramesList: TFramesList;
public
MaterialLibrary: TGLMaterialLibrary;
Obj: TGLBaseSceneObject;
CurrentFrame: Integer;
FramesCount: Integer;
Interval: Integer;
MainDir: String;
procedure LoadFromFile(const FileName: String);
procedure Step(DeltaTime: Double);
end;
implementation
{ TAnimTex }
procedure TAnimTex.LoadFromFile(const FileName: String);
Var
Pak: TPak;
i: Integer;
F: TextFile;
begin
try
Pak:= TPak.Create;
Pak.MainDir:= MainDir;
Pak.OpenPak(FileName);
for i:= 1 to FramesCount do
with MaterialLibrary.Materials.Add do
begin
Name:= Obj.Name + 'Frame' + IntToStr(i);
with Material do
begin
Texture.Enabled:= True;
Texture.Image.LoadFromFile(Pak.ExtractFormPak('Frame' + IntToStr(i)));
Texture.TextureWrap:= twNone;
FrontProperties.Diffuse.SetColor(1,1,1);
end;
end;
finally
Pak.ClosePak;
Pak.Free;
end;
end;
procedure TAnimTex.Step(DeltaTime: Double);
begin
end;
end.