2
Copyright (c) 2008-2009 NetAllied Systems GmbH
4
This file is part of COLLADAMax.
6
Portions of the code are:
7
Copyright (c) 2005-2007 Feeling Software Inc.
8
Copyright (c) 2005-2007 Sony Computer Entertainment America
10
Based on the 3dsMax COLLADASW Tools:
11
Copyright (c) 2005-2006 Autodesk Media Entertainment
13
Licensed under the MIT Open Source License,
14
for details please see LICENSE file or the website
15
http://www.opensource.org/licenses/mit-license.php
19
#ifndef __COLLADAMAX_CAMERAEXPORTER_H__
20
#define __COLLADAMAX_CAMERAEXPORTER_H__
22
#include "COLLADAMaxPrerequisites.h"
24
#include "COLLADASWLibraryCameras.h"
25
#include "COLLADAMaxConversionFunctor.h"
26
#include "COLLADAMaxExtra.h"
28
#define FMULTI_PASS_MOTION_BLUR_CLASS_ID Class_ID(0xd481518, 0x687d7c99)
29
#define FMULTI_PASS_DOF_CLASS_ID Class_ID(0xd481815, 0x687d799c)
35
class ExportSceneGraph;
37
class DocumentExporter;
38
class AnimationExporter;
44
const unsigned int PBLOCK_REF = 0; // This is a IParamBlock, not a IParamBlock2.
45
const unsigned int DOF_REF = 1;
46
const unsigned int MP_EFFECT_REF = 2;
48
// Parameter block indices
49
const unsigned int FOV = 0; //float
50
const unsigned int TARGET_DISTANCE = 1; //float
51
const unsigned int NEAR_CLIP = 2; //float
52
const unsigned int FAR_CLIP = 3; //float
53
const unsigned int NEAR_RANGE = 4; //float
54
const unsigned int FAR_RANGE = 5; //float
55
const unsigned int MULTI_PASS_EFFECT_ENABLE = 6; //bool
56
const unsigned int MULTI_PASS_EFFECT_RENDER_EFFECTS_PER_PASS = 7; //bool
57
const unsigned int FOV_TYPE = 8; //int
62
/** Class to export cameras.*/
63
class CameraExporter : public COLLADASW::LibraryCameras, public Extra
66
/** Conversion functor to calculate the orthographic left for a camera's FOV.*/
67
class ConversionInverseOrthoFOVFunctor : public ConversionFunctor
70
float mTargetDistance;
73
ConversionInverseOrthoFOVFunctor(float targetDistance) { mTargetDistance = targetDistance; }
76
virtual ~ConversionInverseOrthoFOVFunctor() {}
78
/** This member must create a new instance of the class and return a pointer to it.*/
79
virtual ConversionFunctor* clone()const { return new ConversionInverseOrthoFOVFunctor(*this); }
81
/** Main functor to override.
82
@param v The value to convert. @return The converted value. */
83
virtual float operator()(float fov)const {return mTargetDistance * tanf(fov / 2.0f);}
87
static const String CAMERA_ID_SUFFIX;
89
static const String XFOV_SID;
90
static const String XMAG_SID;
91
static const String ZNEAR_SID;
92
static const String ZFAR_SID;
94
static const String EXTRA_PARAMETER_TARGET;
96
static const String TARGETDISTANCE_PARAMETER;
99
/** Name of the motion blur extra tag.*/
100
static const String MOTION_BLUR_ELEMENT;
101
/** Number of motion blur extra parameters.*/
102
static const int MOTION_BLUR_PARAMETER_COUNT;
103
/** Motion blur parameters.*/
104
static const ExtraParameter MOTION_BLUR_PARAMETERS[];
106
/** Name of the depth of field extra tag.*/
107
static const String DEPTH_OF_FIELD_ELEMENT;
108
/** Number of depth of field extra parameters.*/
109
static const int DEPTH_OF_FIELD_PARAMETER_COUNT;
110
/** Depth of field parameters.*/
111
static const ExtraParameter CameraExporter::DEPTH_OF_FIELD_PARAMETERS[];
115
ExportSceneGraph* mExportSceneGraph;
116
DocumentExporter* mDocumentExporter;
117
AnimationExporter* mAnimationExporter;
121
@param streamWriter the stream the extra tags should be written to.*/
122
CameraExporter ( COLLADASW::StreamWriter * streamWriter, ExportSceneGraph * exportSceneGraph, DocumentExporter * documentExporter );
125
virtual ~CameraExporter()
128
/** Exports all the cameras in the export scene graph.*/
131
/** Creates an id for the camera.*/
132
static String getCameraId( const ExportNode& exportNode );
136
/** Exports all the cameras in @a exportNode and all its child nodes.*/
137
void doExport ( ExportNode* exportNode );
139
/** Exports the camera represented by @a exportNode.*/
140
void CameraExporter::exportCamera( ExportNode* exportNode );
149
#endif //__COLLADAMAX_CAMERAEXPORTER_H__