30 #include "model/structures/instance.h"
31 #include "model/metamodel/object.h"
32 #include "model/metamodel/action.h"
33 #include "util/resource/pool.h"
36 #include "renderitem.h"
39 const int STATIC_IMAGE_NOT_INITIALIZED = -2;
41 RenderItem::RenderItem():
45 m_cached_static_img_id(STATIC_IMAGE_NOT_INITIALIZED),
46 m_cached_static_img_angle(0) {
49 int RenderItem::getStaticImageIndexByAngle(
unsigned int angle, Instance* instance) {
50 if (static_cast<int>(angle) != m_cached_static_img_angle) {
51 m_cached_static_img_id = STATIC_IMAGE_NOT_INITIALIZED;
53 if (m_cached_static_img_id != STATIC_IMAGE_NOT_INITIALIZED) {
54 return m_cached_static_img_id;
56 if(!instance->getObject()->getVisual<ObjectVisual>())
58 m_cached_static_img_id = instance->getObject()->getVisual<ObjectVisual>()->getStaticImageIndexByAngle(angle);
59 m_cached_static_img_angle = angle;
60 return m_cached_static_img_id;