Skip to content

Commit

Permalink
TestMergeMeshes: various refactoring and whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Apr 23, 2024
1 parent b8e2d39 commit 557e401
Showing 1 changed file with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2022-2023, Stephen Gold
Copyright (c) 2022-2024 Stephen Gold
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -73,6 +73,18 @@ public class TestMergeMeshes extends AcorusDemo {
*/
final private static String applicationName
= TestMergeMeshes.class.getSimpleName();
/**
* action string to dump the main scene graph
*/
final private static String asDump = "dump scene";
/**
* action string to orbit to the camera's left
*/
final private static String asOrbitLeft = "orbit left";
/**
* action string to orbit to the camera's right
*/
final private static String asOrbitRight = "orbit right";
// *************************************************************************
// new methods exposed

Expand Down Expand Up @@ -201,6 +213,7 @@ public void acorusInit() {
* @param viewPortHeight (in pixels, >0)
* @return a new instance
*/
@Override
public Rectangle detailedHelpBounds(int viewPortWidth, int viewPortHeight) {
// Position help nodes along the top of the viewport.
float margin = 10f; // in pixels
Expand All @@ -219,11 +232,12 @@ public Rectangle detailedHelpBounds(int viewPortWidth, int viewPortHeight) {
@Override
public void moreDefaultBindings() {
InputMode dim = getDefaultInputMode();
dim.bind("dump render", KeyInput.KEY_P);

dim.bind(asDump, KeyInput.KEY_P);
dim.bindSignal(CameraInput.FLYCAM_LOWER, KeyInput.KEY_DOWN);
dim.bindSignal(CameraInput.FLYCAM_RISE, KeyInput.KEY_UP);
dim.bindSignal("orbitLeft", KeyInput.KEY_LEFT);
dim.bindSignal("orbitRight", KeyInput.KEY_RIGHT);
dim.bindSignal(asOrbitLeft, KeyInput.KEY_LEFT);
dim.bindSignal(asOrbitRight, KeyInput.KEY_RIGHT);
dim.bind(asToggleHelp, KeyInput.KEY_H);
}

Expand All @@ -238,9 +252,10 @@ public void moreDefaultBindings() {
public void onAction(String actionString, boolean ongoing, float tpf) {
if (ongoing) {
switch (actionString) {
case "dump render":
case asDump:
new Dumper().dump(renderManager);
return;

default:
}
}
Expand Down Expand Up @@ -293,7 +308,7 @@ private void configureCamera(float cameraX) {
cam.setLocation(new Vector3f(cameraX, 0f, cameraZ));

CameraOrbitAppState orbitState
= new CameraOrbitAppState(cam, "orbitLeft", "orbitRight");
= new CameraOrbitAppState(cam, asOrbitLeft, asOrbitRight);
stateManager.attach(orbitState);
}
}

0 comments on commit 557e401

Please sign in to comment.