[svn] / nytr / trunk / libnytrengine / Scene.h Repository:
ViewVC logotype

View of /nytr/trunk/libnytrengine/Scene.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 678 - (download) (as text) (annotate)
Sat Jan 12 07:18:19 2008 UTC (2 years, 7 months ago) by kouhei
File size: 3256 byte(s)
added libnytrengine. buildable
#ifndef _nytr_Scene_h_
#define _nytr_Scene_h_

#include <vector>

#include "rndrcmn.h"

namespace nytr {

class GeomMgr;
class PolygonSoup;
class Camera;
class Light;
class Material;
class Texture;
class Environment;

namespace pbs
{
	class PBSMaterialDefList;
}

typedef std::vector<Light*>    VPLight;
typedef std::vector<Material*> VPMaterial;
typedef std::vector<Texture*>  VPTexture;

class Scene
{
public:
	//! C-tor
	Scene();

	//! D-tor
	~Scene();

	//! returns true if the scene is ready for rendering
	bool isReadyForRender();

	// ------ accessor methods ------
	//! bind a geometry manager
	/*!
		Just pass in new-ed pointer.
		Scene class will handle deletion.
		@pre
			A PolygonSoup must be binded before binding GeomMgr
		@note
			old GeomMgr will automatically deleted.
	 */
	void bindGeomMgr(GeomMgr* pGM);

	//! bind a camera
	/*!
		Just pass in new-ed pointer.
		Scene class will handle deletion.
		@note
			old Camera will automatically deleted.
	 */
	void bindCamera(Camera* pC);

	//! add a new light
	/*!
		Just pass in a new-ed pointer.
		Scene class will handle deletion.

		@return
			index of the added element
	 */
	unsigned int addLight(Light* pL);

	//! add a new material
	/*!
		Just pass in a new-ed pointer.
		Scene class will handle deletion.

		@return
			index of the added element
	 */
	unsigned int addMaterial(Material* pM);

	//! add a new light (with specified index)
	/*!
		Just pass in a new-ed pointer.
		Scene class will handle deletion

		@param nIndex
			index of new light
		@param pL
			a new-ed Light
	 */
	void addLight(unsigned int nIndex, Light* pL);

	//! add a new material
	/*!
		Just pass in a new-ed pointer.
		Scene class will handle deletion

		@param nIndex
			index of new-ed material
		@param pM
			a new-ed material
		@param bDeleteOld
			if true, delete old material if exists
	 */
	void addMaterial(unsigned int nIndex, Material* pM, bool bDeleteOld = true);

	//! add a new texture
	/*! 
		Just pass in a new-ed pointer.
		Scene class will handle deletion

		@param nIndex
			index of new-ed material
		@param pT
			a new-ed Texture
	 */
	void addTexture(unsigned int nIndex, Texture* pT);

	//! bind environment
	void bindEnvironment(Environment* pEnv);

	//! ready new pbs material definitions list
	void clearPBSDef();

	GeomMgr* getpGeomMgr()
	{
		return m_pgeommgr;
	}

	Camera* getpCamera()
	{
		return m_pcamera;
	}

	const VPLight& getvpLights()
	{
		return m_vplights;
	}
	
	const VPMaterial& getvpMaterials()
	{
		return m_vpmaterials;
	}

	const VPTexture& getvpTextures()
	{
		return m_vptextures;
	}

	Environment* getpEnvironment()
	{
		return m_penv;
	}

	pbs::PBSMaterialDefList* getpPBSMatDefList()
	{
		return m_pdeflist;
	}

private:
	//! geometry manager
	GeomMgr* m_pgeommgr;

	//! camera
	Camera* m_pcamera;

	//! lights
	VPLight m_vplights;

	//! materials
	VPMaterial m_vpmaterials;

	//! textures
	VPTexture m_vptextures;

	//! environment
	Environment* m_penv;

	//! pbs definitions
	pbs::PBSMaterialDefList* m_pdeflist;
};

} // end of namespace nytr

#endif // _nytr_Scene_h_

admin
ViewVC Help
Powered by ViewVC 1.0.5