Browse Source

Add code-based J3MD template and shader templates

Co-authored-by: neph1 <[email protected]>
copilot-swe-agent[bot] 1 month ago
parent
commit
46f3601447

+ 7 - 0
gradlew

@@ -0,0 +1,7 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
+
+uniform vec4 m_Color;
+
+void main(){
+    gl_FragColor = m_Color;
+}

+ 9 - 0
jme3-materialeditor/src/com/jme3/gde/materialdefinition/BasicShader.vert

@@ -0,0 +1,9 @@
+#import "Common/ShaderLib/GLSLCompat.glsllib"
+
+attribute vec3 inPosition;
+
+uniform mat4 g_WorldViewProjectionMatrix;
+
+void main(){
+    gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
+}

+ 16 - 0
jme3-materialeditor/src/com/jme3/gde/materialdefinition/CodeBasedMatDef.j3md

@@ -0,0 +1,16 @@
+MaterialDef ${name} {
+
+    MaterialParameters {
+        Vector4 Color
+    }
+
+    Technique {
+        VertexShader GLSL100: ${name}.vert
+        FragmentShader GLSL100: ${name}.frag
+
+        WorldParameters {
+            WorldViewProjectionMatrix
+        }
+    }
+
+}

+ 7 - 1
jme3-materialeditor/src/com/jme3/gde/materialdefinition/package-info.java

@@ -29,7 +29,13 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-@TemplateRegistration(folder = "Material", content = "MatDef.j3md", displayName="Material Definition Template")
+@TemplateRegistrations({
+    @TemplateRegistration(folder = "Material", content = "MatDef.j3md", displayName="Material Definition Template (Shader Nodes)"),
+    @TemplateRegistration(folder = "Material", content = "CodeBasedMatDef.j3md", displayName="Material Definition Template (Code Based)", position = 100),
+    @TemplateRegistration(folder = "GLSL", content = "BasicShader.vert", displayName="Vertex Shader Template", position = 200),
+    @TemplateRegistration(folder = "GLSL", content = "BasicShader.frag", displayName="Fragment Shader Template", position = 300)
+})
 package com.jme3.gde.materialdefinition;
 
 import org.netbeans.api.templates.TemplateRegistration;
+import org.netbeans.api.templates.TemplateRegistrations;