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

Support vertexColors for meshes via GeometryBasics.meta #183

Merged
merged 2 commits into from
Nov 26, 2020

Conversation

rdeits
Copy link
Owner

@rdeits rdeits commented Sep 23, 2020

Example:

# Create a simple mesh with a single triangle
geometry = GeometryBasics.Mesh(
    [Point(0., 0, 0), Point(1., 0, 0), Point(1., 1, 0)],
    [NgonFace(1, 2, 3)])
# Wrap that mesh with metadata encoding the vertex colors
mesh_meta = meta(geometry, vertexColors=[RGB(1, 0, 0), RGB(0, 1, 0), RGB(0, 0, 1)])
# Create a Gouraud-shaded material with vertex coloring enabled
material = MeshLambertMaterial(vertexColors=true)
# Add it to the scene
setobject!(v[:vertex_color_mesh], mesh_meta, material)
settransform!(v[:vertex_color_mesh], Translation(1, -1.5, 0))

Result:

Screenshot from 2020-09-22 23-33-06

@codecov-commenter
Copy link

Codecov Report

Merging #183 into master will increase coverage by 0.21%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #183      +/-   ##
==========================================
+ Coverage   78.41%   78.62%   +0.21%     
==========================================
  Files          18       18              
  Lines         505      510       +5     
==========================================
+ Hits          396      401       +5     
  Misses        109      109              
Impacted Files Coverage Δ
src/MeshCat.jl 80.00% <ø> (ø)
src/lowering.jl 96.05% <100.00%> (+0.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59e4d2c...36a1c47. Read the comment docs.

@rdeits rdeits merged commit 1203fb7 into master Nov 26, 2020
@rdeits rdeits deleted the mesh-vertex-colors branch November 26, 2020 06:59
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.

2 participants