Skip to content

Commit 172e538

Browse files
chore: update shader
1 parent 6dba92e commit 172e538

4 files changed

Lines changed: 99 additions & 99 deletions

File tree

FreeFrame/Components/Shapes/SVGPath.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class SVGPath : Shape
3131

3232
public List<DrawAttribute> DrawAttributes { get => _drawAttributes; set => _drawAttributes = value; }
3333

34-
public SVGPath(XmlReader reader) //: this()
34+
public SVGPath(XmlReader reader)
3535
{
3636
IsResizeable = false;
3737
IsCornerRadiusChangeable = false;

FreeFrame/Renderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public void Draw(Vector2i clientSize, Color4 color, Matrix4 transformation)
7373
public void Draw(Vector2i clientSize, Color4 color, Shape shape)
7474
{
7575
_shader.Use();
76+
7677
// Applied projection matrix
7778
int uModelToNDC = _shader.GetUniformLocation("u_Model_To_NDC"); // TODO: Don't need to apply projection matrix at each frame I think
7879
Matrix4 matrix = Matrix4.CreateOrthographicOffCenter(0, clientSize.X, clientSize.Y, 0, -1.0f, 1.0f);
@@ -104,7 +105,6 @@ public void Draw(Vector2i clientSize, Color4 color, Shape shape)
104105
GL.Enable(EnableCap.Blend);
105106
GL.DrawElements(_primitiveType, _indexCount, DrawElementsType.UnsignedInt, 0);
106107
GL.Disable(EnableCap.Blend);
107-
108108
}
109109
public void ImplementObjects(float[] vertices, uint[] indexes)
110110
{

FreeFrame/Shaders/shader.vert

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ void main()
1414
{
1515
vec4 finalPosition = vec4(position,1.0, 1.0);
1616

17-
finalPosition -= vec4(u_Position.x + u_Size.x/2.0, u_Position.y + u_Size.y/2.0, 0.0, 0.0);
17+
vec4 origin = vec4(u_Position.x + u_Size.x/2.0, u_Position.y + u_Size.y/2.0, 0.0, 0.0);
18+
19+
finalPosition -= origin;
1820

1921
finalPosition = finalPosition * u_Transformation;
2022

21-
finalPosition += vec4(u_Position.x + u_Size.x/2.0, u_Position.y + u_Size.y/2.0, 0.0, 0.0);
23+
finalPosition += origin;
2224

2325
finalPosition = u_Model_To_NDC * finalPosition;
2426

25-
gl_Position = finalPosition; // * u_View * u_Projection);
27+
gl_Position = finalPosition;
2628
}

0 commit comments

Comments
 (0)