| 135 | } |
| 136 | |
| 137 | void 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 | |
| 159 | void Skybox::setTexture(TextureCube* texture) |
| 160 | { |
nothing calls this directly
no test coverage detected