Changes required for skybox switching and spam control

--HG--
branch : nfb
This commit is contained in:
Peter
2014-03-18 12:27:08 -07:00
parent 0d7bbfb2d7
commit d06003ca38
4 changed files with 13 additions and 4 deletions

View File

@@ -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 ----====----

View File

@@ -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);

View File

@@ -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];
}
}

View File

@@ -126,8 +126,8 @@ void KRScene::render(KRCamera *pCamera, unordered_map<KRAABB, int> &visibleBound
std::vector<KRDirectionalLight *>directional_lights;
std::vector<KRSpotLight *>spot_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<KRNode *> outerNodes = std::set<KRNode *>(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.