Browse Source

- don't add Actor to bounds
- working on outline Tween

dmuratshin 9 years ago
parent
commit
d0a1c1c6c5

+ 3 - 3
examples/Demo/data/pp_blit_fs.glsl

@@ -1,9 +1,9 @@
 /* BlurFragmentShader.glsl */
-precision mediump float;
+//precision mediump float;
  
-uniform sampler2D s_texture;
+uniform mediump sampler2D s_texture;
  
-varying vec2 v_texCoord;
+varying mediump vec2 v_texCoord;
  
 void main()
 {

+ 5 - 5
examples/Demo/data/pp_blit_vs.glsl

@@ -1,12 +1,12 @@
 /* VBlurVertexShader.glsl */
-attribute vec3 position;
-attribute vec4 color;
-attribute vec2 uv;
+attribute  vec3 position;
+attribute  vec4 color;
+attribute  vec2 uv;
  
 uniform mediump float step;
 
-varying vec2 v_texCoord;
-varying vec4 v_color;
+varying mediump vec2 v_texCoord;
+varying mediump vec4 v_color;
  
 void main()
 {

+ 17 - 17
examples/Demo/data/pp_hblur_vs.glsl

@@ -5,28 +5,28 @@ attribute vec2 uv;
  
 uniform mediump float step;
 
-varying vec2 v_texCoord;
-varying vec2 v_blurTexCoords[14];
+varying mediump vec2 v_texCoord;
+varying mediump vec2 v_blurTexCoords[14];
  
 void main()
 {
     gl_Position = vec4(position.xy, 0, 1.0);
-    float z = step;
+    mediump float z = step;
 
 
     v_texCoord = uv;
-    v_blurTexCoords[ 0] = v_texCoord + vec2(-z * 7, 0.0);
-    v_blurTexCoords[ 1] = v_texCoord + vec2(-z * 6, 0.0);
-    v_blurTexCoords[ 2] = v_texCoord + vec2(-z * 5, 0.0);
-    v_blurTexCoords[ 3] = v_texCoord + vec2(-z * 4, 0.0);
-    v_blurTexCoords[ 4] = v_texCoord + vec2(-z * 3, 0.0);
-    v_blurTexCoords[ 5] = v_texCoord + vec2(-z * 2, 0.0);
-    v_blurTexCoords[ 6] = v_texCoord + vec2(-z    , 0.0);
-    v_blurTexCoords[ 7] = v_texCoord + vec2( z    , 0.0);
-    v_blurTexCoords[ 8] = v_texCoord + vec2( z * 2, 0.0);
-    v_blurTexCoords[ 9] = v_texCoord + vec2( z * 3, 0.0);
-    v_blurTexCoords[10] = v_texCoord + vec2( z * 4, 0.0);
-    v_blurTexCoords[11] = v_texCoord + vec2( z * 5, 0.0);
-    v_blurTexCoords[12] = v_texCoord + vec2( z * 6, 0.0);
-    v_blurTexCoords[13] = v_texCoord + vec2( z * 7, 0.0);
+    v_blurTexCoords[ 0] = v_texCoord + vec2(-z * 7.0, 0.0);
+    v_blurTexCoords[ 1] = v_texCoord + vec2(-z * 6.0, 0.0);
+    v_blurTexCoords[ 2] = v_texCoord + vec2(-z * 5.0, 0.0);
+    v_blurTexCoords[ 3] = v_texCoord + vec2(-z * 4.0, 0.0);
+    v_blurTexCoords[ 4] = v_texCoord + vec2(-z * 3.0, 0.0);
+    v_blurTexCoords[ 5] = v_texCoord + vec2(-z * 2.0, 0.0);
+    v_blurTexCoords[ 6] = v_texCoord + vec2(-z      , 0.0);
+    v_blurTexCoords[ 7] = v_texCoord + vec2( z      , 0.0);
+    v_blurTexCoords[ 8] = v_texCoord + vec2( z * 2.0, 0.0);
+    v_blurTexCoords[ 9] = v_texCoord + vec2( z * 3.0, 0.0);
+    v_blurTexCoords[10] = v_texCoord + vec2( z * 4.0, 0.0);
+    v_blurTexCoords[11] = v_texCoord + vec2( z * 5.0, 0.0);
+    v_blurTexCoords[12] = v_texCoord + vec2( z * 6.0, 0.0);
+    v_blurTexCoords[13] = v_texCoord + vec2( z * 7.0, 0.0);
 }

+ 21 - 20
examples/Demo/data/pp_rast_fs.glsl

@@ -1,28 +1,29 @@
 /* BlurFragmentShader.glsl */
-precision mediump float;
+//precision mediump float;
  
-uniform sampler2D s_texture;
+uniform lowp sampler2D s_texture;
  
-varying vec2 v_texCoord;
-varying vec2 v_blurTexCoords[14];
+varying mediump vec2 v_texCoord;
+varying mediump vec2 v_blurTexCoords[14];
  
 void main()
 {
+    const mediump float M = 3.0;
     gl_FragColor = vec4(0.0);
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 0])*0.0044299121055113265;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 1])*0.00895781211794;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 2])*0.0215963866053;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 3])*0.0443683338718;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 4])*0.0776744219933;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 5])*0.115876621105;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 6])*0.147308056121;
-    gl_FragColor += texture2D(s_texture, v_texCoord         )*0.159576912161;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 7])*0.147308056121;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 8])*0.115876621105;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 9])*0.0776744219933;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[10])*0.0443683338718;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[11])*0.0215963866053;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[12])*0.00895781211794;
-    gl_FragColor += texture2D(s_texture, v_blurTexCoords[13])*0.0044299121055113265;
-    gl_FragColor = vec4(1,1,1,1) * gl_FragColor.a;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 0])*0.0044299121055113265 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 1])*0.00895781211794 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 2])*0.0215963866053 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 3])*0.0443683338718 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 4])*0.0776744219933 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 5])*0.115876621105 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 6])*0.147308056121 * M;
+    gl_FragColor += texture2D(s_texture, v_texCoord         )*0.159576912161 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 7])*0.147308056121 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 8])*0.115876621105 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[ 9])*0.0776744219933 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[10])*0.0443683338718 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[11])*0.0215963866053 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[12])*0.00895781211794 * M;
+    gl_FragColor += texture2D(s_texture, v_blurTexCoords[13])*0.0044299121055113265 * M;
+    gl_FragColor = vec4(1.0,1.0,1.0,1.0) * gl_FragColor.a;
 }

