An introduction to contributing to the babylon-mmd.
The basic conventions required by the project are as follows:
- Follow the conventions of Babylon.js.
- Follow eslint rules.
- New features should be compatible with all existing parts whenever possible.
- API design should consider backward compatibility.
- Prioritize performance improvements even if it slightly reduces readability (avoid using js map, filter, iterator).
Most of the Babylon.js conventions are covered by eslint. The following are the items you need to check manually:
- Name folders in PascalCase.
- Name files in camelCase for classes and PascalCase for interfaces or types.
- Exception: For rust cargo project folders, use rust's naming conventions.
Only the main directories of the project are listed.
-
res
- Test resource files. -
src/Loader
- MMD asset loader. -
src/Loader/Optimized
- Includes loaders for optimized formats like BPMX and BVMD. -
src/Runtime
- Elements to animate MMD assets. -
src/Runtime/Optimized
- Includes WebAssembly-based runtime. -
src/Runtime/Optimized/wasm_src
- rust cargo project. -
src/Test
- Test playground.
To build the project, you need to have the following dependencies installed:
- nodejs 20 or higher (may not work with 20.12.2 or later see the issue)
- npm
- rust nightly-2024-11-19
- llvm 19.1.3
- sccache
you can install the dependencies using the following commands:
sudo apt-get update
sudo apt-get install -y nodejs npm
sudo npm update npm -g
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
for aarch64:
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.3/clang+llvm-19.1.3-aarch64-linux-gnu.tar.xz
tar -xf clang+llvm-19.1.3-aarch64-linux-gnu.tar.xz
update PATH temporarily:
export PATH=$PWD/clang+llvm-19.1.3-aarch64-linux-gnu/bin:$PATH
update PATH permanently:
echo "export PATH=$PWD/clang+llvm-19.1.3-aarch64-linux-gnu/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc
for x86_64:
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.3/LLVM-19.1.3-Linux-X64.tar.xz
tar -xf LLVM-19.1.3-Linux-X64.tar.xz
update PATH temporarily:
export PATH=$PWD/LLVM-19.1.3-Linux-X64/bin:$PATH
update PATH permanently:
echo "export PATH=$PWD/LLVM-19.1.3-Linux-X64/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install sccache --locked
you can install the dependencies using the following links:
- nodejs and npm
- rust
- clang and llvm (add bin path to system path)
- scache (install using cargo)
Download clang+llvm-19.1.3-x86_64-pc-windows-msvc.tar.xz
from the link above and extract it.
Add the extracted bin
folder to the system path.
install sccache using the following command:
cargo install sccache --locked
After installing the dependencies, run the following commands:
npm install
npm run build-wasm-all # for code generation
For run the development server with the test playground:
npm start
For build the test playground project:
npm run build
For build the project as a library:
npm run build-lib