MCPcopy Create free account
hub / github.com/EngoEngine/engo / ShouldDraw

Method ShouldDraw

common/render_shaders_blendmap.go:243–261  ·  view source on GitHub ↗
(rc *RenderComponent, sc *SpaceComponent)

Source from the content-addressed store, hash-verified

241}
242
243func (s *blendmapShader) ShouldDraw(rc *RenderComponent, sc *SpaceComponent) bool {
244 tsc := SpaceComponent{
245 Position: sc.Position,
246 Width: rc.Drawable.Width() * rc.Scale.X,
247 Height: rc.Drawable.Height() * rc.Scale.Y,
248 Rotation: sc.Rotation,
249 }
250
251 c := tsc.Corners()
252 c[0].MultiplyMatrixVector(s.cullingMatrix)
253 c[1].MultiplyMatrixVector(s.cullingMatrix)
254 c[2].MultiplyMatrixVector(s.cullingMatrix)
255 c[3].MultiplyMatrixVector(s.cullingMatrix)
256
257 return !((c[0].X < -1 && c[1].X < -1 && c[2].X < -1 && c[3].X < -1) || // All points left of the "viewport"
258 (c[0].X > 1 && c[1].X > 1 && c[2].X > 1 && c[3].X > 1) || // All points right of the "viewport"
259 (c[0].Y < -1 && c[1].Y < -1 && c[2].Y < -1 && c[3].Y < -1) || // All points above of the "viewport"
260 (c[0].Y > 1 && c[1].Y > 1 && c[2].Y > 1 && c[3].Y > 1)) // All points below of the "viewport"
261}
262
263func (s *blendmapShader) bindTexturePack(tp *TexturePack) {
264 engo.Gl.ActiveTexture(engo.Gl.TEXTURE1)

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