@@ -102,26 +102,15 @@ public void Draw(Vector2i clientSize, Camera camera, Color4 color, Shape shape)
102102 int uProjection = _shader . GetUniformLocation ( "u_Projection" ) ;
103103 _shader . SetUniformMat4 ( uProjection , camera . GetViewMatrix ( ) ) ;
104104
105+ int uRadius = _shader . GetUniformLocation ( "u_Radius" ) ;
106+ _shader . SetUniformFloat ( uRadius , shape . CornerRadius ) ;
107+
108+ int uSize = _shader . GetUniformLocation ( "u_Size" ) ;
109+ _shader . SetUniformVec2 ( uSize , new Vector2 ( shape . Width , shape . Height ) ) ;
110+
111+ int uPosition = _shader . GetUniformLocation ( "u_Position" ) ;
112+ _shader . SetUniformVec2 ( uPosition , new Vector2 ( shape . X , shape . Y ) ) ;
105113
106- Type type = shape . GetType ( ) ;
107- if ( type == typeof ( SVGCircle ) )
108- {
109- int uRadius = _shader . GetUniformLocation ( "u_Radius" ) ;
110- int uPosition = _shader . GetUniformLocation ( "u_Position" ) ;
111-
112- _shader . SetUniformFloat ( uRadius , shape . Width / 2 ) ;
113- _shader . SetUniformVec2 ( uPosition , new Vector2 ( shape . X + shape . Width / 2 , shape . Y + shape . Height / 2 ) ) ;
114- }
115- else if ( type == typeof ( SVGRectangle ) )
116- {
117- int uRadius = _shader . GetUniformLocation ( "u_Radius" ) ;
118- int uSize = _shader . GetUniformLocation ( "u_Size" ) ;
119- int uPosition = _shader . GetUniformLocation ( "u_Position" ) ;
120-
121- _shader . SetUniformFloat ( uRadius , ( ( SVGRectangle ) shape ) . CornerRadius ) ;
122- _shader . SetUniformVec2 ( uSize , new Vector2 ( shape . Width , shape . Height ) ) ;
123- _shader . SetUniformVec2 ( uPosition , new Vector2 ( shape . X , shape . Y ) ) ; // Invert y axis
124- }
125114
126115 GL . BindVertexArray ( VertexArrayObjectID ) ;
127116
0 commit comments