summaryrefslogtreecommitdiff
path: root/drawinglayer/inc/drawinglayer/processor3d
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/inc/drawinglayer/processor3d')
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx27
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx37
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx52
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx19
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx35
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx41
6 files changed, 139 insertions, 72 deletions
diff --git a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx
index cd2cc2e6113f..6ed00c337ef3 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx
@@ -37,6 +37,13 @@ namespace drawinglayer
{
namespace processor3d
{
+ /** BaseProcessor3D class
+
+ Baseclass for all C++ implementations of instances which process
+ primitives.
+
+ Please have a look at baseprocessor2d.hxx for more comments.
+ */
class BaseProcessor3D
{
private:
@@ -48,9 +55,10 @@ namespace drawinglayer
maViewInformation3D = rViewInformation3D;
}
- // as tooling, the process() implementation takes over API handling and calls this
- // virtual render method when the primitive implementation is BasePrimitive3D-based.
- // Default implementation does nothing
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ Default implementation does nothing
+ */
virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
public:
@@ -72,6 +80,13 @@ namespace drawinglayer
{
namespace processor3d
{
+ /** CollectingProcessor3D class
+
+ A processor which just collects all primitives given to it in
+ process(..) calls to maPrimitive3DSequence. This can e.g. be used to
+ hand around as instance over various methods where every called
+ method can add graphic content to it.
+ */
class CollectingProcessor3D : public BaseProcessor3D
{
private:
@@ -81,16 +96,16 @@ namespace drawinglayer
CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation);
virtual ~CollectingProcessor3D();
- // the central processing method
+ /// the central processing method
virtual void process(const primitive3d::Primitive3DSequence& rSource);
- // helpers for adding to local sequence
+ /// helpers for adding to local sequence
void appendPrimitive3DReference(const primitive3d::Primitive3DReference& rSource)
{
primitive3d::appendPrimitive3DReferenceToPrimitive3DSequence(maPrimitive3DSequence, rSource);
}
- // data access and reset
+ /// data access and reset
const primitive3d::Primitive3DSequence& getPrimitive3DSequence() const { return maPrimitive3DSequence; }
void reset() { maPrimitive3DSequence = primitive3d::Primitive3DSequence(); }
};
diff --git a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx
index 12ebf023be2a..918634af5e35 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx
@@ -36,26 +36,38 @@ namespace drawinglayer
{
namespace processor3d
{
+ /** CutFindProcessor class
+
+ This processor extracts all cuts of 3D plane geometries in the feeded primitives
+ with the given cut vector, based on the ViewInformation3D given.
+ */
class CutFindProcessor : public BaseProcessor3D
{
private:
- // the start and stop point for the cut vector
+ /// the start and stop point for the cut vector
basegfx::B3DPoint maFront;
basegfx::B3DPoint maBack;
- // the found cut points
+ /// the found cut points
::std::vector< basegfx::B3DPoint > maResult;
- // #i102956# the transformation change from TransformPrimitive3D processings
- // needs to be remembered to be able to transform found cuts to the
- // basic coordinate system the processor starts with
+ /* #i102956# the transformation change from TransformPrimitive3D processings
+ needs to be remembered to be able to transform found cuts to the
+ basic coordinate system the processor starts with
+ */
basegfx::B3DHomMatrix maCombinedTransform;
- // bitfield
+ /// bitfield
bool mbAnyHit : 1;
- // as tooling, the process() implementation takes over API handling and calls this
- // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ /* this flag decides if primitives which are invisible will be taken into account for
+ HitTesting or not.
+ */
+ bool mbUseInvisiblePrimitiveContent : 1;
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
public:
@@ -64,9 +76,16 @@ namespace drawinglayer
const basegfx::B3DPoint& rBack,
bool bAnyHit);
- // data access
+ /// data write access
+ void setUseInvisiblePrimitiveContent(bool bNew)
+ {
+ if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew;
+ }
+
+ /// data read access
const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; }
bool getAnyHit() const { return mbAnyHit; }
+ bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;}
};
} // end of namespace processor3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
index 0b8c1bb413a9..af8de431f191 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
@@ -33,9 +33,11 @@
#include <basegfx/range/b2drange.hxx>
#include <basegfx/color/bcolormodifier.hxx>
#include <svtools/optionsdrawinglayer.hxx>
+#include <boost/shared_ptr.hpp>
//////////////////////////////////////////////////////////////////////////////
// predefines
+
namespace basegfx {
class BZPixelRaster;
class B3DPolygon;
@@ -68,35 +70,49 @@ namespace drawinglayer
{
namespace processor3d
{
+ /** DefaultProcessor3D class
+
+ This processor renders all feeded primitives to a 2D raster where for all
+ primitives the two basic methods rasterconvertB3DPolygon for hairlines and
+ rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to
+ e.g. base a Z-Buffer supported renderer on the 3D primitive processing.
+ */
class DefaultProcessor3D : public BaseProcessor3D
{
protected:
- // render information
- const attribute::SdrSceneAttribute& mrSdrSceneAttribute; // read-only scene infos (normal handling, etc...)
- const attribute::SdrLightingAttribute& mrSdrLightingAttribute; // read-only light infos (lights, etc...)
+ /// read-only scene infos (normal handling, etc...)
+ const attribute::SdrSceneAttribute& mrSdrSceneAttribute;
+
+ /// read-only light infos (lights, etc...)
+ const attribute::SdrLightingAttribute& mrSdrLightingAttribute;
- // renderer range. Need to be correctly set by the derived implementations
- basegfx::B2DRange maRasterRange; // the (0, 0, W, H) range from mpBZPixelRaster
+ /// renderer range. Need to be correctly set by the derived implementations
+ /// normally the (0, 0, W, H) range from mpBZPixelRaster
+ basegfx::B2DRange maRasterRange;
- // the modifiedColorPrimitive stack
+ /// the modifiedColorPrimitive stack
basegfx::BColorModifierStack maBColorModifierStack;
- // the current active texture
- texture::GeoTexSvx* mpGeoTexSvx;
+ /// the current active texture
+ boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx;
- // the current active transparence texture
- texture::GeoTexSvx* mpTransparenceGeoTexSvx;
+ /// the current active transparence texture
+ boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx;
- // SvtOptionsDrawinglayer incarnation to react on diverse settings
+ /// SvtOptionsDrawinglayer incarnation to react on diverse settings
const SvtOptionsDrawinglayer maDrawinglayerOpt;
- // bitfield
+ /// counter for entered transparence textures
+ sal_uInt32 mnTransparenceCounter;
+
+ /// bitfield
unsigned mbModulate : 1;
unsigned mbFilter : 1;
unsigned mbSimpleTextureActive : 1;
//////////////////////////////////////////////////////////////////////////////
// rendering support
+
void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence);
void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive);
void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive);
@@ -108,6 +124,7 @@ namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
// rasterconversions for filled and non-filled polygons. These NEED to be
// implemented from derivations
+
virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0;
virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0;
@@ -121,19 +138,20 @@ namespace drawinglayer
const attribute::SdrLightingAttribute& rSdrLightingAttribute);
virtual ~DefaultProcessor3D();
- // data read access
+ /// data read access
const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; }
const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; }
- // data read access renderer stuff
+ /// data read access renderer stuff
const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
- const texture::GeoTexSvx* getGeoTexSvx() const { return mpGeoTexSvx; }
- const texture::GeoTexSvx* getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; }
+ const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; }
+ const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; }
+ sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; }
bool getModulate() const { return mbModulate; }
bool getFilter() const { return mbFilter; }
bool getSimpleTextureActive() const { return mbSimpleTextureActive; }
- // access to Drawinglayer configuration options
+ /// access to Drawinglayer configuration options
const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
};
} // end of namespace processor3d
diff --git a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx
index 51cbbe15e68d..f07eaa5c245c 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx
@@ -40,20 +40,27 @@ namespace drawinglayer
{
namespace processor3d
{
+ /** Geometry2DExtractingProcessor class
+
+ This processor extracts the 2D geometry (projected geometry) of all feeded primitives.
+ It is e.g. used as sub-processor for contour extraction where 3D geometry is only
+ useful as 2D projected geometry.
+ */
class Geometry2DExtractingProcessor : public BaseProcessor3D
{
private:
- // result holding vector (2D)
+ /// result holding vector (2D)
primitive2d::Primitive2DSequence maPrimitive2DSequence;
- // object transformation for scene for 2d definition
+ /// object transformation for scene for 2d definition
basegfx::B2DHomMatrix maObjectTransformation;
- // the modifiedColorPrimitive stack
+ /// the modifiedColorPrimitive stack
basegfx::BColorModifierStack maBColorModifierStack;
- // as tooling, the process() implementation takes over API handling and calls this
- // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
public:
@@ -61,7 +68,7 @@ namespace drawinglayer
const geometry::ViewInformation3D& rViewInformation,
const basegfx::B2DHomMatrix& rObjectTransformation);
- // data access
+ // data read access
const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
diff --git a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx
index 5f5396f23baf..23d8e7edd913 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx
@@ -44,17 +44,24 @@ namespace drawinglayer
{
namespace processor3d
{
+ /** Shadow3DExtractingProcessor class
+
+ This processor extracts the 2D shadow geometry (projected geometry) of all feeded primitives.
+ It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite
+ some data to do so since we do not only offer flat projected 2D shadow, but also projections
+ dependent on the light source
+ */
class Shadow3DExtractingProcessor : public BaseProcessor3D
{
private:
- // result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence)
+ /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence)
primitive2d::Primitive2DSequence maPrimitive2DSequence;
primitive2d::Primitive2DSequence* mpPrimitive2DSequence;
- // object transformation for scene for 2d definition
+ /// object transformation for scene for 2d definition
basegfx::B2DHomMatrix maObjectTransformation;
- // prepared data (transformations) for 2D/3D shadow calculations
+ /// prepared data (transformations) for 2D/3D shadow calculations
basegfx::B3DHomMatrix maWorldToEye;
basegfx::B3DHomMatrix maEyeToView;
basegfx::B3DVector maLightNormal;
@@ -62,26 +69,28 @@ namespace drawinglayer
basegfx::B3DPoint maPlanePoint;
double mfLightPlaneScalar;
- // the shadow color used for sub-primitives. Can stay at black since
- // the encapsulating 2d shadow primitive will contain the color
+ /* the shadow color used for sub-primitives. Can stay at black since
+ the encapsulating 2d shadow primitive will contain the color
+ */
basegfx::BColor maPrimitiveColor;
- // bitfield
- // flag if shadow plane projection preparation leaded to valid results
+ /// bitfield
+ /// flag if shadow plane projection preparation leaded to valid results
unsigned mbShadowProjectionIsValid : 1;
- // flag if conversion is switched on
+ /// flag if conversion is switched on
unsigned mbConvert : 1;
- // flag if conversion shall use projection
+ /// flag if conversion shall use projection
unsigned mbUseProjection : 1;
- // helpers
+ /// local helpers
basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource);
basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource);
- // as tooling, the process() implementation takes over API handling and calls this
- // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
public:
@@ -92,7 +101,7 @@ namespace drawinglayer
double fShadowSlant,
const basegfx::B3DRange& rContained3DRange);
- // data access
+ /// data read access
const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; }
diff --git a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx
index c7d10bdfc690..aefeddbb38a9 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx
@@ -50,6 +50,7 @@ namespace drawinglayer {
}
class ZBufferRasterConverter3D;
+class RasterPrimitive3D;
//////////////////////////////////////////////////////////////////////////////
@@ -57,37 +58,40 @@ namespace drawinglayer
{
namespace processor3d
{
+ /** ZBufferProcessor3D class
+
+ This 3D renderer derived from DefaultProcessor3D renders all feeded primitives to a 2D
+ raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle
+ transparent content.
+ */
class ZBufferProcessor3D : public DefaultProcessor3D
{
private:
- // the raster target, a Z-Buffer
+ /// the raster target, a Z-Buffer
basegfx::BZPixelRaster* mpBZPixelRaster;
- // inverse of EyeToView for rasterconversion with evtl. Phong shading
+ /// inverse of EyeToView for rasterconversion with evtl. Phong shading
basegfx::B3DHomMatrix maInvEyeToView;
- // The raster converter for Z-Buffer
+ /// The raster converter for Z-Buffer
ZBufferRasterConverter3D* mpZBufferRasterConverter3D;
- // AA value. Defines how many oversámples will be used in X and Y. Values 0, 1
- // will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create
+ /* AA value. Defines how many oversámples will be used in X and Y. Values 0, 1
+ will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create
+ */
sal_uInt16 mnAntiAlialize;
- // bitfield
- // a combination of bools to allow two-pass rendering to render
- // the transparent parts in the 2nd run (if any) as needed for Z-Buffer
- unsigned mbProcessTransparent : 1;
- unsigned mbContainsTransparent : 1;
-
+ /* remembered RasterPrimitive3D's which need to be painted back to front
+ for transparent 3D parts
+ */
+ std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds;
//////////////////////////////////////////////////////////////////////////////
// rasterconversions for filled and non-filled polygons
+
virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const;
virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const;
- // the processing method for a single, known primitive
- virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive);
-
public:
ZBufferProcessor3D(
const geometry::ViewInformation3D& rViewInformation3D,
@@ -100,14 +104,9 @@ namespace drawinglayer
sal_uInt16 nAntiAlialize);
virtual ~ZBufferProcessor3D();
- // helpers for drawing transparent parts in 2nd run. To use this
- // processor, call processNonTransparent and then processTransparent
- // with the same primitives. The 2nd call will only do something,
- // when transparent parts are contained
- void processNonTransparent(const primitive3d::Primitive3DSequence& rSource);
- void processTransparent(const primitive3d::Primitive3DSequence& rSource);
+ void finish();
- // get the result as bitmapEx
+ /// get the result as bitmapEx
BitmapEx getBitmapEx() const;
};
} // end of namespace processor3d