Нет, не существует эквивалента.Обычным методом было бы нарисовать треугольную полосу, образующую квад.
Вы можете использовать инстансинг, поэтому вам просто нужно обновить буфер с данными спрайта (x, y позиция экрана в пикселях, id текстурывыбрать массив текстур, масштабирование, вращение, слой и т. д.) и использовать шейдеры для рендеринга всех спрайтов за один вызов рисования.
Вот некоторые лакомые кусочки HLSL от макушки головы:
//--------------------------------------------------------------------------------------
// Shader code for Sprite Rendering
//--------------------------------------------------------------------------------------
struct Sprite {
float2 position; // x, y world position
float rotation;
float scaling;
float layer; // if you have multiple layers of sprites (e.g. background sprites)
uint textureId;
};
StructuredBuffer<Sprite> SpritesRO : register( t0 );
Texture2DArray<float4> TextureSlices : register (t1);
cbuffer cbRenderConstants : register( b0 )
{
matrix g_mViewProjection;
// other constants
};
struct VSSpriteOut
{
float3 position : SV_Position;
uint textureId;
};
//-------------------------------------------------------------------------------------
// Sprite Vertex Shader
//-------------------------------------------------------------------------------------
VSSpriteOut SpriteVS(uint VID : SV_VertexID, uint SIID : SV_InstanceID)
{
VSSpriteOut Out = (VSSpriteOut)0;
// VID is either 0, 1, 2 or 3
// We can map 0 to position (0,0), 1 to (0,1), 2 to (1,0), 3 to (1,1)
// We fetch the sprite instance data accord SIID
Sprite sdata = SpritesRO[SIID];
// function f computes screen space vertex position
float3 pos = f (g_mViewProjection, VID, position, rotation, scaling, layer etc)
Out.position = pos;
Out.textureId = sdata.textureId;
return Out;
}
//-------------------------------------------------------------------------------------
// Sprite Pixel Shader
//-------------------------------------------------------------------------------------
float4 SpritePS(VSSpriteOut In) : SV_Target
{
// use In.textureId to fetch the right texture slice in texture array
return color;
}