#include "gl.h"#include "glext.h"#include "regcombine.h"Include dependency graph for regcombine.cpp:

Go to the source code of this file.
Namespaces | |
| namespace | rc |
Functions | |
| void | DisableCombiners () |
| void | parameter (GLenum, Color) |
| void | SetupCombinersBumpMap (Texture &bumpTexture, Texture &normalizationTexture, Color ambientColor) |
| void | SetupCombinersDecalAndBumpMap (Texture &bumpTexture, Color ambientColor, Color diffuseColor) |
| void | SetupCombinersGlossMap (int glossMap) |
| void | SetupCombinersGlossMapWithFog (int glossMap) |
| void | SetupCombinersSmooth (Texture &baseTexture, Texture &normalizationTexture, Color ambientColor, bool invert) |
|
|
Definition at line 431 of file regcombine.cpp. References GL_REGISTER_COMBINERS_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE_CUBE_MAP_EXT, and glx::glActiveTextureARB. Referenced by renderBumpMappedMesh(), renderSmoothMesh(), renderSphere_Combiners_VP(), and renderSphere_FP_VP(). 00432 {
00433 glDisable(GL_REGISTER_COMBINERS_NV);
00434 glx::glActiveTextureARB(GL_TEXTURE1_ARB);
00435 glDisable(GL_TEXTURE_CUBE_MAP_EXT);
00436 glDisable(GL_TEXTURE_2D);
00437 glx::glActiveTextureARB(GL_TEXTURE0_ARB);
00438 }
|
|
||||||||||||
|
Definition at line 57 of file regcombine.cpp. References Color::alpha(), Color::blue(), glx::glCombinerParameterfvNV, Color::green(), and Color::red(). Referenced by SetupCombinersDecalAndBumpMap(). 00058 {
00059 float f[4];
00060 f[0] = color.red();
00061 f[1] = color.green();
00062 f[2] = color.blue();
00063 f[3] = color.alpha();
00064 glx::glCombinerParameterfvNV(which, f);
00065 }
|
|
||||||||||||||||
|
Definition at line 67 of file regcombine.cpp. References Color::blue(), GL_COMBINER0_NV, GL_CONSTANT_COLOR0_NV, GL_DISCARD_NV, GL_EXPAND_NORMAL_NV, GL_NUM_GENERAL_COMBINERS_NV, GL_REGISTER_COMBINERS_NV, GL_SCALE_BY_FOUR_NV, GL_SPARE0_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE_CUBE_MAP_EXT, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, GL_VARIABLE_G_NV, glx::glActiveTextureARB, glx::glCombinerInputNV, glx::glCombinerOutputNV, glx::glCombinerParameterfvNV, glx::glCombinerParameteriNV, glx::glFinalCombinerInputNV, Color::green(), and Color::red(). Referenced by renderBumpMappedMesh(). 00070 {
00071 glEnable(GL_REGISTER_COMBINERS_NV);
00072
00073 glDisable(GL_LIGHTING);
00074 glx::glActiveTextureARB(GL_TEXTURE1_ARB);
00075 glEnable(GL_TEXTURE_CUBE_MAP_EXT);
00076 normalizationTexture.bind();
00077
00078 glx::glActiveTextureARB(GL_TEXTURE0_ARB);
00079 glEnable(GL_TEXTURE_2D);
00080 bumpTexture.bind();
00081
00082 // Just a single combiner stage required . . .
00083 glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
00084
00085 float ambient[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
00086 ambient[0] = ambientColor.red();
00087 ambient[1] = ambientColor.green();
00088 ambient[2] = ambientColor.blue();
00089 glx::glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, ambient);
00090
00091 // Compute N dot L in the RGB portion of combiner 0
00092 // Load register A with a normal N from the normal map
00093 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
00094 GL_VARIABLE_A_NV, GL_TEXTURE0_ARB,
00095 GL_EXPAND_NORMAL_NV, GL_RGB);
00096
00097 // Load register B with the normalized light direction L
00098 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
00099 GL_VARIABLE_B_NV, GL_TEXTURE1_ARB,
00100 GL_EXPAND_NORMAL_NV, GL_RGB);
00101
00102 // Compute N dot L
00103 glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
00104 GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
00105 GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);
00106
00107 // Compute the self-shadowing term in the alpha portion of combiner 0
00108 // A = 1
00109 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
00110 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00111 // B = L.z
00112 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
00113 GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_BLUE);
00114 // C = 1
00115 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_C_NV,
00116 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00117 // D = L.z
00118 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_D_NV,
00119 GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV, GL_BLUE);
00120
00121 // Create a steep ramp function for self-shadowing
00122 // SPARE0 = 4*(A*B+C*D) = 4*(1*L.z + 1*L.z) = 8 * L.z
00123 glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
00124 GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
00125 GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
00126
00127 // A = SPARE0_alpha = per-pixel self-shadowing term
00128 glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
00129 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
00130 glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
00131 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00132 // C = zero
00133 glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
00134 GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00135 // D = ambient color
00136 glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
00137 GL_CONSTANT_COLOR0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00138 // G = diffuse illumination contribution = L dot N
00139 glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
00140 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
00141 }
|
|
||||||||||||||||
|
Definition at line 226 of file regcombine.cpp. References GL_COMBINER0_NV, GL_COMBINER1_NV, GL_CONSTANT_COLOR0_NV, GL_CONSTANT_COLOR1_NV, GL_DISCARD_NV, GL_E_TIMES_F_NV, GL_EXPAND_NORMAL_NV, GL_NUM_GENERAL_COMBINERS_NV, GL_PRIMARY_COLOR_NV, GL_REGISTER_COMBINERS_NV, GL_SCALE_BY_FOUR_NV, GL_SPARE0_NV, GL_SPARE1_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, GL_VARIABLE_E_NV, GL_VARIABLE_F_NV, GL_VARIABLE_G_NV, glx::glCombinerInputNV, glx::glCombinerOutputNV, glx::glCombinerParameteriNV, glx::glFinalCombinerInputNV, and rc::parameter(). Referenced by renderSphere_Combiners_VP(). 00229 {
00230 glEnable(GL_REGISTER_COMBINERS_NV);
00231 glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 2);
00232
00233 rc::parameter(GL_CONSTANT_COLOR0_NV, ambientColor);
00234 rc::parameter(GL_CONSTANT_COLOR1_NV, diffuseColor);
00235
00236 // Compute N dot L in the RGB portion of combiner 0
00237 // Load register A with a normal N from the bump map
00238 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
00239 GL_VARIABLE_A_NV, GL_TEXTURE1_ARB,
00240 GL_EXPAND_NORMAL_NV, GL_RGB);
00241
00242 // Load register B with the primary color, which contains the surface
00243 // space light direction L. Because the color is linearly interpolated
00244 // across triangles, the direction may become denormalized; however, in
00245 // Celestia, planet surfaces are tessellated finely enough that this
00246 // is not a problem.
00247 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
00248 GL_VARIABLE_B_NV, GL_PRIMARY_COLOR_NV,
00249 GL_EXPAND_NORMAL_NV, GL_RGB);
00250
00251 // Product C*D computes diffuse color * texture
00252 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
00253 GL_VARIABLE_C_NV, GL_TEXTURE0_ARB,
00254 GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00255 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB,
00256 GL_VARIABLE_D_NV, GL_CONSTANT_COLOR1_NV,
00257 GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00258
00259 // Compute N dot L in spare0 and diffuse * decal texture in spare1
00260 glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
00261 GL_SPARE0_NV, GL_SPARE1_NV, GL_DISCARD_NV,
00262 GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);
00263
00264 // Compute the self-shadowing term in the alpha portion of combiner 0
00265 // A = 1
00266 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
00267 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00268 // B = L.z
00269 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
00270 GL_PRIMARY_COLOR_NV, GL_EXPAND_NORMAL_NV, GL_BLUE);
00271 // C = 1
00272 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_C_NV,
00273 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00274 // D = L.z
00275 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_D_NV,
00276 GL_PRIMARY_COLOR_NV, GL_EXPAND_NORMAL_NV, GL_BLUE);
00277
00278 // Create a steep ramp function for self-shadowing
00279 // SPARE0 = 4*(A*B+C*D) = 4*(1*L.z + 1*L.z) = 8 * L.z
00280 glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
00281 GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
00282 GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
00283
00284 // In the second combiner, sum the ambient color and product of the
00285 // diffuse and self-shadowing terms.
00286 glx::glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV,
00287 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
00288 glx::glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV,
00289 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00290 glx::glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV,
00291 GL_CONSTANT_COLOR0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00292 glx::glCombinerInputNV(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV,
00293 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
00294 glx::glCombinerOutputNV(GL_COMBINER1_NV, GL_RGB,
00295 GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
00296 GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
00297
00298 // E = SPARE0 = fragment brightness, including ambient, diffuse, and
00299 // self shadowing.
00300 glx::glFinalCombinerInputNV(GL_VARIABLE_E_NV,
00301 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00302 // F = spare1 = decal texture rgb * diffuse color
00303 glx::glFinalCombinerInputNV(GL_VARIABLE_F_NV,
00304 GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00305
00306 // A = fog factor
00307 glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
00308 GL_FOG, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
00309 // B = color
00310 glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
00311 GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00312 // C = fog color
00313 glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
00314 GL_FOG, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00315 // D = zero
00316 glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
00317 GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00318
00319 // G = diffuse illumination contribution = L dot N
00320 glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
00321 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
00322 }
|
|
|
Definition at line 326 of file regcombine.cpp. References GL_COMBINER0_NV, GL_DISCARD_NV, GL_NUM_GENERAL_COMBINERS_NV, GL_PRIMARY_COLOR_NV, GL_REGISTER_COMBINERS_NV, GL_SECONDARY_COLOR_NV, GL_SPARE0_NV, GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, GL_VARIABLE_G_NV, glx::glCombinerInputNV, glx::glCombinerOutputNV, glx::glCombinerParameteriNV, and glx::glFinalCombinerInputNV. Referenced by renderSphere_Combiners_VP(), and renderSphere_FP_VP(). 00327 {
00328 glEnable(GL_REGISTER_COMBINERS_NV);
00329
00330 // Just a single combiner stage required . . .
00331 glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
00332
00333 // A = primary color
00334 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
00335 GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00336 // B = base texture color
00337 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
00338 GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00339 // C = secondary color
00340 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
00341 GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00342 if (glossMap != 0)
00343 {
00344 // D = texture1 rgb (gloss mask)
00345 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
00346 glossMap, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00347 }
00348 else
00349 {
00350 // D = texture alpha (gloss mask)
00351 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
00352 GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
00353 }
00354
00355 // SPARE0_rgb = primary * texture.rgb + secondary * texture.alpha
00356 glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
00357 GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
00358 GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
00359
00360 // A = SPARE0_rgb
00361 glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
00362 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00363 // B = 1
00364 glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
00365 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
00366 // C = zero
00367 glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
00368 GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00369 // D = zero
00370 glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
00371 GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00372 // G = 1
00373 glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
00374 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00375 }
|
|
|
Definition at line 379 of file regcombine.cpp. References GL_COMBINER0_NV, GL_DISCARD_NV, GL_NUM_GENERAL_COMBINERS_NV, GL_PRIMARY_COLOR_NV, GL_REGISTER_COMBINERS_NV, GL_SECONDARY_COLOR_NV, GL_SPARE0_NV, GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, GL_VARIABLE_G_NV, glx::glCombinerInputNV, glx::glCombinerOutputNV, glx::glCombinerParameteriNV, and glx::glFinalCombinerInputNV. Referenced by renderSphere_Combiners_VP(). 00380 {
00381 glEnable(GL_REGISTER_COMBINERS_NV);
00382
00383 // Just a single combiner stage required . . .
00384 glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
00385
00386 // A = primary color
00387 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
00388 GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00389 // B = base texture color
00390 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
00391 GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00392 // C = secondary color
00393 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
00394 GL_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00395 if (glossMap != 0)
00396 {
00397 // D = texture1 rgb (gloss mask)
00398 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
00399 glossMap, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00400 }
00401 else
00402 {
00403 // D = texture alpha (gloss mask)
00404 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
00405 GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
00406 }
00407
00408 // SPARE0_rgb = primary * texture.rgb + secondary * texture.alpha
00409 glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
00410 GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
00411 GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
00412
00413 // A = fog factor
00414 glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
00415 GL_FOG, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
00416 // B = spare0_rgb
00417 glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
00418 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00419 // C = fog color
00420 glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
00421 GL_FOG, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00422 // D = zero
00423 glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
00424 GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00425 // G = 1
00426 glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
00427 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00428 }
|
|
||||||||||||||||||||
|
Definition at line 149 of file regcombine.cpp. References Color::blue(), GL_COMBINER0_NV, GL_CONSTANT_COLOR0_NV, GL_DISCARD_NV, GL_E_TIMES_F_NV, GL_EXPAND_NORMAL_NV, GL_NUM_GENERAL_COMBINERS_NV, GL_PRIMARY_COLOR_NV, GL_REGISTER_COMBINERS_NV, GL_SPARE0_NV, GL_SPARE1_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE_CUBE_MAP_EXT, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, GL_VARIABLE_E_NV, GL_VARIABLE_F_NV, GL_VARIABLE_G_NV, glx::glActiveTextureARB, glx::glCombinerInputNV, glx::glCombinerOutputNV, glx::glCombinerParameterfvNV, glx::glCombinerParameteriNV, glx::glFinalCombinerInputNV, Color::green(), and Color::red(). Referenced by renderSmoothMesh(). 00153 {
00154 glEnable(GL_REGISTER_COMBINERS_NV);
00155
00156 glDisable(GL_LIGHTING);
00157 glx::glActiveTextureARB(GL_TEXTURE1_ARB);
00158 glEnable(GL_TEXTURE_CUBE_MAP_EXT);
00159 normalizationTexture.bind();
00160 glx::glActiveTextureARB(GL_TEXTURE0_ARB);
00161 glEnable(GL_TEXTURE_2D);
00162 baseTexture.bind();
00163
00164 // Just a single combiner stage required . . .
00165 glx::glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
00166
00167 float ambient[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
00168 ambient[0] = ambientColor.red();
00169 ambient[1] = ambientColor.green();
00170 ambient[2] = ambientColor.blue();
00171 glx::glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, ambient);
00172
00173 // A = primary color
00174 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
00175 GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV,
00176 GL_RGB);
00177 // B = base texture color
00178 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
00179 GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00180 // SPARE1_rgb = primary * texture
00181 glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB,
00182 GL_SPARE1_NV, GL_DISCARD_NV, GL_DISCARD_NV,
00183 GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
00184
00185 // A = 1
00186 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_A_NV,
00187 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00188 // B = L.z
00189 glx::glCombinerInputNV(GL_COMBINER0_NV, GL_ALPHA, GL_VARIABLE_B_NV,
00190 GL_TEXTURE1_ARB, GL_EXPAND_NORMAL_NV,
00191 GL_BLUE);
00192 // SPARE0_alpha = 1 * L.z
00193 glx::glCombinerOutputNV(GL_COMBINER0_NV, GL_ALPHA,
00194 GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
00195 GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
00196
00197 // E = SPARE1_rgb = base texture color * primary
00198 glx::glFinalCombinerInputNV(GL_VARIABLE_E_NV,
00199 GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00200 // F = ambient color
00201 glx::glFinalCombinerInputNV(GL_VARIABLE_F_NV,
00202 GL_CONSTANT_COLOR0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00203 // A = SPARE1_rgb = base texture color * primary
00204 glx::glFinalCombinerInputNV(GL_VARIABLE_A_NV,
00205 GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00206 // B = SPARE0_alpha = L.z
00207 glx::glFinalCombinerInputNV(GL_VARIABLE_B_NV,
00208 GL_SPARE0_NV,
00209 invert ? GL_UNSIGNED_INVERT_NV : GL_UNSIGNED_IDENTITY_NV,
00210 GL_ALPHA);
00211 // C = zero
00212 glx::glFinalCombinerInputNV(GL_VARIABLE_C_NV,
00213 GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00214 // D = SPARE1_rgb = E*F = texture * primary * ambient color
00215 glx::glFinalCombinerInputNV(GL_VARIABLE_D_NV,
00216 GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
00217 // G = 1
00218 glx::glFinalCombinerInputNV(GL_VARIABLE_G_NV,
00219 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA);
00220
00221 }
|
1.4.1