Safe Haskell | Safe-Infered |
---|
Textures are type safe in GPipe, e.g. when you sample a RGBFormat
texture, you get an RGB
value.
Textures are either created directly from memory, or by giving a framebuffer a concrete size (which it otherwise don't have). The latter is however not possible for 3D textures.
Depth textures are textures that contains depth component data (of type DepthFormat
) but takes the type
of LuminanceFormat
or AlphaFormat
textures, and are sampled as such.
- data Texture3D f
- data Texture2D f
- data Texture1D f
- data TextureCube f
- class Texture t where
- type TextureFormat t
- type TextureSize t
- type TextureVertexCoord t
- type TextureFragmentCoord t
- textureCPUFormatByteSize :: CPUFormat (TextureFormat t) -> TextureSize t -> [Int]
- sample :: Sampler -> t -> TextureFragmentCoord t -> Color (TextureFormat t) (Fragment Float)
- sampleBias :: Sampler -> t -> TextureFragmentCoord t -> Fragment Float -> Color (TextureFormat t) (Fragment Float)
- sampleLod :: Sampler -> t -> TextureVertexCoord t -> Vertex Float -> Color (TextureFormat t) (Vertex Float)
- newTexture :: (Texture t, GPUFormat (TextureFormat t)) => CPUFormat (TextureFormat t) -> TextureFormat t -> TextureSize t -> [Ptr a] -> IO t
- newDepthTexture :: (Texture t, DepthColorFormat (TextureFormat t)) => CPUFormat (TextureFormat t) -> DepthFormat -> TextureSize t -> [Ptr a] -> IO t
- class Texture t => FromFrameBufferColor t c where
- fromFrameBufferColor :: TextureFormat t -> TextureSize t -> FrameBuffer c d s -> t
- class Texture t => FromFrameBufferDepth t where
- fromFrameBufferDepth :: DepthFormat -> TextureSize t -> FrameBuffer c DepthFormat s -> t
- class ColorFormat a => DepthColorFormat a
- fromFrameBufferCubeColor :: ColorFormat c => c -> Vec2 Int -> FrameBuffer c d1 s1 -> FrameBuffer c d2 s2 -> FrameBuffer c d3 s3 -> FrameBuffer c d4 s4 -> FrameBuffer c d5 s5 -> FrameBuffer c d6 s6 -> TextureCube c
- fromFrameBufferCubeDepth :: DepthColorFormat d => DepthFormat -> Vec2 Int -> FrameBuffer c1 DepthFormat s1 -> FrameBuffer c2 DepthFormat s2 -> FrameBuffer c3 DepthFormat s3 -> FrameBuffer c4 DepthFormat s4 -> FrameBuffer c5 DepthFormat s5 -> FrameBuffer c6 DepthFormat s6 -> TextureCube d
- data Sampler = Sampler Filter EdgeMode
- data Filter
- data EdgeMode
Data types
A 3D texture. May only be created from main memory in GPipe.
Texture3D
f
has the following associated types in its Texture
instance:
ColorFormat f => Texture (Texture3D f) |
DepthColorFormat f => FromFrameBufferDepth (Texture2D f) | |
ColorFormat f => Texture (Texture2D f) | |
ColorFormat f => FromFrameBufferColor (Texture2D f) f |
A 1D texture. Assumes a frame buffer of height 1 when created from such.
Texture1D
f
has the following associated types in its Texture
instance:
DepthColorFormat f => FromFrameBufferDepth (Texture1D f) | |
ColorFormat f => Texture (Texture1D f) | |
ColorFormat f => FromFrameBufferColor (Texture1D f) f |
data TextureCube f Source
A cube texture. The sides of the cube are always specified in this order: Positive X, negative X,
positive Y, negative Y, positive Z, negative Z.
TextureCube
f
has the following associated types in its Texture
instance:
ColorFormat f => Texture (TextureCube f) |
Operation
type TextureFormat t Source
The color format of the texture, affects the type of the samples from the texture.
type TextureSize t Source
The type that is used for the dimension of texture.
type TextureVertexCoord t Source
The sample coordinate in Vertex
s.
type TextureFragmentCoord t Source
The sample coordinate in Fragment
s.
textureCPUFormatByteSize :: CPUFormat (TextureFormat t) -> TextureSize t -> [Int]Source
Calculates the byte size of all mipmaps for a specific format and size, which eases the useage of
newTexture
and newDepthTexture
.
sample :: Sampler -> t -> TextureFragmentCoord t -> Color (TextureFormat t) (Fragment Float)Source
Samples the texture using mipmaps in a Fragment
.
sampleBias :: Sampler -> t -> TextureFragmentCoord t -> Fragment Float -> Color (TextureFormat t) (Fragment Float)Source
Samples the texture using mipmaps in a Fragment
, with a bias to add to the mipmap level.
sampleLod :: Sampler -> t -> TextureVertexCoord t -> Vertex Float -> Color (TextureFormat t) (Vertex Float)Source
Samples the texture using a specific mipmap in a Vertex
.
ColorFormat f => Texture (TextureCube f) | |
ColorFormat f => Texture (Texture1D f) | |
ColorFormat f => Texture (Texture2D f) | |
ColorFormat f => Texture (Texture3D f) |
Creation
:: (Texture t, GPUFormat (TextureFormat t)) | |
=> CPUFormat (TextureFormat t) | The format of the data in the provided Ptr's. |
-> TextureFormat t | The format of the resulting texture on the GPU. |
-> TextureSize t | The dimension of the texture. |
-> [Ptr a] | A list of Ptr's for each mipmap of the texture (you may provide as many as you want).
For |
-> IO t |
Creates a texture from color data in main memory. It lives in the IO monad for the sake of the Ptr's, and could otherwise safely be wrapped in unsafePerformIO
calls.
:: (Texture t, DepthColorFormat (TextureFormat t)) | |
=> CPUFormat (TextureFormat t) | The format of the data in the provided Ptr's. |
-> DepthFormat | The depth format of the resulting texture on the GPU. |
-> TextureSize t | The dimension of the texture. |
-> [Ptr a] | A list of Ptr's for each mipmap of the texture (you may provide as many as you want).
For |
-> IO t |
Creates a depth texture from data in main memory. The texture will have the type of a color format and is sampled as such, but contains depth
component information internally. It lives in the IO monad for the sake of the Ptr's, and could otherwise safely be wrapped in unsafePerformIO
calls.
class Texture t => FromFrameBufferColor t c whereSource
The textures that is instances of this class may be created from a FrameBuffer
s color buffer.
fromFrameBufferColor :: TextureFormat t -> TextureSize t -> FrameBuffer c d s -> tSource
Create a texture of a specific format from a FrameBuffer
and a size.
ColorFormat f => FromFrameBufferColor (Texture1D f) f | |
ColorFormat f => FromFrameBufferColor (Texture2D f) f |
class Texture t => FromFrameBufferDepth t whereSource
The textures that is instances of this class may be created from a FrameBuffer
s depth buffer.
The texture will have the type of a color format and is sampled as such, but contains depth
component information internally.
fromFrameBufferDepth :: DepthFormat -> TextureSize t -> FrameBuffer c DepthFormat s -> tSource
Create a texture of a specific depth format from a FrameBuffer
and a size.
DepthColorFormat f => FromFrameBufferDepth (Texture1D f) | |
DepthColorFormat f => FromFrameBufferDepth (Texture2D f) |
class ColorFormat a => DepthColorFormat a Source
The formats that is instances of this class may be used as depth textures, i.e. created with
newDepthTexture
, fromFrameBufferDepth
and fromFrameBufferCubeDepth
.
fromFrameBufferCubeColor :: ColorFormat c => c -> Vec2 Int -> FrameBuffer c d1 s1 -> FrameBuffer c d2 s2 -> FrameBuffer c d3 s3 -> FrameBuffer c d4 s4 -> FrameBuffer c d5 s5 -> FrameBuffer c d6 s6 -> TextureCube cSource
Create a TextureCube
of a specific format and size from the the color buffers of six framebuffers.
fromFrameBufferCubeDepth :: DepthColorFormat d => DepthFormat -> Vec2 Int -> FrameBuffer c1 DepthFormat s1 -> FrameBuffer c2 DepthFormat s2 -> FrameBuffer c3 DepthFormat s3 -> FrameBuffer c4 DepthFormat s4 -> FrameBuffer c5 DepthFormat s5 -> FrameBuffer c6 DepthFormat s6 -> TextureCube dSource
Create a TextureCube
of a specific depth format and size from the the depth buffers of six framebuffers.
The texture will have the type of a color format and is sampled as such, but contains depth
component information internally.
Samplers
A structure describing how a texture is sampled
Filter mode used in sampler state