(ren *RenderComponent, space *SpaceComponent)
| 415 | } |
| 416 | |
| 417 | func (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 | |
| 429 | func (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 |
no test coverage detected