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 namespace drawinglayer 26 { 27 namespace attribute 28 { 29 class ImpSdr3DObjectAttribute 30 { 31 public: 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 39 40 bool mbNormalsInvert : 1; // invert normals 41 bool mbDoubleSided : 1; // surfaces are double sided 42 bool mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene 43 bool mbTextureFilter : 1; // filter texture to make more smooth 44 bool mbReducedLineGeometry : 1; // use reduced line geometry (object specific) 45 ImpSdr3DObjectAttribute(css::drawing::NormalsKind aNormalsKind,css::drawing::TextureProjectionMode aTextureProjectionX,css::drawing::TextureProjectionMode aTextureProjectionY,css::drawing::TextureKind2 aTextureKind,css::drawing::TextureMode aTextureMode,const MaterialAttribute3D & rMaterial,bool bNormalsInvert,bool bDoubleSided,bool bShadow3D,bool bTextureFilter,bool bReducedLineGeometry)46 ImpSdr3DObjectAttribute( 47 css::drawing::NormalsKind aNormalsKind, 48 css::drawing::TextureProjectionMode aTextureProjectionX, 49 css::drawing::TextureProjectionMode aTextureProjectionY, 50 css::drawing::TextureKind2 aTextureKind, 51 css::drawing::TextureMode aTextureMode, 52 const MaterialAttribute3D& rMaterial, 53 bool bNormalsInvert, 54 bool bDoubleSided, 55 bool bShadow3D, 56 bool bTextureFilter, 57 bool bReducedLineGeometry) 58 : maNormalsKind(aNormalsKind), 59 maTextureProjectionX(aTextureProjectionX), 60 maTextureProjectionY(aTextureProjectionY), 61 maTextureKind(aTextureKind), 62 maTextureMode(aTextureMode), 63 maMaterial(rMaterial), 64 mbNormalsInvert(bNormalsInvert), 65 mbDoubleSided(bDoubleSided), 66 mbShadow3D(bShadow3D), 67 mbTextureFilter(bTextureFilter), 68 mbReducedLineGeometry(bReducedLineGeometry) 69 { 70 } 71 72 // data read access getNormalsKind() const73 css::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; } getTextureProjectionX() const74 css::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; } getTextureProjectionY() const75 css::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; } getTextureKind() const76 css::drawing::TextureKind2 getTextureKind() const { return maTextureKind; } getTextureMode() const77 css::drawing::TextureMode getTextureMode() const { return maTextureMode; } getMaterial() const78 const MaterialAttribute3D& getMaterial() const { return maMaterial; } getNormalsInvert() const79 bool getNormalsInvert() const { return mbNormalsInvert; } getDoubleSided() const80 bool getDoubleSided() const { return mbDoubleSided; } getShadow3D() const81 bool getShadow3D() const { return mbShadow3D; } getTextureFilter() const82 bool getTextureFilter() const { return mbTextureFilter; } getReducedLineGeometry() const83 bool getReducedLineGeometry() const { return mbReducedLineGeometry; } 84 operator ==(const ImpSdr3DObjectAttribute & rCandidate) const85 bool operator==(const ImpSdr3DObjectAttribute& rCandidate) const 86 { 87 return (getNormalsKind() == rCandidate.getNormalsKind() 88 && getTextureProjectionX() == rCandidate.getTextureProjectionX() 89 && getTextureProjectionY() == rCandidate.getTextureProjectionY() 90 && getTextureKind() == rCandidate.getTextureKind() 91 && getTextureMode() == rCandidate.getTextureMode() 92 && getMaterial() == rCandidate.getMaterial() 93 && getNormalsInvert() == rCandidate.getNormalsInvert() 94 && getDoubleSided() == rCandidate.getDoubleSided() 95 && getShadow3D() == rCandidate.getShadow3D() 96 && getTextureFilter() == rCandidate.getTextureFilter() 97 && getReducedLineGeometry() == rCandidate.getReducedLineGeometry()); 98 } 99 }; 100 101 namespace 102 { 103 struct theGlobalDefault : 104 public rtl::Static< Sdr3DObjectAttribute::ImplType, theGlobalDefault > {}; 105 } 106 Sdr3DObjectAttribute(css::drawing::NormalsKind aNormalsKind,css::drawing::TextureProjectionMode aTextureProjectionX,css::drawing::TextureProjectionMode aTextureProjectionY,css::drawing::TextureKind2 aTextureKind,css::drawing::TextureMode aTextureMode,const MaterialAttribute3D & rMaterial,bool bNormalsInvert,bool bDoubleSided,bool bShadow3D,bool bTextureFilter,bool bReducedLineGeometry)107 Sdr3DObjectAttribute::Sdr3DObjectAttribute( 108 css::drawing::NormalsKind aNormalsKind, 109 css::drawing::TextureProjectionMode aTextureProjectionX, 110 css::drawing::TextureProjectionMode aTextureProjectionY, 111 css::drawing::TextureKind2 aTextureKind, 112 css::drawing::TextureMode aTextureMode, 113 const MaterialAttribute3D& rMaterial, 114 bool bNormalsInvert, 115 bool bDoubleSided, 116 bool bShadow3D, 117 bool bTextureFilter, 118 bool bReducedLineGeometry) 119 : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute( 120 aNormalsKind, aTextureProjectionX, aTextureProjectionY, aTextureKind, aTextureMode, 121 rMaterial, bNormalsInvert, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry)) 122 { 123 } 124 125 Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute&) = default; 126 127 Sdr3DObjectAttribute::~Sdr3DObjectAttribute() = default; 128 129 Sdr3DObjectAttribute& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute&) = default; 130 operator ==(const Sdr3DObjectAttribute & rCandidate) const131 bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const 132 { 133 return rCandidate.mpSdr3DObjectAttribute == mpSdr3DObjectAttribute; 134 } 135 getNormalsKind() const136 css::drawing::NormalsKind Sdr3DObjectAttribute::getNormalsKind() const 137 { 138 return mpSdr3DObjectAttribute->getNormalsKind(); 139 } 140 getTextureProjectionX() const141 css::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionX() const 142 { 143 return mpSdr3DObjectAttribute->getTextureProjectionX(); 144 } 145 getTextureProjectionY() const146 css::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionY() const 147 { 148 return mpSdr3DObjectAttribute->getTextureProjectionY(); 149 } 150 getTextureKind() const151 css::drawing::TextureKind2 Sdr3DObjectAttribute::getTextureKind() const 152 { 153 return mpSdr3DObjectAttribute->getTextureKind(); 154 } 155 getTextureMode() const156 css::drawing::TextureMode Sdr3DObjectAttribute::getTextureMode() const 157 { 158 return mpSdr3DObjectAttribute->getTextureMode(); 159 } 160 getMaterial() const161 const MaterialAttribute3D& Sdr3DObjectAttribute::getMaterial() const 162 { 163 return mpSdr3DObjectAttribute->getMaterial(); 164 } 165 getNormalsInvert() const166 bool Sdr3DObjectAttribute::getNormalsInvert() const 167 { 168 return mpSdr3DObjectAttribute->getNormalsInvert(); 169 } 170 getDoubleSided() const171 bool Sdr3DObjectAttribute::getDoubleSided() const 172 { 173 return mpSdr3DObjectAttribute->getDoubleSided(); 174 } 175 getShadow3D() const176 bool Sdr3DObjectAttribute::getShadow3D() const 177 { 178 return mpSdr3DObjectAttribute->getShadow3D(); 179 } 180 getTextureFilter() const181 bool Sdr3DObjectAttribute::getTextureFilter() const 182 { 183 return mpSdr3DObjectAttribute->getTextureFilter(); 184 } 185 getReducedLineGeometry() const186 bool Sdr3DObjectAttribute::getReducedLineGeometry() const 187 { 188 return mpSdr3DObjectAttribute->getReducedLineGeometry(); 189 } 190 191 } // end of namespace attribute 192 } // end of namespace drawinglayer 193 194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 195