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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Castle Game Engine: CastleScene: Class TCastleScene</title>
<meta name="generator" content="PasDoc 0.13.0">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
</head>
<body>
<table class="container"><tr><td class="navigation">
<h2>Castle Game Engine</h2><p><a href="introduction.html" class="navigation">Introduction</a></p><p><a href="AllUnits.html" class="navigation">Units</a></p><p><a href="ClassHierarchy.html" class="navigation">Class Hierarchy</a></p><p><a href="AllClasses.html" class="navigation">Classes, Interfaces, Objects and Records</a></p><p><a href="AllTypes.html" class="navigation">Types</a></p><p><a href="AllVariables.html" class="navigation">Variables</a></p><p><a href="AllConstants.html" class="navigation">Constants</a></p><p><a href="AllFunctions.html" class="navigation">Functions and Procedures</a></p><p><a href="AllIdentifiers.html" class="navigation">Identifiers</a></p></td><td class="content">
<a name="TCastleScene"></a><h1 class="cio">Class TCastleScene</h1>
<table class="sections wide_list">
<tr>
<td><a class="section" href="#PasDoc-Description">Description</a></td><td><a class="section" href="#PasDoc-Hierarchy">Hierarchy</a></td><td>Fields</td><td><a class="section" href="#PasDoc-Methods">Methods</a></td><td><a class="section" href="#PasDoc-Properties">Properties</a></td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a href="CastleScene.html">CastleScene</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TCastleScene = class(<a class="normal" href="CastleSceneCore.TCastleSceneCore.html">TCastleSceneCore</a>)</code></p>
<h2 class="description">Description</h2>
<p>
Complete handling and rendering of a 3D VRML/X3D scene. This is a descendant of <a class="normal" href="CastleSceneCore.TCastleSceneCore.html">TCastleSceneCore</a> that adds efficient rendering using OpenGL.
<p>This uses internal <a class="normal" href="CastleRenderer.TGLRenderer.html">TGLRenderer</a> instance, adding some features and comfortable methods on top of it (like blending). See <a class="normal" href="CastleScene.TCastleScene.html#Render">Render</a> method for some details.
<p>This class also provides comfortable management for <a class="normal" href="CastleScene.TCastleScene.html#Background">Background</a> instance to render the VRML/X3D background of this scene.
<p>Calling methods <a class="normal" href="CastleScene.TCastleScene.html#PrepareResources">PrepareResources</a>, Render or Background connects this class with current OpenGL context. Which means that all the following calls should be done with the same OpenGL context set as current. Calling <a class="normal" href="CastleScene.TCastleScene.html#GLContextClose">GLContextClose</a> or the destructor removes this connection.</p>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TComponent</li>
<li class="ancestor"><a class="normal" href="Castle3D.T3D.html">T3D</a></li>
<li class="ancestor"><a class="normal" href="X3DNodes.TX3DEventsEngine.html">TX3DEventsEngine</a></li>
<li class="ancestor"><a class="normal" href="CastleSceneCore.TCastleSceneCore.html">TCastleSceneCore</a></li>
<li class="thisitem">TCastleScene</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Methods"></a><h3 class="summary">Methods</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>function <b><a href="CastleScene.TCastleScene.html#CreateShape">CreateShape</a></b>(AGeometry: <a href="X3DNodes.TAbstractGeometryNode.html">TAbstractGeometryNode</a>; AState: <a href="X3DNodes.TX3DGraphTraverseState.html">TX3DGraphTraverseState</a>; ParentInfo: <a href="X3DNodes.html#PTraversingInfo">PTraversingInfo</a>): <a href="CastleShapes.TShape.html">TShape</a>; override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#InvalidateBackground">InvalidateBackground</a></b>; override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a href="CastleScene.TCastleScene.html#Create">Create</a></b>(AOwner: TComponent); override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a href="CastleScene.TCastleScene.html#CreateCustomCache">CreateCustomCache</a></b>(AOwner: TComponent; ACache: <a href="CastleRenderer.TGLRendererContextCache.html">TGLRendererContextCache</a>);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>constructor <b><a href="CastleScene.TCastleScene.html#CreateCustomRenderer">CreateCustomRenderer</a></b>(AOwner: TComponent; ACustomRenderer: <a href="CastleRenderer.TGLRenderer.html">TGLRenderer</a>);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>destructor <b><a href="CastleScene.TCastleScene.html#Destroy">Destroy</a></b>; override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#GLContextClose">GLContextClose</a></b>; override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#PrepareResources">PrepareResources</a></b>(Options: <a href="CastleScene.html#TPrepareResourcesOptions">TPrepareResourcesOptions</a>; ProgressStep: boolean; BaseLights: <a href="Castle3D.html#TAbstractLightInstancesList">TAbstractLightInstancesList</a>); override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#Render">Render</a></b>(TestShapeVisibility: <a href="CastleShapes.html#TTestShapeVisibility">TTestShapeVisibility</a>; const Frustum: <a href="CastleFrustum.TFrustum.html">TFrustum</a>; const Params: <a href="Castle3D.TRenderParams.html">TRenderParams</a>);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#Render">Render</a></b>(const Frustum: <a href="CastleFrustum.TFrustum.html">TFrustum</a>; const Params: <a href="Castle3D.TRenderParams.html">TRenderParams</a>); override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#BeforeNodesFree">BeforeNodesFree</a></b>(const InternalChangedAll: boolean = false); override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#RenderShadowVolume">RenderShadowVolume</a></b>( ShadowVolumeRenderer: <a href="Castle3D.TBaseShadowVolumeRenderer.html">TBaseShadowVolumeRenderer</a>; const ParentTransformIsIdentity: boolean; const ParentTransform: <a href="CastleVectors.html#TMatrix4Single">TMatrix4Single</a>); override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#RenderSilhouetteEdges">RenderSilhouetteEdges</a></b>( const ObserverPos: <a href="CastleVectors.html#TVector4Single">TVector4Single</a>; const Transform: <a href="CastleVectors.html#TMatrix4Single">TMatrix4Single</a>);</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#RenderBorderEdges">RenderBorderEdges</a></b>( const Transform: <a href="CastleVectors.html#TMatrix4Single">TMatrix4Single</a>);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#FreeResources">FreeResources</a></b>(Resources: <a href="CastleSceneCore.html#TSceneFreeResources">TSceneFreeResources</a>); override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleScene.TCastleScene.html#Background">Background</a></b>: <a href="CastleBackground.TBackground.html">TBackground</a>;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleScene.TCastleScene.html#Attributes">Attributes</a></b>: <a href="CastleScene.TSceneRenderingAttributes.html">TSceneRenderingAttributes</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#UpdateGeneratedTextures">UpdateGeneratedTextures</a></b>( const RenderFunc: <a href="Castle3D.html#TRenderFromViewFunction">TRenderFromViewFunction</a>; const ProjectionNear, ProjectionFar: Single; const OriginalViewport: <a href="CastleRectangles.TRectangle.html">TRectangle</a>); override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#ViewChangedSuddenly">ViewChangedSuddenly</a></b>; override;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>procedure <b><a href="CastleScene.TCastleScene.html#VisibleChangeNotification">VisibleChangeNotification</a></b>(const Changes: <a href="Castle3D.html#TVisibleChanges">TVisibleChanges</a>); override;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleScene.TCastleScene.html#ScreenEffects">ScreenEffects</a></b>(Index: Integer): <a href="CastleGLShaders.TGLSLProgram.html">TGLSLProgram</a>;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleScene.TCastleScene.html#ScreenEffectsCount">ScreenEffectsCount</a></b>: Integer;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>function <b><a href="CastleScene.TCastleScene.html#ScreenEffectsNeedDepth">ScreenEffectsNeedDepth</a></b>: boolean;</code></td>
</tr>
</table>
<a name="PasDoc-Properties"></a><h3 class="summary">Properties</h3>
<table class="summary wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><code>property <b><a href="CastleScene.TCastleScene.html#BackgroundSkySphereRadius">BackgroundSkySphereRadius</a></b>: Single
read FBackgroundSkySphereRadius write SetBackgroundSkySphereRadius
default 1;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleScene.TCastleScene.html#FrustumCulling">FrustumCulling</a></b>: <a href="CastleScene.html#TFrustumCulling">TFrustumCulling</a>
read FFrustumCulling write SetFrustumCulling default fcBox;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleScene.TCastleScene.html#OctreeFrustumCulling">OctreeFrustumCulling</a></b>: <a href="CastleScene.html#TFrustumCulling">TFrustumCulling</a>
read FOctreeFrustumCulling write SetOctreeFrustumCulling default fcBox;</code></td>
</tr>
<tr class="list2">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleScene.TCastleScene.html#ReceiveShadowVolumes">ReceiveShadowVolumes</a></b>: boolean
read FReceiveShadowVolumes write FReceiveShadowVolumes default true;</code></td>
</tr>
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><code>property <b><a href="CastleScene.TCastleScene.html#DistanceCulling">DistanceCulling</a></b>: Single
read FDistanceCulling write FDistanceCulling default 0;</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Methods</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="CreateShape"></a><code>function <b>CreateShape</b>(AGeometry: <a href="X3DNodes.TAbstractGeometryNode.html">TAbstractGeometryNode</a>; AState: <a href="X3DNodes.TX3DGraphTraverseState.html">TX3DGraphTraverseState</a>; ParentInfo: <a href="X3DNodes.html#PTraversingInfo">PTraversingInfo</a>): <a href="CastleShapes.TShape.html">TShape</a>; override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><a name="InvalidateBackground"></a><code>procedure <b>InvalidateBackground</b>; override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Create"></a><code>constructor <b>Create</b>(AOwner: TComponent); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="CreateCustomCache"></a><code>constructor <b>CreateCustomCache</b>(AOwner: TComponent; ACache: <a href="CastleRenderer.TGLRendererContextCache.html">TGLRendererContextCache</a>);</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="CreateCustomRenderer"></a><code>constructor <b>CreateCustomRenderer</b>(AOwner: TComponent; ACustomRenderer: <a href="CastleRenderer.TGLRenderer.html">TGLRenderer</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
A very special constructor, that forces this class to use provided ACustomRenderer. ACustomRenderer must be <> <code>Nil</code>.
<p>Note that this renderer must be created with AttributesClass = <a class="normal" href="CastleScene.TSceneRenderingAttributes.html">TSceneRenderingAttributes</a>.
<p><i>Don't use this unless you really know what you're doing!</i> In all normal circumstances you should use normal <a class="normal" href="CastleScene.TCastleScene.html#Create">Create</a> constructor, that will internally create and use internal renderer object. If you use this constructor you will have to understand how internally this class synchronizes itself with underlying Renderer object.
<p>Once again, if you're not sure, then simply don't use this constructor. It's for internal use — namely it's internally used by <a class="normal" href="CastlePrecalculatedAnimation.TCastlePrecalculatedAnimation.html">TCastlePrecalculatedAnimation</a>, this way all scenes of the animation share the same renderer which means that they also share the same information about textures and images loaded into OpenGL. And this is crucial for <a class="normal" href="CastlePrecalculatedAnimation.TCastlePrecalculatedAnimation.html">TCastlePrecalculatedAnimation</a>, otherwise animation with 100 scenes would load the same texture to OpenGL 100 times.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Destroy"></a><code>destructor <b>Destroy</b>; override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="GLContextClose"></a><code>procedure <b>GLContextClose</b>; override;</code></td>
</tr>
<tr><td colspan="2">
<p>
Destroy any associations of this object with current OpenGL context. For example, release any allocated texture names.
<p>Generally speaking, destroys everything that is allocated by <a class="normal" href="CastleScene.TCastleScene.html#PrepareResources">PrepareResources</a> call. It's harmless to call this method when there are already no associations with current OpenGL context. This is called automatically from the destructor.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="PrepareResources"></a><code>procedure <b>PrepareResources</b>(Options: <a href="CastleScene.html#TPrepareResourcesOptions">TPrepareResourcesOptions</a>; ProgressStep: boolean; BaseLights: <a href="Castle3D.html#TAbstractLightInstancesList">TAbstractLightInstancesList</a>); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Render"></a><code>procedure <b>Render</b>(TestShapeVisibility: <a href="CastleShapes.html#TTestShapeVisibility">TTestShapeVisibility</a>; const Frustum: <a href="CastleFrustum.TFrustum.html">TFrustum</a>; const Params: <a href="Castle3D.TRenderParams.html">TRenderParams</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Render for OpenGL. The rendering parameters are configurable by <a class="normal" href="CastleScene.TCastleScene.html#Attributes">Attributes</a>, see <a class="normal" href="CastleScene.TSceneRenderingAttributes.html">TSceneRenderingAttributes</a> and <a class="normal" href="CastleRenderer.TRenderingAttributes.html">TRenderingAttributes</a>.
<p>For more details about rendering, see <a class="normal" href="CastleRenderer.html">CastleRenderer</a> unit comments. This method internally uses <a class="normal" href="CastleRenderer.TGLRenderer.html">TGLRenderer</a> instance, additionally handling the blending:
<p></p>
<ul class="paragraph_spacing">
<li><p> OpenGL state of glDepthMask, glEnable/Disable(GL_BLEND), glBlendFunc is controlled by this function. This function will unconditionally change (and restore later to original value) this state, to perform correct blending (transparency rendering).
<p>To make a correct rendering, we always render transparent shapes at the end (after all opaque), and with depth-buffer in read-only mode.</p></li>
<li><p>Only a subset of shapes indicated by Params.Transparent is rendered. This is necessary if you want to mix in one 3D world many scenes (like <a class="normal" href="CastleScene.TCastleScene.html">TCastleScene</a> instances), and each of them may have some opaque and some transparent parts. In such case, you want to render everything opaque (from every scene) first, and only then render everything transparent. For shadow volumes, this is even more complicated.</p></li>
<li><p>Note that when Attributes.Blending is <code>False</code> then everything is always opaque, so tgOpaque renders everything and tgTransparent renders nothing.</p></li>
</ul>
<p>
<p></p>
<h6 class="description_section">Parameters</h6>
<dl class="parameters">
<dt>TestShapeVisibility</dt>
<dd>Filters which shapes are visible.
<p>You can use this to optimize rendering. For example you can reject shapes because their bounding volume (bounding boxes or bounding spheres) doesn't intersect with frustum or such. This is called frustum culling, and in fact is done automatically by other overloaded Render methods in this class, see <a class="normal" href="CastleScene.TCastleScene.html#FrustumCulling">FrustumCulling</a> and <a class="normal" href="CastleScene.TCastleScene.html#OctreeFrustumCulling">OctreeFrustumCulling</a>.
<p>TestShapeVisibility callback may be used to implement frustum culling, or some other visibility algorithm.</dd>
</dl>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Render"></a><code>procedure <b>Render</b>(const Frustum: <a href="CastleFrustum.TFrustum.html">TFrustum</a>; const Params: <a href="Castle3D.TRenderParams.html">TRenderParams</a>); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="BeforeNodesFree"></a><code>procedure <b>BeforeNodesFree</b>(const InternalChangedAll: boolean = false); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="RenderShadowVolume"></a><code>procedure <b>RenderShadowVolume</b>( ShadowVolumeRenderer: <a href="Castle3D.TBaseShadowVolumeRenderer.html">TBaseShadowVolumeRenderer</a>; const ParentTransformIsIdentity: boolean; const ParentTransform: <a href="CastleVectors.html#TMatrix4Single">TMatrix4Single</a>); override;</code></td>
</tr>
<tr><td colspan="2">
<p>
Render shadow volume (sides and caps) of this scene, for shadow volume algorithm. Checks ShadowVolumeRenderer.InitScene to know if the shadow needs to be rendered at all. It will calculate current bounding box (looking at ParentTransform, ParentTransformIsIdentity and <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#BoundingBox">BoundingBox</a> method).
<p>It always uses silhouette optimization. This is the usual, fast method of rendering shadow volumes. Will not do anything (treat scene like not casting shadows, like <a class="normal" href="Castle3D.T3D.html#CastShadowVolumes">CastShadowVolumes</a> = false) if the model is not perfect 2-manifold, i.e. has some <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#BorderEdges">BorderEdges</a> (although we could handle some <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#BorderEdges">BorderEdges</a> for some points of view, this could leading to rendering artifacts).
<p>All shadow quads are generated from scene triangles transformed by ParentTransform. We must be able to correctly detect front and back facing triangles with respect to light position, so ShadowVolumeRenderer.LightPosition and "this scene transformed by ParentTransform" must be in the same coordinate system. If ParentTransformIsIdentity then ParentTransform value is ignored and everything works like ParentTransform = identity matrix (and is a little faster in this special case).
<p>Uses <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#TrianglesListShadowCasters">TrianglesListShadowCasters</a> and <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#ManifoldEdges">ManifoldEdges</a> and <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#BorderEdges">BorderEdges</a> (so you may prefer to prepare it before, e.g. by calling <a class="normal" href="CastleScene.TCastleScene.html#PrepareResources">PrepareResources</a> with <a class="normal" href="CastleScene.html#prShadowVolume">prShadowVolume</a> included).
<p>We look at some Attributes, like Attributes.Blending, because transparent triangles have to be handled a little differently, and when Attributes.Blending = false then all triangles are forced to be opaque. In other words, this takes Attributes into account, to cooperate with our Render method.
<p>ShadowVolumeRenderer.LightPosition is the light position. ShadowVolumeRenderer.LightPosition[3] must be 1 (to indicate positional light) or 0 (a directional light). It's expected that ShadowVolumeRenderer is already initialized by ShadowVolumeRenderer.InitFrustumAndLight.
<p>Faces (both shadow quads and caps) are rendered such that CCW <=> you're looking at it from outside (i.e. it's considered front face of this shadow volume).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="RenderSilhouetteEdges"></a><code>procedure <b>RenderSilhouetteEdges</b>( const ObserverPos: <a href="CastleVectors.html#TVector4Single">TVector4Single</a>; const Transform: <a href="CastleVectors.html#TMatrix4Single">TMatrix4Single</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Render silhouette edges. Silhouette is determined from the ObserverPos. Useful to debug (visualize) <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#ManifoldEdges">ManifoldEdges</a> of the scene.
<p>Whole scene is transformed by Transform (before checking which edges are silhouette and before rendering). In other words, Transform must transform the scene to the same coord space where given ObserverPos is. When they are in the same space, just use <a class="normal" href="CastleVectors.html#IdentityMatrix4Single">IdentityMatrix4Single</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="RenderBorderEdges"></a><code>procedure <b>RenderBorderEdges</b>( const Transform: <a href="CastleVectors.html#TMatrix4Single">TMatrix4Single</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Render all border edges (the edges without neighbor). Useful to debug (visualize) <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#BorderEdges">BorderEdges</a> of the scene.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="FreeResources"></a><code>procedure <b>FreeResources</b>(Resources: <a href="CastleSceneCore.html#TSceneFreeResources">TSceneFreeResources</a>); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Background"></a><code>function <b>Background</b>: <a href="CastleBackground.TBackground.html">TBackground</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
<a class="normal" href="CastleBackground.TBackground.html">TBackground</a> instance to render current background. Current background is the top node on the <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#BackgroundStack">BackgroundStack</a> of this scene, following VRML/X3D specifications, and can be dynamic. The scene manager should use this to render background.
<p>We use the current value of <a class="normal" href="CastleScene.TCastleScene.html#BackgroundSkySphereRadius">BackgroundSkySphereRadius</a>.
<p>Returns <code>Nil</code> if there is no currently bound background node in this scene, or if the bound background is not supported for now (the latter case right now happens with TextureBakckground).
<p>This instance is managed (automatically created/freed and so on) by this <a class="normal" href="CastleScene.TCastleScene.html">TCastleScene</a> instance. It is cached (so that it's recreated only when relevant things change, like VRML/X3D nodes affecting this background, or changes to <a class="normal" href="CastleScene.TCastleScene.html#BackgroundSkySphereRadius">BackgroundSkySphereRadius</a>, or OpenGL context is closed).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="Attributes"></a><code>function <b>Attributes</b>: <a href="CastleScene.TSceneRenderingAttributes.html">TSceneRenderingAttributes</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Rendering attributes.
<p>You are free to change them all at any time. Although note that changing some attributes (the ones defined in base <a class="normal" href="CastleRenderer.TRenderingAttributes.html">TRenderingAttributes</a> class) may be a costly operation (next <a class="normal" href="CastleScene.TCastleScene.html#PrepareResources">PrepareResources</a> with <a class="normal" href="CastleScene.html#prRender">prRender</a>, or Render call, may need to recalculate some things).</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="UpdateGeneratedTextures"></a><code>procedure <b>UpdateGeneratedTextures</b>( const RenderFunc: <a href="Castle3D.html#TRenderFromViewFunction">TRenderFromViewFunction</a>; const ProjectionNear, ProjectionFar: Single; const OriginalViewport: <a href="CastleRectangles.TRectangle.html">TRectangle</a>); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ViewChangedSuddenly"></a><code>procedure <b>ViewChangedSuddenly</b>; override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="VisibleChangeNotification"></a><code>procedure <b>VisibleChangeNotification</b>(const Changes: <a href="Castle3D.html#TVisibleChanges">TVisibleChanges</a>); override;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ScreenEffects"></a><code>function <b>ScreenEffects</b>(Index: Integer): <a href="CastleGLShaders.TGLSLProgram.html">TGLSLProgram</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Screen effects information, used by <a class="normal" href="CastleSceneManager.TCastleAbstractViewport.html#ScreenEffects">TCastleAbstractViewport.ScreenEffects</a>. <a class="normal" href="CastleScene.TCastleScene.html#ScreenEffectsCount">ScreenEffectsCount</a> may actually prepare screen effects. </p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ScreenEffectsCount"></a><code>function <b>ScreenEffectsCount</b>: Integer;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="ScreenEffectsNeedDepth"></a><code>function <b>ScreenEffectsNeedDepth</b>: boolean;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<h3 class="detail">Properties</h3>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="public.gif" alt="Public" title="Public"></a></td>
<td class="itemcode"><a name="BackgroundSkySphereRadius"></a><code>property <b>BackgroundSkySphereRadius</b>: Single
read FBackgroundSkySphereRadius write SetBackgroundSkySphereRadius
default 1;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="FrustumCulling"></a><code>property <b>FrustumCulling</b>: <a href="CastleScene.html#TFrustumCulling">TFrustumCulling</a>
read FFrustumCulling write SetFrustumCulling default fcBox;</code></td>
</tr>
<tr><td colspan="2">
<p>
Fine-tune performance of <a class="normal" href="CastleScene.TCastleScene.html#Render">Render</a> when <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#OctreeRendering">OctreeRendering</a> is <i>not</i> available.
<p><a class="normal" href="CastleScene.TCastleScene.html#Render">Render</a> tests each Shape for collision with given Frustum before rendering this Shape. It can use Shape.BoundingBox or Shape.BoundingSphere or both. See <a class="normal" href="CastleScene.html#TFrustumCulling">TFrustumCulling</a>.
<p>Shape.BoundingBox is (in a current implementation) always a better approximation of shape geometry than Shape.BoundingSphere. So advantage of using Shape.BoundingBox is that more Shapes may be eliminated. Advantage of using Shape.BoundingSphere is that checking for collision Frustum<->Sphere is faster, so you don't waste so much time on testing for collisions between frustum and Shape.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="OctreeFrustumCulling"></a><code>property <b>OctreeFrustumCulling</b>: <a href="CastleScene.html#TFrustumCulling">TFrustumCulling</a>
read FOctreeFrustumCulling write SetOctreeFrustumCulling default fcBox;</code></td>
</tr>
<tr><td colspan="2">
<p>
Fine-tune performance of <a class="normal" href="CastleScene.TCastleScene.html#Render">Render</a> when <a class="normal" href="CastleSceneCore.TCastleSceneCore.html#OctreeRendering">OctreeRendering</a> <i>is available</i>.
<p>See <a class="normal" href="CastleScene.html#TFrustumCulling">TFrustumCulling</a>.</p>
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="ReceiveShadowVolumes"></a><code>property <b>ReceiveShadowVolumes</b>: boolean
read FReceiveShadowVolumes write FReceiveShadowVolumes default true;</code></td>
</tr>
<tr><td colspan="2">
</td></tr>
</table>
<table class="detail wide_list">
<tr class="list">
<td class="visibility"><a href="legend.html"><img src="published.gif" alt="Published" title="Published"></a></td>
<td class="itemcode"><a name="DistanceCulling"></a><code>property <b>DistanceCulling</b>: Single
read FDistanceCulling write FDistanceCulling default 0;</code></td>
</tr>
<tr><td colspan="2">
<p>
Cull things farther than this distance. Ignored if <= 0.</p>
</td></tr>
</table>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://michalis.ii.uni.wroc.pl/piwik-castle-engine/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->
<noscript>
<!-- Piwik Image Tracker -->
<img src="http://michalis.ii.uni.wroc.pl/piwik-castle-engine/piwik.php?idsite=1&rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<hr noshade size="1"><span class="appinfo"><em>Generated by <a href="http://pasdoc.sourceforge.net/">PasDoc 0.13.0</a> on 2015-06-15 04:43:11</em>
</span>
</td></tr></table></body></html>
|