1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_drawinglayer.hxx"
30 
31 #include <drawinglayer/processor3d/defaultprocessor3d.hxx>
32 #include <drawinglayer/primitive3d/textureprimitive3d.hxx>
33 #include <drawinglayer/texture/texture.hxx>
34 #include <drawinglayer/texture/texture3d.hxx>
35 #include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
36 #include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
37 #include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
38 #include <basegfx/polygon/b3dpolygontools.hxx>
39 #include <drawinglayer/attribute/materialattribute3d.hxx>
40 #include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
41 #include <basegfx/polygon/b3dpolypolygontools.hxx>
42 #include <com/sun/star/drawing/ShadeMode.hpp>
43 #include <drawinglayer/primitive3d/transformprimitive3d.hxx>
44 #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
45 #include <vcl/bitmapex.hxx>
46 #include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
47 #include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
48 
49 //////////////////////////////////////////////////////////////////////////////
50 
51 using namespace com::sun::star;
52 
53 //////////////////////////////////////////////////////////////////////////////
54 
55 namespace drawinglayer
56 {
57 	namespace processor3d
58 	{
59 		void DefaultProcessor3D::impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence)
60 		{
61 			const primitive3d::Primitive3DSequence& rSubSequence = rPrimitive.getChildren();
62 
63 			if(rSubSequence.hasElements())
64 			{
65 				// rescue values
66 				const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
67 				const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
68 				const bool bOldSimpleTextureActive(getSimpleTextureActive());
69 				boost::shared_ptr< texture::GeoTexSvx > pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx;
70 
71 				// create texture
72 				const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient();
73 				const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY());
74 				const attribute::GradientStyle aGradientStyle(rFillGradient.getStyle());
75 				sal_uInt32 nSteps(rFillGradient.getSteps());
76 				const basegfx::BColor aStart(rFillGradient.getStartColor());
77 				const basegfx::BColor aEnd(rFillGradient.getEndColor());
78 				const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5));
79 				boost::shared_ptr< texture::GeoTexSvx > pNewTex;
80 
81 				if(nMaxSteps)
82 				{
83 					// there IS a color distance
84 					if(nSteps == 0L)
85 					{
86 						nSteps = nMaxSteps;
87 					}
88 
89 					if(nSteps < 2L)
90 					{
91 						nSteps = 2L;
92 					}
93 
94 					if(nSteps > nMaxSteps)
95 					{
96 						nSteps = nMaxSteps;
97 					}
98 
99 					switch(aGradientStyle)
100 					{
101 						case attribute::GRADIENTSTYLE_LINEAR:
102 						{
103 							pNewTex.reset(new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle()));
104 							break;
105 						}
106 						case attribute::GRADIENTSTYLE_AXIAL:
107 						{
108 							pNewTex.reset(new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle()));
109 							break;
110 						}
111 						case attribute::GRADIENTSTYLE_RADIAL:
112 						{
113 							pNewTex.reset(new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY()));
114 							break;
115 						}
116 						case attribute::GRADIENTSTYLE_ELLIPTICAL:
117 						{
118 							pNewTex.reset(new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
119 							break;
120 						}
121 						case attribute::GRADIENTSTYLE_SQUARE:
122 						{
123 							pNewTex.reset(new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
124 							break;
125 						}
126 						case attribute::GRADIENTSTYLE_RECT:
127 						{
128 							pNewTex.reset(new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle()));
129 							break;
130 						}
131 					}
132 
133 					mbSimpleTextureActive = false;
134 				}
135 				else
136 				{
137 					// no color distance -> same color, use simple texture
138 					pNewTex.reset(new texture::GeoTexSvxMono(aStart, 1.0 - aStart.luminance()));
139 					mbSimpleTextureActive = true;
140 				}
141 
142 				// set created texture
143 				if(bTransparence)
144 				{
145 					mpTransparenceGeoTexSvx = pNewTex;
146 				}
147 				else
148 				{
149 					mpGeoTexSvx = pNewTex;
150 				}
151 
152 				// process sub-list
153 				process(rSubSequence);
154 
155 				// restore values
156 				mbModulate = bOldModulate;
157 				mbFilter = bOldFilter;
158 				mbSimpleTextureActive = bOldSimpleTextureActive;
159 
160 				if(bTransparence)
161 				{
162 					mpTransparenceGeoTexSvx = pOldTex;
163 				}
164 				else
165 				{
166 					mpGeoTexSvx = pOldTex;
167 				}
168 			}
169 		}
170 
171 		void DefaultProcessor3D::impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive)
172 		{
173 			const primitive3d::Primitive3DSequence& rSubSequence = rPrimitive.getChildren();
174 
175 			if(rSubSequence.hasElements())
176 			{
177 				// rescue values
178 				const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
179 				const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
180 				boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx;
181 
182 				// calculate logic pixel size in object coordinates. Create transformation view
183 				// to object by inverting ObjectToView
184 				basegfx::B3DHomMatrix aInvObjectToView(getViewInformation3D().getObjectToView());
185 				aInvObjectToView.invert();
186 
187 				// back-project discrete coordinates to object coordinates and extract
188 				// maximum distance
189 				const basegfx::B3DPoint aZero(aInvObjectToView * basegfx::B3DPoint(0.0, 0.0, 0.0));
190 				const basegfx::B3DPoint aOne(aInvObjectToView * basegfx::B3DPoint(1.0, 1.0, 1.0));
191 				const basegfx::B3DVector aLogicPixel(aOne - aZero);
192 				double fLogicPixelSizeWorld(::std::max(::std::max(fabs(aLogicPixel.getX()), fabs(aLogicPixel.getY())), fabs(aLogicPixel.getZ())));
193 
194 				// calculate logic pixel size in texture coordinates
195 				const double fLogicTexSizeX(fLogicPixelSizeWorld / rPrimitive.getTextureSize().getX());
196 				const double fLogicTexSizeY(fLogicPixelSizeWorld / rPrimitive.getTextureSize().getY());
197 				const double fLogicTexSize(fLogicTexSizeX > fLogicTexSizeY ? fLogicTexSizeX : fLogicTexSizeY);
198 
199 				// create texture and set
200 				mpGeoTexSvx.reset(new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize));
201 
202 				// process sub-list
203 				process(rSubSequence);
204 
205 				// restore values
206 				mbModulate = bOldModulate;
207 				mbFilter = bOldFilter;
208 				mpGeoTexSvx = pOldTex;
209 			}
210 		}
211 
212 		void DefaultProcessor3D::impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive)
213 		{
214 			const primitive3d::Primitive3DSequence& rSubSequence = rPrimitive.getChildren();
215 
216 			if(rSubSequence.hasElements())
217 			{
218 				// rescue values
219 				const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate();
220 				const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter();
221 				boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx;
222 
223 				// create texture
224 				const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getFillBitmapAttribute();
225 
226 				if(rFillBitmapAttribute.getTiling())
227 				{
228 					mpGeoTexSvx.reset(new texture::GeoTexSvxBitmapTiled(
229 						rFillBitmapAttribute.getBitmapEx().GetBitmap(),
230 						rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(),
231 						rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()));
232 				}
233 				else
234 				{
235 					mpGeoTexSvx.reset(new texture::GeoTexSvxBitmap(
236 						rFillBitmapAttribute.getBitmapEx().GetBitmap(),
237 						rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(),
238 						rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()));
239 				}
240 
241 				// process sub-list
242 				process(rSubSequence);
243 
244 				// restore values
245 				mbModulate = bOldModulate;
246 				mbFilter = bOldFilter;
247 				mpGeoTexSvx = pOldTex;
248 			}
249 		}
250 
251 		void DefaultProcessor3D::impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate)
252 		{
253 			const primitive3d::Primitive3DSequence& rSubSequence = rModifiedCandidate.getChildren();
254 
255 			if(rSubSequence.hasElements())
256 			{
257 				// put modifier on stack
258 				maBColorModifierStack.push(rModifiedCandidate.getColorModifier());
259 
260 				// process sub-list
261 				process(rModifiedCandidate.getChildren());
262 
263 				// remove modifier from stack
264 				maBColorModifierStack.pop();
265 			}
266 		}
267 
268 		void DefaultProcessor3D::impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive)
269 		{
270 			basegfx::B3DPolygon aHairline(rPrimitive.getB3DPolygon());
271 
272 			if(aHairline.count())
273 			{
274 				// hairlines need no extra data, clear it
275 				aHairline.clearTextureCoordinates();
276 				aHairline.clearNormals();
277 				aHairline.clearBColors();
278 
279 				// transform to device coordinates (-1.0 .. 1.0) and check for visibility
280 				aHairline.transform(getViewInformation3D().getObjectToView());
281 				const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aHairline));
282 				const basegfx::B2DRange a2DRange(a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY());
283 
284 				if(a2DRange.overlaps(maRasterRange))
285 				{
286 					const attribute::MaterialAttribute3D aMaterial(maBColorModifierStack.getModifiedColor(rPrimitive.getBColor()));
287 
288 					rasterconvertB3DPolygon(aMaterial, aHairline);
289 				}
290 			}
291 		}
292 
293 		void DefaultProcessor3D::impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive)
294 		{
295 			basegfx::B3DPolyPolygon aFill(rPrimitive.getB3DPolyPolygon());
296 			basegfx::BColor aObjectColor(rPrimitive.getMaterial().getColor());
297 			bool bPaintIt(aFill.count());
298 
299 			// #i98295# get ShadeMode. Correct early when only flat is possible due to missing normals
300 			const ::com::sun::star::drawing::ShadeMode aShadeMode(
301 				aFill.areNormalsUsed() ?
302 					getSdrSceneAttribute().getShadeMode() : ::com::sun::star::drawing::ShadeMode_FLAT);
303 
304 			if(bPaintIt)
305 			{
306 				// get rid of texture coordinates if there is no texture
307 				if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx().get() && !getTransparenceGeoTexSvx().get())
308 				{
309 					aFill.clearTextureCoordinates();
310 				}
311 
312 				// #i98295# get rid of normals and color early when not needed
313 				if(::com::sun::star::drawing::ShadeMode_FLAT == aShadeMode)
314 				{
315 					aFill.clearNormals();
316 					aFill.clearBColors();
317 				}
318 
319 				// transform to device coordinates (-1.0 .. 1.0) and check for visibility
320 				aFill.transform(getViewInformation3D().getObjectToView());
321 				const basegfx::B3DRange a3DRange(basegfx::tools::getRange(aFill));
322 				const basegfx::B2DRange a2DRange(a3DRange.getMinX(), a3DRange.getMinY(), a3DRange.getMaxX(), a3DRange.getMaxY());
323 
324 				bPaintIt = a2DRange.overlaps(maRasterRange);
325 			}
326 
327 			// check if it shall be painted regarding hiding of normals (backface culling)
328 			if(bPaintIt && !rPrimitive.getDoubleSided())
329 			{
330 				// get plane normal of polygon in view coordinates (with ZBuffer values),
331 				// left-handed coordinate system
332 				const basegfx::B3DVector aPlaneNormal(aFill.getB3DPolygon(0L).getNormal());
333 
334 				if(aPlaneNormal.getZ() > 0.0)
335 				{
336 					bPaintIt = false;
337 				}
338 			}
339 
340 			if(bPaintIt)
341 			{
342 				// prepare ObjectToEye in NormalTransform
343 				basegfx::B3DHomMatrix aNormalTransform(getViewInformation3D().getOrientation() * getViewInformation3D().getObjectTransformation());
344 
345 				if(getSdrSceneAttribute().getTwoSidedLighting())
346 				{
347 					// get plane normal of polygon in view coordinates (with ZBuffer values),
348 					// left-handed coordinate system
349 					const basegfx::B3DVector aPlaneNormal(aFill.getB3DPolygon(0L).getNormal());
350 
351 					if(aPlaneNormal.getZ() > 0.0)
352 					{
353 						// mirror normals
354 						aNormalTransform.scale(-1.0, -1.0, -1.0);
355 					}
356 				}
357 
358 				switch(aShadeMode)
359 				{
360 					case ::com::sun::star::drawing::ShadeMode_PHONG:
361 					{
362 						// phong shading. Transform normals to eye coor
363 						aFill.transformNormals(aNormalTransform);
364 						break;
365 					}
366 					case ::com::sun::star::drawing::ShadeMode_SMOOTH:
367 					{
368 						// gouraud shading. Transform normals to eye coor
369 						aFill.transformNormals(aNormalTransform);
370 
371 						// prepare color model parameters, evtl. use blend color
372 						const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor());
373 						const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular());
374 						const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission());
375 						const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity());
376 
377 						// solve color model for each normal vector, set colors at points. Clear normals.
378 						for(sal_uInt32 a(0L); a < aFill.count(); a++)
379 						{
380 							basegfx::B3DPolygon aPartFill(aFill.getB3DPolygon(a));
381 
382 							for(sal_uInt32 b(0L); b < aPartFill.count(); b++)
383 							{
384 								// solve color model. Transform normal to eye coor
385 								const basegfx::B3DVector aNormal(aPartFill.getNormal(b));
386 								const basegfx::BColor aSolvedColor(getSdrLightingAttribute().solveColorModel(aNormal, aColor, rSpecular, rEmission, nSpecularIntensity));
387 								aPartFill.setBColor(b, aSolvedColor);
388 							}
389 
390 							// clear normals on this part polygon and write it back
391 							aPartFill.clearNormals();
392 							aFill.setB3DPolygon(a, aPartFill);
393 						}
394 						break;
395 					}
396 					case ::com::sun::star::drawing::ShadeMode_FLAT:
397 					{
398 						// flat shading. Get plane vector in eye coordinates
399 						const basegfx::B3DVector aPlaneEyeNormal(aNormalTransform * rPrimitive.getB3DPolyPolygon().getB3DPolygon(0L).getNormal());
400 
401 						// prepare color model parameters, evtl. use blend color
402 						const basegfx::BColor aColor(getModulate() ? basegfx::BColor(1.0, 1.0, 1.0) : rPrimitive.getMaterial().getColor());
403 						const basegfx::BColor& rSpecular(rPrimitive.getMaterial().getSpecular());
404 						const basegfx::BColor& rEmission(rPrimitive.getMaterial().getEmission());
405 						const sal_uInt16 nSpecularIntensity(rPrimitive.getMaterial().getSpecularIntensity());
406 
407 						// solve color model for plane vector and use that color for whole plane
408 						aObjectColor = getSdrLightingAttribute().solveColorModel(aPlaneEyeNormal, aColor, rSpecular, rEmission, nSpecularIntensity);
409 						break;
410 					}
411 					default: // case ::com::sun::star::drawing::ShadeMode_DRAFT:
412 					{
413 						// draft, just use object color which is already set. Delete all other infos
414 						aFill.clearNormals();
415 						aFill.clearBColors();
416 						break;
417 					}
418 				}
419 
420 				// draw it to ZBuffer
421 				const attribute::MaterialAttribute3D aMaterial(
422 					maBColorModifierStack.getModifiedColor(aObjectColor),
423 					rPrimitive.getMaterial().getSpecular(),
424 					rPrimitive.getMaterial().getEmission(),
425 					rPrimitive.getMaterial().getSpecularIntensity());
426 
427 				rasterconvertB3DPolyPolygon(aMaterial, aFill);
428 			}
429 		}
430 
431 		void DefaultProcessor3D::impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate)
432 		{
433 			// transform group. Remember current transformations
434 			const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
435 
436 			// create new transformation; add new object transform from right side
437 			const geometry::ViewInformation3D aNewViewInformation3D(
438 				aLastViewInformation3D.getObjectTransformation() * rTransformCandidate.getTransformation(),
439 				aLastViewInformation3D.getOrientation(),
440 				aLastViewInformation3D.getProjection(),
441 				aLastViewInformation3D.getDeviceToView(),
442 				aLastViewInformation3D.getViewTime(),
443 				aLastViewInformation3D.getExtendedInformationSequence());
444 			updateViewInformation(aNewViewInformation3D);
445 
446 			// let break down recursively
447 			process(rTransformCandidate.getChildren());
448 
449 			// restore transformations
450 			updateViewInformation(aLastViewInformation3D);
451 		}
452 
453 		void DefaultProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive)
454 		{
455 			// it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch
456 			switch(rBasePrimitive.getPrimitive3DID())
457 			{
458 				case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D :
459 				{
460 					// GradientTexturePrimitive3D
461 					const primitive3d::GradientTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::GradientTexturePrimitive3D& >(rBasePrimitive);
462 					impRenderGradientTexturePrimitive3D(rPrimitive, false);
463 					break;
464 				}
465 				case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D :
466 				{
467 					// HatchTexturePrimitive3D
468 					static bool bDoHatchDecomposition(false);
469 
470 					if(bDoHatchDecomposition)
471 					{
472 						// let break down
473 						process(rBasePrimitive.get3DDecomposition(getViewInformation3D()));
474 					}
475 					else
476 					{
477 						// hatchTexturePrimitive3D
478 						const primitive3d::HatchTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::HatchTexturePrimitive3D& >(rBasePrimitive);
479 						impRenderHatchTexturePrimitive3D(rPrimitive);
480 					}
481 					break;
482 				}
483 				case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D :
484 				{
485 					// BitmapTexturePrimitive3D
486 					const primitive3d::BitmapTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::BitmapTexturePrimitive3D& >(rBasePrimitive);
487 					impRenderBitmapTexturePrimitive3D(rPrimitive);
488 					break;
489 				}
490 				case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D :
491 				{
492 					// TransparenceTexturePrimitive3D
493 					const primitive3d::TransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::TransparenceTexturePrimitive3D& >(rBasePrimitive);
494                     mnTransparenceCounter++;
495 					impRenderGradientTexturePrimitive3D(rPrimitive, true);
496                     mnTransparenceCounter--;
497 					break;
498 				}
499 				case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D :
500 				{
501 					// ModifiedColorPrimitive3D
502 					// Force output to unified color.
503 					const primitive3d::ModifiedColorPrimitive3D& rPrimitive = static_cast< const primitive3d::ModifiedColorPrimitive3D& >(rBasePrimitive);
504 					impRenderModifiedColorPrimitive3D(rPrimitive);
505 					break;
506 				}
507 				case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
508 				{
509 					// directdraw of PolygonHairlinePrimitive3D
510 					const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rBasePrimitive);
511 					impRenderPolygonHairlinePrimitive3D(rPrimitive);
512 					break;
513 				}
514 				case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
515 				{
516 					// directdraw of PolyPolygonMaterialPrimitive3D
517 					const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rBasePrimitive);
518 					impRenderPolyPolygonMaterialPrimitive3D(rPrimitive);
519 					break;
520 				}
521 				case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
522 				{
523 					// transform group (TransformPrimitive3D)
524 					impRenderTransformPrimitive3D(static_cast< const primitive3d::TransformPrimitive3D& >(rBasePrimitive));
525 					break;
526 				}
527 				default:
528 				{
529 					// process recursively
530 					process(rBasePrimitive.get3DDecomposition(getViewInformation3D()));
531 					break;
532 				}
533 			}
534 		}
535 
536 		DefaultProcessor3D::DefaultProcessor3D(
537 			const geometry::ViewInformation3D& rViewInformation,
538 			const attribute::SdrSceneAttribute& rSdrSceneAttribute,
539 			const attribute::SdrLightingAttribute& rSdrLightingAttribute)
540 		:	BaseProcessor3D(rViewInformation),
541 			mrSdrSceneAttribute(rSdrSceneAttribute),
542 			mrSdrLightingAttribute(rSdrLightingAttribute),
543 			maRasterRange(),
544 			maBColorModifierStack(),
545 			mpGeoTexSvx(),
546 			mpTransparenceGeoTexSvx(),
547             maDrawinglayerOpt(),
548             mnTransparenceCounter(0),
549 			mbModulate(false),
550 			mbFilter(false),
551 			mbSimpleTextureActive(false)
552 		{
553 			// a derivation has to set maRasterRange which is used in the basic render methods.
554 			// Setting to default here ([0.0 .. 1.0] in X,Y) to avoid problems
555 			maRasterRange.expand(basegfx::B2DTuple(0.0, 0.0));
556 			maRasterRange.expand(basegfx::B2DTuple(1.0, 1.0));
557 		}
558 
559 		DefaultProcessor3D::~DefaultProcessor3D()
560 		{
561 		}
562 	} // end of namespace processor3d
563 } // end of namespace drawinglayer
564 
565 //////////////////////////////////////////////////////////////////////////////
566 // eof
567