+ 19 - 19
examples/Demo/data/pp_vblur_vs.glsl

@@ -1,31 +1,31 @@
 /* VBlurVertexShader.glsl */
-attribute vec3 position;
-attribute vec4 color;
-attribute vec2 uv;
+attribute  vec3 position;
+attribute  vec4 color;
+attribute  vec2 uv;
  
 uniform mediump float step;
 
-varying vec2 v_texCoord;
-varying vec2 v_blurTexCoords[14];
+varying mediump vec2 v_texCoord;
+varying mediump vec2 v_blurTexCoords[14];
  
 void main()
 {
     gl_Position = vec4(position.xy, 0, 1.0);
-    float z = step;
+    mediump float z = step;
 
     v_texCoord = uv;
-    v_blurTexCoords[ 0] = v_texCoord + vec2(0.0, -z * 7);
-    v_blurTexCoords[ 1] = v_texCoord + vec2(0.0, -z * 6);
-    v_blurTexCoords[ 2] = v_texCoord + vec2(0.0, -z * 5);
-    v_blurTexCoords[ 3] = v_texCoord + vec2(0.0, -z * 4);
-    v_blurTexCoords[ 4] = v_texCoord + vec2(0.0, -z * 3);
-    v_blurTexCoords[ 5] = v_texCoord + vec2(0.0, -z * 2);
+    v_blurTexCoords[ 0] = v_texCoord + vec2(0.0, -z * 7.0);
+    v_blurTexCoords[ 1] = v_texCoord + vec2(0.0, -z * 6.0);
+    v_blurTexCoords[ 2] = v_texCoord + vec2(0.0, -z * 5.0);
+    v_blurTexCoords[ 3] = v_texCoord + vec2(0.0, -z * 4.0);
+    v_blurTexCoords[ 4] = v_texCoord + vec2(0.0, -z * 3.0);
+    v_blurTexCoords[ 5] = v_texCoord + vec2(0.0, -z * 2.0);
     v_blurTexCoords[ 6] = v_texCoord + vec2(0.0, -z);
-    v_blurTexCoords[ 7] = v_texCoord + vec2(0.0,  z    );
-    v_blurTexCoords[ 8] = v_texCoord + vec2(0.0,  z * 2);
-    v_blurTexCoords[ 9] = v_texCoord + vec2(0.0,  z * 3);
-    v_blurTexCoords[10] = v_texCoord + vec2(0.0,  z * 4);
-    v_blurTexCoords[11] = v_texCoord + vec2(0.0,  z * 5);
-    v_blurTexCoords[12] = v_texCoord + vec2(0.0,  z * 6);
-    v_blurTexCoords[13] = v_texCoord + vec2(0.0,  z * 7);
+    v_blurTexCoords[ 7] = v_texCoord + vec2(0.0,  z);
+    v_blurTexCoords[ 8] = v_texCoord + vec2(0.0,  z * 2.0);
+    v_blurTexCoords[ 9] = v_texCoord + vec2(0.0,  z * 3.0);
+    v_blurTexCoords[10] = v_texCoord + vec2(0.0,  z * 4.0);
+    v_blurTexCoords[11] = v_texCoord + vec2(0.0,  z * 5.0);
+    v_blurTexCoords[12] = v_texCoord + vec2(0.0,  z * 6.0);
+    v_blurTexCoords[13] = v_texCoord + vec2(0.0,  z * 7.0);
 }

+ 4 - 0
examples/Demo/src/TestDrag.h

@@ -1,6 +1,7 @@
 #pragma once
 #include "test.h"
 #include "Draggable.h"
+#include "TweenAlphaFade.h"
 class DraggableSprite: public Sprite
 {
 public:
@@ -52,6 +53,9 @@ public:
         contacts->attachTo(content);
         contacts->setPriority(10000);
         contacts->setTouchChildrenEnabled(false);
+        contacts->setVisible(false);
+
+        content->addTween(TweenGlow(), 100, -1);
     }
 
     void doUpdate(const UpdateState& us)

+ 1 - 1
examples/Demo/src/TestTweenAlphaFade.h

@@ -34,7 +34,7 @@ public:
 
     void onClick(Event*)
     {
-        _test->addTween(TweenAlphaFade(false), 5500, 1, true);
+        _test->addTween(TweenAlphaFade(false, TweenAlphaFade::opt_singleR2T), 5500, 1, true);
     }
 
     void clicked(string id)

+ 12 - 10
oxygine/src/Actor.cpp

@@ -138,25 +138,27 @@ namespace oxygine
 
 
 
-    void calcBounds2(const Actor* actor, RectF& bounds, const Transform& transform)
+    void Actor::calcBounds2(RectF& bounds, const Transform& transform) const
     {
-        const Actor* c = actor->getFirstChild().get();
+        const Actor* c = getFirstChild().get();
         while (c)
         {
             if (c->getVisible())
             {
                 Transform tr = c->getTransform() * transform;
-                calcBounds2(c, bounds, tr);
+                c->calcBounds2(bounds, tr);
             }
             c = c->getNextSibling().get();
         }
 
-        const RectF& rect = actor->getDestRect();
-
-        bounds.unite(transform.transform(rect.getLeftTop()));
-        bounds.unite(transform.transform(rect.getRightTop()));
-        bounds.unite(transform.transform(rect.getRightBottom()));
-        bounds.unite(transform.transform(rect.getLeftBottom()));
+        RectF rect;
+        if (getBounds(rect))
+        {
+            bounds.unite(transform.transform(rect.getLeftTop()));
+            bounds.unite(transform.transform(rect.getRightTop()));
+            bounds.unite(transform.transform(rect.getRightBottom()));
+            bounds.unite(transform.transform(rect.getLeftBottom()));
+        }
     }
 
     RectF Actor::computeBounds(const Transform& transform) const
@@ -167,7 +169,7 @@ namespace oxygine
             -std::numeric_limits<float>::max(),
             -std::numeric_limits<float>::max());
 
-        calcBounds2(this, bounds, transform);
+        calcBounds2(bounds, transform);
 
         return bounds;
     }

+ 2 - 0
oxygine/src/Actor.h

