shadefuncs.h

Go to the documentation of this file.
00001 /*                      S H A D E F U N C S . H
00002  * BRL-CAD
00003  *
00004  * Copyright (c) 1993-2006 United States Government as represented by
00005  * the U.S. Army Research Laboratory.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this file; see the file named COPYING for more
00019  * information.
00020  */
00021 /** @addtogroup rt */
00022 /*@{*/
00023 /** @file shadefuncs.h
00024  *
00025  *  @par Source
00026  *      The U. S. Army Research Laboratory
00027  *      Aberdeen Proving Ground, Maryland  21005-5068  USA
00028  *
00029  *  $Header: /cvsroot/brlcad/brlcad/include/shadefuncs.h,v 14.8 2006/09/18 05:24:07 lbutler Exp $
00030  */
00031 #ifndef SHADEFUNCS
00032 #define SHADEFUNCS
00033 
00034 #ifndef OPTICAL_EXPORT
00035 #   if defined(_WIN32) && !defined(__CYGWIN__) && defined(BRLCAD_DLL)
00036 #      ifdef OPTICAL_EXPORT_DLL
00037 #         define OPTICAL_EXPORT __declspec(dllexport)
00038 #      else
00039 #         define OPTICAL_EXPORT __declspec(dllimport)
00040 #      endif
00041 #   else
00042 #      define OPTICAL_EXPORT
00043 #   endif
00044 #endif
00045 
00046 /**
00047  *                      M F U N C S
00048  *
00049  *  The interface to the various material property & texture routines.
00050  */
00051 struct mfuncs {
00052         long            mf_magic;       /**< @brief  To validate structure */
00053         char            *mf_name;       /**< @brief  Keyword for material */
00054         struct mfuncs   *mf_forw;       /**< @brief  Forward link */
00055         int             mf_inputs;      /**< @brief  shadework inputs needed */
00056         int             mf_flags;       /**< @brief  Flags describing shader */
00057         int             (*mf_setup)();  /**< @brief  Routine for preparing */
00058         int             (*mf_render)(); /**< @brief  Routine for rendering */
00059         void            (*mf_print)();  /**< @brief  Routine for printing */
00060         void            (*mf_free)();   /**< @brief  Routine for releasing storage */
00061 };
00062 #define MF_MAGIC        0x55968058
00063 #define MF_NULL         ((struct mfuncs *)0)
00064 #define RT_CK_MF(_p)    BU_CKMAG(_p, MF_MAGIC, "mfuncs")
00065 
00066 /*
00067  *  mf_inputs lists what optional shadework fields are needed.
00068  *  dist, point, color, & default(trans,reflect,ri) are always provided
00069  */
00070 #define MFI_NORMAL      0x01            /**< @brief  Need normal */
00071 #define MFI_UV          0x02            /**< @brief  Need uv */
00072 #define MFI_LIGHT       0x04            /**< @brief  Need light visibility */
00073 #define MFI_HIT         0x08            /**< @brief  Need just hit point */
00074 
00075 /** for bu_printb() */
00076 #define MFI_FORMAT      "\020\4HIT\3LIGHT\2UV\1NORMAL"
00077 
00078 
00079 /* mf_flags lists important details about individual shaders */
00080 #define MFF_PROC        0x01            /**< @brief  shader is procedural, computes tr/re/hits */
00081 
00082 /* defined in material.c */
00083 OPTICAL_EXPORT BU_EXTERN(void mlib_add_shader,
00084                          (struct mfuncs **headp,
00085                           struct mfuncs *mfp1));
00086 
00087 OPTICAL_EXPORT BU_EXTERN(int mlib_setup,
00088                          (struct mfuncs **headp,
00089                           struct region *rp,
00090                           struct rt_i *rtip));
00091 
00092 OPTICAL_EXPORT BU_EXTERN(void mlib_free,
00093                          (struct region *rp));
00094 
00095 OPTICAL_EXPORT BU_EXTERN(struct mfuncs *load_dynamic_shader,
00096                          (const char *material,
00097                           const int mlen));
00098 
00099 #endif
00100 /*@}*/
00101 /*
00102  * Local Variables:
00103  * mode: C
00104  * tab-width: 8
00105  * c-basic-offset: 4
00106  * indent-tabs-mode: t
00107  * End:
00108  * ex: shiftwidth=4 tabstop=8
00109  */
00110 

Generated on Mon Sep 18 01:24:42 2006 for BRL-CAD by  doxygen 1.4.6