Panda3D
|
00001 // Filename: shaderInput.I 00002 // Created by: jyelon (01Sep05) 00003 // Updated by: fperazzi, PandaSE (06Apr10) 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 // Function: ShaderInput::Destructor 00017 // Access: Public 00018 // Description: 00019 //////////////////////////////////////////////////////////////////// 00020 INLINE ShaderInput:: 00021 ~ShaderInput() 00022 { 00023 } 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: ShaderInput::Constructor 00027 // Access: Published 00028 // Description: 00029 //////////////////////////////////////////////////////////////////// 00030 INLINE ShaderInput:: 00031 ShaderInput(const InternalName *name, int priority) : 00032 _name(name), 00033 _type(M_invalid), 00034 _priority(priority) 00035 { 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: ShaderInput::Constructor 00040 // Access: Published 00041 // Description: 00042 //////////////////////////////////////////////////////////////////// 00043 INLINE ShaderInput:: 00044 ShaderInput(const InternalName *name, Texture *tex, int priority) : 00045 _name(name), 00046 _type(M_texture), 00047 _priority(priority), 00048 _stored_texture(tex) 00049 { 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: ShaderInput::Constructor 00054 // Access: Published 00055 // Description: 00056 //////////////////////////////////////////////////////////////////// 00057 INLINE ShaderInput:: 00058 ShaderInput(const InternalName *name, const NodePath &np, int priority) : 00059 _name(name), 00060 _type(M_nodepath), 00061 _priority(priority), 00062 _stored_nodepath(np) 00063 { 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: ShaderInput::Constructor 00068 // Access: Published 00069 // Description: 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE ShaderInput:: 00072 ShaderInput(const InternalName *name, const PTA_float &ptr, int priority) : 00073 _name(name), 00074 _type(M_numeric), 00075 _priority(priority), 00076 _stored_ptr(ptr) 00077 { 00078 } 00079 00080 //////////////////////////////////////////////////////////////////// 00081 // Function: ShaderInput::Constructor 00082 // Access: Published 00083 // Description: 00084 //////////////////////////////////////////////////////////////////// 00085 INLINE ShaderInput:: 00086 ShaderInput(const InternalName *name, const PTA_LVecBase4f &ptr, int priority) : 00087 _name(name), 00088 _type(M_numeric), 00089 _priority(priority), 00090 _stored_ptr(ptr) 00091 { 00092 } 00093 00094 //////////////////////////////////////////////////////////////////// 00095 // Function: ShaderInput::Constructor 00096 // Access: Published 00097 // Description: 00098 //////////////////////////////////////////////////////////////////// 00099 INLINE ShaderInput:: 00100 ShaderInput(const InternalName *name, const PTA_LVecBase3f &ptr, int priority) : 00101 _name(name), 00102 _type(M_numeric), 00103 _priority(priority), 00104 _stored_ptr(ptr) 00105 { 00106 } 00107 00108 //////////////////////////////////////////////////////////////////// 00109 // Function: ShaderInput::Constructor 00110 // Access: Published 00111 // Description: 00112 //////////////////////////////////////////////////////////////////// 00113 INLINE ShaderInput:: 00114 ShaderInput(const InternalName *name, const PTA_LVecBase2f &ptr, int priority) : 00115 _name(name), 00116 _type(M_numeric), 00117 _priority(priority), 00118 _stored_ptr(ptr) 00119 { 00120 } 00121 00122 //////////////////////////////////////////////////////////////////// 00123 // Function: ShaderInput::Constructor 00124 // Access: Published 00125 // Description: 00126 //////////////////////////////////////////////////////////////////// 00127 INLINE ShaderInput:: 00128 ShaderInput(const InternalName *name, const LVecBase4f &vec, int priority) : 00129 _name(name), 00130 _type(M_numeric), 00131 _priority(priority), 00132 _stored_ptr(vec), 00133 _stored_vector(LCAST(PN_stdfloat, vec)) //old GLSL inputs must be supported 00134 { 00135 } 00136 00137 //////////////////////////////////////////////////////////////////// 00138 // Function: ShaderInput::Constructor 00139 // Access: Published 00140 // Description: 00141 //////////////////////////////////////////////////////////////////// 00142 INLINE ShaderInput:: 00143 ShaderInput(const InternalName *name, const LVecBase3f &vec, int priority) : 00144 _name(name), 00145 _type(M_numeric), 00146 _priority(priority), 00147 _stored_ptr(vec) 00148 { 00149 } 00150 00151 //////////////////////////////////////////////////////////////////// 00152 // Function: ShaderInput::Constructor 00153 // Access: Published 00154 // Description: 00155 //////////////////////////////////////////////////////////////////// 00156 INLINE ShaderInput:: 00157 ShaderInput(const InternalName *name, const LVecBase2f &vec, int priority) : 00158 _name(name), 00159 _type(M_numeric), 00160 _priority(priority), 00161 _stored_ptr(vec) 00162 { 00163 } 00164 00165 //////////////////////////////////////////////////////////////////// 00166 // Function: ShaderInput::Constructor 00167 // Access: Published 00168 // Description: 00169 //////////////////////////////////////////////////////////////////// 00170 INLINE ShaderInput:: 00171 ShaderInput(const InternalName *name, const PTA_LMatrix4f &ptr, int priority) : 00172 _name(name), 00173 _type(M_numeric), 00174 _priority(priority), 00175 _stored_ptr(ptr) 00176 { 00177 } 00178 00179 //////////////////////////////////////////////////////////////////// 00180 // Function: ShaderInput::Constructor 00181 // Access: Published 00182 // Description: 00183 //////////////////////////////////////////////////////////////////// 00184 INLINE ShaderInput:: 00185 ShaderInput(const InternalName *name, const PTA_LMatrix3f &ptr, int priority) : 00186 _name(name), 00187 _type(M_numeric), 00188 _priority(priority), 00189 _stored_ptr(ptr) 00190 { 00191 } 00192 00193 //////////////////////////////////////////////////////////////////// 00194 // Function: ShaderInput::Constructor 00195 // Access: Published 00196 // Description: 00197 //////////////////////////////////////////////////////////////////// 00198 INLINE ShaderInput:: 00199 ShaderInput(const InternalName *name, const LMatrix4f &mat, int priority) : 00200 _name(name), 00201 _type(M_numeric), 00202 _priority(priority), 00203 _stored_ptr(mat) 00204 { 00205 } 00206 00207 //////////////////////////////////////////////////////////////////// 00208 // Function: ShaderInput::Constructor 00209 // Access: Published 00210 // Description: 00211 //////////////////////////////////////////////////////////////////// 00212 INLINE ShaderInput:: 00213 ShaderInput(const InternalName *name, const LMatrix3f &mat, int priority) : 00214 _name(name), 00215 _type(M_numeric), 00216 _priority(priority), 00217 _stored_ptr(mat) 00218 { 00219 } 00220 00221 //////////////////////////////////////////////////////////////////// 00222 // Function: ShaderInput::Constructor 00223 // Access: Published 00224 // Description: 00225 //////////////////////////////////////////////////////////////////// 00226 INLINE ShaderInput:: 00227 ShaderInput(const InternalName *name, const PTA_double &ptr, int priority) : 00228 _name(name), 00229 _type(M_numeric), 00230 _priority(priority), 00231 _stored_ptr(ptr) 00232 { 00233 } 00234 00235 //////////////////////////////////////////////////////////////////// 00236 // Function: ShaderInput::Constructor 00237 // Access: Published 00238 // Description: 00239 //////////////////////////////////////////////////////////////////// 00240 INLINE ShaderInput:: 00241 ShaderInput(const InternalName *name, const PTA_LVecBase4d &ptr, int priority) : 00242 _name(name), 00243 _type(M_numeric), 00244 _priority(priority), 00245 _stored_ptr(ptr) 00246 { 00247 } 00248 00249 //////////////////////////////////////////////////////////////////// 00250 // Function: ShaderInput::Constructor 00251 // Access: Published 00252 // Description: 00253 //////////////////////////////////////////////////////////////////// 00254 INLINE ShaderInput:: 00255 ShaderInput(const InternalName *name, const PTA_LVecBase3d &ptr, int priority) : 00256 _name(name), 00257 _type(M_numeric), 00258 _priority(priority), 00259 _stored_ptr(ptr) 00260 { 00261 } 00262 00263 //////////////////////////////////////////////////////////////////// 00264 // Function: ShaderInput::Constructor 00265 // Access: Published 00266 // Description: 00267 //////////////////////////////////////////////////////////////////// 00268 INLINE ShaderInput:: 00269 ShaderInput(const InternalName *name, const PTA_LVecBase2d &ptr, int priority) : 00270 _name(name), 00271 _type(M_numeric), 00272 _priority(priority), 00273 _stored_ptr(ptr) 00274 { 00275 } 00276 00277 //////////////////////////////////////////////////////////////////// 00278 // Function: ShaderInput::Constructor 00279 // Access: Published 00280 // Description: 00281 //////////////////////////////////////////////////////////////////// 00282 INLINE ShaderInput:: 00283 ShaderInput(const InternalName *name, const LVecBase4d &vec, int priority) : 00284 _name(name), 00285 _type(M_numeric), 00286 _priority(priority), 00287 _stored_ptr(vec), 00288 _stored_vector(LCAST(PN_stdfloat, vec)) //old GLSL inputs must be supported 00289 { 00290 } 00291 00292 //////////////////////////////////////////////////////////////////// 00293 // Function: ShaderInput::Constructor 00294 // Access: Published 00295 // Description: 00296 //////////////////////////////////////////////////////////////////// 00297 INLINE ShaderInput:: 00298 ShaderInput(const InternalName *name, const LVecBase3d &vec, int priority) : 00299 _name(name), 00300 _type(M_numeric), 00301 _priority(priority), 00302 _stored_ptr(vec) 00303 { 00304 } 00305 00306 //////////////////////////////////////////////////////////////////// 00307 // Function: ShaderInput::Constructor 00308 // Access: Published 00309 // Description: 00310 //////////////////////////////////////////////////////////////////// 00311 INLINE ShaderInput:: 00312 ShaderInput(const InternalName *name, const LVecBase2d &vec, int priority) : 00313 _name(name), 00314 _type(M_numeric), 00315 _priority(priority), 00316 _stored_ptr(vec) 00317 { 00318 } 00319 00320 //////////////////////////////////////////////////////////////////// 00321 // Function: ShaderInput::Constructor 00322 // Access: Published 00323 // Description: 00324 //////////////////////////////////////////////////////////////////// 00325 INLINE ShaderInput:: 00326 ShaderInput(const InternalName *name, const PTA_LMatrix4d &ptr, int priority) : 00327 _name(name), 00328 _type(M_numeric), 00329 _priority(priority), 00330 _stored_ptr(ptr) 00331 { 00332 } 00333 00334 //////////////////////////////////////////////////////////////////// 00335 // Function: ShaderInput::Constructor 00336 // Access: Published 00337 // Description: 00338 //////////////////////////////////////////////////////////////////// 00339 INLINE ShaderInput:: 00340 ShaderInput(const InternalName *name, const PTA_LMatrix3d &ptr, int priority) : 00341 _name(name), 00342 _type(M_numeric), 00343 _priority(priority), 00344 _stored_ptr(ptr) 00345 { 00346 } 00347 00348 //////////////////////////////////////////////////////////////////// 00349 // Function: ShaderInput::Constructor 00350 // Access: Published 00351 // Description: 00352 //////////////////////////////////////////////////////////////////// 00353 INLINE ShaderInput:: 00354 ShaderInput(const InternalName *name, const LMatrix4d &mat, int priority) : 00355 _name(name), 00356 _type(M_numeric), 00357 _priority(priority), 00358 _stored_ptr(mat) 00359 { 00360 } 00361 00362 //////////////////////////////////////////////////////////////////// 00363 // Function: ShaderInput::Constructor 00364 // Access: Published 00365 // Description: 00366 //////////////////////////////////////////////////////////////////// 00367 INLINE ShaderInput:: 00368 ShaderInput(const InternalName *name, const LMatrix3d &mat, int priority) : 00369 _name(name), 00370 _type(M_numeric), 00371 _priority(priority), 00372 _stored_ptr(mat) 00373 { 00374 } 00375 00376 //////////////////////////////////////////////////////////////////// 00377 // Function: ShaderInput::get_name 00378 // Access: Published 00379 // Description: 00380 //////////////////////////////////////////////////////////////////// 00381 INLINE const InternalName *ShaderInput:: 00382 get_name() const { 00383 return _name; 00384 } 00385 00386 //////////////////////////////////////////////////////////////////// 00387 // Function: ShaderInput::get_value_type 00388 // Access: Published 00389 // Description: 00390 //////////////////////////////////////////////////////////////////// 00391 INLINE int ShaderInput:: 00392 get_value_type() const { 00393 return _type; 00394 } 00395 00396 //////////////////////////////////////////////////////////////////// 00397 // Function: ShaderInput::get_priority 00398 // Access: Published 00399 // Description: 00400 //////////////////////////////////////////////////////////////////// 00401 INLINE int ShaderInput:: 00402 get_priority() const { 00403 return _priority; 00404 } 00405 00406 //////////////////////////////////////////////////////////////////// 00407 // Function: ShaderInput::get_texture 00408 // Access: Published 00409 // Description: 00410 //////////////////////////////////////////////////////////////////// 00411 INLINE Texture *ShaderInput:: 00412 get_texture() const { 00413 return _stored_texture; 00414 } 00415 00416 //////////////////////////////////////////////////////////////////// 00417 // Function: ShaderInput::get_ptr 00418 // Access: Published 00419 // Description: 00420 //////////////////////////////////////////////////////////////////// 00421 INLINE const Shader::ShaderPtrData &ShaderInput:: 00422 get_ptr() const { 00423 return _stored_ptr; 00424 } 00425 00426 //////////////////////////////////////////////////////////////////// 00427 // Function: ShaderInput::get_nodepath 00428 // Access: Published 00429 // Description: 00430 //////////////////////////////////////////////////////////////////// 00431 INLINE const NodePath &ShaderInput:: 00432 get_nodepath() const { 00433 return _stored_nodepath; 00434 } 00435 00436 //////////////////////////////////////////////////////////////////// 00437 // Function: ShaderInput::get_vector 00438 // Access: Published 00439 // Description: 00440 //////////////////////////////////////////////////////////////////// 00441 INLINE const LVecBase4 &ShaderInput:: 00442 get_vector() const { 00443 return _stored_vector; 00444 } 00445