API Cleanup - skybox property moved from KRScene to KRCamera
This commit is contained in:
@@ -70,6 +70,7 @@ std::string KRCamera::getElementName() {
|
||||
tinyxml2::XMLElement *KRCamera::saveXML( tinyxml2::XMLNode *parent)
|
||||
{
|
||||
tinyxml2::XMLElement *e = KRNode::saveXML(parent);
|
||||
e->SetAttribute("skybox", m_skyBox.c_str());
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -78,11 +79,20 @@ tinyxml2::XMLElement *KRCamera::saveXML( tinyxml2::XMLNode *parent)
|
||||
void KRCamera::loadXML(tinyxml2::XMLElement *e)
|
||||
{
|
||||
KRNode::loadXML(e);
|
||||
const char *szSkyBoxName = e->Attribute("skybox");
|
||||
m_skyBox = szSkyBoxName ? szSkyBoxName : "";
|
||||
}
|
||||
|
||||
void KRCamera::flushSkybox()
|
||||
void KRCamera::setSkyBox(const std::string &skyBox)
|
||||
{
|
||||
m_pSkyBoxTexture = NULL; // NOTE: the texture manager manages the loading and unloading of the skybox textures
|
||||
m_pSkyBoxTexture = NULL;
|
||||
m_skyBox = skyBox;
|
||||
|
||||
}
|
||||
|
||||
const std::string KRCamera::getSkyBox() const
|
||||
{
|
||||
return m_skyBox;
|
||||
}
|
||||
|
||||
void KRCamera::renderFrame(float deltaTime, GLint renderBufferWidth, GLint renderBufferHeight)
|
||||
@@ -301,8 +311,8 @@ void KRCamera::renderFrame(float deltaTime, GLint renderBufferWidth, GLint rende
|
||||
GLDEBUG(glDepthFunc(GL_LEQUAL));
|
||||
GLDEBUG(glDepthRangef(0.0, 1.0));
|
||||
|
||||
if(!m_pSkyBoxTexture && settings.m_skyBoxName.length()) {
|
||||
m_pSkyBoxTexture = getContext().getTextureManager()->getTextureCube(settings.m_skyBoxName.c_str());
|
||||
if(!m_pSkyBoxTexture && m_skyBox.length()) {
|
||||
m_pSkyBoxTexture = getContext().getTextureManager()->getTextureCube(m_skyBox.c_str());
|
||||
}
|
||||
|
||||
if(m_pSkyBoxTexture) {
|
||||
|
||||
@@ -75,6 +75,9 @@ public:
|
||||
void setFadeColor(const KRVector4 &fade_color);
|
||||
KRVector4 getFadeColor();
|
||||
|
||||
void setSkyBox(const std::string &skyBox);
|
||||
const std::string getSkyBox() const;
|
||||
|
||||
private:
|
||||
void createBuffers(GLint renderBufferWidth, GLint renderBufferHeight);
|
||||
|
||||
@@ -92,6 +95,7 @@ private:
|
||||
void destroyBuffers();
|
||||
|
||||
KRTexture *m_pSkyBoxTexture;
|
||||
std::string m_skyBox;
|
||||
KRViewport m_viewport;
|
||||
|
||||
float m_particlesAbsoluteTime;
|
||||
|
||||
@@ -57,11 +57,6 @@ KRRenderSettings::KRRenderSettings()
|
||||
|
||||
m_cShadowBuffers = 0;
|
||||
|
||||
|
||||
m_skyBoxName = "";
|
||||
|
||||
|
||||
|
||||
volumetric_environment_enable = false;
|
||||
volumetric_environment_downsample = 2;
|
||||
volumetric_environment_max_distance = 100.0f;
|
||||
@@ -148,8 +143,6 @@ KRRenderSettings& KRRenderSettings::operator=(const KRRenderSettings &s)
|
||||
dust_particle_enable=s.dust_particle_enable;
|
||||
perspective_nearz=s.perspective_nearz;
|
||||
perspective_farz=s.perspective_farz;
|
||||
|
||||
m_skyBoxName=s.m_skyBoxName;
|
||||
debug_display = s.debug_display;
|
||||
|
||||
m_lodBias = s.m_lodBias;
|
||||
@@ -168,10 +161,6 @@ void KRRenderSettings::setViewportSize(const KRVector2 &size) {
|
||||
m_viewportSize = size;
|
||||
}
|
||||
|
||||
void KRRenderSettings::setSkyBox(const std::string &skyBoxName) {
|
||||
m_skyBoxName = skyBoxName;
|
||||
}
|
||||
|
||||
float KRRenderSettings::getPerspectiveNearZ()
|
||||
{
|
||||
return perspective_nearz;
|
||||
|
||||
@@ -21,7 +21,6 @@ public:
|
||||
|
||||
const KRVector2 &getViewportSize();
|
||||
void setViewportSize(const KRVector2 &size);
|
||||
void setSkyBox(const std::string &skyBoxName);
|
||||
|
||||
float getPerspectiveNearZ();
|
||||
float getPerspectiveFarZ();
|
||||
@@ -85,8 +84,6 @@ public:
|
||||
float perspective_nearz;
|
||||
float perspective_farz;
|
||||
|
||||
std::string m_skyBoxName;
|
||||
|
||||
enum debug_display_type{
|
||||
KRENGINE_DEBUG_DISPLAY_NONE = 0,
|
||||
KRENGINE_DEBUG_DISPLAY_TIME,
|
||||
|
||||
@@ -50,8 +50,6 @@ KRScene::KRScene(KRContext &context, std::string name) : KRResource(context, nam
|
||||
m_pFirstLight = NULL;
|
||||
m_pRootNode = new KRNode(*this, "scene_root");
|
||||
notify_sceneGraphCreate(m_pRootNode);
|
||||
|
||||
m_skyBoxName = name + "_skybox";
|
||||
}
|
||||
|
||||
KRScene::~KRScene() {
|
||||
@@ -126,9 +124,6 @@ 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
|
||||
// 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.
|
||||
|
||||
// Get lights from outer nodes (directional lights, which have no bounds)
|
||||
@@ -409,7 +404,6 @@ bool KRScene::save(KRDataBlock &data) {
|
||||
tinyxml2::XMLElement *scene_node = doc.NewElement( "scene" );
|
||||
doc.InsertEndChild(scene_node);
|
||||
m_pRootNode->saveXML(scene_node);
|
||||
scene_node->SetAttribute("skybox", m_skyBoxName.c_str()); // This is temporary until the camera is moved into the scene graph
|
||||
|
||||
tinyxml2::XMLPrinter p;
|
||||
doc.Print(&p);
|
||||
@@ -427,8 +421,6 @@ KRScene *KRScene::Load(KRContext &context, const std::string &name, KRDataBlock
|
||||
KRScene *new_scene = new KRScene(context, name);
|
||||
|
||||
tinyxml2::XMLElement *scene_element = doc.RootElement();
|
||||
const char *szSkyBoxName = scene_element->Attribute("skybox");
|
||||
new_scene->m_skyBoxName = szSkyBoxName ? szSkyBoxName : ""; // This is temporary until the camera is moved into the scene graph
|
||||
|
||||
KRNode *n = KRNode::LoadXML(*new_scene, scene_element->FirstChildElement());
|
||||
if(n) {
|
||||
|
||||
@@ -110,8 +110,6 @@ private:
|
||||
|
||||
KROctree m_nodeTree;
|
||||
|
||||
std::string m_skyBoxName;
|
||||
|
||||
public:
|
||||
|
||||
template <class T> T *find()
|
||||
|
||||
Reference in New Issue
Block a user