@@ -324,6 +324,8 @@ namespace oxygine
         virtual void onAdded2Stage() {}
         virtual void onRemovedFromStage() {}
         virtual void transformUpdated() {}
+        virtual bool getBounds(RectF&) const { return false; }
+        void calcBounds2(RectF& bounds, const Transform& transform) const;
 
 
         typedef intrusive_list<spActor> children;

+ 184 - 2
oxygine/src/TweenAlphaFade.cpp

@@ -7,6 +7,186 @@
 
 namespace oxygine
 {
+
+    TweenPostProcess::TweenPostProcess(int opt) : _actor(0), _prev(0), _options(opt)
+    {
+    }
+
+    TweenPostProcess::~TweenPostProcess()
+    {
+        if (_actor)
+            _actor->setMaterial(0);
+        if (_rt)
+            _rt->release();
+        _rt = 0;
+    }
+
+
+    Rect TweenPostProcess::getScreenRect(const Actor& actor) const
+    {
+        Rect screen;
+
+        Rect display(Point(0, 0), core::getDisplaySize());
+
+        if (_options & opt_fullscreen)
+            return display;
+
+        screen = actor.computeBounds(actor.computeGlobalTransform()).cast<Rect>();
+        screen.size += Point(1, 1);
+        Point ext(25, 25);
+        screen.expand(ext, ext);
+        screen.clip(display);
+
+        return screen.cast<Rect>();
+    }
+
+    void TweenPostProcess::init(Actor& actor)
+    {
+        _actor = &actor;
+        _prev = _actor->getMaterial();
+        actor.setMaterial(this);
+
+        restore(0, 0);
+    }
+
+    void TweenPostProcess::restore(Restorable* r, void* userData)
+    {
+        render2texture();
+    }
+
+    void TweenPostProcess::done(Actor& actor)
+    {
+        actor.setMaterial(0);
+        if (_rt)
+            _rt->release();
+        _rt = 0;
+        _actor = 0;
+    }
+
+    bool TweenPostProcess::begin()
+    {
+        if (!STDRenderer::isReady())
+            return false;
+
+        Material::setCurrent(0);
+        IVideoDriver* driver = IVideoDriver::instance;
+
+
+        Rect display(Point(0, 0), core::getDisplaySize());
+
+        Actor& actor = *_actor;
+        _screen = getScreenRect(actor);
+
+        bool c = false;
+        if (!_rt)
+        {
+            _rt = IVideoDriver::instance->createTexture();
+            _rt->init(_screen.getWidth(), _screen.getHeight(), TF_R8G8B8A8, true);
+            c = true;
+        }
+
+        if (_rt->getWidth() < _screen.getWidth() || _rt->getHeight() < _screen.getHeight())
+        {
+            _rt->init(_screen.getWidth(), _screen.getHeight(), TF_R8G8B8A8, true);
+            c = true;
+        }
+
+        if (c)
+            rtCreated();
+
+        return true;
+    }
+
+    void TweenPostProcess::rtCreated()
+    {
+        _rt->reg(CLOSURE(this, &TweenPostProcess::restore), 0);
+    }
+
+    void TweenPostProcess::render2texture()
+    {
+        if (!begin())
+            return;
+
+        IVideoDriver* driver = IVideoDriver::instance;
+        driver->setRenderTarget(_rt);
+
+        Rect vp = _screen;
+        vp.pos = Point(0, 0);
+        driver->setViewport(vp);
+        driver->clear(0);
+
+
+        RenderState rs;
+        STDMaterial* mat = STDMaterial::instance;
+        STDRenderer* renderer = mat->getRenderer();
+        rs.material = mat;
+
+        RectF clip = vp.cast<RectF>();
+        rs.clip = &clip;
+
+        renderer->initCoordinateSystem(vp.getWidth(), vp.getHeight(), true);
+
+        rs.transform = _actor->getParent()->computeGlobalTransform();
+        _rtTransform = _actor->computeGlobalTransform().inverted();
+
+        if (!(_options & opt_fullscreen))
+        {
+            AffineTransform offset;
+            offset.identity();
+            offset.translate(-_screen.pos);
+            rs.transform = rs.transform * offset;
+        }
+
+        mat->Material::render(_actor, rs);
+
+        mat->finish();
+        driver->setRenderTarget(0);
+    }
+
+    void TweenPostProcess::update(Actor& actor, float p, const UpdateState& us)
+    {
+        if (!(_options & opt_singleR2T))
+            render2texture();
+    }
+
+    void TweenPostProcess::apply(Material* prev)
+    {
+
+    }
+
+
+    TweenAlphaFade::TweenAlphaFade(bool fadeIn, int opt) : TweenPostProcess(opt), _fadeIn(fadeIn), _a(0)
+    {
+    }
+
+    void TweenAlphaFade::update(Actor& actor, float p, const UpdateState& us)
+    {
+        TweenPostProcess::update(actor, p, us);
+        _a = lerp(_fadeIn ? 0 : 255, _fadeIn ? 255 : 0, p);
+    }
+
+    void TweenAlphaFade::render(Actor* actor, const RenderState& rs)
+    {
+        STDMaterial* mat = STDMaterial::instance;
+        STDRenderer* renderer = mat->getRenderer();
+
+        RectF src(0, 0,
+                  _screen.getWidth() / (float)_rt->getWidth(),
+                  _screen.getHeight() / (float)_rt->getHeight());
+        RectF dest = _screen.cast<RectF>();
+
+        renderer->setBlendMode(blend_premultiplied_alpha);
+        AffineTransform tr = _rtTransform * _actor->computeGlobalTransform();
+
+        renderer->setTransform(tr);
+        renderer->beginElementRendering(true);
+        Color color = Color(Color::White).withAlpha(_a).premultiplied();
+        renderer->drawElement(_rt, color.rgba(), src, dest);
+        renderer->drawBatch();
+    }
+
+
+
     ShaderProgram* TweenGlow::shaderBlurV = 0;
     ShaderProgram* TweenGlow::shaderBlurH = 0;
     ShaderProgram* TweenGlow::shaderBlit = 0;
@@ -73,6 +253,7 @@ namespace oxygine
         IVideoDriver* driver = IVideoDriver::instance;
 
         driver->setState(IVideoDriver::STATE_BLEND, 0);
+        /*
 
         oxglBindFramebuffer(GL_FRAMEBUFFER, safeCast<NativeTextureGLES*>(_rt2.get())->getFboID());
         driver->setViewport(Rect(0, 0, w / 2, h / 2));
@@ -111,7 +292,7 @@ namespace oxygine
         w /= 2;
         h /= 2;
 
-
+        */
 
 
         oxglBindFramebuffer(GL_FRAMEBUFFER, safeCast<NativeTextureGLES*>(_rt2.get())->getFboID());
@@ -166,6 +347,7 @@ namespace oxygine
     {
         TweenPostProcess::rtCreated();
         _rt2 = IVideoDriver::instance->createTexture();
-        _rt2->init(_rt->getWidth() / 2, _rt->getHeight() / 2, TF_R8G8B8A8, true);
+        //_rt2->init(_screen.getWidth() / 2, _screen.getHeight() / 2, TF_R8G8B8A8, true);
+        _rt2->init(_screen.getWidth(), _screen.getHeight(), TF_R8G8B8A8, true);
     }
 }

