dmuratshin 9 years ago
parent
commit
4695f02a34

+ 0 - 112
examples/Demo/later.patch

@@ -1,112 +0,0 @@
-diff -r c6ab5032adf6 examples/Demo/data/light_fs.glsl
---- a/examples/Demo/data/light_fs.glsl	Tue Nov 25 14:09:04 2014 +0500
-+++ b/examples/Demo/data/light_fs.glsl	Tue Nov 25 14:09:14 2014 +0500
-@@ -3,10 +3,11 @@
- varying lowp vec4 result_color;
- varying mediump vec2 result_uv;
- varying mediump vec2 result_uv2;
-+varying mediump vec2 result_light;
- 
- uniform lowp sampler2D base_texture;
- uniform lowp sampler2D normal_texture;
--uniform mediump vec2 light;
-+//uniform mediump vec2 light;
- 
- void main()
- {	
-@@ -14,7 +15,7 @@
- 	lowp vec3 normal = texture2D(normal_texture, result_uv2).xyz * 2.0 - 1.0;
- 
- 
--	mediump vec3 dir = normalize(vec3(result_pos.xy, 0.0) - vec3(light, 40.0));
-+	mediump vec3 dir = normalize(vec3(result_pos.xy, 0.0) - vec3(result_light, 40.0));
- 
- 
- 	dir = vec3(-dir.x, dir.y, -dir.z);
-diff -r c6ab5032adf6 examples/Demo/data/light_vs.glsl
---- a/examples/Demo/data/light_vs.glsl	Tue Nov 25 14:09:04 2014 +0500
-+++ b/examples/Demo/data/light_vs.glsl	Tue Nov 25 14:09:14 2014 +0500
-@@ -3,6 +3,7 @@
- varying mediump vec2 result_uv;
- varying mediump vec2 result_uv2;
- varying mediump vec2 result_pos;
-+varying mediump vec2 result_light;
- 
- uniform mediump mat4 mat;
- 
-@@ -10,6 +11,7 @@
- attribute vec4 color;
- attribute vec2 uv;
- attribute vec2 uv2;
-+attribute vec2 light;
- 
- void main()
- {
-@@ -19,4 +21,5 @@
- 	result_uv2 = uv2;
- 
- 	result_pos = position.xy;
-+	result_light = light;
- }
-\ No newline at end of file
-diff -r c6ab5032adf6 examples/Demo/src/TestUserShader2.h
---- a/examples/Demo/src/TestUserShader2.h	Tue Nov 25 14:09:04 2014 +0500
-+++ b/examples/Demo/src/TestUserShader2.h	Tue Nov 25 14:09:14 2014 +0500
-@@ -23,7 +23,7 @@
- 	LightningRenderer() :_light(0, 0)
- 	{
- 		//vertex declaration with 2 pairs of UV
--		_vdecl = getDriver()->getVertexDeclaration(vertexPCT2T2::FORMAT);
-+		_vdecl = getDriver()->getVertexDeclaration(vertexPCT2T2T2::FORMAT);
- 
- 		//load vertex shader
- 		file::buffer vsdata;
-@@ -106,8 +106,27 @@
- 			_driver->setTexture(1, _normal);
- 		}
- 
--		vertexPCT2T2 v[4];		
-+		vertexPCT2T2T2 v[4];		
- 		fillQuadT2(v, srcRect, normalSrc, destRect, rs->transform, color.rgba());
-+		Vector2 light = _light;
-+		AffineTransform t = rs->transform;
-+		t.invert();
-+		t.x = 0;
-+		t.y = 0;
-+		light = t.transform(_light);
-+		Vector2 d1 = light;
-+		Vector2 d2 = light;
-+		Vector2 d3 = light;
-+		Vector2 d4 = light;
-+		v[0].u3 = d1.x;
-+		v[0].v3 = d1.y;
-+		v[1].u3 = d1.x;
-+		v[1].v3 = d1.y;
-+		v[2].u3 = d1.x;
-+		v[2].v3 = d1.y;
-+		v[3].u3 = d1.x;
-+		v[3].v3 = d1.y;
-+
- 		_vertices.insert(_vertices.end(), (unsigned char*)v, (unsigned char*)v + sizeof(v));
- 		_checkDrawBatch();
- 	}
-@@ -160,7 +179,9 @@
- 		AnimationFrame frame = resources.getResAnim("normal")->getFrame(0);
- 		spSprite spr = new Sprite2(frame);
- 		spr->setResAnim(resources.getResAnim("tiled"));
--		spr->setPosition(content->getSize() / 2 - spr->getSize() / 2);
-+		spr->setAnchor(Vector2(0.5f, 0.5f));
-+		spr->setPosition(content->getSize() / 2);
-+		spr->addTween(Actor::TweenRotation(MATH_PI * 2), 25000, -1);
- 		spr->attachTo(lightning);
- 		
- 
-@@ -170,7 +191,7 @@
- 		light->setResAnim(resources.getResAnim("light"));
- 		light->setAnchor(0.5f, 0.5f);
- 		drag.init(light.get());
--		light->setPosition(getSize() / 2);
-+		light->setPosition(getSize() / 2 - Vector2(100, 0));
- 
- 		lightning->addChild(light);
- 	}

+ 4 - 2
examples/Demo/src/example.cpp

@@ -27,6 +27,7 @@
 #include "TestColorFont.h"
 #include "TestSignedDistanceFont.h"
 #include "TestTweenPostProcessing.h"
+#include "TestEdges.h"
 
 #ifdef __S3E__
 #include "s3eKeyboard.h"
@@ -73,8 +74,8 @@ public:
         addButton("sliding", "Sliding Actor");
         addButton("box9sprite", "Box9 Sprite");
         addButton("cliprect", "ClipRect Actor");
-        addButton("usershader", "User Shader");
-        addButton("usershader2", "User Shader2");
+        addButton("usershader", "Extended UberShader");
+        addButton("usershader2", "Custom shaders and render");
         addButton("multicolorfont", "Outer Font Color");
         addButton("sdf", "Signed Distance Font");
         addButton("mask", "Mask");
@@ -134,6 +135,7 @@ public:
         if (id == "multicolorfont") showTest(new TestColorFont);
         if (id == "sdf") showTest(new TestSignedDistanceFont);
         if (id == "tweenpp") showTest(new TestTweenPostProcessing);
+        if (id == "edges") showTest(new TestEdges);
         if (id == "openbrowser")
         {
             core::execute("http://oxygine.org/");

+ 4 - 2
oxygine/src/res/ResAtlasGeneric.cpp

@@ -160,8 +160,10 @@ namespace oxygine
         spMemoryTexture mt = new MemoryTexture;
         Rect bounds = ad.atlas.getBounds();
 
-        int w = nextPOT(bounds.getRight());
-        int h = nextPOT(bounds.getBottom());
+        //int w = nextPOT(bounds.getRight());
+        //int h = nextPOT(bounds.getBottom());
+        int w = bounds.getRight();
+        int h = bounds.getBottom();
 
         mt->init(ad.mt.lock().getRect(Rect(0, 0, w, h)));
 #if 0

+ 1 - 1
oxygine/src/res/Resources.cpp

@@ -224,7 +224,7 @@ namespace oxygine
         if (!resources_meta.empty())
         {
             int metaVersion = resources_meta.attribute("version").as_int(0);
-            OX_ASSERT(metaVersion <= 2 && "Please rebuild xmls with latest 'oxyresbuild' tool");
+            OX_ASSERT(metaVersion <= 2 && "Incompatible atlas format. Please rebuild xmls with latest 'oxyresbuild' tool or delete .ox folder from data.");
         }