Panda3D

cLerpNodePathInterval.I

00001 // Filename: cLerpNodePathInterval.I
00002 // Created by:  drose (27Aug02)
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: CLerpNodePathInterval::get_node
00018 //       Access: Published
00019 //  Description: Returns the node being lerped.
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE const NodePath &CLerpNodePathInterval::
00022 get_node() const {
00023   return _node;
00024 }
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //     Function: CLerpNodePathInterval::get_other
00028 //       Access: Published
00029 //  Description: Returns the "other" node, which the lerped node is
00030 //               being moved relative to.  If this is an empty node
00031 //               path, the lerped node is being moved in its own
00032 //               coordinate system.
00033 ////////////////////////////////////////////////////////////////////
00034 INLINE const NodePath &CLerpNodePathInterval::
00035 get_other() const {
00036   return _other;
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: CLerpNodePathInterval::set_start_pos
00041 //       Access: Published
00042 //  Description: Indicates the initial position of the lerped node.
00043 //               This is meaningful only if set_end_pos() is also
00044 //               called.  This parameter is optional; if unspecified,
00045 //               the value will be taken from the node's actual
00046 //               position at the time the lerp is performed.
00047 ////////////////////////////////////////////////////////////////////
00048 INLINE void CLerpNodePathInterval::
00049 set_start_pos(const LVecBase3 &pos) {
00050   nassertv(!pos.is_nan());
00051   _start_pos = pos;
00052   _flags |= F_start_pos;
00053 }
00054 
00055 ////////////////////////////////////////////////////////////////////
00056 //     Function: CLerpNodePathInterval::set_end_pos
00057 //       Access: Published
00058 //  Description: Indicates that the position of the node should be
00059 //               lerped, and specifies the final position of the node.
00060 //               This should be called before priv_initialize().  If this
00061 //               is not called, the node's position will not be
00062 //               affected by the lerp.
00063 ////////////////////////////////////////////////////////////////////
00064 INLINE void CLerpNodePathInterval::
00065 set_end_pos(const LVecBase3 &pos) {
00066   nassertv(!pos.is_nan());
00067   _end_pos = pos;
00068   _flags |= F_end_pos;
00069 }
00070 
00071 ////////////////////////////////////////////////////////////////////
00072 //     Function: CLerpNodePathInterval::set_start_hpr
00073 //       Access: Published
00074 //  Description: Indicates the initial rotation of the lerped node.
00075 //               This is meaningful only if either set_end_hpr() or
00076 //               set_end_quat() is also called.  This parameter is
00077 //               optional; if unspecified, the value will be taken
00078 //               from the node's actual rotation at the time the lerp
00079 //               is performed.
00080 ////////////////////////////////////////////////////////////////////
00081 INLINE void CLerpNodePathInterval::
00082 set_start_hpr(const LVecBase3 &hpr) {
00083   nassertv(!hpr.is_nan());
00084   _start_hpr = hpr;
00085   _flags = (_flags & ~(F_slerp_setup | F_start_quat)) | F_start_hpr;
00086 }
00087 
00088 ////////////////////////////////////////////////////////////////////
00089 //     Function: CLerpNodePathInterval::set_end_hpr
00090 //       Access: Published
00091 //  Description: Indicates that the rotation of the node should be
00092 //               lerped, and specifies the final rotation of the node.
00093 //               This should be called before priv_initialize().
00094 //
00095 //               This replaces a previous call to set_end_quat().  If
00096 //               neither set_end_hpr() nor set_end_quat() is called,
00097 //               the node's rotation will not be affected by the lerp.
00098 ////////////////////////////////////////////////////////////////////
00099 INLINE void CLerpNodePathInterval::
00100 set_end_hpr(const LVecBase3 &hpr) {
00101   nassertv(!hpr.is_nan());
00102   _end_hpr = hpr;
00103   _flags = (_flags & ~F_end_quat) | F_end_hpr;
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: CLerpNodePathInterval::set_end_hpr
00108 //       Access: Published
00109 //  Description: Indicates that the rotation of the node should be
00110 //               lerped, and specifies the final rotation of the node.
00111 //               This should be called before priv_initialize().
00112 //
00113 //               This special function is overloaded to accept a
00114 //               quaternion, even though the function name is
00115 //               set_end_hpr().  The quaternion will be implicitly
00116 //               converted to a HPR trio, and the lerp will be
00117 //               performed in HPR space, componentwise.
00118 ////////////////////////////////////////////////////////////////////
00119 INLINE void CLerpNodePathInterval::
00120 set_end_hpr(const LQuaternion &quat) {
00121   nassertv(!quat.is_nan());
00122   _end_hpr = quat.get_hpr();
00123   _flags = (_flags & ~F_end_quat) | F_end_hpr;
00124 }
00125 
00126 ////////////////////////////////////////////////////////////////////
00127 //     Function: CLerpNodePathInterval::set_start_quat
00128 //       Access: Published
00129 //  Description: Indicates the initial rotation of the lerped node.
00130 //               This is meaningful only if either set_end_quat() or
00131 //               set_end_hpr() is also called.  This parameter is
00132 //               optional; if unspecified, the value will be taken
00133 //               from the node's actual rotation at the time the lerp
00134 //               is performed.
00135 ////////////////////////////////////////////////////////////////////
00136 INLINE void CLerpNodePathInterval::
00137 set_start_quat(const LQuaternion &quat) {
00138   nassertv(!quat.is_nan());
00139   _start_quat = quat;
00140   _flags = (_flags & ~(F_slerp_setup | F_start_hpr)) | F_start_quat;
00141 }
00142 
00143 ////////////////////////////////////////////////////////////////////
00144 //     Function: CLerpNodePathInterval::set_end_quat
00145 //       Access: Published
00146 //  Description: Indicates that the rotation of the node should be
00147 //               lerped, and specifies the final rotation of the node.
00148 //               This should be called before priv_initialize().
00149 //
00150 //               This replaces a previous call to set_end_hpr().  If
00151 //               neither set_end_quat() nor set_end_hpr() is called,
00152 //               the node's rotation will not be affected by the lerp.
00153 //
00154 //               This special function is overloaded to accept a HPR
00155 //               trio, even though the function name is
00156 //               set_end_quat().  The HPR will be implicitly converted
00157 //               to a quaternion, and the lerp will be performed in
00158 //               quaternion space, as a spherical lerp.
00159 ////////////////////////////////////////////////////////////////////
00160 INLINE void CLerpNodePathInterval::
00161 set_end_quat(const LVecBase3 &hpr) {
00162   nassertv(!hpr.is_nan());
00163   _end_quat.set_hpr(hpr);
00164   _flags = (_flags & ~(F_slerp_setup | F_end_hpr)) | F_end_quat;
00165 }
00166 
00167 ////////////////////////////////////////////////////////////////////
00168 //     Function: CLerpNodePathInterval::set_end_quat
00169 //       Access: Published
00170 //  Description: Indicates that the rotation of the node should be
00171 //               lerped, and specifies the final rotation of the node.
00172 //               This should be called before priv_initialize().
00173 //
00174 //               This replaces a previous call to set_end_hpr().  If
00175 //               neither set_end_quat() nor set_end_hpr() is called,
00176 //               the node's rotation will not be affected by the lerp.
00177 ////////////////////////////////////////////////////////////////////
00178 INLINE void CLerpNodePathInterval::
00179 set_end_quat(const LQuaternion &quat) {
00180   nassertv(!quat.is_nan());
00181   _end_quat = quat;
00182   _flags = (_flags & ~(F_slerp_setup | F_end_hpr)) | F_end_quat;
00183 }
00184 
00185 ////////////////////////////////////////////////////////////////////
00186 //     Function: CLerpNodePathInterval::set_start_scale
00187 //       Access: Published
00188 //  Description: Indicates the initial scale of the lerped node.
00189 //               This is meaningful only if set_end_scale() is also
00190 //               called.  This parameter is optional; if unspecified,
00191 //               the value will be taken from the node's actual
00192 //               scale at the time the lerp is performed.
00193 ////////////////////////////////////////////////////////////////////
00194 INLINE void CLerpNodePathInterval::
00195 set_start_scale(const LVecBase3 &scale) {
00196   nassertv(!scale.is_nan());
00197   _start_scale = scale;
00198   _flags |= F_start_scale;
00199 }
00200 
00201 ////////////////////////////////////////////////////////////////////
00202 //     Function: CLerpNodePathInterval::set_start_scale
00203 //       Access: Published
00204 //  Description: Indicates the initial scale of the lerped node.
00205 //               This is meaningful only if set_end_scale() is also
00206 //               called.  This parameter is optional; if unspecified,
00207 //               the value will be taken from the node's actual
00208 //               scale at the time the lerp is performed.
00209 ////////////////////////////////////////////////////////////////////
00210 INLINE void CLerpNodePathInterval::
00211 set_start_scale(PN_stdfloat scale) {
00212   nassertv(!cnan(scale));
00213   set_start_scale(LVecBase3(scale, scale, scale));
00214 }
00215 
00216 ////////////////////////////////////////////////////////////////////
00217 //     Function: CLerpNodePathInterval::set_end_scale
00218 //       Access: Published
00219 //  Description: Indicates that the scale of the node should be
00220 //               lerped, and specifies the final scale of the node.
00221 //               This should be called before priv_initialize().  If this
00222 //               is not called, the node's scale will not be
00223 //               affected by the lerp.
00224 ////////////////////////////////////////////////////////////////////
00225 INLINE void CLerpNodePathInterval::
00226 set_end_scale(const LVecBase3 &scale) {
00227   nassertv(!scale.is_nan());
00228   _end_scale = scale;
00229   _flags |= F_end_scale;
00230 }
00231 
00232 ////////////////////////////////////////////////////////////////////
00233 //     Function: CLerpNodePathInterval::set_end_scale
00234 //       Access: Published
00235 //  Description: Indicates that the scale of the node should be
00236 //               lerped, and specifies the final scale of the node.
00237 //               This should be called before priv_initialize().  If this
00238 //               is not called, the node's scale will not be
00239 //               affected by the lerp.
00240 ////////////////////////////////////////////////////////////////////
00241 INLINE void CLerpNodePathInterval::
00242 set_end_scale(PN_stdfloat scale) {
00243   nassertv(!cnan(scale));
00244   set_end_scale(LVecBase3(scale, scale, scale));
00245 }
00246 
00247 ////////////////////////////////////////////////////////////////////
00248 //     Function: CLerpNodePathInterval::set_start_shear
00249 //       Access: Published
00250 //  Description: Indicates the initial shear of the lerped node.
00251 //               This is meaningful only if set_end_shear() is also
00252 //               called.  This parameter is optional; if unspecified,
00253 //               the value will be taken from the node's actual
00254 //               shear at the time the lerp is performed.
00255 ////////////////////////////////////////////////////////////////////
00256 INLINE void CLerpNodePathInterval::
00257 set_start_shear(const LVecBase3 &shear) {
00258   nassertv(!shear.is_nan());
00259   _start_shear = shear;
00260   _flags |= F_start_shear;
00261 }
00262 
00263 ////////////////////////////////////////////////////////////////////
00264 //     Function: CLerpNodePathInterval::set_end_shear
00265 //       Access: Published
00266 //  Description: Indicates that the shear of the node should be
00267 //               lerped, and specifies the final shear of the node.
00268 //               This should be called before priv_initialize().  If this
00269 //               is not called, the node's shear will not be
00270 //               affected by the lerp.
00271 ////////////////////////////////////////////////////////////////////
00272 INLINE void CLerpNodePathInterval::
00273 set_end_shear(const LVecBase3 &shear) {
00274   nassertv(!shear.is_nan());
00275   _end_shear = shear;
00276   _flags |= F_end_shear;
00277 }
00278 
00279 ////////////////////////////////////////////////////////////////////
00280 //     Function: CLerpNodePathInterval::set_start_color
00281 //       Access: Published
00282 //  Description: Indicates the initial color of the lerped node.
00283 //               This is meaningful only if set_end_color() is also
00284 //               called.  This parameter is optional; if unspecified,
00285 //               the value will be taken from the node's actual
00286 //               color at the time the lerp is performed.
00287 ////////////////////////////////////////////////////////////////////
00288 INLINE void CLerpNodePathInterval::
00289 set_start_color(const LVecBase4 &color) {
00290   nassertv(!color.is_nan());
00291   _start_color = color;
00292   _flags |= F_start_color;
00293 }
00294 
00295 ////////////////////////////////////////////////////////////////////
00296 //     Function: CLerpNodePathInterval::set_end_color
00297 //       Access: Published
00298 //  Description: Indicates that the color of the node should be
00299 //               lerped, and specifies the final color of the node.
00300 //               This should be called before priv_initialize().  If this
00301 //               is not called, the node's color will not be
00302 //               affected by the lerp.
00303 ////////////////////////////////////////////////////////////////////
00304 INLINE void CLerpNodePathInterval::
00305 set_end_color(const LVecBase4 &color) {
00306   nassertv(!color.is_nan());
00307   _end_color = color;
00308   _flags |= F_end_color;
00309 }
00310 
00311 ////////////////////////////////////////////////////////////////////
00312 //     Function: CLerpNodePathInterval::set_start_color_scale
00313 //       Access: Published
00314 //  Description: Indicates the initial color scale of the lerped node.
00315 //               This is meaningful only if set_end_color_scale() is also
00316 //               called.  This parameter is optional; if unspecified,
00317 //               the value will be taken from the node's actual
00318 //               color scale at the time the lerp is performed.
00319 ////////////////////////////////////////////////////////////////////
00320 INLINE void CLerpNodePathInterval::
00321 set_start_color_scale(const LVecBase4 &color_scale) {
00322   nassertv(!color_scale.is_nan());
00323   _start_color_scale = color_scale;
00324   _flags |= F_start_color_scale;
00325 }
00326 
00327 ////////////////////////////////////////////////////////////////////
00328 //     Function: CLerpNodePathInterval::set_end_color_scale
00329 //       Access: Published
00330 //  Description: Indicates that the color scale of the node should be
00331 //               lerped, and specifies the final color scale of the node.
00332 //               This should be called before priv_initialize().  If this
00333 //               is not called, the node's color scale will not be
00334 //               affected by the lerp.
00335 ////////////////////////////////////////////////////////////////////
00336 INLINE void CLerpNodePathInterval::
00337 set_end_color_scale(const LVecBase4 &color_scale) {
00338   nassertv(!color_scale.is_nan());
00339   _end_color_scale = color_scale;
00340   _flags |= F_end_color_scale;
00341 }
00342 
00343 ////////////////////////////////////////////////////////////////////
00344 //     Function: CLerpNodePathInterval::set_texture_stage
00345 //       Access: Published
00346 //  Description: Indicates the texture stage that is adjusted by
00347 //               tex_offset, tex_rotate, and/or tex_scale.  If this is
00348 //               not set, the default is the default texture stage.
00349 ////////////////////////////////////////////////////////////////////
00350 INLINE void CLerpNodePathInterval::
00351 set_texture_stage(TextureStage *stage) {
00352   _texture_stage = stage;
00353 }
00354 
00355 ////////////////////////////////////////////////////////////////////
00356 //     Function: CLerpNodePathInterval::set_start_tex_offset
00357 //       Access: Published
00358 //  Description: Indicates the initial UV offset of the lerped node.
00359 //               This is meaningful only if set_end_tex_offset() is also
00360 //               called.  This parameter is optional; if unspecified,
00361 //               the value will be taken from the node's actual
00362 //               UV offset at the time the lerp is performed.
00363 ////////////////////////////////////////////////////////////////////
00364 INLINE void CLerpNodePathInterval::
00365 set_start_tex_offset(const LVecBase2 &tex_offset) {
00366   nassertv(!tex_offset.is_nan());
00367   _start_tex_offset = tex_offset;
00368   _flags |= F_start_tex_offset;
00369 }
00370 
00371 ////////////////////////////////////////////////////////////////////
00372 //     Function: CLerpNodePathInterval::set_end_tex_offset
00373 //       Access: Published
00374 //  Description: Indicates that the UV offset of the node should be
00375 //               lerped, and specifies the final UV offset of the node.
00376 //               This should be called before priv_initialize().  If this
00377 //               is not called, the node's UV offset will not be
00378 //               affected by the lerp.
00379 ////////////////////////////////////////////////////////////////////
00380 INLINE void CLerpNodePathInterval::
00381 set_end_tex_offset(const LVecBase2 &tex_offset) {
00382   nassertv(!tex_offset.is_nan());
00383   _end_tex_offset = tex_offset;
00384   _flags |= F_end_tex_offset;
00385 }
00386 
00387 ////////////////////////////////////////////////////////////////////
00388 //     Function: CLerpNodePathInterval::set_start_tex_rotate
00389 //       Access: Published
00390 //  Description: Indicates the initial UV rotate of the lerped node.
00391 //               This is meaningful only if set_end_tex_rotate() is also
00392 //               called.  This parameter is optional; if unspecified,
00393 //               the value will be taken from the node's actual
00394 //               UV rotate at the time the lerp is performed.
00395 ////////////////////////////////////////////////////////////////////
00396 INLINE void CLerpNodePathInterval::
00397 set_start_tex_rotate(PN_stdfloat tex_rotate) {
00398   nassertv(!cnan(tex_rotate));
00399   _start_tex_rotate = tex_rotate;
00400   _flags |= F_start_tex_rotate;
00401 }
00402 
00403 ////////////////////////////////////////////////////////////////////
00404 //     Function: CLerpNodePathInterval::set_end_tex_rotate
00405 //       Access: Published
00406 //  Description: Indicates that the UV rotate of the node should be
00407 //               lerped, and specifies the final UV rotate of the node.
00408 //               This should be called before priv_initialize().  If this
00409 //               is not called, the node's UV rotate will not be
00410 //               affected by the lerp.
00411 ////////////////////////////////////////////////////////////////////
00412 INLINE void CLerpNodePathInterval::
00413 set_end_tex_rotate(PN_stdfloat tex_rotate) {
00414   nassertv(!cnan(tex_rotate));
00415   _end_tex_rotate = tex_rotate;
00416   _flags |= F_end_tex_rotate;
00417 }
00418 
00419 ////////////////////////////////////////////////////////////////////
00420 //     Function: CLerpNodePathInterval::set_start_tex_scale
00421 //       Access: Published
00422 //  Description: Indicates the initial UV scale of the lerped node.
00423 //               This is meaningful only if set_end_tex_scale() is also
00424 //               called.  This parameter is optional; if unspecified,
00425 //               the value will be taken from the node's actual
00426 //               UV scale at the time the lerp is performed.
00427 ////////////////////////////////////////////////////////////////////
00428 INLINE void CLerpNodePathInterval::
00429 set_start_tex_scale(const LVecBase2 &tex_scale) {
00430   nassertv(!tex_scale.is_nan());
00431   _start_tex_scale = tex_scale;
00432   _flags |= F_start_tex_scale;
00433 }
00434 
00435 ////////////////////////////////////////////////////////////////////
00436 //     Function: CLerpNodePathInterval::set_end_tex_scale
00437 //       Access: Published
00438 //  Description: Indicates that the UV scale of the node should be
00439 //               lerped, and specifies the final UV scale of the node.
00440 //               This should be called before priv_initialize().  If this
00441 //               is not called, the node's UV scale will not be
00442 //               affected by the lerp.
00443 ////////////////////////////////////////////////////////////////////
00444 INLINE void CLerpNodePathInterval::
00445 set_end_tex_scale(const LVecBase2 &tex_scale) {
00446   nassertv(!tex_scale.is_nan());
00447   _end_tex_scale = tex_scale;
00448   _flags |= F_end_tex_scale;
00449 }
00450 
00451 ////////////////////////////////////////////////////////////////////
00452 //     Function: CLerpNodePathInterval::set_override
00453 //       Access: Published
00454 //  Description: Changes the override value that will be associated
00455 //               with any state changes applied by the lerp.  If this
00456 //               lerp is changing state (for instance, a color lerp or
00457 //               a tex matrix lerp), then the new attributes created
00458 //               by this lerp will be assigned the indicated override
00459 //               value when they are applied to the node.
00460 ////////////////////////////////////////////////////////////////////
00461 INLINE void CLerpNodePathInterval::
00462 set_override(int override) {
00463   _override = override;
00464 }
00465 
00466 ////////////////////////////////////////////////////////////////////
00467 //     Function: CLerpNodePathInterval::get_override
00468 //       Access: Published
00469 //  Description: Returns the override value that will be associated
00470 //               with any state changes applied by the lerp.  See
00471 //               set_override().
00472 ////////////////////////////////////////////////////////////////////
00473 INLINE int CLerpNodePathInterval::
00474 get_override() const {
00475   return _override;
00476 }
 All Classes Functions Variables Enumerations