CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
TrVisFogDef.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23// Viewport fog definition
24
25#ifndef ODTRVISFOGDEF
26#define ODTRVISFOGDEF
27
28#include "TD_PackPush.h"
29
34{
35 // Flags
36 enum Flags
37 {
38 // Enable fog.
39 kEnableFog = (1 << 0),
40 // Display fog on background.
41 kFogBackground = (1 << 1)
42 };
43 // Fog flags
45 // Fog color
47 // Fog distances (in world coordinates)
49 // Fog densities (in 0-1 range)
51
52 void resetFlags(OdUInt16 nFlags = 0)
53 {
54 m_flags = nFlags;
55 }
57 {
58 resetFlags();
59 m_color = 0xFFFFFFFF;
60 m_fDistNear = m_fDistFar = 0.0;
61 m_fDensNear = 0.0; m_fDensFar = 1.0;
62 }
63
64 void enableFog(bool bSet) { SETBIT(m_flags, kEnableFog, bSet); }
65 bool isFogEnabled() const { return GETBIT(m_flags, kEnableFog); }
66
69
71 ODCOLORREF color() const { return m_color; }
72
73 void setDistances(double fNear, double fFar) { m_fDistNear = fNear; m_fDistFar = fFar; }
74 double nearDistance() const { return m_fDistNear; }
75 double farDistance() const { return m_fDistFar; }
76 double depthRange() const { return m_fDistFar - m_fDistNear; }
77
78 void setDensities(double fNear, double fFar) { m_fDensNear = fNear; m_fDensFar = fFar; }
79 double nearDensity() const { return m_fDensNear; }
80 double farDensity() const { return m_fDensFar; }
81 double densityRange() const { return m_fDensFar - m_fDensNear; }
82
83 bool operator ==(const OdTrVisFogDef &fog) const
84 {
85 if (isFogEnabled() != fog.isFogEnabled())
86 return false;
87 if (!isFogEnabled())
88 return true;
90 (color() == fog.color()) && OdEqual(nearDistance(), fog.nearDistance()) &&
93 }
94 bool operator !=(const OdTrVisFogDef &fog) const
95 {
96 if (isFogEnabled() != fog.isFogEnabled())
97 return true;
98 if (!isFogEnabled())
99 return false;
101 (color() != fog.color()) || !OdEqual(nearDistance(), fog.nearDistance()) ||
103 !OdEqual(farDensity(), fog.farDensity());
104 }
105};
106
107#include "TD_PackPop.h"
108
109#endif // ODTRVISFOGDEF
#define ODCOLORREF
Definition: OdPlatform.h:933
unsigned short OdUInt16
bool OdEqual(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:542
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:516
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
bool operator!=(const OdTrVisFogDef &fog) const
Definition: TrVisFogDef.h:94
void enableFogAtBackground(bool bSet)
Definition: TrVisFogDef.h:67
double densityRange() const
Definition: TrVisFogDef.h:81
ODCOLORREF m_color
Definition: TrVisFogDef.h:46
double farDistance() const
Definition: TrVisFogDef.h:75
void enableFog(bool bSet)
Definition: TrVisFogDef.h:64
void setDefault()
Definition: TrVisFogDef.h:56
void setColor(ODCOLORREF color)
Definition: TrVisFogDef.h:70
void resetFlags(OdUInt16 nFlags=0)
Definition: TrVisFogDef.h:52
double m_fDistNear
Definition: TrVisFogDef.h:48
double depthRange() const
Definition: TrVisFogDef.h:76
double m_fDensNear
Definition: TrVisFogDef.h:50
bool isFogAtBackgroundEnabled() const
Definition: TrVisFogDef.h:68
OdUInt16 m_flags
Definition: TrVisFogDef.h:44
double m_fDensFar
Definition: TrVisFogDef.h:50
bool isFogEnabled() const
Definition: TrVisFogDef.h:65
double farDensity() const
Definition: TrVisFogDef.h:80
void setDensities(double fNear, double fFar)
Definition: TrVisFogDef.h:78
double m_fDistFar
Definition: TrVisFogDef.h:48
bool operator==(const OdTrVisFogDef &fog) const
Definition: TrVisFogDef.h:83
double nearDensity() const
Definition: TrVisFogDef.h:79
double nearDistance() const
Definition: TrVisFogDef.h:74
ODCOLORREF color() const
Definition: TrVisFogDef.h:71
void setDistances(double fNear, double fFar)
Definition: TrVisFogDef.h:73