summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-09-02 23:13:40 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-09-02 23:13:40 -0300
commit1a2cb755e2d8b9d59178f36702f6dff7235b9088 (patch)
tree4a88f47c8b984522e36ac973accb34bdcb00363b /drivers
parent89fa70706f9166765c3ac3f799225a467800f065 (diff)
3D Physics and Other Stuff
-=-=-=-=-=-=-=-=-=-=-=-=-= -New Vehicle (Based on Bullet's RaycastVehicle) - Vehiclebody/VehicleWheel. Demo will come soon, old vehicle (CarBody) will go away soon too. -A lot of fixes to the 3D physics engine -Added KinematicBody with demo -Fixed the space query API for 2D (demo will come soon). 3D is WIP. -Fixed long-standing bug with body_enter/body_exit for Area and Area2D -Performance variables now includes physics (active bodies, collision pairs and islands) -Ability to see what's inside of instanced scenes! -Fixed Blend Shapes (no bs+skeleton yet) -Added an Android JavaClassWrapper singleton for using Android native classes directly from GDScript. This is very Alpha!
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index d55557bdbc..4a1362f9f8 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -1504,6 +1504,23 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
ERR_FAIL_COND((format&VS::ARRAY_FORMAT_VERTEX)==0); // mandatory
+ ERR_FAIL_COND( mesh->morph_target_count!=p_blend_shapes.size() );
+ if (mesh->morph_target_count) {
+ //validate format for morphs
+ for(int i=0;i<p_blend_shapes.size();i++) {
+
+ uint32_t bsformat=0;
+ Array arr = p_blend_shapes[i];
+ for(int j=0;j<arr.size();j++) {
+
+
+ if (arr[j].get_type()!=Variant::NIL)
+ bsformat|=(1<<j);
+ }
+
+ ERR_FAIL_COND( (bsformat)!=(format&(VS::ARRAY_FORMAT_BONES-1)));
+ }
+ }
Surface *surface = memnew( Surface );
ERR_FAIL_COND( !surface );
@@ -1701,7 +1718,9 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
surface->array_len=array_len;
surface->format=format;
surface->primitive=p_primitive;
+ surface->morph_target_count=mesh->morph_target_count;
surface->configured_format=0;
+ surface->mesh=mesh;
if (keep_copies) {
surface->data=p_arrays;
surface->morph_data=p_blend_shapes;
@@ -1735,6 +1754,17 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
surface->index_array_local = (uint8_t*)memalloc(index_array_len*surface->array[VS::ARRAY_INDEX].size);
index_array_ptr=(uint8_t*)surface->index_array_local;
}
+
+ if (mesh->morph_target_count) {
+
+ surface->morph_targets_local = memnew_arr(Surface::MorphTarget,mesh->morph_target_count);
+ for(int i=0;i<mesh->morph_target_count;i++) {
+
+ surface->morph_targets_local[i].array=memnew_arr(uint8_t,surface->local_stride*surface->array_len);
+ surface->morph_targets_local[i].configured_format=surface->morph_format;
+ _surface_set_arrays(surface,surface->morph_targets_local[i].array,NULL,p_blend_shapes[i],false);
+ }
+ }
}
@@ -4946,8 +4976,11 @@ Error RasterizerGLES2::_setup_geometry(const Geometry *p_geometry, const Materia
/* compute morphs */
+
if (p_morphs && surf->morph_target_count && can_copy_to_local) {
+
+
base = skinned_buffer;
stride=surf->local_stride;
@@ -7773,9 +7806,9 @@ void RasterizerGLES2::free(const RID& p_rid) {
for(int i=0;i<mesh->morph_target_count;i++) {
- memfree(surface->morph_targets_local[i].array);
+ memdelete_arr(surface->morph_targets_local[i].array);
}
- memfree(surface->morph_targets_local);
+ memdelete_arr(surface->morph_targets_local);
surface->morph_targets_local=NULL;
}