| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return float_and_dword.dword_value; | 82 return float_and_dword.dword_value; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Clamps a float to [0 .. 1] and maps it to [0 .. 255] | 85 // Clamps a float to [0 .. 1] and maps it to [0 .. 255] |
| 86 inline unsigned int FloatToClampedByte(float value) { | 86 inline unsigned int FloatToClampedByte(float value) { |
| 87 value = std::min(1.f, std::max(0.f, value)); | 87 value = std::min(1.f, std::max(0.f, value)); |
| 88 return static_cast<unsigned int>(value * 255); | 88 return static_cast<unsigned int>(value * 255); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Converts a RGBA color into a D3DCOLOR | 91 // Converts a RGBA color into a D3DCOLOR |
| 92 inline D3DCOLOR RGBAToD3DCOLOR(const RGBA &color) { | 92 inline D3DCOLOR RGBAToD3DCOLOR(const o3d::RGBA &color) { |
| 93 return D3DCOLOR_RGBA(FloatToClampedByte(color.red), | 93 return D3DCOLOR_RGBA(FloatToClampedByte(color.red), |
| 94 FloatToClampedByte(color.green), | 94 FloatToClampedByte(color.green), |
| 95 FloatToClampedByte(color.blue), | 95 FloatToClampedByte(color.blue), |
| 96 FloatToClampedByte(color.alpha)); | 96 FloatToClampedByte(color.alpha)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 static bool D3DSemanticToCBSemantic( | 99 static bool D3DSemanticToCBSemantic( |
| 100 D3DDECLUSAGE semantic, | 100 D3DDECLUSAGE semantic, |
| 101 unsigned int semantic_index, | 101 unsigned int semantic_index, |
| 102 vertex_struct::Semantic *out_semantic, | 102 vertex_struct::Semantic *out_semantic, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 *out_semantic_index = semantic_index; | 138 *out_semantic_index = semantic_index; |
| 139 return true; | 139 return true; |
| 140 default: | 140 default: |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 } // namespace command_buffer | 144 } // namespace command_buffer |
| 145 } // namespace o3d | 145 } // namespace o3d |
| 146 | 146 |
| 147 #endif // O3D_COMMAND_BUFFER_SERVICE_WIN_D3D9_D3D9_UTILS_H_ | 147 #endif // O3D_COMMAND_BUFFER_SERVICE_WIN_D3D9_D3D9_UTILS_H_ |
| OLD | NEW |