| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 virtual void ResetEffectParam(RendererGL* renderer, CGparameter cg_param) { | 321 virtual void ResetEffectParam(RendererGL* renderer, CGparameter cg_param) { |
| 322 ParamArray* param = param_->value(); | 322 ParamArray* param = param_->value(); |
| 323 if (param) { | 323 if (param) { |
| 324 int size = cgGetArraySize(cg_param, 0); | 324 int size = cgGetArraySize(cg_param, 0); |
| 325 if (size == static_cast<int>(param->size())) { | 325 if (size == static_cast<int>(param->size())) { |
| 326 for (int i = 0; i < size; ++i) { | 326 for (int i = 0; i < size; ++i) { |
| 327 Param* untyped_element = param->GetUntypedParam(i); | 327 Param* untyped_element = param->GetUntypedParam(i); |
| 328 if (untyped_element->IsA(ParamSampler::GetApparentClass())) { | 328 if (untyped_element->IsA(ParamSampler::GetApparentClass())) { |
| 329 CGparameter cg_element = cgGetArrayParameter(cg_param, i); | |
| 330 ParamSampler* element = down_cast<ParamSampler*>(untyped_element); | 329 ParamSampler* element = down_cast<ParamSampler*>(untyped_element); |
| 331 SamplerGL* sampler_gl = down_cast<SamplerGL*>(element->value()); | 330 SamplerGL* sampler_gl = down_cast<SamplerGL*>(element->value()); |
| 332 if (!sampler_gl) { | 331 if (!sampler_gl) { |
| 333 sampler_gl = down_cast<SamplerGL*>(renderer->error_sampler()); | 332 sampler_gl = down_cast<SamplerGL*>(renderer->error_sampler()); |
| 334 } | 333 } |
| 335 sampler_gl->ResetTexture(cg_param); | 334 sampler_gl->ResetTexture(cg_param); |
| 336 } | 335 } |
| 337 } | 336 } |
| 338 } | 337 } |
| 339 } | 338 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 new EffectParamArrayHandlerGL<ParamBoolean>(param_param_array)); | 450 new EffectParamArrayHandlerGL<ParamBoolean>(param_param_array)); |
| 452 break; | 451 break; |
| 453 case CG_SAMPLER: | 452 case CG_SAMPLER: |
| 454 case CG_SAMPLER1D: | 453 case CG_SAMPLER1D: |
| 455 case CG_SAMPLER2D: | 454 case CG_SAMPLER2D: |
| 456 case CG_SAMPLER3D: | 455 case CG_SAMPLER3D: |
| 457 case CG_SAMPLERCUBE: | 456 case CG_SAMPLERCUBE: |
| 458 handler = EffectParamHandlerGL::Ref( | 457 handler = EffectParamHandlerGL::Ref( |
| 459 new EffectParamArraySamplerHandlerGL(param_param_array)); | 458 new EffectParamArraySamplerHandlerGL(param_param_array)); |
| 460 break; | 459 break; |
| 460 default: |
| 461 break; |
| 461 } | 462 } |
| 462 } else if (param->IsA(ParamMatrix4::GetApparentClass())) { | 463 } else if (param->IsA(ParamMatrix4::GetApparentClass())) { |
| 463 if (cg_type == CG_FLOAT4x4) { | 464 if (cg_type == CG_FLOAT4x4) { |
| 464 if (effect_gl->matrix_load_order() == Effect::COLUMN_MAJOR) { | 465 if (effect_gl->matrix_load_order() == Effect::COLUMN_MAJOR) { |
| 465 // set the data as floats in column major order. | 466 // set the data as floats in column major order. |
| 466 handler = EffectParamHandlerGL::Ref( | 467 handler = EffectParamHandlerGL::Ref( |
| 467 new EffectParamHandlerGLMatrixColumns( | 468 new EffectParamHandlerGLMatrixColumns( |
| 468 down_cast<ParamMatrix4*>(param))); | 469 down_cast<ParamMatrix4*>(param))); |
| 469 } else { | 470 } else { |
| 470 // set the data as floats in row major order. | 471 // set the data as floats in row major order. |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 DoScanCgEffectParameters(semantic_manager_, | 753 DoScanCgEffectParameters(semantic_manager_, |
| 753 renderer_, | 754 renderer_, |
| 754 this, | 755 this, |
| 755 cg_vertex, | 756 cg_vertex, |
| 756 cg_fragment, | 757 cg_fragment, |
| 757 effect_gl, | 758 effect_gl, |
| 758 param_object_list); | 759 param_object_list); |
| 759 } | 760 } |
| 760 | 761 |
| 761 } // namespace o3d | 762 } // namespace o3d |
| OLD | NEW |