#ifndef COIN_SOMULTITEXTURECOORDINATEELEMENT_H#define COIN_SOMULTITEXTURECOORDINATEELEMENT_H/**************************************************************************\ * Copyright (c) Kongsberg Oil & Gas Technologies AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\**************************************************************************/#include <Inventor/elements/SoElement.h>#include <Inventor/elements/SoSubElement.h>#include <Inventor/SbVec2f.h>#include <Inventor/SbVec3f.h>#include <Inventor/SbVec4f.h>typedefconstSbVec4f&SoTextureCoordinateFunctionCB(void*userdata,constSbVec3f&point,constSbVec3f&normal);classSoMultiTextureCoordinateElementP;classCOIN_DLL_APISoMultiTextureCoordinateElement:publicSoElement{typedefSoElementinherited;SO_ELEMENT_HEADER(SoMultiTextureCoordinateElement);public:staticvoidinitClass(void);protected:virtual~SoMultiTextureCoordinateElement();public:enumCoordType{NONE=0,TEXGEN=0,EXPLICIT=1,FUNCTION=2,DEFAULT=3};virtualvoidinit(SoState*state);staticvoidsetDefault(SoState*conststate,SoNode*constnode,constintunit=0);staticvoidsetFunction(SoState*conststate,SoNode*constnode,constintunit,SoTextureCoordinateFunctionCB*constfunc,void*constuserdata);staticvoidset2(SoState*conststate,SoNode*constnode,constintunit,constint32_tnumCoords,constSbVec2f*constcoords);staticvoidset3(SoState*conststate,SoNode*constnode,constintunit,constint32_tnumCoords,constSbVec3f*constcoords);staticvoidset4(SoState*conststate,SoNode*constnode,constintunit,constint32_tnumCoords,constSbVec4f*constcoords);staticCoordTypegetType(SoState*conststate,constintunit=0);virtualCoordTypegetType(constintunit=0)const;staticconstSoMultiTextureCoordinateElement*getInstance(SoState*conststate);constSbVec4f&get(constintunit,constSbVec3f&point,constSbVec3f&normal)const;int32_tgetNum(constintunit=0)const;SbBoolis2D(constintunit=0)const;int32_tgetDimension(constintunit=0)const;constSbVec2f&get2(constintunit,constintindex)const;constSbVec3f&get3(constintunit,constintindex)const;constSbVec4f&get4(constintunit,constintindex)const;constSbVec2f*getArrayPtr2(constintunit=0)const;constSbVec3f*getArrayPtr3(constintunit=0)const;constSbVec4f*getArrayPtr4(constintunit=0)const;classUnitData{public:UnitData();UnitData(constUnitData&org);uint32_tnodeid;CoordTypewhatKind;SoTextureCoordinateFunctionCB*funcCB;void*funcCBData;int32_tnumCoords;constSbVec2f*coords2;constSbVec3f*coords3;constSbVec4f*coords4;intcoordsDimension;};virtualvoidpush(SoState*state);virtualSbBoolmatches(constSoElement*elem)const;SoElement*copyMatchInfo(void)const;// Coin-3 supportconstSbVec4f&get(constSbVec3f&point,constSbVec3f&normal)const{returnthis->get(0,point,normal);}staticvoidsetFunction(SoState*conststate,SoNode*constnode,SoTextureCoordinateFunctionCB*constfunc,void*constuserdata){setFunction(state,node,0,func,userdata);}staticvoidset2(SoState*conststate,SoNode*constnode,constint32_tnumCoords,constSbVec2f*constcoords){set2(state,node,0,numCoords,coords);}staticvoidset3(SoState*conststate,SoNode*constnode,constint32_tnumCoords,constSbVec3f*constcoords){set3(state,node,0,numCoords,coords);}staticvoidset4(SoState*conststate,SoNode*constnode,constint32_tnumCoords,constSbVec4f*constcoords){set4(state,node,0,numCoords,coords);}constSbVec2f&get2(constintindex)const{returnthis->get2(0,index);}constSbVec3f&get3(constintindex)const{returnthis->get3(0,index);}constSbVec4f&get4(constintindex)const{returnthis->get4(0,index);}protected:intgetMaxUnits()const;UnitData&getUnitData(constintunit);constUnitData&getUnitData(constintunit)const;SbVec2fconvert2;SbVec3fconvert3;SbVec4fconvert4;private:SoMultiTextureCoordinateElementP*pimpl;};#endif // !COIN_SOMULTITEXTURECOORDINATEELEMENT_H