Pack shape normals into a word8
This commit is contained in:
+16
-12
@@ -2,11 +2,12 @@
|
||||
--{-# OPTIONS_GHC -Wno-unused-top-binds #-}
|
||||
module Preload.Render (
|
||||
preloadRender,
|
||||
cleanUpRenderPreload,
|
||||
-- cleanUpRenderPreload,
|
||||
) where
|
||||
|
||||
import Shape.Parameters
|
||||
import Control.Concurrent
|
||||
import Control.Lens
|
||||
--import Control.Lens
|
||||
import Control.Monad
|
||||
import Data.Preload.Render
|
||||
import qualified Data.Vector.Mutable as MV
|
||||
@@ -18,7 +19,7 @@ import Shader.AuxAddition
|
||||
import Shader.Compile
|
||||
import Shader.Data
|
||||
import Shader.Parameters
|
||||
import Shape.Parameters
|
||||
--import Shape.Parameters
|
||||
|
||||
{- BINDING LIST:
|
||||
0 base
|
||||
@@ -35,7 +36,6 @@ preloadRender = do
|
||||
-- set up uniform buffer object
|
||||
putStrLn "Setup UBO"
|
||||
theUBO <- mglCreate glCreateBuffers
|
||||
--glNamedBufferData theUBO 64 nullPtr GL_STREAM_DRAW
|
||||
glNamedBufferStorage theUBO 64 nullPtr GL_DYNAMIC_STORAGE_BIT
|
||||
glBindBufferBase GL_UNIFORM_BUFFER 0 theUBO
|
||||
|
||||
@@ -55,14 +55,18 @@ preloadRender = do
|
||||
let wallvbo = VBO wallssbo wallssboptr 8
|
||||
|
||||
shapessbo <- mglCreate glCreateBuffers
|
||||
let shapessbosize = fromIntegral (sizeOf (0::Float) * 12) * 65536
|
||||
let shapessbosize = fromIntegral shapeVerxSize * 65536
|
||||
glNamedBufferStorage shapessbo shapessbosize nullPtr GL_DYNAMIC_STORAGE_BIT
|
||||
glBindBufferBase GL_SHADER_STORAGE_BUFFER 3 shapessbo
|
||||
shptr <- mallocArray (fromIntegral shapessbosize)
|
||||
let shVBO = VBO shapessbo shptr shapeVerxSize
|
||||
|
||||
ishapessbo <- mglCreate glCreateBuffers
|
||||
let ishapessbosize = fromIntegral (sizeOf (0::GLuint) * 65536)
|
||||
glNamedBufferStorage ishapessbo ishapessbosize nullPtr GL_DYNAMIC_STORAGE_BIT
|
||||
glBindBufferBase GL_SHADER_STORAGE_BUFFER 4 ishapessbo
|
||||
ishptr <- mallocArray 65536
|
||||
let shEBO = UintBO ishapessbo ishptr
|
||||
|
||||
ieshapessbo <- mglCreate glCreateBuffers
|
||||
let ieshapessbosize = fromIntegral (sizeOf (0::GLuint) * 65536)
|
||||
@@ -77,9 +81,9 @@ preloadRender = do
|
||||
wallpull <- makeShaderUsingVAO "pull/wall" [vert,frag] pmTriangles (VAO dummyvao)
|
||||
|
||||
putStrLn "Setup shape VBO, VAO, EBO"
|
||||
shVBO <- setupVBO shapeVerxSize
|
||||
shPosVAO <- setupVAOUsingVBO [VertexAttribute 4 GL_FLOAT GL_FALSE 0] shVBO
|
||||
shEBO <- setupEBO shPosVAO
|
||||
-- shVBO <- setupVBO shapeVerxSize
|
||||
-- shPosVAO <- setupVAOUsingVBO [VertexAttribute 4 GL_FLOAT GL_FALSE 0] shVBO
|
||||
-- shEBO <- setupEBO shPosVAO
|
||||
-- note the shape shader vao is distinct from the position vao, but they
|
||||
-- share an EBO
|
||||
-- shapeshader <- makeShaderUsingVBO "shape/basic" [vert, frag] shapeVerxAttributes
|
||||
@@ -221,8 +225,8 @@ preloadRender = do
|
||||
, _matUBO = theUBO
|
||||
-- , _winSSBO = winssbo
|
||||
-- , _wallSSBO = wallssbo
|
||||
, _shapeSSBO = shapessbo
|
||||
, _ishapeSSBO = ishapessbo
|
||||
-- , _shapeSSBO = shapessbo
|
||||
-- , _ishapeSSBO = ishapessbo
|
||||
-- , _ieshapeSSBO = ieshapessbo
|
||||
-- , _lightsUBO = lightsubo
|
||||
-- , _vboWindows = winvbo
|
||||
@@ -265,8 +269,8 @@ initializeGLState = do
|
||||
glEnable GL_DEPTH_TEST
|
||||
glEnable GL_STENCIL_TEST
|
||||
|
||||
cleanUpRenderPreload :: RenderData -> IO ()
|
||||
cleanUpRenderPreload _ = return ()
|
||||
--cleanUpRenderPreload :: RenderData -> IO ()
|
||||
--cleanUpRenderPreload _ = return ()
|
||||
|
||||
--cleanUpRenderPreload pd = do
|
||||
-- TODO fix this
|
||||
|
||||
Reference in New Issue
Block a user