OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 // Given a CG_SAMPLER parameter, find the corresponding CG_TEXTURE | 372 // Given a CG_SAMPLER parameter, find the corresponding CG_TEXTURE |
373 // parameter. From this CG_TEXTURE, find a matching Param by name. | 373 // parameter. From this CG_TEXTURE, find a matching Param by name. |
374 ParamTexture* EffectGL::GetTextureParamFromCgSampler( | 374 ParamTexture* EffectGL::GetTextureParamFromCgSampler( |
375 CGparameter cg_sampler, | 375 CGparameter cg_sampler, |
376 const std::vector<ParamObject*> ¶m_objects) { | 376 const std::vector<ParamObject*> ¶m_objects) { |
377 DLOG(INFO) << "EffectGL GetTextureParamFromCgSampler"; | 377 DLOG(INFO) << "EffectGL GetTextureParamFromCgSampler"; |
378 DLOG_ASSERT(cgGetParameterType(cg_sampler) != CG_SAMPLER); | 378 DLOG_ASSERT(cgGetParameterType(cg_sampler) != CG_SAMPLER); |
379 String sampler_name = cgGetParameterName(cg_sampler); | 379 String sampler_name = cgGetParameterName(cg_sampler); |
380 String param_name = GetTextureNameFromSamplerParamName(sampler_name); | 380 String param_name = GetTextureNameFromSamplerParamName(sampler_name); |
381 if (param_name.size() == 0) { | 381 if (param_name.empty()) { |
382 // Sampler has no texture associated with it. | 382 // Sampler has no texture associated with it. |
383 return NULL; | 383 return NULL; |
384 } | 384 } |
385 // Find a matching Param with the same name as the CG_TEXTURE. | 385 // Find a matching Param with the same name as the CG_TEXTURE. |
386 for (unsigned int i = 0; i < param_objects.size(); ++i) { | 386 for (unsigned int i = 0; i < param_objects.size(); ++i) { |
387 Param* param = param_objects[i]->GetUntypedParam(param_name); | 387 Param* param = param_objects[i]->GetUntypedParam(param_name); |
388 if (param && param->IsA(ParamTexture::GetApparentClass())) { | 388 if (param && param->IsA(ParamTexture::GetApparentClass())) { |
389 // Success. | 389 // Success. |
390 DLOG(INFO) << "EffectGL Matched CG_SAMPLER \"" | 390 DLOG(INFO) << "EffectGL Matched CG_SAMPLER \"" |
391 << sampler_name | 391 << sampler_name |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // Resets the render states back to their default value. | 623 // Resets the render states back to their default value. |
624 void EffectGL::PostDraw(ParamCacheGL* param_cache_gl) { | 624 void EffectGL::PostDraw(ParamCacheGL* param_cache_gl) { |
625 DLOG_FIRST_N(INFO, kNumLoggedEvents) | 625 DLOG_FIRST_N(INFO, kNumLoggedEvents) |
626 << "EffectGL PostDraw \"" << name() << "\""; | 626 << "EffectGL PostDraw \"" << name() << "\""; |
627 DCHECK(renderer_->IsCurrent()); | 627 DCHECK(renderer_->IsCurrent()); |
628 ResetShaderUniforms(param_cache_gl); | 628 ResetShaderUniforms(param_cache_gl); |
629 CHECK_GL_ERROR(); | 629 CHECK_GL_ERROR(); |
630 } | 630 } |
631 | 631 |
632 } // namespace o3d | 632 } // namespace o3d |
OLD | NEW |