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