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 0 : 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 0 : 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 0 : mbReducedLineGeometry(bReducedLineGeometry)
71 : {
72 0 : }
73 :
74 : // data read access
75 0 : ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; }
76 0 : ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; }
77 0 : ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; }
78 0 : ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; }
79 0 : ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; }
80 0 : const MaterialAttribute3D& getMaterial() const { return maMaterial; }
81 0 : bool getNormalsInvert() const { return mbNormalsInvert; }
82 0 : bool getDoubleSided() const { return mbDoubleSided; }
83 0 : bool getShadow3D() const { return mbShadow3D; }
84 0 : bool getTextureFilter() const { return mbTextureFilter; }
85 0 : bool getReducedLineGeometry() const { return mbReducedLineGeometry; }
86 :
87 0 : bool operator==(const ImpSdr3DObjectAttribute& rCandidate) const
88 : {
89 0 : return (getNormalsKind() == rCandidate.getNormalsKind()
90 0 : && getTextureProjectionX() == rCandidate.getTextureProjectionX()
91 0 : && getTextureProjectionY() == rCandidate.getTextureProjectionY()
92 0 : && getTextureKind() == rCandidate.getTextureKind()
93 0 : && getTextureMode() == rCandidate.getTextureMode()
94 0 : && getMaterial() == rCandidate.getMaterial()
95 0 : && getNormalsInvert() == rCandidate.getNormalsInvert()
96 0 : && getDoubleSided() == rCandidate.getDoubleSided()
97 0 : && getShadow3D() == rCandidate.getShadow3D()
98 0 : && getTextureFilter() == rCandidate.getTextureFilter()
99 0 : && getReducedLineGeometry() == rCandidate.getReducedLineGeometry());
100 : }
101 : };
102 :
103 : namespace
104 : {
105 : struct theGlobalDefault :
106 : public rtl::Static< Sdr3DObjectAttribute::ImplType, theGlobalDefault > {};
107 : }
108 :
109 0 : 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 0 : rMaterial, bNormalsInvert, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry))
124 : {
125 0 : }
126 :
127 0 : Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate)
128 0 : : mpSdr3DObjectAttribute(rCandidate.mpSdr3DObjectAttribute)
129 : {
130 0 : }
131 :
132 0 : Sdr3DObjectAttribute::~Sdr3DObjectAttribute()
133 : {
134 0 : }
135 :
136 0 : Sdr3DObjectAttribute& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute& rCandidate)
137 : {
138 0 : mpSdr3DObjectAttribute = rCandidate.mpSdr3DObjectAttribute;
139 0 : return *this;
140 : }
141 :
142 0 : bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const
143 : {
144 0 : return rCandidate.mpSdr3DObjectAttribute == mpSdr3DObjectAttribute;
145 : }
146 :
147 0 : ::com::sun::star::drawing::NormalsKind Sdr3DObjectAttribute::getNormalsKind() const
148 : {
149 0 : return mpSdr3DObjectAttribute->getNormalsKind();
150 : }
151 :
152 0 : ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionX() const
153 : {
154 0 : return mpSdr3DObjectAttribute->getTextureProjectionX();
155 : }
156 :
157 0 : ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionY() const
158 : {
159 0 : return mpSdr3DObjectAttribute->getTextureProjectionY();
160 : }
161 :
162 0 : ::com::sun::star::drawing::TextureKind2 Sdr3DObjectAttribute::getTextureKind() const
163 : {
164 0 : return mpSdr3DObjectAttribute->getTextureKind();
165 : }
166 :
167 0 : ::com::sun::star::drawing::TextureMode Sdr3DObjectAttribute::getTextureMode() const
168 : {
169 0 : return mpSdr3DObjectAttribute->getTextureMode();
170 : }
171 :
172 0 : const MaterialAttribute3D& Sdr3DObjectAttribute::getMaterial() const
173 : {
174 0 : return mpSdr3DObjectAttribute->getMaterial();
175 : }
176 :
177 0 : bool Sdr3DObjectAttribute::getNormalsInvert() const
178 : {
179 0 : return mpSdr3DObjectAttribute->getNormalsInvert();
180 : }
181 :
182 0 : bool Sdr3DObjectAttribute::getDoubleSided() const
183 : {
184 0 : return mpSdr3DObjectAttribute->getDoubleSided();
185 : }
186 :
187 0 : bool Sdr3DObjectAttribute::getShadow3D() const
188 : {
189 0 : return mpSdr3DObjectAttribute->getShadow3D();
190 : }
191 :
192 0 : bool Sdr3DObjectAttribute::getTextureFilter() const
193 : {
194 0 : return mpSdr3DObjectAttribute->getTextureFilter();
195 : }
196 :
197 0 : bool Sdr3DObjectAttribute::getReducedLineGeometry() const
198 : {
199 0 : return mpSdr3DObjectAttribute->getReducedLineGeometry();
200 : }
201 :
202 : } // end of namespace attribute
203 : } // end of namespace drawinglayer
204 :
205 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|