Neo  0.5.0
Developer Documentation
ShaderRef.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 
25 
26 #ifndef __SHADER_REF_H
27 #define __SHADER_REF_H
28 
29 namespace Neo
30 {
31 
32 // shader types
34 {
37 };
38 
39 
40 // Shader ref
41 class NEO_ENGINE_EXPORT ShaderRef : public DataRef
42 {
43 private:
44 
45  // data
46  M_SHADER_TYPES m_type;
47  unsigned int m_shaderId;
48  String m_header;
49 
50 public:
51 
52  // constructor / destructor
53  ShaderRef(unsigned int shaderId, M_SHADER_TYPES type, const char * filename);
54  ~ShaderRef(void);
55 
56  // clear / destroy
57  void clear(void);
58  void destroy(void);
59 
60  // get new
61  static ShaderRef * getNew(unsigned int shaderId, M_SHADER_TYPES type, const char * filename);
62 
63 public:
64 
65  // update
66  void update(void);
67 
68  // type
69  int getType(void){ return M_REF_SHADER; }
70 
71  // data
72  inline void setShaderId(unsigned int shaderId){ m_shaderId = shaderId; }
73  inline unsigned int getShaderId(void){ return m_shaderId; }
74  inline M_SHADER_TYPES getShaderType(void){ return m_type; }
75  const char* getHeader() { return m_header.getSafeString(); }
76  void setHeader(const char* s) { m_header.set(s); }
77 };
78 }
79 #endif
void set(const char *data)
Copies the given string to the internal buffer.
int getType(void)
Definition: ShaderRef.h:69
Implements a framework for string manipulation that operates directly on C strings.
Definition: NeoString.h:35
Definition: DataManager.h:32
Definition: ShaderRef.h:36
void setHeader(const char *s)
Definition: ShaderRef.h:76
const char * getHeader()
Definition: ShaderRef.h:75
M_SHADER_TYPES
Definition: ShaderRef.h:33
void setShaderId(unsigned int shaderId)
Definition: ShaderRef.h:72
Definition: ShaderRef.h:41
const char * getSafeString(void)
Returns the C string. This method is ensured to return a valid C string and never NULL...
unsigned int getShaderId(void)
Definition: ShaderRef.h:73
M_SHADER_TYPES getShaderType(void)
Definition: ShaderRef.h:74
Definition: Color.h:29
Definition: ShaderRef.h:35