1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8 						pageitem_osgframe.h  -  description
9 						-------------------
10 copyright            : Scribus Team
11 ***************************************************************************/
12 
13 /***************************************************************************
14 *                                                                         *
15 *   This program is free software; you can redistribute it and/or modify  *
16 *   it under the terms of the GNU General Public License as published by  *
17 *   the Free Software Foundation; either version 2 of the License, or     *
18 *   (at your option) any later version.                                   *
19 *                                                                         *
20 ***************************************************************************/
21 
22 #ifndef PAGEITEM_OSGFRAME_H
23 #define PAGEITEM_OSGFRAME_H
24 
25 #include <osg/Node>
26 #include <osg/Matrixd>
27 #include <osg/Vec3>
28 #include <QObject>
29 #include <QWidget>
30 #include <QString>
31 #include <QHash>
32 
33 #include "scribusapi.h"
34 #include "pageitem.h"
35 #include "pageitem_imageframe.h"
36 
37 
38 class SCRIBUS_API PageItem_OSGFrame : public PageItem_ImageFrame
39 {
40 	Q_OBJECT
41 
42 	public:
43 		enum LightType
44 		{
45 			None		= 0,
46 			Headlamp	= 1,
47 			White		= 2,
48 			Day			= 3,
49 			Night		= 4,
50 			Hard		= 5,
51 			Primary		= 6,
52 			Blue		= 7,
53 			Red			= 8,
54 			Cube		= 9,
55 			CAD			= 10,
56 			Artwork		= 11
57 		};
58 		enum RenderType
59 		{
60 			Solid							= 0,
61 			SolidWireframe					= 1,
62 			Transparent						= 2,
63 			TransparentWireframe			= 3,
64 			BoundingBox						= 4,
65 			TransparentBoundingBox			= 5,
66 			TransparentBoundingBoxOutline	= 6,
67 			Wireframe						= 7,
68 			ShadedWireframe					= 8,
69 			HiddenWireframe					= 9,
70 			Vertices						= 10,
71 			ShadedVertices					= 11,
72 			Illustration					= 12,
73 			SolidOutline					= 13,
74 			ShadedIllustration				= 14
75 		};
76 		PageItem_OSGFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, const QString& fill, const QString& outline);
77 		~PageItem_OSGFrame();
78 
asOSGFrame()79 		PageItem_OSGFrame * asOSGFrame() override { return this; }
isOSGFrame()80 		bool isOSGFrame() const override { return true; }
81 
realItemType()82 		ItemType realItemType() const override { return PageItem::OSGFrame; }
83 		void clearContents() override;
84 		void setImage(QImage &image);
85 		void setExternalModelFile(QString val);
86 		void loadModel();
87 		void applicableActions(QStringList& actionList) override;
88 		QString infoDescription() const override;
89 		double getDistance(osg::Vec3d pos1, osg::Vec3d pos2);
90 		QString getPDFMatrix(QString viewName);
91 
92 		osg::ref_ptr<osg::Node> loadedModel;
93 		struct viewDefinition
94 		{
95 			osg::Matrixd trackerMatrix;
96 			osg::Vec3d trackerCenter;
97 			osg::Vec3d cameraPosition;
98 			osg::Vec3d cameraUp;
99 			double angleFOV;
100 			double trackerDist;
101 			double trackerSize;
102 			LightType illumination;
103 			RenderType rendermode;
104 			double addedTransparency;
105 			QColor colorAC;
106 			QColor colorFC;
107 		};
108 		QHash<QString, viewDefinition> viewMap;
109 		QString currentView;
110 		double distanceToObj;
111 		QString modelFile;
112 };
113 
114 #endif
115