MCPcopy Create free account
hub / github.com/axmolengine/axmol / create

Method create

core/3d/VertexAttribBinding.cpp:52–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52VertexAttribBinding* 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
79bool VertexAttribBinding::init(MeshIndexData* meshIndexData, Pass* pass, MeshCommand* command)
80{

Callers

nothing calls this directly

Calls 5

autoreleaseMethod · 0.80
getProgramStateMethod · 0.45
sizeMethod · 0.45
initMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected