# SpatialFear.SFAnimatedTextureHelper

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 |
    //=============================================================================
    // Spatial Fear
    // Class: SFAnimatedTextureHelper
    // Description: Adds some support for texture animation to the normal
    //				procedural texture capabilities of a normal Texture.
    //
    // Author: Markus Nuebel
    //=============================================================================

    class SFAnimatedTextureHelper extends SFObject;

    var Texture	m_texSrc;
    var Texture m_texAnimNextSaved;

    // Sets the target texture to handle
    function setTarget(Texture texSrc)
    {
    	// Save reference
    	m_texSrc	= texSrc;
    }

    // Stop the animation by removing the AnimNext reference
    function stopAnimation()
    {
    	// Do not overwrite saved reference
    	if(None == m_texAnimNextSaved)
    	{
    		m_texAnimNextSaved	= m_texSrc.AnimNext;
    		m_texSrc.AnimNext	= None;
    		m_texSrc.MaxFrameRate	= 0;
    		m_texSrc.MinFrameRate	= 0;
    	}
    	m_texSrc.AnimCurrent = m_texSrc;
    }

    // Start the animation again
    function startAnimation(optional float fNewFrameRate)
    {
    	if( 0.0f != fNewFrameRate)
    	{
    		m_texSrc.MaxFrameRate	= fNewFrameRate;
    		m_texSrc.MinFrameRate	= 0;
    	}
    	if(None != m_texAnimNextSaved)
    	{
    		m_texSrc.AnimNext	= m_texAnimNextSaved;
    		m_texAnimNextSaved	= None;
    	}
    }

    // Cleanup stuff
    function terminate()
    {
    	// Release references
    	m_texSrc			= None;
    	m_texAnimNextSaved	= None;

    }

    defaultproperties
    {
    }

class file time: 12/7/2003 3:58:24 PM - creation time: 12/7/2003 4:03:44 PM
Created with UnCodeX