summaryrefslogtreecommitdiff
path: root/goodies
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-04-11 19:32:41 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-04-11 19:32:41 +0000
commitc1f340a3078e3cf1ebdb9381deee7ac44fe6bcfa (patch)
tree5231e3eabc6b2ee32475d70390067dd4bb97c8e4 /goodies
parent91dbce098f77b7c08d573e6cf84cfe6d67c081d7 (diff)
INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED
2007/02/09 16:13:36 vg 1.1.2.1: #72503# get rid of hedabu procedure: Moving headers to goodies/inc/goodies and correspondent necessary changes
Diffstat (limited to 'goodies')
-rw-r--r--goodies/inc/goodies/b3dcompo.hxx233
-rw-r--r--goodies/inc/goodies/b3dentty.hxx175
-rw-r--r--goodies/inc/goodies/b3dgeom.hxx217
-rw-r--r--goodies/inc/goodies/b3dlight.hxx247
4 files changed, 872 insertions, 0 deletions
diff --git a/goodies/inc/goodies/b3dcompo.hxx b/goodies/inc/goodies/b3dcompo.hxx
new file mode 100644
index 000000000000..d9ad93cddea0
--- /dev/null
+++ b/goodies/inc/goodies/b3dcompo.hxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b3dcompo.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 20:31:54 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _B3D_B3DCOMPO_HXX
+#define _B3D_B3DCOMPO_HXX
+
+#ifndef _B3D_B3DENTITY_HXX
+#include <goodies/b3dentty.hxx>
+#endif
+
+/*************************************************************************
+|*
+|* 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
new file mode 100644
index 000000000000..7d2fcd8edec0
--- /dev/null
+++ b/goodies/inc/goodies/b3dentty.hxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b3dentty.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 20:32:22 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _B3D_B3DENTITY_HXX
+#define _B3D_B3DENTITY_HXX
+
+#ifndef _B3D_B3DCOLOR_HXX
+#include <goodies/b3dcolor.hxx>
+#endif
+
+#ifndef _B3D_BUCKET_HXX
+#include <goodies/bucket.hxx>
+#endif
+
+#ifndef _BGFX_POINT_B3DPOINT_HXX
+#include <basegfx/point/b3dpoint.hxx>
+#endif
+
+#ifndef _BGFX_POINT_B2DPOINT_HXX
+#include <basegfx/point/b2dpoint.hxx>
+#endif
+
+#ifndef _BGFX_VECTOR_B3DVECTOR_HXX
+#include <basegfx/vector/b3dvector.hxx>
+#endif
+
+/*************************************************************************
+|*
+|* 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
new file mode 100644
index 000000000000..3172748d42b5
--- /dev/null
+++ b/goodies/inc/goodies/b3dgeom.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b3dgeom.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 20:32:31 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _B3D_B3DGEOM_HXX
+#define _B3D_B3DGEOM_HXX
+
+#ifndef _B3D_B3DENTITY_HXX
+#include <goodies/b3dentty.hxx>
+#endif
+
+//#ifndef _B3D_VOLUM_HXX
+//#include "b3dvolum.hxx"
+//#endif
+
+#ifndef _BGFX_RANGE_B3DRANGE_HXX
+#include <basegfx/range/b3drange.hxx>
+#endif
+
+#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
new file mode 100644
index 000000000000..fc0d3d953770
--- /dev/null
+++ b/goodies/inc/goodies/b3dlight.hxx
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: b3dlight.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-04-11 20:32:41 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _B3D_B3DLIGHT_HXX
+#define _B3D_B3DLIGHT_HXX
+
+#ifndef _SVX_MATRIL3D_HXX
+#include <goodies/matril3d.hxx>
+#endif
+
+#ifndef _BGFX_VECTOR_B3DVECTOR_HXX
+#include <basegfx/vector/b3dvector.hxx>
+#endif
+
+#ifndef _BGFX_POINT_B3DPOINT_HXX
+#include <basegfx/point/b3dpoint.hxx>
+#endif
+
+/*************************************************************************
+|*
+|* 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