瀏覽代碼

Add missing Color hash function

dementive 3 月之前
父節點
當前提交
d2814ebbf3
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      core/templates/hashfuncs.h

+ 7 - 0
core/templates/hashfuncs.h

@@ -389,6 +389,13 @@ struct HashMapHasherDefault {
 		h = hash_murmur3_one_real(p_vec.w, h);
 		return hash_fmix32(h);
 	}
+	static _FORCE_INLINE_ uint32_t hash(const Color &p_vec) {
+		uint32_t h = hash_murmur3_one_float(p_vec.r);
+		h = hash_murmur3_one_float(p_vec.g, h);
+		h = hash_murmur3_one_float(p_vec.b, h);
+		h = hash_murmur3_one_float(p_vec.a, h);
+		return hash_fmix32(h);
+	}
 	static _FORCE_INLINE_ uint32_t hash(const Rect2i &p_rect) {
 		uint32_t h = hash_murmur3_one_32(uint32_t(p_rect.position.x));
 		h = hash_murmur3_one_32(uint32_t(p_rect.position.y), h);