-
Notifications
You must be signed in to change notification settings - Fork 0
/
camera.cpp
82 lines (61 loc) · 2.2 KB
/
camera.cpp
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
#include "export.h"
static void Export (const CameraState& cs,CameraObject* cam,TimeValue t)
{
logBeginFrame ("camera_settings");
dump<<"time\t"<<t<<endl;
if (cs.manualClip)
{
dump<<"hitcher\t"<<cs.hither<<endl;
dump<<"yon\t"<<cs.yon<<endl;
}
dump<<"near_range\t"<<cs.nearRange<<endl;
dump<<"far_range\t"<<cs.farRange<<endl;
dump<<"manual_clip\t"<<cs.manualClip<<endl;
dump<<"near_clip\t"<<cs.hither<<endl;
dump<<"far_clip\t"<<cs.yon<<endl;
dump<<"fov\t"<<cs.fov<<endl;
dump<<"tdist\t"<<cam->GetTDist(t)<<endl;
logEndFrame ();
}
void ExportCamera (INode* node)
{
logBeginFrame ("camera");
INode* target = node->GetTarget();
if (target) dump<<"type\ttarget"<<endl;
else dump<<"type\tfree"<<endl;
// If we have a target object, export animation keys for the target too.
/* if (target) {
ExportNodeTM(target, indentLevel);
}
*/
CameraState cs;
TimeValue t = static_frame;
Interval valid = FOREVER;
Interval animRange = iface->GetAnimRange();
ObjectState os = node->EvalWorldState (t);
CameraObject* cam = (CameraObject*)os.obj;
cam->EvalCameraState (t,valid,&cs);
Export (cs,cam,t);
/*
// Export animated camera settings
if (!valid.InInterval(animRange) && GetIncludeCamLightAnim()) {
fprintf(pStream,"%s\t%s {\n", indent.data(), ID_CAMERA_ANIMATION);
TimeValue t = animRange.Start();
while (1) {
valid = FOREVER; // Extend the validity interval so the camera can shrink it.
cam->EvalCameraState(t,valid,&cs);
t = valid.Start() < animRange.Start() ? animRange.Start() : valid.Start();
// Export the camera settings at this frame
ExportCameraSettings(&cs, cam, t, indentLevel+1);
if (valid.End() >= animRange.End()) {
break;
}
else {
t = (valid.End()/GetTicksPerFrame()+GetMeshFrameStep()) * GetTicksPerFrame();
}
}
fprintf(pStream,"%s\t}\n", indent.data());
}
*/
logEndFrame ();
}