Skip to content

Commit

Permalink
[text_renderer] expose string_get_transform, undocumented for now
Browse files Browse the repository at this point in the history
  • Loading branch information
harrand committed Feb 26, 2024
1 parent 724e880 commit c4bee5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tz/ren/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ namespace tz::ren
strings[static_cast<std::size_t>(static_cast<tz::hanval>(sh))].model = transform.matrix();
}

//--------------------------------------------------------------------------------------------------

tz::trs char_storage::string_get_transform(tz::gl::renderer_handle rh, string_handle sh) const
{
auto strings = tz::gl::get_device().get_renderer(rh).get_resource(this->string_buffer)->data_as<const string_locator>();
return tz::trs::from_matrix(strings[static_cast<std::size_t>(static_cast<tz::hanval>(sh))].model);
}

//--------------------------------------------------------------------------------------------------

void char_storage::string_set_colour(tz::gl::renderer_handle rh, string_handle sh, tz::vec3 colour)
Expand Down Expand Up @@ -577,6 +585,13 @@ namespace tz::ren
this->chars.string_set_transform(this->rh, sh, transform);
}

//--------------------------------------------------------------------------------------------------

tz::trs text_renderer::string_get_transform(string_handle sh)
{
return this->chars.string_get_transform(this->rh, sh);
}

//--------------------------------------------------------------------------------------------------

void text_renderer::string_set_colour(string_handle sh, tz::vec3 colour)
Expand Down
2 changes: 2 additions & 0 deletions src/tz/ren/text.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace tz::ren
std::size_t string_count(bool include_free_list = false) const;

void string_set_transform(tz::gl::renderer_handle rh, string_handle sh, tz::trs transform);
tz::trs string_get_transform(tz::gl::renderer_handle rh, string_handle sh) const;
void string_set_colour(tz::gl::renderer_handle rh, string_handle sh, tz::vec3 colour);
void string_set_text(tz::gl::renderer_handle rh, string_handle sh, std::string);
float string_get_width_pixels(tz::gl::renderer_handle rh, string_handle sh) const;
Expand Down Expand Up @@ -166,6 +167,7 @@ namespace tz::ren
* @param transform New transform of the rendered text.
*/
void string_set_transform(string_handle sh, tz::trs transform);
tz::trs string_get_transform(string_handle sh);
/**
* Set the colour of an existing rendered text.
* @param sh String corresponding to the handle to be affected.
Expand Down

0 comments on commit c4bee5a

Please sign in to comment.