summaryrefslogtreecommitdiff
path: root/svx/source/engine3d
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2001-07-10 09:09:51 +0000
committerArmin Weiss <aw@openoffice.org>2001-07-10 09:09:51 +0000
commit31af9654a9414f23986a24dbde0c3a4ac8cf3a0a (patch)
tree126c8e77c1f8664070eec1d36126e1a4217ecbf7 /svx/source/engine3d
parent750c84d639ccdd65fc8732c337252f6a4d3fa4d4 (diff)
#78972# added virtual function GetLineGeometry(...)
Diffstat (limited to 'svx/source/engine3d')
-rw-r--r--svx/source/engine3d/cube3d.cxx16
-rw-r--r--svx/source/engine3d/extrud3d.cxx16
-rw-r--r--svx/source/engine3d/lathe3d.cxx16
-rw-r--r--svx/source/engine3d/obj3d.cxx214
-rw-r--r--svx/source/engine3d/polygn3d.cxx16
-rw-r--r--svx/source/engine3d/sphere3d.cxx16
6 files changed, 270 insertions, 24 deletions
diff --git a/svx/source/engine3d/cube3d.cxx b/svx/source/engine3d/cube3d.cxx
index bc7c2dcad31a..2a72a83a9552 100644
--- a/svx/source/engine3d/cube3d.cxx
+++ b/svx/source/engine3d/cube3d.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cube3d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2001-01-26 14:01:07 $
+ * last change: $Author: aw $ $Date: 2001-07-10 10:09:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -146,6 +146,18 @@ SdrObject *E3dCubeObj::DoConvertToPolyObj(BOOL bBezier) const
/*************************************************************************
|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+void E3dCubeObj::GetLineGeometry(PolyPolygon3D& rLinePolyPolygon) const
+{
+ // call parent
+ E3dCompoundObject::GetLineGeometry(rLinePolyPolygon);
+}
+
+/*************************************************************************
+|*
|* Geometrieerzeugung
|*
\************************************************************************/
diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx
index 8bb643840067..06eb5ea76136 100644
--- a/svx/source/engine3d/extrud3d.cxx
+++ b/svx/source/engine3d/extrud3d.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: extrud3d.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2001-01-26 14:01:07 $
+ * last change: $Author: aw $ $Date: 2001-07-10 10:09:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -232,6 +232,18 @@ PolyPolygon3D E3dExtrudeObj::GetBackSide(const PolyPolygon3D& rFrontSide)
return aBackSide;
}
+/*************************************************************************
+|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+void E3dExtrudeObj::GetLineGeometry(PolyPolygon3D& rLinePolyPolygon) const
+{
+ // call parent
+ E3dCompoundObject::GetLineGeometry(rLinePolyPolygon);
+}
+
void E3dExtrudeObj::CreateGeometry()
{
// Start der Geometrieerzeugung ankuendigen
diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx
index 25e524346b62..da4ab9fe855c 100644
--- a/svx/source/engine3d/lathe3d.cxx
+++ b/svx/source/engine3d/lathe3d.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: lathe3d.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: aw $ $Date: 2001-02-15 18:38:06 $
+ * last change: $Author: aw $ $Date: 2001-07-10 10:09:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -252,6 +252,18 @@ void E3dLatheObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
/*************************************************************************
|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+void E3dLatheObj::GetLineGeometry(PolyPolygon3D& rLinePolyPolygon) const
+{
+ // call parent
+ E3dCompoundObject::GetLineGeometry(rLinePolyPolygon);
+}
+
+/*************************************************************************
+|*
|* Die eigentliche Konstruktionmethode, erzeugt einen Koerper durch
|* Rotation des uebergebenen Polygons um die senkrechte Y-Achse. Wenn
|* nEndAngle < 3600 ist, werden ausserdem zwei Deckelflaechen-Polygone
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 01fab308d8f3..78669439f32f 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: obj3d.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: aw $ $Date: 2001-06-26 14:04:27 $
+ * last change: $Author: aw $ $Date: 2001-07-10 10:09:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2562,6 +2562,56 @@ Bitmap E3dCompoundObject::GetHatchBitmap(const SfxItemSet& rSet)
/*************************************************************************
|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+void E3dCompoundObject::GetLineGeometry(PolyPolygon3D& rLinePolyPolygon) const
+{
+ // use basic implementation here. Maybe optimized later.
+ rLinePolyPolygon.Clear();
+ B3dEntityBucket& rEntityBucket = ((E3dCompoundObject*)this)->GetDisplayGeometry().GetEntityBucket();
+ GeometryIndexValueBucket& rIndexBucket = ((E3dCompoundObject*)this)->GetDisplayGeometry().GetIndexBucket();
+ sal_uInt32 nPolyCounter(0);
+ sal_uInt32 nEntityCounter(0);
+
+ while(nPolyCounter < rIndexBucket.Count())
+ {
+ // next primitive
+ sal_uInt32 nUpperBound(rIndexBucket[nPolyCounter++].GetIndex());
+ Vector3D aLastPoint;
+
+ BOOL bLastLineVisible = rEntityBucket[nUpperBound - 1].IsEdgeVisible();
+ if(bLastLineVisible)
+ aLastPoint = rEntityBucket[nUpperBound - 1].Point().GetVector3D();
+
+ while(nEntityCounter < nUpperBound)
+ {
+ Vector3D aNewPoint = rEntityBucket[nEntityCounter].Point().GetVector3D();
+
+ if(bLastLineVisible)
+ {
+ if(aLastPoint != aNewPoint)
+ {
+ // fill polygon
+ Polygon3D aNewPoly(2);
+ aNewPoly[0] = aLastPoint;
+ aNewPoly[1] = aNewPoint;
+
+ // create line geometry for polygon in eye coor to
+ // have it always orthogonal to camera plane
+ rLinePolyPolygon.Insert(aNewPoly);
+ }
+ }
+
+ bLastLineVisible = rEntityBucket[nEntityCounter++].IsEdgeVisible();
+ aLastPoint = aNewPoint;
+ }
+ }
+}
+
+/*************************************************************************
+|*
|* Geometrieerzeugung
|*
\************************************************************************/
@@ -4355,7 +4405,148 @@ void E3dCompoundObject::Paint3D(ExtOutputDevice& rOut, Base3D* pBase3D,
// #79585#
pBase3D->SetActiveTexture();
- pBase3D->DrawPolygonGeometry(GetDisplayGeometry(), TRUE);
+ // #78972#
+ // detect if lines need to be drawn specifically
+ const SfxItemSet& rSet = GetItemSet();
+ sal_Int32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+ XLineStyle aLineStyle = ((const XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
+ BOOL bDrawLineSolidHair = (aLineStyle == XLINE_SOLID && nLineWidth == 0);
+
+ if(bDrawLineSolidHair)
+ {
+ // simply draw the object geometry as line (as done before)
+ pBase3D->DrawPolygonGeometry(GetDisplayGeometry(), TRUE);
+ }
+ else
+ {
+ // convert object geometry to line geometry and draw as polygons
+ // in 3D space
+ PolyPolygon3D aPolyPoly3D;
+ PolyPolygon3D aLinePoly3D;
+
+ // get LineStyleParameterPack
+ LineStyleParameterPack aLineAttr(rSet, FALSE, *rOut.GetOutDev());
+ LineGeometryCreator aLineCreator(aLineAttr, aPolyPoly3D, aLinePoly3D, FALSE);
+
+ // get camera set
+ B3dTransformationSet* pTransSet = pBase3D->GetTransformationSet();
+
+ // get object geometry in eye coor
+ PolyPolygon3D aLinePolyPolygon;
+ GetLineGeometry(aLinePolyPolygon);
+ Matrix4D aMatObjectToEye = pTransSet->GetObjectTrans();
+ aMatObjectToEye *= pTransSet->GetOrientation();
+
+ for(sal_uInt16 nInd(0); nInd < aLinePolyPolygon.Count(); nInd++)
+ {
+ // create line geometry for polygon in eye coor to
+ // have it always orthogonal to camera plane
+ Polygon3D aLinePoly = aLinePolyPolygon.GetObject(nInd);
+ aLinePoly.Transform(aMatObjectToEye);
+ aLineCreator.AddPolygon3D(aLinePoly);
+ }
+
+ if(aPolyPoly3D.Count() || aLinePoly3D.Count())
+ {
+ Color aColorLine = ((const XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetValue();
+ BOOL bGhosted = (rInfoRec.pPV && rInfoRec.pPV->GetView().DoVisualizeEnteredGroup()) ? rInfoRec.bNotActive : FALSE;
+
+ if(bGhosted)
+ aColorLine = Color((aColorLine.GetRed() >> 1) + 0x80, (aColorLine.GetGreen() >> 1) + 0x80, (aColorLine.GetBlue() >> 1) + 0x80);
+
+ // set line color
+ pBase3D->SetColor(aColorLine);
+
+ // set base color
+ sal_uInt16 nLineTrans = ((const XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue();
+ Color aColorLineWithTransparency(aColorLine);
+ aColorLineWithTransparency.SetTransparency((UINT8)(nLineTrans * 255 / 100));
+
+ pBase3D->SetMaterial(aColorLine, Base3DMaterialAmbient);
+ pBase3D->SetMaterial(aColorLineWithTransparency, Base3DMaterialDiffuse);
+ pBase3D->SetMaterial(GetMaterialSpecular(), Base3DMaterialSpecular);
+ pBase3D->SetMaterial(GetMaterialEmission(), Base3DMaterialEmission);
+ pBase3D->SetShininess(GetMaterialSpecularIntensity());
+ if(GetUseDifferentBackMaterial())
+ {
+ pBase3D->SetMaterial(aBackMaterial.GetMaterial(Base3DMaterialAmbient), Base3DMaterialAmbient, Base3DMaterialBack);
+ pBase3D->SetMaterial(aBackMaterial.GetMaterial(Base3DMaterialDiffuse), Base3DMaterialDiffuse, Base3DMaterialBack);
+ pBase3D->SetMaterial(aBackMaterial.GetMaterial(Base3DMaterialSpecular), Base3DMaterialSpecular, Base3DMaterialBack);
+ pBase3D->SetMaterial(aBackMaterial.GetMaterial(Base3DMaterialEmission), Base3DMaterialEmission, Base3DMaterialBack);
+ pBase3D->SetShininess(aBackMaterial.GetShininess(), Base3DMaterialBack);
+ }
+
+ if((pBase3D->GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL) != 0)
+ {
+ // set material to black and white mode
+ Color aColorWhite(COL_WHITE);
+ Color aColorWhiteWithTransparency(COL_WHITE);
+ aColorWhiteWithTransparency.SetTransparency((UINT8)(nLineTrans * 255 / 100));
+
+ pBase3D->SetMaterial(aColorWhite, Base3DMaterialAmbient);
+ pBase3D->SetMaterial(aColorWhiteWithTransparency, Base3DMaterialDiffuse);
+
+ if(GetUseDifferentBackMaterial())
+ {
+ pBase3D->SetMaterial(aColorWhite, Base3DMaterialAmbient, Base3DMaterialBack);
+ pBase3D->SetMaterial(aColorWhiteWithTransparency, Base3DMaterialDiffuse, Base3DMaterialBack);
+ }
+ }
+
+ if(aPolyPoly3D.Count())
+ {
+ // draw the line geometry as area polygons
+ pBase3D->SetRenderMode(Base3DRenderFill);
+ pBase3D->SetPolygonOffset(Base3DPolygonOffsetLine, FALSE);
+
+ for(sal_uInt32 a(0); a < aPolyPoly3D.Count(); a++)
+ {
+ // start new primitive
+ pBase3D->StartPrimitive(Base3DPolygon);
+ const Polygon3D& rPolygon = aPolyPoly3D[(sal_uInt16)a];
+
+ for(sal_uInt32 b(0); b < rPolygon.GetPointCount(); b++)
+ {
+ // use backward loop to have the correct orientation since
+ // the geometry was created in eye coor (with Z-flipped coordinate system)
+ Vector3D aVec = rPolygon[rPolygon.GetPointCount() - sal_uInt16(b + 1)];
+ aVec = pTransSet->EyeToObjectCoor(aVec);
+ pBase3D->AddVertex(aVec);
+ }
+
+ // draw primitive
+ pBase3D->EndPrimitive();
+ }
+ }
+
+ if(aLinePoly3D.Count())
+ {
+ // draw the line geometry as 3d lines
+ pBase3D->SetRenderMode(Base3DRenderLine);
+ pBase3D->SetPolygonOffset(Base3DPolygonOffsetLine, TRUE);
+
+ for(sal_uInt32 a(0); a < aLinePoly3D.Count(); a++)
+ {
+ // start new primitive
+ pBase3D->StartPrimitive(Base3DLineStrip);
+ const Polygon3D& rPolygon = aLinePoly3D[(sal_uInt16)a];
+
+ for(sal_uInt32 b(0); b < rPolygon.GetPointCount(); b++)
+ {
+ Vector3D aVec = rPolygon[sal_uInt16(b)];
+ aVec = pTransSet->EyeToObjectCoor(aVec);
+ pBase3D->AddVertex(aVec);
+ }
+
+ // draw primitive
+ pBase3D->EndPrimitive();
+ }
+
+ pBase3D->SetPolygonOffset(Base3DPolygonOffsetLine, FALSE);
+ }
+ }
+ }
+
pBase3D->GetLightGroup()->EnableLighting(bLightingWasEnabled);
pBase3D->SetLightGroup(pBase3D->GetLightGroup());
}
@@ -4616,20 +4807,15 @@ void E3dCompoundObject::GetShadowPolygon(PolyPolygon& rPoly)
}
else
{
- // Normaler 2D Schatten
- Vector3D aPoint;
-
// ObjectTrans setzen
Matrix4D mTransform = GetFullTransform();
rSet.SetObjectTrans(mTransform);
- if(DrawShadowAsOutline())
+ if(FALSE /* #78972# DrawShadowAsOutline()*/)
{
//SubPolygon mit Punktpaaren bilden
- BOOL bLastLineVisible;
UINT16 nPolySize = (UINT16)(rEntityBucket.Count() * 2);
Polygon aPoly(nPolySize);
- Vector3D aLast;
Point aLastPolyPoint;
nPolyPos = 0;
@@ -4639,9 +4825,10 @@ void E3dCompoundObject::GetShadowPolygon(PolyPolygon& rPoly)
nUpperBound = rIndexBucket[nPolyCounter++].GetIndex();
// Polygon bilden
- if(bLastLineVisible = rEntityBucket[nUpperBound - 1].IsEdgeVisible())
+ BOOL bLastLineVisible = rEntityBucket[nUpperBound - 1].IsEdgeVisible();
+ if(bLastLineVisible)
{
- aLast = rEntityBucket[nUpperBound - 1].Point().GetVector3D();
+ Vector3D aLast = rEntityBucket[nUpperBound - 1].Point().GetVector3D();
aLast = rSet.ObjectToViewCoor(aLast);
aLastPolyPoint.X() = (long)(aLast.X() + 0.5) + nXDist;
aLastPolyPoint.Y() = (long)(aLast.Y() + 0.5) + nYDist;
@@ -4649,7 +4836,7 @@ void E3dCompoundObject::GetShadowPolygon(PolyPolygon& rPoly)
while(nEntityCounter < nUpperBound)
{
- aPoint = rEntityBucket[nEntityCounter].Point().GetVector3D();
+ Vector3D aPoint = rEntityBucket[nEntityCounter].Point().GetVector3D();
aPoint = rSet.ObjectToViewCoor(aPoint);
aPolyPoint.X() = (long)(aPoint.X() + 0.5) + nXDist;
aPolyPoint.Y() = (long)(aPoint.Y() + 0.5) + nYDist;
@@ -4669,7 +4856,6 @@ void E3dCompoundObject::GetShadowPolygon(PolyPolygon& rPoly)
// naechster Punkt
aLastPolyPoint = aPolyPoint;
- aLast = aPoint;
bLastLineVisible = rEntityBucket[nEntityCounter++].IsEdgeVisible();
}
}
@@ -4692,7 +4878,7 @@ void E3dCompoundObject::GetShadowPolygon(PolyPolygon& rPoly)
// Polygon fuellen
while(nEntityCounter < nUpperBound)
{
- aPoint = rEntityBucket[nEntityCounter++].Point().GetVector3D();
+ Vector3D aPoint = rEntityBucket[nEntityCounter++].Point().GetVector3D();
aPoint = rSet.ObjectToViewCoor(aPoint);
aPolyPoint.X() = (long)(aPoint.X() + 0.5) + nXDist;
aPolyPoint.Y() = (long)(aPoint.Y() + 0.5) + nYDist;
diff --git a/svx/source/engine3d/polygn3d.cxx b/svx/source/engine3d/polygn3d.cxx
index 6a04fdb21a89..9ef426cdb4b8 100644
--- a/svx/source/engine3d/polygn3d.cxx
+++ b/svx/source/engine3d/polygn3d.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: polygn3d.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2001-01-26 14:01:08 $
+ * last change: $Author: aw $ $Date: 2001-07-10 10:09:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -419,6 +419,18 @@ SdrObject *E3dPolygonObj::DoConvertToPolyObj(BOOL bBezier) const
/*************************************************************************
|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+void E3dPolygonObj::GetLineGeometry(PolyPolygon3D& rLinePolyPolygon) const
+{
+ // call parent
+ E3dCompoundObject::GetLineGeometry(rLinePolyPolygon);
+}
+
+/*************************************************************************
+|*
|* Geometrieerzeugung
|*
\************************************************************************/
diff --git a/svx/source/engine3d/sphere3d.cxx b/svx/source/engine3d/sphere3d.cxx
index b9c19fae44a6..440e4ad7c00e 100644
--- a/svx/source/engine3d/sphere3d.cxx
+++ b/svx/source/engine3d/sphere3d.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sphere3d.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2001-01-26 14:01:08 $
+ * last change: $Author: aw $ $Date: 2001-07-10 10:09:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -158,6 +158,18 @@ void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
/*************************************************************************
|*
+|* Give out simple line geometry
+|*
+\************************************************************************/
+
+void E3dSphereObj::GetLineGeometry(PolyPolygon3D& rLinePolyPolygon) const
+{
+ // call parent
+ E3dCompoundObject::GetLineGeometry(rLinePolyPolygon);
+}
+
+/*************************************************************************
+|*
|* Geometrieerzeugung
|*
\************************************************************************/