JmonkeyEngine에서 x, y, z가 범위 0..100 인 10000 개의 무작위 3D 점을 플롯하는 방법에 대한 예를 제공 할 수 있습니까? java3D 대신 Jmonkey를 사용하도록 제안되었습니다. 나는 둘 다 새로운입니다. 감사합니다.Java : JMonkey에서 3D 점을 플롯
1
A
답변
1
이것은 JMonkey2에서 작성되었습니다. 다음은 10000 개의 구체를 0에서 100으로 만듭니다. 이것은 거의 완전한 상자로 끝납니다. WASD를 사용하여 카메라를 제어하십시오.
package wall;
import java.util.Random;
import java.util.concurrent.Callable;
import com.jme.math.Vector3f;
import com.jme.scene.shape.Sphere;
import com.jme.util.GameTaskQueueManager;
import com.jmex.editors.swing.settings.GameSettingsPanel;
import com.jmex.game.StandardGame;
import com.jmex.game.state.DebugGameState;
import com.jmex.game.state.GameStateManager;
public final class SphereExample {
private static final int MAX = 100;
private static final int TOTAL = 10000;
public static void setupGame() {
final DebugGameState state = new DebugGameState() {
@Override
public void update(final float timeStep) {
// Update the game state
super.update(timeStep);
}
};
final Random random = new Random();
for (int i = 0; i < TOTAL; i++) {
final Sphere sphere = new Sphere("sphere", 5, 5, 1);
sphere.setLocalTranslation(random.nextInt(MAX),
random.nextInt(MAX), random.nextInt(MAX));
sphere.updateRenderState();
state.getRootNode().attachChild(sphere);
}
GameStateManager.getInstance().attachChild(state);
state.setActive(true);
}
public static void main(final String[] args) throws Exception {
final StandardGame game = new StandardGame("Points");
if (GameSettingsPanel.prompt(game.getSettings())) {
game.start();
GameTaskQueueManager.getManager().update(
new Callable<Void>() {
@Override
public Void call() throws Exception {
setupGame();
game.getCamera() // moves the camera to the middle
// of the spheres
.setFrame(
new Vector3f(50.0f,
50.0f, 50.0f),
new Vector3f(-1.0f, 0.0f,
0.0f),
new Vector3f(0.0f, 1.0f,
0.0f),
new Vector3f(0.0f, 0.0f,
-1.0f));
game.getCamera().update();
game.getCamera().apply();
return null;
}
});
}
}
}
+0
fps는 무엇입니까? –
+0
참고; Jmonkey2는 천천히 감가 상각되고 있습니다. Jmonkey3은 기술적으로 아직 베타 버전이지만 늦은 베타 버전입니다. –
지금까지 무엇을 얻었습니까? SDK에 포함 된 일부 자습서 또는 샘플을 따라 응용 프로그램을 실행하고 일부 쿼드를 렌더링하고 카메라 등을 제공하십시오. – Torious