Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers
|
Class TRenderingAttributes
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, to allow TCastleScene to hide internal TGLRenderer but still expose TRenderingAttributes instance.
Hierarchy
- TPersistent
- TRenderingAttributes
Overview
Fields
Methods
Properties
Description
Fields
 |
internal const DefaultPointSize = 3.0; |
|
 |
internal const DefaultLineWidth = 2.0; |
|
 |
internal const DefaultBumpMapping = bmSteepParallaxShadowing; |
|
 |
internal const DefaultPhongShading = false; |
|
Methods
 |
procedure SetEnableTextures(const Value: boolean); virtual; |
|
 |
procedure SetBumpMapping(const Value: TBumpMapping); virtual; |
|
 |
procedure SetVertexBufferObject(const Value: boolean); virtual; |
|
 |
procedure SetVisualizeDepthMap(const Value: boolean); virtual; |
|
 |
procedure SetPhongShading(const Value: boolean); 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; |
|
Properties
 |
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 PointSize: TGLFloat
read FPointSize write FPointSize default DefaultPointSize; |
Size of points. This has an effect on VRML/X3D PointSet rendering. 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 GetShaders write SetShaders; deprecated 'use PhongShading'; |
Warning: this symbol is deprecated: use PhongShading
When GLSL shaders are used. This is now a deprecated property, better use PhongShading to determine the shading. The engine auto-detects whether to use shaders based on OpenGL capabilities, particular shape needs (phong shading, bump mapping, shadow maps, compositing shader effects), and GLFeatures.EnableFixedFunction.
|
 |
property CustomShader: TX3DShaderProgramBase read FCustomShader write FCustomShader; |
Custom GLSL shader to use for the whole scene. When this is assigned, Shaders value is ignored.
Avoid using this. It's not easy to create portable shaders, that work both with OpenGL and OpenGLES. Try using "compositing shaders" instead http://castle-engine.sourceforge.net/compositing_shaders.php which still allow you to write GLSL effects, but they are integrated into standard shader code.
|
 |
property CustomShaderAlphaTest: TX3DShaderProgramBase 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 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.15.0.
|