CFx SDK Documentation  2023 SP0
TrRndDifferentialTransition.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, 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 Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 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"
31 #include "../TrVisStaticSharedPtr.h"
32 
41 {
42  public:
43  union Var
44  {
45  bool m_bool;
48  float m_float;
49  };
50  struct Op
51  {
54  };
55  struct Ops
56  {
59  };
60  protected:
62  public:
65 
66  Op make_op(OdUInt32 opcode) { Op op; op.m_opcode = opcode; return op; }
67  Op make_op(OdUInt32 opcode, bool val) { Op op; op.m_opcode = opcode; op.m_var.m_bool = val; return op; }
68  Op make_op(OdUInt32 opcode, OdInt32 val) { Op op; op.m_opcode = opcode; op.m_var.m_int32 = val; return op; }
69  Op make_op(OdUInt32 opcode, OdUInt32 val) { Op op; op.m_opcode = opcode; op.m_var.m_uint32 = val; return op; }
70  Op make_op(OdUInt32 opcode, float val) { Op op; op.m_opcode = opcode; op.m_var.m_float = val; return op; }
71 
72  void push_ops(const Op &fwd, const Op &back, bool bFwd = true)
73  {
74  Ops ops;
75  if (bFwd) {ops.m_fwd = fwd; ops.m_back = back;}
76  else {ops.m_fwd = back; ops.m_back = fwd;}
77  m_ops.push_back(ops);
78  }
79  void finalize() { m_ops.setPhysicalLength(m_ops.size()); }
80 
81  class Iterator
82  {
83  bool m_bForward;
84  const Ops *m_pOps;
85  OdUInt32 m_nOps;
86  OdInt32 m_nCaret;
87  public:
88  Iterator(const OdVector<Ops, OdMemoryAllocator<Ops> > &ops, bool bForward)
89  : m_bForward(bForward)
90  {
91  m_pOps = ops.getPtr(); m_nOps = ops.size();
92  m_nCaret = (bForward) ? 0 : OdInt32(m_nOps) - 1;
93  }
94  bool done() const { return (m_nCaret < 0) || (OdUInt32(m_nCaret) >= m_nOps); }
95  bool next() { if (m_bForward) m_nCaret++; else m_nCaret--; return done(); }
96  bool back() { if (m_bForward) m_nCaret--; else m_nCaret++; return done(); }
97  const Op &op() const { return (m_bForward) ? m_pOps[m_nCaret].m_fwd : m_pOps[m_nCaret].m_back; }
98  };
99  Iterator iterator(bool bForward) const { return Iterator(m_ops, bForward); }
100 };
101 
106 
107 #include "TD_PackPop.h"
108 
109 #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)
Iterator iterator(bool bForward) const