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