Fix issue that FLOAT4 uniform validator doesn't accept quaternion (#13551)

This commit is contained in:
pandamicro
2022-11-24 21:47:19 +08:00
committed by GitHub
parent 3b00de9cd2
commit 2486810ded
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ export const type2validator = {
[Type.INT3]: (v: Vec3): boolean => !!(v instanceof Vec3),
[Type.FLOAT3]: (v: Vec3): boolean => !!(v instanceof Vec3),
[Type.INT4]: (v: Vec4): boolean => !!(v instanceof Vec4),
[Type.FLOAT4]: (v: Vec4 | Color): boolean => !!((v instanceof Vec4) || (v instanceof Color)),
[Type.FLOAT4]: (v: Vec4 | Color | Quat): boolean => !!((v instanceof Vec4) || (v instanceof Color) || (v instanceof Quat)),
[Type.MAT3]: (v: Mat3): boolean => !!(v instanceof Mat3),
[Type.MAT4]: (v: Mat4): boolean => !!(v instanceof Mat4),
};
+2 -1
View File
@@ -232,7 +232,8 @@ const ccstd::unordered_map<gfx::Type, GFXTypeValidatorCallback> type2validator =
{gfx::Type::FLOAT4, [](const MaterialProperty &v) -> bool {
const auto *p = ccstd::get_if<Vec4>(&v);
const auto *pColor = ccstd::get_if<Color>(&v);
return p != nullptr || pColor != nullptr;
const auto *pQuat = ccstd::get_if<Quaternion>(&v);
return p != nullptr || pColor != nullptr || pQuat != nullptr;
}},
{gfx::Type::MAT3, [](const MaterialProperty &v) -> bool {
const auto *p = ccstd::get_if<Mat3>(&v);