From dda2fb3af3d7cc3124857d07615cde6143377cfa Mon Sep 17 00:00:00 2001 From: xemuth Date: Thu, 10 Sep 2020 18:58:29 +0000 Subject: [PATCH] SurfaceCtrl: Upddated Skybox object git-svn-id: svn://ultimatepp.org/upp/trunk@15012 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/SurfaceCtrl/Object3D.cpp | 2 +- bazaar/SurfaceCtrl/Object3D.h | 4 +++- bazaar/SurfaceCtrl/SurfaceCtrl.h | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bazaar/SurfaceCtrl/Object3D.cpp b/bazaar/SurfaceCtrl/Object3D.cpp index 7da17a8b2..f4d9d2e8d 100644 --- a/bazaar/SurfaceCtrl/Object3D.cpp +++ b/bazaar/SurfaceCtrl/Object3D.cpp @@ -787,7 +787,7 @@ Skybox& Skybox::Init(const Vector& 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(); diff --git a/bazaar/SurfaceCtrl/Object3D.h b/bazaar/SurfaceCtrl/Object3D.h index 9898d54a9..9b564cdb6 100644 --- a/bazaar/SurfaceCtrl/Object3D.h +++ b/bazaar/SurfaceCtrl/Object3D.h @@ -227,6 +227,7 @@ class Skybox { private: unsigned int ID = 0; GLuint VBO, VAO; + bool show = true; OpenGLProgram program; Skybox& Init(const Vector& 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(); diff --git a/bazaar/SurfaceCtrl/SurfaceCtrl.h b/bazaar/SurfaceCtrl/SurfaceCtrl.h index cf10ac535..43bbe3c7d 100644 --- a/bazaar/SurfaceCtrl/SurfaceCtrl.h +++ b/bazaar/SurfaceCtrl/SurfaceCtrl.h @@ -6,6 +6,11 @@ #include "MagicCamera.h" namespace Upp{ + +static const String GetSurfaceCtrlDirectory(){ + return GetFileDirectory(__FILE__); +} + class SurfaceCtrl : public GL{ private: bool loaded = false;