Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Vue・Babylon連携ライブラリ BabyuewJSについて / about-babyuewjs
Search
にー兄さん
November 22, 2023
Programming
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vue・Babylon連携ライブラリ BabyuewJSについて / about-babyuewjs
社内勉強会で発表した資料です(公開許可済み)
にー兄さん
November 22, 2023
More Decks by にー兄さん
See All by にー兄さん
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
190
ついにAuraも登場したのでJetpack XR SDKについて今一度語りたい / i wanna talk about xreal aura
drumath2237
0
41
『Ground Truth: How We Create Geometrically Accurate Reconstructions (Niantic Spatial Blog)』 を読む / read Ground Truth: How We Create Geometrically Accurate Reconstructions
drumath2237
0
77
この時代にOSS開発に向き合ってみる / face the oss development in this era
drumath2237
0
63
プログラマの職能が代替可能になりつつあるこの時代でプログラムと向き合う修行を積む / dedicating myself to the discipline of programming
drumath2237
0
110
個人的3D Gaussian Splattingニュースをご紹介 / sharing 3d gaussian splatting news
drumath2237
0
650
Jetpack XR SDKから紐解くAndroid XR開発と技術選定のヒント / about-androidxr-and-jetpack-xr-sdk
drumath2237
1
860
XRエンジニアの視点から XRのイマと社会実装の実現について考える / thinking-about-xr-popularization
drumath2237
0
98
軽率にプログラミング言語のシンタックスについて考えてみよう / lets-think-about-programming-lang-syntax
drumath2237
0
150
Other Decks in Programming
See All in Programming
新卒PdEのリアル
ryu1013
1
500
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
260
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
150
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
150
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
620
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
4.8k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
470
Building an Out-of-Order CPU
latte72
1
790
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
220
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
アクセシビリティから考える情報設計
high_g_engineer
0
380
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
WENDY [Excerpt]
tessaabrams
14
39k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
Producing Creativity
orderedlist
PRO
348
41k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Agile that works and the tools we love
rasmusluckow
331
22k
Documentation Writing (for coders)
carmenintech
77
5.5k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
240
The untapped power of vector embeddings
frankvandijk
2
1.9k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
370
Facilitating Awesome Meetings
lara
57
7.1k
Transcript
Vue・Babylon連携ライブラリ BabyuewJSについて にー兄さん
アジェンダ 前提知識(Vue・Babylonについて) BabyuewJSについて おわりに
前提知識
主題 今回の話は Vue3とBabylon.jsをいい感じに組み合わせたい という話です
主題 今回の話は Vue3とBabylon.jsをいい感じに組み合わせたい という話です 本題に入る前に これらについて簡単に解説
Vue.js(https://ja.vuejs.org/) モダンJSフレームワーク(The Progressive JavaScript Framework) 類似ライブラリには React, Svelte, Angular, Solid,
… 最新はv3。v2とは「ほぼ別ライブラリ」 リポジトリ(https://github.com/vuejs/core) Start数は⭐41.4Kらしい(Reactは215K)
コード例(動作デモ) JavaScript, HTML, CSS が一体化したような .vueファイル JS側の変数を HTMLに埋め込んだり 変更を検知して 自動でUIを更新できる
<script setup> import { ref } from 'vue' const count = ref(0) </script> <template> <button @click="count++">Count is: {{ count }}</button> </template> <style scoped> button { font-weight: bold; } </style>
Babylon.js(https://www.babylonjs.com/) WebGLフレームワーク、Web 3Dエンジン、説明ちょっと迷う 類似ライブラリはThree.js Webで動くリアルタイム3Dアプリケーションを開発できる TypeScriptフルサポート リポジトリ(https://github.com/BabylonJS/Babylon.js) Star数は⭐21.7K(Three.jsは95.8K)
コード例(動作デモ) canvas要素を使って初期化 カメラ、ライト、Cubeを 配置してレンダリングを実行 const engine = new Engine(renderCanvas, true);
const scene = new Scene(engine) scene.createDefaultCameraOrLight(true, true, true) scene.createDefaultEnvironment() const box = MeshBuilder.CreateBox("box", {size:0.3}) box.position= new Vector3(0,0.15,0) window.addEventListener('resize', () => { engine.resize(); }); engine.runRenderLoop(() => { scene.render(); });
2つのライブラリの連携と BabyuewJSについて
JS FWとWebGL FWを組み合わせるって? つまり…… モダンWebフロントエンドPJで リアルタイム3D表現を扱いたい (いい感じに)
Babylon.jsのdocsにも一応書いてある How to use BabylonJS with Vue https://doc.babylonjs.com/communityExtensions/ Babylon.js+ExternalLibraries/BabylonJS_and_Vue/ BabylonJS_and_Vue_1
つまりscriptの中に 書けばいいじゃん もうちょっといい感じにしたい <script> import { ref, onMounted } from "@vue/runtime-core"; import { createScene } from "../scenes/MyFirstScene"; export default { name: "BabylonScene", setup() { const bjsCanvas = ref(null); onMounted(() => { if (bjsCanvas.value) { createScene(bjsCanvas.value); } }); return { bjsCanvas, }; }, }; </script>
いい感じとは、つまりreact-three-fiber R3F(https://docs.pmnd.rs/react-three-fiber/) export default function App() { return ( <Canvas>
<ambientLight intensity={0.5} /> <spotLight position={[10, 10, 10]} angle={0.15} penumbra={1} /> <pointLight position={[-10, -10, -10]} /> <Box position={[-1.2, 0, 0]} /> <Box position={[1.2, 0, 0]} /> </Canvas> ) } - シーンの状態が分かりやすい - ReactのI/Fで記述できてよい
R3FをVue3とBabylon.jsでも使いたい 100%この要件を満たす物はなかった → 作るか!w BabyuewJS v1.0.0-alpha.1が誕生 npm: https://www.npmjs.com/package/@babyuewjs/core repo: https://github.com/drumath2237/BabyuewJS
コード例(動作デモ) BabyuewSceneコンポーネント をscriptに配置 その中にオブジェクトを 配置していく propsは一部リアクティブ <template> <BabyuewScene antialias> <ArcRotateCamera
name="camera" :alpha="Math.PI / 3" :beta="Math.PI / 3" :radius="0.5" :target="[0, 0.05, 0]" > </ArcRotateCamera> <DirectionalLight :direction="[0.25, -1, -0.6]" :intensity="1" ></DirectionalLight> <Box name="my-box" :position="[0, 0.05, 0]" :size="0.1"> </Box> </BabyuewScene> </template>
おわりに
Babylon.jsが抱える問題と解決 Unityとは違いGUIエディタがない(一応存在する) 全部コードベースで扱う必要がある → シーンオーサリングと振る舞いの記述が混ざる →VueのSFCだとシーン表現と振る舞いの記述を分離できる Webと3D両方わかる必要がある →人口が多いWebの人を呼び込みたい →VueのI/Fで手軽に扱えるようにした
この先 まだ alpha版 仕組みはできたが機能は全然足りない のびしろ・改善点 たくさん Projectsを公開
最後に宣伝