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