/src/libreoffice/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX |
21 | | #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX |
22 | | |
23 | | #include <drawinglayer/drawinglayerdllapi.h> |
24 | | |
25 | | #include <basegfx/polygon/b3dpolypolygon.hxx> |
26 | | #include <basegfx/polygon/b2dpolypolygontools.hxx> |
27 | | #include <vector> |
28 | | |
29 | | |
30 | | // predefines |
31 | | |
32 | | namespace drawinglayer::geometry { |
33 | | class ViewInformation3D; |
34 | | } |
35 | | |
36 | | |
37 | | namespace drawinglayer::primitive3d |
38 | | { |
39 | | /** SliceType3D definition */ |
40 | | enum SliceType3D |
41 | | { |
42 | | SLICETYPE3D_REGULAR, // normal geometry Slice3D |
43 | | SLICETYPE3D_FRONTCAP, // front cap |
44 | | SLICETYPE3D_BACKCAP // back cap |
45 | | }; |
46 | | |
47 | | /// class to hold one Slice3D |
48 | | class DRAWINGLAYER_DLLPUBLIC Slice3D final |
49 | | { |
50 | | basegfx::B3DPolyPolygon maPolyPolygon; |
51 | | SliceType3D maSliceType; |
52 | | |
53 | | public: |
54 | | Slice3D( |
55 | | const basegfx::B2DPolyPolygon& rPolyPolygon, |
56 | | const basegfx::B3DHomMatrix& aTransform, |
57 | | SliceType3D aSliceType = SLICETYPE3D_REGULAR) |
58 | 0 | : maPolyPolygon(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPolygon)), |
59 | 0 | maSliceType(aSliceType) |
60 | 0 | { |
61 | 0 | maPolyPolygon.transform(aTransform); |
62 | 0 | } |
63 | | |
64 | | // data access |
65 | 0 | const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; } |
66 | 0 | SliceType3D getSliceType() const { return maSliceType; } |
67 | | }; |
68 | | |
69 | | /// typedef for a group of Slice3Ds |
70 | | typedef ::std::vector< Slice3D > Slice3DVector; |
71 | | |
72 | | /// helpers for creation |
73 | | void DRAWINGLAYER_DLLPUBLIC createLatheSlices( |
74 | | Slice3DVector& rSliceVector, |
75 | | const basegfx::B2DPolyPolygon& rSource, |
76 | | double fBackScale, |
77 | | double fDiagonal, |
78 | | double fRotation, |
79 | | sal_uInt32 nSteps, |
80 | | bool bCharacterMode, |
81 | | bool bCloseFront, |
82 | | bool bCloseBack); |
83 | | |
84 | | void DRAWINGLAYER_DLLPUBLIC createExtrudeSlices( |
85 | | Slice3DVector& rSliceVector, |
86 | | const basegfx::B2DPolyPolygon& rSource, |
87 | | double fBackScale, |
88 | | double fDiagonal, |
89 | | double fDepth, |
90 | | bool bCharacterMode, |
91 | | bool bCloseFront, |
92 | | bool bCloseBack); |
93 | | |
94 | | /// helpers for geometry extraction |
95 | | basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines); |
96 | | basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector); |
97 | | |
98 | | void DRAWINGLAYER_DLLPUBLIC extractPlanesFromSlice( |
99 | | ::std::vector< basegfx::B3DPolyPolygon >& rFill, |
100 | | const Slice3DVector& rSliceVector, |
101 | | bool bCreateNormals, |
102 | | bool bSmoothNormals, |
103 | | bool bSmoothLids, |
104 | | bool bClosed, |
105 | | double fSmoothNormalsMix, |
106 | | double fSmoothLidsMix, |
107 | | bool bCreateTextureCoordinates, |
108 | | const basegfx::B2DHomMatrix& rTexTransform); |
109 | | |
110 | | void DRAWINGLAYER_DLLPUBLIC createReducedOutlines( |
111 | | const geometry::ViewInformation3D& rViewInformation, |
112 | | const basegfx::B3DHomMatrix& rObjectTransform, |
113 | | const basegfx::B3DPolygon& rLoopA, |
114 | | const basegfx::B3DPolygon& rLoopB, |
115 | | basegfx::B3DPolyPolygon& rTarget); |
116 | | |
117 | | } // end of namespace drawinglayer::overlay |
118 | | |
119 | | |
120 | | #endif //_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX |
121 | | |
122 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |