Empty Engine Code/TtState.c

/******************************************************************************
 **                                                                          **
 **     Module:     TtState.c                                                **
 **                                                                          **
 **     Purpose:    Empty rasterizer drawing engine.                         **
 **                 Methods for state variable maintenance.                  **
 **                                                                          **
 **     Author:     Mike W. Kelley                                           **
 **                                                                          **
 **                 2/3/95  Revised for 0.9 SDK release                      **
 **                                                                          **
 **     Copyright (C) 1994-95 Apple Computer, Inc.  All rights reserved.     **
 **     Apple Computer Confidential                                          **
 **                                                                          **
 *****************************************************************************/
 
#include "RAVE.h"
#include "RAVE_system.h"
#include "TtTinselTown.h"
 
/************************************************************************************************
 *  TtSetFloat.
 ***********************************************************************************************/
 
void TtSetFloat (
    TQADrawContext      *drawContext,       /* Draw context */
    TQATagFloat         tag,                /* Tag of variable to set */
    float               newValue)           /* New value for variable */
{
    TTtDrawPrivate      *myPrivate;
 
    if (tag > kTtMaxTag)
    {
        /*
         * Tag value is out of range; no-op.
         */
        
        return;
    }
    myPrivate = (TTtDrawPrivate *) drawContext->drawPrivate;
    myPrivate->state [tag].f = newValue;
    
    /*
     * Note that this function received a TQADrawContext pointer which is _not_ const.
     * This means you can change the methods based on the set operation.
     */
}
 
/************************************************************************************************
 *  TtSetInt
 ***********************************************************************************************/
 
void TtSetInt (
    TQADrawContext      *drawContext,       /* Draw context */
    TQATagInt           tag,                /* Tag of variable to set */
    unsigned long       newValue)           /* New value for variable */
{
    TTtDrawPrivate      *myPrivate;
 
    myPrivate = (TTtDrawPrivate *) drawContext->drawPrivate;
    if (tag > kTtMaxTag)
    {
        /*
         * Tag value is out of range; no-op.
         */
        
        return;
    }
    myPrivate->state [tag].i = newValue;
    
    /*
     * Note that this function received a TQADrawContext pointer which is _not_ const.
     * This means you can change the methods based on the set operation (e.g., if
     * the texture op is changed)
     */
}
 
/************************************************************************************************
 *  TtSetPtr
 ***********************************************************************************************/
 
void TtSetPtr (
    TQADrawContext      *drawContext,       /* Draw context */
    TQATagPtr           tag,                /* Tag of variable to set */
    const void          *newValue)          /* New value for variable */
{
    TTtDrawPrivate      *myPrivate;
 
    myPrivate = (TTtDrawPrivate *) drawContext->drawPrivate;
    if (tag > kTtMaxTag)
    {
        /*
         * Tag value is out of range; no-op.
         */
        
        return;
    }
    myPrivate->state [tag].p = newValue;
    
    /*
     * Note that this function received a TQADrawContext pointer which is _not_ const.
     * This means you can change the methods based on the set operation (e.g., if
     * the texture op is changed)
     */
}
 
/************************************************************************************************
 *  TtGetFloat
 ***********************************************************************************************/
 
float TtGetFloat (
    const TQADrawContext    *drawContext,       /* Draw context */
    TQATagFloat             tag)                /* Tag of variable to get */
{
    TTtDrawPrivate      *myPrivate;
 
    if (tag > kTtMaxTag)
    {
        /*
         * Tag value is out of range; return 0.
         */
        
        return (0);
    }
    myPrivate = (TTtDrawPrivate *) drawContext->drawPrivate;
    return (myPrivate->state [tag].f);
}
 
/************************************************************************************************
 *  TtGetInt
 ***********************************************************************************************/
 
unsigned long TtGetInt (
    const TQADrawContext    *drawContext,       /* Draw context */
    TQATagInt               tag)                /* Tag of variable to get */
{
    TTtDrawPrivate      *myPrivate;
 
    if (tag > kTtMaxTag)
    {
        /*
         * Tag value is out of range; return 0.
         */
        
        return (0);
    }
    myPrivate = (TTtDrawPrivate *) drawContext->drawPrivate;
    return (myPrivate->state [tag].i);
}
 
/************************************************************************************************
 *  TtGetPtr
 ***********************************************************************************************/
 
void *TtGetPtr (
    const TQADrawContext    *drawContext,       /* Draw context */
    TQATagPtr               tag)                /* Tag of variable to get */
{
    TTtDrawPrivate      *myPrivate;
 
    if (tag > kTtMaxTag)
    {
        /*
         * Tag value is out of range; return 0.
         */
        
        return (0);
    }
    myPrivate = (TTtDrawPrivate *) drawContext->drawPrivate;
    return ((void *) myPrivate->state [tag].p);
}