1ce9c7ef7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3ce9c7ef7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4ce9c7ef7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5ce9c7ef7SAndrew Rist * distributed with this work for additional information 6ce9c7ef7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7ce9c7ef7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8ce9c7ef7SAndrew Rist * "License"); you may not use this file except in compliance 9ce9c7ef7SAndrew Rist * with the License. You may obtain a copy of the License at 10ce9c7ef7SAndrew Rist * 11ce9c7ef7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12ce9c7ef7SAndrew Rist * 13ce9c7ef7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14ce9c7ef7SAndrew Rist * software distributed under the License is distributed on an 15ce9c7ef7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16ce9c7ef7SAndrew Rist * KIND, either express or implied. See the License for the 17ce9c7ef7SAndrew Rist * specific language governing permissions and limitations 18ce9c7ef7SAndrew Rist * under the License. 19ce9c7ef7SAndrew Rist * 20ce9c7ef7SAndrew Rist *************************************************************/ 21ce9c7ef7SAndrew Rist 22ce9c7ef7SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _BGFX_RASTER_RASTERCONVERT3D_HXX 25cdf0e10cSrcweir #define _BGFX_RASTER_RASTERCONVERT3D_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <sal/types.h> 28cdf0e10cSrcweir #include <vector> 29cdf0e10cSrcweir #include <basegfx/color/bcolor.hxx> 30cdf0e10cSrcweir #include <basegfx/vector/b3dvector.hxx> 31cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx> 32cdf0e10cSrcweir #include <basegfx/vector/b2dvector.hxx> 33*b63233d8Sdamjan #include <basegfx/basegfxdllapi.h> 34cdf0e10cSrcweir 35cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 36cdf0e10cSrcweir // predeclarations 37cdf0e10cSrcweir 38cdf0e10cSrcweir namespace basegfx 39cdf0e10cSrcweir { 40cdf0e10cSrcweir class B3DPolygon; 41cdf0e10cSrcweir class B3DPolyPolygon; 42cdf0e10cSrcweir } 43cdf0e10cSrcweir 44cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 45cdf0e10cSrcweir // interpolators for double precision 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace basegfx 48cdf0e10cSrcweir { 49*b63233d8Sdamjan class BASEGFX_DLLPUBLIC ip_single 50cdf0e10cSrcweir { 51cdf0e10cSrcweir private: 52cdf0e10cSrcweir double mfVal; 53cdf0e10cSrcweir double mfInc; 54cdf0e10cSrcweir 55cdf0e10cSrcweir public: ip_single()56cdf0e10cSrcweir ip_single() 57cdf0e10cSrcweir : mfVal(0.0), 58cdf0e10cSrcweir mfInc(0.0) 59cdf0e10cSrcweir {} 60cdf0e10cSrcweir ip_single(double fVal,double fInc)61cdf0e10cSrcweir ip_single(double fVal, double fInc) 62cdf0e10cSrcweir : mfVal(fVal), 63cdf0e10cSrcweir mfInc(fInc) 64cdf0e10cSrcweir {} 65cdf0e10cSrcweir getVal() const66cdf0e10cSrcweir double getVal() const { return mfVal; } getInc() const67cdf0e10cSrcweir double getInc() const { return mfInc; } 68cdf0e10cSrcweir increment(double fStep)69cdf0e10cSrcweir void increment(double fStep) { mfVal += fStep * mfInc; } 70cdf0e10cSrcweir }; 71cdf0e10cSrcweir } // end of namespace basegfx 72cdf0e10cSrcweir 73cdf0e10cSrcweir namespace basegfx 74cdf0e10cSrcweir { 75*b63233d8Sdamjan class BASEGFX_DLLPUBLIC ip_double 76cdf0e10cSrcweir { 77cdf0e10cSrcweir private: 78cdf0e10cSrcweir ip_single maX; 79cdf0e10cSrcweir ip_single maY; 80cdf0e10cSrcweir 81cdf0e10cSrcweir public: ip_double()82cdf0e10cSrcweir ip_double() 83cdf0e10cSrcweir : maX(), 84cdf0e10cSrcweir maY() 85cdf0e10cSrcweir {} 86cdf0e10cSrcweir ip_double(double fXVal,double fXInc,double fYVal,double fYInc)87cdf0e10cSrcweir ip_double(double fXVal, double fXInc, double fYVal, double fYInc) 88cdf0e10cSrcweir : maX(fXVal, fXInc), 89cdf0e10cSrcweir maY(fYVal, fYInc) 90cdf0e10cSrcweir {} 91cdf0e10cSrcweir getX() const92cdf0e10cSrcweir const ip_single& getX() const { return maX; } getY() const93cdf0e10cSrcweir const ip_single& getY() const { return maY; } 94cdf0e10cSrcweir increment(double fStep)95cdf0e10cSrcweir void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); } 96cdf0e10cSrcweir }; 97cdf0e10cSrcweir } // end of namespace basegfx 98cdf0e10cSrcweir 99cdf0e10cSrcweir namespace basegfx 100cdf0e10cSrcweir { 101*b63233d8Sdamjan class BASEGFX_DLLPUBLIC ip_triple 102cdf0e10cSrcweir { 103cdf0e10cSrcweir private: 104cdf0e10cSrcweir ip_single maX; 105cdf0e10cSrcweir ip_single maY; 106cdf0e10cSrcweir ip_single maZ; 107cdf0e10cSrcweir 108cdf0e10cSrcweir public: ip_triple()109cdf0e10cSrcweir ip_triple() 110cdf0e10cSrcweir : maX(), 111cdf0e10cSrcweir maY(), 112cdf0e10cSrcweir maZ() 113cdf0e10cSrcweir {} 114cdf0e10cSrcweir ip_triple(double fXVal,double fXInc,double fYVal,double fYInc,double fZVal,double fZInc)115cdf0e10cSrcweir ip_triple(double fXVal, double fXInc, double fYVal, double fYInc, double fZVal, double fZInc) 116cdf0e10cSrcweir : maX(fXVal, fXInc), 117cdf0e10cSrcweir maY(fYVal, fYInc), 118cdf0e10cSrcweir maZ(fZVal, fZInc) 119cdf0e10cSrcweir {} 120cdf0e10cSrcweir getX() const121cdf0e10cSrcweir const ip_single& getX() const { return maX; } getY() const122cdf0e10cSrcweir const ip_single& getY() const { return maY; } getZ() const123cdf0e10cSrcweir const ip_single& getZ() const { return maZ; } 124cdf0e10cSrcweir increment(double fStep)125cdf0e10cSrcweir void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); maZ.increment(fStep); } 126cdf0e10cSrcweir }; 127cdf0e10cSrcweir } // end of namespace basegfx 128cdf0e10cSrcweir 129cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 130cdf0e10cSrcweir // InterpolatorProvider3D to have a common source for allocating interpolators 131cdf0e10cSrcweir // which may then be addressed using the index to the vectors 132cdf0e10cSrcweir 133cdf0e10cSrcweir namespace basegfx 134cdf0e10cSrcweir { 135cdf0e10cSrcweir #define SCANLINE_EMPTY_INDEX (0xffffffff) 136cdf0e10cSrcweir 137*b63233d8Sdamjan class BASEGFX_DLLPUBLIC InterpolatorProvider3D 138cdf0e10cSrcweir { 139cdf0e10cSrcweir private: 140cdf0e10cSrcweir ::std::vector< ip_triple > maColorInterpolators; 141cdf0e10cSrcweir ::std::vector< ip_triple > maNormalInterpolators; 142cdf0e10cSrcweir ::std::vector< ip_double > maTextureInterpolators; 143cdf0e10cSrcweir ::std::vector< ip_triple > maInverseTextureInterpolators; 144cdf0e10cSrcweir 145cdf0e10cSrcweir protected: addColorInterpolator(const BColor & rA,const BColor & rB,double fInvYDelta)146cdf0e10cSrcweir sal_uInt32 addColorInterpolator(const BColor& rA, const BColor& rB, double fInvYDelta) 147cdf0e10cSrcweir { 1487024eca9SArmin Le Grand double aDeltaRed(rB.getRed() - rA.getRed()); 1497024eca9SArmin Le Grand 1507024eca9SArmin Le Grand if(fTools::equalZero(aDeltaRed)) 1517024eca9SArmin Le Grand { 1527024eca9SArmin Le Grand aDeltaRed = 0.0; 1537024eca9SArmin Le Grand } 1547024eca9SArmin Le Grand else 1557024eca9SArmin Le Grand { 1567024eca9SArmin Le Grand aDeltaRed *= fInvYDelta; 1577024eca9SArmin Le Grand } 1587024eca9SArmin Le Grand 1597024eca9SArmin Le Grand double aDeltaGreen(rB.getGreen() - rA.getGreen()); 1607024eca9SArmin Le Grand 1617024eca9SArmin Le Grand if(fTools::equalZero(aDeltaGreen)) 1627024eca9SArmin Le Grand { 1637024eca9SArmin Le Grand aDeltaGreen = 0.0; 1647024eca9SArmin Le Grand } 1657024eca9SArmin Le Grand else 1667024eca9SArmin Le Grand { 1677024eca9SArmin Le Grand aDeltaGreen *= fInvYDelta; 1687024eca9SArmin Le Grand } 1697024eca9SArmin Le Grand 1707024eca9SArmin Le Grand double aDeltaBlue(rB.getBlue() - rA.getBlue()); 1717024eca9SArmin Le Grand 1727024eca9SArmin Le Grand if(fTools::equalZero(aDeltaBlue)) 1737024eca9SArmin Le Grand { 1747024eca9SArmin Le Grand aDeltaBlue = 0.0; 1757024eca9SArmin Le Grand } 1767024eca9SArmin Le Grand else 1777024eca9SArmin Le Grand { 1787024eca9SArmin Le Grand aDeltaBlue *= fInvYDelta; 1797024eca9SArmin Le Grand } 1807024eca9SArmin Le Grand 1817024eca9SArmin Le Grand maColorInterpolators.push_back( 1827024eca9SArmin Le Grand ip_triple( 1837024eca9SArmin Le Grand rA.getRed(), aDeltaRed, 1847024eca9SArmin Le Grand rA.getGreen(), aDeltaGreen, 1857024eca9SArmin Le Grand rA.getBlue(), aDeltaBlue)); 1867024eca9SArmin Le Grand 1877024eca9SArmin Le Grand return (maColorInterpolators.size() - 1); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir addNormalInterpolator(const B3DVector & rA,const B3DVector & rB,double fInvYDelta)190cdf0e10cSrcweir sal_uInt32 addNormalInterpolator(const B3DVector& rA, const B3DVector& rB, double fInvYDelta) 191cdf0e10cSrcweir { 1927024eca9SArmin Le Grand double aDeltaX(rB.getX() - rA.getX()); 1937024eca9SArmin Le Grand 1947024eca9SArmin Le Grand if(fTools::equalZero(aDeltaX)) 1957024eca9SArmin Le Grand { 1967024eca9SArmin Le Grand aDeltaX = 0.0; 1977024eca9SArmin Le Grand } 1987024eca9SArmin Le Grand else 1997024eca9SArmin Le Grand { 2007024eca9SArmin Le Grand aDeltaX *= fInvYDelta; 2017024eca9SArmin Le Grand } 2027024eca9SArmin Le Grand 2037024eca9SArmin Le Grand double aDeltaY(rB.getY() - rA.getY()); 2047024eca9SArmin Le Grand 2057024eca9SArmin Le Grand if(fTools::equalZero(aDeltaY)) 2067024eca9SArmin Le Grand { 2077024eca9SArmin Le Grand aDeltaY = 0.0; 2087024eca9SArmin Le Grand } 2097024eca9SArmin Le Grand else 2107024eca9SArmin Le Grand { 2117024eca9SArmin Le Grand aDeltaY *= fInvYDelta; 2127024eca9SArmin Le Grand } 2137024eca9SArmin Le Grand 2147024eca9SArmin Le Grand double aDeltaZ(rB.getZ() - rA.getZ()); 2157024eca9SArmin Le Grand 2167024eca9SArmin Le Grand if(fTools::equalZero(aDeltaZ)) 2177024eca9SArmin Le Grand { 2187024eca9SArmin Le Grand aDeltaZ = 0.0; 2197024eca9SArmin Le Grand } 2207024eca9SArmin Le Grand else 2217024eca9SArmin Le Grand { 2227024eca9SArmin Le Grand aDeltaZ *= fInvYDelta; 2237024eca9SArmin Le Grand } 2247024eca9SArmin Le Grand 2257024eca9SArmin Le Grand maNormalInterpolators.push_back( 2267024eca9SArmin Le Grand ip_triple( 2277024eca9SArmin Le Grand rA.getX(), aDeltaX, 2287024eca9SArmin Le Grand rA.getY(), aDeltaY, 2297024eca9SArmin Le Grand rA.getZ(), aDeltaZ)); 2307024eca9SArmin Le Grand 2317024eca9SArmin Le Grand return (maNormalInterpolators.size() - 1); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir addTextureInterpolator(const B2DPoint & rA,const B2DPoint & rB,double fInvYDelta)234cdf0e10cSrcweir sal_uInt32 addTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fInvYDelta) 235cdf0e10cSrcweir { 2367024eca9SArmin Le Grand double aDeltaX(rB.getX() - rA.getX()); 2377024eca9SArmin Le Grand 2387024eca9SArmin Le Grand if(fTools::equalZero(aDeltaX)) 2397024eca9SArmin Le Grand { 2407024eca9SArmin Le Grand aDeltaX = 0.0; 2417024eca9SArmin Le Grand } 2427024eca9SArmin Le Grand else 2437024eca9SArmin Le Grand { 2447024eca9SArmin Le Grand aDeltaX *= fInvYDelta; 2457024eca9SArmin Le Grand } 2467024eca9SArmin Le Grand 2477024eca9SArmin Le Grand double aDeltaY(rB.getY() - rA.getY()); 2487024eca9SArmin Le Grand 2497024eca9SArmin Le Grand if(fTools::equalZero(aDeltaY)) 2507024eca9SArmin Le Grand { 2517024eca9SArmin Le Grand aDeltaY = 0.0; 2527024eca9SArmin Le Grand } 2537024eca9SArmin Le Grand else 2547024eca9SArmin Le Grand { 2557024eca9SArmin Le Grand aDeltaY *= fInvYDelta; 2567024eca9SArmin Le Grand } 2577024eca9SArmin Le Grand 2587024eca9SArmin Le Grand maTextureInterpolators.push_back( 2597024eca9SArmin Le Grand ip_double( 2607024eca9SArmin Le Grand rA.getX(), aDeltaX, 2617024eca9SArmin Le Grand rA.getY(), aDeltaY)); 2627024eca9SArmin Le Grand 2637024eca9SArmin Le Grand return (maTextureInterpolators.size() - 1); 264cdf0e10cSrcweir } 265cdf0e10cSrcweir addInverseTextureInterpolator(const B2DPoint & rA,const B2DPoint & rB,double fZEyeA,double fZEyeB,double fInvYDelta)266cdf0e10cSrcweir sal_uInt32 addInverseTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fZEyeA, double fZEyeB, double fInvYDelta) 267cdf0e10cSrcweir { 2687024eca9SArmin Le Grand double fZDelta(fZEyeB - fZEyeA); 2697024eca9SArmin Le Grand const double fInvZEyeA(fTools::equalZero(fZEyeA) ? fZEyeA : 1.0 / fZEyeA); 2707024eca9SArmin Le Grand double fInvZEyeB(fInvZEyeA); 2717024eca9SArmin Le Grand 2727024eca9SArmin Le Grand if(fTools::equalZero(fZDelta)) 2737024eca9SArmin Le Grand { 2747024eca9SArmin Le Grand fZDelta = 0.0; 2757024eca9SArmin Le Grand } 2767024eca9SArmin Le Grand else 2777024eca9SArmin Le Grand { 2787024eca9SArmin Le Grand fInvZEyeB = fTools::equalZero(fZEyeB) ? fZEyeB : 1.0 / fZEyeB; 2797024eca9SArmin Le Grand fZDelta = (fInvZEyeB - fInvZEyeA) * fInvYDelta; 2807024eca9SArmin Le Grand } 2817024eca9SArmin Le Grand 2827024eca9SArmin Le Grand const B2DPoint aInvA(rA * fInvZEyeA); 2837024eca9SArmin Le Grand const B2DPoint aInvB(rB * fInvZEyeB); 2847024eca9SArmin Le Grand const double aDeltaX((aInvB.getX() - aInvA.getX()) * fInvYDelta); 2857024eca9SArmin Le Grand const double aDeltaY((aInvB.getY() - aInvA.getY()) * fInvYDelta); 2867024eca9SArmin Le Grand 2877024eca9SArmin Le Grand maInverseTextureInterpolators.push_back( 2887024eca9SArmin Le Grand ip_triple( 2897024eca9SArmin Le Grand aInvA.getX(), aDeltaX, 2907024eca9SArmin Le Grand aInvA.getY(), aDeltaY, 2917024eca9SArmin Le Grand fInvZEyeA, fZDelta)); 2927024eca9SArmin Le Grand 2937024eca9SArmin Le Grand return (maInverseTextureInterpolators.size() - 1); 294cdf0e10cSrcweir } 295cdf0e10cSrcweir reset()296cdf0e10cSrcweir void reset() 297cdf0e10cSrcweir { 298cdf0e10cSrcweir maColorInterpolators.clear(); 299cdf0e10cSrcweir maNormalInterpolators.clear(); 300cdf0e10cSrcweir maTextureInterpolators.clear(); 301cdf0e10cSrcweir maInverseTextureInterpolators.clear(); 302cdf0e10cSrcweir } 303cdf0e10cSrcweir 304cdf0e10cSrcweir public: InterpolatorProvider3D()305cdf0e10cSrcweir InterpolatorProvider3D() {} 306cdf0e10cSrcweir getColorInterpolators()307cdf0e10cSrcweir ::std::vector< ip_triple >& getColorInterpolators() { return maColorInterpolators; } getNormalInterpolators()308cdf0e10cSrcweir ::std::vector< ip_triple >& getNormalInterpolators() { return maNormalInterpolators; } getTextureInterpolators()309cdf0e10cSrcweir ::std::vector< ip_double >& getTextureInterpolators() { return maTextureInterpolators; } getInverseTextureInterpolators()310cdf0e10cSrcweir ::std::vector< ip_triple >& getInverseTextureInterpolators() { return maInverseTextureInterpolators; } 311cdf0e10cSrcweir }; 312cdf0e10cSrcweir } // end of namespace basegfx 313cdf0e10cSrcweir 314cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 315cdf0e10cSrcweir // RasterConversionLineEntry3D for Raterconversion of 3D PolyPolygons 316cdf0e10cSrcweir 317cdf0e10cSrcweir namespace basegfx 318cdf0e10cSrcweir { 319*b63233d8Sdamjan class BASEGFX_DLLPUBLIC RasterConversionLineEntry3D 320cdf0e10cSrcweir { 321cdf0e10cSrcweir private: 322cdf0e10cSrcweir ip_single maX; 323cdf0e10cSrcweir ip_single maZ; 324cdf0e10cSrcweir sal_Int32 mnY; 325cdf0e10cSrcweir sal_uInt32 mnCount; 326cdf0e10cSrcweir 327cdf0e10cSrcweir sal_uInt32 mnColorIndex; 328cdf0e10cSrcweir sal_uInt32 mnNormalIndex; 329cdf0e10cSrcweir sal_uInt32 mnTextureIndex; 330cdf0e10cSrcweir sal_uInt32 mnInverseTextureIndex; 331cdf0e10cSrcweir 332cdf0e10cSrcweir public: RasterConversionLineEntry3D(const double & rfX,const double & rfDeltaX,const double & rfZ,const double & rfDeltaZ,sal_Int32 nY,sal_uInt32 nCount)333cdf0e10cSrcweir RasterConversionLineEntry3D(const double& rfX, const double& rfDeltaX, const double& rfZ, const double& rfDeltaZ, sal_Int32 nY, sal_uInt32 nCount) 334cdf0e10cSrcweir : maX(rfX, rfDeltaX), 335cdf0e10cSrcweir maZ(rfZ, rfDeltaZ), 336cdf0e10cSrcweir mnY(nY), 337cdf0e10cSrcweir mnCount(nCount), 338cdf0e10cSrcweir mnColorIndex(SCANLINE_EMPTY_INDEX), 339cdf0e10cSrcweir mnNormalIndex(SCANLINE_EMPTY_INDEX), 340cdf0e10cSrcweir mnTextureIndex(SCANLINE_EMPTY_INDEX), 341cdf0e10cSrcweir mnInverseTextureIndex(SCANLINE_EMPTY_INDEX) 342cdf0e10cSrcweir {} 343cdf0e10cSrcweir setColorIndex(sal_uInt32 nIndex)344cdf0e10cSrcweir void setColorIndex(sal_uInt32 nIndex) { mnColorIndex = nIndex; } setNormalIndex(sal_uInt32 nIndex)345cdf0e10cSrcweir void setNormalIndex(sal_uInt32 nIndex) { mnNormalIndex = nIndex; } setTextureIndex(sal_uInt32 nIndex)346cdf0e10cSrcweir void setTextureIndex(sal_uInt32 nIndex) { mnTextureIndex = nIndex; } setInverseTextureIndex(sal_uInt32 nIndex)347cdf0e10cSrcweir void setInverseTextureIndex(sal_uInt32 nIndex) { mnInverseTextureIndex = nIndex; } 348cdf0e10cSrcweir operator <(const RasterConversionLineEntry3D & rComp) const349cdf0e10cSrcweir bool operator<(const RasterConversionLineEntry3D& rComp) const 350cdf0e10cSrcweir { 351cdf0e10cSrcweir if(mnY == rComp.mnY) 352cdf0e10cSrcweir { 353cdf0e10cSrcweir return maX.getVal() < rComp.maX.getVal(); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir 356cdf0e10cSrcweir return mnY < rComp.mnY; 357cdf0e10cSrcweir } 358cdf0e10cSrcweir decrementRasterConversionLineEntry3D(sal_uInt32 nStep)359cdf0e10cSrcweir bool decrementRasterConversionLineEntry3D(sal_uInt32 nStep) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir if(nStep >= mnCount) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir return false; 364cdf0e10cSrcweir } 365cdf0e10cSrcweir else 366cdf0e10cSrcweir { 367cdf0e10cSrcweir mnCount -= nStep; 368cdf0e10cSrcweir return true; 369cdf0e10cSrcweir } 370cdf0e10cSrcweir } 371cdf0e10cSrcweir incrementRasterConversionLineEntry3D(sal_uInt32 nStep,InterpolatorProvider3D & rProvider)372cdf0e10cSrcweir void incrementRasterConversionLineEntry3D(sal_uInt32 nStep, InterpolatorProvider3D& rProvider) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir const double fStep((double)nStep); 375cdf0e10cSrcweir maX.increment(fStep); 376cdf0e10cSrcweir maZ.increment(fStep); 377cdf0e10cSrcweir mnY += nStep; 378cdf0e10cSrcweir 379cdf0e10cSrcweir if(SCANLINE_EMPTY_INDEX != mnColorIndex) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir rProvider.getColorInterpolators()[mnColorIndex].increment(fStep); 382cdf0e10cSrcweir } 383cdf0e10cSrcweir 384cdf0e10cSrcweir if(SCANLINE_EMPTY_INDEX != mnNormalIndex) 385cdf0e10cSrcweir { 386cdf0e10cSrcweir rProvider.getNormalInterpolators()[mnNormalIndex].increment(fStep); 387cdf0e10cSrcweir } 388cdf0e10cSrcweir 389cdf0e10cSrcweir if(SCANLINE_EMPTY_INDEX != mnTextureIndex) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir rProvider.getTextureInterpolators()[mnTextureIndex].increment(fStep); 392cdf0e10cSrcweir } 393cdf0e10cSrcweir 394cdf0e10cSrcweir if(SCANLINE_EMPTY_INDEX != mnInverseTextureIndex) 395cdf0e10cSrcweir { 396cdf0e10cSrcweir rProvider.getInverseTextureInterpolators()[mnInverseTextureIndex].increment(fStep); 397cdf0e10cSrcweir } 398cdf0e10cSrcweir } 399cdf0e10cSrcweir 400cdf0e10cSrcweir // data read access getX() const401cdf0e10cSrcweir const ip_single& getX() const { return maX; } getY() const402cdf0e10cSrcweir sal_Int32 getY() const { return mnY; } getZ() const403cdf0e10cSrcweir const ip_single& getZ() const { return maZ; } getColorIndex() const404cdf0e10cSrcweir sal_uInt32 getColorIndex() const { return mnColorIndex; } getNormalIndex() const405cdf0e10cSrcweir sal_uInt32 getNormalIndex() const { return mnNormalIndex; } getTextureIndex() const406cdf0e10cSrcweir sal_uInt32 getTextureIndex() const { return mnTextureIndex; } getInverseTextureIndex() const407cdf0e10cSrcweir sal_uInt32 getInverseTextureIndex() const { return mnInverseTextureIndex; } 408cdf0e10cSrcweir }; 409cdf0e10cSrcweir } // end of namespace basegfx 410cdf0e10cSrcweir 411cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 412cdf0e10cSrcweir // the basic RaterConverter itself. Only one method needs to be overloaded. The 413cdf0e10cSrcweir // class itself is strictly virtual 414cdf0e10cSrcweir 415cdf0e10cSrcweir namespace basegfx 416cdf0e10cSrcweir { 417*b63233d8Sdamjan class BASEGFX_DLLPUBLIC RasterConverter3D : public InterpolatorProvider3D 418cdf0e10cSrcweir { 419cdf0e10cSrcweir private: 420cdf0e10cSrcweir // the line entries for an area conversion run 421cdf0e10cSrcweir ::std::vector< RasterConversionLineEntry3D > maLineEntries; 422cdf0e10cSrcweir 423cdf0e10cSrcweir struct lineComparator 424cdf0e10cSrcweir { operator ()basegfx::RasterConverter3D::lineComparator425cdf0e10cSrcweir bool operator()(const RasterConversionLineEntry3D* pA, const RasterConversionLineEntry3D* pB) 426cdf0e10cSrcweir { 427cdf0e10cSrcweir OSL_ENSURE(pA && pB, "lineComparator: empty pointer (!)"); 428cdf0e10cSrcweir return pA->getX().getVal() < pB->getX().getVal(); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir }; 431cdf0e10cSrcweir 432cdf0e10cSrcweir void addArea(const B3DPolygon& rFill, const B3DHomMatrix* pViewToEye); 433cdf0e10cSrcweir void addArea(const B3DPolyPolygon& rFill, const B3DHomMatrix* pViewToEye); 434cdf0e10cSrcweir void addEdge(const B3DPolygon& rFill, sal_uInt32 a, sal_uInt32 b, const B3DHomMatrix* pViewToEye); 435cdf0e10cSrcweir 436cdf0e10cSrcweir void rasterconvertB3DArea(sal_Int32 nStartLine, sal_Int32 nStopLine); 437cdf0e10cSrcweir void rasterconvertB3DEdge(const B3DPolygon& rLine, sal_uInt32 nA, sal_uInt32 nB, sal_Int32 nStartLine, sal_Int32 nStopLine, sal_uInt16 nLineWidth); 438cdf0e10cSrcweir 439cdf0e10cSrcweir virtual void processLineSpan(const RasterConversionLineEntry3D& rA, const RasterConversionLineEntry3D& rB, sal_Int32 nLine, sal_uInt32 nSpanCount) = 0; 440cdf0e10cSrcweir 441cdf0e10cSrcweir public: 442cdf0e10cSrcweir RasterConverter3D(); 443cdf0e10cSrcweir virtual ~RasterConverter3D(); 444cdf0e10cSrcweir 445cdf0e10cSrcweir void rasterconvertB3DPolyPolygon(const B3DPolyPolygon& rFill, const B3DHomMatrix* pViewToEye, sal_Int32 nStartLine, sal_Int32 nStopLine); 446cdf0e10cSrcweir void rasterconvertB3DPolygon(const B3DPolygon& rLine, sal_Int32 nStartLine, sal_Int32 nStopLine, sal_uInt16 nLineWidth); 447cdf0e10cSrcweir }; 448cdf0e10cSrcweir } // end of namespace basegfx 449cdf0e10cSrcweir 450cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 451cdf0e10cSrcweir 452cdf0e10cSrcweir #endif /* _BGFX_RASTER_RASTERCONVERT3D_HXX */ 453