00001 // Filename: fisheyeMaker.I 00002 // Created by: drose (3Oct05) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: FisheyeMaker::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE FisheyeMaker:: 00022 FisheyeMaker(const string &name) : Namable(name) { 00023 reset(); 00024 } 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Function: FisheyeMaker::Destructor 00028 // Access: Public 00029 // Description: 00030 //////////////////////////////////////////////////////////////////// 00031 INLINE FisheyeMaker:: 00032 ~FisheyeMaker() { 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: FisheyeMaker::set_num_vertices 00037 // Access: Public 00038 // Description: Specifies the approximate number of vertices to be 00039 // used to generate the rose. This is the approximate 00040 // number of vertices that will be located within the 00041 // rose's unit circle, not counting the inscribing 00042 // square (if any). The actual number of vertices used 00043 // may be +/- 25% of this value. 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE void FisheyeMaker:: 00046 set_num_vertices(int num_vertices) { 00047 _num_vertices = num_vertices; 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: FisheyeMaker::set_square_inscribed 00052 // Access: Public 00053 // Description: Sets the flag that indicates whether the rose should 00054 // be inscribed within a square. When this is true, an 00055 // additional square is generated to inscribed the 00056 // circular rose, with the indicated "radius" (the sides 00057 // of the square will be 2 * square_radius). The 00058 // texture coordinates of the square will uniformly map 00059 // to the back pole of the cube map. 00060 // 00061 // This is mainly useful to provide a good uniform 00062 // background color for a sphere map so that it does not 00063 // have a sharp circular edge that might produce 00064 // artifacts due to numerical imprecision when mapping. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE void FisheyeMaker:: 00067 set_square_inscribed(bool square_inscribed, PN_stdfloat square_radius) { 00068 _square_inscribed = square_inscribed; 00069 _square_radius = square_radius; 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: FisheyeMaker::set_reflection 00074 // Access: Public 00075 // Description: Sets the flag indicating whether the texture image 00076 // should be mirrored (true) or normal (false). When 00077 // this is true, the 3-D texture coordinates will be 00078 // reversed so that the image is appropriate for a 00079 // reflection. This is the best choice for generating a 00080 // sphere map from a cube map. The default is false. 00081 //////////////////////////////////////////////////////////////////// 00082 INLINE void FisheyeMaker:: 00083 set_reflection(bool reflection) { 00084 _reflect = (reflection) ? -1.0 : 1.0; 00085 }