1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef FFGLPluginInstance_H
#define FFGLPluginInstance_H
#include <FFGL.h>
class FFGLPluginInstance
{
public:
//each platform implements this and returns
//a class that derives from FFGLPluginInstance
//(that class implements the real Load and Unload methods which
//by default return FF_FAIL below)
static FFGLPluginInstance *New();
FFGLPluginInstance();
//these methods are virtual because each platform implements
//dynamic libraries differently
virtual DWORD Load(const char *filename)
{
return FF_FAIL;
}
//calls plugMain(FF_INSTANTIATEGL) and assigns
//each parameter its default value
DWORD InstantiateGL(const FFGLViewportStruct *vp);
//calls plugMain(FF_DEINSTANTIATEGL)
DWORD DeInstantiateGL();
virtual DWORD Unload()
{
return FF_FAIL;
}
//these methods are shared by the
//platform-specific implementations
const char *GetParameterName(int paramNum);
float GetFloatParameter(int paramNum);
void SetFloatParameter(int paramNum, float value);
void SetTime(double curTime);
DWORD CallProcessOpenGL(ProcessOpenGLStructTag &t);
virtual ~FFGLPluginInstance();
protected:
FF_Main_FuncPtr m_ffPluginMain;
//many plugins will return 0x00000000 as the first valid instance,
//so we use 0xFFFFFFFF to represent an uninitialized/invalid instance
enum { INVALIDINSTANCE=0xFFFFFFFF };
DWORD m_ffInstanceID;
enum { MAX_PARAMETERS = 64 };
int m_numParameters;
char *m_paramNames[MAX_PARAMETERS];
//helper methods
//calls plugMain(FF_INITIALISE) and gets the
//parameter names
DWORD InitPluginLibrary();
//calls DeletePluginInstance if needed, calls
//ReleaseParamNames, then calls plugMain(FF_DEINITIALISE)
DWORD DeinitPluginLibrary();
void SetParameterName(int paramNum, const char *srcString);
void ReleaseParamNames();
};
#endif