File: CastleRayTracer.TRayTracer.html

package info (click to toggle)
castle-game-engine 5.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 185,428 kB
  • sloc: pascal: 260,781; cpp: 1,363; objc: 713; makefile: 537; xml: 496; sh: 480; php: 4
file content (246 lines) | stat: -rw-r--r-- 17,009 bytes parent folder | download
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
<!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: CastleRayTracer: Class TRayTracer</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="TRayTracer"></a><h1 class="cio">Class TRayTracer</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><a class="section" href="#PasDoc-Fields">Fields</a></td><td><a class="section" href="#PasDoc-Methods">Methods</a></td><td>Properties</td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a  href="CastleRayTracer.html">CastleRayTracer</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TRayTracer = class(TObject)</code></p>
<h2 class="description">Description</h2>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TObject</li>
<li class="thisitem">TRayTracer</li></ul><h2 class="overview">Overview</h2>
<a name="PasDoc-Fields"></a><h3 class="summary">Fields</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><b><a  href="CastleRayTracer.TRayTracer.html#Octree">Octree</a></b>: <a  href="X3DTriangles.TBaseTrianglesOctree.html">TBaseTrianglesOctree</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><b><a  href="CastleRayTracer.TRayTracer.html#Image">Image</a></b>: <a  href="CastleImages.TCastleImage.html">TCastleImage</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><b><a  href="CastleRayTracer.TRayTracer.html#CamPosition">CamPosition</a></b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</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><b><a  href="CastleRayTracer.TRayTracer.html#CamDirection">CamDirection</a></b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</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><b><a  href="CastleRayTracer.TRayTracer.html#CamUp">CamUp</a></b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</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><b><a  href="CastleRayTracer.TRayTracer.html#Projection">Projection</a></b>: <a  href="CastleRays.TProjection.html">TProjection</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><b><a  href="CastleRayTracer.TRayTracer.html#SceneBGColor">SceneBGColor</a></b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</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><b><a  href="CastleRayTracer.TRayTracer.html#PixelsMadeNotifier">PixelsMadeNotifier</a></b>: <a  href="CastleRayTracer.html#TPixelsMadeNotifierFunc">TPixelsMadeNotifierFunc</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><b><a  href="CastleRayTracer.TRayTracer.html#PixelsMadeNotifierData">PixelsMadeNotifierData</a></b>: Pointer;</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><b><a  href="CastleRayTracer.TRayTracer.html#FirstPixel">FirstPixel</a></b>: Cardinal;</code></td>
</tr>
</table>
<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>procedure <b><a  href="CastleRayTracer.TRayTracer.html#AppendStats">AppendStats</a></b>(const Stats: TStrings; const RenderingTime: Single); virtual;</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="CastleRayTracer.TRayTracer.html#Execute">Execute</a></b>; virtual; abstract;</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="CastleRayTracer.TRayTracer.html#ExecuteStats">ExecuteStats</a></b>(const Stats: TStrings);</code></td>
</tr>
</table>
<h2 class="description">Description</h2>
<h3 class="detail">Fields</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="Octree"></a><code><b>Octree</b>: <a  href="X3DTriangles.TBaseTrianglesOctree.html">TBaseTrianglesOctree</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Scene to render. Must be set before calling <a class="normal" href="CastleRayTracer.TRayTracer.html#Execute">Execute</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="Image"></a><code><b>Image</b>: <a  href="CastleImages.TCastleImage.html">TCastleImage</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Image where the ray-tracer result will be stored. Must be set before calling <a class="normal" href="CastleRayTracer.TRayTracer.html#Execute">Execute</a>.

<p>We will not resize given here Image. Instead we will use it's current size &mdash; so you just have to set Image size as appropriate before calling this method.

<p>For every pixel, we calculate it's color and store it by <a class="normal" href="CastleImages.TCastleImage.html#SetColorRGB">TCastleImage.SetColorRGB</a> method. So make sure SetColorRGB is implemented for your image class (it's implemented in all 3 classes <a class="normal" href="CastleImages.TRGBImage.html">TRGBImage</a>, <a class="normal" href="CastleImages.TRGBAlphaImage.html">TRGBAlphaImage</a>, <a class="normal" href="CastleImages.TRGBFloatImage.html">TRGBFloatImage</a>, so usually just don't worry about that). We don't modify alpha channel of the image.

<p>Using <a class="normal" href="CastleImages.TRGBFloatImage.html">TRGBFloatImage</a> class is advised if you want the full color information. Otherwise color precision is lost beyond 8 bits, and values above 1.0 are clamped.</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="CamPosition"></a><code><b>CamPosition</b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Camera view. <a class="normal" href="CastleRayTracer.TRayTracer.html#CamDirection">CamDirection</a> and <a class="normal" href="CastleRayTracer.TRayTracer.html#CamUp">CamUp</a> do not have to be normalized &mdash; we will correct them here if needed. <a class="normal" href="CastleRayTracer.TRayTracer.html#CamUp">CamUp</a> will be automatically corrected to be orthogonal to <a class="normal" href="CastleRayTracer.TRayTracer.html#CamDirection">CamDirection</a> if necessary, you only make sure it's not parallel to <a class="normal" href="CastleRayTracer.TRayTracer.html#CamDirection">CamDirection</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="CamDirection"></a><code><b>CamDirection</b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Camera view. <code>CamDirection</code> and <a class="normal" href="CastleRayTracer.TRayTracer.html#CamUp">CamUp</a> do not have to be normalized &mdash; we will correct them here if needed. <a class="normal" href="CastleRayTracer.TRayTracer.html#CamUp">CamUp</a> will be automatically corrected to be orthogonal to <code>CamDirection</code> if necessary, you only make sure it's not parallel to <code>CamDirection</code>.</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="CamUp"></a><code><b>CamUp</b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Camera view. <a class="normal" href="CastleRayTracer.TRayTracer.html#CamDirection">CamDirection</a> and <code>CamUp</code> do not have to be normalized &mdash; we will correct them here if needed. <code>CamUp</code> will be automatically corrected to be orthogonal to <a class="normal" href="CastleRayTracer.TRayTracer.html#CamDirection">CamDirection</a> if necessary, you only make sure it's not parallel to <a class="normal" href="CastleRayTracer.TRayTracer.html#CamDirection">CamDirection</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="Projection"></a><code><b>Projection</b>: <a  href="CastleRays.TProjection.html">TProjection</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Camera <code>projection</code> properties.</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="SceneBGColor"></a><code><b>SceneBGColor</b>: <a  href="CastleVectors.html#TVector3Single">TVector3Single</a>;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</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="PixelsMadeNotifier"></a><code><b>PixelsMadeNotifier</b>: <a  href="CastleRayTracer.html#TPixelsMadeNotifierFunc">TPixelsMadeNotifierFunc</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Callback notified (if assigned) about writing each image pixel. This way you can display somewhere, or store to file, partially generated image. This callback gets information (in PixelsMadeCount) about how many pixels were generated (this includes also pixels skipped in case <a class="normal" href="CastleRayTracer.TRayTracer.html#FirstPixel">FirstPixel</a> &gt; 0).

<p>The pixels are written in the order of <a class="normal" href="CastleSpaceFillingCurves.TSwapScanCurve.html">TSwapScanCurve</a> for <a class="normal" href="CastleRayTracer.TClassicRayTracer.html">TClassicRayTracer</a>, and in order dependent on <a class="normal" href="CastleRayTracer.TPathTracer.html#SFCurveClass">TPathTracer.SFCurveClass</a> for <a class="normal" href="CastleRayTracer.TPathTracer.html">TPathTracer</a>. When shadow cache will be implemented to <a class="normal" href="CastleRayTracer.TClassicRayTracer.html">TClassicRayTracer</a>, then configurable SFCurveClass may be done also for <a class="normal" href="CastleRayTracer.TClassicRayTracer.html">TClassicRayTracer</a>.

<p>Remember that pixels not done yet have the same content as they had when you <a class="normal" href="CastleRayTracer.TRayTracer.html#Execute">Execute</a> method started. In other words, if you set <code>PixelsMadeNotifier</code> &lt;&gt; nil, then often it's desirable to initialize Image content (e.g. to all <a class="normal" href="CastleRayTracer.TRayTracer.html#SceneBGColor">SceneBGColor</a>) before calling <a class="normal" href="CastleRayTracer.TRayTracer.html#Execute">Execute</a>. Otherwise at the time of <a class="normal" href="CastleRayTracer.TRayTracer.html#Execute">Execute</a> call, the pixels not done yet will have undefined colors.</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="PixelsMadeNotifierData"></a><code><b>PixelsMadeNotifierData</b>: Pointer;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</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="FirstPixel"></a><code><b>FirstPixel</b>: Cardinal;</code></td>
</tr>
<tr><td colspan="2">
<p>
Initial pixel to start rendering from. By setting this to something &gt; 0, you can (re-)start rendering from the middle. Useful to finish the job of a previous terminated ray-tracer process.

<p>Must be in [0 .. Image.Width * Image.Height] range. Setting to <code>Image.Width * Image.Height</code> makes the ray-tracer do nothing.</p>
</td></tr>
</table>
<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="AppendStats"></a><code>procedure <b>AppendStats</b>(const Stats: TStrings; const RenderingTime: Single); virtual;</code></td>
</tr>
<tr><td colspan="2">
&nbsp;</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="Execute"></a><code>procedure <b>Execute</b>; virtual; abstract;</code></td>
</tr>
<tr><td colspan="2">
<p>
Do ray-tracing, writing a ray-traced image into the <a class="normal" href="CastleRayTracer.TRayTracer.html#Image">Image</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="ExecuteStats"></a><code>procedure <b>ExecuteStats</b>(const Stats: TStrings);</code></td>
</tr>
<tr><td colspan="2">
<p>
Do ray-tracing, like <a class="normal" href="CastleRayTracer.TRayTracer.html#Execute">Execute</a>, additionally gathering some statistics. The statistics will be added to the given string list.</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&amp;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>