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

Method makeModelMatrix

common/render_shaders_blendmap.go:417–427  ·  view source on GitHub ↗
(ren *RenderComponent, space *SpaceComponent)

Source from the content-addressed store, hash-verified

415}
416
417func (s *blendmapShader) makeModelMatrix(ren *RenderComponent, space *SpaceComponent) *engo.Matrix {
418 // Instead of creating a new model matrix every time, we instead store a global one as a struct member
419 // and just reset it for every sprite. This prevents us from allocating a bunch of new Matrix instances in memory
420 // ultimately saving on GC activity.
421 s.modelMatrix.Identity().Scale(engo.GetGlobalScale().X, engo.GetGlobalScale().Y).Translate(space.Position.X, space.Position.Y)
422 if space.Rotation != 0 {
423 s.modelMatrix.Rotate(space.Rotation)
424 }
425 s.modelMatrix.Scale(ren.Scale.X, ren.Scale.Y)
426 return s.modelMatrix
427}
428
429func (s *blendmapShader) generateBufferContent(ren *RenderComponent, space *SpaceComponent, buffer []float32) bool {
430 // We shouldn't use SpaceComponent to get width/height, because this usually already contains the Scale (which

Callers 1

generateBufferContentMethod · 0.95

Calls 5

GetGlobalScaleFunction · 0.92
TranslateMethod · 0.80
ScaleMethod · 0.80
IdentityMethod · 0.80
RotateMethod · 0.80

Tested by

no test coverage detected