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

Generated by: LCOV version 1.10