com.jme3.scene.Mesh.getShortBuffer()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(91)

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

Mesh.getShortBuffer介绍

[英]Get the VertexBuffer data stored on this mesh in short format.
[中]获取存储在此网格上的短格式VertexBuffer数据。

代码示例

代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit

/** creates MeshData from mesh  */
public MeshData(Mesh mesh)
{
 this.maxNumOfWeights = mesh.getMaxNumWeights();
 vertexArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Position));
 normalArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Normal));
 int numOfTexcoordinates = 0;
 for (int i = 0; i < MAX_TEX_COORDS; i++)
 {
   if (mesh.getBuffer(Utilities.getTexCoordType(i)) != null) numOfTexcoordinates++;
 }
 this.uvArrays = new float[numOfTexcoordinates][];
 for (int i = 0; i < numOfTexcoordinates; i++)
 {
   uvArrays[i] = BufferUtils.getFloatArray(mesh.getFloatBuffer(Utilities.getTexCoordType(i)));
 }
 indexArray = Utilities.getShortArray(mesh.getShortBuffer(Type.Index));
 boneWeightArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.BoneWeight));
 VertexBuffer boneIndexBuffer = mesh.getBuffer(Type.BoneIndex);
 if (boneIndexBuffer != null) boneIndexArray = (Utilities.getByteArray((ByteBuffer) boneIndexBuffer.getData()));
}

代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit

/** creates MeshData from mesh  */
public MeshData(Mesh mesh)
{
 this.maxNumOfWeights = mesh.getMaxNumWeights();
 vertexArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Position));
 normalArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Normal));
 int numOfTexcoordinates = 0;
 for (int i = 0; i < MAX_TEX_COORDS; i++)
 {
   if (mesh.getBuffer(Utilities.getTexCoordType(i)) != null) numOfTexcoordinates++;
 }
 this.uvArrays = new float[numOfTexcoordinates][];
 for (int i = 0; i < numOfTexcoordinates; i++)
 {
   uvArrays[i] = BufferUtils.getFloatArray(mesh.getFloatBuffer(Utilities.getTexCoordType(i)));
 }
 indexArray = Utilities.getShortArray(mesh.getShortBuffer(Type.Index));
 boneWeightArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.BoneWeight));
 VertexBuffer boneIndexBuffer = mesh.getBuffer(Type.BoneIndex);
 if (boneIndexBuffer != null) boneIndexArray = (Utilities.getByteArray((ByteBuffer) boneIndexBuffer.getData()));
}

相关文章