Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

randomized colors for entities based on id hash #44

Merged

Conversation

mattuntergassmair
Copy link
Collaborator

The current add_renderable! function for the Entity type uses a randomized color, which differs in every function call and leads to inconsistent colors between time frames. This PR bases the color randomization on the hash of the entity id and is therefore consistent for vehicles with the same id.

@coveralls
Copy link

Coverage Status

Coverage increased (+12.4%) to 55.347% when pulling 36d4056 on mattuntergassmair:v0.8_random_color_hash into 6125e87 on sisl:v0.8.

@MaximeBouton
Copy link
Member

Fancy! what kind of colors does that give us?

@mattuntergassmair
Copy link
Collaborator Author

mattuntergassmair commented Mar 3, 2020

Fancy! what kind of colors does that give us?

I guess we can be arbitrarily specific about the colors we want, right now I've done the following: For every color channel (R, G, B), the value is determined as .3 + .7x where x are some bits from the id-hash and .3 is a minimum value, so the "darkest" possible color is RGB(.3,.3,.3).

@MaximeBouton
Copy link
Member

Is it good to merge?

@mattuntergassmair mattuntergassmair merged commit 716a1c8 into sisl:v0.8 Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants