H3D API  2.4.1
TextureCoordinate.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __TEXTURECOORDINATE_H__
30 #define __TEXTURECOORDINATE_H__
31 
33 #include <GL/glew.h>
34 #include <H3D/MFVec2f.h>
35 
36 namespace H3D {
37 
51  class H3DAPI_API TextureCoordinate : public X3DTextureCoordinateNode {
52  public:
54  TextureCoordinate( Inst< SFNode > _metadata = 0,
55  Inst< MFVec2f> _point = 0 );
56 
58  virtual ~TextureCoordinate();
59 
61  virtual bool supportsExplicitTexCoords() {
62  return true;
63  }
64 
68  virtual void render( int index );
69 
71  virtual void renderForTextureUnit( int index,
72  unsigned int texture_unit );
73 
76  virtual void renderArray();
77 
79  virtual void disableArray();
80 
82  virtual void setAttributeData ( );
83 
85  virtual void renderVBO ( );
86 
88  virtual void disableVBO ( );
89 
91  virtual bool preRenderCheckFail ( );
92 
95  inline virtual bool supportsGetTexCoord( unsigned int /*texture_unit*/ ) {
96  return true;
97  }
98 
100  virtual Vec4f getTexCoord( int index, unsigned int /*texture_unit*/ ) {
101  const Vec2f &p = point->getValueByIndex( index );
102  return Vec4f( p.x, p.y, 0, 1 );
103  }
104 
106  virtual unsigned int nrAvailableTexCoords() {
107  return point->size();
108  }
109 
115  H3DUniquePtr< MFVec2f > point;
116 
119  };
120 }
121 
122 #endif
Contains the MFVec2f field class.
Header file for X3DTextureCoordinateNode, X3D scene-graph node.
The TextureCoordinate node is a geometry property node that specifies a set of 2D texture coordinates...
Definition: TextureCoordinate.h:51
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: TextureCoordinate.h:118
H3DUniquePtr< MFVec2f > point
A vector of 2d texture coordinates.
Definition: TextureCoordinate.h:115
virtual Vec4f getTexCoord(int index, unsigned int)
Gets texture coordinate of the given index and texture unit.
Definition: TextureCoordinate.h:100
virtual unsigned int nrAvailableTexCoords()
Returns the number of texture coordinates this node can render.
Definition: TextureCoordinate.h:106
virtual bool supportsGetTexCoord(unsigned int)
Returns true if the getTexCoord function is available for use.
Definition: TextureCoordinate.h:95
virtual bool supportsExplicitTexCoords()
Returns true.
Definition: TextureCoordinate.h:61
This abstract node type is the base type for all node types which specify texture coordinates.
Definition: X3DTextureCoordinateNode.h:55
Vec2f()
Vec4f()
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194