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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 ElementArray elements; | 71 ElementArray elements; |
72 elements.reserve(elements_.size()); | 72 elements.reserve(elements_.size()); |
73 std::copy(elements_.begin(), | 73 std::copy(elements_.begin(), |
74 elements_.end(), | 74 elements_.end(), |
75 std::back_inserter(elements)); | 75 std::back_inserter(elements)); |
76 return elements; | 76 return elements; |
77 } | 77 } |
78 | 78 |
79 void Shape::SetElements(const ElementArray& elements) { | 79 void Shape::SetElements(const ElementArray& elements) { |
80 elements_.resize(elements.size()); | 80 elements_.resize(elements.size()); |
81 for (int i = 0; i != elements.size(); ++i) { | 81 for (unsigned int i = 0; i != elements.size(); ++i) { |
82 elements_[i] = Element::Ref(elements[i]); | 82 elements_[i] = Element::Ref(elements[i]); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 namespace { | 86 namespace { |
87 class FindByMaterial { | 87 class FindByMaterial { |
88 public: | 88 public: |
89 explicit FindByMaterial(Material* material) : material_(material) { } | 89 explicit FindByMaterial(Material* material) : material_(material) { } |
90 | 90 |
91 bool operator() (const DrawElement* draw_element) { | 91 bool operator() (const DrawElement* draw_element) { |
(...skipping 11 matching lines...) Expand all Loading... |
103 const DrawElementRefArray& draw_elements = element->GetDrawElementRefs(); | 103 const DrawElementRefArray& draw_elements = element->GetDrawElementRefs(); |
104 if (std::find_if(draw_elements.begin(), | 104 if (std::find_if(draw_elements.begin(), |
105 draw_elements.end(), | 105 draw_elements.end(), |
106 FindByMaterial(material)) == draw_elements.end()) { | 106 FindByMaterial(material)) == draw_elements.end()) { |
107 elements_[pp]->CreateDrawElement(pack, material); | 107 elements_[pp]->CreateDrawElement(pack, material); |
108 } | 108 } |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 } // namespace o3d | 112 } // namespace o3d |
OLD | NEW |