-
Notifications
You must be signed in to change notification settings - Fork 103
Add code-based J3MD template and shader templates with multi-file wizard and FreeMarker variable substitution #670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The template mentioned in the issue is MatDef.j3md in jme3.gde.materialdefinition. Try to define (1) one glsl based template and (2) link it in the editor |
Co-authored-by: neph1 <7988802+neph1@users.noreply.github.com>
Co-authored-by: neph1 <7988802+neph1@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good start. However,
- the j3md ends up the same as the template, ie ${name} isn't replaced.
- BasicShader.frag and vert are never instantiated.
- Use the name of the file from the wizard as name instead of BasicShader
@copilot please address these changes
@copilot please check the review comments. |
Co-authored-by: neph1 <7988802+neph1@users.noreply.github.com>
Co-authored-by: neph1 <7988802+neph1@users.noreply.github.com>
I've addressed all three issues:
The templates are organized into logical categories in the New File dialog:
Changes in commit 78d2ed7.
I've created a GLSL-based template as requested and linked it in the editor through the @TemplateRegistration annotations in package-info.java. The CodeBasedMatDef.j3md template provides a clean alternative to the existing shader nodes template, specifically designed for developers who want to write custom GLSL shaders directly. The template includes:
Implementation in commits b158aaf and 78d2ed7. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
@copilot naming works, great! is it possible to also generate the .frag and .vert files with the correct names when you make a .j3md? Currently only the .j3md is generated. |
Co-authored-by: neph1 <7988802+neph1@users.noreply.github.com>
Yes! I've implemented a custom wizard iterator that automatically generates the .frag and .vert files with the correct names when you create a .j3md file. The new "Material Definition Template (Code Based with Shaders)" now creates all three files at once:
All files use the actual name you provide in the wizard (instead of hardcoded "BasicShader") and the material definition automatically references the shader files with the correct names. Implementation in commit 8d5b127. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR addresses the lack of templates for code-based material definitions in the JME SDK. Previously, developers had to use the shader nodes template and manually remove boilerplate code to create materials with custom GLSL shaders.
What's Added
Code-based J3MD Template (
CodeBasedMatDef.j3md
):Basic Shader Templates:
BasicShader.vert
- Minimal vertex shader with standard vertex transformation and ${name} substitutionBasicShader.frag
- Minimal fragment shader with color output and ${name} substitutionMulti-File Template Wizard:
CodeBasedMatDefWizardIterator
- Custom wizard that creates all three files (J3MD + vertex + fragment shaders) simultaneouslyTemplate Features
${name}
variable replacement with the actual file name from the wizard@TemplateRegistration
annotations and FreeMarker script engine configurationBenefits
Template Organization
The templates are organized into logical categories in the New File dialog:
All templates follow established JME3 conventions and are validated against existing working shaders in the codebase.
Fixes #664.
Warning
archive.apache.org
/usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.6-bin/afr5mpiioh2wthjmwnkmdsd5w/gradle-8.6/lib/gradle-launcher-8.6.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.6-bin/afr5mpiioh2wthjmwnkmdsd5w/gradle-8.6/lib/agents/gradle-instrumentation-agent-8.6.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.6
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.