Бранимир Караџић 7 years ago
parent
commit
fb8a82a5fd
2 changed files with 7 additions and 20 deletions
  1. 2 12
      examples/common/bounds.cpp
  2. 5 8
      tools/texturev/texturev.cpp

+ 2 - 12
examples/common/bounds.cpp

@@ -137,25 +137,15 @@ void toAabb(Aabb& _aabb, const float* _mtx, const void* _vertices, uint32_t _num
 {
 	bx::Vec3 min, max;
 	uint8_t* vertex = (uint8_t*)_vertices;
+	min = max = bx::mul(bx::load<bx::Vec3>(vertex), _mtx);
 
-	float position[3];
-	bx::vec3MulMtx(position, (float*)vertex, _mtx);
-	min.x = max.x = position[0];
-	min.y = max.y = position[1];
-	min.z = max.z = position[2];
 	vertex += _stride;
 
 	for (uint32_t ii = 1; ii < _numVertices; ++ii)
 	{
-		bx::vec3MulMtx(position, (float*)vertex, _mtx);
+		bx::Vec3 pos = bx::mul(bx::load<bx::Vec3>(vertex), _mtx);
 		vertex += _stride;
 
-		bx::Vec3 pos =
-		{
-			position[0],
-			position[1],
-			position[2],
-		};
 		min = bx::min(pos, min);
 		max = bx::max(pos, max);
 	}

+ 5 - 8
tools/texturev/texturev.cpp

@@ -2054,14 +2054,11 @@ int _main_(int _argc, char** _argv)
 
 			if (view.m_fit)
 			{
-				float wh[3] = { float(view.m_textureInfo.width), float(view.m_textureInfo.height), 0.0f };
-				float result[3];
-				bx::vec3MulMtx(result, wh, orientation);
-				result[0] = bx::round(bx::abs(result[0]) );
-				result[1] = bx::round(bx::abs(result[1]) );
-
-				scale.set(bx::min(float(view.m_width)  / result[0]
-					,             float(view.m_height) / result[1])
+				const bx::Vec3 wh = { float(view.m_textureInfo.width), float(view.m_textureInfo.height), 0.0f };
+				const bx::Vec3 result = bx::round(bx::abs(bx::mul(wh, orientation) ) );
+
+				scale.set(bx::min(float(view.m_width)  / result.x
+					,             float(view.m_height) / result.y)
 					, 0.1f*view.m_transitionTime
 					);
 			}