bump product version to 4.2.0.1
[LibreOffice.git] / include / drawinglayer / processor3d / defaultprocessor3d.hxx
blobf2277670796d2609c5f287b22d17685264c817c9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/drawinglayerdllapi.h>
25 #include <drawinglayer/processor3d/baseprocessor3d.hxx>
26 #include <basegfx/matrix/b3dhommatrix.hxx>
27 #include <basegfx/range/b2drange.hxx>
28 #include <basegfx/color/bcolormodifier.hxx>
29 #include <svtools/optionsdrawinglayer.hxx>
30 #include <boost/shared_ptr.hpp>
32 //////////////////////////////////////////////////////////////////////////////
33 // predefines
35 namespace basegfx {
36 class BZPixelRaster;
37 class B3DPolygon;
38 class B3DPolyPolygon;
41 namespace drawinglayer { namespace attribute {
42 class SdrSceneAttribute;
43 class SdrLightingAttribute;
44 class MaterialAttribute3D;
47 namespace drawinglayer { namespace primitive3d {
48 class PolygonHairlinePrimitive3D;
49 class PolyPolygonMaterialPrimitive3D;
50 class GradientTexturePrimitive3D;
51 class HatchTexturePrimitive3D;
52 class BitmapTexturePrimitive3D;
53 class TransformPrimitive3D;
54 class ModifiedColorPrimitive3D;
57 namespace drawinglayer { namespace texture {
58 class GeoTexSvx;
61 //////////////////////////////////////////////////////////////////////////////
63 namespace drawinglayer
65 namespace processor3d
67 /** DefaultProcessor3D class
69 This processor renders all feeded primitives to a 2D raster where for all
70 primitives the two basic methods rasterconvertB3DPolygon for hairlines and
71 rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to
72 e.g. base a Z-Buffer supported renderer on the 3D primitive processing.
74 class DefaultProcessor3D : public BaseProcessor3D
76 protected:
77 /// read-only scene infos (normal handling, etc...)
78 const attribute::SdrSceneAttribute& mrSdrSceneAttribute;
80 /// read-only light infos (lights, etc...)
81 const attribute::SdrLightingAttribute& mrSdrLightingAttribute;
83 /// renderer range. Need to be correctly set by the derived implementations
84 /// normally the (0, 0, W, H) range from mpBZPixelRaster
85 basegfx::B2DRange maRasterRange;
87 /// the modifiedColorPrimitive stack
88 basegfx::BColorModifierStack maBColorModifierStack;
90 /// the current active texture
91 boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx;
93 /// the current active transparence texture
94 boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx;
96 /// SvtOptionsDrawinglayer incarnation to react on diverse settings
97 const SvtOptionsDrawinglayer maDrawinglayerOpt;
99 /// counter for entered transparence textures
100 sal_uInt32 mnTransparenceCounter;
102 /// bitfield
103 unsigned mbModulate : 1;
104 unsigned mbFilter : 1;
105 unsigned mbSimpleTextureActive : 1;
107 //////////////////////////////////////////////////////////////////////////////
108 // rendering support
110 void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence);
111 void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive);
112 void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive);
113 void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate);
114 void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive);
115 void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive);
116 void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate);
118 //////////////////////////////////////////////////////////////////////////////
119 // rasterconversions for filled and non-filled polygons. These NEED to be
120 // implemented from derivations
122 virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0;
123 virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0;
125 // the processing method for a single, known primitive
126 virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive);
128 public:
129 DefaultProcessor3D(
130 const geometry::ViewInformation3D& rViewInformation,
131 const attribute::SdrSceneAttribute& rSdrSceneAttribute,
132 const attribute::SdrLightingAttribute& rSdrLightingAttribute);
133 virtual ~DefaultProcessor3D();
135 /// data read access
136 const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; }
137 const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; }
139 /// data read access renderer stuff
140 const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
141 const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; }
142 const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; }
143 sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; }
144 bool getModulate() const { return mbModulate; }
145 bool getFilter() const { return mbFilter; }
146 bool getSimpleTextureActive() const { return mbSimpleTextureActive; }
148 /// access to Drawinglayer configuration options
149 const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
151 } // end of namespace processor3d
152 } // end of namespace drawinglayer
154 //////////////////////////////////////////////////////////////////////////////
156 #endif // INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */