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>
26 namespace drawinglayer
30 class ImpSdr3DObjectAttribute
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
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)
48 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
,
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 mbReducedLineGeometry(bReducedLineGeometry
)
75 ::com::sun::star::drawing::NormalsKind
getNormalsKind() const { return maNormalsKind
; }
76 ::com::sun::star::drawing::TextureProjectionMode
getTextureProjectionX() const { return maTextureProjectionX
; }
77 ::com::sun::star::drawing::TextureProjectionMode
getTextureProjectionY() const { return maTextureProjectionY
; }
78 ::com::sun::star::drawing::TextureKind2
getTextureKind() const { return maTextureKind
; }
79 ::com::sun::star::drawing::TextureMode
getTextureMode() const { return maTextureMode
; }
80 const MaterialAttribute3D
& getMaterial() const { return maMaterial
; }
81 bool getNormalsInvert() const { return mbNormalsInvert
; }
82 bool getDoubleSided() const { return mbDoubleSided
; }
83 bool getShadow3D() const { return mbShadow3D
; }
84 bool getTextureFilter() const { return mbTextureFilter
; }
85 bool getReducedLineGeometry() const { return mbReducedLineGeometry
; }
87 bool operator==(const ImpSdr3DObjectAttribute
& rCandidate
) const
89 return (getNormalsKind() == rCandidate
.getNormalsKind()
90 && getTextureProjectionX() == rCandidate
.getTextureProjectionX()
91 && getTextureProjectionY() == rCandidate
.getTextureProjectionY()
92 && getTextureKind() == rCandidate
.getTextureKind()
93 && getTextureMode() == rCandidate
.getTextureMode()
94 && getMaterial() == rCandidate
.getMaterial()
95 && getNormalsInvert() == rCandidate
.getNormalsInvert()
96 && getDoubleSided() == rCandidate
.getDoubleSided()
97 && getShadow3D() == rCandidate
.getShadow3D()
98 && getTextureFilter() == rCandidate
.getTextureFilter()
99 && getReducedLineGeometry() == rCandidate
.getReducedLineGeometry());
105 struct theGlobalDefault
:
106 public rtl::Static
< Sdr3DObjectAttribute::ImplType
, theGlobalDefault
> {};
109 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
,
120 bool bReducedLineGeometry
)
121 : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute(
122 aNormalsKind
, aTextureProjectionX
, aTextureProjectionY
, aTextureKind
, aTextureMode
,
123 rMaterial
, bNormalsInvert
, bDoubleSided
, bShadow3D
, bTextureFilter
, bReducedLineGeometry
))
127 Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute
& rCandidate
)
128 : mpSdr3DObjectAttribute(rCandidate
.mpSdr3DObjectAttribute
)
132 Sdr3DObjectAttribute::~Sdr3DObjectAttribute()
136 Sdr3DObjectAttribute
& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute
& rCandidate
)
138 mpSdr3DObjectAttribute
= rCandidate
.mpSdr3DObjectAttribute
;
142 bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute
& rCandidate
) const
144 return rCandidate
.mpSdr3DObjectAttribute
== mpSdr3DObjectAttribute
;
147 ::com::sun::star::drawing::NormalsKind
Sdr3DObjectAttribute::getNormalsKind() const
149 return mpSdr3DObjectAttribute
->getNormalsKind();
152 ::com::sun::star::drawing::TextureProjectionMode
Sdr3DObjectAttribute::getTextureProjectionX() const
154 return mpSdr3DObjectAttribute
->getTextureProjectionX();
157 ::com::sun::star::drawing::TextureProjectionMode
Sdr3DObjectAttribute::getTextureProjectionY() const
159 return mpSdr3DObjectAttribute
->getTextureProjectionY();
162 ::com::sun::star::drawing::TextureKind2
Sdr3DObjectAttribute::getTextureKind() const
164 return mpSdr3DObjectAttribute
->getTextureKind();
167 ::com::sun::star::drawing::TextureMode
Sdr3DObjectAttribute::getTextureMode() const
169 return mpSdr3DObjectAttribute
->getTextureMode();
172 const MaterialAttribute3D
& Sdr3DObjectAttribute::getMaterial() const
174 return mpSdr3DObjectAttribute
->getMaterial();
177 bool Sdr3DObjectAttribute::getNormalsInvert() const
179 return mpSdr3DObjectAttribute
->getNormalsInvert();
182 bool Sdr3DObjectAttribute::getDoubleSided() const
184 return mpSdr3DObjectAttribute
->getDoubleSided();
187 bool Sdr3DObjectAttribute::getShadow3D() const
189 return mpSdr3DObjectAttribute
->getShadow3D();
192 bool Sdr3DObjectAttribute::getTextureFilter() const
194 return mpSdr3DObjectAttribute
->getTextureFilter();
197 bool Sdr3DObjectAttribute::getReducedLineGeometry() const
199 return mpSdr3DObjectAttribute
->getReducedLineGeometry();
202 } // end of namespace attribute
203 } // end of namespace drawinglayer
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */