File: CastleRenderer.TGLTextureNode.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 (233 lines) | stat: -rw-r--r-- 17,643 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
<!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: CastleRenderer: Class TGLTextureNode</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="TGLTextureNode"></a><h1 class="cio">Class TGLTextureNode</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>Properties</td></tr></table>
<a name="PasDoc-Description"></a><h2 class="unit">Unit</h2>
<p class="unitlink">
<a  href="CastleRenderer.html">CastleRenderer</a></p>
<h2 class="declaration">Declaration</h2>
<p class="declaration">
<code>type TGLTextureNode = class(<a class="normal" href="CastleRenderer.TResourceRenderer.html">TResourceRenderer</a>)</code></p>
<h2 class="description">Description</h2>
<p>
OpenGL handling for VRML/X3D texture node.</p>
<a name="PasDoc-Hierarchy"></a><h2 class="hierarchy">Hierarchy</h2>
<ul class="hierarchy"><li class="ancestor">TObject</li>
<li class="ancestor"><a class="normal" href="CastleRenderer.TResourceRenderer.html">TResourceRenderer</a></li>
<li class="thisitem">TGLTextureNode</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>procedure <b><a  href="CastleRenderer.TGLTextureNode.html#HandleTexturePropertiesCore">HandleTexturePropertiesCore</a></b>( TextureProperties: <a  href="X3DNodes.TTexturePropertiesNode.html">TTexturePropertiesNode</a>; out Filter: <a  href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; out Anisotropy: <a  href="CastleGLUtils.html#TGLfloat">TGLfloat</a>; out GUITexture: boolean);</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="CastleRenderer.TGLTextureNode.html#HandleTextureProperties">HandleTextureProperties</a></b>( TextureProperties: <a  href="X3DNodes.TX3DNode.html">TX3DNode</a>; out Filter: <a  href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; out Anisotropy: <a  href="CastleGLUtils.html#TGLfloat">TGLfloat</a>; out GUITexture: boolean);</code></td>
</tr>
<tr class="list">
<td class="visibility"><a  href="legend.html"><img  src="protected.gif" alt="Protected" title="Protected"></a></td>
<td class="itemcode"><code>class function <b><a  href="CastleRenderer.TGLTextureNode.html#IsClassForTextureNode">IsClassForTextureNode</a></b>( ANode: <a  href="X3DNodes.TAbstractTextureNode.html">TAbstractTextureNode</a>): boolean; virtual; abstract;</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="CastleRenderer.TGLTextureNode.html#PrepareCore">PrepareCore</a></b>(State: <a  href="X3DNodes.TX3DGraphTraverseState.html">TX3DGraphTraverseState</a>); 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>constructor <b><a  href="CastleRenderer.TGLTextureNode.html#Create">Create</a></b>(ARenderer: <a  href="CastleRenderer.TGLRenderer.html">TGLRenderer</a>; ANode: <a  href="X3DNodes.TX3DNode.html">TX3DNode</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="CastleRenderer.TGLTextureNode.html#TextureNode">TextureNode</a></b>: <a  href="X3DNodes.TAbstractTextureNode.html">TAbstractTextureNode</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>class function <b><a  href="CastleRenderer.TGLTextureNode.html#ClassForTextureNode">ClassForTextureNode</a></b>( ANode: <a  href="X3DNodes.TAbstractTextureNode.html">TAbstractTextureNode</a>): <a  href="CastleRenderer.html#TGLTextureNodeClass">TGLTextureNodeClass</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="CastleRenderer.TGLTextureNode.html#Prepare">Prepare</a></b>(State: <a  href="X3DNodes.TX3DGraphTraverseState.html">TX3DGraphTraverseState</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="CastleRenderer.TGLTextureNode.html#Bind">Bind</a></b>(const TextureUnit: Cardinal): boolean; virtual; abstract;</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="CastleRenderer.TGLTextureNode.html#Enable">Enable</a></b>(const TextureUnit: Cardinal; Shader: TShader; const Env: TTextureEnv): boolean; 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="CastleRenderer.TGLTextureNode.html#EnableAll">EnableAll</a></b>( const TextureUnitsCount: Cardinal; var TextureSlotsUsed: Cardinal; Shader: TShader); virtual; abstract;</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="HandleTexturePropertiesCore"></a><code>procedure <b>HandleTexturePropertiesCore</b>( TextureProperties: <a  href="X3DNodes.TTexturePropertiesNode.html">TTexturePropertiesNode</a>; out Filter: <a  href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; out Anisotropy: <a  href="CastleGLUtils.html#TGLfloat">TGLfloat</a>; out GUITexture: boolean);</code></td>
</tr>
<tr><td colspan="2">
<p>
Calculate things from TextureProperties node. If TextureProperties = <code>Nil</code>, they are taken from defaults (possibly in Attributes).</p>
</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="HandleTextureProperties"></a><code>procedure <b>HandleTextureProperties</b>( TextureProperties: <a  href="X3DNodes.TX3DNode.html">TX3DNode</a>; out Filter: <a  href="CastleGLImages.TTextureFilter.html">TTextureFilter</a>; out Anisotropy: <a  href="CastleGLUtils.html#TGLfloat">TGLfloat</a>; out GUITexture: boolean);</code></td>
</tr>
<tr><td colspan="2">
<p>
Calculate things from TextureProperties node. If TextureProperties = <code>Nil</code> or not of <a class="normal" href="X3DNodes.TTexturePropertiesNode.html">TTexturePropertiesNode</a> class, they are taken from defaults (possibly in Attributes).

<p>This is useful when interpreting VRML/X3D files, as you have no guarantee user didn't place there some disallowed node in &quot;textureProperties&quot; field.</p>
</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="IsClassForTextureNode"></a><code>class function <b>IsClassForTextureNode</b>( ANode: <a  href="X3DNodes.TAbstractTextureNode.html">TAbstractTextureNode</a>): boolean; virtual; abstract;</code></td>
</tr>
<tr><td colspan="2">
<p>
Decide if this class can handle given texture Node.</p>
</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="PrepareCore"></a><code>procedure <b>PrepareCore</b>(State: <a  href="X3DNodes.TX3DGraphTraverseState.html">TX3DGraphTraverseState</a>); virtual; abstract;</code></td>
</tr>
<tr><td colspan="2">
<p>
Do the time-consuming preparations before rendering this texture. Called from <a class="normal" href="CastleRenderer.TGLRenderer.html#Prepare">TGLRenderer.Prepare</a>, always through our Prepare method. Our Prepare method takes care to catch common exceptions from this (<a class="normal" href="CastleGLImages.EFramebufferError.html">EFramebufferError</a>, <a class="normal" href="CastleGLImages.ETextureLoadError.html">ETextureLoadError</a>), convert them to <a class="normal" href="CastleWarnings.html#OnWarning">OnWarning</a> and make Unprepare to undo the preparations. So Prepare-Unprepare work like constructor-destructor, with Unprepare having to be prepared to finilizing incomplete instance.</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="Create"></a><code>constructor <b>Create</b>(ARenderer: <a  href="CastleRenderer.TGLRenderer.html">TGLRenderer</a>; ANode: <a  href="X3DNodes.TX3DNode.html">TX3DNode</a>); override;</code></td>
</tr>
<tr><td colspan="2">
<p>
ANode must be <a class="normal" href="X3DNodes.TAbstractTextureNode.html">TAbstractTextureNode</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="TextureNode"></a><code>function <b>TextureNode</b>: <a  href="X3DNodes.TAbstractTextureNode.html">TAbstractTextureNode</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Reference to handled texture node. Never <code>Nil</code>. It's guaranteed to satisfy <a class="normal" href="CastleRenderer.TGLTextureNode.html#IsClassForTextureNode">IsClassForTextureNode</a> method of this class.</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="ClassForTextureNode"></a><code>class function <b>ClassForTextureNode</b>( ANode: <a  href="X3DNodes.TAbstractTextureNode.html">TAbstractTextureNode</a>): <a  href="CastleRenderer.html#TGLTextureNodeClass">TGLTextureNodeClass</a>;</code></td>
</tr>
<tr><td colspan="2">
<p>
Find suitable <a class="normal" href="CastleRenderer.TGLTextureNode.html">TGLTextureNode</a> class that can best handle given Node. Returns <code>Nil</code> if not found.

<p><i>Descedants implementors</i>: override <a class="normal" href="CastleRenderer.TGLTextureNode.html#IsClassForTextureNode">IsClassForTextureNode</a> to be correctly recognized by this.</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="Prepare"></a><code>procedure <b>Prepare</b>(State: <a  href="X3DNodes.TX3DGraphTraverseState.html">TX3DGraphTraverseState</a>);</code></td>
</tr>
<tr><td colspan="2">
<p>
Do the time-consuming preparations before rendering this texture. Calls <a class="normal" href="CastleRenderer.TGLTextureNode.html#PrepareCore">PrepareCore</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="Bind"></a><code>function <b>Bind</b>(const TextureUnit: Cardinal): boolean; virtual; abstract;</code></td>
</tr>
<tr><td colspan="2">
<p>
Bind texture for OpenGL (without enabling it).

<p>Just like Enable, returns <code>False</code> when texture node was not successfully prepared for OpenGL. Returns <code>True</code> when it was successfully bound (caller can be sure then that given texture unit is currently active).</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="Enable"></a><code>function <b>Enable</b>(const TextureUnit: Cardinal; Shader: TShader; const Env: TTextureEnv): boolean; virtual; abstract;</code></td>
</tr>
<tr><td colspan="2">
<p>
Enables texture for OpenGL. This has to bind texture identifier and enable proper texture state (for example: 2D, and not 3D, and not cube).

<p>When returns <code>False</code>, it means that texture node was not successfully prepared for OpenGL, which means (we assume that you called Prepare before Enable) that texture failed to load, required not available OpenGL version / extension etc. Caller will then disable the texture unit, and you don't have to generate tex coords for it.

<p>When returns <code>True</code> (success) caller can be sure that the specified TextureUnit is currently bound (if OpenGL multitexturing extensions are available at all). This is useful, if you want to later adjust texture unit parameters, like glTexEnvi(GL_TEXTURE_ENV, ...).

<p>It's also already enabled (by glEnable(GL_TEXTURE_2D / GL_TEXTURE_CUBE_MAP / GL_TEXTURE_3D) ).</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="EnableAll"></a><code>procedure <b>EnableAll</b>( const TextureUnitsCount: Cardinal; var TextureSlotsUsed: Cardinal; Shader: TShader); virtual; abstract;</code></td>
</tr>
<tr><td colspan="2">
<p>
Sets texture state for many texture units, based on this node. On every texture unit where something is enabled, proper texture identifier must be bound. Also, has to set complete glTexEnv on every enabled texture unit.

<p>TextureUnitsCount says how many texture units can be enabled/disabled.

<p>TextureUnitsCount does *not* take into account whether multitexturing OpenGL extensions are available at all. Look at GLFeatures.UseMultiTexturing for this. Think of GLFeatures.UseMultiTexturing as capping TextureUnitsCount to 1 (still, remember to honour TextureUnitsCount = 0 case in your implementation, even when GLFeatures.UseMultiTexturing = <code>True</code>).

<p>You have to update TextureSlotsUsed, this is the count of texture units where some texture coordinates should be generated. It's initial value may be &gt; 0, in case some texture slots are already taken. This means that all texture units above TextureSlotsUsed (to TextureUnitsCount - 1) should be disabled by the caller (no need to do this in <code>EnableAll</code>), and there's no need to generated texture coords for them.

<p>( Yes, there is some small optimization missed in the definition of TextureSlotsUsed: if some textures in the middle of multitexture children list failed to load, but some following children succeded, we'll generate tex coords even for the useless texture units in the middle. We could avoid generating texture coords for them, by changing TextureSlotsUsed into bool array. This optimization is not considered worthy implementing for now. )

<p>You have to set texture state of all texture units &lt; TextureSlotsUsed, and only on them.</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>