热门标签 | 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());
}
}

推荐阅读
  • 本文介绍如何使用阿里云的fastjson库解析包含时间戳、IP地址和参数等信息的JSON格式文本,并进行数据处理和保存。 ... [详细]
  • 本文详细介绍了Java中org.neo4j.helpers.collection.Iterators.single()方法的功能、使用场景及代码示例,帮助开发者更好地理解和应用该方法。 ... [详细]
  • 本文详细探讨了JDBC(Java数据库连接)的内部机制,重点分析其作为服务提供者接口(SPI)框架的应用。通过类图和代码示例,展示了JDBC如何注册驱动程序、建立数据库连接以及执行SQL查询的过程。 ... [详细]
  • 本文探讨了如何通过一系列技术手段提升Spring Boot项目的并发处理能力,解决生产环境中因慢请求导致的系统性能下降问题。 ... [详细]
  • 利用YAML配置Resilience4J的Circuit Breaker
    本文探讨了Resilience4j作为现代Java应用程序中不可或缺的容错工具,特别介绍了如何通过YAML文件配置Circuit Breaker以提高服务的弹性和稳定性。 ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • 深入解析Spring Cloud Ribbon负载均衡机制
    本文详细介绍了Spring Cloud中的Ribbon组件如何实现服务调用的负载均衡。通过分析其工作原理、源码结构及配置方式,帮助读者理解Ribbon在分布式系统中的重要作用。 ... [详细]
  • 本文详细介绍了Akka中的BackoffSupervisor机制,探讨其在处理持久化失败和Actor重启时的应用。通过具体示例,展示了如何配置和使用BackoffSupervisor以实现更细粒度的异常处理。 ... [详细]
  • 2023年京东Android面试真题解析与经验分享
    本文由一位拥有6年Android开发经验的工程师撰写,详细解析了京东面试中常见的技术问题。涵盖引用传递、Handler机制、ListView优化、多线程控制及ANR处理等核心知识点。 ... [详细]
  • 从 .NET 转 Java 的自学之路:IO 流基础篇
    本文详细介绍了 Java 中的 IO 流,包括字节流和字符流的基本概念及其操作方式。探讨了如何处理不同类型的文件数据,并结合编码机制确保字符数据的正确读写。同时,文中还涵盖了装饰设计模式的应用,以及多种常见的 IO 操作实例。 ... [详细]
  • 本文介绍了在Windows环境下使用pydoc工具的方法,并详细解释了如何通过命令行和浏览器查看Python内置函数的文档。此外,还提供了关于raw_input和open函数的具体用法和功能说明。 ... [详细]
  • 本文详细介绍了中央电视台电影频道的节目预告,并通过专业工具分析了其加载方式,确保用户能够获取最准确的电视节目信息。 ... [详细]
  • 本文探讨了在Java多线程环境下,如何确保具有相同key值的线程能够互斥执行并按顺序输出结果。通过优化代码结构和使用线程安全的数据结构,我们解决了线程同步问题,并实现了预期的并发行为。 ... [详细]
  • 并发编程 12—— 任务取消与关闭 之 shutdownNow 的局限性
    Java并发编程实践目录并发编程01——ThreadLocal并发编程02——ConcurrentHashMap并发编程03——阻塞队列和生产者-消费者模式并发编程04——闭锁Co ... [详细]
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社区 版权所有