00001 // Filename: cardMaker.I 00002 // Created by: drose (16Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: CardMaker::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE CardMaker:: 00026 CardMaker(const string &name) : Namable(name) { 00027 reset(); 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: CardMaker::Destructor 00032 // Access: Public 00033 // Description: 00034 //////////////////////////////////////////////////////////////////// 00035 INLINE CardMaker:: 00036 ~CardMaker() { 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: CardMaker::set_uv_range 00041 // Access: Public 00042 // Description: Sets the range of UV's that will be applied to the 00043 // vertices. If set_has_uvs() is true (as it is by 00044 // default), the vertices will be generated with the 00045 // indicated range of UV's, which will be useful if a 00046 // texture is applied. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE void CardMaker:: 00049 set_uv_range(const TexCoordf &ll, const TexCoordf &ur) { 00050 _ll = ll; 00051 _ur = ur; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: CardMaker::set_has_uvs 00056 // Access: Public 00057 // Description: Sets the flag indicating whether vertices will be 00058 // generated with UV's or not. 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE void CardMaker:: 00061 set_has_uvs(bool flag) { 00062 _has_uvs = flag; 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: CardMaker::set_frame 00067 // Access: Public 00068 // Description: Sets the size of the card. 00069 //////////////////////////////////////////////////////////////////// 00070 INLINE void CardMaker:: 00071 set_frame(float left, float right, float bottom, float top) { 00072 set_frame(LVecBase4f(left, right, bottom, top)); 00073 } 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function: CardMaker::set_frame 00077 // Access: Public 00078 // Description: Sets the size of the card. 00079 //////////////////////////////////////////////////////////////////// 00080 INLINE void CardMaker:: 00081 set_frame(const LVecBase4f &frame) { 00082 _frame = frame; 00083 } 00084 00085 //////////////////////////////////////////////////////////////////// 00086 // Function: CardMaker::set_color 00087 // Access: Public 00088 // Description: Sets the color of the card. 00089 //////////////////////////////////////////////////////////////////// 00090 INLINE void CardMaker:: 00091 set_color(float r, float g, float b, float a) { 00092 set_color(LVecBase4f(r, g, b, a)); 00093 } 00094 00095 //////////////////////////////////////////////////////////////////// 00096 // Function: CardMaker::set_color 00097 // Access: Public 00098 // Description: Sets the color of the card. 00099 //////////////////////////////////////////////////////////////////// 00100 INLINE void CardMaker:: 00101 set_color(const LVecBase4f &color) { 00102 _color = color; 00103 _has_color = true; 00104 } 00105 00106 //////////////////////////////////////////////////////////////////// 00107 // Function: CardMaker::set_source_geometry 00108 // Access: Published 00109 // Description: Sets a node that will be copied (and scaled and 00110 // translated) to generate the frame, instead of 00111 // generating a new polygon. The node may contain 00112 // arbitrary geometry that describes a flat polygon 00113 // contained within the indicated left, right, bottom, 00114 // top frame. 00115 // 00116 // When generate() is called, the geometry in this node 00117 // will be scaled and translated appropriately to give 00118 // it the size and aspect ratio specified by 00119 // set_frame(). 00120 //////////////////////////////////////////////////////////////////// 00121 INLINE void CardMaker:: 00122 set_source_geometry(PandaNode *node, const LVecBase4f &frame) { 00123 _source_geometry = node; 00124 _source_frame = frame; 00125 } 00126 00127 //////////////////////////////////////////////////////////////////// 00128 // Function: CardMaker::clear_source_geometry 00129 // Access: Published 00130 // Description: Removes the node specified by an earlier call to 00131 // set_source_geometry(). 00132 //////////////////////////////////////////////////////////////////// 00133 INLINE void CardMaker:: 00134 clear_source_geometry() { 00135 _source_geometry = (PandaNode *)NULL; 00136 }