Fixes for android
This commit is contained in:
parent
9985871748
commit
e106741bd5
@ -1,67 +1,32 @@
|
|||||||
unsigned char shaders_sun_100_fs[] = {
|
const char *sun_shader_100 = "#version 100\n\
|
||||||
0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x30, 0x30,
|
precision mediump float;\
|
||||||
0x0a, 0x0a, 0x70, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20,
|
varying vec2 fragTexCoord;\
|
||||||
0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61,
|
varying vec4 fragColor;\
|
||||||
0x74, 0x3b, 0x0a, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20,
|
uniform vec3 color;\
|
||||||
0x76, 0x65, 0x63, 0x32, 0x20, 0x66, 0x72, 0x61, 0x67, 0x54, 0x65, 0x78,
|
uniform float sun_radius;\
|
||||||
0x43, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69,
|
uniform float start_transperency;\
|
||||||
0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x66, 0x72, 0x61, 0x67,
|
vec2 offset = vec2(1.0, 1.0);\
|
||||||
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x0a, 0x0a, 0x75, 0x6e, 0x69,
|
float sun_end = 1.0;\
|
||||||
0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x63, 0x6f,
|
void main()\
|
||||||
0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d,
|
{\
|
||||||
0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x73, 0x75, 0x6e, 0x5f, 0x72,
|
offset.x -= fragTexCoord.x * 2.0;\
|
||||||
0x61, 0x64, 0x69, 0x75, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f,
|
offset.y -= fragTexCoord.y * 2.0;\
|
||||||
0x72, 0x6d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x73, 0x74, 0x61,
|
float radius = length(offset);\
|
||||||
0x72, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x65, 0x72, 0x65,
|
if (radius < sun_radius) {\
|
||||||
0x6e, 0x63, 0x79, 0x3b, 0x0a, 0x0a, 0x76, 0x65, 0x63, 0x32, 0x20, 0x6f,
|
gl_FragColor = vec4(color, 1.0);\
|
||||||
0x66, 0x66, 0x73, 0x65, 0x74, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32,
|
}\
|
||||||
0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a,
|
else if (radius < sun_end) {\
|
||||||
0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x73, 0x75, 0x6e, 0x5f, 0x65, 0x6e,
|
float gradient = radius;\
|
||||||
0x64, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x0a, 0x76, 0x6f,
|
gradient -= sun_radius;\
|
||||||
0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x29, 0x0a, 0x7b, 0x0a,
|
gradient = gradient / (sun_end - sun_radius) * start_transperency;\
|
||||||
0x20, 0x20, 0x20, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x78,
|
gl_FragColor = vec4(color, start_transperency - gradient);\
|
||||||
0x20, 0x2d, 0x3d, 0x20, 0x66, 0x72, 0x61, 0x67, 0x54, 0x65, 0x78, 0x43,
|
}\
|
||||||
0x6f, 0x6f, 0x72, 0x64, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30,
|
else {\
|
||||||
0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
|
gl_FragColor = vec4(color, 0.0);\
|
||||||
0x2e, 0x79, 0x20, 0x2d, 0x3d, 0x20, 0x66, 0x72, 0x61, 0x67, 0x54, 0x65,
|
}\
|
||||||
0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x32,
|
}";
|
||||||
0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61,
|
|
||||||
0x74, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20, 0x3d, 0x20, 0x6c,
|
const char shaders_sun_330_fs[] = {
|
||||||
0x65, 0x6e, 0x67, 0x74, 0x68, 0x28, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
|
|
||||||
0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x72,
|
|
||||||
0x61, 0x64, 0x69, 0x75, 0x73, 0x20, 0x3c, 0x20, 0x73, 0x75, 0x6e, 0x5f,
|
|
||||||
0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x29, 0x7b, 0x0a, 0x0a, 0x20, 0x20,
|
|
||||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61,
|
|
||||||
0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63,
|
|
||||||
0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x31, 0x2e, 0x30,
|
|
||||||
0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x65, 0x6c, 0x73,
|
|
||||||
0x65, 0x20, 0x69, 0x66, 0x28, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20,
|
|
||||||
0x3c, 0x20, 0x73, 0x75, 0x6e, 0x5f, 0x65, 0x6e, 0x64, 0x29, 0x7b, 0x0a,
|
|
||||||
0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f,
|
|
||||||
0x61, 0x74, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20,
|
|
||||||
0x3d, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x3b, 0x0a, 0x20, 0x20,
|
|
||||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65,
|
|
||||||
0x6e, 0x74, 0x20, 0x2d, 0x3d, 0x20, 0x73, 0x75, 0x6e, 0x5f, 0x72, 0x61,
|
|
||||||
0x64, 0x69, 0x75, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
|
||||||
0x20, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x3d,
|
|
||||||
0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x2f, 0x20,
|
|
||||||
0x28, 0x73, 0x75, 0x6e, 0x5f, 0x65, 0x6e, 0x64, 0x20, 0x2d, 0x20, 0x73,
|
|
||||||
0x75, 0x6e, 0x5f, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x29, 0x20, 0x2a,
|
|
||||||
0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73,
|
|
||||||
0x70, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x20,
|
|
||||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67,
|
|
||||||
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34,
|
|
||||||
0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x73, 0x74, 0x61, 0x72,
|
|
||||||
0x74, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x65, 0x72, 0x65, 0x6e,
|
|
||||||
0x63, 0x79, 0x20, 0x2d, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e,
|
|
||||||
0x74, 0x29, 0x3b, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x65, 0x6c,
|
|
||||||
0x73, 0x65, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
|
||||||
0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
|
|
||||||
0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f,
|
|
||||||
0x72, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20,
|
|
||||||
0x20, 0x7d, 0x0a, 0x7d};
|
|
||||||
unsigned int shaders_sun_100_fs_len = 724;
|
|
||||||
unsigned char shaders_sun_330_fs[] = {
|
|
||||||
0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x33, 0x33, 0x30,
|
0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x33, 0x33, 0x30,
|
||||||
0x0a, 0x0a, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x66, 0x72,
|
0x0a, 0x0a, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x66, 0x72,
|
||||||
0x61, 0x67, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a,
|
0x61, 0x67, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a,
|
||||||
@ -121,4 +86,3 @@ unsigned char shaders_sun_330_fs[] = {
|
|||||||
0x65, 0x63, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x30,
|
0x65, 0x63, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x30,
|
||||||
0x2e, 0x30, 0x66, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a,
|
0x2e, 0x30, 0x66, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a,
|
||||||
0x7d, 0x0a};
|
0x7d, 0x0a};
|
||||||
unsigned int shaders_sun_330_fs_len = 698;
|
|
||||||
|
@ -113,8 +113,8 @@ void BackGround::drawSun()
|
|||||||
|
|
||||||
void BackGround::drawMounten(size_t mountenSegments, int min, int max, Color color, float scale)
|
void BackGround::drawMounten(size_t mountenSegments, int min, int max, Color color, float scale)
|
||||||
{
|
{
|
||||||
int x = 0;
|
float x = 0;
|
||||||
int diff = canvasSize / (mountenSegments - 1);
|
float diff = (float)canvasSize / (mountenSegments - 1);
|
||||||
|
|
||||||
float ny = mrand::getFloat(&mountenSeed);
|
float ny = mrand::getFloat(&mountenSeed);
|
||||||
float nz = mrand::getFloat(&mountenSeed);
|
float nz = mrand::getFloat(&mountenSeed);
|
||||||
|
@ -18,7 +18,7 @@ int Circle::colorLoc;
|
|||||||
void Circle::init()
|
void Circle::init()
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
|
||||||
shader = LoadShaderFromMemory(0, (const char *)shaders_sun_100_fs);
|
shader = LoadShaderFromMemory(0, sun_shader_100);
|
||||||
#else
|
#else
|
||||||
shader = LoadShaderFromMemory(0, (const char *)shaders_sun_330_fs);
|
shader = LoadShaderFromMemory(0, (const char *)shaders_sun_330_fs);
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,8 +48,9 @@ Vector2 Tree::drawLine()
|
|||||||
{
|
{
|
||||||
Vector2 point = Vector2Lerp(arg.start, end, i);
|
Vector2 point = Vector2Lerp(arg.start, end, i);
|
||||||
Color color = ColorLerp(m_dna->branches[arg.dep - 1].color, m_dna->branches[arg.dep].color, i);
|
Color color = ColorLerp(m_dna->branches[arg.dep - 1].color, m_dna->branches[arg.dep].color, i);
|
||||||
Circle::setColor(color);
|
DrawCircleV(point, thick, color); // Fester on the phone to call DrawCircle insted of the Circle shader
|
||||||
Circle::draw(point.x, point.y, thick); // TODO Change to BeginShaderMode and EndShaderMode only onece
|
// Circle::setColor(color);
|
||||||
|
// Circle::draw(point.x, point.y, thick); // TODO Change to BeginShaderMode and EndShaderMode only onece
|
||||||
}
|
}
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user