Subversion Repositories AndroidProjects

Rev

Blame | Last modification | View Log | RSS feed

package com.gebauz.bauzoid.graphics.renderstates;

/** Base class for render states.
 * Derived classes need to have three sets of state fields:
 * - official value (what the user set)
 * - current actual value (when locked, this retrieves the actual value since setting the official value is ignored)
 * - default value
 * @author chiu
 *
 */

public abstract class RenderStatesObject
{
        protected RenderStates mRenderStates = null;
        protected boolean mLocked = false;

        /** Constructor. */
        public RenderStatesObject(RenderStates renderStates)
        {
                mRenderStates = renderStates;
        }
       
        /** Initialize the render state by setting its initial value. */
        public void initialize()
        {
                activate(true);
        }
       
        /** Activate a render state - calls as activate(false). */
        public void activate()
        {
                activate(false);               
        }
       
        /* Activate a render state with force parameter. */
        public abstract void activate(boolean force);
       
        /** Reset a render state to default values. */
        public abstract void reset();
       
        /** Deactivate render states by resetting its values. */
        public void deactivate()
        {
                reset();
                activate(false);               
        }
       
        /** Lock the render state, disallowing any changes. */
        public void lock(boolean lock)
        {
                mLocked = lock;        
        }
       
        /** Check if the render state is locked. */
        public boolean isLocked()
        {
                return mLocked;
        }
       
        /** Get the parent render states object. */
        public final RenderStates getRenderStates()
        {
                return mRenderStates;
        }


}