本文整理了Java中com.jme3.scene.Spatial.updateGeometricState()
方法的一些代码示例,展示了Spatial.updateGeometricState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.updateGeometricState()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:updateGeometricState
[英]updateGeometricState
updates the lightlist, computes the world transforms, and computes the world bounds for this Spatial. Calling this when the Spatial is attached to a node will cause undefined results. User code should only call this method on Spatials having no parent.
[中]updateGeometricState
更新光照列表,计算世界变换,并计算此空间的世界边界。当空间连接到节点时调用此函数将导致未定义的结果。用户代码应该只在没有父对象的空间上调用此方法。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void fixRefreshFlags(){
// force transforms to update below this node
spatial.updateGeometricState();
// force world bound to update
Spatial rootNode = spatial;
while (rootNode.getParent() != null){
rootNode = rootNode.getParent();
}
rootNode.getWorldBound();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public static void validateScene(Spatial scene) {
scene.updateGeometricState();
scene.depthFirstTraversal(VISITOR);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void update(){
int w = image.getWidth();
int h = image.getHeight();
float wr = (float) cam.getWidth() / image.getWidth();
float hr = (float) cam.getHeight() / image.getHeight();
scene.updateGeometricState();
for (int y = 0; y < h; y++){
for (int x = 0; x < w; x++){
Vector2f v = new Vector2f(x * wr,y * hr);
Vector3f pos = cam.getWorldCoordinates(v, 0.0f);
Vector3f dir = cam.getWorldCoordinates(v, 0.3f);
dir.subtractLocal(pos).normalizeLocal();
Ray r = new Ray(pos, dir);
results.clear();
scene.collideWith(r, results);
if (results.size() > 0){
image.setRGB(x, h - y - 1, 0xFFFFFFFF);
}else{
image.setRGB(x, h - y - 1, 0xFF000000);
}
}
}
label.repaint();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
return null;
debugShape.updateGeometricState();
return debugShape;
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
return null;
debugShape.updateGeometricState();
return debugShape;
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
child.updateGeometricState();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void update(float tpf) {
// update VR pose & cameras
if( environment.getVRViewManager() != null ) {
environment.getVRViewManager().update(tpf);
} else if( environment.getObserver() != null ) {
environment.getCamera().setFrame(((Spatial)environment.getObserver()).getWorldTranslation(), ((Spatial)environment.getObserver()).getWorldRotation());
}
if( environment.isInVR() == false || environment.getVRGUIManager().getPositioningMode() == VRGUIPositioningMode.MANUAL ) {
// only update geometric state here if GUI is in manual mode, or not in VR
// it will get updated automatically in the viewmanager update otherwise
// TODO isn't this done by SimpleApplication?
for (Spatial spatial : application.getGuiViewPort().getScenes()) {
//spatial.updateLogicalState(tpf);
spatial.updateGeometricState();
}
}
// use the analog control on the first tracked controller to push around the mouse
environment.getVRMouseManager().updateAnalogAsMouse(0, null, null, null, tpf);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void makeMissile() {
Vector3f pos = spaceCraft.getWorldTranslation().clone();
Quaternion rot = spaceCraft.getWorldRotation();
Vector3f dir = rot.getRotationColumn(2);
Spatial missile = assetManager.loadModel("Models/SpaceCraft/Rocket.mesh.xml");
missile.scale(0.5f);
missile.rotate(0, FastMath.PI, 0);
missile.updateGeometricState();
BoundingBox box = (BoundingBox) missile.getWorldBound();
final Vector3f extent = box.getExtent(null);
BoxCollisionShape boxShape = new BoxCollisionShape(extent);
missile.setName("Missile");
missile.rotate(rot);
missile.setLocalTranslation(pos.addLocal(0, extent.y * 4.5f, 0));
missile.setLocalRotation(hoverControl.getPhysicsRotation());
missile.setShadowMode(ShadowMode.Cast);
RigidBodyControl control = new BombControl(assetManager, boxShape, 20);
control.setLinearVelocity(dir.mult(100));
control.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_03);
missile.addControl(control);
rootNode.attachChild(missile);
getPhysicsSpace().add(missile);
}
代码示例来源:origin: info.projectkyoto/mms-engine
public static void optimize(Spatial source, boolean toFixed){
optimizeScene(source, toFixed);
source.updateLogicalState(0);
source.updateGeometricState();
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
private void fixRefreshFlags(){
// force transforms to update below this node
spatial.updateGeometricState();
// force world bound to update
Spatial rootNode = spatial;
while (rootNode.getParent() != null){
rootNode = rootNode.getParent();
}
rootNode.getWorldBound();
}
代码示例来源:origin: info.projectkyoto/mms-engine
private void fixRefreshFlags(){
// force transforms to update below this node
spatial.updateGeometricState();
// force world bound to update
Spatial rootNode = spatial;
while (rootNode.getParent() != null){
rootNode = rootNode.getParent();
}
rootNode.getWorldBound();
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* For internal use only
* specific render for the ragdoll(if debugging)
* @param rm
* @param vp
*/
public void render(RenderManager rm, ViewPort vp) {
if (enabled && space != null && space.getDebugManager() != null) {
if (!debug) {
attachDebugShape(space.getDebugManager());
}
for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) {
PhysicsBoneLink physicsBoneLink = it.next();
Spatial debugShape = physicsBoneLink.rigidBody.debugShape();
if (debugShape != null) {
debugShape.setLocalTranslation(physicsBoneLink.rigidBody.getMotionState().getWorldLocation());
debugShape.setLocalRotation(physicsBoneLink.rigidBody.getMotionState().getWorldRotationQuat());
debugShape.updateGeometricState();
rm.renderScene(debugShape, vp);
}
}
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
@Override
public void updateGeometricState(){
if ((refreshFlags & RF_LIGHTLIST) != 0){
updateWorldLightList();
}
if ((refreshFlags & RF_TRANSFORM) != 0){
// combine with parent transforms- same for all spatial
// subclasses.
updateWorldTransforms();
}
if (!children.isEmpty()) {
// the important part- make sure child geometric state is refreshed
// first before updating own world bound. This saves
// a round-trip later on.
// NOTE 9/19/09
// Although it does save a round trip,
for (Spatial child : children.getArray()) {
child.updateGeometricState();
}
}
if ((refreshFlags & RF_BOUND) != 0){
updateWorldBound();
}
assert refreshFlags == 0;
}
代码示例来源:origin: info.projectkyoto/mms-engine
public void render(RenderManager rm, ViewPort vp) {
if (enabled && space != null && space.getDebugManager() != null) {
if (debugShape == null) {
attachDebugShape(space.getDebugManager());
}
debugShape.setLocalTranslation(getPhysicsLocation());
debugShape.updateLogicalState(0);
debugShape.updateGeometricState();
rm.renderScene(debugShape, vp);
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
return null;
debugShape.updateGeometricState();
return debugShape;
代码示例来源:origin: info.projectkyoto/mms-engine
public void render(RenderManager rm, ViewPort vp) {
if (enabled && space != null && space.getDebugManager() != null) {
if (debugShape == null) {
attachDebugShape(space.getDebugManager());
}
debugShape.setLocalTranslation(spatial.getWorldTranslation());
debugShape.setLocalRotation(spatial.getWorldRotation());
debugShape.updateLogicalState(0);
debugShape.updateGeometricState();
rm.renderScene(debugShape, vp);
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
public Octree(Spatial scene, int minTrisPerNode){
scene.updateGeometricState();
代码示例来源:origin: info.projectkyoto/mms-engine
@Override
public void updateGeometricState() {
if ((refreshFlags & RF_LIGHTLIST) != 0) {
updateWorldLightList();
}
if ((refreshFlags & RF_TRANSFORM) != 0) {
// combine with parent transforms- same for all spatial
// subclasses.
updateWorldTransforms();
}
if (!children.isEmpty()) {
// the important part- make sure child geometric state is refreshed
// first before updating own world bound. This saves
// a round-trip later on.
// NOTE 9/19/09
// Although it does save a round trip,
for (Spatial child : children.getArray()) {
child.updateGeometricState();
}
if (needMeshUpdate) {
updateModelBound();
needMeshUpdate = false;
}
}
if ((refreshFlags & RF_BOUND) != 0) {
updateWorldBound();
}
assert refreshFlags == 0;
}
代码示例来源:origin: info.projectkyoto/mms-engine
public void render(RenderManager rm, ViewPort vp) {
if (enabled && space != null && space.getDebugManager() != null) {
if (debugShape == null) {
attachDebugShape(space.getDebugManager());
}
//TODO: using spatial traslation/rotation..
debugShape.setLocalTranslation(spatial.getWorldTranslation());
debugShape.setLocalRotation(spatial.getWorldRotation());
debugShape.updateLogicalState(0);
debugShape.updateGeometricState();
rm.renderScene(debugShape, vp);
}
}
代码示例来源:origin: info.projectkyoto/mms-engine
child.updateGeometricState();
内容来源于网络,如有侵权,请联系作者删除!