CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
TrVisMetafileDef.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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 "TrVisAtomics.h"
37#include "TrVisMetafileStream.h"
38
39// Forward declaration
40class OdTrRndSgExpand;
41
46
51{
53 {
54 kMfVisible = (1 << 0), // Visibility flag (false for invisible metafiles).
55 kMfHighlighted = (1 << 1), // Highlighting flag (always false for nested metafiles).
56 kMfTemporary = (1 << 2), // True for transient drawables, false for persistent drawables.
57 kMfNested = (1 << 3), // Marks nested drawables (true for drawables inside blocks, false for top-level always).
58 kMfBlockRef = (1 << 4), // Marks block reference container metafile.
59 kMfUtilitary = (1 << 5), // Marks utilitary metafiles (TTF characters cache for example).
60 kMfSectionable = (1 << 6), // Marks sectionable metafiles.
61 kMfComposite = (1 << 7), // Marks composite metafiles (containing data for multipass rendering).
62 kMfXRef = (1 << 8), // Marks external reference metafiles.
63 kMfRefEditFade = (1 << 9), // Fade metafile flag (true if metafile faded onto vectorizer side).
64 kMfCastShadows = (1 << 10), // Metafile geometry can cast shadows.
65 kMfRcivShadows = (1 << 11), // Metafile geometry can receive shadows.
66 kMfUnited = (1 << 12), // Mark metafiles, which represents union of metafile streams.
67 // Set of metafile flags which incompatibility must prevent Scene Graph metafiles joining.
69 };
70
71 OdUInt16 m_mfFlags; // Metafile bit flags
72 OdUInt16 m_rtFlags; // Ray-trace related flags
73 // Note: for 64bit configuration we has Int32 padding here, which can be used without container size grow.
74 // Or we can increase flags container size.
75 OdIntPtr m_revData; // Allocation address
76 OdTrRndSgExpand *m_pSgData; // Runtime scene graph rendering data
77
79
80 bool hasRevData() const { return m_revData != 0; }
81 OdIntPtr getRevData() const { return m_revData; }
82 void setRevData(OdIntPtr revData) { m_revData = revData; }
83
84 virtual void selfRelease();
85 virtual OdTrVisMetafileContainer *selfRenderStream() const { return const_cast<OdTrVisMetafileContainer*>(this); }
86
87 // OdFlatMetafileContainer overrides
88 OdFlatMetafileContainer *createMe() const;
89 // Clone stream data with gaps elimination
90 OdFlatMetafileContainer *clone(const Gap *pGaps = NULL) const
92 pClone->setCloned(this);
93 return pClone;
94 }
95
96 // Reset metafile flags
97 void resetMetafileFlags(OdUInt16 mfFlags = 0) { m_mfFlags = mfFlags; }
98
99 // Visiblity flag
100 bool isMetafileVisible() const { return GETBIT(m_mfFlags, kMfVisible); }
101 void setMetafileVisible(bool bSet) { SETBIT(m_mfFlags, kMfVisible, bSet); }
102
103 // Highlighting flag
106
107 // Temporary drawable flag
110
111 // Nested metafile flag
112 bool isNestedMetafile() const { return GETBIT(m_mfFlags, kMfNested); }
113 void setNestedMetafile(bool bSet) { SETBIT(m_mfFlags, kMfNested, bSet); }
114
115 // Block reference flag
117 void setBlockRefMetafile(bool bSet) { SETBIT(m_mfFlags, kMfBlockRef, bSet); }
118
119 // Utilitary metafile flag
122
123 // Sectionable metafile flag
126
127 // Composite metafile flag
130
131 // XRef metafile flag
132 bool isXRefMetafile() const { return GETBIT(m_mfFlags, kMfXRef); }
133 void setXRefMetafile(bool bSet) { SETBIT(m_mfFlags, kMfXRef, bSet); }
134
135 // RefEditFade metafile flag
137 void setMetafileFaded(bool bSet) { SETBIT(m_mfFlags, kMfRefEditFade, bSet); }
138
139 // CastShadows metafile flag
142
143 // RcivShadows metafile flag
146
147 // United metafile flag
148 bool isUnitedMetafile() const { return GETBIT(m_mfFlags, kMfUnited); }
149 void setUnitedMetafile(bool bSet) { SETBIT(m_mfFlags, kMfUnited, bSet); }
150
151 // Scene-Graph connection
152 bool hasSceneGraphExpands() const { return !!m_pSgData; }
153 void setSceneGraphExpands(OdTrRndSgExpand *pExpand) { m_pSgData = pExpand; }
155 OdTrRndSgExpand *sceneGraphExpands() const { return m_pSgData; }
156
157 // Calculate size of underlying stream
159 {
161 }
162
164 {
166 }
168 {
170 }
171};
172
177{
178 public:
179#ifdef TD_SINGLE_THREAD
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#else
183 static void addRef(OdTrVisMetafileContainer *pObj) { if (pObj) { OdTrVisAtomics::interlockedIncrement32(pObj->m_nRefs); } }
184 static void release(OdTrVisMetafileContainer *pObj) { if (pObj && !OdTrVisAtomics::interlockedDecrement32(pObj->m_nRefs)) pObj->selfRelease(); }
185#endif
186};
187
192
197{
198 // Metafile stream and related flags
200 // Metafile extents
202 // Generator viewport Id
204
206 {
207 m_pMetafile = NULL;
210 }
211};
212
213#include "TD_PackPop.h"
214
215#endif // ODTRVISMETAFILEDEF
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:141
OdTrVisId OdTrVisViewportId
Definition TrVisDefs.h:103
TPtr< OdTrVisMetafileContainer, OdTrVisMfContainerRelease > OdTrVisMetafileContainerPtr
OdSharedPtr< OdTrVisFlatMetafileContainer > OdTrVisFlatMetafileContainerPtr
OdFlatMetafileContainer * clone(const Gap *pGaps=NULL) const
static void addRef(OdTrVisMetafileContainer *pObj)
static void release(OdTrVisMetafileContainer *pObj)
Definition TPtr.h:76
GLsizeiptr size
Definition gles2_ext.h:182
OdUInt32 interlockedIncrement32(OdUInt32 &incVal)
OdUInt32 interlockedDecrement32(OdUInt32 &decVal)
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)
OdFlatMetafileContainer * clone(const Gap *pGaps=NULL) 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)
OdGeExtents3d m_extents
OdTrVisMetafileContainerPtr m_pMetafile
OdTrVisViewportId m_generatorId