UpdateGeometricState()
方法的用处,什么时候用?
In jme3 it is more important than
in jme2 that the correct updating and rendering order is kept, this is why you
should understand what updateGeometricState() is all about.
在
jme3
中有了很重要的跟新,渲染序列可控性也大大提高,所以到处都会用到
updateGeometricState()
这个方法,你必须对这个方法有深刻的理解。
updateGeometricState
()
用来做什么。
The call to
updateGeometricState() applies all changes made to a Spatials location
, rotation and scale and
computes the correct world
position
including the Spatials parent position (if there is one) so all
information is correct for the rendering process. When updateGeometricState()
is called on a Node, all child Spatials will be updated as well, given that
their flags indicate something has changed. In a normal update loop,
updateGeometricState() is called once on the Scenes rootNode just before
rendering.
updateGeometricState()
会在三维空间中应用所有的更改,包括:位置、旋转、缩放以及纠正所有父级别的三维空间坐标,所以此时所有的信息都会在渲染线程中纠正。当
updateGeometricState()
在一个节点上被调用时,所有的子空间将被更新,并且给他们的标志标记上已经改变的记录,通常的跟新循环中该方法只在场景的根节点开始渲染前调用一次。
为什么你有时候想要来使用
updateGeometricState()
方法?
Since the world location
of spatials is only known
after updateGeometricState() has been called in jme2
,
it was common
practice for some to call updateGeometricState() on the spatial to compute its
correct location because it had been changed before. In jme3 you should not do that
as updateGeometricState()
should only be called once on the rootNode of the scene during the update loop.
If you really have to updateGeometric(), do so on the rootNode. In some tests
however, especially physics tests, you might see that updateGeometricState() is
used on created PhysicsNodes. This is however before
they are added to a rootNode that is part of a
live scene. When a Spatial has a parent or was added to the root node, do not
call updateGeometricState() on
it.
由于在
jme2
中场景空间对象的世界坐标
只有在
updateGeometricState()
被调用后才能知道,在空间对象上调用
updateGeometricState()
来计算正确的世界坐标在空间中的位置是常用的做法,因为它之前已经被改变了。
在
jme3
中你可以不用那么做,
updateGeometricState()
仅仅在每次循环中只在根节点上调用一次。如果你趋势有必要去调用
updateGeometric()
,那就在根节点上调用。然而在一些练习中,尤其是物理检测中你可能会看到
updateGeometric()
在被创建的物理节点上被使用,这是由于在它们成为活动场景的一部分之前需要计算它(物理节点)的位置。当一个三维空间对象有一个父节点或者已经被添加到了根节点,请不要调用
updateGeometric()
。
当发生了空间对象的转换
So going along this logic, you
should not change the Spatials translation after updateGeometricState() has
been called anymore. So how or when do you change it? Before. :) The
InputListeners for example are called before updateGeometricState() is called
on the rootNode and the Spatials are in their correct, updated state from the
last loop run. Now you can use setLocalTranslation etc. to modify your
Spatials, also using translation info from the other Spatials. The controllers
(updateLogicalState()) are the second chance to modify your Spatials, they are
used by the animation and particle systems for example. If you absolutely need
to read the world location of a spatial in your normal update() call, you
should call updateGeometricState() once on the root Node of the scene and read
the world locations after that.
依照这个逻辑,你不应该在调用了
updateGeometricState()
之后再去做一些空间对象的变换。那么什么时候或者怎么才能进行变换呢?首先一个输入监听器被一个实例在根节点调用
updateGeometricState()
之前被调用并且空间对象已经处于它们的正确位置,在循环的最后更新状态。现在你可以使用
setLocalTranslation
()或其他的方法来修改你的空间对象,同样可以从其他的空间对象使用变换信息。控制器()会马上对你的空间对象作出修改,它们被动画和粒子系统使用。如果你绝对需要在你的
update()
中得到一个空间对象的世界坐标,你可以在根节点上调用一次
updateGeometricState()
之后来读取世界坐标。
《这篇文章字不多,给我搞的云里雾里的,效果很不好,请高手指点一下。。。》
分享到:
相关推荐
《JME3 中文教程(ZBP翻译第一版)》是一个专门为Java Media Engine 3 (JMonkeyEngine 3,简称JME3)爱好者和开发者准备的教程资源。JME3是一个开源的3D游戏开发框架,它基于Java编程语言,为开发者提供了高效、便捷...
本教程是针对JME3的中文翻译版本,旨在帮助中文用户更好地理解和掌握这个强大的工具。 JME3的主要特点包括: 1. **高性能图形渲染**:JME3支持现代图形API,如OpenGL,能够高效地处理复杂的3D模型和场景,提供流畅...
### JMonkeyEngine 3 (JME3) 中文教程概览 #### 一、JMonkeyEngine 3 简介 JMonkeyEngine 3 (简称 JME3) 是一款用 Java 语言编写的免费开源 3D 游戏引擎。它提供了一套完整的工具和 API,用于创建交互式 3D 应用...
jmasters JMasters 是一个简单的应用程序,遵循所有 JMonkeyEngine 3.x 教程。 可以说它是对网站上现有教程的翻译。 使用的平台: JMonkeyEngine 3.x 64 位; Oracle JDK 7; Kubuntu 14.04 LTS。
### FlagRush 1-6 中文翻译知识点详解 #### 1. 通过SimpleGame创建你的第一个应用程序 **1.1 SimpleGame介绍** - **SimpleGame概述**:SimpleGame是jMonkeyEngine(简称jME)中提供的一个基本应用程序模板,用于...
### Java游戏引擎 jMonkeyEngine FlagRushSeries中文翻译(1-10)知识点解析 #### 一、通过SimpleGame创建你的第一个应用程序 **1.1 SimpleGame介绍** SimpleGame是jMonkeyEngine提供的一种用于快速搭建游戏环境...