| 1 |
{%MainUnit castleinternalrenderer.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 |
{ Global consts, variables at the end of unit interface. } |
| 18 |
|
| 19 |
{$ifdef read_interface} |
| 20 |
|
| 21 |
const |
| 22 |
AllVboTypes = [Low(TVboType) .. High(TVboType)]; |
| 23 |
|
| 24 |
{ This RenderContext.TDepthRange value results from |
| 25 |
using rlParent on Viewport.Items. |
| 26 |
|
| 27 |
Also this value is reset by TRenderer.RenderEnd. |
| 28 |
It cannot reset to drFull, we need shadow quads to check for depth versus |
| 29 |
scene objects in DefaultDepthRange. |
| 30 |
|
| 31 |
Testcases: If RenderEnd would reset to drFull: |
| 32 |
- demo-models/shadow_volumes/stonehenge_with_chopper.x3dv |
| 33 |
would have weird shadows in view3dcene on chopper |
| 34 |
- demo-models/shadow_volumes/shadows_worm_in_a_room.x3dv |
| 35 |
would have weird shadows in view3dcene on worm |
| 36 |
- examples/viewport_and_scenes/shadows |
| 37 |
would have weird shadows |
| 38 |
- examples/research_special_rendering_methods/test_rendering_opengl_capabilities/ |
| 39 |
would have weird shadows |
| 40 |
- examples/deprecated_to_upgrade/fixed_camera_game/ |
| 41 |
would behave weirdly, have confusing shadows, |
| 42 |
suggesting player isn't at the correct place (like floating above floor). |
| 43 |
|
| 44 |
TODO: Should we set this in TRenderContext constructor, on context, |
| 45 |
so that it's really default value? Right now rendering 1st frame |
| 46 |
with TRenderer effectively changes drFull into drFar for everything. |
| 47 |
|
| 48 |
TODO: Do shadow volumes work for stuff in rlFront, like weapon in FPS games? |
| 49 |
Likely not, since they are in disjoint range. |
| 50 |
} |
| 51 |
DefaultDepthRange = drFar; |
| 52 |
|
| 53 |
var |
| 54 |
{ Log renderer cache events. Allows to see how the cache performs. |
| 55 |
A @italic(lot) of log messages. |
| 56 |
|
| 57 |
Meaningful only if you initialized log (see CastleLog unit) by InitializeLog first. } |
| 58 |
LogRendererCache: boolean = false; |
| 59 |
|
| 60 |
{ Log various renderer information. |
| 61 |
|
| 62 |
Meaningful only if you initialized log (see CastleLog unit) by InitializeLog first. } |
| 63 |
LogRenderer: boolean = false; |
| 64 |
|
| 65 |
{ Global renderer cache. |
| 66 |
This caches common things, like textures, shapes, and much more. |
| 67 |
Our OpenGL resources are shared across all OpenGL contexts, |
| 68 |
and everything automatically uses this cache. } |
| 69 |
RendererCache: TRendererCache; |
| 70 |
|
| 71 |
{$endif read_interface} |
| 72 |
|
| 73 |
{$ifdef read_implementation} |
| 74 |
{$endif} |