Free Electron
MapOp.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __operator_MapOp_h__
8 #define __operator_MapOp_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Load a texture map into an attribute
17 
18  @ingroup operator
19 *//***************************************************************************/
20 class FE_DL_EXPORT MapOp:
21  public OperatorSurfaceCommon,
22  public Initialize<MapOp>
23 {
24  public:
25 
26  MapOp(void) {}
27 virtual ~MapOp(void) {}
28 
29  void initialize(void);
30 
31  //* As HandlerI
32 virtual void handle(Record& a_rSignal);
33 
34  protected:
35 
36  class FE_DL_EXPORT Raster
37  {
38  public:
39  Raster(sp<Registry> a_spRegistry):
40  m_spRegistry(a_spRegistry) {}
41 
42  void setTemplate(String a_template)
43  { m_template=a_template; }
44 
45  void setMinMax(Real a_min,Real a_max,Real a_random)
46  { m_min=a_min;
47  m_range=a_max-a_min;
48  m_random=a_random;
49  }
50 
51  String string(const Vector2& a_rUV);
52  I32 integer(const Vector2& a_rUV);
53  Real real(const Vector2& a_rUV);
54  SpatialVector spatialVector(const Vector2& a_rUV);
55 
56  private:
57 
58  Real low1(const Vector2& a_rUV);
59  SpatialVector low3(const Vector2& a_rUV);
60 
61  BWORD lookup(const Vector2& a_rUV,U8* a_pData);
62 
63  sp<Registry> m_spRegistry;
64 
65  Noise m_noise;
66 
67  String m_template;
68 
69  Real m_min;
70  Real m_range;
71  Real m_random;
72 
73  Array< sp<ImageI> > m_mapArray;
74  Array<U32> m_idArray;
75  };
76 
77  private:
78  sp<Scope> m_spScope;
79 };
80 
81 } /* namespace ext */
82 } /* namespace fe */
83 
84 #endif /* __operator_MapOp_h__ */
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Load a texture map into an attribute.
Definition: MapOp.h:20
Automatically reference-counted string container.
Definition: String.h:128
Partial Generic SurfaceI Implemention.
Definition: OperatorSurfaceCommon.h:20
Wrapper for std::vector.
Definition: Array.h:21
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Perlin Noise.
Definition: Noise.h:23