opengl es - MCPE GLSL Conditionals -
i'm writing ios vertex shader "flattens" mc world in x direction if change in z direction detected, , vice versa (the xz plane perp height). have several shaders warp world fine, writing pseudo movement detection hasn't worked. know conditionals costly. comparing position number , worked:
if (worldpos.x != 4.) { worldpos.z = 0.; }
but comparing position static call of position doesn't. far i've tried assigning constant floats x , z components, uniform floats, , pos4 uniform, no success. have feeling conditionals fail because of data type problem? easier debug if pe version displayed coord pc. any/all help! current code:
uniform pos4 chunk_origin_and_scale; attribute pos4 position; void main() { pos4 worldpos; worldpos.xyz = (position.xyz * chunk_origin_and_scale.w) + chunk_origin_and_scale.xyz; worldpos.w = 1.; const float staticposx = worldpos.x; const float staticposz = worldpos.z; if (worldpos.x != staticposx) { worldpos.z = 0.; staticposx = worldpos.x; } if (worldpos.z != staticposz) { worldpos.x = 0.; staticposz = worldpos.z; } etc.
i didn't try in glsl in c can't
int a=5; const int b=a;
Comments
Post a Comment