summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2008-10-17 08:40:10 +0000
committerOliver Bolte <obo@openoffice.org>2008-10-17 08:40:10 +0000
commit98c9f4f4f2506db7385cc3f0fa7bb1b14930a417 (patch)
treee6881eda00d35e22f6ac51732df02db300814385
parent52a7bbb9c5d88ee817b4e484696846adbc7b305e (diff)
CWS-TOOLING: integrate CWS aw057
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygontools.hxx9
-rw-r--r--basegfx/inc/basegfx/polygon/b3dpolygontools.hxx36
-rw-r--r--basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx6
-rw-r--r--basegfx/inc/basegfx/vector/b3dvector.hxx16
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx24
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx4
-rw-r--r--basegfx/source/polygon/b2dpolypolygontools.cxx4
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx322
-rw-r--r--basegfx/source/polygon/b3dpolypolygontools.cxx29
-rw-r--r--basegfx/source/vector/b3dvector.cxx15
-rw-r--r--goodies/inc/b3dtex.hxx378
-rw-r--r--goodies/inc/b3dvolum.hxx85
-rw-r--r--goodies/inc/goodies/b3dcolor.hxx79
-rw-r--r--goodies/inc/goodies/b3dcompo.hxx226
-rw-r--r--goodies/inc/goodies/b3dentty.hxx156
-rw-r--r--goodies/inc/goodies/b3dgeom.hxx207
-rw-r--r--goodies/inc/goodies/b3dlight.hxx236
-rw-r--r--goodies/inc/goodies/base3d.hxx467
-rw-r--r--goodies/inc/goodies/bucket.hxx197
-rw-r--r--goodies/inc/goodies/bxdintpo.hxx177
-rw-r--r--goodies/inc/goodies/matril3d.hxx104
-rw-r--r--goodies/inc/pch/precompiled_goodies.hxx4
-rw-r--r--goodies/inc/vector3d.hxx117
-rw-r--r--goodies/prj/d.lst11
-rw-r--r--goodies/source/base3d/b3dcolor.cxx333
-rw-r--r--goodies/source/base3d/b3dcommn.cxx1434
-rw-r--r--goodies/source/base3d/b3dcommn.hxx129
-rw-r--r--goodies/source/base3d/b3dcompo.cxx1140
-rw-r--r--goodies/source/base3d/b3ddeflt.cxx1956
-rw-r--r--goodies/source/base3d/b3ddeflt.hxx205
-rw-r--r--goodies/source/base3d/b3dentty.cxx330
-rw-r--r--goodies/source/base3d/b3dgeom.cxx975
-rw-r--r--goodies/source/base3d/b3dlight.cxx749
-rw-r--r--goodies/source/base3d/b3dopngl.cxx1457
-rw-r--r--goodies/source/base3d/b3dopngl.hxx186
-rw-r--r--goodies/source/base3d/b3dtex.cxx1303
-rw-r--r--goodies/source/base3d/b3dtrans.cxx7
-rw-r--r--goodies/source/base3d/base3d.cxx1267
-rw-r--r--goodies/source/base3d/makefile.mk19
-rw-r--r--goodies/source/base3d/matril3d.cxx139
-rw-r--r--vcl/aqua/inc/salinst.h3
-rw-r--r--vcl/aqua/inc/salogl.h94
-rw-r--r--vcl/aqua/source/app/salinst.cxx10
-rw-r--r--vcl/aqua/source/gdi/makefile.mk5
-rw-r--r--vcl/aqua/source/gdi/salogl.cxx109
-rw-r--r--vcl/inc/vcl/opengl.hxx159
-rw-r--r--vcl/inc/vcl/outdev.hxx10
-rw-r--r--vcl/inc/vcl/outdev3d.hxx49
-rw-r--r--vcl/inc/vcl/salinst.hxx5
-rw-r--r--vcl/inc/vcl/salogl.hxx83
-rw-r--r--vcl/inc/vcl/salotype.hxx1133
-rw-r--r--vcl/os2/inc/salinst.h3
-rw-r--r--vcl/os2/inc/salogl.h166
-rw-r--r--vcl/os2/source/app/salinst.cxx10
-rw-r--r--vcl/os2/source/gdi/makefile.mk8
-rw-r--r--vcl/os2/source/gdi/salogl.cxx234
-rw-r--r--vcl/prj/d.lst3
-rw-r--r--vcl/source/app/salvtables.cxx7
-rw-r--r--vcl/source/app/svmain.cxx3
-rw-r--r--vcl/source/gdi/makefile.mk3
-rw-r--r--vcl/source/gdi/opengl.cxx1429
-rw-r--r--vcl/source/gdi/outdev.cxx33
-rw-r--r--vcl/source/gdi/salgdilayout.cxx5
-rw-r--r--vcl/source/window/wrkwin.cxx10
-rw-r--r--vcl/unx/headless/svpdummies.cxx11
-rw-r--r--vcl/unx/headless/svpdummies.hxx18
-rw-r--r--vcl/unx/headless/svpinst.cxx7
-rw-r--r--vcl/unx/headless/svpinst.hxx4
-rw-r--r--vcl/unx/inc/salinst.h3
-rw-r--r--vcl/unx/inc/salogl.h104
-rw-r--r--vcl/unx/source/app/saldisp.cxx5
-rw-r--r--vcl/unx/source/app/salinst.cxx18
-rw-r--r--vcl/unx/source/gdi/makefile.mk3
-rw-r--r--vcl/unx/source/gdi/salogl.cxx385
-rw-r--r--vcl/util/makefile.mk3
-rw-r--r--vcl/win/inc/salinst.h3
-rw-r--r--vcl/win/inc/salogl.h82
-rw-r--r--vcl/win/inc/salogl.hxx83
-rw-r--r--vcl/win/source/app/salinst.cxx11
-rw-r--r--vcl/win/source/gdi/MAKEFILE.MK3
-rw-r--r--vcl/win/source/gdi/salogl.cxx324
81 files changed, 465 insertions, 18714 deletions
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
index 20845c8c7cbe..45423ace62c6 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b2dpolygontools.hxx,v $
- * $Revision: 1.24 $
+ * $Revision: 1.24.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -242,8 +242,9 @@ namespace basegfx
bool isInEpsilonRange(const B2DPoint& rEdgeStart, const B2DPoint& rEdgeEnd, const B2DPoint& rTestPosition, double fDistance);
// test if point is inside epsilon-range around the given Polygon. Can be used
- // for HitTesting. The epsilon-range is defined to be the tube around the polygon
- // with distance fDistance and rounded edges (start and end point).
+ // for HitTesting. The epsilon-range is defined to be the rectangle centered
+ // to the given edge, using height 2 x fDistance, and the circle around both points
+ // with radius fDistance.
bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
/** Create a polygon from a rectangle.
@@ -379,7 +380,7 @@ namespace basegfx
/** Create an unit ellipse polygon with the given angles, from start to end
*/
- B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd );
+ B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd );
B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd );
diff --git a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
index d3dbb333a896..7b451970c565 100644
--- a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b3dpolygontools.hxx,v $
- * $Revision: 1.10 $
+ * $Revision: 1.10.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -81,9 +81,6 @@ namespace basegfx
// get area of polygon
double getArea(const B3DPolygon& rCandidate);
- // get normal vector of polygon
- ::basegfx::B3DVector getNormal(const ::basegfx::B3DPolygon& rCandidate);
-
// get signed area of polygon
double getSignedArea(const B3DPolygon& rCandidate);
@@ -141,6 +138,37 @@ namespace basegfx
*/
B3DPolygon applyDefaultTextureCoordinatesSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true);
+ // test if point is inside epsilon-range around an edge defined
+ // by the two given points. Can be used for HitTesting. The epsilon-range
+ // is defined to be the cylinder centered to the given edge, using radius
+ // fDistance, and the sphere around both points with radius fDistance.
+ bool isInEpsilonRange(const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, const B3DPoint& rTestPosition, double fDistance);
+
+ // test if point is inside epsilon-range around the given Polygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the cylinder centered to
+ // the given edge, using radius fDistance, and the sphere around both points with radius fDistance.
+ bool isInEpsilonRange(const B3DPolygon& rCandidate, const B3DPoint& rTestPosition, double fDistance);
+
+ // isInside tests for B3DPoint and other B3DPolygon. On border is not inside as long as
+ // not true is given in bWithBorder flag.
+ bool isInside(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder = false);
+ bool isInside(const B3DPolygon& rCandidate, const B3DPolygon& rPolygon, bool bWithBorder = false);
+
+ // calculates if given point is on given line, taking care of the numerical epsilon
+ bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const B3DPoint& rCandidate, bool bWithPoints = false);
+
+ // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
+ // isPointOnLine internally
+ bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithPoints = true);
+
+ // helper to get a fCut position between a plane (given with normal and a point)
+ // and a line given by start and end point
+ bool getCutBetweenLineAndPlane(const B3DVector& rPlaneNormal, const B3DPoint& rPlanePoint, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
+
+ // helper to get a fCut position between a 3d Polygon
+ // and a line given by start and end point
+ bool getCutBetweenLineAndPolygon(const B3DPolygon& rCandidate, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
+
//////////////////////////////////////////////////////////////////////
// comparators with tolerance for 3D Polygons
bool equal(const B3DPolygon& rCandidateA, const B3DPolygon& rCandidateB, const double& rfSmallValue);
diff --git a/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx
index fcb78f484a1b..466aa25edd96 100644
--- a/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b3dpolypolygontools.hxx,v $
- * $Revision: 1.8 $
+ * $Revision: 1.8.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -142,6 +142,10 @@ namespace basegfx
*/
B3DPolyPolygon applyDefaultTextureCoordinatesSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true);
+ // isInside test for B3DPoint. On border is not inside as long as not true is given
+ // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct.
+ bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder = false);
+
//////////////////////////////////////////////////////////////////////
// comparators with tolerance for 3D PolyPolygons
bool equal(const B3DPolyPolygon& rCandidateA, const B3DPolyPolygon& rCandidateB, const double& rfSmallValue);
diff --git a/basegfx/inc/basegfx/vector/b3dvector.hxx b/basegfx/inc/basegfx/vector/b3dvector.hxx
index f5e2c68b98a7..e39500a15cd7 100644
--- a/basegfx/inc/basegfx/vector/b3dvector.hxx
+++ b/basegfx/inc/basegfx/vector/b3dvector.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b3dvector.hxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -296,6 +296,20 @@ namespace basegfx
return aPerpendicular;
}
+ /** Test two vectors which need not to be normalized for parallelism
+
+ @param rVecA
+ The first 3D Vector
+
+ @param rVecB
+ The second 3D Vector
+
+ @return
+ bool if the two values are parallel. Also true if
+ one of the vectors is empty.
+ */
+ bool areParallel( const B3DVector& rVecA, const B3DVector& rVecB );
+
/** Transform vector by given transformation matrix.
Since this is a vector, translational components of the
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index d001bfb5a4cb..7a7a60ae37b5 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b2dpolygontools.cxx,v $
- * $Revision: 1.29 $
+ * $Revision: 1.29.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -1552,12 +1552,10 @@ namespace basegfx
{
// build edge vector
const B2DVector aEdge(rEdgeEnd - rEdgeStart);
- bool bDeltaXIsZero(fTools::equalZero(aEdge.getX()));
- bool bDeltaYIsZero(fTools::equalZero(aEdge.getY()));
bool bDoDistanceTestStart(false);
bool bDoDistanceTestEnd(false);
- if(bDeltaXIsZero && bDeltaYIsZero)
+ if(aEdge.equalZero())
{
// no edge, just a point. Do one of the distance tests.
bDoDistanceTestStart = true;
@@ -1570,7 +1568,6 @@ namespace basegfx
(aPerpend.getY() * (rTestPosition.getX() - rEdgeStart.getX())
+ aPerpend.getX() * (rEdgeStart.getY() - rTestPosition.getY())) /
(aEdge.getX() * aEdge.getX() + aEdge.getY() * aEdge.getY()));
-
const double fZero(0.0);
const double fOne(1.0);
@@ -1588,9 +1585,8 @@ namespace basegfx
{
// inside line [0.0 .. 1.0]
const B2DPoint aCutPoint(interpolate(rEdgeStart, rEdgeEnd, fCut));
- const double fDeltaX(rTestPosition.getX() - aCutPoint.getX());
- const double fDeltaY(rTestPosition.getY() - aCutPoint.getY());
- const double fDistanceSquare(fDeltaX * fDeltaX + fDeltaY * fDeltaY);
+ const B2DVector aDelta(rTestPosition - aCutPoint);
+ const double fDistanceSquare(aDelta.scalar(aDelta));
if(fDistanceSquare <= fDistance * fDistance)
{
@@ -1598,16 +1594,15 @@ namespace basegfx
}
else
{
- return sal_False;
+ return false;
}
}
}
if(bDoDistanceTestStart)
{
- const double fDeltaX(rTestPosition.getX() - rEdgeStart.getX());
- const double fDeltaY(rTestPosition.getY() - rEdgeStart.getY());
- const double fDistanceSquare(fDeltaX * fDeltaX + fDeltaY * fDeltaY);
+ const B2DVector aDelta(rTestPosition - rEdgeStart);
+ const double fDistanceSquare(aDelta.scalar(aDelta));
if(fDistanceSquare <= fDistance * fDistance)
{
@@ -1616,9 +1611,8 @@ namespace basegfx
}
else if(bDoDistanceTestEnd)
{
- const double fDeltaX(rTestPosition.getX() - rEdgeEnd.getX());
- const double fDeltaY(rTestPosition.getY() - rEdgeEnd.getY());
- const double fDistanceSquare(fDeltaX * fDeltaX + fDeltaY * fDeltaY);
+ const B2DVector aDelta(rTestPosition - rEdgeEnd);
+ const double fDistanceSquare(aDelta.scalar(aDelta));
if(fDistanceSquare <= fDistance * fDistance)
{
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 853e822537e5..6467e7120c03 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b2dpolypolygon.cxx,v $
- * $Revision: 1.21 $
+ * $Revision: 1.21.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -106,7 +106,7 @@ public:
for(sal_uInt32 a(0L); a < nCount; a++)
{
- maPolygons.insert(aIndex, rPolyPolygon.getB2DPolygon(a));
+ aIndex = maPolygons.insert(aIndex, rPolyPolygon.getB2DPolygon(a));
aIndex++;
}
}
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index 7d2f6dcc8f01..c92f2f29147b 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b2dpolypolygontools.cxx,v $
- * $Revision: 1.19 $
+ * $Revision: 1.19.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -230,7 +230,7 @@ namespace basegfx
for(sal_uInt32 a(0L); a < nPolygonCount; a++)
{
const B2DPolygon aPolygon(rCandidate.getB2DPolygon(a));
- const sal_Bool bInside(isInside(aPolygon, rPoint, bWithBorder));
+ const bool bInside(isInside(aPolygon, rPoint, bWithBorder));
if(bInside)
{
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index eaaf08f5b739..3ea163a85e89 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b3dpolygontools.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -36,6 +36,9 @@
#include <basegfx/numeric/ftools.hxx>
#include <basegfx/range/b3drange.hxx>
#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
#include <numeric>
//////////////////////////////////////////////////////////////////////////////
@@ -748,6 +751,323 @@ namespace basegfx
return aRetval;
}
+ bool isInEpsilonRange(const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, const B3DPoint& rTestPosition, double fDistance)
+ {
+ // build edge vector
+ const B3DVector aEdge(rEdgeEnd - rEdgeStart);
+ bool bDoDistanceTestStart(false);
+ bool bDoDistanceTestEnd(false);
+
+ if(aEdge.equalZero())
+ {
+ // no edge, just a point. Do one of the distance tests.
+ bDoDistanceTestStart = true;
+ }
+ else
+ {
+ // calculate fCut in aEdge
+ const B3DVector aTestEdge(rTestPosition - rEdgeStart);
+ const double fScalarTestEdge(aEdge.scalar(aTestEdge));
+ const double fScalarStartEdge(aEdge.scalar(rEdgeStart));
+ const double fScalarEdge(aEdge.scalar(aEdge));
+ const double fCut((fScalarTestEdge - fScalarStartEdge) / fScalarEdge);
+ const double fZero(0.0);
+ const double fOne(1.0);
+
+ if(fTools::less(fCut, fZero))
+ {
+ // left of rEdgeStart
+ bDoDistanceTestStart = true;
+ }
+ else if(fTools::more(fCut, fOne))
+ {
+ // right of rEdgeEnd
+ bDoDistanceTestEnd = true;
+ }
+ else
+ {
+ // inside line [0.0 .. 1.0]
+ const B3DPoint aCutPoint(interpolate(rEdgeStart, rEdgeEnd, fCut));
+ const B3DVector aDelta(rTestPosition - aCutPoint);
+ const double fDistanceSquare(aDelta.scalar(aDelta));
+
+ if(fDistanceSquare <= fDistance * fDistance * fDistance)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ if(bDoDistanceTestStart)
+ {
+ const B3DVector aDelta(rTestPosition - rEdgeStart);
+ const double fDistanceSquare(aDelta.scalar(aDelta));
+
+ if(fDistanceSquare <= fDistance * fDistance * fDistance)
+ {
+ return true;
+ }
+ }
+ else if(bDoDistanceTestEnd)
+ {
+ const B3DVector aDelta(rTestPosition - rEdgeEnd);
+ const double fDistanceSquare(aDelta.scalar(aDelta));
+
+ if(fDistanceSquare <= fDistance * fDistance * fDistance)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool isInEpsilonRange(const B3DPolygon& rCandidate, const B3DPoint& rTestPosition, double fDistance)
+ {
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ if(nPointCount)
+ {
+ const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1L);
+ B3DPoint aCurrent(rCandidate.getB3DPoint(0));
+
+ if(nEdgeCount)
+ {
+ // edges
+ for(sal_uInt32 a(0); a < nEdgeCount; a++)
+ {
+ const sal_uInt32 nNextIndex((a + 1) % nPointCount);
+ const B3DPoint aNext(rCandidate.getB3DPoint(nNextIndex));
+
+ if(isInEpsilonRange(aCurrent, aNext, rTestPosition, fDistance))
+ {
+ return true;
+ }
+
+ // prepare next step
+ aCurrent = aNext;
+ }
+ }
+ else
+ {
+ // no edges, but points -> not closed. Check single point. Just
+ // use isInEpsilonRange with twice the same point, it handles those well
+ if(isInEpsilonRange(aCurrent, aCurrent, rTestPosition, fDistance))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ bool isInside(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder)
+ {
+ if(bWithBorder && isPointOnPolygon(rCandidate, rPoint, true))
+ {
+ return true;
+ }
+ else
+ {
+ const B3DVector aPlaneNormal(rCandidate.getNormal());
+
+ if(!aPlaneNormal.equalZero())
+ {
+ const double fAbsX(fabs(aPlaneNormal.getX()));
+ const double fAbsY(fabs(aPlaneNormal.getY()));
+ const double fAbsZ(fabs(aPlaneNormal.getZ()));
+
+ if(fAbsX > fAbsY && fAbsX > fAbsZ)
+ {
+ // normal points mostly in X-Direction, use YZ-Polygon projection for check
+ B3DHomMatrix aTrans;
+
+ aTrans.set(0, 0, 0.0);
+ aTrans.set(0, 1, 1.0);
+ aTrans.set(1, 1, 0.0);
+ aTrans.set(1, 2, 1.0);
+
+ const B2DPolygon aYZ(createB2DPolygonFromB3DPolygon(rCandidate, aTrans));
+
+ return isInside(aYZ, B2DPoint(rPoint.getY(), rPoint.getZ()), bWithBorder);
+ }
+ else if(fAbsY > fAbsX && fAbsY > fAbsZ)
+ {
+ // normal points mostly in Y-Direction, use XZ-Polygon projection for check
+ B3DHomMatrix aTrans;
+
+ aTrans.set(1, 1, 0.0);
+ aTrans.set(1, 2, 1.0);
+
+ const B2DPolygon aXZ(createB2DPolygonFromB3DPolygon(rCandidate, aTrans));
+
+ return isInside(aXZ, B2DPoint(rPoint.getX(), rPoint.getZ()), bWithBorder);
+ }
+ else
+ {
+ // normal points mostly in Z-Direction, use XY-Polygon projection for check
+ B3DHomMatrix aTrans;
+
+ const B2DPolygon aXY(createB2DPolygonFromB3DPolygon(rCandidate, aTrans));
+
+ return isInside(aXY, B2DPoint(rPoint.getX(), rPoint.getY()), bWithBorder);
+ }
+ }
+
+ return false;
+ }
+ }
+
+ bool isInside(const B3DPolygon& rCandidate, const B3DPolygon& rPolygon, bool bWithBorder)
+ {
+ const sal_uInt32 nPointCount(rPolygon.count());
+
+ for(sal_uInt32 a(0L); a < nPointCount; a++)
+ {
+ const B3DPoint aTestPoint(rPolygon.getB3DPoint(a));
+
+ if(!isInside(rCandidate, aTestPoint, bWithBorder))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const B3DPoint& rCandidate, bool bWithPoints)
+ {
+ if(rCandidate.equal(rStart) || rCandidate.equal(rEnd))
+ {
+ // candidate is in epsilon around start or end -> inside
+ return bWithPoints;
+ }
+ else if(rStart.equal(rEnd))
+ {
+ // start and end are equal, but candidate is outside their epsilon -> outside
+ return false;
+ }
+ else
+ {
+ const B3DVector aEdgeVector(rEnd - rStart);
+ const B3DVector aTestVector(rCandidate - rStart);
+
+ if(areParallel(aEdgeVector, aTestVector))
+ {
+ const double fZero(0.0);
+ const double fOne(1.0);
+ double fParamTestOnCurr(0.0);
+
+ if(aEdgeVector.getX() > aEdgeVector.getY())
+ {
+ if(aEdgeVector.getX() > aEdgeVector.getZ())
+ {
+ // X is biggest
+ fParamTestOnCurr = aTestVector.getX() / aEdgeVector.getX();
+ }
+ else
+ {
+ // Z is biggest
+ fParamTestOnCurr = aTestVector.getZ() / aEdgeVector.getZ();
+ }
+ }
+ else
+ {
+ if(aEdgeVector.getY() > aEdgeVector.getZ())
+ {
+ // Y is biggest
+ fParamTestOnCurr = aTestVector.getY() / aEdgeVector.getY();
+ }
+ else
+ {
+ // Z is biggest
+ fParamTestOnCurr = aTestVector.getZ() / aEdgeVector.getZ();
+ }
+ }
+
+ if(fTools::more(fParamTestOnCurr, fZero) && fTools::less(fParamTestOnCurr, fOne))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithPoints)
+ {
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ if(nPointCount > 1L)
+ {
+ const sal_uInt32 nLoopCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1L);
+ B3DPoint aCurrentPoint(rCandidate.getB3DPoint(0));
+
+ for(sal_uInt32 a(0); a < nLoopCount; a++)
+ {
+ const B3DPoint aNextPoint(rCandidate.getB3DPoint((a + 1) % nPointCount));
+
+ if(isPointOnLine(aCurrentPoint, aNextPoint, rPoint, bWithPoints))
+ {
+ return true;
+ }
+
+ aCurrentPoint = aNextPoint;
+ }
+ }
+ else if(nPointCount && bWithPoints)
+ {
+ return rPoint.equal(rCandidate.getB3DPoint(0));
+ }
+
+ return false;
+ }
+
+ bool getCutBetweenLineAndPlane(const B3DVector& rPlaneNormal, const B3DPoint& rPlanePoint, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut)
+ {
+ if(!rPlaneNormal.equalZero() && !rEdgeStart.equal(rEdgeEnd))
+ {
+ const B3DVector aTestEdge(rEdgeEnd - rEdgeStart);
+ const double fScalarEdge(rPlaneNormal.scalar(aTestEdge));
+
+ if(!fTools::equalZero(fScalarEdge))
+ {
+ const B3DVector aCompareEdge(rPlanePoint - rEdgeStart);
+ const double fScalarCompare(rPlaneNormal.scalar(aCompareEdge));
+
+ fCut = fScalarCompare / fScalarEdge;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool getCutBetweenLineAndPolygon(const B3DPolygon& rCandidate, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut)
+ {
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ if(nPointCount > 2 && !rEdgeStart.equal(rEdgeEnd))
+ {
+ const B3DVector aPlaneNormal(rCandidate.getNormal());
+
+ if(!aPlaneNormal.equalZero())
+ {
+ const B3DPoint aPointOnPlane(rCandidate.getB3DPoint(0));
+
+ return getCutBetweenLineAndPlane(aPlaneNormal, aPointOnPlane, rEdgeStart, rEdgeEnd, fCut);
+ }
+ }
+
+ return false;
+ }
+
//////////////////////////////////////////////////////////////////////
// comparators with tolerance for 3D Polygons
diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx
index 2f73d9688b15..fe75e3919d21 100644
--- a/basegfx/source/polygon/b3dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolypolygontools.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b3dpolypolygontools.cxx,v $
- * $Revision: 1.8 $
+ * $Revision: 1.8.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -496,6 +496,33 @@ namespace basegfx
return aRetval;
}
+ bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder)
+ {
+ const sal_uInt32 nPolygonCount(rCandidate.count());
+
+ if(1L == nPolygonCount)
+ {
+ return isInside(rCandidate.getB3DPolygon(0), rPoint, bWithBorder);
+ }
+ else
+ {
+ sal_Int32 nInsideCount(0);
+
+ for(sal_uInt32 a(0); a < nPolygonCount; a++)
+ {
+ const B3DPolygon aPolygon(rCandidate.getB3DPolygon(a));
+ const bool bInside(isInside(aPolygon, rPoint, bWithBorder));
+
+ if(bInside)
+ {
+ nInsideCount++;
+ }
+ }
+
+ return (nInsideCount % 2L);
+ }
+ }
+
//////////////////////////////////////////////////////////////////////
// comparators with tolerance for 3D PolyPolygons
diff --git a/basegfx/source/vector/b3dvector.cxx b/basegfx/source/vector/b3dvector.cxx
index 0bba99dbee1b..3a7e04f4eea1 100644
--- a/basegfx/source/vector/b3dvector.cxx
+++ b/basegfx/source/vector/b3dvector.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b3dvector.cxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.4.1 $
*
* This file is part of OpenOffice.org.
*
@@ -99,6 +99,19 @@ namespace basegfx
B3DVector aRes( rVec );
return aRes*=rMat;
}
+
+ bool areParallel( const B3DVector& rVecA, const B3DVector& rVecB )
+ {
+ // i think fastest is to compare relations, need no square or division
+ if(!fTools::equal(rVecA.getX() * rVecB.getY(), rVecA.getY() * rVecB.getX()))
+ return false;
+
+ if(!fTools::equal(rVecA.getX() * rVecB.getZ(), rVecA.getZ() * rVecB.getX()))
+ return false;
+
+ return (fTools::equal(rVecA.getY() * rVecB.getZ(), rVecA.getZ() * rVecB.getY()));
+ }
+
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
diff --git a/goodies/inc/b3dtex.hxx b/goodies/inc/b3dtex.hxx
deleted file mode 100644
index 47207e359782..000000000000
--- a/goodies/inc/b3dtex.hxx
+++ /dev/null
@@ -1,378 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dtex.hxx,v $
- * $Revision: 1.10.38.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DTEX_HXX
-#define _B3D_B3DTEX_HXX
-
-#include <vcl/opengl.hxx>
-#include <vcl/bitmapex.hxx>
-#include <tools/color.hxx>
-#include <vcl/salbtype.hxx>
-#include <tools/time.hxx>
-
-// Vorausdeklarationen
-class BitmapReadAccess;
-class BitmapColor;
-
-/*************************************************************************
-|*
-|* define for lifetime of a texture in texture cache.
-|* Parameter of Time(...) call, so hrs, min, sec, 100thsec.
-|* Timer for cache uses ten secs delays
-|*
-\************************************************************************/
-
-#define B3D_TEXTURE_LIFETIME 0, 1, 0
-
-/*************************************************************************
-|*
-|* Long-Zeiger fuer OpenGL Texturdatenuebergabe
-|*
-\************************************************************************/
-
-#ifdef WIN
-typedef UINT8 huge* GL_UINT8;
-#else
-typedef UINT8* GL_UINT8;
-#endif
-
-/*************************************************************************
-|*
-|* Art der Pixeldaten der Textur
-|*
-\************************************************************************/
-
-enum Base3DTextureKind
-{
- Base3DTextureLuminance = 1,
- Base3DTextureIntensity,
- Base3DTextureColor
-};
-
-/*************************************************************************
-|*
-|* Modus der Textur
-|*
-\************************************************************************/
-
-enum Base3DTextureMode
-{
- Base3DTextureReplace = 1,
- Base3DTextureModulate,
- Base3DTextureBlend
-};
-
-/*************************************************************************
-|*
-|* Filtermodus der Textur
-|*
-\************************************************************************/
-
-enum Base3DTextureFilter
-{
- Base3DTextureNearest = 1,
- Base3DTextureLinear
-};
-
-/*************************************************************************
-|*
-|* Wrapping-Modus
-|*
-\************************************************************************/
-
-enum Base3DTextureWrap
-{
- Base3DTextureClamp = 1,
- Base3DTextureRepeat,
- Base3DTextureSingle
-};
-
-/*************************************************************************
-|*
-|* Defines fuer Maskenbildung um Entscheidung innerhalb von ModifyColor
-|* zu beschleunigen
-|*
-\************************************************************************/
-
-#define B3D_TXT_KIND_LUM 0x00
-#define B3D_TXT_KIND_INT 0x01
-#define B3D_TXT_KIND_COL 0x02
-
-#define B3D_TXT_MODE_REP 0x04
-#define B3D_TXT_MODE_MOD 0x08
-#define B3D_TXT_MODE_BND 0x0C
-
-#define B3D_TXT_FLTR_NEA 0x10
-
-/*************************************************************************
-|*
-|* Klassen fuer TexturAttribute beim Anfordern von Texturen
-|*
-\************************************************************************/
-
-#define TEXTURE_ATTRIBUTE_TYPE_COLOR 0x0000
-#define TEXTURE_ATTRIBUTE_TYPE_BITMAP 0x0001
-#define TEXTURE_ATTRIBUTE_TYPE_GRADIENT 0x0002
-#define TEXTURE_ATTRIBUTE_TYPE_HATCH 0x0003
-
-class TextureAttributes
-{
-private:
- void* mpFloatTrans;
- sal_Bool mbGhosted;
-
-public:
- TextureAttributes(sal_Bool bGhosted, void* pFT);
-
- virtual sal_Bool operator==(const TextureAttributes&) const;
- virtual sal_uInt16 GetTextureAttributeType() const =0;
-
- sal_Bool GetGhostedAttribute() { return mbGhosted; }
- void* GetFloatTransAttribute() { return mpFloatTrans; }
-};
-
-class TextureAttributesColor : public TextureAttributes
-{
-private:
- Color maColorAttribute;
-
-public:
- TextureAttributesColor(sal_Bool bGhosted, void* pFT, Color aColor);
-
- virtual sal_Bool operator==(const TextureAttributes&) const;
- virtual sal_uInt16 GetTextureAttributeType() const;
-
- Color GetColorAttribute() { return maColorAttribute; }
-};
-
-class TextureAttributesBitmap : public TextureAttributes
-{
-private:
- Bitmap maBitmapAttribute;
-
-public:
- TextureAttributesBitmap(sal_Bool bGhosted, void* pFT, Bitmap aBmp);
- virtual ~TextureAttributesBitmap();
-
- virtual sal_Bool operator==(const TextureAttributes&) const;
- virtual sal_uInt16 GetTextureAttributeType() const;
-
- Bitmap GetBitmapAttribute() { return maBitmapAttribute; }
-};
-
-class TextureAttributesGradient : public TextureAttributes
-{
-private:
- void* mpFill;
- void* mpStepCount;
-
-public:
- TextureAttributesGradient(sal_Bool bGhosted, void* pFT, void* pF, void *pSC);
-
- virtual sal_Bool operator==(const TextureAttributes&) const;
- virtual sal_uInt16 GetTextureAttributeType() const;
-
- void* GetFillAttribute() { return mpFill; }
- void* GetStepCountAttribute() { return mpStepCount; }
-};
-
-class TextureAttributesHatch : public TextureAttributes
-{
-private:
- void* mpFill;
-
-public:
- TextureAttributesHatch(sal_Bool bGhosted, void* pFT, void* pF);
-
- virtual sal_Bool operator==(const TextureAttributes&) const;
- virtual sal_uInt16 GetTextureAttributeType() const;
-
- void* GetHatchFillAttribute() { return mpFill; }
-};
-
-/*************************************************************************
-|*
-|* Klasse fuer Texturen in Base3D
-|*
-\************************************************************************/
-
-class B3dTexture
-{
-protected:
- // Die Bitmap(s) der Textur
- Bitmap aBitmap;
- AlphaMask aAlphaMask;
- Size aBitmapSize;
- BitmapReadAccess* pReadAccess;
- BitmapReadAccess* pAlphaReadAccess;
-
- // Attribute bei der Generierung
- TextureAttributes* pAttributes;
-
- // Gibt die Haeufigkeit der Benutzung wieder
- Time maTimeStamp;
-
- // Farbe fuer Base3DTextureBlend - Modus
- BitmapColor aColBlend;
-
- // Farbe, wenn keine Textur an einer Stelle liegt
- BitmapColor aColTexture;
-
- // Art der Textur
- Base3DTextureKind eKind;
-
- // Modus der Textur
- Base3DTextureMode eMode;
-
- // Filter
- Base3DTextureFilter eFilter;
-
- // Wrapping-Modes fuer beide Freiheitsgrade
- Base3DTextureWrap eWrapS;
- Base3DTextureWrap eWrapT;
-
- // Entscheidungsvariable
- sal_uInt8 nSwitchVal;
-
- // Vorbestimmbare interne booleans
- unsigned bTextureKindChanged : 1;
-
- // Konstruktor / Destruktor
- B3dTexture(TextureAttributes& rAtt,
- BitmapEx& rBmpEx,
- Base3DTextureKind=Base3DTextureColor,
- Base3DTextureMode=Base3DTextureReplace,
- Base3DTextureFilter=Base3DTextureNearest,
- Base3DTextureWrap eS=Base3DTextureSingle,
- Base3DTextureWrap eT=Base3DTextureSingle);
- virtual ~B3dTexture();
-
- // Interne Zugriffsfunktion auf die BitMapFarben
- inline BitmapColor GetBitmapColor(long nX, long nY) const;
- inline sal_uInt8 GetBitmapTransparency(long nX, long nY) const;
-
- // Generate switch val for optimized own texture mapping
- void SetSwitchVal();
-
- // time stamp and texture cache methods
- void Touch() { maTimeStamp = Time() + Time(B3D_TEXTURE_LIFETIME); }
- const Time& GetTimeStamp() const { return maTimeStamp; }
-
-public:
- // Zugriff auf die Attribute der Textur
- TextureAttributes& GetAttributes();
-
- // Zugriff auf Bitmap
- Bitmap& GetBitmap() { return aBitmap; }
- AlphaMask& GetAlphaMask() { return aAlphaMask; }
- BitmapEx GetBitmapEx() { return BitmapEx(aBitmap, aAlphaMask); }
-
- // #i72895#
- const Size GetBitmapSize() { return aBitmapSize; }
-
- // Texturfunktion
- void ModifyColor(Color& rCol, double fS, double fT);
-
- // Art der Pixeldaten lesen/bestimmen
- void SetTextureKind(Base3DTextureKind eNew);
- Base3DTextureKind GetTextureKind() { return eKind; }
-
- // Texturmodus lesen/bestimmen
- void SetTextureMode(Base3DTextureMode eNew);
- Base3DTextureMode GetTextureMode() { return eMode; }
-
- // Filtermodus lesen/bestimmen
- void SetTextureFilter(Base3DTextureFilter eNew);
- Base3DTextureFilter GetTextureFilter() { return eFilter; }
-
- // Wrapping fuer beide Freiheitsgrade lesen/bestimmen
- void SetTextureWrapS(Base3DTextureWrap eNew);
- Base3DTextureWrap GetTextureWrapS() { return eWrapS; }
- void SetTextureWrapT(Base3DTextureWrap eNew);
- Base3DTextureWrap GetTextureWrapT() { return eWrapT; }
-
- // Blend-Color lesen/bestimmen
- void SetBlendColor(Color rNew);
- Color GetBlendColor();
-
- // Textur-Ersatz-Color lesen/bestimmen
- void SetTextureColor(Color rNew);
- Color GetTextureColor();
-
-protected:
- // Zugriff auf Konstruktor/Destruktor nur fuer die verwaltenden Klassen
- friend class Base3D;
- friend class Base3DOpenGL;
- friend class B3dGlobalData;
- friend class B3dTextureStore;
-};
-
-/*************************************************************************
-|*
-|* erweiterte Klasse fuer Texturen in Base3DOpenGL
-|*
-\************************************************************************/
-
-class B3dTextureOpenGL : public B3dTexture
-{
-private:
- // Name dieser Textur in OpenGL
- GLuint nTextureName;
-
- // Konstruktor / Destruktor
- B3dTextureOpenGL(TextureAttributes& rAtt,
- BitmapEx& rBmpEx,
- OpenGL& rOGL,
- Base3DTextureKind=Base3DTextureColor,
- Base3DTextureMode=Base3DTextureReplace,
- Base3DTextureFilter=Base3DTextureNearest,
- Base3DTextureWrap eS=Base3DTextureClamp,
- Base3DTextureWrap eT=Base3DTextureClamp);
- virtual ~B3dTextureOpenGL();
-
- // In OpenGL die Textur zerstoeren
- void DestroyOpenGLTexture(OpenGL&);
-
-public:
- // Setze diese Textur in OpenGL als aktuelle Textur
- void MakeCurrentTexture(OpenGL&);
-
- // Erzeuge diese Textur als OpenGL-Textur
- void CreateOpenGLTexture(OpenGL&);
-
-protected:
- // Zugriff auf Konstruktor/Destruktor nur fuer die verwaltenden Klassen
- friend class Base3D;
- friend class Base3DOpenGL;
- friend class B3dTextureStore;
-};
-
-
-#endif // _B3D_B3DTEX_HXX
diff --git a/goodies/inc/b3dvolum.hxx b/goodies/inc/b3dvolum.hxx
deleted file mode 100644
index a8d617c931c4..000000000000
--- a/goodies/inc/b3dvolum.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dvolum.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_VOLUM_HXX
-#define _B3D_VOLUM_HXX
-
-//#ifndef _SVX_VECTOR3D_HXX
-//#include "vector3d.hxx"
-//#endif
-
-#ifndef _INC_FLOAT
-#include <float.h>
-#endif
-#include <tools/stream.hxx>
-
-/*************************************************************************
-|*
-|* dreidimensionales Volumen, symmetrisch zu den Koordinatenachsen
-|*
-\************************************************************************/
-
-class B3dVolume
-{
- friend class Vol3DPointIterator;
-
- protected:
- Vector3D aMinVec;
- Vector3D aMaxVec;
-
- public:
- B3dVolume(const Vector3D& rPos, const Vector3D& r3DSize,
- BOOL bPosIsCenter = TRUE);
- B3dVolume();
-
- void Reset();
- BOOL IsValid() const;
-
- B3dVolume& Union(const B3dVolume& rVol2);
- B3dVolume& Union(const Vector3D& rVec);
-
- const Vector3D& MinVec() const { return aMinVec; }
- Vector3D& MinVec() { return aMinVec; }
-
- const Vector3D& MaxVec() const { return aMaxVec; }
- Vector3D& MaxVec() { return aMaxVec; }
-
- double GetWidth() const { return aMaxVec.X() - aMinVec.X(); }
- double GetHeight() const { return aMaxVec.Y() - aMinVec.Y(); }
- double GetDepth() const { return aMaxVec.Z() - aMinVec.Z(); }
- Vector3D GetSize() const;
- BOOL IsInside(const Vector3D& rVec);
-
- friend SvStream& operator>>(SvStream& rIStream, B3dVolume&);
- friend SvStream& operator<<(SvStream& rOStream, const B3dVolume&);
-};
-
-
-#endif // _B3D_VOLUM_HXX
diff --git a/goodies/inc/goodies/b3dcolor.hxx b/goodies/inc/goodies/b3dcolor.hxx
deleted file mode 100644
index 52bcd5e47532..000000000000
--- a/goodies/inc/goodies/b3dcolor.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dcolor.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DCOLOR_HXX
-#define _B3D_B3DCOLOR_HXX
-
-#include <tools/color.hxx>
-
-/*************************************************************************
-|*
-|* Farbklasse fuer 3D. Besitzt einige Funktionen mehr, als die normale
-|* Farbe
-|*
-\************************************************************************/
-
-class B3dColor : public Color
-{
-public:
- B3dColor() : Color() {}
- B3dColor( ColorData nColor ) : Color(nColor) {}
- B3dColor( UINT8 nRed, UINT8 nGreen, UINT8 nBlue )
- : Color(nRed, nGreen, nBlue) {}
- B3dColor( UINT8 nTransparency, UINT8 nRed, UINT8 nGreen, UINT8 nBlue )
- : Color(nTransparency, nRed, nGreen, nBlue) {}
- B3dColor( const ResId& rResId ) : Color(rResId) {}
- B3dColor( const Color& rCol ) : Color(rCol) {}
-
- void CalcInBetween(Color& rOld1, Color& rOld2, double t);
- void CalcMiddle(Color& rOld1, Color& rOld2);
- void CalcMiddle(Color& rOld1, Color& rOld2, Color& rOld3);
- ULONG GetDistance(Color& rOld);
-
- // Addition, Subtraktion mit clamping
- B3dColor& operator+= (const B3dColor&);
- B3dColor& operator-= (const B3dColor&);
- B3dColor operator+ (const B3dColor&) const;
- B3dColor operator- (const B3dColor&) const;
-
- // Multiplikation als Gewichtung, Anwendung einer Lampe
- // auf eine Farbe, Lampe als 2.Faktor
- B3dColor& operator*= (const B3dColor&);
- B3dColor operator* (const B3dColor&) const;
-
- // Multiplikation mit Faktor im Bereich [0.0 .. 1.0]
- B3dColor& operator*= (const double);
- B3dColor operator* (const double) const;
-
- // Zuweisung
- void operator=(const Color& rCol) { mnColor = rCol.GetColor(); }
-};
-
-#endif // _B3D_B3DCOLOR_HXX
diff --git a/goodies/inc/goodies/b3dcompo.hxx b/goodies/inc/goodies/b3dcompo.hxx
deleted file mode 100644
index 4ee0d1a514aa..000000000000
--- a/goodies/inc/goodies/b3dcompo.hxx
+++ /dev/null
@@ -1,226 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dcompo.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DCOMPO_HXX
-#define _B3D_B3DCOMPO_HXX
-
-#include <goodies/b3dentty.hxx>
-
-/*************************************************************************
-|*
-|* Klasse fuer Kantenliste, horizontaler Teil
-|*
-\************************************************************************/
-
-class B3dEdgeList;
-class Base3D;
-class B3dGeometry;
-
-class B3dEdgeEntry
-{
-private:
- // Verzeigerung
- B3dEdgeList* pParent;
- B3dEdgeEntry* pRight;
- B3dEntity* pEnd;
-
- // Ist diese Kante Teil der urspruenglichen Geometrie
- // oder als Stuetzkante hinzugefuegt?
- unsigned bEdgeVisible : 1;
-
-public:
- B3dEdgeEntry() {}
-
- void Reset()
- {
- pEnd = NULL;
- pParent = NULL;
- pRight = NULL;
- }
-
- void SetEnd(B3dEntity* pNew) { pEnd = pNew; }
- B3dEntity* GetEnd() { return pEnd; }
- double GetXPos() { return pEnd->GetX(); }
- double GetYPos() { return pEnd->GetY(); }
-
- void SetParent(B3dEdgeList* pNew) { pParent = pNew; }
- void SetRight(B3dEdgeEntry* pNew) { pRight = pNew; }
-
- B3dEdgeList* GetParent() { return pParent; }
- B3dEdgeEntry* GetRight() { return pRight; }
-
- void SetEdgeVisible(BOOL bNew) { bEdgeVisible = bNew; }
- BOOL IsEdgeVisible() { return bEdgeVisible; }
-
-protected:
-};
-
-/*************************************************************************
-|*
-|* Bucket fuer Kantenliste, horizontaler Teil
-|*
-\************************************************************************/
-
-BASE3D_DECL_BUCKET(B3dEdgeEntry, Bucket)
-
-/*************************************************************************
-|*
-|* Klasse fuer Kantenliste, vertikaler Teil
-|*
-\************************************************************************/
-
-class B3dEdgeList
-{
-private:
- // Verzeigerung
- B3dEdgeList* pParent;
- B3dEdgeList* pDown;
- B3dEdgeEntry* pEntries;
- B3dEntity* pStart;
-
-public:
- B3dEdgeList() {}
-
- void Reset()
- {
- pParent = pDown = NULL;
- pEntries = NULL;
- pStart = NULL;
- }
-
- void SetParent(B3dEdgeList* pNew) { pParent = pNew; }
- void SetDown(B3dEdgeList* pNew) { pDown = pNew; }
- void SetEntries(B3dEdgeEntry* pNew) { pEntries = pNew; }
- void SetStart(B3dEntity* pNew) { pStart = pNew; }
-
- B3dEdgeList* GetParent() { return pParent; }
- B3dEdgeList* GetDown() { return pDown; }
- B3dEdgeEntry* GetEntries() { return pEntries; }
- B3dEntity* GetStart() { return pStart; }
-
- double GetXPos() { return pStart->GetX(); }
- double GetYPos() { return pStart->GetY(); }
-
-protected:
-};
-
-/*************************************************************************
-|*
-|* Bucket fuer Kantenliste, vertikaler Teil
-|*
-\************************************************************************/
-
-BASE3D_DECL_BUCKET(B3dEdgeList, Bucket)
-
-/*************************************************************************
-|*
-|* Klasse fuer komplexe Polygone (PolyPolygone) und deren Triangulierung
-|*
-\************************************************************************/
-
-class B3dComplexPolygon
-{
-private:
- // Buffer fuer Punkte
- B3dEntityBucket aEntityBuffer;
-
- // Startpunkt der EdgeList
- B3dEdgeList* pEdgeList;
-
- // Y-Richtung der Kantenliste
- B3dEdgeListBucket aEdgeList;
-
- // X-Eintraege der Kantenliste
- B3dEdgeEntryBucket aEdgeEntry;
-
- // Startpunkt neues Polygon
- ULONG nNewPolyStart;
-
- // Index der in allen Belangen hoechsten Ecke
- // um 1 erhoeht!
- ULONG nHighestEdge;
-
- // Zeiger auf den zuletzt hinzugefuegten Punkt
- B3dEntity* pLastVertex;
-
- // Normale des bearbeiteten Polygons
- basegfx::B3DVector aNormal;
-
- // Zeiger auf Base3D und B3dGeometry
- Base3D *pBase3D;
- B3dGeometry *pGeometry;
-
- // Flags
- unsigned bOrientationValid : 1;
- unsigned bNormalValid : 1;
- unsigned bTestForCut : 1;
- unsigned bOrientation : 1;
-
-public:
- B3dComplexPolygon();
-
- void StartPrimitive();
- void EndPrimitive(Base3D *pB3d);
- void EndPrimitive(B3dGeometry *pGeom);
- void PostAddVertex(B3dEntity& rVertex);
- B3dEntity &GetFreeEntity();
-
- void EmptyBuffers();
-
- // Schnitte testen an/aus
- void SetTestForCut(BOOL bNew) { bTestForCut = bNew; }
-
-protected:
- BOOL GetTestForCut() { return bTestForCut; }
- void ComputeLastPolygon(BOOL bIsLast=FALSE);
- B3dEdgeEntry* AddEdge(B3dEntity* pPoint1, B3dEntity* pPoint2);
- void TestForCut(B3dEdgeEntry* pEntry);
- void AddEdgeCut(B3dEntity* pStart, B3dEntity* pEnd)
- { TestForCut(AddEdge(pStart, pEnd)); }
- B3dEdgeList* GetList(B3dEntity* pStart);
- B3dEdgeEntry* InsertEdge(B3dEdgeList* pList, B3dEntity* pEnd, BOOL bEdgeVisible);
- double GetSlant(B3dEdgeEntry* pEdge);
- double FindCut(B3dEdgeEntry* pNewEntry, B3dEdgeEntry* pEntry);
- BOOL SwitchEdgeExistance(B3dEntity* pStart, B3dEntity* pEnd);
- void RemoveFirstEdge(B3dEdgeList* pList);
- void RemoveEdgeList(B3dEdgeList* pList);
- void ExtractTriangle();
- B3dEdgeList* FindStartInTriangle();
- BOOL ArePointsEqual(B3dEntity& rFirst, B3dEntity& rSecond);
- BOOL IsConvexPolygon();
- BOOL DoSwap(B3dEntity* pStart, B3dEntity* pEnd);
- BOOL IsLeft(B3dEntity* pTop, B3dEntity* pDirection,
- B3dEntity* pPoint);
- void ChooseNormal();
- BOOL CompareOrder(B3dEntity* pFirst, B3dEntity* pSecond);
- void TestHighestEdge(B3dEntity& rVertex);
-};
-
-#endif // _B3D_B3DCOMPO_HXX
diff --git a/goodies/inc/goodies/b3dentty.hxx b/goodies/inc/goodies/b3dentty.hxx
deleted file mode 100644
index fc47a7906842..000000000000
--- a/goodies/inc/goodies/b3dentty.hxx
+++ /dev/null
@@ -1,156 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dentty.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DENTITY_HXX
-#define _B3D_B3DENTITY_HXX
-
-#include <goodies/b3dcolor.hxx>
-#include <goodies/bucket.hxx>
-#include <basegfx/point/b3dpoint.hxx>
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/vector/b3dvector.hxx>
-
-/*************************************************************************
-|*
-|* Merkt sich einen Punkt plus Normale plus Texturkoordinate
-|* (in Zukunft noch weitere Attribute, bsp. Farbe, Kante, Linienmodus
-|*
-\************************************************************************/
-
-// predeclarations
-class B3dTransformationSet;
-namespace basegfx
-{
- class B3DHomMatrix;
-} // end of namespace basegfx
-
-class B3dEntity
-{
-private:
- // Data defining this point, it's normal and texture coordinates
- basegfx::B3DPoint maPoint;
- basegfx::B3DVector maNormal;
- basegfx::B3DVector maPlaneNormal;
- basegfx::B2DPoint maTexCoor;
- B3dColor maColor;
-
- // Ist die diesem Punkt folgende Kante sichtbar ?
- // EdgeFlag bool NOT in bitfield to be able to access it from OpenGL driver
- sal_uInt8 mbEdgeFlag;
-
- // bitfield
- // Gueltigkeit der geometrischen Daten
- unsigned mbValid : 1;
-
- // Wird eine Normale verwendet ?
- unsigned mbNormalUsed : 1;
-
- // Wird eine Texturkoordinate verwendet ?
- unsigned mbTexCoorUsed : 1;
-
- // Sind die geometrischen Daten schon in DeviceKoordinaten
- // umgerechnet ?
- unsigned mbDeviceCoor : 1;
-
-public:
- B3dEntity() { Reset(); }
-
- sal_Bool IsValid() const { return mbValid; }
- void SetValid(sal_Bool bNew=sal_True) { mbValid = bNew; }
-
- sal_Bool IsNormalUsed() const { return mbNormalUsed; }
- void SetNormalUsed(sal_Bool bNew=sal_True) { mbNormalUsed = bNew; }
-
- sal_Bool IsTexCoorUsed() const { return mbTexCoorUsed; }
- void SetTexCoorUsed(sal_Bool bNew=sal_True) { mbTexCoorUsed = bNew; }
-
- sal_Bool IsDeviceCoor() const { return mbDeviceCoor; }
- void SetDeviceCoor(sal_Bool bNew=sal_True) { mbDeviceCoor = bNew; }
-
- sal_Bool IsEdgeVisible() const { return mbEdgeFlag; }
- void SetEdgeVisible(sal_Bool bNew=sal_True) { mbEdgeFlag = bNew; }
-
- basegfx::B3DPoint& Point() { return maPoint; }
- const basegfx::B3DPoint& Point() const { return maPoint; }
- basegfx::B3DVector& Normal() { return maNormal; }
- const basegfx::B3DVector& Normal() const { return maNormal; }
- basegfx::B3DVector& PlaneNormal() { return maPlaneNormal; }
- const basegfx::B3DVector& PlaneNormal() const { return maPlaneNormal; }
- basegfx::B2DPoint& TexCoor() { return maTexCoor; }
- const basegfx::B2DPoint& TexCoor() const { return maTexCoor; }
- B3dColor& Color() { return maColor; }
- const B3dColor& Color() const { return maColor; }
- sal_uInt8& EdgeFlag() { return mbEdgeFlag; }
- const sal_uInt8& EdgeFlag() const { return mbEdgeFlag; }
-
- double GetX() const { return maPoint.getX(); }
- void SetX(double fNew) { maPoint.setX(fNew); }
-
- double GetY() const { return maPoint.getY(); }
- void SetY(double fNew) { maPoint.setY(fNew); }
-
- double GetZ() const { return maPoint.getZ(); }
- void SetZ(double fNew) { maPoint.setZ(fNew); }
-
- void Reset();
-
- void Copy(B3dEntity& rEnt);
- void ToDeviceCoor(B3dTransformationSet* pSet)
- { if(!IsDeviceCoor()) ImplToDeviceCoor(pSet); }
- void To3DCoor(B3dTransformationSet* pSet)
- { if(IsDeviceCoor()) ImplTo3DCoor(pSet); }
-
- void ForceEqualBase(B3dTransformationSet* pSet, B3dEntity& rOld);
- void ForceEqualBase(B3dTransformationSet* pSet, B3dEntity& rOld1,
- B3dEntity& rOld2);
- void CalcInBetween(B3dEntity& rOld1,
- B3dEntity& rOld2, double t);
- void CalcMiddle(B3dEntity& rOld1,
- B3dEntity& rOld2);
- void CalcMiddle(B3dEntity& rOld1,
- B3dEntity& rOld2, B3dEntity& rOld3);
-
- // Eine beliebige Transformation auf die Geometrie anwenden
- void Transform(const basegfx::B3DHomMatrix& rMat);
-
-protected:
- void ImplToDeviceCoor(B3dTransformationSet* pSet);
- void ImplTo3DCoor(B3dTransformationSet* pSet);
-};
-
-/*************************************************************************
-|*
-|* Bucket fuer geometrische Daten
-|*
-\************************************************************************/
-
-BASE3D_DECL_BUCKET(B3dEntity, Bucket)
-
-#endif // _B3D_B3DENTITY_HXX
diff --git a/goodies/inc/goodies/b3dgeom.hxx b/goodies/inc/goodies/b3dgeom.hxx
deleted file mode 100644
index 91f954d2fe56..000000000000
--- a/goodies/inc/goodies/b3dgeom.hxx
+++ /dev/null
@@ -1,207 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dgeom.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DGEOM_HXX
-#define _B3D_B3DGEOM_HXX
-
-#include <goodies/b3dentty.hxx>
-
-//#ifndef _B3D_VOLUM_HXX
-//#include "b3dvolum.hxx"
-//#endif
-#include <basegfx/range/b3drange.hxx>
-
-#include <vector>
-
-/*************************************************************************
-|*
-|* Defines fuer die Erzeugung von Default-Normalen und -Texturkoordinaten
-|*
-\************************************************************************/
-
-#define B3D_CREATE_DEFAULT_X (0x0001)
-#define B3D_CREATE_DEFAULT_Y (0x0002)
-#define B3D_CREATE_DEFAULT_ALL (B3D_CREATE_DEFAULT_X|B3D_CREATE_DEFAULT_Y)
-
-/*************************************************************************
-|*
-|* Index-Klasse fuer Geometrie-Bucket der B3dGeometry-Klasse
-|*
-\************************************************************************/
-
-#define B3D_INDEX_MODE_FILLED (0)
-#define B3D_INDEX_MODE_LINE (1)
-#define B3D_INDEX_MODE_POINT (2)
-#define B3D_INDEX_MODE_UNUSED (3)
-
-class GeometryIndexValue
-{
-private:
- unsigned nIndex : 30;
- unsigned nMode : 2;
-
-public:
- GeometryIndexValue() : nIndex(0), nMode(B3D_INDEX_MODE_FILLED) {}
- GeometryIndexValue(UINT32 nInd) : nIndex(nInd), nMode(B3D_INDEX_MODE_FILLED) {}
- GeometryIndexValue(UINT32 nInd, UINT8 nMod) : nIndex(nInd), nMode(nMod) {}
-
- UINT32 GetIndex() const { return ((UINT32)nIndex); }
- void SetIndex(UINT32 nNew) { nIndex = nNew; }
-
- UINT8 GetMode() const { return ((UINT8)nMode); }
- void SetMode(UINT8 nNew) { nMode = nNew; }
-
-protected:
-};
-
-/*************************************************************************
-|*
-|* Bucket fuer Indices
-|*
-\************************************************************************/
-
-BASE3D_DECL_BUCKET(GeometryIndexValue, Bucket)
-
-/*************************************************************************
-|*
-|* Geometrie eines 3D-Objektes
-|*
-\************************************************************************/
-class B3dComplexPolygon;
-
-class B3dGeometry
-{
-private:
- // Tool zum triangulieren komplexer Polygone
- // Wird nur temporaer erzeugt
- B3dComplexPolygon* pComplexPolygon;
-
- // Bucket fuer grundsaetzliche Geometrie
- B3dEntityBucket aEntityBucket;
-
- // Indices der Polygonendpunkte
- GeometryIndexValueBucket aIndexBucket;
-
- // Ausgangszustand der Variablen herstellen
- void Reset();
-
- // Freien Eintrag zum fuellen holen
- B3dEntity& GetFreeEntity();
-
- // Hint-Variable
- unsigned bHintIsComplex : 1;
- unsigned bOutline : 1;
-
-public:
- // Konstruktor, Destruktor
- B3dGeometry();
-
- // #92030# add access to bOutline hint flag
- sal_Bool IsOutline() const { return (sal_Bool)bOutline; }
-
- // Geometrieerzeugung
- void StartDescription();
- void EndDescription();
-
- void StartObject(BOOL bHintIsComplex=TRUE, BOOL bOutl=FALSE);
- void EndObject();
-
- void AddEdge(const basegfx::B3DPoint& rPoint);
- void AddEdge(const basegfx::B3DPoint& rPoint, const basegfx::B3DVector& rNormal);
- void AddEdge(const basegfx::B3DPoint& rPoint, const basegfx::B3DVector& rNormal, const basegfx::B2DPoint& rTexture);
-
- // Inhalte loeschen
- void Erase();
- // Inhalte loeschen und Speicher freigeben
- void Empty();
-
- // Copy-Operator
- void operator=(const B3dGeometry& rObj);
-
- // Zugriff auf beide Buckets um die Geometrie zu lesen
- const B3dEntityBucket& GetEntityBucket() const { return aEntityBucket; }
- const GeometryIndexValueBucket& GetIndexBucket() const { return aIndexBucket; }
-
- // Eine beliebige Transformation auf die Geometrie anwenden
- void Transform(const basegfx::B3DHomMatrix& rMat);
-
- // Hittest auf Geometrie
- sal_Bool CheckHit(const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, sal_uInt16 nTol);
-
- // BoundVolume liefern
- basegfx::B3DRange GetBoundVolume() const;
-
- // Mittelpunkt liefern
- basegfx::B3DPoint GetCenter() const;
-
- // Standard - Normalen generieren
- void CreateDefaultNormalsSphere();
- void RemoveNormals();
-
- // Standard - Texturkoordinaten generieren
- void CreateDefaultTexture(sal_uInt16 nCreateWhat=B3D_CREATE_DEFAULT_ALL,
- BOOL bUseSphere=TRUE);
- void RemoveTexture();
-
- // Default-Geometrien erstellen
- void CreateCube(const basegfx::B3DRange& rVolume);
- void CreateSphere(const basegfx::B3DRange& rVolume, double nX, double nY);
-
- // Normalen invertieren
- void InvertNormals();
-
- // #110988# get all cuts of the geometry with the given vector defined by the two positions
- void GetAllCuts(::std::vector< basegfx::B3DPoint >& rVector, const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack) const;
-
-protected:
- // Callbacks bei komplexen Primitiven
- friend class B3dComplexPolygon;
- void StartComplexPrimitive();
- void EndComplexPrimitive();
- void AddComplexVertex(B3dEntity& rNew, BOOL bIsVisible);
-
- // PolygonStart und -Ende aufzeichnen
- void StartPolygon();
- void EndPolygon();
-
- // Hittest fuer einzelnes Polygon, -1: Kein Hit, sonst die Tiefe
- sal_Bool CheckSinglePolygonHit(sal_uInt32 nLow, sal_uInt32 nHigh, const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, basegfx::B3DPoint& rCut) const;
-
- // Schnittpunkt Polygon/Vektor bestimmen
- sal_Bool GetCutPoint(sal_uInt32 nLow, basegfx::B3DPoint& rCut, const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack) const;
-
- // Test auf drin/draussen fuer einzelnes Polygon
- sal_Bool IsInside(sal_uInt32 nLow, sal_uInt32 nHigh, const basegfx::B3DPoint& rPnt) const;
-
- // Normale ermitteln fuer einzelnes Polygon
- basegfx::B3DVector CalcNormal(sal_uInt32 nLow, sal_uInt32 nHigh) const;
-};
-
-#endif // _B3D_B3DGEOM_HXX
diff --git a/goodies/inc/goodies/b3dlight.hxx b/goodies/inc/goodies/b3dlight.hxx
deleted file mode 100644
index c75dcd1e6357..000000000000
--- a/goodies/inc/goodies/b3dlight.hxx
+++ /dev/null
@@ -1,236 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dlight.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DLIGHT_HXX
-#define _B3D_B3DLIGHT_HXX
-
-#ifndef _SVX_MATRIL3D_HXX
-#include <goodies/matril3d.hxx>
-#endif
-#include <basegfx/vector/b3dvector.hxx>
-#include <basegfx/point/b3dpoint.hxx>
-
-/*************************************************************************
-|*
-|* Unterstuetzte Lichtquellen
-|*
-\************************************************************************/
-
-#define BASE3D_MAX_NUMBER_LIGHTS (8)
-
-enum Base3DLightNumber
-{
- Base3DLight0 = 0,
- Base3DLight1,
- Base3DLight2,
- Base3DLight3,
- Base3DLight4,
- Base3DLight5,
- Base3DLight6,
- Base3DLight7,
- Base3DLightNone
-};
-
-/*************************************************************************
-|*
-|* Basisklasse fuer Lichtquellen
-|*
-\************************************************************************/
-
-class B3dLight
-{
-private:
- Color aAmbient;
- Color aDiffuse;
- Color aSpecular;
- basegfx::B3DPoint aPosition;
- basegfx::B3DPoint aPositionEye;
- basegfx::B3DVector aSpotDirection;
- basegfx::B3DVector aSpotDirectionEye;
- sal_uInt16 nSpotExponent;
- double fSpotCutoff;
- double fCosSpotCutoff;
- double fConstantAttenuation;
- double fLinearAttenuation;
- double fQuadraticAttenuation;
-
- unsigned bIsFirstLight : 1;
- unsigned bIsEnabled : 1;
- unsigned bIsDirectionalSource : 1;
- unsigned bIsSpot : 1;
- unsigned bIsAmbient : 1;
- unsigned bIsDiffuse : 1;
- unsigned bIsSpecular : 1;
- unsigned bLinearOrQuadratic : 1;
-
-public:
- B3dLight();
-
- // Zugriffsfunktionen
- void SetIntensity(const Color rNew,
- Base3DMaterialValue=Base3DMaterialAmbient);
- const Color GetIntensity(Base3DMaterialValue=Base3DMaterialAmbient);
- void SetPositionEye(const basegfx::B3DPoint& rNew)
- { aPositionEye=rNew; }
- const basegfx::B3DPoint& GetPositionEye()
- { return aPositionEye; }
- void SetPosition(const basegfx::B3DPoint& rNew)
- { aPosition=rNew; }
- const basegfx::B3DPoint& GetPosition()
- { return aPosition; }
- void SetSpotDirection(const basegfx::B3DVector& rNew);
- const basegfx::B3DVector& GetSpotDirection()
- { return aSpotDirection; }
- void SetSpotDirectionEye(const basegfx::B3DVector& rNew);
- const basegfx::B3DVector& GetSpotDirectionEye()
- { return aSpotDirectionEye; }
- void SetSpotExponent(sal_uInt16 nNew)
- { nSpotExponent=nNew; }
- sal_uInt16 GetSpotExponent()
- { return nSpotExponent; }
- void SetSpotCutoff(double fNew) ;
- double GetSpotCutoff()
- { return fSpotCutoff; }
- double GetCosSpotCutoff()
- { return fCosSpotCutoff; }
- void SetConstantAttenuation(double fNew)
- { fConstantAttenuation=fNew; }
- double GetConstantAttenuation()
- { return fConstantAttenuation; }
- void SetLinearAttenuation(double fNew);
- double GetLinearAttenuation()
- { return fLinearAttenuation; }
- void SetQuadraticAttenuation(double fNew);
- double GetQuadraticAttenuation()
- { return fQuadraticAttenuation; }
-
- void Enable(sal_Bool bNew=sal_True)
- { bIsEnabled=bNew; }
- sal_Bool IsEnabled()
- { return bIsEnabled; }
- void SetFirst(sal_Bool bNew=sal_True)
- { bIsFirstLight=bNew; }
- sal_Bool IsFirst()
- { return bIsFirstLight; }
- void SetDirectionalSource(sal_Bool bNew=sal_True)
- { bIsDirectionalSource=bNew; }
- sal_Bool IsDirectionalSource()
- { return bIsDirectionalSource; }
- sal_Bool IsSpot()
- { return bIsSpot; }
- sal_Bool IsAmbient()
- { return bIsAmbient; }
- sal_Bool IsDiffuse()
- { return bIsDiffuse; }
- sal_Bool IsSpecular()
- { return bIsSpecular; }
- sal_Bool IsLinearOrQuadratic()
- { return bLinearOrQuadratic; }
-
- void Init();
-};
-
-/*************************************************************************
-|*
-|* Gruppe von Lichtquellen
-|*
-\************************************************************************/
-
-class B3dLightGroup
-{
-private:
- // Lichtquellen
- B3dLight aLight[BASE3D_MAX_NUMBER_LIGHTS];
-
- // lokale Parameter des LightModels
- Color aGlobalAmbientLight;
-
- // Hauptschalter fuer die Beleuchtung
- unsigned bLightingEnabled : 1;
- unsigned bLocalViewer : 1;
- unsigned bModelTwoSide : 1;
-
-public:
- // Konstruktor
- B3dLightGroup();
- virtual ~B3dLightGroup();
-
- // lokale Parameter des LightModels
- virtual void SetGlobalAmbientLight(const Color rNew);
- const Color GetGlobalAmbientLight();
- virtual void SetLocalViewer(sal_Bool bNew=sal_True);
- sal_Bool GetLocalViewer();
- virtual void SetModelTwoSide(sal_Bool bNew=sal_False);
- sal_Bool GetModelTwoSide();
-
- // Hauptschalter fuer die Beleuchtung
- virtual void EnableLighting(sal_Bool bNew=sal_True);
- sal_Bool IsLightingEnabled();
-
- // Lichtquellen Interface
- void SetIntensity(const Color rNew,
- Base3DMaterialValue=Base3DMaterialAmbient,
- Base3DLightNumber=Base3DLight0);
- const Color GetIntensity(Base3DMaterialValue=Base3DMaterialAmbient,
- Base3DLightNumber=Base3DLight0);
- void SetPosition(const basegfx::B3DPoint& rNew,
- Base3DLightNumber=Base3DLight0);
- void SetDirection(const basegfx::B3DVector& rNew,
- Base3DLightNumber=Base3DLight0);
- const basegfx::B3DPoint& GetPosition(Base3DLightNumber=Base3DLight0);
- const basegfx::B3DVector& GetDirection(Base3DLightNumber=Base3DLight0);
- void SetSpotDirection(const basegfx::B3DVector& rNew,
- Base3DLightNumber=Base3DLight0);
- const basegfx::B3DVector& GetSpotDirection(Base3DLightNumber=Base3DLight0);
- void SetSpotExponent(sal_uInt16 nNew,
- Base3DLightNumber=Base3DLight0);
- sal_uInt16 GetSpotExponent(Base3DLightNumber=Base3DLight0);
- void SetSpotCutoff(double fNew,
- Base3DLightNumber=Base3DLight0);
- double GetSpotCutoff(Base3DLightNumber=Base3DLight0);
- void SetConstantAttenuation(double fNew,
- Base3DLightNumber=Base3DLight0);
- double GetConstantAttenuation(Base3DLightNumber=Base3DLight0);
- void SetLinearAttenuation(double fNew,
- Base3DLightNumber=Base3DLight0);
- double GetLinearAttenuation(Base3DLightNumber=Base3DLight0);
- void SetQuadraticAttenuation(double fNew,
- Base3DLightNumber=Base3DLight0);
- double GetQuadraticAttenuation(Base3DLightNumber=Base3DLight0);
- void Enable(sal_Bool bNew=sal_True,
- Base3DLightNumber=Base3DLight0);
- sal_Bool IsEnabled(Base3DLightNumber=Base3DLight0);
- sal_Bool IsDirectionalSource(Base3DLightNumber=Base3DLight0);
-
- // Direkter Zugriff auf B3dLight
- B3dLight& GetLightObject(Base3DLightNumber=Base3DLight0);
-};
-
-#endif // _B3D_B3DLIGHT_HXX
diff --git a/goodies/inc/goodies/base3d.hxx b/goodies/inc/goodies/base3d.hxx
deleted file mode 100644
index c2bf428a28f3..000000000000
--- a/goodies/inc/goodies/base3d.hxx
+++ /dev/null
@@ -1,467 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: base3d.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_BASE3D_HXX
-#define _B3D_BASE3D_HXX
-
-#include <goodies/b3dlight.hxx>
-
-//#ifndef _B3D_HMATRIX_HXX
-//#include "hmatrix.hxx"
-//#endif
-#include <goodies/b3dentty.hxx>
-#include <goodies/b3dcompo.hxx>
-
-#ifndef _INC_FLOAT
-#include <float.h>
-#endif
-
-// MUSS-Aenderung
-#include <vcl/outdev3d.hxx>
-#include <vcl/timer.hxx>
-#include <vos/mutex.hxx>
-#include <tools/gen.hxx>
-
-// Vorausdeklarationen
-class B3dTexture;
-class OutputDevice;
-class Bitmap;
-class BitmapEx;
-class TextureAttributes;
-class B3dTransformationSet;
-
-/*************************************************************************
-|*
-|* Texturenverwaltung
-|*
-\************************************************************************/
-
-SV_DECL_PTRARR_DEL(B3dTextureStore, B3dTexture*, 0, 4)
-
-/*************************************************************************
-|*
-|* Globale Daten fuer Base3D
-|*
-\************************************************************************/
-
-class B3dGlobalData
-{
-private:
- // Texturverwaltung
- Container maTextureStore;
- AutoTimer maTimer;
- vos::OMutex maMutex;
-
- // link for timer
- DECL_LINK(TimerHdl, AutoTimer*);
-
-public:
- B3dGlobalData();
- virtual ~B3dGlobalData();
-
- B3dTexture* ObtainTexture(TextureAttributes& rAtt);
- void InsertTexture(B3dTexture* pNew);
- void DeleteTexture(B3dTexture* pOld);
- void DeleteAllTextures();
-};
-
-/*************************************************************************
-|*
-|* Bisher vorhandene Renderer
-|*
-\************************************************************************/
-
-#define BASE3D_TYPE_DEFAULT 0x0000
-#define BASE3D_TYPE_OPENGL 0x0001
-#define BASE3D_TYPE_PRINTER 0x0002
-
-/*************************************************************************
-|*
-|* Moegliche Objekttypen fuer Primitive
-|*
-\************************************************************************/
-
-enum Base3DObjectMode
-{
-
- // die folgenden Primitive muessen von jedem abgeleiteten Renderer
- // ausgefuehrt werden koennen
-
- Base3DPoints = 0,
- Base3DLines,
- Base3DLineLoop,
- Base3DLineStrip,
- Base3DTriangles,
- Base3DTriangleStrip,
- Base3DTriangleFan,
- Base3DQuads,
- Base3DQuadStrip,
- Base3DPolygon,
-
- // ab hier beginnen hoehere Primitive, die mit speziellen Methoden
- // innerhalb von Base3D auf die obenstehenden Primitive
- // abgebildet werden. Diese Methoden tun dies alles im object
- // coordinate system.
-
- // PolyPolygon ohne Selbstueberschneidungen und ohne
- // Ueberschneidungen der evtl. vorhandenen Teilpolygone
- Base3DComplexPolygon,
-
- // Beliebiges PolyPolygon mit Selbstueberschneidungen und
- // Ueberschneidungen der weiteren Teilpolygone
- Base3DComplexPolygonCut
-};
-
-/*************************************************************************
-|*
-|* Moegliche Darstellungsarten fuer Primitive
-|*
-\************************************************************************/
-
-enum Base3DRenderMode
-{
- Base3DRenderNone = 0,
- Base3DRenderPoint,
- Base3DRenderLine,
- Base3DRenderFill
-};
-
-/*************************************************************************
-|*
-|* Moegliche CullingModes fuer Polygone
-|*
-\************************************************************************/
-
-enum Base3DCullMode
-{
- Base3DCullNone = 0,
- Base3DCullFront,
- Base3DCullBack
-};
-
-/*************************************************************************
-|*
-|* Moegliche ShadeModels fuer Polygone
-|*
-\************************************************************************/
-
-enum Base3DShadeModel
-{
- Base3DSmooth = 0,
- Base3DFlat,
- Base3DPhong
-};
-
-/*************************************************************************
-|*
-|* Unterstuetzung PolygonOffset
-|*
-\************************************************************************/
-
-enum Base3DPolygonOffset
-{
- Base3DPolygonOffsetFill = 1,
- Base3DPolygonOffsetLine,
- Base3DPolygonOffsetPoint
-};
-
-/*************************************************************************
-|*
-|* Genauigkeit der Berechnungen; im Zweifelsfall wird dieser
-|* Wert benutzt, um mit 0.0 zu vergleichen oder Abstaende von
-|* Randvereichen von Wertebereichen zu testen
-|*
-\************************************************************************/
-
-#define SMALL_DVALUE (0.0000001)
-
-/*************************************************************************
-|*
-|* Die Basisklasse fuer alle 3D Ausgaben
-|*
-\************************************************************************/
-
-class Base3D : public OutDev3D
-{
-private:
- // das OutputDevice, das Ziel dieser Base3D Engine ist. Wird bereits
- // im Konstruktor uebergeben und kann nicht veraendert werden.
- OutputDevice* pDevice;
-
- // ObjectCreationMode
- Base3DObjectMode eObjectMode;
-
- // current color and alpha blending
- Color aCurrentColor;
-
- // Komplexe Polygone
- B3dComplexPolygon aComplexPolygon;
-
- // RenderMode
- Base3DRenderMode eRenderModeFront;
- Base3DRenderMode eRenderModeBack;
-
- // ShadeMode fuer Polygone
- Base3DShadeModel eShadeModel;
-
- // CullingMode
- Base3DCullMode eCullMode;
-
- // PointSize, LineWidth
- double fPointSize;
- double fLineWidth;
-
- // Scissor Region
- Rectangle aScissorRectangle;
-
- // Texture store
- B3dTexture* pActiveTexture;
-
- // Aktuelles TransformationSet
- B3dTransformationSet* pTransformationSet;
-
- // Aktuelle Beleuchtung
- B3dLightGroup* pLightGroup;
-
- // Materialien
- B3dMaterial aMaterialFront;
- B3dMaterial aMaterialBack;
-
- // Darstellungsqualitaet (0..255)
- UINT8 nDisplayQuality;
-
- // #i71618#
- double mfPolygonOffset;
-
- // EdgeFlag
- unsigned bEdgeFlag : 1;
-
- // Gueltigkeit des Kontextes, wird in
- // den Konstruktoren gesetzt
- unsigned bContextIsValid : 1;
-
- // Variablen fuer PolygonOffset
- unsigned bPolyOffsetFill : 1;
- unsigned bPolyOffsetLine : 1;
- unsigned bPolyOffsetPoint : 1;
-
- // Scissor-Region gesetzt?
- unsigned bScissorRegionActive : 1;
-
- // Dithern?
- unsigned bDitherActive : 1;
-
- // Hint auf transparente Anteile in der Szene
- unsigned bTransparentParts : 1;
-
- // FlatMode force switch
- unsigned bForceFlat : 1;
-
-protected:
- // Konstruktor, Destruktor
- Base3D(OutputDevice* pOutDev);
- virtual ~Base3D();
-
- // setze das ContextIsValid - Flag
- void SetContextIsValid(BOOL bNew=TRUE)
- { bContextIsValid=bNew; }
-
- static Base3D* CreateScreenRenderer(OutputDevice* pDev);
-
-public:
- // Typbestimmung
- virtual UINT16 GetBase3DType()=0;
-
- // Zugriff auf das zu verwendende OutputDevice
- OutputDevice* GetOutputDevice() const { return pDevice; }
-
- // Hint auf transparente Anteile in der Szene setzen/lesen
- void SetTransparentPartsContainedHint(BOOL bNew) { bTransparentParts = bNew; }
- BOOL GetTransparentPartsContainedHint() const { return bTransparentParts; }
-
- // Zugriff auf globale Daten von allen Base3D's
-private:
- B3dGlobalData& GetGlobalData();
-public:
-
- // Erzeugen bzw. Zerstoeren eines Base3D Kontextes
- static Base3D* Create(OutputDevice* pOutDev, BOOL bForcePrinter=FALSE);
- virtual void Destroy(OutputDevice *pOutDev);
-
- // Gueltigkeit des Kontextes nach der Inkarnation
- // ueberpruefen
- BOOL IsContextValid()
- { return bContextIsValid; }
-#ifdef DBG_UTIL
- void SetContextValid(BOOL bNew=TRUE) { bContextIsValid = bNew; }
-#endif
-
- // TransformationSet setzen/lesen
- virtual void SetTransformationSet(B3dTransformationSet* pSet);
- B3dTransformationSet* GetTransformationSet() { return pTransformationSet; }
-
- // Beleuchtung setzen/lesen
- virtual void SetLightGroup(B3dLightGroup* pSet, BOOL bSetGlobal=TRUE);
- B3dLightGroup* GetLightGroup() { return pLightGroup; }
-
- // Szenenverwaltung
- virtual void StartScene() = 0;
- virtual void EndScene() = 0;
-
- // Scissoring
- virtual void SetScissorRegionPixel(const Rectangle& rRect, BOOL bActivate=TRUE);
- void SetScissorRegion(const Rectangle& rRect, BOOL bActivate=TRUE);
- virtual void ActivateScissorRegion(BOOL bNew);
- BOOL IsScissorRegionActive() { return bScissorRegionActive; }
- const Rectangle& GetScissorRegionPixel() { return aScissorRectangle; }
-
- // Dithering aktiv?
- BOOL GetDither() const { return bDitherActive; }
- virtual void SetDither(BOOL bNew);
-
- // Dithering aktiv?
- BOOL GetForceFlat() const { return bForceFlat; }
- void SetForceFlat(BOOL bNew) { bForceFlat = bNew; }
-
- // Attribute Color (und Alpha)
- virtual void SetColor(Color aNew);
- virtual Color GetColor();
-
- // Materials
- virtual void SetMaterial(Color aNew,
- Base3DMaterialValue=Base3DMaterialAmbient,
- Base3DMaterialMode=Base3DMaterialFrontAndBack);
- Color GetMaterial(Base3DMaterialValue=Base3DMaterialAmbient,
- Base3DMaterialMode=Base3DMaterialFrontAndBack) const;
- virtual void SetShininess(UINT16 nExponent,
- Base3DMaterialMode=Base3DMaterialFrontAndBack);
- UINT16 GetShininess(Base3DMaterialMode=Base3DMaterialFrontAndBack) const;
- void ResetMaterial(Base3DMaterialMode=Base3DMaterialFrontAndBack);
-
- // Texturen
- B3dTexture* ObtainTexture(TextureAttributes& rAtt);
- B3dTexture* ObtainTexture(TextureAttributes& rAtt, BitmapEx& rBitmapEx);
- void DeleteTexture(TextureAttributes& rAtt);
- void DeleteAllTextures();
-private:
- virtual B3dTexture* CreateTexture(TextureAttributes& rAtt, BitmapEx& rBitmapEx);
-protected:
- virtual void DestroyTexture(B3dTexture*);
-public:
- virtual void SetActiveTexture(B3dTexture* pTex=NULL);
- B3dTexture* GetActiveTexture() { return pActiveTexture; }
- BOOL IsTextureActive() const { return (pActiveTexture != NULL) ? TRUE : FALSE; }
-
- // Darstellungsqualitaet
- virtual void SetDisplayQuality(UINT8 nNew);
- UINT8 GetDisplayQuality() const;
-
- // PolygonOffset
- virtual void SetPolygonOffset(
- Base3DPolygonOffset eNew=Base3DPolygonOffsetLine, BOOL bNew=FALSE);
- BOOL GetPolygonOffset(Base3DPolygonOffset eNew=Base3DPolygonOffsetLine) const;
-
- // #i71618#
- // support for value for PolygonOffset. Value is relative to Z-Buffer depth. To keep
- // it implementation-independent, it is a value in the range [0.0 .. 1.0]. Default
- // is now 0,005 which expands to ca. 80.000 with 14bit Z-Buffer
- void setPolygonOffset(double fNew);
- double getPolygonOffset() const;
-
- // RenderMode
- virtual void SetRenderMode(Base3DRenderMode eNew,
- Base3DMaterialMode=Base3DMaterialFrontAndBack);
- Base3DRenderMode GetRenderMode(
- Base3DMaterialMode=Base3DMaterialFrontAndBack) const;
-
- // ShadeModel
- virtual void SetShadeModel(Base3DShadeModel eNew);
- Base3DShadeModel GetShadeModel() const;
-
- // CullingMode
- virtual void SetCullMode(Base3DCullMode eNew);
- Base3DCullMode GetCullMode() const;
-
- // EdgeFlagMode
- BOOL GetEdgeFlag() const;
- virtual void SetEdgeFlag(BOOL bNew=TRUE);
-
- // PointSize, LineWidth
- double GetPointSize() const;
- virtual void SetPointSize(double fNew=1.0);
- double GetLineWidth() const;
- virtual void SetLineWidth(double fNew=1.0);
-
- // geometrische Objekte hinzufuegen
- // Modus setzen
- Base3DObjectMode GetObjectMode() const;
-
- // geometrische Daten
- void AddVertex(basegfx::B3DPoint& rVertex);
- void AddVertex(basegfx::B3DPoint& rVertex, basegfx::B3DVector& rNormal);
- void AddVertex(basegfx::B3DPoint& rVertex, basegfx::B3DVector& rNormal, basegfx::B2DPoint& rTexPos);
- void AddVertex(B3dEntity& rEnt);
- void PostAddVertex(B3dEntity& rEnt);
-
- // Geometrische Daten uebergeben
- virtual B3dEntity& GetFreeEntity();
-
- // Primitiv beginnen/abschliessen
- void StartPrimitive(Base3DObjectMode eMode);
- void EndPrimitive();
-
- // Ein Objekt in Form einer B3dGeometry direkt ausgeben
- virtual void DrawPolygonGeometry(const B3dGeometry& rGeometry, sal_Bool bOutline=FALSE);
-
-#ifdef DBG_UTIL
- // Testfunktion um gezielte 3D-Ausgaben zu testen
- void Test(const Rectangle& rBound, const Rectangle& rVisible);
-#endif
-
-protected:
- // geometrische Daten uebergeben
- virtual void ImplPostAddVertex(B3dEntity& rEnt) = 0;
-
- // Direkter Zugriff auf B3dMaterial
- // fuer abgeleitete Klassen
- B3dMaterial& GetMaterialObject(Base3DMaterialMode=Base3DMaterialFront);
-
- // Primitiv beginnen/abschliessen
- virtual void ImplStartPrimitive() = 0;
- virtual void ImplEndPrimitive() = 0;
-
- // Geometrische Daten uebergeben
- virtual B3dEntity& ImplGetFreeEntity() = 0;
-
- // Funktionen, um mit hoeheren Primitiven umzugehen
- void HandleComplexPolygon();
-};
-
-#endif // _B3D_BASE3D_HXX
diff --git a/goodies/inc/goodies/bucket.hxx b/goodies/inc/goodies/bucket.hxx
deleted file mode 100644
index 93b58ca92e9d..000000000000
--- a/goodies/inc/goodies/bucket.hxx
+++ /dev/null
@@ -1,197 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: bucket.hxx,v $
- * $Revision: 1.3.38.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_BUCKET_HXX
-#define _B3D_BUCKET_HXX
-
-#include <svtools/svarray.hxx>
-
-/*************************************************************************
-|*
-|* Bucket deklarator
-|*
-\************************************************************************/
-
-#define BASE3D_DECL_BUCKET(TheClassName,TheExtension) \
- SV_DECL_VARARR(TheClassName##TheExtension##MemArr, char*, 32, 32) \
- class TheClassName##TheExtension { \
- private: \
- TheClassName##TheExtension##MemArr aMemArray; \
- UINT32 nMask; \
- UINT32 nCount; \
- INT16 nFreeMemArray; \
- INT16 nActMemArray; \
- UINT16 nFreeEntry; \
- UINT16 nShift; \
- UINT16 nBlockShift; \
- UINT16 nEntriesPerArray; \
- UINT16 nSlotSize; \
- UINT16 nNext; \
- UINT16 nMemArray; \
- public: \
- TheClassName##TheExtension(UINT16 TheSize); \
- /* Notwendiger Leer-Konstruktor, benutzt default-Groesse 8 */ \
- TheClassName##TheExtension(); \
- /* Zu verwendende Groesse der Speicherarrays setzen */ \
- /* Bitte NUR verwenden, falls sich der Leerkonstruktor */ \
- /* nicht vermeiden laesst! Nicht nachtraeglich anwenden! */ \
- void InitializeSize(UINT16 TheSize); \
- /* Destruktor */ \
- ~TheClassName##TheExtension(); \
- /* Anhaengen und kopieren */ \
- BOOL Append(TheClassName& rVec) \
- { if(CareForSpace()) return ImplAppend(rVec); return FALSE; } \
- /* nur neuen Eintrag anhaengen, ohne ausfuellen */ \
- BOOL Append() \
- { if(CareForSpace()) return ImplAppend(); return FALSE; } \
- /* Letzten Eintrag entfernen */ \
- BOOL Remove() { if(nCount) return ImplRemove(); return FALSE; } \
- /* leeren und Speicher freigeben */ \
- void Empty(); \
- /* leeren aber Speicher behalten */ \
- void Erase(); \
- TheClassName& operator[] (UINT32 nPos); \
- const TheClassName& operator[] (UINT32 nPos) const; \
- UINT32 Count() const { return nCount; } \
- UINT32 GetNumAllocated() const { return aMemArray.Count() * nEntriesPerArray; } \
- void operator=(const TheClassName##TheExtension&); \
- UINT16 GetBlockShift() const { return nBlockShift; } \
- UINT16 GetSlotSize() const { return nSlotSize; } \
- private: \
- BOOL CareForSpace() \
- { if(nFreeEntry == nEntriesPerArray) \
- return ImplCareForSpace(); return TRUE; } \
- BOOL ImplCareForSpace(); \
- /* Anhaengen und kopieren */ \
- BOOL ImplAppend(TheClassName& rVec); \
- /* nur neuen Eintrag anhaengen, ohne ausfuellen */ \
- BOOL ImplAppend(); \
- BOOL ImplRemove(); \
- };
-
-/*************************************************************************
-|*
-|* Bucket implementor
-|*
-\************************************************************************/
-
-#define BASE3D_IMPL_BUCKET(TheClassName,TheExtension) \
- SV_IMPL_VARARR(TheClassName##TheExtension##MemArr, char*) \
- TheClassName##TheExtension::TheClassName##TheExtension(UINT16 TheSize) { \
- InitializeSize(TheSize); \
- } \
- TheClassName##TheExtension::TheClassName##TheExtension() { \
- InitializeSize(8); \
- } \
- void TheClassName##TheExtension::InitializeSize(UINT16 TheSize) { \
- UINT16 nSiz; \
- for(nShift=0,nSiz=1;nSiz<sizeof(TheClassName);nSiz<<=1,nShift++) ; \
- nBlockShift = TheSize - nShift; \
- nMask = (1L << nBlockShift)-1L; \
- nSlotSize = 1<<nShift; \
- nEntriesPerArray = (UINT16)((1L << TheSize) >> nShift); \
- Empty(); \
- } \
- void TheClassName##TheExtension::operator=(const TheClassName##TheExtension& rObj) { \
- Erase(); \
- TheClassName##TheExtension& rSrc = (TheClassName##TheExtension&)rObj; \
- for(UINT32 a=0;a<rSrc.Count();a++) \
- Append(rSrc[a]); \
- } \
- void TheClassName##TheExtension::Empty() { \
- for(UINT16 i=0;i<aMemArray.Count();i++) \
- /*#90353#*/ delete [] aMemArray[i]; \
- if(aMemArray.Count()) \
- aMemArray.Remove(0, aMemArray.Count()); \
- nFreeMemArray = 0; \
- nActMemArray = -1; \
- Erase(); \
- } \
- void TheClassName##TheExtension::Erase() { \
- nFreeEntry = nEntriesPerArray; \
- nCount = 0; \
- nActMemArray = -1; \
- } \
- TheClassName##TheExtension::~TheClassName##TheExtension() { \
- Empty(); \
- } \
- BOOL TheClassName##TheExtension::ImplAppend(TheClassName& rVec) { \
- *((TheClassName*)(aMemArray[nActMemArray] + (nFreeEntry++ << nShift))) = rVec; \
- nCount++; \
- return TRUE; \
- } \
- BOOL TheClassName##TheExtension::ImplAppend() { \
- nFreeEntry++; \
- nCount++; \
- return TRUE; \
- } \
- BOOL TheClassName##TheExtension::ImplRemove() { \
- if(nFreeEntry == 1) { \
- nFreeEntry = nEntriesPerArray + 1; \
- if(nActMemArray == -1) \
- return FALSE; \
- nActMemArray--; \
- } \
- nFreeEntry--; \
- nCount--; \
- return TRUE; \
- } \
- BOOL TheClassName##TheExtension::ImplCareForSpace() { \
- /* neues array bestimmem */ \
- if(nActMemArray + 1 < nFreeMemArray) { \
- /* ist scon allokiert, gehe auf naechstes */ \
- nActMemArray++; \
- } else { \
- /* neues muss allokiert werden */ \
- char* pNew = new char[nEntriesPerArray << nShift]; \
- if(!pNew) \
- return FALSE; \
- aMemArray.Insert((const char*&) pNew, aMemArray.Count()); \
- nActMemArray = nFreeMemArray++; \
- } \
- nFreeEntry = 0; \
- return TRUE; \
- } \
- TheClassName& TheClassName##TheExtension::operator[] (UINT32 nPos) { \
- if(nPos >= nCount) { \
- DBG_ERROR("Access to Bucket out of range!"); \
- return *((TheClassName*)aMemArray[0]); \
- } \
- return *((TheClassName*)(aMemArray[(UINT16)(nPos >> nBlockShift)] + ((nPos & nMask) << nShift))); \
- } \
- const TheClassName& TheClassName##TheExtension::operator[] (UINT32 nPos) const { \
- if(nPos >= nCount) { \
- DBG_ERROR("Access to Bucket out of range!"); \
- return *((TheClassName*)aMemArray[0]); \
- } \
- return *((TheClassName*)(aMemArray[(UINT16)(nPos >> nBlockShift)] + ((nPos & nMask) << nShift))); \
- }
-
-#endif // _B3D_BUCKET_HXX
diff --git a/goodies/inc/goodies/bxdintpo.hxx b/goodies/inc/goodies/bxdintpo.hxx
deleted file mode 100644
index 478fb4ca3053..000000000000
--- a/goodies/inc/goodies/bxdintpo.hxx
+++ /dev/null
@@ -1,177 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: bxdintpo.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _BXD_INTERPOLATOR_HXX
-#define _BXD_INTERPOLATOR_HXX
-
-#include <tools/solar.h>
-#include <tools/color.hxx>
-#include <basegfx/vector/b3dvector.hxx>
-
-/*************************************************************************
-|*
-|* Standard-Interpolierer
-|*
-\************************************************************************/
-
-class BxdInterpolator
-{
-private:
- double fPos;
- double fInc;
-
-public:
- BxdInterpolator(long nS, long nE, long nSteps)
- : fPos(nSteps ? ((double)nS) + 0.5 : ((double)nE) + 0.5),
- fInc((double)(nE - nS)/(double)(nSteps == 0 ? 1 : nSteps)) {}
-
- BxdInterpolator(UINT8 nS, UINT8 nE, long nSteps)
- : fPos(nSteps ? ((double)nS) + 0.5 : ((double)nE) + 0.5),
- fInc((double)(nE - nS)/(double)(nSteps == 0 ? 1 : nSteps)) {}
-
- BxdInterpolator(double fS, double fE, long nSteps)
- : fPos(nSteps ? fS : fE),
- fInc((fE - fS)/(double)(nSteps == 0 ? 1 : nSteps)) {}
-
- BxdInterpolator() {}
-
- void Increment() { fPos += fInc; }
-
- void Load(long nS, long nE, long nSteps)
- {
- fPos = (nSteps) ? ((double)nS) + 0.5 : ((double)nE) + 0.5;
- fInc = (double)(nE - nS)/(double)(nSteps == 0 ? 1 : nSteps);
- }
-
- void Load(UINT8 nS, UINT8 nE, long nSteps)
- {
- fPos = (nSteps) ? ((double)nS) + 0.5 : ((double)nE) + 0.5;
- fInc = (double)(nE - nS)/(double)(nSteps == 0 ? 1 : nSteps);
- }
-
- void Load(double fS, double fE, long nSteps)
- {
- fPos = (nSteps) ? fS : fE;
- fInc = (fE - fS)/(double)(nSteps == 0 ? 1 : nSteps);
- }
-
- long GetLongValue() { return (long)fPos; }
- UINT32 GetUINT32Value() { return (UINT32)fPos; }
- UINT8 GetUINT8Value() { return (UINT8)fPos; }
- double GetDoubleValue() { return fPos; }
- double GetStepSize() { return fInc; }
-};
-
-/*************************************************************************
-|*
-|* Interpolierer fuer Color
-|*
-\************************************************************************/
-
-class BxdColorInterpolator
-{
-private:
- BxdInterpolator aRed;
- BxdInterpolator aGreen;
- BxdInterpolator aBlue;
- UINT8 nTransparency;
-
-public:
- BxdColorInterpolator(Color aS, Color aE, long nSteps)
- : aRed(aS.GetRed(), aE.GetRed(), nSteps),
- aGreen(aS.GetGreen(), aE.GetGreen(), nSteps),
- aBlue(aS.GetBlue(), aE.GetBlue(), nSteps),
- nTransparency(aS.GetTransparency()) {}
-
- BxdColorInterpolator() {}
-
- void Increment()
- {
- aRed.Increment();
- aGreen.Increment();
- aBlue.Increment();
- }
-
- void Load(Color aS, Color aE, long nSteps)
- {
- aRed.Load(aS.GetRed(), aE.GetRed(), nSteps);
- aGreen.Load(aS.GetGreen(), aE.GetGreen(), nSteps);
- aBlue.Load(aS.GetBlue(), aE.GetBlue(), nSteps);
- nTransparency = aS.GetTransparency();
- }
-
- Color GetColorValue()
- {
- return Color(nTransparency,
- aRed.GetUINT8Value(),
- aGreen.GetUINT8Value(),
- aBlue.GetUINT8Value());
- }
-};
-
-/*************************************************************************
-|*
-|* Interpolierer fuer Vector3D
-|*
-\************************************************************************/
-
-class B3dVectorInterpolator
-{
-private:
- BxdInterpolator aX;
- BxdInterpolator aY;
- BxdInterpolator aZ;
-
-public:
- B3dVectorInterpolator(basegfx::B3DVector& rS, basegfx::B3DVector& rE, long nSteps)
- : aX(rS.getX(), rE.getX(), nSteps),
- aY(rS.getY(), rE.getY(), nSteps),
- aZ(rS.getZ(), rE.getZ(), nSteps) {}
-
- B3dVectorInterpolator() {}
-
- void Increment() { aX.Increment(); aY.Increment(); aZ.Increment(); }
-
- void Load(basegfx::B3DVector& rS, basegfx::B3DVector& rE, long nSteps)
- {
- aX.Load(rS.getX(), rE.getX(), nSteps);
- aY.Load(rS.getY(), rE.getY(), nSteps);
- aZ.Load(rS.getZ(), rE.getZ(), nSteps);
- }
-
- void GetVector3DValue(basegfx::B3DVector& rVec)
- {
- rVec.setX(aX.GetDoubleValue());
- rVec.setY(aY.GetDoubleValue());
- rVec.setZ(aZ.GetDoubleValue());
- }
-};
-
-#endif // _BXD_INTERPOLATOR_HXX
diff --git a/goodies/inc/goodies/matril3d.hxx b/goodies/inc/goodies/matril3d.hxx
deleted file mode 100644
index 7584f54973f9..000000000000
--- a/goodies/inc/goodies/matril3d.hxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: matril3d.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_MATRIL3D_HXX
-#define _B3D_MATRIL3D_HXX
-
-#include <goodies/bucket.hxx>
-#include <tools/color.hxx>
-#include <tools/stream.hxx>
-
-/*************************************************************************
-|*
-|* Moegliche MaterialModes fuer Polygone
-|*
-\************************************************************************/
-
-enum Base3DMaterialMode
-{
- Base3DMaterialFront = 0,
- Base3DMaterialBack,
- Base3DMaterialFrontAndBack
-};
-
-/*************************************************************************
-|*
-|* Moegliche MaterialValues fuer Polygone
-|*
-\************************************************************************/
-
-enum Base3DMaterialValue
-{
- Base3DMaterialAmbient = 0,
- Base3DMaterialDiffuse,
- Base3DMaterialSpecular,
- Base3DMaterialEmission
-};
-
-/*************************************************************************
-|*
-|* Basisklasse fuer Materialparameter
-|*
-\************************************************************************/
-
-class B3dMaterial
-{
-private:
- Color aAmbient;
- Color aDiffuse;
- Color aSpecular;
- Color aEmission;
- UINT16 nExponent;
-
-public:
- B3dMaterial();
-
- // Zugriffsfunktionen
- void SetMaterial(Color rNew,
- Base3DMaterialValue=Base3DMaterialAmbient);
- Color GetMaterial(Base3DMaterialValue=Base3DMaterialAmbient) const;
- void SetShininess(UINT16 nNew);
- UINT16 GetShininess() const;
-
- // Vergleichsoperator
- BOOL operator==(const B3dMaterial&);
- BOOL operator!=(const B3dMaterial& rMat) { return (!((*this) == rMat)); }
-protected:
-};
-
-/*************************************************************************
-|*
-|* Bucket fuer Materialeigenschaften
-|*
-\************************************************************************/
-
-BASE3D_DECL_BUCKET(B3dMaterial, Bucket)
-
-#endif // _B3D_MATRIL3D_HXX
diff --git a/goodies/inc/pch/precompiled_goodies.hxx b/goodies/inc/pch/precompiled_goodies.hxx
index 6c4751027c68..5ac2273e1e17 100644
--- a/goodies/inc/pch/precompiled_goodies.hxx
+++ b/goodies/inc/pch/precompiled_goodies.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: precompiled_goodies.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.42.1 $
*
* This file is part of OpenOffice.org.
*
@@ -158,9 +158,7 @@
#include "vcl/lstbox.hxx"
#include "vcl/metric.hxx"
#include "vcl/msgbox.hxx"
-#include "vcl/opengl.hxx"
#include "vcl/outdev.hxx"
-#include "vcl/outdev3d.hxx"
#include "vcl/region.hxx"
#include "vcl/salbtype.hxx"
#include "vcl/sv.h"
diff --git a/goodies/inc/vector3d.hxx b/goodies/inc/vector3d.hxx
deleted file mode 100644
index 5a5934f5283e..000000000000
--- a/goodies/inc/vector3d.hxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: vector3d.hxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVX_VECTOR3D_HXX
-#define _SVX_VECTOR3D_HXX
-
-#include <tools/solar.h>
-
-#include <math.h>
-#include <vector>
-
-class Point;
-class SvStream;
-
-/*************************************************************************
-|*
-|* 3D-Vektor
-|*
-\************************************************************************/
-
-class Vector3D
-{
- protected:
- double V[3];
-
- public:
- Vector3D(double fX = 0, double fY = 0, double fZ = 0)
- { V[0] = fX; V[1] = fY; V[2] = fZ; }
- Vector3D(const Point& rPnt, double fZ = 0);
- const double& X() const { return V[0]; }
- const double& Y() const { return V[1]; }
- const double& Z() const { return V[2]; }
- double& X() { return V[0]; }
- double& Y() { return V[1]; }
- double& Z() { return V[2]; }
- const double& operator[] (int nPos) const { return V[nPos]; }
- double& operator[] (int nPos) { return V[nPos]; }
-
- double GetLength(void) const;
- double GetXYLength(void) const;
- double GetXZLength(void) const;
- double GetYZLength(void) const;
-
- void Normalize();
- void Min(const Vector3D& rVec);
- void Max(const Vector3D& rVec);
- void Abs();
-
- void CalcInBetween(const Vector3D& rOld1, const Vector3D& rOld2, double t);
- void CalcMiddle(const Vector3D& rOld1, const Vector3D& rOld2);
- void CalcMiddle(const Vector3D& rOld1, const Vector3D& rOld2, Vector3D& rOld3);
-
- Vector3D GetPerpendicular2D() const;
- Vector3D GetPerpendicular(const Vector3D& rNormalizedVec) const;
- Vector3D GetProjectionOnPlane(const Vector3D& rNormalizedPlane) const;
-
- Vector3D& operator+= (const Vector3D&);
- Vector3D& operator-= (const Vector3D&);
- Vector3D operator+ (const Vector3D&) const;
- Vector3D operator- (const Vector3D&) const;
- Vector3D operator- (void) const;
-
- // Kreuzprodukt mittels operator| (wie: Senkrecht)
- Vector3D& operator|= (const Vector3D&);
- Vector3D operator| (const Vector3D&) const;
-
- // Skalarprodukt als Methode, um Verwechslungen zu vermeiden
- double Scalar(const Vector3D&) const;
-
- Vector3D& operator/= (const Vector3D&);
- Vector3D operator/ (const Vector3D&) const;
- Vector3D& operator*= (const Vector3D&);
- Vector3D operator* (const Vector3D&) const;
-
- Vector3D& operator*= (double);
- Vector3D operator* (double) const;
- Vector3D& operator/= (double);
- Vector3D operator/ (double) const;
-
- BOOL operator== (const Vector3D&) const;
- BOOL operator!= (const Vector3D&) const;
-
- friend SvStream& operator>>(SvStream& rIStream, Vector3D&);
- friend SvStream& operator<<(SvStream& rOStream, const Vector3D&);
-};
-
-// #110988# typedefs for a vector of Vector3Ds
-typedef ::std::vector< Vector3D > Vector3DVector;
-
-#endif // _SVX_VECTOR3D_HXX
diff --git a/goodies/prj/d.lst b/goodies/prj/d.lst
index a965fc554f88..f30ca516b5da 100644
--- a/goodies/prj/d.lst
+++ b/goodies/prj/d.lst
@@ -78,16 +78,5 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid
mkdir: %_DEST%\inc%_EXT%\goodies
..\inc\grfmgr.hxx %_DEST%\inc%_EXT%\goodies\grfmgr.hxx
..\inc\mailenum.hxx %_DEST%\inc%_EXT%\goodies\mailenum.hxx
-..\inc\goodies\base3d.hxx %_DEST%\inc%_EXT%\goodies\base3d.hxx
-..\inc\goodies\b3dlight.hxx %_DEST%\inc%_EXT%\goodies\b3dlight.hxx
-..\inc\goodies\matril3d.hxx %_DEST%\inc%_EXT%\goodies\matril3d.hxx
-..\inc\goodies\bucket.hxx %_DEST%\inc%_EXT%\goodies\bucket.hxx
-..\inc\goodies\b3dentty.hxx %_DEST%\inc%_EXT%\goodies\b3dentty.hxx
-..\inc\goodies\b3dcolor.hxx %_DEST%\inc%_EXT%\goodies\b3dcolor.hxx
-..\inc\goodies\b3dcompo.hxx %_DEST%\inc%_EXT%\goodies\b3dcompo.hxx
-..\inc\b3dtex.hxx %_DEST%\inc%_EXT%\goodies\b3dtex.hxx
-..\inc\goodies\b3dgeom.hxx %_DEST%\inc%_EXT%\goodies\b3dgeom.hxx
..\inc\b3dtrans.hxx %_DEST%\inc%_EXT%\goodies\b3dtrans.hxx
-..\inc\goodies\bxdintpo.hxx %_DEST%\inc%_EXT%\goodies\bxdintpo.hxx
..\inc\agsdkdll.hxx %_DEST%\inc%_EXT%\goodies\agsdkdll.hxx
-..\inc\goodies\vdevcache.hxx %_DEST%\inc%_EXT%\goodies\vdevcache.hxx
diff --git a/goodies/source/base3d/b3dcolor.cxx b/goodies/source/base3d/b3dcolor.cxx
deleted file mode 100644
index 142964a1119a..000000000000
--- a/goodies/source/base3d/b3dcolor.cxx
+++ /dev/null
@@ -1,333 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dcolor.cxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#ifndef GCC
-#endif
-#include <goodies/b3dcolor.hxx>
-
-/*************************************************************************
-|*
-|* Farbwert interpolieren
-|*
-\************************************************************************/
-
-void B3dColor::CalcInBetween(Color& rOld1, Color& rOld2, double t)
-{
- if(rOld1 != rOld2)
- {
- UINT16 nFac = (UINT16)(t * 256.0);
- UINT16 nNegFac = 256 - nFac;
- SetRed((UINT8)(((nFac * (UINT16)rOld2.GetRed())
- + (nNegFac * (UINT16)rOld1.GetRed())) >> 8));
- SetGreen((UINT8)(((nFac * (UINT16)rOld2.GetGreen())
- + (nNegFac * (UINT16)rOld1.GetGreen())) >> 8));
- SetBlue((UINT8)(((nFac * (UINT16)rOld2.GetBlue())
- + (nNegFac * (UINT16)rOld1.GetBlue())) >> 8));
- SetTransparency((UINT8)(((nFac * (UINT16)rOld2.GetTransparency())
- + (nNegFac * (UINT16)rOld1.GetTransparency())) >> 8));
- }
- else
- {
- SetColor(rOld1.GetColor());
- }
-}
-
-/*************************************************************************
-|*
-|* Farbwert Mittelwert finden mit 2 Farben
-|*
-\************************************************************************/
-
-void B3dColor::CalcMiddle(Color& rOld1, Color& rOld2)
-{
- if(rOld1 != rOld2)
- {
- SetRed((UINT8)(((UINT16)rOld1.GetRed()
- + (UINT16)rOld2.GetRed())>>1));
- SetGreen((UINT8)(((UINT16)rOld1.GetGreen()
- + (UINT16)rOld2.GetGreen())>>1));
- SetBlue((UINT8)(((UINT16)rOld1.GetBlue()
- + (UINT16)rOld2.GetBlue())>>1));
- SetTransparency((UINT8)(((UINT16)rOld1.GetTransparency()
- + (UINT16)rOld2.GetTransparency())>>1));
- }
- else
- {
- SetColor(rOld1.GetColor());
- }
-}
-
-/*************************************************************************
-|*
-|* Farbwert Mittelwert finden mit 3 Farben
-|*
-\************************************************************************/
-
-void B3dColor::CalcMiddle(Color& rOld1, Color& rOld2, Color& rOld3)
-{
- if(rOld1 != rOld2)
- {
- if(rOld1 != rOld3)
- {
- // alle 3 unterschiedlich
- SetRed((UINT8)(((UINT16)rOld1.GetRed()
- + (UINT16)rOld2.GetRed()
- + (UINT16)rOld3.GetRed()) / 3L));
- SetGreen((UINT8)(((UINT16)rOld1.GetGreen()
- + (UINT16)rOld2.GetGreen()
- + (UINT16)rOld3.GetGreen()) / 3L));
- SetBlue((UINT8)(((UINT16)rOld1.GetBlue()
- + (UINT16)rOld2.GetBlue()
- + (UINT16)rOld3.GetBlue()) / 3L));
- SetTransparency((UINT8)(((UINT16)rOld1.GetTransparency()
- + (UINT16)rOld2.GetTransparency()
- + (UINT16)rOld3.GetTransparency()) / 3L));
- }
- else
- {
- // 1 != 2, 1 == 3
- CalcMiddle(rOld1, rOld2);
- }
- }
- else
- {
- // 1 == 2
- if(rOld1 != rOld3)
- {
- CalcMiddle(rOld1, rOld3);
- }
- else
- {
- // 1==2, 1==3 -> alle gleich
- SetColor(rOld1.GetColor());
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Ermittle den Abstand der beiden Farben im Farbraum
-|* Dies geschieht OHNE Wurzelziehen, d.h. es wird als Metrik im RGB
-|* Farbraum hier das Quadrat der 'echten' (gewohnten) Entfernung benutzt
-|*
-\************************************************************************/
-
-ULONG B3dColor::GetDistance(Color& rOld)
-{
- // Bei Gleichheit kein Abstand
- if(*this == rOld)
- return 0L;
-
- // Abstand ermitteln
- long nDistRed = rOld.GetRed() > GetRed() ?
- rOld.GetRed() - GetRed() :
- GetRed() - rOld.GetRed();
- long nDistGreen = rOld.GetGreen() > GetGreen() ?
- rOld.GetGreen() - GetGreen() :
- GetGreen() - rOld.GetGreen();
- long nDistBlue = rOld.GetBlue() > GetBlue() ?
- rOld.GetBlue() - GetBlue() :
- GetBlue() - rOld.GetBlue();
- return (ULONG)(nDistRed * nDistRed
- + nDistGreen * nDistGreen
- + nDistBlue * nDistBlue);
-}
-
-/*************************************************************************
-|*
-|* Farbaddition mit clamping
-|*
-\************************************************************************/
-
-B3dColor& B3dColor::operator+= (const B3dColor& rCol)
-{
- UINT16 nZwi;
- if(rCol.GetRed())
- {
- nZwi = (UINT16)GetRed() + (UINT16)rCol.GetRed();
- if(nZwi > 255)
- nZwi = 255;
- SetRed((UINT8)nZwi);
- }
- if(rCol.GetGreen())
- {
- nZwi = (UINT16)GetGreen() + (UINT16)rCol.GetGreen();
- if(nZwi > 255)
- nZwi = 255;
- SetGreen((UINT8)nZwi);
- }
- if(rCol.GetBlue())
- {
- nZwi = (UINT16)GetBlue() + (UINT16)rCol.GetBlue();
- if(nZwi > 255)
- nZwi = 255;
- SetBlue((UINT8)nZwi);
- }
- if(rCol.GetTransparency())
- {
- nZwi = (UINT16)GetTransparency() + (UINT16)rCol.GetTransparency();
- if(nZwi > 255)
- nZwi = 255;
- SetTransparency((UINT8)nZwi);
- }
- return *this;
-}
-
-/*************************************************************************
-|*
-|* Farbsubtraktion mit clamping
-|*
-\************************************************************************/
-
-B3dColor& B3dColor::operator-= (const B3dColor& rCol)
-{
- INT16 nZwi;
- if(rCol.GetRed())
- {
- nZwi = (INT16)GetRed() - (INT16)rCol.GetRed();
- if(nZwi < 0)
- nZwi = 0;
- SetRed((UINT8)nZwi);
- }
- if(rCol.GetGreen())
- {
- nZwi = (INT16)GetGreen() - (INT16)rCol.GetGreen();
- if(nZwi < 0)
- nZwi = 0;
- SetGreen((UINT8)nZwi);
- }
- if(rCol.GetBlue())
- {
- nZwi = (INT16)GetBlue() - (INT16)rCol.GetBlue();
- if(nZwi < 0)
- nZwi = 0;
- SetBlue((UINT8)nZwi);
- }
- if(rCol.GetTransparency())
- {
- nZwi = (INT16)GetTransparency() - (INT16)rCol.GetTransparency();
- if(nZwi < 0)
- nZwi = 0;
- SetTransparency((UINT8)nZwi);
- }
- return *this;
-}
-
-/*************************************************************************
-|*
-|* Farbaddition mit clamping, neue Farbe erzeugen
-|*
-\************************************************************************/
-
-B3dColor B3dColor::operator+ (const B3dColor& rCol) const
-{
- B3dColor aSum = *this;
- aSum += rCol;
- return aSum;
-}
-
-/*************************************************************************
-|*
-|* Farbsubtraktion mit clamping, neue Farbe erzeugen
-|*
-\************************************************************************/
-
-B3dColor B3dColor::operator- (const B3dColor& rCol) const
-{
- B3dColor aSub = *this;
- aSub -= rCol;
- return aSub;
-}
-
-/*************************************************************************
-|*
-|* Farbmultiplikation, d.h. Gewichtung der Farben aneinander
-|*
-\************************************************************************/
-
-B3dColor& B3dColor::operator*= (const B3dColor& rCol)
-{
- // urspruengliches Objekt ist die Farbe, rCol die zu berechnende
- // Gewichtung
- SetRed((UINT8)(((((UINT16)GetRed())+1)
- * (UINT16)rCol.GetRed()) >> 8));
- SetGreen((UINT8)(((((UINT16)GetGreen())+1)
- * (UINT16)rCol.GetGreen()) >> 8));
- SetBlue((UINT8)(((((UINT16)GetBlue())+1)
- * (UINT16)rCol.GetBlue()) >> 8));
- SetTransparency((UINT8)(((((UINT16)GetTransparency())+1)
- * (UINT16)rCol.GetTransparency()) >> 8));
- return *this;
-}
-
-/*************************************************************************
-|*
-|* Farbmultiplikation, neue Farbe erzeugen
-|*
-\************************************************************************/
-
-B3dColor B3dColor::operator* (const B3dColor& rCol) const
-{
- B3dColor aMul = *this;
- aMul *= rCol;
- return aMul;
-}
-
-/*************************************************************************
-|*
-|* Farbmultiplikation mit Faktor im Bereich [0.0 .. 1.0]
-|*
-\************************************************************************/
-
-B3dColor& B3dColor::operator*= (const double fVal)
-{
- ULONG nVal = (ULONG)(fVal * 65536.0);
- SetRed((UINT8)(((ULONG)GetRed() * nVal) >> 16));
- SetGreen((UINT8)(((ULONG)GetGreen() * nVal) >> 16));
- SetBlue((UINT8)(((ULONG)GetBlue() * nVal) >> 16));
- SetTransparency((UINT8)(((ULONG)GetTransparency() * nVal) >> 16));
- return *this;
-}
-
-/*************************************************************************
-|*
-|* Farbmultiplikation mit Faktor, neue Farbe erzeugen
-|*
-\************************************************************************/
-
-B3dColor B3dColor::operator* (const double fVal) const
-{
- B3dColor aMul = *this;
- aMul *= fVal;
- return aMul;
-}
-
diff --git a/goodies/source/base3d/b3dcommn.cxx b/goodies/source/base3d/b3dcommn.cxx
deleted file mode 100644
index 64bf5e127ec4..000000000000
--- a/goodies/source/base3d/b3dcommn.cxx
+++ /dev/null
@@ -1,1434 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dcommn.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#ifndef GCC
-#endif
-#include "b3dcommn.hxx"
-#include "b3dtrans.hxx"
-#include <tools/debug.hxx>
-#include <vcl/outdev.hxx>
-
-/*************************************************************************
-|*
-|* Bucket fuer Index
-|*
-\************************************************************************/
-
-BASE3D_IMPL_BUCKET(sal_uInt32, Bucket)
-
-/*************************************************************************
-|*
-|* Konstruktor Base3DCommon
-|*
-\************************************************************************/
-
-Base3DCommon::Base3DCommon(OutputDevice* pOutDev)
-: Base3D(pOutDev),
- aBuffers(12) // 4K
-{
-}
-
-/*************************************************************************
-|*
-|* Destruktor Base3DCommon
-|*
-\************************************************************************/
-
-Base3DCommon::~Base3DCommon()
-{
-}
-
-/*************************************************************************
-|*
-|* Start der Szenenbeschreibung:
-|*
-\************************************************************************/
-
-void Base3DCommon::StartScene()
-{
-}
-
-/*************************************************************************
-|*
-|* Ende der Szenenbeschreibung:
-|*
-\************************************************************************/
-
-void Base3DCommon::EndScene()
-{
-}
-
-/*************************************************************************
-|*
-|* Neuen freien Eintrag fuer naechste geometrische Daten liefern
-|*
-\************************************************************************/
-
-B3dEntity& Base3DCommon::ImplGetFreeEntity()
-{
- aBuffers.Append();
- return (aBuffers[aBuffers.Count() - 1]);
-}
-
-/*************************************************************************
-|*
-|* Beleuchtung setzen/lesen
-|*
-\************************************************************************/
-
-void Base3DCommon::SetLightGroup(B3dLightGroup* pSet, sal_Bool bSetGlobal)
-{
- // call parent
- Base3D::SetLightGroup(pSet, bSetGlobal);
-
- if(GetLightGroup())
- {
- basegfx::B3DHomMatrix aOldObjectTrans;
- basegfx::B3DHomMatrix aEmptyTrans;
-
- if(GetTransformationSet() && bSetGlobal)
- {
- aOldObjectTrans = GetTransformationSet()->GetObjectTrans();
- GetTransformationSet()->SetObjectTrans(aEmptyTrans);
- }
-
- for(sal_uInt16 i=0;i<BASE3D_MAX_NUMBER_LIGHTS;i++)
- {
- B3dLight& rLight = GetLightGroup()->GetLightObject((Base3DLightNumber)(Base3DLight0 + i));
-
- if(rLight.IsDirectionalSource())
- {
- basegfx::B3DPoint aPosition(rLight.GetPosition());
-
- if(GetTransformationSet())
- {
- aPosition = GetTransformationSet()->InvTransObjectToEye(aPosition);
- }
-
- rLight.SetPositionEye(aPosition);
- }
- else
- {
- basegfx::B3DPoint aPosition(rLight.GetPosition());
-
- if(GetTransformationSet())
- {
- aPosition = GetTransformationSet()->ObjectToEyeCoor(aPosition);
- }
-
- rLight.SetPositionEye(aPosition);
-
- basegfx::B3DVector aDirection(rLight.GetSpotDirection());
-
- if(GetTransformationSet())
- {
- aDirection = GetTransformationSet()->InvTransObjectToEye(aDirection);
- }
-
- aDirection.normalize();
- rLight.SetSpotDirectionEye(aDirection);
- }
- }
-
- if(GetTransformationSet() && bSetGlobal)
- {
- GetTransformationSet()->SetObjectTrans(aOldObjectTrans);
- }
- }
-}
-
-/*************************************************************************
-|*
-|* entsprechend der impliziten Topologie auf den neuen Punkt reagieren
-|*
-\************************************************************************/
-
-void Base3DCommon::ImplPostAddVertex(B3dEntity& rEntity)
-{
- B3dTransformationSet* pSet = GetTransformationSet();
- if(pSet)
- {
- // Positionen transformieren in ClippingCoordinates
- rEntity.Point() *= pSet->GetObjectToDevice();
-
- // Normalen transformieren in EyeCoordinates
- if((GetLightGroup() && GetLightGroup()->IsLightingEnabled()) && rEntity.IsNormalUsed())
- {
- if(GetForceFlat() || GetShadeModel() == Base3DFlat)
- {
- rEntity.Normal() = pSet->InvTransObjectToEye(rEntity.PlaneNormal());
- }
- else
- {
- rEntity.Normal() = pSet->InvTransObjectToEye(rEntity.Normal());
- }
- }
-
- // Texturkoordinaten transformieren anhand der Texturmatrix
- if(rEntity.IsTexCoorUsed())
- {
- rEntity.TexCoor() = pSet->TransTextureCoor(rEntity.TexCoor());
- }
- }
-
- // Aktuelle Farbe in diesen B3dEntity eintragen
- rEntity.Color() = GetColor();
-
- // Jetzt Topologie beachten und evtl. ein Primitiv ausspucken
- sal_uInt32 aCount = aBuffers.Count();
- switch(GetObjectMode())
- {
- case Base3DPoints:
- {
- Create3DPoint(0);
- aBuffers.Erase();
- break;
- }
- case Base3DLines:
- {
- if(aCount == 2)
- {
- Create3DLine(0, 1);
- aBuffers.Erase();
- }
- break;
- }
- case Base3DLineLoop:
- case Base3DLineStrip:
- {
- if(aCount > 1)
- Create3DLine(aCount - 2, aCount - 1);
- break;
- }
- case Base3DTriangles:
- {
- if(aCount == 3)
- {
- Create3DTriangle(0, 1, 2);
- aBuffers.Erase();
- }
- break;
- }
- case Base3DTriangleStrip:
- {
- if(aCount > 2)
- {
- if(aCount % 2)
- Create3DTriangle(aCount - 3, aCount - 2, aCount - 1);
- else
- Create3DTriangle(aCount - 2, aCount - 3, aCount - 1);
- }
- break;
- }
- case Base3DTriangleFan:
- {
- if(aCount > 2)
- Create3DTriangle(0, aCount - 2, aCount - 1);
- break;
- }
- case Base3DQuads:
- {
- if(aCount == 4)
- {
- // Spezielle Behandlung, da die inneren Kanten
- // eines Quads NICHT sichtbar sein sollen
- B3dEntity& rEnt2 = aBuffers[2];
- B3dEntity& rEnt0 = aBuffers[0];
-
- sal_Bool bZwi = rEnt2.IsEdgeVisible();
- rEnt2.SetEdgeVisible(sal_False);
- Create3DTriangle(0, 1, 2);
- rEnt2.SetEdgeVisible(bZwi);
-
- bZwi = rEnt0.IsEdgeVisible();
- rEnt0.SetEdgeVisible(sal_False);
- Create3DTriangle(0, 2, 3);
- rEnt0.SetEdgeVisible(bZwi);
-
- aBuffers.Erase();
- }
- break;
- }
- case Base3DQuadStrip:
- {
- if(aCount > 2)
- {
- B3dEntity& rEnt = aBuffers[aCount - 2];
- sal_Bool bZwi = rEnt.IsEdgeVisible();
- rEnt.SetEdgeVisible(sal_False);
- if(aCount % 2)
- Create3DTriangle(aCount - 2, aCount - 1, aCount - 3);
- else
- Create3DTriangle(aCount - 3, aCount - 1, aCount - 2);
- rEnt.SetEdgeVisible(bZwi);
- }
- break;
- }
- case Base3DPolygon:
- {
- if(aCount > 2)
- {
- B3dEntity& rEnt = aBuffers[aCount - 1];
- sal_Bool bZwi = rEnt.IsEdgeVisible();
- rEnt.SetEdgeVisible(sal_False);
- Create3DTriangle(0, aCount - 2, aCount - 1);
- rEnt.SetEdgeVisible(bZwi);
- // Ab jetzt nie wieder eine Kante vom 1. Punkt (0)
- // ausgehend generieren
- if(aCount == 3)
- aBuffers[0].SetEdgeVisible(sal_False);
- }
- break;
-
- }
- case Base3DComplexPolygon:
- case Base3DComplexPolygonCut:
- break; // -Wall not handled.
- }
-}
-
-/*************************************************************************
-|*
-|* Ein neues Primitiv, leere die jetzigen buffer
-|*
-\************************************************************************/
-
-void Base3DCommon::ImplStartPrimitive()
-{
- // Buffer leeren
- aBuffers.Erase();
-}
-
-/*************************************************************************
-|*
-|* Primitiv abgeschlossen
-|*
-\************************************************************************/
-
-void Base3DCommon::ImplEndPrimitive()
-{
- // Topologie beachten und evtl. ein Primitiv ausspucken
- sal_uInt32 aCount = aBuffers.Count();
- switch(GetObjectMode())
- {
- case Base3DLineLoop:
- {
- if(aCount > 2)
- Create3DLine(aCount - 1, 0);
- break;
- }
- case Base3DPolygon:
- {
- // Letzte schliessende Linie erzeugen, falls
- // es um das Erzeugen von Linien ging und
- // das letzte Primitiv auch wirklich zur Ausgabe
- // gelangt ist
- if(GetRenderMode() == Base3DRenderLine
- && !WasLastPrimitiveRejected())
- {
- if(aCount > 2)
- Create3DLine(aCount - 1, 0);
- }
- break;
- }
- default:
- break; // -Wall multiple values not handled.
- }
-}
-
-/*************************************************************************
-|*
-|* Funktion fuer Primitiv Punkt
-|* Clipping und Ausgabe, falls noch was ueber ist
-|*
-\************************************************************************/
-
-void Base3DCommon::Create3DPoint(sal_uInt32 nInd)
-{
- bLastPrimitiveRejected = sal_True;
- if(GetRenderMode() != Base3DRenderNone)
- {
- // Sicherstellen, dass die Koordinaten in
- // ClipCoordinates vorliegen
- aBuffers[nInd].To3DCoor(GetTransformationSet());
-
- // Punkt an Einheitswuerfel clippen
- if(Clip3DPoint(nInd))
- Create3DPointClipped(nInd);
- }
-}
-
-void Base3DCommon::Create3DPointClipped(sal_uInt32 nInd)
-{
- // einige Beleuchtungsdinge koennen hier schon geklaert
- // werden
- if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
- {
- B3dEntity& rEnt = aBuffers[nInd];
- if(rEnt.IsNormalUsed() && GetLightGroup())
- {
- // Beleuchtungsmodell loesen, Normale loeschen
- SolveColorModel(rEnt.Color(), rEnt.Normal(), rEnt.Point());
- }
- rEnt.SetNormalUsed(sal_False);
- }
-
- // Punkt wird dargestellt, weiterreichen
- if(GetPointSize() != 1.0)
- {
- // Punkt als Kreis mit dem Durchmesser GetPointSize() ausgeben
- // Hole den Original-Punkt
- B3dEntity& rEnt1 = aBuffers[nInd];
-
- // Umrechnen auf DeviceCoor
- rEnt1.ToDeviceCoor(GetTransformationSet());
-
- // Radius holen
- // Logische Koordinaten nach Pixel
- Point aPnt((long)(GetLineWidth() + 0.5), 0);
- double fRadius = ((double)((
- GetOutputDevice()->PixelToLogic(aPnt).X() -
- GetOutputDevice()->PixelToLogic(Point()).X()) + 0.5)) / 2.0;
-
- // Bereite neue Punkte vor
- // Hole die neuen Punkte
- sal_uInt32 nNew1 = aBuffers.Count();
- aBuffers.Append(rEnt1);
- B3dEntity& rNew1 = aBuffers[nNew1];
-
- sal_uInt32 nNew2 = aBuffers.Count();
- aBuffers.Append(rEnt1);
- B3dEntity& rNew2 = aBuffers[nNew2];
-
- sal_uInt32 nNew3 = aBuffers.Count();
- aBuffers.Append(rEnt1);
- B3dEntity& rNew3 = aBuffers[nNew3];
-
- // Schleife drehen
- Base3DRenderMode eRenderMode = GetRenderMode();
- SetRenderMode(Base3DRenderFill);
- sal_Bool bPolyOffset = GetPolygonOffset(Base3DPolygonOffsetFill);
- SetPolygonOffset(Base3DPolygonOffsetFill, sal_True);
-
- for(double fWink=0.0;fWink<F_2PI-(F_2PI/24.0);fWink+=F_2PI/12.0)
- {
- rNew2.Point().setX(rNew1.Point().getX() + (cos(fWink) * fRadius));
- rNew2.Point().setY(rNew1.Point().getY() + (sin(fWink) * fRadius));
-
- rNew3.Point().setX(rNew1.Point().getX() + (cos(fWink+(F_2PI/12.0)) * fRadius));
- rNew3.Point().setY(rNew1.Point().getY() + (sin(fWink+(F_2PI/12.0)) * fRadius));
-
- // Dreieck Zeichnen
- Create3DTriangle(nNew1, nNew3, nNew2);
- }
-
- SetRenderMode(eRenderMode);
- SetPolygonOffset(Base3DPolygonOffsetFill, bPolyOffset);
-
- bLastPrimitiveRejected = sal_False;
- }
- else
- {
- Clipped3DPoint(nInd);
- bLastPrimitiveRejected = sal_False;
- }
-}
-
-/*************************************************************************
-|*
-|* Funktion fuer Primitiv Linie
-|* Clipping und Ausgabe, falls noch was ueber ist
-|*
-\************************************************************************/
-
-void Base3DCommon::Create3DLine(sal_uInt32 nInd1, sal_uInt32 nInd2)
-{
- bLastPrimitiveRejected = sal_True;
- if(GetRenderMode() != Base3DRenderNone)
- {
- // Sicherstellen, dass die Koordinaten in
- // ClipCoordinates vorliegen
- aBuffers[nInd1].To3DCoor(GetTransformationSet());
- aBuffers[nInd2].To3DCoor(GetTransformationSet());
-
- if(AreEqual(nInd1, nInd2))
- return;
-
- // Linie an Einheitswuerfel clippen, dabei kann eine
- // der Indexvariablen (werden als Referenz uegergeben)
- // veraendert werden
-
- // Alte Buffergroesse merken
- ULONG nCount = aBuffers.Count();
-
- if(Clip3DLine(nInd1, nInd2))
- {
- // EdgeFlag beachten
- if(aBuffers[nInd1].IsEdgeVisible())
- Create3DLineClipped(nInd1, nInd2);
- }
-
- // Alte Buffergroesse wiederherstellen, um fortgesetzte
- // Primitive nicht zu zerstoeren
- while(aBuffers.Count() > nCount)
- aBuffers.Remove();
- }
-}
-
-void Base3DCommon::Create3DLineClipped(sal_uInt32 nInd1, sal_uInt32 nInd2)
-{
- // einige Beleuchtungsdinge koennen hier schon geklaert
- // werden
- if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
- {
- if(GetShadeModel() == Base3DFlat)
- {
- // Beleuchtuungsmodell fuer gemittelte Normale
- // loesen, Normalen loeschen
- B3dEntity& rEnt1 = aBuffers[nInd1];
- B3dEntity& rEnt2 = aBuffers[nInd2];
- if(rEnt1.IsNormalUsed() && rEnt2.IsNormalUsed() && GetLightGroup())
- {
- basegfx::B3DVector aNormal = rEnt1.Normal() + rEnt2.Normal();
- aNormal.normalize();
- basegfx::B3DPoint aPoint = (rEnt1.Point() + rEnt2.Point()) / 2.0;
- SolveColorModel(rEnt1.Color(), aNormal, aPoint);
- rEnt2.Color() = rEnt1.Color();
- }
- rEnt1.SetNormalUsed(sal_False);
- rEnt2.SetNormalUsed(sal_False);
- }
- }
- else
- {
- if(GetShadeModel() == Base3DFlat)
- {
- B3dEntity& rEnt1 = aBuffers[nInd1];
- B3dEntity& rEnt2 = aBuffers[nInd2];
- B3dColor aCol;
- aCol.CalcMiddle(rEnt1.Color(), rEnt2.Color());
- rEnt1.Color() = aCol;
- rEnt2.Color() = aCol;
- }
- }
-
- if(GetRenderMode() == Base3DRenderPoint)
- {
- // Als Punkte ausgeben
- Create3DPointClipped(nInd1);
- Create3DPointClipped(nInd2);
- }
- else
- {
- if(GetLineWidth() != 1.0)
- {
- // Linie als Polygon mit der Breite GetLineWidth() ausgeben
- // Hole die Original-Punkte
- B3dEntity& rEnt1 = aBuffers[nInd1];
- B3dEntity& rEnt2 = aBuffers[nInd2];
-
- // Umrechnen auf DeviceCoor
- rEnt1.ToDeviceCoor(GetTransformationSet());
- rEnt2.ToDeviceCoor(GetTransformationSet());
-
- // Bereite neue Punkte vor
- // Hole die neuen Punkte
- sal_uInt32 nNew1 = aBuffers.Count();
- aBuffers.Append(rEnt1);
- B3dEntity& rNew1 = aBuffers[nNew1];
-
- sal_uInt32 nNew2 = aBuffers.Count();
- aBuffers.Append(rEnt1);
- B3dEntity& rNew2 = aBuffers[nNew2];
-
- sal_uInt32 nNew3 = aBuffers.Count();
- aBuffers.Append(rEnt2);
- B3dEntity& rNew3 = aBuffers[nNew3];
-
- sal_uInt32 nNew4 = aBuffers.Count();
- aBuffers.Append(rEnt2);
- B3dEntity& rNew4 = aBuffers[nNew4];
-
- // Berechnen
- basegfx::B3DVector aEntVector = rEnt2.Point() - rEnt1.Point();
- basegfx::B3DVector aTurned(-aEntVector.getY(), aEntVector.getX(), 0.0);
- aTurned.normalize();
-
- // Logische Koordinaten nach Pixel
- Point aPnt((long)(GetLineWidth() + 0.5), 0);
- double fFac = ((double)((
- GetOutputDevice()->PixelToLogic(aPnt).X() -
- GetOutputDevice()->PixelToLogic(Point()).X()) + 0.5)) / 2.0;
-
- // Aufmuliplizieren
- aTurned *= fFac;
-
- rNew1.Point().setX(rNew1.Point().getX() + aTurned.getX());
- rNew1.Point().setY(rNew1.Point().getY() + aTurned.getY());
- rNew2.Point().setX(rNew2.Point().getX() - aTurned.getX());
- rNew2.Point().setY(rNew2.Point().getY() - aTurned.getY());
-
- rNew3.Point().setX(rNew3.Point().getX() + aTurned.getX());
- rNew3.Point().setY(rNew3.Point().getY() + aTurned.getY());
- rNew4.Point().setX(rNew4.Point().getX() - aTurned.getX());
- rNew4.Point().setY(rNew4.Point().getY() - aTurned.getY());
-
- // Ausgeben
- Base3DRenderMode eRenderMode = GetRenderMode();
- SetRenderMode(Base3DRenderFill);
- sal_Bool bPolyOffset = GetPolygonOffset(Base3DPolygonOffsetFill);
- SetPolygonOffset(Base3DPolygonOffsetFill, sal_True);
-
- Create3DTriangle(nNew2, nNew1, nNew3);
- Create3DTriangle(nNew2, nNew3, nNew4);
-
- SetRenderMode(eRenderMode);
- SetPolygonOffset(Base3DPolygonOffsetFill, bPolyOffset);
-
- bLastPrimitiveRejected = sal_False;
- }
- else
- {
- // Linie ausgeben
- Clipped3DLine(nInd1,nInd2);
- bLastPrimitiveRejected = sal_False;
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Funktion fuer Primitiv Dreieck
-|* Clipping und Ausgabe, falls noch was ueber ist
-|*
-\************************************************************************/
-
-void Base3DCommon::Create3DTriangle(sal_uInt32 nInd1, sal_uInt32 nInd2, sal_uInt32 nInd3)
-{
- bLastPrimitiveRejected = sal_True;
-
- // Sicherstellen, dass die Koordinaten in
- // ClipCoordinates vorliegen
- aBuffers[nInd1].To3DCoor(GetTransformationSet());
- aBuffers[nInd2].To3DCoor(GetTransformationSet());
- aBuffers[nInd3].To3DCoor(GetTransformationSet());
-
- if(AreEqual(nInd1, nInd2)
- || AreEqual(nInd1, nInd3)
- || AreEqual(nInd2, nInd3))
- return;
-
- // Normale vorbereiten, die echte Ebenennormale der Geometrie
- // im Device-Koordinatensystem. Verzerrungen durch perspektivische
- // Projektion sind somit bereits beruecksichtigt.
- const basegfx::B3DPoint& rPnt1 = aBuffers[nInd1].Point();
- const basegfx::B3DPoint& rPnt2 = aBuffers[nInd2].Point();
- const basegfx::B3DPoint& rPnt3 = aBuffers[nInd3].Point();
- basegfx::B3DVector aNormal = basegfx::B3DVector(rPnt2 - rPnt3).getPerpendicular(basegfx::B3DVector(rPnt2 - rPnt1));
- aNormal.normalize();
-
- if(GetCullMode() != Base3DCullNone)
- {
- // Normale ermitteln, eventuell gar nicht zeichnen
- if(GetCullMode() == Base3DCullFront)
- {
- if(aNormal.getZ() > 0.0)
- return;
- }
- else
- {
- if(aNormal.getZ() < 0.0)
- return;
- }
- }
-
- // allgemeines Polygon vorbereiten
- sal_uInt32Bucket aEdgeIndex(8);
- aEdgeIndex.Append(nInd1);
- aEdgeIndex.Append(nInd2);
- aEdgeIndex.Append(nInd3);
-
- // Alte Buffergroesse merken
- ULONG nCount = aBuffers.Count();
-
- // Dreieck an Einheitswuerfel clippen
- if(Clip3DPolygon(aEdgeIndex))
- {
- // #93184# set flag for polygon normal direction
- bNormalPointsAway = sal_Bool(aNormal.getZ() < 0.0);
-
- sal_uInt32 nNumPoints = aEdgeIndex.Count();
-
- // einige Beleuchtungsdinge koennen hier schon geklaert
- // werden
- if(GetLightGroup() && GetLightGroup()->IsLightingEnabled() && nNumPoints != 0)
- {
- if(GetShadeModel() == Base3DFlat)
- {
- B3dEntity& rEntity = aBuffers[nInd1];
- B3dColor aColFlatMode;
-
- // #63505#
- aNormal.setX(-aNormal.getX());
- aNormal.setY(-aNormal.getY());
-
- SolveColorModel(aColFlatMode, aNormal, rEntity.Point());
-
- // Vorberechnete Farbe in Eckpunkten setzen
- for(sal_uInt32 i=0;i<nNumPoints;i++)
- {
- B3dEntity& rEnt = aBuffers[aEdgeIndex[i]];
- rEnt.Color() = aColFlatMode;
- rEnt.SetNormalUsed(sal_False);
- }
- }
- }
- else
- {
- if(GetShadeModel() == Base3DFlat && nNumPoints != 0)
- {
- sal_uInt16 aRed(0), aGreen(0), aBlue(0), aAlpha(0);
- sal_uInt32 i;
- for(i=0;i<nNumPoints;i++)
- {
- B3dEntity& rEnt = aBuffers[aEdgeIndex[i]];
- aRed = aRed + rEnt.Color().GetRed();
- aGreen = aGreen + rEnt.Color().GetGreen();
- aBlue = aBlue + rEnt.Color().GetBlue();
- aAlpha = aAlpha + rEnt.Color().GetTransparency();
- }
- B3dColor aCol((UINT8)(aAlpha / nNumPoints),
- (UINT8)(aRed / nNumPoints),
- (UINT8)(aGreen / nNumPoints),
- (UINT8)(aBlue / nNumPoints));
- for(i=0;i<nNumPoints;i++)
- {
- aBuffers[aEdgeIndex[i]].Color() = aCol;
- }
- }
- }
-
- // Ausgeben, je nach Modus
- Base3DMaterialMode eMat = Base3DMaterialFront;
- if(aNormal.getZ() < 0.0
- && (GetLightGroup() && GetLightGroup()->GetModelTwoSide()))
- eMat = Base3DMaterialBack;
- Base3DRenderMode eMode = GetRenderMode(eMat);
-
- if(eMode == Base3DRenderPoint)
- {
- // Als Punktmenge ausgeben
- for(sal_uInt32 i=0;i<nNumPoints;i++)
- {
- Create3DPointClipped(aEdgeIndex[i]);
- }
- }
- else if(eMode == Base3DRenderLine)
- {
- // Als Linien ausgeben
- sal_uInt32 i2, i3;
- for(sal_uInt32 i=0;i<nNumPoints;i++)
- {
- i2 = i+1;
- if(i2 == nNumPoints)
- i2 = 0;
- i3 = aEdgeIndex[i];
- i2 = aEdgeIndex[i2];
-
- // EdgeFlag beachten
- if(aBuffers[i3].IsEdgeVisible())
- Create3DLineClipped(i3, i2);
- }
- }
- else
- {
- // after clipping the triangle can be a multi-sided, but
- // convex polygon. Render it by dividing it into triangles
- // again. Cause' it is clipped now, no more taking care is
- // necessary. Just give hints which flags are truly edges
- // to allow further computations.
- if(nNumPoints > 2)
- {
- for(sal_uInt32 i=2;i < nNumPoints; i++)
- {
- Clipped3DTriangle(
- aEdgeIndex[0],
- aEdgeIndex[i-1],
- aEdgeIndex[i]);
- bLastPrimitiveRejected = sal_False;
- }
- }
- }
- }
- // Alte Buffergroesse wiederherstellen, um fortgesetzte
- // Primitive nicht zu zerstoeren
- while(aBuffers.Count() > nCount)
- aBuffers.Remove();
-}
-
-/*************************************************************************
-|*
-|* Punkt am canonical view volume clippen
-|*
-\************************************************************************/
-
-sal_Bool Base3DCommon::Clip3DPoint(sal_uInt32 nInd)
-{
- return (!(sal_Bool)GetClipFlags(nInd));
-}
-
-/*************************************************************************
-|*
-|* Vergleicht, ob die beiden Entities geometrisch gleich sind
-|*
-\************************************************************************/
-
-sal_Bool Base3DCommon::AreEqual(sal_uInt32 nInd1, sal_uInt32 nInd2)
-{
- const basegfx::B3DPoint& rPnt1 = aBuffers[nInd1].Point();
- const basegfx::B3DPoint& rPnt2 = aBuffers[nInd2].Point();
-
- return rPnt1.equal(rPnt2);
-}
-
-/*************************************************************************
-|*
-|* Linie am canonical view volume clippen
-|*
-\************************************************************************/
-
-sal_Bool Base3DCommon::Clip3DLine(sal_uInt32& nInd1,sal_uInt32& nInd2)
-{
- sal_uInt16 nFlag0, nFlag1;
- do
- {
- nFlag0 = GetClipFlags(nInd1);
- nFlag1 = GetClipFlags(nInd2);
-
- // Beide Endpunkte drin?
- if(!(nFlag0 | nFlag1))
- return sal_True;
-
- // Linie komplett draussen?
- if(nFlag0 & nFlag1)
- return sal_False;
-
- // Es muss geclippt werden, bereite einen neuen Punkt vor
- sal_uInt32 nNewIndex = aBuffers.Count();
- aBuffers.Append();
-
- if((nFlag0 | nFlag1) & (CLIPFLAG_FRONT | CLIPFLAG_BACK))
- {
- // clippen in Z
- if(nFlag0 & (CLIPFLAG_FRONT | CLIPFLAG_BACK))
- {
- if(nFlag0 & CLIPFLAG_FRONT)
- CalcNewPoint(nNewIndex, nInd2, nInd1, 2, -1.0);
- else
- CalcNewPoint(nNewIndex, nInd1, nInd2, 2, 1.0);
- nInd1 = nNewIndex;
- }
- else
- {
- if(nFlag1 & CLIPFLAG_FRONT)
- CalcNewPoint(nNewIndex, nInd1, nInd2, 2, -1.0);
- else
- CalcNewPoint(nNewIndex, nInd2, nInd1, 2, 1.0);
- nInd2 = nNewIndex;
- }
- }
- else if((nFlag0 | nFlag1) & (CLIPFLAG_LEFT | CLIPFLAG_RIGHT))
- {
- // clippen in X
- if(nFlag0 & (CLIPFLAG_LEFT | CLIPFLAG_RIGHT))
- {
- if(nFlag0 & CLIPFLAG_LEFT)
- CalcNewPoint(nNewIndex, nInd2, nInd1, 0, -1.0);
- else
- CalcNewPoint(nNewIndex, nInd1, nInd2, 0, 1.0);
- nInd1 = nNewIndex;
- }
- else
- {
- if(nFlag1 & CLIPFLAG_LEFT)
- CalcNewPoint(nNewIndex, nInd1, nInd2, 0, -1.0);
- else
- CalcNewPoint(nNewIndex, nInd2, nInd1, 0, 1.0);
- nInd2 = nNewIndex;
- }
- }
- else
- {
- // clippen in Y
- if(nFlag0 & (CLIPFLAG_BOTTOM | CLIPFLAG_TOP))
- {
- if(nFlag0 & CLIPFLAG_BOTTOM)
- CalcNewPoint(nNewIndex, nInd2, nInd1, 1, -1.0);
- else
- CalcNewPoint(nNewIndex, nInd1, nInd2, 1, 1.0);
- nInd1 = nNewIndex;
- }
- else
- {
- if(nFlag1 & CLIPFLAG_BOTTOM)
- CalcNewPoint(nNewIndex, nInd1, nInd2, 1, -1.0);
- else
- CalcNewPoint(nNewIndex, nInd2, nInd1, 1, 1.0);
- nInd2 = nNewIndex;
- }
- }
- } while(nFlag0 | nFlag1);
- return sal_True;
-}
-
-/*************************************************************************
-|*
-|* ClipFlags eines Punktes ermitteln und zurueckgeben
-|*
-\************************************************************************/
-
-sal_uInt16 Base3DCommon::GetClipFlags(sal_uInt32 nInd)
-{
- sal_uInt16 nRetval(0);
- basegfx::B3DPoint& rPoint = aBuffers[nInd].Point();
-
- if(rPoint.getX() < -(1.0 + SMALL_DVALUE))
- nRetval |= CLIPFLAG_LEFT;
- if(rPoint.getX() > 1.0 + SMALL_DVALUE)
- nRetval |= CLIPFLAG_RIGHT;
-
- if(rPoint.getY() < -(1.0 + SMALL_DVALUE))
- nRetval |= CLIPFLAG_BOTTOM;
- if(rPoint.getY() > 1.0 + SMALL_DVALUE)
- nRetval |= CLIPFLAG_TOP;
-
- if(rPoint.getZ() < -(1.0 + SMALL_DVALUE))
- nRetval |= CLIPFLAG_FRONT;
- if(rPoint.getZ() > 1.0 + SMALL_DVALUE)
- nRetval |= CLIPFLAG_BACK;
-
- return nRetval;
-}
-
-/*************************************************************************
-|*
-|* Dreieck am canonical view volume clippen
-|* Ergebnis steht indirekt ueber eine Indizierungstabelle in
-|* aEdgeIndex[nEdgeDestination][0 .. aEdgeIndexFree[nEdgeDestination]]
-|*
-\************************************************************************/
-
-sal_Bool Base3DCommon::Clip3DPolygon(sal_uInt32Bucket& rEdgeIndex)
-{
- sal_uInt32 i;
- sal_uInt16 nAllFlagsOr, nAllFlagsAnd;
-
- do
- {
- // ClipFlags holen
- nAllFlagsOr = 0;
- nAllFlagsAnd = CLIPFLAG_ALL;
-
- for(i=0; i < rEdgeIndex.Count(); i++)
- {
- sal_uInt16 nFlag = GetClipFlags(rEdgeIndex[i]);
- nAllFlagsOr |= nFlag;
- nAllFlagsAnd &= nFlag;
- }
-
- // Alle Endpunkte drin?
- if(!nAllFlagsOr)
- return sal_True;
-
- // Dreieck komplett draussen?
- if(nAllFlagsAnd)
- return sal_False;
-
- if(nAllFlagsOr & (CLIPFLAG_FRONT|CLIPFLAG_BACK))
- {
- // clippen in Z
- if(nAllFlagsOr & CLIPFLAG_FRONT)
- {
- ClipPoly(rEdgeIndex, 2, sal_True);
- }
- else
- {
- ClipPoly(rEdgeIndex, 2, sal_False);
- }
- }
- else if(nAllFlagsOr & (CLIPFLAG_LEFT|CLIPFLAG_RIGHT))
- {
- // clippen in X
- if(nAllFlagsOr & CLIPFLAG_LEFT)
- {
- ClipPoly(rEdgeIndex, 0, sal_True);
- }
- else
- {
- ClipPoly(rEdgeIndex, 0, sal_False);
- }
- }
- else
- {
- // clippen in Y
- if(nAllFlagsOr & CLIPFLAG_BOTTOM)
- {
- ClipPoly(rEdgeIndex, 1, sal_True);
- }
- else
- {
- ClipPoly(rEdgeIndex, 1, sal_False);
- }
- }
- } while(nAllFlagsOr);
- return sal_True;
-}
-
-/*************************************************************************
-|*
-|* Testen, ob die Entitaet nInd innerhalb des canonical view volume liegt
-|*
-\************************************************************************/
-
-sal_Bool Base3DCommon::IsInside(sal_uInt32 nInd, sal_uInt32 nDim, sal_Bool bLow)
-{
- B3dEntity& aEntity = aBuffers[nInd];
-
- // #110270#
- // Add SMALL_DVALUE to this tests
- if(bLow)
- {
- if(aEntity.Point()[nDim] < -(1.0 + SMALL_DVALUE))
- return sal_False;
- }
- else
- {
- if(aEntity.Point()[nDim] > (1.0 + SMALL_DVALUE))
- return sal_False;
- }
- return sal_True;
-}
-
-/*************************************************************************
-|*
-|* Macht einen Clippingdurchgang eines Polygons in der angegebenen
-|* Dimension. Es werden eventuell neue Punkte erzeugt.
-|*
-\************************************************************************/
-
-void Base3DCommon::ClipPoly(sal_uInt32Bucket& rEdgeIndex, sal_uInt16 nDim, sal_Bool bLow)
-{
- sal_uInt32 nNumEdges = rEdgeIndex.Count();
- sal_uInt32 nCurrentInd = rEdgeIndex[0];
- sal_Bool bCurrentInside = IsInside(nCurrentInd, nDim, bLow);
- sal_uInt32 nNextInd;
- sal_Bool bNextInside;
- sal_uInt32Bucket aEdgeIndex(8);
-
- for(sal_uInt32 i=0;i<nNumEdges;i++)
- {
- // hole naechsten Eckpunkt
- nNextInd = i+1;
- if(nNextInd == nNumEdges)
- nNextInd = 0;
- nNextInd = rEdgeIndex[nNextInd];
- bNextInside = IsInside(nNextInd, nDim, bLow);
-
- // behandle die Kante nCurrentInd, nNextInd in der Dimension
- // nDim gegen die Grenze -1.0
- if(bCurrentInside)
- {
- // aktuellen Punkt hinzufuegen
- aEdgeIndex.Append(nCurrentInd);
- if(!bNextInside)
- {
- // drin -> draussen
- // Platz fuer Schnittpunkt allokieren
- sal_uInt32 nNewIndex = aBuffers.Count();
- aBuffers.Append();
-
- // Schnittpunkt berechnen
- if(bLow)
- CalcNewPoint(nNewIndex, nCurrentInd, nNextInd, nDim, -1.0);
- else
- CalcNewPoint(nNewIndex, nNextInd, nCurrentInd, nDim, 1.0);
-
- // EdgeFlag behandeln, beim Verlassen zuruecksetzen
- if(aBuffers[nCurrentInd].IsEdgeVisible())
- aBuffers[nNewIndex].SetEdgeVisible(sal_False);
-
- // Schnittpunkt hinzufuegen
- aEdgeIndex.Append(nNewIndex);
- }
- }
- else
- {
- if(bNextInside)
- {
- // draussen -> drin
- // Platz fuer Schnittpunkt allokieren
- sal_uInt32 nNewIndex = aBuffers.Count();
- aBuffers.Append();
-
- // Schnittpunkt berechnen
- if(bLow)
- CalcNewPoint(nNewIndex, nNextInd, nCurrentInd, nDim, -1.0);
- else
- CalcNewPoint(nNewIndex, nCurrentInd, nNextInd, nDim, 1.0);
-
- // EdgeFlag behandeln, selber Wert wie Vorgaenger
- aBuffers[nNewIndex].SetEdgeVisible(aBuffers[nCurrentInd].IsEdgeVisible());
-
- // Schnittpunkt hinzufuegen
- aEdgeIndex.Append(nNewIndex);
- }
- }
-
- // bereite naechste Kante vor
- nCurrentInd = nNextInd;
- bCurrentInside = bNextInside;
- }
-
- // Indices kopieren
- rEdgeIndex = aEdgeIndex;
-}
-
-/*************************************************************************
-|*
-|* Die Entitaet nNew muss berechnet werden in der angegebenen
-|* Dimension an der Grenze fBound.
-|*
-\************************************************************************/
-
-void Base3DCommon::CalcNewPoint(sal_uInt32 nNew, sal_uInt32 nHigh, sal_uInt32 nLow,
- sal_uInt16 nDim, double fBound)
-{
- B3dEntity& aNew = aBuffers[nNew];
- B3dEntity& aHigh = aBuffers[nHigh];
- B3dEntity& aLow = aBuffers[nLow];
- double fFactor(1.0);
- aNew.Reset();
-
- if(aLow.Point()[nDim] != aHigh.Point()[nDim])
- {
- // #i27159#
- // Still numerical problems here around 0.0 and 1.0. I decided to
- // go the numerically more cautios way and avoid values which get
- // a little bit below 0.0 or above 1.0 here. The original line was:
- // fFactor = (fBound - aHigh.Point()[nDim]) / (aLow.Point()[nDim] - aHigh.Point()[nDim]);
- const double fFactorA(fBound - aHigh.Point()[nDim]);
-
- if(fabs(fFactorA) < SMALL_DVALUE)
- {
- fFactor = 0.0;
- }
- else
- {
- const double fFactorB(aLow.Point()[nDim] - aHigh.Point()[nDim]);
-
- if(fabs(fFactorA - fFactorB) < SMALL_DVALUE)
- {
- fFactor = 1.0;
- }
- else
- {
- fFactor = fFactorA / fFactorB;
- }
- }
- }
-
-#ifdef DBG_UTIL
- if(fFactor > 1.0 || fFactor < 0.0)
- DBG_ERROR("Wrong clipping factor (out of range)!");
-#endif
-
- if(fFactor == 0.0)
- {
- // #110270#
- // If fFactor is 0.0, copy the point
- aNew.Copy(aHigh);
- }
- else if(fFactor == 1.0)
- {
- // #110270#
- // If fFactor is 1.0, copy the point
- aNew.Copy(aLow);
- }
- else
- {
- // Neuen Punkt berechnen, aber Reihenfolge der
- // Punkte aufrecht erhalten um die Sichtbarkeit
- // der Kanten zu retten
- aLow.ForceEqualBase(GetTransformationSet(), aHigh);
-
- if(fBound < 0.0)
- aNew.CalcInBetween(aLow, aHigh, 1.0 - fFactor);
- else
- aNew.CalcInBetween(aHigh, aLow, fFactor);
-
- // WICHTIG fuer die Numerik beim Clippen: Die betroffene
- // Koordinate wirklich auf fBound setzen, nicht berechnen.
- // Beim Berechnen koennen nur wieder Ungenauigkeiten auftreten,
- // die bei der Bestimmung der Clipping-Grenzen zu
- // Endlosschleifen fuehren koennen.
- aNew.Point()[nDim] = fBound;
- }
-}
-
-/*************************************************************************
-|*
-|* Beleuchtungsmodell (ColorModel) in einem Punkt loesen
-|* Dabei das Ergebnis in rCol ablegen, d.h. wirklich modifizieren
-|*
-\************************************************************************/
-
-void Base3DCommon::SolveColorModel(B3dColor& rCol, basegfx::B3DVector& rVec, const basegfx::B3DPoint& rPnt)
-{
- if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
- {
- B3dMaterial& rMat = GetMaterialObject();
- sal_Bool bDoSolve(sal_True);
-
- // Welches Material? Zeigt der Vektor vom Betrachter
- // weg oder auf diesen?
- if(rVec.getZ() < 0.0)
- {
- // Rueckseite, soll diese dargestellt werden?
- if(GetLightGroup() && GetLightGroup()->GetModelTwoSide())
- {
- rMat = GetMaterialObject(Base3DMaterialBack);
- }
- else
- {
- bDoSolve = sal_False;
- }
- }
- if(bDoSolve)
- rCol = SolveColorModel(rMat, rVec, rPnt);
- }
-}
-
-B3dColor Base3DCommon::SolveColorModel(B3dMaterial& rMat, basegfx::B3DVector& rVec, const basegfx::B3DPoint& rPnt)
-{
- // Material emission einbeziehen
- B3dColor aNew = rMat.GetMaterial(Base3DMaterialEmission);
-
- // global ambient light beachten
- aNew += (B3dColor)rMat.GetMaterial(Base3DMaterialAmbient)
- * (B3dColor)GetLightGroup()->GetGlobalAmbientLight();
-
- if(GetTransformationSet())
- {
- // Die Punktkoordinate liegt in ClipCoordinates vor, wird
- // aber zur Farbberechnung in EyeCoordinates benoetigt.
- // Fuehre eine Ruecktransformation durch.
- basegfx::B3DPoint aPnt(rPnt);
- aPnt = GetTransformationSet()->DeviceToEyeCoor(aPnt);
-
- // Falls die Normale vom Betrachter weg zeigt und das Beleuchtungs-
- // modell doppelseitig ist, Normale umdrehen
- basegfx::B3DVector aVec(rVec);
- // #93184# use flag from polygon normal direction to switch local normal eventually
- if(bNormalPointsAway && GetLightGroup()->GetModelTwoSide())
- aVec = -rVec;
-
- // Die einzelnen Lichtquellen einbeziehen
- for(sal_uInt16 i=Base3DLight0; i <= Base3DLight7; i++)
- {
- if(GetLightGroup()->IsEnabled((Base3DLightNumber)i))
- {
- aNew += SolveColorModel(
- GetLightGroup()->GetLightObject((Base3DLightNumber)i),
- rMat, aVec, aPnt);
- }
- }
-
- // Transparenz aus der Diffuse (=Objekt-) Farbe uebernehmen
- aNew.SetTransparency(rMat.GetMaterial(Base3DMaterialDiffuse).GetTransparency());
- }
- return aNew;
-}
-
-/*************************************************************************
-|*
-|* Beleuchtungsmodell (ColorModel) fuer eine Lichtquelle loesen
-|*
-\************************************************************************/
-
-B3dColor Base3DCommon::SolveColorModel(B3dLight& rLight, B3dMaterial& rMat, basegfx::B3DVector& rVec, const basegfx::B3DPoint& rPnt)
-{
- B3dColor aRetval(255, 0, 0, 0);
- if(rLight.IsEnabled())
- {
- // Faktor mit Attenuation 1.0 initialisieren, falls
- // IsDirectionalSource() == sal_True
- double fFac = 1.0;
- basegfx::B3DVector aLightToVertex;
- sal_Bool bLightToVertex(sal_False);
-
- if(!rLight.IsDirectionalSource())
- {
- // positional light
- // echten attenuation Faktor ermitteln
- fFac = rLight.GetConstantAttenuation();
- if(rLight.IsLinearOrQuadratic())
- {
- // jetzt wird die Entfernung zwischen Lichtposition
- // und Punkt benoetigt
- aLightToVertex = rPnt - rLight.GetPositionEye();
- bLightToVertex = sal_True;
- double fLen = aLightToVertex.getLength();
- aLightToVertex.normalize();
-
- fFac += rLight.GetLinearAttenuation() * fLen;
- fFac += rLight.GetQuadraticAttenuation() * fLen * fLen;
- }
- // Kehrwert bilden
- if(fFac != 1.0 && fFac != 0.0)
- fFac = 1.0 / fFac;
-
- if(rLight.IsSpot())
- {
- // Spotlight it immer ein positional light
- // Spotlight effect, wird auf den Faktor multipliziert
- if(!bLightToVertex)
- {
- aLightToVertex = rPnt - rLight.GetPositionEye();
- aLightToVertex.normalize();
- bLightToVertex = sal_True;
- }
- double fCosAngle = aLightToVertex.scalar(rLight.GetSpotDirection());
- // innerhalb des konus?
- if(fCosAngle <= rLight.GetCosSpotCutoff())
- {
- if(fCosAngle > 0.000001)
- {
- if(rLight.GetSpotExponent() != 0.0)
- fCosAngle = pow(fCosAngle, rLight.GetSpotExponent());
- fFac *= fCosAngle;
- }
- else
- {
- fFac = 0.0;
- }
- }
- else
- {
- // Ausserhalb des Konus, keine Beleuchtung
- fFac = 0.0;
- }
- }
- }
-
- // falls es etwas zu beleuchten gibt...
- if(fFac != 0.0)
- {
- // Ambient term
- if(rLight.IsAmbient())
- {
- aRetval += (B3dColor)rLight.GetIntensity(Base3DMaterialAmbient)
- * (B3dColor)rMat.GetMaterial(Base3DMaterialAmbient);
- }
-
- if(rLight.IsDiffuse() || rLight.IsSpecular())
- {
- if(bLightToVertex)
- {
- // Falls hier schon berechnet, handelt es sich
- // auch um ein positional light
- aLightToVertex = -aLightToVertex;
- }
- else
- {
- if(rLight.IsDirectionalSource())
- {
- // Vektor direkt nehmen
- aLightToVertex = rLight.GetPosition();
- }
- else
- {
- // Umgerechnete Lichtposition nehmen
- aLightToVertex = rLight.GetPositionEye();
- // Betrachtete Position abziehen -> Einheitsvektor
- // vom Punkt zur Lichtquelle
- aLightToVertex -= rPnt;
- }
- aLightToVertex.normalize();
- }
- double fCosFac = aLightToVertex.scalar(rVec);
-
- if(fCosFac > 0.000001)
- {
- if(rLight.IsDiffuse())
- {
- // Diffuse term
- aRetval += (B3dColor)rLight.GetIntensity(Base3DMaterialDiffuse)
- * (B3dColor)rMat.GetMaterial(Base3DMaterialDiffuse)
- * fCosFac;
- }
- if(rLight.IsSpecular())
- {
- // Specular term
- if(GetLightGroup()->GetLocalViewer())
- {
- // use vector 0,0,1
- aLightToVertex.setZ(aLightToVertex.getZ() + 1.0);
- }
- else
- {
- // vector Vertex to Viewpoint berechnen in
- // Augkoordinaten, ist 0 - rPnt
- aLightToVertex -= rPnt;
- }
- aLightToVertex.normalize();
- fCosFac = aLightToVertex.scalar(rVec);
- if(fCosFac > 0.000001)
- {
- if(rMat.GetShininess())
- fCosFac = pow(fCosFac, rMat.GetShininess());
- aRetval += (B3dColor)rLight.GetIntensity(Base3DMaterialSpecular)
- * (B3dColor)rMat.GetMaterial(Base3DMaterialSpecular)
- * fCosFac;
- }
- }
- }
- }
-
- // jetzt fFac aufrechnen
- if(fFac != 1.0)
- aRetval *= fFac;
- }
- }
- return aRetval;
-}
-
-// eof
diff --git a/goodies/source/base3d/b3dcommn.hxx b/goodies/source/base3d/b3dcommn.hxx
deleted file mode 100644
index 1c7d500039f6..000000000000
--- a/goodies/source/base3d/b3dcommn.hxx
+++ /dev/null
@@ -1,129 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dcommn.hxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DCOMMN_HXX
-#define _B3D_B3DCOMMN_HXX
-
-#include <goodies/base3d.hxx>
-#include <goodies/b3dgeom.hxx>
-
-// Defines fuer clipping flags (nFlag0,1)
-#define CLIPFLAG_LEFT 0x0001
-#define CLIPFLAG_RIGHT 0x0002
-#define CLIPFLAG_BOTTOM 0x0004
-#define CLIPFLAG_TOP 0x0008
-#define CLIPFLAG_FRONT 0x0010
-#define CLIPFLAG_BACK 0x0020
-#define CLIPFLAG_ALL (CLIPFLAG_LEFT|CLIPFLAG_RIGHT| \
- CLIPFLAG_BOTTOM|CLIPFLAG_TOP| \
- CLIPFLAG_FRONT|CLIPFLAG_BACK)
-
-/*************************************************************************
-|*
-|* Bucket fuer Indices
-|*
-\************************************************************************/
-
-BASE3D_DECL_BUCKET(sal_uInt32, Bucket)
-
-/*************************************************************************
-|*
-|* Die Basisklasse fuer Standard 3D Ausgaben auf StarView Basis
-|*
-\************************************************************************/
-
-#define BUFFER_OVERHEAD (20)
-
-class Base3DCommon : public Base3D
-{
-protected:
- // Buffers fuer temporaere geometrische Daten
- B3dEntityBucket aBuffers;
-
- // Remember if last primitive was rejected
- unsigned bLastPrimitiveRejected : 1;
-
- // #93184# flag for polygon normal direction
- unsigned bNormalPointsAway : 1;
-
-public:
- Base3DCommon(OutputDevice* pOutDev);
- virtual ~Base3DCommon();
-
- // Beleuchtung setzen/lesen
- virtual void SetLightGroup(B3dLightGroup* pSet, sal_Bool bSetGlobal=sal_True);
-
- // Info if last primitive was rejected
- sal_Bool WasLastPrimitiveRejected()
- { return bLastPrimitiveRejected; }
-
- // Szenenverwaltung
- virtual void StartScene();
- virtual void EndScene();
-
-protected:
- // Geometrische Daten uebergeben
- virtual B3dEntity& ImplGetFreeEntity();
-
- virtual void ImplStartPrimitive();
- virtual void ImplEndPrimitive();
- virtual void ImplPostAddVertex(B3dEntity& rEnt);
-
- void Create3DPoint(sal_uInt32 nInd);
- void Create3DPointClipped(sal_uInt32 nInd);
- void Create3DLine(sal_uInt32 nInd1, sal_uInt32 nInd2);
- void Create3DLineClipped(sal_uInt32 nInd1, sal_uInt32 nInd2);
- void Create3DTriangle(sal_uInt32 nInd1, sal_uInt32 nInd2, sal_uInt32 nInd3);
-
- virtual void Clipped3DPoint(sal_uInt32 nInd) = 0;
- virtual void Clipped3DLine(sal_uInt32 nInd1,sal_uInt32 nInd2) = 0;
- virtual void Clipped3DTriangle(sal_uInt32 nInd1,sal_uInt32 nInd2, sal_uInt32 nInd3) = 0;
-
- // clipping functions
- sal_Bool AreEqual(sal_uInt32 nInd1, sal_uInt32 nInd2);
- sal_Bool Clip3DPoint(sal_uInt32 nInd);
- sal_Bool Clip3DLine(sal_uInt32& nInd1,sal_uInt32& nInd2);
- sal_Bool Clip3DPolygon(sal_uInt32Bucket& rEdgeIndex);
- sal_uInt16 GetClipFlags(sal_uInt32 nInd);
- sal_Bool IsInside(sal_uInt32 nInd, sal_uInt32 nDim, sal_Bool bLow);
- void ClipPoly(sal_uInt32Bucket& rEdgeIndex, sal_uInt16 nDim,sal_Bool bLow);
- void CalcNewPoint(sal_uInt32 nNew,sal_uInt32 nHigh,sal_uInt32 nLow,
- sal_uInt16 nDim, double fBound);
-
- // Beleuchtungsmodell (ColorModel) in einem Punkt loesen
- // Punkt MUSS in ClipCoordinates vorliegen !
- void SolveColorModel(B3dColor& rCol, basegfx::B3DVector& rVec, const basegfx::B3DPoint& rPnt);
- B3dColor SolveColorModel(B3dMaterial& rMat, basegfx::B3DVector& rVec, const basegfx::B3DPoint& rPnt);
-
- // Beleuchtungsmodell (ColorModel) fuer eine Lichtquelle loesen
- B3dColor SolveColorModel(B3dLight& rLight, B3dMaterial& rMat, basegfx::B3DVector& rVec, const basegfx::B3DPoint& rPnt);
-};
-
-#endif // _B3D_B3DCOMMN_HXX
diff --git a/goodies/source/base3d/b3dcompo.cxx b/goodies/source/base3d/b3dcompo.cxx
deleted file mode 100644
index 8d694cb22132..000000000000
--- a/goodies/source/base3d/b3dcompo.cxx
+++ /dev/null
@@ -1,1140 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dcompo.cxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include <goodies/b3dcompo.hxx>
-#include <goodies/base3d.hxx>
-#include <goodies/b3dgeom.hxx>
-
-#ifndef _INC_FLOAT
-#include <float.h>
-#endif
-#include <tools/debug.hxx>
-
-/*************************************************************************
-|*
-|* Vergleiche fuer doubles mit bound
-|*
-\************************************************************************/
-
-#define DOUBLE_EQUAL(a,b) (fabs(a-b) < SMALL_DVALUE)
-#define DOUBLE_NOT_EQUAL(a,b) (fabs(a-b) > SMALL_DVALUE)
-#define DOUBLE_SMALLER(a,b) ((a + (SMALL_DVALUE / 2.0)) < b)
-#define DOUBLE_BIGGER(a,b) ((a - (SMALL_DVALUE / 2.0)) > b)
-
-/*************************************************************************
-|*
-|* Bucket fuer Kantenliste, vertikaler Teil
-|*
-\************************************************************************/
-
-BASE3D_IMPL_BUCKET(B3dEdgeList, Bucket)
-
-/*************************************************************************
-|*
-|* Bucket fuer Kantenliste, horizontaler Teil
-|*
-\************************************************************************/
-
-BASE3D_IMPL_BUCKET(B3dEdgeEntry, Bucket)
-
-/*************************************************************************
-|*
-|* Konstruktor
-|*
-\************************************************************************/
-
-B3dComplexPolygon::B3dComplexPolygon()
-: aEntityBuffer(14), // 16K
- aEdgeList(12), // 4K
- aEdgeEntry(12) // 4K
-{
- EmptyBuffers();
- bTestForCut = TRUE;
- nHighestEdge = 0L;
- pBase3D = NULL;
- pGeometry = NULL;
- pLastVertex = NULL;
-}
-
-/*************************************************************************
-|*
-|* Gib einen neuen freien Eintrag zurueck
-|*
-\************************************************************************/
-
-B3dEntity &B3dComplexPolygon::GetFreeEntity()
-{
- aEntityBuffer.Append();
- return aEntityBuffer[aEntityBuffer.Count() - 1];
-}
-
-/*************************************************************************
-|*
-|* Ein neuer Punkt ist ausgefuellt
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::PostAddVertex(B3dEntity &rVertex)
-{
- if(pLastVertex && ArePointsEqual(*pLastVertex, rVertex))
- {
- aEntityBuffer.Remove();
- return;
- }
-
- // #i27242#
- // Comparison for finding nHighestEdge has to start with first point. Due
- // to having this part inside of if(pLastVertex) it always started with the
- // second point. Thus, in 50% of the cases where the first point of the polygon
- // is the extreme point, the normal could be wrong.
- if(!nNewPolyStart)
- {
- if(nHighestEdge)
- TestHighestEdge(rVertex);
- else
- nHighestEdge = aEntityBuffer.Count();
- }
-
- // Zeiger auf letzten hinzugefuegten Punkt setzen
- pLastVertex = &rVertex;
-}
-
-/*************************************************************************
-|*
-|* Testet, ob die neue Edge in allen Freiheitsgraden groesser ist
-|* als die momentane
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::TestHighestEdge(B3dEntity& rVertex)
-{
- B3dEntity& rHighest = aEntityBuffer[nHighestEdge - 1];
- if(rVertex.GetX() <= rHighest.GetX())
- {
- if(rVertex.GetX() < rHighest.GetX())
- {
- nHighestEdge = aEntityBuffer.Count();
- }
- else
- {
- if(rVertex.GetY() <= rHighest.GetY())
- {
- if(rVertex.GetY() < rHighest.GetY())
- {
- nHighestEdge = aEntityBuffer.Count();
- }
- else
- {
- if(rVertex.GetZ() < rHighest.GetZ())
- {
- nHighestEdge = aEntityBuffer.Count();
- }
- }
- }
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Vergleicht zwei Punkte auf ihren INHALT
-|* und fuellt die 2D-Koordinaten aus
-|*
-\************************************************************************/
-
-BOOL B3dComplexPolygon::ArePointsEqual(B3dEntity& rFirst,
- B3dEntity& rSecond)
-{
- // Wenn der Punkt dem letzten gleich ist, gar nicht behandeln
- if(rFirst.Point() == rSecond.Point())
- return TRUE;
- return FALSE;
-}
-
-/*************************************************************************
-|*
-|* Alles auf Startzustand, buffer leeren
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::EmptyBuffers()
-{
- aEntityBuffer.Erase();
- nNewPolyStart = 0;
- bOrientationValid = FALSE;
- bNormalValid = FALSE;
-
- // EdgeList und EdgeEntries leeren
- pEdgeList = NULL;
- aEdgeList.Erase();
- aEdgeEntry.Erase();
-}
-
-/*************************************************************************
-|*
-|* Neues Teilpolygon beginnen
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::StartPrimitive()
-{
- // Bisherige Punkte verarbeiten
- if(aEntityBuffer.Count() > nNewPolyStart)
- ComputeLastPolygon();
-
- // Zeiger auf letzten Punkt loeschen
- pLastVertex = NULL;
-
- // Hoechten Punkt vergesset
- nHighestEdge = 0L;
-}
-
-/*************************************************************************
-|*
-|* Teilpolygon abschliessen
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::ComputeLastPolygon(BOOL bIsLast)
-{
- // Letzten Punkt mit erstem vergleichen, evtl
- // wegschmeissen
- if(pLastVertex)
- {
- if(ArePointsEqual(aEntityBuffer[nNewPolyStart], *pLastVertex))
- {
- // HighestEdge korrigieren, falls dieser geloescht werden soll
- if(nHighestEdge && nHighestEdge == aEntityBuffer.Count())
- nHighestEdge = nNewPolyStart + 1;
-
- aEntityBuffer.Remove();
- }
- }
-
- // Sind noch genug Punkte da?
- if(aEntityBuffer.Count() < nNewPolyStart + 3)
- {
- // Geometrie ausgeben, obwohl zuwenig Punkte fuer ein Polygon
- if(pBase3D)
- {
- pBase3D->StartPrimitive(Base3DPolygon);
- for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
- {
- pBase3D->SetEdgeFlag(aEntityBuffer[a].IsEdgeVisible());
- pBase3D->AddVertex(aEntityBuffer[a]);
- }
- pBase3D->EndPrimitive();
- }
- else if(pGeometry)
- {
- pGeometry->StartComplexPrimitive();
- for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
- pGeometry->AddComplexVertex(aEntityBuffer[a], aEntityBuffer[a].IsEdgeVisible());
- pGeometry->EndComplexPrimitive();
- }
- }
- else
- {
- if(!nNewPolyStart && bIsLast && IsConvexPolygon())
- {
- // Falls das PolyPolygon nur aus einem Polygon besteht
- // und es Konvex ist, ist man fertig.
- // Um die Qualitaet zu verbessern, wird fuer
- // Polygone ab einer gewissen Punktzahl ein
- // abschliessender Mittelpunkt generiert.
- if(pBase3D)
- {
- pBase3D->StartPrimitive(Base3DPolygon);
- if(aEntityBuffer.Count() > 4)
- {
- B3dEntity aNew;
- aNew.CalcMiddle(aEntityBuffer[0], aEntityBuffer[aEntityBuffer.Count() / 2]);
- pBase3D->SetEdgeFlag(FALSE);
- pBase3D->AddVertex(aNew);
- for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
- {
- pBase3D->SetEdgeFlag(aEntityBuffer[a].IsEdgeVisible());
- pBase3D->AddVertex(aEntityBuffer[a]);
- }
- pBase3D->SetEdgeFlag(FALSE);
- pBase3D->AddVertex(aEntityBuffer[0]);
- }
- else
- {
- for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
- {
- pBase3D->SetEdgeFlag(aEntityBuffer[a].IsEdgeVisible());
- pBase3D->AddVertex(aEntityBuffer[a]);
- }
- }
- pBase3D->EndPrimitive();
- }
- else if(pGeometry)
- {
- pGeometry->StartComplexPrimitive();
- if(aEntityBuffer.Count() > 4)
- {
- B3dEntity aNew;
- aNew.CalcMiddle(aEntityBuffer[0], aEntityBuffer[aEntityBuffer.Count() / 2]);
- pGeometry->AddComplexVertex(aNew, FALSE);
- for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
- pGeometry->AddComplexVertex(aEntityBuffer[a], aEntityBuffer[a].IsEdgeVisible());
- pGeometry->AddComplexVertex(aEntityBuffer[0], FALSE);
- }
- else
- {
- for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
- pGeometry->AddComplexVertex(aEntityBuffer[a], aEntityBuffer[a].IsEdgeVisible());
- }
- pGeometry->EndComplexPrimitive();
- }
- }
- else
- {
- if(!bNormalValid)
- ChooseNormal();
-
- // Einsortieren
- UINT32 nUpperBound = aEntityBuffer.Count();
-
- // Als Polygon behandeln
- if(GetTestForCut())
- {
- UINT32 a;
- for(a=nNewPolyStart + 1; a < nUpperBound; a++)
- AddEdgeCut(&aEntityBuffer[a-1], &aEntityBuffer[a]);
-
- // Polygon schliessen
- AddEdgeCut(&aEntityBuffer[a-1], &aEntityBuffer[nNewPolyStart]);
- }
- else
- {
- UINT32 a;
- for(a=nNewPolyStart + 1; a < nUpperBound; a++)
- AddEdge(&aEntityBuffer[a-1], &aEntityBuffer[a]);
-
- // Polygon schliessen
- AddEdge(&aEntityBuffer[a-1], &aEntityBuffer[nNewPolyStart]);
- }
-
- // Hier setzen, da evtl. bereits neue Punkte
- // durch Schnitte hinzugekommen sind
- nNewPolyStart = aEntityBuffer.Count();
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Orientierung des ersten Polygons ermitteln
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::ChooseNormal()
-{
- if(nHighestEdge)
- {
- UINT32 nHigh = nHighestEdge - 1;
- UINT32 nPrev = (nHigh != 0) ? nHigh - 1 : aEntityBuffer.Count() - 1;
- UINT32 nNext = (nHigh + 1 != aEntityBuffer.Count()) ? nHigh + 1 : nNewPolyStart;
-
- // Punkt, Vorgaenger und Nachfolger holen
- const basegfx::B3DPoint& rHigh = aEntityBuffer[nHigh].Point();
- const basegfx::B3DPoint& rPrev = aEntityBuffer[nPrev].Point();
- const basegfx::B3DPoint& rNext = aEntityBuffer[nNext].Point();
-
- // Normale bilden
- aNormal = basegfx::B3DVector(rPrev - rHigh).getPerpendicular(basegfx::B3DVector(rNext - rHigh));
- if(!aNormal.equalZero())
- aNormal.normalize();
- else
- aNormal = basegfx::B3DVector(0.0, 0.0, -1.0);
- }
- bNormalValid = TRUE;
-}
-
-/*************************************************************************
-|*
-|* Komplexes Polygon ausgeben
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::EndPrimitive(Base3D* pB3D)
-{
- // Funktionszeiger setzen
- pBase3D = pB3D;
-
- // Letztes angefangenes Poly verarbeiten
- ComputeLastPolygon(TRUE);
-
- // Wenn es Kanten gibt
- if(pEdgeList)
- {
- // Dreiecke generieren und ausgeben
- pBase3D->StartPrimitive(Base3DTriangles);
- while(pEdgeList)
- ExtractTriangle();
- pBase3D->EndPrimitive();
- }
-
- // Buffer leeren
- EmptyBuffers();
-
- // Zeiger wieder loeschen
- pBase3D = NULL;
-}
-
-void B3dComplexPolygon::EndPrimitive(B3dGeometry *pGeom)
-{
- // Funktionszeiger setzen
- pGeometry = pGeom;
-
- // Letztes angefangenes Poly verarbeiten
- ComputeLastPolygon(TRUE);
-
- // Dreiecke generieren und ausgeben
- while(pEdgeList)
- ExtractTriangle();
-
- // Buffer leeren
- EmptyBuffers();
-
- // Zeiger wieder loeschen
- pGeometry = NULL;
-}
-
-/*************************************************************************
-|*
-|* Teste aktuelles Polygon (0..aEntityBuffer.Count()) auf Konvexitaet
-|*
-\************************************************************************/
-
-BOOL B3dComplexPolygon::IsConvexPolygon()
-{
- B3dEntity* pFirst = &aEntityBuffer[aEntityBuffer.Count() - 2];
- B3dEntity* pSecond = &aEntityBuffer[aEntityBuffer.Count() - 1];
- B3dEntity* pThird = &aEntityBuffer[0];
- BOOL bDirection = IsLeft(pSecond, pFirst, pThird);
- BOOL bOrder = CompareOrder(pSecond, pThird);
- UINT16 nDirChanges(0);
-
- for(UINT32 a = 1; nDirChanges <= 2 && a < aEntityBuffer.Count(); a++)
- {
- pFirst = pSecond;
- pSecond = pThird;
- pThird = &aEntityBuffer[a];
-
- if(IsLeft(pSecond, pFirst, pThird) != bDirection)
- return FALSE;
-
- if(CompareOrder(pSecond, pThird) != bOrder)
- {
- nDirChanges++;
- bOrder = !bOrder;
- }
- }
- // Zuviele aenderungen der Ordnung, auf keinen Fall Convex
- if(nDirChanges > 2)
- return FALSE;
-
- return TRUE;
-}
-
-/*************************************************************************
-|*
-|* Lexikografische Ordnung der beiden Punkte
-|*
-\************************************************************************/
-
-BOOL B3dComplexPolygon::CompareOrder(B3dEntity* pFirst, B3dEntity* pSecond)
-{
- if(pFirst->GetX() < pSecond->GetX())
- return FALSE;
- if(pFirst->GetX() > pSecond->GetX())
- return TRUE;
- if(pFirst->GetY() < pSecond->GetY())
- return FALSE;
- return TRUE;
-}
-
-/*************************************************************************
-|*
-|* Teste, ob die Punkte der Kante getauscht werden muessen
-|*
-\************************************************************************/
-
-BOOL B3dComplexPolygon::DoSwap(B3dEntity* pStart, B3dEntity* pEnd)
-{
- if(DOUBLE_EQUAL(pStart->GetY(), pEnd->GetY()))
- {
- if(pStart->GetX() > pEnd->GetX())
- return TRUE;
- }
- else
- {
- if(pStart->GetY() > pEnd->GetY())
- return TRUE;
- }
- return FALSE;
-}
-
-/*************************************************************************
-|*
-|* Kante nInd1, nInd2 zu Kantenliste hinzufuegen
-|*
-\************************************************************************/
-
-B3dEdgeEntry* B3dComplexPolygon::AddEdge(B3dEntity* pStart, B3dEntity* pEnd)
-{
- if(DoSwap(pStart, pEnd))
- return InsertEdge(GetList(pEnd), pStart, TRUE);
- return InsertEdge(GetList(pStart), pEnd, TRUE);
-}
-
-/*************************************************************************
-|*
-|* Einen Listeneintrag suchen oder neu anlegen
-|* Liefert immer einen Listeneintrag zurueck
-|*
-\************************************************************************/
-
-B3dEdgeList* B3dComplexPolygon::GetList(B3dEntity* pStart)
-{
- B3dEdgeList* pList = pEdgeList;
- B3dEdgeList* pLast = NULL;
-
- while(pList && pList->GetStart() != pStart && DoSwap(pStart, pList->GetStart()))
- {
- pLast = pList;
- pList = pList->GetDown();
- }
-
- if(pList)
- {
- if(pList->GetStart() != pStart)
- {
- if(DOUBLE_NOT_EQUAL(pStart->GetX(), pList->GetXPos()) || DOUBLE_NOT_EQUAL(pStart->GetY(), pList->GetYPos()))
- {
- // Auf jeden Fall ein neuer Eintrag
- aEdgeList.Append();
- B3dEdgeList* pNewList = &aEdgeList[aEdgeList.Count() - 1];
- pNewList->Reset();
- pNewList->SetStart(pStart);
-
- // vor pList einhaengen
- // pLast KANN NULL SEIN!
- pNewList->SetDown(pList);
- pList->SetParent(pNewList);
- if(pLast)
- {
- pNewList->SetParent(pLast);
- pLast->SetDown(pNewList);
- }
- else
- {
- pEdgeList = pNewList;
- }
-
- // Returnwert setzen
- pList = pNewList;
- }
- else
- {
- // pList->GetStart() != pStart, aber
- // die Koordinaten sind praktisch identisch!
- // Gib diese Liste zurueck, d.h.
- // tue gar nichts
- }
- }
- }
- else
- {
- // pLast->GetYPos() < pStart->GetY(),
- // Hinten anhaengen
- aEdgeList.Append();
- pList = &aEdgeList[aEdgeList.Count() - 1];
- pList->Reset();
- pList->SetStart(pStart);
- if(pLast)
- {
- pList->SetParent(pLast);
- pLast->SetDown(pList);
- }
- else
- {
- pEdgeList = pList;
- }
- }
- return pList;
-}
-
-/*************************************************************************
-|*
-|* Eine Kante in eine Kantenliste einsortieren
-|* Die Kante wird dabei neu erzeugt
-|*
-\************************************************************************/
-
-B3dEdgeEntry* B3dComplexPolygon::InsertEdge(B3dEdgeList* pList,
- B3dEntity* pEnd, BOOL bEdgeVisible)
-{
- B3dEdgeEntry* pEntry = pList->GetEntries();
-
- // Immer ein neuer Eintrag
- aEdgeEntry.Append();
- B3dEdgeEntry* pNewEntry = &aEdgeEntry[aEdgeEntry.Count() - 1];
- pNewEntry->Reset();
- pNewEntry->SetEnd(pEnd);
- pNewEntry->SetParent(pList);
- pNewEntry->SetEdgeVisible(bEdgeVisible);
-
- if(pEntry)
- {
- B3dEdgeEntry* pLast = NULL;
- double fSlant = GetSlant(pNewEntry);
- while(pEntry
- && GetSlant(pEntry) < fSlant)
- {
- pLast = pEntry;
- pEntry = pEntry->GetRight();
- }
-
- if(pEntry)
- {
- // GetSlant(pEntry) < fSlant
- // GetSlant(pLast) >= fSlant
- // Neuen Eintrag hinter pLast einfuegen
- // pLast KANN NULL SEIN!
- pNewEntry->SetRight(pEntry);
- if(pLast)
- {
- pLast->SetRight(pNewEntry);
- }
- else
- {
- pList->SetEntries(pNewEntry);
- }
- }
- else
- {
- // GetSlant(pEntry) >= fSlant
- // Neuen Eintrag am Ende anhaengen
- pLast->SetRight(pNewEntry);
- }
- }
- else
- {
- pList->SetEntries(pNewEntry);
- }
- // Returnwert
- return pNewEntry;
-}
-
-/*************************************************************************
-|*
-|* Steigung der Kante liefern
-|*
-\************************************************************************/
-
-double B3dComplexPolygon::GetSlant(B3dEdgeEntry* pEdge)
-{
- double fDivisor = pEdge->GetYPos() - pEdge->GetParent()->GetYPos();
- if(fabs(fDivisor) < SMALL_DVALUE)
- return DBL_MAX;
- return (pEdge->GetXPos() - pEdge->GetParent()->GetXPos()) / fDivisor;
-}
-
-/*************************************************************************
-|*
-|* Auf Schnitt mit einer vorhandenen Kante testen
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::TestForCut(B3dEdgeEntry* pEntry)
-{
- // pEntry: die bereits eingefuegte neue Kante, die mit allen
- // aelteren Kanten geschnitten werden soll
- B3dEdgeList* pList = pEdgeList;
-
- while(pList && DOUBLE_SMALLER(pList->GetYPos(), pEntry->GetYPos()))
- {
- // nur in Gruppen mit anderem Startpunkt suchen
- if(pList != pEntry->GetParent())
- {
- B3dEdgeEntry* pTestEntry = pList->GetEntries();
-
- while(pTestEntry)
- {
- if(DOUBLE_BIGGER(pTestEntry->GetYPos(), pEntry->GetParent()->GetYPos()))
- {
- // es existiert eine vertikale Bereichsueberschneidung
- // Min/Max fuer pEntry holen
- double fXMin = pEntry->GetXPos();
- double fXMax = pEntry->GetParent()->GetXPos();
- if(fXMin > fXMax)
- {
- double fSwap = fXMin;
- fXMin = fXMax;
- fXMax = fSwap;
- }
-
- // Min/Max in X fuer Kandidat holen
- double fTestXMin = pTestEntry->GetXPos();
- double fTestXMax = pList->GetXPos();
- if(fTestXMin > fTestXMax)
- {
- double fSwap = fTestXMin;
- fTestXMin = fTestXMax;
- fTestXMax = fSwap;
- }
-
- if(fTestXMin < fXMax && fTestXMax > fXMin)
- {
- // es existiert eine horizontale Bereichsueberschneidung
- // ein Schnitt ist moeglich
- double fCut = FindCut(pEntry, pTestEntry);
-
- if(fCut != 0.0)
- {
- // Schnitt existiert! fCut ist aus dem Parameterbereich
- // der ersten Kante, also pEntry. Neuen Punkt erzeugen.
- B3dEntity& rNew = GetFreeEntity();
- rNew.CalcInBetween(*pEntry->GetParent()->GetStart(), *pEntry->GetEnd(), fCut);
-
- // Neuen Punkt und neue von diesem ausgehende Kanten erzeugen
- B3dEdgeList* pNewPointList = GetList(&rNew);
- B3dEdgeEntry* pEntry2 = InsertEdge(pNewPointList, pEntry->GetEnd(), pEntry->IsEdgeVisible());
- InsertEdge(pNewPointList, pTestEntry->GetEnd(), pTestEntry->IsEdgeVisible());
-
- // Beteiligte Entries kuerzen
- pEntry->SetEnd(&rNew);
- pTestEntry->SetEnd(&rNew);
-
- // Das neue Ende von pEntry kann weitere Linien
- // schneiden, also geht der test mit diesem weiter
- TestForCut(pEntry2);
-
- // Test mit gekuerztem pEntry fortsetzen
- }
- }
- }
-
- // naechster Entry
- pTestEntry = pTestEntry->GetRight();
- }
- }
-
- // naechste Liste
- pList = pList->GetDown();
- }
-}
-
-/*************************************************************************
-|*
-|* Berechne den Schnitt zwischen den beiden Kanten und gib den
-|* Schnittpunkt im Parameterbereich der 1. Kante zurueck
-|*
-\************************************************************************/
-
-double B3dComplexPolygon::FindCut(B3dEdgeEntry* pEdge1, B3dEdgeEntry* pEdge2)
-{
- double fRetval = 0.0;
- double fDeltaEdge2Y = pEdge2->GetYPos() - pEdge2->GetParent()->GetYPos();
- double fDeltaEdge2X = pEdge2->GetXPos() - pEdge2->GetParent()->GetXPos();
- double fDeltaEdge1X = pEdge1->GetXPos() - pEdge1->GetParent()->GetXPos();
- double fDeltaEdge1Y = pEdge1->GetYPos() - pEdge1->GetParent()->GetYPos();
-
- // Dynamische Grenze fuer parallelitaet berechnen
- double fSmallValue = fabs((fDeltaEdge2Y + fDeltaEdge2X + fDeltaEdge1X + fDeltaEdge1Y) * (SMALL_DVALUE / 4.0));
- double fZwi = (fDeltaEdge1X * fDeltaEdge2Y) - (fDeltaEdge1Y * fDeltaEdge2X);
-
- if(fabs(fZwi) > fSmallValue)
- {
- fZwi = (fDeltaEdge2Y * (pEdge2->GetParent()->GetXPos() - pEdge1->GetParent()->GetXPos())
- + fDeltaEdge2X * (pEdge1->GetParent()->GetYPos() - pEdge2->GetParent()->GetYPos())) / fZwi;
-
- // Im Parameterbereich der ersten Kante (ohne Punkte) ?
- if(fZwi > fSmallValue && fZwi < 1.0 - fSmallValue)
- {
- // Schnitt liegt im Parameterbereich der ersten
- // Linie, aber auch in dem der zweiten?
- if(fabs(fDeltaEdge2X) > fSmallValue && fabs(fDeltaEdge2X) > fabs(fDeltaEdge2Y))
- {
- fDeltaEdge2Y = (pEdge1->GetParent()->GetXPos() + fZwi
- * fDeltaEdge1X - pEdge2->GetParent()->GetXPos()) / fDeltaEdge2X;
-
- // Parameterbereich der zweiten schliesst Start/Ende mit ein!
- if(fDeltaEdge2Y > -fSmallValue && fDeltaEdge2Y < 1.0 + fSmallValue)
- {
- // Ja. Zuweisen.
- fRetval = fZwi;
- }
- }
- else if(fabs(fDeltaEdge2Y) > fSmallValue)
- {
- fDeltaEdge2X = (pEdge1->GetParent()->GetYPos() + fZwi
- * fDeltaEdge1Y - pEdge2->GetParent()->GetYPos()) / fDeltaEdge2Y;
-
- // Parameterbereich der zweiten schliesst Start/Ende mit ein!
- if(fDeltaEdge2X > -fSmallValue && fDeltaEdge2X < 1.0 + fSmallValue)
- {
- // Ja. Zuweisen.
- fRetval = fZwi;
- }
- }
- }
- }
- return fRetval;
-}
-
-/*************************************************************************
-|*
-|* Testet, ob die angegebene Kante schon existiert
-|* Ja: Entfernen
-|* Nein: Einfuegen
-|*
-\************************************************************************/
-
-BOOL B3dComplexPolygon::SwitchEdgeExistance(B3dEntity* pStart,
- B3dEntity* pEnd)
-{
- if(DoSwap(pStart, pEnd))
- {
- B3dEntity* pZwi = pStart;
- pStart = pEnd;
- pEnd = pZwi;
- }
-
- if(pEdgeList)
- {
- // Suchen
- B3dEdgeList* pList = pEdgeList;
- while(pList && pList->GetStart() != pStart)
- pList = pList->GetDown();
-
- if(pList && pList->GetStart() == pStart)
- {
- // Liste gefunden, Eintrag mit Endpunkt
- // pEnd finden
- B3dEdgeEntry* pEntry = pList->GetEntries();
- B3dEdgeEntry* pLeft = NULL;
-
- while(pEntry)
- {
- if(pEntry->GetEnd() == pEnd)
- {
- // Kante existiert, austragen
- // Liste ist pList
- // Links ist pLeft
- if(pLeft)
- {
- pLeft->SetRight(pEntry->GetRight());
- }
- else
- {
- if(pEntry->GetRight())
- pList->SetEntries(pEntry->GetRight());
- else
- RemoveEdgeList(pList);
- }
- // fertig
- return TRUE;
- }
-
- // naechste Kante
- pLeft = pEntry;
- pEntry = pEntry->GetRight();
- }
-
- // Liste existiert, aber der EdgeEintrag nicht.
- // Fuege diesen hinzu
- InsertEdge(pList, pEnd, FALSE);
-
- // fertig
- return FALSE;
- }
- }
- // Liste und Eintrag existieren nicht
- // Erzeuge beides
- InsertEdge(GetList(pStart), pEnd, FALSE);
-
- return FALSE;
-}
-
-/*************************************************************************
-|*
-|* Entferne die Kante aus der Kantenliste. Tue alles weitere,
-|* um die Struktur weiter aufzuloesen
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::RemoveFirstEdge(B3dEdgeList* pList)
-{
- if(pList->GetEntries()->GetRight())
- pList->SetEntries(pList->GetEntries()->GetRight());
- else
- RemoveEdgeList(pList);
-}
-
-/*************************************************************************
-|*
-|* Entferne die Kantenliste. Tue alles weitere,
-|* um die Struktur weiter aufzuloesen
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::RemoveEdgeList(B3dEdgeList* pList)
-{
- if(pList->GetDown())
- pList->GetDown()->SetParent(pList->GetParent());
- if(pList->GetParent())
- pList->GetParent()->SetDown(pList->GetDown());
- else
- {
- // Es gibt keinen parent mehr
- pEdgeList = pList->GetDown();
- }
-}
-
-/*************************************************************************
-|*
-|* Extrahiere das naechste Dreieck aus der Kantenliste
-|* und zeichne es
-|*
-\************************************************************************/
-
-void B3dComplexPolygon::ExtractTriangle()
-{
- B3dEdgeEntry* pLeft = pEdgeList->GetEntries();
- B3dEdgeEntry* pRight = pLeft->GetRight();
-
- if(!pRight)
- {
-// DBG_ASSERT(0, "AW: Einzelne Kante als Startpunkt!");
- RemoveFirstEdge(pEdgeList);
- return;
- }
-
- B3dEdgeList* pList = FindStartInTriangle();
- BOOL bNotAllAligned = (fabs(GetSlant(pLeft) - GetSlant(pRight)) > SMALL_DVALUE);
- BOOL bStartIsEdgePoint = FALSE;
- if(pList)
- {
- const basegfx::B3DPoint& rListStart = pList->GetStart()->Point();
- if(rListStart.equal(pEdgeList->GetStart()->Point()))
- bStartIsEdgePoint = TRUE;
- else if(rListStart.equal(pLeft->GetEnd()->Point()))
- bStartIsEdgePoint = TRUE;
- else if(rListStart.equal(pRight->GetEnd()->Point()))
- bStartIsEdgePoint = TRUE;
- }
-
- if(pList && bNotAllAligned && !bStartIsEdgePoint)
- {
- // Zerlegen in 2 Teildreiecke
- // Erstes Teildreieck
- InsertEdge(pEdgeList, pList->GetStart(), FALSE);
- ExtractTriangle();
-
- // Zweites Teildreieck
- InsertEdge(pEdgeList, pList->GetStart(), FALSE);
- ExtractTriangle();
- }
- else
- {
- B3dEntity* pEntLeft = pLeft->GetEnd();
- B3dEntity* pEntRight = pRight->GetEnd();
- B3dEntity* pEntTop = pEdgeList->GetStart();
- BOOL bLeftVisible = pLeft->IsEdgeVisible();
- BOOL bRightVisible = pRight->IsEdgeVisible();
-
- RemoveFirstEdge(pEdgeList);
- RemoveFirstEdge(pEdgeList);
-
- if(pEntLeft != pEntRight)
- {
- // Merken, ob die Abschlusslinie existiert hat oder nicht
- BOOL bDidEdgeExist = SwitchEdgeExistance(pEntLeft, pEntRight);
-
- if(DOUBLE_NOT_EQUAL(pEntLeft->GetY(), pEntTop->GetY())
- || DOUBLE_NOT_EQUAL(pEntRight->GetY(), pEntTop->GetY()))
- {
- if(!bOrientationValid)
- {
- // Anhand des ersten Dreiecks entscheiden,
- // in welcher Orientierung die Dreiecke
- // auszugeben sind
- basegfx::B3DVector aTmpNormal(basegfx::B3DVector(pEntLeft->Point() - pEntTop->Point()).getPerpendicular(pEntRight->Point() - pEntTop->Point()));
- bOrientation = (aNormal.scalar(aTmpNormal) > 0.0) ? TRUE : FALSE;
- bOrientationValid = TRUE;
- }
-
- // Dreieck ausgeben
- if(pBase3D)
- {
- if(bOrientation)
- {
- // Rechtsrum
- pBase3D->SetEdgeFlag(bRightVisible);
- pBase3D->AddVertex(*pEntTop);
- pBase3D->SetEdgeFlag(bDidEdgeExist);
- pBase3D->AddVertex(*pEntRight);
- pBase3D->SetEdgeFlag(bLeftVisible);
- pBase3D->AddVertex(*pEntLeft);
- }
- else
- {
- // Linksrum
- pBase3D->SetEdgeFlag(bLeftVisible);
- pBase3D->AddVertex(*pEntTop);
- pBase3D->SetEdgeFlag(bDidEdgeExist);
- pBase3D->AddVertex(*pEntLeft);
- pBase3D->SetEdgeFlag(bRightVisible);
- pBase3D->AddVertex(*pEntRight);
- }
- }
- else if(pGeometry)
- {
- pGeometry->StartComplexPrimitive();
- if(bOrientation)
- {
- // Rechtsrum
- pGeometry->AddComplexVertex(*pEntTop, bRightVisible);
- pGeometry->AddComplexVertex(*pEntRight, bDidEdgeExist);
- pGeometry->AddComplexVertex(*pEntLeft, bLeftVisible);
- }
- else
- {
- // Linksrum
- pGeometry->AddComplexVertex(*pEntTop, bLeftVisible);
- pGeometry->AddComplexVertex(*pEntLeft, bDidEdgeExist);
- pGeometry->AddComplexVertex(*pEntRight, bRightVisible);
- }
- pGeometry->EndComplexPrimitive();
- }
- }
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Suche nach einem fremden Startpunkt innerhalb des zu zeichnenden
-|* naechsten Dreiecks
-|*
-\************************************************************************/
-
-B3dEdgeList* B3dComplexPolygon::FindStartInTriangle()
-{
- B3dEdgeList* pList = pEdgeList->GetDown();
- if(pList)
- {
- B3dEdgeEntry* pLeft = pEdgeList->GetEntries();
- B3dEdgeEntry* pRight = pLeft->GetRight();
-
- double fYMax = pLeft->GetYPos();
- double fZwi = pRight->GetYPos();
- if(fZwi > fYMax)
- fYMax = fZwi;
-
- if(pList->GetYPos() <= fYMax)
- {
- B3dEntity* pTop = pEdgeList->GetStart();
- double fXMin = pLeft->GetXPos();
- double fXMax = pRight->GetXPos();
- if(fXMin > fXMax)
- {
- fZwi = fXMin;
- fXMin = fXMax;
- fXMax = fZwi;
- }
-
- double fXTop = pTop->GetX();
- if(fXMin > fXTop)
- fXMin = fXTop;
- if(fXMax < fXTop)
- fXMax = fXTop;
-
- while(pList
- && pList->GetYPos() <= fYMax)
- {
- if(pList->GetXPos() > fXMin && pList->GetXPos() < fXMax)
- {
- if(pList->GetStart() != pLeft->GetEnd()
- && pList->GetStart() != pRight->GetEnd())
- {
- if(IsLeft(pTop, pLeft->GetEnd(), pList->GetStart()))
- {
- if(DOUBLE_NOT_EQUAL(pList->GetXPos(), pLeft->GetXPos())
- || DOUBLE_NOT_EQUAL(pList->GetYPos(), pLeft->GetYPos()))
- {
- if(IsLeft(pRight->GetEnd(), pTop, pList->GetStart()))
- {
- if(DOUBLE_NOT_EQUAL(pList->GetXPos(), pRight->GetXPos())
- || DOUBLE_NOT_EQUAL(pList->GetYPos(), pRight->GetYPos()))
- {
- if(IsLeft(pLeft->GetEnd(), pRight->GetEnd(),
- pList->GetStart()))
- {
- return pList;
- }
- }
- }
- }
- }
- }
- }
- // naechste Liste
- pList = pList->GetDown();
- }
- }
- }
- return NULL;
-}
-
-/*************************************************************************
-|*
-|* Testen, auf welcher Seite pPoint von der Linie pTop, pDirection liegt
-|*
-\************************************************************************/
-
-BOOL B3dComplexPolygon::IsLeft(B3dEntity* pTop, B3dEntity* pDirection,
- B3dEntity* pPoint)
-{
- double fDirX = pDirection->GetX() - pTop->GetX();
- double fDirY = pDirection->GetY() - pTop->GetY();
- double fPntX = pPoint->GetX() - pTop->GetX();
- double fPntY = pPoint->GetY() - pTop->GetY();
-
- return ((fDirX * fPntY - fDirY * fPntX) <= 0.0);
-}
-
diff --git a/goodies/source/base3d/b3ddeflt.cxx b/goodies/source/base3d/b3ddeflt.cxx
deleted file mode 100644
index 17081629b704..000000000000
--- a/goodies/source/base3d/b3ddeflt.cxx
+++ /dev/null
@@ -1,1956 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3ddeflt.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include "b3ddeflt.hxx"
-#include "b3dtrans.hxx"
-#include <vcl/outdev.hxx>
-#include <vcl/bmpacc.hxx>
-#include <vcl/bitmapex.hxx>
-#include "b3dtex.hxx"
-
-/*************************************************************************
-|*
-|* Konstruktor Base3DDefault
-|*
-\************************************************************************/
-
-Base3DDefault::Base3DDefault(OutputDevice* pOutDev)
-: Base3DCommon(pOutDev),
- aZBuffer(),
- aPicture(),
- aMonoTransparence(),
- aAlphaTransparence(),
- aClearValue(Color(0x00ffffff)),
- pZBufferWrite(NULL),
- pPictureWrite(NULL),
- pTransparenceWrite(NULL),
- fDetail(1.0),
- fDetailBackup( -1.0 ),
- nMaxPixels(500000),
- bReducedDetail(FALSE),
- bDetailBackedup(FALSE),
- mbPTCorrection(sal_True)
-
-{
-}
-
-/*************************************************************************
-|*
-|* Destruktor Base3DDefault
-|*
-\************************************************************************/
-
-Base3DDefault::~Base3DDefault()
-{
- // Alle Bitmap-Zugriffe freigeben
- ReleaseAccess();
-}
-
-/*************************************************************************
-|*
-|* Typbestimmung
-|*
-\************************************************************************/
-
-UINT16 Base3DDefault::GetBase3DType()
-{
- return BASE3D_TYPE_DEFAULT;
-}
-
-/*************************************************************************
-|*
-|* Darstellungsqualitaet setzen
-|*
-\************************************************************************/
-
-void Base3DDefault::SetDisplayQuality(sal_uInt8 nNew)
-{
- // Entsprechende PixelGrenze setzen
- SetMaxPixels(((sal_Int32)nNew * 3500) + 3500);
-
- // call parent
- Base3D::SetDisplayQuality(nNew);
-}
-
-/*************************************************************************
-|*
-|* Vergroeberungsstufe setzen
-|*
-\************************************************************************/
-
-void Base3DDefault::SetDetail(double fNew)
-{
- // nach unten begrenzen
- if(fNew > 1.0)
- fNew = 1.0;
-
- fDetail = fNew;
- if(fDetail < 1.0)
- {
- bReducedDetail = TRUE;
- }
- else
- {
- bReducedDetail = FALSE;
- }
-}
-
-/*************************************************************************
-|*
-|* BitmapAccess holen
-|*
-\************************************************************************/
-
-void Base3DDefault::AcquireAccess()
-{
- // Alle accesses holen
- pZBufferWrite = aZBuffer.AcquireWriteAccess();
- pPictureWrite = aPicture.AcquireWriteAccess();
- pTransparenceWrite = (GetTransparentPartsContainedHint())
- ? aAlphaTransparence.AcquireWriteAccess()
- : aMonoTransparence.AcquireWriteAccess();
-}
-
-/*************************************************************************
-|*
-|* BitmapAccess freigeben
-|*
-\************************************************************************/
-
-void Base3DDefault::ReleaseAccess()
-{
- // Alle accesses wieder freigeben
- if(pZBufferWrite)
- {
- delete pZBufferWrite;
- pZBufferWrite = NULL;
- }
-
- if(pPictureWrite)
- {
- delete pPictureWrite;
- pPictureWrite = NULL;
- }
-
- if(pTransparenceWrite)
- {
- delete pTransparenceWrite;
- pTransparenceWrite = NULL;
- }
-}
-
-/*************************************************************************
-|*
-|* Start der Szenenbeschreibung:
-|*
-\************************************************************************/
-
-void Base3DDefault::StartScene()
-{
- // Zugriffe freigeben
- ReleaseAccess();
-
- // Groesse der Bitmaps anpassen?
- sal_Bool bSizeHasChanged = (aLocalSizePixel.GetSize() != aPicture.GetSizePixel());
-
- // Neue BitMaps fuer ZBuffer und Picture allokieren
- if(bSizeHasChanged || !aZBuffer || !aPicture)
- {
- aZBuffer = Bitmap(aLocalSizePixel.GetSize(), 24);
- aPicture = Bitmap(aLocalSizePixel.GetSize(), 24);
- }
-
- // ZBuffer loeschen
- aZBuffer.Erase(aClearValue);
-
- // Bild loeschen
- aPicture.Erase( GetOutputDevice()->GetBackground().GetColor() );
-
- // Neue Transparenz-Bitmap allokieren
- if(GetTransparentPartsContainedHint())
- {
- // Alpha-Channel
- if(bSizeHasChanged || !aAlphaTransparence)
- {
- aAlphaTransparence = AlphaMask(aLocalSizePixel.GetSize());
- if(!!aMonoTransparence)
- aMonoTransparence = Bitmap();
- }
-
- // zu Beginn alles transparent
- aAlphaTransparence.Erase(BYTE(0xff));
- }
- else
- {
- // Mono-Channel
- if(bSizeHasChanged || !aMonoTransparence)
- {
- aMonoTransparence = Bitmap(aLocalSizePixel.GetSize(), 1);
- if(!!aAlphaTransparence)
- aAlphaTransparence = AlphaMask();
- }
-
- // zu Beginn alles transparent
- Color aEraseCol(COL_WHITE);
- aMonoTransparence.Erase(aEraseCol);
- }
-
- // Zugriffe wieder holen
- AcquireAccess();
-
- // lokale ClipRegion anpassen
- if(IsScissorRegionActive())
- {
- // Default specifics for scissoring
- aDefaultScissorRectangle = GetScissorRegionPixel();
- aDefaultScissorRectangle -= aSizePixel.TopLeft();
-
- // Detailstufe beachten
- if(bReducedDetail && fDetail != 0.0)
- {
- sal_Int32 nReducedWidth = (sal_Int32)((double)(aDefaultScissorRectangle.GetWidth() - 1) * fDetail);
- sal_Int32 nReducedHeight = (sal_Int32)((double)(aDefaultScissorRectangle.GetHeight() - 1)* fDetail);
- aDefaultScissorRectangle.SetSize(Size(nReducedWidth + 1, nReducedHeight + 1));
- }
- }
-
- // #i71618#
- // derive maPolygonOffset from mfPolygonOffset and use instead of old
- // POLYGONOFFSET_VALUE which was much to low with default of 120
- maPolygonOffset = (sal_uInt32)(getPolygonOffset() * ZBUFFER_DEPTH_RANGE);
-
- // call parent
- Base3DCommon::StartScene();
-}
-
-/*************************************************************************
-|*
-|* Ende der Szenenbeschreibung:
-|*
-\************************************************************************/
-
-void Base3DDefault::EndScene()
-{
- // Zugriffe freigeben
- ReleaseAccess();
-
- // Ausgabe der erzeugten BitMap
- BitmapEx aBitmapEx;
-
- if(GetTransparentPartsContainedHint())
- {
- // Alpha-Transparenz
- aBitmapEx = BitmapEx(aPicture, aAlphaTransparence);
- }
- else
- {
- // Mono-Transparenz
- aBitmapEx = BitmapEx(aPicture, aMonoTransparence);
- }
-
- // Dithern
- UINT16 nBitCount = GetOutputDevice()->GetBitCount();
- if( GetOutputDevice()->GetOutDevType() != OUTDEV_PRINTER && nBitCount <= 16 && GetDither())
- {
- aBitmapEx.Dither(nBitCount <= 8
- ? BMP_DITHER_MATRIX
- : BMP_DITHER_FLOYD_16);
- }
-
- if(GetOutputDevice()->GetConnectMetaFile() != NULL)
- {
- Rectangle aLogicRect;
- aLogicRect = GetOutputDevice()->PixelToLogic(aSizePixel);
- aBitmapEx.Draw(GetOutputDevice(), aLogicRect.TopLeft(), aLogicRect.GetSize());
- }
- else
- {
- sal_Bool bWasEnabled = GetOutputDevice()->IsMapModeEnabled();
- GetOutputDevice()->EnableMapMode(FALSE);
-
-#ifdef DBG_UTIL // draw for testing
- static sal_Bool bDoDrawBitmapForTesting(FALSE);
- if(bDoDrawBitmapForTesting)
- {
- Bitmap aBmp( aBitmapEx.GetMask() );
- aBmp.Convert( BMP_CONVERSION_4BIT_COLORS );
- aBmp.Replace( COL_WHITE, COL_LIGHTRED );
- GetOutputDevice()->DrawBitmap( aSizePixel.TopLeft(), aSizePixel.GetSize(), aBmp );
- GetOutputDevice()->SetFillColor( COL_LIGHTRED );
- GetOutputDevice()->SetLineColor( COL_LIGHTRED );
- GetOutputDevice()->DrawRect( aSizePixel );
- }
-#endif
-
- aBitmapEx.Draw(GetOutputDevice(), aSizePixel.TopLeft(), aSizePixel.GetSize());
- GetOutputDevice()->EnableMapMode(bWasEnabled);
- }
-
- // Zugriffe wieder holen
- AcquireAccess();
-
- // eventuelle temporaere Reduzierung der Aufloesung zuruecknehmen
- if(bDetailBackedup)
- {
- SetDetail(fDetailBackup);
- bDetailBackedup = FALSE;
- }
-
- // call parent
- Base3DCommon::EndScene();
-}
-
-/*************************************************************************
-|*
-|* Callbacks bei Matrixaenderungen
-|*
-|* Ausgaberechteck innerhalb des OutputDevice festlegen. Die Koordinaten
-|* sind device-spezifisch, muessen also evtl. erst auf pixelkoordinaten
-|* umgerechnet werden
-|*
-\************************************************************************/
-
-void Base3DDefault::SetTransformationSet(B3dTransformationSet* pSet)
-{
- // call parent
- Base3DCommon::SetTransformationSet(pSet);
-
- if(GetTransformationSet())
- {
- // eventuelle temporaere Reduzierung der Aufloesung zuruecknehmen
- if(bDetailBackedup)
- {
- SetDetail(fDetailBackup);
- bDetailBackedup = FALSE;
- }
-
- // Neue Groesse fuer die Ausgabe
- aSizePixel = GetOutputDevice()->LogicToPixel(
- GetTransformationSet()->GetLogicalViewportBounds());
-
- // Eventuell durch ClipRegion eingeschraenkt? Dies
- // muss beachtet werden
- if(IsScissorRegionActive())
- {
- // draw region even smaller
- aSizePixel.Intersection(GetScissorRegionPixel());
- }
-
- // Testen, ob die Bitmap zu gross wird
- aLocalSizePixel = aSizePixel;
-
- double fQuadSize = aLocalSizePixel.GetWidth(); // sj: #i40320# solved overrun
- fQuadSize *= aLocalSizePixel.GetHeight();
-
- if( fQuadSize > GetMaxPixels() )
- {
- // Groesse reduzieren
- double fFactor = sqrt((double)GetMaxPixels() / fQuadSize);
-
- // Bei Druckjobs die Reduzierung einschraenken
- if(fFactor < 0.25 && GetOutputDevice()->GetOutDevType() == OUTDEV_PRINTER)
- fFactor = 0.25;
-
- // Wird hier mehr reduziert als sowieso schon eingestellt ist?
- if(fFactor < fDetail)
- {
- fDetailBackup = GetDetail();
- bDetailBackedup = TRUE;
- SetDetail(fFactor);
- }
- }
-
- // Detailstufe beachten
- if(bReducedDetail && fDetail != 0.0)
- {
- sal_Int32 nReducedWidth = (sal_Int32)((double)(aLocalSizePixel.GetWidth() - 1) * fDetail);
- sal_Int32 nReducedHeight = (sal_Int32)((double)(aLocalSizePixel.GetHeight() - 1)* fDetail);
- aLocalSizePixel.SetSize(Size(nReducedWidth + 1, nReducedHeight + 1));
- }
-
- // Falls die Groesse null ist, groesse auf 1,1 setzen
- if(aLocalSizePixel.GetSize().Width() < 1)
- aLocalSizePixel.SetSize(Size(1 , aLocalSizePixel.GetSize().Height()));
- if(aLocalSizePixel.GetSize().Height() < 1)
- aLocalSizePixel.SetSize(Size(aLocalSizePixel.GetSize().Width(), 1));
- }
-}
-
-/*************************************************************************
-|*
-|* Pixelkoordinaten des Punktes innerhalb der Bitmap holen
-|*
-\************************************************************************/
-
-Point Base3DDefault::GetPixelCoor(B3dEntity& rEntity)
-{
- if(bReducedDetail && fDetail != 0.0)
- {
- Point aRetval = GetOutputDevice()->LogicToPixel(
- Point((sal_Int32)(rEntity.Point().getX()),
- (sal_Int32)(rEntity.Point().getY()))) - aSizePixel.TopLeft();
- aRetval.X() = (sal_Int32)((double)aRetval.X() * fDetail);
- aRetval.Y() = (sal_Int32)((double)aRetval.Y() * fDetail);
- return aRetval;
- }
- else
- {
- return GetOutputDevice()->LogicToPixel(
- Point((sal_Int32)(rEntity.Point().getX()),
- (sal_Int32)(rEntity.Point().getY()))) - aSizePixel.TopLeft();
- }
-}
-
-/*************************************************************************
-|*
-|* 3DPunkt aus Pixelkoordinaten und Tiefe rekonstruieren
-|*
-\************************************************************************/
-
-basegfx::B3DPoint Base3DDefault::Get3DCoor(Point& rPnt, double fDepth)
-{
- if(bReducedDetail && fDetail != 0.0)
- {
- Point aPnt(rPnt);
- aPnt.X() = (sal_Int32)((double)aPnt.X() / fDetail);
- aPnt.Y() = (sal_Int32)((double)aPnt.Y() / fDetail);
- aPnt = GetOutputDevice()->PixelToLogic(aPnt + aSizePixel.TopLeft());
- return basegfx::B3DPoint(aPnt.X(), aPnt.Y(), fDepth);
- }
- else
- {
- Point aPnt = GetOutputDevice()->PixelToLogic(rPnt + aSizePixel.TopLeft());
- return basegfx::B3DPoint(aPnt.X(), aPnt.Y(), fDepth);
- }
-}
-
-/*************************************************************************
-|*
-|* ZBuffer Sichtbarkeitstest
-|*
-\************************************************************************/
-
-sal_Bool Base3DDefault::IsVisibleAndScissor(sal_Int32 nX, sal_Int32 nY, sal_uInt32 nDepth)
-{
- // #112303#
- // Do not allow pixels smaller then the bitmap
- if(nX < 0L || nY < 0L)
- return FALSE;
-
- // #112303#
- // Do not allow pixels bigger then the bitmap
- if(nX > aLocalSizePixel.GetWidth() || nY >aLocalSizePixel.GetHeight())
- return FALSE;
-
- if(!IsScissorRegionActive() || IsInScissorRegion(nX, nY))
- {
- const BitmapColor& rBmCol = pZBufferWrite->GetPixel(nY, nX);
- Color aColor(rBmCol.GetRed(), rBmCol.GetGreen(), rBmCol.GetBlue());
-
- return (aColor.GetColor() >= nDepth);
- }
-
- return FALSE;
-}
-
-/*************************************************************************
-|*
-|* Scissoring Sichtbarkeitstest
-|*
-\************************************************************************/
-
-sal_Bool Base3DDefault::IsInScissorRegion(sal_Int32 nX, sal_Int32 nY)
-{
- if(nX < aDefaultScissorRectangle.Left())
- return FALSE;
- if(nY < aDefaultScissorRectangle.Top())
- return FALSE;
- if(nX > aDefaultScissorRectangle.Right())
- return FALSE;
- if(nY > aDefaultScissorRectangle.Bottom())
- return FALSE;
- return TRUE;
-}
-
-/*************************************************************************
-|*
-|* Pixel setzen in allen Buffern
-|*
-\************************************************************************/
-
-void Base3DDefault::WritePixel(sal_Int32 nX, sal_Int32 nY, Color aColor, sal_uInt32 nDepth)
-{
- // #112303#
- // WritePixel requires the pixel coordinates to be safely on the buffer
- // bitmaps where the paint will take place. Thus, this asserts will
- // ensure that.
- DBG_ASSERT(nX >= 0L, "Base3DDefault::WritePixel: X-Coor negative (!)");
- DBG_ASSERT(nY >= 0L, "Base3DDefault::WritePixel: Y-Coor negative (!)");
- DBG_ASSERT(nX <= aPicture.GetSizePixel().Width(), "Base3DDefault::WritePixel: X-Coor too big (!)");
- DBG_ASSERT(nY <= aPicture.GetSizePixel().Height(), "Base3DDefault::WritePixel: Y-Coor too big (!)");
-
- // In Transparenz-Map eintragen
- if(GetTransparentPartsContainedHint())
- {
- if(aColor.GetTransparency())
- {
- BYTE nOldTrans = pTransparenceWrite->GetPixel(nY, nX).GetIndex();
-
- if(nOldTrans != (BYTE)0xff)
- {
- // Farbe mischen
- BitmapColor aOldCol = pPictureWrite->GetPixel(nY, nX);
- UINT16 nNegTrans = 0x0100 - (UINT16)aColor.GetTransparency();
- aColor.SetRed((BYTE)((((UINT16)aOldCol.GetRed() * (UINT16)aColor.GetTransparency())
- + (aColor.GetRed() * nNegTrans)) >> 8));
- aColor.SetGreen((BYTE)((((UINT16)aOldCol.GetGreen() * (UINT16)aColor.GetTransparency())
- + (aColor.GetGreen() * nNegTrans)) >> 8));
- aColor.SetBlue((BYTE)((((UINT16)aOldCol.GetBlue() * (UINT16)aColor.GetTransparency())
- + (aColor.GetBlue() * nNegTrans)) >> 8));
- pPictureWrite->SetPixel(nY, nX, aColor);
-
- // Transparenz mischen
- pTransparenceWrite->SetPixel(nY, nX,
- (BYTE)(((UINT16)(nOldTrans+1) * (UINT16)aColor.GetTransparency()) >> 8));
- }
- else
- {
- // Pixel setzen
- pPictureWrite->SetPixel(nY, nX, aColor);
-
- // Alpha-Wert setzen
- pTransparenceWrite->SetPixel(nY, nX, aColor.GetTransparency());
- }
- }
- else
- {
- // Pixel setzen
- pPictureWrite->SetPixel(nY, nX, aColor);
-
- // Alpha-Wert setzen
- pTransparenceWrite->SetPixel(nY, nX, (BYTE)0x00);
-
- // Z-Buffer setzen
- Color aZBufCol(nDepth);
- pZBufferWrite->SetPixel(nY, nX, aZBufCol);
- }
- }
- else
- {
- // Dieser Punkt in der Mono-Transparenz ist nicht transparent
- BitmapColor aColBlack(BYTE(0));
- pTransparenceWrite->SetPixel(nY, nX, aColBlack);
-
- // Pixel setzen
- pPictureWrite->SetPixel(nY, nX, aColor);
-
- // Z-Buffer setzen
- Color aZBufCol(nDepth);
- pZBufferWrite->SetPixel(nY, nX, aZBufCol);
- }
-}
-
-/*************************************************************************
-|*
-|* Zeichenfunktionen; alle Objekte sind geclippt
-|* Einzelner Punkt
-|*
-\************************************************************************/
-
-void Base3DDefault::Clipped3DPoint(sal_uInt32 nInd)
-{
- B3dEntity& rEntity = aBuffers[nInd];
-
- // Geometrie holen
- rEntity.ToDeviceCoor(GetTransformationSet());
- Point aOutPoint = GetPixelCoor(rEntity);
- sal_uInt32 nDepth = (sal_uInt32)rEntity.Point().getZ();
-
- // PolygonOffset beachten
- if(GetPolygonOffset(Base3DPolygonOffsetPoint))
- {
- if(nDepth >= maPolygonOffset)
- nDepth -= maPolygonOffset;
- else
- nDepth = 0;
- }
-
- // Zeichnen
- if(IsVisibleAndScissor(aOutPoint.X(), aOutPoint.Y(), nDepth))
- WritePixel(aOutPoint.X(), aOutPoint.Y(), rEntity.Color(), nDepth);
-}
-
-/*************************************************************************
-|*
-|* Zeichenfunktionen; alle Objekte sind geclippt
-|* Linie
-|*
-\************************************************************************/
-
-void Base3DDefault::Clipped3DLine(sal_uInt32 nInd1, sal_uInt32 nInd2)
-{
- B3dEntity& rEntity1 = aBuffers[nInd1];
- B3dEntity& rEntity2 = aBuffers[nInd2];
- bNormalsUsed = rEntity1.IsNormalUsed() && rEntity2.IsNormalUsed();
- bTextureUsed = IsTextureActive() && rEntity1.IsTexCoorUsed() && rEntity2.IsTexCoorUsed();
-
- // ColorModel fuer diese Punkte anwenden, falls Normale vorhanden
- // Danach Normale als ungueltig markieren, da nur noch die berechnete
- // Farbe bei Aufteilungen weiter interpoliert wird
- if(bNormalsUsed)
- {
- // Vektoren normalisieren
- rEntity1.Normal().normalize();
- rEntity2.Normal().normalize();
-
- if(GetShadeModel() != Base3DPhong)
- {
- // Farben auswerten
- rEntity1.Color() = SolveColorModel(GetMaterialObject(),
- rEntity1.Normal(), rEntity1.Point());
- rEntity2.Color() = SolveColorModel(GetMaterialObject(),
- rEntity2.Normal(), rEntity2.Point());
-
- // Die Normalen NICHT ungueltig machen, da die Entities
- // eventuell noch fuer weitere Primitive benutzt werden.
- // Aber lokal merken, dass die Normalen bereits ausgewertet sind
- bNormalsUsed = FALSE;
- }
- }
-
- // Geometrie holen
- rEntity1.ToDeviceCoor(GetTransformationSet());
- rEntity2.ToDeviceCoor(GetTransformationSet());
- Rectangle aPrimitiveArea;
-
- aOutPointTop = GetPixelCoor(rEntity1);
- aOutPointLeft = GetPixelCoor(rEntity2);
-
- if(IsScissorRegionActive())
- {
- aPrimitiveArea.Union(Rectangle(aOutPointTop, aOutPointTop));
- aPrimitiveArea.Union(Rectangle(aOutPointLeft, aOutPointLeft));
- }
-
- if(!IsScissorRegionActive()
- || (IsScissorRegionActive()
- && !aDefaultScissorRectangle.GetIntersection(aPrimitiveArea).IsEmpty()))
- {
- if(bTextureUsed)
- {
- fTexWidth = (double)GetActiveTexture()->GetBitmapSize().Width();
- fTexHeight = (double)GetActiveTexture()->GetBitmapSize().Height();
- }
-
- // Punkt, Farbe und Z-Wert interpolieren und die Linie gererieren
- sal_Int32 nDx = aOutPointLeft.X() - aOutPointTop.X();
- sal_Int32 nDy = aOutPointLeft.Y() - aOutPointTop.Y();
- sal_Int32 nCount;
-
- // Werte fuer Schleife vorbereiten
- if(labs(nDx) > labs(nDy))
- // ueber X gehen
- nCount = labs(nDx);
- else
- // ueber Y gehen
- nCount = labs(nDy);
-
- if(nCount)
- {
- // Interpolatoren vorbereiten
- aIntXPosLeft.Load(aOutPointTop.X(), aOutPointLeft.X(), nCount);
- aIntXPosRight.Load(aOutPointTop.Y(), aOutPointLeft.Y(), nCount);
- sal_uInt32 nDepth;
-
- // PolygonOffset beachten
- if(GetPolygonOffset())
- {
- double fDepthLeft = rEntity1.Point().getZ();
- double fDepthRight = rEntity2.Point().getZ();
-
- if(fDepthLeft >= double(maPolygonOffset))
- fDepthLeft -= double(maPolygonOffset);
- else
- fDepthLeft = 0.0;
-
- if(fDepthRight >= double(maPolygonOffset))
- fDepthRight -= double(maPolygonOffset);
- else
- fDepthRight = 0.0;
-
- aIntDepthLine.Load(fDepthLeft, fDepthRight, nCount);
- }
- else
- {
- aIntDepthLine.Load(rEntity1.Point().getZ(), rEntity2.Point().getZ(), nCount);
- }
-
- // Texturkoordinateninterpolation?
- if(bTextureUsed)
- {
- aIntTexSLine.Load(
- rEntity1.TexCoor().getX() * fTexWidth,
- rEntity2.TexCoor().getX() * fTexWidth,
- nCount);
-
- aIntTexTLine.Load(
- rEntity1.TexCoor().getY() * fTexHeight,
- rEntity2.TexCoor().getY() * fTexHeight,
- nCount);
- }
-
- if(bNormalsUsed && GetShadeModel() == Base3DPhong)
- {
- // Normalen und Geometrie interpolieren
- if(GetTransformationSet())
- {
- basegfx::B3DVector aInvTrans(GetTransformationSet()->GetTranslate());
- basegfx::B3DVector aInvScale(GetTransformationSet()->GetScale());
-
- // Tiefe und Normale vorbereiten
- aIntVectorLine.Load(rEntity1.Normal(), rEntity2.Normal(), nCount);
-
- // Linie zeichnen
- if(bTextureUsed)
- {
- while(nCount--)
- {
- // weiterer Punkt
- nDx = aIntXPosLeft.GetLongValue();
- nDy = aIntXPosRight.GetLongValue();
- nDepth = aIntDepthLine.GetUINT32Value();
-
- if(IsVisibleAndScissor(nDx, nDy, nDepth))
- {
- Point aTmpPoint(nDx, nDy);
- basegfx::B3DPoint aPoint = Get3DCoor(aTmpPoint, nDepth);
- aPoint -= aInvTrans;
- aPoint /= aInvScale;
- basegfx::B3DVector aNormal;
- aIntVectorLine.GetVector3DValue(aNormal);
- aNormal.normalize();
- Color aCol = SolveColorModel(GetMaterialObject(), aNormal, aPoint);
- GetActiveTexture()->ModifyColor(aCol,
- aIntTexSLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue());
- WritePixel(nDx, nDy, aCol, nDepth);
- }
-
- if(nCount)
- {
- // Weiterschalten
- aIntXPosLeft.Increment();
- aIntXPosRight.Increment();
- aIntDepthLine.Increment();
- aIntVectorLine.Increment();
- aIntTexSLine.Increment();
- aIntTexTLine.Increment();
- }
- }
- }
- else
- {
- while(nCount--)
- {
- // weiterer Punkt
- nDx = aIntXPosLeft.GetLongValue();
- nDy = aIntXPosRight.GetLongValue();
- nDepth = aIntDepthLine.GetUINT32Value();
-
- if(IsVisibleAndScissor(nDx, nDy, nDepth))
- {
- Point aTmpPoint(nDx, nDy);
- basegfx::B3DPoint aPoint = Get3DCoor(aTmpPoint, nDepth);
- aPoint -= aInvTrans;
- aPoint /= aInvScale;
- basegfx::B3DVector aNormal;
- aIntVectorLine.GetVector3DValue(aNormal);
- aNormal.normalize();
- Color aCol = SolveColorModel(GetMaterialObject(), aNormal, aPoint);
- WritePixel(nDx, nDy, aCol, nDepth);
- }
-
- if(nCount)
- {
- // Weiterschalten
- aIntXPosLeft.Increment();
- aIntXPosRight.Increment();
- aIntDepthLine.Increment();
- aIntVectorLine.Increment();
- }
- }
- }
- }
- }
- else
- {
- if(rEntity1.Color() != rEntity2.Color())
- {
- // Farbe und Geometrie interpolieren
- // Tiefe und Farbe vorbereiten
- aIntColorLine.Load(rEntity1.Color(), rEntity2.Color(), nCount);
-
- // Linie zeichnen
- if(bTextureUsed)
- {
- while(nCount--)
- {
- // weiterer Punkt
- nDx = aIntXPosLeft.GetLongValue();
- nDy = aIntXPosRight.GetLongValue();
- nDepth = aIntDepthLine.GetUINT32Value();
-
- if(IsVisibleAndScissor(nDx, nDy, nDepth))
- {
- Color aCol = aIntColorLine.GetColorValue();
- GetActiveTexture()->ModifyColor(aCol,
- aIntTexSLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue());
- WritePixel(nDx, nDy, aCol, nDepth);
- }
-
- if(nCount)
- {
- // Weiterschalten
- aIntXPosLeft.Increment();
- aIntXPosRight.Increment();
- aIntDepthLine.Increment();
- aIntColorLine.Increment();
- aIntTexSLine.Increment();
- aIntTexTLine.Increment();
- }
- }
- }
- else
- {
- while(nCount--)
- {
- // weiterer Punkt
- nDx = aIntXPosLeft.GetLongValue();
- nDy = aIntXPosRight.GetLongValue();
- nDepth = aIntDepthLine.GetUINT32Value();
-
- if(IsVisibleAndScissor(nDx, nDy, nDepth))
- WritePixel(nDx, nDy, aIntColorLine.GetColorValue(), nDepth);
-
- if(nCount)
- {
- // Weiterschalten
- aIntXPosLeft.Increment();
- aIntXPosRight.Increment();
- aIntDepthLine.Increment();
- aIntColorLine.Increment();
- }
- }
- }
- }
- else
- {
- // Nur die Geometrie interpolieren
- // Linie zeichnen
- if(bTextureUsed)
- {
- while(nCount--)
- {
- // weiterer Punkt
- nDx = aIntXPosLeft.GetLongValue();
- nDy = aIntXPosRight.GetLongValue();
- nDepth = aIntDepthLine.GetUINT32Value();
-
- if(IsVisibleAndScissor(nDx, nDy, nDepth))
- {
- Color aCol = rEntity1.Color();
- GetActiveTexture()->ModifyColor(aCol,
- aIntTexSLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue());
- WritePixel(nDx, nDy, aCol, nDepth);
- }
-
- if(nCount)
- {
- // Weiterschalten
- aIntXPosLeft.Increment();
- aIntXPosRight.Increment();
- aIntDepthLine.Increment();
- aIntTexSLine.Increment();
- aIntTexTLine.Increment();
- }
- }
- }
- else
- {
- while(nCount--)
- {
- // weiterer Punkt
- nDx = aIntXPosLeft.GetLongValue();
- nDy = aIntXPosRight.GetLongValue();
- nDepth = aIntDepthLine.GetUINT32Value();
-
- if(IsVisibleAndScissor(nDx, nDy, nDepth))
- WritePixel(nDx, nDy, rEntity1.Color(), nDepth);
-
- if(nCount)
- {
- // Weiterschalten
- aIntXPosLeft.Increment();
- aIntXPosRight.Increment();
- aIntDepthLine.Increment();
- aIntTexSLine.Increment();
- aIntTexTLine.Increment();
- }
- }
- }
- }
- }
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Zeichenfunktionen; alle Objekte sind geclippt
-|* Polygon
-|*
-\************************************************************************/
-
-void Base3DDefault::Clipped3DTriangle(sal_uInt32 nInd1, sal_uInt32 nInd2, sal_uInt32 nInd3)
-{
- B3dEntity& rEntity1 = aBuffers[nInd1];
- B3dEntity& rEntity2 = aBuffers[nInd2];
- B3dEntity& rEntity3 = aBuffers[nInd3];
-
- bNormalsUsed = rEntity1.IsNormalUsed() && rEntity2.IsNormalUsed() && rEntity3.IsNormalUsed();
- bTextureUsed = IsTextureActive() && rEntity1.IsTexCoorUsed() && rEntity2.IsTexCoorUsed() && rEntity3.IsTexCoorUsed();
- Base3DMaterialMode eMode = Base3DMaterialFront;
-
- // ColorModel fuer diese Punkte anwenden, falls Normale vorhanden
- // Danach Normale als ungueltig markieren, da nur noch die berechnete
- // Farbe bei Aufteilungen weiter interpoliert wird
- if(bNormalsUsed)
- {
- // Vektoren normalisieren
- rEntity1.Normal().normalize();
- rEntity2.Normal().normalize();
- rEntity3.Normal().normalize();
-
- if(GetShadeModel() != Base3DPhong)
- {
- // Normale berechnen, Farben auswerten
- if(rEntity1.PlaneNormal().getZ() < 0.0 && (GetLightGroup() && GetLightGroup()->GetModelTwoSide()))
- eMode = Base3DMaterialBack;
-
- rEntity1.Color() = SolveColorModel(
- GetMaterialObject(eMode),
- rEntity1.Normal(),
- rEntity1.Point()
- );
-
- rEntity2.Color() = SolveColorModel(
- GetMaterialObject(eMode),
- rEntity2.Normal(),
- rEntity2.Point()
- );
-
- rEntity3.Color() = SolveColorModel(
- GetMaterialObject(eMode),
- rEntity3.Normal(),
- rEntity3.Point()
- );
-
- // Die Normalen NICHT ungueltig machen, da die Entities
- // eventuell noch fuer weitere Primitive benutzt werden.
- // Aber lokal merken, dass die Normalen bereits ausgewertet sind
- bNormalsUsed = FALSE;
- }
- }
-
- // Geometrie holen
- rEntity1.ToDeviceCoor(GetTransformationSet());
- rEntity2.ToDeviceCoor(GetTransformationSet());
- rEntity3.ToDeviceCoor(GetTransformationSet());
-
- // Punkte ordnen. Oberster nach pEntTop
- if(rEntity1.Point().getY() < rEntity2.Point().getY() && rEntity1.Point().getY() < rEntity3.Point().getY())
- {
- // rEntity1 ist der oberste
- pEntTop = &rEntity1;
-
- // Left, Right erst mal zuweisen
- pEntRight = &rEntity3;
- pEntLeft = &rEntity2;
- }
- else
- {
- if(rEntity2.Point().getY() < rEntity3.Point().getY())
- {
- // rEntity2 ist der oberste
- pEntTop = &rEntity2;
-
- // Left, Right erst mal zuweisen
- pEntRight = &rEntity1;
- pEntLeft = &rEntity3;
- }
- else
- {
- // rEntity3 ist der oberste
- pEntTop = &rEntity3;
-
- // Left, Right erst mal zuweisen
- pEntRight = &rEntity2;
- pEntLeft = &rEntity1;
- }
- }
-
- // Werte holen
- Rectangle aPrimitiveArea;
-
- aOutPointTop = GetPixelCoor(*pEntTop);
- aOutPointLeft = GetPixelCoor(*pEntLeft);
- aOutPointRight = GetPixelCoor(*pEntRight);
-
- if(IsScissorRegionActive())
- {
- aPrimitiveArea.Union(Rectangle(aOutPointTop, aOutPointTop));
- aPrimitiveArea.Union(Rectangle(aOutPointLeft, aOutPointLeft));
- aPrimitiveArea.Union(Rectangle(aOutPointRight, aOutPointRight));
- }
-
- if(!IsScissorRegionActive()
- || (IsScissorRegionActive()
- && !aDefaultScissorRectangle.GetIntersection(aPrimitiveArea).IsEmpty()))
- {
- if(bTextureUsed)
- {
- fTexWidth = (double)GetActiveTexture()->GetBitmapSize().Width();
- fTexHeight = (double)GetActiveTexture()->GetBitmapSize().Height();
- }
-
- // Links und rechts ordnen
- sal_Int32 nDeltaYLeft = aOutPointLeft.Y() - aOutPointTop.Y();
- sal_Int32 nDeltaYRight = aOutPointRight.Y() - aOutPointTop.Y();
- sal_Int32 nYLine;
-
- if((aOutPointLeft.X() - aOutPointTop.X()) * nDeltaYRight
- - nDeltaYLeft * (aOutPointRight.X() - aOutPointTop.X()) > 0)
- {
- // Links und rechts vertauschen
- // Punkte
- nYLine = aOutPointLeft.X();
- aOutPointLeft.X() = aOutPointRight.X();
- aOutPointRight.X() = nYLine;
- nYLine = aOutPointLeft.Y();
- aOutPointLeft.Y() = aOutPointRight.Y();
- aOutPointRight.Y() = nYLine;
-
- // Deltas
- nYLine = nDeltaYLeft; nDeltaYLeft = nDeltaYRight; nDeltaYRight = nYLine;
-
- // Zeiger auf Entities
- B3dEntity* pTmp = pEntLeft; pEntLeft = pEntRight; pEntRight = pTmp;
- }
-
- // YStart, Links und rechts laden
- nYLine = aOutPointTop.Y();
-
- aIntXPosLeft.Load(aOutPointTop.X(), aOutPointLeft.X(), nDeltaYLeft);
- aIntDepthLeft.Load(pEntTop->Point().getZ(), pEntLeft->Point().getZ(), nDeltaYLeft);
-
- aIntXPosRight.Load(aOutPointTop.X(), aOutPointRight.X(), nDeltaYRight);
- aIntDepthRight.Load(pEntTop->Point().getZ(), pEntRight->Point().getZ(), nDeltaYRight);
-
- if(bTextureUsed)
- {
- // #96837#
- if(mbPTCorrection)
- {
- // Load real depth interpolators (if needed)
- const double fRealDepthLeft(1.0 / GetTransformationSet()->ViewToEyeCoor(pEntLeft->Point()).getZ());
- const double fRealDepthRight(1.0 / GetTransformationSet()->ViewToEyeCoor(pEntRight->Point()).getZ());
- const double fRealDepthTop(1.0 / GetTransformationSet()->ViewToEyeCoor(pEntTop->Point()).getZ());
- aRealDepthLeft.Load(fRealDepthTop, fRealDepthLeft, nDeltaYLeft);
- aRealDepthRight.Load(fRealDepthTop, fRealDepthRight, nDeltaYRight);
-
- // #96837#
- aIntTexSLeft.Load(
- pEntTop->TexCoor().getX() * fTexWidth * fRealDepthTop,
- pEntLeft->TexCoor().getX() * fTexWidth * fRealDepthLeft,
- nDeltaYLeft);
-
- aIntTexTLeft.Load(
- pEntTop->TexCoor().getY() * fTexHeight * fRealDepthTop,
- pEntLeft->TexCoor().getY() * fTexHeight * fRealDepthLeft,
- nDeltaYLeft);
-
- aIntTexSRight.Load(
- pEntTop->TexCoor().getX() * fTexWidth * fRealDepthTop,
- pEntRight->TexCoor().getX() * fTexWidth * fRealDepthRight,
- nDeltaYRight);
-
- aIntTexTRight.Load(
- pEntTop->TexCoor().getY() * fTexHeight * fRealDepthTop,
- pEntRight->TexCoor().getY() * fTexHeight * fRealDepthRight,
- nDeltaYRight);
- }
- else
- {
- aIntTexSLeft.Load(
- pEntTop->TexCoor().getX() * fTexWidth,
- pEntLeft->TexCoor().getX() * fTexWidth,
- nDeltaYLeft);
-
- aIntTexTLeft.Load(
- pEntTop->TexCoor().getY() * fTexHeight,
- pEntLeft->TexCoor().getY() * fTexHeight,
- nDeltaYLeft);
-
- aIntTexSRight.Load(
- pEntTop->TexCoor().getX() * fTexWidth,
- pEntRight->TexCoor().getX() * fTexWidth,
- nDeltaYRight);
-
- aIntTexTRight.Load(
- pEntTop->TexCoor().getY() * fTexHeight,
- pEntRight->TexCoor().getY() * fTexHeight,
- nDeltaYRight);
- }
- }
-
- if(bNormalsUsed && GetShadeModel() == Base3DPhong)
- {
- // Normalen und Geometrie interpolieren
- aIntVectorLeft.Load(pEntTop->Normal(), pEntLeft->Normal(), nDeltaYLeft);
- aIntVectorRight.Load(pEntTop->Normal(), pEntRight->Normal(), nDeltaYRight);
- B3dMaterial& rMat = GetMaterialObject(eMode);
-
- if(bTextureUsed)
- {
- // Schleife
- while(nDeltaYLeft || nDeltaYRight)
- {
- // Zeile ausgeben
- DrawLinePhongTexture(nYLine, rMat);
-
- // naechste Zeile vorbereiten rechts
- if(!nDeltaYRight && nDeltaYLeft)
- {
- // Rechts ist zuende, lade neu mit Rest nach links
- nDeltaYRight = nDeltaYLeft;
- LoadRightTexture(nDeltaYRight);
- aIntVectorRight.Load(pEntRight->Normal(), pEntLeft->Normal(), nDeltaYRight);
- }
-
- // naechste Zeile vorbereiten links
- if(!nDeltaYLeft && nDeltaYRight)
- {
- // Links ist zuende, lade neu mit Rest nach rechts
- nDeltaYLeft = nDeltaYRight;
- LoadLeftTexture(nDeltaYLeft);
- aIntVectorLeft.Load(pEntLeft->Normal(), pEntRight->Normal(), nDeltaYLeft);
- }
-
- // naechste Zeile rechts
- if(nDeltaYRight || nDeltaYLeft)
- {
- nDeltaYRight--;
- NextStepRightTexture();
- aIntVectorRight.Increment();
-
- nDeltaYLeft--;
- NextStepLeftTexture();
- aIntVectorLeft.Increment();
-
- nYLine++;
- }
- }
- }
- else
- {
- // Schleife
- while(nDeltaYLeft || nDeltaYRight)
- {
- // Zeile ausgeben
- DrawLinePhong(nYLine, rMat);
-
- // naechste Zeile vorbereiten rechts
- if(!nDeltaYRight && nDeltaYLeft)
- {
- // Rechts ist zuende, lade neu mit Rest nach links
- nDeltaYRight = nDeltaYLeft;
- LoadRight(nDeltaYRight);
- aIntVectorRight.Load(pEntRight->Normal(), pEntLeft->Normal(), nDeltaYRight);
- }
-
- // naechste Zeile vorbereiten links
- if(!nDeltaYLeft && nDeltaYRight)
- {
- // Links ist zuende, lade neu mit Rest nach rechts
- nDeltaYLeft = nDeltaYRight;
- LoadLeft(nDeltaYLeft);
- aIntVectorLeft.Load(pEntLeft->Normal(), pEntRight->Normal(), nDeltaYLeft);
- }
-
- // naechste Zeile rechts
- if(nDeltaYRight || nDeltaYLeft)
- {
- nDeltaYRight--;
- NextStepRight();
- aIntVectorRight.Increment();
-
- nDeltaYLeft--;
- NextStepLeft();
- aIntVectorLeft.Increment();
-
- nYLine++;
- }
- }
- }
- }
- else
- {
- if(!(rEntity1.Color() == rEntity2.Color() && rEntity1.Color() == rEntity3.Color()))
- {
- // Farbe und Geometrie interpolieren
- aIntColorLeft.Load(pEntTop->Color(), pEntLeft->Color(), nDeltaYLeft);
- aIntColorRight.Load(pEntTop->Color(), pEntRight->Color(), nDeltaYRight);
-
- if(bTextureUsed)
- {
- // Schleife
- while(nDeltaYLeft || nDeltaYRight)
- {
- // Zeile ausgeben
- DrawLineColorTexture(nYLine);
-
- // naechste Zeile vorbereiten rechts
- if(!nDeltaYRight && nDeltaYLeft)
- {
- // Rechts ist zuende, lade neu mit Rest nach links
- nDeltaYRight = nDeltaYLeft;
- LoadRightTexture(nDeltaYRight);
- aIntColorRight.Load(pEntRight->Color(), pEntLeft->Color(), nDeltaYRight);
- }
-
- // naechste Zeile vorbereiten links
- if(!nDeltaYLeft && nDeltaYRight)
- {
- // Links ist zuende, lade neu mit Rest nach rechts
- nDeltaYLeft = nDeltaYRight;
- LoadLeftTexture(nDeltaYLeft);
- aIntColorLeft.Load(pEntLeft->Color(), pEntRight->Color(), nDeltaYLeft);
- }
-
- // naechste Zeile rechts
- if(nDeltaYRight || nDeltaYLeft)
- {
- nDeltaYRight--;
- NextStepRightTexture();
- aIntColorRight.Increment();
-
- nDeltaYLeft--;
- NextStepLeftTexture();
- aIntColorLeft.Increment();
-
- nYLine++;
- }
- }
- }
- else
- {
- // Schleife
- while(nDeltaYLeft || nDeltaYRight)
- {
- // Zeile ausgeben
- DrawLineColor(nYLine);
-
- // naechste Zeile vorbereiten rechts
- if(!nDeltaYRight && nDeltaYLeft)
- {
- // Rechts ist zuende, lade neu mit Rest nach links
- nDeltaYRight = nDeltaYLeft;
- LoadRight(nDeltaYRight);
- aIntColorRight.Load(pEntRight->Color(), pEntLeft->Color(), nDeltaYRight);
- }
-
- // naechste Zeile vorbereiten links
- if(!nDeltaYLeft && nDeltaYRight)
- {
- // Links ist zuende, lade neu mit Rest nach rechts
- nDeltaYLeft = nDeltaYRight;
- LoadLeft(nDeltaYLeft);
- aIntColorLeft.Load(pEntLeft->Color(), pEntRight->Color(), nDeltaYLeft);
- }
-
- // naechste Zeile rechts
- if(nDeltaYRight || nDeltaYLeft)
- {
- nDeltaYRight--;
- NextStepRight();
- aIntColorRight.Increment();
-
- nDeltaYLeft--;
- NextStepLeft();
- aIntColorLeft.Increment();
-
- nYLine++;
- }
- }
- }
- }
- else
- {
- // Nur die Geometrie interpolieren
- if(bTextureUsed)
- {
- // Schleife
- while(nDeltaYLeft || nDeltaYRight)
- {
- // Zeile ausgeben
- DrawLineTexture(nYLine, pEntTop->Color());
-
- // naechste Zeile vorbereiten rechts
- if(!nDeltaYRight && nDeltaYLeft)
- {
- // Rechts ist zuende, lade neu mit Rest nach links
- nDeltaYRight = nDeltaYLeft;
- LoadRightTexture(nDeltaYRight);
- }
-
- // naechste Zeile vorbereiten links
- if(!nDeltaYLeft && nDeltaYRight)
- {
- // Links ist zuende, lade neu mit Rest nach rechts
- nDeltaYLeft = nDeltaYRight;
- LoadLeftTexture(nDeltaYLeft);
- }
-
- // naechste Zeile rechts
- if(nDeltaYRight || nDeltaYLeft)
- {
- nDeltaYRight--;
- NextStepRightTexture();
-
- nDeltaYLeft--;
- NextStepLeftTexture();
-
- nYLine++;
- }
- }
- }
- else
- {
- // Schleife
- while(nDeltaYLeft || nDeltaYRight)
- {
- // Zeile ausgeben
- DrawLine(nYLine, pEntTop->Color());
-
- // naechste Zeile vorbereiten rechts
- if(!nDeltaYRight && nDeltaYLeft)
- {
- // Rechts ist zuende, lade neu mit Rest nach links
- nDeltaYRight = nDeltaYLeft;
- LoadRight(nDeltaYRight);
- }
-
- // naechste Zeile vorbereiten links
- if(!nDeltaYLeft && nDeltaYRight)
- {
- // Links ist zuende, lade neu mit Rest nach rechts
- nDeltaYLeft = nDeltaYRight;
- LoadLeft(nDeltaYLeft);
- }
-
- // naechste Zeile rechts
- if(nDeltaYRight || nDeltaYLeft)
- {
- nDeltaYRight--;
- NextStepRight();
-
- nDeltaYLeft--;
- NextStepLeft();
-
- nYLine++;
- }
- }
- }
- }
- }
- }
-}
-
-void Base3DDefault::DrawLinePhongTexture(sal_Int32 nYPos, B3dMaterial& rMat)
-{
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && (nYPos < aDefaultScissorRectangle.Top()
- || nYPos > aDefaultScissorRectangle.Bottom()))
- return;
-
- // Von links bis rechts zeichnen
- sal_Int32 nXLineStart = aIntXPosLeft.GetLongValue();
- sal_Int32 nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
-
- if(nXLineDelta > 0)
- {
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
- || nXLineStart > aDefaultScissorRectangle.Right()))
- return;
-
- basegfx::B3DVector aVectorLeft;
- aIntVectorLeft.GetVector3DValue(aVectorLeft);
- basegfx::B3DVector aVectorRight;
- aIntVectorRight.GetVector3DValue(aVectorRight);
- aIntVectorLine.Load(aVectorLeft, aVectorRight, nXLineDelta);
- aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
-
- // #96837##
- if(mbPTCorrection)
- {
- aRealDepthLine.Load(aRealDepthLeft.GetDoubleValue(), aRealDepthRight.GetDoubleValue(), nXLineDelta);
- }
-
- aIntTexSLine.Load(aIntTexSLeft.GetDoubleValue(), aIntTexSRight.GetDoubleValue(), nXLineDelta);
- aIntTexTLine.Load(aIntTexTLeft.GetDoubleValue(), aIntTexTRight.GetDoubleValue(), nXLineDelta);
-
- if(GetTransformationSet())
- {
- basegfx::B3DVector aInvTrans = GetTransformationSet()->GetTranslate();
- basegfx::B3DVector aInvScale = GetTransformationSet()->GetScale();
-
- while(nXLineDelta--)
- {
- // Werte vorbereiten
- sal_uInt32 nDepth = aIntDepthLine.GetUINT32Value();
-
- // Punkt ausgeben
- if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
- {
- Point aTmpPoint(nXLineStart, nYPos);
- basegfx::B3DPoint aPoint = Get3DCoor(aTmpPoint, nDepth);
- aPoint -= aInvTrans;
- aPoint /= aInvScale;
- basegfx::B3DVector aNormal;
- aIntVectorLine.GetVector3DValue(aNormal);
- aNormal.normalize();
- Color aCol = SolveColorModel(rMat, aNormal, aPoint);
-
- // #96837#
- if(mbPTCorrection)
- {
- GetActiveTexture()->ModifyColor(
- aCol,
- aIntTexSLine.GetDoubleValue() / aRealDepthLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue() / aRealDepthLine.GetDoubleValue()
- );
- }
- else
- {
- GetActiveTexture()->ModifyColor(
- aCol,
- aIntTexSLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue()
- );
- }
-
- WritePixel(nXLineStart, nYPos, aCol, nDepth);
- }
-
- if(nXLineDelta)
- {
- // naechste Spalte
- nXLineStart++;
-
- // naechste Tiefe und Farbe
- aIntDepthLine.Increment();
- aIntVectorLine.Increment();
-
- // #96837#
- if(mbPTCorrection)
- {
- aRealDepthLine.Increment();
- }
-
- aIntTexSLine.Increment();
- aIntTexTLine.Increment();
- }
- }
- }
- }
-}
-
-void Base3DDefault::DrawLinePhong(sal_Int32 nYPos, B3dMaterial& rMat)
-{
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && (nYPos < aDefaultScissorRectangle.Top()
- || nYPos > aDefaultScissorRectangle.Bottom()))
- return;
-
- // Von links bis rechts zeichnen
- sal_Int32 nXLineStart = aIntXPosLeft.GetLongValue();
- sal_Int32 nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
-
- if(nXLineDelta > 0)
- {
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
- || nXLineStart > aDefaultScissorRectangle.Right()))
- return;
-
- basegfx::B3DVector aVectorLeft;
- aIntVectorLeft.GetVector3DValue(aVectorLeft);
- basegfx::B3DVector aVectorRight;
- aIntVectorRight.GetVector3DValue(aVectorRight);
- aIntVectorLine.Load(aVectorLeft, aVectorRight, nXLineDelta);
- aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
-
- if(GetTransformationSet())
- {
- basegfx::B3DVector aInvTrans = GetTransformationSet()->GetTranslate();
- basegfx::B3DVector aInvScale = GetTransformationSet()->GetScale();
- while(nXLineDelta--)
- {
- // Werte vorbereiten
- sal_uInt32 nDepth = aIntDepthLine.GetUINT32Value();
-
- // Punkt ausgeben
- if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
- {
- Point aTmpPoint(nXLineStart, nYPos);
- basegfx::B3DPoint aPoint = Get3DCoor(aTmpPoint, nDepth);
- aPoint -= aInvTrans;
- aPoint /= aInvScale;
- basegfx::B3DVector aNormal;
- aIntVectorLine.GetVector3DValue(aNormal);
- aNormal.normalize();
- Color aCol = SolveColorModel(rMat, aNormal, aPoint);
- WritePixel(nXLineStart, nYPos, aCol, nDepth);
- }
-
- if(nXLineDelta)
- {
- // naechste Spalte
- nXLineStart++;
-
- // naechste Tiefe und Farbe
- aIntDepthLine.Increment();
- aIntVectorLine.Increment();
- }
- }
- }
- }
-}
-
-void Base3DDefault::DrawLineColorTexture(sal_Int32 nYPos)
-{
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && (nYPos < aDefaultScissorRectangle.Top()
- || nYPos > aDefaultScissorRectangle.Bottom()))
- return;
-
- // Von links bis rechts zeichnen
- sal_Int32 nXLineStart = aIntXPosLeft.GetLongValue();
- sal_Int32 nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
-
- if(nXLineDelta > 0)
- {
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
- || nXLineStart > aDefaultScissorRectangle.Right()))
- return;
-
- aIntColorLine.Load(aIntColorLeft.GetColorValue(), aIntColorRight.GetColorValue(), nXLineDelta);
- aIntTexSLine.Load(aIntTexSLeft.GetDoubleValue(), aIntTexSRight.GetDoubleValue(), nXLineDelta);
- aIntTexTLine.Load(aIntTexTLeft.GetDoubleValue(), aIntTexTRight.GetDoubleValue(), nXLineDelta);
- aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
-
- // #96837#
- if(mbPTCorrection)
- {
- aRealDepthLine.Load(aRealDepthLeft.GetDoubleValue(), aRealDepthRight.GetDoubleValue(), nXLineDelta);
- }
-
- while(nXLineDelta--)
- {
- // Werte vorbereiten
- sal_uInt32 nDepth = aIntDepthLine.GetUINT32Value();
-
- // Punkt ausgeben
- if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
- {
- Color aCol = aIntColorLine.GetColorValue();
-
- // #96837#
- if(mbPTCorrection)
- {
- GetActiveTexture()->ModifyColor(
- aCol,
- aIntTexSLine.GetDoubleValue() / aRealDepthLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue() / aRealDepthLine.GetDoubleValue()
- );
- }
- else
- {
- GetActiveTexture()->ModifyColor(
- aCol,
- aIntTexSLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue()
- );
- }
-
- WritePixel(nXLineStart, nYPos, aCol, nDepth);
- }
-
- if(nXLineDelta)
- {
- // naechste Spalte
- nXLineStart++;
-
- // naechste Tiefe und Farbe
- aIntDepthLine.Increment();
- aIntColorLine.Increment();
- aIntTexSLine.Increment();
- aIntTexTLine.Increment();
-
- // #96837#
- if(mbPTCorrection)
- {
- aRealDepthLine.Increment();
- }
- }
- }
- }
-}
-
-void Base3DDefault::DrawLineColor(sal_Int32 nYPos)
-{
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && (nYPos < aDefaultScissorRectangle.Top()
- || nYPos > aDefaultScissorRectangle.Bottom()))
- return;
-
- // Von links bis rechts zeichnen
- sal_Int32 nXLineStart = aIntXPosLeft.GetLongValue();
- sal_Int32 nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
-
- if(nXLineDelta > 0)
- {
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
- || nXLineStart > aDefaultScissorRectangle.Right()))
- return;
-
- aIntColorLine.Load(aIntColorLeft.GetColorValue(), aIntColorRight.GetColorValue(), nXLineDelta);
- aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
-
- while(nXLineDelta--)
- {
- // Werte vorbereiten
- sal_uInt32 nDepth = aIntDepthLine.GetUINT32Value();
-
- // Punkt ausgeben
- if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
- WritePixel(nXLineStart, nYPos, aIntColorLine.GetColorValue(), nDepth);
-
- if(nXLineDelta)
- {
- // naechste Spalte
- nXLineStart++;
-
- // naechste Tiefe und Farbe
- aIntDepthLine.Increment();
- aIntColorLine.Increment();
- }
- }
- }
-}
-
-void Base3DDefault::DrawLineTexture(sal_Int32 nYPos, Color& rCol)
-{
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && (nYPos < aDefaultScissorRectangle.Top()
- || nYPos > aDefaultScissorRectangle.Bottom()))
- return;
-
- // Von links bis rechts zeichnen
- sal_Int32 nXLineStart = aIntXPosLeft.GetLongValue();
- sal_Int32 nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
-
- if(nXLineDelta > 0)
- {
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
- || nXLineStart > aDefaultScissorRectangle.Right()))
- return;
-
- aIntTexSLine.Load(aIntTexSLeft.GetDoubleValue(), aIntTexSRight.GetDoubleValue(), nXLineDelta);
- aIntTexTLine.Load(aIntTexTLeft.GetDoubleValue(), aIntTexTRight.GetDoubleValue(), nXLineDelta);
- aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
-
- // #96837#
- if(mbPTCorrection)
- {
- aRealDepthLine.Load(aRealDepthLeft.GetDoubleValue(), aRealDepthRight.GetDoubleValue(), nXLineDelta);
- }
-
- while(nXLineDelta--)
- {
- // Werte vorbereiten
- sal_uInt32 nDepth = aIntDepthLine.GetUINT32Value();
-
- // Punkt ausgeben
- if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
- {
- // Texturkoordinateninterpolation?
- Color aCol = rCol;
-
- // #96837#
- if(mbPTCorrection)
- {
- GetActiveTexture()->ModifyColor(
- aCol,
- aIntTexSLine.GetDoubleValue() / aRealDepthLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue() / aRealDepthLine.GetDoubleValue()
- );
- }
- else
- {
- GetActiveTexture()->ModifyColor(
- aCol,
- aIntTexSLine.GetDoubleValue(),
- aIntTexTLine.GetDoubleValue()
- );
- }
-
- WritePixel(nXLineStart, nYPos, aCol, nDepth);
- }
-
- if(nXLineDelta)
- {
- // naechste Spalte
- nXLineStart++;
-
- // naechste Tiefe und Farbe
- aIntDepthLine.Increment();
- aIntTexSLine.Increment();
- aIntTexTLine.Increment();
-
- // #96837#
- if(mbPTCorrection)
- {
- aRealDepthLine.Increment();
- }
- }
- }
- }
-}
-
-void Base3DDefault::DrawLine(sal_Int32 nYPos, Color& rCol)
-{
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && (nYPos < aDefaultScissorRectangle.Top()
- || nYPos > aDefaultScissorRectangle.Bottom()))
- return;
-
- // Von links bis rechts zeichnen
- sal_Int32 nXLineStart = aIntXPosLeft.GetLongValue();
- sal_Int32 nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
-
- if(nXLineDelta > 0)
- {
- // Ausserhalb des Clipping-Bereichs?
- if(IsScissorRegionActive()
- && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
- || nXLineStart > aDefaultScissorRectangle.Right()))
- return;
-
- aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
-
- while(nXLineDelta--)
- {
- // Werte vorbereiten
- sal_uInt32 nDepth = aIntDepthLine.GetUINT32Value();
-
- // Punkt ausgeben
- if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
- WritePixel(nXLineStart, nYPos, rCol, nDepth);
-
- if(nXLineDelta)
- {
- // naechste Spalte
- nXLineStart++;
-
- // naechste Tiefe und Farbe
- aIntDepthLine.Increment();
- }
- }
- }
-}
-
-void Base3DDefault::LoadLeftTexture(sal_Int32 nSize)
-{
- aIntXPosLeft.Load(aOutPointLeft.X(), aOutPointRight.X(), nSize);
- aIntDepthLeft.Load(pEntLeft->Point().getZ(), pEntRight->Point().getZ(), nSize);
-
- // #96837#
- if(mbPTCorrection)
- {
- const double fRealDepthLeft = 1.0 / GetTransformationSet()->ViewToEyeCoor(pEntLeft->Point()).getZ();
- const double fRealDepthRight = 1.0 / GetTransformationSet()->ViewToEyeCoor(pEntRight->Point()).getZ();
- aRealDepthLeft.Load(fRealDepthLeft, fRealDepthRight, nSize);
-
- aIntTexSLeft.Load(
- pEntLeft->TexCoor().getX() * fTexWidth * fRealDepthLeft,
- pEntRight->TexCoor().getX() * fTexWidth * fRealDepthRight,
- nSize);
-
- aIntTexTLeft.Load(
- pEntLeft->TexCoor().getY() * fTexHeight * fRealDepthLeft,
- pEntRight->TexCoor().getY() * fTexHeight * fRealDepthRight,
- nSize);
- }
- else
- {
- aIntTexSLeft.Load(
- pEntLeft->TexCoor().getX() * fTexWidth,
- pEntRight->TexCoor().getX() * fTexWidth,
- nSize);
-
- aIntTexTLeft.Load(
- pEntLeft->TexCoor().getY() * fTexHeight,
- pEntRight->TexCoor().getY() * fTexHeight,
- nSize);
- }
-}
-
-void Base3DDefault::LoadLeft(sal_Int32 nSize)
-{
- aIntXPosLeft.Load(aOutPointLeft.X(), aOutPointRight.X(), nSize);
- aIntDepthLeft.Load(pEntLeft->Point().getZ(), pEntRight->Point().getZ(), nSize);
-}
-
-void Base3DDefault::LoadRightTexture(sal_Int32 nSize)
-{
- aIntXPosRight.Load(aOutPointRight.X(), aOutPointLeft.X(), nSize);
- aIntDepthRight.Load(pEntRight->Point().getZ(), pEntLeft->Point().getZ(), nSize);
-
- // #96837#
- if(mbPTCorrection)
- {
- const double fRealDepthLeft = 1.0 / GetTransformationSet()->ViewToEyeCoor(pEntLeft->Point()).getZ();
- const double fRealDepthRight = 1.0 / GetTransformationSet()->ViewToEyeCoor(pEntRight->Point()).getZ();
- aRealDepthRight.Load(fRealDepthRight, fRealDepthLeft, nSize);
-
- // #96837#
- aIntTexSRight.Load(
- pEntRight->TexCoor().getX() * fTexWidth * fRealDepthRight,
- pEntLeft->TexCoor().getX() * fTexWidth * fRealDepthLeft,
- nSize);
-
- aIntTexTRight.Load(
- pEntRight->TexCoor().getY() * fTexHeight * fRealDepthRight,
- pEntLeft->TexCoor().getY() * fTexHeight * fRealDepthLeft,
- nSize);
- }
- else
- {
- aIntTexSRight.Load(
- pEntRight->TexCoor().getX() * fTexWidth,
- pEntLeft->TexCoor().getX() * fTexWidth,
- nSize);
-
- aIntTexTRight.Load(
- pEntRight->TexCoor().getY() * fTexHeight,
- pEntLeft->TexCoor().getY() * fTexHeight,
- nSize);
- }
-}
-
-void Base3DDefault::LoadRight(sal_Int32 nSize)
-{
- aIntXPosRight.Load(aOutPointRight.X(), aOutPointLeft.X(), nSize);
- aIntDepthRight.Load(pEntRight->Point().getZ(), pEntLeft->Point().getZ(), nSize);
-}
-
-void Base3DDefault::NextStepRightTexture()
-{
- aIntXPosRight.Increment();
- aIntDepthRight.Increment();
-
- // #96837#
- if(mbPTCorrection)
- {
- aRealDepthRight.Increment();
- }
-
- aIntTexSRight.Increment();
- aIntTexTRight.Increment();
-}
-
-void Base3DDefault::NextStepRight()
-{
- aIntXPosRight.Increment();
- aIntDepthRight.Increment();
-}
-
-void Base3DDefault::NextStepLeftTexture()
-{
- aIntXPosLeft.Increment();
- aIntDepthLeft.Increment();
-
- // #96837#
- if(mbPTCorrection)
- {
- aRealDepthLeft.Increment();
- }
-
- aIntTexSLeft.Increment();
- aIntTexTLeft.Increment();
-}
-
-void Base3DDefault::NextStepLeft()
-{
- aIntXPosLeft.Increment();
- aIntDepthLeft.Increment();
-}
-
-// eof
diff --git a/goodies/source/base3d/b3ddeflt.hxx b/goodies/source/base3d/b3ddeflt.hxx
deleted file mode 100644
index 4e19c3b7ea6a..000000000000
--- a/goodies/source/base3d/b3ddeflt.hxx
+++ /dev/null
@@ -1,205 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3ddeflt.hxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DDEFLT_HXX
-#define _B3D_B3DDEFLT_HXX
-
-#include "b3dcommn.hxx"
-#include <vcl/bitmap.hxx>
-#include <vcl/salbtype.hxx>
-#include <vcl/alpha.hxx>
-#include <goodies/bxdintpo.hxx>
-
-/*************************************************************************
-|*
-|* Die Basisklasse fuer Standard 3D Ausgaben auf StarView Basis
-|*
-\************************************************************************/
-
-class Base3DDefault : public Base3DCommon
-{
-private:
- // ZBuffer auch als BitMap
- Bitmap aZBuffer;
-
- // Bitmap zum Zeichnen im Hintergrund
- Bitmap aPicture;
-
- // Bitmaps fuer die Transparenz
- Bitmap aMonoTransparence;
- AlphaMask aAlphaTransparence;
-
- // Position der oberen linken Ecke aus ImplSetViewport
- Rectangle aSizePixel;
-
- // Mit faktoren umgerechnete echte Bitmap-Groesse
- Rectangle aLocalSizePixel;
-
- // ZBuffer loeschwert
- BitmapColor aClearValue;
-
- // Zugriffe auf die BitMaps
- BitmapWriteAccess* pZBufferWrite;
- BitmapWriteAccess* pPictureWrite;
- BitmapWriteAccess* pTransparenceWrite;
-
- // Vergroeberungsstufe und dazugehoerige Variablen
- double fDetail;
- double fDetailBackup;
- sal_Int32 nMaxPixels;
-
- // Groesse der Textur, falls benutzt
- double fTexWidth;
- double fTexHeight;
-
- // Punktkoodinaten fuer Primitive
- Point aOutPointTop;
- Point aOutPointLeft;
- Point aOutPointRight;
-
- // Zeiger auf die Ursprungsdaten
- B3dEntity* pEntTop;
- B3dEntity* pEntLeft;
- B3dEntity* pEntRight;
-
- // benoetigte Interpolatoren
- BxdInterpolator aIntXPosLeft;
- BxdInterpolator aIntXPosRight;
-
- BxdInterpolator aIntDepthLeft;
- BxdInterpolator aIntDepthRight;
- BxdInterpolator aIntDepthLine;
-
- // #96837#
- // Added interpolators for real z coordinate in eye coor. In these,
- // 1/z is interpolated to have a base for perspective corrected texturing.
- BxdInterpolator aRealDepthLeft;
- BxdInterpolator aRealDepthRight;
- BxdInterpolator aRealDepthLine;
-
- BxdInterpolator aIntTexSLeft;
- BxdInterpolator aIntTexSRight;
- BxdInterpolator aIntTexTLeft;
- BxdInterpolator aIntTexTRight;
- BxdInterpolator aIntTexSLine;
- BxdInterpolator aIntTexTLine;
- B3dVectorInterpolator aIntVectorLeft;
- B3dVectorInterpolator aIntVectorRight;
- B3dVectorInterpolator aIntVectorLine;
- BxdColorInterpolator aIntColorLeft;
- BxdColorInterpolator aIntColorRight;
- BxdColorInterpolator aIntColorLine;
-
- // Lokale Scissor Region (ohne TopLeft)
- Rectangle aDefaultScissorRectangle;
-
- // #i71618#
- // derived from mfPolygonOffset in StartScene() using Z-Buffer depth
- sal_uInt32 maPolygonOffset;
-
- // bitfileld
- // Booleans fuer Zeichenoperationen
- unsigned bNormalsUsed : 1;
- unsigned bTextureUsed : 1;
-
- // Bool fuer Detailreduzierung
- unsigned bReducedDetail : 1;
- unsigned bDetailBackedup : 1;
-
- // #96837#
- // Bool for enabling/disabling perspective texture correction
- unsigned mbPTCorrection : 1;
-
- // Funktionen fuer erlangen/freigeben der BitmapAccesses
- void AcquireAccess();
- void ReleaseAccess();
-
- // Umrechnung auf PixelCoor der Bitmaps und zurueck
- Point GetPixelCoor(B3dEntity& rEntity);
- basegfx::B3DPoint Get3DCoor(Point& rPnt, double fDepth);
-
- // ZBuffer funktionen
- inline sal_Bool IsInScissorRegion(sal_Int32 nX, sal_Int32 nY);
- inline sal_Bool IsVisibleAndScissor(sal_Int32 nX, sal_Int32 nY, sal_uInt32 nDepth);
- inline void WritePixel(sal_Int32 nX, sal_Int32 nY, Color aColor, sal_uInt32 nDepth);
-
- // Zeilenerzeuger fuer Polygon
- /*inline*/ void DrawLinePhongTexture(sal_Int32 nYPos, B3dMaterial& rMat);
- /*inline*/ void DrawLinePhong(sal_Int32 nYPos, B3dMaterial& rMat);
- /*inline*/ void DrawLineColorTexture(sal_Int32 nYPos);
- /*inline*/ void DrawLineColor(sal_Int32 nYPos);
- /*inline*/ void DrawLineTexture(sal_Int32 nYPos, Color& rCol);
- /*inline*/ void DrawLine(sal_Int32 nYPos, Color& rCol);
-
- inline void LoadLeft(sal_Int32 nSize);
- inline void LoadLeftTexture(sal_Int32 nSize);
- inline void LoadRight(sal_Int32 nSize);
- inline void LoadRightTexture(sal_Int32 nSize);
-
- inline void NextStepRight();
- inline void NextStepRightTexture();
- inline void NextStepLeft();
- inline void NextStepLeftTexture();
-
-public:
- Base3DDefault(OutputDevice* pOutDev);
- virtual ~Base3DDefault();
-
- // Typbestimmung
- virtual UINT16 GetBase3DType();
-
- // Szenenverwaltung
- virtual void StartScene();
- virtual void EndScene();
-
- // Nullwert des ZBuffers setzen
- void SetClearValue(sal_uInt32 nNew) { aClearValue = Color(nNew); }
-
- // Detailstufe/Vergroeberung der Ausgabe setzen/lesen
- void SetDetail(double fNew=1.0);
- double GetDetail() { return fDetail; }
- void SetMaxPixels(sal_Int32 nNew=500000) { nMaxPixels = nNew; }
- sal_Int32 GetMaxPixels() { return nMaxPixels; }
- virtual void SetDisplayQuality(sal_uInt8 nNew);
-
- // Callbacks bei Matrixaenderungen
- virtual void SetTransformationSet(B3dTransformationSet* pSet);
-
-protected:
-
- // Geometrie
- virtual void Clipped3DPoint(sal_uInt32 nInd);
- virtual void Clipped3DLine(sal_uInt32 nInd1, sal_uInt32 nInd2);
- virtual void Clipped3DTriangle(sal_uInt32 nInd1, sal_uInt32 nInd2, sal_uInt32 nInd3);
-};
-
-
-
-#endif // _B3D_B3DDEFLT_HXX
diff --git a/goodies/source/base3d/b3dentty.cxx b/goodies/source/base3d/b3dentty.cxx
deleted file mode 100644
index 54ad3c01c8c8..000000000000
--- a/goodies/source/base3d/b3dentty.cxx
+++ /dev/null
@@ -1,330 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dentty.cxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include <goodies/b3dentty.hxx>
-#include "b3dcommn.hxx"
-#include "b3dtrans.hxx"
-#include <tools/debug.hxx>
-
-/*************************************************************************
-|*
-|* Kopieren eine 3DEntity
-|*
-\************************************************************************/
-
-void B3dEntity::Copy(B3dEntity& rEnt)
-{
- maPoint = rEnt.maPoint;
- mbDeviceCoor = rEnt.IsDeviceCoor();
- mbValid = rEnt.IsValid();
- mbEdgeFlag = rEnt.mbEdgeFlag;
- maPlaneNormal = rEnt.maPlaneNormal;
-
- mbNormalUsed = rEnt.IsNormalUsed();
- if( mbNormalUsed )
- maNormal = rEnt.maNormal;
-
- mbTexCoorUsed = rEnt.IsTexCoorUsed();
- if( mbTexCoorUsed )
- maTexCoor = rEnt.maTexCoor;
-
- maColor = rEnt.maColor;
-}
-
-/*************************************************************************
-|*
-|* Flags auf Ausgangsposition
-|*
-\************************************************************************/
-
-void B3dEntity::Reset()
-{
- mbValid = mbNormalUsed = mbTexCoorUsed = mbDeviceCoor = sal_False;
- mbEdgeFlag = sal_True;
-}
-
-/*************************************************************************
-|*
-|* Device Koordinaten des Punktes berechnen
-|*
-\************************************************************************/
-
-void B3dEntity::ImplToDeviceCoor(B3dTransformationSet* pSet)
-{
- if(pSet && !mbDeviceCoor)
- {
- const basegfx::B3DVector& rScale = pSet->GetScale();
- const basegfx::B3DVector& rTrans = pSet->GetTranslate();
-
- maPoint.setX((maPoint.getX() * rScale.getX()) + rTrans.getX());
- maPoint.setY((maPoint.getY() * rScale.getY()) + rTrans.getY());
- maPoint.setZ((maPoint.getZ() * rScale.getZ()) + rTrans.getZ());
-
- mbDeviceCoor = sal_True;
- }
-}
-
-/*************************************************************************
-|*
-|* aus Device Koordinaten des Punktes 3D Koor im canonical view volume
-|* berechnen
-|*
-\************************************************************************/
-
-void B3dEntity::ImplTo3DCoor(B3dTransformationSet* pSet)
-{
- if(pSet && mbDeviceCoor)
- {
- const basegfx::B3DVector& rScale = pSet->GetScale();
- const basegfx::B3DVector& rTrans = pSet->GetTranslate();
-
- if(rScale.getX() != 0.0)
- maPoint.setX((maPoint.getX() - rTrans.getX()) / rScale.getX());
- if(rScale.getY() != 0.0)
- maPoint.setY((maPoint.getY() - rTrans.getY()) / rScale.getY());
- if(rScale.getZ() != 0.0)
- maPoint.setZ((maPoint.getZ() - rTrans.getZ()) / rScale.getZ());
-
- mbDeviceCoor = sal_False;
- }
-}
-
-/*************************************************************************
-|*
-|* Garantiere eine gemeinsame Datenbasis (ClipKoordinaten oder
-|* Devicekoordinaten)
-|*
-\************************************************************************/
-
-void B3dEntity::ForceEqualBase(B3dTransformationSet* pSet, B3dEntity& rOld)
-{
- if(IsDeviceCoor() && rOld.IsDeviceCoor())
- {
- SetDeviceCoor();
- }
- else
- {
- if(IsDeviceCoor())
- To3DCoor(pSet);
- if(rOld.IsDeviceCoor())
- rOld.To3DCoor(pSet);
- }
-}
-
-/*************************************************************************
-|*
-|* Garantiere eine gemeinsame Datenbasis (ClipKoordinaten oder
-|* Devicekoordinaten)
-|*
-\************************************************************************/
-
-void B3dEntity::ForceEqualBase(B3dTransformationSet* pSet, B3dEntity& rOld1,
- B3dEntity& rOld2)
-{
- if(!IsDeviceCoor() && rOld1.IsDeviceCoor() && rOld2.IsDeviceCoor())
- {
- if(IsDeviceCoor())
- To3DCoor(pSet);
- if(rOld1.IsDeviceCoor())
- rOld1.To3DCoor(pSet);
- if(rOld2.IsDeviceCoor())
- rOld2.To3DCoor(pSet);
- }
-}
-
-/*************************************************************************
-|*
-|* Neuen Punkt an der stelle t des parametrisierten Vektors rOld1, rOld2
-|* berechnen und fuellen
-|*
-\************************************************************************/
-
-void B3dEntity::CalcInBetween(B3dEntity& rOld1, B3dEntity& rOld2, double t)
-{
- // DeviceCoor der ersten Quelle benutzen, die Basis sollte
- // vorher abgeglichen sein
- SetDeviceCoor(rOld1.IsDeviceCoor());
-
- // Punktkoordinaten berechnen
- maPoint = interpolate(rOld1.Point(), rOld2.Point(), t);
- SetValid();
-
- // PlaneNormal Koordinaten berechnen
- rOld1.PlaneNormal().normalize();
- rOld2.PlaneNormal().normalize();
- maPlaneNormal = interpolate(rOld1.PlaneNormal(), rOld2.PlaneNormal(), t);
- maPlaneNormal.normalize();
-
- // Vektor berechnen
- if(rOld1.IsNormalUsed() && rOld2.IsNormalUsed())
- {
- rOld1.Normal().normalize();
- rOld2.Normal().normalize();
- maNormal = interpolate(rOld1.Normal(), rOld2.Normal(), t);
- maNormal.normalize();
- SetNormalUsed();
- }
-
- // Texturkoordinaten berechnen
- if(rOld1.IsTexCoorUsed() && rOld2.IsTexCoorUsed())
- {
- maTexCoor = interpolate(rOld1.TexCoor(), rOld2.TexCoor(), t);
- SetTexCoorUsed();
- }
-
- // EdgeVisible berechnen
- SetEdgeVisible(rOld1.IsEdgeVisible());
-
- // Farbe berechnen
- maColor.CalcInBetween(rOld1.Color(), rOld2.Color(), t);
-}
-
-/*************************************************************************
-|*
-|* Neuen Punkt in der Mitte des parametrisierten Vektors rOld1, rOld2
-|* berechnen und fuellen
-|*
-\************************************************************************/
-
-void B3dEntity::CalcMiddle(B3dEntity& rOld1, B3dEntity& rOld2)
-{
- // DeviceCoor der ersten Quelle benutzen, die Basis sollte
- // vorher abgeglichen sein
- SetDeviceCoor(rOld1.IsDeviceCoor());
-
- // Punktkoordinaten berechnen
- maPoint = average(rOld1.Point(), rOld2.Point());
- SetValid();
-
- // PlaneNormal Koordinaten berechnen
- rOld1.PlaneNormal().normalize();
- rOld2.PlaneNormal().normalize();
- maPlaneNormal = average(rOld1.PlaneNormal(), rOld2.PlaneNormal());
- maPlaneNormal.normalize();
-
- // Vektor berechnen
- if(rOld1.IsNormalUsed() && rOld2.IsNormalUsed())
- {
- rOld1.Normal().normalize();
- rOld2.Normal().normalize();
- maNormal = average(rOld1.Normal(), rOld2.Normal());
- maNormal.normalize();
- SetNormalUsed();
- }
-
- // Texturkoordinaten berechnen
- if(rOld1.IsTexCoorUsed() && rOld2.IsTexCoorUsed())
- {
- maTexCoor = average(rOld1.TexCoor(), rOld2.TexCoor());
- SetTexCoorUsed();
- }
-
- // EdgeVisible berechnen
- SetEdgeVisible(rOld1.IsEdgeVisible());
-
- // Farbe berechnen
- maColor.CalcMiddle(rOld1.Color(), rOld2.Color());
-}
-
-/*************************************************************************
-|*
-|* Neuen Punkt in der Mitte des Dreiecks rOld1, rOld2, rOld3
-|* berechnen und fuellen
-|*
-\************************************************************************/
-
-void B3dEntity::CalcMiddle(B3dEntity& rOld1, B3dEntity& rOld2,
- B3dEntity& rOld3)
-{
- // DeviceCoor der ersten Quelle benutzen, die Basis sollte
- // vorher abgeglichen sein
- SetDeviceCoor(rOld1.IsDeviceCoor());
-
- // Punktkoordinaten berechnen
- maPoint = average(rOld1.Point(), rOld2.Point(), rOld3.Point());
- SetValid();
-
- // PlaneNormal Koordinaten berechnen
- rOld1.PlaneNormal().normalize();
- rOld2.PlaneNormal().normalize();
- rOld3.PlaneNormal().normalize();
- maPlaneNormal = average(rOld1.PlaneNormal(), rOld2.PlaneNormal(), rOld3.PlaneNormal());
- maPlaneNormal.normalize();
-
- // Vektor berechnen
- if(rOld1.IsNormalUsed() && rOld2.IsNormalUsed() && rOld3.IsNormalUsed())
- {
- rOld1.Normal().normalize();
- rOld2.Normal().normalize();
- rOld3.Normal().normalize();
- maNormal = average(rOld1.Normal(), rOld2.Normal(), rOld3.Normal());
- maNormal.normalize();
- SetNormalUsed();
- }
-
- // Texturkoordinaten berechnen
- if(rOld1.IsTexCoorUsed() && rOld2.IsTexCoorUsed() && rOld3.IsTexCoorUsed())
- {
- maTexCoor = average(rOld1.TexCoor(), rOld2.TexCoor(), rOld3.TexCoor());
- SetTexCoorUsed();
- }
-
- // Farbe berechnen
- maColor.CalcMiddle(rOld1.Color(), rOld2.Color(), rOld3.Color());
-}
-
-/*************************************************************************
-|*
-|* Eine beliebige Transformation auf die Geometrie anwenden
-|*
-\************************************************************************/
-
-void B3dEntity::Transform(const basegfx::B3DHomMatrix& rMat)
-{
- maPoint *= rMat;
-
- if(mbNormalUsed)
- {
- maNormal *= rMat; // RotateAndNormalize
- maNormal.normalize();
- }
-}
-
-/*************************************************************************
-|*
-|* Bucket fuer geometrische Daten
-|*
-\************************************************************************/
-
-BASE3D_IMPL_BUCKET(B3dEntity, Bucket)
-
-// eof
diff --git a/goodies/source/base3d/b3dgeom.cxx b/goodies/source/base3d/b3dgeom.cxx
deleted file mode 100644
index af107ee15411..000000000000
--- a/goodies/source/base3d/b3dgeom.cxx
+++ /dev/null
@@ -1,975 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dgeom.cxx,v $
- * $Revision: 1.13 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include <goodies/b3dgeom.hxx>
-#include <goodies/b3dcompo.hxx>
-
-//#ifndef _B3D_HMATRIX_HXX
-//#include "hmatrix.hxx"
-//#endif
-#include <goodies/base3d.hxx>
-#include <tools/debug.hxx>
-
-#ifndef _INC_MATH
-#include <math.h>
-#endif
-#include <basegfx/matrix/b3dhommatrix.hxx>
-
-/*************************************************************************
-|*
-|* Bucket fuer Index
-|*
-\************************************************************************/
-
-BASE3D_IMPL_BUCKET(GeometryIndexValue, Bucket)
-
-/*************************************************************************
-|*
-|* Konstruktor
-|*
-\************************************************************************/
-
-B3dGeometry::B3dGeometry()
-: pComplexPolygon(NULL),
- aEntityBucket(14), // 16K
- aIndexBucket(8) // 256Byte
-{
- Reset();
-}
-
-/*************************************************************************
-|*
-|* Ausgangszustand der Variablen herstellen
-|*
-\************************************************************************/
-
-void B3dGeometry::Reset()
-{
- bHintIsComplex = sal_False;
- if(pComplexPolygon)
- delete pComplexPolygon;
- pComplexPolygon = NULL;
-
- // #93136# since #92030# uses bOutline flag now as indication
- // if the filled object is to be drawn, it MUST be initialized now.
- bOutline = sal_False;
-}
-
-/*************************************************************************
-|*
-|* Freien Eintrag zum fuellen holen
-|*
-\************************************************************************/
-
-B3dEntity& B3dGeometry::GetFreeEntity()
-{
- aEntityBucket.Append();
- return aEntityBucket[aEntityBucket.Count() - 1];
-}
-
-/*************************************************************************
-|*
-|* Inhalte loeschen
-|*
-\************************************************************************/
-
-void B3dGeometry::Erase()
-{
- aEntityBucket.Erase();
- aIndexBucket.Erase();
- Reset();
-}
-
-/*************************************************************************
-|*
-|* Inhalte loeschen und Speicher freigeben
-|*
-\************************************************************************/
-
-void B3dGeometry::Empty()
-{
- aEntityBucket.Empty();
- aIndexBucket.Empty();
- Reset();
-}
-
-/*************************************************************************
-|*
-|* Start der Geometriebeschreibung
-|*
-\************************************************************************/
-
-void B3dGeometry::StartDescription()
-{
- Erase();
-}
-
-/*************************************************************************
-|*
-|* Ende der Geometriebeschreibung
-|*
-\************************************************************************/
-
-void B3dGeometry::EndDescription()
-{
- if(pComplexPolygon)
- delete pComplexPolygon;
- pComplexPolygon = NULL;
-}
-
-/*************************************************************************
-|*
-|* Neues Primitiv beginnen
-|*
-\************************************************************************/
-
-void B3dGeometry::StartObject(sal_Bool bHintComplex, sal_Bool bOutl)
-{
- // Hint uebernehmen
- bHintIsComplex = bHintComplex;
- bOutline = bOutl;
-
- // ComplexPolygon anlegen falls nicht vorhanden
- if(bHintIsComplex)
- {
- if(!pComplexPolygon)
- pComplexPolygon = new B3dComplexPolygon;
- pComplexPolygon->StartPrimitive();
- }
- else
- {
- // Direkt neues Polygon beginnen
- StartPolygon();
- }
-}
-
-/*************************************************************************
-|*
-|* Primitiv abschliessen
-|*
-\************************************************************************/
-
-void B3dGeometry::EndObject()
-{
- // Unteren Index holen
- sal_uInt32 nLow = 0L;
- if(aIndexBucket.Count())
- nLow = aIndexBucket[aIndexBucket.Count()-1].GetIndex();
-
- if(bHintIsComplex)
- {
- pComplexPolygon->EndPrimitive(this);
- }
- else
- {
- // Polygon abschliessen
- EndPolygon();
- }
-
- // EbenenNormale berechnen und setzen; bei Linien und
- // Punkten wird PlaneNormal auf (0,0,0) gesetzt
- if(aIndexBucket.Count())
- {
- sal_uInt32 nHigh = aIndexBucket[aIndexBucket.Count()-1].GetIndex();
- basegfx::B3DVector aPlaneNormal = -CalcNormal(nLow, nHigh);
- while(nLow < nHigh)
- aEntityBucket[nLow++].PlaneNormal() = aPlaneNormal;
- }
-}
-
-/*************************************************************************
-|*
-|* Geometrieuebergabe
-|*
-\************************************************************************/
-
-void B3dGeometry::AddEdge(const basegfx::B3DPoint& rPoint)
-{
- if(bHintIsComplex)
- {
- B3dEntity& rNew = pComplexPolygon->GetFreeEntity();
-
- rNew.Reset();
- rNew.Point() = rPoint;
- rNew.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rNew.SetValid();
- rNew.SetEdgeVisible(sal_True);
-
- pComplexPolygon->PostAddVertex(rNew);
- }
- else
- {
- B3dEntity& rNew = GetFreeEntity();
-
- rNew.Reset();
- rNew.Point() = rPoint;
- rNew.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rNew.SetValid();
- rNew.SetEdgeVisible(sal_True);
- }
-}
-
-void B3dGeometry::AddEdge(const basegfx::B3DPoint& rPoint, const basegfx::B3DVector& rNormal)
-{
- if(bHintIsComplex)
- {
- B3dEntity& rNew = pComplexPolygon->GetFreeEntity();
-
- rNew.Reset();
- rNew.Point() = rPoint;
- rNew.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rNew.SetValid();
- rNew.Normal() = rNormal;
- rNew.SetNormalUsed();
- rNew.SetEdgeVisible(sal_True);
-
- pComplexPolygon->PostAddVertex(rNew);
- }
- else
- {
- B3dEntity& rNew = GetFreeEntity();
-
- rNew.Reset();
- rNew.Point() = rPoint;
- rNew.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rNew.SetValid();
- rNew.Normal() = rNormal;
- rNew.SetNormalUsed();
- rNew.SetEdgeVisible(sal_True);
- }
-}
-
-void B3dGeometry::AddEdge(const basegfx::B3DPoint& rPoint, const basegfx::B3DVector& rNormal, const basegfx::B2DPoint& rTexture)
-{
- if(bHintIsComplex)
- {
- B3dEntity& rNew = pComplexPolygon->GetFreeEntity();
-
- rNew.Reset();
- rNew.Point() = rPoint;
- rNew.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rNew.SetValid();
- rNew.Normal() = rNormal;
- rNew.SetNormalUsed();
- rNew.TexCoor() = rTexture;
- rNew.SetTexCoorUsed();
- rNew.SetEdgeVisible(sal_True);
-
- pComplexPolygon->PostAddVertex(rNew);
- }
- else
- {
- B3dEntity& rNew = GetFreeEntity();
-
- rNew.Reset();
- rNew.Point() = rPoint;
- rNew.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rNew.SetValid();
- rNew.Normal() = rNormal;
- rNew.SetNormalUsed();
- rNew.TexCoor() = rTexture;
- rNew.SetTexCoorUsed();
- rNew.SetEdgeVisible(sal_True);
- }
-}
-
-/*************************************************************************
-|*
-|* Copy-Operator
-|*
-\************************************************************************/
-
-void B3dGeometry::operator=(const B3dGeometry& rObj)
-{
- // Bucket kopieren
- aEntityBucket = rObj.aEntityBucket;
- aIndexBucket = rObj.aIndexBucket;
-
- // ComplexPolygon nicht kopieren
- pComplexPolygon = NULL;
-
- // Hint auch nicht
- bHintIsComplex = sal_False;
-}
-
-/*************************************************************************
-|*
-|* Callbacks bei komplexen Primitiven
-|*
-\************************************************************************/
-
-void B3dGeometry::StartComplexPrimitive()
-{
- StartPolygon();
-}
-
-void B3dGeometry::EndComplexPrimitive()
-{
- EndPolygon();
-}
-
-void B3dGeometry::AddComplexVertex(B3dEntity& rNew, sal_Bool bIsVisible)
-{
- // Kopieren
- B3dEntity& rLocal = GetFreeEntity();
- rLocal = rNew;
-
- // EdgeFlag anpassen
- rLocal.SetEdgeVisible(bIsVisible);
-}
-
-/*************************************************************************
-|*
-|* PolygonStart und -Ende aufzeichnen
-|*
-\************************************************************************/
-
-void B3dGeometry::StartPolygon()
-{
-}
-
-void B3dGeometry::EndPolygon()
-{
- GeometryIndexValue aNewIndex(aEntityBucket.Count());
- if(bOutline)
- aNewIndex.SetMode(B3D_INDEX_MODE_LINE);
- aIndexBucket.Append(aNewIndex);
-}
-
-/*************************************************************************
-|*
-|* Eine beliebige Transformation auf die Geometrie anwenden
-|*
-\************************************************************************/
-
-void B3dGeometry::Transform(const basegfx::B3DHomMatrix& rMat)
-{
- for(sal_uInt32 a=0;a<aEntityBucket.Count();a++)
- aEntityBucket[a].Transform(rMat);
-}
-
-/*************************************************************************
-|*
-|* Hittest auf Geometrie
-|* Liegt der angegebene Schnittpunkt innerhalb eines der Polygone?
-|*
-\************************************************************************/
-
-sal_Bool B3dGeometry::CheckHit(const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, sal_uInt16 /*nTol*/)
-{
- sal_uInt32 nPolyCounter(0L);
- sal_uInt32 nEntityCounter(0L);
- sal_uInt32 nUpperBound(0L);
-
- while(nPolyCounter < aIndexBucket.Count())
- {
- // Obergrenze neues Polygon holen
- nUpperBound = aIndexBucket[nPolyCounter++].GetIndex();
-
- // Hittest fuer momentanes Polygon
- basegfx::B3DPoint aCut;
-
- if(CheckSinglePolygonHit(nEntityCounter, nUpperBound, rFront, rBack, aCut))
- {
- return sal_True;
- }
-
- // Auf naechstes Polygon
- nEntityCounter = nUpperBound;
- }
-
- return sal_False;
-}
-
-// #110988# get all cuts of the geometry with the given vector defined by the two positions
-void B3dGeometry::GetAllCuts(::std::vector< basegfx::B3DPoint >& rVector, const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack) const
-{
- sal_uInt32 nPolyCounter(0L);
- sal_uInt32 nEntityCounter(0L);
- sal_uInt32 nUpperBound;
-
- while(nPolyCounter < ((B3dGeometry*)this)->aIndexBucket.Count())
- {
- // get upper bound for new polygon
- nUpperBound = ((B3dGeometry*)this)->aIndexBucket[nPolyCounter++].GetIndex();
-
- // get cut for that polygon
- basegfx::B3DPoint aCut;
-
- if(CheckSinglePolygonHit(nEntityCounter, nUpperBound, rFront, rBack, aCut))
- {
- rVector.push_back(aCut);
- }
-
- // Auf naechstes Polygon
- nEntityCounter = nUpperBound;
- }
-}
-
-sal_Bool B3dGeometry::CheckSinglePolygonHit(sal_uInt32 nLow, sal_uInt32 nHigh, const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack, basegfx::B3DPoint& rCut) const
-{
- if(nLow + 2 < nHigh)
- {
- // calculate cut with plane
- if(GetCutPoint(nLow, rCut, rFront, rBack))
- {
- // cut exists, is it inside the polygon?
- if(IsInside(nLow, nHigh, rCut))
- {
- return sal_True;
- }
- }
- }
-
- return sal_False;
-}
-
-sal_Bool B3dGeometry::GetCutPoint(sal_uInt32 nLow, basegfx::B3DPoint& rCut, const basegfx::B3DPoint& rFront, const basegfx::B3DPoint& rBack) const
-{
- sal_Bool bCutValid = sal_False;
-
- // Normale und Skalar der Ebenengleichung ermitteln
- const basegfx::B3DVector aNormal = ((B3dGeometry*)this)->aEntityBucket[nLow].PlaneNormal();
- const basegfx::B3DVector aPointAsVec = ((B3dGeometry*)this)->aEntityBucket[nLow + 1].Point();
- double fScalar = -(aPointAsVec.scalar(aNormal));
- basegfx::B3DVector aLineVec = rFront - rBack;
- double fZwi = aNormal.scalar(aLineVec);
-
- if(fabs(fZwi) > SMALL_DVALUE)
- {
- fZwi = (-fScalar - (basegfx::B3DVector(rBack).scalar(aNormal))) / fZwi;
- rCut.setX(rBack.getX() + (aLineVec.getX() * fZwi));
- rCut.setY(rBack.getY() + (aLineVec.getY() * fZwi));
- rCut.setZ(rBack.getZ() + (aLineVec.getZ() * fZwi));
-
- bCutValid = sal_True;
- }
- return bCutValid;
-}
-
-sal_Bool B3dGeometry::IsInside(sal_uInt32 nLow, sal_uInt32 nHigh, const basegfx::B3DPoint& rPnt) const
-{
- sal_Bool bInside(sal_False);
- basegfx::B3DRange aVolume;
-
- // Volume von genau dieser Flaeche feststellen
- for(sal_uInt32 a=nLow;a<nHigh;a++)
- aVolume.expand(((B3dGeometry*)this)->aEntityBucket[a].Point());
-
- // Hier eigentlich ein aVolume.IsInside(rPnt), doch da hier ein
- // Vergleich mit Epsilon-Umgebung gebraucht wird, vergleiche selbst
- sal_Bool bIsInside =
- (rPnt.getX() + SMALL_DVALUE >= aVolume.getMinX() && rPnt.getX() - SMALL_DVALUE <= aVolume.getMaxX()
- && rPnt.getY() + SMALL_DVALUE >= aVolume.getMinY() && rPnt.getY() - SMALL_DVALUE <= aVolume.getMaxY()
- && rPnt.getZ() + SMALL_DVALUE >= aVolume.getMinZ() && rPnt.getZ() - SMALL_DVALUE <= aVolume.getMaxZ());
-
- if(bIsInside)
- {
- sal_Bool bInsideXY(sal_False);
- sal_Bool bInsideXZ(sal_False);
- sal_Bool bInsideYZ(sal_False);
- const basegfx::B3DPoint* pPrev = &(((B3dGeometry*)this)->aEntityBucket[nHigh - 1].Point());
- const basegfx::B3DPoint* pActual;
- basegfx::B3DVector aDiffPrev, aDiffActual;
-
- while(nLow < nHigh)
- {
- // Neuen Punkt holen
- pActual = &(((B3dGeometry*)this)->aEntityBucket[nLow++].Point());
-
- // Diffs bilden
- aDiffPrev = *pPrev - rPnt;
- aDiffActual = *pActual - rPnt;
-
- // Ueberschneidung in Y moeglich?
- if((aDiffPrev.getY() > 0.0 && aDiffActual.getY() <= 0.0) || (aDiffActual.getY() > 0.0 && aDiffPrev.getY() <= 0.0))
- {
- // in welchem Bereich liegt X?
- if(aDiffPrev.getX() >= 0.0 && aDiffActual.getX() >= 0.0)
- {
- // Ueberschneidung
- bInsideXY = !bInsideXY;
- }
- else if((aDiffPrev.getX() > 0.0 && aDiffActual.getX() <= 0.0) || (aDiffActual.getX() > 0.0 && aDiffPrev.getX() <= 0.0))
- {
- // eventuell Ueberschneidung
- // wo liegt die X-Koordinate des Schnitts mit der X-Achse?
- if(aDiffActual.getY() != aDiffPrev.getY())
- if(aDiffPrev.getX() - ((aDiffPrev.getY() * (aDiffActual.getX() - aDiffPrev.getX())) / (aDiffActual.getY() - aDiffPrev.getY())) >= 0.0)
- // Ueberschneidung
- bInsideXY = !bInsideXY;
- }
-
- // in welchem Bereich liegt Z?
- if(aDiffPrev.getZ() >= 0.0 && aDiffActual.getZ() >= 0.0)
- {
- // Ueberschneidung
- bInsideYZ = !bInsideYZ;
- }
- else if((aDiffPrev.getZ() > 0.0 && aDiffActual.getZ() <= 0.0) || (aDiffActual.getZ() > 0.0 && aDiffPrev.getZ() <= 0.0))
- {
- // eventuell Ueberschneidung
- // wo liegt die X-Koordinate des Schnitts mit der X-Achse?
- if(aDiffActual.getY() != aDiffPrev.getY())
- if(aDiffPrev.getZ() - ((aDiffPrev.getY() * (aDiffActual.getZ() - aDiffPrev.getZ())) / (aDiffActual.getY() - aDiffPrev.getY())) >= 0.0)
- // Ueberschneidung
- bInsideYZ = !bInsideYZ;
- }
- }
-
- // Ueberschneidung in X moeglich?
- if((aDiffPrev.getX() > 0.0 && aDiffActual.getX() <= 0.0) || (aDiffActual.getX() > 0.0 && aDiffPrev.getX() <= 0.0))
- {
- // in welchem Bereich liegt Z?
- if(aDiffPrev.getZ() >= 0.0 && aDiffActual.getZ() >= 0.0)
- {
- // Ueberschneidung
- bInsideXZ = !bInsideXZ;
- }
- else if((aDiffPrev.getZ() > 0.0 && aDiffActual.getZ() <= 0.0) || (aDiffActual.getZ() > 0.0 && aDiffPrev.getZ() <= 0.0))
- {
- // eventuell Ueberschneidung
- // wo liegt die X-Koordinate des Schnitts mit der X-Achse?
- if(aDiffActual.getX() != aDiffPrev.getX())
- if(aDiffPrev.getZ() - ((aDiffPrev.getX() * (aDiffActual.getZ() - aDiffPrev.getZ())) / (aDiffActual.getX() - aDiffPrev.getX())) >= 0.0)
- // Ueberschneidung
- bInsideXZ = !bInsideXZ;
- }
- }
-
- // Punkt als Vorgaenger merken
- pPrev = pActual;
- }
- // Wahrheitswert bilden
- bInside = bInsideXY || bInsideXZ || bInsideYZ;
- }
- return bInside;
-}
-
-/*************************************************************************
-|*
-|* BoundVolume liefern
-|*
-\************************************************************************/
-
-basegfx::B3DRange B3dGeometry::GetBoundVolume() const
-{
- basegfx::B3DRange aRetval;
-
- for(sal_uInt32 a=0;a<((B3dGeometry*)this)->aEntityBucket.Count();a++)
- {
- aRetval.expand(((B3dGeometry*)this)->aEntityBucket[a].Point());
- }
-
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Mittelpunkt liefern
-|*
-\************************************************************************/
-
-basegfx::B3DPoint B3dGeometry::GetCenter() const
-{
- basegfx::B3DRange aVolume = GetBoundVolume();
- return aVolume.getCenter();
-}
-
-/*************************************************************************
-|*
-|* Standard - Normalen generieren
-|*
-\************************************************************************/
-
-void B3dGeometry::CreateDefaultNormalsSphere()
-{
- // Alle Normalen ausgehend vom Zentrum der Geometrie bilden
- basegfx::B3DPoint aCenter = GetCenter();
-
- for(sal_uInt32 a=0;a<aEntityBucket.Count();a++)
- {
- const basegfx::B3DPoint& aPoint = aEntityBucket[a].Point();
- basegfx::B3DVector aNewNormal = aPoint - aCenter;
- aNewNormal.normalize();
- aEntityBucket[a].Normal() = aNewNormal;
- aEntityBucket[a].SetNormalUsed(sal_True);
- }
-}
-
-/*************************************************************************
-|*
-|* Normale ermitteln fuer einzelnes Polygon
-|*
-\************************************************************************/
-
-basegfx::B3DVector B3dGeometry::CalcNormal(sal_uInt32 nLow, sal_uInt32 nHigh) const
-{
- const basegfx::B3DPoint* pVec1 = NULL;
- const basegfx::B3DPoint* pVec2 = NULL;
- const basegfx::B3DPoint* pVec3 = NULL;
- basegfx::B3DVector aNormal;
-
- while(nLow < nHigh && !(pVec1 && pVec2 && pVec3))
- {
- if(!pVec1)
- {
- pVec1 = &(((B3dGeometry*)this)->aEntityBucket[nLow++].Point());
- }
- else if(!pVec2)
- {
- pVec2 = &(((B3dGeometry*)this)->aEntityBucket[nLow++].Point());
- if(*pVec2 == *pVec1)
- pVec2 = NULL;
- }
- else if(!pVec3)
- {
- pVec3 = &(((B3dGeometry*)this)->aEntityBucket[nLow++].Point());
- if(*pVec3 == *pVec2 || *pVec3 == *pVec1) // #125865#
- pVec3 = NULL;
- }
- }
- if(pVec1 && pVec2 && pVec3)
- {
- aNormal = basegfx::B3DVector(*pVec2 - *pVec1).getPerpendicular(basegfx::B3DVector(*pVec2 - *pVec3));
- aNormal.normalize();
- }
- return aNormal;
-}
-
-/*************************************************************************
-|*
-|* Normaleninformationen ungueltig machen
-|*
-\************************************************************************/
-
-void B3dGeometry::RemoveNormals()
-{
- for(sal_uInt32 a=0;a<aEntityBucket.Count();a++)
- aEntityBucket[a].SetNormalUsed(sal_False);
-}
-
-/*************************************************************************
-|*
-|* Standard - Texturkoordinaten generieren
-|*
-\************************************************************************/
-
-void B3dGeometry::CreateDefaultTexture(sal_uInt16 nCreateWhat, sal_Bool bUseSphere)
-{
- if(nCreateWhat)
- {
- if(bUseSphere)
- {
- // Texturkoordinaten mittels Kugelprojektion ermitteln,
- // dazu das Zentrum der Geometrie benutzen
- // Alle Normalen ausgehend vom Zentrum der Geometrie bilden
- basegfx::B3DPoint aCenter = GetCenter();
- sal_uInt32 nPointCounter = 0;
-
- for(sal_uInt32 a=0;a<aIndexBucket.Count();a++)
- {
- // Lokales Zentrum der zu behandelnden Flaeche bilden,
- // um zu wissen von welcher Seite sich diese Flaeche
- // dem Winkel F_PI bzw. -F_PI naehert
- basegfx::B3DVector aLocalCenter;
- for(sal_uInt32 b=nPointCounter;b<aIndexBucket[a].GetIndex();b++)
- aLocalCenter += aEntityBucket[b].Point();
- aLocalCenter /= aIndexBucket[a].GetIndex() - nPointCounter;
-
- // Vektor vom Mittelpunkt zum lokalen Zentrum bilden
- if(fabs(aLocalCenter.getX()) < SMALL_DVALUE)
- aLocalCenter.setX(0.0);
- if(fabs(aLocalCenter.getY()) < SMALL_DVALUE)
- aLocalCenter.setY(0.0);
- if(fabs(aLocalCenter.getZ()) < SMALL_DVALUE)
- aLocalCenter.setZ(0.0);
-
- // X,Y fuer das lokale Zentrum bilden
- double fXCenter = atan2(aLocalCenter.getZ(), aLocalCenter.getX());
- double fYCenter = atan2(aLocalCenter.getY(), aLocalCenter.getXZLength());
- fXCenter = 1.0 - ((fXCenter + F_PI) / F_2PI);
- fYCenter = 1.0 - ((fYCenter + F_PI2) / F_PI);
-
- // Einzelne Punkte behandeln
- sal_uInt32 nRememberPointCounter = nPointCounter;
- while(nPointCounter < aIndexBucket[a].GetIndex())
- {
- // Vektor vom Mittelpunkt zum Punkt bilden
- const basegfx::B3DPoint& aPoint = aEntityBucket[nPointCounter].Point();
- basegfx::B3DVector aDirection = aPoint - aCenter;
- if(fabs(aDirection.getX()) < SMALL_DVALUE)
- aDirection.setX(0.0);
- if(fabs(aDirection.getY()) < SMALL_DVALUE)
- aDirection.setY(0.0);
- if(fabs(aDirection.getZ()) < SMALL_DVALUE)
- aDirection.setZ(0.0);
-
- // X,Y fuer Punkt bilden
- double fXPoint = atan2(aDirection.getZ(), aDirection.getX());
- double fYPoint = atan2(aDirection.getY(), aDirection.getXZLength());
- fXPoint = 1.0 - ((fXPoint + F_PI) / F_2PI);
- fYPoint = 1.0 - ((fYPoint + F_PI2) / F_PI);
-
- // X,Y des Punktes korrigieren
- if(fXPoint > fXCenter + 0.5)
- fXPoint -= 1.0;
- if(fXPoint < fXCenter - 0.5)
- fXPoint += 1.0;
-
- // Polarkoordinaten als Texturkoordinaten zuweisen
- if(nCreateWhat & B3D_CREATE_DEFAULT_X)
- aEntityBucket[nPointCounter].TexCoor().setX(fXPoint);
- if(nCreateWhat & B3D_CREATE_DEFAULT_Y)
- aEntityBucket[nPointCounter].TexCoor().setY(fYPoint);
-
- aEntityBucket[nPointCounter++].SetTexCoorUsed(sal_True);
- }
-
- // Punkte korrigieren, die direkt in den Polarregionen liegen. Deren
- // X-Koordinate kann nicht korrekt sein. Die korrekte X-Koordinate
- // ist diejenige des Punktes, der in den Pol hinein oder aus diesem heraus
- // fuehrt, auf der Kugel also direkt darauf zu.
- if(nCreateWhat & B3D_CREATE_DEFAULT_X)
- {
- nPointCounter = nRememberPointCounter;
- while(nPointCounter < aIndexBucket[a].GetIndex())
- {
- basegfx::B2DPoint& aCoor = aEntityBucket[nPointCounter].TexCoor();
- if(fabs(aCoor.getY()) < SMALL_DVALUE || fabs(aCoor.getY() - 1.0) < SMALL_DVALUE)
- {
- // Nachfolger finden
- sal_uInt32 nNextIndex = (nPointCounter + 1 < aIndexBucket[a].GetIndex())
- ? nPointCounter + 1 : nRememberPointCounter;
- basegfx::B2DPoint& aNextCoor = aEntityBucket[nNextIndex].TexCoor();
-
- // Vorgaenger finden
- sal_uInt32 nPrevIndex = (nPointCounter && nPointCounter - 1 >= nRememberPointCounter)
- ? nPointCounter - 1 : aIndexBucket[a].GetIndex() - 1;
- basegfx::B2DPoint& aPrevCoor = aEntityBucket[nPrevIndex].TexCoor();
-
- // Nachfolger testen: Liegt dieser ausserhalb des Pols?
- if(fabs(aNextCoor.getY()) > SMALL_DVALUE && fabs(aNextCoor.getY() - 1.0) > SMALL_DVALUE)
- {
- // falls ja: X-Koordinate uebernehmen
- aCoor.setX(aNextCoor.getX());
- }
- // Vorgaenger testen: Liegt dieser ausserhalb des Pols?
- else if(fabs(aPrevCoor.getY()) > SMALL_DVALUE && fabs(aPrevCoor.getY() - 1.0) > SMALL_DVALUE)
- {
- // falls ja, X-Koordinate uebernehmen
- aCoor.setX(aPrevCoor.getX());
- }
- else
- {
- // Weder Vorgaenger noch Nachfolger liegen ausserhalb des Pols.
- // Uebernimm daher wenigstens den bereits korrigierten X-Wert
- // des Vorgaengers
- aCoor.setX(aPrevCoor.getX());
- }
- }
- // naechster Punkt
- nPointCounter++;
- }
- }
- }
- }
- else
- {
- // Texturkoordinaten als Parallelprojektion auf X,Y,Z - Koordinaten
- // im Bereich 1.0 bis 0.0 der Geometrie abstellen
- // Gesamtabmessungen holen
- basegfx::B3DRange aVolume = GetBoundVolume();
-
- for(sal_uInt32 a=0;a<aEntityBucket.Count();a++)
- {
- const basegfx::B3DPoint& aPoint = aEntityBucket[a].Point();
-
- if(nCreateWhat & B3D_CREATE_DEFAULT_X)
- {
- if(aVolume.getWidth())
- aEntityBucket[a].TexCoor().setX((aPoint.getX() - aVolume.getMinX()) / aVolume.getWidth());
- else
- aEntityBucket[a].TexCoor().setX(0.0);
- }
-
- if(nCreateWhat & B3D_CREATE_DEFAULT_Y)
- {
- if(aVolume.getHeight())
- aEntityBucket[a].TexCoor().setY(1.0 - ((aPoint.getY() - aVolume.getMinY()) / aVolume.getHeight()));
- else
- aEntityBucket[a].TexCoor().setY(1.0);
- }
-
- aEntityBucket[a].SetTexCoorUsed(sal_True);
- }
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Texturinformationen ungueltig machen
-|*
-\************************************************************************/
-
-void B3dGeometry::RemoveTexture()
-{
- for(sal_uInt32 a=0;a<aEntityBucket.Count();a++)
- aEntityBucket[a].SetTexCoorUsed(sal_False);
-}
-
-/*************************************************************************
-|*
-|* Default-Geometrien erstellen
-|*
-\************************************************************************/
-
-void B3dGeometry::CreateCube(const basegfx::B3DRange& rVolume)
-{
- Erase();
- StartDescription();
- basegfx::B3DPoint A(rVolume.getMinX(), rVolume.getMaxY(), rVolume.getMinZ());
- basegfx::B3DPoint B(rVolume.getMaxX(), rVolume.getMaxY(), rVolume.getMinZ());
- basegfx::B3DPoint C(rVolume.getMaxX(), rVolume.getMinY(), rVolume.getMinZ());
- basegfx::B3DPoint D(rVolume.getMinX(), rVolume.getMinY(), rVolume.getMinZ());
- basegfx::B3DPoint E(rVolume.getMinX(), rVolume.getMaxY(), rVolume.getMaxZ());
- basegfx::B3DPoint F(rVolume.getMaxX(), rVolume.getMaxY(), rVolume.getMaxZ());
- basegfx::B3DPoint G(rVolume.getMaxX(), rVolume.getMinY(), rVolume.getMaxZ());
- basegfx::B3DPoint H(rVolume.getMinX(), rVolume.getMinY(), rVolume.getMaxZ());
- StartObject(sal_False);
- AddEdge(A);
- AddEdge(B);
- AddEdge(C);
- AddEdge(D);
- EndObject();
- StartObject(sal_False);
- AddEdge(A);
- AddEdge(E);
- AddEdge(F);
- AddEdge(B);
- EndObject();
- StartObject(sal_False);
- AddEdge(B);
- AddEdge(F);
- AddEdge(G);
- AddEdge(C);
- EndObject();
- StartObject(sal_False);
- AddEdge(C);
- AddEdge(G);
- AddEdge(H);
- AddEdge(D);
- EndObject();
- StartObject(sal_False);
- AddEdge(D);
- AddEdge(H);
- AddEdge(E);
- AddEdge(A);
- EndObject();
- StartObject(sal_False);
- AddEdge(E);
- AddEdge(H);
- AddEdge(G);
- AddEdge(F);
- EndObject();
- EndDescription();
- CreateDefaultNormalsSphere();
- CreateDefaultTexture(B3D_CREATE_DEFAULT_ALL, sal_False);
-}
-
-void B3dGeometry::CreateSphere(const basegfx::B3DRange& rVolume, double fX, double fY)
-{
- Erase();
- StartDescription();
- basegfx::B3DPoint A,B,C,D;
- double fXInc, fYInc;
- if(fX == 0.0)
- fX = 4.0;
- fXInc = F_2PI / fX;
- if(fY == 0.0)
- fY = 4.0;
- fYInc = F_PI / fY;
- sal_uInt16 nX = (sal_uInt16)fX;
- sal_uInt16 nY = (sal_uInt16)fY;
- fX = 0.0;
- for(sal_uInt16 a=0;a<nX;a++,fX+=fXInc)
- {
- fY = -F_PI2;
- for(sal_uInt16 b=0;b<nY;b++,fY+=fYInc)
- {
- A.setY(sin(fY+fYInc));
- B.setY(A.getY());
- D.setY(sin(fY));
- C.setY(D.getY());
- A.setX(cos(fX) * cos(fY+fYInc));
- D.setX(cos(fX) * cos(fY));
- B.setX(cos(fX+fXInc) * cos(fY+fYInc));
- C.setX(cos(fX+fXInc) * cos(fY));
- A.setZ(sin(fX) * cos(fY+fYInc));
- D.setZ(sin(fX) * cos(fY));
- B.setZ(sin(fX+fXInc) * cos(fY+fYInc));
- C.setZ(sin(fX+fXInc) * cos(fY));
- StartObject(sal_False);
- AddEdge(A);
- AddEdge(B);
- AddEdge(C);
- AddEdge(D);
- EndObject();
- }
- }
- EndDescription();
- CreateDefaultNormalsSphere();
- CreateDefaultTexture(B3D_CREATE_DEFAULT_ALL, sal_True);
- basegfx::B3DHomMatrix aTransform;
- aTransform.translate(1.0, 1.0, 1.0);
- aTransform.scale(
- (rVolume.getMaxX() - rVolume.getMinX())/2.0,
- (rVolume.getMaxY() - rVolume.getMinY())/2.0,
- (rVolume.getMaxZ() - rVolume.getMinZ())/2.0);
- aTransform.translate(rVolume.getMinX(), rVolume.getMinY(), rVolume.getMinZ());
- Transform(aTransform);
-}
-
-/*************************************************************************
-|*
-|* Normalen invertieren
-|*
-\************************************************************************/
-
-void B3dGeometry::InvertNormals()
-{
- for(sal_uInt32 a=0;a<aEntityBucket.Count();a++)
- aEntityBucket[a].Normal() = -aEntityBucket[a].Normal();
-}
-
-// eof
diff --git a/goodies/source/base3d/b3dlight.cxx b/goodies/source/base3d/b3dlight.cxx
deleted file mode 100644
index dbd7e2f10fb5..000000000000
--- a/goodies/source/base3d/b3dlight.cxx
+++ /dev/null
@@ -1,749 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dlight.cxx,v $
- * $Revision: 1.8 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include <goodies/b3dlight.hxx>
-#include <tools/debug.hxx>
-
-/*************************************************************************
-|*
-|* Konstruktor B3dLight
-|*
-\************************************************************************/
-
-B3dLight::B3dLight()
-{
-}
-
-/*************************************************************************
-|*
-|* Intensitaet einer bestimmten Lichtkomponente setzen
-|*
-\************************************************************************/
-
-void B3dLight::SetIntensity(const Color rNew, Base3DMaterialValue eVal)
-{
- switch(eVal)
- {
- case Base3DMaterialAmbient:
- {
- aAmbient = rNew;
- if(rNew.GetRed() || rNew.GetGreen() || rNew.GetBlue())
- bIsAmbient = sal_True;
- else
- bIsAmbient = sal_False;
- break;
- }
- case Base3DMaterialDiffuse:
- {
- aDiffuse = rNew;
- if(rNew.GetRed() || rNew.GetGreen() || rNew.GetBlue())
- bIsDiffuse = sal_True;
- else
- bIsDiffuse = sal_False;
- break;
- }
- default:
- {
- aSpecular = rNew;
- if(rNew.GetRed() || rNew.GetGreen() || rNew.GetBlue())
- bIsSpecular = sal_True;
- else
- bIsSpecular = sal_False;
- break;
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Intensitaet einer bestimmten Lichtkomponente lesen
-|*
-\************************************************************************/
-
-const Color B3dLight::GetIntensity(Base3DMaterialValue eVal)
-{
- switch(eVal)
- {
- case Base3DMaterialAmbient:
- {
- return aAmbient;
- }
- case Base3DMaterialDiffuse:
- {
- return aDiffuse;
- }
- default:
- {
- return aSpecular;
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Lichtquelle initialisieren (selbe defaults wie OpenGL)
-|*
-\************************************************************************/
-
-void B3dLight::Init()
-{
- aAmbient = Color(255, 0, 0, 0);
- if(IsFirst())
- {
- aDiffuse = Color(255, 204, 204, 204);
- aSpecular = Color(255, 255, 255, 255);
- basegfx::B3DVector aTiltVector(1.0, 1.0, 1.0);
- aTiltVector.normalize();
- aPosition = aTiltVector;
- bIsDiffuse = sal_True;
- bIsSpecular = sal_True;
- bIsEnabled = sal_True;
- }
- else
- {
- aDiffuse = Color(0, 0, 0, 0);
- aSpecular = Color(0, 0, 0, 0);
- aPosition = basegfx::B3DPoint(0.0, 0.0, 1.0);
- bIsDiffuse = sal_False;
- bIsSpecular = sal_False;
- bIsEnabled = sal_False;
- }
- aPositionEye = basegfx::B3DPoint(0.0, 0.0, 0.0);
- aSpotDirection = basegfx::B3DVector(0.0, 0.0, -1.0);
- aSpotDirectionEye = basegfx::B3DVector(0.0, 0.0, 0.0);
- nSpotExponent = 0;
- fSpotCutoff = 180.0;
- fConstantAttenuation = 1.0;
- fLinearAttenuation = 0.0;
- fQuadraticAttenuation = 0.0;
- bLinearOrQuadratic = sal_False;
- bIsDirectionalSource = sal_True;
- bIsSpot = sal_False;
- bIsAmbient = sal_False;
-}
-
-/*************************************************************************
-|*
-|* Richtung der Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLight::SetSpotDirection(const basegfx::B3DVector& rNew)
-{
- aSpotDirection=rNew;
- aSpotDirection.normalize();
-}
-
-/*************************************************************************
-|*
-|* Richtung der Lichtquelle in Augkoordinaten setzen
-|*
-\************************************************************************/
-
-void B3dLight::SetSpotDirectionEye(const basegfx::B3DVector& rNew)
-{
- aSpotDirectionEye=rNew;
- aSpotDirectionEye.normalize();
-}
-
-/*************************************************************************
-|*
-|* Kegel der Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLight::SetSpotCutoff(double fNew)
-{
- fSpotCutoff = fNew;
- bIsSpot = (fNew == 180.0) ? sal_False : sal_True;
- fCosSpotCutoff = cos(fNew * F_PI180);
-}
-
-/*************************************************************************
-|*
-|* Lineare Attenuation setzen
-|*
-\************************************************************************/
-
-void B3dLight::SetLinearAttenuation(double fNew)
-{
- fLinearAttenuation = fNew;
- bLinearOrQuadratic =
- (fNew + fQuadraticAttenuation == 0.0) ? sal_False : sal_True;
-}
-
-/*************************************************************************
-|*
-|* Quadratische Attenuation setzen
-|*
-\************************************************************************/
-
-void B3dLight::SetQuadraticAttenuation(double fNew)
-{
- fQuadraticAttenuation = fNew;
- bLinearOrQuadratic =
- (fNew + fLinearAttenuation == 0.0) ? sal_False : sal_True;
-}
-
-/*************************************************************************
-|*
-|* Gruppe von Lichtquellen, Konstruktor
-|*
-\************************************************************************/
-
-B3dLightGroup::B3dLightGroup()
-: aGlobalAmbientLight(255, 102, 102, 102),
- bLightingEnabled(sal_True),
- bLocalViewer(sal_True),
- bModelTwoSide(sal_False)
-{
- // Lichtquellen initialisieren
- for(sal_uInt16 i=0; i < BASE3D_MAX_NUMBER_LIGHTS;i++)
- {
- aLight[i].SetFirst(i==0);
- aLight[i].Init();
- }
-}
-
-B3dLightGroup::~B3dLightGroup()
-{
-}
-
-/*************************************************************************
-|*
-|* globales Umgebungslicht setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetGlobalAmbientLight(const Color rNew)
-{
- if(aGlobalAmbientLight != rNew)
- {
- aGlobalAmbientLight = rNew;
- }
-}
-
-/*************************************************************************
-|*
-|* globales Umgebungslicht lesen
-|*
-\************************************************************************/
-
-const Color B3dLightGroup::GetGlobalAmbientLight()
-{
- return aGlobalAmbientLight;
-}
-
-/*************************************************************************
-|*
-|* Modus globaler Viewer bei Berechnung specular reflection setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetLocalViewer(sal_Bool bNew)
-{
- if(bLocalViewer != bNew)
- {
- bLocalViewer = bNew;
- }
-}
-
-/*************************************************************************
-|*
-|* Modus globaler Viewer bei Berechnung specular reflection lesen
-|*
-\************************************************************************/
-
-sal_Bool B3dLightGroup::GetLocalViewer()
-{
- return bLocalViewer;
-}
-
-/*************************************************************************
-|*
-|* Modus Beleuchtungsmodell beidseitig anwenden setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetModelTwoSide(sal_Bool bNew)
-{
- if(bModelTwoSide != bNew)
- {
- bModelTwoSide = bNew;
- }
-}
-
-/*************************************************************************
-|*
-|* Modus Beleuchtungsmodell beidseitig anwenden lesen
-|*
-\************************************************************************/
-
-sal_Bool B3dLightGroup::GetModelTwoSide()
-{
- return bModelTwoSide;
-}
-
-/*************************************************************************
-|*
-|* Beleuchtungsmodell aktivieren/deaktivieren
-|*
-\************************************************************************/
-
-void B3dLightGroup::EnableLighting(sal_Bool bNew)
-{
- if(bLightingEnabled != bNew)
- {
- bLightingEnabled = bNew;
- }
-}
-
-/*************************************************************************
-|*
-|* Abfrage, ob das Beleuchtungsmodell aktiviert/deaktiviert ist
-|*
-\************************************************************************/
-
-sal_Bool B3dLightGroup::IsLightingEnabled()
-{
- return bLightingEnabled;
-}
-
-/*************************************************************************
-|*
-|* Die Intensitaet eines bestimmten Aspekts einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetIntensity(const Color rNew,
- Base3DMaterialValue eMat, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetIntensity(rNew, eMat);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Die Intensitaet eines bestimmten Aspekts einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-const Color B3dLightGroup::GetIntensity(Base3DMaterialValue eMat,
- Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].GetIntensity(eMat);
-}
-
-/*************************************************************************
-|*
-|* Die Position einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetPosition(const basegfx::B3DPoint& rNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetPosition(rNew);
- aLight[eNum].SetDirectionalSource(sal_False);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Die Position einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-const basegfx::B3DPoint& B3dLightGroup::GetPosition(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
-#ifdef DBG_UTIL
- if(IsDirectionalSource())
- DBG_ERROR("Zugriff auf die Position einer gerichteten Lichtquelle!");
-#endif
- return aLight[eNum].GetPosition();
-}
-
-/*************************************************************************
-|*
-|* Die Richtung einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetDirection(const basegfx::B3DVector& rNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetPosition(rNew);
- aLight[eNum].SetDirectionalSource(sal_True);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Die Richtung einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-const basegfx::B3DVector& B3dLightGroup::GetDirection(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
-#ifdef DBG_UTIL
- if(!IsDirectionalSource())
- DBG_ERROR("Zugriff auf die Richtung einer ungerichteten Lichtquelle!");
-#endif
- return (basegfx::B3DVector&)aLight[eNum].GetPosition();
-}
-
-/*************************************************************************
-|*
-|* Die Richtung einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetSpotDirection(const basegfx::B3DVector& rNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetSpotDirection(rNew);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Die Richtung einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-const basegfx::B3DVector& B3dLightGroup::GetSpotDirection(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].GetSpotDirection();
-}
-
-/*************************************************************************
-|*
-|* Den SpotExponent einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetSpotExponent(sal_uInt16 nNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetSpotExponent(nNew);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Den SpotExponent einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-sal_uInt16 B3dLightGroup::GetSpotExponent(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].GetSpotExponent();
-}
-
-/*************************************************************************
-|*
-|* Die Einengung des Lichtkegels einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetSpotCutoff(double fNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetSpotCutoff(fNew);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Die Einengung des Lichtkegels einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-double B3dLightGroup::GetSpotCutoff(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].GetSpotCutoff();
-}
-
-/*************************************************************************
-|*
-|* Den konstanten AttenuationFactor einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetConstantAttenuation(double fNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetConstantAttenuation(fNew);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Den konstanten AttenuationFactor einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-double B3dLightGroup::GetConstantAttenuation(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].GetConstantAttenuation();
-}
-
-/*************************************************************************
-|*
-|* Den linearen AttenuationFactor einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetLinearAttenuation(double fNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetLinearAttenuation(fNew);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Den linearen AttenuationFactor einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-double B3dLightGroup::GetLinearAttenuation(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].GetLinearAttenuation();
-}
-
-/*************************************************************************
-|*
-|* Den quadratischen AttenuationFactor einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void B3dLightGroup::SetQuadraticAttenuation(double fNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].SetQuadraticAttenuation(fNew);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Den quadratischen AttenuationFactor einer Lichtquelle lesen
-|*
-\************************************************************************/
-
-double B3dLightGroup::GetQuadraticAttenuation(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].GetQuadraticAttenuation();
-}
-
-/*************************************************************************
-|*
-|* Eine Lichtquelle aktivieren/deaktivieren
-|*
-\************************************************************************/
-
-void B3dLightGroup::Enable(sal_Bool bNew, Base3DLightNumber eNum)
-{
- if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
- {
- aLight[eNum].Enable(bNew);
- }
-#ifdef DBG_UTIL
- else
- DBG_ERROR("Access to Light out of range");
-#endif
-}
-
-/*************************************************************************
-|*
-|* Abfrage, ob eine Lichtquelle aktiviert/deaktiviert ist
-|*
-\************************************************************************/
-
-sal_Bool B3dLightGroup::IsEnabled(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].IsEnabled();
-}
-
-/*************************************************************************
-|*
-|* Abfrage, ob eine Lichtquelle als directional source eingerichtet ist
-|*
-\************************************************************************/
-
-sal_Bool B3dLightGroup::IsDirectionalSource(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum].IsDirectionalSource();
-}
-
-/*************************************************************************
-|*
-|* Direkter Zugriff auf B3dLight fuer abgeleitete Klassen
-|*
-\************************************************************************/
-
-B3dLight& B3dLightGroup::GetLightObject(Base3DLightNumber eNum)
-{
- if(eNum < Base3DLight0 || eNum > Base3DLight7)
- {
- eNum = Base3DLight0;
-#ifdef DBG_UTIL
- DBG_ERROR("Access to Light out of range");
-#endif
- }
- return aLight[eNum];
-}
-
-// eof
diff --git a/goodies/source/base3d/b3dopngl.cxx b/goodies/source/base3d/b3dopngl.cxx
deleted file mode 100644
index 5b0d940ceb25..000000000000
--- a/goodies/source/base3d/b3dopngl.cxx
+++ /dev/null
@@ -1,1457 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dopngl.cxx,v $
- * $Revision: 1.9 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include <vcl/outdev.hxx>
-#include <tools/debug.hxx>
-#include <svtools/options3d.hxx>
-#include "b3dopngl.hxx"
-
-//#ifndef _B3D_HMATRIX_HXX
-//#include "hmatrix.hxx"
-//#endif
-#include "b3dtex.hxx"
-#include "b3dtrans.hxx"
-#include <goodies/b3dgeom.hxx>
-
-/*************************************************************************
-|*
-|* Konstruktor Base3DOpenGL
-|*
-\************************************************************************/
-
-Base3DOpenGL::Base3DOpenGL(OutputDevice* pOutDev)
-: Base3D(pOutDev),
- aOpenGL(pOutDev),
- aLastNormal(DBL_MAX, DBL_MAX, DBL_MAX),
- aLastTexCoor(DBL_MAX, DBL_MAX),
- fOffFacMul100((float)(-0.2 * 100.0)),
- fOffUniMul100((float)(-1.0 * 100.0)),
- aPhongBuffer(12), // 4K
- nPhongDivideSize(20),
- bForceToSinglePrimitiveOutput(sal_True) // (#70626#)
-{
- // create OpenGL context for pOutDev; pOutDev is NOT a printer,
- // so don't care about printers in this place
- if(aOpenGL.IsValid())
- {
- // setup default parameters
- aOpenGL.ClearDepth( 1.0 );
- aOpenGL.DepthFunc( GL_LEQUAL );
- aOpenGL.Enable( GL_DEPTH_TEST );
- aOpenGL.Enable( GL_DITHER );
- aOpenGL.Enable( GL_NORMALIZE );
- aOpenGL.Disable( GL_CULL_FACE );
- aOpenGL.Disable( GL_LIGHTING );
- aOpenGL.Disable( GL_LINE_SMOOTH );
- aOpenGL.Disable( GL_POINT_SMOOTH );
- aOpenGL.Disable( GL_POLYGON_SMOOTH );
- aOpenGL.Disable( GL_POLYGON_STIPPLE );
- aOpenGL.Disable( GL_LINE_STIPPLE );
- aOpenGL.Disable( GL_TEXTURE_1D );
- aOpenGL.Disable( GL_TEXTURE_2D );
- aOpenGL.Disable( GL_BLEND );
- aOpenGL.DepthMask( GL_TRUE );
- aOpenGL.ShadeModel( GL_SMOOTH );
- aOpenGL.EdgeFlag( GL_TRUE );
- aOpenGL.Disable( GL_SCISSOR_TEST );
- }
- SetContextIsValid(aOpenGL.IsValid());
- CalcInternPhongDivideSize();
- bForceToSinglePrimitiveOutput = SvtOptions3D().IsOpenGL_Faster();
-}
-
-/*************************************************************************
-|*
-|* Typbestimmung
-|*
-\************************************************************************/
-
-sal_uInt16 Base3DOpenGL::GetBase3DType()
-{
- return BASE3D_TYPE_OPENGL;
-}
-
-/*************************************************************************
-|*
-|* Start der Szenenbeschreibung: Evtl. neuer HDC, Loesche Tiefenbuffer
-|*
-\************************************************************************/
-
-void Base3DOpenGL::StartScene()
-{
- // Falls Transparenz an war, diese zuruecknehmen
- aOpenGL.Disable( GL_BLEND );
- aOpenGL.DepthMask( sal_True );
-
- // OutputDevice setzen und ZBuffer loeschen
- aOpenGL.SetConnectOutputDevice(GetOutputDevice());
- aOpenGL.Clear( GL_DEPTH_BUFFER_BIT );
-}
-
-/*************************************************************************
-|*
-|* Scissoring Region setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetScissorRegionPixel(const Rectangle& rRect, sal_Bool bActivate)
-{
- // OpenGL specifics
- aOpenGL.Scissor( rRect.Left(), rRect.Top(),
- rRect.GetWidth(), rRect.GetHeight());
-
- // call parent
- Base3D::SetScissorRegionPixel(rRect, bActivate);
-}
-
-/*************************************************************************
-|*
-|* Dithering
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetDither(sal_Bool bNew)
-{
- // call parent
- Base3D::SetDither(bNew);
-
- // OpenGL specifics
- if(GetDither())
- aOpenGL.Enable( GL_DITHER );
- else
- aOpenGL.Disable( GL_DITHER );
-}
-
-/*************************************************************************
-|*
-|* Scissoring aktivieren/deaktivieren
-|*
-\************************************************************************/
-
-void Base3DOpenGL::ActivateScissorRegion(sal_Bool bNew)
-{
- // OpenGL specifics
- if(bNew)
- {
- aOpenGL.Enable(GL_SCISSOR_TEST);
- }
- else
- {
- aOpenGL.Disable(GL_SCISSOR_TEST);
- }
-
- // call parent
- Base3D::ActivateScissorRegion(bNew);
-}
-
-/*************************************************************************
-|*
-|* Ende der Szenenbeschreibung: Erzwinge bisher nicht erzeugte Ausgaben
-|*
-\************************************************************************/
-
-void Base3DOpenGL::EndScene()
-{
- aOpenGL.Flush();
- aOpenGL.Finish();
-}
-
-/*************************************************************************
-|*
-|* Neuen freien Eintrag fuer naechste geometrische Daten liefern
-|*
-\************************************************************************/
-
-B3dEntity& Base3DOpenGL::ImplGetFreeEntity()
-{
- return aEntity;
-}
-
-/*************************************************************************
-|*
-|* starte primitiv auch in OpenGL
-|*
-\************************************************************************/
-
-void Base3DOpenGL::ImplStartPrimitive()
-{
- bPhongBufferedMode = (GetShadeModel() == Base3DPhong
- && GetRenderMode() == Base3DRenderFill
- && (GetObjectMode() == Base3DTriangles
- || GetObjectMode() == Base3DTriangleStrip
- || GetObjectMode() == Base3DTriangleFan
- || GetObjectMode() == Base3DQuads
- || GetObjectMode() == Base3DQuadStrip
- || GetObjectMode() == Base3DPolygon ));
-
- // Transparenz beachten
- if(GetMaterial(Base3DMaterialDiffuse).GetTransparency())
- {
- aOpenGL.Enable( GL_BLEND );
- aOpenGL.DepthMask( sal_False );
- aOpenGL.BlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- }
- else
- {
- aOpenGL.Disable( GL_BLEND );
- aOpenGL.DepthMask( sal_True );
- }
-
- if(bPhongBufferedMode)
- {
- // Phong-Modus: Ausgabe sammeln und in kleinere
- // Dreiecke zerlegt bei ImplEndPrimitive() rendern
- aPhongBuffer.Erase();
- }
- else
- {
- // OpenGL direkt benutzen
- aOpenGL.Begin(GetObjectMode());
- }
-}
-
-/*************************************************************************
-|*
-|* beende primitiv auch in OpenGL
-|*
-\************************************************************************/
-
-void Base3DOpenGL::ImplEndPrimitive()
-{
- if(bPhongBufferedMode)
- {
- DrawPhongPrimitives();
- }
- else
- {
- aOpenGL.End();
- }
-}
-
-/*************************************************************************
-|*
-|* Darstellungsqualitaet setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetDisplayQuality(UINT8 nNew)
-{
- // call parent
- Base3D::SetDisplayQuality(nNew);
-
- // endgueltige Splittinggroesse neuberechnen
- CalcInternPhongDivideSize();
-}
-
-/*************************************************************************
-|*
-|* PhongMode Splitting-Groesse neu setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetPhongDivideSize(long nNew)
-{
- nPhongDivideSize = nNew;
-
- // endgueltige Splittinggroesse neuberechnen
- CalcInternPhongDivideSize();
-}
-
-/*************************************************************************
-|*
-|* PhongMode interne Splitting-Groesse neu setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::CalcInternPhongDivideSize()
-{
- if(GetDisplayQuality() != 255)
- {
- long nNew = GetPhongDivideSize() +
- ((255L - (INT32)GetDisplayQuality())>>2);
- nInternPhongDivideSize = nNew * nNew;
- }
- else
- nInternPhongDivideSize = GetPhongDivideSize() * GetPhongDivideSize();
-}
-
-/*************************************************************************
-|*
-|* Zeichne fuer Phong gebufferte primitive als Dreiecke
-|*
-\************************************************************************/
-
-void Base3DOpenGL::DrawPhongPrimitives()
-{
- sal_uInt32 aCount = aPhongBuffer.Count();
- sal_uInt32 aPos(0L);
- bPhongBufferedMode = sal_False;
- aOpenGL.Begin(Base3DTriangles);
-
- switch(GetObjectMode())
- {
- case Base3DTriangles :
- {
- while(aPos < aCount)
- {
- DrawPhongTriangle(aPos, aPos+1, aPos+2);
- aPos += 3;
- }
- break;
- }
- case Base3DTriangleStrip:
- {
- aPos = 1;
- while(aPos < aCount)
- {
- if(aPos%2)
- DrawPhongTriangle(aPos-1, aPos, aPos+1);
- else
- DrawPhongTriangle(aPos-1, aPos+1, aPos);
- aPos++;
- }
- break;
- }
- case Base3DTriangleFan:
- {
- aPos = 1;
- while(aPos < aCount)
- {
- DrawPhongTriangle(0, aPos, aPos+1);
- aPos++;
- }
- break;
- }
- case Base3DQuads:
- {
- while(aPos < aCount)
- {
- DrawPhongTriangle(aPos, aPos+1, aPos+2);
- DrawPhongTriangle(aPos+2, aPos+3, aPos);
- aPos += 4;
- }
- break;
- }
- case Base3DQuadStrip:
- {
- aPos = 1;
- while(aPos < aCount)
- {
- DrawPhongTriangle(aPos, aPos+1, aPos+3);
- DrawPhongTriangle(aPos, aPos+3, aPos+2);
- aPos+=2;
- }
- break;
- }
- case Base3DPolygon:
- {
- aPos = 2;
- while(aPos < aCount)
- {
- DrawPhongTriangle(0, aPos-1, aPos);
- aPos++;
- }
- break;
- }
- default:
- break; // -Wall multiple values not handled.
- }
- aOpenGL.End();
-}
-
-/*************************************************************************
-|*
-|* Zeichne fuer Phong gebufferte Dreiecke
-|*
-\************************************************************************/
-
-void Base3DOpenGL::DrawPhongTriangle(sal_uInt32 nInd1, sal_uInt32 nInd2, sal_uInt32 nInd3)
-{
- basegfx::B3DPoint aPos1 = GetTransformationSet()->ObjectToViewCoor(aPhongBuffer[nInd1].Point());
- double fXMin = aPos1.getX();
- double fXMax = aPos1.getX();
- double fYMin = aPos1.getY();
- double fYMax = aPos1.getY();
- basegfx::B3DPoint aPos2 = GetTransformationSet()->ObjectToViewCoor(aPhongBuffer[nInd2].Point());
- if(aPos2.getX() < fXMin)
- fXMin = aPos2.getX();
- if(aPos2.getX() > fXMax)
- fXMax = aPos2.getX();
- if(aPos2.getY() < fYMin)
- fYMin = aPos2.getY();
- if(aPos2.getY() > fYMax)
- fYMax = aPos2.getY();
- aPos2 = GetTransformationSet()->ObjectToViewCoor(aPhongBuffer[nInd3].Point());
- if(aPos2.getX() < fXMin)
- fXMin = aPos2.getX();
- if(aPos2.getX() > fXMax)
- fXMax = aPos2.getX();
- if(aPos2.getY() < fYMin)
- fYMin = aPos2.getY();
- if(aPos2.getY() > fYMax)
- fYMax = aPos2.getY();
-
- Size aPixelSize = GetOutputDevice()->LogicToPixel(
- Size((long)(fXMax - fXMin),(long)(fYMax - fYMin)));
- if(aPixelSize.Width() * aPixelSize.Height() > nInternPhongDivideSize)
- {
- sal_uInt32 aCount = aPhongBuffer.Count();
- aPhongBuffer.Append();
- aPhongBuffer.Append();
- aPhongBuffer.Append();
-
- aPhongBuffer[aCount ].CalcMiddle(aPhongBuffer[nInd1], aPhongBuffer[nInd2]);
- aPhongBuffer[aCount+1].CalcMiddle(aPhongBuffer[nInd2], aPhongBuffer[nInd3]);
- aPhongBuffer[aCount+2].CalcMiddle(aPhongBuffer[nInd3], aPhongBuffer[nInd1]);
-
- DrawPhongTriangle(nInd1, aCount, aCount+2);
- DrawPhongTriangle(aCount, nInd2, aCount+1);
- DrawPhongTriangle(aCount+1, nInd3, aCount+2);
- DrawPhongTriangle(aCount, aCount+1, aCount+2);
-
- aPhongBuffer.Remove();
- aPhongBuffer.Remove();
- aPhongBuffer.Remove();
- }
- else
- {
- ImplPostAddVertex(aPhongBuffer[nInd1]);
- ImplPostAddVertex(aPhongBuffer[nInd2]);
- ImplPostAddVertex(aPhongBuffer[nInd3]);
- }
-}
-
-/*************************************************************************
-|*
-|* Geometrische Daten direkt an OpenGL weitergeben
-|* ACHTUNG! Es wird die aktuelle Farbe benutzt, NICHT die in Enttity3D
-|* enthaltene!
-|*
-\************************************************************************/
-
-// hack to get the address of the mfX member for OpenGL
-class LocVecAcc : public basegfx::B3DVector
-{
-public:
- double& getXDirect() { return mfX; }
-};
-
-void Base3DOpenGL::ImplPostAddVertex(B3dEntity& rEntity)
-{
- if(bPhongBufferedMode)
- {
- aPhongBuffer.Append(rEntity);
- }
- else
- {
- // Normale setzen
- if(rEntity.IsNormalUsed())
- {
- if(GetForceFlat() || GetShadeModel() == Base3DFlat)
- {
- if(rEntity.PlaneNormal() != aLastNormal)
- {
- aLastNormal = rEntity.PlaneNormal();
- aOpenGL.Normal3dv(&(((LocVecAcc*)&aLastNormal)->getXDirect()));
- }
- }
- else
- {
- if(rEntity.Normal() != aLastNormal)
- {
- aLastNormal = rEntity.Normal();
- aOpenGL.Normal3dv(&(((LocVecAcc*)&aLastNormal)->getXDirect()));
- }
- }
- }
- else
- {
- if(!aLastNormal.equalZero())
- {
- aLastNormal = basegfx::B3DVector(0.0, 0.0, 0.0);
- aOpenGL.Normal3dv(&(((LocVecAcc*)&aLastNormal)->getXDirect()));
- }
- }
-
- // Texturkoordinate setzen
- if(rEntity.IsTexCoorUsed())
- {
- if(rEntity.TexCoor() != aLastTexCoor)
- {
- aLastTexCoor = rEntity.TexCoor();
- aOpenGL.TexCoord2dv(&(((LocVecAcc*)&aLastTexCoor)->getXDirect()));
- }
- }
- else
- {
- if(!aLastTexCoor.equalZero())
- {
- aLastTexCoor = basegfx::B2DPoint(0.0, 0.0);
- aOpenGL.TexCoord2dv(&(((LocVecAcc*)&aLastTexCoor)->getXDirect()));
- }
- }
-
- // Punkt erzeugen
- aOpenGL.Vertex3dv(&(((LocVecAcc*)&(rEntity.Point()))->getXDirect()));
- }
-}
-
-/*************************************************************************
-|*
-|* beim setzen von color und alpha reagieren
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetColor(Color aNew)
-{
- // call parent
- Base3D::SetColor(aNew);
-
- // Normale Farbausgabe
- aOpenGL.Color4ub(GetColor().GetRed(), GetColor().GetGreen(),
- GetColor().GetBlue(), 0xff - GetColor().GetTransparency());
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetMaterial(Color rNew, Base3DMaterialValue eVal,
- Base3DMaterialMode eMode)
-{
- // call parent
- Base3D::SetMaterial(rNew, eVal, eMode);
-
- // OpenGL Specifics
- GLenum eFace = GL_FRONT_AND_BACK;
- if(eMode == Base3DMaterialFront)
- eFace = GL_FRONT;
- if(eMode == Base3DMaterialBack)
- eFace = GL_BACK;
- GLenum eName = GL_SPECULAR;
- if(eVal == Base3DMaterialAmbient)
- eName = GL_AMBIENT;
- if(eVal == Base3DMaterialDiffuse)
- eName = GL_DIFFUSE;
- if(eVal == Base3DMaterialEmission)
- eName = GL_EMISSION;
-
- // Array fuellen
- float fArray[4] = {
- ((float)GetMaterial(eVal, eMode).GetRed()) / (float)255.0,
- ((float)GetMaterial(eVal, eMode).GetGreen()) / (float)255.0,
- ((float)GetMaterial(eVal, eMode).GetBlue()) / (float)255.0,
- ((float)(255 - GetMaterial(eVal, eMode).GetTransparency())) / (float)255.0
- };
-
- aOpenGL.Materialfv(eFace, eName, fArray);
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften setzen, exponent der specular-Eigenschaft
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetShininess(sal_uInt16 nExponent,
- Base3DMaterialMode eMode)
-{
- // call parent
- Base3D::SetShininess(nExponent, eMode);
-
- // OpenGL Specifics
- GLenum eFace = GL_FRONT_AND_BACK;
- if(eMode == Base3DMaterialFront)
- eFace = GL_FRONT;
- if(eMode == Base3DMaterialBack)
- eFace = GL_BACK;
- aOpenGL.Materialf(eFace, GL_SHININESS, (float)nExponent);
-}
-
-/*************************************************************************
-|*
-|* Aktuell zu benutzende Textur setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetActiveTexture(B3dTexture* pTex)
-{
- // call parent
- Base3D::SetActiveTexture(pTex);
-
- // make current texture, cast ist unkritisch, da innerhalb von
- // Base3DOpenGL nur Texturen von diesem Typ angelegt worden
- // sein koennen
- if(GetActiveTexture())
- {
- aOpenGL.Enable(GL_TEXTURE_2D);
- ((B3dTextureOpenGL*)GetActiveTexture())->MakeCurrentTexture(aOpenGL);
- }
- else
- {
- aOpenGL.BindTexture(GL_TEXTURE_2D, 0);
- aOpenGL.Disable(GL_TEXTURE_2D);
- }
-}
-
-/*************************************************************************
-|*
-|* Ein Textur-Objekt inkarnieren
-|*
-\************************************************************************/
-
-B3dTexture* Base3DOpenGL::CreateTexture(TextureAttributes& rAtt, BitmapEx& rBitmapEx)
-{
- // Hier Parent NICHT rufen! Sonst wird auch noch eine normale Textur erzeugt
- B3dTextureOpenGL* pRetval = new B3dTextureOpenGL(rAtt, rBitmapEx, aOpenGL);
- DBG_ASSERT(pRetval,"AW: Kein Speicher fuer OpenGL-Textur bekommen!");
- return pRetval;
-}
-
-/*************************************************************************
-|*
-|* OpenGL - Textur loeschen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::DestroyTexture(B3dTexture* pTex)
-{
- // Spezielle Loeschaufgaben im Zusammenhang mit OpenGL
- ((B3dTextureOpenGL*)pTex)->DestroyOpenGLTexture(aOpenGL);
-
- // call parent, endgueltig loeschen
- Base3D::DestroyTexture(pTex);
-}
-
-/*************************************************************************
-|*
-|* PolygonOffset setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetPolygonOffset(Base3DPolygonOffset eNew, sal_Bool bNew)
-{
- // call parent
- Base3D::SetPolygonOffset(eNew, bNew);
-
- if(GetPolygonOffset())
- aOpenGL.PolygonOffset((float)(fOffFacMul100 / 100.0), (float)(fOffUniMul100 / 100.0));
- else
- aOpenGL.PolygonOffset((float)0.0, (float)0.0);
-
- // OpenGL Specifics
- switch(eNew)
- {
- case Base3DPolygonOffsetFill :
- if(bNew)
- aOpenGL.Enable( GL_POLYGON_OFFSET_FILL );
- else
- aOpenGL.Disable( GL_POLYGON_OFFSET_FILL );
- break;
-
- case Base3DPolygonOffsetLine :
- if(bNew)
- aOpenGL.Enable( GL_POLYGON_OFFSET_LINE );
- else
- aOpenGL.Disable( GL_POLYGON_OFFSET_LINE );
- break;
-
- case Base3DPolygonOffsetPoint :
- if(bNew)
- aOpenGL.Enable( GL_POLYGON_OFFSET_POINT );
- else
- aOpenGL.Disable( GL_POLYGON_OFFSET_POINT );
- break;
- }
-}
-
-/*************************************************************************
-|*
-|* Beleuchtung setzen/lesen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetLightGroup(B3dLightGroup* pSet, sal_Bool bSetGlobal)
-{
- // call parent
- Base3D::SetLightGroup(pSet, bSetGlobal);
-
- if(GetLightGroup())
- {
- // Allgemeine Parameter setzen
- SetGlobalAmbientLight(GetLightGroup()->GetGlobalAmbientLight());
- SetLocalViewer(GetLightGroup()->GetLocalViewer());
- SetModelTwoSide(GetLightGroup()->GetModelTwoSide());
- EnableLighting(GetLightGroup()->IsLightingEnabled());
-
- // Einzelne Lampen setzen
- if(GetTransformationSet() && bSetGlobal)
- {
- aOpenGL.MatrixMode(GL_MODELVIEW);
- aOpenGL.LoadIdentity();
- }
-
- // Set and enable lights from the beginning of array in
- // OpenGL
- sal_uInt16 nNumAlloc = 0;
-
- sal_uInt16 a;
- for(a=0;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
- {
- Base3DLightNumber eNum = (Base3DLightNumber)(Base3DLight0 + a);
- B3dLight& rLight = GetLightGroup()->GetLightObject(eNum);
-
- if(rLight.IsEnabled())
- {
- Base3DLightNumber eNumAlloc = (Base3DLightNumber)(Base3DLight0 + nNumAlloc);
- nNumAlloc++;
-
- Enable(sal_True, eNumAlloc);
-
- SetIntensity(rLight.GetIntensity(Base3DMaterialAmbient),
- Base3DMaterialAmbient, eNumAlloc);
- SetIntensity(rLight.GetIntensity(Base3DMaterialDiffuse),
- Base3DMaterialDiffuse, eNumAlloc);
- SetIntensity(rLight.GetIntensity(Base3DMaterialSpecular),
- Base3DMaterialSpecular, eNumAlloc);
-
- if(rLight.IsDirectionalSource())
- {
- SetDirection(rLight.GetPosition(), eNumAlloc);
- }
- else
- {
- SetPosition(rLight.GetPosition(), eNumAlloc);
- SetSpotDirection(rLight.GetSpotDirection(), eNumAlloc);
- SetSpotExponent(rLight.GetSpotExponent(), eNumAlloc);
- SetSpotCutoff(rLight.GetSpotCutoff(), eNumAlloc);
- }
-
- SetConstantAttenuation(rLight.GetConstantAttenuation(), eNumAlloc);
- SetLinearAttenuation(rLight.GetLinearAttenuation(), eNumAlloc);
- SetQuadraticAttenuation(rLight.GetQuadraticAttenuation(), eNumAlloc);
- }
- }
-
- for(a=nNumAlloc;a<BASE3D_MAX_NUMBER_LIGHTS;a++)
- {
- Base3DLightNumber eNum = (Base3DLightNumber)(Base3DLight0 + a);
- Enable(sal_False, eNum);
- }
-
- if(GetTransformationSet() && bSetGlobal)
- PostSetObjectOrientation(GetTransformationSet());
- }
-}
-
-/*************************************************************************
-|*
-|* globales Umgebungslicht setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetGlobalAmbientLight(const Color rNew)
-{
- // OpenGL Specifics
- Color aSource;
- if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
- {
- // Graustufen
- UINT8 nLuminance = rNew.GetLuminance();
- aSource.SetRed(nLuminance);
- aSource.SetGreen(nLuminance);
- aSource.SetBlue(nLuminance);
- aSource.SetTransparency(rNew.GetTransparency());
- }
- else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
- {
- // Keine Ausgabe, hier Weiss als Farbe setzen
- aSource = Color(COL_WHITE);
- }
- else
- {
- // Normale Farbausgabe
- aSource = rNew;
- }
-
- // Array fuellen
- float fArray[4] = {
- ((float)aSource.GetRed()) / (float)255.0,
- ((float)aSource.GetGreen()) / (float)255.0,
- ((float)aSource.GetBlue()) / (float)255.0,
- ((float)aSource.GetTransparency()) / (float)255.0
- };
- aOpenGL.LightModelfv(GL_LIGHT_MODEL_AMBIENT, fArray);
-}
-
-/*************************************************************************
-|*
-|* Modus globaler Viewer bei Berechnung specular reflection setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetLocalViewer(sal_Bool bNew)
-{
- // OpenGL Specifics
- aOpenGL.LightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER,
- bNew ? (float)0.0 : (float)1.0);
-}
-
-/*************************************************************************
-|*
-|* Modus Beleuchtungsmodell beidseitig anwenden setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetModelTwoSide(sal_Bool bNew)
-{
- // OpenGL Specifics
- aOpenGL.LightModelf(GL_LIGHT_MODEL_TWO_SIDE,
- bNew ? (float)1.0 : (float)0.0);
-}
-
-/*************************************************************************
-|*
-|* Beleuchtungsmodell aktivieren/deaktivieren
-|*
-\************************************************************************/
-
-void Base3DOpenGL::EnableLighting(sal_Bool bNew)
-{
- // OpenGL Specifics
- if(bNew)
- aOpenGL.Enable( GL_LIGHTING );
- else
- aOpenGL.Disable( GL_LIGHTING );
-}
-
-/*************************************************************************
-|*
-|* Die Intensitaet eines bestimmten Aspekts einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetIntensity(const Color rNew,
- Base3DMaterialValue eVal, Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- Color aSource;
- if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
- {
- // Graustufen
- UINT8 nLuminance = rNew.GetLuminance();
- aSource.SetRed(nLuminance);
- aSource.SetGreen(nLuminance);
- aSource.SetBlue(nLuminance);
- aSource.SetTransparency(rNew.GetTransparency());
- }
- else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
- {
- // Keine Ausgabe, hier Weiss als Farbe setzen
- aSource = Color(COL_WHITE);
- }
- else
- {
- // Normale Farbausgabe
- aSource = rNew;
- }
-
- // Array fuellen
- float fArray[4] = {
- ((float)aSource.GetRed()) / (float)255.0,
- ((float)aSource.GetGreen()) / (float)255.0,
- ((float)aSource.GetBlue()) / (float)255.0,
- ((float)aSource.GetTransparency()) / (float)255.0
- };
-
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- GLenum eName = GL_SPECULAR;
- if(eVal == Base3DMaterialAmbient)
- eName = GL_AMBIENT;
- if(eVal == Base3DMaterialDiffuse)
- eName = GL_DIFFUSE;
- aOpenGL.Lightfv(eLight, eName, fArray);
-}
-
-/*************************************************************************
-|*
-|* Die Position einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetPosition(const basegfx::B3DPoint& rNew, Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- float fArray[4] = {
- (float)rNew.getX(), (float)rNew.getY(), (float)rNew.getZ(), (float)1.0
- };
- aOpenGL.Lightfv(eLight, GL_POSITION, fArray);
-}
-
-/*************************************************************************
-|*
-|* Die Richtung einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetDirection(const basegfx::B3DVector& rNew, Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- float fArray[4] = {
- (float)rNew.getX(), (float)rNew.getY(), (float)rNew.getZ(), (float)0.0
- };
- aOpenGL.Lightfv(eLight, GL_POSITION, fArray);
-}
-
-/*************************************************************************
-|*
-|* Die Richtung einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetSpotDirection(const basegfx::B3DVector& rNew, Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- float fArray[4] = {
- (float)rNew.getX(), (float)rNew.getY(), (float)rNew.getZ(), (float)0.0
- };
- aOpenGL.Lightfv(eLight, GL_SPOT_DIRECTION, fArray);
-}
-
-/*************************************************************************
-|*
-|* Den SpotExponent einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetSpotExponent(sal_uInt16 nNew, Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- aOpenGL.Lightf(eLight, GL_SPOT_EXPONENT, (float)nNew);
-}
-
-/*************************************************************************
-|*
-|* Die Einengung des Lichtkegels einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetSpotCutoff(double fNew, Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- aOpenGL.Lightf(eLight, GL_SPOT_CUTOFF, (float)fNew);
-}
-
-/*************************************************************************
-|*
-|* Den konstanten AttenuationFactor einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetConstantAttenuation(double fNew,
- Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- aOpenGL.Lightf(eLight, GL_CONSTANT_ATTENUATION, (float)fNew);
-}
-
-/*************************************************************************
-|*
-|* Den linearen AttenuationFactor einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetLinearAttenuation(double fNew,
- Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- aOpenGL.Lightf(eLight, GL_LINEAR_ATTENUATION, (float)fNew);
-}
-
-/*************************************************************************
-|*
-|* Den quadratischen AttenuationFactor einer Lichtquelle setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetQuadraticAttenuation(double fNew,
- Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- aOpenGL.Lightf(eLight, GL_QUADRATIC_ATTENUATION, (float)fNew);
-}
-
-/*************************************************************************
-|*
-|* Eine Lichtquelle aktivieren/deaktivieren
-|*
-\************************************************************************/
-
-void Base3DOpenGL::Enable(sal_Bool bNew, Base3DLightNumber eNum)
-{
- // OpenGL Specifics
- GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
- if(bNew)
- aOpenGL.Enable(eLight);
- else
- aOpenGL.Disable(eLight);
-}
-
-/*************************************************************************
-|*
-|* RenderMode setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetRenderMode(Base3DRenderMode eNew,
- Base3DMaterialMode eMode)
-{
- // call parent
- Base3D::SetRenderMode(eNew, eMode);
-
- // OpenGL Specifics
- GLenum eFace = GL_FRONT_AND_BACK;
- if(eMode == Base3DMaterialFront)
- eFace = GL_FRONT;
- if(eMode == Base3DMaterialBack)
- eFace = GL_BACK;
-
- switch(eNew)
- {
- case Base3DRenderNone :
- {
- break;
- }
- case Base3DRenderPoint :
- {
- aOpenGL.PolygonMode(eFace, GL_POINT);
- break;
- }
- case Base3DRenderLine :
- {
- aOpenGL.PolygonMode(eFace, GL_LINE);
- break;
- }
- case Base3DRenderFill :
- {
- aOpenGL.PolygonMode(eFace, GL_FILL);
- break;
- }
- }
-}
-
-/*************************************************************************
-|*
-|* ShadeModel setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetShadeModel(Base3DShadeModel eNew)
-{
- // call parent
- Base3D::SetShadeModel(eNew);
-
- switch(eNew)
- {
- case Base3DSmooth :
- case Base3DPhong :
- {
- aOpenGL.ShadeModel(GL_SMOOTH);
- break;
- }
- case Base3DFlat :
- {
- aOpenGL.ShadeModel(GL_FLAT);
- break;
- }
- }
-}
-
-/*************************************************************************
-|*
-|* CullingMode setzen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetCullMode(Base3DCullMode eNew)
-{
- // call parent
- Base3D::SetCullMode(eNew);
-
- switch(eNew)
- {
- case Base3DCullFront :
- {
- aOpenGL.CullFace(GL_FRONT);
- aOpenGL.Enable(GL_CULL_FACE);
- break;
- }
- case Base3DCullBack :
- {
- aOpenGL.CullFace(GL_BACK);
- aOpenGL.Enable(GL_CULL_FACE);
- break;
- }
- case Base3DCullNone :
- {
- aOpenGL.Disable(GL_CULL_FACE);
- break;
- }
- }
-}
-
-/*************************************************************************
-|*
-|* EdgeFlag schreiben
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetEdgeFlag(sal_Bool bNew)
-{
- // EdgeFlag fuer OpenGL setzen
- if(bNew)
- aOpenGL.EdgeFlag(GL_TRUE);
- else
- aOpenGL.EdgeFlag(GL_FALSE);
-
- // call parent
- Base3D::SetEdgeFlag(bNew);
-}
-
-/*************************************************************************
-|*
-|* PointSize schreiben
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetPointSize(double fNew)
-{
- // PointSize fuer OpenGL setzen
- aOpenGL.PointSize((GLfloat)fNew);
-
- // call parent
- Base3D::SetPointSize(fNew);
-}
-
-/*************************************************************************
-|*
-|* LineWidth schreiben
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetLineWidth(double fNew)
-{
- // LineWidth fuer OpenGL setzen
- aOpenGL.LineWidth((GLfloat)fNew);
-
- // call parent
- Base3D::SetLineWidth(fNew);
-}
-
-/*************************************************************************
-|*
-|* Callbacks bei Matrixaenderungen, Default-Implementierungen
-|*
-\************************************************************************/
-
-void Base3DOpenGL::SetTransformationSet(B3dTransformationSet* pSet)
-{
- // call parent
- Base3D::SetTransformationSet(pSet);
-
- if(GetTransformationSet())
- {
- PostSetObjectOrientation(GetTransformationSet());
- PostSetProjection(GetTransformationSet());
- PostSetTexture(GetTransformationSet());
- PostSetViewport(GetTransformationSet());
- }
-}
-
-void Base3DOpenGL::PostSetObjectOrientation(B3dTransformationSet* pCaller)
-{
- // OpenGL specifics
- basegfx::B3DHomMatrix aMat = pCaller->GetObjectTrans();
- aMat *= pCaller->GetOrientation();
- double fBuffer[16] = {
- aMat.get(0, 0), aMat.get(1, 0), aMat.get(2, 0), aMat.get(3, 0),
- aMat.get(0, 1), aMat.get(1, 1), aMat.get(2, 1), aMat.get(3, 1),
- aMat.get(0, 2), aMat.get(1, 2), aMat.get(2, 2), aMat.get(3, 2),
- aMat.get(0, 3), aMat.get(1, 3), aMat.get(2, 3), aMat.get(3, 3)
- };
- aOpenGL.MatrixMode(GL_MODELVIEW);
- aOpenGL.LoadMatrixd(fBuffer);
-}
-
-void Base3DOpenGL::PostSetProjection(B3dTransformationSet* pCaller)
-{
- // OpenGL specifics
- const basegfx::B3DHomMatrix& rMat = pCaller->GetProjection();
- double fBuffer[16] = {
- rMat.get(0, 0), rMat.get(1, 0), rMat.get(2, 0), rMat.get(3, 0),
- rMat.get(0, 1), rMat.get(1, 1), rMat.get(2, 1), rMat.get(3, 1),
- rMat.get(0, 2), rMat.get(1, 2), rMat.get(2, 2), rMat.get(3, 2),
- rMat.get(0, 3), rMat.get(1, 3), rMat.get(2, 3), rMat.get(3, 3)
- };
- aOpenGL.MatrixMode(GL_PROJECTION);
- aOpenGL.LoadMatrixd(fBuffer);
-}
-
-void Base3DOpenGL::PostSetTexture(B3dTransformationSet* pCaller)
-{
- // OpenGL specifics
- const basegfx::B2DHomMatrix& rMat = pCaller->GetTexture();
- double fBuffer[16] = {
- rMat.get(0, 0), rMat.get(1, 0), 0.0, rMat.get(2, 0),
- rMat.get(0, 1), rMat.get(1, 1), 0.0, rMat.get(2, 1),
- 0.0, 0.0, 0.0, 0.0,
- rMat.get(0, 2), rMat.get(1, 2), 0.0, rMat.get(3, 3)
- };
- aOpenGL.MatrixMode(GL_TEXTURE);
- aOpenGL.LoadMatrixd(fBuffer);
-}
-
-void Base3DOpenGL::PostSetViewport(B3dTransformationSet* pCaller)
-{
- // OpenGL specifics
- Rectangle aBoundPixel(GetOutputDevice()->
- LogicToPixel(pCaller->GetLogicalViewportBounds()));
- aOpenGL.Viewport( aBoundPixel.Left(), aBoundPixel.Top(),
- aBoundPixel.GetWidth() - 1, aBoundPixel.GetHeight() - 1);
-}
-
-/*************************************************************************
-|*
-|* Ein Objekt in Form einer B3dGeometry direkt ausgeben
-|*
-\************************************************************************/
-
-void Base3DOpenGL::DrawPolygonGeometry(const B3dGeometry& rGeometry, sal_Bool bOutline)
-{
- // bForceToSinglePrimitiveOutput: (#70626#)
- if(bForceToSinglePrimitiveOutput || (GetShadeModel() == Base3DPhong && GetRenderMode() == Base3DRenderFill))
- {
- // call parent, render with many primitives
- Base3D::DrawPolygonGeometry(rGeometry, bOutline);
- }
- else
- {
- // Buckets der Geometrie holen
- const B3dEntityBucket& rEntityBucket = rGeometry.GetEntityBucket();
- const GeometryIndexValueBucket& rIndexBucket = rGeometry.GetIndexBucket();
-
- if(rEntityBucket.Count() && rIndexBucket.Count())
- {
- // Arrays aktivieren
- aOpenGL.EnableClientState(GL_VERTEX_ARRAY);
-
- sal_uInt32 nPolyCounter = 0;
- sal_uInt32 nEntityCounter = 0;
- sal_uInt32 nArrayStartIndex = 0;
- sal_uInt32 nUpperBound;
-
- // Pointer setzen
- sal_uInt16 nArray = 0;
- aOpenGL.VertexPointer(3, GL_DOUBLE, rEntityBucket.GetSlotSize(), &rEntityBucket[0].Point());
-
- if(bOutline)
- {
- // Transparenz Linien beachten
- if(GetColor().GetTransparency())
- {
- aOpenGL.Enable( GL_BLEND );
- aOpenGL.DepthMask( sal_False );
- aOpenGL.BlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- }
- else
- {
- aOpenGL.Disable( GL_BLEND );
- aOpenGL.DepthMask( sal_True );
- }
-
- // ALLE Linien Zeichnen
- aOpenGL.Disable(GL_CULL_FACE);
-
- // Polygone als Outline ausgeben
- aOpenGL.PolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- aOpenGL.PolygonOffset((float)(fOffFacMul100 / 100.0), (float)(fOffUniMul100 / 100.0));
- aOpenGL.Enable( GL_POLYGON_OFFSET_LINE );
- aOpenGL.EnableClientState(GL_EDGE_FLAG_ARRAY);
- aOpenGL.EdgeFlagPointer(rEntityBucket.GetSlotSize(), &rEntityBucket[0].EdgeFlag());
-
- while(nPolyCounter < rIndexBucket.Count())
- {
- // Naechstes Primitiv
- nUpperBound = rIndexBucket[nPolyCounter].GetIndex();
- sal_Bool bLineMode = (rIndexBucket[nPolyCounter++].GetMode() == B3D_INDEX_MODE_LINE);
-
- if(nUpperBound >> rEntityBucket.GetBlockShift() != nArray)
- {
- // Einzelschritt, Bereichsueberschreitung im Buffer
- // Als Polygon ausgeben
- aOpenGL.Begin(bLineMode ? Base3DLineStrip : Base3DPolygon);
-
- // Polygon ausgeben
- while(nEntityCounter < nUpperBound)
- {
- const B3dEntity& rEntity = rEntityBucket[nEntityCounter++];
- aOpenGL.EdgeFlag(rEntity.IsEdgeVisible() ? GL_TRUE : GL_FALSE);
- aOpenGL.Vertex3dv((const double *)(&rEntity.Point()));
- }
-
- // Primitiv abschliessen
- aOpenGL.End();
-
- // NUR auf neues Array setzen, wenn noch was da ist (#59941#)
- if(nEntityCounter < rEntityBucket.Count())
- {
- // Pointer auf neues Array setzen
- nArray = (sal_uInt16)(nEntityCounter >> rEntityBucket.GetBlockShift());
- nArrayStartIndex = nEntityCounter;
- const B3dEntity& rStart = rEntityBucket[nEntityCounter];
-
- aOpenGL.VertexPointer(3, GL_DOUBLE, rEntityBucket.GetSlotSize(), &rStart);
- aOpenGL.EdgeFlagPointer(rEntityBucket.GetSlotSize(), &(rStart.EdgeFlag()));
- }
- }
- else
- {
- // Primitiv komplett raushauen, liegt in einem Buffer
- aOpenGL.DrawArrays(bLineMode ? Base3DLineStrip : Base3DPolygon,
- nEntityCounter - nArrayStartIndex,
- nUpperBound - nEntityCounter);
- nEntityCounter = nUpperBound;
- }
- }
-
- // Arrays deaktivieren
- aOpenGL.DisableClientState(GL_VERTEX_ARRAY);
- aOpenGL.DisableClientState(GL_EDGE_FLAG_ARRAY);
- }
- else
- {
- // Transparenz Flaechen beachten
- if(GetMaterial(Base3DMaterialDiffuse).GetTransparency()
- || (GetActiveTexture() && !!(GetActiveTexture()->GetAlphaMask())))
- {
- aOpenGL.Enable( GL_BLEND );
- aOpenGL.DepthMask( sal_False );
- aOpenGL.BlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
- }
- else
- {
- aOpenGL.Disable( GL_BLEND );
- aOpenGL.DepthMask( sal_True );
- }
-
- // Polygone gefuellt ausgeben
- aOpenGL.PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- aOpenGL.EnableClientState(GL_NORMAL_ARRAY);
- aOpenGL.EnableClientState(GL_TEXTURE_COORD_ARRAY);
- if(GetForceFlat() || GetShadeModel() == Base3DFlat)
- aOpenGL.NormalPointer(GL_DOUBLE, rEntityBucket.GetSlotSize(), &rEntityBucket[0].PlaneNormal());
- else
- aOpenGL.NormalPointer(GL_DOUBLE, rEntityBucket.GetSlotSize(), &rEntityBucket[0].Normal());
- aOpenGL.TexCoordPointer(2, GL_DOUBLE, rEntityBucket.GetSlotSize(), &rEntityBucket[0].TexCoor());
-
- while(nPolyCounter < rIndexBucket.Count())
- {
- // Naechstes Primitiv
- nUpperBound = rIndexBucket[nPolyCounter].GetIndex();
- sal_Bool bLineMode = (rIndexBucket[nPolyCounter++].GetMode() == B3D_INDEX_MODE_LINE);
-
- if(nUpperBound >> rEntityBucket.GetBlockShift() != nArray)
- {
- // Einzelschritt, Bereichsueberschreitung im Buffer
- // Als Polygon ausgeben
- aOpenGL.Begin(bLineMode ? Base3DLineStrip : Base3DPolygon);
-
- // Polygon ausgeben
- while(nEntityCounter < nUpperBound)
- {
- const B3dEntity& rEntity = rEntityBucket[nEntityCounter++];
- if(GetForceFlat() || GetShadeModel() == Base3DFlat)
- aOpenGL.Normal3dv((const double *)(&rEntity.PlaneNormal()));
- else
- aOpenGL.Normal3dv((const double *)(&rEntity.Normal()));
- aOpenGL.TexCoord3dv((const double *)(&rEntity.TexCoor()));
- aOpenGL.Vertex3dv((const double *)(&rEntity.Point()));
- }
-
- // Primitiv abschliessen
- aOpenGL.End();
-
- // NUR auf neues Array setzen, wenn noch was da ist (#58702#)
- if(nEntityCounter < rEntityBucket.Count())
- {
- // Pointer auf neues Array setzen
- nArray = (sal_uInt16)(nEntityCounter >> rEntityBucket.GetBlockShift());
- nArrayStartIndex = nEntityCounter;
- const B3dEntity& rStart = rEntityBucket[nEntityCounter];
-
- aOpenGL.VertexPointer(3, GL_DOUBLE, rEntityBucket.GetSlotSize(), &rStart);
- if(GetForceFlat() || GetShadeModel() == Base3DFlat)
- aOpenGL.NormalPointer(GL_DOUBLE, rEntityBucket.GetSlotSize(), &(rStart.PlaneNormal()));
- else
- aOpenGL.NormalPointer(GL_DOUBLE, rEntityBucket.GetSlotSize(), &(rStart.Normal()));
- aOpenGL.TexCoordPointer(2, GL_DOUBLE, rEntityBucket.GetSlotSize(), &(rStart.TexCoor()));
- }
- }
- else
- {
- // Primitiv komplett raushauen, liegt in einem Buffer
- aOpenGL.DrawArrays(bLineMode ? Base3DLineStrip : Base3DPolygon,
- nEntityCounter - nArrayStartIndex,
- nUpperBound - nEntityCounter);
- nEntityCounter = nUpperBound;
- }
- }
-
- // Arrays deaktivieren
- aOpenGL.DisableClientState(GL_VERTEX_ARRAY);
- aOpenGL.DisableClientState(GL_NORMAL_ARRAY);
- aOpenGL.DisableClientState(GL_TEXTURE_COORD_ARRAY);
- }
- }
- }
-}
-
diff --git a/goodies/source/base3d/b3dopngl.hxx b/goodies/source/base3d/b3dopngl.hxx
deleted file mode 100644
index 6446321e2b2a..000000000000
--- a/goodies/source/base3d/b3dopngl.hxx
+++ /dev/null
@@ -1,186 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dopngl.hxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _B3D_B3DOPNGL_HXX
-#define _B3D_B3DOPNGL_HXX
-
-#include <goodies/base3d.hxx>
-#include <vcl/opengl.hxx>
-
-/*************************************************************************
-|*
-|* Die Basisklasse fuer Standard 3D Ausgaben mittels OpenGL unter
-|* Windows (Win95 und Windows NT)
-|*
-\************************************************************************/
-
-class Base3DOpenGL : public Base3D
-{
-private:
- // Datenuebergabe
- B3dEntity aEntity;
-
- // OpenGL Objekt
- OpenGL aOpenGL;
-
- // Letzte Normale und letzte Texturkoordinate
- basegfx::B3DVector aLastNormal;
- basegfx::B2DPoint aLastTexCoor;
-
- float fOffFacMul100;
- float fOffUniMul100;
-
- // Simulation Phong-Mode
- sal_Bool bPhongBufferedMode;
- B3dEntityBucket aPhongBuffer;
- long nPhongDivideSize;
- long nInternPhongDivideSize;
-
- // flags (#70626#)
- sal_Bool bForceToSinglePrimitiveOutput;
-
- void DrawPhongPrimitives();
- void DrawPhongTriangle(UINT32 nInd1, UINT32 nInd2, UINT32 nInd3);
- void CalcInternPhongDivideSize();
-
-public:
- Base3DOpenGL(OutputDevice* pOutDev);
-
- // DivideSize bei Phong-Simulation
- long GetPhongDivideSize() { return nPhongDivideSize; }
- void SetPhongDivideSize(long nNew);
-
- // Get/Set force to single primitive output (#70626#)
- sal_Bool IsForceToSinglePrimitiveOutput() const { return bForceToSinglePrimitiveOutput; }
- void SetForceToSinglePrimitiveOutput(sal_Bool bNew) { bForceToSinglePrimitiveOutput = bNew; }
-
- // Typbestimmung
- virtual sal_uInt16 GetBase3DType();
-
- virtual void StartScene();
- virtual void EndScene();
-
- // Scissoring
- virtual void SetScissorRegionPixel(const Rectangle& rRect, sal_Bool bActivate=sal_True);
- virtual void ActivateScissorRegion(sal_Bool bNew);
-
- // Dithering
- virtual void SetDither(sal_Bool bNew);
-
- // Farbe
- virtual void SetColor(Color aNew);
-
- // Material
- virtual void SetMaterial(Color rNew,
- Base3DMaterialValue=Base3DMaterialAmbient,
- Base3DMaterialMode=Base3DMaterialFrontAndBack);
- virtual void SetShininess(sal_uInt16 nExponent,
- Base3DMaterialMode=Base3DMaterialFrontAndBack);
-
- // Texturen
-private:
- virtual B3dTexture* CreateTexture(TextureAttributes& rAtt, BitmapEx& rBitmapEx);
- virtual void DestroyTexture(B3dTexture*);
-public:
- virtual void SetActiveTexture(B3dTexture* pTex=NULL);
-
- // Darstellungsqualitaet
- virtual void SetDisplayQuality(UINT8 nNew);
-
- // PolygonOffset
- virtual void SetPolygonOffset(
- Base3DPolygonOffset eNew=Base3DPolygonOffsetLine, sal_Bool bNew=sal_False);
-
- // Beleuchtung setzen/lesen
- virtual void SetLightGroup(B3dLightGroup* pSet, sal_Bool bSetGlobal=sal_True);
-
- virtual void SetRenderMode(Base3DRenderMode eNew,
- Base3DMaterialMode=Base3DMaterialFrontAndBack);
- virtual void SetShadeModel(Base3DShadeModel eNew);
- virtual void SetCullMode(Base3DCullMode eNew);
-
- virtual void SetEdgeFlag(sal_Bool bNew=sal_True);
- virtual void SetPointSize(double fNew=1.0);
- virtual void SetLineWidth(double fNew=1.0);
-
- // Ein Objekt in Form einer B3dGeometry direkt ausgeben
- virtual void DrawPolygonGeometry(const B3dGeometry& rGeometry, sal_Bool bOutline=sal_False);
-
- // Callbacks bei Matrixaenderungen
- virtual void SetTransformationSet(B3dTransformationSet* pSet);
-
-protected:
- // Geometrische Daten uebergeben
- virtual B3dEntity& ImplGetFreeEntity();
- virtual void ImplPostAddVertex(B3dEntity& rEnt);
-
- virtual void ImplStartPrimitive();
- virtual void ImplEndPrimitive();
-
- // Callbacks bei Matrixaenderungen
- void PostSetObjectOrientation(B3dTransformationSet* pCaller);
- void PostSetProjection(B3dTransformationSet* pCaller);
- void PostSetTexture(B3dTransformationSet* pCaller);
- void PostSetViewport(B3dTransformationSet* pCaller);
-
- // lokale Parameter des LightModels
- void SetGlobalAmbientLight(const Color rNew);
- void SetLocalViewer(sal_Bool bNew=sal_True);
- void SetModelTwoSide(sal_Bool bNew=sal_False);
-
- // Hauptschalter fuer die Beleuchtung
- void EnableLighting(sal_Bool bNew=sal_True);
-
- // Lichtquellen Interface
- void SetIntensity(const Color rNew,
- Base3DMaterialValue=Base3DMaterialAmbient,
- Base3DLightNumber=Base3DLight0);
- void SetPosition(const basegfx::B3DPoint& rNew,
- Base3DLightNumber=Base3DLight0);
- void SetDirection(const basegfx::B3DVector& rNew,
- Base3DLightNumber=Base3DLight0);
- void SetSpotDirection(const basegfx::B3DVector& rNew,
- Base3DLightNumber=Base3DLight0);
- void SetSpotExponent(sal_uInt16 nNew,
- Base3DLightNumber=Base3DLight0);
- void SetSpotCutoff(double fNew,
- Base3DLightNumber=Base3DLight0);
- void SetConstantAttenuation(double fNew,
- Base3DLightNumber=Base3DLight0);
- void SetLinearAttenuation(double fNew,
- Base3DLightNumber=Base3DLight0);
- void SetQuadraticAttenuation(double fNew,
- Base3DLightNumber=Base3DLight0);
- void Enable(sal_Bool bNew=sal_True,
- Base3DLightNumber=Base3DLight0);
-};
-
-
-#endif // _B3D_B3DOPNGL_HXX
diff --git a/goodies/source/base3d/b3dtex.cxx b/goodies/source/base3d/b3dtex.cxx
deleted file mode 100644
index 67c678431f14..000000000000
--- a/goodies/source/base3d/b3dtex.cxx
+++ /dev/null
@@ -1,1303 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: b3dtex.cxx,v $
- * $Revision: 1.12.38.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include "b3dtex.hxx"
-#include "b3dopngl.hxx"
-#include <vcl/bmpacc.hxx>
-
-#include "rtl/alloc.h"
-
-/*************************************************************************
-|*
-|* Klassen fuer TexturAttribute beim Anfordern von Texturen
-|*
-\************************************************************************/
-
-TextureAttributes::TextureAttributes(sal_Bool bGhosted, void* pFT)
-: mpFloatTrans(pFT),
- mbGhosted(bGhosted)
-{
-}
-
-sal_Bool TextureAttributes::operator==(const TextureAttributes& rAtt) const
-{
- return ( GetTextureAttributeType() == rAtt.GetTextureAttributeType()
- && rAtt.mbGhosted == mbGhosted
- && rAtt.mpFloatTrans == mpFloatTrans);
-}
-
-// Fuer Colors
-
-TextureAttributesColor::TextureAttributesColor(sal_Bool bGhosted, void* pFT, Color aColor)
-: TextureAttributes(bGhosted, pFT),
- maColorAttribute(aColor)
-{
-}
-
-sal_Bool TextureAttributesColor::operator==(const TextureAttributes& rAtt) const
-{
- if(TextureAttributes::operator==(rAtt))
- {
- const TextureAttributesColor& rAttCol = (const TextureAttributesColor&)rAtt;
- if(rAttCol.maColorAttribute == maColorAttribute)
- return sal_True;
- }
- return sal_False;
-}
-
-sal_uInt16 TextureAttributesColor::GetTextureAttributeType() const
-{
- return TEXTURE_ATTRIBUTE_TYPE_COLOR;
-}
-
-// Fuer Bitmaps
-
-TextureAttributesBitmap::TextureAttributesBitmap(sal_Bool bGhosted, void* pFT, Bitmap aBmp)
-: TextureAttributes(bGhosted, pFT),
- maBitmapAttribute(aBmp)
-{
-}
-
-TextureAttributesBitmap::~TextureAttributesBitmap()
-{
-}
-
-sal_Bool TextureAttributesBitmap::operator==(const TextureAttributes& rAtt) const
-{
- if(TextureAttributes::operator==(rAtt))
- {
- const TextureAttributesBitmap& rAttBmp = (const TextureAttributesBitmap&)rAtt;
- if(rAttBmp.maBitmapAttribute == maBitmapAttribute)
- return sal_True;
- }
- return sal_False;
-}
-
-sal_uInt16 TextureAttributesBitmap::GetTextureAttributeType() const
-{
- return TEXTURE_ATTRIBUTE_TYPE_BITMAP;
-}
-
-// Fuer Gradientfills
-
-TextureAttributesGradient::TextureAttributesGradient(sal_Bool bGhosted, void* pFT, void* pF, void *pSC)
-: TextureAttributes(bGhosted, pFT),
- mpFill(pF),
- mpStepCount(pSC)
-{
-}
-
-sal_Bool TextureAttributesGradient::operator==(const TextureAttributes& rAtt) const
-{
- if(TextureAttributes::operator==(rAtt))
- {
- const TextureAttributesGradient& rAttGra = (const TextureAttributesGradient&)rAtt;
-
- if(rAttGra.mpFill == mpFill
- && rAttGra.mpStepCount == mpStepCount)
- return sal_True;
- }
- return sal_False;
-}
-
-sal_uInt16 TextureAttributesGradient::GetTextureAttributeType() const
-{
- return TEXTURE_ATTRIBUTE_TYPE_GRADIENT;
-}
-
-// Fuer Hatchfills
-
-TextureAttributesHatch::TextureAttributesHatch(sal_Bool bGhosted, void* pFT, void* pF)
-: TextureAttributes(bGhosted, pFT),
- mpFill(pF)
-{
-}
-
-sal_Bool TextureAttributesHatch::operator==(const TextureAttributes& rAtt) const
-{
- if(TextureAttributes::operator==(rAtt))
- {
- const TextureAttributesHatch& rAttHat = (const TextureAttributesHatch&)rAtt;
-
- if(rAttHat.mpFill == mpFill)
- return sal_True;
- }
- return sal_False;
-}
-
-sal_uInt16 TextureAttributesHatch::GetTextureAttributeType() const
-{
- return TEXTURE_ATTRIBUTE_TYPE_HATCH;
-}
-
-/*************************************************************************
-|*
-|* Konstruktor Textur
-|*
-\************************************************************************/
-
-B3dTexture::B3dTexture(
- TextureAttributes& rAtt,
- BitmapEx& rBmpEx,
- Base3DTextureKind eKnd,
- Base3DTextureMode eMod,
- Base3DTextureFilter eFlt,
- Base3DTextureWrap eS,
- Base3DTextureWrap eT)
-: aBitmap(rBmpEx.GetBitmap()),
- aAlphaMask(rBmpEx.GetAlpha()),
- aBitmapSize(rBmpEx.GetSizePixel()), // #i72895#
- pReadAccess(NULL),
- pAlphaReadAccess(NULL),
- eKind(eKnd),
- eMode(eMod),
- eFilter(eFlt),
- eWrapS(eS),
- eWrapT(eT),
- nSwitchVal(0),
- bTextureKindChanged(sal_False)
-{
- // ReadAccess auf Textur anfordern
- pReadAccess = aBitmap.AcquireReadAccess();
- pAlphaReadAccess = (!aAlphaMask) ? NULL : aAlphaMask.AcquireReadAccess();
- DBG_ASSERT(pReadAccess, "AW: Keinen Lesezugriff auf Textur-Bitmap bekommen");
-
- // Attribute kopieren
- switch(rAtt.GetTextureAttributeType())
- {
- case TEXTURE_ATTRIBUTE_TYPE_COLOR :
- pAttributes = new TextureAttributesColor(
- rAtt.GetGhostedAttribute(),
- rAtt.GetFloatTransAttribute(),
- ((TextureAttributesColor&)rAtt).GetColorAttribute());
- break;
-
- case TEXTURE_ATTRIBUTE_TYPE_BITMAP :
- pAttributes = new TextureAttributesBitmap(
- rAtt.GetGhostedAttribute(),
- rAtt.GetFloatTransAttribute(),
- ((TextureAttributesBitmap&)rAtt).GetBitmapAttribute());
- break;
-
- case TEXTURE_ATTRIBUTE_TYPE_GRADIENT :
- pAttributes = new TextureAttributesGradient(
- rAtt.GetGhostedAttribute(),
- rAtt.GetFloatTransAttribute(),
- ((TextureAttributesGradient&)rAtt).GetFillAttribute(),
- ((TextureAttributesGradient&)rAtt).GetStepCountAttribute());
- break;
-
- case TEXTURE_ATTRIBUTE_TYPE_HATCH :
- pAttributes = new TextureAttributesHatch(
- rAtt.GetGhostedAttribute(),
- rAtt.GetFloatTransAttribute(),
- ((TextureAttributesHatch&)rAtt).GetHatchFillAttribute());
- break;
- }
-
- // SwitchVal setzen
- SetSwitchVal();
-}
-
-/*************************************************************************
-|*
-|* Destruktor Textur
-|*
-\************************************************************************/
-
-B3dTexture::~B3dTexture()
-{
- // ReadAccess auf Textur freigeben
- if(pReadAccess)
- {
- aBitmap.ReleaseAccess(pReadAccess);
- pReadAccess = NULL;
- }
-
- // free ReadAccess to transparency bitmap
- if(pAlphaReadAccess)
- {
- aAlphaMask.ReleaseAccess(pAlphaReadAccess);
- pAlphaReadAccess = NULL;
- }
-
- // Attribute wegschmeissen
- if(pAttributes)
- delete pAttributes;
- pAttributes = NULL;
-}
-
-// Zugriff auf die Attribute der Textur
-TextureAttributes& B3dTexture::GetAttributes()
-{
- return *pAttributes;
-}
-
-/*************************************************************************
-|*
-|* Art des Wrappings in X setzen
-|*
-\************************************************************************/
-
-void B3dTexture::SetTextureWrapS(Base3DTextureWrap eNew)
-{
- if(eNew != eWrapS)
- {
- eWrapS = eNew;
- bTextureKindChanged = sal_True;
- }
-}
-
-/*************************************************************************
-|*
-|* Art des Wrappings in Y setzen
-|*
-\************************************************************************/
-
-void B3dTexture::SetTextureWrapT(Base3DTextureWrap eNew)
-{
- if(eNew != eWrapT)
- {
- eWrapT = eNew;
- bTextureKindChanged = sal_True;
- }
-}
-
-/*************************************************************************
-|*
-|* Blend-Color lesen/bestimmen
-|*
-\************************************************************************/
-
-void B3dTexture::SetBlendColor(Color rNew)
-{
- if(rNew.GetRed() != aColBlend.GetRed()
- || rNew.GetGreen() != aColBlend.GetGreen()
- || rNew.GetBlue() != aColBlend.GetBlue())
- {
- aColBlend.SetRed(rNew.GetRed());
- aColBlend.SetGreen(rNew.GetGreen());
- aColBlend.SetBlue(rNew.GetBlue());
- if(eWrapS == Base3DTextureSingle || eWrapT == Base3DTextureSingle)
- bTextureKindChanged = sal_True;
- }
-}
-
-Color B3dTexture::GetBlendColor()
-{
- Color aRetval(aColBlend.GetRed(),
- aColBlend.GetGreen(),
- aColBlend.GetBlue());
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Textur-Ersatz-Color lesen/bestimmen
-|*
-\************************************************************************/
-
-void B3dTexture::SetTextureColor(Color rNew)
-{
- if(rNew.GetRed() != aColTexture.GetRed()
- || rNew.GetGreen() != aColTexture.GetGreen()
- || rNew.GetBlue() != aColTexture.GetBlue())
- {
- aColTexture.SetRed(rNew.GetRed());
- aColTexture.SetGreen(rNew.GetGreen());
- aColTexture.SetBlue(rNew.GetBlue());
- if(eWrapS == Base3DTextureSingle || eWrapT == Base3DTextureSingle)
- bTextureKindChanged = sal_True;
- }
-}
-
-Color B3dTexture::GetTextureColor()
-{
- Color aRetval(aColTexture.GetRed(),
- aColTexture.GetGreen(),
- aColTexture.GetBlue());
- return aRetval;
-}
-
-/*************************************************************************
-|*
-|* Internen Verteilungswert setzen
-|*
-\************************************************************************/
-
-void B3dTexture::SetSwitchVal()
-{
- nSwitchVal = 0;
-
- // Kind
- if(GetTextureKind() == Base3DTextureLuminance)
- nSwitchVal |= B3D_TXT_KIND_LUM;
- else if(GetTextureKind() == Base3DTextureIntensity)
- nSwitchVal |= B3D_TXT_KIND_INT;
- else if(GetTextureKind() == Base3DTextureColor)
- nSwitchVal |= B3D_TXT_KIND_COL;
-
- // Mode
- if(GetTextureMode() == Base3DTextureReplace)
- nSwitchVal |= B3D_TXT_MODE_REP;
- else if(GetTextureMode() == Base3DTextureModulate)
- nSwitchVal |= B3D_TXT_MODE_MOD;
- else if(GetTextureMode() == Base3DTextureBlend)
- nSwitchVal |= B3D_TXT_MODE_BND;
-
- // Filter
- if(GetTextureFilter() == Base3DTextureNearest)
- nSwitchVal |= B3D_TXT_FLTR_NEA;
-}
-
-/*************************************************************************
-|*
-|* Zugriffsfunktion auf die Farben der Bitmap
-|*
-\************************************************************************/
-
-BitmapColor B3dTexture::GetBitmapColor(long nX, long nY) const
-{
- return pReadAccess->GetColor(nY, nX);
-}
-
-sal_uInt8 B3dTexture::GetBitmapTransparency(long nX, long nY) const
-{
- if(pAlphaReadAccess)
- return pAlphaReadAccess->GetColor(nY, nX).GetIndex();
- return 0;
-}
-
-/*************************************************************************
-|*
-|* Art der Pixeldaten lesen/bestimmen
-|*
-\************************************************************************/
-
-void B3dTexture::SetTextureKind(Base3DTextureKind eNew)
-{
- if(eKind != eNew)
- {
- eKind = eNew;
- bTextureKindChanged = sal_True;
- }
- SetSwitchVal();
-}
-
-/*************************************************************************
-|*
-|* Texturmodus lesen/bestimmen
-|*
-\************************************************************************/
-
-void B3dTexture::SetTextureMode(Base3DTextureMode eNew)
-{
- eMode = eNew;
- SetSwitchVal();
-}
-
-/*************************************************************************
-|*
-|* Filtermodus lesen/bestimmen
-|*
-\************************************************************************/
-
-void B3dTexture::SetTextureFilter(Base3DTextureFilter eNew)
-{
- eFilter = eNew;
- SetSwitchVal();
-}
-
-/*************************************************************************
-|*
-|* Die Texturfunktion selbst. Die ursruengliche Farbe des Punktes
-|* innerhalb der Grenzen des Parameterbereiches S,T (in Bitmapkoordinaten)
-|* wird modifiziert.
-|*
-\************************************************************************/
-
-void B3dTexture::ModifyColor(Color& rCol, double fS, double fT)
-{
- // Integer-Koordinaten der Texturposition bilden
- long nX((long)fS);
- long nY((long)fT);
- BitmapColor aBmCol = aColTexture;
- sal_Bool bOnTexture(sal_True);
-
- // Wrapping in S-Richtung
- if(eWrapS == Base3DTextureClamp)
- {
- // Clamping
- if(nX < 0)
- nX = 0;
- else if(nX >= GetBitmapSize().Width())
- nX = GetBitmapSize().Width() - 1;
- }
- else if(eWrapS == Base3DTextureRepeat)
- {
- // Repeating
- nX %= GetBitmapSize().Width();
- if(nX < 0)
- nX += GetBitmapSize().Width();
- }
- else
- {
- // Single
- if(nX < 0 || nX >= GetBitmapSize().Width())
- bOnTexture = sal_False;
- }
-
- // Wrapping in T-Richtung
- if(bOnTexture)
- {
- if(eWrapT == Base3DTextureClamp)
- {
- // Clamping
- if(nY < 0)
- nY = 0;
- else if(nY >= GetBitmapSize().Height())
- nY = GetBitmapSize().Height() - 1;
- }
- else if(eWrapT == Base3DTextureRepeat)
- {
- // Repeating
- nY %= GetBitmapSize().Height();
- if(nY < 0)
- nY += GetBitmapSize().Height();
- }
- else
- {
- // Single
- if(nY < 0 || nY >= GetBitmapSize().Height())
- bOnTexture = sal_False;
- }
-
- if(bOnTexture)
- aBmCol = pReadAccess->GetColor(nY, nX);
- }
-
- // transparence
- if(bOnTexture && pAlphaReadAccess)
- rCol.SetTransparency(pAlphaReadAccess->GetLuminance(nY, nX));
-
- // Falls die Position nicht innerhalb der Textur ist, auch das Filtern
- // unterdruecken um keine falschen BitmapAcesses zu bekommen
- sal_uInt8 nLocalSwitchVal(nSwitchVal);
- if(!bOnTexture)
- nLocalSwitchVal |= B3D_TXT_FLTR_NEA;
-
- switch(nLocalSwitchVal)
- {
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_REP|B3D_TXT_KIND_COL) :
- {
- rCol.SetRed(aBmCol.GetRed());
- rCol.SetGreen(aBmCol.GetGreen());
- rCol.SetBlue(aBmCol.GetBlue());
- break;
- }
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_MOD|B3D_TXT_KIND_COL) :
- {
- rCol.SetRed((sal_uInt8)( ((sal_uInt16)rCol.GetRed() * (sal_uInt16)aBmCol.GetRed())>>8 ));
- rCol.SetGreen((sal_uInt8)( ((sal_uInt16)rCol.GetGreen() * (sal_uInt16)aBmCol.GetGreen())>>8 ));
- rCol.SetBlue((sal_uInt8)( ((sal_uInt16)rCol.GetBlue() * (sal_uInt16)aBmCol.GetBlue())>>8 ));
- break;
- }
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_BND|B3D_TXT_KIND_COL) :
- {
- rCol.SetRed((sal_uInt8)( ((sal_uInt16)rCol.GetRed() * (0x00ff - (sal_uInt16)aBmCol.GetRed()))
- + ((sal_uInt16)aColBlend.GetRed() * (sal_uInt16)aBmCol.GetRed()) ));
- rCol.SetGreen((sal_uInt8)( ((sal_uInt16)rCol.GetGreen() * (0x00ff - (sal_uInt16)aBmCol.GetGreen()))
- + ((sal_uInt16)aColBlend.GetGreen() * (sal_uInt16)aBmCol.GetGreen()) ));
- rCol.SetBlue((sal_uInt8)( ((sal_uInt16)rCol.GetBlue() * (0x00ff - (sal_uInt16)aBmCol.GetBlue()))
- + ((sal_uInt16)aColBlend.GetBlue() * (sal_uInt16)aBmCol.GetBlue()) ));
- break;
- }
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_REP|B3D_TXT_KIND_INT) :
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_REP|B3D_TXT_KIND_LUM) :
- {
- rCol.SetRed((aBmCol.GetRed() + aBmCol.GetGreen() + aBmCol.GetBlue()) / 3);
- rCol.SetGreen(rCol.GetRed());
- rCol.SetBlue(rCol.GetRed());
- break;
- }
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_MOD|B3D_TXT_KIND_INT) :
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_MOD|B3D_TXT_KIND_LUM) :
- {
- sal_uInt16 nMidCol = (aBmCol.GetRed() + aBmCol.GetGreen() + aBmCol.GetBlue()) / 3;
- rCol.SetRed((sal_uInt8)( ((sal_uInt16)rCol.GetRed() * nMidCol)>>8 ));
- rCol.SetGreen((sal_uInt8)( ((sal_uInt16)rCol.GetGreen() * nMidCol)>>8 ));
- rCol.SetBlue((sal_uInt8)( ((sal_uInt16)rCol.GetBlue() * nMidCol)>>8 ));
- break;
- }
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_BND|B3D_TXT_KIND_INT) :
- case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_BND|B3D_TXT_KIND_LUM) :
- {
- sal_uInt16 nMidCol = (aBmCol.GetRed() + aBmCol.GetGreen() + aBmCol.GetBlue()) / 3;
- sal_uInt16 nInvMidCol = 0x00ff - nMidCol;
- rCol.SetRed((sal_uInt8)( ((sal_uInt16)rCol.GetRed() * nInvMidCol)
- + ((sal_uInt16)aColBlend.GetRed() * nMidCol) ));
- rCol.SetGreen((sal_uInt8)( ((sal_uInt16)rCol.GetGreen() * nInvMidCol)
- + ((sal_uInt16)aColBlend.GetGreen() * nMidCol) ));
- rCol.SetBlue((sal_uInt8)( ((sal_uInt16)rCol.GetBlue() * nInvMidCol)
- + ((sal_uInt16)aColBlend.GetBlue() * nMidCol) ));
- break;
- }
- case (B3D_TXT_MODE_REP|B3D_TXT_KIND_COL) :
- {
- fS = fS - floor(fS);
- fT = fT - floor(fT);
- long nX2, nY2;
-
- if(fS > 0.5) {
- nX2 = (nX + 1) % GetBitmapSize().Width();
- fS = 1.0 - fS;
- } else
- nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
-
- if(fT > 0.5) {
- nY2 = (nY + 1) % GetBitmapSize().Height();
- fT = 1.0 - fT;
- } else
- nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
-
- fS += 0.5;
- fT += 0.5;
- double fRight = 1.0 - fS;
- double fBottom = 1.0 - fT;
-
- BitmapColor aColTL = pReadAccess->GetColor(nY, nX);
- BitmapColor aColTR = pReadAccess->GetColor(nY, nX2);
- BitmapColor aColBL = pReadAccess->GetColor(nY2, nX);
- BitmapColor aColBR = pReadAccess->GetColor(nY2, nX2);
-
- rCol.SetRed((sal_uInt8)(((double)aColTL.GetRed() * fS + (double)aColTR.GetRed() * fRight) * fT
- + ((double)aColBL.GetRed() * fS + (double)aColBR.GetRed() * fRight) * fBottom));
- rCol.SetGreen((sal_uInt8)(((double)aColTL.GetGreen() * fS + (double)aColTR.GetGreen() * fRight) * fT
- + ((double)aColBL.GetGreen() * fS + (double)aColBR.GetGreen() * fRight) * fBottom));
- rCol.SetBlue((sal_uInt8)(((double)aColTL.GetBlue() * fS + (double)aColTR.GetBlue() * fRight) * fT
- + ((double)aColBL.GetBlue() * fS + (double)aColBR.GetBlue() * fRight) * fBottom));
- break;
- }
- case (B3D_TXT_MODE_MOD|B3D_TXT_KIND_COL) :
- {
- fS = fS - floor(fS);
- fT = fT - floor(fT);
- long nX2, nY2;
-
- if(fS > 0.5) {
- nX2 = (nX + 1) % GetBitmapSize().Width();
- fS = 1.0 - fS;
- } else
- nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
-
- if(fT > 0.5) {
- nY2 = (nY + 1) % GetBitmapSize().Height();
- fT = 1.0 - fT;
- } else
- nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
-
- fS += 0.5;
- fT += 0.5;
- double fRight = 1.0 - fS;
- double fBottom = 1.0 - fT;
-
- BitmapColor aColTL = pReadAccess->GetColor(nY, nX);
- BitmapColor aColTR = pReadAccess->GetColor(nY, nX2);
- BitmapColor aColBL = pReadAccess->GetColor(nY2, nX);
- BitmapColor aColBR = pReadAccess->GetColor(nY2, nX2);
-
- double fRed = ((double)aColTL.GetRed() * fS + (double)aColTR.GetRed() * fRight) * fT
- + ((double)aColBL.GetRed() * fS + (double)aColBR.GetRed() * fRight) * fBottom;
- double fGreen = ((double)aColTL.GetGreen() * fS + (double)aColTR.GetGreen() * fRight) * fT
- + ((double)aColBL.GetGreen() * fS + (double)aColBR.GetGreen() * fRight) * fBottom;
- double fBlue = ((double)aColTL.GetBlue() * fS + (double)aColTR.GetBlue() * fRight) * fT
- + ((double)aColBL.GetBlue() * fS + (double)aColBR.GetBlue() * fRight) * fBottom;
-
- rCol.SetRed((sal_uInt8)(((double)rCol.GetRed() * fRed) / 255.0));
- rCol.SetGreen((sal_uInt8)(((double)rCol.GetGreen() * fGreen) / 255.0));
- rCol.SetBlue((sal_uInt8)(((double)rCol.GetBlue() * fBlue) / 255.0));
- break;
- }
- case (B3D_TXT_MODE_BND|B3D_TXT_KIND_COL) :
- {
- fS = fS - floor(fS);
- fT = fT - floor(fT);
- long nX2, nY2;
-
- if(fS > 0.5) {
- nX2 = (nX + 1) % GetBitmapSize().Width();
- fS = 1.0 - fS;
- } else
- nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
-
- if(fT > 0.5) {
- nY2 = (nY + 1) % GetBitmapSize().Height();
- fT = 1.0 - fT;
- } else
- nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
-
- fS += 0.5;
- fT += 0.5;
- double fRight = 1.0 - fS;
- double fBottom = 1.0 - fT;
-
- BitmapColor aColTL = pReadAccess->GetColor(nY, nX);
- BitmapColor aColTR = pReadAccess->GetColor(nY, nX2);
- BitmapColor aColBL = pReadAccess->GetColor(nY2, nX);
- BitmapColor aColBR = pReadAccess->GetColor(nY2, nX2);
-
- double fRed = ((double)aColTL.GetRed() * fS + (double)aColTR.GetRed() * fRight) * fT
- + ((double)aColBL.GetRed() * fS + (double)aColBR.GetRed() * fRight) * fBottom;
- double fGreen = ((double)aColTL.GetGreen() * fS + (double)aColTR.GetGreen() * fRight) * fT
- + ((double)aColBL.GetGreen() * fS + (double)aColBR.GetGreen() * fRight) * fBottom;
- double fBlue = ((double)aColTL.GetBlue() * fS + (double)aColTR.GetBlue() * fRight) * fT
- + ((double)aColBL.GetBlue() * fS + (double)aColBR.GetBlue() * fRight) * fBottom;
-
- rCol.SetRed((sal_uInt8)((((double)rCol.GetRed() * (255.0 - fRed)) + ((double)aColBlend.GetRed() * fRed)) / 255.0));
- rCol.SetGreen((sal_uInt8)((((double)rCol.GetGreen() * (255.0 - fGreen)) + ((double)aColBlend.GetGreen() * fGreen)) / 255.0));
- rCol.SetBlue((sal_uInt8)((((double)rCol.GetBlue() * (255.0 - fBlue)) + ((double)aColBlend.GetBlue() * fBlue)) / 255.0));
- break;
- }
- case (B3D_TXT_MODE_REP|B3D_TXT_KIND_INT) :
- case (B3D_TXT_MODE_REP|B3D_TXT_KIND_LUM) :
- {
- fS = fS - floor(fS);
- fT = fT - floor(fT);
- long nX2, nY2;
-
- if(fS > 0.5) {
- nX2 = (nX + 1) % GetBitmapSize().Width();
- fS = 1.0 - fS;
- } else
- nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
-
- if(fT > 0.5) {
- nY2 = (nY + 1) % GetBitmapSize().Height();
- fT = 1.0 - fT;
- } else
- nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
-
- fS += 0.5;
- fT += 0.5;
- double fRight = 1.0 - fS;
- double fBottom = 1.0 - fT;
-
- sal_uInt8 nMidVal = (sal_uInt8)((
- (double)pReadAccess->GetLuminance(nY, nX) * fS +
- (double)pReadAccess->GetLuminance(nY, nX2) * fRight) * fT + (
- (double)pReadAccess->GetLuminance(nY2, nX) * fS +
- (double)pReadAccess->GetLuminance(nY2, nX2) * fRight) * fBottom);
-
- rCol.SetRed(nMidVal);
- rCol.SetGreen(nMidVal);
- rCol.SetBlue(nMidVal);
- break;
- }
- case (B3D_TXT_MODE_MOD|B3D_TXT_KIND_INT) :
- case (B3D_TXT_MODE_MOD|B3D_TXT_KIND_LUM) :
- {
- fS = fS - floor(fS);
- fT = fT - floor(fT);
- long nX2, nY2;
-
- if(fS > 0.5) {
- nX2 = (nX + 1) % GetBitmapSize().Width();
- fS = 1.0 - fS;
- } else
- nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
-
- if(fT > 0.5) {
- nY2 = (nY + 1) % GetBitmapSize().Height();
- fT = 1.0 - fT;
- } else
- nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
-
- fS += 0.5;
- fT += 0.5;
- double fRight = 1.0 - fS;
- double fBottom = 1.0 - fT;
-
- double fMidVal = (
- (double)pReadAccess->GetLuminance(nY, nX) * fS +
- (double)pReadAccess->GetLuminance(nY, nX2) * fRight) * fT + (
- (double)pReadAccess->GetLuminance(nY2, nX) * fS +
- (double)pReadAccess->GetLuminance(nY2, nX2) * fRight) * fBottom;
-
- rCol.SetRed((sal_uInt8)(((double)rCol.GetRed() * fMidVal) / 255.0));
- rCol.SetGreen((sal_uInt8)(((double)rCol.GetGreen() * fMidVal) / 255.0));
- rCol.SetBlue((sal_uInt8)(((double)rCol.GetBlue() * fMidVal) / 255.0));
- break;
- }
- case (B3D_TXT_MODE_BND|B3D_TXT_KIND_INT) :
- case (B3D_TXT_MODE_BND|B3D_TXT_KIND_LUM) :
- {
- fS = fS - floor(fS);
- fT = fT - floor(fT);
- long nX2, nY2;
-
- if(fS > 0.5) {
- nX2 = (nX + 1) % GetBitmapSize().Width();
- fS = 1.0 - fS;
- } else
- nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
-
- if(fT > 0.5) {
- nY2 = (nY + 1) % GetBitmapSize().Height();
- fT = 1.0 - fT;
- } else
- nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
-
- fS += 0.5;
- fT += 0.5;
- double fRight = 1.0 - fS;
- double fBottom = 1.0 - fT;
-
- double fMidVal = (
- (double)pReadAccess->GetLuminance(nY, nX) * fS +
- (double)pReadAccess->GetLuminance(nY, nX2) * fRight) * fT + (
- (double)pReadAccess->GetLuminance(nY2, nX) * fS +
- (double)pReadAccess->GetLuminance(nY2, nX2) * fRight) * fBottom;
- double fInvMidVal(255.0 - fMidVal);
-
- rCol.SetRed((sal_uInt8)((((double)rCol.GetRed() * fInvMidVal) + ((double)aColBlend.GetRed() * fMidVal)) / 255.0));
- rCol.SetGreen((sal_uInt8)((((double)rCol.GetGreen() * fInvMidVal) + ((double)aColBlend.GetGreen() * fMidVal)) / 255.0));
- rCol.SetBlue((sal_uInt8)((((double)rCol.GetBlue() * fInvMidVal) + ((double)aColBlend.GetBlue() * fMidVal)) / 255.0));
- break;
- }
- }
-
-// Funktionsfaehige Version komplett auf double precision und
-// kuerzesten Pfaden
-//
-// // Parameter fuer Farbe der Texturstelle bereitstellen
-// double fRed, fGreen, fBlue;
-//
-// // Eventuell glaetten?
-// if(GetTextureFilter() == Base3DTextureLinear)
-// {
-// // Filtern
-// double fLeft = fS - floor(fS);
-// double fTop = fT - floor(fT);
-// double fRight, fBottom;
-// long nX2, nY2;
-//
-// if(fLeft > 0.5)
-// {
-// nX2 = (nX + 1) % GetBitmapSize().Width();
-// fLeft = (1.0 - fLeft) + 0.5;
-// fRight = 1.0 - fLeft;
-// }
-// else
-// {
-// nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
-// fLeft = fLeft + 0.5;
-// fRight = 1.0 - fLeft;
-// }
-//
-//
-// if(fTop > 0.5)
-// {
-// nY2 = (nY + 1) % GetBitmapSize().Height();
-// fTop = (1.0 - fTop) + 0.5;
-// fBottom = 1.0 - fTop;
-// }
-// else
-// {
-// nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
-// fTop = fTop + 0.5;
-// fBottom = 1.0 - fTop;
-// }
-//
-// const BitmapColor& rColTL = GetBitmapColor(nX, nY);
-// const BitmapColor& rColTR = GetBitmapColor(nX2, nY);
-// const BitmapColor& rColBL = GetBitmapColor(nX, nY2);
-// const BitmapColor& rColBR = GetBitmapColor(nX2, nY2);
-//
-// fRed = ((double)rColTL.GetRed() * fLeft + (double)rColTR.GetRed() * fRight) * fTop
-// + ((double)rColBL.GetRed() * fLeft + (double)rColBR.GetRed() * fRight) * fBottom;
-//
-// fGreen = ((double)rColTL.GetGreen() * fLeft + (double)rColTR.GetGreen() * fRight) * fTop
-// + ((double)rColBL.GetGreen() * fLeft + (double)rColBR.GetGreen() * fRight) * fBottom;
-//
-// fBlue = ((double)rColTL.GetBlue() * fLeft + (double)rColTR.GetBlue() * fRight) * fTop
-// + ((double)rColBL.GetBlue() * fLeft + (double)rColBR.GetBlue() * fRight) * fBottom;
-// }
-// else
-// {
-// // Nearest Pixel
-// const BitmapColor& rBmCol = GetBitmapColor(nX, nY);
-// fRed = (double)rBmCol.GetRed();
-// fGreen = (double)rBmCol.GetGreen();
-// fBlue = (double)rBmCol.GetBlue();
-// }
-//
-// // Jetzt anhand der TextureKind entscheiden
-// if(eKind == Base3DTextureColor)
-// {
-// if(eMode == Base3DTextureReplace)
-// {
-// rCol.SetRed((sal_uInt8)fRed);
-// rCol.SetGreen((sal_uInt8)fGreen);
-// rCol.SetBlue((sal_uInt8)fBlue);
-// }
-// else if(eMode == Base3DTextureModulate)
-// {
-// rCol.SetRed((sal_uInt8)(((double)rCol.GetRed() * fRed) / 255.0));
-// rCol.SetGreen((sal_uInt8)(((double)rCol.GetGreen() * fGreen) / 255.0));
-// rCol.SetBlue((sal_uInt8)(((double)rCol.GetBlue() * fBlue) / 255.0));
-// }
-// else // Base3DTextureBlend
-// {
-// rCol.SetRed((sal_uInt8)((((double)rCol.GetRed() * (255.0 - fRed)) + ((double)aColBlend.GetRed() * fRed)) / 255.0));
-// rCol.SetGreen((sal_uInt8)((((double)rCol.GetGreen() * (255.0 - fGreen)) + ((double)aColBlend.GetGreen() * fGreen)) / 255.0));
-// rCol.SetBlue((sal_uInt8)((((double)rCol.GetBlue() * (255.0 - fBlue)) + ((double)aColBlend.GetBlue() * fBlue)) / 255.0));
-// }
-// }
-// else
-// {
-// double fMidVal((fRed + fGreen + fBlue) / 3.0);
-// if(eMode == Base3DTextureReplace)
-// {
-// rCol.SetRed((sal_uInt8)fMidVal);
-// rCol.SetGreen((sal_uInt8)fMidVal);
-// rCol.SetBlue((sal_uInt8)fMidVal);
-// }
-// else if(eMode == Base3DTextureModulate)
-// {
-// rCol.SetRed((sal_uInt8)(((double)rCol.GetRed() * fMidVal) / 255.0));
-// rCol.SetGreen((sal_uInt8)(((double)rCol.GetGreen() * fMidVal) / 255.0));
-// rCol.SetBlue((sal_uInt8)(((double)rCol.GetBlue() * fMidVal) / 255.0));
-// }
-// else // Base3DTextureBlend
-// {
-// double fInvMidVal(255.0 - fMidVal);
-// rCol.SetRed((sal_uInt8)((((double)rCol.GetRed() * fInvMidVal) + ((double)aColBlend.GetRed() * fRed)) / 255.0));
-// rCol.SetGreen((sal_uInt8)((((double)rCol.GetGreen() * fInvMidVal) + ((double)aColBlend.GetGreen() * fGreen)) / 255.0));
-// rCol.SetBlue((sal_uInt8)((((double)rCol.GetBlue() * fInvMidVal) + ((double)aColBlend.GetBlue() * fBlue)) / 255.0));
-// }
-// }
-}
-
-/*************************************************************************
-|*
-|* Konstruktor TexturOpenGL
-|*
-\************************************************************************/
-
-B3dTextureOpenGL::B3dTextureOpenGL(
- TextureAttributes& rAtt,
- BitmapEx& rBmpEx,
- OpenGL& rOGL,
- Base3DTextureKind eKnd,
- Base3DTextureMode eMod,
- Base3DTextureFilter eFlt,
- Base3DTextureWrap eS,
- Base3DTextureWrap eT)
-: B3dTexture(rAtt, rBmpEx, eKnd, eMod, eFlt, eS, eT),
- nTextureName(0)
-{
- // TextureName anfordern
- rOGL.GenTextures(1, &nTextureName);
-}
-
-/*************************************************************************
-|*
-|* Destruktor TexturOpenGL
-|*
-\************************************************************************/
-
-B3dTextureOpenGL::~B3dTextureOpenGL()
-{
-}
-
-/*************************************************************************
-|*
-|* In OpenGL die Textur zerstoeren
-|*
-\************************************************************************/
-
-void B3dTextureOpenGL::DestroyOpenGLTexture(OpenGL& rOpenGL)
-{
- // OpenGL Textur wieder freigeben
- rOpenGL.DeleteTextures(1, &nTextureName);
-}
-
-/*************************************************************************
-|*
-|* Setze diese Textur in OpenGL als aktuelle Textur
-|*
-\************************************************************************/
-
-void B3dTextureOpenGL::MakeCurrentTexture(OpenGL& rOpenGL)
-{
- // Eventuell Textur erst erzeugen?
- if(!rOpenGL.IsTexture(nTextureName) || bTextureKindChanged)
- {
- // Textur erzeugen und binden
- CreateOpenGLTexture(rOpenGL);
- }
- else
- {
- // Jetzt Textur binden
- rOpenGL.BindTexture(GL_TEXTURE_2D, nTextureName);
- }
-
- // Nun die Parameter an der Textur setzen
- switch(GetTextureWrapS())
- {
- case Base3DTextureSingle :
- case Base3DTextureClamp :
- rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- break;
- case Base3DTextureRepeat :
- rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- break;
- }
- switch(GetTextureWrapT())
- {
- case Base3DTextureSingle :
- case Base3DTextureClamp :
- rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- break;
- case Base3DTextureRepeat :
- rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- break;
- }
- switch(GetTextureFilter())
- {
- case Base3DTextureNearest :
- rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- break;
- case Base3DTextureLinear :
- rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- break;
- }
- switch(GetTextureMode())
- {
- case Base3DTextureReplace :
- rOpenGL.TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- break;
- case Base3DTextureModulate :
- rOpenGL.TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- break;
- case Base3DTextureBlend :
- {
- rOpenGL.TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
- float fArray[4] = {
- ((float)GetBlendColor().GetRed()) / (float)255.0,
- ((float)GetBlendColor().GetGreen()) / (float)255.0,
- ((float)GetBlendColor().GetBlue()) / (float)255.0,
- ((float)GetBlendColor().GetTransparency()) / (float)255.0
- };
- rOpenGL.TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, fArray);
- break;
- }
- }
-}
-
-/*************************************************************************
-|*
-|* Erzeuge diese Textur als OpenGL-Textur
-|*
-\************************************************************************/
-
-void B3dTextureOpenGL::CreateOpenGLTexture(OpenGL& rOpenGL)
-{
- Size aSize(0,0);
-
- // Groesse entscheiden (auf 1024 begrenzen)
- for(sal_uInt16 a=1;a<0x0400 && (!aSize.Width() || !aSize.Height());a<<=1)
- {
- if(!aSize.Width() && (a>=GetBitmapSize().Width()))
- aSize.Width() = a;
- if(!aSize.Height() && (a>=GetBitmapSize().Height()))
- aSize.Height() = a;
- }
-
- // begrenzen falls groesser als 1024
- if(!aSize.Width())
- aSize.Width() = 0x0400;
- if(!aSize.Height())
- aSize.Height() = 0x0400;
-
- // Minimalgroesse garantieren, auch an 4Byte-Alignment denken
- // falls hier mal geaendert wird... (siehe OpenGL Bitmap Befehle)
- if(aSize.Width() < 8)
- aSize.Width() = 8;
- if(aSize.Height() < 8)
- aSize.Height() = 8;
-
- // Skalierte Bitmap anlegen
- sal_Bool bUsesAlpha(!!GetAlphaMask());
- Bitmap aLocalBitmap(GetBitmap());
- AlphaMask aTransAlphaMask;
-
- if(bUsesAlpha)
- {
- aTransAlphaMask = GetAlphaMask();
- }
-
- if(aSize != GetBitmapSize())
- {
- aLocalBitmap.Scale((double)aSize.Width() / (double)GetBitmapSize().Width(),
- (double)aSize.Height() / (double)GetBitmapSize().Height());
-
- if(bUsesAlpha)
- {
- aTransAlphaMask.Scale((double)aSize.Width() / (double)GetBitmapSize().Width(),
- (double)aSize.Height() / (double)GetBitmapSize().Height());
- }
- }
-
- // Falls es sich um eine nur einmal zu wiederholende Bitmap
- // handelt, lege nun eine mit einem definierten Rand an
- if(GetTextureWrapS() == Base3DTextureSingle || GetTextureWrapT() == Base3DTextureSingle)
- {
- Bitmap aHelpBitmap(aLocalBitmap);
- AlphaMask aTransAlphaHelpMask;
-
- if(bUsesAlpha)
- {
- aTransAlphaHelpMask = aTransAlphaMask;
- }
-
- Size aNewSize(aSize);
- Point aNewPos(0, 0);
-
- if(GetTextureWrapS() == Base3DTextureSingle)
- {
- aNewSize.Width() -= 4;
- aNewPos.X() = 2;
- }
- if(GetTextureWrapT() == Base3DTextureSingle)
- {
- aNewSize.Height() -= 4;
- aNewPos.Y() = 2;
- }
-
- aHelpBitmap.Scale((double)aNewSize.Width() / (double)aSize.Width(),
- (double)aNewSize.Height() / (double)aSize.Height());
- Color aEraseCol = GetTextureColor();
- aLocalBitmap.Erase(aEraseCol);
- Point aPoint;
- Rectangle aCopySrc(aPoint, aNewSize);
- Rectangle aCopyDest(aNewPos, aNewSize);
- aLocalBitmap.CopyPixel(aCopyDest, aCopySrc, &aHelpBitmap);
-
- if(bUsesAlpha)
- {
- aTransAlphaHelpMask.Scale((double)aNewSize.Width() / (double)aSize.Width(),
- (double)aNewSize.Height() / (double)aSize.Height());
- aTransAlphaMask.Erase(0);
- aTransAlphaMask.CopyPixel(aCopyDest, aCopySrc, &aTransAlphaHelpMask);
- }
- }
-
- // Lesezugriff auf neue Bitmap holen
- BitmapReadAccess* pLocalReadAccess = aLocalBitmap.AcquireReadAccess();
- BitmapReadAccess* pLocalAlphaReadAccess = (bUsesAlpha) ? aTransAlphaMask.AcquireReadAccess() : NULL;
- sal_Bool bGotReadAccess((bUsesAlpha)
- ? (pLocalReadAccess != 0 && pLocalAlphaReadAccess != 0) : pLocalReadAccess != 0);
-
- if(bGotReadAccess)
- {
- // Buffer holen
- sal_Int32 nSize(aSize.Width() * aSize.Height());
- sal_Int32 nAllocSize(nSize);
-
- if(GetTextureKind() == Base3DTextureColor)
- {
- nAllocSize += (2 * nSize);
- }
- if(bUsesAlpha)
- {
- nAllocSize += nSize;
- }
-
- GL_UINT8 pBuffer = (GL_UINT8) rtl_allocateMemory(nAllocSize);
-
- if(pBuffer)
- {
- // Daten kopieren
- GL_UINT8 pRunner = pBuffer;
- if(GetTextureKind() == Base3DTextureColor)
- {
- if(pLocalReadAccess->HasPalette())
- {
- for(long a=0;a<aSize.Height();a++)
- {
- for(long b=0;b<aSize.Width();b++)
- {
- BitmapColor rCol = pLocalReadAccess->GetPaletteColor(pLocalReadAccess->GetPixel(a, b));
- *pRunner++ = rCol.GetRed();
- *pRunner++ = rCol.GetGreen();
- *pRunner++ = rCol.GetBlue();
-
- if(bUsesAlpha)
- {
- BitmapColor rTrn = pLocalAlphaReadAccess->GetPixel(a, b);
- *pRunner++ = (BYTE)255 - rTrn.GetIndex();
- }
- }
- }
- }
- else
- {
- for(long a=0;a<aSize.Height();a++)
- {
- for(long b=0;b<aSize.Width();b++)
- {
- BitmapColor rCol = pLocalReadAccess->GetPixel(a, b);
- *pRunner++ = rCol.GetRed();
- *pRunner++ = rCol.GetGreen();
- *pRunner++ = rCol.GetBlue();
-
- if(bUsesAlpha)
- {
- BitmapColor rTrn = pLocalAlphaReadAccess->GetPixel(a, b);
- *pRunner++ = (BYTE)255 - rTrn.GetIndex();
- }
- }
- }
- }
- }
- else
- {
- if(pLocalReadAccess->HasPalette())
- {
- for(long a=0;a<aSize.Height();a++)
- {
- for(long b=0;b<aSize.Width();b++)
- {
- BitmapColor rCol = pLocalReadAccess->GetPaletteColor(pLocalReadAccess->GetPixel(a, b));
- *pRunner++ = (rCol.GetRed() + rCol.GetGreen() + rCol.GetBlue()) / 3;
-
- if(bUsesAlpha)
- {
- BitmapColor rTrn = pLocalAlphaReadAccess->GetPixel(a, b);
- *pRunner++ = (BYTE)255 - rTrn.GetIndex();
- }
- }
- }
- }
- else
- {
- for(long a=0;a<aSize.Height();a++)
- {
- for(long b=0;b<aSize.Width();b++)
- {
- BitmapColor rCol = pLocalReadAccess->GetPixel(a, b);
- *pRunner++ = (rCol.GetRed() + rCol.GetGreen() + rCol.GetBlue()) / 3;
-
- if(bUsesAlpha)
- {
- BitmapColor rTrn = pLocalAlphaReadAccess->GetPixel(a, b);
- *pRunner++ = (BYTE)255 - rTrn.GetIndex();
- }
- }
- }
- }
- }
-
- // Textur das erste mal binden und damit initialisieren
- rOpenGL.BindTexture(GL_TEXTURE_2D, nTextureName);
-
- // Jetzt ein glTexImage2D() ausfuehren
- GLint nInternalFormat = 0;
- GLint nFormat = 0;
-
- switch(GetTextureKind())
- {
- case Base3DTextureLuminance:
- {
- if(bUsesAlpha)
- {
- nInternalFormat = GL_LUMINANCE_ALPHA;
- nFormat = GL_LUMINANCE_ALPHA;
- }
- else
- {
- nInternalFormat = GL_LUMINANCE;
- nFormat = GL_LUMINANCE;
- }
- break;
- }
- case Base3DTextureIntensity:
- {
- if(bUsesAlpha)
- {
- nInternalFormat = GL_LUMINANCE_ALPHA;
- nFormat = GL_LUMINANCE_ALPHA;
- }
- else
- {
- nInternalFormat = GL_INTENSITY;
- nFormat = GL_LUMINANCE;
- }
- break;
- }
- case Base3DTextureColor:
- {
- if(bUsesAlpha)
- {
- nInternalFormat = GL_RGBA;
- nFormat = GL_RGBA;
- }
- else
- {
- nInternalFormat = GL_RGB;
- nFormat = GL_RGB;
- }
- break;
- }
- }
-
- rOpenGL.TexImage2D(GL_TEXTURE_2D, 0, nInternalFormat,
- (GLsizei)aSize.Width(),
- (GLsizei)aSize.Height(),
- 0, nFormat, GL_UNSIGNED_BYTE, pBuffer);
-
- rtl_freeMemory(pBuffer);
- }
- }
-
- // Lesezugriff freigeben
- if (pLocalReadAccess) aLocalBitmap.ReleaseAccess(pLocalReadAccess);
- if (pLocalAlphaReadAccess) aTransAlphaMask.ReleaseAccess(pLocalAlphaReadAccess);
-
- // Hinweis auf Veraenderung der Texturart auf jeden Fall elliminieren
- bTextureKindChanged = sal_False;
-}
-
-// eof
diff --git a/goodies/source/base3d/b3dtrans.cxx b/goodies/source/base3d/b3dtrans.cxx
index 96f6e6476405..fd2908c3ea2e 100644
--- a/goodies/source/base3d/b3dtrans.cxx
+++ b/goodies/source/base3d/b3dtrans.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b3dtrans.cxx,v $
- * $Revision: 1.10 $
+ * $Revision: 1.10.42.1 $
*
* This file is part of OpenOffice.org.
*
@@ -31,13 +31,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_goodies.hxx"
#include "b3dtrans.hxx"
-#include <goodies/base3d.hxx>
#include <tools/debug.hxx>
-//#ifndef _B3D_VOLUM_HXX
-//#include "b3dvolum.hxx"
-//#endif
-
/*************************************************************************
|*
|* Transformationen fuer alle 3D Ausgaben
diff --git a/goodies/source/base3d/base3d.cxx b/goodies/source/base3d/base3d.cxx
deleted file mode 100644
index 1bad12fbe062..000000000000
--- a/goodies/source/base3d/base3d.cxx
+++ /dev/null
@@ -1,1267 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: base3d.cxx,v $
- * $Revision: 1.17 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include <svtools/options3d.hxx>
-#include <goodies/base3d.hxx>
-#include <goodies/b3dentty.hxx>
-#include "b3dtex.hxx"
-#include "b3dopngl.hxx"
-#include "b3ddeflt.hxx"
-
-//#ifndef _B3D_B3DPRINT_HXX
-//#include "b3dprint.hxx"
-//#endif
-#include <goodies/b3dgeom.hxx>
-#include "b3dtrans.hxx"
-#include <tools/shl.hxx>
-#include <tools/poly.hxx>
-#include <vcl/outdev.hxx>
-
-/*************************************************************************
-|*
-|* Konstruktor B3dGlobalData
-|*
-\************************************************************************/
-
-B3dGlobalData::B3dGlobalData()
-: maTextureStore(64, 16, 16) // init Container
-{
- // init timer
- maTimer.SetTimeout(10000); // ten seconds
- maTimer.SetTimeoutHdl(LINK(this, B3dGlobalData, TimerHdl));
- maTimer.Start();
-}
-
-/*************************************************************************
-|*
-|* Destruktor B3dGlobalData
-|*
-\************************************************************************/
-
-B3dGlobalData::~B3dGlobalData()
-{
- // stop timer
- maTimer.Stop();
- DeleteAllTextures();
-}
-
-/*************************************************************************
-|*
-|* Methods B3dGlobalData
-|*
-\************************************************************************/
-
-IMPL_LINK(B3dGlobalData, TimerHdl, AutoTimer*, EMPTYARG)
-{
- if(maTextureStore.Count())
- {
- maMutex.acquire();
- Time aTimeNow;
- for(sal_uInt16 a(0); a < maTextureStore.Count();)
- {
- B3dTexture* pRetval = (B3dTexture*)maTextureStore.GetObject(a);
- if(pRetval->GetTimeStamp() < aTimeNow)
- {
- maTextureStore.Remove(a);
- delete pRetval;
- }
- else
- a++;
- }
- maMutex.release();
- }
- return 0;
-}
-
-B3dTexture* B3dGlobalData::ObtainTexture(TextureAttributes& rAtt)
-{
- maMutex.acquire();
- for(sal_uInt16 a(0); a < maTextureStore.Count(); a++)
- {
- B3dTexture* pRetval = (B3dTexture*)maTextureStore.GetObject(a);
- if(pRetval->GetAttributes() == rAtt)
- {
- pRetval->Touch();
- maMutex.release();
- return pRetval;
- }
- }
- maMutex.release();
- return NULL;
-}
-
-void B3dGlobalData::InsertTexture(B3dTexture* pNew)
-{
- if(pNew)
- {
- maMutex.acquire();
- for(sal_uInt16 a(0); a < maTextureStore.Count(); a++)
- {
- B3dTexture* pRetval = (B3dTexture*)maTextureStore.GetObject(a);
- if(pRetval == pNew)
- {
- maMutex.release();
- return;
- }
- }
-
- pNew->Touch();
- maTextureStore.Insert(pNew, CONTAINER_APPEND);
- maMutex.release();
- }
-}
-
-void B3dGlobalData::DeleteTexture(B3dTexture* pOld)
-{
- if(pOld)
- {
- maMutex.acquire();
- for(sal_uInt16 a(0); a < maTextureStore.Count(); a++)
- {
- B3dTexture* pRetval = (B3dTexture*)maTextureStore.GetObject(a);
- if(pRetval == pOld)
- {
- maTextureStore.Remove(a);
- delete pOld;
- maMutex.release();
- return;
- }
- }
- maMutex.release();
- }
-}
-
-void B3dGlobalData::DeleteAllTextures()
-{
- if(maTextureStore.Count())
- {
- maMutex.acquire();
- for(sal_uInt16 a(0); a < maTextureStore.Count(); a++)
- {
- B3dTexture* pRetval = (B3dTexture*)maTextureStore.GetObject(a);
- delete pRetval;
- }
- maTextureStore.Clear();
- maMutex.release();
- }
-}
-
-/*************************************************************************
-|*
-|* Konstruktor Base3D
-|*
-\************************************************************************/
-
-Base3D::Base3D(OutputDevice* pOutDev)
-: OutDev3D(),
- pDevice(pOutDev),
- eObjectMode(Base3DPoints),
- aCurrentColor(Color(0xff, 0xff, 0xff)),
- aComplexPolygon(),
- eRenderModeFront(Base3DRenderFill),
- eRenderModeBack(Base3DRenderFill),
- eShadeModel(Base3DSmooth),
- eCullMode(Base3DCullNone),
- fPointSize(1.0),
- fLineWidth(1.0),
- pActiveTexture(NULL),
- pTransformationSet(NULL),
- pLightGroup(NULL),
- aMaterialFront(),
- aMaterialBack(),
- nDisplayQuality(127),
- mfPolygonOffset(0.005), // #i71618#
- bEdgeFlag(TRUE),
- bContextIsValid(TRUE),
- bPolyOffsetFill(FALSE),
- bPolyOffsetLine(FALSE),
- bPolyOffsetPoint(FALSE),
- bScissorRegionActive(FALSE),
- bDitherActive(TRUE)
-{
- // Grundsaetzliche Materialeigenschaften setzen
- ResetMaterial(Base3DMaterialFrontAndBack);
-
- // Fuer OS/2 die FP-Exceptions abschalten
-#if defined(OS2)
-#define SC_FPEXCEPTIONS_ON() _control87( MCW_EM, 0 )
-#define SC_FPEXCEPTIONS_OFF() _control87( MCW_EM, MCW_EM )
- SC_FPEXCEPTIONS_OFF();
-#endif
-
- // Fuer WIN95/NT die FP-Exceptions abschalten
-#if defined(WNT) || defined(WIN)
-#define SC_FPEXCEPTIONS_ON() _control87( _MCW_EM, 0 )
-#define SC_FPEXCEPTIONS_OFF() _control87( _MCW_EM, _MCW_EM )
- SC_FPEXCEPTIONS_OFF();
-#endif
-}
-
-/*************************************************************************
-|*
-|* Destruktor Base3D
-|*
-\************************************************************************/
-
-Base3D::~Base3D()
-{
-}
-
-/*************************************************************************
-|*
-|* Erzeuge einen Base3D Kontext in Anhaengigkeit vom uebergebenen
-|* OutputDevice und trage Ihn dort ein
-|*
-\************************************************************************/
-
-Base3D* Base3D::Create(OutputDevice* pOutDev, BOOL bForcePrinter)
-{
- Base3D* pRetval = NULL;
- if(pOutDev)
- {
- // Anforderungen feststellen
- BOOL bOwnDevice = FALSE;
- if(pOutDev->GetOutDevType() == OUTDEV_VIRDEV
- || pOutDev->GetOutDevType() == OUTDEV_PRINTER
- || pOutDev->GetConnectMetaFile() != NULL)
- bOwnDevice = TRUE;
-
- // Existiert schon ein 3D-Kontext, der auch an dieses
- // OutputDevice gebunden ist?
- if(pOutDev->Get3DContext()
- && ((Base3D*)(pOutDev->Get3DContext()))->GetOutputDevice() == pOutDev)
- {
- pRetval = (Base3D*)pOutDev->Get3DContext();
- }
-
- // Falls Ja, ist er den Anforderungen gewachsen?
- if(pRetval)
- {
- BOOL bForceNew(FALSE);
-
- if((!bForceNew) && (bOwnDevice)&&(pRetval->GetBase3DType() == BASE3D_TYPE_OPENGL))
- {
- bForceNew = TRUE;
- }
-
- if((!bForceNew) && (bForcePrinter)&&(pRetval->GetBase3DType() != BASE3D_TYPE_PRINTER))
- {
- bForceNew = TRUE;
- }
-
- if((!bForceNew) && (!bForcePrinter)&&(pRetval->GetBase3DType() == BASE3D_TYPE_PRINTER))
- {
- bForceNew = TRUE;
- }
-
- if(!bForceNew && !bOwnDevice)
- {
- // Versuchen, einen OpenGL Kontext zu bekommen? Teste das
- // globale Flag aus der .INI
- BOOL bUseOpenGL = SvtOptions3D().IsOpenGL();
-
- if((bUseOpenGL && pRetval->GetBase3DType() != BASE3D_TYPE_OPENGL)
- || (!bUseOpenGL && pRetval->GetBase3DType() == BASE3D_TYPE_OPENGL))
- {
- bForceNew = TRUE;
- bOwnDevice = !bUseOpenGL;
- }
- }
-
- if(bForceNew)
- {
- pRetval->Destroy(pOutDev);
- pRetval = NULL;
- }
- }
-
- if(!pRetval)
- {
- // zerstoere altes Base3D, war nicht mehr an das
- // OutputDevice gebunden
- if(pOutDev->Get3DContext())
- pOutDev->Get3DContext()->Destroy(pOutDev);
-
- // erzeuge neues Base3D, je nach Anforderungen
- if(bForcePrinter)
- {
- DBG_ERROR("Base3D::Create(): Printer renderer not supported ATM, if needed migrate from old goodies lib.");
- // #i82966# fallback to default renderer instead of returning NULL
- pRetval = new Base3DDefault(pOutDev);
- //pRetval = new Base3DPrinter(pOutDev);
- }
- else if(bOwnDevice)
- {
- pRetval = new Base3DDefault(pOutDev);
- }
- else
- {
- // Versuche OpenGL, fallback auf default
- // falls OpenGL nicht verfuegbar
- pRetval = CreateScreenRenderer(pOutDev);
- }
-
- // 3D-Kontext eintragen als Renderer im angegebenen OutputDevice
- if(pRetval)
- pOutDev->Set3DContext((Base3D*)pRetval);
- }
- }
- return pRetval;
-}
-
-/*************************************************************************
-|*
-|* Versuche, einen 3D Kontext zur Bildschirmdarstellung zu generieren.
-|* Diese Funktion wird nur bei WNT realisiert. Sie muss entscheiden,
-|* ob OpenGL-DLL's verfuegbar sind und entsprechend den OpenGL
-|* Renderer oder einen Default Renderer erzeugen.
-|*
-\************************************************************************/
-
-Base3D* Base3D::CreateScreenRenderer(OutputDevice* pOutDev)
-{
- // OpenGL Kontext erzeugen
- Base3D* pRetval = NULL;
-
- // Versuchen, einen OpenGL Kontext zu bekommen? Teste das
- // globale Flag aus der .INI
- BOOL bUseOpenGL = SvtOptions3D().IsOpenGL();
-
- // Versuchen, einen OpenGL Kontext zu bekommen
- if(bUseOpenGL)
- pRetval = new Base3DOpenGL(pOutDev);
-
- if(!pRetval || !pRetval->IsContextValid())
- {
- if(pRetval)
- {
- delete pRetval;
- pRetval = NULL;
- }
- }
-
- // versuche alternativ, einen Default Renderer zu inkarnieren
- if(!pRetval)
- pRetval = new Base3DDefault(pOutDev);
-
- return pRetval;
-}
-
-/*************************************************************************
-|*
-|* Entferne den Kontext aus dem assoziierten OutputDevice und zerstoere
-|* sich selbst
-|*
-|* Als Platzhalter fuer den Zeiger auf einen Kontext im OutputDevice
-|* wird momentan pTheCurrentBase3DIncarnation benutzt
-|*
-\************************************************************************/
-
-void Base3D::Destroy(OutputDevice *)
-{
- Base3D* pTmp;
- if((pTmp = (Base3D*)GetOutputDevice()->Get3DContext()) == this)
- {
- GetOutputDevice()->Set3DContext(NULL);
- delete pTmp;
- }
-}
-
-/*************************************************************************
-|*
-|* TransformationSet setzen
-|*
-\************************************************************************/
-
-void Base3D::SetTransformationSet(B3dTransformationSet* pSet)
-{
- // Aktuelles TransformationSet eintragen
- pTransformationSet = pSet;
-}
-
-/*************************************************************************
-|*
-|* Beleuchtung setzen
-|*
-\************************************************************************/
-
-void Base3D::SetLightGroup(B3dLightGroup* pSet, BOOL /*bSetGlobal*/)
-{
- // Aktuelle Beleuchtung eintragen
- pLightGroup = pSet;
-}
-
-/*************************************************************************
-|*
-|* Scissoring Region setzen
-|*
-\************************************************************************/
-
-void Base3D::SetScissorRegionPixel(const Rectangle& rRect, BOOL bActivate)
-{
- aScissorRectangle = rRect;
- ActivateScissorRegion(bActivate);
-}
-
-void Base3D::SetScissorRegion(const Rectangle& rRect, BOOL bActivate)
-{
- SetScissorRegionPixel(pDevice->LogicToPixel(rRect), bActivate);
-}
-
-/*************************************************************************
-|*
-|* Scissoring aktivieren/deaktivieren
-|*
-\************************************************************************/
-
-void Base3D::ActivateScissorRegion(BOOL bNew)
-{
- if(bNew != bScissorRegionActive)
- bScissorRegionActive = bNew;
-}
-
-/*************************************************************************
-|*
-|* Dithering setzen
-|*
-\************************************************************************/
-
-void Base3D::SetDither(BOOL bNew)
-{
- bDitherActive = bNew;
-}
-
-/*************************************************************************
-|*
-|* Objektmodus holen
-|*
-\************************************************************************/
-
-Base3DObjectMode Base3D::GetObjectMode() const
-{
- return eObjectMode;
-}
-
-/*************************************************************************
-|*
-|* Ein neues Primitiv vom Typ nMode starten
-|*
-\************************************************************************/
-
-void Base3D::StartPrimitive(Base3DObjectMode eMode)
-{
- eObjectMode = eMode;
- if(eObjectMode > Base3DPolygon)
- {
- switch(eObjectMode)
- {
- case Base3DComplexPolygonCut :
- {
- // Neues Polygon beginnen
- aComplexPolygon.SetTestForCut(TRUE);
- aComplexPolygon.StartPrimitive();
- break;
- }
- case Base3DComplexPolygon :
- {
- // Neues Polygon beginnen
- aComplexPolygon.SetTestForCut(FALSE);
- aComplexPolygon.StartPrimitive();
- break;
- }
- default:
- break; // -Wall multiple cases not handled.
- }
- }
- else
- {
- ImplStartPrimitive();
- }
-}
-
-/*************************************************************************
-|*
-|* Primitiv beenden
-|*
-\************************************************************************/
-
-void Base3D::EndPrimitive()
-{
- if(eObjectMode > Base3DPolygon)
- {
- switch(eObjectMode)
- {
- case Base3DComplexPolygon :
- case Base3DComplexPolygonCut :
- {
- // Selbst fuer Darstellung sorgen
- aComplexPolygon.EndPrimitive(this);
- break;
- }
- default:
- break; // -Wall multiple values not handled.
- }
- }
- else
- {
- ImplEndPrimitive();
- }
-}
-
-/*************************************************************************
-|*
-|* Ein Objekt in Form einer B3dGeometry direkt ausgeben
-|*
-\************************************************************************/
-
-void Base3D::DrawPolygonGeometry(const B3dGeometry& rGeometry, sal_Bool bOutline)
-{
- // Buckets der Geometrie holen
- const B3dEntityBucket& rEntityBucket = rGeometry.GetEntityBucket();
- const GeometryIndexValueBucket& rIndexBucket = rGeometry.GetIndexBucket();
-
- UINT32 nPolyCounter = 0;
- UINT32 nEntityCounter = 0;
- UINT32 nUpperBound;
-
- while(nPolyCounter < rIndexBucket.Count())
- {
- // Naechstes Primitiv
- nUpperBound = rIndexBucket[nPolyCounter].GetIndex();
-
- if(bOutline)
- {
- // Polygon als Outline ausgeben
- SetRenderMode(Base3DRenderLine);
- SetPolygonOffset(Base3DPolygonOffsetLine, TRUE);
-
- // ALLE Linien Zeichnen
- SetCullMode(Base3DCullNone);
- }
- else
- {
- // Polygone gefuellt ausgeben
- SetRenderMode(Base3DRenderFill);
- SetPolygonOffset(Base3DPolygonOffsetLine, FALSE);
- }
-
- if(rIndexBucket[nPolyCounter++].GetMode() == B3D_INDEX_MODE_LINE)
- {
- eObjectMode = Base3DLineStrip;
- }
- else
- {
- eObjectMode = Base3DPolygon;
- }
-
- // Neues Polygon beginnen
- ImplStartPrimitive();
-
- // Polygon ausgeben
- while(nEntityCounter < nUpperBound)
- {
- B3dEntity& rEntity = ImplGetFreeEntity();
- rEntity = rEntityBucket[nEntityCounter++];
- if(bOutline)
- {
- rEntity.SetNormalUsed(FALSE);
- rEntity.SetTexCoorUsed(FALSE);
- SetEdgeFlag(rEntity.IsEdgeVisible());
- }
- ImplPostAddVertex(rEntity);
- }
-
- // Primitiv abschliessen
- ImplEndPrimitive();
- }
-}
-
-/*************************************************************************
-|*
-|* Direkter Zugriff auf B3dMaterial fuer abgeleitete Klassen
-|*
-\************************************************************************/
-
-B3dMaterial& Base3D::GetMaterialObject(Base3DMaterialMode eMode)
-{
- if(eMode == Base3DMaterialFront)
- return aMaterialFront;
- return aMaterialBack;
-}
-
-/*************************************************************************
-|*
-|* geometrische Daten uebernehmen
-|*
-\************************************************************************/
-
-void Base3D::AddVertex(basegfx::B3DPoint& rVertex)
-{
- // Platz fuer neue Daten holen
- B3dEntity& rEntity = GetFreeEntity();
- rEntity.Reset();
-
- // geometrische Daten
- rEntity.Point() = rVertex;
- rEntity.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rEntity.SetValid();
-
- // Nachbehandlung
- PostAddVertex(rEntity);
-}
-
-void Base3D::AddVertex(basegfx::B3DPoint& rVertex, basegfx::B3DVector& rNormal)
-{
- // Platz fuer neue Daten holen
- B3dEntity& rEntity = GetFreeEntity();
- rEntity.Reset();
-
- // geometrische Daten
- rEntity.Point() = rVertex;
- rEntity.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rEntity.SetValid();
-
- // Normale
- if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
- {
- rEntity.Normal() = rNormal;
- rEntity.SetNormalUsed();
- }
-
- // Nachbehandlung
- PostAddVertex(rEntity);
-}
-
-void Base3D::AddVertex(basegfx::B3DPoint& rVertex, basegfx::B3DVector& rNormal, basegfx::B2DPoint& rTexPos)
-{
- // Platz fuer neue Daten holen
- B3dEntity& rEntity = GetFreeEntity();
- rEntity.Reset();
-
- // geometrische Daten
- rEntity.Point() = rVertex;
- rEntity.PlaneNormal() = basegfx::B3DVector(); // #i68442# Init PlaneNormal
- rEntity.SetValid();
-
- // Normale
- if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
- {
- rEntity.Normal() = rNormal;
- rEntity.SetNormalUsed();
- }
-
- // Texturdaten
- rEntity.TexCoor() = rTexPos;
- rEntity.SetTexCoorUsed();
-
- // Nachbehandlung
- PostAddVertex(rEntity);
-}
-
-void Base3D::AddVertex(B3dEntity& rEnt)
-{
- // Platz fuer neue Daten holen
- B3dEntity& rEntity = GetFreeEntity();
-
- // Kopieren
- rEntity = rEnt;
-
- // Nachbehandlung
- PostAddVertex(rEntity);
-}
-
-void Base3D::PostAddVertex(B3dEntity& rEntity)
-{
- // Flag fuer die Sichtbarkeit von Kanten kopieren
- rEntity.SetEdgeVisible(GetEdgeFlag());
-
- // aktuelle Farbe eintragen
- rEntity.Color().SetColor(GetColor().GetColor());
-
- if(eObjectMode > Base3DPolygon)
- {
- switch(eObjectMode)
- {
- case Base3DComplexPolygon :
- case Base3DComplexPolygonCut :
- {
- // Punkt ist nun ausgefuellt
- aComplexPolygon.PostAddVertex(rEntity);
- break;
- }
- default:
- break; // -Wall multiple values not handled.
- }
- }
- else
- {
- ImplPostAddVertex(rEntity);
- }
-}
-
-/*************************************************************************
-|*
-|* Platz fuer neuen Punkt anfordern
-|*
-\************************************************************************/
-
-B3dEntity& Base3D::GetFreeEntity()
-{
- if(eObjectMode > Base3DPolygon)
- {
- switch(eObjectMode)
- {
- case Base3DComplexPolygon :
- case Base3DComplexPolygonCut :
- {
- // Im eigenen Buffer anlegen
- return aComplexPolygon.GetFreeEntity();
- }
- default:
- break;
- }
- }
- return ImplGetFreeEntity();
-}
-
-/*************************************************************************
-|*
-|* Farbe setzen
-|*
-\************************************************************************/
-
-void Base3D::SetColor(Color aNew)
-{
- // Farbe setzen
- if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
- {
- // Graustufen
- UINT8 nLuminance = aNew.GetLuminance();
- aCurrentColor = Color(nLuminance, nLuminance, nLuminance);
- }
- else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
- {
- // Keine Ausgabe, hier Schwarz als Farbe setzen, wird
- // als Linienfarbe benutzt
- aCurrentColor = Color(COL_BLACK);
- }
- else
- {
- // Normale Farbausgabe
- aCurrentColor = aNew;
- }
-}
-
-/*************************************************************************
-|*
-|* Farbe liefern
-|*
-\************************************************************************/
-
-Color Base3D::GetColor()
-{
- return aCurrentColor;
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften setzen
-|*
-\************************************************************************/
-
-void Base3D::SetMaterial(Color aNew,
- Base3DMaterialValue eVal,
- Base3DMaterialMode eMode)
-{
- Color aSource;
- if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
- {
- // Graustufen
- UINT8 nLuminance = aNew.GetLuminance();
- aSource.SetRed(nLuminance);
- aSource.SetGreen(nLuminance);
- aSource.SetBlue(nLuminance);
- aSource.SetTransparency(aNew.GetTransparency());
- }
- else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
- {
- // Keine Ausgabe, hier Weiss als Farbe setzen
- aSource = Color(COL_WHITE);
- }
- else
- {
- // Normale Farbausgabe
- aSource = aNew;
- }
-
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialFront)
- {
- aMaterialFront.SetMaterial(aSource, eVal);
- }
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialBack)
- {
- aMaterialBack.SetMaterial(aSource, eVal);
- }
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften abfragen
-|*
-\************************************************************************/
-
-Color Base3D::GetMaterial(Base3DMaterialValue eVal,
- Base3DMaterialMode eMode) const
-{
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialFront)
- {
- return aMaterialFront.GetMaterial(eVal);
- }
- return aMaterialBack.GetMaterial(eVal);
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften setzen, exponent der specular-Eigenschaft
-|*
-\************************************************************************/
-
-void Base3D::SetShininess(UINT16 nExponent,
- Base3DMaterialMode eMode)
-{
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialFront)
- {
- aMaterialFront.SetShininess(nExponent);
- }
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialBack)
- {
- aMaterialBack.SetShininess(nExponent);
- }
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften abfragen, exponent der specular-Eigenschaft
-|*
-\************************************************************************/
-
-UINT16 Base3D::GetShininess(Base3DMaterialMode eMode) const
-{
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialFront)
- {
- return aMaterialFront.GetShininess();
- }
- return aMaterialBack.GetShininess();
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften auf Ausgangszustand
-|*
-\************************************************************************/
-
-void Base3D::ResetMaterial(Base3DMaterialMode eMode)
-{
- Color aColor(255, 51, 51, 51);
- SetMaterial(aColor, Base3DMaterialAmbient, eMode);
- aColor.SetColor(TRGB_COLORDATA(255, 204, 204, 204));
- SetMaterial(aColor, Base3DMaterialDiffuse, eMode);
- aColor.SetColor(TRGB_COLORDATA(255, 0, 0, 0));
- SetMaterial(aColor, Base3DMaterialSpecular, eMode);
- aColor.SetColor(TRGB_COLORDATA(255, 0, 0, 0));
- SetMaterial(aColor, Base3DMaterialEmission, eMode);
- SetShininess(0, eMode);
-}
-
-/*************************************************************************
-|*
-|* GlobalData holen
-|*
-\************************************************************************/
-
-B3dGlobalData& Base3D::GetGlobalData()
-{
- B3dGlobalData** ppGlobalData = (B3dGlobalData**)GetAppData(SHL_BASE3D);
- if(*ppGlobalData)
- return **ppGlobalData;
-
- // GlobalData anlegen
- *ppGlobalData = new B3dGlobalData;
- return **ppGlobalData;
-}
-
-/*************************************************************************
-|*
-|* Textur mit den angegebenen Attributen als Grundlage anfordern.
-|*
-\************************************************************************/
-
-B3dTexture* Base3D::ObtainTexture(TextureAttributes& rAtt)
-{
- return GetGlobalData().ObtainTexture(rAtt);
-}
-
-/*************************************************************************
-|*
-|* Textur mit den angegebenen Attributen als Grundlage anfordern. Falls
-|* eine solche Textur nicht existiert, erzeuge eine und gib diese zurueck
-|*
-\************************************************************************/
-
-B3dTexture* Base3D::ObtainTexture(TextureAttributes& rAtt, BitmapEx& rBitmapEx)
-{
- B3dTexture* pRetval = GetGlobalData().ObtainTexture(rAtt);
- if(!pRetval)
- {
- pRetval = CreateTexture(rAtt, rBitmapEx);
- GetGlobalData().InsertTexture(pRetval);
- }
- return pRetval;
-}
-
-/*************************************************************************
-|*
-|* Gezielt eine Textur freigeben
-|*
-\************************************************************************/
-
-void Base3D::DeleteTexture(TextureAttributes& rAtt)
-{
- B3dTexture* pTexture = GetGlobalData().ObtainTexture(rAtt);
- if(pTexture)
- {
- if(pTexture == pActiveTexture)
- pActiveTexture = NULL;
-
- GetGlobalData().DeleteTexture(pTexture);
- }
-}
-
-/*************************************************************************
-|*
-|* Alle Texturen freigeben
-|*
-\************************************************************************/
-
-void Base3D::DeleteAllTextures()
-{
- pActiveTexture = NULL;
- GetGlobalData().DeleteAllTextures();
-}
-
-/*************************************************************************
-|*
-|* Ein Textur-Objekt inkarnieren
-|*
-\************************************************************************/
-
-B3dTexture* Base3D::CreateTexture(TextureAttributes& rAtt, BitmapEx& rBitmapEx)
-{
- B3dTexture* pRetval = new B3dTexture(rAtt, rBitmapEx);
- DBG_ASSERT(pRetval,"AW: Kein Speicher fuer Textur bekommen!");
- return pRetval;
-}
-
-/*************************************************************************
-|*
-|* Normale Textur loeschen
-|*
-\************************************************************************/
-
-void Base3D::DestroyTexture(B3dTexture* pTex)
-{
- delete pTex;
-}
-
-/*************************************************************************
-|*
-|* Aktuell zu benutzende Textur setzen
-|*
-\************************************************************************/
-
-void Base3D::SetActiveTexture(B3dTexture* pTex)
-{
- if(pTex)
- {
- if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
- {
- // Graustufen
- pTex->SetTextureKind(Base3DTextureIntensity);
- }
- else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
- {
- // Keine Ausgabe, keine Textur setzen
- pTex = NULL;
- }
- }
-
- // ... und setzen
- pActiveTexture = pTex;
-}
-
-/*************************************************************************
-|*
-|* Darstellungsqualitaet setzen
-|*
-\************************************************************************/
-
-void Base3D::SetDisplayQuality(UINT8 nNew)
-{
- nDisplayQuality = nNew;
-}
-
-/*************************************************************************
-|*
-|* Darstellungsqualitaet lesen
-|*
-\************************************************************************/
-
-UINT8 Base3D::GetDisplayQuality() const
-{
- return nDisplayQuality;
-}
-
-/*************************************************************************
-|*
-|* PolygonOffset setzen
-|*
-\************************************************************************/
-
-void Base3D::SetPolygonOffset(Base3DPolygonOffset eNew, BOOL bNew)
-{
- switch(eNew)
- {
- case Base3DPolygonOffsetFill :
- bPolyOffsetFill = bNew;
- break;
-
- case Base3DPolygonOffsetLine :
- bPolyOffsetLine = bNew;
- break;
-
- case Base3DPolygonOffsetPoint :
- bPolyOffsetPoint = bNew;
- break;
- }
-}
-
-/*************************************************************************
-|*
-|* PolygonOffset lesen
-|*
-\************************************************************************/
-
-BOOL Base3D::GetPolygonOffset(Base3DPolygonOffset eNew) const
-{
- if(eNew == Base3DPolygonOffsetLine)
- return bPolyOffsetLine;
- if(eNew == Base3DPolygonOffsetFill)
- return bPolyOffsetFill;
- return bPolyOffsetPoint;
-}
-
-/*************************************************************************
-|*
-|* EdgeFlag lesen
-|*
-\************************************************************************/
-
-BOOL Base3D::GetEdgeFlag() const
-{
- return bEdgeFlag;
-}
-
-/*************************************************************************
-|*
-|* EdgeFlag schreiben
-|*
-\************************************************************************/
-
-void Base3D::SetEdgeFlag(BOOL bNew)
-{
- bEdgeFlag = bNew;
-}
-
-/*************************************************************************
-|*
-|* PointSize lesen
-|*
-\************************************************************************/
-
-double Base3D::GetPointSize() const
-{
- return fPointSize;
-}
-
-/*************************************************************************
-|*
-|* PointSize schreiben
-|*
-\************************************************************************/
-
-void Base3D::SetPointSize(double fNew)
-{
- fPointSize = fNew;
-}
-
-/*************************************************************************
-|*
-|* LineWidth lesen
-|*
-\************************************************************************/
-
-double Base3D::GetLineWidth() const
-{
- return fLineWidth;
-}
-
-/*************************************************************************
-|*
-|* LineWidth schreiben
-|*
-\************************************************************************/
-
-void Base3D::SetLineWidth(double fNew)
-{
- fLineWidth = fNew;
-}
-
-// #i71618#
-void Base3D::setPolygonOffset(double fNew)
-{
- if(fNew != mfPolygonOffset)
- {
- mfPolygonOffset = fNew;
- }
-}
-
-double Base3D::getPolygonOffset() const
-{
- return mfPolygonOffset;
-}
-
-/*************************************************************************
-|*
-|* RenderMode setzen
-|*
-\************************************************************************/
-
-void Base3D::SetRenderMode(Base3DRenderMode eNew,
- Base3DMaterialMode eMode)
-{
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialFront)
- {
- eRenderModeFront = eNew;
- }
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialBack)
- {
- eRenderModeBack = eNew;
- }
-}
-
-/*************************************************************************
-|*
-|* RenderMode lieferen
-|*
-\************************************************************************/
-
-Base3DRenderMode Base3D::GetRenderMode(Base3DMaterialMode eMode) const
-{
- if(eMode == Base3DMaterialFrontAndBack
- || eMode == Base3DMaterialFront)
- {
- return eRenderModeFront;
- }
- return eRenderModeBack;
-}
-
-/*************************************************************************
-|*
-|* ShadeModel setzen
-|*
-\************************************************************************/
-
-void Base3D::SetShadeModel(Base3DShadeModel eNew)
-{
- eShadeModel = eNew;
-}
-
-/*************************************************************************
-|*
-|* ShadeModel lieferen
-|*
-\************************************************************************/
-
-Base3DShadeModel Base3D::GetShadeModel() const
-{
- return eShadeModel;
-}
-
-/*************************************************************************
-|*
-|* CullingMode setzen
-|*
-\************************************************************************/
-
-void Base3D::SetCullMode(Base3DCullMode eNew)
-{
- eCullMode = eNew;
-}
-
-/*************************************************************************
-|*
-|* CullingMode liefern
-|*
-\************************************************************************/
-
-Base3DCullMode Base3D::GetCullMode() const
-{
- return eCullMode;
-}
-
-/*************************************************************************
-|*
-|* Texturenverwaltung
-|*
-\************************************************************************/
-
-SV_IMPL_PTRARR(B3dTextureStore, B3dTexture*);
-
-// eof
diff --git a/goodies/source/base3d/makefile.mk b/goodies/source/base3d/makefile.mk
index 0a162fc112cb..0203f7e1d3d4 100644
--- a/goodies/source/base3d/makefile.mk
+++ b/goodies/source/base3d/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.6 $
+# $Revision: 1.6.42.1 $
#
# This file is part of OpenOffice.org.
#
@@ -40,23 +40,8 @@ AUTOSEG=true
.INCLUDE : settings.mk
# --- Files --------------------------------------------------------
-EXCEPTIONSFILES=\
- $(SLO)$/b3dgeom.obj
-
-SLOFILES= \
- $(SLO)$/base3d.obj \
- $(SLO)$/b3dtrans.obj \
- $(SLO)$/b3ddeflt.obj \
- $(SLO)$/b3dopngl.obj \
- $(SLO)$/b3dcommn.obj \
- $(SLO)$/matril3d.obj \
- $(SLO)$/b3dcolor.obj \
- $(SLO)$/b3dlight.obj \
- $(SLO)$/b3dentty.obj \
- $(SLO)$/b3dcompo.obj \
- $(SLO)$/b3dtex.obj \
- $(SLO)$/b3dgeom.obj
+SLOFILES = $(SLO)$/b3dtrans.obj
.INCLUDE : target.mk
diff --git a/goodies/source/base3d/matril3d.cxx b/goodies/source/base3d/matril3d.cxx
deleted file mode 100644
index 083889f48a29..000000000000
--- a/goodies/source/base3d/matril3d.cxx
+++ /dev/null
@@ -1,139 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: matril3d.cxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_goodies.hxx"
-#include <goodies/matril3d.hxx>
-#include <tools/debug.hxx>
-
-/*************************************************************************
-|*
-|* Konstruktor B3dMaterial
-|*
-\************************************************************************/
-
-B3dMaterial::B3dMaterial()
-: aAmbient(COL_BLACK), // kein lokales Umgebungslicht
- aDiffuse(0x00, 0xb8, 0xff), // Blau7
- aSpecular(COL_WHITE), // Weisser Glanzpunkt
- aEmission(COL_BLACK), // Keine Selbstleuchtfarbe
- nExponent(15) // Glanzpunktbuendelung
-{
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaft setzen
-|*
-\************************************************************************/
-
-void B3dMaterial::SetMaterial(Color rNew, Base3DMaterialValue eVal)
-{
- switch(eVal)
- {
- case Base3DMaterialAmbient:
- aAmbient = rNew;
- break;
- case Base3DMaterialDiffuse:
- aDiffuse = rNew;
- break;
- case Base3DMaterialSpecular:
- aSpecular = rNew;
- break;
- case Base3DMaterialEmission:
- aEmission = rNew;
- break;
- }
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaft abfragen
-|*
-\************************************************************************/
-
-Color B3dMaterial::GetMaterial(Base3DMaterialValue eVal) const
-{
- if(eVal == Base3DMaterialAmbient)
- return aAmbient;
- if(eVal == Base3DMaterialDiffuse)
- return aDiffuse;
- if(eVal == Base3DMaterialEmission)
- return aEmission;
- return aSpecular;
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften setzen, exponent der specular-Eigenschaft
-|*
-\************************************************************************/
-
-void B3dMaterial::SetShininess(UINT16 nNew)
-{
- nExponent = nNew;
-}
-
-/*************************************************************************
-|*
-|* Materialeigenschaften abfragen, exponent der specular-Eigenschaft
-|*
-\************************************************************************/
-
-UINT16 B3dMaterial::GetShininess() const
-{
- return nExponent;
-}
-
-/*************************************************************************
-|*
-|* Vergleichsoperator
-|*
-\************************************************************************/
-
-BOOL B3dMaterial::operator==(const B3dMaterial& rMat)
-{
- if(aAmbient == rMat.aAmbient
- && aDiffuse == rMat.aDiffuse
- && aSpecular == rMat.aSpecular
- && aEmission == rMat.aEmission
- && nExponent == rMat.nExponent)
- return TRUE;
- return FALSE;
-}
-
-/*************************************************************************
-|*
-|* Bucket fuer geometrische Daten
-|*
-\************************************************************************/
-
-BASE3D_IMPL_BUCKET(B3dMaterial, Bucket)
-
diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h
index 61d2c5f40db3..703c3339ba37 100644
--- a/vcl/aqua/inc/salinst.h
+++ b/vcl/aqua/inc/salinst.h
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salinst.h,v $
- * $Revision: 1.20 $
+ * $Revision: 1.20.30.1 $
*
* This file is part of OpenOffice.org.
*
@@ -129,7 +129,6 @@ public:
virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo );
virtual String GetDefaultPrinter();
virtual SalTimer* CreateSalTimer();
- virtual SalOpenGL* CreateSalOpenGL( SalGraphics* pGraphics );
virtual SalI18NImeStatus* CreateI18NImeStatus();
virtual SalSystem* CreateSalSystem();
virtual SalBitmap* CreateSalBitmap();
diff --git a/vcl/aqua/inc/salogl.h b/vcl/aqua/inc/salogl.h
index 7e2d49165462..e69de29bb2d1 100644
--- a/vcl/aqua/inc/salogl.h
+++ b/vcl/aqua/inc/salogl.h
@@ -1,94 +0,0 @@
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: salogl.h,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#ifndef _SV_SALOGL_H
-#define _SV_SALOGL_H
-
-#include "vcl/salogl.hxx"
-#include "osl/module.h"
-
-// -------------
-// - SalOpenGL -
-// -------------
-
-class SalGraphics;
-
-class AquaSalOpenGL : public SalOpenGL
-{
-private:
- static ULONG mnOGLState;
-
- // static oslModule mpGLLib;
-// static GLXContext maGLXContext;
-// static ULONG mnOGLState;
-// static Display* mpDisplay;
-// static XVisualInfo* mpVisualInfo;
-// static BOOL mbHaveGLVisual;
-//
-// static BOOL ImplInit();
-//
-// static GLXContext (*pCreateContext)( Display *, XVisualInfo *, GLXContext, Bool );
-// static void (*pDestroyContext)( Display *, GLXContext );
-// static GLXContext (*pGetCurrentContext)( );
-// static Bool (*pMakeCurrent)( Display *, GLXDrawable, GLXContext );
-// static void (*pSwapBuffers)( Display*, GLXDrawable );
-// static int (*pGetConfig)( Display*, XVisualInfo*, int, int* );
-// static void (*pFlush)();
-//
-// Drawable maDrawable;
-//
-// static void* resolveSymbol( const char* pSym );
-public:
-
- AquaSalOpenGL( SalGraphics* pGraphics );
- ~AquaSalOpenGL();
-
-// static void Release();
-// static void ReleaseLib();
-// static void MakeVisualWeights(
-// Display *pDisplay,
-// XVisualInfo* pInfos,
-// int* pWeights,
-// int nVisuals
-// );
-
- // overload all pure virtual methods
- virtual bool IsValid();
- virtual oglFunction GetOGLFnc( const char * );
- virtual void OGLEntry( SalGraphics* pGraphics );
- virtual void OGLExit( SalGraphics* pGraphics );
- virtual void StartScene( SalGraphics* pGraphics );
- virtual void StopScene();
- virtual BOOL Create();
- virtual void Release();
-
-};
-
-#endif // _SV_SALOGL_H
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index d1a8b27369fe..2ab60067bd6f 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salinst.cxx,v $
- * $Revision: 1.54 $
+ * $Revision: 1.54.28.1 $
*
* This file is part of OpenOffice.org.
*
@@ -52,7 +52,6 @@
#include "salvd.h"
#include "salbmp.h"
#include "salprn.h"
-#include "salogl.h"
#include "saltimer.h"
#include "vclnsapp.h"
@@ -944,13 +943,6 @@ SalTimer* AquaSalInstance::CreateSalTimer()
// -----------------------------------------------------------------------
-SalOpenGL* AquaSalInstance::CreateSalOpenGL( SalGraphics* pGraphics )
-{
- return new AquaSalOpenGL( pGraphics );
-}
-
-// -----------------------------------------------------------------------
-
SalSystem* AquaSalInstance::CreateSalSystem()
{
return new AquaSalSystem();
diff --git a/vcl/aqua/source/gdi/makefile.mk b/vcl/aqua/source/gdi/makefile.mk
index cab8fd6247c6..deb6832a5525 100644
--- a/vcl/aqua/source/gdi/makefile.mk
+++ b/vcl/aqua/source/gdi/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.15 $
+# $Revision: 1.15.154.1 $
#
# This file is part of OpenOffice.org.
#
@@ -62,8 +62,7 @@ SLOFILES= $(SLO)$/salmathutils.obj \
$(SLO)$/salvd.obj \
$(SLO)$/salprn.obj \
$(SLO)$/aquaprintview.obj \
- $(SLO)$/salbmp.obj \
- $(SLO)$/salogl.obj
+ $(SLO)$/salbmp.obj
.IF "$(ENABLE_CAIRO)" == "TRUE"
CDEFS+= -DCAIRO
diff --git a/vcl/aqua/source/gdi/salogl.cxx b/vcl/aqua/source/gdi/salogl.cxx
index 2ae1dbfa93fb..e69de29bb2d1 100644
--- a/vcl/aqua/source/gdi/salogl.cxx
+++ b/vcl/aqua/source/gdi/salogl.cxx
@@ -1,109 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: salogl.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_vcl.hxx"
-
-#include "vcl/salgdi.hxx"
-#include "salgdi.h"
-#include "vcl/salogl.hxx"
-#include "salogl.h"
-
-
-// ========================================================================
-
-// Initialize static data members
-ULONG AquaSalOpenGL::mnOGLState = OGL_STATE_UNLOADED;
-
-// ========================================================================
-
-AquaSalOpenGL::AquaSalOpenGL( SalGraphics* pGraphics )
-{
-}
-
-// ------------------------------------------------------------------------
-
-AquaSalOpenGL::~AquaSalOpenGL()
-{
-}
-
-// ------------------------------------------------------------------------
-
-BOOL AquaSalOpenGL::Create()
-{
- return FALSE;
-}
-
-// ------------------------------------------------------------------------
-
-void AquaSalOpenGL::Release()
-{
-}
-
-// ------------------------------------------------------------------------
-
-oglFunction AquaSalOpenGL::GetOGLFnc( const char* pFncName )
-{
- return NULL;
-}
-
-// ------------------------------------------------------------------------
-
-void AquaSalOpenGL::OGLEntry( SalGraphics* pGraphics )
-{
-}
-
-// ------------------------------------------------------------------------
-
-void AquaSalOpenGL::OGLExit( SalGraphics* pGraphics )
-{
-}
-
-
-
-
-
-
-
-
-void AquaSalOpenGL::StartScene( SalGraphics* pGraphics )
-{
-
-}
-
-bool AquaSalOpenGL::IsValid()
-{
- return FALSE;
-}
-
-void AquaSalOpenGL::StopScene()
-{
-
-}
diff --git a/vcl/inc/vcl/opengl.hxx b/vcl/inc/vcl/opengl.hxx
index 7d106bc8a1c8..e69de29bb2d1 100644
--- a/vcl/inc/vcl/opengl.hxx
+++ b/vcl/inc/vcl/opengl.hxx
@@ -1,159 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: opengl.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SV_OPENGL_HXX
-#define _SV_OPENGL_HXX
-
-#include <tools/gen.hxx>
-#include <vcl/salotype.hxx>
-#include <vcl/dllapi.h>
-
-// ----------
-// - OpenGL -
-// ----------
-
-class OutputDevice;
-class SalOpenGL;
-class RmOpenGL;
-
-class VCL_DLLPUBLIC OpenGL
-{
- static BOOL mbNoOGL;
-
-private:
- OutputDevice* mpOutDev;
- SalOpenGL* mpOGL;
-
- SAL_DLLPRIVATE void ImplInit();
- SAL_DLLPRIVATE BOOL ImplInitFncPointers();
-
-public:
- OpenGL( OutputDevice* pOutDev );
- ~OpenGL();
-
- BOOL IsValid() const { return( mpOGL != NULL ); }
- static void Invalidate( BOOL bInvalid = TRUE ) { mbNoOGL = bInvalid; }
-
- void SetConnectOutputDevice( OutputDevice* pOutDev );
- OutputDevice* GetConnectOutputDevice() const { return mpOutDev; }
-
- void ClearDepth( GLclampd fDepth );
- void DepthFunc( GLenum eFunc );
- void Enable( GLenum eCap );
- void Disable( GLenum eCap );
- void DepthMask( GLboolean bFlag );
- void ShadeModel( GLenum eMode );
- void EdgeFlag( GLboolean bFlag );
- void Clear( GLbitfield nMask );
- void Flush();
- void Finish();
- void Viewport( GLint nX, GLint nY, GLsizei nWidth, GLsizei nHeight );
- void Begin( GLenum eMode );
- void End();
- void Vertex3dv( const GLdouble *fVar );
- void Normal3dv( const GLdouble *fVar );
- void TexCoord3dv( const GLdouble *fVar );
- void Color4ub( GLubyte cRed, GLubyte cGreen, GLubyte cBlue, GLubyte cAlpha );
- void Materialfv( GLenum eFace, GLenum ePName, const GLfloat *fParams );
- void Materialf( GLenum eFace, GLenum ePName, GLfloat fParam );
- void LightModelfv( GLenum ePName, const GLfloat *fParams );
- void LightModelf( GLenum ePName, GLfloat fParam );
- void Lightfv( GLenum eLight, GLenum ePName, const GLfloat *fParams );
- void Lightf( GLenum eLight, GLenum ePName, GLfloat fParam );
- void PolygonMode( GLenum eFace, GLenum eMode );
- void CullFace( GLenum eMode );
- void PointSize( GLfloat fSize );
- void LineWidth( GLfloat fWidth );
- void MatrixMode( GLenum eMode );
- void LoadMatrixd( const GLdouble *fM );
- void TexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
- void TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
- void CopyTexImage1D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border );
- void CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
- void CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
- void CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
- void PixelTransferf( GLenum pname, GLfloat param );
- void PixelTransferi( GLenum pname, GLint param );
- void GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params );
- void GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params );
- void GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params );
- void GetTexParameteriv( GLenum target, GLenum pname, GLint *params );
- void TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels );
- void TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels );
- void PixelStoref( GLenum pname, GLfloat param );
- void PixelStorei( GLenum pname, GLint param );
- void GenTextures( GLsizei n, GLuint *textures );
- GLboolean IsTexture( GLuint texture );
- void BindTexture( GLenum target, GLuint texture );
- void DeleteTextures( GLsizei n, const GLuint *textures );
- GLboolean AreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences );
- void PrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities );
- void TexEnvf( GLenum target, GLenum pname, GLfloat param );
- void TexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
- void TexEnvi( GLenum target, GLenum pname, GLint param );
- void TexEnviv( GLenum target, GLenum pname, const GLint *params );
- void TexParameterf( GLenum target, GLenum pname, GLfloat param );
- void TexParameterfv( GLenum target, GLenum pname, const GLfloat *params );
- void TexParameteri( GLenum target, GLenum pname, GLint param );
- void TexParameteriv( GLenum target, GLenum pname, const GLint *params );
- void TexGend( GLenum coord, GLenum pname, GLdouble param );
- void TexGendv( GLenum coord, GLenum pname, const GLdouble *params );
- void TexGenf( GLenum coord, GLenum pname, GLfloat param );
- void TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
- void TexGeni( GLenum coord, GLenum pname, GLint param );
- void TexGeniv( GLenum coord, GLenum pname, const GLint *params );
- void TexCoord2dv( const GLdouble *pParams );
- void GetIntegerv( GLenum pname, GLint *params );
- void PolygonOffset( GLfloat factor, GLfloat units );
- void Scissor( GLint x, GLint y, GLsizei width, GLsizei height );
-
- void EnableClientState( GLenum array );
- void DisableClientState( GLenum array );
- void VertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
- void ColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
- void IndexPointer( GLenum type, GLsizei stride, const GLvoid *pointer );
- void NormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer );
- void TexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
- void EdgeFlagPointer( GLsizei stride, const GLvoid *pointer );
- void ArrayElement( GLint i );
- void DrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices );
- void DrawArrays( GLenum mode, GLint first, GLsizei count );
- void InterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer );
-
- void LoadIdentity();
- void BlendFunc( GLenum sfactor, GLenum dfactor );
-
-private:
- OpenGL();
- OpenGL( const OpenGL& );
- OpenGL& operator=( const OpenGL& );
-};
-
-#endif // _SV_OPENGL_HXX
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 6d8f9f70492d..7c33e21204c6 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: outdev.hxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.28.1 $
*
* This file is part of OpenOffice.org.
*
@@ -69,8 +69,6 @@ class TextRectInfo;
class FontInfo;
class FontMetric;
class GDIMetaFile;
-class OutDev3D;
-class OpenGL;
class List;
class GfxLink;
class Line;
@@ -304,7 +302,6 @@ class VCL_DLLPUBLIC OutputDevice : public Resource
friend class Bitmap;
friend class ImplImageBmp;
friend class ImplQPrinter;
- friend class OpenGL;
friend class Printer;
friend class SalGraphicsLayout;
friend class System;
@@ -328,7 +325,6 @@ private:
ImplObjStack* mpObjStack;
ImplOutDevData* mpOutDevData;
List* mpUnoGraphicsList;
- OutDev3D* mp3DContext;
vcl::PDFWriterImpl* mpPDFWriter;
vcl::ExtOutDevData* mpExtOutDevData;
@@ -575,10 +571,6 @@ public:
*/
bool supportsOperation( OutDevSupportType ) const;
- void Set3DContext( OutDev3D* p3DContext ) { mp3DContext = p3DContext; }
-
- OutDev3D* Get3DContext() const { return mp3DContext; }
- OpenGL* GetOpenGL();
vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; }
void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
diff --git a/vcl/inc/vcl/outdev3d.hxx b/vcl/inc/vcl/outdev3d.hxx
index b519449a9769..e69de29bb2d1 100644
--- a/vcl/inc/vcl/outdev3d.hxx
+++ b/vcl/inc/vcl/outdev3d.hxx
@@ -1,49 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: outdev3d.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SV_OUTDEV3D_HXX
-#define _SV_OUTDEV3D_HXX
-
-#include <vcl/sv.h>
-#include <vcl/dllapi.h>
-
-class OutputDevice;
-
-// ------------
-// - OutDev3D -
-// ------------
-
-class VCL_DLLPUBLIC OutDev3D
-{
-public:
- virtual void Destroy( OutputDevice* pOutDev ) = 0;
-};
-
-#endif // _SV_OUTDEV3D_HXX
diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx
index f00505e8edbd..cf88b7813ec8 100644
--- a/vcl/inc/vcl/salinst.hxx
+++ b/vcl/inc/vcl/salinst.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salinst.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.154.1 $
*
* This file is part of OpenOffice.org.
*
@@ -47,7 +47,6 @@ struct ImplJobSetup;
class SalGraphics;
class SalFrame;
class SalObject;
-class SalOpenGL;
class SalMenu;
class SalMenuItem;
class SalVirtualDevice;
@@ -124,8 +123,6 @@ public:
// SalTimer
virtual SalTimer* CreateSalTimer() = 0;
- // SalOpenGL
- virtual SalOpenGL* CreateSalOpenGL( SalGraphics* pGraphics ) = 0;
// SalI18NImeStatus
virtual SalI18NImeStatus* CreateI18NImeStatus() = 0;
// SalSystem
diff --git a/vcl/inc/vcl/salogl.hxx b/vcl/inc/vcl/salogl.hxx
index dbd791572bf6..e69de29bb2d1 100644
--- a/vcl/inc/vcl/salogl.hxx
+++ b/vcl/inc/vcl/salogl.hxx
@@ -1,83 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: salogl.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SV_SALOGL_HXX
-#define _SV_SALOGL_HXX
-
-#define _OPENGL_EXT
-
-#include <tools/gen.hxx>
-
-#define _SVUNX_H
-#include <vcl/sv.h>
-#include <vcl/dllapi.h>
-#include <vcl/salotype.hxx>
-
-// -----------------
-// - State defines -
-// -----------------
-
-#define OGL_STATE_UNLOADED (0x00000000)
-#define OGL_STATE_INVALID (0x00000001)
-#define OGL_STATE_VALID (0x00000002)
-
-#ifdef WNT
-#define __OPENGL_CALL __stdcall
-#else
-#define __OPENGL_CALL
-#endif
-
-extern "C"
-{
-typedef void( __OPENGL_CALL *oglFunction )(void);
-}
-
-// -------------
-// - SalOpenGL -
-// -------------
-
-class SalGraphics;
-
-class VCL_DLLPUBLIC SalOpenGL
-{
-public:
-
- SalOpenGL() {}
- virtual ~SalOpenGL();
-
- virtual bool IsValid() = 0;
- virtual oglFunction GetOGLFnc( const char * ) = 0;
- virtual void OGLEntry( SalGraphics* pGraphics ) = 0;
- virtual void OGLExit( SalGraphics* pGraphics ) = 0;
- virtual void StartScene( SalGraphics* pGraphics ) = 0;
- virtual void StopScene() = 0;
-};
-
-#endif
diff --git a/vcl/inc/vcl/salotype.hxx b/vcl/inc/vcl/salotype.hxx
index ac804a511bd8..e69de29bb2d1 100644
--- a/vcl/inc/vcl/salotype.hxx
+++ b/vcl/inc/vcl/salotype.hxx
@@ -1,1133 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: salotype.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SV_SALOTYPE_HXX
-#define _SV_SALOTYPE_HXX
-
-#include <vcl/sv.h>
-
-// ------------
-// - typedefs -
-// ------------
-
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef signed char GLbyte;
-typedef short GLshort;
-typedef int GLint;
-typedef int GLsizei;
-typedef unsigned char GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned int GLuint;
-typedef float GLfloat;
-typedef float GLclampf;
-typedef double GLdouble;
-typedef double GLclampd;
-typedef void GLvoid;
-
-// -----------
-// - Defines -
-// -----------
-
-/* Version */
-#define GL_VERSION_1_1 1
-
-/* AccumOp */
-#define GL_ACCUM 0x0100
-#define GL_LOAD 0x0101
-#define GL_RETURN 0x0102
-#define GL_MULT 0x0103
-#define GL_ADD 0x0104
-
-/* AlphaFunction */
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-
-/* AttribMask */
-#define GL_CURRENT_BIT 0x00000001
-#define GL_POINT_BIT 0x00000002
-#define GL_LINE_BIT 0x00000004
-#define GL_POLYGON_BIT 0x00000008
-#define GL_POLYGON_STIPPLE_BIT 0x00000010
-#define GL_PIXEL_MODE_BIT 0x00000020
-#define GL_LIGHTING_BIT 0x00000040
-#define GL_FOG_BIT 0x00000080
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_ACCUM_BUFFER_BIT 0x00000200
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_VIEWPORT_BIT 0x00000800
-#define GL_TRANSFORM_BIT 0x00001000
-#define GL_ENABLE_BIT 0x00002000
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_HINT_BIT 0x00008000
-#define GL_EVAL_BIT 0x00010000
-#define GL_LIST_BIT 0x00020000
-#define GL_TEXTURE_BIT 0x00040000
-#define GL_SCISSOR_BIT 0x00080000
-#define GL_ALL_ATTRIB_BITS 0x000fffff
-
-/* BeginMode */
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_QUADS 0x0007
-#define GL_QUAD_STRIP 0x0008
-#define GL_POLYGON 0x0009
-
-/* BlendingFactorDest */
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-
-/* BlendingFactorSrc */
-/* GL_ZERO */
-/* GL_ONE */
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-/* GL_SRC_ALPHA */
-/* GL_ONE_MINUS_SRC_ALPHA */
-/* GL_DST_ALPHA */
-/* GL_ONE_MINUS_DST_ALPHA */
-
-/* Boolean */
-#define GL_TRUE 1
-#define GL_FALSE 0
-
-/* ClearBufferMask */
-/* GL_COLOR_BUFFER_BIT */
-/* GL_ACCUM_BUFFER_BIT */
-/* GL_STENCIL_BUFFER_BIT */
-/* GL_DEPTH_BUFFER_BIT */
-
-/* ClientArrayType */
-/* GL_VERTEX_ARRAY */
-/* GL_NORMAL_ARRAY */
-/* GL_COLOR_ARRAY */
-/* GL_INDEX_ARRAY */
-/* GL_TEXTURE_COORD_ARRAY */
-/* GL_EDGE_FLAG_ARRAY */
-
-/* ClipPlaneName */
-#define GL_CLIP_PLANE0 0x3000
-#define GL_CLIP_PLANE1 0x3001
-#define GL_CLIP_PLANE2 0x3002
-#define GL_CLIP_PLANE3 0x3003
-#define GL_CLIP_PLANE4 0x3004
-#define GL_CLIP_PLANE5 0x3005
-
-/* ColorMaterialFace */
-/* GL_FRONT */
-/* GL_BACK */
-/* GL_FRONT_AND_BACK */
-
-/* ColorMaterialParameter */
-/* GL_AMBIENT */
-/* GL_DIFFUSE */
-/* GL_SPECULAR */
-/* GL_EMISSION */
-/* GL_AMBIENT_AND_DIFFUSE */
-
-/* ColorPointerType */
-/* GL_BYTE */
-/* GL_UNSIGNED_BYTE */
-/* GL_SHORT */
-/* GL_UNSIGNED_SHORT */
-/* GL_INT */
-/* GL_UNSIGNED_INT */
-/* GL_FLOAT */
-/* GL_DOUBLE */
-
-/* CullFaceMode */
-/* GL_FRONT */
-/* GL_BACK */
-/* GL_FRONT_AND_BACK */
-
-/* DataType */
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_2_BYTES 0x1407
-#define GL_3_BYTES 0x1408
-#define GL_4_BYTES 0x1409
-#define GL_DOUBLE 0x140A
-
-/* DepthFunction */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* DrawBufferMode */
-#define GL_NONE 0
-#define GL_FRONT_LEFT 0x0400
-#define GL_FRONT_RIGHT 0x0401
-#define GL_BACK_LEFT 0x0402
-#define GL_BACK_RIGHT 0x0403
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_LEFT 0x0406
-#define GL_RIGHT 0x0407
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_AUX0 0x0409
-#define GL_AUX1 0x040A
-#define GL_AUX2 0x040B
-#define GL_AUX3 0x040C
-
-/* Enable */
-/* GL_FOG */
-/* GL_LIGHTING */
-/* GL_TEXTURE_1D */
-/* GL_TEXTURE_2D */
-/* GL_LINE_STIPPLE */
-/* GL_POLYGON_STIPPLE */
-/* GL_CULL_FACE */
-/* GL_ALPHA_TEST */
-/* GL_BLEND */
-/* GL_INDEX_LOGIC_OP */
-/* GL_COLOR_LOGIC_OP */
-/* GL_DITHER */
-/* GL_STENCIL_TEST */
-/* GL_DEPTH_TEST */
-/* GL_CLIP_PLANE0 */
-/* GL_CLIP_PLANE1 */
-/* GL_CLIP_PLANE2 */
-/* GL_CLIP_PLANE3 */
-/* GL_CLIP_PLANE4 */
-/* GL_CLIP_PLANE5 */
-/* GL_LIGHT0 */
-/* GL_LIGHT1 */
-/* GL_LIGHT2 */
-/* GL_LIGHT3 */
-/* GL_LIGHT4 */
-/* GL_LIGHT5 */
-/* GL_LIGHT6 */
-/* GL_LIGHT7 */
-/* GL_TEXTURE_GEN_S */
-/* GL_TEXTURE_GEN_T */
-/* GL_TEXTURE_GEN_R */
-/* GL_TEXTURE_GEN_Q */
-/* GL_MAP1_VERTEX_3 */
-/* GL_MAP1_VERTEX_4 */
-/* GL_MAP1_COLOR_4 */
-/* GL_MAP1_INDEX */
-/* GL_MAP1_NORMAL */
-/* GL_MAP1_TEXTURE_COORD_1 */
-/* GL_MAP1_TEXTURE_COORD_2 */
-/* GL_MAP1_TEXTURE_COORD_3 */
-/* GL_MAP1_TEXTURE_COORD_4 */
-/* GL_MAP2_VERTEX_3 */
-/* GL_MAP2_VERTEX_4 */
-/* GL_MAP2_COLOR_4 */
-/* GL_MAP2_INDEX */
-/* GL_MAP2_NORMAL */
-/* GL_MAP2_TEXTURE_COORD_1 */
-/* GL_MAP2_TEXTURE_COORD_2 */
-/* GL_MAP2_TEXTURE_COORD_3 */
-/* GL_MAP2_TEXTURE_COORD_4 */
-/* GL_POINT_SMOOTH */
-/* GL_LINE_SMOOTH */
-/* GL_POLYGON_SMOOTH */
-/* GL_SCISSOR_TEST */
-/* GL_COLOR_MATERIAL */
-/* GL_NORMALIZE */
-/* GL_AUTO_NORMAL */
-/* GL_VERTEX_ARRAY */
-/* GL_NORMAL_ARRAY */
-/* GL_COLOR_ARRAY */
-/* GL_INDEX_ARRAY */
-/* GL_TEXTURE_COORD_ARRAY */
-/* GL_EDGE_FLAG_ARRAY */
-/* GL_POLYGON_OFFSET_POINT */
-/* GL_POLYGON_OFFSET_LINE */
-/* GL_POLYGON_OFFSET_FILL */
-
-/* ErrorCode */
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-
-/* FeedBackMode */
-#define GL_2D 0x0600
-#define GL_3D 0x0601
-#define GL_3D_COLOR 0x0602
-#define GL_3D_COLOR_TEXTURE 0x0603
-#define GL_4D_COLOR_TEXTURE 0x0604
-
-/* FeedBackToken */
-#define GL_PASS_THROUGH_TOKEN 0x0700
-#define GL_POINT_TOKEN 0x0701
-#define GL_LINE_TOKEN 0x0702
-#define GL_POLYGON_TOKEN 0x0703
-#define GL_BITMAP_TOKEN 0x0704
-#define GL_DRAW_PIXEL_TOKEN 0x0705
-#define GL_COPY_PIXEL_TOKEN 0x0706
-#define GL_LINE_RESET_TOKEN 0x0707
-
-/* FogMode */
-/* GL_LINEAR */
-#define GL_EXP 0x0800
-#define GL_EXP2 0x0801
-
-/* FogParameter */
-/* GL_FOG_COLOR */
-/* GL_FOG_DENSITY */
-/* GL_FOG_END */
-/* GL_FOG_INDEX */
-/* GL_FOG_MODE */
-/* GL_FOG_START */
-
-/* FrontFaceDirection */
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-
-/* GetMapTarget */
-#define GL_COEFF 0x0A00
-#define GL_ORDER 0x0A01
-#define GL_DOMAIN 0x0A02
-
-/* GetPixelMap */
-/* GL_PIXEL_MAP_I_TO_I */
-/* GL_PIXEL_MAP_S_TO_S */
-/* GL_PIXEL_MAP_I_TO_R */
-/* GL_PIXEL_MAP_I_TO_G */
-/* GL_PIXEL_MAP_I_TO_B */
-/* GL_PIXEL_MAP_I_TO_A */
-/* GL_PIXEL_MAP_R_TO_R */
-/* GL_PIXEL_MAP_G_TO_G */
-/* GL_PIXEL_MAP_B_TO_B */
-/* GL_PIXEL_MAP_A_TO_A */
-
-/* GetPointerTarget */
-/* GL_VERTEX_ARRAY_POINTER */
-/* GL_NORMAL_ARRAY_POINTER */
-/* GL_COLOR_ARRAY_POINTER */
-/* GL_INDEX_ARRAY_POINTER */
-/* GL_TEXTURE_COORD_ARRAY_POINTER */
-/* GL_EDGE_FLAG_ARRAY_POINTER */
-
-/* GetTarget */
-#define GL_CURRENT_COLOR 0x0B00
-#define GL_CURRENT_INDEX 0x0B01
-#define GL_CURRENT_NORMAL 0x0B02
-#define GL_CURRENT_TEXTURE_COORDS 0x0B03
-#define GL_CURRENT_RASTER_COLOR 0x0B04
-#define GL_CURRENT_RASTER_INDEX 0x0B05
-#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
-#define GL_CURRENT_RASTER_POSITION 0x0B07
-#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
-#define GL_CURRENT_RASTER_DISTANCE 0x0B09
-#define GL_POINT_SMOOTH 0x0B10
-#define GL_POINT_SIZE 0x0B11
-#define GL_POINT_SIZE_RANGE 0x0B12
-#define GL_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_LINE_SMOOTH 0x0B20
-#define GL_LINE_WIDTH 0x0B21
-#define GL_LINE_WIDTH_RANGE 0x0B22
-#define GL_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_LINE_STIPPLE 0x0B24
-#define GL_LINE_STIPPLE_PATTERN 0x0B25
-#define GL_LINE_STIPPLE_REPEAT 0x0B26
-#define GL_LIST_MODE 0x0B30
-#define GL_MAX_LIST_NESTING 0x0B31
-#define GL_LIST_BASE 0x0B32
-#define GL_LIST_INDEX 0x0B33
-#define GL_POLYGON_MODE 0x0B40
-#define GL_POLYGON_SMOOTH 0x0B41
-#define GL_POLYGON_STIPPLE 0x0B42
-#define GL_EDGE_FLAG 0x0B43
-#define GL_CULL_FACE 0x0B44
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_LIGHTING 0x0B50
-#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
-#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
-#define GL_LIGHT_MODEL_AMBIENT 0x0B53
-#define GL_SHADE_MODEL 0x0B54
-#define GL_COLOR_MATERIAL_FACE 0x0B55
-#define GL_COLOR_MATERIAL_PARAMETER 0x0B56
-#define GL_COLOR_MATERIAL 0x0B57
-#define GL_FOG 0x0B60
-#define GL_FOG_INDEX 0x0B61
-#define GL_FOG_DENSITY 0x0B62
-#define GL_FOG_START 0x0B63
-#define GL_FOG_END 0x0B64
-#define GL_FOG_MODE 0x0B65
-#define GL_FOG_COLOR 0x0B66
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_TEST 0x0B71
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_ACCUM_CLEAR_VALUE 0x0B80
-#define GL_STENCIL_TEST 0x0B90
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_MATRIX_MODE 0x0BA0
-#define GL_NORMALIZE 0x0BA1
-#define GL_VIEWPORT 0x0BA2
-#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
-#define GL_PROJECTION_STACK_DEPTH 0x0BA4
-#define GL_TEXTURE_STACK_DEPTH 0x0BA5
-#define GL_MODELVIEW_MATRIX 0x0BA6
-#define GL_PROJECTION_MATRIX 0x0BA7
-#define GL_TEXTURE_MATRIX 0x0BA8
-#define GL_ATTRIB_STACK_DEPTH 0x0BB0
-#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
-#define GL_ALPHA_TEST 0x0BC0
-#define GL_ALPHA_TEST_FUNC 0x0BC1
-#define GL_ALPHA_TEST_REF 0x0BC2
-#define GL_DITHER 0x0BD0
-#define GL_BLEND_DST 0x0BE0
-#define GL_BLEND_SRC 0x0BE1
-#define GL_BLEND 0x0BE2
-#define GL_LOGIC_OP_MODE 0x0BF0
-#define GL_INDEX_LOGIC_OP 0x0BF1
-#define GL_COLOR_LOGIC_OP 0x0BF2
-#define GL_AUX_BUFFERS 0x0C00
-#define GL_DRAW_BUFFER 0x0C01
-#define GL_READ_BUFFER 0x0C02
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_INDEX_CLEAR_VALUE 0x0C20
-#define GL_INDEX_WRITEMASK 0x0C21
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_INDEX_MODE 0x0C30
-#define GL_RGBA_MODE 0x0C31
-#define GL_DOUBLEBUFFER 0x0C32
-#define GL_STEREO 0x0C33
-#define GL_RENDER_MODE 0x0C40
-#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
-#define GL_POINT_SMOOTH_HINT 0x0C51
-#define GL_LINE_SMOOTH_HINT 0x0C52
-#define GL_POLYGON_SMOOTH_HINT 0x0C53
-#define GL_FOG_HINT 0x0C54
-#define GL_TEXTURE_GEN_S 0x0C60
-#define GL_TEXTURE_GEN_T 0x0C61
-#define GL_TEXTURE_GEN_R 0x0C62
-#define GL_TEXTURE_GEN_Q 0x0C63
-#define GL_PIXEL_MAP_I_TO_I 0x0C70
-#define GL_PIXEL_MAP_S_TO_S 0x0C71
-#define GL_PIXEL_MAP_I_TO_R 0x0C72
-#define GL_PIXEL_MAP_I_TO_G 0x0C73
-#define GL_PIXEL_MAP_I_TO_B 0x0C74
-#define GL_PIXEL_MAP_I_TO_A 0x0C75
-#define GL_PIXEL_MAP_R_TO_R 0x0C76
-#define GL_PIXEL_MAP_G_TO_G 0x0C77
-#define GL_PIXEL_MAP_B_TO_B 0x0C78
-#define GL_PIXEL_MAP_A_TO_A 0x0C79
-#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0
-#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1
-#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2
-#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3
-#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4
-#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5
-#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6
-#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7
-#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8
-#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9
-#define GL_UNPACK_SWAP_BYTES 0x0CF0
-#define GL_UNPACK_LSB_FIRST 0x0CF1
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_SWAP_BYTES 0x0D00
-#define GL_PACK_LSB_FIRST 0x0D01
-#define GL_PACK_ROW_LENGTH 0x0D02
-#define GL_PACK_SKIP_ROWS 0x0D03
-#define GL_PACK_SKIP_PIXELS 0x0D04
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAP_COLOR 0x0D10
-#define GL_MAP_STENCIL 0x0D11
-#define GL_INDEX_SHIFT 0x0D12
-#define GL_INDEX_OFFSET 0x0D13
-#define GL_RED_SCALE 0x0D14
-#define GL_RED_BIAS 0x0D15
-#define GL_ZOOM_X 0x0D16
-#define GL_ZOOM_Y 0x0D17
-#define GL_GREEN_SCALE 0x0D18
-#define GL_GREEN_BIAS 0x0D19
-#define GL_BLUE_SCALE 0x0D1A
-#define GL_BLUE_BIAS 0x0D1B
-#define GL_ALPHA_SCALE 0x0D1C
-#define GL_ALPHA_BIAS 0x0D1D
-#define GL_DEPTH_SCALE 0x0D1E
-#define GL_DEPTH_BIAS 0x0D1F
-#define GL_MAX_EVAL_ORDER 0x0D30
-#define GL_MAX_LIGHTS 0x0D31
-#define GL_MAX_CLIP_PLANES 0x0D32
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_PIXEL_MAP_TABLE 0x0D34
-#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35
-#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
-#define GL_MAX_NAME_STACK_DEPTH 0x0D37
-#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
-#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_INDEX_BITS 0x0D51
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_ACCUM_RED_BITS 0x0D58
-#define GL_ACCUM_GREEN_BITS 0x0D59
-#define GL_ACCUM_BLUE_BITS 0x0D5A
-#define GL_ACCUM_ALPHA_BITS 0x0D5B
-#define GL_NAME_STACK_DEPTH 0x0D70
-#define GL_AUTO_NORMAL 0x0D80
-#define GL_MAP1_COLOR_4 0x0D90
-#define GL_MAP1_INDEX 0x0D91
-#define GL_MAP1_NORMAL 0x0D92
-#define GL_MAP1_TEXTURE_COORD_1 0x0D93
-#define GL_MAP1_TEXTURE_COORD_2 0x0D94
-#define GL_MAP1_TEXTURE_COORD_3 0x0D95
-#define GL_MAP1_TEXTURE_COORD_4 0x0D96
-#define GL_MAP1_VERTEX_3 0x0D97
-#define GL_MAP1_VERTEX_4 0x0D98
-#define GL_MAP2_COLOR_4 0x0DB0
-#define GL_MAP2_INDEX 0x0DB1
-#define GL_MAP2_NORMAL 0x0DB2
-#define GL_MAP2_TEXTURE_COORD_1 0x0DB3
-#define GL_MAP2_TEXTURE_COORD_2 0x0DB4
-#define GL_MAP2_TEXTURE_COORD_3 0x0DB5
-#define GL_MAP2_TEXTURE_COORD_4 0x0DB6
-#define GL_MAP2_VERTEX_3 0x0DB7
-#define GL_MAP2_VERTEX_4 0x0DB8
-#define GL_MAP1_GRID_DOMAIN 0x0DD0
-#define GL_MAP1_GRID_SEGMENTS 0x0DD1
-#define GL_MAP2_GRID_DOMAIN 0x0DD2
-#define GL_MAP2_GRID_SEGMENTS 0x0DD3
-#define GL_TEXTURE_1D 0x0DE0
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
-#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
-#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
-#define GL_SELECTION_BUFFER_POINTER 0x0DF3
-#define GL_SELECTION_BUFFER_SIZE 0x0DF4
-/* GL_TEXTURE_BINDING_1D */
-/* GL_TEXTURE_BINDING_2D */
-/* GL_VERTEX_ARRAY */
-/* GL_NORMAL_ARRAY */
-/* GL_COLOR_ARRAY */
-/* GL_INDEX_ARRAY */
-/* GL_TEXTURE_COORD_ARRAY */
-/* GL_EDGE_FLAG_ARRAY */
-/* GL_VERTEX_ARRAY_SIZE */
-/* GL_VERTEX_ARRAY_TYPE */
-/* GL_VERTEX_ARRAY_STRIDE */
-/* GL_NORMAL_ARRAY_TYPE */
-/* GL_NORMAL_ARRAY_STRIDE */
-/* GL_COLOR_ARRAY_SIZE */
-/* GL_COLOR_ARRAY_TYPE */
-/* GL_COLOR_ARRAY_STRIDE */
-/* GL_INDEX_ARRAY_TYPE */
-/* GL_INDEX_ARRAY_STRIDE */
-/* GL_TEXTURE_COORD_ARRAY_SIZE */
-/* GL_TEXTURE_COORD_ARRAY_TYPE */
-/* GL_TEXTURE_COORD_ARRAY_STRIDE */
-/* GL_EDGE_FLAG_ARRAY_STRIDE */
-/* GL_POLYGON_OFFSET_FACTOR */
-/* GL_POLYGON_OFFSET_UNITS */
-
-/* GetTextureParameter */
-/* GL_TEXTURE_MAG_FILTER */
-/* GL_TEXTURE_MIN_FILTER */
-/* GL_TEXTURE_WRAP_S */
-/* GL_TEXTURE_WRAP_T */
-#define GL_TEXTURE_WIDTH 0x1000
-#define GL_TEXTURE_HEIGHT 0x1001
-#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
-#define GL_TEXTURE_BORDER_COLOR 0x1004
-#define GL_TEXTURE_BORDER 0x1005
-/* GL_TEXTURE_RED_SIZE */
-/* GL_TEXTURE_GREEN_SIZE */
-/* GL_TEXTURE_BLUE_SIZE */
-/* GL_TEXTURE_ALPHA_SIZE */
-/* GL_TEXTURE_LUMINANCE_SIZE */
-/* GL_TEXTURE_INTENSITY_SIZE */
-/* GL_TEXTURE_PRIORITY */
-/* GL_TEXTURE_RESIDENT */
-
-/* HintMode */
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-
-/* HintTarget */
-/* GL_PERSPECTIVE_CORRECTION_HINT */
-/* GL_POINT_SMOOTH_HINT */
-/* GL_LINE_SMOOTH_HINT */
-/* GL_POLYGON_SMOOTH_HINT */
-/* GL_FOG_HINT */
-
-/* IndexPointerType */
-/* GL_SHORT */
-/* GL_INT */
-/* GL_FLOAT */
-/* GL_DOUBLE */
-
-/* LightModelParameter */
-/* GL_LIGHT_MODEL_AMBIENT */
-/* GL_LIGHT_MODEL_LOCAL_VIEWER */
-/* GL_LIGHT_MODEL_TWO_SIDE */
-
-/* LightName */
-#define GL_LIGHT0 0x4000
-#define GL_LIGHT1 0x4001
-#define GL_LIGHT2 0x4002
-#define GL_LIGHT3 0x4003
-#define GL_LIGHT4 0x4004
-#define GL_LIGHT5 0x4005
-#define GL_LIGHT6 0x4006
-#define GL_LIGHT7 0x4007
-
-/* LightParameter */
-#define GL_AMBIENT 0x1200
-#define GL_DIFFUSE 0x1201
-#define GL_SPECULAR 0x1202
-#define GL_POSITION 0x1203
-#define GL_SPOT_DIRECTION 0x1204
-#define GL_SPOT_EXPONENT 0x1205
-#define GL_SPOT_CUTOFF 0x1206
-#define GL_CONSTANT_ATTENUATION 0x1207
-#define GL_LINEAR_ATTENUATION 0x1208
-#define GL_QUADRATIC_ATTENUATION 0x1209
-
-/* InterleavedArrays */
-/* GL_V2F */
-/* GL_V3F */
-/* GL_C4UB_V2F */
-/* GL_C4UB_V3F */
-/* GL_C3F_V3F */
-/* GL_N3F_V3F */
-/* GL_C4F_N3F_V3F */
-/* GL_T2F_V3F */
-/* GL_T4F_V4F */
-/* GL_T2F_C4UB_V3F */
-/* GL_T2F_C3F_V3F */
-/* GL_T2F_N3F_V3F */
-/* GL_T2F_C4F_N3F_V3F */
-/* GL_T4F_C4F_N3F_V4F */
-
-/* ListMode */
-#define GL_COMPILE 0x1300
-#define GL_COMPILE_AND_EXECUTE 0x1301
-
-/* ListNameType */
-/* GL_BYTE */
-/* GL_UNSIGNED_BYTE */
-/* GL_SHORT */
-/* GL_UNSIGNED_SHORT */
-/* GL_INT */
-/* GL_UNSIGNED_INT */
-/* GL_FLOAT */
-/* GL_2_BYTES */
-/* GL_3_BYTES */
-/* GL_4_BYTES */
-
-/* LogicOp */
-#define GL_CLEAR 0x1500
-#define GL_AND 0x1501
-#define GL_AND_REVERSE 0x1502
-#define GL_COPY 0x1503
-#define GL_AND_INVERTED 0x1504
-#define GL_NOOP 0x1505
-#define GL_XOR 0x1506
-#define GL_OR 0x1507
-#define GL_NOR 0x1508
-#define GL_EQUIV 0x1509
-#define GL_INVERT 0x150A
-#define GL_OR_REVERSE 0x150B
-#define GL_COPY_INVERTED 0x150C
-#define GL_OR_INVERTED 0x150D
-#define GL_NAND 0x150E
-#define GL_SET 0x150F
-
-/* MapTarget */
-/* GL_MAP1_COLOR_4 */
-/* GL_MAP1_INDEX */
-/* GL_MAP1_NORMAL */
-/* GL_MAP1_TEXTURE_COORD_1 */
-/* GL_MAP1_TEXTURE_COORD_2 */
-/* GL_MAP1_TEXTURE_COORD_3 */
-/* GL_MAP1_TEXTURE_COORD_4 */
-/* GL_MAP1_VERTEX_3 */
-/* GL_MAP1_VERTEX_4 */
-/* GL_MAP2_COLOR_4 */
-/* GL_MAP2_INDEX */
-/* GL_MAP2_NORMAL */
-/* GL_MAP2_TEXTURE_COORD_1 */
-/* GL_MAP2_TEXTURE_COORD_2 */
-/* GL_MAP2_TEXTURE_COORD_3 */
-/* GL_MAP2_TEXTURE_COORD_4 */
-/* GL_MAP2_VERTEX_3 */
-/* GL_MAP2_VERTEX_4 */
-
-/* MaterialFace */
-/* GL_FRONT */
-/* GL_BACK */
-/* GL_FRONT_AND_BACK */
-
-/* MaterialParameter */
-#define GL_EMISSION 0x1600
-#define GL_SHININESS 0x1601
-#define GL_AMBIENT_AND_DIFFUSE 0x1602
-#define GL_COLOR_INDEXES 0x1603
-/* GL_AMBIENT */
-/* GL_DIFFUSE */
-/* GL_SPECULAR */
-
-/* MatrixMode */
-#define GL_MODELVIEW 0x1700
-#define GL_PROJECTION 0x1701
-#define GL_TEXTURE 0x1702
-
-/* MeshMode1 */
-/* GL_POINT */
-/* GL_LINE */
-
-/* MeshMode2 */
-/* GL_POINT */
-/* GL_LINE */
-/* GL_FILL */
-
-/* NormalPointerType */
-/* GL_BYTE */
-/* GL_SHORT */
-/* GL_INT */
-/* GL_FLOAT */
-/* GL_DOUBLE */
-
-/* PixelCopyType */
-#define GL_COLOR 0x1800
-#define GL_DEPTH 0x1801
-#define GL_STENCIL 0x1802
-
-/* PixelFormat */
-#define GL_COLOR_INDEX 0x1900
-#define GL_STENCIL_INDEX 0x1901
-#define GL_DEPTH_COMPONENT 0x1902
-#define GL_RED 0x1903
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-
-/* PixelMap */
-/* GL_PIXEL_MAP_I_TO_I */
-/* GL_PIXEL_MAP_S_TO_S */
-/* GL_PIXEL_MAP_I_TO_R */
-/* GL_PIXEL_MAP_I_TO_G */
-/* GL_PIXEL_MAP_I_TO_B */
-/* GL_PIXEL_MAP_I_TO_A */
-/* GL_PIXEL_MAP_R_TO_R */
-/* GL_PIXEL_MAP_G_TO_G */
-/* GL_PIXEL_MAP_B_TO_B */
-/* GL_PIXEL_MAP_A_TO_A */
-
-/* PixelStore */
-/* GL_UNPACK_SWAP_BYTES */
-/* GL_UNPACK_LSB_FIRST */
-/* GL_UNPACK_ROW_LENGTH */
-/* GL_UNPACK_SKIP_ROWS */
-/* GL_UNPACK_SKIP_PIXELS */
-/* GL_UNPACK_ALIGNMENT */
-/* GL_PACK_SWAP_BYTES */
-/* GL_PACK_LSB_FIRST */
-/* GL_PACK_ROW_LENGTH */
-/* GL_PACK_SKIP_ROWS */
-/* GL_PACK_SKIP_PIXELS */
-/* GL_PACK_ALIGNMENT */
-
-/* PixelTransfer */
-/* GL_MAP_COLOR */
-/* GL_MAP_STENCIL */
-/* GL_INDEX_SHIFT */
-/* GL_INDEX_OFFSET */
-/* GL_RED_SCALE */
-/* GL_RED_BIAS */
-/* GL_GREEN_SCALE */
-/* GL_GREEN_BIAS */
-/* GL_BLUE_SCALE */
-/* GL_BLUE_BIAS */
-/* GL_ALPHA_SCALE */
-/* GL_ALPHA_BIAS */
-/* GL_DEPTH_SCALE */
-/* GL_DEPTH_BIAS */
-
-/* PixelType */
-#define GL_BITMAP 0x1A00
-/* GL_BYTE */
-/* GL_UNSIGNED_BYTE */
-/* GL_SHORT */
-/* GL_UNSIGNED_SHORT */
-/* GL_INT */
-/* GL_UNSIGNED_INT */
-/* GL_FLOAT */
-
-/* PolygonMode */
-#define GL_POINT 0x1B00
-#define GL_LINE 0x1B01
-#define GL_FILL 0x1B02
-
-/* ReadBufferMode */
-/* GL_FRONT_LEFT */
-/* GL_FRONT_RIGHT */
-/* GL_BACK_LEFT */
-/* GL_BACK_RIGHT */
-/* GL_FRONT */
-/* GL_BACK */
-/* GL_LEFT */
-/* GL_RIGHT */
-/* GL_AUX0 */
-/* GL_AUX1 */
-/* GL_AUX2 */
-/* GL_AUX3 */
-
-/* RenderingMode */
-#define GL_RENDER 0x1C00
-#define GL_FEEDBACK 0x1C01
-#define GL_SELECT 0x1C02
-
-/* ShadingModel */
-#define GL_FLAT 0x1D00
-#define GL_SMOOTH 0x1D01
-
-/* StencilFunction */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* StencilOp */
-/* GL_ZERO */
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-/* GL_INVERT */
-
-/* StringName */
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-
-/* TextureCoordName */
-#define GL_S 0x2000
-#define GL_T 0x2001
-#define GL_R 0x2002
-#define GL_Q 0x2003
-
-/* TexCoordPointerType */
-/* GL_SHORT */
-/* GL_INT */
-/* GL_FLOAT */
-/* GL_DOUBLE */
-
-/* TextureEnvMode */
-#define GL_MODULATE 0x2100
-#define GL_DECAL 0x2101
-/* GL_BLEND */
-/* GL_REPLACE */
-
-/* TextureEnvParameter */
-#define GL_TEXTURE_ENV_MODE 0x2200
-#define GL_TEXTURE_ENV_COLOR 0x2201
-
-/* TextureEnvTarget */
-#define GL_TEXTURE_ENV 0x2300
-
-/* TextureGenMode */
-#define GL_EYE_LINEAR 0x2400
-#define GL_OBJECT_LINEAR 0x2401
-#define GL_SPHERE_MAP 0x2402
-
-/* TextureGenParameter */
-#define GL_TEXTURE_GEN_MODE 0x2500
-#define GL_OBJECT_PLANE 0x2501
-#define GL_EYE_PLANE 0x2502
-
-/* TextureMagFilter */
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-
-/* TextureMinFilter */
-/* GL_NEAREST */
-/* GL_LINEAR */
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-
-/* TextureParameterName */
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-/* GL_TEXTURE_BORDER_COLOR */
-/* GL_TEXTURE_PRIORITY */
-
-/* TextureTarget */
-/* GL_TEXTURE_1D */
-/* GL_TEXTURE_2D */
-/* GL_PROXY_TEXTURE_1D */
-/* GL_PROXY_TEXTURE_2D */
-
-/* TextureWrapMode */
-#define GL_CLAMP 0x2900
-#define GL_REPEAT 0x2901
-
-/* VertexPointerType */
-/* GL_SHORT */
-/* GL_INT */
-/* GL_FLOAT */
-/* GL_DOUBLE */
-
-/* ClientAttribMask */
-#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
-#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
-#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff
-
-/* polygon_offset */
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_POINT 0x2A01
-#define GL_POLYGON_OFFSET_LINE 0x2A02
-#define GL_POLYGON_OFFSET_FILL 0x8037
-
-/* texture */
-#define GL_ALPHA4 0x803B
-#define GL_ALPHA8 0x803C
-#define GL_ALPHA12 0x803D
-#define GL_ALPHA16 0x803E
-#define GL_LUMINANCE4 0x803F
-#define GL_LUMINANCE8 0x8040
-#define GL_LUMINANCE12 0x8041
-#define GL_LUMINANCE16 0x8042
-#define GL_LUMINANCE4_ALPHA4 0x8043
-#define GL_LUMINANCE6_ALPHA2 0x8044
-#define GL_LUMINANCE8_ALPHA8 0x8045
-#define GL_LUMINANCE12_ALPHA4 0x8046
-#define GL_LUMINANCE12_ALPHA12 0x8047
-#define GL_LUMINANCE16_ALPHA16 0x8048
-#define GL_INTENSITY 0x8049
-#define GL_INTENSITY4 0x804A
-#define GL_INTENSITY8 0x804B
-#define GL_INTENSITY12 0x804C
-#define GL_INTENSITY16 0x804D
-#define GL_R3_G3_B2 0x2A10
-#define GL_RGB4 0x804F
-#define GL_RGB5 0x8050
-#define GL_RGB8 0x8051
-#define GL_RGB10 0x8052
-#define GL_RGB12 0x8053
-#define GL_RGB16 0x8054
-#define GL_RGBA2 0x8055
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_RGBA12 0x805A
-#define GL_RGBA16 0x805B
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_GREEN_SIZE 0x805D
-#define GL_TEXTURE_BLUE_SIZE 0x805E
-#define GL_TEXTURE_ALPHA_SIZE 0x805F
-#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
-#define GL_TEXTURE_INTENSITY_SIZE 0x8061
-#define GL_PROXY_TEXTURE_1D 0x8063
-#define GL_PROXY_TEXTURE_2D 0x8064
-
-/* texture_object */
-#define GL_TEXTURE_PRIORITY 0x8066
-#define GL_TEXTURE_RESIDENT 0x8067
-#define GL_TEXTURE_BINDING_1D 0x8068
-#define GL_TEXTURE_BINDING_2D 0x8069
-
-/* vertex_array */
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_NORMAL_ARRAY 0x8075
-#define GL_COLOR_ARRAY 0x8076
-#define GL_INDEX_ARRAY 0x8077
-#define GL_TEXTURE_COORD_ARRAY 0x8078
-#define GL_EDGE_FLAG_ARRAY 0x8079
-#define GL_VERTEX_ARRAY_SIZE 0x807A
-#define GL_VERTEX_ARRAY_TYPE 0x807B
-#define GL_VERTEX_ARRAY_STRIDE 0x807C
-#define GL_NORMAL_ARRAY_TYPE 0x807E
-#define GL_NORMAL_ARRAY_STRIDE 0x807F
-#define GL_COLOR_ARRAY_SIZE 0x8081
-#define GL_COLOR_ARRAY_TYPE 0x8082
-#define GL_COLOR_ARRAY_STRIDE 0x8083
-#define GL_INDEX_ARRAY_TYPE 0x8085
-#define GL_INDEX_ARRAY_STRIDE 0x8086
-#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
-#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
-#define GL_VERTEX_ARRAY_POINTER 0x808E
-#define GL_NORMAL_ARRAY_POINTER 0x808F
-#define GL_COLOR_ARRAY_POINTER 0x8090
-#define GL_INDEX_ARRAY_POINTER 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
-#define GL_V2F 0x2A20
-#define GL_V3F 0x2A21
-#define GL_C4UB_V2F 0x2A22
-#define GL_C4UB_V3F 0x2A23
-#define GL_C3F_V3F 0x2A24
-#define GL_N3F_V3F 0x2A25
-#define GL_C4F_N3F_V3F 0x2A26
-#define GL_T2F_V3F 0x2A27
-#define GL_T4F_V4F 0x2A28
-#define GL_T2F_C4UB_V3F 0x2A29
-#define GL_T2F_C3F_V3F 0x2A2A
-#define GL_T2F_N3F_V3F 0x2A2B
-#define GL_T2F_C4F_N3F_V3F 0x2A2C
-#define GL_T4F_C4F_N3F_V4F 0x2A2D
-
-/* Extensions */
-#define GL_EXT_vertex_array 1
-#define GL_WIN_swap_hint 1
-#define GL_EXT_bgra 1
-#define GL_EXT_paletted_texture 1
-
-/* EXT_vertex_array */
-#define GL_VERTEX_ARRAY_EXT 0x8074
-#define GL_NORMAL_ARRAY_EXT 0x8075
-#define GL_COLOR_ARRAY_EXT 0x8076
-#define GL_INDEX_ARRAY_EXT 0x8077
-#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078
-#define GL_EDGE_FLAG_ARRAY_EXT 0x8079
-#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A
-#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B
-#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C
-#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D
-#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E
-#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F
-#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080
-#define GL_COLOR_ARRAY_SIZE_EXT 0x8081
-#define GL_COLOR_ARRAY_TYPE_EXT 0x8082
-#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083
-#define GL_COLOR_ARRAY_COUNT_EXT 0x8084
-#define GL_INDEX_ARRAY_TYPE_EXT 0x8085
-#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086
-#define GL_INDEX_ARRAY_COUNT_EXT 0x8087
-#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A
-#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B
-#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C
-#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D
-#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E
-#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F
-#define GL_COLOR_ARRAY_POINTER_EXT 0x8090
-#define GL_INDEX_ARRAY_POINTER_EXT 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093
-#define GL_DOUBLE_EXT GL_DOUBLE
-
-/* EXT_bgra */
-#define GL_BGR_EXT 0x80E0
-#define GL_BGRA_EXT 0x80E1
-
-/* EXT_paletted_texture */
-
-/* These must match the GL_COLOR_TABLE_*_SGI enumerants */
-#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8
-#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF
-
-#define GL_COLOR_INDEX1_EXT 0x80E2
-#define GL_COLOR_INDEX2_EXT 0x80E3
-#define GL_COLOR_INDEX4_EXT 0x80E4
-#define GL_COLOR_INDEX8_EXT 0x80E5
-#define GL_COLOR_INDEX12_EXT 0x80E6
-#define GL_COLOR_INDEX16_EXT 0x80E7
-
-/* For compatibility with OpenGL v1.0 */
-#define GL_LOGIC_OP GL_INDEX_LOGIC_OP
-#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT
-
-#endif // _SV_SALOTYPE
-
diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h
index 1183b61f15a6..83d736592a93 100644
--- a/vcl/os2/inc/salinst.h
+++ b/vcl/os2/inc/salinst.h
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: salinst.h,v $
- * $Revision: 1.7 $
+ * $Revision: 1.7.74.1 $
*
* This file is part of OpenOffice.org.
*
@@ -88,7 +88,6 @@ public:
virtual String GetDefaultPrinter();
virtual SalSound* CreateSalSound();
virtual SalTimer* CreateSalTimer();
- virtual SalOpenGL* CreateSalOpenGL( SalGraphics* pGraphics );
virtual SalI18NImeStatus* CreateI18NImeStatus();
virtual SalSystem* CreateSalSystem();
virtual SalBitmap* CreateSalBitmap();
diff --git a/vcl/os2/inc/salogl.h b/vcl/os2/inc/salogl.h
index cee1d25ebe10..e69de29bb2d1 100644
--- a/vcl/os2/inc/salogl.h
+++ b/vcl/os2/inc/salogl.h
@@ -1,166 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: salogl.h,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SV_SALOGL_H
-#define _SV_SALOGL_H
-
-#define _OPENGL_EXT
-
-#include <tools/gen.hxx>
-#include <vcl/sv.h>
-//#ifndef _SV_SALOTYPE_HXX
-//#include <salotype.hxx>
-//#endif
-#include <vcl/salogl.hxx>
-
-// ------------------
-// - OpenGL defines -
-// ------------------
-
-#define PGL_USE_GL 1
-#define PGL_BUFFER_SIZE 2
-#define PGL_LEVEL 3
-#define PGL_RGBA 4
-#define PGL_DOUBLEBUFFER 5
-#define PGL_STEREO 6
-#define PGL_AUX_BUFFERS 7
-#define PGL_RED_SIZE 8
-#define PGL_GREEN_SIZE 9
-#define PGL_BLUE_SIZE 10
-#define PGL_ALPHA_SIZE 11
-#define PGL_DEPTH_SIZE 12
-#define PGL_STENCIL_SIZE 13
-#define PGL_ACCUM_RED_SIZE 14
-#define PGL_ACCUM_GREEN_SIZE 15
-#define PGL_ACCUM_BLUE_SIZE 16
-#define PGL_ACCUM_ALPHA_SIZE 17
-#define PGL_SINGLEBUFFER 18
-
-// -----------------
-// - State defines -
-// -----------------
-
-#define OGL_STATE_UNLOADED (0x00000000)
-#define OGL_STATE_INVALID (0x00000001)
-#define OGL_STATE_VALID (0x00000002)
-
-// ----------
-// - Macros -
-// ----------
-
-#define DECL_OGLFNC( FncName ) static OGLFnc##FncName pFnc##FncName
-
-// -------------------------------
-// - Additional typedefs for init.
-// -------------------------------
-
-typedef struct visualconfig
-{
- unsigned long vid; /*Visual ID*/
- BOOL rgba;
- int redSize, greenSize, blueSize, alphaSize;
- ULONG redMask, greenMask, blueMask;
- int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize;
- BOOL doubleBuffer;
- BOOL stereo;
- int bufferSize;
- int depthSize;
- int stencilSize;
- int auxBuffers;
- int level;
- PVOID reserved;
- struct visualconfig *next;
-}
-VISUALCONFIG, *PVISUALCONFIG;
-
-extern "C"
-{
- typedef LHANDLE HGC;
- typedef PVISUALCONFIG* ( *APIENTRY OGLFncQueryConfigs )( HAB hab, ... );
- typedef PVISUALCONFIG ( *APIENTRY OGLFncChooseConfig )( HAB hab, int *attriblist, ... );
- typedef HGC ( *APIENTRY OGLFncCreateContext )( HAB hab, PVISUALCONFIG pVisualConfig, HGC Sharelist, BOOL IsDirect, ... );
- typedef BOOL ( *APIENTRY OGLFncDestroyContext )( HAB hab, HGC hgc, ... );
- typedef HGC ( *APIENTRY OGLFncGetCurrentContext )( HAB hab, ... );
- typedef BOOL ( *APIENTRY OGLFncMakeCurrent )( HAB hab, HGC hgc, HWND hwnd, ... );
- typedef LONG ( *APIENTRY OGLFncQueryCapability)( HAB hab, ... );
-}
-
-// -------------
-// - SalOpenGL -
-// -------------
-
-class SalGraphics;
-class String;
-
-//class SalOpenGL
-class Os2SalOpenGL : public SalOpenGL
-{
-private:
-
- static HMODULE mhOGLLib;
- static HGC mhOGLContext;
- static HDC mhOGLLastDC;
- static ULONG mnOGLState;
-
-#if 0
-private:
-
- DECL_OGLFNC( QueryConfigs );
- DECL_OGLFNC( ChooseConfig );
- DECL_OGLFNC( CreateContext );
- DECL_OGLFNC( DestroyContext );
- DECL_OGLFNC( GetCurrentContext );
- DECL_OGLFNC( MakeCurrent );
- DECL_OGLFNC( QueryCapability );
-#endif
-
-private:
-
- static BOOL ImplInitLib();
- static BOOL ImplInit();
- static void ImplFreeLib();
-
-public:
-
- Os2SalOpenGL( SalGraphics* );
- virtual ~Os2SalOpenGL();
-