Chemical Data Processing Library C++ API - Version 1.3.0
VRMLObject3DWriter.hpp
Go to the documentation of this file.
1 /*
2  * VRMLObject3DWriter.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_VIS_VRMLOBJECT3DWRITER_HPP
30 #define CDPL_VIS_VRMLOBJECT3DWRITER_HPP
31 
32 #include <iosfwd>
33 
34 #include "CDPL/Vis/APIPrefix.hpp"
36 #include "CDPL/Base/DataWriter.hpp"
37 #include "CDPL/Math/Matrix.hpp"
38 #include "CDPL/Math/Vector.hpp"
39 
40 
41 namespace CDPL
42 {
43 
44  namespace Vis
45  {
46 
47  class Object3D;
48  class Material;
49 
55  {
56 
57  public:
62  VRMLObject3DWriter(std::ostream& os);
63 
65 
72 
73  operator const void*() const;
74  bool operator!() const;
75 
76  void close();
77 
78  private:
79  void process(const Object3D& obj);
80  void visitTriangleMesh(const TriangleMesh3D& mesh);
81 
82  std::ostream& output;
83  bool state;
84  bool headerWritten;
85  Math::Matrix4D vtxTransform;
86  const Material* material;
87  };
88  } // namespace Vis
89 } // namespace CDPL
90 
91 #endif // CDPL_VIS_VRMLOBJECT3DWRITER_HPP
Definition of the class CDPL::Base::DataWriter.
Definition of matrix data types.
Definition of the class CDPL::Vis::Shape3DVisitor.
Definition of vector data types.
Definition of the preprocessor macro CDPL_VIS_API.
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
An interface for writing data objects of a given type to an arbitrary data sink.
Definition: DataWriter.hpp:63
Defines material properties of Vis::Object3D instances.
Definition: Material.hpp:56
Object3D.
Definition: Object3D.hpp:52
The base of all Vis::Shape3D visitor implementations [VPTN].
Definition: Shape3DVisitor.hpp:49
Data structure for describing the geometric shape of 3D objects by means of a triangle mesh.
Definition: TriangleMesh3D.hpp:50
Outputs 3D visualization data represented by Vis::Object3D instances in the VRML [VRML97] format.
Definition: VRMLObject3DWriter.hpp:55
bool operator!() const
Tells whether the writer is in a bad state.
VRMLObject3DWriter(std::ostream &os)
Constructs a VRMLObject3DWriter instance that will write Vis::Object3D data to the output stream os.
void close()
Writes format dependent data (if required) to mark the end of output.
Base::DataWriter< Object3D > & write(const Object3D &obj)
Outputs the Vis::Object3D instance obj.
VRMLObject3DWriter(const VRMLObject3DWriter &)=delete
The namespace of the Chemical Data Processing Library.