41 bool has_extents()
const override {
return iTextures !=
nullptr && !iTextures->empty(); }
42 size extents()
const override {
return has_extents() ? (*iTextures)[0].second != boost::none ? *(*iTextures)[0].second : (*iTextures)[0].first->extents() :
size{}; }
58 typedef std::vector<std::shared_ptr<i_shape_frame>> frame_list;
74 std::vector<texture_sheet_item>
items;
83 shape(
const i_texture& aTexture,
const optional_animation_info& aAnimationInfo = optional_animation_info());
84 shape(
const i_image& aImage,
const optional_animation_info& aAnimationInfo = optional_animation_info());
85 shape(
const i_texture& aTexture,
const rect& aTextureRect,
const optional_animation_info& aAnimationInfo = optional_animation_info());
86 shape(
const i_image& aImage,
const rect& aTextureRect,
const optional_animation_info& aAnimationInfo = optional_animation_info());
97 const i_shape& as_shape()
const override;
103 bool killed()
const override;
104 void kill()
override;
111 void activate_faces(
face_list aActiveFaces)
const override;
112 mat44 transformation_matrix()
const override;
113 const vertex_list& transformed_vertices()
const override;
117 void set_faces(
face_list aFaces)
override;
125 bool is_tag()
const override;
126 i_shape& tag_of()
const override;
127 void set_tag_of(
i_shape& aTagOf,
const vec3& aOffset =
vec3{})
override;
128 const vec3& tag_offset()
const override;
129 void set_tag_offset(
const vec3& aOffset)
override;
130 void unset_tag_of()
override;
133 frame_index frame_count()
const override;
137 void add_frame(std::shared_ptr<i_shape_frame> aFrame)
override;
138 void replace_frame(frame_index aFrameIndex,
i_shape_frame& aFrame)
override;
139 void replace_frame(frame_index aFrameIndex, std::shared_ptr<i_shape_frame> aFrame)
override;
140 void remove_frame(frame_index aFrameIndex)
override;
143 const animation_frames& animation()
const override;
144 bool repeat_animation()
const override;
145 const animation_frame& current_animation_frame()
const override;
146 bool has_animation_finished()
const override;
147 void animation_finished()
override;
148 frame_index current_frame_index()
const override;
151 vec3 origin()
const override;
152 vec3 position()
const override;
154 rect bounding_box_2d(
bool aWithPosition =
true)
const override;
155 void set_animation(
const animation_frames& aAnimation)
override;
156 void set_current_frame(frame_index aFrameIndex)
override;
157 void set_origin(
const vec3& aOrigin)
override;
158 void set_position(
const vec3& aPosition)
override;
159 void clear_extents()
override;
160 void set_extents(
const vec3& aExtents)
override;
161 bool has_transformation_matrix()
const override;
162 void clear_transformation_matrix()
override;
163 void set_transformation_matrix(
const mat33& aTransformationMatrix)
override;
164 void set_transformation_matrix(
const mat44& aTransformationMatrix)
override;
167 bool update(time_interval aNow)
override;
171 virtual void clear_vertices_cache();
174 void init_frames(
const i_texture& aTexture,
const optional_rect& aTextureRect,
const optional_animation_info& aAnimationInfo);
175 void init_frames(
texture_list_pointer aTextures,
const optional_animation_info& aAnimationInfo);
180 animation_frames iAnimation;
181 bool iRepeatAnimation;
182 frame_index iAnimationFrame;
183 frame_index iCurrentFrame;
184 optional_time_interval iTimeOfLastUpdate;
189 std::pair<i_shape*, vec3> iTagOf;
const optional_mat33 & transformation() const override
std::shared_ptr< vertex_list > vertex_list_pointer
void set_transformation(const optional_mat33 &aTransformation) override
size extents() const override
shape_frame(const colour_or_gradient &aColour)
shape_frame(const i_texture &aTexture, const optional_rect &aTextureRect)
texture_list_pointer textures() const override
boost::optional< mat33 > optional_mat33
boost::optional< colour_or_gradient > optional_colour_or_gradient
boost::optional< vec3 > optional_vec3
texture_list_pointer to_texture_list_pointer(const i_texture &aTexture, const optional_rect &aTextureRect=optional_rect{})
boost::optional< rect > optional_rect
void set_textures(texture_list_pointer aTextures) override
i_shape::optional_time_interval optional_time_interval
i_shape::animation_frames animation_frames
boost::optional< animation_info > optional_animation_info
bool has_extents() const override
shape_frame(const i_texture &aTexture, const mat33 &aTransformation)
std::vector< animation_frame > animation_frames
std::vector< vertex > vertex_list
shape_frame(texture_list_pointer aTextures)
void set_colour(const optional_colour_or_gradient &aColour) override
std::vector< texture_sheet_item > items
boost::optional< mat44 > optional_mat44
i_shape::time_interval time_interval
i_shape::animation_frame animation_frame
std::shared_ptr< texture_list > texture_list_pointer
std::pair< frame_index, time_interval > animation_frame
const optional_colour_or_gradient & colour() const override
shape_frame(const i_texture &aTexture, const optional_rect &aTextureRect, const mat33 &aTransformation)
shape_frame(const colour_or_gradient &aColour, const mat33 &aTransformation)
shape_frame(const i_texture &aTexture)
shape_frame(texture_list_pointer aTextures, const mat33 &aTransformation)
i_shape::frame_index frame_index
boost::optional< time_interval > optional_time_interval