LCOV - code coverage report
Current view: top level - include/drawinglayer/processor3d - shadow3dextractor.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          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             : #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/processor3d/baseprocessor3d.hxx>
      26             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      27             : #include <basegfx/matrix/b3dhommatrix.hxx>
      28             : #include <basegfx/color/bcolor.hxx>
      29             : #include <basegfx/polygon/b2dpolygon.hxx>
      30             : #include <basegfx/polygon/b3dpolygon.hxx>
      31             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      32             : #include <basegfx/polygon/b3dpolypolygon.hxx>
      33             : #include <basegfx/matrix/b2dhommatrix.hxx>
      34             : 
      35             : 
      36             : 
      37             : namespace drawinglayer
      38             : {
      39             :     namespace processor3d
      40             :     {
      41             :         /** Shadow3DExtractingProcessor class
      42             : 
      43             :             This processor extracts the 2D shadow geometry (projected geometry) of all feeded primitives.
      44             :             It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite
      45             :             some data to do so since we do not only offer flat projected 2D shadow, but also projections
      46             :             dependent on the light source
      47             :          */
      48             :         class DRAWINGLAYER_DLLPUBLIC Shadow3DExtractingProcessor : public BaseProcessor3D
      49             :         {
      50             :         private:
      51             :             /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence)
      52             :             primitive2d::Primitive2DVector                  maPrimitive2DSequence;
      53             :             primitive2d::Primitive2DVector*                 mpPrimitive2DSequence;
      54             : 
      55             :             /// object transformation for scene for 2d definition
      56             :             basegfx::B2DHomMatrix                           maObjectTransformation;
      57             : 
      58             :             /// prepared data (transformations) for 2D/3D shadow calculations
      59             :             basegfx::B3DHomMatrix                           maWorldToEye;
      60             :             basegfx::B3DHomMatrix                           maEyeToView;
      61             :             basegfx::B3DVector                              maLightNormal;
      62             :             basegfx::B3DVector                              maShadowPlaneNormal;
      63             :             basegfx::B3DPoint                               maPlanePoint;
      64             :             double                                          mfLightPlaneScalar;
      65             : 
      66             :             /*  the shadow color used for sub-primitives. Can stay at black since
      67             :                 the encapsulating 2d shadow primitive will contain the color
      68             :              */
      69             :             basegfx::BColor                                 maPrimitiveColor;
      70             : 
      71             :             /// bitfield
      72             :             /// flag if shadow plane projection preparation leaded to valid results
      73             :             bool                                            mbShadowProjectionIsValid : 1;
      74             : 
      75             :             /// flag if conversion is switched on
      76             :             bool                                            mbConvert : 1;
      77             : 
      78             :             /// flag if conversion shall use projection
      79             :             bool                                            mbUseProjection : 1;
      80             : 
      81             :             /// local helpers
      82             :             basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource);
      83             :             basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource);
      84             : 
      85             :             /*  as tooling, the process() implementation takes over API handling and calls this
      86             :                 virtual render method when the primitive implementation is BasePrimitive3D-based.
      87             :              */
      88             :             virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) SAL_OVERRIDE;
      89             : 
      90             :         public:
      91             :             Shadow3DExtractingProcessor(
      92             :                 const geometry::ViewInformation3D& rViewInformation,
      93             :                 const basegfx::B2DHomMatrix& rObjectTransformation,
      94             :                 const basegfx::B3DVector& rLightNormal,
      95             :                 double fShadowSlant,
      96             :                 const basegfx::B3DRange& rContained3DRange);
      97             :             virtual ~Shadow3DExtractingProcessor();
      98             : 
      99             :             /// data read access
     100             :             const primitive2d::Primitive2DSequence getPrimitive2DSequence() const;
     101           0 :             const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
     102           0 :             const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; }
     103           0 :             const basegfx::B3DHomMatrix& getEyeToView() const { return maEyeToView; }
     104             :         };
     105             :     } // end of namespace processor3d
     106             : } // end of namespace drawinglayer
     107             : 
     108             : #endif //_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10