CFx SDK Documentation  2020SP3
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
OdTrRndDifferentialTransition::make_op
Op make_op(OdUInt32 opcode, float val)
Definition: TrRndDifferentialTransition.h:70
OdTrRndDifferentialTransition::Op
Definition: TrRndDifferentialTransition.h:51
OdTrRndDifferentialTransition::~OdTrRndDifferentialTransition
~OdTrRndDifferentialTransition()
Definition: TrRndDifferentialTransition.h:64
OdTrRndDifferentialTransition::Ops::m_fwd
Op m_fwd
Definition: TrRndDifferentialTransition.h:57
OdTrRndDifferentialTransition::Var::m_int32
OdInt32 m_int32
Definition: TrRndDifferentialTransition.h:46
OdTrRndDifferentialTransition::Iterator::back
bool back()
Definition: TrRndDifferentialTransition.h:96
OdTrRndDifferentialTransition::m_ops
OdVector< Ops, OdMemoryAllocator< Ops > > m_ops
Definition: TrRndDifferentialTransition.h:61
OdVector.h
OdSharedPtr< OdTrRndDifferentialTransition >
OdTrRndDifferentialTransition::Var::m_float
float m_float
Definition: TrRndDifferentialTransition.h:48
OdTrRndDifferentialTransition::Var::m_uint32
OdUInt32 m_uint32
Definition: TrRndDifferentialTransition.h:47
OdTrRndDifferentialTransition::Iterator::Iterator
Iterator(const OdVector< Ops, OdMemoryAllocator< Ops > > &ops, bool bForward)
Definition: TrRndDifferentialTransition.h:88
TD_PackPop.h
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdTrRndDifferentialTransitionPtr
OdSharedPtr< OdTrRndDifferentialTransition > OdTrRndDifferentialTransitionPtr
Definition: TrRndDifferentialTransition.h:105
OdTrRndDifferentialTransition::make_op
Op make_op(OdUInt32 opcode, OdInt32 val)
Definition: TrRndDifferentialTransition.h:68
OdTrRndDifferentialTransition::Ops
Definition: TrRndDifferentialTransition.h:56
OdTrRndDifferentialTransition::Ops::m_back
Op m_back
Definition: TrRndDifferentialTransition.h:58
OdTrRndDifferentialTransition::make_op
Op make_op(OdUInt32 opcode, OdUInt32 val)
Definition: TrRndDifferentialTransition.h:69
OdTrRndDifferentialTransition::make_op
Op make_op(OdUInt32 opcode, bool val)
Definition: TrRndDifferentialTransition.h:67
OdInt32
int OdInt32
Definition: OdPlatformSettings.h:782
OdTrRndDifferentialTransition::Iterator::op
const Op & op() const
Definition: TrRndDifferentialTransition.h:97
OdMemoryAllocator
Definition: OdArray.h:49
OdTrRndDifferentialTransition
Definition: TrRndDifferentialTransition.h:41
OdVector
Definition: OdVector.h:54
OdTrRndDifferentialTransition::Iterator
Definition: TrRndDifferentialTransition.h:82
TD_PackPush.h
OdTrRndDifferentialTransition::Var::m_bool
bool m_bool
Definition: TrRndDifferentialTransition.h:45
OdTrRndDifferentialTransition::iterator
Iterator iterator(bool bForward) const
Definition: TrRndDifferentialTransition.h:99
OdTrRndDifferentialTransition::Iterator::done
bool done() const
Definition: TrRndDifferentialTransition.h:94
OdTrRndDifferentialTransition::OdTrRndDifferentialTransition
OdTrRndDifferentialTransition()
Definition: TrRndDifferentialTransition.h:63
OdTrRndDifferentialTransition::push_ops
void push_ops(const Op &fwd, const Op &back, bool bFwd=true)
Definition: TrRndDifferentialTransition.h:72
OdTrRndDifferentialTransition::Op::m_opcode
OdUInt32 m_opcode
Definition: TrRndDifferentialTransition.h:52
OdTrRndDifferentialTransition::Iterator::next
bool next()
Definition: TrRndDifferentialTransition.h:95
OdTrRndDifferentialTransition::make_op
Op make_op(OdUInt32 opcode)
Definition: TrRndDifferentialTransition.h:66
OdTrRndDifferentialTransition::finalize
void finalize()
Definition: TrRndDifferentialTransition.h:79
OdTrRndDifferentialTransition::Op::m_var
Var m_var
Definition: TrRndDifferentialTransition.h:53
OdTrRndDifferentialTransition::Var
Definition: TrRndDifferentialTransition.h:44