Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/gobj/texture.I

Go to the documentation of this file.
00001 // Filename: texture.I
00002 // Created by:  drose (05Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: Texture::get_wrapu
00022 //       Access: Published
00023 //  Description:
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE Texture::WrapMode Texture::
00026 get_wrapu() const {
00027   return _wrapu;
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: Texture::get_wrapv
00032 //       Access: Published
00033 //  Description:
00034 ////////////////////////////////////////////////////////////////////
00035 INLINE Texture::WrapMode Texture::
00036 get_wrapv() const {
00037   return _wrapv;
00038 }
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: Texture::get_minfilter
00042 //       Access: Published
00043 //  Description:
00044 ////////////////////////////////////////////////////////////////////
00045 INLINE Texture::FilterType Texture::
00046 get_minfilter() const {
00047   return _minfilter;
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: Texture::get_magfilter
00052 //       Access: Published
00053 //  Description:
00054 ////////////////////////////////////////////////////////////////////
00055 INLINE Texture::FilterType Texture::
00056 get_magfilter() const {
00057   return _magfilter;
00058 }
00059 
00060 ////////////////////////////////////////////////////////////////////
00061 //     Function: Texture::get_anisotropic_degree
00062 //       Access: Published
00063 //  Description: Returns the degree of anisotropic filtering that
00064 //               should be applied to the texture.  Normally, this is
00065 //               1, to indicate that anisotropic filtering should be
00066 //               disabled.  If this is a number higher than 1,
00067 //               anisotropic filtering should be enabled (if the
00068 //               rendering backend supports it).
00069 ////////////////////////////////////////////////////////////////////
00070 INLINE int Texture::
00071 get_anisotropic_degree() const {
00072   return _anisotropic_degree;
00073 }
00074 
00075 ////////////////////////////////////////////////////////////////////
00076 //     Function: Texture::uses_mipmaps
00077 //       Access: Public
00078 //  Description: Returns true if the minfilter settings on this
00079 //               texture require the use of mipmapping, false
00080 //               otherwise.
00081 ////////////////////////////////////////////////////////////////////
00082 INLINE bool Texture::
00083 uses_mipmaps() const {
00084   return is_mipmap(get_minfilter());
00085 }
00086 
00087 ////////////////////////////////////////////////////////////////////
00088 //     Function: Texture::has_ram_image
00089 //       Access: Public
00090 //  Description: Returns true if the Texture has its image contents
00091 //               available in main RAM, false if it exists only in
00092 //               texture memory or in the prepared GSG context.
00093 
00094 //               Note that this has nothing to do with whether
00095 //               get_ram_image() will fail or not.  Even if
00096 //               has_ram_image() returns false, get_ram_image() may
00097 //               still return a valid RAM image, because
00098 //               get_ram_image() will automatically load the texture
00099 //               from disk if necessary.  The only thing
00100 //               has_ram_image() tells you is whether the texture is
00101 //               available right now without hitting the disk first.
00102 //
00103 //               Note also that if an application uses only one GSG,
00104 //               it may appear that has_ram_image() returns true if
00105 //               the texture has not yet been loaded by the GSG, but
00106 //               this correlation is not true in general and should
00107 //               not be depended on.  Specifically, if an application
00108 //               ever uses multiple GSG's in its lifetime (for
00109 //               instance, by opening more than one window, or by
00110 //               closing its window and opening another one later),
00111 //               then has_ram_image() may well return false on
00112 //               textures that have never been loaded on the current
00113 //               GSG.
00114 ////////////////////////////////////////////////////////////////////
00115 INLINE bool Texture::
00116 has_ram_image() const {
00117   return !_pbuffer->_image.empty();
00118 }
00119 
00120 ////////////////////////////////////////////////////////////////////
00121 //     Function: Texture::set_keep_ram_image
00122 //       Access: Public
00123 //  Description: Sets the flag that indicates whether this Texture is
00124 //               eligible to have its main RAM copy of the texture
00125 //               memory dumped when the texture is prepared for
00126 //               rendering.
00127 //
00128 //               This will be true for most textures, which can reload
00129 //               their images if needed by rereading the input file.
00130 //               However, textures that were generated dynamically and
00131 //               cannot be easily reloaded will want to set this flag
00132 //               to true, so that the _pbuffer member will always keep
00133 //               its image copy around.
00134 ////////////////////////////////////////////////////////////////////
00135 INLINE void Texture::
00136 set_keep_ram_image(bool keep_ram_image) {
00137   _keep_ram_image = keep_ram_image;
00138 }
00139 
00140 ////////////////////////////////////////////////////////////////////
00141 //     Function: Texture::get_keep_ram_image
00142 //       Access: Public
00143 //  Description: Returns the flag that indicates whether this Texture
00144 //               is eligible to have its main RAM copy of the texture
00145 //               memory dumped when the texture is prepared for
00146 //               rendering.  See set_keep_ram_image().
00147 ////////////////////////////////////////////////////////////////////
00148 INLINE bool Texture::
00149 get_keep_ram_image() const {
00150   return _keep_ram_image;
00151 }
00152 
00153 ////////////////////////////////////////////////////////////////////
00154 //     Function: Texture::apply
00155 //       Access: Public
00156 //  Description:
00157 ////////////////////////////////////////////////////////////////////
00158 INLINE void Texture::
00159 apply(GraphicsStateGuardianBase *gsg) {
00160   gsg->apply_texture(prepare(gsg));
00161 }
00162 
00163 

Generated on Fri May 2 00:39:44 2003 for Panda by doxygen1.3