本文整理汇总了Java中com.jme3.scene.VertexBuffer.getStride方法的典型用法代码示例。如果您正苦于以下问题:Java VertexBuffer.getStride方法的具体用法?Java VertexBuffer.getStride怎么用?Java VertexBuffer.getStride使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.scene.VertexBuffer
的用法示例。
在下文中一共展示了VertexBuffer.getStride方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateVertexArray
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public void updateVertexArray(Mesh mesh) {
int id = mesh.getId();
if (id == -1) {
IntBuffer temp = intBuf1;
ARBVertexArrayObject.glGenVertexArrays(temp);
id = temp.get(0);
mesh.setId(id);
}
if (context.boundVertexArray != id) {
ARBVertexArrayObject.glBindVertexArray(id);
context.boundVertexArray = id;
}
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
IntMap<VertexBuffer> buffers = mesh.getBuffers();
for (Entry<VertexBuffer> entry : buffers) {
VertexBuffer vb = entry.getValue();
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
} else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
}
}
示例2: renderMeshDefault
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void renderMeshDefault(Mesh mesh, int lod, int count) {
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
IntMap<VertexBuffer> buffers = mesh.getBuffers();
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = buffers.get(Type.Index.ordinal());
}
for (Entry<VertexBuffer> entry : buffers) {
VertexBuffer vb = entry.getValue();
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly) // ignore cpu-only buffers
{
continue;
}
if (vb.getBufferType() == Type.Index) {
indices = vb;
} else {
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
} else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
}
}
if (indices != null) {
drawTriangleList(indices, mesh, count);
} else {
gl.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
}
clearVertexAttribs();
clearTextureUnits();
}
示例3: renderMeshVBO
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void renderMeshVBO(Mesh mesh, int lod, int count) {
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
IntMap<VertexBuffer> buffers = mesh.getBuffers();
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = buffers.get(Type.Index.ordinal());
}
for (Entry<VertexBuffer> entry : buffers) {
VertexBuffer vb = entry.getValue();
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttribVBO(vb, null);
} else {
// interleaved
setVertexAttribVBO(vb, interleavedData);
}
}
if (indices != null) {
drawTriangleListVBO(indices, mesh, count);
} else {
gl.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
}
clearVertexAttribs();
clearTextureUnits();
}
示例4: renderMeshDefault
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void renderMeshDefault(Mesh mesh, int lod, int count) {
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
//IntMap<VertexBuffer> buffers = mesh.getBuffers();
ArrayList<VertexBuffer> buffersList = mesh.getBufferList();
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = mesh.getBuffer(Type.Index);
}
//for (Entry<VertexBuffer> entry : buffers) {
// VertexBuffer vb = entry.getValue();
for (int i = 0; i < buffersList.size(); i++){
VertexBuffer vb = buffersList.get(i);
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
} else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
}
if (indices != null) {
drawTriangleList(indices, mesh, count);
} else {
drawTriangleArray(mesh.getMode(), count, mesh.getVertexCount());
}
clearVertexAttribs();
clearTextureUnits();
}
示例5: renderMeshDefault
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void renderMeshDefault(Mesh mesh, int lod, int count) {
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
IntMap<VertexBuffer> buffers = mesh.getBuffers();
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = buffers.get(Type.Index.ordinal());
}
for (Entry<VertexBuffer> entry : buffers) {
VertexBuffer vb = entry.getValue();
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
} else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
}
if (indices != null) {
drawTriangleList(indices, mesh, count);
} else {
glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
}
// TODO: Fix these to use IDList??
clearVertexAttribs();
clearTextureUnits();
clearSetFixedFuncBindings();
}
示例6: updateVertexArray
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public void updateVertexArray(Mesh mesh) {
logger.log(Level.INFO, "updateVertexArray({0})", mesh);
int id = mesh.getId();
/*
if (id == -1){
IntBuffer temp = intBuf1;
// ARBVertexArrayObject.glGenVertexArrays(temp);
GLES20.glGenVertexArrays(temp);
id = temp.get(0);
mesh.setId(id);
}
if (context.boundVertexArray != id){
// ARBVertexArrayObject.glBindVertexArray(id);
GLES20.glBindVertexArray(id);
context.boundVertexArray = id;
}
*/
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
SafeArrayList<VertexBuffer> buffersList = mesh.getBufferList();
for (int i = 0; i < buffersList.size(); i++) {
VertexBuffer vb = buffersList.get(i);
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
} else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
}
}
示例7: renderMeshVertexArray
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
/**
* renderMeshVertexArray renders a mesh using vertex arrays
* @param mesh
* @param lod
* @param count
*/
private void renderMeshVertexArray(Mesh mesh, int lod, int count) {
if (verboseLogging) {
logger.info("renderMeshVertexArray");
}
// IntMap<VertexBuffer> buffers = mesh.getBuffers();
IntMap<VertexBuffer> buffers = mesh.getBuffers();
IntMap.Entry<VertexBuffer> table[] = buffers.getTable();
for (IntMap.Entry<VertexBuffer> entry : table) {
if (entry == null) {
continue;
}
VertexBuffer vb = entry.getValue();
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib_Array(vb);
} else {
// interleaved
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
setVertexAttrib_Array(vb, interleavedData);
}
}
VertexBuffer indices = null;
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = mesh.getBuffer(Type.Index);//buffers.get(Type.Index.ordinal());
}
clearVertexAttribs();
// clearTextureUnits();
if (indices != null) {
drawTriangleList_Array(indices, mesh, count);
} else {
if (verboseLogging) {
logger.log(Level.INFO, "GLES20.glDrawArrays({0}, {1}, {2})",
new Object[]{mesh.getMode(), 0, mesh.getVertexCount()});
}
Gdx.gl20.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
}
}
示例8: renderMeshDefault
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void renderMeshDefault(Mesh mesh, int lod, int count) {
if (verboseLogging) {
logger.log(Level.INFO, "renderMeshDefault({0}, {1}, {2})",
new Object[]{mesh, lod, count});
}
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
//IntMap<VertexBuffer> buffers = mesh.getBuffers(); ;
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = mesh.getBuffer(Type.Index);// buffers.get(Type.Index.ordinal());
}
SafeArrayList<VertexBuffer> buffersList = mesh.getBufferList();
for (int i = 0; i < buffersList.size(); i++) {
VertexBuffer vb = buffersList.get(i);
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
} else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
}
clearVertexAttribs();
// clearTextureUnits();
if (indices != null) {
drawTriangleList(indices, mesh, count);
} else {
// throw new UnsupportedOperationException("Cannot render without index buffer");
if (verboseLogging) {
logger.log(Level.INFO, "GLES20.glDrawArrays({0}, 0, {1})",
new Object[]{convertElementMode(mesh.getMode()), mesh.getVertexCount()});
}
Gdx.gl20.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
}
}
示例9: renderMeshVertexArray
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
/**
* renderMeshVertexArray renders a mesh using vertex arrays
* @param mesh
* @param lod
* @param count
*/
private void renderMeshVertexArray(Mesh mesh, int lod, int count) {
if (verboseLogging) {
logger.info("renderMeshVertexArray");
}
// IntMap<VertexBuffer> buffers = mesh.getBuffers();
IntMap<VertexBuffer> buffers = mesh.getBuffers();
IntMap.Entry<VertexBuffer> table[] = buffers.getTable();
for (IntMap.Entry<VertexBuffer> entry : table) {
if (entry == null) {
continue;
}
VertexBuffer vb = entry.getValue();
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib_Array(vb);
} else {
// interleaved
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
setVertexAttrib_Array(vb, interleavedData);
}
}
VertexBuffer indices = null;
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = mesh.getBuffer(Type.Index);//buffers.get(Type.Index.ordinal());
}
clearVertexAttribs();
// clearTextureUnits();
if (indices != null) {
drawTriangleList_Array(indices, mesh, count);
} else {
if (verboseLogging) {
logger.log(Level.INFO, "GLES20.glDrawArrays({0}, {1}, {2})",
new Object[]{mesh.getMode(), 0, mesh.getVertexCount()});
}
GLES20.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
}
}
示例10: renderMeshDefault
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void renderMeshDefault(Mesh mesh, int lod, int count) {
if (verboseLogging) {
logger.log(Level.INFO, "renderMeshDefault({0}, {1}, {2})",
new Object[]{mesh, lod, count});
}
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
//IntMap<VertexBuffer> buffers = mesh.getBuffers(); ;
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = mesh.getBuffer(Type.Index);// buffers.get(Type.Index.ordinal());
}
SafeArrayList<VertexBuffer> buffersList = mesh.getBufferList();
for (int i = 0; i < buffersList.size(); i++) {
VertexBuffer vb = buffersList.get(i);
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
} else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
}
clearVertexAttribs();
// clearTextureUnits();
if (indices != null) {
drawTriangleList(indices, mesh, count);
} else {
// throw new UnsupportedOperationException("Cannot render without index buffer");
if (verboseLogging) {
logger.log(Level.INFO, "GLES20.glDrawArrays({0}, 0, {1})",
new Object[]{convertElementMode(mesh.getMode()), mesh.getVertexCount()});
}
GLES20.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
}
}
示例11: renderMeshDefault
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
protected void renderMeshDefault(Mesh mesh, int lod, int count) {
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
IntMap<VertexBuffer> buffers = mesh.getBuffers();
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
}
else {
indices = buffers.get(Type.Index.ordinal());
}
for (Entry<VertexBuffer> entry : buffers) {
VertexBuffer vb = entry.getValue();
if (vb.getBufferType() == Type.InterleavedData || vb.getUsage() == Usage.CpuOnly
|| vb.getBufferType() == Type.Index) {
continue;
}
/*if (vb.getBufferType() == Type.Index) {
indices = vb;
}
else {*/
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
}
else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
/*}*/
}
if (indices != null) {
drawTriangleList(indices, mesh, count);
}
else {
drawArrays(mesh);
}
clearVertexAttribs();
clearTextureUnits();
}
示例12: renderMeshVBO
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
protected void renderMeshVBO(Mesh mesh, int lod, int count) {
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
IntMap<VertexBuffer> buffers = mesh.getBuffers();
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
}
else {
indices = buffers.get(Type.Index.ordinal());
}
for (Entry<VertexBuffer> entry : buffers) {
VertexBuffer vb = entry.getValue();
if (vb.getBufferType() == Type.InterleavedData || vb.getUsage() == Usage.CpuOnly // ignore
// cpu-only
// buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttribVBO(vb, null);
}
else {
// interleaved
setVertexAttribVBO(vb, interleavedData);
}
}
if (indices != null) {
drawTriangleListVBO(indices, mesh, count);
}
else {
drawArrays(mesh);
}
clearVertexAttribs();
clearTextureUnits();
}
示例13: renderMeshDefault
import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void renderMeshDefault(Mesh mesh, int lod, int count) {
VertexBuffer indices = null;
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
updateBufferData(interleavedData);
}
//IntMap<VertexBuffer> buffers = mesh.getBuffers();
SafeArrayList<VertexBuffer> buffersList = mesh.getBufferList();
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = mesh.getBuffer(Type.Index);
}
//for (Entry<VertexBuffer> entry : buffers) {
// VertexBuffer vb = entry.getValue();
for (int i = 0; i < buffersList.size(); i++){
VertexBuffer vb = buffersList.get(i);
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
|| vb.getBufferType() == Type.Index) {
continue;
}
if (vb.getStride() == 0) {
// not interleaved
setVertexAttrib(vb);
} else {
// interleaved
setVertexAttrib(vb, interleavedData);
}
}
if (indices != null) {
drawTriangleList(indices, mesh, count);
} else {
drawTriangleArray(mesh.getMode(), count, mesh.getVertexCount());
}
clearVertexAttribs();
clearTextureUnits();
}