gx_shader: normalize normal

This commit is contained in:
Luke Street 2022-08-09 13:40:45 -04:00
parent 5d0848d428
commit 5f06d873bc
2 changed files with 2 additions and 2 deletions

View File

@ -801,7 +801,7 @@ wgpu::ShaderModule build_shader(const ShaderConfig& config, const ShaderInfo& in
}
}
vtxXfrAttrsPre += fmt::format(FMT_STRING("\n var mv_pos = ubuf.pos_mtx * vec4<f32>({}, 1.0);"
"\n var mv_nrm = ubuf.nrm_mtx * vec4<f32>({}, 0.0);"
"\n var mv_nrm = normalize(ubuf.nrm_mtx * vec4<f32>({}, 0.0));"
"\n out.pos = ubuf.proj * vec4<f32>(mv_pos, 1.0);"),
vtx_attr(config, GX_VA_POS), vtx_attr(config, GX_VA_NRM));
if constexpr (EnableNormalVisualization) {

View File

@ -49,7 +49,7 @@ using namespace std::string_view_literals;
if (!(cond)) \
UNLIKELY FATAL(msg, ##__VA_ARGS__)
#ifdef NDEBUG
#define CHECK
#define CHECK(cond, msg, ...)
#else
#define CHECK(cond, msg, ...) ASSERT(cond, msg, ##__VA_ARGS__)
#endif