<commit_before>#include "core/system/components/rendering_component.h"
#include "core/system/gameobject.h"

#include "core/rendering/render_manager.h"
#include "core/rendering/renderable_entity.h"



namespace eversim { namespace core { namespace system {


	rendering_component::rendering_component(
		gameobject* owner, rendering::render_manager& mng, std::string const& texture_name
	)
		: component(owner)
	{
		display = mng.register_entity();
		display->set_Texture(*mng.register_texture(texture_name));
		update_transform();
	}

	void rendering_component::post_physics_update()
	{
		update_transform();
	}

	void rendering_component::update_transform()
	{
		display->set_Position(get_owner().get_position() + offset);
		display->set_Scale(get_owner().get_scale());
		// todo: rotation?!?
	}

}}}<commit_msg>rendering component now also respects angle of the object<commit_after>#include "core/system/components/rendering_component.h"
#include "core/system/gameobject.h"

#include "core/rendering/render_manager.h"
#include "core/rendering/renderable_entity.h"

#include "core/utility/matrix_helper.h"

#include <glm/gtc/matrix_transform.inl>


namespace eversim { namespace core { namespace system {


	rendering_component::rendering_component(
		gameobject* owner, rendering::render_manager& mng, std::string const& texture_name
	)
		: component(owner)
	{
		display = mng.register_entity();
		display->set_Texture(*mng.register_texture(texture_name));
		offset = -.5f*owner->get_scale();
		update_transform();
	}

	void rendering_component::post_physics_update()
	{
		update_transform();
	}

	void rendering_component::update_transform()
	{
		using namespace glm;
		using namespace utility;

		const auto& obj = get_owner();
		auto M = mat3();

		M = scale(obj.get_scale()) * M;
		M = translation(-offset) * rotation(obj.get_angle()) * translation(offset) * M;
		M = translation(obj.get_position() + offset) * M;

		display->set_M(M);
	}

}}}
{'fraction_non_alphanumeric': 0.13545407901487944, 'fraction_numerical': 0.001026167265264238, 'mean_word_length': 5.724137931034483, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6641011', 'n_tokens_mistral': 673, 'n_tokens_neox': 632, 'n_words': 109}