Commit c82b0d4c authored by Dario Seyb's avatar Dario Seyb

added textured mesh example

parent 67755fd8
......@@ -5,7 +5,7 @@
# Setuptools distribution folder.
/dist/
/.ipynb_checkpoints/
/examples/.ipynb_checkpoints/
# Python egg metadata, regenerated from source files by setuptools.
/*.egg-info
/*.egg
......
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import meshvis\n",
"import openmesh as om\n",
"import numpy as np\n",
"\n",
"m = om.PolyMesh()\n",
"\n",
"m.request_vertex_texcoords2D()\n",
"\n",
"options = om.Options()\n",
"options += om.Options.VertexTexCoord\n",
"\n",
"om.read_mesh(m, 'models/spot_quadrangulated.obj', options)\n",
"\n",
"vertices = m.points()\n",
"faces = m.face_vertex_indices()\n",
"edges = m.ev_indices()\n",
"uvs = m.vertex_texcoords2D()\n",
"\n",
"\n",
"mesh = meshvis.Mesh(vertices, faces, \n",
" normals = meshvis.calculatePointNormals(vertices, faces),\n",
" uvs = meshvis.PointAttribute(uvs))\n",
"\n",
"texture = meshvis.ImageTexture('textures/spot_texture.png')\n",
"\n",
"meshvis.display(mesh, texture=texture)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment