00001 // Filename: fltGeometry.I00002 // Created by: drose (28Feb01)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: FltGeometry::has_texture00018 // Access: Public00019 // Description: Returns true if the face has a texture applied, false00020 // otherwise.00021 ////////////////////////////////////////////////////////////////////00022 INLINE boolFltGeometry::00023has_texture() const {
00024 return (_texture_index >= 0 && _header->has_texture(_texture_index));
00025 }
00026
00027 ////////////////////////////////////////////////////////////////////00028 // Function: FltGeometry::get_texture00029 // Access: Public00030 // Description: Returns the texture applied to this face, or NULL if00031 // no texture was applied.00032 ////////////////////////////////////////////////////////////////////00033 INLINE FltTexture *FltGeometry::00034get_texture() const {
00035 return _header->get_texture(_texture_index);
00036 }
00037
00038 ////////////////////////////////////////////////////////////////////00039 // Function: FltGeometry::set_texture00040 // Access: Public00041 // Description: Applies the indicated texture to this face, or if the00042 // texture is NULL, clears it.00043 ////////////////////////////////////////////////////////////////////00044 INLINE voidFltGeometry::00045set_texture(FltTexture *texture) {
00046 if (texture == (FltTexture *)NULL) {
00047 _texture_index = -1;
00048 } else {
00049 _header->add_texture(texture);
00050 _texture_index = texture->_pattern_index;
00051 }
00052 }
00053
00054 ////////////////////////////////////////////////////////////////////00055 // Function: FltGeometry::has_material00056 // Access: Public00057 // Description: Returns true if the face has a material applied, false00058 // otherwise.00059 ////////////////////////////////////////////////////////////////////00060 INLINE boolFltGeometry::00061has_material() const {
00062 return (_material_index >= 0 && _header->has_material(_material_index));
00063 }
00064
00065 ////////////////////////////////////////////////////////////////////00066 // Function: FltGeometry::get_material00067 // Access: Public00068 // Description: Returns the material applied to this face, or NULL if00069 // no material was applied.00070 ////////////////////////////////////////////////////////////////////00071 INLINE FltMaterial *FltGeometry::00072get_material() const {
00073 return _header->get_material(_material_index);
00074 }
00075
00076 ////////////////////////////////////////////////////////////////////00077 // Function: FltGeometry::set_material00078 // Access: Public00079 // Description: Applies the indicated material to this face, or if the00080 // material is NULL, clears it.00081 ////////////////////////////////////////////////////////////////////00082 INLINE voidFltGeometry::00083set_material(FltMaterial *material) {
00084 if (material == (FltMaterial *)NULL) {
00085 _material_index = -1;
00086 } else {
00087 _header->add_material(material);
00088 _material_index = material->_material_index;
00089 }
00090 }
00091
00092 ////////////////////////////////////////////////////////////////////00093 // Function: FltGeometry::has_color00094 // Access: Public00095 // Description: Returns true if the face has a primary color00096 // indicated, false otherwise.00097 ////////////////////////////////////////////////////////////////////00098 INLINE boolFltGeometry::00099has_color() const {
00100 // Even if the no_color bit is not set, if the color_index is -1,00101 // the face doesn't have a color (unless we've got packed color).00102 // On the other hand, if we have a material than we always have00103 // color.00104 return ((_flags & F_no_color) == 0 &&
00105 (_color_index != -1 || ((_flags & F_packed_color) != 0)))
00106 || has_material();
00107 }