Line data Source code
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 { namespace geometry {
33 : class ViewInformation3D;
34 : }}
35 :
36 :
37 :
38 : namespace drawinglayer
39 : {
40 : namespace primitive3d
41 : {
42 : /** SliceType3D definition */
43 : enum SliceType3D
44 : {
45 : SLICETYPE3D_REGULAR, // normal geoemtry Slice3D
46 : SLICETYPE3D_FRONTCAP, // front cap
47 : SLICETYPE3D_BACKCAP // back cap
48 : };
49 :
50 : /// class to hold one Slice3D
51 77082 : class DRAWINGLAYER_DLLPUBLIC Slice3D
52 : {
53 : protected:
54 : basegfx::B3DPolyPolygon maPolyPolygon;
55 : SliceType3D maSliceType;
56 :
57 : public:
58 16692 : Slice3D(
59 : const basegfx::B2DPolyPolygon& rPolyPolygon,
60 : const basegfx::B3DHomMatrix& aTransform,
61 : SliceType3D aSliceType = SLICETYPE3D_REGULAR)
62 : : maPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPolygon)),
63 16692 : maSliceType(aSliceType)
64 : {
65 16692 : maPolyPolygon.transform(aTransform);
66 16692 : }
67 :
68 : explicit Slice3D(
69 : const basegfx::B3DPolyPolygon& rPolyPolygon,
70 : SliceType3D aSliceType = SLICETYPE3D_REGULAR)
71 : : maPolyPolygon(rPolyPolygon),
72 : maSliceType(aSliceType)
73 : {
74 : }
75 :
76 : // data access
77 120624 : const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; }
78 25066 : SliceType3D getSliceType() const { return maSliceType; }
79 : };
80 :
81 : /// typedef for a group of Slice3Ds
82 : typedef ::std::vector< Slice3D > Slice3DVector;
83 :
84 : /// helpers for creation
85 : void DRAWINGLAYER_DLLPUBLIC createLatheSlices(
86 : Slice3DVector& rSliceVector,
87 : const basegfx::B2DPolyPolygon& rSource,
88 : double fBackScale,
89 : double fDiagonal,
90 : double fRotation,
91 : sal_uInt32 nSteps,
92 : bool bCharacterMode,
93 : bool bCloseFront,
94 : bool bCloseBack);
95 :
96 : void DRAWINGLAYER_DLLPUBLIC createExtrudeSlices(
97 : Slice3DVector& rSliceVector,
98 : const basegfx::B2DPolyPolygon& rSource,
99 : double fBackScale,
100 : double fDiagonal,
101 : double fDepth,
102 : bool bCharacterMode,
103 : bool bCloseFront,
104 : bool bCloseBack);
105 :
106 : /// helpers for geometry extraction
107 : basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines);
108 : basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector);
109 :
110 : void DRAWINGLAYER_DLLPUBLIC extractPlanesFromSlice(
111 : ::std::vector< basegfx::B3DPolyPolygon >& rFill,
112 : const Slice3DVector& rSliceVector,
113 : bool bCreateNormals,
114 : bool bSmoothHorizontalNormals,
115 : bool bSmoothNormals,
116 : bool bSmoothLids,
117 : bool bClosed,
118 : double fSmoothNormalsMix,
119 : double fSmoothLidsMix,
120 : bool bCreateTextureCoordinates,
121 : const basegfx::B2DHomMatrix& rTexTransform);
122 :
123 : void DRAWINGLAYER_DLLPUBLIC createReducedOutlines(
124 : const geometry::ViewInformation3D& rViewInformation,
125 : const basegfx::B3DHomMatrix& rObjectTransform,
126 : const basegfx::B3DPolygon& rLoopA,
127 : const basegfx::B3DPolygon& rLoopB,
128 : basegfx::B3DPolyPolygon& rTarget);
129 :
130 : } // end of namespace overlay
131 : } // end of namespace drawinglayer
132 :
133 :
134 :
135 : #endif //_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|