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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "utils/cross/temporary_file.h" | 46 #include "utils/cross/temporary_file.h" |
47 | 47 |
48 namespace o3d { | 48 namespace o3d { |
49 namespace { | 49 namespace { |
50 FUDaeTextureFilterFunction::FilterFunction LookupFilterFunction( | 50 FUDaeTextureFilterFunction::FilterFunction LookupFilterFunction( |
51 const char* name) { | 51 const char* name) { |
52 struct { | 52 struct { |
53 const char* name; | 53 const char* name; |
54 FUDaeTextureFilterFunction::FilterFunction func; | 54 FUDaeTextureFilterFunction::FilterFunction func; |
55 } functions[] = { | 55 } functions[] = { |
56 "None", FUDaeTextureFilterFunction::NONE, | 56 {"None", FUDaeTextureFilterFunction::NONE}, |
57 "Linear", FUDaeTextureFilterFunction::LINEAR, | 57 {"Linear", FUDaeTextureFilterFunction::LINEAR}, |
58 "Point", FUDaeTextureFilterFunction::NEAREST, // DX | 58 {"Point", FUDaeTextureFilterFunction::NEAREST}, // DX |
59 "Nearest", FUDaeTextureFilterFunction::NEAREST, // GL | 59 {"Nearest", FUDaeTextureFilterFunction::NEAREST}, // GL |
60 "LinearMipmapLinear", FUDaeTextureFilterFunction::LINEAR_MIPMAP_LINEAR, | 60 {"LinearMipmapLinear", FUDaeTextureFilterFunction::LINEAR_MIPMAP_LINEAR}, |
61 "LinearMipmapNearest", FUDaeTextureFilterFunction::LINEAR_MIPMAP_NEAREST, | 61 {"LinearMipmapNearest", FUDaeTextureFilterFunction::LINEAR_MIPMAP_NEAREST}, |
62 "NearestMipmapNearest", FUDaeTextureFilterFunction::LINEAR_MIPMAP_NEAREST, | 62 {"NearestMipmapNearest", FUDaeTextureFilterFunction::LINEAR_MIPMAP_NEAREST}, |
63 "NearestMipmapLinear", FUDaeTextureFilterFunction::NEAREST_MIPMAP_LINEAR, | 63 {"NearestMipmapLinear", FUDaeTextureFilterFunction::NEAREST_MIPMAP_LINEAR}, |
64 // TODO: Once FCollada supports the COLLADA v1.5 spec, | 64 // TODO: Once FCollada supports the COLLADA v1.5 spec, |
65 // turn this on. | 65 // turn this on. |
66 // "Anisotropic", FUDaeTextureFilterFunction::ANISOTROPIC, | 66 // "Anisotropic", FUDaeTextureFilterFunction::ANISOTROPIC, |
67 }; | 67 }; |
68 for (int i = 0; i < sizeof(functions) / sizeof(functions[0]); ++i) { | 68 for (size_t i = 0; i < sizeof(functions) / sizeof(functions[0]); ++i) { |
69 if (!base::strcasecmp(functions[i].name, name)) { | 69 if (!base::strcasecmp(functions[i].name, name)) { |
70 return functions[i].func; | 70 return functions[i].func; |
71 } | 71 } |
72 } | 72 } |
73 return FUDaeTextureFilterFunction::UNKNOWN; | 73 return FUDaeTextureFilterFunction::UNKNOWN; |
74 } | 74 } |
75 | 75 |
76 #undef CLAMP | 76 #undef CLAMP |
77 | 77 |
78 FUDaeTextureWrapMode::WrapMode LookupWrapMode(const char* name) { | 78 FUDaeTextureWrapMode::WrapMode LookupWrapMode(const char* name) { |
79 struct { | 79 struct { |
80 const char* name; | 80 const char* name; |
81 FUDaeTextureWrapMode::WrapMode mode; | 81 FUDaeTextureWrapMode::WrapMode mode; |
82 } modes[] = { | 82 } modes[] = { |
83 "None", FUDaeTextureWrapMode::NONE, | 83 {"None", FUDaeTextureWrapMode::NONE}, |
84 // DX-style names: | 84 // DX-style names: |
85 "Wrap", FUDaeTextureWrapMode::WRAP, | 85 {"Wrap", FUDaeTextureWrapMode::WRAP}, |
86 "Mirror", FUDaeTextureWrapMode::MIRROR, | 86 {"Mirror", FUDaeTextureWrapMode::MIRROR}, |
87 "Clamp", FUDaeTextureWrapMode::CLAMP, | 87 {"Clamp", FUDaeTextureWrapMode::CLAMP}, |
88 "Border", FUDaeTextureWrapMode::BORDER, | 88 {"Border", FUDaeTextureWrapMode::BORDER}, |
89 // GL-style names: | 89 // GL-style names: |
90 "Repeat", FUDaeTextureWrapMode::WRAP, | 90 {"Repeat", FUDaeTextureWrapMode::WRAP}, |
91 "MirroredRepeat", FUDaeTextureWrapMode::MIRROR, | 91 {"MirroredRepeat", FUDaeTextureWrapMode::MIRROR}, |
92 "ClampToEdge", FUDaeTextureWrapMode::CLAMP, | 92 {"ClampToEdge", FUDaeTextureWrapMode::CLAMP}, |
93 "ClampToBorder", FUDaeTextureWrapMode::BORDER, | 93 {"ClampToBorder", FUDaeTextureWrapMode::BORDER}, |
94 }; | 94 }; |
95 for (int i = 0; i < sizeof(modes) / sizeof(modes[0]); ++i) { | 95 for (size_t i = 0; i < sizeof(modes) / sizeof(modes[0]); ++i) { |
96 if (!base::strcasecmp(modes[i].name, name)) { | 96 if (!base::strcasecmp(modes[i].name, name)) { |
97 return modes[i].mode; | 97 return modes[i].mode; |
98 } | 98 } |
99 } | 99 } |
100 return FUDaeTextureWrapMode::UNKNOWN; | 100 return FUDaeTextureWrapMode::UNKNOWN; |
101 } | 101 } |
102 | 102 |
103 FCDEffectParameter* FindParameter(FCDMaterial* material, const char* name) { | 103 FCDEffectParameter* FindParameter(FCDMaterial* material, const char* name) { |
104 for (size_t i = 0; i < material->GetEffectParameterCount(); ++i) { | 104 for (size_t i = 0; i < material->GetEffectParameterCount(); ++i) { |
105 FCDEffectParameter* p = material->GetEffectParameter(i); | 105 FCDEffectParameter* p = material->GetEffectParameter(i); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 } | 569 } |
570 O3D_ERROR(service_locator_) << message; | 570 O3D_ERROR(service_locator_) << message; |
571 } else { | 571 } else { |
572 cgDestroyEffect(effect); | 572 cgDestroyEffect(effect); |
573 retval = true; | 573 retval = true; |
574 } | 574 } |
575 cgDestroyContext(context); | 575 cgDestroyContext(context); |
576 return retval; | 576 return retval; |
577 } | 577 } |
578 } // namespace o3d | 578 } // namespace o3d |
OLD | NEW |