Base citro3d functions.
More...
#include "buffers.h"
#include "maths.h"
Go to the source code of this file.
|
#define | C3D_DEFAULT_CMDBUF_SIZE 0x40000 |
| Default command buffer size.
|
|
|
bool | C3D_Init (size_t cmdBufSize) |
| Initializes citro3d.
|
|
void | C3D_Fini (void) |
| Deinitializes citro3d.
|
|
float | C3D_GetCmdBufUsage (void) |
| Retrieves the current command buffer usage.
|
|
void | C3D_BindProgram (shaderProgram_s *program) |
| Binds a shader program to the current rendering state.
|
|
void | C3D_SetViewport (u32 x, u32 y, u32 w, u32 h) |
| Sets the viewport for the current framebuffer.
|
|
void | C3D_SetScissor (GPU_SCISSORMODE mode, u32 left, u32 top, u32 right, u32 bottom) |
| Defines the scissor box.
|
|
void | C3D_DrawArrays (GPU_Primitive_t primitive, int first, int size) |
| Renders primitives from current vertex array buffer.
|
|
void | C3D_DrawElements (GPU_Primitive_t primitive, int count, int type, const void *indices) |
| Renders primitives from current vertex array buffer in a manually specified order.
|
|
|
void | C3D_ImmDrawBegin (GPU_Primitive_t primitive) |
| Delimits the vertices of a primitive or a group of like primitives.
|
|
void | C3D_ImmSendAttrib (float x, float y, float z, float w) |
| Specifies an immediate attribute.
|
|
void | C3D_ImmDrawEnd (void) |
| Delimits the vertices of a primitive or a group of like primitives.
|
|
static void | C3D_ImmDrawRestartPrim (void) |
| Specifies the end of the previous strip/fan and the beginning of a new one.
|
|
|
C3D_FVec * | C3D_FixedAttribGetWritePtr (int id) |
| Gets the pointer to the fixed attribute vector for the specified attribute index.
|
|
static void | C3D_FixedAttribSet (int id, float x, float y, float z, float w) |
| Sets fixed attribute vector for the specified attribute index.
|
|
◆ anonymous enum
Data type of indices for use with C3D_DrawElements().
Enumerator |
---|
C3D_UNSIGNED_BYTE | Unsigned 8-bit integer.
|
C3D_UNSIGNED_SHORT | Unsigned 16-bit integer.
|
◆ C3D_BindProgram()
Binds a shader program to the current rendering state.
- Parameters
-
[in] | program | Specifies the pointer to a shader program object whose executables are to be used as part of the current rendering state. |
◆ C3D_DrawArrays()
Renders primitives from current vertex array buffer.
- Parameters
-
[in] | primitive | Specifies what kind of primitives to render. |
[in] | first | Specifies the starting index in the current buffers. |
[in] | size | Specifies the number of indices to be rendered. |
◆ C3D_DrawElements()
void C3D_DrawElements |
( |
GPU_Primitive_t |
primitive, |
|
|
int |
count, |
|
|
int |
type, |
|
|
const void * |
indices |
|
) |
| |
Renders primitives from current vertex array buffer in a manually specified order.
- Parameters
-
[in] | primitive | Specifies what kind of primitives to render. |
[in] | count | Specifies the number of indices to be rendered. |
[in] | type | Specifies the data type of the indices. May be C3D_UNSIGNED_BYTE or C3D_UNSIGNED_SHORT. |
[in] | indices | Specifies a pointer to where the indices are stored. |
◆ C3D_Fini()
◆ C3D_FixedAttribGetWritePtr()
C3D_FVec * C3D_FixedAttribGetWritePtr |
( |
int |
id | ) |
|
Gets the pointer to the fixed attribute vector for the specified attribute index.
- Parameters
-
- Returns
- Pointer to the fixed attribute vector for the current attribute.
- See also
- C3D_FixedAttribSet()
◆ C3D_FixedAttribSet()
static void C3D_FixedAttribSet |
( |
int |
id, |
|
|
float |
x, |
|
|
float |
y, |
|
|
float |
z, |
|
|
float |
w |
|
) |
| |
|
inlinestatic |
Sets fixed attribute vector for the specified attribute index.
- Note
- The attribute index should be the same as returned by AttrInfo_AddFixed().
- Parameters
-
[in] | id | Attribute index. |
[in] | x | Specifies the X value of the attribute. |
[in] | y | Specifies the Y value of the attribute. |
[in] | z | Specifies the Z value of the attribute. |
[in] | w | Specifies the W value of the attribute. |
◆ C3D_GetCmdBufUsage()
float C3D_GetCmdBufUsage |
( |
void |
| ) |
|
Retrieves the current command buffer usage.
- Returns
- Fraction of command buffer used. (0.0f to 1.0f)
◆ C3D_ImmDrawBegin()
Delimits the vertices of a primitive or a group of like primitives.
- Parameters
-
◆ C3D_ImmDrawEnd()
void C3D_ImmDrawEnd |
( |
void |
| ) |
|
Delimits the vertices of a primitive or a group of like primitives.
- See also
- C3D_ImmDrawBegin()
◆ C3D_ImmDrawRestartPrim()
static void C3D_ImmDrawRestartPrim |
( |
void |
| ) |
|
|
inlinestatic |
Specifies the end of the previous strip/fan and the beginning of a new one.
- See also
- C3D_ImmDrawBegin()
◆ C3D_ImmSendAttrib()
void C3D_ImmSendAttrib |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z, |
|
|
float |
w |
|
) |
| |
Specifies an immediate attribute.
- Note
- Attributes must be specified in the same order they were specified using AttrInfo_AddLoader().
- Parameters
-
[in] | x | Specifies the X value of the current attribute. |
[in] | y | Specifies the Y value of the current attribute. |
[in] | z | Specifies the Z value of the current attribute. |
[in] | w | Specifies the W value of the current attribute. |
◆ C3D_Init()
bool C3D_Init |
( |
size_t |
cmdBufSize | ) |
|
Initializes citro3d.
- Parameters
-
- Note
- If you have a particularly complex scene you might need to specify a larger
cmdBufSize
. Conversely, you may want to decrease it if you're particularly concerned about memory consumption.
- Returns
- true if library was initialized successfully, false if there was an error.
◆ C3D_SetScissor()
Defines the scissor box.
- Note
- When using this with a rendertarget intended for display, keep in mind the orientation of the screens.
- Parameters
-
[in] | mode | Specifies scissoring mode. |
[in] | left | Leftmost boundary in pixels. |
[in] | top | Topmost boundary in pixels. |
[in] | right | Rightmost boundary in pixels. |
[in] | bottom | Bottommost boundary in pixels. |
◆ C3D_SetViewport()
Sets the viewport for the current framebuffer.
- Note
- This function is called by C3D_FrameDrawOn(). (using values specified by C3D_RenderTargetCreate())
-
When using this with a rendertarget intended for display, keep in mind the orientation of the screens.
- Parameters
-
[in] | x | X offset from the origin of the viewport in pixels. |
[in] | y | Y offset from the origin of the viewport in pixels. |
[in] | w | Width of the viewport in pixels. |
[in] | h | Height of the viewport in pixels. |