翻译betajaen的NxOgre简短教程
Betajaen’s shortguide to NxOgre
Betajaen的NxOgre简短教程——宝爷译
Alpha and Omega — A bit of everything
整个世界中的所有东西
World就像我们的宇宙,漫无边际而且只有唯一的一个。我们在world里面的东西叫做Scene,它们是有大小的。Scene和Scene之间不会有交集
The World is like our universe, it’s infinite in size and there can be only one of them.Inside the world we have things called a Scene. They could be considered like dimensions in our world, we inhabit one dimension and ghosts and monsters inhabit another. Things in one scene cannot interact with things with another.
在场景中,所有的物体都有精确单元大小的RigidBodies,就像一支铅笔,一具尸体,一匹马,一个油桶
There are four types of RigidBodies; An Actor, aKinematicActor,SceneGeometry and a Volume, each different type is based on the method of movement it has and how it interacts with each other. But for now; let’s just call treat them as one.
The World and a fitting Description of it — The infamous ’Verse
World和对它的恰当描述——无名的诗
上帝说World* mWorld = World::createWorld(),World在NxOgre中属于最顶层类了,它负责处理所有的场景Scenes,并间接地做一些其他工作,是一个单例类Singletons,通常,第一个创建的就是World,而最后一个销毁的也是它。当我们创建一个World的时候,我们一般会给他一个Description对象,用来描述一些信息,例如它是哪一种冰淇淋,它喜欢什么颜色,像这些东西。我们把Description传递给World以及其他的一些类用来描述相关信息,例如Scene,Actor等。每种类都有相应的Description对象
The World is the top-most class of NxOgre; it is responsible for handling of all the Scenes and indirectly working with it’s friends; theSingletons. World is normally the first to be created, and most always the last destroyed.
WorldDescriptiondescription;
description.mNoHardware =
true;
World* mWorld =
World::createWorld(description);
Father Time — Controlling time with your time machine
时光老人——用你的时间机器来控制时间
TimeController 负责时间的控制,它控制事件的发生,它控制事件的起因和结果,他就是你!因为时间是一个非常奇怪的东西(如果我们没有它可能会更好,个人观点),所有东西都需要在一个时间维度之中,他们需要继承TimeListener对象
TimeController is the second one in charge, he makes things happen, he makes the whole cause and event thing go, he’s the man.
TimeController* mTimeController = mWorld->getTimeController();
Because Time is a strange thing (and personally I think we would do better without it), anything that needs to be in the time dimension must be a TimeListener. We can do that by inheriting from the TimeListener class;
classmyClock :
publicTimeListener
{
bool
advance(
constTimeStep
& step,
constEnums::Priority&) {
std
::
cout<<
"My word! "<< step.mActual <<
" seconds have passed.\n";
}
};
在BloodyMess中,很多对象都是TimeListener,例如Scene,一些单例,Renderables,甚至World!通过TimeController的advance函数来施展我们的时间魔法,让时间前进。
Lot’s of things in Bloody Mess are TimeListeners; Scenes, some Singletons, Renderables, even the World – although you ask him about it, he’ll deny everything.
With our now time controlling superpowers we can exercise our will to advance time forward as much as we want, as many times as we like!
TimeController* mr_timey_wimey =
TimeController::getSingleton();
mr_timey_wimey->advance(
100.0f);
With the universe advanced 100 seconds into the future and we did not age a day, our quest for being an evil mastermind is coming to an end.
The Singletons — Download all six seasons for $29.95!
单例用29.95美元来下载六个季节?
Singletons 是NxOgre的手下,是好人,不是坏人。这里总共有5个Singletons,尽管第五个家伙没有在下面这张图片中显示出来。他们是ErrorStream,TimeController,ResourceSystem,MeshManager以及HeightFieldManager。虽然他们是World的手下,但他们可以在World创建之前被创建。以及在World销毁之后再销毁。单例对象可以在任何地方被调用。
The Singletons are the underlings of NxOgre, not the bad underlings kind, the good ones really. Well, almost. There are five singletons; although the isn’t fifth not shown (He joined us in season 3, and I couldn’t find a more recent screengrab).
They are; ErrorStream, TimeController, ResourceSystem, MeshManager and HeightFieldManager. I’ll let you guess who’s the one in pink.
Although they are the underlings of the World, they can be created before the world, and after the world has perished – If your evil bidding desires it.
World::precreateSingletons(); //
预创建单例
World* mWorld* =
World::createWorld(); //
创建世界
World::destroyWorld(
false); //
销毁世界
World::destroySingletons(); //
销毁单例
Singletons can be accessed any where, and there is only one of their kind – sadly.
ErrorStream::getSingleton()->throwAssertion(
"I've broken it!!!", __FILE__, __LINE__);
The ResourceSystem — Gather ye resources
资源系统——聚集所有资源
ResourceSystem* sparky =
ResourceSystem::getSingleton();
sparky->openArchive(
"myFishesArchive",
"file:C:/Program Files/Fishes/");
Resource* mr_trout = sparky->open(
"myFishesArchive:fish.nxs", Enums::ResourceAccess_ReadOnly);
intx = mr_trout->readInt();
if(
size_tsize = mr_trout->getSize() >
140) {
mr_trout->seek(
140);
short
y = mr_trout->readUShort();
}
unsignedint
readOps = mr_trout->getNbReadOperations();
mr_trout->seekBeginning();
Next time on the Singletons, we explore the easier side of Resources; Meshes and Heightfields.
Meshes & Heightfields — Behold the Starfish King of North London!
Heightfields
HeightField* northLondon =
HeightFieldManager::getSingleton()->load(
"myFishesArchive:northLondon.xhf");
ManualHeightFieldsouthLondon;
southLondon.begin(
8,
8);
for(
unsignedint
i=
0; i <
8;i++)
for
(
unsignedint
j=
0; j <
8;j++)
southLondon.sample((i *
10) + j *
100);
HeightField* theRealSouthLondon = mhf.end(
"southLondon");
Meshes
我们使用PhysX模型文件,它以nxs文件格式被保存在磁盘中,我们通过MeshManager来将他加载进来
Mesh* the_starfish_king =
MeshManager::getSingleton()->load(
"myFishesArchive:donald.nxs");
转载于:https://www.cnblogs.com/ybgame/archive/2011/10/18/2216756.html
翻译betajaen的NxOgre简短教程相关推荐
- 在 Ubuntu Linux 上从源代码构建 Qt 6.2.2的简短教程
Qt 6.2.0 是 Qt 6 系列的第3个版本,功能与 Qt 5 相当,因此有望成为第一个被新 Qt 项目或从 Qt 5 移植的项目广泛采用的版本.在这篇文章中我提供有关在 Ubuntu Linux ...
- [翻译]asp.net ajax xml-script教程(二)
原文地址:http://dotnetslackers.com/articles/atlas/xml_script_tutorial_part2.aspx asp.net ajax xml-script ...
- 正则翻译工具_PythonBasics 中文系列教程 · 翻译完成
原文:PythonBasics Python Tutorial 协议:CC BY-NC-SA 4.0 欢迎任何人参与和完善:一个人可以走的很快,但是一群人却可以走的更远. 在线阅读 ApacheCN ...
- [翻译]Billy Belceb 病毒编写教程for Win32
Billy Belceb病毒编写教程---Win32篇 翻译:onlyu ...
- 函数变量命名翻译助手工具下载及教程
函数变量命名翻译助手教程 下载地址:翻译命名助手 细节: 1.自动翻译 2.选中[上边的文本框]的文字为划词翻译功能,取消选中则恢复 3.选中[下边的文本框]的文字会将选中的英文转化为函数变量名 4. ...
- (翻译++)微软Hololens开发教程系列(1): Holograms 100-使用Unity构建第一个全息影像应用
前言 本系列博文翻译至微软Holograms的官方英文教程,其地址为: https://developer.microsoft.com/en-us/windows/holographic/academ ...
- (翻译++)微软Hololens开发教程系列(1): Holograms 100-使用Unity构建第一个全息影像应用...
Holograms 100-使用Unity构建第一个全息影像应用 前言 本系列博文翻译至微软Holograms的官方英文教程,其地址为: https://developer.microsoft.com ...
- 【翻译转载】【官方教程】Asp.Net MVC4入门指南(2):添加一个控制器
2. 添加一个控制器 · 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-c ...
- 朴素贝叶斯实现分类_关于朴素贝叶斯分类及其实现的简短教程
朴素贝叶斯实现分类 Naive Bayes classification is one of the most simple and popular algorithms in data mining ...
最新文章
- 思考:王者荣耀为什么不使用微服务架构?
- 推荐系统笔记:矩阵分解+基于邻居的模型
- 耳朵经济在生活中的应用
- 「中间件系列一」kafka消息中间件
- Thread的join方法使用解析
- stm32机械臂资料含视频
- 可视化+数据+图表,报告规范这么写才能升职
- jquery1.8.3和1.11.3的用法区别
- IOS8 AutoLayout+SizeClasses 基础篇(1)
- 单实例数据库迁移到rac环境(四)下
- linux如何使用鼠标数据的,浅析linux中鼠标数据读取
- Win2003安装不了 Windows Media Player 11
- Eclipse- 使用记录(1)
- ZOJ 3432 Find the Lost Sock (水题)
- Python | NumPy | 不完全总结
- win8.1各版本的区别
- Flink 生产环境配置建议
- JRUL数字交流三相电流继电器
- 创建OMF(Oracle Managed Files,Oracle管理的文件)
- 微信公众号图文中怎么下载封面图?