Ion: gfx/shaderprogram.h Source File

1 

18 #ifndef ION_GFX_SHADERPROGRAM_H_

19 #define ION_GFX_SHADERPROGRAM_H_

20 

24 

25 namespace ion {

26 namespace gfx {

27 

28 class ShaderInputRegistry;

30 

32 class ShaderProgram;

35 

39  public:

42  kVertexShaderChanged = kNumBaseChanges,

44  kNumChanges

45  };

46 

49 

52 

55  if (Shader* old_shader = vertex_shader_.Get().Get())

56  old_shader->RemoveReceiver(this);

57  vertex_shader_.Set(shader);

58  if (shader.Get())

59  shader->AddReceiver(this);

60  }

62  return vertex_shader_.Get();

63  }

64 

67  if (Shader* old_shader = fragment_shader_.Get().Get())

68  old_shader->RemoveReceiver(this);

69  fragment_shader_.Set(shader);

70  if (shader.Get())

71  shader->AddReceiver(this);

72  }

74  return fragment_shader_.Get();

75  }

76 

88  void SetConcurrent(bool value);

90 

99  const std::string& id_string,

101  const std::string& vertex_shader_string,

102  const std::string& fragment_shader_string,

104 

105  protected:

109 

110  private:

112  void OnNotify(const base::Notifier* notifier) override;

113 

114  Field<ShaderPtr> vertex_shader_;

115  Field<ShaderPtr> fragment_shader_;

118  bool concurrent_;

120  bool concurrent_set_;

121 };

122 

123 }

124 }

125 

126 #endif // ION_GFX_SHADERPROGRAM_H_

void SetVertexShader(const ShaderPtr &shader)

Sets/returns the vertex shader stage.

Changes

Changes that affect the resource.

A ShaderProgram represents an OpenGL shader program that can be applied to shapes.

A Notifier both sends notifications to and receives notifications from other Notifiers.

const ShaderPtr & GetVertexShader() const

base::WeakReferentPtr< ShaderProgram > ShaderProgramWeakPtr

const ShaderPtr & GetFragmentShader() const

base::ReferentPtr< ShaderProgram >::Type ShaderProgramPtr

SharedPtr< ShaderInputRegistry > Type

const ShaderInputRegistryPtr & GetRegistry() const

Returns the ShaderInputRegistry used for the instance.

A Shader represents an OpenGL shader stage.

void SetFragmentShader(const ShaderPtr &shader)

Sets/returns the fragment shader stage.

base::ReferentPtr< ShaderInputRegistry >::Type ShaderInputRegistryPtr

Convenience typedef for shared pointer to a ShaderInputRegistry.

Base class for Shader and ShaderProgram objects.

bool IsConcurrent() const

A WeakReferentPtr is a weak reference to an instance of some class derived from Referent.