Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
# MCglTF
A 3D model loader library which load glTF format file and prepare the required techniques to render the model for Minecraft Modding enviroment.

A 3D model loader library which load glTF format file and prepare the required techniques to render the model for
Minecraft Modding enviroment.
Various features from glTF spec are available but still remain a good compatibility and performance.

[![](https://cf.way2muchnoise.eu/title/mcgltf.svg)](https://www.curseforge.com/minecraft/mc-mods/mcgltf) [![](https://cf.way2muchnoise.eu/versions/mcgltf.svg)](https://www.curseforge.com/minecraft/mc-mods/mcgltf) [![](https://cf.way2muchnoise.eu/mcgltf.svg)](https://www.curseforge.com/minecraft/mc-mods/mcgltf)

## Usages

The example codes for rendering Block, Item, and Entity

- https://github.com/ModularMods/MCglTF-Example

## Features

- [x] GLTF format (Embedded resources or via ResourceLocation)
- [x] GLB format
- [x] UVs
- [x] Normals
- [x] Tangents
- [x] Vertex colors
- [x] Materials (Require [OptiFine](https://github.com/ModularMods/MCglTF/wiki/How-to-make-PBR-Materials-working-with-OptiFine) or [Iris Shaders](https://github.com/ModularMods/MCglTF/wiki/How-to-make-PBR-Materials-working-with-Iris-Shaders) and supported ShaderPack for PBR and Normal map)
- [x] Materials (
Require [OptiFine](https://github.com/ModularMods/MCglTF/wiki/How-to-make-PBR-Materials-working-with-OptiFine)
or [Iris Shaders](https://github.com/ModularMods/MCglTF/wiki/How-to-make-PBR-Materials-working-with-Iris-Shaders) and
supported ShaderPack for PBR and Normal map)
- [x] Textures
- [ ] Mutiple texture coordinates (For compatibility reason with Vanilla)
- [x] Rig
- [x] Animations (multiple)
- [x] Morph targets
- [x] Zero-scale node culling (https://github.com/KhronosGroup/glTF/pull/2059)

## Credit

- JglTF by javagl : https://github.com/javagl/JglTF
- Mikk Tangent Generator by jMonkeyEngine : https://github.com/jMonkeyEngine/jmonkeyengine
105 changes: 51 additions & 54 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_17
Expand All @@ -11,80 +11,77 @@ version = project.mod_version
group = project.maven_group

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"

content {
includeGroup "maven.modrinth"
}
}
flatDir {
dirs 'libs'
}
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"

content {
includeGroup "maven.modrinth"
}
}
flatDir {
dirs 'libs'
}
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
modImplementation "maven.modrinth:iris:${project.iris_version}"
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
modImplementation "maven.modrinth:iris:${project.iris_version}"

}

processResources {
inputs.property "version", project.version
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {

}
}
19 changes: 8 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx4G
org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.4
loader_version=0.16.3

# check these on https://fabricmc.net/develop
minecraft_version=1.20.4
loader_version=0.16.3
# Mod Properties
mod_version = 1.20.4-Fabric-2.1.0.0
maven_group = com.modularmods.mcgltf
archives_base_name = MCglTF

mod_version=1.20.4-Fabric-2.2.0.0
maven_group=com.modularmods.mcgltf
archives_base_name=MCglTF
# Dependencies
fabric_version=0.97.2+1.20.4
iris_version=1.7.2+1.20.4
fabric_version=0.97.2+1.20.4
iris_version=1.7.2+1.20.4
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ pluginManagement {
gradlePluginPortal()
}
}

rootProject.name = "MCglTF"
Loading