From 5e184db3c1319caebdcd8fbab25596cd7f82a480 Mon Sep 17 00:00:00 2001 From: Péter Diviánszky Date: Mon, 22 Feb 2016 11:20:30 +0100 Subject: rename zeroComp --> zero; oneComp --> one --- lc/Builtins.lc | 44 +++++++++++++++++----------------- testdata/Graphics.lc | 24 ++++++++----------- testdata/performance/Graphics.out | 2 +- testdata/reject.ignore/adhoc.reject.lc | 2 +- 4 files changed, 34 insertions(+), 38 deletions(-) diff --git a/lc/Builtins.lc b/lc/Builtins.lc index 41cbbeb0..23035684 100644 --- a/lc/Builtins.lc +++ b/lc/Builtins.lc @@ -101,39 +101,39 @@ instance Signed Int instance Signed Float class Component a where - zeroComp :: a - oneComp :: a + zero :: a + one :: a instance Component Int where - zeroComp = 0 :: Int - oneComp = 1 :: Int + zero = 0 :: Int + one = 1 :: Int instance Component Word where - zeroComp = 0 :: Word - oneComp = 1 :: Word + zero = 0 :: Word + one = 1 :: Word instance Component Float where - zeroComp = 0.0 - oneComp = 1.0 + zero = 0.0 + one = 1.0 instance Component (VecS Float 2) where - zeroComp = V2 0.0 0.0 - oneComp = V2 1.0 1.0 + zero = V2 0.0 0.0 + one = V2 1.0 1.0 instance Component (VecS Float 3) where - zeroComp = V3 0.0 0.0 0.0 - oneComp = V3 1.0 1.0 1.0 + zero = V3 0.0 0.0 0.0 + one = V3 1.0 1.0 1.0 instance Component (VecS Float 4) where - zeroComp = V4 0.0 0.0 0.0 0.0 - oneComp = V4 1.0 1.0 1.0 1.0 + zero = V4 0.0 0.0 0.0 0.0 + one = V4 1.0 1.0 1.0 1.0 instance Component Bool where - zeroComp = False - oneComp = True + zero = False + one = True instance Component (VecS Bool 2) where - zeroComp = V2 False False - oneComp = V2 True True + zero = V2 False False + one = V2 True True instance Component (VecS Bool 3) where - zeroComp = V3 False False False - oneComp = V3 True True True + zero = V3 False False False + one = V3 True True True instance Component (VecS Bool 4) where - zeroComp = V4 False False False False - oneComp = V4 True True True True + zero = V4 False False False False + one = V4 True True True True class Integral a diff --git a/testdata/Graphics.lc b/testdata/Graphics.lc index 29c110da..666438c1 100644 --- a/testdata/Graphics.lc +++ b/testdata/Graphics.lc @@ -3,8 +3,6 @@ module Graphics where import Material hiding (Blending) import SampleMaterial -zero' = zeroComp -one' = oneComp --texture' _ _ = V4 0.0 0.0 0.0 0.0 --PrimTexture texture' = texture2D @@ -40,7 +38,7 @@ mkRasterContext ca = TriangleCtx cull PolygonFill offset LastVertex CT_TwoSided -> CullNone mkaccumulationContext :: StageAttrs -> (FragmentOperation (Depth Float), FragmentOperation (Color (Vec 4 Float))) -mkaccumulationContext sa = (DepthOp depthFunc depthWrite, ColorOp blend (one' :: Vec 4 Bool)) +mkaccumulationContext sa = (DepthOp depthFunc depthWrite, ColorOp blend (one :: Vec 4 Bool)) where depthWrite = saDepthWrite sa depthFunc = case saDepthFunc sa of @@ -60,7 +58,7 @@ mkaccumulationContext sa = (DepthOp depthFunc depthWrite, ColorOp blend (one' :: B_Zero -> Zero' blend = case saBlend sa of Nothing -> NoBlending - Just (src,dst) -> Blend (FuncAdd,FuncAdd) ((srcF,dstF),(srcF,dstF)) one' + Just (src,dst) -> Blend (FuncAdd,FuncAdd) ((srcF,dstF),(srcF,dstF)) one where srcF = cvt src dstF = cvt dst @@ -101,10 +99,10 @@ mkColor ca sa = \rgbaV -> rgb' = case saRGBGen sa of RGB_Wave w -> let c = mkWave w in V3 c c c :: Vec 3 Float RGB_Const r g b -> V3 r g b - RGB_Identity -> one' + RGB_Identity -> one RGB_IdentityLighting -> V3 identityLight' identityLight' identityLight' RGB_Entity -> entityRGB - RGB_OneMinusEntity -> one' - entityRGB + RGB_OneMinusEntity -> one - entityRGB RGB_ExactVertex -> V3 rV gV bV RGB_Vertex -> (V3 rV gV bV) *! identityLight' RGB_LightingDiffuse -> white' -- TODO @@ -115,7 +113,7 @@ mkColor ca sa = \rgbaV -> model: position normal -} - RGB_OneMinusVertex -> one' - ((V3 rV gV bV) *! identityLight') + RGB_OneMinusVertex -> one - ((V3 rV gV bV) *! identityLight') alpha = case saAlphaGen sa of A_Wave w -> let a = mkWave w in clamp a 0 1 @@ -301,8 +299,8 @@ errorShaderFill fb = accumulate fragCtx frag rast fb v4 = viewProj *. (worldMat *. snoc p 1) c' = V4 c%r c%g c%b 0.5 - blend = Blend (FuncAdd,Min) ((One,One),(One,One)) one' - fragCtx = accumulationContext (DepthOp Less False, ColorOp blend (one' :: Vec 4 Bool)) + blend = Blend (FuncAdd,Min) ((One,One),(One,One)) one + fragCtx = accumulationContext (DepthOp Less False, ColorOp blend (one :: Vec 4 Bool)) rastCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex input = fetch "missing shader" Triangle (Attribute "position" :: Vec 3 Float, Attribute "color" :: Vec 4 Float) prims = mapPrimitives vert input @@ -323,22 +321,20 @@ errorShader fb = accumulate fragCtx frag rast (errorShaderFill fb) v4 = viewProj *. (worldMat *. snoc p 1) offset = NoOffset--Offset (0) (-10) - fragCtx = accumulationContext (DepthOp Lequal True, ColorOp NoBlending (one' :: Vec 4 Bool)) + fragCtx = accumulationContext (DepthOp Lequal True, ColorOp NoBlending (one :: Vec 4 Bool)) rastCtx = TriangleCtx CullNone (PolygonLine 1) offset LastVertex input = fetch "missing shader" Triangle (Attribute "position" :: Vec 3 Float, Attribute "color" :: Vec 4 Float) prims = mapPrimitives vert input rast = rasterizePrimitives rastCtx ((Smooth)) prims -- frag :: Vec 4 Float -> (Depth Float, Color (Vec 4 Float)) - frag = \((v)) -> let - one = 1 - in ((V4 (one -! v%r) (one -! v%g) (one -! v%b) one)) + frag = \((v)) -> ((V4 (1 - v%r) (1 - v%g) (1 - v%b) 1)) q3GFX :: [(String,CommonAttrs)] -> FB q3GFX shl = {-blurVH $ PrjFrameBuffer "" tix0 $ -}errorShader (foldl' mkShader clear ordered) where ordered = sortBy (\(_,a) (_,b) -> caSort a `compare` caSort b) shl - clear = FrameBuffer (depthImage1 1000, colorImage1 (zero'::Vec 4 Float)) + clear = FrameBuffer (depthImage1 1000, colorImage1 (zero :: Vec 4 Float)) --main :: Output main = ScreenOut (q3GFX sampleMaterial) diff --git a/testdata/performance/Graphics.out b/testdata/performance/Graphics.out index fc891b27..52c8a2ed 100644 --- a/testdata/performance/Graphics.out +++ b/testdata/performance/Graphics.out @@ -1,5 +1,5 @@ Pipeline - { info = "generated by lambdcube-compiler 0.5.0.0" + { info = "generated by lambdacube-compiler 0.5.0.0" , backend = OpenGL33 , textures = [] , samplers = [] diff --git a/testdata/reject.ignore/adhoc.reject.lc b/testdata/reject.ignore/adhoc.reject.lc index 42e2d968..659029b6 100644 --- a/testdata/reject.ignore/adhoc.reject.lc +++ b/testdata/reject.ignore/adhoc.reject.lc @@ -1,7 +1,7 @@ data A = A -x = oneComp :: Vec 4 A +x = one :: Vec 4 A main = x -- TODO: catch error at application -- cgit v1.2.3