0% found this document useful (0 votes)
11 views2 pages

2.3 The SceneManager Object

Uploaded by

li li
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

2.3 The SceneManager Object

Uploaded by

li li
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

2.

3 The SceneManager object


Apart from the Root object, this is probably the most critical part of the system from the
application's point of view. Certainly it will be the object which is most used by the application.
The SceneManager is in charge of the contents of the scene which is to be rendered by the engine.
It is responsible for organising the contents using whatever technique it deems best, for creating
and managing all the cameras, movable objects (entities), lights and materials (surface properties
of objects), and for managing the 'world geometry' which is the sprawling static geometry usually
used to represent the immovable parts of a scene.

抛开 Root 对象,从应用程序的角度来看 SceneManager 对象可能是系统中最重要的部分了。


当然它也是应用程序中最有使用价值的对象了。SceneManager 管理由引擎渲染的场景中的
内容。SceneManager 必须要使用最好的技术来组织管理这些内容,创建和管理 cameras、有
移动能力的对象(实体)、光和材质(对象的表面属性),以及管理通常用于代表场景中
不可移动部分的 the sprawling static geometry 的世界几何体。

It is to the SceneManager that you go when you want to create a camera for the scene. It's also
where you go to retrieve a material which is used by an object, or to remove a light from the
scene. There is no need for your application to keep lists of objects, the SceneManager keeps a
named set of all of the scene objects for you to access, should you need them. Look in the main
documentation under the getCamera, getMaterial, getLight etc methods.

当你要在场景中创建一个 camera 时,要用 SceneManager。当你检索一个对象的哪个材质被


用到或是在场景中删除一个 light 时也要用到 SceneManager。在你的应用程序中没有必要保
留一个你需要的对象链表,因为 SceneManager 会为你保存一个所有你要访问的场景对象的
命名集合。可以在主文档中查看下面的 getCamera, getMaterial, getLight 等方法。

The SceneManager also sends the scene to the RenderSystem object when it is time to render the
scene. You never have to call the SceneManager::_renderScene method directly though - it is
called automatically whenever a rendering target is asked to update.

当需要渲染场景时,SceneManager 会发送场景给 RenderSystem 对象。无论当渲染对象什么


时候要求更新,你都不需要直接调用 SceneManager::_renderScene,因为 SceneManager 会自
动调用。

So most of your interaction with the SceneManager is during scene setup. You're likely to call a
great number of methods (perhaps driven by some input file containing the scene data) in order to
set up your scene. You can also modify the contents of the scene dynamically during the rendering
cycle if you create your own FrameListener object (see later).

可能你对 SceneManager 最感兴趣的是在场景建立的时候。你可能会调用大量的方法(也许


来自一些包含场景数据的输入文件)来建立你的场景。如果你创建了 FrameListener 对象,
那么你可以在渲染循环中动态修改场景中的内容。
Because different scene types require very different algorithmic approaches to deciding which
objects get sent to the RenderSystem in order to attain good rendering performance, the
SceneManager class is designed to be subclassed for different scene types. The default
SceneManager object will render a scene, but it does little or no scene organisation and you should
not expect the results to be high performance in the case of large scenes. The intention is that
specialisations will be created for each type of scene such that under the surface the subclass will
optimise the scene organisation for best performance given assumptions which can be made for
that scene type. An example is the BspSceneManager which optimises rendering for large indoor
levels based on a Binary Space Partition (BSP) tree.

为了获得比较好的渲染性能,不同的场景类型需要不同的算法来决定哪个对象要送给
RenderSystem。SceneManager 类被设计为不同场景类型的子集。缺省的 SceneManager 对象将
会渲染一个场景,但是它会做很少或是不做场景组织,因此你不能期望在大场景的情况下
有好的性能表现。这样的目的是针对某种类型的场景特化将会起作用,例如派生自
SceneManager 的子类将会通过假定要产生的某种场景类型来对场景组织进行优化,以获得
最优的性能。一个例子是 BspSceneManager 用于优化渲染基于二叉空间划分树的大型室内场
景。

The application using OGRE does not have to know which subclasses are available. The
application simply calls Root::getSceneManager(..) passing as a parameter one of a number of
scene types (e.g. ST_GENERIC, ST_INTERIOR etc). OGRE will automatically use the best
SceneManager subclass available for that scene type, or default to the basic SceneManager if a
specialist one is not available. This allows the developers of OGRE to add new scene
specialisations later and thus optimise previously unoptimised scene types without the user
applications having to change any code.

使 用 OGRE 的 应 用 程 序 不 需 要 知 道 哪 个 子 类 会 被 使 用 。 应 用 程 序 简 单 的 调 用
Root::getSceneManager(..)方法通过场景类型(例如,ST_GENERIC, ST_INTERIOR 等)参
数获得场景管理者。OGRE 将会自动使用针对那种场景类型最好的 SceneManager 子类或是
如果指定的 SceneManager 不存在则缺省的基本 SceneManager 将被应用。这样就可以让用户
的应用程序不需要改变任何代码的情况下,OGRE 的开发者以后添加特定的 SceneManager
来对没有优化的场景类型进行优化。

You might also like