Procházet zdrojové kódy

Add next_vec2/3 utility function - maybe we can move it to LuaStack along with temporary buffers and nice type checking

Daniele Bartolini před 12 roky
rodič
revize
57b92e67c5
2 změnil soubory, kde provedl 11 přidání a 1 odebrání
  1. 6 1
      lua/Vec2Binds.cpp
  2. 5 0
      lua/Vec3Binds.cpp

+ 6 - 1
lua/Vec2Binds.cpp

@@ -11,7 +11,12 @@ extern "C"
 
 const int32_t 	LUA_VEC2_BUFFER_SIZE = 4096;
 Vec2 			vec2_buffer[LUA_VEC2_BUFFER_SIZE];
-uint32_t 		vec2_used = 0;	
+uint32_t 		vec2_used = 0;
+
+Vec2* next_vec2()
+{
+	return &vec2_buffer[vec2_used++];
+}
 
 int32_t	vec2(lua_State* L)
 {

+ 5 - 0
lua/Vec3Binds.cpp

@@ -14,6 +14,11 @@ const int32_t 	LUA_VEC3_BUFFER_SIZE = 4096;
 Vec3 			vec3_buffer[LUA_VEC3_BUFFER_SIZE];
 uint32_t 		vec3_used = 0;
 
+Vec3* next_vec3()
+{
+	return &vec3_buffer[vec3_used++];
+}
+
 //------------------------------------------------------------
 int32_t vec3(lua_State* L)
 {