diff options
author | Armin Weiss <aw@openoffice.org> | 2008-06-10 08:29:56 +0000 |
---|---|---|
committer | Armin Weiss <aw@openoffice.org> | 2008-06-10 08:29:56 +0000 |
commit | 4eed20ca2861504ee08ee50f7173a74bfb56bfa5 (patch) | |
tree | f3385d455bfdcc7dfa611b767898e13376f7085b /drawinglayer/source/processor3d | |
parent | 58f9ce012e902af26b4021fe50b20a7da91ee7bd (diff) |
#i39532# changed 3d primitive stuff to use viewinformation3d
Diffstat (limited to 'drawinglayer/source/processor3d')
5 files changed, 90 insertions, 74 deletions
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 <drawinglayer/primitive3d/polygonprimitive3d.hxx> #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> -#include <drawinglayer/geometry/transformation3d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -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 |