| 245 | } |
| 246 | |
| 247 | void Cinematic::drawDrawable(Drawable const& drawable, float drawableScale, Vec2F const& drawableTranslation) { |
| 248 | auto& guiContext = GuiContext::singleton(); |
| 249 | auto& renderer = guiContext.renderer(); |
| 250 | auto& textureGroup = guiContext.assetTextureGroup(); |
| 251 | |
| 252 | auto& primitives = renderer->immediatePrimitives(); |
| 253 | |
| 254 | if (drawable.isImage()) { |
| 255 | auto const& imagePart = drawable.imagePart(); |
| 256 | auto texture = textureGroup->loadTexture(imagePart.image); |
| 257 | auto size = Vec2F(texture->size()); |
| 258 | |
| 259 | RectF imageRect(Vec2F(), size); |
| 260 | |
| 261 | Vec2F screenTranslation = drawable.position * drawableScale + drawableTranslation; |
| 262 | |
| 263 | Vec2F lowerLeft = |
| 264 | imagePart.transformation.transformVec2(Vec2F(imageRect.xMin(), imageRect.yMin())) * drawableScale |
| 265 | + screenTranslation; |
| 266 | Vec2F lowerRight = |
| 267 | imagePart.transformation.transformVec2(Vec2F(imageRect.xMax(), imageRect.yMin())) * drawableScale |
| 268 | + screenTranslation; |
| 269 | Vec2F upperRight = |
| 270 | imagePart.transformation.transformVec2(Vec2F(imageRect.xMax(), imageRect.yMax())) * drawableScale |
| 271 | + screenTranslation; |
| 272 | Vec2F upperLeft = |
| 273 | imagePart.transformation.transformVec2(Vec2F(imageRect.xMin(), imageRect.yMax())) * drawableScale |
| 274 | + screenTranslation; |
| 275 | |
| 276 | Vec4B drawableColor = drawable.color.toRgba(); |
| 277 | |
| 278 | primitives.emplace_back(std::in_place_type_t<RenderQuad>(), std::move(texture), |
| 279 | lowerLeft, Vec2F{0, 0}, |
| 280 | lowerRight, Vec2F{size[0], 0}, |
| 281 | upperRight, Vec2F{size[0], size[1]}, |
| 282 | upperLeft, Vec2F{0, size[1]}, |
| 283 | drawableColor, 0.0f); |
| 284 | } else { |
| 285 | starAssert(drawable.part.empty()); |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | void Cinematic::updateCamera(float timecode) { |
| 290 | float startZoom = 1.0f; |
no test coverage detected