Przeglądaj źródła

Added overview post code sample

Christophe Riccio 11 lat temu
rodzic
commit
3ad3dbcd93
1 zmienionych plików z 27 dodań i 0 usunięć
  1. 27 0
      glm/detail/dummy.cpp

+ 27 - 0
glm/detail/dummy.cpp

@@ -189,7 +189,34 @@ glm::vec3 lighting
 	return Color;
 }
 */
+
+
+template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
+T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
+{
+	return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
+}
+
+#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template<typename, glm::precision> class
+
+template <GLM_TEMPLATE_GENTYPE vecType>
+T normalizeDotB(vecType<T, P> const & x, vecType<T, P> const & y)
+{
+	return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
+}
+
+template <typename vecType>
+typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
+{
+	return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
+}
+
 int main()
 {
+	glm::vec4 v(1);
+	float a = normalizeDotA(v, v);
+	float b = normalizeDotB(v, v);
+	float c = normalizeDotC(v, v);
+
 	return 0;
 }