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