# HG changeset patch # User helios2000@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1290355094 0 # Node ID 60621d858548beda965e048ff2c4fba9ba7c4503 # Parent 49fb0370f8e1490a6a7ff5ccdc846bf626f03de1 * Fixed the image/animation functions in GenericRenderer and LightRenderer. The functions now consider the camera zoom level. * Added the forgotten LightEdit plugin for the editor. diff -r 49fb0370f8e1 -r 60621d858548 engine/core/view/renderers/genericrenderer.cpp --- a/engine/core/view/renderers/genericrenderer.cpp Thu Nov 18 17:28:15 2010 +0000 +++ b/engine/core/view/renderers/genericrenderer.cpp Sun Nov 21 15:58:14 2010 +0000 @@ -328,10 +328,12 @@ Image* img = &imagepool->getImage(m_image); Rect r; Rect viewport = cam->getViewPort(); - r.x = p.x-img->getWidth()/2; - r.y = p.y-img->getHeight()/2; - r.w = img->getWidth(); - r.h = img->getHeight(); + 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; if(r.intersects(viewport)) img->render(r); } @@ -352,10 +354,12 @@ Image* img = animation.getFrameByTimestamp(animtime); Rect r; Rect viewport = cam->getViewPort(); - r.x = p.x-img->getWidth()/2; - r.y = p.y-img->getHeight()/2; - r.w = img->getWidth(); - r.h = img->getHeight(); + 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; if(r.intersects(viewport)) img->render(r); } @@ -397,13 +401,16 @@ if(m_anchor.getLayer() == layer) { Image* img = &imagepool->getImage(m_image); Rect r; - r.x = p.x-m_width/2; - r.y = p.y-m_height/2; - r.w = m_width; - r.h = m_height; - renderbackend->disableLighting(); - img->render(r); - renderbackend->enableLighting(); + Rect viewport = cam->getViewPort(); + unsigned int widtht = round(m_width * cam->getZoom()); + unsigned int height = round(m_height * cam->getZoom()); + r.x = p.x-widtht/2; + r.y = p.y-height/2; + r.w = widtht; + r.h = height; + if(r.intersects(viewport)) { + img->render(r); + } } } diff -r 49fb0370f8e1 -r 60621d858548 engine/core/view/renderers/lightrenderer.cpp --- a/engine/core/view/renderers/lightrenderer.cpp Thu Nov 18 17:28:15 2010 +0000 +++ b/engine/core/view/renderers/lightrenderer.cpp Sun Nov 21 15:58:14 2010 +0000 @@ -247,10 +247,12 @@ Image* img = &imagepool->getImage(m_image); Rect r; Rect viewport = cam->getViewPort(); - r.x = p.x-img->getWidth()/2; - r.y = p.y-img->getHeight()/2; - r.w = img->getWidth(); - r.h = img->getHeight(); + 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); @@ -296,10 +298,12 @@ Image* img = animation.getFrameByTimestamp(animtime); Rect r; Rect viewport = cam->getViewPort(); - r.x = p.x-img->getWidth()/2; - r.y = p.y-img->getHeight()/2; - r.w = img->getWidth(); - r.h = img->getHeight(); + 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); @@ -343,10 +347,12 @@ Image* img = &imagepool->getImage(m_image); Rect r; Rect viewport = cam->getViewPort(); - r.x = p.x-m_width/2; - r.y = p.y-m_height/2; - r.w = m_width; - r.h = m_height; + unsigned int widtht = round(m_width * cam->getZoom()); + unsigned int height = round(m_height * 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); @@ -392,8 +398,9 @@ void LightRendererSimpleLightInfo::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) { + double zoom = cam->getZoom(); renderbackend->changeBlending(m_src, m_dst); - renderbackend->drawLightPrimitive(p, m_intensity, m_radius, m_subdivisions, m_xstretch, m_ystretch, m_red, m_green, m_blue); + renderbackend->drawLightPrimitive(p, m_intensity, m_radius, m_subdivisions, m_xstretch * zoom, m_ystretch * zoom, m_red, m_green, m_blue); } } void LightRendererSimpleLightInfo::setStencil(uint8_t stencil_ref, float alpha_ref) { diff -r 49fb0370f8e1 -r 60621d858548 tools/editor/gui/lightedit.xml --- a/tools/editor/gui/lightedit.xml Thu Nov 18 17:28:15 2010 +0000 +++ b/tools/editor/gui/lightedit.xml Sun Nov 21 15:58:14 2010 +0000 @@ -1,32 +1,182 @@ - -