This file is indexed.

/usr/src/castle-game-engine-5.0.0/x3d/x3dnodes_generatedtextures.inc is in castle-game-engine-src 5.0.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
  Copyright 2008-2014 Michalis Kamburelis.

  This file is part of "Castle Game Engine".

  "Castle Game Engine" is free software; see the file COPYING.txt,
  included in this distribution, for details about the copyright.

  "Castle Game Engine" is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

  ----------------------------------------------------------------------------
}

{ Common stuff for generated textures. }

{$ifdef read_interface}

  { Possible update modes for generated textures (like TGeneratedCubeMapTextureNode). }
  TTextureUpdate = (upNone, upNextFrameOnly, upAlways);

  { Update field for rendered textures (like TGeneratedCubeMapTextureNode). }
  TSFTextureUpdate = class(TSFString)
  private
    WarningDone: boolean;
    function GetValue: TTextureUpdate;
    procedure SetValue(const AValue: TTextureUpdate);
  protected
    class function ExposedEventsFieldClass: TX3DFieldClass; override;
  public
    constructor Create(AParentNode: TX3DFileItem; const AName: string;
      const AValue: TTextureUpdate);
    function ExecuteChanges: TX3DChanges; override;

    { Access the string value as TTextureUpdate enum.
      Takes care of doing warning if the underlying string value (in VRML/X3D)
      is invalid. }
    property Value: TTextureUpdate read GetValue write SetValue;

    procedure Send(const AValue: TTextureUpdate);
  end;

  { Common interface for all VRML/X3D generated texture nodes. }
  TGeneratedTextureHandler = class
  private
    FUpdate: TSFTextureUpdate;
  strict private
    FUpdateNeeded: boolean;
  public
    constructor Create;

    { When @link(Update) is upAlways, you can check this to know if really
      something visible changed since last update.
      If not, then you do not have to update the texture --- no point, since
      it would look exactly like the current one.

      Scene classes (TCastleSceneCore, TCastleScene, TGLRenderer)
      take care to set this field. After each actual update of the texture,
      it's set to @false. Each time something visible affecting the look
      of this texture possibly changed, it's set to @true. }
    property UpdateNeeded: boolean read FUpdateNeeded write FUpdateNeeded
      default true;

    property Update: TSFTextureUpdate read FUpdate;
  end;
{$endif read_interface}

{$ifdef read_implementation}
const
  UpdateNames: array [TTextureUpdate] of string =
  { Names below must be lowercase }
  ('none', 'next_frame_only', 'always');

constructor TSFTextureUpdate.Create(AParentNode: TX3DFileItem;
  const AName: string; const AValue: TTextureUpdate);
begin
  inherited Create(AParentNode, AName, UpdateNames[AValue]);
end;

function TSFTextureUpdate.GetValue: TTextureUpdate;
var
  S: string;
  Index: Integer;
begin
  S := inherited Value;
  Index := ArrayPosStr(LowerCase(S), UpdateNames);

  if Index = -1 then
  begin
    if not WarningDone then
      OnWarning(wtMajor, 'VRML/X3D', Format('update field has invalid value "%s", will be treated like "NONE"',
        [S]));
    WarningDone := true;
    Result := upNone;
  end else
    Result := TTextureUpdate(Index);
end;

procedure TSFTextureUpdate.SetValue(const AValue: TTextureUpdate);
begin
  inherited Value := UpdateNames[AValue];
end;

procedure TSFTextureUpdate.Send(const AValue: TTextureUpdate);
begin
  inherited Send(UpdateNames[AValue]);
end;

class function TSFTextureUpdate.ExposedEventsFieldClass: TX3DFieldClass;
begin
  Result := TSFString;
end;

function TSFTextureUpdate.ExecuteChanges: TX3DChanges;
begin
  { This causes appropriate @link(Changes): [chRedisplay] if value <> upNone.
    Then necessary things will be done automatically
    at next UpdateGeneratedTextures call, so nothing besides chRedisplay
    is required.

    Note we do not pass chVisibleGeometry, chVisibleNonGeometry, or such.
    So VisibleChangeHere will be called with [].
    That's logical --- only the change of "update" field doesn't visibly
    change anything on the scene. This means that if you change update
    to upAlways, but no visible change was registered since last update
    of the texture, the texture will not be actually immediately
    regenerated --- correct optimization!

    If value is upNone, nothing needs to be done. }

  if Value <> upNone then
    Result := [chRedisplay] else
    Result := [];
end;

constructor TGeneratedTextureHandler.Create;
begin
  inherited;
  FUpdateNeeded := true;
end;
{$endif read_implementation}