本文整理汇总了Java中com.jme3.scene.Mesh.getMode方法的典型用法代码示例。如果您正苦于以下问题:Java Mesh.getMode方法的具体用法?Java Mesh.getMode怎么用?Java Mesh.getMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.scene.Mesh
的用法示例。
在下文中一共展示了Mesh.getMode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BIHTree
import com.jme3.scene.Mesh; //导入方法依赖的package包/类
public BIHTree(Mesh mesh, int maxTrisPerNode) {
this.mesh = mesh;
this.maxTrisPerNode = maxTrisPerNode;
if (maxTrisPerNode < 1 || mesh == null) {
throw new IllegalArgumentException();
}
bihSwapTmp = new float[9];
FloatBuffer vb = (FloatBuffer) mesh.getBuffer(Type.Position).getData();
IndexBuffer ib = mesh.getIndexBuffer();
if (ib == null) {
ib = new VirtualIndexBuffer(mesh.getVertexCount(), mesh.getMode());
} else if (mesh.getMode() != Mode.Triangles) {
ib = new WrappedIndexBuffer(mesh);
}
numTris = ib.size() / 3;
initTriList(vb, ib);
}
示例2: WrappedIndexBuffer
import com.jme3.scene.Mesh; //导入方法依赖的package包/类
public WrappedIndexBuffer(Mesh mesh){
super(mesh.getVertexCount(), mesh.getMode());
this.ib = mesh.getIndexBuffer();
switch (meshMode){
case Points:
numIndices = mesh.getTriangleCount();
break;
case Lines:
case LineLoop:
case LineStrip:
numIndices = mesh.getTriangleCount() * 2;
break;
case Triangles:
case TriangleStrip:
case TriangleFan:
numIndices = mesh.getTriangleCount() * 3;
break;
default:
throw new UnsupportedOperationException();
}
}
示例3: drawTriangleList
import com.jme3.scene.Mesh; //导入方法依赖的package包/类
public void drawTriangleList(VertexBuffer indexBuf, Mesh mesh, int count) {
Mesh.Mode mode = mesh.getMode();
Buffer indexData = indexBuf.getData();
indexData.rewind();
if (mesh.getMode() == Mode.Hybrid) {
throw new UnsupportedOperationException();
/*
int[] modeStart = mesh.getModeStart();
int[] elementLengths = mesh.getElementLengths();
int elMode = convertElementMode(Mode.Triangles);
int fmt = convertVertexFormat(indexBuf.getFormat());
// int elSize = indexBuf.getFormat().getComponentSize();
// int listStart = modeStart[0];
int stripStart = modeStart[1];
int fanStart = modeStart[2];
int curOffset = 0;
for (int i = 0; i < elementLengths.length; i++) {
if (i == stripStart) {
elMode = convertElementMode(Mode.TriangleStrip);
} else if (i == fanStart) {
elMode = convertElementMode(Mode.TriangleStrip);
}
int elementLength = elementLengths[i];
indexData.position(curOffset);
drawElements(elMode,
fmt,
indexData);
curOffset += elementLength;
}*/
} else {
drawElements(convertElementMode(mode),
convertVertexFormat(indexBuf.getFormat()),
indexData);
}
}
示例4: convertToList
import com.jme3.scene.Mesh; //导入方法依赖的package包/类
public static void convertToList(Mesh mesh){
IndexBuffer inBuf = mesh.getIndicesAsList();
IndexBuffer outBuf = IndexBuffer.createIndexBuffer(mesh.getVertexCount(),
inBuf.size());
for (int i = 0; i < inBuf.size(); i++){
outBuf.put(i, inBuf.get(i));
}
mesh.clearBuffer(Type.Index);
switch (mesh.getMode()){
case LineLoop:
case LineStrip:
mesh.setMode(Mode.Lines);
break;
case TriangleStrip:
case TriangleFan:
mesh.setMode(Mode.Triangles);
break;
default:
break;
}
if (outBuf instanceof IndexIntBuffer){
mesh.setBuffer(Type.Index, 3, (IntBuffer)outBuf.getBuffer());
}else{
mesh.setBuffer(Type.Index, 3, (ShortBuffer)outBuf.getBuffer());
}
}
示例5: generate
import com.jme3.scene.Mesh; //导入方法依赖的package包/类
public static void generate(Mesh mesh, boolean approxTangents) {
int[] index = new int[3];
Vector3f[] v = new Vector3f[3];
Vector2f[] t = new Vector2f[3];
for (int i = 0; i < 3; i++) {
v[i] = new Vector3f();
t[i] = new Vector2f();
}
if (mesh.getBuffer(Type.Normal) == null){
throw new IllegalArgumentException("The given mesh has no normal data!");
}
VertexData[] vertices;
switch (mesh.getMode()) {
case Triangles:
vertices = processTriangles(mesh, index, v, t); break;
case TriangleStrip:
vertices = processTriangleStrip(mesh, index, v, t); break;
case TriangleFan:
vertices = processTriangleFan(mesh, index, v, t); break;
default: throw new UnsupportedOperationException(
mesh.getMode() + " is not supported.");
}
processTriangleData(mesh, vertices, approxTangents);
}
示例6: buildForImpl
import com.jme3.scene.Mesh; //导入方法依赖的package包/类
@Override
@FXThread
protected void buildForImpl(@NotNull final Object object, @Nullable final Object parent, @NotNull final VBox container,
@NotNull final ModelChangeConsumer changeConsumer) {
if (!(object instanceof Mesh)) return;
final Mesh mesh = (Mesh) object;
final Mesh.Mode mode = mesh.getMode();
final int id = mesh.getId();
final int instanceCount = mesh.getInstanceCount();
final int vertexCount = mesh.getVertexCount();
final int numLodLevels = mesh.getNumLodLevels();
final int triangleCount = mesh.getTriangleCount();
final DefaultSinglePropertyControl<ModelChangeConsumer, Mesh, Integer> idControl =
new DefaultSinglePropertyControl<>(id, Messages.MODEL_PROPERTY_ID, changeConsumer);
idControl.setSyncHandler(Mesh::getId);
idControl.setToStringFunction(value -> Integer.toString(value));
idControl.setEditObject(mesh);
final DefaultSinglePropertyControl<ModelChangeConsumer, Mesh, Integer> instanceCountControl =
new DefaultSinglePropertyControl<>(instanceCount, Messages.MODEL_PROPERTY_INSTANCE_COUNT, changeConsumer);
instanceCountControl.setSyncHandler(Mesh::getInstanceCount);
instanceCountControl.setToStringFunction(value -> Integer.toString(value));
instanceCountControl.setEditObject(mesh);
final DefaultSinglePropertyControl<ModelChangeConsumer, Mesh, Integer> vertexCountControl =
new DefaultSinglePropertyControl<>(vertexCount, Messages.MODEL_PROPERTY_VERTEX_COUNT, changeConsumer);
vertexCountControl.setSyncHandler(Mesh::getVertexCount);
vertexCountControl.setToStringFunction(value -> Integer.toString(value));
vertexCountControl.setEditObject(mesh);
final DefaultSinglePropertyControl<ModelChangeConsumer, Mesh, Integer> triangleCountControl =
new DefaultSinglePropertyControl<>(triangleCount, Messages.MODEL_PROPERTY_TRIANGLE_COUNT, changeConsumer);
triangleCountControl.setSyncHandler(Mesh::getTriangleCount);
triangleCountControl.setToStringFunction(value -> Integer.toString(value));
triangleCountControl.setEditObject(mesh);
final DefaultSinglePropertyControl<ModelChangeConsumer, Mesh, Integer> numLodLevelsControl =
new DefaultSinglePropertyControl<>(numLodLevels, Messages.MODEL_PROPERTY_NUM_LOD_LEVELS, changeConsumer);
numLodLevelsControl.setSyncHandler(Mesh::getNumLodLevels);
numLodLevelsControl.setToStringFunction(value -> Integer.toString(value));
numLodLevelsControl.setEditObject(mesh);
final EnumPropertyControl<ModelChangeConsumer, Mesh, Mesh.Mode> modeControl =
new EnumPropertyControl<>(mode, Messages.MODEL_PROPERTY_MODE, changeConsumer, MODES);
modeControl.setApplyHandler(Mesh::setMode);
modeControl.setSyncHandler(Mesh::getMode);
modeControl.setEditObject(mesh);
FXUtils.addToPane(idControl, container);
FXUtils.addToPane(instanceCountControl, container);
FXUtils.addToPane(vertexCountControl, container);
FXUtils.addToPane(triangleCountControl, container);
FXUtils.addToPane(numLodLevelsControl, container);
FXUtils.addToPane(modeControl, container);
}
示例7: generate
import com.jme3.scene.Mesh; //导入方法依赖的package包/类
public static void generate(Mesh mesh, boolean approxTangents, boolean splitMirrored) {
int[] index = new int[3];
Vector3f[] v = new Vector3f[3];
Vector2f[] t = new Vector2f[3];
for (int i = 0; i < 3; i++) {
v[i] = new Vector3f();
t[i] = new Vector2f();
}
if (mesh.getBuffer(Type.Normal) == null) {
throw new IllegalArgumentException("The given mesh has no normal data!");
}
List<VertexData> vertices;
switch (mesh.getMode()) {
case Triangles:
vertices = processTriangles(mesh, index, v, t, splitMirrored);
if (splitMirrored) {
splitVertices(mesh, vertices, splitMirrored);
}
break;
case TriangleStrip:
vertices = processTriangleStrip(mesh, index, v, t);
break;
case TriangleFan:
vertices = processTriangleFan(mesh, index, v, t);
break;
default:
throw new UnsupportedOperationException(mesh.getMode() + " is not supported.");
}
processTriangleData(mesh, vertices, approxTangents, splitMirrored);
// if the mesh has a bind pose, we need to generate the bind pose for the tangent buffer
if (mesh.getBuffer(Type.BindPosePosition) != null) {
VertexBuffer tangents = mesh.getBuffer(Type.Tangent);
if (tangents != null) {
VertexBuffer bindTangents = new VertexBuffer(Type.BindPoseTangent);
bindTangents.setupData(Usage.CpuOnly, 4, Format.Float, BufferUtils.clone(tangents.getData()));
if (mesh.getBuffer(Type.BindPoseTangent) != null) {
mesh.clearBuffer(Type.BindPoseTangent);
}
mesh.setBuffer(bindTangents);
tangents.setUsage(Usage.Stream);
}
}
}