Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Unit CastleScene
Description
VRML/X3D complete scene handling and OpenGL rendering (TCastleScene).
Uses
Overview
Classes, Interfaces, Objects and Records
Functions and Procedures
Types
Constants
Variables
Description
Functions and Procedures
Types
TTestShapeVisibility = function (Shape: TGLShape): boolean of object; |
|
TWireframeEffect = (...); |
Values for TSceneRenderingAttributes.WireframeEffect.
Generally, two other attributes may affect the way wireframe is rendered: TSceneRenderingAttributes.WireframeColor and TSceneRenderingAttributes.LineWidth, quite self-explanatory.
Values
-
weNormal: Default setting, model polygons are simply passed to OpenGL. Whether this results in filled or wireframe look, depends on OpenGL glPolygonMode setting, filled by default.
-
weWireframeOnly: The model is rendered in wireframe mode.
LineWidth is used as wireframe line width (regardless of TSceneRenderingAttributes.Mode).
Depending on TSceneRenderingAttributes.Mode value:
If <> rmFull then WireframeColor is used as wireframe line color.
If rmFull, then lines are colored and potentially lighted and textured just like their corresponding triangles would be colored. So you can control lighting using Lighting, UseSceneLights etc. attributes, and you can control texturing by EnableTextures attribute.
-
weSolidWireframe: The model is rendered as normal, with it's wireframe version visible on top. This is most often called "solid wireframe", since the intention is too see wireframe version of the model but still render shapes solid (e.g. filled polygons with depth test).
WireframeColor and LineWidth are used as wireframe line color/width (regardless of current scene Attributes.Mode value).
This usually gives best results when Attributes.Mode = rmPureGeometry. Then current glColor sets the color of the solid model (and, like said before, WireframeColor sets wireframe color).
-
weSilhouette: The model is rendered as normal, with silhouette outlined around it. This works quite like weSolidWireframe, except that weSolidWireframe makes the wireframe mesh slightly in front the model, while weSilhouette makes the wireframe mesh slightly at the back of the model. This way only the silhouette is visible from the wireframe rendering.
WireframeColor and LineWidth are used as silhouette line color/width (regardless of current scene Attributes.Mode value).
This is sometimes sensible to use with Attributes.Mode = rmPureGeometry. Then current glColor sets the color of the solid model (and, like said before, WireframeColor sets wireframe color).
|
TBeforeShapeRenderProc = procedure (Shape: TShape) of object; |
|
TFrustumCulling = (...); |
Possible checks done while frustum culling.
This is used for TCastleScene.FrustumCulling (what checks should be done when shapes octree is not available) and TCastleScene.OctreeFrustumCulling (what checks should be done when shapes octree is available).
In the second case, checks done by TFrustumCulling are applied after octree traverse. That is, octree already eliminated some shapes, and fully included some other shapes while traversing. TFrustumCulling are used in this case only as a "last resort", to check only the shapes in octree leaves that are in "possibly-colliding" state with frustum.
Generally, more checks mean that more shapes may be eliminated but also that we waste more time on checks themselves. What is optimal depends on given 3D model, and how you expect the player to view it (e.g. if player usually sees the whole model, then TFrustumCulling checks may be useless waste of time; OTOH, if player stands inside the model composed from many shapes then TFrustumCulling may help).
Values
-
fcNone: No checks.
Setting this as TCastleScene.FrustumCulling turns off frustum culling entirely, which is usually not a wise thing to do. Setting this as TCastleScene.OctreeFrustumCulling means that frustum culling is only done during octree traversal (we only visit octree nodes possibly colliding with frustum), this is also not optimal.
-
fcSphere: Check shape's bounding sphere for collision with frustum.
-
fcBox: Check shape's bounding box for collision with frustum.
-
fcBoth: Check shape's bounding sphere, and then box, for collision with frustum. This is the most rigoristic check, but usually this is a waste of time: in most cases, when bounding sphere collides, then bounding box collides too.
|
Constants
prRender = Castle3D.prRender; |
|
prBackground = Castle3D.prBackground; |
|
prBoundingBox = Castle3D.prBoundingBox; |
|
prTrianglesListShadowCasters = Castle3D.prTrianglesListShadowCasters; |
|
prManifoldAndBorderEdges = Castle3D.prManifoldAndBorderEdges; |
|
Variables
GLContextCache: TGLRendererContextCache; |
Global OpenGL context cache. This caches common things, like textures, shapes, and much more. Our OpenGL resources are currently shared across all OpenGL contexts, and they all automatically share this cache.
|
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:13
|