SoInterpolate.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef COIN_SOINTERPOLATE_H
00021
#define COIN_SOINTERPOLATE_H
00022
00023
00024
#include <Inventor/engines/SoSubEngine.h>
00025
#include <Inventor/engines/SoEngineOutput.h>
00026
#include <Inventor/fields/SoSFFloat.h>
00027
00028 class COIN_DLL_API SoInterpolate :
public SoEngine {
00029
typedef SoEngine inherited;
00030 SO_ENGINE_ABSTRACT_HEADER(SoInterpolate);
00031
00032
public:
00033
static void initClass(
void);
00034
static void initClasses(
void);
00035
00036
SoSFFloat alpha;
00037
SoEngineOutput output;
00038
00039
protected:
00040 SoInterpolate();
00041
virtual ~SoInterpolate();
00042 };
00043
00044
00045
00047
00048
00049
#define SO_INTERPOLATE_HEADER(_class_) \
00050
SO_ENGINE_HEADER(_class_); \
00051
public: \
00052
_class_(); \
00053
static void initClass(); \
00054
protected: \
00055
virtual ~_class_(); \
00056
private: \
00057
virtual void evaluate()
00058
00059
00060
#define PRIVATE_SO_INTERPOLATE_CONSTRUCTOR(_class_, _type_, _valtype_, _default0_, _default1_) \
00061
SO_ENGINE_CONSTRUCTOR(_class_); \
00062
SO_ENGINE_ADD_INPUT(alpha, (0.0f)); \
00063
SO_ENGINE_ADD_INPUT(input0, _default0_); \
00064
SO_ENGINE_ADD_INPUT(input1, _default1_); \
00065
SO_ENGINE_ADD_OUTPUT(output, _type_)
00066
00067
#define PRIVATE_SO_INTERPOLATE_DESTRUCTOR(_class_) \
00068
_class_::~_class_() \
00069
{ \
00070
}
00071
00072
#define PRIVATE_SO_INTERPOLATE_EVALUATE(_class_, _type_, _valtype_, _interpexp_) \
00073
void \
00074
_class_::evaluate(void) \
00075
{ \
00076
int n0 = this->input0.getNum(); \
00077
int n1 = this->input1.getNum(); \
00078
float a = this->alpha.getValue(); \
00079
for (int i = SbMax(n0, n1) - 1; i >= 0; i--) { \
00080
_valtype_ v0 = this->input0[SbMin(i, n0-1)]; \
00081
_valtype_ v1 = this->input1[SbMin(i, n1-1)]; \
00082
SO_ENGINE_OUTPUT(output, _type_, set1Value(i, _interpexp_)); \
00083
} \
00084
}
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
#define SO_INTERPOLATE_SOURCE(_class_, _type_, _valtype_, _default0_, _default1_, _interpexp_) \
00102
\
00103
SO_ENGINE_SOURCE(_class_); \
00104
\
00105
_class_::_class_(void) \
00106
{ \
00107
PRIVATE_SO_INTERPOLATE_CONSTRUCTOR(_class_, _type_, _valtype_, _default0_, _default1_); \
00108
this->isBuiltIn = FALSE; \
00109
} \
00110
\
00111
PRIVATE_SO_INTERPOLATE_DESTRUCTOR(_class_) \
00112
PRIVATE_SO_INTERPOLATE_EVALUATE(_class_, _type_, _valtype_, _interpexp_)
00113
00114
00115
#define SO_INTERPOLATE_INITCLASS(_class_, _classname_) \
00116
\
00117
void \
00118
_class_::initClass(void) \
00119
{ \
00120
SO_ENGINE_INIT_CLASS(_class_, SoInterpolate, "SoInterpolate"); \
00121
}
00122
00123
00125
00126
00127
#ifndef COIN_INTERNAL
00128
00129
#include <Inventor/engines/SoInterpolateFloat.h>
00130
#include <Inventor/engines/SoInterpolateVec2f.h>
00131
#include <Inventor/engines/SoInterpolateVec3f.h>
00132
#include <Inventor/engines/SoInterpolateVec4f.h>
00133
#include <Inventor/engines/SoInterpolateRotation.h>
00134
#endif // !COIN_INTERNAL
00135
00136
00137
#endif // !COIN_SOINTERPOLATE_H
Generated on Tue Jul 27 23:53:01 2004 for Coin by
1.3.7