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 .
20 #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
21 #define INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
23 #include <drawinglayer/processor3d/baseprocessor3d.hxx>
24 #include <basegfx/range/b2drange.hxx>
25 #include <basegfx/color/bcolormodifier.hxx>
26 #include <svtools/optionsdrawinglayer.hxx>
35 namespace drawinglayer
{ namespace attribute
{
36 class SdrSceneAttribute
;
37 class SdrLightingAttribute
;
38 class MaterialAttribute3D
;
41 namespace drawinglayer
{ namespace primitive3d
{
42 class PolygonHairlinePrimitive3D
;
43 class PolyPolygonMaterialPrimitive3D
;
44 class GradientTexturePrimitive3D
;
45 class HatchTexturePrimitive3D
;
46 class BitmapTexturePrimitive3D
;
47 class TransformPrimitive3D
;
48 class ModifiedColorPrimitive3D
;
51 namespace drawinglayer
{ namespace texture
{
56 namespace drawinglayer
60 /** DefaultProcessor3D class
62 This processor renders all feeded primitives to a 2D raster where for all
63 primitives the two basic methods rasterconvertB3DPolygon for hairlines and
64 rasterconvertB3DPolyPolygon for filled geometry is called. It is a baseclass to
65 e.g. base a Z-Buffer supported renderer on the 3D primitive processing.
67 class DefaultProcessor3D
: public BaseProcessor3D
70 /// read-only scene infos (normal handling, etc...)
71 const attribute::SdrSceneAttribute
& mrSdrSceneAttribute
;
73 /// read-only light infos (lights, etc...)
74 const attribute::SdrLightingAttribute
& mrSdrLightingAttribute
;
76 /// renderer range. Need to be correctly set by the derived implementations
77 /// normally the (0, 0, W, H) range from mpBZPixelRaster
78 basegfx::B2DRange maRasterRange
;
80 /// the modifiedColorPrimitive stack
81 basegfx::BColorModifierStack maBColorModifierStack
;
83 /// the current active texture
84 std::shared_ptr
< texture::GeoTexSvx
> mpGeoTexSvx
;
86 /// the current active transparence texture
87 std::shared_ptr
< texture::GeoTexSvx
> mpTransparenceGeoTexSvx
;
89 /// SvtOptionsDrawinglayer incarnation to react on diverse settings
90 const SvtOptionsDrawinglayer maDrawinglayerOpt
;
92 /// counter for entered transparence textures
93 sal_uInt32 mnTransparenceCounter
;
97 bool mbSimpleTextureActive
: 1;
102 void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D
& rPrimitive
, bool bTransparence
);
103 void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D
& rPrimitive
);
104 void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D
& rPrimitive
);
105 void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D
& rModifiedCandidate
);
106 void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D
& rPrimitive
) const;
107 void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D
& rPrimitive
) const;
108 void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D
& rTransformCandidate
);
111 // rasterconversions for filled and non-filled polygons. These NEED to be
112 // implemented from derivations
114 virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D
& rMaterial
, const basegfx::B3DPolygon
& rHairline
) const = 0;
115 virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D
& rMaterial
, const basegfx::B3DPolyPolygon
& rFill
) const = 0;
117 // the processing method for a single, known primitive
118 virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D
& rBasePrimitive
) override
;
122 const geometry::ViewInformation3D
& rViewInformation
,
123 const attribute::SdrSceneAttribute
& rSdrSceneAttribute
,
124 const attribute::SdrLightingAttribute
& rSdrLightingAttribute
);
125 virtual ~DefaultProcessor3D() override
;
128 const attribute::SdrSceneAttribute
& getSdrSceneAttribute() const { return mrSdrSceneAttribute
; }
129 const attribute::SdrLightingAttribute
& getSdrLightingAttribute() const { return mrSdrLightingAttribute
; }
131 /// data read access renderer stuff
132 const basegfx::BColorModifierStack
& getBColorModifierStack() const { return maBColorModifierStack
; }
133 const std::shared_ptr
< texture::GeoTexSvx
>& getGeoTexSvx() const { return mpGeoTexSvx
; }
134 const std::shared_ptr
< texture::GeoTexSvx
>& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx
; }
135 sal_uInt32
getTransparenceCounter() const { return mnTransparenceCounter
; }
136 bool getModulate() const { return mbModulate
; }
137 bool getFilter() const { return mbFilter
; }
138 bool getSimpleTextureActive() const { return mbSimpleTextureActive
; }
140 /// access to Drawinglayer configuration options
141 const SvtOptionsDrawinglayer
& getOptionsDrawinglayer() const { return maDrawinglayerOpt
; }
143 } // end of namespace processor3d
144 } // end of namespace drawinglayer
147 #endif // INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */