CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
TrVisMetafileDef.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// GLES2 device metafile definition
24
25#ifndef ODTRVISMETAFILEDEF
26#define ODTRVISMETAFILEDEF
27
28#include "TD_PackPush.h"
29
30#include "UInt8Array.h"
31#include "Ge/GeExtents3d.h"
32#include "SharedPtr.h"
33#include "TPtr.h"
34
35#include "TrVisDefs.h"
36#include "TrVisMetafileStream.h"
37
38// Forward declaration
39class OdTrRndSgExpand;
40
45
50{
52 {
53 kMfVisible = (1 << 0), // Visibility flag (false for invisible metafiles).
54 kMfHighlighted = (1 << 1), // Highlighting flag (always false for nested metafiles).
55 kMfTemporary = (1 << 2), // True for transient drawables, false for persistent drawables.
56 kMfNested = (1 << 3), // Marks nested drawables (true for drawables inside blocks, false for top-level always).
57 kMfBlockRef = (1 << 4), // Marks block reference container metafile.
58 kMfUtilitary = (1 << 5), // Marks utilitary metafiles (TTF characters cache for example).
59 kMfSectionable = (1 << 6), // Marks sectionable metafiles.
60 kMfComposite = (1 << 7), // Marks composite metafiles (containing data for multipass rendering).
61 kMfXRef = (1 << 8), // Marks external reference metafiles.
62 kMfRefEditFade = (1 << 9), // Fade metafile flag (true if metafile faded onto vectorizer side).
63 kMfCastShadows = (1 << 10), // Metafile geometry can cast shadows.
64 kMfRcivShadows = (1 << 11), // Metafile geometry can receive shadows.
65 kMfUnited = (1 << 12), // Mark metafiles, which represents union of metafile streams.
66 // Set of metafile flags which incompatibility must prevent Scene Graph metafiles joining.
68 };
69
70 OdUInt16 m_mfFlags; // Metafile bit flags
71 OdUInt16 m_nRefs; // Reference counter
72 OdUInt32 m_revPartHigh; // Low-data reserved part
73 OdTrRndSgExpand *m_pSgData; // Runtime scene graph rendering data
74
76#if (OD_SIZEOF_PTR == 4) // 32 bit addresses
77 bool hasRevData() const { return m_revPartLow != 0; }
78 OdIntPtr getRevData() const { return (OdIntPtr)m_revPartLow; }
79 void setRevData(OdIntPtr revData) { m_revPartLow = (OdUInt32)revData; }
80#else
81 bool hasRevData() const { return (m_revPartLow != 0) || (m_revPartHigh != 0); }
82 OdIntPtr getRevData() const { return (OdIntPtr)((OdUInt64(m_revPartHigh) << OdUInt64(32)) | OdUInt64(m_revPartLow)); }
83 void setRevData(OdIntPtr revData) { const OdUInt64 rd = (OdUInt64)revData; m_revPartLow = (OdUInt32)rd; m_revPartHigh = (OdUInt32)(rd >> OdUInt64(32)); }
84#endif
85 virtual void selfRelease();
86 virtual OdTrVisMetafileContainer *selfRenderStream() const { return const_cast<OdTrVisMetafileContainer*>(this); }
87
88 // OdFlatMetafileContainer overrides
89 OdFlatMetafileContainer *createMe() const;
90 // Clone stream data with gaps elimination
91 OdFlatMetafileContainer *clone(const Gap *pGaps = NULL) const
92 { OdTrVisMetafileContainer *pClone = static_cast<OdTrVisMetafileContainer*>(OdFlatMetafileContainer::clone(pGaps));
93 pClone->setCloned(this);
94 return pClone;
95 }
96
97 // Reset metafile flags
98 void resetMetafileFlags(OdUInt16 mfFlags = 0) { m_mfFlags = mfFlags; }
99
100 // Visiblity flag
101 bool isMetafileVisible() const { return GETBIT(m_mfFlags, kMfVisible); }
102 void setMetafileVisible(bool bSet) { SETBIT(m_mfFlags, kMfVisible, bSet); }
103
104 // Highlighting flag
107
108 // Temporary drawable flag
111
112 // Nested metafile flag
113 bool isNestedMetafile() const { return GETBIT(m_mfFlags, kMfNested); }
114 void setNestedMetafile(bool bSet) { SETBIT(m_mfFlags, kMfNested, bSet); }
115
116 // Block reference flag
118 void setBlockRefMetafile(bool bSet) { SETBIT(m_mfFlags, kMfBlockRef, bSet); }
119
120 // Utilitary metafile flag
123
124 // Sectionable metafile flag
127
128 // Composite metafile flag
131
132 // XRef metafile flag
133 bool isXRefMetafile() const { return GETBIT(m_mfFlags, kMfXRef); }
134 void setXRefMetafile(bool bSet) { SETBIT(m_mfFlags, kMfXRef, bSet); }
135
136 // RefEditFade metafile flag
138 void setMetafileFaded(bool bSet) { SETBIT(m_mfFlags, kMfRefEditFade, bSet); }
139
140 // CastShadows metafile flag
143
144 // RcivShadows metafile flag
147
148 // United metafile flag
149 bool isUnitedMetafile() const { return GETBIT(m_mfFlags, kMfUnited); }
150 void setUnitedMetafile(bool bSet) { SETBIT(m_mfFlags, kMfUnited, bSet); }
151
152 // Scene-Graph connection
153 bool hasSceneGraphExpands() const { return !!m_pSgData; }
154 void setSceneGraphExpands(OdTrRndSgExpand *pExpand) { m_pSgData = pExpand; }
156 OdTrRndSgExpand *sceneGraphExpands() const { return m_pSgData; }
157
158 // Calculate size of underlying stream
160 {
162 }
163
165 {
167 }
169 {
171 }
172};
173
178{
179 public:
180 static void addRef(OdTrVisMetafileContainer* pObj) { if (pObj) { pObj->m_nRefs++; } }
181 static void release(OdTrVisMetafileContainer* pObj) { if (pObj) { pObj->m_nRefs--; if (!pObj->m_nRefs) pObj->selfRelease(); } }
182};
183
188
193{
194 // Metafile stream and related flags
196 // Metafile extents
198 // Generator viewport Id
200
202 {
203 m_pMetafile = NULL;
206 }
207};
208
209#include "TD_PackPop.h"
210
211#endif // ODTRVISMETAFILEDEF
unsigned int OdUInt32
unsigned short OdUInt16
ptrdiff_t OdIntPtr
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:516
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
const OdTrVisId kTrVisNullId
Definition: TrVisDefs.h:134
TPtr< OdTrVisMetafileContainer, OdTrVisMfContainerRelease > OdTrVisMetafileContainerPtr
OdSharedPtr< OdTrVisFlatMetafileContainer > OdTrVisFlatMetafileContainerPtr
static void addRef(OdTrVisMetafileContainer *pObj)
static void release(OdTrVisMetafileContainer *pObj)
Definition: TPtr.h:76
GLsizeiptr size
Definition: gles2_ext.h:182
OdIntPtr getRevData() const
void setUnitedMetafile(bool bSet)
virtual OdTrVisMetafileContainer * selfRenderStream() const
void setCloned(const OdTrVisMetafileContainer *pSrc)
void setRevData(OdIntPtr revData)
void setUtilitaryMetafile(bool bSet)
OdTrRndSgExpand * sceneGraphExpands() const
OdFlatMetafileContainer * createMe() const
void setNestedMetafile(bool bSet)
void setMetafileFaded(bool bSet)
void setMetafileReceiveShadows(bool bSet)
void setSceneGraphExpands(OdTrRndSgExpand *pExpand)
virtual void selfRelease()
void setMetafileVisible(bool bSet)
bool isMetafileHighlighted() const
OdFlatMetafileContainer * clone(const Gap *pGaps=NULL) const
bool isMetafileCastShadows() const
OdTrRndSgExpand * m_pSgData
void setCompositeMetafile(bool bSet)
void setMetafileHighlighted(bool bSet)
bool isMetafileReceiveShadows() const
void resetMetafileFlags(OdUInt16 mfFlags=0)
void setBlockRefMetafile(bool bSet)
void setTemporaryMetafile(bool bSet)
void setSectionableMetafile(bool bSet)
void setXRefMetafile(bool bSet)
void setMetafileCastShadows(bool bSet)
bool isSectionableMetafile() const
OdGeExtents3d m_extents
OdTrVisMetafileContainerPtr m_pMetafile
OdTrVisViewportId m_generatorId