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

推荐阅读
  • 本文探讨了如何通过一系列技术手段提升Spring Boot项目的并发处理能力,解决生产环境中因慢请求导致的系统性能下降问题。 ... [详细]
  • 本文介绍如何使用阿里云的fastjson库解析包含时间戳、IP地址和参数等信息的JSON格式文本,并进行数据处理和保存。 ... [详细]
  • 利用YAML配置Resilience4J的Circuit Breaker
    本文探讨了Resilience4j作为现代Java应用程序中不可或缺的容错工具,特别介绍了如何通过YAML文件配置Circuit Breaker以提高服务的弹性和稳定性。 ... [详细]
  • 本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • 本文详细介绍了Akka中的BackoffSupervisor机制,探讨其在处理持久化失败和Actor重启时的应用。通过具体示例,展示了如何配置和使用BackoffSupervisor以实现更细粒度的异常处理。 ... [详细]
  • 本文详细介绍了Java编程语言中的核心概念和常见面试问题,包括集合类、数据结构、线程处理、Java虚拟机(JVM)、HTTP协议以及Git操作等方面的内容。通过深入分析每个主题,帮助读者更好地理解Java的关键特性和最佳实践。 ... [详细]
  • 本文详细介绍了 Java 中 org.apache.xmlbeans.SchemaType 类的 getBaseEnumType() 方法,提供了多个代码示例,并解释了其在不同场景下的使用方法。 ... [详细]
  • 在Win10上利用VS2015构建Caffe2环境
    本文详细介绍如何在Windows 10操作系统上通过Visual Studio 2015编译Caffe2深度学习框架的过程。包括必要的软件安装、环境配置以及常见问题的解决方法。 ... [详细]
  • 本文详细介绍了如何解决Uploadify插件在Internet Explorer(IE)9和10版本中遇到的点击失效及JQuery运行时错误问题。通过修改相关JavaScript代码,确保上传功能在不同浏览器环境中的一致性和稳定性。 ... [详细]
  • c# – UWP:BrightnessOverride StartOverride逻辑 ... [详细]
  • 本文将详细介绍NSRunLoop的工作原理,包括其基本概念、消息类型(事件源)、运行模式、生命周期管理以及嵌套运行等关键知识点,帮助开发者更好地理解和应用这一重要技术。 ... [详细]
  • 本文探讨了在支付项目开发中使用SS5 Socket Server实现内部网络访问外部网络的技术方案。详细介绍了SS5的安装、配置及性能测试过程,旨在为面临相同需求的技术人员提供参考。 ... [详细]
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社区 版权所有