Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/processor3d/baseprocessor3d.hxx>
35 : : #include <basegfx/matrix/b3dhommatrix.hxx>
36 : : #include <basegfx/range/b2drange.hxx>
37 : : #include <basegfx/color/bcolormodifier.hxx>
38 : : #include <svtools/optionsdrawinglayer.hxx>
39 : : #include <boost/shared_ptr.hpp>
40 : :
41 : : //////////////////////////////////////////////////////////////////////////////
42 : : // predefines
43 : :
44 : : namespace basegfx {
45 : : class BZPixelRaster;
46 : : class B3DPolygon;
47 : : class B3DPolyPolygon;
48 : : }
49 : :
50 : : namespace drawinglayer { namespace attribute {
51 : : class SdrSceneAttribute;
52 : : class SdrLightingAttribute;
53 : : class MaterialAttribute3D;
54 : : }}
55 : :
56 : : namespace drawinglayer { namespace primitive3d {
57 : : class PolygonHairlinePrimitive3D;
58 : : class PolyPolygonMaterialPrimitive3D;
59 : : class GradientTexturePrimitive3D;
60 : : class HatchTexturePrimitive3D;
61 : : class BitmapTexturePrimitive3D;
62 : : class TransformPrimitive3D;
63 : : class ModifiedColorPrimitive3D;
64 : : }}
65 : :
66 : : namespace drawinglayer { namespace texture {
67 : : class GeoTexSvx;
68 : : }}
69 : :
70 : : //////////////////////////////////////////////////////////////////////////////
71 : :
72 : : namespace drawinglayer
73 : : {
74 : : namespace processor3d
75 : : {
76 : : /** DefaultProcessor3D class
77 : :
78 : : This processor renders all feeded primitives to a 2D raster where for all
79 : : primitives the two basic methods rasterconvertB3DPolygon for hairlines and
80 : : rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to
81 : : e.g. base a Z-Buffer supported renderer on the 3D primitive processing.
82 : : */
83 : : class DRAWINGLAYER_DLLPUBLIC DefaultProcessor3D : public BaseProcessor3D
84 : : {
85 : : protected:
86 : : /// read-only scene infos (normal handling, etc...)
87 : : const attribute::SdrSceneAttribute& mrSdrSceneAttribute;
88 : :
89 : : /// read-only light infos (lights, etc...)
90 : : const attribute::SdrLightingAttribute& mrSdrLightingAttribute;
91 : :
92 : : /// renderer range. Need to be correctly set by the derived implementations
93 : : /// normally the (0, 0, W, H) range from mpBZPixelRaster
94 : : basegfx::B2DRange maRasterRange;
95 : :
96 : : /// the modifiedColorPrimitive stack
97 : : basegfx::BColorModifierStack maBColorModifierStack;
98 : :
99 : : /// the current active texture
100 : : boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx;
101 : :
102 : : /// the current active transparence texture
103 : : boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx;
104 : :
105 : : /// SvtOptionsDrawinglayer incarnation to react on diverse settings
106 : : const SvtOptionsDrawinglayer maDrawinglayerOpt;
107 : :
108 : : /// counter for entered transparence textures
109 : : sal_uInt32 mnTransparenceCounter;
110 : :
111 : : /// bitfield
112 : : unsigned mbModulate : 1;
113 : : unsigned mbFilter : 1;
114 : : unsigned mbSimpleTextureActive : 1;
115 : :
116 : : //////////////////////////////////////////////////////////////////////////////
117 : : // rendering support
118 : :
119 : : void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence);
120 : : void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive);
121 : : void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive);
122 : : void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate);
123 : : void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive);
124 : : void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive);
125 : : void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate);
126 : :
127 : : //////////////////////////////////////////////////////////////////////////////
128 : : // rasterconversions for filled and non-filled polygons. These NEED to be
129 : : // implemented from derivations
130 : :
131 : : virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0;
132 : : virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0;
133 : :
134 : : // the processing method for a single, known primitive
135 : : virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive);
136 : :
137 : : public:
138 : : DefaultProcessor3D(
139 : : const geometry::ViewInformation3D& rViewInformation,
140 : : const attribute::SdrSceneAttribute& rSdrSceneAttribute,
141 : : const attribute::SdrLightingAttribute& rSdrLightingAttribute);
142 : : virtual ~DefaultProcessor3D();
143 : :
144 : : /// data read access
145 : 695 : const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; }
146 : 749 : const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; }
147 : :
148 : : /// data read access renderer stuff
149 : 51530 : const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
150 : 2474095 : const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; }
151 : 371327 : const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; }
152 : 623 : sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; }
153 : 2317 : bool getModulate() const { return mbModulate; }
154 : 66 : bool getFilter() const { return mbFilter; }
155 : 58 : bool getSimpleTextureActive() const { return mbSimpleTextureActive; }
156 : :
157 : : /// access to Drawinglayer configuration options
158 : 0 : const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
159 : : };
160 : : } // end of namespace processor3d
161 : : } // end of namespace drawinglayer
162 : :
163 : : //////////////////////////////////////////////////////////////////////////////
164 : :
165 : : #endif // INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
166 : :
167 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|