I want to ask you guys, what is your approach on HLSL and GLSL wrapping. I have a solution that works, but its really ugly and really don't like it :
///////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////
#ifdef VERTEX_SHADER
@vertex-attrib float3 $a_pos a_position
@vertex-attrib float2 $a_uv a_uv
@varying float2 $v_uv;
@uniform float4x4 g_projView;
@uniform float4x4 g_world;
@shader-main-begin
float4 worldPos = mul(g_world, float4($a_pos, 1.0));
$vs_out = mul(g_projView, worldPos);
$v_uv = $a_uv;
@shader-main-end
#endif
///////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////
#ifdef PIXEL_SHADER
@varying float2 $v_uv
@ps-out $color 0
@uniform texture2D tex0
@shader-main-begin
$color = sample2D(tex0, $v_uv);
@shader-main-end
#endif
This is later converted to HLSL/GLSL
Basically i use FCPP(really i don't recommend it) for marcos and pre-processing. and than some basic token matching + few macros. But all that $ @shader-main-begin are really awful... I really can't think of any other cleaner to basically wrap those two languages together.
What do you guys do?