Free Electron
SurfaceAccessorOsd.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __opensubdiv_SurfaceAccessorOsd_h__
8 #define __opensubdiv_SurfaceAccessorOsd_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Accessor for OpenSubdiv
17 
18  @ingroup opensubdiv
19 *//***************************************************************************/
20 class FE_DL_EXPORT SurfaceAccessorOsd:
21  virtual public SurfaceAccessorCatalog
22 {
23  public:
24  SurfaceAccessorOsd(void);
25 virtual ~SurfaceAccessorOsd(void);
26 
27  using SurfaceAccessorCatalog::set;
28  using SurfaceAccessorCatalog::spatialVector;
29 
30  //* as SurfaceAccessorI
31 virtual U32 count(void) const;
32 virtual U32 subCount(U32 a_index) const;
33 
34 virtual I32 integer(U32 a_index,U32 a_subIndex=0);
35 
36 virtual SpatialVector spatialVector(U32 a_index,U32 a_subIndex=0);
37 
38 virtual void set(U32 a_index,U32 a_subIndex,I32 a_integer);
39 
40  private:
41 
42  class Vertex: public SpatialVector
43  {
44  public:
45  Vertex(void) {}
46 
47  Vertex(Vertex const& a_src):
49  { *this=a_src; }
50 
51  void Clear(void* a_void=NULL)
52  { fe::set(*this); }
53 
54  void AddWithWeight(Vertex const& a_src,float a_weight)
55  { (*this)[0]+=a_src[0]*a_weight;
56  (*this)[1]+=a_src[1]*a_weight;
57  (*this)[2]+=a_src[2]*a_weight; }
58 
59  void SetPosition(float a_x, float a_y, float a_z)
60  { fe::set(*this,a_x,a_y,a_z); }
61 
62  const Real* GetPosition(void) const
63  { return raw(); }
64  };
65 };
66 
67 } /* namespace ext */
68 } /* namespace fe */
69 
70 #endif /* __opensubdiv_SurfaceAccessorOsd_h__ */
Accessor backed with a Catalog.
Definition: SurfaceAccessorCatalog.h:22
kernel
Definition: namespace.dox:3
Accessor for OpenSubdiv.
Definition: SurfaceAccessorOsd.h:20