本文整理了Java中com.ardor3d.math.Transform.applyForwardVector()
方法的一些代码示例,展示了Transform.applyForwardVector()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transform.applyForwardVector()
方法的具体详情如下:
包路径:com.ardor3d.math.Transform
类名称:Transform
方法名:applyForwardVector
[英]Locally applies this transform to the given vector: V' = MV
[中]局部地将此变换应用于给定向量:V'=MV
代码示例来源:origin: com.ardor3d/ardor3d-math
/**
* Applies this transform to the given vector and returns the result in the given store vector: V' = M*V
*
* @param vector
* @param store
* the vector to store our result in. if null, a new vector will be created.
* @return the transformed vector.
* @throws NullPointerException
* if vector is null.
*/
@Override
public Vector3 applyForwardVector(final ReadOnlyVector3 vector, final Vector3 store) {
Vector3 result = store;
if (result == null) {
result = new Vector3();
}
result.set(vector);
return applyForwardVector(result);
}
代码示例来源:origin: Renanse/Ardor3D
/**
* Applies this transform to the given vector and returns the result in the given store vector: V' = M*V
*
* @param vector
* @param store
* the vector to store our result in. if null, a new vector will be created.
* @return the transformed vector.
* @throws NullPointerException
* if vector is null.
*/
@Override
public Vector3 applyForwardVector(final ReadOnlyVector3 vector, final Vector3 store) {
Vector3 result = store;
if (result == null) {
result = new Vector3();
}
result.set(vector);
return applyForwardVector(result);
}
代码示例来源:origin: Renanse/Ardor3D
@Test(expected = NullPointerException.class)
public void testApplyFail2() {
final Transform trans = new Transform();
trans.applyForwardVector(null);
}
代码示例来源:origin: Renanse/Ardor3D
public void transformNormals(final Transform transform, final boolean normalize) {
final FloatBuffer normalBuffer = getNormalBuffer();
final Vector3 store = new Vector3();
for (int x = 0; x < _vertexCount; x++) {
BufferUtils.populateFromBuffer(store, normalBuffer, x);
transform.applyForwardVector(store, store);
if (normalize) {
store.normalizeLocal();
}
BufferUtils.setInBuffer(store, normalBuffer, x);
}
}
代码示例来源:origin: com.ardor3d/ardor3d-core
public void transformNormals(final Transform transform, final boolean normalize) {
final Vector3 store = new Vector3();
for (int x = 0; x < _vertexCount; x++) {
BufferUtils.populateFromBuffer(store, _normalCoords.getBuffer(), x);
transform.applyForwardVector(store, store);
if (normalize) {
store.normalizeLocal();
}
BufferUtils.setInBuffer(store, _normalCoords.getBuffer(), x);
}
}
代码示例来源:origin: Renanse/Ardor3D
/**
* rotates the normals of this Mesh to world normals based on its world settings. The results are stored in the
* given FloatBuffer. If given FloatBuffer is null, one is created.
*
* @param store
* the FloatBuffer to store the results in, or null if you want one created.
* @return store or new FloatBuffer if store == null.
*/
public FloatBuffer getWorldNormals(FloatBuffer store) {
final FloatBuffer normBuf = _meshData.getNormalBuffer();
if (store == null || store.capacity() != normBuf.limit()) {
store = BufferUtils.createFloatBuffer(normBuf.limit());
}
final Vector3 compVect = Vector3.fetchTempInstance();
for (int v = 0, vSize = store.capacity() / 3; v < vSize; v++) {
BufferUtils.populateFromBuffer(compVect, normBuf, v);
_worldTransform.applyForwardVector(compVect);
BufferUtils.setInBuffer(compVect, store, v);
}
Vector3.releaseTempInstance(compVect);
return store;
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
* rotates the normals of this Mesh to world normals based on its world settings. The results are stored in the
* given FloatBuffer. If given FloatBuffer is null, one is created.
*
* @param store
* the FloatBuffer to store the results in, or null if you want one created.
* @return store or new FloatBuffer if store == null.
*/
public FloatBuffer getWorldNormals(FloatBuffer store) {
final FloatBuffer normBuf = _meshData.getNormalBuffer();
if (store == null || store.capacity() != normBuf.limit()) {
store = BufferUtils.createFloatBuffer(normBuf.limit());
}
final Vector3 compVect = Vector3.fetchTempInstance();
for (int v = 0, vSize = store.capacity() / 3; v < vSize; v++) {
BufferUtils.populateFromBuffer(compVect, normBuf, v);
_worldTransform.applyForwardVector(compVect);
BufferUtils.setInBuffer(compVect, store, v);
}
Vector3.releaseTempInstance(compVect);
return store;
}
代码示例来源: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: 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: Renanse/Ardor3D
_initFrameTransform.applyForwardVector(vec);
frame.setTransform(_initFrameTransform);
frame.addTranslation(vec);
代码示例来源:origin: com.ardor3d/ardor3d-ui
_initFrameTransform.applyForwardVector(vec);
frame.setTransform(_initFrameTransform);
frame.addTranslation(vec);
代码示例来源:origin: com.ardor3d/ardor3d-ui
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
final Transform t = Transform.fetchTempInstance();
t.set(getWorldTransform());
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源: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.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
代码示例来源:origin: Renanse/Ardor3D
t.applyForwardVector(v);
t.translate(v);
Vector3.releaseTempInstance(v);
内容来源于网络,如有侵权,请联系作者删除!