本文整理了Java中com.ardor3d.math.Transform.translate()
方法的一些代码示例,展示了Transform.translate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transform.translate()
方法的具体详情如下:
包路径:com.ardor3d.math.Transform
类名称:Transform
方法名:translate
[英]Locally adds to the translation of this transform.
[中]局部添加到此转换的转换。
代码示例来源:origin: com.ardor3d/ardor3d-math
@Override
public Transform translate(final ReadOnlyVector3 vec) {
super.translate(vec);
validate();
return this;
}
代码示例来源:origin: com.ardor3d/ardor3d-math
@Override
public Transform translate(final double x, final double y, final double z) {
super.translate(x, y, z);
validate();
return this;
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public Transform translate(final ReadOnlyVector3 vec) {
super.translate(vec);
validate();
return this;
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public Transform translate(final double x, final double y, final double z) {
super.translate(x, y, z);
validate();
return this;
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
* adds to the current translation of this spatial. This marks the spatial as DirtyType.Transform.
*
* @param x
* the x amount
* @param y
* the y amount
* @param z
* the z amount
*/
public void addTranslation(final double x, final double y, final double z) {
_localTransform.translate(x, y, z);
markDirty(DirtyType.Transform);
}
代码示例来源:origin: Renanse/Ardor3D
/**
* adds to the current translation of this spatial. This marks the spatial as DirtyType.Transform.
*
* @param x
* the x amount
* @param y
* the y amount
* @param z
* the z amount
*/
public void addTranslation(final double x, final double y, final double z) {
_localTransform.translate(x, y, z);
markDirty(DirtyType.Transform);
}
代码示例来源: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
@Test(expected = InvalidTransformException.class)
public void failConstructor() {
final Transform bad = new Transform();
bad.translate(Double.NaN, 1, 2);
new ValidatingTransform(Transform.IDENTITY); // good
new ValidatingTransform(bad); // bad
}
代码示例来源:origin: Renanse/Ardor3D
@Test(expected = InvalidTransformException.class)
public void testSet() {
final Transform bad = new Transform();
bad.translate(Double.NaN, 1, 2);
final ValidatingTransform vt1 = new ValidatingTransform();
vt1.set(Transform.IDENTITY); // good
vt1.set(bad); // bad
}
代码示例来源:origin: Renanse/Ardor3D
@Test(expected = InvalidTransformException.class)
public void testMultiply() {
final ValidatingTransform vt1 = new ValidatingTransform();
vt1.multiply(Transform.IDENTITY, null); // good
final Transform bad = new Transform();
bad.translate(Double.NaN, 1, 2);
vt1.multiply(bad, null); // bad
}
代码示例来源:origin: Renanse/Ardor3D
public void draw(final Renderer renderer, final UIComponent comp, final int height, final double xOffset,
final double yOffset) {
final long curr = System.currentTimeMillis();
if (curr - _lastBlink > _blinkInterval) {
_lastBlink = curr;
_show = !_show;
comp.fireComponentDirty();
}
if (!_show) {
return;
}
final Vector3 v = Vector3.fetchTempInstance();
v.set(getPosX() + xOffset, getPosY() + yOffset, 0);
final Transform t = Transform.fetchTempInstance();
t.set(comp.getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
_strip.setWorldTransform(t);
Transform.releaseTempInstance(t);
_strip.setWorldScale(1, _strip.getWorldScale().getY() * height, 0);
_strip.render(renderer);
}
代码示例来源:origin: com.ardor3d/ardor3d-ui
public void draw(final Renderer renderer, final UIComponent comp, final int height, final double xOffset,
final double yOffset) {
final long curr = System.currentTimeMillis();
if (curr - _lastBlink > _blinkInterval) {
_lastBlink = curr;
_show = !_show;
comp.fireComponentDirty();
}
if (!_show) {
return;
}
final Vector3 v = Vector3.fetchTempInstance();
v.set(getPosX() + xOffset, getPosY() + yOffset, 0);
final Transform t = Transform.fetchTempInstance();
t.set(comp.getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
_strip.setWorldTransform(t);
Transform.releaseTempInstance(t);
_strip.setWorldScale(1, _strip.getWorldScale().getY() * height, 0);
_strip.render(renderer);
}
代码示例来源:origin: com.ardor3d/ardor3d-ui
v.set(gPar.getTotalLeft(), gPar.getTotalBottom(), 0);
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
v.set(gPar.getTotalLeft(), gPar.getTotalBottom(), 0);
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
t.set(comp.getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
t.set(getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
_uiText.setWorldTransform(t);
代码示例来源:origin: Renanse/Ardor3D
@Override
public void draw(final Renderer renderer, final UIComponent comp) {
final float oldA = _color.getAlpha();
if (oldA == 0) {
// no need to draw.
return;
}
_color.setAlpha(oldA * UIComponent.getCurrentOpacity());
SolidBackdrop._standin.setDefaultColor(_color);
final Vector3 v = Vector3.fetchTempInstance();
final Insets margin = comp.getMargin() != null ? comp.getMargin() : Insets.EMPTY;
final Insets border = comp.getBorder() != null ? comp.getBorder() : Insets.EMPTY;
v.set(margin.getLeft() + border.getLeft(), margin.getBottom() + border.getBottom(), 0);
final Transform t = Transform.fetchTempInstance();
t.set(comp.getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
SolidBackdrop._standin.setWorldTransform(t);
Transform.releaseTempInstance(t);
final float width = UIBackdrop.getBackdropWidth(comp);
final float height = UIBackdrop.getBackdropHeight(comp);
SolidBackdrop._standin.resize(width, height);
SolidBackdrop._standin.render(renderer);
_color.setAlpha(oldA);
}
代码示例来源:origin: com.ardor3d/ardor3d-ui
@Override
public void draw(final Renderer renderer, final UIComponent comp) {
final float oldA = _color.getAlpha();
if (oldA == 0) {
// no need to draw.
return;
}
_color.setAlpha(oldA * UIComponent.getCurrentOpacity());
SolidBackdrop._standin.setDefaultColor(_color);
final Vector3 v = Vector3.fetchTempInstance();
v.set(comp.getMargin().getLeft() + comp.getBorder().getLeft(), comp.getMargin().getBottom()
+ comp.getBorder().getBottom(), 0);
final Transform t = Transform.fetchTempInstance();
t.set(comp.getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
SolidBackdrop._standin.setWorldTransform(t);
Transform.releaseTempInstance(t);
final float width = UIBackdrop.getBackdropWidth(comp);
final float height = UIBackdrop.getBackdropHeight(comp);
SolidBackdrop._standin.resize(width, height);
SolidBackdrop._standin.render(renderer);
_color.setAlpha(oldA);
}
代码示例来源:origin: com.ardor3d/ardor3d-ui
t.set(comp.getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
t.set(comp.getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
内容来源于网络,如有侵权,请联系作者删除!