draw_multitextured_rectangle


Description:

public void draw_multitextured_rectangle (Pipeline pipeline, float x_1, float y_1, float x_2, float y_2, float[] tex_coords, int tex_coords_len)

Draws a textured rectangle to this with the given pipeline state with the top left corner positioned at (x_1, y_1) and the bottom right corner positioned at (x_2, y_2).

As a pipeline may contain multiple texture layers this interface lets you supply texture coordinates for each layer of the pipeline.

<note>The position is the position before the rectangle has been transformed by the model-view matrix and the projection matrix. </note>

This is a high level drawing api that can handle any kind of MetaTexture texture for the first layer such as Texture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as draw which only support low level texture types that are directly supported by GPUs such as Texture2D.

<note>This api can not currently handle multiple high-level meta texture layers. The first layer may be a high level meta texture such as Texture2DSliced but all other layers much be low level textures such as Texture2D and additionally they should be textures that can be sampled using normalized coordinates (so not TextureRectangle textures).</note>

The top left texture coordinate for layer 0 of any pipeline will be (tex_coords[0], tex_coords[1]) and the bottom right coordinate will be (tex_coords[2], tex_coords[3]). The coordinates for layer 1 would be (tex_coords[4], tex_coords[5]) (tex_coords[6], tex_coords[7]) and so on...

The given texture coordinates should always be normalized such that (0, 0) corresponds to the top left and (1, 1) corresponds to the bottom right. To map an entire texture across the rectangle pass in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, tex_coords[3]=1.

<note>Even if you have associated a TextureRectangle texture which normally implies working with non-normalized texture coordinates this api should still be passed normalized texture coordinates.</note>

The first pair of coordinates are for the first layer (with the smallest layer index) and if you supply less texture coordinates than there are layers in the current source material then default texture coordinates (0.0, 0.0, 1.0, 1.0) are generated.

Parameters:

this

A destination Framebuffer

pipeline

A Pipeline state object

x_1

x coordinate upper left on screen.

y_1

y coordinate upper left on screen.

x_2

x coordinate lower right on screen.

y_2

y coordinate lower right on screen.

tex_coords

An array containing groups of 4 float values: [s_1, t_1, s_2, t_2] that are interpreted as two texture coordinates; one for the top left texel, and one for the bottom right texel. Each value should be between 0.0 and 1.0, where the coordinate (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the bottom right.

tex_coords_len

The length of the tex_coords array. (For one layer and one group of texture coordinates, this would be 4)