Created
February 21, 2015 04:52
-
-
Save daeyun/853139e333b650ff658d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function renderMesh(Mesh, vertexColors, az, el, upvec) | |
if ~exist('vertexColors', 'var'), vertexColors=zeros(size(Mesh.v,1), 1); end | |
if ~exist('az', 'var'), az=-45; end | |
if ~exist('el', 'var'), el=-120; end | |
if ~exist('upvec', 'var'), upvec=[0 1 0]; end | |
y=Mesh.v(:,2); | |
Mesh.v(:,2)=Mesh.v(:,3); | |
Mesh.v(:,3)=y; | |
patch('vertices', Mesh.v, 'faces',Mesh.f, ... | |
'FaceVertexCData', vertexColors, ... | |
'FaceColor', 'interp', 'CDataMapping', 'scaled', 'edgecolor', 'interp'); | |
%, 'EdgeColor','flat'); | |
axis off; | |
axis equal; | |
axis vis3d; | |
view(az, el); | |
camtarget(mean(Mesh.v)); | |
camproj('perspective'); | |
lighting gouraud; | |
cameramenu; | |
shading interp; | |
camlight('headlight') | |
set(gca,'CameraUpVector', upvec); | |
cameratoolbar('Show'); | |
cameratoolbar('SetMode', 'orbit'); | |
cameratoolbar('SetCoordSys', 'z'); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment