trimesh_color.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 * VCGLib                                                            o o     *
00003 * Visual and Computer Graphics Library                            o     o   *
00004 *                                                                _   O  _   *
00005 * Copyright(C) 2004-2012                                           \/)\/    *
00006 * Visual Computing Lab                                            /\/|      *
00007 * ISTI - Italian National Research Council                           |      *
00008 *                                                                    \      *
00009 * All rights reserved.                                                      *
00010 *                                                                           *
00011 * This program is free software; you can redistribute it and/or modify      *
00012 * it under the terms of the GNU General Public License as published by      *
00013 * the Free Software Foundation; either version 2 of the License, or         *
00014 * (at your option) any later version.                                       *
00015 *                                                                           *
00016 * This program is distributed in the hope that it will be useful,           *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020 * for more details.                                                         *
00021 *                                                                           *
00022 ****************************************************************************/
00029 #include<vcg/complex/complex.h>
00030 
00031 #include <vcg/complex/algorithms/update/bounding.h>
00032 #include <vcg/complex/algorithms/update/color.h>
00033 #include <vcg/complex/algorithms/update/normal.h>
00034 #include <vcg/complex/algorithms/update/flag.h>
00035 #include <vcg/complex/algorithms/clustering.h>
00036 
00037 // input output
00038 #include <wrap/io_trimesh/import.h>
00039 #include <wrap/io_trimesh/export.h>
00040 
00041 class MyFace;
00042 class MyVertex;
00043 
00044 struct MyUsedTypes : public vcg::UsedTypes<     vcg::Use<MyVertex>::AsVertexType,    vcg::Use<MyFace>::AsFaceType>{};
00045 
00046 class MyVertex  : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::Color4b, vcg::vertex::BitFlags  >{};
00047 class MyFace    : public vcg::Face < MyUsedTypes, vcg::face::VertexRef, vcg::face::Normal3f, vcg::face::Color4b, vcg::face::BitFlags > {};
00048 class MyMesh    : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};
00049 
00050 
00051 int  main()
00052 {
00053  MyMesh m;
00054 
00055  vcg::tri::io::ImporterPLY<MyMesh>::Open(m,"../../meshes/torus_irregular.ply");
00056 
00057  vcg::tri::UpdateColor<MyMesh>::PerVertexConstant(m, vcg::Color4b::LightGray);
00058  vcg::tri::UpdateColor<MyMesh>::PerFaceConstant(m, vcg::Color4b::LightGray);
00059 
00060  vcg::tri::UpdateColor<MyMesh>::PerVertexPerlinNoise(m,vcg::Point3f(0.5,0.75,1.0));
00061  vcg::tri::UpdateColor<MyMesh>::PerFaceFromVertex(m);
00062 
00063 
00064  vcg::tri::io::ExporterPLY<MyMesh>::Save(m,"out.ply",vcg::tri::io::Mask::IOM_FACECOLOR+vcg::tri::io::Mask::IOM_VERTCOLOR);
00065   return 0;
00066 }


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:38:15