本文整理汇总了Java中com.jme3.scene.Spatial.getWorldTranslation方法的典型用法代码示例。如果您正苦于以下问题:Java Spatial.getWorldTranslation方法的具体用法?Java Spatial.getWorldTranslation怎么用?Java Spatial.getWorldTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.scene.Spatial
的用法示例。
在下文中一共展示了Spatial.getWorldTranslation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintTexture
import com.jme3.scene.Spatial; //导入方法依赖的package包/类
/**
* Paint texture.
*
* @param editingInput the editing input.
* @param contactPoint the contact point.
*/
private void paintTexture(@NotNull final EditingInput editingInput, @NotNull final Vector3f contactPoint) {
final Texture alphaTexture = getAlphaTexture();
if (alphaTexture == null) return;
final LocalObjects local = LocalObjects.get();
final Spatial terrainNode = notNull(getEditedModel());
final Terrain terrain = (Terrain) terrainNode;
final Image image = alphaTexture.getImage();
final Vector3f worldTranslation = terrainNode.getWorldTranslation();
final Vector3f localPoint = contactPoint.subtract(worldTranslation, local.nextVector());
final Vector3f localScale = terrainNode.getLocalScale();
final Vector2f uv = getPointPercentagePosition(terrain, localPoint, localScale, local.nextVector2f());
final Vector2f temp = local.nextVector2f();
final ColorRGBA color = local.nextColor();
final int layer = getLayer();
// get the radius of the brush in pixel-percent
float brushSize = getBrushSize() / (terrain.getTerrainSize() * localScale.getX());
float brushPower = getBrushPower();
if (editingInput == EditingInput.MOUSE_SECONDARY) {
brushPower *= -1;
}
// selectedTextureIndex/4 is an int floor, do not simplify the equation
final ObjectFloatObjectConsumer<ColorRGBA, Boolean> colorFunction = COLOR_FUNCTIONS[layer - ((layer / 4) * 4)];
doPaintAction(colorFunction, image, uv, temp, color, brushSize, false, brushPower);
image.setUpdateNeeded();
}
示例2: isVisibleOnEditor
import com.jme3.scene.Spatial; //导入方法依赖的package包/类
@FXThread
private boolean isVisibleOnEditor(@NotNull final Spatial spatial) {
final MA editor3DState = getEditor3DState();
final Camera camera = editor3DState.getCamera();
final Vector3f position = spatial.getWorldTranslation();
final Vector3f coordinates = camera.getScreenCoordinates(position, new Vector3f());
boolean invisible = coordinates.getZ() < 0F || coordinates.getZ() > 1F;
invisible = invisible || !isInside(coordinates.getX(), camera.getHeight() - coordinates.getY(), Event.class);
return !invisible;
}