protected color ShadowSprite(float player, data d, unit u, vec2 pos, TextureSampler Texture, float selection_blend, float selection_size, bool solid_blend_flag, float solid_blend) { if (pos.x > 1 || pos.y > 1 || pos.x < 0 || pos.y < 0) { return(color.TransparentBlack); } //bool draw_selected = u.player == player && show_selected(d) && pos.y > selection_size; bool draw_selected = u.player == player && fake_selected(d); var clr = Texture[pos]; if (draw_selected) { if (clr.a > 0) { float a = clr.a; clr = SelectedUnitColor.Get(u.player); clr.a = a; } //float a = clr.a * selection_blend; //clr = a * clr + (1 - a) * SelectedUnitColor.Get(u.player); } //if (solid_blend_flag) //{ // clr = solid_blend * clr + (1 - solid_blend) * SolidColor(player, d, u); //} return(clr); }
color FragmentShader(VertexOut vertex, Field <BuildingDist> BuildingDistances, Field <building> Data, Field <unit> Unit, float blend, float radius, [Player.Vals] float player) { BuildingDist info = BuildingDistances[Here]; if (info.dist > _15) { return(color.TransparentBlack); } vec2 subcell_pos = get_subcell_pos(vertex, BuildingDistances.Size); // Get the building data by following the offset vec2 offset = Float(info.diff - Pathfinding_ToSpecial.CenterOffset); var index = new RelativeIndex(offset.x, offset.y); building b = Data[index]; unit u = Unit[index]; // Get the distance from here to the building center float l = length(255 * (info.diff - Pathfinding_ToSpecial.CenterOffset) - (subcell_pos - vec(.5f, .5f))); // Draw pixel if (fake_selected(b) && u.player == player) { if (l > .8f * radius && l < radius * 1.15f) { color clr = SelectedUnitColor.Get(get_player(info)) * .75f; clr.a = 1; return(clr * blend); } if (l < radius) { color clr = BuildingMarkerColors.Get(get_player(info), get_type(info)) * 1f; clr.a = 1; return(clr * blend); } } else { if (l < radius) { color clr = BuildingMarkerColors.Get(get_player(info), get_type(info)); return(clr * blend); } } return(color.TransparentBlack); }
protected color SolidColor(float player, data data, unit unit) { return(unit.player == player && fake_selected(data) ? SelectedUnitColor.Get(unit.player) : UnitColor.Get(unit.player)); }