30 #include "model/structures/instance.h"
31 #include "model/metamodel/object.h"
32 #include "model/metamodel/action.h"
35 #include "renderitem.h"
38 const int32_t STATIC_IMAGE_NOT_INITIALIZED = -2;
40 RenderItem::RenderItem():
44 m_cached_static_img_id(STATIC_IMAGE_NOT_INITIALIZED),
45 m_cached_static_img_angle(0) {
48 int32_t RenderItem::getStaticImageIndexByAngle(uint32_t angle, Instance* instance) {
49 if (static_cast<int32_t>(angle) != m_cached_static_img_angle) {
50 m_cached_static_img_id = STATIC_IMAGE_NOT_INITIALIZED;
52 if (m_cached_static_img_id != STATIC_IMAGE_NOT_INITIALIZED) {
53 return m_cached_static_img_id;
55 if(!instance->getObject()->getVisual<ObjectVisual>()) {
59 m_cached_static_img_id = instance->getObject()->getVisual<ObjectVisual>()->getStaticImageIndexByAngle(angle);
60 m_cached_static_img_angle = angle;
61 return m_cached_static_img_id;