Page MenuHomePhorge

Scene.h
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None
#ifndef _ECHOSCENE_H_
#define _ECHOSCENE_H_
#include <echo/Kernel/TaskGroup.h>
#include <echo/Graphics/Renderable.h>
#include <echo/Graphics/SceneRenderable.h>
#include <map>
#include <vector>
namespace Echo
{
class Camera;
class Light;
class SceneRenderable;
class RenderTarget;
class Matrix4;
class Ray;
class Scene : public TaskGroup, public SceneRenderableVisitor
{
public:
Scene();
Scene(const std::string& name);
virtual ~Scene();
shared_ptr<Camera> CreateCamera(); //Creates a camera for the Scene
shared_ptr<Camera> CreateCamera(const std::string& name); //Creates a camera for the Scene
shared_ptr<Camera> GetCamera(const std::string& name); //Gets a camera for the Scene
shared_ptr<Light> CreateLight(); //Creates a light for the Scene
shared_ptr<Light> CreateLight(const std::string& name); //Creates a light for the Scene
shared_ptr<Light> GetLight(const std::string& name); //Gets a light for the Scene
void AddRenderable(shared_ptr< SceneRenderable > sceneRenderable, bool pickable = true);
void RemoveRenderable(shared_ptr<SceneRenderable> sceneRenderable);
shared_ptr< SceneRenderable > Pick(Camera& camera, Ray& ray);
//! Builds the render queue.
void BuildRenderQueue(const Camera& camera);
void SceneRenderableVisit(SceneRenderable& renderable) override;
/**
* Override from SceneRenderableVisitor.
* @return If performing a Render operation, the current camera used for rendering the scene, otherwise null.
*/
const Camera* GetCurrentCamera() override;
void Render(RenderTarget& renderTarget, const Camera& camera);
void SetSkyBox(shared_ptr< SceneRenderable > skyBox);
protected:
void ApplyLights(RenderTarget& renderTarget, const Camera& camera);
typedef std::pair< f32, SceneRenderable* > DistanceRenderablePair;
typedef std::pair< const std::string, shared_ptr< Light > > NamedLightPair;
static bool DistanceCompare(const DistanceRenderablePair& a, const DistanceRenderablePair& b);
std::map< std::string, shared_ptr<Camera> > mCameras;
std::map< std::string, shared_ptr<Light> > mLights;
std::list< shared_ptr< SceneRenderable > > mRenderables;
std::list< shared_ptr< SceneRenderable > > mPickableRenderables;
std::vector< DistanceRenderablePair > mRenderQueue;
shared_ptr< SceneRenderable > mSkyBox;
const Camera* mCurrentCamera; /// Camera set for operations over multiple methods.
};
}
#endif

File Metadata

Mime Type
text/x-c++
Expires
Thu, Dec 5, 2:04 AM (7 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
61647
Default Alt Text
Scene.h (2 KB)

Event Timeline