summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/graphics/shader.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core/graphics/shader.h')
-rw-r--r--source/modules/asura-core/graphics/shader.h74
1 files changed, 59 insertions, 15 deletions
diff --git a/source/modules/asura-core/graphics/shader.h b/source/modules/asura-core/graphics/shader.h
index 12d2f59..25b36dc 100644
--- a/source/modules/asura-core/graphics/shader.h
+++ b/source/modules/asura-core/graphics/shader.h
@@ -24,15 +24,6 @@ namespace AsuraEngine
namespace Graphics
{
- enum BuiltInUniforms
- {
- BUILTIN_UNIFORM_MODEL_MATRIX = 0,
- BUILTIN_UNIFORM_VIEW_MATRIX,
- BUILTIN_UNIFORM_PROJECTION_MATRIX,
-
- BUILTIN_UNIFORM_COUNT
- };
-
///
/// һshaderһڲʼ乲ijShaderuniformsͶݣֻṩ
/// uniformsuseɫķ༭ÿshaderͨshaderҵuniforms
@@ -48,7 +39,7 @@ namespace AsuraEngine
~Shader();
- bool Load(const std::string& vert, const std::string& frag);
+ bool Load(const std::string& vert, const std::string& frag) ASURA_THROW(Exception);
void OnUse();
void OnUnuse();
@@ -56,9 +47,21 @@ namespace AsuraEngine
///
/// öԣAsuraֻ֧2ά
///
- int GetAttributeLocation(const std::string& name);
- void SetAttribute(int loc, void* data, uint offset = 0, uint stride = 0);
- void SetAttribute(int loc, GPUBuffer* vbo, uint offset = 0, uint stride = 0);
+ //int GetAttributeLocation(const std::string& name);
+ //void SetAttribute(int loc, void* data, uint offset = 0, uint stride = 0);
+ //void SetAttribute(int loc, GPUBuffer* vbo, uint offset = 0, uint stride = 0);
+
+ ///
+ /// ǰö
+ ///
+ void SetAttribPosition(int size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
+ void SetAttribTangent(int size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
+ void SetAttribNormal(int size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
+ void SetAttribTexcoord0(int size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
+ void SetAttribTexcoord1(int size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
+ void SetAttribTexcoord2(int size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
+ void SetAttribTexcoord3(int size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
+ void SetAttribColor(int size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
///
/// uniform
@@ -113,11 +116,39 @@ namespace AsuraEngine
std::string GetProgramWarnings();
std::string GetShaderWarnings(GLuint shader);
-
+
+ ///
+ /// AsuraShader壬Ժuniformframeworkлshaderװ
+ /// ν壬ָshaderԶıⲿ򽻻ʱҪṩЩֵ
+ /// ĻҪ
+ ///
+ enum ASLSemantics
+ {
+ // MVP
+ SEMANTICS_UNIFORM_MODEL_MATRIX = 0,
+ SEMANTICS_UNIFORM_VIEW_MATRIX,
+ SEMANTICS_UNIFORM_PROJECTION_MATRIX,
+ //
+ SEMANTICS_ATTRIBUTE_POSITION,
+ //
+ SEMANTICS_ATTRIBUTE_TANGENT,
+ //
+ SEMANTICS_ATTRIBUTE_NORMAL,
+ // UV
+ SEMANTICS_ATTRIBUTE_TEXCOORD0,
+ SEMANTICS_ATTRIBUTE_TEXCOORD1,
+ SEMANTICS_ATTRIBUTE_TEXCOORD2,
+ SEMANTICS_ATTRIBUTE_TEXCOORD3,
+ // ɫ
+ SEMANTICS_ATTRIBUTE_COLOR,
+
+ SEMANTICS_COUNT
+ };
+
///
/// Asura shader ַͳһ
///
- static const char* ASLSemantics[BUILTIN_UNIFORM_COUNT];
+ static const char* SemanticsName[SEMANTICS_COUNT];
GLuint mProgram;
GLuint mVertShader;
@@ -133,6 +164,19 @@ namespace AsuraEngine
///
GLint mMVP[3];
+ ///
+ /// Եlocation
+ ///
+ GLint mPosition;
+ GLint mTangent;
+ GLint mNormal;
+ GLint mColor;
+ // ֧UV
+ GLint mTexcoord0;
+ GLint mTexcoord1;
+ GLint mTexcoord2;
+ GLint mTexcoord3;
+
};
}