Skip to content
Snippets Groups Projects
Commit 58c42b9d authored by Philip Trettner's avatar Philip Trettner
Browse files

made types explicit

parent 2925f2a5
No related branches found
No related tags found
No related merge requests found
...@@ -30,21 +30,21 @@ int main() ...@@ -30,21 +30,21 @@ int main()
// Load a polymesh mesh // Load a polymesh mesh
pm::Mesh m; pm::Mesh m;
auto pos = m.vertices().make_attribute<glm::vec3>(); auto pos = m.vertices().make_attribute<tg::pos3>();
load(dataPath + "suzanne.obj", m, pos); load(dataPath + "suzanne.obj", m, pos);
normalize(pos); // make it -1..1 normalize(pos); // make it -1..1
// prepare some data // prepare some data
auto uv = pos.map([](glm::vec3 v) { return glm::vec2(v.x, v.y); }); pm::vertex_attribute<glm::vec2> uv = pos.map([](tg::pos3 v) { return glm::vec2(v.x, v.y); });
auto vdata = pos.map([](glm::vec3 v) { return v.y; }); pm::vertex_attribute<float> vdata = pos.map([](tg::pos3 v) { return v.y; });
auto vnormals = vertex_normals_by_area(m, pos); pm::vertex_attribute<tg::vec3> vnormals = vertex_normals_by_area(m, pos);
auto fdata = m.faces().map([&](pm::face_handle f) { return f.vertices().avg(pos).z; }); pm::face_attribute<float> fdata = m.faces().map([&](pm::face_handle f) { return f.vertices().avg(pos).z; });
auto tex = glow::Texture2D::createFromFile(dataPath + "textures/tiles.color.png", glow::ColorSpace::sRGB); glow::SharedTexture2D tex = glow::Texture2D::createFromFile(dataPath + "textures/tiles.color.png", glow::ColorSpace::sRGB);
auto atex = glow::AsyncTextureLoader::load2D(dataPath + "textures/tiles.color.png", glow::ColorSpace::sRGB); glow::AsyncTexture2D atex = glow::AsyncTextureLoader::load2D(dataPath + "textures/tiles.color.png", glow::ColorSpace::sRGB);
auto fcolors = m.faces().map([&](pm::face_handle) { return glow::colors::color(dis(rng), dis(rng), dis(rng)); }); pm::face_attribute<glow::colors::color> fcolors = m.faces().map([&](pm::face_handle) { return glow::colors::color(dis(rng), dis(rng), dis(rng)); });
auto vcolors = attribute(m.vertices(), glow::colors::color(1, 0, 0)); pm::vertex_attribute<glow::colors::color> vcolors = attribute(m.vertices(), glow::colors::color(1, 0, 0));
auto edge_lengths = m.edges().map([&](pm::edge_handle e) { return edge_length(e, pos); }); pm::edge_attribute<float> edge_lengths = m.edges().map([&](pm::edge_handle e) { return edge_length(e, pos); });
auto ptsize = m.vertices().map([&](pm::vertex_handle v) { return v.edges().avg(edge_lengths); }); pm::vertex_attribute<float> ptsize = m.vertices().map([&](pm::vertex_handle v) { return v.edges().avg(edge_lengths); });
// Simplest view // Simplest view
glow::viewer::view(pos); glow::viewer::view(pos);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment