skybox: added moon and stars

This commit is contained in:
MihailRis
2024-01-26 02:49:42 +03:00
parent b42a517cc6
commit a4a5aef422
22 changed files with 258 additions and 52 deletions
+23 -3
View File
@@ -11,6 +11,9 @@ GfxContext::GfxContext(const GfxContext* parent, Viewport& viewport, Batch2D* g2
GfxContext::~GfxContext() {
if (parent == nullptr)
return;
if (depthMask_ != parent->depthMask_) {
glDepthMask(parent->depthMask_);
}
if (depthTest_ != parent->depthTest_) {
if (depthTest_) glDisable(GL_DEPTH_TEST);
else glEnable(GL_DEPTH_TEST);
@@ -19,6 +22,9 @@ GfxContext::~GfxContext() {
if (cullFace_) glDisable(GL_CULL_FACE);
else glEnable(GL_CULL_FACE);
}
if (blendMode_ != parent->blendMode_) {
Window::setBlendMode(parent->blendMode_);
}
}
const Viewport& GfxContext::getViewport() const {
@@ -36,11 +42,18 @@ GfxContext GfxContext::sub() const {
return ctx;
}
void GfxContext::depthMask(bool flag) {
if (depthMask_ == flag)
return;
depthMask_ = flag;
glDepthMask(GL_FALSE + flag);
}
void GfxContext::depthTest(bool flag) {
if (depthTest_ == flag)
return;
depthTest_ = flag;
if (depthTest_) {
if (flag) {
glEnable(GL_DEPTH_TEST);
} else {
glDisable(GL_DEPTH_TEST);
@@ -51,9 +64,16 @@ void GfxContext::cullFace(bool flag) {
if (cullFace_ == flag)
return;
cullFace_ = flag;
if (cullFace_) {
if (flag) {
glEnable(GL_CULL_FACE);
} else {
glDisable(GL_CULL_FACE);
}
}
}
void GfxContext::blendMode(blendmode mode) {
if (blendMode_ == mode)
return;
blendMode_ = mode;
Window::setBlendMode(mode);
}