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

Method draw

tests/lua-tests/Source/lua_test_bindings.cpp:197–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void DrawNode3D::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
198{
199 _customCommand.init(_globalZOrder);
200 // update mvp matrix
201 auto& matrixP = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
202 auto mvp = matrixP * transform;
203 _programState->setUniform(_locMVPMatrix, mvp.m, sizeof(mvp.m));
204
205 if (_customCommand.getVertexCapacity() < _buffer.size())
206 {
207 auto s = _buffer.size();
208 _customCommand.createVertexBuffer(sizeof(V3F_C4B), s + s / 2, CustomCommand::BufferUsage::DYNAMIC);
209 }
210
211 if (_dirty && !_buffer.empty())
212 {
213 _customCommand.updateVertexBuffer(_buffer.data(), (unsigned int)(_buffer.size() * sizeof(_buffer[0])));
214 _customCommand.setVertexDrawInfo(0, _buffer.size());
215 _dirty = false;
216 }
217
218 setBlendFunc(_blendFunc);
219
220 if (!_buffer.empty())
221 {
222 renderer->addCommand(&_customCommand);
223 }
224}
225
226void DrawNode3D::drawLine(const Vec3& from, const Vec3& to, const Color4F& color)
227{

Callers

nothing calls this directly

Calls 10

getInstanceFunction · 0.85
createVertexBufferMethod · 0.80
setBlendFuncFunction · 0.50
initMethod · 0.45
setUniformMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
updateVertexBufferMethod · 0.45
dataMethod · 0.45
addCommandMethod · 0.45

Tested by

no test coverage detected