summaryrefslogtreecommitdiff
path: root/drawinglayer/source/processor3d
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2009-03-15 14:43:10 +0000
committerVladimir Glazounov <vg@openoffice.org>2009-03-15 14:43:10 +0000
commitd75a74bf2a45c3ee051fa424b0e7350f5b77c518 (patch)
treeb3450fc9c64c09aaf4d15b351c4757fe85372ec1 /drawinglayer/source/processor3d
parent1bad9334e8d2683dec2218ac9c632f658d46d8e0 (diff)
CWS-TOOLING: integrate CWS aw064
2009-02-10 17:39:02 +0100 aw r267569 : #i98314# adapted texture size to object size 2009-02-05 15:26:16 +0100 aw r267427 : #i98532# added mirroring of redline info when RTL is on 2009-02-04 16:31:27 +0100 aw r267392 : #i98314# corrected texturing for E3dPolygonObj's primitive creation 2009-02-02 17:58:49 +0100 aw r267285 : #i98295# corrected orientation of E3dPolygonObj's polygon definition on it's way to prmitives 2009-02-02 17:57:32 +0100 aw r267283 : #i98295# optimized SdrPolyPolygonPrimitive3D::createLocalDecomposition data flow
Diffstat (limited to 'drawinglayer/source/processor3d')
-rw-r--r--drawinglayer/source/processor3d/defaultprocessor3d.cxx83
1 files changed, 38 insertions, 45 deletions
diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
index 9631bd344e6f..d9194ca4b5eb 100644
--- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
@@ -312,6 +312,11 @@ namespace drawinglayer
basegfx::BColor aObjectColor(rPrimitive.getMaterial().getColor());
bool bPaintIt(aFill.count());
+ // #i98295# get ShadeMode. Correct early when only flat is possible due to missing normals
+ const ::com::sun::star::drawing::ShadeMode aShadeMode(
+ aFill.areNormalsUsed() ?
+ getSdrSceneAttribute().getShadeMode() : ::com::sun::star::drawing::ShadeMode_FLAT);
+
if(bPaintIt)
{
// get rid of texture coordinates if there is no texture
@@ -320,6 +325,13 @@ namespace drawinglayer
aFill.clearTextureCoordinates();
}
+ // #i98295# get rid of normals and color early when not needed
+ if(::com::sun::star::drawing::ShadeMode_FLAT == aShadeMode)
+ {
+ aFill.clearNormals();
+ aFill.clearBColors();
+ }
+
// transform to device coordinates (-1.0 .. 1.0) and check for visibility
aFill.transform(getViewInformation3D().getObjectToView());
const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aFill));
@@ -344,7 +356,6 @@ namespace drawinglayer
if(bPaintIt)
{
// prepare ObjectToEye in NormalTransform
- ::com::sun::star::drawing::ShadeMode aShadeMode(getSdrSceneAttribute().getShadeMode());
basegfx::B3DHomMatrix aNormalTransform(getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation());
if(getSdrSceneAttribute().getTwoSidedLighting())
@@ -360,27 +371,17 @@ namespace drawinglayer
}
}
- if(::com::sun::star::drawing::ShadeMode_PHONG == aShadeMode)
+ switch(aShadeMode)
{
- // phong shading
- if(aFill.areNormalsUsed())
+ case ::com::sun::star::drawing::ShadeMode_PHONG:
{
- // transform normals to eye coor
+ // phong shading. Transform normals to eye coor
aFill.transformNormals(aNormalTransform);
+ break;
}
- else
- {
- // fallback to gouraud when no normals available
- aShadeMode = ::com::sun::star::drawing::ShadeMode_SMOOTH;
- }
- }
-
- if(::com::sun::star::drawing::ShadeMode_SMOOTH == aShadeMode)
- {
- // gouraud shading
- if(aFill.areNormalsUsed())
+ case ::com::sun::star::drawing::ShadeMode_SMOOTH:
{
- // transform normals to eye coor
+ // gouraud shading. Transform normals to eye coor
aFill.transformNormals(aNormalTransform);
// prepare color model parameters, evtl. use blend color
@@ -406,38 +407,30 @@ namespace drawinglayer
aPartFill.clearNormals();
aFill.setB3DPolygon(a, aPartFill);
}
+ break;
}
- else
+ case ::com::sun::star::drawing::ShadeMode_FLAT:
{
- // fallback to flat when no normals available
- aShadeMode = ::com::sun::star::drawing::ShadeMode_FLAT;
- }
- }
+ // flat shading. Get plane vector in eye coordinates
+ const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0L).getNormal());
- if(::com::sun::star::drawing::ShadeMode_FLAT == aShadeMode)
- {
- // flat shading. Clear normals and colors
- aFill.clearNormals();
- aFill.clearBColors();
-
- // get plane vector in eye coordinates
- const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0L).getNormal());
-
- // prepare color model parameters, evtl. use blend color
- const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor());
- const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular());
- const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission());
- const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity());
-
- // solve color model for plane vector and use that color for whole plane
- aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity);
- }
+ // prepare color model parameters, evtl. use blend color
+ const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor());
+ const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular());
+ const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission());
+ const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity());
- if(::com::sun::star::drawing::ShadeMode_DRAFT == aShadeMode)
- {
- // draft, just use object color which is already set. Delete all other infos
- aFill.clearNormals();
- aFill.clearBColors();
+ // solve color model for plane vector and use that color for whole plane
+ aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity);
+ break;
+ }
+ default: // case ::com::sun::star::drawing::ShadeMode_DRAFT:
+ {
+ // draft, just use object color which is already set. Delete all other infos
+ aFill.clearNormals();
+ aFill.clearBColors();
+ break;
+ }
}
// draw it to ZBuffer