DYT/Tool/OpenSceneGraph-3.6.5/include/osgEarth/RenderSymbol
2024-12-25 07:49:36 +08:00

102 lines
3.4 KiB
C++

/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2020 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#pragma once
#include <osgEarth/Common>
#include <osgEarth/DepthOffset>
#include <osgEarth/Expression>
#include <osgEarth/Symbol>
#include <osg/Referenced>
#include <vector>
namespace osgEarth
{
/**
* Symbol that contains general rendering settings.
*/
class OSGEARTH_EXPORT RenderSymbol : public Symbol
{
public:
META_Object(osgEarth, RenderSymbol);
/** construct a render symbol */
RenderSymbol(const Config& conf =Config());
RenderSymbol(const RenderSymbol& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
/** whether to perform depth buffer testing */
OE_OPTION(bool, depthTest, true);
/** whether to force lighting on/off */
OE_OPTION(bool, lighting, true);
/** depth offset properties */
OE_OPTION(DepthOffsetOptions, depthOffset);
/** whether to force backface culling on or off */
OE_OPTION(bool, backfaceCulling, true);
/** applies a rendering order to affected geometry */
OE_OPTION(NumericExpression, order, 0);
/** clip plane number to activate. */
OE_OPTION(unsigned, clipPlane, 0);
/** discard fragments with alpha < threshold */
OE_OPTION(float, minAlpha, 0.0f);
/** hint to render in the transparent (depth-sorted) bin */
OE_OPTION(bool, transparent, false);
/** render bin to use for sorting */
OE_OPTION(std::string, renderBin);
/** enable decaling (lequal + polygonoffset) */
OE_OPTION(bool, decal, false);
/** maximum crease angle for normal smoothing (default=0) */
OE_OPTION(Angle, maxCreaseAngle, Angle(0, Units::DEGREES));
/** maximum angle at which to tessellate geometry when curving it to the earth's surface */
OE_OPTION(Angle, maxTessAngle, Angle(1, Units::DEGREES));
/** maximum visibility altitude */
OE_OPTION(Distance, maxAltitude, Distance(FLT_MAX, Units::METERS));
/** geometric error present when rendering */
OE_OPTION(Distance, geometricError, Distance(0.0, Units::METERS));
/** minimum distance (maps to 0) when rendering a signed distance field */
OE_OPTION(NumericExpression, sdfMinDistance, 0.0);
/** maximum distance (maps to 1) when rendering a signed distance field */
OE_OPTION(NumericExpression, sdfMaxDistance, 20.0);
public:
virtual Config getConfig() const;
virtual void mergeConfig( const Config& conf );
static void parseSLD(const Config& c, class Style& style);
void applyTo(osg::Node*) const;
protected:
virtual ~RenderSymbol() { }
};
} // namespace osgEarth