diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-05-29 10:56:39 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-05-29 10:56:39 -0300 |
commit | 6f0b4678e26c04abfc88c0226c803e78a108de98 (patch) | |
tree | 51b99b2ece75e5782c0b14c97bb6913c48e7f363 /scene/3d/immediate_geometry.cpp | |
parent | d9adf2627a70ab37408aca9ae4140c6280dfe6df (diff) | |
download | redot-engine-6f0b4678e26c04abfc88c0226c803e78a108de98.tar.gz |
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/3d/immediate_geometry.cpp')
-rw-r--r-- | scene/3d/immediate_geometry.cpp | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp new file mode 100644 index 0000000000..1459f2c362 --- /dev/null +++ b/scene/3d/immediate_geometry.cpp @@ -0,0 +1,102 @@ +#include "immediate_geometry.h" + + +void ImmediateGeometry::begin(Mesh::PrimitiveType p_primitive,const Ref<Texture>& p_texture) { + + VS::get_singleton()->immediate_begin(im,(VS::PrimitiveType)p_primitive,p_texture.is_valid()?p_texture->get_rid():RID()); + if (p_texture.is_valid()) + cached_textures.push_back(p_texture); + +} + +void ImmediateGeometry::set_normal(const Vector3& p_normal){ + + VS::get_singleton()->immediate_normal(im,p_normal); +} + +void ImmediateGeometry::set_tangent(const Plane& p_tangent){ + + VS::get_singleton()->immediate_tangent(im,p_tangent); + +} + +void ImmediateGeometry::set_color(const Color& p_color){ + + VS::get_singleton()->immediate_color(im,p_color); + +} + +void ImmediateGeometry::set_uv(const Vector2& p_uv){ + + VS::get_singleton()->immediate_uv(im,p_uv); + +} + +void ImmediateGeometry::set_uv2(const Vector2& p_uv2){ + + VS::get_singleton()->immediate_uv2(im,p_uv2); + +} + +void ImmediateGeometry::add_vertex(const Vector3& p_vertex){ + + VS::get_singleton()->immediate_vertex(im,p_vertex); + if (empty) { + aabb.pos=p_vertex; + aabb.size=Vector3(); + } else { + aabb.expand_to(p_vertex); + } +} + +void ImmediateGeometry::end(){ + + VS::get_singleton()->immediate_end(im); + +} + +void ImmediateGeometry::clear(){ + + VS::get_singleton()->immediate_clear(im); + empty=true; + cached_textures.clear(); + +} + +AABB ImmediateGeometry::get_aabb() const { + + return aabb; +} +DVector<Face3> ImmediateGeometry::get_faces(uint32_t p_usage_flags) const { + + return DVector<Face3>(); +} + +void ImmediateGeometry::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("begin","primitive","texture:Texture"),&ImmediateGeometry::begin); + ObjectTypeDB::bind_method(_MD("set_normal","normal"),&ImmediateGeometry::set_normal); + ObjectTypeDB::bind_method(_MD("set_tangent","tangent"),&ImmediateGeometry::set_tangent); + ObjectTypeDB::bind_method(_MD("set_color","color"),&ImmediateGeometry::set_color); + ObjectTypeDB::bind_method(_MD("set_uv","uv"),&ImmediateGeometry::set_uv); + ObjectTypeDB::bind_method(_MD("set_uv2","uv"),&ImmediateGeometry::set_uv2); + ObjectTypeDB::bind_method(_MD("add_vertex","color"),&ImmediateGeometry::add_vertex); + ObjectTypeDB::bind_method(_MD("end"),&ImmediateGeometry::end); + ObjectTypeDB::bind_method(_MD("clear"),&ImmediateGeometry::clear); + +} + +ImmediateGeometry::ImmediateGeometry() { + + im = VisualServer::get_singleton()->immediate_create(); + set_base(im); + empty=true; + +} + + +ImmediateGeometry::~ImmediateGeometry() { + + VisualServer::get_singleton()->free(im); + +} |