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

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

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

Geometry.setLocalScale介绍

暂无

代码示例

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

/**
 *  Sets the vertical scale of the visualization where
 *  each unit is a millisecond.  Defaults to 2, ie: a
 *  single millisecond stretches two pixels high.
 * @param scale the scale
 */
public void setGraphScale( float scale ) {
  if( this.scale == scale ) {
    return;
  }
  this.scale = scale;
  if( graph != null ) {
    graph.setLocalScale(1, scale, 1);            
  }
}

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

private void attachRandomGeometry(Node node, Material mat) {
  Box box = new Box(0.25f, 0.25f, 0.25f);
  Torus torus = new Torus(16, 16, 0.2f, 0.8f);
  Geometry[] boxes = new Geometry[]{
    new Geometry("box1", box),
    new Geometry("box2", box),
    new Geometry("box3", box),
    new Geometry("torus1", torus),
    new Geometry("torus2", torus),
    new Geometry("torus3", torus)
  };
  for (int i = 0; i < boxes.length; i++) {
    Geometry geometry = boxes[i];
    geometry.setLocalTranslation((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
    geometry.setLocalRotation(new Quaternion().fromAngles((float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI));
    geometry.setLocalScale((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
    geometry.setMaterial(mat);
    node.attachChild(geometry);
  }
}

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

@Override
  public void simpleUpdate(float tpf) {
    if (!done) {
      done = true;
      batch.attachChild(cube2);
      batch.batch();
    }
    updateBoindPoints(points);
    frustum.update(points);
    time += tpf;
    dl.setDirection(cam.getDirection());
    cube2.setLocalTranslation(FastMath.sin(-time) * 3, FastMath.cos(time) * 3, 0);
    cube2.setLocalRotation(new Quaternion().fromAngleAxis(time, Vector3f.UNIT_Z));
    cube2.setLocalScale(Math.max(FastMath.sin(time), 0.5f));

//        batch.setLocalRotation(new Quaternion().fromAngleAxis(time, Vector3f.UNIT_Z));

  }
//

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

probeGeom.setLocalScale(probeScale);
if (probe.isReady()) {
  m.setTexture("CubeMap", probe.getPrefilteredEnvMap());

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

@Override
protected void initialize( Application app ) {
  
  graph = new Geometry("profiler", profiler.getMesh());
  
  Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setBoolean("VertexColor", true);
  graph.setMaterial(mat);
  graph.setLocalTranslation(0, 300, 0);
  graph.setLocalScale(1, scale, 1);
        Mesh mesh = new Mesh();
  background = new Geometry("profiler.background", mesh);
  mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setBoolean("VertexColor", true);
  mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
  background.setMaterial(mat);
  background.setLocalTranslation(0, 300, -1);
  background.setLocalScale(1, scale, 1);        
  
  refreshBackground();
  
  InputManager inputManager = app.getInputManager();        
  if( inputManager != null ) { 
    inputManager.addMapping(INPUT_MAPPING_PROFILER_TOGGLE, new KeyTrigger(KeyInput.KEY_F6));
    inputManager.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE); 
  }               
}

代码示例来源: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

bulletg.setMaterial(matBullet);
bulletg.setLocalTranslation(cam.getLocation());
bulletg.setLocalScale(bulletSize);
bulletCollisionShape = new SphereCollisionShape(bulletSize);
RigidBodyControl bulletNode = new RigidBodyControl(bulletCollisionShape, bulletSize * 10);
bulletg.setMaterial(matBullet);
bulletg.setLocalTranslation(cam.getLocation());
bulletg.setLocalScale(bulletSize);
bulletCollisionShape = new SphereCollisionShape(bulletSize);
BombControl bulletNode = new BombControl(assetManager, bulletCollisionShape, 1);

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

@Override
public void simpleInitApp() {
  // create a simple plane/quad
  Quad quadMesh = new Quad(1, 1);
  quadMesh.updateGeometry(1, 1, true);
  Geometry quad = new Geometry("Textured Quad", quadMesh);
  assetManager.registerLocator("https://raw.githubusercontent.com/jMonkeyEngine/BookSamples/master/assets/Textures/",
              UrlLocator.class);
  TextureKey key = new TextureKey("mucha-window.png", false);
  key.setGenerateMips(true);
  Texture tex = assetManager.loadTexture(key);
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setTexture("ColorMap", tex);
  quad.setMaterial(mat);
  float aspect = tex.getImage().getWidth() / (float) tex.getImage().getHeight();
  quad.setLocalScale(new Vector3f(aspect * 1.5f, 1.5f, 1));
  quad.center();
  rootNode.attachChild(quad);
}

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

public void makeBoxWire(BoundingBox box) {
  Vector3f[] points = new Vector3f[8];
  for (int i = 0; i < 8; i++) {
    points[i] = new Vector3f();
  }
  points[0].set(-1, -1, 1);
  points[1].set(-1, 1, 1);
  points[2].set(1, 1, 1);
  points[3].set(1, -1, 1);
  points[4].set(-1, -1, -1);
  points[5].set(-1, 1, -1);
  points[6].set(1, 1, -1);
  points[7].set(1, -1, -1);
  WireFrustum frustumShape = new WireFrustum(points);
  aabbGeom = new Geometry("box", frustumShape);
  aabbGeom.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
  aabbGeom.getMaterial().getAdditionalRenderState().setWireframe(true);
  aabbGeom.setLocalTranslation(box.getCenter());
  aabbGeom.setLocalScale(box.getXExtent(), box.getYExtent(), box.getZExtent());
  rootNode.attachChild(aabbGeom);
}

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

clonePot.setLocalScale(.15f);

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

lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
lightMdl.setLocalTranslation(new Vector3f(77.70334f, 34.013165f, 27.1017f));
lightMdl.setLocalScale(5);
rootNode.attachChild(lightMdl);

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

clonePot.setLocalScale(.15f);
clonePot.setMaterial(mat);
rootNode.attachChild(clonePot);

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

clonePot.setLocalScale(.15f);

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

teapot.setLocalScale(2f);
Material mat2 = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat2.setFloat("Shininess", 25);

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

TangentBinormalGenerator.generate(teapot.getMesh(), true);
teapot.setLocalScale(2f);
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");

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

geom2.setMaterial(mat2);
rootNode.attachChild(geom2);
geom2.setLocalScale(0.1f, 0.2f, 1);

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

lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
lightMdl.setLocalTranslation(new Vector3f(77.70334f, 34.013165f, 27.1017f));
lightMdl.setLocalScale(5);
rootNode.attachChild(lightMdl);

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

/**
 *  Sets the vertical scale of the visualization where
 *  each unit is a millisecond.  Defaults to 2, ie: a
 *  single millisecond stretches two pixels high.
 * @param scale the scale
 */
public void setGraphScale( float scale ) {
  if( this.scale == scale ) {
    return;
  }
  this.scale = scale;
  if( graph != null ) {
    graph.setLocalScale(1, scale, 1);            
  }
}

代码示例来源:origin: org.cogchar/org.cogchar.lib.render.goody

@Override
  public Void call() throws Exception {
    for (BasicGoodyGeomBinding aGeomBinding : myGeomBindings) {
      Vector3f rotatedScale = aGeomBinding.myRotationOffset.mult(scaleVector);
      aGeomBinding.myGeometry.setLocalScale(rotatedScale);
    }
    return null;
  }
}, style);

代码示例来源:origin: tonihele/OpenKeeper

public static Geometry makeGeometry(Vector3f loc, Vector3f scl, Mesh mesh, Material mat, String name) {
  Geometry geom = new Geometry(name, mesh);
  geom.setMaterial(mat);
  geom.setLocalTranslation(loc);
  geom.setLocalScale(scl);
  return geom;
}

相关文章