00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027
00029 #ifndef __NORMAL_H__
00030 #define __NORMAL_H__
00031
00032 #include "X3DNormalNode.h"
00033 #include "FieldTemplates.h"
00034 #include <GL/glew.h>
00035 #include "MFVec3f.h"
00036
00037 namespace H3D {
00038
00048 class H3DAPI_API Normal : public X3DNormalNode {
00049 public:
00050
00051 Normal( Inst< SFNode > _metadata = 0,
00052 Inst< MFVec3f> _vector = 0 );
00053
00054
00055 virtual Vec3f getNormal( int index ) {
00056 return vector->getValueByIndex( index );
00057 }
00058
00061 virtual void render( int index ) {
00062 const Vec3f &v = vector->getValueByIndex( index );
00063 glNormal3f( v.x, v.y, v.z );
00064 }
00065
00068 virtual void renderArray();
00069
00071 virtual void disableArray();
00072
00074 virtual unsigned int nrAvailableNormals() {
00075 return vector->size();
00076 }
00077
00081 auto_ptr< MFVec3f > vector;
00082
00084 static H3DNodeDatabase database;
00085 };
00086 }
00087
00088 #endif