本文整理了Java中com.ardor3d.math.Transform.getTranslation()
方法的一些代码示例,展示了Transform.getTranslation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transform.getTranslation()
方法的具体详情如下:
包路径:com.ardor3d.math.Transform
类名称:Transform
方法名:getTranslation
暂无
代码示例来源:origin: Renanse/Ardor3D
/**
* Gets the local translation vector.
*
* @return the translation
*/
public ReadOnlyVector3 getTranslation() {
return _localTransform.getTranslation();
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
* Gets the local translation vector.
*
* @return the translation
*/
public ReadOnlyVector3 getTranslation() {
return _localTransform.getTranslation();
}
代码示例来源:origin: Renanse/Ardor3D
/**
* Gets the world translation vector.
*
* @return the world translation
*/
public ReadOnlyVector3 getWorldTranslation() {
return _worldTransform.getTranslation();
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
* Gets the world translation vector.
*
* @return the world translation
*/
public ReadOnlyVector3 getWorldTranslation() {
return _worldTransform.getTranslation();
}
代码示例来源:origin: com.ardor3d/ardor3d-terrain
@Override
public void drawTo(final BufferedImage image, final ReadOnlyTransform localTransform, final int clipmapLevel) {
// apply the two transforms together and then use result to scale/translate and rotate image
final Transform trans = new Transform();
localTransform.multiply(getTransform(), trans);
// grab a copy of the graphics so we don't bleed state to next image
final Graphics2D g2d = (Graphics2D) image.getGraphics().create();
// apply hints
for (final RenderingHints.Key key : hints.keySet()) {
g2d.setRenderingHint(key, hints.get(key));
}
// set transform
g2d.translate(trans.getTranslation().getX(), trans.getTranslation().getY());
g2d.rotate(trans.getMatrix().toAngles(null)[2]); // rotation about z
g2d.scale(trans.getScale().getX(), trans.getScale().getY());
// set composite
if (_compositeOverride != null) {
g2d.setComposite(_compositeOverride);
}
// draw the image
g2d.drawImage(_image, 0, 0, null);
}
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public void drawTo(final BufferedImage image, final ReadOnlyTransform localTransform, final int clipmapLevel) {
// apply the two transforms together and then use result to scale/translate and rotate image
final Transform trans = new Transform();
localTransform.multiply(getTransform(), trans);
// grab a copy of the graphics so we don't bleed state to next image
final Graphics2D g2d = (Graphics2D) image.getGraphics().create();
// apply hints
for (final RenderingHints.Key key : hints.keySet()) {
g2d.setRenderingHint(key, hints.get(key));
}
// set transform
g2d.translate(trans.getTranslation().getX(), trans.getTranslation().getY());
g2d.rotate(trans.getMatrix().toAngles(null)[2]); // rotation about z
g2d.scale(trans.getScale().getX(), trans.getScale().getY());
// set composite
if (_compositeOverride != null) {
g2d.setComposite(_compositeOverride);
}
// draw the image
g2d.drawImage(_image, 0, 0, null);
}
}
代码示例来源:origin: com.ardor3d/ardor3d-terrain
g2d.translate(trans.getTranslation().getX(), trans.getTranslation().getY());
g2d.rotate(trans.getMatrix().toAngles(null)[2]); // rotation about z
g2d.scale(trans.getScale().getX(), trans.getScale().getY());
代码示例来源:origin: Renanse/Ardor3D
g2d.translate(trans.getTranslation().getX(), trans.getTranslation().getY());
g2d.rotate(trans.getMatrix().toAngles(null)[2]); // rotation about z
g2d.scale(trans.getScale().getX(), trans.getScale().getY());
代码示例来源:origin: Renanse/Ardor3D
@Test
public void testTranslate() {
final Transform trans = new Transform();
trans.translate(1, 3, 5);
assertEquals(new Vector3(1, 3, 5), trans.getTranslation());
trans.translate(trans.getTranslation().negate(null));
assertEquals(Vector3.ZERO, trans.getTranslation());
trans.translate(new Vector3(1, 3, 5));
assertEquals(new Vector3(1, 3, 5), trans.getTranslation());
trans.translate(-1, -3, -5);
assertEquals(Vector3.ZERO, trans.getTranslation());
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public void applyFilter(final InteractManager manager) {
final SpatialState state = manager.getSpatialState();
_calcVectorA.set(state.getTransform().getTranslation());
for (final ReadOnlyPlane plane : _planes) {
final double distance = plane.pseudoDistance(_calcVectorA);
if (distance < 0) {
// push us back to the plane.
_calcVectorB.set(plane.getNormal()).multiplyLocal(-distance);
_calcVectorA.addLocal(_calcVectorB);
}
}
state.getTransform().setTranslation(_calcVectorA);
}
代码示例来源:origin: Renanse/Ardor3D
/**
* Aligns this Billboard Node so that it points to the camera position.
*/
private void rotateCameraAligned() {
final Camera camera = Camera.getCurrentCamera();
_look.set(camera.getLocation()).subtractLocal(_worldTransform.getTranslation()).normalizeLocal();
_left.set(camera.getUp()).crossLocal(_look);
final Vector3 up = Vector3.fetchTempInstance();
up.set(_look).crossLocal(_left);
_orient.fromAxes(_left, up, _look);
if(_localRot != null)
_orient.multiplyLocal(_localRot);
_worldTransform.setRotation(_orient);
Vector3.releaseTempInstance(up);
}
代码示例来源:origin: com.ardor3d/ardor3d-core
public void reconstruct(final Vector3 top, final Vector3 bottom, final double radius) {
// our temp vars
final Vector3 localTranslation = Vector3.fetchTempInstance();
final Vector3 capsuleUp = Vector3.fetchTempInstance();
// first make the capsule the right shape
height = top.distance(bottom);
this.radius = radius;
setGeometryData();
// now orient it in space.
localTranslation.set(_localTransform.getTranslation());
top.add(bottom, localTranslation).multiplyLocal(.5);
// rotation that takes us from 0,1,0 to the unit vector described by top/center.
top.subtract(localTranslation, capsuleUp).normalizeLocal();
final Matrix3 rotation = Matrix3.fetchTempInstance();
rotation.fromStartEndLocal(Vector3.UNIT_Y, capsuleUp);
_localTransform.setRotation(rotation);
Vector3.releaseTempInstance(localTranslation);
Vector3.releaseTempInstance(capsuleUp);
Matrix3.releaseTempInstance(rotation);
updateWorldTransform(false);
}
代码示例来源:origin: Renanse/Ardor3D
public void reconstruct(final Vector3 top, final Vector3 bottom, final double radius) {
// our temp vars
final Vector3 localTranslation = Vector3.fetchTempInstance();
final Vector3 capsuleUp = Vector3.fetchTempInstance();
// first make the capsule the right shape
height = top.distance(bottom);
this.radius = radius;
setGeometryData();
// now orient it in space.
localTranslation.set(_localTransform.getTranslation());
top.add(bottom, localTranslation).multiplyLocal(.5);
// rotation that takes us from 0,1,0 to the unit vector described by top/center.
top.subtract(localTranslation, capsuleUp).normalizeLocal();
final Matrix3 rotation = Matrix3.fetchTempInstance();
rotation.fromStartEndLocal(Vector3.UNIT_Y, capsuleUp);
_localTransform.setRotation(rotation);
Vector3.releaseTempInstance(localTranslation);
Vector3.releaseTempInstance(capsuleUp);
Matrix3.releaseTempInstance(rotation);
updateWorldTransform(false);
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public void processInput(final Canvas source, final TwoInputStates inputStates, final AtomicBoolean inputConsumed,
final InteractManager manager) {
final Camera camera = source.getCanvasRenderer().getCamera();
final MouseState current = inputStates.getCurrent().getMouseState();
final MouseState previous = inputStates.getPrevious().getMouseState();
// first process mouse over state
checkMouseOver(source, current, manager);
// Now check drag status
if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) {
return;
}
// act on drag
final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY());
final Vector3 loc = getNewOffset(oldMouse, current, camera, manager);
final Transform transform = manager.getSpatialState().getTransform();
transform.setTranslation(loc.addLocal(transform.getTranslation()));
// apply our filters, if any, now that we've made updates.
applyFilters(manager);
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public void processInput(final Canvas source, final TwoInputStates inputStates, final AtomicBoolean inputConsumed,
final InteractManager manager) {
final Camera camera = source.getCanvasRenderer().getCamera();
final MouseState current = inputStates.getCurrent().getMouseState();
final MouseState previous = inputStates.getPrevious().getMouseState();
// first process mouse over state
checkMouseOver(source, current, manager);
// Now check drag status
if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) {
return;
}
// act on drag
if (_lastDragSpatial != null && _lastDragSpatial.getParent() instanceof InteractArrow) {
final InteractArrow arrow = (InteractArrow) _lastDragSpatial.getParent();
_lastArrow = arrow;
final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY());
final Vector3 loc = getNewOffset(arrow, oldMouse, current, camera, manager);
final Transform transform = manager.getSpatialState().getTransform();
transform.setTranslation(loc.addLocal(transform.getTranslation()));
// apply our filters, if any, now that we've made updates.
applyFilters(manager);
}
}
代码示例来源:origin: com.ardor3d/ardor3d-core
_look.negateLocal().addLocal(_worldTransform.getTranslation());
代码示例来源:origin: Renanse/Ardor3D
@Override
public void processInput(final Canvas source, final TwoInputStates inputStates, final AtomicBoolean inputConsumed,
final InteractManager manager) {
final Camera camera = source.getCanvasRenderer().getCamera();
final MouseState current = inputStates.getCurrent().getMouseState();
final MouseState previous = inputStates.getPrevious().getMouseState();
// first process mouse over state
checkMouseOver(source, current, manager);
// Now check drag status
if (!checkShouldDrag(camera, current, previous, inputConsumed, manager)) {
return;
}
// act on drag
final PickData pickData = _results.getNumber() > 0 ? _results.getPickData(0) : null;
if (pickData != null && _lastDragSpatial instanceof Mesh
&& pickData.getIntersectionRecord().getNumberOfIntersections() > 0) {
final PrimitiveKey key = pickData.getIntersectionRecord().getIntersectionPrimitive(0);
((Mesh) _lastDragSpatial).getMeshData().getPrimitiveVertices(key.getPrimitiveIndex(), key.getSection(),
new Vector3[] { _calcVec3A, _calcVec3B, _calcVec3C });
_lastDragSpatial.localToWorld(_calcVec3A, _calcVec3A);
_lastDragSpatial.localToWorld(_calcVec3B, _calcVec3B);
_lastDragSpatial.localToWorld(_calcVec3C, _calcVec3C);
final Vector2 oldMouse = new Vector2(previous.getX(), previous.getY());
final Vector3 loc = getNewOffset(oldMouse, current, camera, manager);
final Transform transform = manager.getSpatialState().getTransform();
transform.setTranslation(loc.addLocal(transform.getTranslation()));
// apply our filters, if any, now that we've made updates.
applyFilters(manager);
}
}
代码示例来源:origin: com.ardor3d/ardor3d-core
_look.set(camera.getLocation()).subtractLocal(_worldTransform.getTranslation());
代码示例来源:origin: com.ardor3d/ardor3d-core
_look.set(camera.getLocation()).subtractLocal(_worldTransform.getTranslation());
final Matrix3 worldMatrix = Matrix3.fetchTempInstance().set(_worldTransform.getMatrix());
代码示例来源:origin: com.ardor3d/ardor3d-math
matrixA.applyPost(transformBy.getTranslation(), newTranslate).addLocal(getTranslation());
内容来源于网络,如有侵权,请联系作者删除!