Debian Codegraph @

src/deprecated_units/castlematerialproperties.pas

raw
1 {
2 Copyright 2007-2023 Michalis Kamburelis.
3
4 This file is part of "Castle Game Engine".
5
6 "Castle Game Engine" is free software; see the file COPYING.txt,
7 included in this distribution, for details about the copyright.
8
9 "Castle Game Engine" is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 ----------------------------------------------------------------------------
14 }
15
16 { Material and texture properties from external files (TMaterialProperty,
17 global MaterialProperties collection). }
18 unit CastleMaterialProperties deprecated 'use CastleTextureImage unit for TextureLoadingScale, everything else from this unit was internal';
19
20 interface
21
22 {$ifdef FPC}
23 function GetTextureLoadingScale: Cardinal;
24 procedure SetTextureLoadingScale(const Value: Cardinal);
25 property TextureLoadingScale: Cardinal read GetTextureLoadingScale write SetTextureLoadingScale;
26 {$endif}
27
28 type
29 TDummyMaterialProperties = class
30 strict private
31 FUrl: String;
32 procedure SetUrl(const Value: String);
33 public
34 property Url: String read FUrl write SetUrl;
35 end;
36
37 function MaterialProperties: TDummyMaterialProperties;
38
39 implementation
40
41 uses SysUtils, CastleLog, CastleTextureImages;
42
43 function GetTextureLoadingScale: Cardinal;
44 begin
45 Result := CastleTextureImages.TextureLoadingScale;
46 end;
47
48 procedure SetTextureLoadingScale(const Value: Cardinal);
49 begin
50 CastleTextureImages.TextureLoadingScale := Value;
51 end;
52
53 procedure TDummyMaterialProperties.SetUrl(const Value: String);
54 begin
55 if FUrl <> Value then
56 begin
57 FUrl := Value;
58 WritelnWarning('Do not use "MaterialProperties.Url := ..." anymore. Instead place your data in "castle-data:/material_properties.xml" and it will be read automatically.');
59 end;
60 end;
61
62 var
63 FMaterialProperties: TDummyMaterialProperties;
64
65 function MaterialProperties: TDummyMaterialProperties;
66 begin
67 if FMaterialProperties = nil then
68 FMaterialProperties := TDummyMaterialProperties.Create;
69 Result := FMaterialProperties;
70 end;
71
72 initialization
73 finalization
74 FreeAndNil(FMaterialProperties);
75 end.