1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
28 //////////////////////////////////////////////////////////////////////////////
30 namespace drawinglayer
34 /** SdrExtrudePrimitive3D class
36 This 3D primitive expands the SdrPrimitive3D to a 3D extrude definition.
37 The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D
38 and gets extruded in Z-Direction by Depth.
40 Various possibilities e.g. for creating diagonals (edge roudings in 3D)
41 and similar are given.
43 The decomposition will create all necessary 3D planes for visualisation.
45 class DRAWINGLAYER_DLLPUBLIC SdrExtrudePrimitive3D
: public SdrPrimitive3D
48 /// geometry helper for slices
49 basegfx::B2DPolyPolygon maCorrectedPolyPolygon
;
50 Slice3DVector maSlices
;
52 /// primitive geometry data
53 basegfx::B2DPolyPolygon maPolyPolygon
;
58 /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
59 geometry::ViewInformation3D
* mpLastRLGViewInformation
;
62 unsigned mbSmoothNormals
: 1; // Plane self
63 unsigned mbSmoothHorizontalNormals
: 1; // always
64 unsigned mbSmoothLids
: 1; // Front/back
65 unsigned mbCharacterMode
: 1;
66 unsigned mbCloseFront
: 1;
67 unsigned mbCloseBack
: 1;
70 void impCreateSlices();
72 /// get (evtl. create) slices
73 const Slice3DVector
& getSlices() const;
76 /// local decomposition.
77 virtual Primitive3DSequence
create3DDecomposition(const geometry::ViewInformation3D
& rViewInformation
) const;
81 SdrExtrudePrimitive3D(
82 const basegfx::B3DHomMatrix
& rTransform
,
83 const basegfx::B2DVector
& rTextureSize
,
84 const attribute::SdrLineFillShadowAttribute3D
& rSdrLFSAttribute
,
85 const attribute::Sdr3DObjectAttribute
& rSdr3DObjectAttribute
,
86 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
91 bool bSmoothHorizontalNormals
,
96 virtual ~SdrExtrudePrimitive3D();
99 const basegfx::B2DPolyPolygon
& getPolyPolygon() const { return maPolyPolygon
; }
100 double getDepth() const { return mfDepth
; }
101 double getDiagonal() const { return mfDiagonal
; }
102 double getBackScale() const { return mfBackScale
; }
103 bool getSmoothNormals() const { return mbSmoothNormals
; }
104 bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals
; }
105 bool getSmoothLids() const { return mbSmoothLids
; }
106 bool getCharacterMode() const { return mbCharacterMode
; }
107 bool getCloseFront() const { return mbCloseFront
; }
108 bool getCloseBack() const { return mbCloseBack
; }
111 virtual bool operator==(const BasePrimitive3D
& rPrimitive
) const;
114 virtual basegfx::B3DRange
getB3DRange(const geometry::ViewInformation3D
& rViewInformation
) const;
116 /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
117 virtual Primitive3DSequence
get3DDecomposition(const geometry::ViewInformation3D
& rViewInformation
) const;
119 /// provide unique ID
120 DeclPrimitive3DIDBlock()
122 } // end of namespace primitive3d
123 } // end of namespace drawinglayer
125 //////////////////////////////////////////////////////////////////////////////
127 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */