void LightRendererAnimationInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend) { Point p = m_anchor.getCalculatedPoint(cam, layer, true); if(m_anchor.getLayer() == layer) { int32_t animtime = scaleTime(m_time_scale, TimeManager::instance()->getTime() - m_start_time) % m_animation->getDuration(); ImagePtr img = m_animation->getFrameByTimestamp(animtime); Rect r; Rect viewport = cam->getViewPort(); uint32_t width = static_cast<uint32_t>(round(img->getWidth() * cam->getZoom())); uint32_t height = static_cast<uint32_t>(round(img->getHeight() * cam->getZoom())); r.x = p.x-width/2; r.y = p.y-height/2; r.w = width; r.h = height; if(r.intersects(viewport)) { uint8_t lm = renderbackend->getLightingModel(); img->render(r); if (m_stencil) { renderbackend->changeRenderInfos(RENDER_DATA_WITHOUT_Z, 1, m_src, m_dst, false, true, m_stencil_ref, INCR, GEQUAL); } else if (lm == 1) { renderbackend->changeRenderInfos(RENDER_DATA_WITHOUT_Z, 1, m_src, m_dst, false, true, 255, KEEP, NOTEQUAL); } } } }
void GenericRendererAnimationInfo::render(Camera* cam, Layer* layer, std::vector<Instance*>& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) { Point p = m_anchor.getCalculatedPoint(cam, layer, instances); Animation& animation = animpool->getAnimation(m_animation); int animtime = scaleTime(m_time_scale, TimeManager::instance()->getTime() - m_start_time) % animation.getDuration(); Image* img = animation.getFrameByTimestamp(animtime); Rect r; r.x = p.x-img->getWidth()/2; r.y = p.y-img->getHeight()/2; r.w = img->getWidth(); r.h = img->getHeight(); img->render(r); }
void OffRendererAnimationInfo::render(RenderBackend* renderbackend) { int32_t animtime = scaleTime(m_time_scale, TimeManager::instance()->getTime() - m_start_time) % m_animation->getDuration(); ImagePtr img = m_animation->getFrameByTimestamp(animtime); Rect r; uint16_t width = img->getWidth(); uint16_t height = img->getHeight(); r.x = m_anchor.x-width/2; r.y = m_anchor.y-height/2; r.w = width; r.h = height; img->render(r); }
void LightRendererAnimationInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) { Point p = m_anchor.getCalculatedPoint(cam, layer); if(m_anchor.getLayer() == layer) { Animation& animation = animpool->getAnimation(m_animation); int animtime = scaleTime(m_time_scale, TimeManager::instance()->getTime() - m_start_time) % animation.getDuration(); Image* img = animation.getFrameByTimestamp(animtime); Rect r; Rect viewport = cam->getViewPort(); unsigned int widtht = round(img->getWidth() * cam->getZoom()); unsigned int height = round(img->getHeight() * cam->getZoom()); r.x = p.x-widtht/2; r.y = p.y-height/2; r.w = widtht; r.h = height; renderbackend->changeBlending(m_src, m_dst); if(r.intersects(viewport)) img->render(r); } }
void GenericRendererAnimationInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend) { Point p = m_anchor.getCalculatedPoint(cam, layer, m_zoomed); if(m_anchor.getLayer() == layer) { int32_t animtime = scaleTime(m_time_scale, TimeManager::instance()->getTime() - m_start_time) % m_animation->getDuration(); ImagePtr img = m_animation->getFrameByTimestamp(animtime); Rect r; Rect viewport = cam->getViewPort(); uint32_t width, height; if(m_zoomed) { width = static_cast<uint32_t>(round(img->getWidth() * cam->getZoom())); height = static_cast<uint32_t>(round(img->getHeight() * cam->getZoom())); } else { width = img->getWidth(); height = img->getHeight(); } r.x = p.x-width/2; r.y = p.y-height/2; r.w = width; r.h = height; if(r.intersects(viewport)) { img->render(r); } } }