Ver Fonte

Split IdTable from Id definition

Daniele Bartolini há 12 anos atrás
pai
commit
b4d93e3d0e

+ 0 - 1
engine/Camera.h

@@ -30,7 +30,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Frustum.h"
 #include "Matrix4x4.h"
 #include "Vector3.h"
-#include "IdTable.h"
 
 namespace crown
 {

+ 0 - 1
engine/RenderWorld.h

@@ -26,7 +26,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "IdTable.h"
 #include "IdArray.h"
 #include "Mesh.h"
 #include "Sprite.h"

+ 0 - 1
engine/Unit.cpp

@@ -25,7 +25,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include "Unit.h"
-#include "IdTable.h"
 #include "World.h"
 #include "Allocator.h"
 #include "Log.h"

+ 1 - 1
engine/Unit.h

@@ -26,11 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
+#include "Types.h"
 #include "Vector3.h"
 #include "Quaternion.h"
 #include "Matrix4x4.h"
 #include "Hash.h"
-#include "IdTable.h"
 #include "SceneGraph.h"
 #include "StringUtils.h"
 

+ 1 - 2
engine/World.h

@@ -26,14 +26,13 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
+#include "Types.h"
 #include "HeapAllocator.h"
-#include "IdTable.h"
 #include "IdArray.h"
 #include "LinearAllocator.h"
 #include "Unit.h"
 #include "Camera.h"
 #include "Vector.h"
-#include "LinearAllocator.h"
 #include "RenderWorld.h"
 #include "SoundRenderer.h"
 #include "PoolAllocator.h"

+ 29 - 0
engine/core/Types.h

@@ -39,6 +39,35 @@ OTHER DEALINGS IN THE SOFTWARE.
 	#define CE_INLINE inline
 #endif
 
+#define INVALID_ID 65535
+
+struct Id
+{
+	uint16_t id;
+	uint16_t index;
+
+	void decode(uint32_t id_and_index)
+	{
+		id = (id_and_index & 0xFFFF0000) >> 16;
+		index = id_and_index & 0xFFFF;
+	}
+
+	uint32_t encode() const
+	{
+		return (uint32_t(id) << 16) | uint32_t(index);
+	}
+
+	bool operator==(const Id& other)
+	{
+		return id == other.id && index == other.index;
+	}
+
+	bool operator!=(const Id& other)
+	{
+		return id != other.id || index != other.index;
+	}
+};
+
 #ifndef NULL
 #ifdef __cplusplus
 #define NULL    0

+ 0 - 1
engine/core/containers/IdArray.h

@@ -29,7 +29,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Assert.h"
 #include "Allocator.h"
 #include "Types.h"
-#include "IdTable.h"
 #include "List.h"
 
 namespace crown

+ 0 - 29
engine/core/containers/IdTable.h

@@ -33,35 +33,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-#define INVALID_ID 65535
-
-struct Id
-{
-	uint16_t id;
-	uint16_t index;
-
-	void decode(uint32_t id_and_index)
-	{
-		id = (id_and_index & 0xFFFF0000) >> 16;
-		index = id_and_index & 0xFFFF;
-	}
-
-	uint32_t encode() const
-	{
-		return (uint32_t(id) << 16) | uint32_t(index);
-	}
-
-	bool operator==(const Id& other)
-	{
-		return id == other.id && index == other.index;
-	}
-
-	bool operator!=(const Id& other)
-	{
-		return id != other.id || index != other.index;
-	}
-};
-
 /// Table of Ids.
 template <uint32_t MAX_NUM_ID>
 class IdTable

+ 0 - 1
engine/renderers/RenderContext.h

@@ -28,7 +28,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Color4.h"
 #include "Matrix4x4.h"
-#include "IdTable.h"
 #include "CommandBuffer.h"
 #include "ConstantBuffer.h"
 #include "RendererTypes.h"

+ 1 - 0
engine/renderers/Renderer.h

@@ -34,6 +34,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "RenderContext.h"
 #include "OsThread.h"
 #include "OS.h"
+#include "IdTable.h"
 
 namespace crown
 {

+ 1 - 1
engine/renderers/RendererTypes.h

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "IdTable.h"
+#include "Types.h"
 
 namespace crown
 {

+ 1 - 1
engine/renderers/gl/GLRenderer.h

@@ -36,8 +36,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 	#error "Oops, wrong platform"
 #endif
 
+#include "Types.h"
 #include "Renderer.h"
-#include "IdTable.h"
 #include "Resource.h"
 #include "GLContext.h"
 #include "HeapAllocator.h"

+ 1 - 1
engine/rpc/RPCHandler.h

@@ -26,10 +26,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
+#include "Types.h"
 #include "Hash.h"
 #include "JSONParser.h"
 #include "StringUtils.h"
-#include "IdTable.h"
 
 namespace crown
 {