GteVisual.h
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 #pragma once
9 
11 #include <Graphics/GteSpatial.h>
14 
15 namespace gte
16 {
17 
18 class GTE_IMPEXP Visual : public Spatial
19 {
20 public:
21  // Construction and destruction.
22  virtual ~Visual();
23  Visual(
24  std::shared_ptr<VertexBuffer> const& vbuffer =
25  std::shared_ptr<VertexBuffer>(),
26  std::shared_ptr<IndexBuffer> const& ibuffer =
27  std::shared_ptr<IndexBuffer>(),
28  std::shared_ptr<VisualEffect> const& effect =
29  std::shared_ptr<VisualEffect>());
30 
31  // Member access.
32  inline void SetVertexBuffer(std::shared_ptr<VertexBuffer> const& vbuffer);
33  inline void SetIndexBuffer(std::shared_ptr<IndexBuffer> const& ibuffer);
34  inline void SetEffect(std::shared_ptr<VisualEffect> const& effect);
35  inline std::shared_ptr<VertexBuffer> const& GetVertexBuffer() const;
36  inline std::shared_ptr<IndexBuffer> const& GetIndexBuffer() const;
37  inline std::shared_ptr<VisualEffect> const& GetEffect() const;
38 
39  // Support for geometric updates.
40  bool UpdateModelBound();
41  bool UpdateModelNormals();
42 
43  // Public member access.
45 
46 protected:
47  // Support for geometric updates.
48  inline virtual void UpdateWorldBound();
49 
50  // Support for hierarchical culling.
51  inline virtual void GetVisibleSet(Culler& culler,
52  std::shared_ptr<Camera> const& camera, bool noCull);
53 
54  std::shared_ptr<VertexBuffer> mVBuffer;
55  std::shared_ptr<IndexBuffer> mIBuffer;
56  std::shared_ptr<VisualEffect> mEffect;
57 };
58 
59 
61  std::shared_ptr<VertexBuffer> const& vbuffer)
62 {
63  mVBuffer = vbuffer;
64 }
65 
67  std::shared_ptr<IndexBuffer> const& ibuffer)
68 {
69  mIBuffer = ibuffer;
70 }
71 
72 inline void Visual::SetEffect(std::shared_ptr<VisualEffect> const& effect)
73 {
74  mEffect = effect;
75 }
76 
77 inline std::shared_ptr<VertexBuffer> const& Visual::GetVertexBuffer() const
78 {
79  return mVBuffer;
80 }
81 
82 inline std::shared_ptr<IndexBuffer> const& Visual::GetIndexBuffer() const
83 {
84  return mIBuffer;
85 }
86 
87 inline std::shared_ptr<VisualEffect> const& Visual::GetEffect() const
88 {
89  return mEffect;
90 }
91 
93 {
94  modelBound.TransformBy(worldTransform, worldBound);
95 }
96 
97 inline void Visual::GetVisibleSet(Culler& culler,
98  std::shared_ptr<Camera> const&, bool)
99 {
100  culler.Insert(this);
101 }
102 
103 
104 }
std::shared_ptr< VertexBuffer > mVBuffer
Definition: GteVisual.h:54
BoundingSphere modelBound
Definition: GteVisual.h:44
virtual void GetVisibleSet(Culler &culler, std::shared_ptr< Camera > const &camera, bool noCull)
Definition: GteVisual.h:97
std::shared_ptr< VertexBuffer > const & GetVertexBuffer() const
Definition: GteVisual.h:77
virtual void Insert(Visual *visible)
Definition: GteCuller.cpp:104
std::shared_ptr< IndexBuffer > const & GetIndexBuffer() const
Definition: GteVisual.h:82
std::shared_ptr< VisualEffect > const & GetEffect() const
Definition: GteVisual.h:87
void SetVertexBuffer(std::shared_ptr< VertexBuffer > const &vbuffer)
Definition: GteVisual.h:60
virtual void UpdateWorldBound()
Definition: GteVisual.h:92
void SetEffect(std::shared_ptr< VisualEffect > const &effect)
Definition: GteVisual.h:72
std::shared_ptr< IndexBuffer > mIBuffer
Definition: GteVisual.h:55
void SetIndexBuffer(std::shared_ptr< IndexBuffer > const &ibuffer)
Definition: GteVisual.h:66
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
std::shared_ptr< VisualEffect > mEffect
Definition: GteVisual.h:56


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