Hehongyuanlove 5 éve
szülő
commit
3154cec79c
1 módosított fájl, 18 hozzáadás és 0 törlés
  1. 18 0
      include/assimp/StringUtils.h

+ 18 - 0
include/assimp/StringUtils.h

@@ -145,4 +145,22 @@ std::string DecimalToHexa( T toConvert ) {
     return result;
     return result;
 }
 }
 
 
+///	@fn		Rgba2Hex
+///	@brief	translate RGBA to String
+///	@param	r   aiColor.r
+///	@param	g   aiColor.g
+///	@param	b   aiColor.b
+///	@param	a   aiColor.a
+///	@param	with_head   # 
+///	@return	The hexadecimal string, is empty in case of an error.
+AI_FORCE_INLINE
+std::string Rgba2Hex(int r, int g, int b, int a, bool with_head)
+{
+	std::stringstream ss;
+	if (with_head)
+		ss << "#";
+	ss << std::hex << (r << 24 | g << 16 | b << 8 | a);
+	return ss.str();
+}
+
 #endif // INCLUDED_AI_STRINGUTILS_H
 #endif // INCLUDED_AI_STRINGUTILS_H