1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <drawinglayer/processor3d/baseprocessor3d.hxx>
23 #include <basegfx/range/b2drange.hxx>
24 #include <basegfx/color/bcolormodifier.hxx>
33 namespace drawinglayer::attribute
{
34 class SdrSceneAttribute
;
35 class SdrLightingAttribute
;
36 class MaterialAttribute3D
;
39 namespace drawinglayer::primitive3d
{
40 class PolygonHairlinePrimitive3D
;
41 class PolyPolygonMaterialPrimitive3D
;
42 class GradientTexturePrimitive3D
;
43 class HatchTexturePrimitive3D
;
44 class BitmapTexturePrimitive3D
;
45 class TransformPrimitive3D
;
46 class ModifiedColorPrimitive3D
;
49 namespace drawinglayer::texture
{
54 namespace drawinglayer::processor3d
56 /** DefaultProcessor3D class
58 This processor renders all fed primitives to a 2D raster where for all
59 primitives the two basic methods rasterconvertB3DPolygon for hairlines and
60 rasterconvertB3DPolyPolygon for filled geometry is called. It is a baseclass to
61 e.g. base a Z-Buffer supported renderer on the 3D primitive processing.
63 class DefaultProcessor3D
: public BaseProcessor3D
66 /// read-only scene infos (normal handling, etc...)
67 const attribute::SdrSceneAttribute
& mrSdrSceneAttribute
;
69 /// read-only light infos (lights, etc...)
70 const attribute::SdrLightingAttribute
& mrSdrLightingAttribute
;
72 /// renderer range. Need to be correctly set by the derived implementations
73 /// normally the (0, 0, W, H) range from mpBZPixelRaster
74 basegfx::B2DRange maRasterRange
;
76 /// the modifiedColorPrimitive stack
77 basegfx::BColorModifierStack maBColorModifierStack
;
79 /// the current active texture
80 std::shared_ptr
< texture::GeoTexSvx
> mpGeoTexSvx
;
82 /// the current active transparence texture
83 std::shared_ptr
< texture::GeoTexSvx
> mpTransparenceGeoTexSvx
;
85 /// counter for entered transparence textures
86 sal_uInt32 mnTransparenceCounter
;
90 bool mbSimpleTextureActive
: 1;
95 void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D
& rPrimitive
, bool bTransparence
);
96 void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D
& rPrimitive
);
97 void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D
& rPrimitive
);
98 void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D
& rModifiedCandidate
);
99 void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D
& rPrimitive
) const;
100 void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D
& rPrimitive
) const;
101 void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D
& rTransformCandidate
);
104 // rasterconversions for filled and non-filled polygons. These NEED to be
105 // implemented from derivations
107 virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D
& rMaterial
, const basegfx::B3DPolygon
& rHairline
) const = 0;
108 virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D
& rMaterial
, const basegfx::B3DPolyPolygon
& rFill
) const = 0;
110 // the processing method for a single, known primitive
111 virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D
& rBasePrimitive
) override
;
115 const geometry::ViewInformation3D
& rViewInformation
,
116 const attribute::SdrSceneAttribute
& rSdrSceneAttribute
,
117 const attribute::SdrLightingAttribute
& rSdrLightingAttribute
);
118 virtual ~DefaultProcessor3D() override
;
121 const attribute::SdrSceneAttribute
& getSdrSceneAttribute() const { return mrSdrSceneAttribute
; }
122 const attribute::SdrLightingAttribute
& getSdrLightingAttribute() const { return mrSdrLightingAttribute
; }
124 /// data read access renderer stuff
125 const basegfx::BColorModifierStack
& getBColorModifierStack() const { return maBColorModifierStack
; }
126 const std::shared_ptr
< texture::GeoTexSvx
>& getGeoTexSvx() const { return mpGeoTexSvx
; }
127 const std::shared_ptr
< texture::GeoTexSvx
>& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx
; }
128 sal_uInt32
getTransparenceCounter() const { return mnTransparenceCounter
; }
129 bool getModulate() const { return mbModulate
; }
130 bool getFilter() const { return mbFilter
; }
131 bool getSimpleTextureActive() const { return mbSimpleTextureActive
; }
134 } // end of namespace drawinglayer::processor3d
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */