added iterator for light and geometry
This commit is contained in:
parent
cccacb047c
commit
aeaf4e08dd
@ -11,8 +11,8 @@
|
|||||||
#include "scenetree.h"
|
#include "scenetree.h"
|
||||||
|
|
||||||
Engine::Engine() :
|
Engine::Engine() :
|
||||||
m_input(NULL),
|
|
||||||
m_window(NULL),
|
m_window(NULL),
|
||||||
|
m_input(NULL),
|
||||||
m_world(NULL)
|
m_world(NULL)
|
||||||
{
|
{
|
||||||
m_clock = new sf::Clock();
|
m_clock = new sf::Clock();
|
||||||
|
@ -24,14 +24,12 @@ void SceneTree::setMainCamera(CameraNode *camera)
|
|||||||
|
|
||||||
SceneIterator<Light*>* SceneTree::getLights()
|
SceneIterator<Light*>* SceneTree::getLights()
|
||||||
{
|
{
|
||||||
// TODO
|
return new ArrayIterator<Light*>(m_lights);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneIterator<GeometryNode*>* SceneTree::getGeometry()
|
SceneIterator<GeometryNode*>* SceneTree::getGeometry()
|
||||||
{
|
{
|
||||||
// TODO
|
return new ArrayIterator<GeometryNode*>(m_geometries);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneTree::update()
|
void SceneTree::update()
|
||||||
@ -39,6 +37,27 @@ void SceneTree::update()
|
|||||||
m_root.update();
|
m_root.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneTree::addObject(ContainerNode *parent, SceneNode *node)
|
||||||
|
{
|
||||||
|
parent->addChild(node);
|
||||||
|
Light *light = node->getLight();
|
||||||
|
GeometryNode *geometrynode = node->getGeometryNode();
|
||||||
|
//TODO : Check for doublon in m_lights et m_geometries
|
||||||
|
if (light) m_lights.push_back(light);
|
||||||
|
if (geometrynode) m_geometries.push_back(geometrynode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SceneTree::removeObject(ContainerNode* parent,SceneNode *node){
|
||||||
|
parent->removeChild(node);
|
||||||
|
Light *l = node->getLight();
|
||||||
|
GeometryNode *g = node->getGeometryNode();
|
||||||
|
//TODO : remove light and geometrynode from m_lights et m_geometries
|
||||||
|
// debug following line
|
||||||
|
// m_lights.erase(std::remove(m_lights.begin(),m_lights.end(),&(*l)),m_lights.end());
|
||||||
|
// m_geometries.erase(std::remove(m_geometries.begin(),m_geometries.end(),g),m_geometries.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Container Node
|
// Container Node
|
||||||
|
|
||||||
void ContainerNode::update()
|
void ContainerNode::update()
|
||||||
|
@ -18,6 +18,8 @@ class SceneNode
|
|||||||
public:
|
public:
|
||||||
SceneNode* m_parent;
|
SceneNode* m_parent;
|
||||||
virtual void update() = 0;
|
virtual void update() = 0;
|
||||||
|
Light* getLight(){return nullptr;}
|
||||||
|
GeometryNode* getGeometryNode(){return nullptr;}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,16 +66,18 @@ public:
|
|||||||
void setSkybox(Texture* skybox) {m_skybox = skybox;}
|
void setSkybox(Texture* skybox) {m_skybox = skybox;}
|
||||||
|
|
||||||
void setMainCamera(CameraNode *camera);
|
void setMainCamera(CameraNode *camera);
|
||||||
void addRootObject(SceneNode *node) {m_root.addChild(node);}
|
|
||||||
|
|
||||||
|
ContainerNode getRootObject(){return m_root;}
|
||||||
|
void addObject(ContainerNode *parent, SceneNode *node);
|
||||||
|
void removeObject(ContainerNode* parent,SceneNode *node);
|
||||||
private:
|
private:
|
||||||
ContainerNode m_root;
|
ContainerNode m_root;
|
||||||
|
std::vector<Light*> m_lights;
|
||||||
|
std::vector<GeometryNode*> m_geometries;
|
||||||
Texture* m_skybox;
|
Texture* m_skybox;
|
||||||
SimplePipeline* m_simplepipeline;
|
SimplePipeline* m_simplepipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Additionnal Nodes :
|
// Additionnal Nodes :
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // SCENETREE_H
|
#endif // SCENETREE_H
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
const int SparrowShell::BUFFER_MAX_LENGTH = 50;
|
const unsigned int SparrowShell::BUFFER_MAX_LENGTH = 50;
|
||||||
const int SparrowShell::BUFFER_DISPLAYED_NUMBER = 10;
|
const unsigned int SparrowShell::BUFFER_DISPLAYED_NUMBER = 10;
|
||||||
const int SparrowShell::SCROLLBAR_PIXEL_WIDTH = 2;
|
const unsigned int SparrowShell::SCROLLBAR_PIXEL_WIDTH = 2;
|
||||||
|
|
||||||
SparrowShell::SparrowShell(sf::Window* window, Input* input): m_position(glm::ivec2(0,0)),m_window(window),m_input(input),m_scrollbar(this)
|
SparrowShell::SparrowShell(sf::Window* window, Input* input): m_window(window),m_input(input),m_position(glm::ivec2(0,0)),m_scrollbar(this)
|
||||||
{
|
{
|
||||||
//m_dimension = glm::ivec2();//
|
//m_dimension = glm::ivec2();//
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,9 @@ private:
|
|||||||
void update();
|
void update();
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int BUFFER_MAX_LENGTH;
|
static const unsigned int BUFFER_MAX_LENGTH;
|
||||||
static const int BUFFER_DISPLAYED_NUMBER;
|
static const unsigned int BUFFER_DISPLAYED_NUMBER;
|
||||||
static const int SCROLLBAR_PIXEL_WIDTH;
|
static const unsigned int SCROLLBAR_PIXEL_WIDTH;
|
||||||
|
|
||||||
std::list<std::string> m_buffer;
|
std::list<std::string> m_buffer;
|
||||||
sf::Window* m_window;
|
sf::Window* m_window;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user