热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.ardor3d.math.Vector3.releaseTempInstance()方法的使用及代码示例

本文整理了Java中com.ardor3d.math.Vector3.releaseTempInstance()方法的一些代码示例,展示了Vector3.r

本文整理了Java中com.ardor3d.math.Vector3.releaseTempInstance()方法的一些代码示例,展示了Vector3.releaseTempInstance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector3.releaseTempInstance()方法的具体详情如下:
包路径:com.ardor3d.math.Vector3
类名称:Vector3
方法名:releaseTempInstance

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 BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 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 BufferUtils.setInBuffer(tempVec3, vertexBuffer, startIndex + 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());
}
}

推荐阅读
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 在前两篇文章中,我们探讨了 ControllerDescriptor 和 ActionDescriptor 这两个描述对象,分别对应控制器和操作方法。本文将基于 MVC3 源码进一步分析 ParameterDescriptor,即用于描述 Action 方法参数的对象,并详细介绍其工作原理。 ... [详细]
  • 本文详细介绍了 Apache Jena 库中的 Txn.executeWrite 方法,通过多个实际代码示例展示了其在不同场景下的应用,帮助开发者更好地理解和使用该方法。 ... [详细]
  • 2023年京东Android面试真题解析与经验分享
    本文由一位拥有6年Android开发经验的工程师撰写,详细解析了京东面试中常见的技术问题。涵盖引用传递、Handler机制、ListView优化、多线程控制及ANR处理等核心知识点。 ... [详细]
  • 本文介绍如何使用阿里云的fastjson库解析包含时间戳、IP地址和参数等信息的JSON格式文本,并进行数据处理和保存。 ... [详细]
  • 不确定性|放入_华为机试题 HJ9提取不重复的整数
    不确定性|放入_华为机试题 HJ9提取不重复的整数 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • 本文深入探讨了 Java 中的 Serializable 接口,解释了其实现机制、用途及注意事项,帮助开发者更好地理解和使用序列化功能。 ... [详细]
  • 本文详细介绍了Java编程语言中的核心概念和常见面试问题,包括集合类、数据结构、线程处理、Java虚拟机(JVM)、HTTP协议以及Git操作等方面的内容。通过深入分析每个主题,帮助读者更好地理解Java的关键特性和最佳实践。 ... [详细]
  • 本文详细介绍了如何构建一个高效的UI管理系统,集中处理UI页面的打开、关闭、层级管理和页面跳转等问题。通过UIManager统一管理外部切换逻辑,实现功能逻辑分散化和代码复用,支持多人协作开发。 ... [详细]
  • 从 .NET 转 Java 的自学之路:IO 流基础篇
    本文详细介绍了 Java 中的 IO 流,包括字节流和字符流的基本概念及其操作方式。探讨了如何处理不同类型的文件数据,并结合编码机制确保字符数据的正确读写。同时,文中还涵盖了装饰设计模式的应用,以及多种常见的 IO 操作实例。 ... [详细]
  • 本文介绍了在Windows环境下使用pydoc工具的方法,并详细解释了如何通过命令行和浏览器查看Python内置函数的文档。此外,还提供了关于raw_input和open函数的具体用法和功能说明。 ... [详细]
  • 本文详细介绍了 Java 中 org.apache.xmlbeans.SchemaType 类的 getBaseEnumType() 方法,提供了多个代码示例,并解释了其在不同场景下的使用方法。 ... [详细]
  • 本文探讨了在C++中如何有效地清空输入缓冲区,确保程序只处理最近的输入并丢弃多余的输入。我们将介绍一种不阻塞的方法,并提供一个具体的实现方案。 ... [详细]
author-avatar
高德福瑞
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有