Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/builder/builderVertex.I

Go to the documentation of this file.
00001 // Filename: builderVertex.I
00002 // Created by:  drose (18Sep97)
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 #include <notify.h>
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: BuilderVertex::set_coord_value
00023 //       Access: Public
00024 //  Description: Reassigns the vertex coordinate, without knowing
00025 //               whether the vertex is indexed or nonindexed.  A
00026 //               nonindexed vertex will look up the index in the array
00027 //               and store the resulting value, while an indexed
00028 //               vertex will just store the index number (which
00029 //               assumes the array is the same one it's indexing on).
00030 ////////////////////////////////////////////////////////////////////
00031 INLINE void BuilderVertex::
00032 set_coord_value(const BuilderV *array, ushort index) {
00033   set_coord(array[index]);
00034 }
00035 
00036 
00037 ////////////////////////////////////////////////////////////////////
00038 //     Function: BuilderVertex::set_normal_value
00039 //       Access: Public
00040 //  Description: Reassigns the vertex normal, without knowing whether
00041 //               the vertex is indexed or nonindexed.  A nonindexed
00042 //               vertex will look up the index in the array and store
00043 //               the resulting value, while an indexed vertex will
00044 //               just store the index number (which assumes the array
00045 //               is the same one it's indexing on).
00046 ////////////////////////////////////////////////////////////////////
00047 INLINE void BuilderVertex::
00048 set_normal_value(const BuilderN *array, ushort index) {
00049   set_normal(array[index]);
00050 }
00051 
00052 ////////////////////////////////////////////////////////////////////
00053 //     Function: BuilderVertex::set_texcoord_value
00054 //       Access: Public
00055 //  Description: Reassigns the vertex texture coordinate, without
00056 //               knowing whether the vertex is indexed or nonindexed.
00057 //               A nonindexed vertex will look up the index in the
00058 //               array and store the resulting value, while an indexed
00059 //               vertex will just store the index number (which
00060 //               assumes the array is the same one it's indexing on).
00061 ////////////////////////////////////////////////////////////////////
00062 INLINE void BuilderVertex::
00063 set_texcoord_value(const BuilderTC *array, ushort index) {
00064   set_texcoord(array[index]);
00065 }
00066 
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //     Function: BuilderVertex::set_color_value
00070 //       Access: Public
00071 //  Description: Reassigns the vertex color, without knowing whether
00072 //               the vertex is indexed or nonindexed.  A nonindexed
00073 //               vertex will look up the index in the array and store
00074 //               the resulting value, while an indexed vertex will
00075 //               just store the index number (which assumes the array
00076 //               is the same one it's indexing on).
00077 ////////////////////////////////////////////////////////////////////
00078 INLINE void BuilderVertex::
00079 set_color_value(const BuilderC *array, ushort index) {
00080   set_color(array[index]);
00081 }
00082 
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //     Function: BuilderVertex::get_coord_value
00086 //       Access: Public
00087 //  Description: Returns the actual coordinate value of the vertex,
00088 //               whether it is indexed or nonindexed.  Normally, the
00089 //               value returned by get_coord(), which will be either a
00090 //               BuilderV or a ushort, is sufficient, but there are
00091 //               occasional times when it is necessary to get the
00092 //               actual location in space of the vertex position (for
00093 //               instance, to subdivide a concave polygon).
00094 //
00095 //               This function returns the actual coordinate value.
00096 //               For a nonindexed vertex, its return value is the same
00097 //               as get_coord(); for an indexed vertex, it looks up
00098 //               the vertex's index in the bucket's coord array, and
00099 //               returns that value.
00100 //
00101 //               Note that this makes some perhaps unwarranted
00102 //               assumptions about indexed geometry; specifically,
00103 //               that its value is valid at creation time, and that it
00104 //               won't change too drastically during runtime.
00105 ////////////////////////////////////////////////////////////////////
00106 INLINE BuilderV BuilderVertex::
00107 get_coord_value(const BuilderBucket &) const {
00108   return get_coord();
00109 }
00110 
00111 
00112 ////////////////////////////////////////////////////////////////////
00113 //     Function: BuilderVertex::get_normal_value
00114 //       Access: Public
00115 //  Description: Returns the actual normal value of the vertex,
00116 //               whether it is indexed or nonindexed.  See
00117 //               get_coord_value().
00118 ////////////////////////////////////////////////////////////////////
00119 INLINE BuilderN BuilderVertex::
00120 get_normal_value(const BuilderBucket &) const {
00121   return get_normal();
00122 }
00123 
00124 
00125 ////////////////////////////////////////////////////////////////////
00126 //     Function: BuilderVertex::get_texcoord_value
00127 //       Access: Public
00128 //  Description: Returns the actual texture coordinate value of the
00129 //               vertex, whether it is indexed or nonindexed.  See
00130 //               get_coord_value().
00131 ////////////////////////////////////////////////////////////////////
00132 INLINE BuilderTC BuilderVertex::
00133 get_texcoord_value(const BuilderBucket &) const {
00134   return get_texcoord();
00135 }
00136 
00137 
00138 ////////////////////////////////////////////////////////////////////
00139 //     Function: BuilderVertex::get_color_value
00140 //       Access: Public
00141 //  Description: Returns the actual color value of the vertex,
00142 //               whether it is indexed or nonindexed.  See
00143 //               get_coord_value().
00144 ////////////////////////////////////////////////////////////////////
00145 INLINE BuilderC BuilderVertex::
00146 get_color_value(const BuilderBucket &) const {
00147   return get_color();
00148 }
00149 
00150 
00151 ////////////////////////////////////////////////////////////////////
00152 //     Function: BuilderVertex::set_coord_value
00153 //       Access: Public
00154 //  Description: Reassigns the vertex coordinate, without knowing
00155 //               whether the vertex is indexed or nonindexed.  A
00156 //               nonindexed vertex will look up the index in the array
00157 //               and store the resulting value, while an indexed
00158 //               vertex will just store the index number (which
00159 //               assumes the array is the same one it's indexing on).
00160 ////////////////////////////////////////////////////////////////////
00161 INLINE void BuilderVertexI::
00162 set_coord_value(const BuilderV *, ushort index) {
00163   set_coord(index);
00164 }
00165 
00166 
00167 ////////////////////////////////////////////////////////////////////
00168 //     Function: BuilderVertex::set_normal_value
00169 //       Access: Public
00170 //  Description: Reassigns the vertex normal, without knowing whether
00171 //               the vertex is indexed or nonindexed.  A nonindexed
00172 //               vertex will look up the index in the array and store
00173 //               the resulting value, while an indexed vertex will
00174 //               just store the index number (which assumes the array
00175 //               is the same one it's indexing on).
00176 ////////////////////////////////////////////////////////////////////
00177 INLINE void BuilderVertexI::
00178 set_normal_value(const BuilderN *, ushort index) {
00179   set_normal(index);
00180 }
00181 
00182 
00183 ////////////////////////////////////////////////////////////////////
00184 //     Function: BuilderVertex::set_texcoord_value
00185 //       Access: Public
00186 //  Description: Reassigns the vertex texture coordinate, without
00187 //               knowing whether the vertex is indexed or nonindexed.
00188 //               A nonindexed vertex will look up the index in the
00189 //               array and store the resulting value, while an indexed
00190 //               vertex will just store the index number (which
00191 //               assumes the array is the same one it's indexing on).
00192 ////////////////////////////////////////////////////////////////////
00193 INLINE void BuilderVertexI::
00194 set_texcoord_value(const BuilderTC *, ushort index) {
00195   set_texcoord(index);
00196 }
00197 
00198 ////////////////////////////////////////////////////////////////////
00199 //     Function: BuilderVertex::set_color_value
00200 //       Access: Public
00201 //  Description: Reassigns the vertex color, without knowing whether
00202 //               the vertex is indexed or nonindexed.  A nonindexed
00203 //               vertex will look up the index in the array and store
00204 //               the resulting value, while an indexed vertex will
00205 //               just store the index number (which assumes the array
00206 //               is the same one it's indexing on).
00207 ////////////////////////////////////////////////////////////////////
00208 INLINE void BuilderVertexI::
00209 set_color_value(const BuilderC *, ushort index) {
00210   set_color(index);
00211 }
00212 
00213 ////////////////////////////////////////////////////////////////////
00214 //     Function: BuilderVertex::get_coord_value
00215 //       Access: Public
00216 //  Description: Returns the actual coordinate value of the vertex,
00217 //               whether it is indexed or nonindexed.  Normally, the
00218 //               value returned by get_coord(), which will be either a
00219 //               BuilderV or a ushort, is sufficient, but there are
00220 //               occasional times when it is necessary to get the
00221 //               actual location in space of the vertex position (for
00222 //               instance, to subdivide a concave polygon).
00223 //
00224 //               This function returns the actual coordinate value.
00225 //               For a nonindexed vertex, its return value is the same
00226 //               as get_coord(); for an indexed vertex, it looks up
00227 //               the vertex's index in the bucket's coord array, and
00228 //               returns that value.
00229 //
00230 //               Note that this makes some perhaps unwarranted
00231 //               assumptions about indexed geometry; specifically,
00232 //               that its value is valid at creation time, and that it
00233 //               won't change too drastically during runtime.
00234 ////////////////////////////////////////////////////////////////////
00235 INLINE BuilderV BuilderVertexI::
00236 get_coord_value(const BuilderBucket &bucket) const {
00237   nassertr(bucket.get_coords() != (Vertexf *)NULL, BuilderV());
00238   return bucket.get_coords()[get_coord()];
00239 }
00240 
00241 ////////////////////////////////////////////////////////////////////
00242 //     Function: BuilderVertex::get_normal_value
00243 //       Access: Public
00244 //  Description: Returns the actual normal value of the vertex,
00245 //               whether it is indexed or nonindexed.  See
00246 //               get_coord_value().
00247 ////////////////////////////////////////////////////////////////////
00248 INLINE BuilderN BuilderVertexI::
00249 get_normal_value(const BuilderBucket &bucket) const {
00250   nassertr(bucket.get_normals() != (Normalf *)NULL, BuilderN());
00251   return bucket.get_normals()[get_normal()];
00252 }
00253 
00254 ////////////////////////////////////////////////////////////////////
00255 //     Function: BuilderVertex::get_texcoord_value
00256 //       Access: Public
00257 //  Description: Returns the actual texture coordinate value of the
00258 //               vertex, whether it is indexed or nonindexed.  See
00259 //               get_coord_value().
00260 ////////////////////////////////////////////////////////////////////
00261 INLINE BuilderTC BuilderVertexI::
00262 get_texcoord_value(const BuilderBucket &bucket) const {
00263   nassertr(bucket.get_texcoords() != (TexCoordf *)NULL, BuilderTC());
00264   return bucket.get_texcoords()[get_texcoord()];
00265 }
00266 
00267 ////////////////////////////////////////////////////////////////////
00268 //     Function: BuilderVertex::get_color_value
00269 //       Access: Public
00270 //  Description: Returns the actual color value of the vertex,
00271 //               whether it is indexed or nonindexed.  See
00272 //               get_coord_value().
00273 ////////////////////////////////////////////////////////////////////
00274 INLINE BuilderC BuilderVertexI::
00275 get_color_value(const BuilderBucket &bucket) const {
00276   nassertr(bucket.get_colors() != (Colorf *)NULL, BuilderC());
00277   return bucket.get_colors()[get_color()];
00278 }

Generated on Fri May 2 00:34:47 2003 for Panda by doxygen1.3