Castle Game Engine: CastleRenderer: Class TRenderingAttributes

# Class TRenderingAttributes
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleRenderer ## Declaration `type TRenderingAttributes = class(TPersistent)` ## Description Various properties that control rendering done with TGLRenderer. They are collected here, in a class separate from TGLRenderer, because various things (like TCastleScene and TCastlePrecalculatedAnimation) wrap TGLRenderer instances and hide it, but still they want to allow user to change these attributes. ## Hierarchy TPersistent TRenderingAttributes ## Overview ### Fields
| `internal const DefaultPointSize = 3.0;`
| `internal const DefaultLineWidth = 2.0;`
| `internal const DefaultShaders = srWhenRequired;`
| `internal const DefaultBumpMapping = bmBasic;`
### Methods
| `procedure SetOnRadianceTransfer(const Value: TRadianceTransferFunction); virtual;`
| `procedure SetOnVertexColor(const Value: TVertexColorFunction); virtual;`
| `procedure SetEnableTextures(const Value: boolean); virtual;`
| `procedure SetMinificationFilter(const Value: TMinificationFilter); virtual;`
| `procedure SetMagnificationFilter(const Value: TMagnificationFilter); virtual;`
| `procedure SetBumpMapping(const Value: TBumpMapping); virtual;`
| `procedure SetMode(const Value: TRenderingMode); virtual;`
| `procedure SetShadowSampling(const Value: TShadowSampling); virtual;`
| `procedure SetVertexBufferObject(const Value: boolean); virtual;`
| `procedure SetVisualizeDepthMap(const Value: boolean); virtual;`
| `procedure SetShaders(const Value: TShadersRendering); virtual;`
| `procedure ReleaseCachedResources; virtual;`
| `constructor Create; virtual;`
| `procedure Assign(Source: TPersistent); override;`
| `function EqualForShapeCache(SecondValue: TRenderingAttributes): boolean; virtual;`
| `function TextureFilter: TTextureFilter;`
### Properties
| `property OnRadianceTransfer: TRadianceTransferFunction read FOnRadianceTransfer write SetOnRadianceTransfer;`
| `property OnVertexColor: TVertexColorFunction read FOnVertexColor write SetOnVertexColor;`
| `property Lighting: boolean read FLighting write FLighting default true;`
| `property UseSceneLights: boolean read FUseSceneLights write FUseSceneLights default true;`
| `property Opacity: Single read FOpacity write FOpacity default 1;`
| `property EnableTextures: boolean read FEnableTextures write SetEnableTextures default true;`
| `property MinificationFilter: TMinificationFilter read FMinificationFilter write SetMinificationFilter default minLinearMipmapLinear;`
| `property MagnificationFilter: TMagnificationFilter read FMagnificationFilter write SetMagnificationFilter default magLinear;`
| `property PointSize: TGLFloat read FPointSize write FPointSize default DefaultPointSize;`
| `property LineWidth: Single read FLineWidth write FLineWidth default DefaultLineWidth;`
| `property BumpMapping: TBumpMapping read FBumpMapping write SetBumpMapping default DefaultBumpMapping;`
| `property Shaders: TShadersRendering read FShaders write FShaders default DefaultShaders;`
| `property CustomShader: TGLSLProgram read FCustomShader write FCustomShader;`
| `property CustomShaderAlphaTest: TGLSLProgram read FCustomShaderAlphaTest write FCustomShaderAlphaTest;`
| `property Mode: TRenderingMode read FMode write SetMode default rmFull;`
| `property VertexBufferObject: boolean read FVertexBufferObject write SetVertexBufferObject default true;`
| `property ShadowSampling: TShadowSampling read FShadowSampling write SetShadowSampling default DefaultShadowSampling;`
| `property VisualizeDepthMap: boolean read FVisualizeDepthMap write SetVisualizeDepthMap default false;`
| `property DepthTest: boolean read FDepthTest write FDepthTest default true;`
## Description ### Fields
| `internal const DefaultPointSize = 3.0;`
| `internal const DefaultLineWidth = 2.0;`
| `internal const DefaultShaders = srWhenRequired;`
| `internal const DefaultBumpMapping = bmBasic;`
### Methods
| `procedure SetOnRadianceTransfer(const Value: TRadianceTransferFunction); virtual;`
These methods just set the value on given property, eventually (some of them) calling ReleaseCachedResources.
| `procedure SetOnVertexColor(const Value: TVertexColorFunction); virtual;`
| `procedure SetEnableTextures(const Value: boolean); virtual;`
| `procedure SetMinificationFilter(const Value: TMinificationFilter); virtual;`
| `procedure SetMagnificationFilter(const Value: TMagnificationFilter); virtual;`
| `procedure SetBumpMapping(const Value: TBumpMapping); virtual;`
| `procedure SetMode(const Value: TRenderingMode); virtual;`
| `procedure SetShadowSampling(const Value: TShadowSampling); virtual;`
| `procedure SetVertexBufferObject(const Value: boolean); virtual;`
| `procedure SetVisualizeDepthMap(const Value: boolean); virtual;`
| `procedure SetShaders(const Value: TShadersRendering); virtual;`
| `procedure ReleaseCachedResources; virtual;`
Called before changing an attribute that requires the release of things cached in a renderer. This includes attributes that affect: How TShapeCache.Arrays contents are generated. For example, Generator uses TexCoordsNeeded, so changing any attribute that affects TexCoordsNeeded calls this method. Likewise OnVertexColor determines if color array will be loaded at all. How (and if) TShapeCache.Vbo are loaded. How textures are loaded (texture filtering options affect them).
| `constructor Create; virtual;`
| `procedure Assign(Source: TPersistent); override;`
| `function EqualForShapeCache(SecondValue: TRenderingAttributes): boolean; virtual;`
Is the second TRenderingAttributes instance on all fields that affect TShapeCache, that is things that affect generated geometry arrays or vbo. This compares the subset of variables that call ReleaseCachedResources — only the ones that affect TShapeCache.
| `function TextureFilter: TTextureFilter;`
### Properties
| `property OnRadianceTransfer: TRadianceTransferFunction read FOnRadianceTransfer write SetOnRadianceTransfer;`
Calculate vertex color from radiance transfer. If this is assigned, and geometry object has radianceTransfer field (see [http://castle-engine.sourceforge.net/x3d_extensions.php#section_ext_radiance_transfer]) then this is used to calculate the color of each vertex. Note that this is evaluated when object is rendered. It causes the shapes resources to be regenerated at each render frame, since we have to assume that results of this function change.
| `property OnVertexColor: TVertexColorFunction read FOnVertexColor write SetOnVertexColor;`
Calculate vertex color for given vertex by a callback. If this is assigned, then this is used to calculate the color of each vertex. Note that this is evaluated when object is rendered. It causes the shapes resources to be regenerated at each render frame, since we have to assume that results of this function change.
| `property Lighting: boolean read FLighting write FLighting default true;`
Enable OpenGL lighting when rendering. This is `True` by default, since it's almost always wanted. When Lighting is `False`, we disable OpenGL lighting. (We had previously a different approach, when we left GL_LIGHTING untouched and caller could enable/disable it. But this doesn't really work for modern OpenGL, the renderer really has to know if lighting is enabled. (to generate proper shaders, and to avoid clumsy glPushAttrib / glPopAttrib at some places).)
| `property UseSceneLights: boolean read FUseSceneLights write FUseSceneLights default true;`
Should we setup VRML/X3D lights as OpenGL lights during rendering. VRML/X3D lights are loaded into OpenGL lights. All OpenGL lights are always used (we always start from the first OpenGL light 0, up to the last available OpenGL light — this is necessary, as shader pipeline must know all the lights anyway). Initial OpenGL lights are reserved for BaseLights (useful for you to define any lights from outside of the scene). Then following OpenGL lights are reserved for the lights defined in your scene (if this property is `True`). The remaining OpenGL lights, if any, are not used (we make sure they are disabled for fixed-function pipeline). This is independent from the Lighting property (which merely says whether we will turn OpenGL lighting on at all).
| `property Opacity: Single read FOpacity write FOpacity default 1;`
Opacity for all rendered shapes. Setting this to something < 1 you can make every shape transparent.
| `property EnableTextures: boolean read FEnableTextures write SetEnableTextures default true;`
Take model textures into account. When `True` (default), then our engine takes care of everything related to texturing for you: enabling and using textures for textured parts of the model, disabling textures for non-textured parts. Otherwise, textures are disabled.
| `property MinificationFilter: TMinificationFilter read FMinificationFilter write SetMinificationFilter default minLinearMipmapLinear;`
Default minification and magnification filters for textures. These can be overridden on a per-texture basis in VRML / X3D files by X3D TextureProperties node (see X3D specification).
| `property MagnificationFilter: TMagnificationFilter read FMagnificationFilter write SetMagnificationFilter default magLinear;`
| `property PointSize: TGLFloat read FPointSize write FPointSize default DefaultPointSize;`
Size of points. This has an effect on VRML/X3D PointSet rendering. Must be > 0.
| `property LineWidth: Single read FLineWidth write FLineWidth default DefaultLineWidth;`
Line width. This has an effect on VRML/X3D LineSet rendering, and on wireframe rendering for TSceneRenderingAttributes.WireframeEffect. Must be > 0.
| `property BumpMapping: TBumpMapping read FBumpMapping write SetBumpMapping default DefaultBumpMapping;`
Use bump mapping. To actually use this, particular shape must also provide normal map (and height map, if you want parallax bump mapping). This also requires some OpenGL capabilities, in particular GLSL. Simple bump mapping (when only normal map is available) means that normals are provided in the texture, and lighting is calculated per-fragment. Parallax bump mapping means that additionally the texture coordinate is perturbed, based on height map and camera direction, to create illusion of 3D shape instead of flat surface. This makes e.g. the bricks on the texture really visible as "standing out", in 3D, from the wall. And self-shadowing means that these bricks even cast appropriate shadows on each other. Steep parallax mapping requires good GPU to work correctly and fast enough.
| `property Shaders: TShadersRendering read FShaders write FShaders default DefaultShaders;`
When GLSL shaders are used. srDisable Never use shaders for anything. This means that "shaders", "effects" VRML/X3D fields are ignored, and various effects are disabled (like shadow maps, bump mapping, screen effects). No GLSL program is active, we always force fixed-function pipeline. srWhenRequired Enable only for shapes that require it. For shapes that don't strictly require shaders (don't have ComposedShader, don't use shadow maps, don't have any shader effects etc.) use fixed-function pipeline. srAlways Enable for all shapes, render everything by GLSL shaders. Everything will look beautiful (per-pixel lighting for all shapes), but rendering may be slower. Note that Mode <> rmFull also disables all shaders. That is, when Mode <> rmFull, the value of this property doesn't matter, it's always treated like srDisable.
| `property CustomShader: TGLSLProgram read FCustomShader write FCustomShader;`
Custom GLSL shader to use for the whole scene. When this is assigned, Shaders value is ignored.
| `property CustomShaderAlphaTest: TGLSLProgram read FCustomShaderAlphaTest write FCustomShaderAlphaTest;`
Alternative custom GLSL shader used when alpha test is necessary. Relevant only if CustomShader <> nil. Do not use this. This is a temporary hack to enable VSM working with alpha test. It's not clean, and should not be used for anything else.
| `property Mode: TRenderingMode read FMode write SetMode default rmFull;`
Rendering mode, can be used to disable many rendering features at once.
| `property VertexBufferObject: boolean read FVertexBufferObject write SetVertexBufferObject default true;`
Use OpenGL vertex buffer object. This is always a good idea. You can set this to `False` for debug purposes, e.g. to check how much speedup you get from VBO.
| `property ShadowSampling: TShadowSampling read FShadowSampling write SetShadowSampling default DefaultShadowSampling;`
Shadow maps sampling. Various approaches result in various quality and speed.
| `property VisualizeDepthMap: boolean read FVisualizeDepthMap write SetVisualizeDepthMap default false;`
Visualize depths stored in the shadow maps, instead of using them to actually make shadow. Even without turning this on, VRML author can always activate it explicitly for specific lights. For this, you have to use `X3DLightNode.defaultShadowMap` field, and place a GeneratedShadowMap node there. If the `GeneratedShadowMap.compareMode` is set to `'NONE'`, we will always visualize depths of this shadow map. Setting this property to `True` has the same effect as setting compareMode to "NONE" on all (explicit and implicitly created) GeneratedShadowMap nodes.
| `property DepthTest: boolean read FDepthTest write FDepthTest default true;`
By default, we use depth testing to determine which objects are in front of the others. This allows to display all 3D content (all TCastleScene instances, and all shapes inside them) in any order. For very special purposes, you can disable depth testing. This means that 3D objects will always be drawn in front of the previous ones, in the order in which they are rendered, ignoring the contents of the depth buffer. Use only if you know what you're doing, if you're sure that the order of rendering will always be good.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:11