Skip to content

Commit

Permalink
fix graphics deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Bauumm committed Oct 23, 2024
1 parent 92efa30 commit a853c7b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions compat/game192/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ if not args.headless then
message_font = love.graphics.newFont("assets/font/imagine.ttf", 40)
layer_shader = love.graphics.newShader(
[[
attribute vec2 instance_offset;
attribute vec4 instance_color;
layout(location = 3) in vec2 instance_offset;
layout(location = 4) in vec4 instance_color;
varying vec4 instance_color_out;
vec4 position(mat4 transform_projection, vec4 vertex_position)
Expand Down Expand Up @@ -461,8 +461,8 @@ function public.draw(screen)
instance_colors[i][4] = a
a = (a - alpha_falloff) % 256
end
main_quads:set_instance_attribute_array("instance_offset", "float", 2, instance_offsets)
main_quads:set_instance_attribute_array("instance_color", "float", 4, instance_colors)
main_quads:set_instance_attribute_array("instance_offset", "floatvec2", 3, instance_offsets)
main_quads:set_instance_attribute_array("instance_color", "floatvec4", 4, instance_colors)
love.graphics.setShader(layer_shader)
main_quads:draw_instanced(depth)
love.graphics.setShader()
Expand Down
8 changes: 4 additions & 4 deletions compat/game20/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ function public.draw(screen)
instance_colors[i][4] = a
a = (a - alpha_falloff) % 256
end
main_quads:set_instance_attribute_array("instance_offset", "float", 2, instance_offsets)
main_quads:set_instance_attribute_array("instance_color", "float", 4, instance_colors)
main_quads:set_instance_attribute_array("instance_offset", "floatvec2", 3, instance_offsets)
main_quads:set_instance_attribute_array("instance_color", "floatvec4", 4, instance_colors)
love.graphics.setShader(layer_shader)
main_quads:draw_instanced(depth)
love.graphics.setShader()
Expand Down Expand Up @@ -463,8 +463,8 @@ public.init = async(function(conf, audio)
message_font = love.graphics.newFont("assets/font/imagine.ttf", 38)
layer_shader = love.graphics.newShader(
[[
attribute vec2 instance_offset;
attribute vec4 instance_color;
layout(location = 3) in vec2 instance_offset;
layout(location = 4) in vec4 instance_color;
varying vec4 instance_color_out;
vec4 position(mat4 transform_projection, vec4 vertex_position)
Expand Down
4 changes: 2 additions & 2 deletions compat/game21/dynamic_quads.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ function quads:_resize()
end
end

function quads:set_instance_attribute_array(attribute, attr_type, components, values)
function quads:set_instance_attribute_array(attribute, attr_format, bindinglocation, values)
if self.instance_meshes[attribute] == nil or #values ~= self.instance_meshes[attribute]:getVertexCount() then
-- give some fake draw mode as love 12 does not like nil as draw mode anymore
self.instance_meshes[attribute] =
love.graphics.newMesh({ { attribute, attr_type, components } }, values, "strip", "stream")
love.graphics.newMesh({ { name = attribute, format = attr_format, location = bindinglocation } }, values, "strip", "stream")
self.mesh:attachAttribute(attribute, self.instance_meshes[attribute], "perinstance")
else
self.instance_meshes[attribute]:setVertices(values)
Expand Down
4 changes: 2 additions & 2 deletions compat/game21/dynamic_tris.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ function tris:_resize()
end
end

function tris:set_instance_attribute_array(attribute, attr_type, components, values)
function tris:set_instance_attribute_array(attribute, attr_type, bindinglocation, values)
if self.instance_meshes[attribute] == nil or #values ~= self.instance_meshes[attribute]:getVertexCount() then
-- give some fake draw mode as love 12 does not like nil as draw mode anymore
self.instance_meshes[attribute] =
love.graphics.newMesh({ { attribute, attr_type, components } }, values, "strip", "stream")
love.graphics.newMesh({ { name = attribute, format = attr_type, location = bindinglocation } }, values, "strip", "stream")
self.mesh:attachAttribute(attribute, self.instance_meshes[attribute], "perinstance")
else
self.instance_meshes[attribute]:setVertices(values)
Expand Down
16 changes: 8 additions & 8 deletions compat/game21/pseudo3d.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function pseudo3d.init(pass_game)
if not args.headless then
layer_shader = love.graphics.newShader(
[[
attribute vec2 instance_position;
attribute vec4 instance_color;
layout(location = 3) in vec2 instance_position;
layout(location = 4) in vec4 instance_color;
varying vec4 instance_color_out;
vec4 position(mat4 transform_projection, vec4 vertex_position)
Expand Down Expand Up @@ -123,12 +123,12 @@ function pseudo3d.draw(set_render_stage, wall_quads, pivot_quads, player_tris, b
player_layer_colors[j][4] = a
end
if depth > 0 then
wall_quads:set_instance_attribute_array("instance_position", "float", 2, layer_offsets)
wall_quads:set_instance_attribute_array("instance_color", "float", 4, wall_layer_colors)
pivot_quads:set_instance_attribute_array("instance_position", "float", 2, layer_offsets)
pivot_quads:set_instance_attribute_array("instance_color", "float", 4, pivot_layer_colors)
player_tris:set_instance_attribute_array("instance_position", "float", 2, layer_offsets)
player_tris:set_instance_attribute_array("instance_color", "float", 4, player_layer_colors)
wall_quads:set_instance_attribute_array("instance_position", "floatvec2", 3, layer_offsets)
wall_quads:set_instance_attribute_array("instance_color", "floatvec4", 4, wall_layer_colors)
pivot_quads:set_instance_attribute_array("instance_position", "floatvec2", 3, layer_offsets)
pivot_quads:set_instance_attribute_array("instance_color", "floatvec4", 4, pivot_layer_colors)
player_tris:set_instance_attribute_array("instance_position", "floatvec2", 3, layer_offsets)
player_tris:set_instance_attribute_array("instance_color", "floatvec4", 4, player_layer_colors)

set_render_stage(1, layer_shader, true)
wall_quads:draw_instanced(depth)
Expand Down

0 comments on commit a853c7b

Please sign in to comment.