View 20230916updated_webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//参考:https://qiita.com/10mi8o/items/2477f2640291f0ce6687 | |
//参考:https://qiita.com/chocomint_t/items/4bc57945bce081922582 | |
/* pathモジュールを使ってwebページとして出力するパスを指定する。 | |
"path.resolveは、引数をつなげて絶対パスに変換する" | |
"__dirname"は、実行集のソースコードが格納されているディレクトリパス | |
参考:https://gist.github.com/uupaa/da42698d6b2d2cbb3cca | |
*/ | |
const path = require('path'); | |
//const outputPath = path.resolve(__dirname, 'dist'); |
View error.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npx webpack-dev-server | |
[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. |
View Simple_snapshot_rendering_exmaple_BJS_WebGPU.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Babylon.js sample code</title> | |
<!-- Babylon.js --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script> | |
<script src="https://assets.babylonjs.com/generated/Assets.js"></script> |
View fps_and_cpu_usage_time.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
engine.runRenderLoop(() => { | |
const startCPUTime = BABYLON.PrecisionDate.Now; | |
scene.render(); | |
const endCPUTime = BABYLON.PrecisionDate.Now; | |
t = (t + 1) % 10; | |
// Prevent hammering the composition. | |
if (t === 0) { | |
divFps.innerHTML = engine.getFps().toFixed() + " fps - " + ((endCPUTime - startCPUTime)).toFixed(2) + " CPU ms"; | |
} |
View SimpleWebGPU_BJS.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//See the link "https://github.com/BabylonJS/Website/tree/master/build/Demos/WebGPU" in detail. | |
(async function() { | |
if (!navigator.gpu) { | |
alert("Web GPU is not supported on your platform so far."); | |
return; | |
} | |
const canvas = document.getElementById("renderCanvas"); | |
const divFps = document.getElementById("fps"); | |
const engine = new BABYLON.WebGPUEngine(canvas); |
View performance_bjs.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Performance Test on Babylon.js</title> | |
<!-- Babylon.js --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script> | |
<script src="https://assets.babylonjs.com/generated/Assets.js"></script> |
View babylonjs_translate.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scene.registerAfterRender(function() { | |
// if(sphere.intersectsMesh(hitbox)) | |
F = engine.getFps(); | |
if((map["a"] || map["A"])){ | |
sphere.translate(BABYLON.Axis.X, -distance, BABYLON.Space.WORLD); | |
} | |
if((map["d"] || map["D"])){ | |
sphere.translate(BABYLON.Axis.X, distance, BABYLON.Space.WORLD); |
View Imposter_js.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sphere.physicsImpostor = new BABYLON.PhysicsImpostor(sphere, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 2, restitution: 0.4}); | |
cube1.physicsImpostor = new BABYLON.PhysicsImpostor(cube1, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 0, restitution: 0}); | |
cube2.physicsImpostor = new BABYLON.PhysicsImpostor(cube2, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 0, restitution: 0}); | |
wall1.physicsImpostor = new BABYLON.PhysicsImpostor(wall1, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 0, restitution: 0}); | |
wall2.physicsImpostor = new BABYLON.PhysicsImpostor(wall2, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 0, restitution: 0}); | |
wall3.physicsImpostor = new BABYLON.PhysicsImpostor(wall3, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 0, restitution: 0}); | |
wall4.physicsImpostor = new BABYLON.PhysicsImpostor(wall4, BABYLON.PhysicsImpostor.SphereImpostor, {mass: 0, restitution: 0}); | |
ground.physicsImpostor = new BABYLON.PhysicsImpostor(ground, BABYLON.PhysicsImpostor.BoxImpostor, {mass:0, restitution: 0, frictio |
View bjs_translate.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map ={}; //object for multiple key presses | |
//キー入力を受け付ける宣言 | |
//キー入力があるたびに、map変数の値がセットされる | |
scene.actionManager = new BABYLON.ActionManager(scene); | |
scene.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnKeyDownTrigger, function (evt) { | |
map[evt.sourceEvent.key] = evt.sourceEvent.type == "keydown"; | |
})); | |
scene.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnKeyUpTrigger, function (evt) { |
NewerOlder