当前位置: 首页>>代码示例>>Java>>正文


Java Spatial.getWorldTranslation方法代码示例

本文整理汇总了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();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:41,代码来源:PaintTerrainToolControl.java

示例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;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:15,代码来源:AbstractSceneFileEditor.java


注:本文中的com.jme3.scene.Spatial.getWorldTranslation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。