Commits

rude  committed 914e4d8

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.

  • Participants
  • Parent commits 213ac04

Comments (0)

Files changed (1)

File src/modules/graphics/opengl/wrap_ParticleSystem.cpp

 	{
 		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 {
 		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),