00001 //------------------------------------------------------------------------ 00002 // 00003 // Joe Kniss 00004 // 3-20-03 00005 // ________ ____ ___ 00006 // | \ / | / / 00007 // +---+ \/ |/ / 00008 // +--+| |\ /| < 00009 // | || | \ / | |\ \ 00010 // | | \/ | | \ \ 00011 // \_____| |__| \__\ 00012 // Copyright 2003 00013 // Joe Michael Kniss 00014 // <<< jmk@cs.utah.edu >>> 00015 // "All Your Base are Belong to Us" 00016 //------------------------------------------------------------------------- 00017 00018 /// simTexture.h 00019 00020 /// Simian Texture utilities. 00021 00022 #ifndef __SIMIAN_TEXTURE_DOT_H 00023 #define __SIMIAN_TEXTURE_DOT_H 00024 00025 #include <textureGlift.h> 00026 #include <nrro/nrro.h> 00027 00028 /////////////////////////////////////////////////////////////////////////// 00029 /// Texture types, SIMT_BEST chooses the highest precision texture, 00030 /// based on the precision of the format of the source data and 00031 /// the highest precision interpolating texture that supports the 00032 /// requested number of components. 00033 enum SIM_TEX_PREFERENCE{ 00034 SIMT_UNKNOWN, 00035 SIMT_BEST, 00036 SIMT_8BIT, 00037 SIMT_16FIXED, 00038 SIMT_16FLOAT, 00039 SIMT_32FLOAT, 00040 SIMT_FORMAT_TYPE_LAST 00041 }; 00042 00043 /////////////////////////////////////////////////////////////////////////// 00044 /// Load a single nrrd texture 00045 /// Check for zero on return value for failure to load 00046 /////////////////////////////////////////////////////////////////////////// 00047 glift::SingleTex *loadNrrdTexture(char *nrrdTexName, int texType=SIMT_BEST); 00048 00049 glift::SingleTexSP loadNrroTexture(const NrroSP n, int texType=SIMT_BEST); 00050 00051 int getSimtType(const NrroSP n, int texType=SIMT_BEST); 00052 00053 /////////////////////////////////////////////////////////////////////////// 00054 /// Load Texture, explicit, standard texture object state: 00055 /// Linear, clamp to boarder (if applicable) or clamp 00056 /// BEST FITS: 00057 /// Comps Type General Type nv123x Type ATI 9700+ 00058 /// 1 Lumanance HILO16 Fixed16 Lum 00059 /// 2 Lumanance Alpha HILO16 Fixed16 Lum Alpha 00060 /// 3 RGB8 RGB8 RGB16 (FIXED) 00061 /// 4 RGBA8 RGBA8 RGBA16 (FIXED) 00062 /////////////////////////////////////////////////////////////////////////// 00063 glift::SingleTexSP loadTexture3D(float *data, int sx, int sy, int sz, int comp, int texType=SIMT_BEST); 00064 glift::SingleTexSP loadTexture3D(char *data, int sx, int sy, int sz, int comp, int texType=SIMT_BEST); 00065 00066 glift::SingleTex *loadTexture1D(float *data, int sx, int comp, int texType=SIMT_BEST); 00067 glift::SingleTex *loadTexture2D(float *data, int sx, int sy, int comp, int texType=SIMT_BEST); 00068 00069 /////////////////////////////////////////////////////////////////////////// 00070 /// find the best fit texture type, returns the higest precision (best == interpolating) type 00071 /// for the current platform and the number of components requested 00072 /// this function is mostly for internal use, SIMT_BEST is "best" 00073 GLenum getInternalFormat(int nComps, int simtType); 00074 00075 /////////////////////////////////////////////////////////////////////////// 00076 /// Get the gl texture format for the reqested number of components 00077 /// you can pass in the internal format if that effects the type of 00078 /// the external format, as it does on NVidia cards, (HILO) 00079 GLenum getExternalFormat(int nComps, GLenum inFormat = 0); 00080 00081 #endif