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>
24 namespace drawinglayer::attribute
26 class ImpSdr3DObjectAttribute
29 // 3D object attribute definitions
30 css::drawing::NormalsKind maNormalsKind
; // normals type (0..2)
31 css::drawing::TextureProjectionMode maTextureProjectionX
; // texture projection type X (0..2)
32 css::drawing::TextureProjectionMode maTextureProjectionY
; // texture projection type Y (0..2)
33 css::drawing::TextureKind2 maTextureKind
; // texture kind (see uno API)
34 css::drawing::TextureMode maTextureMode
; // texture kind (see uno API)
35 MaterialAttribute3D maMaterial
; // object, specular and emissive colors, SpecularIntensity
37 bool mbNormalsInvert
: 1; // invert normals
38 bool mbDoubleSided
: 1; // surfaces are double sided
39 bool mbShadow3D
: 1; // display shadow in 3D (if on), params for that are at scene
40 bool mbTextureFilter
: 1; // filter texture to make more smooth
41 bool mbReducedLineGeometry
: 1; // use reduced line geometry (object specific)
43 ImpSdr3DObjectAttribute(
44 css::drawing::NormalsKind aNormalsKind
,
45 css::drawing::TextureProjectionMode aTextureProjectionX
,
46 css::drawing::TextureProjectionMode aTextureProjectionY
,
47 css::drawing::TextureKind2 aTextureKind
,
48 css::drawing::TextureMode aTextureMode
,
49 const MaterialAttribute3D
& rMaterial
,
54 bool bReducedLineGeometry
)
55 : maNormalsKind(aNormalsKind
),
56 maTextureProjectionX(aTextureProjectionX
),
57 maTextureProjectionY(aTextureProjectionY
),
58 maTextureKind(aTextureKind
),
59 maTextureMode(aTextureMode
),
60 maMaterial(rMaterial
),
61 mbNormalsInvert(bNormalsInvert
),
62 mbDoubleSided(bDoubleSided
),
63 mbShadow3D(bShadow3D
),
64 mbTextureFilter(bTextureFilter
),
65 mbReducedLineGeometry(bReducedLineGeometry
)
70 css::drawing::NormalsKind
getNormalsKind() const { return maNormalsKind
; }
71 css::drawing::TextureProjectionMode
getTextureProjectionX() const { return maTextureProjectionX
; }
72 css::drawing::TextureProjectionMode
getTextureProjectionY() const { return maTextureProjectionY
; }
73 css::drawing::TextureKind2
getTextureKind() const { return maTextureKind
; }
74 css::drawing::TextureMode
getTextureMode() const { return maTextureMode
; }
75 const MaterialAttribute3D
& getMaterial() const { return maMaterial
; }
76 bool getNormalsInvert() const { return mbNormalsInvert
; }
77 bool getDoubleSided() const { return mbDoubleSided
; }
78 bool getShadow3D() const { return mbShadow3D
; }
79 bool getTextureFilter() const { return mbTextureFilter
; }
80 bool getReducedLineGeometry() const { return mbReducedLineGeometry
; }
82 bool operator==(const ImpSdr3DObjectAttribute
& rCandidate
) const
84 return (getNormalsKind() == rCandidate
.getNormalsKind()
85 && getTextureProjectionX() == rCandidate
.getTextureProjectionX()
86 && getTextureProjectionY() == rCandidate
.getTextureProjectionY()
87 && getTextureKind() == rCandidate
.getTextureKind()
88 && getTextureMode() == rCandidate
.getTextureMode()
89 && getMaterial() == rCandidate
.getMaterial()
90 && getNormalsInvert() == rCandidate
.getNormalsInvert()
91 && getDoubleSided() == rCandidate
.getDoubleSided()
92 && getShadow3D() == rCandidate
.getShadow3D()
93 && getTextureFilter() == rCandidate
.getTextureFilter()
94 && getReducedLineGeometry() == rCandidate
.getReducedLineGeometry());
98 Sdr3DObjectAttribute::Sdr3DObjectAttribute(
99 css::drawing::NormalsKind aNormalsKind
,
100 css::drawing::TextureProjectionMode aTextureProjectionX
,
101 css::drawing::TextureProjectionMode aTextureProjectionY
,
102 css::drawing::TextureKind2 aTextureKind
,
103 css::drawing::TextureMode aTextureMode
,
104 const MaterialAttribute3D
& rMaterial
,
109 bool bReducedLineGeometry
)
110 : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute(
111 aNormalsKind
, aTextureProjectionX
, aTextureProjectionY
, aTextureKind
, aTextureMode
,
112 rMaterial
, bNormalsInvert
, bDoubleSided
, bShadow3D
, bTextureFilter
, bReducedLineGeometry
))
116 Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute
&) = default;
118 Sdr3DObjectAttribute::~Sdr3DObjectAttribute() = default;
120 Sdr3DObjectAttribute
& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute
&) = default;
122 bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute
& rCandidate
) const
124 return rCandidate
.mpSdr3DObjectAttribute
== mpSdr3DObjectAttribute
;
127 css::drawing::NormalsKind
Sdr3DObjectAttribute::getNormalsKind() const
129 return mpSdr3DObjectAttribute
->getNormalsKind();
132 css::drawing::TextureProjectionMode
Sdr3DObjectAttribute::getTextureProjectionX() const
134 return mpSdr3DObjectAttribute
->getTextureProjectionX();
137 css::drawing::TextureProjectionMode
Sdr3DObjectAttribute::getTextureProjectionY() const
139 return mpSdr3DObjectAttribute
->getTextureProjectionY();
142 css::drawing::TextureKind2
Sdr3DObjectAttribute::getTextureKind() const
144 return mpSdr3DObjectAttribute
->getTextureKind();
147 css::drawing::TextureMode
Sdr3DObjectAttribute::getTextureMode() const
149 return mpSdr3DObjectAttribute
->getTextureMode();
152 const MaterialAttribute3D
& Sdr3DObjectAttribute::getMaterial() const
154 return mpSdr3DObjectAttribute
->getMaterial();
157 bool Sdr3DObjectAttribute::getNormalsInvert() const
159 return mpSdr3DObjectAttribute
->getNormalsInvert();
162 bool Sdr3DObjectAttribute::getDoubleSided() const
164 return mpSdr3DObjectAttribute
->getDoubleSided();
167 bool Sdr3DObjectAttribute::getShadow3D() const
169 return mpSdr3DObjectAttribute
->getShadow3D();
172 bool Sdr3DObjectAttribute::getTextureFilter() const
174 return mpSdr3DObjectAttribute
->getTextureFilter();
177 bool Sdr3DObjectAttribute::getReducedLineGeometry() const
179 return mpSdr3DObjectAttribute
->getReducedLineGeometry();
182 } // end of namespace
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */