1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
25 #define INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/processor3d/defaultprocessor3d.hxx>
29 #include <vcl/bitmapex.hxx>
30 
31 //////////////////////////////////////////////////////////////////////////////
32 // predefines
33 
34 namespace basegfx {
35 	class BZPixelRaster;
36 }
37 
38 namespace drawinglayer {
39 	namespace attribute {
40 		class SdrSceneAttribute;
41 		class SdrLightingAttribute;
42 		class MaterialAttribute3D;
43 	}
44 	namespace geometry {
45 		class ViewInformation2D;
46 	}
47 }
48 
49 class ZBufferRasterConverter3D;
50 class RasterPrimitive3D;
51 
52 //////////////////////////////////////////////////////////////////////////////
53 
54 namespace drawinglayer
55 {
56 	namespace processor3d
57 	{
58         /** ZBufferProcessor3D class
59 
60             This 3D renderer derived from DefaultProcessor3D renders all feeded primitives to a 2D
61             raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle
62             transparent content.
63          */
64 		class ZBufferProcessor3D : public DefaultProcessor3D
65 		{
66 		private:
67 			/// the raster target, a Z-Buffer
68 			basegfx::BZPixelRaster*								mpBZPixelRaster;
69 
70 			/// inverse of EyeToView for rasterconversion with evtl. Phong shading
71 			basegfx::B3DHomMatrix								maInvEyeToView;
72 
73             /// The raster converter for Z-Buffer
74 			ZBufferRasterConverter3D*							mpZBufferRasterConverter3D;
75 
76             /*  AA value. Defines how many overs�mples will be used in X and Y. Values 0, 1
77                 will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create
78               */
79 			sal_uInt16											mnAntiAlialize;
80 
81             /*  remembered RasterPrimitive3D's which need to be painted back to front
82                 for transparent 3D parts
83              */
84             std::vector< RasterPrimitive3D >*                   mpRasterPrimitive3Ds;
85 
86 			//////////////////////////////////////////////////////////////////////////////
87 			// rasterconversions for filled and non-filled polygons
88 
89             virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const;
90 			virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const;
91 
92 		public:
93 			ZBufferProcessor3D(
94 				const geometry::ViewInformation3D& rViewInformation3D,
95 				const geometry::ViewInformation2D& rViewInformation2D,
96 				const attribute::SdrSceneAttribute& rSdrSceneAttribute,
97 				const attribute::SdrLightingAttribute& rSdrLightingAttribute,
98 				double fSizeX,
99 				double fSizeY,
100 				const basegfx::B2DRange& rVisiblePart,
101                 sal_uInt16 nAntiAlialize);
102 			virtual ~ZBufferProcessor3D();
103 
104             void finish();
105 
106 			/// get the result as bitmapEx
107 			BitmapEx getBitmapEx() const;
108 		};
109 	} // end of namespace processor3d
110 } // end of namespace drawinglayer
111 
112 //////////////////////////////////////////////////////////////////////////////
113 
114 #endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
115 
116 // eof
117