diagrams-lib-1.4.3: Embedded domain-specific language for declarative graphics

Copyright | (c) 2014 diagrams-lib team (see LICENSE)
License | BSD-style (see LICENSE)
Maintainer | diagrams-discuss@googlegroups.com
Safe Haskell | None
Language | Haskell2010

Diagrams.ThreeD.Attributes

Description

Diagrams may have attributes which affect the way they are rendered. This module defines some common attributes relevant in 3D; particular backends may also define more backend-specific attributes.

Every attribute type must have a semigroup structure, that is, an associative binary operation for combining two attributes into one. Unless otherwise noted, all the attributes defined here use the `Last` structure, that is, combining two attributes simply keeps the second one and throws away the first. This means that child attributes always override parent attributes.

Synopsis

- newtype SurfaceColor = SurfaceColor (Last (Colour Double))
- _SurfaceColor :: Iso' SurfaceColor (Colour Double)
- sc :: HasStyle d => Colour Double -> d -> d
- _sc :: Lens' (Style v n) (Maybe (Colour Double))
- newtype Diffuse = Diffuse (Last Double)
- _Diffuse :: Iso' Diffuse Double
- diffuse :: HasStyle d => Double -> d -> d
- _diffuse :: Lens' (Style v n) (Maybe Double)
- newtype Ambient = Ambient (Last Double)
- _Ambient :: Iso' Ambient Double
- ambient :: HasStyle d => Double -> d -> d
- _ambient :: Lens' (Style v n) (Maybe Double)
- data Specular = Specular {
  - _specularIntensity :: Double
  - _specularSize :: Double
  }
- specularSize :: Lens' Specular Double
- specularIntensity :: Lens' Specular Double
- newtype Highlight = Highlight (Last Specular)
- _Highlight :: Iso' Highlight Specular
- highlight :: HasStyle d => Specular -> d -> d
- _highlight :: Lens' (Style v n) (Maybe Specular)
- highlightIntensity :: Traversal' (Style v n) Double
- highlightSize :: Traversal' (Style v n) Double

# Documentation

newtype SurfaceColor Source #

`SurfaceColor` is the inherent pigment of an object, assumed to be opaque.

Constructors

SurfaceColor (Last (Colour Double)) |

#### Instances

Instances details

Show SurfaceColor Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods showsPrec :: Int -> SurfaceColor -> ShowS show :: SurfaceColor -> String showList :: [SurfaceColor] -> ShowS
Semigroup SurfaceColor Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods (<>) :: SurfaceColor -> SurfaceColor -> SurfaceColor sconcat :: NonEmpty SurfaceColor -> SurfaceColor stimes :: Integral b => b -> SurfaceColor -> SurfaceColor
AttributeClass SurfaceColor Source # |
Instance details Defined in Diagrams.ThreeD.Attributes

_SurfaceColor :: Iso' SurfaceColor (Colour Double) Source #

sc :: HasStyle d => Colour Double -> d -> d Source #

Set the surface color.

_sc :: Lens' (Style v n) (Maybe (Colour Double)) Source #

Lens onto the surface colour of a style.

newtype Diffuse Source #

`Diffuse` is the fraction of incident light reflected diffusely, that is, in all directions. The actual light reflected is the product of this value, the incident light, and the `SurfaceColor` Attribute. For physical reasonableness, `Diffuse` should have a value between 0 and 1; this is not checked.

Constructors

Diffuse (Last Double) |

#### Instances

Instances details

Show Diffuse Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods showsPrec :: Int -> Diffuse -> ShowS show :: Diffuse -> String showList :: [Diffuse] -> ShowS
Semigroup Diffuse Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods (<>) :: Diffuse -> Diffuse -> Diffuse sconcat :: NonEmpty Diffuse -> Diffuse stimes :: Integral b => b -> Diffuse -> Diffuse
AttributeClass Diffuse Source # |
Instance details Defined in Diagrams.ThreeD.Attributes

_Diffuse :: Iso' Diffuse Double Source #

Isomorphism between `Diffuse` and `Double`

diffuse :: HasStyle d => Double -> d -> d Source #

Set the diffuse reflectance.

_diffuse :: Lens' (Style v n) (Maybe Double) Source #

Lens onto the possible diffuse reflectance in a style.

newtype Ambient Source #

`Ambient` is an ad-hoc representation of indirect lighting. The product of `Ambient` and `SurfaceColor` is added to the light leaving an object due to diffuse and specular terms. `Ambient` can be set per-object, and can be loosely thought of as the product of indirect lighting incident on that object and the diffuse reflectance.

Constructors

Ambient (Last Double) |

#### Instances

Instances details

Show Ambient Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods showsPrec :: Int -> Ambient -> ShowS show :: Ambient -> String showList :: [Ambient] -> ShowS
Semigroup Ambient Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods (<>) :: Ambient -> Ambient -> Ambient sconcat :: NonEmpty Ambient -> Ambient stimes :: Integral b => b -> Ambient -> Ambient
AttributeClass Ambient Source # |
Instance details Defined in Diagrams.ThreeD.Attributes

_Ambient :: Iso' Ambient Double Source #

ambient :: HasStyle d => Double -> d -> d Source #

Set the emittance due to ambient light.

_ambient :: Lens' (Style v n) (Maybe Double) Source #

Lens onto the possible ambience in a style.

data Specular Source #

A specular highlight has two terms, the intensity, between 0 and 1, and the size. The highlight size is assumed to be the exponent in a Phong shading model (though Backends are free to use a different shading model). In this model, reasonable values are between 1 and 50 or so, with higher values for shinier objects. Physically, the intensity and the value of `Diffuse` must add up to less than 1; this is not enforced.

Constructors

Specular |

Fields

- _specularIntensity :: Double
- _specularSize :: Double

#### Instances

Instances details

Show Specular Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods showsPrec :: Int -> Specular -> ShowS show :: Specular -> String showList :: [Specular] -> ShowS

specularSize :: Lens' Specular Double Source #

specularIntensity :: Lens' Specular Double Source #

newtype Highlight Source #

Constructors

Highlight (Last Specular) |

#### Instances

Instances details

Show Highlight Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods showsPrec :: Int -> Highlight -> ShowS show :: Highlight -> String showList :: [Highlight] -> ShowS
Semigroup Highlight Source # |
Instance details Defined in Diagrams.ThreeD.Attributes Methods (<>) :: Highlight -> Highlight -> Highlight sconcat :: NonEmpty Highlight -> Highlight stimes :: Integral b => b -> Highlight -> Highlight
AttributeClass Highlight Source # |
Instance details Defined in Diagrams.ThreeD.Attributes

_Highlight :: Iso' Highlight Specular Source #

highlight :: HasStyle d => Specular -> d -> d Source #

Set the specular highlight.

_highlight :: Lens' (Style v n) (Maybe Specular) Source #

Lens onto the possible specular highlight in a style

highlightIntensity :: Traversal' (Style v n) Double Source #

Traversal over the highlight intensity of a style. If the style has no `Specular`, setting this will do nothing.

highlightSize :: Traversal' (Style v n) Double Source #

Traversal over the highlight size in a style. If the style has no `Specular`, setting this will do nothing.