Panda3D
Loading...
Searching...
No Matches
Public Member Functions | List of all members
FisheyeMaker Class Reference

This class is similar to CardMaker, but instead of generating ordinary cards, it generates a circular rose that represents the projection of a 3-D scene through a fisheye lens. More...

#include "fisheyeMaker.h"

Inheritance diagram for FisheyeMaker:
Namable MemoryBase

Public Member Functions

 FisheyeMaker (const std::string &name)
 
 PT (PandaNode) generate()
 
void reset ()
 Resets all the parameters to their initial defaults.
 
void set_fov (PN_stdfloat fov)
 Specifies the field of view of the fisheye projection.
 
void set_num_vertices (int num_vertices)
 Specifies the approximate number of vertices to be used to generate the rose.
 
void set_reflection (bool reflection)
 Sets the flag indicating whether the texture image should be mirrored (true) or normal (false).
 
void set_square_inscribed (bool square_inscribed, PN_stdfloat square_radius)
 Sets the flag that indicates whether the rose should be inscribed within a square.
 
- Public Member Functions inherited from Namable
 Namable (const std::string &initial_name="")
 
void clear_name ()
 Resets the Namable's name to empty.
 
const std::string & get_name () const
 
bool has_name () const
 Returns true if the Namable has a nonempty name set, false if the name is empty.
 
void output (std::ostream &out) const
 Outputs the Namable.
 
void set_name (const std::string &name)
 
- Public Member Functions inherited from MemoryBase
void operator delete (void *, void *)
 
void operator delete (void *ptr)
 
void operator delete[] (void *, void *)
 
void operator delete[] (void *ptr)
 
void * operator new (size_t size)
 
void * operator new (size_t size, void *ptr)
 
void * operator new[] (size_t size)
 
void * operator new[] (size_t size, void *ptr)
 

Additional Inherited Members

- Static Public Member Functions inherited from Namable
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Public Attributes inherited from Namable
 get_name
 
 set_name
 

Detailed Description

This class is similar to CardMaker, but instead of generating ordinary cards, it generates a circular rose that represents the projection of a 3-D scene through a fisheye lens.

The texture coordinates of the rose are defined so that each 2-D vertex has a 3-D UVW that reflects the corresponding position in 3-D space of that particular vertex.

This class is particularly suited for converting cube maps to sphere maps.

Definition at line 34 of file fisheyeMaker.h.

Constructor & Destructor Documentation

◆ FisheyeMaker()

FisheyeMaker::FisheyeMaker ( const std::string & name)
inlineexplicit

Definition at line 17 of file fisheyeMaker.I.

◆ ~FisheyeMaker()

FisheyeMaker::~FisheyeMaker ( )
inline

Definition at line 25 of file fisheyeMaker.I.

Member Function Documentation

◆ reset()

void FisheyeMaker::reset ( )

Resets all the parameters to their initial defaults.

Definition at line 31 of file fisheyeMaker.cxx.

References set_fov(), and set_reflection().

◆ set_fov()

void FisheyeMaker::set_fov ( PN_stdfloat fov)

Specifies the field of view of the fisheye projection.

A sphere map will have a 360-degree field of view (and this is the default).

Definition at line 44 of file fisheyeMaker.cxx.

Referenced by reset().

◆ set_num_vertices()

void FisheyeMaker::set_num_vertices ( int num_vertices)
inline

Specifies the approximate number of vertices to be used to generate the rose.

This is the approximate number of vertices that will be located within the rose's unit circle, not counting the inscribing square (if any). The actual number of vertices used may be +/- 25% of this value.

Definition at line 35 of file fisheyeMaker.I.

◆ set_reflection()

void FisheyeMaker::set_reflection ( bool reflection)
inline

Sets the flag indicating whether the texture image should be mirrored (true) or normal (false).

When this is true, the 3-D texture coordinates will be reversed so that the image is appropriate for a reflection. This is the best choice for generating a sphere map from a cube map. The default is false.

Definition at line 64 of file fisheyeMaker.I.

Referenced by reset().

◆ set_square_inscribed()

void FisheyeMaker::set_square_inscribed ( bool square_inscribed,
PN_stdfloat square_radius )
inline

Sets the flag that indicates whether the rose should be inscribed within a square.

When this is true, an additional square is generated to inscribed the circular rose, with the indicated "radius" (the sides of the square will be 2 * square_radius). The texture coordinates of the square will uniformly map to the back pole of the cube map.

This is mainly useful to provide a good uniform background color for a sphere map so that it does not have a sharp circular edge that might produce artifacts due to numerical imprecision when mapping.

Definition at line 51 of file fisheyeMaker.I.


The documentation for this class was generated from the following files: