diff options
Diffstat (limited to 'include/drawinglayer/processor3d')
6 files changed, 622 insertions, 0 deletions
diff --git a/include/drawinglayer/processor3d/baseprocessor3d.hxx b/include/drawinglayer/processor3d/baseprocessor3d.hxx new file mode 100644 index 000000000000..834779982ba5 --- /dev/null +++ b/include/drawinglayer/processor3d/baseprocessor3d.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/primitive3d/baseprimitive3d.hxx> +#include <drawinglayer/geometry/viewinformation3d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + /** BaseProcessor3D class + + Baseclass for all C++ implementations of instances which process + primitives. + + Please have a look at baseprocessor2d.hxx for more comments. + */ + class DRAWINGLAYER_DLLPUBLIC BaseProcessor3D + { + private: + geometry::ViewInformation3D maViewInformation3D; + + protected: + void updateViewInformation(const geometry::ViewInformation3D& rViewInformation3D) + { + maViewInformation3D = rViewInformation3D; + } + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + Default implementation does nothing + */ + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); + + public: + explicit BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation); + virtual ~BaseProcessor3D(); + + // the central processing method + virtual void process(const primitive3d::Primitive3DSequence& rSource); + + // data access + const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/processor3d/cutfindprocessor3d.hxx b/include/drawinglayer/processor3d/cutfindprocessor3d.hxx new file mode 100644 index 000000000000..2b4714ca3054 --- /dev/null +++ b/include/drawinglayer/processor3d/cutfindprocessor3d.hxx @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/processor3d/defaultprocessor3d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + /** CutFindProcessor class + + This processor extracts all cuts of 3D plane geometries in the feeded primitives + with the given cut vector, based on the ViewInformation3D given. + */ + class DRAWINGLAYER_DLLPUBLIC CutFindProcessor : public BaseProcessor3D + { + private: + /// the start and stop point for the cut vector + basegfx::B3DPoint maFront; + basegfx::B3DPoint maBack; + + /// the found cut points + ::std::vector< basegfx::B3DPoint > maResult; + + /* #i102956# the transformation change from TransformPrimitive3D processings + needs to be remembered to be able to transform found cuts to the + basic coordinate system the processor starts with + */ + basegfx::B3DHomMatrix maCombinedTransform; + + /// bitfield + bool mbAnyHit : 1; + + /* this flag decides if primitives which are invisible will be taken into account for + HitTesting or not. + */ + bool mbUseInvisiblePrimitiveContent : 1; + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); + + public: + CutFindProcessor(const geometry::ViewInformation3D& rViewInformation, + const basegfx::B3DPoint& rFront, + const basegfx::B3DPoint& rBack, + bool bAnyHit); + + /// data write access + void setUseInvisiblePrimitiveContent(bool bNew) + { + if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew; + } + + /// data read access + const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } + bool getAnyHit() const { return mbAnyHit; } + bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;} + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/processor3d/defaultprocessor3d.hxx b/include/drawinglayer/processor3d/defaultprocessor3d.hxx new file mode 100644 index 000000000000..010fba3b1f1d --- /dev/null +++ b/include/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -0,0 +1,158 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/processor3d/baseprocessor3d.hxx> +#include <basegfx/matrix/b3dhommatrix.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/color/bcolormodifier.hxx> +#include <svtools/optionsdrawinglayer.hxx> +#include <boost/shared_ptr.hpp> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BZPixelRaster; + class B3DPolygon; + class B3DPolyPolygon; +} + +namespace drawinglayer { namespace attribute { + class SdrSceneAttribute; + class SdrLightingAttribute; + class MaterialAttribute3D; +}} + +namespace drawinglayer { namespace primitive3d { + class PolygonHairlinePrimitive3D; + class PolyPolygonMaterialPrimitive3D; + class GradientTexturePrimitive3D; + class HatchTexturePrimitive3D; + class BitmapTexturePrimitive3D; + class TransformPrimitive3D; + class ModifiedColorPrimitive3D; +}} + +namespace drawinglayer { namespace texture { + class GeoTexSvx; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + /** DefaultProcessor3D class + + This processor renders all feeded primitives to a 2D raster where for all + primitives the two basic methods rasterconvertB3DPolygon for hairlines and + rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to + e.g. base a Z-Buffer supported renderer on the 3D primitive processing. + */ + class DRAWINGLAYER_DLLPUBLIC DefaultProcessor3D : public BaseProcessor3D + { + protected: + /// read-only scene infos (normal handling, etc...) + const attribute::SdrSceneAttribute& mrSdrSceneAttribute; + + /// read-only light infos (lights, etc...) + const attribute::SdrLightingAttribute& mrSdrLightingAttribute; + + /// renderer range. Need to be correctly set by the derived implementations + /// normally the (0, 0, W, H) range from mpBZPixelRaster + basegfx::B2DRange maRasterRange; + + /// the modifiedColorPrimitive stack + basegfx::BColorModifierStack maBColorModifierStack; + + /// the current active texture + boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx; + + /// the current active transparence texture + boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx; + + /// SvtOptionsDrawinglayer incarnation to react on diverse settings + const SvtOptionsDrawinglayer maDrawinglayerOpt; + + /// counter for entered transparence textures + sal_uInt32 mnTransparenceCounter; + + /// bitfield + unsigned mbModulate : 1; + unsigned mbFilter : 1; + unsigned mbSimpleTextureActive : 1; + + ////////////////////////////////////////////////////////////////////////////// + // rendering support + + void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence); + void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive); + void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive); + void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate); + void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive); + void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive); + void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate); + + ////////////////////////////////////////////////////////////////////////////// + // rasterconversions for filled and non-filled polygons. These NEED to be + // implemented from derivations + + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0; + virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0; + + // the processing method for a single, known primitive + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive); + + public: + DefaultProcessor3D( + const geometry::ViewInformation3D& rViewInformation, + const attribute::SdrSceneAttribute& rSdrSceneAttribute, + const attribute::SdrLightingAttribute& rSdrLightingAttribute); + virtual ~DefaultProcessor3D(); + + /// data read access + const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; } + const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; } + + /// data read access renderer stuff + const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } + const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } + const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; } + bool getModulate() const { return mbModulate; } + bool getFilter() const { return mbFilter; } + bool getSimpleTextureActive() const { return mbSimpleTextureActive; } + + /// access to Drawinglayer configuration options + const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/processor3d/geometry2dextractor.hxx b/include/drawinglayer/processor3d/geometry2dextractor.hxx new file mode 100644 index 000000000000..d85e6843f54d --- /dev/null +++ b/include/drawinglayer/processor3d/geometry2dextractor.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/processor3d/baseprocessor3d.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b3dhommatrix.hxx> +#include <basegfx/color/bcolormodifier.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + /** Geometry2DExtractingProcessor class + + This processor extracts the 2D geometry (projected geometry) of all feeded primitives. + It is e.g. used as sub-processor for contour extraction where 3D geometry is only + useful as 2D projected geometry. + */ + class DRAWINGLAYER_DLLPUBLIC Geometry2DExtractingProcessor : public BaseProcessor3D + { + private: + /// result holding vector (2D) + primitive2d::Primitive2DSequence maPrimitive2DSequence; + + /// object transformation for scene for 2d definition + basegfx::B2DHomMatrix maObjectTransformation; + + /// the modifiedColorPrimitive stack + basegfx::BColorModifierStack maBColorModifierStack; + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); + + public: + Geometry2DExtractingProcessor( + const geometry::ViewInformation3D& rViewInformation, + const basegfx::B2DHomMatrix& rObjectTransformation); + + // data read access + const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/processor3d/shadow3dextractor.hxx b/include/drawinglayer/processor3d/shadow3dextractor.hxx new file mode 100644 index 000000000000..183d61271c83 --- /dev/null +++ b/include/drawinglayer/processor3d/shadow3dextractor.hxx @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/processor3d/baseprocessor3d.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b3dhommatrix.hxx> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b3dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b3dpolypolygon.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + /** Shadow3DExtractingProcessor class + + This processor extracts the 2D shadow geometry (projected geometry) of all feeded primitives. + It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite + some data to do so since we do not only offer flat projected 2D shadow, but also projections + dependent on the light source + */ + class DRAWINGLAYER_DLLPUBLIC Shadow3DExtractingProcessor : public BaseProcessor3D + { + private: + /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence) + primitive2d::Primitive2DVector maPrimitive2DSequence; + primitive2d::Primitive2DVector* mpPrimitive2DSequence; + + /// object transformation for scene for 2d definition + basegfx::B2DHomMatrix maObjectTransformation; + + /// prepared data (transformations) for 2D/3D shadow calculations + basegfx::B3DHomMatrix maWorldToEye; + basegfx::B3DHomMatrix maEyeToView; + basegfx::B3DVector maLightNormal; + basegfx::B3DVector maShadowPlaneNormal; + basegfx::B3DPoint maPlanePoint; + double mfLightPlaneScalar; + + /* the shadow color used for sub-primitives. Can stay at black since + the encapsulating 2d shadow primitive will contain the color + */ + basegfx::BColor maPrimitiveColor; + + /// bitfield + /// flag if shadow plane projection preparation leaded to valid results + unsigned mbShadowProjectionIsValid : 1; + + /// flag if conversion is switched on + unsigned mbConvert : 1; + + /// flag if conversion shall use projection + unsigned mbUseProjection : 1; + + /// local helpers + basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource); + basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource); + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ + virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); + + public: + Shadow3DExtractingProcessor( + const geometry::ViewInformation3D& rViewInformation, + const basegfx::B2DHomMatrix& rObjectTransformation, + const basegfx::B3DVector& rLightNormal, + double fShadowSlant, + const basegfx::B3DRange& rContained3DRange); + virtual ~Shadow3DExtractingProcessor(); + + /// data read access + const primitive2d::Primitive2DSequence getPrimitive2DSequence() const; + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } + const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; } + const basegfx::B3DHomMatrix& getEyeToView() const { return maEyeToView; } + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +#endif //_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/processor3d/zbufferprocessor3d.hxx b/include/drawinglayer/processor3d/zbufferprocessor3d.hxx new file mode 100644 index 000000000000..8570809b465d --- /dev/null +++ b/include/drawinglayer/processor3d/zbufferprocessor3d.hxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <drawinglayer/processor3d/defaultprocessor3d.hxx> +#include <vcl/bitmapex.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BZPixelRaster; +} + +namespace drawinglayer { + namespace attribute { + class SdrSceneAttribute; + class SdrLightingAttribute; + class MaterialAttribute3D; + } + namespace geometry { + class ViewInformation2D; + } +} + +class ZBufferRasterConverter3D; +class RasterPrimitive3D; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor3d + { + /** ZBufferProcessor3D class + + This 3D renderer derived from DefaultProcessor3D renders all feeded primitives to a 2D + raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle + transparent content. + */ + class DRAWINGLAYER_DLLPUBLIC ZBufferProcessor3D : public DefaultProcessor3D + { + private: + /// the raster target, a Z-Buffer + basegfx::BZPixelRaster* mpBZPixelRaster; + + /// inverse of EyeToView for rasterconversion with evtl. Phong shading + basegfx::B3DHomMatrix maInvEyeToView; + + /// The raster converter for Z-Buffer + ZBufferRasterConverter3D* mpZBufferRasterConverter3D; + + /* AA value. Defines how many oversámples will be used in X and Y. Values 0, 1 + will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create + */ + sal_uInt16 mnAntiAlialize; + + /* remembered RasterPrimitive3D's which need to be painted back to front + for transparent 3D parts + */ + std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds; + + ////////////////////////////////////////////////////////////////////////////// + // rasterconversions for filled and non-filled polygons + + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const; + virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const; + + public: + ZBufferProcessor3D( + const geometry::ViewInformation3D& rViewInformation3D, + const geometry::ViewInformation2D& rViewInformation2D, + const attribute::SdrSceneAttribute& rSdrSceneAttribute, + const attribute::SdrLightingAttribute& rSdrLightingAttribute, + double fSizeX, + double fSizeY, + const basegfx::B2DRange& rVisiblePart, + sal_uInt16 nAntiAlialize); + virtual ~ZBufferProcessor3D(); + + void finish(); + + /// get the result as bitmapEx + BitmapEx getBitmapEx() const; + }; + } // end of namespace processor3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |