GteFluid2EnforceStateBoundary.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 
12 #include <Graphics/GteTexture2.h>
13 
14 namespace gte
15 {
16 
17 class GraphicsEngine;
18 
20 {
21 public:
22  // Construction. Clamp the velocity vectors at the image boundary to
23  // ensure they do not point outside the domain. For example, let
24  // image(x,y) have velocity (vx,vy). At the boundary pixel (x,0),
25  // the velocity is clamped to (vx,0). At the boundary pixel (0,y), the
26  // velocity is clamped to (0,vy). The density is set to zero on the image
27  // boundary.
28  Fluid2EnforceStateBoundary(std::shared_ptr<ProgramFactory> const& factory,
29  int xSize, int ySize, int numXThreads, int numYThreads);
30 
31  // Set the density and velocity values at the image boundary as described
32  // in the comments for the constructor. The state texture has texels
33  // (velocity.x, velocity.y, 0, density).
34  void Execute(std::shared_ptr<GraphicsEngine> const& engine,
35  std::shared_ptr<Texture2> const& state);
36 
37 private:
38  int mNumXGroups, mNumYGroups;
39  std::shared_ptr<ComputeProgram> mCopyXEdge;
40  std::shared_ptr<ComputeProgram> mWriteXEdge;
41  std::shared_ptr<ComputeProgram> mCopyYEdge;
42  std::shared_ptr<ComputeProgram> mWriteYEdge;
43  std::shared_ptr<Texture1> mXMin;
44  std::shared_ptr<Texture1> mXMax;
45  std::shared_ptr<Texture1> mYMin;
46  std::shared_ptr<Texture1> mYMax;
47 
48  // Shader source code as strings.
49  static std::string const msGLSLSource;
50  static std::string const msHLSLSource;
51  static std::string const* msSource[ProgramFactory::PF_NUM_API];
52 };
53 
54 }
std::shared_ptr< ComputeProgram > mCopyXEdge
std::shared_ptr< ComputeProgram > mWriteXEdge
std::shared_ptr< ComputeProgram > mWriteYEdge
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
std::shared_ptr< ComputeProgram > mCopyYEdge
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63


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