SurfaceCtrl: Upddated Skybox object

git-svn-id: svn://ultimatepp.org/upp/trunk@15012 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
xemuth 2020-09-10 18:58:29 +00:00
parent 6b8d449038
commit dda2fb3af3
3 changed files with 9 additions and 2 deletions

View file

@ -787,7 +787,7 @@ Skybox& Skybox::Init(const Vector<Image>& images){
Skybox& Skybox::Clear(){if(ID)glDeleteTextures(1,&ID); return *this;} //Clear the skybox
Skybox& Skybox::Draw(const glm::mat4& projectionMatrix,const glm::mat4& viewMatrix){ //Draw the skybox
if(ID > 0){
if(show && ID > 0){
glDepthFunc(GL_LEQUAL); // change depth function so depth test passes when values are equal to depth buffer's content
program.Bind();

View file

@ -227,6 +227,7 @@ class Skybox {
private:
unsigned int ID = 0;
GLuint VBO, VAO;
bool show = true;
OpenGLProgram program;
Skybox& Init(const Vector<Image>& images); //Load this vector of image as Skybox
@ -235,7 +236,8 @@ class Skybox {
Skybox(){}
~Skybox(){Clear();}
Skybox& Show(bool b = true){show = b; return *this;}
bool IsShown(){return show;}
Skybox& Init(const Image& skybox_right,const Image& skybox_left,const Image& skybox_top,const Image& skybox_bottom,const Image& skybox_front,const Image& skybox_back); //Load all image provided as skybox
Skybox& Clear();

View file

@ -6,6 +6,11 @@
#include "MagicCamera.h"
namespace Upp{
static const String GetSurfaceCtrlDirectory(){
return GetFileDirectory(__FILE__);
}
class SurfaceCtrl : public GL{
private:
bool loaded = false;