Commits

Alex Szpakowski committed fae9875

Renamed Source:s/getDistance to Source:s/getAttenuationDistances (resolves issue #632).

Fixed detection for mipmap sharpness support.

  • Participants
  • Parent commits b205d3c

Comments (0)

Files changed (4)

File src/modules/audio/wrap_Source.cpp

 	return 2;
 }
 
-int w_Source_setDistance(lua_State *L)
+int w_Source_setAttenuationDistances(lua_State *L)
 {
 	Source *t = luax_checksource(L, 1);
 	float dref = (float)luaL_checknumber(L, 2);
 	return 0;
 }
 
-int w_Source_getDistance(lua_State *L)
+int w_Source_getAttenuationDistances(lua_State *L)
 {
 	Source *t = luax_checksource(L, 1);
 	lua_pushnumber(L, t->getReferenceDistance());
 
 	{ "setVolumeLimits", w_Source_setVolumeLimits },
 	{ "getVolumeLimits", w_Source_getVolumeLimits },
-	{ "setDistance", w_Source_setDistance },
-	{ "getDistance", w_Source_getDistance },
+	{ "setAttenuationDistances", w_Source_setAttenuationDistances },
+	{ "getAttenuationDistances", w_Source_getAttenuationDistances },
 	{ "setRolloff", w_Source_setRolloff},
 	{ "getRolloff", w_Source_getRolloff},
 

File src/modules/audio/wrap_Source.h

 int w_Source_isStatic(lua_State *L);
 int w_Source_setVolumeLimits(lua_State *L);
 int w_Source_getVolumeLimits(lua_State *L);
-int w_Source_setDistance(lua_State *L);
-int w_Source_getDistance(lua_State *L);
+int w_Source_setAttenuationDistances(lua_State *L);
+int w_Source_getAttenuationDistances(lua_State *L);
 int w_Source_setRolloff(lua_State *L);
 int w_Source_getRolloff(lua_State *L);
 int w_Source_getType(lua_State *L);

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

 	, width((float)(cdata->getWidth(0)))
 	, height((float)(cdata->getHeight(0)))
 	, texture(0)
+	, texCoordScale(1.0, 1.0)
 	, mipmapSharpness(defaultMipmapSharpness)
 	, mipmapsCreated(false)
 	, compressed(true)
 	Matrix t;
 	t.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky);
 
-	const Vertex *v = quad->getVertices();
-	drawv(t, v);
+	drawv(t, quad->getVertices());
 }
 
 void Image::predraw() const
 
 	bind();
 
-	int mipmapcount = cdata->getMipmapCount();
+	int count = cdata->getMipmapCount();
 
 	// We have to inform OpenGL if the image doesn't have all mipmap levels.
 	if (GLEE_VERSION_1_2 || GLEE_SGIS_texture_lod)
 	{
-		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapcount - 1);
+		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, count - 1);
 	}
-	else if (cdata->getWidth(mipmapcount-1) > 1 || cdata->getHeight(mipmapcount-1) > 1)
+	else if (cdata->getWidth(count-1) > 1 || cdata->getHeight(count-1) > 1)
 	{
 		// Telling OpenGL to ignore certain levels isn't always supported.
 		throw love::Exception("Cannot load mipmaps: "
 		      "compressed image does not have all required levels.");
 	}
 
-	for (int i = 1; i < mipmapcount; i++)
+	for (int i = 1; i < count; i++)
 	{
 		glCompressedTexImage2DARB(GL_TEXTURE_2D,
 		                          i,
 
 bool Image::hasMipmapSharpnessSupport()
 {
-	return GLEE_VERSION_1_4 || GLEE_EXT_texture_lod_bias;
+	return GLEE_VERSION_1_4;
 }
 
 bool Image::hasCompressedTextureSupport()

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

 		ibo = nullptr;
 	}
 
-	if (!ibo)
+	if (!ibo && size > 0)
 	{
 		// Full memory backing because we might access the data at any time.
 		ibo = VertexBuffer::Create(size, GL_ELEMENT_ARRAY_BUFFER, GL_DYNAMIC_DRAW, VertexBuffer::BACKING_FULL);
 
 	element_count = map.size();
 
-	if (element_count > 0)
+	if (ibo && element_count > 0)
 	{
 		VertexBuffer::Bind ibo_bind(*ibo);
 		VertexBuffer::Mapper ibo_map(*ibo);
 
 	GLenum mode = getGLDrawMode(draw_mode);
 
-	if (element_count > 0)
+	if (ibo && element_count > 0)
 	{
 		VertexBuffer::Bind ibo_bind(*ibo);