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_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
35 : : #include <drawinglayer/primitive3d/baseprimitive3d.hxx>
36 : : #include <drawinglayer/geometry/viewinformation3d.hxx>
37 : : #include <basegfx/matrix/b2dhommatrix.hxx>
38 : :
39 : : //////////////////////////////////////////////////////////////////////////////
40 : : // Embedded3DPrimitive2D class
41 : :
42 : : namespace drawinglayer
43 : : {
44 : : namespace primitive2d
45 : : {
46 : : /** Embedded3DPrimitive2D class
47 : :
48 : : This is a helper primitive which allows embedding of single 3D
49 : : primitives to the 2D primitive logic. It will get the scene it's
50 : : involved and thus the 3D transformation. With this information it
51 : : is able to provide 2D range data for a 3D primitive.
52 : :
53 : : This primitive will not be visualized and decomposes to a yellow
54 : : 2D rectangle to visualize that this should never be visualized
55 : : */
56 [ # # ][ # # ]: 0 : class DRAWINGLAYER_DLLPUBLIC Embedded3DPrimitive2D : public BufferedDecompositionPrimitive2D
[ # # ][ # # ]
[ # # ]
57 : : {
58 : : private:
59 : : /// the sequence of 3d primitives
60 : : primitive3d::Primitive3DSequence mxChildren3D;
61 : :
62 : : /// the 2D scene object transformation
63 : : basegfx::B2DHomMatrix maObjectTransformation;
64 : :
65 : : /// the 3D transformations
66 : : geometry::ViewInformation3D maViewInformation3D;
67 : :
68 : : /** if the embedded 3D primitives contain shadow, these parameters are needed
69 : : to extract the shadow wich is a sequence od 2D primitives and may expand
70 : : the 2D range. Since every single 3D object in a scene may individually
71 : : have shadow or not, these values need to be provided and prepared. The shadow
72 : : distance itself (a 2D transformation) is part of the 3D shadow definition
73 : : */
74 : : basegfx::B3DVector maLightNormal;
75 : : double mfShadowSlant;
76 : : basegfx::B3DRange maScene3DRange;
77 : :
78 : : /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
79 : : Primitive2DSequence maShadowPrimitives;
80 : :
81 : : /// #i96669# add simple range buffering for this primitive
82 : : basegfx::B2DRange maB2DRange;
83 : :
84 : : /// bitfield
85 : : /** flag if given 3D geometry is already cheched for shadow definitions and 2d shadows
86 : : are created in maShadowPrimitives
87 : : */
88 : : unsigned mbShadow3DChecked : 1;
89 : :
90 : : /// private helpers
91 : : bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const;
92 : :
93 : : protected:
94 : : /// local decomposition.
95 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
96 : :
97 : : public:
98 : : /// constructor
99 : : Embedded3DPrimitive2D(
100 : : const primitive3d::Primitive3DSequence& rxChildren3D,
101 : : const basegfx::B2DHomMatrix& rObjectTransformation,
102 : : const geometry::ViewInformation3D& rViewInformation3D,
103 : : const basegfx::B3DVector& rLightNormal,
104 : : double fShadowSlant,
105 : : const basegfx::B3DRange& rScene3DRange);
106 : :
107 : : /// data read access
108 : 0 : const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; }
109 : 0 : const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
110 : 0 : const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
111 : 0 : const basegfx::B3DVector& getLightNormal() const { return maLightNormal; }
112 : 0 : double getShadowSlant() const { return mfShadowSlant; }
113 : 0 : const basegfx::B3DRange& getScene3DRange() const { return maScene3DRange; }
114 : :
115 : : /// compare operator
116 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
117 : :
118 : : /// get range
119 : : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
120 : :
121 : : /// provide unique ID
122 : : DeclPrimitrive2DIDBlock()
123 : : };
124 : : } // end of namespace primitive2d
125 : : } // end of namespace drawinglayer
126 : :
127 : : //////////////////////////////////////////////////////////////////////////////
128 : :
129 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
130 : :
131 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|