Made rendering buildings more efficient
This commit is contained in:
parent
cf2dd03dc0
commit
00e2793a53
4 changed files with 20 additions and 8 deletions
|
|
@ -11,11 +11,16 @@ varying vec2 world_position;
|
||||||
|
|
||||||
void vertex()
|
void vertex()
|
||||||
{
|
{
|
||||||
|
location = ivec2(128. * COLOR.xy);
|
||||||
|
dimension = ivec2(128. * COLOR.zw);
|
||||||
|
|
||||||
|
vec2 myloc = vec2(location) + UV * (vec2(dimension) + vec2(0., .5));
|
||||||
|
float angle = float(myloc.x) * TAU / 60.;
|
||||||
|
float height = float(myloc.y) * cell_height + ground_height;
|
||||||
|
VERTEX = vec2(cos(angle), sin(angle)) * height;
|
||||||
|
//VERTEX = myloc;
|
||||||
|
VERTEX = (inverse(MODEL_MATRIX) * vec4(VERTEX, 0, 1)).xy;
|
||||||
world_position = (MODEL_MATRIX * vec4(VERTEX, 0.0, 1.0)).xy;
|
world_position = (MODEL_MATRIX * vec4(VERTEX, 0.0, 1.0)).xy;
|
||||||
location = ivec2(256. * COLOR.xy);
|
|
||||||
dimension = ivec2(256. * COLOR.zw);
|
|
||||||
//location = ivec2(45, 1);
|
|
||||||
//dimension = ivec2(1, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
|
|
@ -29,7 +34,8 @@ void fragment() {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
COLOR = texture(TEXTURE, vec2(sample_x, sample_y));
|
COLOR = texture(TEXTURE, vec2(sample_x, sample_y));
|
||||||
//COLOR = vec4(ivec4(location, dimension));
|
//COLOR = vec4(ivec4(location, dimension))/16.;
|
||||||
|
//COLOR = vec4(1., 1., 1., 1.);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@ shader_parameter/cell_height = 300.0
|
||||||
shader_parameter/num_cells = 60
|
shader_parameter/num_cells = 60
|
||||||
|
|
||||||
[node name="Building" type="Node2D"]
|
[node name="Building" type="Node2D"]
|
||||||
|
modulate = Color(0.3529412, 0, 0.007843138, 0.007843138)
|
||||||
script = ExtResource("1_5j34s")
|
script = ExtResource("1_5j34s")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
self_modulate = Color(0.1764706, 0, 0.003921569, 0.003921569)
|
|
||||||
material = SubResource("ShaderMaterial_qnfc1")
|
material = SubResource("ShaderMaterial_qnfc1")
|
||||||
scale = Vector2(15, 15)
|
scale = Vector2(250, 250)
|
||||||
texture = ExtResource("2_2yopf")
|
texture = ExtResource("2_2yopf")
|
||||||
script = ExtResource("4_qnfc1")
|
script = ExtResource("4_qnfc1")
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,4 @@ extends Sprite2D
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
var location = Vector2i(get_parent().location)
|
var location = Vector2i(get_parent().location)
|
||||||
var dimension = Vector2i(get_parent().dimension)
|
var dimension = Vector2i(get_parent().dimension)
|
||||||
self_modulate = Color8(location.x, location.y, dimension.x, dimension.y)
|
self_modulate = 2 * Color8(location.x, location.y, dimension.x, dimension.y)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/player_walk.png-59515d82f701e5545419ecd7b3460
|
||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
|
|
@ -25,6 +27,10 @@ mipmaps/generate=false
|
||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue