Updated bgfx to latest (f7e2c6b291d)

master
Martin Felis 2016-11-10 21:53:08 +01:00
parent f01edbea34
commit d053912aee
247 changed files with 13441 additions and 5323 deletions

View File

@ -1,6 +1,23 @@
GLSL optimizer Change Log GLSL optimizer Change Log
========================= =========================
2016 10
-------
* Metal/GLES: Fixed bad optimization (all code removed) when framebuffer fetch extension is used, but
fragment shader does not actually read the incoming color value.
* Fixed translation of texelSize().
* Fixed translation of texelFetch().
2016 09
-------
* Metal: Fixed constant precision propagation in some cases.
* Metal: Fixed shadowmap sampling when reference Z value is outside of 0..1 range (now clamps to match GLES specs).
2016 06 2016 06
------- -------

View File

@ -76,6 +76,12 @@ Notes
1.20. Higher GLSL versions might work, but aren't tested now. 1.20. Higher GLSL versions might work, but aren't tested now.
* GLSL ES versions 1.00 and 3.00 are supported. * GLSL ES versions 1.00 and 3.00 are supported.
Status and Future
-----------------
**Note**: As of mid-2016, the project is unlikely to have any significant developments. At Unity we are largely moving to a different
shader compilation pipeline, with glsl-optimizer mostly not used. So from my side there won't be significant work done on it :(
Dev Notes Dev Notes
--------- ---------

View File

@ -3046,6 +3046,11 @@ process_initializer(ir_variable *var, ast_declaration *decl,
if (type->qualifier.flags.q.constant) { if (type->qualifier.flags.q.constant) {
ir_constant *constant_value = rhs->constant_expression_value(); ir_constant *constant_value = rhs->constant_expression_value();
constant_value->set_precision((glsl_precision)type->qualifier.precision); constant_value->set_precision((glsl_precision)type->qualifier.precision);
if (constant_value->type->is_array()) {
for (unsigned i = 0; i < constant_value->type->length; i++) {
constant_value->get_array_element(i)->set_precision((glsl_precision)type->qualifier.precision);
}
}
} }
/* Calculate the constant value if this is a const or uniform /* Calculate the constant value if this is a const or uniform

View File

@ -3830,21 +3830,6 @@ builtin_builder::_all(const glsl_type *type)
UNOP(not, ir_unop_logic_not, always_available) UNOP(not, ir_unop_logic_not, always_available)
static bool
has_lod(const glsl_type *sampler_type)
{
assert(sampler_type->is_sampler());
switch (sampler_type->sampler_dimensionality) {
case GLSL_SAMPLER_DIM_RECT:
case GLSL_SAMPLER_DIM_BUF:
case GLSL_SAMPLER_DIM_MS:
return false;
default:
return true;
}
}
ir_function_signature * ir_function_signature *
builtin_builder::_textureSize(builtin_available_predicate avail, builtin_builder::_textureSize(builtin_available_predicate avail,
const glsl_type *return_type, const glsl_type *return_type,
@ -3857,7 +3842,7 @@ builtin_builder::_textureSize(builtin_available_predicate avail,
ir_texture *tex = new(mem_ctx) ir_texture(ir_txs); ir_texture *tex = new(mem_ctx) ir_texture(ir_txs);
tex->set_sampler(new(mem_ctx) ir_dereference_variable(s), return_type); tex->set_sampler(new(mem_ctx) ir_dereference_variable(s), return_type);
if (has_lod(sampler_type)) { if (ir_texture::has_lod(sampler_type)) {
ir_variable *lod = in_var(glsl_type::int_type, "lod"); ir_variable *lod = in_var(glsl_type::int_type, "lod");
sig->parameters.push_tail(lod); sig->parameters.push_tail(lod);
tex->lod_info.lod = var_ref(lod); tex->lod_info.lod = var_ref(lod);
@ -4017,7 +4002,7 @@ builtin_builder::_texelFetch(builtin_available_predicate avail,
sig->parameters.push_tail(sample); sig->parameters.push_tail(sample);
tex->lod_info.sample_index = var_ref(sample); tex->lod_info.sample_index = var_ref(sample);
tex->op = ir_txf_ms; tex->op = ir_txf_ms;
} else if (has_lod(sampler_type)) { } else if (ir_texture::has_lod(sampler_type)) {
ir_variable *lod = in_var(glsl_type::int_type, "lod"); ir_variable *lod = in_var(glsl_type::int_type, "lod");
sig->parameters.push_tail(lod); sig->parameters.push_tail(lod);
tex->lod_info.lod = var_ref(lod); tex->lod_info.lod = var_ref(lod);

View File

@ -48,7 +48,7 @@ initialize_mesa_context(struct gl_context *ctx, glslopt_target api)
{ {
default: default:
case kGlslTargetOpenGL: case kGlslTargetOpenGL:
ctx->Const.GLSLVersion = 140; ctx->Const.GLSLVersion = 150;
break; break;
case kGlslTargetOpenGLES20: case kGlslTargetOpenGLES20:
ctx->Extensions.OES_standard_derivatives = true; ctx->Extensions.OES_standard_derivatives = true;

View File

@ -1410,6 +1410,22 @@ ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type)
} }
bool
ir_texture::has_lod(const glsl_type *sampler_type)
{
assert(sampler_type->is_sampler());
switch (sampler_type->sampler_dimensionality) {
case GLSL_SAMPLER_DIM_RECT:
case GLSL_SAMPLER_DIM_BUF:
case GLSL_SAMPLER_DIM_MS:
return false;
default:
return true;
}
}
void void
ir_swizzle::init_mask(const unsigned *comp, unsigned count) ir_swizzle::init_mask(const unsigned *comp, unsigned count)
{ {

View File

@ -1922,6 +1922,8 @@ public:
/** Set the sampler and type. */ /** Set the sampler and type. */
void set_sampler(ir_dereference *sampler, const glsl_type *type); void set_sampler(ir_dereference *sampler, const glsl_type *type);
static bool has_lod(const glsl_type *sampler_type);
/** /**
* Do a reverse-lookup to translate a string into an ir_texture_opcode. * Do a reverse-lookup to translate a string into an ir_texture_opcode.
*/ */

View File

@ -826,6 +826,20 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
const bool is_shadow = ir->sampler->type->sampler_shadow; const bool is_shadow = ir->sampler->type->sampler_shadow;
const bool is_array = ir->sampler->type->sampler_array; const bool is_array = ir->sampler->type->sampler_array;
const bool is_msaa = ir->op == ir_txf_ms; const bool is_msaa = ir->op == ir_txf_ms;
if (ir->op == ir_txs)
{
buffer.asprintf_append("textureSize (");
ir->sampler->accept(this);
if (ir_texture::has_lod(ir->sampler->type))
{
buffer.asprintf_append(", ");
ir->lod_info.lod->accept(this);
}
buffer.asprintf_append(")");
return;
}
const glsl_type* uv_type = ir->coordinate->type; const glsl_type* uv_type = ir->coordinate->type;
const int uv_dim = uv_type->vector_elements; const int uv_dim = uv_type->vector_elements;
int sampler_uv_dim = tex_sampler_dim_size[sampler_dim]; int sampler_uv_dim = tex_sampler_dim_size[sampler_dim];
@ -835,7 +849,7 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
sampler_uv_dim += 1; sampler_uv_dim += 1;
if (is_msaa) if (is_msaa)
sampler_uv_dim += 1; sampler_uv_dim += 1;
const bool is_proj = (uv_dim > sampler_uv_dim); const bool is_proj = ((ir->op == ir_tex || ir->op == ir_txb || ir->op == ir_txl || ir->op == ir_txd) && uv_dim > sampler_uv_dim);
const bool is_lod = (ir->op == ir_txl); const bool is_lod = (ir->op == ir_txl);
#if 0 // BK - disable LOD workarounds. #if 0 // BK - disable LOD workarounds.
@ -869,7 +883,6 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
} }
#endif // 0 #endif // 0
// texture function name // texture function name
//ACS: shadow lookups and lookups with dimensionality included in the name were deprecated in 130 //ACS: shadow lookups and lookups with dimensionality included in the name were deprecated in 130
if(state->language_version<130) if(state->language_version<130)
@ -879,17 +892,14 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
} }
else else
{ {
if (ir->op == ir_txf if (ir->op == ir_txf || ir->op == ir_txf_ms)
|| ir->op == ir_txf_ms) {
buffer.asprintf_append ("texelFetch"); buffer.asprintf_append ("texelFetch");
}
else else
buffer.asprintf_append ("texture"); buffer.asprintf_append ("texture");
} }
if (is_array && state->EXT_texture_array_enable) if (is_array && state->EXT_texture_array_enable)
buffer.asprintf_append ("Array"); buffer.asprintf_append ("Array");
if (ir->op == ir_tex && is_proj) if (ir->op == ir_tex && is_proj)
buffer.asprintf_append ("Proj"); buffer.asprintf_append ("Proj");
if (ir->op == ir_txl) if (ir->op == ir_txl)
@ -932,6 +942,13 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
ir->lod_info.lod->accept(this); ir->lod_info.lod->accept(this);
} }
// sample index
if (ir->op == ir_txf_ms)
{
buffer.asprintf_append (", ");
ir->lod_info.sample_index->accept(this);
}
// grad // grad
if (ir->op == ir_txd) if (ir->op == ir_txd)
{ {

View File

@ -677,6 +677,20 @@ void ir_print_metal_visitor::visit(ir_variable *ir)
buffer.asprintf_append (" = "); buffer.asprintf_append (" = ");
visit (ir->constant_value); visit (ir->constant_value);
} }
if ((ir->data.mode == ir_var_auto || ir->data.mode == ir_var_temporary) && (ir->type->matrix_columns == 1)) {
switch (ir->type->base_type) {
case GLSL_TYPE_INT:
case GLSL_TYPE_FLOAT:
buffer.asprintf_append (" = 0");
break;
case GLSL_TYPE_BOOL:
buffer.asprintf_append (" = false");
break;
default:
break;
}
}
} }
@ -1110,9 +1124,10 @@ void ir_print_metal_visitor::visit(ir_expression *ir)
else if (op0cast) else if (op0cast)
{ {
print_cast (buffer, arg_prec, ir->operands[0]); print_cast (buffer, arg_prec, ir->operands[0]);
buffer.asprintf_append ("(");
} }
ir->operands[0]->accept(this); ir->operands[0]->accept(this);
if (op0castTo1) if (op0castTo1 || op0cast)
{ {
buffer.asprintf_append (")"); buffer.asprintf_append (")");
} }
@ -1131,9 +1146,10 @@ void ir_print_metal_visitor::visit(ir_expression *ir)
else if (op1cast) else if (op1cast)
{ {
print_cast (buffer, arg_prec, ir->operands[1]); print_cast (buffer, arg_prec, ir->operands[1]);
buffer.asprintf_append ("(");
} }
ir->operands[1]->accept(this); ir->operands[1]->accept(this);
if (op1castTo0) if (op1castTo0 || op1cast)
{ {
buffer.asprintf_append (")"); buffer.asprintf_append (")");
} }
@ -1214,14 +1230,17 @@ static void print_texture_uv (ir_print_metal_visitor* vis, ir_texture* ir, bool
} }
else if (is_shadow) else if (is_shadow)
{ {
// Note that on metal sample_compare works differently than shadow2DEXT on GLES:
// it does not clamp neither the pixel value nor compare value to the [0.0, 1.0] range. To
// preserve same behavior we're clamping the argument explicitly.
if (!is_proj) if (!is_proj)
{ {
// regular shadow // regular shadow
vis->buffer.asprintf_append (uv_dim == 4 ? "(float3)(" : "(float2)("); vis->buffer.asprintf_append (uv_dim == 4 ? "(float3)(" : "(float2)(");
ir->coordinate->accept(vis); ir->coordinate->accept(vis);
vis->buffer.asprintf_append (uv_dim == 4 ? ").xyz, (" : ").xy, (float)("); vis->buffer.asprintf_append (uv_dim == 4 ? ").xyz, (" : ").xy, saturate((float)(");
ir->coordinate->accept(vis); ir->coordinate->accept(vis);
vis->buffer.asprintf_append (uv_dim == 4 ? ").w" : ").z"); vis->buffer.asprintf_append (uv_dim == 4 ? ").w" : ").z)");
} }
else else
{ {
@ -1230,17 +1249,29 @@ static void print_texture_uv (ir_print_metal_visitor* vis, ir_texture* ir, bool
ir->coordinate->accept(vis); ir->coordinate->accept(vis);
vis->buffer.asprintf_append (").xy / (float)("); vis->buffer.asprintf_append (").xy / (float)(");
ir->coordinate->accept(vis); ir->coordinate->accept(vis);
vis->buffer.asprintf_append (").w, (float)("); vis->buffer.asprintf_append (").w, saturate((float)(");
ir->coordinate->accept(vis); ir->coordinate->accept(vis);
vis->buffer.asprintf_append (").z / (float)("); vis->buffer.asprintf_append (").z / (float)(");
ir->coordinate->accept(vis); ir->coordinate->accept(vis);
vis->buffer.asprintf_append (").w"); vis->buffer.asprintf_append (").w)");
} }
} }
} }
void ir_print_metal_visitor::visit(ir_texture *ir) void ir_print_metal_visitor::visit(ir_texture *ir)
{ {
if (ir->op == ir_txs)
{
ir->sampler->accept(this);
buffer.asprintf_append (".get_width(");
ir->lod_info.lod->accept(this);
buffer.asprintf_append ("), ");
ir->sampler->accept(this);
buffer.asprintf_append (".get_height(");
ir->lod_info.lod->accept(this);
buffer.asprintf_append (")");
return;
}
glsl_sampler_dim sampler_dim = (glsl_sampler_dim)ir->sampler->type->sampler_dimensionality; glsl_sampler_dim sampler_dim = (glsl_sampler_dim)ir->sampler->type->sampler_dimensionality;
const bool is_shadow = ir->sampler->type->sampler_shadow; const bool is_shadow = ir->sampler->type->sampler_shadow;
const bool is_array = ir->sampler->type->sampler_array; const bool is_array = ir->sampler->type->sampler_array;
@ -1258,7 +1289,7 @@ void ir_print_metal_visitor::visit(ir_texture *ir)
// For shadow sampling, Metal right now needs a hardcoded sampler state :| // For shadow sampling, Metal right now needs a hardcoded sampler state :|
if (!ctx.shadowSamplerDone) if (!ctx.shadowSamplerDone)
{ {
ctx.prefixStr.asprintf_append("constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less);\n"); ctx.prefixStr.asprintf_append("constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal);\n");
ctx.shadowSamplerDone = true; ctx.shadowSamplerDone = true;
} }
buffer.asprintf_append (".sample_compare(_mtl_xl_shadow_sampler"); buffer.asprintf_append (".sample_compare(_mtl_xl_shadow_sampler");

View File

@ -40,12 +40,6 @@
static int glsl_version = 330; static int glsl_version = 330;
//extern "C" void
//_mesa_error_no_memory(const char *caller)
//{
// fprintf(stderr, "Mesa error: out of memory in %s", caller);
//}
static void static void
initialize_context(struct gl_context *ctx, gl_api api) initialize_context(struct gl_context *ctx, gl_api api)
{ {

View File

@ -81,7 +81,7 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned)
*/ */
if (entry->var->data.mode != ir_var_function_out && if (entry->var->data.mode != ir_var_function_out &&
entry->var->data.mode != ir_var_function_inout && entry->var->data.mode != ir_var_function_inout &&
entry->var->data.mode != ir_var_shader_out) { entry->var->data.mode != ir_var_shader_out && entry->var->data.mode != ir_var_shader_inout) {
entry->assign->remove(); entry->assign->remove();
progress = true; progress = true;

View File

@ -11,7 +11,7 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
c_1.zw = half2(float2(0.0, 0.0)); c_1.zw = half2(float2(0.0, 0.0));
c_1.xy = half2(float2(-0.3441301, 0.05004501)); c_1.xy = half2(float2(-0.3441301, 0.05004501));
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;

View File

@ -11,7 +11,7 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
c_1.zw = half2(float2(0.0, 0.0)); c_1.zw = half2(float2(0.0, 0.0));
c_1.xy = half2(float2(-0.3441301, 0.05004501)); c_1.xy = half2(float2(-0.3441301, 0.05004501));
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;

View File

@ -12,7 +12,7 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float a_2; float a_2 = 0;
if ((_mtl_i.gl_FragCoord.x == 1.0)) { if ((_mtl_i.gl_FragCoord.x == 1.0)) {
discard_fragment(); discard_fragment();
}; };

View File

@ -0,0 +1,14 @@
#version 300 es
#extension GL_EXT_shader_framebuffer_fetch : require
// had a bug where if shader framebuffer fetch extension is enabled,
// but not actually used, then translated shader would end up
// being empty, since all writes to gl_FragData were wrongly removed.
#define gl_FragData _glesFragData
layout(location = 0) inout mediump vec4 _glesFragData[4];
in highp vec2 inUV;
void main() {
gl_FragData[0] = vec4(inUV.x);
}

View File

@ -0,0 +1,15 @@
#version 300 es
#extension GL_EXT_shader_framebuffer_fetch : enable
layout(location=0) inout mediump vec4 _glesFragData[4];
in highp vec2 inUV;
void main ()
{
highp vec4 tmpvar_1;
tmpvar_1 = inUV.xxxx;
_glesFragData[0] = tmpvar_1;
}
// stats: 0 alu 0 tex 0 flow
// inputs: 1
// #0: inUV (high float) 2x1 [-1]

View File

@ -0,0 +1,25 @@
#include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal;
struct xlatMtlShaderInput {
float2 inUV;
half4 _glesFragData_0 [[color(0)]];
};
struct xlatMtlShaderOutput {
half4 _glesFragData_0 [[color(0)]];
};
struct xlatMtlShaderUniform {
};
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{
xlatMtlShaderOutput _mtl_o;
float4 tmpvar_1 = 0;
tmpvar_1 = _mtl_i.inUV.xxxx;
_mtl_o._glesFragData_0 = half4(tmpvar_1);
return _mtl_o;
}
// stats: 0 alu 0 tex 0 flow
// inputs: 1
// #0: inUV (high float) 2x1 [-1]

View File

@ -18,57 +18,57 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 t_1; half4 t_1 = 0;
half4 tmpvar_2; half4 tmpvar_2 = 0;
tmpvar_2 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_2 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0));
t_1 = tmpvar_2; t_1 = tmpvar_2;
if ((_mtl_u._NumPasses > (half)0.0)) { if ((_mtl_u._NumPasses > (half)(0.0))) {
half passes_3; half passes_3 = 0;
passes_3 = _mtl_u._NumPasses; passes_3 = _mtl_u._NumPasses;
float i_4; float i_4 = 0;
half3 res_5; half3 res_5 = 0;
res_5 = tmpvar_2.xyz; res_5 = tmpvar_2.xyz;
i_4 = 0.0; i_4 = 0.0;
while (true) { while (true) {
if ((i_4 >= 4.0)) { if ((i_4 >= 4.0)) {
break; break;
}; };
if ((i_4 == (float)passes_3)) { if ((i_4 == (float)(passes_3))) {
break; break;
}; };
if ((i_4 == 0.0)) { if ((i_4 == 0.0)) {
half3 tmpvar_6; half3 tmpvar_6 = 0;
half val_7; half val_7 = 0;
val_7 = ((_mtl_u._ContrastShift.x * (half)3.0) + (half)12.0); val_7 = ((_mtl_u._ContrastShift.x * (half)(3.0)) + (half)(12.0));
half tmpvar_8; half tmpvar_8 = 0;
tmpvar_8 = pow ((cos(val_7) + (half)1.0), val_7); tmpvar_8 = pow ((cos(val_7) + (half)(1.0)), val_7);
tmpvar_6 = ((res_5 - (half)0.5) * tmpvar_8); tmpvar_6 = ((res_5 - (half)(0.5)) * tmpvar_8);
res_5 = tmpvar_6; res_5 = tmpvar_6;
} else { } else {
if ((i_4 == 1.0)) { if ((i_4 == 1.0)) {
half3 tmpvar_9; half3 tmpvar_9 = 0;
half val_10; half val_10 = 0;
val_10 = ((_mtl_u._SaturationShift.y * (half)3.0) + (half)12.0); val_10 = ((_mtl_u._SaturationShift.y * (half)(3.0)) + (half)(12.0));
half tmpvar_11; half tmpvar_11 = 0;
tmpvar_11 = pow ((cos(val_10) + (half)1.0), val_10); tmpvar_11 = pow ((cos(val_10) + (half)(1.0)), val_10);
tmpvar_9 = ((res_5 - (half)0.5) * tmpvar_11); tmpvar_9 = ((res_5 - (half)(0.5)) * tmpvar_11);
res_5 = tmpvar_9; res_5 = tmpvar_9;
} else { } else {
if ((i_4 == 2.0)) { if ((i_4 == 2.0)) {
half3 tmpvar_12; half3 tmpvar_12 = 0;
half val_13; half val_13 = 0;
val_13 = ((_mtl_u._HueShift.z * (half)3.0) + (half)12.0); val_13 = ((_mtl_u._HueShift.z * (half)(3.0)) + (half)(12.0));
half tmpvar_14; half tmpvar_14 = 0;
tmpvar_14 = pow ((cos(val_13) + (half)1.0), val_13); tmpvar_14 = pow ((cos(val_13) + (half)(1.0)), val_13);
tmpvar_12 = ((res_5 - (half)0.5) * tmpvar_14); tmpvar_12 = ((res_5 - (half)(0.5)) * tmpvar_14);
res_5 = tmpvar_12; res_5 = tmpvar_12;
} else { } else {
half3 tmpvar_15; half3 tmpvar_15 = 0;
half val_16; half val_16 = 0;
val_16 = ((_mtl_u._LuminosityShift.x * (half)3.0) + (half)12.0); val_16 = ((_mtl_u._LuminosityShift.x * (half)(3.0)) + (half)(12.0));
half tmpvar_17; half tmpvar_17 = 0;
tmpvar_17 = pow ((cos(val_16) + (half)1.0), val_16); tmpvar_17 = pow ((cos(val_16) + (half)(1.0)), val_16);
tmpvar_15 = ((res_5 - (half)0.5) * tmpvar_17); tmpvar_15 = ((res_5 - (half)(0.5)) * tmpvar_17);
res_5 = tmpvar_15; res_5 = tmpvar_15;
}; };
}; };
@ -77,7 +77,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
}; };
t_1.xyz = res_5; t_1.xyz = res_5;
}; };
half4 tmpvar_18; half4 tmpvar_18 = 0;
tmpvar_18.w = half(1.0); tmpvar_18.w = half(1.0);
tmpvar_18.xyz = t_1.xyz; tmpvar_18.xyz = t_1.xyz;
_mtl_o._fragData = tmpvar_18; _mtl_o._fragData = tmpvar_18;

View File

@ -13,7 +13,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<float> _CameraDepthTexture [[texture(0)]], sampler _mtlsmp__CameraDepthTexture [[sampler(0)]]) , texture2d<float> _CameraDepthTexture [[texture(0)]], sampler _mtlsmp__CameraDepthTexture [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float4 tmpvar_1; float4 tmpvar_1 = 0;
tmpvar_1 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.varUV), level(0.0)).xxxx; tmpvar_1 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.varUV), level(0.0)).xxxx;
_mtl_o._fragData = half4(tmpvar_1); _mtl_o._fragData = half4(tmpvar_1);
return _mtl_o; return _mtl_o;

View File

@ -23,48 +23,48 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _NoiseTex [[texture(4)]], sampler _mtlsmp__NoiseTex [[sampler(4)]]) , texture2d<half> _NoiseTex [[texture(4)]], sampler _mtlsmp__NoiseTex [[sampler(4)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float2 tmpvar_1; float2 tmpvar_1 = 0;
tmpvar_1 = _mtl_i.xlv_TEXCOORD0; tmpvar_1 = _mtl_i.xlv_TEXCOORD0;
float4 jitteredDir_3; float4 jitteredDir_3 = 0;
float4 sum_4; float4 sum_4 = 0;
float weight_5; float weight_5 = 0;
float zx_6; float zx_6 = 0;
float2 vx_7; float2 vx_7 = 0;
float2 x_8; float2 x_8 = 0;
float2 xf_9; float2 xf_9 = 0;
xf_9 = _mtl_i.xlv_TEXCOORD0; xf_9 = _mtl_i.xlv_TEXCOORD0;
x_8 = _mtl_i.xlv_TEXCOORD0; x_8 = _mtl_i.xlv_TEXCOORD0;
if ((_mtl_u._MainTex_TexelSize.y < 0.0)) { if ((_mtl_u._MainTex_TexelSize.y < 0.0)) {
xf_9.y = (1.0 - _mtl_i.xlv_TEXCOORD0.y); xf_9.y = (1.0 - _mtl_i.xlv_TEXCOORD0.y);
}; };
half4 tmpvar_10; half4 tmpvar_10 = 0;
tmpvar_10 = _NeighbourMaxTex.sample(_mtlsmp__NeighbourMaxTex, (float2)(xf_9), level(0.0)); tmpvar_10 = _NeighbourMaxTex.sample(_mtlsmp__NeighbourMaxTex, (float2)(xf_9), level(0.0));
float2 tmpvar_11; float2 tmpvar_11 = 0;
tmpvar_11 = float2(tmpvar_10.xy); tmpvar_11 = float2(tmpvar_10.xy);
half4 tmpvar_12; half4 tmpvar_12 = 0;
tmpvar_12 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0)); tmpvar_12 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0));
float4 tmpvar_13; float4 tmpvar_13 = 0;
tmpvar_13 = float4(tmpvar_12); tmpvar_13 = float4(tmpvar_12);
half4 tmpvar_14; half4 tmpvar_14 = 0;
tmpvar_14 = _VelTex.sample(_mtlsmp__VelTex, (float2)(xf_9), level(0.0)); tmpvar_14 = _VelTex.sample(_mtlsmp__VelTex, (float2)(xf_9), level(0.0));
float2 tmpvar_15; float2 tmpvar_15 = 0;
tmpvar_15 = float2(tmpvar_14.xy); tmpvar_15 = float2(tmpvar_14.xy);
vx_7 = tmpvar_15; vx_7 = tmpvar_15;
float4 tmpvar_16; float4 tmpvar_16 = 0;
tmpvar_16.zw = float2(0.0, 0.0); tmpvar_16.zw = float2(0.0, 0.0);
tmpvar_16.xy = _mtl_i.xlv_TEXCOORD0; tmpvar_16.xy = _mtl_i.xlv_TEXCOORD0;
float4 coord_17; float4 coord_17 = 0;
coord_17 = (tmpvar_16 * 11.0); coord_17 = (tmpvar_16 * 11.0);
half4 tmpvar_18; half4 tmpvar_18 = 0;
tmpvar_18 = _NoiseTex.sample(_mtlsmp__NoiseTex, (float2)(coord_17.xy), level(coord_17.w)); tmpvar_18 = _NoiseTex.sample(_mtlsmp__NoiseTex, (float2)(coord_17.xy), level(coord_17.w));
float4 tmpvar_19; float4 tmpvar_19 = 0;
tmpvar_19 = float4(((tmpvar_18 * (half)2.0) - (half)1.0)); tmpvar_19 = float4(((tmpvar_18 * (half)(2.0)) - (half)(1.0)));
zx_6 = -((1.0/(( zx_6 = -((1.0/((
(_mtl_u._ZBufferParams.x * _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0)).x) (_mtl_u._ZBufferParams.x * _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0)).x)
+ _mtl_u._ZBufferParams.y)))); + _mtl_u._ZBufferParams.y))));
weight_5 = 1.0; weight_5 = 1.0;
sum_4 = tmpvar_13; sum_4 = tmpvar_13;
float4 tmpvar_20; float4 tmpvar_20 = 0;
tmpvar_20 = (tmpvar_11.xyxy + (tmpvar_19 * (_mtl_u._MainTex_TexelSize.xyxy * _mtl_u._Jitter)).xyyz); tmpvar_20 = (tmpvar_11.xyxy + (tmpvar_19 * (_mtl_u._MainTex_TexelSize.xyxy * _mtl_u._Jitter)).xyyz);
jitteredDir_3 = ((max ( jitteredDir_3 = ((max (
abs(tmpvar_20.xyxy) abs(tmpvar_20.xyxy)
@ -72,50 +72,50 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
((_mtl_u._MainTex_TexelSize.xyxy * _mtl_u._MaxVelocity) * 0.15) ((_mtl_u._MainTex_TexelSize.xyxy * _mtl_u._MaxVelocity) * 0.15)
) * sign(tmpvar_20.xyxy)) * float4(1.0, 1.0, -1.0, -1.0)); ) * sign(tmpvar_20.xyxy)) * float4(1.0, 1.0, -1.0, -1.0));
for (int l_2 = 0; l_2 < 12; l_2++) { for (int l_2 = 0; l_2 < 12; l_2++) {
float zy_21; float zy_21 = 0;
float4 yf_22; float4 yf_22 = 0;
float4 tmpvar_23; float4 tmpvar_23 = 0;
tmpvar_23 = (tmpvar_1.xyxy + ((jitteredDir_3.xyxy * _xlat_mtl_const1[l_2].xyxy) * float4(1.0, 1.0, -1.0, -1.0))); tmpvar_23 = (tmpvar_1.xyxy + ((jitteredDir_3.xyxy * _xlat_mtl_const1[l_2].xyxy) * float4(1.0, 1.0, -1.0, -1.0)));
yf_22 = tmpvar_23; yf_22 = tmpvar_23;
if ((_mtl_u._MainTex_TexelSize.y < 0.0)) { if ((_mtl_u._MainTex_TexelSize.y < 0.0)) {
yf_22.yw = (1.0 - tmpvar_23.yw); yf_22.yw = (1.0 - tmpvar_23.yw);
}; };
half4 tmpvar_24; half4 tmpvar_24 = 0;
tmpvar_24 = _VelTex.sample(_mtlsmp__VelTex, (float2)(yf_22.xy), level(0.0)); tmpvar_24 = _VelTex.sample(_mtlsmp__VelTex, (float2)(yf_22.xy), level(0.0));
float2 tmpvar_25; float2 tmpvar_25 = 0;
tmpvar_25 = float2(tmpvar_24.xy); tmpvar_25 = float2(tmpvar_24.xy);
zy_21 = -((1.0/(( zy_21 = -((1.0/((
(_mtl_u._ZBufferParams.x * _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(tmpvar_23.xy), level(0.0)).x) (_mtl_u._ZBufferParams.x * _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(tmpvar_23.xy), level(0.0)).x)
+ _mtl_u._ZBufferParams.y)))); + _mtl_u._ZBufferParams.y))));
float2 x_26; float2 x_26 = 0;
x_26 = (x_8 - tmpvar_23.xy); x_26 = (x_8 - tmpvar_23.xy);
float2 x_27; float2 x_27 = 0;
x_27 = (tmpvar_23.xy - x_8); x_27 = (tmpvar_23.xy - x_8);
float tmpvar_28; float tmpvar_28 = 0;
tmpvar_28 = sqrt(dot (tmpvar_25, tmpvar_25)); tmpvar_28 = sqrt(dot (tmpvar_25, tmpvar_25));
float2 x_29; float2 x_29 = 0;
x_29 = (tmpvar_23.xy - x_8); x_29 = (tmpvar_23.xy - x_8);
float edge0_30; float edge0_30 = 0;
edge0_30 = (0.95 * tmpvar_28); edge0_30 = (0.95 * tmpvar_28);
float tmpvar_31; float tmpvar_31 = 0;
tmpvar_31 = clamp ((( tmpvar_31 = clamp (((
sqrt(dot (x_29, x_29)) sqrt(dot (x_29, x_29))
- edge0_30) / ( - edge0_30) / (
(1.05 * tmpvar_28) (1.05 * tmpvar_28)
- edge0_30)), 0.0, 1.0); - edge0_30)), 0.0, 1.0);
float tmpvar_32; float tmpvar_32 = 0;
tmpvar_32 = sqrt(dot (vx_7, vx_7)); tmpvar_32 = sqrt(dot (vx_7, vx_7));
float2 x_33; float2 x_33 = 0;
x_33 = (x_8 - tmpvar_23.xy); x_33 = (x_8 - tmpvar_23.xy);
float edge0_34; float edge0_34 = 0;
edge0_34 = (0.95 * tmpvar_32); edge0_34 = (0.95 * tmpvar_32);
float tmpvar_35; float tmpvar_35 = 0;
tmpvar_35 = clamp ((( tmpvar_35 = clamp (((
sqrt(dot (x_33, x_33)) sqrt(dot (x_33, x_33))
- edge0_34) / ( - edge0_34) / (
(1.05 * tmpvar_32) (1.05 * tmpvar_32)
- edge0_34)), 0.0, 1.0); - edge0_34)), 0.0, 1.0);
float tmpvar_36; float tmpvar_36 = 0;
tmpvar_36 = ((( tmpvar_36 = (((
clamp ((1.0 - ((zy_21 - zx_6) / _mtl_u._SoftZDistance)), 0.0, 1.0) clamp ((1.0 - ((zy_21 - zx_6) / _mtl_u._SoftZDistance)), 0.0, 1.0)
* *
@ -141,14 +141,14 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
(2.0 * tmpvar_35) (2.0 * tmpvar_35)
)))) ))))
) * 2.0)); ) * 2.0));
half4 tmpvar_37; half4 tmpvar_37 = 0;
tmpvar_37 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_23.xy), level(0.0)); tmpvar_37 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_23.xy), level(0.0));
float4 tmpvar_38; float4 tmpvar_38 = 0;
tmpvar_38 = float4(tmpvar_37); tmpvar_38 = float4(tmpvar_37);
sum_4 = (sum_4 + (tmpvar_38 * tmpvar_36)); sum_4 = (sum_4 + (tmpvar_38 * tmpvar_36));
weight_5 = (weight_5 + tmpvar_36); weight_5 = (weight_5 + tmpvar_36);
}; };
float4 tmpvar_39; float4 tmpvar_39 = 0;
tmpvar_39 = (sum_4 / weight_5); tmpvar_39 = (sum_4 / weight_5);
_mtl_o._fragData = half4(tmpvar_39); _mtl_o._fragData = half4(tmpvar_39);
return _mtl_o; return _mtl_o;

View File

@ -15,16 +15,16 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
c_1 = half4(((float4)_mtl_i.uv + _mtl_i.gl_FragCoord)); c_1 = half4(((float4)(_mtl_i.uv) + _mtl_i.gl_FragCoord));
float tmpvar_2; float tmpvar_2 = 0;
if (_mtl_i.gl_FrontFacing) { if (_mtl_i.gl_FrontFacing) {
tmpvar_2 = 1.0; tmpvar_2 = 1.0;
} else { } else {
tmpvar_2 = 0.0; tmpvar_2 = 0.0;
}; };
c_1.x = (c_1.x + (half)tmpvar_2); c_1.x = (c_1.x + (half)(tmpvar_2));
c_1.xy = half2(((float2)c_1.xy + _mtl_i.gl_PointCoord)); c_1.xy = half2(((float2)(c_1.xy) + _mtl_i.gl_PointCoord));
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;
return _mtl_o; return _mtl_o;
} }

View File

@ -24,6 +24,7 @@ mediump vec4 frag( in v2f i ) {
h += ha[j]; h += ha[j];
f += fa[j]; f += fa[j];
f += (p * ha[0]); f += (p * ha[0]);
f += (ha[1] * p);
} }
return vec4( h.xy, f.xy); return vec4( h.xy, f.xy);
} }

View File

@ -19,6 +19,7 @@ void main ()
h_6 = (h_6 + vec3[3](vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0))[j_3]); h_6 = (h_6 + vec3[3](vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0))[j_3]);
f_5 = (f_5 + vec3[3](vec3(11.0, 12.0, 13.0), vec3(14.0, 15.0, 16.0), vec3(17.0, 18.0, 19.0))[j_3]); f_5 = (f_5 + vec3[3](vec3(11.0, 12.0, 13.0), vec3(14.0, 15.0, 16.0), vec3(17.0, 18.0, 19.0))[j_3]);
f_5 = (f_5 + (p_4 * vec3(1.0, 2.0, 3.0))); f_5 = (f_5 + (p_4 * vec3(1.0, 2.0, 3.0)));
f_5 = (f_5 + (vec3(4.0, 5.0, 6.0) * p_4));
}; };
highp vec4 tmpvar_8; highp vec4 tmpvar_8;
tmpvar_8.xy = h_6.xy; tmpvar_8.xy = h_6.xy;
@ -28,6 +29,6 @@ void main ()
} }
// stats: 12 alu 0 tex 2 flow // stats: 14 alu 0 tex 2 flow
// inputs: 1 // inputs: 1
// #0: xlv_TEXCOORD0 (medium float) 2x1 [-1] // #0: xlv_TEXCOORD0 (medium float) 2x1 [-1]

View File

@ -1,7 +1,7 @@
#include <metal_stdlib> #include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal; using namespace metal;
constant half3 _xlat_mtl_const1[3] = {float3(1.0, 2.0, 3.0), float3(4.0, 5.0, 6.0), float3(7.0, 8.0, 9.0)}; constant half3 _xlat_mtl_const1[3] = {half3(1.0, 2.0, 3.0), half3(4.0, 5.0, 6.0), half3(7.0, 8.0, 9.0)};
constant float3 _xlat_mtl_const2[3] = {float3(11.0, 12.0, 13.0), float3(14.0, 15.0, 16.0), float3(17.0, 18.0, 19.0)}; constant float3 _xlat_mtl_const2[3] = {float3(11.0, 12.0, 13.0), float3(14.0, 15.0, 16.0), float3(17.0, 18.0, 19.0)};
struct xlatMtlShaderInput { struct xlatMtlShaderInput {
half2 xlv_TEXCOORD0; half2 xlv_TEXCOORD0;
@ -14,24 +14,25 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
half2 tmpvar_2; half2 tmpvar_2 = 0;
tmpvar_2 = _mtl_i.xlv_TEXCOORD0; tmpvar_2 = _mtl_i.xlv_TEXCOORD0;
float3 p_4; float3 p_4 = 0;
float3 f_5; float3 f_5 = 0;
half3 h_6; half3 h_6 = 0;
h_6 = half3(float3(0.0, 0.0, 0.0)); h_6 = half3(float3(0.0, 0.0, 0.0));
f_5 = float3(0.0, 0.0, 0.0); f_5 = float3(0.0, 0.0, 0.0);
half3 tmpvar_7; half3 tmpvar_7 = 0;
tmpvar_7.z = half(1.0); tmpvar_7.z = half(1.0);
tmpvar_7.xy = _mtl_i.xlv_TEXCOORD0; tmpvar_7.xy = _mtl_i.xlv_TEXCOORD0;
p_4 = float3(tmpvar_7); p_4 = float3(tmpvar_7);
for (int j_3 = 0; j_3 < short((tmpvar_2.x * (half)3.0)); j_3++) { for (int j_3 = 0; j_3 < short((tmpvar_2.x * (half)(3.0))); j_3++) {
h_6 = (h_6 + _xlat_mtl_const1[j_3]); h_6 = (h_6 + _xlat_mtl_const1[j_3]);
f_5 = (f_5 + _xlat_mtl_const2[j_3]); f_5 = (f_5 + _xlat_mtl_const2[j_3]);
f_5 = (f_5 + (p_4 * float3(1.0, 2.0, 3.0))); f_5 = (f_5 + (p_4 * (float3)(half3(1.0, 2.0, 3.0))));
f_5 = (f_5 + ((float3)(half3(4.0, 5.0, 6.0)) * p_4));
}; };
float4 tmpvar_8; float4 tmpvar_8 = 0;
tmpvar_8.xy = float2(h_6.xy); tmpvar_8.xy = float2(h_6.xy);
tmpvar_8.zw = f_5.xy; tmpvar_8.zw = f_5.xy;
tmpvar_1 = half4(tmpvar_8); tmpvar_1 = half4(tmpvar_8);
@ -40,6 +41,6 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
} }
// stats: 12 alu 0 tex 2 flow // stats: 14 alu 0 tex 2 flow
// inputs: 1 // inputs: 1
// #0: xlv_TEXCOORD0 (medium float) 2x1 [-1] // #0: xlv_TEXCOORD0 (medium float) 2x1 [-1]

View File

@ -13,12 +13,12 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 xlt_ocol_1; half4 xlt_ocol_1 = 0;
xlt_ocol_1 = _mtl_i._glesFragData_0; xlt_ocol_1 = _mtl_i._glesFragData_0;
half4 ocol_2; half4 ocol_2 = 0;
ocol_2.w = xlt_ocol_1.w; ocol_2.w = xlt_ocol_1.w;
ocol_2.xy = _mtl_i.xlv_TEXCOORD0.xy; ocol_2.xy = _mtl_i.xlv_TEXCOORD0.xy;
ocol_2.z = (xlt_ocol_1.z * (half)2.0); ocol_2.z = (xlt_ocol_1.z * (half)(2.0));
xlt_ocol_1 = ocol_2; xlt_ocol_1 = ocol_2;
_mtl_o._glesFragData_0 = ocol_2; _mtl_o._glesFragData_0 = ocol_2;
return _mtl_o; return _mtl_o;

View File

@ -1,7 +1,7 @@
#include <metal_stdlib> #include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal; using namespace metal;
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less); constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal);
struct FragmentCommonData { struct FragmentCommonData {
half3 diffColor; half3 diffColor;
half3 specColor; half3 specColor;
@ -45,125 +45,125 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, depth2d<float> _ShadowMapTexture [[texture(3)]], sampler _mtlsmp__ShadowMapTexture [[sampler(3)]]) , depth2d<float> _ShadowMapTexture [[texture(3)]], sampler _mtlsmp__ShadowMapTexture [[sampler(3)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half atten_2; half atten_2 = 0;
half4 tmpvar_3; half4 tmpvar_3 = 0;
tmpvar_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0.xy)); tmpvar_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0.xy));
half2 tmpvar_4; half2 tmpvar_4 = 0;
tmpvar_4.x = _mtl_u._Metallic; tmpvar_4.x = _mtl_u._Metallic;
tmpvar_4.y = _mtl_u._Glossiness; tmpvar_4.y = _mtl_u._Glossiness;
half3 tmpvar_5; half3 tmpvar_5 = 0;
tmpvar_5 = (_mtl_u._Color.xyz * tmpvar_3.xyz); tmpvar_5 = (_mtl_u._Color.xyz * tmpvar_3.xyz);
half3 tmpvar_6; half3 tmpvar_6 = 0;
half3 tmpvar_7; half3 tmpvar_7 = 0;
tmpvar_7 = mix (_mtl_u.unity_ColorSpaceDielectricSpec.xyz, tmpvar_5, half3(_mtl_u._Metallic)); tmpvar_7 = mix (_mtl_u.unity_ColorSpaceDielectricSpec.xyz, tmpvar_5, half3(_mtl_u._Metallic));
half tmpvar_8; half tmpvar_8 = 0;
tmpvar_8 = (_mtl_u.unity_ColorSpaceDielectricSpec.w - (_mtl_u._Metallic * _mtl_u.unity_ColorSpaceDielectricSpec.w)); tmpvar_8 = (_mtl_u.unity_ColorSpaceDielectricSpec.w - (_mtl_u._Metallic * _mtl_u.unity_ColorSpaceDielectricSpec.w));
tmpvar_6 = (tmpvar_5 * tmpvar_8); tmpvar_6 = (tmpvar_5 * tmpvar_8);
half3 tmpvar_9; half3 tmpvar_9 = 0;
tmpvar_9 = normalize(_mtl_i.xlv_TEXCOORD2_2.xyz); tmpvar_9 = normalize(_mtl_i.xlv_TEXCOORD2_2.xyz);
half3 tmpvar_10; half3 tmpvar_10 = 0;
tmpvar_10 = normalize(_mtl_i.xlv_TEXCOORD1); tmpvar_10 = normalize(_mtl_i.xlv_TEXCOORD1);
half3 tmpvar_11; half3 tmpvar_11 = 0;
tmpvar_11 = _mtl_u._LightColor0.xyz; tmpvar_11 = _mtl_u._LightColor0.xyz;
half shadow_12; half shadow_12 = 0;
half tmpvar_13; half tmpvar_13 = 0;
tmpvar_13 = _ShadowMapTexture.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.xlv_TEXCOORD6.xyz).xy, (float)(_mtl_i.xlv_TEXCOORD6.xyz).z); tmpvar_13 = _ShadowMapTexture.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.xlv_TEXCOORD6.xyz).xy, saturate((float)(_mtl_i.xlv_TEXCOORD6.xyz).z));
half tmpvar_14; half tmpvar_14 = 0;
tmpvar_14 = tmpvar_13; tmpvar_14 = tmpvar_13;
shadow_12 = (_mtl_u._LightShadowData.x + (tmpvar_14 * ((half)1.0 - _mtl_u._LightShadowData.x))); shadow_12 = (_mtl_u._LightShadowData.x + (tmpvar_14 * ((half)(1.0) - _mtl_u._LightShadowData.x)));
atten_2 = shadow_12; atten_2 = shadow_12;
half occ_15; half occ_15 = 0;
half tmpvar_16; half tmpvar_16 = 0;
tmpvar_16 = _OcclusionMap.sample(_mtlsmp__OcclusionMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).y; tmpvar_16 = _OcclusionMap.sample(_mtlsmp__OcclusionMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).y;
occ_15 = tmpvar_16; occ_15 = tmpvar_16;
half tmpvar_17; half tmpvar_17 = 0;
tmpvar_17 = (((half)1.0 - _mtl_u._OcclusionStrength) + (occ_15 * _mtl_u._OcclusionStrength)); tmpvar_17 = (((half)(1.0) - _mtl_u._OcclusionStrength) + (occ_15 * _mtl_u._OcclusionStrength));
FragmentCommonData s_18; FragmentCommonData s_18;
s_18 = _xlat_mtl_const1; s_18 = _xlat_mtl_const1;
s_18.oneMinusRoughness = tmpvar_4.y; s_18.oneMinusRoughness = tmpvar_4.y;
s_18.normalWorld = tmpvar_9; s_18.normalWorld = tmpvar_9;
s_18.eyeVec = tmpvar_10; s_18.eyeVec = tmpvar_10;
s_18.posWorld = half3(float3(0.0, 0.0, 0.0)); s_18.posWorld = half3(float3(0.0, 0.0, 0.0));
half3 tmpvar_19; half3 tmpvar_19 = 0;
half3 tmpvar_20; half3 tmpvar_20 = 0;
tmpvar_19 = s_18.normalWorld; tmpvar_19 = s_18.normalWorld;
tmpvar_20 = s_18.eyeVec; tmpvar_20 = s_18.eyeVec;
float4 tmpvar_21; float4 tmpvar_21 = 0;
tmpvar_21 = float4(_mtl_u.unity_SpecCube0_HDR); tmpvar_21 = float4(_mtl_u.unity_SpecCube0_HDR);
half tmpvar_22; half tmpvar_22 = 0;
tmpvar_22 = ((half)1.0 - s_18.oneMinusRoughness); tmpvar_22 = ((half)(1.0) - s_18.oneMinusRoughness);
half3 tmpvar_23; half3 tmpvar_23 = 0;
tmpvar_23 = (tmpvar_20 - ((half)2.0 * ( tmpvar_23 = (tmpvar_20 - ((half)(2.0) * (
dot (tmpvar_19, tmpvar_20) dot (tmpvar_19, tmpvar_20)
* tmpvar_19))); * tmpvar_19)));
half4 tmpvar_24; half4 tmpvar_24 = 0;
tmpvar_24.w = half(1.0); tmpvar_24.w = half(1.0);
tmpvar_24.xyz = tmpvar_19; tmpvar_24.xyz = tmpvar_19;
half3 x_25; half3 x_25 = 0;
x_25.x = dot (_mtl_u.unity_SHAr, tmpvar_24); x_25.x = dot (_mtl_u.unity_SHAr, tmpvar_24);
x_25.y = dot (_mtl_u.unity_SHAg, tmpvar_24); x_25.y = dot (_mtl_u.unity_SHAg, tmpvar_24);
x_25.z = dot (_mtl_u.unity_SHAb, tmpvar_24); x_25.z = dot (_mtl_u.unity_SHAb, tmpvar_24);
half4 hdr_26; half4 hdr_26 = 0;
hdr_26 = half4(tmpvar_21); hdr_26 = half4(tmpvar_21);
half4 tmpvar_27; half4 tmpvar_27 = 0;
tmpvar_27.xyz = tmpvar_23; tmpvar_27.xyz = tmpvar_23;
tmpvar_27.w = ((tmpvar_22 * ((half)1.7 - tmpvar_27.w = ((tmpvar_22 * ((half)(1.7) -
((half)0.7 * tmpvar_22) ((half)(0.7) * tmpvar_22)
)) * (half)6.0); )) * (half)(6.0));
half4 tmpvar_28; half4 tmpvar_28 = 0;
tmpvar_28 = unity_SpecCube0.sample(_mtlsmp_unity_SpecCube0, (float3)(tmpvar_23), level(tmpvar_27.w)); tmpvar_28 = unity_SpecCube0.sample(_mtlsmp_unity_SpecCube0, (float3)(tmpvar_23), level(tmpvar_27.w));
half4 tmpvar_29; half4 tmpvar_29 = 0;
tmpvar_29 = tmpvar_28; tmpvar_29 = tmpvar_28;
half3 viewDir_30; half3 viewDir_30 = 0;
viewDir_30 = -(tmpvar_10); viewDir_30 = -(tmpvar_10);
half3 tmpvar_31; half3 tmpvar_31 = 0;
half3 inVec_32; half3 inVec_32 = 0;
inVec_32 = (_mtl_u._WorldSpaceLightPos0.xyz + viewDir_30); inVec_32 = (_mtl_u._WorldSpaceLightPos0.xyz + viewDir_30);
tmpvar_31 = (inVec_32 * rsqrt(max ((half)0.001, tmpvar_31 = (inVec_32 * rsqrt(max ((half)0.001,
dot (inVec_32, inVec_32) dot (inVec_32, inVec_32)
))); )));
half tmpvar_33; half tmpvar_33 = 0;
tmpvar_33 = max ((half)0.0, dot (_mtl_u._WorldSpaceLightPos0.xyz, tmpvar_31)); tmpvar_33 = max ((half)0.0, dot (_mtl_u._WorldSpaceLightPos0.xyz, tmpvar_31));
half tmpvar_34; half tmpvar_34 = 0;
tmpvar_34 = ((half)1.0 - _mtl_u._Glossiness); tmpvar_34 = ((half)(1.0) - _mtl_u._Glossiness);
half tmpvar_35; half tmpvar_35 = 0;
tmpvar_35 = max ((half)0.0001, (tmpvar_34 * tmpvar_34)); tmpvar_35 = max ((half)0.0001, (tmpvar_34 * tmpvar_34));
half tmpvar_36; half tmpvar_36 = 0;
tmpvar_36 = max ((((half)2.0 / tmpvar_36 = max ((((half)(2.0) /
(tmpvar_35 * tmpvar_35) (tmpvar_35 * tmpvar_35)
) - (half)2.0), (half)0.0001); ) - (half)(2.0)), (half)0.0001);
half x_37; half x_37 = 0;
x_37 = ((half)1.0 - max ((half)0.0, dot (tmpvar_9, viewDir_30))); x_37 = ((half)(1.0) - max ((half)0.0, dot (tmpvar_9, viewDir_30)));
half4 tmpvar_38; half4 tmpvar_38 = 0;
tmpvar_38.w = half(1.0); tmpvar_38.w = half(1.0);
tmpvar_38.xyz = ((( tmpvar_38.xyz = (((
((tmpvar_6 + (sqrt( ((tmpvar_6 + (sqrt(
max ((half)0.0001, (((tmpvar_36 + (half)1.0) * pow ( max ((half)0.0001, (((tmpvar_36 + (half)(1.0)) * pow (
max ((half)0.0, dot (tmpvar_9, tmpvar_31)) max ((half)0.0, dot (tmpvar_9, tmpvar_31))
, tmpvar_36)) / (( , tmpvar_36)) / ((
((half)8.0 * (((tmpvar_33 * tmpvar_33) * _mtl_u._Glossiness) + (tmpvar_34 * tmpvar_34))) ((half)(8.0) * (((tmpvar_33 * tmpvar_33) * _mtl_u._Glossiness) + (tmpvar_34 * tmpvar_34)))
* tmpvar_33) + (half)0.0001))) * tmpvar_33) + (half)(0.0001))))
) * tmpvar_7)) * (tmpvar_11 * atten_2)) ) * tmpvar_7)) * (tmpvar_11 * atten_2))
* *
max ((half)0.0, dot (tmpvar_9, _mtl_u._WorldSpaceLightPos0.xyz)) max ((half)0.0, dot (tmpvar_9, _mtl_u._WorldSpaceLightPos0.xyz))
) + ( ) + (
(max ((((half)1.055 * (max ((((half)(1.055) *
pow (max ((half3)float3(0.0, 0.0, 0.0), (_mtl_i.xlv_TEXCOORD5.xyz + x_25)), (half3)float3(0.4166667, 0.4166667, 0.4166667)) pow (max ((half3)float3(0.0, 0.0, 0.0), (_mtl_i.xlv_TEXCOORD5.xyz + x_25)), (half3)float3(0.4166667, 0.4166667, 0.4166667))
) - (half)0.055), (half3)float3(0.0, 0.0, 0.0)) * tmpvar_17) ) - (half)(0.055)), (half3)float3(0.0, 0.0, 0.0)) * tmpvar_17)
* tmpvar_6)) + (( * tmpvar_6)) + ((
((half)1.0 - ((tmpvar_34 * tmpvar_34) * (tmpvar_34 * (half)0.28))) ((half)(1.0) - ((tmpvar_34 * tmpvar_34) * (tmpvar_34 * (half)(0.28))))
* *
(((hdr_26.x * tmpvar_29.w) * tmpvar_29.xyz) * tmpvar_17) (((hdr_26.x * tmpvar_29.w) * tmpvar_29.xyz) * tmpvar_17)
) * mix (tmpvar_7, half3( ) * mix (tmpvar_7, half3(
clamp ((_mtl_u._Glossiness + ((half)1.0 - tmpvar_8)), (half)0.0, (half)1.0) clamp ((_mtl_u._Glossiness + ((half)(1.0) - tmpvar_8)), (half)0.0, (half)1.0)
), half3( ), half3(
((x_37 * x_37) * (x_37 * x_37)) ((x_37 * x_37) * (x_37 * x_37))
)))); ))));
c_1 = (tmpvar_38 * _mtl_i.xlv_COLOR); c_1 = (tmpvar_38 * _mtl_i.xlv_COLOR);
c_1.xyz = c_1.xyz; c_1.xyz = c_1.xyz;
c_1.xyz = c_1.xyz; c_1.xyz = c_1.xyz;
half4 xlat_varoutput_39; half4 xlat_varoutput_39 = 0;
xlat_varoutput_39.xyz = c_1.xyz; xlat_varoutput_39.xyz = c_1.xyz;
xlat_varoutput_39.w = half(1.0); xlat_varoutput_39.w = half(1.0);
_mtl_o.FragData_0 = xlat_varoutput_39; _mtl_o.FragData_0 = xlat_varoutput_39;

View File

@ -12,7 +12,7 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 v_1; half4 v_1 = 0;
v_1.w = half(-1.0); v_1.w = half(-1.0);
v_1.x = ((half)(1.2 + _mtl_u.nonSqMat[0].x)); v_1.x = ((half)(1.2 + _mtl_u.nonSqMat[0].x));
v_1.y = half(6.0); v_1.y = half(6.0);

View File

@ -12,148 +12,148 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
c_1 = half4(float4(0.0, 0.0, 0.0, 0.0)); c_1 = half4(float4(0.0, 0.0, 0.0, 0.0));
float tmpvar_2; float tmpvar_2 = 0;
tmpvar_2 = (_mtl_i.xlv_TEXCOORD0.x / 2.0); tmpvar_2 = (_mtl_i.xlv_TEXCOORD0.x / 2.0);
float tmpvar_3; float tmpvar_3 = 0;
tmpvar_3 = (fract(abs(tmpvar_2)) * 2.0); tmpvar_3 = (fract(abs(tmpvar_2)) * 2.0);
float tmpvar_4; float tmpvar_4 = 0;
if ((tmpvar_2 >= 0.0)) { if ((tmpvar_2 >= 0.0)) {
tmpvar_4 = tmpvar_3; tmpvar_4 = tmpvar_3;
} else { } else {
tmpvar_4 = -(tmpvar_3); tmpvar_4 = -(tmpvar_3);
}; };
c_1.x = half(tmpvar_4); c_1.x = half(tmpvar_4);
float2 tmpvar_5; float2 tmpvar_5 = 0;
tmpvar_5 = (_mtl_i.xlv_TEXCOORD0.xy / float2(2.0, 2.0)); tmpvar_5 = (_mtl_i.xlv_TEXCOORD0.xy / float2(2.0, 2.0));
float2 tmpvar_6; float2 tmpvar_6 = 0;
tmpvar_6 = (fract(abs(tmpvar_5)) * float2(2.0, 2.0)); tmpvar_6 = (fract(abs(tmpvar_5)) * float2(2.0, 2.0));
float tmpvar_7; float tmpvar_7 = 0;
if ((tmpvar_5.x >= 0.0)) { if ((tmpvar_5.x >= 0.0)) {
tmpvar_7 = tmpvar_6.x; tmpvar_7 = tmpvar_6.x;
} else { } else {
tmpvar_7 = -(tmpvar_6.x); tmpvar_7 = -(tmpvar_6.x);
}; };
float tmpvar_8; float tmpvar_8 = 0;
if ((tmpvar_5.y >= 0.0)) { if ((tmpvar_5.y >= 0.0)) {
tmpvar_8 = tmpvar_6.y; tmpvar_8 = tmpvar_6.y;
} else { } else {
tmpvar_8 = -(tmpvar_6.y); tmpvar_8 = -(tmpvar_6.y);
}; };
float2 tmpvar_9; float2 tmpvar_9 = 0;
tmpvar_9.x = tmpvar_7; tmpvar_9.x = tmpvar_7;
tmpvar_9.y = tmpvar_8; tmpvar_9.y = tmpvar_8;
c_1.xy = ((half2)((float2)c_1.xy + tmpvar_9)); c_1.xy = ((half2)((float2)(c_1.xy) + tmpvar_9));
float3 tmpvar_10; float3 tmpvar_10 = 0;
tmpvar_10 = (_mtl_i.xlv_TEXCOORD0.xyz / float3(2.0, 2.0, 2.0)); tmpvar_10 = (_mtl_i.xlv_TEXCOORD0.xyz / float3(2.0, 2.0, 2.0));
float3 tmpvar_11; float3 tmpvar_11 = 0;
tmpvar_11 = (fract(abs(tmpvar_10)) * float3(2.0, 2.0, 2.0)); tmpvar_11 = (fract(abs(tmpvar_10)) * float3(2.0, 2.0, 2.0));
float tmpvar_12; float tmpvar_12 = 0;
if ((tmpvar_10.x >= 0.0)) { if ((tmpvar_10.x >= 0.0)) {
tmpvar_12 = tmpvar_11.x; tmpvar_12 = tmpvar_11.x;
} else { } else {
tmpvar_12 = -(tmpvar_11.x); tmpvar_12 = -(tmpvar_11.x);
}; };
float tmpvar_13; float tmpvar_13 = 0;
if ((tmpvar_10.y >= 0.0)) { if ((tmpvar_10.y >= 0.0)) {
tmpvar_13 = tmpvar_11.y; tmpvar_13 = tmpvar_11.y;
} else { } else {
tmpvar_13 = -(tmpvar_11.y); tmpvar_13 = -(tmpvar_11.y);
}; };
float tmpvar_14; float tmpvar_14 = 0;
if ((tmpvar_10.z >= 0.0)) { if ((tmpvar_10.z >= 0.0)) {
tmpvar_14 = tmpvar_11.z; tmpvar_14 = tmpvar_11.z;
} else { } else {
tmpvar_14 = -(tmpvar_11.z); tmpvar_14 = -(tmpvar_11.z);
}; };
float3 tmpvar_15; float3 tmpvar_15 = 0;
tmpvar_15.x = tmpvar_12; tmpvar_15.x = tmpvar_12;
tmpvar_15.y = tmpvar_13; tmpvar_15.y = tmpvar_13;
tmpvar_15.z = tmpvar_14; tmpvar_15.z = tmpvar_14;
c_1.xyz = ((half3)((float3)c_1.xyz + tmpvar_15)); c_1.xyz = ((half3)((float3)(c_1.xyz) + tmpvar_15));
float4 tmpvar_16; float4 tmpvar_16 = 0;
tmpvar_16 = (_mtl_i.xlv_TEXCOORD0 / float4(2.0, 2.0, 2.0, 2.0)); tmpvar_16 = (_mtl_i.xlv_TEXCOORD0 / float4(2.0, 2.0, 2.0, 2.0));
float4 tmpvar_17; float4 tmpvar_17 = 0;
tmpvar_17 = (fract(abs(tmpvar_16)) * float4(2.0, 2.0, 2.0, 2.0)); tmpvar_17 = (fract(abs(tmpvar_16)) * float4(2.0, 2.0, 2.0, 2.0));
float tmpvar_18; float tmpvar_18 = 0;
if ((tmpvar_16.x >= 0.0)) { if ((tmpvar_16.x >= 0.0)) {
tmpvar_18 = tmpvar_17.x; tmpvar_18 = tmpvar_17.x;
} else { } else {
tmpvar_18 = -(tmpvar_17.x); tmpvar_18 = -(tmpvar_17.x);
}; };
float tmpvar_19; float tmpvar_19 = 0;
if ((tmpvar_16.y >= 0.0)) { if ((tmpvar_16.y >= 0.0)) {
tmpvar_19 = tmpvar_17.y; tmpvar_19 = tmpvar_17.y;
} else { } else {
tmpvar_19 = -(tmpvar_17.y); tmpvar_19 = -(tmpvar_17.y);
}; };
float tmpvar_20; float tmpvar_20 = 0;
if ((tmpvar_16.z >= 0.0)) { if ((tmpvar_16.z >= 0.0)) {
tmpvar_20 = tmpvar_17.z; tmpvar_20 = tmpvar_17.z;
} else { } else {
tmpvar_20 = -(tmpvar_17.z); tmpvar_20 = -(tmpvar_17.z);
}; };
float tmpvar_21; float tmpvar_21 = 0;
if ((tmpvar_16.w >= 0.0)) { if ((tmpvar_16.w >= 0.0)) {
tmpvar_21 = tmpvar_17.w; tmpvar_21 = tmpvar_17.w;
} else { } else {
tmpvar_21 = -(tmpvar_17.w); tmpvar_21 = -(tmpvar_17.w);
}; };
float4 tmpvar_22; float4 tmpvar_22 = 0;
tmpvar_22.x = tmpvar_18; tmpvar_22.x = tmpvar_18;
tmpvar_22.y = tmpvar_19; tmpvar_22.y = tmpvar_19;
tmpvar_22.z = tmpvar_20; tmpvar_22.z = tmpvar_20;
tmpvar_22.w = tmpvar_21; tmpvar_22.w = tmpvar_21;
c_1 = ((half4)((float4)c_1 + tmpvar_22)); c_1 = ((half4)((float4)(c_1) + tmpvar_22));
float tmpvar_23; float tmpvar_23 = 0;
half ip_24; half ip_24 = 0;
int tmpvar_25; int tmpvar_25 = 0;
tmpvar_25 = int(_mtl_i.xlv_TEXCOORD0.x); tmpvar_25 = int(_mtl_i.xlv_TEXCOORD0.x);
ip_24 = half(float(tmpvar_25)); ip_24 = half(float(tmpvar_25));
tmpvar_23 = (_mtl_i.xlv_TEXCOORD0.x - (float)ip_24); tmpvar_23 = (_mtl_i.xlv_TEXCOORD0.x - (float)(ip_24));
c_1.x = ((half)((float)c_1.x + tmpvar_23)); c_1.x = ((half)((float)(c_1.x) + tmpvar_23));
float2 tmpvar_26; float2 tmpvar_26 = 0;
int2 tmpvar_27; int2 tmpvar_27 = 0;
tmpvar_27 = int2(_mtl_i.xlv_TEXCOORD0.xy); tmpvar_27 = int2(_mtl_i.xlv_TEXCOORD0.xy);
half2 tmpvar_28; half2 tmpvar_28 = 0;
tmpvar_28 = half2(float2(tmpvar_27)); tmpvar_28 = half2(float2(tmpvar_27));
tmpvar_26 = (_mtl_i.xlv_TEXCOORD0.xy - (float2)tmpvar_28); tmpvar_26 = (_mtl_i.xlv_TEXCOORD0.xy - (float2)(tmpvar_28));
c_1.xy = ((half2)((float2)c_1.xy + tmpvar_26)); c_1.xy = ((half2)((float2)(c_1.xy) + tmpvar_26));
float3 tmpvar_29; float3 tmpvar_29 = 0;
int3 tmpvar_30; int3 tmpvar_30 = 0;
tmpvar_30 = int3(_mtl_i.xlv_TEXCOORD0.xyz); tmpvar_30 = int3(_mtl_i.xlv_TEXCOORD0.xyz);
half3 tmpvar_31; half3 tmpvar_31 = 0;
tmpvar_31 = half3(float3(tmpvar_30)); tmpvar_31 = half3(float3(tmpvar_30));
tmpvar_29 = (_mtl_i.xlv_TEXCOORD0.xyz - (float3)tmpvar_31); tmpvar_29 = (_mtl_i.xlv_TEXCOORD0.xyz - (float3)(tmpvar_31));
c_1.xyz = ((half3)((float3)c_1.xyz + tmpvar_29)); c_1.xyz = ((half3)((float3)(c_1.xyz) + tmpvar_29));
float4 tmpvar_32; float4 tmpvar_32 = 0;
int4 tmpvar_33; int4 tmpvar_33 = 0;
tmpvar_33 = int4(_mtl_i.xlv_TEXCOORD0); tmpvar_33 = int4(_mtl_i.xlv_TEXCOORD0);
half4 tmpvar_34; half4 tmpvar_34 = 0;
tmpvar_34 = half4(float4(tmpvar_33)); tmpvar_34 = half4(float4(tmpvar_33));
tmpvar_32 = (_mtl_i.xlv_TEXCOORD0 - (float4)tmpvar_34); tmpvar_32 = (_mtl_i.xlv_TEXCOORD0 - (float4)(tmpvar_34));
c_1 = ((half4)((float4)c_1 + tmpvar_32)); c_1 = ((half4)((float4)(c_1) + tmpvar_32));
float tmpvar_35; float tmpvar_35 = 0;
tmpvar_35 = (float(fmod (_mtl_i.xlv_TEXCOORD0.x, (float)tmpvar_34.x))); tmpvar_35 = (float(fmod (_mtl_i.xlv_TEXCOORD0.x, (float)tmpvar_34.x)));
c_1.x = half(((float)c_1.x + tmpvar_35)); c_1.x = half(((float)(c_1.x) + tmpvar_35));
float2 tmpvar_36; float2 tmpvar_36 = 0;
tmpvar_36 = (float2(fmod (_mtl_i.xlv_TEXCOORD0.xy, (float2)tmpvar_34.xy))); tmpvar_36 = (float2(fmod (_mtl_i.xlv_TEXCOORD0.xy, (float2)tmpvar_34.xy)));
c_1.xy = half2(((float2)c_1.xy + tmpvar_36)); c_1.xy = half2(((float2)(c_1.xy) + tmpvar_36));
float3 tmpvar_37; float3 tmpvar_37 = 0;
tmpvar_37 = (float3(fmod (_mtl_i.xlv_TEXCOORD0.xyz, (float3)tmpvar_34.xyz))); tmpvar_37 = (float3(fmod (_mtl_i.xlv_TEXCOORD0.xyz, (float3)tmpvar_34.xyz)));
c_1.xyz = half3(((float3)c_1.xyz + tmpvar_37)); c_1.xyz = half3(((float3)(c_1.xyz) + tmpvar_37));
float tmpvar_38; float tmpvar_38 = 0;
tmpvar_38 = (1.0/(_mtl_i.xlv_TEXCOORD0.x)); tmpvar_38 = (1.0/(_mtl_i.xlv_TEXCOORD0.x));
c_1.x = half(((float)c_1.x + tmpvar_38)); c_1.x = half(((float)(c_1.x) + tmpvar_38));
float tmpvar_39; float tmpvar_39 = 0;
tmpvar_39 = max (0.0, tmpvar_38); tmpvar_39 = max (0.0, tmpvar_38);
c_1.x = half(((float)c_1.x + tmpvar_39)); c_1.x = half(((float)(c_1.x) + tmpvar_39));
c_1.y = (c_1.y + ((half)1.0/(c_1.z))); c_1.y = (c_1.y + ((half)1.0/(c_1.z)));
c_1.y = (c_1.y + max ((half)0.0, ((half)1.0/(c_1.w)))); c_1.y = (c_1.y + max ((half)0.0, ((half)1.0/(c_1.w))));
float tmpvar_40; float tmpvar_40 = 0;
tmpvar_40 = max (_mtl_i.xlv_TEXCOORD0.x, (float)c_1.z); tmpvar_40 = max (_mtl_i.xlv_TEXCOORD0.x, (float)c_1.z);
c_1.x = half(((float)c_1.x + tmpvar_40)); c_1.x = half(((float)(c_1.x) + tmpvar_40));
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;
return _mtl_o; return _mtl_o;
} }

View File

@ -15,14 +15,14 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
half3 light_2; half3 light_2 = 0;
half4 col_3; half4 col_3 = 0;
col_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_uv)); col_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_uv));
light_2 = ((col_3.xyz * _mtl_i.xlv_nl.x) * _mtl_u._TerrainTreeLightColors[0].xyz); light_2 = ((col_3.xyz * _mtl_i.xlv_nl.x) * _mtl_u._TerrainTreeLightColors[0].xyz);
light_2 = (light_2 + ((col_3.xyz * _mtl_i.xlv_nl.y) * _mtl_u._TerrainTreeLightColors[1].xyz)); light_2 = (light_2 + ((col_3.xyz * _mtl_i.xlv_nl.y) * _mtl_u._TerrainTreeLightColors[1].xyz));
light_2 = (light_2 + ((col_3.xyz * _mtl_i.xlv_nl.z) * _mtl_u._TerrainTreeLightColors[2].xyz)); light_2 = (light_2 + ((col_3.xyz * _mtl_i.xlv_nl.z) * _mtl_u._TerrainTreeLightColors[2].xyz));
half4 tmpvar_4; half4 tmpvar_4 = 0;
tmpvar_4.w = half(1.0); tmpvar_4.w = half(1.0);
tmpvar_4.xyz = light_2; tmpvar_4.xyz = light_2;
tmpvar_1 = tmpvar_4; tmpvar_1 = tmpvar_4;

View File

@ -15,17 +15,17 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
half3 light_2; half3 light_2 = 0;
half4 tmpvar_3; half4 tmpvar_3 = 0;
tmpvar_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_uv)); tmpvar_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_uv));
if ((tmpvar_3.w < (half)0.5)) { if ((tmpvar_3.w < (half)(0.5))) {
discard_fragment(); discard_fragment();
}; };
light_2 = ((tmpvar_3.xyz * _mtl_i.xlv_nl.x) * _mtl_u._TerrainTreeLightColors[0].xyz); light_2 = ((tmpvar_3.xyz * _mtl_i.xlv_nl.x) * _mtl_u._TerrainTreeLightColors[0].xyz);
light_2 = (light_2 + ((tmpvar_3.xyz * _mtl_i.xlv_nl.y) * _mtl_u._TerrainTreeLightColors[1].xyz)); light_2 = (light_2 + ((tmpvar_3.xyz * _mtl_i.xlv_nl.y) * _mtl_u._TerrainTreeLightColors[1].xyz));
light_2 = (light_2 + ((tmpvar_3.xyz * _mtl_i.xlv_nl.z) * _mtl_u._TerrainTreeLightColors[2].xyz)); light_2 = (light_2 + ((tmpvar_3.xyz * _mtl_i.xlv_nl.z) * _mtl_u._TerrainTreeLightColors[2].xyz));
half4 tmpvar_4; half4 tmpvar_4 = 0;
tmpvar_4.w = half(1.0); tmpvar_4.w = half(1.0);
tmpvar_4.xyz = light_2; tmpvar_4.xyz = light_2;
tmpvar_1 = tmpvar_4; tmpvar_1 = tmpvar_4;

View File

@ -23,18 +23,18 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _DecalNorm [[texture(1)]], sampler _mtlsmp__DecalNorm [[sampler(1)]]) , texture2d<half> _DecalNorm [[texture(1)]], sampler _mtlsmp__DecalNorm [[sampler(1)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 res_1; half4 res_1 = 0;
half3 worldN_2; half3 worldN_2 = 0;
half3 combinedNormal_3; half3 combinedNormal_3 = 0;
half3 tmpvar_4; half3 tmpvar_4 = 0;
tmpvar_4 = ((_DecalNorm.sample(_mtlsmp__DecalNorm, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz * (half)2.0) - (half)1.0); tmpvar_4 = ((_DecalNorm.sample(_mtlsmp__DecalNorm, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz * (half)(2.0)) - (half)(1.0));
half3 tmpvar_5; half3 tmpvar_5 = 0;
tmpvar_5 = ((_PanelNorm.sample(_mtlsmp__PanelNorm, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz * (half)2.0) - (half)1.0); tmpvar_5 = ((_PanelNorm.sample(_mtlsmp__PanelNorm, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz * (half)(2.0)) - (half)(1.0));
half3 tmpvar_6; half3 tmpvar_6 = 0;
tmpvar_6.x = tmpvar_4.z; tmpvar_6.x = tmpvar_4.z;
tmpvar_6.y = tmpvar_4.y; tmpvar_6.y = tmpvar_4.y;
tmpvar_6.z = -(tmpvar_4.x); tmpvar_6.z = -(tmpvar_4.x);
half3 tmpvar_7; half3 tmpvar_7 = 0;
tmpvar_7.x = tmpvar_4.x; tmpvar_7.x = tmpvar_4.x;
tmpvar_7.y = tmpvar_4.z; tmpvar_7.y = tmpvar_4.z;
tmpvar_7.z = -(tmpvar_4.y); tmpvar_7.z = -(tmpvar_4.y);
@ -50,33 +50,33 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
tmpvar_9[2].y = tmpvar_7.z; tmpvar_9[2].y = tmpvar_7.z;
tmpvar_9[2].z = tmpvar_4.z; tmpvar_9[2].z = tmpvar_4.z;
tmpvar_8 = _xlcast_float3x3(tmpvar_9); tmpvar_8 = _xlcast_float3x3(tmpvar_9);
float3 v_10; float3 v_10 = 0;
v_10.x = tmpvar_8[0].x; v_10.x = tmpvar_8[0].x;
v_10.y = tmpvar_8[1].x; v_10.y = tmpvar_8[1].x;
v_10.z = tmpvar_8[2].x; v_10.z = tmpvar_8[2].x;
float3 v_11; float3 v_11 = 0;
v_11.x = tmpvar_8[0].y; v_11.x = tmpvar_8[0].y;
v_11.y = tmpvar_8[1].y; v_11.y = tmpvar_8[1].y;
v_11.z = tmpvar_8[2].y; v_11.z = tmpvar_8[2].y;
float3 v_12; float3 v_12 = 0;
v_12.x = tmpvar_8[0].z; v_12.x = tmpvar_8[0].z;
v_12.y = tmpvar_8[1].z; v_12.y = tmpvar_8[1].z;
v_12.z = tmpvar_8[2].z; v_12.z = tmpvar_8[2].z;
combinedNormal_3 = normalize((( combinedNormal_3 = normalize(((
((half3)((float)tmpvar_5.x * v_10)) ((half3)((float)(tmpvar_5.x) * v_10))
+ +
((half3)((float)tmpvar_5.y * v_11)) ((half3)((float)(tmpvar_5.y) * v_11))
) + ((half3)((float)tmpvar_5.z * v_12)))); ) + ((half3)((float)(tmpvar_5.z) * v_12))));
float tmpvar_13; float tmpvar_13 = 0;
tmpvar_13 = dot (_mtl_i.xlv_TEXCOORD1.xyz, (float3)combinedNormal_3); tmpvar_13 = dot (_mtl_i.xlv_TEXCOORD1.xyz, (float3)combinedNormal_3);
worldN_2.x = half(tmpvar_13); worldN_2.x = half(tmpvar_13);
float tmpvar_14; float tmpvar_14 = 0;
tmpvar_14 = dot (_mtl_i.xlv_TEXCOORD2.xyz, (float3)combinedNormal_3); tmpvar_14 = dot (_mtl_i.xlv_TEXCOORD2.xyz, (float3)combinedNormal_3);
worldN_2.y = half(tmpvar_14); worldN_2.y = half(tmpvar_14);
float tmpvar_15; float tmpvar_15 = 0;
tmpvar_15 = dot (_mtl_i.xlv_TEXCOORD3.xyz, (float3)combinedNormal_3); tmpvar_15 = dot (_mtl_i.xlv_TEXCOORD3.xyz, (float3)combinedNormal_3);
worldN_2.z = half(tmpvar_15); worldN_2.z = half(tmpvar_15);
res_1.xyz = ((worldN_2 * (half)0.5) + (half)0.5); res_1.xyz = ((worldN_2 * (half)(0.5)) + (half)(0.5));
res_1.w = half(0.0); res_1.w = half(0.0);
_mtl_o._fragData = res_1; _mtl_o._fragData = res_1;
return _mtl_o; return _mtl_o;

View File

@ -28,11 +28,11 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half2x2 halfMatrix_1; half2x2 halfMatrix_1;
float2x2 rotationMatrix_2; float2x2 rotationMatrix_2;
float tmpvar_3; float tmpvar_3 = 0;
float tmpvar_4; float tmpvar_4 = 0;
tmpvar_4 = (_mtl_u._Speed * _mtl_u._Time.x); tmpvar_4 = (_mtl_u._Speed * _mtl_u._Time.x);
tmpvar_3 = sin(tmpvar_4); tmpvar_3 = sin(tmpvar_4);
float tmpvar_5; float tmpvar_5 = 0;
tmpvar_5 = cos(tmpvar_4); tmpvar_5 = cos(tmpvar_4);
float2x2 tmpvar_6; float2x2 tmpvar_6;
tmpvar_6[0].x = tmpvar_5; tmpvar_6[0].x = tmpvar_5;
@ -50,14 +50,14 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
tmpvar_7[1].x = -(tmpvar_3); tmpvar_7[1].x = -(tmpvar_3);
tmpvar_7[1].y = tmpvar_5; tmpvar_7[1].y = tmpvar_5;
halfMatrix_1 = _xlcast_half2x2(tmpvar_7); halfMatrix_1 = _xlcast_half2x2(tmpvar_7);
halfMatrix_1 = (halfMatrix_1 * (half)2.0); halfMatrix_1 = (halfMatrix_1 * (half)(2.0));
halfMatrix_1 = (halfMatrix_1 - _xlinit_half2x2(1.0)); halfMatrix_1 = (halfMatrix_1 - _xlinit_half2x2(1.0));
halfMatrix_1 = _xlcast_half2x2(((float2x2)(_xlinit_half2x2(tmpvar_3) - halfMatrix_1))); halfMatrix_1 = _xlcast_half2x2(((float2x2)(_xlinit_half2x2(tmpvar_3) - halfMatrix_1)));
halfMatrix_1 = _xlcast_half2x2(((float2x2)(_xlinit_half2x2(tmpvar_5) + halfMatrix_1))); halfMatrix_1 = _xlcast_half2x2(((float2x2)(_xlinit_half2x2(tmpvar_5) + halfMatrix_1)));
halfMatrix_1 = _xlcast_half2x2(((float2x2)(halfMatrix_1 * (1.0h/half(tmpvar_3))))); halfMatrix_1 = _xlcast_half2x2(((float2x2)(halfMatrix_1 * (1.0h/half(tmpvar_3)))));
float4 tmpvar_8; float4 tmpvar_8 = 0;
tmpvar_8.xy = (rotationMatrix_2 * _mtl_i.uv); tmpvar_8.xy = (rotationMatrix_2 * _mtl_i.uv);
tmpvar_8.zw = ((float2)(halfMatrix_1 * (half2)_mtl_i.uv)); tmpvar_8.zw = ((float2)(halfMatrix_1 * (half2)(_mtl_i.uv)));
_mtl_o._fragData = half4(tmpvar_8); _mtl_o._fragData = half4(tmpvar_8);
return _mtl_o; return _mtl_o;
} }

View File

@ -13,9 +13,9 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
float4 tmpvar_2; float4 tmpvar_2 = 0;
tmpvar_2 = ((float4)_mtl_i.xlv_COLOR0 * _mtl_u._Color); tmpvar_2 = ((float4)(_mtl_i.xlv_COLOR0) * _mtl_u._Color);
c_1 = half4(tmpvar_2); c_1 = half4(tmpvar_2);
_mtl_o._glesFragData_0 = c_1; _mtl_o._glesFragData_0 = c_1;
return _mtl_o; return _mtl_o;

View File

@ -14,10 +14,10 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half tmpvar_2; half tmpvar_2 = 0;
tmpvar_2 = dot (_mtl_i.normal, _mtl_i.halfDir); tmpvar_2 = dot (_mtl_i.normal, _mtl_i.halfDir);
half4 tmpvar_3; half4 tmpvar_3 = 0;
tmpvar_3 = half4(pow (tmpvar_2, _mtl_u.specPower)); tmpvar_3 = half4(pow (tmpvar_2, _mtl_u.specPower));
c_1 = tmpvar_3; c_1 = tmpvar_3;
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;

View File

@ -13,13 +13,13 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 r_1; half4 r_1 = 0;
half3 lightCoord_2; half3 lightCoord_2 = 0;
float4 tmpvar_3; float4 tmpvar_3 = 0;
tmpvar_3.w = 1.0; tmpvar_3.w = 1.0;
tmpvar_3.xyz = _mtl_u._WorldPos; tmpvar_3.xyz = _mtl_u._WorldPos;
float3 tmpvar_4; float3 tmpvar_4 = 0;
tmpvar_4 = ((float4)(_mtl_u._LightMatrix * (half4)tmpvar_3)).xyz; tmpvar_4 = ((float4)(_mtl_u._LightMatrix * (half4)(tmpvar_3))).xyz;
lightCoord_2 = half3(tmpvar_4); lightCoord_2 = half3(tmpvar_4);
r_1.xyz = lightCoord_2; r_1.xyz = lightCoord_2;
r_1.w = half(1.0); r_1.w = half(1.0);

View File

@ -12,7 +12,7 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half3x3 tmpvar_2; half3x3 tmpvar_2;
tmpvar_2[0].x = half(0.8164966); tmpvar_2[0].x = half(0.8164966);
tmpvar_2[0].y = half(-0.4082483); tmpvar_2[0].y = half(-0.4082483);

View File

@ -18,21 +18,21 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texturecube<float> cubehigh [[texture(5)]], sampler _mtlsmp_cubehigh [[sampler(5)]]) , texturecube<float> cubehigh [[texture(5)]], sampler _mtlsmp_cubehigh [[sampler(5)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half4 tmpvar_2; half4 tmpvar_2 = 0;
tmpvar_2 = texlow.sample(_mtlsmp_texlow, (float2)(_mtl_i.varUV.xy)); tmpvar_2 = texlow.sample(_mtlsmp_texlow, (float2)(_mtl_i.varUV.xy));
c_1 = tmpvar_2; c_1 = tmpvar_2;
c_1 = (c_1 + texmed.sample(_mtlsmp_texmed, (float2)(_mtl_i.varUV.xy))); c_1 = (c_1 + texmed.sample(_mtlsmp_texmed, (float2)(_mtl_i.varUV.xy)));
float4 tmpvar_3; float4 tmpvar_3 = 0;
tmpvar_3 = texhigh.sample(_mtlsmp_texhigh, (float2)(_mtl_i.varUV.xy)); tmpvar_3 = texhigh.sample(_mtlsmp_texhigh, (float2)(_mtl_i.varUV.xy));
c_1 = half4(((float4)c_1 + tmpvar_3)); c_1 = half4(((float4)(c_1) + tmpvar_3));
half4 tmpvar_4; half4 tmpvar_4 = 0;
tmpvar_4 = cubelow.sample(_mtlsmp_cubelow, (float3)(_mtl_i.varUV.xyz)); tmpvar_4 = cubelow.sample(_mtlsmp_cubelow, (float3)(_mtl_i.varUV.xyz));
c_1 = (c_1 + tmpvar_4); c_1 = (c_1 + tmpvar_4);
c_1 = (c_1 + cubemed.sample(_mtlsmp_cubemed, (float3)(_mtl_i.varUV.xyz))); c_1 = (c_1 + cubemed.sample(_mtlsmp_cubemed, (float3)(_mtl_i.varUV.xyz)));
float4 tmpvar_5; float4 tmpvar_5 = 0;
tmpvar_5 = cubehigh.sample(_mtlsmp_cubehigh, (float3)(_mtl_i.varUV.xyz)); tmpvar_5 = cubehigh.sample(_mtlsmp_cubehigh, (float3)(_mtl_i.varUV.xyz));
c_1 = half4(((float4)c_1 + tmpvar_5)); c_1 = half4(((float4)(c_1) + tmpvar_5));
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;
return _mtl_o; return _mtl_o;
} }

View File

@ -12,45 +12,45 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
c_1 = half4(float4(0.0, 0.0, 0.0, 0.0)); c_1 = half4(float4(0.0, 0.0, 0.0, 0.0));
float tmpvar_2; float tmpvar_2 = 0;
if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) { if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) {
tmpvar_2 = 0.9; tmpvar_2 = 0.9;
} else { } else {
tmpvar_2 = 0.1; tmpvar_2 = 0.1;
}; };
c_1 = half4(float4(tmpvar_2)); c_1 = half4(float4(tmpvar_2));
float4 tmpvar_3; float4 tmpvar_3 = 0;
if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) { if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) {
tmpvar_3 = float4(0.9, 0.9, 0.9, 0.9); tmpvar_3 = float4(0.9, 0.9, 0.9, 0.9);
} else { } else {
tmpvar_3 = float4(0.1, 0.1, 0.1, 0.1); tmpvar_3 = float4(0.1, 0.1, 0.1, 0.1);
}; };
c_1 = ((half4)(float4(tmpvar_2) + tmpvar_3)); c_1 = ((half4)(float4(tmpvar_2) + tmpvar_3));
float3 tmpvar_4; float3 tmpvar_4 = 0;
if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) { if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) {
tmpvar_4 = float3(0.9, 0.9, 0.9); tmpvar_4 = float3(0.9, 0.9, 0.9);
} else { } else {
tmpvar_4 = float3(0.1, 0.1, 0.1); tmpvar_4 = float3(0.1, 0.1, 0.1);
}; };
c_1.xyz = (c_1.xyz + (half3)tmpvar_4); c_1.xyz = (c_1.xyz + (half3)(tmpvar_4));
float2 tmpvar_5; float2 tmpvar_5 = 0;
if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) { if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) {
tmpvar_5 = float2(0.9, 0.9); tmpvar_5 = float2(0.9, 0.9);
} else { } else {
tmpvar_5 = float2(0.1, 0.1); tmpvar_5 = float2(0.1, 0.1);
}; };
c_1.xy = (c_1.xy + (half2)tmpvar_5); c_1.xy = (c_1.xy + (half2)(tmpvar_5));
float tmpvar_6; float tmpvar_6 = 0;
tmpvar_6 = fract(_mtl_i.xlv_TEXCOORD0.x); tmpvar_6 = fract(_mtl_i.xlv_TEXCOORD0.x);
float tmpvar_7; float tmpvar_7 = 0;
if (bool(tmpvar_6)) { if (bool(tmpvar_6)) {
tmpvar_7 = 0.9; tmpvar_7 = 0.9;
} else { } else {
tmpvar_7 = 0.1; tmpvar_7 = 0.1;
}; };
c_1.x = (c_1.x + (half)tmpvar_7); c_1.x = (c_1.x + (half)(tmpvar_7));
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;
return _mtl_o; return _mtl_o;
} }

View File

@ -12,164 +12,164 @@ struct xlatMtlShaderUniform {
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
float4 a_2; float4 a_2 = 0;
a_2 = float4(0.0, 0.0, 0.0, 0.0); a_2 = float4(0.0, 0.0, 0.0, 0.0);
bool4 tmpvar_3; bool4 tmpvar_3 = false;
tmpvar_3 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5))); tmpvar_3 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5)));
float tmpvar_4; float tmpvar_4 = 0;
if (tmpvar_3.x) { if (tmpvar_3.x) {
tmpvar_4 = 1.0; tmpvar_4 = 1.0;
} else { } else {
tmpvar_4 = 5.0; tmpvar_4 = 5.0;
}; };
float tmpvar_5; float tmpvar_5 = 0;
if (tmpvar_3.y) { if (tmpvar_3.y) {
tmpvar_5 = 2.0; tmpvar_5 = 2.0;
} else { } else {
tmpvar_5 = 6.0; tmpvar_5 = 6.0;
}; };
float tmpvar_6; float tmpvar_6 = 0;
if (tmpvar_3.z) { if (tmpvar_3.z) {
tmpvar_6 = 3.0; tmpvar_6 = 3.0;
} else { } else {
tmpvar_6 = 7.0; tmpvar_6 = 7.0;
}; };
float tmpvar_7; float tmpvar_7 = 0;
if (tmpvar_3.w) { if (tmpvar_3.w) {
tmpvar_7 = 4.0; tmpvar_7 = 4.0;
} else { } else {
tmpvar_7 = 8.0; tmpvar_7 = 8.0;
}; };
float4 tmpvar_8; float4 tmpvar_8 = 0;
tmpvar_8.x = tmpvar_4; tmpvar_8.x = tmpvar_4;
tmpvar_8.y = tmpvar_5; tmpvar_8.y = tmpvar_5;
tmpvar_8.z = tmpvar_6; tmpvar_8.z = tmpvar_6;
tmpvar_8.w = tmpvar_7; tmpvar_8.w = tmpvar_7;
a_2 = tmpvar_8; a_2 = tmpvar_8;
bool4 tmpvar_9; bool4 tmpvar_9 = false;
tmpvar_9 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5))); tmpvar_9 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5)));
float tmpvar_10; float tmpvar_10 = 0;
if (tmpvar_9.x) { if (tmpvar_9.x) {
tmpvar_10 = 1.0; tmpvar_10 = 1.0;
} else { } else {
tmpvar_10 = 5.0; tmpvar_10 = 5.0;
}; };
float tmpvar_11; float tmpvar_11 = 0;
if (tmpvar_9.y) { if (tmpvar_9.y) {
tmpvar_11 = 2.0; tmpvar_11 = 2.0;
} else { } else {
tmpvar_11 = 6.0; tmpvar_11 = 6.0;
}; };
float tmpvar_12; float tmpvar_12 = 0;
if (tmpvar_9.z) { if (tmpvar_9.z) {
tmpvar_12 = 3.0; tmpvar_12 = 3.0;
} else { } else {
tmpvar_12 = 7.0; tmpvar_12 = 7.0;
}; };
float tmpvar_13; float tmpvar_13 = 0;
if (tmpvar_9.w) { if (tmpvar_9.w) {
tmpvar_13 = 4.0; tmpvar_13 = 4.0;
} else { } else {
tmpvar_13 = 8.0; tmpvar_13 = 8.0;
}; };
float4 tmpvar_14; float4 tmpvar_14 = 0;
tmpvar_14.x = tmpvar_10; tmpvar_14.x = tmpvar_10;
tmpvar_14.y = tmpvar_11; tmpvar_14.y = tmpvar_11;
tmpvar_14.z = tmpvar_12; tmpvar_14.z = tmpvar_12;
tmpvar_14.w = tmpvar_13; tmpvar_14.w = tmpvar_13;
a_2 = (tmpvar_8 + tmpvar_14); a_2 = (tmpvar_8 + tmpvar_14);
bool4 tmpvar_15; bool4 tmpvar_15 = false;
tmpvar_15 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5))); tmpvar_15 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5)));
float tmpvar_16; float tmpvar_16 = 0;
if (tmpvar_15.x) { if (tmpvar_15.x) {
tmpvar_16 = 1.0; tmpvar_16 = 1.0;
} else { } else {
tmpvar_16 = 2.0; tmpvar_16 = 2.0;
}; };
float tmpvar_17; float tmpvar_17 = 0;
if (tmpvar_15.y) { if (tmpvar_15.y) {
tmpvar_17 = 1.0; tmpvar_17 = 1.0;
} else { } else {
tmpvar_17 = 2.0; tmpvar_17 = 2.0;
}; };
float tmpvar_18; float tmpvar_18 = 0;
if (tmpvar_15.z) { if (tmpvar_15.z) {
tmpvar_18 = 1.0; tmpvar_18 = 1.0;
} else { } else {
tmpvar_18 = 2.0; tmpvar_18 = 2.0;
}; };
float tmpvar_19; float tmpvar_19 = 0;
if (tmpvar_15.w) { if (tmpvar_15.w) {
tmpvar_19 = 1.0; tmpvar_19 = 1.0;
} else { } else {
tmpvar_19 = 2.0; tmpvar_19 = 2.0;
}; };
float4 tmpvar_20; float4 tmpvar_20 = 0;
tmpvar_20.x = tmpvar_16; tmpvar_20.x = tmpvar_16;
tmpvar_20.y = tmpvar_17; tmpvar_20.y = tmpvar_17;
tmpvar_20.z = tmpvar_18; tmpvar_20.z = tmpvar_18;
tmpvar_20.w = tmpvar_19; tmpvar_20.w = tmpvar_19;
a_2 = (a_2 + tmpvar_20); a_2 = (a_2 + tmpvar_20);
bool4 tmpvar_21; bool4 tmpvar_21 = false;
tmpvar_21 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5))); tmpvar_21 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5)));
float tmpvar_22; float tmpvar_22 = 0;
if (tmpvar_21.x) { if (tmpvar_21.x) {
tmpvar_22 = 1.0; tmpvar_22 = 1.0;
} else { } else {
tmpvar_22 = 2.0; tmpvar_22 = 2.0;
}; };
float tmpvar_23; float tmpvar_23 = 0;
if (tmpvar_21.y) { if (tmpvar_21.y) {
tmpvar_23 = 1.0; tmpvar_23 = 1.0;
} else { } else {
tmpvar_23 = 2.0; tmpvar_23 = 2.0;
}; };
float tmpvar_24; float tmpvar_24 = 0;
if (tmpvar_21.z) { if (tmpvar_21.z) {
tmpvar_24 = 1.0; tmpvar_24 = 1.0;
} else { } else {
tmpvar_24 = 2.0; tmpvar_24 = 2.0;
}; };
float tmpvar_25; float tmpvar_25 = 0;
if (tmpvar_21.w) { if (tmpvar_21.w) {
tmpvar_25 = 1.0; tmpvar_25 = 1.0;
} else { } else {
tmpvar_25 = 2.0; tmpvar_25 = 2.0;
}; };
float4 tmpvar_26; float4 tmpvar_26 = 0;
tmpvar_26.x = tmpvar_22; tmpvar_26.x = tmpvar_22;
tmpvar_26.y = tmpvar_23; tmpvar_26.y = tmpvar_23;
tmpvar_26.z = tmpvar_24; tmpvar_26.z = tmpvar_24;
tmpvar_26.w = tmpvar_25; tmpvar_26.w = tmpvar_25;
a_2 = (a_2 + tmpvar_26); a_2 = (a_2 + tmpvar_26);
bool4 tmpvar_27; bool4 tmpvar_27 = false;
tmpvar_27 = bool4(fract(_mtl_i.xlv_TEXCOORD0)); tmpvar_27 = bool4(fract(_mtl_i.xlv_TEXCOORD0));
float tmpvar_28; float tmpvar_28 = 0;
if (tmpvar_27.x) { if (tmpvar_27.x) {
tmpvar_28 = 1.0; tmpvar_28 = 1.0;
} else { } else {
tmpvar_28 = 2.0; tmpvar_28 = 2.0;
}; };
float tmpvar_29; float tmpvar_29 = 0;
if (tmpvar_27.y) { if (tmpvar_27.y) {
tmpvar_29 = 1.0; tmpvar_29 = 1.0;
} else { } else {
tmpvar_29 = 2.0; tmpvar_29 = 2.0;
}; };
float tmpvar_30; float tmpvar_30 = 0;
if (tmpvar_27.z) { if (tmpvar_27.z) {
tmpvar_30 = 1.0; tmpvar_30 = 1.0;
} else { } else {
tmpvar_30 = 2.0; tmpvar_30 = 2.0;
}; };
float tmpvar_31; float tmpvar_31 = 0;
if (tmpvar_27.w) { if (tmpvar_27.w) {
tmpvar_31 = 1.0; tmpvar_31 = 1.0;
} else { } else {
tmpvar_31 = 2.0; tmpvar_31 = 2.0;
}; };
float4 tmpvar_32; float4 tmpvar_32 = 0;
tmpvar_32.x = tmpvar_28; tmpvar_32.x = tmpvar_28;
tmpvar_32.y = tmpvar_29; tmpvar_32.y = tmpvar_29;
tmpvar_32.z = tmpvar_30; tmpvar_32.z = tmpvar_30;

View File

@ -13,21 +13,21 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d_array<half> myarr [[texture(0)]], sampler _mtlsmp_myarr [[sampler(0)]]) , texture2d_array<half> myarr [[texture(0)]], sampler _mtlsmp_myarr [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
float4 slod_2; float4 slod_2 = 0;
half4 tmpvar_3; half4 tmpvar_3 = 0;
tmpvar_3 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z)); tmpvar_3 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z));
float4 tmpvar_4; float4 tmpvar_4 = 0;
tmpvar_4 = float4(tmpvar_3); tmpvar_4 = float4(tmpvar_3);
half4 tmpvar_5; half4 tmpvar_5 = 0;
tmpvar_5 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyw).xy), (uint)((_mtl_i.uv.xyw).z)); tmpvar_5 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyw).xy), (uint)((_mtl_i.uv.xyw).z));
float4 tmpvar_6; float4 tmpvar_6 = 0;
tmpvar_6 = float4(tmpvar_5); tmpvar_6 = float4(tmpvar_5);
half4 tmpvar_7; half4 tmpvar_7 = 0;
tmpvar_7 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z), bias(1.5)); tmpvar_7 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z), bias(1.5));
float4 tmpvar_8; float4 tmpvar_8 = 0;
tmpvar_8 = float4(tmpvar_7); tmpvar_8 = float4(tmpvar_7);
half4 tmpvar_9; half4 tmpvar_9 = 0;
tmpvar_9 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z), level(2.5)); tmpvar_9 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z), level(2.5));
slod_2 = float4(tmpvar_9); slod_2 = float4(tmpvar_9);
tmpvar_1 = half4(((tmpvar_4 + tmpvar_6) + (tmpvar_8 + slod_2))); tmpvar_1 = half4(((tmpvar_4 + tmpvar_6) + (tmpvar_8 + slod_2)));

View File

@ -15,13 +15,13 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> tex [[texture(0)]], sampler _mtlsmp_tex [[sampler(0)]]) , texture2d<half> tex [[texture(0)]], sampler _mtlsmp_tex [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half2 tmpvar_1; half2 tmpvar_1 = 0;
tmpvar_1 = dfdx(_mtl_i.uv1.xy); tmpvar_1 = dfdx(_mtl_i.uv1.xy);
half2 tmpvar_2; half2 tmpvar_2 = 0;
tmpvar_2 = dfdy(_mtl_i.uv1.xy); tmpvar_2 = dfdy(_mtl_i.uv1.xy);
float2 tmpvar_3; float2 tmpvar_3 = 0;
tmpvar_3 = dfdx(_mtl_i.uv2.xy); tmpvar_3 = dfdx(_mtl_i.uv2.xy);
float2 tmpvar_4; float2 tmpvar_4 = 0;
tmpvar_4 = dfdy(_mtl_i.uv2.xy); tmpvar_4 = dfdy(_mtl_i.uv2.xy);
_mtl_o._fragColor = ((tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv1.xy), gradient2d((float2)(tmpvar_1), (float2)(tmpvar_2))) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv2.xy), gradient2d((float2)(tmpvar_3), (float2)(tmpvar_4)))) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv2.xy), gradient2d((float2)(_mtl_i.uv1.xy), (float2)(_mtl_i.uv1.xy)))); _mtl_o._fragColor = ((tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv1.xy), gradient2d((float2)(tmpvar_1), (float2)(tmpvar_2))) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv2.xy), gradient2d((float2)(tmpvar_3), (float2)(tmpvar_4)))) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv2.xy), gradient2d((float2)(_mtl_i.uv1.xy), (float2)(_mtl_i.uv1.xy))));
return _mtl_o; return _mtl_o;

View File

@ -15,11 +15,11 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> tex [[texture(0)]], sampler _mtlsmp_tex [[sampler(0)]]) , texture2d<half> tex [[texture(0)]], sampler _mtlsmp_tex [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
half4 tmpvar_2; half4 tmpvar_2 = 0;
tmpvar_2 = tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uvHi.xy), level(0.0)); tmpvar_2 = tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uvHi.xy), level(0.0));
tmpvar_1 = tmpvar_2; tmpvar_1 = tmpvar_2;
half4 tmpvar_3; half4 tmpvar_3 = 0;
tmpvar_3 = tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uvMed.xy), level(_mtl_i.uvMed.z)); tmpvar_3 = tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uvMed.xy), level(_mtl_i.uvMed.z));
_mtl_o._fragColor = (tmpvar_1 + tmpvar_3); _mtl_o._fragColor = (tmpvar_1 + tmpvar_3);
return _mtl_o; return _mtl_o;

View File

@ -1,7 +1,7 @@
#include <metal_stdlib> #include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal; using namespace metal;
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less); constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal);
struct xlatMtlShaderInput { struct xlatMtlShaderInput {
float4 uvHi; float4 uvHi;
half4 uvMed; half4 uvMed;
@ -16,11 +16,11 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, depth2d<float> shadowmap [[texture(0)]], sampler _mtlsmp_shadowmap [[sampler(0)]]) , depth2d<float> shadowmap [[texture(0)]], sampler _mtlsmp_shadowmap [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 r_1; half4 r_1 = 0;
half4 tmpvar_2; half4 tmpvar_2 = 0;
tmpvar_2 = half4((shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi.xyz).xy, (float)(_mtl_i.uvHi.xyz).z) + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi).xy / (float)(_mtl_i.uvHi).w, (float)(_mtl_i.uvHi).z / (float)(_mtl_i.uvHi).w))); tmpvar_2 = half4((shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi.xyz).xy, saturate((float)(_mtl_i.uvHi.xyz).z)) + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi).xy / (float)(_mtl_i.uvHi).w, saturate((float)(_mtl_i.uvHi).z / (float)(_mtl_i.uvHi).w))));
r_1.yzw = tmpvar_2.yzw; r_1.yzw = tmpvar_2.yzw;
r_1.x = (tmpvar_2.x + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvMed.xyz).xy, (float)(_mtl_i.uvMed.xyz).z)); r_1.x = (tmpvar_2.x + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvMed.xyz).xy, saturate((float)(_mtl_i.uvMed.xyz).z)));
_mtl_o._fragColor = r_1; _mtl_o._fragColor = r_1;
return _mtl_o; return _mtl_o;
} }

View File

@ -1,7 +1,7 @@
#include <metal_stdlib> #include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal; using namespace metal;
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less); constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal);
struct xlatMtlShaderInput { struct xlatMtlShaderInput {
half4 uv; half4 uv;
}; };
@ -15,7 +15,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, depthcube<float> shadowmap [[texture(0)]], sampler _mtlsmp_shadowmap [[sampler(0)]]) , depthcube<float> shadowmap [[texture(0)]], sampler _mtlsmp_shadowmap [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
tmpvar_1 = half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float3)(_mtl_i.uv).xyz, (_mtl_i.uv).w)); tmpvar_1 = half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float3)(_mtl_i.uv).xyz, (_mtl_i.uv).w));
_mtl_o._fragColor = tmpvar_1; _mtl_o._fragColor = tmpvar_1;
return _mtl_o; return _mtl_o;

View File

@ -14,7 +14,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture3d<half> vol [[texture(1)]], sampler _mtlsmp_vol [[sampler(1)]]) , texture3d<half> vol [[texture(1)]], sampler _mtlsmp_vol [[sampler(1)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
c_1 = (tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv.xy)) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv.xy), bias(0.5))); c_1 = (tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv.xy)) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv.xy), bias(0.5)));
c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(_mtl_i.uv))); c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(_mtl_i.uv)));
c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(_mtl_i.uv), bias(-0.5))); c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(_mtl_i.uv), bias(-0.5)));

View File

@ -1,7 +1,7 @@
#include <metal_stdlib> #include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal; using namespace metal;
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less); constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal);
struct xlatMtlShaderInput { struct xlatMtlShaderInput {
float4 uv; float4 uv;
}; };
@ -15,12 +15,12 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, depth2d<float> shadowmap [[texture(1)]], sampler _mtlsmp_shadowmap [[sampler(1)]]) , depth2d<float> shadowmap [[texture(1)]], sampler _mtlsmp_shadowmap [[sampler(1)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
c_1 = (tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w)) + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv.xyz).xy / (float)(_mtl_i.uv.xyz).z))); c_1 = (tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w)) + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv.xyz).xy / (float)(_mtl_i.uv.xyz).z)));
c_1 = (c_1 + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w), level(1.0))); c_1 = (c_1 + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w), level(1.0)));
c_1 = (c_1 + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv.xyz).xy / (float)(_mtl_i.uv.xyz).z), level(1.0))); c_1 = (c_1 + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv.xyz).xy / (float)(_mtl_i.uv.xyz).z), level(1.0)));
c_1 = (c_1 + half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uv.xyz).xy, (float)(_mtl_i.uv.xyz).z))); c_1 = (c_1 + half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uv.xyz).xy, saturate((float)(_mtl_i.uv.xyz).z))));
c_1 = (c_1 + half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w, (float)(_mtl_i.uv).z / (float)(_mtl_i.uv).w))); c_1 = (c_1 + half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w, saturate((float)(_mtl_i.uv).z / (float)(_mtl_i.uv).w))));
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;
return _mtl_o; return _mtl_o;
} }

View File

@ -0,0 +1,7 @@
#version 300 es
uniform highp sampler2D map;
layout ( location = 0 ) out mediump vec4 out_color;
void main () {
vec2 map_size = vec2(textureSize(map, 0));
out_color = vec4(map_size.x, map_size.y, 0.0, 0.0);
}

View File

@ -0,0 +1,15 @@
#version 300 es
uniform highp sampler2D map;
layout(location=0) out mediump vec4 out_color;
void main ()
{
highp vec4 tmpvar_1;
tmpvar_1.zw = vec2(0.0, 0.0);
tmpvar_1.xy = vec2(textureSize (map, 0));
out_color = tmpvar_1;
}
// stats: 2 alu 1 tex 0 flow
// textures: 1
// #0: map (high 2d) 0x0 [-1]

View File

@ -0,0 +1,25 @@
#include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal;
struct xlatMtlShaderInput {
};
struct xlatMtlShaderOutput {
half4 out_color [[color(0)]];
};
struct xlatMtlShaderUniform {
};
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]
, texture2d<float> map [[texture(0)]], sampler _mtlsmp_map [[sampler(0)]])
{
xlatMtlShaderOutput _mtl_o;
float4 tmpvar_1 = 0;
tmpvar_1.zw = float2(0.0, 0.0);
tmpvar_1.xy = float2(map.get_width(0), map.get_height(0));
_mtl_o.out_color = half4(tmpvar_1);
return _mtl_o;
}
// stats: 2 alu 1 tex 0 flow
// textures: 1
// #0: map (high 2d) 0x0 [-1] loc 0

View File

@ -0,0 +1,7 @@
#version 150
uniform sampler2DMS tex;
in vec2 uv;
out vec4 color;
void main() {
color = texelFetch(tex, ivec2(uv), 3);
}

View File

@ -0,0 +1,15 @@
#version 150
uniform sampler2DMS tex;
in vec2 uv;
out vec4 color;
void main ()
{
color = texelFetch (tex, ivec2(uv), 3);
}
// stats: 1 alu 1 tex 0 flow
// inputs: 1
// #0: uv (high float) 2x1 [-1]
// textures: 1
// #0: tex (high other) 0x0 [-1]

View File

@ -0,0 +1,44 @@
#version 300 es
#define gl_FragData _glesFragData
layout(location = 0) out mediump vec4 _glesFragData[1];
uniform sampler2D _MainTex;
struct u2v {
vec4 pos;
vec2 uv;
};
struct v2f {
vec4 pos;
vec2 uv;
};
v2f vert (u2v v) {
v2f o;
o.pos = v.pos;
o.uv = v.uv;
return o;
}
vec4 frag (in v2f i) {
vec4 foo;
bool bar;
mat4 mat;
vec4 leet = vec4(0.5);
vec4 col = texture(_MainTex, i.uv);
col += bar ? foo : leet;
col += mat[0];
return col;
}
in mediump vec2 xlv_TEXCOORD0;
void main() {
mediump vec4 xl_retval;
v2f xlt_i;
xlt_i.pos = vec4(0.0);
xlt_i.uv = vec2(xlv_TEXCOORD0);
xl_retval = frag(xlt_i);
gl_FragData[0] = vec4(xl_retval);
}

View File

@ -0,0 +1,32 @@
#version 300 es
layout(location=0) out mediump vec4 _glesFragData[1];
uniform sampler2D _MainTex;
in mediump vec2 xlv_TEXCOORD0;
void main ()
{
mediump vec4 xl_retval_1;
lowp vec4 col_2;
highp vec4 mat_0_3;
bool bar_4;
highp vec4 foo_5;
lowp vec4 tmpvar_6;
tmpvar_6 = texture (_MainTex, xlv_TEXCOORD0);
col_2 = tmpvar_6;
highp vec4 tmpvar_7;
if (bar_4) {
tmpvar_7 = foo_5;
} else {
tmpvar_7 = vec4(0.5, 0.5, 0.5, 0.5);
};
col_2 = (tmpvar_6 + tmpvar_7);
col_2 = (col_2 + mat_0_3);
xl_retval_1 = col_2;
_glesFragData[0] = xl_retval_1;
}
// stats: 3 alu 1 tex 1 flow
// inputs: 1
// #0: xlv_TEXCOORD0 (medium float) 2x1 [-1]
// textures: 1
// #0: _MainTex (low 2d) 0x0 [-1]

View File

@ -0,0 +1,42 @@
#include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal;
struct xlatMtlShaderInput {
half2 xlv_TEXCOORD0;
};
struct xlatMtlShaderOutput {
half4 _glesFragData_0 [[color(0)]];
};
struct xlatMtlShaderUniform {
};
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]
, texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]])
{
xlatMtlShaderOutput _mtl_o;
half4 xl_retval_1 = 0;
half4 col_2 = 0;
float4 mat_0_3 = 0;
bool bar_4 = false;
float4 foo_5 = 0;
half4 tmpvar_6 = 0;
tmpvar_6 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0));
col_2 = tmpvar_6;
float4 tmpvar_7 = 0;
if (bar_4) {
tmpvar_7 = foo_5;
} else {
tmpvar_7 = float4(0.5, 0.5, 0.5, 0.5);
};
col_2 = (tmpvar_6 + (half4)(tmpvar_7));
col_2 = (col_2 + (half4)(mat_0_3));
xl_retval_1 = col_2;
_mtl_o._glesFragData_0 = xl_retval_1;
return _mtl_o;
}
// stats: 3 alu 1 tex 1 flow
// inputs: 1
// #0: xlv_TEXCOORD0 (medium float) 2x1 [-1]
// textures: 1
// #0: _MainTex (low 2d) 0x0 [-1] loc 0

View File

@ -16,15 +16,15 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _MainTex [[texture(2)]], sampler _mtlsmp__MainTex [[sampler(2)]]) , texture2d<half> _MainTex [[texture(2)]], sampler _mtlsmp__MainTex [[sampler(2)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half3 tmpvar_2; half3 tmpvar_2 = 0;
half3 tmpvar_3; half3 tmpvar_3 = 0;
half4 c_4; half4 c_4 = 0;
half4 tmpvar_5; half4 tmpvar_5 = 0;
tmpvar_5 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_5 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0));
c_4 = tmpvar_5; c_4 = tmpvar_5;
tmpvar_2 = c_4.xyz; tmpvar_2 = c_4.xyz;
tmpvar_3 = ((c_4.xyz * (half)2.0) - (half)1.0); tmpvar_3 = ((c_4.xyz * (half)(2.0)) - (half)(1.0));
half3x3 tmpvar_6; half3x3 tmpvar_6;
tmpvar_6[0].x = half(0.8164966); tmpvar_6[0].x = half(0.8164966);
tmpvar_6[0].y = half(-0.4082483); tmpvar_6[0].y = half(-0.4082483);
@ -35,15 +35,15 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
tmpvar_6[2].x = half(0.5773503); tmpvar_6[2].x = half(0.5773503);
tmpvar_6[2].y = half(0.5773503); tmpvar_6[2].y = half(0.5773503);
tmpvar_6[2].z = half(0.5773503); tmpvar_6[2].z = half(0.5773503);
half3 normal_7; half3 normal_7 = 0;
normal_7 = tmpvar_3; normal_7 = tmpvar_3;
half3 scalePerBasisVector_8; half3 scalePerBasisVector_8 = 0;
half3 lm_9; half3 lm_9 = 0;
half3 tmpvar_10; half3 tmpvar_10 = 0;
tmpvar_10 = ((half)2.0 * unity_Lightmap.sample(_mtlsmp_unity_Lightmap, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz); tmpvar_10 = ((half)(2.0) * unity_Lightmap.sample(_mtlsmp_unity_Lightmap, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz);
lm_9 = tmpvar_10; lm_9 = tmpvar_10;
half3 tmpvar_11; half3 tmpvar_11 = 0;
tmpvar_11 = ((half)2.0 * unity_LightmapInd.sample(_mtlsmp_unity_LightmapInd, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz); tmpvar_11 = ((half)(2.0) * unity_LightmapInd.sample(_mtlsmp_unity_LightmapInd, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz);
scalePerBasisVector_8 = tmpvar_11; scalePerBasisVector_8 = tmpvar_11;
lm_9 = (lm_9 * dot (clamp ( lm_9 = (lm_9 * dot (clamp (
(tmpvar_6 * normal_7) (tmpvar_6 * normal_7)

View File

@ -20,101 +20,101 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _CameraDepthTexture [[texture(0)]], sampler _mtlsmp__CameraDepthTexture [[sampler(0)]]) , texture2d<half> _CameraDepthTexture [[texture(0)]], sampler _mtlsmp__CameraDepthTexture [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float4 depth_1; float4 depth_1 = 0;
float2 coordTemp_2; float2 coordTemp_2 = 0;
float sampleOnEpipolarLine_3; float sampleOnEpipolarLine_3 = 0;
float tmpvar_4; float tmpvar_4 = 0;
tmpvar_4 = clamp ((_mtl_i.xlv_TEXCOORD0.y - (0.5 / _mtl_u._CoordTexDim.y)), 0.0, 1.0); tmpvar_4 = clamp ((_mtl_i.xlv_TEXCOORD0.y - (0.5 / _mtl_u._CoordTexDim.y)), 0.0, 1.0);
sampleOnEpipolarLine_3 = ((_mtl_i.xlv_TEXCOORD0.x - (0.5 / _mtl_u._CoordTexDim.x)) * (_mtl_u._CoordTexDim.x / (_mtl_u._CoordTexDim.x - 1.0))); sampleOnEpipolarLine_3 = ((_mtl_i.xlv_TEXCOORD0.x - (0.5 / _mtl_u._CoordTexDim.x)) * (_mtl_u._CoordTexDim.x / (_mtl_u._CoordTexDim.x - 1.0)));
float tmpvar_5; float tmpvar_5 = 0;
tmpvar_5 = clamp (sampleOnEpipolarLine_3, 0.0, 1.0); tmpvar_5 = clamp (sampleOnEpipolarLine_3, 0.0, 1.0);
sampleOnEpipolarLine_3 = tmpvar_5; sampleOnEpipolarLine_3 = tmpvar_5;
int tmpvar_6; int tmpvar_6 = 0;
tmpvar_6 = int(clamp (floor( tmpvar_6 = int(clamp (floor(
(tmpvar_4 * 4.0) (tmpvar_4 * 4.0)
), 0.0, 3.0)); ), 0.0, 3.0));
float tmpvar_7; float tmpvar_7 = 0;
tmpvar_7 = (-1.0 + (2.0 * fract( tmpvar_7 = (-1.0 + (2.0 * fract(
(tmpvar_4 * 4.0) (tmpvar_4 * 4.0)
))); )));
float4 tmpvar_8; float4 tmpvar_8 = 0;
tmpvar_8.xz = float2(-1.0, 1.0); tmpvar_8.xz = float2(-1.0, 1.0);
tmpvar_8.y = tmpvar_7; tmpvar_8.y = tmpvar_7;
tmpvar_8.w = -(tmpvar_7); tmpvar_8.w = -(tmpvar_7);
float4 tmpvar_9; float4 tmpvar_9 = 0;
tmpvar_9.yw = float2(-1.0, 1.0); tmpvar_9.yw = float2(-1.0, 1.0);
tmpvar_9.x = -(tmpvar_7); tmpvar_9.x = -(tmpvar_7);
tmpvar_9.z = tmpvar_7; tmpvar_9.z = tmpvar_7;
bool4 tmpvar_10; bool4 tmpvar_10 = false;
tmpvar_10 = bool4((int4(tmpvar_6) == int4(0, 1, 2, 3))); tmpvar_10 = bool4((int4(tmpvar_6) == int4(0, 1, 2, 3)));
half4 tmpvar_11; half4 tmpvar_11 = 0;
tmpvar_11 = half4(tmpvar_10); tmpvar_11 = half4(tmpvar_10);
half4 tmpvar_12; half4 tmpvar_12 = 0;
tmpvar_12 = half4(tmpvar_10); tmpvar_12 = half4(tmpvar_10);
float2 tmpvar_13; float2 tmpvar_13 = 0;
tmpvar_13.x = dot (tmpvar_9, (float4)tmpvar_11); tmpvar_13.x = dot (tmpvar_9, (float4)tmpvar_11);
tmpvar_13.y = dot (tmpvar_8, (float4)tmpvar_12); tmpvar_13.y = dot (tmpvar_8, (float4)tmpvar_12);
coordTemp_2 = ((mix (_mtl_u._LightPos.xy, coordTemp_2 = ((mix (_mtl_u._LightPos.xy,
-(tmpvar_13) -(tmpvar_13)
, float2(tmpvar_5)) * 0.5) + 0.5); , float2(tmpvar_5)) * 0.5) + 0.5);
float4 tmpvar_14; float4 tmpvar_14 = 0;
tmpvar_14.zw = float2(0.0, 0.0); tmpvar_14.zw = float2(0.0, 0.0);
tmpvar_14.xy = coordTemp_2; tmpvar_14.xy = coordTemp_2;
coordTemp_2 = ((floor( coordTemp_2 = ((floor(
(coordTemp_2 * _mtl_u._ScreenTexDim.xy) (coordTemp_2 * _mtl_u._ScreenTexDim.xy)
) + 0.5) * _mtl_u._ScreenTexDim.zw); ) + 0.5) * _mtl_u._ScreenTexDim.zw);
half4 tmpvar_15; half4 tmpvar_15 = 0;
tmpvar_15 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(coordTemp_2)); tmpvar_15 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(coordTemp_2));
float tmpvar_16; float tmpvar_16 = 0;
float z_17; float z_17 = 0;
z_17 = float(tmpvar_15.x); z_17 = float(tmpvar_15.x);
tmpvar_16 = (1.0/(((_mtl_u._ZBufferParams.x * z_17) + _mtl_u._ZBufferParams.y))); tmpvar_16 = (1.0/(((_mtl_u._ZBufferParams.x * z_17) + _mtl_u._ZBufferParams.y)));
depth_1 = float4(tmpvar_16); depth_1 = float4(tmpvar_16);
float4 v_18; float4 v_18 = 0;
v_18.x = _mtl_u._FrustumRays[0].x; v_18.x = _mtl_u._FrustumRays[0].x;
v_18.y = _mtl_u._FrustumRays[1].x; v_18.y = _mtl_u._FrustumRays[1].x;
v_18.z = _mtl_u._FrustumRays[2].x; v_18.z = _mtl_u._FrustumRays[2].x;
v_18.w = _mtl_u._FrustumRays[3].x; v_18.w = _mtl_u._FrustumRays[3].x;
float4 v_19; float4 v_19 = 0;
v_19.x = _mtl_u._FrustumRays[0].y; v_19.x = _mtl_u._FrustumRays[0].y;
v_19.y = _mtl_u._FrustumRays[1].y; v_19.y = _mtl_u._FrustumRays[1].y;
v_19.z = _mtl_u._FrustumRays[2].y; v_19.z = _mtl_u._FrustumRays[2].y;
v_19.w = _mtl_u._FrustumRays[3].y; v_19.w = _mtl_u._FrustumRays[3].y;
float4 v_20; float4 v_20 = 0;
v_20.x = _mtl_u._FrustumRays[0].w; v_20.x = _mtl_u._FrustumRays[0].w;
v_20.y = _mtl_u._FrustumRays[1].w; v_20.y = _mtl_u._FrustumRays[1].w;
v_20.z = _mtl_u._FrustumRays[2].w; v_20.z = _mtl_u._FrustumRays[2].w;
v_20.w = _mtl_u._FrustumRays[3].w; v_20.w = _mtl_u._FrustumRays[3].w;
float4 v_21; float4 v_21 = 0;
v_21.x = _mtl_u._FrustumRays[0].z; v_21.x = _mtl_u._FrustumRays[0].z;
v_21.y = _mtl_u._FrustumRays[1].z; v_21.y = _mtl_u._FrustumRays[1].z;
v_21.z = _mtl_u._FrustumRays[2].z; v_21.z = _mtl_u._FrustumRays[2].z;
v_21.w = _mtl_u._FrustumRays[3].z; v_21.w = _mtl_u._FrustumRays[3].z;
float3 tmpvar_22; float3 tmpvar_22 = 0;
tmpvar_22 = mix (mix (v_18.xyz, v_19.xyz, tmpvar_14.xxx), mix (v_20.xyz, v_21.xyz, tmpvar_14.xxx), tmpvar_14.yyy); tmpvar_22 = mix (mix (v_18.xyz, v_19.xyz, tmpvar_14.xxx), mix (v_20.xyz, v_21.xyz, tmpvar_14.xxx), tmpvar_14.yyy);
float tmpvar_23; float tmpvar_23 = 0;
tmpvar_23 = sqrt(dot (tmpvar_22, tmpvar_22)); tmpvar_23 = sqrt(dot (tmpvar_22, tmpvar_22));
bool tmpvar_24; bool tmpvar_24 = false;
float3 tmpvar_25; float3 tmpvar_25 = 0;
tmpvar_25 = (1.0/((tmpvar_22 / tmpvar_23))); tmpvar_25 = (1.0/((tmpvar_22 / tmpvar_23)));
float3 tmpvar_26; float3 tmpvar_26 = 0;
tmpvar_26 = (tmpvar_25 * (-0.5 - _mtl_u._CameraPosLocal.xyz)); tmpvar_26 = (tmpvar_25 * (-0.5 - _mtl_u._CameraPosLocal.xyz));
float3 tmpvar_27; float3 tmpvar_27 = 0;
tmpvar_27 = (tmpvar_25 * (0.5 - _mtl_u._CameraPosLocal.xyz)); tmpvar_27 = (tmpvar_25 * (0.5 - _mtl_u._CameraPosLocal.xyz));
float3 tmpvar_28; float3 tmpvar_28 = 0;
tmpvar_28 = min (tmpvar_27, tmpvar_26); tmpvar_28 = min (tmpvar_27, tmpvar_26);
float3 tmpvar_29; float3 tmpvar_29 = 0;
tmpvar_29 = max (tmpvar_27, tmpvar_26); tmpvar_29 = max (tmpvar_27, tmpvar_26);
float2 tmpvar_30; float2 tmpvar_30 = 0;
tmpvar_30 = max (tmpvar_28.xx, tmpvar_28.yz); tmpvar_30 = max (tmpvar_28.xx, tmpvar_28.yz);
float tmpvar_31; float tmpvar_31 = 0;
tmpvar_31 = max (tmpvar_30.x, tmpvar_30.y); tmpvar_31 = max (tmpvar_30.x, tmpvar_30.y);
float2 tmpvar_32; float2 tmpvar_32 = 0;
tmpvar_32 = min (tmpvar_29.xx, tmpvar_29.yz); tmpvar_32 = min (tmpvar_29.xx, tmpvar_29.yz);
float tmpvar_33; float tmpvar_33 = 0;
tmpvar_33 = min (tmpvar_32.x, tmpvar_32.y); tmpvar_33 = min (tmpvar_32.x, tmpvar_32.y);
tmpvar_24 = bool(((tmpvar_31 < tmpvar_33) && (tmpvar_33 > 0.0))); tmpvar_24 = bool(((tmpvar_31 < tmpvar_33) && (tmpvar_33 > 0.0)));
if (((bool)!(tmpvar_24) || (tmpvar_16 < (tmpvar_31 / tmpvar_23)))) { if (((bool)(!(tmpvar_24)) || (tmpvar_16 < (tmpvar_31 / tmpvar_23)))) {
depth_1 = -(float4(tmpvar_16)); depth_1 = -(float4(tmpvar_16));
} else { } else {
depth_1 = min (depth_1, float4((tmpvar_33 / tmpvar_23))); depth_1 = min (depth_1, float4((tmpvar_33 / tmpvar_23)));

View File

@ -21,26 +21,26 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _MainTex [[texture(1)]], sampler _mtlsmp__MainTex [[sampler(1)]]) , texture2d<half> _MainTex [[texture(1)]], sampler _mtlsmp__MainTex [[sampler(1)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half3 tmpvar_2; half3 tmpvar_2 = 0;
half tmpvar_3; half tmpvar_3 = 0;
half4 tmpvar_4; half4 tmpvar_4 = 0;
tmpvar_4 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i._uv0.xy)); tmpvar_4 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i._uv0.xy));
tmpvar_2 = (tmpvar_4.xyz * _mtl_u._Color.xyz); tmpvar_2 = (tmpvar_4.xyz * _mtl_u._Color.xyz);
tmpvar_3 = (tmpvar_4.w * _mtl_u._Color.w); tmpvar_3 = (tmpvar_4.w * _mtl_u._Color.w);
half4 tmpvar_5; half4 tmpvar_5 = 0;
tmpvar_5 = _BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i._uv0.zw)); tmpvar_5 = _BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i._uv0.zw));
half4 packednormal_6; half4 packednormal_6 = 0;
packednormal_6 = tmpvar_5; packednormal_6 = tmpvar_5;
half4 normal_7; half4 normal_7 = 0;
normal_7.xy = ((packednormal_6.wy * (half)2.0) - (half)1.0); normal_7.xy = ((packednormal_6.wy * (half)(2.0)) - (half)(1.0));
normal_7.z = sqrt((((half)1.0 - normal_7.z = sqrt((((half)(1.0) -
(normal_7.x * normal_7.x) (normal_7.x * normal_7.x)
) - (normal_7.y * normal_7.y))); ) - (normal_7.y * normal_7.y)));
half4 c_8; half4 c_8 = 0;
half spec_9; half spec_9 = 0;
half tmpvar_10; half tmpvar_10 = 0;
float y_11; float y_11 = 0;
y_11 = (_mtl_u._Shininess * 128.0); y_11 = (_mtl_u._Shininess * 128.0);
tmpvar_10 = ((half)pow ((float)max ((half)0.0, dot (normal_7.xyz, tmpvar_10 = ((half)pow ((float)max ((half)0.0, dot (normal_7.xyz,
normalize((_mtl_i._uv2 + normalize(_mtl_i._uv1))) normalize((_mtl_i._uv2 + normalize(_mtl_i._uv1)))
@ -52,11 +52,11 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
max ((half)0.0, dot (normal_7.xyz, _mtl_i._uv2)) max ((half)0.0, dot (normal_7.xyz, _mtl_i._uv2))
) + ( ) + (
(_mtl_u._LightColor0.xyz * _mtl_u._SpecColor.xyz) (_mtl_u._LightColor0.xyz * _mtl_u._SpecColor.xyz)
* spec_9)) * (half)2.0); * spec_9)) * (half)(2.0));
c_8.w = (tmpvar_3 + ((_mtl_u._LightColor0.w * _mtl_u._SpecColor.w) * spec_9)); c_8.w = (tmpvar_3 + ((_mtl_u._LightColor0.w * _mtl_u._SpecColor.w) * spec_9));
c_1.xyz = (c_8.xyz + (tmpvar_2 * _mtl_i._uv3)); c_1.xyz = (c_8.xyz + (tmpvar_2 * _mtl_i._uv3));
c_1.w = tmpvar_3; c_1.w = tmpvar_3;
half4 tmpvar_12; half4 tmpvar_12 = 0;
tmpvar_12 = c_1; tmpvar_12 = c_1;
_mtl_o._fragData = tmpvar_12; _mtl_o._fragData = tmpvar_12;
return _mtl_o; return _mtl_o;

View File

@ -23,34 +23,34 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _ShadowMapTexture [[texture(1)]], sampler _mtlsmp__ShadowMapTexture [[sampler(1)]]) , texture2d<half> _ShadowMapTexture [[texture(1)]], sampler _mtlsmp__ShadowMapTexture [[sampler(1)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
float4 res_2; float4 res_2 = 0;
float depth_3; float depth_3 = 0;
half4 tmpvar_4; half4 tmpvar_4 = 0;
tmpvar_4 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_4 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.xlv_TEXCOORD0));
depth_3 = float(tmpvar_4.x); depth_3 = float(tmpvar_4.x);
float tmpvar_5; float tmpvar_5 = 0;
tmpvar_5 = (1.0/(((_mtl_u._ZBufferParams.x * depth_3) + _mtl_u._ZBufferParams.y))); tmpvar_5 = (1.0/(((_mtl_u._ZBufferParams.x * depth_3) + _mtl_u._ZBufferParams.y)));
depth_3 = tmpvar_5; depth_3 = tmpvar_5;
float4 tmpvar_6; float4 tmpvar_6 = 0;
tmpvar_6.w = 1.0; tmpvar_6.w = 1.0;
tmpvar_6.xyz = (_mtl_i.xlv_TEXCOORD1 * tmpvar_5); tmpvar_6.xyz = (_mtl_i.xlv_TEXCOORD1 * tmpvar_5);
half shadow_7; half shadow_7 = 0;
float4 weights_8; float4 weights_8 = 0;
float4 far_9; float4 far_9 = 0;
float4 near_10; float4 near_10 = 0;
bool4 tmpvar_11; bool4 tmpvar_11 = false;
tmpvar_11 = bool4((tmpvar_6.zzzz >= _mtl_u._LightSplitsNear)); tmpvar_11 = bool4((tmpvar_6.zzzz >= _mtl_u._LightSplitsNear));
half4 tmpvar_12; half4 tmpvar_12 = 0;
tmpvar_12 = half4(tmpvar_11); tmpvar_12 = half4(tmpvar_11);
near_10 = float4(tmpvar_12); near_10 = float4(tmpvar_12);
bool4 tmpvar_13; bool4 tmpvar_13 = false;
tmpvar_13 = bool4((tmpvar_6.zzzz < _mtl_u._LightSplitsFar)); tmpvar_13 = bool4((tmpvar_6.zzzz < _mtl_u._LightSplitsFar));
half4 tmpvar_14; half4 tmpvar_14 = 0;
tmpvar_14 = half4(tmpvar_13); tmpvar_14 = half4(tmpvar_13);
far_9 = float4(tmpvar_14); far_9 = float4(tmpvar_14);
weights_8 = (near_10 * far_9); weights_8 = (near_10 * far_9);
float4 tmpvar_15; float4 tmpvar_15 = 0;
tmpvar_15.w = 1.0; tmpvar_15.w = 1.0;
tmpvar_15.xyz = ((( tmpvar_15.xyz = (((
((_mtl_u._View2Shadow * tmpvar_6).xyz * weights_8.x) ((_mtl_u._View2Shadow * tmpvar_6).xyz * weights_8.x)
@ -59,10 +59,10 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
) + ( ) + (
(_mtl_u._View2Shadow2 * tmpvar_6) (_mtl_u._View2Shadow2 * tmpvar_6)
.xyz * weights_8.z)) + ((_mtl_u._View2Shadow3 * tmpvar_6).xyz * weights_8.w)); .xyz * weights_8.z)) + ((_mtl_u._View2Shadow3 * tmpvar_6).xyz * weights_8.w));
half4 tmpvar_16; half4 tmpvar_16 = 0;
tmpvar_16 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float2)(tmpvar_15.xy)); tmpvar_16 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float2)(tmpvar_15.xy));
float tmpvar_17; float tmpvar_17 = 0;
if (((float)tmpvar_16.x < tmpvar_15.z)) { if (((float)(tmpvar_16.x) < tmpvar_15.z)) {
tmpvar_17 = _mtl_u._LightShadowData.x; tmpvar_17 = _mtl_u._LightShadowData.x;
} else { } else {
tmpvar_17 = 1.0; tmpvar_17 = 1.0;
@ -70,9 +70,9 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
shadow_7 = half(tmpvar_17); shadow_7 = half(tmpvar_17);
res_2.x = float(shadow_7); res_2.x = float(shadow_7);
res_2.y = 1.0; res_2.y = 1.0;
float2 enc_18; float2 enc_18 = 0;
enc_18 = (float2(1.0, 255.0) * (1.0 - tmpvar_5)); enc_18 = (float2(1.0, 255.0) * (1.0 - tmpvar_5));
float2 tmpvar_19; float2 tmpvar_19 = 0;
tmpvar_19 = fract(enc_18); tmpvar_19 = fract(enc_18);
enc_18.y = tmpvar_19.y; enc_18.y = tmpvar_19.y;
enc_18.x = (tmpvar_19.x - (tmpvar_19.y * 0.00392157)); enc_18.x = (tmpvar_19.x - (tmpvar_19.y * 0.00392157));

View File

@ -14,119 +14,119 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float2 rcpFrame_1; float2 rcpFrame_1 = 0;
rcpFrame_1 = _mtl_u._MainTex_TexelSize.xy; rcpFrame_1 = _mtl_u._MainTex_TexelSize.xy;
half3 tmpvar_2; half3 tmpvar_2 = 0;
bool doneP_4; bool doneP_4 = false;
bool doneN_5; bool doneN_5 = false;
half lumaEndP_6; half lumaEndP_6 = 0;
half lumaEndN_7; half lumaEndN_7 = 0;
float2 offNP_8; float2 offNP_8 = 0;
float2 posP_9; float2 posP_9 = 0;
float2 posN_10; float2 posN_10 = 0;
half gradientN_11; half gradientN_11 = 0;
float lengthSign_12; float lengthSign_12 = 0;
half3 rgbL_13; half3 rgbL_13 = 0;
half lumaS_14; half lumaS_14 = 0;
half lumaN_15; half lumaN_15 = 0;
float4 tmpvar_16; float4 tmpvar_16 = 0;
tmpvar_16.zw = float2(0.0, 0.0); tmpvar_16.zw = float2(0.0, 0.0);
tmpvar_16.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(0.0, -1.0) * _mtl_u._MainTex_TexelSize.xy)); tmpvar_16.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(0.0, -1.0) * _mtl_u._MainTex_TexelSize.xy));
half4 tmpvar_17; half4 tmpvar_17 = 0;
tmpvar_17 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_16.xy), level(0.0)); tmpvar_17 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_16.xy), level(0.0));
float4 tmpvar_18; float4 tmpvar_18 = 0;
tmpvar_18.zw = float2(0.0, 0.0); tmpvar_18.zw = float2(0.0, 0.0);
tmpvar_18.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(-1.0, 0.0) * _mtl_u._MainTex_TexelSize.xy)); tmpvar_18.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(-1.0, 0.0) * _mtl_u._MainTex_TexelSize.xy));
half4 tmpvar_19; half4 tmpvar_19 = 0;
tmpvar_19 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_18.xy), level(0.0)); tmpvar_19 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_18.xy), level(0.0));
half4 tmpvar_20; half4 tmpvar_20 = 0;
tmpvar_20 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0)); tmpvar_20 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0));
float4 tmpvar_21; float4 tmpvar_21 = 0;
tmpvar_21.zw = float2(0.0, 0.0); tmpvar_21.zw = float2(0.0, 0.0);
tmpvar_21.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(1.0, 0.0) * _mtl_u._MainTex_TexelSize.xy)); tmpvar_21.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(1.0, 0.0) * _mtl_u._MainTex_TexelSize.xy));
half4 tmpvar_22; half4 tmpvar_22 = 0;
tmpvar_22 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_21.xy), level(0.0)); tmpvar_22 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_21.xy), level(0.0));
float4 tmpvar_23; float4 tmpvar_23 = 0;
tmpvar_23.zw = float2(0.0, 0.0); tmpvar_23.zw = float2(0.0, 0.0);
tmpvar_23.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(0.0, 1.0) * _mtl_u._MainTex_TexelSize.xy)); tmpvar_23.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(0.0, 1.0) * _mtl_u._MainTex_TexelSize.xy));
half4 tmpvar_24; half4 tmpvar_24 = 0;
tmpvar_24 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_23.xy), level(0.0)); tmpvar_24 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_23.xy), level(0.0));
half tmpvar_25; half tmpvar_25 = 0;
tmpvar_25 = ((tmpvar_17.y * (half)1.963211) + tmpvar_17.x); tmpvar_25 = ((tmpvar_17.y * (half)(1.963211)) + tmpvar_17.x);
lumaN_15 = tmpvar_25; lumaN_15 = tmpvar_25;
half tmpvar_26; half tmpvar_26 = 0;
tmpvar_26 = ((tmpvar_19.y * (half)1.963211) + tmpvar_19.x); tmpvar_26 = ((tmpvar_19.y * (half)(1.963211)) + tmpvar_19.x);
half tmpvar_27; half tmpvar_27 = 0;
tmpvar_27 = ((tmpvar_20.y * (half)1.963211) + tmpvar_20.x); tmpvar_27 = ((tmpvar_20.y * (half)(1.963211)) + tmpvar_20.x);
half tmpvar_28; half tmpvar_28 = 0;
tmpvar_28 = ((tmpvar_22.y * (half)1.963211) + tmpvar_22.x); tmpvar_28 = ((tmpvar_22.y * (half)(1.963211)) + tmpvar_22.x);
half tmpvar_29; half tmpvar_29 = 0;
tmpvar_29 = ((tmpvar_24.y * (half)1.963211) + tmpvar_24.x); tmpvar_29 = ((tmpvar_24.y * (half)(1.963211)) + tmpvar_24.x);
lumaS_14 = tmpvar_29; lumaS_14 = tmpvar_29;
half tmpvar_30; half tmpvar_30 = 0;
tmpvar_30 = max (max (tmpvar_27, tmpvar_25), max (max (tmpvar_26, tmpvar_29), tmpvar_28)); tmpvar_30 = max (max (tmpvar_27, tmpvar_25), max (max (tmpvar_26, tmpvar_29), tmpvar_28));
half tmpvar_31; half tmpvar_31 = 0;
tmpvar_31 = (tmpvar_30 - min (min (tmpvar_27, tmpvar_25), min ( tmpvar_31 = (tmpvar_30 - min (min (tmpvar_27, tmpvar_25), min (
min (tmpvar_26, tmpvar_29) min (tmpvar_26, tmpvar_29)
, tmpvar_28))); , tmpvar_28)));
half tmpvar_32; half tmpvar_32 = 0;
tmpvar_32 = max ((half)0.04166667, (tmpvar_30 * (half)0.125)); tmpvar_32 = max ((half)0.04166667, (tmpvar_30 * (half)(0.125)));
if ((tmpvar_31 < tmpvar_32)) { if ((tmpvar_31 < tmpvar_32)) {
tmpvar_2 = tmpvar_20.xyz; tmpvar_2 = tmpvar_20.xyz;
} else { } else {
half tmpvar_33; half tmpvar_33 = 0;
tmpvar_33 = min ((half)0.75, (max ((half)0.0, tmpvar_33 = min ((half)0.75, (max ((half)0.0,
((abs(( ((abs((
(((tmpvar_25 + tmpvar_26) + (tmpvar_28 + tmpvar_29)) * (half)0.25) (((tmpvar_25 + tmpvar_26) + (tmpvar_28 + tmpvar_29)) * (half)(0.25))
- tmpvar_27)) / tmpvar_31) - (half)0.25) - tmpvar_27)) / tmpvar_31) - (half)(0.25))
) * (half)1.333333)); ) * (half)(1.333333)));
float4 tmpvar_34; float4 tmpvar_34 = 0;
tmpvar_34.zw = float2(0.0, 0.0); tmpvar_34.zw = float2(0.0, 0.0);
tmpvar_34.xy = (_mtl_i.xlv_TEXCOORD0 - _mtl_u._MainTex_TexelSize.xy); tmpvar_34.xy = (_mtl_i.xlv_TEXCOORD0 - _mtl_u._MainTex_TexelSize.xy);
half4 tmpvar_35; half4 tmpvar_35 = 0;
tmpvar_35 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_34.xy), level(0.0)); tmpvar_35 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_34.xy), level(0.0));
float4 tmpvar_36; float4 tmpvar_36 = 0;
tmpvar_36.zw = float2(0.0, 0.0); tmpvar_36.zw = float2(0.0, 0.0);
tmpvar_36.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(1.0, -1.0) * _mtl_u._MainTex_TexelSize.xy)); tmpvar_36.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(1.0, -1.0) * _mtl_u._MainTex_TexelSize.xy));
half4 tmpvar_37; half4 tmpvar_37 = 0;
tmpvar_37 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_36.xy), level(0.0)); tmpvar_37 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_36.xy), level(0.0));
float4 tmpvar_38; float4 tmpvar_38 = 0;
tmpvar_38.zw = float2(0.0, 0.0); tmpvar_38.zw = float2(0.0, 0.0);
tmpvar_38.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(-1.0, 1.0) * _mtl_u._MainTex_TexelSize.xy)); tmpvar_38.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(-1.0, 1.0) * _mtl_u._MainTex_TexelSize.xy));
half4 tmpvar_39; half4 tmpvar_39 = 0;
tmpvar_39 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_38.xy), level(0.0)); tmpvar_39 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_38.xy), level(0.0));
float4 tmpvar_40; float4 tmpvar_40 = 0;
tmpvar_40.zw = float2(0.0, 0.0); tmpvar_40.zw = float2(0.0, 0.0);
tmpvar_40.xy = (_mtl_i.xlv_TEXCOORD0 + _mtl_u._MainTex_TexelSize.xy); tmpvar_40.xy = (_mtl_i.xlv_TEXCOORD0 + _mtl_u._MainTex_TexelSize.xy);
half4 tmpvar_41; half4 tmpvar_41 = 0;
tmpvar_41 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_40.xy), level(0.0)); tmpvar_41 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_40.xy), level(0.0));
rgbL_13 = (((tmpvar_17.xyz + tmpvar_19.xyz) + (tmpvar_20.xyz + tmpvar_22.xyz)) + ((tmpvar_24.xyz + tmpvar_35.xyz) + ( rgbL_13 = (((tmpvar_17.xyz + tmpvar_19.xyz) + (tmpvar_20.xyz + tmpvar_22.xyz)) + ((tmpvar_24.xyz + tmpvar_35.xyz) + (
(tmpvar_37.xyz + tmpvar_39.xyz) (tmpvar_37.xyz + tmpvar_39.xyz)
+ tmpvar_41.xyz))); + tmpvar_41.xyz)));
rgbL_13 = (rgbL_13 * (half3)float3(0.1111111, 0.1111111, 0.1111111)); rgbL_13 = (rgbL_13 * (half3)(float3(0.1111111, 0.1111111, 0.1111111)));
half tmpvar_42; half tmpvar_42 = 0;
tmpvar_42 = ((tmpvar_35.y * (half)1.963211) + tmpvar_35.x); tmpvar_42 = ((tmpvar_35.y * (half)(1.963211)) + tmpvar_35.x);
half tmpvar_43; half tmpvar_43 = 0;
tmpvar_43 = ((tmpvar_37.y * (half)1.963211) + tmpvar_37.x); tmpvar_43 = ((tmpvar_37.y * (half)(1.963211)) + tmpvar_37.x);
half tmpvar_44; half tmpvar_44 = 0;
tmpvar_44 = ((tmpvar_39.y * (half)1.963211) + tmpvar_39.x); tmpvar_44 = ((tmpvar_39.y * (half)(1.963211)) + tmpvar_39.x);
half tmpvar_45; half tmpvar_45 = 0;
tmpvar_45 = ((tmpvar_41.y * (half)1.963211) + tmpvar_41.x); tmpvar_45 = ((tmpvar_41.y * (half)(1.963211)) + tmpvar_41.x);
bool tmpvar_46; bool tmpvar_46 = false;
tmpvar_46 = ((( tmpvar_46 = (((
abs(((((half)0.25 * tmpvar_42) + ((half)-0.5 * tmpvar_26)) + ((half)0.25 * tmpvar_44))) abs(((((half)(0.25) * tmpvar_42) + ((half)(-0.5) * tmpvar_26)) + ((half)(0.25) * tmpvar_44)))
+ +
abs(((((half)0.5 * tmpvar_25) - tmpvar_27) + ((half)0.5 * tmpvar_29))) abs(((((half)(0.5) * tmpvar_25) - tmpvar_27) + ((half)(0.5) * tmpvar_29)))
) + abs( ) + abs(
((((half)0.25 * tmpvar_43) + ((half)-0.5 * tmpvar_28)) + ((half)0.25 * tmpvar_45)) ((((half)(0.25) * tmpvar_43) + ((half)(-0.5) * tmpvar_28)) + ((half)(0.25) * tmpvar_45))
)) >= (( )) >= ((
abs(((((half)0.25 * tmpvar_42) + ((half)-0.5 * tmpvar_25)) + ((half)0.25 * tmpvar_43))) abs(((((half)(0.25) * tmpvar_42) + ((half)(-0.5) * tmpvar_25)) + ((half)(0.25) * tmpvar_43)))
+ +
abs(((((half)0.5 * tmpvar_26) - tmpvar_27) + ((half)0.5 * tmpvar_28))) abs(((((half)(0.5) * tmpvar_26) - tmpvar_27) + ((half)(0.5) * tmpvar_28)))
) + abs( ) + abs(
((((half)0.25 * tmpvar_44) + ((half)-0.5 * tmpvar_29)) + ((half)0.25 * tmpvar_45)) ((((half)(0.25) * tmpvar_44) + ((half)(-0.5) * tmpvar_29)) + ((half)(0.25) * tmpvar_45))
))); )));
float tmpvar_47; float tmpvar_47 = 0;
if (tmpvar_46) { if (tmpvar_46) {
tmpvar_47 = -(_mtl_u._MainTex_TexelSize.y); tmpvar_47 = -(_mtl_u._MainTex_TexelSize.y);
} else { } else {
@ -139,14 +139,14 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
if (!(tmpvar_46)) { if (!(tmpvar_46)) {
lumaS_14 = tmpvar_28; lumaS_14 = tmpvar_28;
}; };
half tmpvar_48; half tmpvar_48 = 0;
tmpvar_48 = abs((lumaN_15 - tmpvar_27)); tmpvar_48 = abs((lumaN_15 - tmpvar_27));
gradientN_11 = tmpvar_48; gradientN_11 = tmpvar_48;
half tmpvar_49; half tmpvar_49 = 0;
tmpvar_49 = abs((lumaS_14 - tmpvar_27)); tmpvar_49 = abs((lumaS_14 - tmpvar_27));
lumaN_15 = ((lumaN_15 + tmpvar_27) * (half)0.5); lumaN_15 = ((lumaN_15 + tmpvar_27) * (half)(0.5));
lumaS_14 = ((lumaS_14 + tmpvar_27) * (half)0.5); lumaS_14 = ((lumaS_14 + tmpvar_27) * (half)(0.5));
bool tmpvar_50; bool tmpvar_50 = false;
tmpvar_50 = (tmpvar_48 >= tmpvar_49); tmpvar_50 = (tmpvar_48 >= tmpvar_49);
if (!(tmpvar_50)) { if (!(tmpvar_50)) {
lumaN_15 = lumaS_14; lumaN_15 = lumaS_14;
@ -157,30 +157,30 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
if (!(tmpvar_50)) { if (!(tmpvar_50)) {
lengthSign_12 = -(tmpvar_47); lengthSign_12 = -(tmpvar_47);
}; };
float tmpvar_51; float tmpvar_51 = 0;
if (tmpvar_46) { if (tmpvar_46) {
tmpvar_51 = 0.0; tmpvar_51 = 0.0;
} else { } else {
tmpvar_51 = (lengthSign_12 * 0.5); tmpvar_51 = (lengthSign_12 * 0.5);
}; };
posN_10.x = (_mtl_i.xlv_TEXCOORD0.x + tmpvar_51); posN_10.x = (_mtl_i.xlv_TEXCOORD0.x + tmpvar_51);
float tmpvar_52; float tmpvar_52 = 0;
if (tmpvar_46) { if (tmpvar_46) {
tmpvar_52 = (lengthSign_12 * 0.5); tmpvar_52 = (lengthSign_12 * 0.5);
} else { } else {
tmpvar_52 = 0.0; tmpvar_52 = 0.0;
}; };
posN_10.y = (_mtl_i.xlv_TEXCOORD0.y + tmpvar_52); posN_10.y = (_mtl_i.xlv_TEXCOORD0.y + tmpvar_52);
gradientN_11 = (gradientN_11 * (half)0.25); gradientN_11 = (gradientN_11 * (half)(0.25));
posP_9 = posN_10; posP_9 = posN_10;
float2 tmpvar_53; float2 tmpvar_53 = 0;
if (tmpvar_46) { if (tmpvar_46) {
float2 tmpvar_54; float2 tmpvar_54 = 0;
tmpvar_54.y = 0.0; tmpvar_54.y = 0.0;
tmpvar_54.x = rcpFrame_1.x; tmpvar_54.x = rcpFrame_1.x;
tmpvar_53 = tmpvar_54; tmpvar_53 = tmpvar_54;
} else { } else {
float2 tmpvar_55; float2 tmpvar_55 = 0;
tmpvar_55.x = 0.0; tmpvar_55.x = 0.0;
tmpvar_55.y = rcpFrame_1.y; tmpvar_55.y = rcpFrame_1.y;
tmpvar_53 = tmpvar_55; tmpvar_53 = tmpvar_55;
@ -194,23 +194,23 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
posP_9 = (posP_9 + tmpvar_53); posP_9 = (posP_9 + tmpvar_53);
for (int i_3 = 0; i_3 < 16; i_3++) { for (int i_3 = 0; i_3 < 16; i_3++) {
if (!(doneN_5)) { if (!(doneN_5)) {
half4 tmpvar_56; half4 tmpvar_56 = 0;
tmpvar_56 = _MainTex.sample(_mtlsmp__MainTex, (float2)(posN_10), level(0.0)); tmpvar_56 = _MainTex.sample(_mtlsmp__MainTex, (float2)(posN_10), level(0.0));
lumaEndN_7 = ((tmpvar_56.y * (half)1.963211) + tmpvar_56.x); lumaEndN_7 = ((tmpvar_56.y * (half)(1.963211)) + tmpvar_56.x);
}; };
if (!(doneP_4)) { if (!(doneP_4)) {
half4 tmpvar_57; half4 tmpvar_57 = 0;
tmpvar_57 = _MainTex.sample(_mtlsmp__MainTex, (float2)(posP_9), level(0.0)); tmpvar_57 = _MainTex.sample(_mtlsmp__MainTex, (float2)(posP_9), level(0.0));
lumaEndP_6 = ((tmpvar_57.y * (half)1.963211) + tmpvar_57.x); lumaEndP_6 = ((tmpvar_57.y * (half)(1.963211)) + tmpvar_57.x);
}; };
bool tmpvar_58; bool tmpvar_58 = false;
if (doneN_5) { if (doneN_5) {
tmpvar_58 = bool(bool(1)); tmpvar_58 = bool(bool(1));
} else { } else {
tmpvar_58 = (abs((lumaEndN_7 - lumaN_15)) >= gradientN_11); tmpvar_58 = (abs((lumaEndN_7 - lumaN_15)) >= gradientN_11);
}; };
doneN_5 = tmpvar_58; doneN_5 = tmpvar_58;
bool tmpvar_59; bool tmpvar_59 = false;
if (doneP_4) { if (doneP_4) {
tmpvar_59 = bool(bool(1)); tmpvar_59 = bool(bool(1));
} else { } else {
@ -227,66 +227,66 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
posP_9 = (posP_9 + offNP_8); posP_9 = (posP_9 + offNP_8);
}; };
}; };
float tmpvar_60; float tmpvar_60 = 0;
if (tmpvar_46) { if (tmpvar_46) {
tmpvar_60 = (_mtl_i.xlv_TEXCOORD0.x - posN_10.x); tmpvar_60 = (_mtl_i.xlv_TEXCOORD0.x - posN_10.x);
} else { } else {
tmpvar_60 = (_mtl_i.xlv_TEXCOORD0.y - posN_10.y); tmpvar_60 = (_mtl_i.xlv_TEXCOORD0.y - posN_10.y);
}; };
float tmpvar_61; float tmpvar_61 = 0;
if (tmpvar_46) { if (tmpvar_46) {
tmpvar_61 = (posP_9.x - _mtl_i.xlv_TEXCOORD0.x); tmpvar_61 = (posP_9.x - _mtl_i.xlv_TEXCOORD0.x);
} else { } else {
tmpvar_61 = (posP_9.y - _mtl_i.xlv_TEXCOORD0.y); tmpvar_61 = (posP_9.y - _mtl_i.xlv_TEXCOORD0.y);
}; };
bool tmpvar_62; bool tmpvar_62 = false;
tmpvar_62 = (tmpvar_60 < tmpvar_61); tmpvar_62 = (tmpvar_60 < tmpvar_61);
half tmpvar_63; half tmpvar_63 = 0;
if (tmpvar_62) { if (tmpvar_62) {
tmpvar_63 = lumaEndN_7; tmpvar_63 = lumaEndN_7;
} else { } else {
tmpvar_63 = lumaEndP_6; tmpvar_63 = lumaEndP_6;
}; };
lumaEndN_7 = tmpvar_63; lumaEndN_7 = tmpvar_63;
if ((((tmpvar_27 - lumaN_15) < (half)0.0) == ((tmpvar_63 - lumaN_15) < (half)0.0))) { if ((((tmpvar_27 - lumaN_15) < (half)(0.0)) == ((tmpvar_63 - lumaN_15) < (half)(0.0)))) {
lengthSign_12 = 0.0; lengthSign_12 = 0.0;
}; };
float tmpvar_64; float tmpvar_64 = 0;
tmpvar_64 = (tmpvar_61 + tmpvar_60); tmpvar_64 = (tmpvar_61 + tmpvar_60);
float tmpvar_65; float tmpvar_65 = 0;
if (tmpvar_62) { if (tmpvar_62) {
tmpvar_65 = tmpvar_60; tmpvar_65 = tmpvar_60;
} else { } else {
tmpvar_65 = tmpvar_61; tmpvar_65 = tmpvar_61;
}; };
float tmpvar_66; float tmpvar_66 = 0;
tmpvar_66 = ((0.5 + (tmpvar_65 * tmpvar_66 = ((0.5 + (tmpvar_65 *
(-1.0 / tmpvar_64) (-1.0 / tmpvar_64)
)) * lengthSign_12); )) * lengthSign_12);
float tmpvar_67; float tmpvar_67 = 0;
if (tmpvar_46) { if (tmpvar_46) {
tmpvar_67 = 0.0; tmpvar_67 = 0.0;
} else { } else {
tmpvar_67 = tmpvar_66; tmpvar_67 = tmpvar_66;
}; };
float tmpvar_68; float tmpvar_68 = 0;
if (tmpvar_46) { if (tmpvar_46) {
tmpvar_68 = tmpvar_66; tmpvar_68 = tmpvar_66;
} else { } else {
tmpvar_68 = 0.0; tmpvar_68 = 0.0;
}; };
float2 tmpvar_69; float2 tmpvar_69 = 0;
tmpvar_69.x = (_mtl_i.xlv_TEXCOORD0.x + tmpvar_67); tmpvar_69.x = (_mtl_i.xlv_TEXCOORD0.x + tmpvar_67);
tmpvar_69.y = (_mtl_i.xlv_TEXCOORD0.y + tmpvar_68); tmpvar_69.y = (_mtl_i.xlv_TEXCOORD0.y + tmpvar_68);
half4 tmpvar_70; half4 tmpvar_70 = 0;
tmpvar_70 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_69), level(0.0)); tmpvar_70 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_69), level(0.0));
half3 tmpvar_71; half3 tmpvar_71 = 0;
tmpvar_71.x = -(tmpvar_33); tmpvar_71.x = -(tmpvar_33);
tmpvar_71.y = -(tmpvar_33); tmpvar_71.y = -(tmpvar_33);
tmpvar_71.z = -(tmpvar_33); tmpvar_71.z = -(tmpvar_33);
tmpvar_2 = ((tmpvar_71 * tmpvar_70.xyz) + ((rgbL_13 * half3(tmpvar_33)) + tmpvar_70.xyz)); tmpvar_2 = ((tmpvar_71 * tmpvar_70.xyz) + ((rgbL_13 * half3(tmpvar_33)) + tmpvar_70.xyz));
}; };
half4 tmpvar_72; half4 tmpvar_72 = 0;
tmpvar_72.w = half(0.0); tmpvar_72.w = half(0.0);
tmpvar_72.xyz = tmpvar_2; tmpvar_72.xyz = tmpvar_2;
_mtl_o._fragData = tmpvar_72; _mtl_o._fragData = tmpvar_72;

View File

@ -28,138 +28,138 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texturecube<half> _ShadowMapTexture [[texture(4)]], sampler _mtlsmp__ShadowMapTexture [[sampler(4)]]) , texturecube<half> _ShadowMapTexture [[texture(4)]], sampler _mtlsmp__ShadowMapTexture [[sampler(4)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 res_1; half4 res_1 = 0;
float spec_2; float spec_2 = 0;
half3 h_3; half3 h_3 = 0;
float atten_4; float atten_4 = 0;
half3 lightDir_5; half3 lightDir_5 = 0;
float3 tolight_6; float3 tolight_6 = 0;
float3 wpos_7; float3 wpos_7 = 0;
float depth_8; float depth_8 = 0;
half3 normal_9; half3 normal_9 = 0;
half4 nspec_10; half4 nspec_10 = 0;
float2 uv_11; float2 uv_11 = 0;
uv_11 = (_mtl_i.xlv_TEXCOORD0.xy / _mtl_i.xlv_TEXCOORD0.w); uv_11 = (_mtl_i.xlv_TEXCOORD0.xy / _mtl_i.xlv_TEXCOORD0.w);
half4 tmpvar_12; half4 tmpvar_12 = 0;
tmpvar_12 = _CameraNormalsTexture.sample(_mtlsmp__CameraNormalsTexture, (float2)(uv_11)); tmpvar_12 = _CameraNormalsTexture.sample(_mtlsmp__CameraNormalsTexture, (float2)(uv_11));
nspec_10 = tmpvar_12; nspec_10 = tmpvar_12;
normal_9 = ((nspec_10.xyz * (half)2.0) - (half)1.0); normal_9 = ((nspec_10.xyz * (half)(2.0)) - (half)(1.0));
normal_9 = normalize(normal_9); normal_9 = normalize(normal_9);
half4 tmpvar_13; half4 tmpvar_13 = 0;
tmpvar_13 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(uv_11)); tmpvar_13 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(uv_11));
depth_8 = float(tmpvar_13.x); depth_8 = float(tmpvar_13.x);
float tmpvar_14; float tmpvar_14 = 0;
tmpvar_14 = (1.0/(((_mtl_u._ZBufferParams.x * depth_8) + _mtl_u._ZBufferParams.y))); tmpvar_14 = (1.0/(((_mtl_u._ZBufferParams.x * depth_8) + _mtl_u._ZBufferParams.y)));
depth_8 = tmpvar_14; depth_8 = tmpvar_14;
float4 tmpvar_15; float4 tmpvar_15 = 0;
tmpvar_15.w = 1.0; tmpvar_15.w = 1.0;
tmpvar_15.xyz = ((_mtl_i.xlv_TEXCOORD1 * (_mtl_u._ProjectionParams.z / _mtl_i.xlv_TEXCOORD1.z)) * tmpvar_14); tmpvar_15.xyz = ((_mtl_i.xlv_TEXCOORD1 * (_mtl_u._ProjectionParams.z / _mtl_i.xlv_TEXCOORD1.z)) * tmpvar_14);
wpos_7 = (_mtl_u._CameraToWorld * tmpvar_15).xyz; wpos_7 = (_mtl_u._CameraToWorld * tmpvar_15).xyz;
tolight_6 = (wpos_7 - _mtl_u._LightPos.xyz); tolight_6 = (wpos_7 - _mtl_u._LightPos.xyz);
float3 tmpvar_16; float3 tmpvar_16 = 0;
tmpvar_16 = normalize(tolight_6); tmpvar_16 = normalize(tolight_6);
lightDir_5 = half3(-(tmpvar_16)); lightDir_5 = half3(-(tmpvar_16));
float2 tmpvar_17; float2 tmpvar_17 = 0;
tmpvar_17 = float2((dot (tolight_6, tolight_6) * _mtl_u._LightPos.w)); tmpvar_17 = float2((dot (tolight_6, tolight_6) * _mtl_u._LightPos.w));
half4 tmpvar_18; half4 tmpvar_18 = 0;
tmpvar_18 = _LightTextureB0.sample(_mtlsmp__LightTextureB0, (float2)(tmpvar_17)); tmpvar_18 = _LightTextureB0.sample(_mtlsmp__LightTextureB0, (float2)(tmpvar_17));
atten_4 = float(tmpvar_18.w); atten_4 = float(tmpvar_18.w);
float mydist_19; float mydist_19 = 0;
mydist_19 = (sqrt(dot (tolight_6, tolight_6)) * _mtl_u._LightPositionRange.w); mydist_19 = (sqrt(dot (tolight_6, tolight_6)) * _mtl_u._LightPositionRange.w);
mydist_19 = (mydist_19 * 0.97); mydist_19 = (mydist_19 * 0.97);
float4 shadowVals_20; float4 shadowVals_20 = 0;
float3 vec_21; float3 vec_21 = 0;
vec_21 = (tolight_6 + float3(0.0078125, 0.0078125, 0.0078125)); vec_21 = (tolight_6 + float3(0.0078125, 0.0078125, 0.0078125));
float4 packDist_22; float4 packDist_22 = 0;
half4 tmpvar_23; half4 tmpvar_23 = 0;
tmpvar_23 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_21)); tmpvar_23 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_21));
packDist_22 = float4(tmpvar_23); packDist_22 = float4(tmpvar_23);
shadowVals_20.x = dot (packDist_22, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09)); shadowVals_20.x = dot (packDist_22, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
float3 vec_24; float3 vec_24 = 0;
vec_24 = (tolight_6 + float3(-0.0078125, -0.0078125, 0.0078125)); vec_24 = (tolight_6 + float3(-0.0078125, -0.0078125, 0.0078125));
float4 packDist_25; float4 packDist_25 = 0;
half4 tmpvar_26; half4 tmpvar_26 = 0;
tmpvar_26 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_24)); tmpvar_26 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_24));
packDist_25 = float4(tmpvar_26); packDist_25 = float4(tmpvar_26);
shadowVals_20.y = dot (packDist_25, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09)); shadowVals_20.y = dot (packDist_25, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
float3 vec_27; float3 vec_27 = 0;
vec_27 = (tolight_6 + float3(-0.0078125, 0.0078125, -0.0078125)); vec_27 = (tolight_6 + float3(-0.0078125, 0.0078125, -0.0078125));
float4 packDist_28; float4 packDist_28 = 0;
half4 tmpvar_29; half4 tmpvar_29 = 0;
tmpvar_29 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_27)); tmpvar_29 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_27));
packDist_28 = float4(tmpvar_29); packDist_28 = float4(tmpvar_29);
shadowVals_20.z = dot (packDist_28, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09)); shadowVals_20.z = dot (packDist_28, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
float3 vec_30; float3 vec_30 = 0;
vec_30 = (tolight_6 + float3(0.0078125, -0.0078125, -0.0078125)); vec_30 = (tolight_6 + float3(0.0078125, -0.0078125, -0.0078125));
float4 packDist_31; float4 packDist_31 = 0;
half4 tmpvar_32; half4 tmpvar_32 = 0;
tmpvar_32 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_30)); tmpvar_32 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_30));
packDist_31 = float4(tmpvar_32); packDist_31 = float4(tmpvar_32);
shadowVals_20.w = dot (packDist_31, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09)); shadowVals_20.w = dot (packDist_31, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
bool4 tmpvar_33; bool4 tmpvar_33 = false;
tmpvar_33 = bool4((shadowVals_20 < float4(mydist_19))); tmpvar_33 = bool4((shadowVals_20 < float4(mydist_19)));
float4 tmpvar_34; float4 tmpvar_34 = 0;
tmpvar_34 = _mtl_u._LightShadowData.xxxx; tmpvar_34 = _mtl_u._LightShadowData.xxxx;
float tmpvar_35; float tmpvar_35 = 0;
if (tmpvar_33.x) { if (tmpvar_33.x) {
tmpvar_35 = tmpvar_34.x; tmpvar_35 = tmpvar_34.x;
} else { } else {
tmpvar_35 = 1.0; tmpvar_35 = 1.0;
}; };
float tmpvar_36; float tmpvar_36 = 0;
if (tmpvar_33.y) { if (tmpvar_33.y) {
tmpvar_36 = tmpvar_34.y; tmpvar_36 = tmpvar_34.y;
} else { } else {
tmpvar_36 = 1.0; tmpvar_36 = 1.0;
}; };
float tmpvar_37; float tmpvar_37 = 0;
if (tmpvar_33.z) { if (tmpvar_33.z) {
tmpvar_37 = tmpvar_34.z; tmpvar_37 = tmpvar_34.z;
} else { } else {
tmpvar_37 = 1.0; tmpvar_37 = 1.0;
}; };
float tmpvar_38; float tmpvar_38 = 0;
if (tmpvar_33.w) { if (tmpvar_33.w) {
tmpvar_38 = tmpvar_34.w; tmpvar_38 = tmpvar_34.w;
} else { } else {
tmpvar_38 = 1.0; tmpvar_38 = 1.0;
}; };
half4 tmpvar_39; half4 tmpvar_39 = 0;
tmpvar_39.x = half(tmpvar_35); tmpvar_39.x = half(tmpvar_35);
tmpvar_39.y = half(tmpvar_36); tmpvar_39.y = half(tmpvar_36);
tmpvar_39.z = half(tmpvar_37); tmpvar_39.z = half(tmpvar_37);
tmpvar_39.w = half(tmpvar_38); tmpvar_39.w = half(tmpvar_38);
half tmpvar_40; half tmpvar_40 = 0;
tmpvar_40 = dot (tmpvar_39, (half4)float4(0.25, 0.25, 0.25, 0.25)); tmpvar_40 = dot (tmpvar_39, (half4)float4(0.25, 0.25, 0.25, 0.25));
atten_4 = (atten_4 * (float)tmpvar_40); atten_4 = (atten_4 * (float)(tmpvar_40));
float4 tmpvar_41; float4 tmpvar_41 = 0;
tmpvar_41.w = 1.0; tmpvar_41.w = 1.0;
tmpvar_41.xyz = wpos_7; tmpvar_41.xyz = wpos_7;
half4 tmpvar_42; half4 tmpvar_42 = 0;
float3 P_43; float3 P_43 = 0;
P_43 = (_mtl_u._LightMatrix0 * tmpvar_41).xyz; P_43 = (_mtl_u._LightMatrix0 * tmpvar_41).xyz;
tmpvar_42 = _LightTexture0.sample(_mtlsmp__LightTexture0, (float3)(P_43)); tmpvar_42 = _LightTexture0.sample(_mtlsmp__LightTexture0, (float3)(P_43));
atten_4 = (atten_4 * (float)tmpvar_42.w); atten_4 = (atten_4 * (float)(tmpvar_42.w));
float3 tmpvar_44; float3 tmpvar_44 = 0;
tmpvar_44 = normalize(((float3)lightDir_5 - normalize( tmpvar_44 = normalize(((float3)(lightDir_5) - normalize(
(wpos_7 - _mtl_u._WorldSpaceCameraPos) (wpos_7 - _mtl_u._WorldSpaceCameraPos)
))); )));
h_3 = half3(tmpvar_44); h_3 = half3(tmpvar_44);
half tmpvar_45; half tmpvar_45 = 0;
tmpvar_45 = pow (max ((half)0.0, dot (h_3, normal_9)), (nspec_10.w * (half)128.0)); tmpvar_45 = pow (max ((half)0.0, dot (h_3, normal_9)), (nspec_10.w * (half)(128.0)));
spec_2 = float(tmpvar_45); spec_2 = float(tmpvar_45);
spec_2 = (spec_2 * clamp (atten_4, 0.0, 1.0)); spec_2 = (spec_2 * clamp (atten_4, 0.0, 1.0));
res_1.xyz = half3((_mtl_u._LightColor.xyz * ((float)max ((half)0.0, res_1.xyz = half3((_mtl_u._LightColor.xyz * ((float)(max ((half)0.0,
dot (lightDir_5, normal_9) dot (lightDir_5, normal_9)
) * atten_4))); )) * atten_4)));
half3 c_46; half3 c_46 = 0;
c_46 = half3(_mtl_u._LightColor.xyz); c_46 = half3(_mtl_u._LightColor.xyz);
res_1.w = half((spec_2 * (float)dot (c_46, (half3)float3(0.22, 0.707, 0.071)))); res_1.w = half((spec_2 * (float)(dot (c_46, (half3)float3(0.22, 0.707, 0.071)))));
float tmpvar_47; float tmpvar_47 = 0;
tmpvar_47 = clamp ((1.0 - ( tmpvar_47 = clamp ((1.0 - (
(tmpvar_15.z * _mtl_u.unity_LightmapFade.z) (tmpvar_15.z * _mtl_u.unity_LightmapFade.z)
+ _mtl_u.unity_LightmapFade.w)), 0.0, 1.0); + _mtl_u.unity_LightmapFade.w)), 0.0, 1.0);
res_1 = ((half4)((float4)res_1 * tmpvar_47)); res_1 = ((half4)((float4)(res_1) * tmpvar_47));
_mtl_o._fragData = exp2(-(res_1)); _mtl_o._fragData = exp2(-(res_1));
return _mtl_o; return _mtl_o;
} }

View File

@ -15,26 +15,26 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _Curve [[texture(1)]], sampler _mtlsmp__Curve [[sampler(1)]]) , texture2d<half> _Curve [[texture(1)]], sampler _mtlsmp__Curve [[sampler(1)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float newLum_1; float newLum_1 = 0;
float3 cie_2; float3 cie_2 = 0;
float4 color_3; float4 color_3 = 0;
half4 tmpvar_4; half4 tmpvar_4 = 0;
tmpvar_4 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_4 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0));
color_3 = float4(tmpvar_4); color_3 = float4(tmpvar_4);
float3 Yxy_5; float3 Yxy_5 = 0;
float3 tmpvar_6; float3 tmpvar_6 = 0;
tmpvar_6 = (float3x3(float3(0.514136, 0.265068, 0.0241188), float3(0.323879, 0.670234, 0.122818), float3(0.160364, 0.0640916, 0.844427)) * color_3.xyz); tmpvar_6 = (float3x3(float3(0.514136, 0.265068, 0.0241188), float3(0.323879, 0.670234, 0.122818), float3(0.160364, 0.0640916, 0.844427)) * color_3.xyz);
Yxy_5.x = tmpvar_6.y; Yxy_5.x = tmpvar_6.y;
Yxy_5.yz = (tmpvar_6.xy / dot (float3(1.0, 1.0, 1.0), tmpvar_6)); Yxy_5.yz = (tmpvar_6.xy / dot (float3(1.0, 1.0, 1.0), tmpvar_6));
cie_2.yz = Yxy_5.yz; cie_2.yz = Yxy_5.yz;
float2 tmpvar_7; float2 tmpvar_7 = 0;
tmpvar_7.y = 0.5; tmpvar_7.y = 0.5;
tmpvar_7.x = (tmpvar_6.y * _mtl_u._RangeScale); tmpvar_7.x = (tmpvar_6.y * _mtl_u._RangeScale);
half tmpvar_8; half tmpvar_8 = 0;
tmpvar_8 = _Curve.sample(_mtlsmp__Curve, (float2)(tmpvar_7)).x; tmpvar_8 = _Curve.sample(_mtlsmp__Curve, (float2)(tmpvar_7)).x;
newLum_1 = float(tmpvar_8); newLum_1 = float(tmpvar_8);
cie_2.x = newLum_1; cie_2.x = newLum_1;
float3 XYZ_9; float3 XYZ_9 = 0;
XYZ_9.x = ((newLum_1 * Yxy_5.y) / Yxy_5.z); XYZ_9.x = ((newLum_1 * Yxy_5.y) / Yxy_5.z);
XYZ_9.y = cie_2.x; XYZ_9.y = cie_2.x;
XYZ_9.z = ((newLum_1 * ( XYZ_9.z = ((newLum_1 * (

View File

@ -24,31 +24,31 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _TranslucencyMap [[texture(2)]], sampler _mtlsmp__TranslucencyMap [[sampler(2)]]) , texture2d<half> _TranslucencyMap [[texture(2)]], sampler _mtlsmp__TranslucencyMap [[sampler(2)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half nh_2; half nh_2 = 0;
half nl_3; half nl_3 = 0;
half3 lightColor_4; half3 lightColor_4 = 0;
half3 backContribs_5; half3 backContribs_5 = 0;
half3 light_6; half3 light_6 = 0;
half gloss_7; half gloss_7 = 0;
half specular_8; half specular_8 = 0;
half3 albedo_9; half3 albedo_9 = 0;
half4 tmpvar_10; half4 tmpvar_10 = 0;
tmpvar_10 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_10 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0));
half x_11; half x_11 = 0;
x_11 = (tmpvar_10.w - _mtl_u._Cutoff); x_11 = (tmpvar_10.w - _mtl_u._Cutoff);
if ((x_11 < (half)0.0)) { if ((x_11 < (half)(0.0))) {
discard_fragment(); discard_fragment();
}; };
albedo_9 = half3(((float3)tmpvar_10.xyz * _mtl_i.xlv_TEXCOORD1)); albedo_9 = half3(((float3)(tmpvar_10.xyz) * _mtl_i.xlv_TEXCOORD1));
half4 tmpvar_12; half4 tmpvar_12 = 0;
tmpvar_12 = _BumpSpecMap.sample(_mtlsmp__BumpSpecMap, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_12 = _BumpSpecMap.sample(_mtlsmp__BumpSpecMap, (float2)(_mtl_i.xlv_TEXCOORD0));
specular_8 = (tmpvar_12.x * (half)128.0); specular_8 = (tmpvar_12.x * (half)(128.0));
half4 tmpvar_13; half4 tmpvar_13 = 0;
tmpvar_13 = _TranslucencyMap.sample(_mtlsmp__TranslucencyMap, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_13 = _TranslucencyMap.sample(_mtlsmp__TranslucencyMap, (float2)(_mtl_i.xlv_TEXCOORD0));
gloss_7 = tmpvar_13.w; gloss_7 = tmpvar_13.w;
light_6 = (_mtl_u.UNITY_LIGHTMODEL_AMBIENT.xyz * albedo_9); light_6 = (_mtl_u.UNITY_LIGHTMODEL_AMBIENT.xyz * albedo_9);
backContribs_5 = half3((_mtl_i.xlv_TEXCOORD2 * (float)tmpvar_13.z)); backContribs_5 = half3((_mtl_i.xlv_TEXCOORD2 * (float)(tmpvar_13.z)));
lightColor_4 = half3(_mtl_u._TerrainTreeLightColors[0].xyz); lightColor_4 = half3(_mtl_u._TerrainTreeLightColors[0].xyz);
nl_3 = half(_mtl_i.xlv_TEXCOORD3.x); nl_3 = half(_mtl_i.xlv_TEXCOORD3.x);
nh_2 = half(_mtl_i.xlv_TEXCOORD4.x); nh_2 = half(_mtl_i.xlv_TEXCOORD4.x);
@ -73,7 +73,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
+ +
(_mtl_u._SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7)) (_mtl_u._SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7))
) * lightColor_4)); ) * lightColor_4));
c_1.xyz = (light_6 * (half)2.0); c_1.xyz = (light_6 * (half)(2.0));
c_1.w = half(1.0); c_1.w = half(1.0);
_mtl_o._fragData = c_1; _mtl_o._fragData = c_1;
return _mtl_o; return _mtl_o;

View File

@ -35,10 +35,10 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _SelfIllum [[texture(11)]], sampler _mtlsmp__SelfIllum [[sampler(11)]]) , texture2d<half> _SelfIllum [[texture(11)]], sampler _mtlsmp__SelfIllum [[sampler(11)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half3 lightDir_1; half3 lightDir_1 = 0;
half3 env_2; half3 env_2 = 0;
float3 tmpvar_3; float3 tmpvar_3 = 0;
float3 tmpvar_4; float3 tmpvar_4 = 0;
tmpvar_3 = _mtl_i.xlv_TEXCOORD3.xyz; tmpvar_3 = _mtl_i.xlv_TEXCOORD3.xyz;
tmpvar_4 = (((_mtl_i.xlv_TEXCOORD2.yzx * _mtl_i.xlv_TEXCOORD3.zxy) - (_mtl_i.xlv_TEXCOORD2.zxy * _mtl_i.xlv_TEXCOORD3.yzx)) * _mtl_i.xlv_TEXCOORD3.www); tmpvar_4 = (((_mtl_i.xlv_TEXCOORD2.yzx * _mtl_i.xlv_TEXCOORD3.zxy) - (_mtl_i.xlv_TEXCOORD2.zxy * _mtl_i.xlv_TEXCOORD3.yzx)) * _mtl_i.xlv_TEXCOORD3.www);
float3x3 tmpvar_5; float3x3 tmpvar_5;
@ -51,51 +51,51 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
tmpvar_5[2].x = tmpvar_3.z; tmpvar_5[2].x = tmpvar_3.z;
tmpvar_5[2].y = tmpvar_4.z; tmpvar_5[2].y = tmpvar_4.z;
tmpvar_5[2].z = _mtl_i.xlv_TEXCOORD2.z; tmpvar_5[2].z = _mtl_i.xlv_TEXCOORD2.z;
half3 normal_6; half3 normal_6 = 0;
normal_6.xy = ((_BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).wy * (half)2.0) - (half)1.0); normal_6.xy = ((_BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).wy * (half)(2.0)) - (half)(1.0));
normal_6.xy = ((half2)((float2)normal_6.xy * _mtl_u._BumpScale)); normal_6.xy = ((half2)((float2)(normal_6.xy) * _mtl_u._BumpScale));
normal_6.z = sqrt(((half)1.0 - clamp ( normal_6.z = sqrt(((half)(1.0) - clamp (
dot (normal_6.xy, normal_6.xy) dot (normal_6.xy, normal_6.xy)
, (half)0.0, (half)1.0))); , (half)0.0, (half)1.0)));
half3 normal_7; half3 normal_7 = 0;
normal_7.xy = ((_DetailNormalMap.sample(_mtlsmp__DetailNormalMap, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).wy * (half)2.0) - (half)1.0); normal_7.xy = ((_DetailNormalMap.sample(_mtlsmp__DetailNormalMap, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).wy * (half)(2.0)) - (half)(1.0));
normal_7.xy = ((half2)((float2)normal_7.xy * _mtl_u._DetailNormalMapScale)); normal_7.xy = ((half2)((float2)(normal_7.xy) * _mtl_u._DetailNormalMapScale));
normal_7.z = sqrt(((half)1.0 - clamp ( normal_7.z = sqrt(((half)(1.0) - clamp (
dot (normal_7.xy, normal_7.xy) dot (normal_7.xy, normal_7.xy)
, (half)0.0, (half)1.0))); , (half)0.0, (half)1.0)));
half3 tmpvar_8; half3 tmpvar_8 = 0;
tmpvar_8.xy = (normal_6.xy + normal_7.xy); tmpvar_8.xy = (normal_6.xy + normal_7.xy);
tmpvar_8.z = (normal_6.z * normal_7.z); tmpvar_8.z = (normal_6.z * normal_7.z);
half3 tmpvar_9; half3 tmpvar_9 = 0;
tmpvar_9 = normalize(tmpvar_8); tmpvar_9 = normalize(tmpvar_8);
half3 tmpvar_10; half3 tmpvar_10 = 0;
tmpvar_10 = ((half3)((float3)tmpvar_9 * tmpvar_5)); tmpvar_10 = ((half3)((float3)(tmpvar_9) * tmpvar_5));
float3 tmpvar_11; float3 tmpvar_11 = 0;
tmpvar_11 = normalize((_mtl_i.xlv_TEXCOORD1.xyz - _mtl_u._WorldSpaceCameraPos)); tmpvar_11 = normalize((_mtl_i.xlv_TEXCOORD1.xyz - _mtl_u._WorldSpaceCameraPos));
half4 tmpvar_12; half4 tmpvar_12 = 0;
tmpvar_12 = _SpecGlossMap.sample(_mtlsmp__SpecGlossMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)); tmpvar_12 = _SpecGlossMap.sample(_mtlsmp__SpecGlossMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy));
half tmpvar_13; half tmpvar_13 = 0;
tmpvar_13 = dot (tmpvar_12.xyz, (half3)float3(0.299, 0.587, 0.114)); tmpvar_13 = dot (tmpvar_12.xyz, (half3)float3(0.299, 0.587, 0.114));
half tmpvar_14; half tmpvar_14 = 0;
tmpvar_14 = ((half)1.0 - tmpvar_12.w); tmpvar_14 = ((half)(1.0) - tmpvar_12.w);
half4 tmpvar_15; half4 tmpvar_15 = 0;
tmpvar_15.xyz = ((half3)(tmpvar_11 - (float3)((half)2.0 * ( tmpvar_15.xyz = ((half3)(tmpvar_11 - (float3)(((half)(2.0) * (
((half)dot ((float3)tmpvar_10, tmpvar_11)) ((half)dot ((float3)tmpvar_10, tmpvar_11))
* tmpvar_10)))); * tmpvar_10)))));
tmpvar_15.w = (tmpvar_14 * (half)5.0); tmpvar_15.w = (tmpvar_14 * (half)(5.0));
half4 tmpvar_16; half4 tmpvar_16 = 0;
tmpvar_16 = _SpecCube.sample(_mtlsmp__SpecCube, (float3)(tmpvar_15.xyz), level(tmpvar_15.w)); tmpvar_16 = _SpecCube.sample(_mtlsmp__SpecCube, (float3)(tmpvar_15.xyz), level(tmpvar_15.w));
half tmpvar_17; half tmpvar_17 = 0;
tmpvar_17 = (tmpvar_16.w * tmpvar_16.w); tmpvar_17 = (tmpvar_16.w * tmpvar_16.w);
half2 tmpvar_18; half2 tmpvar_18 = 0;
tmpvar_18.x = tmpvar_17; tmpvar_18.x = tmpvar_17;
tmpvar_18.y = (tmpvar_16.w * tmpvar_17); tmpvar_18.y = (tmpvar_16.w * tmpvar_17);
env_2 = (((half3)((float3)(tmpvar_16.xyz * env_2 = (((half3)((float3)((tmpvar_16.xyz *
dot ((half2)float2(0.7532, 0.2468), tmpvar_18) dot ((half2)float2(0.7532, 0.2468), tmpvar_18)
) * _mtl_u._Exposure)) * _Occlusion.sample(_mtlsmp__Occlusion, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).x); )) * _mtl_u._Exposure)) * _Occlusion.sample(_mtlsmp__Occlusion, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).x);
half4 tmpvar_19; half4 tmpvar_19 = 0;
tmpvar_19 = unity_Lightmap.sample(_mtlsmp_unity_Lightmap, (float2)(_mtl_i.xlv_TEXCOORD4.xy)); tmpvar_19 = unity_Lightmap.sample(_mtlsmp_unity_Lightmap, (float2)(_mtl_i.xlv_TEXCOORD4.xy));
half4 tmpvar_20; half4 tmpvar_20 = 0;
tmpvar_20 = unity_LightmapInd.sample(_mtlsmp_unity_LightmapInd, (float2)(_mtl_i.xlv_TEXCOORD4.xy)); tmpvar_20 = unity_LightmapInd.sample(_mtlsmp_unity_LightmapInd, (float2)(_mtl_i.xlv_TEXCOORD4.xy));
float3x3 tmpvar_21; float3x3 tmpvar_21;
tmpvar_21[0].x = 0.816497; tmpvar_21[0].x = 0.816497;
@ -107,80 +107,80 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
tmpvar_21[2].x = 0.57735; tmpvar_21[2].x = 0.57735;
tmpvar_21[2].y = 0.57735; tmpvar_21[2].y = 0.57735;
tmpvar_21[2].z = 0.57735; tmpvar_21[2].z = 0.57735;
half3 tmpvar_22; half3 tmpvar_22 = 0;
tmpvar_22 = (((half)8.0 * tmpvar_20.w) * tmpvar_20.xyz); tmpvar_22 = (((half)(8.0) * tmpvar_20.w) * tmpvar_20.xyz);
float3 v_23; float3 v_23 = 0;
v_23.x = tmpvar_21[0].x; v_23.x = tmpvar_21[0].x;
v_23.y = tmpvar_21[1].x; v_23.y = tmpvar_21[1].x;
v_23.z = tmpvar_21[2].x; v_23.z = tmpvar_21[2].x;
float3 v_24; float3 v_24 = 0;
v_24.x = tmpvar_21[0].y; v_24.x = tmpvar_21[0].y;
v_24.y = tmpvar_21[1].y; v_24.y = tmpvar_21[1].y;
v_24.z = tmpvar_21[2].y; v_24.z = tmpvar_21[2].y;
float3 v_25; float3 v_25 = 0;
v_25.x = tmpvar_21[0].z; v_25.x = tmpvar_21[0].z;
v_25.y = tmpvar_21[1].z; v_25.y = tmpvar_21[1].z;
v_25.z = tmpvar_21[2].z; v_25.z = tmpvar_21[2].z;
lightDir_1 = ((half3)((float3)normalize(( lightDir_1 = ((half3)((float3)(normalize((
((tmpvar_22.x * (half3)v_23) + (tmpvar_22.y * (half3)v_24)) ((tmpvar_22.x * (half3)(v_23)) + (tmpvar_22.y * (half3)(v_24)))
+ +
(tmpvar_22.z * (half3)v_25) (tmpvar_22.z * (half3)(v_25))
)) * tmpvar_5)); ))) * tmpvar_5));
half3 tmpvar_26; half3 tmpvar_26 = 0;
tmpvar_26 = normalize(lightDir_1); tmpvar_26 = normalize(lightDir_1);
lightDir_1 = tmpvar_26; lightDir_1 = tmpvar_26;
half3 lightColor_27; half3 lightColor_27 = 0;
lightColor_27 = (_ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, ((float2)(_mtl_i.xlv_TEXCOORD5).xy / (float)(_mtl_i.xlv_TEXCOORD5).w)).x * (( lightColor_27 = (_ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, ((float2)(_mtl_i.xlv_TEXCOORD5).xy / (float)(_mtl_i.xlv_TEXCOORD5).w)).x * ((
((half)8.0 * tmpvar_19.w) ((half)(8.0) * tmpvar_19.w)
* tmpvar_19.xyz) * dot ( * tmpvar_19.xyz) * dot (
clamp (((half3)(tmpvar_21 * (float3)tmpvar_9)), (half)0.0, (half)1.0) clamp (((half3)(tmpvar_21 * (float3)(tmpvar_9))), (half)0.0, (half)1.0)
, tmpvar_22))); , tmpvar_22)));
float3 viewDir_28; float3 viewDir_28 = 0;
viewDir_28 = -(tmpvar_11); viewDir_28 = -(tmpvar_11);
half3 tmpvar_29; half3 tmpvar_29 = 0;
tmpvar_29 = normalize(((half3)((float3)tmpvar_26 + viewDir_28))); tmpvar_29 = normalize(((half3)((float3)(tmpvar_26) + viewDir_28)));
half tmpvar_30; half tmpvar_30 = 0;
tmpvar_30 = max ((half)0.0, dot (tmpvar_10, tmpvar_26)); tmpvar_30 = max ((half)0.0, dot (tmpvar_10, tmpvar_26));
half tmpvar_31; half tmpvar_31 = 0;
tmpvar_31 = max ((half)0.0, dot (tmpvar_10, tmpvar_29)); tmpvar_31 = max ((half)0.0, dot (tmpvar_10, tmpvar_29));
half tmpvar_32; half tmpvar_32 = 0;
tmpvar_32 = max ((half)0.0, ((half)dot ((float3)tmpvar_10, viewDir_28))); tmpvar_32 = max ((half)0.0, ((half)dot ((float3)tmpvar_10, viewDir_28)));
half tmpvar_33; half tmpvar_33 = 0;
tmpvar_33 = max ((half)0.0, ((half)dot (viewDir_28, (float3)tmpvar_29))); tmpvar_33 = max ((half)0.0, ((half)dot (viewDir_28, (float3)tmpvar_29)));
half VdotH_34; half VdotH_34 = 0;
VdotH_34 = (tmpvar_33 + (half)1e-05); VdotH_34 = (tmpvar_33 + (half)(1e-05));
half tmpvar_35; half tmpvar_35 = 0;
tmpvar_35 = (((half)1.0/(( tmpvar_35 = (((half)1.0/((
pow (tmpvar_14, (half)4.0) pow (tmpvar_14, (half)4.0)
+ (half)1e-05))) - (half)2.0); + (half)(1e-05)))) - (half)(2.0));
half tmpvar_36; half tmpvar_36 = 0;
half tmpvar_37; half tmpvar_37 = 0;
tmpvar_37 = max ((half)0.0, dot (tmpvar_26, tmpvar_29)); tmpvar_37 = max ((half)0.0, dot (tmpvar_26, tmpvar_29));
tmpvar_36 = ((half)0.5 + (((half)2.0 * tmpvar_37) * (tmpvar_37 * tmpvar_14))); tmpvar_36 = ((half)(0.5) + (((half)(2.0) * tmpvar_37) * (tmpvar_37 * tmpvar_14)));
half4 tmpvar_38; half4 tmpvar_38 = 0;
tmpvar_38.xyz = ((( tmpvar_38.xyz = (((
(min ((((half3)(_mtl_u._Color.xyz * (float3)_MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz)) * ((half)2.0 * _DetailAlbedoMap.sample(_mtlsmp__DetailAlbedoMap, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz)), ((half3)float3(1.0, 1.0, 1.0) - tmpvar_13)) * ((( (min ((((half3)(_mtl_u._Color.xyz * (float3)(_MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz))) * ((half)(2.0) * _DetailAlbedoMap.sample(_mtlsmp__DetailAlbedoMap, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz)), ((half3)(float3(1.0, 1.0, 1.0)) - tmpvar_13)) * (((
((half)1.0 + ((tmpvar_36 - (half)1.0) * pow (((half)1.00001 - tmpvar_30), (half)5.0))) ((half)(1.0) + ((tmpvar_36 - (half)(1.0)) * pow (((half)(1.00001) - tmpvar_30), (half)5.0)))
* *
((half)1.0 + ((tmpvar_36 - (half)1.0) * pow (((half)1.00001 - tmpvar_32), (half)5.0))) ((half)(1.0) + ((tmpvar_36 - (half)(1.0)) * pow (((half)(1.00001) - tmpvar_32), (half)5.0)))
) * tmpvar_30) * lightColor_27)) ) * tmpvar_30) * lightColor_27))
+ +
(tmpvar_12.xyz * (env_2 + (lightColor_27 * max ((half)0.0, (tmpvar_12.xyz * (env_2 + (lightColor_27 * max ((half)0.0,
((((tmpvar_13 + ((((tmpvar_13 +
(((half)1.0 - tmpvar_13) * pow (abs(((half)1.0 - tmpvar_33)), (half)5.0)) (((half)(1.0) - tmpvar_13) * pow (abs(((half)(1.0) - tmpvar_33)), (half)5.0))
) * min ((half)1.0, ) * min ((half)1.0,
min (((((half)2.0 * tmpvar_31) * tmpvar_32) / VdotH_34), ((((half)2.0 * tmpvar_31) * tmpvar_30) / VdotH_34)) min (((((half)(2.0) * tmpvar_31) * tmpvar_32) / VdotH_34), ((((half)(2.0) * tmpvar_31) * tmpvar_30) / VdotH_34))
)) * max ((half)0.0, ( )) * max ((half)0.0, (
pow (tmpvar_31, tmpvar_35) pow (tmpvar_31, tmpvar_35)
* *
((tmpvar_35 + (half)1.0) / (half)6.28318) ((tmpvar_35 + (half)(1.0)) / (half)(6.28318))
))) / (((half)4.0 * tmpvar_32) + (half)1e-05)) ))) / (((half)(4.0) * tmpvar_32) + (half)(1e-05)))
)))) ))))
) + ( ) + (
((((half)1.0 - dot (tmpvar_12.xyz, (half3)float3(0.299, 0.587, 0.114))) * ((half)1.0 - tmpvar_14)) * pow (abs(((half)1.0 - tmpvar_32)), (half)5.0)) ((((half)(1.0) - dot (tmpvar_12.xyz, (half3)float3(0.299, 0.587, 0.114))) * ((half)(1.0) - tmpvar_14)) * pow (abs(((half)(1.0) - tmpvar_32)), (half)5.0))
* env_2)) + ((half3)((float3)_SelfIllum.sample(_mtlsmp__SelfIllum, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz * _mtl_u._SelfIllumScale))); * env_2)) + ((half3)((float3)(_SelfIllum.sample(_mtlsmp__SelfIllum, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz) * _mtl_u._SelfIllumScale)));
tmpvar_38.w = ((half)((float)_AlphaMap.sample(_mtlsmp__AlphaMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).w * _mtl_u._Color.w)); tmpvar_38.w = ((half)((float)(_AlphaMap.sample(_mtlsmp__AlphaMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).w) * _mtl_u._Color.w));
half4 tmpvar_39; half4 tmpvar_39 = 0;
tmpvar_39 = tmpvar_38; tmpvar_39 = tmpvar_38;
_mtl_o._fragData = tmpvar_39; _mtl_o._fragData = tmpvar_39;
return _mtl_o; return _mtl_o;

View File

@ -20,44 +20,44 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _MainTex [[texture(2)]], sampler _mtlsmp__MainTex [[sampler(2)]]) , texture2d<half> _MainTex [[texture(2)]], sampler _mtlsmp__MainTex [[sampler(2)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half atten_2; half atten_2 = 0;
half4 lightCoord_3; half4 lightCoord_3 = 0;
float3 tmpvar_4; float3 tmpvar_4 = 0;
tmpvar_4 = normalize((_mtl_u._WorldSpaceLightPos0.xyz - _mtl_i.xlv_TEXCOORD2)); tmpvar_4 = normalize((_mtl_u._WorldSpaceLightPos0.xyz - _mtl_i.xlv_TEXCOORD2));
half3 tmpvar_5; half3 tmpvar_5 = 0;
half tmpvar_6; half tmpvar_6 = 0;
half4 c_7; half4 c_7 = 0;
half4 tmpvar_8; half4 tmpvar_8 = 0;
tmpvar_8 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_8 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0));
c_7 = tmpvar_8; c_7 = tmpvar_8;
tmpvar_5 = c_7.xyz; tmpvar_5 = c_7.xyz;
tmpvar_6 = c_7.w; tmpvar_6 = c_7.w;
float4 tmpvar_9; float4 tmpvar_9 = 0;
tmpvar_9.w = 1.0; tmpvar_9.w = 1.0;
tmpvar_9.xyz = _mtl_i.xlv_TEXCOORD2; tmpvar_9.xyz = _mtl_i.xlv_TEXCOORD2;
float4 tmpvar_10; float4 tmpvar_10 = 0;
tmpvar_10 = ((float4)(_mtl_u._LightMatrix0 * (half4)tmpvar_9)); tmpvar_10 = ((float4)(_mtl_u._LightMatrix0 * (half4)(tmpvar_9)));
lightCoord_3 = half4(tmpvar_10); lightCoord_3 = half4(tmpvar_10);
half4 tmpvar_11; half4 tmpvar_11 = 0;
half2 P_12; half2 P_12 = 0;
P_12 = ((lightCoord_3.xy / lightCoord_3.w) + (half)0.5); P_12 = ((lightCoord_3.xy / lightCoord_3.w) + (half)(0.5));
tmpvar_11 = _LightTexture0.sample(_mtlsmp__LightTexture0, (float2)(P_12)); tmpvar_11 = _LightTexture0.sample(_mtlsmp__LightTexture0, (float2)(P_12));
half tmpvar_13; half tmpvar_13 = 0;
tmpvar_13 = dot (lightCoord_3.xyz, lightCoord_3.xyz); tmpvar_13 = dot (lightCoord_3.xyz, lightCoord_3.xyz);
half4 tmpvar_14; half4 tmpvar_14 = 0;
tmpvar_14 = _LightTextureB0.sample(_mtlsmp__LightTextureB0, (float2)(half2(tmpvar_13))); tmpvar_14 = _LightTextureB0.sample(_mtlsmp__LightTextureB0, (float2)(half2(tmpvar_13)));
half tmpvar_15; half tmpvar_15 = 0;
tmpvar_15 = ((half( tmpvar_15 = ((half(
(lightCoord_3.z > (half)0.0) (lightCoord_3.z > (half)(0.0))
) * tmpvar_11.w) * tmpvar_14.w); ) * tmpvar_11.w) * tmpvar_14.w);
atten_2 = tmpvar_15; atten_2 = tmpvar_15;
half3 lightDir_16; half3 lightDir_16 = 0;
lightDir_16 = half3(tmpvar_4); lightDir_16 = half3(tmpvar_4);
half4 c_17; half4 c_17 = 0;
c_17.xyz = ((tmpvar_5 * _mtl_u._LightColor0.xyz) * (( c_17.xyz = ((tmpvar_5 * _mtl_u._LightColor0.xyz) * ((
max ((half)0.0, dot (_mtl_i.xlv_TEXCOORD1, lightDir_16)) max ((half)0.0, dot (_mtl_i.xlv_TEXCOORD1, lightDir_16))
* atten_2) * (half)2.0)); * atten_2) * (half)(2.0)));
c_17.w = tmpvar_6; c_17.w = tmpvar_6;
c_1.xyz = c_17.xyz; c_1.xyz = c_17.xyz;
c_1.w = half(0.0); c_1.w = half(0.0);

View File

@ -19,23 +19,23 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _MainTex [[texture(1)]], sampler _mtlsmp__MainTex [[sampler(1)]]) , texture2d<half> _MainTex [[texture(1)]], sampler _mtlsmp__MainTex [[sampler(1)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 c_1; half4 c_1 = 0;
half4 tmpvar_2; half4 tmpvar_2 = 0;
tmpvar_2 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_2 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0));
half3 tmpvar_3; half3 tmpvar_3 = 0;
tmpvar_3 = ((_BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i.xlv_TEXCOORD0)).xyz * (half)2.0) - (half)1.0); tmpvar_3 = ((_BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i.xlv_TEXCOORD0)).xyz * (half)(2.0)) - (half)(1.0));
half3 halfDir_4; half3 halfDir_4 = 0;
halfDir_4 = _mtl_i.xlv_TEXCOORD1; halfDir_4 = _mtl_i.xlv_TEXCOORD1;
half4 c_5; half4 c_5 = 0;
half spec_6; half spec_6 = 0;
half tmpvar_7; half tmpvar_7 = 0;
tmpvar_7 = max ((half)0.0, dot (tmpvar_3, halfDir_4)); tmpvar_7 = max ((half)0.0, dot (tmpvar_3, halfDir_4));
half tmpvar_8; half tmpvar_8 = 0;
tmpvar_8 = pow (tmpvar_7, (_mtl_u._Shininess * (half)128.0)); tmpvar_8 = pow (tmpvar_7, (_mtl_u._Shininess * (half)(128.0)));
spec_6 = (tmpvar_8 * tmpvar_2.w); spec_6 = (tmpvar_8 * tmpvar_2.w);
c_5.xyz = ((( c_5.xyz = (((
(tmpvar_2.xyz * max ((half)0.0, dot (tmpvar_3, _mtl_i.xlv_TEXCOORD2))) (tmpvar_2.xyz * max ((half)0.0, dot (tmpvar_3, _mtl_i.xlv_TEXCOORD2)))
+ spec_6) * _mtl_u._LightColor0.xyz) * (half)2.0); + spec_6) * _mtl_u._LightColor0.xyz) * (half)(2.0));
c_5.w = half(0.0); c_5.w = half(0.0);
c_1.w = c_5.w; c_1.w = c_5.w;
c_1.xyz = (c_5.xyz + (tmpvar_2.xyz * _mtl_i.xlv_TEXCOORD3)); c_1.xyz = (c_5.xyz + (tmpvar_2.xyz * _mtl_i.xlv_TEXCOORD3));

View File

@ -18,23 +18,23 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
, texture2d<half> _RandomTexture [[texture(1)]], sampler _mtlsmp__RandomTexture [[sampler(1)]]) , texture2d<half> _RandomTexture [[texture(1)]], sampler _mtlsmp__RandomTexture [[sampler(1)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half tmpvar_1; half tmpvar_1 = 0;
float2 tmpvar_2; float2 tmpvar_2 = 0;
tmpvar_2 = _mtl_i.xlv_TEXCOORD0; tmpvar_2 = _mtl_i.xlv_TEXCOORD0;
float occ_4; float occ_4 = 0;
float scale_5; float scale_5 = 0;
float depth_6; float depth_6 = 0;
float3 viewNorm_7; float3 viewNorm_7 = 0;
half3 randN_8; half3 randN_8 = 0;
half3 tmpvar_9; half3 tmpvar_9 = 0;
tmpvar_9 = ((_RandomTexture.sample(_mtlsmp__RandomTexture, (float2)(_mtl_i.xlv_TEXCOORD1)).xyz * (half)2.0) - (half)1.0); tmpvar_9 = ((_RandomTexture.sample(_mtlsmp__RandomTexture, (float2)(_mtl_i.xlv_TEXCOORD1)).xyz * (half)(2.0)) - (half)(1.0));
randN_8 = tmpvar_9; randN_8 = tmpvar_9;
float4 tmpvar_10; float4 tmpvar_10 = 0;
tmpvar_10 = _CameraDepthNormalsTexture.sample(_mtlsmp__CameraDepthNormalsTexture, (float2)(_mtl_i.xlv_TEXCOORD0)); tmpvar_10 = _CameraDepthNormalsTexture.sample(_mtlsmp__CameraDepthNormalsTexture, (float2)(_mtl_i.xlv_TEXCOORD0));
float3 n_11; float3 n_11 = 0;
float3 tmpvar_12; float3 tmpvar_12 = 0;
tmpvar_12 = ((tmpvar_10.xyz * float3(3.5554, 3.5554, 0.0)) + float3(-1.7777, -1.7777, 1.0)); tmpvar_12 = ((tmpvar_10.xyz * float3(3.5554, 3.5554, 0.0)) + float3(-1.7777, -1.7777, 1.0));
float tmpvar_13; float tmpvar_13 = 0;
tmpvar_13 = (2.0 / dot (tmpvar_12, tmpvar_12)); tmpvar_13 = (2.0 / dot (tmpvar_12, tmpvar_12));
n_11.xy = (tmpvar_13 * tmpvar_12.xy); n_11.xy = (tmpvar_13 * tmpvar_12.xy);
n_11.z = (tmpvar_13 - 1.0); n_11.z = (tmpvar_13 - 1.0);
@ -43,29 +43,29 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]]
scale_5 = (_mtl_u._Params.x / depth_6); scale_5 = (_mtl_u._Params.x / depth_6);
occ_4 = 0.0; occ_4 = 0.0;
for (int s_3 = 0; s_3 < 8; s_3++) { for (int s_3 = 0; s_3 < 8; s_3++) {
half3 randomDir_14; half3 randomDir_14 = 0;
float3 tmpvar_15; float3 tmpvar_15 = 0;
float3 I_16; float3 I_16 = 0;
I_16 = _xlat_mtl_const1[s_3]; I_16 = _xlat_mtl_const1[s_3];
tmpvar_15 = (I_16 - (float3)((half)2.0 * ((half3)( tmpvar_15 = (I_16 - (float3)(((half)(2.0) * ((half3)(
dot ((float3)randN_8, I_16) dot ((float3)randN_8, I_16)
* (float3)randN_8)))); * (float3)(randN_8))))));
randomDir_14 = half3(tmpvar_15); randomDir_14 = half3(tmpvar_15);
float tmpvar_17; float tmpvar_17 = 0;
tmpvar_17 = dot (viewNorm_7, (float3)randomDir_14); tmpvar_17 = dot (viewNorm_7, (float3)randomDir_14);
half tmpvar_18; half tmpvar_18 = 0;
if ((tmpvar_17 < 0.0)) { if ((tmpvar_17 < 0.0)) {
tmpvar_18 = half(1.0); tmpvar_18 = half(1.0);
} else { } else {
tmpvar_18 = half(-1.0); tmpvar_18 = half(-1.0);
}; };
randomDir_14 = (randomDir_14 * -(tmpvar_18)); randomDir_14 = (randomDir_14 * -(tmpvar_18));
randomDir_14 = half3(((float3)randomDir_14 + (viewNorm_7 * 0.3))); randomDir_14 = half3(((float3)(randomDir_14) + (viewNorm_7 * 0.3)));
float tmpvar_19; float tmpvar_19 = 0;
tmpvar_19 = clamp (((depth_6 - tmpvar_19 = clamp (((depth_6 -
((float)randomDir_14.z * _mtl_u._Params.x) ((float)(randomDir_14.z) * _mtl_u._Params.x)
) - ( ) - (
dot (_CameraDepthNormalsTexture.sample(_mtlsmp__CameraDepthNormalsTexture, (float2)((tmpvar_2 + ((float2)randomDir_14.xy * scale_5)))).zw, float2(1.0, 0.00392157)) dot (_CameraDepthNormalsTexture.sample(_mtlsmp__CameraDepthNormalsTexture, (float2)((tmpvar_2 + ((float2)(randomDir_14.xy) * scale_5)))).zw, float2(1.0, 0.00392157))
* _mtl_u._ProjectionParams.z)), 0.0, 1.0); * _mtl_u._ProjectionParams.z)), 0.0, 1.0);
if ((tmpvar_19 > _mtl_u._Params.y)) { if ((tmpvar_19 > _mtl_u._Params.y)) {
occ_4 = (occ_4 + pow ((1.0 - tmpvar_19), _mtl_u._Params.z)); occ_4 = (occ_4 + pow ((1.0 - tmpvar_19), _mtl_u._Params.z));

View File

@ -48,6 +48,7 @@ static PFNGLGETSHADERIVPROC glGetShaderiv;
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#include <OpenGL/CGLTypes.h> #include <OpenGL/CGLTypes.h>
#include <dirent.h> #include <dirent.h>
#include <stdlib.h>
static CGLContextObj s_GLContext; static CGLContextObj s_GLContext;
static CGLContextObj s_GLContext3; static CGLContextObj s_GLContext3;
static bool s_GL3Active = false; static bool s_GL3Active = false;

View File

@ -136,7 +136,6 @@ v2f xlat_main( in appdata_full v ) {
return o; return o;
} }
attribute vec4 TANGENT; attribute vec4 TANGENT;
varying highp vec4 xlv_SV_POSITION;
varying highp vec2 xlv_TEXCOORD0; varying highp vec2 xlv_TEXCOORD0;
varying lowp vec4 xlv_TEXCOORD1; varying lowp vec4 xlv_TEXCOORD1;
void main() { void main() {
@ -149,7 +148,7 @@ void main() {
xlt_v.texcoord1 = vec4( gl_MultiTexCoord1); xlt_v.texcoord1 = vec4( gl_MultiTexCoord1);
xlt_v.color = vec4( gl_Color); xlt_v.color = vec4( gl_Color);
xl_retval = xlat_main( xlt_v); xl_retval = xlat_main( xlt_v);
xlv_SV_POSITION = vec4( xl_retval.pos); gl_Position = vec4(xl_retval.pos);
xlv_TEXCOORD0 = vec2( xl_retval.uv); xlv_TEXCOORD0 = vec2( xl_retval.uv);
xlv_TEXCOORD1 = vec4( xl_retval.color); xlv_TEXCOORD1 = vec4( xl_retval.color);
} }

View File

@ -143,7 +143,6 @@ in highp vec4 _uv0;
in highp vec4 _uv1; in highp vec4 _uv1;
in lowp vec4 _color; in lowp vec4 _color;
in vec4 TANGENT; in vec4 TANGENT;
out highp vec4 xlv_SV_POSITION;
out highp vec2 xlv_TEXCOORD0; out highp vec2 xlv_TEXCOORD0;
out lowp vec4 xlv_TEXCOORD1; out lowp vec4 xlv_TEXCOORD1;
void main() { void main() {
@ -156,7 +155,7 @@ void main() {
xlt_v.texcoord1 = _uv1; xlt_v.texcoord1 = _uv1;
xlt_v.color = _color; xlt_v.color = _color;
xl_retval = xlat_main( xlt_v); xl_retval = xlat_main( xlt_v);
xlv_SV_POSITION = vec4( xl_retval.pos); gl_Position = vec4(xl_retval.pos);
xlv_TEXCOORD0 = vec2( xl_retval.uv); xlv_TEXCOORD0 = vec2( xl_retval.uv);
xlv_TEXCOORD1 = vec4( xl_retval.color); xlv_TEXCOORD1 = vec4( xl_retval.color);
} }

View File

@ -20,7 +20,6 @@ uniform highp float _VerticalBillboarding;
uniform highp mat4 _World2Object; uniform highp mat4 _World2Object;
uniform highp vec3 _WorldSpaceCameraPos; uniform highp vec3 _WorldSpaceCameraPos;
uniform highp mat4 glstate_matrix_mvp; uniform highp mat4 glstate_matrix_mvp;
varying highp vec4 xlv_SV_POSITION;
varying highp vec2 xlv_TEXCOORD0; varying highp vec2 xlv_TEXCOORD0;
varying lowp vec4 xlv_TEXCOORD1; varying lowp vec4 xlv_TEXCOORD1;
void main () void main ()
@ -135,7 +134,7 @@ void main ()
nfadeout_31 = (nfadeout_31 * nfadeout_31); nfadeout_31 = (nfadeout_31 * nfadeout_31);
nfadeout_31 = (nfadeout_31 * ffadeout_30); nfadeout_31 = (nfadeout_31 * ffadeout_30);
tmpvar_3 = ((nfadeout_31 * _Color) * (_Multiplier * wave_6)); tmpvar_3 = ((nfadeout_31 * _Color) * (_Multiplier * wave_6));
xlv_SV_POSITION = (glstate_matrix_mvp * tmpvar_29); gl_Position = (glstate_matrix_mvp * tmpvar_29);
xlv_TEXCOORD0 = _glesMultiTexCoord0.xy; xlv_TEXCOORD0 = _glesMultiTexCoord0.xy;
xlv_TEXCOORD1 = tmpvar_3; xlv_TEXCOORD1 = tmpvar_3;
} }

View File

@ -21,7 +21,6 @@ in mediump vec3 _inNormal;
in highp vec4 _uv0; in highp vec4 _uv0;
in highp vec4 _uv1; in highp vec4 _uv1;
in lowp vec4 _color; in lowp vec4 _color;
out highp vec4 xlv_SV_POSITION;
out highp vec2 xlv_TEXCOORD0; out highp vec2 xlv_TEXCOORD0;
out lowp vec4 xlv_TEXCOORD1; out lowp vec4 xlv_TEXCOORD1;
void main () void main ()
@ -136,7 +135,7 @@ void main ()
nfadeout_31 = (nfadeout_31 * nfadeout_31); nfadeout_31 = (nfadeout_31 * nfadeout_31);
nfadeout_31 = (nfadeout_31 * ffadeout_30); nfadeout_31 = (nfadeout_31 * ffadeout_30);
tmpvar_3 = ((nfadeout_31 * _Color) * (_Multiplier * wave_6)); tmpvar_3 = ((nfadeout_31 * _Color) * (_Multiplier * wave_6));
xlv_SV_POSITION = (glstate_matrix_mvp * tmpvar_29); gl_Position = (glstate_matrix_mvp * tmpvar_29);
xlv_TEXCOORD0 = _uv0.xy; xlv_TEXCOORD0 = _uv0.xy;
xlv_TEXCOORD1 = tmpvar_3; xlv_TEXCOORD1 = tmpvar_3;
} }

View File

@ -9,7 +9,7 @@ struct xlatMtlShaderInput {
half4 _color [[attribute(4)]]; half4 _color [[attribute(4)]];
}; };
struct xlatMtlShaderOutput { struct xlatMtlShaderOutput {
float4 xlv_SV_POSITION; float4 gl_Position [[position]];
float2 xlv_TEXCOORD0; float2 xlv_TEXCOORD0;
half4 xlv_TEXCOORD1; half4 xlv_TEXCOORD1;
}; };
@ -35,46 +35,46 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float3 tmpvar_1; float3 tmpvar_1 = 0;
float4 tmpvar_2; float4 tmpvar_2 = 0;
tmpvar_1 = float3(_mtl_i._inNormal); tmpvar_1 = float3(_mtl_i._inNormal);
tmpvar_2 = float4(_mtl_i._color); tmpvar_2 = float4(_mtl_i._color);
half4 tmpvar_3; half4 tmpvar_3 = 0;
float noiseWave_4; float noiseWave_4 = 0;
float noiseTime_5; float noiseTime_5 = 0;
float wave_6; float wave_6 = 0;
float time_7; float time_7 = 0;
float3 BBLocalPos_8; float3 BBLocalPos_8 = 0;
float3 localDir_9; float3 localDir_9 = 0;
float3 centerLocal_10; float3 centerLocal_10 = 0;
float3 centerOffs_11; float3 centerOffs_11 = 0;
float3 tmpvar_12; float3 tmpvar_12 = 0;
tmpvar_12.z = 0.0; tmpvar_12.z = 0.0;
tmpvar_12.xy = (float2(0.5, 0.5) - tmpvar_2.xy); tmpvar_12.xy = (float2(0.5, 0.5) - tmpvar_2.xy);
centerOffs_11 = (tmpvar_12 * _mtl_i._uv1.xyy); centerOffs_11 = (tmpvar_12 * _mtl_i._uv1.xyy);
centerLocal_10 = (_mtl_i._inVertex.xyz + centerOffs_11); centerLocal_10 = (_mtl_i._inVertex.xyz + centerOffs_11);
float4 tmpvar_13; float4 tmpvar_13 = 0;
tmpvar_13.w = 1.0; tmpvar_13.w = 1.0;
tmpvar_13.xyz = _mtl_u._WorldSpaceCameraPos; tmpvar_13.xyz = _mtl_u._WorldSpaceCameraPos;
localDir_9 = ((_mtl_u._World2Object * tmpvar_13).xyz - centerLocal_10); localDir_9 = ((_mtl_u._World2Object * tmpvar_13).xyz - centerLocal_10);
localDir_9.y = (localDir_9.y * _mtl_u._VerticalBillboarding); localDir_9.y = (localDir_9.y * _mtl_u._VerticalBillboarding);
float tmpvar_14; float tmpvar_14 = 0;
tmpvar_14 = sqrt(dot (localDir_9, localDir_9)); tmpvar_14 = sqrt(dot (localDir_9, localDir_9));
float3 dir_15; float3 dir_15 = 0;
dir_15 = (localDir_9 / tmpvar_14); dir_15 = (localDir_9 / tmpvar_14);
float tmpvar_16; float tmpvar_16 = 0;
tmpvar_16 = abs(dir_15.y); tmpvar_16 = abs(dir_15.y);
float3 tmpvar_17; float3 tmpvar_17 = 0;
if ((tmpvar_16 > 0.999)) { if ((tmpvar_16 > 0.999)) {
tmpvar_17 = float3(0.0, 0.0, 1.0); tmpvar_17 = float3(0.0, 0.0, 1.0);
} else { } else {
tmpvar_17 = float3(0.0, 1.0, 0.0); tmpvar_17 = float3(0.0, 1.0, 0.0);
}; };
float3 tmpvar_18; float3 tmpvar_18 = 0;
tmpvar_18 = normalize(((tmpvar_17.yzx * dir_15.zxy) - (tmpvar_17.zxy * dir_15.yzx))); tmpvar_18 = normalize(((tmpvar_17.yzx * dir_15.zxy) - (tmpvar_17.zxy * dir_15.yzx)));
float3 tmpvar_19; float3 tmpvar_19 = 0;
tmpvar_19 = ((dir_15.yzx * tmpvar_18.zxy) - (dir_15.zxy * tmpvar_18.yzx)); tmpvar_19 = ((dir_15.yzx * tmpvar_18.zxy) - (dir_15.zxy * tmpvar_18.yzx));
float tmpvar_20; float tmpvar_20 = 0;
tmpvar_20 = min ((max ( tmpvar_20 = min ((max (
(tmpvar_14 - _mtl_u._SizeGrowStartDist) (tmpvar_14 - _mtl_u._SizeGrowStartDist)
, 0.0) / _mtl_u._SizeGrowEndDist), 1.0); , 0.0) / _mtl_u._SizeGrowEndDist), 1.0);
@ -92,23 +92,23 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
(_mtl_u._MaxGrowSize * tmpvar_2.w) (_mtl_u._MaxGrowSize * tmpvar_2.w)
))); )));
time_7 = (_mtl_u._Time.y + (_mtl_u._BlinkingTimeOffsScale * tmpvar_2.z)); time_7 = (_mtl_u._Time.y + (_mtl_u._BlinkingTimeOffsScale * tmpvar_2.z));
float y_21; float y_21 = 0;
y_21 = (_mtl_u._TimeOnDuration + _mtl_u._TimeOffDuration); y_21 = (_mtl_u._TimeOnDuration + _mtl_u._TimeOffDuration);
float tmpvar_22; float tmpvar_22 = 0;
tmpvar_22 = (time_7 / y_21); tmpvar_22 = (time_7 / y_21);
float tmpvar_23; float tmpvar_23 = 0;
tmpvar_23 = (fract(abs(tmpvar_22)) * y_21); tmpvar_23 = (fract(abs(tmpvar_22)) * y_21);
float tmpvar_24; float tmpvar_24 = 0;
if ((tmpvar_22 >= 0.0)) { if ((tmpvar_22 >= 0.0)) {
tmpvar_24 = tmpvar_23; tmpvar_24 = tmpvar_23;
} else { } else {
tmpvar_24 = -(tmpvar_23); tmpvar_24 = -(tmpvar_23);
}; };
float tmpvar_25; float tmpvar_25 = 0;
tmpvar_25 = clamp ((tmpvar_24 / (_mtl_u._TimeOnDuration * 0.25)), 0.0, 1.0); tmpvar_25 = clamp ((tmpvar_24 / (_mtl_u._TimeOnDuration * 0.25)), 0.0, 1.0);
float edge0_26; float edge0_26 = 0;
edge0_26 = (_mtl_u._TimeOnDuration * 0.75); edge0_26 = (_mtl_u._TimeOnDuration * 0.75);
float tmpvar_27; float tmpvar_27 = 0;
tmpvar_27 = clamp (((tmpvar_24 - edge0_26) / (_mtl_u._TimeOnDuration - edge0_26)), 0.0, 1.0); tmpvar_27 = clamp (((tmpvar_24 - edge0_26) / (_mtl_u._TimeOnDuration - edge0_26)), 0.0, 1.0);
wave_6 = ((tmpvar_25 * (tmpvar_25 * wave_6 = ((tmpvar_25 * (tmpvar_25 *
(3.0 - (2.0 * tmpvar_25)) (3.0 - (2.0 * tmpvar_25))
@ -123,19 +123,19 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
(noiseTime_5 * 0.6366) (noiseTime_5 * 0.6366)
+ 56.7272))) + 0.5) + 56.7272))) + 0.5)
)) + (1.0 - _mtl_u._NoiseAmount)); )) + (1.0 - _mtl_u._NoiseAmount));
float tmpvar_28; float tmpvar_28 = 0;
if ((_mtl_u._NoiseAmount < 0.01)) { if ((_mtl_u._NoiseAmount < 0.01)) {
tmpvar_28 = wave_6; tmpvar_28 = wave_6;
} else { } else {
tmpvar_28 = noiseWave_4; tmpvar_28 = noiseWave_4;
}; };
wave_6 = (tmpvar_28 + _mtl_u._Bias); wave_6 = (tmpvar_28 + _mtl_u._Bias);
float4 tmpvar_29; float4 tmpvar_29 = 0;
tmpvar_29.w = 1.0; tmpvar_29.w = 1.0;
tmpvar_29.xyz = BBLocalPos_8; tmpvar_29.xyz = BBLocalPos_8;
float ffadeout_30; float ffadeout_30 = 0;
float nfadeout_31; float nfadeout_31 = 0;
float tmpvar_32; float tmpvar_32 = 0;
tmpvar_32 = clamp ((tmpvar_14 / _mtl_u._FadeOutDistNear), 0.0, 1.0); tmpvar_32 = clamp ((tmpvar_14 / _mtl_u._FadeOutDistNear), 0.0, 1.0);
ffadeout_30 = (1.0 - clamp (( ffadeout_30 = (1.0 - clamp ((
max ((tmpvar_14 - _mtl_u._FadeOutDistFar), 0.0) max ((tmpvar_14 - _mtl_u._FadeOutDistFar), 0.0)
@ -145,7 +145,7 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
nfadeout_31 = (nfadeout_31 * nfadeout_31); nfadeout_31 = (nfadeout_31 * nfadeout_31);
nfadeout_31 = (nfadeout_31 * ffadeout_30); nfadeout_31 = (nfadeout_31 * ffadeout_30);
tmpvar_3 = half4(((nfadeout_31 * _mtl_u._Color) * (_mtl_u._Multiplier * wave_6))); tmpvar_3 = half4(((nfadeout_31 * _mtl_u._Color) * (_mtl_u._Multiplier * wave_6)));
_mtl_o.xlv_SV_POSITION = (_mtl_u.glstate_matrix_mvp * tmpvar_29); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * tmpvar_29);
_mtl_o.xlv_TEXCOORD0 = _mtl_i._uv0.xy; _mtl_o.xlv_TEXCOORD0 = _mtl_i._uv0.xy;
_mtl_o.xlv_TEXCOORD1 = tmpvar_3; _mtl_o.xlv_TEXCOORD1 = tmpvar_3;
return _mtl_o; return _mtl_o;

View File

@ -17,33 +17,33 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float3 viewDir_1; float3 viewDir_1 = 0;
float3 tmpvar_2; float3 tmpvar_2 = 0;
float4 tmpvar_3; float4 tmpvar_3 = 0;
tmpvar_3.w = 1.0; tmpvar_3.w = 1.0;
tmpvar_3.xyz = _mtl_u._WorldSpaceCameraPos; tmpvar_3.xyz = _mtl_u._WorldSpaceCameraPos;
viewDir_1 = normalize(((_mtl_u._World2Object * tmpvar_3).xyz - _mtl_i._glesVertex.xyz)); viewDir_1 = normalize(((_mtl_u._World2Object * tmpvar_3).xyz - _mtl_i._glesVertex.xyz));
half tmpvar_4; half tmpvar_4 = 0;
float tmpvar_5; float tmpvar_5 = 0;
tmpvar_5 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[0])), 0.0, 1.0); tmpvar_5 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[0])), 0.0, 1.0);
tmpvar_4 = half(tmpvar_5); tmpvar_4 = half(tmpvar_5);
float3 tmpvar_6; float3 tmpvar_6 = 0;
tmpvar_6.yz = tmpvar_2.yz; tmpvar_6.yz = tmpvar_2.yz;
tmpvar_6.x = float((tmpvar_4 * (half)2.0)); tmpvar_6.x = float((tmpvar_4 * (half)(2.0)));
half tmpvar_7; half tmpvar_7 = 0;
float tmpvar_8; float tmpvar_8 = 0;
tmpvar_8 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[1])), 0.0, 1.0); tmpvar_8 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[1])), 0.0, 1.0);
tmpvar_7 = half(tmpvar_8); tmpvar_7 = half(tmpvar_8);
float3 tmpvar_9; float3 tmpvar_9 = 0;
tmpvar_9.xz = tmpvar_6.xz; tmpvar_9.xz = tmpvar_6.xz;
tmpvar_9.y = float((tmpvar_7 * (half)2.0)); tmpvar_9.y = float((tmpvar_7 * (half)(2.0)));
half tmpvar_10; half tmpvar_10 = 0;
float tmpvar_11; float tmpvar_11 = 0;
tmpvar_11 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[2])), 0.0, 1.0); tmpvar_11 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[2])), 0.0, 1.0);
tmpvar_10 = half(tmpvar_11); tmpvar_10 = half(tmpvar_11);
float3 tmpvar_12; float3 tmpvar_12 = 0;
tmpvar_12.xy = tmpvar_9.xy; tmpvar_12.xy = tmpvar_9.xy;
tmpvar_12.z = float((tmpvar_10 * (half)2.0)); tmpvar_12.z = float((tmpvar_10 * (half)(2.0)));
tmpvar_2 = tmpvar_12; tmpvar_2 = tmpvar_12;
_mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex);
_mtl_o.xlv_TEXCOORD2 = tmpvar_12; _mtl_o.xlv_TEXCOORD2 = tmpvar_12;

View File

@ -16,12 +16,12 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
, uint gl_VertexID [[vertex_id]]) , uint gl_VertexID [[vertex_id]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float3 p_1; float3 p_1 = 0;
p_1.z = _mtl_i._inPos.z; p_1.z = _mtl_i._inPos.z;
p_1.x = (_mtl_i._inPos.x + float(gl_VertexID)); p_1.x = (_mtl_i._inPos.x + float(gl_VertexID));
p_1.y = (_mtl_i._inPos.y + float(gl_InstanceID)); p_1.y = (_mtl_i._inPos.y + float(gl_InstanceID));
p_1 = (p_1 + _mtl_i._inNor); p_1 = (p_1 + _mtl_i._inNor);
float4 tmpvar_2; float4 tmpvar_2 = 0;
tmpvar_2.w = 1.0; tmpvar_2.w = 1.0;
tmpvar_2.xyz = p_1; tmpvar_2.xyz = p_1;
_mtl_o.gl_Position = tmpvar_2; _mtl_o.gl_Position = tmpvar_2;

View File

@ -17,14 +17,14 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half2 tmpvar_1; half2 tmpvar_1 = 0;
tmpvar_1 = half2(_mtl_i._glesMultiTexCoord0.xy); tmpvar_1 = half2(_mtl_i._glesMultiTexCoord0.xy);
float4 tmpvar_2; float4 tmpvar_2 = 0;
tmpvar_2.xyz = normalize(_mtl_i._glesTANGENT.xyz); tmpvar_2.xyz = normalize(_mtl_i._glesTANGENT.xyz);
tmpvar_2.w = _mtl_i._glesTANGENT.w; tmpvar_2.w = _mtl_i._glesTANGENT.w;
half4 tmpvar_3; half4 tmpvar_3 = 0;
tmpvar_3.xy = (tmpvar_1 * (half)0.3); tmpvar_3.xy = (tmpvar_1 * (half)(0.3));
tmpvar_3.xyz = half3(((float3)tmpvar_3.xyz + ((tmpvar_2.xyz * 0.5) + 0.5))); tmpvar_3.xyz = half3(((float3)(tmpvar_3.xyz) + ((tmpvar_2.xyz * 0.5) + 0.5)));
tmpvar_3.w = half(0.0); tmpvar_3.w = half(0.0);
_mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex);
_mtl_o.xlv_TEXCOORD0 = tmpvar_1; _mtl_o.xlv_TEXCOORD0 = tmpvar_1;

View File

@ -48,12 +48,12 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float4 phase0_Output0_1; float4 phase0_Output0_1 = 0;
float4 Temp_0_2; float4 Temp_0_2 = 0;
float4 Temp_1_3; float4 Temp_1_3 = 0;
float4 Temp_2_4; float4 Temp_2_4 = 0;
float4 Temp_3_5; float4 Temp_3_5 = 0;
int4 Temp_int_0_6; int4 Temp_int_0_6 = 0;
Temp_0_2 = (_mtl_i.dcl_Input0_POSITION0.yyyy * _mtl_u.glstate_matrix_mvp[1]); Temp_0_2 = (_mtl_i.dcl_Input0_POSITION0.yyyy * _mtl_u.glstate_matrix_mvp[1]);
Temp_0_2 = ((_mtl_u.glstate_matrix_mvp[0] * _mtl_i.dcl_Input0_POSITION0.xxxx) + Temp_0_2); Temp_0_2 = ((_mtl_u.glstate_matrix_mvp[0] * _mtl_i.dcl_Input0_POSITION0.xxxx) + Temp_0_2);
Temp_0_2 = ((_mtl_u.glstate_matrix_mvp[2] * _mtl_i.dcl_Input0_POSITION0.zzzz) + Temp_0_2); Temp_0_2 = ((_mtl_u.glstate_matrix_mvp[2] * _mtl_i.dcl_Input0_POSITION0.zzzz) + Temp_0_2);

View File

@ -28,11 +28,11 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float4 phase0_Output2_1; float4 phase0_Output2_1 = 0;
float4 Temp_2_2; float4 Temp_2_2 = 0;
float4 Temp_3_3; float4 Temp_3_3 = 0;
int4 Temp_int_0_4; int4 Temp_int_0_4 = 0;
int4 Temp_int_1_5; int4 Temp_int_1_5 = 0;
Temp_int_0_4 = as_type<int4>((_mtl_i.in_POSITION0.yyyy * _mtl_u.glstate_matrix_mvp[1])); Temp_int_0_4 = as_type<int4>((_mtl_i.in_POSITION0.yyyy * _mtl_u.glstate_matrix_mvp[1]));
Temp_int_0_4 = as_type<int4>(((_mtl_u.glstate_matrix_mvp[0] * _mtl_i.in_POSITION0.xxxx) + as_type<float4>(Temp_int_0_4))); Temp_int_0_4 = as_type<int4>(((_mtl_u.glstate_matrix_mvp[0] * _mtl_i.in_POSITION0.xxxx) + as_type<float4>(Temp_int_0_4)));
Temp_int_0_4 = as_type<int4>(((_mtl_u.glstate_matrix_mvp[2] * _mtl_i.in_POSITION0.zzzz) + as_type<float4>(Temp_int_0_4))); Temp_int_0_4 = as_type<int4>(((_mtl_u.glstate_matrix_mvp[2] * _mtl_i.in_POSITION0.zzzz) + as_type<float4>(Temp_int_0_4)));

View File

@ -17,38 +17,38 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float3 tmpvar_1; float3 tmpvar_1 = 0;
tmpvar_1 = _mtl_i._glesVertex.xyz; tmpvar_1 = _mtl_i._glesVertex.xyz;
int j_2; int j_2 = 0;
int j_3; int j_3 = 0;
int il_4; int il_4 = 0;
half3 lcolor_5; half3 lcolor_5 = 0;
half3 eyeNormal_6; half3 eyeNormal_6 = 0;
half4 color_7; half4 color_7 = 0;
half4 tmpvar_8; half4 tmpvar_8 = 0;
color_7 = half4(float4(0.0, 0.0, 0.0, 1.1)); color_7 = half4(float4(0.0, 0.0, 0.0, 1.1));
eyeNormal_6 = half3(_mtl_i._glesNormal); eyeNormal_6 = half3(_mtl_i._glesNormal);
lcolor_5 = half3(float3(0.0, 0.0, 0.0)); lcolor_5 = half3(float3(0.0, 0.0, 0.0));
il_4 = 0; il_4 = 0;
while (true) { while (true) {
float tmpvar_9; float tmpvar_9 = 0;
tmpvar_9 = min (8.0, float(_mtl_u.unity_VertexLightParams.x)); tmpvar_9 = min (8.0, float(_mtl_u.unity_VertexLightParams.x));
if ((float(il_4) >= tmpvar_9)) { if ((float(il_4) >= tmpvar_9)) {
break; break;
}; };
float3 tmpvar_10; float3 tmpvar_10 = 0;
tmpvar_10 = _mtl_u.unity_LightPosition[il_4].xyz; tmpvar_10 = _mtl_u.unity_LightPosition[il_4].xyz;
half3 dirToLight_11; half3 dirToLight_11 = 0;
dirToLight_11 = half3(tmpvar_10); dirToLight_11 = half3(tmpvar_10);
lcolor_5 = (lcolor_5 + min (( lcolor_5 = (lcolor_5 + min ((
(max (dot (eyeNormal_6, dirToLight_11), (half)0.0) * _mtl_u.unity_LightColor[il_4].xyz) (max (dot (eyeNormal_6, dirToLight_11), (half)0.0) * _mtl_u.unity_LightColor[il_4].xyz)
* (half)0.5), (half3)float3(1.0, 1.0, 1.0))); * (half)(0.5)), (half3)float3(1.0, 1.0, 1.0)));
il_4++; il_4++;
}; };
color_7.xyz = lcolor_5; color_7.xyz = lcolor_5;
j_3 = 0; j_3 = 0;
while (true) { while (true) {
float tmpvar_12; float tmpvar_12 = 0;
tmpvar_12 = min (float(_mtl_u.unity_VertexLightParams.y), 4.0); tmpvar_12 = min (float(_mtl_u.unity_VertexLightParams.y), 4.0);
if ((j_3 >= int(tmpvar_12))) { if ((j_3 >= int(tmpvar_12))) {
break; break;
@ -58,7 +58,7 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
}; };
j_2 = 0; j_2 = 0;
while (true) { while (true) {
int tmpvar_13; int tmpvar_13 = 0;
tmpvar_13 = min (_mtl_u.unity_VertexLightParams.y, 4); tmpvar_13 = min (_mtl_u.unity_VertexLightParams.y, 4);
if ((j_2 >= tmpvar_13)) { if ((j_2 >= tmpvar_13)) {
break; break;
@ -67,7 +67,7 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
j_2++; j_2++;
}; };
tmpvar_8 = color_7; tmpvar_8 = color_7;
float4 tmpvar_14; float4 tmpvar_14 = 0;
tmpvar_14.w = 1.0; tmpvar_14.w = 1.0;
tmpvar_14.xyz = tmpvar_1; tmpvar_14.xyz = tmpvar_1;
_mtl_o.xlv_COLOR0 = tmpvar_8; _mtl_o.xlv_COLOR0 = tmpvar_8;

View File

@ -16,31 +16,31 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float4 l_1_1; float4 l_1_1 = 0;
float4 l_2; float4 l_2 = 0;
half4 tmpvar_3; half4 tmpvar_3 = 0;
half4 tmpvar_4; half4 tmpvar_4 = 0;
tmpvar_3 = half4((_mtl_u.UNITY_MATRIX_MVP * _mtl_i._inVertex)); tmpvar_3 = half4((_mtl_u.UNITY_MATRIX_MVP * _mtl_i._inVertex));
tmpvar_4 = half4(_mtl_u.unity_LightColor[0]); tmpvar_4 = half4(_mtl_u.unity_LightColor[0]);
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[1])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[1]));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[0])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[0]));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[1])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[1]));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[2])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[2]));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[3])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[3]));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[3])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[3]));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[2])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[2]));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[1])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[1]));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[0])); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[0]));
l_2 = (_mtl_u.unity_LightColor[0] * _mtl_u.unity_LightAtten[0].x); l_2 = (_mtl_u.unity_LightColor[0] * _mtl_u.unity_LightAtten[0].x);
tmpvar_4 = half4(((float4)tmpvar_4 + l_2)); tmpvar_4 = half4(((float4)(tmpvar_4) + l_2));
l_2 = (_mtl_u.unity_LightColor[1] * _mtl_u.unity_LightAtten[1].x); l_2 = (_mtl_u.unity_LightColor[1] * _mtl_u.unity_LightAtten[1].x);
tmpvar_4 = half4(((float4)tmpvar_4 + l_2)); tmpvar_4 = half4(((float4)(tmpvar_4) + l_2));
l_1_1 = (_mtl_u.unity_LightColor[0] * _mtl_u.unity_LightAtten[0].z); l_1_1 = (_mtl_u.unity_LightColor[0] * _mtl_u.unity_LightAtten[0].z);
tmpvar_4 = half4(((float4)tmpvar_4 + l_1_1)); tmpvar_4 = half4(((float4)(tmpvar_4) + l_1_1));
l_1_1 = (_mtl_u.unity_LightColor[1] * _mtl_u.unity_LightAtten[1].z); l_1_1 = (_mtl_u.unity_LightColor[1] * _mtl_u.unity_LightAtten[1].z);
tmpvar_4 = half4(((float4)tmpvar_4 + l_1_1)); tmpvar_4 = half4(((float4)(tmpvar_4) + l_1_1));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[1].x)); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[1].x));
tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[2].x)); tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[2].x));
_mtl_o.gl_Position = float4(tmpvar_3); _mtl_o.gl_Position = float4(tmpvar_3);
_mtl_o.xlv_TEXCOORD0 = tmpvar_4; _mtl_o.xlv_TEXCOORD0 = tmpvar_4;
return _mtl_o; return _mtl_o;

View File

@ -27,13 +27,13 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
float4x4 htof4_3; float4x4 htof4_3;
half2x2 ftoh2_4; half2x2 ftoh2_4;
half4x4 ftoh4_5; half4x4 ftoh4_5;
float4 r_6; float4 r_6 = 0;
r_6.yzw = float3(0.0, 0.0, 0.0); r_6.yzw = float3(0.0, 0.0, 0.0);
ftoh4_5 = _xlcast_half4x4(_mtl_u.uniMat4F); ftoh4_5 = _xlcast_half4x4(_mtl_u.uniMat4F);
r_6.x = float(ftoh4_5[0].x); r_6.x = float(ftoh4_5[0].x);
r_6.x = (r_6.x + (float)ftoh4_5[0].x); r_6.x = (r_6.x + (float)(ftoh4_5[0].x));
ftoh2_4 = _xlcast_half2x2(_mtl_u.uniMat2F); ftoh2_4 = _xlcast_half2x2(_mtl_u.uniMat2F);
r_6.x = (r_6.x + (float)ftoh2_4[0].x); r_6.x = (r_6.x + (float)(ftoh2_4[0].x));
htof4_3 = _xlcast_float4x4(_mtl_u.uniMat4H); htof4_3 = _xlcast_float4x4(_mtl_u.uniMat4H);
r_6.x = (r_6.x + htof4_3[0].x); r_6.x = (r_6.x + htof4_3[0].x);
htof3_2 = _xlcast_float3x3(_mtl_u.uniMat3H); htof3_2 = _xlcast_float3x3(_mtl_u.uniMat3H);

View File

@ -23,21 +23,21 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half3 lightDir_1; half3 lightDir_1 = 0;
float3 worldN_2; float3 worldN_2 = 0;
half3 tmpvar_3; half3 tmpvar_3 = 0;
half3 tmpvar_4; half3 tmpvar_4 = 0;
half3 tmpvar_5; half3 tmpvar_5 = 0;
float3x3 tmpvar_6; float3x3 tmpvar_6;
tmpvar_6[0] = _mtl_u._Object2World[0].xyz; tmpvar_6[0] = _mtl_u._Object2World[0].xyz;
tmpvar_6[1] = _mtl_u._Object2World[1].xyz; tmpvar_6[1] = _mtl_u._Object2World[1].xyz;
tmpvar_6[2] = _mtl_u._Object2World[2].xyz; tmpvar_6[2] = _mtl_u._Object2World[2].xyz;
half3 tmpvar_7; half3 tmpvar_7 = 0;
tmpvar_7 = ((half3)(tmpvar_6 * (float3)_mtl_i.attrNormal)); tmpvar_7 = ((half3)(tmpvar_6 * (float3)(_mtl_i.attrNormal)));
worldN_2 = float3(tmpvar_7); worldN_2 = float3(tmpvar_7);
tmpvar_5 = half3(worldN_2); tmpvar_5 = half3(worldN_2);
half3 tmpvar_8; half3 tmpvar_8 = 0;
half3 tmpvar_9; half3 tmpvar_9 = 0;
tmpvar_8 = _mtl_i.attrTangent.xyz; tmpvar_8 = _mtl_i.attrTangent.xyz;
tmpvar_9 = (((_mtl_i.attrNormal.yzx * _mtl_i.attrTangent.zxy) - (_mtl_i.attrNormal.zxy * _mtl_i.attrTangent.yzx)) * _mtl_i.attrTangent.w); tmpvar_9 = (((_mtl_i.attrNormal.yzx * _mtl_i.attrTangent.zxy) - (_mtl_i.attrNormal.zxy * _mtl_i.attrTangent.yzx)) * _mtl_i.attrTangent.w);
half3x3 tmpvar_10; half3x3 tmpvar_10;
@ -50,16 +50,16 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
tmpvar_10[2].x = tmpvar_8.z; tmpvar_10[2].x = tmpvar_8.z;
tmpvar_10[2].y = tmpvar_9.z; tmpvar_10[2].y = tmpvar_9.z;
tmpvar_10[2].z = _mtl_i.attrNormal.z; tmpvar_10[2].z = _mtl_i.attrNormal.z;
float3 tmpvar_11; float3 tmpvar_11 = 0;
tmpvar_11 = ((float3)(tmpvar_10 * (half3)(_mtl_u._World2Object * (float4)_mtl_u._WorldSpaceLightPos0).xyz)); tmpvar_11 = ((float3)(tmpvar_10 * (half3)((_mtl_u._World2Object * (float4)(_mtl_u._WorldSpaceLightPos0)).xyz)));
lightDir_1 = half3(tmpvar_11); lightDir_1 = half3(tmpvar_11);
tmpvar_3 = lightDir_1; tmpvar_3 = lightDir_1;
float4 tmpvar_12; float4 tmpvar_12 = 0;
tmpvar_12.w = 1.0; tmpvar_12.w = 1.0;
tmpvar_12.xyz = _mtl_u._WorldSpaceCameraPos; tmpvar_12.xyz = _mtl_u._WorldSpaceCameraPos;
float3 tmpvar_13; float3 tmpvar_13 = 0;
tmpvar_13 = normalize(((float3)lightDir_1 + normalize( tmpvar_13 = normalize(((float3)(lightDir_1) + normalize(
((float3)(tmpvar_10 * (half3)(((_mtl_u._World2Object * tmpvar_12).xyz * _mtl_u.unity_Scale.w) - _mtl_i.attrVertex.xyz))) ((float3)(tmpvar_10 * (half3)((((_mtl_u._World2Object * tmpvar_12).xyz * _mtl_u.unity_Scale.w) - _mtl_i.attrVertex.xyz))))
))); )));
tmpvar_4 = half3(tmpvar_13); tmpvar_4 = half3(tmpvar_13);
_mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i.attrVertex); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i.attrVertex);

View File

@ -16,9 +16,9 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half4 tmpvar_1; half4 tmpvar_1 = 0;
tmpvar_1 = half4(_mtl_i._glesMultiTexCoord0); tmpvar_1 = half4(_mtl_i._glesMultiTexCoord0);
float4 tmpvar_2; float4 tmpvar_2 = 0;
tmpvar_2 = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex); tmpvar_2 = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex);
tmpvar_2.z = (tmpvar_2.z + clamp ((_mtl_u.unity_LightShadowBias.x / tmpvar_2.w), 0.0, 1.0)); tmpvar_2.z = (tmpvar_2.z + clamp ((_mtl_u.unity_LightShadowBias.x / tmpvar_2.w), 0.0, 1.0));
tmpvar_2.z = mix (tmpvar_2.z, max (tmpvar_2.z, -(tmpvar_2.w)), _mtl_u.unity_LightShadowBias.y); tmpvar_2.z = mix (tmpvar_2.z, max (tmpvar_2.z, -(tmpvar_2.w)), _mtl_u.unity_LightShadowBias.y);

View File

@ -18,8 +18,8 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half2 tmpvar_1; half2 tmpvar_1 = 0;
half4 tmpvar_2; half4 tmpvar_2 = 0;
tmpvar_2.w = _mtl_i._color.w; tmpvar_2.w = _mtl_i._color.w;
tmpvar_2.xyz = (_mtl_i._color.xyz + _mtl_i._inNormal); tmpvar_2.xyz = (_mtl_i._color.xyz + _mtl_i._inNormal);
tmpvar_1 = half2(_mtl_i._uv0); tmpvar_1 = half2(_mtl_i._uv0);

View File

@ -24,18 +24,18 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float3 tmpvar_1; float3 tmpvar_1 = 0;
tmpvar_1 = _mtl_i._glesVertex.xyz; tmpvar_1 = _mtl_i._glesVertex.xyz;
float3 n_2; float3 n_2 = 0;
n_2 = float3(_mtl_i._glesNormal); n_2 = float3(_mtl_i._glesNormal);
half4 tmpvar_3; half4 tmpvar_3 = 0;
float4 tmpvar_4; float4 tmpvar_4 = 0;
tmpvar_4.w = 1.0; tmpvar_4.w = 1.0;
tmpvar_4.xyz = tmpvar_1; tmpvar_4.xyz = tmpvar_1;
float3 lightColor_5; float3 lightColor_5 = 0;
float3 viewN_6; float3 viewN_6 = 0;
float3 viewpos_7; float3 viewpos_7 = 0;
float4 tmpvar_8; float4 tmpvar_8 = 0;
tmpvar_8.w = 1.0; tmpvar_8.w = 1.0;
tmpvar_8.xyz = tmpvar_1; tmpvar_8.xyz = tmpvar_1;
viewpos_7 = (_mtl_u.glstate_matrix_modelview0 * tmpvar_8).xyz; viewpos_7 = (_mtl_u.glstate_matrix_modelview0 * tmpvar_8).xyz;
@ -44,37 +44,37 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
tmpvar_9[1] = _mtl_u.glstate_matrix_invtrans_modelview0[1].xyz; tmpvar_9[1] = _mtl_u.glstate_matrix_invtrans_modelview0[1].xyz;
tmpvar_9[2] = _mtl_u.glstate_matrix_invtrans_modelview0[2].xyz; tmpvar_9[2] = _mtl_u.glstate_matrix_invtrans_modelview0[2].xyz;
viewN_6 = (tmpvar_9 * n_2); viewN_6 = (tmpvar_9 * n_2);
float3 tmpvar_10; float3 tmpvar_10 = 0;
tmpvar_10 = (_mtl_u.unity_LightPosition[0].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[0].w)); tmpvar_10 = (_mtl_u.unity_LightPosition[0].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[0].w));
lightColor_5 = (_mtl_u.glstate_lightmodel_ambient.xyz + ((float3)_mtl_u.unity_LightColor[0].xyz * ( lightColor_5 = (_mtl_u.glstate_lightmodel_ambient.xyz + ((float3)(_mtl_u.unity_LightColor[0].xyz) * (
max (0.0, dot (viewN_6, normalize(tmpvar_10))) max (0.0, dot (viewN_6, normalize(tmpvar_10)))
* *
(1.0/((1.0 + (dot (tmpvar_10, tmpvar_10) * (float)_mtl_u.unity_LightAtten[0].z)))) (1.0/((1.0 + (dot (tmpvar_10, tmpvar_10) * (float)(_mtl_u.unity_LightAtten[0].z)))))
))); )));
float3 tmpvar_11; float3 tmpvar_11 = 0;
tmpvar_11 = (_mtl_u.unity_LightPosition[1].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[1].w)); tmpvar_11 = (_mtl_u.unity_LightPosition[1].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[1].w));
lightColor_5 = (lightColor_5 + ((float3)_mtl_u.unity_LightColor[1].xyz * ( lightColor_5 = (lightColor_5 + ((float3)(_mtl_u.unity_LightColor[1].xyz) * (
max (0.0, dot (viewN_6, normalize(tmpvar_11))) max (0.0, dot (viewN_6, normalize(tmpvar_11)))
* *
(1.0/((1.0 + (dot (tmpvar_11, tmpvar_11) * (float)_mtl_u.unity_LightAtten[1].z)))) (1.0/((1.0 + (dot (tmpvar_11, tmpvar_11) * (float)(_mtl_u.unity_LightAtten[1].z)))))
))); )));
float3 tmpvar_12; float3 tmpvar_12 = 0;
tmpvar_12 = (_mtl_u.unity_LightPosition[2].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[2].w)); tmpvar_12 = (_mtl_u.unity_LightPosition[2].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[2].w));
lightColor_5 = (lightColor_5 + ((float3)_mtl_u.unity_LightColor[2].xyz * ( lightColor_5 = (lightColor_5 + ((float3)(_mtl_u.unity_LightColor[2].xyz) * (
max (0.0, dot (viewN_6, normalize(tmpvar_12))) max (0.0, dot (viewN_6, normalize(tmpvar_12)))
* *
(1.0/((1.0 + (dot (tmpvar_12, tmpvar_12) * (float)_mtl_u.unity_LightAtten[2].z)))) (1.0/((1.0 + (dot (tmpvar_12, tmpvar_12) * (float)(_mtl_u.unity_LightAtten[2].z)))))
))); )));
float3 tmpvar_13; float3 tmpvar_13 = 0;
tmpvar_13 = (_mtl_u.unity_LightPosition[3].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[3].w)); tmpvar_13 = (_mtl_u.unity_LightPosition[3].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[3].w));
lightColor_5 = (lightColor_5 + ((float3)_mtl_u.unity_LightColor[3].xyz * ( lightColor_5 = (lightColor_5 + ((float3)(_mtl_u.unity_LightColor[3].xyz) * (
max (0.0, dot (viewN_6, normalize(tmpvar_13))) max (0.0, dot (viewN_6, normalize(tmpvar_13)))
* *
(1.0/((1.0 + (dot (tmpvar_13, tmpvar_13) * (float)_mtl_u.unity_LightAtten[3].z)))) (1.0/((1.0 + (dot (tmpvar_13, tmpvar_13) * (float)(_mtl_u.unity_LightAtten[3].z)))))
))); )));
float4 tmpvar_14; float4 tmpvar_14 = 0;
tmpvar_14.w = 1.0; tmpvar_14.w = 1.0;
tmpvar_14.xyz = ((lightColor_5 * (float3)_mtl_u._Color.xyz) * 2.0); tmpvar_14.xyz = ((lightColor_5 * (float3)(_mtl_u._Color.xyz)) * 2.0);
tmpvar_3 = half4(tmpvar_14); tmpvar_3 = half4(tmpvar_14);
_mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * tmpvar_4); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * tmpvar_4);
_mtl_o.xlv_COLOR0 = tmpvar_3; _mtl_o.xlv_COLOR0 = tmpvar_3;

View File

@ -17,140 +17,140 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
, texture2d<half> _DynLampInfo [[texture(0)]], sampler _mtlsmp__DynLampInfo [[sampler(0)]]) , texture2d<half> _DynLampInfo [[texture(0)]], sampler _mtlsmp__DynLampInfo [[sampler(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
half3 tmpvar_1; half3 tmpvar_1 = 0;
float3 tmpvar_2; float3 tmpvar_2 = 0;
tmpvar_2 = (_mtl_u._Object2World * _mtl_i._glesVertex).xyz; tmpvar_2 = (_mtl_u._Object2World * _mtl_i._glesVertex).xyz;
float3 tmpvar_3; float3 tmpvar_3 = 0;
half3 hybridCol_4; half3 hybridCol_4 = 0;
int4 tmpvar_5; int4 tmpvar_5 = 0;
tmpvar_5.xyz = int3(tmpvar_2); tmpvar_5.xyz = int3(tmpvar_2);
tmpvar_5.w = int(-(tmpvar_2.x)); tmpvar_5.w = int(-(tmpvar_2.x));
float2 tmpvar_6; float2 tmpvar_6 = 0;
tmpvar_6.y = 1.0; tmpvar_6.y = 1.0;
tmpvar_6.x = float(tmpvar_5.x); tmpvar_6.x = float(tmpvar_5.x);
half2 coord_7; half2 coord_7 = 0;
coord_7 = half2(tmpvar_6); coord_7 = half2(tmpvar_6);
half4 tmpvar_8; half4 tmpvar_8 = 0;
tmpvar_8.zw = half2(float2(0.0, 0.0)); tmpvar_8.zw = half2(float2(0.0, 0.0));
tmpvar_8.xy = (coord_7 / _mtl_u._DynLampInfo_bufferSize); tmpvar_8.xy = (coord_7 / _mtl_u._DynLampInfo_bufferSize);
half4 tmpvar_9; half4 tmpvar_9 = 0;
half4 tmpvar_10; half4 tmpvar_10 = 0;
tmpvar_10 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_8.xy), level(0.0)); tmpvar_10 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_8.xy), level(0.0));
tmpvar_9 = tmpvar_10; tmpvar_9 = tmpvar_10;
float2 tmpvar_11; float2 tmpvar_11 = 0;
tmpvar_11.y = 2.0; tmpvar_11.y = 2.0;
tmpvar_11.x = float(tmpvar_5.x); tmpvar_11.x = float(tmpvar_5.x);
half2 coord_12; half2 coord_12 = 0;
coord_12 = half2(tmpvar_11); coord_12 = half2(tmpvar_11);
half4 tmpvar_13; half4 tmpvar_13 = 0;
tmpvar_13.zw = half2(float2(0.0, 0.0)); tmpvar_13.zw = half2(float2(0.0, 0.0));
tmpvar_13.xy = (coord_12 / _mtl_u._DynLampInfo_bufferSize); tmpvar_13.xy = (coord_12 / _mtl_u._DynLampInfo_bufferSize);
half4 tmpvar_14; half4 tmpvar_14 = 0;
half4 tmpvar_15; half4 tmpvar_15 = 0;
tmpvar_15 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_13.xy), level(0.0)); tmpvar_15 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_13.xy), level(0.0));
tmpvar_14 = tmpvar_15; tmpvar_14 = tmpvar_15;
float2 tmpvar_16; float2 tmpvar_16 = 0;
tmpvar_16.y = 1.0; tmpvar_16.y = 1.0;
tmpvar_16.x = float(tmpvar_5.y); tmpvar_16.x = float(tmpvar_5.y);
half2 coord_17; half2 coord_17 = 0;
coord_17 = half2(tmpvar_16); coord_17 = half2(tmpvar_16);
half4 tmpvar_18; half4 tmpvar_18 = 0;
tmpvar_18.zw = half2(float2(0.0, 0.0)); tmpvar_18.zw = half2(float2(0.0, 0.0));
tmpvar_18.xy = (coord_17 / _mtl_u._DynLampInfo_bufferSize); tmpvar_18.xy = (coord_17 / _mtl_u._DynLampInfo_bufferSize);
half4 tmpvar_19; half4 tmpvar_19 = 0;
half4 tmpvar_20; half4 tmpvar_20 = 0;
tmpvar_20 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_18.xy), level(0.0)); tmpvar_20 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_18.xy), level(0.0));
tmpvar_19 = tmpvar_20; tmpvar_19 = tmpvar_20;
float2 tmpvar_21; float2 tmpvar_21 = 0;
tmpvar_21.y = 2.0; tmpvar_21.y = 2.0;
tmpvar_21.x = float(tmpvar_5.y); tmpvar_21.x = float(tmpvar_5.y);
half2 coord_22; half2 coord_22 = 0;
coord_22 = half2(tmpvar_21); coord_22 = half2(tmpvar_21);
half4 tmpvar_23; half4 tmpvar_23 = 0;
tmpvar_23.zw = half2(float2(0.0, 0.0)); tmpvar_23.zw = half2(float2(0.0, 0.0));
tmpvar_23.xy = (coord_22 / _mtl_u._DynLampInfo_bufferSize); tmpvar_23.xy = (coord_22 / _mtl_u._DynLampInfo_bufferSize);
half4 tmpvar_24; half4 tmpvar_24 = 0;
half4 tmpvar_25; half4 tmpvar_25 = 0;
tmpvar_25 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_23.xy), level(0.0)); tmpvar_25 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_23.xy), level(0.0));
tmpvar_24 = tmpvar_25; tmpvar_24 = tmpvar_25;
float2 tmpvar_26; float2 tmpvar_26 = 0;
tmpvar_26.y = 1.0; tmpvar_26.y = 1.0;
tmpvar_26.x = float(tmpvar_5.z); tmpvar_26.x = float(tmpvar_5.z);
half2 coord_27; half2 coord_27 = 0;
coord_27 = half2(tmpvar_26); coord_27 = half2(tmpvar_26);
half4 tmpvar_28; half4 tmpvar_28 = 0;
tmpvar_28.zw = half2(float2(0.0, 0.0)); tmpvar_28.zw = half2(float2(0.0, 0.0));
tmpvar_28.xy = (coord_27 / _mtl_u._DynLampInfo_bufferSize); tmpvar_28.xy = (coord_27 / _mtl_u._DynLampInfo_bufferSize);
half4 tmpvar_29; half4 tmpvar_29 = 0;
half4 tmpvar_30; half4 tmpvar_30 = 0;
tmpvar_30 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_28.xy), level(0.0)); tmpvar_30 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_28.xy), level(0.0));
tmpvar_29 = tmpvar_30; tmpvar_29 = tmpvar_30;
float2 tmpvar_31; float2 tmpvar_31 = 0;
tmpvar_31.y = 2.0; tmpvar_31.y = 2.0;
tmpvar_31.x = float(tmpvar_5.z); tmpvar_31.x = float(tmpvar_5.z);
half2 coord_32; half2 coord_32 = 0;
coord_32 = half2(tmpvar_31); coord_32 = half2(tmpvar_31);
half4 tmpvar_33; half4 tmpvar_33 = 0;
tmpvar_33.zw = half2(float2(0.0, 0.0)); tmpvar_33.zw = half2(float2(0.0, 0.0));
tmpvar_33.xy = (coord_32 / _mtl_u._DynLampInfo_bufferSize); tmpvar_33.xy = (coord_32 / _mtl_u._DynLampInfo_bufferSize);
half4 tmpvar_34; half4 tmpvar_34 = 0;
half4 tmpvar_35; half4 tmpvar_35 = 0;
tmpvar_35 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_33.xy), level(0.0)); tmpvar_35 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_33.xy), level(0.0));
tmpvar_34 = tmpvar_35; tmpvar_34 = tmpvar_35;
float2 tmpvar_36; float2 tmpvar_36 = 0;
tmpvar_36.y = 1.0; tmpvar_36.y = 1.0;
tmpvar_36.x = float(tmpvar_5.w); tmpvar_36.x = float(tmpvar_5.w);
half2 coord_37; half2 coord_37 = 0;
coord_37 = half2(tmpvar_36); coord_37 = half2(tmpvar_36);
half4 tmpvar_38; half4 tmpvar_38 = 0;
tmpvar_38.zw = half2(float2(0.0, 0.0)); tmpvar_38.zw = half2(float2(0.0, 0.0));
tmpvar_38.xy = (coord_37 / _mtl_u._DynLampInfo_bufferSize); tmpvar_38.xy = (coord_37 / _mtl_u._DynLampInfo_bufferSize);
half4 tmpvar_39; half4 tmpvar_39 = 0;
half4 tmpvar_40; half4 tmpvar_40 = 0;
tmpvar_40 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_38.xy), level(0.0)); tmpvar_40 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_38.xy), level(0.0));
tmpvar_39 = tmpvar_40; tmpvar_39 = tmpvar_40;
float2 tmpvar_41; float2 tmpvar_41 = 0;
tmpvar_41.y = 2.0; tmpvar_41.y = 2.0;
tmpvar_41.x = float(tmpvar_5.w); tmpvar_41.x = float(tmpvar_5.w);
half2 coord_42; half2 coord_42 = 0;
coord_42 = half2(tmpvar_41); coord_42 = half2(tmpvar_41);
half4 tmpvar_43; half4 tmpvar_43 = 0;
tmpvar_43.zw = half2(float2(0.0, 0.0)); tmpvar_43.zw = half2(float2(0.0, 0.0));
tmpvar_43.xy = (coord_42 / _mtl_u._DynLampInfo_bufferSize); tmpvar_43.xy = (coord_42 / _mtl_u._DynLampInfo_bufferSize);
half4 tmpvar_44; half4 tmpvar_44 = 0;
half4 tmpvar_45; half4 tmpvar_45 = 0;
tmpvar_45 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_43.xy), level(0.0)); tmpvar_45 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_43.xy), level(0.0));
tmpvar_44 = tmpvar_45; tmpvar_44 = tmpvar_45;
half3 hybridCol_46; half3 hybridCol_46 = 0;
half4 atten_47; half4 atten_47 = 0;
float3 tmpvar_48; float3 tmpvar_48 = 0;
tmpvar_48 = ((float3)tmpvar_9.xyz - tmpvar_2); tmpvar_48 = ((float3)(tmpvar_9.xyz) - tmpvar_2);
float tmpvar_49; float tmpvar_49 = 0;
tmpvar_49 = dot (tmpvar_48, tmpvar_48); tmpvar_49 = dot (tmpvar_48, tmpvar_48);
half4 tmpvar_50; half4 tmpvar_50 = 0;
tmpvar_50.yzw = atten_47.yzw; tmpvar_50.yzw = atten_47.yzw;
tmpvar_50.x = half((tmpvar_49 * (float)tmpvar_9.w)); tmpvar_50.x = half((tmpvar_49 * (float)(tmpvar_9.w)));
float3 tmpvar_51; float3 tmpvar_51 = 0;
tmpvar_51 = ((float3)tmpvar_19.xyz - tmpvar_2); tmpvar_51 = ((float3)(tmpvar_19.xyz) - tmpvar_2);
float tmpvar_52; float tmpvar_52 = 0;
tmpvar_52 = dot (tmpvar_51, tmpvar_51); tmpvar_52 = dot (tmpvar_51, tmpvar_51);
half4 tmpvar_53; half4 tmpvar_53 = 0;
tmpvar_53.xzw = tmpvar_50.xzw; tmpvar_53.xzw = tmpvar_50.xzw;
tmpvar_53.y = half((tmpvar_52 * (float)tmpvar_19.w)); tmpvar_53.y = half((tmpvar_52 * (float)(tmpvar_19.w)));
float3 tmpvar_54; float3 tmpvar_54 = 0;
tmpvar_54 = ((float3)tmpvar_29.xyz - tmpvar_2); tmpvar_54 = ((float3)(tmpvar_29.xyz) - tmpvar_2);
float tmpvar_55; float tmpvar_55 = 0;
tmpvar_55 = dot (tmpvar_54, tmpvar_54); tmpvar_55 = dot (tmpvar_54, tmpvar_54);
half4 tmpvar_56; half4 tmpvar_56 = 0;
tmpvar_56.xyw = tmpvar_53.xyw; tmpvar_56.xyw = tmpvar_53.xyw;
tmpvar_56.z = half((tmpvar_55 * (float)tmpvar_29.w)); tmpvar_56.z = half((tmpvar_55 * (float)(tmpvar_29.w)));
float3 tmpvar_57; float3 tmpvar_57 = 0;
tmpvar_57 = ((float3)tmpvar_39.xyz - tmpvar_2); tmpvar_57 = ((float3)(tmpvar_39.xyz) - tmpvar_2);
float tmpvar_58; float tmpvar_58 = 0;
tmpvar_58 = dot (tmpvar_57, tmpvar_57); tmpvar_58 = dot (tmpvar_57, tmpvar_57);
half4 tmpvar_59; half4 tmpvar_59 = 0;
tmpvar_59.xyz = tmpvar_56.xyz; tmpvar_59.xyz = tmpvar_56.xyz;
tmpvar_59.w = half((tmpvar_58 * (float)tmpvar_39.w)); tmpvar_59.w = half((tmpvar_58 * (float)(tmpvar_39.w)));
atten_47 = tmpvar_59; atten_47 = tmpvar_59;
hybridCol_46 = (hybridCol_4 + (tmpvar_14.xyz * tmpvar_50.x)); hybridCol_46 = (hybridCol_4 + (tmpvar_14.xyz * tmpvar_50.x));
hybridCol_46 = (hybridCol_46 + (tmpvar_24.xyz * tmpvar_53.y)); hybridCol_46 = (hybridCol_46 + (tmpvar_24.xyz * tmpvar_53.y));

View File

@ -18,18 +18,18 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float4 tmpvar_1; float4 tmpvar_1 = 0;
float3 tmpvar_2; float3 tmpvar_2 = 0;
tmpvar_1 = (_mtl_u.glstate_matrix_mvp * _mtl_i._vertex); tmpvar_1 = (_mtl_u.glstate_matrix_mvp * _mtl_i._vertex);
float4 o_3; float4 o_3 = 0;
o_3 = (tmpvar_1 * 0.5); o_3 = (tmpvar_1 * 0.5);
float2 tmpvar_4; float2 tmpvar_4 = 0;
tmpvar_4.x = o_3.x; tmpvar_4.x = o_3.x;
tmpvar_4.y = (o_3.y * _mtl_u._ProjectionParams.x); tmpvar_4.y = (o_3.y * _mtl_u._ProjectionParams.x);
o_3.xy = (tmpvar_4 + o_3.w); o_3.xy = (tmpvar_4 + o_3.w);
o_3.zw = tmpvar_1.zw; o_3.zw = tmpvar_1.zw;
tmpvar_2 = ((_mtl_u.glstate_matrix_modelview0 * _mtl_i._vertex).xyz * float3(-1.0, -1.0, 1.0)); tmpvar_2 = ((_mtl_u.glstate_matrix_modelview0 * _mtl_i._vertex).xyz * float3(-1.0, -1.0, 1.0));
float3 tmpvar_5; float3 tmpvar_5 = 0;
tmpvar_5 = mix (tmpvar_2, _mtl_i._normal, float3(float((_mtl_i._normal.z != 0.0)))); tmpvar_5 = mix (tmpvar_2, _mtl_i._normal, float3(float((_mtl_i._normal.z != 0.0))));
tmpvar_2 = tmpvar_5; tmpvar_2 = tmpvar_5;
_mtl_o.gl_Position = tmpvar_1; _mtl_o.gl_Position = tmpvar_1;

View File

@ -36,56 +36,56 @@ struct xlatMtlShaderUniform {
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{ {
xlatMtlShaderOutput _mtl_o; xlatMtlShaderOutput _mtl_o;
float4 tmpvar_1; float4 tmpvar_1 = 0;
float3 tmpvar_2; float3 tmpvar_2 = 0;
float4 tmpvar_3; float4 tmpvar_3 = 0;
tmpvar_1 = float4(_mtl_i.TANGENT); tmpvar_1 = float4(_mtl_i.TANGENT);
tmpvar_2 = float3(_mtl_i._inNormal); tmpvar_2 = float3(_mtl_i._inNormal);
tmpvar_3 = float4(_mtl_i._color); tmpvar_3 = float4(_mtl_i._color);
float3 binormal_4; float3 binormal_4 = 0;
float4 tmpvar_5; float4 tmpvar_5 = 0;
float4 tmpvar_6; float4 tmpvar_6 = 0;
float4 pos_7; float4 pos_7 = 0;
float isBillboard_8; float isBillboard_8 = 0;
isBillboard_8 = (1.0 - abs(tmpvar_1.w)); isBillboard_8 = (1.0 - abs(tmpvar_1.w));
float4 tmpvar_9; float4 tmpvar_9 = 0;
tmpvar_9.w = 0.0; tmpvar_9.w = 0.0;
tmpvar_9.xyz = tmpvar_2; tmpvar_9.xyz = tmpvar_2;
float4 tmpvar_10; float4 tmpvar_10 = 0;
tmpvar_10.w = 0.0; tmpvar_10.w = 0.0;
tmpvar_10.xyz = tmpvar_1.xyz; tmpvar_10.xyz = tmpvar_1.xyz;
float4 tmpvar_11; float4 tmpvar_11 = 0;
tmpvar_11.zw = float2(0.0, 0.0); tmpvar_11.zw = float2(0.0, 0.0);
tmpvar_11.xy = tmpvar_2.xy; tmpvar_11.xy = tmpvar_2.xy;
pos_7 = (_mtl_i._inVertex + ((tmpvar_11 * _mtl_u.glstate_matrix_invtrans_modelview0) * isBillboard_8)); pos_7 = (_mtl_i._inVertex + ((tmpvar_11 * _mtl_u.glstate_matrix_invtrans_modelview0) * isBillboard_8));
float3 tmpvar_12; float3 tmpvar_12 = 0;
tmpvar_12 = mix (tmpvar_2, normalize((tmpvar_9 * _mtl_u.glstate_matrix_invtrans_modelview0)).xyz, float3(isBillboard_8)); tmpvar_12 = mix (tmpvar_2, normalize((tmpvar_9 * _mtl_u.glstate_matrix_invtrans_modelview0)).xyz, float3(isBillboard_8));
float4 tmpvar_13; float4 tmpvar_13 = 0;
tmpvar_13.w = -1.0; tmpvar_13.w = -1.0;
tmpvar_13.xyz = normalize((tmpvar_10 * _mtl_u.glstate_matrix_invtrans_modelview0)).xyz; tmpvar_13.xyz = normalize((tmpvar_10 * _mtl_u.glstate_matrix_invtrans_modelview0)).xyz;
float4 tmpvar_14; float4 tmpvar_14 = 0;
tmpvar_14 = mix (tmpvar_1, tmpvar_13, float4(isBillboard_8)); tmpvar_14 = mix (tmpvar_1, tmpvar_13, float4(isBillboard_8));
tmpvar_5.w = pos_7.w; tmpvar_5.w = pos_7.w;
tmpvar_6.w = tmpvar_14.w; tmpvar_6.w = tmpvar_14.w;
tmpvar_5.xyz = (pos_7.xyz * _mtl_u._Scale.xyz); tmpvar_5.xyz = (pos_7.xyz * _mtl_u._Scale.xyz);
float4 pos_15; float4 pos_15 = 0;
pos_15.w = tmpvar_5.w; pos_15.w = tmpvar_5.w;
float3 bend_16; float3 bend_16 = 0;
float2 vWavesSum_17; float2 vWavesSum_17 = 0;
float4 vWaves_18; float4 vWaves_18 = 0;
float fBranchPhase_19; float fBranchPhase_19 = 0;
fBranchPhase_19 = (dot (_mtl_u._Object2World[3].xyz, float3(1.0, 1.0, 1.0)) + tmpvar_3.x); fBranchPhase_19 = (dot (_mtl_u._Object2World[3].xyz, float3(1.0, 1.0, 1.0)) + tmpvar_3.x);
float2 tmpvar_20; float2 tmpvar_20 = 0;
tmpvar_20.x = dot (tmpvar_5.xyz, float3((tmpvar_3.y + fBranchPhase_19))); tmpvar_20.x = dot (tmpvar_5.xyz, float3((tmpvar_3.y + fBranchPhase_19)));
tmpvar_20.y = fBranchPhase_19; tmpvar_20.y = fBranchPhase_19;
vWaves_18 = ((fract( vWaves_18 = ((fract(
((_mtl_u._Time.yy + tmpvar_20).xxyy * float4(1.975, 0.793, 0.375, 0.193)) ((_mtl_u._Time.yy + tmpvar_20).xxyy * float4(1.975, 0.793, 0.375, 0.193))
) * 2.0) - 1.0); ) * 2.0) - 1.0);
float4 tmpvar_21; float4 tmpvar_21 = 0;
tmpvar_21 = abs((( tmpvar_21 = abs(((
fract((vWaves_18 + 0.5)) fract((vWaves_18 + 0.5))
* 2.0) - 1.0)); * 2.0) - 1.0));
float4 tmpvar_22; float4 tmpvar_22 = 0;
tmpvar_22 = ((tmpvar_21 * tmpvar_21) * (3.0 - (2.0 * tmpvar_21))); tmpvar_22 = ((tmpvar_21 * tmpvar_21) * (3.0 - (2.0 * tmpvar_21)));
vWaves_18 = tmpvar_22; vWaves_18 = tmpvar_22;
vWavesSum_17 = (tmpvar_22.xz + tmpvar_22.yw); vWavesSum_17 = (tmpvar_22.xz + tmpvar_22.yw);
@ -97,18 +97,18 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
((_mtl_u._Wind.xyz * vWavesSum_17.y) * _mtl_i._uv1.y) ((_mtl_u._Wind.xyz * vWavesSum_17.y) * _mtl_i._uv1.y)
) * _mtl_u._Wind.w)); ) * _mtl_u._Wind.w));
pos_15.xyz = (pos_15.xyz + (_mtl_i._uv1.x * _mtl_u._Wind.xyz)); pos_15.xyz = (pos_15.xyz + (_mtl_i._uv1.x * _mtl_u._Wind.xyz));
float3 tmpvar_23; float3 tmpvar_23 = 0;
tmpvar_23 = mix ((pos_15.xyz - ( tmpvar_23 = mix ((pos_15.xyz - (
(dot (_mtl_u._SquashPlaneNormal.xyz, pos_15.xyz) + _mtl_u._SquashPlaneNormal.w) (dot (_mtl_u._SquashPlaneNormal.xyz, pos_15.xyz) + _mtl_u._SquashPlaneNormal.w)
* _mtl_u._SquashPlaneNormal.xyz)), pos_15.xyz, float3(_mtl_u._SquashAmount)); * _mtl_u._SquashPlaneNormal.xyz)), pos_15.xyz, float3(_mtl_u._SquashAmount));
float4 tmpvar_24; float4 tmpvar_24 = 0;
tmpvar_24.w = 1.0; tmpvar_24.w = 1.0;
tmpvar_24.xyz = tmpvar_23; tmpvar_24.xyz = tmpvar_23;
tmpvar_5 = tmpvar_24; tmpvar_5 = tmpvar_24;
float4 tmpvar_25; float4 tmpvar_25 = 0;
tmpvar_25.xyz = float3(1.0, 1.0, 1.0); tmpvar_25.xyz = float3(1.0, 1.0, 1.0);
tmpvar_25.w = tmpvar_3.w; tmpvar_25.w = tmpvar_3.w;
float3 tmpvar_26; float3 tmpvar_26 = 0;
tmpvar_26 = normalize(tmpvar_12); tmpvar_26 = normalize(tmpvar_12);
tmpvar_6.xyz = normalize(tmpvar_14.xyz); tmpvar_6.xyz = normalize(tmpvar_14.xyz);
binormal_4 = (((tmpvar_26.yzx * tmpvar_6.zxy) - (tmpvar_26.zxy * tmpvar_6.yzx)) * tmpvar_14.w); binormal_4 = (((tmpvar_26.yzx * tmpvar_6.zxy) - (tmpvar_26.zxy * tmpvar_6.yzx)) * tmpvar_14.w);
@ -122,21 +122,21 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]],
tmpvar_27[2].x = tmpvar_6.z; tmpvar_27[2].x = tmpvar_6.z;
tmpvar_27[2].y = binormal_4.z; tmpvar_27[2].y = binormal_4.z;
tmpvar_27[2].z = tmpvar_26.z; tmpvar_27[2].z = tmpvar_26.z;
float4 tmpvar_28; float4 tmpvar_28 = 0;
tmpvar_28.w = 1.0; tmpvar_28.w = 1.0;
tmpvar_28.xyz = _mtl_u._WorldSpaceCameraPos; tmpvar_28.xyz = _mtl_u._WorldSpaceCameraPos;
_mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * tmpvar_24); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * tmpvar_24);
_mtl_o.xlv_TEXCOORD0 = ((_mtl_i._uv0.xy * _mtl_u._MainTex_ST.xy) + _mtl_u._MainTex_ST.zw); _mtl_o.xlv_TEXCOORD0 = ((_mtl_i._uv0.xy * _mtl_u._MainTex_ST.xy) + _mtl_u._MainTex_ST.zw);
_mtl_o.xlv_COLOR0 = half4(tmpvar_25); _mtl_o.xlv_COLOR0 = half4(tmpvar_25);
float3 tmpvar_29; float3 tmpvar_29 = 0;
tmpvar_29 = (tmpvar_27 * (_mtl_u._World2Object * _mtl_u._WorldSpaceLightPos0).xyz); tmpvar_29 = (tmpvar_27 * (_mtl_u._World2Object * _mtl_u._WorldSpaceLightPos0).xyz);
_mtl_o.xlv_TEXCOORD1 = half3(tmpvar_29); _mtl_o.xlv_TEXCOORD1 = half3(tmpvar_29);
float3 tmpvar_30; float3 tmpvar_30 = 0;
tmpvar_30 = (tmpvar_27 * (( tmpvar_30 = (tmpvar_27 * ((
(_mtl_u._World2Object * tmpvar_28) (_mtl_u._World2Object * tmpvar_28)
.xyz * _mtl_u.unity_Scale.w) - tmpvar_23)); .xyz * _mtl_u.unity_Scale.w) - tmpvar_23));
_mtl_o.xlv_TEXCOORD2 = half3(tmpvar_30); _mtl_o.xlv_TEXCOORD2 = half3(tmpvar_30);
float2 tmpvar_31; float2 tmpvar_31 = 0;
tmpvar_31 = (_mtl_u._LightMatrix0 * (_mtl_u._Object2World * tmpvar_24)).xy; tmpvar_31 = (_mtl_u._LightMatrix0 * (_mtl_u._Object2World * tmpvar_24)).xy;
_mtl_o.xlv_TEXCOORD3 = half2(tmpvar_31); _mtl_o.xlv_TEXCOORD3 = half2(tmpvar_31);
return _mtl_o; return _mtl_o;

View File

@ -25,6 +25,7 @@
- How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs. - How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs.
- How can I tell when ImGui wants my mouse/keyboard inputs and when I can pass them to my application? - How can I tell when ImGui wants my mouse/keyboard inputs and when I can pass them to my application?
- How can I load a different font than the default? - How can I load a different font than the default?
- How can I easily use icons in my application?
- How can I load multiple fonts? - How can I load multiple fonts?
- How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic? - How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?
- How can I use the drawing facilities without an ImGui window? (using ImDrawList API) - How can I use the drawing facilities without an ImGui window? (using ImDrawList API)
@ -80,7 +81,7 @@
- read the FAQ below this section! - read the FAQ below this section!
- your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention on your side, no state duplication, less sync, less bugs. - your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention on your side, no state duplication, less sync, less bugs.
- call and read ImGui::ShowTestWindow() for demo code demonstrating most features. - call and read ImGui::ShowTestWindow() for demo code demonstrating most features.
- see examples/ folder for standalone sample applications. Prefer reading examples/opengl_example/ first as it is the simplest. - see examples/ folder for standalone sample applications. Prefer reading examples/opengl2_example/ first as it is the simplest.
you may be able to grab and copy a ready made imgui_impl_*** file from the examples/. you may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
- customization: PushStyleColor()/PushStyleVar() or the style editor to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme). - customization: PushStyleColor()/PushStyleVar() or the style editor to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme).
@ -150,6 +151,9 @@
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code. Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
Also read releases logs https://github.com/ocornut/imgui/releases for more details. Also read releases logs https://github.com/ocornut/imgui/releases for more details.
- 2016/11/06 (1.50) - BeginChild(const char*) now applies the stack id to the provided label, consistently with other functions as it should always have been. It shouldn't affect you unless (extremely unlikely) you were appending multiple times to a same child from different locations of the stack id. If that's the case, generate an id with GetId() and use it instead of passing string to BeginChild().
- 2016/10/15 (1.50) - avoid 'void* user_data' parameter to io.SetClipboardTextFn/io.GetClipboardTextFn pointers. We pass io.ClipboardUserData to it.
- 2016/09/25 (1.50) - style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc.
- 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal. - 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.
- 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore. - 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore.
If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you. If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you.
@ -293,7 +297,7 @@
Also make sure your orthographic projection matrix and io.DisplaySize matches your actual framebuffer dimension. Also make sure your orthographic projection matrix and io.DisplaySize matches your actual framebuffer dimension.
Q: I integrated ImGui in my engine and some elements are clipping or disappearing when I move windows around.. Q: I integrated ImGui in my engine and some elements are clipping or disappearing when I move windows around..
A: Most likely you are mishandling the clipping rectangles in your render function. Rectangles provided by ImGui are defined as (x1,y1,x2,y2) and NOT as (x1,y1,width,height). A: Most likely you are mishandling the clipping rectangles in your render function. Rectangles provided by ImGui are defined as (x1=left,y1=top,x2=right,y2=bottom) and NOT as (x1,y1,width,height).
Q: Can I have multiple widgets with the same label? Can I have widget without a label? (Yes) Q: Can I have multiple widgets with the same label? Can I have widget without a label? (Yes)
A: Yes. A primer on the use of labels/IDs in ImGui.. A: Yes. A primer on the use of labels/IDs in ImGui..
@ -301,7 +305,7 @@
- Elements that are not clickable, such as Text() items don't need an ID. - Elements that are not clickable, such as Text() items don't need an ID.
- Interactive widgets require state to be carried over multiple frames (most typically ImGui often needs to remember what is the "active" widget). - Interactive widgets require state to be carried over multiple frames (most typically ImGui often needs to remember what is the "active" widget).
to do so they need an unique ID. unique ID are typically derived from a string label, an integer index or a pointer. to do so they need a unique ID. unique ID are typically derived from a string label, an integer index or a pointer.
Button("OK"); // Label = "OK", ID = hash of "OK" Button("OK"); // Label = "OK", ID = hash of "OK"
Button("Cancel"); // Label = "Cancel", ID = hash of "Cancel" Button("Cancel"); // Label = "Cancel", ID = hash of "Cancel"
@ -403,6 +407,10 @@
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels); io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels);
io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()
Q: How can I easily use icons in my application?
A: The most convenient and practical way is to merge an icon font such as FontAwesome inside you main font. Then you can refer to icons within your strings.
Read 'How can I load multiple fonts?' and the file 'extra_fonts/README.txt' for instructions.
Q: How can I load multiple fonts? Q: How can I load multiple fonts?
A: Use the font atlas to pack them into a single texture: A: Use the font atlas to pack them into a single texture:
(Read extra_fonts/README.txt and the code in ImFontAtlas for more details.) (Read extra_fonts/README.txt and the code in ImFontAtlas for more details.)
@ -422,13 +430,13 @@
config.GlyphExtraSpacing.x = 1.0f; config.GlyphExtraSpacing.x = 1.0f;
io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, &config); io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, &config);
// Combine multiple fonts into one // Combine multiple fonts into one (e.g. for icon fonts)
ImWchar ranges[] = { 0xf000, 0xf3ff, 0 }; ImWchar ranges[] = { 0xf000, 0xf3ff, 0 };
ImFontConfig config; ImFontConfig config;
config.MergeMode = true; config.MergeMode = true;
io.Fonts->AddFontDefault(); io.Fonts->AddFontDefault();
io.Fonts->LoadFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges); io.Fonts->LoadFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges); // Merge icon font
io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); // Merge japanese glyphs
Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic? Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
A: When loading a font, pass custom Unicode ranges to specify the glyphs to load. A: When loading a font, pass custom Unicode ranges to specify the glyphs to load.
@ -483,8 +491,9 @@
!- main: make it so that a frame with no window registered won't refocus every window on subsequent frames (~bump LastFrameActive of all windows). !- main: make it so that a frame with no window registered won't refocus every window on subsequent frames (~bump LastFrameActive of all windows).
- main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes - main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
- main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode? - main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now. - input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
- input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541) - input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
- input text: expose CursorPos in char filter event (#816)
- input text: flag to disable live update of the user buffer (also applies to float/int text input) - input text: flag to disable live update of the user buffer (also applies to float/int text input)
- input text: resize behavior - field could stretch when being edited? hover tooltip shows more text? - input text: resize behavior - field could stretch when being edited? hover tooltip shows more text?
- input text: add ImGuiInputTextFlags_EnterToApply? (off #218) - input text: add ImGuiInputTextFlags_EnterToApply? (off #218)
@ -524,7 +533,7 @@
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402) !- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
- popups: add variant using global identifier similar to Begin/End (#402) - popups: add variant using global identifier similar to Begin/End (#402)
- popups: border options. richer api like BeginChild() perhaps? (#197) - popups: border options. richer api like BeginChild() perhaps? (#197)
- tooltip: tooltip that doesn't fit in entire screen seems to lose their "last prefered button" and may teleport when moving mouse - tooltip: tooltip that doesn't fit in entire screen seems to lose their "last preferred button" and may teleport when moving mouse
- menus: local shortcuts, global shortcuts (#456, #126) - menus: local shortcuts, global shortcuts (#456, #126)
- menus: icons - menus: icons
- menus: menubars: some sort of priority / effect of main menu-bar on desktop size? - menus: menubars: some sort of priority / effect of main menu-bar on desktop size?
@ -562,7 +571,6 @@
- style: color-box not always square? - style: color-box not always square?
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc. - style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation). - style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
- style/opt: PopStyleVar could be optimized by having GetStyleVar returns the type, using a table mapping stylevar enum to data type.
- style: global scale setting. - style: global scale setting.
- style: WindowPadding needs to be EVEN needs the 0.5 multiplier probably have a subtle effect on clip rectangle - style: WindowPadding needs to be EVEN needs the 0.5 multiplier probably have a subtle effect on clip rectangle
- text: simple markup language for color change? - text: simple markup language for color change?
@ -660,6 +668,7 @@ static float GetDraggedColumnOffset(int column_index);
static bool IsKeyPressedMap(ImGuiKey key, bool repeat = true); static bool IsKeyPressedMap(ImGuiKey key, bool repeat = true);
static ImFont* GetDefaultFont();
static void SetCurrentFont(ImFont* font); static void SetCurrentFont(ImFont* font);
static void SetCurrentWindow(ImGuiWindow* window); static void SetCurrentWindow(ImGuiWindow* window);
static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y); static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y);
@ -707,8 +716,8 @@ static bool DataTypeApplyOpFromText(const char* buf, const char* ini
// Platform dependent default implementations // Platform dependent default implementations
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static const char* GetClipboardTextFn_DefaultImpl(); static const char* GetClipboardTextFn_DefaultImpl(void* user_data);
static void SetClipboardTextFn_DefaultImpl(const char* text); static void SetClipboardTextFn_DefaultImpl(void* user_data, const char* text);
static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y); static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y);
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -734,7 +743,7 @@ ImGuiStyle::ImGuiStyle()
WindowPadding = ImVec2(8,8); // Padding within a window WindowPadding = ImVec2(8,8); // Padding within a window
WindowMinSize = ImVec2(32,32); // Minimum window size WindowMinSize = ImVec2(32,32); // Minimum window size
WindowRounding = 9.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows WindowRounding = 9.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
WindowTitleAlign = ImGuiAlign_Left; // Alignment for title bar text WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text
ChildWindowRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows ChildWindowRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets) FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets). FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
@ -747,6 +756,7 @@ ImGuiStyle::ImGuiStyle()
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text.
DisplayWindowPadding = ImVec2(22,22); // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows. DisplayWindowPadding = ImVec2(22,22); // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
DisplaySafeAreaPadding = ImVec2(4,4); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. DisplaySafeAreaPadding = ImVec2(4,4); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
AntiAliasedLines = true; // Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU. AntiAliasedLines = true; // Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU.
@ -810,6 +820,7 @@ ImGuiIO::ImGuiIO()
LogFilename = "imgui_log.txt"; LogFilename = "imgui_log.txt";
Fonts = &GImDefaultFontAtlas; Fonts = &GImDefaultFontAtlas;
FontGlobalScale = 1.0f; FontGlobalScale = 1.0f;
FontDefault = NULL;
DisplayFramebufferScale = ImVec2(1.0f, 1.0f); DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
MousePos = ImVec2(-1,-1); MousePos = ImVec2(-1,-1);
MousePosPrev = ImVec2(-1,-1); MousePosPrev = ImVec2(-1,-1);
@ -832,6 +843,7 @@ ImGuiIO::ImGuiIO()
MemFreeFn = free; MemFreeFn = free;
GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;
ClipboardUserData = NULL;
ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl; ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl;
// Set OS X style defaults based on __APPLE__ compile time flag // Set OS X style defaults based on __APPLE__ compile time flag
@ -1198,16 +1210,20 @@ int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_e
ImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in) ImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in)
{ {
float s = 1.0f/255.0f; float s = 1.0f/255.0f;
return ImVec4((in & 0xFF) * s, ((in >> 8) & 0xFF) * s, ((in >> 16) & 0xFF) * s, (in >> 24) * s); return ImVec4(
((in >> IM_COL32_R_SHIFT) & 0xFF) * s,
((in >> IM_COL32_G_SHIFT) & 0xFF) * s,
((in >> IM_COL32_B_SHIFT) & 0xFF) * s,
((in >> IM_COL32_A_SHIFT) & 0xFF) * s);
} }
ImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in) ImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in)
{ {
ImU32 out; ImU32 out;
out = ((ImU32)IM_F32_TO_INT8_SAT(in.x)); out = ((ImU32)IM_F32_TO_INT8_SAT(in.x)) << IM_COL32_R_SHIFT;
out |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << 8; out |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << IM_COL32_G_SHIFT;
out |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << 16; out |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << IM_COL32_B_SHIFT;
out |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << 24; out |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << IM_COL32_A_SHIFT;
return out; return out;
} }
@ -1215,14 +1231,14 @@ ImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul)
{ {
ImVec4 c = GImGui->Style.Colors[idx]; ImVec4 c = GImGui->Style.Colors[idx];
c.w *= GImGui->Style.Alpha * alpha_mul; c.w *= GImGui->Style.Alpha * alpha_mul;
return ImGui::ColorConvertFloat4ToU32(c); return ColorConvertFloat4ToU32(c);
} }
ImU32 ImGui::GetColorU32(const ImVec4& col) ImU32 ImGui::GetColorU32(const ImVec4& col)
{ {
ImVec4 c = col; ImVec4 c = col;
c.w *= GImGui->Style.Alpha; c.w *= GImGui->Style.Alpha;
return ImGui::ColorConvertFloat4ToU32(c); return ColorConvertFloat4ToU32(c);
} }
// Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592 // Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592
@ -1831,6 +1847,8 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window = NULL)
g.ActiveId = id; g.ActiveId = id;
g.ActiveIdAllowOverlap = false; g.ActiveIdAllowOverlap = false;
g.ActiveIdIsJustActivated = true; g.ActiveIdIsJustActivated = true;
if (id)
g.ActiveIdIsAlive = true;
g.ActiveIdWindow = window; g.ActiveIdWindow = window;
} }
@ -2007,13 +2025,13 @@ void ImGui::MemFree(void* ptr)
const char* ImGui::GetClipboardText() const char* ImGui::GetClipboardText()
{ {
return GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn() : ""; return GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn(GImGui->IO.ClipboardUserData) : "";
} }
void ImGui::SetClipboardText(const char* text) void ImGui::SetClipboardText(const char* text)
{ {
if (GImGui->IO.SetClipboardTextFn) if (GImGui->IO.SetClipboardTextFn)
GImGui->IO.SetClipboardTextFn(text); GImGui->IO.SetClipboardTextFn(GImGui->IO.ClipboardUserData, text);
} }
const char* ImGui::GetVersion() const char* ImGui::GetVersion()
@ -2100,7 +2118,8 @@ void ImGui::NewFrame()
g.Initialized = true; g.Initialized = true;
} }
SetCurrentFont(g.IO.Fonts->Fonts[0]); SetCurrentFont(GetDefaultFont());
IM_ASSERT(g.Font->IsLoaded());
g.Time += g.IO.DeltaTime; g.Time += g.IO.DeltaTime;
g.FrameCount += 1; g.FrameCount += 1;
@ -2339,10 +2358,13 @@ void ImGui::Shutdown()
} }
g.Windows.clear(); g.Windows.clear();
g.WindowsSortBuffer.clear(); g.WindowsSortBuffer.clear();
g.CurrentWindow = NULL;
g.CurrentWindowStack.clear(); g.CurrentWindowStack.clear();
g.FocusedWindow = NULL; g.FocusedWindow = NULL;
g.HoveredWindow = NULL; g.HoveredWindow = NULL;
g.HoveredRootWindow = NULL; g.HoveredRootWindow = NULL;
g.ActiveIdWindow = NULL;
g.MovedWindow = NULL;
for (int i = 0; i < g.Settings.Size; i++) for (int i = 0; i < g.Settings.Size; i++)
ImGui::MemFree(g.Settings[i].Name); ImGui::MemFree(g.Settings[i].Name);
g.Settings.clear(); g.Settings.clear();
@ -2351,6 +2373,8 @@ void ImGui::Shutdown()
g.FontStack.clear(); g.FontStack.clear();
g.OpenPopupStack.clear(); g.OpenPopupStack.clear();
g.CurrentPopupStack.clear(); g.CurrentPopupStack.clear();
g.SetNextWindowSizeConstraintCallback = NULL;
g.SetNextWindowSizeConstraintCallbackUserData = NULL;
for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++) for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
g.RenderDrawLists[i].clear(); g.RenderDrawLists[i].clear();
g.OverlayDrawList.ClearFreeMemory(); g.OverlayDrawList.ClearFreeMemory();
@ -2546,8 +2570,8 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDr
} }
// Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
IM_ASSERT(draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
IM_ASSERT(draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);
// Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices) // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices)
@ -2866,8 +2890,9 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end
} }
} }
// Default clip_rect uses (pos_min,pos_max)
// Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges) // Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges)
void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, ImGuiAlign align, const ImVec2* clip_min, const ImVec2* clip_max) void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect)
{ {
// Hide anything after a '##' string // Hide anything after a '##' string
const char* text_display_end = FindRenderedTextEnd(text, text_end); const char* text_display_end = FindRenderedTextEnd(text, text_end);
@ -2882,14 +2907,15 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, cons
ImVec2 pos = pos_min; ImVec2 pos = pos_min;
const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f); const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f);
if (!clip_max) clip_max = &pos_max; const ImVec2* clip_min = clip_rect ? &clip_rect->Min : &pos_min;
const ImVec2* clip_max = clip_rect ? &clip_rect->Max : &pos_max;
bool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y); bool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y);
if (!clip_min) clip_min = &pos_min; else need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y); if (clip_rect) // If we had no explicit clipping rectangle then pos==clip_min
need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y);
// Align // Align whole block. We should defer that to the better rendering function when we'll have support for individual line alignment.
if (align & ImGuiAlign_Center) pos.x = ImMax(pos.x, (pos.x + pos_max.x - text_size.x) * 0.5f); if (align.x > 0.0f) pos.x = ImMax(pos.x, pos.x + (pos_max.x - pos.x - text_size.x) * align.x);
else if (align & ImGuiAlign_Right) pos.x = ImMax(pos.x, pos_max.x - text_size.x); if (align.y > 0.0f) pos.y = ImMax(pos.y, pos.y + (pos_max.y - pos.y - text_size.y) * align.y);
if (align & ImGuiAlign_VCenter) pos.y = ImMax(pos.y, (pos.y + pos_max.y - text_size.y) * 0.5f);
// Render // Render
if (need_clipping) if (need_clipping)
@ -2919,7 +2945,7 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
} }
// Render a triangle to denote expanded/collapsed state // Render a triangle to denote expanded/collapsed state
void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale, bool shadow) void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindow();
@ -2943,8 +2969,6 @@ void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale, bool
c = center + ImVec2(-0.500f,-0.866f)*r; c = center + ImVec2(-0.500f,-0.866f)*r;
} }
if (shadow && (window->Flags & ImGuiWindowFlags_ShowBorders) != 0)
window->DrawList->AddTriangleFilled(a+ImVec2(2,2), b+ImVec2(2,2), c+ImVec2(2,2), GetColorU32(ImGuiCol_BorderShadow));
window->DrawList->AddTriangleFilled(a, b, c, GetColorU32(ImGuiCol_Text)); window->DrawList->AddTriangleFilled(a, b, c, GetColorU32(ImGuiCol_Text));
} }
@ -3360,8 +3384,7 @@ void ImGui::EndTooltip()
static bool IsPopupOpen(ImGuiID id) static bool IsPopupOpen(ImGuiID id)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
const bool is_open = g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id; return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id;
return is_open;
} }
// Mark popup as open (toggle toward open state). // Mark popup as open (toggle toward open state).
@ -3481,11 +3504,11 @@ static bool BeginPopupEx(const char* str_id, ImGuiWindowFlags extra_flags)
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize; ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize;
char name[32]; char name[20];
if (flags & ImGuiWindowFlags_ChildMenu) if (flags & ImGuiWindowFlags_ChildMenu)
ImFormatString(name, 20, "##menu_%d", g.CurrentPopupStack.Size); // Recycle windows based on depth ImFormatString(name, IM_ARRAYSIZE(name), "##menu_%d", g.CurrentPopupStack.Size); // Recycle windows based on depth
else else
ImFormatString(name, 20, "##popup_%08x", id); // Not recycling, so we can close/open during the same frame ImFormatString(name, IM_ARRAYSIZE(name), "##popup_%08x", id); // Not recycling, so we can close/open during the same frame
bool is_open = ImGui::Begin(name, NULL, flags); bool is_open = ImGui::Begin(name, NULL, flags);
if (!(window->Flags & ImGuiWindowFlags_ShowBorders)) if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
@ -3572,12 +3595,12 @@ bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
return BeginPopup(str_id); return BeginPopup(str_id);
} }
bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
{ {
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = ImGui::GetCurrentWindow();
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow; ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
const ImVec2 content_avail = GetContentRegionAvail(); const ImVec2 content_avail = ImGui::GetContentRegionAvail();
ImVec2 size = ImFloor(size_arg); ImVec2 size = ImFloor(size_arg);
if (size.x <= 0.0f) if (size.x <= 0.0f)
{ {
@ -3596,22 +3619,28 @@ bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border,
flags |= extra_flags; flags |= extra_flags;
char title[256]; char title[256];
ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s", window->Name, str_id); if (name)
ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s.%08X", window->Name, name, id);
else
ImFormatString(title, IM_ARRAYSIZE(title), "%s.%08X", window->Name, id);
bool ret = ImGui::Begin(title, NULL, size, -1.0f, flags); bool ret = ImGui::Begin(title, NULL, size, -1.0f, flags);
if (!(window->Flags & ImGuiWindowFlags_ShowBorders)) if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
GetCurrentWindow()->Flags &= ~ImGuiWindowFlags_ShowBorders; ImGui::GetCurrentWindow()->Flags &= ~ImGuiWindowFlags_ShowBorders;
return ret; return ret;
} }
bool ImGui::BeginChild(ImGuiID id, const ImVec2& size, bool border, ImGuiWindowFlags extra_flags) bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
{ {
char str_id[32]; ImGuiWindow* window = GetCurrentWindow();
ImFormatString(str_id, IM_ARRAYSIZE(str_id), "child_%08x", id); return BeginChildEx(str_id, window->GetID(str_id), size_arg, border, extra_flags);
bool ret = ImGui::BeginChild(str_id, size, border, extra_flags); }
return ret;
bool ImGui::BeginChild(ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)
{
return BeginChildEx(NULL, id, size_arg, border, extra_flags);
} }
void ImGui::EndChild() void ImGui::EndChild()
@ -4063,7 +4092,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
if (window_pos_center) if (window_pos_center)
{ {
// Center (any sort of window) // Center (any sort of window)
SetWindowPos(ImMax(style.DisplaySafeAreaPadding, fullscreen_rect.GetCenter() - window->SizeFull * 0.5f)); SetWindowPos(window, ImMax(style.DisplaySafeAreaPadding, fullscreen_rect.GetCenter() - window->SizeFull * 0.5f), 0);
} }
else if (flags & ImGuiWindowFlags_ChildMenu) else if (flags & ImGuiWindowFlags_ChildMenu)
{ {
@ -4185,8 +4214,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f; window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
// Window background // Window background, Default Alpha
// Default alpha
ImGuiCol bg_color_idx = ImGuiCol_WindowBg; ImGuiCol bg_color_idx = ImGuiCol_WindowBg;
if ((flags & ImGuiWindowFlags_ComboBox) != 0) if ((flags & ImGuiWindowFlags_ComboBox) != 0)
bg_color_idx = ImGuiCol_ComboBg; bg_color_idx = ImGuiCol_ComboBg;
@ -4199,19 +4227,19 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
bg_color.w = bg_alpha; bg_color.w = bg_alpha;
bg_color.w *= style.Alpha; bg_color.w *= style.Alpha;
if (bg_color.w > 0.0f) if (bg_color.w > 0.0f)
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, ColorConvertFloat4ToU32(bg_color), window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? 15 : 4|8); window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, ColorConvertFloat4ToU32(bg_color), window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImGuiCorner_All : ImGuiCorner_BottomLeft|ImGuiCorner_BottomRight);
// Title bar // Title bar
if (!(flags & ImGuiWindowFlags_NoTitleBar)) if (!(flags & ImGuiWindowFlags_NoTitleBar))
window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32((g.FocusedWindow && window->RootNonPopupWindow == g.FocusedWindow->RootNonPopupWindow) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, 1|2); window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32((g.FocusedWindow && window->RootNonPopupWindow == g.FocusedWindow->RootNonPopupWindow) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImGuiCorner_TopLeft|ImGuiCorner_TopRight);
// Menu bar // Menu bar
if (flags & ImGuiWindowFlags_MenuBar) if (flags & ImGuiWindowFlags_MenuBar)
{ {
ImRect menu_bar_rect = window->MenuBarRect(); ImRect menu_bar_rect = window->MenuBarRect();
window->DrawList->AddRectFilled(menu_bar_rect.GetTL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, 1|2);
if (flags & ImGuiWindowFlags_ShowBorders) if (flags & ImGuiWindowFlags_ShowBorders)
window->DrawList->AddLine(menu_bar_rect.GetBL()-ImVec2(0,0), menu_bar_rect.GetBR()-ImVec2(0,0), GetColorU32(ImGuiCol_Border)); window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border));
window->DrawList->AddRectFilled(menu_bar_rect.GetTL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImGuiCorner_TopLeft|ImGuiCorner_TopRight);
} }
// Scrollbars // Scrollbars
@ -4303,18 +4331,19 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
const ImVec2 text_size = CalcTextSize(name, NULL, true); const ImVec2 text_size = CalcTextSize(name, NULL, true);
if (!(flags & ImGuiWindowFlags_NoCollapse)) if (!(flags & ImGuiWindowFlags_NoCollapse))
RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f, true); RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f);
ImVec2 text_min = window->Pos + style.FramePadding; ImVec2 text_min = window->Pos;
ImVec2 text_max = window->Pos + ImVec2(window->Size.x - style.FramePadding.x, style.FramePadding.y*2 + text_size.y); ImVec2 text_max = window->Pos + ImVec2(window->Size.x, style.FramePadding.y*2 + text_size.y);
ImVec2 clip_max = ImVec2(window->Pos.x + window->Size.x - (p_open ? title_bar_rect.GetHeight() - 3 : style.FramePadding.x), text_max.y); // Match the size of CloseWindowButton() ImRect clip_rect;
bool pad_left = (flags & ImGuiWindowFlags_NoCollapse) == 0; clip_rect.Max = ImVec2(window->Pos.x + window->Size.x - (p_open ? title_bar_rect.GetHeight() - 3 : style.FramePadding.x), text_max.y); // Match the size of CloseWindowButton()
bool pad_right = (p_open != NULL); float pad_left = (flags & ImGuiWindowFlags_NoCollapse) == 0 ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : style.FramePadding.x;
if (style.WindowTitleAlign & ImGuiAlign_Center) pad_right = pad_left; float pad_right = (p_open != NULL) ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : style.FramePadding.x;
if (pad_left) text_min.x += g.FontSize + style.ItemInnerSpacing.x; if (style.WindowTitleAlign.x > 0.0f) pad_right = ImLerp(pad_right, pad_left, style.WindowTitleAlign.x);
if (pad_right) text_max.x -= g.FontSize + style.ItemInnerSpacing.x; text_min.x += pad_left;
ImVec2 clip_min = ImVec2(text_min.x, window->Pos.y); text_max.x -= pad_right;
RenderTextClipped(text_min, text_max, name, NULL, &text_size, style.WindowTitleAlign, &clip_min, &clip_max); clip_rect.Min = ImVec2(text_min.x, window->Pos.y);
RenderTextClipped(text_min, text_max, name, NULL, &text_size, style.WindowTitleAlign, &clip_rect);
} }
// Save clipped aabb so we can access it in constant-time in FindHoveredWindow() // Save clipped aabb so we can access it in constant-time in FindHoveredWindow()
@ -4418,9 +4447,9 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding; float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding;
int window_rounding_corners; int window_rounding_corners;
if (horizontal) if (horizontal)
window_rounding_corners = 8 | (other_scrollbar ? 0 : 4); window_rounding_corners = ImGuiCorner_BottomLeft | (other_scrollbar ? 0 : ImGuiCorner_BottomRight);
else else
window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? 2 : 0) | (other_scrollbar ? 0 : 4); window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImGuiCorner_TopRight : 0) | (other_scrollbar ? 0 : ImGuiCorner_BottomRight);
window->DrawList->AddRectFilled(bb.Min, bb.Max, ImGui::GetColorU32(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners); window->DrawList->AddRectFilled(bb.Min, bb.Max, ImGui::GetColorU32(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners);
bb.Reduce(ImVec2(ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f))); bb.Reduce(ImVec2(ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f)));
@ -4570,6 +4599,12 @@ float ImGui::CalcItemWidth()
return w; return w;
} }
static ImFont* GetDefaultFont()
{
ImGuiContext& g = *GImGui;
return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0];
}
static void SetCurrentFont(ImFont* font) static void SetCurrentFont(ImFont* font)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
@ -4585,7 +4620,7 @@ void ImGui::PushFont(ImFont* font)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
if (!font) if (!font)
font = g.IO.Fonts->Fonts[0]; font = GetDefaultFont();
SetCurrentFont(font); SetCurrentFont(font);
g.FontStack.push_back(font); g.FontStack.push_back(font);
g.CurrentWindow->DrawList->PushTextureID(font->ContainerAtlas->TexID); g.CurrentWindow->DrawList->PushTextureID(font->ContainerAtlas->TexID);
@ -4596,7 +4631,7 @@ void ImGui::PopFont()
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
g.CurrentWindow->DrawList->PopTextureID(); g.CurrentWindow->DrawList->PopTextureID();
g.FontStack.pop_back(); g.FontStack.pop_back();
SetCurrentFont(g.FontStack.empty() ? g.IO.Fonts->Fonts[0] : g.FontStack.back()); SetCurrentFont(g.FontStack.empty() ? GetDefaultFont() : g.FontStack.back());
} }
void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus) void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus)
@ -4646,7 +4681,7 @@ void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col)
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiColMod backup; ImGuiColMod backup;
backup.Col = idx; backup.Col = idx;
backup.PreviousValue = g.Style.Colors[idx]; backup.BackupValue = g.Style.Colors[idx];
g.ColorModifiers.push_back(backup); g.ColorModifiers.push_back(backup);
g.Style.Colors[idx] = col; g.Style.Colors[idx] = col;
} }
@ -4657,65 +4692,66 @@ void ImGui::PopStyleColor(int count)
while (count > 0) while (count > 0)
{ {
ImGuiColMod& backup = g.ColorModifiers.back(); ImGuiColMod& backup = g.ColorModifiers.back();
g.Style.Colors[backup.Col] = backup.PreviousValue; g.Style.Colors[backup.Col] = backup.BackupValue;
g.ColorModifiers.pop_back(); g.ColorModifiers.pop_back();
count--; count--;
} }
} }
static float* GetStyleVarFloatAddr(ImGuiStyleVar idx) struct ImGuiStyleVarInfo
{ {
ImGuiContext& g = *GImGui; ImGuiDataType Type;
switch (idx) ImU32 Offset;
{ void* GetVarPtr() const { return (void*)((unsigned char*)&GImGui->Style + Offset); }
case ImGuiStyleVar_Alpha: return &g.Style.Alpha; };
case ImGuiStyleVar_WindowRounding: return &g.Style.WindowRounding;
case ImGuiStyleVar_ChildWindowRounding: return &g.Style.ChildWindowRounding;
case ImGuiStyleVar_FrameRounding: return &g.Style.FrameRounding;
case ImGuiStyleVar_IndentSpacing: return &g.Style.IndentSpacing;
case ImGuiStyleVar_GrabMinSize: return &g.Style.GrabMinSize;
case ImGuiStyleVar_ViewId: return &g.Style.ViewId;
}
return NULL;
}
static ImVec2* GetStyleVarVec2Addr(ImGuiStyleVar idx) static const ImGuiStyleVarInfo GStyleVarInfo[ImGuiStyleVar_Count_] =
{ {
ImGuiContext& g = *GImGui; { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) },
switch (idx) { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowPadding) },
{ { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowRounding) },
case ImGuiStyleVar_WindowPadding: return &g.Style.WindowPadding; { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowMinSize) },
case ImGuiStyleVar_WindowMinSize: return &g.Style.WindowMinSize; { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildWindowRounding) },
case ImGuiStyleVar_FramePadding: return &g.Style.FramePadding; { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) },
case ImGuiStyleVar_ItemSpacing: return &g.Style.ItemSpacing; { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) },
case ImGuiStyleVar_ItemInnerSpacing: return &g.Style.ItemInnerSpacing; { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) },
} { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) },
return NULL; { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, IndentSpacing) },
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabMinSize) },
{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) },
{ ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ViewId) },
};
static const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx)
{
IM_ASSERT(idx >= 0 && idx < ImGuiStyleVar_Count_);
return &GStyleVarInfo[idx];
} }
void ImGui::PushStyleVar(ImGuiStyleVar idx, float val) void ImGui::PushStyleVar(ImGuiStyleVar idx, float val)
{ {
ImGuiContext& g = *GImGui; const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx);
float* pvar = GetStyleVarFloatAddr(idx); if (var_info->Type == ImGuiDataType_Float)
IM_ASSERT(pvar != NULL); // Called function with wrong-type? Variable is not a float. {
ImGuiStyleMod backup; float* pvar = (float*)var_info->GetVarPtr();
backup.Var = idx; GImGui->StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar));
backup.PreviousValue = ImVec2(*pvar, 0.0f);
g.StyleModifiers.push_back(backup);
*pvar = val; *pvar = val;
return;
}
IM_ASSERT(0); // Called function with wrong-type? Variable is not a float.
} }
void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val) void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)
{ {
ImGuiContext& g = *GImGui; const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx);
ImVec2* pvar = GetStyleVarVec2Addr(idx); if (var_info->Type == ImGuiDataType_Float2)
IM_ASSERT(pvar != NULL); // Called function with wrong-type? Variable is not a ImVec2. {
ImGuiStyleMod backup; ImVec2* pvar = (ImVec2*)var_info->GetVarPtr();
backup.Var = idx; GImGui->StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar));
backup.PreviousValue = *pvar;
g.StyleModifiers.push_back(backup);
*pvar = val; *pvar = val;
return;
}
IM_ASSERT(0); // Called function with wrong-type? Variable is not a ImVec2.
} }
void ImGui::PopStyleVar(int count) void ImGui::PopStyleVar(int count)
@ -4724,10 +4760,10 @@ void ImGui::PopStyleVar(int count)
while (count > 0) while (count > 0)
{ {
ImGuiStyleMod& backup = g.StyleModifiers.back(); ImGuiStyleMod& backup = g.StyleModifiers.back();
if (float* pvar_f = GetStyleVarFloatAddr(backup.Var)) const ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx);
*pvar_f = backup.PreviousValue.x; if (info->Type == ImGuiDataType_Float) (*(float*)info->GetVarPtr()) = backup.BackupFloat[0];
else if (ImVec2* pvar_v = GetStyleVarVec2Addr(backup.Var)) else if (info->Type == ImGuiDataType_Float2) (*(ImVec2*)info->GetVarPtr()) = ImVec2(backup.BackupFloat[0], backup.BackupFloat[1]);
*pvar_v = backup.PreviousValue; else if (info->Type == ImGuiDataType_Int) (*(int*)info->GetVarPtr()) = backup.BackupInt[0];
g.StyleModifiers.pop_back(); g.StyleModifiers.pop_back();
count--; count--;
} }
@ -4860,14 +4896,13 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond co
void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCond cond) void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCond cond)
{ {
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindowRead();
SetWindowPos(window, pos, cond); SetWindowPos(window, pos, cond);
} }
void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond) void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond)
{ {
ImGuiWindow* window = FindWindowByName(name); if (ImGuiWindow* window = FindWindowByName(name))
if (window)
SetWindowPos(window, pos, cond); SetWindowPos(window, pos, cond);
} }
@ -5448,7 +5483,7 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
// Render // Render
const char* value_text_begin = &g.TempBuffer[0]; const char* value_text_begin = &g.TempBuffer[0];
const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImGuiAlign_VCenter); RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImVec2(0.0f,0.5f));
if (label_size.x > 0.0f) if (label_size.x > 0.0f)
RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
} }
@ -5565,7 +5600,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
const ImVec2 label_size = CalcTextSize(label, NULL, true); const ImVec2 label_size = CalcTextSize(label, NULL, true);
ImVec2 pos = window->DC.CursorPos; ImVec2 pos = window->DC.CursorPos;
if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag)
pos.y += window->DC.CurrentLineTextBaseOffset - style.FramePadding.y; pos.y += window->DC.CurrentLineTextBaseOffset - style.FramePadding.y;
ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f); ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
@ -5581,7 +5616,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
// Render // Render
const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
RenderTextClipped(bb.Min, bb.Max, label, NULL, &label_size, ImGuiAlign_Center | ImGuiAlign_VCenter); RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
// Automatically close popups // Automatically close popups
//if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup)) //if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
@ -5790,8 +5825,7 @@ void ImGui::LogFinish()
} }
if (g.LogClipboard->size() > 1) if (g.LogClipboard->size() > 1)
{ {
if (g.IO.SetClipboardTextFn) SetClipboardText(g.LogClipboard->begin());
g.IO.SetClipboardTextFn(g.LogClipboard->begin());
g.LogClipboard->clear(); g.LogClipboard->clear();
} }
} }
@ -5941,7 +5975,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
{ {
// Framed type // Framed type
RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
RenderCollapseTriangle(bb.Min + padding + ImVec2(0.0f, text_base_offset_y), is_open, 1.0f, true); RenderCollapseTriangle(bb.Min + padding + ImVec2(0.0f, text_base_offset_y), is_open, 1.0f);
if (g.LogEnabled) if (g.LogEnabled)
{ {
// NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here. // NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.
@ -5965,7 +5999,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
if (flags & ImGuiTreeNodeFlags_Bullet) if (flags & ImGuiTreeNodeFlags_Bullet)
RenderBullet(bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize*0.50f + text_base_offset_y)); RenderBullet(bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize*0.50f + text_base_offset_y));
else if (!(flags & ImGuiTreeNodeFlags_Leaf)) else if (!(flags & ImGuiTreeNodeFlags_Leaf))
RenderCollapseTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), is_open, 0.70f, false); RenderCollapseTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), is_open, 0.70f);
if (g.LogEnabled) if (g.LogEnabled)
LogRenderedText(text_pos, ">"); LogRenderedText(text_pos, ">");
RenderText(text_pos, label, label_end, false); RenderText(text_pos, label, label_end, false);
@ -6101,7 +6135,7 @@ void ImGui::TreeAdvanceToLabelPos()
g.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing(); g.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing();
} }
// Horizontal distance preceeding label when using TreeNode() or Bullet() // Horizontal distance preceding label when using TreeNode() or Bullet()
float ImGui::GetTreeNodeToLabelSpacing() float ImGui::GetTreeNodeToLabelSpacing()
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
@ -6580,7 +6614,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
// Display value using user-provided display format so user can add prefix/suffix/decorations to the value. // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
char value_buf[64]; char value_buf[64];
const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center|ImGuiAlign_VCenter); RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f));
if (label_size.x > 0.0f) if (label_size.x > 0.0f)
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
@ -6627,7 +6661,7 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float
// For the vertical slider we allow centered text to overlap the frame padding // For the vertical slider we allow centered text to overlap the frame padding
char value_buf[64]; char value_buf[64];
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center); RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.0f));
if (label_size.x > 0.0f) if (label_size.x > 0.0f)
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
@ -6877,7 +6911,7 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f
// Display value using user-provided display format so user can add prefix/suffix/decorations to the value. // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
char value_buf[64]; char value_buf[64];
const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center|ImGuiAlign_VCenter); RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f));
if (label_size.x > 0.0f) if (label_size.x > 0.0f)
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);
@ -7071,6 +7105,8 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
if (values_count > 0)
{
int res_w = ImMin((int)graph_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); int res_w = ImMin((int)graph_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);
int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);
@ -7125,10 +7161,11 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
t0 = t1; t0 = t1;
tp0 = tp1; tp0 = tp1;
} }
}
// Text overlay // Text overlay
if (overlay_text) if (overlay_text)
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImGuiAlign_Center); RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImVec2(0.5f,0.0f));
if (label_size.x > 0.0f) if (label_size.x > 0.0f)
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);
@ -7204,7 +7241,7 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over
ImVec2 overlay_size = CalcTextSize(overlay, NULL); ImVec2 overlay_size = CalcTextSize(overlay, NULL);
if (overlay_size.x > 0.0f) if (overlay_size.x > 0.0f)
RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImGuiAlign_Left|ImGuiAlign_VCenter, &bb.Min, &bb.Max); RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImVec2(0.0f,0.5f), &bb);
} }
bool ImGui::Checkbox(const char* label, bool* v) bool ImGui::Checkbox(const char* label, bool* v)
@ -7419,12 +7456,12 @@ static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* ob
static bool is_separator(unsigned int c) { return ImCharIsSpace(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; } static bool is_separator(unsigned int c) { return ImCharIsSpace(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; }
static int is_word_boundary_from_right(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (is_separator( obj->Text[idx-1] ) && !is_separator( obj->Text[idx] ) ) : 1; } static int is_word_boundary_from_right(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (is_separator( obj->Text[idx-1] ) && !is_separator( obj->Text[idx] ) ) : 1; }
static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; } static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }
#ifdef __APPLE__ // FIXME: Move setting to IO structure #ifdef __APPLE__ // FIXME: Move setting to IO structure
static int is_word_boundary_from_left(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (!is_separator( obj->Text[idx-1] ) && is_separator( obj->Text[idx] ) ) : 1; } static int is_word_boundary_from_left(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (!is_separator( obj->Text[idx-1] ) && is_separator( obj->Text[idx] ) ) : 1; }
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; } static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; }
#else #else
static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; } static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; }
#endif #endif
#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h #define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h
#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL #define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL
@ -7605,11 +7642,13 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
const ImGuiIO& io = g.IO; const ImGuiIO& io = g.IO;
const ImGuiStyle& style = g.Style; const ImGuiStyle& style = g.Style;
const ImGuiID id = window->GetID(label);
const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0; const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0;
const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0; const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0;
const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0; const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;
if (is_multiline) // Open group before calling GetID() because groups tracks id created during their spawn
BeginGroup();
const ImGuiID id = window->GetID(label);
const ImVec2 label_size = CalcTextSize(label, NULL, true); const ImVec2 label_size = CalcTextSize(label, NULL, true);
ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y*2.0f); // Arbitrary default of 8 lines high for multi-line ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y*2.0f); // Arbitrary default of 8 lines high for multi-line
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size); const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);
@ -7618,7 +7657,6 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
ImGuiWindow* draw_window = window; ImGuiWindow* draw_window = window;
if (is_multiline) if (is_multiline)
{ {
BeginGroup();
if (!BeginChildFrame(id, frame_bb.GetSize())) if (!BeginChildFrame(id, frame_bb.GetSize()))
{ {
EndChildFrame(); EndChildFrame();
@ -7849,7 +7887,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
const int ie = edit_state.HasSelection() ? ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end) : edit_state.CurLenW; const int ie = edit_state.HasSelection() ? ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end) : edit_state.CurLenW;
edit_state.TempTextBuffer.resize((ie-ib) * 4 + 1); edit_state.TempTextBuffer.resize((ie-ib) * 4 + 1);
ImTextStrToUtf8(edit_state.TempTextBuffer.Data, edit_state.TempTextBuffer.Size, edit_state.Text.Data+ib, edit_state.Text.Data+ie); ImTextStrToUtf8(edit_state.TempTextBuffer.Data, edit_state.TempTextBuffer.Size, edit_state.Text.Data+ib, edit_state.Text.Data+ie);
io.SetClipboardTextFn(edit_state.TempTextBuffer.Data); SetClipboardText(edit_state.TempTextBuffer.Data);
} }
if (cut) if (cut)
@ -7861,7 +7899,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_V) && is_editable) else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_V) && is_editable)
{ {
// Paste // Paste
if (const char* clipboard = io.GetClipboardTextFn ? io.GetClipboardTextFn() : NULL) if (const char* clipboard = GetClipboardText())
{ {
// Filter pasted buffer // Filter pasted buffer
const int clipboard_len = (int)strlen(clipboard); const int clipboard_len = (int)strlen(clipboard);
@ -8145,8 +8183,6 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
Dummy(text_size + ImVec2(0.0f, g.FontSize)); // Always add room to scroll an extra line Dummy(text_size + ImVec2(0.0f, g.FontSize)); // Always add room to scroll an extra line
EndChildFrame(); EndChildFrame();
EndGroup(); EndGroup();
if (g.ActiveId == id || is_currently_scrolling) // Set LastItemId which was lost by EndChild/EndGroup, so user can use IsItemActive()
window->DC.LastItemId = g.ActiveId;
} }
if (is_password) if (is_password)
@ -8200,7 +8236,7 @@ bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data
if (!(extra_flags & ImGuiInputTextFlags_CharsHexadecimal)) if (!(extra_flags & ImGuiInputTextFlags_CharsHexadecimal))
extra_flags |= ImGuiInputTextFlags_CharsDecimal; extra_flags |= ImGuiInputTextFlags_CharsDecimal;
extra_flags |= ImGuiInputTextFlags_AutoSelectAll; extra_flags |= ImGuiInputTextFlags_AutoSelectAll;
if (InputText("", buf, IM_ARRAYSIZE(buf), extra_flags)) if (InputText("", buf, IM_ARRAYSIZE(buf), extra_flags)) // PushId(label) + "" gives us the expected ID from outside point of view
value_changed = DataTypeApplyOpFromText(buf, GImGui->InputTextState.InitialText.begin(), data_type, data_ptr, scalar_format); value_changed = DataTypeApplyOpFromText(buf, GImGui->InputTextState.InitialText.begin(), data_type, data_ptr, scalar_format);
// Step buttons // Step buttons
@ -8239,7 +8275,7 @@ bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast,
if (decimal_precision < 0) if (decimal_precision < 0)
strcpy(display_format, "%f"); // Ideally we'd have a minimum decimal precision of 1 to visually denote that this is a float, while hiding non-significant digits? %f doesn't have a minimum of 1 strcpy(display_format, "%f"); // Ideally we'd have a minimum decimal precision of 1 to visually denote that this is a float, while hiding non-significant digits? %f doesn't have a minimum of 1
else else
ImFormatString(display_format, 16, "%%.%df", decimal_precision); ImFormatString(display_format, IM_ARRAYSIZE(display_format), "%%.%df", decimal_precision);
return InputScalarEx(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), display_format, extra_flags); return InputScalarEx(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), display_format, extra_flags);
} }
@ -8418,7 +8454,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
{ {
const char* item_text; const char* item_text;
if (items_getter(data, *current_item, &item_text)) if (items_getter(data, *current_item, &item_text))
RenderTextClipped(frame_bb.Min + style.FramePadding, value_bb.Max, item_text, NULL, NULL); RenderTextClipped(frame_bb.Min + style.FramePadding, value_bb.Max, item_text, NULL, NULL, ImVec2(0.0f,0.0f));
} }
if (label_size.x > 0) if (label_size.x > 0)
@ -8564,7 +8600,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
} }
if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
RenderTextClipped(bb.Min, bb_with_spacing.Max, label, NULL, &label_size); RenderTextClipped(bb.Min, bb_with_spacing.Max, label, NULL, &label_size, ImVec2(0.0f,0.0f));
if (flags & ImGuiSelectableFlags_Disabled) PopStyleColor(); if (flags & ImGuiSelectableFlags_Disabled) PopStyleColor();
// Automatically close popups // Automatically close popups
@ -8840,7 +8876,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale? tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale?
tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f); tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f);
moving_within_opened_triangle = ImIsPointInTriangle(g.IO.MousePos, ta, tb, tc); moving_within_opened_triangle = ImIsPointInTriangle(g.IO.MousePos, ta, tb, tc);
//window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? 0x80008000 : 0x80000080); window->DrawList->PopClipRect(); // Debug //window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); window->DrawList->PopClipRect(); // Debug
} }
} }
@ -9084,8 +9120,8 @@ void ImGui::Separator()
if (!window->DC.GroupStack.empty()) if (!window->DC.GroupStack.empty())
x1 += window->DC.IndentX; x1 += window->DC.IndentX;
const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y)); const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y+1.0f));
ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit // FIXME: Height should be 1.0f not 0.0f ? ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout.
if (!ItemAdd(bb, NULL)) if (!ItemAdd(bb, NULL))
{ {
if (window->DC.ColumnsCount > 1) if (window->DC.ColumnsCount > 1)
@ -9093,7 +9129,7 @@ void ImGui::Separator()
return; return;
} }
window->DrawList->AddLine(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border)); window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x,bb.Min.y), GetColorU32(ImGuiCol_Border));
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
if (g.LogEnabled) if (g.LogEnabled)
@ -9147,9 +9183,11 @@ void ImGui::BeginGroup()
group_data.BackupCursorPos = window->DC.CursorPos; group_data.BackupCursorPos = window->DC.CursorPos;
group_data.BackupCursorMaxPos = window->DC.CursorMaxPos; group_data.BackupCursorMaxPos = window->DC.CursorMaxPos;
group_data.BackupIndentX = window->DC.IndentX; group_data.BackupIndentX = window->DC.IndentX;
group_data.BackupGroupOffsetX = window->DC.GroupOffsetX;
group_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight; group_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight;
group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset; group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset;
group_data.BackupLogLinePosY = window->DC.LogLinePosY; group_data.BackupLogLinePosY = window->DC.LogLinePosY;
group_data.BackupActiveIdIsAlive = GImGui->ActiveIdIsAlive;
group_data.AdvanceCursor = true; group_data.AdvanceCursor = true;
window->DC.GroupOffsetX = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffsetX; window->DC.GroupOffsetX = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffsetX;
@ -9161,15 +9199,15 @@ void ImGui::BeginGroup()
void ImGui::EndGroup() void ImGui::EndGroup()
{ {
ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindow();
ImGuiStyle& style = GetStyle();
IM_ASSERT(!window->DC.GroupStack.empty()); // Mismatched BeginGroup()/EndGroup() calls IM_ASSERT(!window->DC.GroupStack.empty()); // Mismatched BeginGroup()/EndGroup() calls
ImGuiGroupData& group_data = window->DC.GroupStack.back(); ImGuiGroupData& group_data = window->DC.GroupStack.back();
ImRect group_bb(group_data.BackupCursorPos, window->DC.CursorMaxPos); ImRect group_bb(group_data.BackupCursorPos, window->DC.CursorMaxPos);
group_bb.Max.y -= style.ItemSpacing.y; // Cancel out last vertical spacing because we are adding one ourselves. group_bb.Max.y -= g.Style.ItemSpacing.y; // Cancel out last vertical spacing because we are adding one ourselves.
group_bb.Max = ImMax(group_bb.Min, group_bb.Max); group_bb.Max = ImMax(group_bb.Min, group_bb.Max);
window->DC.CursorPos = group_data.BackupCursorPos; window->DC.CursorPos = group_data.BackupCursorPos;
@ -9177,7 +9215,7 @@ void ImGui::EndGroup()
window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight; window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight;
window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset; window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset;
window->DC.IndentX = group_data.BackupIndentX; window->DC.IndentX = group_data.BackupIndentX;
window->DC.GroupOffsetX = window->DC.IndentX; window->DC.GroupOffsetX = group_data.BackupGroupOffsetX;
window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;
if (group_data.AdvanceCursor) if (group_data.AdvanceCursor)
@ -9187,9 +9225,17 @@ void ImGui::EndGroup()
ItemAdd(group_bb, NULL); ItemAdd(group_bb, NULL);
} }
// If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive() will function on the entire group.
// It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but if you search for LastItemId you'll notice it is only used in that context.
const bool active_id_within_group = (!group_data.BackupActiveIdIsAlive && g.ActiveIdIsAlive && g.ActiveId && g.ActiveIdWindow->RootWindow == window->RootWindow);
if (active_id_within_group)
window->DC.LastItemId = g.ActiveId;
if (active_id_within_group && g.HoveredId == g.ActiveId)
window->DC.LastItemHoveredAndUsable = window->DC.LastItemHoveredRect = true;
window->DC.GroupStack.pop_back(); window->DC.GroupStack.pop_back();
//window->DrawList->AddRect(group_bb.Min, group_bb.Max, 0xFFFF00FF); // Debug //window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255)); // Debug
} }
// Gets back to previous line and continue with horizontal layout // Gets back to previous line and continue with horizontal layout
@ -9425,7 +9471,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index); const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index);
KeepAliveID(column_id); KeepAliveID(column_id);
const float default_t = column_index / (float)window->DC.ColumnsCount; const float default_t = column_index / (float)window->DC.ColumnsCount;
const float t = window->DC.StateStorage->GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store an union into the map?) const float t = window->DC.StateStorage->GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store a union into the map?)
window->DC.ColumnsData[column_index].OffsetNorm = t; window->DC.ColumnsData[column_index].OffsetNorm = t;
} }
window->DrawList->ChannelsSplit(window->DC.ColumnsCount); window->DrawList->ChannelsSplit(window->DC.ColumnsCount);
@ -9527,17 +9573,11 @@ void ImGui::ValueColor(const char* prefix, ImU32 v)
{ {
Text("%s: %08X", prefix, v); Text("%s: %08X", prefix, v);
SameLine(); SameLine();
ColorButton(ColorConvertU32ToFloat4(v), true);
ImVec4 col;
col.x = (float)((v >> 0) & 0xFF) / 255.0f;
col.y = (float)((v >> 8) & 0xFF) / 255.0f;
col.z = (float)((v >> 16) & 0xFF) / 255.0f;
col.w = (float)((v >> 24) & 0xFF) / 255.0f;
ColorButton(col, true);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// PLATFORM DEPENDANT HELPERS // PLATFORM DEPENDENT HELPERS
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS)) #if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS))
@ -9553,7 +9593,7 @@ void ImGui::ValueColor(const char* prefix, ImU32 v)
#pragma comment(lib, "user32") #pragma comment(lib, "user32")
#endif #endif
static const char* GetClipboardTextFn_DefaultImpl() static const char* GetClipboardTextFn_DefaultImpl(void*)
{ {
static ImVector<char> buf_local; static ImVector<char> buf_local;
buf_local.clear(); buf_local.clear();
@ -9573,7 +9613,7 @@ static const char* GetClipboardTextFn_DefaultImpl()
return buf_local.Data; return buf_local.Data;
} }
static void SetClipboardTextFn_DefaultImpl(const char* text) static void SetClipboardTextFn_DefaultImpl(void*, const char* text)
{ {
if (!OpenClipboard(NULL)) if (!OpenClipboard(NULL))
return; return;
@ -9592,13 +9632,13 @@ static void SetClipboardTextFn_DefaultImpl(const char* text)
#else #else
// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers // Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers
static const char* GetClipboardTextFn_DefaultImpl() static const char* GetClipboardTextFn_DefaultImpl(void*)
{ {
return GImGui->PrivateClipboard; return GImGui->PrivateClipboard;
} }
// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers // Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers
static void SetClipboardTextFn_DefaultImpl(const char* text) static void SetClipboardTextFn_DefaultImpl(void*, const char* text)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
if (g.PrivateClipboard) if (g.PrivateClipboard)
@ -9732,6 +9772,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window)) if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
return; return;
NodeDrawList(window->DrawList, "DrawList"); NodeDrawList(window->DrawList, "DrawList");
ImGui::BulletText("Pos: (%.1f,%.1f)", window->Pos.x, window->Pos.y);
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y); ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y); ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow"); if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");

View File

@ -30,7 +30,7 @@
#endif #endif
// Some compilers support applying printf-style warnings to user functions. // Some compilers support applying printf-style warnings to user functions.
#if defined(__clang__) || defined(__GNUC__) #if 0 // defined(__clang__) || defined(__GNUC__)
#define IM_PRINTFARGS(FMT) __attribute__((format(printf, FMT, (FMT+1)))) #define IM_PRINTFARGS(FMT) __attribute__((format(printf, FMT, (FMT+1))))
#else #else
#define IM_PRINTFARGS(FMT) #define IM_PRINTFARGS(FMT)
@ -70,7 +70,6 @@ typedef void* ImTextureID; // user data to identify a texture (this is
typedef int ImGuiCol; // a color identifier for styling // enum ImGuiCol_ typedef int ImGuiCol; // a color identifier for styling // enum ImGuiCol_
typedef int ImGuiStyleVar; // a variable identifier for styling // enum ImGuiStyleVar_ typedef int ImGuiStyleVar; // a variable identifier for styling // enum ImGuiStyleVar_
typedef int ImGuiKey; // a key identifier (ImGui-side enum) // enum ImGuiKey_ typedef int ImGuiKey; // a key identifier (ImGui-side enum) // enum ImGuiKey_
typedef int ImGuiAlign; // alignment // enum ImGuiAlign_
typedef int ImGuiColorEditMode; // color edit mode for ColorEdit*() // enum ImGuiColorEditMode_ typedef int ImGuiColorEditMode; // color edit mode for ColorEdit*() // enum ImGuiColorEditMode_
typedef int ImGuiMouseCursor; // a mouse cursor identifier // enum ImGuiMouseCursor_ typedef int ImGuiMouseCursor; // a mouse cursor identifier // enum ImGuiMouseCursor_
typedef int ImGuiWindowFlags; // window flags for Begin*() // enum ImGuiWindowFlags_ typedef int ImGuiWindowFlags; // window flags for Begin*() // enum ImGuiWindowFlags_
@ -332,7 +331,7 @@ namespace ImGui
IMGUI_API void TreePush(const void* ptr_id = NULL); // " IMGUI_API void TreePush(const void* ptr_id = NULL); // "
IMGUI_API void TreePop(); // ~ Unindent()+PopId() IMGUI_API void TreePop(); // ~ Unindent()+PopId()
IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing() IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing()
IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceeding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0); // set next TreeNode/CollapsingHeader open state. IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0); // set next TreeNode/CollapsingHeader open state.
IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop(). IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header
@ -647,17 +646,9 @@ enum ImGuiStyleVar_
ImGuiStyleVar_ItemInnerSpacing, // ImVec2 ImGuiStyleVar_ItemInnerSpacing, // ImVec2
ImGuiStyleVar_IndentSpacing, // float ImGuiStyleVar_IndentSpacing, // float
ImGuiStyleVar_GrabMinSize, // float ImGuiStyleVar_GrabMinSize, // float
ImGuiStyleVar_ViewId // uint8_t ImGuiStyleVar_ButtonTextAlign, // flags ImGuiAlign_*
}; ImGuiStyleVar_ViewId, // uint8_t
ImGuiStyleVar_Count_
enum ImGuiAlign_
{
ImGuiAlign_Left = 1 << 0,
ImGuiAlign_Center = 1 << 1,
ImGuiAlign_Right = 1 << 2,
ImGuiAlign_Top = 1 << 3,
ImGuiAlign_VCenter = 1 << 4,
ImGuiAlign_Default = ImGuiAlign_Left | ImGuiAlign_Top
}; };
// Enumeration for ColorEditMode() // Enumeration for ColorEditMode()
@ -674,6 +665,7 @@ enum ImGuiColorEditMode_
// Enumeration for GetMouseCursor() // Enumeration for GetMouseCursor()
enum ImGuiMouseCursor_ enum ImGuiMouseCursor_
{ {
ImGuiMouseCursor_None = -1,
ImGuiMouseCursor_Arrow = 0, ImGuiMouseCursor_Arrow = 0,
ImGuiMouseCursor_TextInput, // When hovering over InputText, etc. ImGuiMouseCursor_TextInput, // When hovering over InputText, etc.
ImGuiMouseCursor_Move, // Unused ImGuiMouseCursor_Move, // Unused
@ -700,7 +692,7 @@ struct ImGuiStyle
ImVec2 WindowPadding; // Padding within a window ImVec2 WindowPadding; // Padding within a window
ImVec2 WindowMinSize; // Minimum window size ImVec2 WindowMinSize; // Minimum window size
float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
ImGuiAlign WindowTitleAlign; // Alignment for title bar text ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.
float ChildWindowRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows float ChildWindowRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows
ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets) ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets)
float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
@ -714,6 +706,7 @@ struct ImGuiStyle
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar
float ViewId; float ViewId;
float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f,0.5f) for horizontally+vertically centered.
ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows. ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
bool AntiAliasedLines; // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. bool AntiAliasedLines; // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU.
@ -748,6 +741,7 @@ struct ImGuiIO
ImFontAtlas* Fonts; // <auto> // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array. ImFontAtlas* Fonts; // <auto> // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.
float FontGlobalScale; // = 1.0f // Global scale all fonts float FontGlobalScale; // = 1.0f // Global scale all fonts
bool FontAllowUserScaling; // = false // Allow user scaling text of individual window with CTRL+Wheel. bool FontAllowUserScaling; // = false // Allow user scaling text of individual window with CTRL+Wheel.
ImFont* FontDefault; // = NULL // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0].
ImVec2 DisplayFramebufferScale; // = (1.0f,1.0f) // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui. ImVec2 DisplayFramebufferScale; // = (1.0f,1.0f) // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
ImVec2 DisplayVisibleMin; // <unset> (0.0f,0.0f) // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area. ImVec2 DisplayVisibleMin; // <unset> (0.0f,0.0f) // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area.
ImVec2 DisplayVisibleMax; // <unset> (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize ImVec2 DisplayVisibleMax; // <unset> (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
@ -766,8 +760,9 @@ struct ImGuiIO
// Optional: access OS clipboard // Optional: access OS clipboard
// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
const char* (*GetClipboardTextFn)(); const char* (*GetClipboardTextFn)(void* user_data);
void (*SetClipboardTextFn)(const char* text); void (*SetClipboardTextFn)(void* user_data, const char* text);
void* ClipboardUserData;
// Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer. // Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer.
// (default to posix malloc/free) // (default to posix malloc/free)
@ -813,7 +808,7 @@ struct ImGuiIO
int MetricsActiveWindows; // Number of visible windows (exclude child windows) int MetricsActiveWindows; // Number of visible windows (exclude child windows)
//------------------------------------------------------------------ //------------------------------------------------------------------
// [Internal] ImGui will maintain those fields for you // [Private] ImGui will maintain those fields. Forward compatibility not guaranteed!
//------------------------------------------------------------------ //------------------------------------------------------------------
ImVec2 MousePosPrev; // Previous mouse position ImVec2 MousePosPrev; // Previous mouse position
@ -960,10 +955,9 @@ struct ImGuiTextBuffer
}; };
// Helper: Simple Key->value storage // Helper: Simple Key->value storage
// - Store collapse state for a tree (Int 0/1)
// - Store color edit options (Int using values in ImGuiColorEditMode enum).
// - Custom user storage for temporary values.
// Typically you don't have to worry about this since a storage is held within each Window. // Typically you don't have to worry about this since a storage is held within each Window.
// We use it to e.g. store collapse state for a tree (Int 0/1), store color edit options.
// You can use it as custom user storage for temporary values.
// Declare your own storage if: // Declare your own storage if:
// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). // - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state).
// - You want to store custom debug data easily without adding or editing structures in your code. // - You want to store custom debug data easily without adding or editing structures in your code.
@ -995,9 +989,8 @@ struct ImGuiStorage
// - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.
// - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.
// - A typical use case where this is convenient: // - A typical use case where this is convenient for quick hacking (e.g. add storage during a live Edit&Continue session if you can't modify existing struct)
// float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar;
// - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application.
IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0); IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);
IMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false); IMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false);
IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f); IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f);
@ -1045,17 +1038,36 @@ struct ImGuiSizeConstraintCallbackData
ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing.
}; };
// Helpers macros to generate 32-bits encoded colors
#ifdef IMGUI_USE_BGRA_PACKED_COLOR
#define IM_COL32_R_SHIFT 16
#define IM_COL32_G_SHIFT 8
#define IM_COL32_B_SHIFT 0
#define IM_COL32_A_SHIFT 24
#define IM_COL32_A_MASK 0xFF000000
#else
#define IM_COL32_R_SHIFT 0
#define IM_COL32_G_SHIFT 8
#define IM_COL32_B_SHIFT 16
#define IM_COL32_A_SHIFT 24
#define IM_COL32_A_MASK 0xFF000000
#endif
#define IM_COL32(R,G,B,A) (((ImU32)(A)<<IM_COL32_A_SHIFT) | ((ImU32)(B)<<IM_COL32_B_SHIFT) | ((ImU32)(G)<<IM_COL32_G_SHIFT) | ((ImU32)(R)<<IM_COL32_R_SHIFT))
#define IM_COL32_WHITE IM_COL32(255,255,255,255) // Opaque white
#define IM_COL32_BLACK IM_COL32(0,0,0,255) // Opaque black
#define IM_COL32_BLACK_TRANS IM_COL32(0,0,0,0) // Transparent black
// ImColor() helper to implicity converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float) // ImColor() helper to implicity converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float)
// Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with ImDrawList API. // Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with ImDrawList API.
// Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class. // **Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class.
// None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. // **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats.
struct ImColor struct ImColor
{ {
ImVec4 Value; ImVec4 Value;
ImColor() { Value.x = Value.y = Value.z = Value.w = 0.0f; } ImColor() { Value.x = Value.y = Value.z = Value.w = 0.0f; }
ImColor(int r, int g, int b, int a = 255) { float sc = 1.0f/255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; } ImColor(int r, int g, int b, int a = 255) { float sc = 1.0f/255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; }
ImColor(ImU32 rgba) { float sc = 1.0f/255.0f; Value.x = (float)(rgba&0xFF) * sc; Value.y = (float)((rgba>>8)&0xFF) * sc; Value.z = (float)((rgba>>16)&0xFF) * sc; Value.w = (float)(rgba >> 24) * sc; } ImColor(ImU32 rgba) { float sc = 1.0f/255.0f; Value.x = (float)((rgba>>IM_COL32_R_SHIFT)&0xFF) * sc; Value.y = (float)((rgba>>IM_COL32_G_SHIFT)&0xFF) * sc; Value.z = (float)((rgba>>IM_COL32_B_SHIFT)&0xFF) * sc; Value.w = (float)((rgba>>IM_COL32_A_SHIFT)&0xFF) * sc; }
ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; } ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }
ImColor(const ImVec4& col) { Value = col; } ImColor(const ImVec4& col) { Value = col; }
inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); }
@ -1101,12 +1113,6 @@ struct ImGuiListClipper
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. // Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Helpers macros to generate 32-bits encoded colors
#define IM_COL32(R,G,B,A) (((ImU32)(A)<<24) | ((ImU32)(B)<<16) | ((ImU32)(G)<<8) | ((ImU32)(R)))
#define IM_COL32_WHITE (0xFFFFFFFF)
#define IM_COL32_BLACK (0xFF000000)
#define IM_COL32_BLACK_TRANS (0x00000000) // Transparent black
// Draw callbacks for advanced uses. // Draw callbacks for advanced uses.
// NB- You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that) // NB- You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that)
// Draw callback may be useful for example, A) Change your GPU render state, B) render a complex 3D scene inside a UI element (without an intermediate texture/render target), etc. // Draw callback may be useful for example, A) Change your GPU render state, B) render a complex 3D scene inside a UI element (without an intermediate texture/render target), etc.
@ -1168,7 +1174,7 @@ struct ImDrawList
ImVector<ImDrawVert> VtxBuffer; // Vertex buffer. ImVector<ImDrawVert> VtxBuffer; // Vertex buffer.
// [Internal, used while building lists] // [Internal, used while building lists]
const char* _OwnerName; // Pointer to owner window's name (if any) for debugging const char* _OwnerName; // Pointer to owner window's name for debugging
unsigned int _VtxCurrentIdx; // [Internal] == VtxBuffer.Size unsigned int _VtxCurrentIdx; // [Internal] == VtxBuffer.Size
ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
@ -1189,8 +1195,8 @@ struct ImDrawList
// Primitives // Primitives
IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f); IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F, float thickness = 1.0f); // a: upper-left, b: lower-right IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ~0, float thickness = 1.0f); // a: upper-left, b: lower-right, rounding_corners_flags: 4-bits corresponding to which corner to round
IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F); // a: upper-left, b: lower-right IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ~0); // a: upper-left, b: lower-right
IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left); IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left);
IMGUI_API void AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness = 1.0f); IMGUI_API void AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness = 1.0f);
IMGUI_API void AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col); IMGUI_API void AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col);
@ -1214,7 +1220,7 @@ struct ImDrawList
IMGUI_API void PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10); IMGUI_API void PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10);
IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle
IMGUI_API void PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0); IMGUI_API void PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0);
IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners = 0x0F); IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners_flags = ~0); // rounding_corners_flags: 4-bits corresponding to which corner to round
// Channels // Channels
// - Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives) // - Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives)
@ -1392,9 +1398,7 @@ struct ImFont
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
//---- Include imgui_user.h at the end of imgui.h // Include imgui_user.h at the end of imgui.h (convenient for user to only explicitly include vanilla imgui.h)
//---- So you can include code that extends ImGui using any of the types declared above.
//---- (also convenient for user to only explicitly include vanilla imgui.h)
#ifdef IMGUI_INCLUDE_IMGUI_USER_H #ifdef IMGUI_INCLUDE_IMGUI_USER_H
#include "imgui_user.h" #include "imgui_user.h"
#endif #endif

View File

@ -30,7 +30,9 @@
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
#pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal #pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal
#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. #pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
#if __has_warning("-Wreserved-id-macro")
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // #pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
#endif
#elif defined(__GNUC__) #elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size
#pragma GCC diagnostic ignored "-Wformat-security" // warning : format string is not a string literal (potentially insecure) #pragma GCC diagnostic ignored "-Wformat-security" // warning : format string is not a string literal (potentially insecure)
@ -71,7 +73,13 @@ static void ShowHelpMarker(const char* desc)
{ {
ImGui::TextDisabled("(?)"); ImGui::TextDisabled("(?)");
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
ImGui::SetTooltip(desc); {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(450.0f);
ImGui::TextUnformatted(desc);
ImGui::PopTextWrapPos();
ImGui::EndTooltip();
}
} }
void ImGui::ShowUserGuide() void ImGui::ShowUserGuide()
@ -349,18 +357,18 @@ void ImGui::ShowTestWindow(bool* p_open)
ImGui::Text("Test paragraph 1:"); ImGui::Text("Test paragraph 1:");
ImVec2 pos = ImGui::GetCursorScreenPos(); ImVec2 pos = ImGui::GetCursorScreenPos();
ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), 0xFFFF00FF); ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), IM_COL32(255,0,255,255));
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width);
ImGui::Text("lazy dog. This paragraph is made to fit within %.0f pixels. The quick brown fox jumps over the lazy dog.", wrap_width); ImGui::Text("lazy dog. This paragraph is made to fit within %.0f pixels. The quick brown fox jumps over the lazy dog.", wrap_width);
ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), 0xFF00FFFF); ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255,255,0,255));
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImGui::Text("Test paragraph 2:"); ImGui::Text("Test paragraph 2:");
pos = ImGui::GetCursorScreenPos(); pos = ImGui::GetCursorScreenPos();
ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), 0xFFFF00FF); ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), IM_COL32(255,0,255,255));
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width);
ImGui::Text("aaaaaaaa bbbbbbbb, cccccccc,dddddddd. eeeeeeee ffffffff. gggggggg!hhhhhhhh"); ImGui::Text("aaaaaaaa bbbbbbbb, cccccccc,dddddddd. eeeeeeee ffffffff. gggggggg!hhhhhhhh");
ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), 0xFF00FFFF); ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255,255,0,255));
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImGui::TreePop(); ImGui::TreePop();
@ -790,7 +798,7 @@ void ImGui::ShowTestWindow(bool* p_open)
ImGui::Separator(); ImGui::Separator();
ImGui::PushItemWidth(100); ImGui::Combo("func", &func_type, "Sin\0Saw\0"); ImGui::PopItemWidth(); ImGui::PushItemWidth(100); ImGui::Combo("func", &func_type, "Sin\0Saw\0"); ImGui::PopItemWidth();
ImGui::SameLine(); ImGui::SameLine();
ImGui::SliderInt("Sample count", &display_count, 1, 500); ImGui::SliderInt("Sample count", &display_count, 1, 400);
float (*func)(void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw; float (*func)(void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw;
ImGui::PlotLines("Lines", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80)); ImGui::PlotLines("Lines", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80));
ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80)); ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80));
@ -896,7 +904,7 @@ void ImGui::ShowTestWindow(bool* p_open)
if (ImGui::TreeNode("Basic Horizontal Layout")) if (ImGui::TreeNode("Basic Horizontal Layout"))
{ {
ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceeding item)"); ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceding item)");
// Text // Text
ImGui::Text("Two items: Hello"); ImGui::SameLine(); ImGui::Text("Two items: Hello"); ImGui::SameLine();
@ -1415,9 +1423,9 @@ void ImGui::ShowTestWindow(bool* p_open)
ImGui::InputFloat("blue", &bar, 0.05f, 0, 3); ImGui::InputFloat("blue", &bar, 0.05f, 0, 3);
ImGui::NextColumn(); ImGui::NextColumn();
if (ImGui::CollapsingHeader("Category A")) ImGui::Text("Blah blah blah"); ImGui::NextColumn(); if (ImGui::CollapsingHeader("Category A")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn();
if (ImGui::CollapsingHeader("Category B")) ImGui::Text("Blah blah blah"); ImGui::NextColumn(); if (ImGui::CollapsingHeader("Category B")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn();
if (ImGui::CollapsingHeader("Category C")) ImGui::Text("Blah blah blah"); ImGui::NextColumn(); if (ImGui::CollapsingHeader("Category C")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn();
ImGui::Columns(1); ImGui::Columns(1);
ImGui::Separator(); ImGui::Separator();
ImGui::TreePop(); ImGui::TreePop();
@ -1534,7 +1542,7 @@ void ImGui::ShowTestWindow(bool* p_open)
if (ImGui::TreeNode("Dragging")) if (ImGui::TreeNode("Dragging"))
{ {
ImGui::TextWrapped("You can use ImGui::GetItemActiveDragDelta() to query for the dragged amount on any widget."); ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget.");
ImGui::Button("Drag Me"); ImGui::Button("Drag Me");
if (ImGui::IsItemActive()) if (ImGui::IsItemActive())
{ {
@ -1632,7 +1640,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui::TreePop(); ImGui::TreePop();
} }
if (ImGui::TreeNode("Sizes")) if (ImGui::TreeNode("Settings"))
{ {
ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f"); ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f");
@ -1647,6 +1655,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 16.0f, "%.0f"); ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 16.0f, "%.0f");
ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 16.0f, "%.0f"); ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 16.0f, "%.0f");
ImGui::Text("Alignment");
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); ShowHelpMarker("Alignment applies when a button is larger than its text content.");
ImGui::TreePop(); ImGui::TreePop();
} }
@ -1722,13 +1733,14 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImFont* font = atlas->Fonts[i]; ImFont* font = atlas->Fonts[i];
ImGui::BulletText("Font %d: \'%s\', %.2f px, %d glyphs", i, font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size); ImGui::BulletText("Font %d: \'%s\', %.2f px, %d glyphs", i, font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size);
ImGui::TreePush((void*)(intptr_t)i); ImGui::TreePush((void*)(intptr_t)i);
if (i > 0) { ImGui::SameLine(); if (ImGui::SmallButton("Set as default")) { atlas->Fonts[i] = atlas->Fonts[0]; atlas->Fonts[0] = font; } } ImGui::SameLine(); if (ImGui::SmallButton("Set as default")) ImGui::GetIO().FontDefault = font;
ImGui::PushFont(font); ImGui::PushFont(font);
ImGui::Text("The quick brown fox jumps over the lazy dog"); ImGui::Text("The quick brown fox jumps over the lazy dog");
ImGui::PopFont(); ImGui::PopFont();
if (ImGui::TreeNode("Details")) if (ImGui::TreeNode("Details"))
{ {
ImGui::DragFloat("font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // scale only this font ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font
ImGui::SameLine(); ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)");
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent); ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar); ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar);
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++) for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
@ -1736,6 +1748,47 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImFontConfig* cfg = &font->ConfigData[config_i]; ImFontConfig* cfg = &font->ConfigData[config_i];
ImGui::BulletText("Input %d: \'%s\'\nOversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH); ImGui::BulletText("Input %d: \'%s\'\nOversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH);
} }
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
{
// Display all glyphs of the fonts in separate pages of 256 characters
const ImFont::Glyph* glyph_fallback = font->FallbackGlyph; // Forcefully/dodgily make FindGlyph() return NULL on fallback, which isn't the default behavior.
font->FallbackGlyph = NULL;
for (int base = 0; base < 0x10000; base += 256)
{
int count = 0;
for (int n = 0; n < 256; n++)
count += font->FindGlyph((ImWchar)(base + n)) ? 1 : 0;
if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base+255, count, count > 1 ? "glyphs" : "glyph"))
{
float cell_spacing = style.ItemSpacing.y;
ImVec2 cell_size(font->FontSize * 1, font->FontSize * 1);
ImVec2 base_pos = ImGui::GetCursorScreenPos();
ImDrawList* draw_list = ImGui::GetWindowDrawList();
for (int n = 0; n < 256; n++)
{
ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size.x + cell_spacing), base_pos.y + (n / 16) * (cell_size.y + cell_spacing));
ImVec2 cell_p2(cell_p1.x + cell_size.x, cell_p1.y + cell_size.y);
const ImFont::Glyph* glyph = font->FindGlyph((ImWchar)(base+n));;
draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255,255,255,100) : IM_COL32(255,255,255,50));
font->RenderChar(draw_list, cell_size.x, cell_p1, ImGui::GetColorU32(ImGuiCol_Text), (ImWchar)(base+n)); // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.
if (glyph && ImGui::IsMouseHoveringRect(cell_p1, cell_p2))
{
ImGui::BeginTooltip();
ImGui::Text("Codepoint: U+%04X", base+n);
ImGui::Separator();
ImGui::Text("XAdvance+1: %.1f", glyph->XAdvance);
ImGui::Text("Pos: (%.2f,%.2f)->(%.2f,%.2f)", glyph->X0, glyph->Y0, glyph->X1, glyph->Y1);
ImGui::Text("UV: (%.3f,%.3f)->(%.3f,%.3f)", glyph->U0, glyph->V0, glyph->U1, glyph->V1);
ImGui::EndTooltip();
}
}
ImGui::Dummy(ImVec2((cell_size.x + cell_spacing) * 16, (cell_size.y + cell_spacing) * 16));
ImGui::TreePop();
}
}
font->FallbackGlyph = glyph_fallback;
ImGui::TreePop();
}
ImGui::TreePop(); ImGui::TreePop();
} }
ImGui::TreePop(); ImGui::TreePop();
@ -1873,8 +1926,8 @@ static void ShowExampleAppConstrainedResize(bool* p_open)
"Custom: Fixed Steps (100)", "Custom: Fixed Steps (100)",
}; };
ImGui::Combo("Constraint", &type, desc, IM_ARRAYSIZE(desc)); ImGui::Combo("Constraint", &type, desc, IM_ARRAYSIZE(desc));
if (ImGui::Button("200x200")) ImGui::SetWindowSize(ImVec2(200,200)); ImGui::SameLine(); if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200,200)); } ImGui::SameLine();
if (ImGui::Button("500x500")) ImGui::SetWindowSize(ImVec2(500,500)); ImGui::SameLine(); if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500,500)); } ImGui::SameLine();
if (ImGui::Button("800x200")) ImGui::SetWindowSize(ImVec2(800,200)); if (ImGui::Button("800x200")) ImGui::SetWindowSize(ImVec2(800,200));
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
ImGui::Text("Hello, sailor! Making this line long enough for the example."); ImGui::Text("Hello, sailor! Making this line long enough for the example.");
@ -1988,14 +2041,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
bool adding_preview = false; bool adding_preview = false;
ImGui::InvisibleButton("canvas", canvas_size); ImGui::InvisibleButton("canvas", canvas_size);
if (ImGui::IsItemHovered())
{
ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y); ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y);
if (!adding_line && ImGui::IsMouseClicked(0))
{
points.push_back(mouse_pos_in_canvas);
adding_line = true;
}
if (adding_line) if (adding_line)
{ {
adding_preview = true; adding_preview = true;
@ -2003,6 +2049,13 @@ static void ShowExampleAppCustomRendering(bool* p_open)
if (!ImGui::GetIO().MouseDown[0]) if (!ImGui::GetIO().MouseDown[0])
adding_line = adding_preview = false; adding_line = adding_preview = false;
} }
if (ImGui::IsItemHovered())
{
if (!adding_line && ImGui::IsMouseClicked(0))
{
points.push_back(mouse_pos_in_canvas);
adding_line = true;
}
if (ImGui::IsMouseClicked(1) && !points.empty()) if (ImGui::IsMouseClicked(1) && !points.empty())
{ {
adding_line = adding_preview = false; adding_line = adding_preview = false;
@ -2012,7 +2065,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
} }
draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y)); // clip lines within the canvas (if we resize it, etc.) draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y)); // clip lines within the canvas (if we resize it, etc.)
for (int i = 0; i < points.Size - 1; i += 2) for (int i = 0; i < points.Size - 1; i += 2)
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), 0xFF00FFFF, 2.0f); draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f);
draw_list->PopClipRect(); draw_list->PopClipRect();
if (adding_preview) if (adding_preview)
points.pop_back(); points.pop_back();
@ -2088,8 +2141,8 @@ struct ExampleAppConsole
// TODO: display items starting from the bottom // TODO: display items starting from the bottom
if (ImGui::SmallButton("Add Dummy Text")) { AddLog("%d some text", Items.Size); AddLog("some more text"); AddLog("display very important message here!"); } ImGui::SameLine(); if (ImGui::SmallButton("Add Dummy Text")) { AddLog("%d some text", Items.Size); AddLog("some more text"); AddLog("display very important message here!"); } ImGui::SameLine();
if (ImGui::SmallButton("Add Dummy Error")) AddLog("[error] something went wrong"); ImGui::SameLine(); if (ImGui::SmallButton("Add Dummy Error")) { AddLog("[error] something went wrong"); } ImGui::SameLine();
if (ImGui::SmallButton("Clear")) ClearLog(); ImGui::SameLine(); if (ImGui::SmallButton("Clear")) { ClearLog(); } ImGui::SameLine();
if (ImGui::SmallButton("Scroll to bottom")) ScrollToBottom = true; if (ImGui::SmallButton("Scroll to bottom")) ScrollToBottom = true;
//static float t = 0.0f; if (ImGui::GetTime() - t > 0.02f) { t = ImGui::GetTime(); AddLog("Spam %f", t); } //static float t = 0.0f; if (ImGui::GetTime() - t > 0.02f) { t = ImGui::GetTime(); AddLog("Spam %f", t); }
@ -2143,7 +2196,7 @@ struct ExampleAppConsole
if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), ImGuiInputTextFlags_EnterReturnsTrue|ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_CallbackHistory, &TextEditCallbackStub, (void*)this)) if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), ImGuiInputTextFlags_EnterReturnsTrue|ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_CallbackHistory, &TextEditCallbackStub, (void*)this))
{ {
char* input_end = InputBuf+strlen(InputBuf); char* input_end = InputBuf+strlen(InputBuf);
while (input_end > InputBuf && input_end[-1] == ' ') input_end--; *input_end = 0; while (input_end > InputBuf && input_end[-1] == ' ') { input_end--; } *input_end = 0;
if (InputBuf[0]) if (InputBuf[0])
ExecCommand(InputBuf); ExecCommand(InputBuf);
strcpy(InputBuf, ""); strcpy(InputBuf, "");

View File

@ -39,7 +39,9 @@
#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok. #pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
#if __has_warning("-Wreserved-id-macro")
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // #pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
#endif
#elif defined(__GNUC__) #elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
@ -431,7 +433,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
{ {
// Anti-aliased stroke // Anti-aliased stroke
const float AA_SIZE = 1.0f; const float AA_SIZE = 1.0f;
const ImU32 col_trans = col & 0x00ffffff; const ImU32 col_trans = col & IM_COL32(255,255,255,0);
const int idx_count = thick_line ? count*18 : count*12; const int idx_count = thick_line ? count*18 : count*12;
const int vtx_count = thick_line ? points_count*4 : points_count*3; const int vtx_count = thick_line ? points_count*4 : points_count*3;
@ -604,7 +606,7 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun
{ {
// Anti-aliased Fill // Anti-aliased Fill
const float AA_SIZE = 1.0f; const float AA_SIZE = 1.0f;
const ImU32 col_trans = col & 0x00ffffff; const ImU32 col_trans = col & IM_COL32(255,255,255,0);
const int idx_count = (points_count-2)*3 + points_count*6; const int idx_count = (points_count-2)*3 + points_count*6;
const int vtx_count = (points_count*2); const int vtx_count = (points_count*2);
PrimReserve(idx_count, vtx_count); PrimReserve(idx_count, vtx_count);
@ -799,7 +801,7 @@ void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, int
void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness) void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
PathLineTo(a + ImVec2(0.5f,0.5f)); PathLineTo(a + ImVec2(0.5f,0.5f));
PathLineTo(b + ImVec2(0.5f,0.5f)); PathLineTo(b + ImVec2(0.5f,0.5f));
@ -807,21 +809,21 @@ void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thic
} }
// a: upper-left, b: lower-right. we don't render 1 px sized rectangles properly. // a: upper-left, b: lower-right. we don't render 1 px sized rectangles properly.
void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners, float thickness) void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners_flags, float thickness)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.5f,0.5f), rounding, rounding_corners); PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.5f,0.5f), rounding, rounding_corners_flags);
PathStroke(col, true, thickness); PathStroke(col, true, thickness);
} }
void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners) void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners_flags)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
if (rounding > 0.0f) if (rounding > 0.0f)
{ {
PathRect(a, b, rounding, rounding_corners); PathRect(a, b, rounding, rounding_corners_flags);
PathFill(col); PathFill(col);
} }
else else
@ -833,7 +835,7 @@ void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, floa
void ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left) void ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
{ {
if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) >> 24) == 0) if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0)
return; return;
const ImVec2 uv = GImGui->FontTexUvWhitePixel; const ImVec2 uv = GImGui->FontTexUvWhitePixel;
@ -848,7 +850,7 @@ void ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32
void ImDrawList::AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness) void ImDrawList::AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
PathLineTo(a); PathLineTo(a);
@ -860,7 +862,7 @@ void ImDrawList::AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, cons
void ImDrawList::AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col) void ImDrawList::AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
PathLineTo(a); PathLineTo(a);
@ -872,7 +874,7 @@ void ImDrawList::AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c
void ImDrawList::AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness) void ImDrawList::AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
PathLineTo(a); PathLineTo(a);
@ -883,7 +885,7 @@ void ImDrawList::AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c,
void ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col) void ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
PathLineTo(a); PathLineTo(a);
@ -894,7 +896,7 @@ void ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec
void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments, float thickness) void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments, float thickness)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments; const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;
@ -904,7 +906,7 @@ void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int nu
void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments) void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments; const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;
@ -914,7 +916,7 @@ void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col,
void ImDrawList::AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments) void ImDrawList::AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
PathLineTo(pos0); PathLineTo(pos0);
@ -924,7 +926,7 @@ void ImDrawList::AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImV
void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect) void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
if (text_end == NULL) if (text_end == NULL)
@ -959,7 +961,7 @@ void ImDrawList::AddText(const ImVec2& pos, ImU32 col, const char* text_begin, c
void ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col) void ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col)
{ {
if ((col >> 24) == 0) if ((col & IM_COL32_A_MASK) == 0)
return; return;
// FIXME-OPT: This is wasting draw calls. // FIXME-OPT: This is wasting draw calls.
@ -1121,7 +1123,7 @@ void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_wid
const unsigned char* src = pixels; const unsigned char* src = pixels;
unsigned int* dst = TexPixelsRGBA32; unsigned int* dst = TexPixelsRGBA32;
for (int n = TexWidth * TexHeight; n > 0; n--) for (int n = TexWidth * TexHeight; n > 0; n--)
*dst++ = ((unsigned int)(*src++) << 24) | 0x00FFFFFF; *dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++));
} }
*out_pixels = (unsigned char*)TexPixelsRGBA32; *out_pixels = (unsigned char*)TexPixelsRGBA32;
@ -1169,7 +1171,7 @@ static void Decode85(const unsigned char* src, unsigned char* dst)
while (*src) while (*src)
{ {
unsigned int tmp = Decode85Byte(src[0]) + 85*(Decode85Byte(src[1]) + 85*(Decode85Byte(src[2]) + 85*(Decode85Byte(src[3]) + 85*Decode85Byte(src[4])))); unsigned int tmp = Decode85Byte(src[0]) + 85*(Decode85Byte(src[1]) + 85*(Decode85Byte(src[2]) + 85*(Decode85Byte(src[3]) + 85*Decode85Byte(src[4]))));
dst[0] = ((tmp >> 0) & 0xFF); dst[1] = ((tmp >> 8) & 0xFF); dst[2] = ((tmp >> 16) & 0xFF); dst[3] = ((tmp >> 24) & 0xFF); // We can't assume little-endianess. dst[0] = ((tmp >> 0) & 0xFF); dst[1] = ((tmp >> 8) & 0xFF); dst[2] = ((tmp >> 16) & 0xFF); dst[3] = ((tmp >> 24) & 0xFF); // We can't assume little-endianness.
src += 5; src += 5;
dst += 4; dst += 4;
} }
@ -1184,7 +1186,7 @@ ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
font_cfg.OversampleH = font_cfg.OversampleV = 1; font_cfg.OversampleH = font_cfg.OversampleV = 1;
font_cfg.PixelSnapH = true; font_cfg.PixelSnapH = true;
} }
if (font_cfg.Name[0] == '\0') strcpy(font_cfg.Name, "<default>"); if (font_cfg.Name[0] == '\0') strcpy(font_cfg.Name, "ProggyClean.ttf, 13px");
const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85(); const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, 13.0f, &font_cfg, GetGlyphRangesDefault()); ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, 13.0f, &font_cfg, GetGlyphRangesDefault());
@ -1206,7 +1208,7 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels,
// Store a short copy of filename into into the font name for convenience // Store a short copy of filename into into the font name for convenience
const char* p; const char* p;
for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {} for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
snprintf(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s", p); snprintf(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels);
} }
return AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg, glyph_ranges); return AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg, glyph_ranges);
} }
@ -1843,7 +1845,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
} }
} }
const float char_width = ((int)c < IndexXAdvance.Size) ? IndexXAdvance[(int)c] * scale : FallbackXAdvance; const float char_width = ((int)c < IndexXAdvance.Size ? IndexXAdvance[(int)c] : FallbackXAdvance) * scale;
if (ImCharIsSpace(c)) if (ImCharIsSpace(c))
{ {
if (inside_word) if (inside_word)
@ -1942,7 +1944,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
else else
{ {
s += ImTextCharFromUtf8(&c, s, text_end); s += ImTextCharFromUtf8(&c, s, text_end);
if (c == 0) if (c == 0) // Malformed UTF-8?
break; break;
} }
@ -2000,7 +2002,7 @@ void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip) const void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip) const
{ {
if (!text_end) if (!text_end)
text_end = text_begin + strlen(text_begin); text_end = text_begin + strlen(text_begin); // ImGui functions generally already provides a valid text_end, so this is merely to handle direct calls.
// Align to be pixel perfect // Align to be pixel perfect
pos.x = (float)(int)pos.x + DisplayOffset.x; pos.x = (float)(int)pos.x + DisplayOffset.x;
@ -2068,7 +2070,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
else else
{ {
s += ImTextCharFromUtf8(&c, s, text_end); s += ImTextCharFromUtf8(&c, s, text_end);
if (c == 0) if (c == 0) // Malformed UTF-8?
break; break;
} }
@ -2326,7 +2328,7 @@ static const char proggy_clean_ttf_compressed_data_base85[11980+1] =
"%(?A%R$f<->Zts'^kn=-^@c4%-pY6qI%J%1IGxfLU9CP8cbPlXv);C=b),<2mOvP8up,UVf3839acAWAW-W?#ao/^#%KYo8fRULNd2.>%m]UK:n%r$'sw]J;5pAoO_#2mO3n,'=H5(et" "%(?A%R$f<->Zts'^kn=-^@c4%-pY6qI%J%1IGxfLU9CP8cbPlXv);C=b),<2mOvP8up,UVf3839acAWAW-W?#ao/^#%KYo8fRULNd2.>%m]UK:n%r$'sw]J;5pAoO_#2mO3n,'=H5(et"
"Hg*`+RLgv>=4U8guD$I%D:W>-r5V*%j*W:Kvej.Lp$<M-SGZ':+Q_k+uvOSLiEo(<aD/K<CCc`'Lx>'?;++O'>()jLR-^u68PHm8ZFWe+ej8h:9r6L*0//c&iH&R8pRbA#Kjm%upV1g:" "Hg*`+RLgv>=4U8guD$I%D:W>-r5V*%j*W:Kvej.Lp$<M-SGZ':+Q_k+uvOSLiEo(<aD/K<CCc`'Lx>'?;++O'>()jLR-^u68PHm8ZFWe+ej8h:9r6L*0//c&iH&R8pRbA#Kjm%upV1g:"
"a_#Ur7FuA#(tRh#.Y5K+@?3<-8m0$PEn;J:rh6?I6uG<-`wMU'ircp0LaE_OtlMb&1#6T.#FDKu#1Lw%u%+GM+X'e?YLfjM[VO0MbuFp7;>Q&#WIo)0@F%q7c#4XAXN-U&VB<HFF*qL(" "a_#Ur7FuA#(tRh#.Y5K+@?3<-8m0$PEn;J:rh6?I6uG<-`wMU'ircp0LaE_OtlMb&1#6T.#FDKu#1Lw%u%+GM+X'e?YLfjM[VO0MbuFp7;>Q&#WIo)0@F%q7c#4XAXN-U&VB<HFF*qL("
"$/V,;(kXZejWO`<[5??ewY(*9=%wDc;,u<'9t3W-(H1th3+G]ucQ]kLs7df($/*JL]@*t7Bu_G3_7mp7<iaQjO@.kLg;x3B0lqp7Hf,^Ze7-##@/c58Mo(3;knp0%)A7?-W+eI'o8)b<" "$/V,;(kXZejWO`<[5?\?ewY(*9=%wDc;,u<'9t3W-(H1th3+G]ucQ]kLs7df($/*JL]@*t7Bu_G3_7mp7<iaQjO@.kLg;x3B0lqp7Hf,^Ze7-##@/c58Mo(3;knp0%)A7?-W+eI'o8)b<"
"nKnw'Ho8C=Y>pqB>0ie&jhZ[?iLR@@_AvA-iQC(=ksRZRVp7`.=+NpBC%rh&3]R:8XDmE5^V8O(x<<aG/1N$#FX$0V5Y6x'aErI3I$7x%E`v<-BY,)%-?Psf*l?%C3.mM(=/M0:JxG'?" "nKnw'Ho8C=Y>pqB>0ie&jhZ[?iLR@@_AvA-iQC(=ksRZRVp7`.=+NpBC%rh&3]R:8XDmE5^V8O(x<<aG/1N$#FX$0V5Y6x'aErI3I$7x%E`v<-BY,)%-?Psf*l?%C3.mM(=/M0:JxG'?"
"7WhH%o'a<-80g0NBxoO(GH<dM]n.+%q@jH?f.UsJ2Ggs&4<-e47&Kl+f//9@`b+?.TeN_&B8Ss?v;^Trk;f#YvJkl&w$]>-+k?'(<S:68tq*WoDfZu';mM?8X[ma8W%*`-=;D.(nc7/;" "7WhH%o'a<-80g0NBxoO(GH<dM]n.+%q@jH?f.UsJ2Ggs&4<-e47&Kl+f//9@`b+?.TeN_&B8Ss?v;^Trk;f#YvJkl&w$]>-+k?'(<S:68tq*WoDfZu';mM?8X[ma8W%*`-=;D.(nc7/;"
")g:T1=^J$&BRV(-lTmNB6xqB[@0*o.erM*<SWF]u2=st-*(6v>^](H.aREZSi,#1:[IXaZFOm<-ui#qUq2$##Ri;u75OK#(RtaW-K-F`S+cF]uN`-KMQ%rP/Xri.LRcB##=YL3BgM/3M" ")g:T1=^J$&BRV(-lTmNB6xqB[@0*o.erM*<SWF]u2=st-*(6v>^](H.aREZSi,#1:[IXaZFOm<-ui#qUq2$##Ri;u75OK#(RtaW-K-F`S+cF]uN`-KMQ%rP/Xri.LRcB##=YL3BgM/3M"

View File

@ -75,6 +75,7 @@ extern IMGUI_API ImGuiContext* GImGui; // current implicit ImGui context po
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR))) #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR)))
#define IM_PI 3.14159265358979323846f #define IM_PI 3.14159265358979323846f
#define IM_OFFSETOF(_TYPE,_ELM) ((size_t)&(((_TYPE*)0)->_ELM))
// Helpers: UTF-8 <> wchar // Helpers: UTF-8 <> wchar
IMGUI_API int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count IMGUI_API int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count
@ -192,7 +193,17 @@ enum ImGuiPlotType
enum ImGuiDataType enum ImGuiDataType
{ {
ImGuiDataType_Int, ImGuiDataType_Int,
ImGuiDataType_Float ImGuiDataType_Float,
ImGuiDataType_Float2,
};
enum ImGuiCorner
{
ImGuiCorner_TopLeft = 1 << 0, // 1
ImGuiCorner_TopRight = 1 << 1, // 2
ImGuiCorner_BottomRight = 1 << 2, // 4
ImGuiCorner_BottomLeft = 1 << 3, // 8
ImGuiCorner_All = 0x0F
}; };
// 2D axis aligned bounding-box // 2D axis aligned bounding-box
@ -241,14 +252,17 @@ struct IMGUI_API ImRect
struct ImGuiColMod struct ImGuiColMod
{ {
ImGuiCol Col; ImGuiCol Col;
ImVec4 PreviousValue; ImVec4 BackupValue;
}; };
// Stacked style modifier, backup of modified data so we can restore it // Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable.
struct ImGuiStyleMod struct ImGuiStyleMod
{ {
ImGuiStyleVar Var; ImGuiStyleVar VarIdx;
ImVec2 PreviousValue; union { int BackupInt[2]; float BackupFloat[2]; };
ImGuiStyleMod(ImGuiStyleVar idx, int v) { VarIdx = idx; BackupInt[0] = v; }
ImGuiStyleMod(ImGuiStyleVar idx, float v) { VarIdx = idx; BackupFloat[0] = v; }
ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; }
}; };
// Stacked data for BeginGroup()/EndGroup() // Stacked data for BeginGroup()/EndGroup()
@ -257,9 +271,11 @@ struct ImGuiGroupData
ImVec2 BackupCursorPos; ImVec2 BackupCursorPos;
ImVec2 BackupCursorMaxPos; ImVec2 BackupCursorMaxPos;
float BackupIndentX; float BackupIndentX;
float BackupGroupOffsetX;
float BackupCurrentLineHeight; float BackupCurrentLineHeight;
float BackupCurrentLineTextBaseOffset; float BackupCurrentLineTextBaseOffset;
float BackupLogLinePosY; float BackupLogLinePosY;
bool BackupActiveIdIsAlive;
bool AdvanceCursor; bool AdvanceCursor;
}; };
@ -704,13 +720,13 @@ namespace ImGui
IMGUI_API void OpenPopupEx(const char* str_id, bool reopen_existing); IMGUI_API void OpenPopupEx(const char* str_id, bool reopen_existing);
// NB: All position are in absolute pixels coordinates (not window coordinates) // NB: All position are in absolute pixels coordinates (not window coordinates)
// FIXME: All those functions are a mess and needs to be refactored into something decent. Avoid use outside of imgui.cpp! // FIXME: All those functions are a mess and needs to be refactored into something decent. AVOID USING OUTSIDE OF IMGUI.CPP! NOT FOR PUBLIC CONSUMPTION.
// We need: a sort of symbol library, preferably baked into font atlas when possible + decent text rendering helpers. // We need: a sort of symbol library, preferably baked into font atlas when possible + decent text rendering helpers.
IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true); IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true);
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width); IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);
IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, ImGuiAlign align = ImGuiAlign_Default, const ImVec2* clip_min = NULL, const ImVec2* clip_max = NULL); IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0,0), const ImRect* clip_rect = NULL);
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f); IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
IMGUI_API void RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale = 1.0f, bool shadow = false); IMGUI_API void RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale = 1.0f);
IMGUI_API void RenderBullet(ImVec2 pos); IMGUI_API void RenderBullet(ImVec2 pos);
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col); IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col);
IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text. IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.

View File

@ -44,3 +44,5 @@ namespace ImGui
#include "widgets/file_list.h" #include "widgets/file_list.h"
#include "widgets/memory_editor.h" #include "widgets/memory_editor.h"
#include "widgets/gizmo.h"
#include "widgets/dock.h"

View File

@ -74,3 +74,5 @@ namespace ImGui
#include "widgets/file_list.inl" #include "widgets/file_list.inl"
#include "widgets/memory_editor.inl" #include "widgets/memory_editor.inl"
#include "widgets/gizmo.inl"
#include "widgets/dock.inl"

View File

@ -0,0 +1,21 @@
namespace ImGui
{
///
IMGUI_API void InitDockContext();
///
IMGUI_API void ShutdownDockContext();
///
IMGUI_API void RootDock(const ImVec2& pos, const ImVec2& size);
///
IMGUI_API bool BeginDock(const char* label, bool* opened = NULL, ImGuiWindowFlags extra_flags = 0);
///
IMGUI_API void EndDock();
///
IMGUI_API void SetDockActive();
} // namespace ImGui

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
#include <bx/bx.h>
#include <dirent.h> #include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -15,6 +16,9 @@ namespace ImGui
void ImFileList::ChDir(const char* path) void ImFileList::ChDir(const char* path)
{ {
#if BX_PLATFORM_NACL || BX_PLATFORM_PS4
BX_UNUSED(path);
#else
DIR* dir = opendir(path); DIR* dir = opendir(path);
if (NULL != dir) if (NULL != dir)
{ {
@ -43,6 +47,7 @@ namespace ImGui
closedir(dir); closedir(dir);
} }
#endif // BX_PLATFORM_NACL || BX_PLATFORM_PS4
} }
void ImFileList::Draw() void ImFileList::Draw()

View File

@ -0,0 +1,156 @@
// https://github.com/CedricGuillemet/ImGuizmo
// v 1.04 WIP
//
// The MIT License(MIT)
//
// Copyright(c) 2016 Cedric Guillemet
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -------------------------------------------------------------------------------------------
// History :
// 2016/09/11 Behind camera culling. Scaling Delta matrix not multiplied by source matrix scales. local/world rotation and translation fixed. Display message is incorrect (X: ... Y:...) in local mode.
// 2016/09/09 Hatched negative axis. Snapping. Documentation update.
// 2016/09/04 Axis switch and translation plan autohiding. Scale transform stability improved
// 2016/09/01 Mogwai changed to Manipulate. Draw debug cube. Fixed inverted scale. Mixing scale and translation/rotation gives bad results.
// 2016/08/31 First version
//
// -------------------------------------------------------------------------------------------
// Future (no order):
//
// - Multi view
// - display rotation/translation/scale infos in local/world space and not only local
// - finish local/world matrix application
// - OPERATION as bitmask
//
// -------------------------------------------------------------------------------------------
// Example
#if 0
void EditTransform(const Camera& camera, matrix_t& matrix)
{
static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::ROTATE);
static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::WORLD);
if (ImGui::IsKeyPressed(90))
mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
if (ImGui::IsKeyPressed(69))
mCurrentGizmoOperation = ImGuizmo::ROTATE;
if (ImGui::IsKeyPressed(82)) // r Key
mCurrentGizmoOperation = ImGuizmo::SCALE;
if (ImGui::RadioButton("Translate", mCurrentGizmoOperation == ImGuizmo::TRANSLATE))
mCurrentGizmoOperation = ImGuizmo::TRANSLATE;
ImGui::SameLine();
if (ImGui::RadioButton("Rotate", mCurrentGizmoOperation == ImGuizmo::ROTATE))
mCurrentGizmoOperation = ImGuizmo::ROTATE;
ImGui::SameLine();
if (ImGui::RadioButton("Scale", mCurrentGizmoOperation == ImGuizmo::SCALE))
mCurrentGizmoOperation = ImGuizmo::SCALE;
float matrixTranslation[3], matrixRotation[3], matrixScale[3];
ImGuizmo::DecomposeMatrixToComponents(matrix.m16, matrixTranslation, matrixRotation, matrixScale);
ImGui::InputFloat3("Tr", matrixTranslation, 3);
ImGui::InputFloat3("Rt", matrixRotation, 3);
ImGui::InputFloat3("Sc", matrixScale, 3);
ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, matrix.m16);
if (mCurrentGizmoOperation != ImGuizmo::SCALE)
{
if (ImGui::RadioButton("Local", mCurrentGizmoMode == ImGuizmo::LOCAL))
mCurrentGizmoMode = ImGuizmo::LOCAL;
ImGui::SameLine();
if (ImGui::RadioButton("World", mCurrentGizmoMode == ImGuizmo::WORLD))
mCurrentGizmoMode = ImGuizmo::WORLD;
}
static bool useSnap(false);
if (ImGui::IsKeyPressed(83))
useSnap = !useSnap;
ImGui::Checkbox("", &useSnap);
ImGui::SameLine();
vec_t snap;
switch (mCurrentGizmoOperation)
{
case ImGuizmo::TRANSLATE:
snap = config.mSnapTranslation;
ImGui::InputFloat3("Snap", &snap.x);
break;
case ImGuizmo::ROTATE:
snap = config.mSnapRotation;
ImGui::InputFloat("Angle Snap", &snap.x);
break;
case ImGuizmo::SCALE:
snap = config.mSnapScale;
ImGui::InputFloat("Scale Snap", &snap.x);
break;
}
ImGuizmo::Manipulate(camera.mView.m16, camera.mProjection.m16, mCurrentGizmoOperation, mCurrentGizmoMode, matrix.m16, NULL, useSnap ? &snap.x : NULL);
}
#endif
#pragma once
namespace ImGuizmo
{
// call BeginFrame right after ImGui_XXXX_NewFrame();
void BeginFrame();
// return true if mouse cursor is over any gizmo control (axis, plan or screen component)
bool IsOver();
// return true if mouse IsOver or if the gizmo is in moving state
bool IsUsing();
// enable/disable the gizmo. Stay in the state until next call to Enable.
// gizmo is rendered with gray half transparent color when disabled
void Enable(bool enable);
// helper functions for manualy editing translation/rotation/scale with an input float
// translation, rotation and scale float points to 3 floats each
// Angles are in degrees (more suitable for human editing)
// example:
// float matrixTranslation[3], matrixRotation[3], matrixScale[3];
// ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
// ImGui::InputFloat3("Tr", matrixTranslation, 3);
// ImGui::InputFloat3("Rt", matrixRotation, 3);
// ImGui::InputFloat3("Sc", matrixScale, 3);
// ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);
//
// These functions have some numerical stability issues for now. Use with caution.
void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale);
void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix);
// Render a cube with face color corresponding to face normal. Usefull for debug/tests
void DrawCube(const float *view, const float *projection, float *matrix);
// call it when you want a gizmo
// Needs view and projection matrices.
// matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional
// translation is applied in world space
enum OPERATION
{
TRANSLATE,
ROTATE,
SCALE
};
enum MODE
{
LOCAL,
WORLD
};
void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix = 0, float *snap = 0);
};

File diff suppressed because it is too large Load Diff

View File

@ -5682,7 +5682,8 @@ static void* rmtglGetProcAddress(OpenGL* opengl, const char* symbol)
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
return NSGLGetProcAddress((const GLubyte*)symbol); extern void* nsglGetProcAddress(const GLubyte* _name);
return nsglGetProcAddress((const GLubyte*)symbol);
#elif defined(RMT_PLATFORM_LINUX) #elif defined(RMT_PLATFORM_LINUX)

Some files were not shown because too many files have changed in this diff Show More