CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GsViewLocalId.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
24#ifndef __OD_GS_VIEW_LOCAL_ID__
25#define __OD_GS_VIEW_LOCAL_ID__
26
27#include "Gs/Gs.h"
28
29#include "TD_PackPush.h"
30
31class OdGsViewImpl;
32class OdGsBaseModel;
33
34/* Note:
35 All GsNode's locally owned by only one GsModel, so GsNode metafiles is also owned by GsModel. GsModel could be shared
36 between different rendering modules. But viewportId is creating from SlotManager owned by rendering device, so
37 viewportId's for different devices will lie in same range, so couldn't be used as unique view identifier inside
38 GsModel. To solve problem we create for each GsModel their own SlotManager which is used for generate unique
39 viewportId for each view referenced by GsModel. This localViewportId is stored on GsModel side, view access to it
40 and store it's own copy localViewportId for optimization purposes (this is not problem for MT because only one
41 GsModel is used per parallel vectorization.
42*/
43
51{
52 /* Note: the initial registration will be done on addViewRef. But for example MT ghost views or views
53 of layout helper will do registration on first update. In this case first of all we
54 search exist registered view, if it is doesn't exist we search view with similar viewportId
55 and similar device (case of MT ghost view and layout helper view). Composite device
56 must register view ID manually. */
57 public:
58 // Call on view deletion to clear model view entry
59 virtual void onViewDelete(OdGsViewImpl *pView) = 0;
60 // Manually reset Id
61 virtual void resetViewId(OdGsViewImpl *pView, OdUInt32 nId) = 0;
62 // Get current view Id (or -1 if view doesn't registered)
63 virtual OdUInt32 getViewId(OdGsViewImpl *pView) = 0;
64 // Make view registration (you must check first does id is already registered)
65 virtual OdUInt32 registerView(OdGsViewImpl *pView) = 0;
66 // Get maximum registered Id
67 virtual OdUInt32 getMaxId() const = 0;
68
70};
72
79// Used in OdGsViewImpl
81{
82 protected:
87 public:
88 explicit OdGsViewLocalId(OdGsViewImpl *pView = NULL)
89 : m_pLocalIdModel(NULL)
90 , m_localId(0)
91 , m_pView(pView)
92 {
93 }
95
96 void setView(OdGsViewImpl *pView)
97 {
98 m_pView = pView;
99 }
101 {
102 return m_pView;
103 }
104
105 // Gets local viewport Id optimized
107 {
108 if (m_pLocalIdModel == pModel)
109 return m_localId;
110 m_pLocalIdModel = pModel;
111 return m_localId = getLocalViewportId(pModel);
112 }
113 // Gets local viewport Id directly from GsModel
115
116 // Reset current state
117 void reset()
118 {
119 m_pLocalIdModel = NULL;
120 m_localId = 0;
121 }
122
124 {
125 return m_localIdRefs;
126 }
127};
128
129#include "TD_PackPop.h"
130
131#endif // __OD_GS_VIEW_LOCAL_ID__
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
OdSmartPtr< OdGsBaseModelLocalIds > OdGsBaseModelLocalIdsPtr
Definition: GsViewLocalId.h:71
unsigned int OdUInt32
virtual void resetViewId(OdGsViewImpl *pView, OdUInt32 nId)=0
virtual void onViewDelete(OdGsViewImpl *pView)=0
virtual OdUInt32 registerView(OdGsViewImpl *pView)=0
static OdSmartPtr< OdGsBaseModelLocalIds > createObject()
virtual OdUInt32 getMaxId() const =0
virtual OdUInt32 getViewId(OdGsViewImpl *pView)=0
OdUInt32 m_localId
Definition: GsViewLocalId.h:84
void setView(OdGsViewImpl *pView)
Definition: GsViewLocalId.h:96
OdUInt32 getLocalViewportId(const OdGsBaseModel *pModel) const
const OdGsBaseModel * m_pLocalIdModel
Definition: GsViewLocalId.h:83
OdArray< OdGsBaseModelLocalIdsPtr > & refs()
OdGsViewImpl * view() const
OdGsViewImpl * m_pView
Definition: GsViewLocalId.h:86
OdArray< OdGsBaseModelLocalIdsPtr > m_localIdRefs
Definition: GsViewLocalId.h:85
OdUInt32 localViewportId(const OdGsBaseModel *pModel) const
OdGsViewLocalId(OdGsViewImpl *pView=NULL)
Definition: GsViewLocalId.h:88