GteTexture2Effect.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.1 (2016/11/13)
7 
8 #pragma once
9 
11 #include <Graphics/GteTexture2.h>
13 
14 namespace gte
15 {
16 
18 {
19 public:
20  // Constructionn.
21  Texture2Effect(std::shared_ptr<ProgramFactory> const& factory,
22  std::shared_ptr<Texture2> const& texture, SamplerState::Filter filter,
23  SamplerState::Mode mode0, SamplerState::Mode mode1);
24 
25  // Member access.
26  inline void SetPVWMatrix(Matrix4x4<float> const& pvwMatrix);
27  inline Matrix4x4<float> const& GetPVWMatrix() const;
28 
29  // Required to bind and update resources.
30  inline std::shared_ptr<ConstantBuffer> const& GetPVWMatrixConstant() const;
31  inline std::shared_ptr<Texture2> const& GetTexture() const;
32  inline std::shared_ptr<SamplerState> const& GetSampler() const;
33 
34  void SetPVWMatrixConstant(std::shared_ptr<ConstantBuffer> const& pvwMatrix);
35 
36 private:
37  // Vertex shader parameters.
38  std::shared_ptr<ConstantBuffer> mPVWMatrixConstant;
39 
40  // Pixel shader parameters.
41  std::shared_ptr<Texture2> mTexture;
42  std::shared_ptr<SamplerState> mSampler;
43 
44  // Convenience pointer.
46 
47  // Shader source code as strings.
50  static std::string const msHLSLSource;
51  static std::string const* msVSSource[ProgramFactory::PF_NUM_API];
52  static std::string const* msPSSource[ProgramFactory::PF_NUM_API];
53 };
54 
55 
56 inline void Texture2Effect::SetPVWMatrix(Matrix4x4<float> const& pvwMatrix)
57 {
58  *mPVWMatrix = pvwMatrix;
59 }
60 
62 {
63  return *mPVWMatrix;
64 }
65 
66 inline std::shared_ptr<ConstantBuffer> const&
68 {
69  return mPVWMatrixConstant;
70 }
71 
72 inline std::shared_ptr<Texture2> const& Texture2Effect::GetTexture() const
73 {
74  return mTexture;
75 }
76 
77 inline std::shared_ptr<SamplerState> const& Texture2Effect::GetSampler() const
78 {
79  return mSampler;
80 }
81 
82 
83 }
std::shared_ptr< ConstantBuffer > const & GetPVWMatrixConstant() const
std::shared_ptr< Texture2 > mTexture
static std::string const msGLSLVSSource
void SetPVWMatrix(Matrix4x4< float > const &pvwMatrix)
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
GLuint texture
Definition: glcorearb.h:410
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1292
Matrix4x4< float > * mPVWMatrix
std::shared_ptr< SamplerState > mSampler
std::shared_ptr< SamplerState > const & GetSampler() const
static std::string const msGLSLPSSource
std::shared_ptr< Texture2 > const & GetTexture() const
std::shared_ptr< ConstantBuffer > mPVWMatrixConstant
static std::string const msHLSLSource
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
Matrix4x4< float > const & GetPVWMatrix() const


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:01