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

Method draw

core/3d/Skybox.cpp:137–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void Skybox::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
138{
139 _customCommand.init(_globalZOrder);
140
141 renderer->addCommand(&_customCommand);
142
143 auto camera = Camera::getVisitingCamera();
144
145 Mat4 cameraModelMat = camera->getNodeToWorldTransform();
146 Mat4 projectionMat = camera->getProjectionMatrix();
147 // Ignore the translation
148 cameraModelMat.m[12] = cameraModelMat.m[13] = cameraModelMat.m[14] = 0;
149 // prescale the matrix to account for the camera fov
150 cameraModelMat.scale(1 / projectionMat.m[0], 1 / projectionMat.m[5], 1.0);
151
152 Vec4 color(_displayedColor.r / 255.f, _displayedColor.g / 255.f, _displayedColor.b / 255.f, 1.f);
153 _programState->setUniform(_uniformColorLoc, &color, sizeof(color));
154 _programState->setUniform(_uniformCameraRotLoc, cameraModelMat.m, sizeof(cameraModelMat.m));
155
156 AX_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
157}
158
159void Skybox::setTexture(TextureCube* texture)
160{

Callers

nothing calls this directly

Calls 5

scaleMethod · 0.80
initMethod · 0.45
addCommandMethod · 0.45
setUniformMethod · 0.45

Tested by

no test coverage detected