136 lines
4.1 KiB
Plaintext
136 lines
4.1 KiB
Plaintext
|
#include <metal_stdlib>
|
||
|
|
||
|
using namespace metal;
|
||
|
struct buf0 {
|
||
|
/* 0x0000 */ packed_float2 resolution;
|
||
|
};
|
||
|
struct main_out {
|
||
|
float4 x_GLF_color_1;
|
||
|
};
|
||
|
struct tint_symbol_2 {
|
||
|
float4 x_GLF_color_1 [[color(0)]];
|
||
|
};
|
||
|
|
||
|
float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) {
|
||
|
float const x_76 = (*(a)).x;
|
||
|
float const x_78 = (*(b)).y;
|
||
|
float const x_81 = (*(b)).x;
|
||
|
float const x_83 = (*(a)).y;
|
||
|
return ((x_76 * x_78) - (x_81 * x_83));
|
||
|
}
|
||
|
|
||
|
int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) {
|
||
|
float pab = 0.0f;
|
||
|
float2 param = 0.0f;
|
||
|
float2 param_1 = 0.0f;
|
||
|
float pbc = 0.0f;
|
||
|
float2 param_2 = 0.0f;
|
||
|
float2 param_3 = 0.0f;
|
||
|
float pca = 0.0f;
|
||
|
float2 param_4 = 0.0f;
|
||
|
float2 param_5 = 0.0f;
|
||
|
bool x_137 = false;
|
||
|
bool x_169 = false;
|
||
|
bool x_138_phi = false;
|
||
|
bool x_170_phi = false;
|
||
|
float const x_88 = (*(p)).x;
|
||
|
float const x_90 = (*(a_1)).x;
|
||
|
float const x_93 = (*(p)).y;
|
||
|
float const x_95 = (*(a_1)).y;
|
||
|
float const x_99 = (*(b_1)).x;
|
||
|
float const x_100 = (*(a_1)).x;
|
||
|
float const x_103 = (*(b_1)).y;
|
||
|
float const x_104 = (*(a_1)).y;
|
||
|
param = float2((x_88 - x_90), (x_93 - x_95));
|
||
|
param_1 = float2((x_99 - x_100), (x_103 - x_104));
|
||
|
float const x_107 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||
|
pab = x_107;
|
||
|
float const x_108 = (*(p)).x;
|
||
|
float const x_109 = (*(b_1)).x;
|
||
|
float const x_111 = (*(p)).y;
|
||
|
float const x_112 = (*(b_1)).y;
|
||
|
float const x_116 = (*(c)).x;
|
||
|
float const x_117 = (*(b_1)).x;
|
||
|
float const x_120 = (*(c)).y;
|
||
|
float const x_121 = (*(b_1)).y;
|
||
|
param_2 = float2((x_108 - x_109), (x_111 - x_112));
|
||
|
param_3 = float2((x_116 - x_117), (x_120 - x_121));
|
||
|
float const x_124 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||
|
pbc = x_124;
|
||
|
float const x_125 = pab;
|
||
|
float const x_127 = pbc;
|
||
|
bool const x_129 = ((x_125 < 0.0f) && (x_127 < 0.0f));
|
||
|
x_138_phi = x_129;
|
||
|
if (!(x_129)) {
|
||
|
float const x_133 = pab;
|
||
|
float const x_135 = pbc;
|
||
|
x_137 = ((x_133 >= 0.0f) && (x_135 >= 0.0f));
|
||
|
x_138_phi = x_137;
|
||
|
}
|
||
|
bool const x_138 = x_138_phi;
|
||
|
if (!(x_138)) {
|
||
|
return 0;
|
||
|
}
|
||
|
float const x_142 = (*(p)).x;
|
||
|
float const x_143 = (*(c)).x;
|
||
|
float const x_145 = (*(p)).y;
|
||
|
float const x_146 = (*(c)).y;
|
||
|
float const x_149 = (*(a_1)).x;
|
||
|
float const x_150 = (*(c)).x;
|
||
|
float const x_152 = (*(a_1)).y;
|
||
|
float const x_153 = (*(c)).y;
|
||
|
param_4 = float2((x_142 - x_143), (x_145 - x_146));
|
||
|
param_5 = float2((x_149 - x_150), (x_152 - x_153));
|
||
|
float const x_156 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||
|
pca = x_156;
|
||
|
float const x_157 = pab;
|
||
|
float const x_159 = pca;
|
||
|
bool const x_161 = ((x_157 < 0.0f) && (x_159 < 0.0f));
|
||
|
x_170_phi = x_161;
|
||
|
if (!(x_161)) {
|
||
|
float const x_165 = pab;
|
||
|
float const x_167 = pca;
|
||
|
x_169 = ((x_165 >= 0.0f) && (x_167 >= 0.0f));
|
||
|
x_170_phi = x_169;
|
||
|
}
|
||
|
bool const x_170 = x_170_phi;
|
||
|
if (!(x_170)) {
|
||
|
return 0;
|
||
|
}
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) {
|
||
|
float2 pos = 0.0f;
|
||
|
float2 param_6 = 0.0f;
|
||
|
float2 param_7 = 0.0f;
|
||
|
float2 param_8 = 0.0f;
|
||
|
float2 param_9 = 0.0f;
|
||
|
float4 const x_63 = *(tint_symbol_5);
|
||
|
float2 const x_66 = x_24.resolution;
|
||
|
pos = (float2(x_63.x, x_63.y) / x_66);
|
||
|
float2 const x_68 = pos;
|
||
|
param_6 = x_68;
|
||
|
param_7 = float2(0.699999988f, 0.300000012f);
|
||
|
param_8 = float2(0.5f, 0.899999976f);
|
||
|
param_9 = float2(0.100000001f, 0.400000006f);
|
||
|
int const x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||
|
if ((x_69 == 1)) {
|
||
|
*(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||
|
} else {
|
||
|
*(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) {
|
||
|
thread float4 tint_symbol_7 = 0.0f;
|
||
|
thread float4 tint_symbol_8 = 0.0f;
|
||
|
tint_symbol_7 = gl_FragCoord_param;
|
||
|
main_1(x_24, &(tint_symbol_7), &(tint_symbol_8));
|
||
|
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8};
|
||
|
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
|
||
|
return tint_symbol_4;
|
||
|
}
|
||
|
|