GteFluid2SolvePoisson.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. Solve the Poisson equation where numIterations is the
24  // number of Gauss-Seidel steps to use in Execute.
25  Fluid2SolvePoisson(std::shared_ptr<ProgramFactory> const& factory,
26  int xSize, int ySize, int numXThreads, int numYThreads,
27  std::shared_ptr<ConstantBuffer> const& parameters, int numIterations);
28 
29  // Member access. The texels are (velocity.x, velocity.y, 0, density).
30  // The third component is unused in the simulation (a 3D simulation will
31  // store velocity.z in this component).
32  inline std::shared_ptr<Texture2> const& GetPoisson() const;
33 
34  // Update the state for the fluid simulation.
35  void Execute(std::shared_ptr<GraphicsEngine> const& engine,
36  std::shared_ptr<Texture2> const& divergence);
37 
38 private:
39  int mNumXGroups, mNumYGroups;
40  std::shared_ptr<ComputeProgram> mZeroPoisson;
41  std::shared_ptr<ComputeProgram> mSolvePoisson;
42  std::shared_ptr<ComputeProgram> mWriteXEdge;
43  std::shared_ptr<ComputeProgram> mWriteYEdge;
44  std::shared_ptr<Texture2> mPoisson0;
45  std::shared_ptr<Texture2> mPoisson1;
47 
48  // Shader source code as strings.
55  static std::string const* msZeroSource[ProgramFactory::PF_NUM_API];
56  static std::string const* msSolveSource[ProgramFactory::PF_NUM_API];
57  static std::string const* msEnforceSource[ProgramFactory::PF_NUM_API];
58 };
59 
60 inline std::shared_ptr<Texture2> const& Fluid2SolvePoisson::GetPoisson() const
61 {
62  return mPoisson0;
63 }
64 
65 }
static std::string const msHLSLSolveSource
std::shared_ptr< ComputeProgram > mSolvePoisson
static std::string const msHLSLZeroSource
static std::string const msGLSLEnforceSource
std::shared_ptr< ComputeProgram > mWriteXEdge
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
std::shared_ptr< Texture2 > const & GetPoisson() const
std::shared_ptr< ComputeProgram > mZeroPoisson
std::shared_ptr< Texture2 > mPoisson0
static std::string const msGLSLZeroSource
std::shared_ptr< Texture2 > mPoisson1
std::shared_ptr< ComputeProgram > mWriteYEdge
static std::string const msHLSLEnforceSource
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
static std::string const msGLSLSolveSource


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