GteFluid3SolvePoisson.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/GteTexture3.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  Fluid3SolvePoisson(std::shared_ptr<ProgramFactory> const& factory,
26  int xSize, int ySize, int zSize, int numXThreads, int numYThreads, int numZThreads,
27  std::shared_ptr<ConstantBuffer> const& parameters, int numIterations);
28 
29  // Member access. The texels are (velocity.xyz, density).
30  inline std::shared_ptr<gte::Texture3> const& GetPoisson() const;
31 
32  // Update the state for the fluid simulation.
33  void Execute(std::shared_ptr<GraphicsEngine> const& engine,
34  std::shared_ptr<Texture3> const& divergence);
35 
36 private:
37  int mNumXGroups, mNumYGroups, mNumZGroups;
38  std::shared_ptr<ComputeProgram> mZeroPoisson;
39  std::shared_ptr<ComputeProgram> mSolvePoisson;
40  std::shared_ptr<ComputeProgram> mWriteXFace;
41  std::shared_ptr<ComputeProgram> mWriteYFace;
42  std::shared_ptr<ComputeProgram> mWriteZFace;
43  std::shared_ptr<Texture3> mPoisson0;
44  std::shared_ptr<Texture3> mPoisson1;
46 
47  // Shader source code as strings.
54  static std::string const* msZeroSource[ProgramFactory::PF_NUM_API];
55  static std::string const* msSolveSource[ProgramFactory::PF_NUM_API];
56  static std::string const* msEnforceSource[ProgramFactory::PF_NUM_API];
57 };
58 
59 inline std::shared_ptr<Texture3> const& Fluid3SolvePoisson::GetPoisson() const
60 {
61  return mPoisson0;
62 }
63 
64 }
65 
std::shared_ptr< Texture3 > mPoisson1
static std::string const msGLSLEnforceSource
static std::string const msHLSLEnforceSource
static std::string const msGLSLSolveSource
std::shared_ptr< ComputeProgram > mWriteYFace
std::shared_ptr< ComputeProgram > mZeroPoisson
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
static std::string const msHLSLZeroSource
std::shared_ptr< ComputeProgram > mWriteXFace
static std::string const msGLSLZeroSource
std::shared_ptr< ComputeProgram > mWriteZFace
static std::string const msHLSLSolveSource
std::shared_ptr< gte::Texture3 > const & GetPoisson() const
std::shared_ptr< ComputeProgram > mSolvePoisson
std::shared_ptr< Texture3 > mPoisson0
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63


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