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


Java Matrix3f.set方法代码示例

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


在下文中一共展示了Matrix3f.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAsText

import com.jme3.math.Matrix3f; //导入方法依赖的package包/类
public void setAsText(String text) throws IllegalArgumentException {
        text = text.replace('[', ' ');
        text = text.replace(']', ' ');
        String[] values = text.split(",");
        if (values.length != 3) {
            throw (new IllegalArgumentException("String not correct"));
        }
        float[] floats = new float[3];
        for (int i = 0; i < values.length; i++) {
            String string = values[i];
            floats[i] = Float.parseFloat(string);
        }
        Matrix3f old = new Matrix3f();
        old.set(vector);
//        vector.set(floats[0], floats[1], floats[2]);
        notifyListeners(old, vector);
    }
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:18,代码来源:Matrix3fPropertyEditor.java

示例2: transform

import com.jme3.math.Matrix3f; //导入方法依赖的package包/类
/**
 * <code>transform</code> modifies the center of the box to reflect the
 * change made via a rotation, translation and scale.
 * 
 * @param trans 
 *            the transform to apply
 * @param store
 *            box to store result in
 */
public BoundingVolume transform(Transform trans, BoundingVolume store) {

    BoundingBox box;
    if (store == null || store.getType() != Type.AABB) {
        box = new BoundingBox();
    } else {
        box = (BoundingBox) store;
    }

    center.mult(trans.getScale(), box.center);
    trans.getRotation().mult(box.center, box.center);
    box.center.addLocal(trans.getTranslation());

    TempVars vars = TempVars.get();

    Matrix3f transMatrix = vars.tempMat3;
    transMatrix.set(trans.getRotation());
    // Make the rotation matrix all positive to get the maximum x/y/z extent
    transMatrix.absoluteLocal();

    Vector3f scale = trans.getScale();
    vars.vect1.set(xExtent * scale.x, yExtent * scale.y, zExtent * scale.z);
    transMatrix.mult(vars.vect1, vars.vect2);
    // Assign the biggest rotations after scales.
    box.xExtent = FastMath.abs(vars.vect2.getX());
    box.yExtent = FastMath.abs(vars.vect2.getY());
    box.zExtent = FastMath.abs(vars.vect2.getZ());

    vars.release();

    return box;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:42,代码来源:BoundingBox.java

示例3: getDebugShape

import com.jme3.math.Matrix3f; //导入方法依赖的package包/类
/**
 * Creates a debug shape from the given collision shape. This is mostly used internally.<br>
 * To attach a debug shape to a physics object, call <code>attachDebugShape(AssetManager manager);</code> on it.
 * @param collisionShape
 * @return
 */
public static Spatial getDebugShape(CollisionShape collisionShape) {
    if (collisionShape == null) {
        return null;
    }
    Spatial debugShape;
    if (collisionShape instanceof CompoundCollisionShape) {
        CompoundCollisionShape shape = (CompoundCollisionShape) collisionShape;
        List<ChildCollisionShape> children = shape.getChildren();
        Node node = new Node("DebugShapeNode");
        for (Iterator<ChildCollisionShape> it = children.iterator(); it.hasNext();) {
            ChildCollisionShape childCollisionShape = it.next();
            CollisionShape ccollisionShape = childCollisionShape.shape;
            Geometry geometry = createDebugShape(ccollisionShape);

            // apply translation
            geometry.setLocalTranslation(childCollisionShape.location);

            // apply rotation
            TempVars vars = TempVars.get();                
            Matrix3f tempRot = vars.tempMat3;

            tempRot.set(geometry.getLocalRotation());
            childCollisionShape.rotation.mult(tempRot, tempRot);
            geometry.setLocalRotation(tempRot);

            vars.release();

            node.attachChild(geometry);
        }
        debugShape = node;
    } else {
        debugShape = createDebugShape(collisionShape);
    }
    if (debugShape == null) {
        return null;
    }
    debugShape.updateGeometricState();
    return debugShape;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:46,代码来源:DebugShapeFactory.java

示例4: getDebugShape

import com.jme3.math.Matrix3f; //导入方法依赖的package包/类
/**
 * Creates a debug shape from the given collision shape. This is mostly used internally.<br>
 * To attach a debug shape to a physics object, call <code>attachDebugShape(AssetManager manager);</code> on it.
 * @param collisionShape
 * @return
 */
public static Spatial getDebugShape(CollisionShape collisionShape) {
    if (collisionShape == null) {
        return null;
    }
    Spatial debugShape;
    if (collisionShape instanceof CompoundCollisionShape) {
        CompoundCollisionShape shape = (CompoundCollisionShape) collisionShape;
        List<ChildCollisionShape> children = shape.getChildren();
        Node node = new Node("DebugShapeNode");
        for (Iterator<ChildCollisionShape> it = children.iterator(); it.hasNext();) {
            ChildCollisionShape childCollisionShape = it.next();
            CollisionShape ccollisionShape = childCollisionShape.shape;
            Geometry geometry = createDebugShape(ccollisionShape);

            // apply translation
            geometry.setLocalTranslation(childCollisionShape.location);

            // apply rotation
            TempVars vars = TempVars.get();

            Matrix3f tempRot = vars.tempMat3;

            tempRot.set(geometry.getLocalRotation());
            childCollisionShape.rotation.mult(tempRot, tempRot);
            geometry.setLocalRotation(tempRot);

            vars.release();

            node.attachChild(geometry);
        }
        debugShape = node;
    } else {
        debugShape = createDebugShape(collisionShape);
    }
    if (debugShape == null) {
        return null;
    }
    debugShape.updateGeometricState();
    return debugShape;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:47,代码来源:DebugShapeFactory.java


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