Index: /trunk/nv/types.hh
===================================================================
--- /trunk/nv/types.hh	(revision 53)
+++ /trunk/nv/types.hh	(revision 54)
@@ -8,6 +8,8 @@
 #include <glm/glm.hpp>
 #include <nv/common.hh>
+#include <type_traits>
 #include <utility>
 #include <unordered_map>
+#include <vector>
 #include <string>
 
@@ -68,5 +70,5 @@
 	template <> struct enum_to_type< FLOAT_MATRIX_4 > { typedef mat4 type; };
 
-	template < typename Type > struct type_to_enum {};
+	template < typename TYPE > struct type_to_enum {};
 
 	template <> struct type_to_enum< int >           { static const type type = INT; };
@@ -96,4 +98,7 @@
     }
 
+#define NV_REGISTER_NAME( s ) template <> inline const char* nv::get_type_name<s>   () { return #s; }
+
+	template <> inline const char* get_type_name<int>   () { return "sint"; }
     template <> inline const char* get_type_name<sint8> () { return "sint8"; }
     template <> inline const char* get_type_name<sint16>() { return "sint16"; }
@@ -101,8 +106,9 @@
     template <> inline const char* get_type_name<sint64>() { return "sint64"; }
 
-	template <> inline const char* get_type_name<uint8> () { return "uint8"; }
-    template <> inline const char* get_type_name<uint16>() { return "uint16"; }
-    template <> inline const char* get_type_name<uint32>() { return "uint32"; }
-    template <> inline const char* get_type_name<uint64>() { return "uint64"; }
+	template <> inline const char* get_type_name<unsigned int>() { return "uint"; }
+	template <> inline const char* get_type_name<uint8> ()       { return "uint8"; }
+    template <> inline const char* get_type_name<uint16>()       { return "uint16"; }
+    template <> inline const char* get_type_name<uint32>()       { return "uint32"; }
+    template <> inline const char* get_type_name<uint64>()       { return "uint64"; }
 
 	template <> inline const char* get_type_name<f32> () { return "f32"; }
@@ -162,4 +168,43 @@
 namespace nv
 {
+	struct type_entry;
+
+	struct type_field
+	{
+		enum flags
+		{
+			FPOINTER      = 0x01, //< field is a pointer
+			FNOSERIALIZE  = 0x02, //< ignore during serialization
+			FINVISIBLE    = 0x04, //< field invisible to API
+			FREADONLY     = 0x08, //< read only field
+			FSIMPLETYPE   = 0x10, //< raw binary I/O possible
+			FOWNED        = 0x20,
+		};
+		hash_string  name;      //< name of the field
+		hash_string  type_name; //< name of the type of the field
+		type_entry*  type;      //< pointer to field type
+		unsigned int flags;     //< flags 
+		size_t       offset;
+
+		template< typename TOBJECT, typename TFIELD>
+		type_field( hash_string name, TFIELD TOBJECT::*field )
+			: name(name)
+			, type_name( get_type_name< std::remove_pointer<TFIELD>::type >() )
+			, type( nullptr )
+			, flags( 0 )
+			, offset( offsetof( TOBJECT, *field ) )
+		{
+			flags = 
+				( std::is_pointer<TFIELD>::value ? FPOINTER : 0 ) |
+				( std::is_pod<TFIELD>::value ? FSIMPLETYPE : 0 );
+		}
+	};
+
+	struct type_enum
+	{
+		hash_string name;
+		int         value;
+		type_enum( hash_string name, int value ) : name(name), value(value) {}
+	};
 
     struct type_entry
@@ -181,6 +226,43 @@
         // Result of sizeof(type) operation
         size_t size;
+
+		// Base type
+		type_entry* base_type;
+
+		// Field list
+		std::vector<type_field> field_list;
+
+		// Enum list
+		std::vector<type_enum> enum_list;
+
+		template <int TYPE>
+		type_entry& base()
+		{
+			base_type = type_db->get_type( get_type_name<TYPE>() )
+		}
+
+		template <int SIZE>
+		type_entry& fields( type_field (&init_fields)[SIZE] )
+		{
+			for (int i = 0; i < SIZE; i++)
+			{
+				type_field f = init_fields[i];
+				f.type = type_db->get_type(f.type_name);
+				field_list.push_back(f);
+			}
+			return *this;
+		}
+
+		template <int SIZE>
+		type_entry& enums( type_enum (&init_enums)[SIZE] )
+		{
+			for (int i = 0; i < SIZE; i++)
+			{
+				enum_list.push_back( init_enums[i] )
+			}
+			return *this;
+		}
     };
- 
+
     class type_database
     {
@@ -207,4 +289,5 @@
 			return *i_type;
 		}
+
         type_entry* get_type( hash_string name )
 		{
