Crate fna3d

Source
Expand description

Wrapper of FNA3D, the graphics library for FNA

See fna3h as an alternative.

See examples to get started.

§What is fna3d?

fna3d is a wrapper around fna3d-sys, which is Rust FFI to FNA3D generated with bindgen.

FNA3D is the 3D graphics library for FNA written in C99 in 2020. FNA is a reimplementation of XNA. XNA is a famous game framework.

§What does Rust-FNA3D do?

Device is reference counted and it drops FNA3D device when they go out of scope.

Other changes are trivial; they’re just for improvements to the default output of bindgen:

  • Wrapping the original API with rusty types: slices, enums and booleans
  • Wrapping some legacy API (XNA-compatibility API) with more meaningful one

Details are noted in this file on GitHub.

Re-exports§

pub use bitflags;
pub use fna3d_sys as sys;

Modules§

img
FNA3D_Image.h with some helpers
mojo
MojoShader types and some helpers
utils
Helpers

Structs§

BlendState
ClearOptions
Device::clear parameter, which specifies the buffers for clearing
Color
24 bits RGBA color
DepthStencilState
Pipeline
Device
FNA3D device
RasterizerState
Pipeline
RenderTargetBinding
Offscreen rendering
SamplerState
Specifies texture sampling method
SdlWindowFlags
Newtype of untyped SDL_WindowFlags, which is used for SDL_CreateWindow

Enums§

Blend
BlendState component, which specifies blend mode
BlendFunction
BlendState component, which specifies color blending function (expression)
BufferUsage
Vertex/index buffer component, which hints optimization of memory placement
ColorWriteChannels
BlendState component, which specifies color channels for render target blending operations
CompareFunction
DepthStencilState component, which specifies comparison operator for depth testing
CubeMapFace
Cube map texture data component
CullMode
RasterizerState component
DepthFormat
PresentationParameters component, Renderbuffer attribute
DisplayOrientation
PresentationParameters component
FillMode
RasterizerState component
IndexElementSize
16 bits | 32 bits
PresentInterval
PresentationParameters component
PrimitiveType
Specifies primitive type used for drawing
RenderTargetType
2D | Cube
RenderTargetUsage
PresentationParameters component, Renderbuffer attribute
SetDataOptions
How vertex or index buffer data will be flushed during a SetData operation.
StencilOperation
DepthStencilState component
SurfaceFormat
Texture or Renderbuffer pixel data format (memory layout of each pixel)
TextureAddressMode
SamplerState component, which specifies texture coordinates addressing method
TextureFilter
SamplerState component, which specifies filtering types
VertexElementFormat
VertexElement component, which specifies the data type
VertexElementUsage
VertexElement component, which specifies its usage

Functions§

get_drawable_size
After your window is created, call this to check for high-DPI support.
linked_version
Version of FNA3D in use
prepare_window_attributes
Selects the most suitable graphics rendering backend for the system, then provides the application with context-sensitive bitflags for the OS window.

Type Aliases§

Buffer
Opaque struct that represents index or vertex buffer
Effect
Opaque struct that represents FNA3D effect
PresentationParameters
Query
Opaque object to run occlusion queries
Rect
Scissor rect or region of Renderbuffer
Renderbuffer
Opaque struct that represents FNA3D render buffer
Texture
Opaque struct that represents 2D or 3D texture data stored in GPU memory
Vec4
Used to represent color
VertexBufferBinding
Device::apply_vertex_buffer_bindings parameter, which describes vertex memory location and attributes
VertexDeclaration
VertexBufferBinding component that declares memory layout of a vertex data
VertexElement
VertexDeclaration component that specifies an element of vertex data
Viewport
The view bounds for render-target surface