You can try the following:
Code: Select all
@property( !diffuse_map && !diffuse_map0 )
@set( IF_NoDiffuseMap, 1 )
@end
@property( IF_NoDiffuseMap )
@end
I'm not sure if that will work because of how @set and @property are evaluated (the order of evaluation).
But if you place them in different files, it will work because files are evaluated first in the order in which their folders were added to the library, and within the same folder files are parsed in alphabetical order:
Code: Select all
// 00.MySetup_piece_all.hlsl
@property( !diffuse_map && !diffuse_map0 )
@set( IF_NoDiffuseMap, 1 )
@end
// PixelShader.hlsl
@property( IF_NoDiffuseMap )
@end
Or use math:
Code: Select all
// IF_NoDiffuseMap = diffuse_map + diffuse_map0
@padd( IF_NoDiffuseMap, diffuse_map, diffuse_map0 )
@property( IF_NoDiffuseMap )
@end
The difference between padd() and add() is that padd is always parsed first ignoring everything i.e. it will be executed even if inside @property( 0 ); which are ideal for setting things up without relying on separate files.
Valid
math and
pmath operations can be found in the code.
Note that @set( a, b && c ) is not supported.
Why this madness? Because Hlms parser syntax is not a proper language. It was written with parsing speed in mind (and honestly it went a bit overboard). I wanted to use Lua or Python but these languages suck at string parsing speed or as the case of python they add tremendous dependency overhead.