GteSpatial.cpp
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #include <GTEnginePCH.h>
9 #include <Graphics/GteSpatial.h>
10 using namespace gte;
11 
13 {
14  // The mParent member is not reference counted by Spatial, so do not
15  // release it here.
16 }
17 
19  :
22  worldBoundIsCurrent(false),
23  name(""),
24  mParent(nullptr)
25 {
26 }
27 
28 void Spatial::Update(double applicationTime, bool initiator)
29 {
30  UpdateWorldData(applicationTime);
32  if (initiator)
33  {
35  }
36 }
37 
39  std::shared_ptr<Camera> const& camera, bool noCull)
40 {
41  if (culling == CULL_ALWAYS)
42  {
43  return;
44  }
45 
46  if (culling == CULL_NEVER)
47  {
48  noCull = true;
49  }
50 
51  unsigned int savePlaneState = culler.GetPlaneState();
52  if (noCull || culler.IsVisible(worldBound))
53  {
54  GetVisibleSet(culler, camera, noCull);
55  }
56  culler.SetPlaneState(savePlaneState);
57 }
58 
59 void Spatial::UpdateWorldData(double applicationTime)
60 {
61  // Update any controllers associated with this object.
62  UpdateControllers(applicationTime);
63 
64  // Update world transforms.
66  {
67  if (mParent)
68  {
69 #if defined(GTE_USE_MAT_VEC)
71 #else
73 #endif
74  }
75  else
76  {
78  }
79  }
80 }
81 
83 {
84  if (mParent)
85  {
88  }
89 }
Spatial * mParent
Definition: GteSpatial.h:87
CULL_ALWAYS
Definition: GteCuller.h:34
CULL_DYNAMIC
Definition: GteCuller.h:34
GLuint const GLchar * name
Definition: glcorearb.h:781
void OnGetVisibleSet(Culler &culler, std::shared_ptr< Camera > const &camera, bool noCull)
Definition: GteSpatial.cpp:38
bool worldTransformIsCurrent
Definition: GteSpatial.h:51
bool UpdateControllers(double applicationTime)
void SetPlaneState(unsigned int planeState)
Definition: GteCuller.h:128
CullingMode culling
Definition: GteSpatial.h:57
Transform worldTransform
Definition: GteSpatial.h:50
virtual void UpdateWorldBound()=0
void Update(double applicationTime=0.0, bool initiator=true)
Definition: GteSpatial.cpp:28
bool worldBoundIsCurrent
Definition: GteSpatial.h:58
virtual ~Spatial()
Definition: GteSpatial.cpp:12
unsigned int GetPlaneState() const
Definition: GteCuller.h:133
virtual void UpdateWorldData(double applicationTime)
Definition: GteSpatial.cpp:59
BoundingSphere worldBound
Definition: GteSpatial.h:56
virtual void GetVisibleSet(Culler &culler, std::shared_ptr< Camera > const &camera, bool noCull)=0
void PropagateBoundToRoot()
Definition: GteSpatial.cpp:82
bool IsVisible(BoundingSphere const &sphere)
Definition: GteCuller.cpp:65
Transform localTransform
Definition: GteSpatial.h:49


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:01