本文整理汇总了Java中com.jme3.scene.VertexBuffer.getNumElements方法的典型用法代码示例。如果您正苦于以下问题:Java VertexBuffer.getNumElements方法的具体用法?Java VertexBuffer.getNumElements怎么用?Java VertexBuffer.getNumElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.scene.VertexBuffer
的用法示例。
在下文中一共展示了VertexBuffer.getNumElements方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateItem
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
@Override
protected void updateItem(@Nullable final Integer level, final boolean empty) {
super.updateItem(level, empty);
final Geometry geometry = getEditObject();
final Mesh mesh = geometry.getMesh();
if (level == null || mesh == null) {
setText("None");
return;
}
int elements;
if (level < mesh.getNumLodLevels()) {
final VertexBuffer lodLevel = mesh.getLodLevel(level);
elements = lodLevel.getNumElements();
} else {
elements = mesh.getTriangleCount();
}
setText(Messages.MODEL_PROPERTY_LEVEL + ": " + level + " (" + elements + " " +
Messages.MODEL_PROPERTY_TRIANGLE_COUNT + ")");
}
示例2: printMesh
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public static void printMesh(Mesh mesh) {
for (int bufType = 0; bufType < Type.values().length; bufType++) {
VertexBuffer outBuf = mesh.getBuffer(Type.values()[bufType]);
if (outBuf == null) {
continue;
}
System.out.println(outBuf.getBufferType() + ": ");
for (int vert = 0; vert < outBuf.getNumElements(); vert++) {
String str = "[";
for (int comp = 0; comp < outBuf.getNumComponents(); comp++) {
Object val = outBuf.getElementComponent(vert, comp);
outBuf.setElementComponent(vert, comp, val);
val = outBuf.getElementComponent(vert, comp);
str += val;
if (comp != outBuf.getNumComponents() - 1) {
str += ", ";
}
}
str += "]";
System.out.println(str);
}
System.out.println("------");
}
}
示例3: getVector3f
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public static Vector3f getVector3f(VertexBuffer v,int id){
if(v==null||v.getNumElements()<=id){
return new Vector3f();
}
return new Vector3f((float)v.getElementComponent(id, 0),
(float)v.getElementComponent(id, 1),
(float)v.getElementComponent(id, 2));
}
示例4: SharedBuffer
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
/**
* Creates a shared buffer from the specified vertex buffer
* @param vertexBuffer the vertex buffer to use
*/
public SharedBuffer(VertexBuffer vertexBuffer) {
this.jmeBuffer = vertexBuffer;
this.format = vertexBuffer.getFormat();
this.type = vertexBuffer.getBufferType();
this.components = vertexBuffer.getNumComponents();
this.size = vertexBuffer.getNumElements();
}
示例5: getVertices
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
/**
* Get vertcices of mesh.
*
* @param mesh
* @return
*/
public static Vector3f[] getVertices(Mesh mesh) {
VertexBuffer buffer = mesh.getBuffer(VertexBuffer.Type.Position);
Vector3f[] array = new Vector3f[buffer.getNumElements()];
for (int i = 0; i < buffer.getNumElements(); i++) {
array[i] = new Vector3f();
array[i].setX((Float) buffer.getElementComponent(i, 0));
array[i].setY((Float) buffer.getElementComponent(i, 1));
array[i].setZ((Float) buffer.getElementComponent(i, 2));
}
return array;
}