CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiTransformed.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
25
26
27// GiBaseVectorizer.h: interface for the OdGiBaseVectorizer class.
28//
30
31#ifndef _ODGITRANSFORMED_INCLUDED_
32#define _ODGITRANSFORMED_INCLUDED_
33
34
35#include "Gi/GiBaseVectorizer.h"
36#include "OdStack.h"
37
38#include "TD_PackPush.h"
39
45template <class T> class OdGiTransformed : public T
46{
50 struct Transforms
51 {
55 Transforms() : bWorldToModelValid(false) {}
57 OdGeMatrix3d xModelToWorld;
59 mutable OdGeMatrix3d xWorldToModel;
61 mutable bool bWorldToModelValid;
62 };
63 OdStack<Transforms> m_TransformStack;
64
65 public:
66
72 {
73 const Transforms* pPrev = m_TransformStack.top();
74 Transforms* pNew = m_TransformStack.push();
75 if(pPrev)
76 {
77 pNew->xModelToWorld.setToProduct(pPrev->xModelToWorld, xMat);
78 }
79 else
80 {
81 pNew->xModelToWorld = xMat;
82 }
83 }
84
89 void pushModelTransform(const OdGeVector3d& vNormal)
90 {
92 }
93
98 {
99 m_TransformStack.pop();
100 }
101
106 {
107 if(m_TransformStack.top())
108 return m_TransformStack.top()->xModelToWorld;
110 }
111
116 {
117 const Transforms* pTop = m_TransformStack.top();
118 if(pTop)
119 {
120 if(!pTop->bWorldToModelValid)
121 {
122 pTop->xWorldToModel = pTop->xModelToWorld.inverse();
123 pTop->bWorldToModelValid = true;
124 }
125 return pTop->xWorldToModel;
126 }
128 }
129};
130
131#include "TD_PackPop.h"
132
133#endif // #ifndef _ODGITRANSFORMED_INCLUDED_
static OdGeMatrix3d planeToWorld(const OdGeVector3d &normal)
static GE_STATIC_EXPORT const OdGeMatrix3d kIdentity
Definition: GeMatrix3d.h:97
void popModelTransform()
Definition: GiTransformed.h:97
OdGeMatrix3d getModelToWorldTransform() const
OdGeMatrix3d getWorldToModelTransform() const
void pushModelTransform(const OdGeMatrix3d &xMat)
Definition: GiTransformed.h:71
void pushModelTransform(const OdGeVector3d &vNormal)
Definition: GiTransformed.h:89
const T * top() const
Definition: OdStack.h:77
void push(const T &inVal)
Definition: OdStack.h:61
void pop(T &outVal)
Definition: OdStack.h:70