From 247e7ed716a4c0bd5140c2b2a938f7118e84fb14 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 2 Sep 2014 23:13:40 -0300 Subject: 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! --- drivers/gles2/rasterizer_gles2.cpp | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'drivers/gles2/rasterizer_gles2.cpp') 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;iarray_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;imorph_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;imorph_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; } -- cgit v1.2.3