本文整理汇总了Java中com.badlogic.gdx.graphics.VertexAttributes.findByUsage方法的典型用法代码示例。如果您正苦于以下问题:Java VertexAttributes.findByUsage方法的具体用法?Java VertexAttributes.findByUsage怎么用?Java VertexAttributes.findByUsage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.VertexAttributes
的用法示例。
在下文中一共展示了VertexAttributes.findByUsage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: begin
import com.badlogic.gdx.graphics.VertexAttributes; //导入方法依赖的package包/类
/** Begin building a mesh */
public void begin (final VertexAttributes attributes, int primitiveType) {
if (this.attributes != null) throw new RuntimeException("Call end() first");
this.attributes = attributes;
this.vertices.clear();
this.indices.clear();
this.parts.clear();
this.vindex = 0;
this.istart = 0;
this.part = null;
this.stride = attributes.vertexSize / 4;
this.vertex = new float[stride];
VertexAttribute a = attributes.findByUsage(Usage.Position);
if (a == null) throw new GdxRuntimeException("Cannot build mesh without position attribute");
posOffset = a.offset / 4;
posSize = a.numComponents;
a = attributes.findByUsage(Usage.Normal);
norOffset = a == null ? -1 : a.offset / 4;
a = attributes.findByUsage(Usage.Color);
colOffset = a == null ? -1 : a.offset / 4;
colSize = a == null ? 0 : a.numComponents;
a = attributes.findByUsage(Usage.ColorPacked);
cpOffset = a == null ? -1 : a.offset / 4;
a = attributes.findByUsage(Usage.TextureCoordinates);
uvOffset = a == null ? -1 : a.offset / 4;
setColor(null);
setVertexTransform(null);
this.primitiveType = primitiveType;
}
示例2: begin
import com.badlogic.gdx.graphics.VertexAttributes; //导入方法依赖的package包/类
/** Begin building a mesh */
public void begin(final VertexAttributes attributes, int primitiveType) {
if (this.attributes != null)
throw new RuntimeException("Call end() first");
this.attributes = attributes;
this.vertices.clear();
this.indices.clear();
this.parts.clear();
this.vindex = 0;
this.istart = 0;
this.part = null;
this.stride = attributes.vertexSize / 4;
this.vertex = new float[stride];
VertexAttribute a = attributes.findByUsage(Usage.Position);
if (a == null)
throw new GdxRuntimeException("Cannot build mesh without position attribute");
posOffset = a.offset / 4;
posSize = a.numComponents;
a = attributes.findByUsage(Usage.Normal);
norOffset = a == null ? -1 : a.offset / 4;
a = attributes.findByUsage(Usage.ColorUnpacked);
colOffset = a == null ? -1 : a.offset / 4;
colSize = a == null ? 0 : a.numComponents;
a = attributes.findByUsage(Usage.ColorPacked);
cpOffset = a == null ? -1 : a.offset / 4;
a = attributes.findByUsage(Usage.TextureCoordinates);
uvOffset = a == null ? -1 : a.offset / 4;
setColor(null);
this.primitiveType = primitiveType;
}