CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
TrRndDifferentialTransition.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 differential rendering state transitions container
24
25#ifndef ODTRRNDDIFFERENTIALTRANSITION
26#define ODTRRNDDIFFERENTIALTRANSITION
27
28#include "TD_PackPush.h"
29
30#include "OdVector.h"
32
41{
42 public:
50 struct Op
51 {
54 Op() {}
55 Op(OdUInt32 opcode) : m_opcode(opcode) { m_var.m_uint32 = 0; }
56 bool operator ==(const Op &op2) const { return (m_opcode == op2.m_opcode) && (m_var.m_uint32 == op2.m_var.m_uint32); }
57 bool operator !=(const Op &op2) const { return (m_opcode != op2.m_opcode) || (m_var.m_uint32 != op2.m_var.m_uint32); }
58 };
59 struct Ops
60 {
63 bool operator ==(const Ops &op2) const { return (m_fwd == op2.m_fwd) && (m_back == op2.m_back); }
64 bool operator !=(const Ops &op2) const { return (m_fwd != op2.m_fwd) || (m_back != op2.m_back); }
65 };
66 protected:
68 public:
71
72 Op make_op(OdUInt32 opcode) { return Op(opcode); }
73 Op make_op(OdUInt32 opcode, bool val) { Op op(opcode); op.m_var.m_bool = val; return op; }
74 Op make_op(OdUInt32 opcode, OdInt32 val) { Op op(opcode); op.m_var.m_int32 = val; return op; }
75 Op make_op(OdUInt32 opcode, OdUInt32 val) { Op op(opcode); op.m_var.m_uint32 = val; return op; }
76 Op make_op(OdUInt32 opcode, float val) { Op op(opcode); op.m_var.m_float = val; return op; }
77
78 void push_ops(const Op &fwd, const Op &back, bool bFwd = true)
79 {
80 Ops ops;
81 if (bFwd) { ops.m_fwd = fwd; ops.m_back = back; }
82 else { ops.m_fwd = back; ops.m_back = fwd; }
83 m_ops.push_back(ops);
84 }
85 void finalize() { m_ops.setPhysicalLength(m_ops.size()); }
86
88 {
89 bool m_bForward;
90 const Ops *m_pOps;
91 OdUInt32 m_nOps;
92 OdInt32 m_nCaret;
93 public:
94 Iterator(const OdVector<Ops, OdMemoryAllocator<Ops> > &ops, bool bForward)
95 : m_bForward(bForward)
96 {
97 m_pOps = ops.getPtr(); m_nOps = ops.size();
98 m_nCaret = (bForward) ? 0 : OdInt32(m_nOps) - 1;
99 }
100 bool done() const { return (m_nCaret < 0) || (OdUInt32(m_nCaret) >= m_nOps); }
101 bool next() { if (m_bForward) m_nCaret++; else m_nCaret--; return done(); }
102 bool back() { if (m_bForward) m_nCaret--; else m_nCaret++; return done(); }
103 const Op &op() const { return (m_bForward) ? m_pOps[m_nCaret].m_fwd : m_pOps[m_nCaret].m_back; }
104 };
105 Iterator iterator(bool bForward) const { return Iterator(m_ops, bForward); }
106
108 { const OdUInt32 opsSize = m_ops.size();
109 if (opsSize == dt2.m_ops.size())
110 { const Ops *pOps1 = m_ops.getPtr(), *pOps2 = dt2.m_ops.getPtr();
111 for (OdUInt32 nOp = 0; nOp < opsSize; nOp++)
112 { if (pOps1[nOp] != pOps2[nOp])
113 return false;
114 }
115 return true;
116 }
117 return false;
118 }
120 { const OdUInt32 opsSize = m_ops.size();
121 if (opsSize == dt2.m_ops.size())
122 { const Ops *pOps1 = m_ops.getPtr(), *pOps2 = dt2.m_ops.getPtr();
123 for (OdUInt32 nOp = 0; nOp < opsSize; nOp++)
124 { if (pOps1[nOp] != pOps2[nOp])
125 return true;
126 }
127 return false;
128 }
129 return true;
130 }
131};
132
137
138#include "TD_PackPop.h"
139
140#endif // ODTRRNDDIFFERENTIALTRANSITION
unsigned int OdUInt32
int OdInt32
OdSharedPtr< OdTrRndDifferentialTransition > OdTrRndDifferentialTransitionPtr
Iterator(const OdVector< Ops, OdMemoryAllocator< Ops > > &ops, bool bForward)
Op make_op(OdUInt32 opcode, OdInt32 val)
Op make_op(OdUInt32 opcode, OdUInt32 val)
Op make_op(OdUInt32 opcode, float val)
void push_ops(const Op &fwd, const Op &back, bool bFwd=true)
OdVector< Ops, OdMemoryAllocator< Ops > > m_ops
Op make_op(OdUInt32 opcode, bool val)
bool operator!=(const OdTrRndDifferentialTransition &dt2) const
Iterator iterator(bool bForward) const
bool operator==(const OdTrRndDifferentialTransition &dt2) const