Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
35 : : #include <basegfx/polygon/b2dpolypolygon.hxx>
36 : :
37 : : //////////////////////////////////////////////////////////////////////////////
38 : :
39 : : namespace drawinglayer
40 : : {
41 : : namespace primitive3d
42 : : {
43 : : /** SdrExtrudePrimitive3D class
44 : :
45 : : This 3D primitive expands the SdrPrimitive3D to a 3D extrude definition.
46 : : The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D
47 : : and gets extruded in Z-Direction by Depth.
48 : :
49 : : Various possibilities e.g. for creating diagonals (edge roudings in 3D)
50 : : and similar are given.
51 : :
52 : : The decomposition will create all necessary 3D planes for visualisation.
53 : : */
54 : : class DRAWINGLAYER_DLLPUBLIC SdrExtrudePrimitive3D : public SdrPrimitive3D
55 : : {
56 : : private:
57 : : /// geometry helper for slices
58 : : basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
59 : : Slice3DVector maSlices;
60 : :
61 : : /// primitive geometry data
62 : : basegfx::B2DPolyPolygon maPolyPolygon;
63 : : double mfDepth;
64 : : double mfDiagonal;
65 : : double mfBackScale;
66 : :
67 : : /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
68 : : geometry::ViewInformation3D* mpLastRLGViewInformation;
69 : :
70 : : /// bitfield
71 : : unsigned mbSmoothNormals : 1; // Plane self
72 : : unsigned mbSmoothHorizontalNormals : 1; // always
73 : : unsigned mbSmoothLids : 1; // Front/back
74 : : unsigned mbCharacterMode : 1;
75 : : unsigned mbCloseFront : 1;
76 : : unsigned mbCloseBack : 1;
77 : :
78 : : /// create slices
79 : : void impCreateSlices();
80 : :
81 : : /// get (evtl. create) slices
82 : : const Slice3DVector& getSlices() const;
83 : :
84 : : protected:
85 : : /// local decomposition.
86 : : virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
87 : :
88 : : public:
89 : : /// constructor
90 : : SdrExtrudePrimitive3D(
91 : : const basegfx::B3DHomMatrix& rTransform,
92 : : const basegfx::B2DVector& rTextureSize,
93 : : const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
94 : : const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
95 : : const basegfx::B2DPolyPolygon& rPolyPolygon,
96 : : double fDepth,
97 : : double fDiagonal,
98 : : double fBackScale,
99 : : bool bSmoothNormals,
100 : : bool bSmoothHorizontalNormals,
101 : : bool bSmoothLids,
102 : : bool bCharacterMode,
103 : : bool bCloseFront,
104 : : bool bCloseBack);
105 : : virtual ~SdrExtrudePrimitive3D();
106 : :
107 : : /// data read access
108 : 16262 : const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
109 : 6770 : double getDepth() const { return mfDepth; }
110 : 8340 : double getDiagonal() const { return mfDiagonal; }
111 : 3513 : double getBackScale() const { return mfBackScale; }
112 : 536 : bool getSmoothNormals() const { return mbSmoothNormals; }
113 : 536 : bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals; }
114 : 536 : bool getSmoothLids() const { return mbSmoothLids; }
115 : 3513 : bool getCharacterMode() const { return mbCharacterMode; }
116 : 6770 : bool getCloseFront() const { return mbCloseFront; }
117 : 3513 : bool getCloseBack() const { return mbCloseBack; }
118 : :
119 : : /// compare operator
120 : : virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
121 : :
122 : : /// get range
123 : : virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
124 : :
125 : : /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
126 : : virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
127 : :
128 : : /// provide unique ID
129 : : DeclPrimitrive3DIDBlock()
130 : : };
131 : : } // end of namespace primitive3d
132 : : } // end of namespace drawinglayer
133 : :
134 : : //////////////////////////////////////////////////////////////////////////////
135 : :
136 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
137 : :
138 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|