瀏覽代碼

minor uber shader additions

dm 7 年之前
父節點
當前提交
d41c34266a

+ 1 - 1
examples/Demo/src/example.cpp

@@ -169,7 +169,7 @@ void example_init()
 
     //Load resources in xml file
     resources.loadXML("xmls/res.xml");
-    
+
 
     Test::instance = new TestActor;
     Test::instance->attachTo(getStage());

文件差異過大導致無法顯示
+ 0 - 0
examples/Demo/src/test.cpp


+ 4 - 4
examples/Demo/src/test.h

@@ -36,8 +36,8 @@ public:
     void updateText(string id, string txt);
     virtual void clicked(string id) {}
     virtual void toggleClicked(string id, const toggle* data) {}
-    
-        
+
+
     void notify(string text, int time = 400);
 
 protected:
@@ -53,8 +53,8 @@ protected:
     spActor _ui;
 
     float _x;
-    float _y;    
-    
+    float _y;
+
     enum {MAX_NOTIFIES = 8};
     int _notifies[MAX_NOTIFIES];
 };

+ 20 - 0
oxygine/src/oxygine/AnimationFrame.cpp

@@ -64,6 +64,26 @@ namespace oxygine
         return f;
     }
 
+    spNativeTexture AnimationFrame::getBaseTexture() const
+    {
+        return _diffuse.base;
+    }
+
+    spNativeTexture AnimationFrame::getAlphaTexture() const
+    {
+        return _diffuse.alpha;
+    }
+
+    void AnimationFrame::setBaseTexture(spNativeTexture t)
+    {
+        _diffuse.base = t;
+    }
+
+    void AnimationFrame::setAlphaTexture(spNativeTexture t)
+    {
+        _diffuse.alpha = t;
+    }
+
     void AnimationFrame::flipX()
     {
         _srcRect.setX(_srcRect.getRight());

+ 5 - 0
oxygine/src/oxygine/AnimationFrame.h

@@ -53,10 +53,15 @@ namespace oxygine
         const Diffuse&  getDiffuse() const {return _diffuse;}
         const HitTestData& getHitTestData()const { return _hittest; }
 
+        spNativeTexture getBaseTexture() const;
+        spNativeTexture getAlphaTexture() const;
+
         void            setSrcRect(const RectF& r) {_srcRect = r;}
         void            setDestRect(const RectF& r) {_destRect = r;}
         void            setResAnim(ResAnim* rs) {_resAnim = rs;}
         void            setDiffuse(const Diffuse& d) { _diffuse = d; }
+        void            setBaseTexture(spNativeTexture t);
+        void            setAlphaTexture(spNativeTexture t);
         void            setSize(const Vector2& size) {_frameSize = size;}
         void            setSize(float w, float h) { setSize(Vector2(w, h)); }
         void            setHitTestData(const HitTestData& ad) { _hittest = ad; }

文件差異過大導致無法顯示
+ 0 - 1
oxygine/src/oxygine/core/system_data.cpp


+ 13 - 0
oxygine/system_data/original/system/shader.glsl

@@ -3,13 +3,17 @@ varying lowp vec4 result_color;
 varying mediump vec2 result_uv;
 varying mediump vec2 result_uv2;
 
+
 #ifdef VS
 uniform highp mat4 mat;
 uniform mediump vec3 msk[4];
 attribute vec3 position;
 attribute vec4 color;
 attribute vec2 uv;
+
+#ifdef SAMPLER_UV2
 attribute vec2 uv2;
+#endif
 
 void program_main_vs()
 {
@@ -17,6 +21,7 @@ void program_main_vs()
 
 	result_color = color;
 	result_uv = uv;
+
 #ifdef MASK
 	mediump float a = dot(msk[0], vec3(1.0, position.x, position.y));
 	mediump float b = dot(msk[1], vec3(1.0, position.x, position.y));
@@ -24,6 +29,10 @@ void program_main_vs()
 	result_uv2.x = dot(msk[2], vec3(1.0, a, b));
 	result_uv2.y = dot(msk[3], vec3(1.0, a, b));
 #endif
+
+#ifdef SAMPLER_UV2
+	 result_uv2 = uv2;
+#endif
 }
 
 #endif
@@ -50,6 +59,10 @@ lowp vec4 get_base()
 	base.a = texture2D(alpha_texture, result_uv).r;	
 #endif
 
+#ifdef SEPARATE_ALPHA_UV2
+	base.a = texture2D(alpha_texture, result_uv2).a;	
+#endif
+
 #ifdef MODIFY_BASE_PRE
 	//define MODIFY_BASE_PRE and declare your own function modify_base_pre	
 	base = modify_base_pre(base);

部分文件因文件數量過多而無法顯示