bkaradzic 13 lat temu
rodzic
commit
5fe1132b1c
3 zmienionych plików z 18 dodań i 18 usunięć
  1. 2 2
      examples/06-bump/bump.cpp
  2. 2 2
      src/bgfx_p.h
  3. 14 14
      src/vertexdecl.cpp

+ 2 - 2
examples/06-bump/bump.cpp

@@ -22,8 +22,8 @@ struct PosNormalTangentTexcoordVertex
 	float m_z;
 	uint32_t m_normal;
 	uint32_t m_tangent;
-	uint16_t m_u;
-	uint16_t m_v;
+	int16_t m_u;
+	int16_t m_v;
 };
 
 static bgfx::VertexDecl s_PosNormalTangentTexcoordDecl;

+ 2 - 2
src/bgfx_p.h

@@ -194,12 +194,12 @@ namespace bgfx
 	const char* getAttribName(Attrib::Enum _attr);
 	bool renderFrame();
 
-	inline uint32_t uint16_min(uint16_t _a, uint16_t _b)
+	inline uint16_t uint16_min(uint16_t _a, uint16_t _b)
 	{
 		return _a > _b ? _b : _a;
 	}
 
-	inline uint32_t uint16_max(uint16_t _a, uint16_t _b)
+	inline uint16_t uint16_max(uint16_t _a, uint16_t _b)
 	{
 		return _a < _b ? _b : _a;
 	}

+ 14 - 14
src/vertexdecl.cpp

@@ -209,27 +209,27 @@ namespace bgfx
 
 		case AttribType::Int16:
 			{
-				uint16_t* packed = (uint16_t*)data;
+				int16_t* packed = (int16_t*)data;
 				if (_inputNormalized)
 				{
 					if (asInt)
 					{
 						switch (num)
 						{
-						default: *packed++ = uint16_t(*_input++ * 32767.0f);
-						case 3:  *packed++ = uint16_t(*_input++ * 32767.0f);
-						case 2:  *packed++ = uint16_t(*_input++ * 32767.0f);
-						case 1:  *packed++ = uint16_t(*_input++ * 32767.0f);
+						default: *packed++ = int16_t(*_input++ * 32767.0f);
+						case 3:  *packed++ = int16_t(*_input++ * 32767.0f);
+						case 2:  *packed++ = int16_t(*_input++ * 32767.0f);
+						case 1:  *packed++ = int16_t(*_input++ * 32767.0f);
 						}
 					}
 					else
 					{
 						switch (num)
 						{
-						default: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f);
-						case 3:  *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f);
-						case 2:  *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f);
-						case 1:  *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f);
+						default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
+						case 3:  *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
+						case 2:  *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
+						case 1:  *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
 						}
 					}
 				}
@@ -237,10 +237,10 @@ namespace bgfx
 				{
 					switch (num)
 					{
-					default: *packed++ = uint16_t(*_input++);
-					case 3:  *packed++ = uint16_t(*_input++);
-					case 2:  *packed++ = uint16_t(*_input++);
-					case 1:  *packed++ = uint16_t(*_input++);
+					default: *packed++ = int16_t(*_input++);
+					case 3:  *packed++ = int16_t(*_input++);
+					case 2:  *packed++ = int16_t(*_input++);
+					case 1:  *packed++ = int16_t(*_input++);
 					}
 				}
 			}
@@ -313,7 +313,7 @@ namespace bgfx
 
 		case AttribType::Int16:
 			{
-				uint16_t* packed = (uint16_t*)data;
+				int16_t* packed = (int16_t*)data;
 				if (asInt)
 				{
 					switch (num)