+ 22 - 174
oxygine/src/TweenAlphaFade.h

@@ -16,8 +16,9 @@ namespace oxygine
 
         Actor* _actor;
         Material* _prev;
-        spNativeTexture _rt;
 
+        spNativeTexture _rt;
+        Transform _rtTransform;
         Rect _screen;
         enum options
         {
@@ -27,147 +28,17 @@ namespace oxygine
 
         int _options;
 
-        TweenPostProcess(int opt) : _actor(0), _prev(0), _options(opt) {}
-
-        ~TweenPostProcess()
-        {
-            if (_actor)
-                _actor->setMaterial(0);
-            if (_rt)
-                _rt->release();
-            _rt = 0;
-        }
-
-
-        Rect getScreenRect(const Actor& actor) const
-        {
-            Rect screen;
-
-            Rect display(Point(0, 0), core::getDisplaySize());
-
-            if (_options & opt_fullscreen)
-                return display;
-
-            screen = actor.computeBounds(actor.computeGlobalTransform()).cast<Rect>();
-            screen.size += Point(1, 1);
-            screen.expand(Point(18, 18), Point(18, 18));
-            screen.clip(display);
-
-            return screen.cast<Rect>();
-        }
-
-        void init(Actor& actor)
-        {
-            _actor = &actor;
-            _prev = _actor->getMaterial();
-            actor.setMaterial(this);
-
-            restore(0, 0);
-
-        }
-
-        void restore(Restorable* r, void* userData)
-        {
-            render2texture();
-        }
-
-        void done(Actor& actor)
-        {
-            actor.setMaterial(0);
-            if (_rt)
-                _rt->release();
-            _rt = 0;
-            _actor = 0;
-        }
-
-        bool begin()
-        {
-            if (!STDRenderer::isReady())
-                return false;
-
-            Material::setCurrent(0);
-            IVideoDriver* driver = IVideoDriver::instance;
-
-
-            Rect display(Point(0, 0), core::getDisplaySize());
-
-            Actor& actor = *_actor;
-            _screen = getScreenRect(actor);
-
-            bool c = false;
-            if (!_rt)
-            {
-                _rt = IVideoDriver::instance->createTexture();
-                _rt->init(_screen.getWidth(), _screen.getHeight(), TF_R8G8B8A8, true);
-                c = true;
-            }
-
-            if (_rt->getWidth() < _screen.getWidth() || _rt->getHeight() < _screen.getHeight())
-            {
-                _rt->init(_screen.getWidth(), _screen.getHeight(), TF_R8G8B8A8, true);
-                c = true;
-            }
-
-            if (c)
-                rtCreated();
-
-            return true;
-        }
-
-        virtual void rtCreated()
-        {
-            _rt->reg(CLOSURE(this, &TweenPostProcess::restore), 0);
-        }
-
-        virtual void render2texture()
-        {
-            if (!begin())
-                return;
-
-            IVideoDriver* driver = IVideoDriver::instance;
-            driver->setRenderTarget(_rt);
-
-            Rect vp = _screen;
-            vp.pos = Point(0, 0);
-            driver->setViewport(vp);
-            driver->clear(0);
-
-
-            RenderState rs;
-            STDMaterial* mat = STDMaterial::instance;
-            STDRenderer* renderer = mat->getRenderer();
-            rs.material = mat;
-
-            RectF clip = vp.cast<RectF>();
-            rs.clip = &clip;
-
-            renderer->initCoordinateSystem(vp.getWidth(), vp.getHeight(), true);
-
-            rs.transform = _actor->getParent()->computeGlobalTransform();
-            if (!(_options & opt_fullscreen))
-            {
-                AffineTransform offset;
-                offset.identity();
-                offset.translate(-_screen.pos);
-                rs.transform = rs.transform * offset;
-            }
-
-            mat->Material::render(_actor, rs);
-
-            mat->finish();
-            driver->setRenderTarget(0);
-        }
-
-        void update(Actor& actor, float p, const UpdateState& us)
-        {
-            if (!(_options & opt_singleR2T))
-                render2texture();
-        }
-
-        void apply(Material* prev)
-        {
-
-        }
+        TweenPostProcess(int opt);
+        ~TweenPostProcess();
+        Rect getScreenRect(const Actor& actor) const;
+        void init(Actor& actor);
+        void restore(Restorable* r, void* userData);
+        void done(Actor& actor);
+        bool begin();
+        virtual void rtCreated();
+        virtual void render2texture();
+        void update(Actor& actor, float p, const UpdateState& us);
+        void apply(Material* prev);
     };
 
     class TweenAlphaFade : public TweenPostProcess
