H3D API  2.4.1
NoiseTexture.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 __NOISETEXTURE_H__
30 #define __NOISETEXTURE_H__
31 
32 #include <H3D/X3DTexture2DNode.h>
33 #include <H3D/SFInt32.h>
34 
35 namespace H3D {
44  class H3DAPI_API NoiseTexture : public X3DTexture2DNode {
45  public:
46 
60  class H3DAPI_API SFImage: public TypedField< X3DTexture2DNode::SFImage,
61  Types< SFFloat, SFFloat, SFInt32, SFFloat, SFInt32, SFInt32, SFInt32, SFString, SFBool > > {
63  virtual void update();
64  };
65 
67  NoiseTexture(Inst< DisplayList > _displayList = 0,
68  Inst< SFNode > _metadata = 0,
69  Inst< SFImage > _image = 0,
70  Inst< SFTextureProperties > _textureProperties = 0,
71  Inst< SFInt32 > _width = 0,
72  Inst< SFInt32 > _height = 0,
73  Inst< SFFloat > _frequency = 0,
74  Inst< SFFloat > _lacunarity = 0,
75  Inst< SFInt32 > _octaveCount = 0,
76  Inst< SFFloat > _persistence = 0,
77  Inst< SFInt32 > _seed = 0,
78  Inst< SFString > _type = 0,
79  Inst< SFBool > _tileable = 0 );
80 
81  // static H3DFloat perlinNoiseTileable( H3DFloat x, H3DFloat y );
82  static H3DFloat simplexNoise( H3DFloat x, H3DFloat y, H3DFloat frequency, H3DFloat lacunarity, H3DFloat octaves, H3DFloat persistence );
83  static H3DFloat simplexNoiseTileable( H3DFloat x, H3DFloat y, H3DFloat frequency, H3DFloat lacunarity, H3DFloat octaves, H3DFloat persistence );
84 
89  H3DUniquePtr< SFInt32 > width;
90 
95  H3DUniquePtr< SFInt32 > height;
96 
101  H3DUniquePtr< SFFloat > frequency;
102 
107  H3DUniquePtr< SFFloat > lacunarity;
108 
113  H3DUniquePtr< SFInt32 > octaveCount;
114 
119  H3DUniquePtr< SFFloat > persistence;
120 
125  H3DUniquePtr< SFInt32 > seed;
126 
132  H3DUniquePtr< SFString > type;
133 
139  H3DUniquePtr< SFBool > tileable;
140 
143 
144  };
145 }
146 
147 #endif
Contains the SFInt32 field class.
Header file for X3DTexture2DNode, X3D scene-graph node.
SFImage is overridden to update the value from the url and imageLoader fields of the ImageTexture.
Definition: NoiseTexture.h:61
The NoiseTexture node creates a texture with Perlin noise.
Definition: NoiseTexture.h:44
H3DUniquePtr< SFInt32 > width
Width (x-dimension) of texture.
Definition: NoiseTexture.h:89
H3DUniquePtr< SFFloat > persistence
Sets the persistence value of the Perlin noise.
Definition: NoiseTexture.h:119
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: NoiseTexture.h:142
H3DUniquePtr< SFString > type
Noise type.
Definition: NoiseTexture.h:132
H3DUniquePtr< SFFloat > lacunarity
Frequency multiplier between successive octaves.
Definition: NoiseTexture.h:107
H3DUniquePtr< SFFloat > frequency
Frequency of the first octave.
Definition: NoiseTexture.h:101
H3DUniquePtr< SFInt32 > seed
Seed value used by the Perlin-noise function.
Definition: NoiseTexture.h:125
H3DUniquePtr< SFInt32 > height
Height (y-dimension) of texture.
Definition: NoiseTexture.h:95
H3DUniquePtr< SFInt32 > octaveCount
Total number of octaves that generate the Perlin noise, higher value increases computation time,...
Definition: NoiseTexture.h:113
H3DUniquePtr< SFBool > tileable
If set to TRUE the produced texture will be tileable seamlessly.
Definition: NoiseTexture.h:139
A template modifier class for adding type checking on the routes to any Field class.
Definition: TypedField.h:84
This abstract node type is the base type for all node types which specify 2D sources for texture imag...
Definition: X3DTexture2DNode.h:46
H3DDouble x
float H3DFloat
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