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