/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #include "OdaCommon.h" #include "Gs/GsBaseVectorizer.h" #include "GsBackgroundImpl.h" // OdGsBackgroundImpl OdGsBackgroundImpl::OdGsBackgroundImpl(const OdGsBackgroundModule *pModule) : m_pModule(pModule) { } void OdGsBackgroundImpl::fillBackgroundRect(const OdGsViewImpl& view, OdGePoint3d rect[5]) { OdGePoint2d smin, smax; // This may take problems in perspective projection view.viewportDcCorners(smin, smax); // Found backClip value for current projection /*double back_clip_value; if (view.mode() != OdGsView::k2DOptimized) { OdGeMatrix3d back_clip_mat = view.projectionMatrix().invert(); OdGePoint3d back_clip(0.0, 0.0, 0.99); back_clip.transformBy(back_clip_mat); back_clip_value = back_clip.z; } else { back_clip_value = 0.0; }*/ double back_clip_value = 0.0; // rect[0].set(smin.x, smin.y, back_clip_value); rect[1].set(smax.x, smin.y, back_clip_value); rect[2].set(smax.x, smax.y, back_clip_value); rect[3].set(smin.x, smax.y, back_clip_value); rect[4] = rect[0]; } OdGsBackgroundImpl::RenderingModeHolder OdGsBackgroundImpl::setRenderingMode(OdGsBaseVectorizer& view) { RenderingModeHolder holder; holder.lft = view.drawContext()->subEntityTraits().fillType(); holder.lrm = view.getRenderMode(); //view.setMode(OdGsView::kFlatShaded); //view.drawContext()->subEntityTraits().setFillType(kOdGiFillAlways); //view.ray(OdGePoint3d::kOrigin, OdGePoint3d::kOrigin); // @@@TEST return holder; } void OdGsBackgroundImpl::restoreRenderingMode(OdGsBaseVectorizer& /*view*/, const OdGsBackgroundImpl::RenderingModeHolder& /*holder*/) { //view.drawContext()->subEntityTraits().setFillType(holder.lft); //view.setMode(holder.lrm); //view.ray(OdGePoint3d::kOrigin, OdGePoint3d::kOrigin); // @@@TEST } OdCmEntityColor &OdGsBackgroundImpl::VertexColorResolver::setColor(const OdCmEntityColor &color, OdGsBaseVectorizer& view) { // #CORE-16160 : Typical devices doesn't expect indexed colors in vertex data. switch (color.colorMethod()) { case OdCmEntityColor::kByACI: case OdCmEntityColor::kByDgnIndex: OdCmEntityColor::operator =(ODTOCMCOLOR(view.paletteColor(color.colorIndex()))); break; default: OdCmEntityColor::operator =(color); } return *this; } //