Free Electron
MayaRamp.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 __maya_MayaRamp_h__
8 #define __maya_MayaRamp_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Ramp in Maya
17 
18  @ingroup maya
19 *//***************************************************************************/
20 class FE_DL_EXPORT MayaRamp:
21  public MetaRamp,
22  public CastableAs<MayaRamp>
23 {
24  public:
25  MayaRamp(void) {}
26 virtual ~MayaRamp(void) {}
27 
28  //* as RampI
29 virtual U32 entryCount(void) const
30  {
31  MStatus status;
32  const U32 count=const_cast<MRampAttribute&>(m_ramp)
33  .getNumEntries(&status);
34  FEASSERT(status);
35  return count;
36  }
37 
38 virtual Vector2 entry(U32 a_index) const
39  {
40  MIntArray indexes;
41  MFloatArray positions;
42  MFloatArray values;
43  MIntArray interps;
44  MStatus status;
45  const_cast<MRampAttribute&>(m_ramp)
46  .getEntries(indexes,positions,values,
47  interps,&status);
48  FEASSERT(status);
49  return Vector2(positions[a_index],values[a_index]);
50  }
51 
52 virtual Real eval(Real a_u) const
53  {
54  float value;
55  MStatus status;
56  const_cast<MRampAttribute&>(m_ramp)
57  .getValueAtPosition(a_u,value,&status);
58  FEASSERT(status);
59  return value;
60  }
61 
62  void setRamp(MRampAttribute& a_rRamp)
63  { m_ramp=a_rRamp; }
64 
65  private:
66 
67  MRampAttribute m_ramp;
68 };
69 
70 } /* namespace ext */
71 } /* namespace fe */
72 
73 #endif /* __maya_MayaRamp_h__ */
Common ramp interface for Houdini, Maya, etc.
Definition: MetaRamp.h:20
kernel
Definition: namespace.dox:3
Ramp in Maya.
Definition: MayaRamp.h:20
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192