MCPcopy
hub / github.com/EngoEngine/engo / ShouldDraw

Method ShouldDraw

common/render_shaders_default.go:188–206  ·  view source on GitHub ↗
(rc *RenderComponent, sc *SpaceComponent)

Source from the content-addressed store, hash-verified

186}
187
188func (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
208func (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.

Callers

nothing calls this directly

Calls 4

CornersMethod · 0.95
MultiplyMatrixVectorMethod · 0.80
WidthMethod · 0.65
HeightMethod · 0.65

Tested by

no test coverage detected