summaryrefslogtreecommitdiff
path: root/drawinglayer/source/processor3d/defaultprocessor3d.cxx
blob: 5f316879b4c5644917107ec0a3f9076c0ecc81a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <processor3d/defaultprocessor3d.hxx>
#include <primitive3d/textureprimitive3d.hxx>
#include <texture/texture.hxx>
#include <texture/texture3d.hxx>
#include <primitive3d/hatchtextureprimitive3d.hxx>
#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#include <basegfx/polygon/b3dpolygontools.hxx>
#include <drawinglayer/attribute/materialattribute3d.hxx>
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#include <basegfx/polygon/b3dpolypolygontools.hxx>
#include <com/sun/star/drawing/ShadeMode.hpp>
#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
#include <vcl/bitmapex.hxx>
#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
#include <vcl/graph.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>


using namespace com::sun::star;


namespace drawinglayer::processor3d
{
        void DefaultProcessor3D::impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence)
        {
            const primitive3d::Primitive3DContainer& rSubSequence = rPrimitive.getChildren();

            if(rSubSequence.empty())
                return;

            // rescue values
            const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
            const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
            const bool bOldSimpleTextureActive(getSimpleTextureActive());
            std::shared_ptr< texture::GeoTexSvx > pOldTex = bTransparence ? mpTransparenceGeoTexSvx : mpGeoTexSvx;

            // create texture
            const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient();
            const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY());
            const css::awt::GradientStyle aGradientStyle(rFillGradient.getStyle());
            std::shared_ptr< texture::GeoTexSvx > pNewTex;
            basegfx::BColor aSingleColor;

            if (!rFillGradient.getColorStops().isSingleColor(aSingleColor))
            {
                switch(aGradientStyle)
                {
                    default: // GradientStyle_MAKE_FIXED_SIZE
                    case css::awt::GradientStyle_LINEAR:
                    {
                        pNewTex = std::make_shared<texture::GeoTexSvxGradientLinear>(
                                aOutlineRange,
                                aOutlineRange,
                                rFillGradient.getSteps(),
                                rFillGradient.getColorStops(),
                                rFillGradient.getBorder(),
                                rFillGradient.getAngle());
                        break;
                    }
                    case css::awt::GradientStyle_AXIAL:
                    {
                        pNewTex = std::make_shared<texture::GeoTexSvxGradientAxial>(
                                aOutlineRange,
                                aOutlineRange,
                                rFillGradient.getSteps(),
                                rFillGradient.getColorStops(),
                                rFillGradient.getBorder(),
                                rFillGradient.getAngle());
                        break;
                    }
                    case css::awt::GradientStyle_RADIAL:
                    {
                        pNewTex =
                            std::make_shared<texture::GeoTexSvxGradientRadial>(
                                aOutlineRange,
                                rFillGradient.getSteps(),
                                rFillGradient.getColorStops(),
                                rFillGradient.getBorder(),
                                rFillGradient.getOffsetX(),
                                rFillGradient.getOffsetY());
                        break;
                    }
                    case css::awt::GradientStyle_ELLIPTICAL:
                    {
                        pNewTex =
                            std::make_shared<texture::GeoTexSvxGradientElliptical>(
                                aOutlineRange,
                                rFillGradient.getSteps(),
                                rFillGradient.getColorStops(),
                                rFillGradient.getBorder(),
                                rFillGradient.getOffsetX(),
                                rFillGradient.getOffsetY(),
                                rFillGradient.getAngle());
                        break;
                    }
                    case css::awt::GradientStyle_SQUARE:
                    {
                        pNewTex =
                            std::make_shared<texture::GeoTexSvxGradientSquare>(
                                aOutlineRange,
                                rFillGradient.getSteps(),
                                rFillGradient.getColorStops(),
                                rFillGradient.getBorder(),
                                rFillGradient.getOffsetX(),
                                rFillGradient.getOffsetY(),
                                rFillGradient.getAngle());
                        break;
                    }
                    case css::awt::GradientStyle_RECT:
                    {
                        pNewTex =
                            std::make_shared<texture::GeoTexSvxGradientRect>(
                                aOutlineRange,
                                rFillGradient.getSteps(),
                                rFillGradient.getColorStops(),
                                rFillGradient.getBorder(),
                                rFillGradient.getOffsetX(),
                                rFillGradient.getOffsetY(),
                                rFillGradient.getAngle());
                        break;
                    }
                }

                mbSimpleTextureActive = false;
            }
            else
            {
                // only one color, so no real gradient -> use simple texture
                pNewTex = std::make_shared<texture::GeoTexSvxMono>(aSingleColor, 1.0 - aSingleColor.luminance());
                mbSimpleTextureActive = true;
            }

            // set created texture
            if(bTransparence)
            {
                mpTransparenceGeoTexSvx = pNewTex;
            }
            else
            {
                mpGeoTexSvx = pNewTex;
            }

            // process sub-list
            process(rSubSequence);

            // restore values
            mbModulate = bOldModulate;
            mbFilter = bOldFilter;
            mbSimpleTextureActive = bOldSimpleTextureActive;

            if(bTransparence)
            {
                mpTransparenceGeoTexSvx = std::move(pOldTex);
            }
            else
            {
                mpGeoTexSvx = std::move(pOldTex);
            }
        }

        void DefaultProcessor3D::impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive)
        {
            const primitive3d::Primitive3DContainer& rSubSequence = rPrimitive.getChildren();

            if(rSubSequence.empty())
                return;

            // rescue values
            const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
            const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
            std::shared_ptr<texture::GeoTexSvx> xOldTex(mpGeoTexSvx);

            // calculate logic pixel size in object coordinates. Create transformation view
            // to object by inverting ObjectToView
            basegfx::B3DHomMatrix aInvObjectToView(getViewInformation3D().getObjectToView());
            aInvObjectToView.invert();

            // back-project discrete coordinates to object coordinates and extract
            // maximum distance
            const basegfx::B3DPoint aZero(aInvObjectToView * basegfx::B3DPoint(0.0, 0.0, 0.0));
            const basegfx::B3DPoint aOne(aInvObjectToView * basegfx::B3DPoint(1.0, 1.0, 1.0));
            const basegfx::B3DVector aLogicPixel(aOne - aZero);
            double fLogicPixelSizeWorld(std::max(std::max(fabs(aLogicPixel.getX()), fabs(aLogicPixel.getY())), fabs(aLogicPixel.getZ())));

            // calculate logic pixel size in texture coordinates
            const double fLogicTexSizeX(fLogicPixelSizeWorld / rPrimitive.getTextureSize().getX());
            const double fLogicTexSizeY(fLogicPixelSizeWorld / rPrimitive.getTextureSize().getY());
            const double fLogicTexSize(std::max(fLogicTexSizeX, fLogicTexSizeY));

            // create texture and set
            mpGeoTexSvx = std::make_shared<texture::GeoTexSvxMultiHatch>(rPrimitive, fLogicTexSize);

            // process sub-list
            process(rSubSequence);

            // restore values
            mbModulate = bOldModulate;
            mbFilter = bOldFilter;
            mpGeoTexSvx = std::move(xOldTex);
        }

        void DefaultProcessor3D::impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive)
        {
            const primitive3d::Primitive3DContainer& rSubSequence = rPrimitive.getChildren();

            if(rSubSequence.empty())
                return;

            // rescue values
            const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
            const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
            std::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx;

            // create texture
            const attribute::FillGraphicAttribute& rFillGraphicAttribute = rPrimitive.getFillGraphicAttribute();

            // #121194# For 3D texture we will use the BitmapRex representation
            const BitmapEx aBitmapEx(rFillGraphicAttribute.getGraphic().GetBitmapEx());

            // create range scaled by texture size
            basegfx::B2DRange aGraphicRange(rFillGraphicAttribute.getGraphicRange());

            aGraphicRange.transform(
                basegfx::utils::createScaleB2DHomMatrix(
                    rPrimitive.getTextureSize()));

            if(rFillGraphicAttribute.getTiling())
            {
                mpGeoTexSvx =
                    std::make_shared<texture::GeoTexSvxBitmapExTiled>(
                        aBitmapEx,
                        aGraphicRange,
                        rFillGraphicAttribute.getOffsetX(),
                        rFillGraphicAttribute.getOffsetY());
            }
            else
            {
                mpGeoTexSvx =
                    std::make_shared<texture::GeoTexSvxBitmapEx>(
                        aBitmapEx,
                        aGraphicRange);
            }

            // process sub-list
            process(rSubSequence);

            // restore values
            mbModulate = bOldModulate;
            mbFilter = bOldFilter;
            mpGeoTexSvx = std::move(pOldTex);
        }

        void DefaultProcessor3D::impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate)
        {
            const primitive3d::Primitive3DContainer& rSubSequence = rModifiedCandidate.getChildren();

            if(!rSubSequence.empty())
            {
                // put modifier on stack
                maBColorModifierStack.push(rModifiedCandidate.getColorModifier());

                // process sub-list
                process(rModifiedCandidate.getChildren());

                // remove modifier from stack
                maBColorModifierStack.pop();
            }
        }

        void DefaultProcessor3D::impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive) const
        {
            basegfx::B3DPolygon aHairline(rPrimitive.getB3DPolygon());

            if(!aHairline.count())
                return;

            // hairlines need no extra data, clear it
            aHairline.clearTextureCoordinates();
            aHairline.clearNormals();
            aHairline.clearBColors();

            // transform to device coordinates (-1.0 .. 1.0) and check for visibility
            aHairline.transform(getViewInformation3D().getObjectToView());
            const basegfx::B3DRange a3DRange(basegfx::utils::getRange(aHairline));
            const basegfx::B2DRange a2DRange(a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY());

            if(a2DRange.overlaps(maRasterRange))
            {
                const attribute::MaterialAttribute3D aMaterial(maBColorModifierStack.getModifiedColor(rPrimitive.getBColor()));

                rasterconvertB3DPolygon(aMaterial, aHairline);
            }
        }

        void DefaultProcessor3D::impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive) const
        {
            basegfx::B3DPolyPolygon aFill(rPrimitive.getB3DPolyPolygon());
            basegfx::BColor aObjectColor(rPrimitive.getMaterial().getColor());
            bool bPaintIt(aFill.count());

            // #i98295# get ShadeMode. Correct early when only flat is possible due to missing normals
            const css::drawing::ShadeMode aShadeMode(
                aFill.areNormalsUsed() ?
                    getSdrSceneAttribute().getShadeMode() : css::drawing::ShadeMode_FLAT);

            if(bPaintIt)
            {
                // get rid of texture coordinates if there is no texture
                if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx() && !getTransparenceGeoTexSvx())
                {
                    aFill.clearTextureCoordinates();
                }

                // #i98295# get rid of normals and color early when not needed
                if(css::drawing::ShadeMode_FLAT == aShadeMode)
                {
                    aFill.clearNormals();
                    aFill.clearBColors();
                }

                // transform to device coordinates (-1.0 .. 1.0) and check for visibility
                aFill.transform(getViewInformation3D().getObjectToView());
                const basegfx::B3DRange a3DRange(basegfx::utils::getRange(aFill));
                const basegfx::B2DRange a2DRange(a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY());

                bPaintIt = a2DRange.overlaps(maRasterRange);
            }

            // check if it shall be painted regarding hiding of normals (backface culling)
            if(bPaintIt && !rPrimitive.getDoubleSided())
            {
                // get plane normal of polygon in view coordinates (with ZBuffer values),
                // left-handed coordinate system
                const basegfx::B3DVector aPlaneNormal(aFill.getB3DPolygon(0).getNormal());

                if(aPlaneNormal.getZ() > 0.0)
                {
                    bPaintIt = false;
                }
            }

            if(!bPaintIt)
                return;

            // prepare ObjectToEye in NormalTransform
            basegfx::B3DHomMatrix aNormalTransform(getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation());

            if(getSdrSceneAttribute().getTwoSidedLighting())
            {
                // get plane normal of polygon in view coordinates (with ZBuffer values),
                // left-handed coordinate system
                const basegfx::B3DVector aPlaneNormal(aFill.getB3DPolygon(0).getNormal());

                if(aPlaneNormal.getZ() > 0.0)
                {
                    // mirror normals
                    aNormalTransform.scale(-1.0, -1.0, -1.0);
                }
            }

            switch(aShadeMode)
            {
                case css::drawing::ShadeMode_PHONG:
                {
                    // phong shading. Transform normals to eye coor
                    aFill.transformNormals(aNormalTransform);
                    break;
                }
                case css::drawing::ShadeMode_SMOOTH:
                {
                    // gouraud shading. Transform normals to eye coor
                    aFill.transformNormals(aNormalTransform);

                    // prepare color model parameters, evtl. use blend color
                    const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor());
                    const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular());
                    const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission());
                    const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity());

                    // solve color model for each normal vector, set colors at points. Clear normals.
                    for(sal_uInt32 a(0); a < aFill.count(); a++)
                    {
                        basegfx::B3DPolygon aPartFill(aFill.getB3DPolygon(a));

                        for(sal_uInt32 b(0); b < aPartFill.count(); b++)
                        {
                            // solve color model. Transform normal to eye coor
                            const basegfx::B3DVector aNormal(aPartFill.getNormal(b));
                            const basegfx::BColor aSolvedColor(getSdrLightingAttribute().solveColorModel(aNormal, aColor, rSpecular, rEmission, nSpecularIntensity));
                            aPartFill.setBColor(b, aSolvedColor);
                        }

                        // clear normals on this part polygon and write it back
                        aPartFill.clearNormals();
                        aFill.setB3DPolygon(a, aPartFill);
                    }
                    break;
                }
                case css::drawing::ShadeMode_FLAT:
                {
                    // flat shading. Get plane vector in eye coordinates
                    const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0).getNormal());

                    // prepare color model parameters, evtl. use blend color
                    const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor());
                    const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular());
                    const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission());
                    const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity());

                    // solve color model for plane vector and use that color for whole plane
                    aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity);
                    break;
                }
                default: // case css::drawing::ShadeMode_DRAFT:
                {
                    // draft, just use object color which is already set. Delete all other infos
                    aFill.clearNormals();
                    aFill.clearBColors();
                    break;
                }
            }

            // draw it to ZBuffer
            const attribute::MaterialAttribute3D aMaterial(
                maBColorModifierStack.getModifiedColor(aObjectColor),
                rPrimitive.getMaterial().getSpecular(),
                rPrimitive.getMaterial().getEmission(),
                rPrimitive.getMaterial().getSpecularIntensity());

            rasterconvertB3DPolyPolygon(aMaterial, aFill);
        }

        void DefaultProcessor3D::impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate)
        {
            // transform group. Remember current transformations
            const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());

            // create new transformation; add new object transform from right side
            const geometry::ViewInformation3D aNewViewInformation3D(
                aLastViewInformation3D.getObjectTransformation() * rTransformCandidate.getTransformation(),
                aLastViewInformation3D.getOrientation(),
                aLastViewInformation3D.getProjection(),
                aLastViewInformation3D.getDeviceToView(),
                aLastViewInformation3D.getViewTime(),
                aLastViewInformation3D.getExtendedInformationSequence());
            updateViewInformation(aNewViewInformation3D);

            // let break down recursively
            process(rTransformCandidate.getChildren());

            // restore transformations
            updateViewInformation(aLastViewInformation3D);
        }

        void DefaultProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive)
        {
            // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch
            switch(rBasePrimitive.getPrimitive3DID())
            {
                case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D :
                {
                    // GradientTexturePrimitive3D
                    const primitive3d::GradientTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::GradientTexturePrimitive3D& >(rBasePrimitive);
                    impRenderGradientTexturePrimitive3D(rPrimitive, false);
                    break;
                }
                case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D :
                {
                    // hatchTexturePrimitive3D
                    const primitive3d::HatchTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::HatchTexturePrimitive3D& >(rBasePrimitive);
                    impRenderHatchTexturePrimitive3D(rPrimitive);
                    break;
                }
                case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D :
                {
                    // BitmapTexturePrimitive3D
                    const primitive3d::BitmapTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::BitmapTexturePrimitive3D& >(rBasePrimitive);
                    impRenderBitmapTexturePrimitive3D(rPrimitive);
                    break;
                }
                case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D :
                {
                    // TransparenceTexturePrimitive3D
                    const primitive3d::TransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::TransparenceTexturePrimitive3D& >(rBasePrimitive);
                    mnTransparenceCounter++;
                    impRenderGradientTexturePrimitive3D(rPrimitive, true);
                    mnTransparenceCounter--;
                    break;
                }
                case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D :
                {
                    // ModifiedColorPrimitive3D
                    // Force output to unified color.
                    const primitive3d::ModifiedColorPrimitive3D& rPrimitive = static_cast< const primitive3d::ModifiedColorPrimitive3D& >(rBasePrimitive);
                    impRenderModifiedColorPrimitive3D(rPrimitive);
                    break;
                }
                case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
                {
                    // directdraw of PolygonHairlinePrimitive3D
                    const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rBasePrimitive);
                    impRenderPolygonHairlinePrimitive3D(rPrimitive);
                    break;
                }
                case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
                {
                    // directdraw of PolyPolygonMaterialPrimitive3D
                    const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rBasePrimitive);
                    impRenderPolyPolygonMaterialPrimitive3D(rPrimitive);
                    break;
                }
                case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
                {
                    // transform group (TransformPrimitive3D)
                    impRenderTransformPrimitive3D(static_cast< const primitive3d::TransformPrimitive3D& >(rBasePrimitive));
                    break;
                }
                default:
                {
                    // process recursively
                    process(rBasePrimitive.get3DDecomposition(getViewInformation3D()));
                    break;
                }
            }
        }

        DefaultProcessor3D::DefaultProcessor3D(
            const geometry::ViewInformation3D& rViewInformation,
            const attribute::SdrSceneAttribute& rSdrSceneAttribute,
            const attribute::SdrLightingAttribute& rSdrLightingAttribute)
        :   BaseProcessor3D(rViewInformation),
            mrSdrSceneAttribute(rSdrSceneAttribute),
            mrSdrLightingAttribute(rSdrLightingAttribute),
            maBColorModifierStack(),
            mnTransparenceCounter(0),
            mbModulate(false),
            mbFilter(false),
            mbSimpleTextureActive(false)
        {
            // a derivation has to set maRasterRange which is used in the basic render methods.
            // Setting to default here ([0.0 .. 1.0] in X,Y) to avoid problems
            maRasterRange.expand(basegfx::B2DTuple(0.0, 0.0));
            maRasterRange.expand(basegfx::B2DTuple(1.0, 1.0));
        }

        DefaultProcessor3D::~DefaultProcessor3D()
        {
        }

} // end of namespace

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */