没有合适的资源?快使用搜索试试~ 我知道了~
Ogre场景管理器SceneManager类
3星 · 超过75%的资源 需积分: 13 21 下载量 117 浏览量
2010-12-23
14:22:20
上传
评论
收藏 224KB DOC 举报
温馨提示
试读
38页
学习ogre非常好的资料,本人从网上搜集下来,特贡献出来供大家分享,此文章对我的学习帮助很大,希望对大家有所帮助.
资源推荐
资源详情
资源评论
Ogre 场景管理器 SceneManager 类 收藏
SceneManager 类
场景管理类,是场景管理的核心类。
SceneManager 类 内 部 保 存 std::map 类 型 的 CameraList 、 LightList 、 EntityList 和
SceneNodeList ,并 提 供各 种 方 法 对 它们 进 行 管 理 和 维 护 。 SceneNode 自 身 的设 计 使
SceneNodeList 实 际 上 是 一 个 树 状 结 构 。 在 每 个 SceneNode 中 引 用
CameraList 、 LightList 、 EntityList 中 的 元 素 实 现 了 场 景 元 素 在 SceneNode 上 的 挂 接 。
SceneManager 类还直接保存场景节点树的根节点指针以提供该树的访问入口。
重要函数
缺省构造函数
SceneManager();
缺省析构函数
virtual ~SceneManager();
摄像机相关函数
virtual Camera* createCamera(const String& name);
virtual Camera* getCamera(const String& name);
virtual void removeCamera(Camera *cam);
virtual void removeCamera(const String& name);
virtual void removeAllCameras(void);
光相关函数
virtual Light* createLight(const String& name);
virtual Light* getLight(const String& name);
virtual void removeLight(const String& name);
virtual void removeLight(Light* light);
virtual void removeAllLights(void);
材质相关函数
virtual Material* createMaterial(const String& name);
返回一个指向缺省材质设定的指针,用这个指针可以改变材质的设定
缺省设定如下:
- ambient = ColourValue::White
- diffuse = ColourValue::White
- specular = ColourValue::Black
- emmissive = ColourValue::Black
- shininess = 0
- No texture layers (& hence no textures)
- SourceBlendFactor = SBF_ONE
- DestBlendFactor = SBF_ZERO (no blend, replace with new
colour)
- Depth buffer checking on
- Depth buffer writing on
- Depth buffer comparison function = CMPF_LESS_EQUAL
- Culling mode = CULL_CLOCKWISE
- Ambient lighting = ColourValue(0.5, 0.5, 0.5) (mid-grey)
- Dynamic lighting enabled
- Gourad shading mode
- Bilinear texture filtering
virtual Material* getDefaultMaterialSettings(void);
virtual void addMaterial(const Material& mat);
virtual Material* getMaterial(const String& name);
virtual Material* getMaterial(int handle);
场景节点相关函数
virtual SceneNode* createSceneNode(void);
virtual SceneNode* createSceneNode(const String& name);
virtual void destroySceneNode(const String& name);
取得根节点,在整个场景中只有一个根节点
virtual SceneNode* getRootSceneNode(void) const;
virtual SceneNode* getSceneNode(const String& name) const;
用 Mesh 创建一个实体
virtual Entity* createEntity(const String& entityName, const String& meshName);
用预先提供的 shape 创建实体
PrefabType 是一个枚举,提供预制的 shape,不需要模型
enum PrefabType {
PT_PLANE
};
virtual Entity* createEntity(const String& entityName, PrefabType ptype);
virtual Entity* getEntity(const String& name);
销毁实体,注意实体必须没有被 SceneNode 所 attach,如果你不确定是否还有实体被
attach,使用 SceneManager::clearScene()
virtual void removeEntity(Entity* ent);
virtual void removeEntity(const String& name);
virtual void removeAllEntities(void);
清空场景,包括 SceneNodes,Cameras,Entities,Lights
virtual void clearScene(void);
设定环境光,缺省的环境光是 ColourValue::Black
void setAmbientLight(ColourValue colour);
ColourValue getAmbientLight(void);
设定世界坐标系
virtual void setWorldGeometry(const String& filename);
从 SceneManager 处 取 得 一 个 推 荐 的 viewpoint , 通 常 这 个 方 法 返 回 原 点 , 除 非 通 过
SceneManager::setWorldGeometry 设定了坐标系或者世界坐标系推荐了起始点。如果有多于
一个的推荐点,将返回第一个,如果参数 random 为真,将随机的返回一个。
virtual ViewPoint getSuggestedViewpoint(bool random = false);
为 SceneManager 设定一个特殊实现的选项
virtual bool setOption( const String& strKey, const void* pValue ) { return false; }
virtual bool getOption( const String& strKey, void* pDestValue ) { return false; }
确认 SceneManager 是否有一个特殊实现的选项
virtual bool hasOption( const String& strKey ) { return false; }
virtual bool getOptionValues( const String& strKey, std::list<SDDataChunk>& refValueList )
{ return false; }
virtual bool getOptionKeys( std::list<String>& refKeys ) { return false; }
Enables / Disables 一个天空面
virtual void setSkyPlane(
bool enable,
const Plane& plane,
const String& materialName,
Real scale = 1000,
Real tiling = 10, bool drawFirst = true, Real bow = 0 );
Enables / Disables 一个天空盒
virtual void setSkyBox(
bool enable,
const String& materialName,
Real distance = 5000,
bool drawFirst = true,
const Quaternion& orientation = Quaternion::IDENTITY );
剩余37页未读,继续阅读
资源评论
- c2400117422013-05-18有很多重复的
BAYI132337
- 粉丝: 35
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功