hadronized / quaazar

Realtime 3D engine
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

Textures #8

Closed hadronized closed 9 years ago

hadronized commented 10 years ago

Introduction and context

We don’t have any kind of textures supported yet, even in core. We have to support that.

Texture

The simpler useful texture kind is the 2D version. We can imagine such a texture via data as follow:

data Texture = Texture {
    -- |Texture width.
    textureWidth   :: Natural
    -- |Texture height.
  , textureHeight  :: Natural
    -- |Texture format.
  , textureFormat :: TextureFormat
    -- |Texture texels.
  , textureTexels :: [Float]
  } deriving (Eq,Show)

data TextureFormat
  = R
  | RG
  | RGB
  | RGBA
    deriving (Eq,Ord,Show)

That simple. Each channel is on 32-bit float.

Integration into SceneRel

Now. Textures can be used in order to enrich materials. The thing is: how? Do we put them directly in the over materials? Or upper? Better: texture nodes!