00001 // Filename: cLerpNodePathInterval.I00002 // Created by: drose (27Aug02)00003 //00004 ////////////////////////////////////////////////////////////////////00005 //00006 // PANDA 3D SOFTWARE00007 // Copyright (c) Carnegie Mellon University. All rights reserved.00008 //00009 // All use of this software is subject to the terms of the revised BSD00010 // license. You should have received a copy of this license along00011 // with this source code in a file named "LICENSE."00012 //00013 ////////////////////////////////////////////////////////////////////00014
00015
00016 ////////////////////////////////////////////////////////////////////00017 // Function: CLerpNodePathInterval::get_node00018 // Access: Published00019 // Description: Returns the node being lerped.00020 ////////////////////////////////////////////////////////////////////00021 INLINE constNodePath &CLerpNodePathInterval::00022get_node() const {
00023 return _node;
00024 }
00025
00026 ////////////////////////////////////////////////////////////////////00027 // Function: CLerpNodePathInterval::get_other00028 // Access: Published00029 // Description: Returns the "other" node, which the lerped node is00030 // being moved relative to. If this is an empty node00031 // path, the lerped node is being moved in its own00032 // coordinate system.00033 ////////////////////////////////////////////////////////////////////00034 INLINE constNodePath &CLerpNodePathInterval::00035get_other() const {
00036 return _other;
00037 }
00038
00039 ////////////////////////////////////////////////////////////////////00040 // Function: CLerpNodePathInterval::set_start_pos00041 // Access: Published00042 // Description: Indicates the initial position of the lerped node.00043 // This is meaningful only if set_end_pos() is also00044 // called. This parameter is optional; if unspecified,00045 // the value will be taken from the node's actual00046 // position at the time the lerp is performed.00047 ////////////////////////////////////////////////////////////////////00048 INLINE voidCLerpNodePathInterval::00049set_start_pos(constLVecBase3 &pos) {
00050 nassertv(!pos.is_nan());
00051 _start_pos = pos;
00052 _flags |= F_start_pos;
00053 }
00054
00055 ////////////////////////////////////////////////////////////////////00056 // Function: CLerpNodePathInterval::set_end_pos00057 // Access: Published00058 // Description: Indicates that the position of the node should be00059 // lerped, and specifies the final position of the node.00060 // This should be called before priv_initialize(). If this00061 // is not called, the node's position will not be00062 // affected by the lerp.00063 ////////////////////////////////////////////////////////////////////00064 INLINE voidCLerpNodePathInterval::00065set_end_pos(constLVecBase3 &pos) {
00066 nassertv(!pos.is_nan());
00067 _end_pos = pos;
00068 _flags |= F_end_pos;
00069 }
00070
00071 ////////////////////////////////////////////////////////////////////00072 // Function: CLerpNodePathInterval::set_start_hpr00073 // Access: Published00074 // Description: Indicates the initial rotation of the lerped node.00075 // This is meaningful only if either set_end_hpr() or00076 // set_end_quat() is also called. This parameter is00077 // optional; if unspecified, the value will be taken00078 // from the node's actual rotation at the time the lerp00079 // is performed.00080 ////////////////////////////////////////////////////////////////////00081 INLINE voidCLerpNodePathInterval::00082set_start_hpr(constLVecBase3 &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_hpr00090 // Access: Published00091 // Description: Indicates that the rotation of the node should be00092 // 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(). If00096 // 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 voidCLerpNodePathInterval::00100set_end_hpr(constLVecBase3 &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_hpr00108 // Access: Published00109 // Description: Indicates that the rotation of the node should be00110 // 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 a00114 // quaternion, even though the function name is00115 // set_end_hpr(). The quaternion will be implicitly00116 // converted to a HPR trio, and the lerp will be00117 // performed in HPR space, componentwise.00118 ////////////////////////////////////////////////////////////////////00119 INLINE voidCLerpNodePathInterval::00120set_end_hpr(constLQuaternion &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_quat00128 // Access: Published00129 // Description: Indicates the initial rotation of the lerped node.00130 // This is meaningful only if either set_end_quat() or00131 // set_end_hpr() is also called. This parameter is00132 // optional; if unspecified, the value will be taken00133 // from the node's actual rotation at the time the lerp00134 // is performed.00135 ////////////////////////////////////////////////////////////////////00136 INLINE voidCLerpNodePathInterval::00137set_start_quat(constLQuaternion &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_quat00145 // Access: Published00146 // Description: Indicates that the rotation of the node should be00147 // 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(). If00151 // 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 HPR00155 // trio, even though the function name is00156 // set_end_quat(). The HPR will be implicitly converted00157 // to a quaternion, and the lerp will be performed in00158 // quaternion space, as a spherical lerp.00159 ////////////////////////////////////////////////////////////////////00160 INLINE voidCLerpNodePathInterval::00161set_end_quat(constLVecBase3 &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_quat00169 // Access: Published00170 // Description: Indicates that the rotation of the node should be00171 // 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(). If00175 // 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 voidCLerpNodePathInterval::00179set_end_quat(constLQuaternion &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_scale00187 // Access: Published00188 // Description: Indicates the initial scale of the lerped node.00189 // This is meaningful only if set_end_scale() is also00190 // called. This parameter is optional; if unspecified,00191 // the value will be taken from the node's actual00192 // scale at the time the lerp is performed.00193 ////////////////////////////////////////////////////////////////////00194 INLINE voidCLerpNodePathInterval::00195set_start_scale(constLVecBase3 &scale) {
00196 nassertv(!scale.is_nan());
00197 _start_scale = scale;
00198 _flags |= F_start_scale;
00199 }
00200
00201 ////////////////////////////////////////////////////////////////////00202 // Function: CLerpNodePathInterval::set_start_scale00203 // Access: Published00204 // Description: Indicates the initial scale of the lerped node.00205 // This is meaningful only if set_end_scale() is also00206 // called. This parameter is optional; if unspecified,00207 // the value will be taken from the node's actual00208 // scale at the time the lerp is performed.00209 ////////////////////////////////////////////////////////////////////00210 INLINE voidCLerpNodePathInterval::00211set_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_scale00218 // Access: Published00219 // Description: Indicates that the scale of the node should be00220 // lerped, and specifies the final scale of the node.00221 // This should be called before priv_initialize(). If this00222 // is not called, the node's scale will not be00223 // affected by the lerp.00224 ////////////////////////////////////////////////////////////////////00225 INLINE voidCLerpNodePathInterval::00226set_end_scale(constLVecBase3 &scale) {
00227 nassertv(!scale.is_nan());
00228 _end_scale = scale;
00229 _flags |= F_end_scale;
00230 }
00231
00232 ////////////////////////////////////////////////////////////////////00233 // Function: CLerpNodePathInterval::set_end_scale00234 // Access: Published00235 // Description: Indicates that the scale of the node should be00236 // lerped, and specifies the final scale of the node.00237 // This should be called before priv_initialize(). If this00238 // is not called, the node's scale will not be00239 // affected by the lerp.00240 ////////////////////////////////////////////////////////////////////00241 INLINE voidCLerpNodePathInterval::00242set_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_shear00249 // Access: Published00250 // Description: Indicates the initial shear of the lerped node.00251 // This is meaningful only if set_end_shear() is also00252 // called. This parameter is optional; if unspecified,00253 // the value will be taken from the node's actual00254 // shear at the time the lerp is performed.00255 ////////////////////////////////////////////////////////////////////00256 INLINE voidCLerpNodePathInterval::00257set_start_shear(constLVecBase3 &shear) {
00258 nassertv(!shear.is_nan());
00259 _start_shear = shear;
00260 _flags |= F_start_shear;
00261 }
00262
00263 ////////////////////////////////////////////////////////////////////00264 // Function: CLerpNodePathInterval::set_end_shear00265 // Access: Published00266 // Description: Indicates that the shear of the node should be00267 // lerped, and specifies the final shear of the node.00268 // This should be called before priv_initialize(). If this00269 // is not called, the node's shear will not be00270 // affected by the lerp.00271 ////////////////////////////////////////////////////////////////////00272 INLINE voidCLerpNodePathInterval::00273set_end_shear(constLVecBase3 &shear) {
00274 nassertv(!shear.is_nan());
00275 _end_shear = shear;
00276 _flags |= F_end_shear;
00277 }
00278
00279 ////////////////////////////////////////////////////////////////////00280 // Function: CLerpNodePathInterval::set_start_color00281 // Access: Published00282 // Description: Indicates the initial color of the lerped node.00283 // This is meaningful only if set_end_color() is also00284 // called. This parameter is optional; if unspecified,00285 // the value will be taken from the node's actual00286 // color at the time the lerp is performed.00287 ////////////////////////////////////////////////////////////////////00288 INLINE voidCLerpNodePathInterval::00289set_start_color(constLVecBase4 &color) {
00290 nassertv(!color.is_nan());
00291 _start_color = color;
00292 _flags |= F_start_color;
00293 }
00294
00295 ////////////////////////////////////////////////////////////////////00296 // Function: CLerpNodePathInterval::set_end_color00297 // Access: Published00298 // Description: Indicates that the color of the node should be00299 // lerped, and specifies the final color of the node.00300 // This should be called before priv_initialize(). If this00301 // is not called, the node's color will not be00302 // affected by the lerp.00303 ////////////////////////////////////////////////////////////////////00304 INLINE voidCLerpNodePathInterval::00305set_end_color(constLVecBase4 &color) {
00306 nassertv(!color.is_nan());
00307 _end_color = color;
00308 _flags |= F_end_color;
00309 }
00310
00311 ////////////////////////////////////////////////////////////////////00312 // Function: CLerpNodePathInterval::set_start_color_scale00313 // Access: Published00314 // Description: Indicates the initial color scale of the lerped node.00315 // This is meaningful only if set_end_color_scale() is also00316 // called. This parameter is optional; if unspecified,00317 // the value will be taken from the node's actual00318 // color scale at the time the lerp is performed.00319 ////////////////////////////////////////////////////////////////////00320 INLINE voidCLerpNodePathInterval::00321set_start_color_scale(constLVecBase4 &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_scale00329 // Access: Published00330 // Description: Indicates that the color scale of the node should be00331 // lerped, and specifies the final color scale of the node.00332 // This should be called before priv_initialize(). If this00333 // is not called, the node's color scale will not be00334 // affected by the lerp.00335 ////////////////////////////////////////////////////////////////////00336 INLINE voidCLerpNodePathInterval::00337set_end_color_scale(constLVecBase4 &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_stage00345 // Access: Published00346 // Description: Indicates the texture stage that is adjusted by00347 // tex_offset, tex_rotate, and/or tex_scale. If this is00348 // not set, the default is the default texture stage.00349 ////////////////////////////////////////////////////////////////////00350 INLINE voidCLerpNodePathInterval::00351set_texture_stage(TextureStage *stage) {
00352 _texture_stage = stage;
00353 }
00354
00355 ////////////////////////////////////////////////////////////////////00356 // Function: CLerpNodePathInterval::set_start_tex_offset00357 // Access: Published00358 // Description: Indicates the initial UV offset of the lerped node.00359 // This is meaningful only if set_end_tex_offset() is also00360 // called. This parameter is optional; if unspecified,00361 // the value will be taken from the node's actual00362 // UV offset at the time the lerp is performed.00363 ////////////////////////////////////////////////////////////////////00364 INLINE voidCLerpNodePathInterval::00365set_start_tex_offset(constLVecBase2 &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_offset00373 // Access: Published00374 // Description: Indicates that the UV offset of the node should be00375 // lerped, and specifies the final UV offset of the node.00376 // This should be called before priv_initialize(). If this00377 // is not called, the node's UV offset will not be00378 // affected by the lerp.00379 ////////////////////////////////////////////////////////////////////00380 INLINE voidCLerpNodePathInterval::00381set_end_tex_offset(constLVecBase2 &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_rotate00389 // Access: Published00390 // Description: Indicates the initial UV rotate of the lerped node.00391 // This is meaningful only if set_end_tex_rotate() is also00392 // called. This parameter is optional; if unspecified,00393 // the value will be taken from the node's actual00394 // UV rotate at the time the lerp is performed.00395 ////////////////////////////////////////////////////////////////////00396 INLINE voidCLerpNodePathInterval::00397set_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_rotate00405 // Access: Published00406 // Description: Indicates that the UV rotate of the node should be00407 // lerped, and specifies the final UV rotate of the node.00408 // This should be called before priv_initialize(). If this00409 // is not called, the node's UV rotate will not be00410 // affected by the lerp.00411 ////////////////////////////////////////////////////////////////////00412 INLINE voidCLerpNodePathInterval::00413set_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_scale00421 // Access: Published00422 // Description: Indicates the initial UV scale of the lerped node.00423 // This is meaningful only if set_end_tex_scale() is also00424 // called. This parameter is optional; if unspecified,00425 // the value will be taken from the node's actual00426 // UV scale at the time the lerp is performed.00427 ////////////////////////////////////////////////////////////////////00428 INLINE voidCLerpNodePathInterval::00429set_start_tex_scale(constLVecBase2 &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_scale00437 // Access: Published00438 // Description: Indicates that the UV scale of the node should be00439 // lerped, and specifies the final UV scale of the node.00440 // This should be called before priv_initialize(). If this00441 // is not called, the node's UV scale will not be00442 // affected by the lerp.00443 ////////////////////////////////////////////////////////////////////00444 INLINE voidCLerpNodePathInterval::00445set_end_tex_scale(constLVecBase2 &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_override00453 // Access: Published00454 // Description: Changes the override value that will be associated00455 // with any state changes applied by the lerp. If this00456 // lerp is changing state (for instance, a color lerp or00457 // a tex matrix lerp), then the new attributes created00458 // by this lerp will be assigned the indicated override00459 // value when they are applied to the node.00460 ////////////////////////////////////////////////////////////////////00461 INLINE voidCLerpNodePathInterval::00462set_override(intoverride) {
00463 _override = override;
00464 }
00465
00466 ////////////////////////////////////////////////////////////////////00467 // Function: CLerpNodePathInterval::get_override00468 // Access: Published00469 // Description: Returns the override value that will be associated00470 // with any state changes applied by the lerp. See00471 // set_override().00472 ////////////////////////////////////////////////////////////////////00473 INLINE intCLerpNodePathInterval::00474get_override() const {
00475 return _override;
00476 }