1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
21 #include <drawinglayer/attribute/materialattribute3d.hxx>
22 #include <rtl/instance.hxx>
25 namespace drawinglayer
29 class ImpSdr3DObjectAttribute
32 // 3D object attribute definitions
33 css::drawing::NormalsKind maNormalsKind
; // normals type (0..2)
34 css::drawing::TextureProjectionMode maTextureProjectionX
; // texture projection type X (0..2)
35 css::drawing::TextureProjectionMode maTextureProjectionY
; // texture projection type Y (0..2)
36 css::drawing::TextureKind2 maTextureKind
; // texture kind (see uno API)
37 css::drawing::TextureMode maTextureMode
; // texture kind (see uno API)
38 MaterialAttribute3D maMaterial
; // object, specular and emissive colors, SpecularIntensity
41 bool mbNormalsInvert
: 1; // invert normals
42 bool mbDoubleSided
: 1; // surfaces are double sided
43 bool mbShadow3D
: 1; // display shadow in 3D (if on), params for that are at scene
44 bool mbTextureFilter
: 1; // filter texture to make more smooth
45 bool mbReducedLineGeometry
: 1; // use reduced line geometry (object specific)
47 ImpSdr3DObjectAttribute(
48 css::drawing::NormalsKind aNormalsKind
,
49 css::drawing::TextureProjectionMode aTextureProjectionX
,
50 css::drawing::TextureProjectionMode aTextureProjectionY
,
51 css::drawing::TextureKind2 aTextureKind
,
52 css::drawing::TextureMode aTextureMode
,
53 const MaterialAttribute3D
& rMaterial
,
58 bool bReducedLineGeometry
)
59 : maNormalsKind(aNormalsKind
),
60 maTextureProjectionX(aTextureProjectionX
),
61 maTextureProjectionY(aTextureProjectionY
),
62 maTextureKind(aTextureKind
),
63 maTextureMode(aTextureMode
),
64 maMaterial(rMaterial
),
65 mbNormalsInvert(bNormalsInvert
),
66 mbDoubleSided(bDoubleSided
),
67 mbShadow3D(bShadow3D
),
68 mbTextureFilter(bTextureFilter
),
69 mbReducedLineGeometry(bReducedLineGeometry
)
74 css::drawing::NormalsKind
getNormalsKind() const { return maNormalsKind
; }
75 css::drawing::TextureProjectionMode
getTextureProjectionX() const { return maTextureProjectionX
; }
76 css::drawing::TextureProjectionMode
getTextureProjectionY() const { return maTextureProjectionY
; }
77 css::drawing::TextureKind2
getTextureKind() const { return maTextureKind
; }
78 css::drawing::TextureMode
getTextureMode() const { return maTextureMode
; }
79 const MaterialAttribute3D
& getMaterial() const { return maMaterial
; }
80 bool getNormalsInvert() const { return mbNormalsInvert
; }
81 bool getDoubleSided() const { return mbDoubleSided
; }
82 bool getShadow3D() const { return mbShadow3D
; }
83 bool getTextureFilter() const { return mbTextureFilter
; }
84 bool getReducedLineGeometry() const { return mbReducedLineGeometry
; }
86 bool operator==(const ImpSdr3DObjectAttribute
& rCandidate
) const
88 return (getNormalsKind() == rCandidate
.getNormalsKind()
89 && getTextureProjectionX() == rCandidate
.getTextureProjectionX()
90 && getTextureProjectionY() == rCandidate
.getTextureProjectionY()
91 && getTextureKind() == rCandidate
.getTextureKind()
92 && getTextureMode() == rCandidate
.getTextureMode()
93 && getMaterial() == rCandidate
.getMaterial()
94 && getNormalsInvert() == rCandidate
.getNormalsInvert()
95 && getDoubleSided() == rCandidate
.getDoubleSided()
96 && getShadow3D() == rCandidate
.getShadow3D()
97 && getTextureFilter() == rCandidate
.getTextureFilter()
98 && getReducedLineGeometry() == rCandidate
.getReducedLineGeometry());
104 struct theGlobalDefault
:
105 public rtl::Static
< Sdr3DObjectAttribute::ImplType
, theGlobalDefault
> {};
108 Sdr3DObjectAttribute::Sdr3DObjectAttribute(
109 css::drawing::NormalsKind aNormalsKind
,
110 css::drawing::TextureProjectionMode aTextureProjectionX
,
111 css::drawing::TextureProjectionMode aTextureProjectionY
,
112 css::drawing::TextureKind2 aTextureKind
,
113 css::drawing::TextureMode aTextureMode
,
114 const MaterialAttribute3D
& rMaterial
,
119 bool bReducedLineGeometry
)
120 : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute(
121 aNormalsKind
, aTextureProjectionX
, aTextureProjectionY
, aTextureKind
, aTextureMode
,
122 rMaterial
, bNormalsInvert
, bDoubleSided
, bShadow3D
, bTextureFilter
, bReducedLineGeometry
))
126 Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute
& rCandidate
)
127 : mpSdr3DObjectAttribute(rCandidate
.mpSdr3DObjectAttribute
)
131 Sdr3DObjectAttribute::~Sdr3DObjectAttribute()
135 Sdr3DObjectAttribute
& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute
& rCandidate
)
137 mpSdr3DObjectAttribute
= rCandidate
.mpSdr3DObjectAttribute
;
141 bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute
& rCandidate
) const
143 return rCandidate
.mpSdr3DObjectAttribute
== mpSdr3DObjectAttribute
;
146 css::drawing::NormalsKind
Sdr3DObjectAttribute::getNormalsKind() const
148 return mpSdr3DObjectAttribute
->getNormalsKind();
151 css::drawing::TextureProjectionMode
Sdr3DObjectAttribute::getTextureProjectionX() const
153 return mpSdr3DObjectAttribute
->getTextureProjectionX();
156 css::drawing::TextureProjectionMode
Sdr3DObjectAttribute::getTextureProjectionY() const
158 return mpSdr3DObjectAttribute
->getTextureProjectionY();
161 css::drawing::TextureKind2
Sdr3DObjectAttribute::getTextureKind() const
163 return mpSdr3DObjectAttribute
->getTextureKind();
166 css::drawing::TextureMode
Sdr3DObjectAttribute::getTextureMode() const
168 return mpSdr3DObjectAttribute
->getTextureMode();
171 const MaterialAttribute3D
& Sdr3DObjectAttribute::getMaterial() const
173 return mpSdr3DObjectAttribute
->getMaterial();
176 bool Sdr3DObjectAttribute::getNormalsInvert() const
178 return mpSdr3DObjectAttribute
->getNormalsInvert();
181 bool Sdr3DObjectAttribute::getDoubleSided() const
183 return mpSdr3DObjectAttribute
->getDoubleSided();
186 bool Sdr3DObjectAttribute::getShadow3D() const
188 return mpSdr3DObjectAttribute
->getShadow3D();
191 bool Sdr3DObjectAttribute::getTextureFilter() const
193 return mpSdr3DObjectAttribute
->getTextureFilter();
196 bool Sdr3DObjectAttribute::getReducedLineGeometry() const
198 return mpSdr3DObjectAttribute
->getReducedLineGeometry();
201 } // end of namespace attribute
202 } // end of namespace drawinglayer
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */