Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F96908
ShaderProgram.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ShaderProgram.h
View Options
#ifndef _ECHOSHADERPROGRAM_H_
#define _ECHOSHADERPROGRAM_H_
#include
<echo/Types.h>
#include
<echo/Graphics/VertexShader.h>
#include
<echo/Graphics/FragmentShader.h>
#include
<echo/Maths/Matrix4.h>
#include
<map>
namespace
Echo
{
//An internal structure for managing the shader resource
class
ShaderProgramResource
;
class
ShaderProgramVariable
;
class
ShaderProgram
{
public
:
//The constructor should allocate and/or assign the EShaderProgramResource
ShaderProgram
();
~
ShaderProgram
();
ShaderProgramResource
*
GetShaderProgramResource
()
const
{
return
mShaderProgramResource
;
}
void
SetShaderResource
(
ShaderProgramResource
*
val
)
{
mShaderProgramResource
=
val
;
}
// Adds a fragment shader
bool
AddFragmentShader
(
shared_ptr
<
FragmentShader
>
shader
);
//Adds vertex shader to be later linked
bool
AddVertexShader
(
shared_ptr
<
VertexShader
>
shader
);
//Links this program
bool
Link
();
//Setting active assigns all of the variables.
void
SetActive
();
void
SetInactive
();
//Setting an attribute stream passes a pointer to a stream of data that will be used for vertex attributes
//when the program is set to active. The streams must contain as much data as there are vertices.
bool
SetFloatAttributeStream
(
const
std
::
string
&
name
,
float
*
stream
);
bool
SetVector2AttributeStream
(
const
std
::
string
&
name
,
Vector2
*
stream
);
bool
SetVector3AttributeStream
(
const
std
::
string
&
name
,
Vector3
*
stream
);
bool
SetVector4AttributeStream
(
const
std
::
string
&
name
,
Vector4
*
stream
);
//These Get methods return a shared pointer that points to a value that can be changed so that when the program is
//set to active the value of the variables at that time will be the values of the uniform variables.
shared_ptr
<
float
>
GetFloat
(
const
std
::
string
&
name
);
shared_ptr
<
s32
>
GetInteger
(
const
std
::
string
&
name
);
shared_ptr
<
bool
>
GetBoolean
(
const
std
::
string
&
name
);
shared_ptr
<
Vector2
>
GetVector2
(
const
std
::
string
&
name
);
shared_ptr
<
Vector3
>
GetVector3
(
const
std
::
string
&
name
);
shared_ptr
<
Vector4
>
GetVector4
(
const
std
::
string
&
name
);
shared_ptr
<
Matrix3
>
GetMatrix3
(
const
std
::
string
&
name
);
shared_ptr
<
Matrix4
>
GetMatrix4
(
const
std
::
string
&
name
);
std
::
string
GetErrors
();
private
:
std
::
string
m_Source
;
bool
mLinked
;
bool
mActive
;
ShaderProgramResource
*
mShaderProgramResource
;
std
::
map
<
std
::
string
,
ShaderProgramVariable
*
>
mUniformProgramVariables
;
std
::
map
<
std
::
string
,
ShaderProgramVariable
*
>
mAttributeProgramVariables
;
};
}
#endif
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Thu, Dec 5, 1:58 AM (7 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63264
Default Alt Text
ShaderProgram.h (2 KB)
Attached To
Mode
rEE Echo 3
Attached
Detach File
Event Timeline
Log In to Comment