nss: upgrade to release 3.73
[LibreOffice.git] / include / drawinglayer / primitive3d / sdrextrudeprimitive3d.hxx
blob76078be50fde6bbb0e3b463228ace257c2338aa9
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_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
26 #include <basegfx/polygon/b2dpolypolygon.hxx>
27 #include <memory>
30 namespace drawinglayer::primitive3d
32 /** SdrExtrudePrimitive3D class
34 This 3D primitive expands the SdrPrimitive3D to a 3D extrude definition.
35 The given 2D tools::PolyPolygon geometry is imagined as lying on the XY-plane in 3D
36 and gets extruded in Z-Direction by Depth.
38 Various possibilities e.g. for creating diagonals (edge roudings in 3D)
39 and similar are given.
41 The decomposition will create all necessary 3D planes for visualisation.
43 class DRAWINGLAYER_DLLPUBLIC SdrExtrudePrimitive3D final : public SdrPrimitive3D
45 private:
46 /// geometry helper for slices
47 basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
48 Slice3DVector maSlices;
50 /// primitive geometry data
51 basegfx::B2DPolyPolygon maPolyPolygon;
52 double mfDepth;
53 double mfDiagonal;
54 double mfBackScale;
56 /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
57 std::unique_ptr<geometry::ViewInformation3D> mpLastRLGViewInformation;
59 bool mbSmoothNormals : 1; // Plane self
60 bool mbSmoothLids : 1; // Front/back
61 bool mbCharacterMode : 1;
62 bool mbCloseFront : 1;
63 bool mbCloseBack : 1;
65 /// create slices
66 void impCreateSlices();
68 /// get (evtl. create) slices
69 const Slice3DVector& getSlices() const;
71 /// local decomposition.
72 virtual Primitive3DContainer create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
74 public:
75 /// constructor
76 SdrExtrudePrimitive3D(
77 const basegfx::B3DHomMatrix& rTransform,
78 const basegfx::B2DVector& rTextureSize,
79 const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
80 const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
81 const basegfx::B2DPolyPolygon& rPolyPolygon,
82 double fDepth,
83 double fDiagonal,
84 double fBackScale,
85 bool bSmoothNormals,
86 bool bSmoothLids,
87 bool bCharacterMode,
88 bool bCloseFront,
89 bool bCloseBack);
90 virtual ~SdrExtrudePrimitive3D() override;
92 /// data read access
93 const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
94 double getDepth() const { return mfDepth; }
95 double getDiagonal() const { return mfDiagonal; }
96 double getBackScale() const { return mfBackScale; }
97 bool getSmoothNormals() const { return mbSmoothNormals; }
98 bool getSmoothLids() const { return mbSmoothLids; }
99 bool getCharacterMode() const { return mbCharacterMode; }
100 bool getCloseFront() const { return mbCloseFront; }
101 bool getCloseBack() const { return mbCloseBack; }
103 /// compare operator
104 virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
106 /// get range
107 virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
109 /// Overridden to allow for reduced line mode to decide if to buffer decomposition or not
110 virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
112 /// provide unique ID
113 DeclPrimitive3DIDBlock()
116 } // end of namespace drawinglayer::primitive3d
119 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */