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


Java Quaternion.getX方法代码示例

本文整理汇总了Java中com.jme3.math.Quaternion.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Quaternion.getX方法的具体用法?Java Quaternion.getX怎么用?Java Quaternion.getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.math.Quaternion的用法示例。


在下文中一共展示了Quaternion.getX方法的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.getX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。