00001 // Filename: textureContext.I 00002 // Created by: drose (07Oct99) 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: TextureContext::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE TextureContext:: 00026 TextureContext(Texture *tex) : 00027 _texture(tex) 00028 { 00029 _dirty_flags = 0; 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: TextureContext::mark_dirty 00034 // Access: Public 00035 // Description: Marks the context "dirty", i.e. its properties are 00036 // different from the last time the GSG has seen them. 00037 // Presumably, the GSG will respond by updating the 00038 // properties and clearing the dirty bits the next time 00039 // it renders the texture. 00040 // 00041 // The value is the union of all the bits that are to be 00042 // set dirty; bits that are not set in this parameter 00043 // are left unchanged. See Texture::DirtyFlags for a 00044 // list of available bits. 00045 // 00046 // Usually this function is not called directly, but 00047 // rather is called by Texture::mark_dirty() as a result 00048 // of changing properties directly on the texture. 00049 //////////////////////////////////////////////////////////////////// 00050 INLINE void TextureContext:: 00051 mark_dirty(int flags_to_set) { 00052 _dirty_flags |= flags_to_set; 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function: TextureContext::clear_dirty_flags 00057 // Access: Public 00058 // Description: Removes the indicated flags from the "dirty" bits. 00059 // See mark_dirty(). 00060 // 00061 // The value is the union of all the bits that are to be 00062 // cleared; if a bit is set in the parameter, it will be 00063 // removed from the dirty set. Bits that are not set in 00064 // this parameter are left unchanged. 00065 // 00066 // This function is intended to be called by the GSG 00067 // after it has updated the texture parameters. 00068 //////////////////////////////////////////////////////////////////// 00069 INLINE void TextureContext:: 00070 clear_dirty_flags(int flags_to_clear) { 00071 _dirty_flags &= ~flags_to_clear; 00072 _texture->_all_dirty_flags &= ~flags_to_clear; 00073 } 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function: TextureContext::get_dirty_flags 00077 // Access: Public 00078 // Description: Returns the current state of the dirty flags. If 00079 // this is non-zero, it represents the union of all 00080 // properties that have been changed since the last call 00081 // to clear_dirty_flags(). 00082 // 00083 // This function is intended to be called by the GSG to 00084 // determine what properties need to be updated. See 00085 // Texture::DirtyFlags for a list of possible bits. 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE int TextureContext:: 00088 get_dirty_flags() const { 00089 return _dirty_flags; 00090 } 00091