Skip to content

Commit bee6ae3

Browse files
committed
feat:Improve README.md
1 parent 4f4bad1 commit bee6ae3

1 file changed

Lines changed: 51 additions & 28 deletions

File tree

README.md

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
# Live2D-JavaBinding
22

3-
A Native Java binding for the Live2D Cubism SDK.
3+
A native Java binding for the [Live2D Cubism SDK](https://www.live2d.com/en/products/cubism-sdk), enabling seamless integration of Live2D models in Java applications.
44

55
> **Status: Work in Progress**
6-
> This project is currently under development
6+
> This project is currently under active development. Contributions are welcome!
77
88
## Features
99

10-
- **Distributed Separately**: Java logic and native binaries are decoupled. Native JARs are self-contained (statically linked with Cubism Core).
11-
- **Cross-Platform**: Supports Windows (x64), Linux (x64, arm64), and macOS (x64, arm64).
12-
- **Simple API**: Easy-to-use Apis to rendering.
10+
- **Decoupled Distribution**: Java logic and native binaries are separated for flexibility. Native JARs are fully self-contained.
11+
- **Cross-Platform Support**: Compatible with Windows (x64), Linux (x64, arm64), and macOS (x64, arm64).
12+
- **Simple and Intuitive API**: Easy-to-use interfaces for model loading, rendering, and interaction.
13+
- **JNI Integration**: Leverages Java Native Interface (JNI) for high-performance native code execution.
1314

14-
## Quick Usage example
15+
## About JNI Integration
16+
17+
JNI (Java Native Interface) is a programming framework that enables Java code to interact with native applications and libraries written in languages like C or C++. In this project:
18+
19+
- JNI bridges the Java API (in the `binding/` directory) with the native C++ implementation of the Live2D Cubism SDK (in the `native/` directory).
20+
- The native components are built using CMake and compiled into platform-specific shared libraries, which are bundled into JAR files for easy distribution.
21+
22+
For more details on JNI, refer to the [official Oracle JNI documentation](https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/jniTOC.html).
23+
24+
## Quick Start
25+
26+
Here's a simple example to get you up and running:
1527

1628
```java
1729
import dev.eatgrapes.live2d.CubismFramework;
@@ -23,49 +35,60 @@ CubismFramework.initialize();
2335

2436
// 2. Load Model & Components
2537
CubismUserModel model = new CubismUserModel();
26-
model.loadModel(moc3Bytes);
27-
model.loadPose(poseBytes);
28-
model.loadPhysics(physicsBytes);
38+
model.loadModel(moc3Bytes); // Load model data
39+
model.loadPose(poseBytes); // Load pose data
40+
model.loadPhysics(physicsBytes); // Load physics data
2941

3042
// 3. Setup Renderer
3143
model.createRenderer();
32-
model.registerTexture(0, openGLTextureId);
44+
model.registerTexture(0, openGLTextureId); // Bind textures
3345

34-
// 4. Interaction & Motion
35-
model.setDragging(nx, ny); // Eye tracking
46+
// 4. Handle Interactions & Motions
47+
model.setDragging(nx, ny); // Enable eye tracking or dragging
3648
model.startMotion(motionBytes, priority, loop, name -> {
37-
System.out.println("Motion finished!");
49+
System.out.println("Motion finished!"); // Callback on completion
3850
});
3951

40-
// 5. Update & Draw (in your render loop)
41-
model.update(deltaTime);
42-
model.draw(mvpMatrix);
52+
// 5. Update & Draw (in your main render loop)
53+
model.update(deltaTime); // Update model state
54+
model.draw(mvpMatrix); // Render the model
4355
```
4456

4557
## Project Structure
4658

47-
- `binding/`: Java API and module definitions.
48-
- `native/`: JNI implementation and CMake build scripts.
49-
- `scripts/`: Python build automation for all platforms.
50-
- `example/`: A complete Maven-based example using LWJGL 3
59+
- **`binding/`**: Contains the Java API definitions and module configurations.
60+
- **`native/`**: Houses the JNI C++ implementation, along with CMake build scripts for native compilation.
61+
- **`scripts/`**: Python scripts for automating builds across all supported platforms.
62+
- **`example/`**: A complete Maven-based demo project using LWJGL 3 for OpenGL integration.
63+
64+
## Building the Project
5165

52-
## Building
66+
### Prerequisites
67+
- Python 3.x
68+
- CMake 3.10+
69+
- A C++14-compatible compiler (e.g., GCC, Clang, or MSVC)
70+
- JDK 9 or higher
5371

54-
Requires Python 3, CMake, a C++14 compiler, and JDK 9+.
72+
### Build Command
73+
Run the following in the project root:
5574

5675
```bash
5776
python3 scripts/build.py
5877
```
5978

60-
The artifacts will be generated in the `out/` directory:
61-
- `live2d-shared.jar` (Java API)
62-
- `live2d-native-[platform].jar` (Self-contained Native Library)
79+
This will generate artifacts in the `out/` directory:
80+
- `live2d-shared.jar`: The core Java API.
81+
- `live2d-native-[platform].jar`: Platform-specific native libraries (e.g., `live2d-native-windows-x64.jar`).
6382

6483
## Contributing
6584

66-
Pull Requests (PRs) are welcome! Help us implement more SDK features or improve platform compatibility.
85+
We welcome Pull Requests (PRs)! Whether it's implementing additional SDK features, enhancing platform support, or fixing bugs, your help is appreciated. Please follow these steps:
86+
1. Fork the repository.
87+
2. Create a feature branch.
88+
3. Commit your changes.
89+
4. Open a PR with a clear description.
6790

6891
## License
6992

70-
- **Binding Code**: Distributed under the [MIT License](LICENSE).
71-
- **Live2D Cubism SDK**: The use of the underlying SDK is governed by the [Live2D Open Software License Agreement](https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html). You must agree to their terms to use the native components.
93+
- **Binding Code**: Licensed under the [MIT License](LICENSE).
94+
- **Live2D Cubism SDK**: Usage is subject to the [Live2D Open Software License Agreement](https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html). You must review and agree to their terms before using the native components.

0 commit comments

Comments
 (0)