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

panda/src/shader/shaderTransition.I

Go to the documentation of this file.
00001 // Filename: shaderTransition.I
00002 // Created by:  drose (24Mar00)
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 #include <algorithm>
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: ShaderTransition::Constructor
00023 //       Access: Public
00024 //  Description:
00025 ////////////////////////////////////////////////////////////////////
00026 INLINE ShaderTransition::
00027 ShaderTransition() {
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: set_shader
00032 //  Description: An external function, handy for setting shaders
00033 //               directly onto arcs.  This will add the indicated
00034 //               shader to an existing ShaderTransition, or create a
00035 //               new ShaderTransition if necessary.
00036 ////////////////////////////////////////////////////////////////////
00037 INLINE bool
00038 set_shader(NodeRelation *arc, Shader *shader) {
00039   ShaderTransition *st;
00040   if (get_transition_into(st, arc)) {
00041     return st->set_shader(shader);
00042   }
00043   st = new ShaderTransition;
00044   st->set_shader(shader);
00045   arc->set_transition(st);
00046   return true;
00047 }
00048 
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: clear_shader
00052 //  Description: An external function, handy for setting shaders
00053 //               directly onto arcs.  This will remove the indicated
00054 //               shader from the existing ShaderTransition, if there
00055 //               is one.
00056 ////////////////////////////////////////////////////////////////////
00057 INLINE bool
00058 clear_shader(NodeRelation *arc, Shader *shader) {
00059   ShaderTransition *st;
00060   if (get_transition_into(st, arc)) {
00061     return st->clear_shader(shader);
00062   }
00063   return false;
00064 }
00065 
00066 ////////////////////////////////////////////////////////////////////
00067 //     Function: has_shader
00068 //  Description: An external function, handy for setting shaders
00069 //               directly onto arcs.  This returns true if there
00070 //               exists a ShaderTransition and it contains the
00071 //               indicated shader, false otherwise.
00072 ////////////////////////////////////////////////////////////////////
00073 INLINE bool
00074 has_shader(const NodeRelation *arc, Shader *shader) {
00075   const ShaderTransition *st;
00076   if (get_transition_into(st, arc)) {
00077     return st->has_shader(shader);
00078   }
00079   return false;
00080 }

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