~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to COLLADAMax/include/COLLADAMaxCameraExporter.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
        This file is part of COLLADAMax.
 
5
 
 
6
    Portions of the code are:
 
7
    Copyright (c) 2005-2007 Feeling Software Inc.
 
8
    Copyright (c) 2005-2007 Sony Computer Entertainment America
 
9
    
 
10
    Based on the 3dsMax COLLADASW Tools:
 
11
    Copyright (c) 2005-2006 Autodesk Media Entertainment
 
12
        
 
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
 
16
*/
 
17
 
 
18
 
 
19
#ifndef __COLLADAMAX_CAMERAEXPORTER_H__
 
20
#define __COLLADAMAX_CAMERAEXPORTER_H__
 
21
 
 
22
#include "COLLADAMaxPrerequisites.h"
 
23
 
 
24
#include "COLLADASWLibraryCameras.h"
 
25
#include "COLLADAMaxConversionFunctor.h"
 
26
#include "COLLADAMaxExtra.h"
 
27
 
 
28
#define FMULTI_PASS_MOTION_BLUR_CLASS_ID Class_ID(0xd481518, 0x687d7c99)
 
29
#define FMULTI_PASS_DOF_CLASS_ID Class_ID(0xd481815, 0x687d799c)
 
30
 
 
31
 
 
32
namespace COLLADAMax
 
33
{
 
34
 
 
35
        class ExportSceneGraph;
 
36
        class ExportNode;
 
37
        class DocumentExporter;
 
38
        class AnimationExporter;
 
39
 
 
40
 
 
41
        namespace MaxCamera
 
42
        {
 
43
                // reference #s
 
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;
 
47
 
 
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
 
58
        };
 
59
 
 
60
 
 
61
 
 
62
    /** Class to export cameras.*/
 
63
    class CameraExporter : public COLLADASW::LibraryCameras, public Extra
 
64
    {
 
65
        public:
 
66
                /** Conversion functor to calculate the orthographic left for a camera's FOV.*/
 
67
                class ConversionInverseOrthoFOVFunctor : public ConversionFunctor
 
68
                {
 
69
                private:
 
70
                        float mTargetDistance;
 
71
                public:
 
72
                        /** Constructor. */
 
73
                        ConversionInverseOrthoFOVFunctor(float targetDistance) { mTargetDistance = targetDistance; }
 
74
 
 
75
                        /** Destructor. */
 
76
                        virtual ~ConversionInverseOrthoFOVFunctor() {} 
 
77
 
 
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); }
 
80
 
 
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);}
 
84
                };
 
85
 
 
86
        public:
 
87
                static const String CAMERA_ID_SUFFIX;
 
88
 
 
89
                static const String XFOV_SID;
 
90
                static const String XMAG_SID;
 
91
                static const String ZNEAR_SID;
 
92
                static const String ZFAR_SID;
 
93
 
 
94
                static const String EXTRA_PARAMETER_TARGET;
 
95
 
 
96
                static const String TARGETDISTANCE_PARAMETER;
 
97
 
 
98
 
 
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[];
 
105
 
 
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[];
 
112
 
 
113
 
 
114
    private:
 
115
                ExportSceneGraph* mExportSceneGraph;
 
116
                DocumentExporter* mDocumentExporter;
 
117
                AnimationExporter* mAnimationExporter;
 
118
 
 
119
    public:
 
120
        /** Constructor
 
121
         @param streamWriter the stream the extra tags should be written to.*/
 
122
        CameraExporter ( COLLADASW::StreamWriter * streamWriter, ExportSceneGraph * exportSceneGraph, DocumentExporter * documentExporter  );
 
123
 
 
124
        /** Destructor*/
 
125
        virtual ~CameraExporter()
 
126
        {}
 
127
 
 
128
                /** Exports all the cameras in the export scene graph.*/
 
129
                void doExport();
 
130
 
 
131
                /** Creates an id for the camera.*/
 
132
                static String getCameraId( const ExportNode& exportNode );
 
133
 
 
134
    private:
 
135
 
 
136
                /** Exports all the cameras in @a exportNode and all its child nodes.*/
 
137
                void doExport ( ExportNode* exportNode );
 
138
 
 
139
                /** Exports the camera represented by @a exportNode.*/
 
140
                void CameraExporter::exportCamera( ExportNode* exportNode );
 
141
 
 
142
 
 
143
        };
 
144
 
 
145
 
 
146
}
 
147
 
 
148
 
 
149
#endif //__COLLADAMAX_CAMERAEXPORTER_H__
 
150