From 4eed20ca2861504ee08ee50f7173a74bfb56bfa5 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Tue, 10 Jun 2008 08:29:56 +0000 Subject: #i39532# changed 3d primitive stuff to use viewinformation3d --- .../drawinglayer/geometry/viewinformation2d.hxx | 11 +- .../drawinglayer/geometry/viewinformation3d.hxx | 129 +++++ .../primitive2d/embedded3dprimitive2d.hxx | 12 +- .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 12 +- .../drawinglayer/primitive3d/baseprimitive3d.hxx | 30 +- .../drawinglayer/primitive3d/groupprimitive3d.hxx | 6 +- .../primitive3d/hatchtextureprimitive3d.hxx | 6 +- .../primitive3d/polygonprimitive3d.hxx | 8 +- .../primitive3d/polygontubeprimitive3d.hxx | 6 +- .../primitive3d/polypolygonprimitive3d.hxx | 6 +- .../primitive3d/sdrcubeprimitive3d.hxx | 8 +- .../primitive3d/sdrextrudeprimitive3d.hxx | 8 +- .../primitive3d/sdrlatheprimitive3d.hxx | 8 +- .../primitive3d/sdrpolypolygonprimitive3d.hxx | 8 +- .../drawinglayer/primitive3d/sdrprimitive3d.hxx | 9 +- .../primitive3d/sdrsphereprimitive3d.hxx | 8 +- .../primitive3d/textureprimitive3d.hxx | 10 +- .../primitive3d/transformprimitive3d.hxx | 6 +- .../drawinglayer/processor2d/baseprocessor2d.hxx | 12 +- .../drawinglayer/processor3d/baseprocessor3d.hxx | 19 +- .../processor3d/defaultprocessor3d.hxx | 6 +- .../processor3d/geometry2dextractor.hxx | 14 +- .../drawinglayer/processor3d/shadow3dextractor.hxx | 10 +- .../processor3d/zbufferprocessor3d.hxx | 9 +- drawinglayer/prj/d.lst | 2 +- drawinglayer/source/geometry/makefile.mk | 8 +- drawinglayer/source/geometry/viewinformation2d.cxx | 27 +- drawinglayer/source/geometry/viewinformation3d.cxx | 555 +++++++++++++++++++++ .../source/primitive2d/embedded3dprimitive2d.cxx | 23 +- .../source/primitive2d/sceneprimitive2d.cxx | 33 +- .../source/primitive3d/baseprimitive3d.cxx | 84 +--- .../source/primitive3d/groupprimitive3d.cxx | 6 +- .../source/primitive3d/hatchtextureprimitive3d.cxx | 6 +- .../source/primitive3d/polygonprimitive3d.cxx | 8 +- .../source/primitive3d/polygontubeprimitive3d.cxx | 6 +- .../source/primitive3d/polypolygonprimitive3d.cxx | 6 +- .../source/primitive3d/sdrcubeprimitive3d.cxx | 12 +- .../source/primitive3d/sdrextrudeprimitive3d.cxx | 12 +- .../source/primitive3d/sdrlatheprimitive3d.cxx | 12 +- .../primitive3d/sdrpolypolygonprimitive3d.cxx | 12 +- drawinglayer/source/primitive3d/sdrprimitive3d.cxx | 30 +- .../source/primitive3d/sdrsphereprimitive3d.cxx | 12 +- .../source/primitive3d/textureprimitive3d.cxx | 10 +- .../source/primitive3d/transformprimitive3d.cxx | 8 +- .../source/processor2d/canvasprocessor.cxx | 9 +- .../source/processor2d/contourextractor2d.cxx | 10 +- drawinglayer/source/processor2d/vclprocessor2d.cxx | 14 +- .../source/processor3d/baseprocessor3d.cxx | 12 +- .../source/processor3d/defaultprocessor3d.cxx | 16 +- .../source/processor3d/geometry2dextractor.cxx | 39 +- .../source/processor3d/shadow3dextractor.cxx | 76 +-- .../source/processor3d/zbufferprocessor3d.cxx | 21 +- 52 files changed, 1030 insertions(+), 400 deletions(-) create mode 100644 drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx create mode 100644 drawinglayer/source/geometry/viewinformation3d.cxx diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx index 1f760d6740cd..cc0b74319e69 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: viewinformation2d.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: thb $ $Date: 2008-05-27 20:09:13 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:20 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -72,7 +72,7 @@ namespace drawinglayer // constructor to easily build a ViewInformation2D when all view // information is available as basegfx implementation classes. The // ExtendedParameters allows adding extra parameters besides ViewTransformation, - // Viewport and ViewTime and should not itself include one of these. + // Viewport, ViewTime and DrawPage and should not itself include one of these. ViewInformation2D( const basegfx::B2DHomMatrix& rViewTransformation, const basegfx::B2DRange& rViewport, @@ -95,6 +95,9 @@ namespace drawinglayer // assignment operator ViewInformation2D& operator=(const ViewInformation2D& rCandidate); + // compare operator + bool operator==(const ViewInformation2D& rCandidate) const; + // data access const basegfx::B2DHomMatrix& getViewTransformation() const; const basegfx::B2DRange& getViewport() const; @@ -114,7 +117,7 @@ namespace drawinglayer const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const; // get the uno::Sequence< beans::PropertyValue > which contains only extra information. This means - // information different from ViewTransformation, Viewport and ViewTime. + // information different from ViewTransformation, Viewport, ViewTime and DrawPage. const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const; }; } // end of namespace geometry diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx new file mode 100644 index 000000000000..0a5dc8b2c39f --- /dev/null +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: viewinformation3d.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2008-06-10 09:29:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX +#define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX + +// the solaris compiler defines 'sun' as '1'. To avoid that (and to allow +// pre-declarations of com/sun/star namespace), include sal/config.h here +// where sun is redefined as 'sun' (so i guess the problem is known). +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace { + class ImpViewInformation3D; +}} + +namespace basegfx { + class B3DHomMatrix; +} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace geometry + { + class ViewInformation3D + { + private: + // impl pointer + ImpViewInformation3D* mpViewInformation3D; + + public: + // constructor to easily build a ViewInformation3D when all view + // information is available as basegfx implementation classes. The + // ExtendedParameters allows adding extra parameters besides the simple ones + // and should not itself include one of these. + ViewInformation3D( + const basegfx::B3DHomMatrix& rTransformation, + const basegfx::B3DHomMatrix& rOrientation, + const basegfx::B3DHomMatrix& rProjection, + const basegfx::B3DHomMatrix& rDeviceToView, + double fViewTime, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters); + + // constructor to create a ViewInformation3D based on API information only. The + // ViewParameters can contain ViewTransformation, Viewport and ViewTime but also + // other parameters which will be preserved in the ExtendedInformation. The three + // named information will be extracted locally for faster access. + ViewInformation3D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters); + + // copy constructor + ViewInformation3D(const ViewInformation3D& rCandidate); + + // destructor + ~ViewInformation3D(); + + // assignment operator + ViewInformation3D& operator=(const ViewInformation3D& rCandidate); + + // compare operator + bool operator==(const ViewInformation3D& rCandidate) const; + + // data access + // the four transformations defining the 3D view pipeline complately + const basegfx::B3DHomMatrix& getTransformation() const; + const basegfx::B3DHomMatrix& getOrientation() const; + const basegfx::B3DHomMatrix& getProjection() const; + const basegfx::B3DHomMatrix& getDeviceToView() const; + + // for convenience, the linear combination of the above four transformations + const basegfx::B3DHomMatrix& getObjectToView() const; + + // time at which the transformation is to be used. This may be used from animated objects + double getViewTime() const; + + // get the uno::Sequence< beans::PropertyValue > which contains all information. When + // constructed using the API constructor, You will get back Your input. If not, the + // needed sequence will be constructed including the extended informations. + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const; + + // get the uno::Sequence< beans::PropertyValue > which contains only extra information. This means + // information different from the four transformations. + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const; + }; + } // end of namespace geometry +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx index 7629397800b3..b7ec9dfe219a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: embedded3dprimitive2d.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -38,7 +38,7 @@ #include #include -#include +#include #include ////////////////////////////////////////////////////////////////////////////// @@ -53,7 +53,7 @@ namespace drawinglayer private: primitive3d::Primitive3DSequence mxChildren3D; basegfx::B2DHomMatrix maObjectTransformation; - geometry::Transformation3D maTransformation3D; + geometry::ViewInformation3D maViewInformation3D; protected: // local decomposition. @@ -63,12 +63,12 @@ namespace drawinglayer Embedded3DPrimitive2D( const primitive3d::Primitive3DSequence& rxChildren3D, const basegfx::B2DHomMatrix& rObjectTransformation, - const geometry::Transformation3D& rTransformation3D); + const geometry::ViewInformation3D& rViewInformation3D); // get data const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } - const geometry::Transformation3D& getTransformation3D() const { return maTransformation3D; } + const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index 73beadd1bbba..59c498d312f7 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: sceneprimitive2d.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: thb $ $Date: 2008-05-27 20:09:13 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include ////////////////////////////////////////////////////////////////////////////// @@ -55,7 +55,7 @@ namespace drawinglayer attribute::SdrSceneAttribute maSdrSceneAttribute; // 3d scene attribute set attribute::SdrLightingAttribute maSdrLightingAttribute; // lighting attribute set basegfx::B2DHomMatrix maObjectTransformation; // object transformation for scene for 2d definition - geometry::Transformation3D maTransformation3D; // scene transformation set and object transformation + geometry::ViewInformation3D maViewInformation3D; // scene transformation set and object transformation // the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked) Primitive2DSequence maShadowPrimitives; @@ -104,14 +104,14 @@ namespace drawinglayer const attribute::SdrSceneAttribute& rSdrSceneAttribute, const attribute::SdrLightingAttribute& rSdrLightingAttribute, const basegfx::B2DHomMatrix& rObjectTransformation, - const geometry::Transformation3D& rTransformation3D); + const geometry::ViewInformation3D& rViewInformation3D); // get data const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; } const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return maSdrSceneAttribute; } const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return maSdrLightingAttribute; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } - const geometry::Transformation3D& getTransformation3D() const { return maTransformation3D; } + const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx index 4345ed176d74..faeac28b0c0c 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/baseprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: baseprimitive3d.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,6 +54,13 @@ #define ImplPrimitrive3DIDBlock(TheClass, TheID) \ sal_uInt32 TheClass::getPrimitiveID() const { return TheID; } +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace geometry { + class ViewInformation3D; +}} + ////////////////////////////////////////////////////////////////////////////// // basePrimitive3D class @@ -86,7 +93,7 @@ namespace drawinglayer // method which is to be used to implement the local decomposition of a 2D primitive. The default // implementation will just return an empty decomposition - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: // constructor @@ -102,7 +109,7 @@ namespace drawinglayer // This method is for places where using the C++ implementation directly is possible. The subprocessing // and range merging is more efficient when working directly on basegfx::B3DRange. The default implementation // will use getDecomposition results to create the range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID for fast identifying of known primitive implementations in renderers. These use // the the defines from primitivetypes3d.hxx to define unique IDs. @@ -110,17 +117,17 @@ namespace drawinglayer // The getDecomposition default implementation will on demand use createLocalDecomposition() if maLocalDecomposition is empty. // It will set maLocalDecomposition to this obtained decomposition to buffer it. - // If the decomposition is also time-dependent, this method needs to be overloaded and the - // time for the last decomposition need to be remembered, too, and be used in the next call to decide if + // If the decomposition is also ViewInformation-dependent, this method needs to be overloaded and the + // ViewInformation for the last decomposition needs to be remembered, too, and be used in the next call to decide if // the buffered decomposition may be reused or not. - virtual Primitive3DSequence get3DDecomposition(double fTime) const; + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; // // Methods from XPrimitive3D // // The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It - // will get the time from the ViewParameters for that purpose + // will get the ViewInformation from the ViewParameters for that purpose virtual Primitive3DSequence SAL_CALL getDecomposition( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException ); // the getRange default implemenation will use getDecomposition to create the range information from merging @@ -138,10 +145,10 @@ namespace drawinglayer namespace primitive3d { // get B3DRange from a given Primitive3DReference - basegfx::B3DRange getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, double fTime); + basegfx::B3DRange getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, const geometry::ViewInformation3D& aViewInformation); // get range3D from a given Primitive3DSequence - basegfx::B3DRange getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, double fTime); + basegfx::B3DRange getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, const geometry::ViewInformation3D& aViewInformation); // compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D) // and using compare operator @@ -156,9 +163,6 @@ namespace drawinglayer // concatenate single Primitive3D void appendPrimitive3DReferenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DReference& rSource); - // conversion helpers for 3D ViewParameters (only time used ATM) - double ViewParametersToTime(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters); - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > TimeToViewParameters(double fTime); } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx index 4b7b7b874b64..029b4c664fe2 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: groupprimitive3d.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,7 +52,7 @@ namespace drawinglayer protected: // local decomposition. Implementation will just return children - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: // constructor diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx index 8c02bd8050c9..c1feccaaa10c 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: hatchtextureprimitive3d.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -51,7 +51,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: HatchTexturePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx index 986393ab11c3..9de2dc5949e7 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive3d.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -67,7 +67,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive3D& rPrimitive) const; // get range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID DeclPrimitrive3DIDBlock() @@ -90,7 +90,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: PolygonStrokePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx index 428cf96e15a5..8a9b293a8c5e 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: polygontubeprimitive3d.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -62,7 +62,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: PolygonTubePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx index abb475d6d19b..1c5b9e400bbb 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polypolygonprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: polypolygonprimitive3d.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -70,7 +70,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive3D& rPrimitive) const; // get range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID DeclPrimitrive3DIDBlock() diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx index af23233ba042..57f31a46a557 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrcubeprimitive3d.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -48,7 +48,7 @@ namespace drawinglayer { protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrCubePrimitive3D( @@ -61,7 +61,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive3D& rPrimitive) const; // get range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID DeclPrimitrive3DIDBlock() diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx index 30629605e3dc..d17f3493178d 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrextrudeprimitive3d.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -74,7 +74,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrExtrudePrimitive3D( @@ -109,7 +109,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive3D& rPrimitive) const; // get range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID DeclPrimitrive3DIDBlock() diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx index e1d3d15510ec..ec9ebe3fabe8 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrlatheprimitive3d.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -75,7 +75,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrLathePrimitive3D( @@ -114,7 +114,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive3D& rPrimitive) const; // get range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID DeclPrimitrive3DIDBlock() diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx index 9f937831deba..4eec829afeb5 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrpolypolygonprimitive3d.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,7 +52,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrPolyPolygonPrimitive3D( @@ -69,7 +69,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive3D& rPrimitive) const; // get range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID DeclPrimitrive3DIDBlock() diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx index ac01ec00e5f4..6b381445716e 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrprimitive3d.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -66,11 +66,6 @@ namespace drawinglayer // will use given Slice3Ds and expand by evtl. line width / 2 basegfx::B3DRange get3DRangeFromSlices(const Slice3DVector& rSlices) const; -#ifdef DBG_UTIL - // tooling for testing. Eventually adds geometry to visualize the BoundRect of the primitive - Primitive3DSequence EventuallyAddTestRange(Primitive3DSequence& rTarget) const; -#endif - public: SdrPrimitive3D( const basegfx::B3DHomMatrix& rTransform, diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx index 70e4ca3f868d..358298e30456 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrsphereprimitive3d.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,7 +52,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: SdrSpherePrimitive3D( @@ -71,7 +71,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive3D& rPrimitive) const; // get range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID DeclPrimitrive3DIDBlock() diff --git a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx index 4698b1b5b125..15b8e1265709 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: textureprimitive3d.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -90,7 +90,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: UnifiedAlphaTexturePrimitive3D( @@ -122,7 +122,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: GradientTexturePrimitive3D( @@ -157,7 +157,7 @@ namespace drawinglayer protected: // local decomposition. - virtual Primitive3DSequence createLocalDecomposition(double fTime) const; + virtual Primitive3DSequence createLocalDecomposition(const geometry::ViewInformation3D& rViewInformation) const; public: BitmapTexturePrimitive3D( diff --git a/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx index 9755056e22cc..720f28445dec 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/transformprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: transformprimitive3d.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -62,7 +62,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive3D& rPrimitive) const; // get range - virtual basegfx::B3DRange getB3DRange(double fTime) const; + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; // provide unique ID DeclPrimitrive3DIDBlock() diff --git a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx index cdb7e390caac..45cc54e9df23 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: baseprocessor2d.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -47,9 +47,15 @@ namespace drawinglayer { class BaseProcessor2D { - protected: + private: geometry::ViewInformation2D maViewInformation2D; + protected: + void updateViewInformation(const geometry::ViewInformation2D& rViewInformation2D) + { + maViewInformation2D = rViewInformation2D; + } + public: BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation); virtual ~BaseProcessor2D(); diff --git a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx index a1cce9d32049..9528973415ab 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: baseprocessor3d.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -47,17 +48,23 @@ namespace drawinglayer class BaseProcessor3D { private: - double mfTime; + geometry::ViewInformation3D maViewInformation3D; + + protected: + void updateViewInformation(const geometry::ViewInformation3D& rViewInformation3D) + { + maViewInformation3D = rViewInformation3D; + } public: - BaseProcessor3D(double fTime); + BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation); virtual ~BaseProcessor3D(); // the central processing method virtual void process(const primitive3d::Primitive3DSequence& rSource) = 0; // data access - double getTime() const { return mfTime; } + const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; } }; } // end of namespace processor3d } // end of namespace drawinglayer @@ -74,7 +81,7 @@ namespace drawinglayer primitive3d::Primitive3DSequence maPrimitive3DSequence; public: - CollectingProcessor3D(double fTime); + CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation); // the central processing method virtual void process(const primitive3d::Primitive3DSequence& rSource); diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx index 50587d7d8df3..cef93af14cd7 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: defaultprocessor3d.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:21 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -126,7 +126,7 @@ namespace drawinglayer public: DefaultProcessor3D( - double fTime, + const geometry::ViewInformation3D& rViewInformation, const attribute::SdrSceneAttribute& rSdrSceneAttribute, const attribute::SdrLightingAttribute& rSdrLightingAttribute); virtual ~DefaultProcessor3D(); diff --git a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx index 55f1d6122b75..a12e0792a42d 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx @@ -4,9 +4,9 @@ * * $RCSfile: geometry2dextractor.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:22 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,18 +57,13 @@ namespace drawinglayer // object transformation for scene for 2d definition basegfx::B2DHomMatrix maObjectTransformation; - // prepared data (transformations) for 2D/3D transformation calculations - // will be used as transformation stack during processing (changed) - basegfx::B3DHomMatrix maWorldToView; - // the modifiedColorPrimitive stack basegfx::BColorModifierStack maBColorModifierStack; public: Geometry2DExtractingProcessor( - double fTime, - const basegfx::B2DHomMatrix& rObjectTransformation, - const basegfx::B3DHomMatrix& rWorldToView); + const geometry::ViewInformation3D& rViewInformation, + const basegfx::B2DHomMatrix& rObjectTransformation); // the central processing method virtual void process(const primitive3d::Primitive3DSequence& rSource); @@ -76,7 +71,6 @@ namespace drawinglayer // data access const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } - const basegfx::B3DHomMatrix& getWorldToView() const { return maWorldToView; } const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } }; } // end of namespace processor3d diff --git a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx index fcd910ca679f..6aff5a46fbe3 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx @@ -4,9 +4,9 @@ * * $RCSfile: shadow3dextractor.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:22 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -66,7 +66,6 @@ namespace drawinglayer // prepared data (transformations) for 2D/3D shadow calculations basegfx::B3DHomMatrix maWorldToEye; basegfx::B3DHomMatrix maEyeToView; - basegfx::B3DHomMatrix maWorldToView; basegfx::B3DVector maLightNormal; basegfx::B3DVector maShadowPlaneNormal; basegfx::B3DPoint maPlanePoint; @@ -92,10 +91,8 @@ namespace drawinglayer public: Shadow3DExtractingProcessor( - double fTime, + const geometry::ViewInformation3D& rViewInformation, const basegfx::B2DHomMatrix& rObjectTransformation, - const basegfx::B3DHomMatrix& rWorldToEye, - const basegfx::B3DHomMatrix& rEyeToView, const attribute::SdrLightingAttribute& rSdrLightingAttribute, const primitive3d::Primitive3DSequence& rPrimitiveVector, double fShadowSlant); @@ -108,7 +105,6 @@ namespace drawinglayer const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; } const basegfx::B3DHomMatrix& getEyeToView() const { return maEyeToView; } - const basegfx::B3DHomMatrix& getWorldToView() const { return maWorldToView; } }; } // end of namespace processor3d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx index 5bbdf692ab2e..dd0d0bc1b4eb 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: zbufferprocessor3d.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:22 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,7 +54,6 @@ namespace drawinglayer { } namespace geometry { class ViewInformation2D; - class Transformation3D; } } @@ -99,8 +98,8 @@ namespace drawinglayer public: ZBufferProcessor3D( - const geometry::ViewInformation2D& rViewInformation, - const geometry::Transformation3D& rTransformation3D, + const geometry::ViewInformation3D& rViewInformation3D, + const geometry::ViewInformation2D& rViewInformation2D, const attribute::SdrSceneAttribute& rSdrSceneAttribute, const attribute::SdrLightingAttribute& rSdrLightingAttribute, double fSizeX, diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index e5a6d6ae8b57..ba72b0e2711e 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -71,8 +71,8 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\animation ..\inc\drawinglayer\animation\animationtiming.hxx %_DEST%\inc%_EXT%\drawinglayer\animation\animationtiming.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\geometry -..\inc\drawinglayer\geometry\transformation3d.hxx %_DEST%\inc%_EXT%\drawinglayer\geometry\transformation3d.hxx ..\inc\drawinglayer\geometry\viewinformation2d.hxx %_DEST%\inc%_EXT%\drawinglayer\geometry\viewinformation2d.hxx +..\inc\drawinglayer\geometry\viewinformation3d.hxx %_DEST%\inc%_EXT%\drawinglayer\geometry\viewinformation3d.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor2d ..\inc\drawinglayer\processor2d\baseprocessor2d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor2d\baseprocessor2d.hxx diff --git a/drawinglayer/source/geometry/makefile.mk b/drawinglayer/source/geometry/makefile.mk index 5c52333c57ae..38ceeb55a886 100644 --- a/drawinglayer/source/geometry/makefile.mk +++ b/drawinglayer/source/geometry/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: aw $ $Date: 2006-10-19 10:36:46 $ +# last change: $Author: aw $ $Date: 2008-06-10 09:29:32 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -44,8 +44,8 @@ TARGET=geometry # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/transformation3d.obj \ - $(SLO)$/viewinformation2d.obj + $(SLO)$/viewinformation2d.obj \ + $(SLO)$/viewinformation3d.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 52a5128b2290..87ec9c7163d5 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: viewinformation2d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:32 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -75,7 +75,7 @@ namespace drawinglayer // the DrawPage which is target of visualisation. This is needed e.g. for // the view-dependent decomposition of PageNumber TextFields - uno::Reference< drawing::XDrawPage > mxVisualizedPage; + uno::Reference< drawing::XDrawPage > mxVisualizedPage; // the point in time double mfViewTime; @@ -84,7 +84,7 @@ namespace drawinglayer uno::Sequence< beans::PropertyValue > mxViewInformation; // the extra PropertyValues; not represented by ViewTransformation, - // Viewport or ViewTime + // Viewport, VisualizedPage or ViewTime uno::Sequence< beans::PropertyValue > mxExtendedInformation; // bitfield @@ -317,6 +317,15 @@ namespace drawinglayer { return mxExtendedInformation; } + + bool operator==(const ImpViewInformation2D& rCandidate) const + { + return (maViewTransformation == rCandidate.maViewTransformation + && maViewport == rCandidate.maViewport + && mxVisualizedPage == rCandidate.mxVisualizedPage + && mfViewTime == rCandidate.mfViewTime + && mxExtendedInformation == rCandidate.mxExtendedInformation); + } }; } // end of anonymous namespace } // end of namespace drawinglayer @@ -382,6 +391,16 @@ namespace drawinglayer return *this; } + bool ViewInformation2D::operator==(const ViewInformation2D& rCandidate) const + { + if(rCandidate.mpViewInformation2D == mpViewInformation2D) + { + return true; + } + + return (*rCandidate.mpViewInformation2D == *mpViewInformation2D); + } + const basegfx::B2DHomMatrix& ViewInformation2D::getViewTransformation() const { return mpViewInformation2D->getViewTransformation(); diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx new file mode 100644 index 000000000000..2f5546c75e4f --- /dev/null +++ b/drawinglayer/source/geometry/viewinformation3d.cxx @@ -0,0 +1,555 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: viewinformation3d.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2008-06-10 09:29:32 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace + { + class ImpViewInformation3D + { + private: + // ViewInformation3D implementation can change refcount, so we have only + // two memory regions for pairs of ViewInformation3D/ImpViewInformation3D + friend class ::drawinglayer::geometry::ViewInformation3D; + + // the refcounter + sal_uInt32 mnRefCount; + + // the 3D transformations + // Object to World. This may change and being adapted when entering 3D transformation + // groups + basegfx::B3DHomMatrix maTransformation; + + // World to Camera. This includes VRP, VPN and VUV camera coordinate system + basegfx::B3DHomMatrix maOrientation; + + // Camera to Device with X,Y and Z [-1.0 .. 1.0]. This is the + // 3D to 2D projection which may be parallell or perspective. When it is perspective, + // the last line of the homogen matrix will NOT be unused + basegfx::B3DHomMatrix maProjection; + + // Device to View with X,Y and Z [0.0 .. 1.0]. This converts from -1 to 1 coordinates + // in camera coordinate system to 0 to 1 in unit 2D coordinates. This way it stays + // view-independent. To get discrete coordinates, the 2D transformation of a scene + // as 2D object needs to be involved + basegfx::B3DHomMatrix maDeviceToView; + + // Object to View is the linear combination of all four transformations. It's + // buffered to avoid too much matrix multiplying and created on demand + basegfx::B3DHomMatrix maObjectToView; + + // the point in time + double mfViewTime; + + // the complete PropertyValue representation (if already created) + uno::Sequence< beans::PropertyValue > mxViewInformation; + + // the extra PropertyValues; does not contain the transformations + uno::Sequence< beans::PropertyValue > mxExtendedInformation; + + // the local UNO API strings + const ::rtl::OUString& getNamePropertyTransformation() + { + static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Transformation")); + return s_sNamePropertyTransformation; + } + + const ::rtl::OUString& getNamePropertyOrientation() + { + static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Orientation")); + return s_sNamePropertyTransformation; + } + + const ::rtl::OUString& getNamePropertyProjection() + { + static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection")); + return s_sNamePropertyTransformation; + } + + const ::rtl::OUString& getNamePropertyProjection_30() + { + static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection30")); + return s_sNamePropertyTransformation; + } + + const ::rtl::OUString& getNamePropertyProjection_31() + { + static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection31")); + return s_sNamePropertyTransformation; + } + + const ::rtl::OUString& getNamePropertyProjection_32() + { + static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection32")); + return s_sNamePropertyTransformation; + } + + const ::rtl::OUString& getNamePropertyProjection_33() + { + static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("Projection33")); + return s_sNamePropertyTransformation; + } + + const ::rtl::OUString& getNamePropertyDeviceToView() + { + static ::rtl::OUString s_sNamePropertyTransformation(RTL_CONSTASCII_USTRINGPARAM("DeviceToView")); + return s_sNamePropertyTransformation; + } + + const ::rtl::OUString& getNamePropertyTime() + { + static ::rtl::OUString s_sNamePropertyTime(RTL_CONSTASCII_USTRINGPARAM("Time")); + return s_sNamePropertyTime; + } + + void impInterpretPropertyValues(const uno::Sequence< beans::PropertyValue >& rViewParameters) + { + if(rViewParameters.hasElements()) + { + const sal_Int32 nCount(rViewParameters.getLength()); + sal_Int32 nExtendedInsert(0); + + // prepare extended information for filtering. Maximum size is nCount + mxExtendedInformation.realloc(nCount); + + for(sal_Int32 a(0); a < nCount; a++) + { + const beans::PropertyValue& rProp = rViewParameters[a]; + + if(rProp.Name == getNamePropertyTransformation()) + { + com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D; + rProp.Value >>= aAffineMatrix3D; + maTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); + } + else if(rProp.Name == getNamePropertyOrientation()) + { + com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D; + rProp.Value >>= aAffineMatrix3D; + maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); + } + else if(rProp.Name == getNamePropertyProjection()) + { + // projection may be defined using a frustum in which case the last line of + // the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that, + // these four values need to be treated extra + const double f_30(maProjection.get(3, 0)); + const double f_31(maProjection.get(3, 1)); + const double f_32(maProjection.get(3, 2)); + const double f_33(maProjection.get(3, 3)); + + com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D; + rProp.Value >>= aAffineMatrix3D; + maProjection = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); + + maProjection.set(3, 0, f_30); + maProjection.set(3, 1, f_31); + maProjection.set(3, 2, f_32); + maProjection.set(3, 3, f_33); + } + else if(rProp.Name == getNamePropertyProjection_30()) + { + double f_30(0.0); + rProp.Value >>= f_30; + maProjection.set(3, 0, f_30); + } + else if(rProp.Name == getNamePropertyProjection_31()) + { + double f_31(0.0); + rProp.Value >>= f_31; + maProjection.set(3, 1, f_31); + } + else if(rProp.Name == getNamePropertyProjection_32()) + { + double f_32(0.0); + rProp.Value >>= f_32; + maProjection.set(3, 2, f_32); + } + else if(rProp.Name == getNamePropertyProjection_33()) + { + double f_33(1.0); + rProp.Value >>= f_33; + maProjection.set(3, 3, f_33); + } + else if(rProp.Name == getNamePropertyDeviceToView()) + { + com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D; + rProp.Value >>= aAffineMatrix3D; + maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); + } + else if(rProp.Name == getNamePropertyTime()) + { + rProp.Value >>= mfViewTime; + } + else + { + // extra information; add to filtered information + mxExtendedInformation[nExtendedInsert++] = rProp; + } + } + + // extra information size is now known; realloc to final size + mxExtendedInformation.realloc(nExtendedInsert); + } + } + + void impFillViewInformationFromContent() + { + uno::Sequence< beans::PropertyValue > xRetval; + const bool bTransformationUsed(!maTransformation.isIdentity()); + const bool bOrientationUsed(!maOrientation.isIdentity()); + const bool bProjectionUsed(!maProjection.isIdentity()); + const bool bDeviceToViewUsed(!maDeviceToView.isIdentity()); + const bool bTimeUsed(0.0 < mfViewTime); + const bool bExtraInformation(mxExtendedInformation.hasElements()); + + // projection may be defined using a frustum in which case the last line of + // the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that, + // these four values need to be treated extra + const bool bProjectionUsed_30(bProjectionUsed && !basegfx::fTools::equalZero(maProjection.get(3, 0))); + const bool bProjectionUsed_31(bProjectionUsed && !basegfx::fTools::equalZero(maProjection.get(3, 1))); + const bool bProjectionUsed_32(bProjectionUsed && !basegfx::fTools::equalZero(maProjection.get(3, 2))); + const bool bProjectionUsed_33(bProjectionUsed && !basegfx::fTools::equal(maProjection.get(3, 3), 1.0)); + + sal_uInt32 nIndex(0); + const sal_uInt32 nCount( + (bTransformationUsed ? 1 : 0) + + (bOrientationUsed ? 1 : 0) + + (bProjectionUsed ? 1 : 0) + + (bProjectionUsed_30 ? 1 : 0) + + (bProjectionUsed_31 ? 1 : 0) + + (bProjectionUsed_32 ? 1 : 0) + + (bProjectionUsed_33 ? 1 : 0) + + (bDeviceToViewUsed ? 1 : 0) + + (bTimeUsed ? 1 : 0) + + (bExtraInformation ? mxExtendedInformation.getLength() : 0)); + + mxViewInformation.realloc(nCount); + + if(bTransformationUsed) + { + com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D; + basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maTransformation); + mxViewInformation[nIndex].Name = getNamePropertyTransformation(); + mxViewInformation[nIndex].Value <<= aAffineMatrix3D; + nIndex++; + } + + if(bOrientationUsed) + { + com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D; + basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maOrientation); + mxViewInformation[nIndex].Name = getNamePropertyOrientation(); + mxViewInformation[nIndex].Value <<= aAffineMatrix3D; + nIndex++; + } + + if(bProjectionUsed) + { + com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D; + basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maProjection); + mxViewInformation[nIndex].Name = getNamePropertyProjection(); + mxViewInformation[nIndex].Value <<= aAffineMatrix3D; + nIndex++; + } + + if(bProjectionUsed_30) + { + mxViewInformation[nIndex].Name = getNamePropertyProjection_30(); + mxViewInformation[nIndex].Value <<= maProjection.get(3, 0); + nIndex++; + } + + if(bProjectionUsed_31) + { + mxViewInformation[nIndex].Name = getNamePropertyProjection_31(); + mxViewInformation[nIndex].Value <<= maProjection.get(3, 1); + nIndex++; + } + + if(bProjectionUsed_32) + { + mxViewInformation[nIndex].Name = getNamePropertyProjection_32(); + mxViewInformation[nIndex].Value <<= maProjection.get(3, 2); + nIndex++; + } + + if(bProjectionUsed_33) + { + mxViewInformation[nIndex].Name = getNamePropertyProjection_33(); + mxViewInformation[nIndex].Value <<= maProjection.get(3, 3); + nIndex++; + } + + if(bDeviceToViewUsed) + { + com::sun::star::geometry::AffineMatrix3D aAffineMatrix3D; + basegfx::unotools::affineMatrixFromHomMatrix3D(aAffineMatrix3D, maDeviceToView); + mxViewInformation[nIndex].Name = getNamePropertyDeviceToView(); + mxViewInformation[nIndex].Value <<= aAffineMatrix3D; + nIndex++; + } + + if(bTimeUsed) + { + mxViewInformation[nIndex].Name = getNamePropertyTime(); + mxViewInformation[nIndex].Value <<= mfViewTime; + nIndex++; + } + + if(bExtraInformation) + { + const sal_Int32 nExtra(mxExtendedInformation.getLength()); + + for(sal_Int32 a(0); a < nExtra; a++) + { + mxViewInformation[nIndex++] = mxExtendedInformation[a]; + } + } + } + + public: + ImpViewInformation3D( + const basegfx::B3DHomMatrix& rTransformation, + const basegfx::B3DHomMatrix& rOrientation, + const basegfx::B3DHomMatrix& rProjection, + const basegfx::B3DHomMatrix& rDeviceToView, + double fViewTime, + const uno::Sequence< beans::PropertyValue >& rExtendedParameters) + : mnRefCount(0), + maTransformation(rTransformation), + maOrientation(rOrientation), + maProjection(rProjection), + maDeviceToView(rDeviceToView), + mfViewTime(fViewTime), + mxViewInformation(), + mxExtendedInformation() + { + impInterpretPropertyValues(rExtendedParameters); + } + + ImpViewInformation3D(const uno::Sequence< beans::PropertyValue >& rViewParameters) + : mnRefCount(0), + maTransformation(), + maOrientation(), + maProjection(), + maDeviceToView(), + mfViewTime(), + mxViewInformation(rViewParameters), + mxExtendedInformation() + { + impInterpretPropertyValues(rViewParameters); + } + + const basegfx::B3DHomMatrix& getTransformation() const { return maTransformation; } + const basegfx::B3DHomMatrix& getOrientation() const { return maOrientation; } + const basegfx::B3DHomMatrix& getProjection() const { return maProjection; } + const basegfx::B3DHomMatrix& getDeviceToView() const { return maDeviceToView; } + + double getViewTime() const { return mfViewTime; } + + const basegfx::B3DHomMatrix& getObjectToView() const + { + // on demand WorldToView creation + ::osl::Mutex m_mutex; + + if(maObjectToView.isIdentity()) + { + const_cast< ImpViewInformation3D* >(this)->maObjectToView = maDeviceToView * maProjection * maOrientation * maTransformation; + } + + return maObjectToView; + } + + const uno::Sequence< beans::PropertyValue >& getViewInformationSequence() const + { + if(!mxViewInformation.hasElements()) + { + const_cast< ImpViewInformation3D* >(this)->impFillViewInformationFromContent(); + } + + return mxViewInformation; + } + + const uno::Sequence< beans::PropertyValue >& getExtendedInformationSequence() const + { + return mxExtendedInformation; + } + + bool operator==(const ImpViewInformation3D& rCandidate) const + { + return (maTransformation == rCandidate.maTransformation + && maOrientation == rCandidate.maOrientation + && maProjection == rCandidate.maProjection + && maDeviceToView == rCandidate.maDeviceToView + && mfViewTime == rCandidate.mfViewTime + && mxExtendedInformation == rCandidate.mxExtendedInformation); + } + }; + } // end of anonymous namespace +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace geometry + { + ViewInformation3D::ViewInformation3D( + const basegfx::B3DHomMatrix& rTransformation, + const basegfx::B3DHomMatrix& rOrientation, + const basegfx::B3DHomMatrix& rProjection, + const basegfx::B3DHomMatrix& rDeviceToView, + double fViewTime, + const uno::Sequence< beans::PropertyValue >& rExtendedParameters) + : mpViewInformation3D(new ImpViewInformation3D(rTransformation, rOrientation, rProjection, rDeviceToView, fViewTime, rExtendedParameters)) + { + } + + ViewInformation3D::ViewInformation3D(const uno::Sequence< beans::PropertyValue >& rViewParameters) + : mpViewInformation3D(new ImpViewInformation3D(rViewParameters)) + { + } + + ViewInformation3D::ViewInformation3D(const ViewInformation3D& rCandidate) + : mpViewInformation3D(rCandidate.mpViewInformation3D) + { + ::osl::Mutex m_mutex; + mpViewInformation3D->mnRefCount++; + } + + ViewInformation3D::~ViewInformation3D() + { + ::osl::Mutex m_mutex; + + if(mpViewInformation3D->mnRefCount) + { + mpViewInformation3D->mnRefCount--; + } + else + { + delete mpViewInformation3D; + } + } + + ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D& rCandidate) + { + ::osl::Mutex m_mutex; + + if(mpViewInformation3D->mnRefCount) + { + mpViewInformation3D->mnRefCount--; + } + else + { + delete mpViewInformation3D; + } + + mpViewInformation3D = rCandidate.mpViewInformation3D; + mpViewInformation3D->mnRefCount++; + + return *this; + } + + bool ViewInformation3D::operator==(const ViewInformation3D& rCandidate) const + { + if(rCandidate.mpViewInformation3D == mpViewInformation3D) + { + return true; + } + + return (*rCandidate.mpViewInformation3D == *mpViewInformation3D); + } + + const basegfx::B3DHomMatrix& ViewInformation3D::getTransformation() const + { + return mpViewInformation3D->getTransformation(); + } + + const basegfx::B3DHomMatrix& ViewInformation3D::getOrientation() const + { + return mpViewInformation3D->getOrientation(); + } + + const basegfx::B3DHomMatrix& ViewInformation3D::getProjection() const + { + return mpViewInformation3D->getProjection(); + } + + const basegfx::B3DHomMatrix& ViewInformation3D::getDeviceToView() const + { + return mpViewInformation3D->getDeviceToView(); + } + + const basegfx::B3DHomMatrix& ViewInformation3D::getObjectToView() const + { + return mpViewInformation3D->getObjectToView(); + } + + double ViewInformation3D::getViewTime() const + { + return mpViewInformation3D->getViewTime(); + } + + const uno::Sequence< beans::PropertyValue >& ViewInformation3D::getViewInformationSequence() const + { + return mpViewInformation3D->getViewInformationSequence(); + } + + const uno::Sequence< beans::PropertyValue >& ViewInformation3D::getExtendedInformationSequence() const + { + return mpViewInformation3D->getExtendedInformationSequence(); + } + } // end of namespace geometry +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx index 4f4073c18afe..1493b221c3af 100644 --- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: embedded3dprimitive2d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:32 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -44,6 +44,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -55,11 +56,11 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence Embedded3DPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence Embedded3DPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // use info to create a yellow 2d rectangle, similar to empty 3d scenes and/or groups - basegfx::B3DRange a3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), rViewInformation.getViewTime())); - a3DRange.transform(getTransformation3D().getWorldToView()); + basegfx::B3DRange a3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), getViewInformation3D())); + a3DRange.transform(getViewInformation3D().getObjectToView()); // create 2d range from projected 3d and transform with scene's object transformation basegfx::B2DRange a2DRange; @@ -76,11 +77,11 @@ namespace drawinglayer Embedded3DPrimitive2D::Embedded3DPrimitive2D( const primitive3d::Primitive3DSequence& rxChildren3D, const basegfx::B2DHomMatrix& rObjectTransformation, - const geometry::Transformation3D& rTransformation3D) + const geometry::ViewInformation3D& rViewInformation3D) : BasePrimitive2D(), mxChildren3D(rxChildren3D), maObjectTransformation(rObjectTransformation), - maTransformation3D(rTransformation3D) + maViewInformation3D(rViewInformation3D) { } @@ -92,17 +93,17 @@ namespace drawinglayer return (primitive3d::arePrimitive3DSequencesEqual(getChildren3D(), rCompare.getChildren3D()) && getObjectTransformation() == rCompare.getObjectTransformation() - && getTransformation3D() == rCompare.getTransformation3D()); + && getViewInformation3D() == rCompare.getViewInformation3D()); } return false; } - basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { // use the 3d transformation stack to create a projection of the 3D range - basegfx::B3DRange a3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), rViewInformation.getViewTime())); - a3DRange.transform(getTransformation3D().getWorldToView()); + basegfx::B3DRange a3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(getChildren3D(), getViewInformation3D())); + a3DRange.transform(getViewInformation3D().getObjectToView()); // create 2d range from projected 3d and transform with scene's object transformation basegfx::B2DRange aRetval; diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 5c6fa3852259..be2caee3a831 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sceneprimitive2d.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -176,8 +176,8 @@ namespace drawinglayer // use default 3D primitive processor to create BitmapEx for aUnitVisiblePart and process processor3d::ZBufferProcessor3D aZBufferProcessor3D( + getViewInformation3D(), rViewInformation, - getTransformation3D(), getSdrSceneAttribute(), getSdrLightingAttribute(), aLogicRenderSize.getX(), @@ -254,9 +254,8 @@ namespace drawinglayer { // create 2D geometry extraction processor processor3d::Geometry2DExtractingProcessor aGeometryProcessor( - rViewInformation.getViewTime(), - getObjectTransformation(), - getTransformation3D().getWorldToView()); + getViewInformation3D(), + getObjectTransformation()); // process local primitives aGeometryProcessor.process(getChildren3D()); @@ -281,13 +280,13 @@ namespace drawinglayer const attribute::SdrSceneAttribute& rSdrSceneAttribute, const attribute::SdrLightingAttribute& rSdrLightingAttribute, const basegfx::B2DHomMatrix& rObjectTransformation, - const geometry::Transformation3D& rTransformation3D) + const geometry::ViewInformation3D& rViewInformation3D) : BasePrimitive2D(), mxChildren3D(rxChildren3D), maSdrSceneAttribute(rSdrSceneAttribute), maSdrLightingAttribute(rSdrLightingAttribute), maObjectTransformation(rObjectTransformation), - maTransformation3D(rTransformation3D), + maViewInformation3D(rViewInformation3D), mbShadow3DChecked(false), mbLabel3DChecked(false), mfOldDiscreteSizeX(0.0), @@ -306,7 +305,7 @@ namespace drawinglayer && getSdrSceneAttribute() == rCompare.getSdrSceneAttribute() && getSdrLightingAttribute() == rCompare.getSdrLightingAttribute() && getObjectTransformation() == rCompare.getObjectTransformation() - && getTransformation3D() == rCompare.getTransformation3D()); + && getViewInformation3D() == rCompare.getViewInformation3D()); } return false; @@ -401,7 +400,7 @@ namespace drawinglayer return BasePrimitive2D::get2DDecomposition(rViewInformation); } - bool ScenePrimitive2D::impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const + bool ScenePrimitive2D::impGetShadow3D(const geometry::ViewInformation2D& /*rViewInformation*/) const { osl::MutexGuard aGuard( m_aMutex ); @@ -409,14 +408,9 @@ namespace drawinglayer if(!mbShadow3DChecked && getChildren3D().hasElements()) { // create shadow extraction processor - const basegfx::B3DHomMatrix aWorldToEye(getTransformation3D().getOrientation() * getTransformation3D().getTransformation()); - const basegfx::B3DHomMatrix aEyeToView(getTransformation3D().getDeviceToView() * getTransformation3D().getProjection()); - processor3d::Shadow3DExtractingProcessor aShadowProcessor( - rViewInformation.getViewTime(), + getViewInformation3D(), getObjectTransformation(), - aWorldToEye, - aEyeToView, getSdrLightingAttribute(), getChildren3D(), getSdrSceneAttribute().getShadowSlant()); @@ -433,7 +427,7 @@ namespace drawinglayer return maShadowPrimitives.hasElements(); } - bool ScenePrimitive2D::impGetLabel3D(const geometry::ViewInformation2D& rViewInformation) const + bool ScenePrimitive2D::impGetLabel3D(const geometry::ViewInformation2D& /*rViewInformation*/) const { osl::MutexGuard aGuard( m_aMutex ); @@ -442,9 +436,8 @@ namespace drawinglayer { // create label extraction processor processor3d::Label3DExtractingProcessor aLabelProcessor( - rViewInformation.getViewTime(), - getObjectTransformation(), - getTransformation3D().getWorldToView()); + getViewInformation3D(), + getObjectTransformation()); // process local primitives aLabelProcessor.process(getChildren3D()); diff --git a/drawinglayer/source/primitive3d/baseprimitive3d.cxx b/drawinglayer/source/primitive3d/baseprimitive3d.cxx index dc8c1030d9ca..032ae068003b 100644 --- a/drawinglayer/source/primitive3d/baseprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/baseprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: baseprimitive3d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,7 @@ #include "precompiled_drawinglayer.hxx" #include +#include #include ////////////////////////////////////////////////////////////////////////////// @@ -45,24 +46,12 @@ using namespace com::sun::star; ////////////////////////////////////////////////////////////////////////////// -namespace -{ - const ::rtl::OUString& getNamePropertyTime() - { - static ::rtl::OUString s_sNamePropertyTime(RTL_CONSTASCII_USTRINGPARAM("Time")); - return s_sNamePropertyTime; - } -} // end of anonymous namespace - -////////////////////////////////////////////////////////////////////////////// - namespace drawinglayer { namespace primitive3d { - Primitive3DSequence BasePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence BasePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { - // default returns an empty sequence return Primitive3DSequence(); } @@ -77,19 +66,18 @@ namespace drawinglayer return (getPrimitiveID() == rPrimitive.getPrimitiveID()); } - basegfx::B3DRange BasePrimitive3D::getB3DRange(double fTime) const + basegfx::B3DRange BasePrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const { - return getB3DRangeFromPrimitive3DSequence(get3DDecomposition(fTime), fTime); + return getB3DRangeFromPrimitive3DSequence(get3DDecomposition(rViewInformation), rViewInformation); } - - Primitive3DSequence BasePrimitive3D::get3DDecomposition(double fTime) const + Primitive3DSequence BasePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); if(!getLocalDecomposition().hasElements()) { - const Primitive3DSequence aNewSequence(createLocalDecomposition(fTime)); + const Primitive3DSequence aNewSequence(createLocalDecomposition(rViewInformation)); const_cast< BasePrimitive3D* >(this)->setLocalDecomposition(aNewSequence); } @@ -98,12 +86,14 @@ namespace drawinglayer Primitive3DSequence SAL_CALL BasePrimitive3D::getDecomposition( const uno::Sequence< beans::PropertyValue >& rViewParameters ) throw ( uno::RuntimeException ) { - return get3DDecomposition(ViewParametersToTime(rViewParameters)); + const geometry::ViewInformation3D aViewInformation(rViewParameters); + return get3DDecomposition(rViewParameters); } - geometry::RealRectangle3D SAL_CALL BasePrimitive3D::getRange( const uno::Sequence< beans::PropertyValue >& rViewParameters ) throw ( uno::RuntimeException ) + com::sun::star::geometry::RealRectangle3D SAL_CALL BasePrimitive3D::getRange( const uno::Sequence< beans::PropertyValue >& rViewParameters ) throw ( uno::RuntimeException ) { - return basegfx::unotools::rectangle3DFromB3DRectangle(getB3DRange(ViewParametersToTime(rViewParameters))); + const geometry::ViewInformation3D aViewInformation(rViewParameters); + return basegfx::unotools::rectangle3DFromB3DRectangle(getB3DRange(aViewInformation)); } } // end of namespace primitive3d } // end of namespace drawinglayer @@ -116,7 +106,7 @@ namespace drawinglayer namespace primitive3d { // get range3D from a given Primitive3DReference - basegfx::B3DRange getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, double fTime) + basegfx::B3DRange getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, const geometry::ViewInformation3D& aViewInformation) { basegfx::B3DRange aRetval; @@ -128,13 +118,13 @@ namespace drawinglayer if(pCandidate) { // use it if possible - aRetval.expand(pCandidate->getB3DRange(fTime)); + aRetval.expand(pCandidate->getB3DRange(aViewInformation)); } else { // use UNO API call instead - const uno::Sequence< beans::PropertyValue > xViewParameters(TimeToViewParameters(fTime)); - aRetval.expand(basegfx::unotools::b3DRectangleFromRealRectangle3D(rCandidate->getRange(xViewParameters))); + const uno::Sequence< beans::PropertyValue >& rViewParameters(aViewInformation.getViewInformationSequence()); + aRetval.expand(basegfx::unotools::b3DRectangleFromRealRectangle3D(rCandidate->getRange(rViewParameters))); } } @@ -142,7 +132,7 @@ namespace drawinglayer } // get range3D from a given Primitive3DSequence - basegfx::B3DRange getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, double fTime) + basegfx::B3DRange getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, const geometry::ViewInformation3D& aViewInformation) { basegfx::B3DRange aRetval; @@ -152,7 +142,7 @@ namespace drawinglayer for(sal_Int32 a(0L); a < nCount; a++) { - aRetval.expand(getB3DRangeFromPrimitive3DReference(rCandidate[a], fTime)); + aRetval.expand(getB3DRangeFromPrimitive3DReference(rCandidate[a], aViewInformation)); } } @@ -267,42 +257,6 @@ namespace drawinglayer } } - // conversion helpers for 3D ViewParameters (only time used ATM) - double ViewParametersToTime(const uno::Sequence< beans::PropertyValue >& rViewParameters) - { - double fRetval(0.0); - - if(rViewParameters.hasElements()) - { - const sal_Int32 nCount(rViewParameters.getLength()); - - for(sal_Int32 a(0); a < nCount; a++) - { - const beans::PropertyValue& rProp = rViewParameters[a]; - - if(rProp.Name == getNamePropertyTime()) - { - rProp.Value >>= fRetval; - } - } - } - - return fRetval; - } - - const uno::Sequence< beans::PropertyValue > TimeToViewParameters(double fTime) - { - uno::Sequence< beans::PropertyValue > xViewParameters; - - if(0.0 < fTime) - { - xViewParameters.realloc(1); - xViewParameters[0].Name = getNamePropertyTime(); - xViewParameters[0].Value <<= fTime; - } - - return xViewParameters; - } } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/groupprimitive3d.cxx b/drawinglayer/source/primitive3d/groupprimitive3d.cxx index fa147b7dd85a..b8ed86ee952a 100644 --- a/drawinglayer/source/primitive3d/groupprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/groupprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: groupprimitive3d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -50,7 +50,7 @@ namespace drawinglayer namespace primitive3d { /// default: just return children, so all renderers not supporting group will use it's content - Primitive3DSequence GroupPrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence GroupPrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { return getChildren(); } diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx index a0c93a817a10..dd49f99b751c 100644 --- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: hatchtextureprimitive3d.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -59,7 +59,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence HatchTexturePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence HatchTexturePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; diff --git a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx index 6f58139f0dc6..b89499091dd0 100644 --- a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive3d.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -75,7 +75,7 @@ namespace drawinglayer return false; } - basegfx::B3DRange PolygonHairlinePrimitive3D::getB3DRange(double /*fTime*/) const + basegfx::B3DRange PolygonHairlinePrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const { return basegfx::tools::getRange(getB3DPolygon()); } @@ -92,7 +92,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence PolygonStrokePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence PolygonStrokePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index d9f8bc033b05..09c4acdcaed5 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygontubeprimitive3d.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -417,7 +417,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence PolygonTubePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence PolygonTubePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { const sal_uInt32 nPointCount(getB3DPolygon().count()); std::vector< BasePrimitive3D* > aResultVector; diff --git a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx index 4e8da3ebf299..f05a85869cbf 100644 --- a/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polypolygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polypolygonprimitive3d.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -76,7 +76,7 @@ namespace drawinglayer return false; } - basegfx::B3DRange PolyPolygonMaterialPrimitive3D::getB3DRange(double /*fTime*/) const + basegfx::B3DRange PolyPolygonMaterialPrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const { return basegfx::tools::getRange(getB3DPolyPolygon()); } diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx index 9058e7be7cc3..af91a74f6591 100644 --- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrcubeprimitive3d.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,7 +54,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrCubePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence SdrCubePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); Primitive3DSequence aRetval; @@ -175,11 +175,7 @@ namespace drawinglayer appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } -#ifdef DBG_UTIL - return EventuallyAddTestRange(aRetval); -#else return aRetval; -#endif } SdrCubePrimitive3D::SdrCubePrimitive3D( @@ -196,7 +192,7 @@ namespace drawinglayer return SdrPrimitive3D::operator==(rPrimitive); } - basegfx::B3DRange SdrCubePrimitive3D::getB3DRange(double /*fTime*/) const + basegfx::B3DRange SdrCubePrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const { // use defaut from sdrPrimitive3D which uses transformation expanded by line width/2. // The parent implementation which uses the ranges of the decomposition would be more diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index 33e08eafd3ac..2aef562d1e2c 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrextrudeprimitive3d.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,7 +54,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrExtrudePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence SdrExtrudePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; @@ -205,11 +205,7 @@ namespace drawinglayer } } -#ifdef DBG_UTIL - return EventuallyAddTestRange(aRetval); -#else return aRetval; -#endif } void SdrExtrudePrimitive3D::impCreateSlices() @@ -315,7 +311,7 @@ namespace drawinglayer return false; } - basegfx::B3DRange SdrExtrudePrimitive3D::getB3DRange(double /*fTime*/) const + basegfx::B3DRange SdrExtrudePrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const { // use defaut from sdrPrimitive3D which uses transformation expanded by line width/2 // The parent implementation which uses the ranges of the decomposition would be more diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index e116b6d9b1bc..e0018cb78f63 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrlatheprimitive3d.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,7 +54,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrLathePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence SdrLathePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; @@ -199,11 +199,7 @@ namespace drawinglayer } } -#ifdef DBG_UTIL - return EventuallyAddTestRange(aRetval); -#else return aRetval; -#endif } void SdrLathePrimitive3D::impCreateSlices() @@ -326,7 +322,7 @@ namespace drawinglayer return false; } - basegfx::B3DRange SdrLathePrimitive3D::getB3DRange(double /*fTime*/) const + basegfx::B3DRange SdrLathePrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const { // use defaut from sdrPrimitive3D which uses transformation expanded by line width/2 // The parent implementation which uses the ranges of the decomposition would be more diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx index 9edfc9f1888e..639635970c87 100644 --- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrpolypolygonprimitive3d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,7 +52,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrPolyPolygonPrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence SdrPolyPolygonPrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; @@ -89,11 +89,7 @@ namespace drawinglayer } } -#ifdef DBG_UTIL - return EventuallyAddTestRange(aRetval); -#else return aRetval; -#endif } SdrPolyPolygonPrimitive3D::SdrPolyPolygonPrimitive3D( @@ -119,7 +115,7 @@ namespace drawinglayer return false; } - basegfx::B3DRange SdrPolyPolygonPrimitive3D::getB3DRange(double /*fTime*/) const + basegfx::B3DRange SdrPolyPolygonPrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const { // added this implementation to make sure that non-visible objects of this // kind will deliver their expansion. If not implemented, it would never deliver diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx index 3cf74720f95c..3b2f56be0d6c 100644 --- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrprimitive3d.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -126,32 +126,6 @@ namespace drawinglayer return false; } -#ifdef DBG_UTIL - Primitive3DSequence SdrPrimitive3D::EventuallyAddTestRange(Primitive3DSequence& rTarget) const - { - static bool bAddBoundCretsForTest(false); - - if(bAddBoundCretsForTest) - { - const basegfx::B3DRange a3DRange(getB3DRange(0.0)); - const basegfx::B3DPolyPolygon aLine(basegfx::tools::createCubePolyPolygonFromB3DRange(a3DRange)); - const basegfx::BColor aBColor(0.0, 0.0, 1.0); - const ::std::vector< double > aEmptyVector; - const drawinglayer::attribute::SdrLineAttribute aLineAttribute( - basegfx::B2DLINEJOIN_NONE, - 0.0, - 0.0, - aBColor, - aEmptyVector, - 0.0); - const basegfx::B3DHomMatrix aEmptyTransform; - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, aEmptyTransform, aLineAttribute)); - appendPrimitive3DSequenceToPrimitive3DSequence(rTarget, aLines); - } - - return rTarget; - } -#endif } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx index d3f98fa9ea74..74a5713b69e8 100644 --- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrsphereprimitive3d.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,7 +54,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence SdrSpherePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence SdrSpherePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { Primitive3DSequence aRetval; const basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); @@ -162,11 +162,7 @@ namespace drawinglayer appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } -#ifdef DBG_UTIL - return EventuallyAddTestRange(aRetval); -#else return aRetval; -#endif } SdrSpherePrimitive3D::SdrSpherePrimitive3D( @@ -195,7 +191,7 @@ namespace drawinglayer return false; } - basegfx::B3DRange SdrSpherePrimitive3D::getB3DRange(double /*fTime*/) const + basegfx::B3DRange SdrSpherePrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const { // use defaut from sdrPrimitive3D which uses transformation expanded by line width/2 // The parent implementation which uses the ranges of the decomposition would be more diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index f355f403adf1..3393346d0b2d 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: textureprimitive3d.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -81,7 +81,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence UnifiedAlphaTexturePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence UnifiedAlphaTexturePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { if(0.0 == getTransparence()) { @@ -135,7 +135,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence GradientTexturePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence GradientTexturePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { return getChildren(); } @@ -175,7 +175,7 @@ namespace drawinglayer { namespace primitive3d { - Primitive3DSequence BitmapTexturePrimitive3D::createLocalDecomposition(double /*fTime*/) const + Primitive3DSequence BitmapTexturePrimitive3D::createLocalDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { return getChildren(); } diff --git a/drawinglayer/source/primitive3d/transformprimitive3d.cxx b/drawinglayer/source/primitive3d/transformprimitive3d.cxx index 3d5ddbcb54a6..cc96a9ecbc8d 100644 --- a/drawinglayer/source/primitive3d/transformprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/transformprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: transformprimitive3d.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -70,9 +70,9 @@ namespace drawinglayer return false; } - basegfx::B3DRange TransformPrimitive3D::getB3DRange(double fTime) const + basegfx::B3DRange TransformPrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const { - basegfx::B3DRange aRetval(getB3DRangeFromPrimitive3DSequence(getChildren(), fTime)); + basegfx::B3DRange aRetval(getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation)); aRetval.transform(getTransformation()); return aRetval; } diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index 255aac4d8598..00013375d94f 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -4,9 +4,9 @@ * * $RCSfile: canvasprocessor.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1310,12 +1310,13 @@ namespace drawinglayer // create new transformations for CurrentTransformation // and for local ViewInformation2D maCurrentTransformation = maCurrentTransformation * rTransformCandidate.getTransformation(); - maViewInformation2D = geometry::ViewInformation2D( + const geometry::ViewInformation2D aViewInformation2D( getViewInformation2D().getViewTransformation() * rTransformCandidate.getTransformation(), getViewInformation2D().getViewport(), getViewInformation2D().getVisualizedPage(), getViewInformation2D().getViewTime(), getViewInformation2D().getExtendedInformationSequence()); + updateViewInformation(aViewInformation2D); // set at canvas canvas::tools::setViewStateTransform(maViewState, maCurrentTransformation); @@ -1325,7 +1326,7 @@ namespace drawinglayer // restore transformations maCurrentTransformation = aLastCurrentTransformation; - maViewInformation2D = aLastViewInformation2D; + updateViewInformation(aLastViewInformation2D); // restore at canvas canvas::tools::setViewStateTransform(maViewState, maCurrentTransformation); diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx index 08f9297e9d46..cea25303a7cd 100644 --- a/drawinglayer/source/processor2d/contourextractor2d.cxx +++ b/drawinglayer/source/processor2d/contourextractor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: contourextractor2d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -143,19 +143,21 @@ namespace drawinglayer // create new transformations for CurrentTransformation and for local ViewInformation2D maCurrentTransformation = maCurrentTransformation * rTransformCandidate.getTransformation(); - maViewInformation2D = geometry::ViewInformation2D( + const geometry::ViewInformation2D aViewInformation2D( getViewInformation2D().getViewTransformation() * rTransformCandidate.getTransformation(), getViewInformation2D().getViewport(), getViewInformation2D().getVisualizedPage(), getViewInformation2D().getViewTime(), getViewInformation2D().getExtendedInformationSequence()); + updateViewInformation(aViewInformation2D); // proccess content process(rTransformCandidate.getChildren()); // restore transformations maCurrentTransformation = aLastCurrentTransformation; - maViewInformation2D = aLastViewInformation2D; + updateViewInformation(aLastViewInformation2D); + break; } case PRIMITIVE2D_ID_SCENEPRIMITIVE2D : diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 55d5a9439c91..7df7a3276ab6 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclprocessor2d.cxx,v $ * - * $Revision: 1.29 $ + * $Revision: 1.30 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:22 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -762,19 +762,20 @@ namespace drawinglayer // create new transformations for CurrentTransformation // and for local ViewInformation2D maCurrentTransformation = maCurrentTransformation * rTransformCandidate.getTransformation(); - maViewInformation2D = geometry::ViewInformation2D( + const geometry::ViewInformation2D aViewInformation2D( getViewInformation2D().getViewTransformation() * rTransformCandidate.getTransformation(), getViewInformation2D().getViewport(), getViewInformation2D().getVisualizedPage(), getViewInformation2D().getViewTime(), getViewInformation2D().getExtendedInformationSequence()); + updateViewInformation(aViewInformation2D); // proccess content process(rTransformCandidate.getChildren()); // restore transformations maCurrentTransformation = aLastCurrentTransformation; - maViewInformation2D = aLastViewInformation2D; + updateViewInformation(aLastViewInformation2D); } // new XDrawPage for ViewInformation2D @@ -784,18 +785,19 @@ namespace drawinglayer const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D()); // create new local ViewInformation2D - maViewInformation2D = geometry::ViewInformation2D( + const geometry::ViewInformation2D aViewInformation2D( getViewInformation2D().getViewTransformation(), getViewInformation2D().getViewport(), rPagePreviewCandidate.getXDrawPage(), getViewInformation2D().getViewTime(), getViewInformation2D().getExtendedInformationSequence()); + updateViewInformation(aViewInformation2D); // proccess decomposed content process(rPagePreviewCandidate.get2DDecomposition(getViewInformation2D())); // restore transformations - maViewInformation2D = aLastViewInformation2D; + updateViewInformation(aLastViewInformation2D); } // marker diff --git a/drawinglayer/source/processor3d/baseprocessor3d.cxx b/drawinglayer/source/processor3d/baseprocessor3d.cxx index 6619d359f7ee..9daa9a44bc55 100644 --- a/drawinglayer/source/processor3d/baseprocessor3d.cxx +++ b/drawinglayer/source/processor3d/baseprocessor3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: baseprocessor3d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:22 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -48,8 +48,8 @@ namespace drawinglayer { namespace processor3d { - BaseProcessor3D::BaseProcessor3D(double fTime) - : mfTime(fTime) + BaseProcessor3D::BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation) + : maViewInformation3D(rViewInformation) { } @@ -65,8 +65,8 @@ namespace drawinglayer { namespace processor3d { - CollectingProcessor3D::CollectingProcessor3D(double fTime) - : BaseProcessor3D(fTime), + CollectingProcessor3D::CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation) + : BaseProcessor3D(rViewInformation), maPrimitive3DSequence() { } diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index b0c7a416f4da..03d2a4b130b6 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: defaultprocessor3d.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:22 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -488,7 +488,7 @@ namespace drawinglayer if(bDoHatchDecomposition) { // let break down - process(rBasePrimitive.get3DDecomposition(getTime())); + process(rBasePrimitive.get3DDecomposition(getViewInformation3D())); } else { @@ -549,7 +549,7 @@ namespace drawinglayer default: { // process recursively - process(rBasePrimitive.get3DDecomposition(getTime())); + process(rBasePrimitive.get3DDecomposition(getViewInformation3D())); break; } } @@ -578,8 +578,8 @@ namespace drawinglayer else { // unknown implementation, use UNO API call instead and process recursively - const uno::Sequence< beans::PropertyValue > xViewParameters(primitive3d::TimeToViewParameters(getTime())); - process(xReference->getDecomposition(xViewParameters)); + const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence()); + process(xReference->getDecomposition(rViewParameters)); } } } @@ -587,10 +587,10 @@ namespace drawinglayer } DefaultProcessor3D::DefaultProcessor3D( - double fTime, + const geometry::ViewInformation3D& rViewInformation, const attribute::SdrSceneAttribute& rSdrSceneAttribute, const attribute::SdrLightingAttribute& rSdrLightingAttribute) - : BaseProcessor3D(fTime), + : BaseProcessor3D(rViewInformation), mrSdrSceneAttribute(rSdrSceneAttribute), mrSdrLightingAttribute(rSdrLightingAttribute), maWorldToEye(), diff --git a/drawinglayer/source/processor3d/geometry2dextractor.cxx b/drawinglayer/source/processor3d/geometry2dextractor.cxx index 7fad3c84c876..da2d37672f04 100644 --- a/drawinglayer/source/processor3d/geometry2dextractor.cxx +++ b/drawinglayer/source/processor3d/geometry2dextractor.cxx @@ -4,9 +4,9 @@ * * $RCSfile: geometry2dextractor.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:22 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -59,13 +59,11 @@ namespace drawinglayer namespace processor3d { Geometry2DExtractingProcessor::Geometry2DExtractingProcessor( - double fTime, - const basegfx::B2DHomMatrix& rObjectTransformation, - const basegfx::B3DHomMatrix& rWorldToView) - : BaseProcessor3D(fTime), + const geometry::ViewInformation3D& rViewInformation, + const basegfx::B2DHomMatrix& rObjectTransformation) + : BaseProcessor3D(rViewInformation), maPrimitive2DSequence(), maObjectTransformation(rObjectTransformation), - maWorldToView(rWorldToView), maBColorModifierStack() { } @@ -95,16 +93,23 @@ namespace drawinglayer { // transform group. Remember current transformations const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(*(xReference.get())); - basegfx::B3DHomMatrix aLastWorldToView(getWorldToView()); - - // create new transformations - maWorldToView = getWorldToView() * rPrimitive.getTransformation(); + const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D()); + + // create new transformation; add new object transform from right side + const geometry::ViewInformation3D aNewViewInformation3D( + aLastViewInformation3D.getTransformation() * rPrimitive.getTransformation(), + aLastViewInformation3D.getOrientation(), + aLastViewInformation3D.getProjection(), + aLastViewInformation3D.getDeviceToView(), + aLastViewInformation3D.getViewTime(), + aLastViewInformation3D.getExtendedInformationSequence()); + updateViewInformation(aNewViewInformation3D); // let break down recursively process(rPrimitive.getChildren()); // restore transformations - maWorldToView = aLastWorldToView; + updateViewInformation(aLastViewInformation3D); break; } case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D : @@ -125,7 +130,7 @@ namespace drawinglayer { // PolygonHairlinePrimitive3D const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(*pBasePrimitive); - basegfx::B2DPolygon a2DHairline(basegfx::tools::createB2DPolygonFromB3DPolygon(rPrimitive.getB3DPolygon(), getWorldToView())); + basegfx::B2DPolygon a2DHairline(basegfx::tools::createB2DPolygonFromB3DPolygon(rPrimitive.getB3DPolygon(), getViewInformation3D().getObjectToView())); if(a2DHairline.count()) { @@ -140,7 +145,7 @@ namespace drawinglayer { // PolyPolygonMaterialPrimitive3D const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive); - basegfx::B2DPolyPolygon a2DFill(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPrimitive.getB3DPolyPolygon(), getWorldToView())); + basegfx::B2DPolyPolygon a2DFill(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPrimitive.getB3DPolyPolygon(), getViewInformation3D().getObjectToView())); if(a2DFill.count()) { @@ -176,7 +181,7 @@ namespace drawinglayer default : { // process recursively - process(pBasePrimitive->get3DDecomposition(getTime())); + process(pBasePrimitive->get3DDecomposition(getViewInformation3D())); break; } } @@ -184,8 +189,8 @@ namespace drawinglayer else { // unknown implementation, use UNO API call instead and process recursively - const uno::Sequence< beans::PropertyValue > xViewParameters(primitive3d::TimeToViewParameters(getTime())); - process(xReference->getDecomposition(xViewParameters)); + const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence()); + process(xReference->getDecomposition(rViewParameters)); } } } diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index f6ab7cd8df7c..749540a12cfc 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -4,9 +4,9 @@ * * $RCSfile: shadow3dextractor.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:22 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:33 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,20 +61,17 @@ namespace drawinglayer namespace processor3d { Shadow3DExtractingProcessor::Shadow3DExtractingProcessor( - double fTime, + const geometry::ViewInformation3D& rViewInformation, const basegfx::B2DHomMatrix& rObjectTransformation, - const basegfx::B3DHomMatrix& rWorldToEye, - const basegfx::B3DHomMatrix& rEyeToView, const attribute::SdrLightingAttribute& rSdrLightingAttribute, const primitive3d::Primitive3DSequence& rPrimitiveSequence, double fShadowSlant) - : BaseProcessor3D(fTime), + : BaseProcessor3D(rViewInformation), maPrimitive2DSequence(), mpPrimitive2DSequence(&maPrimitive2DSequence), maObjectTransformation(rObjectTransformation), - maWorldToEye(rWorldToEye), - maEyeToView(rEyeToView), - maWorldToView(maEyeToView * maWorldToEye), + maWorldToEye(), + maEyeToView(), maLightNormal(), maShadowPlaneNormal(), maPlanePoint(), @@ -84,19 +81,11 @@ namespace drawinglayer mbConvert(false), mbUseProjection(false) { - // create deviceToView projection for shadow geometry - // outcome is [-1.0 .. 1.0] in X,Y and Z. bring to [0.0 .. 1.0]. Also - // necessary to flip Y due to screen orientation - // Z is not needed, but will also be brought to [0.0 .. 1.0] - basegfx::B3DHomMatrix aDeviceToView; - aDeviceToView.scale(0.5, -0.5, 0.5); - aDeviceToView.translate(0.5, 0.5, 0.5); - // calculate shadow projection stuff if(rSdrLightingAttribute.getLightVector().size()) { // get light normal, plane normal and sclalar from it - maLightNormal = rSdrLightingAttribute.getLightVector()[0L].getDirection(); + maLightNormal = rSdrLightingAttribute.getLightVector()[0].getDirection(); maLightNormal.normalize(); maShadowPlaneNormal = basegfx::B3DVector(0.0, sin(fShadowSlant), cos(fShadowSlant)); maShadowPlaneNormal.normalize(); @@ -105,7 +94,12 @@ namespace drawinglayer // use only when scalar is > 0.0, so the light is in front of the object if(basegfx::fTools::more(mfLightPlaneScalar, 0.0)) { - basegfx::B3DRange aContained3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(rPrimitiveSequence, getTime())); + // prepare buffered WorldToEye and EyeToView + maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getTransformation(); + maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection(); + + // calculate range to get front edge around which to rotate the shadow's projection + basegfx::B3DRange aContained3DRange(primitive3d::getB3DRangeFromPrimitive3DSequence(rPrimitiveSequence, getViewInformation3D())); aContained3DRange.transform(getWorldToEye()); maPlanePoint.setX(maShadowPlaneNormal.getX() < 0.0 ? aContained3DRange.getMinX() : aContained3DRange.getMaxX()); maPlanePoint.setY(maShadowPlaneNormal.getY() > 0.0 ? aContained3DRange.getMinY() : aContained3DRange.getMaxY()); @@ -185,19 +179,37 @@ namespace drawinglayer { // transform group. Remember current transformations const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(*pBasePrimitive); - basegfx::B3DHomMatrix aLastWorldToView(getWorldToView()); - basegfx::B3DHomMatrix aLastWorldToEye(getWorldToEye()); - - // create new transformations - maWorldToView = getWorldToView() * rPrimitive.getTransformation(); - maWorldToEye = getWorldToEye() * rPrimitive.getTransformation(); + const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D()); + + // create new transformation; add new object transform from right side + const geometry::ViewInformation3D aNewViewInformation3D( + aLastViewInformation3D.getTransformation() * rPrimitive.getTransformation(), + aLastViewInformation3D.getOrientation(), + aLastViewInformation3D.getProjection(), + aLastViewInformation3D.getDeviceToView(), + aLastViewInformation3D.getViewTime(), + aLastViewInformation3D.getExtendedInformationSequence()); + updateViewInformation(aNewViewInformation3D); + + if(mbShadowProjectionIsValid) + { + // update buffered WorldToEye and EyeToView + maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getTransformation(); + maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection(); + } // let break down process(rPrimitive.getChildren()); // restore transformations - maWorldToView = aLastWorldToView; - maWorldToEye = aLastWorldToEye; + updateViewInformation(aLastViewInformation3D); + + if(mbShadowProjectionIsValid) + { + // update buffered WorldToEye and EyeToView + maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getTransformation(); + maEyeToView = getViewInformation3D().getDeviceToView() * getViewInformation3D().getProjection(); + } break; } case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : @@ -217,7 +229,7 @@ namespace drawinglayer } else { - a2DHairline = basegfx::tools::createB2DPolygonFromB3DPolygon(rPrimitive.getB3DPolygon(), getWorldToView()); + a2DHairline = basegfx::tools::createB2DPolygonFromB3DPolygon(rPrimitive.getB3DPolygon(), getViewInformation3D().getObjectToView()); } if(a2DHairline.count()) @@ -246,7 +258,7 @@ namespace drawinglayer } else { - a2DFill = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPrimitive.getB3DPolyPolygon(), getWorldToView()); + a2DFill = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rPrimitive.getB3DPolyPolygon(), getViewInformation3D().getObjectToView()); } if(a2DFill.count()) @@ -267,7 +279,7 @@ namespace drawinglayer default : { // process recursively - process(pBasePrimitive->get3DDecomposition(getTime())); + process(pBasePrimitive->get3DDecomposition(getViewInformation3D())); break; } } @@ -275,8 +287,8 @@ namespace drawinglayer else { // unknown implementation, use UNO API call instead and process recursively - const uno::Sequence< beans::PropertyValue > xViewParameters(primitive3d::TimeToViewParameters(getTime())); - process(xReference->getDecomposition(xViewParameters)); + const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation3D().getViewInformationSequence()); + process(xReference->getDecomposition(rViewParameters)); } } } diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index 91b85b44cfc6..82b157ade202 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: zbufferprocessor3d.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:22 $ + * last change: $Author: aw $ $Date: 2008-06-10 09:29:34 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -49,7 +49,6 @@ #include #include #include -#include ////////////////////////////////////////////////////////////////////////////// @@ -571,15 +570,15 @@ namespace drawinglayer } ZBufferProcessor3D::ZBufferProcessor3D( - const geometry::ViewInformation2D& rViewInformation, - const geometry::Transformation3D& rTransformation3D, + 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) - : DefaultProcessor3D(rViewInformation.getViewTime(), rSdrSceneAttribute, rSdrLightingAttribute), + : DefaultProcessor3D(rViewInformation3D, rSdrSceneAttribute, rSdrLightingAttribute), mpBZPixelRaster(0), maInvEyeToView(), mpZBufferRasterConverter3D(0), @@ -588,8 +587,8 @@ namespace drawinglayer mbContainsTransparent(false) { // generate ViewSizes - const double fFullViewSizeX((rViewInformation.getViewTransformation() * basegfx::B2DVector(fSizeX, 0.0)).getLength()); - const double fFullViewSizeY((rViewInformation.getViewTransformation() * basegfx::B2DVector(0.0, fSizeY)).getLength()); + const double fFullViewSizeX((rViewInformation2D.getViewTransformation() * basegfx::B2DVector(fSizeX, 0.0)).getLength()); + const double fFullViewSizeY((rViewInformation2D.getViewTransformation() * basegfx::B2DVector(0.0, fSizeY)).getLength()); const double fViewSizeX(fFullViewSizeX * rVisiblePart.getWidth()); const double fViewSizeY(fFullViewSizeY * rVisiblePart.getHeight()); @@ -636,13 +635,13 @@ namespace drawinglayer } // create world to eye transformation - maWorldToEye = rTransformation3D.getOrientation() * rTransformation3D.getTransformation(); + maWorldToEye = getViewInformation3D().getOrientation() * getViewInformation3D().getTransformation(); // create EyeToView transformation - maWorldToView = aDeviceToView * rTransformation3D.getProjection() * maWorldToEye; + maWorldToView = aDeviceToView * getViewInformation3D().getProjection() * maWorldToEye; // create inverse EyeToView transformation - maInvEyeToView = aDeviceToView * rTransformation3D.getProjection(); + maInvEyeToView = aDeviceToView * getViewInformation3D().getProjection(); maInvEyeToView.invert(); // prepare maRasterRange -- cgit