/
novaplayer.hpp
212 lines (176 loc) · 7.33 KB
/
novaplayer.hpp
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
// This file is distributed under a BSD license. See LICENSE.txt for details.
#pragma once
#include "kdoc.hpp"
#include "script.hpp"
/****************************************************************************/
/*** ***/
/*** forwards ***/
/*** ***/
/****************************************************************************/
class KSCeneNode2;
struct KEnvironment2;
struct KEffect2;
struct KEvent2;
/****************************************************************************/
/*** ***/
/*** scene ***/
/*** ***/
/****************************************************************************/
class KSceneNode2 : public KObject
{
public:
KSceneNode2();
~KSceneNode2();
void Copy(KObject *);
sMatrix Matrix; // transformation from animation
sMatrix WorldMatrix; // transformation after concatenation
sAABox Bounds; // bound of all childs (and this one)
KSceneNode2 *Next; // next sibling on same lavel
KSceneNode2 *First; // first child
class EngMesh *Mesh; // -> drawing
void *Light; // -> lighting
class WerkSceneNode2 *BackLink; // go back to werk-gui
};
/****************************************************************************/
/*** ***/
/*** effects ***/
/*** ***/
/****************************************************************************/
struct KEnvironment2
{
void Init();
void Exit();
sViewport View; // viewport
sMaterialEnv Env; // camera
sBool InScene; // BeginViewport() already called
sInt BeatTime; // absolte time
sInt EffectBeatTime; // time relative to effect
sArray<struct KEvent2 *> Events; // list of all effects, for globals.
};
#define K2MAX_LINK 8
/****************************************************************************/
struct KEffect2Symbol
{
sChar Name[KK_NAME];
sInt Id;
sInt Type; // 0..3 -> Scalar, Vector, Matrix, Spline
};
enum KEffect2ParaInfoType
{
EPT_INT = 1,
EPT_CHOICE,
EPT_FLAGS,
EPT_FLOAT,
EPT_MATRIX,
EPT_COLOR,
EPT_LINK,
EPT_GROUP,
EPT_ALIAS,
};
enum KEffect2ParaAnimType
{
EAT_SCALAR = 0x0001,
EAT_VECTOR = 0x0002,
EAT_EULER = 0x0004,
EAT_SRT = 0x0008,
EAT_TARGET = 0x0010,
EAT_COLOR = 0x0020,
};
struct KEffect2ParaInfo2
{
sInt Type;
sInt Offset;
sInt EditOffset; // secondary offset for sMatrixEdit parameters
sInt Count;
sInt KCType;
sF32 Min,Max,Step;
sInt AnimType; // bitmask of allowed animationtypes
const sChar *Name;
const sChar *Choice;
};
struct KEffectInfo
{
void Init();
void Exit();
void Clear();
sArray<KEffect2ParaInfo2> ParaInfo;
sArray<KEffect2Symbol> Exports;
sF32 DefaultPara[64];
sF32 DefaultEdit[64];
KEffect2ParaInfo2 *AddPara (const sChar *name,sInt offset,sInt Type); // use for matrix,color
KEffect2ParaInfo2 *AddLink (const sChar *name,sInt index,sInt kc_type);
KEffect2ParaInfo2 *AddAlias (const sChar *name);
KEffect2ParaInfo2 *AddGroup (const sChar *name);
KEffect2ParaInfo2 *AddChoice(const sChar *name,sInt offset,const sChar *choices);
KEffect2ParaInfo2 *AddFlags (const sChar *name,sInt offset,const sChar *choices);
KEffect2ParaInfo2 *AddInt (const sChar *name,sInt offset,sF32 Min,sF32 Max,sF32 Step,sInt Count=1);
KEffect2ParaInfo2 *AddFloat (const sChar *name,sInt offset,sF32 Min,sF32 Max,sF32 Step,sInt Count=1);
KEffect2ParaInfo2 *AddColor (const sChar *name,sInt offset); // use for matrix,color
KEffect2ParaInfo2 *AddMatrix(const sChar *name,sInt offset,sInt editoffset); // use for matrix,color
void AddSymbol(const sChar *name,sInt id,sInt type);
};
struct KEffect2
{
const sChar *Name;
sU32 ButtonColor;
sInt Id;
sU32 Flags;
sInt ParaSize;
sInt EditSize;
// player calls
void (*OnInit)(KEvent2 *,KEnvironment2 *);
void (*OnExit)(KEvent2 *,KEnvironment2 *);
void (*OnPaint)(KEvent2 *,KEnvironment2 *);
void (*OnSet)(KEvent2 *,KEnvironment2 *,sInt id,sF32 *values,sU32 mask);
// editor calls
void (*OnPara)(KEffectInfo *);
sInt Types[K2MAX_LINK];
KEffectInfo *Info;
};
enum KEffect2Flags
{
KEF_NEEDBEGINSCENE = 1,
};
/****************************************************************************/
/*** ***/
/*** events ***/
/*** ***/
/****************************************************************************/
struct KEvent2
{
public:
void Init(const KEffect2 *ef);
void Exit();
sInt Start; // time start
sInt End; // time end
sInt LoopEnd; // loop end
const KEffect2 *Effect; // effect-class
sF32 *Para; // effect parameters
sF32 *Edit; // editor parameters
KObject *Links[K2MAX_LINK]; // links to mesh/texture/material/...
KEvent2 *Alias; // alias-event
sArray<KSpline *> Splines; // list of splines, updated during Build()
sArray<KSceneNode2 *> SceneNodes; // list of nodes, updated during Build()
#if !sLINK_KKRIEGER || !sPLAYER
sScript Code;
#endif
};
/****************************************************************************/
/****************************************************************************/
/*** ***/
/*** bytecode ***/
/*** ***/
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/*** ***/
/*** some code ***/
/*** ***/
/****************************************************************************/
/****************************************************************************/
extern KEffect2 EffectList[];
void NovaEngine(class WerkDoc2 *doc2,class WerkDoc *doc);
void NovaSceneWalk(KSceneNode2 *node,const sMatrix &pmat);
/****************************************************************************/
/****************************************************************************/