1*4f506f19SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*4f506f19SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*4f506f19SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*4f506f19SAndrew Rist * distributed with this work for additional information 6*4f506f19SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*4f506f19SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*4f506f19SAndrew Rist * "License"); you may not use this file except in compliance 9*4f506f19SAndrew Rist * with the License. You may obtain a copy of the License at 10*4f506f19SAndrew Rist * 11*4f506f19SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*4f506f19SAndrew Rist * 13*4f506f19SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*4f506f19SAndrew Rist * software distributed under the License is distributed on an 15*4f506f19SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*4f506f19SAndrew Rist * KIND, either express or implied. See the License for the 17*4f506f19SAndrew Rist * specific language governing permissions and limitations 18*4f506f19SAndrew Rist * under the License. 19*4f506f19SAndrew Rist * 20*4f506f19SAndrew Rist *************************************************************/ 21*4f506f19SAndrew Rist 22*4f506f19SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX 25cdf0e10cSrcweir #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX 26cdf0e10cSrcweir 27090f0eb8SEike Rathke #include <drawinglayer/drawinglayerdllapi.h> 28cdf0e10cSrcweir #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 29cdf0e10cSrcweir #include <drawinglayer/primitive3d/baseprimitive3d.hxx> 30cdf0e10cSrcweir #include <drawinglayer/geometry/viewinformation3d.hxx> 31cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 34cdf0e10cSrcweir // Embedded3DPrimitive2D class 35cdf0e10cSrcweir 36cdf0e10cSrcweir namespace drawinglayer 37cdf0e10cSrcweir { 38cdf0e10cSrcweir namespace primitive2d 39cdf0e10cSrcweir { 40cdf0e10cSrcweir /** Embedded3DPrimitive2D class 41cdf0e10cSrcweir 42cdf0e10cSrcweir This is a helper primitive which allows embedding of single 3D 43cdf0e10cSrcweir primitives to the 2D primitive logic. It will get the scene it's 44cdf0e10cSrcweir involved and thus the 3D transformation. With this information it 45cdf0e10cSrcweir is able to provide 2D range data for a 3D primitive. 46cdf0e10cSrcweir 47cdf0e10cSrcweir This primitive will not be visualized and decomposes to a yellow 48cdf0e10cSrcweir 2D rectangle to visualize that this should never be visualized 49cdf0e10cSrcweir */ 50090f0eb8SEike Rathke class DRAWINGLAYER_DLLPUBLIC Embedded3DPrimitive2D : public BufferedDecompositionPrimitive2D 51cdf0e10cSrcweir { 52cdf0e10cSrcweir private: 53cdf0e10cSrcweir /// the sequence of 3d primitives 54cdf0e10cSrcweir primitive3d::Primitive3DSequence mxChildren3D; 55cdf0e10cSrcweir 56cdf0e10cSrcweir /// the 2D scene object transformation 57cdf0e10cSrcweir basegfx::B2DHomMatrix maObjectTransformation; 58cdf0e10cSrcweir 59cdf0e10cSrcweir /// the 3D transformations 60cdf0e10cSrcweir geometry::ViewInformation3D maViewInformation3D; 61cdf0e10cSrcweir 62cdf0e10cSrcweir /** if the embedded 3D primitives contain shadow, these parameters are needed 63cdf0e10cSrcweir to extract the shadow wich is a sequence od 2D primitives and may expand 64cdf0e10cSrcweir the 2D range. Since every single 3D object in a scene may individually 65cdf0e10cSrcweir have shadow or not, these values need to be provided and prepared. The shadow 66cdf0e10cSrcweir distance itself (a 2D transformation) is part of the 3D shadow definition 67cdf0e10cSrcweir */ 68cdf0e10cSrcweir basegfx::B3DVector maLightNormal; 69cdf0e10cSrcweir double mfShadowSlant; 70cdf0e10cSrcweir basegfx::B3DRange maScene3DRange; 71cdf0e10cSrcweir 72cdf0e10cSrcweir /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked) 73cdf0e10cSrcweir Primitive2DSequence maShadowPrimitives; 74cdf0e10cSrcweir 75cdf0e10cSrcweir /// #i96669# add simple range buffering for this primitive 76cdf0e10cSrcweir basegfx::B2DRange maB2DRange; 77cdf0e10cSrcweir 78cdf0e10cSrcweir /// bitfield 79cdf0e10cSrcweir /** flag if given 3D geometry is already cheched for shadow definitions and 2d shadows 80cdf0e10cSrcweir are created in maShadowPrimitives 81cdf0e10cSrcweir */ 82cdf0e10cSrcweir unsigned mbShadow3DChecked : 1; 83cdf0e10cSrcweir 84cdf0e10cSrcweir /// private helpers 85cdf0e10cSrcweir bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const; 86cdf0e10cSrcweir 87cdf0e10cSrcweir protected: 88cdf0e10cSrcweir /// local decomposition. 89cdf0e10cSrcweir virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 90cdf0e10cSrcweir 91cdf0e10cSrcweir public: 92cdf0e10cSrcweir /// constructor 93cdf0e10cSrcweir Embedded3DPrimitive2D( 94cdf0e10cSrcweir const primitive3d::Primitive3DSequence& rxChildren3D, 95cdf0e10cSrcweir const basegfx::B2DHomMatrix& rObjectTransformation, 96cdf0e10cSrcweir const geometry::ViewInformation3D& rViewInformation3D, 97cdf0e10cSrcweir const basegfx::B3DVector& rLightNormal, 98cdf0e10cSrcweir double fShadowSlant, 99cdf0e10cSrcweir const basegfx::B3DRange& rScene3DRange); 100cdf0e10cSrcweir 101cdf0e10cSrcweir /// data read access getChildren3D() const102cdf0e10cSrcweir const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; } getObjectTransformation() const103cdf0e10cSrcweir const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } getViewInformation3D() const104cdf0e10cSrcweir const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; } getLightNormal() const105cdf0e10cSrcweir const basegfx::B3DVector& getLightNormal() const { return maLightNormal; } getShadowSlant() const106cdf0e10cSrcweir double getShadowSlant() const { return mfShadowSlant; } getScene3DRange() const107cdf0e10cSrcweir const basegfx::B3DRange& getScene3DRange() const { return maScene3DRange; } 108cdf0e10cSrcweir 109cdf0e10cSrcweir /// compare operator 110cdf0e10cSrcweir virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 111cdf0e10cSrcweir 112cdf0e10cSrcweir /// get range 113cdf0e10cSrcweir virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 114cdf0e10cSrcweir 115cdf0e10cSrcweir /// provide unique ID 116cdf0e10cSrcweir DeclPrimitrive2DIDBlock() 117cdf0e10cSrcweir }; 118cdf0e10cSrcweir } // end of namespace primitive2d 119cdf0e10cSrcweir } // end of namespace drawinglayer 120cdf0e10cSrcweir 121cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 122cdf0e10cSrcweir 123cdf0e10cSrcweir #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX 124cdf0e10cSrcweir 125cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 126cdf0e10cSrcweir // eof 127