Browse Source

Rename love.graphics.drawShaderVertices to drawFromShader.

Sasha Szpakowski 2 years ago
parent
commit
d3747cebb1

+ 1 - 1
changes.txt

@@ -55,7 +55,7 @@ Released: N/A
 * Added Compute Shader support via new 'computemain' shader entry point.
 * Added love.graphics.dispatchThreadgroups for running compute shaders.
 * Added Shader:hasStage.
-* Added love.graphics.drawShaderVertices.
+* Added love.graphics.drawFromShader.
 * Added love.graphics.getQuadIndexBuffer.
 * Added variants of love.graphics.applyTransform and replaceTransform which accept x,y,angle,sx,sy,ox,oy parameters.
 * Added APIs to override the default orthographic projection: love.graphics.setOrthoProjection, setPerspectiveProjection, and resetProjection.

+ 13 - 13
src/modules/graphics/Graphics.cpp

@@ -1819,29 +1819,29 @@ void Graphics::drawInstanced(Mesh *mesh, const Matrix4 &m, int instancecount)
 	mesh->drawInstanced(this, m, instancecount);
 }
 
-void Graphics::drawShaderVertices(PrimitiveType primtype, int vertexcount, int instancecount, Texture *maintexture)
+void Graphics::drawFromShader(PrimitiveType primtype, int vertexcount, int instancecount, Texture *maintexture)
 {
 	if (primtype == PRIMITIVE_TRIANGLE_FAN && vertexcount > LOVE_UINT16_MAX)
-		throw love::Exception("drawShaderVertices cannot draw more than %d vertices when the 'fan' draw mode is used.", LOVE_UINT16_MAX);
+		throw love::Exception("drawFromShader cannot draw more than %d vertices when the 'fan' draw mode is used.", LOVE_UINT16_MAX);
 
 	// Emulated triangle fan via an index buffer.
 	if (primtype == PRIMITIVE_TRIANGLE_FAN && getFanIndexBuffer())
 	{
 		int indexcount = getIndexCount(TRIANGLEINDEX_FAN, vertexcount);
-		drawShaderVertices(getFanIndexBuffer(), indexcount, instancecount, 0, maintexture);
+		drawFromShader(getFanIndexBuffer(), indexcount, instancecount, 0, maintexture);
 		return;
 	}
 
 	flushBatchedDraws();
 
 	if (!capabilities.features[FEATURE_GLSL3])
-		throw love::Exception("drawShaderVertices is not supported on this system (GLSL3 support is required.)");
+		throw love::Exception("drawFromShader is not supported on this system (GLSL3 support is required.)");
 
 	if (Shader::isDefaultActive() || !Shader::current)
-		throw love::Exception("drawShaderVertices can only be used with a custom shader.");
+		throw love::Exception("drawFromShader can only be used with a custom shader.");
 
 	if (vertexcount < 0 || instancecount < 0)
-		throw love::Exception("drawShaderVertices vertex and instance count parameters must not be negative.");
+		throw love::Exception("drawFromShader vertex and instance count parameters must not be negative.");
 
 	Shader::current->validateDrawState(primtype, maintexture);
 
@@ -1858,27 +1858,27 @@ void Graphics::drawShaderVertices(PrimitiveType primtype, int vertexcount, int i
 	draw(cmd);
 }
 
-void Graphics::drawShaderVertices(Buffer *indexbuffer, int indexcount, int instancecount, int startindex, Texture *maintexture)
+void Graphics::drawFromShader(Buffer *indexbuffer, int indexcount, int instancecount, int startindex, Texture *maintexture)
 {
 	flushBatchedDraws();
 
 	if (!capabilities.features[FEATURE_GLSL3])
-		throw love::Exception("drawShaderVertices is not supported on this system (GLSL3 support is required.)");
+		throw love::Exception("drawFromShader is not supported on this system (GLSL3 support is required.)");
 
 	if (!(indexbuffer->getUsageFlags() & BUFFERUSAGEFLAG_INDEX))
-		throw love::Exception("The buffer passed to drawShaderVertices must be an index buffer.");
+		throw love::Exception("The buffer passed to drawFromShader must be an index buffer.");
 
 	if (startindex < 0)
-		throw love::Exception("drawShaderVertices startindex parameter must not be negative.");
+		throw love::Exception("drawFromShader startindex parameter must not be negative.");
 
 	if (indexcount < 0 || instancecount < 0)
-		throw love::Exception("drawShaderVertices index and instance count parameters must not be negative.");
+		throw love::Exception("drawFromShader index and instance count parameters must not be negative.");
 
 	if ((size_t)(startindex + indexcount) > indexbuffer->getArrayLength() * indexbuffer->getDataMembers().size())
-		throw love::Exception("drawShaderVertices startindex and index count parameters do not fit in the given index buffer.");
+		throw love::Exception("drawFromShader startindex and index count parameters do not fit in the given index buffer.");
 
 	if (Shader::isDefaultActive() || !Shader::current)
-		throw love::Exception("drawShaderVertices can only be used with a custom shader.");
+		throw love::Exception("drawFromShader can only be used with a custom shader.");
 
 	Shader::current->validateDrawState(PRIMITIVE_TRIANGLES, maintexture);
 

+ 2 - 2
src/modules/graphics/Graphics.h

@@ -697,8 +697,8 @@ public:
 	void drawLayer(Texture *texture, int layer, Quad *quad, const Matrix4 &m);
 	void drawInstanced(Mesh *mesh, const Matrix4 &m, int instancecount);
 
-	void drawShaderVertices(PrimitiveType primtype, int vertexcount, int instancecount, Texture *maintexture);
-	void drawShaderVertices(Buffer *indexbuffer, int indexcount, int instancecount, int startindex, Texture *maintexture);
+	void drawFromShader(PrimitiveType primtype, int vertexcount, int instancecount, Texture *maintexture);
+	void drawFromShader(Buffer *indexbuffer, int indexcount, int instancecount, int startindex, Texture *maintexture);
 
 	/**
 	 * Draws text at the specified coordinates

+ 4 - 4
src/modules/graphics/wrap_Graphics.cpp

@@ -3099,7 +3099,7 @@ int w_drawInstanced(lua_State *L)
 	return 0;
 }
 
-int w_drawShaderVertices(lua_State *L)
+int w_drawFromShader(lua_State *L)
 {
 	if (luax_istype(L, 1, Buffer::type))
 	{
@@ -3114,7 +3114,7 @@ int w_drawShaderVertices(lua_State *L)
 		if (!lua_isnoneornil(L, 5))
 			tex = luax_checktexture(L, 5);
 
-		luax_catchexcept(L, [&]() { instance()->drawShaderVertices(t, indexcount, instancecount, indexstart, tex); });
+		luax_catchexcept(L, [&]() { instance()->drawFromShader(t, indexcount, instancecount, indexstart, tex); });
 	}
 	else
 	{
@@ -3130,7 +3130,7 @@ int w_drawShaderVertices(lua_State *L)
 		if (!lua_isnoneornil(L, 4))
 			tex = luax_checktexture(L, 4);
 
-		luax_catchexcept(L, [&]() { instance()->drawShaderVertices(primtype, vertexcount, instancecount, tex); });
+		luax_catchexcept(L, [&]() { instance()->drawFromShader(primtype, vertexcount, instancecount, tex); });
 	}
 	return 0;
 }
@@ -3844,7 +3844,7 @@ static const luaL_Reg functions[] =
 	{ "draw", w_draw },
 	{ "drawLayer", w_drawLayer },
 	{ "drawInstanced", w_drawInstanced },
-	{ "drawShaderVertices", w_drawShaderVertices },
+	{ "drawFromShader", w_drawFromShader },
 
 	{ "print", w_print },
 	{ "printf", w_printf },