bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / drawinglayer / processor3d / shadow3dextractor.hxx
blob8d92f84c503db37d69c009898dc39459406a30ac
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
21 #define INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/processor3d/baseprocessor3d.hxx>
26 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
27 #include <basegfx/matrix/b3dhommatrix.hxx>
28 #include <basegfx/polygon/b2dpolygon.hxx>
29 #include <basegfx/polygon/b2dpolypolygon.hxx>
30 #include <basegfx/matrix/b2dhommatrix.hxx>
32 namespace basegfx { class B3DPolyPolygon; }
33 namespace basegfx { class B3DPolygon; }
36 namespace drawinglayer
38 namespace processor3d
40 /** Shadow3DExtractingProcessor class
42 This processor extracts the 2D shadow geometry (projected geometry) of all fed primitives.
43 It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite
44 some data to do so since we do not only offer flat projected 2D shadow, but also projections
45 dependent on the light source
47 class DRAWINGLAYER_DLLPUBLIC Shadow3DExtractingProcessor : public BaseProcessor3D
49 private:
50 /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence)
51 primitive2d::Primitive2DContainer maPrimitive2DSequence;
52 primitive2d::Primitive2DContainer* mpPrimitive2DSequence;
54 /// object transformation for scene for 2d definition
55 basegfx::B2DHomMatrix maObjectTransformation;
57 /// prepared data (transformations) for 2D/3D shadow calculations
58 basegfx::B3DHomMatrix maWorldToEye;
59 basegfx::B3DHomMatrix maEyeToView;
60 basegfx::B3DVector maLightNormal;
61 basegfx::B3DVector maShadowPlaneNormal;
62 basegfx::B3DPoint maPlanePoint;
63 double mfLightPlaneScalar;
65 /// flag if shadow plane projection preparation led to valid results
66 bool mbShadowProjectionIsValid : 1;
68 /// flag if conversion is switched on
69 bool mbConvert : 1;
71 /// flag if conversion shall use projection
72 bool mbUseProjection : 1;
74 /// local helpers
75 basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource);
76 basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource);
78 /* as tooling, the process() implementation takes over API handling and calls this
79 virtual render method when the primitive implementation is BasePrimitive3D-based.
81 virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) override;
83 public:
84 Shadow3DExtractingProcessor(
85 const geometry::ViewInformation3D& rViewInformation,
86 const basegfx::B2DHomMatrix& rObjectTransformation,
87 const basegfx::B3DVector& rLightNormal,
88 double fShadowSlant,
89 const basegfx::B3DRange& rContained3DRange);
90 virtual ~Shadow3DExtractingProcessor() override;
92 /// data read access
93 const primitive2d::Primitive2DContainer& getPrimitive2DSequence() const;
94 const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
95 const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; }
97 } // end of namespace processor3d
98 } // end of namespace drawinglayer
100 #endif //_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */