summaryrefslogtreecommitdiff
path: root/scene/resources/material.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-05-29 10:56:39 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-05-29 10:56:39 -0300
commit6f0b4678e26c04abfc88c0226c803e78a108de98 (patch)
tree51b99b2ece75e5782c0b14c97bb6913c48e7f363 /scene/resources/material.cpp
parentd9adf2627a70ab37408aca9ae4140c6280dfe6df (diff)
More 3D Improvements
-=-=-=-=-=-=-=-=-=-= -Sprite3D and AnimatedSprite3D support. -Opaque pre-pass works, is compatible with shadows -Improved shadow map rendering (can differentiate between plain opaque and opaque with shaders/discard/etc) -Added option to use alpha discard in FixedMaterial -Improved Glow FX, many more options (three modes, Additive, Screen and SoftLight), strength and scale -Ability for Background (image or cubemap) to send to glow buffer -Dumb Deploy of clients now actually works in Android -Many Many rendering fixes, 3D is much more usable now.
Diffstat (limited to 'scene/resources/material.cpp')
-rw-r--r--scene/resources/material.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 2ddfa1078b..091a46d4ab 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -45,6 +45,7 @@ static const char*_hint_names[Material::HINT_MAX]={
"opaque_pre_zpass",
"no_shadow",
"no_depth_draw",
+ "no_alpha_depth_draw",
};
static const Material::Flag _flag_indices[Material::FLAG_MAX]={
@@ -175,6 +176,7 @@ void Material::_bind_methods() {
BIND_CONSTANT( HINT_OPAQUE_PRE_PASS );
BIND_CONSTANT( HINT_NO_SHADOW );
BIND_CONSTANT( HINT_NO_DEPTH_DRAW );
+ BIND_CONSTANT( HINT_NO_DEPTH_DRAW_FOR_ALPHA );
BIND_CONSTANT( HINT_MAX );
BIND_CONSTANT( SHADE_MODEL_LAMBERT );
@@ -208,6 +210,7 @@ Material::Material(const RID& p_material) {
for(int i=0;i<HINT_MAX;i++)
hints[i]=false;
+ hints[HINT_NO_DEPTH_DRAW_FOR_ALPHA]=true;
blend_mode=BLEND_MODE_MIX;
shade_model = SHADE_MODEL_LAMBERT;
@@ -365,14 +368,14 @@ Material::BlendMode FixedMaterial::get_detail_blend_mode() const {
}
void FixedMaterial::set_fixed_flag(FixedFlag p_flag, bool p_value) {
- ERR_FAIL_INDEX(p_flag,3);
+ ERR_FAIL_INDEX(p_flag,4);
fixed_flags[p_flag]=p_value;
VisualServer::get_singleton()->fixed_material_set_flag(material,(VS::FixedMaterialFlags)p_flag,p_value);
}
bool FixedMaterial::get_fixed_flag(FixedFlag p_flag) const {
- ERR_FAIL_INDEX_V(p_flag,3,false);
+ ERR_FAIL_INDEX_V(p_flag,4,false);
return fixed_flags[p_flag];
}
@@ -419,6 +422,7 @@ void FixedMaterial::_bind_methods() {
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/use_alpha" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_USE_ALPHA);
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/use_color_array" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_USE_COLOR_ARRAY);
ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/use_point_size" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_USE_POINT_SIZE);
+ ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "fixed_flags/discard_alpha" ), _SCS("set_fixed_flag"), _SCS("get_fixed_flag"), FLAG_DISCARD_ALPHA);
ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "params/diffuse" ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_DIFFUSE);
ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "params/specular", PROPERTY_HINT_COLOR_NO_ALPHA ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_SPECULAR );
ADD_PROPERTYI( PropertyInfo( Variant::COLOR, "params/emission", PROPERTY_HINT_COLOR_NO_ALPHA ), _SCS("set_parameter"), _SCS("get_parameter"), PARAM_EMISSION );
@@ -457,6 +461,7 @@ void FixedMaterial::_bind_methods() {
BIND_CONSTANT( FLAG_USE_ALPHA );
BIND_CONSTANT( FLAG_USE_COLOR_ARRAY );
BIND_CONSTANT( FLAG_USE_POINT_SIZE );
+ BIND_CONSTANT( FLAG_DISCARD_ALPHA );
}