From d06003ca38cb947a59e4997e1a4f257482ba7502 Mon Sep 17 00:00:00 2001 From: Peter Date: Tue, 18 Mar 2014 12:27:08 -0700 Subject: [PATCH] Changes required for skybox switching and spam control --HG-- branch : nfb --- KREngine/kraken/KRCamera.cpp | 7 +++++++ KREngine/kraken/KRCamera.h | 2 ++ KREngine/kraken/KREngine.mm | 4 ++-- KREngine/kraken/KRScene.cpp | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/KREngine/kraken/KRCamera.cpp b/KREngine/kraken/KRCamera.cpp index 7a4abf1..f729137 100644 --- a/KREngine/kraken/KRCamera.cpp +++ b/KREngine/kraken/KRCamera.cpp @@ -77,6 +77,13 @@ void KRCamera::loadXML(tinyxml2::XMLElement *e) KRNode::loadXML(e); } +void KRCamera::flushSkybox() +{ + KRTexture *tobedeleted = m_pSkyBoxTexture; + m_pSkyBoxTexture = NULL; +// delete tobedeleted; // FINDME - this delete is not thread safe .. it crashes the texture streamer +} + void KRCamera::renderFrame(float deltaTime, GLint renderBufferWidth, GLint renderBufferHeight) { // ----====---- Record timing information for measuring FPS ----====---- diff --git a/KREngine/kraken/KRCamera.h b/KREngine/kraken/KRCamera.h index 4978c00..d84b589 100644 --- a/KREngine/kraken/KRCamera.h +++ b/KREngine/kraken/KRCamera.h @@ -67,6 +67,8 @@ public: virtual void loadXML(tinyxml2::XMLElement *e); std::string getDebugText(); + + void flushSkybox(); // this will delete the skybox and cause the camera to reload a new skybox based on the settings private: void createBuffers(GLint renderBufferWidth, GLint renderBufferHeight); diff --git a/KREngine/kraken/KREngine.mm b/KREngine/kraken/KREngine.mm index 991fba0..b570d3e 100644 --- a/KREngine/kraken/KREngine.mm +++ b/KREngine/kraken/KREngine.mm @@ -237,14 +237,14 @@ void kraken::set_debug_text(const std::string &print_text) NSString *bundlePath = [[NSBundle mainBundle] pathForResource:bundleName ofType:@"bundle"]; NSBundle *bundle = [NSBundle bundleWithPath:bundlePath]; if(bundle == nil) { - NSLog(@"ERROR - Standard asset bundle could not be found."); + KRContext::Log(KRContext::LOG_LEVEL_ERROR, "%s", "ERROR - Standard asset bundle could not be found."); } else { NSEnumerator *bundleEnumerator = [[bundle pathsForResourcesOfType: nil inDirectory: nil] objectEnumerator]; NSString * p = nil; while (p = [bundleEnumerator nextObject]) { NSString *file_name = [p lastPathComponent]; if([file_name hasSuffix: @".vsh"] || [file_name hasSuffix: @".fsh"] || [file_name hasSuffix: @".krbundle"] ||[file_name hasPrefix:@"font."]) { - NSLog(@" %@\n", file_name); + KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, "%s", [file_name UTF8String]); [self loadResource:p]; } } diff --git a/KREngine/kraken/KRScene.cpp b/KREngine/kraken/KRScene.cpp index 816a4ca..f2ae199 100644 --- a/KREngine/kraken/KRScene.cpp +++ b/KREngine/kraken/KRScene.cpp @@ -126,8 +126,8 @@ void KRScene::render(KRCamera *pCamera, unordered_map &visibleBound std::vectordirectional_lights; std::vectorspot_lights; - pCamera->settings.setSkyBox(m_skyBoxName); // This is temporary until the camera is moved into the scene graph - +// pCamera->settings.setSkyBox(m_skyBoxName); // This is temporary until the camera is moved into the scene graph +// NOTE: the skybox is now selected in the CircaViewController std::set outerNodes = std::set(m_nodeTree.getOuterSceneNodes()); // HACK - Copying the std::set as it is potentially modified as KRNode's update their bounds during the iteration. This is very expensive and will be eliminated in the future.