Panda3D
|
00001 // Filename: geomVertexColumn.I 00002 // Created by: drose (06Mar05) 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: GeomVertexColumn::Default Constructor 00018 // Access: Private 00019 // Description: Creates an invalid column. Used on when constructing 00020 // from a bam file. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE GeomVertexColumn:: 00023 GeomVertexColumn() : 00024 _packer(NULL) 00025 { 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: GeomVertexColumn::Constructor 00030 // Access: Published 00031 // Description: 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE GeomVertexColumn:: 00034 GeomVertexColumn(InternalName *name, int num_components, 00035 NumericType numeric_type, Contents contents, 00036 int start, int column_alignment) : 00037 _name(name), 00038 _num_components(num_components), 00039 _numeric_type(numeric_type), 00040 _contents(contents), 00041 _start(start), 00042 _column_alignment(column_alignment), 00043 _packer(NULL) 00044 { 00045 setup(); 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: GeomVertexColumn::Copy Constructor 00050 // Access: Published 00051 // Description: 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE GeomVertexColumn:: 00054 GeomVertexColumn(const GeomVertexColumn ©) : 00055 _name(copy._name), 00056 _num_components(copy._num_components), 00057 _numeric_type(copy._numeric_type), 00058 _contents(copy._contents), 00059 _start(copy._start), 00060 _column_alignment(copy._column_alignment), 00061 _packer(NULL) 00062 { 00063 setup(); 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: GeomVertexColumn::Destructor 00068 // Access: Published 00069 // Description: 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE GeomVertexColumn:: 00072 ~GeomVertexColumn() { 00073 delete _packer; 00074 } 00075 00076 //////////////////////////////////////////////////////////////////// 00077 // Function: GeomVertexColumn::get_name 00078 // Access: Published 00079 // Description: Returns the name of this particular data field, 00080 // e.g. "vertex" or "normal". The name may be a 00081 // user-defined string, or it may be one of the standard 00082 // system-defined field types. Only the system-defined 00083 // field types are used for the actual rendering. 00084 //////////////////////////////////////////////////////////////////// 00085 INLINE InternalName *GeomVertexColumn:: 00086 get_name() const { 00087 return _name; 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: GeomVertexColumn::get_num_components 00092 // Access: Published 00093 // Description: Returns the number of components of the column: 00094 // the number of instances of the NumericType in each 00095 // element. This is usually, but not always, the same 00096 // thing as get_num_values(). 00097 //////////////////////////////////////////////////////////////////// 00098 INLINE int GeomVertexColumn:: 00099 get_num_components() const { 00100 return _num_components; 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: GeomVertexColumn::get_num_values 00105 // Access: Published 00106 // Description: Returns the number of numeric values of the column: 00107 // the number of distinct numeric values that go into 00108 // each element. This is usually, but not always, the 00109 // same thing as get_num_components(); the difference is 00110 // in the case of a composite numeric type like 00111 // NT_packed_dcba, which has four numeric values per 00112 // component. 00113 //////////////////////////////////////////////////////////////////// 00114 INLINE int GeomVertexColumn:: 00115 get_num_values() const { 00116 return _num_values; 00117 } 00118 00119 //////////////////////////////////////////////////////////////////// 00120 // Function: GeomVertexColumn::get_numeric_type 00121 // Access: Published 00122 // Description: Returns the token representing the numeric type of 00123 // the data storage. 00124 //////////////////////////////////////////////////////////////////// 00125 INLINE GeomVertexColumn::NumericType GeomVertexColumn:: 00126 get_numeric_type() const { 00127 return _numeric_type; 00128 } 00129 00130 //////////////////////////////////////////////////////////////////// 00131 // Function: GeomVertexColumn::get_contents 00132 // Access: Published 00133 // Description: Returns the token representing the semantic meaning of 00134 // the stored value. 00135 //////////////////////////////////////////////////////////////////// 00136 INLINE GeomVertexColumn::Contents GeomVertexColumn:: 00137 get_contents() const { 00138 return _contents; 00139 } 00140 00141 //////////////////////////////////////////////////////////////////// 00142 // Function: GeomVertexColumn::get_start 00143 // Access: Published 00144 // Description: Returns the byte within the array record at which 00145 // this column starts. This can be set to non-zero 00146 // to implement interleaved arrays. 00147 //////////////////////////////////////////////////////////////////// 00148 INLINE int GeomVertexColumn:: 00149 get_start() const { 00150 return _start; 00151 } 00152 00153 //////////////////////////////////////////////////////////////////// 00154 // Function: GeomVertexColumn::get_column_alignment 00155 // Access: Published 00156 // Description: Returns the alignment requirements for this column. 00157 // If this is greater than 1, it restricts the column to 00158 // appear only on memory addresses that are integer 00159 // multiples of this value; this has implications for 00160 // this column's start value, as well as the stride of 00161 // the resulting array. 00162 //////////////////////////////////////////////////////////////////// 00163 INLINE int GeomVertexColumn:: 00164 get_column_alignment() const { 00165 return _column_alignment; 00166 } 00167 00168 //////////////////////////////////////////////////////////////////// 00169 // Function: GeomVertexColumn::get_component_bytes 00170 // Access: Published 00171 // Description: Returns the number of bytes used by each component 00172 // (that is, by one element of the numeric type). 00173 //////////////////////////////////////////////////////////////////// 00174 INLINE int GeomVertexColumn:: 00175 get_component_bytes() const { 00176 return _component_bytes; 00177 } 00178 00179 //////////////////////////////////////////////////////////////////// 00180 // Function: GeomVertexColumn::get_total_bytes 00181 // Access: Published 00182 // Description: Returns the number of bytes used by each element of 00183 // the column: component_bytes * num_components. 00184 //////////////////////////////////////////////////////////////////// 00185 INLINE int GeomVertexColumn:: 00186 get_total_bytes() const { 00187 return _total_bytes; 00188 } 00189 00190 //////////////////////////////////////////////////////////////////// 00191 // Function: GeomVertexColumn::has_homogeneous_coord 00192 // Access: Published 00193 // Description: Returns true if this Contents type is one that 00194 // includes a homogeneous coordinate in the fourth 00195 // component, or false otherwise. If this is true, 00196 // correct operation on the vertex data may require 00197 // scaling by the homogeneous coordinate from time to 00198 // time (but in general this is handled automatically if 00199 // you use the 3-component or smaller forms of 00200 // get_data() and set_data()). 00201 //////////////////////////////////////////////////////////////////// 00202 INLINE bool GeomVertexColumn:: 00203 has_homogeneous_coord() const { 00204 switch (_contents) { 00205 case C_point: 00206 case C_texcoord: 00207 return true; 00208 00209 default: 00210 return false; 00211 } 00212 } 00213 00214 //////////////////////////////////////////////////////////////////// 00215 // Function: GeomVertexColumn::overlaps_with 00216 // Access: Published 00217 // Description: Returns true if this column overlaps with any of 00218 // the bytes in the indicated range, false if it does 00219 // not. 00220 //////////////////////////////////////////////////////////////////// 00221 INLINE bool GeomVertexColumn:: 00222 overlaps_with(int start_byte, int num_bytes) const { 00223 return (_start < start_byte + num_bytes && 00224 _start + _total_bytes > start_byte); 00225 } 00226 00227 //////////////////////////////////////////////////////////////////// 00228 // Function: GeomVertexColumn::is_bytewise_equivalent 00229 // Access: Published 00230 // Description: Returns true if the data store of this column is 00231 // exactly the same as that of the other, irrespective 00232 // of name or start position within the record. 00233 //////////////////////////////////////////////////////////////////// 00234 INLINE bool GeomVertexColumn:: 00235 is_bytewise_equivalent(const GeomVertexColumn &other) const { 00236 // Not sure if the contents are relevant, but let's say that they 00237 // are. 00238 return (_num_components == other._num_components && 00239 _numeric_type == other._numeric_type && 00240 _contents == other._contents); 00241 } 00242 00243 //////////////////////////////////////////////////////////////////// 00244 // Function: GeomVertexColumn::is_packed_argb 00245 // Access: Public 00246 // Description: Returns true if this column is the standard 00247 // DirectX representation of 4-component color: C_color, 00248 // in NT_packed_dabc, with 1 component (4 values). 00249 //////////////////////////////////////////////////////////////////// 00250 INLINE bool GeomVertexColumn:: 00251 is_packed_argb() const { 00252 return (_num_components == 1 && 00253 _numeric_type == NT_packed_dabc && 00254 _contents == C_color); 00255 } 00256 00257 //////////////////////////////////////////////////////////////////// 00258 // Function: GeomVertexColumn::is_uint8_rgba 00259 // Access: Public 00260 // Description: Returns true if this column is the standard 00261 // OpenGL representation of 4-component color: C_color, 00262 // in NT_uint8, with 4 components. 00263 //////////////////////////////////////////////////////////////////// 00264 INLINE bool GeomVertexColumn:: 00265 is_uint8_rgba() const { 00266 return (_num_components == 4 && 00267 _numeric_type == NT_uint8 && 00268 _contents == C_color); 00269 } 00270 00271 //////////////////////////////////////////////////////////////////// 00272 // Function: GeomVertexColumn::compare_to 00273 // Access: Public 00274 // Description: This is used to unquify columns, and hence 00275 // formats, for the GeomVertexFormat registry. 00276 //////////////////////////////////////////////////////////////////// 00277 INLINE int GeomVertexColumn:: 00278 compare_to(const GeomVertexColumn &other) const { 00279 if (_name != other._name) { 00280 return _name < other._name ? -1 : 1; 00281 } 00282 if (_num_components != other._num_components) { 00283 return _num_components - other._num_components; 00284 } 00285 if (_numeric_type != other._numeric_type) { 00286 return (int)_numeric_type - (int)other._numeric_type; 00287 } 00288 if (_contents != other._contents) { 00289 return (int)_contents - (int)other._contents; 00290 } 00291 if (_start != other._start) { 00292 return _start - other._start; 00293 } 00294 if (_column_alignment != other._column_alignment) { 00295 return _column_alignment - other._column_alignment; 00296 } 00297 return 0; 00298 } 00299 00300 //////////////////////////////////////////////////////////////////// 00301 // Function: GeomVertexColumn::operator == 00302 // Access: Public 00303 // Description: Returns true if the two columns are exactly 00304 // equivalent, false otherwise. 00305 //////////////////////////////////////////////////////////////////// 00306 INLINE bool GeomVertexColumn:: 00307 operator == (const GeomVertexColumn &other) const { 00308 return compare_to(other) == 0; 00309 } 00310 00311 //////////////////////////////////////////////////////////////////// 00312 // Function: GeomVertexColumn::operator != 00313 // Access: Public 00314 // Description: 00315 //////////////////////////////////////////////////////////////////// 00316 INLINE bool GeomVertexColumn:: 00317 operator != (const GeomVertexColumn &other) const { 00318 return compare_to(other) != 0; 00319 } 00320 00321 //////////////////////////////////////////////////////////////////// 00322 // Function: GeomVertexColumn::operator < 00323 // Access: Public 00324 // Description: This is used to put columns in order within a 00325 // particular GeomVertexArrayFormat. Note that it is 00326 // *not* in the same space as operator == and operator 00327 // !=. 00328 //////////////////////////////////////////////////////////////////// 00329 INLINE bool GeomVertexColumn:: 00330 operator < (const GeomVertexColumn &other) const { 00331 if (_start != other._start) { 00332 return _start < other._start; 00333 } 00334 if (_total_bytes < other._total_bytes) { 00335 return _total_bytes < other._total_bytes; 00336 } 00337 return 0; 00338 } 00339 00340 INLINE ostream & 00341 operator << (ostream &out, const GeomVertexColumn &obj) { 00342 obj.output(out); 00343 return out; 00344 } 00345 00346 //////////////////////////////////////////////////////////////////// 00347 // Function: GeomVertexColumn::Packer::maybe_scale_color_f 00348 // Access: Public 00349 // Description: Converts an integer (typically a uint8) value to a 00350 // floating-point value. If the contents value 00351 // indicates this is a color value, scales it into the 00352 // range 0..1 per convention; otherwise leaves it alone. 00353 //////////////////////////////////////////////////////////////////// 00354 INLINE float GeomVertexColumn::Packer:: 00355 maybe_scale_color_f(unsigned int value) { 00356 if (_column->get_contents() == C_color) { 00357 return (float)value / 255.0f; 00358 } else { 00359 return (float)value; 00360 } 00361 } 00362 00363 //////////////////////////////////////////////////////////////////// 00364 // Function: GeomVertexColumn::Packer::maybe_scale_color_f 00365 // Access: Public 00366 // Description: Converts a pair of integers into the _v2 member. See 00367 // one-parameter maybe_scale_color_f() for more info. 00368 //////////////////////////////////////////////////////////////////// 00369 INLINE void GeomVertexColumn::Packer:: 00370 maybe_scale_color_f(unsigned int a, unsigned int b) { 00371 if (_column->get_contents() == C_color) { 00372 _v2.set((float)a / 255.0f, 00373 (float)b / 255.0f); 00374 } else { 00375 _v2.set((float)a, (float)b); 00376 } 00377 } 00378 00379 //////////////////////////////////////////////////////////////////// 00380 // Function: GeomVertexColumn::Packer::maybe_scale_color_f 00381 // Access: Public 00382 // Description: Converts a pair of integers into the _v3 member. See 00383 // one-parameter maybe_scale_color_f() for more info. 00384 //////////////////////////////////////////////////////////////////// 00385 INLINE void GeomVertexColumn::Packer:: 00386 maybe_scale_color_f(unsigned int a, unsigned int b, unsigned int c) { 00387 if (_column->get_contents() == C_color) { 00388 _v3.set((float)a / 255.0f, 00389 (float)b / 255.0f, 00390 (float)c / 255.0f); 00391 } else { 00392 _v3.set((float)a, (float)b, (float)c); 00393 } 00394 } 00395 00396 //////////////////////////////////////////////////////////////////// 00397 // Function: GeomVertexColumn::Packer::maybe_scale_color_f 00398 // Access: Public 00399 // Description: Converts a pair of integers into the _v4 member. See 00400 // one-parameter maybe_scale_color_f() for more info. 00401 //////////////////////////////////////////////////////////////////// 00402 INLINE void GeomVertexColumn::Packer:: 00403 maybe_scale_color_f(unsigned int a, unsigned int b, unsigned int c, 00404 unsigned int d) { 00405 if (_column->get_contents() == C_color) { 00406 _v4.set((float)a / 255.0f, 00407 (float)b / 255.0f, 00408 (float)c / 255.0f, 00409 (float)d / 255.0f); 00410 } else { 00411 _v4.set((float)a, (float)b, (float)c, (float)d); 00412 } 00413 } 00414 00415 00416 //////////////////////////////////////////////////////////////////// 00417 // Function: GeomVertexColumn::Packer::maybe_unscale_color_f 00418 // Access: Public 00419 // Description: Converts a floating-point value to a uint8 value. If 00420 // the contents value indicates this is a color value, 00421 // scales it into the range 0..255 per convention; 00422 // otherwise leaves it alone. 00423 //////////////////////////////////////////////////////////////////// 00424 INLINE unsigned int GeomVertexColumn::Packer:: 00425 maybe_unscale_color_f(float data) { 00426 if (_column->get_contents() == C_color) { 00427 return (unsigned int)(data * 255.0f); 00428 } else { 00429 return (unsigned int)data; 00430 } 00431 } 00432 00433 //////////////////////////////////////////////////////////////////// 00434 // Function: GeomVertexColumn::Packer::maybe_unscale_color_f 00435 // Access: Public 00436 // Description: Converts an LVecBase2f into a pair of uint8 00437 // values. See one-parameter maybe_unscale_color_f() for 00438 // more info. 00439 //////////////////////////////////////////////////////////////////// 00440 INLINE void GeomVertexColumn::Packer:: 00441 maybe_unscale_color_f(const LVecBase2f &data) { 00442 if (_column->get_contents() == C_color) { 00443 _a = (unsigned int)(data[0] * 255.0f); 00444 _b = (unsigned int)(data[1] * 255.0f); 00445 } else { 00446 _a = (unsigned int)data[0]; 00447 _b = (unsigned int)data[1]; 00448 } 00449 } 00450 00451 //////////////////////////////////////////////////////////////////// 00452 // Function: GeomVertexColumn::Packer::maybe_unscale_color_f 00453 // Access: Public 00454 // Description: Converts an LVecBase3f into a pair of uint8 00455 // values. See one-parameter maybe_unscale_color_f() for 00456 // more info. 00457 //////////////////////////////////////////////////////////////////// 00458 INLINE void GeomVertexColumn::Packer:: 00459 maybe_unscale_color_f(const LVecBase3f &data) { 00460 if (_column->get_contents() == C_color) { 00461 _a = (unsigned int)(data[0] * 255.0f); 00462 _b = (unsigned int)(data[1] * 255.0f); 00463 _c = (unsigned int)(data[2] * 255.0f); 00464 } else { 00465 _a = (unsigned int)data[0]; 00466 _b = (unsigned int)data[1]; 00467 _c = (unsigned int)data[2]; 00468 } 00469 } 00470 00471 //////////////////////////////////////////////////////////////////// 00472 // Function: GeomVertexColumn::Packer::maybe_unscale_color_f 00473 // Access: Public 00474 // Description: Converts an LVecBase4f into a pair of uint8 00475 // values. See one-parameter maybe_unscale_color_f() for 00476 // more info. 00477 //////////////////////////////////////////////////////////////////// 00478 INLINE void GeomVertexColumn::Packer:: 00479 maybe_unscale_color_f(const LVecBase4f &data) { 00480 if (_column->get_contents() == C_color) { 00481 _a = (unsigned int)(data[0] * 255.0f); 00482 _b = (unsigned int)(data[1] * 255.0f); 00483 _c = (unsigned int)(data[2] * 255.0f); 00484 _d = (unsigned int)(data[3] * 255.0f); 00485 } else { 00486 _a = (unsigned int)data[0]; 00487 _b = (unsigned int)data[1]; 00488 _c = (unsigned int)data[2]; 00489 _d = (unsigned int)data[3]; 00490 } 00491 } 00492 00493 //////////////////////////////////////////////////////////////////// 00494 // Function: GeomVertexColumn::Packer::maybe_scale_color_d 00495 // Access: Public 00496 // Description: Converts an integer (typically a uint8) value to a 00497 // floating-point value. If the contents value 00498 // indicates this is a color value, scales it into the 00499 // range 0..1 per convention; otherwise leaves it alone. 00500 //////////////////////////////////////////////////////////////////// 00501 INLINE double GeomVertexColumn::Packer:: 00502 maybe_scale_color_d(unsigned int value) { 00503 if (_column->get_contents() == C_color) { 00504 return (double)value / 255.0; 00505 } else { 00506 return (double)value; 00507 } 00508 } 00509 00510 //////////////////////////////////////////////////////////////////// 00511 // Function: GeomVertexColumn::Packer::maybe_scale_color_d 00512 // Access: Public 00513 // Description: Converts a pair of integers into the _v2d member. See 00514 // one-parameter maybe_scale_color_d() for more info. 00515 //////////////////////////////////////////////////////////////////// 00516 INLINE void GeomVertexColumn::Packer:: 00517 maybe_scale_color_d(unsigned int a, unsigned int b) { 00518 if (_column->get_contents() == C_color) { 00519 _v2d.set((double)a / 255.0, 00520 (double)b / 255.0); 00521 } else { 00522 _v2d.set((double)a, (double)b); 00523 } 00524 } 00525 00526 //////////////////////////////////////////////////////////////////// 00527 // Function: GeomVertexColumn::Packer::maybe_scale_color_d 00528 // Access: Public 00529 // Description: Converts a pair of integers into the _v3d member. See 00530 // one-parameter maybe_scale_color_d() for more info. 00531 //////////////////////////////////////////////////////////////////// 00532 INLINE void GeomVertexColumn::Packer:: 00533 maybe_scale_color_d(unsigned int a, unsigned int b, unsigned int c) { 00534 if (_column->get_contents() == C_color) { 00535 _v3d.set((double)a / 255.0, 00536 (double)b / 255.0, 00537 (double)c / 255.0); 00538 } else { 00539 _v3d.set((double)a, (double)b, (double)c); 00540 } 00541 } 00542 00543 //////////////////////////////////////////////////////////////////// 00544 // Function: GeomVertexColumn::Packer::maybe_scale_color_d 00545 // Access: Public 00546 // Description: Converts a pair of integers into the _v4d member. See 00547 // one-parameter maybe_scale_color_d() for more info. 00548 //////////////////////////////////////////////////////////////////// 00549 INLINE void GeomVertexColumn::Packer:: 00550 maybe_scale_color_d(unsigned int a, unsigned int b, unsigned int c, 00551 unsigned int d) { 00552 if (_column->get_contents() == C_color) { 00553 _v4d.set((double)a / 255.0, 00554 (double)b / 255.0, 00555 (double)c / 255.0, 00556 (double)d / 255.0); 00557 } else { 00558 _v4d.set((double)a, (double)b, (double)c, (double)d); 00559 } 00560 } 00561 00562 00563 //////////////////////////////////////////////////////////////////// 00564 // Function: GeomVertexColumn::Packer::maybe_unscale_color_d 00565 // Access: Public 00566 // Description: Converts a floating-point value to a uint8 value. If 00567 // the contents value indicates this is a color value, 00568 // scales it into the range 0..255 per convention; 00569 // otherwise leaves it alone. 00570 //////////////////////////////////////////////////////////////////// 00571 INLINE unsigned int GeomVertexColumn::Packer:: 00572 maybe_unscale_color_d(double data) { 00573 if (_column->get_contents() == C_color) { 00574 return (unsigned int)(data * 255.0); 00575 } else { 00576 return (unsigned int)data; 00577 } 00578 } 00579 00580 //////////////////////////////////////////////////////////////////// 00581 // Function: GeomVertexColumn::Packer::maybe_unscale_color_d 00582 // Access: Public 00583 // Description: Converts an LVecBase2d into a pair of uint8 00584 // values. See one-parameter maybe_unscale_color_d() for 00585 // more info. 00586 //////////////////////////////////////////////////////////////////// 00587 INLINE void GeomVertexColumn::Packer:: 00588 maybe_unscale_color_d(const LVecBase2d &data) { 00589 if (_column->get_contents() == C_color) { 00590 _a = (unsigned int)(data[0] * 255.0); 00591 _b = (unsigned int)(data[1] * 255.0); 00592 } else { 00593 _a = (unsigned int)data[0]; 00594 _b = (unsigned int)data[1]; 00595 } 00596 } 00597 00598 //////////////////////////////////////////////////////////////////// 00599 // Function: GeomVertexColumn::Packer::maybe_unscale_color_d 00600 // Access: Public 00601 // Description: Converts an LVecBase3d into a pair of uint8 00602 // values. See one-parameter maybe_unscale_color_d() for 00603 // more info. 00604 //////////////////////////////////////////////////////////////////// 00605 INLINE void GeomVertexColumn::Packer:: 00606 maybe_unscale_color_d(const LVecBase3d &data) { 00607 if (_column->get_contents() == C_color) { 00608 _a = (unsigned int)(data[0] * 255.0); 00609 _b = (unsigned int)(data[1] * 255.0); 00610 _c = (unsigned int)(data[2] * 255.0); 00611 } else { 00612 _a = (unsigned int)data[0]; 00613 _b = (unsigned int)data[1]; 00614 _c = (unsigned int)data[2]; 00615 } 00616 } 00617 00618 //////////////////////////////////////////////////////////////////// 00619 // Function: GeomVertexColumn::Packer::maybe_unscale_color_d 00620 // Access: Public 00621 // Description: Converts an LVecBase4d into a pair of uint8 00622 // values. See one-parameter maybe_unscale_color_d() for 00623 // more info. 00624 //////////////////////////////////////////////////////////////////// 00625 INLINE void GeomVertexColumn::Packer:: 00626 maybe_unscale_color_d(const LVecBase4d &data) { 00627 if (_column->get_contents() == C_color) { 00628 _a = (unsigned int)(data[0] * 255.0); 00629 _b = (unsigned int)(data[1] * 255.0); 00630 _c = (unsigned int)(data[2] * 255.0); 00631 _d = (unsigned int)(data[3] * 255.0); 00632 } else { 00633 _a = (unsigned int)data[0]; 00634 _b = (unsigned int)data[1]; 00635 _c = (unsigned int)data[2]; 00636 _d = (unsigned int)data[3]; 00637 } 00638 }