This commit is contained in:
2026-05-06 17:52:45 -07:00
parent 9fc3f35125
commit 1463c23334
402 changed files with 3758 additions and 0 deletions

View File

@ -0,0 +1,58 @@
{
"shader_datas": [
{
"contexts": [
{
"color_attachments": [
"RGBA64"
],
"compare_mode": "less",
"constants": [
{
"link": "_worldViewProjectionMatrix",
"name": "WVP",
"type": "mat4"
},
{
"link": "_normalMatrix",
"name": "N",
"type": "mat3"
},
{
"link": "_posUnpack",
"name": "posUnpack",
"type": "float"
},
{
"link": "_time",
"name": "time",
"type": "float"
},
{
"link": "myParam",
"name": "myParam",
"type": "float"
}
],
"cull_mode": "clockwise",
"depth_write": true,
"fragment_shader": "MyCustomMaterial.frag",
"name": "mesh",
"texture_units": [],
"vertex_elements": [
{
"name": "pos",
"data": "short4norm"
},
{
"name": "nor",
"data": "short2norm"
}
],
"vertex_shader": "MyCustomMaterial.vert"
}
],
"name": "MyCustomMaterial"
}
]
}

View File

@ -0,0 +1,17 @@
#version 450
in vec3 mpos;
in vec3 normal;
// Color of each fragment on the screen
out vec4 fragColor;
void main() {
// Shadeless red color
//fragColor = vec4(1.0,0.0,0.0,0.0);
// Assuming forward rendering path for simplicity
vec3 col = (mpos + vec3(1.0)) / 8.0;
col += normal * 0.1;
fragColor = vec4(col, 1.0);
}

View File

@ -0,0 +1,28 @@
#version 450
// Armory uses packed vertex data to preserve memory
in vec4 pos; // pos.xyz, nor.z
in vec2 nor; // nor.xy
uniform mat4 WVP;
uniform mat3 N;
uniform float posUnpack;
uniform float time;
uniform float myParam;
out vec3 mpos;
out vec3 normal;
void main() {
vec4 p = vec4(pos.xyz, 1.0);
// Position data is packed into (-1, 1) range
// Retrieve model position
mpos = pos.xyz * posUnpack;
// Unpack normal.z component from pos.w
normal = N * vec3(nor.xy, pos.w);
p.z += sin((time + mpos.x + mpos.y) * 2.0) * 0.2 * myParam;
gl_Position = WVP * p;
}

View File

@ -0,0 +1,26 @@
package lnx;
import iron.Scene;
import iron.math.Vec4;
import iron.data.MaterialData;
import iron.object.MeshObject;
import iron.object.Object;
import iron.object.Uniforms;
class MyTrait extends iron.Trait {
public function new() {
super();
notifyOnInit(() -> {
Uniforms.externalFloatLinks.push(floatLink);
});
}
function floatLink(object:Object, mat:MaterialData, link:String):Null<kha.FastFloat> {
if (link == "myParam") {
var mouse = iron.system.Input.getMouse();
return (iron.App.h() - mouse.y) / 100;
}
return null;
}
}

Binary file not shown.