56 lines
1.1 KiB
Plaintext
56 lines
1.1 KiB
Plaintext
|
[gd_scene load_steps=4 format=2]
|
||
|
|
||
|
[ext_resource path="res://cylinder.dae" type="PackedScene" id=1]
|
||
|
|
||
|
[sub_resource type="Shader" id=1]
|
||
|
code = "shader_type spatial;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
render_mode blend_mix,depth_draw_opaque,cull_disabled;
|
||
|
|
||
|
uniform vec4 albedo : hint_color;
|
||
|
uniform sampler2D texture_albedo : hint_albedo;
|
||
|
uniform mat4 my_matrix;
|
||
|
|
||
|
|
||
|
|
||
|
void vertex() {
|
||
|
//VERTEX=VERTEX * my_matrix;
|
||
|
vec4 row0 = vec4(1.0, 0.0, 0.0, 2.0);
|
||
|
vec4 row1 = vec4(0.0, 1.0, 0.0, 0.0);
|
||
|
vec4 row2 = vec4(0.0, 0.0, 1.0, -3.0);
|
||
|
vec4 row3 = vec4(0.0, 0.0, 0.0, 1.0);
|
||
|
mat4 crank_matrix = mat4(row0, row1, row2, row3);
|
||
|
//VERTEX=(vec4(VERTEX, 1.0) * crank_matrix).xyz;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
void fragment() {
|
||
|
vec2 base_uv = UV;
|
||
|
vec4 albedo_tex = texture(texture_albedo,base_uv);
|
||
|
ALBEDO = albedo.rgb * albedo_tex.rgb;
|
||
|
}
|
||
|
"
|
||
|
|
||
|
[sub_resource type="ShaderMaterial" id=2]
|
||
|
shader = SubResource( 1 )
|
||
|
shader_param/albedo = Color( 1, 1, 1, 1 )
|
||
|
shader_param/my_matrix = Transform( 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, -5 )
|
||
|
|
||
|
[node name="cylinder" instance=ExtResource( 1 )]
|
||
|
|
||
|
[node name="Cylinder" parent="." index="0"]
|
||
|
material/0 = SubResource( 2 )
|