Add game source, converter pipeline, and web port

This commit is contained in:
2026-08-12 18:59:06 +02:00
parent 3e6635eac6
commit bd13ad67cc
97 changed files with 8781 additions and 0 deletions
+206
View File
@@ -0,0 +1,206 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.jme3.animation.AnimChannel
* com.jme3.animation.AnimControl
* com.jme3.animation.AnimEventListener
* com.jme3.app.SimpleApplication
* com.jme3.app.state.AppState
* com.jme3.bullet.BulletAppState
* com.jme3.bullet.BulletAppState$ThreadingType
* com.jme3.bullet.collision.PhysicsCollisionEvent
* com.jme3.bullet.collision.PhysicsCollisionListener
* com.jme3.bullet.collision.shapes.CapsuleCollisionShape
* com.jme3.bullet.collision.shapes.CollisionShape
* com.jme3.bullet.control.CharacterControl
* com.jme3.bullet.control.RigidBodyControl
* com.jme3.input.ChaseCamera
* com.jme3.input.controls.ActionListener
* com.jme3.input.controls.InputListener
* com.jme3.input.controls.KeyTrigger
* com.jme3.input.controls.Trigger
* com.jme3.light.AmbientLight
* com.jme3.light.DirectionalLight
* com.jme3.light.Light
* com.jme3.material.Material
* com.jme3.math.ColorRGBA
* com.jme3.math.Quaternion
* com.jme3.math.Vector3f
* com.jme3.scene.Geometry
* com.jme3.scene.Mesh
* com.jme3.scene.Node
* com.jme3.scene.Spatial
* com.jme3.scene.control.Control
* com.jme3.scene.shape.Quad
*/
package jme3.hello;
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AppState;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.collision.PhysicsCollisionEvent;
import com.jme3.bullet.collision.PhysicsCollisionListener;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.CharacterControl;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.input.ChaseCamera;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.InputListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.Trigger;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.light.Light;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import com.jme3.scene.shape.Quad;
public class test
extends SimpleApplication
implements ActionListener,
PhysicsCollisionListener,
AnimEventListener {
private BulletAppState bulletAppState;
CharacterControl character;
Node model;
Vector3f walkDirection = new Vector3f();
Geometry ground;
ChaseCamera chaseCam;
boolean left = false;
boolean right = false;
boolean up = false;
boolean down = false;
public static void main(String[] args) {
test app = new test();
app.start();
}
public void simpleInitApp() {
this.bulletAppState = new BulletAppState();
this.bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
this.stateManager.attach((AppState)this.bulletAppState);
this.setupKeys();
this.createLight();
this.createCharacter();
Material mat = new Material(this.assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", this.assetManager.loadTexture("Textures/Rock.PNG"));
this.ground = new Geometry("ground", (Mesh)new Quad(50.0f, 50.0f));
this.ground.setLocalRotation(new Quaternion().fromAngleAxis(-1.5707964f, Vector3f.UNIT_X));
this.ground.setLocalTranslation(0.0f, 0.0f, 0.0f);
this.ground.setMaterial(mat);
RigidBodyControl ground_solid = new RigidBodyControl(0.0f);
this.ground.addControl((Control)ground_solid);
this.bulletAppState.getPhysicsSpace().add((Object)ground_solid);
this.rootNode.attachChild((Spatial)this.ground);
this.setupChaseCamera();
}
private void setupKeys() {
this.inputManager.addMapping("CharLeft", new Trigger[]{new KeyTrigger(30)});
this.inputManager.addMapping("CharRight", new Trigger[]{new KeyTrigger(32)});
this.inputManager.addMapping("CharUp", new Trigger[]{new KeyTrigger(17)});
this.inputManager.addMapping("CharDown", new Trigger[]{new KeyTrigger(31)});
this.inputManager.addListener((InputListener)this, new String[]{"CharLeft", "CharRight", "CharUp", "CharDown"});
}
private void createLight() {
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.White.mult(1.3f));
this.rootNode.addLight((Light)al);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White);
dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal());
this.rootNode.addLight((Light)dl);
}
private void createGround() {
Material mat = new Material(this.assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", this.assetManager.loadTexture("Textures/Rock.PNG"));
this.ground = new Geometry("ground", (Mesh)new Quad(50.0f, 50.0f));
this.ground.setLocalRotation(new Quaternion().fromAngleAxis(-1.5707964f, Vector3f.UNIT_X));
this.ground.setLocalTranslation(0.0f, 0.0f, 0.0f);
this.ground.setMaterial(mat);
RigidBodyControl ground_solid = new RigidBodyControl(0.0f);
this.ground.addControl((Control)ground_solid);
this.bulletAppState.getPhysicsSpace().add((Object)ground_solid);
this.rootNode.attachChild((Spatial)this.ground);
}
private void createCharacter() {
CapsuleCollisionShape capsule = new CapsuleCollisionShape(1.0f, 1.0f);
this.character = new CharacterControl((CollisionShape)capsule, 1.0f);
this.model = (Node)this.assetManager.loadModel("Models/spider/Spider.mesh.j3o");
this.model.addControl((Control)this.character);
this.model.setLocalTranslation(0.0f, 10.0f, 0.0f);
this.character.setPhysicsLocation(new Vector3f(-140.0f, 15.0f, -10.0f));
this.rootNode.attachChild((Spatial)this.model);
this.bulletAppState.getPhysicsSpace().add((Object)this.character);
}
private void setupChaseCamera() {
this.flyCam.setEnabled(false);
this.chaseCam = new ChaseCamera(this.cam, (Spatial)this.model, this.inputManager);
}
public void simpleUpdate(float tpf) {
this.walkDirection.set(0.0f, 0.0f, 0.0f);
Vector3f camDir = this.cam.getDirection().clone().multLocal(0.1f);
Vector3f camLeft = this.cam.getLeft().clone().multLocal(0.1f);
camDir.y = 0.0f;
camLeft.y = 0.0f;
this.walkDirection.set(0.0f, 0.0f, 0.0f);
if (this.left) {
this.walkDirection.addLocal(camLeft);
}
if (this.right) {
this.walkDirection.addLocal(camLeft.negate());
}
if (this.up) {
this.walkDirection.addLocal(camDir);
}
if (this.down) {
this.walkDirection.addLocal(camDir.negate());
}
if (this.walkDirection.length() != 0.0f) {
this.character.setViewDirection(this.walkDirection);
}
this.character.setWalkDirection(this.walkDirection);
}
public void onAction(String binding, boolean value, float tpf) {
if (binding.equals("CharLeft")) {
this.left = value;
} else if (binding.equals("CharRight")) {
this.right = value;
} else if (binding.equals("CharUp")) {
this.up = value;
} else if (binding.equals("CharDown")) {
this.down = value;
}
}
public void collision(PhysicsCollisionEvent event) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
throw new UnsupportedOperationException("Not supported yet.");
}
}