@@ -176,33 +47,10 @@ namespace oxygine
         unsigned char _a;
         bool _fadeIn;
 
-        TweenAlphaFade(bool fadeIn, int opt = 0) : TweenPostProcess(opt), _fadeIn(fadeIn), _a(0) {}
-
-        void update(Actor& actor, float p, const UpdateState& us)
-        {
-            TweenPostProcess::update(actor, p, us);
-            _a = lerp(_fadeIn ? 0 : 255, _fadeIn ? 255 : 0, p);
-        }
-
-        void render(Actor* actor, const RenderState& rs)
-        {
-            STDMaterial* mat = STDMaterial::instance;
-            STDRenderer* renderer = mat->getRenderer();
-
-            RectF src(0, 0,
-                      _screen.getWidth() / (float)_rt->getWidth(),
-                      _screen.getHeight() / (float)_rt->getHeight());
-            RectF dest = _screen.cast<RectF>();
+        TweenAlphaFade(bool fadeIn, int opt = 0);
 
-            renderer->setBlendMode(blend_premultiplied_alpha);
-            AffineTransform tr;
-            tr.identity();
-            renderer->setTransform(tr);
-            renderer->beginElementRendering(true);
-            Color color = Color(Color::White).withAlpha(_a).premultiplied();
-            renderer->drawElement(_rt, color.rgba(), src, dest);
-            renderer->drawBatch();
-        }
+        void update(Actor& actor, float p, const UpdateState& us);
+        void render(Actor* actor, const RenderState& rs);
     };
 
     class TweenGlow : public TweenPostProcess
