GteFluid2ComputeDivergence.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 
13 #include <Graphics/GteTexture2.h>
14 
15 namespace gte
16 {
17 
18 class GraphicsEngine;
19 
21 {
22 public:
23  // Construction. Compute the divergence of the velocity vector field:
24  // Divergence(V(x,y)) = dV/dx + dV/dy. The derivatives are estimated
25  // using centered finite differences,
26  // dV/dx = (V(x+dx,y) - V(x-dx,y))/(2*dx)
27  // dV/dy = (V(x,y+dy) - V(x,y-dy))/(2*dy)
28  Fluid2ComputeDivergence(std::shared_ptr<ProgramFactory> const& factory,
29  int xSize, int ySize, int numXThreads, int numYThreads,
30  std::shared_ptr<ConstantBuffer> const& parameters);
31 
32  // Member access.
33  inline std::shared_ptr<Texture2> const& GetDivergence() const;
34 
35  // Compute the divergence of the velocity vector field for the input
36  // state.
37  void Execute(std::shared_ptr<GraphicsEngine> const& engine,
38  std::shared_ptr<Texture2> const& state);
39 
40 private:
41  int mNumXGroups, mNumYGroups;
42  std::shared_ptr<ComputeProgram> mComputeDivergence;
43  std::shared_ptr<Texture2> mDivergence;
44 
45  // Shader source code as strings.
46  static std::string const msGLSLSource;
47  static std::string const msHLSLSource;
48  static std::string const* msSource[ProgramFactory::PF_NUM_API];
49 };
50 
51 inline std::shared_ptr<Texture2> const& Fluid2ComputeDivergence::GetDivergence() const
52 {
53  return mDivergence;
54 }
55 
56 }
static std::string const msHLSLSource
std::shared_ptr< Texture2 > mDivergence
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
static std::string const msGLSLSource
std::shared_ptr< Texture2 > const & GetDivergence() const
std::shared_ptr< ComputeProgram > mComputeDivergence
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59