當前位置: 首頁>>代碼示例>>Java>>正文


Java Quaternion.getY方法代碼示例

本文整理匯總了Java中com.jme3.math.Quaternion.getY方法的典型用法代碼示例。如果您正苦於以下問題:Java Quaternion.getY方法的具體用法?Java Quaternion.getY怎麽用?Java Quaternion.getY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.math.Quaternion的用法示例。


在下文中一共展示了Quaternion.getY方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAsString

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * 將目標對象轉換為字符串形式
 * @param value
 * @return 
 */
public final static String getAsString(Object value) {
    if (value == null) 
        return null;
    
     if (value instanceof String) {
        return (String) value;
    } else if (value instanceof Vector2f) {
        Vector2f v2 = (Vector2f) value;
        return v2.x + "," + v2.y;
    } else if (value instanceof Vector3f) {
        Vector3f v3 = (Vector3f) value;
        return v3.x + "," + v3.y + "," + v3.z;
    } else if (value instanceof Vector4f) {
        Vector4f v4 = (Vector4f) value;
        return v4.x + "," + v4.y + "," + v4.z + "," + v4.w;
    } else if (value instanceof Quaternion) {
        Quaternion q4 = (Quaternion) value;
        return q4.getX() + "," + q4.getY() + "," + q4.getZ() + "," + q4.getW();
    } else if (value instanceof ColorRGBA) {
        ColorRGBA c4 = (ColorRGBA) value;
        return c4.r + "," + c4.g + "," + c4.b + "," + c4.a;
    }
    return value.toString();
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:30,代碼來源:Converter.java

示例2: serialize

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
@Override
protected void serialize(int i, Quaternion store) {
    int j = i * getTupleSize();
    array[j] = store.getX();
    array[j + 1] = store.getY();
    array[j + 2] = store.getZ();
    array[j + 3] = store.getW();
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:9,代碼來源:CompactQuaternionArray.java

示例3: getValueAsString

import com.jme3.math.Quaternion; //導入方法依賴的package包/類
/**
 * Returns the material parameter value as it would appear in a J3M
 * file. E.g.<br/>
 * <code>
 * MaterialParameters {<br/>
 *     ABC : 1 2 3 4<br/>
 * }<br/>
 * </code>
 * Assuming "ABC" is a Vector4 parameter, then the value
 * "1 2 3 4" would be returned by this method.
 * <br/><br/>
 * @return material parameter value as it would appear in a J3M file.
 */
public String getValueAsString() {
    switch (type) {
        case Boolean:
        case Float:
        case Int:
            return value.toString();
        case Vector2:
            Vector2f v2 = (Vector2f) value;
            return v2.getX() + " " + v2.getY();
        case Vector3:
            Vector3f v3 = (Vector3f) value;
            return v3.getX() + " " + v3.getY() + " " + v3.getZ();
        case Vector4:
            // can be either ColorRGBA, Vector4f or Quaternion
            if (value instanceof Vector4f) {
                Vector4f v4 = (Vector4f) value;
                return v4.getX() + " " + v4.getY() + " "
                        + v4.getZ() + " " + v4.getW();
            } else if (value instanceof ColorRGBA) {
                ColorRGBA color = (ColorRGBA) value;
                return color.getRed() + " " + color.getGreen() + " "
                        + color.getBlue() + " " + color.getAlpha();
            } else if (value instanceof Quaternion) {
                Quaternion quat = (Quaternion) value;
                return quat.getX() + " " + quat.getY() + " "
                        + quat.getZ() + " " + quat.getW();
            } else {
                throw new UnsupportedOperationException("Unexpected Vector4 type: " + value);
            }
        case Texture2D:
        case Texture3D:
        case TextureArray:
        case TextureBuffer:
        case TextureCubeMap:
            Texture texVal = (Texture) value;
            TextureKey texKey = (TextureKey) texVal.getKey();
            String ret = "";
            if (texKey.isFlipY()) {
                ret += "Flip ";
            }
            if (texVal.getWrap(Texture.WrapAxis.S) == WrapMode.Repeat) {
                ret += "Repeat ";
            }

            return ret + texKey.getName();
        default:
            return null; // parameter type not supported in J3M
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:63,代碼來源:MatParam.java


注:本文中的com.jme3.math.Quaternion.getY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。