利用者:Jwilkins/VFX/Aspects/Sprite

提供: wiki
移動先: 案内検索

The Sprite Aspect

Header File: GPU_sprite.h

void GPU_sprite_begin(void);
void GPU_sprite_end(void);

GPU_sprite_begin will both switch to GPU_ASPECT_SPRITE and also prepares for GPU_sprite calls to be made. GPU_sprite_end undoes this and switches back to GPU_ASPECT_BASIC.

Currently the appropriate GPU_immediate_format call must be made before any calls to GPU_sprite and GPU_immediate_unformat should be called after all sprites are drawn. Since no emulation of point sprites is done on systems that do not support it, no texture coordinate is required. This is subject to change.

Features

void GPU_point_size (float size);
void GPU_sprite_size(float size);

A distinction has to be made between points and sprites. The GPU_sprite_size function controls the size of sprites that are drawn using the GPU_ASPECT_SPRITE, while GPU_point_size function controls the size of points that are drawn using POINT with any other aspect.

enum GPUSpriteShaderOption {
    GPU_SPRITE_CIRCULAR   = (1<<0),
    GPU_SPRITE_TEXTURE_2D = (1<<1)
};

These options can be set on <tt>GPU_ASPECT_SPRITE</tt> by using <tt>GPU_aspect_enable(GPU_ASPECT_SPRITE, ...)</tt> and disabled by using <tt>GPU_aspect_disable(GPU_ASPECT_SPRITE, ...)</tt>.

<tt>GPU_SPRITE_CIRCULAR</tt> has the same effect as the legacy <tt>POINT_SMOOTH</tt>, that is, it makes points round.

<tt>GPU_SPRITE_TEXTURE_2D</tt> enables texture mapping and is not implemented yet.

Issuing Sprites

void GPU_sprite_2f (float x, float y);
void GPU_sprite_2fv(const float v[2]);

void GPU_sprite_3f (float x, float y, float z);
void GPU_sprite_3fv(const float v[3]);

These functions act the same as Vertex in POINT mode and issue sprites to be drawn.