| 1 |
{%MainUnit castlerenderoptions.pas} |
| 2 |
{ |
| 3 |
Copyright 2002-2023 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
{$ifdef read_interface} |
| 18 |
|
| 19 |
type |
| 20 |
TCastleRenderOptions = class; |
| 21 |
|
| 22 |
TCastleRenderOptionsEvent = procedure (const Options: TCastleRenderOptions) of object; |
| 23 |
|
| 24 |
{ Options that control rendering, |
| 25 |
available at every scene through @link(TCastleScene.RenderOptions). } |
| 26 |
TCastleRenderOptions = class(TCastleComponent) |
| 27 |
strict private |
| 28 |
type |
| 29 |
TRenderOptionsHash = Int32; |
| 30 |
var |
| 31 |
FLighting: Boolean; |
| 32 |
FReceiveSceneLights, FReceiveGlobalLights: Boolean; |
| 33 |
FTextures: Boolean; |
| 34 |
FMinificationFilter: TAutoMinificationFilter; |
| 35 |
FMagnificationFilter: TAutoMagnificationFilter; |
| 36 |
FPointSize: Single; |
| 37 |
FLineWidth: Single; |
| 38 |
FBumpMapping: TBumpMapping; |
| 39 |
FBumpMappingParallaxHeight: Single; |
| 40 |
FMode: TRenderingMode; |
| 41 |
FShadowSampling: TShadowSampling; |
| 42 |
FDepthTest: Boolean; |
| 43 |
FPhongShading: Boolean; |
| 44 |
FSolidColor: TCastleColorRGB; |
| 45 |
FMaxLightsPerShape: Cardinal; |
| 46 |
FBlending: Boolean; |
| 47 |
FBlendingSourceFactor: TBlendingSourceFactor; |
| 48 |
FBlendingDestinationFactor: TBlendingDestinationFactor; |
| 49 |
FWireframeColor: TCastleColorRGB; |
| 50 |
FWireframeEffect: TWireframeEffect; |
| 51 |
FSolidWireframeScale: Single; |
| 52 |
FSolidWireframeBias: Single; |
| 53 |
FSilhouetteScale: Single; |
| 54 |
FSilhouetteBias: Single; |
| 55 |
FRobustNegativeScale: Boolean; |
| 56 |
FWholeSceneManifold: Boolean; |
| 57 |
FColorChannels: TColorChannels; |
| 58 |
|
| 59 |
{ Hash to quickly compare 2 TCastleRenderOptions instances, |
| 60 |
important for efficient batching. } |
| 61 |
FHash: TRenderOptionsHash; |
| 62 |
|
| 63 |
// Property setters that |
| 64 |
// - call UpdateHash |
| 65 |
// - sometimes call ReleaseCachedResources |
| 66 |
procedure SetTextures(const Value: Boolean); |
| 67 |
procedure SetMinificationFilter(const Value: TAutoMinificationFilter); |
| 68 |
procedure SetMagnificationFilter(const Value: TAutoMagnificationFilter); |
| 69 |
procedure SetBumpMapping(const Value: TBumpMapping); |
| 70 |
procedure SetMode(const Value: TRenderingMode); |
| 71 |
procedure SetShadowSampling(const Value: TShadowSampling); |
| 72 |
procedure SetBlending(const Value: Boolean); |
| 73 |
procedure SetBlendingSourceFactor(const Value: TBlendingSourceFactor); |
| 74 |
procedure SetBlendingDestinationFactor(const Value: TBlendingDestinationFactor); |
| 75 |
procedure SetPhongShading(const Value: Boolean); |
| 76 |
procedure SetWireframeColor(const Value: TCastleColorRGB); |
| 77 |
procedure SetWireframeEffect(const Value: TWireframeEffect); |
| 78 |
procedure SetSolidWireframeScale(const Value: Single); |
| 79 |
procedure SetSolidWireframeBias(const Value: Single); |
| 80 |
procedure SetSilhouetteScale(const Value: Single); |
| 81 |
procedure SetSilhouetteBias(const Value: Single); |
| 82 |
procedure SetRobustNegativeScale(const Value: Boolean); |
| 83 |
procedure SetWholeSceneManifold(const Value: Boolean); |
| 84 |
procedure SetColorChannels(const Value: TColorChannels); |
| 85 |
procedure SetMaxLightsPerShape(const Value: Cardinal); |
| 86 |
procedure SetDepthTest(const Value: Boolean); |
| 87 |
procedure SetReceiveSceneLights(const Value: Boolean); |
| 88 |
procedure SetReceiveGlobalLights(const Value: Boolean); |
| 89 |
procedure SetSolidColor(const Value: TCastleColorRGB); |
| 90 |
procedure SetPointSize(const Value: Single); |
| 91 |
procedure SetLineWidth(const Value: Single); |
| 92 |
procedure SetBumpMappingParallaxHeight(const Value: Single); |
| 93 |
procedure SetLighting(const Value: Boolean); |
| 94 |
|
| 95 |
procedure UpdateHash; |
| 96 |
|
| 97 |
function IsStoredBumpMappingParallaxHeight: Boolean; |
| 98 |
function IsStoredLineWidth: Boolean; |
| 99 |
function IsStoredPointSize: Boolean; |
| 100 |
function IsStoredSilhouetteBias: Boolean; |
| 101 |
function IsStoredSilhouetteScale: Boolean; |
| 102 |
function IsStoredSolidWireframeBias: Boolean; |
| 103 |
function IsStoredSolidWireframeScale: Boolean; |
| 104 |
protected |
| 105 |
{ Called before changing an attribute that requires the release |
| 106 |
of things cached in a renderer. This includes attributes that affect: |
| 107 |
|
| 108 |
@unorderedList( |
| 109 |
@item(How TShapeCache.Arrays contents are generated. |
| 110 |
For example, Generator uses TexCoordsNeeded, so changing |
| 111 |
any attribute that affects TexCoordsNeeded calls this method.) |
| 112 |
|
| 113 |
@item(How (and if) TShapeCache.Vbo are loaded.) |
| 114 |
|
| 115 |
@item(How textures are loaded (texture filtering options affect them).) |
| 116 |
) } |
| 117 |
procedure ReleaseCachedResources; virtual; |
| 118 |
public |
| 119 |
const |
| 120 |
DefaultPointSize = 3.0; |
| 121 |
DefaultLineWidth = 2.0; |
| 122 |
DefaultBumpMapping = bmBasic; |
| 123 |
DefaultBumpMappingParallaxHeight = 0.01; |
| 124 |
DefaultPhongShading = true; |
| 125 |
DefaultMaxLightsPerShape = 64; |
| 126 |
|
| 127 |
{ Default value of @link(TCastleRenderOptions.BlendingSourceFactor). |
| 128 |
This is the typical blending operation. } |
| 129 |
DefaultBlendingSourceFactor = bsSrcAlpha; |
| 130 |
|
| 131 |
{ Default value of @link(TCastleRenderOptions.BlendingDestinationFactor). |
| 132 |
This is the typical blending operation. } |
| 133 |
DefaultBlendingDestinationFactor = bdOneMinusSrcAlpha; |
| 134 |
|
| 135 |
DefaultWireframeColor: TCastleColorRGB = (X: 0; Y: 0; Z: 0); |
| 136 |
|
| 137 |
DefaultSolidWireframeScale = 1; |
| 138 |
DefaultSolidWireframeBias = 1; |
| 139 |
DefaultSilhouetteScale = 5; |
| 140 |
DefaultSilhouetteBias = 5; |
| 141 |
|
| 142 |
DefaultShadowSampling = ssPCF16; |
| 143 |
|
| 144 |
class var |
| 145 |
{ Value used when @link(MinificationFilter) is minDefault. |
| 146 |
By default, this is minLinearMipmapLinear. } |
| 147 |
DefaultMinificationFilter: TMinificationFilter; |
| 148 |
{ Value used when @link(MagnificationFilter) is magDefault. |
| 149 |
By default, this is magLinear. } |
| 150 |
DefaultMagnificationFilter: TMagnificationFilter; |
| 151 |
{ Adjust attributes of all loaded resources. } |
| 152 |
OnCreate: TCastleRenderOptionsEvent; |
| 153 |
|
| 154 |
constructor Create(AOwner: TComponent); override; |
| 155 |
destructor Destroy; override; |
| 156 |
procedure Assign(Source: TPersistent); override; |
| 157 |
procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override; |
| 158 |
function PropertySections(const PropertyName: String): TPropertySections; override; |
| 159 |
|
| 160 |
{ Equal TCastleRenderOptions produce the same effect when rendering |
| 161 |
and can be treated as exactly equivalent by the @link(TCastleViewport.DynamicBatching) |
| 162 |
algorithm. } |
| 163 |
function Equals(Obj: TObject): Boolean; override; |
| 164 |
|
| 165 |
{ Is the second TCastleRenderOptions instance on all fields |
| 166 |
that affect TShapeCache, that is things that affect generated geometry |
| 167 |
arrays or vbo. This compares the subset of variables that call |
| 168 |
ReleaseCachedResources --- only the ones that affect TShapeCache. } |
| 169 |
function EqualForShapeCache(SecondValue: TCastleRenderOptions): boolean; virtual; |
| 170 |
|
| 171 |
{ Rendering mode, can be used to disable many rendering features at once. } |
| 172 |
property Mode: TRenderingMode read FMode write SetMode default rmFull; |
| 173 |
|
| 174 |
{ By default, we use depth testing to determine which objects are in front |
| 175 |
of the others. This allows to display all 3D content (all TCastleScene |
| 176 |
instances, and all shapes inside them) in any order. |
| 177 |
|
| 178 |
For very special purposes, you can disable depth testing. |
| 179 |
This means that 3D objects will always be drawn in front of the previous |
| 180 |
ones, in the order in which they are rendered, |
| 181 |
ignoring the contents of the depth buffer. Use only if you know |
| 182 |
what you're doing, if you're sure that the order of rendering will |
| 183 |
always be good. } |
| 184 |
property DepthTest: boolean read FDepthTest write SetDepthTest default true; |
| 185 |
|
| 186 |
{ Color used when @link(Mode) is @link(rmSolidColor). |
| 187 |
By default BlackRGB. } |
| 188 |
property SolidColor: TCastleColorRGB read FSolidColor write SetSolidColor; |
| 189 |
|
| 190 |
{ Wireframe color, used with some WireframeEffect values. |
| 191 |
Default value is DefaultWireframeColor. } |
| 192 |
property WireframeColor: TCastleColorRGB |
| 193 |
read FWireframeColor write SetWireframeColor; |
| 194 |
|
| 195 |
{ Which color buffer channels (RGBA) to write when rendering this model. |
| 196 |
|
| 197 |
This makes a cool effect, avoiding writing to some color channels, |
| 198 |
but writing others, and writing depth buffer. |
| 199 |
This property may change to be non-internal some day, please report |
| 200 |
on Castle Game Engine forum / Discord / GitHub |
| 201 |
( https://castle-engine.io/talk.php ) if you find it useful. } |
| 202 |
property InternalColorChannels: TColorChannels |
| 203 |
read FColorChannels write SetColorChannels default AllColorChannels; |
| 204 |
published |
| 205 |
{ Enable real-time lighting when rendering. } |
| 206 |
property Lighting: boolean read FLighting write SetLighting default true; |
| 207 |
|
| 208 |
{ Use lights defined in this scene (in the model loaded to this TCastleScene) |
| 209 |
to light the shapes in this scene. |
| 210 |
|
| 211 |
Note: This property controls whether lights defined within a model (TCastleScene) |
| 212 |
affect the shapes in the same model. |
| 213 |
In case of such lights, the value of @link(TCastleScene.CastGlobalLights) |
| 214 |
and @link(ReceiveGlobalLights) doesn't matter. Only this property, ReceiveSceneLights, controls |
| 215 |
whether such lights work. |
| 216 |
|
| 217 |
The other lights are controlled by @link(ReceiveGlobalLights). |
| 218 |
|
| 219 |
This doesn't matter if @link(Lighting) is @false. |
| 220 |
Also, if both ReceiveSceneLights and ReceiveGlobalLights are @false, |
| 221 |
then the scene receives no lighting at all. } |
| 222 |
property ReceiveSceneLights: boolean |
| 223 |
read FReceiveSceneLights write SetReceiveSceneLights default true; |
| 224 |
|
| 225 |
{ Use lights defined in other scenes to light the shapes in this scene. |
| 226 |
|
| 227 |
This property controls whether @italic(other) scenes with |
| 228 |
@link(TCastleScene.CastGlobalLights), |
| 229 |
as well as headlight, shine on this scene. |
| 230 |
|
| 231 |
This doesn't matter if @link(Lighting) is @false. |
| 232 |
Also, if both ReceiveSceneLights and ReceiveGlobalLights are @false, |
| 233 |
then the scene receives no lighting at all. } |
| 234 |
property ReceiveGlobalLights: boolean |
| 235 |
read FReceiveGlobalLights write SetReceiveGlobalLights default true; |
| 236 |
|
| 237 |
{ Use textures. } |
| 238 |
property Textures: boolean |
| 239 |
read FTextures write SetTextures default true; |
| 240 |
|
| 241 |
{ Default minification and magnification filters for textures. |
| 242 |
These can be overridden on a per-texture basis in VRML / X3D files |
| 243 |
by X3D TextureProperties node (see X3D specification). |
| 244 |
|
| 245 |
They can be equal to minDefault, magDefault in which case they |
| 246 |
actually use the values from |
| 247 |
DefaultMinificationFilter, DefaultMagnificationFilter |
| 248 |
(by default minLinearMipmapLinear, magLinear). |
| 249 |
|
| 250 |
@groupBegin } |
| 251 |
property MinificationFilter: TAutoMinificationFilter |
| 252 |
read FMinificationFilter write SetMinificationFilter default minDefault; |
| 253 |
property MagnificationFilter: TAutoMagnificationFilter |
| 254 |
read FMagnificationFilter write SetMagnificationFilter default magDefault; |
| 255 |
{ @groupEnd } |
| 256 |
|
| 257 |
{ Size of points. This has an effect on TPointSetNode rendering. |
| 258 |
Must be > 0. } |
| 259 |
property PointSize: Single |
| 260 |
read FPointSize write SetPointSize stored IsStoredPointSize; |
| 261 |
|
| 262 |
{ Line width. This has an effect on TLineSetNode rendering, |
| 263 |
and on wireframe rendering when @link(TCastleRenderOptions.WireframeEffect) indicates it. |
| 264 |
Must be > 0. } |
| 265 |
property LineWidth: Single |
| 266 |
read FLineWidth write SetLineWidth stored IsStoredLineWidth; |
| 267 |
|
| 268 |
{ Use bump mapping. The bump mapping is only done when particular shape |
| 269 |
defines a normal map (and a height map, if you want parallax bump mapping). |
| 270 |
See https://castle-engine.io/bump_mapping . |
| 271 |
|
| 272 |
The normal map is usually provided in |
| 273 |
the @link(TAbstractOneSidedMaterialNode.NormalTexture) field. |
| 274 |
@link(TAbstractOneSidedMaterialNode) is an ancestor of all useful |
| 275 |
material nodes, like @link(TMaterialNode) (Phong lighting), |
| 276 |
@link(TPhysicalMaterialNode) (PBR lighting), and even |
| 277 |
@link(TUnlitMaterialNode) (unlit -- doesn't use normals for lighting, |
| 278 |
but may still use them e.g. for tex coord generation). |
| 279 |
So all material nodes allow to specify normal map. |
| 280 |
|
| 281 |
See TBumpMapping for various possible values. } |
| 282 |
property BumpMapping: TBumpMapping |
| 283 |
read FBumpMapping write SetBumpMapping default DefaultBumpMapping; |
| 284 |
|
| 285 |
{ Maximum height expressed in the normal map alpha channel, |
| 286 |
used only when @link(BumpMapping) indicates one of the "parallax" options. |
| 287 |
|
| 288 |
By default this is ignored because @link(BumpMapping) by default is just bmBasic, |
| 289 |
which ignores the height map in the normal map alpha channel. |
| 290 |
If your normal map includes an alpha channel, |
| 291 |
and you set @link(BumpMapping) to a value bmParallax, bmSteepParallax, |
| 292 |
bmSteepParallaxShadowing then this property is used to interpret the height information. } |
| 293 |
property BumpMappingParallaxHeight: Single |
| 294 |
read FBumpMappingParallaxHeight write SetBumpMappingParallaxHeight |
| 295 |
stored IsStoredBumpMappingParallaxHeight; |
| 296 |
|
| 297 |
{ Whether to use Phong shading by default. |
| 298 |
|
| 299 |
Note that each shape may override it by @link(TAbstractShapeNode.Shading) field. |
| 300 |
|
| 301 |
Note that Phong shading is forced anyway by various situations: |
| 302 |
|
| 303 |
@unorderedList( |
| 304 |
@itemSpacing Compact |
| 305 |
@item PBR materials (TPhysicalMaterialNode, in particular imported from glTF) |
| 306 |
@item Using textures like normal maps, specular maps |
| 307 |
@item Using shadow maps |
| 308 |
) } |
| 309 |
property PhongShading: boolean read FPhongShading write SetPhongShading |
| 310 |
default DefaultPhongShading; |
| 311 |
|
| 312 |
{ Shadow maps sampling. Various approaches result in various quality and speed. } |
| 313 |
property ShadowSampling: TShadowSampling |
| 314 |
read FShadowSampling write SetShadowSampling |
| 315 |
default DefaultShadowSampling; |
| 316 |
|
| 317 |
{ For efficiency reasons, we only allow a finite number of lights that can affect |
| 318 |
the given shape. |
| 319 |
|
| 320 |
You can increase this number if necessary, |
| 321 |
although note that it is alreday quite large by default. |
| 322 |
Instead of increasing this limit, |
| 323 |
it is always more efficient to design your scenes to fit within this limit. |
| 324 |
Use the light source radius and/or scope (e.g. you can use "radius" in Blender, |
| 325 |
it is exported OK to glTF), and make smaller shapes. |
| 326 |
|
| 327 |
Note that on ancient dekstops, with fixed-function OpenGL pipeline, |
| 328 |
there is an additional hard limit (dependent on GPU, but usually 8, for this). |
| 329 |
But on modern desktops, as well as mobile and other platforms, |
| 330 |
you can increase this limit freely. } |
| 331 |
property MaxLightsPerShape: Cardinal |
| 332 |
read FMaxLightsPerShape write SetMaxLightsPerShape default DefaultMaxLightsPerShape; |
| 333 |
|
| 334 |
{ Render partially transparent objects. |
| 335 |
|
| 336 |
More precisely: if this is @true, all shapes with |
| 337 |
transparent materials or textures with non-trivial (not only yes/no) |
| 338 |
alpha channel will be rendered using blending. |
| 339 |
See https://castle-engine.io/blending |
| 340 |
for details how it works. |
| 341 |
|
| 342 |
If this is @false, everything will be rendered as opaque. } |
| 343 |
property Blending: boolean |
| 344 |
read FBlending write SetBlending default true; |
| 345 |
|
| 346 |
{ Blending function parameters, used when @link(Blending). |
| 347 |
|
| 348 |
See https://castle-engine.io/blending |
| 349 |
for more information about blending. |
| 350 |
|
| 351 |
For the exact meaning of BlendingSourceFactor and BlendingDestinationFactor |
| 352 |
consult OpenGL specification of glBlendFunc, |
| 353 |
https://registry.khronos.org/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml . |
| 354 |
Regardless of whether we use OpenGL for rendering, these properties |
| 355 |
and their values will reflect the equations there. |
| 356 |
|
| 357 |
The typical blending setup (default) is to use |
| 358 |
|
| 359 |
@unorderedList( |
| 360 |
@item(BlendingSourceFactor = |
| 361 |
DefaultBlendingSourceFactor = |
| 362 |
bsSrcAlpha.) |
| 363 |
@item(BlendingDestinationFactor = |
| 364 |
DefaultBlendingDestinationFactor = |
| 365 |
bdOneMinusSrcAlpha. |
| 366 |
) |
| 367 |
) |
| 368 |
|
| 369 |
This is the standard that follows most intuitive transparency equation. |
| 370 |
The major drawback of this default (and why you may want to consider |
| 371 |
alternatives) is that it depends on a correct order of rendering |
| 372 |
partially-transparent shapes. |
| 373 |
|
| 374 |
CGE allows to cope with it: |
| 375 |
|
| 376 |
@orderedList( |
| 377 |
@item(When multiple transparent shapes are possible, |
| 378 |
sort the transparent shapes, using |
| 379 |
@link(TCastleViewport.BlendingSort). |
| 380 |
|
| 381 |
Note that it cannot |
| 382 |
be perfect in certain cases (like when transparent shape is one, concave, |
| 383 |
mesh). |
| 384 |
) |
| 385 |
|
| 386 |
@item(For closed convex 3D objects, use backface culling. |
| 387 |
|
| 388 |
To do this, set on geometries @link(TAbstractGeometryNode.Solid) |
| 389 |
to @true, this activates backface culling. |
| 390 |
|
| 391 |
In practice you usually set this in a 3D authoring application, |
| 392 |
like Blender. This is called just "Backface Culling" in Blender, |
| 393 |
checkbox is in the Blender material properties. |
| 394 |
This information is then exported to glTF or X3D and just used |
| 395 |
by CGE.) |
| 396 |
|
| 397 |
@item(Finally, consider a different blending equation: |
| 398 |
|
| 399 |
Changing BlendingDestinationFactor to bdOne means that sorting |
| 400 |
isn't necessary. On the other hand, it only adds to the color, |
| 401 |
often making too bright results. |
| 402 |
) |
| 403 |
) |
| 404 |
|
| 405 |
Note that these properties can be overridden on each shape |
| 406 |
using @link(TBlendModeNode). |
| 407 |
See https://castle-engine.io/x3d_extensions.php#section_ext_blending |
| 408 |
for details of TBlendModeNode. |
| 409 |
|
| 410 |
@groupBegin } |
| 411 |
property BlendingSourceFactor: TBlendingSourceFactor |
| 412 |
read FBlendingSourceFactor write SetBlendingSourceFactor |
| 413 |
default DefaultBlendingSourceFactor; |
| 414 |
property BlendingDestinationFactor: TBlendingDestinationFactor |
| 415 |
read FBlendingDestinationFactor write SetBlendingDestinationFactor |
| 416 |
default DefaultBlendingDestinationFactor; |
| 417 |
{ @groupEnd } |
| 418 |
|
| 419 |
{ Activate various effects related to wireframe rendering. |
| 420 |
When this is weNormal (default), we simply render polygons as polygons. |
| 421 |
See description of TWireframeEffect for what other modes do. |
| 422 |
|
| 423 |
Note: How the wireframe effects work when Mode = rmDepth is undefined now. |
| 424 |
Don't use Mode = rmDepth with WireframeEffect <> weNormal. } |
| 425 |
property WireframeEffect: TWireframeEffect |
| 426 |
read FWireframeEffect write SetWireframeEffect default weNormal; |
| 427 |
|
| 428 |
property SolidWireframeScale: Single |
| 429 |
read FSolidWireframeScale write SetSolidWireframeScale stored IsStoredSolidWireframeScale; |
| 430 |
property SolidWireframeBias: Single |
| 431 |
read FSolidWireframeBias write SetSolidWireframeBias stored IsStoredSolidWireframeBias; |
| 432 |
property SilhouetteScale: Single |
| 433 |
read FSilhouetteScale write SetSilhouetteScale stored IsStoredSilhouetteScale; |
| 434 |
property SilhouetteBias: Single |
| 435 |
read FSilhouetteBias write SetSilhouetteBias stored IsStoredSilhouetteBias; |
| 436 |
|
| 437 |
{ Support lighting and backface culling for models using negative scale. |
| 438 |
This has a small performance cost, and so is disabled by default. } |
| 439 |
property RobustNegativeScale: Boolean |
| 440 |
read FRobustNegativeScale write SetRobustNegativeScale default false; |
| 441 |
|
| 442 |
{ When considering this scene to be a shadow caster for shadow volumes, |
| 443 |
assume it is 2-manifold when treated as whole scene (each separate |
| 444 |
shape may be not 2-manifold). This means that you guarantee that |
| 445 |
all border edges of all shapes match with each other, closing the skin |
| 446 |
of the model perfectly. |
| 447 |
See https://castle-engine.io/shadow_volumes |
| 448 |
about using shadow volumes and the requirement to be 2-manifold. |
| 449 |
|
| 450 |
If this is @true then, even if some shapes are not 2-manifold, |
| 451 |
we will generate shadow (using shadow volumes) from them. |
| 452 |
And we will never reject shadows from a particular shape, |
| 453 |
we will either reject whole scene shadow, or render whole scene shadow. |
| 454 |
|
| 455 |
It is the user responsibility to guarantee that whole scene is |
| 456 |
really 2-manifold. If it is not, then shadow volumes may exhibit |
| 457 |
weird artifacts. } |
| 458 |
property WholeSceneManifold: Boolean |
| 459 |
read FWholeSceneManifold write SetWholeSceneManifold default false; |
| 460 |
|
| 461 |
{$define read_interface_class} |
| 462 |
{$I auto_generated_persistent_vectors/tcastlerenderoptions_persistent_vectors.inc} |
| 463 |
{$undef read_interface_class} |
| 464 |
end; |
| 465 |
|
| 466 |
TCastleRenderOptionsClass = class of TCastleRenderOptions; |
| 467 |
|
| 468 |
{$endif read_interface} |
| 469 |
|
| 470 |
{$ifdef read_implementation} |
| 471 |
|
| 472 |
{ TCastleRenderOptions --------------------------------------------------- } |
| 473 |
|
| 474 |
constructor TCastleRenderOptions.Create(AOwner: TComponent); |
| 475 |
begin |
| 476 |
inherited; |
| 477 |
|
| 478 |
FLighting := true; |
| 479 |
FReceiveSceneLights := true; |
| 480 |
FReceiveGlobalLights := true; |
| 481 |
FTextures := true; |
| 482 |
FMinificationFilter := minDefault; |
| 483 |
FMagnificationFilter := magDefault; |
| 484 |
FPointSize := DefaultPointSize; |
| 485 |
FLineWidth := DefaultLineWidth; |
| 486 |
FBumpMapping := DefaultBumpMapping; |
| 487 |
FBumpMappingParallaxHeight := DefaultBumpMappingParallaxHeight; |
| 488 |
FShadowSampling := DefaultShadowSampling; |
| 489 |
FDepthTest := true; |
| 490 |
FPhongShading := DefaultPhongShading; |
| 491 |
FMaxLightsPerShape := DefaultMaxLightsPerShape; |
| 492 |
FBlending := true; |
| 493 |
FBlendingSourceFactor := DefaultBlendingSourceFactor; |
| 494 |
FBlendingDestinationFactor := DefaultBlendingDestinationFactor; |
| 495 |
FSolidWireframeScale := DefaultSolidWireframeScale; |
| 496 |
FSolidWireframeBias := DefaultSolidWireframeBias; |
| 497 |
FSilhouetteScale := DefaultSilhouetteScale; |
| 498 |
FSilhouetteBias := DefaultSilhouetteBias; |
| 499 |
FWireframeEffect := weNormal; |
| 500 |
FWireframeColor := DefaultWireframeColor; |
| 501 |
FColorChannels := AllColorChannels; |
| 502 |
|
| 503 |
{$define read_implementation_constructor} |
| 504 |
{$I auto_generated_persistent_vectors/tcastlerenderoptions_persistent_vectors.inc} |
| 505 |
{$undef read_implementation_constructor} |
| 506 |
|
| 507 |
if Assigned(OnCreate) then |
| 508 |
OnCreate(Self); |
| 509 |
end; |
| 510 |
|
| 511 |
destructor TCastleRenderOptions.Destroy; |
| 512 |
begin |
| 513 |
{$define read_implementation_destructor} |
| 514 |
{$I auto_generated_persistent_vectors/tcastlerenderoptions_persistent_vectors.inc} |
| 515 |
{$undef read_implementation_destructor} |
| 516 |
inherited; |
| 517 |
end; |
| 518 |
|
| 519 |
procedure TCastleRenderOptions.Assign(Source: TPersistent); |
| 520 |
begin |
| 521 |
if Source is TCastleRenderOptions then |
| 522 |
begin |
| 523 |
Lighting := TCastleRenderOptions(Source).Lighting; |
| 524 |
ReceiveSceneLights := TCastleRenderOptions(Source).ReceiveSceneLights; |
| 525 |
ReceiveGlobalLights := TCastleRenderOptions(Source).ReceiveGlobalLights; |
| 526 |
Textures := TCastleRenderOptions(Source).Textures; |
| 527 |
MinificationFilter := TCastleRenderOptions(Source).MinificationFilter; |
| 528 |
MagnificationFilter := TCastleRenderOptions(Source).MagnificationFilter; |
| 529 |
PointSize := TCastleRenderOptions(Source).PointSize; |
| 530 |
LineWidth := TCastleRenderOptions(Source).LineWidth; |
| 531 |
Blending := TCastleRenderOptions(Source).Blending; |
| 532 |
BlendingSourceFactor := TCastleRenderOptions(Source).BlendingSourceFactor; |
| 533 |
BlendingDestinationFactor := TCastleRenderOptions(Source).BlendingDestinationFactor; |
| 534 |
end else |
| 535 |
inherited; |
| 536 |
end; |
| 537 |
|
| 538 |
function TCastleRenderOptions.EqualForShapeCache( |
| 539 |
SecondValue: TCastleRenderOptions): boolean; |
| 540 |
begin |
| 541 |
Result := |
| 542 |
(SecondValue.Textures = Textures); |
| 543 |
end; |
| 544 |
|
| 545 |
function TCastleRenderOptions.Equals(Obj: TObject): Boolean; |
| 546 |
begin |
| 547 |
Result := |
| 548 |
(Obj is TCastleRenderOptions) and |
| 549 |
(FHash = TCastleRenderOptions(Obj).FHash); |
| 550 |
end; |
| 551 |
|
| 552 |
procedure TCastleRenderOptions.ReleaseCachedResources; |
| 553 |
begin |
| 554 |
end; |
| 555 |
|
| 556 |
{$I norqcheckbegin.inc} |
| 557 |
procedure TCastleRenderOptions.UpdateHash; |
| 558 |
|
| 559 |
function SingleOrd(const S: Single): TRenderOptionsHash; |
| 560 |
begin |
| 561 |
Result := Round(S * 1000); |
| 562 |
end; |
| 563 |
|
| 564 |
function ColorOrd(const C: TCastleColorRGB): TRenderOptionsHash; |
| 565 |
begin |
| 566 |
Result := |
| 567 |
Round(C.X * 1000) + |
| 568 |
Round(C.Y * 1000 * 1000) + |
| 569 |
Round(C.Z * 1000 * 1000 * 1000); |
| 570 |
end; |
| 571 |
|
| 572 |
(* Unused now. |
| 573 |
function PtrOrd(const P: Pointer): TRenderOptionsHash; |
| 574 |
begin |
| 575 |
{ On 64-bit platforms, cut pointer to least significant 32 bits. |
| 576 |
That's OK for hash. } |
| 577 |
Result := TRenderOptionsHash(PtrUInt(P)); |
| 578 |
end; |
| 579 |
*) |
| 580 |
|
| 581 |
function ColorChannelsOrd(const C: TColorChannels): TRenderOptionsHash; |
| 582 |
begin |
| 583 |
Result := |
| 584 |
179 * Ord(0 in C) + |
| 585 |
181 * Ord(1 in C) + |
| 586 |
191 * Ord(2 in C) + |
| 587 |
193 * Ord(3 in C); |
| 588 |
end; |
| 589 |
|
| 590 |
begin |
| 591 |
// https://en.wikipedia.org/wiki/List_of_prime_numbers |
| 592 |
FHash := |
| 593 |
2 * Ord(FLighting) + |
| 594 |
3 * Ord(FReceiveSceneLights) + |
| 595 |
5 * Ord(FReceiveGlobalLights) + |
| 596 |
7 * Ord(FTextures) + |
| 597 |
11 * Ord(FMinificationFilter) + |
| 598 |
13 * Ord(FMagnificationFilter) + |
| 599 |
17 * SingleOrd(FPointSize) + |
| 600 |
19 * SingleOrd(FLineWidth) + |
| 601 |
23 * Ord(FBumpMapping) + |
| 602 |
29 * SingleOrd(FBumpMappingParallaxHeight) + |
| 603 |
41 * Ord(FMode) + |
| 604 |
43 * Ord(FShadowSampling) + |
| 605 |
47 * Ord(FDepthTest) + |
| 606 |
53 * Ord(FPhongShading) + |
| 607 |
59 * ColorOrd(FSolidColor) + |
| 608 |
73 * Ord(FMaxLightsPerShape) + |
| 609 |
79 * Ord(FBlending) + |
| 610 |
83 * Ord(FBlendingSourceFactor) + |
| 611 |
89 * Ord(FBlendingDestinationFactor) + |
| 612 |
97 * ColorOrd(FWireframeColor) + |
| 613 |
101 * Ord(FWireframeEffect) + |
| 614 |
103 * SingleOrd(FSolidWireframeScale) + |
| 615 |
107 * SingleOrd(FSolidWireframeBias) + |
| 616 |
109 * SingleOrd(FSilhouetteScale) + |
| 617 |
113 * SingleOrd(FSilhouetteBias) + |
| 618 |
127 * Ord(FRobustNegativeScale) + |
| 619 |
131 * Ord(FWholeSceneManifold) + |
| 620 |
137 * ColorChannelsOrd(FColorChannels); |
| 621 |
end; |
| 622 |
{$I norqcheckend.inc} |
| 623 |
|
| 624 |
procedure TCastleRenderOptions.CustomSerialization(const SerializationProcess: TSerializationProcess); |
| 625 |
|
| 626 |
function SceneCaption: String; |
| 627 |
begin |
| 628 |
if Owner <> nil then |
| 629 |
Result := 'Scene "' + Owner.Name + '"' |
| 630 |
else |
| 631 |
Result := 'RenderOptions (in unnamed scene)'; |
| 632 |
end; |
| 633 |
|
| 634 |
var |
| 635 |
BlendingSortStr: String; |
| 636 |
B: Boolean; |
| 637 |
begin |
| 638 |
inherited; |
| 639 |
BlendingSortStr := ''; |
| 640 |
SerializationProcess.ReadWriteString('BlendingSort', BlendingSortStr, false); |
| 641 |
if BlendingSortStr <> '' then |
| 642 |
begin |
| 643 |
WritelnWarning('%s uses "BlendingSort" = "%s", this is no longer supported on scene. Instead set TCastleViewport.BlendingSort.', [ |
| 644 |
SceneCaption, |
| 645 |
BlendingSortStr |
| 646 |
]); |
| 647 |
end; |
| 648 |
|
| 649 |
B := false; |
| 650 |
SerializationProcess.ReadWriteBoolean('OcclusionSort', B, false); |
| 651 |
if B then |
| 652 |
begin |
| 653 |
WritelnWarning('%s uses "OcclusionSort", this is no longer supported on scene. Instead set TCastleViewport.OcclusionSort.', [ |
| 654 |
SceneCaption |
| 655 |
]); |
| 656 |
end; |
| 657 |
|
| 658 |
B := false; |
| 659 |
SerializationProcess.ReadWriteBoolean('OcclusionQuery', B, false); |
| 660 |
if B then |
| 661 |
begin |
| 662 |
WritelnWarning('%s uses "OcclusionQuery", this is no longer supported on scene. Instead set TCastleViewport.OcclusionCulling.', [ |
| 663 |
SceneCaption |
| 664 |
]); |
| 665 |
end; |
| 666 |
end; |
| 667 |
|
| 668 |
function TCastleRenderOptions.PropertySections(const PropertyName: String): TPropertySections; |
| 669 |
begin |
| 670 |
if ArrayContainsString(PropertyName, [ |
| 671 |
'Lighting', 'ReceiveSceneLights', 'ReceiveGlobalLights', 'Textures', |
| 672 |
'MinificationFilter', 'MagnificationFilter', 'PointSize', 'LineWidth', |
| 673 |
'BumpMapping', 'BumpMappingParallaxHeight', 'PhongShading', 'ShadowSampling', |
| 674 |
'MaxLightsPerShape', 'Blending', 'BlendingSourceFactor', 'BlendingDestinationFactor', |
| 675 |
'WireframeEffect', 'WireframeColorPersistent', |
| 676 |
'SolidWireframeScale', 'SolidWireframeBias', 'SilhouetteScale', |
| 677 |
'SilhouetteBias', 'RobustNegativeScale', |
| 678 |
'WholeSceneManifold', 'ColorChannels' |
| 679 |
]) then |
| 680 |
Result := [psBasic] |
| 681 |
else |
| 682 |
Result := inherited PropertySections(PropertyName); |
| 683 |
end; |
| 684 |
|
| 685 |
{ trivial setters ------------------------------------------------------------- } |
| 686 |
|
| 687 |
procedure TCastleRenderOptions.SetTextures(const Value: Boolean); |
| 688 |
begin |
| 689 |
if Textures <> Value then |
| 690 |
begin |
| 691 |
ReleaseCachedResources; |
| 692 |
FTextures := Value; |
| 693 |
UpdateHash; |
| 694 |
end; |
| 695 |
end; |
| 696 |
|
| 697 |
procedure TCastleRenderOptions.SetMinificationFilter(const Value: TAutoMinificationFilter); |
| 698 |
begin |
| 699 |
if MinificationFilter <> Value then |
| 700 |
begin |
| 701 |
ReleaseCachedResources; |
| 702 |
FMinificationFilter := Value; |
| 703 |
UpdateHash; |
| 704 |
end; |
| 705 |
end; |
| 706 |
|
| 707 |
procedure TCastleRenderOptions.SetMagnificationFilter(const Value: TAutoMagnificationFilter); |
| 708 |
begin |
| 709 |
if MagnificationFilter <> Value then |
| 710 |
begin |
| 711 |
ReleaseCachedResources; |
| 712 |
FMagnificationFilter := Value; |
| 713 |
UpdateHash; |
| 714 |
end; |
| 715 |
end; |
| 716 |
|
| 717 |
procedure TCastleRenderOptions.SetBumpMapping(const Value: TBumpMapping); |
| 718 |
begin |
| 719 |
if BumpMapping <> Value then |
| 720 |
begin |
| 721 |
ReleaseCachedResources; |
| 722 |
FBumpMapping := Value; |
| 723 |
UpdateHash; |
| 724 |
end; |
| 725 |
end; |
| 726 |
|
| 727 |
procedure TCastleRenderOptions.SetMode(const Value: TRenderingMode); |
| 728 |
begin |
| 729 |
if FMode <> Value then |
| 730 |
begin |
| 731 |
FMode := Value; |
| 732 |
UpdateHash; |
| 733 |
end; |
| 734 |
end; |
| 735 |
|
| 736 |
procedure TCastleRenderOptions.SetShadowSampling(const Value: TShadowSampling); |
| 737 |
begin |
| 738 |
if FShadowSampling <> Value then |
| 739 |
begin |
| 740 |
{ When swithing between VSM and non-VSM sampling methods, |
| 741 |
we need to ReleaseCachedResources, since shadow maps must be regenerated. } |
| 742 |
if (FShadowSampling = ssVarianceShadowMaps) <> |
| 743 |
(Value = ssVarianceShadowMaps) then |
| 744 |
ReleaseCachedResources; |
| 745 |
|
| 746 |
FShadowSampling := Value; |
| 747 |
UpdateHash; |
| 748 |
end; |
| 749 |
end; |
| 750 |
|
| 751 |
procedure TCastleRenderOptions.SetBlending(const Value: Boolean); |
| 752 |
begin |
| 753 |
if FBlending <> Value then |
| 754 |
begin |
| 755 |
FBlending := Value; |
| 756 |
UpdateHash; |
| 757 |
end; |
| 758 |
end; |
| 759 |
|
| 760 |
procedure TCastleRenderOptions.SetBlendingSourceFactor( |
| 761 |
const Value: TBlendingSourceFactor); |
| 762 |
begin |
| 763 |
if FBlendingSourceFactor <> Value then |
| 764 |
begin |
| 765 |
FBlendingSourceFactor := Value; |
| 766 |
UpdateHash; |
| 767 |
end; |
| 768 |
end; |
| 769 |
|
| 770 |
procedure TCastleRenderOptions.SetBlendingDestinationFactor( |
| 771 |
const Value: TBlendingDestinationFactor); |
| 772 |
begin |
| 773 |
if FBlendingDestinationFactor <> Value then |
| 774 |
begin |
| 775 |
FBlendingDestinationFactor := Value; |
| 776 |
UpdateHash; |
| 777 |
end; |
| 778 |
end; |
| 779 |
|
| 780 |
procedure TCastleRenderOptions.SetPhongShading(const Value: Boolean); |
| 781 |
begin |
| 782 |
if PhongShading <> Value then |
| 783 |
begin |
| 784 |
FPhongShading := Value; |
| 785 |
{ When switching this we want to force generating necessary |
| 786 |
shaders at the next PrepareResources call. Otherwise shaders would |
| 787 |
be prepared only when shapes come into view, which means that navigating |
| 788 |
awfully stutters for some time after changing this property. |
| 789 |
|
| 790 |
We could do this by OwnerScene.PreparedRender := false. |
| 791 |
Or just ReleaseCachedResources. } |
| 792 |
ReleaseCachedResources; |
| 793 |
UpdateHash; |
| 794 |
end; |
| 795 |
end; |
| 796 |
|
| 797 |
procedure TCastleRenderOptions.SetWireframeColor(const Value: TCastleColorRGB); |
| 798 |
begin |
| 799 |
if not TCastleColorRGB.PerfectlyEquals(FWireframeColor, Value) then |
| 800 |
begin |
| 801 |
FWireframeColor := Value; |
| 802 |
UpdateHash; |
| 803 |
end; |
| 804 |
end; |
| 805 |
|
| 806 |
procedure TCastleRenderOptions.SetWireframeEffect(const Value: TWireframeEffect); |
| 807 |
begin |
| 808 |
if FWireframeEffect <> Value then |
| 809 |
begin |
| 810 |
FWireframeEffect := Value; |
| 811 |
UpdateHash; |
| 812 |
end; |
| 813 |
end; |
| 814 |
|
| 815 |
procedure TCastleRenderOptions.SetSolidWireframeScale(const Value: Single); |
| 816 |
begin |
| 817 |
if FSolidWireframeScale <> Value then |
| 818 |
begin |
| 819 |
FSolidWireframeScale := Value; |
| 820 |
UpdateHash; |
| 821 |
end; |
| 822 |
end; |
| 823 |
|
| 824 |
procedure TCastleRenderOptions.SetSolidWireframeBias(const Value: Single); |
| 825 |
begin |
| 826 |
if FSolidWireframeBias <> Value then |
| 827 |
begin |
| 828 |
FSolidWireframeBias := Value; |
| 829 |
UpdateHash; |
| 830 |
end; |
| 831 |
end; |
| 832 |
|
| 833 |
procedure TCastleRenderOptions.SetSilhouetteScale(const Value: Single); |
| 834 |
begin |
| 835 |
if FSilhouetteScale <> Value then |
| 836 |
begin |
| 837 |
FSilhouetteScale := Value; |
| 838 |
UpdateHash; |
| 839 |
end; |
| 840 |
end; |
| 841 |
|
| 842 |
procedure TCastleRenderOptions.SetSilhouetteBias(const Value: Single); |
| 843 |
begin |
| 844 |
if FSilhouetteBias <> Value then |
| 845 |
begin |
| 846 |
FSilhouetteBias := Value; |
| 847 |
UpdateHash; |
| 848 |
end; |
| 849 |
end; |
| 850 |
|
| 851 |
procedure TCastleRenderOptions.SetRobustNegativeScale(const Value: Boolean); |
| 852 |
begin |
| 853 |
if FRobustNegativeScale <> Value then |
| 854 |
begin |
| 855 |
FRobustNegativeScale := Value; |
| 856 |
UpdateHash; |
| 857 |
end; |
| 858 |
end; |
| 859 |
|
| 860 |
procedure TCastleRenderOptions.SetWholeSceneManifold(const Value: Boolean); |
| 861 |
begin |
| 862 |
if FWholeSceneManifold <> Value then |
| 863 |
begin |
| 864 |
FWholeSceneManifold := Value; |
| 865 |
UpdateHash; |
| 866 |
end; |
| 867 |
end; |
| 868 |
|
| 869 |
procedure TCastleRenderOptions.SetColorChannels(const Value: TColorChannels); |
| 870 |
begin |
| 871 |
if FColorChannels <> Value then |
| 872 |
begin |
| 873 |
FColorChannels := Value; |
| 874 |
UpdateHash; |
| 875 |
end; |
| 876 |
end; |
| 877 |
|
| 878 |
procedure TCastleRenderOptions.SetMaxLightsPerShape(const Value: Cardinal); |
| 879 |
begin |
| 880 |
if FMaxLightsPerShape <> Value then |
| 881 |
begin |
| 882 |
FMaxLightsPerShape := Value; |
| 883 |
UpdateHash; |
| 884 |
end; |
| 885 |
end; |
| 886 |
|
| 887 |
procedure TCastleRenderOptions.SetDepthTest(const Value: Boolean); |
| 888 |
begin |
| 889 |
if FDepthTest <> Value then |
| 890 |
begin |
| 891 |
FDepthTest := Value; |
| 892 |
UpdateHash; |
| 893 |
end; |
| 894 |
end; |
| 895 |
|
| 896 |
procedure TCastleRenderOptions.SetReceiveSceneLights(const Value: Boolean); |
| 897 |
begin |
| 898 |
if FReceiveSceneLights <> Value then |
| 899 |
begin |
| 900 |
FReceiveSceneLights := Value; |
| 901 |
UpdateHash; |
| 902 |
end; |
| 903 |
end; |
| 904 |
|
| 905 |
procedure TCastleRenderOptions.SetReceiveGlobalLights(const Value: Boolean); |
| 906 |
begin |
| 907 |
if FReceiveGlobalLights <> Value then |
| 908 |
begin |
| 909 |
FReceiveGlobalLights := Value; |
| 910 |
UpdateHash; |
| 911 |
end; |
| 912 |
end; |
| 913 |
|
| 914 |
procedure TCastleRenderOptions.SetSolidColor(const Value: TCastleColorRGB); |
| 915 |
begin |
| 916 |
if not TCastleColorRGB.PerfectlyEquals(FSolidColor, Value) then |
| 917 |
begin |
| 918 |
FSolidColor := Value; |
| 919 |
UpdateHash; |
| 920 |
end; |
| 921 |
end; |
| 922 |
|
| 923 |
procedure TCastleRenderOptions.SetPointSize(const Value: Single); |
| 924 |
begin |
| 925 |
if FPointSize <> Value then |
| 926 |
begin |
| 927 |
FPointSize := Value; |
| 928 |
UpdateHash; |
| 929 |
end; |
| 930 |
end; |
| 931 |
|
| 932 |
procedure TCastleRenderOptions.SetLineWidth(const Value: Single); |
| 933 |
begin |
| 934 |
if FLineWidth <> Value then |
| 935 |
begin |
| 936 |
FLineWidth := Value; |
| 937 |
UpdateHash; |
| 938 |
end; |
| 939 |
end; |
| 940 |
|
| 941 |
procedure TCastleRenderOptions.SetBumpMappingParallaxHeight(const Value: Single); |
| 942 |
begin |
| 943 |
if FBumpMappingParallaxHeight <> Value then |
| 944 |
begin |
| 945 |
FBumpMappingParallaxHeight := Value; |
| 946 |
UpdateHash; |
| 947 |
end; |
| 948 |
end; |
| 949 |
|
| 950 |
procedure TCastleRenderOptions.SetLighting(const Value: Boolean); |
| 951 |
begin |
| 952 |
if FLighting <> Value then |
| 953 |
begin |
| 954 |
FLighting := Value; |
| 955 |
UpdateHash; |
| 956 |
end; |
| 957 |
end; |
| 958 |
|
| 959 |
function TCastleRenderOptions.IsStoredBumpMappingParallaxHeight: Boolean; |
| 960 |
begin |
| 961 |
Result := FBumpMappingParallaxHeight <> Single(DefaultBumpMappingParallaxHeight); |
| 962 |
end; |
| 963 |
|
| 964 |
function TCastleRenderOptions.IsStoredLineWidth: Boolean; |
| 965 |
begin |
| 966 |
Result := FLineWidth <> DefaultLineWidth; |
| 967 |
end; |
| 968 |
|
| 969 |
function TCastleRenderOptions.IsStoredPointSize: Boolean; |
| 970 |
begin |
| 971 |
Result := FPointSize <> DefaultPointSize; |
| 972 |
end; |
| 973 |
|
| 974 |
function TCastleRenderOptions.IsStoredSilhouetteBias: Boolean; |
| 975 |
begin |
| 976 |
Result := FSilhouetteBias <> DefaultSilhouetteBias; |
| 977 |
end; |
| 978 |
|
| 979 |
function TCastleRenderOptions.IsStoredSilhouetteScale: Boolean; |
| 980 |
begin |
| 981 |
Result := FSilhouetteScale <> DefaultSilhouetteScale; |
| 982 |
end; |
| 983 |
|
| 984 |
function TCastleRenderOptions.IsStoredSolidWireframeBias: Boolean; |
| 985 |
begin |
| 986 |
Result := FSolidWireframeBias <> DefaultSolidWireframeBias; |
| 987 |
end; |
| 988 |
|
| 989 |
function TCastleRenderOptions.IsStoredSolidWireframeScale: Boolean; |
| 990 |
begin |
| 991 |
Result := FSolidWireframeScale <> DefaultSolidWireframeScale; |
| 992 |
end; |
| 993 |
|
| 994 |
{$define read_implementation_methods} |
| 995 |
{$I auto_generated_persistent_vectors/tcastlerenderoptions_persistent_vectors.inc} |
| 996 |
{$undef read_implementation_methods} |
| 997 |
|
| 998 |
{$endif read_implementation} |