本文整理汇总了Java中com.badlogic.gdx.graphics.GL20.GL_TRIANGLES属性的典型用法代码示例。如果您正苦于以下问题:Java GL20.GL_TRIANGLES属性的具体用法?Java GL20.GL_TRIANGLES怎么用?Java GL20.GL_TRIANGLES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.badlogic.gdx.graphics.GL20
的用法示例。
在下文中一共展示了GL20.GL_TRIANGLES属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
public static Renderable draw() {
Player player = Cubes.getClient().player;
ItemTool.MiningTarget currentlyMining = player.getCurrentlyMining();
if (currentlyMining == null)
return null;
BlockReference position = currentlyMining.target;
float percent = currentlyMining.time / currentlyMining.totalTime;
percent -= 1f / (1f + num);
if (percent <= 0f)
return null;
int n = (int) Math.floor(percent * num);
float f = 1f / 128f;
Renderable renderable = new Renderable();
renderable.worldTransform.translate(position.blockX - f, position.blockY - f, position.blockZ - f);
renderable.worldTransform.scl(1f + f + f);
renderable.meshPart.primitiveType = GL20.GL_TRIANGLES;
renderable.meshPart.offset = n * (6 * 6);
renderable.meshPart.size = 6 * 6;
renderable.meshPart.mesh = mesh;
renderable.material = material;
return renderable;
}
示例2: draw
public static Renderable draw() {
Player player = Cubes.getClient().player;
ItemTool.MiningTarget currentlyMining = player.getCurrentlyMining();
if (currentlyMining == null) return null;
BlockReference position = currentlyMining.target;
float percent = currentlyMining.time / currentlyMining.totalTime;
percent -= 1f / (1f + num);
if (percent <= 0f) return null;
int n = (int) Math.floor(percent * num);
float f = 1f / 128f;
Renderable renderable = new Renderable();
renderable.worldTransform.translate(position.blockX - f, position.blockY - f, position.blockZ - f);
renderable.worldTransform.scl(1f + f + f);
renderable.meshPart.primitiveType = GL20.GL_TRIANGLES;
renderable.meshPart.offset = n * (6 * 6);
renderable.meshPart.size = 6 * 6;
renderable.meshPart.mesh = mesh;
renderable.material = material;
return renderable;
}
示例3: AreaMesh
public AreaMesh(VertexAttributes vertexAttributes) {
mesh = new Mesh(true, MAX_VERTICES, MAX_INDICES, vertexAttributes);
meshPart = new MeshPart();
meshPart.mesh = mesh;
meshPart.primitiveType = GL20.GL_TRIANGLES;
meshPart.offset = 0;
mesh.setIndices(indices);
}
示例4: AreaMesh
public AreaMesh(VertexAttributes vertexAttributes) {
mesh = new Mesh(true, MAX_VERTICES, MAX_INDICES, vertexAttributes);
meshPart = new MeshPart();
meshPart.mesh = mesh;
meshPart.primitiveType = GL20.GL_TRIANGLES;
meshPart.offset = 0;
mesh.setIndices(indices);
}
示例5: loadRenderModel
private Model loadRenderModel(String name) {
if (models.containsKey(name)) return models.get(name);
// FIXME we load the models synchronously cause we are lazy
int error = 0;
PointerBuffer modelPointer = PointerBuffer.allocateDirect(1);
while (true) {
error = VRRenderModels.VRRenderModels_LoadRenderModel_Async(name, modelPointer);
if (error != VR.EVRRenderModelError_VRRenderModelError_Loading) break;
}
if (error != VR.EVRRenderModelError_VRRenderModelError_None) return null;
RenderModel renderModel = new RenderModel(modelPointer.getByteBuffer(RenderModel.SIZEOF));
error = 0;
PointerBuffer texturePointer = PointerBuffer.allocateDirect(1);
while (true) {
error = VRRenderModels.VRRenderModels_LoadTexture_Async(renderModel.diffuseTextureId(), texturePointer);
if (error != VR.EVRRenderModelError_VRRenderModelError_Loading) break;
}
if (error != VR.EVRRenderModelError_VRRenderModelError_None) {
VRRenderModels.VRRenderModels_FreeRenderModel(renderModel);
return null;
}
RenderModelTextureMap renderModelTexture = new RenderModelTextureMap(texturePointer.getByteBuffer(RenderModelTextureMap.SIZEOF));
// convert to a Model
Mesh mesh = new Mesh(true, renderModel.unVertexCount(), renderModel.unTriangleCount() * 3, VertexAttribute.Position(), VertexAttribute.Normal(), VertexAttribute.TexCoords(0));
MeshPart meshPart = new MeshPart(name, mesh, 0, renderModel.unTriangleCount() * 3, GL20.GL_TRIANGLES);
RenderModelVertex.Buffer vertices = renderModel.rVertexData();
float[] packedVertices = new float[8 * renderModel.unVertexCount()];
int i = 0;
while(vertices.remaining() > 0) {
RenderModelVertex v = vertices.get();
packedVertices[i++] = v.vPosition().v(0);
packedVertices[i++] = v.vPosition().v(1);
packedVertices[i++] = v.vPosition().v(2);
packedVertices[i++] = v.vNormal().v(0);
packedVertices[i++] = v.vNormal().v(1);
packedVertices[i++] = v.vNormal().v(2);
packedVertices[i++] = v.rfTextureCoord().get(0);
packedVertices[i++] = v.rfTextureCoord().get(1);
}
mesh.setVertices(packedVertices);
short[] indices = new short[renderModel.unTriangleCount() * 3];
renderModel.IndexData().get(indices);
mesh.setIndices(indices);
Pixmap pixmap = new Pixmap(renderModelTexture.unWidth(), renderModelTexture.unHeight(), Format.RGBA8888);
byte[] pixels = new byte[renderModelTexture.unWidth() * renderModelTexture.unHeight() * 4];
renderModelTexture.rubTextureMapData(pixels.length).get(pixels);
pixmap.getPixels().put(pixels);
pixmap.getPixels().position(0);
Texture texture = new Texture(new PixmapTextureData(pixmap, pixmap.getFormat(), true, true));
Material material = new Material(new TextureAttribute(TextureAttribute.Diffuse, texture));
Model model = new Model();
model.meshes.add(mesh);
model.meshParts.add(meshPart);
model.materials.add(material);
Node node = new Node();
node.id = name;
node.parts.add(new NodePart(meshPart, material));
model.nodes.add(node);
model.manageDisposable(mesh);
model.manageDisposable(texture);
VRRenderModels.VRRenderModels_FreeRenderModel(renderModel);
VRRenderModels.VRRenderModels_FreeTexture(renderModelTexture);
models.put(name, model);
return model;
}