00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Side Effects Software Inc. 00008 * 477 Richmond Street West 00009 * Toronto, Ontario 00010 * Canada M5V 3E7 00011 * 416-504-9876 00012 * 00013 * NAME: GR_ShadedOffset.h (GR library, C++) 00014 * 00015 * COMMENTS: Attribute offsets specifically for GR 00016 * 00017 */ 00018 00019 #ifndef __GR_AttribOffset_h__ 00020 #define __GR_AttribOffset_h__ 00021 00022 #include "GR_API.h" 00023 #include <UT/UT_IntArray.h> 00024 #include <UT/UT_RefArray.h> 00025 #include <RE/RE_Types.h> 00026 #include <GU/GU_DisplayAttribs.h> 00027 00028 class RE_Render; 00029 class GA_GBElement; 00030 class GR_DisplayOption; 00031 00032 class GR_API GR_AttribOffset : public GU_DisplayAttribs 00033 { 00034 public: 00035 typedef const float *(*ColorLookupFunc)(const GA_GBElement *element, 00036 const GA_ROAttributeRef &offset); 00037 00038 GR_AttribOffset(); 00039 00040 GR_AttribOffset(const GR_AttribOffset ©); 00041 GR_AttribOffset &operator=(const GR_AttribOffset ©); 00042 00043 // This function overrides the base class version. 00044 // It's non-virtual for efficiency as we don't use this class in a 00045 // polymorphic fashion. 00046 void resetOffsets(); 00047 00048 void getShaderAttribOffsets(const GU_Detail *gdp, 00049 const RE_MaterialPtr &mat); 00050 00051 void getMultiTexAttribOffsets(RE_Render &ren, 00052 const GU_Detail *gdp, 00053 const RE_MaterialPtr &mat, 00054 int layer); 00055 00056 void getLookups(const GU_Detail *gdp, const GR_DisplayOption &dopt); 00057 00058 // Query whether we have vertex level colors. This includes both point 00059 // and vertex attributes. 00060 inline bool hasVertexColors() const 00061 { return ptCd.isValid() || vtxCd.isValid() || 00062 ptColorLookupOffset.isValid() || vtxColorLookupOffset.isValid(); } 00063 00064 // OpenGL shaders. 00065 UT_IntArray ptLocations; // OpenGL shader attribute offsets 00066 UT_RefArray<GA_ROAttributeRef> ptOffsets; // Corresponding gdp attribute offsets 00067 UT_IntArray ptSizes; // Corresponding gdp attribute sizes 00068 UT_IntArray vtxLocations; // OpenGL shader (vertex) attribute offsets 00069 UT_RefArray<GA_ROAttributeRef> vtxOffsets; // Corresponding gdp (vertex) attribute offsets 00070 UT_IntArray vtxSizes; // Corresponding gdp (vertex) attribute sizes 00071 00072 // Multi-texture coords for texture coord layers > 1. layer 1 uses the 00073 // tex coord attributes in the parent class. 00074 UT_IntArray ptTexCoords; 00075 UT_RefArray<GA_ROAttributeRef> ptTexOffsets; 00076 UT_IntArray ptTexSizes; 00077 UT_IntArray vtxTexCoords; 00078 UT_RefArray<GA_ROAttributeRef> vtxTexOffsets; 00079 UT_IntArray vtxTexSizes; 00080 00081 ColorLookupFunc colorLookup; 00082 GA_ROAttributeRef ptColorLookupOffset; 00083 GA_ROAttributeRef vtxColorLookupOffset; 00084 00085 private: 00086 }; 00087 00088 #endif // __GR_AttribOffset_h__ 00089
1.5.9