Fix arc rendering bug (make vertex attribs correct size)
This commit is contained in:
Binary file not shown.
@@ -29,7 +29,6 @@ void main()
|
||||
|
||||
float onArcTest = max(dTest,aTest);
|
||||
|
||||
//gl_FragDepth = max(gl_FragCoord.z , step(gRadOut/2,distance(pos,cenPosT)));
|
||||
gl_FragDepth = max(gl_FragCoord.z , onArcTest);
|
||||
fColor = gColor;
|
||||
}
|
||||
|
||||
+4
-3
@@ -17,9 +17,10 @@ void main()
|
||||
angles = vparams[0].xy;
|
||||
vec3 cenPos = gl_in[0].gl_Position.xyz;
|
||||
gColor = vColor[0];
|
||||
float gWdth = vparams[0].w * 0.5;
|
||||
gRadOut = (vparams[0].z + gWdth) * zoom * 2;
|
||||
gRadIn = (vparams[0].z - gWdth) * zoom * 2;
|
||||
float width = vparams[0].w * 0.5;
|
||||
float rad = vparams[0].z;
|
||||
gRadOut = (rad + width) * zoom * 2;
|
||||
gRadIn = (rad - width) * zoom * 2;
|
||||
|
||||
cenPosT = vec2 ( (cenPos.x + 1) * 0.5 * winSize.x , (cenPos.y + 1) * 0.5 * winSize.y);
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 430 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec4 gColor;
|
||||
in vec2 gTex;
|
||||
|
||||
uniform sampler2D aTexture;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = texture(aTexture, gTex) * gColor;
|
||||
// FragColor = texture(aTexture, vTexCoord);
|
||||
// FragColor = gColor;
|
||||
// FragColor = vec4 (1,1,1,1);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
in vec4 vColor [];
|
||||
in vec2 vTexCoord [];
|
||||
out vec4 gColor;
|
||||
out vec2 gTex;
|
||||
void main()
|
||||
{
|
||||
vec3 cenPos = gl_in[0].gl_Position.xyz;
|
||||
float size = vTexCoord[0].y;
|
||||
//float size = 0.05;
|
||||
gColor = vColor[0];
|
||||
float texPos = vTexCoord[0].x;
|
||||
|
||||
gl_Position = vec4 (cenPos.x - size*0.5, cenPos.y - size, cenPos.z , 1);
|
||||
//gl_Position = vec4 (0, 0 , 5 , 1);
|
||||
gTex = vec2 (texPos*0.0078125, 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x - size*0.5, cenPos.y + size, cenPos.z , 1);
|
||||
//gl_Position = vec4 (0, 0.5 , 5 , 1);
|
||||
gTex = vec2 (texPos*0.0078125, 0);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x + size*0.5, cenPos.y - size, cenPos.z , 1);
|
||||
//gl_Position = vec4 (0.5, 0.5 , -5 , 1);
|
||||
gTex = vec2 ((texPos+1)*0.0078125, 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x + size*0.5, cenPos.y + size, cenPos.z , 1);
|
||||
gTex = vec2 ((texPos+1)*0.0078125, 0);
|
||||
//gl_Position = vec4 (0.5, 0 , -5 , 1);
|
||||
EmitVertex();
|
||||
|
||||
|
||||
EndPrimitive();
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 1) in vec4 aColor;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
|
||||
uniform vec2 winSize;
|
||||
uniform float zoom;
|
||||
uniform vec2 translation;
|
||||
uniform float rotation;
|
||||
|
||||
out vec4 vColor;
|
||||
out vec2 vTexCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(aPos, 1.0);
|
||||
vColor = aColor;
|
||||
vTexCoord = aTexCoord;
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#version 430 core
|
||||
in vec4 gColor;
|
||||
in vec2 cenPosT;
|
||||
in float gRad;
|
||||
out vec4 fColor;
|
||||
out float gl_FragDepth;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos = gl_FragCoord.xy;
|
||||
// fColor = vec4( gColor.xyz , 0 );
|
||||
// fColor = vec4( gColor.xyz , 1 - step(distance(pos,cenPos.xy),gRad) );
|
||||
// fColor = vec4( gColor.xyz , distance(pos,cenPos.xy)/gRad );
|
||||
// fColor = vec4( gColor.rgb, gColor.a * (1-step(gRad/2,distance(pos,cenPosT))) );
|
||||
gl_FragDepth = max(gl_FragCoord.z , step(gRad/2,distance(pos,cenPosT)));
|
||||
fColor = gColor;
|
||||
}
|
||||
//note it is the fragdepth that stops this from being square
|
||||
@@ -1,33 +0,0 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
in vec4 vColor [];
|
||||
in float vRad [];
|
||||
out vec4 gColor;
|
||||
out float gRad;
|
||||
out vec2 cenPosT;
|
||||
|
||||
uniform vec2 winSize;
|
||||
uniform float zoom;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 cenPos = gl_in[0].gl_Position.xyz;
|
||||
//cenPos = vec3 (0.5,0,0);
|
||||
gColor = vColor[0];
|
||||
gRad = vRad[0] * zoom * 2;
|
||||
// gRad = 0.2;
|
||||
|
||||
cenPosT = vec2 ( (cenPos.x + 1) * 0.5 * winSize.x , (cenPos.y + 1) * 0.5 * winSize.y);
|
||||
|
||||
gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y + gRad/winSize.y, cenPos.z , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y + gRad/winSize.y, cenPos.z , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y - gRad/winSize.y, cenPos.z , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y - gRad/winSize.y, cenPos.z , 1);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 position;
|
||||
layout (location = 1) in vec4 color;
|
||||
layout (location = 2) in float rad;
|
||||
out vec4 vColor;
|
||||
out float vRad;
|
||||
|
||||
uniform vec2 winSize;
|
||||
uniform float zoom;
|
||||
uniform vec2 translation;
|
||||
uniform float rotation;
|
||||
uniform mat4 worldMat;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = worldMat * vec4(position,1);
|
||||
vColor = color;
|
||||
vRad = rad;
|
||||
}
|
||||
@@ -4,7 +4,6 @@ in vec4 gColorE;
|
||||
in vec2 gBoundingBox;
|
||||
|
||||
out vec4 fColor;
|
||||
//out float gl_FragDepth;
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -12,4 +11,3 @@ void main()
|
||||
if ( d > 1) { discard; }
|
||||
fColor = mix (gColorE , gColorC, d);
|
||||
}
|
||||
//note it is the fragdepth that stops this from being square
|
||||
|
||||
@@ -6,9 +6,6 @@ out vec4 gColorC;
|
||||
out vec4 gColorE;
|
||||
out vec2 gBoundingBox;
|
||||
|
||||
uniform vec2 winSize;
|
||||
uniform float zoom;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 pa = gl_in[0].gl_Position.xyz;
|
||||
@@ -19,14 +16,12 @@ void main()
|
||||
|
||||
gBoundingBox = vec2 (-1,1);
|
||||
gl_Position = vec4 (pb, 1);
|
||||
//gl_Position = vec4 (0.5,0,0, 1);
|
||||
EmitVertex();
|
||||
gBoundingBox = vec2 (1,1);
|
||||
gl_Position = vec4 (pa, 1);
|
||||
EmitVertex();
|
||||
gBoundingBox = vec2 (-1,-1);
|
||||
gl_Position = vec4 (pc, 1);
|
||||
// gl_Position = vec4 (0.5,0.5,0, 1);
|
||||
EmitVertex();
|
||||
gBoundingBox = vec2 (1,-1);
|
||||
gl_Position = vec4 (pa + pc - pb, 1);
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#version 430 core
|
||||
in vec2 cenPosT;
|
||||
in vec2 gParams;
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos = gl_FragCoord.xy;
|
||||
float dist = min(1 , 2*distance(pos,cenPosT) / (gParams.x));
|
||||
//float c = pow(gParams.y*dist,2);
|
||||
float c = gParams.y * pow(1-dist,2);
|
||||
//float c = gParams.y;
|
||||
fColor = vec4( c,c,c ,c );
|
||||
// fColor = vec4( 1,0,0 , 1);
|
||||
// fColor = vec4( 1,0,0 , pow(dist,2) );
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
in vec2 vParams [];
|
||||
out vec2 gParams;
|
||||
out vec2 cenPosT;
|
||||
|
||||
uniform vec2 winSize;
|
||||
uniform float zoom;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 cenPos = gl_in[0].gl_Position.xyz;
|
||||
//cenPos = vec3 (0.5,0,0);
|
||||
gParams = vec2( vParams[0].x * zoom * 2, vParams[0].y);
|
||||
float gRad = gParams.x;
|
||||
|
||||
cenPosT = vec2 ( (cenPos.x + 1) * 0.5 * winSize.x , (cenPos.y + 1) * 0.5 * winSize.y);
|
||||
|
||||
gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y + gRad/winSize.y, 0.9 , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y + gRad/winSize.y, 0.9 , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y - gRad/winSize.y, 0.9 , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y - gRad/winSize.y, 0.9 , 1);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec4 position;
|
||||
out vec2 vParams;
|
||||
|
||||
uniform vec2 winSize;
|
||||
uniform float zoom;
|
||||
uniform vec2 translation;
|
||||
uniform float rotation;
|
||||
uniform mat4 worldMat;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position.xy,0,1);
|
||||
vParams = position.zw;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 430 core
|
||||
in vec4 gColor;
|
||||
in vec2 cenPosTrans;
|
||||
in float gRad;
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos = gl_FragCoord.xy;
|
||||
float dist = max(0 , 1 - 2 * distance(pos,cenPosTrans) / (gRad));
|
||||
fColor = vec4( gColor.xyz , pow(gColor.z*dist,2) );
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#version 430 core
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
in vec4 vColor [];
|
||||
in float vRad [];
|
||||
uniform vec2 winSize;
|
||||
out vec4 gColor;
|
||||
out float gRad;
|
||||
out vec2 cenPosTrans;
|
||||
void main()
|
||||
{
|
||||
vec3 cenPos = gl_in[0].gl_Position.xyz;
|
||||
vec2 cenPosa = cenPos.xy + vec2 (1,1);
|
||||
cenPosTrans = vec2 (cenPosa * winSize * 0.5);
|
||||
gColor = vColor[0];
|
||||
gRad = vRad[0];
|
||||
|
||||
gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y + gRad/winSize.y, cenPos.z , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y + gRad/winSize.y, cenPos.z , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y - gRad/winSize.y, cenPos.z , 1);
|
||||
EmitVertex();
|
||||
gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y - gRad/winSize.y, cenPos.z , 1);
|
||||
EmitVertex();
|
||||
|
||||
|
||||
EndPrimitive();
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 430 core
|
||||
layout (location = 0) in vec3 position;
|
||||
layout (location = 1) in vec4 color;
|
||||
layout (location = 2) in float rad;
|
||||
out vec4 vColor;
|
||||
out float vRad;
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position,1);
|
||||
vColor = color;
|
||||
vRad = rad;
|
||||
}
|
||||
+1
-1
@@ -546,7 +546,7 @@ deadEndRoom = Room
|
||||
]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = []
|
||||
, _rmPS = []
|
||||
, _rmPS = [PS (0,-10) 0 basicLS]
|
||||
, _rmBound = rectNSWE 20 (-20) (-30) 30
|
||||
}
|
||||
where lnks = [((0,30) ,0)
|
||||
|
||||
@@ -2194,15 +2194,15 @@ flameShield = basicEquipment
|
||||
}
|
||||
frontArmour = basicEquipment
|
||||
{ _itIdentity = FrontArmour
|
||||
, _itName = "FRONTARMOUR"
|
||||
, _itName = "FARMOUR"
|
||||
, _itMaxStack = 1
|
||||
, _itAmount = 1
|
||||
, _itFloorPict = onLayer FlItLayer $ translate 0 (-5)
|
||||
$ pictures [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||
$ pictures [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||
,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
||||
]
|
||||
, _itEquipPict = (\cr _ -> onLayer CrLayer
|
||||
$ pictures [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||
$ pictures [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||
,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
||||
]
|
||||
)
|
||||
|
||||
+55
-50
@@ -1,6 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
--{-# LANGUAGE Strict #-}
|
||||
module Picture.Preload
|
||||
( RenderData (..)
|
||||
, preloadRender
|
||||
, cleanUpRenderPreload
|
||||
)
|
||||
where
|
||||
|
||||
import Picture.Data
|
||||
@@ -25,6 +29,57 @@ data RenderData = RenderData
|
||||
|
||||
makeLenses ''RenderData
|
||||
|
||||
preloadRender :: IO RenderData
|
||||
preloadRender = do
|
||||
-- compile shader programs
|
||||
lsShad <- makeShader "lightmapCircle" [vert,geom,frag] [(0,4)] Points (return . return . flat4)
|
||||
-- fcs <- makeSourcedShader "lightmapCircle" [VertexShader,GeometryShader,FragmentShader]
|
||||
|
||||
bgShad <- makeTextureShader "background" [vert,geom,frag] [(0,4),(1,2)] Points pokeBGStrat
|
||||
"data/texture/smudgedDirt.png"
|
||||
|
||||
wsShad <- makeShaderCustomUnis "wallShadow" [vert,geom,frag] [(0,4),(1,4)] Points pokeWPStrat
|
||||
["lightPos"]
|
||||
|
||||
bslist <- makeShader "basic" [vert,frag] [(0,3),(1,4)] Triangles pokeTriStrat
|
||||
lslist <- makeShader "basic" [vert,frag] [(0,3),(1,4)] Lines pokeLineStrat
|
||||
aslist <- makeShader "arc" [vert,geom,frag] [(0,3),(1,4),(2,4)] Points pokeArcStrat
|
||||
eslist <- makeShader "ellipse" [vert,geom,frag] [(0,3),(1,4)] Triangles pokeEllStrat
|
||||
cslist <- makeTextureShader "character" [vert,geom,frag]
|
||||
[(0,3),(1,4),(2,3)] Points pokeCharStrat
|
||||
"data/texture/charMap.png"
|
||||
|
||||
--the following vbo is set up to contain one fixed vertex
|
||||
dummyvbo <- genObjectName
|
||||
dummyptr <- mallocArray numDrawableElements
|
||||
pokeArray dummyptr [0..2000]
|
||||
bindBuffer ArrayBuffer $= Just dummyvbo
|
||||
bufferData ArrayBuffer $= (fromIntegral floatSize, dummyptr, StaticDraw)
|
||||
|
||||
-- input a list of (attribute location, attrib length) pairs
|
||||
-- these will have buffers and pointers created
|
||||
backgroundvao <- setupVAO [(0,4),(1,2)]
|
||||
|
||||
return $ RenderData
|
||||
{ _listShaders = [bslist,lslist,cslist,aslist,eslist]
|
||||
, _dummyVBO = dummyvbo
|
||||
, _dummyPtr = dummyptr
|
||||
, _lightSourceShader = lsShad
|
||||
, _wallShadowShader = wsShad
|
||||
, _backgroundShader = bgShad
|
||||
}
|
||||
|
||||
|
||||
--------------------end preloadRender
|
||||
cleanUpRenderPreload :: RenderData -> IO ()
|
||||
cleanUpRenderPreload pd = do
|
||||
mapM_ freeShaderPointers $ _listShaders pd
|
||||
freeShaderPointers $ _lightSourceShader pd
|
||||
freeShaderPointers $ _wallShadowShader pd
|
||||
freeShaderPointers $ _backgroundShader pd
|
||||
free $ _dummyPtr pd
|
||||
|
||||
{-# INLINE pokeTriStrat #-}
|
||||
pokeTriStrat (RenderPoly vs) = fmap (\((x,y,z),(r,g,b,a)) -> [[x,y,z],[r,g,b,a]]) vs
|
||||
pokeTriStrat _ = []
|
||||
|
||||
@@ -53,53 +108,3 @@ pokeWPStrat ((x,y),(z,w),(a,b),(c,d)) = [[[x,y,z,w],[a,b,c,d]]]
|
||||
pokeBGStrat :: a -> [[[Float]]]
|
||||
pokeBGStrat = const []
|
||||
|
||||
preloadRender :: IO RenderData
|
||||
preloadRender = do
|
||||
-- compile shader programs
|
||||
lsShad <- makeShader "lightmapCircle" [vert,geom,frag] [(0,4)] Points (return . return . flat4)
|
||||
-- fcs <- makeSourcedShader "lightmapCircle" [VertexShader,GeometryShader,FragmentShader]
|
||||
|
||||
bgShad <- makeTextureShader "background" [vert,geom,frag] [(0,4),(1,2)] Points pokeBGStrat
|
||||
"data/texture/smudgedDirt.png"
|
||||
|
||||
wsShad <- makeShaderCustomUnis "wallShadow" [vert,geom,frag] [(0,4),(1,4)] Points pokeWPStrat
|
||||
["lightPos"]
|
||||
|
||||
bslist <- makeShader "basic" [vert,frag] [(0,3),(1,4)] Triangles pokeTriStrat
|
||||
lslist <- makeShader "basic" [vert,frag] [(0,3),(1,4)] Lines pokeLineStrat
|
||||
aslist <- makeShader "arc" [vert,geom,frag] [(0,3),(1,4),(2,3)] Points pokeArcStrat
|
||||
eslist <- makeShader "ellipse" [vert,geom,frag] [(0,3),(1,4)] Triangles pokeEllStrat
|
||||
cslist <- makeTextureShader "character" [vert,geom,frag]
|
||||
[(0,3),(1,4),(2,3)] Points pokeCharStrat
|
||||
"data/texture/charMap.png"
|
||||
|
||||
--the following vbo is set up to contain one fixed vertex
|
||||
dummyvbo <- genObjectName
|
||||
dummyptr <- mallocArray numDrawableElements
|
||||
pokeArray dummyptr [0..2000]
|
||||
bindBuffer ArrayBuffer $= Just dummyvbo
|
||||
bufferData ArrayBuffer $= (fromIntegral floatSize, dummyptr, StaticDraw)
|
||||
|
||||
-- input a list of (attribute location, attrib length) pairs
|
||||
-- these will have buffers and pointers created
|
||||
backgroundvao <- setupVAO [(0,4),(1,2)]
|
||||
|
||||
return $ RenderData
|
||||
{ _listShaders = [bslist,lslist,cslist,aslist,eslist]
|
||||
, _dummyVBO = dummyvbo
|
||||
, _dummyPtr = dummyptr
|
||||
, _lightSourceShader = lsShad
|
||||
, _wallShadowShader = wsShad
|
||||
, _backgroundShader = bgShad
|
||||
}
|
||||
|
||||
vaoPointers :: VAO -> [Ptr Float]
|
||||
vaoPointers = (\(_,ps,_) -> ps) . unzip3 . _vaoBufferTargets
|
||||
|
||||
cleanUpRenderPreload :: RenderData -> IO ()
|
||||
cleanUpRenderPreload pd = do
|
||||
mapM_ freeShaderPointers $ _listShaders pd
|
||||
freeShaderPointers $ _lightSourceShader pd
|
||||
freeShaderPointers $ _wallShadowShader pd
|
||||
freeShaderPointers $ _backgroundShader pd
|
||||
free $ _dummyPtr pd
|
||||
|
||||
@@ -57,14 +57,6 @@ polyToTris :: [s] -> [s]
|
||||
polyToTris (a:b:c:as) = a : intercalate [a] (zipWith (\x y->[x,y]) (init (b:c:as)) (c:as))
|
||||
polyToTris _ = []
|
||||
|
||||
tripFirst :: (a -> a') -> (a,b,c) -> (a',b,c)
|
||||
{-# INLINE tripFirst #-}
|
||||
tripFirst f (x,y,z) = (f x,y,z)
|
||||
|
||||
tripSecond :: (b -> b') -> (a,b,c) -> (a,b',c)
|
||||
{-# INLINE tripSecond #-}
|
||||
tripSecond f (x,y,z) = (x,f y,z)
|
||||
|
||||
scaleT :: (Float,Float) -> (Point3,Point4,Point3) -> (Point3,Point4,Point3)
|
||||
{-# INLINE scaleT #-}
|
||||
scaleT (x,y) (a,b,(o,s,t)) = (a,b,(o,s*x,t*y))
|
||||
@@ -95,24 +87,6 @@ overSca :: (Point2 -> Point2) -> RenderType -> RenderType
|
||||
overSca f (RenderText vs) = RenderText $ map (scaleT (f (1,1))) vs
|
||||
overSca f p = p
|
||||
|
||||
scaleRen,translateRen :: Float -> Float -> RenderType -> RenderType
|
||||
{-# INLINE scaleRen #-}
|
||||
scaleRen x y (RenderText vs) = overPos (scale3 x y) $ RenderText $ map (scaleT (x,y)) vs
|
||||
scaleRen x y rt = overPos (scale3 x y) rt
|
||||
{-# INLINE translateRen #-}
|
||||
translateRen x y = overPos $ translate3 x y
|
||||
rotateRen,setDepthRen :: Float -> RenderType -> RenderType
|
||||
{-# INLINE rotateRen #-}
|
||||
rotateRen a (RenderArc (p,c,(as,ae,r,w))) = overPos (rotate3 a) $ RenderArc (p,c,(f as,f ae,r,w))
|
||||
--where f b = normalizeAngle $ a + b
|
||||
where f b = a + b
|
||||
rotateRen a pic = overPos (rotate3 a) pic
|
||||
{-# INLINE setDepthRen #-}
|
||||
setDepthRen d = overPos $ \(x,y,_) -> (x,y,-d)
|
||||
{-# INLINE colorRen #-}
|
||||
colorRen :: RGBA -> RenderType -> RenderType
|
||||
colorRen c = overCol $ const c
|
||||
|
||||
stringToList :: String -> [(Point3,Point4,Point3)]
|
||||
{-# INLINE stringToList #-}
|
||||
stringToList s = zipWith (\x (a,b,c) -> (translate3 x 0 a,b,c))
|
||||
|
||||
Reference in New Issue
Block a user