|
Tiny3D
|

Go to the source code of this file.
Data Structures | |
| struct | TPXInitParams |
| struct | __attribute__ |
Typedefs | |
| typedef TPXParticleS8 | TPXParticle |
Enumerations | |
| enum | TPXCmd { TPX_CMD_SYNC_T3D = 0x0 , TPX_CMD_DRAW_COLOR = 0x1 , TPX_CMD_MATRIX_STACK = 0x2 , TPX_CMD_SET_DMEM = 0x3 , TPX_CMD_DRAW_TEXTURE = 0x4 } |
Functions | |
| aligned (16))) TPXParticleS8 | |
| aligned (8))) TPXParticleS16 | |
| void | tpx_init (TPXInitParams params) |
| Initializes the tinyPX library. | |
| void | tpx_state_from_t3d () |
| void | tpx_state_set_scale (float scaleX, float scaleY) |
| void | tpx_state_set_base_size (uint16_t baseSize) |
| void | tpx_state_set_tex_params (int16_t offsetX, uint16_t mirrorPoint) |
| void | tpx_particle_draw_s8 (TPXParticleS8 *particles, uint32_t count) |
| static void | tpx_particle_draw (TPXParticleS8 *particles, uint32_t count) |
| void | tpx_particle_draw_s16 (TPXParticleS16 *particles, uint32_t count) |
| void | tpx_particle_draw_tex_s8 (TPXParticleS8 *particles, uint32_t count) |
| static void | tpx_particle_draw_tex (TPXParticleS8 *particles, uint32_t count) |
| void | tpx_particle_draw_tex_s16 (TPXParticleS16 *particles, uint32_t count) |
| void | tpx_matrix_set (const T3DMat4FP *mat, bool doMultiply) |
| void | tpx_matrix_push (const T3DMat4FP *mat) |
| void | tpx_matrix_pop (int count) |
| void | tpx_matrix_push_pos (int count) |
| static int8_t * | tpx_buffer_s8_get_pos (TPXParticleS8 pt[], int idx) |
| static int8_t * | tpx_buffer_get_pos (TPXParticleS8 pt[], int idx) |
| static int8_t * | tpx_buffer_s8_get_size (TPXParticleS8 pt[], int idx) |
| static int8_t * | tpx_buffer_get_size (TPXParticleS8 pt[], int idx) |
| static uint32_t * | tpx_buffer_s8_get_color (TPXParticleS8 pt[], int idx) |
| static uint32_t * | tpx_buffer_get_color (TPXParticleS8 pt[], int idx) |
| static uint8_t * | tpx_buffer_s8_get_rgba (TPXParticleS8 pt[], int idx) |
| static uint8_t * | tpx_buffer_get_rgba (TPXParticleS8 pt[], int idx) |
| static int16_t * | tpx_buffer_s16_get_pos (TPXParticleS16 pt[], int idx) |
| static int8_t * | tpx_buffer_s16_get_size (TPXParticleS16 pt[], int idx) |
| static uint8_t * | tpx_buffer_s16_get_rgba (TPXParticleS16 pt[], int idx) |
| static uint8_t * | tpx_buffer_s16_get_tex_offset (TPXParticleS16 pt[], int idx) |
| void | tpx_buffer_s8_swap (TPXParticleS8 pt[], uint32_t idxA, uint32_t idxB) |
| static void | tpx_buffer_swap (TPXParticleS8 pt[], uint32_t idxA, uint32_t idxB) |
| void | tpx_buffer_s16_swap (TPXParticleS16 pt[], uint32_t idxA, uint32_t idxB) |
| void | tpx_buffer_s8_copy (TPXParticleS8 pt[], uint32_t idxDst, uint32_t idxSrc) |
| static void | tpx_buffer_copy (TPXParticleS8 pt[], uint32_t idxDst, uint32_t idxSrc) |
| void | tpx_buffer_s16_copy (TPXParticleS16 pt[], uint32_t idxDst, uint32_t idxSrc) |
| void | tpx_destroy () |
Variables | |
| uint32_t | TPX_RSP_ID |
| typedef TPXParticleS8 TPXParticle |
| void tpx_buffer_s16_copy | ( | TPXParticleS16 | pt[], |
| uint32_t | idxDst, | ||
| uint32_t | idxSrc ) |
Copies a particle into another place in a buffer This will overwrite the destination particle and keep the source particle unchanged.
| pt | buffer to copy particles in |
| idxDst | destination index |
| idxSrc | source index |
|
inlinestatic |
Returns the pointer to a position of a particle in a buffer
| vert | particle buffer |
| idx | particle index |
|
inlinestatic |
Returns the pointer to the color (as a u32) of a particle in a buffer
| pt | particle buffer |
| idx | particle index |
|
inlinestatic |
Returns the pointer to the size of a particle in a buffer
| pt | particle buffer |
| idx | particle index |
|
inlinestatic |
Returns the pointer to the texture offset in the buffer. This is only present in the 16bit buffer, in the 8bit version this stored in alpha channel.
| pt | particle buffer |
| idx | particle index |
| void tpx_buffer_s16_swap | ( | TPXParticleS16 | pt[], |
| uint32_t | idxA, | ||
| uint32_t | idxB ) |
Swaps two particles in a buffer
| pt | buffer to swap particles in |
| idxA | index of the first particle |
| idxB | index of the second particle |
| void tpx_buffer_s8_copy | ( | TPXParticleS8 | pt[], |
| uint32_t | idxDst, | ||
| uint32_t | idxSrc ) |
Copies a particle into another place in a buffer This will overwrite the destination particle and keep the source particle unchanged.
| pt | buffer to copy particles in |
| idxDst | destination index |
| idxSrc | source index |
|
inlinestatic |
Returns the pointer to the color (as a u32) of a particle in a buffer
| pt | particle buffer |
| idx | particle index |
|
inlinestatic |
Returns the pointer to a position of a particle in a buffer
| vert | particle buffer |
| idx | particle index |
|
inlinestatic |
Returns the pointer to the color (as a u8[4]) of a particle in a buffer
| pt | particle buffer |
| idx | particle index |
|
inlinestatic |
Returns the pointer to the size of a particle in a buffer
| pt | particle buffer |
| idx | particle index |
| void tpx_buffer_s8_swap | ( | TPXParticleS8 | pt[], |
| uint32_t | idxA, | ||
| uint32_t | idxB ) |
Swaps two particles in a buffer
| pt | buffer to swap particles in |
| idxA | index of the first particle |
| idxB | index of the second particle |
| void tpx_destroy | ( | ) |
Destroys the tinyPX library and frees all resources
| void tpx_init | ( | TPXInitParams | params | ) |
Initializes the tinyPX library.
| params | settings to configure the library |
| void tpx_matrix_pop | ( | int | count | ) |
Pops the current matrix from the stack.
| count | how many matrices to pop |
| void tpx_matrix_push | ( | const T3DMat4FP * | mat | ) |
Multiplies a matrix with the current stack position, then pushes it onto the stack.
| mat | address to load matrix from |
| void tpx_matrix_push_pos | ( | int | count | ) |
Moves the stack pos. without changing a matrix or causing re-calculations. This should only be used in preparation for 'tpx_matrix_set' calls.
E.g. instead of multiple push/pop combis, use:
This is the most efficient way to set multiple matrices at the same level.
| count | relative change (matrix count), should usually be 1 |
| void tpx_matrix_set | ( | const T3DMat4FP * | mat, |
| bool | doMultiply ) |
Directly loads a matrix, overwriting the current stack position.
With 'doMultiply' set to false, this lets you completely replace the current matrix. With 'doMultiply' set to true, it serves as a faster version of a pop+push combination.
| mat | address to load matrix from |
| doMultiply | if true, the matrix will be multiplied with the previous stack entry |
| void tpx_particle_draw_s16 | ( | TPXParticleS16 * | particles, |
| uint32_t | count ) |
Draws a given amount of particles (16bit position precision). 16bit Precision gives you larger range but comes with slightly more memory and runtime cost. Whenever possible use the 8bit version instead. It is most useful if you need to cover large ranges, e.g. when using it for billboards in scene.
In contrast to triangles in t3d, this works in a single command. So load, transform and draw happens in one go.
| particles | pointer to the particle data |
| count | number of particles to draw |
| void tpx_particle_draw_s8 | ( | TPXParticleS8 * | particles, |
| uint32_t | count ) |
Draws a given amount of particles (8bit position precision). In contrast to triangles in t3d, this works in a single command. So load, transform and draw happens in one go.
| particles | pointer to the particle data |
| count | number of particles to draw |
| void tpx_particle_draw_tex_s16 | ( | TPXParticleS16 * | particles, |
| uint32_t | count ) |
Draws a given amount of particles (16bit position precision). 16bit Precision gives you larger range but comes with slightly more memory and runtime cost. Whenever possible use the 8bit version instead. It is most useful if you need to cover large ranges, e.g. when using it for billboards in scene.
Note: this expects that you already setup textures. It will also always use TILE0 for the rect-commands. A per-particle texture offset can be set in 'texOffsetA'/'texOffsetB'.
| particles | pointer to the particle data |
| count | number of particles to draw |
| void tpx_particle_draw_tex_s8 | ( | TPXParticleS8 * | particles, |
| uint32_t | count ) |
Draws a given amount of particles with a texture. In contrast to triangles in t3d, this works in a single command. So load, transform and draw happens in one go.
Note: this expects that you already setup textures. It will also always use TILE0 for the rect-commands. The colors alpha channel acts as a texture offset.
| particles | pointer to the particle data |
| count | number of particles to draw |
| void tpx_state_from_t3d | ( | ) |
T3D and TPX have separate states and ucodes. This function copies the relevant T3D state to TPX.
Settings that are copied:
| void tpx_state_set_base_size | ( | uint16_t | baseSize | ) |
Sets a global base size from which all particles are scaled. This values can later only be scaled down, not up. By default it is set to 128, which should be good enough for most cases. If you notices particles are way too small or large, you can change this value. This may happen if you use large or very small screen sizes, or unusual near/far values.
| baseSize | unit-less base size, def.: 128 |
| void tpx_state_set_scale | ( | float | scaleX, |
| float | scaleY ) |
Sets a global scaling factor applied to all particles Note that you can only scale down, not up.
| scaleX | horizontal scaling factor, range: 0.0 - 1.0 |
| scaleY | vertical scaling factor, range: 0.0 - 1.0 |
| void tpx_state_set_tex_params | ( | int16_t | offsetX, |
| uint16_t | mirrorPoint ) |
Sets global params for textured particles. Those can be used to animate particles over time. NOTE: Check out the '19_particles_tex' example for more info.
| offsetX | base-offset UV offset in 1/4th pixels. This refers to the 8x8px base size irrespective of the actual texture size. |
| mirrorPoint | point where the texture should be mirrored This is in amount of sections of the 8x8px base size. So if you want to repeat after 32px set it to 4. If you want no mirroring, set it to 0. |