本文整理了Java中com.ardor3d.math.Vector3.releaseTempInstance()
方法的一些代码示例,展示了Vector3.releaseTempInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector3.releaseTempInstance()
方法的具体详情如下:
包路径:com.ardor3d.math.Vector3
类名称:Vector3
方法名:releaseTempInstance
[英]Releases a Vector3 back to be used by a future call to fetchTempInstance. TAKE CARE: this Vector3 object should no longer have other classes referencing it or "Bad Things" will happen.
[中]释放一个向量3,供将来调用fetchTempInstance时使用。小心:这个Vector3对象不应该再有其他类引用它,否则会发生“坏事情”。
代码示例来源:origin: com.ardor3d/ardor3d-core
private void put(final FloatBuffer fb, final FloatBuffer nb, final Vector3 vec) {
fb.put((float) vec.getX()).put((float) vec.getY()).put((float) vec.getZ());
final Vector3 v = vec.normalize(Vector3.fetchTempInstance());
nb.put((float) v.getX()).put((float) v.getY()).put((float) v.getZ());
Vector3.releaseTempInstance(v);
}
代码示例来源:origin: Renanse/Ardor3D
private void put(final FloatBuffer fb, final FloatBuffer nb, final Vector3 vec) {
fb.put((float) vec.getX()).put((float) vec.getY()).put((float) vec.getZ());
final Vector3 v = vec.normalize(Vector3.fetchTempInstance());
nb.put((float) v.getX()).put((float) v.getY()).put((float) v.getZ());
Vector3.releaseTempInstance(v);
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
* Normalize a Vector3 in-buffer.
*
* @param buf
* the buffer to find the Vector3 within
* @param index
* the position (in terms of vectors, not floats) of the vector to normalize
*/
public static void normalizeVector3(final FloatBuffer buf, final int index) {
final Vector3 temp = Vector3.fetchTempInstance();
populateFromBuffer(temp, buf, index);
temp.normalizeLocal();
setInBuffer(temp, buf, index);
Vector3.releaseTempInstance(temp);
}
代码示例来源:origin: Renanse/Ardor3D
/**
* Normalize a Vector3 in-buffer.
*
* @param buf
* the buffer to find the Vector3 within
* @param index
* the position (in terms of vectors, not floats) of the vector to normalize
*/
public static void normalizeVector3(final FloatBuffer buf, final int index) {
final Vector3 temp = Vector3.fetchTempInstance();
populateFromBuffer(temp, buf, index);
temp.normalizeLocal();
setInBuffer(temp, buf, index);
Vector3.releaseTempInstance(temp);
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
* Add to a Vector3 in-buffer.
*
* @param toAdd
* the vector to add from
* @param buf
* the buffer to find the Vector3 within
* @param index
* the position (in terms of vectors, not floats) of the vector to add to
*/
public static void addInBuffer(final ReadOnlyVector3 toAdd, final FloatBuffer buf, final int index) {
final Vector3 temp = Vector3.fetchTempInstance();
populateFromBuffer(temp, buf, index);
temp.addLocal(toAdd);
setInBuffer(temp, buf, index);
Vector3.releaseTempInstance(temp);
}
代码示例来源:origin: com.ardor3d/ardor3d-core
/**
* Multiply and store a Vector3 in-buffer.
*
* @param toMult
* the vector to multiply against
* @param buf
* the buffer to find the Vector3 within
* @param index
* the position (in terms of vectors, not floats) of the vector to multiply
*/
public static void multInBuffer(final ReadOnlyVector3 toMult, final FloatBuffer buf, final int index) {
final Vector3 temp = Vector3.fetchTempInstance();
populateFromBuffer(temp, buf, index);
temp.multiplyLocal(toMult);
setInBuffer(temp, buf, index);
Vector3.releaseTempInstance(temp);
}
代码示例来源:origin: Renanse/Ardor3D
/**
* Multiply and store a Vector3 in-buffer.
*
* @param toMult
* the vector to multiply against
* @param buf
* the buffer to find the Vector3 within
* @param index
* the position (in terms of vectors, not floats) of the vector to multiply
*/
public static void multInBuffer(final ReadOnlyVector3 toMult, final FloatBuffer buf, final int index) {
final Vector3 temp = Vector3.fetchTempInstance();
populateFromBuffer(temp, buf, index);
temp.multiplyLocal(toMult);
setInBuffer(temp, buf, index);
Vector3.releaseTempInstance(temp);
}
代码示例来源:origin: com.ardor3d/ardor3d-ui
public void startDrag(final int mouseX, final int mouseY) {
final Vector3 vec = Vector3.fetchTempInstance();
vec.set(mouseX, mouseY, 0);
_uiFrameStatusBar.getWorldTransform().applyInverseVector(vec);
_initialX = Math.round(vec.getXf());
_initialY = Math.round(vec.getYf());
Vector3.releaseTempInstance(vec);
final UIFrame frame = UIFrame.findParentFrame(_uiFrameStatusBar);
_initialLocalCompOnentWidth= frame.getLocalComponentWidth();
_initialLocalCompOnentHeight= frame.getLocalComponentHeight();
_initFrameTransform.set(frame.getWorldTransform());
}
代码示例来源:origin: Renanse/Ardor3D
public void startDrag(final int mouseX, final int mouseY) {
final Vector3 vec = Vector3.fetchTempInstance();
vec.set(mouseX, mouseY, 0);
_uiFrameStatusBar.getWorldTransform().applyInverseVector(vec);
_initialX = Math.round(vec.getXf());
_initialY = Math.round(vec.getYf());
Vector3.releaseTempInstance(vec);
final UIFrame frame = UIFrame.findParentFrame(_uiFrameStatusBar);
_initialLocalCompOnentWidth= frame.getLocalComponentWidth();
_initialLocalCompOnentHeight= frame.getLocalComponentHeight();
_initFrameTransform.set(frame.getWorldTransform());
}
代码示例来源:origin: com.ardor3d/ardor3d-math
public double eval(final double x, final double y, final double z) {
final Vector3 temp = Vector3.fetchTempInstance();
temp.set(x, y, z);
rotation.applyPost(temp, temp);
final double val = source.eval(temp.getX(), temp.getY(), temp.getZ());
Vector3.releaseTempInstance(temp);
return val;
}
};
代码示例来源:origin: Renanse/Ardor3D
public double eval(final double x, final double y, final double z) {
final Vector3 temp = Vector3.fetchTempInstance();
temp.set(x, y, z);
rotation.applyPost(temp, temp);
final double val = source.eval(temp.getX(), temp.getY(), temp.getZ());
Vector3.releaseTempInstance(temp);
return val;
}
};
代码示例来源:origin: com.ardor3d/ardor3d-effects
public void killParticle() {
setStatus(Status.Dead);
final Vector3 tempVec3 = Vector3.fetchTempInstance();
final FloatBuffer vertexBuffer = parent.getParticleGeometry().getMeshData().getVertexBuffer();
BufferUtils.populateFromBuffer(tempVec3, vertexBuffer, startIndex);
final int verts = ParticleSystem.getVertsForParticleType(type);
for (int x = 1; x
}
Vector3.releaseTempInstance(tempVec3);
}
代码示例来源:origin: Renanse/Ardor3D
public void killParticle() {
setStatus(Status.Dead);
final Vector3 tempVec3 = Vector3.fetchTempInstance();
final FloatBuffer vertexBuffer = parent.getParticleGeometry().getMeshData().getVertexBuffer();
BufferUtils.populateFromBuffer(tempVec3, vertexBuffer, startIndex);
final int verts = ParticleSystem.getVertsForParticleType(type);
for (int x = 1; x
}
Vector3.releaseTempInstance(tempVec3);
}
代码示例来源:origin: com.ardor3d/ardor3d-core
public void updateLeftRightCameraFrames() {
// update camera frame
final Vector3 rightDir = Vector3.fetchTempInstance();
final Vector3 work = Vector3.fetchTempInstance();
rightDir.set(getDirection()).crossLocal(getUp()).multiplyLocal(_eyeSeparation / 2.0);
_leftCamera.setFrame(getLocation().subtract(rightDir, work), getLeft(), getUp(), getDirection());
_rightCamera.setFrame(getLocation().add(rightDir, work), getLeft(), getUp(), getDirection());
Vector3.releaseTempInstance(work);
Vector3.releaseTempInstance(rightDir);
}
代码示例来源:origin: Renanse/Ardor3D
public void updateLeftRightCameraFrames() {
// update camera frame
final Vector3 rightDir = Vector3.fetchTempInstance();
final Vector3 work = Vector3.fetchTempInstance();
rightDir.set(getDirection()).crossLocal(getUp()).multiplyLocal(_eyeSeparation / 2.0);
_leftCamera.setFrame(getLocation().subtract(rightDir, work), getLeft(), getUp(), getDirection());
_rightCamera.setFrame(getLocation().add(rightDir, work), getLeft(), getUp(), getDirection());
Vector3.releaseTempInstance(work);
Vector3.releaseTempInstance(rightDir);
}
代码示例来源: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: Renanse/Ardor3D
public void stateChanged(final ChangeEvent e) {
final Rectangle3 rect = ((RectangleEmitter) getEdittedParticles().getParticleEmitter()).getSource();
final double width = _rectWidthPanel.getDoubleValue();
final Vector3 helper = Vector3.fetchTempInstance();
helper.set(rect.getA()).setX(-width / 2.0);
rect.setA(helper);
helper.set(rect.getB()).setX(width / 2.0);
rect.setB(helper);
helper.set(rect.getC()).setX(-width / 2.0);
rect.setC(helper);
Vector3.releaseTempInstance(helper);
}
});
代码示例来源:origin: Renanse/Ardor3D
public void stateChanged(final ChangeEvent e) {
final Rectangle3 rect = ((RectangleEmitter) getEdittedParticles().getParticleEmitter()).getSource();
final double height = _rectHeightPanel.getDoubleValue();
final Vector3 helper = Vector3.fetchTempInstance();
helper.set(rect.getA()).setZ(-height / 2.0);
rect.setA(helper);
helper.set(rect.getB()).setZ(-height / 2.0);
rect.setB(helper);
helper.set(rect.getC()).setZ(height / 2.0);
rect.setC(helper);
Vector3.releaseTempInstance(helper);
}
});
代码示例来源:origin: com.ardor3d/ardor3d-effects
@Override
public void prepare(final ParticleSystem system) {
_line.setOrigin(_axis.getOrigin());
_line.setDirection(_axis.getDirection());
final ReadOnlyMatrix3 mat = system.getEmitterTransform().getMatrix();
if (_transformWithScene && !mat.isIdentity()) {
final Vector3 temp = Vector3.fetchTempInstance();
mat.applyPost(_line.getOrigin(), temp);
_line.setOrigin(temp);
mat.applyPost(_line.getDirection(), temp);
_line.setDirection(temp);
Vector3.releaseTempInstance(temp);
}
if (_type == VT_CYLINDER) {
_rot.fromAngleAxis(-_divergence, _line.getDirection());
}
}
代码示例来源:origin: Renanse/Ardor3D
@Override
public void prepare(final ParticleSystem system) {
_line.setOrigin(_axis.getOrigin());
_line.setDirection(_axis.getDirection());
final ReadOnlyMatrix3 mat = system.getEmitterTransform().getMatrix();
if (_transformWithScene && !mat.isIdentity()) {
final Vector3 temp = Vector3.fetchTempInstance();
mat.applyPost(_line.getOrigin(), temp);
_line.setOrigin(temp);
mat.applyPost(_line.getDirection(), temp);
_line.setDirection(temp);
Vector3.releaseTempInstance(temp);
}
if (_type == VT_CYLINDER) {
_rot.fromAngleAxis(-_divergence, _line.getDirection());
}
}