فهرست منبع

- clamp2edge option added to xml
- new blend mode
- virtual Actor::transformUpdated
- minor

dmuratshin 10 سال پیش
والد
کامیت
a8acfc9ccf
6فایلهای تغییر یافته به همراه17 افزوده شده و 7 حذف شده
  1. 4 2
      oxygine/src/Actor.cpp
  2. 1 0
      oxygine/src/Actor.h
  3. 4 0
      oxygine/src/STDRenderer.cpp
  4. 2 1
      oxygine/src/core/Renderer.h
  5. 2 1
      oxygine/src/oxygine_include.h
  6. 4 3
      oxygine/src/res/ResAtlas.cpp

+ 4 - 2
oxygine/src/Actor.cpp

@@ -661,6 +661,8 @@ namespace oxygine
 
         _transform = tr;
         _flags &= ~flag_transformDirty;
+
+        const_cast<Actor*>(this)->transformUpdated();
     }
 
     bool Actor::isOn(const Vector2& localPosition)
@@ -1310,7 +1312,7 @@ namespace oxygine
     {
         Transform t;
         t.identity();
-        while (child != parent)
+        while (child && child != parent)
         {
             t = t * child->getTransform();
             child = child->getParent();
@@ -1323,7 +1325,7 @@ namespace oxygine
     {
         Transform t;
         t.identity();
-        while (child.get() != parent)
+        while (child && (child.get() != parent))
         {
             t = t * child->getTransform();
             child = child->getParent();

+ 1 - 0
oxygine/src/Actor.h

@@ -314,6 +314,7 @@ namespace oxygine
         void removedFromStage();
         virtual void onAdded2Stage() {}
         virtual void onRemovedFromStage() {}
+        virtual void transformUpdated() {}
 
 
         typedef intrusive_list<spActor> children;

+ 4 - 0
oxygine/src/STDRenderer.cpp

@@ -413,6 +413,10 @@ namespace oxygine
                 case blend_multiply:
                     _driver->setBlendFunc(IVideoDriver::BT_DST_COLOR, IVideoDriver::BT_ONE_MINUS_SRC_ALPHA);
                     break;
+                case blend_inverse:
+                    _driver->setBlendFunc(IVideoDriver::BT_ONE_MINUS_DST_COLOR, IVideoDriver::BT_ZERO);
+                    break;
+
                 //case blend_sub:
                 //_driver->setBlendFunc(IVideoDriver::BT_ONE, IVideoDriver::BT_ONE);
                 //glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);

+ 2 - 1
oxygine/src/core/Renderer.h

@@ -25,6 +25,7 @@ namespace oxygine
         blend_alpha,
         blend_add,
         blend_multiply,
+        blend_inverse,
     };
 
 
@@ -228,4 +229,4 @@ namespace oxygine
 
     /**Returns View matrix where Left Top corner is (0,0), and right bottom is (w,h)*/
     Matrix makeViewMatrix(int w, int h, bool flipU = false);
-}
+}

+ 2 - 1
oxygine/src/oxygine_include.h

@@ -30,6 +30,7 @@
 #   endif // DEBUG  
 #elif OXYGINE_EDITOR
 #   define OXYGINE_FILESYSTEM_USE_STDIO 1
+#   include <qglobal.h>
 #else
 #   define OXYGINE_SDL 1
 #   ifdef _WIN32
@@ -73,7 +74,7 @@ namespace oxygine { namespace log { void error(const char* format, ...); } }
 
 //assert without log::error
 #ifdef OXYGINE_QT
-#   define OX_ASSERT_NL(x) {assert(x);}
+#   define OX_ASSERT_NL(x) {Q_ASSERT(x);}
 #elif EMSCRIPTEN
 #   define OX_ASSERT_NL(x)
 #else

+ 4 - 3
oxygine/src/res/ResAtlas.cpp

@@ -37,7 +37,7 @@ namespace oxygine
     };
 
 
-    void apply_atlas(atlas_data& ad, bool linear)
+    void apply_atlas(atlas_data& ad, bool linear, bool clamp2edge)
     {
         if (!ad.texture)
             return;
@@ -56,6 +56,7 @@ namespace oxygine
 
         ad.texture->apply();
         ad.texture->setLinearFilter(linear);
+        ad.texture->setClamp2Edge(clamp2edge);
     }
 
     void next_atlas(int w, int h, TextureFormat tf, atlas_data& ad, const char* name)
@@ -515,7 +516,7 @@ namespace oxygine
                         bool s = ad.atlas.add(&ad.mt, src, dest, offset);
                         if (s == false)
                         {
-                            apply_atlas(ad, _linearFilter);
+                            apply_atlas(ad, _linearFilter, _clamp2edge);
                             next_atlas(w, h, tf, ad, walker.getCurrentFolder().c_str());
                             s = ad.atlas.add(&ad.mt, src, dest, offset);
                             OX_ASSERT(s);
@@ -580,7 +581,7 @@ namespace oxygine
 
         }
 
-        apply_atlas(ad, _linearFilter);
+        apply_atlas(ad, _linearFilter, _clamp2edge);
 
         for (std::vector<ResAnim*>::iterator i = anims.begin(); i != anims.end(); ++i)
         {