summaryrefslogtreecommitdiffhomepage
path: root/draw
diff options
context:
space:
mode:
Diffstat (limited to 'draw')
-rw-r--r--draw/anim.cpp6
-rw-r--r--draw/floor.cpp3
-rw-r--r--draw/wall.cpp3
-rw-r--r--draw/wireframe.cpp3
4 files changed, 5 insertions, 10 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp
index 0270ef6d..02421ddb 100644
--- a/draw/anim.cpp
+++ b/draw/anim.cpp
@@ -77,10 +77,9 @@ void anim_mesh::draw(tile_shader& shader, const Vector2i& win_size, chunk& c, st
{
fm_assert(i < size);
GL::MeshView mesh{mesh_};
- atlas.texture().bind(0);
mesh.setCount((int)(quad_index_count * 1));
mesh.setIndexRange((int)(x.mesh_idx*quad_index_count), 0, max_index);
- shader.draw(mesh);
+ shader.draw(atlas.texture(), mesh);
i++;
}
else
@@ -105,8 +104,7 @@ void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t
for (auto i = 0uz; i < 4; i++)
array[i] = { pos[i], texcoords[i], depth };
_vertex_buffer.setSubData(0, array);
- atlas.texture().bind(0);
- shader.draw(_mesh);
+ shader.draw(atlas.texture(), _mesh);
}
void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, local_coords xy, Vector2b offset, float depth)
diff --git a/draw/floor.cpp b/draw/floor.cpp
index d030c5a6..8e92c966 100644
--- a/draw/floor.cpp
+++ b/draw/floor.cpp
@@ -25,10 +25,9 @@ void floor_mesh::draw(tile_shader& shader, chunk& c)
return;
if (auto len = i - last.pos; last.atlas && len > 0)
{
- last.atlas->texture().bind(0);
mesh.setCount((int)(quad_index_count * len));
mesh.setIndexRange((int)(last.pos*quad_index_count), 0, max_index);
- shader.draw(mesh);
+ shader.draw(last.atlas->texture(), mesh);
draw_count++;
}
last = { atlas, i };
diff --git a/draw/wall.cpp b/draw/wall.cpp
index 4562a250..f6f06c4c 100644
--- a/draw/wall.cpp
+++ b/draw/wall.cpp
@@ -26,10 +26,9 @@ void wall_mesh::draw(tile_shader& shader, chunk& c)
return;
if (auto len = i - last.pos; last.atlas && len > 0)
{
- last.atlas->texture().bind(0);
mesh.setCount((int)(quad_index_count * len));
mesh.setIndexRange((int)(last.pos*quad_index_count), 0, max_index);
- shader.draw(mesh);
+ shader.draw(last.atlas->texture(), mesh);
draw_count++;
}
last = { atlas, i };
diff --git a/draw/wireframe.cpp b/draw/wireframe.cpp
index 28621b8f..5d041991 100644
--- a/draw/wireframe.cpp
+++ b/draw/wireframe.cpp
@@ -50,8 +50,7 @@ mesh_base::mesh_base(GL::MeshPrimitive primitive, ArrayView<const void> index_da
void mesh_base::draw(tile_shader& shader)
{
- _texture->bind(0);
- shader.draw(_mesh);
+ shader.draw(*_texture, _mesh);
}
void mesh_base::set_subdata(ArrayView<const void> array)