jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUVertexAttribute.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webgpu (webref). Do not edit.
module JSDOM.Generated.GPUVertexAttribute
(newGPUVertexAttribute, setFormat, getFormat, setOffset, getOffset, setShaderLocation, getShaderLocation, GPUVertexAttribute(..), gTypeGPUVertexAttribute)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums
-- | <https://gpuweb.github.io/gpuweb/#dictdef-gpuvertexattribute GPUVertexAttribute specification>
newGPUVertexAttribute :: (MonadDOM m) => GPUVertexFormat -> Word53 -> Word -> m GPUVertexAttribute
newGPUVertexAttribute format offset shaderLocation = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "format" (toJSVal format)) P.>> (o ^. jss "offset" (toJSVal offset)) P.>> (o ^. jss "shaderLocation" (toJSVal shaderLocation)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexattribute-format GPUVertexAttribute.format specification>
setFormat :: (MonadDOM m) => GPUVertexAttribute -> GPUVertexFormat -> m ()
setFormat self val = liftDOM (void (self ^. jss "format" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexattribute-format GPUVertexAttribute.format specification>
getFormat :: (MonadDOM m) => GPUVertexAttribute -> m GPUVertexFormat
getFormat self = liftDOM (((self ^. js "format") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexattribute-offset GPUVertexAttribute.offset specification>
setOffset :: (MonadDOM m) => GPUVertexAttribute -> Word53 -> m ()
setOffset self val = liftDOM (void (self ^. jss "offset" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexattribute-offset GPUVertexAttribute.offset specification>
getOffset :: (MonadDOM m) => GPUVertexAttribute -> m Word53
getOffset self = liftDOM (((self ^. js "offset") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexattribute-shaderlocation GPUVertexAttribute.shaderLocation specification>
setShaderLocation :: (MonadDOM m) => GPUVertexAttribute -> Word -> m ()
setShaderLocation self val = liftDOM (void (self ^. jss "shaderLocation" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexattribute-shaderlocation GPUVertexAttribute.shaderLocation specification>
getShaderLocation :: (MonadDOM m) => GPUVertexAttribute -> m Word
getShaderLocation self = liftDOM ((P.round <$> ((self ^. js "shaderLocation") >>= valToNumber)))