Line data Source code
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 : #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
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>
31 :
32 :
33 : // predefines
34 :
35 : namespace basegfx {
36 : class BZPixelRaster;
37 : class B3DPolygon;
38 : class B3DPolyPolygon;
39 : }
40 :
41 : namespace drawinglayer { namespace attribute {
42 : class SdrSceneAttribute;
43 : class SdrLightingAttribute;
44 : class MaterialAttribute3D;
45 : }}
46 :
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;
55 : }}
56 :
57 : namespace drawinglayer { namespace texture {
58 : class GeoTexSvx;
59 : }}
60 :
61 :
62 :
63 : namespace drawinglayer
64 : {
65 : namespace processor3d
66 : {
67 : /** DefaultProcessor3D class
68 :
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.
73 : */
74 : class DefaultProcessor3D : public BaseProcessor3D
75 : {
76 : protected:
77 : /// read-only scene infos (normal handling, etc...)
78 : const attribute::SdrSceneAttribute& mrSdrSceneAttribute;
79 :
80 : /// read-only light infos (lights, etc...)
81 : const attribute::SdrLightingAttribute& mrSdrLightingAttribute;
82 :
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;
86 :
87 : /// the modifiedColorPrimitive stack
88 : basegfx::BColorModifierStack maBColorModifierStack;
89 :
90 : /// the current active texture
91 : boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx;
92 :
93 : /// the current active transparence texture
94 : boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx;
95 :
96 : /// SvtOptionsDrawinglayer incarnation to react on diverse settings
97 : const SvtOptionsDrawinglayer maDrawinglayerOpt;
98 :
99 : /// counter for entered transparence textures
100 : sal_uInt32 mnTransparenceCounter;
101 :
102 : /// bitfield
103 : bool mbModulate : 1;
104 : bool mbFilter : 1;
105 : bool mbSimpleTextureActive : 1;
106 :
107 :
108 : // rendering support
109 :
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);
117 :
118 :
119 : // rasterconversions for filled and non-filled polygons. These NEED to be
120 : // implemented from derivations
121 :
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;
124 :
125 : // the processing method for a single, known primitive
126 : virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) SAL_OVERRIDE;
127 :
128 : public:
129 : DefaultProcessor3D(
130 : const geometry::ViewInformation3D& rViewInformation,
131 : const attribute::SdrSceneAttribute& rSdrSceneAttribute,
132 : const attribute::SdrLightingAttribute& rSdrLightingAttribute);
133 : virtual ~DefaultProcessor3D();
134 :
135 : /// data read access
136 55082 : const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; }
137 18894 : const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; }
138 :
139 : /// data read access renderer stuff
140 117939 : const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
141 3641283 : const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; }
142 976268 : const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; }
143 18622 : sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; }
144 22917 : bool getModulate() const { return mbModulate; }
145 165 : bool getFilter() const { return mbFilter; }
146 145 : bool getSimpleTextureActive() const { return mbSimpleTextureActive; }
147 :
148 : /// access to Drawinglayer configuration options
149 0 : const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
150 : };
151 : } // end of namespace processor3d
152 : } // end of namespace drawinglayer
153 :
154 :
155 :
156 : #endif // INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
157 :
158 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|