们需要把 boost 文件夹添加入头文件路径 。 否则的话 , 我们用 Ogre 3D 引擎什么程序也编译
不了 。 如果需要的话 , Ogre 3D 可以直接从源码编译 , 那样的话可以取消线程支持也就取消
掉了 boost 文件夹的需求 。 当使用 boost 的时候 , 编译器需要链接到 boost 的库文件 。 所以我
们添加了 boost 的库文件文件夹到 lib path (见第 7 步 ) 。 】
In step 10, we added PathToYourOgreSDK\lib\debug to our library path. As said before, Ogre 3D
comes with debug and release libraries. With this line we decided to use the debug libraries
because they offer better debug support if something happens to go wrong. When we want to use
the release versions, we have to change the lib\debug to \lib\release. The same is true for steps 11
und 12. There we added OgreMain_d.lib and OIS_d.lib to our linked libraries. When we want to
use the release version, we need to add OgreMain.lib and OIS.lib. OgreMain.lib, and
OgreMain_d.lib contains both the interface information about Ogre 3D and tells our application to
load OgreMain.dll or OgreMain_d.dll. Note that OIS.lib or OIS_d.lib is the same for the input
system — they load OIS_d.dll or OIS.dll. So we link Ogre 3D and OIS dynamically, enabling us
to switch the DLL without recompiling our application, as long as the interface of the libraries
doesn't change and the application and the DLL are using the same runtime library versions. This
also implies that our application always needs to load the DLLs, so we have to make sure it can
find it. This is one of the reasons we set the working directory in step 14. Another reason will be
made clear in the next section.
【 在第 10 步中,我们把 “ 你的 Ogre SDK 路径 \ lib\debug\ ” 添加到了库文件路径之中,像
前面所说的那样 , Ogre 3D 有 debug 库和 release 库 。 在这里我们使用 debug 库 , 因为如果出
现错误, debug 库提供调试支持。当想使用 release 库的时候,要把 “ lib\debug ” 改为
“ \lib\release ” 。 对于第 11 步和第 12 步也是如此 。 在那两步中我们添加了 OgreMain_d.lib 和
OIS_d.lib 作为需要链接的库文件。当想使用 release 版本的时候,要改成 OgreMain.lib 和
OIS.lib 。 OgreMain.lib 和 OgreMain_d.lib 文件包含着 Ogre 3D 程序的接口信息和怎么样加 载
OgreMain.dll 或 OgreMain_d.dll 。注意 OIS.lib 或 OIS_d.lib 对于输入系统也是如此 —— 他们
加 载 OIS_d.dl l 或 OIS.dll 。 所以我们动态的链 接 Ogre 3 D 和 OIS , 这样使得我们可以切 换 DL L
而不需要重新编译程序,只要接口和库没有变化而且 DLL 使用相同的运行库版本。这也就
要求程序时刻需要加载 DLL ,所以要确保程序能够找到那些 DLL 。这也就是我们为啥要在
第 14 步设置工作空间。还有一个原因会在后面的部分澄清。 】
ExampleApplication
ExampleApplication
ExampleApplication
ExampleApplication
【 ExampleApplication ( Ogre SDK 中的一个类 ) 】
We created a new class, Example1, which inherits from ExampleApplication. ExampleApplication
is a class that comes with the Ogre 3D SDK and is intended to make learning Ogre 3D easier by
offering an additional abstraction layer above Ogre 3D. ExampleApplication starts Ogre for us,
loads different models we can use, and implements a simple camera so we can navigate through
our scene. To use ExampleApplication, we just needed to inherit from it and override the virtual
function createScene(). We will use the ExampleApplication class for now to save us from a lot of
work, until we have a good understanding of Ogre 3D. Later, we will replace
ExamplesApplication piece-by-piece with our own code.
【 我们创建了一个新的类, Example1 ,它继承于 ExampleApplication 。 ExampleApplicatio n