00001 // Filename: eggData.I 00002 // Created by: drose (11Feb99) 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: EggData::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE EggData:: 00026 EggData() { 00027 _auto_resolve_externals = false; 00028 _coordsys = CS_default; 00029 } 00030 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: EggData::Copy constructor 00034 // Access: Public 00035 // Description: 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE EggData:: 00038 EggData(const EggData ©) : 00039 EggGroupNode(copy), 00040 _auto_resolve_externals(copy._auto_resolve_externals), 00041 _coordsys(copy._coordsys), 00042 _egg_filename(copy._egg_filename) { 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: EggData::Copy assignment operator 00047 // Access: Public 00048 // Description: 00049 //////////////////////////////////////////////////////////////////// 00050 INLINE EggData &EggData:: 00051 operator = (const EggData ©) { 00052 EggGroupNode::operator = (copy); 00053 _auto_resolve_externals = copy._auto_resolve_externals; 00054 _coordsys = copy._coordsys; 00055 _egg_filename = copy._egg_filename; 00056 return *this; 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: EggData::set_auto_resolve_externals 00061 // Access: Public 00062 // Description: Indicates whether the EggData object will 00063 // automatically resolve any external references when 00064 // read() is called. The default is false. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE void EggData:: 00067 set_auto_resolve_externals(bool resolve) { 00068 _auto_resolve_externals = resolve; 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: EggData::get_auto_resolve_externals 00073 // Access: Public 00074 // Description: Indicates whether the EggData object will 00075 // automatically resolve any external references when 00076 // read() is called. The default is false. 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE bool EggData:: 00079 get_auto_resolve_externals() const { 00080 return _auto_resolve_externals; 00081 } 00082 00083 //////////////////////////////////////////////////////////////////// 00084 // Function: EggData::get_coordinate_system 00085 // Access: Public 00086 // Description: Returns the coordinate system in which the egg file 00087 // is defined. 00088 //////////////////////////////////////////////////////////////////// 00089 INLINE CoordinateSystem EggData:: 00090 get_coordinate_system() const { 00091 return _coordsys; 00092 } 00093 00094 00095 //////////////////////////////////////////////////////////////////// 00096 // Function: EggData::set_egg_filename 00097 // Access: Public 00098 // Description: Sets the filename--especially the directory part--in 00099 // which the egg file is considered to reside. This is 00100 // also implicitly set by read(). 00101 //////////////////////////////////////////////////////////////////// 00102 INLINE void EggData:: 00103 set_egg_filename(const Filename &egg_filename) { 00104 _egg_filename = egg_filename; 00105 } 00106 00107 //////////////////////////////////////////////////////////////////// 00108 // Function: EggData::get_egg_filename 00109 // Access: Public 00110 // Description: Returns the directory in which the egg file is 00111 // considered to reside. 00112 //////////////////////////////////////////////////////////////////// 00113 INLINE const Filename &EggData:: 00114 get_egg_filename() const { 00115 return _egg_filename; 00116 } 00117 00118 //////////////////////////////////////////////////////////////////// 00119 // Function: EggData::recompute_vertex_normals 00120 // Access: Public 00121 // Description: Recomputes all the vertex normals for polygon 00122 // geometry at this group node and below so that they 00123 // accurately reflect the vertex positions. A shared 00124 // edge between two polygons (even in different groups) 00125 // is considered smooth if the angle between the two 00126 // edges is less than threshold degrees. 00127 // 00128 // This function also removes degenerate polygons that 00129 // do not have enough vertices to define a normal. It 00130 // does not affect normals for other kinds of primitives 00131 // like Nurbs or Points. 00132 // 00133 // This function does not remove or adjust vertices in 00134 // the vertex pool; it only adds new vertices with the 00135 // correct normals. Thus, it is a good idea to call 00136 // remove_unused_vertices() after calling this. 00137 //////////////////////////////////////////////////////////////////// 00138 INLINE void EggData:: 00139 recompute_vertex_normals(double threshold) { 00140 EggGroupNode::recompute_vertex_normals(threshold, _coordsys); 00141 } 00142 00143 //////////////////////////////////////////////////////////////////// 00144 // Function: EggData::recompute_polygon_normals 00145 // Access: Public 00146 // Description: Recomputes all the polygon normals for polygon 00147 // geometry at this group node and below so that they 00148 // accurately reflect the vertex positions. Normals are 00149 // removed from the vertices and defined only on 00150 // polygons, giving the geometry a faceted appearance. 00151 // 00152 // This function also removes degenerate polygons that 00153 // do not have enough vertices to define a normal. It 00154 // does not affect normals for other kinds of primitives 00155 // like Nurbs or Points. 00156 // 00157 // This function does not remove or adjust vertices in 00158 // the vertex pool; it only adds new vertices with the 00159 // normals removed. Thus, it is a good idea to call 00160 // remove_unused_vertices() after calling this. 00161 //////////////////////////////////////////////////////////////////// 00162 INLINE void EggData:: 00163 recompute_polygon_normals() { 00164 EggGroupNode::recompute_polygon_normals(_coordsys); 00165 } 00166 00167 //////////////////////////////////////////////////////////////////// 00168 // Function: EggData::strip_normals 00169 // Access: Public 00170 // Description: Removes all normals from primitives, and the vertices 00171 // they reference, at this node and below. 00172 // 00173 // This function does not remove or adjust vertices in 00174 // the vertex pool; it only adds new vertices with the 00175 // normal removed. Thus, it is a good idea to call 00176 // remove_unused_vertices() after calling this. 00177 //////////////////////////////////////////////////////////////////// 00178 INLINE void EggData:: 00179 strip_normals() { 00180 EggGroupNode::strip_normals(); 00181 }