summaryrefslogtreecommitdiff
path: root/scene/resources/shader.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/shader.h')
-rw-r--r--scene/resources/shader.h56
1 files changed, 24 insertions, 32 deletions
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index 59d7601d98..b7fa349dfe 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -29,14 +29,14 @@
#ifndef SHADER_H
#define SHADER_H
-#include "resource.h"
#include "io/resource_loader.h"
+#include "resource.h"
#include "scene/resources/texture.h"
class Shader : public Resource {
- GDCLASS(Shader,Resource);
- OBJ_SAVE_TYPE( Shader );
+ GDCLASS(Shader, Resource);
+ OBJ_SAVE_TYPE(Shader);
RES_BASE_EXTENSION("shd");
public:
@@ -47,6 +47,7 @@ public:
MODE_PARTICLES,
MODE_MAX
};
+
private:
RID shader;
Mode mode;
@@ -55,37 +56,31 @@ private:
// shaders keep a list of ShaderMaterial -> VisualServer name translations, to make
// convertion fast and save memory.
mutable bool params_cache_dirty;
- mutable Map<StringName,StringName> params_cache; //map a shader param to a material param..
- Map<StringName,Ref<Texture> > default_textures;
-
-
+ mutable Map<StringName, StringName> params_cache; //map a shader param to a material param..
+ Map<StringName, Ref<Texture> > default_textures;
protected:
-
-
-
static void _bind_methods();
-public:
-
+public:
//void set_mode(Mode p_mode);
Mode get_mode() const;
- void set_code( const String& p_code);
+ void set_code(const String &p_code);
String get_code() const;
void get_param_list(List<PropertyInfo> *p_params) const;
- bool has_param(const StringName& p_param) const;
+ bool has_param(const StringName &p_param) const;
- void set_default_texture_param(const StringName& p_param, const Ref<Texture> &p_texture);
- Ref<Texture> get_default_texture_param(const StringName& p_param) const;
- void get_default_texture_param_list(List<StringName>* r_textures) const;
+ void set_default_texture_param(const StringName &p_param, const Ref<Texture> &p_texture);
+ Ref<Texture> get_default_texture_param(const StringName &p_param) const;
+ void get_default_texture_param_list(List<StringName> *r_textures) const;
- _FORCE_INLINE_ StringName remap_param(const StringName& p_param) const {
+ _FORCE_INLINE_ StringName remap_param(const StringName &p_param) const {
if (params_cache_dirty)
get_param_list(NULL);
- const Map<StringName,StringName>::Element *E=params_cache.find(p_param);
+ const Map<StringName, StringName>::Element *E = params_cache.find(p_param);
if (E)
return E->get();
return StringName();
@@ -95,38 +90,35 @@ public:
Shader(Mode p_mode);
~Shader();
-
};
-VARIANT_ENUM_CAST( Shader::Mode );
+VARIANT_ENUM_CAST(Shader::Mode);
class SpatialShader : public Shader {
- GDCLASS(SpatialShader,Shader);
+ GDCLASS(SpatialShader, Shader);
public:
-
- SpatialShader() : Shader(MODE_SPATIAL) {};
+ SpatialShader()
+ : Shader(MODE_SPATIAL){};
};
class CanvasItemShader : public Shader {
- GDCLASS(CanvasItemShader,Shader);
+ GDCLASS(CanvasItemShader, Shader);
public:
-
- CanvasItemShader() : Shader(MODE_CANVAS_ITEM) {};
+ CanvasItemShader()
+ : Shader(MODE_CANVAS_ITEM){};
};
-
class ParticlesShader : public Shader {
- GDCLASS(ParticlesShader,Shader);
+ GDCLASS(ParticlesShader, Shader);
public:
-
- ParticlesShader() : Shader(MODE_PARTICLES) {};
+ ParticlesShader()
+ : Shader(MODE_PARTICLES){};
};
-
#endif // SHADER_H