| 50 | } |
| 51 | |
| 52 | VertexAttribBinding* VertexAttribBinding::create(MeshIndexData* meshIndexData, Pass* pass, MeshCommand* command) |
| 53 | { |
| 54 | AXASSERT(meshIndexData && pass && pass->getProgramState(), "Invalid MeshIndexData and/or programState"); |
| 55 | |
| 56 | // Search for an existing vertex attribute binding that can be used. |
| 57 | VertexAttribBinding* b; |
| 58 | for (size_t i = 0, count = __vertexAttribBindingCache.size(); i < count; ++i) |
| 59 | { |
| 60 | b = __vertexAttribBindingCache[i]; |
| 61 | AX_ASSERT(b); |
| 62 | if (b->_meshIndexData == meshIndexData && b->_programState == pass->getProgramState()) |
| 63 | { |
| 64 | // Found a match! |
| 65 | return b; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | b = new VertexAttribBinding(); |
| 70 | if (b->init(meshIndexData, pass, command)) |
| 71 | { |
| 72 | b->autorelease(); |
| 73 | __vertexAttribBindingCache.emplace_back(b); |
| 74 | } |
| 75 | |
| 76 | return b; |
| 77 | } |
| 78 | |
| 79 | bool VertexAttribBinding::init(MeshIndexData* meshIndexData, Pass* pass, MeshCommand* command) |
| 80 | { |
nothing calls this directly
no test coverage detected