LCOV - code coverage report
Current view: top level - libreoffice/drawinglayer/source/processor3d - defaultprocessor3d.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 228 0.0 %
Date: 2012-12-27 Functions: 0 11 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             : #include <drawinglayer/processor3d/defaultprocessor3d.hxx>
      21             : #include <drawinglayer/primitive3d/textureprimitive3d.hxx>
      22             : #include <drawinglayer/texture/texture.hxx>
      23             : #include <drawinglayer/texture/texture3d.hxx>
      24             : #include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
      25             : #include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
      26             : #include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
      27             : #include <basegfx/polygon/b3dpolygontools.hxx>
      28             : #include <drawinglayer/attribute/materialattribute3d.hxx>
      29             : #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
      30             : #include <basegfx/polygon/b3dpolypolygontools.hxx>
      31             : #include <com/sun/star/drawing/ShadeMode.hpp>
      32             : #include <drawinglayer/primitive3d/transformprimitive3d.hxx>
      33             : #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
      34             : #include <vcl/bitmapex.hxx>
      35             : #include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
      36             : #include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
      37             : 
      38             : //////////////////////////////////////////////////////////////////////////////
      39             : 
      40             : using namespace com::sun::star;
      41             : 
      42             : //////////////////////////////////////////////////////////////////////////////
      43             : 
      44             : namespace drawinglayer
      45             : {
      46             :     namespace processor3d
      47             :     {
      48           0 :         void DefaultProcessor3D::impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence)
      49             :         {
      50           0 :             const primitive3d::Primitive3DSequence& rSubSequence = rPrimitive.getChildren();
      51             : 
      52           0 :             if(rSubSequence.hasElements())
      53             :             {
      54             :                 // rescue values
      55           0 :                 const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
      56           0 :                 const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
      57           0 :                 const bool bOldSimpleTextureActive(getSimpleTextureActive());
      58           0 :                 boost::shared_ptr< texture::GeoTexSvx > pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx;
      59             : 
      60             :                 // create texture
      61           0 :                 const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient();
      62           0 :                 const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY());
      63           0 :                 const attribute::GradientStyle aGradientStyle(rFillGradient.getStyle());
      64           0 :                 sal_uInt32 nSteps(rFillGradient.getSteps());
      65           0 :                 const basegfx::BColor aStart(rFillGradient.getStartColor());
      66           0 :                 const basegfx::BColor aEnd(rFillGradient.getEndColor());
      67           0 :                 const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5));
      68           0 :                 boost::shared_ptr< texture::GeoTexSvx > pNewTex;
      69             : 
      70           0 :                 if(nMaxSteps)
      71             :                 {
      72             :                     // there IS a color distance
      73           0 :                     if(nSteps == 0L)
      74             :                     {
      75           0 :                         nSteps = nMaxSteps;
      76             :                     }
      77             : 
      78           0 :                     if(nSteps < 2L)
      79             :                     {
      80           0 :                         nSteps = 2L;
      81             :                     }
      82             : 
      83           0 :                     if(nSteps > nMaxSteps)
      84             :                     {
      85           0 :                         nSteps = nMaxSteps;
      86             :                     }
      87             : 
      88           0 :                     switch(aGradientStyle)
      89             :                     {
      90             :                         case attribute::GRADIENTSTYLE_LINEAR:
      91             :                         {
      92           0 :                             pNewTex.reset(new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle()));
      93           0 :                             break;
      94             :                         }
      95             :                         case attribute::GRADIENTSTYLE_AXIAL:
      96             :                         {
      97           0 :                             pNewTex.reset(new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle()));
      98           0 :                             break;
      99             :                         }
     100             :                         case attribute::GRADIENTSTYLE_RADIAL:
     101             :                         {
     102           0 :                             pNewTex.reset(new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY()));
     103           0 :                             break;
     104             :                         }
     105             :                         case attribute::GRADIENTSTYLE_ELLIPTICAL:
     106             :                         {
     107           0 :                             pNewTex.reset(new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
     108           0 :                             break;
     109             :                         }
     110             :                         case attribute::GRADIENTSTYLE_SQUARE:
     111             :                         {
     112           0 :                             pNewTex.reset(new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
     113           0 :                             break;
     114             :                         }
     115             :                         case attribute::GRADIENTSTYLE_RECT:
     116             :                         {
     117           0 :                             pNewTex.reset(new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
     118           0 :                             break;
     119             :                         }
     120             :                     }
     121             : 
     122           0 :                     mbSimpleTextureActive = false;
     123             :                 }
     124             :                 else
     125             :                 {
     126             :                     // no color distance -> same color, use simple texture
     127           0 :                     pNewTex.reset(new texture::GeoTexSvxMono(aStart, 1.0 - aStart.luminance()));
     128           0 :                     mbSimpleTextureActive = true;
     129             :                 }
     130             : 
     131             :                 // set created texture
     132           0 :                 if(bTransparence)
     133             :                 {
     134           0 :                     mpTransparenceGeoTexSvx = pNewTex;
     135             :                 }
     136             :                 else
     137             :                 {
     138           0 :                     mpGeoTexSvx = pNewTex;
     139             :                 }
     140             : 
     141             :                 // process sub-list
     142           0 :                 process(rSubSequence);
     143             : 
     144             :                 // restore values
     145           0 :                 mbModulate = bOldModulate;
     146           0 :                 mbFilter = bOldFilter;
     147           0 :                 mbSimpleTextureActive = bOldSimpleTextureActive;
     148             : 
     149           0 :                 if(bTransparence)
     150             :                 {
     151           0 :                     mpTransparenceGeoTexSvx = pOldTex;
     152             :                 }
     153             :                 else
     154             :                 {
     155           0 :                     mpGeoTexSvx = pOldTex;
     156           0 :                 }
     157           0 :             }
     158           0 :         }
     159             : 
     160           0 :         void DefaultProcessor3D::impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive)
     161             :         {
     162           0 :             const primitive3d::Primitive3DSequence& rSubSequence = rPrimitive.getChildren();
     163             : 
     164           0 :             if(rSubSequence.hasElements())
     165             :             {
     166             :                 // rescue values
     167           0 :                 const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
     168           0 :                 const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
     169           0 :                 boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx;
     170             : 
     171             :                 // calculate logic pixel size in object coordinates. Create transformation view
     172             :                 // to object by inverting ObjectToView
     173           0 :                 basegfx::B3DHomMatrix aInvObjectToView(getViewInformation3D().getObjectToView());
     174           0 :                 aInvObjectToView.invert();
     175             : 
     176             :                 // back-project discrete coordinates to object coordinates and extract
     177             :                 // maximum distance
     178           0 :                 const basegfx::B3DPoint aZero(aInvObjectToView * basegfx::B3DPoint(0.0, 0.0, 0.0));
     179           0 :                 const basegfx::B3DPoint aOne(aInvObjectToView * basegfx::B3DPoint(1.0, 1.0, 1.0));
     180           0 :                 const basegfx::B3DVector aLogicPixel(aOne - aZero);
     181           0 :                 double fLogicPixelSizeWorld(::std::max(::std::max(fabs(aLogicPixel.getX()), fabs(aLogicPixel.getY())), fabs(aLogicPixel.getZ())));
     182             : 
     183             :                 // calculate logic pixel size in texture coordinates
     184           0 :                 const double fLogicTexSizeX(fLogicPixelSizeWorld / rPrimitive.getTextureSize().getX());
     185           0 :                 const double fLogicTexSizeY(fLogicPixelSizeWorld / rPrimitive.getTextureSize().getY());
     186           0 :                 const double fLogicTexSize(fLogicTexSizeX > fLogicTexSizeY ? fLogicTexSizeX : fLogicTexSizeY);
     187             : 
     188             :                 // create texture and set
     189           0 :                 mpGeoTexSvx.reset(new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize));
     190             : 
     191             :                 // process sub-list
     192           0 :                 process(rSubSequence);
     193             : 
     194             :                 // restore values
     195           0 :                 mbModulate = bOldModulate;
     196           0 :                 mbFilter = bOldFilter;
     197           0 :                 mpGeoTexSvx = pOldTex;
     198           0 :             }
     199           0 :         }
     200             : 
     201           0 :         void DefaultProcessor3D::impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive)
     202             :         {
     203           0 :             const primitive3d::Primitive3DSequence& rSubSequence = rPrimitive.getChildren();
     204             : 
     205           0 :             if(rSubSequence.hasElements())
     206             :             {
     207             :                 // rescue values
     208           0 :                 const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
     209           0 :                 const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
     210           0 :                 boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx;
     211             : 
     212             :                 // create texture
     213           0 :                 const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getFillBitmapAttribute();
     214             : 
     215           0 :                 if(rFillBitmapAttribute.getTiling())
     216             :                 {
     217             :                     mpGeoTexSvx.reset(new texture::GeoTexSvxBitmapTiled(
     218           0 :                         rFillBitmapAttribute.getBitmapEx().GetBitmap(),
     219           0 :                         rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(),
     220           0 :                         rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()));
     221             :                 }
     222             :                 else
     223             :                 {
     224             :                     mpGeoTexSvx.reset(new texture::GeoTexSvxBitmap(
     225           0 :                         rFillBitmapAttribute.getBitmapEx().GetBitmap(),
     226           0 :                         rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(),
     227           0 :                         rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()));
     228             :                 }
     229             : 
     230             :                 // process sub-list
     231           0 :                 process(rSubSequence);
     232             : 
     233             :                 // restore values
     234           0 :                 mbModulate = bOldModulate;
     235           0 :                 mbFilter = bOldFilter;
     236           0 :                 mpGeoTexSvx = pOldTex;
     237           0 :             }
     238           0 :         }
     239             : 
     240           0 :         void DefaultProcessor3D::impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate)
     241             :         {
     242           0 :             const primitive3d::Primitive3DSequence& rSubSequence = rModifiedCandidate.getChildren();
     243             : 
     244           0 :             if(rSubSequence.hasElements())
     245             :             {
     246             :                 // put modifier on stack
     247           0 :                 maBColorModifierStack.push(rModifiedCandidate.getColorModifier());
     248             : 
     249             :                 // process sub-list
     250           0 :                 process(rModifiedCandidate.getChildren());
     251             : 
     252             :                 // remove modifier from stack
     253           0 :                 maBColorModifierStack.pop();
     254           0 :             }
     255           0 :         }
     256             : 
     257           0 :         void DefaultProcessor3D::impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive)
     258             :         {
     259           0 :             basegfx::B3DPolygon aHairline(rPrimitive.getB3DPolygon());
     260             : 
     261           0 :             if(aHairline.count())
     262             :             {
     263             :                 // hairlines need no extra data, clear it
     264           0 :                 aHairline.clearTextureCoordinates();
     265           0 :                 aHairline.clearNormals();
     266           0 :                 aHairline.clearBColors();
     267             : 
     268             :                 // transform to device coordinates (-1.0 .. 1.0) and check for visibility
     269           0 :                 aHairline.transform(getViewInformation3D().getObjectToView());
     270           0 :                 const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aHairline));
     271           0 :                 const basegfx::B2DRange a2DRange(a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY());
     272             : 
     273           0 :                 if(a2DRange.overlaps(maRasterRange))
     274             :                 {
     275           0 :                     const attribute::MaterialAttribute3D aMaterial(maBColorModifierStack.getModifiedColor(rPrimitive.getBColor()));
     276             : 
     277           0 :                     rasterconvertB3DPolygon(aMaterial, aHairline);
     278             :                 }
     279           0 :             }
     280           0 :         }
     281             : 
     282           0 :         void DefaultProcessor3D::impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive)
     283             :         {
     284           0 :             basegfx::B3DPolyPolygon aFill(rPrimitive.getB3DPolyPolygon());
     285           0 :             basegfx::BColor aObjectColor(rPrimitive.getMaterial().getColor());
     286           0 :             bool bPaintIt(aFill.count());
     287             : 
     288             :             // #i98295# get ShadeMode. Correct early when only flat is possible due to missing normals
     289             :             const ::com::sun::star::drawing::ShadeMode aShadeMode(
     290           0 :                 aFill.areNormalsUsed() ?
     291           0 :                     getSdrSceneAttribute().getShadeMode() : ::com::sun::star::drawing::ShadeMode_FLAT);
     292             : 
     293           0 :             if(bPaintIt)
     294             :             {
     295             :                 // get rid of texture coordinates if there is no texture
     296           0 :                 if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx().get() && !getTransparenceGeoTexSvx().get())
     297             :                 {
     298           0 :                     aFill.clearTextureCoordinates();
     299             :                 }
     300             : 
     301             :                 // #i98295# get rid of normals and color early when not needed
     302           0 :                 if(::com::sun::star::drawing::ShadeMode_FLAT == aShadeMode)
     303             :                 {
     304           0 :                     aFill.clearNormals();
     305           0 :                     aFill.clearBColors();
     306             :                 }
     307             : 
     308             :                 // transform to device coordinates (-1.0 .. 1.0) and check for visibility
     309           0 :                 aFill.transform(getViewInformation3D().getObjectToView());
     310           0 :                 const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aFill));
     311           0 :                 const basegfx::B2DRange a2DRange(a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY());
     312             : 
     313           0 :                 bPaintIt = a2DRange.overlaps(maRasterRange);
     314             :             }
     315             : 
     316             :             // check if it shall be painted regarding hiding of normals (backface culling)
     317           0 :             if(bPaintIt && !rPrimitive.getDoubleSided())
     318             :             {
     319             :                 // get plane normal of polygon in view coordinates (with ZBuffer values),
     320             :                 // left-handed coordinate system
     321           0 :                 const basegfx::B3DVector aPlaneNormal(aFill.getB3DPolygon(0L).getNormal());
     322             : 
     323           0 :                 if(aPlaneNormal.getZ() > 0.0)
     324             :                 {
     325           0 :                     bPaintIt = false;
     326           0 :                 }
     327             :             }
     328             : 
     329           0 :             if(bPaintIt)
     330             :             {
     331             :                 // prepare ObjectToEye in NormalTransform
     332           0 :                 basegfx::B3DHomMatrix aNormalTransform(getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation());
     333             : 
     334           0 :                 if(getSdrSceneAttribute().getTwoSidedLighting())
     335             :                 {
     336             :                     // get plane normal of polygon in view coordinates (with ZBuffer values),
     337             :                     // left-handed coordinate system
     338           0 :                     const basegfx::B3DVector aPlaneNormal(aFill.getB3DPolygon(0L).getNormal());
     339             : 
     340           0 :                     if(aPlaneNormal.getZ() > 0.0)
     341             :                     {
     342             :                         // mirror normals
     343           0 :                         aNormalTransform.scale(-1.0, -1.0, -1.0);
     344           0 :                     }
     345             :                 }
     346             : 
     347           0 :                 switch(aShadeMode)
     348             :                 {
     349             :                     case ::com::sun::star::drawing::ShadeMode_PHONG:
     350             :                     {
     351             :                         // phong shading. Transform normals to eye coor
     352           0 :                         aFill.transformNormals(aNormalTransform);
     353           0 :                         break;
     354             :                     }
     355             :                     case ::com::sun::star::drawing::ShadeMode_SMOOTH:
     356             :                     {
     357             :                         // gouraud shading. Transform normals to eye coor
     358           0 :                         aFill.transformNormals(aNormalTransform);
     359             : 
     360             :                         // prepare color model parameters, evtl. use blend color
     361           0 :                         const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor());
     362           0 :                         const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular());
     363           0 :                         const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission());
     364           0 :                         const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity());
     365             : 
     366             :                         // solve color model for each normal vector, set colors at points. Clear normals.
     367           0 :                         for(sal_uInt32 a(0L); a < aFill.count(); a++)
     368             :                         {
     369           0 :                             basegfx::B3DPolygon aPartFill(aFill.getB3DPolygon(a));
     370             : 
     371           0 :                             for(sal_uInt32 b(0L); b < aPartFill.count(); b++)
     372             :                             {
     373             :                                 // solve color model. Transform normal to eye coor
     374           0 :                                 const basegfx::B3DVector aNormal(aPartFill.getNormal(b));
     375           0 :                                 const basegfx::BColor aSolvedColor(getSdrLightingAttribute().solveColorModel(aNormal, aColor, rSpecular, rEmission, nSpecularIntensity));
     376           0 :                                 aPartFill.setBColor(b, aSolvedColor);
     377           0 :                             }
     378             : 
     379             :                             // clear normals on this part polygon and write it back
     380           0 :                             aPartFill.clearNormals();
     381           0 :                             aFill.setB3DPolygon(a, aPartFill);
     382           0 :                         }
     383           0 :                         break;
     384             :                     }
     385             :                     case ::com::sun::star::drawing::ShadeMode_FLAT:
     386             :                     {
     387             :                         // flat shading. Get plane vector in eye coordinates
     388           0 :                         const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0L).getNormal());
     389             : 
     390             :                         // prepare color model parameters, evtl. use blend color
     391           0 :                         const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor());
     392           0 :                         const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular());
     393           0 :                         const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission());
     394           0 :                         const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity());
     395             : 
     396             :                         // solve color model for plane vector and use that color for whole plane
     397           0 :                         aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity);
     398           0 :                         break;
     399             :                     }
     400             :                     default: // case ::com::sun::star::drawing::ShadeMode_DRAFT:
     401             :                     {
     402             :                         // draft, just use object color which is already set. Delete all other infos
     403           0 :                         aFill.clearNormals();
     404           0 :                         aFill.clearBColors();
     405           0 :                         break;
     406             :                     }
     407             :                 }
     408             : 
     409             :                 // draw it to ZBuffer
     410             :                 const attribute::MaterialAttribute3D aMaterial(
     411             :                     maBColorModifierStack.getModifiedColor(aObjectColor),
     412           0 :                     rPrimitive.getMaterial().getSpecular(),
     413           0 :                     rPrimitive.getMaterial().getEmission(),
     414           0 :                     rPrimitive.getMaterial().getSpecularIntensity());
     415             : 
     416           0 :                 rasterconvertB3DPolyPolygon(aMaterial, aFill);
     417           0 :             }
     418           0 :         }
     419             : 
     420           0 :         void DefaultProcessor3D::impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate)
     421             :         {
     422             :             // transform group. Remember current transformations
     423           0 :             const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
     424             : 
     425             :             // create new transformation; add new object transform from right side
     426             :             const geometry::ViewInformation3D aNewViewInformation3D(
     427           0 :                 aLastViewInformation3D.getObjectTransformation() * rTransformCandidate.getTransformation(),
     428           0 :                 aLastViewInformation3D.getOrientation(),
     429           0 :                 aLastViewInformation3D.getProjection(),
     430           0 :                 aLastViewInformation3D.getDeviceToView(),
     431             :                 aLastViewInformation3D.getViewTime(),
     432           0 :                 aLastViewInformation3D.getExtendedInformationSequence());
     433           0 :             updateViewInformation(aNewViewInformation3D);
     434             : 
     435             :             // let break down recursively
     436           0 :             process(rTransformCandidate.getChildren());
     437             : 
     438             :             // restore transformations
     439           0 :             updateViewInformation(aLastViewInformation3D);
     440           0 :         }
     441             : 
     442           0 :         void DefaultProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive)
     443             :         {
     444             :             // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch
     445           0 :             switch(rBasePrimitive.getPrimitive3DID())
     446             :             {
     447             :                 case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D :
     448             :                 {
     449             :                     // GradientTexturePrimitive3D
     450           0 :                     const primitive3d::GradientTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::GradientTexturePrimitive3D& >(rBasePrimitive);
     451           0 :                     impRenderGradientTexturePrimitive3D(rPrimitive, false);
     452           0 :                     break;
     453             :                 }
     454             :                 case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D :
     455             :                 {
     456             :                     // HatchTexturePrimitive3D
     457             :                     static bool bDoHatchDecomposition(false);
     458             : 
     459           0 :                     if(bDoHatchDecomposition)
     460             :                     {
     461             :                         // let break down
     462           0 :                         process(rBasePrimitive.get3DDecomposition(getViewInformation3D()));
     463             :                     }
     464             :                     else
     465             :                     {
     466             :                         // hatchTexturePrimitive3D
     467           0 :                         const primitive3d::HatchTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::HatchTexturePrimitive3D& >(rBasePrimitive);
     468           0 :                         impRenderHatchTexturePrimitive3D(rPrimitive);
     469             :                     }
     470           0 :                     break;
     471             :                 }
     472             :                 case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D :
     473             :                 {
     474             :                     // BitmapTexturePrimitive3D
     475           0 :                     const primitive3d::BitmapTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::BitmapTexturePrimitive3D& >(rBasePrimitive);
     476           0 :                     impRenderBitmapTexturePrimitive3D(rPrimitive);
     477           0 :                     break;
     478             :                 }
     479             :                 case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D :
     480             :                 {
     481             :                     // TransparenceTexturePrimitive3D
     482           0 :                     const primitive3d::TransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::TransparenceTexturePrimitive3D& >(rBasePrimitive);
     483           0 :                     mnTransparenceCounter++;
     484           0 :                     impRenderGradientTexturePrimitive3D(rPrimitive, true);
     485           0 :                     mnTransparenceCounter--;
     486           0 :                     break;
     487             :                 }
     488             :                 case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D :
     489             :                 {
     490             :                     // ModifiedColorPrimitive3D
     491             :                     // Force output to unified color.
     492           0 :                     const primitive3d::ModifiedColorPrimitive3D& rPrimitive = static_cast< const primitive3d::ModifiedColorPrimitive3D& >(rBasePrimitive);
     493           0 :                     impRenderModifiedColorPrimitive3D(rPrimitive);
     494           0 :                     break;
     495             :                 }
     496             :                 case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
     497             :                 {
     498             :                     // directdraw of PolygonHairlinePrimitive3D
     499           0 :                     const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rBasePrimitive);
     500           0 :                     impRenderPolygonHairlinePrimitive3D(rPrimitive);
     501           0 :                     break;
     502             :                 }
     503             :                 case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
     504             :                 {
     505             :                     // directdraw of PolyPolygonMaterialPrimitive3D
     506           0 :                     const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rBasePrimitive);
     507           0 :                     impRenderPolyPolygonMaterialPrimitive3D(rPrimitive);
     508           0 :                     break;
     509             :                 }
     510             :                 case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
     511             :                 {
     512             :                     // transform group (TransformPrimitive3D)
     513           0 :                     impRenderTransformPrimitive3D(static_cast< const primitive3d::TransformPrimitive3D& >(rBasePrimitive));
     514           0 :                     break;
     515             :                 }
     516             :                 default:
     517             :                 {
     518             :                     // process recursively
     519           0 :                     process(rBasePrimitive.get3DDecomposition(getViewInformation3D()));
     520           0 :                     break;
     521             :                 }
     522             :             }
     523           0 :         }
     524             : 
     525           0 :         DefaultProcessor3D::DefaultProcessor3D(
     526             :             const geometry::ViewInformation3D& rViewInformation,
     527             :             const attribute::SdrSceneAttribute& rSdrSceneAttribute,
     528             :             const attribute::SdrLightingAttribute& rSdrLightingAttribute)
     529             :         :   BaseProcessor3D(rViewInformation),
     530             :             mrSdrSceneAttribute(rSdrSceneAttribute),
     531             :             mrSdrLightingAttribute(rSdrLightingAttribute),
     532             :             maRasterRange(),
     533             :             maBColorModifierStack(),
     534             :             mpGeoTexSvx(),
     535             :             mpTransparenceGeoTexSvx(),
     536             :             maDrawinglayerOpt(),
     537             :             mnTransparenceCounter(0),
     538             :             mbModulate(false),
     539             :             mbFilter(false),
     540           0 :             mbSimpleTextureActive(false)
     541             :         {
     542             :             // a derivation has to set maRasterRange which is used in the basic render methods.
     543             :             // Setting to default here ([0.0 .. 1.0] in X,Y) to avoid problems
     544           0 :             maRasterRange.expand(basegfx::B2DTuple(0.0, 0.0));
     545           0 :             maRasterRange.expand(basegfx::B2DTuple(1.0, 1.0));
     546           0 :         }
     547             : 
     548           0 :         DefaultProcessor3D::~DefaultProcessor3D()
     549             :         {
     550           0 :         }
     551             :     } // end of namespace processor3d
     552             : } // end of namespace drawinglayer
     553             : 
     554             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10