MEPP2 Project
Examples
Generic
TextureImageDemo
texture_image_demo_main.hpp
Go to the documentation of this file.
1
// Copyright (c) 2012-2022 University of Lyon and CNRS (France).
2
// All rights reserved.
3
//
4
// This file is part of MEPP2; you can redistribute it and/or modify
5
// it under the terms of the GNU Lesser General Public License as
6
// published by the Free Software Foundation; either version 3 of
7
// the License, or (at your option) any later version.
8
//
9
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11
#pragma once
12
13
#include "
FEVV/Filters/Generic/generic_reader.hpp
"
14
#include "
FEVV/Filters/Generic/generic_writer.hpp
"
15
#include "
Examples/Generic/TextureImageDemo/texture_image_demo_filter.hpp
"
16
23
template
<
typename
MeshT >
24
int
25
texture_image_demo_main
(
int
argc,
const
char
**argv)
26
{
27
if
(argc != 2)
28
{
29
std::cout <<
"Apply a dummy texture image filter to the input mesh."
30
<< std::endl;
31
std::cout <<
"Usage: "
<< argv[0] <<
" input_mesh_filename"
<< std::endl;
32
std::cout <<
"Example: "
<< argv[0]
33
<<
" ../Testing/Data/textures/face-multitexture/face.obj"
34
<< std::endl;
35
return
EXIT_FAILURE;
36
}
37
38
// input and output files
39
std::string input_file_path = argv[1];
40
std::string output_file_path =
"texture_image_demo.output.obj"
;
41
42
// read mesh from file
43
MeshT
m;
44
FEVV::PMapsContainer
pmaps_bag;
45
FEVV::Filters::read_mesh
(input_file_path, m, pmaps_bag);
46
47
// Note: the property maps must be extracted from the
48
// property maps bag, and explicitely passed as
49
// parameters to the filter, in order to make
50
// clear what property is used by the filter
51
52
// retrieve the materials property map
53
54
if
(!
has_map
(pmaps_bag,
FEVV::mesh_materials
))
55
{
56
std::cout <<
"The mesh has no materials. Aborting."
<< std::endl;
57
return
EXIT_FAILURE;
58
}
59
60
std::cout <<
"retrieve existing mesh_materials property map"
<< std::endl;
61
auto
mtl_pm =
get_property_map
(
FEVV::mesh_materials
, m, pmaps_bag);
62
63
// apply filter
64
texture_image_demo_filter
(m, mtl_pm);
65
66
// write mesh to file
67
FEVV::Filters::write_mesh
(output_file_path, m, pmaps_bag);
68
69
return
0;
70
}
FEVV::get_property_map
PMap_traits< PropertyT, MeshT >::pmap_type get_property_map(PropertyT p, const MeshT &, const PMapsContainer &pmaps)
Definition:
properties.h:646
FEVV::mesh_materials
@ mesh_materials
Definition:
properties.h:89
FEVV::has_map
bool has_map(const PMapsContainer &pmaps, const std::string &map_name)
(refer to Property Maps API)
Definition:
properties.h:103
generic_reader.hpp
FEVV::PMapsContainer
std::map< std::string, boost::any > PMapsContainer
Definition:
properties.h:99
FEVV::Filters::read_mesh
void read_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps, bool=false)
Load mesh from file.
Definition:
cgal_point_set_reader.hpp:110
texture_image_demo_filter.hpp
texture_image_demo_main
int texture_image_demo_main(int argc, const char **argv)
A mesh type templated main(argc, argv) function that.
Definition:
texture_image_demo_main.hpp:25
FEVV::Filters::write_mesh
void write_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps)
Write mesh to file.
Definition:
cgal_point_set_writer.hpp:42
generic_writer.hpp
FEVV::DataStructures::AIF::AIFMesh
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
Definition:
AIFMesh.hpp:47
texture_image_demo_filter
void texture_image_demo_filter(const HalfedgeGraph &, MaterialMap &mtl_pm, const GeometryTraits &)
Definition:
texture_image_demo_filter.hpp:24
Generated by
1.8.20