// Update draws the entities in the RenderSystem to the OpenGL Surface.
358112
func (rs *RenderSystem) Update(dt float32) {
	if engo.Headless() {
		return
	}

	if rs.sortingNeeded {
		sort.Sort(rs.entities)
		rs.sortingNeeded = false
	}

	if rs.newCamera {
		newCamera(rs.world)
		rs.newCamera = false
	}

	engo.Gl.Clear(engo.Gl.COLOR_BUFFER_BIT)

	preparedCullingShaders := make(map[CullingShader]struct{})
	var cullingShader CullingShader // current culling shader
	var prevShader Shader           // shader of the previous entity
	var currentShader Shader        // currently "active" shader

	// TODO: it's linear for now, but that might very well be a bad idea
	for _, e := range rs.entities {
		if e.RenderComponent.Hidden {
			continue // with other entities
		}

		// Retrieve a shader, may be the default one -- then use it if we aren't already using it
		shader := e.RenderComponent.shader

		if !compareShaders(shader, prevShader) {
			// to increase performance avoid the type assertions when possible
			prevShader = shader
			if cs, ok := shader.(CullingShader); ok {
				cullingShader = cs
				if _, isPrepared := preparedCullingShaders[cullingShader]; !isPrepared {
					cullingShader.PrepareCulling()
					preparedCullingShaders[cullingShader] = struct{}{}
				}
			} else {
				cullingShader = nil
			}
		}

		if cullingShader != nil && !cullingShader.ShouldDraw(e.RenderComponent, e.SpaceComponent) {
			continue
		}

		// Change Shader if we have to
		if !compareShaders(shader, currentShader) {
			if currentShader != nil {
				currentShader.Post()
			}
			shader.Pre()
			currentShader = shader
		}

		// Setting default scale to 1
		if e.RenderComponent.Scale.X == 0 && e.RenderComponent.Scale.Y == 0 {
			e.RenderComponent.Scale = engo.Point{X: 1, Y: 1}
		}

		// Setting default to white
		if e.RenderComponent.Color == nil {
			e.RenderComponent.Color = color.White
		}

		currentShader.Draw(e.RenderComponent, e.SpaceComponent)
	}

	if currentShader != nil {
		currentShader.Post()
	}
}
981746
func (rs *RenderSystem) Add(basic *ecs.BasicEntity, render *RenderComponent, space *SpaceComponent) {
	// Do nothing if entity already exists
	if _, ok := rs.ids[basic.ID()]; ok {
		return
	}

	rs.ids[basic.ID()] = struct{}{}

	render.ensureShader()

	// This is to prevent users from using the wrong one
	if render.shader == HUDShader {
		switch render.Drawable.(type) {
		case Triangle:
			render.shader = LegacyHUDShader
		case Circle:
			render.shader = LegacyHUDShader
		case Rectangle:
			render.shader = LegacyHUDShader
		case ComplexTriangles:
			render.shader = LegacyHUDShader
		case Text:
			render.shader = TextHUDShader
		default:
			render.shader = HUDShader
		}
	}

	// If the scale is zero, set it to one.
	if render.Scale.X == 0 {
		render.Scale.X = 1
	}
	if render.Scale.Y == 0 {
		render.Scale.Y = 1
	}

	rs.entities = append(rs.entities, renderEntity{basic, render, space})
	rs.sortingNeeded = true
}
1235884
func (c *FakeEndpoints) Update(endpoints *corev1.Endpoints) (result *corev1.Endpoints, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(endpointsResource, c.ns, endpoints), &corev1.Endpoints{})

	if obj == nil {
		return nil, err
	}
	return obj.(*corev1.Endpoints), err
}
1201417
func (c *bundles) Update(bundle *v1.Bundle) (result *v1.Bundle, err error) {
	result = &v1.Bundle{}
	err = c.client.Put().
		Namespace(c.ns).
		Resource("bundles").
		Name(bundle.Name).
		Body(bundle).
		Do().
		Into(result)
	return
}
710676
func (c *FakeRuntimeClasses) Update(runtimeClass *v1beta1.RuntimeClass) (result *v1beta1.RuntimeClass, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateAction(runtimeclassesResource, runtimeClass), &v1beta1.RuntimeClass{})
	if obj == nil {
		return nil, err
	}
	return obj.(*v1beta1.RuntimeClass), err
}
1367757
func (s *AgentsService) Update(ctx context.Context, uuid string, agent *Agent) (*Agent, *APIResponse, error) {
	return s.handleAgentRequest(ctx, "PATCH", uuid, agent)
}
874982
func (s *SourcesStore) Update(ctx context.Context, src chronograf.Source) error {
	return s.UpdateF(ctx, src)
}
887358
func (p *Controller) Update(ctx context.Context, t *api.Task) error {
	p.logger.Debug("Update")
	return nil
}
754677
func (a *AudioSystem) Update(dt float32) {
	if len(a.playerCh) >= 25 { //if the channel is full just return so we don't block the update loop
		return
	}
	players := make([]*Player, 0)
	for _, e := range a.entities {
		if e.Player.isPlaying {
			players = append(players, e.Player)
		}
	}
	a.playerCh <- players
}
1187559
func (c *images) Update(imageResource *image.Image) (result *image.Image, err error) {
	result = &image.Image{}
	err = c.client.Put().
		Resource("images").
		Name(imageResource.Name).
		Body(imageResource).
		Do().
		Into(result)
	return
}
347500
func (p *displayPool) update(e *EventDisplays) {
	p.m.Lock()
	defer p.m.Unlock()
	var ids = make(map[int64]bool)
	for _, o := range e.All {
		ids[*o.ID] = true
		var primary bool
		if *o.ID == *e.Primary.ID {
			primary = true
		}
		if d, ok := p.d[*o.ID]; ok {
			d.primary = primary
			*d.o = *o
		} else {
			p.d[*o.ID] = newDisplay(o, primary)
		}
	}
	for id := range p.d {
		if _, ok := ids[id]; !ok {
			delete(p.d, id)
		}
	}
}
148217
func (p *Init) Update(ctx context.Context, r *google_protobuf.Any) error {
	p.mu.Lock()
	defer p.mu.Unlock()

	return p.initState.Update(ctx, r)
}
128358
func (u *Updater) update(ctx Context, options UpdateOptions) (*Update, error) {
	update, err := u.checkForUpdate(ctx, options)
	if err != nil {
		return nil, findErr(err)
	}
	if update == nil || !update.NeedUpdate {
		// No update available
		return nil, nil
	}
	u.log.Infof("Got update with version: %s", update.Version)

	err = ctx.BeforeUpdatePrompt(*update, options)
	if err != nil {
		return update, err
	}

	// Prompt for update
	updatePromptResponse, err := u.promptForUpdateAction(ctx, *update, options)
	if err != nil {
		return update, promptErr(err)
	}
	switch updatePromptResponse.Action {
	case UpdateActionApply:
		ctx.ReportAction(updatePromptResponse, update, options)
	case UpdateActionAuto:
		ctx.ReportAction(updatePromptResponse, update, options)
	case UpdateActionSnooze:
		ctx.ReportAction(updatePromptResponse, update, options)
		return update, CancelErr(fmt.Errorf("Snoozed update"))
	case UpdateActionCancel:
		ctx.ReportAction(updatePromptResponse, update, options)
		return update, CancelErr(fmt.Errorf("Canceled"))
	case UpdateActionError:
		return update, promptErr(fmt.Errorf("Unknown prompt error"))
	case UpdateActionContinue:
		// Continue
	case UpdateActionUIBusy:
		// Return nil so that AfterUpdateCheck won't exit the service
		return nil, guiBusyErr(fmt.Errorf("User active, retrying later"))
	}

	// Linux updates don't have assets so it's ok to prompt for update above before
	// we check for nil asset.
	if update.Asset == nil || update.Asset.URL == "" {
		u.log.Info("No update asset to apply")
		return update, nil
	}

	if err := u.CleanupPreviousUpdates(); err != nil {
		u.log.Infof("Error cleaning up previous downloads: %v", err)
	}

	tmpDir := u.tempDir()
	defer u.Cleanup(tmpDir)
	if err := u.downloadAsset(update.Asset, tmpDir, options); err != nil {
		return update, downloadErr(err)
	}

	u.log.Infof("Verify asset: %s", update.Asset.LocalPath)
	if err := ctx.Verify(*update); err != nil {
		return update, verifyErr(err)
	}

	if err := u.apply(ctx, *update, options, tmpDir); err != nil {
		return update, err
	}

	return update, nil
}
845763
func (s *Storage) Update(rls *rspb.Release) error {
	s.Log("updating release %q", makeKey(rls.Name, rls.Version))
	return s.Driver.Update(makeKey(rls.Name, rls.Version), rls)
}
769179
func (c *FakeStatefulSets) Update(statefulSet *appsv1.StatefulSet) (result *appsv1.StatefulSet, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(statefulsetsResource, c.ns, statefulSet), &appsv1.StatefulSet{})

	if obj == nil {
		return nil, err
	}
	return obj.(*appsv1.StatefulSet), err
}
968141
func (c *FakeApplications) Update(application *v1alpha1.Application) (result *v1alpha1.Application, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(applicationsResource, c.ns, application), &v1alpha1.Application{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.Application), err
}
1112805
func (c *FakeFluxHelmReleases) Update(fluxHelmRelease *v1alpha2.FluxHelmRelease) (result *v1alpha2.FluxHelmRelease, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(fluxhelmreleasesResource, c.ns, fluxHelmRelease), &v1alpha2.FluxHelmRelease{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha2.FluxHelmRelease), err
}