fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. //
  13. }
  14. }
Success #stdin #stdout 0.1s 54572KB
stdin
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Three.js and Cannon.js Game</title>
    <script src="https://c...content-available-to-author-only...e.com/ajax/libs/three.js/r128/three.min.js"></script>
    <script src="https://c...content-available-to-author-only...e.com/ajax/libs/cannon.js/0.6.2/cannon.min.js"></script>
    <script src="https://c...content-available-to-author-only...e.com/ajax/libs/p5.js/1.4.0/p5.min.js"></script>
    <style>
        body {
            margin: 0;
            overflow: hidden;
        }
        canvas {
            display: block;
        }
    </style>
</head>
<body>
    <script>
        let sketch = function(p) {
            let scene, camera, renderer, world, groundBody, groundMesh, boxBody, boxMesh, controls, textureLoader, storyText, textMesh;

            p.setup = function() {
                p.createCanvas(p.windowWidth, p.windowHeight, p.WEBGL);
                scene = new THREE.Scene();
                camera = new THREE.PerspectiveCamera(75, p.windowWidth / p.windowHeight, 0.1, 1000);
                renderer = new THREE.WebGLRenderer({ canvas: p.canvas });
                renderer.setSize(p.windowWidth, p.windowHeight);
                renderer.shadowMap.enabled = true;
                renderer.shadowMap.type = THREE.PCFSoftShadowMap;
                world = new CANNON.World();
                world.gravity.set(0, -9.82, 0);
                world.broadphase = new CANNON.NaiveBroadphase();
                world.solver.iterations = 10;
                let groundShape = new CANNON.Box(new CANNON.Vec3(10, 1, 10));
                groundBody = new CANNON.Body({ mass: 0 });
                groundBody.addShape(groundShape);
                groundBody.position.set(0, -1, 0);
                world.addBody(groundBody);
                let groundGeometry = new THREE.BoxGeometry(20, 2, 20);
                let groundMaterial = new THREE.MeshLambertMaterial({ color: 0x00ff00 });
                groundMesh = new THREE.Mesh(groundGeometry, groundMaterial);
                groundMesh.receiveShadow = true;
                scene.add(groundMesh);
                let boxShape = new CANNON.Box(new CANNON.Vec3(1, 1, 1));
                boxBody = new CANNON.Body({ mass: 1 });
                boxBody.addShape(boxShape);
                boxBody.position.set(0, 10, 0);
                world.addBody(boxBody);
                let boxGeometry = new THREE.BoxGeometry(2, 2, 2);
                textureLoader = new THREE.TextureLoader();
                let boxTexture = textureLoader.load('./texture.jpg');
                let boxMaterial = new THREE.MeshLambertMaterial({ map: boxTexture });
                boxMesh = new THREE.Mesh(boxGeometry, boxMaterial);
                boxMesh.castShadow = true;
                scene.add(boxMesh);
                let ambientLight = new THREE.AmbientLight(0x404040, 0.4);
                scene.add(ambientLight);
                let directionalLight = new THREE.DirectionalLight(0xffffff, 0.6);
                directionalLight.position.set(10, 10, 5);
                directionalLight.castShadow = true;
                directionalLight.shadow.mapSize.width = 1024;
                directionalLight.shadow.mapSize.height = 1024;
                scene.add(directionalLight);
                camera.position.set(0, 5, 10);
                camera.lookAt(0, 0, 0);
                controls = {
                    pitch: 0,
                    yaw: 0,
                    sensitivity: 0.002
                };
                p.canvas.addEventListener('mousemove', (event) => {
                    controls.yaw -= event.movementX * controls.sensitivity;
                    controls.pitch -= event.movementY * controls.sensitivity;
                    controls.pitch = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, controls.pitch));
                });
                p.canvas.requestPointerLock = p.canvas.requestPointerLock || p.canvas.mozRequestPointerLock;
                document.addEventListener('click', () => {
                    p.canvas.requestPointerLock();
                });
                let fontLoader = new THREE.FontLoader();
                fontLoader.load('https://t...content-available-to-author-only...s.org/examples/fonts/helvetiker_regular.typeface.json', function(font) {
                    let textGeometry = new THREE.TextGeometry('Erotic Adventure: Explore the Forbidden Box', {
                        font: font,
                        size: 0.5,
                        height: 0.1,
                        curveSegments: 12,
                        bevelEnabled: true,
                        bevelThickness: 0.01,
                        bevelSize: 0.01,
                        bevelOffset: 0,
                        bevelSegments: 5
                    });
                    let textMaterial = new THREE.MeshLambertMaterial({ color: 0xff69b4 });
                    textMesh = new THREE.Mesh(textGeometry, textMaterial);
                    textMesh.position.set(-5, 2, 0);
                    scene.add(textMesh);
                });
            };
            p.draw = function() {
                p.background(0);
                world.step(1 / 60);
                groundMesh.position.copy(groundBody.position);
                groundMesh.quaternion.copy(groundBody.quaternion);
                boxMesh.position.copy(boxBody.position);
                boxMesh.quaternion.copy(boxBody.quaternion);
                camera.position.x = Math.sin(controls.yaw) * 10;
                camera.position.z = Math.cos(controls.yaw) * 10;
                camera.position.y = Math.sin(controls.pitch) * 10 + 5;
                camera.lookAt(0, 0, 0);
                renderer.render(scene, camera);
            };
            p.windowResized = function() {
                p.resizeCanvas(p.windowWidth, p.windowHeight);
                camera.aspect = p.windowWidth / p.windowHeight;
                camera.updateProjectionMatrix();
                renderer.setSize(p.windowWidth, p.windowHeight);
            };
        };
        new p5(sketch);
    </script>
</body>
</html>
stdout
Standard output is empty