Skip to content

Commit

Permalink
brightness pathway restored
Browse files Browse the repository at this point in the history
  • Loading branch information
dktr0 committed Nov 27, 2024
1 parent c19a681 commit 7460334
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
44 changes: 22 additions & 22 deletions punctual.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ render punctual args = do
webGLs <- read punctual.webGLs
case lookup args.zone webGLs of
Nothing -> pure unit
Just w -> drawWebGL w (numberToDateTime args.nowTime)
Just w -> do
brightness <- read punctual.sharedResources.brightness
drawWebGL w (numberToDateTime args.nowTime) brightness


postRender :: Punctual -> { canDraw :: Boolean, nowTime :: Number } -> Effect Unit
Expand Down
6 changes: 3 additions & 3 deletions src/WebGL.purs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ deleteWebGL :: WebGL -> Effect Unit
deleteWebGL webGL = deleteWebGLCanvas webGL.glc


drawWebGL :: WebGL -> DateTime -> Effect Unit
drawWebGL webGL now = do
drawWebGL :: WebGL -> DateTime -> Number -> Effect Unit
drawWebGL webGL now brightness = do
configureFrameBufferTextures webGL.glc
-- t0 <- nowDateTime
let glc = webGL.glc
Expand Down Expand Up @@ -200,7 +200,7 @@ drawWebGL webGL now = do
ofb <- getOutputFrameBuffer glc
bindFrameBuffer glc (Just ofb)
drawDefaultTriangleStrip glc
drawPostProgram glc
drawPostProgram glc brightness
-- t1 <- nowDateTime
-- log $ " draw time = " <> show (diff t1 t0 :: Milliseconds)
pure unit
Expand Down
6 changes: 3 additions & 3 deletions src/WebGLCanvas.purs
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,15 @@ _newPostProgram gl = do
_flush gl
pure glProg

drawPostProgram :: WebGLCanvas -> Effect Unit
drawPostProgram glc = do
drawPostProgram :: WebGLCanvas -> Number -> Effect Unit
drawPostProgram glc brightness = do
let p = glc.postProgram
useProgram glc p
t <- getOutputTexture glc
w <- getCanvasWidth glc
h <- getCanvasHeight glc
bindTexture glc p t 0 "t"
setUniform1f glc p "b" 1.0
setUniform1f glc p "b" brightness
setUniform2f glc p "r" (toNumber w) (toNumber h)
viewport glc 0 0 w h
harmonizeCanvasDimensions glc
Expand Down

0 comments on commit 7460334

Please sign in to comment.