Panda3D
fisheyeMaker.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file fisheyeMaker.h
10  * @author drose
11  * @date 2005-10-03
12  */
13 
14 #ifndef FISHEYEMAKER_H
15 #define FISHEYEMAKER_H
16 
17 #include "pandabase.h"
18 
19 #include "pandaNode.h"
20 #include "pointerTo.h"
21 #include "namable.h"
22 
23 class GeomVertexWriter;
24 
25 /**
26  * This class is similar to CardMaker, but instead of generating ordinary
27  * cards, it generates a circular rose that represents the projection of a 3-D
28  * scene through a fisheye lens. The texture coordinates of the rose are
29  * defined so that each 2-D vertex has a 3-D UVW that reflects the
30  * corresponding position in 3-D space of that particular vertex.
31  *
32  * This class is particularly suited for converting cube maps to sphere maps.
33  */
34 class EXPCL_PANDA_GRUTIL FisheyeMaker : public Namable {
35 PUBLISHED:
36  INLINE explicit FisheyeMaker(const std::string &name);
37  INLINE ~FisheyeMaker();
38 
39  void reset();
40  void set_fov(PN_stdfloat fov);
41  INLINE void set_num_vertices(int num_vertices);
42  INLINE void set_square_inscribed(bool square_inscribed, PN_stdfloat square_radius);
43  INLINE void set_reflection(bool reflection);
44 
45  PT(PandaNode) generate();
46 
47 private:
48  void add_vertex(GeomVertexWriter &vertex, GeomVertexWriter &texcoord,
49  PN_stdfloat r, PN_stdfloat a);
50 
51  void add_square_vertex(GeomVertexWriter &vertex, GeomVertexWriter &texcoord,
52  PN_stdfloat a);
53 
54  PN_stdfloat _fov;
55  PN_stdfloat _half_fov_rad;
56  int _num_vertices;
57  bool _square_inscribed;
58  PN_stdfloat _square_radius;
59  PN_stdfloat _reflect;
60 };
61 
62 #include "fisheyeMaker.I"
63 
64 #endif
pandaNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
GeomVertexWriter
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
Definition: geomVertexWriter.h:55
namable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
FisheyeMaker
This class is similar to CardMaker, but instead of generating ordinary cards, it generates a circular...
Definition: fisheyeMaker.h:34
Namable
A base class for all things which can have a name.
Definition: namable.h:26
fisheyeMaker.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PandaNode
A basic node of the scene graph or data graph.
Definition: pandaNode.h:65
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.