diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2022-01-13 13:26:25 +0100 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2022-02-17 14:14:01 +0100 |
commit | 157b027c4cfca2582b1c1bdb66992560084ac008 (patch) | |
tree | 41ae4086069acc86fb36ccbb23a1eb82bfa5117c /offapi | |
parent | 424cd919c4234d6e6fd4da89acd90197771f7b9d (diff) |
tdf#145700 Improve lighting in extruded custom shapes
The fix tries to make rendering similar to MS Office.
The ODF standard follows closely the extrusion in RTF and MS binary
format. Rendering uses the 3D scene engine.
The main problem was, that the z-component of the direction was
interpreted with opposite sign. As result the maximum of a light was at
false position. Especially a direction from the observer to the object
has produced a light behind the shape and so looks as if light was off.
The wrong z-direction has produced lighting, which was less intensive
than in MS Office. To compensate that, a third light source was added
as workaround. That part is removed.
Second problem was wrong use of 3D-scene D3DMaterialSpecularIntensity
and D3DMaterialSpecular (= UI Specular color). That was not only wrong
in OOo but in my previous patch too.
D3DMaterialSpecularIntensity corresponds to MS property 'c3DShininess'.
Relationship is Intensity = 2^c3DShininess.
D3DMaterialSpecular is calculated from MS property c3DSpecularAmt and
and c3DKeyIntensity. The light source was missing, but needs to be
included, because c3DSpecularAmt is 'the ratio of incident to specular
light that is reflected on a shape'.
The old unit tests are adapted to this change.
MS gives no information how it softens a light in case of harsh=false.
ODF specifies it as 'implementation-defined'. The patch uses four
additional lights, which have directions in 60° angle to the original
light. The light intensity is distributed. That comes near to rendering
in MS Office. Changing our 3D engine to provide 'soft' lights was not
doable for me.
The way MS Office renders a 'metal' surface is different from ODF
specification. To distinguish the kinds, I have introduced a new
property MetalType. I have discussed it with the ODF TC (see minutes
from 2022-02-07) and got the advise to use namespaced values.
Therefore the datatype is not boolean.
The 'Surface' drop-down in the extrusion bar is changed to make the two
kinds of rendering 'Metal' available to the user.
If a user sets surface 'Metal' in the UI of MS Office, it sets not only
fc3DMetallic but reduces the value of c3DDiffuseAmt in addition. Our
3D-scene engine has the corresponding ODF attribute dr3d:diffuse-color
not implemented. To get a similar rendering I change the material color
of the 3D-objects as workaround.
Change-Id: Ia986b9c318b4c79688e0c0e2d858215b9d612fdc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128449
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'offapi')
-rw-r--r-- | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/drawing/EnhancedCustomShapeExtrusion.idl | 11 | ||||
-rwxr-xr-x | offapi/com/sun/star/drawing/EnhancedCustomShapeMetalType.idl | 36 |
3 files changed, 47 insertions, 1 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 2f4240e75e33..28b3a41f280b 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2295,6 +2295,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/drawing,\ EnhancedCustomShapeSegmentCommand \ EnhancedCustomShapeTextFrame \ EnhancedCustomShapeTextPathMode \ + EnhancedCustomShapeMetalType \ EscapeDirection \ FillStyle \ FlagSequence \ diff --git a/offapi/com/sun/star/drawing/EnhancedCustomShapeExtrusion.idl b/offapi/com/sun/star/drawing/EnhancedCustomShapeExtrusion.idl index bfe99f4029fd..4b589c4aa1d8 100644 --- a/offapi/com/sun/star/drawing/EnhancedCustomShapeExtrusion.idl +++ b/offapi/com/sun/star/drawing/EnhancedCustomShapeExtrusion.idl @@ -94,11 +94,20 @@ service EnhancedCustomShapeExtrusion */ [optional, property] boolean Metal; + /** Specifies in case of Metal=true the way the rendering of the shape is modified. + <p>Note: Currently not usable in ODF strict.</p> + + @see EnhancedCustomShapeMetalType + + @since LibreOffice 7.4 + */ + [optional, property] short MetalType; + /** This property defines the shade mode. */ [optional, property] ::com::sun::star::drawing::ShadeMode ShadeMode; - /** This attributes specifies the rotation angle about the x-axis in grad. + /** This attributes specifies the rotation angle about the x-axis in degrees. The order of rotation is: z-axis, y-axis and then x-axis. The z-axis is specified by the draw:rotate-angle. */ diff --git a/offapi/com/sun/star/drawing/EnhancedCustomShapeMetalType.idl b/offapi/com/sun/star/drawing/EnhancedCustomShapeMetalType.idl new file mode 100755 index 000000000000..aea502ccd31b --- /dev/null +++ b/offapi/com/sun/star/drawing/EnhancedCustomShapeMetalType.idl @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef __com_sun_star_drawing_EnhancedCustomShapeMetalType_idl__ +#define __com_sun_star_drawing_EnhancedCustomShapeMetalType_idl__ + + + module com { module sun { module star { module drawing { + +/** These constants define the way the attribute Metal of service + EnhancedCustomShapeExtrusion is interpreted for rendering the shape. + @since LibreOffice 7.4 + */ +constants EnhancedCustomShapeMetalType +{ + /** The rendering of the shape is modified as specified in the ODF standard. + */ + const short MetalODF = 0; + + /** The rendering of the shape is modified to get a similar rendering as in Microsoft Office for objects, which have the fc3DMetallic flag in Rich Text Format or binary MS Office format set. + */ + const short MetalMSCompatible = 1; +}; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
\ No newline at end of file |