Browse Source

Do not allow more than eight sizes and colors in ParticleSystem. This makes it
less impossible to implement ParticleSystem as a vertex shader in the future.

rude 14 years ago
parent
commit
1274b5d55a
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/modules/graphics/opengl/wrap_ParticleSystem.cpp

+ 7 - 0
src/modules/graphics/opengl/wrap_ParticleSystem.cpp

@@ -147,6 +147,10 @@ namespace opengl
 	{
 		ParticleSystem * t = luax_checkparticlesystem(L, 1);
 		size_t nSizes = lua_gettop(L) - 1;
+
+		if (nSizes > 8)
+			return luaL_error(L, "At most eight (8) sizes may be used.");
+
 		if (nSizes == 1) {
 			t->setSize(luax_checkfloat(L, 2));
 		} else {
@@ -199,6 +203,9 @@ namespace opengl
 		ParticleSystem * t = luax_checkparticlesystem(L, 1);
 		size_t nColors = (lua_gettop(L) - 1) / 4;
 
+		if (nColors > 8)
+			return luaL_error(L, "At most eight (8) colors may be used.");
+
 		if (nColors == 1) {
 			t->setColor(Color(luaL_checkint(L,2),
 						luaL_checkint(L,3),