Coverage Report

Created: 2026-10-14 09:33

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