101 lines
2.4 KiB
Plaintext
101 lines
2.4 KiB
Plaintext
[gd_scene load_steps=7 format=2]
|
|
|
|
[ext_resource path="res://scenes/HexTile3D.cs" type="Script" id=1]
|
|
[ext_resource path="res://assets/4x4checkerColor.png" type="Texture" id=2]
|
|
|
|
[sub_resource type="CylinderMesh" id=6]
|
|
top_radius = 0.5
|
|
bottom_radius = 0.5
|
|
height = 10.0
|
|
radial_segments = 6
|
|
rings = 1
|
|
|
|
[sub_resource type="Shader" id=11]
|
|
code = "shader_type spatial;
|
|
render_mode specular_schlick_ggx, async_visible;
|
|
|
|
uniform sampler2D MapAlbedoTexture : hint_black_albedo;
|
|
uniform mat4 HexAffineInverse;
|
|
varying vec2 map_coord;
|
|
|
|
const mat2 _HexAffineInverse = mat2(vec2(1.333333, -0.6666667), vec2(0, -1.154701));
|
|
|
|
vec2 axial_to_offset(vec2 axial) {
|
|
ivec2 axial_i = ivec2(axial);
|
|
int x = axial_i.x;
|
|
int y = axial_i.y;
|
|
int off_y = y + (x - (x % 1)) / 2;
|
|
return vec2(float(x), float(off_y));
|
|
}
|
|
|
|
void vertex() {
|
|
// Input:2
|
|
mat4 model_matrix = WORLD_MATRIX;
|
|
|
|
vec3 origin = vec4(WORLD_MATRIX * vec4(0, 0, 0, 1)).xyz;
|
|
|
|
vec3 axial_coords = vec3(_HexAffineInverse * origin.xz, 0);
|
|
|
|
// Output:0
|
|
map_coord = origin.xz * 0.25;
|
|
map_coord = axial_to_offset(axial_coords.xy) * 0.25;
|
|
}
|
|
|
|
void fragment() {
|
|
// Input:3
|
|
mat4 n_out3p0 = WORLD_MATRIX;
|
|
|
|
// TransformDecompose:5
|
|
vec3 n_out5p0 = n_out3p0[0].xyz;
|
|
vec3 n_out5p1 = n_out3p0[1].xyz;
|
|
vec3 n_out5p2 = n_out3p0[2].xyz;
|
|
vec3 n_out5p3 = n_out3p0[3].xyz;
|
|
|
|
// VectorOp:9
|
|
vec3 n_in9p1 = vec3(1.00000, 1.00000, 1.00000);
|
|
vec3 n_out9p0 = n_out5p3 * n_in9p1;
|
|
|
|
// TextureUniform:4
|
|
vec3 n_out4p0;
|
|
float n_out4p1;
|
|
{
|
|
vec4 n_tex_read = texture(MapAlbedoTexture, map_coord);
|
|
n_out4p0 = n_tex_read.rgb;
|
|
n_out4p1 = n_tex_read.a;
|
|
}
|
|
|
|
// Output:0
|
|
ALBEDO = n_out4p0;
|
|
|
|
}
|
|
|
|
void light() {
|
|
// Output:0
|
|
|
|
}
|
|
"
|
|
|
|
[sub_resource type="ShaderMaterial" id=10]
|
|
shader = SubResource( 11 )
|
|
shader_param/HexAffineInverse = null
|
|
shader_param/MapAlbedoTexture = ExtResource( 2 )
|
|
|
|
[sub_resource type="CylinderShape" id=5]
|
|
height = 1.0
|
|
radius = 0.5
|
|
|
|
[node name="HexTile3D" type="Spatial"]
|
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0096302, 0, 0 )
|
|
script = ExtResource( 1 )
|
|
|
|
[node name="Mesh" type="MeshInstance" parent="."]
|
|
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0.00399733, -5, 0 )
|
|
mesh = SubResource( 6 )
|
|
material/0 = SubResource( 10 )
|
|
|
|
[node name="StaticBody" type="StaticBody" parent="."]
|
|
|
|
[node name="CollisionShape" type="CollisionShape" parent="StaticBody"]
|
|
transform = Transform( -4.37114e-08, 0, 1, 0, 10, 0, -1, 0, -4.37114e-08, 0, -5, 0 )
|
|
shape = SubResource( 5 )
|