com.jme3.scene.Geometry.clone()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中com.jme3.scene.Geometry.clone()方法的一些代码示例,展示了Geometry.clone()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.clone()方法的具体详情如下:
包路径:com.jme3.scene.Geometry
类名称:Geometry
方法名:clone

Geometry.clone介绍

[英]This version of clone is a shallow clone, in other words, the same mesh is referenced as the original geometry. Exception: if the mesh is marked as being a software animated mesh, (bind pose is set) then the positions and normals are deep copied.
[中]此版本的克隆是浅层克隆,换句话说,将引用与原始几何体相同的网格。例外:如果网格标记为软件动画网格,(设置绑定姿势),则深度复制位置和法线。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * This version of clone is a shallow clone, in other words, the
 * same mesh is referenced as the original geometry.
 * Exception: if the mesh is marked as being a software
 * animated mesh, (bind pose is set) then the positions
 * and normals are deep copied.
 */
@Override
public Geometry clone() {
  return clone(true);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public ParticleEmitter clone(boolean cloneMaterial) {
  return (ParticleEmitter)super.clone(cloneMaterial);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public BitmapTextPage clone() {
  BitmapTextPage clone = (BitmapTextPage) super.clone();
  //clone.mesh = mesh.deepClone();
  return clone;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public Spatial oldDeepClone() {
  Geometry geomClone = clone(true);
  geomClone.mesh = mesh.deepClone();
  return geomClone;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private void createballs() {
  System.out.println((frames / time) + ";" + val);
  for (int i = val; i < val+1 ; i++) {
    Geometry s = sphere.clone().clone(false);
    s.setMaterial(mat);
    s.setLocalTranslation(i - 30, 5, (((i) * 2) % 40) - 50);
    s.setShadowMode(ShadowMode.CastAndReceive);
    rootNode.attachChild(s);
  }
  if (val == 300) {
    stop();
  }
  val += 1;
  time = 0;
  frames = 0;
}
float time;

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
   * Randomly Places a cube on the map between 30 and 90 paces away from player
   */
  private void randomizeCube() {
    Geometry cube = fcube.clone();
    int playerX = (int) player.getLocalTranslation().getX();
    int playerZ = (int) player.getLocalTranslation().getZ();
//        float x = FastMath.nextRandomInt(playerX + difficulty + 10, playerX + difficulty + 150);
    float x = FastMath.nextRandomInt(playerX + difficulty + 30, playerX + difficulty + 90);
    float z = FastMath.nextRandomInt(playerZ - difficulty - 50, playerZ + difficulty + 50);
    cube.getLocalTranslation().set(x, 0, z);

//        playerX+difficulty+30,playerX+difficulty+90

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    if (!solidBox){
      mat.getAdditionalRenderState().setWireframe(true);
    }
    mat.setColor("Color", obstacleColors.get(FastMath.nextRandomInt(0, obstacleColors.size() - 1)));
    cube.setMaterial(mat);

    rootNode.attachChild(cube);
    cubeField.add(cube);
  }

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (n == null) {
  n = new Node("DebugProbe");
  n.attachChild(debugGeom.clone(true));
  n.attachChild(debugBounds.clone(false));
  debugNode.attachChild(n);
  probeMapping.put(probe, n);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

geoms[i] = geomArray[i].clone(false);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

cube1.move(0, 1.5f, 0);      
Geometry cube2 = cube1.clone(true);
cube2.move(0.2f, 0 , 0);    
cube2.setQueueBucket(RenderQueue.Bucket.Transparent);
Geometry cube3 = cube1.clone();
Geometry cube4 = cube2.clone(true);
cube4.getMaterial().getAdditionalRenderState().setDepthFunc(RenderState.TestFunction.Less);       
cube3.move(0,-3,0);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void simpleInitApp() {
  Quad q = new Quad(1, 1);
  Geometry g = new Geometry("quad", q);
  g.setLocalTranslation(-500, -500, 0);
  g.setLocalScale(1000);
  rootNode.attachChild(g);
  cam.setLocation(new Vector3f(0.0f, 0.0f, 0.40647888f));
  cam.setRotation(new Quaternion(0.0f, 1.0f, 0.0f, 0.0f));
  Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/UnshadedNodes.j3md");
 //Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setColor("Color", ColorRGBA.Yellow);
  mat.setTexture("ColorMap", tex);
  g.setMaterial(mat);
  //place the geoms in the transparent bucket so that they are rendered back to front for maximum overdraw
  g.setQueueBucket(RenderQueue.Bucket.Transparent);
  for (int i = 0; i < 1000; i++) {
    Geometry cl = g.clone(false);
    cl.move(0, 0, -(i + 1));
    rootNode.attachChild(cl);
  }
  flyCam.setMoveSpeed(20);
  Logger.getLogger("com.jme3").setLevel(Level.WARNING);
  this.setAppProfiler(new Profiler());
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

ParticleEmitter clone = (ParticleEmitter) super.clone(cloneMaterial);
clone.shape = shape.deepClone();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

Geometry right = geom.clone();
right.move(width, 0, 0);
result.attachChild(right);
Geometry down = geom.clone();
down.move(0, bb.getCenter().y - bb.getYExtent() - 1, 0);
result.attachChild(down);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

Geometry clonePot = teapot.clone();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

for (int y = -5; y < 5; y++) {
  for (int x = -5; x < 5; x++) {
    Geometry clonePot = teapot.clone();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

for (int y = -f; y < f; y++) {
  for (int x = -f; x < f; x++) {
    Geometry clonePot = teapot.clone();

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * This version of clone is a shallow clone, in other words, the
 * same mesh is referenced as the original geometry.
 * Exception: if the mesh is marked as being a software
 * animated mesh, (bind pose is set) then the positions
 * and normals are deep copied.
 */
@Override
public Geometry clone() {
  return clone(true);
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * This version of clone is a shallow clone, in other words, the
 * same mesh is referenced as the original geometry.
 * Exception: if the mesh is marked as being a software
 * animated mesh, (bind pose is set) then the positions
 * and normals are deep copied.
 */
@Override
public Geometry clone() {
  return clone(true);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

Geometry b = boxGeo.clone(false);
cubeNodes.attachChild(b);
b.setLocalTranslation(p.getPosition().x, 2, p.getPosition().z);

代码示例来源:origin: org.jmonkeyengine/jme3-core

public Spatial oldDeepClone() {
  Geometry geomClone = clone(true);
  geomClone.mesh = mesh.deepClone();
  return geomClone;
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * Creates a deep clone of the geometry,
 * this creates an identical copy of the mesh
 * with the vertexbuffer data duplicated.
 */
@Override
public Spatial deepClone() {
  Geometry geomClone = clone(true);
  geomClone.mesh = mesh.deepClone();
  return geomClone;
}

相关文章