(rc *RenderComponent, sc *SpaceComponent)
| 186 | } |
| 187 | |
| 188 | func (s *basicShader) ShouldDraw(rc *RenderComponent, sc *SpaceComponent) bool { |
| 189 | tsc := SpaceComponent{ |
| 190 | Position: sc.Position, |
| 191 | Width: rc.Drawable.Width() * rc.Scale.X, |
| 192 | Height: rc.Drawable.Height() * rc.Scale.Y, |
| 193 | Rotation: sc.Rotation, |
| 194 | } |
| 195 | |
| 196 | c := tsc.Corners() |
| 197 | c[0].MultiplyMatrixVector(s.cullingMatrix) |
| 198 | c[1].MultiplyMatrixVector(s.cullingMatrix) |
| 199 | c[2].MultiplyMatrixVector(s.cullingMatrix) |
| 200 | c[3].MultiplyMatrixVector(s.cullingMatrix) |
| 201 | |
| 202 | return !((c[0].X < -1 && c[1].X < -1 && c[2].X < -1 && c[3].X < -1) || // All points left of the "viewport" |
| 203 | (c[0].X > 1 && c[1].X > 1 && c[2].X > 1 && c[3].X > 1) || // All points right of the "viewport" |
| 204 | (c[0].Y < -1 && c[1].Y < -1 && c[2].Y < -1 && c[3].Y < -1) || // All points above of the "viewport" |
| 205 | (c[0].Y > 1 && c[1].Y > 1 && c[2].Y > 1 && c[3].Y > 1)) // All points below of the "viewport" |
| 206 | } |
| 207 | |
| 208 | func (s *basicShader) Draw(ren *RenderComponent, space *SpaceComponent) { |
| 209 | // If our texture (or any of its properties) has changed or we've reached the end of our buffer, flush before moving on. |
nothing calls this directly
no test coverage detected