當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。