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 .
22 #include <processor3d/defaultprocessor3d.hxx>
23 #include <basegfx/matrix/b3dhommatrix.hxx>
30 namespace drawinglayer::attribute
{
31 class SdrSceneAttribute
;
32 class SdrLightingAttribute
;
33 class MaterialAttribute3D
;
37 class ZBufferRasterConverter3D
;
38 class RasterPrimitive3D
;
40 namespace drawinglayer::processor3d
43 This 3D renderer derived from DefaultProcessor3D renders all fed primitives to a 2D
44 raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle
47 class ZBufferProcessor3D final
: public DefaultProcessor3D
50 /// inverse of EyeToView for rasterconversion with evtl. Phong shading
51 basegfx::B3DHomMatrix maInvEyeToView
;
53 /// The raster converter for Z-Buffer
54 std::unique_ptr
<ZBufferRasterConverter3D
> mpZBufferRasterConverter3D
;
56 /* AA value. Defines how many oversamples will be used in X and Y. Values 0, 1
57 will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create
59 sal_uInt16 mnAntiAlialize
;
61 /* remembered RasterPrimitive3D's which need to be painted back to front
62 for transparent 3D parts
64 mutable std::vector
< RasterPrimitive3D
> maRasterPrimitive3Ds
;
66 sal_uInt32 mnStartLine
;
67 sal_uInt32 mnStopLine
;
69 // rasterconversions for filled and non-filled polygons
71 virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D
& rMaterial
, const basegfx::B3DPolygon
& rHairline
) const override
;
72 virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D
& rMaterial
, const basegfx::B3DPolyPolygon
& rFill
) const override
;
76 const geometry::ViewInformation3D
& rViewInformation3D
,
77 const attribute::SdrSceneAttribute
& rSdrSceneAttribute
,
78 const attribute::SdrLightingAttribute
& rSdrLightingAttribute
,
79 const basegfx::B2DRange
& rVisiblePart
,
80 sal_uInt16 nAntiAlialize
,
81 double fFullViewSizeX
,
82 double fFullViewSizeY
,
83 basegfx::BZPixelRaster
& rBZPixelRaster
,
84 sal_uInt32 nStartLine
,
85 sal_uInt32 nStopLine
);
86 virtual ~ZBufferProcessor3D() override
;
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */