GteFluid2InitializeState.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. The initial velocity is zero and the initial density
23  // is randomly generated with values in [0,1].
24  Fluid2InitializeState(std::shared_ptr<ProgramFactory> const& factory,
25  int xSize, int ySize, int numXThreads, int numYThreads);
26 
27  // Member access. The texels are (velocity.x, velocity.y, 0, density).
28  // The third component is unused in the simulation (a 3D simulation will
29  // store velocity.z in this component).
30  inline std::shared_ptr<Texture2> const& GetStateTm1() const;
31  inline std::shared_ptr<Texture2> const& GetStateT() const;
32 
33  // Compute the initial density and initial velocity for the fluid
34  // simulation.
35  void Execute(std::shared_ptr<GraphicsEngine> const& engine);
36 
37 private:
38  int mNumXGroups, mNumYGroups;
39  std::shared_ptr<ComputeProgram> mInitializeState;
40  std::shared_ptr<Texture2> mDensity;
41  std::shared_ptr<Texture2> mVelocity;
42  std::shared_ptr<Texture2> mStateTm1;
43  std::shared_ptr<Texture2> mStateT;
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& Fluid2InitializeState::GetStateTm1() const
52 {
53  return mStateTm1;
54 }
55 
56 inline std::shared_ptr<Texture2> const& Fluid2InitializeState::GetStateT() const
57 {
58  return mStateT;
59 }
60 
61 }
static std::string const msHLSLSource
std::shared_ptr< Texture2 > mStateTm1
static std::string const msGLSLSource
std::shared_ptr< Texture2 > mVelocity
std::shared_ptr< Texture2 > mDensity
std::shared_ptr< ComputeProgram > mInitializeState
std::shared_ptr< Texture2 > const & GetStateTm1() const
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
std::shared_ptr< Texture2 > mStateT
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
std::shared_ptr< Texture2 > const & GetStateT() const


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