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 : #include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
21 : #include <drawinglayer/attribute/materialattribute3d.hxx>
22 : #include <rtl/instance.hxx>
23 :
24 :
25 :
26 : namespace drawinglayer
27 : {
28 : namespace attribute
29 : {
30 28803 : class ImpSdr3DObjectAttribute
31 : {
32 : public:
33 : // 3D object attribute definitions
34 : ::com::sun::star::drawing::NormalsKind maNormalsKind; // normals type (0..2)
35 : ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionX; // texture projection type X (0..2)
36 : ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionY; // texture projection type Y (0..2)
37 : ::com::sun::star::drawing::TextureKind2 maTextureKind; // texture kind (see uno API)
38 : ::com::sun::star::drawing::TextureMode maTextureMode; // texture kind (see uno API)
39 : MaterialAttribute3D maMaterial; // object, specular and emissive colors, SpecularIntensity
40 :
41 : // bitfield
42 : bool mbNormalsInvert : 1; // invert normals
43 : bool mbDoubleSided : 1; // surfaces are double sided
44 : bool mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene
45 : bool mbTextureFilter : 1; // filter texture to make more smooth
46 : bool mbReducedLineGeometry : 1; // use reduced line geometry (object specific)
47 :
48 9601 : ImpSdr3DObjectAttribute(
49 : ::com::sun::star::drawing::NormalsKind aNormalsKind,
50 : ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX,
51 : ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY,
52 : ::com::sun::star::drawing::TextureKind2 aTextureKind,
53 : ::com::sun::star::drawing::TextureMode aTextureMode,
54 : const MaterialAttribute3D& rMaterial,
55 : bool bNormalsInvert,
56 : bool bDoubleSided,
57 : bool bShadow3D,
58 : bool bTextureFilter,
59 : bool bReducedLineGeometry)
60 : : maNormalsKind(aNormalsKind),
61 : maTextureProjectionX(aTextureProjectionX),
62 : maTextureProjectionY(aTextureProjectionY),
63 : maTextureKind(aTextureKind),
64 : maTextureMode(aTextureMode),
65 : maMaterial(rMaterial),
66 : mbNormalsInvert(bNormalsInvert),
67 : mbDoubleSided(bDoubleSided),
68 : mbShadow3D(bShadow3D),
69 : mbTextureFilter(bTextureFilter),
70 9601 : mbReducedLineGeometry(bReducedLineGeometry)
71 : {
72 9601 : }
73 :
74 : // data read access
75 10345 : ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; }
76 10383 : ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; }
77 10383 : ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; }
78 9922 : ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; }
79 9922 : ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; }
80 18207 : const MaterialAttribute3D& getMaterial() const { return maMaterial; }
81 10210 : bool getNormalsInvert() const { return mbNormalsInvert; }
82 18207 : bool getDoubleSided() const { return mbDoubleSided; }
83 9902 : bool getShadow3D() const { return mbShadow3D; }
84 9922 : bool getTextureFilter() const { return mbTextureFilter; }
85 10183 : bool getReducedLineGeometry() const { return mbReducedLineGeometry; }
86 :
87 4951 : bool operator==(const ImpSdr3DObjectAttribute& rCandidate) const
88 : {
89 4951 : return (getNormalsKind() == rCandidate.getNormalsKind()
90 4951 : && getTextureProjectionX() == rCandidate.getTextureProjectionX()
91 4951 : && getTextureProjectionY() == rCandidate.getTextureProjectionY()
92 4951 : && getTextureKind() == rCandidate.getTextureKind()
93 4951 : && getTextureMode() == rCandidate.getTextureMode()
94 4951 : && getMaterial() == rCandidate.getMaterial()
95 4951 : && getNormalsInvert() == rCandidate.getNormalsInvert()
96 4951 : && getDoubleSided() == rCandidate.getDoubleSided()
97 4951 : && getShadow3D() == rCandidate.getShadow3D()
98 4951 : && getTextureFilter() == rCandidate.getTextureFilter()
99 9902 : && getReducedLineGeometry() == rCandidate.getReducedLineGeometry());
100 : }
101 : };
102 :
103 : namespace
104 : {
105 : struct theGlobalDefault :
106 : public rtl::Static< Sdr3DObjectAttribute::ImplType, theGlobalDefault > {};
107 : }
108 :
109 9601 : Sdr3DObjectAttribute::Sdr3DObjectAttribute(
110 : ::com::sun::star::drawing::NormalsKind aNormalsKind,
111 : ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX,
112 : ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY,
113 : ::com::sun::star::drawing::TextureKind2 aTextureKind,
114 : ::com::sun::star::drawing::TextureMode aTextureMode,
115 : const MaterialAttribute3D& rMaterial,
116 : bool bNormalsInvert,
117 : bool bDoubleSided,
118 : bool bShadow3D,
119 : bool bTextureFilter,
120 : bool bReducedLineGeometry)
121 : : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute(
122 : aNormalsKind, aTextureProjectionX, aTextureProjectionY, aTextureKind, aTextureMode,
123 9601 : rMaterial, bNormalsInvert, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry))
124 : {
125 9601 : }
126 :
127 23579 : Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate)
128 23579 : : mpSdr3DObjectAttribute(rCandidate.mpSdr3DObjectAttribute)
129 : {
130 23579 : }
131 :
132 33180 : Sdr3DObjectAttribute::~Sdr3DObjectAttribute()
133 : {
134 33180 : }
135 :
136 0 : Sdr3DObjectAttribute& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute& rCandidate)
137 : {
138 0 : mpSdr3DObjectAttribute = rCandidate.mpSdr3DObjectAttribute;
139 0 : return *this;
140 : }
141 :
142 5824 : bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const
143 : {
144 5824 : return rCandidate.mpSdr3DObjectAttribute == mpSdr3DObjectAttribute;
145 : }
146 :
147 443 : ::com::sun::star::drawing::NormalsKind Sdr3DObjectAttribute::getNormalsKind() const
148 : {
149 443 : return mpSdr3DObjectAttribute->getNormalsKind();
150 : }
151 :
152 481 : ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionX() const
153 : {
154 481 : return mpSdr3DObjectAttribute->getTextureProjectionX();
155 : }
156 :
157 481 : ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionY() const
158 : {
159 481 : return mpSdr3DObjectAttribute->getTextureProjectionY();
160 : }
161 :
162 20 : ::com::sun::star::drawing::TextureKind2 Sdr3DObjectAttribute::getTextureKind() const
163 : {
164 20 : return mpSdr3DObjectAttribute->getTextureKind();
165 : }
166 :
167 20 : ::com::sun::star::drawing::TextureMode Sdr3DObjectAttribute::getTextureMode() const
168 : {
169 20 : return mpSdr3DObjectAttribute->getTextureMode();
170 : }
171 :
172 8305 : const MaterialAttribute3D& Sdr3DObjectAttribute::getMaterial() const
173 : {
174 8305 : return mpSdr3DObjectAttribute->getMaterial();
175 : }
176 :
177 308 : bool Sdr3DObjectAttribute::getNormalsInvert() const
178 : {
179 308 : return mpSdr3DObjectAttribute->getNormalsInvert();
180 : }
181 :
182 8305 : bool Sdr3DObjectAttribute::getDoubleSided() const
183 : {
184 8305 : return mpSdr3DObjectAttribute->getDoubleSided();
185 : }
186 :
187 0 : bool Sdr3DObjectAttribute::getShadow3D() const
188 : {
189 0 : return mpSdr3DObjectAttribute->getShadow3D();
190 : }
191 :
192 20 : bool Sdr3DObjectAttribute::getTextureFilter() const
193 : {
194 20 : return mpSdr3DObjectAttribute->getTextureFilter();
195 : }
196 :
197 281 : bool Sdr3DObjectAttribute::getReducedLineGeometry() const
198 : {
199 281 : return mpSdr3DObjectAttribute->getReducedLineGeometry();
200 : }
201 :
202 : } // end of namespace attribute
203 : } // end of namespace drawinglayer
204 :
205 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|