@@ -212,9 +60,10 @@ namespace oxygine
         static ShaderProgram* shaderBlurH;
         static ShaderProgram* shaderBlit;
 
+        int _downsample;
         spNativeTexture _rt2;
 
-        TweenGlow(): TweenPostProcess(0) {}
+        TweenGlow(): TweenPostProcess(0), _downsample(1) {}
 
         void render2texture() OVERRIDE;
         void rtCreated() OVERRIDE;
@@ -226,17 +75,17 @@ namespace oxygine
             STDRenderer* renderer = mat->getRenderer();
 
             RectF src(0, 0,
-                      _screen.getWidth() / (float)_rt->getWidth() / 4,
-                      _screen.getHeight() / (float)_rt->getHeight() / 4);
+                      _screen.getWidth() / (float)_rt->getWidth() / _downsample,
+                      _screen.getHeight() / (float)_rt->getHeight() / _downsample);
             RectF dest = _screen.cast<RectF>();
 
             renderer->setBlendMode(blend_premultiplied_alpha);
+
             AffineTransform tr;
             tr.identity();
-            //tr.scale(Vector2(4, 4));
             renderer->setTransform(tr);
             renderer->beginElementRendering(true);
-            Color color = Color(Color::White).premultiplied();
+            Color color = Color(Color::White).withAlpha(255).premultiplied();
             renderer->drawElement(_rt, color.rgba(), src, dest);
             renderer->drawBatch();
 
@@ -246,7 +95,6 @@ namespace oxygine
             actor->setMaterial(_prev);
             actor->render(r);
             actor->setMaterial(this);
-
         }
     };
 }

+ 1 - 0
oxygine/src/VisualStyle.h

@@ -45,6 +45,7 @@ namespace oxygine
         typedef Property<Color, const Color&, VStyleActor, &VStyleActor::getColor, &VStyleActor::setColor> TweenColor;
 
     protected:
+        bool getBounds(RectF& b) const  OVERRIDE {b = getDestRect() ;  return true; }
         VisualStyle _vstyle;
     };
 

+ 1 - 2
oxygine/src/core/ZipFileSystem.cpp

@@ -62,8 +62,6 @@ namespace oxygine
                 entry.pos = pos;
                 entry.zp = zp;
 
-                //strcpy(entry.name, entry.name);
-
                 _files.push_back(entry);
 
             }
@@ -177,6 +175,7 @@ namespace oxygine
 
             zpitem item;
             item.handle = zp;
+            strcpy(item.name, name);
             _zps.push_back(item);
 
             read(zp);

+ 3 - 1
oxygine/src/core/ZipFileSystem.h

@@ -49,7 +49,9 @@ namespace oxygine
             {
                 unzFile handle;
                 std::vector<char> data;
-                zpitem(): handle(0) {}
+                char name[255];
+
+                zpitem() : handle(0) { name[0] = 0; }
             };
             typedef std::vector<zpitem> zips;
             zips _zps;

+ 1 - 6
oxygine/src/dev_tools/TreeInspector.cpp

@@ -28,16 +28,11 @@ namespace oxygine
     }
 
 
-    RectF getBounds(Actor* a)
-    {
-        return RectF(a->getPosition(), a->getSize());
-    }
-
     RectF TreeInspector::calcBounds(Actor* actor)
     {
         OX_ASSERT(actor);
 
-        RectF r = getBounds(actor);
+        RectF r(actor->getPosition(), actor->getSize());
 
         spActor c = actor->getFirstChild();
         while (c)